@betteroffice/docx 0.0.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 (190) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +41 -0
  3. package/dist/Subscribable-DOz6Ohoo.d.mts +33 -0
  4. package/dist/agent/index.d.mts +531 -0
  5. package/dist/agent/index.mjs +1 -0
  6. package/dist/chunk-34K66SY4.mjs +1 -0
  7. package/dist/chunk-3UBMCDME.mjs +1 -0
  8. package/dist/chunk-4RCISPPE.mjs +1 -0
  9. package/dist/chunk-4UD54UM5.mjs +1 -0
  10. package/dist/chunk-52GB3Y42.mjs +1 -0
  11. package/dist/chunk-6NEKRDXF.mjs +1 -0
  12. package/dist/chunk-6PW4CWUG.mjs +1 -0
  13. package/dist/chunk-7DEIW7FL.mjs +1 -0
  14. package/dist/chunk-7PCO5I2O.mjs +1 -0
  15. package/dist/chunk-BI3B33LI.mjs +1 -0
  16. package/dist/chunk-BIQWVK5P.mjs +2 -0
  17. package/dist/chunk-CIRN3LZA.mjs +1 -0
  18. package/dist/chunk-DXKG3HQ5.mjs +16 -0
  19. package/dist/chunk-EUUIJVM6.mjs +0 -0
  20. package/dist/chunk-FPZBTOD6.mjs +1 -0
  21. package/dist/chunk-FZIA7OFY.mjs +1 -0
  22. package/dist/chunk-GWKJ2Y4Y.mjs +1 -0
  23. package/dist/chunk-H3JCIGWK.mjs +1 -0
  24. package/dist/chunk-HJGAQIU7.mjs +2 -0
  25. package/dist/chunk-I6KKMUUC.mjs +1 -0
  26. package/dist/chunk-IL5JZJT7.mjs +1 -0
  27. package/dist/chunk-JY6ILTNS.mjs +1 -0
  28. package/dist/chunk-KEE52TT5.mjs +1 -0
  29. package/dist/chunk-KVKLLTDP.mjs +58 -0
  30. package/dist/chunk-KXNZFTTK.mjs +1 -0
  31. package/dist/chunk-L5ISVQ3W.mjs +1 -0
  32. package/dist/chunk-LDUWIM7M.mjs +1 -0
  33. package/dist/chunk-N5Q3YN64.mjs +1 -0
  34. package/dist/chunk-NEWOMDTX.mjs +1 -0
  35. package/dist/chunk-O2QSE2I7.mjs +1 -0
  36. package/dist/chunk-OBQGPMPQ.mjs +1 -0
  37. package/dist/chunk-OJOHXQNQ.mjs +1 -0
  38. package/dist/chunk-OMR3TWCD.mjs +2 -0
  39. package/dist/chunk-P3KDV4M2.mjs +1 -0
  40. package/dist/chunk-Q7PO7V73.mjs +1 -0
  41. package/dist/chunk-QOUFE3VX.mjs +1 -0
  42. package/dist/chunk-SINEY6ZF.mjs +1 -0
  43. package/dist/chunk-T4EZMUXM.mjs +1 -0
  44. package/dist/chunk-TTRUPDAB.mjs +1 -0
  45. package/dist/chunk-TYHI7RAD.mjs +1 -0
  46. package/dist/chunk-UIEJWORW.mjs +1 -0
  47. package/dist/chunk-VAOUFAUH.mjs +1 -0
  48. package/dist/chunk-VBOTMRXV.mjs +1 -0
  49. package/dist/chunk-VCER63GQ.mjs +1 -0
  50. package/dist/chunk-WAUF2UC7.mjs +2 -0
  51. package/dist/chunk-WRWRCBLK.mjs +1 -0
  52. package/dist/chunk-X4XDO3LZ.mjs +1 -0
  53. package/dist/chunk-XQBCCJBO.mjs +9 -0
  54. package/dist/chunk-XWUOLYRQ.mjs +2 -0
  55. package/dist/chunk-XYH6XWP3.mjs +10 -0
  56. package/dist/chunk-YBIM6UJV.mjs +8 -0
  57. package/dist/chunk-YCIH2Q3E.mjs +1 -0
  58. package/dist/chunk-YUOKI2HB.mjs +1 -0
  59. package/dist/chunk-ZOV5KL7C.mjs +1 -0
  60. package/dist/colorResolver-n0o7H7ep.d.mts +290 -0
  61. package/dist/content-sSHuWw49.d.mts +2202 -0
  62. package/dist/core-plugins.d.mts +37 -0
  63. package/dist/core-plugins.mjs +1 -0
  64. package/dist/core.d.mts +451 -0
  65. package/dist/core.mjs +1 -0
  66. package/dist/displayListQueries-p-ijSzdh.d.mts +222 -0
  67. package/dist/docx/index.d.mts +618 -0
  68. package/dist/docx/index.mjs +2 -0
  69. package/dist/docx/parser.d.mts +41 -0
  70. package/dist/docx/parser.mjs +1 -0
  71. package/dist/docx/rezip.d.mts +148 -0
  72. package/dist/docx/rezip.mjs +1 -0
  73. package/dist/docx/serializer/index.d.mts +42 -0
  74. package/dist/docx/serializer/index.mjs +1 -0
  75. package/dist/docx/wrapTypes.d.mts +19 -0
  76. package/dist/docx/wrapTypes.mjs +1 -0
  77. package/dist/docxInput-DTbCa48g.d.mts +21 -0
  78. package/dist/editor/index.d.mts +170 -0
  79. package/dist/editor/index.mjs +1 -0
  80. package/dist/editorTree-DO5PyDK8.d.mts +37 -0
  81. package/dist/executor-7O2RBJ2B.mjs +1 -0
  82. package/dist/fontLoader-Bx6DK6-2.d.mts +327 -0
  83. package/dist/formatting-DoL7KBSL.d.mts +823 -0
  84. package/dist/generated/edit/docx_edit_bg.wasm +0 -0
  85. package/dist/generated/layout/docx_layout_bg.wasm +0 -0
  86. package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
  87. package/dist/generated/parse/docx_parse_bg.wasm +0 -0
  88. package/dist/headerFooterLayout-0zPT64Qc.d.mts +316 -0
  89. package/dist/headless.d.mts +69 -0
  90. package/dist/headless.mjs +1 -0
  91. package/dist/layout/flow/index.d.mts +149 -0
  92. package/dist/layout/flow/index.mjs +1 -0
  93. package/dist/layout/index.d.mts +307 -0
  94. package/dist/layout/index.mjs +1 -0
  95. package/dist/layout/measure/index.d.mts +324 -0
  96. package/dist/layout/measure/index.mjs +1 -0
  97. package/dist/layout/pagination/index.d.mts +60 -0
  98. package/dist/layout/pagination/index.mjs +1 -0
  99. package/dist/layout/pagination/types.d.mts +4 -0
  100. package/dist/layout/pagination/types.mjs +1 -0
  101. package/dist/layout/render/index.d.mts +733 -0
  102. package/dist/layout/render/index.mjs +1 -0
  103. package/dist/loadWasmAsset-CMvnVkfA.d.mts +3 -0
  104. package/dist/managers/AutoSaveManager.d.mts +81 -0
  105. package/dist/managers/AutoSaveManager.mjs +1 -0
  106. package/dist/managers/TableSelectionManager.d.mts +74 -0
  107. package/dist/managers/TableSelectionManager.mjs +1 -0
  108. package/dist/managers/types.d.mts +113 -0
  109. package/dist/managers/types.mjs +0 -0
  110. package/dist/mcp-cli.mjs +142 -0
  111. package/dist/mcp.d.mts +162 -0
  112. package/dist/mcp.mjs +16 -0
  113. package/dist/measureBlocksPipeline-Df0Bbrwy.d.mts +109 -0
  114. package/dist/measuredBlock-DZwz8zhD.d.mts +26 -0
  115. package/dist/plugin-api/RenderedDomContext.d.mts +114 -0
  116. package/dist/plugin-api/RenderedDomContext.mjs +1 -0
  117. package/dist/plugin-api/index.d.mts +7 -0
  118. package/dist/plugin-api/index.mjs +0 -0
  119. package/dist/plugin-api/resolveItemPositions.d.mts +39 -0
  120. package/dist/plugin-api/resolveItemPositions.mjs +1 -0
  121. package/dist/plugin-api/types.d.mts +193 -0
  122. package/dist/plugin-api/types.mjs +0 -0
  123. package/dist/processTemplate-HDUIZFJ5.mjs +1 -0
  124. package/dist/registry-DMM5VTdT.d.mts +165 -0
  125. package/dist/rustDisplayList-dqunvwxH.d.mts +1036 -0
  126. package/dist/rustPagination-Bj2hq013.d.mts +106 -0
  127. package/dist/sectionConfigs-DW3J8q0X.d.mts +55 -0
  128. package/dist/selectionContext-Buc9BCU1.d.mts +570 -0
  129. package/dist/selectiveSave-oFBJ1n71.d.mts +16 -0
  130. package/dist/selectiveXmlPatch-ypkxlTD_.d.mts +23 -0
  131. package/dist/settingsParser-CcGvtmCK.d.mts +33 -0
  132. package/dist/styles/index.d.mts +162 -0
  133. package/dist/styles/index.mjs +1 -0
  134. package/dist/styles-VxNcXLdi.d.mts +189 -0
  135. package/dist/types/agentApi.d.mts +456 -0
  136. package/dist/types/agentApi.mjs +1 -0
  137. package/dist/types/content.d.mts +3 -0
  138. package/dist/types/content.mjs +1 -0
  139. package/dist/types/document.d.mts +117 -0
  140. package/dist/types/document.mjs +1 -0
  141. package/dist/types-DNrYr6yQ.d.mts +1754 -0
  142. package/dist/types-dYdjUZMo.d.mts +311 -0
  143. package/dist/units-O5Y02RKQ.d.mts +34 -0
  144. package/dist/utils/autoScroll.d.mts +24 -0
  145. package/dist/utils/autoScroll.mjs +1 -0
  146. package/dist/utils/cardStyles.d.mts +22 -0
  147. package/dist/utils/cardStyles.mjs +1 -0
  148. package/dist/utils/comments.d.mts +120 -0
  149. package/dist/utils/comments.mjs +4 -0
  150. package/dist/utils/findReplace.d.mts +114 -0
  151. package/dist/utils/findReplace.mjs +2 -0
  152. package/dist/utils/findVerticalScrollParent.d.mts +25 -0
  153. package/dist/utils/findVerticalScrollParent.mjs +1 -0
  154. package/dist/utils/fontOptions.d.mts +21 -0
  155. package/dist/utils/fontOptions.mjs +1 -0
  156. package/dist/utils/headingCollector.d.mts +28 -0
  157. package/dist/utils/headingCollector.mjs +1 -0
  158. package/dist/utils/highlightColors.d.mts +14 -0
  159. package/dist/utils/highlightColors.mjs +1 -0
  160. package/dist/utils/index.d.mts +956 -0
  161. package/dist/utils/index.mjs +84 -0
  162. package/dist/utils/listState.d.mts +27 -0
  163. package/dist/utils/listState.mjs +1 -0
  164. package/dist/utils/reportIssue.d.mts +23 -0
  165. package/dist/utils/reportIssue.mjs +2 -0
  166. package/dist/utils/sidebarConstants.d.mts +10 -0
  167. package/dist/utils/sidebarConstants.mjs +1 -0
  168. package/dist/utils/stylePreview.d.mts +70 -0
  169. package/dist/utils/stylePreview.mjs +1 -0
  170. package/dist/utils/textSelection.d.mts +92 -0
  171. package/dist/utils/textSelection.mjs +1 -0
  172. package/dist/utils/units.d.mts +78 -0
  173. package/dist/utils/units.mjs +1 -0
  174. package/dist/variableDetector-Borj29SF.d.mts +115 -0
  175. package/dist/wasm-FZQ5XB2Y.mjs +1 -0
  176. package/dist/wasm-SA237OSP.mjs +1 -0
  177. package/dist/wasm-edit.d.mts +473 -0
  178. package/dist/wasm-edit.mjs +1 -0
  179. package/dist/wasm-layout.d.mts +112 -0
  180. package/dist/wasm-layout.mjs +1 -0
  181. package/dist/wasm-opc.d.mts +16 -0
  182. package/dist/wasm-opc.mjs +1 -0
  183. package/dist/wasm-parse.d.mts +18 -0
  184. package/dist/wasm-parse.mjs +1 -0
  185. package/dist/watermarkApi-DCxjutkg.d.mts +38 -0
  186. package/dist/yrs/index.d.mts +882 -0
  187. package/dist/yrs/index.mjs +1 -0
  188. package/dist/yrs/residentEngineWorker.d.mts +2 -0
  189. package/dist/yrs/residentEngineWorker.mjs +1 -0
  190. package/package.json +365 -0
