@docx-editor.dev/react 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- 'use strict';var Ye=require('react'),editor=require('@docx-editor.dev/core/editor'),i18n=require('@docx-editor.dev/i18n'),jsxRuntime=require('react/jsx-runtime'),reactDom=require('react-dom'),classVarianceAuthority=require('class-variance-authority'),clsx=require('clsx'),pe=require('@radix-ui/react-select'),editor$1=require('@docx-editor.dev/core/contracts/editor');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Ye__namespace=/*#__PURE__*/_interopNamespace(Ye);var pe__namespace=/*#__PURE__*/_interopNamespace(pe);var Kf=Object.defineProperty;var zf=(e,t,n)=>t in e?Kf(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n;var nt=(e,t,n)=>zf(e,typeof t!="symbol"?t+"":t,n);var pc="(prefers-color-scheme: dark)";function mc(){return typeof window<"u"&&typeof window.matchMedia=="function"}function fc(){return mc()?window.matchMedia(pc).matches:false}function gc(e,t){return e==="dark"||e==="system"&&t}function bc(e){if(!mc())return ()=>{};let t=window.matchMedia(pc);e(t.matches);let n=o=>e(o.matches);return t.addEventListener("change",n),()=>t.removeEventListener("change",n)}var wi=Ye.createContext(null);function A(){return Ye.useContext(wi)}var St=Ye.createContext(null);var Mi=Ye.createContext(i18n.en),Ii=Ye.createContext("en");function wo({i18n:e,children:t}){let n=Ye.useContext(Mi),o=Ye.useContext(Ii),r=typeof e?._lang=="string"?e._lang:o,a=Ye.useMemo(()=>i18n.deepMerge(n,e),[n,e]);return jsxRuntime.jsx(Ii.Provider,{value:r,children:jsxRuntime.jsx(Mi.Provider,{value:a,children:t})})}function _(){let e=Ye.useContext(Mi),t=Ye.useContext(Ii);return {t:Ye.useMemo(()=>i18n.createT(e,t),[e,t])}}function Tc(e){let{t}=_();return Ye.useCallback((n,o)=>e?.get(n)??t(n,o),[e,t])}var sn=Object.freeze({scope:Object.freeze({kind:"body"}),isLoading:true,parseError:null,editable:false,zoom:1,selection:null,selectionCollapsed:true,formatting:null,table:null,tocContext:null,image:null,page:Object.freeze({current:0,total:0}),canUndo:false,canRedo:false});var jf=()=>{};function Qf(e){let t=false;return ()=>{if(t)return;t=true;let n=globalThis.navigator?.scheduling,o=()=>{t=false,e();};n?.isInputPending?.({includeContinuous:true})?setTimeout(o,0):queueMicrotask(o);}}function q(e,t=Object.is,n){let o=A(),r=n?.onSubscribe,a=n?.onUnsubscribe,i=Ye.useCallback(d=>{if(!o)return jf;let p=false;r?.();let f=Qf(()=>{p||d();}),m=[o.on("change",f),o.on("selectionChange",f),o.on("error",f)];return ()=>{p=true,a?.();for(let g of m)g();}},[o,r,a]),s=Ye.useMemo(()=>{let d=false,p,f;return m=>{if(d&&m===p)return f;let g=e(m);return d&&t(f,g)?(p=m,f):(d=true,p=m,f=g,g)}},[o,e,t]),c=Ye.useCallback(()=>s(o?o.snapshot():sn),[o,s]),l=Ye.useCallback(()=>s(sn),[s]);return Ye.useSyncExternalStore(i,c,l)}var Pc=12700,Cc=96;function o0(e){return e==="image/png"||e==="image/jpeg"||e==="image/gif"}function n0(e,t,n,o){let r=e*72/n,a=t*72/o;return {widthPoints:Math.max(1,Math.round(r*100)/100),heightPoints:Math.max(1,Math.round(a*100)/100)}}function kr(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(!o0(n))return n==="image/svg+xml"||n==="image/tiff"?{ok:false,reasonKey:"imageInsert.errors.unsupportedFormat"}:{ok:false,reasonKey:"imageInsert.errors.invalidSignature"};let o=editor.validateRasterHeader(e,n);if(!o)return {ok:false,reasonKey:"imageInsert.errors.invalidSignature"};if(o.pixelWidth*o.pixelHeight>t.maxPixels||o.pixelWidth>t.maxDimension||o.pixelHeight>t.maxDimension)return {ok:false,reasonKey:"imageInsert.errors.oversize"};let{widthPoints:a,heightPoints:i}=n0(o.pixelWidth,o.pixelHeight,Cc,Cc);return Object.freeze({ok:true,bytes:e,mime:n,widthPoints:a,heightPoints:i})}function kt(e){return Math.round(e/Pc*100)/100}function cn(e){return Math.round(e*Pc)}var dn=Ye.createContext({t:void 0,onSave:void 0});function Ri(e){let{t}=_();return n=>e?.(n)??t(n)}function Y(){let{t:e}=Ye.useContext(dn);return Ri(e)}function d0(e,t){return e.active===t.active&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason}function _i(e){return typeof e=="string"}function u0(e){return JSON.stringify(e,Object.keys(e).sort())}function ne(e){let t=A(),n=_i(e)?e:u0(e),o=Ye.useRef(e);o.current=e;let r=Ye.useCallback(s=>{let c=o.current;if(_i(c)){let d=editor.toolbarCommandState(t,c);return {active:d.active,enabled:d.enabled,disabledReason:d.disabledReason}}if(!t)return {active:false,enabled:false,disabledReason:null};let l=t.can(c);return {active:t.isActive(c),enabled:l.ok,disabledReason:l.ok?null:l.reason??null}},[t,n]),a=q(r,d0),i=Ye.useCallback(()=>{let s=o.current;return _i(s)?editor.runToolbarCommand(t,s).ok:t?t.exec(s).ok:false},[t,n]);return Ye.useMemo(()=>({execute:i,isActive:a.active,isEnabled:a.enabled,disabledReason:a.disabledReason}),[i,a])}function g0(e,t){return typeof t!="function"?e:typeof e!="function"?t:n=>{e(n),n.defaultPrevented||t(n);}}function b0(e,t){let n={...e,...t};for(let o of Object.keys(e))/^on[A-Z]/.test(o)?n[o]=g0(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 W({children:e,...t}){let n=Ye.Children.only(e);if(!Ye.isValidElement(n))return null;let o=n.props,r=b0(t,o),a=n.ref,i=t.ref;return (a||i)&&(r.ref=s=>{for(let c of [a,i])typeof c=="function"?c(s):c&&typeof c=="object"&&(c.current=s);}),Ye.cloneElement(n,r)}function ee(e){for(let t of editor.CHROME_GROUPS)for(let n of t.controls)if(editor.chromeSlotId(t,n)===e)return n;return null}function te(e){return e?jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:18,height:18,"aria-hidden":"true",focusable:"false",children:e.map(t=>jsxRuntime.jsx("path",{d:t,fill:"currentColor"},t))}):null}function O(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function Xt(e){let{slot:t,icon:n,asChild:o,className:r,children:a,hidden:i}=e,{execute:s,isActive:c,isEnabled:l,disabledReason:d}=ne(t),p=Y();if(i)return null;let f=ee(t),m=p(f?.labelKey??t),g=editor.commandForSlot(t),u=g?.type==="toggleMark"||g?.type==="setAlignment",h={onClick:()=>s(),onMouseDown:O,disabled:!l,"data-slot":t,className:`docx-toolbar__button${r?` ${r}`:""}`,...c?{"data-active":""}:{},...l?{}:{"data-disabled":""},...u?{"aria-pressed":c}:{},"aria-label":m,title:d??m};return o?jsxRuntime.jsx(W,{...h,children:a}):jsxRuntime.jsx("button",{type:"button",...h,children:n??a??te(f?.paths)})}Xt.docxToolbarPart=true;var P0="image/png,image/jpeg,image/gif",Di=Ye.createContext(null);function _r(){let e=Ye.useContext(Di);if(!e)throw new Error("useImageInsert must be used within ImageInsertProvider");return e}function Li(){return Ye.useContext(Di)}function Nr({children:e}){let t=A(),{t:n}=_(),o=Ye.useRef(null),r=Ye.useRef(false),a=Ye.useCallback(()=>editor.toolbarCommandState(t,"image.insert"),[t]),i=q(a,(u,h)=>u.enabled===h.enabled&&u.disabledReason===h.disabledReason),s=i.enabled,c=i.disabledReason,l=Ye.useCallback(async u=>{if(!t||r.current)return;let h=kr(u);if(!h.ok){window.alert(n(h.reasonKey));return}let b={type:"insertImage",data:h.bytes,mime:h.mime,widthPoints:h.widthPoints,heightPoints:h.heightPoints},v=t.canExecuteImageCommand?.(b);if(v&&!v.ok){window.alert(v.reason??n("imageInsert.errors.refused"));return}r.current=true;try{let C=await editor.executeImageCommand(t,b);C.ok?t.focus():window.alert(C.reason??n("imageInsert.errors.refused"));}finally{r.current=false;}},[t,n]),d=Ye.useCallback(async u=>{let h=u?.[0];if(!h)return;let b=await h.arrayBuffer();await l(new Uint8Array(b));},[l]),p=Ye.useCallback(async u=>{if(!u)return;let h=[...u.files].find(b=>b.type.startsWith("image/"));if(h){await d([h]);return}for(let b of u.items){if(b.kind!=="file"||!b.type.startsWith("image/"))continue;let v=b.getAsFile();if(!v)continue;let C=await v.arrayBuffer();await l(new Uint8Array(C));return}},[l,d]),f=Ye.useCallback(()=>{s&&o.current?.click();},[s]),m=Ye.useCallback(async u=>{let h=u.currentTarget;await d(h.files),h.value="";},[d]),g=Ye.useMemo(()=>({openFilePicker:f,insertFromFileList:d,insertFromDataTransfer:p,isEnabled:s,disabledReason:c,inputRef:o,onInputChange:m}),[f,d,p,s,c,m]);return jsxRuntime.jsxs(Di.Provider,{value:g,children:[jsxRuntime.jsx("input",{ref:o,type:"file",accept:P0,className:"docx-image-insert__input",tabIndex:-1,"aria-hidden":"true",onChange:m,onMouseDown:u=>u.stopPropagation()}),e]})}function Dr({className:e,hidden:t,asChild:n,children:o}){let{openFilePicker:r,isEnabled:a,disabledReason:i}=_r(),s=Y();if(t)return null;let c=ee("image.insert"),l=s(c?.labelKey??"toolbar.image"),d={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"image.insert",disabled:!a,...a?{}:{"data-disabled":""},"aria-label":l,title:i??l,onMouseDown:O,onClick:r};return n?jsxRuntime.jsx(W,{...d,children:o}):jsxRuntime.jsx("button",{...d,children:o??te(c?.paths)})}Dr.docxSlot="image.insert";var un=Object.assign(Dr,{docxSlot:"image.insert"});var F0=["nw","n","ne","e","se","s","sw","w"],Nc=40,Dc=12;function A0(e){return `imageOverlay.handle.${e}`}function O0(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 Z0(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 B0(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 Hi({containerRef:e,portalRef:t,scrollPort:n}){let o=A(),{t:r}=_(),[a,i]=Ye.useState(null),[s,c]=Ye.useState(null),l=Ye.useRef(null);l.current=s;let d=Ye.useRef(null),p=Ye.useRef(null),f=Ye.useRef(null),m=Ye.useRef(null),g=Ye.useRef(null);Ye.useEffect(()=>{let S=e.current;if(!S)return;let y=x=>{let E=(x.target instanceof Element?x.target:null)?.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id");m.current=E??null,E&&E===a?.id&&queueMicrotask(()=>f.current?.focus({preventScroll:true}));};return S.addEventListener("pointerdown",y,{capture:true}),()=>S.removeEventListener("pointerdown",y,{capture:true})},[e,a?.id]),Ye.useEffect(()=>{if(!o){i(null);return}let S=()=>{i(editor.selectedDrawingOverlayTargetOf(o.surface));},y=()=>{queueMicrotask(S);};S();let x=[o.on("change",y),o.on("selectionChange",S)];return ()=>{for(let M of x)M();}},[o]),Ye.useEffect(()=>{if(n){g.current=n;return}let S=e.current;if(!S||!o?.surface)return;let y=S.closest(".docx-editor__scroll-container");if(!y)return;let x=o.surface.overlayCoordinates();return g.current=editor.createImageOverlayScrollPort(y,x.paintScale),()=>{g.current=null;}},[e,o,n]);let u=Ye.useCallback(()=>{c(null),d.current=null;let S=p.current;if(p.current=null,S)try{S.releasePointerCapture(S._lastPointerId??0);}catch{}},[]),h=Ye.useCallback((S,y,x,M,E,w,N)=>{if(!o?.surface)return;let F=editor.captureImageMutationPreconditions(o);if(!F)return;let H=o.surface.publishedLayout();d.current=Object.freeze({x:M,y:E}),p.current=w,w._lastPointerId=N;try{w.setPointerCapture(N);}catch{}c({session:Object.freeze({drawingNodeId:x.id,startBounds:Object.freeze({x:x.x,y:x.y,width:x.width,height:x.height}),startWidthEmu:x.widthEmu,startHeightEmu:x.heightEmu,startPosition:x.position,anchorFrameOrigin:x.anchorFrameOrigin,transform:x.transform,mode:S,handle:y,preconditions:F,layoutRevision:H.revision,packageRevision:o.surface.session.packageRevision(),kind:x.kind}),bounds:x,accumulatedScrollPt:0}),f.current?.focus({preventScroll:true});},[o]),b=Ye.useCallback((S,y,x,M,E)=>{if(!o)return;if(editor.isStaleImageInteractionCommit(o,S)){u();return}S.mode==="resize"?o.exec({type:"setImageProperties",widthEmu:y,heightEmu:x,...E?.mode==="simple"?{horizontalEmu:E.horizontalEmu,verticalEmu:E.verticalEmu}:{},...E?.mode==="frame"?{...E.horizontalEmu!==void 0?{horizontalEmu:E.horizontalEmu}:{},...E.verticalEmu!==void 0?{verticalEmu:E.verticalEmu}:{}}:{}}):S.mode==="move"&&E&&o.exec({type:"setImagePosition",...E}),u();},[u,o]),v=Ye.useCallback(S=>{if(!o)return;let y=l.current?.bounds??editor.selectedDrawingOverlayTargetOf(o.surface);if(!y)return;if(l.current&&S.key==="Escape"){S.preventDefault(),S.stopPropagation(),u();return}if(l.current)return;let x=S.shiftKey?editor.IMAGE_OVERLAY_NUDGE_SHIFT_PT:editor.IMAGE_OVERLAY_NUDGE_PT;if(S.key==="Delete"||S.key==="Backspace"){S.preventDefault(),S.stopPropagation(),o.exec({type:"deleteImage"});return}if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(S.key))return;S.preventDefault(),S.stopPropagation();let M=S.key==="ArrowLeft"?-x:S.key==="ArrowRight"?x:0,E=S.key==="ArrowUp"?-x:S.key==="ArrowDown"?x:0;if(S.altKey){if(!y.canResize)return;let N=B0(M,E),F=editor.computeImageResizeResult({handle:N,startWidthEmu:y.widthEmu,startHeightEmu:y.heightEmu,startBounds:{x:y.x,y:y.y,width:y.width,height:y.height},startPosition:y.position,anchorFrameOrigin:y.anchorFrameOrigin,deltaXPt:M,deltaYPt:E,transform:y.transform,preserveAspect:editor.resizePreservesAspect(N,y.aspectLocked,S.shiftKey),kind:y.kind});o.exec({type:"setImageProperties",widthEmu:F.widthEmu,heightEmu:F.heightEmu,...F.position?.mode==="simple"?{horizontalEmu:F.position.horizontalEmu,verticalEmu:F.position.verticalEmu}:{},...F.position?.mode==="frame"?{...F.position.horizontalEmu!==void 0?{horizontalEmu:F.position.horizontalEmu}:{},...F.position.verticalEmu!==void 0?{verticalEmu:F.position.verticalEmu}:{}}:{}});return}if(y.kind!=="anchored"||!y.canMove||!y.position)return;let w=editor.computeMovedImagePosition(y.position,M,E);o.exec({type:"setImagePosition",...w});},[u,o]);Ye.useEffect(()=>{if(!s||!o?.surface)return;let S=o.surface.overlayCoordinates(),y=M=>{let E=l.current,w=d.current;if(!E||!w)return;let N=editor.cssPixelsToLayoutPoints(M.clientX-w.x,S.paintScale),F=editor.cssPixelsToLayoutPoints(M.clientY-w.y,S.paintScale);if(E.session.mode==="move"){let k=0,D=g.current,I=e.current?.closest(".docx-editor__scroll-container");if(D&&I){let z=I.getBoundingClientRect();M.clientY>z.bottom-Nc?k=Dc:M.clientY<z.top+Nc&&(k=-Dc),k!==0&&(k=D.scrollBy(k));}let R=E.accumulatedScrollPt+k;c({...E,accumulatedScrollPt:R,bounds:Object.freeze({...E.bounds,x:E.session.startBounds.x+N,y:E.session.startBounds.y+F+R})});return}if(!E.session.handle)return;let H=editor.computeImageResizeResult({handle:E.session.handle,startWidthEmu:E.session.startWidthEmu,startHeightEmu:E.session.startHeightEmu,startBounds:E.session.startBounds,startPosition:E.session.startPosition,anchorFrameOrigin:E.session.anchorFrameOrigin,deltaXPt:N,deltaYPt:F,transform:E.session.transform,preserveAspect:editor.resizePreservesAspect(E.session.handle,E.bounds.aspectLocked,M.shiftKey),kind:E.session.kind});c({...E,bounds:Object.freeze({...E.bounds,x:H.previewBounds.x,y:H.previewBounds.y,width:H.previewBounds.width,height:H.previewBounds.height,widthEmu:H.widthEmu,heightEmu:H.heightEmu})});},x=M=>{let E=l.current;if(E)if(M.type==="pointerup"){let w=editor.cssPixelsToLayoutPoints(M.clientX-(d.current?.x??M.clientX),S.paintScale),N=editor.cssPixelsToLayoutPoints(M.clientY-(d.current?.y??M.clientY),S.paintScale),F=editor.finalizeImageOverlayInteraction({session:E.session,deltaXPt:w,deltaYPt:N,accumulatedScrollPt:E.accumulatedScrollPt,aspectLocked:E.bounds.aspectLocked,shiftKey:M.shiftKey,anchorFrameOrigin:E.session.anchorFrameOrigin});b(E.session,F.widthEmu,F.heightEmu,F.previewBounds,F.position);}else u();};return window.addEventListener("pointermove",y),window.addEventListener("pointerup",x),window.addEventListener("pointercancel",x),()=>{window.removeEventListener("pointermove",y),window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x);}},[u,b,e,o,s]),Ye.useEffect(()=>{!a||m.current!==a.id||(m.current=null,f.current?.focus({preventScroll:true}));},[a]);let C=s?.bounds??a,P=Ye.useMemo(()=>{if(!o?.surface||!C)return null;let S=o.surface.publishedLayout(),y=o.surface.overlayCoordinates(),x=editor.overlayFrameToSheetCssPixels(S,{pageIndex:C.pageIndex,x:C.x,y:C.y,width:C.width,height:C.height},y),M=C.canResize,E=C.kind==="anchored"&&C.canMove;return jsxRuntime.jsxs("div",{ref:f,className:"docx-image-selection-overlay docx-editor-one-surface__overlay-control","data-drawing-node-id":C.id,tabIndex:0,onKeyDown:v,children:[jsxRuntime.jsx("div",{className:"docx-image-selection-overlay__frame",role:"group","aria-label":r("imageOverlay.selection"),style:{left:`${x.left}px`,top:`${x.top}px`,width:`${x.width}px`,height:`${x.height}px`,cursor:E?"move":"default"},onPointerDown:w=>{O(w),!(!E||!C.position)&&w.button===0&&(w.preventDefault(),w.stopPropagation(),h("move",null,C,w.clientX,w.clientY,w.currentTarget,w.pointerId));}}),M?F0.map(w=>{let N=Z0(w);return jsxRuntime.jsx("button",{type:"button",className:"docx-image-selection-overlay__handle","aria-label":r(A0(w)),tabIndex:0,style:{left:`calc(${x.left}px + ${x.width}px * ${parseFloat(N.x)/100} - 5px)`,top:`calc(${x.top}px + ${x.height}px * ${parseFloat(N.y)/100} - 5px)`,cursor:O0(w)},onPointerDown:F=>{O(F),F.button===0&&(F.preventDefault(),F.stopPropagation(),h("resize",w,C,F.clientX,F.clientY,F.currentTarget,F.pointerId));}},w)}):null]})},[C,h,o,v,r]);return !P||!t.current?null:reactDom.createPortal(P,t.current)}function Fr({className:e}){let t=A(),n=Li(),o=Ye.useRef(null),r=Ye.useRef(null);Ye.useLayoutEffect(()=>{let s=o.current;if(!(!t||!s))return t.attach(s),()=>{t.detach();}},[t]);let a=Ye.useCallback(s=>{if(!n?.isEnabled)return;let c=s.clipboardData;!c||![...c.items].some(d=>d.kind==="file"&&d.type.startsWith("image/"))||(s.preventDefault(),n.insertFromDataTransfer(c));},[n]),i=Ye.useCallback(s=>{!n?.isEnabled||![...s.dataTransfer.items].some(l=>l.kind==="file"&&l.type.startsWith("image/"))||(s.preventDefault(),n.insertFromDataTransfer(s.dataTransfer));},[n]);return jsxRuntime.jsxs("div",{ref:r,className:"docx-content-mount",children:[jsxRuntime.jsx("div",{ref:o,className:`docx-paginated-surface${e?` ${e}`:""}`,onPaste:a,onDrop:i}),t?jsxRuntime.jsx(Hi,{containerRef:o,portalRef:r}):null]})}var V0=e=>e.isLoading;function Fi({className:e}){return jsxRuntime.jsx("span",{className:`docx-editor__loading-spinner${e?` ${e}`:""}`,"aria-hidden":"true"})}function $0({when:e=false,className:t,style:n,children:o}){let r=q(V0),{t:a}=_();return !e&&!r?null:jsxRuntime.jsx("div",{className:`docx-editor docx-editor__loading${t?` ${t}`:""}`,style:n,role:"status","aria-live":"polite",children:o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Fi,{}),jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:a("loading.label")})]})})}var Ai=Object.assign($0,{Spinner:Fi});var jt=Object.freeze({mode:"closed",link:null,anchor:null,text:"",url:"",copied:false,error:false,canEdit:true}),J0=e=>e;function eg(){let e=n=>!!n&&(n.width>0||n.height>0);if(typeof document<"u"){let o=document.querySelector("[data-docx-caret]")?.getBoundingClientRect();if(e(o))return {left:o.left,top:o.bottom}}let t=typeof window>"u"?null:window.getSelection();if(t&&t.rangeCount>0){let n=t.getRangeAt(0),o=n.getBoundingClientRect();if(e(o))return {left:o.left,top:o.bottom};let r=n.startContainer,i=(r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.getBoundingClientRect();if(e(i))return {left:i.left,top:i.bottom}}return null}var mn=Ye.createContext(null);function Zi(){let e=Ye.useContext(mn),t=Or(e===null);return e??t}function Or(e=true){let t=A(),[n,o]=Ye.useState(jt),r=Ye.useRef(n);r.current=n;let a=q(J0),i=t?t.can({type:"insertText",text:""}).ok:false,s=Ye.useCallback((b,v)=>{o({mode:b?"reading":"editing",link:b??null,anchor:v??null,text:b?.text??"",url:b?b.kind==="internal"?`#${b.anchor??""}`:b.authored:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t]),c=Ye.useCallback(()=>{t?.surface?.releaseSelection(),o(jt);},[t]),l=Ye.useCallback(()=>{let b=eg(),v=t?.surface?.hyperlinks.linkAtCaret()??null;if(v){o({mode:"editing",link:v,anchor:b,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 C=t?.query({type:"selectedText"})??"";t?.surface?.retainSelection(),o({mode:"editing",link:null,anchor:b,text:C,url:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t]);Ye.useEffect(()=>{if(!(!t||!e))return t.setHyperlinkChrome({onPopover:b=>s(b.link,{left:b.rect.left,top:b.rect.bottom}),onRequest:l})},[t,e,s,l]),Ye.useEffect(()=>{let b=r.current;if(b.mode!=="reading"||!b.link)return;let v=t?.surface?.hyperlinks.linkAtCaret()??null;v&&v.id===b.link.id||o(jt);},[a,t]),Ye.useEffect(()=>{let b=r.current;if(b.mode!=="editing"||b.link)return;let v=t?.surface;!v||v.retainedSelection()||o(jt);},[a,t]);let d=Ye.useCallback(async()=>{let b=r.current.link?.href;if(!b)return false;try{await navigator.clipboard.writeText(b);}catch{return false}return o(v=>({...v,copied:true})),true},[]),p=Ye.useCallback(()=>{o(b=>({...b,mode:"editing",copied:false,error:false}));},[]),f=Ye.useCallback(b=>{o(v=>({...v,text:b,copied:false,error:false}));},[]),m=Ye.useCallback(b=>{o(v=>({...v,url:b,copied:false,error:false}));},[]),g=Ye.useCallback(()=>{let b=r.current,v=t?.surface?.hyperlinks;if(!v)return false;let C=b.url.trim();if(C.length===0)return o(y=>({...y,error:true})),false;let P=C.startsWith("#");return v.applyHyperlink({...P?{anchor:C.slice(1)}:{url:C},...b.text.trim().length>0?{text:b.text}:{}})?(c(),true):(o(y=>({...y,error:true})),false)},[t,c]),u=Ye.useCallback(()=>{let b=t?.surface?.hyperlinks,v=r.current.link;if(!b)return false;let C=b.removeHyperlink(v?.id);return C&&c(),C},[t,c]),h=Ye.useCallback(()=>{let b=t?.surface?.navigation,v=r.current.link;if(!b||!v)return false;if(v.kind==="internal"){let P=v.anchor?b.goToBookmark(v.anchor):false;return P&&o(jt),P}let C=b.openExternal(v.href);return C&&o(jt),C},[t]);return Ye.useMemo(()=>({state:n.mode==="closed"?jt:{...n,canEdit:i},open:s,openAtCaret:l,close:c,copy:d,beginEdit:p,setText:f,setUrl:m,commitEdit:g,unlink:u,openTarget:h}),[n,i,s,l,c,d,p,f,m,g,u,h])}var Be={showAll:"contentControl.showAll",formFill:"contentControl.formFill",inspector:"contentControl.inspector",remove:"contentControl.remove"};function rg(e){return e==="sdtLocked"||e==="sdtContentLocked"}function ag(e){return e==="contentLocked"||e==="sdtContentLocked"}function qi(e,t){return !e.ok&&e.code===t}function pt(){let e=Ye.useContext(Ki),t=Zr();return e??t}function Zr(){let e=A(),[t,n]=Ye.useState(false),[o,r]=Ye.useState(false),[a,i]=Ye.useState(false),s=q(x=>x),c=e?.surface??null,l=c?.contentControls;Ye.useEffect(()=>{r(l?.showAll()??c?.state().contentControls.showAll??false),i(l?.formFill()??c?.state().contentControls.formFill??false);},[s,l,c]);let d=Ye.useMemo(()=>{if(!e)return null;let x=l?.atCaret()??null;if(x){let I=l?.disabledReason(x.id,"edit")??null,R=l?.disabledReason(x.id,"remove")??null;return {id:x.id,tag:x.tag??null,alias:x.alias??null,controlType:x.controlType,locked:ag(x.effectiveLock)||I==="locked",removalLocked:rg(x.effectiveLock)||R==="locked",placeholder:x.placeholder,bound:x.bound||I==="bound",effectiveLock:x.effectiveLock}}let M=e.query({type:"contentControlAt"});if(!M)return null;let E=l?.disabledReason(M.id,"edit")??null,w=l?.disabledReason(M.id,"remove")??null,N=e.can({type:"setContentControlValue",value:""}),F=e.can({type:"removeContentControl"}),H=M.locked===true||E==="locked"||qi(N,"locked"),k=E==="bound"||qi(N,"bound"),D=w==="locked"||qi(F,"locked");return {id:M.id,tag:M.tag??null,alias:M.alias??null,controlType:M.controlType,locked:H,removalLocked:D,placeholder:false,bound:k,effectiveLock:null}},[e,s,l]),p=Ye.useMemo(()=>e?e.query({type:"contentControls"}):[],[e,s]),f=Ye.useCallback(x=>{l?.setShowAll(x),r(x);},[l]),m=Ye.useCallback(x=>{l?.setFormFill(x),i(x);},[l]),g=Ye.useCallback(()=>f(!o),[f,o]),u=Ye.useCallback(()=>m(!a),[m,a]),h=Ye.useCallback(()=>n(true),[]),b=Ye.useCallback(()=>n(false),[]),v=Ye.useCallback(()=>n(x=>!x),[]),C=Ye.useMemo(()=>{if(!d)return "no content control at the current selection";if(l){let M=l.disabledReason(d.id,"edit");return M==="locked"?"the content control is locked":M==="bound"?"the content control is bound to external data":M==="notFound"?"the content control was not found":M}if(d.locked)return "the content control is locked";if(d.bound)return "the content control is bound to external data";if(!e)return "no document is loaded";let x=e.can({type:"setContentControlValue",value:""});return x.ok?null:x.reason},[d,l,e]),P=Ye.useMemo(()=>{if(!d)return "no content control at the current selection";if(l){let M=l.disabledReason(d.id,"remove");return M==="locked"?"the content control is locked":M==="notFound"?"the content control was not found":M}if(d.removalLocked)return "the content control is locked";if(!e)return "no document is loaded";let x=e.can({type:"removeContentControl"});return x.ok?null:x.reason},[d,l,e]),S=Ye.useCallback(x=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(l&&d){let M=l.disabledReason(d.id,"edit");if(M)return {ok:false,code:M==="bound"?"bound":M==="locked"?"locked":"notFound",reason:M==="bound"?"the content control is bound to external data":M==="locked"?"the content control is locked":"the content control was not found"}}return e.exec({type:"setContentControlValue",value:x})},[e,l,d]),y=Ye.useCallback(()=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(l){let x=d?.id;if(!x)return {ok:false,code:"notFound",reason:"no content control at the current selection"};let M=l.disabledReason(x,"remove");return M?{ok:false,code:M==="locked"?"locked":"notFound",reason:M==="locked"?"the content control is locked":"the content control was not found"}:l.remove(x)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:"the edit was refused"}}return e.exec({type:"removeContentControl"})},[e,l,d]);return Ye.useMemo(()=>({control:d,controls:p,showAll:o,formFill:a,inspectorOpen:t,canSetValue:C===null&&d!==null,canRemove:P===null&&d!==null,setValueDisabledReason:C,removeDisabledReason:P,setShowAll:f,toggleShowAll:g,setFormFill:m,toggleFormFill:u,openInspector:h,closeInspector:b,toggleInspector:v,remove:y,setValue:S}),[d,p,o,a,t,C,P,f,g,m,u,h,b,v,y,S])}var Ki=Ye.createContext(null);function Zc(){let e=0,t=null,n=new Set,o=new Set,r=a=>{for(let i of [...a])i();};return {getShift:()=>e,setShift(a){let i=Math.max(0,Math.round(a));i!==e&&(e=i,r(n));},subscribeShift(a){return n.add(a),()=>n.delete(a)},getViewport:()=>t,setViewport(a){a!==t&&(t=a,r(o));},subscribeViewport(a){return o.add(a),()=>o.delete(a)}}}var zi=Ye.createContext(null);function ko(){return Ye.useContext(zi)}var sg=()=>0,Bc=()=>()=>{};function Ro(){let e=ko(),t=Ye.useCallback(o=>e?e.subscribeShift(o):Bc(),[e]),n=Ye.useCallback(()=>e?e.getShift():0,[e]);return Ye.useSyncExternalStore(t,n,sg)}function _o(){let e=ko(),t=Ye.useCallback(r=>e?e.subscribeViewport(r):Bc(),[e]),n=Ye.useCallback(()=>e?e.getViewport():null,[e]),o=Ye.useCallback(()=>null,[]);return Ye.useSyncExternalStore(t,n,o)}function mg(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 qr(e){let{document:t,fonts:n,zoom:o,zoomMode:r,tableInteractionLabel:a,imageDecodePort:i,children:s}=e,{t:c}=_(),l=Ye.useCallback((v,C)=>c(v,C),[c]),d=Ye.useRef(e);d.current=e;let[p,f]=Ye.useState(null);Ye.useEffect(()=>{let v=d.current,C=v.translate??l,P=editor.createDocxEditor({...v.document!==void 0?{document:v.document}:{},...v.fonts?{fonts:v.fonts}:{},...v.author!==void 0?{author:v.author}:{},...v.locale!==void 0?{locale:v.locale}:{},translate:C,...v.mode!==void 0?{mode:v.mode}:{},...v.modules!==void 0?{modules:v.modules}:{},...v.zoom!==void 0?{zoom:v.zoom}:{},...v.zoomMode!==void 0?{zoomMode:v.zoomMode}:{},...v.tableInteractionLabel?{tableInteractionLabel:v.tableInteractionLabel}:{},...v.imageDecodePort?{imageDecodePort:v.imageDecodePort}:{},onFontError:y=>d.current.onFontError?.(y)}),S=P.on("change",y=>d.current.onChange?.(y));return f(P),()=>{S(),P.destroy(),f(y=>y===P?null:y);}},[t,n,l,i]),Ye.useEffect(()=>{p&&d.current.onReady?.(p);},[p]);let m=Ye.useRef({editor:null,zoom:void 0,mode:void 0});Ye.useEffect(()=>{if(!p)return;m.current.editor!==p&&(m.current={editor:p,zoom:void 0,mode:void 0});let C=false;o!==void 0&&o!==m.current.zoom&&(m.current.zoom=o,p.setZoom(o),C=true);let P=m.current.mode,S=r!==void 0&&(P===void 0||!mg(P,r)),y=r===void 0?null:editor.resolveZoomMode(r),x=C&&r!==void 0&&y!==null&&y.type==="fit";(S||x)&&(m.current.mode=r,p.setZoomMode(r));},[p,o,r]),Ye.useEffect(()=>{p&&p.setTableInteractionLabel(a??editor.defaultTableLabel);},[p,a]);let[g,u]=Ye.useState(0),h=Ye.useMemo(()=>({mounted:g,register:()=>(u(v=>v+1),()=>u(v=>Math.max(0,v-1)))}),[g]),b=Ye.useMemo(Zc,[]);return jsxRuntime.jsx(St.Provider,{value:h,children:jsxRuntime.jsx(wi.Provider,{value:p,children:jsxRuntime.jsx(zi.Provider,{value:b,children:jsxRuntime.jsx(fg,{children:jsxRuntime.jsx(gg,{children:jsxRuntime.jsx(Nr,{children:s})})})})})})}function fg({children:e}){let t=Or(true);return jsxRuntime.jsx(mn.Provider,{value:t,children:e})}function gg({children:e}){let t=Zr();return jsxRuntime.jsx(Ki.Provider,{value:t,children:e})}var Kr=[.25,.5,.75,1,1.25,1.5,2];function bn(e,t){return t==="in"?Kr.find(o=>o>e+.001)??null:[...Kr].reverse().find(o=>o<e-.001)??null}function Vc(e,t){return e==="0"?1:e==="+"||e==="="?bn(t,"in")??t:e==="-"?bn(t,"out")??t:null}var Qt=Ye.createContext(false);function Xe(){return Ye.useContext(Qt)?"":"docx-editor "}var yg=e=>e.reviewPaneOpen??true,xg=e=>e.zoomMode?.type==="fit";function zr({className:e,style:t,children:n}){let o=Xe(),r=A(),a=q(yg),i=q(xg),c=(Ye.useContext(St)?.mounted??0)>0,l=ko(),d=Ro(),p=Ye.useCallback(m=>l?.setViewport(m),[l]),f=Ye.useCallback(m=>{if(!r||!(m.metaKey||m.ctrlKey)||m.altKey)return;let g=m.target;if(g instanceof Element&&g.closest('input, textarea, select, [role="dialog"]'))return;let u=Vc(m.key,r.getZoom());u!==null&&(m.preventDefault(),r.setZoom(u));},[r]);return jsxRuntime.jsx("div",{ref:p,"data-testid":"docx-editor-scroll",onKeyDownCapture:f,...c?{"data-review-pane":a?"open":"closed"}:{},...i?{"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":`${d}px`},children:jsxRuntime.jsx(Qt.Provider,{value:true,children:n})})}var Sg=sn;function Uc({ref:e,editorRef:t}){Ye.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)??Sg}),[t]);}var Mg=e=>e.editingMode??"editing",Wi=[{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"}],Ig="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z";function $r({className:e,hidden:t}){let n=A(),o=q(Mg),r=Y(),[a,i]=Ye.useState(false),s=Ye.useRef(null),c=Ye.useRef(null),l=Ye.useRef(null);Ye.useEffect(()=>{if(!a)return;let u=l.current?.querySelectorAll('[role="menuitemradio"]');(l.current?.querySelector('[aria-checked="true"]')??u?.[0]??void 0)?.focus();},[a]);let d=Ye.useCallback(u=>{let h=[...l.current?.querySelectorAll('[role="menuitemradio"]')??[]],b=h.indexOf(document.activeElement),v=C=>{u.preventDefault(),h[(C+h.length)%h.length]?.focus();};u.key==="ArrowDown"?v(b+1):u.key==="ArrowUp"?v(b-1):u.key==="Home"?v(0):u.key==="End"&&v(h.length-1);},[]);Ye.useEffect(()=>{if(!a)return;let u=b=>{let v=s.current;v&&b.target instanceof Node&&v.contains(b.target)||i(false);},h=b=>{b.key==="Escape"&&(b.preventDefault(),i(false));};return document.addEventListener("mousedown",u,true),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",u,true),document.removeEventListener("keydown",h);}},[a]);let p=Ye.useCallback(u=>{i(false),editor.runToolbarCommand(n,"review.editingMode",u),n?.focus();},[n]),f=editor.toolbarCommandState(n,"review.editingMode"),m=Ye.useMemo(()=>Wi.find(u=>u.mode===o)??Wi[0],[o]);if(t)return null;let g=ee("review.editingMode");return jsxRuntime.jsxs("div",{ref:s,className:`docx-toolbar__mode${e?` ${e}`:""}`,"data-slot":"review.editingMode",children:[jsxRuntime.jsxs("button",{ref:c,type:"button",className:"docx-toolbar__picker","data-testid":"editing-mode-trigger","data-mode":o,"aria-haspopup":"menu","aria-expanded":a,"aria-label":r(g?.labelKey??"editingMode.label"),disabled:!f.enabled,...f.disabledReason?{title:f.disabledReason}:{},onMouseDown:O,onClick:()=>i(u=>!u),children:[Ui(m.path),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-value",children:r(m.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),a?jsxRuntime.jsx("div",{ref:l,className:"docx-toolbar__mode-menu",role:"menu","aria-label":r(g?.labelKey??"editingMode.label"),"data-testid":"editing-mode-menu",onKeyDown:d,children:Wi.map(u=>jsxRuntime.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":u.mode===o,className:"docx-toolbar__mode-item","data-testid":`editing-mode-${u.mode}`,onMouseDown:O,onClick:()=>p(u.mode),children:[Ui(u.path),jsxRuntime.jsxs("span",{className:"docx-toolbar__mode-text",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__mode-label",children:r(u.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-hint",children:r(u.hintKey)})]}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-check","aria-hidden":"true",children:u.mode===o?Ui(Ig):null})]},u.mode))}):null]})}$r.docxSlot="review.editingMode";function Ui(e){return jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:18,height:18,"aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:e,fill:"currentColor"})})}function No(e,t){if(!Ye.isValidElement(e)||e.type!==Ye.Fragment)return null;let o=Ye.Children.toArray(e.props.children).map(t).filter(r=>r!==null);return o.length===1?o[0]:null}function Ur({entries:e,children:t,preset:n,keyOfEntry:o,keyOfChild:r,renderEntry:a}){if(!n)return t;let i=new Map,s=[];for(let p of Ye.Children.toArray(t)){let f=r(p);f?i.set(f,p):s.push(p);}let c=e.map((p,f)=>{let m=o(p,f),g=i.get(m);return g?jsxRuntime.jsx(Ye.Fragment,{children:g},m):jsxRuntime.jsx(Ye.Fragment,{children:a(p,f)},m)}),l=new Set(e.map(o)),d=[...i.entries()].filter(([p])=>!l.has(p)).map(([p,f])=>jsxRuntime.jsx(Ye.Fragment,{children:f},p));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[c,d,s]})}var Ng=["zoom","script","format","list","alignment","styles","font","text","history"],Yi=new Set(["review"]),Xi=24,Qc=new Set;function Jc(e,t=Ng){let n=t.filter(r=>e.includes(r));return [...e.filter(r=>!t.includes(r)).reverse(),...n]}function jc(e,t){let{widths:n,groups:o,order:r,fixed:a,more:i}=e,s=a;for(let l of o)s+=n.get(l)??0;if(s<=t)return Qc;s+=i;let c=new Set;for(let l of r){if(s<=t)break;let d=n.get(l);d===void 0||c.has(l)||(c.add(l),s-=d);}return c}function ed(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 td=ed;function od(e){if(!(e.available>0))return Qc;let t=jc(e,e.available),n=e.previous;if(!n||n.size===0||t.size>=n.size)return t;let o=jc(e,e.available-(e.hysteresis));return ed(o,n)?n:o}function nd(e,t,n,o){return e+t+n+o*2}function rd(e,t){return e+t}function Qi(e,t){return e+t}function ad(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 ji(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function id(e){return ji(e.columnGap)}function ld(e,t){return e.clientWidth-ji(t.paddingLeft)-ji(t.paddingRight)}var vn="data-toolbar-group",yn="data-toolbar-fixed",el="data-toolbar-more",Fg=34,Ji=new Set;function cd(e,t,n){let o=Ye.useRef(null),r=Ye.useRef(new Map),a=Ye.useRef(Fg),[i,s]=Ye.useState(Ji),c=Ye.useRef(i);c.current=i;let l=Ye.useRef({groups:t,order:n});l.current={groups:t,order:n};let d=Ye.useCallback(()=>{let f=o.current;if(!f||!e)return;let m=getComputedStyle(f),g=id(m),u=ld(f,m),h=f.querySelector(".docx-toolbar__separator"),b=g*2;if(h){let y=getComputedStyle(h),x=ad(y);b=nd(h.offsetWidth,x.start,x.end,g);}for(let y of f.querySelectorAll(`[${vn}]`)){let x=y.getAttribute(vn);x&&y.offsetWidth>0&&r.current.set(x,rd(y.offsetWidth,b));}let v=0;for(let y of f.querySelectorAll(`[${yn}]`))y.offsetWidth>0&&(v+=Qi(y.offsetWidth,g));let C=f.querySelector(`[${el}]`);C&&C.offsetWidth>0&&(a.current=Qi(C.offsetWidth,g));let P={available:u,widths:r.current,groups:l.current.groups,order:l.current.order,fixed:v,more:a.current,previous:c.current,hysteresis:Xi},S=od(P);td(S,c.current)||(c.current=S,s(S));},[e]),p=Ye.useCallback(f=>{o.current=f;},[]);return Ye.useLayoutEffect(()=>{if(!e){c.current.size>0&&(c.current=Ji,s(Ji));return}d();},[e,d]),Ye.useEffect(()=>{let f=o.current;if(!e||!f||typeof ResizeObserver>"u")return;let m=0,g=new ResizeObserver(()=>{m===0&&(m=requestAnimationFrame(()=>{m=0,d();}));});g.observe(f);for(let u of f.querySelectorAll(`[${vn}], [${yn}]`))g.observe(u);return ()=>{m!==0&&cancelAnimationFrame(m),g.disconnect();}},[e,d,i]),{attach:p,overflow:i}}var Vg=["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"],ud=Ye.createContext({close:()=>{}});function $g(e){e.querySelector('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')?.focus();}function pd({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 md({slot:e}){let t=Y(),{close:n}=Ye.useContext(ud),{execute:o,isActive:r,isEnabled:a,disabledReason:i}=ne(e),s=ee(e),c=editor.commandForSlot(e),l=c?.type==="toggleMark"||c?.type==="setAlignment",d=t(s?.labelKey??e);return jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__more-command","data-slot":e,disabled:!a,...i?{title:i}:{},...l?{"aria-pressed":r}:{},...r?{"data-active":""}:{},onMouseDown:O,onClick:p=>{o(),n(p.detail===0);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-icon","aria-hidden":"true",children:te(s?.paths)}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-label",children:d})]})}function fd({sections:e,className:t}){let n=Y(),[o,r]=Ye.useState(false),a=Ye.useRef(null),i=Ye.useRef(null),s=Ye.useRef(null),c=Ye.useRef(false),l=Ye.useId(),d=n("formattingBar.more"),p=Ye.useCallback(g=>{r(false),g&&i.current?.focus();},[]),f=Ye.useMemo(()=>({close:p}),[p]);Ye.useEffect(()=>{if(!o)return;let g=u=>{let h=u.target;h instanceof Node&&a.current?.contains(h)||r(false);};return document.addEventListener("mousedown",g,true),()=>document.removeEventListener("mousedown",g,true)},[o]),Ye.useEffect(()=>{if(!o||!c.current)return;c.current=false;let g=s.current;g&&$g(g);},[o]);let m=g=>{g.key!=="Escape"||g.defaultPrevented||(g.preventDefault(),p(true));};return jsxRuntime.jsxs("div",{ref:a,className:`docx-toolbar__more${t?` ${t}`:""}`,[el]:"",children:[jsxRuntime.jsx("button",{ref:i,type:"button",className:"docx-toolbar__button docx-toolbar__more-trigger","data-slot":"toolbar.more","aria-haspopup":"dialog","aria-expanded":o,"aria-controls":o?l:void 0,"aria-label":d,title:d,...o?{"data-active":""}:{},onMouseDown:O,onClick:()=>r(g=>!g),onKeyDown:g=>{g.key==="ArrowDown"&&(g.preventDefault(),c.current=true,r(true));},children:te(Vg)}),o?jsxRuntime.jsx(ud.Provider,{value:f,children:jsxRuntime.jsx("div",{ref:s,id:l,role:"dialog","aria-label":d,className:"docx-toolbar__more-panel","data-testid":"toolbar-overflow-panel",onKeyDown:m,children:e.map(g=>jsxRuntime.jsxs("div",{className:"docx-toolbar__more-section",role:"group","aria-label":n(g.labelKey),children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-heading","aria-hidden":"true",children:n(g.labelKey)}),g.children]},g.id))})}):null]})}function Xg(e,t){return e.value===t.value&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason}function xn(e){let t=A(),n=Ye.useRef(e);n.current=e;let o=Ye.useCallback(s=>{let c=n.current,l=editor.toolbarCommandState(t,c);return {value:l.value??null,enabled:l.enabled,disabledReason:l.disabledReason}},[t,e]),r=q(o,Xg),a=Ye.useMemo(()=>({execute:s=>editor.runToolbarCommand(t,"image.wrap",s),value:r.value??null,options:editor.IMAGE_WRAP_TARGETS,isEnabled:r.enabled,disabledReason:r.disabledReason}),[t,r]),i=Ye.useMemo(()=>({execute:s=>editor.runToolbarCommand(t,"image.altText",s),value:r.value,options:[],isEnabled:r.enabled,disabledReason:r.disabledReason}),[t,r]);return e==="image.wrap"?a:i}var ol=[{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 jr({className:e,hidden:t,asChild:n,children:o}){let{t:r}=_(),a=Y(),{execute:i,value:s,isEnabled:c,disabledReason:l}=xn("image.wrap"),[d,p]=Ye.useState(false),f=Ye.useRef(null),m=Ye.useRef(null),g=Ye.useRef(null),u=Ye.useId(),h=Ye.useMemo(()=>ol.find(y=>y.value===s)??ol[0],[s]),b=ee("image.wrap"),v=a(b?.labelKey??"formattingBar.imageWrap");Ye.useEffect(()=>{if(!d)return;let y=M=>{let E=f.current;E&&M.target instanceof Node&&E.contains(M.target)||p(false);},x=M=>{M.key==="Escape"&&(M.preventDefault(),p(false),m.current?.focus());};return document.addEventListener("mousedown",y,true),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",y,true),document.removeEventListener("keydown",x);}},[d]);let C=Ye.useCallback(y=>{p(false),i(y);},[i]);if(t)return null;let P=r("imageWrap.tooltipPrefix",{label:r(h.labelKey)}),S={type:"button",ref:m,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?u:void 0,"aria-label":v,title:l??P,onMouseDown:O,onClick:()=>p(y=>!y)};return jsxRuntime.jsxs("div",{ref:f,className:"docx-toolbar__image-wrap",children:[n?jsxRuntime.jsx(W,{...S,children:o}):jsxRuntime.jsx("button",{...S,children:o??te(b?.paths)}),d?jsxRuntime.jsx("div",{ref:g,id:u,role:"menu",className:"docx-toolbar__image-wrap-menu","aria-label":r("imageWrap.menu.ariaLabel"),onMouseDown:y=>y.stopPropagation(),children:ol.map(y=>jsxRuntime.jsx("button",{type:"button",role:"menuitemradio",className:"docx-toolbar__image-wrap-item","aria-checked":s===y.value,...s===y.value?{"data-active":""}:{},onMouseDown:O,onClick:()=>C(y.value),children:r(y.labelKey)},y.value))}):null]})}jr.docxSlot="image.wrap";var Tn=Object.assign(jr,{docxSlot:"image.wrap"});function Qr({className:e,hidden:t,asChild:n,children:o}){let{t:r}=_(),a=Y(),{execute:i,value:s,isEnabled:c,disabledReason:l}=xn("image.altText"),[d,p]=Ye.useState(false),[f,m]=Ye.useState(""),g=Ye.useRef(null),u=Ye.useRef(null),h=Ye.useId();Ye.useEffect(()=>{d&&m(s??"");},[d,s]),Ye.useEffect(()=>{if(!d)return;let S=x=>{let M=g.current;M&&x.target instanceof Node&&M.contains(x.target)||p(false);},y=x=>{x.key==="Escape"&&(x.preventDefault(),p(false),u.current?.focus());};return document.addEventListener("mousedown",S,true),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",S,true),document.removeEventListener("keydown",y);}},[d]);let b=Ye.useCallback(()=>{i(f),p(false);},[f,i]);if(t)return null;let v=ee("image.altText"),C=a(v?.labelKey??"formattingBar.altText"),P={type:"button",ref:u,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?h:void 0,"aria-label":C,title:l??C,onMouseDown:O,onClick:()=>p(S=>!S)};return jsxRuntime.jsxs("div",{ref:g,className:"docx-toolbar__alt-text",children:[n?jsxRuntime.jsx(W,{...P,children:o}):jsxRuntime.jsx("button",{...P,children:o??C}),d?jsxRuntime.jsxs("div",{id:h,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:`${h}-description`,children:r("imageAltText.description")}),jsxRuntime.jsx("textarea",{id:`${h}-description`,className:"docx-dialog__textarea",value:f,onChange:S=>m(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:()=>p(false),children:r("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:b,children:r("common.apply")})]})]}):null]})}Qr.docxSlot="image.altText";var Sn=Object.assign(Qr,{docxSlot:"image.altText"});var Sd=e=>e.image;function Td(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 ub(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function ll(e){let t=e.position;return !t||e.kind!=="anchored"?{positionMode:"frame",horizontalPoints:"",verticalPoints:"",relativeToH:"page",relativeToV:"line"}:t.mode==="simple"?{positionMode:"simple",horizontalPoints:t.horizontalEmu!==void 0?String(kt(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(kt(t.verticalEmu)):"",relativeToH:"page",relativeToV:"line"}:{positionMode:"frame",horizontalPoints:t.horizontalEmu!==void 0?String(kt(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(kt(t.verticalEmu)):"",relativeToH:t.relativeToH??"page",relativeToV:t.relativeToV??"line"}}function pb(e,t){let n=ll(t);return e.horizontalPoints!==n.horizontalPoints||e.verticalPoints!==n.verticalPoints||e.relativeToH!==n.relativeToH||e.relativeToV!==n.relativeToV}function Jr(e){if(e.trim()==="")return null;let t=Number(e);if(!Number.isFinite(t))return null;let n=cn(t);return Number.isInteger(n)?n:null}function mb(e,t){let n=ll(t);if(e.positionMode==="simple"||t.position?.mode==="simple"){let l=e.horizontalPoints!==n.horizontalPoints,d=e.verticalPoints!==n.verticalPoints,p=l?Jr(e.horizontalPoints):t.position?.horizontalEmu,f=d?Jr(e.verticalPoints):t.position?.verticalEmu;return l&&p===null?{ok:false}:d&&f===null?{ok:false}:p===void 0||f===void 0?{ok:false}:{ok:true,value:{horizontalEmu:p,verticalEmu:f}}}let o=e.horizontalPoints!==n.horizontalPoints,r=e.verticalPoints!==n.verticalPoints,a=e.relativeToH!==n.relativeToH,i=e.relativeToV!==n.relativeToV,s=o?Jr(e.horizontalPoints):t.position?.horizontalEmu,c=r?Jr(e.verticalPoints):t.position?.verticalEmu;return o&&s===null?{ok:false}:r&&c===null?{ok:false}:{ok:true,value:{...typeof s=="number"?{horizontalEmu:s}:{},...typeof c=="number"?{verticalEmu:c}:{},...a||o||r?{relativeToH:e.relativeToH}:{},...i||o||r?{relativeToV:e.relativeToV}:{}}}}function ea(e){let t=Number(e);return !Number.isFinite(t)||t<0||t>100?null:t}function ta(e){let t=Number(e);return !Number.isFinite(t)||t<=0?null:t}function sl({open:e,onClose:t,className:n,triggerRef:o}){let r=A(),{t:a}=_(),i=q(Sd),s=Ye.useId(),c=Ye.useId(),l=Ye.useId(),d=Ye.useRef(null),p=Ye.useRef(null),f=Ye.useRef(null),m=Ye.useRef(null),[g,u]=Ye.useState(null),[h,b]=Ye.useState(null),v=p.current,C=v?.canCrop===false,P=v?.canResize===false,S=v?.locks.changeAspect===true,y=v?.kind==="anchored"&&v.canMove===true,x=v?.kind==="inline",M=v?.kind==="anchored"&&v.canMove===false;Ye.useEffect(()=>{if(!e){p.current=null,f.current=null,m.current=null;return}if(!i)return;if(p.current=i,r?.surface){let{anchor:z}=r.surface.state().selection;f.current={paragraphId:z.paragraphId,offset:z.offset},m.current=r.surface.session.packageRevision();}b(null);let I=ll(i),R=i.crop;u({widthPoints:String(kt(i.widthEmu)),heightPoints:String(kt(i.heightEmu)),cropLeft:String(R.left),cropTop:String(R.top),cropRight:String(R.right),cropBottom:String(R.bottom),title:i.title,description:i.description,hyperlink:i.hyperlink??"",wrap:i.wrap,lockAspect:i.locks.changeAspect,...I});},[e,i?.id,i?.widthEmu,i?.heightEmu,r]);let E=Ye.useCallback(()=>{o?.current?.focus(),r?.focus();},[r,o]),w=Ye.useCallback(()=>{t(),E();},[t,E]);Ye.useEffect(()=>{if(!e)return;let I=d.current;if(!I)return;let R=Td(I);(R.find($=>$.id==="image-prop-width"&&!$.hasAttribute("disabled"))??R.find($=>!$.hasAttribute("disabled"))??I).focus();let Z=$=>{if($.key==="Escape"){$.preventDefault(),w();return}if($.key!=="Tab")return;let Q=Td(I);if(Q.length===0)return;let Me=document.activeElement,se=Q.findIndex(Ce=>Ce===Me);if(se===-1)return;$.preventDefault();let Te=$.shiftKey?(se-1+Q.length)%Q.length:(se+1)%Q.length;Q[Te]?.focus();};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[e,w]);let N=Ye.useMemo(()=>{let I=v??i;return !I||I.widthEmu<=0?1:I.widthEmu/I.heightEmu},[i,v]),F=Ye.useCallback(I=>{u(R=>{if(!R)return R;if(!R.lockAspect)return {...R,widthPoints:I};let z=ta(I);if(z===null)return {...R,widthPoints:I};let Z=Math.round(z/N*100)/100;return {...R,widthPoints:I,heightPoints:String(Z)}});},[N]),H=Ye.useCallback(I=>{u(R=>{if(!R)return R;if(!R.lockAspect)return {...R,heightPoints:I};let z=ta(I);if(z===null)return {...R,heightPoints:I};let Z=Math.round(z*N*100)/100;return {...R,widthPoints:String(Z),heightPoints:I}});},[N]),k=Ye.useCallback(()=>{let I=p.current;if(!I?.intrinsic)return;let R=I.intrinsic.pixelWidth*72/I.intrinsic.dpiX,z=I.intrinsic.pixelHeight*72/I.intrinsic.dpiY;u(Z=>Z&&{...Z,widthPoints:String(Math.round(R*100)/100),heightPoints:String(Math.round(z*100)/100)});},[i]),D=Ye.useCallback(()=>{let I=p.current,R=f.current,z=m.current;if(!r||!I||!g||!R||z===null)return;let Z={type:"setImageProperties",drawingNodeId:I.id,expectedPackageRevision:z,selectionParagraphId:R.paragraphId,selectionOffset:R.offset};if(!P){let Ce=ta(g.widthPoints),G=ta(g.heightPoints);if(Ce===null||G===null){b("imageProperties.errors.invalidDimensions");return}let B=cn(Ce),Pe=cn(G);B!==I.widthEmu&&(Z.widthEmu=B),Pe!==I.heightEmu&&(Z.heightEmu=Pe);}if(I.canCrop&&!C){let Ce=ea(g.cropLeft),G=ea(g.cropTop),B=ea(g.cropRight),Pe=ea(g.cropBottom);if(Ce===null||G===null||B===null||Pe===null){b("imageProperties.errors.invalidCrop");return}let Ue=I.crop;(Ce!==Ue.left||G!==Ue.top||B!==Ue.right||Pe!==Ue.bottom)&&(Z.crop={left:Ce,top:G,right:B,bottom:Pe});}g.title!==I.title&&(Z.title=g.title),g.description!==I.description&&(Z.description=g.description);let $=g.hyperlink.trim();if($!==(I.hyperlink??"")&&(Z.hyperlink=$===""?null:$),I.canChangeWrap&&g.wrap!==I.wrap&&(Z.wrap=g.wrap),I.kind==="anchored"&&I.canMove&&pb(g,I)){let Ce=mb(g,I);if(!Ce.ok){b("imageProperties.errors.invalidPosition");return}if(!editor.validateDrawingPositionInput(editor.positionInputFromPropertiesCommand(Ce.value,I))){b("imageProperties.errors.invalidPosition");return}Object.assign(Z,Ce.value);}if(!(Z.widthEmu!==void 0||Z.heightEmu!==void 0||Z.title!==void 0||Z.description!==void 0||Z.hyperlink!==void 0||Z.crop!==void 0||Z.wrap!==void 0||Z.horizontalEmu!==void 0||Z.verticalEmu!==void 0||Z.relativeToH!==void 0||Z.relativeToV!==void 0)){w();return}if(!r.can(Z).ok){b("imageProperties.errors.refused");return}if(!r.exec(Z).ok){b("imageProperties.errors.refused");return}w();},[r,g,C,P,w]);return !e||!g?null:jsxRuntime.jsx("div",{className:`docx-dialog-overlay${n?` ${n}`:""}`,onClick:w,onMouseDown:I=>{I.stopPropagation(),ub(I);},children:jsxRuntime.jsxs("div",{ref:d,role:"dialog","aria-modal":"true","aria-labelledby":s,className:"docx-dialog docx-image-properties-dialog",onClick:I=>I.stopPropagation(),onMouseDown:I=>I.stopPropagation(),children:[jsxRuntime.jsx("div",{id:s,className:"docx-dialog__header",children:a("dialogs.imageProperties.title")}),jsxRuntime.jsxs("div",{className:"docx-dialog__body",children:[h?jsxRuntime.jsx("p",{className:"docx-dialog__error",children:a(h)}):null,jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.imageProperties.dimensions")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-width",children:a("dialogs.imageProperties.widthLabel")}),jsxRuntime.jsx("input",{id:"image-prop-width",className:"docx-dialog__input",value:g.widthPoints,disabled:P,onChange:I=>F(I.target.value)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("imageProperties.units.points")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-height",children:a("dialogs.imageProperties.heightLabel")}),jsxRuntime.jsx("input",{id:"image-prop-height",className:"docx-dialog__input",value:g.heightPoints,disabled:P,onChange:I=>H(I.target.value)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("imageProperties.units.points")})]}),jsxRuntime.jsxs("label",{className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:g.lockAspect,disabled:S,onChange:I=>u(R=>R&&{...R,lockAspect:I.target.checked})}),a("dialogs.imageProperties.lockAspectRatio")]}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__link-button",disabled:C||!v?.intrinsic,onClick:k,children:a("imageProperties.resetNaturalSize")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("imageProperties.position")}),x?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:a("imageProperties.positionUnavailable")}):null,M?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:a("imageProperties.positionLocked")}):null,y?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g.positionMode==="frame"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-rel-h",children:a("imageProperties.relativeToHorizontal")}),jsxRuntime.jsx("select",{id:"image-pos-rel-h",className:"docx-dialog__select",value:g.relativeToH??"page",onChange:I=>u(R=>R&&{...R,relativeToH:I.target.value}),children:editor.DRAWING_REL_FROM_H.map(I=>jsxRuntime.jsx("option",{value:I,children:a(`dialogs.imagePosition.relativeOptions.${I}`)},I))})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-rel-v",children:a("imageProperties.relativeToVertical")}),jsxRuntime.jsx("select",{id:"image-pos-rel-v",className:"docx-dialog__select",value:g.relativeToV??"line",onChange:I=>u(R=>R&&{...R,relativeToV:I.target.value}),children:editor.DRAWING_REL_FROM_V.map(I=>jsxRuntime.jsx("option",{value:I,children:a(`dialogs.imagePosition.relativeOptions.${I}`)},I))})]})]}):null,jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-h",children:a("imageProperties.horizontalOffset")}),jsxRuntime.jsx("input",{id:"image-pos-h",className:"docx-dialog__input",value:g.horizontalPoints,onChange:I=>u(R=>R&&{...R,horizontalPoints:I.target.value})}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("imageProperties.units.points")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-v",children:a("imageProperties.verticalOffset")}),jsxRuntime.jsx("input",{id:"image-pos-v",className:"docx-dialog__input",value:g.verticalPoints,onChange:I=>u(R=>R&&{...R,verticalPoints:I.target.value})}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("imageProperties.units.points")})]})]}):null]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.imageProperties.altText")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-title",children:a("imageAltText.title")}),jsxRuntime.jsx("input",{id:"image-prop-title",className:"docx-dialog__input",value:g.title,onChange:I=>u(R=>R&&{...R,title:I.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-description",children:a("imageAltText.description")}),jsxRuntime.jsx("textarea",{id:"image-prop-description",className:"docx-dialog__textarea",value:g.description,onChange:I=>u(R=>R&&{...R,description:I.target.value}),placeholder:a("dialogs.imageProperties.altTextPlaceholder")})]})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("imageProperties.hyperlink")}),jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:l,children:a("hyperlinkPopup.urlLabel")}),jsxRuntime.jsx("input",{id:l,className:"docx-dialog__input docx-dialog__input--full",value:g.hyperlink,onChange:I=>u(R=>R&&{...R,hyperlink:I.target.value}),placeholder:a("hyperlinkPopup.urlPlaceholder")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.imageProperties.textWrapping")}),jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:c,children:a("formattingBar.imageWrap")}),jsxRuntime.jsx("select",{id:c,className:"docx-dialog__select docx-dialog__input--full",value:g.wrap,disabled:v?.canChangeWrap===false,onChange:I=>u(R=>R&&{...R,wrap:I.target.value}),children:editor.IMAGE_WRAP_TARGETS.map(I=>jsxRuntime.jsx("option",{value:I,children:a(`imageWrap.targets.${I}`)},I))})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("imageProperties.crop")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-left",children:a("imageProperties.cropLeft")}),jsxRuntime.jsx("input",{id:"image-crop-left",className:"docx-dialog__input",disabled:C,value:g.cropLeft,onChange:I=>u(R=>R&&{...R,cropLeft:I.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-top",children:a("imageProperties.cropTop")}),jsxRuntime.jsx("input",{id:"image-crop-top",className:"docx-dialog__input",disabled:C,value:g.cropTop,onChange:I=>u(R=>R&&{...R,cropTop:I.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-right",children:a("imageProperties.cropRight")}),jsxRuntime.jsx("input",{id:"image-crop-right",className:"docx-dialog__input",disabled:C,value:g.cropRight,onChange:I=>u(R=>R&&{...R,cropRight:I.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-bottom",children:a("imageProperties.cropBottom")}),jsxRuntime.jsx("input",{id:"image-crop-bottom",className:"docx-dialog__input",disabled:C,value:g.cropBottom,onChange:I=>u(R=>R&&{...R,cropBottom:I.target.value})})]}),C?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:a("imageProperties.nonPictureHint")}):null]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__footer",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:w,children:a("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:D,children:a("common.apply")})]})]})})}function oa({className:e,hidden:t,asChild:n,children:o}){let r=A(),{t:a}=_(),i=q(Sd),[s,c]=Ye.useState(false),l=Ye.useRef(null),d={type:"setImageProperties",description:"probe"},p=r&&i?r.can(d):null,f=p?.ok===true,m=p&&!p.ok?p.reason:null;if(t)return null;let g=ee("image.properties"),u={type:"button",ref:l,className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"image.properties",disabled:!f,...f?{}:{"data-disabled":""},"aria-label":a("formattingBar.imagePropertiesShortcut"),title:m??a("formattingBar.imagePropertiesShortcut"),onMouseDown:O,onClick:()=>c(true)};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n?jsxRuntime.jsx(W,{...u,children:o}):jsxRuntime.jsx("button",{...u,children:o??te(g?.paths)}),jsxRuntime.jsx(sl,{open:s,onClose:()=>c(false),triggerRef:l})]})}oa.docxSlot="image.properties";var Pn=Object.assign(oa,{docxSlot:"image.properties"});function Ee(e){return Object.assign(n=>jsxRuntime.jsx(Xt,{slot:e,...n}),{docxSlot:e})}var Cd=Ee("history.undo"),Pd=Ee("history.redo"),Ed=Ee("text.bold"),wd=Ee("text.italic"),Md=Ee("text.underline"),Id=Ee("text.strike"),kd=Ee("format.clear"),Rd=Ee("script.super"),_d=Ee("script.sub"),Nd=Ee("alignment.left"),Dd=Ee("alignment.center"),Ld=Ee("alignment.right"),Hd=Ee("alignment.justify"),Fd=Ee("list.bullet"),Ad=Ee("list.numbered"),Od=Ee("list.outdent"),Zd=Ee("list.indent");var Bd=Ee("table.insert"),qd=Ee("review.comments");function bb({className:e,hidden:t,icon:n,asChild:o,children:r}){let a=A(),{openAtCaret:i}=Zi(),s=editor.chromeProbeForSlot("text.link"),c=a&&s?a.can(s):null,l=c?.ok===true,d=c&&!c.ok?c.reason:null,p=Y();if(t)return null;let f=ee("text.link"),m=p(f?.labelKey??"text.link"),g={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"text.link",disabled:!l,...l?{}:{"data-disabled":""},"aria-label":m,title:d??m,onMouseDown:O,onClick:()=>i()};return o?jsxRuntime.jsx(W,{...g,children:r}):jsxRuntime.jsx("button",{...g,children:n??r??te(f?.paths)})}var cl=Object.assign(bb,{docxSlot:"text.link"});function hb({className:e,hidden:t}){let n=A(),{onSave:o}=Ye.useContext(dn),r=Y();if(t)return null;let a=ee("file.save"),i=r(a?.labelKey??"file.save"),s=!n||!o;return jsxRuntime.jsx("button",{type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"file.save",disabled:s,...s?{"data-disabled":""}:{},"aria-label":i,title:i,onMouseDown:O,onClick:()=>o?.(),children:te(a?.paths)})}var dl=Object.assign(hb,{docxSlot:"file.save"});function Ho({className:e}){return jsxRuntime.jsx("div",{role:"separator","aria-orientation":"vertical",className:`docx-toolbar__separator${e?` ${e}`:""}`})}function Fo(e){let t=e?.closest(".docx-editor")??null;for(;t&&!t.querySelector(".docx-pages");)t=t.parentElement?.closest(".docx-editor")??null;return t}var xb=e=>({zoom:e.zoom,mode:e.zoomMode}),Tb=(e,t)=>e.zoom===t.zoom&&e.mode===t.mode,zd={type:"fixed"};function ul(){let e=A(),{zoom:t,mode:n}=q(xb,Tb),o=Ye.useCallback(a=>{e?.setZoom(a);},[e]),r=Ye.useCallback(a=>{e?.setZoomMode(a);},[e]);return Ye.useMemo(()=>{let a=n??zd,i=bn(t,"out"),s=bn(t,"in");return {zoom:t,mode:a,isFit:a.type==="fit",setZoom:o,setMode:r,fitToWidth:()=>r(editor.FIT_WIDTH_ZOOM_MODE),auto:()=>r("auto"),reset:()=>{r(zd),o(1);},zoomIn:()=>s!==null&&o(s),zoomOut:()=>i!==null&&o(i),canZoomIn:!!e&&s!==null,canZoomOut:!!e&&i!==null,levels:Kr}},[e,t,n,o,r])}var Mn=2,In=3276,wn=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],Pb=e=>e.formatting?.fontSizePt??null;function Wd(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function Ud(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 Yd(e){return jsxRuntime.jsxs("span",{className:`docx-toolbar__stepper${e.className?` ${e.className}`:""}`,...e.slot!==void 0?{"data-slot":e.slot}:{},role:"group","aria-label":e.groupLabel,title:e.title??e.groupLabel,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__stepper-button",disabled:!e.canDecrease,"aria-label":e.decreaseLabel,onMouseDown:O,onClick:e.onDecrease,children:"\u2212"}),e.middle,jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__stepper-button",disabled:!e.canIncrease,"aria-label":e.increaseLabel,onMouseDown:O,onClick:e.onIncrease,children:"+"})]})}function Eb(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<Mn||o>In?null:o}function wb({className:e,hidden:t}){let n=A(),o=q(Pb),{isEnabled:r,disabledReason:a}=ne("font.size"),i=Y(),[s,c]=Ye.useState(false),[l,d]=Ye.useState(null),p=Ye.useRef(null),f=Ye.useRef(null),m=Ye.useCallback(S=>{if(!n)return;let y=editor.commandForSlotValue("font.size",S);y&&n.can(y).ok&&n.exec(y);},[n]),g=Ye.useCallback(S=>{m(Math.min(In,Math.max(Mn,Math.round(S*2))));},[m]),u=Ye.useCallback(S=>{c(false),d(null),f.current?.blur(),S&&Mb(p.current);},[]);if(Ye.useEffect(()=>{if(!s)return;let S=y=>{let x=p.current;x&&y.target instanceof Node&&x.contains(y.target)||(c(false),d(null));};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[s]),t)return null;let h=r&&o!==null,b=o===null?"\u2014":String(Math.round(o*2)/2),v=l??b,C=o===null?null:Math.round(o*2)/2,P=()=>{if(l===null)return;let S=Eb(l);S!==null&&m(S);};return jsxRuntime.jsxs("span",{ref:p,className:"docx-toolbar__font-size","data-slot":"font.size",title:a??void 0,children:[jsxRuntime.jsx(Yd,{className:e,groupLabel:i("fontSize.label"),decreaseLabel:i("fontSize.decrease"),increaseLabel:i("fontSize.increase"),middle:jsxRuntime.jsx("input",{ref:f,type:"text",inputMode:"decimal",className:"docx-toolbar__stepper-value docx-toolbar__stepper-value--boxed docx-toolbar__font-size-input",value:v,disabled:!r,role:"combobox","aria-expanded":s,"aria-haspopup":"listbox","aria-label":i("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(),P(),u(true)):S.key==="Escape"?(S.preventDefault(),u(true)):(S.key==="ArrowDown"||S.key==="ArrowUp")&&(S.preventDefault(),c(true),o!==null&&g(S.key==="ArrowDown"?Ud(o,wn,Mn/2):Wd(o,wn,In/2)));},onBlur:()=>{P(),d(null);}}),canDecrease:h&&Math.round(o*2)>Mn,canIncrease:h&&Math.round(o*2)<In,onDecrease:()=>g(Ud(o??0,wn,Mn/2)),onIncrease:()=>g(Wd(o??0,wn,In/2))}),s&&r?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__font-size-menu",role:"listbox","aria-label":i("fontSize.listLabel"),children:wn.map(S=>{let y=C===S;return jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":y,...y?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>{g(S),u(true);},children:S},S)})}):null]})}function Mb(e){(Fo(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}var fl=Object.assign(wb,{docxSlot:"font.size"});function Ib({className:e,hidden:t}){let n=A(),{zoom:o,isFit:r,mode:a,setZoom:i,setMode:s,zoomIn:c,zoomOut:l,canZoomIn:d,canZoomOut:p,levels:f}=ul(),m=Y(),[g,u]=Ye.useState(false),h=Ye.useRef(null);Ye.useEffect(()=>{if(!g)return;let y=x=>{let M=h.current;M&&x.target instanceof Node&&M.contains(x.target)||u(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[g]);let b=Ye.useCallback(y=>{u(false),i(y);},[i]),v=Ye.useCallback(y=>{u(false),s(y==="auto"?"auto":editor.FIT_WIDTH_ZOOM_MODE);},[s]);if(t)return null;let C=`${Math.round(o*100)}%`,P=editor.sameZoomMode(a,editor.AUTO_ZOOM_MODE),S=editor.sameZoomMode(a,editor.FIT_WIDTH_ZOOM_MODE);return jsxRuntime.jsxs("span",{ref:h,className:"docx-toolbar__zoom","data-slot":"zoom.level",children:[jsxRuntime.jsx(Yd,{className:e,groupLabel:m("zoom.zoomLevel"),decreaseLabel:m("zoom.zoomOut"),increaseLabel:m("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":g,"aria-label":m("zoom.zoomLevel"),onMouseDown:O,onClick:()=>u(y=>!y),children:[C,jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),canDecrease:p,canIncrease:d,onDecrease:l,onIncrease:c}),g?jsxRuntime.jsxs("div",{className:"docx-toolbar__menu docx-toolbar__zoom-menu",role:"listbox","aria-label":m("zoom.zoomLevel"),children:[jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":P,...P?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>v("auto"),children:m("zoom.automatic")}),jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":S,...S?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>v("fit-width"),children:m("zoom.fitWidth")}),jsxRuntime.jsx("hr",{className:"docx-toolbar__menu-separator",role:"presentation"}),f.map(y=>{let x=!r&&Math.abs(y-o)<.001;return jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":x,...x?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>b(y),children:`${Math.round(y*100)}%`},y)})]}):null]})}var gl=Object.assign(Ib,{docxSlot:"zoom.level"});var Db=[1,1.15,1.5,2,2.5,3],jd=10,Lb=e=>({lineSpacing:e.formatting?.lineSpacing??null,spaceBeforePt:e.formatting?.spaceBeforePt??null,spaceAfterPt:e.formatting?.spaceAfterPt??null}),Hb=(e,t)=>e.spaceBeforePt===t.spaceBeforePt&&e.spaceAfterPt===t.spaceAfterPt&&e.lineSpacing?.rule===t.lineSpacing?.rule&&e.lineSpacing?.value===t.lineSpacing?.value;function Fb({className:e,hidden:t}){let n=A(),o=q(Lb,Hb),{isEnabled:r,disabledReason:a}=ne("list.lineSpacing"),i=Y(),[s,c]=Ye.useState(false),l=Ye.useRef(null);Ye.useEffect(()=>{if(!s)return;let h=b=>{let v=l.current;v&&b.target instanceof Node&&v.contains(b.target)||c(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]);let d=Ye.useCallback(h=>{if(c(false),!n)return;let b=editor.commandForSlotValue("list.lineSpacing",h);b&&n.can(b).ok&&n.exec(b);},[n]),p=Ye.useCallback((h,b)=>{if(c(false),!n)return;let v={type:"setParagraphSpacing",[h]:b};n.can(v).ok&&n.exec(v);},[n]);if(t)return null;let f=ee("list.lineSpacing"),m=(o.spaceBeforePt??0)>0,g=(o.spaceAfterPt??0)>0,u=o.lineSpacing?.rule==="multiple"?o.lineSpacing?.value??null:null;return jsxRuntime.jsxs("span",{ref:l,className:"docx-toolbar__line-spacing","data-slot":"list.lineSpacing",children:[jsxRuntime.jsxs("button",{type:"button",className:`docx-toolbar__button docx-toolbar__line-spacing-trigger${e?` ${e}`:""}`,disabled:!r,...r?{}:{"data-disabled":""},"aria-haspopup":"menu","aria-expanded":s,"aria-label":i("lineSpacing.label"),title:a??i("lineSpacing.label"),onMouseDown:O,onClick:()=>c(h=>!h),children:[te(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:[Db.map(h=>{let b=u===h;return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":b,...b?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>d(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",onMouseDown:O,onClick:()=>p("beforePt",m?null:jd),children:i(m?"lineSpacing.removeSpaceBefore":"lineSpacing.addSpaceBefore")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>p("afterPt",g?null:jd),children:i(g?"lineSpacing.removeSpaceAfter":"lineSpacing.addSpaceAfter")})]}):null]})}var hl=Object.assign(Fb,{docxSlot:"list.lineSpacing"});var Kb=[{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"}],Qd=[{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"}],Jd=["FFFFFF","000000","E7E6E6","44546A","4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47"],na=["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"],Dt=e=>({labelKey:`colorPicker.theme.lighter${e}`,apply:t=>t+(255-t)*(e/100)}),Qe=e=>({labelKey:`colorPicker.theme.darker${e}`,apply:t=>t*(1-e/100)});function zb(e){let t=[0,2,4].map(o=>parseInt(e.slice(o,o+2),16)),n=(Math.max(...t)+Math.min(...t))/2/255;return n===1?[Qe(5),Qe(15),Qe(25),Qe(35),Qe(50)]:n===0?[Dt(50),Dt(35),Dt(25),Dt(15),Dt(5)]:n>=.8?[Qe(10),Qe(25),Qe(50),Qe(75),Qe(90)]:[Dt(80),Dt(60),Dt(40),Qe(25),Qe(50)]}var Vb=/^[0-9A-Fa-f]{6}$/;function $b(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 Wb(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 ra({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":""}:{},...Wb(t.replace("#",""))?{"data-light":""}:{},onMouseDown:O,onClick:()=>r(e)})}function Ub({apply:e,label:t,current:n,themeHexes:o}){let r=o.map(zb),a=[0,1,2,3,4];return jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:t("colorPicker.themeColors")}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-grid docx-toolbar__swatch-grid--theme",role:"group",children:[o.map((i,s)=>jsxRuntime.jsx(ra,{value:i,css:`#${i.toLowerCase()}`,title:t(na[s]),selected:n===i,apply:e},`base-${s}`)),a.map(i=>o.map((s,c)=>{let l=r[c][i],d=$b(s,l.apply);return jsxRuntime.jsx(ra,{value:d,css:`#${d.toLowerCase()}`,title:`${t(na[c])}, ${t(l.labelKey)}`,selected:n===d,apply:e},`${i}-${c}`)}))]})]})}function Gb(e){let{apply:t,label:n,current:o}=e,[r,a]=Ye.useState(""),i=Vb.test(r);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ub,{...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:Kb.map(s=>jsxRuntime.jsx(ra,{value:s.value,css:s.css,title:n(s.labelKey),selected:o===s.value,apply:t},s.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:s=>a(s.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:s=>{s.key==="Enter"&&i&&t(r.toUpperCase());}}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__swatch-apply",disabled:!i,onMouseDown:O,onClick:()=>t(r.toUpperCase()),children:n("colorPicker.apply")})]})]})]})}function yl({apply:e,current:t}){let n=A(),o=Y(),r=n?.getDocumentThemeColors()??[],a=r.length===na.length?r.map(s=>s.hex):Jd,i=t?.toUpperCase()??null;return jsxRuntime.jsx(Gb,{apply:e,label:o,current:i,themeHexes:a})}var Yb=Qd.filter(e=>e.value!=="white");function Xb({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:Yb.map(o=>jsxRuntime.jsx(ra,{value:o.value,css:o.css,title:t(o.labelKey),selected:n===o.value,apply:e},o.value))})]})}function eu(e){let{slot:t,defaultValue:n,cssOf:o,clear:r,body:a}=e,i=t==="text.color";return Object.assign(({className:c,hidden:l,icon:d})=>{let p=A(),{isEnabled:f,disabledReason:m}=ne(t),g=Y(),[u,h]=Ye.useState(false),[b,v]=Ye.useState(n),C=Ye.useRef(null),P=q(w=>{if(i){let N=w.formatting?.color;return N&&N.kind==="hex"?N.value.toUpperCase():null}return w.formatting?.highlight??null}),S=p?.getDocumentThemeColors()??[],y=S.length===na.length?S.map(w=>w.hex):Jd;Ye.useEffect(()=>{if(!u)return;let w=N=>{let F=C.current;F&&N.target instanceof Node&&F.contains(N.target)||h(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[u]);let x=Ye.useCallback(w=>{if(h(false),!p)return;let N=editor.commandForSlotValue(t,w);N&&p.can(N).ok&&(p.exec(N),w!==r.value&&v(w));},[p]),M=Ye.useMemo(()=>ee(t),[]);if(l)return null;let E=g(M?.labelKey??t);return jsxRuntime.jsxs("div",{ref:C,className:`docx-toolbar__colorsplit${c?` ${c}`:""}`,"data-slot":t,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__button docx-toolbar__colorsplit-main",disabled:!f,...f?{}:{"data-disabled":""},"aria-label":E,title:m??E,onMouseDown:O,onClick:()=>x(b),children:[d??te(M?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:o(b)},"aria-hidden":"true"})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__colorsplit-caret",disabled:!f,...f?{}:{"data-disabled":""},"aria-haspopup":"true","aria-expanded":u,"aria-label":E,title:m??E,onMouseDown:O,onClick:()=>h(w=>!w),children:"\u25BE"}),u?jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-popup",role:"dialog","aria-label":E,onMouseDown:O,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:O,onClick:()=>x(r.value),children:[jsxRuntime.jsx("span",{className:`docx-toolbar__swatch-clear-chip${r.value==="none"?" docx-toolbar__swatch-clear-chip--none":""}`,"aria-hidden":"true"}),g(r.labelKey)]}),a({apply:x,label:g,current:P,themeHexes:y})]}):null]})},{docxSlot:t})}var jb=new Map(Qd.map(e=>[e.value,e.css])),xl=eu({slot:"text.color",defaultValue:"FF0000",cssOf:e=>e==="auto"?"#000000":`#${e}`,clear:{value:"auto",labelKey:"colorPicker.automatic"},body:e=>jsxRuntime.jsx(yl,{apply:e.apply,current:e.current})}),Tl=eu({slot:"text.highlight",defaultValue:"yellow",cssOf:e=>jb.get(e)??"#ffff00",clear:{value:"none",labelKey:"colorPicker.noColor"},body:e=>jsxRuntime.jsx(Xb,{...e})});var oh=["alignment.left","alignment.center","alignment.right","alignment.justify"];function nh({className:e,hidden:t}){let n=ne("alignment.left"),o=ne("alignment.center"),r=ne("alignment.right"),a=ne("alignment.justify"),i=Y(),[s,c]=Ye.useState(false),l=Ye.useRef(null);if(Ye.useEffect(()=>{if(!s)return;let u=h=>{let b=l.current;b&&h.target instanceof Node&&b.contains(h.target)||c(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),t)return null;let d=[n,o,r,a],p=oh.map((u,h)=>({slot:u,control:ee(u),state:d[h]})),f=p.find(u=>u.state.isActive)??p[0],m=p.some(u=>u.state.isEnabled),g=i(f.control?.labelKey??f.slot);return jsxRuntime.jsxs("div",{ref:l,className:`docx-toolbar__alignment${e?` ${e}`:""}`,"data-slot":"alignment",children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__button docx-toolbar__alignment-trigger",disabled:!m,...m?{}:{"data-disabled":""},"aria-haspopup":"true","aria-expanded":s,"aria-label":g,title:m?g:f.state.disabledReason??g,onMouseDown:O,onClick:()=>c(u=>!u),children:[te(f.control?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),s?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__alignment-popup",children:p.map(u=>{let h=i(u.control?.labelKey??u.slot);return jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__button docx-toolbar__alignment-option","data-slot":u.slot,disabled:!u.state.isEnabled,...u.state.isActive?{"data-active":""}:{},"aria-pressed":u.state.isActive,"aria-label":h,title:u.state.disabledReason??h,onMouseDown:O,onClick:()=>{u.state.execute(),c(false);},children:te(u.control?.paths)},u.slot)})}):null]})}var aa=Object.assign(nh,{docxSlot:"alignment"});function Cl(e){let{label:t,icon:n,active:o,disabled:r,disabledReason:a,onSelect:i,asChild:s,className:c,children:l}=e,d={type:"button",className:`docx-toolbar__button${c?` ${c}`:""}`,disabled:r,...o?{"data-active":""}:{},...r?{"data-disabled":""}:{},...o!==void 0?{"aria-pressed":o}:{},"aria-label":t,title:r?a??t:t,onMouseDown:p=>O(p),onClick:r?void 0:i};return s?jsxRuntime.jsx(W,{...d,children:l}):jsxRuntime.jsx("button",{...d,children:n??l})}var uh=Object.freeze([]),ph=e=>e.formatting?.fontFamily??null,mh=e=>e;function ia(){let e=A(),t=q(ph),n=q(mh),o=Ye.useMemo(()=>e&&!n.isLoading?e.getAvailableFonts():uh,[e,n]),{isEnabled:r}=ne("font.family"),a=Ye.useCallback(i=>{if(!e)return;let s=editor.commandForSlotValue("font.family",i);s&&e.can(s).ok&&e.exec(s);},[e]);return Ye.useMemo(()=>({value:t,setValue:a,options:o,isEnabled:r}),[t,a,o,r])}var nu=Ye.createContext(null);function El(){return Ye.useContext(nu)}function wl({asChild:e,className:t,children:n}){let o=El(),r=Y();if(!o)return null;let a=r(ee("font.family")?.labelKey??"font.family"),i={onClick:()=>o.setOpen(!o.open),onMouseDown:O,disabled:!o.isEnabled,className:`docx-toolbar__font-family-trigger${t?` ${t}`:""}`,...o.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":o.open,"aria-label":a,title:a},s=n??jsxRuntime.jsx("span",{children:o.value??"\u2014"});return e?jsxRuntime.jsx(W,{...i,children:s}):jsxRuntime.jsx("button",{type:"button",...i,children:s})}wl.docxToolbarPart=true;var fh=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"]]),gh=[{category:"sansSerif",labelKey:"font.sansSerif"},{category:"serif",labelKey:"font.serif"},{category:"monospace",labelKey:"font.monospace"},{category:"other",labelKey:null}];function ru({asChild:e,className:t,children:n}){let o=El(),r=Y();if(!o||!o.open)return null;let a={role:"listbox",className:`docx-toolbar__menu docx-toolbar__font-family-content${t?` ${t}`:""}`,style:{position:"absolute",top:"100%",left:0,zIndex:30,minWidth:"100%",maxHeight:300,overflowY:"auto"}},i;return n!==void 0?i=n:i=gh.map(c=>({...c,fonts:o.options.filter(l=>(fh.get(l.toLowerCase())??"other")===c.category)})).filter(c=>c.fonts.length>0).map((c,l)=>jsxRuntime.jsxs("div",{role:"group",children:[l>0?jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}):null,c.labelKey?jsxRuntime.jsx("div",{className:"docx-toolbar__menu-label",children:r(c.labelKey)}):null,c.fonts.map(d=>jsxRuntime.jsx(au,{value:d},d))]},c.category)),e?jsxRuntime.jsx(W,{...a,children:i}):jsxRuntime.jsx("div",{...a,children:i})}function au({value:e,asChild:t,className:n,children:o}){let r=El();if(!r)return null;let a=r.value===e,i={role:"option","aria-selected":a,...a?{"data-selected":""}:{},onMouseDown:O,onClick:()=>{r.setValue(e),r.setOpen(false);},className:`docx-toolbar__font-family-item${n?` ${n}`:""}`},s=o??jsxRuntime.jsx("span",{style:{fontFamily:e},children:e});return t?jsxRuntime.jsx(W,{...i,children:s}):jsxRuntime.jsxs("button",{type:"button",...i,children:[s,a?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function bh({hidden:e,asChild:t,className:n,children:o}){let r=ia(),[a,i]=Ye.useState(false),s=Ye.useRef(null);Ye.useEffect(()=>{if(!a)return;let p=f=>{let m=s.current;m&&f.target instanceof Node&&m.contains(f.target)||i(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[a]);let c=Ye.useMemo(()=>({...r,open:a,setOpen:i}),[r,a]);if(e)return null;let l={className:`docx-toolbar__font-family${n?` ${n}`:""}`,"data-slot":"font.family",style:{position:"relative",display:"inline-block"}},d=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(wl,{}),jsxRuntime.jsx(ru,{})]});return jsxRuntime.jsx(nu.Provider,{value:c,children:t?jsxRuntime.jsx(W,{...l,ref:s,children:d}):jsxRuntime.jsx("div",{ref:s,...l,children:d})})}var Ml=Object.assign(bh,{docxSlot:"font.family",Trigger:wl,Content:ru,Item:au});function Eh(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 wh=Object.freeze([]),Mh=e=>e.formatting?.styleId??null,Ih=e=>e;function la(){let e=A(),t=q(Mh),n=q(Ih),o=Ye.useMemo(()=>e&&!n.isLoading?e.getDocumentStyles().filter(i=>i.type==="paragraph").map(i=>({styleId:i.styleId,name:i.name,preview:i.preview})):wh,[e,n]),{isEnabled:r}=ne("styles.style"),a=Ye.useCallback(i=>{if(!e)return;let s=editor.commandForSlotValue("styles.style",i);s&&e.can(s).ok&&e.exec(s);},[e]);return Ye.useMemo(()=>({value:t,setValue:a,options:o,isEnabled:r}),[t,a,o,r])}var iu=Ye.createContext(null);function Rl(){return Ye.useContext(iu)}function _l({asChild:e,className:t,children:n}){let o=Rl(),r=Y();if(!o)return null;let a=ee("styles.style"),i=r(a?.labelKey??"styles.style"),s={onClick:()=>o.setOpen(!o.open),onMouseDown:O,disabled:!o.isEnabled,className:`docx-toolbar__style-trigger${t?` ${t}`:""}`,...o.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":o.open,"aria-label":i,title:i},c=o.options.find(d=>d.styleId===o.value),l=n??(o.value===null?jsxRuntime.jsx("span",{children:a?.valueKey?r(a.valueKey):"\u2014"}):jsxRuntime.jsx("span",{children:c?.name??o.value}));return e?jsxRuntime.jsx(W,{...s,children:l}):jsxRuntime.jsx("button",{type:"button",...s,children:l})}_l.docxToolbarPart=true;function lu({asChild:e,className:t,children:n}){let o=Rl();if(!o||!o.open)return null;let r={role:"listbox",className:`docx-toolbar__menu docx-toolbar__style-content${t?` ${t}`:""}`,style:{position:"absolute",top:"100%",left:0,zIndex:30,minWidth:"100%",maxHeight:300,overflowY:"auto"}},a=n??o.options.map(i=>jsxRuntime.jsx(su,{value:i.styleId},i.styleId));return e?jsxRuntime.jsx(W,{...r,children:a}):jsxRuntime.jsx("div",{...r,children:a})}function su({value:e,asChild:t,className:n,children:o}){let r=Rl();if(!r)return null;let a=r.value===e,i=r.options.find(l=>l.styleId===e),s={role:"option","aria-selected":a,...a?{"data-selected":""}:{},onMouseDown:O,onClick:()=>{r.setValue(e),r.setOpen(false);},className:`docx-toolbar__style-item${n?` ${n}`:""}`},c=o??jsxRuntime.jsx("span",{style:i?Eh(i.preview):void 0,children:i?.name??e});return t?jsxRuntime.jsx(W,{...s,children:c}):jsxRuntime.jsxs("button",{type:"button",...s,children:[c,a?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function kh({hidden:e,asChild:t,className:n,children:o}){let r=la(),[a,i]=Ye.useState(false),s=Ye.useRef(null);Ye.useEffect(()=>{if(!a)return;let p=f=>{let m=s.current;m&&f.target instanceof Node&&m.contains(f.target)||i(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[a]);let c=Ye.useMemo(()=>({...r,open:a,setOpen:i}),[r,a]);if(e)return null;let l={className:`docx-toolbar__style${n?` ${n}`:""}`,"data-slot":"styles.style",style:{position:"relative",display:"inline-block"}},d=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(_l,{}),jsxRuntime.jsx(lu,{})]});return jsxRuntime.jsx(iu.Provider,{value:c,children:t?jsxRuntime.jsx(W,{...l,ref:s,children:d}):jsxRuntime.jsx("div",{ref:s,...l,children:d})})}var Nl=Object.assign(kh,{docxSlot:"styles.style",Trigger:_l,Content:lu,Item:su});function du(e,t){let n=e;return Object.assign(({className:r,hidden:a,icon:i,asChild:s,children:c})=>{let{isEnabled:l,disabledReason:d}=ne(n),p=pt(),f=t==="showAll"?p.showAll:p.formFill,m=Y();if(a)return null;let g=ee(n),u=m(g?.labelKey??e),h={type:"button",className:`docx-toolbar__button${r?` ${r}`:""}`,"data-slot":e,disabled:!l,...l?{}:{"data-disabled":""},...f?{"data-active":""}:{},"aria-pressed":f,"aria-label":u,title:d??u,onMouseDown:O,onClick:()=>{t==="showAll"?p.toggleShowAll():p.toggleFormFill();}};return s?jsxRuntime.jsx(W,{...h,children:c}):jsxRuntime.jsx("button",{...h,children:i??c??te(g?.paths)})},{docxSlot:n})}function _h({className:e,hidden:t,icon:n,asChild:o,children:r}){let a=Be.inspector,{isEnabled:i,disabledReason:s}=ne(a),{inspectorOpen:c,openInspector:l}=pt(),d=Y();if(t)return null;let p=ee(a),f=d(p?.labelKey??"contentControl.inspector"),m={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Be.inspector,disabled:!i,...i?{}:{"data-disabled":""},...c?{"data-active":""}:{},"aria-pressed":c,"aria-label":f,title:s??f,onMouseDown:O,onClick:()=>l()};return o?jsxRuntime.jsx(W,{...m,children:r}):jsxRuntime.jsx("button",{...m,children:n??r??te(p?.paths)})}function Nh({className:e,hidden:t,icon:n,asChild:o,children:r}){let{canRemove:a,removeDisabledReason:i,remove:s}=pt(),c=Y();if(t)return null;let l=Be.remove,d=ee(l),p=c(d?.labelKey??"contentControl.remove"),f={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Be.remove,disabled:!a,...a?{}:{"data-disabled":""},"aria-label":p,title:i??p,onMouseDown:O,onClick:()=>{s();}};return o?jsxRuntime.jsx(W,{...f,children:r}):jsxRuntime.jsx("button",{...f,children:n??r??te(d?.paths)})}var sa=du(Be.showAll,"showAll"),ca=du(Be.formFill,"formFill"),da=Object.assign(Nh,{docxSlot:Be.remove}),ua=Object.assign(_h,{docxSlot:Be.inspector}),uu={[Be.showAll]:sa,[Be.formFill]:ca,[Be.inspector]:ua,[Be.remove]:da};function Dl(e,t){let n=A(),o=Ye.useRef(t);o.current=t,Ye.useEffect(()=>{if(!n)return;let r=((...a)=>{o.current(...a);});return n.on(e,r)},[n,e]);}var Zh=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],Hl=Ye.createContext(null);function vu(){let e=Ye.useContext(Hl);if(!e)throw new Error("table chrome group must render inside TableChromeProvider");return e.visible}function qh(e,t){let n=t.table,r=(e?.getSelectedTable()??null)?.blockId??"",a=n?`${r}|${n.rows}|${n.columns}|${n.rowIndex}|${n.columnIndex}`:"",i=t.selection,s=i?`${i.from&&"paraId"in i.from?i.from.paraId:""}|${i.to&&"paraId"in i.to?i.to.paraId:""}|${t.selectionCollapsed}`:"",c=e?.getTableCellSelection()??null,l=c?`${c.tableId}|${c.rows.from}-${c.rows.to}|${c.columns.from}-${c.columns.to}|${c.cellIds.join(",")}`:"";return {tableKey:a,selectionKey:s,cellSelectionKey:l,editable:t.editable,editingMode:t.editingMode??"editing"}}function Kh(e,t){return e.table===t.table&&e.editable===t.editable&&e.editingMode===t.editingMode&&e.headParagraphId===t.headParagraphId}function zh(e,t){return e.tableKey===t.tableKey&&e.selectionKey===t.selectionKey&&e.cellSelectionKey===t.cellSelectionKey&&e.editable===t.editable&&e.editingMode===t.editingMode}var bu={tableKey:"",selectionKey:"",cellSelectionKey:"",editable:false,editingMode:"editing"};function Vh(e,t){let n={};for(let o of Zh){let r=editor.tableChromeToolbarState(e,o,t);n[o]={enabled:r.enabled,disabledReason:r.disabledReason};}return n}function Fl({children:e}){let t=A(),[n,o]=Ye.useState(editor.DEFAULT_TABLE_CHROME_DRAFT),[r,a]=Ye.useState(bu);Ye.useEffect(()=>(()=>{}),[]);let i=q(Ye.useCallback(f=>({table:f.table,editable:f.editable,editingMode:f.editingMode??"editing",headParagraphId:f.selection?.to&&"paraId"in f.selection.to?f.selection.to.paraId:f.selection?.from&&"paraId"in f.selection.from?f.selection.from.paraId:""}),[]),Kh,{onSubscribe:()=>{},onUnsubscribe:()=>{}}),s=Ye.useCallback(()=>{if(!t){a(bu);return}let f=qh(t,t.snapshot());a(m=>zh(m,f)?m:f);},[t]);Ye.useEffect(()=>{s();},[s,i]),Dl("selectionChange",Ye.useCallback(()=>{s();},[s]));let c=r.tableKey!=="",l=Ye.useMemo(()=>t?Vh(t,n):{},[t,n,r.tableKey,r.selectionKey,r.cellSelectionKey,r.editable,r.editingMode]),d=Ye.useCallback((f,m)=>{if(!t)return;let{result:g,nextDraft:u}=editor.runTableChromeCommand(t,f,m,n);g.ok&&u&&o(u);},[t,n]),p=Ye.useMemo(()=>({visible:c,draft:n,setDraft:o,slotState:f=>l[f]??{enabled:false,disabledReason:"editor is not ready"},apply:d}),[c,n,l,d]);return jsxRuntime.jsx(Hl.Provider,{value:p,children:e})}function $h(){let e=Ye.useContext(Hl);if(!e)throw new Error("table chrome parts must render inside TableChromeProvider");return e}function ma(e){let t=$h(),n=t.slotState(e);return Ye.useMemo(()=>({visible:t.visible,enabled:n.enabled,disabledReason:n.disabledReason,draft:t.draft,apply:o=>t.apply(e,o)}),[t,e,n])}var Uh='[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]';function Jt(e){return [...e.querySelectorAll(Uh)].filter(t=>t.closest('[role="menu"]')===e)}function Al(e){return [...e.querySelectorAll(".docx-menubar__trigger")]}function at(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 it(e,t){let n=t==="first"?e[0]:e[e.length-1];return n?(n.focus(),true):false}function fa(e){(Fo(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}function Zl(e,t,n){Ye.useEffect(()=>{if(!e)return;let o=r=>{let a=n.current;a&&r.target instanceof Node&&a.contains(r.target)||t(false);};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,t,n]);}function ga({enabled:e,disabledReason:t,ariaLabel:n}){let o=Ye.useId(),r=!e&&t?o:void 0;return {reasonId:o,shared:{type:"button",onMouseDown:O,"aria-label":n,...r?{"aria-describedby":r}:{},...t?{title:t}:{},...e?{}:{"data-disabled":"","aria-disabled":true}},reasonNode:r&&t?jsxRuntime.jsx("span",{id:o,className:"docx-editor-sr-only",children:t}):null}}var Yh='[role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]';function yu(e,t,n,o){Ye.useEffect(()=>{if(!e)return;let r=n.current,a=o.current;if(!r)return;let i=()=>[...r.querySelectorAll(Yh)].filter(l=>l.closest('[role="menu"]')===r);queueMicrotask(()=>{let l=i();(l.find(p=>p.hasAttribute("data-selected")||p.hasAttribute("data-active"))??l[0])?.focus();});let c=l=>{let d=i();if(l.key==="Escape"){l.preventDefault(),t(false),a?.focus();return}if(l.key==="ArrowDown"){l.preventDefault(),at(d,document.activeElement,1);return}if(l.key==="ArrowUp"){l.preventDefault(),at(d,document.activeElement,-1);return}if(l.key==="Home"){l.preventDefault(),it(d,"first");return}if(l.key==="End"){l.preventDefault(),it(d,"last");return}if(l.key==="Enter"||l.key===" "){let p=document.activeElement;p instanceof HTMLElement&&d.includes(p)&&(l.preventDefault(),p.click());}};return r.addEventListener("keydown",c),()=>r.removeEventListener("keydown",c)},[e,t,n,o]);}function xu(e,t,n,o){Ye.useEffect(()=>{if(!e)return;let r=n.current,a=o.current;if(!r)return;let i=()=>[...r.querySelectorAll('button:not([aria-disabled="true"])')].filter(c=>c.closest('[role="dialog"]')===r);queueMicrotask(()=>{i()[0]?.focus();});let s=c=>{if(c.key==="Escape"){c.preventDefault(),t(false),a?.focus();return}if(c.key==="Enter"||c.key===" "){let l=document.activeElement,d=i();l instanceof HTMLElement&&d.includes(l)&&(c.preventDefault(),l.click());}};return r.addEventListener("keydown",s),()=>r.removeEventListener("keydown",s)},[e,t,n,o]);}function Eu(e,t,n){if(e)return o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),n(!t));}}function ov(e){return te(editor.tableChromeIconPaths(e))}function wu(){return Ye.createContext(null)}function Pt(e){let t=Ye.useContext(e);if(!t)throw new Error("table chrome compound part used outside its root");return t}function ql(e,t,n){let o=wu();function r({hidden:s,asChild:c,className:l,children:d}){let{visible:p,enabled:f,disabledReason:m,draft:g,apply:u}=ma(e),[h,b]=Ye.useState(false),v=Ye.useRef(null),C=Ye.useRef(null);Zl(h,b,v);let P=Ye.useMemo(()=>({open:h,setOpen:b,enabled:f,disabledReason:m,apply:u,draft:g,triggerRef:C}),[h,f,m,u,g]);if(s||!p)return null;let S={className:`${t}${l?` ${l}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},y=d??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(a,{}),jsxRuntime.jsx(i,{})]});return jsxRuntime.jsx(o.Provider,{value:P,children:c?jsxRuntime.jsx(W,{...S,ref:v,children:y}):jsxRuntime.jsx("div",{ref:v,...S,children:y})})}function a({asChild:s,className:c,children:l}){let{open:d,setOpen:p,enabled:f,disabledReason:m,triggerRef:g}=Pt(o),u=Y(),h=ee(e),b=u(h?.labelKey??n),{shared:v,reasonNode:C}=ga({enabled:f,disabledReason:m,ariaLabel:b}),P={...v,ref:g,className:`docx-toolbar__button docx-table-chrome__trigger${c?` ${c}`:""}`,"aria-haspopup":"menu","aria-expanded":d,onClick:f?()=>p(!d):void 0,...s?{tabIndex:f?0:-1,role:"button",onKeyDown:Eu(f,d,p)}:{}},S=l??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[te(h?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]});return s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(W,{...P,children:S}),C]}):jsxRuntime.jsxs("button",{...P,children:[S,C]})}a.docxToolbarPart=true;function i({asChild:s,className:c,children:l}){let{open:d,setOpen:p,enabled:f,triggerRef:m}=Pt(o),g=Y(),u=Ye.useRef(null);if(yu(d&&f,p,u,m),!d||!f)return null;let h=ee(e),b=g(h?.labelKey??n),v={ref:u,role:"menu","aria-label":b,className:`docx-table-chrome__panel${c?` ${c}`:""}`,onMouseDown:O};return s?jsxRuntime.jsx(W,{...v,children:l}):jsxRuntime.jsx("div",{...v,children:l})}return {Root:r,Trigger:a,Content:i,Ctx:o}}var Nn=ql("table.borderTarget","docx-table-chrome docx-table-chrome--target","table.borders.tooltip");function Mu({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:a,draft:i}=Pt(Nn.Ctx),s=Y(),c=editor.TABLE_BORDER_TARGET_OPTIONS.find(f=>f.value===e);if(!c)return null;let l=c.value==="none"?false:c.value===i.activeTarget,d={type:"button",role:"menuitemradio","aria-checked":l,"data-value":c.value,className:`docx-table-chrome__target-btn${n?` ${n}`:""}`,...l?{"data-active":""}:{},"aria-label":s(c.labelKey),title:s(c.labelKey),onMouseDown:O,onClick:()=>{a(false),r(c.value);}},p=o??ov(c.icon);return t?jsxRuntime.jsx(W,{...d,children:p}):jsxRuntime.jsx("button",{...d,children:p})}function Iu(e){let{children:t}=e;return jsxRuntime.jsx(Nn.Content,{...e,children:t??jsxRuntime.jsx("div",{className:"docx-table-chrome__target-grid",children:editor.TABLE_BORDER_TARGET_OPTIONS.map(n=>jsxRuntime.jsx(Mu,{value:n.value},n.value))})})}function nv(e){let{children:t}=e,n=t??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Nn.Trigger,{}),jsxRuntime.jsx(Iu,{})]});return jsxRuntime.jsx(Nn.Root,{...e,children:n})}var An=Object.assign(nv,{docxSlot:"table.borderTarget",Trigger:Nn.Trigger,Content:Iu,Item:Mu}),Dn=ql("table.borderStyle","docx-table-chrome docx-table-chrome--style","table.borders.styleAriaLabel");function ku({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:a,draft:i}=Pt(Dn.Ctx),s=Y(),c=editor.TABLE_BORDER_STYLE_OPTIONS.find(f=>f.value===e);if(!c)return null;let l=c.value===i.spec.style,d={type:"button",role:"menuitemradio","aria-checked":l,...l?{"data-selected":""}:{},className:`docx-table-chrome__width-row${n?` ${n}`:""}`,onMouseDown:O,onClick:()=>{a(false),r(c.value);}},p=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:`docx-table-line ${c.previewClass}`,"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:s(c.labelKey)})]});return t?jsxRuntime.jsx(W,{...d,children:p}):jsxRuntime.jsx("button",{...d,children:p})}function Ru(e){let{children:t}=e;return jsxRuntime.jsx(Dn.Content,{...e,children:t??editor.TABLE_BORDER_STYLE_OPTIONS.map(n=>jsxRuntime.jsx(ku,{value:n.value},n.value))})}function rv(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Dn.Trigger,{}),jsxRuntime.jsx(Ru,{})]});return jsxRuntime.jsx(Dn.Root,{...e,children:t})}var On=Object.assign(rv,{docxSlot:"table.borderStyle",Trigger:Dn.Trigger,Content:Ru,Item:ku}),Ln=ql("table.borderWidth","docx-table-chrome docx-table-chrome--width","table.borderWidth");function _u({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:a,draft:i}=Pt(Ln.Ctx),s=Y(),c=Number(e),l=editor.TABLE_BORDER_WIDTH_OPTIONS.find(m=>m.size===c);if(!l)return null;let d=l.size===i.spec.size,p={type:"button",role:"menuitemradio","aria-checked":d,...d?{"data-selected":""}:{},className:`docx-table-chrome__width-row${n?` ${n}`:""}`,onMouseDown:O,onClick:()=>{a(false),r(l.size);}},f=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"docx-table-line docx-table-line--single",style:{height:`${l.previewThickness}px`},"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:s(l.labelKey)})]});return t?jsxRuntime.jsx(W,{...p,children:f}):jsxRuntime.jsx("button",{...p,children:f})}function Nu(e){let{children:t}=e;return jsxRuntime.jsx(Ln.Content,{...e,children:t??editor.TABLE_BORDER_WIDTH_OPTIONS.map(n=>jsxRuntime.jsx(_u,{value:String(n.size)},n.size))})}function av(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ln.Trigger,{}),jsxRuntime.jsx(Nu,{})]});return jsxRuntime.jsx(Ln.Root,{...e,children:t})}var Zn=Object.assign(av,{docxSlot:"table.borderWidth",Trigger:Ln.Trigger,Content:Nu,Item:_u});function Du(e,t,n){let o=n?.defaultHex??"FF0000",r=wu();function a({hidden:d,asChild:p,className:f,children:m}){let{visible:g,enabled:u,disabledReason:h,draft:b,apply:v}=ma(e),[C,P]=Ye.useState(false),[S,y]=Ye.useState(o),x=Ye.useRef(null),M=Ye.useRef(null);Zl(C,P,x);let E=Ye.useMemo(()=>({open:C,setOpen:P,enabled:u,disabledReason:h,apply:v,draft:b,triggerRef:M,lastHex:S,setLastHex:y}),[C,u,h,v,b,S]);if(d||!g)return null;let w={className:`docx-toolbar__colorsplit docx-table-chrome${f?` ${f}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},N=m??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(i,{}),jsxRuntime.jsx(s,{}),jsxRuntime.jsx(c,{clearFill:n?.clearFill??false})]});return jsxRuntime.jsx(r.Provider,{value:E,children:p?jsxRuntime.jsx(W,{...w,ref:x,children:N}):jsxRuntime.jsx("div",{ref:x,...w,children:N})})}function i({asChild:d,className:p,children:f}){let{enabled:m,disabledReason:g,apply:u,draft:h,lastHex:b}=Pt(r),v=Y(),C=ee(e),P=v(C?.labelKey??t),{shared:S,reasonNode:y}=ga({enabled:m,disabledReason:g,ariaLabel:P}),x=e==="table.borderColor"&&h.spec.color.kind==="hex"?h.spec.color.value:b??o,M={...S,className:`docx-toolbar__button docx-toolbar__colorsplit-main${p?` ${p}`:""}`,onClick:m?()=>u({kind:"hex",value:x}):void 0},E=f??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[te(C?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:`#${x.toLowerCase()}`},"aria-hidden":"true"})]});return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(W,{...M,children:E}),y]}):jsxRuntime.jsxs("button",{...M,children:[E,y]})}i.docxToolbarPart=true;function s({asChild:d,className:p,children:f}){let{open:m,setOpen:g,enabled:u,disabledReason:h,triggerRef:b}=Pt(r),v=Y(),C=ee(e),P=v(C?.labelKey??t),{shared:S,reasonNode:y}=ga({enabled:u,disabledReason:h,ariaLabel:P}),x={...S,ref:b,className:`docx-toolbar__colorsplit-caret${p?` ${p}`:""}`,"aria-haspopup":"dialog","aria-expanded":m,onClick:u?()=>g(!m):void 0,...d?{tabIndex:u?0:-1,role:"button",onKeyDown:Eu(u,m,g)}:{}},M=f??"\u25BE";return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(W,{...x,children:M}),y]}):jsxRuntime.jsxs("button",{...x,children:[M,y]})}s.docxToolbarPart=true;function c({asChild:d,className:p,children:f,clearFill:m}){let{open:g,setOpen:u,enabled:h,apply:b,draft:v,triggerRef:C,lastHex:P,setLastHex:S}=Pt(r),y=Y(),x=Ye.useRef(null);if(xu(g&&h,u,x,C),!g||!h)return null;let M=y(t),E=e==="table.borderColor"&&v.spec.color.kind==="hex"?v.spec.color.value:P??o,w={ref:x,role:"dialog","aria-label":M,className:`docx-toolbar__swatch-popup docx-table-chrome__panel${p?` ${p}`:""}`,onMouseDown:O},N=f??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[m?jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:O,onClick:()=>{u(false),b(null),fa(C.current);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__swatch-clear-chip docx-toolbar__swatch-clear-chip--none","aria-hidden":"true"}),y("table.clearCellFill")]}):null,jsxRuntime.jsx(yl,{apply:F=>{u(false),S?.(F),b({kind:"hex",value:F}),fa(C.current);},current:E})]});return d?jsxRuntime.jsx(W,{...w,children:N}):jsxRuntime.jsx("div",{...w,children:N})}function l({value:d,css:p,labelKey:f,asChild:m,className:g,children:u}){let{apply:h,setOpen:b,setLastHex:v,triggerRef:C}=Pt(r),P=Y(),S=p??`#${d.toLowerCase()}`,y=f?P(f):d,x={type:"button",className:`docx-toolbar__swatch docx-table-chrome__swatch${g?` ${g}`:""}`,style:{backgroundColor:S},"data-value":d,"aria-label":y,title:y,onMouseDown:O,onClick:()=>{b(false),v?.(d),h({kind:"hex",value:d}),fa(C.current);}};return m?jsxRuntime.jsx(W,{...x,children:u}):jsxRuntime.jsx("button",{...x,children:u})}return {Root:a,Main:i,Trigger:s,Content:c,Item:l,Ctx:r}}var Hn=Du("table.borderColor","table.borderColor",{defaultHex:"000000"});function iv(e){return jsxRuntime.jsx(Hn.Content,{...e,clearFill:false})}function lv(e){return jsxRuntime.jsx(Hn.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function sv(e){return jsxRuntime.jsx(Hn.Root,{...e})}var Bn=Object.assign(sv,{docxSlot:"table.borderColor",Trigger:Hn.Trigger,Content:iv,Item:lv,Main:Hn.Main}),Fn=Du("table.cellFill","table.cellFillColor",{clearFill:true,defaultHex:"FFFF00"});function cv(e){return jsxRuntime.jsx(Fn.Content,{...e,clearFill:true})}function dv(e){return jsxRuntime.jsx(Fn.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function uv(e){return jsxRuntime.jsx(Fn.Root,{...e})}var qn=Object.assign(uv,{docxSlot:"table.cellFill",Trigger:Fn.Trigger,Content:cv,Item:dv,Main:Fn.Main});function Lu({overrides:e=new Map}){return vu()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ho,{}),[An,Bn,On,Zn,qn].map(o=>{let r=e.get(o.docxSlot);return r?jsxRuntime.jsx(Ye.Fragment,{children:r},o.docxSlot):jsxRuntime.jsx(o,{},o.docxSlot)})]}):null}function Hu(){let e=Y(),{draft:t}=ma("table.borderTarget");return e(editor.tableChromeLabelKeyForTarget(t.activeTarget))}var Zu=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],Bu={"zoom.level":gl,"styles.style":Nl,"font.family":Ml,"font.size":fl,"text.color":xl,"text.highlight":Tl,"text.link":cl,"list.lineSpacing":hl,"review.editingMode":$r,"file.save":dl,...uu,"table.borderTarget":An,"table.borderColor":Bn,"table.borderStyle":On,"table.borderWidth":Zn,"table.cellFill":qn,"image.insert":un,"image.properties":Pn,"image.wrap":Tn,"image.altText":Sn},Au=new Map;function fv(e){let t=Au.get(e);return t||(t=n=>jsxRuntime.jsx(Xt,{slot:e,...n}),Au.set(e,t)),t}function gv(e){return editor.formattingBarChromeGroups(e).map(t=>t.id==="alignment"?{id:t.id,labelKey:t.labelKey,entries:[{slot:"alignment",Part:aa}]}:{id:t.id,labelKey:t.labelKey,entries:t.controls.map(n=>{let o=editor.chromeSlotId(t,n);return {slot:o,Part:Bu[o]??fv(o)}})})}var bv=e=>e.image;function hv(e){return e==="alignment"||e in Bu}function Vl(e){let t=No(e,Vl);if(t!==null)return t;if(!Ye.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 Kl(e){if(e==null||typeof e=="boolean")return false;if(Array.isArray(e))return e.some(Kl);let t=Vl(e);return t!=null&&Zu.includes(t)?true:Ye.isValidElement(e)?Ye.Children.toArray(e.props.children).some(Kl):false}function vv(e,t){return t?true:Ye.Children.toArray(e).some(Kl)}function yv(e){let t=Xe(),{className:n,t:o,onSave:r,preset:a=true,overflow:i=true,children:s}=e,c=Ye.useMemo(()=>({t:o,onSave:r}),[o,r]),l=Ri(o),d=q(bv),p=Ye.useMemo(()=>gv(d),[d]),f=Ye.useMemo(()=>new Set(p.flatMap(C=>C.entries.map(P=>P.slot))),[p]),m=Ye.useMemo(()=>p.map(C=>C.id).filter(C=>!Yi.has(C)),[p]),g=Ye.useMemo(()=>Jc(m),[m]),u=a&&i,{attach:h,overflow:b}=cd(u,m,g),v;if(!a)v=s;else {let C=Ye.Children.toArray(s),P=new Map,S=new Map,y=[];for(let N of C){let F=Vl(N);F&&f.has(F)?P.set(F,N):F&&Zu.includes(F)?S.set(F,N):y.push(N);}let x=N=>{let F=P.get(N.slot);if(F)return F;let H=N.Part;return jsxRuntime.jsx(H,{})},M=[],E=[],w=0;for(let N of p){if(b.has(N.id)){let H=N.entries.flatMap(k=>{let D=Tv(k,P,l,N.labelKey,x);return D===null?[]:[jsxRuntime.jsx(Ye.Fragment,{children:D},k.slot)]});if(H.length===0)continue;E.push({id:N.id,labelKey:N.labelKey,children:H});continue}w>0&&M.push(jsxRuntime.jsx(Ho,{},`separator-${N.id}`)),w+=1;let F=Yi.has(N.id);M.push(jsxRuntime.jsx("div",{className:"docx-toolbar__group",...F?{[yn]:""}:{[vn]:N.id},children:N.entries.map(H=>jsxRuntime.jsx(Ye.Fragment,{children:x(H)},H.slot))},N.id));}v=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M,jsxRuntime.jsx(Lu,{overrides:S}),y.length>0?jsxRuntime.jsx("div",{className:"docx-toolbar__group",[yn]:"",children:y}):null,E.length>0?jsxRuntime.jsx(fd,{sections:E}):null]});}return jsxRuntime.jsx(dn.Provider,{value:c,children:jsxRuntime.jsx("div",{ref:h,role:"toolbar","data-testid":"docx-toolbar",className:`${t}docx-toolbar${n?` ${n}`:""}`,...u?{"data-overflow":""}:{},onMouseDown:O,children:vv(s,a)?jsxRuntime.jsx(Fl,{children:v}):v})})}function xv(e){return e?!!e.props.hidden:false}function Tv(e,t,n,o,r){let a=t.get(e.slot);return xv(a)?null:a||hv(e.slot)?jsxRuntime.jsx(pd,{label:Sv(n,e,o),children:r(e)}):jsxRuntime.jsx(md,{slot:e.slot})}function Sv(e,t,n){let o=t.slot==="alignment"?null:ee(t.slot);return e(o?.labelKey??n)}var zn=Object.assign(yv,{Button:Xt,Action:Cl,Separator:Ho,Undo:Cd,Redo:Pd,Bold:Ed,Italic:wd,Underline:Md,Strike:Id,Link:cl,ClearFormatting:kd,Superscript:Rd,Subscript:_d,Alignment:aa,AlignLeft:Nd,AlignCenter:Dd,AlignRight:Ld,AlignJustify:Hd,LineSpacing:hl,BulletList:Fd,NumberedList:Ad,Outdent:Od,Indent:Zd,ImageInsert:un,ImageProperties:Pn,ImageWrap:Tn,ImageAltText:Sn,TableInsert:Bd,TableBorderTarget:An,TableBorderColor:Bn,TableBorderStyle:On,TableBorderWidth:Zn,TableCellFill:qn,Comments:qd,FontFamily:Ml,FontSize:fl,FontColor:xl,Highlight:Tl,Zoom:gl,StylePicker:Nl,EditingMode:$r,Save:dl,ContentControlShowAll:sa,ContentControlFormFill:ca,ContentControlInspector:ua,ContentControlRemove:da});var wv=e=>e.pageSetup??null,Mv=e=>e.editable;function eo(){let e=A(),t=q(wv),n=q(Mv),o=Ye.useMemo(()=>n&&e!==null&&e.can({type:"setPageSetup",marginTop:0}).ok,[e,n]),r=Ye.useCallback(a=>e?e.exec({...a.pageWidthTwips!==void 0?{pageWidth:a.pageWidthTwips}:{},...a.pageHeightTwips!==void 0?{pageHeight:a.pageHeightTwips}:{},...a.orientation!==void 0?{orientation:a.orientation}:{},...a.marginTopTwips!==void 0?{marginTop:a.marginTopTwips}:{},...a.marginRightTwips!==void 0?{marginRight:a.marginRightTwips}:{},...a.marginBottomTwips!==void 0?{marginBottom:a.marginBottomTwips}:{},...a.marginLeftTwips!==void 0?{marginLeft:a.marginLeftTwips}:{},...a.scope!==void 0?{scope:a.scope}:{},type:"setPageSetup"}).ok:false,[e]);return Ye.useMemo(()=>({pageSetup:t,isEnabled:o,apply:r}),[t,o,r])}var Wl=[{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}],Gu=1440,Iv=e=>Math.round(e/Gu*100)/100,kv=e=>Math.round(e*Gu);function Rv(e,t){let n=Math.min(e,t),o=Math.max(e,t);return Wl.findIndex(r=>Math.abs(r.width-n)<20&&Math.abs(r.height-o)<20)}var _v={position:"fixed",inset:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},Nv={backgroundColor:"var(--doc-surface)",borderRadius:8,boxShadow:"0 4px 20px var(--doc-shadow)",minWidth:400,maxWidth:480,width:"100%",margin:20},Dv={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:16,fontWeight:600,color:"var(--doc-text)"},Lv={padding:"16px 20px",display:"flex",flexDirection:"column",gap:14},Vu={fontSize:12,fontWeight:600,color:"var(--doc-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},ba={display:"flex",alignItems:"center",gap:12},ha={width:80,fontSize:13,color:"var(--doc-text-muted)"},va={flex:1,padding:"6px 8px",border:"1px solid var(--doc-border)",borderRadius:4,fontSize:13,backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},Hv={fontSize:11,color:"var(--doc-text-muted)",width:16},Fv={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"flex-end",gap:8},$u={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer",backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},Wu=12240,Uu=15840,Ht=1440;function Vn({open:e,onClose:t,className:n}){let{t:o}=_(),{pageSetup:r,isEnabled:a,apply:i}=eo(),[s,c]=Ye.useState(Wu),[l,d]=Ye.useState(Uu),[p,f]=Ye.useState("portrait"),[m,g]=Ye.useState(Ht),[u,h]=Ye.useState(Ht),[b,v]=Ye.useState(Ht),[C,P]=Ye.useState(Ht),[S,y]=Ye.useState("document"),x=Ye.useRef(null),M=Ye.useRef("no");Ye.useEffect(()=>{if(!e){M.current="no";return}if(M.current==="yes"&&r===null){M.current="no";return}M.current==="yes"||M.current==="loading"&&r===null||(c(r?.pageWidthTwips??Wu),d(r?.pageHeightTwips??Uu),f(r?.orientation??"portrait"),g(r?.marginsTwips.top??Ht),h(r?.marginsTwips.bottom??Ht),v(r?.marginsTwips.left??Ht),P(r?.marginsTwips.right??Ht),y("document"),M.current=r===null?"loading":"yes");},[e,r]),Ye.useEffect(()=>{e&&x.current?.focus();},[e]);let E=Ye.useCallback(k=>{let D=Wl[k];D&&(c(p==="landscape"?D.height:D.width),d(p==="landscape"?D.width:D.height));},[p]),w=Ye.useCallback(k=>{k!==p&&(f(k),c(l),d(s));},[p,s,l]),N=Ye.useCallback(()=>{i({pageWidthTwips:s,pageHeightTwips:l,orientation:p,marginTopTwips:m,marginRightTwips:C,marginBottomTwips:u,marginLeftTwips:b,scope:S})&&t();},[i,s,l,p,m,C,u,b,S,t]);if(!e)return null;let F=Rv(s,l),H=(k,D,I)=>jsxRuntime.jsxs("div",{style:ba,children:[jsxRuntime.jsx("label",{style:ha,children:o(`dialogs.pageSetup.${k}`)}),jsxRuntime.jsx("input",{type:"number",style:va,min:0,max:22,step:.1,value:Iv(D),onChange:R=>I(Math.max(0,kv(Number(R.target.value)||0))),"aria-label":o(`dialogs.pageSetup.${k}`)}),jsxRuntime.jsx("span",{style:Hv,children:"in"})]});return jsxRuntime.jsx("div",{className:n,style:_v,onClick:t,onKeyDown:k=>{k.key==="Escape"&&t(),k.key==="Enter"&&N();},children:jsxRuntime.jsxs("div",{ref:x,tabIndex:-1,style:Nv,onClick:k=>k.stopPropagation(),onMouseDown:k=>k.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":o("dialogs.pageSetup.title"),children:[jsxRuntime.jsx("div",{style:Dv,children:o("dialogs.pageSetup.title")}),jsxRuntime.jsxs("div",{style:Lv,children:[jsxRuntime.jsx("div",{style:Vu,children:o("dialogs.pageSetup.pageSize")}),jsxRuntime.jsxs("div",{style:ba,children:[jsxRuntime.jsx("label",{style:ha,children:o("dialogs.pageSetup.sizeLabel")}),jsxRuntime.jsxs("select",{style:va,value:F,onChange:k=>E(Number(k.target.value)),"aria-label":o("dialogs.pageSetup.sizeLabel"),children:[Wl.map((k,D)=>jsxRuntime.jsx("option",{value:D,children:o(k.labelKey)},k.labelKey)),F<0&&jsxRuntime.jsx("option",{value:-1,children:o("dialogs.pageSetup.custom")})]})]}),jsxRuntime.jsxs("div",{style:ba,children:[jsxRuntime.jsx("label",{style:ha,children:o("dialogs.pageSetup.orientation")}),jsxRuntime.jsxs("select",{style:va,value:p,onChange:k=>w(k.target.value),"aria-label":o("dialogs.pageSetup.orientation"),children:[jsxRuntime.jsx("option",{value:"portrait",children:o("dialogs.pageSetup.portrait")}),jsxRuntime.jsx("option",{value:"landscape",children:o("dialogs.pageSetup.landscape")})]})]}),jsxRuntime.jsx("div",{style:{...Vu,marginTop:4},children:o("dialogs.pageSetup.margins")}),H("top",m,g),H("bottom",u,h),H("left",b,v),H("right",C,P),jsxRuntime.jsxs("div",{style:ba,children:[jsxRuntime.jsx("label",{style:ha,children:o("dialogs.pageSetup.applyTo")}),jsxRuntime.jsxs("select",{style:va,value:S,onChange:k=>y(k.target.value),"aria-label":o("dialogs.pageSetup.applyTo"),children:[jsxRuntime.jsx("option",{value:"document",children:o("dialogs.pageSetup.applyToDocument")}),jsxRuntime.jsx("option",{value:"section",children:o("dialogs.pageSetup.applyToSection")})]})]})]}),jsxRuntime.jsxs("div",{style:Fv,children:[jsxRuntime.jsx("button",{type:"button",style:$u,onClick:t,children:o("common.cancel")}),jsxRuntime.jsx("button",{type:"button",style:{...$u,backgroundColor:"var(--doc-primary)",color:"var(--doc-on-primary)",borderColor:"var(--doc-primary)",opacity:a?1:.5},disabled:!a,onClick:N,children:o("common.apply")})]})]})})}var $n=Ye.createContext({t:void 0,openMenu:null,setOpenMenu:()=>{},activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onReportIssue:void 0,reportIssue:void 0});function ft(){return Ye.useContext($n)}function Oe(){let{t:e}=ft(),{t}=_();return n=>e?.(n)??t(n)}var Zv=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i,Bv=/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2066-\u2069\ufeff<>:"/\\|?*]/g;var Yu=new TextEncoder;function qv(e,t){if(Yu.encode(e).length<=t)return e;let n=0,o="";for(let r of e){let a=Yu.encode(r).length;if(n+a>t)break;n+=a,o+=r;}return o}function Xu(e){let t=qv((e??"").replace(/\.docx$/i,"").replace(Bv," ").replace(/\s+/g," ").trim().replace(/^[.\s]+/,"").replace(/[.\s]+$/,""),200).trim();return !t||Zv.test(t)?"document.docx":`${t}.docx`}function ju(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 Kv="https://github.com/eigenpal/docx-editor/issues/new";function zv(){if(typeof window>"u")return "";try{let e=new URL(window.location.href);return `${e.origin}${e.pathname}`}catch{return ""}}function Qu(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??zv()}`,`- Viewport: ${n.width} x ${n.height}`,`- User agent: ${t}`,""].join(`
2
- `),a=new URLSearchParams({title:"[Bug] ",body:r});return `${Kv}?${a.toString()}`}function Wn(e){typeof window>"u"||window.open(Qu(e),"_blank","noopener,noreferrer");}var ya=6,Ul=6;function Le(e){let{icon:t,shortcut:n,disabled:o,title:r,active:a,selected:i,slot:s,onSelect:c,className:l,children:d}=e,p=Ye.useId(),f=o&&r?p:void 0;return jsxRuntime.jsxs("button",{type:"button",role:a===void 0?"menuitem":i===void 0?"menuitemcheckbox":"menuitemradio",className:`docx-toolbar__menu-item docx-menubar__item${l?` ${l}`:""}`,tabIndex:-1,...s?{"data-slot":s}:{},...a?{"data-active":""}:{},...o?{"data-disabled":"","aria-disabled":true}:{},...a!==void 0?{"aria-checked":a}:{},...f?{"aria-describedby":f}:{},...r?{title:r}:{},onMouseDown:O,onClick:o?void 0:c,children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:t}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:d}),n?jsxRuntime.jsx("span",{className:"docx-menubar__item-shortcut",children:n}):null,f?jsxRuntime.jsx("span",{id:p,className:"docx-editor-sr-only",children:r}):null]})}function Gn({label:e,labelKey:t,className:n,hidden:o,children:r}){let a=Oe();if(o)return null;let i=e??(t===void 0?void 0:a(t));return jsxRuntime.jsxs("div",{role:"group",className:`docx-menubar__group${n?` ${n}`:""}`,...i?{"aria-label":i}:{},children:[i?jsxRuntime.jsx("div",{className:"docx-menubar__group-label","aria-hidden":"true",children:i}):null,r]})}function gt({slot:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let{execute:a,isActive:i,isEnabled:s,disabledReason:c}=ne(e),{setOpenMenu:l}=ft(),d=Oe();if(r)return null;let p=ee(e),f=d(t??p?.labelKey??e),m=editor.commandForSlot(e),g=m?.type==="toggleMark"||m?.type==="setAlignment",u=m?.type==="setAlignment";return jsxRuntime.jsx(Le,{slot:e,icon:te(p?.paths),...n?{shortcut:d(n)}:{},disabled:!s,...c?{title:c}:{},...g?{active:i}:{},...u?{selected:true}:{},onSelect:()=>{a(),l(null);},...o?{className:o}:{},children:f})}gt.docxMenuRow=true;function ep(e,t,n,o){return Object.assign(({className:a,hidden:i})=>{let s=ft(),c=Oe(),l=o(s);if(i)return null;let d=ee(e),p=c(t??d?.labelKey??e);return jsxRuntime.jsx(Le,{slot:e,icon:te(d?.paths),...n?{shortcut:c(n)}:{},disabled:!l,onSelect:()=>{l?.(),s.setOpenMenu(null);},...a?{className:a}:{},children:p})},{docxSlot:e})}var Yl=ep("file.open","toolbar.open","toolbar.openShortcut",e=>e.onOpen),Xl=ep("file.save","toolbar.save","toolbar.saveShortcut",e=>e.onSave);function Yv({className:e,hidden:t}){let n=A(),o=ft(),r=Oe(),a=editor.chromeProbeForSlot("file.pageSetup"),i=n&&a?n.can(a):null,s=i?.ok===true,c=i&&!i.ok?i.reason:null;if(t)return null;let l=ee("file.pageSetup"),d=r(l?.labelKey??"file.pageSetup"),p=s&&!!o.onPageSetup;return jsxRuntime.jsx(Le,{slot:"file.pageSetup",icon:te(l?.paths),disabled:!p,...c?{title:c}:{},onSelect:()=>{o.onPageSetup?.(),o.setOpenMenu(null);},...e?{className:e}:{},children:d})}var jl=Object.assign(Yv,{docxSlot:"file.pageSetup"});function Xv({className:e,hidden:t}){let{openFilePicker:n,isEnabled:o,disabledReason:r}=_r(),a=ft(),i=Oe();if(t)return null;let s=ee("image.insert"),c=i(s?.labelKey??"toolbar.image");return jsxRuntime.jsx(Le,{slot:"image.insert",icon:te(s?.paths),disabled:!o,...r?{title:r}:{},onSelect:()=>{n(),a.setOpenMenu(null);},...e?{className:e}:{},children:c})}var jv=Object.assign(Xv,{docxSlot:"image.insert"}),Un=8;function oo({labelKey:e,paths:t,className:n,children:o}){let r=Oe(),[a,i]=Ye.useState(false),s=Ye.useRef(null),c=Ye.useRef(null),l=Ye.useId(),d=r(e),[p,f]=Ye.useState(null);return Ye.useLayoutEffect(()=>{if(!a){f(null);return}let m=s.current,g=c.current,u=m?.ownerDocument.defaultView;if(!m||!g||!u)return;let h=m.getBoundingClientRect(),b=g.offsetWidth,v=g.offsetHeight,C=h.right+b>u.innerWidth-Un;f({left:C?Math.max(Un,h.left-b):Math.min(h.right,u.innerWidth-b-Un),top:Math.max(Un,Math.min(h.top-4,u.innerHeight-v-Un))});},[a]),jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__submenu${n?` ${n}`:""}`,onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),onKeyDown:m=>{m.key==="ArrowRight"&&document.activeElement===s.current?(m.preventDefault(),i(true),queueMicrotask(()=>{c.current&&it(Jt(c.current),"first");})):(m.key==="ArrowLeft"||m.key==="Escape")&&a&&(m.preventDefault(),m.stopPropagation(),i(false),s.current?.focus());},onBlur:m=>{m.currentTarget.contains(m.relatedTarget)||i(false);},children:[jsxRuntime.jsxs("button",{ref:s,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?l:void 0,className:"docx-toolbar__menu-item docx-menubar__item",tabIndex:-1,...a?{"data-open":""}:{},onMouseDown:O,onFocus:()=>i(true),onClick:()=>i(true),children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:te(t)}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:d}),jsxRuntime.jsx("span",{className:"docx-menubar__item-caret","aria-hidden":"true",children:"\u203A"})]}),a?jsxRuntime.jsx("div",{ref:c,id:l,className:"docx-toolbar__menu docx-menubar__menu docx-menubar__submenu-panel",role:"menu","aria-label":d,style:p?{position:"fixed",left:p.left,top:p.top}:{position:"fixed",visibility:"hidden"},onKeyDown:m=>{let g=c.current;if(!g)return;let u=Jt(g);m.key==="ArrowDown"?(m.preventDefault(),m.stopPropagation(),at(u,document.activeElement,1)):m.key==="ArrowUp"&&(m.preventDefault(),m.stopPropagation(),at(u,document.activeElement,-1));},children:o}):null]})}function Ta({slot:e="table.insert",className:t}){let n=A(),{isEnabled:o}=ne(e),{setOpenMenu:r}=ft(),[a,i]=Ye.useState(null),[s,c]=Ye.useState({rows:1,cols:1}),l=Ye.useRef(null),d=Ye.useCallback((m,g)=>{if(!n||!o)return;let u={type:"insertTable",rows:m,cols:g};n.can(u).ok&&(n.exec(u),r(null),n.focus());},[n,o,r]),p=Ye.useCallback(m=>{c(g=>{let u={rows:Math.min(Ul,Math.max(1,g.rows+(m.rows??0))),cols:Math.min(ya,Math.max(1,m.toCol??g.cols+(m.cols??0)))};return i(u),queueMicrotask(()=>l.current?.querySelector(`[data-cell="${u.rows}x${u.cols}"]`)?.focus()),u});},[]),f=[];for(let m=1;m<=Ul;m+=1){let g=[];for(let u=1;u<=ya;u+=1){let h=!!a&&m<=a.rows&&u<=a.cols;g.push(jsxRuntime.jsx("button",{type:"button",role:"gridcell","data-cell":`${m}x${u}`,className:"docx-menubar__grid-cell",tabIndex:s.rows===m&&s.cols===u?0:-1,...h?{"data-filled":""}:{},"aria-label":`${u} \xD7 ${m}`,onMouseDown:O,onMouseEnter:()=>i({rows:m,cols:u}),onFocus:()=>i({rows:m,cols:u}),onClick:()=>d(m,u)},u));}f.push(jsxRuntime.jsx("div",{role:"row",className:"docx-menubar__grid-row",children:g},m));}return jsxRuntime.jsxs("div",{ref:l,role:"grid","aria-label":`${ya} \xD7 ${Ul}`,className:`docx-menubar__grid${t?` ${t}`:""}`,onMouseLeave:()=>i(null),onKeyDown:m=>{if(m.key==="ArrowRight")p({cols:1});else if(m.key==="ArrowLeft")p({cols:-1});else if(m.key==="ArrowDown")p({rows:1});else if(m.key==="ArrowUp")p({rows:-1});else if(m.key==="Home")p({toCol:1});else if(m.key==="End")p({toCol:ya});else return;m.preventDefault(),m.stopPropagation();},children:[jsxRuntime.jsx("div",{className:"docx-menubar__grid-cells",children:f}),jsxRuntime.jsx("div",{className:"docx-menubar__grid-caption","aria-hidden":"true",children:a?`${a.cols} \xD7 ${a.rows}`:""})]})}function Qv({entry:e}){let{isEnabled:t}=ne(e.slot),n=ee(e.slot);return t?jsxRuntime.jsx(oo,{labelKey:e.labelKey??n?.labelKey??e.slot,paths:n?.paths,children:jsxRuntime.jsx(Ta,{slot:e.slot})}):jsxRuntime.jsx(gt,{slot:e.slot,...e.labelKey?{labelKey:e.labelKey}:{}})}function no({className:e}){return jsxRuntime.jsx("div",{role:"separator",className:`docx-toolbar__menu-separator${e?` ${e}`:""}`})}function Yn({entry:e}){return e.kind==="separator"?jsxRuntime.jsx(no,{}):e.kind==="submenu"?jsxRuntime.jsx(oo,{labelKey:e.labelKey,paths:e.paths,children:e.items.map((t,n)=>jsxRuntime.jsx(Yn,{entry:t},n))}):e.slot==="file.open"?jsxRuntime.jsx(Yl,{}):e.slot==="file.save"?jsxRuntime.jsx(Xl,{}):e.slot==="file.pageSetup"?jsxRuntime.jsx(jl,{}):e.slot==="image.insert"?jsxRuntime.jsx(jv,{}):e.picker==="tableGrid"?jsxRuntime.jsx(Qv,{entry:e}):jsxRuntime.jsx(gt,{slot:e.slot,...e.labelKey?{labelKey:e.labelKey}:{},...e.shortcutKey?{shortcutKey:e.shortcutKey}:{}})}function tp(e){if(!Ye.isValidElement(e))return null;let t=No(e,tp);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 Jv(e,t){return e.kind==="item"?e.slot:e.kind==="submenu"?`submenu:${e.labelKey}`:`separator:${t}`}function ey(e,t,n){return Ur({entries:e??[],children:t,preset:n,keyOfEntry:Jv,keyOfChild:tp,renderEntry:o=>jsxRuntime.jsx(Yn,{entry:o})})}function Zo({id:e,labelKey:t,label:n,icon:o,className:r,hidden:a,preset:i=true,children:s}){let{openMenu:c,setOpenMenu:l,activeMenu:d}=ft(),p=Oe(),f=Ye.useId(),m=Ye.useRef(null),g=Ye.useRef(null),u=Ye.useRef(false),h=Ye.useRef(false),b=editor.CHROME_MENUS.find(y=>y.id===e),v=c===e;if(a)return null;let C=n??p(t??b?.labelKey??e),P=ey(b?.entries,s,i),S=()=>{l(null),m.current?.focus();};return jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__menu-root${r?` ${r}`:""}`,"data-menu":e,children:[jsxRuntime.jsxs("button",{ref:m,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":v,"aria-controls":v?f:void 0,className:"docx-menubar__trigger",tabIndex:d===e?0:-1,...v?{"data-open":""}:{},onMouseDown:O,onKeyDown:y=>{y.key==="ArrowDown"||y.key==="Enter"||y.key===" "||y.key==="ArrowUp"?(y.preventDefault(),u.current=true,l(e)):y.key==="Escape"&&v&&(y.preventDefault(),S());},onClick:()=>{if(h.current){h.current=false;return}l(v?null:e);},onMouseEnter:()=>{c!==null&&c!==e&&(h.current=true,l(e));},onMouseLeave:()=>{h.current=false;},children:[o?jsxRuntime.jsx("span",{className:"docx-menubar__trigger-icon","aria-hidden":"true",children:o}):null,C]}),v?jsxRuntime.jsx("div",{ref:y=>{g.current=y,y&&u.current&&(u.current=false,it(Jt(y),"first"));},id:f,role:"menu","aria-label":C,className:"docx-toolbar__menu docx-menubar__menu",onKeyDown:y=>{let x=g.current;if(!x)return;let M=Jt(x),E=document.activeElement;y.key==="ArrowDown"?(y.preventDefault(),at(M,E,1)):y.key==="ArrowUp"?(y.preventDefault(),at(M,E,-1)):y.key==="Home"?(y.preventDefault(),it(M,"first")):y.key==="End"?(y.preventDefault(),it(M,"last")):y.key==="Escape"?(y.preventDefault(),y.stopPropagation(),S()):y.key==="Tab"&&l(null);},children:P}):null]})}function Ql(e){return Object.assign(n=>jsxRuntime.jsx(Zo,{id:e,...n}),{docxMenu:e})}var Jl=Ql("file"),es=Ql("format"),ts=Ql("insert");function ty({className:e,hidden:t,onSelect:n}){let{setOpenMenu:o,onReportIssue:r,reportIssue:a}=ft(),i=Oe();if(t||a===false)return null;let s=n??r??Wn;return jsxRuntime.jsx(Le,{slot:"help.reportIssue",onSelect:()=>{s(),o(null);},...e?{className:e}:{},children:i("toolbar.reportIssue")})}var Sa=Object.assign(ty,{docxSlot:"help.reportIssue"});function oy({children:e,...t}){let{reportIssue:n}=ft();return e===void 0&&n===false?null:jsxRuntime.jsxs(Zo,{id:"help",...t,children:[jsxRuntime.jsx(Sa,{}),e]})}var os=Object.assign(oy,{docxMenu:"help"});var ay={file:Jl,format:es,insert:ts,help:os},iy=new Set(editor.CHROME_MENUS.map(e=>e.id));function sp(e){if(!Ye.isValidElement(e))return null;if(e.type===Ye.Fragment){let o=Ye.Children.toArray(e.props.children).map(sp).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===Zo){let n=e.props.id;if(typeof n=="string"&&iy.has(n))return n}return null}function ly(e){let t=Xe(),{className:n,t:o,fileName:r,onOpen:a,onOpenFile:i,onSave:s,onPageSetup:c,onReportIssue:l,reportIssue:d,preset:p=true,children:f}=e,m=A(),{t:g}=_(),[u,h]=Ye.useState(null),[b,v]=Ye.useState(null),[C,P]=Ye.useState(null),[S,y]=Ye.useState(false),x=Ye.useRef(null),M=Ye.useRef(null);Ye.useEffect(()=>{if(u===null)return;let z=$=>{let Q=x.current;Q&&$.target instanceof Node&&Q.contains($.target)||h(null);},Z=$=>{$.key==="Escape"&&h(null);};return document.addEventListener("mousedown",z),document.addEventListener("keydown",Z),()=>{document.removeEventListener("mousedown",z),document.removeEventListener("keydown",Z);}},[u]);let E=Ye.useCallback(z=>{h(z),z!==null&&P(z);},[]),w=Ye.useCallback(()=>M.current?.click(),[]),N=Ye.useCallback(()=>{m&&m.save().then(z=>ju(z,Xu(r??b??void 0))).catch(z=>{console.error("[docx-editor] save failed",z);});},[m,r,b]),F=Ye.useCallback(()=>y(true),[]),H=m?a??w:void 0,k=m?s??N:void 0,D=m?c??F:void 0;Ye.useEffect(()=>{let z=Z=>{if(!(Z.metaKey||Z.ctrlKey)||Z.altKey||Z.shiftKey)return;let $=Z.key.toLowerCase();if($!=="s"&&$!=="o")return;let Q=Z.target,Me=Fo(x.current)??x.current;!Q||!Me?.contains(Q)||($==="s"&&k?(Z.preventDefault(),k()):$==="o"&&H&&(Z.preventDefault(),H()));};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[H,k]);let I=Ye.useMemo(()=>({t:o,openMenu:u,setOpenMenu:E,activeMenu:C,onOpen:H,onSave:k,onPageSetup:D,onReportIssue:l,reportIssue:d}),[o,u,E,C,H,k,D,l,d]),R;if(!p)R=f;else {let z=new Map,Z=[];for(let $ of Ye.Children.toArray(f)){let Q=sp($);Q?z.set(Q,$):Z.push($);}R=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[editor.CHROME_MENUS.map($=>{let Q=z.get($.id);if(Q)return jsxRuntime.jsx(Ye.Fragment,{children:Q},$.id);let Me=ay[$.id];return jsxRuntime.jsx(Me,{},$.id)}),Z]});}return jsxRuntime.jsxs($n.Provider,{value:I,children:[jsxRuntime.jsx("div",{ref:z=>{if(x.current=z,z&&C===null){let Z=Al(z)[0]?.closest("[data-menu]")?.getAttribute("data-menu");Z&&P(Z);}},role:"menubar","aria-label":o?.("titleBar.menuBarAriaLabel")??g("titleBar.menuBarAriaLabel"),"data-testid":"docx-menubar",className:`${t}docx-menubar${n?` ${n}`:""}`,onMouseDown:O,onKeyDown:z=>{if(z.key!=="ArrowLeft"&&z.key!=="ArrowRight")return;let Z=x.current;if(!Z)return;let $=Al(Z),Q=$.indexOf(document.activeElement);if(Q===-1)return;z.preventDefault();let Me=z.key==="ArrowRight"?1:-1,se=$[(Q+Me+$.length)%$.length],Te=se?.closest("[data-menu]")?.getAttribute("data-menu");Te&&(P(Te),se?.focus(),u!==null&&h(Te));},children:R}),jsxRuntime.jsx("input",{ref:M,type:"file",accept:".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document",style:{display:"none"},onChange:z=>{let Z=z.target.files?.[0];z.target.value="",!(!Z||!m)&&(v(Z.name),i?.(Z),Z.arrayBuffer().then($=>m.load(new Uint8Array($))).catch($=>{console.error("[docx-editor] could not open the file",$);}));}}),jsxRuntime.jsx(Vn,{open:S,onClose:()=>y(false)})]})}var jn=Object.assign(ly,{Menu:Zo,File:Jl,Format:es,Insert:ts,Help:os,Item:gt,Row:Le,Group:Gn,Separator:no,Submenu:oo,TableGrid:Ta,Entry:Yn,Open:Yl,Save:Xl,PageSetup:jl,ReportIssue:Sa});function _e(e){return e/1440*96}function Ea(e){return e/96*1440}function ze(e){return `${Math.round(e*100)/100}px`}function ns(e){return e/2}var py=12240,up=1440,fp=1440,gp=567,ro=20,as=6,my=ro+as+2,fy="var(--doc-text-muted)",gy="var(--doc-text-subtle)",pp="var(--doc-shadow-subtle)",by="var(--doc-primary)",hy="var(--doc-primary-hover)",vy="var(--doc-text-subtle)",Jn=5,Qn=7,yy={left:0,right:0,firstLine:0};function mp(e,t){return t==="inch"?(e/fp).toFixed(2)+'"':(e/gp).toFixed(1)+" cm"}function xy(e,t){return t?1:Math.round(e==="cm"?editor.SNAP_TWIPS_CM:editor.SNAP_TWIPS_INCH)}function ao({pageSetup:e,zoom:t=1,editable:n=false,onLeftMarginChange:o,onRightMarginChange:r,onMarginDragEnd:a,showIndentHandles:i=false,indent:s,indentEditable:c=false,onIndentChange:l,onIndentDragEnd:d,unit:p="inch",className:f="",style:m,tabMarks:g,onTabMarkRemove:u}){let{t:h}=_(),[b,v]=Ye.useState(null),[C,P]=Ye.useState(null),[S,y]=Ye.useState(null),[x,M]=Ye.useState(null),E=Ye.useRef(null),w=e?.pageWidthTwips??py,N=e?.marginsTwips.left??up,F=e?.marginsTwips.right??up,H=e?.gutterTwips??0,k={pageWidth:w,leftMargin:N,rightMargin:F},D=s??yy,I=_e(w)*t,R=_e(N)*t,z=_e(F)*t,Z=Ye.useCallback(B=>{let Pe=E.current?.getBoundingClientRect();return Pe?Ea((B-Pe.left)/t):null},[t]),$=Ye.useCallback((B,Pe,Ue)=>{let ce=Z(Pe);if(ce===null)return;if(M(_e(ce)*t),B==="leftMargin"||B==="rightMargin"){if(B==="leftMargin"){let rn=w-F-H-720,Eo=Math.round(Math.max(0,Math.min(ce,rn)));y(Eo),o?.(Eo);}else {let rn=w-ce,Eo=w-N-H-720,Mr=Math.round(Math.max(0,Math.min(rn,Eo)));y(Mr),r?.(Mr);}return}let Ge=editor.dragIndent(B,ce,D,k,{unit:p,precise:Ue});y(B==="right"?Ge.right:B==="firstLine"?Ge.firstLine:Ge.left),l?.(Ge);},[Z,t,w,N,F,H,o,r,l,D,k,p]),Q=Ye.useCallback(B=>{B==="leftMargin"||B==="rightMargin"?a?.():d?.(),v(null),y(null),M(null);},[a,d]),Me=Ye.useCallback((B,Pe,Ue)=>{let ce=editor.handlePosition(B,D,k),Ge=editor.dragIndent(B,ce+Pe*xy(p,Ue),D,k,{unit:p,precise:true});l?.(Ge),d?.();},[D,k,p,l,d]),se=wy(w,t,p),Te=i&&c&&l!==void 0,Ce=B=>_e(editor.handlePosition(B,D,k))*t,G=(B,Pe,Ue)=>({positionPx:Ce(B),editable:Te,isDragging:b===B,isHovered:C===B,onPointerEnter:()=>P(B),onPointerLeave:()=>P(null),onPointerDown:ce=>{Te&&(ce.preventDefault(),ce.stopPropagation(),ce.currentTarget.setPointerCapture(ce.pointerId),v(B));},onPointerMove:ce=>{b===B&&$(B,ce.clientX,ce.altKey);},onPointerUp:ce=>{b===B&&(ce.currentTarget.releasePointerCapture(ce.pointerId),Q(B));},onKeyDown:ce=>{Te&&(ce.key!=="ArrowLeft"&&ce.key!=="ArrowRight"||(ce.preventDefault(),Me(B,ce.key==="ArrowLeft"?-1:1,ce.shiftKey)));},label:h(Pe),valueNow:Ue,valueText:mp(Ue,p),pageWidthTwips:w});return jsxRuntime.jsxs("div",{ref:E,className:`docx-horizontal-ruler ${f}`,style:{position:"relative",width:ze(I),height:my,backgroundColor:"transparent",overflow:"visible",userSelect:"none",touchAction:"none",cursor:b?"ew-resize":"default",...m},role:"group","aria-label":h("ruler.horizontal"),children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:ze(R),height:ro,backgroundColor:pp,borderRight:"1px solid var(--doc-shadow-subtle)",cursor:n?"ew-resize":"default",zIndex:1},onPointerDown:n&&o?B=>{B.preventDefault(),B.currentTarget.setPointerCapture(B.pointerId),v("leftMargin");}:void 0,onPointerMove:B=>b==="leftMargin"&&$("leftMargin",B.clientX,B.altKey),onPointerUp:B=>{b==="leftMargin"&&(B.currentTarget.releasePointerCapture(B.pointerId),Q("leftMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,right:0,width:ze(z),height:ro,backgroundColor:pp,borderLeft:"1px solid var(--doc-shadow-subtle)",cursor:n?"ew-resize":"default",zIndex:1},onPointerDown:n&&r?B=>{B.preventDefault(),B.currentTarget.setPointerCapture(B.pointerId),v("rightMargin");}:void 0,onPointerMove:B=>b==="rightMargin"&&$("rightMargin",B.clientX,B.altKey),onPointerUp:B=>{b==="rightMargin"&&(B.currentTarget.releasePointerCapture(B.pointerId),Q("rightMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:ro,pointerEvents:"none"},children:se.map((B,Pe)=>jsxRuntime.jsx(Ty,{tick:B},Pe))}),g?.map(B=>jsxRuntime.jsx(Ey,{tabMark:B,positionPx:_e(B.position)*t,onDoubleClick:()=>u?.(B.position)},B.position)),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(rs,{direction:"down",anchor:"top",...G("firstLine","ruler.firstLineIndent",D.firstLine)}),jsxRuntime.jsx(rs,{direction:"up",anchor:"strip",...G("hanging","ruler.hangingIndent",D.left)}),jsxRuntime.jsx(Sy,{...G("left","ruler.leftIndent",D.left)}),jsxRuntime.jsx(rs,{direction:"up",anchor:"strip",...G("right","ruler.rightIndent",D.right)})]}),b&&S!==null&&x!==null&&jsxRuntime.jsx(Cy,{value:mp(S,p),positionPx:x})]})}function Ty({tick:e}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:{position:"absolute",left:ze(e.position),bottom:0,width:1,height:e.height,backgroundColor:gy}}),e.label&&jsxRuntime.jsx("div",{style:{position:"absolute",left:ze(e.position),top:2,transform:"translateX(-50%)",fontSize:"9px",color:fy,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:e.label})]})}function bp(e){return e.editable?e.isDragging||e.isHovered?hy:by:vy}function hp(e,t,n){return {position:"absolute",left:ze(e.positionPx-t/2),width:t,cursor:e.editable?"ew-resize":"default",zIndex:e.isDragging?10:4,touchAction:"none",...n}}function vp(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 rs({direction:e,anchor:t,...n}){let o=bp(n),r=t==="top"?{top:0,height:Qn+1}:{top:ro-Qn,height:Qn};return jsxRuntime.jsx("div",{className:"docx-ruler-indent",style:hp(n,Jn*2,r),onPointerEnter:n.onPointerEnter,onPointerLeave:n.onPointerLeave,onPointerDown:n.onPointerDown,onPointerMove:n.onPointerMove,onPointerUp:n.onPointerUp,onKeyDown:n.onKeyDown,...vp(n),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:0,width:0,height:0,borderLeft:`${Jn}px solid transparent`,borderRight:`${Jn}px solid transparent`,...e==="down"?{top:0,borderTop:`${Qn}px solid ${o}`}:{bottom:0,borderBottom:`${Qn}px solid ${o}`},transition:"border-color 0.1s"}})})}function Sy(e){return jsxRuntime.jsx("div",{className:"docx-ruler-indent docx-ruler-indent--box",style:hp(e,Jn*2,{top:ro+1,height:as}),onPointerEnter:e.onPointerEnter,onPointerLeave:e.onPointerLeave,onPointerDown:e.onPointerDown,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onKeyDown:e.onKeyDown,...vp(e),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:1,top:0,width:Jn*2-2,height:as,backgroundColor:bp(e),borderRadius:1,transition:"background-color 0.1s"}})})}function Cy({value:e,positionPx:t}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:ze(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 Py={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function Ey({tabMark:e,positionPx:t,onDoubleClick:n}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:ze(t-5),top:ro-12,width:10,height:12,display:"flex",alignItems:"center",justifyContent:"center",fontSize:8,fontWeight:700,color:"var(--doc-text-muted)",cursor:"pointer",userSelect:"none"},onDoubleClick:o=>{o.stopPropagation(),n();},title:`${e.alignment} tab at ${(e.position/1440).toFixed(2)}"`,children:Py[e.alignment]||"L"})}function wy(e,t,n){let o=[];if(n==="inch"){let r=fp/8,a=Math.ceil(e/r);for(let i=0;i<=a;i++){let s=i*r;if(s>e)break;let c=_e(s)*t;i%8===0?o.push({position:c,height:8,label:i/8>0?String(i/8):void 0}):i%4===0?o.push({position:c,height:5}):i%2===0?o.push({position:c,height:3}):o.push({position:c,height:2});}}else {let r=gp/10,a=Math.ceil(e/r);for(let i=0;i<=a;i++){let s=i*r;if(s>e)break;let c=_e(s)*t;i%10===0?o.push({position:c,height:8,label:i/10>0?String(i/10):void 0}):i%5===0?o.push({position:c,height:5}):o.push({position:c,height:3});}}return o}var ky=15840,Tp=1440,Ry=1440,_y=567,Bo=20,Ny="var(--doc-text-muted)",Dy="var(--doc-text-subtle)",Ly="var(--doc-primary)",Hy="var(--doc-primary)",Fy="var(--doc-primary-hover)";function er({pageSetup:e,zoom:t=1,editable:n=false,onTopMarginChange:o,onBottomMarginChange:r,onMarginDragEnd:a,unit:i="inch",className:s="",style:c}){let{t:l}=_(),[d,p]=Ye.useState(null),[f,m]=Ye.useState(null),g=Ye.useRef(null),u=e?.pageHeightTwips??ky,h=e?.marginsTwips.top??Tp,b=e?.marginsTwips.bottom??Tp,v=_e(u)*t,C=_e(h)*t,P=_e(b)*t,S=Ye.useCallback((w,N)=>{n&&(w.preventDefault(),p(N));},[n]),y=Ye.useCallback(w=>{if(!d||!g.current)return;let N=g.current.getBoundingClientRect(),F=w.clientY-N.top,H=Ea(F/t);if(d==="topMargin"){let k=u-b-720,D=Math.max(0,Math.min(H,k));o?.(Math.round(D));}else if(d==="bottomMargin"){let k=u-H,D=u-h-720,I=Math.max(0,Math.min(k,D));r?.(Math.round(I));}},[d,t,u,h,b,o,r]),x=Ye.useCallback(()=>{d!==null&&a?.(),p(null);},[d,a]);Ye.useEffect(()=>{if(d)return document.addEventListener("mousemove",y),document.addEventListener("mouseup",x),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",x);}},[d,y,x]);let M=Oy(u,t,i),E={position:"relative",width:Bo,height:ze(v),backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:d?"ns-resize":"default",...c};return jsxRuntime.jsxs("div",{ref:g,className:`docx-vertical-ruler ${s}`,style:E,role:"slider","aria-label":l("ruler.vertical"),"aria-orientation":"vertical",children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"},children:M.map((w,N)=>jsxRuntime.jsx(Ay,{tick:w},N))}),jsxRuntime.jsx(Sp,{type:"topMargin",position:C,editable:n,isDragging:d==="topMargin",isHovered:f==="topMargin",onMouseEnter:()=>m("topMargin"),onMouseLeave:()=>m(null),onMouseDown:w=>S(w,"topMargin")}),jsxRuntime.jsx(Sp,{type:"bottomMargin",position:v-P,editable:n,isDragging:d==="bottomMargin",isHovered:f==="bottomMargin",onMouseEnter:()=>m("bottomMargin"),onMouseLeave:()=>m(null),onMouseDown:w=>S(w,"bottomMargin")})]})}function Ay({tick:e}){let t={position:"absolute",top:ze(e.position),right:0,height:1,width:e.width,backgroundColor:Dy},n={position:"absolute",top:ze(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:Ny,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 Sp({type:e,position:t,editable:n,isDragging:o,isHovered:r,onMouseEnter:a,onMouseLeave:i,onMouseDown:s}){let{t:c}=_(),l=o?Fy:r?Hy:Ly,d={position:"absolute",top:ze(t-5),right:0,width:Bo,height:10,cursor:n?"ns-resize":"default",zIndex:o?10:1},p={position:"absolute",top:0,right:2,width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderRight:`8px solid ${l}`,transition:"border-right-color 0.1s"};return jsxRuntime.jsx("div",{className:`docx-ruler-marker docx-ruler-marker-${e}`,style:d,onMouseEnter:a,onMouseLeave:i,onMouseDown:s,role:"slider","aria-label":c(e==="topMargin"?"ruler.topMargin":"ruler.bottomMargin"),"aria-orientation":"vertical",tabIndex:n?0:-1,children:jsxRuntime.jsx("div",{style:p})})}function Oy(e,t,n){let o=[];if(n==="inch"){let r=Ry/8,a=Math.ceil(e/r);for(let i=0;i<=a;i++){let s=i*r;if(s>e)break;let c=_e(s)*t;if(i%8===0){let l=i/8;o.push({position:c,width:10,label:l>0?String(l):void 0});}else i%4===0?o.push({position:c,width:6}):i%2===0?o.push({position:c,width:4}):o.push({position:c,width:2});}}else {let r=_y/10,a=Math.ceil(e/r);for(let i=0;i<=a;i++){let s=i*r;if(s>e)break;let c=_e(s)*t;if(i%10===0){let l=i/10;o.push({position:c,width:10,label:l>0?String(l):void 0});}else i%5===0?o.push({position:c,width:6}):o.push({position:c,width:3});}}return o}var io=e=>e.isLoading||e.parseError!==null||e.pageSetup==null;var qy=e=>e.formatting?.indent??null,Ky=e=>e.editable;function ss(){let e=A(),t=q(qy),n=q(Ky),o=Ye.useMemo(()=>n&&e!==null&&e.can({type:"setIndent",left:0}).ok,[e,n]),r=Ye.useCallback(a=>e?e.exec({...a.left!==void 0?{left:a.left}:{},...a.right!==void 0?{right:a.right}:{},...a.firstLine!==void 0?{firstLine:a.firstLine}:{},type:"setIndent"}).ok:false,[e]);return Ye.useMemo(()=>({indent:t,isEnabled:o,apply:r}),[t,o,r])}var Mp=e=>e.zoom;function Ip(e,t){return !e||Object.keys(t).length===0?e:{...e,marginsTwips:{...e.marginsTwips,...t}}}function kp(){let{apply:e}=eo(),[t,n]=Ye.useState({}),o=Ye.useRef({}),r=Ye.useCallback(i=>s=>{o.current={...o.current,[i]:Math.round(s)},n(o.current);},[]),a=Ye.useCallback(()=>{let i=o.current;o.current={},n({}),Object.keys(i).length!==0&&e({...i.top!==void 0?{marginTopTwips:i.top}:{},...i.right!==void 0?{marginRightTwips:i.right}:{},...i.bottom!==void 0?{marginBottomTwips:i.bottom}:{},...i.left!==void 0?{marginLeftTwips:i.left}:{},scope:"section"});},[e]);return {pending:t,preview:r,commit:a}}function wp(e){let t=e?.snapshot().selection??null;return t?JSON.stringify(t):""}function $y(){let e=A(),{indent:t,isEnabled:n,apply:o}=ss(),[r,a]=Ye.useState(null),i=Ye.useRef(null),s=Ye.useRef(null),c=Ye.useCallback(p=>{s.current===null&&(s.current=wp(e)),i.current=p,a(p);},[e]),l=Ye.useCallback(()=>{let p=i.current,f=s.current;i.current=null,s.current=null,a(null),p&&(f!==null&&f!==wp(e)||o({left:p.left,right:p.right,firstLine:p.firstLine}));},[e,o]),d=Ye.useMemo(()=>r??(t?{left:t.left,right:t.right,firstLine:t.firstLine}:null),[r,t]);return Ye.useMemo(()=>({indent:d,isEnabled:n,preview:c,commit:l}),[d,n,c,l])}function Wy(){let e=_o(),[t,n]=Ye.useState(0);return Ye.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 ka(e){let t=q(io),{pageSetup:n,isEnabled:o}=eo(),r=q(Mp),{pending:a,preview:i,commit:s}=kp(),c=$y(),l=Ro(),d=Uy(),p=Wy();return t?null:jsxRuntime.jsx(ao,{pageSetup:Ip(n,a),zoom:r,editable:o,onLeftMarginChange:i("left"),onRightMarginChange:i("right"),onMarginDragEnd:s,showIndentHandles:c.indent!==null,indent:c.indent,indentEditable:c.isEnabled,onIndentChange:c.preview,onIndentDragEnd:c.commit,unit:e.unit??"inch",className:e.className??"",style:{flexShrink:0,marginRight:d,...e.style,marginInlineStart:l,transition:"margin 0.2s ease",transform:`${e.style?.transform?`${e.style.transform} `:""}translateX(${-p}px)`,clipPath:l>0&&p>0?`inset(0 0 0 ${p}px)`:e.style?.clipPath}})}function Uy(){let e=q(Gy);return (Ye.useContext(St)?.mounted??0)===0?0:e?Yy:Xy}var Gy=e=>e.reviewPaneOpen??true,Yy=316,Xy=44;function Ra(e){let t=q(io),{pageSetup:n,isEnabled:o}=eo(),r=q(Mp),{pending:a,preview:i,commit:s}=kp();return t?null:jsxRuntime.jsx(er,{pageSetup:Ip(n,a),zoom:r,editable:o,onTopMarginChange:i("top"),onBottomMarginChange:i("bottom"),onMarginDragEnd:s,unit:e.unit??"inch",className:e.className??"",style:e.style})}function L({size:e=20,className:t="",style:n,children:o}){return jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 -960 960 960",fill:"currentColor",className:t,style:{display:"inline-flex",flexShrink:0,...n},"aria-hidden":"true",children:o})}function Qy(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"})})}function Jy(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"})})}function ex(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z"})})}function tx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-320 280-520l56-58 104 104v-326h80v326l104-104 56 58-200 200ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"})})}function ox(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-320v-326L336-542l-56-58 200-200 200 200-56 58-104-104v326h-80ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"})})}function nx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"})})}function rx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"})})}function ax(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-120v-80h560v80H200Zm123-223q-56-63-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63q-101 0-157-63Z"})})}function ix(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"})})}function lx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"})})}function sx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"})})}function cx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"})})}function dx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"})})}function ux(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"})})}function px(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"})})}function mx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"})})}function fx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"})})}function us(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M240-160 80-320l56-56 64 62v-332l-64 62-56-56 160-160 160 160-56 56-64-62v332l64-62 56 56-160 160Zm240-40v-80h400v80H480Zm0-240v-80h400v80H480Zm0-240v-80h400v80H480Z"})})}function gx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"})})}function bx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"})})}function hx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"})})}function vx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"})})}function yx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm140-280 210-560h100l210 560h-96l-50-144H368l-52 144h-96Zm176-224h168l-82-232h-4l-82 232Z"})})}function xx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M544-400 440-504 240-304l104 104 200-200Zm-47-161 104 104 199-199-104-104-199 199Zm-84-28 216 216-229 229q-24 24-56 24t-56-24l-2-2-26 26H60l126-126-2-2q-24-24-24-56t24-56l229-229Zm0 0 227-227q24-24 56-24t56 24l104 104q24 24 24 56t-24 56L629-373 413-589Z"})})}function Tx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M800-436q0 36-8 69t-22 63l-62-60q6-17 9-34.5t3-37.5q0-47-17.5-89T650-600L480-768l-88 86-56-56 144-142 226 222q44 42 69 99.5T800-436Zm-8 380L668-180q-41 29-88 44.5T480-120q-133 0-226.5-92.5T160-436q0-51 16-98t48-90L56-792l56-56 736 736-56 56ZM480-200q36 0 68.5-10t61.5-28L280-566q-21 32-30.5 64t-9.5 66q0 98 70 167t170 69Zm-37-204Zm110-116Z"})})}function Sx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-360 280-560h400L480-360Z"})})}function Cx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"})})}function Px(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120ZM200-640h560v-120H200v120Zm100 80H200v360h100v-360Zm360 0v360h100v-360H660Zm-80 0H380v360h200v-360Z"})})}function Ex(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"})})}function wx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M760-200v-120H200v120h560Zm0-200v-160H200v160h560Zm0-240v-120H200v120h560ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Z"})})}function Mx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z"})})}function _p(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"})})}function Ix(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-200h560v-560H200v560Zm-80 80v-720h720v720H120Zm160-320v-80h80v80h-80Zm160 160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 160v-80h80v80h-80Z"})})}function kx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm320 640v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm-160 0v-80h80v80h-80ZM440-120v-320H120v-80h320v-320h80v320h320v80H520v320h-80Z"})})}function Rx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function _x(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"})})}function Nx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-440v-80h560v80H200Z"})})}function Dx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"})})}function Lx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M600-240v-80h160v80H600Zm0-320v-80h280v80H600Zm0 160v-80h240v80H600ZM120-640H80v-80h160v-60h160v60h160v80h-40v360q0 33-23.5 56.5T440-200H200q-33 0-56.5-23.5T120-280v-360Zm80 0v360h240v-360H200Zm0 0v360-360Z"})})}function Hx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m296-160-56-56 200-200v-269L337-582l-57-57 200-200 201 201-57 57-104-104v301L296-160Zm368 1L536-286l57-57 127 128-56 56Z"})})}function Fx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"})})}function Ax(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"})})}function Ox(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"})})}function Zx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-280v-400h400v400H120Zm80-80h240v-240H200v240Zm-80-400v-80h720v80H120Zm480 160v-80h240v80H600Zm0 160v-80h240v80H600Zm0 160v-80h240v80H600ZM120-120v-80h720v80H120Z"})})}function Bx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-280v-400h400v400H440Zm80-80h240v-240H520v240ZM120-120v-80h720v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h720v80H120Z"})})}function qx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-440v-80h640v80H160Z"})})}function Kx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-480h80v480h480v80H200Zm160-240v80q-33 0-56.5-23.5T280-360h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm80-160h-80q0-33 23.5-56.5T360-840v80Zm80 480v-80h80v80h-80Zm0-480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0 480v-80h80v80h-80Zm160-480v-80q33 0 56.5 23.5T840-760h-80Zm0 400h80q0 33-23.5 56.5T760-280v-80Zm0-80v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function zx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function Vx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-80 310-250l57-57 73 73v-166h80v165l72-73 58 58L480-80ZM250-310 80-480l169-169 57 57-72 72h166v80H235l73 72-58 58Zm460 0-57-57 73-73H560v-80h165l-73-72 58-58 170 170-170 170ZM440-560v-166l-73 73-57-57 170-170 170 170-57 57-73-73v166h-80Z"})})}function $x(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-120v-240h80v80h320v80H520v80h-80Zm-320-80v-80h240v80H120Zm160-160v-80H120v-80h160v-80h80v240h-80Zm160-80v-80h400v80H440Zm160-160v-240h80v80h160v80H680v80h-80Zm-480-80v-80h400v80H120Z"})})}function Wx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M522-80v-82q34-5 66.5-18t61.5-34l56 58q-42 32-88 51.5T522-80Zm-80 0Q304-98 213-199.5T122-438q0-75 28.5-140.5t77-114q48.5-48.5 114-77T482-798h6l-62-62 56-58 160 160-160 160-56-56 64-64h-8q-117 0-198.5 81.5T202-438q0 104 68 182.5T442-162v82Zm322-134-58-56q21-29 34-61.5t18-66.5h82q-5 50-24.5 96T764-214Zm76-264h-82q-5-34-18-66.5T706-606l58-56q32 39 51 86t25 98Z"})})}function Ux(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-80q-50-5-96-24.5T256-156l56-58q29 21 61.5 34t66.5 18v82Zm80 0v-82q104-15 172-93.5T760-438q0-117-81.5-198.5T480-718h-8l64 64-56 56-160-160 160-160 56 58-62 62h6q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-438q0 137-91 238.5T520-80ZM198-214q-32-42-51.5-88T122-398h82q5 34 18 66.5t34 61.5l-58 56Zm-76-264q6-51 25-98t51-86l58 56q-21 29-34 61.5T204-478h-82Z"})})}function Gx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M280-160 80-360l200-200 56 57-103 103h287v80H233l103 103-56 57Zm400-240-56-57 103-103H440v-80h287L624-743l56-57 200 200-200 200Z"})})}function Yx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M320-440v-287L217-624l-57-56 200-200 200 200-57 56-103-103v287h-80ZM600-80 400-280l57-56 103 103v-287h80v287l103-103 57 56L600-80Z"})})}function Xx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M600-360ZM320-242q10 1 19.5 1.5t20.5.5q11 0 20.5-.5T400-242v82h400v-400h-82q1-10 1.5-19.5t.5-20.5q0-11-.5-20.5T718-640h82q33 0 56.5 23.5T880-560v400q0 33-23.5 56.5T800-80H400q-33 0-56.5-23.5T320-160v-82Zm40-78q-117 0-198.5-81.5T80-600q0-117 81.5-198.5T360-880q117 0 198.5 81.5T640-600q0 117-81.5 198.5T360-320Zm0-80q83 0 141.5-58.5T560-600q0-83-58.5-141.5T360-800q-83 0-141.5 58.5T160-600q0 83 58.5 141.5T360-400Zm0-200Z"})})}function jx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h480v440q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v160h-80v-160h-40v80h-80v-80H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z"})})}function Qx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"})})}function Jx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z"})})}function eT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h720v80H120Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function tT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function oT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm160 0v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function nT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-720h80v720h-80Z"})})}function rT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h720v60H120Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Z"})})}function aT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-720h60v720h-60Zm165 0v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Z"})})}function iT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M320-600q17 0 28.5-11.5T360-640q0-17-11.5-28.5T320-680q-17 0-28.5 11.5T280-640q0 17 11.5 28.5T320-600Zm160 0q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm160 0q17 0 28.5-11.5T680-640q0-17-11.5-28.5T640-680q-17 0-28.5 11.5T600-640q0 17 11.5 28.5T640-600ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"})})}function lT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-200v-80h528l-42-42 56-56 138 138-138 138-56-56 42-42H160Zm116-200 164-440h80l164 440h-76l-38-112H392l-40 112h-76Zm138-176h132l-64-182h-4l-64 182Z"})})}function sT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M588-132 440-280l148-148 56 58-50 50h96q29 0 49.5-20.5T760-390q0-29-20.5-49.5T690-460H160v-80h530q63 0 106.5 43.5T840-390q0 63-43.5 106.5T690-240h-96l50 50-56 58ZM160-240v-80h200v80H160Zm0-440v-80h640v80H160Z"})})}function cT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-120 320-280l56-56 64 63v-414l-64 63-56-56 160-160 160 160-56 57-64-64v414l64-63 56 56-160 160Z"})})}function dT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm640 0v-720h80v720h-80ZM280-440v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function uT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"})})}function pT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm160-320h56l312-311-29-29-28-28-311 312v56Zm-80 80v-170l448-447q11-11 25.5-17t30.5-6q16 0 31 6t27 18l55 56q12 11 17.5 26t5.5 31q0 15-5.5 29.5T777-687L330-240H160Zm560-504-56-56 56 56ZM608-631l-29-29-28-28 57 57Z"})})}function mT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m247-904 57-56 343 343q23 23 23 57t-23 57L457-313q-23 23-57 23t-57-23L153-503q-23-23-23-57t23-57l190-191-96-96Zm153 153L209-560h382L400-751Zm360 471q-33 0-56.5-23.5T680-360q0-21 12.5-45t27.5-45q9-12 19-25t21-25q11 12 21 25t19 25q15 21 27.5 45t12.5 45q0 33-23.5 56.5T760-280ZM80 0v-160h800V0H80Z"})})}function fT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-760v-80h640v80H160Zm280 640v-408L336-424l-56-56 200-200 200 200-56 56-104-104v408h-80Z"})})}function gT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-80v-168l-64 64-56-56 160-160 160 160-56 56-64-64v168h-80ZM160-440v-80h640v80H160Zm320-120L320-720l56-56 64 64v-168h80v168l64-64 56 56-160 160Z"})})}function bT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-120v-80h640v80H160Zm320-160L280-480l56-56 104 104v-408h80v408l104-104 56 56-200 200Z"})})}function hT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"})})}function vT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"})})}function yT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"})})}function xT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"})})}function TT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"})})}function ST(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-160q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm0-240q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm0-240q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Z"})})}function CT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-440v-80h160v80H120Zm200 0v-80h160v80H320Zm200 0v-80h160v80H520Zm200 0v-80h120v80H720ZM240-120q-33 0-56.5-23.5T160-200v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-120H240Zm-80-520v-120q0-33 23.5-56.5T240-840h480q33 0 56.5 23.5T800-760v120h-80v-120H240v120h-80Z"})})}function PT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm0-80h640v-480H160v480Zm320-60q66 0 113-37t47-93q0-29-13-58t-34-55q-21-26-50-49t-50-31q-21 8-50 31t-50 49q-21 26-34 55t-13 58q0 56 47 93t140 37Z"})})}function ET(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M313-440l224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"})})}function wT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"})})}function MT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"})})}function IT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M268-240 42-466l57-56 170 170 56 56-57 56Zm226 0L268-466l56-57 170 170 368-368 57 57-425 424Zm0-226-57-56 198-198 57 56-198 198Z"})})}function kT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m424-296 282-282-56-56-226 226-114-114-56 56 170 170Zm56 216q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z"})})}function RT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function _T(e){return jsxRuntime.jsxs(L,{...e,children:[jsxRuntime.jsx("path",{d:"M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"}),jsxRuntime.jsx("path",{fill:"var(--doc-success)",d:"m421-380 227-227-45-45-182 182-92-91-45 45 137 136Z"})]})}function NT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"})})}function DT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"})})}function LT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-400h80v-120h120v-80H520v-120h-80v120H320v80h120v120ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function HT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M240-400h480v-80H240v80Zm0-120h480v-80H240v80Zm0-120h480v-80H240v80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function FT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-400h280v-80H160v80Zm0-160h440v-80H160v80Zm0-160h440v-80H160v80Zm360 360v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T863-380L643-160H520Zm300-263-37-37 37 37ZM580-220h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z"})})}function AT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M240-400h122l200-200q9-9 13.5-20.5T580-643q0-11-5-21.5T562-684l-36-38q-9-9-20-13.5t-23-4.5q-11 0-22.5 4.5T440-722L240-522v122Zm280-243-37-37 37 37ZM300-460v-38l101-101 20 18 18 20-101 101h-38Zm121-121 18 20-38-38 20 18Zm26 181h273v-80H527l-80 80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function OT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Zm0-300Zm0 220q113 0 207.5-59.5T832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280Z"})})}function ZT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm0-280v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80ZM680-80l-56-56 64-64H120v-80h568l-64-64 56-56 160 160L680-80Z"})})}function BT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm-88 160 64 64-56 56-160-160 160-160 56 56-64 64h568v80H272Zm88-440v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80Z"})})}function qT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"})})}var KT={undo:Qy,redo:Jy,print:ex,file_download:tx,file_upload:ox,format_bold:nx,format_italic:rx,format_underlined:ax,strikethrough_s:ix,superscript:lx,subscript:sx,link:cx,format_clear:dx,format_align_left:ux,format_align_center:px,format_align_right:mx,format_align_justify:fx,format_line_spacing:us,format_list_bulleted:gx,format_list_numbered:bx,format_indent_increase:hx,format_indent_decrease:vx,format_color_text:yx,ink_highlighter:xx,format_color_reset:Tx,arrow_drop_down:Sx,table:Cx,table_chart:Px,grid_on:Ex,table_rows:wx,view_column:Mx,border_all:_p,select_all:_p,border_outer:Ix,border_inner:kx,border_clear:Rx,add:_x,remove:Nx,delete:Dx,delete_sweep:Lx,call_merge:Hx,call_split:Fx,drag_indicator:Ax,image:Ox,format_image_left:Zx,format_image_right:Bx,horizontal_rule:qx,flip_to_back:Kx,flip_to_front:zx,open_with:Vx,tune:$x,rotate_right:Wx,rotate_left:Ux,swap_horiz:Gx,swap_vert:Yx,shapes:Xx,format_paint:jx,expand_more:Qx,expand_less:Jx,border_top:eT,border_bottom:tT,border_left:oT,border_right:nT,border_horizontal:rT,border_vertical:aT,padding:iT,text_rotation_none:lT,wrap_text:sT,height:cT,fit_width:dT,settings:uT,border_color:pT,format_color_fill:mT,vertical_align_top:fT,vertical_align_center:gT,vertical_align_bottom:bT,line_weight:hT,keyboard_arrow_up:vT,keyboard_arrow_down:yT,keyboard_arrow_left:xT,keyboard_arrow_right:TT,more_vert:ST,page_break:CT,branding_watermark:PT,arrow_back:ET,search:wT,toc:MT,done_all:IT,check_circle:kT,chat_bubble_outline:RT,chat_bubble_check:_T,check:NT,close:DT,add_comment:LT,comment:HT,edit_note:FT,rate_review:AT,visibility:OT,format_textdirection_l_to_r:ZT,format_textdirection_r_to_l:BT,"agent-sparkle":qT};function K({name:e,size:t=20,className:n="",style:o}){let r=KT[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 _a=12,ps=240,UT=24,tr=12,Na=Ye__namespace.default.memo(function({headings:t,onHeadingClick:n,onClose:o,topOffset:r=0,scrollLeft:a=0,leftOffset:i=_a}){let{t:s}=_(),[c,l]=Ye.useState(false),d=t.length?Math.min(...t.map(p=>p.level)):0;return Ye.useEffect(()=>{requestAnimationFrame(()=>l(true));},[]),jsxRuntime.jsxs("nav",{className:"docx-outline-nav",role:"navigation","aria-label":s("documentOutline.ariaLabel"),style:{position:"absolute",top:r,left:i-a,bottom:0,width:ps,paddingTop:UT,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,transform:c?"translateX(0)":`translateX(-${i+ps}px)`,transition:"transform 0.15s ease-out"},onMouseDown:p=>p.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"16px 16px 12px 0"},children:[jsxRuntime.jsx("button",{onClick:o,"aria-label":s("documentOutline.closeAriaLabel"),style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:"50%",display:"flex",alignItems:"center",color:"var(--doc-text-muted)"},title:s("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:s("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:s("documentOutline.noHeadings")}):t.map((p,f)=>jsxRuntime.jsx("div",{style:{marginLeft:(p.level-d)*16},children:jsxRuntime.jsx("button",{className:"docx-outline-heading-btn",onClick:()=>n(p.blockId),style:{display:"block",width:"100%",textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"5px 8px",fontSize:13,fontWeight:400,color:"var(--doc-text)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderRadius:0,letterSpacing:"0.01em"},title:p.text,children:p.text})},`${p.blockId}-${f}`))})]})});var jT=e=>e,QT=Object.freeze([]),JT=()=>{};function ms(e){let t=A(),n=q(jT),o=Ye.useMemo(()=>t&&!n.isLoading?t.getOutline():QT,[t,n]),r=Ye.useCallback(a=>{if(!t)return;t.focus();let i={paragraphId:a,offset:0};t.exec({type:"setSelection",range:{anchor:i,head:i}}),t.scrollToBlock(a);},[t]);return io(n)?null:jsxRuntime.jsx(Na,{headings:o,onHeadingClick:r,onClose:e.onClose??JT,topOffset:e.topOffset??0,...e.leftOffset!==void 0?{leftOffset:e.leftOffset}:{}})}var fs=Ye.createContext(null);function Ot(e){let t=Ye.useContext(fs);if(!t)throw new Error(`<DocxEditor.Navigation.${e}> must be rendered inside <DocxEditor.Navigation>`);return t}var qo=280,Da=32,Lp=16;function Ko(e=280){return 32+e+16}function La({viewportWidth:e,pageWidthPx:t,reservation:n,inlineEndReservation:o=0,docked:r=false}){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0||!Number.isFinite(n)||n<=0||!Number.isFinite(o)||o<0)return 0;let a=(e-o-t)/2;return a>=n?0:!r&&n<=2*a?Math.ceil(2*(n-a)):Math.ceil(n)}var aS=Object.freeze([]),iS=e=>e;function Ha(){let e=A(),t=q(iS),[n,o]=Ye.useState(null),r=Ye.useMemo(()=>e&&!t.isLoading?e.getOutline():aS,[e,t]),a=Ye.useMemo(()=>{if(r.length===0)return [];let s=r[0].level;for(let c of r)c.level<s&&(s=c.level);return r.map(c=>({heading:c,depth:c.level-s}))},[r]),i=Ye.useCallback(s=>{if(!e||typeof s!="string"||s.length===0)return;e.focus();let c={paragraphId:s,offset:0};e.exec({type:"setSelection",range:{anchor:c,head:c}}),e.scrollToBlock(s),o(s);},[e]);return {headings:r,items:a,selectedBlockId:n,goTo:i,isEmpty:r.length===0}}var hs=150,vs=2e3,bs=Object.freeze([]),cS=e=>e;function Fa(){let e=A(),t=q(cS),[n,o]=Ye.useState(""),[r,a]=Ye.useState(""),[i,s]=Ye.useState(false),[c,l]=Ye.useState(false),[d,p]=Ye.useState(bs),[f,m]=Ye.useState(-1);Ye.useEffect(()=>{if(n===r)return;let y=setTimeout(()=>a(n),hs);return ()=>clearTimeout(y)},[n,r]);let g=Ye.useMemo(()=>({matchCase:i,wholeWord:c}),[i,c]);Ye.useEffect(()=>{if(!e||r.length===0){p(bs),m(-1);return}let y=e.findMatches(r,g);p(x=>x===y?x:y);},[e,r,g,t]);let u=Ye.useRef(d);Ye.useEffect(()=>{u.current!==d&&(u.current=d,m(y=>y>=0&&y<d.length?y:-1));},[d]);let h=Ye.useCallback(y=>{if(!e)return;let x=d[y];if(!x)return;e.focus(),e.selectMatch(x).ok&&m(y);},[e,d]),b=Ye.useCallback(y=>{if(d.length===0)return;let M=((f<0?y>0?-1:0:f)+y+d.length)%d.length;h(M);},[f,h,d.length]),v=Ye.useCallback(()=>b(1),[b]),C=Ye.useCallback(()=>b(-1),[b]),P=Ye.useCallback(y=>o(y),[]),S=Ye.useCallback(()=>{o(""),a(""),p(bs),m(-1);},[]);return {query:n,setQuery:P,matchCase:i,setMatchCase:s,wholeWord:c,setWholeWord:l,matches:d,truncated:d.length>=vs,activeIndex:f,goTo:h,next:v,previous:C,clear:S,isPending:n!==r}}var gS=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)}},bS=(e,t)=>e.zoom===t.zoom&&e.reviewPaneOpen===t.reviewPaneOpen&&e.fitting===t.fitting&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function Oa(e={}){let{defaultOpen:t=false,defaultTab:n="headings",paneWidth:o=280}=e,[r,a]=Ye.useState(t),[i,s]=Ye.useState(n),c=e.open??r,l=e.tab??i,{onOpenChange:d,onTabChange:p}=e,f=e.open!==void 0,m=e.tab!==void 0,g=Ye.useCallback(D=>{f||a(D),d?.(D);},[f,d]),u=Ye.useCallback(()=>g(!c),[c,g]),h=Ye.useCallback(D=>{m||s(D),p?.(D);},[m,p]),b=ko(),v=_o(),C=Ye.useContext(St),{pageSetup:P,zoom:S,reviewPaneOpen:y,fitting:x}=q(gS,bS),[M,E]=Ye.useState(0),[w,N]=Ye.useState(0);Ye.useEffect(()=>{if(!v){E(0),N(0);return}let D=()=>{E(v.clientWidth);let R=Number.parseFloat(getComputedStyle(v).paddingInlineEnd);N(Number.isFinite(R)?R:0);};if(D(),typeof ResizeObserver>"u")return;let I=new ResizeObserver(D);return I.observe(v),()=>I.disconnect()},[v,c,y,C?.mounted]);let F=Ye.useRef(null);P&&(F.current=P.pageWidthTwips);let H=P?.pageWidthTwips??F.current,k=Ye.useMemo(()=>!c||H===null?0:La({viewportWidth:M,pageWidthPx:_e(H)*S,reservation:Ko(o),inlineEndReservation:w,docked:x}),[c,H,S,M,o,w,x]);return Ye.useEffect(()=>{if(b)return b.setShift(k),()=>b.setShift(0)},[b,k]),{open:c,setOpen:g,toggle:u,tab:l,setTab:h,paneWidth:o,shift:k}}var or=["headings","find"],ht=(...e)=>e.filter(Boolean).join(" ");function nr({className:e,style:t,children:n}){return jsxRuntime.jsx("div",{className:ht("docx-nav__header",e),style:t,children:n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(rr,{}),jsxRuntime.jsx(ar,{})]})})}function rr({className:e,style:t,children:n}){let{pane:o,t:r}=Ot("Close");return jsxRuntime.jsx("button",{type:"button",className:ht("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 ar({className:e,style:t,children:n}){let{t:o}=Ot("Title");return jsxRuntime.jsx("h2",{className:ht("docx-nav__title",e),style:t,children:n??o("navigation.title")})}function ir({className:e,style:t,children:n}){let{pane:o,t:r}=Ot("Tabs"),a=Ye.useCallback(i=>{let s=i.key==="ArrowRight"?1:i.key==="ArrowLeft"?-1:0;if(s===0)return;i.preventDefault();let c=or.indexOf(o.tab);o.setTab(or[(c+s+or.length)%or.length]);},[o]);return jsxRuntime.jsx("div",{className:ht("docx-nav__tabs",e),style:t,role:"tablist","aria-label":r("navigation.title"),onKeyDown:a,children:n??or.map(i=>jsxRuntime.jsx(lr,{value:i},i))})}function lr({value:e,className:t,style:n,children:o}){let{pane:r,t:a}=Ot("Tab"),i=r.tab===e;return jsxRuntime.jsx("button",{type:"button",role:"tab",id:`docx-nav-tab-${e}`,"aria-selected":i,"aria-controls":`docx-nav-panel-${e}`,tabIndex:i?0:-1,className:ht("docx-nav__tab",i&&"docx-nav__tab--selected",t),style:n,onClick:()=>r.setTab(e),children:o??a(`navigation.tabs.${e}`)})}function Ap({value:e,onChange:t,onClear:n,placeholder:o,label:r,clearLabel:a,autoFocus:i}){return jsxRuntime.jsxs("div",{className:"docx-nav__searchbox",children:[jsxRuntime.jsx(K,{name:"search",size:18,className:"docx-nav__search-icon"}),jsxRuntime.jsx("input",{type:"search",className:"docx-nav__search-input",value:e,placeholder:o,"aria-label":r,autoFocus:i,onChange:s=>t(s.target.value)}),e.length>0&&jsxRuntime.jsx("button",{type:"button",className:"docx-nav__search-clear","aria-label":a,onClick:n,children:jsxRuntime.jsx(K,{name:"close",size:16})})]})}function sr({className:e,style:t}){let{pane:n,outline:o,t:r}=Ot("Headings"),[a,i]=Ye.useState(""),s=q(io),c=Ye.useMemo(()=>{let d=a.trim().toLowerCase();return d.length===0?o.items:o.items.filter(p=>p.heading.text.toLowerCase().includes(d))},[o.items,a]),l=n.tab!=="headings";return jsxRuntime.jsxs("div",{className:ht("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-headings","aria-labelledby":"docx-nav-tab-headings",hidden:l,children:[jsxRuntime.jsx(Ap,{value:a,onChange:i,onClear:()=>i(""),placeholder:r("navigation.find.placeholder"),label:r("navigation.find.inputAriaLabel"),clearLabel:r("navigation.find.clearAriaLabel")}),s?null:o.isEmpty?jsxRuntime.jsx("p",{className:"docx-nav__empty",children:r("navigation.headings.noHeadings")}):c.length===0?jsxRuntime.jsx("p",{className:"docx-nav__empty",children:r("navigation.find.noResults")}):jsxRuntime.jsx("ul",{className:"docx-nav__list",children:c.map((d,p)=>jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:ht("docx-nav__heading",o.selectedBlockId===d.heading.blockId&&"docx-nav__heading--current"),style:{paddingInlineStart:`${8+d.depth*14}px`},title:d.heading.text,onClick:()=>o.goTo(d.heading.blockId),children:d.heading.text})},`${d.heading.blockId}-${p}`))})]})}function xS({match:e,active:t,onSelect:n}){return jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:ht("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 cr({className:e,style:t}){let{pane:n,search:o,t:r}=Ot("Find"),a=n.tab!=="find",i=o.query.trim().length>0,s=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:ht("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-find","aria-labelledby":"docx-nav-tab-find",hidden:a,children:[jsxRuntime.jsx(Ap,{value:o.query,onChange:o.setQuery,onClear:o.clear,placeholder:r("navigation.find.placeholder"),label:r("navigation.find.inputAriaLabel"),clearLabel:r("navigation.find.clearAriaLabel")}),jsxRuntime.jsxs("div",{className:"docx-nav__options",role:"group","aria-label":r("navigation.find.optionsAriaLabel"),children:[jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:o.matchCase,onChange:c=>o.setMatchCase(c.target.checked)}),r("navigation.find.matchCase")]}),jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:o.wholeWord,onChange:c=>o.setWholeWord(c.target.checked)}),r("navigation.find.wholeWord")]})]}),jsxRuntime.jsxs("div",{className:"docx-nav__resultbar",children:[jsxRuntime.jsx("span",{className:"docx-nav__count","aria-live":"polite",children:i?o.isPending?r("navigation.find.searching"):s??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,l)=>jsxRuntime.jsx(xS,{match:c,active:l===o.activeIndex,onSelect:()=>o.goTo(l)},`${c.blockId}-${c.start}-${l}`))})]})}function dr({className:e,style:t,children:n}){let{pane:o,t:r}=Ot("Toggle");return jsxRuntime.jsx("button",{type:"button",className:ht("docx-nav__toggle",e),style:t,"aria-label":r("navigation.openAriaLabel"),"aria-expanded":o.open,title:r("navigation.openTitle"),onMouseDown:a=>a.preventDefault(),onClick:o.toggle,children:n??jsxRuntime.jsx(K,{name:"toc",size:20})})}function xs(e){let t=Xe(),{t:n,toggle:o=true,className:r,style:a,children:i,...s}=e,c=Oa(s),l=Ha(),d=Fa(),{t:p}=_(),f=Ye.useMemo(()=>({pane:c,outline:l,search:d,t:n??((g,u)=>p(g,u))}),[c,l,d,n,p]),m=e.paneWidth??280;return jsxRuntime.jsx(fs.Provider,{value:f,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":`${m}px`,"--docx-nav-inset":`${32}px`,"--docx-nav-reservation":`${Ko(m)}px`,...a},children:[o!==false&&!c.open&&jsxRuntime.jsx(dr,{...typeof o=="object"?o:{}}),jsxRuntime.jsx("aside",{className:"docx-nav__panel-shell","aria-label":f.t("navigation.ariaLabel"),inert:!c.open,children:i??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(nr,{}),jsxRuntime.jsx(ir,{}),jsxRuntime.jsx(sr,{}),jsxRuntime.jsx(cr,{})]})})]})})}var Za=Object.assign(xs,{Header:nr,Close:rr,Title:ar,Tabs:ir,Tab:lr,Headings:sr,Find:cr,Toggle:dr});var MS=600,IS=e=>e.page.total,Ts=Ye.createContext(null);function Ss({className:e,style:t}){let n=Xe(),o=A(),r=_o(),a=q(IS),{t:i}=_(),s=Ye.useContext(Ts),[c,l]=Ye.useState(1),[d,p]=Ye.useState(false);if(Ye.useEffect(()=>{if(p(false),!o||!r||a<=1)return;l(o.getCurrentPage("viewport"));let m=null,g=()=>{l(o.getCurrentPage("viewport")),p(true),m&&clearTimeout(m),m=setTimeout(()=>p(false),MS);};return r.addEventListener("scroll",g,{passive:true}),()=>{r.removeEventListener("scroll",g),m&&clearTimeout(m);}},[o,a,r]),a<=1)return null;let f=s?s("viewer.pageIndicator").replace(/\{current\}/g,String(c)).replace(/\{total\}/g,String(a)):i("viewer.pageIndicator",{current:c,total:a});return jsxRuntime.jsx("div",{className:`${n}docx-editor-shell__page-indicator-chip docx-editor__page-number${e?` ${e}`:""}`,style:t,"data-visible":d?"true":"false",role:"status","aria-live":"polite",children:f})}var _S=[],NS=e=>e.fontSubstitutions??_S;function Ba({className:e,style:t,t:n}){let o=q(NS),{t:r}=_(),a=n??r,[i,s]=Ye.useState(null);if(o.length===0)return null;let c=o.join("\0");return i===c?null:jsxRuntime.jsxs("div",{className:e?`docx-font-notice ${e}`:"docx-font-notice",role:"status",...t?{style:t}:{},children:[jsxRuntime.jsx("span",{className:"docx-font-notice__text",children:a("editor.fontSubstitutionNotice",{fonts:o.join(", ")}).replace("{fonts}",o.join(", "))}),jsxRuntime.jsx("button",{type:"button",className:"docx-font-notice__dismiss",onClick:()=>s(c),children:a("common.dismiss")})]})}var Ve={hfInlineEditor:10,chrome:50,ruler:30,outline:40,popover:100,toolbar:100,modal:1e4};function Cs(e){return Math.round(e/1440*100)/100}function qp(e){return Math.round(e*1440)}function HS(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 Ps(){let e=A(),t=Ye.useCallback(n=>e?.getHeaderFooterState()??null,[e]);return q(t,HS)}function qa(e,t,n){let o=e.getBoundingClientRect();return {left:t-o.left-e.clientLeft+e.scrollLeft,top:n-o.top-e.clientTop+e.scrollTop}}function Ka(e,t){let[n,o]=Ye.useState(null),r=Ye.useCallback(s=>o(s),[]),[a,i]=Ye.useState({visibility:"hidden"});return Ye.useLayoutEffect(()=>{let s=n?.closest(".docx-editor__scroll-container"),c=s??n?.parentElement?.querySelector(".docx-editor__scroll-container");if(!n||!c)return;let l=0,d=null,p=new ResizeObserver(()=>m()),f=()=>{l=0;let u=e(c);if(u!==d&&(p.disconnect(),p.observe(c),p.observe(n),u&&p.observe(u),d=u),!u||!u.isConnected){i({visibility:"hidden"});return}let h=u.getBoundingClientRect(),b=Math.max(n.offsetHeight,28),v=6,C=s===c,P=h.top-b-v,S=C?qa(c,h.left,P):{left:h.left,top:P},y=S.left,x=S.top;C?c.scrollLeft+8:8;i({position:C?"absolute":"fixed",left:y,top:x,...{width:Math.max(240,Math.min(h.width,c.clientWidth-16))},visibility:"visible"});},m=()=>{l||(l=requestAnimationFrame(f));};p.observe(c),p.observe(n);let g=new MutationObserver(m);return g.observe(c,{subtree:true,childList:true,attributes:true,attributeFilter:["data-docx-hf-active","data-docx-note-scope"]}),c.addEventListener("scroll",m,{passive:true}),window.addEventListener("resize",m),f(),()=>{l&&cancelAnimationFrame(l),p.disconnect(),g.disconnect(),c.removeEventListener("scroll",m),window.removeEventListener("resize",m);}},[n,e,t]),{ref:r,style:a}}function BS(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 qS=[{field:"PAGE",labelKey:"headerFooter.insertPageNumber"},{field:"NUMPAGES",labelKey:"headerFooter.insertTotalPages"},{field:"SECTIONPAGES",labelKey:"headerFooter.insertSectionPages"},{field:"PAGE_X_OF_Y",labelKey:"headerFooter.insertPageXofY"}];function ur(e){let t=A();return Ye.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 KS(e){let{state:t,onMouseDown:n}=e,{t:o}=_(),r=A(),[a,i]=Ye.useState(false),s=Ye.useRef(null),[c,l]=Ye.useState(""),[d,p]=Ye.useState("");Ye.useEffect(()=>{a&&(t.headerDistanceTwips===void 0||t.footerDistanceTwips===void 0||(l(String(Cs(t.headerDistanceTwips))),p(String(Cs(t.footerDistanceTwips)))));},[a,t.headerDistanceTwips,t.footerDistanceTwips]),Ye.useEffect(()=>{if(!a)return;let x=M=>{s.current?.contains(M.target)||i(false);};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[a]);let f=Ye.useMemo(()=>({type:"setHeaderFooterOptions",titlePage:!t.titlePage}),[t.titlePage]),m=Ye.useMemo(()=>({type:"setHeaderFooterOptions",evenAndOddHeaders:!t.evenAndOddHeaders}),[t.evenAndOddHeaders]),g=Ye.useMemo(()=>({type:"linkHeaderFooterToPrevious"}),[]),u=Ye.useMemo(()=>({type:"unlinkHeaderFooterFromPrevious"}),[]),h=Ye.useMemo(()=>({type:"removeHeaderFooter",position:t.editing}),[t.editing]),b=ur(f),v=ur(m),C=ur(g),P=ur(u),S=ur(h),y=(x,M)=>{if(!r)return;let E=Number.parseFloat(M);Number.isFinite(E)&&r.exec({type:"setHeaderFooterOptions",[x]:qp(E)});};return jsxRuntime.jsxs("div",{ref:s,className:"docx-hf-chrome__options",onMouseDown:n,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-context-bar__options-trigger","aria-expanded":a,"aria-haspopup":"menu",onClick:()=>i(x=>!x),onMouseDown:n,children:o("headerFooter.options")}),a?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:n,children:[qS.map(x=>{let M={type:"insertPageField",field:x.field},E=r?.can(M);return jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!E?.ok,title:E&&!E.ok?E.reason:void 0,onClick:()=>{r?.exec(M),i(false);},onMouseDown:n,children:o(x.labelKey)},x.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:!b.enabled,title:b.reason??void 0,onChange:()=>r?.exec(f)}),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:!v.enabled,title:v.reason??void 0,onChange:()=>r?.exec(m)}),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:!P.enabled,title:P.reason??void 0,onClick:()=>r?.exec(u),onMouseDown:n,children:o("headerFooter.unlinkFromPrevious")}):jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!C.enabled,title:C.reason??void 0,onClick:()=>r?.exec(g),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:x=>l(x.target.value),onBlur:()=>y("headerDistanceTwips",c)}),jsxRuntime.jsx("span",{className:"docx-hf-chrome__unit",children:"in"})]}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row docx-hf-chrome__menu-row--distance",children:[jsxRuntime.jsx("span",{children:o("headerFooter.footerDistance")}),jsxRuntime.jsx("input",{type:"number",min:0,step:.01,"aria-label":o("headerFooter.footerDistance"),value:d,onChange:x=>p(x.target.value),onBlur:()=>y("footerDistanceTwips",d)}),jsxRuntime.jsx("span",{className:"docx-hf-chrome__unit",children:"in"})]}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!S.enabled,title:S.reason??void 0,onClick:()=>r?.exec(h),onMouseDown:n,children:t.editing==="header"?o("headerFooter.removeHeader"):o("headerFooter.removeFooter")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-hf-close",onClick:()=>{r?.exec({type:"exitHeaderFooter"}),i(false);},onMouseDown:n,children:o("common.close")})]}):null]})}function za({className:e}){let{t}=_(),n=Ps(),o=Ye.useCallback(s=>s.querySelector("[data-docx-hf-active]"),[]),r=Ka(o,"story-label"),a=O;if(!n?.editing)return null;let i=BS(n.editing,n.variant);return jsxRuntime.jsxs("div",{ref:r.ref,className:`docx-context-bar docx-hf-chrome${e?` ${e}`:""}`,role:"region","aria-label":t("headerFooter.chromeAriaLabel"),"data-testid":"docx-hf-chrome",onMouseDown:a,style:{...r.style,zIndex:Ve.hfInlineEditor},children:[jsxRuntime.jsxs("div",{className:"docx-context-bar__label",children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:t(i)}),n.inherited?jsxRuntime.jsx("span",{className:"docx-context-bar__status","data-testid":"docx-hf-inherited",title:t("headerFooter.sameAsPreviousHint"),children:t("headerFooter.sameAsPrevious")}):null]}),jsxRuntime.jsx(KS,{state:n,onMouseDown:a})]})}function uo(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var Va=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"})}),YS="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",XS="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",jS="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",QS="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 JS({className:e,asChild:t,hidden:n,children:o,preset:r=true}){let a=vt(),i=Ye.useRef(null),{state:s,close:c}=a;Ye.useEffect(()=>{if(s.mode==="closed")return;let u=b=>{b.key==="Escape"&&(b.preventDefault(),c());},h=b=>{let v=i.current;v&&b.target instanceof Node&&v.contains(b.target)||c();};return document.addEventListener("keydown",u),document.addEventListener("mousedown",h,true),()=>{document.removeEventListener("keydown",u),document.removeEventListener("mousedown",h,true);}},[s.mode,c]);let[l,d]=Ye.useState(null);Ye.useLayoutEffect(()=>{let u=s.anchor,h=i.current;if(!u||!h){d(null);return}let b=h.offsetParent;if(!b){d(null);return}let{left:v,top:C}=qa(b,u.left,u.top),P=Math.max(0,b.scrollWidth-h.offsetWidth);d({left:Math.max(0,Math.min(v,P)),top:C});},[s.anchor]);let{t:p}=_(),f=s.mode==="editing"?p(s.link?"hyperlinkPopup.editTitle":"hyperlinkPopup.insertTitle"):p("hyperlinkPopup.editLink"),m=r?jsxRuntime.jsx(eC,{children:o}):o;if(n)return s.mode==="closed"?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:o});let g={ref:i,className:`docx-hyperlink-popup${e?` ${e}`:""}`,"data-testid":"hyperlink-popup","data-mode":s.mode,role:"dialog","aria-modal":false,onMouseDown:uo,style:l??void 0,"aria-label":f};return s.mode==="closed"?null:t?jsxRuntime.jsx(W,{...g,children:o}):jsxRuntime.jsx("div",{...g,children:m})}function eC({children:e}){let{state:t}=vt(),n=Ye.useMemo(()=>tC(e),[e]),o=(r,a)=>r in n?n[r]:a;return t.mode==="editing"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o("Fields",jsxRuntime.jsx(_s,{})),o("Error",jsxRuntime.jsx(Ds,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Apply",jsxRuntime.jsx(Ns,{})),o("Cancel",jsxRuntime.jsx(Ls,{}))]}),n.__extra]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o("Url",jsxRuntime.jsx(Ms,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Copy",jsxRuntime.jsx(Is,{})),t.canEdit?o("Edit",jsxRuntime.jsx(ks,{})):null,t.canEdit?o("Unlink",jsxRuntime.jsx(Rs,{})):null]}),n.__extra]})}function tC(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===Ye.Fragment){o(r.props.children);return}let a=r.type.docxHyperLinkPart;a?t[a]=r:n.push(r);};return o(e),n.length>0&&(t.__extra=n),t}function vt(){return Ye.useContext(mn)??oC}var oC={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 Ms({className:e,asChild:t,hidden:n,children:o}){let{state:r,openTarget:a}=vt(),{t:i}=_();if(n||!r.link)return null;let s=!r.link.href,c=r.link.kind==="internal",l=c?`#${r.link.anchor??""}`:r.link.authored,d=i(s?"hyperlinkPopup.inertTarget":c?"hyperlinkPopup.bookmarkTarget":"hyperlinkPopup.openLink"),p={className:`docx-hyperlink-popup__url${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-url",...s?{"data-inert":""}:{},title:d,onMouseDown:uo,...s?{}:{onClick:()=>a(),type:"button"}};return t?jsxRuntime.jsx(W,{...p,children:o}):s?jsxRuntime.jsxs("span",{...p,children:[o??l,jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:d})]}):jsxRuntime.jsxs("button",{...p,children:[o??l,Va(QS)]})}Ms.docxHyperLinkPart="Url";function Is({className:e,asChild:t,hidden:n,children:o,icon:r}){let{state:a,copy:i}=vt(),{t:s}=_();if(n||!a.link?.href)return null;let c=a.copied?s("editor.linkCopied"):s("hyperlinkPopup.copyLink"),l={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-copy",...a.copied?{"data-copied":""}:{},"aria-label":c,title:c,onMouseDown:uo,onClick:()=>{i();}};return t?jsxRuntime.jsx(W,{...l,children:o}):jsxRuntime.jsx("button",{...l,children:r??o??Va(YS)})}Is.docxHyperLinkPart="Copy";function ks({className:e,asChild:t,hidden:n,children:o,icon:r}){let{beginEdit:a}=vt(),{t:i}=_();if(n)return null;let s=i("hyperlinkPopup.editLink"),c={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-edit","aria-label":s,title:s,onMouseDown:uo,onClick:()=>a()};return t?jsxRuntime.jsx(W,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:r??o??Va(XS)})}ks.docxHyperLinkPart="Edit";function Rs({className:e,asChild:t,hidden:n,children:o,icon:r}){let{unlink:a}=vt(),{t:i}=_();if(n)return null;let s=i("hyperlinkPopup.removeLink"),c={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-unlink","aria-label":s,title:s,onMouseDown:uo,onClick:()=>a()};return t?jsxRuntime.jsx(W,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:r??o??Va(jS)})}Rs.docxHyperLinkPart="Unlink";function _s({className:e,hidden:t}){let{state:n,setText:o,setUrl:r,commitEdit:a,close:i}=vt(),{t:s}=_(),c=Ye.useRef(null),l=Ye.useId(),d=Ye.useId();Ye.useEffect(()=>{n.mode==="editing"&&(c.current?.focus({preventScroll:true}),c.current?.select());},[n.mode]);let p=Ye.useCallback(f=>{if(f.key==="Enter"){f.preventDefault(),a();return}f.key==="Escape"&&(f.preventDefault(),i());},[a,i]);return t?null:jsxRuntime.jsxs("div",{className:`docx-hyperlink-popup__fields${e?` ${e}`:""}`,children:[jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:l,children:s("hyperlinkPopup.displayTextPlaceholder")}),jsxRuntime.jsx("input",{id:l,"data-testid":"hyperlink-popup-text",className:"docx-hyperlink-popup__input",value:n.text,placeholder:s("hyperlinkPopup.displayTextPlaceholder"),onChange:f=>o(f.target.value),onKeyDown:p}),jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:d,children:s("hyperlinkPopup.urlPlaceholder")}),jsxRuntime.jsx("input",{id:d,ref:c,"data-testid":"hyperlink-popup-url-input",className:"docx-hyperlink-popup__input",value:n.url,placeholder:s("hyperlinkPopup.urlPlaceholder"),onChange:f=>r(f.target.value),onKeyDown:p})]})}_s.docxHyperLinkPart="Fields";function Ns({className:e,asChild:t,hidden:n,children:o}){let{state:r,commitEdit:a}=vt(),{t:i}=_();if(n)return null;let s=i("hyperlinkPopup.apply"),c={type:"button",className:`docx-hyperlink-popup__apply${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-apply",disabled:r.url.trim().length===0,onMouseDown:uo,onClick:()=>a()};return t?jsxRuntime.jsx(W,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:o??s})}function Ds({className:e,hidden:t}){let{state:n}=vt(),{t:o}=_();return t||!n.error?null:jsxRuntime.jsx("div",{className:`docx-hyperlink-popup__error${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-error",role:"alert",children:o("hyperlinkPopup.refused")})}Ds.docxHyperLinkPart="Error";Ns.docxHyperLinkPart="Apply";function Ls({className:e,asChild:t,hidden:n,children:o}){let{close:r}=vt(),{t:a}=_();if(n)return null;let i=a("hyperlinkPopup.cancel"),s={type:"button",className:`docx-hyperlink-popup__cancel${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-cancel",onMouseDown:uo,onClick:()=>r()};return t?jsxRuntime.jsx(W,{...s,children:o}):jsxRuntime.jsx("button",{...s,children:o??i})}Ls.docxHyperLinkPart="Cancel";var $a=Object.assign(JS,{Url:Ms,Copy:Is,Edit:ks,Unlink:Rs,Fields:_s,Error:Ds,Apply:Ns,Cancel:Ls});function nC(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 Hs(){let e=A(),t=Ye.useCallback(o=>{let r=e?.getActiveScope();return r?.kind==="note"?r:null},[e]),n=q(t,nC);return n?.kind==="note"?n:null}function Up(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 Gp(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&&Up(e.documentAuthored,t.documentAuthored)&&Up(e.sectionAuthored,t.sectionAuthored)}function rC(e,t){return e===t?true:!e||!t?false:e.sectionIndex===t.sectionIndex&&Gp(e.footnote,t.footnote)&&Gp(e.endnote,t.endnote)}function Fs(){let e=A(),t=Ye.useCallback(n=>e?.getNotePropertiesState()??null,[e]);return q(t,rC)}var aC=/^(footnote|endnote):(-?\d{1,10})$/;function Xp(e){let t=aC.exec(e);if(!t)return null;let n=Number(t[2]);return Number.isInteger(n)?{noteKind:t[1],noteId:n}:null}function iC(){return typeof window>"u"?false:window.matchMedia("(pointer: coarse)").matches}function Os(e){let t=A();return Ye.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 lC(e){let{t}=_(),[n,o]=Ye.useState(false),r=Ye.useRef(null);return Ye.useEffect(()=>{if(!n)return;let a=i=>{r.current?.contains(i.target)||o(false);};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[n]),jsxRuntime.jsxs("div",{ref:r,className:"docx-hf-chrome__options",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-context-bar__options-trigger","data-testid":"docx-notes-options","aria-expanded":n,"aria-haspopup":"menu",onMouseDown:O,onClick:()=>o(a=>!a),children:t("headerFooter.options")}),n?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:O,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-notes-properties",onClick:()=>{e.onOpenProperties(),o(false);},children:t("dialogs.footnoteProperties.title")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-notes-close",onClick:()=>{e.onClose(),o(false);},children:t("common.close")})]}):null]})}function Wa({className:e}){let{t}=_(),n=A(),o=Hs(),[r,a]=Ye.useState(null),[i,s]=Ye.useState(null),[c,l]=Ye.useState(false),d=Ye.useRef(null),p=Ye.useCallback(E=>{if(!o)return null;let N=[...E.querySelectorAll("[data-docx-note-scope]")].find(F=>F.matches("[data-docx-note]")&&F.dataset.docxNoteScope===o.id)??null;return N?.closest("[data-docx-notes]")??N},[o]),f=Ka(p,"story-label"),m=Ye.useCallback(()=>{d.current&&clearTimeout(d.current),d.current=null,a(null);},[]);Ye.useEffect(()=>{if(!n)return;let E=document.querySelector(".docx-pages");if(!E)return;let w=H=>{let k=H.target;if(!k)return;let D=k.closest("[data-docx-note-ref]");if(D?.dataset.docxNoteScope){H.preventDefault(),m(),s(null),n.setActiveScope({kind:"note",id:D.dataset.docxNoteScope});return}k.closest("[data-docx-note-mark-back]")&&(H.preventDefault(),m(),s(null),n.setActiveScope({kind:"body"}));},N=H=>{let k=H,I=k.target?.closest("[data-docx-note-scope]");I?.dataset.docxNoteScope&&(k.preventDefault(),s({scopeId:I.dataset.docxNoteScope,x:k.clientX,y:k.clientY}));},F=H=>{if(iC())return;let D=H.target?.closest("[data-docx-note-ref]");if(!D?.dataset.docxNoteScope){m();return}let I=D.dataset.docxNoteScope,z=n.getNotePreviewText(I)??D.getAttribute("aria-description")??t("notes.previewFallback"),Z=D.getBoundingClientRect();d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{a({scopeId:I,text:z,x:Z.left,y:Z.bottom+4});},400);};return E.addEventListener("click",w),E.addEventListener("contextmenu",N),E.addEventListener("pointerover",F),E.addEventListener("scroll",m,true),()=>{E.removeEventListener("click",w),E.removeEventListener("contextmenu",N),E.removeEventListener("pointerover",F),E.removeEventListener("scroll",m,true),m();}},[n,m,t]);let g=Ye.useCallback(E=>{n&&(n.exec(E),s(null));},[n]),u=i?Xp(i.scopeId):null,h=Ye.useMemo(()=>u?{type:"deleteNote",noteKind:u.noteKind,noteId:u.noteId}:null,[u]),b=Ye.useMemo(()=>u?{type:"convertNote",fromKind:u.noteKind,noteId:u.noteId}:null,[u]),v=Ye.useMemo(()=>u?{type:"convertAllNotes",fromKind:u.noteKind}:null,[u]),C=Os(h??{type:"deleteNote",noteKind:"footnote",noteId:0}),P=Os(b??{type:"convertNote",fromKind:"footnote",noteId:0}),S=Os(v??{type:"convertAllNotes",fromKind:"footnote"}),y=Ye.useMemo(()=>({position:"fixed",left:r?.x??0,top:r?.y??0,zIndex:Ve.popover,maxWidth:280,maxHeight:"40vh",overflowY:"auto",padding:"8px 10px",background:"var(--doc-popover-bg, #fff)",color:"var(--doc-popover-fg, #111)",border:"1px solid var(--doc-border, #ddd)",boxShadow:"var(--doc-shadow, 0 4px 16px rgba(0,0,0,.12))",fontSize:12,lineHeight:1.4,pointerEvents:"none"}),[r]),x=o?Xp(o.id):null,M=x?t("notes.editingRegion",{kind:x.noteKind==="footnote"?t("notes.footnoteKind"):t("notes.endnoteKind"),number:x.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&&x?jsxRuntime.jsxs("div",{ref:f.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:{...f.style,zIndex:Ve.chrome},children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:M}),jsxRuntime.jsx(lC,{onOpenProperties:()=>l(true),onClose:()=>n.setActiveScope({kind:"body"})})]}):null,r?jsxRuntime.jsx("div",{role:"tooltip","data-testid":"docx-notes-preview",style:y,onMouseDown:E=>{E.preventDefault(),E.stopPropagation();},children:r.text}):null,i&&u?jsxRuntime.jsxs("div",{role:"menu","data-testid":"docx-notes-menu",style:{position:"fixed",left:i.x,top:i.y,zIndex:Ve.popover,minWidth:160,background:"var(--doc-popover-bg, #fff)",border:"1px solid var(--doc-border, #ddd)",boxShadow:"var(--doc-shadow, 0 4px 16px rgba(0,0,0,.12))",padding:4},onMouseDown:O,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-delete",disabled:!C.enabled,title:C.reason??void 0,onClick:()=>h&&g(h),children:t("notes.delete")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-convert",disabled:!P.enabled,title:P.reason??void 0,onClick:()=>b&&g(b),children:u.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:()=>v&&g(v),children:u.noteKind==="footnote"?t("notes.convertAllFootnotes"):t("notes.convertAllEndnotes")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",onClick:()=>l(true),children:t("dialogs.footnoteProperties.title")})]}):null,c?jsxRuntime.jsx(sC,{onClose:()=>l(false),onApply:E=>{g(E),l(false);}}):null]}):null}function sC(e){let{t}=_(),n=A(),o=Fs(),[r,a]=Ye.useState("document"),[i,s]=Ye.useState("decimal"),[c,l]=Ye.useState("continuous"),[d,p]=Ye.useState("pageBottom"),[f,m]=Ye.useState("decimal"),[g,u]=Ye.useState("continuous"),[h,b]=Ye.useState("docEnd");Ye.useEffect(()=>{o&&(s(o.footnote.resolved.numFmt),l(o.footnote.resolved.numRestart),p(o.footnote.resolved.pos),m(o.endnote.resolved.numFmt),u(o.endnote.resolved.numRestart),b(o.endnote.resolved.pos));},[o]);let v=!o?.footnote.documentAuthored&&!o?.footnote.sectionAuthored,C=!o?.endnote.documentAuthored&&!o?.endnote.sectionAuthored;return jsxRuntime.jsx("div",{className:"docx-note-properties",role:"dialog","aria-modal":"true","aria-label":t("dialogs.footnoteProperties.title"),"data-testid":"docx-notes-properties-dialog",style:{zIndex:Ve.modal},onClick:e.onClose,onKeyDown:P=>{P.key==="Escape"&&e.onClose();},children:jsxRuntime.jsxs("div",{className:"docx-note-properties__panel",onClick:P=>P.stopPropagation(),onMouseDown:P=>P.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:P=>a(P.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")}),v?jsxRuntime.jsx("span",{className:"docx-note-properties__badge",children:t("notes.inheritedValue")}):null]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__fields",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numberFormat")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:i,onChange:P=>s(P.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:P=>l(P.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:P=>p(P.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")}),C?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:f,onChange:P=>m(P.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:g,onChange:P=>u(P.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:h,"data-testid":"docx-notes-endnote-position",onChange:P=>b(P.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 P={type:"setNoteProperties",scope:r,sectionIndex:r==="section"?o?.sectionIndex:void 0,footnote:{numFmt:i,numRestart:c,position:d},endnote:{numFmt:f,numRestart:g,position:h}};n.can(P).ok&&e.onApply(P);},children:t("common.apply")})]})]})})}var Ua=Ye.createContext({close:()=>{},anchor:null,tocId:null,target:null,clipboardRefusal:null,reportClipboardRefusal:()=>{}});function po(){return Ye.useContext(Ua)}function Jp(){return Ye.useContext(Ua).target}var em=["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"],tm=["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"],om=["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h168q13-36 43.5-58t68.5-22q38 0 68.5 22t43.5 58h168q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560h-80v120H280v-120h-80v560Zm280-560q17 0 28.5-11.5T520-800q0-17-11.5-28.5T480-840q-17 0-28.5 11.5T440-800q0 17 11.5 28.5T480-760Z"],nm=["M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"],rm=["M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"],am=["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"],im=["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 Ga(e,t,n){return Object.assign(({icon:r,labelKey:a,shortcutKey:i,className:s,hidden:c})=>{let l=A(),{close:d}=po(),p=Oe(),{isEnabled:f,disabledReason:m}=ne(t);return c?null:jsxRuntime.jsx(Le,{slot:e,icon:r??te(n.paths),shortcut:p(i??n.shortcutKey),disabled:!f,...m?{title:m}:{},onSelect:()=>{l?.exec(t),d(true);},...s?{className:s}:{},children:p(a??n.labelKey)})},{docxRow:e})}var mr=Ga("edit.cut",{type:"cut"},{labelKey:"contextMenu.cut",shortcutKey:"contextMenu.cutShortcut",paths:em}),fr=Ga("edit.copy",{type:"copy"},{labelKey:"contextMenu.copy",shortcutKey:"contextMenu.copyShortcut",paths:tm}),gr=Ga("edit.delete",{type:"deleteText"},{labelKey:"contextMenu.delete",shortcutKey:"contextMenu.deleteShortcut",paths:nm}),br=Ga("edit.selectAll",{type:"selectAll"},{labelKey:"contextMenu.selectAll",shortcutKey:"contextMenu.selectAllShortcut",paths:im});function Wo({icon:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let a=A(),{close:i,clipboardRefusal:s,reportClipboardRefusal:c}=po(),l=Oe(),d=Ye.useMemo(()=>({type:"paste",text:" "}),[]),{isEnabled:p,disabledReason:f}=ne(d);if(r)return null;let m=s!==null;return jsxRuntime.jsx(Le,{slot:"edit.paste",icon:e??te(om),shortcut:l(n??"contextMenu.pasteShortcut"),disabled:!p||m,...s??f?{title:s??f??""}:{},onSelect:()=>{(async()=>{try{let g=await navigator.clipboard.readText();g&&a?.exec({type:"paste",text:g});}catch(g){c(g instanceof Error?g.message:"the clipboard is not readable");}finally{i(true);}})();},...o?{className:o}:{},children:l(t??"contextMenu.paste")})}Wo.docxRow="edit.paste";function mo(e,t,n){return Object.assign(({icon:r,labelKey:a,className:i,hidden:s,destructive:c})=>{let{close:l}=po(),d=Oe(),p=ja(),{isEnabled:f,disabledReason:m,execute:g}=ne(t);return s||!p?null:jsxRuntime.jsx(Le,{slot:e,icon:r??te(n.paths),disabled:!f,...m?{title:m}:{},className:`${c??n.destructive?"docx-table-chrome__destructive-row":""}${i?` ${i}`:""}`,onSelect:()=>{g()&&l(true);},children:d(a??n.labelKey)})},{docxRow:e})}var Uo=mo("table.insertRowAbove",{type:"insertRow",where:"above"},{labelKey:"table.insertRowAbove",paths:editor.tableChromeIconPaths("table_rows")}),Go=mo("table.insertRowBelow",{type:"insertRow",where:"below"},{labelKey:"table.insertRowBelow",paths:editor.tableChromeIconPaths("table_rows")}),Yo=mo("table.insertColumnLeft",{type:"insertColumn",where:"left"},{labelKey:"table.insertColumnLeft",paths:editor.tableChromeIconPaths("view_column")}),Xo=mo("table.insertColumnRight",{type:"insertColumn",where:"right"},{labelKey:"table.insertColumnRight",paths:editor.tableChromeIconPaths("view_column")}),jo=mo("table.deleteRow",{type:"deleteRow"},{labelKey:"table.deleteRow",paths:editor.tableChromeIconPaths("delete_sweep"),destructive:true}),Qo=mo("table.deleteColumn",{type:"deleteColumn"},{labelKey:"table.deleteColumn",paths:editor.tableChromeIconPaths("view_column"),destructive:true}),Jo=mo("table.deleteTable",{type:"deleteTable"},{labelKey:"table.deleteTable",paths:editor.tableChromeIconPaths("delete"),destructive:true}),uC=[{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 fo({hidden:e}){let{close:t}=po(),n=Oe(),o=ja(),r=ne({type:"setTableCellVerticalAlignment",alignment:"top"}),a=ne({type:"setTableCellVerticalAlignment",alignment:"center"}),i=ne({type:"setTableCellVerticalAlignment",alignment:"bottom"}),s=[r,a,i];return e||!o?null:jsxRuntime.jsxs("div",{className:"docx-contextmenu__table-align",children:[jsxRuntime.jsx("span",{className:"docx-contextmenu__table-align-label",children:n("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{className:"docx-contextmenu__table-align-buttons",role:"group","aria-label":n("tableAdvanced.verticalAlignment"),children:uC.map((c,l)=>{let d=s[l];return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":false,"aria-label":n(c.labelKey),title:d.disabledReason??n(c.labelKey),"aria-disabled":!d.isEnabled,className:"docx-contextmenu__table-align-button",onMouseDown:p=>{p.preventDefault(),p.stopPropagation();},onClick:()=>{d.execute()&&t(true);},children:te(editor.tableChromeIconPaths(c.icon))},c.alignment)})})]})}fo.docxRow="table.cellVerticalAlignment";function sm(e,t,n){return Object.assign(({icon:r,labelKey:a,className:i,hidden:s})=>{let c=A(),{close:l,tocId:d}=po(),p=Oe(),f=Ye.useMemo(()=>({type:"refreshToc",mode:t,...d?{tocId:d}:{}}),[d]),{isEnabled:m,disabledReason:g}=ne(f);return s||d===null?null:jsxRuntime.jsx(Le,{slot:e,icon:r??te(n.paths),disabled:!m,...g?{title:g}:{},onSelect:()=>{c?.exec(f),l(true);},...i?{className:i}:{},children:p(a??n.labelKey)})},{docxRow:e})}var Ya=sm("toc.refresh","entire",{labelKey:"toc.refresh",paths:rm}),Xa=sm("toc.refreshPageNumbers","pageNumbers",{labelKey:"toc.refreshPageNumbers",paths:am});function ja(){return q(Ye.useCallback(e=>e.table!=null,[]),(e,t)=>e===t)}function Qa({label:e,icon:t,shortcut:n,disabled:o,disabledReason:r,active:a,onSelect:i,className:s}){let{close:c}=po();return jsxRuntime.jsx(Le,{...t?{icon:t}:{},...n?{shortcut:n}:{},...o?{disabled:o}:{},...o&&r?{title:r}:{},...a!==void 0?{active:a}:{},onSelect:()=>{i?.(),c(true);},...s?{className:s}:{},children:e})}var ti=8,fC=[{kind:"row",id:"edit.cut",render:()=>jsxRuntime.jsx(mr,{})},{kind:"row",id:"edit.copy",render:()=>jsxRuntime.jsx(fr,{})},{kind:"row",id:"edit.paste",render:()=>jsxRuntime.jsx(Wo,{})},{kind:"separator",id:"sep.clipboard"},{kind:"row",id:"edit.delete",render:()=>jsxRuntime.jsx(gr,{})},{kind:"row",id:"edit.selectAll",render:()=>jsxRuntime.jsx(br,{})},{kind:"separator",id:"sep.selection"},{kind:"row",id:"text.link",render:()=>jsxRuntime.jsx(gt,{slot:"text.link",labelKey:"formattingBar.insertLink"})},{kind:"row",id:"review.comments",render:()=>jsxRuntime.jsx(gt,{slot:"review.comments",labelKey:"comments.addComment"})}];function gC(){return [{kind:"separator",id:"sep.table"},{kind:"row",id:Uo.docxRow,render:()=>jsxRuntime.jsx(Uo,{})},{kind:"row",id:Go.docxRow,render:()=>jsxRuntime.jsx(Go,{})},{kind:"separator",id:"sep.table.columns"},{kind:"row",id:Yo.docxRow,render:()=>jsxRuntime.jsx(Yo,{})},{kind:"row",id:Xo.docxRow,render:()=>jsxRuntime.jsx(Xo,{})},{kind:"separator",id:"sep.table.destructive"},{kind:"row",id:jo.docxRow,render:()=>jsxRuntime.jsx(jo,{})},{kind:"row",id:Qo.docxRow,render:()=>jsxRuntime.jsx(Qo,{})},{kind:"row",id:Jo.docxRow,render:()=>jsxRuntime.jsx(Jo,{})},{kind:"separator",id:"sep.table.alignment"},{kind:"row",id:fo.docxRow,render:()=>jsxRuntime.jsx(fo,{})}]}function bC(){return [{kind:"separator",id:"sep.toc"},{kind:"row",id:Ya.docxRow,render:()=>jsxRuntime.jsx(Ya,{})},{kind:"row",id:Xa.docxRow,render:()=>jsxRuntime.jsx(Xa,{})}]}function hC(e,t=false){return [...fC,...e?gC():[],...t?bC():[]]}function mm(e){if(!Ye.isValidElement(e))return null;let t=No(e,mm);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 um(e){if(!Ye.isValidElement(e))return false;let t=e.type;return typeof t!="function"&&typeof t!="object"?false:t.docxRowPlacement==="start"}function vC(e){return e?.closest(".docx-editor__scroll-container")??null}function vr({className:e,t,preset:n=true,disabled:o,onOpenChange:r,children:a}){let i=Xe(),s=A(),{t:c}=_(),l=ja(),d=Ye.useRef(null),p=Ye.useRef(null),[f,m]=Ye.useState(null),[g,u]=Ye.useState(null),[h,b]=Ye.useState(null),v=Ye.useMemo(()=>hC(l,g!==null),[l,g]),[C,P]=Ye.useState(null),S=Ye.useCallback((H=false)=>{m(null),P(null),u(null),b(null),H&&s?.focus();},[s]);Ye.useEffect(()=>{if(o)return;let H=vC(d.current);if(!H)return;let k=D=>{D.preventDefault();let I=D.button===-1||D.clientX===0&&D.clientY===0,R=H.getBoundingClientRect();u(s?.snapshot().tocContext?.id??null),b(I||!(D.target instanceof HTMLElement)?null:D.target),m(I?{x:R.left+16,y:R.top+16}:{x:D.clientX,y:D.clientY});};return H.addEventListener("contextmenu",k),()=>H.removeEventListener("contextmenu",k)},[o,s]),Ye.useEffect(()=>{o&&S();},[o,S]),Ye.useEffect(()=>{if(!f)return;let H=I=>{p.current?.contains(I.target)||S();},k=I=>{I.key==="Escape"?(I.preventDefault(),S(true)):I.key==="Tab"&&S();},D=()=>S();return document.addEventListener("pointerdown",H,true),document.addEventListener("keydown",k),document.addEventListener("scroll",D,{capture:true,passive:true}),window.addEventListener("blur",D),window.addEventListener("resize",D),()=>{document.removeEventListener("pointerdown",H,true),document.removeEventListener("keydown",k),document.removeEventListener("scroll",D,true),window.removeEventListener("blur",D),window.removeEventListener("resize",D);}},[f,S]),Ye.useLayoutEffect(()=>{let H=p.current;if(!f||!H)return;let{width:k,height:D}=H.getBoundingClientRect(),I=window.innerWidth-k-ti,R=window.innerHeight-D-ti,z=Math.max(ti,f.x>I?f.x-k:f.x),Z=Math.max(ti,f.y>R?f.y-D:f.y);P({x:z,y:Z});},[f]),Ye.useLayoutEffect(()=>{C&&p.current?.focus({preventScroll:true});},[C]);let y=Ye.useRef(r);y.current=r;let x=Ye.useRef(false);Ye.useEffect(()=>{let H=f!==null;H!==x.current&&(x.current=H,y.current?.(H));},[f]);let M=Ye.useMemo(()=>({t,openMenu:null,setOpenMenu:()=>S(true),activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onReportIssue:void 0,reportIssue:void 0}),[t,S]),[E,w]=Ye.useState(null),N=Ye.useMemo(()=>({close:S,anchor:f,tocId:g,target:h,clipboardRefusal:E,reportClipboardRefusal:w}),[S,f,g,h,E]),F={position:"fixed",left:(C??f)?.x??0,top:(C??f)?.y??0,visibility:C?"visible":"hidden"};return jsxRuntime.jsx("div",{ref:d,style:{display:"contents"},children:f?jsxRuntime.jsx($n.Provider,{value:M,children:jsxRuntime.jsx(Ua.Provider,{value:N,children:jsxRuntime.jsxs("div",{ref:p,role:"menu","aria-label":t?.("contextMenu.ariaLabel")??c("contextMenu.ariaLabel"),tabIndex:-1,className:`${i}docx-toolbar__menu docx-contextmenu${e?` ${e}`:""}`,style:F,onKeyDown:H=>{let k=p.current;if(!k)return;let D=Jt(k);H.key==="ArrowDown"?(H.preventDefault(),at(D,document.activeElement,1)):H.key==="ArrowUp"?(H.preventDefault(),at(D,document.activeElement,-1)):H.key==="Home"?(H.preventDefault(),it(D,"first")):H.key==="End"&&(H.preventDefault(),it(D,"last"));},children:[Ye.Children.toArray(a).filter(um),Ur({entries:v,children:Ye.Children.toArray(a).filter(H=>!um(H)),preset:n,keyOfEntry:H=>H.id,keyOfChild:mm,renderEntry:H=>H.kind==="separator"?jsxRuntime.jsx(no,{}):H.render()})]})})}):null})}var qs=Object.assign(vr,{Cut:mr,Copy:fr,Paste:Wo,Delete:gr,SelectAll:br,InsertRowAbove:Uo,InsertRowBelow:Go,InsertColumnLeft:Yo,InsertColumnRight:Xo,DeleteTableRow:jo,DeleteTableColumn:Qo,DeleteTable:Jo,CellVerticalAlignment:fo,RefreshToc:Ya,RefreshTocPageNumbers:Xa,Item:Qa,Slot:gt,Row:Le,Group:Gn,Separator:no,Submenu:oo});function Ks(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var gm=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"})}),SC="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",CC="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",PC={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},EC={display:"flex",justifyContent:"space-between",gap:12,alignItems:"baseline"},wC={color:"var(--doc-text-muted)",flexShrink:0},MC={textAlign:"right",wordBreak:"break-word"},IC={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,fontWeight:600},kC={display:"flex",gap:8,marginTop:4},bm={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 RC(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 _C(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 en({label:e,value:t,testId:n}){return jsxRuntime.jsxs("div",{style:EC,"data-testid":n,children:[jsxRuntime.jsx("span",{style:wC,children:e}),jsxRuntime.jsx("span",{style:MC,children:t})]})}function NC({className:e,asChild:t,hidden:n,children:o,preset:r=true}){let a=pt(),i=Ye.useRef(null),s=Ye.useId(),{t:c}=_(),{control:l,inspectorOpen:d,closeInspector:p}=a;if(Ye.useEffect(()=>{if(!d)return;let u=b=>{b.key==="Escape"&&(b.preventDefault(),p());},h=b=>{let v=i.current;v&&b.target instanceof Node&&v.contains(b.target)||p();};return document.addEventListener("keydown",u),document.addEventListener("mousedown",h,true),()=>{document.removeEventListener("keydown",u),document.removeEventListener("mousedown",h,true);}},[d,p]),Ye.useEffect(()=>{d&&!l&&p();},[d,l,p]),n||!d||!l)return null;let f=r?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(hm,{}),jsxRuntime.jsx(vm,{}),jsxRuntime.jsx("div",{style:kC,children:jsxRuntime.jsx(ym,{})}),o]}):o,m={ref:i,role:"dialog","aria-modal":false,"aria-labelledby":s,"data-testid":"content-control-inspector","data-control-id":l.id,"data-control-type":l.controlType,...l.locked?{"data-locked":""}:{},...l.bound?{"data-bound":""}:{},...l.placeholder?{"data-placeholder":""}:{},className:`docx-content-control-inspector${e?` ${e}`:""}`,style:PC,onMouseDown:u=>{Ks(u),u.stopPropagation();}},g=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{id:s,className:"docx-editor-sr-only",children:c("contentControl.inspectorPanel.title")}),f]});return t?jsxRuntime.jsx(W,{...m,children:g}):jsxRuntime.jsx("div",{...m,children:g})}function hm({className:e,asChild:t,hidden:n,children:o}){let{closeInspector:r}=pt(),{t:a}=_();if(n)return null;let i={style:IC,className:e??void 0,"data-testid":"content-control-inspector-header"},s=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{children:o??a("contentControl.inspectorPanel.title")}),jsxRuntime.jsx("button",{type:"button","data-testid":"content-control-inspector-close","aria-label":a("common.close"),title:a("common.close"),style:{...bm,padding:4,border:"none",background:"transparent"},onMouseDown:Ks,onClick:()=>r(),children:gm(SC)})]});return t?jsxRuntime.jsx(W,{...i,children:s}):jsxRuntime.jsx("div",{...i,children:s})}function vm({className:e,asChild:t,hidden:n,children:o}){let{control:r}=pt(),{t:a}=_();if(n||!r)return null;let i=a("contentControl.inspectorPanel.empty"),s=a("contentControl.inspectorPanel.yes"),c=a("contentControl.inspectorPanel.no"),l=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(en,{label:a("contentControl.inspectorPanel.alias"),value:r.alias??i,testId:"content-control-inspector-alias"}),jsxRuntime.jsx(en,{label:a("contentControl.inspectorPanel.tag"),value:r.tag??i,testId:"content-control-inspector-tag"}),jsxRuntime.jsx(en,{label:a("contentControl.inspectorPanel.type"),value:a(RC(r.controlType)),testId:"content-control-inspector-type"}),jsxRuntime.jsx(en,{label:a("contentControl.inspectorPanel.lock"),value:a(_C(r)),testId:"content-control-inspector-lock"}),jsxRuntime.jsx(en,{label:a("contentControl.inspectorPanel.placeholder"),value:r.placeholder?s:c,testId:"content-control-inspector-placeholder"}),jsxRuntime.jsx(en,{label:a("contentControl.inspectorPanel.bound"),value:r.bound?s:c,testId:"content-control-inspector-bound"}),r.bound?jsxRuntime.jsx("p",{"data-testid":"content-control-inspector-bound-note",style:{margin:0,color:"var(--doc-text-muted)",fontSize:12},children:a("contentControl.inspectorPanel.boundNote")}):null,r.locked?jsxRuntime.jsx("p",{"data-testid":"content-control-inspector-locked-note",style:{margin:0,color:"var(--doc-text-muted)",fontSize:12},"aria-live":"polite",children:a("contentControl.inspectorPanel.lockedNote")}):null]}),d={className:e??void 0,"data-testid":"content-control-inspector-fields",style:{display:"flex",flexDirection:"column",gap:8}};return t?jsxRuntime.jsx(W,{...d,children:l}):jsxRuntime.jsx("div",{...d,children:l})}function ym({className:e,asChild:t,hidden:n,icon:o,children:r}){let{canRemove:a,removeDisabledReason:i,remove:s,closeInspector:c}=pt(),{t:l}=_();if(n)return null;let d=l("contentControl.remove"),p={type:"button",className:`docx-content-control-inspector__remove${e?` ${e}`:""}`,"data-testid":"content-control-inspector-remove","data-slot":"contentControl.remove",disabled:!a,...a?{}:{"data-disabled":""},"aria-label":d,title:i??d,style:bm,onMouseDown:Ks,onClick:()=>{s().ok&&c();}},f=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o??r??gm(CC),jsxRuntime.jsx("span",{children:d})]});return t?jsxRuntime.jsx(W,{...p,children:f}):jsxRuntime.jsx("button",{...p,children:f})}var oi=Object.assign(NC,{Header:hm,Fields:vm,Remove:ym});var FC={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg)"},AC={flex:1,minHeight:0,minWidth:0,overflowAnchor:"none"},OC={position:"relative",display:"flex",flex:1,minHeight:0,minWidth:0},ZC={display:"flex",justifyContent:"center",flex:"none",minHeight:34,padding:"6px 0 2px",overflow:"hidden",backgroundColor:"var(--doc-bg)"},BC={position:"absolute",top:40,left:0,zIndex:10,pointerEvents:"none"},qC={flex:"none",display:"flex",flexDirection:"column",position:"relative",zIndex:30,backgroundColor:"var(--doc-surface)",borderBottomWidth:1,borderBottomStyle:"solid",borderBottomColor:"var(--doc-border)",boxShadow:"0 1px 3px var(--doc-shadow-subtle)"},KC={padding:"8px 12px"},zC={display:"flex",alignItems:"center",gap:8,padding:"8px 12px 0",color:"var(--doc-text)"},VC={display:"flex",flexDirection:"column",flex:1,minWidth:0,gap:2},$C={flex:1,minWidth:0,font:"inherit",color:"inherit",backgroundColor:"transparent",border:"1px solid transparent",borderRadius:4,padding:"2px 6px"};function WC({forwardedRef:e}){let t=A(),n=Ye.useRef(null);return n.current=t,Uc({ref:e,editorRef:n}),null}var UC=Ye.forwardRef(function(t,n){let{document:o,fonts:r,className:a,t:i,chrome:s=true,title:c,onTitleChange:l,renderTitleBarLeft:d,renderTitleBarRight:p,colorMode:f="light",author:m,locale:g,mode:u,modules:h,zoom:b,zoomMode:v,onReady:C,onChange:P,onFontError:S,onOpen:y,onSave:x,hyperlinkPopup:M,contextMenu:E=true,menu:w=true,navigation:N=true,rulers:F=true}=t,[H,k]=Ye.useState(fc);Ye.useEffect(()=>{if(f==="system")return bc(k)},[f]);let D=gc(f,H),{t:I}=_(),R=Ye.useCallback((Q,Me)=>i?i(Q,Me):I(Q,Me),[i,I]),z=jsxRuntime.jsxs(zr,{className:s?D?"dark":void 0:a,style:s?AC:void 0,children:[s?jsxRuntime.jsx(za,{}):null,s?jsxRuntime.jsx(Wa,{}):null,jsxRuntime.jsx(Fr,{}),jsxRuntime.jsx($a,{hidden:M===false}),E===false?null:jsxRuntime.jsx(vr,{t:R,...typeof E=="object"?E:{}}),jsxRuntime.jsx(oi,{}),F&&s?jsxRuntime.jsx("div",{style:BC,"aria-hidden":"true",children:jsxRuntime.jsx(Ra,{})}):null,t.children]}),Z=s?jsxRuntime.jsxs("div",{className:`docx-editor${D?" dark":""}${a?` ${a}`:""}`,style:FC,children:[jsxRuntime.jsxs("div",{style:qC,children:[jsxRuntime.jsxs("div",{style:zC,children:[d?.(),jsxRuntime.jsxs("div",{style:VC,children:[l?jsxRuntime.jsx("input",{"aria-label":R("titleBar.documentNameAriaLabel"),value:c??"",placeholder:R("titleBar.untitled"),onChange:Q=>l(Q.target.value),style:$C}):jsxRuntime.jsx("span",{style:{minWidth:0,padding:"2px 6px"},children:c??R("titleBar.untitled")}),w!==false?jsxRuntime.jsx(jn,{t:R,...c!==void 0?{fileName:c}:{},...y?{onOpen:y}:{},...x?{onSave:x}:{},...typeof w=="object"?w:{}}):null]}),p?.()]}),jsxRuntime.jsx("div",{style:KC,children:jsxRuntime.jsx(zn,{t:R})})]}),F?jsxRuntime.jsx("div",{style:ZC,children:jsxRuntime.jsx(ka,{})}):null,jsxRuntime.jsx(Ba,{t:R}),jsxRuntime.jsxs("div",{style:OC,children:[N?jsxRuntime.jsx(Za,{t:R}):null,z,jsxRuntime.jsx(Ts.Provider,{value:R,children:jsxRuntime.jsx(Ss,{})})]})]}):z,$=Ye.useCallback(Q=>R(Q),[R]);return jsxRuntime.jsxs(qr,{...o!==void 0?{document:o}:{},...r?{fonts:r}:{},...m!==void 0?{author:m}:{},...g!==void 0?{locale:g}:{},translate:R,...u!==void 0?{mode:u}:{},...h!==void 0?{modules:h}:{},...b!==void 0?{zoom:b}:{},...v!==void 0?{zoomMode:v}:{},tableInteractionLabel:$,...C?{onReady:C}:{},...P?{onChange:P}:{},...S?{onFontError:S}:{},children:[jsxRuntime.jsx(WC,{forwardedRef:n}),jsxRuntime.jsx(Qt.Provider,{value:s,children:Z})]})}),GC=Ye.forwardRef(function(t,n){return jsxRuntime.jsx(wo,{...t.i18n!==void 0?{i18n:t.i18n}:{},children:jsxRuntime.jsx(UC,{...t,ref:n})})}),YC=Object.assign(GC,{Root:qr,Viewport:zr,Content:Fr,Toolbar:zn,Menu:jn,Loading:Ai,HorizontalRuler:ka,VerticalRuler:Ra,DocumentOutline:ms,Navigation:Za,PageSetupDialog:Vn,PageNumber:Ss,FontNotice:Ba,HeaderFooterChrome:za,NotesChrome:Wa,HyperLink:$a,ContextMenu:qs,ContentControl:oi});function QC(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}async function JC(e){return typeof e=="function"?e():e}function eP(e,t={}){let[n,o]=Ye.useState(void 0),[r,a]=Ye.useState(void 0),[i,s]=Ye.useState(null),[c,l]=Ye.useState(e!=null),[d,p]=Ye.useState(t.fonts===void 0),f=Ye.useRef(t);return f.current=t,Ye.useEffect(()=>{let m=f.current.fonts;if(m===void 0)return;let g=true;return (async()=>{try{let u=await JC(m);g&&a(editor.composeFontConfiguration(u));}catch{}finally{g&&p(true);}})(),()=>{g=false;}},[]),Ye.useEffect(()=>{if(e==null){o(void 0),s(null),l(false);return}let m=QC(e);if(m){o(m),s(null),l(false);return}let g=true,u=new AbortController;return l(true),s(null),(async()=>{try{let h=await fetch(String(e),{...f.current.fetchOptions,signal:u.signal});if(!h.ok)throw new Error(`could not open the document: ${h.status} ${h.statusText}`);let b=new Uint8Array(await h.arrayBuffer());if(!g)return;o(b),l(!1);}catch(h){if(!g||h instanceof Error&&h.name==="AbortError")return;s(h instanceof Error?h:new Error("could not open the document")),l(false);}})(),()=>{g=false,u.abort();}},[e]),{document:d?n:void 0,fonts:r,error:i,isLoading:c||!d}}function rP(e,...t){let n=Ye.useRef({source:e,fragments:t});return n.current={source:e,fragments:t},Ye.useMemo(()=>async o=>{let r=n.current,i=[typeof r.source=="function"?await r.source(o):await r.source,...r.fragments].filter(l=>l!==void 0);if(i.length===0)return;let{epoch:s,...c}=editor.composeFontConfiguration(i[0],...i.slice(1));return c},[])}function lP(e){let n=e?.surface?.state?.().selection?.head;return n&&typeof n.paragraphId=="string"&&Number.isFinite(n.offset)?n:null}function sP(){let e=A(),t=Ye.useRef(null),n=Ye.useCallback(r=>{if(!e)return ()=>{};let a=e.on("selectionChange",r),i=e.on("change",r);return ()=>{a(),i();}},[e]),o=Ye.useCallback(()=>{let r=lP(e),a=t.current;return (r===null?a===null:a!==null&&cP(a,r))?a:(t.current=r,r)},[e]);return Ye.useSyncExternalStore(n,o,()=>null)}function cP(e,t){return e.paragraphId===t.paragraphId&&e.offset===t.offset}function zs({source:e,scale:t,measurer:n,onStateChange:o,onError:r,className:a,documentFontFamily:i,ref:s}){let c=Ye.useRef(null),l=Ye.useRef(null),[d,p]=Ye.useState(null),f=Ye.useRef(o);f.current=o;let m=Ye.useRef(r);return m.current=r,Ye.useEffect(()=>{let g=c.current;if(!g)return;let u=editor.mountPaginatedSurface(g,e,{...t===void 0?{}:{scale:t},...n?{measurer:n}:{},onChange:b=>{p(b),f.current?.(b);}});if(!u.ok){m.current?.(u.reason,u.detail);return}l.current=u.surface;let h=u.surface.state();return p(h),f.current?.(h),()=>{u.surface.destroy(),l.current=null;}},[e,n]),Ye.useImperativeHandle(s,()=>({focus:()=>l.current?.focus(),type:g=>l.current?.type(g),undo:()=>l.current?.undo(),redo:()=>l.current?.redo(),selectAll:()=>l.current?.selectAll(),navigate:(g,u)=>l.current?.navigate(g,u),toggleRunProperty:(g,u)=>l.current?.toggleRunProperty(g,u),setRunProperty:(g,u)=>l.current?.setRunProperty(g,u),setParagraphProperty:(g,u)=>l.current?.setParagraphProperty(g,u),formatting:()=>l.current?.formatting()??null,sectionProperties:()=>l.current?.sectionProperties()??null,save:()=>l.current?.session.save()??null}),[]),jsxRuntime.jsx("div",{ref:c,style:{margin:"24px auto",...i?{fontFamily:i}:{}},className:a?`docx-paginated-surface ${a}`:"docx-paginated-surface","data-revision":d?.revision??0,"data-page-count":d?.pageCount??0})}var Tr=Ye.createContext(null);function Pm(){let e=Ye.useContext(Tr);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}function vP(e){return "type"in e&&e.type==="separator"}var Mm={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"},yP={...Mm,background:"var(--doc-bg-hover)"},Im={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"},xP={...Im,opacity:.4,cursor:"default"},TP={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},SP={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted)"},CP={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 Sr({label:e,items:t,disabled:n,showChevron:o=false}){let[r,a]=Ye.useState(false),[i,s]=Ye.useState(null),c=Ye.useRef(null),l=Ye.useRef(null),[d,p]=Ye.useState({top:0,left:0}),f=Ye.useCallback(()=>{a(false),s(null);},[]);Ye.useEffect(()=>{if(!r||!c.current)return;let g=c.current.getBoundingClientRect();p({top:g.bottom+2,left:g.left});},[r]),Ye.useEffect(()=>{if(!r)return;function g(b){let v=b.target;c.current&&!c.current.contains(v)&&l.current&&!l.current.contains(v)&&f();}function u(b){b.key==="Escape"&&f();}function h(){f();}return document.addEventListener("mousedown",g),document.addEventListener("keydown",u),window.addEventListener("scroll",h,true),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",u),window.removeEventListener("scroll",h,true);}},[r,f]);let m=g=>{g.disabled||g.submenuContent||g.onClick&&(g.onClick(),f());};return jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:c,type:"button",onClick:()=>!n&&a(!r),onMouseDown:g=>g.preventDefault(),disabled:n,style:r?yP:Mm,children:[e,o&&jsxRuntime.jsx(K,{name:"arrow_drop_down",size:16})]}),r&&jsxRuntime.jsx("div",{ref:l,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:g=>g.preventDefault(),children:t.map((g,u)=>{if(vP(g))return jsxRuntime.jsx("div",{style:TP},`sep-${u}`);let h=g;if(h.customContent)return jsxRuntime.jsx("div",{onMouseDown:C=>C.preventDefault(),children:h.customContent},h.label);let b=!!h.submenuContent,v=i===h.label;return jsxRuntime.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>b&&s(h.label),onMouseLeave:()=>b&&s(null),children:[jsxRuntime.jsxs("button",{type:"button",style:h.disabled?xP:Im,onClick:()=>m(h),onMouseDown:C=>C.preventDefault(),onMouseOver:C=>{h.disabled||(C.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:C=>{C.currentTarget.style.backgroundColor="transparent";},disabled:h.disabled,children:[h.icon&&jsxRuntime.jsx(K,{name:h.icon,size:18}),jsxRuntime.jsx("span",{children:h.label}),h.shortcut&&jsxRuntime.jsx("span",{style:SP,children:h.shortcut}),b&&jsxRuntime.jsx("span",{style:{marginLeft:"auto"},children:jsxRuntime.jsx(K,{name:"keyboard_arrow_right",size:16})})]}),b&&v&&jsxRuntime.jsx("div",{style:CP,onMouseDown:C=>C.preventDefault(),children:h.submenuContent(f)})]},h.label)})})]})}var Ws=18,EP=2,Rm={width:Ws,height:Ws,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},wP={...Rm,backgroundColor:"var(--doc-primary)",border:"1px solid var(--doc-primary)"},MP={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text)",textAlign:"center"};function _m({onInsert:e,gridRows:t=6,gridColumns:n=6}){let[o,r]=Ye.useState(0),[a,i]=Ye.useState(0),s=Ye.useCallback(()=>{o>0&&a>0&&e(o,a);},[o,a,e]),c=[];for(let d=1;d<=t;d++)for(let p=1;p<=n;p++){let f=d<=o&&p<=a;c.push(jsxRuntime.jsx("div",{style:f?wP:Rm,onMouseEnter:()=>{r(d),i(p);},onClick:s,role:"gridcell","aria-selected":f},`${d}-${p}`));}let l=o>0&&a>0?`${a} \xD7 ${o}`:"Select size";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{display:"grid",gap:EP,gridTemplateColumns:`repeat(${n}, ${Ws}px)`},onMouseLeave:()=>{r(0),i(0);},role:"grid","aria-label":"Table size selector",children:c}),jsxRuntime.jsx("div",{style:MP,children:l})]})}function _P({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 NP(){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 ai({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function DP(e){return e.replace(/\.docx$/i,"")}function Gs({value:e,onChange:t,placeholder:n,editable:o=true}){let{t:r}=_(),a=n??r("titleBar.untitled"),i=DP(e)??"";return o?jsxRuntime.jsx("input",{type:"text",value:i,onChange:s=>{let c=s.target.value;t?.(c.endsWith(".docx")?c:c+".docx");},placeholder:a,className:"text-base font-normal text-foreground bg-transparent border-0 outline-none px-2 py-0 rounded hover:bg-muted focus:bg-doc-bg-input focus:ring-1 focus:ring-ring min-w-[100px] max-w-[300px] truncate leading-tight","aria-label":r("titleBar.documentNameAriaLabel")}):jsxRuntime.jsx("span",{className:"text-base font-normal text-foreground px-2 py-0 min-w-[100px] max-w-[300px] truncate leading-tight",children:i||a})}function ii({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function li(){let{t:e}=_(),t=Pm(),{disabled:n=false,onFormat:o,onPrint:r,onOpen:a,onSave:i,onPageSetup:s,onInsertImage:c,onInsertTable:l,showTableInsert:d=true,showHelpMenu:p=true,onInsertPageBreak:f,onInsertSectionBreakNextPage:m,onInsertSectionBreakContinuous:g,onInsertTOC:u,onWatermark:h,onRefocusEditor:b}=t,v=Ye.useCallback(y=>{!n&&o&&o(y);},[n,o]),C=Ye.useCallback((y,x)=>{!n&&l&&(l(y,x),requestAnimationFrame(()=>b?.()));},[n,l,b]),P=!!r||!!s,S=P||a||i;return jsxRuntime.jsxs("div",{className:"flex items-center",role:"menubar","aria-label":e("titleBar.menuBarAriaLabel"),children:[S&&jsxRuntime.jsx(Sr,{label:e("toolbar.file"),disabled:n,items:[...a?[{icon:"file_upload",label:e("toolbar.open"),shortcut:e("toolbar.openShortcut"),onClick:a}]:[],...i?[{icon:"file_download",label:e("toolbar.save"),shortcut:e("toolbar.saveShortcut"),onClick:i}]:[],...(a||i)&&P?[{type:"separator"}]:[],...r?[{icon:"print",label:e("toolbar.print"),shortcut:e("toolbar.printShortcut"),onClick:r}]:[],...s?[{icon:"settings",label:e("toolbar.pageSetup"),onClick:s}]:[]]}),jsxRuntime.jsx(Sr,{label:e("toolbar.format"),disabled:n,items:[{icon:"format_textdirection_l_to_r",label:e("toolbar.leftToRight"),onClick:()=>v("setLtr")},{icon:"format_textdirection_r_to_l",label:e("toolbar.rightToLeft"),onClick:()=>v("setRtl")}]}),jsxRuntime.jsx(Sr,{label:e("toolbar.insert"),disabled:n,items:[...c?[{icon:"image",label:e("toolbar.image"),onClick:c}]:[],...d&&l?[{icon:"grid_on",label:e("toolbar.table"),submenuContent:y=>jsxRuntime.jsx(_m,{onInsert:(x,M)=>{C(x,M),y();}})}]:[],...c||d&&l?[{type:"separator"}]:[],{icon:"page_break",label:e("toolbar.break"),submenuContent:y=>jsxRuntime.jsx(_P,{closeMenu:y,items:[{icon:"page_break",label:e("toolbar.pageBreak"),onClick:f},{icon:"horizontal_rule",label:e("toolbar.sectionBreakNextPage"),onClick:m},{icon:"border_horizontal",label:e("toolbar.sectionBreakContinuous"),onClick:g}]})},{icon:"format_list_numbered",label:e("toolbar.tableOfContents"),onClick:u,disabled:!u},...h?[{icon:"branding_watermark",label:e("toolbar.watermark"),onClick:h}]:[]]}),p&&jsxRuntime.jsx(Sr,{label:e("toolbar.help"),disabled:n,items:[{label:e("toolbar.reportIssue"),onClick:()=>Wn()}]})]})}function Ys({children:e}){let t=null,n=null,o=[],r=[];Ye.Children.forEach(e,i=>{Ye.isValidElement(i)&&(i.type===ai?t=i:i.type===ii?n=i:i.type===li?r.push(i):o.push(i));});let a=Ye.useCallback(i=>{let s=i.target;s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.tagName==="SELECT"||s.tagName==="OPTION"||i.preventDefault();},[]);return jsxRuntime.jsxs("div",{className:"flex items-stretch bg-doc-surface pt-2 pb-1",onMouseDown:a,"data-testid":"title-bar",children:[jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 pl-3 pr-1",children:t||jsxRuntime.jsx(NP,{})}),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 si={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},AP={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:""},Nm={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 OP(e,t){let n=Nm[t]??Nm[t.toLowerCase()]??t,r=e?.colorScheme?.[n];return typeof r=="string"&&r?r:si[n]??"000000"}function Dm(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 Xs(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex")return `#${Dm(e.value)??n}`;let o=Object.entries(t?.colorScheme??si).map(([a,i])=>({slot:a,hex:String(i)})),r=editor.resolveThemeColorHex(e,o);return `#${r.ok?r.hex:OP(t,e.slot)}`}function wt(e,t){if(!(!e||e.kind==="auto"))return e.kind==="hex"?Dm(e.value):Xs(e,t).slice(1)}function Lm(e){if(!e||e==="none")return "";let t=AP[e];return t?`#${t}`:""}var ZP=[{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"}],BP=[{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 Hm(e){let t=e??si;return BP.map(n=>ZP.map(o=>{let r=t[o.slot]??si[o.slot]??"000000",i={hex:n.type==="base"?r.toUpperCase():n.type==="tint"?editor.applyThemeTint(r,n.keep):editor.applyThemeShade(r,n.keep),themeSlot:o.slot,label:`${o.name}${n.labelSuffix}`};return n.type==="tint"?i.tint=n.keep:n.type==="shade"&&(i.shade=n.keep),i}))}function j(...e){return clsx.clsx(e)}var zP=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"}}),we=Ye__namespace.forwardRef(({className:e,variant:t,size:n,...o},r)=>jsxRuntime.jsx("button",{className:j(zP({variant:t,size:n,className:e})),ref:r,...o}));we.displayName="Button";function Je({content:e,children:t,side:n="bottom",delayMs:o=400}){let[r,a]=Ye__namespace.useState(false),[i,s]=Ye__namespace.useState({x:0,y:0}),c=Ye__namespace.useRef(null),l=Ye__namespace.useRef(null),d=Ye__namespace.useCallback(()=>{l.current=setTimeout(()=>{if(c.current){let g=c.current.getBoundingClientRect(),u=g.left+g.width/2,h=n==="top"?g.top-8:g.bottom+8;s({x:u,y:h});}a(true);},o);},[o,n]),p=Ye__namespace.useCallback(()=>{l.current&&(clearTimeout(l.current),l.current=null),a(false);},[]);Ye__namespace.useEffect(()=>()=>{l.current&&clearTimeout(l.current);},[]);let f=t.props,m=Ye__namespace.cloneElement(t,{ref:c,onMouseEnter:g=>{d(),f.onMouseEnter?.(g);},onMouseLeave:g=>{p(),f.onMouseLeave?.(g);}});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[m,r&&jsxRuntime.jsx("div",{className:"fixed z-50 px-2 py-1 text-xs font-medium text-white bg-foreground dark:bg-muted dark:text-foreground rounded-md shadow-lg",style:{left:i.x,top:i.y,transform:n==="top"?"translate(-50%, -100%)":n==="bottom"?"translate(-50%, 0)":void 0},children:e})]})}var qt=pe__namespace.Root,Kt=pe__namespace.Group,ci=pe__namespace.Value;function zt({className:e,children:t,onMouseDown:n,...o}){return jsxRuntime.jsxs(pe__namespace.Trigger,{className:j("flex h-8 items-center justify-between gap-1 rounded px-2 py-1","text-sm text-foreground bg-transparent","hover:bg-muted/80 focus:outline-none focus:bg-muted/80","disabled:cursor-not-allowed disabled:opacity-50","transition-colors duration-150","[&>span]:truncate",e),onMouseDown:r=>{r.preventDefault(),n?.(r);},...o,children:[t,jsxRuntime.jsx(pe__namespace.Icon,{asChild:true,children:jsxRuntime.jsx(GP,{className:"h-4 w-4 text-muted-foreground shrink-0"})})]})}function Vt({className:e,children:t,position:n="popper",onCloseAutoFocus:o,...r}){let a=typeof document<"u"&&!!document.querySelector(".docx-editor.dark");return jsxRuntime.jsx(pe__namespace.Portal,{children:jsxRuntime.jsx("div",{className:j("docx-editor",a&&"dark"),children:jsxRuntime.jsx(pe__namespace.Content,{className:j("relative z-50 max-h-72 min-w-[8rem] overflow-hidden","rounded-lg border border-border bg-popover text-popover-foreground shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",e),position:n,onCloseAutoFocus:i=>{i.preventDefault(),o?.(i);},...r,children:jsxRuntime.jsx(pe__namespace.Viewport,{className:j("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),onMouseDown:i=>i.preventDefault(),children:t})})})})}function bo({className:e,...t}){return jsxRuntime.jsx(pe__namespace.Label,{className:j("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...t})}function et({className:e,children:t,onMouseDown:n,...o}){return jsxRuntime.jsxs(pe__namespace.Item,{className:j("relative flex w-full cursor-pointer select-none items-center","rounded px-2 py-1.5 text-sm text-foreground outline-none","hover:bg-muted focus:bg-muted","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),onMouseDown:r=>{r.preventDefault(),n?.(r);},...o,children:[jsxRuntime.jsx(pe__namespace.ItemText,{children:t}),jsxRuntime.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(pe__namespace.ItemIndicator,{children:jsxRuntime.jsx(YP,{className:"h-4 w-4"})})})]})}function ho({className:e,...t}){return jsxRuntime.jsx(pe__namespace.Separator,{className:j("-mx-1 my-1 h-px bg-muted",e),...t})}function GP({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 YP({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 js(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 XP=[{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 Om({value:e,onChange:t,fonts:n=XP,documentFonts:o,disabled:r=false,className:a,placeholder:i="Arial",width:s=120,showPreview:c=true}){let{t:l}=_(),d=Ye__namespace.useMemo(()=>{if(!o)return [];let u=new Set(n.map(h=>h.name.toLowerCase()));return o.filter(h=>!u.has(h.name.toLowerCase()))},[o,n]),p=Ye__namespace.useMemo(()=>[...d,...n],[d,n]),f=Ye__namespace.useMemo(()=>e?p.find(h=>h.fontFamily===e||h.name.toLowerCase()===e.toLowerCase()||js(h.fontFamily).toLowerCase()===e.toLowerCase())?.name||e:i,[e,p,i]),m=Ye__namespace.useCallback(u=>{let h=p.find(b=>b.name===u);h&&t?.(js(h.fontFamily)||h.name);},[t,p]),g=Ye__namespace.useMemo(()=>{let u={"sans-serif":[],serif:[],monospace:[],other:[]};return n.forEach(h=>{let b=h.category||"other";u[b].push(h);}),u},[n]);return jsxRuntime.jsxs(qt,{value:f,onValueChange:m,disabled:r,children:[jsxRuntime.jsx(zt,{className:j("h-8 text-sm",a),style:{minWidth:typeof s=="number"?`${s}px`:s},"aria-label":l("font.selectAriaLabel"),children:jsxRuntime.jsx(ci,{placeholder:i,children:f})}),jsxRuntime.jsxs(Vt,{className:"max-h-[300px]",children:[d.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Kt,{children:[jsxRuntime.jsx(bo,{children:l("font.documentFonts")}),d.map(u=>jsxRuntime.jsx(et,{value:u.name,style:c?{fontFamily:u.fontFamily}:void 0,children:u.name},`doc-${u.name}`))]}),jsxRuntime.jsx(ho,{})]}),g["sans-serif"].length>0&&jsxRuntime.jsxs(Kt,{children:[jsxRuntime.jsx(bo,{children:l("font.sansSerif")}),g["sans-serif"].map(u=>jsxRuntime.jsx(et,{value:u.name,style:c?{fontFamily:u.fontFamily}:void 0,children:u.name},u.name))]}),g.serif.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ho,{}),jsxRuntime.jsxs(Kt,{children:[jsxRuntime.jsx(bo,{children:l("font.serif")}),g.serif.map(u=>jsxRuntime.jsx(et,{value:u.name,style:c?{fontFamily:u.fontFamily}:void 0,children:u.name},u.name))]})]}),g.monospace.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ho,{}),jsxRuntime.jsxs(Kt,{children:[jsxRuntime.jsx(bo,{children:l("font.monospace")}),g.monospace.map(u=>jsxRuntime.jsx(et,{value:u.name,style:c?{fontFamily:u.fontFamily}:void 0,children:u.name},u.name))]})]}),g.other.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ho,{}),jsxRuntime.jsx(Kt,{children:g.other.map(u=>jsxRuntime.jsx(et,{value:u.name,style:c?{fontFamily:u.fontFamily}:void 0,children:u.name},u.name))})]})]})]})}function Qs(e){if(e===void 0)return;let t=e.map(n=>typeof n=="string"?{name:n,fontFamily:n,category:"other"}:n);return t}function e1(e,t,n,o){let a=Math.max(8,window.innerWidth-n-8),i=Math.max(8,window.innerHeight-o-8);return {top:Math.min(Math.max(8,e),i),left:Math.min(Math.max(8,t),a)}}function $e({isOpen:e,onClose:t,align:n="left"}){let o=Ye.useRef(null),r=Ye.useRef(null),[a,i]=Ye.useState({top:0,left:0});Ye.useEffect(()=>{if(!e||!o.current)return;let l=o.current.getBoundingClientRect();n==="right"?requestAnimationFrame(()=>{if(r.current){let d=r.current.getBoundingClientRect(),p=e1(l.bottom+4,l.right-d.width,d.width,d.height);i(p);}else i({top:l.bottom+4,left:l.left});}):i({top:l.bottom+4,left:l.left});},[e,n]),Ye.useEffect(()=>{if(!e)return;let l=performance.now()+150,d=m=>{let g=m.target;o.current&&!o.current.contains(g)&&r.current&&!r.current.contains(g)&&t();},p=m=>{m.key==="Escape"&&t();},f=m=>{if(performance.now()<l)return;let g=m.target;g&&r.current&&r.current.contains(g)||g instanceof Element&&g!==document.documentElement&&g!==document.body&&o.current&&g.contains(o.current)||t();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",p),window.addEventListener("scroll",f,true),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",p),window.removeEventListener("scroll",f,true);}},[e,t]);let s=Ye.useCallback(l=>{l.preventDefault(),l.stopPropagation();},[]),c={position:"fixed",top:a.top,left:a.left,zIndex:1e4};return {containerRef:o,dropdownRef:r,dropdownStyle:c,handleMouseDown:s}}var n1=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],r1=1,a1=400;function qm(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function Km(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 zm({value:e,onChange:t,sizes:n=n1,disabled:o=false,className:r,placeholder:a="11",minSize:i=r1,maxSize:s=a1}){let{t:c}=_(),[l,d]=Ye.useState(false),[p,f]=Ye.useState(""),[m,g]=Ye.useState(false),u=Ye.useRef(null),h=Ye.useCallback(()=>{g(false),d(false);},[]),{containerRef:b,dropdownRef:v,dropdownStyle:C}=$e({isOpen:m,onClose:h}),P=e??(parseInt(a,10)||11),S=e!==void 0?e.toString():a,y=Ye.useCallback(k=>{if(k.preventDefault(),o)return;let D=Km(P,n,i);t?.(D);},[P,n,i,o,t]),x=Ye.useCallback(k=>{if(k.preventDefault(),o)return;let D=qm(P,n,s);t?.(D);},[P,n,s,o,t]),M=Ye.useCallback(k=>{k.preventDefault(),!o&&(d(true),f(S),g(true),requestAnimationFrame(()=>{u.current?.focus(),u.current?.select();}));},[o,S]),E=Ye.useCallback(k=>{f(k.target.value);},[]),w=Ye.useCallback(()=>{d(false);let k=parseFloat(p);if(!isNaN(k)&&k>=i&&k<=s){let D=Math.round(k*2)/2;t?.(D);}},[p,i,s,t]),N=Ye.useCallback(k=>{if(k.key==="Enter")k.preventDefault(),w(),g(false);else if(k.key==="Escape")d(false),g(false);else if(k.key==="ArrowUp"){k.preventDefault();let D=qm(P,n,s);f(D.toString()),t?.(D);}else if(k.key==="ArrowDown"){k.preventDefault();let D=Km(P,n,i);f(D.toString()),t?.(D);}},[w,P,n,s,i,t]),F=Ye.useCallback(k=>{t?.(k),g(false),d(false);},[t]),H=Ye.useCallback(k=>{k.target.tagName!=="INPUT"&&k.preventDefault();},[]);return jsxRuntime.jsxs("div",{ref:b,className:j("flex items-center",r),onMouseDown:H,children:[jsxRuntime.jsx(we,{variant:"ghost",size:"icon-sm",className:j("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",o&&"opacity-30 cursor-not-allowed"),onMouseDown:y,disabled:o||P<=i,"aria-label":c("fontSize.decrease"),"data-testid":"font-size-decrease",children:jsxRuntime.jsx(K,{name:"remove",size:18})}),jsxRuntime.jsx("div",{className:"relative",children:l?jsxRuntime.jsx("input",{ref:u,type:"text",value:p,onChange:E,onBlur:w,onKeyDown:N,className:j("h-7 w-10 text-center text-sm border border-input bg-doc-bg-input text-doc-text","focus:outline-none focus:ring-1 focus:ring-ring","rounded-none"),"aria-label":c("fontSize.label"),"data-testid":"font-size-input"}):jsxRuntime.jsx("button",{type:"button",onClick:M,className:j("h-7 w-10 text-center text-sm border border-border bg-doc-bg-input text-doc-text","hover:border-input hover:bg-doc-bg-hover","focus:outline-none focus:ring-1 focus:ring-ring","rounded-none",o&&"opacity-50 cursor-not-allowed"),disabled:o,"aria-label":c("fontSize.label"),"aria-haspopup":"listbox","aria-expanded":m,"data-testid":"font-size-display",children:S})}),m&&jsxRuntime.jsx("div",{ref:v,style:{...C,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",maxHeight:240,overflowY:"auto",minWidth:60},role:"listbox","aria-label":c("fontSize.listLabel"),children:n.map(k=>jsxRuntime.jsx("button",{type:"button",onClick:()=>F(k),className:j("w-full px-3 py-1.5 text-sm text-left","hover:bg-muted",k===P&&"bg-muted font-medium"),role:"option","aria-selected":k===P,children:k},k))}),jsxRuntime.jsx(we,{variant:"ghost",size:"icon-sm",className:j("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",o&&"opacity-30 cursor-not-allowed"),onMouseDown:x,disabled:o||P>=s,"aria-label":c("fontSize.increase"),"data-testid":"font-size-increase",children:jsxRuntime.jsx(K,{name:"add",size:18})})]})}var s1=[{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"}],ui=18,c1=2,d1={position:"relative",display:"inline-block"},u1={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)"},p1={padding:"10px",backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border-dark)",borderRadius:"6px",boxShadow:"0 4px 16px var(--doc-shadow)",width:"auto"},tc={fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px",fontWeight:500},oc={height:"1px",backgroundColor:"var(--doc-border)",margin:"8px 0"},Wm={display:"grid",gap:`${c1}px`},pi={width:`${ui}px`,height:`${ui}px`,border:"1px solid var(--doc-border-input)",borderRadius:"2px",cursor:"pointer",padding:0,transition:"transform 0.1s, border-color 0.1s"},Um={...pi,transform:"scale(1.15)",borderColor:"var(--doc-text)",zIndex:1},Gm={...pi,borderWidth:"2px",borderColor:"var(--doc-primary)",boxShadow:"0 0 0 1px var(--doc-primary)"},m1={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)"},f1={display:"flex",alignItems:"center",gap:"6px"},g1={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"12px"},b1={height:"24px",padding:"0 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",backgroundColor:"var(--doc-bg-subtle)",fontSize:"12px",cursor:"pointer"},Vm={width:"16px",height:"4px",borderRadius:"1px",marginTop:"-2px"},h1={display:"inline-flex",alignItems:"stretch",height:"32px",gap:"2px"},v1={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)"},y1={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 nc(e,t,n){if(!e)return t==="text"||t==="border"?"#000000":"transparent";if(typeof e=="string"){if(t==="highlight"){let o=Lm(e);return o||(e==="none"?"transparent":e.startsWith("#")?e:`#${e}`)}return e.startsWith("#")?e:`#${e}`}return Xs(e,n)}function $m(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 Ym(e,t,n){return e?(typeof e=="string"?e.replace(/^#/,"").toUpperCase():wt(e,n))===t.toUpperCase():false}function x1({matrix:e,selectedColor:t,theme:n,onSelect:o}){let[r,a]=Ye.useState(null);return jsxRuntime.jsx("div",{style:{...Wm,gridTemplateColumns:`repeat(10, ${ui}px)`},children:e.flatMap((i,s)=>i.map((c,l)=>{let d=`${s}-${l}`,p=r===d,f=Ym(t,c.hex,n);return jsxRuntime.jsx("button",{type:"button",style:{...f?Gm:p?Um:pi,backgroundColor:`#${c.hex}`},title:c.label,"aria-label":c.label,"aria-selected":f,onClick:()=>o(c),onMouseDown:m=>m.preventDefault(),onMouseEnter:()=>a(d),onMouseLeave:()=>a(null)},d)}))})}function T1({selectedColor:e,theme:t,onSelect:n}){let[o,r]=Ye.useState(null),{t:a}=_();return jsxRuntime.jsx("div",{style:{...Wm,gridTemplateColumns:`repeat(10, ${ui}px)`},children:s1.map((i,s)=>{let c=o===s,l=Ym(e,i.hex,t),d=a(i.nameKey);return jsxRuntime.jsx("button",{type:"button",style:{...l?Gm:c?Um:pi,backgroundColor:`#${i.hex}`},title:d,"aria-label":d,"aria-selected":l,onClick:()=>n(i.hex),onMouseDown:p=>p.preventDefault(),onMouseEnter:()=>r(s),onMouseLeave:()=>r(null)},i.hex)})})}function xo({mode:e,value:t,onChange:n,theme:o,disabled:r=false,className:a,style:i,title:s,icon:c,autoLabel:l,splitButton:d=true,defaultColor:p}){let[f,m]=Ye.useState(false),[g,u]=Ye.useState(false),[h,b]=Ye.useState(false),[v,C]=Ye.useState(false),[P,S]=Ye.useState(""),[y,x]=Ye.useState(()=>p??(e==="highlight"?"FFFF00":e==="border"?{kind:"hex",value:"000000"}:{kind:"hex",value:"FF0000"})),{t:M}=_();Ye.useEffect(()=>{let G=nc(t,e,o).replace(/^#/,"");/^[0-9A-Fa-f]{6}$/.test(G)&&S(G.toUpperCase());},[t,e,o]);let E=Ye.useCallback(()=>m(false),[]),{containerRef:w,dropdownRef:N,dropdownStyle:F}=$e({isOpen:f,onClose:E}),H=o?.colorScheme??null,k=Ye.useMemo(()=>Hm(H),[H]),D=Ye.useMemo(()=>nc(t,e,o),[t,e,o]),I=Ye.useMemo(()=>nc(y,e,o),[y,e,o]),R=Ye.useCallback(()=>{r||m(G=>!G);},[r]),z=Ye.useCallback(G=>{let B;e==="highlight"?B=G.hex:B={kind:"theme",slot:G.themeSlot,...G.tint!==void 0?{tint:G.tint}:{},...G.shade!==void 0?{shade:G.shade}:{}},x(B),n?.(B),m(false);},[e,n]),Z=Ye.useCallback(G=>{let B=e==="highlight"?G:{kind:"hex",value:G};x(B),n?.(B),m(false);},[e,n]),$=Ye.useCallback(()=>{n?.(e==="highlight"?"none":{kind:"auto"}),m(false);},[e,n]),Q=Ye.useCallback(()=>{let G=P.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/i.test(G)){let B=e==="highlight"?G:{kind:"hex",value:G};x(B),n?.(B),m(false),S("");}},[e,P,n]),Me=Ye.useCallback(()=>{r||n?.(y);},[r,y,n]),se={...u1,...r?{cursor:"default",opacity:.38}:f?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:g?{backgroundColor:"var(--doc-bg-hover)"}:{}},Te=M(e==="text"?"formattingBar.fontColor":e==="highlight"?"formattingBar.highlightColor":"table.borderColor"),Ce=c??(e==="text"?"format_color_text":e==="highlight"?"ink_highlighter":"border_color");return jsxRuntime.jsxs("div",{ref:w,className:`docx-color-picker ${a||""}`,style:{...d1,...i},children:[d?jsxRuntime.jsxs("div",{className:"docx-color-picker-split",style:{...h1,...r?{opacity:.38,cursor:"default"}:null},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-apply",style:{...v1,...r?{cursor:"default"}:h?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:Me,onMouseDown:G=>G.preventDefault(),onMouseEnter:()=>b(true),onMouseLeave:()=>b(false),disabled:r,title:s||Te,"aria-label":s||Te,children:[jsxRuntime.jsx(K,{name:Ce,size:18}),jsxRuntime.jsx("div",{style:{...Vm,backgroundColor:I==="transparent"?"#fff":I,outline:I==="transparent"||$m(I)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-color-picker-arrow",style:{...y1,...r?{cursor:"default"}:f?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:v?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:R,onMouseDown:G=>G.preventDefault(),onMouseEnter:()=>C(true),onMouseLeave:()=>C(false),disabled:r,title:s||Te,"aria-label":s||Te,"aria-haspopup":"true","aria-expanded":f,children:jsxRuntime.jsx(K,{name:"arrow_drop_down",size:18})})]}):jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-button",style:se,onClick:R,onMouseDown:G=>G.preventDefault(),onMouseEnter:()=>u(true),onMouseLeave:()=>u(false),disabled:r,title:s||Te,"aria-label":s||Te,"aria-haspopup":"true","aria-expanded":f,children:[jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:0},children:[jsxRuntime.jsx(K,{name:Ce,size:18}),jsxRuntime.jsx("div",{style:{...Vm,backgroundColor:D==="transparent"?"#fff":D,outline:D==="transparent"||$m(D)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14})]}),f&&jsxRuntime.jsx("div",{ref:N,className:"docx-color-picker-dropdown",style:{...F,...p1},role:"dialog","aria-label":`${Te} picker`,onMouseDown:G=>{G.target.tagName!=="INPUT"&&G.preventDefault();},children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",style:m1,onClick:$,onMouseDown:G=>G.preventDefault(),children:[e==="highlight"?jsxRuntime.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",border:"1px solid #ccc",borderRadius:"2px",position:"relative",backgroundColor:"#fff"},children:jsxRuntime.jsx("span",{style:{position:"absolute",top:"50%",left:"-1px",right:"-1px",height:"2px",backgroundColor:"#ff0000",transform:"rotate(-45deg)"}})}):jsxRuntime.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",backgroundColor:"#000",borderRadius:"2px"}}),l??M(e==="highlight"?"colorPicker.noColor":"colorPicker.automatic")]}),jsxRuntime.jsx("div",{style:oc}),jsxRuntime.jsx("div",{style:tc,children:M("colorPicker.themeColors")}),jsxRuntime.jsx(x1,{matrix:k,selectedColor:t,theme:o,onSelect:z}),jsxRuntime.jsx("div",{style:oc}),jsxRuntime.jsx("div",{style:tc,children:M("colorPicker.standardColors")}),jsxRuntime.jsx(T1,{selectedColor:t,theme:o,onSelect:Z}),jsxRuntime.jsx("div",{style:oc}),jsxRuntime.jsx("div",{style:tc,children:M("colorPicker.customColor")}),jsxRuntime.jsxs("div",{style:f1,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:g1,value:P,onChange:G=>S(G.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:G=>{G.key==="Enter"&&Q();},onMouseDown:G=>{G.stopPropagation();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsxRuntime.jsx("button",{type:"button",style:{...b1,opacity:/^[0-9A-Fa-f]{6}$/.test(P)?1:.4,cursor:/^[0-9A-Fa-f]{6}$/.test(P)?"pointer":"default"},onClick:Q,onMouseDown:G=>G.preventDefault(),disabled:!/^[0-9A-Fa-f]{6}$/.test(P),children:M("common.apply")})]})]})})]})}var Pr=20,rc=[{value:"left",label:"Align Left",labelKey:"alignment.alignLeft",shortcutKey:"alignment.alignLeftShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_left",size:Pr}),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:Pr}),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:Pr}),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:Pr}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function Qm({value:e="left",onChange:t,disabled:n=false}){let{t:o}=_(),[r,a]=Ye.useState(false),i=Ye.useCallback(()=>a(false),[]),{containerRef:s,dropdownRef:c,dropdownStyle:l,handleMouseDown:d}=$e({isOpen:r,onClose:i}),p=Ye.useCallback(b=>{n||t?.(b),a(false);},[n,t]),f=rc.find(b=>b.value===e)||rc[0],m=o(f.labelKey),g=f.shortcutKey?o(f.shortcutKey):void 0,u=`${m}${g?` (${g})`:""}`,h=jsxRuntime.jsxs(we,{variant:"ghost",size:"icon-sm",className:j("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",n&&"opacity-30 cursor-not-allowed"),onMouseDown:d,onClick:()=>!n&&a(b=>!b),disabled:n,"aria-label":u,"aria-expanded":r,"aria-haspopup":"true","data-testid":"toolbar-alignment",children:[jsxRuntime.jsx(K,{name:f.iconName,size:Pr}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:s,style:{position:"relative",display:"inline-block"},children:[r?h:jsxRuntime.jsx(Je,{content:u,children:h}),r&&!n&&jsxRuntime.jsx("div",{ref:c,style:{...l,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:b=>b.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",gap:2},children:rc.map(b=>{let v=e===b.value,C=o(b.labelKey),P=b.shortcutKey?o(b.shortcutKey):void 0;return jsxRuntime.jsx("button",{type:"button",title:`${C}${P?` (${P})`:""}`,"data-testid":`alignment-${b.value}`,style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:v?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:v?"var(--doc-primary)":"var(--doc-text)"},onMouseDown:S=>S.preventDefault(),onMouseEnter:S=>{v||(S.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:S=>{S.currentTarget.style.backgroundColor=v?"var(--doc-primary-light)":"transparent";},onClick:()=>p(b.value),children:jsxRuntime.jsx(K,{name:b.iconName,size:18})},b.value)})})})]})}function mi(){return {type:"none",level:0,isInList:false}}var w1={display:"inline-flex",alignItems:"center",gap:"4px"},Jm={display:"inline-flex",alignItems:"center",gap:"4px"},hi={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)"},M1={...hi,backgroundColor:"var(--doc-bg-hover)"},I1={...hi,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},k1={...hi,cursor:"default",opacity:.38},R1={width:"28px",height:"28px",padding:"2px"},_1={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},fi=20;function gi({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:a,style:i}){let[s,c]=Ye.useState(false),l={...t?k1:e?I1:s?M1:hi,...i},d=p=>{p.preventDefault();};return jsxRuntime.jsx("button",{type:"button",className:`docx-list-button ${e?"docx-list-button-active":""} ${t?"docx-list-button-disabled":""} ${a||""}`,style:l,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 ef({listState:e,onBulletList:t,onNumberedList:n,onIndent:o,onOutdent:r,disabled:a=false,className:i,style:s,showIndentButtons:c=true,compact:l=false,hasIndent:d=false}){let{t:p}=_(),f=Ye.useCallback(()=>l?{...R1}:{},[l]),m=e?.type==="bullet",g=e?.type==="numbered",h=(e?.isInList||m||g)&&(e?.level??0)>0||d;return jsxRuntime.jsxs("div",{className:`docx-list-buttons ${i||""}`,style:{...w1,...s},role:"group","aria-label":p("lists.ariaLabel"),children:[jsxRuntime.jsxs("div",{style:Jm,role:"group","aria-label":p("lists.typeAriaLabel"),children:[jsxRuntime.jsx(gi,{active:m,disabled:a,title:p("lists.bulletList"),onClick:t,style:f(),children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:fi})}),jsxRuntime.jsx(gi,{active:g,disabled:a,title:p("lists.numberedList"),onClick:n,style:f(),children:jsxRuntime.jsx(K,{name:"format_list_numbered",size:fi})})]}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:_1,role:"separator"}),jsxRuntime.jsxs("div",{style:Jm,role:"group","aria-label":p("lists.indentationAriaLabel"),children:[jsxRuntime.jsx(gi,{active:false,disabled:a||!h,title:p("lists.decreaseIndent"),onClick:r,style:f(),children:jsxRuntime.jsx(K,{name:"format_indent_decrease",size:fi})}),jsxRuntime.jsx(gi,{active:false,disabled:a,title:p("lists.increaseIndent"),onClick:o,style:f(),children:jsxRuntime.jsx(K,{name:"format_indent_increase",size:fi})})]})]})]})}var D1=[{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 of({value:e,onChange:t,options:n=D1,disabled:o=false,className:r}){let{t:a}=_(),i=Ye__namespace.useMemo(()=>e===void 0?n[0]:n.find(l=>l.twipsValue===e)||n[0],[e,n]),s=Ye__namespace.useCallback(l=>{let d=parseInt(l,10);isNaN(d)||t?.(d);},[t]),c=l=>l.labelKey?a(l.labelKey):l.label;return jsxRuntime.jsxs(qt,{value:i.twipsValue.toString(),onValueChange:s,disabled:o,children:[jsxRuntime.jsx(zt,{className:j("h-8 text-sm gap-0.5 px-2",r),style:{width:"auto"},"aria-label":a("lineSpacing.label"),title:a("lineSpacing.lineSpacingTitle",{label:c(i)}),children:jsxRuntime.jsx(us,{className:"h-5 w-5 shrink-0"})}),jsxRuntime.jsxs(Vt,{children:[n.map(l=>jsxRuntime.jsx(et,{value:l.twipsValue.toString(),children:c(l)},l.twipsValue)),jsxRuntime.jsx(ho,{}),jsxRuntime.jsx(Kt,{children:jsxRuntime.jsx(bo,{children:a("lineSpacing.blockSpacingRules")})})]})]})}var L1={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14},H1=new Set(["Title","Heading1","Heading2","Heading3"]),F1={Subtitle:"666666"},A1="#4a6c8c";function nf(e){let t=L1[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??H1.has(e.styleId))&&(o.fontWeight="bold"),e.italic&&(o.fontStyle="italic");let r=e.color??F1[e.styleId];return r?o.color=`#${r}`:e.styleId.startsWith("Heading")&&(o.color=A1),o}function rf(e){return !e||e.length===0?[]:e.filter(t=>t.type==="paragraph").map(t=>({styleId:t.styleId,name:t.name||t.styleId,priority:99}))}var af=[{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 lf({value:e,onChange:t,styles:n,disabled:o=false,className:r,width:a=120}){let{t:i}=_(),s=Ye__namespace.useMemo(()=>{let m=rf(n);return m.length===0?af:m.map(g=>({...g,type:"paragraph",nameKey:af.find(u=>u.styleId===g.styleId)?.nameKey}))},[n]),c=Ye__namespace.useCallback(m=>{t?.(m);},[t]),l=m=>m.nameKey?i(m.nameKey):m.name,d=e||"Normal",p=s.find(m=>m.styleId===d),f=p?l(p):d;return jsxRuntime.jsxs(qt,{value:d,onValueChange:c,disabled:o,children:[jsxRuntime.jsx(zt,{className:j("h-8 text-sm",r),style:{width:typeof a=="number"?`${a}px`:a},"aria-label":i("styles.selectAriaLabel"),children:jsxRuntime.jsx("span",{className:"truncate",children:f})}),jsxRuntime.jsx(Vt,{className:"min-w-[260px] max-h-[400px]",children:s.map(m=>jsxRuntime.jsx(et,{value:m.styleId,className:"py-2.5 px-3",children:jsxRuntime.jsx("span",{style:nf(m),children:l(m)})},m.styleId))})]})}var Z1=[{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 cf({value:e=1,onChange:t,levels:n=Z1,disabled:o=false,className:r,compact:a=false}){let{t:i}=_(),s=Ye__namespace.useMemo(()=>{let m=n.find(g=>Math.abs(g.value-e)<.001);return m?m.label:`${Math.round(e*100)}%`},[n,e]),c=Ye__namespace.useCallback(m=>{let g=parseFloat(m);isNaN(g)||t?.(g);},[t]),l=Ye__namespace.useMemo(()=>[...n].sort((m,g)=>m.value-g.value),[n]),d=Ye__namespace.useMemo(()=>[...l].reverse().find(m=>m.value<e-.001),[l,e]),p=Ye__namespace.useMemo(()=>l.find(m=>m.value>e+.001),[l,e]),f=a?"h-7 w-7":"h-8 w-8";return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(we,{variant:"ghost",size:"icon-sm",className:j(f,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",(o||!d)&&"opacity-30 cursor-not-allowed"),onClick:()=>d&&t?.(d.value),disabled:o||!d,"aria-label":i("zoom.zoomOut"),children:jsxRuntime.jsx(K,{name:"remove",size:18})}),jsxRuntime.jsxs(qt,{value:e.toString(),onValueChange:c,disabled:o,children:[jsxRuntime.jsx(zt,{className:j(a?"h-7 min-w-[55px] text-xs":"h-8 min-w-[64px] text-sm","rounded-none",r),"aria-label":i("zoom.ariaLabel",{label:s}),children:jsxRuntime.jsx(ci,{placeholder:"100%",children:s})}),jsxRuntime.jsx(Vt,{children:n.map(m=>jsxRuntime.jsx(et,{value:m.value.toString(),children:m.label},m.value))})]}),jsxRuntime.jsx(we,{variant:"ghost",size:"icon-sm",className:j(f,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",(o||!p)&&"opacity-30 cursor-not-allowed"),onClick:()=>p&&t?.(p.value),disabled:o||!p,"aria-label":i("zoom.zoomIn"),children:jsxRuntime.jsx(K,{name:"add",size:18})})]})}var q1=[{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 pf({onAction:e,disabled:t=false}){let{t:n}=_(),[o,r]=Ye.useState(false),a=Ye.useCallback(()=>r(false),[]),{containerRef:i,dropdownRef:s,dropdownStyle:c,handleMouseDown:l}=$e({isOpen:o,onClose:a}),d=Ye.useCallback(f=>{e(f),r(false);},[e]),p=jsxRuntime.jsxs(we,{variant:"ghost",size:"icon-sm",className:j("text-muted-foreground hover:text-foreground hover:bg-muted/80",o&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:l,onClick:()=>!t&&r(f=>!f),disabled:t,"aria-label":n("table.borders.styleAriaLabel"),"aria-expanded":o,"aria-haspopup":"true","data-testid":"toolbar-table-borders",children:[jsxRuntime.jsx(K,{name:"border_all",size:20}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:i,style:{position:"relative",display:"inline-block"},children:[o?p:jsxRuntime.jsx(Je,{content:n("table.borders.tooltip"),children:p}),o&&!t&&jsxRuntime.jsx("div",{ref:s,style:{...c,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:f=>f.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:2},children:q1.map(({action:f,icon:m,labelKey:g})=>jsxRuntime.jsx("button",{type:"button",title:n(g),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:u=>u.preventDefault(),onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},onClick:()=>d(f),children:jsxRuntime.jsx(K,{name:m,size:18})},typeof f=="string"?f:f.type))})})]})}function mf({onAction:e,disabled:t=false,theme:n,value:o}){let{t:r}=_(),a=Ye.useCallback(i=>{if(typeof i=="string"){e({type:"borderColor",color:i.replace(/^#/,"")});return}let s=i.kind==="auto"?"000000":wt(i,n);s&&e({type:"borderColor",color:s});},[e,n]);return jsxRuntime.jsx(xo,{mode:"border",value:o,onChange:a,theme:n,disabled:t,title:r("table.borderColor")})}var $1=[{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 gf({onAction:e,disabled:t=false}){let[n,o]=Ye.useState(false),{t:r}=_(),a=Ye.useCallback(()=>o(false),[]),{containerRef:i,dropdownRef:s,dropdownStyle:c,handleMouseDown:l}=$e({isOpen:n,onClose:a}),d=Ye.useCallback(f=>{e({type:"borderWidth",size:f}),o(false);},[e]),p=jsxRuntime.jsxs(we,{variant:"ghost",size:"icon-sm",className:j("text-muted-foreground hover:text-foreground hover:bg-muted/80",n&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:l,onClick:()=>!t&&o(f=>!f),disabled:t,"aria-label":r("table.borderWidth"),"aria-expanded":n,"aria-haspopup":"true","data-testid":"toolbar-table-border-width",children:[jsxRuntime.jsx(K,{name:"line_weight",size:20}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:i,style:{position:"relative",display:"inline-block"},children:[n?p:jsxRuntime.jsx(Je,{content:r("table.borderWidth"),children:p}),n&&!t&&jsxRuntime.jsx("div",{ref:s,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:f=>f.stopPropagation(),children:$1.map(({size:f,label:m,thickness:g})=>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:u=>u.preventDefault(),onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},onClick:()=>d(f),children:[jsxRuntime.jsx("div",{style:{width:50,height:Math.max(g,1),backgroundColor:"#000",borderRadius:g>2?1:0}}),jsxRuntime.jsx("span",{children:m})]},f))})]})}function hf({onAction:e,disabled:t=false,theme:n,value:o}){let{t:r}=_(),a=Ye.useCallback(i=>{typeof i=="string"&&e(i==="none"?{type:"cellFillColor",color:null}:{type:"cellFillColor",color:i.replace(/^#/,"")});},[e]);return jsxRuntime.jsx("div",{"data-testid":"toolbar-table-cell-fill",style:{display:"inline-block"},children:jsxRuntime.jsx(xo,{mode:"highlight",value:o,onChange:a,theme:n,disabled:t,title:r("table.cellFillColor"),icon:"format_color_fill",autoLabel:r("colorPicker.noColor")})})}var U1={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"},Co={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},xf={padding:"6px 14px 2px",fontSize:11,color:"var(--doc-text-muted)",fontWeight:500};function Tf({onAction:e,disabled:t=false,tableContext:n}){let{t:o}=_(),[r,a]=Ye.useState(false),[i,s]=Ye.useState(null),c=Ye.useCallback(()=>a(false),[]),{containerRef:l,dropdownRef:d,dropdownStyle:p,handleMouseDown:f}=$e({isOpen:r,onClose:c,align:"right"}),m=n?.table?.attrs?.justification??"left",g=Ye.useCallback(b=>{e(b),a(false);},[e]),u=(b,v,C,P,S)=>{let y=t||S?.itemDisabled;return jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{...U1,backgroundColor:i===b&&!y?"var(--doc-bg-hover)":"transparent",color:y?"var(--doc-text-muted)":S?.danger?"var(--doc-error)":"var(--doc-text)",cursor:y?"not-allowed":"pointer"},onClick:()=>!y&&g(P),onMouseEnter:()=>s(b),onMouseLeave:()=>s(null),disabled:y,children:[jsxRuntime.jsx(K,{name:v,size:16,className:S?.danger&&!y?"text-destructive":""}),jsxRuntime.jsx("span",{style:{flex:1},children:C})]},b)},h=jsxRuntime.jsx(we,{variant:"ghost",size:"icon-sm",className:j("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:f,onClick:()=>!t&&a(b=>!b),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:l,style:{position:"relative",display:"inline-block"},children:[r?h:jsxRuntime.jsx(Je,{content:o("table.moreOptions"),children:h}),r&&!t&&jsxRuntime.jsxs("div",{ref:d,style:{...p,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:"4px 0",minWidth:200,maxHeight:"70vh",overflowY:"auto"},role:"menu",onMouseDown:b=>b.stopPropagation(),children:[u("addRowAbove","add",o("table.insertRowAbove"),"addRowAbove"),u("addRowBelow","add",o("table.insertRowBelow"),"addRowBelow"),u("addColumnLeft","add",o("table.insertColumnLeft"),"addColumnLeft"),u("addColumnRight","add",o("table.insertColumnRight"),"addColumnRight"),jsxRuntime.jsx("div",{style:Co,role:"separator"}),u("mergeCells","call_merge",o("table.mergeCells"),"mergeCells",{itemDisabled:!n?.hasMultiCellSelection}),u("splitCell","call_split",o("table.splitCell"),"splitCell",{itemDisabled:!n?.canSplitCell}),jsxRuntime.jsx("div",{style:Co,role:"separator"}),u("selectTable","select_all",o("table.selectTable"),"selectTable"),jsxRuntime.jsx("div",{style:Co,role:"separator"}),u("deleteRow","delete",o("table.deleteRow"),"deleteRow",{danger:true,itemDisabled:(n?.rowCount??0)<=1}),u("deleteColumn","delete",o("table.deleteColumn"),"deleteColumn",{danger:true,itemDisabled:(n?.columnCount??0)<=1}),u("deleteTable","delete",o("table.deleteTable"),"deleteTable",{danger:true}),jsxRuntime.jsx("div",{style:Co,role:"separator"}),jsxRuntime.jsx("div",{style:xf,children:o("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["top","center","bottom"].map(b=>{let v={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"}[b]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:"transparent",cursor:"pointer"},onMouseDown:P=>P.preventDefault(),onMouseEnter:P=>{P.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},onClick:()=>g({type:"cellVerticalAlign",align:b}),children:jsxRuntime.jsx(K,{name:v[b],size:16})},b)})}),jsxRuntime.jsx("div",{style:Co,role:"separator"}),jsxRuntime.jsx("div",{style:xf,children:o("tableAdvanced.tableAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["left","center","right"].map(b=>{let v={left:"format_align_left",center:"format_align_center",right:"format_align_right"},C=m===b;return jsxRuntime.jsx("button",{type:"button",title:o({left:"tableAdvanced.alignTableLeft",center:"tableAdvanced.alignTableCenter",right:"tableAdvanced.alignTableRight"}[b]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:C?"var(--doc-primary-light)":"transparent",borderColor:C?"var(--doc-primary)":"var(--doc-border)",color:C?"var(--doc-primary)":"var(--doc-text)",cursor:"pointer"},onMouseDown:P=>P.preventDefault(),onClick:()=>g({type:"tableProperties",props:{justification:b}}),children:jsxRuntime.jsx(K,{name:v[b],size:16})},b)})}),jsxRuntime.jsx("div",{style:Co,role:"separator"}),u("headerRow","table_rows",o("tableAdvanced.toggleHeaderRow"),{type:"toggleHeaderRow"}),u("distribute","view_column",o("tableAdvanced.distributeColumns"),{type:"distributeColumns"}),u("autoFit","fit_width",o("tableAdvanced.autoFit"),{type:"autoFitContents"}),u("noWrap","wrap_text",o("tableAdvanced.toggleNoWrap"),{type:"toggleNoWrap"}),jsxRuntime.jsx("div",{style:Co,role:"separator"}),u("properties","settings",o("tableAdvanced.tableProperties"),{type:"openTableProperties"})]})]})}var Y1=20;function xi({options:e,activeValue:t,triggerIcon:n,tooltipContent:o,onSelect:r,disabled:a=false,ariaLabel:i,testId:s,showLabels:c=false}){let[l,d]=Ye.useState(false),p=Ye.useCallback(()=>d(false),[]),{containerRef:f,dropdownRef:m,dropdownStyle:g,handleMouseDown:u}=$e({isOpen:l,onClose:p}),h=Ye.useCallback(v=>{a||r(v),d(false);},[a,r]),b=jsxRuntime.jsxs(we,{variant:"ghost",size:"icon-sm",className:j("text-muted-foreground hover:text-foreground hover:bg-muted/80",l&&"bg-muted",a&&"opacity-30 cursor-not-allowed"),onMouseDown:u,onClick:()=>!a&&d(v=>!v),disabled:a,"aria-label":i??o,"aria-expanded":l,"aria-haspopup":"true","data-testid":s,children:[jsxRuntime.jsx(K,{name:n,size:Y1}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:f,style:{position:"relative",display:"inline-block"},children:[l?b:jsxRuntime.jsx(Je,{content:o,children:b}),l&&!a&&jsxRuntime.jsx("div",{ref:m,style:{...g,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:v=>v.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:c?"column":"row",gap:c?1:2,minWidth:c?200:void 0},children:e.map(v=>{let C=t===v.value;return jsxRuntime.jsxs("button",{type:"button",title:v.label,"data-testid":s?`${s}-${v.value}`:void 0,style:{display:"flex",alignItems:"center",height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:C?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:C?"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:P=>P.preventDefault(),onMouseEnter:P=>{C||(P.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:P=>{P.currentTarget.style.backgroundColor=C?"var(--doc-primary-light)":"transparent";},onClick:()=>h(v.value),children:[jsxRuntime.jsx(K,{name:v.iconName,size:18}),c&&jsxRuntime.jsx("span",{style:{flex:1},children:v.label})]},v.value)})})})]})}var X1=[{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 j1(e){return e.displayMode==="float"&&e.cssFloat==="left"?"wrapRight":e.displayMode==="float"&&e.cssFloat==="right"?"wrapLeft":e.wrapType}function Cf({imageContext:e,onChange:t,disabled:n=false}){let{t:o}=_(),r=X1.map(s=>({...s,label:o(s.labelKey)})),a=j1(e),i=r.find(s=>s.value===a)||r[0];return jsxRuntime.jsx(xi,{options:r,activeValue:a,triggerIcon:i.iconName,tooltipContent:`Wrap: ${i.label}`,onSelect:t,disabled:n,testId:"toolbar-image-wrap",showLabels:true})}var J1=[{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 Pf({onTransform:e,disabled:t=false}){let{t:n}=_(),o=J1.map(r=>({...r,label:n(r.labelKey)}));return jsxRuntime.jsx(xi,{options:o,triggerIcon:"rotate_right",tooltipContent:n("imageTransform.tooltip"),onSelect:e,disabled:t,testId:"toolbar-image-transform"})}var ct=18;function tt({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:a,ariaLabel:i}){let s=i?.toLowerCase().replace(/\s+/g,"-")||n?.toLowerCase().replace(/\s+/g,"-").replace(/\([^()]*\)/g,"").trim(),c=d=>{d.preventDefault();},l=jsxRuntime.jsx(we,{variant:"ghost",size:"icon-sm",className:j("docx-editor-toolbar-toggle text-muted-foreground",t&&"opacity-30 cursor-not-allowed",a),"data-active":e?"true":void 0,onMouseDown:c,onClick:t?void 0:o,"aria-disabled":t||void 0,tabIndex:t?-1:void 0,"aria-pressed":!!e,"aria-label":i||n,"data-testid":s?`toolbar-${s}`:void 0,children:r});return n?jsxRuntime.jsx(Je,{content:n,children:l}):l}function dt({label:e,children:t,className:n}){return jsxRuntime.jsx("div",{className:j("flex items-center gap-px px-1.5 border-r border-border/50 last:border-r-0 first:pl-0",n),role:"group","aria-label":e,children:t})}function r2(e){let t=Ye__namespace.default.useContext(Tr);return t?{...t,...a2(e)}:e}function a2(e){let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t}function sc(e){let{t}=_(),n=r2(e),{currentFormatting:o={},onFormat:r,onUndo:a,onRedo:i,canUndo:s=false,canRedo:c=false,disabled:l=false,className:d,style:p,enableShortcuts:f=true,editorRef:m,children:g,showFontPicker:u=true,fontFamilies:h,documentFonts:b,showFontSizePicker:v=true,showTextColorPicker:C=true,showHighlightColorPicker:P=true,showAlignmentButtons:S=true,showListButtons:y=true,showLineSpacingPicker:x=true,showStylePicker:M=true,documentStyles:E,theme:w,showZoomControl:N=true,zoom:F,onZoomChange:H,onRefocusEditor:k,imageContext:D,onImageWrapType:I,onImageTransform:R,onOpenImageProperties:z,tableContext:Z,onTableAction:$,inline:Q=false}=n,Me=Ye.useRef(null),se=Ye.useCallback(de=>{!l&&r&&r(de);},[l,r]),Te=Ye.useCallback(()=>{!l&&s&&a&&a();},[l,s,a]),Ce=Ye.useCallback(()=>{!l&&c&&i&&i();},[l,c,i]),G=Ye.useCallback(de=>{!l&&r&&r({type:"fontFamily",value:de});},[l,r]),B=Ye__namespace.default.useMemo(()=>Qs(h),[h]),Pe=Ye.useCallback(de=>{!l&&r&&r({type:"fontSize",value:de});},[l,r]),Ue=Ye.useCallback(de=>{!l&&r&&r({type:"textColor",value:de});},[l,r]),ce=Ye.useCallback(de=>{!l&&r&&r({type:"highlightColor",value:typeof de=="string"?de:""});},[l,r]),Ge=Ye.useCallback(de=>{!l&&r&&r({type:"alignment",value:de});},[l,r]),rn=Ye.useCallback(()=>{!l&&r&&r("bulletList");},[l,r]),Eo=Ye.useCallback(()=>{!l&&r&&r("numberedList");},[l,r]),Mr=Ye.useCallback(()=>{!l&&r&&r("indent");},[l,r]),Lf=Ye.useCallback(()=>{!l&&r&&r("outdent");},[l,r]),Hf=Ye.useCallback(de=>{!l&&r&&(r({type:"lineSpacing",value:de}),requestAnimationFrame(()=>k?.()));},[l,r,k]),Ff=Ye.useCallback(de=>{!l&&r&&r({type:"applyStyle",value:de});},[l,r]),an=Ye.useCallback(de=>{!l&&$&&($(de),requestAnimationFrame(()=>k?.()));},[l,$,k]);Ye.useEffect(()=>{if(!f)return;let de=ue=>{if(ue.defaultPrevented)return;let ln=ue.target,uc=m?.current,Zf=Me.current,Bf=uc?.contains(ln),qf=Zf?.contains(ln);if(!Bf&&!qf)return;if((ue.ctrlKey||ue.metaKey)&&!ue.altKey)switch(ue.key.toLowerCase()){case "b":ue.preventDefault(),se("bold");break;case "i":ue.preventDefault(),se("italic");break;case "u":ue.preventDefault(),se("underline");break;case "=":ue.shiftKey?(ue.preventDefault(),se("superscript")):(ue.preventDefault(),se("subscript"));break;case "l":ue.preventDefault(),Ge("left");break;case "e":ue.preventDefault(),Ge("center");break;case "r":ue.preventDefault(),Ge("right");break;case "j":ue.preventDefault(),Ge("both");break;case "k":ue.preventDefault(),se("insertLink");break}};return document.addEventListener("keydown",de),()=>{document.removeEventListener("keydown",de);}},[f,se,Ge,m]);let Af=Ye.useCallback(de=>{let ue=de.target;ue.tagName==="INPUT"||ue.tagName==="TEXTAREA"||ue.tagName==="SELECT"||ue.tagName==="OPTION"||de.preventDefault();},[]),Of=Ye.useCallback(de=>{let ue=de.target,ln=document.activeElement;ue.tagName==="SELECT"||ue.tagName==="OPTION"||ln?.tagName==="SELECT"||requestAnimationFrame(()=>{k?.();});},[k]);return jsxRuntime.jsxs("div",{ref:Me,className:j(!Q&&"flex items-center px-2 py-1 bg-muted rounded-full min-h-[36px] overflow-x-auto mx-2 mb-1",d),style:Q?{display:"contents",...p}:p,role:Q?void 0:"toolbar","aria-label":Q?void 0:t("toolbar.ariaLabel"),"data-testid":Q?void 0:"formatting-bar",onMouseDown:Q?void 0:Af,onMouseUp:Q?void 0:Of,children:[jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.history"),children:[jsxRuntime.jsx(tt,{onClick:Te,disabled:l||!s,title:t("formattingBar.undoShortcut"),ariaLabel:t("formattingBar.undo"),children:jsxRuntime.jsx(K,{name:"undo",size:ct})}),jsxRuntime.jsx(tt,{onClick:Ce,disabled:l||!c,title:t("formattingBar.redoShortcut"),ariaLabel:t("formattingBar.redo"),children:jsxRuntime.jsx(K,{name:"redo",size:ct})})]}),N&&jsxRuntime.jsx(dt,{label:t("formattingBar.groups.zoom"),children:jsxRuntime.jsx(cf,{value:F,onChange:H,disabled:l,compact:true})}),M&&jsxRuntime.jsx(dt,{label:t("formattingBar.groups.styles"),children:jsxRuntime.jsx(lf,{value:o.styleId||"Normal",onChange:Ff,styles:E,theme:w,disabled:l,width:120})}),(u||v)&&jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.font"),children:[u&&jsxRuntime.jsx(Om,{value:o.fontFamily||"Arial",onChange:G,fonts:B,documentFonts:b,disabled:l,width:60,placeholder:"Arial"}),v&&jsxRuntime.jsx(zm,{value:o.fontSize!==void 0?ns(o.fontSize):11,onChange:Pe,disabled:l,width:42,placeholder:"11"})]}),jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.textFormatting"),children:[jsxRuntime.jsx(tt,{onClick:()=>se("bold"),active:o.bold,disabled:l,title:t("formattingBar.boldShortcut"),ariaLabel:t("formattingBar.bold"),children:jsxRuntime.jsx(K,{name:"format_bold",size:ct})}),jsxRuntime.jsx(tt,{onClick:()=>se("italic"),active:o.italic,disabled:l,title:t("formattingBar.italicShortcut"),ariaLabel:t("formattingBar.italic"),children:jsxRuntime.jsx(K,{name:"format_italic",size:ct})}),jsxRuntime.jsx(tt,{onClick:()=>se("underline"),active:o.underline,disabled:l,title:t("formattingBar.underlineShortcut"),ariaLabel:t("formattingBar.underline"),children:jsxRuntime.jsx(K,{name:"format_underlined",size:ct})}),jsxRuntime.jsx(tt,{onClick:()=>se("strikethrough"),active:o.strike,disabled:l,title:t("formattingBar.strikethrough"),ariaLabel:t("formattingBar.strikethrough"),children:jsxRuntime.jsx(K,{name:"strikethrough_s",size:ct})}),C&&jsxRuntime.jsx(xo,{mode:"text",value:o.color?.replace(/^#/,""),onChange:Ue,theme:w,disabled:l,title:t("formattingBar.fontColor")}),P&&jsxRuntime.jsx(xo,{mode:"highlight",value:o.highlight,onChange:ce,theme:w,disabled:l,title:t("formattingBar.highlightColor")}),jsxRuntime.jsx(tt,{onClick:()=>se("insertLink"),disabled:l,title:t("formattingBar.insertLinkShortcut"),ariaLabel:t("formattingBar.insertLink"),children:jsxRuntime.jsx(K,{name:"link",size:ct})})]}),jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.script"),children:[jsxRuntime.jsx(tt,{onClick:()=>se("superscript"),active:o.superscript,disabled:l,title:t("formattingBar.superscriptShortcut"),ariaLabel:t("formattingBar.superscript"),children:jsxRuntime.jsx(K,{name:"superscript",size:ct})}),jsxRuntime.jsx(tt,{onClick:()=>se("subscript"),active:o.subscript,disabled:l,title:t("formattingBar.subscriptShortcut"),ariaLabel:t("formattingBar.subscript"),children:jsxRuntime.jsx(K,{name:"subscript",size:ct})})]}),S&&jsxRuntime.jsx(dt,{label:t("formattingBar.groups.alignment"),children:jsxRuntime.jsx(Qm,{value:o.alignment||"left",onChange:Ge,disabled:l})}),(y||x)&&jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.listFormatting"),children:[y&&jsxRuntime.jsx(ef,{listState:o.listState||mi(),onBulletList:rn,onNumberedList:Eo,onIndent:Mr,onOutdent:Lf,disabled:l,showIndentButtons:true,compact:true,hasIndent:(o.indentLeft??0)>0}),x&&jsxRuntime.jsx(of,{value:o.lineSpacing,onChange:Hf,disabled:l})]}),D&&I&&jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.image"),children:[jsxRuntime.jsx(Cf,{imageContext:D,onChange:I,disabled:l}),R&&jsxRuntime.jsx(Pf,{onTransform:R,disabled:l}),z&&jsxRuntime.jsx(tt,{onClick:z,disabled:l,title:t("formattingBar.imagePropertiesShortcut"),ariaLabel:t("formattingBar.imageProperties"),children:jsxRuntime.jsx(K,{name:"tune",size:ct})})]}),Z?.isInTable&&$&&jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.table"),children:[jsxRuntime.jsx(pf,{onAction:an,disabled:l}),jsxRuntime.jsx(mf,{onAction:an,disabled:l,theme:w,value:wt(Z?.cellBorderColor,w)}),jsxRuntime.jsx(gf,{onAction:an,disabled:l}),jsxRuntime.jsx(hf,{onAction:an,disabled:l,theme:w,value:Z?.cellBackgroundColor}),jsxRuntime.jsx(Tf,{onAction:an,disabled:l,tableContext:Z})]}),jsxRuntime.jsx(tt,{onClick:()=>se("clearFormatting"),disabled:l,title:t("formattingBar.clearFormatting"),ariaLabel:t("formattingBar.clearFormatting"),children:jsxRuntime.jsx(K,{name:"format_clear",size:ct})}),g]})}function i2({children:e,className:t,style:n,...o}){return jsxRuntime.jsx(Tr.Provider,{value:o,children:jsxRuntime.jsx("div",{className:j("flex flex-col bg-doc-surface shadow-sm flex-shrink-0",t),style:{position:"relative",zIndex:Ve.toolbar,...n},"data-testid":"editor-toolbar",children:e})})}var We=i2;We.TitleBar=Ys;We.Logo=ai;We.DocumentName=Gs;We.MenuBar=li;We.TitleBarRight=ii;We.Toolbar=sc;var c2=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"]]),d2=e=>{let t=/^#?([0-9a-fA-F]{6})$/.exec(e.trim());return t?t[1].toUpperCase():null};function u2({source:e,scale:t,measurer:n,documentName:o,onStateChange:r,onError:a,onSave:i,renderTitleBarLeft:s,renderTitleBarRight:c,ref:l,colorMode:d,onZoomChange:p,documentFontFamily:f,className:m}){let g=Ye.useRef(null),[u,h]=Ye.useState(null),[b,v]=Ye.useState({}),[C,P]=Ye.useState(null),S=Ye.useCallback(E=>{h(E);let w=g.current?.formatting();w&&v({bold:w.bold,italic:w.italic,underline:w.underline,strike:w.strikethrough,superscript:w.superscript,subscript:w.subscript,...w.fontFamily?{fontFamily:w.fontFamily}:{},...w.fontSizeHalfPoints?{fontSize:w.fontSizeHalfPoints}:{},...w.alignment?{alignment:w.alignment}:{},...w.styleId?{styleId:w.styleId}:{},...w.color?{color:`#${w.color}`}:{},...w.highlight?{highlight:w.highlight}:{}}),P(g.current?.sectionProperties()??null),r?.(E);},[r]),y=Ye.useCallback(E=>{let w=g.current;if(w){if(typeof E=="string")switch(E){case "bold":return w.toggleRunProperty("b");case "italic":return w.toggleRunProperty("i");case "underline":return w.toggleRunProperty("u",{val:"single"});case "strikethrough":return w.toggleRunProperty("strike");case "superscript":return w.setRunProperty("vertAlign",{val:"superscript"});case "subscript":return w.setRunProperty("vertAlign",{val:"subscript"});case "clearFormatting":w.setRunProperty("b",{val:"0"}),w.setRunProperty("i",{val:"0"}),w.setRunProperty("u",{val:"none"}),w.setRunProperty("strike",{val:"0"}),w.setRunProperty("vertAlign",{val:"baseline"});return;default:return}switch(E.type){case "fontFamily":return w.setRunProperty("rFonts",{ascii:E.value,hAnsi:E.value});case "fontSize":return w.setRunProperty("sz",{val:String(Math.round(E.value*2))});case "textColor":{let N=E.value,F=typeof N=="string"?d2(N):wt(N,null)??null;return F?w.setRunProperty("color",{val:F}):void 0}case "highlightColor":{let N=E.value.trim().toLowerCase();if(N==="none"||N==="")return w.setRunProperty("highlight",{val:"none"});let F=c2.get(N.startsWith("#")?N:`#${N}`);return F?w.setRunProperty("highlight",{val:F}):void 0}case "alignment":return w.setParagraphProperty("jc",{val:String(E.value)});case "lineSpacing":return w.setParagraphProperty("spacing",{line:String(Math.round(E.value)),lineRule:"auto"});case "applyStyle":return w.setParagraphProperty("pStyle",{val:E.value});default:return}}},[]);Ye.useImperativeHandle(l,()=>g.current,[]);let x=t===void 0?1:t/(96/72),M=C?{pageWidthTwips:C.pageSize.widthTwips,pageHeightTwips:C.pageSize.heightTwips,orientation:C.landscape?"landscape":"portrait",marginsTwips:{top:C.margins.topTwips,right:C.margins.rightTwips,bottom:C.margins.bottomTwips,left:C.margins.leftTwips}}:null;return jsxRuntime.jsxs("div",{className:["docx-editor docx-paginated-shell",d==="dark"?"dark":"",m??""].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(We,{currentFormatting:b,onFormat:y,onUndo:()=>g.current?.undo(),onRedo:()=>g.current?.redo(),canUndo:u?.canUndo??false,canRedo:u?.canRedo??false,zoom:x,onZoomChange:p,onSave:()=>{let E=g.current?.save();E&&i?.(E);},children:[jsxRuntime.jsxs(We.TitleBar,{children:[s&&jsxRuntime.jsx(We.Logo,{children:s()}),jsxRuntime.jsx(We.DocumentName,{value:o??"Document",editable:false}),c&&jsxRuntime.jsx(We.TitleBarRight,{children:c()}),jsxRuntime.jsx(We.MenuBar,{})]}),jsxRuntime.jsx(We.Toolbar,{})]}),jsxRuntime.jsxs("div",{className:"docx-editor__scroll-container",style:{flex:1,minHeight:0,overflow:"auto",background:"var(--doc-bg)"},children:[M?jsxRuntime.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"4px 0"},children:jsxRuntime.jsx(ao,{pageSetup:M,zoom:x})}):null,jsxRuntime.jsx(zs,{ref:g,source:e,...f?{documentFontFamily:f}:{},...t===void 0?{}:{scale:t},...n?{measurer:n}:{},onStateChange:S,...a?{onError:a}:{}})]})]})}var Si=class{constructor(t){nt(this,"listeners",new Set);nt(this,"snapshot");nt(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t);}));nt(this,"getSnapshot",()=>this.snapshot);this.snapshot=t;}setSnapshot(t){this.snapshot=t,this.notify();}notify(){for(let t of this.listeners)t();}};var Ci=class extends Si{constructor(){super({notifications:[]});nt(this,"notifications",[]);nt(this,"idCounter",0);nt(this,"timers",new Set);}showError(n,o){return this.addNotification(n,"error",o)}showWarning(n,o){return this.addNotification(n,"warning",o)}showInfo(n,o){return this.addNotification(n,"info",o)}dismiss(n){this.notifications=this.notifications.map(r=>r.id===n?{...r,dismissed:true}:r),this.emitSnapshot();let o=setTimeout(()=>{this.timers.delete(o),this.notifications=this.notifications.filter(r=>r.id!==n),this.emitSnapshot();},300);this.timers.add(o);}clearAll(){this.notifications=[];for(let n of this.timers)clearTimeout(n);this.timers.clear(),this.emitSnapshot();}destroy(){for(let n of this.timers)clearTimeout(n);this.timers.clear(),this.notifications=[];}addNotification(n,o,r){let a=`error-${++this.idCounter}-${Date.now()}`,i={id:a,message:n,severity:o,details:r,timestamp:Date.now()};if(this.notifications=[...this.notifications,i],this.emitSnapshot(),o!=="error"){let s=setTimeout(()=>{this.timers.delete(s),this.dismiss(a);},5e3);this.timers.add(s);}return a}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};var h2=Ye.createContext(null);function kf({children:e}){let t=Ye.useMemo(()=>new Ci,[]),n=Ye.useSyncExternalStore(t.subscribe,t.getSnapshot),o=Ye.useCallback((l,d)=>{t.showError(l,d);},[t]),r=Ye.useCallback((l,d)=>{t.showWarning(l,d);},[t]),a=Ye.useCallback((l,d)=>{t.showInfo(l,d);},[t]),i=Ye.useCallback(l=>{t.dismiss(l);},[t]),s=Ye.useCallback(()=>{t.clearAll();},[t]),c=Ye.useMemo(()=>({notifications:n.notifications,showError:o,showWarning:r,showInfo:a,dismissNotification:i,clearNotifications:s}),[n.notifications,o,r,a,i,s]);return jsxRuntime.jsxs(h2.Provider,{value:c,children:[e,jsxRuntime.jsx(v2,{notifications:n.notifications,onDismiss:i})]})}function v2({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(y2,{notification:r,onDismiss:()=>t(r.id)},r.id))})}function y2({notification:e,onDismiss:t}){let{t:n}=_(),[o,r]=Ye.useState(false),i=(u=>{switch(u){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),s={background:i.bg,border:`1px solid ${i.border}`,borderRadius:"8px",padding:"12px 16px",boxShadow:"0 2px 8px var(--doc-shadow)",animation:"slideIn 0.3s ease-out"},c={display:"flex",alignItems:"flex-start",gap:"8px"},l={color:i.icon,flexShrink:0},d={flex:1,minWidth:0},p={color:i.text,fontSize:"14px",fontWeight:500,wordBreak:"break-word"},f={marginTop:"8px",padding:"8px",background:"var(--doc-shadow-subtle)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word",color:i.text,maxHeight:"200px",overflow:"auto"},m={background:"transparent",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:i.text},g=u=>{switch(u){case "error":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 6v5M10 13v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "warning":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("path",{d:"M10 3L18 17H2L10 3z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M10 8v4M10 14v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "info":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 9v5M10 6v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}};return jsxRuntime.jsxs("div",{className:`docx-notification-toast docx-notification-${e.severity}`,style:s,children:[jsxRuntime.jsx("style",{children:`
1
+ 'use strict';var Ye=require('react'),editor=require('@docx-editor.dev/core/editor'),i18n=require('@docx-editor.dev/i18n'),jsxRuntime=require('react/jsx-runtime'),reactDom=require('react-dom'),classVarianceAuthority=require('class-variance-authority'),clsx=require('clsx'),pe=require('@radix-ui/react-select'),editor$1=require('@docx-editor.dev/core/contracts/editor');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Ye__namespace=/*#__PURE__*/_interopNamespace(Ye);var pe__namespace=/*#__PURE__*/_interopNamespace(pe);var zf=Object.defineProperty;var Vf=(e,t,n)=>t in e?zf(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n;var nt=(e,t,n)=>Vf(e,typeof t!="symbol"?t+"":t,n);var mc="(prefers-color-scheme: dark)";function fc(){return typeof window<"u"&&typeof window.matchMedia=="function"}function gc(){return fc()?window.matchMedia(mc).matches:false}function bc(e,t){return e==="dark"||e==="system"&&t}function hc(e){if(!fc())return ()=>{};let t=window.matchMedia(mc);e(t.matches);let n=o=>e(o.matches);return t.addEventListener("change",n),()=>t.removeEventListener("change",n)}var ki=Ye.createContext(null);function A(){return Ye.useContext(ki)}var St=Ye.createContext(null);var Ii=Ye.createContext(i18n.en),Ri=Ye.createContext("en");function wo({i18n:e,children:t}){let n=Ye.useContext(Ii),o=Ye.useContext(Ri),r=typeof e?._lang=="string"?e._lang:o,a=Ye.useMemo(()=>i18n.deepMerge(n,e),[n,e]);return jsxRuntime.jsx(Ri.Provider,{value:r,children:jsxRuntime.jsx(Ii.Provider,{value:a,children:t})})}function _(){let e=Ye.useContext(Ii),t=Ye.useContext(Ri);return {t:Ye.useMemo(()=>i18n.createT(e,t),[e,t])}}function Sc(e){let{t}=_();return Ye.useCallback((n,o)=>e?.get(n)??t(n,o),[e,t])}var sn=Object.freeze({scope:Object.freeze({kind:"body"}),isLoading:true,isOpening:false,parseError:null,editable:false,zoom:1,selection:null,selectionCollapsed:true,formatting:null,table:null,tocContext:null,image:null,page:Object.freeze({current:0,total:0}),canUndo:false,canRedo:false});var Qf=()=>{};function Jf(e){let t=false;return ()=>{if(t)return;t=true;let n=globalThis.navigator?.scheduling,o=()=>{t=false,e();};n?.isInputPending?.({includeContinuous:true})?setTimeout(o,0):queueMicrotask(o);}}function q(e,t=Object.is,n){let o=A(),r=n?.onSubscribe,a=n?.onUnsubscribe,i=Ye.useCallback(d=>{if(!o)return Qf;let p=false;r?.();let g=Jf(()=>{p||d();}),m=[o.on("change",g),o.on("selectionChange",g),o.on("error",g)];return ()=>{p=true,a?.();for(let f of m)f();}},[o,r,a]),s=Ye.useMemo(()=>{let d=false,p,g;return m=>{if(d&&m===p)return g;let f=e(m);return d&&t(g,f)?(p=m,g):(d=true,p=m,g=f,f)}},[o,e,t]),c=Ye.useCallback(()=>s(o?o.snapshot():sn),[o,s]),l=Ye.useCallback(()=>s(sn),[s]);return Ye.useSyncExternalStore(i,c,l)}var Ec=12700,Pc=96;function n0(e){return e==="image/png"||e==="image/jpeg"||e==="image/gif"}function r0(e,t,n,o){let r=e*72/n,a=t*72/o;return {widthPoints:Math.max(1,Math.round(r*100)/100),heightPoints:Math.max(1,Math.round(a*100)/100)}}function Ir(e){let t=editor.DEFAULT_IMAGE_RESOURCE_LIMITS;if(e.byteLength===0)return {ok:false,reasonKey:"imageInsert.errors.emptyFile"};if(e.byteLength>t.maxEncodedBytes)return {ok:false,reasonKey:"imageInsert.errors.oversize"};let n=editor.sniffImageMime(e);if(!n0(n))return n==="image/svg+xml"||n==="image/tiff"?{ok:false,reasonKey:"imageInsert.errors.unsupportedFormat"}:{ok:false,reasonKey:"imageInsert.errors.invalidSignature"};let o=editor.validateRasterHeader(e,n);if(!o)return {ok:false,reasonKey:"imageInsert.errors.invalidSignature"};if(o.pixelWidth*o.pixelHeight>t.maxPixels||o.pixelWidth>t.maxDimension||o.pixelHeight>t.maxDimension)return {ok:false,reasonKey:"imageInsert.errors.oversize"};let{widthPoints:a,heightPoints:i}=r0(o.pixelWidth,o.pixelHeight,Pc,Pc);return Object.freeze({ok:true,bytes:e,mime:n,widthPoints:a,heightPoints:i})}function It(e){return Math.round(e/Ec*100)/100}function cn(e){return Math.round(e*Ec)}var dn=Ye.createContext({t:void 0,onSave:void 0});function Ni(e){let{t}=_();return n=>e?.(n)??t(n)}function Y(){let{t:e}=Ye.useContext(dn);return Ni(e)}function u0(e,t){return e.active===t.active&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason}function Di(e){return typeof e=="string"}function p0(e){return JSON.stringify(e,Object.keys(e).sort())}function ne(e){let t=A(),n=Di(e)?e:p0(e),o=Ye.useRef(e);o.current=e;let r=Ye.useCallback(s=>{let c=o.current;if(Di(c)){let d=editor.toolbarCommandState(t,c);return {active:d.active,enabled:d.enabled,disabledReason:d.disabledReason}}if(!t)return {active:false,enabled:false,disabledReason:null};let l=t.can(c);return {active:t.isActive(c),enabled:l.ok,disabledReason:l.ok?null:l.reason??null}},[t,n]),a=q(r,u0),i=Ye.useCallback(()=>{let s=o.current;return Di(s)?editor.runToolbarCommand(t,s).ok:t?t.exec(s).ok:false},[t,n]);return Ye.useMemo(()=>({execute:i,isActive:a.active,isEnabled:a.enabled,disabledReason:a.disabledReason}),[i,a])}function b0(e,t){return typeof t!="function"?e:typeof e!="function"?t:n=>{e(n),n.defaultPrevented||t(n);}}function h0(e,t){let n={...e,...t};for(let o of Object.keys(e))/^on[A-Z]/.test(o)?n[o]=b0(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 W({children:e,...t}){let n=Ye.Children.only(e);if(!Ye.isValidElement(n))return null;let o=n.props,r=h0(t,o),a=n.ref,i=t.ref;return (a||i)&&(r.ref=s=>{for(let c of [a,i])typeof c=="function"?c(s):c&&typeof c=="object"&&(c.current=s);}),Ye.cloneElement(n,r)}function ee(e){for(let t of editor.CHROME_GROUPS)for(let n of t.controls)if(editor.chromeSlotId(t,n)===e)return n;return null}function te(e){return e?jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:18,height:18,"aria-hidden":"true",focusable:"false",children:e.map(t=>jsxRuntime.jsx("path",{d:t,fill:"currentColor"},t))}):null}function O(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function Xt(e){let{slot:t,icon:n,asChild:o,className:r,children:a,hidden:i}=e,{execute:s,isActive:c,isEnabled:l,disabledReason:d}=ne(t),p=Y();if(i)return null;let g=ee(t),m=p(g?.labelKey??t),f=editor.commandForSlot(t),u=f?.type==="toggleMark"||f?.type==="setAlignment",h={onClick:()=>s(),onMouseDown:O,disabled:!l,"data-slot":t,className:`docx-toolbar__button${r?` ${r}`:""}`,...c?{"data-active":""}:{},...l?{}:{"data-disabled":""},...u?{"aria-pressed":c}:{},"aria-label":m,title:d??m};return o?jsxRuntime.jsx(W,{...h,children:a}):jsxRuntime.jsx("button",{type:"button",...h,children:n??a??te(g?.paths)})}Xt.docxToolbarPart=true;var E0="image/png,image/jpeg,image/gif",Hi=Ye.createContext(null);function _r(){let e=Ye.useContext(Hi);if(!e)throw new Error("useImageInsert must be used within ImageInsertProvider");return e}function Fi(){return Ye.useContext(Hi)}function Nr({children:e}){let t=A(),{t:n}=_(),o=Ye.useRef(null),r=Ye.useRef(false),a=Ye.useCallback(()=>editor.toolbarCommandState(t,"image.insert"),[t]),i=q(a,(u,h)=>u.enabled===h.enabled&&u.disabledReason===h.disabledReason),s=i.enabled,c=i.disabledReason,l=Ye.useCallback(async u=>{if(!t||r.current)return;let h=Ir(u);if(!h.ok){window.alert(n(h.reasonKey));return}let b={type:"insertImage",data:h.bytes,mime:h.mime,widthPoints:h.widthPoints,heightPoints:h.heightPoints},v=t.canExecuteImageCommand?.(b);if(v&&!v.ok){window.alert(v.reason??n("imageInsert.errors.refused"));return}r.current=true;try{let C=await editor.executeImageCommand(t,b);C.ok?t.focus():window.alert(C.reason??n("imageInsert.errors.refused"));}finally{r.current=false;}},[t,n]),d=Ye.useCallback(async u=>{let h=u?.[0];if(!h)return;let b=await h.arrayBuffer();await l(new Uint8Array(b));},[l]),p=Ye.useCallback(async u=>{if(!u)return;let h=[...u.files].find(b=>b.type.startsWith("image/"));if(h){await d([h]);return}for(let b of u.items){if(b.kind!=="file"||!b.type.startsWith("image/"))continue;let v=b.getAsFile();if(!v)continue;let C=await v.arrayBuffer();await l(new Uint8Array(C));return}},[l,d]),g=Ye.useCallback(()=>{s&&o.current?.click();},[s]),m=Ye.useCallback(async u=>{let h=u.currentTarget;await d(h.files),h.value="";},[d]),f=Ye.useMemo(()=>({openFilePicker:g,insertFromFileList:d,insertFromDataTransfer:p,isEnabled:s,disabledReason:c,inputRef:o,onInputChange:m}),[g,d,p,s,c,m]);return jsxRuntime.jsxs(Hi.Provider,{value:f,children:[jsxRuntime.jsx("input",{ref:o,type:"file",accept:E0,className:"docx-image-insert__input",tabIndex:-1,"aria-hidden":"true",onChange:m,onMouseDown:u=>u.stopPropagation()}),e]})}function Dr({className:e,hidden:t,asChild:n,children:o}){let{openFilePicker:r,isEnabled:a,disabledReason:i}=_r(),s=Y();if(t)return null;let c=ee("image.insert"),l=s(c?.labelKey??"toolbar.image"),d={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"image.insert",disabled:!a,...a?{}:{"data-disabled":""},"aria-label":l,title:i??l,onMouseDown:O,onClick:r};return n?jsxRuntime.jsx(W,{...d,children:o}):jsxRuntime.jsx("button",{...d,children:o??te(c?.paths)})}Dr.docxSlot="image.insert";var un=Object.assign(Dr,{docxSlot:"image.insert"});var A0=["nw","n","ne","e","se","s","sw","w"],Dc=40,Lc=12;function O0(e){return `imageOverlay.handle.${e}`}function Z0(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 B0(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 q0(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 Ai({containerRef:e,portalRef:t,scrollPort:n}){let o=A(),{t:r}=_(),[a,i]=Ye.useState(null),[s,c]=Ye.useState(null),l=Ye.useRef(null);l.current=s;let d=Ye.useRef(null),p=Ye.useRef(null),g=Ye.useRef(null),m=Ye.useRef(null),f=Ye.useRef(null);Ye.useEffect(()=>{let S=e.current;if(!S)return;let y=x=>{let E=(x.target instanceof Element?x.target:null)?.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id");m.current=E??null,E&&E===a?.id&&queueMicrotask(()=>g.current?.focus({preventScroll:true}));};return S.addEventListener("pointerdown",y,{capture:true}),()=>S.removeEventListener("pointerdown",y,{capture:true})},[e,a?.id]),Ye.useEffect(()=>{if(!o){i(null);return}let S=()=>{i(editor.selectedDrawingOverlayTargetOf(o.surface));},y=()=>{queueMicrotask(S);};S();let x=[o.on("change",y),o.on("selectionChange",S)];return ()=>{for(let M of x)M();}},[o]),Ye.useEffect(()=>{if(n){f.current=n;return}let S=e.current;if(!S||!o?.surface)return;let y=S.closest(".docx-editor__scroll-container");if(!y)return;let x=o.surface.overlayCoordinates();return f.current=editor.createImageOverlayScrollPort(y,x.paintScale),()=>{f.current=null;}},[e,o,n]);let u=Ye.useCallback(()=>{c(null),d.current=null;let S=p.current;if(p.current=null,S)try{S.releasePointerCapture(S._lastPointerId??0);}catch{}},[]),h=Ye.useCallback((S,y,x,M,E,w,N)=>{if(!o?.surface)return;let F=editor.captureImageMutationPreconditions(o);if(!F)return;let H=o.surface.publishedLayout();d.current=Object.freeze({x:M,y:E}),p.current=w,w._lastPointerId=N;try{w.setPointerCapture(N);}catch{}c({session:Object.freeze({drawingNodeId:x.id,startBounds:Object.freeze({x:x.x,y:x.y,width:x.width,height:x.height}),startWidthEmu:x.widthEmu,startHeightEmu:x.heightEmu,startPosition:x.position,anchorFrameOrigin:x.anchorFrameOrigin,transform:x.transform,mode:S,handle:y,preconditions:F,layoutRevision:H.revision,packageRevision:o.surface.session.packageRevision(),kind:x.kind}),bounds:x,accumulatedScrollPt:0}),g.current?.focus({preventScroll:true});},[o]),b=Ye.useCallback((S,y,x,M,E)=>{if(!o)return;if(editor.isStaleImageInteractionCommit(o,S)){u();return}S.mode==="resize"?o.exec({type:"setImageProperties",widthEmu:y,heightEmu:x,...E?.mode==="simple"?{horizontalEmu:E.horizontalEmu,verticalEmu:E.verticalEmu}:{},...E?.mode==="frame"?{...E.horizontalEmu!==void 0?{horizontalEmu:E.horizontalEmu}:{},...E.verticalEmu!==void 0?{verticalEmu:E.verticalEmu}:{}}:{}}):S.mode==="move"&&E&&o.exec({type:"setImagePosition",...E}),u();},[u,o]),v=Ye.useCallback(S=>{if(!o)return;let y=l.current?.bounds??editor.selectedDrawingOverlayTargetOf(o.surface);if(!y)return;if(l.current&&S.key==="Escape"){S.preventDefault(),S.stopPropagation(),u();return}if(l.current)return;let x=S.shiftKey?editor.IMAGE_OVERLAY_NUDGE_SHIFT_PT:editor.IMAGE_OVERLAY_NUDGE_PT;if(S.key==="Delete"||S.key==="Backspace"){S.preventDefault(),S.stopPropagation(),o.exec({type:"deleteImage"});return}if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(S.key))return;S.preventDefault(),S.stopPropagation();let M=S.key==="ArrowLeft"?-x:S.key==="ArrowRight"?x:0,E=S.key==="ArrowUp"?-x:S.key==="ArrowDown"?x:0;if(S.altKey){if(!y.canResize)return;let N=q0(M,E),F=editor.computeImageResizeResult({handle:N,startWidthEmu:y.widthEmu,startHeightEmu:y.heightEmu,startBounds:{x:y.x,y:y.y,width:y.width,height:y.height},startPosition:y.position,anchorFrameOrigin:y.anchorFrameOrigin,deltaXPt:M,deltaYPt:E,transform:y.transform,preserveAspect:editor.resizePreservesAspect(N,y.aspectLocked,S.shiftKey),kind:y.kind});o.exec({type:"setImageProperties",widthEmu:F.widthEmu,heightEmu:F.heightEmu,...F.position?.mode==="simple"?{horizontalEmu:F.position.horizontalEmu,verticalEmu:F.position.verticalEmu}:{},...F.position?.mode==="frame"?{...F.position.horizontalEmu!==void 0?{horizontalEmu:F.position.horizontalEmu}:{},...F.position.verticalEmu!==void 0?{verticalEmu:F.position.verticalEmu}:{}}:{}});return}if(y.kind!=="anchored"||!y.canMove||!y.position)return;let w=editor.computeMovedImagePosition(y.position,M,E);o.exec({type:"setImagePosition",...w});},[u,o]);Ye.useEffect(()=>{if(!s||!o?.surface)return;let S=o.surface.overlayCoordinates(),y=M=>{let E=l.current,w=d.current;if(!E||!w)return;let N=editor.cssPixelsToLayoutPoints(M.clientX-w.x,S.paintScale),F=editor.cssPixelsToLayoutPoints(M.clientY-w.y,S.paintScale);if(E.session.mode==="move"){let I=0,D=f.current,k=e.current?.closest(".docx-editor__scroll-container");if(D&&k){let z=k.getBoundingClientRect();M.clientY>z.bottom-Dc?I=Lc:M.clientY<z.top+Dc&&(I=-Lc),I!==0&&(I=D.scrollBy(I));}let R=E.accumulatedScrollPt+I;c({...E,accumulatedScrollPt:R,bounds:Object.freeze({...E.bounds,x:E.session.startBounds.x+N,y:E.session.startBounds.y+F+R})});return}if(!E.session.handle)return;let H=editor.computeImageResizeResult({handle:E.session.handle,startWidthEmu:E.session.startWidthEmu,startHeightEmu:E.session.startHeightEmu,startBounds:E.session.startBounds,startPosition:E.session.startPosition,anchorFrameOrigin:E.session.anchorFrameOrigin,deltaXPt:N,deltaYPt:F,transform:E.session.transform,preserveAspect:editor.resizePreservesAspect(E.session.handle,E.bounds.aspectLocked,M.shiftKey),kind:E.session.kind});c({...E,bounds:Object.freeze({...E.bounds,x:H.previewBounds.x,y:H.previewBounds.y,width:H.previewBounds.width,height:H.previewBounds.height,widthEmu:H.widthEmu,heightEmu:H.heightEmu})});},x=M=>{let E=l.current;if(E)if(M.type==="pointerup"){let w=editor.cssPixelsToLayoutPoints(M.clientX-(d.current?.x??M.clientX),S.paintScale),N=editor.cssPixelsToLayoutPoints(M.clientY-(d.current?.y??M.clientY),S.paintScale),F=editor.finalizeImageOverlayInteraction({session:E.session,deltaXPt:w,deltaYPt:N,accumulatedScrollPt:E.accumulatedScrollPt,aspectLocked:E.bounds.aspectLocked,shiftKey:M.shiftKey,anchorFrameOrigin:E.session.anchorFrameOrigin});b(E.session,F.widthEmu,F.heightEmu,F.previewBounds,F.position);}else u();};return window.addEventListener("pointermove",y),window.addEventListener("pointerup",x),window.addEventListener("pointercancel",x),()=>{window.removeEventListener("pointermove",y),window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x);}},[u,b,e,o,s]),Ye.useEffect(()=>{!a||m.current!==a.id||(m.current=null,g.current?.focus({preventScroll:true}));},[a]);let C=s?.bounds??a,P=Ye.useMemo(()=>{if(!o?.surface||!C)return null;let S=o.surface.publishedLayout(),y=o.surface.overlayCoordinates(),x=editor.overlayFrameToSheetCssPixels(S,{pageIndex:C.pageIndex,x:C.x,y:C.y,width:C.width,height:C.height},y),M=C.canResize,E=C.kind==="anchored"&&C.canMove;return jsxRuntime.jsxs("div",{ref:g,className:"docx-image-selection-overlay docx-editor-one-surface__overlay-control","data-drawing-node-id":C.id,tabIndex:0,onKeyDown:v,children:[jsxRuntime.jsx("div",{className:"docx-image-selection-overlay__frame",role:"group","aria-label":r("imageOverlay.selection"),style:{left:`${x.left}px`,top:`${x.top}px`,width:`${x.width}px`,height:`${x.height}px`,cursor:E?"move":"default"},onPointerDown:w=>{O(w),!(!E||!C.position)&&w.button===0&&(w.preventDefault(),w.stopPropagation(),h("move",null,C,w.clientX,w.clientY,w.currentTarget,w.pointerId));}}),M?A0.map(w=>{let N=B0(w);return jsxRuntime.jsx("button",{type:"button",className:"docx-image-selection-overlay__handle","aria-label":r(O0(w)),tabIndex:0,style:{left:`calc(${x.left}px + ${x.width}px * ${parseFloat(N.x)/100} - 5px)`,top:`calc(${x.top}px + ${x.height}px * ${parseFloat(N.y)/100} - 5px)`,cursor:Z0(w)},onPointerDown:F=>{O(F),F.button===0&&(F.preventDefault(),F.stopPropagation(),h("resize",w,C,F.clientX,F.clientY,F.currentTarget,F.pointerId));}},w)}):null]})},[C,h,o,v,r]);return !P||!t.current?null:reactDom.createPortal(P,t.current)}function Fr({className:e}){let t=A(),n=Fi(),o=Ye.useRef(null),r=Ye.useRef(null);Ye.useLayoutEffect(()=>{let s=o.current;if(!(!t||!s))return t.attach(s),()=>{t.detach();}},[t]);let a=Ye.useCallback(s=>{if(!n?.isEnabled)return;let c=s.clipboardData;!c||![...c.items].some(d=>d.kind==="file"&&d.type.startsWith("image/"))||(s.preventDefault(),n.insertFromDataTransfer(c));},[n]),i=Ye.useCallback(s=>{!n?.isEnabled||![...s.dataTransfer.items].some(l=>l.kind==="file"&&l.type.startsWith("image/"))||(s.preventDefault(),n.insertFromDataTransfer(s.dataTransfer));},[n]);return jsxRuntime.jsxs("div",{ref:r,className:"docx-content-mount",children:[jsxRuntime.jsx("div",{ref:o,className:`docx-paginated-surface${e?` ${e}`:""}`,onPaste:a,onDrop:i}),t?jsxRuntime.jsx(Ai,{containerRef:o,portalRef:r}):null]})}var $0=e=>e.isLoading||e.isOpening===true;function Oi({className:e}){return jsxRuntime.jsx("span",{className:`docx-editor__loading-spinner${e?` ${e}`:""}`,"aria-hidden":"true"})}function W0({when:e=false,overlay:t=false,className:n,style:o,children:r}){let a=q($0),{t:i}=_();if(!e&&!a)return null;let s=`docx-editor docx-editor__loading${t?" docx-editor__loading--overlay":""}${n?` ${n}`:""}`;return jsxRuntime.jsx("div",{className:s,style:o,role:"status","aria-live":"polite",children:r??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Oi,{}),jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:i("loading.label")})]})})}var Or=Object.assign(W0,{Spinner:Oi});function Zr(e){return e.paragraphId===""}var jt=Object.freeze({mode:"closed",link:null,anchor:null,text:"",url:"",copied:false,error:false,canEdit:true}),eg=e=>e;function tg(){let e=n=>!!n&&(n.width>0||n.height>0);if(typeof document<"u"){let o=document.querySelector("[data-docx-caret]")?.getBoundingClientRect();if(e(o))return {left:o.left,top:o.bottom}}let t=typeof window>"u"?null:window.getSelection();if(t&&t.rangeCount>0){let n=t.getRangeAt(0),o=n.getBoundingClientRect();if(e(o))return {left:o.left,top:o.bottom};let r=n.startContainer,i=(r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.getBoundingClientRect();if(e(i))return {left:i.left,top:i.bottom}}return null}var mn=Ye.createContext(null);function Bi(){let e=Ye.useContext(mn),t=Br(e===null);return e??t}function Br(e=true){let t=A(),[n,o]=Ye.useState(jt),r=Ye.useRef(n);r.current=n;let a=q(eg),i=t?t.can({type:"insertText",text:""}).ok:false,s=Ye.useCallback((b,v)=>{o({mode:b?"reading":"editing",link:b??null,anchor:v??null,text:b?.text??"",url:b?b.kind==="internal"?`#${b.anchor??""}`:b.authored:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t]),c=Ye.useCallback(()=>{t?.surface?.releaseSelection(),o(jt);},[t]),l=Ye.useCallback(()=>{let b=tg(),v=t?.surface?.hyperlinks.linkAtCaret()??t?.surface?.hyperlinks.fieldLinkAtCaret()??null;if(v&&Zr(v)){s(v,b);return}if(v){o({mode:"editing",link:v,anchor:b,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 C=t?.query({type:"selectedText"})??"";t?.surface?.retainSelection(),o({mode:"editing",link:null,anchor:b,text:C,url:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t,s]);Ye.useEffect(()=>{if(!(!t||!e))return t.setHyperlinkChrome({onPopover:b=>s(b.link,{left:b.rect.left,top:b.rect.bottom}),onRequest:l})},[t,e,s,l]),Ye.useEffect(()=>{let b=r.current;if(b.mode!=="reading"||!b.link)return;let v=Zr(b.link)?t?.surface?.hyperlinks.fieldLinkAtCaret()??null:t?.surface?.hyperlinks.linkAtCaret()??null;v&&v.id===b.link.id||o(jt);},[a,t]),Ye.useEffect(()=>{let b=r.current;if(b.mode!=="editing"||b.link)return;let v=t?.surface;!v||v.retainedSelection()||o(jt);},[a,t]);let d=Ye.useCallback(async()=>{let b=r.current.link?.href;if(!b)return false;try{await navigator.clipboard.writeText(b);}catch{return false}return o(v=>({...v,copied:true})),true},[]),p=Ye.useCallback(()=>{o(b=>({...b,mode:"editing",copied:false,error:false}));},[]),g=Ye.useCallback(b=>{o(v=>({...v,text:b,copied:false,error:false}));},[]),m=Ye.useCallback(b=>{o(v=>({...v,url:b,copied:false,error:false}));},[]),f=Ye.useCallback(()=>{let b=r.current,v=t?.surface?.hyperlinks;if(!v)return false;let C=b.url.trim();if(C.length===0)return o(y=>({...y,error:true})),false;let P=C.startsWith("#");return v.applyHyperlink({...P?{anchor:C.slice(1)}:{url:C},...b.text.trim().length>0?{text:b.text}:{}})?(c(),true):(o(y=>({...y,error:true})),false)},[t,c]),u=Ye.useCallback(()=>{let b=t?.surface?.hyperlinks,v=r.current.link;if(!b)return false;let C=b.removeHyperlink(v?.id);return C&&c(),C},[t,c]),h=Ye.useCallback(()=>{let b=t?.surface?.navigation,v=r.current.link;if(!b||!v)return false;if(v.kind==="internal"){let P=v.anchor?b.goToBookmark(v.anchor):false;return P&&o(jt),P}let C=b.openExternal(v.href);return C&&o(jt),C},[t]);return Ye.useMemo(()=>({state:n.mode==="closed"?jt:{...n,canEdit:i},open:s,openAtCaret:l,close:c,copy:d,beginEdit:p,setText:g,setUrl:m,commitEdit:f,unlink:u,openTarget:h}),[n,i,s,l,c,d,p,g,m,f,u,h])}var Be={showAll:"contentControl.showAll",formFill:"contentControl.formFill",inspector:"contentControl.inspector",remove:"contentControl.remove"};function ag(e){return e==="sdtLocked"||e==="sdtContentLocked"}function ig(e){return e==="contentLocked"||e==="sdtContentLocked"}function Ki(e,t){return !e.ok&&e.code===t}function pt(){let e=Ye.useContext(zi),t=qr();return e??t}function qr(){let e=A(),[t,n]=Ye.useState(false),[o,r]=Ye.useState(false),[a,i]=Ye.useState(false),s=q(x=>x),c=e?.surface??null,l=c?.contentControls;Ye.useEffect(()=>{r(l?.showAll()??c?.state().contentControls.showAll??false),i(l?.formFill()??c?.state().contentControls.formFill??false);},[s,l,c]);let d=Ye.useMemo(()=>{if(!e)return null;let x=l?.atCaret()??null;if(x){let k=l?.disabledReason(x.id,"edit")??null,R=l?.disabledReason(x.id,"remove")??null;return {id:x.id,tag:x.tag??null,alias:x.alias??null,controlType:x.controlType,locked:ig(x.effectiveLock)||k==="locked",removalLocked:ag(x.effectiveLock)||R==="locked",placeholder:x.placeholder,bound:x.bound||k==="bound",effectiveLock:x.effectiveLock}}let M=e.query({type:"contentControlAt"});if(!M)return null;let E=l?.disabledReason(M.id,"edit")??null,w=l?.disabledReason(M.id,"remove")??null,N=e.can({type:"setContentControlValue",value:""}),F=e.can({type:"removeContentControl"}),H=M.locked===true||E==="locked"||Ki(N,"locked"),I=E==="bound"||Ki(N,"bound"),D=w==="locked"||Ki(F,"locked");return {id:M.id,tag:M.tag??null,alias:M.alias??null,controlType:M.controlType,locked:H,removalLocked:D,placeholder:false,bound:I,effectiveLock:null}},[e,s,l]),p=Ye.useMemo(()=>e?e.query({type:"contentControls"}):[],[e,s]),g=Ye.useCallback(x=>{l?.setShowAll(x),r(x);},[l]),m=Ye.useCallback(x=>{l?.setFormFill(x),i(x);},[l]),f=Ye.useCallback(()=>g(!o),[g,o]),u=Ye.useCallback(()=>m(!a),[m,a]),h=Ye.useCallback(()=>n(true),[]),b=Ye.useCallback(()=>n(false),[]),v=Ye.useCallback(()=>n(x=>!x),[]),C=Ye.useMemo(()=>{if(!d)return "no content control at the current selection";if(l){let M=l.disabledReason(d.id,"edit");return M==="locked"?"the content control is locked":M==="bound"?"the content control is bound to external data":M==="notFound"?"the content control was not found":M}if(d.locked)return "the content control is locked";if(d.bound)return "the content control is bound to external data";if(!e)return "no document is loaded";let x=e.can({type:"setContentControlValue",value:""});return x.ok?null:x.reason},[d,l,e]),P=Ye.useMemo(()=>{if(!d)return "no content control at the current selection";if(l){let M=l.disabledReason(d.id,"remove");return M==="locked"?"the content control is locked":M==="notFound"?"the content control was not found":M}if(d.removalLocked)return "the content control is locked";if(!e)return "no document is loaded";let x=e.can({type:"removeContentControl"});return x.ok?null:x.reason},[d,l,e]),S=Ye.useCallback(x=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(l&&d){let M=l.disabledReason(d.id,"edit");if(M)return {ok:false,code:M==="bound"?"bound":M==="locked"?"locked":"notFound",reason:M==="bound"?"the content control is bound to external data":M==="locked"?"the content control is locked":"the content control was not found"}}return e.exec({type:"setContentControlValue",value:x})},[e,l,d]),y=Ye.useCallback(()=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(l){let x=d?.id;if(!x)return {ok:false,code:"notFound",reason:"no content control at the current selection"};let M=l.disabledReason(x,"remove");return M?{ok:false,code:M==="locked"?"locked":"notFound",reason:M==="locked"?"the content control is locked":"the content control was not found"}:l.remove(x)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:"the edit was refused"}}return e.exec({type:"removeContentControl"})},[e,l,d]);return Ye.useMemo(()=>({control:d,controls:p,showAll:o,formFill:a,inspectorOpen:t,canSetValue:C===null&&d!==null,canRemove:P===null&&d!==null,setValueDisabledReason:C,removeDisabledReason:P,setShowAll:g,toggleShowAll:f,setFormFill:m,toggleFormFill:u,openInspector:h,closeInspector:b,toggleInspector:v,remove:y,setValue:S}),[d,p,o,a,t,C,P,g,f,m,u,h,b,v,y,S])}var zi=Ye.createContext(null);function Bc(){let e=0,t=null,n=new Set,o=new Set,r=a=>{for(let i of [...a])i();};return {getShift:()=>e,setShift(a){let i=Math.max(0,Math.round(a));i!==e&&(e=i,r(n));},subscribeShift(a){return n.add(a),()=>n.delete(a)},getViewport:()=>t,setViewport(a){a!==t&&(t=a,r(o));},subscribeViewport(a){return o.add(a),()=>o.delete(a)}}}var Vi=Ye.createContext(null);function Io(){return Ye.useContext(Vi)}var cg=()=>0,qc=()=>()=>{};function Ro(){let e=Io(),t=Ye.useCallback(o=>e?e.subscribeShift(o):qc(),[e]),n=Ye.useCallback(()=>e?e.getShift():0,[e]);return Ye.useSyncExternalStore(t,n,cg)}function _o(){let e=Io(),t=Ye.useCallback(r=>e?e.subscribeViewport(r):qc(),[e]),n=Ye.useCallback(()=>e?e.getViewport():null,[e]),o=Ye.useCallback(()=>null,[]);return Ye.useSyncExternalStore(t,n,o)}function fg(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 zr(e){let{document:t,fonts:n,zoom:o,zoomMode:r,tableInteractionLabel:a,imageDecodePort:i,children:s}=e,{t:c}=_(),l=Ye.useCallback((v,C)=>c(v,C),[c]),d=Ye.useRef(e);d.current=e;let[p,g]=Ye.useState(null);Ye.useEffect(()=>{let v=d.current,C=v.translate??l,P=editor.createDocxEditor({...v.document!==void 0?{document:v.document}:{},...v.fonts?{fonts:v.fonts}:{},...v.author!==void 0?{author:v.author}:{},...v.locale!==void 0?{locale:v.locale}:{},translate:C,...v.mode!==void 0?{mode:v.mode}:{},...v.modules!==void 0?{modules:v.modules}:{},...v.zoom!==void 0?{zoom:v.zoom}:{},...v.zoomMode!==void 0?{zoomMode:v.zoomMode}:{},...v.tableInteractionLabel?{tableInteractionLabel:v.tableInteractionLabel}:{},...v.imageDecodePort?{imageDecodePort:v.imageDecodePort}:{},onFontError:y=>d.current.onFontError?.(y)}),S=P.on("change",y=>d.current.onChange?.(y));return g(P),()=>{S(),P.destroy(),g(y=>y===P?null:y);}},[t,n,l,i]),Ye.useEffect(()=>{if(!p)return;if(!p.snapshot().isOpening){d.current.onReady?.(p);return}let v=p.on("change",()=>{v(),d.current.onReady?.(p);});return v},[p]);let m=Ye.useRef({editor:null,zoom:void 0,mode:void 0});Ye.useEffect(()=>{if(!p)return;m.current.editor!==p&&(m.current={editor:p,zoom:void 0,mode:void 0});let C=false;o!==void 0&&o!==m.current.zoom&&(m.current.zoom=o,p.setZoom(o),C=true);let P=m.current.mode,S=r!==void 0&&(P===void 0||!fg(P,r)),y=r===void 0?null:editor.resolveZoomMode(r),x=C&&r!==void 0&&y!==null&&y.type==="fit";(S||x)&&(m.current.mode=r,p.setZoomMode(r));},[p,o,r]),Ye.useEffect(()=>{p&&p.setTableInteractionLabel(a??editor.defaultTableLabel);},[p,a]);let[f,u]=Ye.useState(0),h=Ye.useMemo(()=>({mounted:f,register:()=>(u(v=>v+1),()=>u(v=>Math.max(0,v-1)))}),[f]),b=Ye.useMemo(Bc,[]);return jsxRuntime.jsx(St.Provider,{value:h,children:jsxRuntime.jsx(ki.Provider,{value:p,children:jsxRuntime.jsx(Vi.Provider,{value:b,children:jsxRuntime.jsx(gg,{children:jsxRuntime.jsx(bg,{children:jsxRuntime.jsx(Nr,{children:s})})})})})})}function gg({children:e}){let t=Br(true);return jsxRuntime.jsx(mn.Provider,{value:t,children:e})}function bg({children:e}){let t=qr();return jsxRuntime.jsx(zi.Provider,{value:t,children:e})}var Vr=[.25,.5,.75,1,1.25,1.5,2];function bn(e,t){return t==="in"?Vr.find(o=>o>e+.001)??null:[...Vr].reverse().find(o=>o<e-.001)??null}function $c(e,t){return e==="0"?1:e==="+"||e==="="?bn(t,"in")??t:e==="-"?bn(t,"out")??t:null}var Qt=Ye.createContext(false);function Xe(){return Ye.useContext(Qt)?"":"docx-editor "}var xg=e=>e.reviewPaneOpen??true,Tg=e=>e.zoomMode?.type==="fit";function $r({className:e,style:t,children:n}){let o=Xe(),r=A(),a=q(xg),i=q(Tg),c=(Ye.useContext(St)?.mounted??0)>0,l=Io(),d=Ro(),p=Ye.useCallback(m=>l?.setViewport(m),[l]),g=Ye.useCallback(m=>{if(!r||!(m.metaKey||m.ctrlKey)||m.altKey)return;let f=m.target;if(f instanceof Element&&f.closest('input, textarea, select, [role="dialog"]'))return;let u=$c(m.key,r.getZoom());u!==null&&(m.preventDefault(),r.setZoom(u));},[r]);return jsxRuntime.jsx("div",{ref:p,"data-testid":"docx-editor-scroll",onKeyDownCapture:g,...c?{"data-review-pane":a?"open":"closed"}:{},...i?{"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":`${d}px`},children:jsxRuntime.jsx(Qt.Provider,{value:true,children:n})})}var Cg=sn;function Gc({ref:e,editorRef:t}){Ye.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)??Cg}),[t]);}var kg=e=>e.editingMode??"editing",Ui=[{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"}],Ig="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z";function Ur({className:e,hidden:t}){let n=A(),o=q(kg),r=Y(),[a,i]=Ye.useState(false),s=Ye.useRef(null),c=Ye.useRef(null),l=Ye.useRef(null);Ye.useEffect(()=>{if(!a)return;let u=l.current?.querySelectorAll('[role="menuitemradio"]');(l.current?.querySelector('[aria-checked="true"]')??u?.[0]??void 0)?.focus();},[a]);let d=Ye.useCallback(u=>{let h=[...l.current?.querySelectorAll('[role="menuitemradio"]')??[]],b=h.indexOf(document.activeElement),v=C=>{u.preventDefault(),h[(C+h.length)%h.length]?.focus();};u.key==="ArrowDown"?v(b+1):u.key==="ArrowUp"?v(b-1):u.key==="Home"?v(0):u.key==="End"&&v(h.length-1);},[]);Ye.useEffect(()=>{if(!a)return;let u=b=>{let v=s.current;v&&b.target instanceof Node&&v.contains(b.target)||i(false);},h=b=>{b.key==="Escape"&&(b.preventDefault(),i(false));};return document.addEventListener("mousedown",u,true),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",u,true),document.removeEventListener("keydown",h);}},[a]);let p=Ye.useCallback(u=>{i(false),editor.runToolbarCommand(n,"review.editingMode",u),n?.focus();},[n]),g=editor.toolbarCommandState(n,"review.editingMode"),m=Ye.useMemo(()=>Ui.find(u=>u.mode===o)??Ui[0],[o]);if(t)return null;let f=ee("review.editingMode");return jsxRuntime.jsxs("div",{ref:s,className:`docx-toolbar__mode${e?` ${e}`:""}`,"data-slot":"review.editingMode",children:[jsxRuntime.jsxs("button",{ref:c,type:"button",className:"docx-toolbar__picker","data-testid":"editing-mode-trigger","data-mode":o,"aria-haspopup":"menu","aria-expanded":a,"aria-label":r(f?.labelKey??"editingMode.label"),disabled:!g.enabled,...g.disabledReason?{title:g.disabledReason}:{},onMouseDown:O,onClick:()=>i(u=>!u),children:[Gi(m.path),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-value",children:r(m.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),a?jsxRuntime.jsx("div",{ref:l,className:"docx-toolbar__mode-menu",role:"menu","aria-label":r(f?.labelKey??"editingMode.label"),"data-testid":"editing-mode-menu",onKeyDown:d,children:Ui.map(u=>jsxRuntime.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":u.mode===o,className:"docx-toolbar__mode-item","data-testid":`editing-mode-${u.mode}`,onMouseDown:O,onClick:()=>p(u.mode),children:[Gi(u.path),jsxRuntime.jsxs("span",{className:"docx-toolbar__mode-text",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__mode-label",children:r(u.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-hint",children:r(u.hintKey)})]}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-check","aria-hidden":"true",children:u.mode===o?Gi(Ig):null})]},u.mode))}):null]})}Ur.docxSlot="review.editingMode";function Gi(e){return jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:18,height:18,"aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:e,fill:"currentColor"})})}function No(e,t){if(!Ye.isValidElement(e)||e.type!==Ye.Fragment)return null;let o=Ye.Children.toArray(e.props.children).map(t).filter(r=>r!==null);return o.length===1?o[0]:null}function Yr({entries:e,children:t,preset:n,keyOfEntry:o,keyOfChild:r,renderEntry:a}){if(!n)return t;let i=new Map,s=[];for(let p of Ye.Children.toArray(t)){let g=r(p);g?i.set(g,p):s.push(p);}let c=e.map((p,g)=>{let m=o(p,g),f=i.get(m);return f?jsxRuntime.jsx(Ye.Fragment,{children:f},m):jsxRuntime.jsx(Ye.Fragment,{children:a(p,g)},m)}),l=new Set(e.map(o)),d=[...i.entries()].filter(([p])=>!l.has(p)).map(([p,g])=>jsxRuntime.jsx(Ye.Fragment,{children:g},p));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[c,d,s]})}var Dg=["zoom","script","format","list","alignment","styles","font","text","history"],Xi=new Set(["review"]),ji=24,Jc=new Set;function ed(e,t=Dg){let n=t.filter(r=>e.includes(r));return [...e.filter(r=>!t.includes(r)).reverse(),...n]}function Qc(e,t){let{widths:n,groups:o,order:r,fixed:a,more:i}=e,s=a;for(let l of o)s+=n.get(l)??0;if(s<=t)return Jc;s+=i;let c=new Set;for(let l of r){if(s<=t)break;let d=n.get(l);d===void 0||c.has(l)||(c.add(l),s-=d);}return c}function td(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 od=td;function nd(e){if(!(e.available>0))return Jc;let t=Qc(e,e.available),n=e.previous;if(!n||n.size===0||t.size>=n.size)return t;let o=Qc(e,e.available-(e.hysteresis));return td(o,n)?n:o}function rd(e,t,n,o){return e+t+n+o*2}function ad(e,t){return e+t}function Ji(e,t){return e+t}function id(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 Qi(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function ld(e){return Qi(e.columnGap)}function sd(e,t){return e.clientWidth-Qi(t.paddingLeft)-Qi(t.paddingRight)}var vn="data-toolbar-group",yn="data-toolbar-fixed",tl="data-toolbar-more",Ag=34,el=new Set;function dd(e,t,n){let o=Ye.useRef(null),r=Ye.useRef(new Map),a=Ye.useRef(Ag),[i,s]=Ye.useState(el),c=Ye.useRef(i);c.current=i;let l=Ye.useRef({groups:t,order:n});l.current={groups:t,order:n};let d=Ye.useCallback(()=>{let g=o.current;if(!g||!e)return;let m=getComputedStyle(g),f=ld(m),u=sd(g,m),h=g.querySelector(".docx-toolbar__separator"),b=f*2;if(h){let y=getComputedStyle(h),x=id(y);b=rd(h.offsetWidth,x.start,x.end,f);}for(let y of g.querySelectorAll(`[${vn}]`)){let x=y.getAttribute(vn);x&&y.offsetWidth>0&&r.current.set(x,ad(y.offsetWidth,b));}let v=0;for(let y of g.querySelectorAll(`[${yn}]`))y.offsetWidth>0&&(v+=Ji(y.offsetWidth,f));let C=g.querySelector(`[${tl}]`);C&&C.offsetWidth>0&&(a.current=Ji(C.offsetWidth,f));let P={available:u,widths:r.current,groups:l.current.groups,order:l.current.order,fixed:v,more:a.current,previous:c.current,hysteresis:ji},S=nd(P);od(S,c.current)||(c.current=S,s(S));},[e]),p=Ye.useCallback(g=>{o.current=g;},[]);return Ye.useLayoutEffect(()=>{if(!e){c.current.size>0&&(c.current=el,s(el));return}d();},[e,d]),Ye.useEffect(()=>{let g=o.current;if(!e||!g||typeof ResizeObserver>"u")return;let m=0,f=new ResizeObserver(()=>{m===0&&(m=requestAnimationFrame(()=>{m=0,d();}));});f.observe(g);for(let u of g.querySelectorAll(`[${vn}], [${yn}]`))f.observe(u);return ()=>{m!==0&&cancelAnimationFrame(m),f.disconnect();}},[e,d,i]),{attach:p,overflow:i}}var $g=["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"],pd=Ye.createContext({close:()=>{}});function Wg(e){e.querySelector('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')?.focus();}function md({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 fd({slot:e}){let t=Y(),{close:n}=Ye.useContext(pd),{execute:o,isActive:r,isEnabled:a,disabledReason:i}=ne(e),s=ee(e),c=editor.commandForSlot(e),l=c?.type==="toggleMark"||c?.type==="setAlignment",d=t(s?.labelKey??e);return jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__more-command","data-slot":e,disabled:!a,...i?{title:i}:{},...l?{"aria-pressed":r}:{},...r?{"data-active":""}:{},onMouseDown:O,onClick:p=>{o(),n(p.detail===0);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-icon","aria-hidden":"true",children:te(s?.paths)}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-label",children:d})]})}function gd({sections:e,className:t}){let n=Y(),[o,r]=Ye.useState(false),a=Ye.useRef(null),i=Ye.useRef(null),s=Ye.useRef(null),c=Ye.useRef(false),l=Ye.useId(),d=n("formattingBar.more"),p=Ye.useCallback(f=>{r(false),f&&i.current?.focus();},[]),g=Ye.useMemo(()=>({close:p}),[p]);Ye.useEffect(()=>{if(!o)return;let f=u=>{let h=u.target;h instanceof Node&&a.current?.contains(h)||r(false);};return document.addEventListener("mousedown",f,true),()=>document.removeEventListener("mousedown",f,true)},[o]),Ye.useEffect(()=>{if(!o||!c.current)return;c.current=false;let f=s.current;f&&Wg(f);},[o]);let m=f=>{f.key!=="Escape"||f.defaultPrevented||(f.preventDefault(),p(true));};return jsxRuntime.jsxs("div",{ref:a,className:`docx-toolbar__more${t?` ${t}`:""}`,[tl]:"",children:[jsxRuntime.jsx("button",{ref:i,type:"button",className:"docx-toolbar__button docx-toolbar__more-trigger","data-slot":"toolbar.more","aria-haspopup":"dialog","aria-expanded":o,"aria-controls":o?l:void 0,"aria-label":d,title:d,...o?{"data-active":""}:{},onMouseDown:O,onClick:()=>r(f=>!f),onKeyDown:f=>{f.key==="ArrowDown"&&(f.preventDefault(),c.current=true,r(true));},children:te($g)}),o?jsxRuntime.jsx(pd.Provider,{value:g,children:jsxRuntime.jsx("div",{ref:s,id:l,role:"dialog","aria-label":d,className:"docx-toolbar__more-panel","data-testid":"toolbar-overflow-panel",onKeyDown:m,children:e.map(f=>jsxRuntime.jsxs("div",{className:"docx-toolbar__more-section",role:"group","aria-label":n(f.labelKey),children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-heading","aria-hidden":"true",children:n(f.labelKey)}),f.children]},f.id))})}):null]})}function jg(e,t){return e.value===t.value&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason}function xn(e){let t=A(),n=Ye.useRef(e);n.current=e;let o=Ye.useCallback(s=>{let c=n.current,l=editor.toolbarCommandState(t,c);return {value:l.value??null,enabled:l.enabled,disabledReason:l.disabledReason}},[t,e]),r=q(o,jg),a=Ye.useMemo(()=>({execute:s=>editor.runToolbarCommand(t,"image.wrap",s),value:r.value??null,options:editor.IMAGE_WRAP_TARGETS,isEnabled:r.enabled,disabledReason:r.disabledReason}),[t,r]),i=Ye.useMemo(()=>({execute:s=>editor.runToolbarCommand(t,"image.altText",s),value:r.value,options:[],isEnabled:r.enabled,disabledReason:r.disabledReason}),[t,r]);return e==="image.wrap"?a:i}var nl=[{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 Jr({className:e,hidden:t,asChild:n,children:o}){let{t:r}=_(),a=Y(),{execute:i,value:s,isEnabled:c,disabledReason:l}=xn("image.wrap"),[d,p]=Ye.useState(false),g=Ye.useRef(null),m=Ye.useRef(null),f=Ye.useRef(null),u=Ye.useId(),h=Ye.useMemo(()=>nl.find(y=>y.value===s)??nl[0],[s]),b=ee("image.wrap"),v=a(b?.labelKey??"formattingBar.imageWrap");Ye.useEffect(()=>{if(!d)return;let y=M=>{let E=g.current;E&&M.target instanceof Node&&E.contains(M.target)||p(false);},x=M=>{M.key==="Escape"&&(M.preventDefault(),p(false),m.current?.focus());};return document.addEventListener("mousedown",y,true),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",y,true),document.removeEventListener("keydown",x);}},[d]);let C=Ye.useCallback(y=>{p(false),i(y);},[i]);if(t)return null;let P=r("imageWrap.tooltipPrefix",{label:r(h.labelKey)}),S={type:"button",ref:m,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?u:void 0,"aria-label":v,title:l??P,onMouseDown:O,onClick:()=>p(y=>!y)};return jsxRuntime.jsxs("div",{ref:g,className:"docx-toolbar__image-wrap",children:[n?jsxRuntime.jsx(W,{...S,children:o}):jsxRuntime.jsx("button",{...S,children:o??te(b?.paths)}),d?jsxRuntime.jsx("div",{ref:f,id:u,role:"menu",className:"docx-toolbar__image-wrap-menu","aria-label":r("imageWrap.menu.ariaLabel"),onMouseDown:y=>y.stopPropagation(),children:nl.map(y=>jsxRuntime.jsx("button",{type:"button",role:"menuitemradio",className:"docx-toolbar__image-wrap-item","aria-checked":s===y.value,...s===y.value?{"data-active":""}:{},onMouseDown:O,onClick:()=>C(y.value),children:r(y.labelKey)},y.value))}):null]})}Jr.docxSlot="image.wrap";var Tn=Object.assign(Jr,{docxSlot:"image.wrap"});function ea({className:e,hidden:t,asChild:n,children:o}){let{t:r}=_(),a=Y(),{execute:i,value:s,isEnabled:c,disabledReason:l}=xn("image.altText"),[d,p]=Ye.useState(false),[g,m]=Ye.useState(""),f=Ye.useRef(null),u=Ye.useRef(null),h=Ye.useId();Ye.useEffect(()=>{d&&m(s??"");},[d,s]),Ye.useEffect(()=>{if(!d)return;let S=x=>{let M=f.current;M&&x.target instanceof Node&&M.contains(x.target)||p(false);},y=x=>{x.key==="Escape"&&(x.preventDefault(),p(false),u.current?.focus());};return document.addEventListener("mousedown",S,true),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",S,true),document.removeEventListener("keydown",y);}},[d]);let b=Ye.useCallback(()=>{i(g),p(false);},[g,i]);if(t)return null;let v=ee("image.altText"),C=a(v?.labelKey??"formattingBar.altText"),P={type:"button",ref:u,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?h:void 0,"aria-label":C,title:l??C,onMouseDown:O,onClick:()=>p(S=>!S)};return jsxRuntime.jsxs("div",{ref:f,className:"docx-toolbar__alt-text",children:[n?jsxRuntime.jsx(W,{...P,children:o}):jsxRuntime.jsx("button",{...P,children:o??C}),d?jsxRuntime.jsxs("div",{id:h,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:`${h}-description`,children:r("imageAltText.description")}),jsxRuntime.jsx("textarea",{id:`${h}-description`,className:"docx-dialog__textarea",value:g,onChange:S=>m(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:()=>p(false),children:r("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:b,children:r("common.apply")})]})]}):null]})}ea.docxSlot="image.altText";var Sn=Object.assign(ea,{docxSlot:"image.altText"});var Cd=e=>e.image;function Sd(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 pb(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function sl(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(It(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(It(t.verticalEmu)):"",relativeToH:"page",relativeToV:"line"}:{positionMode:"frame",horizontalPoints:t.horizontalEmu!==void 0?String(It(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(It(t.verticalEmu)):"",relativeToH:t.relativeToH??"page",relativeToV:t.relativeToV??"line"}}function mb(e,t){let n=sl(t);return e.horizontalPoints!==n.horizontalPoints||e.verticalPoints!==n.verticalPoints||e.relativeToH!==n.relativeToH||e.relativeToV!==n.relativeToV}function ta(e){if(e.trim()==="")return null;let t=Number(e);if(!Number.isFinite(t))return null;let n=cn(t);return Number.isInteger(n)?n:null}function fb(e,t){let n=sl(t);if(e.positionMode==="simple"||t.position?.mode==="simple"){let l=e.horizontalPoints!==n.horizontalPoints,d=e.verticalPoints!==n.verticalPoints,p=l?ta(e.horizontalPoints):t.position?.horizontalEmu,g=d?ta(e.verticalPoints):t.position?.verticalEmu;return l&&p===null?{ok:false}:d&&g===null?{ok:false}:p===void 0||g===void 0?{ok:false}:{ok:true,value:{horizontalEmu:p,verticalEmu:g}}}let o=e.horizontalPoints!==n.horizontalPoints,r=e.verticalPoints!==n.verticalPoints,a=e.relativeToH!==n.relativeToH,i=e.relativeToV!==n.relativeToV,s=o?ta(e.horizontalPoints):t.position?.horizontalEmu,c=r?ta(e.verticalPoints):t.position?.verticalEmu;return o&&s===null?{ok:false}:r&&c===null?{ok:false}:{ok:true,value:{...typeof s=="number"?{horizontalEmu:s}:{},...typeof c=="number"?{verticalEmu:c}:{},...a||o||r?{relativeToH:e.relativeToH}:{},...i||o||r?{relativeToV:e.relativeToV}:{}}}}function oa(e){let t=Number(e);return !Number.isFinite(t)||t<0||t>100?null:t}function na(e){let t=Number(e);return !Number.isFinite(t)||t<=0?null:t}function cl({open:e,onClose:t,className:n,triggerRef:o}){let r=A(),{t:a}=_(),i=q(Cd),s=Ye.useId(),c=Ye.useId(),l=Ye.useId(),d=Ye.useRef(null),p=Ye.useRef(null),g=Ye.useRef(null),m=Ye.useRef(null),[f,u]=Ye.useState(null),[h,b]=Ye.useState(null),v=p.current,C=v?.canCrop===false,P=v?.canResize===false,S=v?.locks.changeAspect===true,y=v?.kind==="anchored"&&v.canMove===true,x=v?.kind==="inline",M=v?.kind==="anchored"&&v.canMove===false;Ye.useEffect(()=>{if(!e){p.current=null,g.current=null,m.current=null;return}if(!i)return;if(p.current=i,r?.surface){let{anchor:z}=r.surface.state().selection;g.current={paragraphId:z.paragraphId,offset:z.offset},m.current=r.surface.session.packageRevision();}b(null);let k=sl(i),R=i.crop;u({widthPoints:String(It(i.widthEmu)),heightPoints:String(It(i.heightEmu)),cropLeft:String(R.left),cropTop:String(R.top),cropRight:String(R.right),cropBottom:String(R.bottom),title:i.title,description:i.description,hyperlink:i.hyperlink??"",wrap:i.wrap,lockAspect:i.locks.changeAspect,...k});},[e,i?.id,i?.widthEmu,i?.heightEmu,r]);let E=Ye.useCallback(()=>{o?.current?.focus(),r?.focus();},[r,o]),w=Ye.useCallback(()=>{t(),E();},[t,E]);Ye.useEffect(()=>{if(!e)return;let k=d.current;if(!k)return;let R=Sd(k);(R.find($=>$.id==="image-prop-width"&&!$.hasAttribute("disabled"))??R.find($=>!$.hasAttribute("disabled"))??k).focus();let Z=$=>{if($.key==="Escape"){$.preventDefault(),w();return}if($.key!=="Tab")return;let Q=Sd(k);if(Q.length===0)return;let Me=document.activeElement,se=Q.findIndex(Ce=>Ce===Me);if(se===-1)return;$.preventDefault();let Te=$.shiftKey?(se-1+Q.length)%Q.length:(se+1)%Q.length;Q[Te]?.focus();};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[e,w]);let N=Ye.useMemo(()=>{let k=v??i;return !k||k.widthEmu<=0?1:k.widthEmu/k.heightEmu},[i,v]),F=Ye.useCallback(k=>{u(R=>{if(!R)return R;if(!R.lockAspect)return {...R,widthPoints:k};let z=na(k);if(z===null)return {...R,widthPoints:k};let Z=Math.round(z/N*100)/100;return {...R,widthPoints:k,heightPoints:String(Z)}});},[N]),H=Ye.useCallback(k=>{u(R=>{if(!R)return R;if(!R.lockAspect)return {...R,heightPoints:k};let z=na(k);if(z===null)return {...R,heightPoints:k};let Z=Math.round(z*N*100)/100;return {...R,widthPoints:String(Z),heightPoints:k}});},[N]),I=Ye.useCallback(()=>{let k=p.current;if(!k?.intrinsic)return;let R=k.intrinsic.pixelWidth*72/k.intrinsic.dpiX,z=k.intrinsic.pixelHeight*72/k.intrinsic.dpiY;u(Z=>Z&&{...Z,widthPoints:String(Math.round(R*100)/100),heightPoints:String(Math.round(z*100)/100)});},[i]),D=Ye.useCallback(()=>{let k=p.current,R=g.current,z=m.current;if(!r||!k||!f||!R||z===null)return;let Z={type:"setImageProperties",drawingNodeId:k.id,expectedPackageRevision:z,selectionParagraphId:R.paragraphId,selectionOffset:R.offset};if(!P){let Ce=na(f.widthPoints),G=na(f.heightPoints);if(Ce===null||G===null){b("imageProperties.errors.invalidDimensions");return}let B=cn(Ce),Pe=cn(G);B!==k.widthEmu&&(Z.widthEmu=B),Pe!==k.heightEmu&&(Z.heightEmu=Pe);}if(k.canCrop&&!C){let Ce=oa(f.cropLeft),G=oa(f.cropTop),B=oa(f.cropRight),Pe=oa(f.cropBottom);if(Ce===null||G===null||B===null||Pe===null){b("imageProperties.errors.invalidCrop");return}let Ue=k.crop;(Ce!==Ue.left||G!==Ue.top||B!==Ue.right||Pe!==Ue.bottom)&&(Z.crop={left:Ce,top:G,right:B,bottom:Pe});}f.title!==k.title&&(Z.title=f.title),f.description!==k.description&&(Z.description=f.description);let $=f.hyperlink.trim();if($!==(k.hyperlink??"")&&(Z.hyperlink=$===""?null:$),k.canChangeWrap&&f.wrap!==k.wrap&&(Z.wrap=f.wrap),k.kind==="anchored"&&k.canMove&&mb(f,k)){let Ce=fb(f,k);if(!Ce.ok){b("imageProperties.errors.invalidPosition");return}if(!editor.validateDrawingPositionInput(editor.positionInputFromPropertiesCommand(Ce.value,k))){b("imageProperties.errors.invalidPosition");return}Object.assign(Z,Ce.value);}if(!(Z.widthEmu!==void 0||Z.heightEmu!==void 0||Z.title!==void 0||Z.description!==void 0||Z.hyperlink!==void 0||Z.crop!==void 0||Z.wrap!==void 0||Z.horizontalEmu!==void 0||Z.verticalEmu!==void 0||Z.relativeToH!==void 0||Z.relativeToV!==void 0)){w();return}if(!r.can(Z).ok){b("imageProperties.errors.refused");return}if(!r.exec(Z).ok){b("imageProperties.errors.refused");return}w();},[r,f,C,P,w]);return !e||!f?null:jsxRuntime.jsx("div",{className:`docx-dialog-overlay${n?` ${n}`:""}`,onClick:w,onMouseDown:k=>{k.stopPropagation(),pb(k);},children:jsxRuntime.jsxs("div",{ref:d,role:"dialog","aria-modal":"true","aria-labelledby":s,className:"docx-dialog docx-image-properties-dialog",onClick:k=>k.stopPropagation(),onMouseDown:k=>k.stopPropagation(),children:[jsxRuntime.jsx("div",{id:s,className:"docx-dialog__header",children:a("dialogs.imageProperties.title")}),jsxRuntime.jsxs("div",{className:"docx-dialog__body",children:[h?jsxRuntime.jsx("p",{className:"docx-dialog__error",children:a(h)}):null,jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.imageProperties.dimensions")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-width",children:a("dialogs.imageProperties.widthLabel")}),jsxRuntime.jsx("input",{id:"image-prop-width",className:"docx-dialog__input",value:f.widthPoints,disabled:P,onChange:k=>F(k.target.value)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("imageProperties.units.points")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-height",children:a("dialogs.imageProperties.heightLabel")}),jsxRuntime.jsx("input",{id:"image-prop-height",className:"docx-dialog__input",value:f.heightPoints,disabled:P,onChange:k=>H(k.target.value)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("imageProperties.units.points")})]}),jsxRuntime.jsxs("label",{className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:f.lockAspect,disabled:S,onChange:k=>u(R=>R&&{...R,lockAspect:k.target.checked})}),a("dialogs.imageProperties.lockAspectRatio")]}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__link-button",disabled:C||!v?.intrinsic,onClick:I,children:a("imageProperties.resetNaturalSize")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("imageProperties.position")}),x?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:a("imageProperties.positionUnavailable")}):null,M?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:a("imageProperties.positionLocked")}):null,y?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[f.positionMode==="frame"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-rel-h",children:a("imageProperties.relativeToHorizontal")}),jsxRuntime.jsx("select",{id:"image-pos-rel-h",className:"docx-dialog__select",value:f.relativeToH??"page",onChange:k=>u(R=>R&&{...R,relativeToH:k.target.value}),children:editor.DRAWING_REL_FROM_H.map(k=>jsxRuntime.jsx("option",{value:k,children:a(`dialogs.imagePosition.relativeOptions.${k}`)},k))})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-rel-v",children:a("imageProperties.relativeToVertical")}),jsxRuntime.jsx("select",{id:"image-pos-rel-v",className:"docx-dialog__select",value:f.relativeToV??"line",onChange:k=>u(R=>R&&{...R,relativeToV:k.target.value}),children:editor.DRAWING_REL_FROM_V.map(k=>jsxRuntime.jsx("option",{value:k,children:a(`dialogs.imagePosition.relativeOptions.${k}`)},k))})]})]}):null,jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-h",children:a("imageProperties.horizontalOffset")}),jsxRuntime.jsx("input",{id:"image-pos-h",className:"docx-dialog__input",value:f.horizontalPoints,onChange:k=>u(R=>R&&{...R,horizontalPoints:k.target.value})}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("imageProperties.units.points")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-v",children:a("imageProperties.verticalOffset")}),jsxRuntime.jsx("input",{id:"image-pos-v",className:"docx-dialog__input",value:f.verticalPoints,onChange:k=>u(R=>R&&{...R,verticalPoints:k.target.value})}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("imageProperties.units.points")})]})]}):null]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.imageProperties.altText")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-title",children:a("imageAltText.title")}),jsxRuntime.jsx("input",{id:"image-prop-title",className:"docx-dialog__input",value:f.title,onChange:k=>u(R=>R&&{...R,title:k.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-description",children:a("imageAltText.description")}),jsxRuntime.jsx("textarea",{id:"image-prop-description",className:"docx-dialog__textarea",value:f.description,onChange:k=>u(R=>R&&{...R,description:k.target.value}),placeholder:a("dialogs.imageProperties.altTextPlaceholder")})]})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("imageProperties.hyperlink")}),jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:l,children:a("hyperlinkPopup.urlLabel")}),jsxRuntime.jsx("input",{id:l,className:"docx-dialog__input docx-dialog__input--full",value:f.hyperlink,onChange:k=>u(R=>R&&{...R,hyperlink:k.target.value}),placeholder:a("hyperlinkPopup.urlPlaceholder")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.imageProperties.textWrapping")}),jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:c,children:a("formattingBar.imageWrap")}),jsxRuntime.jsx("select",{id:c,className:"docx-dialog__select docx-dialog__input--full",value:f.wrap,disabled:v?.canChangeWrap===false,onChange:k=>u(R=>R&&{...R,wrap:k.target.value}),children:editor.IMAGE_WRAP_TARGETS.map(k=>jsxRuntime.jsx("option",{value:k,children:a(`imageWrap.targets.${k}`)},k))})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("imageProperties.crop")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-left",children:a("imageProperties.cropLeft")}),jsxRuntime.jsx("input",{id:"image-crop-left",className:"docx-dialog__input",disabled:C,value:f.cropLeft,onChange:k=>u(R=>R&&{...R,cropLeft:k.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-top",children:a("imageProperties.cropTop")}),jsxRuntime.jsx("input",{id:"image-crop-top",className:"docx-dialog__input",disabled:C,value:f.cropTop,onChange:k=>u(R=>R&&{...R,cropTop:k.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-right",children:a("imageProperties.cropRight")}),jsxRuntime.jsx("input",{id:"image-crop-right",className:"docx-dialog__input",disabled:C,value:f.cropRight,onChange:k=>u(R=>R&&{...R,cropRight:k.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-bottom",children:a("imageProperties.cropBottom")}),jsxRuntime.jsx("input",{id:"image-crop-bottom",className:"docx-dialog__input",disabled:C,value:f.cropBottom,onChange:k=>u(R=>R&&{...R,cropBottom:k.target.value})})]}),C?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:a("imageProperties.nonPictureHint")}):null]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__footer",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:w,children:a("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:D,children:a("common.apply")})]})]})})}function ra({className:e,hidden:t,asChild:n,children:o}){let r=A(),{t:a}=_(),i=q(Cd),[s,c]=Ye.useState(false),l=Ye.useRef(null),d={type:"setImageProperties",description:"probe"},p=r&&i?r.can(d):null,g=p?.ok===true,m=p&&!p.ok?p.reason:null;if(t)return null;let f=ee("image.properties"),u={type:"button",ref:l,className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"image.properties",disabled:!g,...g?{}:{"data-disabled":""},"aria-label":a("formattingBar.imagePropertiesShortcut"),title:m??a("formattingBar.imagePropertiesShortcut"),onMouseDown:O,onClick:()=>c(true)};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n?jsxRuntime.jsx(W,{...u,children:o}):jsxRuntime.jsx("button",{...u,children:o??te(f?.paths)}),jsxRuntime.jsx(cl,{open:s,onClose:()=>c(false),triggerRef:l})]})}ra.docxSlot="image.properties";var Pn=Object.assign(ra,{docxSlot:"image.properties"});function Ee(e){return Object.assign(n=>jsxRuntime.jsx(Xt,{slot:e,...n}),{docxSlot:e})}var Pd=Ee("history.undo"),Ed=Ee("history.redo"),wd=Ee("text.bold"),Md=Ee("text.italic"),kd=Ee("text.underline"),Id=Ee("text.strike"),Rd=Ee("format.clear"),_d=Ee("script.super"),Nd=Ee("script.sub"),Dd=Ee("alignment.left"),Ld=Ee("alignment.center"),Hd=Ee("alignment.right"),Fd=Ee("alignment.justify"),Ad=Ee("list.bullet"),Od=Ee("list.numbered"),Zd=Ee("list.outdent"),Bd=Ee("list.indent");var qd=Ee("table.insert"),Kd=Ee("review.comments");function hb({className:e,hidden:t,icon:n,asChild:o,children:r}){let a=A(),{openAtCaret:i}=Bi(),s=editor.chromeProbeForSlot("text.link"),c=a&&s?a.can(s):null,l=c?.ok===true,d=c&&!c.ok?c.reason:null,p=Y();if(t)return null;let g=ee("text.link"),m=p(g?.labelKey??"text.link"),f={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"text.link",disabled:!l,...l?{}:{"data-disabled":""},"aria-label":m,title:d??m,onMouseDown:O,onClick:()=>i()};return o?jsxRuntime.jsx(W,{...f,children:r}):jsxRuntime.jsx("button",{...f,children:n??r??te(g?.paths)})}var dl=Object.assign(hb,{docxSlot:"text.link"});function vb({className:e,hidden:t}){let n=A(),{onSave:o}=Ye.useContext(dn),r=Y();if(t)return null;let a=ee("file.save"),i=r(a?.labelKey??"file.save"),s=!n||!o;return jsxRuntime.jsx("button",{type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"file.save",disabled:s,...s?{"data-disabled":""}:{},"aria-label":i,title:i,onMouseDown:O,onClick:()=>o?.(),children:te(a?.paths)})}var ul=Object.assign(vb,{docxSlot:"file.save"});function Ho({className:e}){return jsxRuntime.jsx("div",{role:"separator","aria-orientation":"vertical",className:`docx-toolbar__separator${e?` ${e}`:""}`})}function Fo(e){let t=e?.closest(".docx-editor")??null;for(;t&&!t.querySelector(".docx-pages");)t=t.parentElement?.closest(".docx-editor")??null;return t}var Tb=e=>({zoom:e.zoom,mode:e.zoomMode}),Sb=(e,t)=>e.zoom===t.zoom&&e.mode===t.mode,Vd={type:"fixed"};function pl(){let e=A(),{zoom:t,mode:n}=q(Tb,Sb),o=Ye.useCallback(a=>{e?.setZoom(a);},[e]),r=Ye.useCallback(a=>{e?.setZoomMode(a);},[e]);return Ye.useMemo(()=>{let a=n??Vd,i=bn(t,"out"),s=bn(t,"in");return {zoom:t,mode:a,isFit:a.type==="fit",setZoom:o,setMode:r,fitToWidth:()=>r(editor.FIT_WIDTH_ZOOM_MODE),auto:()=>r("auto"),reset:()=>{r(Vd),o(1);},zoomIn:()=>s!==null&&o(s),zoomOut:()=>i!==null&&o(i),canZoomIn:!!e&&s!==null,canZoomOut:!!e&&i!==null,levels:Vr}},[e,t,n,o,r])}var Mn=2,kn=3276,wn=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],Eb=e=>e.formatting?.fontSizePt??null;function Ud(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function Gd(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 Xd(e){return jsxRuntime.jsxs("span",{className:`docx-toolbar__stepper${e.className?` ${e.className}`:""}`,...e.slot!==void 0?{"data-slot":e.slot}:{},role:"group","aria-label":e.groupLabel,title:e.title??e.groupLabel,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__stepper-button",disabled:!e.canDecrease,"aria-label":e.decreaseLabel,onMouseDown:O,onClick:e.onDecrease,children:"\u2212"}),e.middle,jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__stepper-button",disabled:!e.canIncrease,"aria-label":e.increaseLabel,onMouseDown:O,onClick:e.onIncrease,children:"+"})]})}function wb(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<Mn||o>kn?null:o}function Mb({className:e,hidden:t}){let n=A(),o=q(Eb),{isEnabled:r,disabledReason:a}=ne("font.size"),i=Y(),[s,c]=Ye.useState(false),[l,d]=Ye.useState(null),p=Ye.useRef(null),g=Ye.useRef(null),m=Ye.useCallback(S=>{if(!n)return;let y=editor.commandForSlotValue("font.size",S);y&&n.can(y).ok&&n.exec(y);},[n]),f=Ye.useCallback(S=>{m(Math.min(kn,Math.max(Mn,Math.round(S*2))));},[m]),u=Ye.useCallback(S=>{c(false),d(null),g.current?.blur(),S&&kb(p.current);},[]);if(Ye.useEffect(()=>{if(!s)return;let S=y=>{let x=p.current;x&&y.target instanceof Node&&x.contains(y.target)||(c(false),d(null));};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[s]),t)return null;let h=r&&o!==null,b=o===null?"\u2014":String(Math.round(o*2)/2),v=l??b,C=o===null?null:Math.round(o*2)/2,P=()=>{if(l===null)return;let S=wb(l);S!==null&&m(S);};return jsxRuntime.jsxs("span",{ref:p,className:"docx-toolbar__font-size","data-slot":"font.size",title:a??void 0,children:[jsxRuntime.jsx(Xd,{className:e,groupLabel:i("fontSize.label"),decreaseLabel:i("fontSize.decrease"),increaseLabel:i("fontSize.increase"),middle:jsxRuntime.jsx("input",{ref:g,type:"text",inputMode:"decimal",className:"docx-toolbar__stepper-value docx-toolbar__stepper-value--boxed docx-toolbar__font-size-input",value:v,disabled:!r,role:"combobox","aria-expanded":s,"aria-haspopup":"listbox","aria-label":i("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(),P(),u(true)):S.key==="Escape"?(S.preventDefault(),u(true)):(S.key==="ArrowDown"||S.key==="ArrowUp")&&(S.preventDefault(),c(true),o!==null&&f(S.key==="ArrowDown"?Gd(o,wn,Mn/2):Ud(o,wn,kn/2)));},onBlur:()=>{P(),d(null);}}),canDecrease:h&&Math.round(o*2)>Mn,canIncrease:h&&Math.round(o*2)<kn,onDecrease:()=>f(Gd(o??0,wn,Mn/2)),onIncrease:()=>f(Ud(o??0,wn,kn/2))}),s&&r?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__font-size-menu",role:"listbox","aria-label":i("fontSize.listLabel"),children:wn.map(S=>{let y=C===S;return jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":y,...y?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>{f(S),u(true);},children:S},S)})}):null]})}function kb(e){(Fo(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}var gl=Object.assign(Mb,{docxSlot:"font.size"});function Ib({className:e,hidden:t}){let n=A(),{zoom:o,isFit:r,mode:a,setZoom:i,setMode:s,zoomIn:c,zoomOut:l,canZoomIn:d,canZoomOut:p,levels:g}=pl(),m=Y(),[f,u]=Ye.useState(false),h=Ye.useRef(null);Ye.useEffect(()=>{if(!f)return;let y=x=>{let M=h.current;M&&x.target instanceof Node&&M.contains(x.target)||u(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[f]);let b=Ye.useCallback(y=>{u(false),i(y);},[i]),v=Ye.useCallback(y=>{u(false),s(y==="auto"?"auto":editor.FIT_WIDTH_ZOOM_MODE);},[s]);if(t)return null;let C=`${Math.round(o*100)}%`,P=editor.sameZoomMode(a,editor.AUTO_ZOOM_MODE),S=editor.sameZoomMode(a,editor.FIT_WIDTH_ZOOM_MODE);return jsxRuntime.jsxs("span",{ref:h,className:"docx-toolbar__zoom","data-slot":"zoom.level",children:[jsxRuntime.jsx(Xd,{className:e,groupLabel:m("zoom.zoomLevel"),decreaseLabel:m("zoom.zoomOut"),increaseLabel:m("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":f,"aria-label":m("zoom.zoomLevel"),onMouseDown:O,onClick:()=>u(y=>!y),children:[C,jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),canDecrease:p,canIncrease:d,onDecrease:l,onIncrease:c}),f?jsxRuntime.jsxs("div",{className:"docx-toolbar__menu docx-toolbar__zoom-menu",role:"listbox","aria-label":m("zoom.zoomLevel"),children:[jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":P,...P?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>v("auto"),children:m("zoom.automatic")}),jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":S,...S?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>v("fit-width"),children:m("zoom.fitWidth")}),jsxRuntime.jsx("hr",{className:"docx-toolbar__menu-separator",role:"presentation"}),g.map(y=>{let x=!r&&Math.abs(y-o)<.001;return jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":x,...x?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>b(y),children:`${Math.round(y*100)}%`},y)})]}):null]})}var bl=Object.assign(Ib,{docxSlot:"zoom.level"});var Lb=[1,1.15,1.5,2,2.5,3],Qd=10,Hb=e=>({lineSpacing:e.formatting?.lineSpacing??null,spaceBeforePt:e.formatting?.spaceBeforePt??null,spaceAfterPt:e.formatting?.spaceAfterPt??null}),Fb=(e,t)=>e.spaceBeforePt===t.spaceBeforePt&&e.spaceAfterPt===t.spaceAfterPt&&e.lineSpacing?.rule===t.lineSpacing?.rule&&e.lineSpacing?.value===t.lineSpacing?.value;function Ab({className:e,hidden:t}){let n=A(),o=q(Hb,Fb),{isEnabled:r,disabledReason:a}=ne("list.lineSpacing"),i=Y(),[s,c]=Ye.useState(false),l=Ye.useRef(null);Ye.useEffect(()=>{if(!s)return;let h=b=>{let v=l.current;v&&b.target instanceof Node&&v.contains(b.target)||c(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]);let d=Ye.useCallback(h=>{if(c(false),!n)return;let b=editor.commandForSlotValue("list.lineSpacing",h);b&&n.can(b).ok&&n.exec(b);},[n]),p=Ye.useCallback((h,b)=>{if(c(false),!n)return;let v={type:"setParagraphSpacing",[h]:b};n.can(v).ok&&n.exec(v);},[n]);if(t)return null;let g=ee("list.lineSpacing"),m=(o.spaceBeforePt??0)>0,f=(o.spaceAfterPt??0)>0,u=o.lineSpacing?.rule==="multiple"?o.lineSpacing?.value??null:null;return jsxRuntime.jsxs("span",{ref:l,className:"docx-toolbar__line-spacing","data-slot":"list.lineSpacing",children:[jsxRuntime.jsxs("button",{type:"button",className:`docx-toolbar__button docx-toolbar__line-spacing-trigger${e?` ${e}`:""}`,disabled:!r,...r?{}:{"data-disabled":""},"aria-haspopup":"menu","aria-expanded":s,"aria-label":i("lineSpacing.label"),title:a??i("lineSpacing.label"),onMouseDown:O,onClick:()=>c(h=>!h),children:[te(g?.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:[Lb.map(h=>{let b=u===h;return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":b,...b?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>d(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",onMouseDown:O,onClick:()=>p("beforePt",m?null:Qd),children:i(m?"lineSpacing.removeSpaceBefore":"lineSpacing.addSpaceBefore")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>p("afterPt",f?null:Qd),children:i(f?"lineSpacing.removeSpaceAfter":"lineSpacing.addSpaceAfter")})]}):null]})}var vl=Object.assign(Ab,{docxSlot:"list.lineSpacing"});var zb=[{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"}],Jd=[{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"}],eu=["FFFFFF","000000","E7E6E6","44546A","4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47"],aa=["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"],Dt=e=>({labelKey:`colorPicker.theme.lighter${e}`,apply:t=>t+(255-t)*(e/100)}),Qe=e=>({labelKey:`colorPicker.theme.darker${e}`,apply:t=>t*(1-e/100)});function Vb(e){let t=[0,2,4].map(o=>parseInt(e.slice(o,o+2),16)),n=(Math.max(...t)+Math.min(...t))/2/255;return n===1?[Qe(5),Qe(15),Qe(25),Qe(35),Qe(50)]:n===0?[Dt(50),Dt(35),Dt(25),Dt(15),Dt(5)]:n>=.8?[Qe(10),Qe(25),Qe(50),Qe(75),Qe(90)]:[Dt(80),Dt(60),Dt(40),Qe(25),Qe(50)]}var $b=/^[0-9A-Fa-f]{6}$/;function Wb(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 Ub(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 ia({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":""}:{},...Ub(t.replace("#",""))?{"data-light":""}:{},onMouseDown:O,onClick:()=>r(e)})}function Gb({apply:e,label:t,current:n,themeHexes:o}){let r=o.map(Vb),a=[0,1,2,3,4];return jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:t("colorPicker.themeColors")}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-grid docx-toolbar__swatch-grid--theme",role:"group",children:[o.map((i,s)=>jsxRuntime.jsx(ia,{value:i,css:`#${i.toLowerCase()}`,title:t(aa[s]),selected:n===i,apply:e},`base-${s}`)),a.map(i=>o.map((s,c)=>{let l=r[c][i],d=Wb(s,l.apply);return jsxRuntime.jsx(ia,{value:d,css:`#${d.toLowerCase()}`,title:`${t(aa[c])}, ${t(l.labelKey)}`,selected:n===d,apply:e},`${i}-${c}`)}))]})]})}function Yb(e){let{apply:t,label:n,current:o}=e,[r,a]=Ye.useState(""),i=$b.test(r);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Gb,{...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:zb.map(s=>jsxRuntime.jsx(ia,{value:s.value,css:s.css,title:n(s.labelKey),selected:o===s.value,apply:t},s.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:s=>a(s.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:s=>{s.key==="Enter"&&i&&t(r.toUpperCase());}}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__swatch-apply",disabled:!i,onMouseDown:O,onClick:()=>t(r.toUpperCase()),children:n("colorPicker.apply")})]})]})]})}function xl({apply:e,current:t}){let n=A(),o=Y(),r=n?.getDocumentThemeColors()??[],a=r.length===aa.length?r.map(s=>s.hex):eu,i=t?.toUpperCase()??null;return jsxRuntime.jsx(Yb,{apply:e,label:o,current:i,themeHexes:a})}var Xb=Jd.filter(e=>e.value!=="white");function jb({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:Xb.map(o=>jsxRuntime.jsx(ia,{value:o.value,css:o.css,title:t(o.labelKey),selected:n===o.value,apply:e},o.value))})]})}function tu(e){let{slot:t,defaultValue:n,cssOf:o,clear:r,body:a}=e,i=t==="text.color";return Object.assign(({className:c,hidden:l,icon:d})=>{let p=A(),{isEnabled:g,disabledReason:m}=ne(t),f=Y(),[u,h]=Ye.useState(false),[b,v]=Ye.useState(n),C=Ye.useRef(null),P=q(w=>{if(i){let N=w.formatting?.color;return N&&N.kind==="hex"?N.value.toUpperCase():null}return w.formatting?.highlight??null}),S=p?.getDocumentThemeColors()??[],y=S.length===aa.length?S.map(w=>w.hex):eu;Ye.useEffect(()=>{if(!u)return;let w=N=>{let F=C.current;F&&N.target instanceof Node&&F.contains(N.target)||h(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[u]);let x=Ye.useCallback(w=>{if(h(false),!p)return;let N=editor.commandForSlotValue(t,w);N&&p.can(N).ok&&(p.exec(N),w!==r.value&&v(w));},[p]),M=Ye.useMemo(()=>ee(t),[]);if(l)return null;let E=f(M?.labelKey??t);return jsxRuntime.jsxs("div",{ref:C,className:`docx-toolbar__colorsplit${c?` ${c}`:""}`,"data-slot":t,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__button docx-toolbar__colorsplit-main",disabled:!g,...g?{}:{"data-disabled":""},"aria-label":E,title:m??E,onMouseDown:O,onClick:()=>x(b),children:[d??te(M?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:o(b)},"aria-hidden":"true"})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__colorsplit-caret",disabled:!g,...g?{}:{"data-disabled":""},"aria-haspopup":"true","aria-expanded":u,"aria-label":E,title:m??E,onMouseDown:O,onClick:()=>h(w=>!w),children:"\u25BE"}),u?jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-popup",role:"dialog","aria-label":E,onMouseDown:O,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:O,onClick:()=>x(r.value),children:[jsxRuntime.jsx("span",{className:`docx-toolbar__swatch-clear-chip${r.value==="none"?" docx-toolbar__swatch-clear-chip--none":""}`,"aria-hidden":"true"}),f(r.labelKey)]}),a({apply:x,label:f,current:P,themeHexes:y})]}):null]})},{docxSlot:t})}var Qb=new Map(Jd.map(e=>[e.value,e.css])),Tl=tu({slot:"text.color",defaultValue:"FF0000",cssOf:e=>e==="auto"?"#000000":`#${e}`,clear:{value:"auto",labelKey:"colorPicker.automatic"},body:e=>jsxRuntime.jsx(xl,{apply:e.apply,current:e.current})}),Sl=tu({slot:"text.highlight",defaultValue:"yellow",cssOf:e=>Qb.get(e)??"#ffff00",clear:{value:"none",labelKey:"colorPicker.noColor"},body:e=>jsxRuntime.jsx(jb,{...e})});var nh=["alignment.left","alignment.center","alignment.right","alignment.justify"];function rh({className:e,hidden:t}){let n=ne("alignment.left"),o=ne("alignment.center"),r=ne("alignment.right"),a=ne("alignment.justify"),i=Y(),[s,c]=Ye.useState(false),l=Ye.useRef(null);if(Ye.useEffect(()=>{if(!s)return;let u=h=>{let b=l.current;b&&h.target instanceof Node&&b.contains(h.target)||c(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),t)return null;let d=[n,o,r,a],p=nh.map((u,h)=>({slot:u,control:ee(u),state:d[h]})),g=p.find(u=>u.state.isActive)??p[0],m=p.some(u=>u.state.isEnabled),f=i(g.control?.labelKey??g.slot);return jsxRuntime.jsxs("div",{ref:l,className:`docx-toolbar__alignment${e?` ${e}`:""}`,"data-slot":"alignment",children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__button docx-toolbar__alignment-trigger",disabled:!m,...m?{}:{"data-disabled":""},"aria-haspopup":"true","aria-expanded":s,"aria-label":f,title:m?f:g.state.disabledReason??f,onMouseDown:O,onClick:()=>c(u=>!u),children:[te(g.control?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),s?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__alignment-popup",children:p.map(u=>{let h=i(u.control?.labelKey??u.slot);return jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__button docx-toolbar__alignment-option","data-slot":u.slot,disabled:!u.state.isEnabled,...u.state.isActive?{"data-active":""}:{},"aria-pressed":u.state.isActive,"aria-label":h,title:u.state.disabledReason??h,onMouseDown:O,onClick:()=>{u.state.execute(),c(false);},children:te(u.control?.paths)},u.slot)})}):null]})}var la=Object.assign(rh,{docxSlot:"alignment"});function Pl(e){let{label:t,icon:n,active:o,disabled:r,disabledReason:a,onSelect:i,asChild:s,className:c,children:l}=e,d={type:"button",className:`docx-toolbar__button${c?` ${c}`:""}`,disabled:r,...o?{"data-active":""}:{},...r?{"data-disabled":""}:{},...o!==void 0?{"aria-pressed":o}:{},"aria-label":t,title:r?a??t:t,onMouseDown:p=>O(p),onClick:r?void 0:i};return s?jsxRuntime.jsx(W,{...d,children:l}):jsxRuntime.jsx("button",{...d,children:n??l})}var ph=Object.freeze([]),mh=e=>e.formatting?.fontFamily??null,fh=e=>e;function sa(){let e=A(),t=q(mh),n=q(fh),o=Ye.useMemo(()=>e&&!n.isLoading?e.getAvailableFonts():ph,[e,n]),{isEnabled:r}=ne("font.family"),a=Ye.useCallback(i=>{if(!e)return;let s=editor.commandForSlotValue("font.family",i);s&&e.can(s).ok&&e.exec(s);},[e]);return Ye.useMemo(()=>({value:t,setValue:a,options:o,isEnabled:r}),[t,a,o,r])}var ru=Ye.createContext(null);function wl(){return Ye.useContext(ru)}function Ml({asChild:e,className:t,children:n}){let o=wl(),r=Y();if(!o)return null;let a=r(ee("font.family")?.labelKey??"font.family"),i={onClick:()=>o.setOpen(!o.open),onMouseDown:O,disabled:!o.isEnabled,className:`docx-toolbar__font-family-trigger${t?` ${t}`:""}`,...o.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":o.open,"aria-label":a,title:a},s=n??jsxRuntime.jsx("span",{children:o.value??"\u2014"});return e?jsxRuntime.jsx(W,{...i,children:s}):jsxRuntime.jsx("button",{type:"button",...i,children:s})}Ml.docxToolbarPart=true;var gh=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"]]),bh=[{category:"sansSerif",labelKey:"font.sansSerif"},{category:"serif",labelKey:"font.serif"},{category:"monospace",labelKey:"font.monospace"},{category:"other",labelKey:null}];function au({asChild:e,className:t,children:n}){let o=wl(),r=Y();if(!o||!o.open)return null;let a={role:"listbox",className:`docx-toolbar__menu docx-toolbar__font-family-content${t?` ${t}`:""}`,style:{position:"absolute",top:"100%",left:0,zIndex:30,minWidth:"100%",maxHeight:300,overflowY:"auto"}},i;return n!==void 0?i=n:i=bh.map(c=>({...c,fonts:o.options.filter(l=>(gh.get(l.toLowerCase())??"other")===c.category)})).filter(c=>c.fonts.length>0).map((c,l)=>jsxRuntime.jsxs("div",{role:"group",children:[l>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(iu,{value:d},d))]},c.category)),e?jsxRuntime.jsx(W,{...a,children:i}):jsxRuntime.jsx("div",{...a,children:i})}function iu({value:e,asChild:t,className:n,children:o}){let r=wl();if(!r)return null;let a=r.value===e,i={role:"option","aria-selected":a,...a?{"data-selected":""}:{},onMouseDown:O,onClick:()=>{r.setValue(e),r.setOpen(false);},className:`docx-toolbar__font-family-item${n?` ${n}`:""}`},s=o??jsxRuntime.jsx("span",{style:{fontFamily:e},children:e});return t?jsxRuntime.jsx(W,{...i,children:s}):jsxRuntime.jsxs("button",{type:"button",...i,children:[s,a?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function hh({hidden:e,asChild:t,className:n,children:o}){let r=sa(),[a,i]=Ye.useState(false),s=Ye.useRef(null);Ye.useEffect(()=>{if(!a)return;let p=g=>{let m=s.current;m&&g.target instanceof Node&&m.contains(g.target)||i(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[a]);let c=Ye.useMemo(()=>({...r,open:a,setOpen:i}),[r,a]);if(e)return null;let l={className:`docx-toolbar__font-family${n?` ${n}`:""}`,"data-slot":"font.family",style:{position:"relative",display:"inline-block"}},d=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ml,{}),jsxRuntime.jsx(au,{})]});return jsxRuntime.jsx(ru.Provider,{value:c,children:t?jsxRuntime.jsx(W,{...l,ref:s,children:d}):jsxRuntime.jsx("div",{ref:s,...l,children:d})})}var kl=Object.assign(hh,{docxSlot:"font.family",Trigger:Ml,Content:au,Item:iu});function wh(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 Mh=Object.freeze([]),kh=e=>e.formatting?.styleId??null,Ih=e=>e;function ca(){let e=A(),t=q(kh),n=q(Ih),o=Ye.useMemo(()=>e&&!n.isLoading?e.getDocumentStyles().filter(i=>i.type==="paragraph").map(i=>({styleId:i.styleId,name:i.name,preview:i.preview})):Mh,[e,n]),{isEnabled:r}=ne("styles.style"),a=Ye.useCallback(i=>{if(!e)return;let s=editor.commandForSlotValue("styles.style",i);s&&e.can(s).ok&&e.exec(s);},[e]);return Ye.useMemo(()=>({value:t,setValue:a,options:o,isEnabled:r}),[t,a,o,r])}var lu=Ye.createContext(null);function _l(){return Ye.useContext(lu)}function Nl({asChild:e,className:t,children:n}){let o=_l(),r=Y();if(!o)return null;let a=ee("styles.style"),i=r(a?.labelKey??"styles.style"),s={onClick:()=>o.setOpen(!o.open),onMouseDown:O,disabled:!o.isEnabled,className:`docx-toolbar__style-trigger${t?` ${t}`:""}`,...o.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":o.open,"aria-label":i,title:i},c=o.options.find(d=>d.styleId===o.value),l=n??(o.value===null?jsxRuntime.jsx("span",{children:a?.valueKey?r(a.valueKey):"\u2014"}):jsxRuntime.jsx("span",{children:c?.name??o.value}));return e?jsxRuntime.jsx(W,{...s,children:l}):jsxRuntime.jsx("button",{type:"button",...s,children:l})}Nl.docxToolbarPart=true;function su({asChild:e,className:t,children:n}){let o=_l();if(!o||!o.open)return null;let r={role:"listbox",className:`docx-toolbar__menu docx-toolbar__style-content${t?` ${t}`:""}`,style:{position:"absolute",top:"100%",left:0,zIndex:30,minWidth:"100%",maxHeight:300,overflowY:"auto"}},a=n??o.options.map(i=>jsxRuntime.jsx(cu,{value:i.styleId},i.styleId));return e?jsxRuntime.jsx(W,{...r,children:a}):jsxRuntime.jsx("div",{...r,children:a})}function cu({value:e,asChild:t,className:n,children:o}){let r=_l();if(!r)return null;let a=r.value===e,i=r.options.find(l=>l.styleId===e),s={role:"option","aria-selected":a,...a?{"data-selected":""}:{},onMouseDown:O,onClick:()=>{r.setValue(e),r.setOpen(false);},className:`docx-toolbar__style-item${n?` ${n}`:""}`},c=o??jsxRuntime.jsx("span",{style:i?wh(i.preview):void 0,children:i?.name??e});return t?jsxRuntime.jsx(W,{...s,children:c}):jsxRuntime.jsxs("button",{type:"button",...s,children:[c,a?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function Rh({hidden:e,asChild:t,className:n,children:o}){let r=ca(),[a,i]=Ye.useState(false),s=Ye.useRef(null);Ye.useEffect(()=>{if(!a)return;let p=g=>{let m=s.current;m&&g.target instanceof Node&&m.contains(g.target)||i(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[a]);let c=Ye.useMemo(()=>({...r,open:a,setOpen:i}),[r,a]);if(e)return null;let l={className:`docx-toolbar__style${n?` ${n}`:""}`,"data-slot":"styles.style",style:{position:"relative",display:"inline-block"}},d=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Nl,{}),jsxRuntime.jsx(su,{})]});return jsxRuntime.jsx(lu.Provider,{value:c,children:t?jsxRuntime.jsx(W,{...l,ref:s,children:d}):jsxRuntime.jsx("div",{ref:s,...l,children:d})})}var Dl=Object.assign(Rh,{docxSlot:"styles.style",Trigger:Nl,Content:su,Item:cu});function uu(e,t){let n=e;return Object.assign(({className:r,hidden:a,icon:i,asChild:s,children:c})=>{let{isEnabled:l,disabledReason:d}=ne(n),p=pt(),g=t==="showAll"?p.showAll:p.formFill,m=Y();if(a)return null;let f=ee(n),u=m(f?.labelKey??e),h={type:"button",className:`docx-toolbar__button${r?` ${r}`:""}`,"data-slot":e,disabled:!l,...l?{}:{"data-disabled":""},...g?{"data-active":""}:{},"aria-pressed":g,"aria-label":u,title:d??u,onMouseDown:O,onClick:()=>{t==="showAll"?p.toggleShowAll():p.toggleFormFill();}};return s?jsxRuntime.jsx(W,{...h,children:c}):jsxRuntime.jsx("button",{...h,children:i??c??te(f?.paths)})},{docxSlot:n})}function Nh({className:e,hidden:t,icon:n,asChild:o,children:r}){let a=Be.inspector,{isEnabled:i,disabledReason:s}=ne(a),{inspectorOpen:c,openInspector:l}=pt(),d=Y();if(t)return null;let p=ee(a),g=d(p?.labelKey??"contentControl.inspector"),m={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Be.inspector,disabled:!i,...i?{}:{"data-disabled":""},...c?{"data-active":""}:{},"aria-pressed":c,"aria-label":g,title:s??g,onMouseDown:O,onClick:()=>l()};return o?jsxRuntime.jsx(W,{...m,children:r}):jsxRuntime.jsx("button",{...m,children:n??r??te(p?.paths)})}function Dh({className:e,hidden:t,icon:n,asChild:o,children:r}){let{canRemove:a,removeDisabledReason:i,remove:s}=pt(),c=Y();if(t)return null;let l=Be.remove,d=ee(l),p=c(d?.labelKey??"contentControl.remove"),g={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Be.remove,disabled:!a,...a?{}:{"data-disabled":""},"aria-label":p,title:i??p,onMouseDown:O,onClick:()=>{s();}};return o?jsxRuntime.jsx(W,{...g,children:r}):jsxRuntime.jsx("button",{...g,children:n??r??te(d?.paths)})}var da=uu(Be.showAll,"showAll"),ua=uu(Be.formFill,"formFill"),pa=Object.assign(Dh,{docxSlot:Be.remove}),ma=Object.assign(Nh,{docxSlot:Be.inspector}),pu={[Be.showAll]:da,[Be.formFill]:ua,[Be.inspector]:ma,[Be.remove]:pa};function Ll(e,t){let n=A(),o=Ye.useRef(t);o.current=t,Ye.useEffect(()=>{if(!n)return;let r=((...a)=>{o.current(...a);});return n.on(e,r)},[n,e]);}var Bh=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],Fl=Ye.createContext(null);function yu(){let e=Ye.useContext(Fl);if(!e)throw new Error("table chrome group must render inside TableChromeProvider");return e.visible}function Kh(e,t){let n=t.table,r=(e?.getSelectedTable()??null)?.blockId??"",a=n?`${r}|${n.rows}|${n.columns}|${n.rowIndex}|${n.columnIndex}`:"",i=t.selection,s=i?`${i.from&&"paraId"in i.from?i.from.paraId:""}|${i.to&&"paraId"in i.to?i.to.paraId:""}|${t.selectionCollapsed}`:"",c=e?.getTableCellSelection()??null,l=c?`${c.tableId}|${c.rows.from}-${c.rows.to}|${c.columns.from}-${c.columns.to}|${c.cellIds.join(",")}`:"";return {tableKey:a,selectionKey:s,cellSelectionKey:l,editable:t.editable,editingMode:t.editingMode??"editing"}}function zh(e,t){return e.table===t.table&&e.editable===t.editable&&e.editingMode===t.editingMode&&e.headParagraphId===t.headParagraphId}function Vh(e,t){return e.tableKey===t.tableKey&&e.selectionKey===t.selectionKey&&e.cellSelectionKey===t.cellSelectionKey&&e.editable===t.editable&&e.editingMode===t.editingMode}var hu={tableKey:"",selectionKey:"",cellSelectionKey:"",editable:false,editingMode:"editing"};function $h(e,t){let n={};for(let o of Bh){let r=editor.tableChromeToolbarState(e,o,t);n[o]={enabled:r.enabled,disabledReason:r.disabledReason};}return n}function Al({children:e}){let t=A(),[n,o]=Ye.useState(editor.DEFAULT_TABLE_CHROME_DRAFT),[r,a]=Ye.useState(hu);Ye.useEffect(()=>(()=>{}),[]);let i=q(Ye.useCallback(g=>({table:g.table,editable:g.editable,editingMode:g.editingMode??"editing",headParagraphId:g.selection?.to&&"paraId"in g.selection.to?g.selection.to.paraId:g.selection?.from&&"paraId"in g.selection.from?g.selection.from.paraId:""}),[]),zh,{onSubscribe:()=>{},onUnsubscribe:()=>{}}),s=Ye.useCallback(()=>{if(!t){a(hu);return}let g=Kh(t,t.snapshot());a(m=>Vh(m,g)?m:g);},[t]);Ye.useEffect(()=>{s();},[s,i]),Ll("selectionChange",Ye.useCallback(()=>{s();},[s]));let c=r.tableKey!=="",l=Ye.useMemo(()=>t?$h(t,n):{},[t,n,r.tableKey,r.selectionKey,r.cellSelectionKey,r.editable,r.editingMode]),d=Ye.useCallback((g,m)=>{if(!t)return;let{result:f,nextDraft:u}=editor.runTableChromeCommand(t,g,m,n);f.ok&&u&&o(u);},[t,n]),p=Ye.useMemo(()=>({visible:c,draft:n,setDraft:o,slotState:g=>l[g]??{enabled:false,disabledReason:"editor is not ready"},apply:d}),[c,n,l,d]);return jsxRuntime.jsx(Fl.Provider,{value:p,children:e})}function Wh(){let e=Ye.useContext(Fl);if(!e)throw new Error("table chrome parts must render inside TableChromeProvider");return e}function ga(e){let t=Wh(),n=t.slotState(e);return Ye.useMemo(()=>({visible:t.visible,enabled:n.enabled,disabledReason:n.disabledReason,draft:t.draft,apply:o=>t.apply(e,o)}),[t,e,n])}var Gh='[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]';function Jt(e){return [...e.querySelectorAll(Gh)].filter(t=>t.closest('[role="menu"]')===e)}function Ol(e){return [...e.querySelectorAll(".docx-menubar__trigger")]}function at(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 it(e,t){let n=t==="first"?e[0]:e[e.length-1];return n?(n.focus(),true):false}function ba(e){(Fo(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}function Bl(e,t,n){Ye.useEffect(()=>{if(!e)return;let o=r=>{let a=n.current;a&&r.target instanceof Node&&a.contains(r.target)||t(false);};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,t,n]);}function ha({enabled:e,disabledReason:t,ariaLabel:n}){let o=Ye.useId(),r=!e&&t?o:void 0;return {reasonId:o,shared:{type:"button",onMouseDown:O,"aria-label":n,...r?{"aria-describedby":r}:{},...t?{title:t}:{},...e?{}:{"data-disabled":"","aria-disabled":true}},reasonNode:r&&t?jsxRuntime.jsx("span",{id:o,className:"docx-editor-sr-only",children:t}):null}}var Xh='[role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]';function xu(e,t,n,o){Ye.useEffect(()=>{if(!e)return;let r=n.current,a=o.current;if(!r)return;let i=()=>[...r.querySelectorAll(Xh)].filter(l=>l.closest('[role="menu"]')===r);queueMicrotask(()=>{let l=i();(l.find(p=>p.hasAttribute("data-selected")||p.hasAttribute("data-active"))??l[0])?.focus();});let c=l=>{let d=i();if(l.key==="Escape"){l.preventDefault(),t(false),a?.focus();return}if(l.key==="ArrowDown"){l.preventDefault(),at(d,document.activeElement,1);return}if(l.key==="ArrowUp"){l.preventDefault(),at(d,document.activeElement,-1);return}if(l.key==="Home"){l.preventDefault(),it(d,"first");return}if(l.key==="End"){l.preventDefault(),it(d,"last");return}if(l.key==="Enter"||l.key===" "){let p=document.activeElement;p instanceof HTMLElement&&d.includes(p)&&(l.preventDefault(),p.click());}};return r.addEventListener("keydown",c),()=>r.removeEventListener("keydown",c)},[e,t,n,o]);}function Tu(e,t,n,o){Ye.useEffect(()=>{if(!e)return;let r=n.current,a=o.current;if(!r)return;let i=()=>[...r.querySelectorAll('button:not([aria-disabled="true"])')].filter(c=>c.closest('[role="dialog"]')===r);queueMicrotask(()=>{i()[0]?.focus();});let s=c=>{if(c.key==="Escape"){c.preventDefault(),t(false),a?.focus();return}if(c.key==="Enter"||c.key===" "){let l=document.activeElement,d=i();l instanceof HTMLElement&&d.includes(l)&&(c.preventDefault(),l.click());}};return r.addEventListener("keydown",s),()=>r.removeEventListener("keydown",s)},[e,t,n,o]);}function wu(e,t,n){if(e)return o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),n(!t));}}function nv(e){return te(editor.tableChromeIconPaths(e))}function Mu(){return Ye.createContext(null)}function Pt(e){let t=Ye.useContext(e);if(!t)throw new Error("table chrome compound part used outside its root");return t}function Kl(e,t,n){let o=Mu();function r({hidden:s,asChild:c,className:l,children:d}){let{visible:p,enabled:g,disabledReason:m,draft:f,apply:u}=ga(e),[h,b]=Ye.useState(false),v=Ye.useRef(null),C=Ye.useRef(null);Bl(h,b,v);let P=Ye.useMemo(()=>({open:h,setOpen:b,enabled:g,disabledReason:m,apply:u,draft:f,triggerRef:C}),[h,g,m,u,f]);if(s||!p)return null;let S={className:`${t}${l?` ${l}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},y=d??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(a,{}),jsxRuntime.jsx(i,{})]});return jsxRuntime.jsx(o.Provider,{value:P,children:c?jsxRuntime.jsx(W,{...S,ref:v,children:y}):jsxRuntime.jsx("div",{ref:v,...S,children:y})})}function a({asChild:s,className:c,children:l}){let{open:d,setOpen:p,enabled:g,disabledReason:m,triggerRef:f}=Pt(o),u=Y(),h=ee(e),b=u(h?.labelKey??n),{shared:v,reasonNode:C}=ha({enabled:g,disabledReason:m,ariaLabel:b}),P={...v,ref:f,className:`docx-toolbar__button docx-table-chrome__trigger${c?` ${c}`:""}`,"aria-haspopup":"menu","aria-expanded":d,onClick:g?()=>p(!d):void 0,...s?{tabIndex:g?0:-1,role:"button",onKeyDown:wu(g,d,p)}:{}},S=l??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[te(h?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]});return s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(W,{...P,children:S}),C]}):jsxRuntime.jsxs("button",{...P,children:[S,C]})}a.docxToolbarPart=true;function i({asChild:s,className:c,children:l}){let{open:d,setOpen:p,enabled:g,triggerRef:m}=Pt(o),f=Y(),u=Ye.useRef(null);if(xu(d&&g,p,u,m),!d||!g)return null;let h=ee(e),b=f(h?.labelKey??n),v={ref:u,role:"menu","aria-label":b,className:`docx-table-chrome__panel${c?` ${c}`:""}`,onMouseDown:O};return s?jsxRuntime.jsx(W,{...v,children:l}):jsxRuntime.jsx("div",{...v,children:l})}return {Root:r,Trigger:a,Content:i,Ctx:o}}var Nn=Kl("table.borderTarget","docx-table-chrome docx-table-chrome--target","table.borders.tooltip");function ku({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:a,draft:i}=Pt(Nn.Ctx),s=Y(),c=editor.TABLE_BORDER_TARGET_OPTIONS.find(g=>g.value===e);if(!c)return null;let l=c.value==="none"?false:c.value===i.activeTarget,d={type:"button",role:"menuitemradio","aria-checked":l,"data-value":c.value,className:`docx-table-chrome__target-btn${n?` ${n}`:""}`,...l?{"data-active":""}:{},"aria-label":s(c.labelKey),title:s(c.labelKey),onMouseDown:O,onClick:()=>{a(false),r(c.value);}},p=o??nv(c.icon);return t?jsxRuntime.jsx(W,{...d,children:p}):jsxRuntime.jsx("button",{...d,children:p})}function Iu(e){let{children:t}=e;return jsxRuntime.jsx(Nn.Content,{...e,children:t??jsxRuntime.jsx("div",{className:"docx-table-chrome__target-grid",children:editor.TABLE_BORDER_TARGET_OPTIONS.map(n=>jsxRuntime.jsx(ku,{value:n.value},n.value))})})}function rv(e){let{children:t}=e,n=t??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Nn.Trigger,{}),jsxRuntime.jsx(Iu,{})]});return jsxRuntime.jsx(Nn.Root,{...e,children:n})}var An=Object.assign(rv,{docxSlot:"table.borderTarget",Trigger:Nn.Trigger,Content:Iu,Item:ku}),Dn=Kl("table.borderStyle","docx-table-chrome docx-table-chrome--style","table.borders.styleAriaLabel");function Ru({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:a,draft:i}=Pt(Dn.Ctx),s=Y(),c=editor.TABLE_BORDER_STYLE_OPTIONS.find(g=>g.value===e);if(!c)return null;let l=c.value===i.spec.style,d={type:"button",role:"menuitemradio","aria-checked":l,...l?{"data-selected":""}:{},className:`docx-table-chrome__width-row${n?` ${n}`:""}`,onMouseDown:O,onClick:()=>{a(false),r(c.value);}},p=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:`docx-table-line ${c.previewClass}`,"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:s(c.labelKey)})]});return t?jsxRuntime.jsx(W,{...d,children:p}):jsxRuntime.jsx("button",{...d,children:p})}function _u(e){let{children:t}=e;return jsxRuntime.jsx(Dn.Content,{...e,children:t??editor.TABLE_BORDER_STYLE_OPTIONS.map(n=>jsxRuntime.jsx(Ru,{value:n.value},n.value))})}function av(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Dn.Trigger,{}),jsxRuntime.jsx(_u,{})]});return jsxRuntime.jsx(Dn.Root,{...e,children:t})}var On=Object.assign(av,{docxSlot:"table.borderStyle",Trigger:Dn.Trigger,Content:_u,Item:Ru}),Ln=Kl("table.borderWidth","docx-table-chrome docx-table-chrome--width","table.borderWidth");function Nu({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:a,draft:i}=Pt(Ln.Ctx),s=Y(),c=Number(e),l=editor.TABLE_BORDER_WIDTH_OPTIONS.find(m=>m.size===c);if(!l)return null;let d=l.size===i.spec.size,p={type:"button",role:"menuitemradio","aria-checked":d,...d?{"data-selected":""}:{},className:`docx-table-chrome__width-row${n?` ${n}`:""}`,onMouseDown:O,onClick:()=>{a(false),r(l.size);}},g=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"docx-table-line docx-table-line--single",style:{height:`${l.previewThickness}px`},"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:s(l.labelKey)})]});return t?jsxRuntime.jsx(W,{...p,children:g}):jsxRuntime.jsx("button",{...p,children:g})}function Du(e){let{children:t}=e;return jsxRuntime.jsx(Ln.Content,{...e,children:t??editor.TABLE_BORDER_WIDTH_OPTIONS.map(n=>jsxRuntime.jsx(Nu,{value:String(n.size)},n.size))})}function iv(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ln.Trigger,{}),jsxRuntime.jsx(Du,{})]});return jsxRuntime.jsx(Ln.Root,{...e,children:t})}var Zn=Object.assign(iv,{docxSlot:"table.borderWidth",Trigger:Ln.Trigger,Content:Du,Item:Nu});function Lu(e,t,n){let o=n?.defaultHex??"FF0000",r=Mu();function a({hidden:d,asChild:p,className:g,children:m}){let{visible:f,enabled:u,disabledReason:h,draft:b,apply:v}=ga(e),[C,P]=Ye.useState(false),[S,y]=Ye.useState(o),x=Ye.useRef(null),M=Ye.useRef(null);Bl(C,P,x);let E=Ye.useMemo(()=>({open:C,setOpen:P,enabled:u,disabledReason:h,apply:v,draft:b,triggerRef:M,lastHex:S,setLastHex:y}),[C,u,h,v,b,S]);if(d||!f)return null;let w={className:`docx-toolbar__colorsplit docx-table-chrome${g?` ${g}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},N=m??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(i,{}),jsxRuntime.jsx(s,{}),jsxRuntime.jsx(c,{clearFill:n?.clearFill??false})]});return jsxRuntime.jsx(r.Provider,{value:E,children:p?jsxRuntime.jsx(W,{...w,ref:x,children:N}):jsxRuntime.jsx("div",{ref:x,...w,children:N})})}function i({asChild:d,className:p,children:g}){let{enabled:m,disabledReason:f,apply:u,draft:h,lastHex:b}=Pt(r),v=Y(),C=ee(e),P=v(C?.labelKey??t),{shared:S,reasonNode:y}=ha({enabled:m,disabledReason:f,ariaLabel:P}),x=e==="table.borderColor"&&h.spec.color.kind==="hex"?h.spec.color.value:b??o,M={...S,className:`docx-toolbar__button docx-toolbar__colorsplit-main${p?` ${p}`:""}`,onClick:m?()=>u({kind:"hex",value:x}):void 0},E=g??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[te(C?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:`#${x.toLowerCase()}`},"aria-hidden":"true"})]});return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(W,{...M,children:E}),y]}):jsxRuntime.jsxs("button",{...M,children:[E,y]})}i.docxToolbarPart=true;function s({asChild:d,className:p,children:g}){let{open:m,setOpen:f,enabled:u,disabledReason:h,triggerRef:b}=Pt(r),v=Y(),C=ee(e),P=v(C?.labelKey??t),{shared:S,reasonNode:y}=ha({enabled:u,disabledReason:h,ariaLabel:P}),x={...S,ref:b,className:`docx-toolbar__colorsplit-caret${p?` ${p}`:""}`,"aria-haspopup":"dialog","aria-expanded":m,onClick:u?()=>f(!m):void 0,...d?{tabIndex:u?0:-1,role:"button",onKeyDown:wu(u,m,f)}:{}},M=g??"\u25BE";return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(W,{...x,children:M}),y]}):jsxRuntime.jsxs("button",{...x,children:[M,y]})}s.docxToolbarPart=true;function c({asChild:d,className:p,children:g,clearFill:m}){let{open:f,setOpen:u,enabled:h,apply:b,draft:v,triggerRef:C,lastHex:P,setLastHex:S}=Pt(r),y=Y(),x=Ye.useRef(null);if(Tu(f&&h,u,x,C),!f||!h)return null;let M=y(t),E=e==="table.borderColor"&&v.spec.color.kind==="hex"?v.spec.color.value:P??o,w={ref:x,role:"dialog","aria-label":M,className:`docx-toolbar__swatch-popup docx-table-chrome__panel${p?` ${p}`:""}`,onMouseDown:O},N=g??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[m?jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:O,onClick:()=>{u(false),b(null),ba(C.current);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__swatch-clear-chip docx-toolbar__swatch-clear-chip--none","aria-hidden":"true"}),y("table.clearCellFill")]}):null,jsxRuntime.jsx(xl,{apply:F=>{u(false),S?.(F),b({kind:"hex",value:F}),ba(C.current);},current:E})]});return d?jsxRuntime.jsx(W,{...w,children:N}):jsxRuntime.jsx("div",{...w,children:N})}function l({value:d,css:p,labelKey:g,asChild:m,className:f,children:u}){let{apply:h,setOpen:b,setLastHex:v,triggerRef:C}=Pt(r),P=Y(),S=p??`#${d.toLowerCase()}`,y=g?P(g):d,x={type:"button",className:`docx-toolbar__swatch docx-table-chrome__swatch${f?` ${f}`:""}`,style:{backgroundColor:S},"data-value":d,"aria-label":y,title:y,onMouseDown:O,onClick:()=>{b(false),v?.(d),h({kind:"hex",value:d}),ba(C.current);}};return m?jsxRuntime.jsx(W,{...x,children:u}):jsxRuntime.jsx("button",{...x,children:u})}return {Root:a,Main:i,Trigger:s,Content:c,Item:l,Ctx:r}}var Hn=Lu("table.borderColor","table.borderColor",{defaultHex:"000000"});function lv(e){return jsxRuntime.jsx(Hn.Content,{...e,clearFill:false})}function sv(e){return jsxRuntime.jsx(Hn.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function cv(e){return jsxRuntime.jsx(Hn.Root,{...e})}var Bn=Object.assign(cv,{docxSlot:"table.borderColor",Trigger:Hn.Trigger,Content:lv,Item:sv,Main:Hn.Main}),Fn=Lu("table.cellFill","table.cellFillColor",{clearFill:true,defaultHex:"FFFF00"});function dv(e){return jsxRuntime.jsx(Fn.Content,{...e,clearFill:true})}function uv(e){return jsxRuntime.jsx(Fn.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function pv(e){return jsxRuntime.jsx(Fn.Root,{...e})}var qn=Object.assign(pv,{docxSlot:"table.cellFill",Trigger:Fn.Trigger,Content:dv,Item:uv,Main:Fn.Main});function Hu({overrides:e=new Map}){return yu()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ho,{}),[An,Bn,On,Zn,qn].map(o=>{let r=e.get(o.docxSlot);return r?jsxRuntime.jsx(Ye.Fragment,{children:r},o.docxSlot):jsxRuntime.jsx(o,{},o.docxSlot)})]}):null}function Fu(){let e=Y(),{draft:t}=ga("table.borderTarget");return e(editor.tableChromeLabelKeyForTarget(t.activeTarget))}var Bu=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],qu={"zoom.level":bl,"styles.style":Dl,"font.family":kl,"font.size":gl,"text.color":Tl,"text.highlight":Sl,"text.link":dl,"list.lineSpacing":vl,"review.editingMode":Ur,"file.save":ul,...pu,"table.borderTarget":An,"table.borderColor":Bn,"table.borderStyle":On,"table.borderWidth":Zn,"table.cellFill":qn,"image.insert":un,"image.properties":Pn,"image.wrap":Tn,"image.altText":Sn},Ou=new Map;function gv(e){let t=Ou.get(e);return t||(t=n=>jsxRuntime.jsx(Xt,{slot:e,...n}),Ou.set(e,t)),t}function bv(e){return editor.formattingBarChromeGroups(e).map(t=>t.id==="alignment"?{id:t.id,labelKey:t.labelKey,entries:[{slot:"alignment",Part:la}]}:{id:t.id,labelKey:t.labelKey,entries:t.controls.map(n=>{let o=editor.chromeSlotId(t,n);return {slot:o,Part:qu[o]??gv(o)}})})}var hv=e=>e.image;function vv(e){return e==="alignment"||e in qu}function $l(e){let t=No(e,$l);if(t!==null)return t;if(!Ye.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 zl(e){if(e==null||typeof e=="boolean")return false;if(Array.isArray(e))return e.some(zl);let t=$l(e);return t!=null&&Bu.includes(t)?true:Ye.isValidElement(e)?Ye.Children.toArray(e.props.children).some(zl):false}function yv(e,t){return t?true:Ye.Children.toArray(e).some(zl)}function xv(e){let t=Xe(),{className:n,t:o,onSave:r,preset:a=true,overflow:i=true,children:s}=e,c=Ye.useMemo(()=>({t:o,onSave:r}),[o,r]),l=Ni(o),d=q(hv),p=Ye.useMemo(()=>bv(d),[d]),g=Ye.useMemo(()=>new Set(p.flatMap(C=>C.entries.map(P=>P.slot))),[p]),m=Ye.useMemo(()=>p.map(C=>C.id).filter(C=>!Xi.has(C)),[p]),f=Ye.useMemo(()=>ed(m),[m]),u=a&&i,{attach:h,overflow:b}=dd(u,m,f),v;if(!a)v=s;else {let C=Ye.Children.toArray(s),P=new Map,S=new Map,y=[];for(let N of C){let F=$l(N);F&&g.has(F)?P.set(F,N):F&&Bu.includes(F)?S.set(F,N):y.push(N);}let x=N=>{let F=P.get(N.slot);if(F)return F;let H=N.Part;return jsxRuntime.jsx(H,{})},M=[],E=[],w=0;for(let N of p){if(b.has(N.id)){let H=N.entries.flatMap(I=>{let D=Sv(I,P,l,N.labelKey,x);return D===null?[]:[jsxRuntime.jsx(Ye.Fragment,{children:D},I.slot)]});if(H.length===0)continue;E.push({id:N.id,labelKey:N.labelKey,children:H});continue}w>0&&M.push(jsxRuntime.jsx(Ho,{},`separator-${N.id}`)),w+=1;let F=Xi.has(N.id);M.push(jsxRuntime.jsx("div",{className:"docx-toolbar__group",...F?{[yn]:""}:{[vn]:N.id},children:N.entries.map(H=>jsxRuntime.jsx(Ye.Fragment,{children:x(H)},H.slot))},N.id));}v=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M,jsxRuntime.jsx(Hu,{overrides:S}),y.length>0?jsxRuntime.jsx("div",{className:"docx-toolbar__group",[yn]:"",children:y}):null,E.length>0?jsxRuntime.jsx(gd,{sections:E}):null]});}return jsxRuntime.jsx(dn.Provider,{value:c,children:jsxRuntime.jsx("div",{ref:h,role:"toolbar","data-testid":"docx-toolbar",className:`${t}docx-toolbar${n?` ${n}`:""}`,...u?{"data-overflow":""}:{},onMouseDown:O,children:yv(s,a)?jsxRuntime.jsx(Al,{children:v}):v})})}function Tv(e){return e?!!e.props.hidden:false}function Sv(e,t,n,o,r){let a=t.get(e.slot);return Tv(a)?null:a||vv(e.slot)?jsxRuntime.jsx(md,{label:Cv(n,e,o),children:r(e)}):jsxRuntime.jsx(fd,{slot:e.slot})}function Cv(e,t,n){let o=t.slot==="alignment"?null:ee(t.slot);return e(o?.labelKey??n)}var zn=Object.assign(xv,{Button:Xt,Action:Pl,Separator:Ho,Undo:Pd,Redo:Ed,Bold:wd,Italic:Md,Underline:kd,Strike:Id,Link:dl,ClearFormatting:Rd,Superscript:_d,Subscript:Nd,Alignment:la,AlignLeft:Dd,AlignCenter:Ld,AlignRight:Hd,AlignJustify:Fd,LineSpacing:vl,BulletList:Ad,NumberedList:Od,Outdent:Zd,Indent:Bd,ImageInsert:un,ImageProperties:Pn,ImageWrap:Tn,ImageAltText:Sn,TableInsert:qd,TableBorderTarget:An,TableBorderColor:Bn,TableBorderStyle:On,TableBorderWidth:Zn,TableCellFill:qn,Comments:Kd,FontFamily:kl,FontSize:gl,FontColor:Tl,Highlight:Sl,Zoom:bl,StylePicker:Dl,EditingMode:Ur,Save:ul,ContentControlShowAll:da,ContentControlFormFill:ua,ContentControlInspector:ma,ContentControlRemove:pa});var Mv=e=>e.pageSetup??null,kv=e=>e.editable;function eo(){let e=A(),t=q(Mv),n=q(kv),o=Ye.useMemo(()=>n&&e!==null&&e.can({type:"setPageSetup",marginTop:0}).ok,[e,n]),r=Ye.useCallback(a=>e?e.exec({...a.pageWidthTwips!==void 0?{pageWidth:a.pageWidthTwips}:{},...a.pageHeightTwips!==void 0?{pageHeight:a.pageHeightTwips}:{},...a.orientation!==void 0?{orientation:a.orientation}:{},...a.marginTopTwips!==void 0?{marginTop:a.marginTopTwips}:{},...a.marginRightTwips!==void 0?{marginRight:a.marginRightTwips}:{},...a.marginBottomTwips!==void 0?{marginBottom:a.marginBottomTwips}:{},...a.marginLeftTwips!==void 0?{marginLeft:a.marginLeftTwips}:{},...a.scope!==void 0?{scope:a.scope}:{},type:"setPageSetup"}).ok:false,[e]);return Ye.useMemo(()=>({pageSetup:t,isEnabled:o,apply:r}),[t,o,r])}var Ul=[{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}],Yu=1440,Iv=e=>Math.round(e/Yu*100)/100,Rv=e=>Math.round(e*Yu);function _v(e,t){let n=Math.min(e,t),o=Math.max(e,t);return Ul.findIndex(r=>Math.abs(r.width-n)<20&&Math.abs(r.height-o)<20)}var Nv={position:"fixed",inset:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},Dv={backgroundColor:"var(--doc-surface)",borderRadius:8,boxShadow:"0 4px 20px var(--doc-shadow)",minWidth:400,maxWidth:480,width:"100%",margin:20},Lv={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:16,fontWeight:600,color:"var(--doc-text)"},Hv={padding:"16px 20px",display:"flex",flexDirection:"column",gap:14},$u={fontSize:12,fontWeight:600,color:"var(--doc-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},va={display:"flex",alignItems:"center",gap:12},ya={width:80,fontSize:13,color:"var(--doc-text-muted)"},xa={flex:1,padding:"6px 8px",border:"1px solid var(--doc-border)",borderRadius:4,fontSize:13,backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},Fv={fontSize:11,color:"var(--doc-text-muted)",width:16},Av={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"flex-end",gap:8},Wu={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer",backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},Uu=12240,Gu=15840,Ht=1440;function Vn({open:e,onClose:t,className:n}){let{t:o}=_(),{pageSetup:r,isEnabled:a,apply:i}=eo(),[s,c]=Ye.useState(Uu),[l,d]=Ye.useState(Gu),[p,g]=Ye.useState("portrait"),[m,f]=Ye.useState(Ht),[u,h]=Ye.useState(Ht),[b,v]=Ye.useState(Ht),[C,P]=Ye.useState(Ht),[S,y]=Ye.useState("document"),x=Ye.useRef(null),M=Ye.useRef("no");Ye.useEffect(()=>{if(!e){M.current="no";return}if(M.current==="yes"&&r===null){M.current="no";return}M.current==="yes"||M.current==="loading"&&r===null||(c(r?.pageWidthTwips??Uu),d(r?.pageHeightTwips??Gu),g(r?.orientation??"portrait"),f(r?.marginsTwips.top??Ht),h(r?.marginsTwips.bottom??Ht),v(r?.marginsTwips.left??Ht),P(r?.marginsTwips.right??Ht),y("document"),M.current=r===null?"loading":"yes");},[e,r]),Ye.useEffect(()=>{e&&x.current?.focus();},[e]);let E=Ye.useCallback(I=>{let D=Ul[I];D&&(c(p==="landscape"?D.height:D.width),d(p==="landscape"?D.width:D.height));},[p]),w=Ye.useCallback(I=>{I!==p&&(g(I),c(l),d(s));},[p,s,l]),N=Ye.useCallback(()=>{i({pageWidthTwips:s,pageHeightTwips:l,orientation:p,marginTopTwips:m,marginRightTwips:C,marginBottomTwips:u,marginLeftTwips:b,scope:S})&&t();},[i,s,l,p,m,C,u,b,S,t]);if(!e)return null;let F=_v(s,l),H=(I,D,k)=>jsxRuntime.jsxs("div",{style:va,children:[jsxRuntime.jsx("label",{style:ya,children:o(`dialogs.pageSetup.${I}`)}),jsxRuntime.jsx("input",{type:"number",style:xa,min:0,max:22,step:.1,value:Iv(D),onChange:R=>k(Math.max(0,Rv(Number(R.target.value)||0))),"aria-label":o(`dialogs.pageSetup.${I}`)}),jsxRuntime.jsx("span",{style:Fv,children:"in"})]});return jsxRuntime.jsx("div",{className:n,style:Nv,onClick:t,onKeyDown:I=>{I.key==="Escape"&&t(),I.key==="Enter"&&N();},children:jsxRuntime.jsxs("div",{ref:x,tabIndex:-1,style:Dv,onClick:I=>I.stopPropagation(),onMouseDown:I=>I.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":o("dialogs.pageSetup.title"),children:[jsxRuntime.jsx("div",{style:Lv,children:o("dialogs.pageSetup.title")}),jsxRuntime.jsxs("div",{style:Hv,children:[jsxRuntime.jsx("div",{style:$u,children:o("dialogs.pageSetup.pageSize")}),jsxRuntime.jsxs("div",{style:va,children:[jsxRuntime.jsx("label",{style:ya,children:o("dialogs.pageSetup.sizeLabel")}),jsxRuntime.jsxs("select",{style:xa,value:F,onChange:I=>E(Number(I.target.value)),"aria-label":o("dialogs.pageSetup.sizeLabel"),children:[Ul.map((I,D)=>jsxRuntime.jsx("option",{value:D,children:o(I.labelKey)},I.labelKey)),F<0&&jsxRuntime.jsx("option",{value:-1,children:o("dialogs.pageSetup.custom")})]})]}),jsxRuntime.jsxs("div",{style:va,children:[jsxRuntime.jsx("label",{style:ya,children:o("dialogs.pageSetup.orientation")}),jsxRuntime.jsxs("select",{style:xa,value:p,onChange:I=>w(I.target.value),"aria-label":o("dialogs.pageSetup.orientation"),children:[jsxRuntime.jsx("option",{value:"portrait",children:o("dialogs.pageSetup.portrait")}),jsxRuntime.jsx("option",{value:"landscape",children:o("dialogs.pageSetup.landscape")})]})]}),jsxRuntime.jsx("div",{style:{...$u,marginTop:4},children:o("dialogs.pageSetup.margins")}),H("top",m,f),H("bottom",u,h),H("left",b,v),H("right",C,P),jsxRuntime.jsxs("div",{style:va,children:[jsxRuntime.jsx("label",{style:ya,children:o("dialogs.pageSetup.applyTo")}),jsxRuntime.jsxs("select",{style:xa,value:S,onChange:I=>y(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:Av,children:[jsxRuntime.jsx("button",{type:"button",style:Wu,onClick:t,children:o("common.cancel")}),jsxRuntime.jsx("button",{type:"button",style:{...Wu,backgroundColor:"var(--doc-primary)",color:"var(--doc-on-primary)",borderColor:"var(--doc-primary)",opacity:a?1:.5},disabled:!a,onClick:N,children:o("common.apply")})]})]})})}var $n=Ye.createContext({t:void 0,openMenu:null,setOpenMenu:()=>{},activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onReportIssue:void 0,reportIssue:void 0});function ft(){return Ye.useContext($n)}function Oe(){let{t:e}=ft(),{t}=_();return n=>e?.(n)??t(n)}var Bv=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i,qv=/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2066-\u2069\ufeff<>:"/\\|?*]/g;var Xu=new TextEncoder;function Kv(e,t){if(Xu.encode(e).length<=t)return e;let n=0,o="";for(let r of e){let a=Xu.encode(r).length;if(n+a>t)break;n+=a,o+=r;}return o}function ju(e){let t=Kv((e??"").replace(/\.docx$/i,"").replace(qv," ").replace(/\s+/g," ").trim().replace(/^[.\s]+/,"").replace(/[.\s]+$/,""),200).trim();return !t||Bv.test(t)?"document.docx":`${t}.docx`}function Qu(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 zv="https://github.com/eigenpal/docx-editor/issues/new";function Vv(){if(typeof window>"u")return "";try{let e=new URL(window.location.href);return `${e.origin}${e.pathname}`}catch{return ""}}function Ju(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??Vv()}`,`- Viewport: ${n.width} x ${n.height}`,`- User agent: ${t}`,""].join(`
2
+ `),a=new URLSearchParams({title:"[Bug] ",body:r});return `${zv}?${a.toString()}`}function Wn(e){typeof window>"u"||window.open(Ju(e),"_blank","noopener,noreferrer");}var Ta=6,Gl=6;function Le(e){let{icon:t,shortcut:n,disabled:o,title:r,active:a,selected:i,slot:s,onSelect:c,className:l,children:d}=e,p=Ye.useId(),g=o&&r?p:void 0;return jsxRuntime.jsxs("button",{type:"button",role:a===void 0?"menuitem":i===void 0?"menuitemcheckbox":"menuitemradio",className:`docx-toolbar__menu-item docx-menubar__item${l?` ${l}`:""}`,tabIndex:-1,...s?{"data-slot":s}:{},...a?{"data-active":""}:{},...o?{"data-disabled":"","aria-disabled":true}:{},...a!==void 0?{"aria-checked":a}:{},...g?{"aria-describedby":g}:{},...r?{title:r}:{},onMouseDown:O,onClick:o?void 0:c,children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:t}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:d}),n?jsxRuntime.jsx("span",{className:"docx-menubar__item-shortcut",children:n}):null,g?jsxRuntime.jsx("span",{id:p,className:"docx-editor-sr-only",children:r}):null]})}function Gn({label:e,labelKey:t,className:n,hidden:o,children:r}){let a=Oe();if(o)return null;let i=e??(t===void 0?void 0:a(t));return jsxRuntime.jsxs("div",{role:"group",className:`docx-menubar__group${n?` ${n}`:""}`,...i?{"aria-label":i}:{},children:[i?jsxRuntime.jsx("div",{className:"docx-menubar__group-label","aria-hidden":"true",children:i}):null,r]})}function gt({slot:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let{execute:a,isActive:i,isEnabled:s,disabledReason:c}=ne(e),{setOpenMenu:l}=ft(),d=Oe();if(r)return null;let p=ee(e),g=d(t??p?.labelKey??e),m=editor.commandForSlot(e),f=m?.type==="toggleMark"||m?.type==="setAlignment",u=m?.type==="setAlignment";return jsxRuntime.jsx(Le,{slot:e,icon:te(p?.paths),...n?{shortcut:d(n)}:{},disabled:!s,...c?{title:c}:{},...f?{active:i}:{},...u?{selected:true}:{},onSelect:()=>{a(),l(null);},...o?{className:o}:{},children:g})}gt.docxMenuRow=true;function tp(e,t,n,o){return Object.assign(({className:a,hidden:i})=>{let s=ft(),c=Oe(),l=o(s);if(i)return null;let d=ee(e),p=c(t??d?.labelKey??e);return jsxRuntime.jsx(Le,{slot:e,icon:te(d?.paths),...n?{shortcut:c(n)}:{},disabled:!l,onSelect:()=>{l?.(),s.setOpenMenu(null);},...a?{className:a}:{},children:p})},{docxSlot:e})}var Xl=tp("file.open","toolbar.open","toolbar.openShortcut",e=>e.onOpen),jl=tp("file.save","toolbar.save","toolbar.saveShortcut",e=>e.onSave);function Xv({className:e,hidden:t}){let n=A(),o=ft(),r=Oe(),a=editor.chromeProbeForSlot("file.pageSetup"),i=n&&a?n.can(a):null,s=i?.ok===true,c=i&&!i.ok?i.reason:null;if(t)return null;let l=ee("file.pageSetup"),d=r(l?.labelKey??"file.pageSetup"),p=s&&!!o.onPageSetup;return jsxRuntime.jsx(Le,{slot:"file.pageSetup",icon:te(l?.paths),disabled:!p,...c?{title:c}:{},onSelect:()=>{o.onPageSetup?.(),o.setOpenMenu(null);},...e?{className:e}:{},children:d})}var Ql=Object.assign(Xv,{docxSlot:"file.pageSetup"});function jv({className:e,hidden:t}){let{openFilePicker:n,isEnabled:o,disabledReason:r}=_r(),a=ft(),i=Oe();if(t)return null;let s=ee("image.insert"),c=i(s?.labelKey??"toolbar.image");return jsxRuntime.jsx(Le,{slot:"image.insert",icon:te(s?.paths),disabled:!o,...r?{title:r}:{},onSelect:()=>{n(),a.setOpenMenu(null);},...e?{className:e}:{},children:c})}var Qv=Object.assign(jv,{docxSlot:"image.insert"}),Un=8;function oo({labelKey:e,paths:t,className:n,children:o}){let r=Oe(),[a,i]=Ye.useState(false),s=Ye.useRef(null),c=Ye.useRef(null),l=Ye.useId(),d=r(e),[p,g]=Ye.useState(null);return Ye.useLayoutEffect(()=>{if(!a){g(null);return}let m=s.current,f=c.current,u=m?.ownerDocument.defaultView;if(!m||!f||!u)return;let h=m.getBoundingClientRect(),b=f.offsetWidth,v=f.offsetHeight,C=h.right+b>u.innerWidth-Un;g({left:C?Math.max(Un,h.left-b):Math.min(h.right,u.innerWidth-b-Un),top:Math.max(Un,Math.min(h.top-4,u.innerHeight-v-Un))});},[a]),jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__submenu${n?` ${n}`:""}`,onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),onKeyDown:m=>{m.key==="ArrowRight"&&document.activeElement===s.current?(m.preventDefault(),i(true),queueMicrotask(()=>{c.current&&it(Jt(c.current),"first");})):(m.key==="ArrowLeft"||m.key==="Escape")&&a&&(m.preventDefault(),m.stopPropagation(),i(false),s.current?.focus());},onBlur:m=>{m.currentTarget.contains(m.relatedTarget)||i(false);},children:[jsxRuntime.jsxs("button",{ref:s,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?l:void 0,className:"docx-toolbar__menu-item docx-menubar__item",tabIndex:-1,...a?{"data-open":""}:{},onMouseDown:O,onFocus:()=>i(true),onClick:()=>i(true),children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:te(t)}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:d}),jsxRuntime.jsx("span",{className:"docx-menubar__item-caret","aria-hidden":"true",children:"\u203A"})]}),a?jsxRuntime.jsx("div",{ref:c,id:l,className:"docx-toolbar__menu docx-menubar__menu docx-menubar__submenu-panel",role:"menu","aria-label":d,style:p?{position:"fixed",left:p.left,top:p.top}:{position:"fixed",visibility:"hidden"},onKeyDown:m=>{let f=c.current;if(!f)return;let u=Jt(f);m.key==="ArrowDown"?(m.preventDefault(),m.stopPropagation(),at(u,document.activeElement,1)):m.key==="ArrowUp"&&(m.preventDefault(),m.stopPropagation(),at(u,document.activeElement,-1));},children:o}):null]})}function Ca({slot:e="table.insert",className:t}){let n=A(),{isEnabled:o}=ne(e),{setOpenMenu:r}=ft(),[a,i]=Ye.useState(null),[s,c]=Ye.useState({rows:1,cols:1}),l=Ye.useRef(null),d=Ye.useCallback((m,f)=>{if(!n||!o)return;let u={type:"insertTable",rows:m,cols:f};n.can(u).ok&&(n.exec(u),r(null),n.focus());},[n,o,r]),p=Ye.useCallback(m=>{c(f=>{let u={rows:Math.min(Gl,Math.max(1,f.rows+(m.rows??0))),cols:Math.min(Ta,Math.max(1,m.toCol??f.cols+(m.cols??0)))};return i(u),queueMicrotask(()=>l.current?.querySelector(`[data-cell="${u.rows}x${u.cols}"]`)?.focus()),u});},[]),g=[];for(let m=1;m<=Gl;m+=1){let f=[];for(let u=1;u<=Ta;u+=1){let h=!!a&&m<=a.rows&&u<=a.cols;f.push(jsxRuntime.jsx("button",{type:"button",role:"gridcell","data-cell":`${m}x${u}`,className:"docx-menubar__grid-cell",tabIndex:s.rows===m&&s.cols===u?0:-1,...h?{"data-filled":""}:{},"aria-label":`${u} \xD7 ${m}`,onMouseDown:O,onMouseEnter:()=>i({rows:m,cols:u}),onFocus:()=>i({rows:m,cols:u}),onClick:()=>d(m,u)},u));}g.push(jsxRuntime.jsx("div",{role:"row",className:"docx-menubar__grid-row",children:f},m));}return jsxRuntime.jsxs("div",{ref:l,role:"grid","aria-label":`${Ta} \xD7 ${Gl}`,className:`docx-menubar__grid${t?` ${t}`:""}`,onMouseLeave:()=>i(null),onKeyDown:m=>{if(m.key==="ArrowRight")p({cols:1});else if(m.key==="ArrowLeft")p({cols:-1});else if(m.key==="ArrowDown")p({rows:1});else if(m.key==="ArrowUp")p({rows:-1});else if(m.key==="Home")p({toCol:1});else if(m.key==="End")p({toCol:Ta});else return;m.preventDefault(),m.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 Jv({entry:e}){let{isEnabled:t}=ne(e.slot),n=ee(e.slot);return t?jsxRuntime.jsx(oo,{labelKey:e.labelKey??n?.labelKey??e.slot,paths:n?.paths,children:jsxRuntime.jsx(Ca,{slot:e.slot})}):jsxRuntime.jsx(gt,{slot:e.slot,...e.labelKey?{labelKey:e.labelKey}:{}})}function no({className:e}){return jsxRuntime.jsx("div",{role:"separator",className:`docx-toolbar__menu-separator${e?` ${e}`:""}`})}function Yn({entry:e}){return e.kind==="separator"?jsxRuntime.jsx(no,{}):e.kind==="submenu"?jsxRuntime.jsx(oo,{labelKey:e.labelKey,paths:e.paths,children:e.items.map((t,n)=>jsxRuntime.jsx(Yn,{entry:t},n))}):e.slot==="file.open"?jsxRuntime.jsx(Xl,{}):e.slot==="file.save"?jsxRuntime.jsx(jl,{}):e.slot==="file.pageSetup"?jsxRuntime.jsx(Ql,{}):e.slot==="image.insert"?jsxRuntime.jsx(Qv,{}):e.picker==="tableGrid"?jsxRuntime.jsx(Jv,{entry:e}):jsxRuntime.jsx(gt,{slot:e.slot,...e.labelKey?{labelKey:e.labelKey}:{},...e.shortcutKey?{shortcutKey:e.shortcutKey}:{}})}function op(e){if(!Ye.isValidElement(e))return null;let t=No(e,op);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 ey(e,t){return e.kind==="item"?e.slot:e.kind==="submenu"?`submenu:${e.labelKey}`:`separator:${t}`}function ty(e,t,n){return Yr({entries:e??[],children:t,preset:n,keyOfEntry:ey,keyOfChild:op,renderEntry:o=>jsxRuntime.jsx(Yn,{entry:o})})}function Zo({id:e,labelKey:t,label:n,icon:o,className:r,hidden:a,preset:i=true,children:s}){let{openMenu:c,setOpenMenu:l,activeMenu:d}=ft(),p=Oe(),g=Ye.useId(),m=Ye.useRef(null),f=Ye.useRef(null),u=Ye.useRef(false),h=Ye.useRef(false),b=editor.CHROME_MENUS.find(y=>y.id===e),v=c===e;if(a)return null;let C=n??p(t??b?.labelKey??e),P=ty(b?.entries,s,i),S=()=>{l(null),m.current?.focus();};return jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__menu-root${r?` ${r}`:""}`,"data-menu":e,children:[jsxRuntime.jsxs("button",{ref:m,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":v,"aria-controls":v?g:void 0,className:"docx-menubar__trigger",tabIndex:d===e?0:-1,...v?{"data-open":""}:{},onMouseDown:O,onKeyDown:y=>{y.key==="ArrowDown"||y.key==="Enter"||y.key===" "||y.key==="ArrowUp"?(y.preventDefault(),u.current=true,l(e)):y.key==="Escape"&&v&&(y.preventDefault(),S());},onClick:()=>{if(h.current){h.current=false;return}l(v?null:e);},onMouseEnter:()=>{c!==null&&c!==e&&(h.current=true,l(e));},onMouseLeave:()=>{h.current=false;},children:[o?jsxRuntime.jsx("span",{className:"docx-menubar__trigger-icon","aria-hidden":"true",children:o}):null,C]}),v?jsxRuntime.jsx("div",{ref:y=>{f.current=y,y&&u.current&&(u.current=false,it(Jt(y),"first"));},id:g,role:"menu","aria-label":C,className:"docx-toolbar__menu docx-menubar__menu",onKeyDown:y=>{let x=f.current;if(!x)return;let M=Jt(x),E=document.activeElement;y.key==="ArrowDown"?(y.preventDefault(),at(M,E,1)):y.key==="ArrowUp"?(y.preventDefault(),at(M,E,-1)):y.key==="Home"?(y.preventDefault(),it(M,"first")):y.key==="End"?(y.preventDefault(),it(M,"last")):y.key==="Escape"?(y.preventDefault(),y.stopPropagation(),S()):y.key==="Tab"&&l(null);},children:P}):null]})}function Jl(e){return Object.assign(n=>jsxRuntime.jsx(Zo,{id:e,...n}),{docxMenu:e})}var es=Jl("file"),ts=Jl("format"),os=Jl("insert");function oy({className:e,hidden:t,onSelect:n}){let{setOpenMenu:o,onReportIssue:r,reportIssue:a}=ft(),i=Oe();if(t||a===false)return null;let s=n??r??Wn;return jsxRuntime.jsx(Le,{slot:"help.reportIssue",onSelect:()=>{s(),o(null);},...e?{className:e}:{},children:i("toolbar.reportIssue")})}var Pa=Object.assign(oy,{docxSlot:"help.reportIssue"});function ny({children:e,...t}){let{reportIssue:n}=ft();return e===void 0&&n===false?null:jsxRuntime.jsxs(Zo,{id:"help",...t,children:[jsxRuntime.jsx(Pa,{}),e]})}var ns=Object.assign(ny,{docxMenu:"help"});var iy={file:es,format:ts,insert:os,help:ns},ly=new Set(editor.CHROME_MENUS.map(e=>e.id));function cp(e){if(!Ye.isValidElement(e))return null;if(e.type===Ye.Fragment){let o=Ye.Children.toArray(e.props.children).map(cp).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===Zo){let n=e.props.id;if(typeof n=="string"&&ly.has(n))return n}return null}function sy(e){let t=Xe(),{className:n,t:o,fileName:r,onOpen:a,onOpenFile:i,onSave:s,onPageSetup:c,onReportIssue:l,reportIssue:d,preset:p=true,children:g}=e,m=A(),{t:f}=_(),[u,h]=Ye.useState(null),[b,v]=Ye.useState(null),[C,P]=Ye.useState(null),[S,y]=Ye.useState(false),x=Ye.useRef(null),M=Ye.useRef(null);Ye.useEffect(()=>{if(u===null)return;let z=$=>{let Q=x.current;Q&&$.target instanceof Node&&Q.contains($.target)||h(null);},Z=$=>{$.key==="Escape"&&h(null);};return document.addEventListener("mousedown",z),document.addEventListener("keydown",Z),()=>{document.removeEventListener("mousedown",z),document.removeEventListener("keydown",Z);}},[u]);let E=Ye.useCallback(z=>{h(z),z!==null&&P(z);},[]),w=Ye.useCallback(()=>M.current?.click(),[]),N=Ye.useCallback(()=>{m&&m.save().then(z=>Qu(z,ju(r??b??void 0))).catch(z=>{console.error("[docx-editor] save failed",z);});},[m,r,b]),F=Ye.useCallback(()=>y(true),[]),H=m?a??w:void 0,I=m?s??N:void 0,D=m?c??F:void 0;Ye.useEffect(()=>{let z=Z=>{if(!(Z.metaKey||Z.ctrlKey)||Z.altKey||Z.shiftKey)return;let $=Z.key.toLowerCase();if($!=="s"&&$!=="o")return;let Q=Z.target,Me=Fo(x.current)??x.current;!Q||!Me?.contains(Q)||($==="s"&&I?(Z.preventDefault(),I()):$==="o"&&H&&(Z.preventDefault(),H()));};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[H,I]);let k=Ye.useMemo(()=>({t:o,openMenu:u,setOpenMenu:E,activeMenu:C,onOpen:H,onSave:I,onPageSetup:D,onReportIssue:l,reportIssue:d}),[o,u,E,C,H,I,D,l,d]),R;if(!p)R=g;else {let z=new Map,Z=[];for(let $ of Ye.Children.toArray(g)){let Q=cp($);Q?z.set(Q,$):Z.push($);}R=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[editor.CHROME_MENUS.map($=>{let Q=z.get($.id);if(Q)return jsxRuntime.jsx(Ye.Fragment,{children:Q},$.id);let Me=iy[$.id];return jsxRuntime.jsx(Me,{},$.id)}),Z]});}return jsxRuntime.jsxs($n.Provider,{value:k,children:[jsxRuntime.jsx("div",{ref:z=>{if(x.current=z,z&&C===null){let Z=Ol(z)[0]?.closest("[data-menu]")?.getAttribute("data-menu");Z&&P(Z);}},role:"menubar","aria-label":o?.("titleBar.menuBarAriaLabel")??f("titleBar.menuBarAriaLabel"),"data-testid":"docx-menubar",className:`${t}docx-menubar${n?` ${n}`:""}`,onMouseDown:O,onKeyDown:z=>{if(z.key!=="ArrowLeft"&&z.key!=="ArrowRight")return;let Z=x.current;if(!Z)return;let $=Ol(Z),Q=$.indexOf(document.activeElement);if(Q===-1)return;z.preventDefault();let Me=z.key==="ArrowRight"?1:-1,se=$[(Q+Me+$.length)%$.length],Te=se?.closest("[data-menu]")?.getAttribute("data-menu");Te&&(P(Te),se?.focus(),u!==null&&h(Te));},children:R}),jsxRuntime.jsx("input",{ref:M,type:"file",accept:".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document",style:{display:"none"},onChange:z=>{let Z=z.target.files?.[0];z.target.value="",!(!Z||!m)&&(v(Z.name),i?.(Z),Z.arrayBuffer().then($=>m.load(new Uint8Array($))).catch($=>{console.error("[docx-editor] could not open the file",$);}));}}),jsxRuntime.jsx(Vn,{open:S,onClose:()=>y(false)})]})}var jn=Object.assign(sy,{Menu:Zo,File:es,Format:ts,Insert:os,Help:ns,Item:gt,Row:Le,Group:Gn,Separator:no,Submenu:oo,TableGrid:Ca,Entry:Yn,Open:Xl,Save:jl,PageSetup:Ql,ReportIssue:Pa});function _e(e){return e/1440*96}function Ma(e){return e/96*1440}function ze(e){return `${Math.round(e*100)/100}px`}function rs(e){return e/2}var my=12240,pp=1440,gp=1440,bp=567,ro=20,is=6,fy=ro+is+2,gy="var(--doc-text-muted)",by="var(--doc-text-subtle)",mp="var(--doc-shadow-subtle)",hy="var(--doc-primary)",vy="var(--doc-primary-hover)",yy="var(--doc-text-subtle)",Jn=5,Qn=7,xy={left:0,right:0,firstLine:0};function fp(e,t){return t==="inch"?(e/gp).toFixed(2)+'"':(e/bp).toFixed(1)+" cm"}function Ty(e,t){return t?1:Math.round(e==="cm"?editor.SNAP_TWIPS_CM:editor.SNAP_TWIPS_INCH)}function ao({pageSetup:e,zoom:t=1,editable:n=false,onLeftMarginChange:o,onRightMarginChange:r,onMarginDragEnd:a,showIndentHandles:i=false,indent:s,indentEditable:c=false,onIndentChange:l,onIndentDragEnd:d,unit:p="inch",className:g="",style:m,tabMarks:f,onTabMarkRemove:u}){let{t:h}=_(),[b,v]=Ye.useState(null),[C,P]=Ye.useState(null),[S,y]=Ye.useState(null),[x,M]=Ye.useState(null),E=Ye.useRef(null),w=e?.pageWidthTwips??my,N=e?.marginsTwips.left??pp,F=e?.marginsTwips.right??pp,H=e?.gutterTwips??0,I={pageWidth:w,leftMargin:N,rightMargin:F},D=s??xy,k=_e(w)*t,R=_e(N)*t,z=_e(F)*t,Z=Ye.useCallback(B=>{let Pe=E.current?.getBoundingClientRect();return Pe?Ma((B-Pe.left)/t):null},[t]),$=Ye.useCallback((B,Pe,Ue)=>{let ce=Z(Pe);if(ce===null)return;if(M(_e(ce)*t),B==="leftMargin"||B==="rightMargin"){if(B==="leftMargin"){let rn=w-F-H-720,Eo=Math.round(Math.max(0,Math.min(ce,rn)));y(Eo),o?.(Eo);}else {let rn=w-ce,Eo=w-N-H-720,Mr=Math.round(Math.max(0,Math.min(rn,Eo)));y(Mr),r?.(Mr);}return}let Ge=editor.dragIndent(B,ce,D,I,{unit:p,precise:Ue});y(B==="right"?Ge.right:B==="firstLine"?Ge.firstLine:Ge.left),l?.(Ge);},[Z,t,w,N,F,H,o,r,l,D,I,p]),Q=Ye.useCallback(B=>{B==="leftMargin"||B==="rightMargin"?a?.():d?.(),v(null),y(null),M(null);},[a,d]),Me=Ye.useCallback((B,Pe,Ue)=>{let ce=editor.handlePosition(B,D,I),Ge=editor.dragIndent(B,ce+Pe*Ty(p,Ue),D,I,{unit:p,precise:true});l?.(Ge),d?.();},[D,I,p,l,d]),se=My(w,t,p),Te=i&&c&&l!==void 0,Ce=B=>_e(editor.handlePosition(B,D,I))*t,G=(B,Pe,Ue)=>({positionPx:Ce(B),editable:Te,isDragging:b===B,isHovered:C===B,onPointerEnter:()=>P(B),onPointerLeave:()=>P(null),onPointerDown:ce=>{Te&&(ce.preventDefault(),ce.stopPropagation(),ce.currentTarget.setPointerCapture(ce.pointerId),v(B));},onPointerMove:ce=>{b===B&&$(B,ce.clientX,ce.altKey);},onPointerUp:ce=>{b===B&&(ce.currentTarget.releasePointerCapture(ce.pointerId),Q(B));},onKeyDown:ce=>{Te&&(ce.key!=="ArrowLeft"&&ce.key!=="ArrowRight"||(ce.preventDefault(),Me(B,ce.key==="ArrowLeft"?-1:1,ce.shiftKey)));},label:h(Pe),valueNow:Ue,valueText:fp(Ue,p),pageWidthTwips:w});return jsxRuntime.jsxs("div",{ref:E,className:`docx-horizontal-ruler ${g}`,style:{position:"relative",width:ze(k),height:fy,backgroundColor:"transparent",overflow:"visible",userSelect:"none",touchAction:"none",cursor:b?"ew-resize":"default",...m},role:"group","aria-label":h("ruler.horizontal"),children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:ze(R),height:ro,backgroundColor:mp,borderRight:"1px solid var(--doc-shadow-subtle)",cursor:n?"ew-resize":"default",zIndex:1},onPointerDown:n&&o?B=>{B.preventDefault(),B.currentTarget.setPointerCapture(B.pointerId),v("leftMargin");}:void 0,onPointerMove:B=>b==="leftMargin"&&$("leftMargin",B.clientX,B.altKey),onPointerUp:B=>{b==="leftMargin"&&(B.currentTarget.releasePointerCapture(B.pointerId),Q("leftMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,right:0,width:ze(z),height:ro,backgroundColor:mp,borderLeft:"1px solid var(--doc-shadow-subtle)",cursor:n?"ew-resize":"default",zIndex:1},onPointerDown:n&&r?B=>{B.preventDefault(),B.currentTarget.setPointerCapture(B.pointerId),v("rightMargin");}:void 0,onPointerMove:B=>b==="rightMargin"&&$("rightMargin",B.clientX,B.altKey),onPointerUp:B=>{b==="rightMargin"&&(B.currentTarget.releasePointerCapture(B.pointerId),Q("rightMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:ro,pointerEvents:"none"},children:se.map((B,Pe)=>jsxRuntime.jsx(Sy,{tick:B},Pe))}),f?.map(B=>jsxRuntime.jsx(wy,{tabMark:B,positionPx:_e(B.position)*t,onDoubleClick:()=>u?.(B.position)},B.position)),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(as,{direction:"down",anchor:"top",...G("firstLine","ruler.firstLineIndent",D.firstLine)}),jsxRuntime.jsx(as,{direction:"up",anchor:"strip",...G("hanging","ruler.hangingIndent",D.left)}),jsxRuntime.jsx(Cy,{...G("left","ruler.leftIndent",D.left)}),jsxRuntime.jsx(as,{direction:"up",anchor:"strip",...G("right","ruler.rightIndent",D.right)})]}),b&&S!==null&&x!==null&&jsxRuntime.jsx(Py,{value:fp(S,p),positionPx:x})]})}function Sy({tick:e}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:{position:"absolute",left:ze(e.position),bottom:0,width:1,height:e.height,backgroundColor:by}}),e.label&&jsxRuntime.jsx("div",{style:{position:"absolute",left:ze(e.position),top:2,transform:"translateX(-50%)",fontSize:"9px",color:gy,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:e.label})]})}function hp(e){return e.editable?e.isDragging||e.isHovered?vy:hy:yy}function vp(e,t,n){return {position:"absolute",left:ze(e.positionPx-t/2),width:t,cursor:e.editable?"ew-resize":"default",zIndex:e.isDragging?10:4,touchAction:"none",...n}}function yp(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 as({direction:e,anchor:t,...n}){let o=hp(n),r=t==="top"?{top:0,height:Qn+1}:{top:ro-Qn,height:Qn};return jsxRuntime.jsx("div",{className:"docx-ruler-indent",style:vp(n,Jn*2,r),onPointerEnter:n.onPointerEnter,onPointerLeave:n.onPointerLeave,onPointerDown:n.onPointerDown,onPointerMove:n.onPointerMove,onPointerUp:n.onPointerUp,onKeyDown:n.onKeyDown,...yp(n),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:0,width:0,height:0,borderLeft:`${Jn}px solid transparent`,borderRight:`${Jn}px solid transparent`,...e==="down"?{top:0,borderTop:`${Qn}px solid ${o}`}:{bottom:0,borderBottom:`${Qn}px solid ${o}`},transition:"border-color 0.1s"}})})}function Cy(e){return jsxRuntime.jsx("div",{className:"docx-ruler-indent docx-ruler-indent--box",style:vp(e,Jn*2,{top:ro+1,height:is}),onPointerEnter:e.onPointerEnter,onPointerLeave:e.onPointerLeave,onPointerDown:e.onPointerDown,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onKeyDown:e.onKeyDown,...yp(e),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:1,top:0,width:Jn*2-2,height:is,backgroundColor:hp(e),borderRadius:1,transition:"background-color 0.1s"}})})}function Py({value:e,positionPx:t}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:ze(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 Ey={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function wy({tabMark:e,positionPx:t,onDoubleClick:n}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:ze(t-5),top:ro-12,width:10,height:12,display:"flex",alignItems:"center",justifyContent:"center",fontSize:8,fontWeight:700,color:"var(--doc-text-muted)",cursor:"pointer",userSelect:"none"},onDoubleClick:o=>{o.stopPropagation(),n();},title:`${e.alignment} tab at ${(e.position/1440).toFixed(2)}"`,children:Ey[e.alignment]||"L"})}function My(e,t,n){let o=[];if(n==="inch"){let r=gp/8,a=Math.ceil(e/r);for(let i=0;i<=a;i++){let s=i*r;if(s>e)break;let c=_e(s)*t;i%8===0?o.push({position:c,height:8,label:i/8>0?String(i/8):void 0}):i%4===0?o.push({position:c,height:5}):i%2===0?o.push({position:c,height:3}):o.push({position:c,height:2});}}else {let r=bp/10,a=Math.ceil(e/r);for(let i=0;i<=a;i++){let s=i*r;if(s>e)break;let c=_e(s)*t;i%10===0?o.push({position:c,height:8,label:i/10>0?String(i/10):void 0}):i%5===0?o.push({position:c,height:5}):o.push({position:c,height:3});}}return o}var Ry=15840,Sp=1440,_y=1440,Ny=567,Bo=20,Dy="var(--doc-text-muted)",Ly="var(--doc-text-subtle)",Hy="var(--doc-primary)",Fy="var(--doc-primary)",Ay="var(--doc-primary-hover)";function er({pageSetup:e,zoom:t=1,editable:n=false,onTopMarginChange:o,onBottomMarginChange:r,onMarginDragEnd:a,unit:i="inch",className:s="",style:c}){let{t:l}=_(),[d,p]=Ye.useState(null),[g,m]=Ye.useState(null),f=Ye.useRef(null),u=e?.pageHeightTwips??Ry,h=e?.marginsTwips.top??Sp,b=e?.marginsTwips.bottom??Sp,v=_e(u)*t,C=_e(h)*t,P=_e(b)*t,S=Ye.useCallback((w,N)=>{n&&(w.preventDefault(),p(N));},[n]),y=Ye.useCallback(w=>{if(!d||!f.current)return;let N=f.current.getBoundingClientRect(),F=w.clientY-N.top,H=Ma(F/t);if(d==="topMargin"){let I=u-b-720,D=Math.max(0,Math.min(H,I));o?.(Math.round(D));}else if(d==="bottomMargin"){let I=u-H,D=u-h-720,k=Math.max(0,Math.min(I,D));r?.(Math.round(k));}},[d,t,u,h,b,o,r]),x=Ye.useCallback(()=>{d!==null&&a?.(),p(null);},[d,a]);Ye.useEffect(()=>{if(d)return document.addEventListener("mousemove",y),document.addEventListener("mouseup",x),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",x);}},[d,y,x]);let M=Zy(u,t,i),E={position:"relative",width:Bo,height:ze(v),backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:d?"ns-resize":"default",...c};return jsxRuntime.jsxs("div",{ref:f,className:`docx-vertical-ruler ${s}`,style:E,role:"slider","aria-label":l("ruler.vertical"),"aria-orientation":"vertical",children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"},children:M.map((w,N)=>jsxRuntime.jsx(Oy,{tick:w},N))}),jsxRuntime.jsx(Cp,{type:"topMargin",position:C,editable:n,isDragging:d==="topMargin",isHovered:g==="topMargin",onMouseEnter:()=>m("topMargin"),onMouseLeave:()=>m(null),onMouseDown:w=>S(w,"topMargin")}),jsxRuntime.jsx(Cp,{type:"bottomMargin",position:v-P,editable:n,isDragging:d==="bottomMargin",isHovered:g==="bottomMargin",onMouseEnter:()=>m("bottomMargin"),onMouseLeave:()=>m(null),onMouseDown:w=>S(w,"bottomMargin")})]})}function Oy({tick:e}){let t={position:"absolute",top:ze(e.position),right:0,height:1,width:e.width,backgroundColor:Ly},n={position:"absolute",top:ze(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:Dy,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 Cp({type:e,position:t,editable:n,isDragging:o,isHovered:r,onMouseEnter:a,onMouseLeave:i,onMouseDown:s}){let{t:c}=_(),l=o?Ay:r?Fy:Hy,d={position:"absolute",top:ze(t-5),right:0,width:Bo,height:10,cursor:n?"ns-resize":"default",zIndex:o?10:1},p={position:"absolute",top:0,right:2,width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderRight:`8px solid ${l}`,transition:"border-right-color 0.1s"};return jsxRuntime.jsx("div",{className:`docx-ruler-marker docx-ruler-marker-${e}`,style:d,onMouseEnter:a,onMouseLeave:i,onMouseDown:s,role:"slider","aria-label":c(e==="topMargin"?"ruler.topMargin":"ruler.bottomMargin"),"aria-orientation":"vertical",tabIndex:n?0:-1,children:jsxRuntime.jsx("div",{style:p})})}function Zy(e,t,n){let o=[];if(n==="inch"){let r=_y/8,a=Math.ceil(e/r);for(let i=0;i<=a;i++){let s=i*r;if(s>e)break;let c=_e(s)*t;if(i%8===0){let l=i/8;o.push({position:c,width:10,label:l>0?String(l):void 0});}else i%4===0?o.push({position:c,width:6}):i%2===0?o.push({position:c,width:4}):o.push({position:c,width:2});}}else {let r=Ny/10,a=Math.ceil(e/r);for(let i=0;i<=a;i++){let s=i*r;if(s>e)break;let c=_e(s)*t;if(i%10===0){let l=i/10;o.push({position:c,width:10,label:l>0?String(l):void 0});}else i%5===0?o.push({position:c,width:6}):o.push({position:c,width:3});}}return o}var io=e=>e.isLoading||e.parseError!==null||e.pageSetup==null;var Ky=e=>e.formatting?.indent??null,zy=e=>e.editable;function cs(){let e=A(),t=q(Ky),n=q(zy),o=Ye.useMemo(()=>n&&e!==null&&e.can({type:"setIndent",left:0}).ok,[e,n]),r=Ye.useCallback(a=>e?e.exec({...a.left!==void 0?{left:a.left}:{},...a.right!==void 0?{right:a.right}:{},...a.firstLine!==void 0?{firstLine:a.firstLine}:{},type:"setIndent"}).ok:false,[e]);return Ye.useMemo(()=>({indent:t,isEnabled:o,apply:r}),[t,o,r])}var kp=e=>e.zoom;function Ip(e,t){return !e||Object.keys(t).length===0?e:{...e,marginsTwips:{...e.marginsTwips,...t}}}function Rp(){let{apply:e}=eo(),[t,n]=Ye.useState({}),o=Ye.useRef({}),r=Ye.useCallback(i=>s=>{o.current={...o.current,[i]:Math.round(s)},n(o.current);},[]),a=Ye.useCallback(()=>{let i=o.current;o.current={},n({}),Object.keys(i).length!==0&&e({...i.top!==void 0?{marginTopTwips:i.top}:{},...i.right!==void 0?{marginRightTwips:i.right}:{},...i.bottom!==void 0?{marginBottomTwips:i.bottom}:{},...i.left!==void 0?{marginLeftTwips:i.left}:{},scope:"section"});},[e]);return {pending:t,preview:r,commit:a}}function Mp(e){let t=e?.snapshot().selection??null;return t?JSON.stringify(t):""}function Wy(){let e=A(),{indent:t,isEnabled:n,apply:o}=cs(),[r,a]=Ye.useState(null),i=Ye.useRef(null),s=Ye.useRef(null),c=Ye.useCallback(p=>{s.current===null&&(s.current=Mp(e)),i.current=p,a(p);},[e]),l=Ye.useCallback(()=>{let p=i.current,g=s.current;i.current=null,s.current=null,a(null),p&&(g!==null&&g!==Mp(e)||o({left:p.left,right:p.right,firstLine:p.firstLine}));},[e,o]),d=Ye.useMemo(()=>r??(t?{left:t.left,right:t.right,firstLine:t.firstLine}:null),[r,t]);return Ye.useMemo(()=>({indent:d,isEnabled:n,preview:c,commit:l}),[d,n,c,l])}function Uy(){let e=_o(),[t,n]=Ye.useState(0);return Ye.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 _a(e){let t=q(io),{pageSetup:n,isEnabled:o}=eo(),r=q(kp),{pending:a,preview:i,commit:s}=Rp(),c=Wy(),l=Ro(),d=Gy(),p=Uy();return t?null:jsxRuntime.jsx(ao,{pageSetup:Ip(n,a),zoom:r,editable:o,onLeftMarginChange:i("left"),onRightMarginChange:i("right"),onMarginDragEnd:s,showIndentHandles:c.indent!==null,indent:c.indent,indentEditable:c.isEnabled,onIndentChange:c.preview,onIndentDragEnd:c.commit,unit:e.unit??"inch",className:e.className??"",style:{flexShrink:0,marginRight:d,...e.style,marginInlineStart:l,transition:"margin 0.2s ease",transform:`${e.style?.transform?`${e.style.transform} `:""}translateX(${-p}px)`,clipPath:l>0&&p>0?`inset(0 0 0 ${p}px)`:e.style?.clipPath}})}function Gy(){let e=q(Yy);return (Ye.useContext(St)?.mounted??0)===0?0:e?Xy:jy}var Yy=e=>e.reviewPaneOpen??true,Xy=316,jy=44;function Na(e){let t=q(io),{pageSetup:n,isEnabled:o}=eo(),r=q(kp),{pending:a,preview:i,commit:s}=Rp();return t?null:jsxRuntime.jsx(er,{pageSetup:Ip(n,a),zoom:r,editable:o,onTopMarginChange:i("top"),onBottomMarginChange:i("bottom"),onMarginDragEnd:s,unit:e.unit??"inch",className:e.className??"",style:e.style})}function L({size:e=20,className:t="",style:n,children:o}){return jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 -960 960 960",fill:"currentColor",className:t,style:{display:"inline-flex",flexShrink:0,...n},"aria-hidden":"true",children:o})}function Jy(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"})})}function ex(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"})})}function tx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z"})})}function ox(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-320 280-520l56-58 104 104v-326h80v326l104-104 56 58-200 200ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"})})}function nx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-320v-326L336-542l-56-58 200-200 200 200-56 58-104-104v326h-80ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"})})}function rx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"})})}function ax(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"})})}function ix(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-120v-80h560v80H200Zm123-223q-56-63-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63q-101 0-157-63Z"})})}function lx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"})})}function sx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"})})}function cx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"})})}function dx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"})})}function ux(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"})})}function px(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"})})}function mx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"})})}function fx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"})})}function gx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"})})}function ps(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M240-160 80-320l56-56 64 62v-332l-64 62-56-56 160-160 160 160-56 56-64-62v332l64-62 56 56-160 160Zm240-40v-80h400v80H480Zm0-240v-80h400v80H480Zm0-240v-80h400v80H480Z"})})}function bx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"})})}function hx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"})})}function vx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"})})}function yx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"})})}function xx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm140-280 210-560h100l210 560h-96l-50-144H368l-52 144h-96Zm176-224h168l-82-232h-4l-82 232Z"})})}function Tx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M544-400 440-504 240-304l104 104 200-200Zm-47-161 104 104 199-199-104-104-199 199Zm-84-28 216 216-229 229q-24 24-56 24t-56-24l-2-2-26 26H60l126-126-2-2q-24-24-24-56t24-56l229-229Zm0 0 227-227q24-24 56-24t56 24l104 104q24 24 24 56t-24 56L629-373 413-589Z"})})}function Sx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M800-436q0 36-8 69t-22 63l-62-60q6-17 9-34.5t3-37.5q0-47-17.5-89T650-600L480-768l-88 86-56-56 144-142 226 222q44 42 69 99.5T800-436Zm-8 380L668-180q-41 29-88 44.5T480-120q-133 0-226.5-92.5T160-436q0-51 16-98t48-90L56-792l56-56 736 736-56 56ZM480-200q36 0 68.5-10t61.5-28L280-566q-21 32-30.5 64t-9.5 66q0 98 70 167t170 69Zm-37-204Zm110-116Z"})})}function Cx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-360 280-560h400L480-360Z"})})}function Px(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"})})}function Ex(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120ZM200-640h560v-120H200v120Zm100 80H200v360h100v-360Zm360 0v360h100v-360H660Zm-80 0H380v360h200v-360Z"})})}function wx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"})})}function Mx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M760-200v-120H200v120h560Zm0-200v-160H200v160h560Zm0-240v-120H200v120h560ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Z"})})}function kx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z"})})}function Np(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"})})}function Ix(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-200h560v-560H200v560Zm-80 80v-720h720v720H120Zm160-320v-80h80v80h-80Zm160 160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 160v-80h80v80h-80Z"})})}function Rx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm320 640v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm-160 0v-80h80v80h-80ZM440-120v-320H120v-80h320v-320h80v320h320v80H520v320h-80Z"})})}function _x(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function Nx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"})})}function Dx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-440v-80h560v80H200Z"})})}function Lx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"})})}function Hx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M600-240v-80h160v80H600Zm0-320v-80h280v80H600Zm0 160v-80h240v80H600ZM120-640H80v-80h160v-60h160v60h160v80h-40v360q0 33-23.5 56.5T440-200H200q-33 0-56.5-23.5T120-280v-360Zm80 0v360h240v-360H200Zm0 0v360-360Z"})})}function Fx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m296-160-56-56 200-200v-269L337-582l-57-57 200-200 201 201-57 57-104-104v301L296-160Zm368 1L536-286l57-57 127 128-56 56Z"})})}function Ax(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"})})}function Ox(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"})})}function Zx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"})})}function Bx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-280v-400h400v400H120Zm80-80h240v-240H200v240Zm-80-400v-80h720v80H120Zm480 160v-80h240v80H600Zm0 160v-80h240v80H600Zm0 160v-80h240v80H600ZM120-120v-80h720v80H120Z"})})}function qx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-280v-400h400v400H440Zm80-80h240v-240H520v240ZM120-120v-80h720v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h720v80H120Z"})})}function Kx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-440v-80h640v80H160Z"})})}function zx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-480h80v480h480v80H200Zm160-240v80q-33 0-56.5-23.5T280-360h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm80-160h-80q0-33 23.5-56.5T360-840v80Zm80 480v-80h80v80h-80Zm0-480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0 480v-80h80v80h-80Zm160-480v-80q33 0 56.5 23.5T840-760h-80Zm0 400h80q0 33-23.5 56.5T760-280v-80Zm0-80v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function Vx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function $x(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-80 310-250l57-57 73 73v-166h80v165l72-73 58 58L480-80ZM250-310 80-480l169-169 57 57-72 72h166v80H235l73 72-58 58Zm460 0-57-57 73-73H560v-80h165l-73-72 58-58 170 170-170 170ZM440-560v-166l-73 73-57-57 170-170 170 170-57 57-73-73v166h-80Z"})})}function Wx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-120v-240h80v80h320v80H520v80h-80Zm-320-80v-80h240v80H120Zm160-160v-80H120v-80h160v-80h80v240h-80Zm160-80v-80h400v80H440Zm160-160v-240h80v80h160v80H680v80h-80Zm-480-80v-80h400v80H120Z"})})}function Ux(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M522-80v-82q34-5 66.5-18t61.5-34l56 58q-42 32-88 51.5T522-80Zm-80 0Q304-98 213-199.5T122-438q0-75 28.5-140.5t77-114q48.5-48.5 114-77T482-798h6l-62-62 56-58 160 160-160 160-56-56 64-64h-8q-117 0-198.5 81.5T202-438q0 104 68 182.5T442-162v82Zm322-134-58-56q21-29 34-61.5t18-66.5h82q-5 50-24.5 96T764-214Zm76-264h-82q-5-34-18-66.5T706-606l58-56q32 39 51 86t25 98Z"})})}function Gx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-80q-50-5-96-24.5T256-156l56-58q29 21 61.5 34t66.5 18v82Zm80 0v-82q104-15 172-93.5T760-438q0-117-81.5-198.5T480-718h-8l64 64-56 56-160-160 160-160 56 58-62 62h6q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-438q0 137-91 238.5T520-80ZM198-214q-32-42-51.5-88T122-398h82q5 34 18 66.5t34 61.5l-58 56Zm-76-264q6-51 25-98t51-86l58 56q-21 29-34 61.5T204-478h-82Z"})})}function Yx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M280-160 80-360l200-200 56 57-103 103h287v80H233l103 103-56 57Zm400-240-56-57 103-103H440v-80h287L624-743l56-57 200 200-200 200Z"})})}function Xx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M320-440v-287L217-624l-57-56 200-200 200 200-57 56-103-103v287h-80ZM600-80 400-280l57-56 103 103v-287h80v287l103-103 57 56L600-80Z"})})}function jx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M600-360ZM320-242q10 1 19.5 1.5t20.5.5q11 0 20.5-.5T400-242v82h400v-400h-82q1-10 1.5-19.5t.5-20.5q0-11-.5-20.5T718-640h82q33 0 56.5 23.5T880-560v400q0 33-23.5 56.5T800-80H400q-33 0-56.5-23.5T320-160v-82Zm40-78q-117 0-198.5-81.5T80-600q0-117 81.5-198.5T360-880q117 0 198.5 81.5T640-600q0 117-81.5 198.5T360-320Zm0-80q83 0 141.5-58.5T560-600q0-83-58.5-141.5T360-800q-83 0-141.5 58.5T160-600q0 83 58.5 141.5T360-400Zm0-200Z"})})}function Qx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h480v440q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v160h-80v-160h-40v80h-80v-80H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z"})})}function Jx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"})})}function eT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z"})})}function tT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h720v80H120Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function oT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function nT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm160 0v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function rT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-720h80v720h-80Z"})})}function aT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h720v60H120Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Z"})})}function iT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-720h60v720h-60Zm165 0v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Z"})})}function lT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M320-600q17 0 28.5-11.5T360-640q0-17-11.5-28.5T320-680q-17 0-28.5 11.5T280-640q0 17 11.5 28.5T320-600Zm160 0q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm160 0q17 0 28.5-11.5T680-640q0-17-11.5-28.5T640-680q-17 0-28.5 11.5T600-640q0 17 11.5 28.5T640-600ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"})})}function sT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-200v-80h528l-42-42 56-56 138 138-138 138-56-56 42-42H160Zm116-200 164-440h80l164 440h-76l-38-112H392l-40 112h-76Zm138-176h132l-64-182h-4l-64 182Z"})})}function cT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M588-132 440-280l148-148 56 58-50 50h96q29 0 49.5-20.5T760-390q0-29-20.5-49.5T690-460H160v-80h530q63 0 106.5 43.5T840-390q0 63-43.5 106.5T690-240h-96l50 50-56 58ZM160-240v-80h200v80H160Zm0-440v-80h640v80H160Z"})})}function dT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-120 320-280l56-56 64 63v-414l-64 63-56-56 160-160 160 160-56 57-64-64v414l64-63 56 56-160 160Z"})})}function uT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm640 0v-720h80v720h-80ZM280-440v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function pT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"})})}function mT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm160-320h56l312-311-29-29-28-28-311 312v56Zm-80 80v-170l448-447q11-11 25.5-17t30.5-6q16 0 31 6t27 18l55 56q12 11 17.5 26t5.5 31q0 15-5.5 29.5T777-687L330-240H160Zm560-504-56-56 56 56ZM608-631l-29-29-28-28 57 57Z"})})}function fT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m247-904 57-56 343 343q23 23 23 57t-23 57L457-313q-23 23-57 23t-57-23L153-503q-23-23-23-57t23-57l190-191-96-96Zm153 153L209-560h382L400-751Zm360 471q-33 0-56.5-23.5T680-360q0-21 12.5-45t27.5-45q9-12 19-25t21-25q11 12 21 25t19 25q15 21 27.5 45t12.5 45q0 33-23.5 56.5T760-280ZM80 0v-160h800V0H80Z"})})}function gT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-760v-80h640v80H160Zm280 640v-408L336-424l-56-56 200-200 200 200-56 56-104-104v408h-80Z"})})}function bT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-80v-168l-64 64-56-56 160-160 160 160-56 56-64-64v168h-80ZM160-440v-80h640v80H160Zm320-120L320-720l56-56 64 64v-168h80v168l64-64 56 56-160 160Z"})})}function hT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-120v-80h640v80H160Zm320-160L280-480l56-56 104 104v-408h80v408l104-104 56 56-200 200Z"})})}function vT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"})})}function yT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"})})}function xT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"})})}function TT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"})})}function ST(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"})})}function CT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-160q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm0-240q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm0-240q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Z"})})}function PT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-440v-80h160v80H120Zm200 0v-80h160v80H320Zm200 0v-80h160v80H520Zm200 0v-80h120v80H720ZM240-120q-33 0-56.5-23.5T160-200v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-120H240Zm-80-520v-120q0-33 23.5-56.5T240-840h480q33 0 56.5 23.5T800-760v120h-80v-120H240v120h-80Z"})})}function ET(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm0-80h640v-480H160v480Zm320-60q66 0 113-37t47-93q0-29-13-58t-34-55q-21-26-50-49t-50-31q-21 8-50 31t-50 49q-21 26-34 55t-13 58q0 56 47 93t140 37Z"})})}function wT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M313-440l224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"})})}function MT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"})})}function kT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"})})}function IT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M268-240 42-466l57-56 170 170 56 56-57 56Zm226 0L268-466l56-57 170 170 368-368 57 57-425 424Zm0-226-57-56 198-198 57 56-198 198Z"})})}function RT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m424-296 282-282-56-56-226 226-114-114-56 56 170 170Zm56 216q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z"})})}function _T(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function NT(e){return jsxRuntime.jsxs(L,{...e,children:[jsxRuntime.jsx("path",{d:"M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"}),jsxRuntime.jsx("path",{fill:"var(--doc-success)",d:"m421-380 227-227-45-45-182 182-92-91-45 45 137 136Z"})]})}function DT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"})})}function LT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"})})}function HT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-400h80v-120h120v-80H520v-120h-80v120H320v80h120v120ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function FT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M240-400h480v-80H240v80Zm0-120h480v-80H240v80Zm0-120h480v-80H240v80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function AT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-400h280v-80H160v80Zm0-160h440v-80H160v80Zm0-160h440v-80H160v80Zm360 360v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T863-380L643-160H520Zm300-263-37-37 37 37ZM580-220h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z"})})}function OT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M240-400h122l200-200q9-9 13.5-20.5T580-643q0-11-5-21.5T562-684l-36-38q-9-9-20-13.5t-23-4.5q-11 0-22.5 4.5T440-722L240-522v122Zm280-243-37-37 37 37ZM300-460v-38l101-101 20 18 18 20-101 101h-38Zm121-121 18 20-38-38 20 18Zm26 181h273v-80H527l-80 80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function ZT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Zm0-300Zm0 220q113 0 207.5-59.5T832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280Z"})})}function BT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm0-280v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80ZM680-80l-56-56 64-64H120v-80h568l-64-64 56-56 160 160L680-80Z"})})}function qT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm-88 160 64 64-56 56-160-160 160-160 56 56-64 64h568v80H272Zm88-440v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80Z"})})}function KT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"})})}var zT={undo:Jy,redo:ex,print:tx,file_download:ox,file_upload:nx,format_bold:rx,format_italic:ax,format_underlined:ix,strikethrough_s:lx,superscript:sx,subscript:cx,link:dx,format_clear:ux,format_align_left:px,format_align_center:mx,format_align_right:fx,format_align_justify:gx,format_line_spacing:ps,format_list_bulleted:bx,format_list_numbered:hx,format_indent_increase:vx,format_indent_decrease:yx,format_color_text:xx,ink_highlighter:Tx,format_color_reset:Sx,arrow_drop_down:Cx,table:Px,table_chart:Ex,grid_on:wx,table_rows:Mx,view_column:kx,border_all:Np,select_all:Np,border_outer:Ix,border_inner:Rx,border_clear:_x,add:Nx,remove:Dx,delete:Lx,delete_sweep:Hx,call_merge:Fx,call_split:Ax,drag_indicator:Ox,image:Zx,format_image_left:Bx,format_image_right:qx,horizontal_rule:Kx,flip_to_back:zx,flip_to_front:Vx,open_with:$x,tune:Wx,rotate_right:Ux,rotate_left:Gx,swap_horiz:Yx,swap_vert:Xx,shapes:jx,format_paint:Qx,expand_more:Jx,expand_less:eT,border_top:tT,border_bottom:oT,border_left:nT,border_right:rT,border_horizontal:aT,border_vertical:iT,padding:lT,text_rotation_none:sT,wrap_text:cT,height:dT,fit_width:uT,settings:pT,border_color:mT,format_color_fill:fT,vertical_align_top:gT,vertical_align_center:bT,vertical_align_bottom:hT,line_weight:vT,keyboard_arrow_up:yT,keyboard_arrow_down:xT,keyboard_arrow_left:TT,keyboard_arrow_right:ST,more_vert:CT,page_break:PT,branding_watermark:ET,arrow_back:wT,search:MT,toc:kT,done_all:IT,check_circle:RT,chat_bubble_outline:_T,chat_bubble_check:NT,check:DT,close:LT,add_comment:HT,comment:FT,edit_note:AT,rate_review:OT,visibility:ZT,format_textdirection_l_to_r:BT,format_textdirection_r_to_l:qT,"agent-sparkle":KT};function K({name:e,size:t=20,className:n="",style:o}){let r=zT[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 Da=12,ms=240,GT=24,tr=12,La=Ye__namespace.default.memo(function({headings:t,onHeadingClick:n,onClose:o,topOffset:r=0,scrollLeft:a=0,leftOffset:i=Da}){let{t:s}=_(),[c,l]=Ye.useState(false),d=t.length?Math.min(...t.map(p=>p.level)):0;return Ye.useEffect(()=>{requestAnimationFrame(()=>l(true));},[]),jsxRuntime.jsxs("nav",{className:"docx-outline-nav",role:"navigation","aria-label":s("documentOutline.ariaLabel"),style:{position:"absolute",top:r,left:i-a,bottom:0,width:ms,paddingTop:GT,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,transform:c?"translateX(0)":`translateX(-${i+ms}px)`,transition:"transform 0.15s ease-out"},onMouseDown:p=>p.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"16px 16px 12px 0"},children:[jsxRuntime.jsx("button",{onClick:o,"aria-label":s("documentOutline.closeAriaLabel"),style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:"50%",display:"flex",alignItems:"center",color:"var(--doc-text-muted)"},title:s("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:s("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:s("documentOutline.noHeadings")}):t.map((p,g)=>jsxRuntime.jsx("div",{style:{marginLeft:(p.level-d)*16},children:jsxRuntime.jsx("button",{className:"docx-outline-heading-btn",onClick:()=>n(p.blockId),style:{display:"block",width:"100%",textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"5px 8px",fontSize:13,fontWeight:400,color:"var(--doc-text)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderRadius:0,letterSpacing:"0.01em"},title:p.text,children:p.text})},`${p.blockId}-${g}`))})]})});var QT=e=>e,JT=Object.freeze([]),eS=()=>{};function fs(e){let t=A(),n=q(QT),o=Ye.useMemo(()=>t&&!n.isLoading?t.getOutline():JT,[t,n]),r=Ye.useCallback(a=>{if(!t)return;t.focus();let i={paragraphId:a,offset:0};t.exec({type:"setSelection",range:{anchor:i,head:i}}),t.scrollToBlock(a);},[t]);return io(n)?null:jsxRuntime.jsx(La,{headings:o,onHeadingClick:r,onClose:e.onClose??eS,topOffset:e.topOffset??0,...e.leftOffset!==void 0?{leftOffset:e.leftOffset}:{}})}var gs=Ye.createContext(null);function Ot(e){let t=Ye.useContext(gs);if(!t)throw new Error(`<DocxEditor.Navigation.${e}> must be rendered inside <DocxEditor.Navigation>`);return t}var qo=280,Ha=32,Hp=16;function Ko(e=280){return 32+e+16}function Fa({viewportWidth:e,pageWidthPx:t,reservation:n,inlineEndReservation:o=0,docked:r=false}){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0||!Number.isFinite(n)||n<=0||!Number.isFinite(o)||o<0)return 0;let a=(e-o-t)/2;return a>=n?0:!r&&n<=2*a?Math.ceil(2*(n-a)):Math.ceil(n)}var iS=Object.freeze([]),lS=e=>e;function Aa(){let e=A(),t=q(lS),[n,o]=Ye.useState(null),r=Ye.useMemo(()=>e&&!t.isLoading?e.getOutline():iS,[e,t]),a=Ye.useMemo(()=>{if(r.length===0)return [];let s=r[0].level;for(let c of r)c.level<s&&(s=c.level);return r.map(c=>({heading:c,depth:c.level-s}))},[r]),i=Ye.useCallback(s=>{if(!e||typeof s!="string"||s.length===0)return;e.focus();let c={paragraphId:s,offset:0};e.exec({type:"setSelection",range:{anchor:c,head:c}}),e.scrollToBlock(s),o(s);},[e]);return {headings:r,items:a,selectedBlockId:n,goTo:i,isEmpty:r.length===0}}var vs=150,ys=2e3,hs=Object.freeze([]),dS=e=>e;function Oa(){let e=A(),t=q(dS),[n,o]=Ye.useState(""),[r,a]=Ye.useState(""),[i,s]=Ye.useState(false),[c,l]=Ye.useState(false),[d,p]=Ye.useState(hs),[g,m]=Ye.useState(-1);Ye.useEffect(()=>{if(n===r)return;let y=setTimeout(()=>a(n),vs);return ()=>clearTimeout(y)},[n,r]);let f=Ye.useMemo(()=>({matchCase:i,wholeWord:c}),[i,c]);Ye.useEffect(()=>{if(!e||r.length===0){p(hs),m(-1);return}let y=e.findMatches(r,f);p(x=>x===y?x:y);},[e,r,f,t]);let u=Ye.useRef(d);Ye.useEffect(()=>{u.current!==d&&(u.current=d,m(y=>y>=0&&y<d.length?y:-1));},[d]);let h=Ye.useCallback(y=>{if(!e)return;let x=d[y];if(!x)return;e.focus(),e.selectMatch(x).ok&&m(y);},[e,d]),b=Ye.useCallback(y=>{if(d.length===0)return;let M=((g<0?y>0?-1:0:g)+y+d.length)%d.length;h(M);},[g,h,d.length]),v=Ye.useCallback(()=>b(1),[b]),C=Ye.useCallback(()=>b(-1),[b]),P=Ye.useCallback(y=>o(y),[]),S=Ye.useCallback(()=>{o(""),a(""),p(hs),m(-1);},[]);return {query:n,setQuery:P,matchCase:i,setMatchCase:s,wholeWord:c,setWholeWord:l,matches:d,truncated:d.length>=ys,activeIndex:g,goTo:h,next:v,previous:C,clear:S,isPending:n!==r}}var bS=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)}},hS=(e,t)=>e.zoom===t.zoom&&e.reviewPaneOpen===t.reviewPaneOpen&&e.fitting===t.fitting&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function Ba(e={}){let{defaultOpen:t=false,defaultTab:n="headings",paneWidth:o=280}=e,[r,a]=Ye.useState(t),[i,s]=Ye.useState(n),c=e.open??r,l=e.tab??i,{onOpenChange:d,onTabChange:p}=e,g=e.open!==void 0,m=e.tab!==void 0,f=Ye.useCallback(D=>{g||a(D),d?.(D);},[g,d]),u=Ye.useCallback(()=>f(!c),[c,f]),h=Ye.useCallback(D=>{m||s(D),p?.(D);},[m,p]),b=Io(),v=_o(),C=Ye.useContext(St),{pageSetup:P,zoom:S,reviewPaneOpen:y,fitting:x}=q(bS,hS),[M,E]=Ye.useState(0),[w,N]=Ye.useState(0);Ye.useEffect(()=>{if(!v){E(0),N(0);return}let D=()=>{E(v.clientWidth);let R=Number.parseFloat(getComputedStyle(v).paddingInlineEnd);N(Number.isFinite(R)?R:0);};if(D(),typeof ResizeObserver>"u")return;let k=new ResizeObserver(D);return k.observe(v),()=>k.disconnect()},[v,c,y,C?.mounted]);let F=Ye.useRef(null);P&&(F.current=P.pageWidthTwips);let H=P?.pageWidthTwips??F.current,I=Ye.useMemo(()=>!c||H===null?0:Fa({viewportWidth:M,pageWidthPx:_e(H)*S,reservation:Ko(o),inlineEndReservation:w,docked:x}),[c,H,S,M,o,w,x]);return Ye.useEffect(()=>{if(b)return b.setShift(I),()=>b.setShift(0)},[b,I]),{open:c,setOpen:f,toggle:u,tab:l,setTab:h,paneWidth:o,shift:I}}var or=["headings","find"],ht=(...e)=>e.filter(Boolean).join(" ");function nr({className:e,style:t,children:n}){return jsxRuntime.jsx("div",{className:ht("docx-nav__header",e),style:t,children:n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(rr,{}),jsxRuntime.jsx(ar,{})]})})}function rr({className:e,style:t,children:n}){let{pane:o,t:r}=Ot("Close");return jsxRuntime.jsx("button",{type:"button",className:ht("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 ar({className:e,style:t,children:n}){let{t:o}=Ot("Title");return jsxRuntime.jsx("h2",{className:ht("docx-nav__title",e),style:t,children:n??o("navigation.title")})}function ir({className:e,style:t,children:n}){let{pane:o,t:r}=Ot("Tabs"),a=Ye.useCallback(i=>{let s=i.key==="ArrowRight"?1:i.key==="ArrowLeft"?-1:0;if(s===0)return;i.preventDefault();let c=or.indexOf(o.tab);o.setTab(or[(c+s+or.length)%or.length]);},[o]);return jsxRuntime.jsx("div",{className:ht("docx-nav__tabs",e),style:t,role:"tablist","aria-label":r("navigation.title"),onKeyDown:a,children:n??or.map(i=>jsxRuntime.jsx(lr,{value:i},i))})}function lr({value:e,className:t,style:n,children:o}){let{pane:r,t:a}=Ot("Tab"),i=r.tab===e;return jsxRuntime.jsx("button",{type:"button",role:"tab",id:`docx-nav-tab-${e}`,"aria-selected":i,"aria-controls":`docx-nav-panel-${e}`,tabIndex:i?0:-1,className:ht("docx-nav__tab",i&&"docx-nav__tab--selected",t),style:n,onClick:()=>r.setTab(e),children:o??a(`navigation.tabs.${e}`)})}function Op({value:e,onChange:t,onClear:n,placeholder:o,label:r,clearLabel:a,autoFocus:i}){return jsxRuntime.jsxs("div",{className:"docx-nav__searchbox",children:[jsxRuntime.jsx(K,{name:"search",size:18,className:"docx-nav__search-icon"}),jsxRuntime.jsx("input",{type:"search",className:"docx-nav__search-input",value:e,placeholder:o,"aria-label":r,autoFocus:i,onChange:s=>t(s.target.value)}),e.length>0&&jsxRuntime.jsx("button",{type:"button",className:"docx-nav__search-clear","aria-label":a,onClick:n,children:jsxRuntime.jsx(K,{name:"close",size:16})})]})}function sr({className:e,style:t}){let{pane:n,outline:o,t:r}=Ot("Headings"),[a,i]=Ye.useState(""),s=q(io),c=Ye.useMemo(()=>{let d=a.trim().toLowerCase();return d.length===0?o.items:o.items.filter(p=>p.heading.text.toLowerCase().includes(d))},[o.items,a]),l=n.tab!=="headings";return jsxRuntime.jsxs("div",{className:ht("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-headings","aria-labelledby":"docx-nav-tab-headings",hidden:l,children:[jsxRuntime.jsx(Op,{value:a,onChange:i,onClear:()=>i(""),placeholder:r("navigation.find.placeholder"),label:r("navigation.find.inputAriaLabel"),clearLabel:r("navigation.find.clearAriaLabel")}),s?null:o.isEmpty?jsxRuntime.jsx("p",{className:"docx-nav__empty",children:r("navigation.headings.noHeadings")}):c.length===0?jsxRuntime.jsx("p",{className:"docx-nav__empty",children:r("navigation.find.noResults")}):jsxRuntime.jsx("ul",{className:"docx-nav__list",children:c.map((d,p)=>jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:ht("docx-nav__heading",o.selectedBlockId===d.heading.blockId&&"docx-nav__heading--current"),style:{paddingInlineStart:`${8+d.depth*14}px`},title:d.heading.text,onClick:()=>o.goTo(d.heading.blockId),children:d.heading.text})},`${d.heading.blockId}-${p}`))})]})}function TS({match:e,active:t,onSelect:n}){return jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:ht("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 cr({className:e,style:t}){let{pane:n,search:o,t:r}=Ot("Find"),a=n.tab!=="find",i=o.query.trim().length>0,s=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:ht("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-find","aria-labelledby":"docx-nav-tab-find",hidden:a,children:[jsxRuntime.jsx(Op,{value:o.query,onChange:o.setQuery,onClear:o.clear,placeholder:r("navigation.find.placeholder"),label:r("navigation.find.inputAriaLabel"),clearLabel:r("navigation.find.clearAriaLabel")}),jsxRuntime.jsxs("div",{className:"docx-nav__options",role:"group","aria-label":r("navigation.find.optionsAriaLabel"),children:[jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:o.matchCase,onChange:c=>o.setMatchCase(c.target.checked)}),r("navigation.find.matchCase")]}),jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:o.wholeWord,onChange:c=>o.setWholeWord(c.target.checked)}),r("navigation.find.wholeWord")]})]}),jsxRuntime.jsxs("div",{className:"docx-nav__resultbar",children:[jsxRuntime.jsx("span",{className:"docx-nav__count","aria-live":"polite",children:i?o.isPending?r("navigation.find.searching"):s??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,l)=>jsxRuntime.jsx(TS,{match:c,active:l===o.activeIndex,onSelect:()=>o.goTo(l)},`${c.blockId}-${c.start}-${l}`))})]})}function dr({className:e,style:t,children:n}){let{pane:o,t:r}=Ot("Toggle");return jsxRuntime.jsx("button",{type:"button",className:ht("docx-nav__toggle",e),style:t,"aria-label":r("navigation.openAriaLabel"),"aria-expanded":o.open,title:r("navigation.openTitle"),onMouseDown:a=>a.preventDefault(),onClick:o.toggle,children:n??jsxRuntime.jsx(K,{name:"toc",size:20})})}function Ts(e){let t=Xe(),{t:n,toggle:o=true,className:r,style:a,children:i,...s}=e,c=Ba(s),l=Aa(),d=Oa(),{t:p}=_(),g=Ye.useMemo(()=>({pane:c,outline:l,search:d,t:n??((f,u)=>p(f,u))}),[c,l,d,n,p]),m=e.paneWidth??280;return jsxRuntime.jsx(gs.Provider,{value:g,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":`${m}px`,"--docx-nav-inset":`${32}px`,"--docx-nav-reservation":`${Ko(m)}px`,...a},children:[o!==false&&!c.open&&jsxRuntime.jsx(dr,{...typeof o=="object"?o:{}}),jsxRuntime.jsx("aside",{className:"docx-nav__panel-shell","aria-label":g.t("navigation.ariaLabel"),inert:!c.open,children:i??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(nr,{}),jsxRuntime.jsx(ir,{}),jsxRuntime.jsx(sr,{}),jsxRuntime.jsx(cr,{})]})})]})})}var qa=Object.assign(Ts,{Header:nr,Close:rr,Title:ar,Tabs:ir,Tab:lr,Headings:sr,Find:cr,Toggle:dr});var kS=600,IS=e=>e.page.total,Ss=Ye.createContext(null);function Cs({className:e,style:t}){let n=Xe(),o=A(),r=_o(),a=q(IS),{t:i}=_(),s=Ye.useContext(Ss),[c,l]=Ye.useState(1),[d,p]=Ye.useState(false);if(Ye.useEffect(()=>{if(p(false),!o||!r||a<=1)return;l(o.getCurrentPage("viewport"));let m=null,f=()=>{l(o.getCurrentPage("viewport")),p(true),m&&clearTimeout(m),m=setTimeout(()=>p(false),kS);};return r.addEventListener("scroll",f,{passive:true}),()=>{r.removeEventListener("scroll",f),m&&clearTimeout(m);}},[o,a,r]),a<=1)return null;let g=s?s("viewer.pageIndicator").replace(/\{current\}/g,String(c)).replace(/\{total\}/g,String(a)):i("viewer.pageIndicator",{current:c,total:a});return jsxRuntime.jsx("div",{className:`${n}docx-editor-shell__page-indicator-chip docx-editor__page-number${e?` ${e}`:""}`,style:t,"data-visible":d?"true":"false",role:"status","aria-live":"polite",children:g})}var NS=[],DS=e=>e.fontSubstitutions??NS;function Ka({className:e,style:t,t:n}){let o=q(DS),{t:r}=_(),a=n??r,[i,s]=Ye.useState(null);if(o.length===0)return null;let c=o.join("\0");return i===c?null:jsxRuntime.jsxs("div",{className:e?`docx-font-notice ${e}`:"docx-font-notice",role:"status",...t?{style:t}:{},children:[jsxRuntime.jsx("span",{className:"docx-font-notice__text",children:a("editor.fontSubstitutionNotice",{fonts:o.join(", ")}).replace("{fonts}",o.join(", "))}),jsxRuntime.jsx("button",{type:"button",className:"docx-font-notice__dismiss",onClick:()=>s(c),children:a("common.dismiss")})]})}var Ve={hfInlineEditor:10,chrome:50,ruler:30,outline:40,popover:100,toolbar:100,modal:1e4};function Ps(e){return Math.round(e/1440*100)/100}function Kp(e){return Math.round(e*1440)}function FS(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 Es(){let e=A(),t=Ye.useCallback(n=>e?.getHeaderFooterState()??null,[e]);return q(t,FS)}function za(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 Va(e,t){let[n,o]=Ye.useState(null),r=Ye.useCallback(s=>o(s),[]),[a,i]=Ye.useState({visibility:"hidden"});return Ye.useLayoutEffect(()=>{let s=n?.closest(".docx-editor__scroll-container"),c=s??n?.parentElement?.querySelector(".docx-editor__scroll-container");if(!n||!c)return;let l=0,d=null,p=new ResizeObserver(()=>m()),g=()=>{l=0;let u=e(c);if(u!==d&&(p.disconnect(),p.observe(c),p.observe(n),u&&p.observe(u),d=u),!u||!u.isConnected){i({visibility:"hidden"});return}let h=u.getBoundingClientRect(),b=Math.max(n.offsetHeight,28),v=6,C=s===c,P=h.top-b-v,S=C?za(c,h.left,P):{left:h.left,top:P},y=S.left,x=S.top;C?c.scrollLeft+8:8;i({position:C?"absolute":"fixed",left:y,top:x,...{width:Math.max(240,Math.min(h.width,c.clientWidth-16))},visibility:"visible"});},m=()=>{l||(l=requestAnimationFrame(g));};p.observe(c),p.observe(n);let f=new MutationObserver(m);return f.observe(c,{subtree:true,childList:true,attributes:true,attributeFilter:["data-docx-hf-active","data-docx-note-scope"]}),c.addEventListener("scroll",m,{passive:true}),window.addEventListener("resize",m),g(),()=>{l&&cancelAnimationFrame(l),p.disconnect(),f.disconnect(),c.removeEventListener("scroll",m),window.removeEventListener("resize",m);}},[n,e,t]),{ref:r,style:a}}function qS(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 KS=[{field:"PAGE",labelKey:"headerFooter.insertPageNumber"},{field:"NUMPAGES",labelKey:"headerFooter.insertTotalPages"},{field:"SECTIONPAGES",labelKey:"headerFooter.insertSectionPages"},{field:"PAGE_X_OF_Y",labelKey:"headerFooter.insertPageXofY"}];function ur(e){let t=A();return Ye.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 zS(e){let{state:t,onMouseDown:n}=e,{t:o}=_(),r=A(),[a,i]=Ye.useState(false),s=Ye.useRef(null),[c,l]=Ye.useState(""),[d,p]=Ye.useState("");Ye.useEffect(()=>{a&&(t.headerDistanceTwips===void 0||t.footerDistanceTwips===void 0||(l(String(Ps(t.headerDistanceTwips))),p(String(Ps(t.footerDistanceTwips)))));},[a,t.headerDistanceTwips,t.footerDistanceTwips]),Ye.useEffect(()=>{if(!a)return;let x=M=>{s.current?.contains(M.target)||i(false);};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[a]);let g=Ye.useMemo(()=>({type:"setHeaderFooterOptions",titlePage:!t.titlePage}),[t.titlePage]),m=Ye.useMemo(()=>({type:"setHeaderFooterOptions",evenAndOddHeaders:!t.evenAndOddHeaders}),[t.evenAndOddHeaders]),f=Ye.useMemo(()=>({type:"linkHeaderFooterToPrevious"}),[]),u=Ye.useMemo(()=>({type:"unlinkHeaderFooterFromPrevious"}),[]),h=Ye.useMemo(()=>({type:"removeHeaderFooter",position:t.editing}),[t.editing]),b=ur(g),v=ur(m),C=ur(f),P=ur(u),S=ur(h),y=(x,M)=>{if(!r)return;let E=Number.parseFloat(M);Number.isFinite(E)&&r.exec({type:"setHeaderFooterOptions",[x]:Kp(E)});};return jsxRuntime.jsxs("div",{ref:s,className:"docx-hf-chrome__options",onMouseDown:n,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-context-bar__options-trigger","aria-expanded":a,"aria-haspopup":"menu",onClick:()=>i(x=>!x),onMouseDown:n,children:o("headerFooter.options")}),a?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:n,children:[KS.map(x=>{let M={type:"insertPageField",field:x.field},E=r?.can(M);return jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!E?.ok,title:E&&!E.ok?E.reason:void 0,onClick:()=>{r?.exec(M),i(false);},onMouseDown:n,children:o(x.labelKey)},x.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:!b.enabled,title:b.reason??void 0,onChange:()=>r?.exec(g)}),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:!v.enabled,title:v.reason??void 0,onChange:()=>r?.exec(m)}),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:!P.enabled,title:P.reason??void 0,onClick:()=>r?.exec(u),onMouseDown:n,children:o("headerFooter.unlinkFromPrevious")}):jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!C.enabled,title:C.reason??void 0,onClick:()=>r?.exec(f),onMouseDown:n,children:o("headerFooter.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:x=>l(x.target.value),onBlur:()=>y("headerDistanceTwips",c)}),jsxRuntime.jsx("span",{className:"docx-hf-chrome__unit",children:"in"})]}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row docx-hf-chrome__menu-row--distance",children:[jsxRuntime.jsx("span",{children:o("headerFooter.footerDistance")}),jsxRuntime.jsx("input",{type:"number",min:0,step:.01,"aria-label":o("headerFooter.footerDistance"),value:d,onChange:x=>p(x.target.value),onBlur:()=>y("footerDistanceTwips",d)}),jsxRuntime.jsx("span",{className:"docx-hf-chrome__unit",children:"in"})]}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!S.enabled,title:S.reason??void 0,onClick:()=>r?.exec(h),onMouseDown:n,children:t.editing==="header"?o("headerFooter.removeHeader"):o("headerFooter.removeFooter")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-hf-close",onClick:()=>{r?.exec({type:"exitHeaderFooter"}),i(false);},onMouseDown:n,children:o("common.close")})]}):null]})}function $a({className:e}){let{t}=_(),n=Es(),o=Ye.useCallback(s=>s.querySelector("[data-docx-hf-active]"),[]),r=Va(o,"story-label"),a=O;if(!n?.editing)return null;let i=qS(n.editing,n.variant);return jsxRuntime.jsxs("div",{ref:r.ref,className:`docx-context-bar docx-hf-chrome${e?` ${e}`:""}`,role:"region","aria-label":t("headerFooter.chromeAriaLabel"),"data-testid":"docx-hf-chrome",onMouseDown:a,style:{...r.style,zIndex:Ve.hfInlineEditor},children:[jsxRuntime.jsxs("div",{className:"docx-context-bar__label",children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:t(i)}),n.inherited?jsxRuntime.jsx("span",{className:"docx-context-bar__status","data-testid":"docx-hf-inherited",title:t("headerFooter.sameAsPreviousHint"),children:t("headerFooter.sameAsPrevious")}):null]}),jsxRuntime.jsx(zS,{state:n,onMouseDown:a})]})}function uo(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var Wa=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"})}),XS="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",jS="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",QS="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",JS="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 eC({className:e,asChild:t,hidden:n,children:o,preset:r=true}){let a=vt(),i=Ye.useRef(null),{state:s,close:c}=a;Ye.useEffect(()=>{if(s.mode==="closed")return;let u=b=>{b.key==="Escape"&&(b.preventDefault(),c());},h=b=>{let v=i.current;v&&b.target instanceof Node&&v.contains(b.target)||c();};return document.addEventListener("keydown",u),document.addEventListener("mousedown",h,true),()=>{document.removeEventListener("keydown",u),document.removeEventListener("mousedown",h,true);}},[s.mode,c]);let[l,d]=Ye.useState(null);Ye.useLayoutEffect(()=>{let u=s.anchor,h=i.current;if(!u||!h){d(null);return}let b=h.offsetParent;if(!b){d(null);return}let{left:v,top:C}=za(b,u.left,u.top),P=Math.max(0,b.scrollWidth-h.offsetWidth);d({left:Math.max(0,Math.min(v,P)),top:C});},[s.anchor]);let{t:p}=_(),g=s.mode==="editing"?p(s.link?"hyperlinkPopup.editTitle":"hyperlinkPopup.insertTitle"):p("hyperlinkPopup.editLink"),m=r?jsxRuntime.jsx(tC,{children:o}):o;if(n)return s.mode==="closed"?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:o});let f={ref:i,className:`docx-hyperlink-popup${e?` ${e}`:""}`,"data-testid":"hyperlink-popup","data-mode":s.mode,role:"dialog","aria-modal":false,onMouseDown:uo,style:l??void 0,"aria-label":g};return s.mode==="closed"?null:t?jsxRuntime.jsx(W,{...f,children:o}):jsxRuntime.jsx("div",{...f,children:m})}function tC({children:e}){let{state:t}=vt(),n=Ye.useMemo(()=>oC(e),[e]),o=(a,i)=>a in n?n[a]:i;if(t.mode==="editing")return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o("Fields",jsxRuntime.jsx(Ns,{})),o("Error",jsxRuntime.jsx(Ls,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Apply",jsxRuntime.jsx(Ds,{})),o("Cancel",jsxRuntime.jsx(Hs,{}))]}),n.__extra]});let r=t.canEdit&&!(t.link&&Zr(t.link));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o("Url",jsxRuntime.jsx(ks,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Copy",jsxRuntime.jsx(Is,{})),r?o("Edit",jsxRuntime.jsx(Rs,{})):null,r?o("Unlink",jsxRuntime.jsx(_s,{})):null]}),n.__extra]})}function oC(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===Ye.Fragment){o(r.props.children);return}let a=r.type.docxHyperLinkPart;a?t[a]=r:n.push(r);};return o(e),n.length>0&&(t.__extra=n),t}function vt(){return Ye.useContext(mn)??nC}var nC={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 ks({className:e,asChild:t,hidden:n,children:o}){let{state:r,openTarget:a}=vt(),{t:i}=_();if(n||!r.link)return null;let s=!r.link.href,c=r.link.kind==="internal",l=c?`#${r.link.anchor??""}`:r.link.authored,d=i(s?"hyperlinkPopup.inertTarget":c?"hyperlinkPopup.bookmarkTarget":"hyperlinkPopup.openLink"),p={className:`docx-hyperlink-popup__url${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-url",...s?{"data-inert":""}:{},title:d,onMouseDown:uo,...s?{}:{onClick:()=>a(),type:"button"}};return t?jsxRuntime.jsx(W,{...p,children:o}):s?jsxRuntime.jsxs("span",{...p,children:[o??l,jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:d})]}):jsxRuntime.jsxs("button",{...p,children:[o??l,Wa(JS)]})}ks.docxHyperLinkPart="Url";function Is({className:e,asChild:t,hidden:n,children:o,icon:r}){let{state:a,copy:i}=vt(),{t:s}=_();if(n||!a.link?.href)return null;let c=a.copied?s("editor.linkCopied"):s("hyperlinkPopup.copyLink"),l={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-copy",...a.copied?{"data-copied":""}:{},"aria-label":c,title:c,onMouseDown:uo,onClick:()=>{i();}};return t?jsxRuntime.jsx(W,{...l,children:o}):jsxRuntime.jsx("button",{...l,children:r??o??Wa(XS)})}Is.docxHyperLinkPart="Copy";function Rs({className:e,asChild:t,hidden:n,children:o,icon:r}){let{beginEdit:a}=vt(),{t:i}=_();if(n)return null;let s=i("hyperlinkPopup.editLink"),c={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-edit","aria-label":s,title:s,onMouseDown:uo,onClick:()=>a()};return t?jsxRuntime.jsx(W,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:r??o??Wa(jS)})}Rs.docxHyperLinkPart="Edit";function _s({className:e,asChild:t,hidden:n,children:o,icon:r}){let{unlink:a}=vt(),{t:i}=_();if(n)return null;let s=i("hyperlinkPopup.removeLink"),c={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-unlink","aria-label":s,title:s,onMouseDown:uo,onClick:()=>a()};return t?jsxRuntime.jsx(W,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:r??o??Wa(QS)})}_s.docxHyperLinkPart="Unlink";function Ns({className:e,hidden:t}){let{state:n,setText:o,setUrl:r,commitEdit:a,close:i}=vt(),{t:s}=_(),c=Ye.useRef(null),l=Ye.useId(),d=Ye.useId();Ye.useEffect(()=>{n.mode==="editing"&&(c.current?.focus({preventScroll:true}),c.current?.select());},[n.mode]);let p=Ye.useCallback(g=>{if(g.key==="Enter"){g.preventDefault(),a();return}g.key==="Escape"&&(g.preventDefault(),i());},[a,i]);return t?null:jsxRuntime.jsxs("div",{className:`docx-hyperlink-popup__fields${e?` ${e}`:""}`,children:[jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:l,children:s("hyperlinkPopup.displayTextPlaceholder")}),jsxRuntime.jsx("input",{id:l,"data-testid":"hyperlink-popup-text",className:"docx-hyperlink-popup__input",value:n.text,placeholder:s("hyperlinkPopup.displayTextPlaceholder"),onChange:g=>o(g.target.value),onKeyDown:p}),jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:d,children:s("hyperlinkPopup.urlPlaceholder")}),jsxRuntime.jsx("input",{id:d,ref:c,"data-testid":"hyperlink-popup-url-input",className:"docx-hyperlink-popup__input",value:n.url,placeholder:s("hyperlinkPopup.urlPlaceholder"),onChange:g=>r(g.target.value),onKeyDown:p})]})}Ns.docxHyperLinkPart="Fields";function Ds({className:e,asChild:t,hidden:n,children:o}){let{state:r,commitEdit:a}=vt(),{t:i}=_();if(n)return null;let s=i("hyperlinkPopup.apply"),c={type:"button",className:`docx-hyperlink-popup__apply${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-apply",disabled:r.url.trim().length===0,onMouseDown:uo,onClick:()=>a()};return t?jsxRuntime.jsx(W,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:o??s})}function Ls({className:e,hidden:t}){let{state:n}=vt(),{t:o}=_();return t||!n.error?null:jsxRuntime.jsx("div",{className:`docx-hyperlink-popup__error${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-error",role:"alert",children:o("hyperlinkPopup.refused")})}Ls.docxHyperLinkPart="Error";Ds.docxHyperLinkPart="Apply";function Hs({className:e,asChild:t,hidden:n,children:o}){let{close:r}=vt(),{t:a}=_();if(n)return null;let i=a("hyperlinkPopup.cancel"),s={type:"button",className:`docx-hyperlink-popup__cancel${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-cancel",onMouseDown:uo,onClick:()=>r()};return t?jsxRuntime.jsx(W,{...s,children:o}):jsxRuntime.jsx("button",{...s,children:o??i})}Hs.docxHyperLinkPart="Cancel";var Ua=Object.assign(eC,{Url:ks,Copy:Is,Edit:Rs,Unlink:_s,Fields:Ns,Error:Ls,Apply:Ds,Cancel:Hs});function rC(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 Fs(){let e=A(),t=Ye.useCallback(o=>{let r=e?.getActiveScope();return r?.kind==="note"?r:null},[e]),n=q(t,rC);return n?.kind==="note"?n:null}function Gp(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 Yp(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&&Gp(e.documentAuthored,t.documentAuthored)&&Gp(e.sectionAuthored,t.sectionAuthored)}function aC(e,t){return e===t?true:!e||!t?false:e.sectionIndex===t.sectionIndex&&Yp(e.footnote,t.footnote)&&Yp(e.endnote,t.endnote)}function As(){let e=A(),t=Ye.useCallback(n=>e?.getNotePropertiesState()??null,[e]);return q(t,aC)}var iC=/^(footnote|endnote):(-?\d{1,10})$/;function jp(e){let t=iC.exec(e);if(!t)return null;let n=Number(t[2]);return Number.isInteger(n)?{noteKind:t[1],noteId:n}:null}function lC(){return typeof window>"u"?false:window.matchMedia("(pointer: coarse)").matches}function Zs(e){let t=A();return Ye.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 sC(e){let{t}=_(),[n,o]=Ye.useState(false),r=Ye.useRef(null);return Ye.useEffect(()=>{if(!n)return;let a=i=>{r.current?.contains(i.target)||o(false);};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[n]),jsxRuntime.jsxs("div",{ref:r,className:"docx-hf-chrome__options",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-context-bar__options-trigger","data-testid":"docx-notes-options","aria-expanded":n,"aria-haspopup":"menu",onMouseDown:O,onClick:()=>o(a=>!a),children:t("headerFooter.options")}),n?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:O,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-notes-properties",onClick:()=>{e.onOpenProperties(),o(false);},children:t("dialogs.footnoteProperties.title")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-notes-close",onClick:()=>{e.onClose(),o(false);},children:t("common.close")})]}):null]})}function Ga({className:e}){let{t}=_(),n=A(),o=Fs(),[r,a]=Ye.useState(null),[i,s]=Ye.useState(null),[c,l]=Ye.useState(false),d=Ye.useRef(null),p=Ye.useCallback(E=>{if(!o)return null;let N=[...E.querySelectorAll("[data-docx-note-scope]")].find(F=>F.matches("[data-docx-note]")&&F.dataset.docxNoteScope===o.id)??null;return N?.closest("[data-docx-notes]")??N},[o]),g=Va(p,"story-label"),m=Ye.useCallback(()=>{d.current&&clearTimeout(d.current),d.current=null,a(null);},[]);Ye.useEffect(()=>{if(!n)return;let E=document.querySelector(".docx-pages");if(!E)return;let w=H=>{let I=H.target;if(!I)return;let D=I.closest("[data-docx-note-ref]");if(D?.dataset.docxNoteScope){H.preventDefault(),m(),s(null),n.setActiveScope({kind:"note",id:D.dataset.docxNoteScope});return}I.closest("[data-docx-note-mark-back]")&&(H.preventDefault(),m(),s(null),n.setActiveScope({kind:"body"}));},N=H=>{let I=H,k=I.target?.closest("[data-docx-note-scope]");k?.dataset.docxNoteScope&&(I.preventDefault(),s({scopeId:k.dataset.docxNoteScope,x:I.clientX,y:I.clientY}));},F=H=>{if(lC())return;let D=H.target?.closest("[data-docx-note-ref]");if(!D?.dataset.docxNoteScope){m();return}let k=D.dataset.docxNoteScope,z=n.getNotePreviewText(k)??D.getAttribute("aria-description")??t("notes.previewFallback"),Z=D.getBoundingClientRect();d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{a({scopeId:k,text:z,x:Z.left,y:Z.bottom+4});},400);};return E.addEventListener("click",w),E.addEventListener("contextmenu",N),E.addEventListener("pointerover",F),E.addEventListener("scroll",m,true),()=>{E.removeEventListener("click",w),E.removeEventListener("contextmenu",N),E.removeEventListener("pointerover",F),E.removeEventListener("scroll",m,true),m();}},[n,m,t]);let f=Ye.useCallback(E=>{n&&(n.exec(E),s(null));},[n]),u=i?jp(i.scopeId):null,h=Ye.useMemo(()=>u?{type:"deleteNote",noteKind:u.noteKind,noteId:u.noteId}:null,[u]),b=Ye.useMemo(()=>u?{type:"convertNote",fromKind:u.noteKind,noteId:u.noteId}:null,[u]),v=Ye.useMemo(()=>u?{type:"convertAllNotes",fromKind:u.noteKind}:null,[u]),C=Zs(h??{type:"deleteNote",noteKind:"footnote",noteId:0}),P=Zs(b??{type:"convertNote",fromKind:"footnote",noteId:0}),S=Zs(v??{type:"convertAllNotes",fromKind:"footnote"}),y=Ye.useMemo(()=>({position:"fixed",left:r?.x??0,top:r?.y??0,zIndex:Ve.popover,maxWidth:280,maxHeight:"40vh",overflowY:"auto",padding:"8px 10px",background:"var(--doc-popover-bg, #fff)",color:"var(--doc-popover-fg, #111)",border:"1px solid var(--doc-border, #ddd)",boxShadow:"var(--doc-shadow, 0 4px 16px rgba(0,0,0,.12))",fontSize:12,lineHeight:1.4,pointerEvents:"none"}),[r]),x=o?jp(o.id):null,M=x?t("notes.editingRegion",{kind:x.noteKind==="footnote"?t("notes.footnoteKind"):t("notes.endnoteKind"),number:x.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&&x?jsxRuntime.jsxs("div",{ref:g.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:{...g.style,zIndex:Ve.chrome},children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:M}),jsxRuntime.jsx(sC,{onOpenProperties:()=>l(true),onClose:()=>n.setActiveScope({kind:"body"})})]}):null,r?jsxRuntime.jsx("div",{role:"tooltip","data-testid":"docx-notes-preview",style:y,onMouseDown:E=>{E.preventDefault(),E.stopPropagation();},children:r.text}):null,i&&u?jsxRuntime.jsxs("div",{role:"menu","data-testid":"docx-notes-menu",style:{position:"fixed",left:i.x,top:i.y,zIndex:Ve.popover,minWidth:160,background:"var(--doc-popover-bg, #fff)",border:"1px solid var(--doc-border, #ddd)",boxShadow:"var(--doc-shadow, 0 4px 16px rgba(0,0,0,.12))",padding:4},onMouseDown:O,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-delete",disabled:!C.enabled,title:C.reason??void 0,onClick:()=>h&&f(h),children:t("notes.delete")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-convert",disabled:!P.enabled,title:P.reason??void 0,onClick:()=>b&&f(b),children:u.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:()=>v&&f(v),children:u.noteKind==="footnote"?t("notes.convertAllFootnotes"):t("notes.convertAllEndnotes")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",onClick:()=>l(true),children:t("dialogs.footnoteProperties.title")})]}):null,c?jsxRuntime.jsx(cC,{onClose:()=>l(false),onApply:E=>{f(E),l(false);}}):null]}):null}function cC(e){let{t}=_(),n=A(),o=As(),[r,a]=Ye.useState("document"),[i,s]=Ye.useState("decimal"),[c,l]=Ye.useState("continuous"),[d,p]=Ye.useState("pageBottom"),[g,m]=Ye.useState("decimal"),[f,u]=Ye.useState("continuous"),[h,b]=Ye.useState("docEnd");Ye.useEffect(()=>{o&&(s(o.footnote.resolved.numFmt),l(o.footnote.resolved.numRestart),p(o.footnote.resolved.pos),m(o.endnote.resolved.numFmt),u(o.endnote.resolved.numRestart),b(o.endnote.resolved.pos));},[o]);let v=!o?.footnote.documentAuthored&&!o?.footnote.sectionAuthored,C=!o?.endnote.documentAuthored&&!o?.endnote.sectionAuthored;return jsxRuntime.jsx("div",{className:"docx-note-properties",role:"dialog","aria-modal":"true","aria-label":t("dialogs.footnoteProperties.title"),"data-testid":"docx-notes-properties-dialog",style:{zIndex:Ve.modal},onClick:e.onClose,onKeyDown:P=>{P.key==="Escape"&&e.onClose();},children:jsxRuntime.jsxs("div",{className:"docx-note-properties__panel",onClick:P=>P.stopPropagation(),onMouseDown:P=>P.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:P=>a(P.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")}),v?jsxRuntime.jsx("span",{className:"docx-note-properties__badge",children:t("notes.inheritedValue")}):null]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__fields",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numberFormat")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:i,onChange:P=>s(P.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:P=>l(P.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:P=>p(P.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")}),C?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:g,onChange:P=>m(P.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:f,onChange:P=>u(P.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:h,"data-testid":"docx-notes-endnote-position",onChange:P=>b(P.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 P={type:"setNoteProperties",scope:r,sectionIndex:r==="section"?o?.sectionIndex:void 0,footnote:{numFmt:i,numRestart:c,position:d},endnote:{numFmt:g,numRestart:f,position:h}};n.can(P).ok&&e.onApply(P);},children:t("common.apply")})]})]})})}var Ya=Ye.createContext({close:()=>{},anchor:null,tocId:null,target:null,clipboardRefusal:null,reportClipboardRefusal:()=>{}});function po(){return Ye.useContext(Ya)}function em(){return Ye.useContext(Ya).target}var tm=["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"],om=["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"],nm=["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"],rm=["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"],am=["M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"],im=["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"],lm=["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 Xa(e,t,n){return Object.assign(({icon:r,labelKey:a,shortcutKey:i,className:s,hidden:c})=>{let l=A(),{close:d}=po(),p=Oe(),{isEnabled:g,disabledReason:m}=ne(t);return c?null:jsxRuntime.jsx(Le,{slot:e,icon:r??te(n.paths),shortcut:p(i??n.shortcutKey),disabled:!g,...m?{title:m}:{},onSelect:()=>{l?.exec(t),d(true);},...s?{className:s}:{},children:p(a??n.labelKey)})},{docxRow:e})}var mr=Xa("edit.cut",{type:"cut"},{labelKey:"contextMenu.cut",shortcutKey:"contextMenu.cutShortcut",paths:tm}),fr=Xa("edit.copy",{type:"copy"},{labelKey:"contextMenu.copy",shortcutKey:"contextMenu.copyShortcut",paths:om}),gr=Xa("edit.delete",{type:"deleteText"},{labelKey:"contextMenu.delete",shortcutKey:"contextMenu.deleteShortcut",paths:rm}),br=Xa("edit.selectAll",{type:"selectAll"},{labelKey:"contextMenu.selectAll",shortcutKey:"contextMenu.selectAllShortcut",paths:lm});function Wo({icon:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let a=A(),{close:i,clipboardRefusal:s,reportClipboardRefusal:c}=po(),l=Oe(),d=Ye.useMemo(()=>({type:"paste",text:" "}),[]),{isEnabled:p,disabledReason:g}=ne(d);if(r)return null;let m=s!==null;return jsxRuntime.jsx(Le,{slot:"edit.paste",icon:e??te(nm),shortcut:l(n??"contextMenu.pasteShortcut"),disabled:!p||m,...s??g?{title:s??g??""}:{},onSelect:()=>{(async()=>{try{let f=await navigator.clipboard.readText();f&&a?.exec({type:"paste",text:f});}catch(f){c(f instanceof Error?f.message:"the clipboard is not readable");}finally{i(true);}})();},...o?{className:o}:{},children:l(t??"contextMenu.paste")})}Wo.docxRow="edit.paste";function mo(e,t,n){return Object.assign(({icon:r,labelKey:a,className:i,hidden:s,destructive:c})=>{let{close:l}=po(),d=Oe(),p=Ja(),{isEnabled:g,disabledReason:m,execute:f}=ne(t);return s||!p?null:jsxRuntime.jsx(Le,{slot:e,icon:r??te(n.paths),disabled:!g,...m?{title:m}:{},className:`${c??n.destructive?"docx-table-chrome__destructive-row":""}${i?` ${i}`:""}`,onSelect:()=>{f()&&l(true);},children:d(a??n.labelKey)})},{docxRow:e})}var Uo=mo("table.insertRowAbove",{type:"insertRow",where:"above"},{labelKey:"table.insertRowAbove",paths:editor.tableChromeIconPaths("table_rows")}),Go=mo("table.insertRowBelow",{type:"insertRow",where:"below"},{labelKey:"table.insertRowBelow",paths:editor.tableChromeIconPaths("table_rows")}),Yo=mo("table.insertColumnLeft",{type:"insertColumn",where:"left"},{labelKey:"table.insertColumnLeft",paths:editor.tableChromeIconPaths("view_column")}),Xo=mo("table.insertColumnRight",{type:"insertColumn",where:"right"},{labelKey:"table.insertColumnRight",paths:editor.tableChromeIconPaths("view_column")}),jo=mo("table.deleteRow",{type:"deleteRow"},{labelKey:"table.deleteRow",paths:editor.tableChromeIconPaths("delete_sweep"),destructive:true}),Qo=mo("table.deleteColumn",{type:"deleteColumn"},{labelKey:"table.deleteColumn",paths:editor.tableChromeIconPaths("view_column"),destructive:true}),Jo=mo("table.deleteTable",{type:"deleteTable"},{labelKey:"table.deleteTable",paths:editor.tableChromeIconPaths("delete"),destructive:true}),pC=[{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 fo({hidden:e}){let{close:t}=po(),n=Oe(),o=Ja(),r=ne({type:"setTableCellVerticalAlignment",alignment:"top"}),a=ne({type:"setTableCellVerticalAlignment",alignment:"center"}),i=ne({type:"setTableCellVerticalAlignment",alignment:"bottom"}),s=[r,a,i];return e||!o?null:jsxRuntime.jsxs("div",{className:"docx-contextmenu__table-align",children:[jsxRuntime.jsx("span",{className:"docx-contextmenu__table-align-label",children:n("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{className:"docx-contextmenu__table-align-buttons",role:"group","aria-label":n("tableAdvanced.verticalAlignment"),children:pC.map((c,l)=>{let d=s[l];return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":false,"aria-label":n(c.labelKey),title:d.disabledReason??n(c.labelKey),"aria-disabled":!d.isEnabled,className:"docx-contextmenu__table-align-button",onMouseDown:p=>{p.preventDefault(),p.stopPropagation();},onClick:()=>{d.execute()&&t(true);},children:te(editor.tableChromeIconPaths(c.icon))},c.alignment)})})]})}fo.docxRow="table.cellVerticalAlignment";function cm(e,t,n){return Object.assign(({icon:r,labelKey:a,className:i,hidden:s})=>{let c=A(),{close:l,tocId:d}=po(),p=Oe(),g=Ye.useMemo(()=>({type:"refreshToc",mode:t,...d?{tocId:d}:{}}),[d]),{isEnabled:m,disabledReason:f}=ne(g);return s||d===null?null:jsxRuntime.jsx(Le,{slot:e,icon:r??te(n.paths),disabled:!m,...f?{title:f}:{},onSelect:()=>{c?.exec(g),l(true);},...i?{className:i}:{},children:p(a??n.labelKey)})},{docxRow:e})}var ja=cm("toc.refresh","entire",{labelKey:"toc.refresh",paths:am}),Qa=cm("toc.refreshPageNumbers","pageNumbers",{labelKey:"toc.refreshPageNumbers",paths:im});function Ja(){return q(Ye.useCallback(e=>e.table!=null,[]),(e,t)=>e===t)}function ei({label:e,icon:t,shortcut:n,disabled:o,disabledReason:r,active:a,onSelect:i,className:s}){let{close:c}=po();return jsxRuntime.jsx(Le,{...t?{icon:t}:{},...n?{shortcut:n}:{},...o?{disabled:o}:{},...o&&r?{title:r}:{},...a!==void 0?{active:a}:{},onSelect:()=>{i?.(),c(true);},...s?{className:s}:{},children:e})}var ni=8,gC=[{kind:"row",id:"edit.cut",render:()=>jsxRuntime.jsx(mr,{})},{kind:"row",id:"edit.copy",render:()=>jsxRuntime.jsx(fr,{})},{kind:"row",id:"edit.paste",render:()=>jsxRuntime.jsx(Wo,{})},{kind:"separator",id:"sep.clipboard"},{kind:"row",id:"edit.delete",render:()=>jsxRuntime.jsx(gr,{})},{kind:"row",id:"edit.selectAll",render:()=>jsxRuntime.jsx(br,{})},{kind:"separator",id:"sep.selection"},{kind:"row",id:"text.link",render:()=>jsxRuntime.jsx(gt,{slot:"text.link",labelKey:"formattingBar.insertLink"})},{kind:"row",id:"review.comments",render:()=>jsxRuntime.jsx(gt,{slot:"review.comments",labelKey:"comments.addComment"})}];function bC(){return [{kind:"separator",id:"sep.table"},{kind:"row",id:Uo.docxRow,render:()=>jsxRuntime.jsx(Uo,{})},{kind:"row",id:Go.docxRow,render:()=>jsxRuntime.jsx(Go,{})},{kind:"separator",id:"sep.table.columns"},{kind:"row",id:Yo.docxRow,render:()=>jsxRuntime.jsx(Yo,{})},{kind:"row",id:Xo.docxRow,render:()=>jsxRuntime.jsx(Xo,{})},{kind:"separator",id:"sep.table.destructive"},{kind:"row",id:jo.docxRow,render:()=>jsxRuntime.jsx(jo,{})},{kind:"row",id:Qo.docxRow,render:()=>jsxRuntime.jsx(Qo,{})},{kind:"row",id:Jo.docxRow,render:()=>jsxRuntime.jsx(Jo,{})},{kind:"separator",id:"sep.table.alignment"},{kind:"row",id:fo.docxRow,render:()=>jsxRuntime.jsx(fo,{})}]}function hC(){return [{kind:"separator",id:"sep.toc"},{kind:"row",id:ja.docxRow,render:()=>jsxRuntime.jsx(ja,{})},{kind:"row",id:Qa.docxRow,render:()=>jsxRuntime.jsx(Qa,{})}]}function vC(e,t=false){return [...gC,...e?bC():[],...t?hC():[]]}function fm(e){if(!Ye.isValidElement(e))return null;let t=No(e,fm);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 pm(e){if(!Ye.isValidElement(e))return false;let t=e.type;return typeof t!="function"&&typeof t!="object"?false:t.docxRowPlacement==="start"}function yC(e){return e?.closest(".docx-editor__scroll-container")??null}function vr({className:e,t,preset:n=true,disabled:o,onOpenChange:r,children:a}){let i=Xe(),s=A(),{t:c}=_(),l=Ja(),d=Ye.useRef(null),p=Ye.useRef(null),[g,m]=Ye.useState(null),[f,u]=Ye.useState(null),[h,b]=Ye.useState(null),v=Ye.useMemo(()=>vC(l,f!==null),[l,f]),[C,P]=Ye.useState(null),S=Ye.useCallback((H=false)=>{m(null),P(null),u(null),b(null),H&&s?.focus();},[s]);Ye.useEffect(()=>{if(o)return;let H=yC(d.current);if(!H)return;let I=D=>{D.preventDefault();let k=D.button===-1||D.clientX===0&&D.clientY===0,R=H.getBoundingClientRect();u(s?.snapshot().tocContext?.id??null),b(k||!(D.target instanceof HTMLElement)?null:D.target),m(k?{x:R.left+16,y:R.top+16}:{x:D.clientX,y:D.clientY});};return H.addEventListener("contextmenu",I),()=>H.removeEventListener("contextmenu",I)},[o,s]),Ye.useEffect(()=>{o&&S();},[o,S]),Ye.useEffect(()=>{if(!g)return;let H=k=>{p.current?.contains(k.target)||S();},I=k=>{k.key==="Escape"?(k.preventDefault(),S(true)):k.key==="Tab"&&S();},D=()=>S();return document.addEventListener("pointerdown",H,true),document.addEventListener("keydown",I),document.addEventListener("scroll",D,{capture:true,passive:true}),window.addEventListener("blur",D),window.addEventListener("resize",D),()=>{document.removeEventListener("pointerdown",H,true),document.removeEventListener("keydown",I),document.removeEventListener("scroll",D,true),window.removeEventListener("blur",D),window.removeEventListener("resize",D);}},[g,S]),Ye.useLayoutEffect(()=>{let H=p.current;if(!g||!H)return;let{width:I,height:D}=H.getBoundingClientRect(),k=window.innerWidth-I-ni,R=window.innerHeight-D-ni,z=Math.max(ni,g.x>k?g.x-I:g.x),Z=Math.max(ni,g.y>R?g.y-D:g.y);P({x:z,y:Z});},[g]),Ye.useLayoutEffect(()=>{C&&p.current?.focus({preventScroll:true});},[C]);let y=Ye.useRef(r);y.current=r;let x=Ye.useRef(false);Ye.useEffect(()=>{let H=g!==null;H!==x.current&&(x.current=H,y.current?.(H));},[g]);let M=Ye.useMemo(()=>({t,openMenu:null,setOpenMenu:()=>S(true),activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onReportIssue:void 0,reportIssue:void 0}),[t,S]),[E,w]=Ye.useState(null),N=Ye.useMemo(()=>({close:S,anchor:g,tocId:f,target:h,clipboardRefusal:E,reportClipboardRefusal:w}),[S,g,f,h,E]),F={position:"fixed",left:(C??g)?.x??0,top:(C??g)?.y??0,visibility:C?"visible":"hidden"};return jsxRuntime.jsx("div",{ref:d,style:{display:"contents"},children:g?jsxRuntime.jsx($n.Provider,{value:M,children:jsxRuntime.jsx(Ya.Provider,{value:N,children:jsxRuntime.jsxs("div",{ref:p,role:"menu","aria-label":t?.("contextMenu.ariaLabel")??c("contextMenu.ariaLabel"),tabIndex:-1,className:`${i}docx-toolbar__menu docx-contextmenu${e?` ${e}`:""}`,style:F,onKeyDown:H=>{let I=p.current;if(!I)return;let D=Jt(I);H.key==="ArrowDown"?(H.preventDefault(),at(D,document.activeElement,1)):H.key==="ArrowUp"?(H.preventDefault(),at(D,document.activeElement,-1)):H.key==="Home"?(H.preventDefault(),it(D,"first")):H.key==="End"&&(H.preventDefault(),it(D,"last"));},children:[Ye.Children.toArray(a).filter(pm),Yr({entries:v,children:Ye.Children.toArray(a).filter(H=>!pm(H)),preset:n,keyOfEntry:H=>H.id,keyOfChild:fm,renderEntry:H=>H.kind==="separator"?jsxRuntime.jsx(no,{}):H.render()})]})})}):null})}var Ks=Object.assign(vr,{Cut:mr,Copy:fr,Paste:Wo,Delete:gr,SelectAll:br,InsertRowAbove:Uo,InsertRowBelow:Go,InsertColumnLeft:Yo,InsertColumnRight:Xo,DeleteTableRow:jo,DeleteTableColumn:Qo,DeleteTable:Jo,CellVerticalAlignment:fo,RefreshToc:ja,RefreshTocPageNumbers:Qa,Item:ei,Slot:gt,Row:Le,Group:Gn,Separator:no,Submenu:oo});function zs(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var bm=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"})}),CC="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",PC="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",EC={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},wC={display:"flex",justifyContent:"space-between",gap:12,alignItems:"baseline"},MC={color:"var(--doc-text-muted)",flexShrink:0},kC={textAlign:"right",wordBreak:"break-word"},IC={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,fontWeight:600},RC={display:"flex",gap:8,marginTop:4},hm={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 _C(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 NC(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 en({label:e,value:t,testId:n}){return jsxRuntime.jsxs("div",{style:wC,"data-testid":n,children:[jsxRuntime.jsx("span",{style:MC,children:e}),jsxRuntime.jsx("span",{style:kC,children:t})]})}function DC({className:e,asChild:t,hidden:n,children:o,preset:r=true}){let a=pt(),i=Ye.useRef(null),s=Ye.useId(),{t:c}=_(),{control:l,inspectorOpen:d,closeInspector:p}=a;if(Ye.useEffect(()=>{if(!d)return;let u=b=>{b.key==="Escape"&&(b.preventDefault(),p());},h=b=>{let v=i.current;v&&b.target instanceof Node&&v.contains(b.target)||p();};return document.addEventListener("keydown",u),document.addEventListener("mousedown",h,true),()=>{document.removeEventListener("keydown",u),document.removeEventListener("mousedown",h,true);}},[d,p]),Ye.useEffect(()=>{d&&!l&&p();},[d,l,p]),n||!d||!l)return null;let g=r?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(vm,{}),jsxRuntime.jsx(ym,{}),jsxRuntime.jsx("div",{style:RC,children:jsxRuntime.jsx(xm,{})}),o]}):o,m={ref:i,role:"dialog","aria-modal":false,"aria-labelledby":s,"data-testid":"content-control-inspector","data-control-id":l.id,"data-control-type":l.controlType,...l.locked?{"data-locked":""}:{},...l.bound?{"data-bound":""}:{},...l.placeholder?{"data-placeholder":""}:{},className:`docx-content-control-inspector${e?` ${e}`:""}`,style:EC,onMouseDown:u=>{zs(u),u.stopPropagation();}},f=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{id:s,className:"docx-editor-sr-only",children:c("contentControl.inspectorPanel.title")}),g]});return t?jsxRuntime.jsx(W,{...m,children:f}):jsxRuntime.jsx("div",{...m,children:f})}function vm({className:e,asChild:t,hidden:n,children:o}){let{closeInspector:r}=pt(),{t:a}=_();if(n)return null;let i={style:IC,className:e??void 0,"data-testid":"content-control-inspector-header"},s=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{children:o??a("contentControl.inspectorPanel.title")}),jsxRuntime.jsx("button",{type:"button","data-testid":"content-control-inspector-close","aria-label":a("common.close"),title:a("common.close"),style:{...hm,padding:4,border:"none",background:"transparent"},onMouseDown:zs,onClick:()=>r(),children:bm(CC)})]});return t?jsxRuntime.jsx(W,{...i,children:s}):jsxRuntime.jsx("div",{...i,children:s})}function ym({className:e,asChild:t,hidden:n,children:o}){let{control:r}=pt(),{t:a}=_();if(n||!r)return null;let i=a("contentControl.inspectorPanel.empty"),s=a("contentControl.inspectorPanel.yes"),c=a("contentControl.inspectorPanel.no"),l=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(en,{label:a("contentControl.inspectorPanel.alias"),value:r.alias??i,testId:"content-control-inspector-alias"}),jsxRuntime.jsx(en,{label:a("contentControl.inspectorPanel.tag"),value:r.tag??i,testId:"content-control-inspector-tag"}),jsxRuntime.jsx(en,{label:a("contentControl.inspectorPanel.type"),value:a(_C(r.controlType)),testId:"content-control-inspector-type"}),jsxRuntime.jsx(en,{label:a("contentControl.inspectorPanel.lock"),value:a(NC(r)),testId:"content-control-inspector-lock"}),jsxRuntime.jsx(en,{label:a("contentControl.inspectorPanel.placeholder"),value:r.placeholder?s:c,testId:"content-control-inspector-placeholder"}),jsxRuntime.jsx(en,{label:a("contentControl.inspectorPanel.bound"),value:r.bound?s:c,testId:"content-control-inspector-bound"}),r.bound?jsxRuntime.jsx("p",{"data-testid":"content-control-inspector-bound-note",style:{margin:0,color:"var(--doc-text-muted)",fontSize:12},children:a("contentControl.inspectorPanel.boundNote")}):null,r.locked?jsxRuntime.jsx("p",{"data-testid":"content-control-inspector-locked-note",style:{margin:0,color:"var(--doc-text-muted)",fontSize:12},"aria-live":"polite",children:a("contentControl.inspectorPanel.lockedNote")}):null]}),d={className:e??void 0,"data-testid":"content-control-inspector-fields",style:{display:"flex",flexDirection:"column",gap:8}};return t?jsxRuntime.jsx(W,{...d,children:l}):jsxRuntime.jsx("div",{...d,children:l})}function xm({className:e,asChild:t,hidden:n,icon:o,children:r}){let{canRemove:a,removeDisabledReason:i,remove:s,closeInspector:c}=pt(),{t:l}=_();if(n)return null;let d=l("contentControl.remove"),p={type:"button",className:`docx-content-control-inspector__remove${e?` ${e}`:""}`,"data-testid":"content-control-inspector-remove","data-slot":"contentControl.remove",disabled:!a,...a?{}:{"data-disabled":""},"aria-label":d,title:i??d,style:hm,onMouseDown:zs,onClick:()=>{s().ok&&c();}},g=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o??r??bm(PC),jsxRuntime.jsx("span",{children:d})]});return t?jsxRuntime.jsx(W,{...p,children:g}):jsxRuntime.jsx("button",{...p,children:g})}var ri=Object.assign(DC,{Header:vm,Fields:ym,Remove:xm});var AC={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg)"},OC={flex:1,minHeight:0,minWidth:0,overflowAnchor:"none"},ZC={position:"relative",display:"flex",flex:1,minHeight:0,minWidth:0},BC={display:"flex",justifyContent:"center",flex:"none",minHeight:34,padding:"6px 0 2px",overflow:"hidden",backgroundColor:"var(--doc-bg)"},qC={position:"absolute",top:40,left:0,zIndex:10,pointerEvents:"none"},KC={flex:"none",display:"flex",flexDirection:"column",position:"relative",zIndex:30,backgroundColor:"var(--doc-surface)",borderBottomWidth:1,borderBottomStyle:"solid",borderBottomColor:"var(--doc-border)",boxShadow:"0 1px 3px var(--doc-shadow-subtle)"},zC={padding:"8px 12px"},VC={display:"flex",alignItems:"center",gap:8,padding:"8px 12px 0",color:"var(--doc-text)"},$C={display:"flex",flexDirection:"column",flex:1,minWidth:0,gap:2},WC={flex:1,minWidth:0,font:"inherit",color:"inherit",backgroundColor:"transparent",border:"1px solid transparent",borderRadius:4,padding:"2px 6px"};function UC({forwardedRef:e}){let t=A(),n=Ye.useRef(null);return n.current=t,Gc({ref:e,editorRef:n}),null}var GC=Ye.forwardRef(function(t,n){let{document:o,fonts:r,className:a,t:i,chrome:s=true,title:c,onTitleChange:l,renderTitleBarLeft:d,renderTitleBarRight:p,colorMode:g="light",author:m,locale:f,mode:u="edit",modules:h,zoom:b,zoomMode:v,onReady:C,onChange:P,onFontError:S,onOpen:y,onSave:x,hyperlinkPopup:M,contextMenu:E=true,menu:w=true,navigation:N=true,rulers:F=true}=t,[H,I]=Ye.useState(gc);Ye.useEffect(()=>{if(g==="system")return hc(I)},[g]);let D=bc(g,H),{t:k}=_(),R=Ye.useCallback((Q,Me)=>i?i(Q,Me):k(Q,Me),[i,k]),z=jsxRuntime.jsxs($r,{className:s?D?"dark":void 0:a,style:s?OC:void 0,children:[s?jsxRuntime.jsx($a,{}):null,s?jsxRuntime.jsx(Ga,{}):null,jsxRuntime.jsx(Fr,{}),jsxRuntime.jsx(Ua,{hidden:M===false}),E===false?null:jsxRuntime.jsx(vr,{t:R,...typeof E=="object"?E:{}}),jsxRuntime.jsx(ri,{}),F&&s?jsxRuntime.jsx("div",{style:qC,"aria-hidden":"true",children:jsxRuntime.jsx(Na,{})}):null,t.children]}),Z=s?jsxRuntime.jsxs("div",{className:`docx-editor${D?" dark":""}${a?` ${a}`:""}`,style:AC,children:[jsxRuntime.jsxs("div",{style:KC,children:[jsxRuntime.jsxs("div",{style:VC,children:[d?.(),jsxRuntime.jsxs("div",{style:$C,children:[l?jsxRuntime.jsx("input",{"aria-label":R("titleBar.documentNameAriaLabel"),value:c??"",placeholder:R("titleBar.untitled"),onChange:Q=>l(Q.target.value),style:WC}):jsxRuntime.jsx("span",{style:{minWidth:0,padding:"2px 6px"},children:c??R("titleBar.untitled")}),w!==false?jsxRuntime.jsx(jn,{t:R,...c!==void 0?{fileName:c}:{},...y?{onOpen:y}:{},...x?{onSave:x}:{},...typeof w=="object"?w:{}}):null]}),p?.()]}),jsxRuntime.jsx("div",{style:zC,children:jsxRuntime.jsx(zn,{t:R})})]}),F?jsxRuntime.jsx("div",{style:BC,children:jsxRuntime.jsx(_a,{})}):null,jsxRuntime.jsx(Ka,{t:R}),jsxRuntime.jsxs("div",{style:ZC,children:[N?jsxRuntime.jsx(qa,{t:R}):null,z,jsxRuntime.jsx(Ss.Provider,{value:R,children:jsxRuntime.jsx(Cs,{})}),jsxRuntime.jsx(Or,{overlay:true})]})]}):z,$=Ye.useCallback(Q=>R(Q),[R]);return jsxRuntime.jsxs(zr,{...o!==void 0?{document:o}:{},...r?{fonts:r}:{},...m!==void 0?{author:m}:{},...f!==void 0?{locale:f}:{},translate:R,mode:u,...h!==void 0?{modules:h}:{},...b!==void 0?{zoom:b}:{},...v!==void 0?{zoomMode:v}:{},tableInteractionLabel:$,...C?{onReady:C}:{},...P?{onChange:P}:{},...S?{onFontError:S}:{},children:[jsxRuntime.jsx(UC,{forwardedRef:n}),jsxRuntime.jsx(Qt.Provider,{value:s,children:Z})]})}),YC=Ye.forwardRef(function(t,n){return jsxRuntime.jsx(wo,{...t.i18n!==void 0?{i18n:t.i18n}:{},children:jsxRuntime.jsx(GC,{...t,ref:n})})}),XC=Object.assign(YC,{Root:zr,Viewport:$r,Content:Fr,Toolbar:zn,Menu:jn,Loading:Or,HorizontalRuler:_a,VerticalRuler:Na,DocumentOutline:fs,Navigation:qa,PageSetupDialog:Vn,PageNumber:Cs,FontNotice:Ka,HeaderFooterChrome:$a,NotesChrome:Ga,HyperLink:Ua,ContextMenu:Ks,ContentControl:ri});function JC(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}async function eP(e){return typeof e=="function"?e():e}function tP(e,t={}){let[n,o]=Ye.useState(void 0),[r,a]=Ye.useState(void 0),[i,s]=Ye.useState(null),[c,l]=Ye.useState(e!=null),[d,p]=Ye.useState(t.fonts===void 0),g=Ye.useRef(t);return g.current=t,Ye.useEffect(()=>{let m=g.current.fonts;if(m===void 0)return;let f=true;return (async()=>{try{let u=await eP(m);f&&a(editor.composeFontConfiguration(u));}catch{}finally{f&&p(true);}})(),()=>{f=false;}},[]),Ye.useEffect(()=>{if(e==null){o(void 0),s(null),l(false);return}let m=JC(e);if(m){o(m),s(null),l(false);return}let f=true,u=new AbortController;return l(true),s(null),(async()=>{try{let h=await fetch(String(e),{...g.current.fetchOptions,signal:u.signal});if(!h.ok)throw new Error(`could not open the document: ${h.status} ${h.statusText}`);let b=new Uint8Array(await h.arrayBuffer());if(!f)return;o(b),l(!1);}catch(h){if(!f||h instanceof Error&&h.name==="AbortError")return;s(h instanceof Error?h:new Error("could not open the document")),l(false);}})(),()=>{f=false,u.abort();}},[e]),{document:d?n:void 0,fonts:r,error:i,isLoading:c||!d}}function aP(e,...t){let n=Ye.useRef({source:e,fragments:t});return n.current={source:e,fragments:t},Ye.useMemo(()=>async o=>{let r=n.current,i=[typeof r.source=="function"?await r.source(o):await r.source,...r.fragments].filter(l=>l!==void 0);if(i.length===0)return;let{epoch:s,...c}=editor.composeFontConfiguration(i[0],...i.slice(1));return c},[])}function sP(e){let n=e?.surface?.state?.().selection?.head;return n&&typeof n.paragraphId=="string"&&Number.isFinite(n.offset)?n:null}function cP(){let e=A(),t=Ye.useRef(null),n=Ye.useCallback(r=>{if(!e)return ()=>{};let a=e.on("selectionChange",r),i=e.on("change",r);return ()=>{a(),i();}},[e]),o=Ye.useCallback(()=>{let r=sP(e),a=t.current;return (r===null?a===null:a!==null&&dP(a,r))?a:(t.current=r,r)},[e]);return Ye.useSyncExternalStore(n,o,()=>null)}function dP(e,t){return e.paragraphId===t.paragraphId&&e.offset===t.offset}function Vs({source:e,scale:t,measurer:n,onStateChange:o,onError:r,className:a,documentFontFamily:i,ref:s}){let c=Ye.useRef(null),l=Ye.useRef(null),[d,p]=Ye.useState(null),g=Ye.useRef(o);g.current=o;let m=Ye.useRef(r);return m.current=r,Ye.useEffect(()=>{let f=c.current;if(!f)return;let u=editor.mountPaginatedSurface(f,e,{...t===void 0?{}:{scale:t},...n?{measurer:n}:{},onChange:b=>{p(b),g.current?.(b);}});if(!u.ok){m.current?.(u.reason,u.detail);return}l.current=u.surface;let h=u.surface.state();return p(h),g.current?.(h),()=>{u.surface.destroy(),l.current=null;}},[e,n]),Ye.useImperativeHandle(s,()=>({focus:()=>l.current?.focus(),type:f=>l.current?.type(f),undo:()=>l.current?.undo(),redo:()=>l.current?.redo(),selectAll:()=>l.current?.selectAll(),navigate:(f,u)=>l.current?.navigate(f,u),toggleRunProperty:(f,u)=>l.current?.toggleRunProperty(f,u),setRunProperty:(f,u)=>l.current?.setRunProperty(f,u),setParagraphProperty:(f,u)=>l.current?.setParagraphProperty(f,u),formatting:()=>l.current?.formatting()??null,sectionProperties:()=>l.current?.sectionProperties()??null,save:()=>{let f=l.current;return f?(f.flushPendingInput(),f.session.save()):null}}),[]),jsxRuntime.jsx("div",{ref:c,style:{margin:"24px auto",...i?{fontFamily:i}:{}},className:a?`docx-paginated-surface ${a}`:"docx-paginated-surface","data-revision":d?.revision??0,"data-page-count":d?.pageCount??0})}var Tr=Ye.createContext(null);function Em(){let e=Ye.useContext(Tr);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}function yP(e){return "type"in e&&e.type==="separator"}var km={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"},xP={...km,background:"var(--doc-bg-hover)"},Im={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"},TP={...Im,opacity:.4,cursor:"default"},SP={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},CP={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted)"},PP={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 Sr({label:e,items:t,disabled:n,showChevron:o=false}){let[r,a]=Ye.useState(false),[i,s]=Ye.useState(null),c=Ye.useRef(null),l=Ye.useRef(null),[d,p]=Ye.useState({top:0,left:0}),g=Ye.useCallback(()=>{a(false),s(null);},[]);Ye.useEffect(()=>{if(!r||!c.current)return;let f=c.current.getBoundingClientRect();p({top:f.bottom+2,left:f.left});},[r]),Ye.useEffect(()=>{if(!r)return;function f(b){let v=b.target;c.current&&!c.current.contains(v)&&l.current&&!l.current.contains(v)&&g();}function u(b){b.key==="Escape"&&g();}function h(){g();}return document.addEventListener("mousedown",f),document.addEventListener("keydown",u),window.addEventListener("scroll",h,true),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",u),window.removeEventListener("scroll",h,true);}},[r,g]);let m=f=>{f.disabled||f.submenuContent||f.onClick&&(f.onClick(),g());};return jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:c,type:"button",onClick:()=>!n&&a(!r),onMouseDown:f=>f.preventDefault(),disabled:n,style:r?xP:km,children:[e,o&&jsxRuntime.jsx(K,{name:"arrow_drop_down",size:16})]}),r&&jsxRuntime.jsx("div",{ref:l,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:f=>f.preventDefault(),children:t.map((f,u)=>{if(yP(f))return jsxRuntime.jsx("div",{style:SP},`sep-${u}`);let h=f;if(h.customContent)return jsxRuntime.jsx("div",{onMouseDown:C=>C.preventDefault(),children:h.customContent},h.label);let b=!!h.submenuContent,v=i===h.label;return jsxRuntime.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>b&&s(h.label),onMouseLeave:()=>b&&s(null),children:[jsxRuntime.jsxs("button",{type:"button",style:h.disabled?TP:Im,onClick:()=>m(h),onMouseDown:C=>C.preventDefault(),onMouseOver:C=>{h.disabled||(C.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:C=>{C.currentTarget.style.backgroundColor="transparent";},disabled:h.disabled,children:[h.icon&&jsxRuntime.jsx(K,{name:h.icon,size:18}),jsxRuntime.jsx("span",{children:h.label}),h.shortcut&&jsxRuntime.jsx("span",{style:CP,children:h.shortcut}),b&&jsxRuntime.jsx("span",{style:{marginLeft:"auto"},children:jsxRuntime.jsx(K,{name:"keyboard_arrow_right",size:16})})]}),b&&v&&jsxRuntime.jsx("div",{style:PP,onMouseDown:C=>C.preventDefault(),children:h.submenuContent(g)})]},h.label)})})]})}var Us=18,wP=2,_m={width:Us,height:Us,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},MP={..._m,backgroundColor:"var(--doc-primary)",border:"1px solid var(--doc-primary)"},kP={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text)",textAlign:"center"};function Nm({onInsert:e,gridRows:t=6,gridColumns:n=6}){let[o,r]=Ye.useState(0),[a,i]=Ye.useState(0),s=Ye.useCallback(()=>{o>0&&a>0&&e(o,a);},[o,a,e]),c=[];for(let d=1;d<=t;d++)for(let p=1;p<=n;p++){let g=d<=o&&p<=a;c.push(jsxRuntime.jsx("div",{style:g?MP:_m,onMouseEnter:()=>{r(d),i(p);},onClick:s,role:"gridcell","aria-selected":g},`${d}-${p}`));}let l=o>0&&a>0?`${a} \xD7 ${o}`:"Select size";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{display:"grid",gap:wP,gridTemplateColumns:`repeat(${n}, ${Us}px)`},onMouseLeave:()=>{r(0),i(0);},role:"grid","aria-label":"Table size selector",children:c}),jsxRuntime.jsx("div",{style:kP,children:l})]})}function NP({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 DP(){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 li({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function LP(e){return e.replace(/\.docx$/i,"")}function Ys({value:e,onChange:t,placeholder:n,editable:o=true}){let{t:r}=_(),a=n??r("titleBar.untitled"),i=LP(e)??"";return o?jsxRuntime.jsx("input",{type:"text",value:i,onChange:s=>{let c=s.target.value;t?.(c.endsWith(".docx")?c:c+".docx");},placeholder:a,className:"text-base font-normal text-foreground bg-transparent border-0 outline-none px-2 py-0 rounded hover:bg-muted focus:bg-doc-bg-input focus:ring-1 focus:ring-ring min-w-[100px] max-w-[300px] truncate leading-tight","aria-label":r("titleBar.documentNameAriaLabel")}):jsxRuntime.jsx("span",{className:"text-base font-normal text-foreground px-2 py-0 min-w-[100px] max-w-[300px] truncate leading-tight",children:i||a})}function si({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function ci(){let{t:e}=_(),t=Em(),{disabled:n=false,onFormat:o,onPrint:r,onOpen:a,onSave:i,onPageSetup:s,onInsertImage:c,onInsertTable:l,showTableInsert:d=true,showHelpMenu:p=true,onInsertPageBreak:g,onInsertSectionBreakNextPage:m,onInsertSectionBreakContinuous:f,onInsertTOC:u,onWatermark:h,onRefocusEditor:b}=t,v=Ye.useCallback(y=>{!n&&o&&o(y);},[n,o]),C=Ye.useCallback((y,x)=>{!n&&l&&(l(y,x),requestAnimationFrame(()=>b?.()));},[n,l,b]),P=!!r||!!s,S=P||a||i;return jsxRuntime.jsxs("div",{className:"flex items-center",role:"menubar","aria-label":e("titleBar.menuBarAriaLabel"),children:[S&&jsxRuntime.jsx(Sr,{label:e("toolbar.file"),disabled:n,items:[...a?[{icon:"file_upload",label:e("toolbar.open"),shortcut:e("toolbar.openShortcut"),onClick:a}]:[],...i?[{icon:"file_download",label:e("toolbar.save"),shortcut:e("toolbar.saveShortcut"),onClick:i}]:[],...(a||i)&&P?[{type:"separator"}]:[],...r?[{icon:"print",label:e("toolbar.print"),shortcut:e("toolbar.printShortcut"),onClick:r}]:[],...s?[{icon:"settings",label:e("toolbar.pageSetup"),onClick:s}]:[]]}),jsxRuntime.jsx(Sr,{label:e("toolbar.format"),disabled:n,items:[{icon:"format_textdirection_l_to_r",label:e("toolbar.leftToRight"),onClick:()=>v("setLtr")},{icon:"format_textdirection_r_to_l",label:e("toolbar.rightToLeft"),onClick:()=>v("setRtl")}]}),jsxRuntime.jsx(Sr,{label:e("toolbar.insert"),disabled:n,items:[...c?[{icon:"image",label:e("toolbar.image"),onClick:c}]:[],...d&&l?[{icon:"grid_on",label:e("toolbar.table"),submenuContent:y=>jsxRuntime.jsx(Nm,{onInsert:(x,M)=>{C(x,M),y();}})}]:[],...c||d&&l?[{type:"separator"}]:[],{icon:"page_break",label:e("toolbar.break"),submenuContent:y=>jsxRuntime.jsx(NP,{closeMenu:y,items:[{icon:"page_break",label:e("toolbar.pageBreak"),onClick:g},{icon:"horizontal_rule",label:e("toolbar.sectionBreakNextPage"),onClick:m},{icon:"border_horizontal",label:e("toolbar.sectionBreakContinuous"),onClick:f}]})},{icon:"format_list_numbered",label:e("toolbar.tableOfContents"),onClick:u,disabled:!u},...h?[{icon:"branding_watermark",label:e("toolbar.watermark"),onClick:h}]:[]]}),p&&jsxRuntime.jsx(Sr,{label:e("toolbar.help"),disabled:n,items:[{label:e("toolbar.reportIssue"),onClick:()=>Wn()}]})]})}function Xs({children:e}){let t=null,n=null,o=[],r=[];Ye.Children.forEach(e,i=>{Ye.isValidElement(i)&&(i.type===li?t=i:i.type===si?n=i:i.type===ci?r.push(i):o.push(i));});let a=Ye.useCallback(i=>{let s=i.target;s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.tagName==="SELECT"||s.tagName==="OPTION"||i.preventDefault();},[]);return jsxRuntime.jsxs("div",{className:"flex items-stretch bg-doc-surface pt-2 pb-1",onMouseDown:a,"data-testid":"title-bar",children:[jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 pl-3 pr-1",children:t||jsxRuntime.jsx(DP,{})}),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 di={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},OP={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:""},Dm={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 ZP(e,t){let n=Dm[t]??Dm[t.toLowerCase()]??t,r=e?.colorScheme?.[n];return typeof r=="string"&&r?r:di[n]??"000000"}function Lm(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 js(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex")return `#${Lm(e.value)??n}`;let o=Object.entries(t?.colorScheme??di).map(([a,i])=>({slot:a,hex:String(i)})),r=editor.resolveThemeColorHex(e,o);return `#${r.ok?r.hex:ZP(t,e.slot)}`}function wt(e,t){if(!(!e||e.kind==="auto"))return e.kind==="hex"?Lm(e.value):js(e,t).slice(1)}function Hm(e){if(!e||e==="none")return "";let t=OP[e];return t?`#${t}`:""}var BP=[{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"}],qP=[{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 Fm(e){let t=e??di;return qP.map(n=>BP.map(o=>{let r=t[o.slot]??di[o.slot]??"000000",i={hex:n.type==="base"?r.toUpperCase():n.type==="tint"?editor.applyThemeTint(r,n.keep):editor.applyThemeShade(r,n.keep),themeSlot:o.slot,label:`${o.name}${n.labelSuffix}`};return n.type==="tint"?i.tint=n.keep:n.type==="shade"&&(i.shade=n.keep),i}))}function j(...e){return clsx.clsx(e)}var VP=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"}}),we=Ye__namespace.forwardRef(({className:e,variant:t,size:n,...o},r)=>jsxRuntime.jsx("button",{className:j(VP({variant:t,size:n,className:e})),ref:r,...o}));we.displayName="Button";function Je({content:e,children:t,side:n="bottom",delayMs:o=400}){let[r,a]=Ye__namespace.useState(false),[i,s]=Ye__namespace.useState({x:0,y:0}),c=Ye__namespace.useRef(null),l=Ye__namespace.useRef(null),d=Ye__namespace.useCallback(()=>{l.current=setTimeout(()=>{if(c.current){let f=c.current.getBoundingClientRect(),u=f.left+f.width/2,h=n==="top"?f.top-8:f.bottom+8;s({x:u,y:h});}a(true);},o);},[o,n]),p=Ye__namespace.useCallback(()=>{l.current&&(clearTimeout(l.current),l.current=null),a(false);},[]);Ye__namespace.useEffect(()=>()=>{l.current&&clearTimeout(l.current);},[]);let g=t.props,m=Ye__namespace.cloneElement(t,{ref:c,onMouseEnter:f=>{d(),g.onMouseEnter?.(f);},onMouseLeave:f=>{p(),g.onMouseLeave?.(f);}});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[m,r&&jsxRuntime.jsx("div",{className:"fixed z-50 px-2 py-1 text-xs font-medium text-white bg-foreground dark:bg-muted dark:text-foreground rounded-md shadow-lg",style:{left:i.x,top:i.y,transform:n==="top"?"translate(-50%, -100%)":n==="bottom"?"translate(-50%, 0)":void 0},children:e})]})}var qt=pe__namespace.Root,Kt=pe__namespace.Group,ui=pe__namespace.Value;function zt({className:e,children:t,onMouseDown:n,...o}){return jsxRuntime.jsxs(pe__namespace.Trigger,{className:j("flex h-8 items-center justify-between gap-1 rounded px-2 py-1","text-sm text-foreground bg-transparent","hover:bg-muted/80 focus:outline-none focus:bg-muted/80","disabled:cursor-not-allowed disabled:opacity-50","transition-colors duration-150","[&>span]:truncate",e),onMouseDown:r=>{r.preventDefault(),n?.(r);},...o,children:[t,jsxRuntime.jsx(pe__namespace.Icon,{asChild:true,children:jsxRuntime.jsx(YP,{className:"h-4 w-4 text-muted-foreground shrink-0"})})]})}function Vt({className:e,children:t,position:n="popper",onCloseAutoFocus:o,...r}){let a=typeof document<"u"&&!!document.querySelector(".docx-editor.dark");return jsxRuntime.jsx(pe__namespace.Portal,{children:jsxRuntime.jsx("div",{className:j("docx-editor",a&&"dark"),children:jsxRuntime.jsx(pe__namespace.Content,{className:j("relative z-50 max-h-72 min-w-[8rem] overflow-hidden","rounded-lg border border-border bg-popover text-popover-foreground shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",e),position:n,onCloseAutoFocus:i=>{i.preventDefault(),o?.(i);},...r,children:jsxRuntime.jsx(pe__namespace.Viewport,{className:j("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),onMouseDown:i=>i.preventDefault(),children:t})})})})}function bo({className:e,...t}){return jsxRuntime.jsx(pe__namespace.Label,{className:j("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...t})}function et({className:e,children:t,onMouseDown:n,...o}){return jsxRuntime.jsxs(pe__namespace.Item,{className:j("relative flex w-full cursor-pointer select-none items-center","rounded px-2 py-1.5 text-sm text-foreground outline-none","hover:bg-muted focus:bg-muted","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),onMouseDown:r=>{r.preventDefault(),n?.(r);},...o,children:[jsxRuntime.jsx(pe__namespace.ItemText,{children:t}),jsxRuntime.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(pe__namespace.ItemIndicator,{children:jsxRuntime.jsx(XP,{className:"h-4 w-4"})})})]})}function ho({className:e,...t}){return jsxRuntime.jsx(pe__namespace.Separator,{className:j("-mx-1 my-1 h-px bg-muted",e),...t})}function YP({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 XP({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 Qs(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 jP=[{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 Zm({value:e,onChange:t,fonts:n=jP,documentFonts:o,disabled:r=false,className:a,placeholder:i="Arial",width:s=120,showPreview:c=true}){let{t:l}=_(),d=Ye__namespace.useMemo(()=>{if(!o)return [];let u=new Set(n.map(h=>h.name.toLowerCase()));return o.filter(h=>!u.has(h.name.toLowerCase()))},[o,n]),p=Ye__namespace.useMemo(()=>[...d,...n],[d,n]),g=Ye__namespace.useMemo(()=>e?p.find(h=>h.fontFamily===e||h.name.toLowerCase()===e.toLowerCase()||Qs(h.fontFamily).toLowerCase()===e.toLowerCase())?.name||e:i,[e,p,i]),m=Ye__namespace.useCallback(u=>{let h=p.find(b=>b.name===u);h&&t?.(Qs(h.fontFamily)||h.name);},[t,p]),f=Ye__namespace.useMemo(()=>{let u={"sans-serif":[],serif:[],monospace:[],other:[]};return n.forEach(h=>{let b=h.category||"other";u[b].push(h);}),u},[n]);return jsxRuntime.jsxs(qt,{value:g,onValueChange:m,disabled:r,children:[jsxRuntime.jsx(zt,{className:j("h-8 text-sm",a),style:{minWidth:typeof s=="number"?`${s}px`:s},"aria-label":l("font.selectAriaLabel"),children:jsxRuntime.jsx(ui,{placeholder:i,children:g})}),jsxRuntime.jsxs(Vt,{className:"max-h-[300px]",children:[d.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Kt,{children:[jsxRuntime.jsx(bo,{children:l("font.documentFonts")}),d.map(u=>jsxRuntime.jsx(et,{value:u.name,style:c?{fontFamily:u.fontFamily}:void 0,children:u.name},`doc-${u.name}`))]}),jsxRuntime.jsx(ho,{})]}),f["sans-serif"].length>0&&jsxRuntime.jsxs(Kt,{children:[jsxRuntime.jsx(bo,{children:l("font.sansSerif")}),f["sans-serif"].map(u=>jsxRuntime.jsx(et,{value:u.name,style:c?{fontFamily:u.fontFamily}:void 0,children:u.name},u.name))]}),f.serif.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ho,{}),jsxRuntime.jsxs(Kt,{children:[jsxRuntime.jsx(bo,{children:l("font.serif")}),f.serif.map(u=>jsxRuntime.jsx(et,{value:u.name,style:c?{fontFamily:u.fontFamily}:void 0,children:u.name},u.name))]})]}),f.monospace.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ho,{}),jsxRuntime.jsxs(Kt,{children:[jsxRuntime.jsx(bo,{children:l("font.monospace")}),f.monospace.map(u=>jsxRuntime.jsx(et,{value:u.name,style:c?{fontFamily:u.fontFamily}:void 0,children:u.name},u.name))]})]}),f.other.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ho,{}),jsxRuntime.jsx(Kt,{children:f.other.map(u=>jsxRuntime.jsx(et,{value:u.name,style:c?{fontFamily:u.fontFamily}:void 0,children:u.name},u.name))})]})]})]})}function Js(e){if(e===void 0)return;let t=e.map(n=>typeof n=="string"?{name:n,fontFamily:n,category:"other"}:n);return t}function t1(e,t,n,o){let a=Math.max(8,window.innerWidth-n-8),i=Math.max(8,window.innerHeight-o-8);return {top:Math.min(Math.max(8,e),i),left:Math.min(Math.max(8,t),a)}}function $e({isOpen:e,onClose:t,align:n="left"}){let o=Ye.useRef(null),r=Ye.useRef(null),[a,i]=Ye.useState({top:0,left:0});Ye.useEffect(()=>{if(!e||!o.current)return;let l=o.current.getBoundingClientRect();n==="right"?requestAnimationFrame(()=>{if(r.current){let d=r.current.getBoundingClientRect(),p=t1(l.bottom+4,l.right-d.width,d.width,d.height);i(p);}else i({top:l.bottom+4,left:l.left});}):i({top:l.bottom+4,left:l.left});},[e,n]),Ye.useEffect(()=>{if(!e)return;let l=performance.now()+150,d=m=>{let f=m.target;o.current&&!o.current.contains(f)&&r.current&&!r.current.contains(f)&&t();},p=m=>{m.key==="Escape"&&t();},g=m=>{if(performance.now()<l)return;let f=m.target;f&&r.current&&r.current.contains(f)||f instanceof Element&&f!==document.documentElement&&f!==document.body&&o.current&&f.contains(o.current)||t();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",p),window.addEventListener("scroll",g,true),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",p),window.removeEventListener("scroll",g,true);}},[e,t]);let s=Ye.useCallback(l=>{l.preventDefault(),l.stopPropagation();},[]),c={position:"fixed",top:a.top,left:a.left,zIndex:1e4};return {containerRef:o,dropdownRef:r,dropdownStyle:c,handleMouseDown:s}}var r1=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],a1=1,i1=400;function Km(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function zm(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 Vm({value:e,onChange:t,sizes:n=r1,disabled:o=false,className:r,placeholder:a="11",minSize:i=a1,maxSize:s=i1}){let{t:c}=_(),[l,d]=Ye.useState(false),[p,g]=Ye.useState(""),[m,f]=Ye.useState(false),u=Ye.useRef(null),h=Ye.useCallback(()=>{f(false),d(false);},[]),{containerRef:b,dropdownRef:v,dropdownStyle:C}=$e({isOpen:m,onClose:h}),P=e??(parseInt(a,10)||11),S=e!==void 0?e.toString():a,y=Ye.useCallback(I=>{if(I.preventDefault(),o)return;let D=zm(P,n,i);t?.(D);},[P,n,i,o,t]),x=Ye.useCallback(I=>{if(I.preventDefault(),o)return;let D=Km(P,n,s);t?.(D);},[P,n,s,o,t]),M=Ye.useCallback(I=>{I.preventDefault(),!o&&(d(true),g(S),f(true),requestAnimationFrame(()=>{u.current?.focus(),u.current?.select();}));},[o,S]),E=Ye.useCallback(I=>{g(I.target.value);},[]),w=Ye.useCallback(()=>{d(false);let I=parseFloat(p);if(!isNaN(I)&&I>=i&&I<=s){let D=Math.round(I*2)/2;t?.(D);}},[p,i,s,t]),N=Ye.useCallback(I=>{if(I.key==="Enter")I.preventDefault(),w(),f(false);else if(I.key==="Escape")d(false),f(false);else if(I.key==="ArrowUp"){I.preventDefault();let D=Km(P,n,s);g(D.toString()),t?.(D);}else if(I.key==="ArrowDown"){I.preventDefault();let D=zm(P,n,i);g(D.toString()),t?.(D);}},[w,P,n,s,i,t]),F=Ye.useCallback(I=>{t?.(I),f(false),d(false);},[t]),H=Ye.useCallback(I=>{I.target.tagName!=="INPUT"&&I.preventDefault();},[]);return jsxRuntime.jsxs("div",{ref:b,className:j("flex items-center",r),onMouseDown:H,children:[jsxRuntime.jsx(we,{variant:"ghost",size:"icon-sm",className:j("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",o&&"opacity-30 cursor-not-allowed"),onMouseDown:y,disabled:o||P<=i,"aria-label":c("fontSize.decrease"),"data-testid":"font-size-decrease",children:jsxRuntime.jsx(K,{name:"remove",size:18})}),jsxRuntime.jsx("div",{className:"relative",children:l?jsxRuntime.jsx("input",{ref:u,type:"text",value:p,onChange:E,onBlur:w,onKeyDown:N,className:j("h-7 w-10 text-center text-sm border border-input bg-doc-bg-input text-doc-text","focus:outline-none focus:ring-1 focus:ring-ring","rounded-none"),"aria-label":c("fontSize.label"),"data-testid":"font-size-input"}):jsxRuntime.jsx("button",{type:"button",onClick:M,className:j("h-7 w-10 text-center text-sm border border-border bg-doc-bg-input text-doc-text","hover:border-input hover:bg-doc-bg-hover","focus:outline-none focus:ring-1 focus:ring-ring","rounded-none",o&&"opacity-50 cursor-not-allowed"),disabled:o,"aria-label":c("fontSize.label"),"aria-haspopup":"listbox","aria-expanded":m,"data-testid":"font-size-display",children:S})}),m&&jsxRuntime.jsx("div",{ref:v,style:{...C,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",maxHeight:240,overflowY:"auto",minWidth:60},role:"listbox","aria-label":c("fontSize.listLabel"),children:n.map(I=>jsxRuntime.jsx("button",{type:"button",onClick:()=>F(I),className:j("w-full px-3 py-1.5 text-sm text-left","hover:bg-muted",I===P&&"bg-muted font-medium"),role:"option","aria-selected":I===P,children:I},I))}),jsxRuntime.jsx(we,{variant:"ghost",size:"icon-sm",className:j("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",o&&"opacity-30 cursor-not-allowed"),onMouseDown:x,disabled:o||P>=s,"aria-label":c("fontSize.increase"),"data-testid":"font-size-increase",children:jsxRuntime.jsx(K,{name:"add",size:18})})]})}var c1=[{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"}],mi=18,d1=2,u1={position:"relative",display:"inline-block"},p1={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)"},m1={padding:"10px",backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border-dark)",borderRadius:"6px",boxShadow:"0 4px 16px var(--doc-shadow)",width:"auto"},oc={fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px",fontWeight:500},nc={height:"1px",backgroundColor:"var(--doc-border)",margin:"8px 0"},Um={display:"grid",gap:`${d1}px`},fi={width:`${mi}px`,height:`${mi}px`,border:"1px solid var(--doc-border-input)",borderRadius:"2px",cursor:"pointer",padding:0,transition:"transform 0.1s, border-color 0.1s"},Gm={...fi,transform:"scale(1.15)",borderColor:"var(--doc-text)",zIndex:1},Ym={...fi,borderWidth:"2px",borderColor:"var(--doc-primary)",boxShadow:"0 0 0 1px var(--doc-primary)"},f1={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)"},g1={display:"flex",alignItems:"center",gap:"6px"},b1={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"12px"},h1={height:"24px",padding:"0 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",backgroundColor:"var(--doc-bg-subtle)",fontSize:"12px",cursor:"pointer"},$m={width:"16px",height:"4px",borderRadius:"1px",marginTop:"-2px"},v1={display:"inline-flex",alignItems:"stretch",height:"32px",gap:"2px"},y1={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)"},x1={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 rc(e,t,n){if(!e)return t==="text"||t==="border"?"#000000":"transparent";if(typeof e=="string"){if(t==="highlight"){let o=Hm(e);return o||(e==="none"?"transparent":e.startsWith("#")?e:`#${e}`)}return e.startsWith("#")?e:`#${e}`}return js(e,n)}function Wm(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 Xm(e,t,n){return e?(typeof e=="string"?e.replace(/^#/,"").toUpperCase():wt(e,n))===t.toUpperCase():false}function T1({matrix:e,selectedColor:t,theme:n,onSelect:o}){let[r,a]=Ye.useState(null);return jsxRuntime.jsx("div",{style:{...Um,gridTemplateColumns:`repeat(10, ${mi}px)`},children:e.flatMap((i,s)=>i.map((c,l)=>{let d=`${s}-${l}`,p=r===d,g=Xm(t,c.hex,n);return jsxRuntime.jsx("button",{type:"button",style:{...g?Ym:p?Gm:fi,backgroundColor:`#${c.hex}`},title:c.label,"aria-label":c.label,"aria-selected":g,onClick:()=>o(c),onMouseDown:m=>m.preventDefault(),onMouseEnter:()=>a(d),onMouseLeave:()=>a(null)},d)}))})}function S1({selectedColor:e,theme:t,onSelect:n}){let[o,r]=Ye.useState(null),{t:a}=_();return jsxRuntime.jsx("div",{style:{...Um,gridTemplateColumns:`repeat(10, ${mi}px)`},children:c1.map((i,s)=>{let c=o===s,l=Xm(e,i.hex,t),d=a(i.nameKey);return jsxRuntime.jsx("button",{type:"button",style:{...l?Ym:c?Gm:fi,backgroundColor:`#${i.hex}`},title:d,"aria-label":d,"aria-selected":l,onClick:()=>n(i.hex),onMouseDown:p=>p.preventDefault(),onMouseEnter:()=>r(s),onMouseLeave:()=>r(null)},i.hex)})})}function xo({mode:e,value:t,onChange:n,theme:o,disabled:r=false,className:a,style:i,title:s,icon:c,autoLabel:l,splitButton:d=true,defaultColor:p}){let[g,m]=Ye.useState(false),[f,u]=Ye.useState(false),[h,b]=Ye.useState(false),[v,C]=Ye.useState(false),[P,S]=Ye.useState(""),[y,x]=Ye.useState(()=>p??(e==="highlight"?"FFFF00":e==="border"?{kind:"hex",value:"000000"}:{kind:"hex",value:"FF0000"})),{t:M}=_();Ye.useEffect(()=>{let G=rc(t,e,o).replace(/^#/,"");/^[0-9A-Fa-f]{6}$/.test(G)&&S(G.toUpperCase());},[t,e,o]);let E=Ye.useCallback(()=>m(false),[]),{containerRef:w,dropdownRef:N,dropdownStyle:F}=$e({isOpen:g,onClose:E}),H=o?.colorScheme??null,I=Ye.useMemo(()=>Fm(H),[H]),D=Ye.useMemo(()=>rc(t,e,o),[t,e,o]),k=Ye.useMemo(()=>rc(y,e,o),[y,e,o]),R=Ye.useCallback(()=>{r||m(G=>!G);},[r]),z=Ye.useCallback(G=>{let B;e==="highlight"?B=G.hex:B={kind:"theme",slot:G.themeSlot,...G.tint!==void 0?{tint:G.tint}:{},...G.shade!==void 0?{shade:G.shade}:{}},x(B),n?.(B),m(false);},[e,n]),Z=Ye.useCallback(G=>{let B=e==="highlight"?G:{kind:"hex",value:G};x(B),n?.(B),m(false);},[e,n]),$=Ye.useCallback(()=>{n?.(e==="highlight"?"none":{kind:"auto"}),m(false);},[e,n]),Q=Ye.useCallback(()=>{let G=P.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/i.test(G)){let B=e==="highlight"?G:{kind:"hex",value:G};x(B),n?.(B),m(false),S("");}},[e,P,n]),Me=Ye.useCallback(()=>{r||n?.(y);},[r,y,n]),se={...p1,...r?{cursor:"default",opacity:.38}:g?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:f?{backgroundColor:"var(--doc-bg-hover)"}:{}},Te=M(e==="text"?"formattingBar.fontColor":e==="highlight"?"formattingBar.highlightColor":"table.borderColor"),Ce=c??(e==="text"?"format_color_text":e==="highlight"?"ink_highlighter":"border_color");return jsxRuntime.jsxs("div",{ref:w,className:`docx-color-picker ${a||""}`,style:{...u1,...i},children:[d?jsxRuntime.jsxs("div",{className:"docx-color-picker-split",style:{...v1,...r?{opacity:.38,cursor:"default"}:null},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-apply",style:{...y1,...r?{cursor:"default"}:h?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:Me,onMouseDown:G=>G.preventDefault(),onMouseEnter:()=>b(true),onMouseLeave:()=>b(false),disabled:r,title:s||Te,"aria-label":s||Te,children:[jsxRuntime.jsx(K,{name:Ce,size:18}),jsxRuntime.jsx("div",{style:{...$m,backgroundColor:k==="transparent"?"#fff":k,outline:k==="transparent"||Wm(k)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-color-picker-arrow",style:{...x1,...r?{cursor:"default"}:g?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:v?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:R,onMouseDown:G=>G.preventDefault(),onMouseEnter:()=>C(true),onMouseLeave:()=>C(false),disabled:r,title:s||Te,"aria-label":s||Te,"aria-haspopup":"true","aria-expanded":g,children:jsxRuntime.jsx(K,{name:"arrow_drop_down",size:18})})]}):jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-button",style:se,onClick:R,onMouseDown:G=>G.preventDefault(),onMouseEnter:()=>u(true),onMouseLeave:()=>u(false),disabled:r,title:s||Te,"aria-label":s||Te,"aria-haspopup":"true","aria-expanded":g,children:[jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:0},children:[jsxRuntime.jsx(K,{name:Ce,size:18}),jsxRuntime.jsx("div",{style:{...$m,backgroundColor:D==="transparent"?"#fff":D,outline:D==="transparent"||Wm(D)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14})]}),g&&jsxRuntime.jsx("div",{ref:N,className:"docx-color-picker-dropdown",style:{...F,...m1},role:"dialog","aria-label":`${Te} picker`,onMouseDown:G=>{G.target.tagName!=="INPUT"&&G.preventDefault();},children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",style:f1,onClick:$,onMouseDown:G=>G.preventDefault(),children:[e==="highlight"?jsxRuntime.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",border:"1px solid #ccc",borderRadius:"2px",position:"relative",backgroundColor:"#fff"},children:jsxRuntime.jsx("span",{style:{position:"absolute",top:"50%",left:"-1px",right:"-1px",height:"2px",backgroundColor:"#ff0000",transform:"rotate(-45deg)"}})}):jsxRuntime.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",backgroundColor:"#000",borderRadius:"2px"}}),l??M(e==="highlight"?"colorPicker.noColor":"colorPicker.automatic")]}),jsxRuntime.jsx("div",{style:nc}),jsxRuntime.jsx("div",{style:oc,children:M("colorPicker.themeColors")}),jsxRuntime.jsx(T1,{matrix:I,selectedColor:t,theme:o,onSelect:z}),jsxRuntime.jsx("div",{style:nc}),jsxRuntime.jsx("div",{style:oc,children:M("colorPicker.standardColors")}),jsxRuntime.jsx(S1,{selectedColor:t,theme:o,onSelect:Z}),jsxRuntime.jsx("div",{style:nc}),jsxRuntime.jsx("div",{style:oc,children:M("colorPicker.customColor")}),jsxRuntime.jsxs("div",{style:g1,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:b1,value:P,onChange:G=>S(G.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:G=>{G.key==="Enter"&&Q();},onMouseDown:G=>{G.stopPropagation();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsxRuntime.jsx("button",{type:"button",style:{...h1,opacity:/^[0-9A-Fa-f]{6}$/.test(P)?1:.4,cursor:/^[0-9A-Fa-f]{6}$/.test(P)?"pointer":"default"},onClick:Q,onMouseDown:G=>G.preventDefault(),disabled:!/^[0-9A-Fa-f]{6}$/.test(P),children:M("common.apply")})]})]})})]})}var Pr=20,ac=[{value:"left",label:"Align Left",labelKey:"alignment.alignLeft",shortcutKey:"alignment.alignLeftShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_left",size:Pr}),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:Pr}),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:Pr}),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:Pr}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function Jm({value:e="left",onChange:t,disabled:n=false}){let{t:o}=_(),[r,a]=Ye.useState(false),i=Ye.useCallback(()=>a(false),[]),{containerRef:s,dropdownRef:c,dropdownStyle:l,handleMouseDown:d}=$e({isOpen:r,onClose:i}),p=Ye.useCallback(b=>{n||t?.(b),a(false);},[n,t]),g=ac.find(b=>b.value===e)||ac[0],m=o(g.labelKey),f=g.shortcutKey?o(g.shortcutKey):void 0,u=`${m}${f?` (${f})`:""}`,h=jsxRuntime.jsxs(we,{variant:"ghost",size:"icon-sm",className:j("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",n&&"opacity-30 cursor-not-allowed"),onMouseDown:d,onClick:()=>!n&&a(b=>!b),disabled:n,"aria-label":u,"aria-expanded":r,"aria-haspopup":"true","data-testid":"toolbar-alignment",children:[jsxRuntime.jsx(K,{name:g.iconName,size:Pr}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:s,style:{position:"relative",display:"inline-block"},children:[r?h:jsxRuntime.jsx(Je,{content:u,children:h}),r&&!n&&jsxRuntime.jsx("div",{ref:c,style:{...l,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:b=>b.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",gap:2},children:ac.map(b=>{let v=e===b.value,C=o(b.labelKey),P=b.shortcutKey?o(b.shortcutKey):void 0;return jsxRuntime.jsx("button",{type:"button",title:`${C}${P?` (${P})`:""}`,"data-testid":`alignment-${b.value}`,style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:v?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:v?"var(--doc-primary)":"var(--doc-text)"},onMouseDown:S=>S.preventDefault(),onMouseEnter:S=>{v||(S.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:S=>{S.currentTarget.style.backgroundColor=v?"var(--doc-primary-light)":"transparent";},onClick:()=>p(b.value),children:jsxRuntime.jsx(K,{name:b.iconName,size:18})},b.value)})})})]})}function gi(){return {type:"none",level:0,isInList:false}}var M1={display:"inline-flex",alignItems:"center",gap:"4px"},ef={display:"inline-flex",alignItems:"center",gap:"4px"},yi={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)"},k1={...yi,backgroundColor:"var(--doc-bg-hover)"},I1={...yi,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},R1={...yi,cursor:"default",opacity:.38},_1={width:"28px",height:"28px",padding:"2px"},N1={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},bi=20;function hi({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:a,style:i}){let[s,c]=Ye.useState(false),l={...t?R1:e?I1:s?k1:yi,...i},d=p=>{p.preventDefault();};return jsxRuntime.jsx("button",{type:"button",className:`docx-list-button ${e?"docx-list-button-active":""} ${t?"docx-list-button-disabled":""} ${a||""}`,style:l,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 tf({listState:e,onBulletList:t,onNumberedList:n,onIndent:o,onOutdent:r,disabled:a=false,className:i,style:s,showIndentButtons:c=true,compact:l=false,hasIndent:d=false}){let{t:p}=_(),g=Ye.useCallback(()=>l?{..._1}:{},[l]),m=e?.type==="bullet",f=e?.type==="numbered",h=(e?.isInList||m||f)&&(e?.level??0)>0||d;return jsxRuntime.jsxs("div",{className:`docx-list-buttons ${i||""}`,style:{...M1,...s},role:"group","aria-label":p("lists.ariaLabel"),children:[jsxRuntime.jsxs("div",{style:ef,role:"group","aria-label":p("lists.typeAriaLabel"),children:[jsxRuntime.jsx(hi,{active:m,disabled:a,title:p("lists.bulletList"),onClick:t,style:g(),children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:bi})}),jsxRuntime.jsx(hi,{active:f,disabled:a,title:p("lists.numberedList"),onClick:n,style:g(),children:jsxRuntime.jsx(K,{name:"format_list_numbered",size:bi})})]}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:N1,role:"separator"}),jsxRuntime.jsxs("div",{style:ef,role:"group","aria-label":p("lists.indentationAriaLabel"),children:[jsxRuntime.jsx(hi,{active:false,disabled:a||!h,title:p("lists.decreaseIndent"),onClick:r,style:g(),children:jsxRuntime.jsx(K,{name:"format_indent_decrease",size:bi})}),jsxRuntime.jsx(hi,{active:false,disabled:a,title:p("lists.increaseIndent"),onClick:o,style:g(),children:jsxRuntime.jsx(K,{name:"format_indent_increase",size:bi})})]})]})]})}var L1=[{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 nf({value:e,onChange:t,options:n=L1,disabled:o=false,className:r}){let{t:a}=_(),i=Ye__namespace.useMemo(()=>e===void 0?n[0]:n.find(l=>l.twipsValue===e)||n[0],[e,n]),s=Ye__namespace.useCallback(l=>{let d=parseInt(l,10);isNaN(d)||t?.(d);},[t]),c=l=>l.labelKey?a(l.labelKey):l.label;return jsxRuntime.jsxs(qt,{value:i.twipsValue.toString(),onValueChange:s,disabled:o,children:[jsxRuntime.jsx(zt,{className:j("h-8 text-sm gap-0.5 px-2",r),style:{width:"auto"},"aria-label":a("lineSpacing.label"),title:a("lineSpacing.lineSpacingTitle",{label:c(i)}),children:jsxRuntime.jsx(ps,{className:"h-5 w-5 shrink-0"})}),jsxRuntime.jsxs(Vt,{children:[n.map(l=>jsxRuntime.jsx(et,{value:l.twipsValue.toString(),children:c(l)},l.twipsValue)),jsxRuntime.jsx(ho,{}),jsxRuntime.jsx(Kt,{children:jsxRuntime.jsx(bo,{children:a("lineSpacing.blockSpacingRules")})})]})]})}var H1={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14},F1=new Set(["Title","Heading1","Heading2","Heading3"]),A1={Subtitle:"666666"},O1="#4a6c8c";function rf(e){let t=H1[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??F1.has(e.styleId))&&(o.fontWeight="bold"),e.italic&&(o.fontStyle="italic");let r=e.color??A1[e.styleId];return r?o.color=`#${r}`:e.styleId.startsWith("Heading")&&(o.color=O1),o}function af(e){return !e||e.length===0?[]:e.filter(t=>t.type==="paragraph").map(t=>({styleId:t.styleId,name:t.name||t.styleId,priority:99}))}var lf=[{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 sf({value:e,onChange:t,styles:n,disabled:o=false,className:r,width:a=120}){let{t:i}=_(),s=Ye__namespace.useMemo(()=>{let m=af(n);return m.length===0?lf:m.map(f=>({...f,type:"paragraph",nameKey:lf.find(u=>u.styleId===f.styleId)?.nameKey}))},[n]),c=Ye__namespace.useCallback(m=>{t?.(m);},[t]),l=m=>m.nameKey?i(m.nameKey):m.name,d=e||"Normal",p=s.find(m=>m.styleId===d),g=p?l(p):d;return jsxRuntime.jsxs(qt,{value:d,onValueChange:c,disabled:o,children:[jsxRuntime.jsx(zt,{className:j("h-8 text-sm",r),style:{width:typeof a=="number"?`${a}px`:a},"aria-label":i("styles.selectAriaLabel"),children:jsxRuntime.jsx("span",{className:"truncate",children:g})}),jsxRuntime.jsx(Vt,{className:"min-w-[260px] max-h-[400px]",children:s.map(m=>jsxRuntime.jsx(et,{value:m.styleId,className:"py-2.5 px-3",children:jsxRuntime.jsx("span",{style:rf(m),children:l(m)})},m.styleId))})]})}var B1=[{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 df({value:e=1,onChange:t,levels:n=B1,disabled:o=false,className:r,compact:a=false}){let{t:i}=_(),s=Ye__namespace.useMemo(()=>{let m=n.find(f=>Math.abs(f.value-e)<.001);return m?m.label:`${Math.round(e*100)}%`},[n,e]),c=Ye__namespace.useCallback(m=>{let f=parseFloat(m);isNaN(f)||t?.(f);},[t]),l=Ye__namespace.useMemo(()=>[...n].sort((m,f)=>m.value-f.value),[n]),d=Ye__namespace.useMemo(()=>[...l].reverse().find(m=>m.value<e-.001),[l,e]),p=Ye__namespace.useMemo(()=>l.find(m=>m.value>e+.001),[l,e]),g=a?"h-7 w-7":"h-8 w-8";return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(we,{variant:"ghost",size:"icon-sm",className:j(g,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",(o||!d)&&"opacity-30 cursor-not-allowed"),onClick:()=>d&&t?.(d.value),disabled:o||!d,"aria-label":i("zoom.zoomOut"),children:jsxRuntime.jsx(K,{name:"remove",size:18})}),jsxRuntime.jsxs(qt,{value:e.toString(),onValueChange:c,disabled:o,children:[jsxRuntime.jsx(zt,{className:j(a?"h-7 min-w-[55px] text-xs":"h-8 min-w-[64px] text-sm","rounded-none",r),"aria-label":i("zoom.ariaLabel",{label:s}),children:jsxRuntime.jsx(ui,{placeholder:"100%",children:s})}),jsxRuntime.jsx(Vt,{children:n.map(m=>jsxRuntime.jsx(et,{value:m.value.toString(),children:m.label},m.value))})]}),jsxRuntime.jsx(we,{variant:"ghost",size:"icon-sm",className:j(g,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",(o||!p)&&"opacity-30 cursor-not-allowed"),onClick:()=>p&&t?.(p.value),disabled:o||!p,"aria-label":i("zoom.zoomIn"),children:jsxRuntime.jsx(K,{name:"add",size:18})})]})}var K1=[{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 mf({onAction:e,disabled:t=false}){let{t:n}=_(),[o,r]=Ye.useState(false),a=Ye.useCallback(()=>r(false),[]),{containerRef:i,dropdownRef:s,dropdownStyle:c,handleMouseDown:l}=$e({isOpen:o,onClose:a}),d=Ye.useCallback(g=>{e(g),r(false);},[e]),p=jsxRuntime.jsxs(we,{variant:"ghost",size:"icon-sm",className:j("text-muted-foreground hover:text-foreground hover:bg-muted/80",o&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:l,onClick:()=>!t&&r(g=>!g),disabled:t,"aria-label":n("table.borders.styleAriaLabel"),"aria-expanded":o,"aria-haspopup":"true","data-testid":"toolbar-table-borders",children:[jsxRuntime.jsx(K,{name:"border_all",size:20}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:i,style:{position:"relative",display:"inline-block"},children:[o?p:jsxRuntime.jsx(Je,{content:n("table.borders.tooltip"),children:p}),o&&!t&&jsxRuntime.jsx("div",{ref:s,style:{...c,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:g=>g.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:2},children:K1.map(({action:g,icon:m,labelKey:f})=>jsxRuntime.jsx("button",{type:"button",title:n(f),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:u=>u.preventDefault(),onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},onClick:()=>d(g),children:jsxRuntime.jsx(K,{name:m,size:18})},typeof g=="string"?g:g.type))})})]})}function ff({onAction:e,disabled:t=false,theme:n,value:o}){let{t:r}=_(),a=Ye.useCallback(i=>{if(typeof i=="string"){e({type:"borderColor",color:i.replace(/^#/,"")});return}let s=i.kind==="auto"?"000000":wt(i,n);s&&e({type:"borderColor",color:s});},[e,n]);return jsxRuntime.jsx(xo,{mode:"border",value:o,onChange:a,theme:n,disabled:t,title:r("table.borderColor")})}var W1=[{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 bf({onAction:e,disabled:t=false}){let[n,o]=Ye.useState(false),{t:r}=_(),a=Ye.useCallback(()=>o(false),[]),{containerRef:i,dropdownRef:s,dropdownStyle:c,handleMouseDown:l}=$e({isOpen:n,onClose:a}),d=Ye.useCallback(g=>{e({type:"borderWidth",size:g}),o(false);},[e]),p=jsxRuntime.jsxs(we,{variant:"ghost",size:"icon-sm",className:j("text-muted-foreground hover:text-foreground hover:bg-muted/80",n&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:l,onClick:()=>!t&&o(g=>!g),disabled:t,"aria-label":r("table.borderWidth"),"aria-expanded":n,"aria-haspopup":"true","data-testid":"toolbar-table-border-width",children:[jsxRuntime.jsx(K,{name:"line_weight",size:20}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:i,style:{position:"relative",display:"inline-block"},children:[n?p:jsxRuntime.jsx(Je,{content:r("table.borderWidth"),children:p}),n&&!t&&jsxRuntime.jsx("div",{ref:s,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:g=>g.stopPropagation(),children:W1.map(({size:g,label:m,thickness:f})=>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:u=>u.preventDefault(),onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},onClick:()=>d(g),children:[jsxRuntime.jsx("div",{style:{width:50,height:Math.max(f,1),backgroundColor:"#000",borderRadius:f>2?1:0}}),jsxRuntime.jsx("span",{children:m})]},g))})]})}function vf({onAction:e,disabled:t=false,theme:n,value:o}){let{t:r}=_(),a=Ye.useCallback(i=>{typeof i=="string"&&e(i==="none"?{type:"cellFillColor",color:null}:{type:"cellFillColor",color:i.replace(/^#/,"")});},[e]);return jsxRuntime.jsx("div",{"data-testid":"toolbar-table-cell-fill",style:{display:"inline-block"},children:jsxRuntime.jsx(xo,{mode:"highlight",value:o,onChange:a,theme:n,disabled:t,title:r("table.cellFillColor"),icon:"format_color_fill",autoLabel:r("colorPicker.noColor")})})}var G1={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"},Co={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},Tf={padding:"6px 14px 2px",fontSize:11,color:"var(--doc-text-muted)",fontWeight:500};function Sf({onAction:e,disabled:t=false,tableContext:n}){let{t:o}=_(),[r,a]=Ye.useState(false),[i,s]=Ye.useState(null),c=Ye.useCallback(()=>a(false),[]),{containerRef:l,dropdownRef:d,dropdownStyle:p,handleMouseDown:g}=$e({isOpen:r,onClose:c,align:"right"}),m=n?.table?.attrs?.justification??"left",f=Ye.useCallback(b=>{e(b),a(false);},[e]),u=(b,v,C,P,S)=>{let y=t||S?.itemDisabled;return jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{...G1,backgroundColor:i===b&&!y?"var(--doc-bg-hover)":"transparent",color:y?"var(--doc-text-muted)":S?.danger?"var(--doc-error)":"var(--doc-text)",cursor:y?"not-allowed":"pointer"},onClick:()=>!y&&f(P),onMouseEnter:()=>s(b),onMouseLeave:()=>s(null),disabled:y,children:[jsxRuntime.jsx(K,{name:v,size:16,className:S?.danger&&!y?"text-destructive":""}),jsxRuntime.jsx("span",{style:{flex:1},children:C})]},b)},h=jsxRuntime.jsx(we,{variant:"ghost",size:"icon-sm",className:j("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:g,onClick:()=>!t&&a(b=>!b),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:l,style:{position:"relative",display:"inline-block"},children:[r?h:jsxRuntime.jsx(Je,{content:o("table.moreOptions"),children:h}),r&&!t&&jsxRuntime.jsxs("div",{ref:d,style:{...p,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:"4px 0",minWidth:200,maxHeight:"70vh",overflowY:"auto"},role:"menu",onMouseDown:b=>b.stopPropagation(),children:[u("addRowAbove","add",o("table.insertRowAbove"),"addRowAbove"),u("addRowBelow","add",o("table.insertRowBelow"),"addRowBelow"),u("addColumnLeft","add",o("table.insertColumnLeft"),"addColumnLeft"),u("addColumnRight","add",o("table.insertColumnRight"),"addColumnRight"),jsxRuntime.jsx("div",{style:Co,role:"separator"}),u("mergeCells","call_merge",o("table.mergeCells"),"mergeCells",{itemDisabled:!n?.hasMultiCellSelection}),u("splitCell","call_split",o("table.splitCell"),"splitCell",{itemDisabled:!n?.canSplitCell}),jsxRuntime.jsx("div",{style:Co,role:"separator"}),u("selectTable","select_all",o("table.selectTable"),"selectTable"),jsxRuntime.jsx("div",{style:Co,role:"separator"}),u("deleteRow","delete",o("table.deleteRow"),"deleteRow",{danger:true,itemDisabled:(n?.rowCount??0)<=1}),u("deleteColumn","delete",o("table.deleteColumn"),"deleteColumn",{danger:true,itemDisabled:(n?.columnCount??0)<=1}),u("deleteTable","delete",o("table.deleteTable"),"deleteTable",{danger:true}),jsxRuntime.jsx("div",{style:Co,role:"separator"}),jsxRuntime.jsx("div",{style:Tf,children:o("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["top","center","bottom"].map(b=>{let v={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"}[b]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:"transparent",cursor:"pointer"},onMouseDown:P=>P.preventDefault(),onMouseEnter:P=>{P.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},onClick:()=>f({type:"cellVerticalAlign",align:b}),children:jsxRuntime.jsx(K,{name:v[b],size:16})},b)})}),jsxRuntime.jsx("div",{style:Co,role:"separator"}),jsxRuntime.jsx("div",{style:Tf,children:o("tableAdvanced.tableAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["left","center","right"].map(b=>{let v={left:"format_align_left",center:"format_align_center",right:"format_align_right"},C=m===b;return jsxRuntime.jsx("button",{type:"button",title:o({left:"tableAdvanced.alignTableLeft",center:"tableAdvanced.alignTableCenter",right:"tableAdvanced.alignTableRight"}[b]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:C?"var(--doc-primary-light)":"transparent",borderColor:C?"var(--doc-primary)":"var(--doc-border)",color:C?"var(--doc-primary)":"var(--doc-text)",cursor:"pointer"},onMouseDown:P=>P.preventDefault(),onClick:()=>f({type:"tableProperties",props:{justification:b}}),children:jsxRuntime.jsx(K,{name:v[b],size:16})},b)})}),jsxRuntime.jsx("div",{style:Co,role:"separator"}),u("headerRow","table_rows",o("tableAdvanced.toggleHeaderRow"),{type:"toggleHeaderRow"}),u("distribute","view_column",o("tableAdvanced.distributeColumns"),{type:"distributeColumns"}),u("autoFit","fit_width",o("tableAdvanced.autoFit"),{type:"autoFitContents"}),u("noWrap","wrap_text",o("tableAdvanced.toggleNoWrap"),{type:"toggleNoWrap"}),jsxRuntime.jsx("div",{style:Co,role:"separator"}),u("properties","settings",o("tableAdvanced.tableProperties"),{type:"openTableProperties"})]})]})}var X1=20;function Si({options:e,activeValue:t,triggerIcon:n,tooltipContent:o,onSelect:r,disabled:a=false,ariaLabel:i,testId:s,showLabels:c=false}){let[l,d]=Ye.useState(false),p=Ye.useCallback(()=>d(false),[]),{containerRef:g,dropdownRef:m,dropdownStyle:f,handleMouseDown:u}=$e({isOpen:l,onClose:p}),h=Ye.useCallback(v=>{a||r(v),d(false);},[a,r]),b=jsxRuntime.jsxs(we,{variant:"ghost",size:"icon-sm",className:j("text-muted-foreground hover:text-foreground hover:bg-muted/80",l&&"bg-muted",a&&"opacity-30 cursor-not-allowed"),onMouseDown:u,onClick:()=>!a&&d(v=>!v),disabled:a,"aria-label":i??o,"aria-expanded":l,"aria-haspopup":"true","data-testid":s,children:[jsxRuntime.jsx(K,{name:n,size:X1}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:g,style:{position:"relative",display:"inline-block"},children:[l?b:jsxRuntime.jsx(Je,{content:o,children:b}),l&&!a&&jsxRuntime.jsx("div",{ref:m,style:{...f,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:v=>v.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:c?"column":"row",gap:c?1:2,minWidth:c?200:void 0},children:e.map(v=>{let C=t===v.value;return jsxRuntime.jsxs("button",{type:"button",title:v.label,"data-testid":s?`${s}-${v.value}`:void 0,style:{display:"flex",alignItems:"center",height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:C?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:C?"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:P=>P.preventDefault(),onMouseEnter:P=>{C||(P.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:P=>{P.currentTarget.style.backgroundColor=C?"var(--doc-primary-light)":"transparent";},onClick:()=>h(v.value),children:[jsxRuntime.jsx(K,{name:v.iconName,size:18}),c&&jsxRuntime.jsx("span",{style:{flex:1},children:v.label})]},v.value)})})})]})}var j1=[{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 Q1(e){return e.displayMode==="float"&&e.cssFloat==="left"?"wrapRight":e.displayMode==="float"&&e.cssFloat==="right"?"wrapLeft":e.wrapType}function Pf({imageContext:e,onChange:t,disabled:n=false}){let{t:o}=_(),r=j1.map(s=>({...s,label:o(s.labelKey)})),a=Q1(e),i=r.find(s=>s.value===a)||r[0];return jsxRuntime.jsx(Si,{options:r,activeValue:a,triggerIcon:i.iconName,tooltipContent:`Wrap: ${i.label}`,onSelect:t,disabled:n,testId:"toolbar-image-wrap",showLabels:true})}var e2=[{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 Ef({onTransform:e,disabled:t=false}){let{t:n}=_(),o=e2.map(r=>({...r,label:n(r.labelKey)}));return jsxRuntime.jsx(Si,{options:o,triggerIcon:"rotate_right",tooltipContent:n("imageTransform.tooltip"),onSelect:e,disabled:t,testId:"toolbar-image-transform"})}var ct=18;function tt({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:a,ariaLabel:i}){let s=i?.toLowerCase().replace(/\s+/g,"-")||n?.toLowerCase().replace(/\s+/g,"-").replace(/\([^()]*\)/g,"").trim(),c=d=>{d.preventDefault();},l=jsxRuntime.jsx(we,{variant:"ghost",size:"icon-sm",className:j("docx-editor-toolbar-toggle text-muted-foreground",t&&"opacity-30 cursor-not-allowed",a),"data-active":e?"true":void 0,onMouseDown:c,onClick:t?void 0:o,"aria-disabled":t||void 0,tabIndex:t?-1:void 0,"aria-pressed":!!e,"aria-label":i||n,"data-testid":s?`toolbar-${s}`:void 0,children:r});return n?jsxRuntime.jsx(Je,{content:n,children:l}):l}function dt({label:e,children:t,className:n}){return jsxRuntime.jsx("div",{className:j("flex items-center gap-px px-1.5 border-r border-border/50 last:border-r-0 first:pl-0",n),role:"group","aria-label":e,children:t})}function a2(e){let t=Ye__namespace.default.useContext(Tr);return t?{...t,...i2(e)}:e}function i2(e){let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t}function cc(e){let{t}=_(),n=a2(e),{currentFormatting:o={},onFormat:r,onUndo:a,onRedo:i,canUndo:s=false,canRedo:c=false,disabled:l=false,className:d,style:p,enableShortcuts:g=true,editorRef:m,children:f,showFontPicker:u=true,fontFamilies:h,documentFonts:b,showFontSizePicker:v=true,showTextColorPicker:C=true,showHighlightColorPicker:P=true,showAlignmentButtons:S=true,showListButtons:y=true,showLineSpacingPicker:x=true,showStylePicker:M=true,documentStyles:E,theme:w,showZoomControl:N=true,zoom:F,onZoomChange:H,onRefocusEditor:I,imageContext:D,onImageWrapType:k,onImageTransform:R,onOpenImageProperties:z,tableContext:Z,onTableAction:$,inline:Q=false}=n,Me=Ye.useRef(null),se=Ye.useCallback(de=>{!l&&r&&r(de);},[l,r]),Te=Ye.useCallback(()=>{!l&&s&&a&&a();},[l,s,a]),Ce=Ye.useCallback(()=>{!l&&c&&i&&i();},[l,c,i]),G=Ye.useCallback(de=>{!l&&r&&r({type:"fontFamily",value:de});},[l,r]),B=Ye__namespace.default.useMemo(()=>Js(h),[h]),Pe=Ye.useCallback(de=>{!l&&r&&r({type:"fontSize",value:de});},[l,r]),Ue=Ye.useCallback(de=>{!l&&r&&r({type:"textColor",value:de});},[l,r]),ce=Ye.useCallback(de=>{!l&&r&&r({type:"highlightColor",value:typeof de=="string"?de:""});},[l,r]),Ge=Ye.useCallback(de=>{!l&&r&&r({type:"alignment",value:de});},[l,r]),rn=Ye.useCallback(()=>{!l&&r&&r("bulletList");},[l,r]),Eo=Ye.useCallback(()=>{!l&&r&&r("numberedList");},[l,r]),Mr=Ye.useCallback(()=>{!l&&r&&r("indent");},[l,r]),Hf=Ye.useCallback(()=>{!l&&r&&r("outdent");},[l,r]),Ff=Ye.useCallback(de=>{!l&&r&&(r({type:"lineSpacing",value:de}),requestAnimationFrame(()=>I?.()));},[l,r,I]),Af=Ye.useCallback(de=>{!l&&r&&r({type:"applyStyle",value:de});},[l,r]),an=Ye.useCallback(de=>{!l&&$&&($(de),requestAnimationFrame(()=>I?.()));},[l,$,I]);Ye.useEffect(()=>{if(!g)return;let de=ue=>{if(ue.defaultPrevented)return;let ln=ue.target,pc=m?.current,Bf=Me.current,qf=pc?.contains(ln),Kf=Bf?.contains(ln);if(!qf&&!Kf)return;if((ue.ctrlKey||ue.metaKey)&&!ue.altKey)switch(ue.key.toLowerCase()){case "b":ue.preventDefault(),se("bold");break;case "i":ue.preventDefault(),se("italic");break;case "u":ue.preventDefault(),se("underline");break;case "=":ue.shiftKey?(ue.preventDefault(),se("superscript")):(ue.preventDefault(),se("subscript"));break;case "l":ue.preventDefault(),Ge("left");break;case "e":ue.preventDefault(),Ge("center");break;case "r":ue.preventDefault(),Ge("right");break;case "j":ue.preventDefault(),Ge("both");break;case "k":ue.preventDefault(),se("insertLink");break}};return document.addEventListener("keydown",de),()=>{document.removeEventListener("keydown",de);}},[g,se,Ge,m]);let Of=Ye.useCallback(de=>{let ue=de.target;ue.tagName==="INPUT"||ue.tagName==="TEXTAREA"||ue.tagName==="SELECT"||ue.tagName==="OPTION"||de.preventDefault();},[]),Zf=Ye.useCallback(de=>{let ue=de.target,ln=document.activeElement;ue.tagName==="SELECT"||ue.tagName==="OPTION"||ln?.tagName==="SELECT"||requestAnimationFrame(()=>{I?.();});},[I]);return jsxRuntime.jsxs("div",{ref:Me,className:j(!Q&&"flex items-center px-2 py-1 bg-muted rounded-full min-h-[36px] overflow-x-auto mx-2 mb-1",d),style:Q?{display:"contents",...p}:p,role:Q?void 0:"toolbar","aria-label":Q?void 0:t("toolbar.ariaLabel"),"data-testid":Q?void 0:"formatting-bar",onMouseDown:Q?void 0:Of,onMouseUp:Q?void 0:Zf,children:[jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.history"),children:[jsxRuntime.jsx(tt,{onClick:Te,disabled:l||!s,title:t("formattingBar.undoShortcut"),ariaLabel:t("formattingBar.undo"),children:jsxRuntime.jsx(K,{name:"undo",size:ct})}),jsxRuntime.jsx(tt,{onClick:Ce,disabled:l||!c,title:t("formattingBar.redoShortcut"),ariaLabel:t("formattingBar.redo"),children:jsxRuntime.jsx(K,{name:"redo",size:ct})})]}),N&&jsxRuntime.jsx(dt,{label:t("formattingBar.groups.zoom"),children:jsxRuntime.jsx(df,{value:F,onChange:H,disabled:l,compact:true})}),M&&jsxRuntime.jsx(dt,{label:t("formattingBar.groups.styles"),children:jsxRuntime.jsx(sf,{value:o.styleId||"Normal",onChange:Af,styles:E,theme:w,disabled:l,width:120})}),(u||v)&&jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.font"),children:[u&&jsxRuntime.jsx(Zm,{value:o.fontFamily||"Arial",onChange:G,fonts:B,documentFonts:b,disabled:l,width:60,placeholder:"Arial"}),v&&jsxRuntime.jsx(Vm,{value:o.fontSize!==void 0?rs(o.fontSize):11,onChange:Pe,disabled:l,width:42,placeholder:"11"})]}),jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.textFormatting"),children:[jsxRuntime.jsx(tt,{onClick:()=>se("bold"),active:o.bold,disabled:l,title:t("formattingBar.boldShortcut"),ariaLabel:t("formattingBar.bold"),children:jsxRuntime.jsx(K,{name:"format_bold",size:ct})}),jsxRuntime.jsx(tt,{onClick:()=>se("italic"),active:o.italic,disabled:l,title:t("formattingBar.italicShortcut"),ariaLabel:t("formattingBar.italic"),children:jsxRuntime.jsx(K,{name:"format_italic",size:ct})}),jsxRuntime.jsx(tt,{onClick:()=>se("underline"),active:o.underline,disabled:l,title:t("formattingBar.underlineShortcut"),ariaLabel:t("formattingBar.underline"),children:jsxRuntime.jsx(K,{name:"format_underlined",size:ct})}),jsxRuntime.jsx(tt,{onClick:()=>se("strikethrough"),active:o.strike,disabled:l,title:t("formattingBar.strikethrough"),ariaLabel:t("formattingBar.strikethrough"),children:jsxRuntime.jsx(K,{name:"strikethrough_s",size:ct})}),C&&jsxRuntime.jsx(xo,{mode:"text",value:o.color?.replace(/^#/,""),onChange:Ue,theme:w,disabled:l,title:t("formattingBar.fontColor")}),P&&jsxRuntime.jsx(xo,{mode:"highlight",value:o.highlight,onChange:ce,theme:w,disabled:l,title:t("formattingBar.highlightColor")}),jsxRuntime.jsx(tt,{onClick:()=>se("insertLink"),disabled:l,title:t("formattingBar.insertLinkShortcut"),ariaLabel:t("formattingBar.insertLink"),children:jsxRuntime.jsx(K,{name:"link",size:ct})})]}),jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.script"),children:[jsxRuntime.jsx(tt,{onClick:()=>se("superscript"),active:o.superscript,disabled:l,title:t("formattingBar.superscriptShortcut"),ariaLabel:t("formattingBar.superscript"),children:jsxRuntime.jsx(K,{name:"superscript",size:ct})}),jsxRuntime.jsx(tt,{onClick:()=>se("subscript"),active:o.subscript,disabled:l,title:t("formattingBar.subscriptShortcut"),ariaLabel:t("formattingBar.subscript"),children:jsxRuntime.jsx(K,{name:"subscript",size:ct})})]}),S&&jsxRuntime.jsx(dt,{label:t("formattingBar.groups.alignment"),children:jsxRuntime.jsx(Jm,{value:o.alignment||"left",onChange:Ge,disabled:l})}),(y||x)&&jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.listFormatting"),children:[y&&jsxRuntime.jsx(tf,{listState:o.listState||gi(),onBulletList:rn,onNumberedList:Eo,onIndent:Mr,onOutdent:Hf,disabled:l,showIndentButtons:true,compact:true,hasIndent:(o.indentLeft??0)>0}),x&&jsxRuntime.jsx(nf,{value:o.lineSpacing,onChange:Ff,disabled:l})]}),D&&k&&jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.image"),children:[jsxRuntime.jsx(Pf,{imageContext:D,onChange:k,disabled:l}),R&&jsxRuntime.jsx(Ef,{onTransform:R,disabled:l}),z&&jsxRuntime.jsx(tt,{onClick:z,disabled:l,title:t("formattingBar.imagePropertiesShortcut"),ariaLabel:t("formattingBar.imageProperties"),children:jsxRuntime.jsx(K,{name:"tune",size:ct})})]}),Z?.isInTable&&$&&jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.table"),children:[jsxRuntime.jsx(mf,{onAction:an,disabled:l}),jsxRuntime.jsx(ff,{onAction:an,disabled:l,theme:w,value:wt(Z?.cellBorderColor,w)}),jsxRuntime.jsx(bf,{onAction:an,disabled:l}),jsxRuntime.jsx(vf,{onAction:an,disabled:l,theme:w,value:Z?.cellBackgroundColor}),jsxRuntime.jsx(Sf,{onAction:an,disabled:l,tableContext:Z})]}),jsxRuntime.jsx(tt,{onClick:()=>se("clearFormatting"),disabled:l,title:t("formattingBar.clearFormatting"),ariaLabel:t("formattingBar.clearFormatting"),children:jsxRuntime.jsx(K,{name:"format_clear",size:ct})}),f]})}function l2({children:e,className:t,style:n,...o}){return jsxRuntime.jsx(Tr.Provider,{value:o,children:jsxRuntime.jsx("div",{className:j("flex flex-col bg-doc-surface shadow-sm flex-shrink-0",t),style:{position:"relative",zIndex:Ve.toolbar,...n},"data-testid":"editor-toolbar",children:e})})}var We=l2;We.TitleBar=Xs;We.Logo=li;We.DocumentName=Ys;We.MenuBar=ci;We.TitleBarRight=si;We.Toolbar=cc;var d2=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"]]),u2=e=>{let t=/^#?([0-9a-fA-F]{6})$/.exec(e.trim());return t?t[1].toUpperCase():null};function p2({source:e,scale:t,measurer:n,documentName:o,onStateChange:r,onError:a,onSave:i,renderTitleBarLeft:s,renderTitleBarRight:c,ref:l,colorMode:d,onZoomChange:p,documentFontFamily:g,className:m}){let f=Ye.useRef(null),[u,h]=Ye.useState(null),[b,v]=Ye.useState({}),[C,P]=Ye.useState(null),S=Ye.useCallback(E=>{h(E);let w=f.current?.formatting();w&&v({bold:w.bold,italic:w.italic,underline:w.underline,strike:w.strikethrough,superscript:w.superscript,subscript:w.subscript,...w.fontFamily?{fontFamily:w.fontFamily}:{},...w.fontSizeHalfPoints?{fontSize:w.fontSizeHalfPoints}:{},...w.alignment?{alignment:w.alignment}:{},...w.styleId?{styleId:w.styleId}:{},...w.color?{color:`#${w.color}`}:{},...w.highlight?{highlight:w.highlight}:{}}),P(f.current?.sectionProperties()??null),r?.(E);},[r]),y=Ye.useCallback(E=>{let w=f.current;if(w){if(typeof E=="string")switch(E){case "bold":return w.toggleRunProperty("b");case "italic":return w.toggleRunProperty("i");case "underline":return w.toggleRunProperty("u",{val:"single"});case "strikethrough":return w.toggleRunProperty("strike");case "superscript":return w.setRunProperty("vertAlign",{val:"superscript"});case "subscript":return w.setRunProperty("vertAlign",{val:"subscript"});case "clearFormatting":w.setRunProperty("b",{val:"0"}),w.setRunProperty("i",{val:"0"}),w.setRunProperty("u",{val:"none"}),w.setRunProperty("strike",{val:"0"}),w.setRunProperty("vertAlign",{val:"baseline"});return;default:return}switch(E.type){case "fontFamily":return w.setRunProperty("rFonts",{ascii:E.value,hAnsi:E.value});case "fontSize":return w.setRunProperty("sz",{val:String(Math.round(E.value*2))});case "textColor":{let N=E.value,F=typeof N=="string"?u2(N):wt(N,null)??null;return F?w.setRunProperty("color",{val:F}):void 0}case "highlightColor":{let N=E.value.trim().toLowerCase();if(N==="none"||N==="")return w.setRunProperty("highlight",{val:"none"});let F=d2.get(N.startsWith("#")?N:`#${N}`);return F?w.setRunProperty("highlight",{val:F}):void 0}case "alignment":return w.setParagraphProperty("jc",{val:String(E.value)});case "lineSpacing":return w.setParagraphProperty("spacing",{line:String(Math.round(E.value)),lineRule:"auto"});case "applyStyle":return w.setParagraphProperty("pStyle",{val:E.value});default:return}}},[]);Ye.useImperativeHandle(l,()=>f.current,[]);let x=t===void 0?1:t/(96/72),M=C?{pageWidthTwips:C.pageSize.widthTwips,pageHeightTwips:C.pageSize.heightTwips,orientation:C.landscape?"landscape":"portrait",marginsTwips:{top:C.margins.topTwips,right:C.margins.rightTwips,bottom:C.margins.bottomTwips,left:C.margins.leftTwips}}:null;return jsxRuntime.jsxs("div",{className:["docx-editor docx-paginated-shell",d==="dark"?"dark":"",m??""].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(We,{currentFormatting:b,onFormat:y,onUndo:()=>f.current?.undo(),onRedo:()=>f.current?.redo(),canUndo:u?.canUndo??false,canRedo:u?.canRedo??false,zoom:x,onZoomChange:p,onSave:()=>{let E=f.current?.save();E&&i?.(E);},children:[jsxRuntime.jsxs(We.TitleBar,{children:[s&&jsxRuntime.jsx(We.Logo,{children:s()}),jsxRuntime.jsx(We.DocumentName,{value:o??"Document",editable:false}),c&&jsxRuntime.jsx(We.TitleBarRight,{children:c()}),jsxRuntime.jsx(We.MenuBar,{})]}),jsxRuntime.jsx(We.Toolbar,{})]}),jsxRuntime.jsxs("div",{className:"docx-editor__scroll-container",style:{flex:1,minHeight:0,overflow:"auto",background:"var(--doc-bg)"},children:[M?jsxRuntime.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"4px 0"},children:jsxRuntime.jsx(ao,{pageSetup:M,zoom:x})}):null,jsxRuntime.jsx(Vs,{ref:f,source:e,...g?{documentFontFamily:g}:{},...t===void 0?{}:{scale:t},...n?{measurer:n}:{},onStateChange:S,...a?{onError:a}:{}})]})]})}var Pi=class{constructor(t){nt(this,"listeners",new Set);nt(this,"snapshot");nt(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t);}));nt(this,"getSnapshot",()=>this.snapshot);this.snapshot=t;}setSnapshot(t){this.snapshot=t,this.notify();}notify(){for(let t of this.listeners)t();}};var Ei=class extends Pi{constructor(){super({notifications:[]});nt(this,"notifications",[]);nt(this,"idCounter",0);nt(this,"timers",new Set);}showError(n,o){return this.addNotification(n,"error",o)}showWarning(n,o){return this.addNotification(n,"warning",o)}showInfo(n,o){return this.addNotification(n,"info",o)}dismiss(n){this.notifications=this.notifications.map(r=>r.id===n?{...r,dismissed:true}:r),this.emitSnapshot();let o=setTimeout(()=>{this.timers.delete(o),this.notifications=this.notifications.filter(r=>r.id!==n),this.emitSnapshot();},300);this.timers.add(o);}clearAll(){this.notifications=[];for(let n of this.timers)clearTimeout(n);this.timers.clear(),this.emitSnapshot();}destroy(){for(let n of this.timers)clearTimeout(n);this.timers.clear(),this.notifications=[];}addNotification(n,o,r){let a=`error-${++this.idCounter}-${Date.now()}`,i={id:a,message:n,severity:o,details:r,timestamp:Date.now()};if(this.notifications=[...this.notifications,i],this.emitSnapshot(),o!=="error"){let s=setTimeout(()=>{this.timers.delete(s),this.dismiss(a);},5e3);this.timers.add(s);}return a}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};var v2=Ye.createContext(null);function Rf({children:e}){let t=Ye.useMemo(()=>new Ei,[]),n=Ye.useSyncExternalStore(t.subscribe,t.getSnapshot),o=Ye.useCallback((l,d)=>{t.showError(l,d);},[t]),r=Ye.useCallback((l,d)=>{t.showWarning(l,d);},[t]),a=Ye.useCallback((l,d)=>{t.showInfo(l,d);},[t]),i=Ye.useCallback(l=>{t.dismiss(l);},[t]),s=Ye.useCallback(()=>{t.clearAll();},[t]),c=Ye.useMemo(()=>({notifications:n.notifications,showError:o,showWarning:r,showInfo:a,dismissNotification:i,clearNotifications:s}),[n.notifications,o,r,a,i,s]);return jsxRuntime.jsxs(v2.Provider,{value:c,children:[e,jsxRuntime.jsx(y2,{notifications:n.notifications,onDismiss:i})]})}function y2({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(x2,{notification:r,onDismiss:()=>t(r.id)},r.id))})}function x2({notification:e,onDismiss:t}){let{t:n}=_(),[o,r]=Ye.useState(false),i=(u=>{switch(u){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),s={background:i.bg,border:`1px solid ${i.border}`,borderRadius:"8px",padding:"12px 16px",boxShadow:"0 2px 8px var(--doc-shadow)",animation:"slideIn 0.3s ease-out"},c={display:"flex",alignItems:"flex-start",gap:"8px"},l={color:i.icon,flexShrink:0},d={flex:1,minWidth:0},p={color:i.text,fontSize:"14px",fontWeight:500,wordBreak:"break-word"},g={marginTop:"8px",padding:"8px",background:"var(--doc-shadow-subtle)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word",color:i.text,maxHeight:"200px",overflow:"auto"},m={background:"transparent",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:i.text},f=u=>{switch(u){case "error":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 6v5M10 13v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "warning":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("path",{d:"M10 3L18 17H2L10 3z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M10 8v4M10 14v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "info":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 9v5M10 6v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}};return jsxRuntime.jsxs("div",{className:`docx-notification-toast docx-notification-${e.severity}`,style:s,children:[jsxRuntime.jsx("style",{children:`
3
3
  @keyframes slideIn {
4
4
  from {
5
5
  opacity: 0;
@@ -10,9 +10,9 @@
10
10
  transform: translateX(0);
11
11
  }
12
12
  }
13
- `}),jsxRuntime.jsxs("div",{style:c,children:[jsxRuntime.jsx("span",{style:l,children:g(e.severity)}),jsxRuntime.jsxs("div",{style:d,children:[jsxRuntime.jsx("div",{style:p,children:e.message}),e.details&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>r(!o),style:{...m,marginTop:"4px",fontSize:"12px",padding:"2px 8px"},children:n(o?"errors.hideDetails":"errors.showDetails")}),o&&jsxRuntime.jsx("div",{style:f,children:e.details})]})]}),jsxRuntime.jsx("button",{type:"button",onClick:t,style:m,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 Pi=class extends Ye.Component{constructor(n){super(n);nt(this,"resetError",()=>{this.setState({hasError:false,error:null,errorInfo:null});});this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(n){return {hasError:true,error:n}}componentDidCatch(n,o){this.setState({errorInfo:o}),console.error("ErrorBoundary caught an error:",n,o),this.props.onError&&this.props.onError(n,o);}render(){if(this.state.hasError){let{fallback:n,showDetails:o=true}=this.props,{error:r,errorInfo:a}=this.state;return n?typeof n=="function"?n(r,this.resetError):n:jsxRuntime.jsx(x2,{error:r,errorInfo:a,showDetails:o,onReset:this.resetError})}return this.props.children}};function x2({error:e,errorInfo:t,showDetails:n,onReset:o}){let{t:r}=_(),a={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"40px",textAlign:"center",minHeight:"200px",background:"var(--doc-surface)",borderRadius:"8px",border:"1px solid var(--doc-border)",margin:"20px"},i={color:"var(--doc-error)",marginBottom:"16px"},s={fontSize:"18px",fontWeight:600,color:"var(--doc-text)",marginBottom:"8px"},c={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"16px",maxWidth:"400px"},l={width:"100%",maxWidth:"600px",marginBottom:"16px",padding:"12px",background:"var(--doc-error-bg)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:"200px",overflow:"auto"},d={padding:"10px 20px",background:"var(--doc-primary)",color:"var(--doc-on-primary)",border:"none",borderRadius:"4px",fontSize:"14px",cursor:"pointer"};return jsxRuntime.jsxs("div",{className:"docx-error-fallback",style:a,children:[jsxRuntime.jsx("div",{style:i,children:jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"currentColor",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M24 14v12M24 30v2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),jsxRuntime.jsx("h2",{style:s,children:r("errors.somethingWentWrong")}),jsxRuntime.jsx("p",{style:c,children:r("errors.errorDescription")}),n&&jsxRuntime.jsxs("div",{style:l,children:[jsxRuntime.jsx("strong",{children:r("errors.errorLabel")})," ",e.message,t&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[`
13
+ `}),jsxRuntime.jsxs("div",{style:c,children:[jsxRuntime.jsx("span",{style:l,children:f(e.severity)}),jsxRuntime.jsxs("div",{style:d,children:[jsxRuntime.jsx("div",{style:p,children:e.message}),e.details&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>r(!o),style:{...m,marginTop:"4px",fontSize:"12px",padding:"2px 8px"},children:n(o?"errors.hideDetails":"errors.showDetails")}),o&&jsxRuntime.jsx("div",{style:g,children:e.details})]})]}),jsxRuntime.jsx("button",{type:"button",onClick:t,style:m,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 wi=class extends Ye.Component{constructor(n){super(n);nt(this,"resetError",()=>{this.setState({hasError:false,error:null,errorInfo:null});});this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(n){return {hasError:true,error:n}}componentDidCatch(n,o){this.setState({errorInfo:o}),console.error("ErrorBoundary caught an error:",n,o),this.props.onError&&this.props.onError(n,o);}render(){if(this.state.hasError){let{fallback:n,showDetails:o=true}=this.props,{error:r,errorInfo:a}=this.state;return n?typeof n=="function"?n(r,this.resetError):n:jsxRuntime.jsx(T2,{error:r,errorInfo:a,showDetails:o,onReset:this.resetError})}return this.props.children}};function T2({error:e,errorInfo:t,showDetails:n,onReset:o}){let{t:r}=_(),a={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"40px",textAlign:"center",minHeight:"200px",background:"var(--doc-surface)",borderRadius:"8px",border:"1px solid var(--doc-border)",margin:"20px"},i={color:"var(--doc-error)",marginBottom:"16px"},s={fontSize:"18px",fontWeight:600,color:"var(--doc-text)",marginBottom:"8px"},c={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"16px",maxWidth:"400px"},l={width:"100%",maxWidth:"600px",marginBottom:"16px",padding:"12px",background:"var(--doc-error-bg)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:"200px",overflow:"auto"},d={padding:"10px 20px",background:"var(--doc-primary)",color:"var(--doc-on-primary)",border:"none",borderRadius:"4px",fontSize:"14px",cursor:"pointer"};return jsxRuntime.jsxs("div",{className:"docx-error-fallback",style:a,children:[jsxRuntime.jsx("div",{style:i,children:jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"currentColor",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M24 14v12M24 30v2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),jsxRuntime.jsx("h2",{style:s,children:r("errors.somethingWentWrong")}),jsxRuntime.jsx("p",{style:c,children:r("errors.errorDescription")}),n&&jsxRuntime.jsxs("div",{style:l,children:[jsxRuntime.jsx("strong",{children:r("errors.errorLabel")})," ",e.message,t&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[`
14
14
 
15
- `,jsxRuntime.jsx("strong",{children:r("errors.componentStack")}),t.componentStack]})]}),jsxRuntime.jsx("button",{type:"button",onClick:o,style:d,children:r("errors.tryAgain")})]})}function Nf({onClick:e,topPx:t,scrollLeft:n=0,leftOffset:o=tr}){let{t:r}=_();return jsxRuntime.jsx("button",{className:"docx-outline-toggle",onClick:e,onMouseDown:a=>a.stopPropagation(),title:r("editor.showDocumentOutline"),"aria-label":r("editor.showDocumentOutline"),style:{position:"absolute",left:o-n,top:t,zIndex:Ve.outline},children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:20})})}function dc({currentPage:e,totalPages:t,visible:n}){let{t:o}=_();return jsxRuntime.jsx("div",{style:{position:"absolute",right:24,top:"50%",transform:"translateY(-50%)",backgroundColor:"var(--doc-overlay)",color:"#fff",padding:"6px 12px",borderRadius:"4px",fontSize:"12px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontWeight:500,whiteSpace:"nowrap",pointerEvents:"none",zIndex:1e3,opacity:n?1:0,transition:"opacity 0.3s ease",userSelect:"none"},"aria-live":"polite",role:"status",children:o("viewer.pageIndicator",{current:e,total:t})})}function S2({i18n:e,isDark:t,onEditorError:n,containerRef:o,scrollContainerRef:r,editorContentRef:a,className:i,containerStyle:s,mainContentStyle:c,editorContainerStyle:l,showRuler:d,readOnlyProp:p,showOutline:f,showOutlineButton:m,sidebarOpen:g,minLayoutWidth:u,toolbarHeight:h,editorScrollLeft:b,expandedSidebarItem:v,trackedChanges:C,onScrollContainerMouseDown:P,onEditorBgMouseDown:S,onEditorContextMenu:y,horizontalRulerProps:x,verticalRulerProps:M,outlineProps:E,onToggleOutline:w,scrollPageInfo:N,toolbar:F,pagedArea:H,overlays:k,dialogs:D,fileInputs:I}){return jsxRuntime.jsx(Qt.Provider,{value:true,children:jsxRuntime.jsx(wo,{i18n:e,children:jsxRuntime.jsx(kf,{children:jsxRuntime.jsx(Pi,{onError:n,children:jsxRuntime.jsxs("div",{ref:o,className:j("docx-editor",t&&"dark",i),style:s,"data-testid":"docx-editor",children:[jsxRuntime.jsx("div",{style:c,children:jsxRuntime.jsxs("div",{style:{position:"relative",flex:1,minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[F,jsxRuntime.jsxs("div",{ref:r,className:"docx-editor__scroll-container",style:l,onMouseDown:P,children:[d&&jsxRuntime.jsx("div",{className:"flex justify-center py-1 flex-shrink-0 bg-doc-bg",style:{position:"sticky",top:0,zIndex:Ve.ruler,paddingLeft:20,paddingRight:20+(g?352:0),minWidth:u,transition:"padding 0.2s ease"},children:jsxRuntime.jsx(ao,{...x})}),jsxRuntime.jsx("div",{style:{display:"flex",flex:1,minHeight:0,position:"relative",minWidth:u},children:jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",flex:1,minWidth:0},onMouseDown:S,onContextMenu:y,children:[d&&!p&&jsxRuntime.jsx("div",{style:{position:"absolute",left:0,top:0,zIndex:Ve.ruler,paddingTop:48},children:jsxRuntime.jsx(er,{...M})}),v&&v.startsWith("comment-")&&jsxRuntime.jsx("style",{children:`.paged-editor__pages [data-comment-id="${v.replace("comment-","")}"] { background-color: var(--doc-comment-active-bg) !important; border-bottom-width: 2px !important; border-bottom-style: solid !important; border-bottom-color: var(--doc-comment-active-border) !important; }`}),v?.startsWith("tc-")&&(()=>{let R=v.split("-")[1],Z=C.find($=>String($.id)===R)?.id??R;return jsxRuntime.jsx("style",{children:`
15
+ `,jsxRuntime.jsx("strong",{children:r("errors.componentStack")}),t.componentStack]})]}),jsxRuntime.jsx("button",{type:"button",onClick:o,style:d,children:r("errors.tryAgain")})]})}function Df({onClick:e,topPx:t,scrollLeft:n=0,leftOffset:o=tr}){let{t:r}=_();return jsxRuntime.jsx("button",{className:"docx-outline-toggle",onClick:e,onMouseDown:a=>a.stopPropagation(),title:r("editor.showDocumentOutline"),"aria-label":r("editor.showDocumentOutline"),style:{position:"absolute",left:o-n,top:t,zIndex:Ve.outline},children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:20})})}function uc({currentPage:e,totalPages:t,visible:n}){let{t:o}=_();return jsxRuntime.jsx("div",{style:{position:"absolute",right:24,top:"50%",transform:"translateY(-50%)",backgroundColor:"var(--doc-overlay)",color:"#fff",padding:"6px 12px",borderRadius:"4px",fontSize:"12px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontWeight:500,whiteSpace:"nowrap",pointerEvents:"none",zIndex:1e3,opacity:n?1:0,transition:"opacity 0.3s ease",userSelect:"none"},"aria-live":"polite",role:"status",children:o("viewer.pageIndicator",{current:e,total:t})})}function C2({i18n:e,isDark:t,onEditorError:n,containerRef:o,scrollContainerRef:r,editorContentRef:a,className:i,containerStyle:s,mainContentStyle:c,editorContainerStyle:l,showRuler:d,readOnlyProp:p,showOutline:g,showOutlineButton:m,sidebarOpen:f,minLayoutWidth:u,toolbarHeight:h,editorScrollLeft:b,expandedSidebarItem:v,trackedChanges:C,onScrollContainerMouseDown:P,onEditorBgMouseDown:S,onEditorContextMenu:y,horizontalRulerProps:x,verticalRulerProps:M,outlineProps:E,onToggleOutline:w,scrollPageInfo:N,toolbar:F,pagedArea:H,overlays:I,dialogs:D,fileInputs:k}){return jsxRuntime.jsx(Qt.Provider,{value:true,children:jsxRuntime.jsx(wo,{i18n:e,children:jsxRuntime.jsx(Rf,{children:jsxRuntime.jsx(wi,{onError:n,children:jsxRuntime.jsxs("div",{ref:o,className:j("docx-editor",t&&"dark",i),style:s,"data-testid":"docx-editor",children:[jsxRuntime.jsx("div",{style:c,children:jsxRuntime.jsxs("div",{style:{position:"relative",flex:1,minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[F,jsxRuntime.jsxs("div",{ref:r,className:"docx-editor__scroll-container",style:l,onMouseDown:P,children:[d&&jsxRuntime.jsx("div",{className:"flex justify-center py-1 flex-shrink-0 bg-doc-bg",style:{position:"sticky",top:0,zIndex:Ve.ruler,paddingLeft:20,paddingRight:20+(f?352:0),minWidth:u,transition:"padding 0.2s ease"},children:jsxRuntime.jsx(ao,{...x})}),jsxRuntime.jsx("div",{style:{display:"flex",flex:1,minHeight:0,position:"relative",minWidth:u},children:jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",flex:1,minWidth:0},onMouseDown:S,onContextMenu:y,children:[d&&!p&&jsxRuntime.jsx("div",{style:{position:"absolute",left:0,top:0,zIndex:Ve.ruler,paddingTop:48},children:jsxRuntime.jsx(er,{...M})}),v&&v.startsWith("comment-")&&jsxRuntime.jsx("style",{children:`.paged-editor__pages [data-comment-id="${v.replace("comment-","")}"] { background-color: var(--doc-comment-active-bg) !important; border-bottom-width: 2px !important; border-bottom-style: solid !important; border-bottom-color: var(--doc-comment-active-border) !important; }`}),v?.startsWith("tc-")&&(()=>{let R=v.split("-")[1],Z=C.find($=>String($.id)===R)?.id??R;return jsxRuntime.jsx("style",{children:`
16
16
  .paged-editor__pages .docx-insertion[data-revision-id="${Z}"] { background-color: rgba(52, 168, 83, 0.2) !important; border-bottom: 2px solid #2e7d32 !important; }
17
17
  .paged-editor__pages .docx-deletion[data-revision-id="${Z}"] { background-color: rgba(211, 47, 47, 0.2) !important; text-decoration-thickness: 2px !important; }
18
- `})})(),H]})})]}),N.totalPages>1&&jsxRuntime.jsx(dc,{currentPage:N.currentPage,totalPages:N.totalPages,visible:N.visible}),f&&jsxRuntime.jsx(Na,{...E,leftOffset:_a+(d?Bo:0)}),m&&!f&&jsxRuntime.jsx(Nf,{onClick:w,topPx:h+(d?30:0)+48,scrollLeft:b,leftOffset:tr+(d?Bo:0)})]})}),k,D,I]})})})})})}function k2(e){let[t,n]=Ye.useState(0);return Ye.useEffect(()=>{if(!e)return;let o=()=>n(i=>i+1),r=e.on("change",o),a=e.on("selectionChange",o);return o(),()=>{r(),a();}},[e]),t}var sH="0.0.2";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,"MAX_RESOLVER_FAMILIES",{enumerable:true,get:function(){return editor.MAX_RESOLVER_FAMILIES}});Object.defineProperty(exports,"PX_PER_CM",{enumerable:true,get:function(){return editor.PX_PER_CM}});Object.defineProperty(exports,"PX_PER_INCH",{enumerable:true,get:function(){return editor.PX_PER_INCH}});Object.defineProperty(exports,"WORD_DEFAULT_FONT",{enumerable:true,get:function(){return editor.WORD_DEFAULT_FONT}});Object.defineProperty(exports,"chromeMenuSlots",{enumerable:true,get:function(){return editor.chromeMenuSlots}});Object.defineProperty(exports,"commandForSlot",{enumerable:true,get:function(){return editor.commandForSlot}});Object.defineProperty(exports,"composeFontConfiguration",{enumerable:true,get:function(){return editor.composeFontConfiguration}});Object.defineProperty(exports,"createFontSource",{enumerable:true,get:function(){return editor.createFontSource}});Object.defineProperty(exports,"generateRulerTicks",{enumerable:true,get:function(){return editor.generateRulerTicks}});Object.defineProperty(exports,"loadFonts",{enumerable:true,get:function(){return editor.loadFonts}});Object.defineProperty(exports,"rulerPageBox",{enumerable:true,get:function(){return editor.rulerPageBox}});Object.defineProperty(exports,"runToolbarCommand",{enumerable:true,get:function(){return editor.runToolbarCommand}});Object.defineProperty(exports,"toolbarCommandState",{enumerable:true,get:function(){return editor.toolbarCommandState}});Object.defineProperty(exports,"EditorFontError",{enumerable:true,get:function(){return editor$1.EditorFontError}});exports.CONTENT_CONTROL_SLOTS=Be;exports.ContextMenuCellVerticalAlignment=fo;exports.ContextMenuCopy=fr;exports.ContextMenuCut=mr;exports.ContextMenuDelete=gr;exports.ContextMenuDeleteTable=Jo;exports.ContextMenuDeleteTableColumn=Qo;exports.ContextMenuDeleteTableRow=jo;exports.ContextMenuInsertColumnLeft=Yo;exports.ContextMenuInsertColumnRight=Xo;exports.ContextMenuInsertRowAbove=Uo;exports.ContextMenuInsertRowBelow=Go;exports.ContextMenuItem=Qa;exports.ContextMenuPaste=Wo;exports.ContextMenuSelectAll=br;exports.DocumentName=Gs;exports.DocxEditor=YC;exports.DocxEditorContent=Fr;exports.DocxEditorContentControl=oi;exports.DocxEditorContextMenu=vr;exports.DocxEditorDocumentOutline=ms;exports.DocxEditorFontNotice=Ba;exports.DocxEditorHeaderFooterChrome=za;exports.DocxEditorHorizontalRuler=ka;exports.DocxEditorHyperLink=$a;exports.DocxEditorImagePropertiesDialog=sl;exports.DocxEditorLoading=Ai;exports.DocxEditorLoadingSpinner=Fi;exports.DocxEditorMenu=jn;exports.DocxEditorNavigation=xs;exports.DocxEditorNotesChrome=Wa;exports.DocxEditorPageSetupDialog=Vn;exports.DocxEditorRoot=qr;exports.DocxEditorShell=S2;exports.DocxEditorToolbar=zn;exports.DocxEditorVerticalRuler=Ra;exports.DocxEditorViewport=zr;exports.HorizontalRuler=ao;exports.ImageAltText=Qr;exports.ImageInsertProvider=Nr;exports.ImageInsertTrigger=Dr;exports.ImagePropertiesTrigger=oa;exports.ImageWrap=jr;exports.LocaleProvider=wo;exports.Logo=ai;exports.MenuBar=li;exports.NAVIGATION_PANE_GAP=Lp;exports.NAVIGATION_PANE_INSET=Da;exports.NAVIGATION_PANE_WIDTH=qo;exports.NavigationClose=rr;exports.NavigationFind=cr;exports.NavigationHeader=nr;exports.NavigationHeadings=sr;exports.NavigationTab=lr;exports.NavigationTabs=ir;exports.NavigationTitle=ar;exports.NavigationToggle=dr;exports.PageIndicator=dc;exports.PaginatedDocxEditor=zs;exports.PaginatedDocxEditorShell=u2;exports.RULER_WIDTH=Bo;exports.ReviewRailContext=St;exports.SEARCH_DEBOUNCE_MS=hs;exports.SEARCH_MATCH_LIMIT=vs;exports.Slot=W;exports.TitleBar=Ys;exports.TitleBarRight=ii;exports.Toolbar=sc;exports.ToolbarButton=tt;exports.ToolbarGroup=dt;exports.VERSION=sH;exports.VerticalRuler=er;exports.navigationPaneReservation=Ko;exports.navigationShift=La;exports.normalizeImageBytes=kr;exports.useChromeTranslate=Tc;exports.useContentControl=pt;exports.useContentControlInstance=Zr;exports.useContextMenuTarget=Jp;exports.useDocumentOutline=Ha;exports.useDocumentSearch=Fa;exports.useDocxEditor=A;exports.useDocxSource=eP;exports.useEditorCaret=sP;exports.useEditorCommand=ne;exports.useEditorEvent=Dl;exports.useEditorSnapshot=k2;exports.useEditorState=q;exports.useEditorValueCommand=xn;exports.useFontFamily=ia;exports.useFonts=rP;exports.useHeaderFooterState=Ps;exports.useHyperlinkPopup=Zi;exports.useHyperlinkPopupInstance=Or;exports.useNavigationPane=Oa;exports.useNavigationShift=Ro;exports.useNotePropertiesState=Fs;exports.useNoteScopeState=Hs;exports.usePageSetup=eo;exports.useParagraphIndent=ss;exports.useParagraphStyle=la;exports.useTableBorderTargetLabel=Hu;exports.useTranslation=_;exports.useZoom=ul;
18
+ `})})(),H]})})]}),N.totalPages>1&&jsxRuntime.jsx(uc,{currentPage:N.currentPage,totalPages:N.totalPages,visible:N.visible}),g&&jsxRuntime.jsx(La,{...E,leftOffset:Da+(d?Bo:0)}),m&&!g&&jsxRuntime.jsx(Df,{onClick:w,topPx:h+(d?30:0)+48,scrollLeft:b,leftOffset:tr+(d?Bo:0)})]})}),I,D,k]})})})})})}function R2(e){let[t,n]=Ye.useState(0);return Ye.useEffect(()=>{if(!e)return;let o=()=>n(i=>i+1),r=e.on("change",o),a=e.on("selectionChange",o);return o(),()=>{r(),a();}},[e]),t}var cH="0.0.2";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,"MAX_RESOLVER_FAMILIES",{enumerable:true,get:function(){return editor.MAX_RESOLVER_FAMILIES}});Object.defineProperty(exports,"PX_PER_CM",{enumerable:true,get:function(){return editor.PX_PER_CM}});Object.defineProperty(exports,"PX_PER_INCH",{enumerable:true,get:function(){return editor.PX_PER_INCH}});Object.defineProperty(exports,"WORD_DEFAULT_FONT",{enumerable:true,get:function(){return editor.WORD_DEFAULT_FONT}});Object.defineProperty(exports,"chromeMenuSlots",{enumerable:true,get:function(){return editor.chromeMenuSlots}});Object.defineProperty(exports,"commandForSlot",{enumerable:true,get:function(){return editor.commandForSlot}});Object.defineProperty(exports,"composeFontConfiguration",{enumerable:true,get:function(){return editor.composeFontConfiguration}});Object.defineProperty(exports,"createFontSource",{enumerable:true,get:function(){return editor.createFontSource}});Object.defineProperty(exports,"generateRulerTicks",{enumerable:true,get:function(){return editor.generateRulerTicks}});Object.defineProperty(exports,"loadFonts",{enumerable:true,get:function(){return editor.loadFonts}});Object.defineProperty(exports,"rulerPageBox",{enumerable:true,get:function(){return editor.rulerPageBox}});Object.defineProperty(exports,"runToolbarCommand",{enumerable:true,get:function(){return editor.runToolbarCommand}});Object.defineProperty(exports,"toolbarCommandState",{enumerable:true,get:function(){return editor.toolbarCommandState}});Object.defineProperty(exports,"EditorFontError",{enumerable:true,get:function(){return editor$1.EditorFontError}});exports.CONTENT_CONTROL_SLOTS=Be;exports.ContextMenuCellVerticalAlignment=fo;exports.ContextMenuCopy=fr;exports.ContextMenuCut=mr;exports.ContextMenuDelete=gr;exports.ContextMenuDeleteTable=Jo;exports.ContextMenuDeleteTableColumn=Qo;exports.ContextMenuDeleteTableRow=jo;exports.ContextMenuInsertColumnLeft=Yo;exports.ContextMenuInsertColumnRight=Xo;exports.ContextMenuInsertRowAbove=Uo;exports.ContextMenuInsertRowBelow=Go;exports.ContextMenuItem=ei;exports.ContextMenuPaste=Wo;exports.ContextMenuSelectAll=br;exports.DocumentName=Ys;exports.DocxEditor=XC;exports.DocxEditorContent=Fr;exports.DocxEditorContentControl=ri;exports.DocxEditorContextMenu=vr;exports.DocxEditorDocumentOutline=fs;exports.DocxEditorFontNotice=Ka;exports.DocxEditorHeaderFooterChrome=$a;exports.DocxEditorHorizontalRuler=_a;exports.DocxEditorHyperLink=Ua;exports.DocxEditorImagePropertiesDialog=cl;exports.DocxEditorLoading=Or;exports.DocxEditorLoadingSpinner=Oi;exports.DocxEditorMenu=jn;exports.DocxEditorNavigation=Ts;exports.DocxEditorNotesChrome=Ga;exports.DocxEditorPageSetupDialog=Vn;exports.DocxEditorRoot=zr;exports.DocxEditorShell=C2;exports.DocxEditorToolbar=zn;exports.DocxEditorVerticalRuler=Na;exports.DocxEditorViewport=$r;exports.HorizontalRuler=ao;exports.ImageAltText=ea;exports.ImageInsertProvider=Nr;exports.ImageInsertTrigger=Dr;exports.ImagePropertiesTrigger=ra;exports.ImageWrap=Jr;exports.LocaleProvider=wo;exports.Logo=li;exports.MenuBar=ci;exports.NAVIGATION_PANE_GAP=Hp;exports.NAVIGATION_PANE_INSET=Ha;exports.NAVIGATION_PANE_WIDTH=qo;exports.NavigationClose=rr;exports.NavigationFind=cr;exports.NavigationHeader=nr;exports.NavigationHeadings=sr;exports.NavigationTab=lr;exports.NavigationTabs=ir;exports.NavigationTitle=ar;exports.NavigationToggle=dr;exports.PageIndicator=uc;exports.PaginatedDocxEditor=Vs;exports.PaginatedDocxEditorShell=p2;exports.RULER_WIDTH=Bo;exports.ReviewRailContext=St;exports.SEARCH_DEBOUNCE_MS=vs;exports.SEARCH_MATCH_LIMIT=ys;exports.Slot=W;exports.TitleBar=Xs;exports.TitleBarRight=si;exports.Toolbar=cc;exports.ToolbarButton=tt;exports.ToolbarGroup=dt;exports.VERSION=cH;exports.VerticalRuler=er;exports.navigationPaneReservation=Ko;exports.navigationShift=Fa;exports.normalizeImageBytes=Ir;exports.useChromeTranslate=Sc;exports.useContentControl=pt;exports.useContentControlInstance=qr;exports.useContextMenuTarget=em;exports.useDocumentOutline=Aa;exports.useDocumentSearch=Oa;exports.useDocxEditor=A;exports.useDocxSource=tP;exports.useEditorCaret=cP;exports.useEditorCommand=ne;exports.useEditorEvent=Ll;exports.useEditorSnapshot=R2;exports.useEditorState=q;exports.useEditorValueCommand=xn;exports.useFontFamily=sa;exports.useFonts=aP;exports.useHeaderFooterState=Es;exports.useHyperlinkPopup=Bi;exports.useHyperlinkPopupInstance=Br;exports.useNavigationPane=Ba;exports.useNavigationShift=Ro;exports.useNotePropertiesState=As;exports.useNoteScopeState=Fs;exports.usePageSetup=eo;exports.useParagraphIndent=cs;exports.useParagraphStyle=ca;exports.useTableBorderTargetLabel=Fu;exports.useTranslation=_;exports.useZoom=pl;