@eigenpal/docx-editor-react 1.3.3 → 1.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/chunk-HBBXR6RS.js +2 -0
- package/dist/chunk-KUCRLN5R.mjs +2 -0
- package/dist/index.d.mts +52 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.js +8 -8
- package/dist/index.mjs +8 -8
- package/dist/styles.css +1 -1
- package/dist/ui.js +3 -3
- package/dist/ui.mjs +1 -1
- package/package.json +4 -4
- package/dist/chunk-53P6TCSE.js +0 -2
- package/dist/chunk-72ZQJWN2.mjs +0 -2
package/dist/chunk-53P6TCSE.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkEKDRHOOJ_js=require('./chunk-EKDRHOOJ.js'),chunkGNIO6SOS_js=require('./chunk-GNIO6SOS.js'),j=require('react'),clsx=require('clsx'),jsxRuntime=require('react/jsx-runtime'),units=require('@eigenpal/docx-editor-core/utils/units'),listState=require('@eigenpal/docx-editor-core/utils/listState'),docxEditorI18n=require('@eigenpal/docx-editor-i18n'),N=require('@radix-ui/react-select'),utils=require('@eigenpal/docx-editor-core/utils'),fontOptions=require('@eigenpal/docx-editor-core/utils/fontOptions'),highlightColors=require('@eigenpal/docx-editor-core/utils/highlightColors'),reportIssue=require('@eigenpal/docx-editor-core/utils/reportIssue');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 j__namespace=/*#__PURE__*/_interopNamespace(j);var N__namespace=/*#__PURE__*/_interopNamespace(N);var Ut=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Zt=clsx.clsx,qt=(e,t)=>o=>{var r;if(t?.variants==null)return Zt(e,o?.class,o?.className);let{variants:n,defaultVariants:s}=t,i=Object.keys(n).map(a=>{let p=o?.[a],m=s?.[a];if(p===null)return null;let l=Ut(p)||Ut(m);return n[a][l]}),c=o&&Object.entries(o).reduce((a,p)=>{let[m,l]=p;return l===void 0||(a[m]=l),a},{}),d=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((a,p)=>{let{class:m,className:l,...b}=p;return Object.entries(b).every(u=>{let[f,x]=u;return Array.isArray(x)?x.includes({...s,...c}[f]):{...s,...c}[f]===x})?[...a,m,l]:a},[]);return Zt(e,i,d,o?.class,o?.className)};function I(...e){return clsx.clsx(e)}var sr=qt("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"}}),V=j__namespace.forwardRef(({className:e,variant:t,size:o,...r},n)=>jsxRuntime.jsx("button",{className:I(sr({variant:t,size:o,className:e})),ref:n,...r}));V.displayName="Button";var ur=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],pr=1,mr=400;function Xt(e,t,o){for(let r of t)if(r>e)return r;return Math.min(e+1,o)}function jt(e,t,o){for(let r=t.length-1;r>=0;r--)if(t[r]<e)return t[r];return Math.max(e-1,o)}function Jt({value:e,onChange:t,sizes:o=ur,disabled:r=false,className:n,placeholder:s="11",minSize:i=pr,maxSize:c=mr}){let{t:d}=chunkGNIO6SOS_js.b(),[a,p]=j.useState(false),[m,l]=j.useState(""),[b,u]=j.useState(false),f=j.useRef(null),x=j.useCallback(()=>{u(false),p(false);},[]),{containerRef:g,dropdownRef:h,dropdownStyle:y}=chunkEKDRHOOJ_js.c({isOpen:b,onClose:x}),v=e??(parseInt(s,10)||11),P=e!==void 0?e.toString():s,L=j.useCallback(k=>{if(k.preventDefault(),r)return;let _=jt(v,o,i);t?.(_);},[v,o,i,r,t]),ce=j.useCallback(k=>{if(k.preventDefault(),r)return;let _=Xt(v,o,c);t?.(_);},[v,o,c,r,t]),F=j.useCallback(k=>{k.preventDefault(),!r&&(p(true),l(P),u(true),requestAnimationFrame(()=>{f.current?.focus(),f.current?.select();}));},[r,P]),Y=j.useCallback(k=>{l(k.target.value);},[]),de=j.useCallback(()=>{p(false);let k=parseFloat(m);if(!isNaN(k)&&k>=i&&k<=c){let _=Math.round(k*2)/2;t?.(_);}},[m,i,c,t]),ge=j.useCallback(k=>{if(k.key==="Enter")k.preventDefault(),de(),u(false);else if(k.key==="Escape")p(false),u(false);else if(k.key==="ArrowUp"){k.preventDefault();let _=Xt(v,o,c);l(_.toString()),t?.(_);}else if(k.key==="ArrowDown"){k.preventDefault();let _=jt(v,o,i);l(_.toString()),t?.(_);}},[de,v,o,c,i,t]),G=j.useCallback(k=>{t?.(k),u(false),p(false);},[t]),R=j.useCallback(k=>{k.target.tagName!=="INPUT"&&k.preventDefault();},[]);return jsxRuntime.jsxs("div",{ref:g,className:I("flex items-center",n),onMouseDown:R,children:[jsxRuntime.jsx(V,{variant:"ghost",size:"icon-sm",className:I("h-7 w-7 text-slate-500 hover:text-slate-900 hover:bg-slate-100/80 rounded-r-none",r&&"opacity-30 cursor-not-allowed"),onMouseDown:L,disabled:r||v<=i,"aria-label":d("fontSize.decrease"),"data-testid":"font-size-decrease",children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"remove",size:18})}),jsxRuntime.jsx("div",{className:"relative",children:a?jsxRuntime.jsx("input",{ref:f,type:"text",value:m,onChange:Y,onBlur:de,onKeyDown:ge,className:I("h-7 w-10 text-center text-sm border border-slate-300 bg-white","focus:outline-none focus:ring-1 focus:ring-slate-400","rounded-none"),"aria-label":d("fontSize.label"),"data-testid":"font-size-input"}):jsxRuntime.jsx("button",{type:"button",onClick:F,className:I("h-7 w-10 text-center text-sm border border-slate-200 bg-white","hover:border-slate-300 hover:bg-slate-50","focus:outline-none focus:ring-1 focus:ring-slate-400","rounded-none",r&&"opacity-50 cursor-not-allowed"),disabled:r,"aria-label":d("fontSize.label"),"aria-haspopup":"listbox","aria-expanded":b,"data-testid":"font-size-display",children:P})}),b&&jsxRuntime.jsx("div",{ref:h,style:{...y,backgroundColor:"white",border:"1px solid #e2e8f0",borderRadius:6,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.12)",maxHeight:240,overflowY:"auto",minWidth:60},role:"listbox","aria-label":d("fontSize.listLabel"),children:o.map(k=>jsxRuntime.jsx("button",{type:"button",onClick:()=>G(k),className:I("w-full px-3 py-1.5 text-sm text-left","hover:bg-slate-100",k===v&&"bg-slate-100 font-medium"),role:"option","aria-selected":k===v,children:k},k))}),jsxRuntime.jsx(V,{variant:"ghost",size:"icon-sm",className:I("h-7 w-7 text-slate-500 hover:text-slate-900 hover:bg-slate-100/80 rounded-l-none",r&&"opacity-30 cursor-not-allowed"),onMouseDown:ce,disabled:r||v>=c,"aria-label":d("fontSize.increase"),"data-testid":"font-size-increase",children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"add",size:18})})]})}var hr={display:"inline-flex",alignItems:"center",gap:"4px"},eo={display:"inline-flex",alignItems:"center",gap:"4px"},at={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)"},xr={...at,backgroundColor:"var(--doc-bg-hover)"},yr={...at,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},vr={...at,cursor:"default",opacity:.38},Cr={width:"28px",height:"28px",padding:"2px"},Sr={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},ot=20;function rt({active:e=false,disabled:t=false,title:o,onClick:r,children:n,className:s,style:i}){let[c,d]=j.useState(false),a={...t?vr:e?yr:c?xr:at,...i},p=m=>{m.preventDefault();};return jsxRuntime.jsx("button",{type:"button",className:`docx-list-button ${e?"docx-list-button-active":""} ${t?"docx-list-button-disabled":""} ${s||""}`,style:a,onMouseDown:p,onClick:t?void 0:r,onMouseEnter:()=>d(true),onMouseLeave:()=>d(false),disabled:t,title:o,"aria-label":o,"aria-pressed":e,role:"button",children:n})}function to({listState:e,onBulletList:t,onNumberedList:o,onIndent:r,onOutdent:n,disabled:s=false,className:i,style:c,showIndentButtons:d=true,compact:a=false,hasIndent:p=false}){let{t:m}=chunkGNIO6SOS_js.b(),l=j.useCallback(()=>a?{...Cr}:{},[a]),b=e?.type==="bullet",u=e?.type==="numbered",x=(e?.isInList||b||u)&&(e?.level??0)>0||p;return jsxRuntime.jsxs("div",{className:`docx-list-buttons ${i||""}`,style:{...hr,...c},role:"group","aria-label":m("lists.ariaLabel"),children:[jsxRuntime.jsxs("div",{style:eo,role:"group","aria-label":m("lists.typeAriaLabel"),children:[jsxRuntime.jsx(rt,{active:b,disabled:s,title:m("lists.bulletList"),onClick:t,style:l(),children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"format_list_bulleted",size:ot})}),jsxRuntime.jsx(rt,{active:u,disabled:s,title:m("lists.numberedList"),onClick:o,style:l(),children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"format_list_numbered",size:ot})})]}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:Sr,role:"separator"}),jsxRuntime.jsxs("div",{style:eo,role:"group","aria-label":m("lists.indentationAriaLabel"),children:[jsxRuntime.jsx(rt,{active:false,disabled:s||!x,title:m("lists.decreaseIndent"),onClick:n,style:l(),children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"format_indent_decrease",size:ot})}),jsxRuntime.jsx(rt,{active:false,disabled:s,title:m("lists.increaseIndent"),onClick:r,style:l(),children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"format_indent_increase",size:ot})})]})]})]})}var ro={hfInlineEditor:10,ruler:30,dropdown:100,contextMenu:1e4};var ao=[{action:"cut",labelKey:"contextMenu.cut",shortcutKey:"contextMenu.cutShortcut"},{action:"copy",labelKey:"contextMenu.copy",shortcutKey:"contextMenu.copyShortcut"},{action:"paste",labelKey:"contextMenu.paste",shortcutKey:"contextMenu.pasteShortcut"},{action:"pasteAsPlainText",labelKey:"contextMenu.pastePlainText",shortcutKey:"contextMenu.pastePlainTextShortcut",dividerAfter:true},{action:"delete",labelKey:"contextMenu.delete",shortcutKey:"contextMenu.deleteShortcut",dividerAfter:true},{action:"selectAll",labelKey:"contextMenu.selectAll",shortcutKey:"contextMenu.selectAllShortcut"}],Pr=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"4",cy:"12",r:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5.5 10.5L10.5 3M10.5 10.5L5.5 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Mr=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"5",y:"5",width:"8",height:"9",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M11 5V3a1 1 0 00-1-1H4a1 1 0 00-1 1v8a1 1 0 001 1h2",stroke:"currentColor",strokeWidth:"1.5"})]}),Ir=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"10",height:"11",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 3V2a1 1 0 011-1h2a1 1 0 011 1v1",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 8h4M6 11h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Lr=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Rr=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"1",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"2 2"}),jsxRuntime.jsx("rect",{x:"4",y:"4",width:"8",height:"8",fill:"currentColor",opacity:"0.3"})]}),Er=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"6",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("rect",{x:"2",y:"10",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("path",{d:"M8 1v3M6.5 2.5h3",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),Ar=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"2",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("rect",{x:"2",y:"6",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("path",{d:"M8 12v3M6.5 13.5h3",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),Nr=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"2",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("rect",{x:"2",y:"6",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2",opacity:"0.3"}),jsxRuntime.jsx("rect",{x:"2",y:"10",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("path",{d:"M5 8h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Dr=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"6",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("rect",{x:"10",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("path",{d:"M3 8H0.5M1.75 6.5v3",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),Br=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("rect",{x:"6",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("path",{d:"M13 8h2.5M14.25 6.5v3",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),_r=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("rect",{x:"6",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2",opacity:"0.3"}),jsxRuntime.jsx("rect",{x:"10",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("path",{d:"M8 5v6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Fr=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"4",height:"8",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("rect",{x:"10",y:"4",width:"4",height:"8",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("path",{d:"M7 8h2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M8 7l1 1-1 1",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),Or=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"12",height:"8",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("path",{d:"M8 4v8",stroke:"currentColor",strokeWidth:"1.2",strokeDasharray:"2 1"}),jsxRuntime.jsx("path",{d:"M6.5 8h-1M9.5 8h1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Kr=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M3 3h10a1 1 0 011 1v6a1 1 0 01-1 1H6l-3 2.5V11H3a1 1 0 01-1-1V4a1 1 0 011-1z",stroke:"currentColor",strokeWidth:"1.3"}),jsxRuntime.jsx("path",{d:"M5 6h6M5 8.5h4",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]});function zr(e){switch(e){case "cut":return jsxRuntime.jsx(Pr,{});case "copy":return jsxRuntime.jsx(Mr,{});case "paste":case "pasteAsPlainText":return jsxRuntime.jsx(Ir,{});case "delete":return jsxRuntime.jsx(Lr,{});case "selectAll":return jsxRuntime.jsx(Rr,{});case "addRowAbove":return jsxRuntime.jsx(Er,{});case "addRowBelow":return jsxRuntime.jsx(Ar,{});case "deleteRow":return jsxRuntime.jsx(Nr,{});case "addColumnLeft":return jsxRuntime.jsx(Dr,{});case "addColumnRight":return jsxRuntime.jsx(Br,{});case "deleteColumn":return jsxRuntime.jsx(_r,{});case "mergeCells":return jsxRuntime.jsx(Fr,{});case "splitCell":return jsxRuntime.jsx(Or,{});case "addComment":return jsxRuntime.jsx(Kr,{});default:return null}}var Hr=({item:e,onClick:t,isHighlighted:o,onMouseEnter:r})=>e.action==="separator"?jsxRuntime.jsx("div",{className:"docx-text-context-menu-separator",style:{height:"1px",backgroundColor:"var(--doc-border)",margin:"4px 12px"}}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",className:`docx-text-context-menu-item ${o?"docx-text-context-menu-item-highlighted":""} ${e.disabled?"docx-text-context-menu-item-disabled":""}`,onClick:t,onMouseEnter:r,disabled:e.disabled,role:"menuitem","aria-disabled":e.disabled,style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"8px 12px",border:"none",background:o&&!e.disabled?"var(--doc-primary-light)":"transparent",cursor:e.disabled?"not-allowed":"pointer",fontSize:"13px",color:e.disabled?"var(--doc-text-subtle)":"var(--doc-text)",textAlign:"left",opacity:e.disabled?.6:1},children:[jsxRuntime.jsx("span",{style:{display:"flex",color:e.disabled?"var(--doc-border)":"var(--doc-text-muted)"},children:zr(e.action)}),jsxRuntime.jsx("span",{style:{flex:1},children:e.label}),e.shortcut&&jsxRuntime.jsx("span",{style:{fontSize:"11px",color:"var(--doc-text-subtle)",fontFamily:"monospace"},children:e.shortcut})]}),e.dividerAfter&&jsxRuntime.jsx("div",{className:"docx-text-context-menu-separator",style:{height:"1px",backgroundColor:"var(--doc-border)",margin:"4px 12px"}})]}),di=({isOpen:e,position:t,hasSelection:o,isEditable:r,hasClipboardContent:n=true,onAction:s,onClose:i,items:c,className:d=""})=>{let a=j.useRef(null),[p,m]=j.useState(0),{t:l}=chunkGNIO6SOS_js.b(),b=j.useMemo(()=>ao.map(h=>({action:h.action,label:l(h.labelKey),shortcut:h.shortcutKey?l(h.shortcutKey):void 0,dividerAfter:h.dividerAfter})),[l]),u=(c||b).map(h=>{let y=(()=>{if(h.disabled!==void 0)return h.disabled;switch(h.action){case "cut":case "copy":case "delete":return !o;case "paste":case "pasteAsPlainText":return !r||!n;default:return false}})();return {...h,disabled:y}}),f=u.filter(h=>h.action!=="separator");j.useEffect(()=>{if(!e)return;let h=v=>{a.current&&!a.current.contains(v.target)&&i();},y=setTimeout(()=>{document.addEventListener("mousedown",h);},0);return ()=>{clearTimeout(y),document.removeEventListener("mousedown",h);}},[e,i]),j.useEffect(()=>{if(!e)return;let h=y=>{switch(y.key){case "Escape":y.preventDefault(),i();break;case "ArrowDown":y.preventDefault(),m(P=>{let L=(P+1)%f.length;for(;f[L]?.disabled&&L!==P;)L=(L+1)%f.length;return L});break;case "ArrowUp":y.preventDefault(),m(P=>{let L=(P-1+f.length)%f.length;for(;f[L]?.disabled&&L!==P;)L=(L-1+f.length)%f.length;return L});break;case "Enter":y.preventDefault();let v=f[p];v&&!v.disabled&&(s(v.action),i());break}};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,p,f,s,i]),j.useEffect(()=>{e&&m(0);},[e]);let x=j.useCallback(()=>{let y=u.length*36+16,v=t.x,P=t.y;return typeof window<"u"&&(v+220>window.innerWidth&&(v=window.innerWidth-220-10),P+y>window.innerHeight&&(P=window.innerHeight-y-10),v<10&&(v=10),P<10&&(P=10)),{position:"fixed",top:P,left:v,minWidth:220,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",zIndex:ro.contextMenu,padding:"4px 0",overflow:"hidden"}},[t,u.length]),g=h=>{h.disabled||(s(h.action),i());};return e?jsxRuntime.jsx("div",{ref:a,className:`docx-text-context-menu ${d}`,style:x(),role:"menu","aria-label":l("contextMenu.textMenuAriaLabel"),children:u.map((h,y)=>{let v=f.findIndex(P=>P===h);return jsxRuntime.jsx(Hr,{item:h,onClick:()=>g(h),isHighlighted:v===p,onMouseEnter:()=>{v>=0&&!h.disabled&&m(v);}},`${h.action}-${y}`)})}):null};function ui(e={}){let{enabled:t=true,isEditable:o=true,containerRef:r,onAction:n}=e,[s,i]=j.useState(false),[c,d]=j.useState({x:0,y:0}),[a,p]=j.useState(false),m=j.useCallback(()=>{let x=window.getSelection(),g=x&&!x.isCollapsed&&x.toString().length>0;return p(!!g),!!g},[]),l=j.useCallback(x=>{t&&(x.preventDefault(),x.stopPropagation(),m(),d({x:x.clientX,y:x.clientY}),i(true));},[t,m]),b=j.useCallback(()=>{i(false);},[]),u=j.useCallback(x=>{switch(b(),x){case "cut":document.execCommand("cut");break;case "copy":document.execCommand("copy");break;case "paste":document.execCommand("paste");break;case "pasteAsPlainText":navigator.clipboard.readText?.().then(g=>{document.execCommand("insertText",false,g);}).catch(()=>{document.execCommand("paste");});break;case "delete":document.execCommand("delete");break;case "selectAll":document.execCommand("selectAll");break}n?.(x);},[b,n]),f=j.useCallback(x=>{l(x);},[l]);return j.useEffect(()=>{if(!s)return;let x=g=>{g.key==="Escape"&&b();};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[s,b]),{isOpen:s,position:c,hasSelection:a,openMenu:l,closeMenu:b,handleAction:u,onContextMenu:f}}function pi(e){return {cut:"Cut",copy:"Copy",paste:"Paste",pasteAsPlainText:"Paste as Plain Text",selectAll:"Select All",delete:"Delete",separator:"",addRowAbove:"Insert row above",addRowBelow:"Insert row below",deleteRow:"Delete row",addColumnLeft:"Insert column left",addColumnRight:"Insert column right",deleteColumn:"Delete column",mergeCells:docxEditorI18n.en.table.mergeCells,splitCell:docxEditorI18n.en.table.splitCell,addComment:"Comment"}[e]}function mi(e){return {cut:"Ctrl+X",copy:"Ctrl+C",paste:"Ctrl+V",pasteAsPlainText:"Ctrl+Shift+V",selectAll:"Ctrl+A",delete:"Del",separator:"",addRowAbove:"",addRowBelow:"",deleteRow:"",addColumnLeft:"",addColumnRight:"",deleteColumn:"",mergeCells:"",splitCell:"",addComment:""}[e]}function fi(){return ao.map(e=>({action:e.action,label:e.labelKey,shortcut:e.shortcutKey,dividerAfter:e.dividerAfter}))}function bi(e,t,o){switch(e){case "cut":case "copy":case "delete":return t;case "paste":case "pasteAsPlainText":return o;case "addComment":return t;case "selectAll":return true;default:return true}}var we=N__namespace.Root,De=N__namespace.Group,st=N__namespace.Value;function Te({className:e,children:t,onMouseDown:o,...r}){return jsxRuntime.jsxs(N__namespace.Trigger,{className:I("flex h-8 items-center justify-between gap-1 rounded px-2 py-1","text-sm text-slate-700 bg-transparent","hover:bg-slate-100/80 focus:outline-none focus:bg-slate-100/80","disabled:cursor-not-allowed disabled:opacity-50","transition-colors duration-150","[&>span]:truncate",e),onMouseDown:n=>{n.preventDefault(),o?.(n);},...r,children:[t,jsxRuntime.jsx(N__namespace.Icon,{asChild:true,children:jsxRuntime.jsx(Vr,{className:"h-4 w-4 text-slate-400 shrink-0"})})]})}function ke({className:e,children:t,position:o="popper",onCloseAutoFocus:r,...n}){return jsxRuntime.jsx(N__namespace.Portal,{children:jsxRuntime.jsx("div",{className:"ep-root",children:jsxRuntime.jsx(N__namespace.Content,{className:I("relative z-50 max-h-72 min-w-[8rem] overflow-hidden","rounded-lg border border-slate-200 bg-white 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",o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",e),position:o,onCloseAutoFocus:s=>{s.preventDefault(),r?.(s);},...n,children:jsxRuntime.jsx(N__namespace.Viewport,{className:I("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),onMouseDown:s=>s.preventDefault(),children:t})})})})}function We({className:e,...t}){return jsxRuntime.jsx(N__namespace.Label,{className:I("px-2 py-1.5 text-xs font-medium text-slate-500",e),...t})}function ae({className:e,children:t,onMouseDown:o,...r}){return jsxRuntime.jsxs(N__namespace.Item,{className:I("relative flex w-full cursor-pointer select-none items-center","rounded px-2 py-1.5 text-sm text-slate-700 outline-none","hover:bg-slate-100 focus:bg-slate-100","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),onMouseDown:n=>{n.preventDefault(),o?.(n);},...r,children:[jsxRuntime.jsx(N__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(N__namespace.ItemIndicator,{children:jsxRuntime.jsx($r,{className:"h-4 w-4"})})})]})}function Ve({className:e,...t}){return jsxRuntime.jsx(N__namespace.Separator,{className:I("-mx-1 my-1 h-px bg-slate-100",e),...t})}function Vr({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 $r({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"})})}var Gr=[{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 lo({value:e,onChange:t,fonts:o=Gr,disabled:r=false,className:n,placeholder:s="Arial",width:i=120,showPreview:c=true}){let{t:d}=chunkGNIO6SOS_js.b(),a=j__namespace.useMemo(()=>e?o.find(b=>b.fontFamily===e||b.name.toLowerCase()===e.toLowerCase())?.name||e:s,[e,o,s]),p=j__namespace.useCallback(l=>{let b=o.find(u=>u.name===l);b&&t?.(b.fontFamily);},[t,o]),m=j__namespace.useMemo(()=>{let l={"sans-serif":[],serif:[],monospace:[],other:[]};return o.forEach(b=>{let u=b.category||"other";l[u].push(b);}),l},[o]);return jsxRuntime.jsxs(we,{value:a,onValueChange:p,disabled:r,children:[jsxRuntime.jsx(Te,{className:I("h-8 text-sm",n),style:{minWidth:typeof i=="number"?`${i}px`:i},"aria-label":d("font.selectAriaLabel"),children:jsxRuntime.jsx(st,{placeholder:s,children:a})}),jsxRuntime.jsxs(ke,{className:"max-h-[300px]",children:[m["sans-serif"].length>0&&jsxRuntime.jsxs(De,{children:[jsxRuntime.jsx(We,{children:d("font.sansSerif")}),m["sans-serif"].map(l=>jsxRuntime.jsx(ae,{value:l.name,style:c?{fontFamily:l.fontFamily}:void 0,children:l.name},l.name))]}),m.serif.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ve,{}),jsxRuntime.jsxs(De,{children:[jsxRuntime.jsx(We,{children:d("font.serif")}),m.serif.map(l=>jsxRuntime.jsx(ae,{value:l.name,style:c?{fontFamily:l.fontFamily}:void 0,children:l.name},l.name))]})]}),m.monospace.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ve,{}),jsxRuntime.jsxs(De,{children:[jsxRuntime.jsx(We,{children:d("font.monospace")}),m.monospace.map(l=>jsxRuntime.jsx(ae,{value:l.name,style:c?{fontFamily:l.fontFamily}:void 0,children:l.name},l.name))]})]}),m.other.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ve,{}),jsxRuntime.jsx(De,{children:m.other.map(l=>jsxRuntime.jsx(ae,{value:l.name,style:c?{fontFamily:l.fontFamily}:void 0,children:l.name},l.name))})]})]})]})}var jr=[{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"}],ct=18,Jr=2,Qr={position:"relative",display:"inline-block"},en={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)"},tn={padding:"10px",backgroundColor:"#fff",border:"1px solid #d0d0d0",borderRadius:"6px",boxShadow:"0 4px 16px rgba(0, 0, 0, 0.15)",width:"auto"},Pt={fontSize:"11px",color:"#666",marginBottom:"4px",fontWeight:500},Mt={height:"1px",backgroundColor:"#e0e0e0",margin:"8px 0"},uo={display:"grid",gap:`${Jr}px`},dt={width:`${ct}px`,height:`${ct}px`,border:"1px solid #c0c0c0",borderRadius:"2px",cursor:"pointer",padding:0,transition:"transform 0.1s, border-color 0.1s"},po={...dt,transform:"scale(1.15)",borderColor:"#333",zIndex:1},mo={...dt,borderWidth:"2px",borderColor:"#0066cc",boxShadow:"0 0 0 1px #0066cc"},on={display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"5px 8px",border:"1px solid #d0d0d0",borderRadius:"4px",backgroundColor:"#fff",cursor:"pointer",fontSize:"12px",color:"#333"},rn={display:"flex",alignItems:"center",gap:"6px"},nn={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid #ccc",borderRadius:"3px",fontSize:"12px"},an={height:"24px",padding:"0 10px",border:"1px solid #ccc",borderRadius:"3px",backgroundColor:"#f5f5f5",fontSize:"12px",cursor:"pointer"},so={width:"16px",height:"4px",borderRadius:"1px",marginTop:"-2px"},ln={display:"inline-flex",alignItems:"stretch",height:"32px",gap:"2px"},sn={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)"},cn={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 It(e,t,o){if(!e)return t==="text"||t==="border"?"#000000":"transparent";if(typeof e=="string"){if(t==="highlight"){let r=utils.resolveHighlightColor(e);return r||(e==="none"?"transparent":e.startsWith("#")?e:`#${e}`)}return e.startsWith("#")?e:`#${e}`}return utils.resolveColor(e,o)}function co(e){let t=e.replace(/^#/,"");if(t.length!==6)return false;let o=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),n=parseInt(t.slice(4,6),16);return (o*299+r*587+n*114)/1e3>230}function fo(e,t,o){return e?(typeof e=="string"?e.replace(/^#/,"").toUpperCase():utils.resolveColorToHex(e,o))===t.toUpperCase():false}function dn({matrix:e,selectedColor:t,theme:o,onSelect:r}){let[n,s]=j.useState(null);return jsxRuntime.jsx("div",{style:{...uo,gridTemplateColumns:`repeat(10, ${ct}px)`},children:e.flatMap((i,c)=>i.map((d,a)=>{let p=`${c}-${a}`,m=n===p,l=fo(t,d.hex,o);return jsxRuntime.jsx("button",{type:"button",style:{...l?mo:m?po:dt,backgroundColor:`#${d.hex}`},title:d.label,"aria-label":d.label,"aria-selected":l,onClick:()=>r(d),onMouseDown:b=>b.preventDefault(),onMouseEnter:()=>s(p),onMouseLeave:()=>s(null)},p)}))})}function un({selectedColor:e,theme:t,onSelect:o}){let[r,n]=j.useState(null),{t:s}=chunkGNIO6SOS_js.b();return jsxRuntime.jsx("div",{style:{...uo,gridTemplateColumns:`repeat(10, ${ct}px)`},children:jr.map((i,c)=>{let d=r===c,a=fo(e,i.hex,t),p=s(i.nameKey);return jsxRuntime.jsx("button",{type:"button",style:{...a?mo:d?po:dt,backgroundColor:`#${i.hex}`},title:p,"aria-label":p,"aria-selected":a,onClick:()=>o(i.hex),onMouseDown:m=>m.preventDefault(),onMouseEnter:()=>n(c),onMouseLeave:()=>n(null)},i.hex)})})}function _e({mode:e,value:t,onChange:o,theme:r,disabled:n=false,className:s,style:i,title:c,icon:d,autoLabel:a,splitButton:p=true,defaultColor:m}){let[l,b]=j.useState(false),[u,f]=j.useState(false),[x,g]=j.useState(false),[h,y]=j.useState(false),[v,P]=j.useState(""),[L,ce]=j.useState(()=>m??(e==="highlight"?"FFFF00":e==="border"?{rgb:"000000"}:{rgb:"FF0000"})),{t:F}=chunkGNIO6SOS_js.b();j.useEffect(()=>{let w=It(t,e,r).replace(/^#/,"");/^[0-9A-Fa-f]{6}$/.test(w)&&P(w.toUpperCase());},[t,e,r]);let Y=j.useCallback(()=>b(false),[]),{containerRef:de,dropdownRef:ge,dropdownStyle:G}=chunkEKDRHOOJ_js.c({isOpen:l,onClose:Y}),R=r?.colorScheme??null,k=j.useMemo(()=>utils.generateThemeTintShadeMatrix(R),[R]),_=j.useMemo(()=>It(t,e,r),[t,e,r]),ue=j.useMemo(()=>It(L,e,r),[L,e,r]),he=j.useCallback(()=>{n||b(w=>!w);},[n]),xe=j.useCallback(w=>{let W;if(e==="highlight")W=w.hex;else {let ve={themeColor:w.themeSlot,rgb:w.hex};w.tint&&(ve.themeTint=w.tint),w.shade&&(ve.themeShade=w.shade),W=ve;}ce(W),o?.(W),b(false);},[e,o]),ye=j.useCallback(w=>{let W=e==="highlight"?w:{rgb:w};ce(W),o?.(W),b(false);},[e,o]),te=j.useCallback(()=>{o?.(e==="highlight"?"none":{auto:true}),b(false);},[e,o]),Ee=j.useCallback(()=>{let w=v.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/i.test(w)){let W=e==="highlight"?w:{rgb:w};ce(W),o?.(W),b(false),P("");}},[e,v,o]),O=j.useCallback(()=>{n||o?.(L);},[n,L,o]),qe={...en,...n?{cursor:"default",opacity:.38}:l?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:u?{backgroundColor:"var(--doc-bg-hover)"}:{}},oe=F(e==="text"?"formattingBar.fontColor":e==="highlight"?"formattingBar.highlightColor":"table.borderColor"),ze=d??(e==="text"?"format_color_text":e==="highlight"?"ink_highlighter":"border_color");return jsxRuntime.jsxs("div",{ref:de,className:`docx-color-picker ${s||""}`,style:{...Qr,...i},children:[p?jsxRuntime.jsxs("div",{className:"docx-color-picker-split",style:{...ln,...n?{opacity:.38,cursor:"default"}:null},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-apply",style:{...sn,...n?{cursor:"default"}:x?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:O,onMouseDown:w=>w.preventDefault(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),disabled:n,title:c||oe,"aria-label":c||oe,children:[jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:ze,size:18}),jsxRuntime.jsx("div",{style:{...so,backgroundColor:ue==="transparent"?"#fff":ue,outline:ue==="transparent"||co(ue)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-color-picker-arrow",style:{...cn,...n?{cursor:"default"}:l?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:h?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:he,onMouseDown:w=>w.preventDefault(),onMouseEnter:()=>y(true),onMouseLeave:()=>y(false),disabled:n,title:c||oe,"aria-label":c||oe,"aria-haspopup":"true","aria-expanded":l,children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"arrow_drop_down",size:18})})]}):jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-button",style:qe,onClick:he,onMouseDown:w=>w.preventDefault(),onMouseEnter:()=>f(true),onMouseLeave:()=>f(false),disabled:n,title:c||oe,"aria-label":c||oe,"aria-haspopup":"true","aria-expanded":l,children:[jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:0},children:[jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:ze,size:18}),jsxRuntime.jsx("div",{style:{...so,backgroundColor:_==="transparent"?"#fff":_,outline:_==="transparent"||co(_)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"arrow_drop_down",size:14})]}),l&&jsxRuntime.jsx("div",{ref:ge,className:"docx-color-picker-dropdown",style:{...G,...tn},role:"dialog","aria-label":`${oe} picker`,onMouseDown:w=>{w.target.tagName!=="INPUT"&&w.preventDefault();},children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",style:on,onClick:te,onMouseDown:w=>w.preventDefault(),children:[e==="highlight"?jsxRuntime.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",border:"1px solid #ccc",borderRadius:"2px",position:"relative",backgroundColor:"#fff"},children:jsxRuntime.jsx("span",{style:{position:"absolute",top:"50%",left:"-1px",right:"-1px",height:"2px",backgroundColor:"#ff0000",transform:"rotate(-45deg)"}})}):jsxRuntime.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",backgroundColor:"#000",borderRadius:"2px"}}),a??F(e==="highlight"?"colorPicker.noColor":"colorPicker.automatic")]}),jsxRuntime.jsx("div",{style:Mt}),jsxRuntime.jsx("div",{style:Pt,children:F("colorPicker.themeColors")}),jsxRuntime.jsx(dn,{matrix:k,selectedColor:t,theme:r,onSelect:xe}),jsxRuntime.jsx("div",{style:Mt}),jsxRuntime.jsx("div",{style:Pt,children:F("colorPicker.standardColors")}),jsxRuntime.jsx(un,{selectedColor:t,theme:r,onSelect:ye}),jsxRuntime.jsx("div",{style:Mt}),jsxRuntime.jsx("div",{style:Pt,children:F("colorPicker.customColor")}),jsxRuntime.jsxs("div",{style:rn,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"#666"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:nn,value:v,onChange:w=>P(w.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:w=>{w.key==="Enter"&&Ee();},onMouseDown:w=>{w.stopPropagation();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsxRuntime.jsx("button",{type:"button",style:{...an,opacity:/^[0-9A-Fa-f]{6}$/.test(v)?1:.4,cursor:/^[0-9A-Fa-f]{6}$/.test(v)?"pointer":"default"},onClick:Ee,onMouseDown:w=>w.preventDefault(),disabled:!/^[0-9A-Fa-f]{6}$/.test(v),children:F("common.apply")})]})]})})]})}function Q({content:e,children:t,side:o="bottom",delayMs:r=400}){let[n,s]=j__namespace.useState(false),[i,c]=j__namespace.useState({x:0,y:0}),d=j__namespace.useRef(null),a=j__namespace.useRef(null),p=j__namespace.useCallback(()=>{a.current=setTimeout(()=>{if(d.current){let u=d.current.getBoundingClientRect(),f=u.left+u.width/2,x=o==="top"?u.top-8:u.bottom+8;c({x:f,y:x});}s(true);},r);},[r,o]),m=j__namespace.useCallback(()=>{a.current&&(clearTimeout(a.current),a.current=null),s(false);},[]);j__namespace.useEffect(()=>()=>{a.current&&clearTimeout(a.current);},[]);let l=t.props,b=j__namespace.cloneElement(t,{ref:d,onMouseEnter:u=>{p(),l.onMouseEnter?.(u);},onMouseLeave:u=>{m(),l.onMouseLeave?.(u);}});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[b,n&&jsxRuntime.jsx("div",{className:"fixed z-50 px-2 py-1 text-xs font-medium text-white bg-slate-900 rounded-md shadow-lg",style:{left:i.x,top:i.y,transform:o==="top"?"translate(-50%, -100%)":o==="bottom"?"translate(-50%, 0)":void 0},children:e})]})}var je=20,Lt=[{value:"left",label:"Align Left",labelKey:"alignment.alignLeft",shortcutKey:"alignment.alignLeftShortcut",icon:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"format_align_left",size:je}),iconName:"format_align_left",shortcut:"Ctrl+L"},{value:"center",label:"Center",labelKey:"alignment.center",shortcutKey:"alignment.centerShortcut",icon:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"format_align_center",size:je}),iconName:"format_align_center",shortcut:"Ctrl+E"},{value:"right",label:"Align Right",labelKey:"alignment.alignRight",shortcutKey:"alignment.alignRightShortcut",icon:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"format_align_right",size:je}),iconName:"format_align_right",shortcut:"Ctrl+R"},{value:"both",label:"Justify",labelKey:"alignment.justify",shortcutKey:"alignment.justifyShortcut",icon:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"format_align_justify",size:je}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function ho({value:e="left",onChange:t,disabled:o=false}){let{t:r}=chunkGNIO6SOS_js.b(),[n,s]=j.useState(false),i=j.useCallback(()=>s(false),[]),{containerRef:c,dropdownRef:d,dropdownStyle:a,handleMouseDown:p}=chunkEKDRHOOJ_js.c({isOpen:n,onClose:i}),m=j.useCallback(g=>{o||t?.(g),s(false);},[o,t]),l=Lt.find(g=>g.value===e)||Lt[0],b=r(l.labelKey),u=l.shortcutKey?r(l.shortcutKey):void 0,f=`${b}${u?` (${u})`:""}`,x=jsxRuntime.jsxs(V,{variant:"ghost",size:"icon-sm",className:I("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",n&&"bg-slate-100",o&&"opacity-30 cursor-not-allowed"),onMouseDown:p,onClick:()=>!o&&s(g=>!g),disabled:o,"aria-label":f,"aria-expanded":n,"aria-haspopup":"true","data-testid":"toolbar-alignment",children:[jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:l.iconName,size:je}),jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:c,style:{position:"relative",display:"inline-block"},children:[n?x:jsxRuntime.jsx(Q,{content:f,children:x}),n&&!o&&jsxRuntime.jsx("div",{ref:d,style:{...a,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:6},onMouseDown:g=>g.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",gap:2},children:Lt.map(g=>{let h=e===g.value,y=r(g.labelKey),v=g.shortcutKey?r(g.shortcutKey):void 0;return jsxRuntime.jsx("button",{type:"button",title:`${y}${v?` (${v})`:""}`,"data-testid":`alignment-${g.value}`,style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:h?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:h?"var(--doc-primary)":"var(--doc-text)"},onMouseDown:P=>P.preventDefault(),onMouseEnter:P=>{h||(P.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:P=>{P.currentTarget.style.backgroundColor=h?"var(--doc-primary-light)":"transparent";},onClick:()=>m(g.value),children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:g.iconName,size:18})},g.value)})})})]})}var hn=[{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 yo({value:e,onChange:t,options:o=hn,disabled:r=false,className:n}){let{t:s}=chunkGNIO6SOS_js.b(),i=j__namespace.useMemo(()=>e===void 0?o[0]:o.find(a=>a.twipsValue===e)||o[0],[e,o]),c=j__namespace.useCallback(a=>{let p=parseInt(a,10);isNaN(p)||t?.(p);},[t]),d=a=>a.labelKey?s(a.labelKey):a.label;return jsxRuntime.jsxs(we,{value:i.twipsValue.toString(),onValueChange:c,disabled:r,children:[jsxRuntime.jsx(Te,{className:I("h-8 text-sm gap-0.5 px-2",n),style:{width:"auto"},title:s("lineSpacing.lineSpacingTitle",{label:d(i)}),children:jsxRuntime.jsx(chunkEKDRHOOJ_js.a,{className:"h-5 w-5 shrink-0"})}),jsxRuntime.jsxs(ke,{children:[o.map(a=>jsxRuntime.jsx(ae,{value:a.twipsValue.toString(),children:d(a)},a.twipsValue)),jsxRuntime.jsx(Ve,{}),jsxRuntime.jsx(De,{children:jsxRuntime.jsx(We,{children:s("lineSpacing.paragraphSpacing")})})]})]})}var vo=[{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}],xn="#4a6c8c",yn={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14};function vn(e){let t={},o=yn[e.styleId];if(o)t.fontSize=`${o}px`;else {let r=e.fontSize?e.fontSize/2:11,n=Math.min(Math.max(r,11),20);t.fontSize=`${n}px`;}return t.lineHeight="1.3",e.bold&&(t.fontWeight="bold"),e.italic&&(t.fontStyle="italic"),e.color?t.color=`#${e.color}`:e.styleId.startsWith("Heading")&&(t.color=xn),t}function Co({value:e,onChange:t,styles:o,disabled:r=false,className:n,width:s=120}){let{t:i}=chunkGNIO6SOS_js.b(),c=j__namespace.useMemo(()=>!o||o.length===0?vo:o.filter(u=>u.type==="paragraph").filter(u=>u.qFormat?true:!(u.hidden||u.semiHidden)).map(u=>{let f=vo.find(x=>x.styleId===u.styleId);return {styleId:u.styleId,name:u.name||u.styleId,nameKey:f?.nameKey,type:u.type,isDefault:u.default,qFormat:u.qFormat,priority:u.uiPriority??99,fontSize:u.rPr?.fontSize??f?.fontSize,bold:u.rPr?.bold??f?.bold,italic:u.rPr?.italic??f?.italic,color:u.rPr?.color?.rgb??f?.color}}).sort((u,f)=>(u.priority??99)-(f.priority??99)),[o]),d=j__namespace.useCallback(b=>{t?.(b);},[t]),a=b=>b.nameKey?i(b.nameKey):b.name,p=e||"Normal",m=c.find(b=>b.styleId===p),l=m?a(m):p;return jsxRuntime.jsxs(we,{value:p,onValueChange:d,disabled:r,children:[jsxRuntime.jsx(Te,{className:I("h-8 text-sm",n),style:{width:typeof s=="number"?`${s}px`:s},"aria-label":i("styles.selectAriaLabel"),children:jsxRuntime.jsx("span",{className:"truncate",children:l})}),jsxRuntime.jsx(ke,{className:"min-w-[260px] max-h-[400px]",children:c.map(b=>jsxRuntime.jsx(ae,{value:b.styleId,className:"py-2.5 px-3",children:jsxRuntime.jsx("span",{style:vn(b),children:a(b)})},b.styleId))})]})}var Sn=[{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 So({value:e=1,onChange:t,levels:o=Sn,disabled:r=false,className:n,compact:s=false}){let{t:i}=chunkGNIO6SOS_js.b(),c=j__namespace.useMemo(()=>{let a=o.find(p=>Math.abs(p.value-e)<.001);return a?a.label:`${Math.round(e*100)}%`},[o,e]),d=j__namespace.useCallback(a=>{let p=parseFloat(a);isNaN(p)||t?.(p);},[t]);return jsxRuntime.jsxs(we,{value:e.toString(),onValueChange:d,disabled:r,children:[jsxRuntime.jsx(Te,{className:I(s?"h-7 min-w-[55px] text-xs":"h-8 min-w-[70px] text-sm",n),"aria-label":i("zoom.ariaLabel",{label:c}),children:jsxRuntime.jsx(st,{placeholder:"100%",children:c})}),jsxRuntime.jsx(ke,{children:o.map(a=>jsxRuntime.jsx(ae,{value:a.value.toString(),children:a.label},a.value))})]})}var kn=[{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 ko({onAction:e,disabled:t=false}){let{t:o}=chunkGNIO6SOS_js.b(),[r,n]=j.useState(false),s=j.useCallback(()=>n(false),[]),{containerRef:i,dropdownRef:c,dropdownStyle:d,handleMouseDown:a}=chunkEKDRHOOJ_js.c({isOpen:r,onClose:s}),p=j.useCallback(l=>{e(l),n(false);},[e]),m=jsxRuntime.jsxs(V,{variant:"ghost",size:"icon-sm",className:I("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",r&&"bg-slate-100",t&&"opacity-30 cursor-not-allowed"),onMouseDown:a,onClick:()=>!t&&n(l=>!l),disabled:t,"aria-label":o("table.borders.styleAriaLabel"),"aria-expanded":r,"aria-haspopup":"true","data-testid":"toolbar-table-borders",children:[jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"border_all",size:20}),jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:i,style:{position:"relative",display:"inline-block"},children:[r?m:jsxRuntime.jsx(Q,{content:o("table.borders.tooltip"),children:m}),r&&!t&&jsxRuntime.jsx("div",{ref:c,style:{...d,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:6},onMouseDown:l=>l.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:2},children:kn.map(({action:l,icon:b,labelKey:u})=>jsxRuntime.jsx("button",{type:"button",title:o(u),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:"transparent",cursor:"pointer",color:"var(--doc-text)"},onMouseDown:f=>f.preventDefault(),onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},onClick:()=>p(l),children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:b,size:18})},typeof l=="string"?l:l.type))})})]})}function Po({onAction:e,disabled:t=false,theme:o,value:r}){let{t:n}=chunkGNIO6SOS_js.b(),s=j.useCallback(i=>{typeof i=="string"?e({type:"borderColor",color:i.replace(/^#/,"")}):i.rgb?e({type:"borderColor",color:i.rgb.replace(/^#/,"")}):i.auto&&e({type:"borderColor",color:"000000"});},[e]);return jsxRuntime.jsx(_e,{mode:"border",value:r,onChange:s,theme:o,disabled:t,title:n("table.borderColor")})}var Ln=[{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 Io({onAction:e,disabled:t=false}){let[o,r]=j.useState(false),{t:n}=chunkGNIO6SOS_js.b(),s=j.useCallback(()=>r(false),[]),{containerRef:i,dropdownRef:c,dropdownStyle:d,handleMouseDown:a}=chunkEKDRHOOJ_js.c({isOpen:o,onClose:s}),p=j.useCallback(l=>{e({type:"borderWidth",size:l}),r(false);},[e]),m=jsxRuntime.jsxs(V,{variant:"ghost",size:"icon-sm",className:I("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",o&&"bg-slate-100",t&&"opacity-30 cursor-not-allowed"),onMouseDown:a,onClick:()=>!t&&r(l=>!l),disabled:t,"aria-label":n("table.borderWidth"),"aria-expanded":o,"aria-haspopup":"true","data-testid":"toolbar-table-border-width",children:[jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"line_weight",size:20}),jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:i,style:{position:"relative",display:"inline-block"},children:[o?m:jsxRuntime.jsx(Q,{content:n("table.borderWidth"),children:m}),o&&!t&&jsxRuntime.jsx("div",{ref:c,style:{...d,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:"4px 0",minWidth:120},onMouseDown:l=>l.stopPropagation(),children:Ln.map(({size:l,label:b,thickness:u})=>jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:10,padding:"6px 12px",width:"100%",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:12,color:"var(--doc-text)"},onMouseDown:f=>f.preventDefault(),onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},onClick:()=>p(l),children:[jsxRuntime.jsx("div",{style:{width:50,height:Math.max(u,1),backgroundColor:"#000",borderRadius:u>2?1:0}}),jsxRuntime.jsx("span",{children:b})]},l))})]})}function Lo({onAction:e,disabled:t=false,theme:o,value:r}){let{t:n}=chunkGNIO6SOS_js.b(),s=j.useCallback(i=>{typeof i=="string"&&e(i==="none"?{type:"cellFillColor",color:null}:{type:"cellFillColor",color:i.replace(/^#/,"")});},[e]);return jsxRuntime.jsx(_e,{mode:"highlight",value:r,onChange:s,theme:o,disabled:t,title:n("table.cellFillColor"),icon:"format_color_fill",autoLabel:n("colorPicker.noColor")})}var An={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"},Ue={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},Ao={padding:"6px 14px 2px",fontSize:11,color:"var(--doc-text-muted)",fontWeight:500};function No({onAction:e,disabled:t=false,tableContext:o}){let{t:r}=chunkGNIO6SOS_js.b(),[n,s]=j.useState(false),[i,c]=j.useState(null),d=j.useCallback(()=>s(false),[]),{containerRef:a,dropdownRef:p,dropdownStyle:m,handleMouseDown:l}=chunkEKDRHOOJ_js.c({isOpen:n,onClose:d,align:"right"}),b=o?.table?.attrs?.justification??"left",u=j.useCallback(g=>{e(g),s(false);},[e]),f=(g,h,y,v,P)=>{let L=t||P?.itemDisabled;return jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{...An,backgroundColor:i===g&&!L?"var(--doc-bg-hover)":"transparent",color:L?"var(--doc-text-muted)":P?.danger?"var(--doc-error)":"var(--doc-text)",cursor:L?"not-allowed":"pointer"},onClick:()=>!L&&u(v),onMouseEnter:()=>c(g),onMouseLeave:()=>c(null),disabled:L,children:[jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:h,size:16,className:P?.danger&&!L?"text-red-600":""}),jsxRuntime.jsx("span",{style:{flex:1},children:y})]},g)},x=jsxRuntime.jsx(V,{variant:"ghost",size:"icon-sm",className:I("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",n&&"bg-slate-100",t&&"opacity-30 cursor-not-allowed"),onMouseDown:l,onClick:()=>!t&&s(g=>!g),disabled:t,"aria-label":r("table.moreOptions"),"aria-expanded":n,"aria-haspopup":"menu","data-testid":"toolbar-table-more",children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"more_vert",size:20})});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[n?x:jsxRuntime.jsx(Q,{content:r("table.moreOptions"),children:x}),n&&!t&&jsxRuntime.jsxs("div",{ref:p,style:{...m,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:"4px 0",minWidth:200,maxHeight:"70vh",overflowY:"auto"},role:"menu",onMouseDown:g=>g.stopPropagation(),children:[f("addRowAbove","add",r("table.insertRowAbove"),"addRowAbove"),f("addRowBelow","add",r("table.insertRowBelow"),"addRowBelow"),f("addColumnLeft","add",r("table.insertColumnLeft"),"addColumnLeft"),f("addColumnRight","add",r("table.insertColumnRight"),"addColumnRight"),jsxRuntime.jsx("div",{style:Ue,role:"separator"}),f("mergeCells","call_merge",r("table.mergeCells"),"mergeCells",{itemDisabled:!o?.hasMultiCellSelection}),f("splitCell","call_split",r("table.splitCell"),"splitCell",{itemDisabled:!o?.canSplitCell}),jsxRuntime.jsx("div",{style:Ue,role:"separator"}),f("deleteRow","delete",r("table.deleteRow"),"deleteRow",{danger:true,itemDisabled:(o?.rowCount??0)<=1}),f("deleteColumn","delete",r("table.deleteColumn"),"deleteColumn",{danger:true,itemDisabled:(o?.columnCount??0)<=1}),f("deleteTable","delete",r("table.deleteTable"),"deleteTable",{danger:true}),jsxRuntime.jsx("div",{style:Ue,role:"separator"}),jsxRuntime.jsx("div",{style:Ao,children:r("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["top","center","bottom"].map(g=>{let h={top:"vertical_align_top",center:"vertical_align_center",bottom:"vertical_align_bottom"};return jsxRuntime.jsx("button",{type:"button",title:r({top:"tableAdvanced.top",center:"tableAdvanced.middle",bottom:"tableAdvanced.bottom"}[g]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:"transparent",cursor:"pointer"},onMouseDown:v=>v.preventDefault(),onMouseEnter:v=>{v.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="transparent";},onClick:()=>u({type:"cellVerticalAlign",align:g}),children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:h[g],size:16})},g)})}),jsxRuntime.jsx("div",{style:Ue,role:"separator"}),jsxRuntime.jsx("div",{style:Ao,children:r("tableAdvanced.tableAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["left","center","right"].map(g=>{let h={left:"format_align_left",center:"format_align_center",right:"format_align_right"},y=b===g;return jsxRuntime.jsx("button",{type:"button",title:r({left:"tableAdvanced.alignTableLeft",center:"tableAdvanced.alignTableCenter",right:"tableAdvanced.alignTableRight"}[g]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:y?"var(--doc-primary-light)":"transparent",borderColor:y?"var(--doc-primary)":"var(--doc-border)",color:y?"var(--doc-primary)":"var(--doc-text)",cursor:"pointer"},onMouseDown:v=>v.preventDefault(),onClick:()=>u({type:"tableProperties",props:{justification:g}}),children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:h[g],size:16})},g)})}),jsxRuntime.jsx("div",{style:Ue,role:"separator"}),f("headerRow","table_rows",r("tableAdvanced.toggleHeaderRow"),{type:"toggleHeaderRow"}),f("distribute","view_column",r("tableAdvanced.distributeColumns"),{type:"distributeColumns"}),f("autoFit","fit_width",r("tableAdvanced.autoFit"),{type:"autoFitContents"}),f("noWrap","wrap_text",r("tableAdvanced.toggleNoWrap"),{type:"toggleNoWrap"}),jsxRuntime.jsx("div",{style:Ue,role:"separator"}),f("properties","settings",r("tableAdvanced.tableProperties"),{type:"openTableProperties"})]})]})}var Dn=20;function bt({options:e,activeValue:t,triggerIcon:o,tooltipContent:r,onSelect:n,disabled:s=false,ariaLabel:i,testId:c,showLabels:d=false}){let[a,p]=j.useState(false),m=j.useCallback(()=>p(false),[]),{containerRef:l,dropdownRef:b,dropdownStyle:u,handleMouseDown:f}=chunkEKDRHOOJ_js.c({isOpen:a,onClose:m}),x=j.useCallback(h=>{s||n(h),p(false);},[s,n]),g=jsxRuntime.jsxs(V,{variant:"ghost",size:"icon-sm",className:I("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",a&&"bg-slate-100",s&&"opacity-30 cursor-not-allowed"),onMouseDown:f,onClick:()=>!s&&p(h=>!h),disabled:s,"aria-label":i??r,"aria-expanded":a,"aria-haspopup":"true","data-testid":c,children:[jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:o,size:Dn}),jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:l,style:{position:"relative",display:"inline-block"},children:[a?g:jsxRuntime.jsx(Q,{content:r,children:g}),a&&!s&&jsxRuntime.jsx("div",{ref:b,style:{...u,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:6},onMouseDown:h=>h.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:d?"column":"row",gap:d?1:2,minWidth:d?200:void 0},children:e.map(h=>{let y=t===h.value;return jsxRuntime.jsxs("button",{type:"button",title:h.label,"data-testid":c?`${c}-${h.value}`:void 0,style:{display:"flex",alignItems:"center",height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:y?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:y?"var(--doc-primary)":"var(--doc-text)",...d?{width:"100%",gap:10,padding:"0 10px",justifyContent:"flex-start",fontSize:13,textAlign:"left"}:{width:32,justifyContent:"center"}},onMouseDown:v=>v.preventDefault(),onMouseEnter:v=>{y||(v.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:v=>{v.currentTarget.style.backgroundColor=y?"var(--doc-primary-light)":"transparent";},onClick:()=>x(h.value),children:[jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:h.iconName,size:18}),d&&jsxRuntime.jsx("span",{style:{flex:1},children:h.label})]},h.value)})})})]})}var Bn=[{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 _n(e){return e.displayMode==="float"&&e.cssFloat==="left"?"wrapRight":e.displayMode==="float"&&e.cssFloat==="right"?"wrapLeft":e.wrapType}function _o({imageContext:e,onChange:t,disabled:o=false}){let{t:r}=chunkGNIO6SOS_js.b(),n=Bn.map(c=>({...c,label:r(c.labelKey)})),s=_n(e),i=n.find(c=>c.value===s)||n[0];return jsxRuntime.jsx(bt,{options:n,activeValue:s,triggerIcon:i.iconName,tooltipContent:`Wrap: ${i.label}`,onSelect:t,disabled:o,testId:"toolbar-image-wrap",showLabels:true})}var On=[{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 Fo({onTransform:e,disabled:t=false}){let{t:o}=chunkGNIO6SOS_js.b(),r=On.map(n=>({...n,label:o(n.labelKey)}));return jsxRuntime.jsx(bt,{options:r,triggerIcon:"rotate_right",tooltipContent:o("imageTransform.tooltip"),onSelect:e,disabled:t,testId:"toolbar-image-transform"})}var Qe=j.createContext(null);function Oo(){let e=j.useContext(Qe);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}var le=18;function se({active:e=false,disabled:t=false,title:o,onClick:r,children:n,className:s,ariaLabel:i}){let c=i?.toLowerCase().replace(/\s+/g,"-")||o?.toLowerCase().replace(/\s+/g,"-").replace(/\([^)]*\)/g,"").trim(),d=p=>{p.preventDefault();},a=jsxRuntime.jsx(V,{variant:"ghost",size:"icon-sm",className:I("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",e&&"bg-slate-900 text-white hover:bg-slate-800 hover:text-white",t&&"opacity-30 cursor-not-allowed",s),onMouseDown:d,onClick:t?void 0:r,disabled:t,"aria-pressed":e,"aria-label":i||o,"data-testid":c?`toolbar-${c}`:void 0,children:n});return o?jsxRuntime.jsx(Q,{content:o,children:a}):a}function fe({label:e,children:t,className:o}){return jsxRuntime.jsx("div",{className:I("flex items-center gap-px px-1.5 border-r border-slate-200/50 last:border-r-0 first:pl-0",o),role:"group","aria-label":e,children:t})}function Ws(){return jsxRuntime.jsx("div",{className:"w-px h-6 bg-slate-200 mx-1.5",role:"separator"})}function Gn(e){let t=j__namespace.default.useContext(Qe);return t?{...t,...Un(e)}:e}function Un(e){let t={};for(let o of Object.keys(e))e[o]!==void 0&&(t[o]=e[o]);return t}function zo(e){let{t}=chunkGNIO6SOS_js.b(),o=Gn(e),{currentFormatting:r={},onFormat:n,onUndo:s,onRedo:i,canUndo:c=false,canRedo:d=false,disabled:a=false,className:p,style:m,enableShortcuts:l=true,editorRef:b,children:u,showFontPicker:f=true,fontFamilies:x,showFontSizePicker:g=true,showTextColorPicker:h=true,showHighlightColorPicker:y=true,showAlignmentButtons:v=true,showListButtons:P=true,showLineSpacingPicker:L=true,showStylePicker:ce=true,documentStyles:F,theme:Y,showZoomControl:de=true,zoom:ge,onZoomChange:G,onRefocusEditor:R,imageContext:k,onImageWrapType:_,onImageTransform:ue,onOpenImageProperties:he,tableContext:xe,onTableAction:ye,inline:te=false}=o,Ee=j.useRef(null),O=j.useCallback(A=>{!a&&n&&n(A);},[a,n]),qe=j.useCallback(()=>{!a&&c&&s&&s();},[a,c,s]),oe=j.useCallback(()=>{!a&&d&&i&&i();},[a,d,i]),ze=j.useCallback(A=>{!a&&n&&(n({type:"fontFamily",value:A}),requestAnimationFrame(()=>R?.()));},[a,n,R]),w=j__namespace.default.useMemo(()=>fontOptions.normalizeFontFamilies(x),[x]),W=j.useCallback(A=>{!a&&n&&(n({type:"fontSize",value:A}),requestAnimationFrame(()=>R?.()));},[a,n,R]),ve=j.useCallback(A=>{!a&&n&&(n({type:"textColor",value:A}),requestAnimationFrame(()=>R?.()));},[a,n,R]),St=j.useCallback(A=>{!a&&n&&(n({type:"highlightColor",value:typeof A=="string"?A:""}),requestAnimationFrame(()=>R?.()));},[a,n,R]),E=j.useCallback(A=>{!a&&n&&n({type:"alignment",value:A});},[a,n]),Ae=j.useCallback(()=>{!a&&n&&n("bulletList");},[a,n]),tt=j.useCallback(()=>{!a&&n&&n("numberedList");},[a,n]),Ne=j.useCallback(()=>{!a&&n&&n("indent");},[a,n]),pe=j.useCallback(()=>{!a&&n&&n("outdent");},[a,n]),J=j.useCallback(A=>{!a&&n&&(n({type:"lineSpacing",value:A}),requestAnimationFrame(()=>R?.()));},[a,n,R]),re=j.useCallback(A=>{!a&&n&&(n({type:"applyStyle",value:A}),requestAnimationFrame(()=>R?.()));},[a,n,R]),ne=j.useCallback(A=>{!a&&ye&&(ye(A),requestAnimationFrame(()=>R?.()));},[a,ye,R]);j.useEffect(()=>{if(!l)return;let A=B=>{let Ye=B.target,$t=b?.current,rr=Ee.current,nr=$t?.contains(Ye),ar=rr?.contains(Ye);if(!nr&&!ar)return;if((B.ctrlKey||B.metaKey)&&!B.altKey)switch(B.key.toLowerCase()){case "b":B.preventDefault(),O("bold");break;case "i":B.preventDefault(),O("italic");break;case "u":B.preventDefault(),O("underline");break;case "=":B.shiftKey?(B.preventDefault(),O("superscript")):(B.preventDefault(),O("subscript"));break;case "l":B.preventDefault(),E("left");break;case "e":B.preventDefault(),E("center");break;case "r":B.preventDefault(),E("right");break;case "j":B.preventDefault(),E("both");break;case "k":B.preventDefault(),O("insertLink");break}};return document.addEventListener("keydown",A),()=>{document.removeEventListener("keydown",A);}},[l,O,E,b]);let tr=j.useCallback(A=>{let B=A.target;B.tagName==="INPUT"||B.tagName==="TEXTAREA"||B.tagName==="SELECT"||B.tagName==="OPTION"||A.preventDefault();},[]),or=j.useCallback(A=>{let B=A.target,Ye=document.activeElement;B.tagName==="SELECT"||B.tagName==="OPTION"||Ye?.tagName==="SELECT"||requestAnimationFrame(()=>{R?.();});},[R]);return jsxRuntime.jsxs("div",{ref:Ee,className:I(!te&&"flex items-center px-2 py-1 bg-[#f1f5f9] rounded-full min-h-[36px] overflow-x-auto mx-2 mb-1",p),style:te?{display:"contents",...m}:m,role:te?void 0:"toolbar","aria-label":te?void 0:t("toolbar.ariaLabel"),"data-testid":te?void 0:"formatting-bar",onMouseDown:te?void 0:tr,onMouseUp:te?void 0:or,children:[jsxRuntime.jsxs(fe,{label:t("formattingBar.groups.history"),children:[jsxRuntime.jsx(se,{onClick:qe,disabled:a||!c,title:t("formattingBar.undoShortcut"),ariaLabel:t("formattingBar.undo"),children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"undo",size:le})}),jsxRuntime.jsx(se,{onClick:oe,disabled:a||!d,title:t("formattingBar.redoShortcut"),ariaLabel:t("formattingBar.redo"),children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"redo",size:le})})]}),de&&jsxRuntime.jsx(fe,{label:t("formattingBar.groups.zoom"),children:jsxRuntime.jsx(So,{value:ge,onChange:G,minZoom:.5,maxZoom:2,disabled:a,compact:true,showButtons:false})}),ce&&jsxRuntime.jsx(fe,{label:t("formattingBar.groups.styles"),children:jsxRuntime.jsx(Co,{value:r.styleId||"Normal",onChange:re,styles:F,theme:Y,disabled:a,width:120})}),(f||g)&&jsxRuntime.jsxs(fe,{label:t("formattingBar.groups.font"),children:[f&&jsxRuntime.jsx(lo,{value:r.fontFamily||"Arial",onChange:ze,fonts:w,disabled:a,width:60,placeholder:"Arial"}),g&&jsxRuntime.jsx(Jt,{value:r.fontSize!==void 0?units.halfPointsToPoints(r.fontSize):11,onChange:W,disabled:a,width:42,placeholder:"11"})]}),jsxRuntime.jsxs(fe,{label:t("formattingBar.groups.textFormatting"),children:[jsxRuntime.jsx(se,{onClick:()=>O("bold"),active:r.bold,disabled:a,title:t("formattingBar.boldShortcut"),ariaLabel:t("formattingBar.bold"),children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"format_bold",size:le})}),jsxRuntime.jsx(se,{onClick:()=>O("italic"),active:r.italic,disabled:a,title:t("formattingBar.italicShortcut"),ariaLabel:t("formattingBar.italic"),children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"format_italic",size:le})}),jsxRuntime.jsx(se,{onClick:()=>O("underline"),active:r.underline,disabled:a,title:t("formattingBar.underlineShortcut"),ariaLabel:t("formattingBar.underline"),children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"format_underlined",size:le})}),jsxRuntime.jsx(se,{onClick:()=>O("strikethrough"),active:r.strike,disabled:a,title:t("formattingBar.strikethrough"),ariaLabel:t("formattingBar.strikethrough"),children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"strikethrough_s",size:le})}),h&&jsxRuntime.jsx(_e,{mode:"text",value:r.color?.replace(/^#/,""),onChange:ve,theme:Y,disabled:a,title:t("formattingBar.fontColor")}),y&&jsxRuntime.jsx(_e,{mode:"highlight",value:r.highlight,onChange:St,theme:Y,disabled:a,title:t("formattingBar.highlightColor")}),jsxRuntime.jsx(se,{onClick:()=>O("insertLink"),disabled:a,title:t("formattingBar.insertLinkShortcut"),ariaLabel:t("formattingBar.insertLink"),children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"link",size:le})})]}),jsxRuntime.jsxs(fe,{label:t("formattingBar.groups.script"),children:[jsxRuntime.jsx(se,{onClick:()=>O("superscript"),active:r.superscript,disabled:a,title:t("formattingBar.superscriptShortcut"),ariaLabel:t("formattingBar.superscript"),children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"superscript",size:le})}),jsxRuntime.jsx(se,{onClick:()=>O("subscript"),active:r.subscript,disabled:a,title:t("formattingBar.subscriptShortcut"),ariaLabel:t("formattingBar.subscript"),children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"subscript",size:le})})]}),v&&jsxRuntime.jsx(fe,{label:t("formattingBar.groups.alignment"),children:jsxRuntime.jsx(ho,{value:r.alignment||"left",onChange:E,disabled:a})}),(P||L)&&jsxRuntime.jsxs(fe,{label:t("formattingBar.groups.listFormatting"),children:[P&&jsxRuntime.jsx(to,{listState:r.listState||listState.createDefaultListState(),onBulletList:Ae,onNumberedList:tt,onIndent:Ne,onOutdent:pe,disabled:a,showIndentButtons:true,compact:true,hasIndent:(r.indentLeft??0)>0}),L&&jsxRuntime.jsx(yo,{value:r.lineSpacing,onChange:J,disabled:a})]}),k&&_&&jsxRuntime.jsxs(fe,{label:t("formattingBar.groups.image"),children:[jsxRuntime.jsx(_o,{imageContext:k,onChange:_,disabled:a}),ue&&jsxRuntime.jsx(Fo,{onTransform:ue,disabled:a}),he&&jsxRuntime.jsx(se,{onClick:he,disabled:a,title:t("formattingBar.imagePropertiesShortcut"),ariaLabel:t("formattingBar.imageProperties"),children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"tune",size:le})})]}),xe?.isInTable&&ye&&jsxRuntime.jsxs(fe,{label:t("formattingBar.groups.table"),children:[jsxRuntime.jsx(ko,{onAction:ne,disabled:a}),jsxRuntime.jsx(Po,{onAction:ne,disabled:a,theme:Y,value:utils.resolveColorToHex(xe?.cellBorderColor,Y)}),jsxRuntime.jsx(Io,{onAction:ne,disabled:a}),jsxRuntime.jsx(Lo,{onAction:ne,disabled:a,theme:Y,value:xe?.cellBackgroundColor}),jsxRuntime.jsx(No,{onAction:ne,disabled:a,tableContext:xe})]}),jsxRuntime.jsx(se,{onClick:()=>O("clearFormatting"),disabled:a,title:t("formattingBar.clearFormatting"),ariaLabel:t("formattingBar.clearFormatting"),children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"format_clear",size:le})}),u]})}function qn(e){return "type"in e&&e.type==="separator"}var Vo={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, #374151)",whiteSpace:"nowrap",height:28,lineHeight:"28px"},Yn={...Vo,background:"var(--doc-hover, #f3f4f6)"},$o={display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:"pointer",fontSize:13,color:"var(--doc-text, #374151)",width:"100%",textAlign:"left",whiteSpace:"nowrap"},Xn={...$o,opacity:.4,cursor:"default"},jn={height:1,backgroundColor:"var(--doc-border, #e5e7eb)",margin:"4px 0"},Jn={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted, #9ca3af)"},Qn={position:"absolute",left:"100%",top:-4,marginLeft:2,backgroundColor:"white",border:"1px solid var(--doc-border, #d1d5db)",borderRadius:6,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.12)",padding:8,zIndex:1001};function et({label:e,items:t,disabled:o,showChevron:r=false}){let[n,s]=j.useState(false),[i,c]=j.useState(null),d=j.useRef(null),a=j.useRef(null),[p,m]=j.useState({top:0,left:0}),l=j.useCallback(()=>{s(false),c(null);},[]);j.useEffect(()=>{if(!n||!d.current)return;let u=d.current.getBoundingClientRect();m({top:u.bottom+2,left:u.left});},[n]),j.useEffect(()=>{if(!n)return;function u(g){let h=g.target;d.current&&!d.current.contains(h)&&a.current&&!a.current.contains(h)&&l();}function f(g){g.key==="Escape"&&l();}function x(){l();}return document.addEventListener("mousedown",u),document.addEventListener("keydown",f),window.addEventListener("scroll",x,true),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",f),window.removeEventListener("scroll",x,true);}},[n,l]);let b=u=>{u.disabled||u.submenuContent||u.onClick&&(u.onClick(),l());};return jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:d,type:"button",onClick:()=>!o&&s(!n),onMouseDown:u=>u.preventDefault(),disabled:o,style:n?Yn:Vo,children:[e,r&&jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"arrow_drop_down",size:16})]}),n&&jsxRuntime.jsx("div",{ref:a,style:{position:"fixed",top:p.top,left:p.left,backgroundColor:"white",border:"1px solid var(--doc-border, #d1d5db)",borderRadius:6,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.12)",padding:"4px 0",zIndex:1e4,minWidth:200},onMouseDown:u=>u.preventDefault(),children:t.map((u,f)=>{if(qn(u))return jsxRuntime.jsx("div",{style:jn},`sep-${f}`);let x=u;if(x.customContent)return jsxRuntime.jsx("div",{onMouseDown:y=>y.preventDefault(),children:x.customContent},x.label);let g=!!x.submenuContent,h=i===x.label;return jsxRuntime.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>g&&c(x.label),onMouseLeave:()=>g&&c(null),children:[jsxRuntime.jsxs("button",{type:"button",style:x.disabled?Xn:$o,onClick:()=>b(x),onMouseDown:y=>y.preventDefault(),onMouseOver:y=>{x.disabled||(y.currentTarget.style.backgroundColor="var(--doc-hover, #f3f4f6)");},onMouseOut:y=>{y.currentTarget.style.backgroundColor="transparent";},disabled:x.disabled,children:[x.icon&&jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:x.icon,size:18}),jsxRuntime.jsx("span",{children:x.label}),x.shortcut&&jsxRuntime.jsx("span",{style:Jn,children:x.shortcut}),g&&jsxRuntime.jsx("span",{style:{marginLeft:"auto"},children:jsxRuntime.jsx(chunkEKDRHOOJ_js.b,{name:"keyboard_arrow_right",size:16})})]}),g&&h&&jsxRuntime.jsx("div",{style:Qn,onMouseDown:y=>y.preventDefault(),children:x.submenuContent(l)})]},x.label)})})]})}var Bt=18,ta=2,Uo={width:Bt,height:Bt,backgroundColor:"white",border:"1px solid var(--doc-border, #d1d5db)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},oa={...Uo,backgroundColor:"var(--doc-primary, #3b82f6)",border:"1px solid var(--doc-primary, #3b82f6)"},ra={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text, #374151)",textAlign:"center"};function Zo({onInsert:e,gridRows:t=6,gridColumns:o=6}){let[r,n]=j.useState(0),[s,i]=j.useState(0),c=j.useCallback(()=>{r>0&&s>0&&e(r,s);},[r,s,e]),d=[];for(let p=1;p<=t;p++)for(let m=1;m<=o;m++){let l=p<=r&&m<=s;d.push(jsxRuntime.jsx("div",{style:l?oa:Uo,onMouseEnter:()=>{n(p),i(m);},onClick:c,role:"gridcell","aria-selected":l},`${p}-${m}`));}let a=r>0&&s>0?`${s} \xD7 ${r}`:"Select size";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{display:"grid",gap:ta,gridTemplateColumns:`repeat(${o}, ${Bt}px)`},onMouseLeave:()=>{n(0),i(0);},role:"grid","aria-label":"Table size selector",children:d}),jsxRuntime.jsx("div",{style:ra,children:a})]})}function la(){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 Ft({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function sa(e){return e.replace(/\.docx$/i,"")}function Yo({value:e,onChange:t,placeholder:o,editable:r=true}){let{t:n}=chunkGNIO6SOS_js.b(),s=o??n("titleBar.untitled"),i=sa(e)??"";return r?jsxRuntime.jsx("input",{type:"text",value:i,onChange:c=>{let d=c.target.value;t?.(d.endsWith(".docx")?d:d+".docx");},placeholder:s,className:"text-base font-normal text-slate-800 bg-transparent border-0 outline-none px-2 py-0 rounded hover:bg-slate-50 focus:bg-white focus:ring-1 focus:ring-slate-300 min-w-[100px] max-w-[300px] truncate leading-tight","aria-label":n("titleBar.documentNameAriaLabel")}):jsxRuntime.jsx("span",{className:"text-base font-normal text-slate-800 px-2 py-0 min-w-[100px] max-w-[300px] truncate leading-tight",children:i||s})}function Ot({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function Kt(){let{t:e}=chunkGNIO6SOS_js.b(),t=Oo(),{disabled:o=false,onFormat:r,onPrint:n,onOpen:s,onSave:i,onPageSetup:c,onInsertImage:d,onInsertTable:a,showTableInsert:p=true,onInsertPageBreak:m,onInsertTOC:l,onWatermark:b,onRefocusEditor:u}=t,f=j.useCallback(y=>{!o&&r&&r(y);},[o,r]),x=j.useCallback((y,v)=>{!o&&a&&(a(y,v),requestAnimationFrame(()=>u?.()));},[o,a,u]),g=!!n||!!c,h=g||s||i;return jsxRuntime.jsxs("div",{className:"flex items-center",role:"menubar","aria-label":e("titleBar.menuBarAriaLabel"),children:[h&&jsxRuntime.jsx(et,{label:e("toolbar.file"),disabled:o,items:[...s?[{icon:"file_upload",label:e("toolbar.open"),shortcut:e("toolbar.openShortcut"),onClick:s}]:[],...i?[{icon:"file_download",label:e("toolbar.save"),shortcut:e("toolbar.saveShortcut"),onClick:i}]:[],...(s||i)&&g?[{type:"separator"}]:[],...n?[{icon:"print",label:e("toolbar.print"),shortcut:e("toolbar.printShortcut"),onClick:n}]:[],...c?[{icon:"settings",label:e("toolbar.pageSetup"),onClick:c}]:[]]}),jsxRuntime.jsx(et,{label:e("toolbar.format"),disabled:o,items:[{icon:"format_textdirection_l_to_r",label:e("toolbar.leftToRight"),onClick:()=>f("setLtr")},{icon:"format_textdirection_r_to_l",label:e("toolbar.rightToLeft"),onClick:()=>f("setRtl")}]}),jsxRuntime.jsx(et,{label:e("toolbar.insert"),disabled:o,items:[...d?[{icon:"image",label:e("toolbar.image"),onClick:d}]:[],...p&&a?[{icon:"grid_on",label:e("toolbar.table"),submenuContent:y=>jsxRuntime.jsx(Zo,{onInsert:(v,P)=>{x(v,P),y();}})}]:[],...d||p&&a?[{type:"separator"}]:[],{icon:"page_break",label:e("toolbar.pageBreak"),onClick:m,disabled:!m},{icon:"format_list_numbered",label:e("toolbar.tableOfContents"),onClick:l,disabled:!l},...b?[{icon:"branding_watermark",label:e("toolbar.watermark"),onClick:b}]:[]]}),jsxRuntime.jsx(et,{label:e("toolbar.help"),disabled:o,items:[{label:e("toolbar.reportIssue"),onClick:()=>reportIssue.openReportIssue()}]})]})}function Xo({children:e}){let t=null,o=null,r=[],n=[];j.Children.forEach(e,i=>{j.isValidElement(i)&&(i.type===Ft?t=i:i.type===Ot?o=i:i.type===Kt?n.push(i):r.push(i));});let s=j.useCallback(i=>{let c=i.target;c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.tagName==="SELECT"||c.tagName==="OPTION"||i.preventDefault();},[]);return jsxRuntime.jsxs("div",{className:"flex items-stretch bg-white pt-2 pb-1",onMouseDown:s,"data-testid":"title-bar",children:[jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 pl-3 pr-1",children:t||jsxRuntime.jsx(la,{})}),jsxRuntime.jsxs("div",{className:"flex flex-col justify-center flex-1 min-w-0 py-1",children:[r.length>0&&jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-1",children:r}),n.length>0&&jsxRuntime.jsx("div",{className:"flex items-center px-1",children:n})]}),o&&jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 px-3",children:o})]})}function ca({children:e,className:t,style:o,...r}){return jsxRuntime.jsx(Qe.Provider,{value:r,children:jsxRuntime.jsx("div",{className:I("flex flex-col bg-white shadow-sm flex-shrink-0",t),style:o,"data-testid":"editor-toolbar",children:e})})}var Ze=ca;Ze.TitleBar=Xo;Ze.Logo=Ft;Ze.DocumentName=Yo;Ze.MenuBar=Kt;Ze.TitleBarRight=Ot;Ze.Toolbar=zo;var Qo=12240,yt=1440,vt=1440,Ct=567,Ht=22,pa="var(--doc-text-muted)",ma="var(--doc-text-subtle)",Jo="rgba(0, 0, 0, 0.02)",fa="#4285f4",ba="#3367d6",ga="#2a56c6",Ke=5;function ha(e,t){return t==="inch"?(e/vt).toFixed(2)+'"':(e/Ct).toFixed(1)+" cm"}function vc({sectionProps:e,zoom:t=1,editable:o=false,onLeftMarginChange:r,onRightMarginChange:n,onFirstLineIndentChange:s,showFirstLineIndent:i=false,firstLineIndent:c=0,hangingIndent:d=false,indentLeft:a=0,indentRight:p=0,onIndentLeftChange:m,onIndentRightChange:l,unit:b="inch",className:u="",style:f,tabStops:x,onTabStopRemove:g}){let{t:h}=chunkGNIO6SOS_js.b(),[y,v]=j.useState(null),[P,L]=j.useState(null),[ce,F]=j.useState(null),[Y,de]=j.useState(null),ge=j.useRef(null),G=e?.pageWidth??Qo,R=e?.marginLeft??yt,k=e?.marginRight??yt,_=G-R-k,ue=utils.twipsToPixels(G)*t,he=utils.twipsToPixels(R)*t,xe=utils.twipsToPixels(k)*t,ye=utils.twipsToPixels(a)*t,te=utils.twipsToPixels(p)*t,Ee=d?-c:c,O=utils.twipsToPixels(Ee)*t,qe=he+ye,oe=ue-xe-te,ze=he+ye+O,w=j.useCallback((E,Ae)=>{o&&(E.preventDefault(),E.stopPropagation(),v(Ae));},[o]),W=j.useCallback(E=>{if(!y||!ge.current)return;let Ae=ge.current.getBoundingClientRect(),tt=E.clientX-Ae.left;de(tt);let Ne=utils.pixelsToTwips(tt/t);if(y==="leftMargin"){let pe=G-k-720,J=Math.round(Math.max(0,Math.min(Ne,pe)));F(J),r?.(J);}else if(y==="rightMargin"){let pe=G-Ne,J=G-R-720,re=Math.round(Math.max(0,Math.min(pe,J)));F(re),n?.(re);}else if(y==="firstLineIndent"){let pe=R+a,J=Ne-pe,re=_-a-p-720,ne=Math.round(Math.max(-a,Math.min(J,re)));F(ne),s?.(ne);}else if(y==="leftIndent"){let pe=Ne-R,J=_-p-720,re=Math.round(Math.max(0,Math.min(pe,J)));F(re),m?.(re);}else if(y==="rightIndent"){let J=G-k-Ne,re=_-a-720,ne=Math.round(Math.max(0,Math.min(J,re)));F(ne),l?.(ne);}},[y,t,G,R,k,_,a,p,r,n,s,m,l]),ve=j.useCallback(()=>{v(null),F(null),de(null);},[]);j.useEffect(()=>{if(y)return document.addEventListener("mousemove",W),document.addEventListener("mouseup",ve),()=>{document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",ve);}},[y,W,ve]);let St=Sa(G,t,b);return jsxRuntime.jsxs("div",{ref:ge,className:`docx-horizontal-ruler ${u}`,style:{position:"relative",width:utils.formatPx(ue),height:Ht,backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:y?"ew-resize":"default",...f},role:"slider","aria-label":h("ruler.horizontal"),"aria-valuemin":0,"aria-valuemax":G,children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:utils.formatPx(he),height:Ht,backgroundColor:Jo,borderRight:"1px solid rgba(0,0,0,0.06)",cursor:o?"ew-resize":"default",zIndex:1},onMouseDown:o&&r?E=>w(E,"leftMargin"):void 0}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,right:0,width:utils.formatPx(xe),height:Ht,backgroundColor:Jo,borderLeft:"1px solid rgba(0,0,0,0.06)",cursor:o?"ew-resize":"default",zIndex:1},onMouseDown:o&&n?E=>w(E,"rightMargin"):void 0}),jsxRuntime.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:St.map((E,Ae)=>jsxRuntime.jsx(xa,{tick:E},Ae))}),i&&jsxRuntime.jsx(Wt,{direction:"down",positionPx:ze,editable:o,isDragging:y==="firstLineIndent",isHovered:P==="firstLineIndent",onMouseEnter:()=>L("firstLineIndent"),onMouseLeave:()=>L(null),onMouseDown:E=>w(E,"firstLineIndent"),label:h("ruler.firstLineIndent")}),o&&m&&jsxRuntime.jsx(Wt,{direction:"up",positionPx:qe,editable:o,isDragging:y==="leftIndent",isHovered:P==="leftIndent",onMouseEnter:()=>L("leftIndent"),onMouseLeave:()=>L(null),onMouseDown:E=>w(E,"leftIndent"),label:h("ruler.leftIndent")}),o&&l&&jsxRuntime.jsx(Wt,{direction:"down",positionPx:oe,editable:o,isDragging:y==="rightIndent",isHovered:P==="rightIndent",onMouseEnter:()=>L("rightIndent"),onMouseLeave:()=>L(null),onMouseDown:E=>w(E,"rightIndent"),label:h("ruler.rightIndent")}),x?.map(E=>jsxRuntime.jsx(Ca,{tabStop:E,positionPx:utils.twipsToPixels(E.position)*t,onDoubleClick:()=>g?.(E.position)},E.position)),y&&ce!==null&&Y!==null&&jsxRuntime.jsx(ya,{value:ha(ce,b),positionPx:Y})]})}function xa({tick:e}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:{position:"absolute",left:utils.formatPx(e.position),bottom:0,width:1,height:e.height,backgroundColor:ma}}),e.label&&jsxRuntime.jsx("div",{style:{position:"absolute",left:utils.formatPx(e.position),top:3,transform:"translateX(-50%)",fontSize:"9px",color:pa,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:e.label})]})}function Wt({direction:e,positionPx:t,editable:o,isDragging:r,isHovered:n,onMouseEnter:s,onMouseLeave:i,onMouseDown:c,label:d}){let a=r?ga:n?ba:fa,p=Math.round(Ke*1.6),m={position:"absolute",left:utils.formatPx(t-Ke),width:Ke*2,height:p+2,cursor:o?"ew-resize":"default",zIndex:r?10:4,...e==="down"?{top:0}:{bottom:0}},l=e==="down"?{position:"absolute",top:1,left:0,width:0,height:0,borderLeft:`${Ke}px solid transparent`,borderRight:`${Ke}px solid transparent`,borderTop:`${p}px solid ${a}`,transition:"border-top-color 0.1s"}:{position:"absolute",bottom:1,left:0,width:0,height:0,borderLeft:`${Ke}px solid transparent`,borderRight:`${Ke}px solid transparent`,borderBottom:`${p}px solid ${a}`,transition:"border-bottom-color 0.1s"};return jsxRuntime.jsx("div",{className:"docx-ruler-indent",style:m,onMouseEnter:s,onMouseLeave:i,onMouseDown:c,role:"slider","aria-label":d,"aria-orientation":"horizontal",tabIndex:o?0:-1,children:jsxRuntime.jsx("div",{style:l})})}function ya({value:e,positionPx:t}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:utils.formatPx(t),top:-22,transform:"translateX(-50%)",backgroundColor:"#333",color:"#fff",fontSize:"10px",fontFamily:"sans-serif",padding:"2px 6px",borderRadius:3,whiteSpace:"nowrap",pointerEvents:"none",zIndex:20},children:e})}var va={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function Ca({tabStop:e,positionPx:t,onDoubleClick:o}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:utils.formatPx(t-5),bottom:0,width:10,height:12,display:"flex",alignItems:"center",justifyContent:"center",fontSize:8,fontWeight:700,color:"#555",cursor:"pointer",userSelect:"none"},onDoubleClick:r=>{r.stopPropagation(),o();},title:`${e.alignment} tab at ${(e.position/1440).toFixed(2)}"`,children:va[e.alignment]||"L"})}function Sa(e,t,o){let r=[];if(o==="inch"){let n=vt/8,s=Math.ceil(e/n);for(let i=0;i<=s;i++){let c=i*n;if(c>e)break;let d=utils.twipsToPixels(c)*t;i%8===0?r.push({position:d,height:10,label:i/8>0?String(i/8):void 0}):i%4===0?r.push({position:d,height:6}):i%2===0?r.push({position:d,height:4}):r.push({position:d,height:2});}}else {let n=Ct/10,s=Math.ceil(e/n);for(let i=0;i<=s;i++){let c=i*n;if(c>e)break;let d=utils.twipsToPixels(c)*t;i%10===0?r.push({position:d,height:10,label:i/10>0?String(i/10):void 0}):i%5===0?r.push({position:d,height:6}):r.push({position:d,height:3});}}return r}function Cc(e,t,o,r){let n=utils.pixelsToTwips(e/r);return t==="left"?Math.max(0,n):Math.max(0,utils.pixelsToTwips(o/r)-n)}function Sc(e,t=1){let o=e?.pageWidth??Qo,r=e?.marginLeft??yt,n=e?.marginRight??yt,s=utils.twipsToPixels(o)*t,i=utils.twipsToPixels(r)*t,c=utils.twipsToPixels(n)*t;return {width:s,leftMargin:i,rightMargin:c,contentWidth:s-i-c}}function wc(e,t){return t==="inch"?(e/vt).toFixed(2)+'"':(e/Ct).toFixed(1)+" cm"}function Tc(e,t){let o=parseFloat(e.replace(/[^\d.]/g,""));return isNaN(o)?null:Math.round(o*(t==="inch"?vt:Ct))}
|
|
2
|
-
Object.defineProperty(exports,"d",{enumerable:true,get:function(){return units.pointsToHalfPoints}});Object.defineProperty(exports,"f",{enumerable:true,get:function(){return listState.createDefaultListState}});Object.defineProperty(exports,"g",{enumerable:true,get:function(){return highlightColors.mapHexToHighlightName}});exports.A=se;exports.B=fe;exports.C=Ws;exports.D=zo;exports.E=Ze;exports.F=vc;exports.G=Cc;exports.H=Sc;exports.I=wc;exports.J=Tc;exports.a=I;exports.b=V;exports.c=Jt;exports.e=to;exports.h=ro;exports.i=di;exports.j=ui;exports.k=pi;exports.l=mi;exports.m=fi;exports.n=bi;exports.o=Q;exports.p=lo;exports.q=_e;exports.r=ho;exports.s=yo;exports.t=Co;exports.u=So;exports.v=ko;exports.w=Po;exports.x=Io;exports.y=Lo;exports.z=No;
|
package/dist/chunk-72ZQJWN2.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {b,c,a}from'./chunk-3L2QMHNA.mjs';import {b as b$1}from'./chunk-ZFZJRL2R.mjs';import*as j from'react';import j__default,{createContext,useState,useRef,useCallback,useMemo,useEffect,Children,isValidElement,useContext}from'react';import {clsx}from'clsx';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {halfPointsToPoints}from'@eigenpal/docx-editor-core/utils/units';export{pointsToHalfPoints as d}from'@eigenpal/docx-editor-core/utils/units';import {createDefaultListState}from'@eigenpal/docx-editor-core/utils/listState';export{createDefaultListState as f}from'@eigenpal/docx-editor-core/utils/listState';import {en as en$1}from'@eigenpal/docx-editor-i18n';import*as N from'@radix-ui/react-select';import {generateThemeTintShadeMatrix,resolveColorToHex,twipsToPixels,pixelsToTwips,formatPx,resolveHighlightColor,resolveColor}from'@eigenpal/docx-editor-core/utils';import {normalizeFontFamilies}from'@eigenpal/docx-editor-core/utils/fontOptions';export{mapHexToHighlightName as g}from'@eigenpal/docx-editor-core/utils/highlightColors';import {openReportIssue}from'@eigenpal/docx-editor-core/utils/reportIssue';var Ut=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Zt=clsx,qt=(e,t)=>o=>{var r;if(t?.variants==null)return Zt(e,o?.class,o?.className);let{variants:n,defaultVariants:s}=t,i=Object.keys(n).map(a=>{let p=o?.[a],m=s?.[a];if(p===null)return null;let l=Ut(p)||Ut(m);return n[a][l]}),c=o&&Object.entries(o).reduce((a,p)=>{let[m,l]=p;return l===void 0||(a[m]=l),a},{}),d=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((a,p)=>{let{class:m,className:l,...b}=p;return Object.entries(b).every(u=>{let[f,x]=u;return Array.isArray(x)?x.includes({...s,...c}[f]):{...s,...c}[f]===x})?[...a,m,l]:a},[]);return Zt(e,i,d,o?.class,o?.className)};function I(...e){return clsx(e)}var sr=qt("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"}}),V=j.forwardRef(({className:e,variant:t,size:o,...r},n)=>jsx("button",{className:I(sr({variant:t,size:o,className:e})),ref:n,...r}));V.displayName="Button";var ur=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],pr=1,mr=400;function Xt(e,t,o){for(let r of t)if(r>e)return r;return Math.min(e+1,o)}function jt(e,t,o){for(let r=t.length-1;r>=0;r--)if(t[r]<e)return t[r];return Math.max(e-1,o)}function Jt({value:e,onChange:t,sizes:o=ur,disabled:r=false,className:n,placeholder:s="11",minSize:i=pr,maxSize:c$1=mr}){let{t:d}=b$1(),[a,p]=useState(false),[m,l]=useState(""),[b$2,u]=useState(false),f=useRef(null),x=useCallback(()=>{u(false),p(false);},[]),{containerRef:g,dropdownRef:h,dropdownStyle:y}=c({isOpen:b$2,onClose:x}),v=e??(parseInt(s,10)||11),P=e!==void 0?e.toString():s,L=useCallback(k=>{if(k.preventDefault(),r)return;let _=jt(v,o,i);t?.(_);},[v,o,i,r,t]),ce=useCallback(k=>{if(k.preventDefault(),r)return;let _=Xt(v,o,c$1);t?.(_);},[v,o,c$1,r,t]),F=useCallback(k=>{k.preventDefault(),!r&&(p(true),l(P),u(true),requestAnimationFrame(()=>{f.current?.focus(),f.current?.select();}));},[r,P]),Y=useCallback(k=>{l(k.target.value);},[]),de=useCallback(()=>{p(false);let k=parseFloat(m);if(!isNaN(k)&&k>=i&&k<=c$1){let _=Math.round(k*2)/2;t?.(_);}},[m,i,c$1,t]),ge=useCallback(k=>{if(k.key==="Enter")k.preventDefault(),de(),u(false);else if(k.key==="Escape")p(false),u(false);else if(k.key==="ArrowUp"){k.preventDefault();let _=Xt(v,o,c$1);l(_.toString()),t?.(_);}else if(k.key==="ArrowDown"){k.preventDefault();let _=jt(v,o,i);l(_.toString()),t?.(_);}},[de,v,o,c$1,i,t]),G=useCallback(k=>{t?.(k),u(false),p(false);},[t]),R=useCallback(k=>{k.target.tagName!=="INPUT"&&k.preventDefault();},[]);return jsxs("div",{ref:g,className:I("flex items-center",n),onMouseDown:R,children:[jsx(V,{variant:"ghost",size:"icon-sm",className:I("h-7 w-7 text-slate-500 hover:text-slate-900 hover:bg-slate-100/80 rounded-r-none",r&&"opacity-30 cursor-not-allowed"),onMouseDown:L,disabled:r||v<=i,"aria-label":d("fontSize.decrease"),"data-testid":"font-size-decrease",children:jsx(b,{name:"remove",size:18})}),jsx("div",{className:"relative",children:a?jsx("input",{ref:f,type:"text",value:m,onChange:Y,onBlur:de,onKeyDown:ge,className:I("h-7 w-10 text-center text-sm border border-slate-300 bg-white","focus:outline-none focus:ring-1 focus:ring-slate-400","rounded-none"),"aria-label":d("fontSize.label"),"data-testid":"font-size-input"}):jsx("button",{type:"button",onClick:F,className:I("h-7 w-10 text-center text-sm border border-slate-200 bg-white","hover:border-slate-300 hover:bg-slate-50","focus:outline-none focus:ring-1 focus:ring-slate-400","rounded-none",r&&"opacity-50 cursor-not-allowed"),disabled:r,"aria-label":d("fontSize.label"),"aria-haspopup":"listbox","aria-expanded":b$2,"data-testid":"font-size-display",children:P})}),b$2&&jsx("div",{ref:h,style:{...y,backgroundColor:"white",border:"1px solid #e2e8f0",borderRadius:6,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.12)",maxHeight:240,overflowY:"auto",minWidth:60},role:"listbox","aria-label":d("fontSize.listLabel"),children:o.map(k=>jsx("button",{type:"button",onClick:()=>G(k),className:I("w-full px-3 py-1.5 text-sm text-left","hover:bg-slate-100",k===v&&"bg-slate-100 font-medium"),role:"option","aria-selected":k===v,children:k},k))}),jsx(V,{variant:"ghost",size:"icon-sm",className:I("h-7 w-7 text-slate-500 hover:text-slate-900 hover:bg-slate-100/80 rounded-l-none",r&&"opacity-30 cursor-not-allowed"),onMouseDown:ce,disabled:r||v>=c$1,"aria-label":d("fontSize.increase"),"data-testid":"font-size-increase",children:jsx(b,{name:"add",size:18})})]})}var hr={display:"inline-flex",alignItems:"center",gap:"4px"},eo={display:"inline-flex",alignItems:"center",gap:"4px"},at={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)"},xr={...at,backgroundColor:"var(--doc-bg-hover)"},yr={...at,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},vr={...at,cursor:"default",opacity:.38},Cr={width:"28px",height:"28px",padding:"2px"},Sr={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},ot=20;function rt({active:e=false,disabled:t=false,title:o,onClick:r,children:n,className:s,style:i}){let[c,d]=useState(false),a={...t?vr:e?yr:c?xr:at,...i},p=m=>{m.preventDefault();};return jsx("button",{type:"button",className:`docx-list-button ${e?"docx-list-button-active":""} ${t?"docx-list-button-disabled":""} ${s||""}`,style:a,onMouseDown:p,onClick:t?void 0:r,onMouseEnter:()=>d(true),onMouseLeave:()=>d(false),disabled:t,title:o,"aria-label":o,"aria-pressed":e,role:"button",children:n})}function to({listState:e,onBulletList:t,onNumberedList:o,onIndent:r,onOutdent:n,disabled:s=false,className:i,style:c,showIndentButtons:d=true,compact:a=false,hasIndent:p=false}){let{t:m}=b$1(),l=useCallback(()=>a?{...Cr}:{},[a]),b$2=e?.type==="bullet",u=e?.type==="numbered",x=(e?.isInList||b$2||u)&&(e?.level??0)>0||p;return jsxs("div",{className:`docx-list-buttons ${i||""}`,style:{...hr,...c},role:"group","aria-label":m("lists.ariaLabel"),children:[jsxs("div",{style:eo,role:"group","aria-label":m("lists.typeAriaLabel"),children:[jsx(rt,{active:b$2,disabled:s,title:m("lists.bulletList"),onClick:t,style:l(),children:jsx(b,{name:"format_list_bulleted",size:ot})}),jsx(rt,{active:u,disabled:s,title:m("lists.numberedList"),onClick:o,style:l(),children:jsx(b,{name:"format_list_numbered",size:ot})})]}),d&&jsxs(Fragment,{children:[jsx("div",{style:Sr,role:"separator"}),jsxs("div",{style:eo,role:"group","aria-label":m("lists.indentationAriaLabel"),children:[jsx(rt,{active:false,disabled:s||!x,title:m("lists.decreaseIndent"),onClick:n,style:l(),children:jsx(b,{name:"format_indent_decrease",size:ot})}),jsx(rt,{active:false,disabled:s,title:m("lists.increaseIndent"),onClick:r,style:l(),children:jsx(b,{name:"format_indent_increase",size:ot})})]})]})]})}var ro={hfInlineEditor:10,ruler:30,dropdown:100,contextMenu:1e4};var ao=[{action:"cut",labelKey:"contextMenu.cut",shortcutKey:"contextMenu.cutShortcut"},{action:"copy",labelKey:"contextMenu.copy",shortcutKey:"contextMenu.copyShortcut"},{action:"paste",labelKey:"contextMenu.paste",shortcutKey:"contextMenu.pasteShortcut"},{action:"pasteAsPlainText",labelKey:"contextMenu.pastePlainText",shortcutKey:"contextMenu.pastePlainTextShortcut",dividerAfter:true},{action:"delete",labelKey:"contextMenu.delete",shortcutKey:"contextMenu.deleteShortcut",dividerAfter:true},{action:"selectAll",labelKey:"contextMenu.selectAll",shortcutKey:"contextMenu.selectAllShortcut"}],Pr=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"4",cy:"12",r:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("circle",{cx:"12",cy:"12",r:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5.5 10.5L10.5 3M10.5 10.5L5.5 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Mr=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"5",y:"5",width:"8",height:"9",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M11 5V3a1 1 0 00-1-1H4a1 1 0 00-1 1v8a1 1 0 001 1h2",stroke:"currentColor",strokeWidth:"1.5"})]}),Ir=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"3",y:"3",width:"10",height:"11",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 3V2a1 1 0 011-1h2a1 1 0 011 1v1",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 8h4M6 11h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Lr=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Rr=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"1",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"2 2"}),jsx("rect",{x:"4",y:"4",width:"8",height:"8",fill:"currentColor",opacity:"0.3"})]}),Er=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"6",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsx("rect",{x:"2",y:"10",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsx("path",{d:"M8 1v3M6.5 2.5h3",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),Ar=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"2",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsx("rect",{x:"2",y:"6",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsx("path",{d:"M8 12v3M6.5 13.5h3",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),Nr=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"2",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsx("rect",{x:"2",y:"6",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2",opacity:"0.3"}),jsx("rect",{x:"2",y:"10",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsx("path",{d:"M5 8h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Dr=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"6",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsx("rect",{x:"10",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsx("path",{d:"M3 8H0.5M1.75 6.5v3",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),Br=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsx("rect",{x:"6",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsx("path",{d:"M13 8h2.5M14.25 6.5v3",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),_r=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsx("rect",{x:"6",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2",opacity:"0.3"}),jsx("rect",{x:"10",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsx("path",{d:"M8 5v6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Fr=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"4",width:"4",height:"8",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsx("rect",{x:"10",y:"4",width:"4",height:"8",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsx("path",{d:"M7 8h2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M8 7l1 1-1 1",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),Or=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"4",width:"12",height:"8",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsx("path",{d:"M8 4v8",stroke:"currentColor",strokeWidth:"1.2",strokeDasharray:"2 1"}),jsx("path",{d:"M6.5 8h-1M9.5 8h1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Kr=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M3 3h10a1 1 0 011 1v6a1 1 0 01-1 1H6l-3 2.5V11H3a1 1 0 01-1-1V4a1 1 0 011-1z",stroke:"currentColor",strokeWidth:"1.3"}),jsx("path",{d:"M5 6h6M5 8.5h4",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]});function zr(e){switch(e){case "cut":return jsx(Pr,{});case "copy":return jsx(Mr,{});case "paste":case "pasteAsPlainText":return jsx(Ir,{});case "delete":return jsx(Lr,{});case "selectAll":return jsx(Rr,{});case "addRowAbove":return jsx(Er,{});case "addRowBelow":return jsx(Ar,{});case "deleteRow":return jsx(Nr,{});case "addColumnLeft":return jsx(Dr,{});case "addColumnRight":return jsx(Br,{});case "deleteColumn":return jsx(_r,{});case "mergeCells":return jsx(Fr,{});case "splitCell":return jsx(Or,{});case "addComment":return jsx(Kr,{});default:return null}}var Hr=({item:e,onClick:t,isHighlighted:o,onMouseEnter:r})=>e.action==="separator"?jsx("div",{className:"docx-text-context-menu-separator",style:{height:"1px",backgroundColor:"var(--doc-border)",margin:"4px 12px"}}):jsxs(Fragment,{children:[jsxs("button",{type:"button",className:`docx-text-context-menu-item ${o?"docx-text-context-menu-item-highlighted":""} ${e.disabled?"docx-text-context-menu-item-disabled":""}`,onClick:t,onMouseEnter:r,disabled:e.disabled,role:"menuitem","aria-disabled":e.disabled,style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"8px 12px",border:"none",background:o&&!e.disabled?"var(--doc-primary-light)":"transparent",cursor:e.disabled?"not-allowed":"pointer",fontSize:"13px",color:e.disabled?"var(--doc-text-subtle)":"var(--doc-text)",textAlign:"left",opacity:e.disabled?.6:1},children:[jsx("span",{style:{display:"flex",color:e.disabled?"var(--doc-border)":"var(--doc-text-muted)"},children:zr(e.action)}),jsx("span",{style:{flex:1},children:e.label}),e.shortcut&&jsx("span",{style:{fontSize:"11px",color:"var(--doc-text-subtle)",fontFamily:"monospace"},children:e.shortcut})]}),e.dividerAfter&&jsx("div",{className:"docx-text-context-menu-separator",style:{height:"1px",backgroundColor:"var(--doc-border)",margin:"4px 12px"}})]}),di=({isOpen:e,position:t,hasSelection:o,isEditable:r,hasClipboardContent:n=true,onAction:s,onClose:i,items:c,className:d=""})=>{let a=useRef(null),[p,m]=useState(0),{t:l}=b$1(),b=useMemo(()=>ao.map(h=>({action:h.action,label:l(h.labelKey),shortcut:h.shortcutKey?l(h.shortcutKey):void 0,dividerAfter:h.dividerAfter})),[l]),u=(c||b).map(h=>{let y=(()=>{if(h.disabled!==void 0)return h.disabled;switch(h.action){case "cut":case "copy":case "delete":return !o;case "paste":case "pasteAsPlainText":return !r||!n;default:return false}})();return {...h,disabled:y}}),f=u.filter(h=>h.action!=="separator");useEffect(()=>{if(!e)return;let h=v=>{a.current&&!a.current.contains(v.target)&&i();},y=setTimeout(()=>{document.addEventListener("mousedown",h);},0);return ()=>{clearTimeout(y),document.removeEventListener("mousedown",h);}},[e,i]),useEffect(()=>{if(!e)return;let h=y=>{switch(y.key){case "Escape":y.preventDefault(),i();break;case "ArrowDown":y.preventDefault(),m(P=>{let L=(P+1)%f.length;for(;f[L]?.disabled&&L!==P;)L=(L+1)%f.length;return L});break;case "ArrowUp":y.preventDefault(),m(P=>{let L=(P-1+f.length)%f.length;for(;f[L]?.disabled&&L!==P;)L=(L-1+f.length)%f.length;return L});break;case "Enter":y.preventDefault();let v=f[p];v&&!v.disabled&&(s(v.action),i());break}};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,p,f,s,i]),useEffect(()=>{e&&m(0);},[e]);let x=useCallback(()=>{let y=u.length*36+16,v=t.x,P=t.y;return typeof window<"u"&&(v+220>window.innerWidth&&(v=window.innerWidth-220-10),P+y>window.innerHeight&&(P=window.innerHeight-y-10),v<10&&(v=10),P<10&&(P=10)),{position:"fixed",top:P,left:v,minWidth:220,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",zIndex:ro.contextMenu,padding:"4px 0",overflow:"hidden"}},[t,u.length]),g=h=>{h.disabled||(s(h.action),i());};return e?jsx("div",{ref:a,className:`docx-text-context-menu ${d}`,style:x(),role:"menu","aria-label":l("contextMenu.textMenuAriaLabel"),children:u.map((h,y)=>{let v=f.findIndex(P=>P===h);return jsx(Hr,{item:h,onClick:()=>g(h),isHighlighted:v===p,onMouseEnter:()=>{v>=0&&!h.disabled&&m(v);}},`${h.action}-${y}`)})}):null};function ui(e={}){let{enabled:t=true,isEditable:o=true,containerRef:r,onAction:n}=e,[s,i]=useState(false),[c,d]=useState({x:0,y:0}),[a,p]=useState(false),m=useCallback(()=>{let x=window.getSelection(),g=x&&!x.isCollapsed&&x.toString().length>0;return p(!!g),!!g},[]),l=useCallback(x=>{t&&(x.preventDefault(),x.stopPropagation(),m(),d({x:x.clientX,y:x.clientY}),i(true));},[t,m]),b=useCallback(()=>{i(false);},[]),u=useCallback(x=>{switch(b(),x){case "cut":document.execCommand("cut");break;case "copy":document.execCommand("copy");break;case "paste":document.execCommand("paste");break;case "pasteAsPlainText":navigator.clipboard.readText?.().then(g=>{document.execCommand("insertText",false,g);}).catch(()=>{document.execCommand("paste");});break;case "delete":document.execCommand("delete");break;case "selectAll":document.execCommand("selectAll");break}n?.(x);},[b,n]),f=useCallback(x=>{l(x);},[l]);return useEffect(()=>{if(!s)return;let x=g=>{g.key==="Escape"&&b();};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[s,b]),{isOpen:s,position:c,hasSelection:a,openMenu:l,closeMenu:b,handleAction:u,onContextMenu:f}}function pi(e){return {cut:"Cut",copy:"Copy",paste:"Paste",pasteAsPlainText:"Paste as Plain Text",selectAll:"Select All",delete:"Delete",separator:"",addRowAbove:"Insert row above",addRowBelow:"Insert row below",deleteRow:"Delete row",addColumnLeft:"Insert column left",addColumnRight:"Insert column right",deleteColumn:"Delete column",mergeCells:en$1.table.mergeCells,splitCell:en$1.table.splitCell,addComment:"Comment"}[e]}function mi(e){return {cut:"Ctrl+X",copy:"Ctrl+C",paste:"Ctrl+V",pasteAsPlainText:"Ctrl+Shift+V",selectAll:"Ctrl+A",delete:"Del",separator:"",addRowAbove:"",addRowBelow:"",deleteRow:"",addColumnLeft:"",addColumnRight:"",deleteColumn:"",mergeCells:"",splitCell:"",addComment:""}[e]}function fi(){return ao.map(e=>({action:e.action,label:e.labelKey,shortcut:e.shortcutKey,dividerAfter:e.dividerAfter}))}function bi(e,t,o){switch(e){case "cut":case "copy":case "delete":return t;case "paste":case "pasteAsPlainText":return o;case "addComment":return t;case "selectAll":return true;default:return true}}var we=N.Root,De=N.Group,st=N.Value;function Te({className:e,children:t,onMouseDown:o,...r}){return jsxs(N.Trigger,{className:I("flex h-8 items-center justify-between gap-1 rounded px-2 py-1","text-sm text-slate-700 bg-transparent","hover:bg-slate-100/80 focus:outline-none focus:bg-slate-100/80","disabled:cursor-not-allowed disabled:opacity-50","transition-colors duration-150","[&>span]:truncate",e),onMouseDown:n=>{n.preventDefault(),o?.(n);},...r,children:[t,jsx(N.Icon,{asChild:true,children:jsx(Vr,{className:"h-4 w-4 text-slate-400 shrink-0"})})]})}function ke({className:e,children:t,position:o="popper",onCloseAutoFocus:r,...n}){return jsx(N.Portal,{children:jsx("div",{className:"ep-root",children:jsx(N.Content,{className:I("relative z-50 max-h-72 min-w-[8rem] overflow-hidden","rounded-lg border border-slate-200 bg-white 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",o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",e),position:o,onCloseAutoFocus:s=>{s.preventDefault(),r?.(s);},...n,children:jsx(N.Viewport,{className:I("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),onMouseDown:s=>s.preventDefault(),children:t})})})})}function We({className:e,...t}){return jsx(N.Label,{className:I("px-2 py-1.5 text-xs font-medium text-slate-500",e),...t})}function ae({className:e,children:t,onMouseDown:o,...r}){return jsxs(N.Item,{className:I("relative flex w-full cursor-pointer select-none items-center","rounded px-2 py-1.5 text-sm text-slate-700 outline-none","hover:bg-slate-100 focus:bg-slate-100","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),onMouseDown:n=>{n.preventDefault(),o?.(n);},...r,children:[jsx(N.ItemText,{children:t}),jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:jsx(N.ItemIndicator,{children:jsx($r,{className:"h-4 w-4"})})})]})}function Ve({className:e,...t}){return jsx(N.Separator,{className:I("-mx-1 my-1 h-px bg-slate-100",e),...t})}function Vr({className:e}){return jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children: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 $r({className:e}){return jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children: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"})})}var Gr=[{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 lo({value:e,onChange:t,fonts:o=Gr,disabled:r=false,className:n,placeholder:s="Arial",width:i=120,showPreview:c=true}){let{t:d}=b$1(),a=j.useMemo(()=>e?o.find(b=>b.fontFamily===e||b.name.toLowerCase()===e.toLowerCase())?.name||e:s,[e,o,s]),p=j.useCallback(l=>{let b=o.find(u=>u.name===l);b&&t?.(b.fontFamily);},[t,o]),m=j.useMemo(()=>{let l={"sans-serif":[],serif:[],monospace:[],other:[]};return o.forEach(b=>{let u=b.category||"other";l[u].push(b);}),l},[o]);return jsxs(we,{value:a,onValueChange:p,disabled:r,children:[jsx(Te,{className:I("h-8 text-sm",n),style:{minWidth:typeof i=="number"?`${i}px`:i},"aria-label":d("font.selectAriaLabel"),children:jsx(st,{placeholder:s,children:a})}),jsxs(ke,{className:"max-h-[300px]",children:[m["sans-serif"].length>0&&jsxs(De,{children:[jsx(We,{children:d("font.sansSerif")}),m["sans-serif"].map(l=>jsx(ae,{value:l.name,style:c?{fontFamily:l.fontFamily}:void 0,children:l.name},l.name))]}),m.serif.length>0&&jsxs(Fragment,{children:[jsx(Ve,{}),jsxs(De,{children:[jsx(We,{children:d("font.serif")}),m.serif.map(l=>jsx(ae,{value:l.name,style:c?{fontFamily:l.fontFamily}:void 0,children:l.name},l.name))]})]}),m.monospace.length>0&&jsxs(Fragment,{children:[jsx(Ve,{}),jsxs(De,{children:[jsx(We,{children:d("font.monospace")}),m.monospace.map(l=>jsx(ae,{value:l.name,style:c?{fontFamily:l.fontFamily}:void 0,children:l.name},l.name))]})]}),m.other.length>0&&jsxs(Fragment,{children:[jsx(Ve,{}),jsx(De,{children:m.other.map(l=>jsx(ae,{value:l.name,style:c?{fontFamily:l.fontFamily}:void 0,children:l.name},l.name))})]})]})]})}var jr=[{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"}],ct=18,Jr=2,Qr={position:"relative",display:"inline-block"},en={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)"},tn={padding:"10px",backgroundColor:"#fff",border:"1px solid #d0d0d0",borderRadius:"6px",boxShadow:"0 4px 16px rgba(0, 0, 0, 0.15)",width:"auto"},Pt={fontSize:"11px",color:"#666",marginBottom:"4px",fontWeight:500},Mt={height:"1px",backgroundColor:"#e0e0e0",margin:"8px 0"},uo={display:"grid",gap:`${Jr}px`},dt={width:`${ct}px`,height:`${ct}px`,border:"1px solid #c0c0c0",borderRadius:"2px",cursor:"pointer",padding:0,transition:"transform 0.1s, border-color 0.1s"},po={...dt,transform:"scale(1.15)",borderColor:"#333",zIndex:1},mo={...dt,borderWidth:"2px",borderColor:"#0066cc",boxShadow:"0 0 0 1px #0066cc"},on={display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"5px 8px",border:"1px solid #d0d0d0",borderRadius:"4px",backgroundColor:"#fff",cursor:"pointer",fontSize:"12px",color:"#333"},rn={display:"flex",alignItems:"center",gap:"6px"},nn={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid #ccc",borderRadius:"3px",fontSize:"12px"},an={height:"24px",padding:"0 10px",border:"1px solid #ccc",borderRadius:"3px",backgroundColor:"#f5f5f5",fontSize:"12px",cursor:"pointer"},so={width:"16px",height:"4px",borderRadius:"1px",marginTop:"-2px"},ln={display:"inline-flex",alignItems:"stretch",height:"32px",gap:"2px"},sn={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)"},cn={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 It(e,t,o){if(!e)return t==="text"||t==="border"?"#000000":"transparent";if(typeof e=="string"){if(t==="highlight"){let r=resolveHighlightColor(e);return r||(e==="none"?"transparent":e.startsWith("#")?e:`#${e}`)}return e.startsWith("#")?e:`#${e}`}return resolveColor(e,o)}function co(e){let t=e.replace(/^#/,"");if(t.length!==6)return false;let o=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),n=parseInt(t.slice(4,6),16);return (o*299+r*587+n*114)/1e3>230}function fo(e,t,o){return e?(typeof e=="string"?e.replace(/^#/,"").toUpperCase():resolveColorToHex(e,o))===t.toUpperCase():false}function dn({matrix:e,selectedColor:t,theme:o,onSelect:r}){let[n,s]=useState(null);return jsx("div",{style:{...uo,gridTemplateColumns:`repeat(10, ${ct}px)`},children:e.flatMap((i,c)=>i.map((d,a)=>{let p=`${c}-${a}`,m=n===p,l=fo(t,d.hex,o);return jsx("button",{type:"button",style:{...l?mo:m?po:dt,backgroundColor:`#${d.hex}`},title:d.label,"aria-label":d.label,"aria-selected":l,onClick:()=>r(d),onMouseDown:b=>b.preventDefault(),onMouseEnter:()=>s(p),onMouseLeave:()=>s(null)},p)}))})}function un({selectedColor:e,theme:t,onSelect:o}){let[r,n]=useState(null),{t:s}=b$1();return jsx("div",{style:{...uo,gridTemplateColumns:`repeat(10, ${ct}px)`},children:jr.map((i,c)=>{let d=r===c,a=fo(e,i.hex,t),p=s(i.nameKey);return jsx("button",{type:"button",style:{...a?mo:d?po:dt,backgroundColor:`#${i.hex}`},title:p,"aria-label":p,"aria-selected":a,onClick:()=>o(i.hex),onMouseDown:m=>m.preventDefault(),onMouseEnter:()=>n(c),onMouseLeave:()=>n(null)},i.hex)})})}function _e({mode:e,value:t,onChange:o,theme:r,disabled:n=false,className:s,style:i,title:c$1,icon:d,autoLabel:a,splitButton:p=true,defaultColor:m}){let[l,b$2]=useState(false),[u,f]=useState(false),[x,g]=useState(false),[h,y]=useState(false),[v,P]=useState(""),[L,ce]=useState(()=>m??(e==="highlight"?"FFFF00":e==="border"?{rgb:"000000"}:{rgb:"FF0000"})),{t:F}=b$1();useEffect(()=>{let w=It(t,e,r).replace(/^#/,"");/^[0-9A-Fa-f]{6}$/.test(w)&&P(w.toUpperCase());},[t,e,r]);let Y=useCallback(()=>b$2(false),[]),{containerRef:de,dropdownRef:ge,dropdownStyle:G}=c({isOpen:l,onClose:Y}),R=r?.colorScheme??null,k=useMemo(()=>generateThemeTintShadeMatrix(R),[R]),_=useMemo(()=>It(t,e,r),[t,e,r]),ue=useMemo(()=>It(L,e,r),[L,e,r]),he=useCallback(()=>{n||b$2(w=>!w);},[n]),xe=useCallback(w=>{let W;if(e==="highlight")W=w.hex;else {let ve={themeColor:w.themeSlot,rgb:w.hex};w.tint&&(ve.themeTint=w.tint),w.shade&&(ve.themeShade=w.shade),W=ve;}ce(W),o?.(W),b$2(false);},[e,o]),ye=useCallback(w=>{let W=e==="highlight"?w:{rgb:w};ce(W),o?.(W),b$2(false);},[e,o]),te=useCallback(()=>{o?.(e==="highlight"?"none":{auto:true}),b$2(false);},[e,o]),Ee=useCallback(()=>{let w=v.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/i.test(w)){let W=e==="highlight"?w:{rgb:w};ce(W),o?.(W),b$2(false),P("");}},[e,v,o]),O=useCallback(()=>{n||o?.(L);},[n,L,o]),qe={...en,...n?{cursor:"default",opacity:.38}:l?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:u?{backgroundColor:"var(--doc-bg-hover)"}:{}},oe=F(e==="text"?"formattingBar.fontColor":e==="highlight"?"formattingBar.highlightColor":"table.borderColor"),ze=d??(e==="text"?"format_color_text":e==="highlight"?"ink_highlighter":"border_color");return jsxs("div",{ref:de,className:`docx-color-picker ${s||""}`,style:{...Qr,...i},children:[p?jsxs("div",{className:"docx-color-picker-split",style:{...ln,...n?{opacity:.38,cursor:"default"}:null},children:[jsxs("button",{type:"button",className:"docx-color-picker-apply",style:{...sn,...n?{cursor:"default"}:x?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:O,onMouseDown:w=>w.preventDefault(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),disabled:n,title:c$1||oe,"aria-label":c$1||oe,children:[jsx(b,{name:ze,size:18}),jsx("div",{style:{...so,backgroundColor:ue==="transparent"?"#fff":ue,outline:ue==="transparent"||co(ue)?"1px solid #bbb":"none"}})]}),jsx("button",{type:"button",className:"docx-color-picker-arrow",style:{...cn,...n?{cursor:"default"}:l?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:h?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:he,onMouseDown:w=>w.preventDefault(),onMouseEnter:()=>y(true),onMouseLeave:()=>y(false),disabled:n,title:c$1||oe,"aria-label":c$1||oe,"aria-haspopup":"true","aria-expanded":l,children:jsx(b,{name:"arrow_drop_down",size:18})})]}):jsxs("button",{type:"button",className:"docx-color-picker-button",style:qe,onClick:he,onMouseDown:w=>w.preventDefault(),onMouseEnter:()=>f(true),onMouseLeave:()=>f(false),disabled:n,title:c$1||oe,"aria-label":c$1||oe,"aria-haspopup":"true","aria-expanded":l,children:[jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:0},children:[jsx(b,{name:ze,size:18}),jsx("div",{style:{...so,backgroundColor:_==="transparent"?"#fff":_,outline:_==="transparent"||co(_)?"1px solid #bbb":"none"}})]}),jsx(b,{name:"arrow_drop_down",size:14})]}),l&&jsx("div",{ref:ge,className:"docx-color-picker-dropdown",style:{...G,...tn},role:"dialog","aria-label":`${oe} picker`,onMouseDown:w=>{w.target.tagName!=="INPUT"&&w.preventDefault();},children:jsxs(Fragment,{children:[jsxs("button",{type:"button",style:on,onClick:te,onMouseDown:w=>w.preventDefault(),children:[e==="highlight"?jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",border:"1px solid #ccc",borderRadius:"2px",position:"relative",backgroundColor:"#fff"},children:jsx("span",{style:{position:"absolute",top:"50%",left:"-1px",right:"-1px",height:"2px",backgroundColor:"#ff0000",transform:"rotate(-45deg)"}})}):jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",backgroundColor:"#000",borderRadius:"2px"}}),a??F(e==="highlight"?"colorPicker.noColor":"colorPicker.automatic")]}),jsx("div",{style:Mt}),jsx("div",{style:Pt,children:F("colorPicker.themeColors")}),jsx(dn,{matrix:k,selectedColor:t,theme:r,onSelect:xe}),jsx("div",{style:Mt}),jsx("div",{style:Pt,children:F("colorPicker.standardColors")}),jsx(un,{selectedColor:t,theme:r,onSelect:ye}),jsx("div",{style:Mt}),jsx("div",{style:Pt,children:F("colorPicker.customColor")}),jsxs("div",{style:rn,children:[jsx("span",{style:{fontSize:"12px",color:"#666"},children:"#"}),jsx("input",{type:"text",style:nn,value:v,onChange:w=>P(w.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:w=>{w.key==="Enter"&&Ee();},onMouseDown:w=>{w.stopPropagation();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsx("button",{type:"button",style:{...an,opacity:/^[0-9A-Fa-f]{6}$/.test(v)?1:.4,cursor:/^[0-9A-Fa-f]{6}$/.test(v)?"pointer":"default"},onClick:Ee,onMouseDown:w=>w.preventDefault(),disabled:!/^[0-9A-Fa-f]{6}$/.test(v),children:F("common.apply")})]})]})})]})}function Q({content:e,children:t,side:o="bottom",delayMs:r=400}){let[n,s]=j.useState(false),[i,c]=j.useState({x:0,y:0}),d=j.useRef(null),a=j.useRef(null),p=j.useCallback(()=>{a.current=setTimeout(()=>{if(d.current){let u=d.current.getBoundingClientRect(),f=u.left+u.width/2,x=o==="top"?u.top-8:u.bottom+8;c({x:f,y:x});}s(true);},r);},[r,o]),m=j.useCallback(()=>{a.current&&(clearTimeout(a.current),a.current=null),s(false);},[]);j.useEffect(()=>()=>{a.current&&clearTimeout(a.current);},[]);let l=t.props,b=j.cloneElement(t,{ref:d,onMouseEnter:u=>{p(),l.onMouseEnter?.(u);},onMouseLeave:u=>{m(),l.onMouseLeave?.(u);}});return jsxs(Fragment,{children:[b,n&&jsx("div",{className:"fixed z-50 px-2 py-1 text-xs font-medium text-white bg-slate-900 rounded-md shadow-lg",style:{left:i.x,top:i.y,transform:o==="top"?"translate(-50%, -100%)":o==="bottom"?"translate(-50%, 0)":void 0},children:e})]})}var je=20,Lt=[{value:"left",label:"Align Left",labelKey:"alignment.alignLeft",shortcutKey:"alignment.alignLeftShortcut",icon:jsx(b,{name:"format_align_left",size:je}),iconName:"format_align_left",shortcut:"Ctrl+L"},{value:"center",label:"Center",labelKey:"alignment.center",shortcutKey:"alignment.centerShortcut",icon:jsx(b,{name:"format_align_center",size:je}),iconName:"format_align_center",shortcut:"Ctrl+E"},{value:"right",label:"Align Right",labelKey:"alignment.alignRight",shortcutKey:"alignment.alignRightShortcut",icon:jsx(b,{name:"format_align_right",size:je}),iconName:"format_align_right",shortcut:"Ctrl+R"},{value:"both",label:"Justify",labelKey:"alignment.justify",shortcutKey:"alignment.justifyShortcut",icon:jsx(b,{name:"format_align_justify",size:je}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function ho({value:e="left",onChange:t,disabled:o=false}){let{t:r}=b$1(),[n,s]=useState(false),i=useCallback(()=>s(false),[]),{containerRef:c$1,dropdownRef:d,dropdownStyle:a,handleMouseDown:p}=c({isOpen:n,onClose:i}),m=useCallback(g=>{o||t?.(g),s(false);},[o,t]),l=Lt.find(g=>g.value===e)||Lt[0],b$2=r(l.labelKey),u=l.shortcutKey?r(l.shortcutKey):void 0,f=`${b$2}${u?` (${u})`:""}`,x=jsxs(V,{variant:"ghost",size:"icon-sm",className:I("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",n&&"bg-slate-100",o&&"opacity-30 cursor-not-allowed"),onMouseDown:p,onClick:()=>!o&&s(g=>!g),disabled:o,"aria-label":f,"aria-expanded":n,"aria-haspopup":"true","data-testid":"toolbar-alignment",children:[jsx(b,{name:l.iconName,size:je}),jsx(b,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxs("div",{ref:c$1,style:{position:"relative",display:"inline-block"},children:[n?x:jsx(Q,{content:f,children:x}),n&&!o&&jsx("div",{ref:d,style:{...a,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:6},onMouseDown:g=>g.stopPropagation(),children:jsx("div",{style:{display:"flex",gap:2},children:Lt.map(g=>{let h=e===g.value,y=r(g.labelKey),v=g.shortcutKey?r(g.shortcutKey):void 0;return jsx("button",{type:"button",title:`${y}${v?` (${v})`:""}`,"data-testid":`alignment-${g.value}`,style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:h?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:h?"var(--doc-primary)":"var(--doc-text)"},onMouseDown:P=>P.preventDefault(),onMouseEnter:P=>{h||(P.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:P=>{P.currentTarget.style.backgroundColor=h?"var(--doc-primary-light)":"transparent";},onClick:()=>m(g.value),children:jsx(b,{name:g.iconName,size:18})},g.value)})})})]})}var hn=[{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 yo({value:e,onChange:t,options:o=hn,disabled:r=false,className:n}){let{t:s}=b$1(),i=j.useMemo(()=>e===void 0?o[0]:o.find(a=>a.twipsValue===e)||o[0],[e,o]),c=j.useCallback(a=>{let p=parseInt(a,10);isNaN(p)||t?.(p);},[t]),d=a=>a.labelKey?s(a.labelKey):a.label;return jsxs(we,{value:i.twipsValue.toString(),onValueChange:c,disabled:r,children:[jsx(Te,{className:I("h-8 text-sm gap-0.5 px-2",n),style:{width:"auto"},title:s("lineSpacing.lineSpacingTitle",{label:d(i)}),children:jsx(a,{className:"h-5 w-5 shrink-0"})}),jsxs(ke,{children:[o.map(a=>jsx(ae,{value:a.twipsValue.toString(),children:d(a)},a.twipsValue)),jsx(Ve,{}),jsx(De,{children:jsx(We,{children:s("lineSpacing.paragraphSpacing")})})]})]})}var vo=[{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}],xn="#4a6c8c",yn={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14};function vn(e){let t={},o=yn[e.styleId];if(o)t.fontSize=`${o}px`;else {let r=e.fontSize?e.fontSize/2:11,n=Math.min(Math.max(r,11),20);t.fontSize=`${n}px`;}return t.lineHeight="1.3",e.bold&&(t.fontWeight="bold"),e.italic&&(t.fontStyle="italic"),e.color?t.color=`#${e.color}`:e.styleId.startsWith("Heading")&&(t.color=xn),t}function Co({value:e,onChange:t,styles:o,disabled:r=false,className:n,width:s=120}){let{t:i}=b$1(),c=j.useMemo(()=>!o||o.length===0?vo:o.filter(u=>u.type==="paragraph").filter(u=>u.qFormat?true:!(u.hidden||u.semiHidden)).map(u=>{let f=vo.find(x=>x.styleId===u.styleId);return {styleId:u.styleId,name:u.name||u.styleId,nameKey:f?.nameKey,type:u.type,isDefault:u.default,qFormat:u.qFormat,priority:u.uiPriority??99,fontSize:u.rPr?.fontSize??f?.fontSize,bold:u.rPr?.bold??f?.bold,italic:u.rPr?.italic??f?.italic,color:u.rPr?.color?.rgb??f?.color}}).sort((u,f)=>(u.priority??99)-(f.priority??99)),[o]),d=j.useCallback(b=>{t?.(b);},[t]),a=b=>b.nameKey?i(b.nameKey):b.name,p=e||"Normal",m=c.find(b=>b.styleId===p),l=m?a(m):p;return jsxs(we,{value:p,onValueChange:d,disabled:r,children:[jsx(Te,{className:I("h-8 text-sm",n),style:{width:typeof s=="number"?`${s}px`:s},"aria-label":i("styles.selectAriaLabel"),children:jsx("span",{className:"truncate",children:l})}),jsx(ke,{className:"min-w-[260px] max-h-[400px]",children:c.map(b=>jsx(ae,{value:b.styleId,className:"py-2.5 px-3",children:jsx("span",{style:vn(b),children:a(b)})},b.styleId))})]})}var Sn=[{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 So({value:e=1,onChange:t,levels:o=Sn,disabled:r=false,className:n,compact:s=false}){let{t:i}=b$1(),c=j.useMemo(()=>{let a=o.find(p=>Math.abs(p.value-e)<.001);return a?a.label:`${Math.round(e*100)}%`},[o,e]),d=j.useCallback(a=>{let p=parseFloat(a);isNaN(p)||t?.(p);},[t]);return jsxs(we,{value:e.toString(),onValueChange:d,disabled:r,children:[jsx(Te,{className:I(s?"h-7 min-w-[55px] text-xs":"h-8 min-w-[70px] text-sm",n),"aria-label":i("zoom.ariaLabel",{label:c}),children:jsx(st,{placeholder:"100%",children:c})}),jsx(ke,{children:o.map(a=>jsx(ae,{value:a.value.toString(),children:a.label},a.value))})]})}var kn=[{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 ko({onAction:e,disabled:t=false}){let{t:o}=b$1(),[r,n]=useState(false),s=useCallback(()=>n(false),[]),{containerRef:i,dropdownRef:c$1,dropdownStyle:d,handleMouseDown:a}=c({isOpen:r,onClose:s}),p=useCallback(l=>{e(l),n(false);},[e]),m=jsxs(V,{variant:"ghost",size:"icon-sm",className:I("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",r&&"bg-slate-100",t&&"opacity-30 cursor-not-allowed"),onMouseDown:a,onClick:()=>!t&&n(l=>!l),disabled:t,"aria-label":o("table.borders.styleAriaLabel"),"aria-expanded":r,"aria-haspopup":"true","data-testid":"toolbar-table-borders",children:[jsx(b,{name:"border_all",size:20}),jsx(b,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxs("div",{ref:i,style:{position:"relative",display:"inline-block"},children:[r?m:jsx(Q,{content:o("table.borders.tooltip"),children:m}),r&&!t&&jsx("div",{ref:c$1,style:{...d,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:6},onMouseDown:l=>l.stopPropagation(),children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:2},children:kn.map(({action:l,icon:b$1,labelKey:u})=>jsx("button",{type:"button",title:o(u),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:"transparent",cursor:"pointer",color:"var(--doc-text)"},onMouseDown:f=>f.preventDefault(),onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},onClick:()=>p(l),children:jsx(b,{name:b$1,size:18})},typeof l=="string"?l:l.type))})})]})}function Po({onAction:e,disabled:t=false,theme:o,value:r}){let{t:n}=b$1(),s=useCallback(i=>{typeof i=="string"?e({type:"borderColor",color:i.replace(/^#/,"")}):i.rgb?e({type:"borderColor",color:i.rgb.replace(/^#/,"")}):i.auto&&e({type:"borderColor",color:"000000"});},[e]);return jsx(_e,{mode:"border",value:r,onChange:s,theme:o,disabled:t,title:n("table.borderColor")})}var Ln=[{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 Io({onAction:e,disabled:t=false}){let[o,r]=useState(false),{t:n}=b$1(),s=useCallback(()=>r(false),[]),{containerRef:i,dropdownRef:c$1,dropdownStyle:d,handleMouseDown:a}=c({isOpen:o,onClose:s}),p=useCallback(l=>{e({type:"borderWidth",size:l}),r(false);},[e]),m=jsxs(V,{variant:"ghost",size:"icon-sm",className:I("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",o&&"bg-slate-100",t&&"opacity-30 cursor-not-allowed"),onMouseDown:a,onClick:()=>!t&&r(l=>!l),disabled:t,"aria-label":n("table.borderWidth"),"aria-expanded":o,"aria-haspopup":"true","data-testid":"toolbar-table-border-width",children:[jsx(b,{name:"line_weight",size:20}),jsx(b,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxs("div",{ref:i,style:{position:"relative",display:"inline-block"},children:[o?m:jsx(Q,{content:n("table.borderWidth"),children:m}),o&&!t&&jsx("div",{ref:c$1,style:{...d,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:"4px 0",minWidth:120},onMouseDown:l=>l.stopPropagation(),children:Ln.map(({size:l,label:b,thickness:u})=>jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:10,padding:"6px 12px",width:"100%",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:12,color:"var(--doc-text)"},onMouseDown:f=>f.preventDefault(),onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},onClick:()=>p(l),children:[jsx("div",{style:{width:50,height:Math.max(u,1),backgroundColor:"#000",borderRadius:u>2?1:0}}),jsx("span",{children:b})]},l))})]})}function Lo({onAction:e,disabled:t=false,theme:o,value:r}){let{t:n}=b$1(),s=useCallback(i=>{typeof i=="string"&&e(i==="none"?{type:"cellFillColor",color:null}:{type:"cellFillColor",color:i.replace(/^#/,"")});},[e]);return jsx(_e,{mode:"highlight",value:r,onChange:s,theme:o,disabled:t,title:n("table.cellFillColor"),icon:"format_color_fill",autoLabel:n("colorPicker.noColor")})}var An={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"},Ue={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},Ao={padding:"6px 14px 2px",fontSize:11,color:"var(--doc-text-muted)",fontWeight:500};function No({onAction:e,disabled:t=false,tableContext:o}){let{t:r}=b$1(),[n,s]=useState(false),[i,c$1]=useState(null),d=useCallback(()=>s(false),[]),{containerRef:a,dropdownRef:p,dropdownStyle:m,handleMouseDown:l}=c({isOpen:n,onClose:d,align:"right"}),b$2=o?.table?.attrs?.justification??"left",u=useCallback(g=>{e(g),s(false);},[e]),f=(g,h,y,v,P)=>{let L=t||P?.itemDisabled;return jsxs("button",{type:"button",role:"menuitem",style:{...An,backgroundColor:i===g&&!L?"var(--doc-bg-hover)":"transparent",color:L?"var(--doc-text-muted)":P?.danger?"var(--doc-error)":"var(--doc-text)",cursor:L?"not-allowed":"pointer"},onClick:()=>!L&&u(v),onMouseEnter:()=>c$1(g),onMouseLeave:()=>c$1(null),disabled:L,children:[jsx(b,{name:h,size:16,className:P?.danger&&!L?"text-red-600":""}),jsx("span",{style:{flex:1},children:y})]},g)},x=jsx(V,{variant:"ghost",size:"icon-sm",className:I("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",n&&"bg-slate-100",t&&"opacity-30 cursor-not-allowed"),onMouseDown:l,onClick:()=>!t&&s(g=>!g),disabled:t,"aria-label":r("table.moreOptions"),"aria-expanded":n,"aria-haspopup":"menu","data-testid":"toolbar-table-more",children:jsx(b,{name:"more_vert",size:20})});return jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[n?x:jsx(Q,{content:r("table.moreOptions"),children:x}),n&&!t&&jsxs("div",{ref:p,style:{...m,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:"4px 0",minWidth:200,maxHeight:"70vh",overflowY:"auto"},role:"menu",onMouseDown:g=>g.stopPropagation(),children:[f("addRowAbove","add",r("table.insertRowAbove"),"addRowAbove"),f("addRowBelow","add",r("table.insertRowBelow"),"addRowBelow"),f("addColumnLeft","add",r("table.insertColumnLeft"),"addColumnLeft"),f("addColumnRight","add",r("table.insertColumnRight"),"addColumnRight"),jsx("div",{style:Ue,role:"separator"}),f("mergeCells","call_merge",r("table.mergeCells"),"mergeCells",{itemDisabled:!o?.hasMultiCellSelection}),f("splitCell","call_split",r("table.splitCell"),"splitCell",{itemDisabled:!o?.canSplitCell}),jsx("div",{style:Ue,role:"separator"}),f("deleteRow","delete",r("table.deleteRow"),"deleteRow",{danger:true,itemDisabled:(o?.rowCount??0)<=1}),f("deleteColumn","delete",r("table.deleteColumn"),"deleteColumn",{danger:true,itemDisabled:(o?.columnCount??0)<=1}),f("deleteTable","delete",r("table.deleteTable"),"deleteTable",{danger:true}),jsx("div",{style:Ue,role:"separator"}),jsx("div",{style:Ao,children:r("tableAdvanced.verticalAlignment")}),jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["top","center","bottom"].map(g=>{let h={top:"vertical_align_top",center:"vertical_align_center",bottom:"vertical_align_bottom"};return jsx("button",{type:"button",title:r({top:"tableAdvanced.top",center:"tableAdvanced.middle",bottom:"tableAdvanced.bottom"}[g]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:"transparent",cursor:"pointer"},onMouseDown:v=>v.preventDefault(),onMouseEnter:v=>{v.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="transparent";},onClick:()=>u({type:"cellVerticalAlign",align:g}),children:jsx(b,{name:h[g],size:16})},g)})}),jsx("div",{style:Ue,role:"separator"}),jsx("div",{style:Ao,children:r("tableAdvanced.tableAlignment")}),jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["left","center","right"].map(g=>{let h={left:"format_align_left",center:"format_align_center",right:"format_align_right"},y=b$2===g;return jsx("button",{type:"button",title:r({left:"tableAdvanced.alignTableLeft",center:"tableAdvanced.alignTableCenter",right:"tableAdvanced.alignTableRight"}[g]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:y?"var(--doc-primary-light)":"transparent",borderColor:y?"var(--doc-primary)":"var(--doc-border)",color:y?"var(--doc-primary)":"var(--doc-text)",cursor:"pointer"},onMouseDown:v=>v.preventDefault(),onClick:()=>u({type:"tableProperties",props:{justification:g}}),children:jsx(b,{name:h[g],size:16})},g)})}),jsx("div",{style:Ue,role:"separator"}),f("headerRow","table_rows",r("tableAdvanced.toggleHeaderRow"),{type:"toggleHeaderRow"}),f("distribute","view_column",r("tableAdvanced.distributeColumns"),{type:"distributeColumns"}),f("autoFit","fit_width",r("tableAdvanced.autoFit"),{type:"autoFitContents"}),f("noWrap","wrap_text",r("tableAdvanced.toggleNoWrap"),{type:"toggleNoWrap"}),jsx("div",{style:Ue,role:"separator"}),f("properties","settings",r("tableAdvanced.tableProperties"),{type:"openTableProperties"})]})]})}var Dn=20;function bt({options:e,activeValue:t,triggerIcon:o,tooltipContent:r,onSelect:n,disabled:s=false,ariaLabel:i,testId:c$1,showLabels:d=false}){let[a,p]=useState(false),m=useCallback(()=>p(false),[]),{containerRef:l,dropdownRef:b$1,dropdownStyle:u,handleMouseDown:f}=c({isOpen:a,onClose:m}),x=useCallback(h=>{s||n(h),p(false);},[s,n]),g=jsxs(V,{variant:"ghost",size:"icon-sm",className:I("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",a&&"bg-slate-100",s&&"opacity-30 cursor-not-allowed"),onMouseDown:f,onClick:()=>!s&&p(h=>!h),disabled:s,"aria-label":i??r,"aria-expanded":a,"aria-haspopup":"true","data-testid":c$1,children:[jsx(b,{name:o,size:Dn}),jsx(b,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxs("div",{ref:l,style:{position:"relative",display:"inline-block"},children:[a?g:jsx(Q,{content:r,children:g}),a&&!s&&jsx("div",{ref:b$1,style:{...u,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:6},onMouseDown:h=>h.stopPropagation(),children:jsx("div",{style:{display:"flex",flexDirection:d?"column":"row",gap:d?1:2,minWidth:d?200:void 0},children:e.map(h=>{let y=t===h.value;return jsxs("button",{type:"button",title:h.label,"data-testid":c$1?`${c$1}-${h.value}`:void 0,style:{display:"flex",alignItems:"center",height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:y?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:y?"var(--doc-primary)":"var(--doc-text)",...d?{width:"100%",gap:10,padding:"0 10px",justifyContent:"flex-start",fontSize:13,textAlign:"left"}:{width:32,justifyContent:"center"}},onMouseDown:v=>v.preventDefault(),onMouseEnter:v=>{y||(v.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:v=>{v.currentTarget.style.backgroundColor=y?"var(--doc-primary-light)":"transparent";},onClick:()=>x(h.value),children:[jsx(b,{name:h.iconName,size:18}),d&&jsx("span",{style:{flex:1},children:h.label})]},h.value)})})})]})}var Bn=[{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 _n(e){return e.displayMode==="float"&&e.cssFloat==="left"?"wrapRight":e.displayMode==="float"&&e.cssFloat==="right"?"wrapLeft":e.wrapType}function _o({imageContext:e,onChange:t,disabled:o=false}){let{t:r}=b$1(),n=Bn.map(c=>({...c,label:r(c.labelKey)})),s=_n(e),i=n.find(c=>c.value===s)||n[0];return jsx(bt,{options:n,activeValue:s,triggerIcon:i.iconName,tooltipContent:`Wrap: ${i.label}`,onSelect:t,disabled:o,testId:"toolbar-image-wrap",showLabels:true})}var On=[{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 Fo({onTransform:e,disabled:t=false}){let{t:o}=b$1(),r=On.map(n=>({...n,label:o(n.labelKey)}));return jsx(bt,{options:r,triggerIcon:"rotate_right",tooltipContent:o("imageTransform.tooltip"),onSelect:e,disabled:t,testId:"toolbar-image-transform"})}var Qe=createContext(null);function Oo(){let e=useContext(Qe);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}var le=18;function se({active:e=false,disabled:t=false,title:o,onClick:r,children:n,className:s,ariaLabel:i}){let c=i?.toLowerCase().replace(/\s+/g,"-")||o?.toLowerCase().replace(/\s+/g,"-").replace(/\([^)]*\)/g,"").trim(),d=p=>{p.preventDefault();},a=jsx(V,{variant:"ghost",size:"icon-sm",className:I("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",e&&"bg-slate-900 text-white hover:bg-slate-800 hover:text-white",t&&"opacity-30 cursor-not-allowed",s),onMouseDown:d,onClick:t?void 0:r,disabled:t,"aria-pressed":e,"aria-label":i||o,"data-testid":c?`toolbar-${c}`:void 0,children:n});return o?jsx(Q,{content:o,children:a}):a}function fe({label:e,children:t,className:o}){return jsx("div",{className:I("flex items-center gap-px px-1.5 border-r border-slate-200/50 last:border-r-0 first:pl-0",o),role:"group","aria-label":e,children:t})}function Ws(){return jsx("div",{className:"w-px h-6 bg-slate-200 mx-1.5",role:"separator"})}function Gn(e){let t=j__default.useContext(Qe);return t?{...t,...Un(e)}:e}function Un(e){let t={};for(let o of Object.keys(e))e[o]!==void 0&&(t[o]=e[o]);return t}function zo(e){let{t}=b$1(),o=Gn(e),{currentFormatting:r={},onFormat:n,onUndo:s,onRedo:i,canUndo:c=false,canRedo:d=false,disabled:a=false,className:p,style:m,enableShortcuts:l=true,editorRef:b$2,children:u,showFontPicker:f=true,fontFamilies:x,showFontSizePicker:g=true,showTextColorPicker:h=true,showHighlightColorPicker:y=true,showAlignmentButtons:v=true,showListButtons:P=true,showLineSpacingPicker:L=true,showStylePicker:ce=true,documentStyles:F,theme:Y,showZoomControl:de=true,zoom:ge,onZoomChange:G,onRefocusEditor:R,imageContext:k,onImageWrapType:_,onImageTransform:ue,onOpenImageProperties:he,tableContext:xe,onTableAction:ye,inline:te=false}=o,Ee=useRef(null),O=useCallback(A=>{!a&&n&&n(A);},[a,n]),qe=useCallback(()=>{!a&&c&&s&&s();},[a,c,s]),oe=useCallback(()=>{!a&&d&&i&&i();},[a,d,i]),ze=useCallback(A=>{!a&&n&&(n({type:"fontFamily",value:A}),requestAnimationFrame(()=>R?.()));},[a,n,R]),w=j__default.useMemo(()=>normalizeFontFamilies(x),[x]),W=useCallback(A=>{!a&&n&&(n({type:"fontSize",value:A}),requestAnimationFrame(()=>R?.()));},[a,n,R]),ve=useCallback(A=>{!a&&n&&(n({type:"textColor",value:A}),requestAnimationFrame(()=>R?.()));},[a,n,R]),St=useCallback(A=>{!a&&n&&(n({type:"highlightColor",value:typeof A=="string"?A:""}),requestAnimationFrame(()=>R?.()));},[a,n,R]),E=useCallback(A=>{!a&&n&&n({type:"alignment",value:A});},[a,n]),Ae=useCallback(()=>{!a&&n&&n("bulletList");},[a,n]),tt=useCallback(()=>{!a&&n&&n("numberedList");},[a,n]),Ne=useCallback(()=>{!a&&n&&n("indent");},[a,n]),pe=useCallback(()=>{!a&&n&&n("outdent");},[a,n]),J=useCallback(A=>{!a&&n&&(n({type:"lineSpacing",value:A}),requestAnimationFrame(()=>R?.()));},[a,n,R]),re=useCallback(A=>{!a&&n&&(n({type:"applyStyle",value:A}),requestAnimationFrame(()=>R?.()));},[a,n,R]),ne=useCallback(A=>{!a&&ye&&(ye(A),requestAnimationFrame(()=>R?.()));},[a,ye,R]);useEffect(()=>{if(!l)return;let A=B=>{let Ye=B.target,$t=b$2?.current,rr=Ee.current,nr=$t?.contains(Ye),ar=rr?.contains(Ye);if(!nr&&!ar)return;if((B.ctrlKey||B.metaKey)&&!B.altKey)switch(B.key.toLowerCase()){case "b":B.preventDefault(),O("bold");break;case "i":B.preventDefault(),O("italic");break;case "u":B.preventDefault(),O("underline");break;case "=":B.shiftKey?(B.preventDefault(),O("superscript")):(B.preventDefault(),O("subscript"));break;case "l":B.preventDefault(),E("left");break;case "e":B.preventDefault(),E("center");break;case "r":B.preventDefault(),E("right");break;case "j":B.preventDefault(),E("both");break;case "k":B.preventDefault(),O("insertLink");break}};return document.addEventListener("keydown",A),()=>{document.removeEventListener("keydown",A);}},[l,O,E,b$2]);let tr=useCallback(A=>{let B=A.target;B.tagName==="INPUT"||B.tagName==="TEXTAREA"||B.tagName==="SELECT"||B.tagName==="OPTION"||A.preventDefault();},[]),or=useCallback(A=>{let B=A.target,Ye=document.activeElement;B.tagName==="SELECT"||B.tagName==="OPTION"||Ye?.tagName==="SELECT"||requestAnimationFrame(()=>{R?.();});},[R]);return jsxs("div",{ref:Ee,className:I(!te&&"flex items-center px-2 py-1 bg-[#f1f5f9] rounded-full min-h-[36px] overflow-x-auto mx-2 mb-1",p),style:te?{display:"contents",...m}:m,role:te?void 0:"toolbar","aria-label":te?void 0:t("toolbar.ariaLabel"),"data-testid":te?void 0:"formatting-bar",onMouseDown:te?void 0:tr,onMouseUp:te?void 0:or,children:[jsxs(fe,{label:t("formattingBar.groups.history"),children:[jsx(se,{onClick:qe,disabled:a||!c,title:t("formattingBar.undoShortcut"),ariaLabel:t("formattingBar.undo"),children:jsx(b,{name:"undo",size:le})}),jsx(se,{onClick:oe,disabled:a||!d,title:t("formattingBar.redoShortcut"),ariaLabel:t("formattingBar.redo"),children:jsx(b,{name:"redo",size:le})})]}),de&&jsx(fe,{label:t("formattingBar.groups.zoom"),children:jsx(So,{value:ge,onChange:G,minZoom:.5,maxZoom:2,disabled:a,compact:true,showButtons:false})}),ce&&jsx(fe,{label:t("formattingBar.groups.styles"),children:jsx(Co,{value:r.styleId||"Normal",onChange:re,styles:F,theme:Y,disabled:a,width:120})}),(f||g)&&jsxs(fe,{label:t("formattingBar.groups.font"),children:[f&&jsx(lo,{value:r.fontFamily||"Arial",onChange:ze,fonts:w,disabled:a,width:60,placeholder:"Arial"}),g&&jsx(Jt,{value:r.fontSize!==void 0?halfPointsToPoints(r.fontSize):11,onChange:W,disabled:a,width:42,placeholder:"11"})]}),jsxs(fe,{label:t("formattingBar.groups.textFormatting"),children:[jsx(se,{onClick:()=>O("bold"),active:r.bold,disabled:a,title:t("formattingBar.boldShortcut"),ariaLabel:t("formattingBar.bold"),children:jsx(b,{name:"format_bold",size:le})}),jsx(se,{onClick:()=>O("italic"),active:r.italic,disabled:a,title:t("formattingBar.italicShortcut"),ariaLabel:t("formattingBar.italic"),children:jsx(b,{name:"format_italic",size:le})}),jsx(se,{onClick:()=>O("underline"),active:r.underline,disabled:a,title:t("formattingBar.underlineShortcut"),ariaLabel:t("formattingBar.underline"),children:jsx(b,{name:"format_underlined",size:le})}),jsx(se,{onClick:()=>O("strikethrough"),active:r.strike,disabled:a,title:t("formattingBar.strikethrough"),ariaLabel:t("formattingBar.strikethrough"),children:jsx(b,{name:"strikethrough_s",size:le})}),h&&jsx(_e,{mode:"text",value:r.color?.replace(/^#/,""),onChange:ve,theme:Y,disabled:a,title:t("formattingBar.fontColor")}),y&&jsx(_e,{mode:"highlight",value:r.highlight,onChange:St,theme:Y,disabled:a,title:t("formattingBar.highlightColor")}),jsx(se,{onClick:()=>O("insertLink"),disabled:a,title:t("formattingBar.insertLinkShortcut"),ariaLabel:t("formattingBar.insertLink"),children:jsx(b,{name:"link",size:le})})]}),jsxs(fe,{label:t("formattingBar.groups.script"),children:[jsx(se,{onClick:()=>O("superscript"),active:r.superscript,disabled:a,title:t("formattingBar.superscriptShortcut"),ariaLabel:t("formattingBar.superscript"),children:jsx(b,{name:"superscript",size:le})}),jsx(se,{onClick:()=>O("subscript"),active:r.subscript,disabled:a,title:t("formattingBar.subscriptShortcut"),ariaLabel:t("formattingBar.subscript"),children:jsx(b,{name:"subscript",size:le})})]}),v&&jsx(fe,{label:t("formattingBar.groups.alignment"),children:jsx(ho,{value:r.alignment||"left",onChange:E,disabled:a})}),(P||L)&&jsxs(fe,{label:t("formattingBar.groups.listFormatting"),children:[P&&jsx(to,{listState:r.listState||createDefaultListState(),onBulletList:Ae,onNumberedList:tt,onIndent:Ne,onOutdent:pe,disabled:a,showIndentButtons:true,compact:true,hasIndent:(r.indentLeft??0)>0}),L&&jsx(yo,{value:r.lineSpacing,onChange:J,disabled:a})]}),k&&_&&jsxs(fe,{label:t("formattingBar.groups.image"),children:[jsx(_o,{imageContext:k,onChange:_,disabled:a}),ue&&jsx(Fo,{onTransform:ue,disabled:a}),he&&jsx(se,{onClick:he,disabled:a,title:t("formattingBar.imagePropertiesShortcut"),ariaLabel:t("formattingBar.imageProperties"),children:jsx(b,{name:"tune",size:le})})]}),xe?.isInTable&&ye&&jsxs(fe,{label:t("formattingBar.groups.table"),children:[jsx(ko,{onAction:ne,disabled:a}),jsx(Po,{onAction:ne,disabled:a,theme:Y,value:resolveColorToHex(xe?.cellBorderColor,Y)}),jsx(Io,{onAction:ne,disabled:a}),jsx(Lo,{onAction:ne,disabled:a,theme:Y,value:xe?.cellBackgroundColor}),jsx(No,{onAction:ne,disabled:a,tableContext:xe})]}),jsx(se,{onClick:()=>O("clearFormatting"),disabled:a,title:t("formattingBar.clearFormatting"),ariaLabel:t("formattingBar.clearFormatting"),children:jsx(b,{name:"format_clear",size:le})}),u]})}function qn(e){return "type"in e&&e.type==="separator"}var Vo={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, #374151)",whiteSpace:"nowrap",height:28,lineHeight:"28px"},Yn={...Vo,background:"var(--doc-hover, #f3f4f6)"},$o={display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:"pointer",fontSize:13,color:"var(--doc-text, #374151)",width:"100%",textAlign:"left",whiteSpace:"nowrap"},Xn={...$o,opacity:.4,cursor:"default"},jn={height:1,backgroundColor:"var(--doc-border, #e5e7eb)",margin:"4px 0"},Jn={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted, #9ca3af)"},Qn={position:"absolute",left:"100%",top:-4,marginLeft:2,backgroundColor:"white",border:"1px solid var(--doc-border, #d1d5db)",borderRadius:6,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.12)",padding:8,zIndex:1001};function et({label:e,items:t,disabled:o,showChevron:r=false}){let[n,s]=useState(false),[i,c]=useState(null),d=useRef(null),a=useRef(null),[p,m]=useState({top:0,left:0}),l=useCallback(()=>{s(false),c(null);},[]);useEffect(()=>{if(!n||!d.current)return;let u=d.current.getBoundingClientRect();m({top:u.bottom+2,left:u.left});},[n]),useEffect(()=>{if(!n)return;function u(g){let h=g.target;d.current&&!d.current.contains(h)&&a.current&&!a.current.contains(h)&&l();}function f(g){g.key==="Escape"&&l();}function x(){l();}return document.addEventListener("mousedown",u),document.addEventListener("keydown",f),window.addEventListener("scroll",x,true),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",f),window.removeEventListener("scroll",x,true);}},[n,l]);let b$1=u=>{u.disabled||u.submenuContent||u.onClick&&(u.onClick(),l());};return jsxs("div",{style:{position:"relative"},children:[jsxs("button",{ref:d,type:"button",onClick:()=>!o&&s(!n),onMouseDown:u=>u.preventDefault(),disabled:o,style:n?Yn:Vo,children:[e,r&&jsx(b,{name:"arrow_drop_down",size:16})]}),n&&jsx("div",{ref:a,style:{position:"fixed",top:p.top,left:p.left,backgroundColor:"white",border:"1px solid var(--doc-border, #d1d5db)",borderRadius:6,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.12)",padding:"4px 0",zIndex:1e4,minWidth:200},onMouseDown:u=>u.preventDefault(),children:t.map((u,f)=>{if(qn(u))return jsx("div",{style:jn},`sep-${f}`);let x=u;if(x.customContent)return jsx("div",{onMouseDown:y=>y.preventDefault(),children:x.customContent},x.label);let g=!!x.submenuContent,h=i===x.label;return jsxs("div",{style:{position:"relative"},onMouseEnter:()=>g&&c(x.label),onMouseLeave:()=>g&&c(null),children:[jsxs("button",{type:"button",style:x.disabled?Xn:$o,onClick:()=>b$1(x),onMouseDown:y=>y.preventDefault(),onMouseOver:y=>{x.disabled||(y.currentTarget.style.backgroundColor="var(--doc-hover, #f3f4f6)");},onMouseOut:y=>{y.currentTarget.style.backgroundColor="transparent";},disabled:x.disabled,children:[x.icon&&jsx(b,{name:x.icon,size:18}),jsx("span",{children:x.label}),x.shortcut&&jsx("span",{style:Jn,children:x.shortcut}),g&&jsx("span",{style:{marginLeft:"auto"},children:jsx(b,{name:"keyboard_arrow_right",size:16})})]}),g&&h&&jsx("div",{style:Qn,onMouseDown:y=>y.preventDefault(),children:x.submenuContent(l)})]},x.label)})})]})}var Bt=18,ta=2,Uo={width:Bt,height:Bt,backgroundColor:"white",border:"1px solid var(--doc-border, #d1d5db)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},oa={...Uo,backgroundColor:"var(--doc-primary, #3b82f6)",border:"1px solid var(--doc-primary, #3b82f6)"},ra={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text, #374151)",textAlign:"center"};function Zo({onInsert:e,gridRows:t=6,gridColumns:o=6}){let[r,n]=useState(0),[s,i]=useState(0),c=useCallback(()=>{r>0&&s>0&&e(r,s);},[r,s,e]),d=[];for(let p=1;p<=t;p++)for(let m=1;m<=o;m++){let l=p<=r&&m<=s;d.push(jsx("div",{style:l?oa:Uo,onMouseEnter:()=>{n(p),i(m);},onClick:c,role:"gridcell","aria-selected":l},`${p}-${m}`));}let a=r>0&&s>0?`${s} \xD7 ${r}`:"Select size";return jsxs("div",{children:[jsx("div",{style:{display:"grid",gap:ta,gridTemplateColumns:`repeat(${o}, ${Bt}px)`},onMouseLeave:()=>{n(0),i(0);},role:"grid","aria-label":"Table size selector",children:d}),jsx("div",{style:ra,children:a})]})}function la(){return jsxs("svg",{width:"32",height:"40",viewBox:"0 0 32 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[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"}),jsx("path",{d:"M22 0L32 10H24C22.9 10 22 9.1 22 8V0Z",fill:"#94a3b8"}),jsx("rect",{x:"7",y:"18",width:"18",height:"2",rx:"1",fill:"#fff"}),jsx("rect",{x:"7",y:"23",width:"18",height:"2",rx:"1",fill:"#fff"}),jsx("rect",{x:"7",y:"28",width:"12",height:"2",rx:"1",fill:"#fff"})]})}function Ft({children:e}){return jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function sa(e){return e.replace(/\.docx$/i,"")}function Yo({value:e,onChange:t,placeholder:o,editable:r=true}){let{t:n}=b$1(),s=o??n("titleBar.untitled"),i=sa(e)??"";return r?jsx("input",{type:"text",value:i,onChange:c=>{let d=c.target.value;t?.(d.endsWith(".docx")?d:d+".docx");},placeholder:s,className:"text-base font-normal text-slate-800 bg-transparent border-0 outline-none px-2 py-0 rounded hover:bg-slate-50 focus:bg-white focus:ring-1 focus:ring-slate-300 min-w-[100px] max-w-[300px] truncate leading-tight","aria-label":n("titleBar.documentNameAriaLabel")}):jsx("span",{className:"text-base font-normal text-slate-800 px-2 py-0 min-w-[100px] max-w-[300px] truncate leading-tight",children:i||s})}function Ot({children:e}){return jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function Kt(){let{t:e}=b$1(),t=Oo(),{disabled:o=false,onFormat:r,onPrint:n,onOpen:s,onSave:i,onPageSetup:c,onInsertImage:d,onInsertTable:a,showTableInsert:p=true,onInsertPageBreak:m,onInsertTOC:l,onWatermark:b,onRefocusEditor:u}=t,f=useCallback(y=>{!o&&r&&r(y);},[o,r]),x=useCallback((y,v)=>{!o&&a&&(a(y,v),requestAnimationFrame(()=>u?.()));},[o,a,u]),g=!!n||!!c,h=g||s||i;return jsxs("div",{className:"flex items-center",role:"menubar","aria-label":e("titleBar.menuBarAriaLabel"),children:[h&&jsx(et,{label:e("toolbar.file"),disabled:o,items:[...s?[{icon:"file_upload",label:e("toolbar.open"),shortcut:e("toolbar.openShortcut"),onClick:s}]:[],...i?[{icon:"file_download",label:e("toolbar.save"),shortcut:e("toolbar.saveShortcut"),onClick:i}]:[],...(s||i)&&g?[{type:"separator"}]:[],...n?[{icon:"print",label:e("toolbar.print"),shortcut:e("toolbar.printShortcut"),onClick:n}]:[],...c?[{icon:"settings",label:e("toolbar.pageSetup"),onClick:c}]:[]]}),jsx(et,{label:e("toolbar.format"),disabled:o,items:[{icon:"format_textdirection_l_to_r",label:e("toolbar.leftToRight"),onClick:()=>f("setLtr")},{icon:"format_textdirection_r_to_l",label:e("toolbar.rightToLeft"),onClick:()=>f("setRtl")}]}),jsx(et,{label:e("toolbar.insert"),disabled:o,items:[...d?[{icon:"image",label:e("toolbar.image"),onClick:d}]:[],...p&&a?[{icon:"grid_on",label:e("toolbar.table"),submenuContent:y=>jsx(Zo,{onInsert:(v,P)=>{x(v,P),y();}})}]:[],...d||p&&a?[{type:"separator"}]:[],{icon:"page_break",label:e("toolbar.pageBreak"),onClick:m,disabled:!m},{icon:"format_list_numbered",label:e("toolbar.tableOfContents"),onClick:l,disabled:!l},...b?[{icon:"branding_watermark",label:e("toolbar.watermark"),onClick:b}]:[]]}),jsx(et,{label:e("toolbar.help"),disabled:o,items:[{label:e("toolbar.reportIssue"),onClick:()=>openReportIssue()}]})]})}function Xo({children:e}){let t=null,o=null,r=[],n=[];Children.forEach(e,i=>{isValidElement(i)&&(i.type===Ft?t=i:i.type===Ot?o=i:i.type===Kt?n.push(i):r.push(i));});let s=useCallback(i=>{let c=i.target;c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.tagName==="SELECT"||c.tagName==="OPTION"||i.preventDefault();},[]);return jsxs("div",{className:"flex items-stretch bg-white pt-2 pb-1",onMouseDown:s,"data-testid":"title-bar",children:[jsx("div",{className:"flex items-center flex-shrink-0 pl-3 pr-1",children:t||jsx(la,{})}),jsxs("div",{className:"flex flex-col justify-center flex-1 min-w-0 py-1",children:[r.length>0&&jsx("div",{className:"flex items-center gap-2 px-1",children:r}),n.length>0&&jsx("div",{className:"flex items-center px-1",children:n})]}),o&&jsx("div",{className:"flex items-center flex-shrink-0 px-3",children:o})]})}function ca({children:e,className:t,style:o,...r}){return jsx(Qe.Provider,{value:r,children:jsx("div",{className:I("flex flex-col bg-white shadow-sm flex-shrink-0",t),style:o,"data-testid":"editor-toolbar",children:e})})}var Ze=ca;Ze.TitleBar=Xo;Ze.Logo=Ft;Ze.DocumentName=Yo;Ze.MenuBar=Kt;Ze.TitleBarRight=Ot;Ze.Toolbar=zo;var Qo=12240,yt=1440,vt=1440,Ct=567,Ht=22,pa="var(--doc-text-muted)",ma="var(--doc-text-subtle)",Jo="rgba(0, 0, 0, 0.02)",fa="#4285f4",ba="#3367d6",ga="#2a56c6",Ke=5;function ha(e,t){return t==="inch"?(e/vt).toFixed(2)+'"':(e/Ct).toFixed(1)+" cm"}function vc({sectionProps:e,zoom:t=1,editable:o=false,onLeftMarginChange:r,onRightMarginChange:n,onFirstLineIndentChange:s,showFirstLineIndent:i=false,firstLineIndent:c=0,hangingIndent:d=false,indentLeft:a=0,indentRight:p=0,onIndentLeftChange:m,onIndentRightChange:l,unit:b="inch",className:u="",style:f,tabStops:x,onTabStopRemove:g}){let{t:h}=b$1(),[y,v]=useState(null),[P,L]=useState(null),[ce,F]=useState(null),[Y,de]=useState(null),ge=useRef(null),G=e?.pageWidth??Qo,R=e?.marginLeft??yt,k=e?.marginRight??yt,_=G-R-k,ue=twipsToPixels(G)*t,he=twipsToPixels(R)*t,xe=twipsToPixels(k)*t,ye=twipsToPixels(a)*t,te=twipsToPixels(p)*t,Ee=d?-c:c,O=twipsToPixels(Ee)*t,qe=he+ye,oe=ue-xe-te,ze=he+ye+O,w=useCallback((E,Ae)=>{o&&(E.preventDefault(),E.stopPropagation(),v(Ae));},[o]),W=useCallback(E=>{if(!y||!ge.current)return;let Ae=ge.current.getBoundingClientRect(),tt=E.clientX-Ae.left;de(tt);let Ne=pixelsToTwips(tt/t);if(y==="leftMargin"){let pe=G-k-720,J=Math.round(Math.max(0,Math.min(Ne,pe)));F(J),r?.(J);}else if(y==="rightMargin"){let pe=G-Ne,J=G-R-720,re=Math.round(Math.max(0,Math.min(pe,J)));F(re),n?.(re);}else if(y==="firstLineIndent"){let pe=R+a,J=Ne-pe,re=_-a-p-720,ne=Math.round(Math.max(-a,Math.min(J,re)));F(ne),s?.(ne);}else if(y==="leftIndent"){let pe=Ne-R,J=_-p-720,re=Math.round(Math.max(0,Math.min(pe,J)));F(re),m?.(re);}else if(y==="rightIndent"){let J=G-k-Ne,re=_-a-720,ne=Math.round(Math.max(0,Math.min(J,re)));F(ne),l?.(ne);}},[y,t,G,R,k,_,a,p,r,n,s,m,l]),ve=useCallback(()=>{v(null),F(null),de(null);},[]);useEffect(()=>{if(y)return document.addEventListener("mousemove",W),document.addEventListener("mouseup",ve),()=>{document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",ve);}},[y,W,ve]);let St=Sa(G,t,b);return jsxs("div",{ref:ge,className:`docx-horizontal-ruler ${u}`,style:{position:"relative",width:formatPx(ue),height:Ht,backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:y?"ew-resize":"default",...f},role:"slider","aria-label":h("ruler.horizontal"),"aria-valuemin":0,"aria-valuemax":G,children:[jsx("div",{style:{position:"absolute",top:0,left:0,width:formatPx(he),height:Ht,backgroundColor:Jo,borderRight:"1px solid rgba(0,0,0,0.06)",cursor:o?"ew-resize":"default",zIndex:1},onMouseDown:o&&r?E=>w(E,"leftMargin"):void 0}),jsx("div",{style:{position:"absolute",top:0,right:0,width:formatPx(xe),height:Ht,backgroundColor:Jo,borderLeft:"1px solid rgba(0,0,0,0.06)",cursor:o?"ew-resize":"default",zIndex:1},onMouseDown:o&&n?E=>w(E,"rightMargin"):void 0}),jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:St.map((E,Ae)=>jsx(xa,{tick:E},Ae))}),i&&jsx(Wt,{direction:"down",positionPx:ze,editable:o,isDragging:y==="firstLineIndent",isHovered:P==="firstLineIndent",onMouseEnter:()=>L("firstLineIndent"),onMouseLeave:()=>L(null),onMouseDown:E=>w(E,"firstLineIndent"),label:h("ruler.firstLineIndent")}),o&&m&&jsx(Wt,{direction:"up",positionPx:qe,editable:o,isDragging:y==="leftIndent",isHovered:P==="leftIndent",onMouseEnter:()=>L("leftIndent"),onMouseLeave:()=>L(null),onMouseDown:E=>w(E,"leftIndent"),label:h("ruler.leftIndent")}),o&&l&&jsx(Wt,{direction:"down",positionPx:oe,editable:o,isDragging:y==="rightIndent",isHovered:P==="rightIndent",onMouseEnter:()=>L("rightIndent"),onMouseLeave:()=>L(null),onMouseDown:E=>w(E,"rightIndent"),label:h("ruler.rightIndent")}),x?.map(E=>jsx(Ca,{tabStop:E,positionPx:twipsToPixels(E.position)*t,onDoubleClick:()=>g?.(E.position)},E.position)),y&&ce!==null&&Y!==null&&jsx(ya,{value:ha(ce,b),positionPx:Y})]})}function xa({tick:e}){return jsxs(Fragment,{children:[jsx("div",{style:{position:"absolute",left:formatPx(e.position),bottom:0,width:1,height:e.height,backgroundColor:ma}}),e.label&&jsx("div",{style:{position:"absolute",left:formatPx(e.position),top:3,transform:"translateX(-50%)",fontSize:"9px",color:pa,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:e.label})]})}function Wt({direction:e,positionPx:t,editable:o,isDragging:r,isHovered:n,onMouseEnter:s,onMouseLeave:i,onMouseDown:c,label:d}){let a=r?ga:n?ba:fa,p=Math.round(Ke*1.6),m={position:"absolute",left:formatPx(t-Ke),width:Ke*2,height:p+2,cursor:o?"ew-resize":"default",zIndex:r?10:4,...e==="down"?{top:0}:{bottom:0}},l=e==="down"?{position:"absolute",top:1,left:0,width:0,height:0,borderLeft:`${Ke}px solid transparent`,borderRight:`${Ke}px solid transparent`,borderTop:`${p}px solid ${a}`,transition:"border-top-color 0.1s"}:{position:"absolute",bottom:1,left:0,width:0,height:0,borderLeft:`${Ke}px solid transparent`,borderRight:`${Ke}px solid transparent`,borderBottom:`${p}px solid ${a}`,transition:"border-bottom-color 0.1s"};return jsx("div",{className:"docx-ruler-indent",style:m,onMouseEnter:s,onMouseLeave:i,onMouseDown:c,role:"slider","aria-label":d,"aria-orientation":"horizontal",tabIndex:o?0:-1,children:jsx("div",{style:l})})}function ya({value:e,positionPx:t}){return jsx("div",{style:{position:"absolute",left:formatPx(t),top:-22,transform:"translateX(-50%)",backgroundColor:"#333",color:"#fff",fontSize:"10px",fontFamily:"sans-serif",padding:"2px 6px",borderRadius:3,whiteSpace:"nowrap",pointerEvents:"none",zIndex:20},children:e})}var va={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function Ca({tabStop:e,positionPx:t,onDoubleClick:o}){return jsx("div",{style:{position:"absolute",left:formatPx(t-5),bottom:0,width:10,height:12,display:"flex",alignItems:"center",justifyContent:"center",fontSize:8,fontWeight:700,color:"#555",cursor:"pointer",userSelect:"none"},onDoubleClick:r=>{r.stopPropagation(),o();},title:`${e.alignment} tab at ${(e.position/1440).toFixed(2)}"`,children:va[e.alignment]||"L"})}function Sa(e,t,o){let r=[];if(o==="inch"){let n=vt/8,s=Math.ceil(e/n);for(let i=0;i<=s;i++){let c=i*n;if(c>e)break;let d=twipsToPixels(c)*t;i%8===0?r.push({position:d,height:10,label:i/8>0?String(i/8):void 0}):i%4===0?r.push({position:d,height:6}):i%2===0?r.push({position:d,height:4}):r.push({position:d,height:2});}}else {let n=Ct/10,s=Math.ceil(e/n);for(let i=0;i<=s;i++){let c=i*n;if(c>e)break;let d=twipsToPixels(c)*t;i%10===0?r.push({position:d,height:10,label:i/10>0?String(i/10):void 0}):i%5===0?r.push({position:d,height:6}):r.push({position:d,height:3});}}return r}function Cc(e,t,o,r){let n=pixelsToTwips(e/r);return t==="left"?Math.max(0,n):Math.max(0,pixelsToTwips(o/r)-n)}function Sc(e,t=1){let o=e?.pageWidth??Qo,r=e?.marginLeft??yt,n=e?.marginRight??yt,s=twipsToPixels(o)*t,i=twipsToPixels(r)*t,c=twipsToPixels(n)*t;return {width:s,leftMargin:i,rightMargin:c,contentWidth:s-i-c}}function wc(e,t){return t==="inch"?(e/vt).toFixed(2)+'"':(e/Ct).toFixed(1)+" cm"}function Tc(e,t){let o=parseFloat(e.replace(/[^\d.]/g,""));return isNaN(o)?null:Math.round(o*(t==="inch"?vt:Ct))}
|
|
2
|
-
export{se as A,fe as B,Ws as C,zo as D,Ze as E,vc as F,Cc as G,Sc as H,wc as I,Tc as J,I as a,V as b,Jt as c,to as e,ro as h,di as i,ui as j,pi as k,mi as l,fi as m,bi as n,Q as o,lo as p,_e as q,ho as r,yo as s,Co as t,So as u,ko as v,Po as w,Io as x,Lo as y,No as z};
|