@zeke-02/docx-editor 0.0.35 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/README.md +34 -29
  2. package/dist/{ClipboardManager-C1l58nzE.d.ts → ClipboardManager-CVKX0v9q.d.ts} +1 -1
  3. package/dist/{ClipboardManager-Cjb_v74d.d.mts → ClipboardManager-V3aaMnWE.d.mts} +1 -1
  4. package/dist/{DocumentAgent-E8OX_8j0.d.mts → DocumentAgent-BWflKHpH.d.mts} +1 -1
  5. package/dist/{DocumentAgent-iedmc_8s.d.ts → DocumentAgent-DsdXtetF.d.ts} +1 -1
  6. package/dist/{FindReplaceDialog-YW3R4FHM.mjs → FindReplaceDialog-L3YF5HIS.mjs} +1 -1
  7. package/dist/FindReplaceDialog-SEBWC5P7.js +1 -0
  8. package/dist/{FootnotePropertiesDialog-LNFJXQUG.mjs → FootnotePropertiesDialog-TNVJJCY6.mjs} +1 -1
  9. package/dist/{FootnotePropertiesDialog-7QX54WQT.js → FootnotePropertiesDialog-XQ7NIFIU.js} +1 -1
  10. package/dist/{HyperlinkDialog-HNYTXDCB.mjs → HyperlinkDialog-FR4IZZ7E.mjs} +1 -1
  11. package/dist/HyperlinkDialog-WEK6JSAC.js +1 -0
  12. package/dist/{ImagePositionDialog-M65BYQQE.js → ImagePositionDialog-2YXRAGZS.js} +1 -1
  13. package/dist/{ImagePositionDialog-B4RLP2W5.mjs → ImagePositionDialog-JSZSIKF5.mjs} +1 -1
  14. package/dist/ImagePropertiesDialog-527MFLQO.mjs +1 -0
  15. package/dist/{ImagePropertiesDialog-O4WQSF5M.js → ImagePropertiesDialog-HG4K3IE7.js} +1 -1
  16. package/dist/PageSetupDialog-GALVJMUB.js +1 -0
  17. package/dist/PageSetupDialog-TGQIAMI7.mjs +1 -0
  18. package/dist/SplitCellDialog-JIAC3RYV.js +1 -0
  19. package/dist/SplitCellDialog-NP3JJYHD.mjs +1 -0
  20. package/dist/{TablePropertiesDialog-WOZ4ES3H.js → TablePropertiesDialog-T7D4HSVP.js} +1 -1
  21. package/dist/TablePropertiesDialog-TIK4AA5M.mjs +1 -0
  22. package/dist/{clipboard-BWhM0CRj.d.mts → TableToolbar-DUgmob2I.d.ts} +227 -135
  23. package/dist/{clipboard-BvkuNZub.d.ts → TableToolbar-YL74HNS1.d.mts} +227 -135
  24. package/dist/{agentApi-mv532p8I.d.mts → agentApi-DLt94vXk.d.mts} +83 -5
  25. package/dist/{agentApi-mv532p8I.d.ts → agentApi-DLt94vXk.d.ts} +83 -5
  26. package/dist/chunk-23SXXIZS.js +111 -0
  27. package/dist/chunk-3F52AP2Q.js +1 -0
  28. package/dist/chunk-42O5GXM5.mjs +82 -0
  29. package/dist/chunk-54ULJEHM.mjs +1 -0
  30. package/dist/chunk-5XK326FI.mjs +1 -0
  31. package/dist/chunk-76IYR7C7.mjs +1 -0
  32. package/dist/chunk-7BG7QY7I.js +182 -0
  33. package/dist/chunk-AGRIVA4G.js +1 -0
  34. package/dist/chunk-BTCQ2QI3.mjs +3 -0
  35. package/dist/chunk-BXRC4U3X.mjs +2 -0
  36. package/dist/chunk-CPAYKE6X.mjs +1 -0
  37. package/dist/chunk-DACWLFKI.mjs +1 -0
  38. package/dist/{chunk-377ZVTSE.js → chunk-EHFEG3TX.js} +1 -1
  39. package/dist/chunk-EPBFWE36.js +2 -0
  40. package/dist/chunk-FXES3YDB.js +82 -0
  41. package/dist/chunk-HI66BSGS.mjs +9 -0
  42. package/dist/chunk-INTPVEO6.mjs +9 -0
  43. package/dist/chunk-IOAGVW6Q.mjs +2 -0
  44. package/dist/chunk-JCEWC5QL.mjs +4 -0
  45. package/dist/chunk-JTIUFACT.js +1 -0
  46. package/dist/chunk-KUTCCI4X.mjs +182 -0
  47. package/dist/{chunk-KCOGY3V2.js → chunk-LUF7PWIC.js} +4 -4
  48. package/dist/chunk-LVGJKS7Y.mjs +24 -0
  49. package/dist/chunk-MGEN6GOE.mjs +2 -0
  50. package/dist/chunk-MOE2ZGUE.js +18 -0
  51. package/dist/chunk-MWLHJWB6.js +9 -0
  52. package/dist/chunk-OFYVDN3U.mjs +2 -0
  53. package/dist/chunk-P4VSHBGZ.js +2 -0
  54. package/dist/chunk-P5FQHIES.mjs +1 -0
  55. package/dist/chunk-PBC7XAYZ.js +3 -0
  56. package/dist/chunk-PEMB6SZT.js +2 -0
  57. package/dist/chunk-PKEOQIQO.mjs +2 -0
  58. package/dist/chunk-PQMSZTBB.js +9 -0
  59. package/dist/chunk-Q7UDQXAF.js +1 -0
  60. package/dist/chunk-QGTAIC5E.js +1 -0
  61. package/dist/chunk-R3QMYPL5.mjs +59 -0
  62. package/dist/chunk-RBUTXXQJ.mjs +18 -0
  63. package/dist/chunk-RRWYZ2TS.mjs +111 -0
  64. package/dist/{chunk-AU5NVRHP.js → chunk-SFUM35DH.js} +2 -2
  65. package/dist/chunk-SNLC6EK2.js +1 -0
  66. package/dist/chunk-TMTLIGLZ.js +59 -0
  67. package/dist/{chunk-RTFUE3KK.mjs → chunk-TSE2PWFX.mjs} +3 -3
  68. package/dist/chunk-UWYD42WV.js +4 -0
  69. package/dist/chunk-UXVACQCY.mjs +1 -0
  70. package/dist/{chunk-Z26WOH6R.mjs → chunk-W4EIKDM6.mjs} +2 -2
  71. package/dist/chunk-WNS2RBQD.js +2 -0
  72. package/dist/chunk-YC5KZSYD.js +24 -0
  73. package/dist/chunk-Z3KMSHUP.js +1 -0
  74. package/dist/core-plugins-reexport.d.mts +4 -4
  75. package/dist/core-plugins-reexport.d.ts +4 -4
  76. package/dist/core-plugins-reexport.js +1 -1
  77. package/dist/core-plugins-reexport.mjs +1 -1
  78. package/dist/core-reexport.d.mts +47 -16
  79. package/dist/core-reexport.d.ts +47 -16
  80. package/dist/core-reexport.js +1 -1
  81. package/dist/core-reexport.mjs +1 -1
  82. package/dist/{colorResolver-C5fQ4fxP.d.mts → documentSerializer-DtS_-oGA.d.mts} +378 -376
  83. package/dist/{colorResolver-Bp9flT3l.d.ts → documentSerializer-Wj1p2ASa.d.ts} +378 -376
  84. package/dist/executor-C3VXF7QA.mjs +1 -0
  85. package/dist/executor-GDBV3AGV.js +1 -0
  86. package/dist/headless-reexport.d.mts +14 -12
  87. package/dist/headless-reexport.d.ts +14 -12
  88. package/dist/headless-reexport.js +1 -4
  89. package/dist/headless-reexport.mjs +1 -4
  90. package/dist/index.css +1 -1
  91. package/dist/index.d.mts +284 -172
  92. package/dist/index.d.ts +284 -172
  93. package/dist/index.js +17 -9
  94. package/dist/index.mjs +17 -9
  95. package/dist/{fontLoader-0G00frKD.d.mts → insertOperations-BTH1Asas.d.mts} +86 -86
  96. package/dist/{fontLoader-DPdt4JvW.d.ts → insertOperations-CbUnXAXH.d.ts} +86 -86
  97. package/dist/layout-bridge-EA4DJ227.js +1 -0
  98. package/dist/layout-bridge-XDPSO6GO.mjs +1 -0
  99. package/dist/mcp-reexport.d.mts +2 -2
  100. package/dist/mcp-reexport.d.ts +2 -2
  101. package/dist/mcp-reexport.js +8 -8
  102. package/dist/mcp-reexport.mjs +7 -7
  103. package/dist/processTemplate-MJ2PCSO5.js +1 -0
  104. package/dist/{processTemplate-LRHXOWMZ.mjs → processTemplate-W2C5PXZB.mjs} +1 -1
  105. package/dist/{react-1OO-DXvx.d.ts → react-B0W16SV6.d.ts} +384 -166
  106. package/dist/{react-B1dSZ_w1.d.mts → react-D0Pn1nww.d.mts} +384 -166
  107. package/dist/react.css +1 -1
  108. package/dist/react.d.mts +5 -5
  109. package/dist/react.d.ts +5 -5
  110. package/dist/react.js +1 -1
  111. package/dist/react.mjs +1 -1
  112. package/dist/{registry-BWGKcKc1.d.ts → registry-CH9V-IX0.d.ts} +1 -1
  113. package/dist/{registry-8XOdjHGC.d.mts → registry-CWBKYlNW.d.mts} +1 -1
  114. package/dist/styles.css +1 -1
  115. package/dist/{types-DIBvJ7AJ.d.mts → types-UDsUq8D3.d.mts} +1 -1
  116. package/dist/{types-CfAiObQo.d.ts → types-jbivc9Lj.d.ts} +1 -1
  117. package/dist/ui.d.mts +33 -83
  118. package/dist/ui.d.ts +33 -83
  119. package/dist/ui.js +1 -1
  120. package/dist/ui.mjs +1 -1
  121. package/dist/{variableDetector-DNO18eZ1.d.mts → variableDetector-CdQ7ZTzA.d.mts} +1 -1
  122. package/dist/{variableDetector-BIJFVpkl.d.ts → variableDetector-DsRV3A9z.d.ts} +1 -1
  123. package/i18n/de.json +49 -2
  124. package/i18n/en.json +55 -8
  125. package/i18n/he.json +792 -0
  126. package/i18n/pl.json +49 -2
  127. package/i18n/pt-BR.json +792 -0
  128. package/i18n/tr.json +792 -0
  129. package/i18n/zh-CN.json +792 -0
  130. package/package.json +17 -5
  131. package/dist/FindReplaceDialog-KNJETYJX.js +0 -1
  132. package/dist/HyperlinkDialog-GBAYMTUE.js +0 -1
  133. package/dist/ImagePropertiesDialog-JOGW3WDU.mjs +0 -1
  134. package/dist/PageSetupDialog-2GIBTKMJ.js +0 -1
  135. package/dist/PageSetupDialog-Q7SHEZIJ.mjs +0 -1
  136. package/dist/TablePropertiesDialog-LMXWX3FI.mjs +0 -1
  137. package/dist/chunk-2HDYCD2Q.mjs +0 -1
  138. package/dist/chunk-37SLIJPH.mjs +0 -58
  139. package/dist/chunk-3OKYQQQ5.js +0 -111
  140. package/dist/chunk-4VUZBV2S.js +0 -1
  141. package/dist/chunk-6YRWZ32V.js +0 -261
  142. package/dist/chunk-7MGFEP2R.mjs +0 -26
  143. package/dist/chunk-7QTNB64A.mjs +0 -9
  144. package/dist/chunk-AARNCPWR.js +0 -1
  145. package/dist/chunk-DC65PJYE.js +0 -4
  146. package/dist/chunk-DLVLK5FT.mjs +0 -24
  147. package/dist/chunk-EV3CM6TU.js +0 -1
  148. package/dist/chunk-FVUGBRDD.js +0 -1
  149. package/dist/chunk-FW5LYOOZ.mjs +0 -111
  150. package/dist/chunk-GZOCOWWB.mjs +0 -2
  151. package/dist/chunk-KUL2SDYC.js +0 -26
  152. package/dist/chunk-LYBG4YI7.mjs +0 -1
  153. package/dist/chunk-M5F4SK3W.mjs +0 -1
  154. package/dist/chunk-P7WEP4JU.js +0 -9
  155. package/dist/chunk-PB7VMDDP.js +0 -24
  156. package/dist/chunk-QAZ4233N.mjs +0 -1
  157. package/dist/chunk-QSUPYUOP.js +0 -2
  158. package/dist/chunk-QTSXJRP6.mjs +0 -1
  159. package/dist/chunk-S67UBZDL.mjs +0 -261
  160. package/dist/chunk-SE5EN2QL.js +0 -1
  161. package/dist/chunk-X5A54T6S.mjs +0 -4
  162. package/dist/chunk-YKBSKEBS.mjs +0 -2
  163. package/dist/chunk-ZJNGMDRE.js +0 -58
  164. package/dist/executor-L2MVKMXO.js +0 -1
  165. package/dist/executor-XKBCCVNY.mjs +0 -1
  166. package/dist/processTemplate-5ZST2Q5L.js +0 -1
  167. package/dist/selectionRects-DEX5THEG.js +0 -1
  168. package/dist/selectionRects-SQTAHMCH.mjs +0 -1