@@ -0,0 +1,84 @@
1
+ export{a as collectHeadings}from'../chunk-TYHI7RAD.mjs';export{k as createDoubleClickWordSelector,l as createTripleClickParagraphSelector,h as expandSelectionToWordBoundaries,e as findWordAt,c as findWordBoundaries,d as getWordAt,j as handleClickForMultiClick,i as selectParagraphAtCursor,f as selectWordAtCursor,g as selectWordInTextNode}from'../chunk-4RCISPPE.mjs';export{d as MIN_CARD_GAP,c as SIDEBAR_DOCUMENT_SHIFT,b as SIDEBAR_PAGE_GAP,a as SIDEBAR_WIDTH}from'../chunk-YUOKI2HB.mjs';export{n as countPageBreaks,b as createColumnBreak,g as createHorizontalRule,c as createLineBreak,a as createPageBreak,e as createPageBreakParagraph,d as createPageBreakRun,o as findPageBreaks,m as hasPageBreakBefore,h as insertHorizontalRule,f as insertPageBreak,l as isBreakContent,j as isColumnBreak,k as isLineBreak,i as isPageBreak,p as removePageBreak}from'../chunk-34K66SY4.mjs';export{b as createDocumentWithText,a as createEmptyDocument}from'../chunk-VAOUFAUH.mjs';import {i,b as b$1}from'../chunk-L5ISVQ3W.mjs';export{j as colorsEqual,g as createRgbColor,f as createThemeColor,h as ensureHexPrefix,c as isBlack,d as isWhite,e as parseColorString,a as resolveHighlightColor,i as resolveHighlightToCss,b as resolveShadingColor}from'../chunk-L5ISVQ3W.mjs';export{j as createTemplateProcessor,g as getMissingVariables,e as getTemplateTags,h as previewTemplate,a as processTemplate,i as processTemplateAdvanced,d as processTemplateAndDownload,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'../chunk-O2QSE2I7.mjs';export{a as sanitizeHref}from'../chunk-ZOV5KL7C.mjs';import {e,d as d$1}from'../chunk-FZIA7OFY.mjs';export{i as blendColors,g as darkenColor,k as generateThemeTintShadeMatrix,f as getContrastingColor,j as getThemeTintShadeHex,h as lightenColor,d as resolveColor,e as resolveColorToHex}from'../chunk-FZIA7OFY.mjs';import {l,k,q as q$1,g,f,n}from'../chunk-3UBMCDME.mjs';export{a as PIXELS_PER_INCH,e as TWIPS_PER_INCH,p as clamp,n as eighthsToPixels,b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,l as halfPointsToPoints,c as pixelsToEmu,h as pixelsToTwips,m as pointsToHalfPoints,d as pointsToPixels,o as roundPixels,j as twipsToEmu,g as twipsToPixels}from'../chunk-3UBMCDME.mjs';import {o,d,e as e$1}from'../chunk-DXKG3HQ5.mjs';export{s as FONT_MAPPING,o as canRenderFont,c as deobfuscateFont,B as extractEmbeddedFontFaces,x as extractFontsFromDocument,A as getEmbeddedFontFaces,z as getEmbeddedFontFamilies,t as getGoogleFontEquivalent,l as getLoadedFonts,h as isFontLoaded,j as isGoogleFontsEnabled,k as isLoading,b as isValidFontKey,y as loadDocumentFonts,C as loadEmbeddedFonts,f as loadFont,r as loadFontDefinitions,p as loadFontFromBuffer,q as loadFontFromUrl,u as loadFontWithMapping,g as loadFonts,v as loadFontsWithMapping,n as onFontError,m as onFontsLoaded,w as preloadCommonFonts,i as setGoogleFontsEnabled,a as toArrayBuffer}from'../chunk-DXKG3HQ5.mjs';import'../chunk-FPZBTOD6.mjs';import'../chunk-H3JCIGWK.mjs';import'../chunk-SINEY6ZF.mjs';import'../chunk-T4EZMUXM.mjs';import'../chunk-TTRUPDAB.mjs';import wo from'dompurify';var Fo;function Ro(){return Fo??(Fo=wo(window))}var Ao="application/x-docx-editor",h={HTML:"text/html",PLAIN:"text/plain"};function Po(e){if(!e)return [];let t=()=>{if(!e.items||e.items.length===0)return [];let a=[];for(let d of Array.from(e.items)){if(d.kind!=="file"||!d.type.startsWith("image/"))continue;let f=d.getAsFile();f&&a.push(f);}return a},o=()=>!e.files||e.files.length===0?[]:Array.from(e.files).filter(a=>a.type.startsWith("image/")),n=t(),r=n.length?n:o();if(r.length<=1)return r;let i=["image/png","image/jpeg","image/webp","image/gif","image/svg+xml","image/bmp","image/tiff"],s=a=>{let d=a[0],f=i.indexOf(d.type);f<0&&(f=Number.MAX_SAFE_INTEGER);for(let u of a.slice(1)){let m=i.indexOf(u.type);if(m<0&&(m=Number.MAX_SAFE_INTEGER),m<f){d=u,f=m;continue}m===f&&u.size>d.size&&(d=u);}return d},l=new Map;for(let a of r){let d=a.name?.trim()??"",u=(d?d.replace(/\.[^/.]+$/,"").toLowerCase():"")||`size:${a.size}`,m=l.get(u);m?m.push(a):l.set(u,[a]);}let c=[];for(let a of l.values())c.push(s(a));return c}async function j(e,t={}){let{includeFormatting:o=true,onError:n,theme:r}=t;try{let i=N(e,o,r);return await P(i)}catch(i){return n?.(i),false}}async function Eo(e,t={}){let{includeFormatting:o=true,onError:n,theme:r}=t;try{let i=ae(e,o,r);return await P(i)}catch(i){return n?.(i),false}}function N(e,t=true,o){let n=e.map(Y).join(""),r=t?pe(e,o):q(n),i=JSON.stringify(e);return {plainText:n,html:r,internal:i}}function ae(e,t=true,o){let n=e.map(Lo).join(`
2
+ `),r=t?Ho(e,o):q(n),i=JSON.stringify(e);return {plainText:n,html:r,internal:i}}async function P(e){try{if(navigator.clipboard&&navigator.clipboard.write){let t=[new ClipboardItem({[h.PLAIN]:new Blob([e.plainText],{type:h.PLAIN}),[h.HTML]:new Blob([e.html],{type:h.HTML})})];return await navigator.clipboard.write(t),!0}return ne(e)}catch{return ne(e)}}function ne(e){let t=document.createElement("div");t.innerHTML=e.html,t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t);try{let o=window.getSelection();if(!o)return !1;let n=document.createRange();n.selectNodeContents(t),o.removeAllRanges(),o.addRange(n);let r=document.execCommand("copy");return o.removeAllRanges(),r}finally{document.body.removeChild(t);}}async function ko(e={}){let{cleanWordFormatting:t=true,onError:o}=e;try{if(navigator.clipboard&&navigator.clipboard.read){let n=await navigator.clipboard.read();return await vo(n,t)}return null}catch(n){return o?.(n),null}}async function vo(e,t){let o="",n="";for(let r of e)r.types.includes(h.HTML)&&(o=await(await r.getType(h.HTML)).text()),r.types.includes(h.PLAIN)&&(n=await(await r.getType(h.PLAIN)).text());return V(o,n,t)}function le(e,t={}){let{cleanWordFormatting:o=true}=t,n=e.clipboardData;if(!n)return null;let r=n.getData(h.HTML),i=n.getData(h.PLAIN);return V(r,i,o)}function V(e,t,o=true){let n=ce(e),r=de(e);if(r){let l=e.match(/data-docx-editor-content="([^"]+)"/);if(l)try{return {runs:JSON.parse(decodeURIComponent(l[1])),fromWord:!1,fromEditor:!0,plainText:t}}catch{}}let i=e;return n&&o&&(i=ue(e)),{runs:fe(i,t),fromWord:n,fromEditor:r,plainText:t}}function ce(e){return e.includes("urn:schemas-microsoft-com:office")||e.includes("mso-")||e.includes("MsoNormal")||e.includes('class="Mso')||e.includes("<!--[if gte mso")}function de(e){return e.includes("data-docx-editor")||e.includes("docx-run")||e.includes("docx-paragraph")}function No(e){let t="",o=0;for(;o<e.length;){let n=e.indexOf("<!--",o);if(n===-1){t+=e.slice(o);break}t+=e.slice(o,n);let r=e.indexOf("-->",n+4);if(r===-1)break;o=r+3;}return t}function re(e,t){let o="<"+t,n="</"+t,r=e.toLowerCase(),i="",s=0;for(;s<e.length;){let l=r.indexOf(o,s);if(l===-1){i+=e.slice(s);break}let c=e.indexOf(">",l),a=c===-1?-1:r.indexOf(n,c+1),d=a===-1?-1:e.indexOf(">",a);if(d===-1){i+=e.slice(s);break}i+=e.slice(s,l),s=d+1;}return i}function ue(e){let t=e;return t=No(t),t=t.replace(/<\?xml[^>]*>/gi,""),t=re(t,"o:"),t=t.replace(/<o:[^>]*\/>/gi,""),t=re(t,"w:"),t=t.replace(/<w:[^>]*\/>/gi,""),t=t.replace(/\s*mso-[^:;]+:[^;]+;?/gi,""),t=t.replace(/\s*style="\s*"/gi,""),t=t.replace(/\s*class="[^"]*Mso[^"]*"/gi,""),t=t.replace(/<span[^>]*>\s*<\/span>/gi,""),t=t.replace(/<\/?font[^>]*>/gi,""),t=t.replace(/\s+/g," ").trim(),t}function fe(e,t){if(!e||e.trim()==="")return t?[X(t)]:[];let o=Ro().sanitize(e),r=new DOMParser().parseFromString(o,"text/html").body,i=[];return U(r,i,{}),i.length===0&&t?[X(t)]:i}function U(e,t,o){if(e.nodeType===Node.TEXT_NODE){let s=e.textContent||"";(s.trim()||s.includes(" "))&&t.push(X(s,o));return}if(e.nodeType!==Node.ELEMENT_NODE)return;let n=e,r=n.tagName.toLowerCase(),i={...o,...Do(n)};switch(r){case "br":t.push(se(i));return;case "p":case "div":for(let s of n.childNodes)U(s,t,i);n.nextSibling&&t.push(se(i));return;case "b":case "strong":i.bold=true;break;case "i":case "em":i.italic=true;break;case "u":i.underline={style:"single"};break;case "s":case "strike":case "del":i.strike=true;break;case "sup":i.vertAlign="superscript";break;case "sub":i.vertAlign="subscript";break;case "code":case "pre":i.fontFamily={ascii:"Courier New"};break}for(let s of n.childNodes)U(s,t,i);}function Do(e){let t={},o=e.style;(o.fontWeight==="bold"||parseInt(o.fontWeight)>=700)&&(t.bold=true),o.fontStyle==="italic"&&(t.italic=true);let n=o.textDecoration||o.textDecorationLine;if(n&&(n.includes("underline")&&(t.underline={style:"single"}),n.includes("line-through")&&(t.strike=true)),o.fontSize){let r=parseFloat(o.fontSize);isNaN(r)||(t.fontSize=Math.round(r/1.333*2));}if(o.fontFamily){let r=o.fontFamily.replace(/["']/g,"").split(",")[0].trim();r&&(t.fontFamily={ascii:r});}if(o.color){let r=ie(o.color);r&&(t.color={rgb:r});}if(o.backgroundColor&&o.backgroundColor!=="transparent"){let r=ie(o.backgroundColor);r&&(t.shading={fill:{rgb:r}});}return t}function ie(e){if(!e||e==="transparent"||e==="inherit")return null;if(e.startsWith("#"))return e.slice(1).toUpperCase();let t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(t){let o=parseInt(t[1]).toString(16).padStart(2,"0"),n=parseInt(t[2]).toString(16).padStart(2,"0"),r=parseInt(t[3]).toString(16).padStart(2,"0");return (o+n+r).toUpperCase()}return null}function Y(e){return e.content.map(t=>t.type==="text"?t.text:t.type==="tab"?" ":t.type==="break"&&t.breakType==="textWrapping"?`
3
+ `:"").join("")}function Lo(e){return (e.content||[]).map(t=>t.type==="run"?Y(t):"").join("")}function pe(e,t){return e.map(o=>Oo(o,t)).join("")}function Ho(e,t){return e.map(o=>`<p>${pe(o.content?.filter(n=>n.type==="run")||[],t)}</p>`).join("")}function Oo(e$1,t){let o=Y(e$1);if(!o)return "";let n=q(o),r=e$1.formatting;if(!r)return n;r.bold&&(n=`<strong>${n}</strong>`),r.italic&&(n=`<em>${n}</em>`),r.underline&&(n=`<u>${n}</u>`),r.strike&&(n=`<s>${n}</s>`),r.vertAlign==="superscript"&&(n=`<sup>${n}</sup>`),r.vertAlign==="subscript"&&(n=`<sub>${n}</sub>`);let i=[];if(r.fontSize){let c=r.fontSize/2;i.push(`font-size: ${c}pt`);}r.fontFamily?.ascii&&i.push(`font-family: "${r.fontFamily.ascii}"`);let s=e(r.color,t);s&&i.push(`color: #${s}`);let l=e(r.shading?.fill,t);return l&&i.push(`background-color: #${l}`),i.length>0&&(n=`<span style="${i.join("; ")}">${n}</span>`),n}function q(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function X(e,t){return {type:"run",formatting:t,content:[{type:"text",text:e}]}}function se(e){return {type:"run",formatting:e,content:[{type:"break",breakType:"textWrapping"}]}}function Mo(e){let{onCopy:t,onCut:o,onPaste:n,clipboardOptions:r={}}=e;return {handleCopy:async a=>{if(!t)return;let d=t();if(!d)return;a.preventDefault();let f=N(d.runs);a.clipboardData?(a.clipboardData.setData(h.PLAIN,f.plainText),a.clipboardData.setData(h.HTML,f.html)):await P(f);},handleCut:async a=>{if(!o)return;let d=o();if(!d)return;a.preventDefault();let f=N(d.runs);a.clipboardData?(a.clipboardData.setData(h.PLAIN,f.plainText),a.clipboardData.setData(h.HTML,f.html)):await P(f);},handlePaste:a=>{if(!n)return;a.preventDefault();let d=le(a,r);d&&n(d);},handleKeyDown:async a=>{let d=a.ctrlKey||a.metaKey;if(d&&a.key==="c"&&!a.shiftKey&&t){let f=t();f&&await j(f.runs,r);}if(d&&a.key==="x"&&!a.shiftKey&&o){let f=o();f&&await j(f.runs,r);}}}}function he(e){let t=new Set,o=e.package;if(o.theme&&Io(o.theme,t),o.styles&&Bo(o.styles,t),o.document)for(let n of o.document.content)E(n,t);if(o.headers)for(let n of o.headers.values())me(n,t);if(o.footers)for(let n of o.footers.values())me(n,t);if(o.footnotes)for(let n of o.footnotes)Uo(n,t);if(o.endnotes)for(let n of o.endnotes)Xo(n,t);return Array.from(t).sort()}function Io(e,t){let o=e.fontScheme;o&&(o.majorFont&&ge(o.majorFont,t),o.minorFont&&ge(o.minorFont,t));}function ge(e,t){if(e.latin&&t.add(e.latin),e.ea&&t.add(e.ea),e.cs&&t.add(e.cs),e.fonts)for(let o of Object.values(e.fonts))o&&t.add(o);}function Bo(e,t){e.docDefaults&&(e.docDefaults.rPr&&R(e.docDefaults.rPr,t),e.docDefaults.pPr?.runProperties&&R(e.docDefaults.pPr.runProperties,t));for(let o of e.styles)o.rPr&&R(o.rPr,t),o.pPr?.runProperties&&R(o.pPr.runProperties,t);}function R(e,t){let o=e.fontFamily;o&&(o.ascii&&t.add(o.ascii),o.hAnsi&&t.add(o.hAnsi),o.eastAsia&&t.add(o.eastAsia),o.cs&&t.add(o.cs));}function _o(e,t){e.runProperties&&R(e.runProperties,t);}function E(e,t){e.type==="paragraph"?Wo(e,t):e.type==="table"&&zo(e,t);}function Wo(e,t){e.formatting&&_o(e.formatting,t);for(let o of e.content)Ko(o,t);}function Ko(e,t){if(e.type==="run")D(e,t);else if(e.type==="hyperlink")$o(e,t);else if(e.type==="simpleField"||e.type==="complexField"){if("content"in e)for(let o of e.content)o.type==="run"&&D(o,t);if("fieldResult"in e)for(let o of e.fieldResult)D(o,t);}}function D(e,t){e.formatting&&R(e.formatting,t);}function $o(e,t){for(let o of e.children)o.type==="run"&&D(o,t);}function zo(e,t){for(let o of e.rows)Go(o,t);}function Go(e,t){for(let o of e.cells)jo(o,t);}function jo(e,t){for(let o of e.content)E(o,t);}function me(e,t){for(let o of e.content)E(o,t);}function Uo(e,t){for(let o of e.content)E(o,t);}function Xo(e,t){for(let o of e.content)E(o,t);}var Vo=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui"]);function be(e,t={}){let o$1=t.canRender??o,n=new Set;for(let l of t.exclude??[])n.add(l.trim().toLowerCase());let r=new Set;for(let l of t.embeddedFamilies??[])r.add(l.trim().toLowerCase());let i=[],s=new Set;for(let l of e){let c=l.trim(),a=c.toLowerCase();!c||Vo.has(a)||n.has(a)||s.has(a)||!r.has(a)&&!o$1(c)||(s.add(a),i.push({name:c,fontFamily:d(c).cssFallback,category:"other"}));}return i}function Yo(e,t={}){return be(he(e),t)}function qo(e,t){if(!e||e.length===0)return [];let o=new Set;for(let i of t)o.add(i.trim().toLowerCase());let n=new Set,r=[];for(let i of e){let s=i.name.trim().toLowerCase();o.has(s)||n.has(s)||(n.add(s),r.push(i));}return r}function Jo(e,t){if(!e)return {};let o={};if(e.fontFamily){let s=null;if(e.fontFamily.asciiTheme&&t?.fontScheme&&(s=e$1(e.fontFamily.asciiTheme,t.fontScheme)),s||(s=e.fontFamily.ascii||e.fontFamily.hAnsi||e.fontFamily.eastAsia||e.fontFamily.cs||null),s){let l=d(s);o.fontFamily=l.cssFallback;}}if(e.fontSize!==void 0&&(o.fontSize=`${l(e.fontSize)}pt`),e.bold&&(o.fontWeight="bold"),e.italic&&(o.fontStyle="italic"),e.color&&(o.color=d$1(e.color,t)),e.highlight&&e.highlight!=="none"&&(o.backgroundColor=i(e.highlight)),e.shading){let s=L(e.shading,t);s&&!o.backgroundColor&&(o.backgroundColor=s);}let n=[],r=[],i$1=[];if(e.underline&&e.underline.style!=="none"){n.push("underline");let s=Zo(e.underline.style);s!=="solid"&&r.push(s),e.underline.color&&i$1.push(d$1(e.underline.color,t));}if(e.strike&&n.push("line-through"),e.doubleStrike&&n.push("line-through"),n.length>0&&(o.textDecoration=n.join(" "),r.length>0&&(o.textDecorationStyle=r[0]),i$1.length>0&&(o.textDecorationColor=i$1[0])),e.vertAlign)switch(e.vertAlign){case "superscript":o.verticalAlign="super",o.fontSize||(o.fontSize="0.83em");break;case "subscript":o.verticalAlign="sub",o.fontSize||(o.fontSize="0.83em");break}if(e.position&&e.position!==0){let s=k(e.position);o.position="relative",o.top=q$1(-s);}return e.allCaps?o.textTransform="uppercase":e.smallCaps&&(o.fontVariant="small-caps"),e.spacing!==void 0&&e.spacing!==0&&(o.letterSpacing=q$1(g(e.spacing))),e.scale!==void 0&&e.scale!==100&&(o.transform=`scaleX(${e.scale/100})`,o.display="inline-block"),e.hidden&&(o.display="none"),e.emboss&&(o.textShadow="1px 1px 1px rgba(255,255,255,0.5), -1px -1px 1px rgba(0,0,0,0.3)"),e.imprint&&(o.textShadow="-1px -1px 1px rgba(255,255,255,0.5), 1px 1px 1px rgba(0,0,0,0.3)"),e.outline&&(o.WebkitTextStroke="1px currentColor",o.WebkitTextFillColor="transparent"),e.shadow&&!e.emboss&&!e.imprint&&(o.textShadow="1px 1px 2px rgba(0,0,0,0.3)"),e.rtl&&(o.direction="rtl"),o}function Qo(e,t){if(!e)return {};let o={};if(e.alignment&&(o.textAlign=en(e.alignment)),e.beforeAutospacing?o.marginTop=q$1(f):e.spaceBefore!==void 0&&(o.marginTop=q$1(g(e.spaceBefore))),e.afterAutospacing?o.marginBottom=q$1(f):e.spaceAfter!==void 0&&(o.marginBottom=q$1(g(e.spaceAfter))),e.lineSpacing!==void 0&&e.lineSpacing>0)switch(e.lineSpacingRule){case "exact":{let n=g(e.lineSpacing);n>0&&(o.lineHeight=q$1(n));break}case "atLeast":{let n=g(e.lineSpacing);n>0&&(o.minHeight=q$1(n),o.lineHeight=q$1(n));break}default:{let n=e.lineSpacing/240;n>0&&(o.lineHeight=n.toString());break}}if(e.indentLeft!==void 0&&(o.marginLeft=q$1(g(e.indentLeft))),e.indentRight!==void 0&&(o.marginRight=q$1(g(e.indentRight))),e.indentFirstLine!==void 0&&(e.hangingIndent?o.textIndent=q$1(g(e.indentFirstLine)):o.textIndent=q$1(g(e.indentFirstLine))),e.borders&&(e.borders.top&&Object.assign(o,T(e.borders.top,"Top",t)),e.borders.bottom&&Object.assign(o,T(e.borders.bottom,"Bottom",t)),e.borders.left&&Object.assign(o,T(e.borders.left,"Left",t)),e.borders.right&&Object.assign(o,T(e.borders.right,"Right",t))),e.shading){let n=L(e.shading,t);n&&(o.backgroundColor=n);}return e.bidi&&(o.direction="rtl"),e.pageBreakBefore&&(o.pageBreakBefore="always"),e.keepNext&&(o.pageBreakAfter="avoid"),e.keepLines&&(o.pageBreakInside="avoid"),o}function T(e,t="",o){if(!e||e.style==="none"||e.style==="nil")return {};let n$1={},r=e.size?n(e.size):1,i=e.color?d$1(e.color,o):"#000000",s=tn(e.style),l=`border${t}Width`,c=`border${t}Style`,a=`border${t}Color`;return n$1[l]=q$1(Math.max(1,r)),n$1[c]=s,n$1[a]=i,n$1}function L(e,t){return !e||e.pattern==="clear"||e.pattern==="nil"?"":e.fill?e.fill.auto||e.fill.rgb==="auto"||e.fill.rgb==="FFFFFF"?"":b$1(e.fill,t):e.pattern==="solid"&&e.color?b$1(e.color,t):e.pattern&&e.pattern.startsWith("pct")&&e.color?b$1(e.color,t):""}function Zo(e){switch(e){case "double":return "double";case "dotted":case "dottedHeavy":return "dotted";case "dash":case "dashedHeavy":case "dashLong":case "dashLongHeavy":case "dotDash":case "dashDotHeavy":case "dotDotDash":case "dashDotDotHeavy":return "dashed";case "wave":case "wavyHeavy":case "wavyDouble":return "wavy";default:return "solid"}}function en(e){switch(e){case "center":return "center";case "right":return "right";case "both":case "distribute":return "justify";default:return "left"}}function tn(e){switch(e){case "none":case "nil":return "none";case "double":case "triple":return "double";case "dotted":return "dotted";case "dashed":case "dashSmallGap":return "dashed";case "threeDEmboss":return "ridge";case "threeDEngrave":return "groove";case "outset":return "outset";case "inset":return "inset";default:return "solid"}}function on(...e){let t={};for(let o of e)o&&Object.assign(t,o);return t}function nn(e,t){if(!e)return {};let o={};if(e.verticalAlign&&(o.verticalAlign=e.verticalAlign),e.textDirection&&(e.textDirection.includes("rl")||e.textDirection.includes("Rl"))&&(o.direction="rtl"),e.shading){let n=L(e.shading,t);n&&(o.backgroundColor=n);}return e.borders&&(e.borders.top&&Object.assign(o,T(e.borders.top,"Top",t)),e.borders.bottom&&Object.assign(o,T(e.borders.bottom,"Bottom",t)),e.borders.left&&Object.assign(o,T(e.borders.left,"Left",t)),e.borders.right&&Object.assign(o,T(e.borders.right,"Right",t))),e.margins&&(e.margins.top?.value&&(o.paddingTop=q$1(g(e.margins.top.value))),e.margins.bottom?.value&&(o.paddingBottom=q$1(g(e.margins.bottom.value))),e.margins.left?.value&&(o.paddingLeft=q$1(g(e.margins.left.value))),e.margins.right?.value&&(o.paddingRight=q$1(g(e.margins.right.value)))),o}function rn(e,t){if(!e)return {};let o={};if(e.pageWidth&&(o.width=q$1(g(e.pageWidth))),e.pageHeight&&(o.minHeight=q$1(g(e.pageHeight))),e.marginTop&&(o.paddingTop=q$1(g(e.marginTop))),e.marginBottom&&(o.paddingBottom=q$1(g(e.marginBottom))),e.marginLeft&&(o.paddingLeft=q$1(g(e.marginLeft))),e.marginRight&&(o.paddingRight=q$1(g(e.marginRight))),e.background?.color){let n=d$1(e.background.color,t);n&&(o.backgroundColor=n);}return o}function C(e){return e?/[\p{L}\p{N}_]/u.test(e):false}function J(e){return e?/\s/.test(e):false}function sn(e){return e?/[\p{P}]/u.test(e):false}function an(e,t){if(t<=0)return 0;t>e.length&&(t=e.length);let o=t;for(;o>0&&J(e[o-1]);)o--;if(o===0)return 0;for(;o>0&&C(e[o-1]);)o--;return o}function ln(e,t){if(t>=e.length)return e.length;t<0&&(t=0);let o=t;for(;o<e.length&&C(e[o]);)o++;for(;o<e.length&&J(e[o]);)o++;return o}function xe(e,t){if(t>=e.length)return e.length;let o=t;for(;o<e.length&&C(e[o]);)o++;for(;o<e.length&&!C(e[o]);)o++;return o}function ye(e,t){if(t<=0)return 0;let o=t;for(;o>0&&!C(e[o-1]);)o--;for(;o>0&&C(e[o-1]);)o--;return o}function Se(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 i=n.getBoundingClientRect().top,s=0,l=t;for(;s<l;){let c=Math.floor((s+l)/2);n.setStart(e,c),n.collapse(true);let a=n.getBoundingClientRect();Math.abs(a.top-i)<2?l=c:s=c+1;}return {node:e,offset:s}}return null}function Ce(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 s=r.getBoundingClientRect().top,l=t,c=n;for(;l<c;){let a=Math.ceil((l+c)/2);r.setStart(e,a),r.collapse(true);let d=r.getBoundingClientRect();Math.abs(d.top-s)<2?l=a:c=a-1;}return {node:e,offset:l}}return null}function cn(){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 H(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 O(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 Te(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||"",i=o.focusOffset,s;return e==="left"?s=ye(r,i):s=xe(r,i),t?O(n,s):H(n,s),true}function we(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 s=e==="start"?Se(n,o.focusOffset):Ce(n,o.focusOffset);if(s)return t?O(s.node,s.offset):H(s.node,s.offset),true}let r=n.textContent||"",i=e==="start"?0:r.length;return t?O(n,i):H(n,i),true}function Fe(e){let{key:t,ctrlKey:o,metaKey:n,shiftKey:r,altKey:i}=e,s=o||n;switch(t){case "ArrowLeft":if(s)return {direction:"left",unit:"word",extend:r};break;case "ArrowRight":if(s)return {direction:"right",unit:"word",extend:r};break;case "Home":return s?{direction:"left",unit:"document",extend:r}:{direction:"left",unit:"line",extend:r};case "End":return s?{direction:"right",unit:"document",extend:r}:{direction:"right",unit:"line",extend:r}}return null}function dn(e,t){let o=Fe(e);if(!o)return false;switch(o.unit){case "word":if((o.direction==="left"||o.direction==="right")&&Te(o.direction,o.extend))return e.preventDefault(),true;break;case "line":let n=o.direction==="left"?"start":"end";if(we(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 un(e){let{key:t,ctrlKey:o,metaKey:n}=e;return !!((o||n)&&(t==="ArrowLeft"||t==="ArrowRight")||t==="Home"||t==="End")}function fn(){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,i=n;for(;r>0&&C(o[r-1]);)r--;for(;i<o.length&&C(o[i]);)i++;if(r===i)return false;let s=document.createRange();return s.setStart(t,r),s.setEnd(t,i),e.removeAllRanges(),e.addRange(s),true}function pn(){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,i=n;for(;r>0&&C(o[r-1]);)r--;for(;i<o.length&&C(o[i]);)i++;return r===i?null:o.slice(r,i)}function gn(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 b={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 x(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 mn(){return [{action:"Move by word (left)",shortcut:x(b.wordLeft)},{action:"Move by word (right)",shortcut:x(b.wordRight)},{action:"Select word (left)",shortcut:x(b.selectWordLeft)},{action:"Select word (right)",shortcut:x(b.selectWordRight)},{action:"Go to line start",shortcut:x(b.lineStart)},{action:"Go to line end",shortcut:x(b.lineEnd)},{action:"Select to line start",shortcut:x(b.selectToLineStart)},{action:"Select to line end",shortcut:x(b.selectToLineEnd)},{action:"Go to document start",shortcut:x(b.documentStart)},{action:"Go to document end",shortcut:x(b.documentEnd)},{action:"Select to document start",shortcut:x(b.selectToDocumentStart)},{action:"Select to document end",shortcut:x(b.selectToDocumentEnd)}]}var M={backgroundColor:"rgba(26, 115, 232, 0.3)",borderRadius:0,zIndex:0,opacity:1,mixBlendMode:"multiply"},hn={backgroundColor:"rgba(0, 120, 215, 0.4)",borderColor:"rgba(0, 120, 215, 0.6)",borderRadius:1,zIndex:0,opacity:1},bn={backgroundColor:"--docx-selection-bg",borderColor:"--docx-selection-border",textColor:"--docx-selection-text"};function Q(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=[],i=0,s=0;if(e){let l=e.getBoundingClientRect();i=l.left+e.scrollLeft,s=l.top+e.scrollTop;}for(let l=0;l<n.length;l++){let c=n[l];c.width===0&&c.height===0||r.push({left:c.left-i,top:c.top-s,width:c.width,height:c.height});}return r}function Re(e,t=2){if(e.length<=1)return e;let o=[...e].sort((i,s)=>Math.abs(i.top-s.top)<t?i.left-s.left:i.top-s.top),n=[],r={...o[0]};for(let i=1;i<o.length;i++){let s=o[i],l=Math.abs(s.top-r.top)<t,c=s.left<=r.left+r.width+t;if(l&&c){let a=Math.max(r.left+r.width,s.left+s.width);r.width=a-r.left,r.height=Math.max(r.height,s.height);}else n.push(r),r={...s};}return n.push(r),n}function Ae(e){let t=Q(e);return Re(t)}function xn(e,t=M){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 yn(e,t=M){let o=t.backgroundColor;return `
4
+ ${e}::selection,
5
+ ${e} *::selection {
6
+ background-color: ${o} !important;
7
+ color: inherit !important;
8
+ }
9
+
10
+ ${e}::-moz-selection,
11
+ ${e} *::-moz-selection {
12
+ background-color: ${o} !important;
13
+ color: inherit !important;
14
+ }
15
+ `}function Sn(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function Cn(){let e=window.getSelection();return e?e.toString():""}function Tn(e){let t=window.getSelection();if(!t||t.rangeCount===0)return false;let o=t.getRangeAt(0);return e.contains(o.commonAncestorContainer)}function wn(){let e=window.getSelection();return !e||e.rangeCount===0?null:e.getRangeAt(0).getBoundingClientRect()}function Fn(e,t,o,n,r){try{let i=document.createRange();return i.setStart(t,o),i.setEnd(n,r),i}catch{return null}}function Rn(e){let t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e));}function An(){let e=window.getSelection();e&&e.removeAllRanges();}function Pe(){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 Pn(){let e=window.getSelection();if(!e||e.rangeCount===0||!Pe())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 w=null;function En(e=M){Ee();let t=`
16
+ /* DOCX Editor Selection Highlighting */
17
+
18
+ /* Base selection style for all editable content */
19
+ .docx-editor [contenteditable="true"]::selection,
20
+ .docx-editor [contenteditable="true"] *::selection,
21
+ .docx-run-editable::selection,
22
+ .docx-run-editable *::selection {
23
+ background-color: ${e.backgroundColor} !important;
24
+ color: inherit !important;
25
+ }
26
+
27
+ /* Firefox selection */
28
+ .docx-editor [contenteditable="true"]::-moz-selection,
29
+ .docx-editor [contenteditable="true"] *::-moz-selection,
30
+ .docx-run-editable::-moz-selection,
31
+ .docx-run-editable *::-moz-selection {
32
+ background-color: ${e.backgroundColor} !important;
33
+ color: inherit !important;
34
+ }
35
+
36
+ /* Ensure selection is visible against all backgrounds */
37
+ .docx-run-highlighted::selection,
38
+ .docx-run-highlighted *::selection {
39
+ /* For highlighted (yellow background) text, use darker selection */
40
+ background-color: rgba(26, 115, 232, 0.5) !important;
41
+ }
42
+
43
+ .docx-run-highlighted::-moz-selection,
44
+ .docx-run-highlighted *::-moz-selection {
45
+ background-color: rgba(26, 115, 232, 0.5) !important;
46
+ }
47
+
48
+ /* Selection in dark text */
49
+ .docx-run-dark-bg::selection,
50
+ .docx-run-dark-bg *::selection {
51
+ /* Use lighter selection for dark backgrounds */
52
+ background-color: rgba(100, 181, 246, 0.5) !important;
53
+ }
54
+
55
+ .docx-run-dark-bg::-moz-selection,
56
+ .docx-run-dark-bg *::-moz-selection {
57
+ background-color: rgba(100, 181, 246, 0.5) !important;
58
+ }
59
+
60
+ /* Programmatic highlight class */
61
+ .docx-selection-highlight {
62
+ background-color: ${e.backgroundColor};
63
+ ${e.borderRadius?`border-radius: ${e.borderRadius}px;`:""}
64
+ ${e.mixBlendMode?`mix-blend-mode: ${e.mixBlendMode};`:""}
65
+ }
66
+
67
+ /* Find/replace highlight */
68
+ .docx-find-highlight {
69
+ background-color: rgba(255, 235, 59, 0.5);
70
+ border-radius: 2px;
71
+ }
72
+
73
+ .docx-find-highlight-current {
74
+ background-color: rgba(255, 152, 0, 0.6);
75
+ border-radius: 2px;
76
+ outline: 2px solid rgba(255, 152, 0, 0.8);
77
+ }
78
+
79
+ /* AI action selection preview */
80
+ .docx-ai-selection-preview {
81
+ background-color: rgba(156, 39, 176, 0.2);
82
+ border-bottom: 2px dashed rgba(156, 39, 176, 0.6);
83
+ }
84
+ `;w=document.createElement("style"),w.id="docx-selection-styles",w.textContent=t,document.head.appendChild(w);}function Ee(){w&&(w.remove(),w=null);let e=document.getElementById("docx-selection-styles");e&&e.remove();}function kn(){return w!==null||document.getElementById("docx-selection-styles")!==null}function vn(e,t,o=true){return ()=>{if(!e){t([]);return}let n=o?Ae(e):Q(e);t(n);}}var ke="rgba(255, 235, 59, 0.55)",Nn=1200,I="docx-paragraph-flash",Z=new WeakMap;function Dn(e){let t=globalThis;return typeof t.CSS?.escape=="function"?t.CSS.escape(e):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function Ln(e){return e?.color?.trim()||ke}function Hn(e){let t=e?.durationMs;return t==null||!Number.isFinite(t)||t<0?1200:t}function ve(e,t){if(!t||!t.trim())return [];let o=Dn(t);return Array.from(e.querySelectorAll(`.layout-paragraph[data-para-id="${o}"]`))}function Ne(e,t){let o=0,n=Ln(t),r=Hn(t);for(let i of e){o++;let s=Z.get(i);s!==void 0&&clearTimeout(s),i.classList.remove(I),i.offsetWidth,i.style.setProperty("--docx-paragraph-flash-color",n),i.style.setProperty("--docx-paragraph-flash-duration",`${r}ms`),i.classList.add(I);let l=setTimeout(()=>{i.classList.remove(I),i.style.removeProperty("--docx-paragraph-flash-color"),i.style.removeProperty("--docx-paragraph-flash-duration"),Z.delete(i);},r);Z.set(i,l);}return o}function On(e,t,o){let n=ve(e,t);return Ne(n,o)>0}function De(e,t,o){let n=0;for(let r=t;r<t+o&&r<e.length;r++)n+=e[r];return n}function Mn(e,t,o,n){let r=De(e,t,o),i=Math.floor(r/Math.max(n,1)),s=r-i*n,l=Array.from({length:n},(c,a)=>i+(a<s?1:0));return [...e.slice(0,t),...l,...e.slice(t+o)]}function In(e,t,o,n,r,i){let s=o-t.rowspan,l=n-t.colspan,c=r+s,a=t.row+t.rowspan,d=t.col+t.colspan,f=[];for(let u of e){if(u===t)continue;let m=u.row+u.rowspan,B=u.col+u.colspan,ee=u.row<a&&m>t.row,te=u.col<d&&B>t.col;f.push({data:u.data,row:u.row>=a?u.row+s:u.row,col:u.col>=d?u.col+l:u.col,rowspan:u.rowspan+(s>0&&ee&&!te?s:0),colspan:u.colspan+(l>0&&te&&!ee?l:0)});}for(let u=0;u<o;u++)for(let m=0;m<n;m++){let B=u===0&&m===0;f.push({data:i(B,u,m),row:t.row+u,col:t.col+m,rowspan:1,colspan:1});}return {anchors:f,deltaRows:s,deltaCols:l,newRowCount:c}}function Bn(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 i=n.col;i<n.col+n.colspan;i++)o.set(`${r}-${i}`,n);}return {byStart:t,byCoveredSlot:o}}function _n(e,t){let o=e>1||t>1;return {minRows:e,minCols:t,initialRows:e,initialCols:o?t:t+1}}async function Wn(e){let t=e.target;if(!t||!t.files)return null;let o=t.files[0];return t.value="",o?{buffer:await o.arrayBuffer(),name:o.name.replace(/\.docx$/i,"")}:null}var Le="(prefers-color-scheme: dark)";function He(){return typeof window<"u"&&typeof window.matchMedia=="function"}function Kn(){return He()?window.matchMedia(Le).matches:false}function $n(e,t){return e==="dark"||e==="system"&&t}function zn(e){if(!He())return ()=>{};let t=window.matchMedia(Le);e(t.matches);let o=n=>e(n.matches);return t.addEventListener("change",o),()=>t.removeEventListener("change",o)}var Gn=-1;function jn(){let e=1;return {next:()=>e++,seedAbove(t){t>=e&&(e=t+1);}}}function Un(e,t,o,n){return {id:e.next(),author:o,date:new Date().toISOString(),content:[{type:"paragraph",formatting:{},content:[{type:"run",formatting:{},content:[{type:"text",text:t}]}]}],...n!==void 0&&{parentId:n}}}export{h as CLIPBOARD_TYPES,ke as DEFAULT_PARAGRAPH_FLASH_COLOR,Nn as DEFAULT_PARAGRAPH_FLASH_DURATION_MS,M as DEFAULT_SELECTION_STYLE,hn as HIGH_CONTRAST_SELECTION_STYLE,Ao as INTERNAL_CLIPBOARD_TYPE,b as NAVIGATION_SHORTCUTS,I as PARAGRAPH_FLASH_CLASS_NAME,Gn as PENDING_COMMENT_ID,bn as SELECTION_CSS_VARS,kn as areSelectionStylesInjected,T as borderToStyle,Bn as buildAnchorMaps,ue as cleanWordHtml,An as clearSelection,_n as computeSplitDialogDefaults,In as computeSplitLayout,Eo as copyParagraphs,j as copyRuns,Mo as createClipboardHandlers,Un as createComment,jn as createCommentIdAllocator,vn as createSelectionChangeHandler,x as describeShortcut,qo as excludeFontsByName,fn as expandSelectionToWord,O as extendSelectionTo,xe as findNextWordStart,ve as findParagraphFragmentsByParaId,ye as findPreviousWordStart,Ce as findVisualLineEnd,Se as findVisualLineStart,ln as findWordEnd,an as findWordStart,Ne as flashParagraphElements,On as flashParagraphFragmentsByParaId,yn as generateSelectionCSS,Po as getClipboardImageFiles,xn as getHighlightRectStyle,Ae as getMergedSelectionRects,mn as getNavigationShortcutDescriptions,Yo as getRenderableDocumentFonts,Cn as getSelectedText,wn as getSelectionBoundingRect,cn as getSelectionInfo,Q as getSelectionRects,pn as getWordAtCursor,dn as handleNavigationKey,le as handlePasteEvent,Sn as hasActiveSelection,Fn as highlightTextRange,fe as htmlToRuns,En as injectSelectionStyles,de as isEditorHtml,un as isNavigationKey,sn as isPunctuation,Pe as isSelectionBackwards,Tn as isSelectionWithin,J as isWhitespace,C as isWordCharacter,ce as isWordHtml,gn as matchesShortcut,Re as mergeAdjacentRects,on as mergeStyles,Te as moveByWord,we as moveToLineEdge,Pn as normalizeSelectionDirection,Qo as paragraphToStyle,ae as paragraphsToClipboardContent,V as parseClipboardHtml,Fe as parseNavigationAction,Kn as prefersColorSchemeDark,Wn as readDocxFileFromInput,ko as readFromClipboard,Mn as redistributeColumnWidths,Ee as removeSelectionStyles,$n as resolveIsDark,L as resolveShadingFill,N as runsToClipboardContent,rn as sectionToStyle,Rn as selectRange,be as selectRenderableFonts,H as setSelectionPosition,zn as subscribeSystemDark,De as sumColumnWidths,nn as tableCellToStyle,Jo as textToStyle,P as writeToClipboard};
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Pure list-state helpers used by both adapter toolbars to track
3
+ * whether the selection is in a bullet/numbered list and at what
4
+ * indent level. Lifted from packages/docx-react/src/components/ui/
5
+ * ListButtons.tsx so the React + Vue toolbars share identical
6
+ * state-mutation logic.
7
+ * @packageDocumentation
8
+ * @public
9
+ */
10
+ type ListType = 'bullet' | 'numbered' | 'none';
11
+ interface ListState {
12
+ type: ListType;
13
+ level: number;
14
+ isInList: boolean;
15
+ numId?: number;
16
+ }
17
+ declare function createDefaultListState(): ListState;
18
+ declare function createBulletListState(level?: number, numId?: number): ListState;
19
+ declare function createNumberedListState(level?: number, numId?: number): ListState;
20
+ declare function isBulletListState(state: ListState | undefined): boolean;
21
+ declare function isNumberedListState(state: ListState | undefined): boolean;
22
+ declare function isAnyListState(state: ListState | undefined): boolean;
23
+ declare function getNextIndentLevel(currentLevel: number): number;
24
+ declare function getPreviousIndentLevel(currentLevel: number): number;
25
+ declare function toggleListType(state: ListState | undefined, targetType: ListType): ListState;
26
+
27
+ export { type ListState, type ListType, createBulletListState, createDefaultListState, createNumberedListState, getNextIndentLevel, getPreviousIndentLevel, isAnyListState, isBulletListState, isNumberedListState, toggleListType };
@@ -0,0 +1 @@
1
+ import'../chunk-TTRUPDAB.mjs';function r(){return {type:"none",level:0,isInList:false}}function i(e=0,t){return {type:"bullet",level:e,isInList:true,numId:t}}function u(e=0,t){return {type:"numbered",level:e,isInList:true,numId:t}}function l(e){return e?.type==="bullet"}function L(e){return e?.type==="numbered"}function a(e){return e?.isInList===true}function b(e){return Math.min(e+1,8)}function p(e){return Math.max(e-1,0)}function f(e,t){if(e?.type===t)return r();let n=e?.isInList?e.level:0;return t==="bullet"?i(n):t==="numbered"?u(n):r()}export{i as createBulletListState,r as createDefaultListState,u as createNumberedListState,b as getNextIndentLevel,p as getPreviousIndentLevel,a as isAnyListState,l as isBulletListState,L as isNumberedListState,f as toggleListType};
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Framework-agnostic helper to open a pre-filled GitHub "new issue"
3
+ * URL for the Help > Report issue action. GitHub doesn't allow file
4
+ * attachments via URL params, so the body asks the user to drag-drop
5
+ * their DOCX onto the issue after it opens.
6
+ *
7
+ * Lifted from packages/docx-react/src/components/reportIssue.ts so the
8
+ * Vue adapter can re-use it without re-implementing.
9
+ * @packageDocumentation
10
+ * @public
11
+ */
12
+ interface ReportIssueEnv {
13
+ userAgent?: string;
14
+ viewport?: {
15
+ width: number;
16
+ height: number;
17
+ };
18
+ pageUrl?: string;
19
+ }
20
+ declare function buildReportIssueUrl(env?: ReportIssueEnv): string;
21
+ declare function openReportIssue(env?: ReportIssueEnv): void;
22
+
23
+ export { type ReportIssueEnv, buildReportIssueUrl, openReportIssue };
@@ -0,0 +1,2 @@
1
+ import'../chunk-TTRUPDAB.mjs';var i="https://github.com/openooxml/docx/issues/new";function s(e={}){let n=e.userAgent??(typeof navigator<"u"?navigator.userAgent:"unknown"),t=e.viewport??(typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0}),o=["### What happened","","### Steps to reproduce","1. ","2. ","3. ","","### Expected","","### Actual","","### Attach the DOCX","Please drag the `.docx` file that reproduces this onto the issue (below this text box). Bugs are much faster to fix with a real file.","","### Environment",`- URL: ${e.pageUrl??(typeof window<"u"?window.location.href:"")}`,`- Viewport: ${t.width} x ${t.height}`,`- User agent: ${n}`,""].join(`
2
+ `),r=new URLSearchParams({title:"[Bug] ",body:o});return `${i}?${r.toString()}`}function a(e){typeof window>"u"||window.open(s(e),"_blank","noopener,noreferrer");}export{s as buildReportIssueUrl,a as openReportIssue};
@@ -0,0 +1,10 @@
1
+ /** Sidebar geometry constants — shared by both adapters so the
2
+ * page-shift and card-gap math stays consistent.
3
+ * @packageDocumentation
4
+ * @public */
5
+ declare const SIDEBAR_WIDTH = 340;
6
+ declare const SIDEBAR_PAGE_GAP = 12;
7
+ declare const SIDEBAR_DOCUMENT_SHIFT: number;
8
+ declare const MIN_CARD_GAP = 8;
9
+
10
+ export { MIN_CARD_GAP, SIDEBAR_DOCUMENT_SHIFT, SIDEBAR_PAGE_GAP, SIDEBAR_WIDTH };
@@ -0,0 +1 @@
1
+ export{d as MIN_CARD_GAP,c as SIDEBAR_DOCUMENT_SHIFT,b as SIDEBAR_PAGE_GAP,a as SIDEBAR_WIDTH}from'../chunk-YUOKI2HB.mjs';import'../chunk-TTRUPDAB.mjs';
@@ -0,0 +1,70 @@
1
+ import { S as Style } from '../styles-VxNcXLdi.mjs';
2
+ import '../formatting-DoL7KBSL.mjs';
3
+
4
+ /**
5
+ * Paragraph-style preview + option resolution — shared between the React and
6
+ * Vue toolbars so the style-picker dropdown looks and behaves identically.
7
+ *
8
+ * Pure logic only: no i18n and no framework CSS types. The returned preview is
9
+ * a plain `{ fontSize, lineHeight, fontWeight?, fontStyle?, color? }` object,
10
+ * which is structurally assignable to both React's `CSSProperties` and Vue's
11
+ * inline-style record, so neither adapter needs a cast. Name localization stays
12
+ * in the adapters (they own the i18n `t()` boundary).
13
+ * @packageDocumentation
14
+ * @public
15
+ */
16
+
17
+ /**
18
+ * Inline preview style for a paragraph-style dropdown item.
19
+ * @public
20
+ */
21
+ interface StylePreviewProps {
22
+ fontSize: string;
23
+ lineHeight: string;
24
+ fontWeight?: 'bold';
25
+ fontStyle?: 'italic';
26
+ color?: string;
27
+ }
28
+ /**
29
+ * A resolved paragraph-style option (document order, with extracted visual
30
+ * fields). Adapters add their own localized label on top of `name`.
31
+ * @public
32
+ */
33
+ interface ResolvedStyleOption {
34
+ styleId: string;
35
+ name: string;
36
+ priority: number;
37
+ fontSize?: number;
38
+ bold?: boolean;
39
+ italic?: boolean;
40
+ color?: string;
41
+ }
42
+ /** Dropdown preview sizes (px) for well-known styles, matching Google Docs. @public */
43
+ declare const STYLE_PREVIEW_SIZES: Record<string, number>;
44
+ /** Styles rendered bold in the dropdown preview by default. @public */
45
+ declare const STYLE_DEFAULT_BOLD: ReadonlySet<string>;
46
+ /** Default preview text color (hex, no `#`) for styles that don't set one. @public */
47
+ declare const STYLE_DEFAULT_COLOR: Record<string, string>;
48
+ /** Google-Docs heading preview color. @public */
49
+ declare const HEADING_COLOR = "#4a6c8c";
50
+ /**
51
+ * Build the inline preview style for a style option. `fontSize` is in
52
+ * half-points (OOXML); known styles use {@link STYLE_PREVIEW_SIZES} instead.
53
+ * @public
54
+ */
55
+ declare function getStylePreviewProps(input: {
56
+ styleId: string;
57
+ fontSize?: number;
58
+ bold?: boolean;
59
+ italic?: boolean;
60
+ color?: string;
61
+ }): StylePreviewProps;
62
+ /**
63
+ * Filter the document's styles to the visible paragraph styles, extract their
64
+ * visual fields, and sort by UI priority — the list a toolbar style picker
65
+ * shows. Returns `[]` when there are no styles (adapters fall back to presets).
66
+ * @public
67
+ */
68
+ declare function resolveParagraphStyleOptions(styles: Style[] | undefined): ResolvedStyleOption[];
69
+
70
+ export { HEADING_COLOR, type ResolvedStyleOption, STYLE_DEFAULT_BOLD, STYLE_DEFAULT_COLOR, STYLE_PREVIEW_SIZES, type StylePreviewProps, getStylePreviewProps, resolveParagraphStyleOptions };
@@ -0,0 +1 @@
1
+ import'../chunk-TTRUPDAB.mjs';var n={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14},l=new Set(["Title","Heading1","Heading2","Heading3"]),a={Subtitle:"666666"},d="#4a6c8c";function g(t){let e=n[t.styleId],o={fontSize:e?`${e}px`:`${Math.min(Math.max(t.fontSize?t.fontSize/2:11,11),20)}px`,lineHeight:"1.3"};(t.bold??l.has(t.styleId))&&(o.fontWeight="bold"),t.italic&&(o.fontStyle="italic");let i=t.color??a[t.styleId];return i?o.color=`#${i}`:t.styleId.startsWith("Heading")&&(o.color=d),o}function S(t){return !t||t.length===0?[]:t.filter(e=>e.type==="paragraph").filter(e=>e.qFormat?true:!(e.hidden||e.semiHidden)).map(e=>({styleId:e.styleId,name:e.name||e.styleId,priority:e.uiPriority??99,fontSize:e.rPr?.fontSize,bold:e.rPr?.bold,italic:e.rPr?.italic,color:e.rPr?.color?.rgb})).sort((e,r)=>e.priority-r.priority)}export{d as HEADING_COLOR,l as STYLE_DEFAULT_BOLD,a as STYLE_DEFAULT_COLOR,n as STYLE_PREVIEW_SIZES,g as getStylePreviewProps,S as resolveParagraphStyleOptions};
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Text Selection Utilities
3
+ *
4
+ * Utilities for word-level and paragraph-level text selection.
5
+ * Used for double-click (word) and triple-click (paragraph) selection.
6
+ * @packageDocumentation
7
+ * @public
8
+ */
9
+ /**
10
+ * Check if a character is a word character
11
+ */
12
+ declare function isWordCharacter(char: string): boolean;
13
+ /**
14
+ * Check if a character is whitespace
15
+ */
16
+ declare function isWhitespace(char: string): boolean;
17
+ /**
18
+ * Find word boundaries around a position in text
19
+ * Returns [startIndex, endIndex] inclusive start, exclusive end
20
+ */
21
+ declare function findWordBoundaries(text: string, position: number): [number, number];
22
+ /**
23
+ * Get the word at a position in text
24
+ */
25
+ declare function getWordAt(text: string, position: number): string;
26
+ /**
27
+ * Word selection result
28
+ */
29
+ interface WordSelectionResult {
30
+ /** The selected word */
31
+ word: string;
32
+ /** Start index in the text (inclusive) */
33
+ startIndex: number;
34
+ /** End index in the text (exclusive) */
35
+ endIndex: number;
36
+ }
37
+ /**
38
+ * Find the word at a position and return detailed info
39
+ */
40
+ declare function findWordAt(text: string, position: number): WordSelectionResult;
41
+ /**
42
+ * Select a word at the current cursor position using the browser's native APIs.
43
+ * This works reliably across different browsers and handles contentEditable well.
44
+ */
45
+ declare function selectWordAtCursor(): boolean;
46
+ /**
47
+ * Select a word in a specific text node at the given offset
48
+ */
49
+ declare function selectWordInTextNode(textNode: Text, offset: number): boolean;
50
+ /**
51
+ * Expand the current selection to word boundaries.
52
+ * If there's a collapsed selection (cursor), selects the word at cursor.
53
+ * If there's an existing selection, expands to include complete words.
54
+ */
55
+ declare function expandSelectionToWordBoundaries(): boolean;
56
+ /**
57
+ * Select the entire paragraph containing the current selection.
58
+ * Looks for the nearest element with [data-paragraph-index] attribute.
59
+ */
60
+ declare function selectParagraphAtCursor(): boolean;
61
+ /**
62
+ * Handle click event for multi-click detection.
63
+ * Call this in your click handler.
64
+ * Returns the click count (1 = single, 2 = double, 3 = triple).
65
+ */
66
+ declare function handleClickForMultiClick(event: MouseEvent): number;
67
+ /**
68
+ * Create a double-click handler that selects words.
69
+ * Returns a function that should be called on dblclick events.
70
+ */
71
+ declare function createDoubleClickWordSelector(): (event: MouseEvent) => void;
72
+ /**
73
+ * Create a triple-click handler that selects paragraphs.
74
+ * This uses our custom click counting since browsers have inconsistent triple-click.
75
+ */
76
+ declare function createTripleClickParagraphSelector(): (event: MouseEvent) => void;
77
+ declare const _default: {
78
+ isWordCharacter: typeof isWordCharacter;
79
+ isWhitespace: typeof isWhitespace;
80
+ findWordBoundaries: typeof findWordBoundaries;
81
+ getWordAt: typeof getWordAt;
82
+ findWordAt: typeof findWordAt;
83
+ selectWordAtCursor: typeof selectWordAtCursor;
84
+ selectWordInTextNode: typeof selectWordInTextNode;
85
+ expandSelectionToWordBoundaries: typeof expandSelectionToWordBoundaries;
86
+ selectParagraphAtCursor: typeof selectParagraphAtCursor;
87
+ handleClickForMultiClick: typeof handleClickForMultiClick;
88
+ createDoubleClickWordSelector: typeof createDoubleClickWordSelector;
89
+ createTripleClickParagraphSelector: typeof createTripleClickParagraphSelector;
90
+ };
91
+
92
+ export { type WordSelectionResult, createDoubleClickWordSelector, createTripleClickParagraphSelector, _default as default, expandSelectionToWordBoundaries, findWordAt, findWordBoundaries, getWordAt, handleClickForMultiClick, isWhitespace, isWordCharacter, selectParagraphAtCursor, selectWordAtCursor, selectWordInTextNode };
@@ -0,0 +1 @@
1
+ export{k as createDoubleClickWordSelector,l as createTripleClickParagraphSelector,m as default,h as expandSelectionToWordBoundaries,e as findWordAt,c as findWordBoundaries,d as getWordAt,j as handleClickForMultiClick,b as isWhitespace,a as isWordCharacter,i as selectParagraphAtCursor,f as selectWordAtCursor,g as selectWordInTextNode}from'../chunk-4RCISPPE.mjs';import'../chunk-TTRUPDAB.mjs';
@@ -0,0 +1,78 @@
1
+ export { P as PIXELS_PER_INCH, e as emuToPixels, p as pixelsToEmu, a as pointsToPixels } from '../units-O5Y02RKQ.mjs';
2
+
3
+ /**
4
+ * Unit Conversion Utilities - Convert OOXML units to CSS/pixels
5
+ *
6
+ * OOXML uses various unit systems that need conversion for rendering:
7
+ * - Twips: 1/20 of a point (1440 twips = 1 inch)
8
+ * - EMUs (English Metric Units): 914400 EMUs = 1 inch
9
+ * - Half-points: 1/2 of a point (144 half-points = 1 inch)
10
+ * - Points: 72 points = 1 inch
11
+ * - Eighths of a point: 1/8 of a point (576 eighths = 1 inch)
12
+ *
13
+ * Standard assumption: 96 DPI (pixels per inch)
14
+ * @packageDocumentation
15
+ * @public
16
+ */
17
+
18
+ /** Twips per inch (1 inch = 1440 twips) */
19
+ declare const TWIPS_PER_INCH = 1440;
20
+ /**
21
+ * Automatic paragraph spacing applied for `w:beforeAutospacing` /
22
+ * `w:afterAutospacing` (HTML-origin "auto" spacing). Word renders these as
23
+ * ~14px before/after regardless of any explicit `w:before`/`w:after` value.
24
+ */
25
+ declare const AUTO_PARAGRAPH_SPACING_PX = 14;
26
+ /**
27
+ * Convert twips to pixels (at 96 DPI)
28
+ *
29
+ * 1 inch = 1440 twips = 96 pixels
30
+ * → 1 twip = 96/1440 pixels = 1/15 pixels
31
+ */
32
+ declare function twipsToPixels(twips: number): number;
33
+ /**
34
+ * Convert pixels to twips
35
+ */
36
+ declare function pixelsToTwips(px: number): number;
37
+ /**
38
+ * Convert EMUs to twips
39
+ */
40
+ declare function emuToTwips(emu: number): number;
41
+ /**
42
+ * Convert twips to EMUs
43
+ */
44
+ declare function twipsToEmu(twips: number): number;
45
+ /**
46
+ * Convert half-points to pixels (at 96 DPI)
47
+ *
48
+ * Half-points are commonly used for font sizes in OOXML (w:sz).
49
+ */
50
+ declare function halfPointsToPixels(halfPoints: number): number;
51
+ /**
52
+ * Convert half-points to points
53
+ */
54
+ declare function halfPointsToPoints(halfPoints: number): number;
55
+ /**
56
+ * Convert points to half-points
57
+ */
58
+ declare function pointsToHalfPoints(points: number): number;
59
+ /**
60
+ * Convert eighths of a point to pixels (at 96 DPI)
61
+ *
62
+ * Eighths of a point are used for border widths in OOXML.
63
+ */
64
+ declare function eighthsToPixels(eighths: number): number;
65
+ /**
66
+ * Round a pixel value to avoid sub-pixel rendering issues
67
+ */
68
+ declare function roundPixels(px: number, decimalPlaces?: number): number;
69
+ /**
70
+ * Clamp a value between min and max
71
+ */
72
+ declare function clamp(value: number, min: number, max: number): number;
73
+ /**
74
+ * Format a pixel value as CSS string
75
+ */
76
+ declare function formatPx(px: number): string;
77
+
78
+ export { AUTO_PARAGRAPH_SPACING_PX, TWIPS_PER_INCH, clamp, eighthsToPixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, pixelsToTwips, pointsToHalfPoints, roundPixels, twipsToEmu, twipsToPixels };
@@ -0,0 +1 @@
1
+ export{f as AUTO_PARAGRAPH_SPACING_PX,a as PIXELS_PER_INCH,e as TWIPS_PER_INCH,p as clamp,n as eighthsToPixels,b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,l as halfPointsToPoints,c as pixelsToEmu,h as pixelsToTwips,m as pointsToHalfPoints,d as pointsToPixels,o as roundPixels,j as twipsToEmu,g as twipsToPixels}from'../chunk-3UBMCDME.mjs';import'../chunk-TTRUPDAB.mjs';
@@ -0,0 +1,115 @@
1
+ import { Document } from './types/document.mjs';
2
+ import { c as DocumentBody, P as Paragraph } from './content-sSHuWw49.mjs';
3
+
4
+ /**
5
+ * Variable Detector Utility
6
+ *
7
+ * Scans a DOCX document for template variables in the format {variable_name}
8
+ * (standard docxtemplater syntax).
9
+ * Returns a unique, sorted list of variable names found in the document.
10
+ */
11
+
12
+ /**
13
+ * Result of variable detection
14
+ */
15
+ interface VariableDetectionResult {
16
+ /** Unique variable names sorted alphabetically */
17
+ variables: string[];
18
+ /** Total count of variable occurrences */
19
+ totalOccurrences: number;
20
+ /** Variables by location */
21
+ byLocation: {
22
+ body: string[];
23
+ headers: string[];
24
+ footers: string[];
25
+ footnotes: string[];
26
+ endnotes: string[];
27
+ textBoxes: string[];
28
+ };
29
+ /** Variable occurrences with positions */
30
+ occurrences: VariableOccurrence[];
31
+ }
32
+ /**
33
+ * A single variable occurrence with location info
34
+ */
35
+ interface VariableOccurrence {
36
+ /** Variable name (without braces) */
37
+ name: string;
38
+ /** Location type */
39
+ location: 'body' | 'header' | 'footer' | 'footnote' | 'endnote' | 'textBox';
40
+ /** Paragraph index within location */
41
+ paragraphIndex?: number;
42
+ /** Section index (for headers/footers) */
43
+ sectionIndex?: number;
44
+ }
45
+ /**
46
+ * Detect all template variables in a document
47
+ *
48
+ * @param doc - The parsed document
49
+ * @returns Array of unique variable names sorted alphabetically
50
+ */
51
+ declare function detectVariables(doc: Document): string[];
52
+ /**
53
+ * Detect variables with detailed information
54
+ *
55
+ * @param doc - The parsed document
56
+ * @returns Detailed detection result
57
+ */
58
+ declare function detectVariablesDetailed(doc: Document): VariableDetectionResult;
59
+ /**
60
+ * Detect variables in document body
61
+ */
62
+ declare function detectVariablesInBody(body: DocumentBody): string[];
63
+ /**
64
+ * Detect variables in a paragraph
65
+ */
66
+ declare function detectVariablesInParagraph(paragraph: Paragraph): string[];
67
+ /**
68
+ * Extract variable names from text
69
+ *
70
+ * @param text - The text to search
71
+ * @returns Array of variable names (without braces)
72
+ */
73
+ declare function extractVariablesFromText(text: string): string[];
74
+ /**
75
+ * Check if text contains template variables
76
+ */
77
+ declare function hasTemplateVariables(text: string): boolean;
78
+ /**
79
+ * Check if a variable name is valid
80
+ */
81
+ declare function isValidVariableName(name: string): boolean;
82
+ /**
83
+ * Sanitize a variable name
84
+ */
85
+ declare function sanitizeVariableName(name: string): string;
86
+ /**
87
+ * Format a variable name with braces (standard docxtemplater syntax)
88
+ */
89
+ declare function formatVariable(name: string): string;
90
+ /**
91
+ * Parse a variable string to get the name
92
+ */
93
+ declare function parseVariable(variable: string): string | null;
94
+ /**
95
+ * Replace variables in text with values
96
+ *
97
+ * @param text - The text containing variables
98
+ * @param values - Map of variable name to replacement value
99
+ * @returns Text with variables replaced
100
+ */
101
+ declare function replaceVariables(text: string, values: Record<string, string>): string;
102
+ /**
103
+ * Replace all variables in text with a placeholder
104
+ *
105
+ * @param text - The text containing variables
106
+ * @param placeholder - Placeholder to use (default: empty string)
107
+ * @returns Text with variables replaced
108
+ */
109
+ declare function removeVariables(text: string, placeholder?: string): string;
110
+ /**
111
+ * Check if document has any template variables
112
+ */
113
+ declare function documentHasVariables(doc: Document): boolean;
114
+
115
+ export { type VariableDetectionResult as V, type VariableOccurrence as a, detectVariablesDetailed as b, detectVariablesInBody as c, detectVariables as d, detectVariablesInParagraph as e, documentHasVariables as f, extractVariablesFromText as g, formatVariable as h, hasTemplateVariables as i, isValidVariableName as j, replaceVariables as k, parseVariable as p, removeVariables as r, sanitizeVariableName as s };
@@ -0,0 +1 @@
1
+ import'./chunk-EUUIJVM6.mjs';export{b as createEditSession,a as preloadEditWasm}from'./chunk-NEWOMDTX.mjs';import'./chunk-T4EZMUXM.mjs';import'./chunk-TTRUPDAB.mjs';
@@ -0,0 +1 @@
1
+ export{l as buildDisplayListJson,o as clearMeasureFonts,g as closeDisplayList,d as hasDisplayListSession,e as hasRangeRectsRegion,h as hitTestRegionsByHandle,b as hitTestRegionsJson,m as layoutDocumentJson,p as measureParagraphJson,f as openDisplayList,q as outlineGlyphJson,a as preloadLayoutWasm,i as rangeRectsByHandle,c as rangeRectsJson,k as rangeRectsRegionByHandle,j as rangeRectsRegionJson,n as registerMeasureFont}from'./chunk-CIRN3LZA.mjs';import'./chunk-T4EZMUXM.mjs';import'./chunk-TTRUPDAB.mjs';