@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 @@
1
+ 'use strict';function h(){return {type:"break",breakType:"page"}}function P(){return {type:"break",breakType:"column"}}function x(e){return {type:"break",breakType:"textWrapping",clear:e}}function b(){return {type:"run",content:[h()]}}function l(){return {type:"paragraph",content:[],formatting:{pageBreakBefore:true}}}function k(e){return e.content.filter(t=>t.type==="run")}function y(e,t){let{paragraphIndex:a}=t,n=[...e.package.document.content||[]],r=l();return n.splice(a+1,0,r),{...e,package:{...e.package,document:{...e.package.document,content:n}}}}function B(){return {type:"paragraph",content:[],formatting:{borders:{bottom:{style:"single",color:{rgb:"000000"},size:12,space:1}},spaceBefore:120,spaceAfter:120}}}function C(e,t){let{paragraphIndex:a}=t,n=[...e.package.document.content||[]],r=B();return n.splice(a+1,0,r),{...e,package:{...e.package,document:{...e.package.document,content:n}}}}function i(e){return e.type==="break"&&e.breakType==="page"}function d(e){return e.type==="break"&&e.breakType==="column"}function R(e){return e.type==="break"&&e.breakType==="textWrapping"}function I(e){return e.type==="break"}function g(e){return e.formatting?.pageBreakBefore===true}function D(e){let t=0;for(let a of e.package.document.content||[])if(a.type==="paragraph"){let n=a;g(n)&&t++;let r=k(n);for(let u of r)for(let o of u.content)i(o)&&t++;}return t}function T(e){let t=[],a=e.package.document.content||[];for(let n=0;n<a.length;n++){let r=a[n];if(r.type==="paragraph"){let u=r;g(u)&&t.push({paragraphIndex:n});let o=k(u);for(let p=0;p<o.length;p++){let s=o[p];for(let c of s.content)i(c)&&t.push({paragraphIndex:n,runIndex:p});}}}return t}function z(e,t){let{paragraphIndex:a,runIndex:n}=t,r=[...e.package.document.content||[]],u=r[a];if(u.type!=="paragraph")return e;let o=u;if(g(o)&&n===void 0)return r[a]={...o,formatting:{...o.formatting,pageBreakBefore:false}},{...e,package:{...e.package,document:{...e.package.document,content:r}}};if(n!==void 0){let p=[],s=0;for(let c of o.content)if(c.type==="run"){if(s===n){let f=c.content.filter(m=>!i(m));f.length>0&&p.push({...c,content:f});}else p.push(c);s++;}else p.push(c);return r[a]={...o,content:p},{...e,package:{...e.package,document:{...e.package.document,content:r}}}}return e}exports.a=h;exports.b=P;exports.c=x;exports.d=b;exports.e=l;exports.f=y;exports.g=B;exports.h=C;exports.i=i;exports.j=d;exports.k=R;exports.l=I;exports.m=g;exports.n=D;exports.o=T;exports.p=z;
@@ -0,0 +1,3 @@
1
+ import {b,a,o,d as d$1}from'./chunk-CPAYKE6X.mjs';import {i,h,k as k$1,a as a$1,j as j$1}from'./chunk-54ULJEHM.mjs';var re="application/x-docx-editor",d={HTML:"text/html",PLAIN:"text/plain"};function se(e){if(!e)return [];let t=()=>{if(!e.items||e.items.length===0)return [];let a=[];for(let l of Array.from(e.items)){if(l.kind!=="file"||!l.type.startsWith("image/"))continue;let c=l.getAsFile();c&&a.push(c);}return a},n=()=>!e.files||e.files.length===0?[]:Array.from(e.files).filter(a=>a.type.startsWith("image/")),i=t(),o=i.length?i:n();if(o.length<=1)return o;let r=["image/png","image/jpeg","image/webp","image/gif","image/svg+xml","image/bmp","image/tiff"],s=a=>{let l=a[0],c=r.indexOf(l.type);c<0&&(c=Number.MAX_SAFE_INTEGER);for(let m of a.slice(1)){let b=r.indexOf(m.type);if(b<0&&(b=Number.MAX_SAFE_INTEGER),b<c){l=m,c=b;continue}b===c&&m.size>l.size&&(l=m);}return l},u=new Map;for(let a of o){let l=a.name?.trim()??"",m=(l?l.replace(/\.[^/.]+$/,"").toLowerCase():"")||`size:${a.size}`,b=u.get(m);b?b.push(a):u.set(m,[a]);}let g=[];for(let a of u.values())g.push(s(a));return g}async function A(e,t={}){let{includeFormatting:n=true,onError:i,theme:o}=t;try{let r=F(e,n,o);return await S(r)}catch(r){return i?.(r),false}}async function ae(e,t={}){let{includeFormatting:n=true,onError:i,theme:o}=t;try{let r=j(e,n,o);return await S(r)}catch(r){return i?.(r),false}}function F(e,t=true,n){let i=e.map(L).join(""),o=t?O(e,n):v(i),r=JSON.stringify(e);return {plainText:i,html:o,internal:r}}function j(e,t=true,n){let i=e.map(X).join(`
2
+ `),o=t?Q(e,n):v(i),r=JSON.stringify(e);return {plainText:i,html:o,internal:r}}async function S(e){try{if(navigator.clipboard&&navigator.clipboard.write){let t=[new ClipboardItem({[d.PLAIN]:new Blob([e.plainText],{type:d.PLAIN}),[d.HTML]:new Blob([e.html],{type:d.HTML})})];return await navigator.clipboard.write(t),!0}return P(e)}catch{return P(e)}}function P(e){let t=document.createElement("div");t.innerHTML=e.html,t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t);try{let n=window.getSelection();if(!n)return !1;let i=document.createRange();i.selectNodeContents(t),n.removeAllRanges(),n.addRange(i);let o=document.execCommand("copy");return n.removeAllRanges(),o}finally{document.body.removeChild(t);}}async function le(e={}){let{cleanWordFormatting:t=true,onError:n}=e;try{if(navigator.clipboard&&navigator.clipboard.read){let i=await navigator.clipboard.read();return await z(i,t)}return null}catch(i){return n?.(i),null}}async function z(e,t){let n="",i="";for(let o of e)o.types.includes(d.HTML)&&(n=await(await o.getType(d.HTML)).text()),o.types.includes(d.PLAIN)&&(i=await(await o.getType(d.PLAIN)).text());return D(n,i,t)}function W(e,t={}){let{cleanWordFormatting:n=true}=t,i=e.clipboardData;if(!i)return null;let o=i.getData(d.HTML),r=i.getData(d.PLAIN);return D(o,r,n)}function D(e,t,n=true){let i=$(e),o=K(e);if(o){let u=e.match(/data-docx-editor-content="([^"]+)"/);if(u)try{return {runs:JSON.parse(decodeURIComponent(u[1])),fromWord:!1,fromEditor:!0,plainText:t}}catch{}}let r=e;return i&&n&&(r=U(e)),{runs:q(r,t),fromWord:i,fromEditor:o,plainText:t}}function $(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 K(e){return e.includes("data-docx-editor")||e.includes("docx-run")||e.includes("docx-paragraph")}function U(e){let t=e;return t=t.replace(/<!--\[if[\s\S]*?<!\[endif\]-->/gi,""),t=t.replace(/<!--[\s\S]*?-->/g,""),t=t.replace(/<\?xml[^>]*>/gi,""),t=t.replace(/<o:[^>]*>[\s\S]*?<\/o:[^>]*>/gi,""),t=t.replace(/<o:[^>]*\/>/gi,""),t=t.replace(/<w:[^>]*>[\s\S]*?<\/w:[^>]*>/gi,""),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 q(e,t){if(!e||e.trim()==="")return t?[k(t)]:[];let n=document.createElement("div");n.innerHTML=e;let i=[];return T(n,i,{}),i.length===0&&t?[k(t)]:i}function T(e,t,n){if(e.nodeType===Node.TEXT_NODE){let s=e.textContent||"";(s.trim()||s.includes(" "))&&t.push(k(s,n));return}if(e.nodeType!==Node.ELEMENT_NODE)return;let i=e,o=i.tagName.toLowerCase(),r={...n,...J(i)};switch(o){case "br":t.push(H(r));return;case "p":case "div":for(let s of i.childNodes)T(s,t,r);i.nextSibling&&t.push(H(r));return;case "b":case "strong":r.bold=true;break;case "i":case "em":r.italic=true;break;case "u":r.underline={style:"single"};break;case "s":case "strike":case "del":r.strike=true;break;case "sup":r.vertAlign="superscript";break;case "sub":r.vertAlign="subscript";break;case "code":case "pre":r.fontFamily={ascii:"Courier New"};break}for(let s of i.childNodes)T(s,t,r);}function J(e){let t={},n=e.style;(n.fontWeight==="bold"||parseInt(n.fontWeight)>=700)&&(t.bold=true),n.fontStyle==="italic"&&(t.italic=true);let i=n.textDecoration||n.textDecorationLine;if(i&&(i.includes("underline")&&(t.underline={style:"single"}),i.includes("line-through")&&(t.strike=true)),n.fontSize){let o=parseFloat(n.fontSize);isNaN(o)||(t.fontSize=Math.round(o/1.333*2));}if(n.fontFamily){let o=n.fontFamily.replace(/["']/g,"").split(",")[0].trim();o&&(t.fontFamily={ascii:o});}if(n.color){let o=I(n.color);o&&(t.color={rgb:o});}if(n.backgroundColor&&n.backgroundColor!=="transparent"){let o=I(n.backgroundColor);o&&(t.shading={fill:{rgb:o}});}return t}function I(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 n=parseInt(t[1]).toString(16).padStart(2,"0"),i=parseInt(t[2]).toString(16).padStart(2,"0"),o=parseInt(t[3]).toString(16).padStart(2,"0");return (n+i+o).toUpperCase()}return null}function L(e){return e.content.map(t=>t.type==="text"?t.text:t.type==="tab"?" ":t.type==="break"&&t.breakType==="textWrapping"?`
3
+ `:"").join("")}function X(e){return (e.content||[]).map(t=>t.type==="run"?L(t):"").join("")}function O(e,t){return e.map(n=>V(n,t)).join("")}function Q(e,t){return e.map(n=>`<p>${O(n.content?.filter(i=>i.type==="run")||[],t)}</p>`).join("")}function V(e,t){let n=L(e);if(!n)return "";let i=v(n),o=e.formatting;if(!o)return i;o.bold&&(i=`<strong>${i}</strong>`),o.italic&&(i=`<em>${i}</em>`),o.underline&&(i=`<u>${i}</u>`),o.strike&&(i=`<s>${i}</s>`),o.vertAlign==="superscript"&&(i=`<sup>${i}</sup>`),o.vertAlign==="subscript"&&(i=`<sub>${i}</sub>`);let r=[];if(o.fontSize){let g=o.fontSize/2;r.push(`font-size: ${g}pt`);}o.fontFamily?.ascii&&r.push(`font-family: "${o.fontFamily.ascii}"`);let s=b(o.color,t);s&&r.push(`color: #${s}`);let u=b(o.shading?.fill,t);return u&&r.push(`background-color: #${u}`),r.length>0&&(i=`<span style="${r.join("; ")}">${i}</span>`),i}function v(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function k(e,t){return {type:"run",formatting:t,content:[{type:"text",text:e}]}}function H(e){return {type:"run",formatting:e,content:[{type:"break",breakType:"textWrapping"}]}}function ce(e){let{onCopy:t,onCut:n,onPaste:i,clipboardOptions:o={}}=e;return {handleCopy:async a=>{if(!t)return;let l=t();if(!l)return;a.preventDefault();let c=F(l.runs);a.clipboardData?(a.clipboardData.setData(d.PLAIN,c.plainText),a.clipboardData.setData(d.HTML,c.html)):await S(c);},handleCut:async a=>{if(!n)return;let l=n();if(!l)return;a.preventDefault();let c=F(l.runs);a.clipboardData?(a.clipboardData.setData(d.PLAIN,c.plainText),a.clipboardData.setData(d.HTML,c.html)):await S(c);},handlePaste:a=>{if(!i)return;a.preventDefault();let l=W(a,o);l&&i(l);},handleKeyDown:async a=>{let l=a.ctrlKey||a.metaKey;if(l&&a.key==="c"&&!a.shiftKey&&t){let c=t();c&&await A(c.runs,o);}if(l&&a.key==="x"&&!a.shiftKey&&n){let c=n();c&&await A(c.runs,o);}}}}var Y={calibri:{googleFont:"Carlito",category:"sans-serif",fallbackStack:["Calibri","Carlito","Arial","Helvetica","sans-serif"],singleLineRatio:1.2207},cambria:{googleFont:"Caladea",category:"serif",fallbackStack:["Cambria","Caladea","Georgia","serif"],singleLineRatio:1.2676},arial:{googleFont:"Arimo",category:"sans-serif",fallbackStack:["Arial","Arimo","Helvetica","sans-serif"],singleLineRatio:1.1172},"times new roman":{googleFont:"Tinos",category:"serif",fallbackStack:["Times New Roman","Tinos","Times","serif"],singleLineRatio:1.1074},"courier new":{googleFont:"Cousine",category:"monospace",fallbackStack:["Courier New","Cousine","Courier","monospace"],singleLineRatio:1.1328},georgia:{googleFont:"Tinos",category:"serif",fallbackStack:["Georgia","Tinos","Times New Roman","serif"],singleLineRatio:1.1362},verdana:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Verdana","Open Sans","Arial","sans-serif"],singleLineRatio:1.2153},tahoma:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Tahoma","Open Sans","Arial","sans-serif"],singleLineRatio:1.2075},"trebuchet ms":{googleFont:"Fira Sans",category:"sans-serif",fallbackStack:["Trebuchet MS","Fira Sans","Arial","sans-serif"],singleLineRatio:1.1431},"comic sans ms":{googleFont:"Comic Neue",category:"cursive",fallbackStack:["Comic Sans MS","Comic Neue","cursive"],singleLineRatio:1.3936},impact:{googleFont:"Anton",category:"sans-serif",fallbackStack:["Impact","Anton","Arial Black","sans-serif"],singleLineRatio:1.2197},"palatino linotype":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Palatino Linotype","EB Garamond","Palatino","Georgia","serif"],singleLineRatio:1.0259},"book antiqua":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Book Antiqua","EB Garamond","Palatino","Georgia","serif"],singleLineRatio:1.0259},garamond:{googleFont:"EB Garamond",category:"serif",fallbackStack:["Garamond","EB Garamond","Georgia","serif"],singleLineRatio:1.068},"century gothic":{googleFont:"Questrial",category:"sans-serif",fallbackStack:["Century Gothic","Questrial","Arial","sans-serif"],singleLineRatio:1.1611},"lucida sans":{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Lucida Sans","Open Sans","Arial","sans-serif"],singleLineRatio:1.1655},"lucida console":{googleFont:"Cousine",category:"monospace",fallbackStack:["Lucida Console","Cousine","Courier New","monospace"],singleLineRatio:1.1387},consolas:{googleFont:"Inconsolata",category:"monospace",fallbackStack:["Consolas","Inconsolata","Cousine","Courier New","monospace"],singleLineRatio:1.1626},"ms mincho":{googleFont:"Noto Serif JP",category:"serif",fallbackStack:["MS Mincho","Noto Serif JP","serif"],singleLineRatio:1.15},"ms gothic":{googleFont:"Noto Sans JP",category:"sans-serif",fallbackStack:["MS Gothic","Noto Sans JP","sans-serif"],singleLineRatio:1.15},simhei:{googleFont:"Noto Sans SC",category:"sans-serif",fallbackStack:["SimHei","Noto Sans SC","sans-serif"],singleLineRatio:1.15},simsun:{googleFont:"Noto Serif SC",category:"serif",fallbackStack:["SimSun","Noto Serif SC","serif"],singleLineRatio:1.15},"malgun gothic":{googleFont:"Noto Sans KR",category:"sans-serif",fallbackStack:["Malgun Gothic","Noto Sans KR","sans-serif"],singleLineRatio:1.15}},Z={"sans-serif":"Arial, Helvetica, sans-serif",serif:"Times New Roman, Times, serif",monospace:"Courier New, Courier, monospace",cursive:"cursive",fantasy:"fantasy","system-ui":"system-ui, sans-serif"};function ee(e){let t=e.toLowerCase();return t.includes("mono")||t.includes("courier")||t.includes("consolas")||t.includes("console")||t.includes("code")||t.includes("terminal")?"monospace":t.includes("times")||t.includes("georgia")||t.includes("garamond")||t.includes("palatino")||t.includes("baskerville")||t.includes("bodoni")||t.includes("cambria")||t.includes("mincho")||t.includes("ming")||t.includes("song")||t.includes("serif")?"serif":t.includes("script")||t.includes("cursive")||t.includes("comic")||t.includes("brush")||t.includes("hand")?"cursive":"sans-serif"}function M(e){let t=e.trim().toLowerCase(),n=Y[t];if(n)return {googleFont:n.googleFont,cssFallback:n.fallbackStack.map(B).join(", "),originalFont:e,hasGoogleEquivalent:true,singleLineRatio:n.singleLineRatio};let i=ee(e),o=Z[i];return {googleFont:null,cssFallback:`${B(e)}, ${o}`,originalFont:e,hasGoogleEquivalent:false,singleLineRatio:1.15}}function B(e){return ["serif","sans-serif","monospace","cursive","fantasy","system-ui"].includes(e.toLowerCase())?e:/[\s,'"()]/.test(e)?`"${e.replace(/"/g,'\\"')}"`:e}function G(e,t){if(!t)return null;let i=e.toLowerCase().startsWith("major")?t.majorFont:t.minorFont;if(!i)return null;let o=e.toLowerCase();return o.includes("eastasia")||o.includes("ea")?i.ea??i.latin??null:o.includes("cs")||o.includes("bidi")?i.cs??i.latin??null:i.latin??null}function be(e,t){if(!e)return {};let n={};if(e.fontFamily){let s=null;if(e.fontFamily.asciiTheme&&t?.fontScheme&&(s=G(e.fontFamily.asciiTheme,t.fontScheme)),s||(s=e.fontFamily.ascii||e.fontFamily.hAnsi||e.fontFamily.eastAsia||e.fontFamily.cs||null),s){let u=M(s);n.fontFamily=u.cssFallback;}}if(e.fontSize!==void 0&&(n.fontSize=`${i(e.fontSize)}pt`),e.bold&&(n.fontWeight="bold"),e.italic&&(n.fontStyle="italic"),e.color&&(n.color=a(e.color,t)),e.highlight&&e.highlight!=="none"&&(n.backgroundColor=o(e.highlight)),e.shading){let s=_(e.shading,t);s&&!n.backgroundColor&&(n.backgroundColor=s);}let i$1=[],o$1=[],r=[];if(e.underline&&e.underline.style!=="none"){i$1.push("underline");let s=te(e.underline.style);s!=="solid"&&o$1.push(s),e.underline.color&&r.push(a(e.underline.color,t));}if(e.strike&&i$1.push("line-through"),e.doubleStrike&&i$1.push("line-through"),i$1.length>0&&(n.textDecoration=i$1.join(" "),o$1.length>0&&(n.textDecorationStyle=o$1[0]),r.length>0&&(n.textDecorationColor=r[0])),e.vertAlign)switch(e.vertAlign){case "superscript":n.verticalAlign="super",n.fontSize||(n.fontSize="0.83em");break;case "subscript":n.verticalAlign="sub",n.fontSize||(n.fontSize="0.83em");break}if(e.position&&e.position!==0){let s=h(e.position);n.position="relative",n.top=k$1(-s);}return e.allCaps?n.textTransform="uppercase":e.smallCaps&&(n.fontVariant="small-caps"),e.spacing!==void 0&&e.spacing!==0&&(n.letterSpacing=k$1(a$1(e.spacing))),e.scale!==void 0&&e.scale!==100&&(n.transform=`scaleX(${e.scale/100})`,n.display="inline-block"),e.hidden&&(n.display="none"),e.emboss&&(n.textShadow="1px 1px 1px rgba(255,255,255,0.5), -1px -1px 1px rgba(0,0,0,0.3)"),e.imprint&&(n.textShadow="-1px -1px 1px rgba(255,255,255,0.5), 1px 1px 1px rgba(0,0,0,0.3)"),e.outline&&(n.WebkitTextStroke="1px currentColor",n.WebkitTextFillColor="transparent"),e.shadow&&!e.emboss&&!e.imprint&&(n.textShadow="1px 1px 2px rgba(0,0,0,0.3)"),e.rtl&&(n.direction="rtl"),n}function me(e,t){if(!e)return {};let n={};if(e.alignment&&(n.textAlign=ne(e.alignment)),e.spaceBefore!==void 0&&(n.marginTop=k$1(a$1(e.spaceBefore))),e.spaceAfter!==void 0&&(n.marginBottom=k$1(a$1(e.spaceAfter))),e.lineSpacing!==void 0&&e.lineSpacing>0)switch(e.lineSpacingRule){case "exact":{let i=a$1(e.lineSpacing);i>0&&(n.lineHeight=k$1(i));break}case "atLeast":{let i=a$1(e.lineSpacing);i>0&&(n.minHeight=k$1(i),n.lineHeight=k$1(i));break}default:{let i=e.lineSpacing/240;i>0&&(n.lineHeight=i.toString());break}}if(e.indentLeft!==void 0&&(n.marginLeft=k$1(a$1(e.indentLeft))),e.indentRight!==void 0&&(n.marginRight=k$1(a$1(e.indentRight))),e.indentFirstLine!==void 0&&(e.hangingIndent?n.textIndent=k$1(a$1(e.indentFirstLine)):n.textIndent=k$1(a$1(e.indentFirstLine))),e.borders&&(e.borders.top&&Object.assign(n,C(e.borders.top,"Top",t)),e.borders.bottom&&Object.assign(n,C(e.borders.bottom,"Bottom",t)),e.borders.left&&Object.assign(n,C(e.borders.left,"Left",t)),e.borders.right&&Object.assign(n,C(e.borders.right,"Right",t))),e.shading){let i=_(e.shading,t);i&&(n.backgroundColor=i);}return e.bidi&&(n.direction="rtl"),e.pageBreakBefore&&(n.pageBreakBefore="always"),e.keepNext&&(n.pageBreakAfter="avoid"),e.keepLines&&(n.pageBreakInside="avoid"),n}function C(e,t="",n){if(!e||e.style==="none"||e.style==="nil")return {};let i={},o=e.size?j$1(e.size):1,r=e.color?a(e.color,n):"#000000",s=ie(e.style),u=`border${t}Width`,g=`border${t}Style`,a$1=`border${t}Color`;return i[u]=k$1(Math.max(1,o)),i[g]=s,i[a$1]=r,i}function _(e,t){return !e||e.pattern==="clear"||e.pattern==="nil"?"":e.fill?e.fill.auto||e.fill.rgb==="auto"||e.fill.rgb==="FFFFFF"?"":d$1(e.fill,t):e.pattern==="solid"&&e.color?d$1(e.color,t):e.pattern&&e.pattern.startsWith("pct")&&e.color?d$1(e.color,t):""}function te(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 ne(e){switch(e){case "center":return "center";case "right":return "right";case "both":case "distribute":return "justify";default:return "left"}}function ie(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 ye(e){let t=[];return e.descendants((n,i)=>{if(n.type.name==="paragraph"){let o=n.attrs.outlineLevel,r=n.attrs.styleId,s=o;if(s==null&&r){let u=r.match(/^[Hh]eading(\d)$/);u&&(s=parseInt(u[1],10)-1);}if(s!=null&&s>=0&&s<=8){let u="";n.forEach(g=>{g.isText&&(u+=g.text||"");}),u.trim()&&t.push({text:u.trim(),level:s,pmPos:i});}}}),t}export{re as a,d as b,se as c,A as d,ae as e,F as f,j as g,S as h,le as i,W as j,D as k,$ as l,K as m,U as n,q as o,ce as p,M as q,be as r,me as s,C as t,ye as u};