@@ -0,0 +1,82 @@
1
+ function g(e){return e?/[\p{L}\p{N}_]/u.test(e):false}function E(e){return e?/\s/.test(e):false}function Y(e){return e?/[\p{P}]/u.test(e):false}function q(e,t){if(t<=0)return 0;t>e.length&&(t=e.length);let o=t;for(;o>0&&E(e[o-1]);)o--;if(o===0)return 0;for(;o>0&&g(e[o-1]);)o--;return o}function J(e,t){if(t>=e.length)return e.length;t<0&&(t=0);let o=t;for(;o<e.length&&g(e[o]);)o++;for(;o<e.length&&E(e[o]);)o++;return o}function L(e,t){if(t>=e.length)return e.length;let o=t;for(;o<e.length&&g(e[o]);)o++;for(;o<e.length&&!g(e[o]);)o++;return o}function D(e,t){if(t<=0)return 0;let o=t;for(;o>0&&!g(e[o-1]);)o--;for(;o>0&&g(e[o-1]);)o--;return o}function H(e,t){if(!window.getSelection())return null;let n=document.createRange();if(e.nodeType===Node.TEXT_NODE){n.setStart(e,Math.min(t,e.textContent?.length||0)),n.collapse(true);let l=n.getBoundingClientRect().top,i=0,c=t;for(;i<c;){let s=Math.floor((i+c)/2);n.setStart(e,s),n.collapse(true);let d=n.getBoundingClientRect();Math.abs(d.top-l)<2?c=s:i=s+1;}return {node:e,offset:i}}return null}function P(e,t){if(!window.getSelection())return null;let n=e.textContent?.length||0,r=document.createRange();if(e.nodeType===Node.TEXT_NODE){r.setStart(e,Math.min(t,n)),r.collapse(true);let i=r.getBoundingClientRect().top,c=t,s=n;for(;c<s;){let d=Math.ceil((c+s)/2);r.setStart(e,d),r.collapse(true);let m=r.getBoundingClientRect();Math.abs(m.top-i)<2?c=d:s=d-1;}return {node:e,offset:c}}return null}function Q(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;let t=e.getRangeAt(0);return {node:t.startContainer,offset:t.startOffset,anchorNode:e.anchorNode,anchorOffset:e.anchorOffset,focusNode:e.focusNode,focusOffset:e.focusOffset,isCollapsed:e.isCollapsed,text:e.toString()}}function T(e,t){let o=window.getSelection();if(!o)return;let n=document.createRange(),r=e.nodeType===Node.TEXT_NODE?e.textContent?.length||0:e.childNodes.length;n.setStart(e,Math.min(t,r)),n.collapse(true),o.removeAllRanges(),o.addRange(n);}function C(e,t){let o=window.getSelection();if(!(!o||!o.anchorNode))try{o.extend(e,Math.min(t,e.textContent?.length||0));}catch{let n=e.nodeType===Node.TEXT_NODE?e.textContent?.length||0:e.childNodes.length;o.setBaseAndExtent(o.anchorNode,o.anchorOffset,e,Math.min(t,n));}}function W(e,t=false){let o=window.getSelection();if(!o||o.rangeCount===0)return false;let n=o.focusNode;if(!n||n.nodeType!==Node.TEXT_NODE)return false;let r=n.textContent||"",l=o.focusOffset,i;return e==="left"?i=D(r,l):i=L(r,l),t?C(n,i):T(n,i),true}function I(e,t=false){let o=window.getSelection();if(!o||o.rangeCount===0)return false;let n=o.focusNode;if(!n)return false;if(n.nodeType===Node.TEXT_NODE){let i=e==="start"?H(n,o.focusOffset):P(n,o.focusOffset);if(i)return t?C(i.node,i.offset):T(i.node,i.offset),true}let r=n.textContent||"",l=e==="start"?0:r.length;return t?C(n,l):T(n,l),true}function _(e){let{key:t,ctrlKey:o,metaKey:n,shiftKey:r,altKey:l}=e,i=o||n;switch(t){case "ArrowLeft":if(i)return {direction:"left",unit:"word",extend:r};break;case "ArrowRight":if(i)return {direction:"right",unit:"word",extend:r};break;case "Home":return i?{direction:"left",unit:"document",extend:r}:{direction:"left",unit:"line",extend:r};case "End":return i?{direction:"right",unit:"document",extend:r}:{direction:"right",unit:"line",extend:r}}return null}function Z(e,t){let o=_(e);if(!o)return false;switch(o.unit){case "word":if((o.direction==="left"||o.direction==="right")&&W(o.direction,o.extend))return e.preventDefault(),true;break;case "line":let n=o.direction==="left"?"start":"end";if(I(n,o.extend))return e.preventDefault(),true;break;case "document":if(o.direction==="left"&&t?.onDocumentStart)return e.preventDefault(),t.onDocumentStart(),true;if(o.direction==="right"&&t?.onDocumentEnd)return e.preventDefault(),t.onDocumentEnd(),true;break}return false}function ee(e){let{key:t,ctrlKey:o,metaKey:n}=e;return !!((o||n)&&(t==="ArrowLeft"||t==="ArrowRight")||t==="Home"||t==="End")}function te(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.focusNode;if(!t||t.nodeType!==Node.TEXT_NODE)return false;let o=t.textContent||"",n=e.focusOffset,r=n,l=n;for(;r>0&&g(o[r-1]);)r--;for(;l<o.length&&g(o[l]);)l++;if(r===l)return false;let i=document.createRange();return i.setStart(t,r),i.setEnd(t,l),e.removeAllRanges(),e.addRange(i),true}function oe(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;let t=e.focusNode;if(!t||t.nodeType!==Node.TEXT_NODE)return null;let o=t.textContent||"",n=e.focusOffset,r=n,l=n;for(;r>0&&g(o[r-1]);)r--;for(;l<o.length&&g(o[l]);)l++;return r===l?null:o.slice(r,l)}function ne(e,t){let o=e.ctrlKey||e.metaKey,n=t.ctrlKey||t.metaKey;return e.key.toLowerCase()===t.key.toLowerCase()&&o===!!n&&e.shiftKey===!!t.shiftKey&&e.altKey===!!t.altKey}var u={wordLeft:{key:"ArrowLeft",ctrlKey:true},wordRight:{key:"ArrowRight",ctrlKey:true},selectWordLeft:{key:"ArrowLeft",ctrlKey:true,shiftKey:true},selectWordRight:{key:"ArrowRight",ctrlKey:true,shiftKey:true},lineStart:{key:"Home"},lineEnd:{key:"End"},selectToLineStart:{key:"Home",shiftKey:true},selectToLineEnd:{key:"End",shiftKey:true},documentStart:{key:"Home",ctrlKey:true},documentEnd:{key:"End",ctrlKey:true},selectToDocumentStart:{key:"Home",ctrlKey:true,shiftKey:true},selectToDocumentEnd:{key:"End",ctrlKey:true,shiftKey:true}};function f(e){let t=[];if(e.ctrlKey||e.metaKey){let n=typeof navigator<"u"&&/Mac/i.test(navigator.platform);t.push(n?"\u2318":"Ctrl");}e.shiftKey&&t.push("Shift"),e.altKey&&t.push("Alt");let o=e.key;return o==="ArrowLeft"?o="\u2190":o==="ArrowRight"?o="\u2192":o==="ArrowUp"?o="\u2191":o==="ArrowDown"&&(o="\u2193"),t.push(o),t.join("+")}function re(){return [{action:"Move by word (left)",shortcut:f(u.wordLeft)},{action:"Move by word (right)",shortcut:f(u.wordRight)},{action:"Select word (left)",shortcut:f(u.selectWordLeft)},{action:"Select word (right)",shortcut:f(u.selectWordRight)},{action:"Go to line start",shortcut:f(u.lineStart)},{action:"Go to line end",shortcut:f(u.lineEnd)},{action:"Select to line start",shortcut:f(u.selectToLineStart)},{action:"Select to line end",shortcut:f(u.selectToLineEnd)},{action:"Go to document start",shortcut:f(u.documentStart)},{action:"Go to document end",shortcut:f(u.documentEnd)},{action:"Select to document start",shortcut:f(u.selectToDocumentStart)},{action:"Select to document end",shortcut:f(u.selectToDocumentEnd)}]}var w={backgroundColor:"rgba(26, 115, 232, 0.3)",borderRadius:0,zIndex:0,opacity:1,mixBlendMode:"multiply"},ie={backgroundColor:"rgba(0, 120, 215, 0.4)",borderColor:"rgba(0, 120, 215, 0.6)",borderRadius:1,zIndex:0,opacity:1},le={backgroundColor:"--docx-selection-bg",borderColor:"--docx-selection-border",textColor:"--docx-selection-text"};function R(e){let t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return [];let o=t.getRangeAt(0);if(e&&!e.contains(o.commonAncestorContainer))return [];let n=o.getClientRects(),r=[],l=0,i=0;if(e){let c=e.getBoundingClientRect();l=c.left+e.scrollLeft,i=c.top+e.scrollTop;}for(let c=0;c<n.length;c++){let s=n[c];s.width===0&&s.height===0||r.push({left:s.left-l,top:s.top-i,width:s.width,height:s.height});}return r}function B(e,t=2){if(e.length<=1)return e;let o=[...e].sort((l,i)=>Math.abs(l.top-i.top)<t?l.left-i.left:l.top-i.top),n=[],r={...o[0]};for(let l=1;l<o.length;l++){let i=o[l],c=Math.abs(i.top-r.top)<t,s=i.left<=r.left+r.width+t;if(c&&s){let d=Math.max(r.left+r.width,i.left+i.width);r.width=d-r.left,r.height=Math.max(r.height,i.height);}else n.push(r),r={...i};}return n.push(r),n}function F(e){let t=R(e);return B(t)}function ce(e,t=w){return {position:"absolute",left:`${e.left}px`,top:`${e.top}px`,width:`${e.width}px`,height:`${e.height}px`,backgroundColor:t.backgroundColor,borderRadius:t.borderRadius?`${t.borderRadius}px`:void 0,border:t.borderColor?`1px solid ${t.borderColor}`:void 0,zIndex:t.zIndex??0,opacity:t.opacity??1,mixBlendMode:t.mixBlendMode,pointerEvents:"none",userSelect:"none"}}function se(e,t=w){let o=t.backgroundColor;return `
2
+ ${e}::selection,
3
+ ${e} *::selection {
4
+ background-color: ${o} !important;
5
+ color: inherit !important;
6
+ }
7
+
8
+ ${e}::-moz-selection,
9
+ ${e} *::-moz-selection {
10
+ background-color: ${o} !important;
11
+ color: inherit !important;
12
+ }
13
+ `}function ae(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function de(){let e=window.getSelection();return e?e.toString():""}function ue(e){let t=window.getSelection();if(!t||t.rangeCount===0)return false;let o=t.getRangeAt(0);return e.contains(o.commonAncestorContainer)}function fe(){let e=window.getSelection();return !e||e.rangeCount===0?null:e.getRangeAt(0).getBoundingClientRect()}function ge(e,t,o,n,r){try{let l=document.createRange();return l.setStart(t,o),l.setEnd(n,r),l}catch{return null}}function he(e){let t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e));}function pe(){let e=window.getSelection();e&&e.removeAllRanges();}function $(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.anchorNode,o=e.focusNode;return !t||!o?false:t===o?e.focusOffset<e.anchorOffset:(t.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_PRECEDING)!==0}function me(){let e=window.getSelection();if(!e||e.rangeCount===0||!$())return;let t=e.getRangeAt(0),o=document.createRange();o.setStart(t.startContainer,t.startOffset),o.setEnd(t.endContainer,t.endOffset),e.removeAllRanges(),e.addRange(o);}var h=null;function be(e=w){z();let t=`
14
+ /* DOCX Editor Selection Highlighting */
15
+
16
+ /* Base selection style for all editable content */
17
+ .docx-editor [contenteditable="true"]::selection,
18
+ .docx-editor [contenteditable="true"] *::selection,
19
+ .docx-run-editable::selection,
20
+ .docx-run-editable *::selection {
21
+ background-color: ${e.backgroundColor} !important;
22
+ color: inherit !important;
23
+ }
24
+
25
+ /* Firefox selection */
26
+ .docx-editor [contenteditable="true"]::-moz-selection,
27
+ .docx-editor [contenteditable="true"] *::-moz-selection,
28
+ .docx-run-editable::-moz-selection,
29
+ .docx-run-editable *::-moz-selection {
30
+ background-color: ${e.backgroundColor} !important;
31
+ color: inherit !important;
32
+ }
33
+
34
+ /* Ensure selection is visible against all backgrounds */
35
+ .docx-run-highlighted::selection,
36
+ .docx-run-highlighted *::selection {
37
+ /* For highlighted (yellow background) text, use darker selection */
38
+ background-color: rgba(26, 115, 232, 0.5) !important;
39
+ }
40
+
41
+ .docx-run-highlighted::-moz-selection,
42
+ .docx-run-highlighted *::-moz-selection {
43
+ background-color: rgba(26, 115, 232, 0.5) !important;
44
+ }
45
+
46
+ /* Selection in dark text */
47
+ .docx-run-dark-bg::selection,
48
+ .docx-run-dark-bg *::selection {
49
+ /* Use lighter selection for dark backgrounds */
50
+ background-color: rgba(100, 181, 246, 0.5) !important;
51
+ }
52
+
53
+ .docx-run-dark-bg::-moz-selection,
54
+ .docx-run-dark-bg *::-moz-selection {
55
+ background-color: rgba(100, 181, 246, 0.5) !important;
56
+ }
57
+
58
+ /* Programmatic highlight class */
59
+ .docx-selection-highlight {
60
+ background-color: ${e.backgroundColor};
61
+ ${e.borderRadius?`border-radius: ${e.borderRadius}px;`:""}
62
+ ${e.mixBlendMode?`mix-blend-mode: ${e.mixBlendMode};`:""}
63
+ }
64
+
65
+ /* Find/replace highlight */
66
+ .docx-find-highlight {
67
+ background-color: rgba(255, 235, 59, 0.5);
68
+ border-radius: 2px;
69
+ }
70
+
71
+ .docx-find-highlight-current {
72
+ background-color: rgba(255, 152, 0, 0.6);
73
+ border-radius: 2px;
74
+ outline: 2px solid rgba(255, 152, 0, 0.8);
75
+ }
76
+
77
+ /* AI action selection preview */
78
+ .docx-ai-selection-preview {
79
+ background-color: rgba(156, 39, 176, 0.2);
80
+ border-bottom: 2px dashed rgba(156, 39, 176, 0.6);
81
+ }
82
+ `;h=document.createElement("style"),h.id="docx-selection-styles",h.textContent=t,document.head.appendChild(h);}function z(){h&&(h.remove(),h=null);let e=document.getElementById("docx-selection-styles");e&&e.remove();}function xe(){return h!==null||document.getElementById("docx-selection-styles")!==null}function Se(e,t,o=true){return ()=>{if(!e){t([]);return}let n=o?F(e):R(e);t(n);}}var Te=/[\p{L}\p{N}\p{M}_''\-]/u,Ce=/\s/;function N(e){return !e||e.length===0?false:Te.test(e)}function A(e){return !e||e.length===0?false:Ce.test(e)}function p(e,t){if(!e||e.length===0)return [0,0];t=Math.max(0,Math.min(t,e.length-1));let o=e[t];if(A(o)){let n=t,r=t;for(;n>0&&A(e[n-1]);)n--;for(;r<e.length&&A(e[r]);)r++;return [n,r]}if(N(o)){let n=t,r=t;for(;n>0&&N(e[n-1]);)n--;for(;r<e.length&&N(e[r]);)r++;return [n,r]}return [t,t+1]}function we(e,t){let[o,n]=p(e,t);return e.slice(o,n)}function ye(e,t){let[o,n]=p(e,t);return {word:e.slice(o,n),startIndex:o,endIndex:n}}function O(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0),o=t.startContainer;if(o.nodeType===Node.TEXT_NODE){let n=o.textContent||"",r=t.startOffset,[l,i]=p(n,r);if(i>l)return t.setStart(o,l),t.setEnd(o,i),e.removeAllRanges(),e.addRange(t),true}if(o.nodeType===Node.ELEMENT_NODE){let n=o,r=X(n);if(r.length>0){let l=t.startOffset,i=null,c=l;if(l<n.childNodes.length){let s=n.childNodes[l];if(s.nodeType===Node.TEXT_NODE)i=s,c=0;else if(s instanceof Element){let d=X(s);d.length>0&&(i=d[0],c=0);}}if(!i&&r.length>0&&(i=r[0],c=0),i){let s=i.textContent||"",[d,m]=p(s,c);if(m>d){let b=document.createRange();return b.setStart(i,d),b.setEnd(i,m),e.removeAllRanges(),e.addRange(b),true}}}}return false}function Ee(e,t){let o=window.getSelection();if(!o)return false;let n=e.textContent||"",[r,l]=p(n,t);if(l>r){let i=document.createRange();return i.setStart(e,r),i.setEnd(e,l),o.removeAllRanges(),o.addRange(i),true}return false}function Re(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0);if(t.collapsed)return O();let o=t.startContainer,n=t.endContainer,r=t.startOffset,l=t.endOffset;if(o.nodeType===Node.TEXT_NODE){let i=o.textContent||"",[c]=p(i,t.startOffset);r=c;}if(n.nodeType===Node.TEXT_NODE){let i=n.textContent||"",c=Math.max(0,t.endOffset-1),[,s]=p(i,c);l=s;}try{return t.setStart(o,r),t.setEnd(n,l),e.removeAllRanges(),e.addRange(t),!0}catch(i){return console.warn("Could not expand selection to word boundaries:",i),false}}function U(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let o=e.getRangeAt(0).commonAncestorContainer,n=Ne(o);if(n){let r=document.createRange();return r.selectNodeContents(n),e.removeAllRanges(),e.addRange(r),true}return false}function Ne(e){if(!e)return null;let t=e;for(;t;){if(t instanceof Element&&t.hasAttribute("data-paragraph-index"))return t;t=t.parentNode;}return null}function X(e){let t=[],o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),n;for(;n=o.nextNode();)n.nodeType===Node.TEXT_NODE&&t.push(n);return t}var k=0,S=null,v=null,Ae=500;function G(){k=0,v=null,S&&(clearTimeout(S),S=null);}function j(e){return e.target!==v&&G(),k++,v=e.target,S&&clearTimeout(S),S=setTimeout(G,Ae),Math.min(k,3)}function ke(){return e=>{e.ctrlKey||e.metaKey||e.altKey||O();}}function ve(){return e=>{if(j(e)===3){if(e.ctrlKey||e.metaKey||e.altKey)return;U();}}}function V(e,t,o){let n=0;for(let r=t;r<t+o&&r<e.length;r++)n+=e[r];return n}function Oe(e,t,o,n){let r=V(e,t,o),l=Math.floor(r/Math.max(n,1)),i=r-l*n,c=Array.from({length:n},(s,d)=>l+(d<i?1:0));return [...e.slice(0,t),...c,...e.slice(t+o)]}function Me(e,t,o,n,r,l){let i=o-t.rowspan,c=n-t.colspan,s=r+i,d=t.row+t.rowspan,m=t.col+t.colspan,b=[];for(let a of e){if(a===t)continue;let x=a.row+a.rowspan,y=a.col+a.colspan,M=a.row<d&&x>t.row,K=a.col<m&&y>t.col;b.push({data:a.data,row:a.row>=d?a.row+i:a.row,col:a.col>=m?a.col+c:a.col,rowspan:a.rowspan+(i>0&&M&&!K?i:0),colspan:a.colspan+(c>0&&K&&!M?c:0)});}for(let a=0;a<o;a++)for(let x=0;x<n;x++){let y=a===0&&x===0;b.push({data:l(y,a,x),row:t.row+a,col:t.col+x,rowspan:1,colspan:1});}return {anchors:b,deltaRows:i,deltaCols:c,newRowCount:s}}function Ke(e){let t=new Map,o=new Map;for(let n of e){t.set(`${n.row}-${n.col}`,n);for(let r=n.row;r<n.row+n.rowspan;r++)for(let l=n.col;l<n.col+n.colspan;l++)o.set(`${r}-${l}`,n);}return {byStart:t,byCoveredSlot:o}}function Le(e,t){let o=e>1||t>1;return {minRows:e,minCols:t,initialRows:e,initialCols:o?t:t+1}}export{Ee as $,R as A,B,F as C,ce as D,se as E,ae as F,de as G,ue as H,fe as I,ge as J,he as K,pe as L,$ as M,me as N,be as O,z as P,xe as Q,Se as R,V as S,Oe as T,Me as U,Ke as V,Le as W,p as X,we as Y,ye as Z,O as _,g as a,Re as aa,E as b,U as ba,Y as c,j as ca,q as d,ke as da,J as e,ve as ea,L as f,D as g,H as h,P as i,Q as j,T as k,C as l,W as m,I as n,_ as o,Z as p,ee as q,te as r,oe as s,ne as t,u,f as v,re as w,w as x,ie as y,le as z};
@@ -0,0 +1 @@
1
+ function u(n){return n/1440*96}function o(n){return n/96*1440}function P(n){return n==null||isNaN(n)?0:Math.round(n*96/914400)}function _(n){return Math.round(n/96*914400)}function I(n){return Math.round(n/914400*1440)}function E(n){return Math.round(n/1440*914400)}function i(n){return n/72*96}function m(n){return n/144*96}function N(n){return n/2}function H(n){return n/576*96}function e(n,t=2){let r=Math.pow(10,t);return Math.round(n*r)/r}function b(n){return `${e(n)}px`}export{u as a,o as b,P as c,_ as d,I as e,E as f,i as g,m as h,N as i,H as j,b as k};
@@ -0,0 +1 @@
1
+ import {b as b$1}from'./chunk-W53SI3XW.mjs';import {d}from'./chunk-54ULJEHM.mjs';function R(s,t){let a=b$1.getCommandHandler(t.type);if(a)return a(s,t);switch(t.type){case "insertText":return E(s,t);case "replaceText":return B(s,t);case "deleteText":return S(s,t);case "formatText":return V(s,t);case "formatParagraph":return $(s,t);case "applyStyle":return H(s,t);case "insertTable":return A(s,t);case "insertImage":return F(s,t);case "insertHyperlink":return j(s,t);case "removeHyperlink":return N(s,t);case "insertParagraphBreak":return v(s,t);case "mergeParagraphs":return M(s,t);case "splitParagraph":return O(s,t);case "setVariable":return _(s,t);case "applyVariables":return J(s,t);default:let r=t;throw new Error(`Unknown command type: ${r.type}`)}}function q(s,t){return t.reduce((a,r)=>R(a,r),s)}function h(s){return JSON.parse(JSON.stringify(s))}function g(s,t){let a=0;for(let r=0;r<s.content.length;r++)if(s.content[r].type==="paragraph"){if(a===t)return r;a++;}return -1}function I(s){let t="";for(let a of s.content)if(a.type==="run")for(let r of a.content)r.type==="text"&&(t+=r.text);else if(a.type==="hyperlink"){for(let r of a.children)if(r.type==="run")for(let e of r.content)e.type==="text"&&(t+=e.text);}return t}function b(s,t){return {type:"run",formatting:t,content:[{type:"text",text:s}]}}function C(s,t,a,r){let e=[],o=0,p=false;for(let n of s.content)if(n.type==="run"){let c=n.content.filter(l=>l.type==="text").map(l=>l.text).join(""),i=o,u=o+c.length;if(!p&&t>=i&&t<=u){let l=t-i;l>0&&e.push({...n,content:[{type:"text",text:c.slice(0,l)}]}),e.push(b(a,r||n.formatting)),l<c.length&&e.push({...n,content:[{type:"text",text:c.slice(l)}]}),p=true;}else e.push(n);o=u;}else e.push(n);return p||e.push(b(a,r)),e}function y(s,t,a){let r=[],e=0;for(let o of s.content)if(o.type==="run"){let p=o.content.filter(i=>i.type==="text").map(i=>i.text).join(""),n=e,c=e+p.length;if(c<=t||n>=a)r.push(o);else {let i="";n<t&&(i+=p.slice(0,t-n)),c>a&&(i+=p.slice(a-n)),i.length>0&&r.push({...o,content:[{type:"text",text:i}]});}e=c;}else r.push(o);return r}function D(s,t,a,r){let e=[],o=0;for(let p of s.content)if(p.type==="run"){let n=p.content.filter(u=>u.type==="text").map(u=>u.text).join(""),c=o,i=o+n.length;if(i<=t||c>=a)e.push(p);else if(c>=t&&i<=a)e.push({...p,formatting:{...p.formatting,...r}});else {let u=Math.max(t,c),l=Math.min(a,i);c<u&&e.push({...p,content:[{type:"text",text:n.slice(0,u-c)}]}),e.push({...p,formatting:{...p.formatting,...r},content:[{type:"text",text:n.slice(u-c,l-c)}]}),i>l&&e.push({...p,content:[{type:"text",text:n.slice(l-c)}]});}o=i;}else e.push(p);return e}function E(s,t){let a=h(s),r=a.package.document,e=g(r,t.position.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.position.paragraphIndex} not found`);let o=r.content[e];return o.content=C(o,t.position.offset,t.text,t.formatting),a}function B(s,t){let a=h(s),r=a.package.document,{start:e,end:o}=t.range;if(e.paragraphIndex===o.paragraphIndex){let p=g(r,e.paragraphIndex);if(p===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let n=r.content[p];n.content=y(n,e.offset,o.offset),n.content=C(n,e.offset,t.text,t.formatting);}else {let p=g(r,e.paragraphIndex),n=r.content[p],c=I(n);n.content=y(n,e.offset,c.length),n.content=C(n,e.offset,t.text,t.formatting);let i=[];for(let u=e.paragraphIndex+1;u<=o.paragraphIndex;u++)i.push(g(r,u));for(let u=i.length-1;u>=0;u--)i[u]!==-1&&r.content.splice(i[u],1);}return a}function S(s,t){let a=h(s),r=a.package.document,{start:e,end:o}=t.range;if(e.paragraphIndex===o.paragraphIndex){let p=g(r,e.paragraphIndex);if(p===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let n=r.content[p];n.content=y(n,e.offset,o.offset);}else {let p=g(r,e.paragraphIndex),n=r.content[p],c=I(n);n.content=y(n,e.offset,c.length);let i=g(r,o.paragraphIndex),u=r.content[i];u.content=y(u,0,o.offset),n.content.push(...u.content);let l=[];for(let f=e.paragraphIndex+1;f<=o.paragraphIndex;f++)l.push(g(r,f));for(let f=l.length-1;f>=0;f--)l[f]!==-1&&r.content.splice(l[f],1);}return a}function V(s,t){let a=h(s),r=a.package.document,{start:e,end:o}=t.range;if(e.paragraphIndex===o.paragraphIndex){let p=g(r,e.paragraphIndex);if(p===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let n=r.content[p];n.content=D(n,e.offset,o.offset,t.formatting);}else for(let p=e.paragraphIndex;p<=o.paragraphIndex;p++){let n=g(r,p);if(n===-1)continue;let c=r.content[n],i=I(c),u=0,l=i.length;p===e.paragraphIndex&&(u=e.offset),p===o.paragraphIndex&&(l=o.offset),c.content=D(c,u,l,t.formatting);}return a}function $(s,t){let a=h(s),r=a.package.document,e=g(r,t.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let o=r.content[e];if(o.formatting={...o.formatting,...t.formatting},"numPr"in t.formatting){let p=t.formatting.numPr;if(p&&p.numId!==void 0&&p.numId!==0){let n=p.ilvl??0,c=p.numId===1,i=c?"\u2022":"1.";if(a.package.numbering){let u=a.package.numbering.nums.find(l=>l.numId===p.numId);if(u){let l=a.package.numbering.abstractNums.find(f=>f.abstractNumId===u.abstractNumId);if(l){let f=l.levels.find(x=>x.ilvl===n);f&&(i=f.lvlText||i);}}}o.listRendering={level:n,numId:p.numId,marker:i,isBullet:c};}else delete o.listRendering;}return a}function H(s,t){let a=h(s),r=a.package.document,e=g(r,t.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let o=r.content[e];return o.formatting={...o.formatting,styleId:t.styleId},a}function A(s,t){let a=h(s),r=a.package.document,e=[];for(let n=0;n<t.rows;n++){let c=[];for(let i=0;i<t.columns;i++){let u=t.data?.[n]?.[i]||"";c.push({type:"tableCell",content:[{type:"paragraph",content:u?[b(u)]:[]}]});}e.push({type:"tableRow",formatting:n===0&&t.hasHeader?{header:true}:void 0,cells:c});}let o={type:"table",rows:e},p=g(r,t.position.paragraphIndex);return p===-1?r.content.push(o):r.content.splice(p+1,0,o),a}function F(s,t){let a=h(s),r=a.package.document,e=g(r,t.position.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.position.paragraphIndex} not found`);let o=r.content[e],n={type:"run",content:[{type:"drawing",image:{type:"image",rId:`rId_img_${Date.now()}`,src:t.src,alt:t.alt,size:{width:d(t.width||100),height:d(t.height||100)},wrap:{type:"inline"}}}]},c=C(o,t.position.offset,"",void 0),i=false,u=0;for(let l=0;l<c.length;l++){let f=c[l];if(f.type==="run"){let x=f.content.filter(d=>d.type==="text").map(d=>d.text).join("");if(u+=x.length,!i&&u>=t.position.offset){c.splice(l+1,0,n),i=true;break}}}return i||c.push(n),o.content=c,a}function j(s,t){let a=h(s),r=a.package.document,{start:e,end:o}=t.range;if(e.paragraphIndex!==o.paragraphIndex)throw new Error("Hyperlinks cannot span multiple paragraphs");let p=g(r,e.paragraphIndex);if(p===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let n=r.content[p],c=I(n),i=t.displayText||c.slice(e.offset,o.offset);n.content=y(n,e.offset,o.offset);let u={type:"hyperlink",href:t.url,tooltip:t.tooltip,children:[b(i)]},l=false,f=0,x=[];for(let d of n.content)if(d.type==="run"){let P=d.content.filter(m=>m.type==="text").map(m=>m.text).join(""),k=f+P.length;if(!l&&f<=e.offset&&e.offset<=k){let m=e.offset-f;m>0&&x.push({...d,content:[{type:"text",text:P.slice(0,m)}]}),x.push(u),m<P.length&&x.push({...d,content:[{type:"text",text:P.slice(m)}]}),l=true;}else x.push(d);f=k;}else x.push(d);return l||x.push(u),n.content=x,a}function N(s,t){let a=h(s),r=a.package.document,{start:e}=t.range,o=g(r,e.paragraphIndex);if(o===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let p=r.content[o],n=[];for(let c of p.content)if(c.type==="hyperlink")for(let i of c.children)i.type==="run"&&n.push(i);else n.push(c);return p.content=n,a}function v(s,t){let a=h(s),r=a.package.document,e=g(r,t.position.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.position.paragraphIndex} not found`);let o=r.content[e],p=I(o),n=y({...o,content:[...o.content]},t.position.offset,p.length),c=y({...o,content:[...o.content]},0,t.position.offset);o.content=n;let i={type:"paragraph",formatting:o.formatting,content:c};return r.content.splice(e+1,0,i),a}function M(s,t){let a=h(s),r=a.package.document,e=g(r,t.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let o=r.content[e],p=[];for(let n=1;n<=t.count;n++){let c=g(r,t.paragraphIndex+n);if(c!==-1){let i=r.content[c];o.content.push(...i.content),p.push(c);}}for(let n=p.length-1;n>=0;n--)r.content.splice(p[n],1);return a}function O(s,t){return v(s,{position:t.position})}function _(s,t){let a=h(s);return a.templateVariables||(a.templateVariables=[]),a.templateVariables.includes(t.name)||a.templateVariables.push(t.name),a}function J(s,t){let a=h(s),r=a.package.document;function e(n){for(let c of n.content)if(c.type==="text")for(let[i,u]of Object.entries(t.values)){let l=new RegExp(`\\{${i}\\}`,"g");c.text=c.text.replace(l,u);}}function o(n){for(let c of n.content)if(c.type==="run")e(c);else if(c.type==="hyperlink")for(let i of c.children)i.type==="run"&&e(i);}function p(n){if(n.type==="paragraph")o(n);else if(n.type==="table")for(let c of n.rows)for(let i of c.cells)for(let u of i.content)p(u);}for(let n of r.content)p(n);return a}export{R as a,q as b};
@@ -0,0 +1 @@
1
+ function t(){return Math.floor(Math.random()*4294967296).toString(16).toUpperCase().padStart(8,"0")}export{t as a};