@novaprose/tinymce-compat 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/README.md +10 -3
  2. package/THIRD_PARTY_NOTICES.md +2 -0
  3. package/dist/ai-XVSDIIQI.js +127 -0
  4. package/dist/ai-XVSDIIQI.js.map +1 -0
  5. package/dist/dialog-3UZZZW6Y.js +300 -0
  6. package/dist/dialog-3UZZZW6Y.js.map +1 -0
  7. package/dist/index.cjs +1351 -397
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +109 -48
  10. package/dist/index.d.ts +109 -48
  11. package/dist/index.js +856 -363
  12. package/dist/index.js.map +1 -1
  13. package/dist/novaprose.css +440 -508
  14. package/dist/tinymce-chunks/a11ychecker-fe78c552.js +2 -0
  15. package/dist/tinymce-chunks/a11ychecker-fe78c552.js.map +7 -0
  16. package/dist/tinymce-chunks/accordion-ui-4272c63b.js +2 -0
  17. package/dist/tinymce-chunks/accordion-ui-4272c63b.js.map +7 -0
  18. package/dist/tinymce-chunks/advcode-840793ca.js +2 -0
  19. package/dist/tinymce-chunks/advcode-840793ca.js.map +7 -0
  20. package/dist/tinymce-chunks/advcode-editor-37bc0a02.js +26 -0
  21. package/dist/tinymce-chunks/advcode-editor-37bc0a02.js.map +7 -0
  22. package/dist/tinymce-chunks/advlist-67b98670.js +2 -0
  23. package/dist/tinymce-chunks/advlist-67b98670.js.map +7 -0
  24. package/dist/tinymce-chunks/advtable-ui-db2e667d.js +2 -0
  25. package/dist/tinymce-chunks/advtable-ui-db2e667d.js.map +7 -0
  26. package/dist/tinymce-chunks/ai-e0658729.js +6 -0
  27. package/dist/tinymce-chunks/ai-e0658729.js.map +7 -0
  28. package/dist/tinymce-chunks/ai2-ddf912a7.js +34 -0
  29. package/dist/tinymce-chunks/ai2-ddf912a7.js.map +7 -0
  30. package/dist/tinymce-chunks/anchor-ui-da0966bb.js +2 -0
  31. package/dist/tinymce-chunks/anchor-ui-da0966bb.js.map +7 -0
  32. package/dist/tinymce-chunks/autocorrect-907e1296.js +3 -0
  33. package/dist/tinymce-chunks/autocorrect-907e1296.js.map +7 -0
  34. package/dist/tinymce-chunks/autolink-897e8650.js +2 -0
  35. package/dist/tinymce-chunks/autolink-897e8650.js.map +7 -0
  36. package/dist/tinymce-chunks/autoresize-f8a4a52a.js +2 -0
  37. package/dist/tinymce-chunks/autoresize-f8a4a52a.js.map +7 -0
  38. package/dist/tinymce-chunks/autosave-60381295.js +2 -0
  39. package/dist/tinymce-chunks/autosave-60381295.js.map +7 -0
  40. package/dist/tinymce-chunks/bash-f3f8783a.js +2 -0
  41. package/dist/tinymce-chunks/bash-f3f8783a.js.map +7 -0
  42. package/dist/tinymce-chunks/c-8e3b278b.js +2 -0
  43. package/dist/tinymce-chunks/c-8e3b278b.js.map +7 -0
  44. package/dist/tinymce-chunks/casechange-8ad6a2c3.js +6 -0
  45. package/dist/tinymce-chunks/casechange-8ad6a2c3.js.map +7 -0
  46. package/dist/tinymce-chunks/charmap-5deb524c.js +2 -0
  47. package/dist/tinymce-chunks/charmap-5deb524c.js.map +7 -0
  48. package/dist/tinymce-chunks/checklist-5a0c95d3.js +2 -0
  49. package/dist/tinymce-chunks/checklist-5a0c95d3.js.map +7 -0
  50. package/dist/tinymce-chunks/codesample-b91dcd91.js +4 -0
  51. package/dist/tinymce-chunks/codesample-b91dcd91.js.map +7 -0
  52. package/dist/tinymce-chunks/comments-panel-152e9cbe.js +2 -0
  53. package/dist/tinymce-chunks/comments-panel-152e9cbe.js.map +7 -0
  54. package/dist/tinymce-chunks/core-f5b3fd3e.js +4 -0
  55. package/dist/tinymce-chunks/core-f5b3fd3e.js.map +7 -0
  56. package/dist/tinymce-chunks/cpp-525b2c81.js +2 -0
  57. package/dist/tinymce-chunks/cpp-525b2c81.js.map +7 -0
  58. package/dist/tinymce-chunks/csharp-b95db858.js +2 -0
  59. package/dist/tinymce-chunks/csharp-b95db858.js.map +7 -0
  60. package/dist/tinymce-chunks/css-bb736f0c.js +2 -0
  61. package/dist/tinymce-chunks/css-bb736f0c.js.map +7 -0
  62. package/dist/tinymce-chunks/de-eb649701.js +2 -0
  63. package/dist/tinymce-chunks/de-eb649701.js.map +7 -0
  64. package/dist/tinymce-chunks/dialog-126a0355.js +2 -0
  65. package/dist/tinymce-chunks/dialog-126a0355.js.map +7 -0
  66. package/dist/tinymce-chunks/diff-02578ed2.js +2 -0
  67. package/dist/tinymce-chunks/diff-02578ed2.js.map +7 -0
  68. package/dist/tinymce-chunks/directionality-185b3810.js +2 -0
  69. package/dist/tinymce-chunks/directionality-185b3810.js.map +7 -0
  70. package/dist/tinymce-chunks/dockerfile-ff44475c.js +2 -0
  71. package/dist/tinymce-chunks/dockerfile-ff44475c.js.map +7 -0
  72. package/dist/tinymce-chunks/draghandle-a1d99987.js +4 -0
  73. package/dist/tinymce-chunks/draghandle-a1d99987.js.map +7 -0
  74. package/dist/tinymce-chunks/editimage-36199bc6.js +2 -0
  75. package/dist/tinymce-chunks/editimage-36199bc6.js.map +7 -0
  76. package/dist/tinymce-chunks/email-1926dd8a.js +62 -0
  77. package/dist/tinymce-chunks/email-1926dd8a.js.map +7 -0
  78. package/dist/tinymce-chunks/email2-e9c49586.js +2 -0
  79. package/dist/tinymce-chunks/email2-e9c49586.js.map +7 -0
  80. package/dist/tinymce-chunks/emoticons-a5ab437d.js +2 -0
  81. package/dist/tinymce-chunks/emoticons-a5ab437d.js.map +7 -0
  82. package/dist/tinymce-chunks/es-b9c95169.js +2 -0
  83. package/dist/tinymce-chunks/es-b9c95169.js.map +7 -0
  84. package/dist/tinymce-chunks/exportpdf-0c6647bc.js +2 -0
  85. package/dist/tinymce-chunks/exportpdf-0c6647bc.js.map +7 -0
  86. package/dist/tinymce-chunks/exportword-8a03f24d.js +2 -0
  87. package/dist/tinymce-chunks/exportword-8a03f24d.js.map +7 -0
  88. package/dist/tinymce-chunks/footnotes-ui-3f167c2c.js +2 -0
  89. package/dist/tinymce-chunks/footnotes-ui-3f167c2c.js.map +7 -0
  90. package/dist/tinymce-chunks/form-dialog-9eb62199.js +2 -0
  91. package/dist/tinymce-chunks/form-dialog-9eb62199.js.map +7 -0
  92. package/dist/tinymce-chunks/formatpainter-cbeeffa7.js +2 -0
  93. package/dist/tinymce-chunks/formatpainter-cbeeffa7.js.map +7 -0
  94. package/dist/tinymce-chunks/fr-724ffe36.js +2 -0
  95. package/dist/tinymce-chunks/fr-724ffe36.js.map +7 -0
  96. package/dist/tinymce-chunks/fullpagehtml-ui-9dd804af.js +2 -0
  97. package/dist/tinymce-chunks/fullpagehtml-ui-9dd804af.js.map +7 -0
  98. package/dist/tinymce-chunks/go-14612282.js +2 -0
  99. package/dist/tinymce-chunks/go-14612282.js.map +7 -0
  100. package/dist/tinymce-chunks/graphql-032121b4.js +2 -0
  101. package/dist/tinymce-chunks/graphql-032121b4.js.map +7 -0
  102. package/dist/tinymce-chunks/history-diff-a0db052c.js +2 -0
  103. package/dist/tinymce-chunks/history-diff-a0db052c.js.map +7 -0
  104. package/dist/tinymce-chunks/importcss-28610ab5.js +3 -0
  105. package/dist/tinymce-chunks/importcss-28610ab5.js.map +7 -0
  106. package/dist/tinymce-chunks/importword-ec0b2213.js +2 -0
  107. package/dist/tinymce-chunks/importword-ec0b2213.js.map +7 -0
  108. package/dist/tinymce-chunks/index-330c7726.js +5 -0
  109. package/dist/tinymce-chunks/index-330c7726.js.map +7 -0
  110. package/dist/tinymce-chunks/index2-610900bb.js +2 -0
  111. package/dist/tinymce-chunks/index2-610900bb.js.map +7 -0
  112. package/dist/tinymce-chunks/insertdatetime-a48ee6e0.js +2 -0
  113. package/dist/tinymce-chunks/insertdatetime-a48ee6e0.js.map +7 -0
  114. package/dist/tinymce-chunks/it-f4816bbc.js +2 -0
  115. package/dist/tinymce-chunks/it-f4816bbc.js.map +7 -0
  116. package/dist/tinymce-chunks/java-e051279c.js +2 -0
  117. package/dist/tinymce-chunks/java-e051279c.js.map +7 -0
  118. package/dist/tinymce-chunks/javascript-d7a6fb3d.js +2 -0
  119. package/dist/tinymce-chunks/javascript-d7a6fb3d.js.map +7 -0
  120. package/dist/tinymce-chunks/json-08c0b631.js +2 -0
  121. package/dist/tinymce-chunks/json-08c0b631.js.map +7 -0
  122. package/dist/tinymce-chunks/kotlin-b34d5ff2.js +3 -0
  123. package/dist/tinymce-chunks/kotlin-b34d5ff2.js.map +7 -0
  124. package/dist/tinymce-chunks/linkchecker-820845fd.js +2 -0
  125. package/dist/tinymce-chunks/linkchecker-820845fd.js.map +7 -0
  126. package/dist/tinymce-chunks/lua-9b0ae20a.js +2 -0
  127. package/dist/tinymce-chunks/lua-9b0ae20a.js.map +7 -0
  128. package/dist/tinymce-chunks/markdown-5698ebec.js +34 -0
  129. package/dist/tinymce-chunks/markdown-5698ebec.js.map +7 -0
  130. package/dist/tinymce-chunks/markdown2-943bcf90.js +2 -0
  131. package/dist/tinymce-chunks/markdown2-943bcf90.js.map +7 -0
  132. package/dist/tinymce-chunks/math-ui-1b57f7eb.js +2 -0
  133. package/dist/tinymce-chunks/math-ui-1b57f7eb.js.map +7 -0
  134. package/dist/tinymce-chunks/media-ui-de819f11.js +2 -0
  135. package/dist/tinymce-chunks/media-ui-de819f11.js.map +7 -0
  136. package/dist/tinymce-chunks/mediaembed-ui-7be11324.js +2 -0
  137. package/dist/tinymce-chunks/mediaembed-ui-7be11324.js.map +7 -0
  138. package/dist/tinymce-chunks/mentions-ui-b1bb2d15.js +2 -0
  139. package/dist/tinymce-chunks/mentions-ui-b1bb2d15.js.map +7 -0
  140. package/dist/tinymce-chunks/mergetags-ui-f5bdd1f9.js +2 -0
  141. package/dist/tinymce-chunks/mergetags-ui-f5bdd1f9.js.map +7 -0
  142. package/dist/tinymce-chunks/nonbreaking-f15226ad.js +2 -0
  143. package/dist/tinymce-chunks/nonbreaking-f15226ad.js.map +7 -0
  144. package/dist/tinymce-chunks/pagebreak-ui-7476f5c2.js +2 -0
  145. package/dist/tinymce-chunks/pagebreak-ui-7476f5c2.js.map +7 -0
  146. package/dist/tinymce-chunks/pageembed-ui-da39f1ee.js +2 -0
  147. package/dist/tinymce-chunks/pageembed-ui-da39f1ee.js.map +7 -0
  148. package/dist/tinymce-chunks/pagelayout-ui-01757669.js +2 -0
  149. package/dist/tinymce-chunks/pagelayout-ui-01757669.js.map +7 -0
  150. package/dist/tinymce-chunks/paste-office-d6821891.js +3 -0
  151. package/dist/tinymce-chunks/paste-office-d6821891.js.map +7 -0
  152. package/dist/tinymce-chunks/permanentpen-fc96f445.js +2 -0
  153. package/dist/tinymce-chunks/permanentpen-fc96f445.js.map +7 -0
  154. package/dist/tinymce-chunks/php-6b723470.js +3 -0
  155. package/dist/tinymce-chunks/php-6b723470.js.map +7 -0
  156. package/dist/tinymce-chunks/powershell-e6c3fdb8.js +2 -0
  157. package/dist/tinymce-chunks/powershell-e6c3fdb8.js.map +7 -0
  158. package/dist/tinymce-chunks/print-86762549.js +27 -0
  159. package/dist/tinymce-chunks/print-86762549.js.map +7 -0
  160. package/dist/tinymce-chunks/pt-BR-abebbb34.js +2 -0
  161. package/dist/tinymce-chunks/pt-BR-abebbb34.js.map +7 -0
  162. package/dist/tinymce-chunks/python-a20cacce.js +2 -0
  163. package/dist/tinymce-chunks/python-a20cacce.js.map +7 -0
  164. package/dist/tinymce-chunks/quickbars-35c87c0e.js +2 -0
  165. package/dist/tinymce-chunks/quickbars-35c87c0e.js.map +7 -0
  166. package/dist/tinymce-chunks/revisionhistory-741dfb24.js +2 -0
  167. package/dist/tinymce-chunks/revisionhistory-741dfb24.js.map +7 -0
  168. package/dist/tinymce-chunks/ru-f1d19f4f.js +2 -0
  169. package/dist/tinymce-chunks/ru-f1d19f4f.js.map +7 -0
  170. package/dist/tinymce-chunks/ruby-93c325c7.js +2 -0
  171. package/dist/tinymce-chunks/ruby-93c325c7.js.map +7 -0
  172. package/dist/tinymce-chunks/rust-d80fbab5.js +2 -0
  173. package/dist/tinymce-chunks/rust-d80fbab5.js.map +7 -0
  174. package/dist/tinymce-chunks/save-a65e56cd.js +2 -0
  175. package/dist/tinymce-chunks/save-a65e56cd.js.map +7 -0
  176. package/dist/tinymce-chunks/scss-7cffeb15.js +2 -0
  177. package/dist/tinymce-chunks/scss-7cffeb15.js.map +7 -0
  178. package/dist/tinymce-chunks/search-bar-3ea04183.js +3 -0
  179. package/dist/tinymce-chunks/search-bar-3ea04183.js.map +7 -0
  180. package/dist/tinymce-chunks/spellchecker-91509fc1.js +6 -0
  181. package/dist/tinymce-chunks/spellchecker-91509fc1.js.map +7 -0
  182. package/dist/tinymce-chunks/sql-eeac1a81.js +2 -0
  183. package/dist/tinymce-chunks/sql-eeac1a81.js.map +7 -0
  184. package/dist/tinymce-chunks/suggestions-panel-c29362cf.js +2 -0
  185. package/dist/tinymce-chunks/suggestions-panel-c29362cf.js.map +7 -0
  186. package/dist/tinymce-chunks/suggestions-ui-c5f6bad4.js +2 -0
  187. package/dist/tinymce-chunks/suggestions-ui-c5f6bad4.js.map +7 -0
  188. package/dist/tinymce-chunks/swift-2b081f3e.js +2 -0
  189. package/dist/tinymce-chunks/swift-2b081f3e.js.map +7 -0
  190. package/dist/tinymce-chunks/table-4d43f60d.js +2 -0
  191. package/dist/tinymce-chunks/table-4d43f60d.js.map +7 -0
  192. package/dist/tinymce-chunks/table-dialogs-0445847c.js +2 -0
  193. package/dist/tinymce-chunks/table-dialogs-0445847c.js.map +7 -0
  194. package/dist/tinymce-chunks/tableofcontents-ui-01a9af06.js +2 -0
  195. package/dist/tinymce-chunks/tableofcontents-ui-01a9af06.js.map +7 -0
  196. package/dist/tinymce-chunks/temml-d637f801.js +97 -0
  197. package/dist/tinymce-chunks/temml-d637f801.js.map +7 -0
  198. package/dist/tinymce-chunks/template-b522c8ed.js +2 -0
  199. package/dist/tinymce-chunks/template-b522c8ed.js.map +7 -0
  200. package/dist/tinymce-chunks/typescript-fa085d66.js +2 -0
  201. package/dist/tinymce-chunks/typescript-fa085d66.js.map +7 -0
  202. package/dist/tinymce-chunks/typography-469ce11a.js +3 -0
  203. package/dist/tinymce-chunks/typography-469ce11a.js.map +7 -0
  204. package/dist/tinymce-chunks/visualblocks-8b7cba25.js +2 -0
  205. package/dist/tinymce-chunks/visualblocks-8b7cba25.js.map +7 -0
  206. package/dist/tinymce-chunks/visualchars-7cda4c00.js +2 -0
  207. package/dist/tinymce-chunks/visualchars-7cda4c00.js.map +7 -0
  208. package/dist/tinymce-chunks/xml-77617a8f.js +2 -0
  209. package/dist/tinymce-chunks/xml-77617a8f.js.map +7 -0
  210. package/dist/tinymce-chunks/yaml-5bb3ad37.js +2 -0
  211. package/dist/tinymce-chunks/yaml-5bb3ad37.js.map +7 -0
  212. package/dist/tinymce.global.js +36 -29
  213. package/dist/tinymce.global.js.map +7 -1
  214. package/dist/tinymce.licenses.txt +1094 -0
  215. package/package.json +11 -6
@@ -0,0 +1,5 @@
1
+ var Qt=Object.create;var tt=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var re=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var se=(a,t,e)=>t in a?tt(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var z=(a,t)=>()=>{try{return t||a((t={exports:{}}).exports,t),t.exports}catch(e){throw t=0,e}};var ie=(a,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ee(t))!ne.call(a,n)&&n!==e&&tt(a,n,{get:()=>t[n],enumerable:!(r=te(t,n))||r.enumerable});return a};var D=(a,t,e)=>(e=a!=null?Qt(re(a)):{},ie(t||!a||!a.__esModule?tt(e,"default",{value:a,enumerable:!0}):e,a));var b=(a,t,e)=>se(a,typeof t!="symbol"?t+"":t,e);var yt=z(et=>{var ht=globalThis.__novaprose_tinymce["packages/core/src/plugins/index.ts"];Object.defineProperty(et,"__esModule",{value:!0});for(bt in ht)(function(a){Object.defineProperty(et,a,{enumerable:!0,get:function(){return ht[a]}})})(bt);var bt});var xt=z(rt=>{var vt=globalThis.__novaprose_tinymce["node_modules/.pnpm/prosemirror-model@1.25.13/node_modules/prosemirror-model/dist/index.js"];Object.defineProperty(rt,"__esModule",{value:!0});for($t in vt)(function(a){Object.defineProperty(rt,a,{enumerable:!0,get:function(){return vt[a]}})})($t);var $t});var Et=z(nt=>{var Pt=globalThis.__novaprose_tinymce["packages/core/src/document.ts"];Object.defineProperty(nt,"__esModule",{value:!0});for(kt in Pt)(function(a){Object.defineProperty(nt,a,{enumerable:!0,get:function(){return Pt[a]}})})(kt);var kt});var G=z(st=>{var Ct=globalThis.__novaprose_tinymce["packages/core/src/plugins/pagelayout.ts"];Object.defineProperty(st,"__esModule",{value:!0});for(Mt in Ct)(function(a){Object.defineProperty(st,a,{enumerable:!0,get:function(){return Ct[a]}})})(Mt);var Mt});var Ut=z(it=>{var Nt=globalThis.__novaprose_tinymce["packages/core/src/plugins/suggestions.ts"];Object.defineProperty(it,"__esModule",{value:!0});for(At in Nt)(function(a){Object.defineProperty(it,a,{enumerable:!0,get:function(){return Nt[a]}})})(At);var At});var St=z(at=>{var Tt=globalThis.__novaprose_tinymce["packages/core/src/url.ts"];Object.defineProperty(at,"__esModule",{value:!0});for(Rt in Tt)(function(a){Object.defineProperty(at,a,{enumerable:!0,get:function(){return Tt[a]}})})(Rt);var Rt});var Ke=D(yt(),1),Kt=D(xt(),1),Vt=D(Et(),1),wt=D(G(),1);var zt=D(G()),Z=D(Ut()),ut=D(St());var ae={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};function ot(a){return a.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi,(t,e)=>{if(e[0]==="#"){let r=e[1]==="x"||e[1]==="X"?parseInt(e.slice(2),16):parseInt(e.slice(1),10);return Number.isFinite(r)&&r>0&&r<=1114111?String.fromCodePoint(r):t}return ae[e.toLowerCase()]??t})}function oe(a){return a<32&&a!==9&&a!==10&&a!==13||a>65533}function N(a){let t="";for(let e=0;e<a.length;e++)oe(a.charCodeAt(e))||(t+=a[e]);return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}var le=/([^\s=/]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/g;function It(a){let t=a.charCodeAt(0)===65279?a.slice(1):a,e={name:"#document",attrs:{},children:[]},r=[e],n=0;for(;n<t.length;){let s=t.indexOf("<",n),i=r[r.length-1];if(s<0){n<t.length&&i.children.push(ot(t.slice(n)));break}if(s>n&&i.children.push(ot(t.slice(n,s))),t.startsWith("<!--",s)){let o=t.indexOf("-->",s+4);n=o<0?t.length:o+3}else if(t.startsWith("<![CDATA[",s)){let o=t.indexOf("]]>",s+9);i.children.push(t.slice(s+9,o<0?t.length:o)),n=o<0?t.length:o+3}else if(t.startsWith("<?",s)||t.startsWith("<!",s)){let o=t.indexOf(">",s);n=o<0?t.length:o+1}else if(t[s+1]==="/"){let o=t.indexOf(">",s),l=t.slice(s+2,o<0?t.length:o).trim(),c=r.map(p=>p.name).lastIndexOf(l);c>0&&(r.length=c),n=o<0?t.length:o+1}else{let o=s+1,l="";for(;o<t.length;o++){let w=t[o];if(l)w===l&&(l="");else if(w==='"'||w==="'")l=w;else if(w===">")break}let c=t.slice(s+1,o),p=c.endsWith("/");p&&(c=c.slice(0,-1));let u=c.search(/[\s]/),m=u<0?c:c.slice(0,u),f={};if(u>=0)for(let w of c.slice(u).matchAll(le))f[w[1]]=ot(w[2]??w[3]??"");let h={name:m,attrs:f,children:[]};i.children.push(h),p||r.push(h),n=o+1}}return e}function E(a,t){return a?a.children.filter(e=>typeof e!="string"&&(!t||e.name===t)):[]}function d(a,t){return a?.children.find(e=>typeof e!="string"&&e.name===t)}function j(a,...t){let e=a;for(let r of t)e=d(e,r);return e}function L(a){return typeof a=="string"?a:a.children.map(L).join("")}var ce=new TextEncoder,q=null;function pe(a){if(!q){q=new Uint32Array(256);for(let e=0;e<256;e++){let r=e;for(let n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;q[e]=r>>>0}}let t=4294967295;for(let e of a)t=q[(t^e)&255]^t>>>8;return(t^4294967295)>>>0}async function _t(a,t){let r=new ReadableStream({start(l){l.enqueue(a),l.close()}}).pipeThrough(t).getReader(),n=[],s=0;for(;;){let{done:l,value:c}=await r.read();if(l)break;n.push(c),s+=c.length}let i=new Uint8Array(s),o=0;for(let l of n)i.set(l,o),o+=l.length;return i}var ue=()=>typeof CompressionStream<"u";async function Ot(a){let t=[],e=[],r=0;for(let c of a){let p=ce.encode(c.name),u=pe(c.data),m=ue()&&c.data.length>64,f=m?await _t(c.data,new CompressionStream("deflate-raw")):c.data,h=m?8:0,w=new DataView(new ArrayBuffer(30));w.setUint32(0,67324752,!0),w.setUint16(4,20,!0),w.setUint16(6,2048,!0),w.setUint16(8,h,!0),w.setUint16(10,0,!0),w.setUint16(12,33,!0),w.setUint32(14,u,!0),w.setUint32(18,f.length,!0),w.setUint32(22,c.data.length,!0),w.setUint16(26,p.length,!0),w.setUint16(28,0,!0),t.push(new Uint8Array(w.buffer),p,f);let g=new DataView(new ArrayBuffer(46));g.setUint32(0,33639248,!0),g.setUint16(4,20,!0),g.setUint16(6,20,!0),g.setUint16(8,2048,!0),g.setUint16(10,h,!0),g.setUint16(12,0,!0),g.setUint16(14,33,!0),g.setUint32(16,u,!0),g.setUint32(20,f.length,!0),g.setUint32(24,c.data.length,!0),g.setUint16(28,p.length,!0),g.setUint32(42,r,!0),e.push(new Uint8Array(g.buffer),p),r+=30+p.length+f.length}let n=e.reduce((c,p)=>c+p.length,0),s=new DataView(new ArrayBuffer(22));s.setUint32(0,101010256,!0),s.setUint16(8,a.length,!0),s.setUint16(10,a.length,!0),s.setUint32(12,n,!0),s.setUint32(16,r,!0);let i=[...t,...e,new Uint8Array(s.buffer)],o=new Uint8Array(i.reduce((c,p)=>c+p.length,0)),l=0;for(let c of i)o.set(c,l),l+=c.length;return o}async function Dt(a){let t=new DataView(a.buffer,a.byteOffset,a.byteLength),e=-1;for(let o=a.length-22;o>=Math.max(0,a.length-22-65535);o--)if(t.getUint32(o,!0)===101010256){e=o;break}if(e<0)throw new Error("Not a ZIP file");let r=t.getUint16(e+10,!0),n=t.getUint32(e+16,!0),s=new TextDecoder,i=new Map;for(let o=0;o<r;o++){if(t.getUint32(n,!0)!==33639248)throw new Error("Damaged ZIP file");let l=t.getUint16(n+8,!0),c=t.getUint16(n+10,!0),p=t.getUint32(n+20,!0),u=t.getUint16(n+28,!0),m=t.getUint16(n+30,!0),f=t.getUint16(n+32,!0),h=t.getUint32(n+42,!0),w=s.decode(a.subarray(n+46,n+46+u));if(n+=46+u+m+f,l&1)throw new Error("Encrypted documents are not supported");let g=h+30+t.getUint16(h+26,!0)+t.getUint16(h+28,!0),$=a.subarray(g,g+p);if(c===0)i.set(w,$);else if(c===8){if(typeof DecompressionStream>"u")throw new Error("This browser cannot unpack compressed files");i.set(w,await _t($,new DecompressionStream("deflate-raw")))}else throw new Error(`Unsupported compression in ${w}`)}return i}var A={w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",a:"http://schemas.openxmlformats.org/drawingml/2006/main",pic:"http://schemas.openxmlformats.org/drawingml/2006/picture",rel:"http://schemas.openxmlformats.org/officeDocument/2006/relationships"},I=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ `,fe=1440/25.4,Xt=9525,me=600,X=a=>Math.round(a*fe);function de(a){return a[0]===137&&a[1]===80&&a[2]===78&&a[3]===71?"png":a[0]===255&&a[1]===216&&a[2]===255?"jpeg":a[0]===71&&a[1]===73&&a[2]===70?"gif":null}function we(a,t){let e=new DataView(a.buffer,a.byteOffset,a.byteLength);try{if(t==="png")return{width:e.getUint32(16),height:e.getUint32(20)};if(t==="gif")return{width:e.getUint16(6,!0),height:e.getUint16(8,!0)};for(let r=2;r+9<a.length&&a[r]===255;){let n=a[r+1],s=e.getUint16(r+2);if(n>=192&&n<=207&&![196,200,204].includes(n))return{height:e.getUint16(r+5),width:e.getUint16(r+7)};r+=2+s}}catch{}return{}}function ge(a){let t=atob(a.replace(/\s+/g,"")),e=new Uint8Array(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}async function he(a){let t,e=/^data:[^,;]*(;base64)?,([\s\S]*)$/i.exec(a);if(e)t=e[1]?ge(e[2]):new TextEncoder().encode(decodeURIComponent(e[2]));else if(typeof fetch=="function"&&!/^(javascript|vbscript):/i.test(a)){let n=await fetch(a);if(!n.ok)return null;t=new Uint8Array(await n.arrayBuffer())}else return null;let r=de(t);return r?{data:t,type:r,...we(t,r)}:null}var be={black:"000000",white:"FFFFFF",red:"FF0000",green:"008000",blue:"0000FF",yellow:"FFFF00",orange:"FFA500",purple:"800080",gray:"808080",grey:"808080"};function lt(a){if(typeof a!="string")return null;let t=a.trim().toLowerCase(),e=/^#([0-9a-f]{3,8})$/.exec(t)?.[1];if(e)return e.length===3||e.length===4?[...e.slice(0,3)].map(n=>n+n).join("").toUpperCase():e.length===6||e.length===8?e.slice(0,6).toUpperCase():null;let r=/^rgba?\(([^)]+)\)$/.exec(t)?.[1];if(r){let n=r.split(/[\s,/]+/).filter(Boolean);if(n.length>=4&&Number(n[3])===0)return null;let s=n.slice(0,3).map(i=>i.endsWith("%")?parseFloat(i)*255/100:parseFloat(i));return s.length<3||s.some(i=>!Number.isFinite(i))?null:s.map(i=>Math.round(Math.min(255,Math.max(0,i))).toString(16).padStart(2,"0")).join("").toUpperCase()}return be[t]??null}var ye={serif:"Times New Roman","sans-serif":"Arial",monospace:"Consolas","system-ui":"Calibri",cursive:"Comic Sans MS"};function ve(a){if(typeof a!="string")return null;let t=a.split(",")[0].trim().replace(/^['"]|['"]$/g,"");return t?ye[t.toLowerCase()]??t.slice(0,64):null}function jt(a){let t=typeof a=="string"?/^(\d+(?:\.\d+)?)(px|pt)$/.exec(a.trim()):null;if(!t)return null;let e=t[2]==="px"?Number(t[1])*.75:Number(t[1]);return e>0&&e<1e3?Math.round(e*2):null}function ct(a){let t=a.replace(/[^\p{L}\p{N}_]/gu,"_");return(/^\p{L}/u.test(t)?t:`b_${t}`).slice(0,40)}function Lt(a){let t=Number(a);return new Date(Number.isFinite(t)&&t>0?t:0).toISOString().replace(/\.\d+Z$/,"Z")}var Ft={font:"Cambria Math",italic:!0};function pt(a){let t=(0,Z.blockSuggestion)(a.attrs.suggestion);return t?.change!=="insert"&&t?.change!=="delete"?null:{tag:t.change==="insert"?"w:ins":"w:del",author:(t.name||t.author||"NovaProse").slice(0,80),time:t.time}}var $e=["\u2022","\u25E6","\u25AA"],xe=["decimal","lowerLetter","lowerRoman"],Pe={decimal:"decimal","lower-alpha":"lowerLetter","lower-latin":"lowerLetter","upper-alpha":"upperLetter","upper-latin":"upperLetter","lower-roman":"lowerRoman","upper-roman":"upperRoman","lower-greek":"lowerLetter"},ke={disc:"\u2022",circle:"\u25E6",square:"\u25AA"},ft=class{constructor(t,e){b(this,"layout",t);b(this,"images",e);b(this,"rels",[]);b(this,"relCount",2);b(this,"media",[]);b(this,"imageRels",new Map);b(this,"abstracts",new Map);b(this,"abstractXml",[]);b(this,"numXml",[]);b(this,"numCount",0);b(this,"drawingCount",0);b(this,"bookmarkCount",0);b(this,"changeCount",0);b(this,"textWidthPx");b(this,"bands",[]);this.textWidthPx=(t.width-t.margins.left-t.margins.right)*96/25.4}rel(t,e,r=!1){let n=`rId${++this.relCount}`;return this.rels.push(`<Relationship Id="${n}" Type="${A.rel}/${t}" Target="${N(e)}"${r?' TargetMode="External"':""}/>`),n}runProps(t,e,r={}){let n=this.props(t,e,r),s=t.find(c=>c.type.name==="suggestion_format");if(!s)return n?`<w:rPr>${n}</w:rPr>`:"";let i=this.props((0,Z.formatMarks)(s.type.schema,s.attrs.before),e,r),o=String(s.attrs.name||s.attrs.author||"NovaProse").slice(0,80),l=`<w:rPrChange w:id="${++this.changeCount}" w:author="${N(o)}" w:date="${Lt(s.attrs.time)}"><w:rPr>${i}</w:rPr></w:rPrChange>`;return`<w:rPr>${n}${l}</w:rPr>`}props(t,e,r={}){let n=r.style??"",s=r.font??"",i=!!e.bold,o=!!r.italic,l=!1,c="",p="",u=!1,m="",f="";for(let w of t){let g=w.type.name;if(g==="link")n="Hyperlink";else if(g==="bold")i=!0;else if(g==="italic")o=!0;else if(g==="underline")u=!0;else if(g==="strike")l=!0;else if(g==="subscript")f="subscript";else if(g==="superscript")f="superscript";else if(g==="code")s="Consolas",m||(m="F3F4F6");else if(g==="color")c=lt(w.attrs.value)??c;else if(g==="background")m=lt(w.attrs.value)??m;else if(g==="font_family")s=ve(w.attrs.value)??s;else if(g==="font_size"){let $=jt(w.attrs.value);$&&(p=`<w:sz w:val="${$}"/><w:szCs w:val="${$}"/>`)}}return(n?`<w:rStyle w:val="${n}"/>`:"")+(s?`<w:rFonts w:ascii="${N(s)}" w:hAnsi="${N(s)}" w:cs="${N(s)}" w:eastAsia="${N(s)}"/>`:"")+(i?"<w:b/><w:bCs/>":"")+(o?"<w:i/><w:iCs/>":"")+(l?"<w:strike/>":"")+(c?`<w:color w:val="${c}"/>`:"")+p+(u?'<w:u w:val="single"/>':"")+(m?`<w:shd w:val="clear" w:color="auto" w:fill="${m}"/>`:"")+(f?`<w:vertAlign w:val="${f}"/>`:"")}text(t,e="w:t"){let r="";return t.split(`
3
+ `).forEach((n,s)=>{s&&(r+="<w:br/>"),n.split(" ").forEach((i,o)=>{o&&(r+="<w:tab/>"),i&&(r+=`<${e} xml:space="preserve">${N(i)}</${e}>`)})}),r}run(t,e,r,n={}){let s=this.revisionOf(e,r)?.tag==="w:del",i=`<w:r>${this.runProps(e,r,n)}${this.text(t,s?"w:delText":"w:t")}</w:r>`;return this.tracked(i,e,r)}revisionOf(t,e){if(e?.change?.tag==="w:del")return e.change;let r=t.find(n=>n.type.name==="suggestion_insert"||n.type.name==="suggestion_delete");return r?{tag:r.type.name==="suggestion_insert"?"w:ins":"w:del",author:String(r.attrs.name||r.attrs.author||"NovaProse").slice(0,80),time:r.attrs.time}:e?.change??null}revisionAttrs(t){return`w:id="${++this.changeCount}" w:author="${N(t.author)}" w:date="${Lt(t.time)}"`}tracked(t,e,r){let n=this.revisionOf(e,r);return n?`<${n.tag} ${this.revisionAttrs(n)}>${t}</${n.tag}>`:t}bookmark(t,e=""){if(typeof t!="string"||!t)return e;let r=++this.bookmarkCount;return`<w:bookmarkStart w:id="${r}" w:name="${N(ct(t))}"/>${e}<w:bookmarkEnd w:id="${r}"/>`}drawing(t,e,r,n){let s=typeof t=="string"?this.images.get(t):null,i=typeof e=="string"?e:"";if(!s||typeof t!="string")return i?this.text(`[${i}]`):"";let o=this.imageRels.get(t);if(!o){let h=`image${this.media.length+1}.${s.type}`;this.media.push({name:`word/media/${h}`,data:s.data}),o=this.rel("image",`media/${h}`),this.imageRels.set(t,o)}let l=Number(r)||s.width||300,c=s.width&&s.height?s.height/s.width:.75,p=Number(n)||l*c;l>this.textWidthPx&&(p*=this.textWidthPx/l,l=this.textWidthPx);let u=Math.round(l*Xt),m=Math.round(p*Xt),f=++this.drawingCount;return`<w:drawing><wp:inline distT="0" distB="0" distL="0" distR="0"><wp:extent cx="${u}" cy="${m}"/><wp:docPr id="${f}" name="Picture ${f}" descr="${N(i)}"/><wp:cNvGraphicFramePr><a:graphicFrameLocks noChangeAspect="1"/></wp:cNvGraphicFramePr><a:graphic><a:graphicData uri="${A.pic}"><pic:pic><pic:nvPicPr><pic:cNvPr id="${f}" name="Picture ${f}"/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip r:embed="${o}"/><a:stretch><a:fillRect/></a:stretch></pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${u}" cy="${m}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic></wp:inline></w:drawing>`}inlineNode(t,e){let r=t.type.name;if(t.isText)return this.run(t.text??"",t.marks,e);if(r==="hard_break")return this.tracked("<w:r><w:br/></w:r>",t.marks,e);if(r==="image")return this.tracked(`<w:r>${this.drawing(t.attrs.src,t.attrs.alt,t.attrs.width,t.attrs.height)}</w:r>`,t.marks,e);if(r==="anchor")return this.bookmark(t.attrs.id);if(r==="math_inline")return this.run(String(t.attrs.latex??""),t.marks,e,Ft);if(r==="mergetag")return this.run(String(t.attrs.label||`{{${String(t.attrs.key??"")}}}`),t.marks,e);let n=t.type.spec.leafText?.(t)??t.textContent;return n?this.run(n,t.marks,e):""}inline(t,e){let r="",n=null;return t.forEach(s=>{let i=s.marks.find(l=>l.type.name==="link"),o=i&&(0,ut.isSafeLinkUrl)(i.attrs.href)?String(i.attrs.href):null;o!==n&&(n!==null&&(r+="</w:hyperlink>"),o!==null&&(r+=o.startsWith("#")?`<w:hyperlink w:anchor="${N(ct(o.slice(1)))}">`:`<w:hyperlink r:id="${this.rel("hyperlink",o,!0)}">`),n=o),r+=this.inlineNode(s,e)}),n!==null&&(r+="</w:hyperlink>"),r}paragraph(t,e,r={}){let n=t?.attrs??{},s=n.dir==="rtl",i=r.style??e.style,o=r.jc??(typeof n.align=="string"?n.align:""),l=o==="justify"?"both":o==="center"||o==="right"||o==="left"?o:"",c=Number(n.indent)||0,p=r.indent??(e.continuation??0)+Math.max(0,c)*me,u="",m=typeof n.lineHeight=="string"?n.lineHeight:"";if(/^\d+(\.\d+)?$/.test(m))u=`<w:spacing w:line="${Math.round(Number(m)*240)}" w:lineRule="auto"/>`;else{let w=jt(m);w&&(u=`<w:spacing w:line="${w*10}" w:lineRule="exact"/>`)}let f=(i?`<w:pStyle w:val="${i}"/>`:"")+(r.numPr??"")+(r.border??"")+(s?"<w:bidi/>":"")+u+(p&&!r.numPr?`<w:ind w:${s?"right":"left"}="${p}"/>`:"")+(l?`<w:jc w:val="${l}"/>`:"")+(e.change?`<w:rPr><${e.change.tag} ${this.revisionAttrs(e.change)}/></w:rPr>`:""),h=r.content??(t?this.inline(t,e):"");return`<w:p>${f?`<w:pPr>${f}</w:pPr>`:""}${r.prefix??""}${h}</w:p>`}numbering(t,e,r){let n=`${t?"o":"b"}:${typeof e=="string"?e:""}`,s=this.abstracts.get(n);if(s===void 0){s=this.abstracts.size,this.abstracts.set(n,s);let l=typeof e=="string"?t?Pe[e]:ke[e]:void 0,c=Array.from({length:9},(p,u)=>{let m=`<w:pPr><w:ind w:left="${720*(u+1)}" w:hanging="360"/></w:pPr>`;if(t){let h=u===0&&l||xe[u%3];return`<w:lvl w:ilvl="${u}"><w:start w:val="1"/><w:numFmt w:val="${h}"/><w:lvlText w:val="%${u+1}."/><w:lvlJc w:val="left"/>${m}</w:lvl>`}let f=u===0&&l||$e[u%3];return`<w:lvl w:ilvl="${u}"><w:start w:val="1"/><w:numFmt w:val="bullet"/><w:lvlText w:val="${f}"/><w:lvlJc w:val="left"/>${m}</w:lvl>`});this.abstractXml.push(`<w:abstractNum w:abstractNumId="${s}"><w:multiLevelType w:val="hybridMultilevel"/>${c.join("")}</w:abstractNum>`)}let i=++this.numCount,o=t?`<w:lvlOverride w:ilvl="0"><w:startOverride w:val="${Math.max(0,r)}"/></w:lvlOverride>`:"";return this.numXml.push(`<w:num w:numId="${i}"><w:abstractNumId w:val="${s}"/>${o}</w:num>`),i}list(t,e){let r=t.type.name==="ordered_list",n=t.attrs.checklist===!0,s=Math.min(8,e.listLevel+1),i=n?0:this.numbering(r,t.attrs.listStyle,Number(t.attrs.start)||1),o={...e,listLevel:s,continuation:720*(s+1)},l="";return t.forEach(c=>{let p=!0;c.forEach(u=>{let m=u.type.name;p&&u.isTextblock?(p=!1,l+=this.paragraph(u,o,{numPr:i?`<w:numPr><w:ilvl w:val="${s}"/><w:numId w:val="${i}"/></w:numPr>`:void 0,prefix:n?this.run(c.attrs.checked?"\u2612 ":"\u2610 ",[],o):""})):m==="bullet_list"||m==="ordered_list"?l+=this.list(u,{...e,listLevel:s}):(p=!1,l+=this.block(u,o))})}),l}table(t,e){let r=[];t.forEach(y=>r.push(y));let n=new Map,s=new Map,i=0;if(r.forEach((y,x)=>{let v=0;y.forEach(M=>{for(;n.has(`${x}:${v}`);)v++;let T={row:x,col:v,colspan:Math.max(1,Number(M.attrs.colspan)||1),rowspan:Math.max(1,Math.min(r.length-x,Number(M.attrs.rowspan)||1)),cell:M};s.set(`${x}:${v}`,T);for(let S=0;S<T.rowspan;S++)for(let k=0;k<T.colspan;k++)n.set(`${x+S}:${v+k}`,T);v+=T.colspan,i=Math.max(i,v)})}),!i)return"";let o=Array.from({length:i},()=>null);for(let y of s.values()){let x=y.cell.attrs.colwidth;Array.isArray(x)&&x.forEach((v,M)=>{typeof v=="number"&&v>0&&o[y.col+M]==null&&(o[y.col+M]=v)})}let l=o.reduce((y,x)=>y+(x??0),0),c=o.filter(y=>y==null).length,p=c?Math.max(40,(this.textWidthPx-l)/c):0,u=o.map(y=>Math.round((y??p)*15)),m=t.attrs.align==="center"||t.attrs.align==="right"?t.attrs.align:"",f=y=>`<w:${y} w:val="single" w:sz="4" w:space="0" w:color="auto"/>`,h=`<w:tblPr><w:tblW w:w="${u.reduce((y,x)=>y+x,0)}" w:type="dxa"/>`+(m?`<w:jc w:val="${m}"/>`:"")+`<w:tblBorders>${["top","left","bottom","right","insideH","insideV"].map(f).join("")}</w:tblBorders><w:tblLayout w:type="fixed"/><w:tblCellMar><w:left w:w="108" w:type="dxa"/><w:right w:w="108" w:type="dxa"/></w:tblCellMar></w:tblPr>`,w=`<w:tblGrid>${u.map(y=>`<w:gridCol w:w="${y}"/>`).join("")}</w:tblGrid>`,g=(y,x)=>u.slice(y,y+x).reduce((v,M)=>v+M,0),$="";return r.forEach((y,x)=>{let v=pt(y)??e.change??null,M=v?{...e,change:v}:e,T=y.childCount>0;y.forEach(R=>{R.type.name!=="table_header"&&(T=!1)});let S="";for(let R=0;R<i;){let U=n.get(`${x}:${R}`);if(!U){S+=`<w:tc><w:tcPr><w:tcW w:w="${u[R]}" w:type="dxa"/></w:tcPr><w:p/></w:tc>`,R++;continue}let _=`<w:tcW w:w="${g(U.col,U.colspan)}" w:type="dxa"/>`,B=U.colspan>1?`<w:gridSpan w:val="${U.colspan}"/>`:"";if(U.row!==x)S+=`<w:tc><w:tcPr>${_}${B}<w:vMerge/></w:tcPr><w:p/></w:tc>`;else{let{cell:O}=U,H=pt(O),Yt=H?{...M,change:H}:M,gt=lt(O.attrs.background),W=O.attrs.valign==="middle"?"center":O.attrs.valign,Jt=_+B+(U.rowspan>1?'<w:vMerge w:val="restart"/>':"")+(gt?`<w:shd w:val="clear" w:color="auto" w:fill="${gt}"/>`:"")+(W==="top"||W==="center"||W==="bottom"?`<w:vAlign w:val="${W}"/>`:"")+(H?`<w:${H.tag==="w:ins"?"cellIns":"cellDel"} ${this.revisionAttrs(H)}/>`:""),Q=this.blocks(O,{...Yt,listLevel:-1,continuation:void 0,style:void 0,bold:e.bold||O.type.name==="table_header"});Q.endsWith("</w:p>")||(Q+="<w:p/>"),S+=`<w:tc><w:tcPr>${Jt}</w:tcPr>${Q}</w:tc>`}R+=U.colspan}let k=(T?"<w:tblHeader/>":"")+(v?`<${v.tag} ${this.revisionAttrs(v)}/>`:"");$+=`<w:tr>${k?`<w:trPr>${k}</w:trPr>`:""}${S}</w:tr>`}),`<w:tbl>${h}${w}${$}</w:tbl>`}blocks(t,e){let r="";return t.forEach(n=>r+=this.block(n,e)),r}block(t,e){let r=t.type.name,n=pt(t),s=n?{...e,change:n}:e;switch(r){case"paragraph":return this.paragraph(t,s);case"heading":{let i=Math.min(6,Math.max(1,Number(t.attrs.level)||1));return this.paragraph(t,s,{style:`Heading${i}`,content:this.bookmark(t.attrs.id,this.inline(t,s))})}case"blockquote":return this.blocks(t,{...s,style:"Quote"});case"code_block":return this.paragraph(null,s,{style:"Code",content:this.run(t.textContent,[],{...s,bold:!1})});case"bullet_list":case"ordered_list":return this.list(t,s);case"table":return this.table(t,s);case"horizontal_rule":return this.paragraph(null,s,{border:'<w:pBdr><w:bottom w:val="single" w:sz="6" w:space="1" w:color="auto"/></w:pBdr>',content:""});case"pagebreak":return'<w:p><w:r><w:br w:type="page"/></w:r></w:p>';case"figure":{let i="",o="";t.forEach(c=>{c.type.name==="figure_image"?i=this.drawing(c.attrs.src,c.attrs.alt,c.attrs.width,c.attrs.height):c.type.name==="figcaption"&&(o=this.paragraph(c,s,{style:"Caption"}))});let l=t.attrs.align==="center"||t.attrs.align==="right"?t.attrs.align:"";return this.paragraph(null,s,{jc:l,content:i?this.tracked(`<w:r>${i}</w:r>`,[],s):""})+o}case"math_block":return this.paragraph(null,s,{jc:"center",content:this.run(String(t.attrs.latex??""),[],s,Ft)});case"details":return this.blocks(t,s);case"details_summary":return this.paragraph(t,{...s,bold:!0});case"toc":{let i=Array.isArray(t.attrs.entries)?t.attrs.entries:[];return(typeof t.attrs.title=="string"&&t.attrs.title?this.paragraph(null,s,{content:this.run(t.attrs.title,[],{...s,bold:!0})}):"")+i.filter(l=>!!l&&typeof l.id=="string").map(l=>this.paragraph(null,s,{indent:Math.max(0,(Number(l.level)||1)-1)*360,content:`<w:hyperlink w:anchor="${N(ct(l.id))}">${this.run(String(l.text??""),[],s,{style:"Hyperlink"})}</w:hyperlink>`})).join("")}case"media":case"pageembed":case"link_card":{let i=String(t.attrs.src??t.attrs.href??"");return(0,ut.isSafeLinkUrl)(i)?this.paragraph(null,s,{content:`<w:hyperlink r:id="${this.rel("hyperlink",i,!0)}">${this.run(String(t.attrs.title||i),[],s)}</w:hyperlink>`}):""}default:return t.isTextblock?this.paragraph(t,s):t.isBlock&&t.childCount?this.blocks(t,s):""}}bandXml(t,e){let{layout:r}=this,n=X(r.width-r.margins.left-r.margins.right),s='<w:rPr><w:color w:val="595959"/><w:sz w:val="18"/><w:szCs w:val="18"/></w:rPr>',i=c=>`<w:fldSimple w:instr=" ${c} "><w:r>${s}<w:t>1</w:t></w:r></w:fldSimple>`,o=c=>c.split(/(\{pages?\})/).filter(p=>p!=="").map(p=>p==="{page}"?i("PAGE"):p==="{pages}"?i("NUMPAGES"):`<w:r>${s}<w:t xml:space="preserve">${N(p)}</w:t></w:r>`).join(""),l=`<w:r>${s}<w:tab/></w:r>`;return`${I}<w:${t} xmlns:w="${A.w}" xmlns:r="${A.r}"><w:p><w:pPr><w:tabs><w:tab w:val="center" w:pos="${Math.round(n/2)}"/><w:tab w:val="right" w:pos="${n}"/></w:tabs><w:spacing w:before="0" w:after="0"/></w:pPr>${o(e.left)}${l}${o(e.center)}${l}${o(e.right)}</w:p></w:${t}>`}bandReference(t,e){if(!e)return"";let r=`${t}1.xml`,n=this.rel(t,r);return this.bands.push({name:`word/${r}`,xml:this.bandXml(t==="header"?"hdr":"ftr",e),contentType:`application/vnd.openxmlformats-officedocument.wordprocessingml.${t}+xml`}),`<w:${t}Reference w:type="default" r:id="${n}"/>`}bandFiles(){let t=e=>new TextEncoder().encode(e);return{entries:this.bands.map(e=>({name:e.name,data:t(e.xml)})),overrides:this.bands.map(e=>`<Override PartName="/${e.name}" ContentType="${e.contentType}"/>`).join("")}}document(t){let e=this.blocks(t,{listLevel:-1});e.endsWith("</w:p>")||(e+="<w:p/>");let{layout:r}=this,n=r.margins,s=r.width>r.height?' w:orient="landscape"':"",i=this.bandReference("header",r.header)+this.bandReference("footer",r.footer),o=p=>X(Math.min(12.5,Math.max(3,p/2))),l=i&&r.differentFirstPage?"<w:titlePg/>":"",c=`<w:sectPr>${i}<w:pgSz w:w="${X(r.width)}" w:h="${X(r.height)}"${s}/><w:pgMar w:top="${X(n.top)}" w:right="${X(n.right)}" w:bottom="${X(n.bottom)}" w:left="${X(n.left)}" w:header="${o(n.top)}" w:footer="${o(n.bottom)}" w:gutter="0"/>${l}</w:sectPr>`;return I+`<w:document xmlns:w="${A.w}" xmlns:r="${A.r}" xmlns:wp="${A.wp}" xmlns:a="${A.a}" xmlns:pic="${A.pic}"><w:body>${e}${c}</w:body></w:document>`}numberingXml(){return`${I}<w:numbering xmlns:w="${A.w}">${this.abstractXml.join("")}${this.numXml.join("")}</w:numbering>`}relsXml(){return`${I}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="${A.rel}/styles" Target="styles.xml"/><Relationship Id="rId2" Type="${A.rel}/numbering" Target="numbering.xml"/>${this.rels.join("")}</Relationships>`}mediaFiles(){return this.media}};function Ee(a,t){let e=N(a),r=Math.round(t*2),n=(i,o)=>`<w:style w:type="paragraph" w:styleId="Heading${i}"><w:name w:val="heading ${i}"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:uiPriority w:val="9"/><w:qFormat/><w:pPr><w:keepNext/><w:spacing w:before="${Math.round(o*20*1.2)}" w:after="${Math.round(o*10)}"/><w:outlineLvl w:val="${i-1}"/></w:pPr><w:rPr><w:b/><w:bCs/><w:sz w:val="${Math.round(o*2)}"/><w:szCs w:val="${Math.round(o*2)}"/></w:rPr></w:style>`,s=[2,1.5,1.25,1,.875,.85];return`${I}<w:styles xmlns:w="${A.w}"><w:docDefaults><w:rPrDefault><w:rPr><w:rFonts w:ascii="${e}" w:hAnsi="${e}" w:cs="${e}" w:eastAsia="${e}"/><w:sz w:val="${r}"/><w:szCs w:val="${r}"/></w:rPr></w:rPrDefault><w:pPrDefault><w:pPr><w:spacing w:after="${Math.round(t*20*.75)}" w:line="384" w:lineRule="auto"/></w:pPr></w:pPrDefault></w:docDefaults><w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/><w:qFormat/></w:style>`+s.map((i,o)=>n(o+1,t*i)).join("")+`<w:style w:type="paragraph" w:styleId="Quote"><w:name w:val="Quote"/><w:basedOn w:val="Normal"/><w:qFormat/><w:pPr><w:pBdr><w:left w:val="single" w:sz="18" w:space="8" w:color="D0D7DE"/></w:pBdr><w:ind w:left="360"/></w:pPr><w:rPr><w:color w:val="59636E"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Code"><w:name w:val="Code"/><w:basedOn w:val="Normal"/><w:pPr><w:shd w:val="clear" w:color="auto" w:fill="F6F8FA"/><w:spacing w:line="276" w:lineRule="auto"/></w:pPr><w:rPr><w:rFonts w:ascii="Consolas" w:hAnsi="Consolas" w:cs="Consolas"/><w:sz w:val="${Math.round(r*.85)}"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Caption"><w:name w:val="caption"/><w:basedOn w:val="Normal"/><w:qFormat/><w:rPr><w:i/><w:color w:val="59636E"/><w:sz w:val="${Math.round(r*.85)}"/></w:rPr></w:style><w:style w:type="character" w:styleId="Hyperlink"><w:name w:val="Hyperlink"/><w:rPr><w:color w:val="0969DA"/><w:u w:val="single"/></w:rPr></w:style></w:styles>`}function Ce(a){let t=new Set;return a.descendants(e=>{(e.type.name==="image"||e.type.name==="figure_image")&&e.attrs.src&&t.add(String(e.attrs.src))}),[...t]}async function K(a,t={}){let e=t.page&&"width"in t.page&&typeof t.page.width=="number"?t.page:(0,zt.resolvePageLayout)(t.page??{}),r=t.loadImage??he,n=new Map;await Promise.all(Ce(a).map(async u=>{n.set(u,await r(u).catch(()=>null))}));let s=new ft(e,n),i=s.document(a),o=s.bandFiles(),l=u=>new TextEncoder().encode(u),c=t.title?`<dc:title>${N(t.title)}</dc:title>`:"",p=[{name:"[Content_Types].xml",data:l(`${I}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Default Extension="png" ContentType="image/png"/><Default Extension="jpeg" ContentType="image/jpeg"/><Default Extension="gif" ContentType="image/gif"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/><Override PartName="/word/numbering.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"/><Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/><Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>`+o.overrides+"</Types>")},{name:"_rels/.rels",data:l(`${I}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="${A.rel}/officeDocument" Target="word/document.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/><Relationship Id="rId3" Type="${A.rel}/extended-properties" Target="docProps/app.xml"/></Relationships>`)},{name:"word/document.xml",data:l(i)},{name:"word/styles.xml",data:l(Ee(t.font??"Calibri",t.fontSize??12))},{name:"word/numbering.xml",data:l(s.numberingXml())},{name:"word/_rels/document.xml.rels",data:l(s.relsXml())},{name:"docProps/core.xml",data:l(`${I}<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/">${c}</cp:coreProperties>`)},{name:"docProps/app.xml",data:l(`${I}<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"><Application>NovaProse</Application></Properties>`)},...o.entries,...s.mediaFiles()];return Ot(p)}var Y=D(G());var Me={yellow:"#ffff00",green:"#00ff00",cyan:"#00ffff",magenta:"#ff00ff",blue:"#0000ff",red:"#ff0000",darkBlue:"#000080",darkCyan:"#008080",darkGreen:"#008000",darkMagenta:"#800080",darkRed:"#800000",darkYellow:"#808000",darkGray:"#808080",lightGray:"#c0c0c0",black:"#000000",white:"#ffffff"},Ne={lowerLetter:"lower-alpha",upperLetter:"upper-alpha",lowerRoman:"lower-roman",upperRoman:"upper-roman"},Ae={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",webp:"image/webp"},C=a=>a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),F=a=>!!a&&!["0","false","off","none"].includes(a.attrs["w:val"]??""),P=a=>a?.attrs["w:val"];function Ue(a){let t="";for(let e=0;e<a.length;e+=32768)t+=String.fromCharCode(...a.subarray(e,e+32768));return btoa(t)}function Bt(a,t){if(t.startsWith("/"))return t.slice(1);let e=a.split("/").slice(0,-1);for(let r of t.split("/"))r===".."?e.pop():r!=="."&&e.push(r);return e.join("/")}function V(a,t){return`${t}|${(a.attrs["w:author"]??"").slice(0,80)}|${Date.parse(a.attrs["w:date"]??"")}`}function Ht(a,t,e){let r=d(a,e);if(r)return{node:r,kind:"del",change:"delete"};let n=d(a,t);return n?{node:n,kind:"ins",change:"insert"}:null}var mt=class{constructor(t,e="accept"){b(this,"files",t);b(this,"revisions",e);b(this,"warnings",new Set);b(this,"styles",new Map);b(this,"levels",new Map);b(this,"starts",new Map);b(this,"footnotes",new Map);b(this,"notes",[]);b(this,"rels",new Map);b(this,"part","word/document.xml");b(this,"images",0);b(this,"inHeader",!1);b(this,"revisionCount",0);b(this,"wholeRevision",null)}xml(t){let e=this.files.get(t);return e?It(new TextDecoder().decode(e)):void 0}relsOf(t){let e=new Map,r=t.split("/").slice(0,-1).join("/"),n=t.split("/").pop(),s=this.xml(`${r?`${r}/`:""}_rels/${n}.rels`);for(let i of E(j(s,"Relationships"),"Relationship")){let o=i.attrs.TargetMode==="External";e.set(i.attrs.Id??"",{type:(i.attrs.Type??"").split("/").pop()??"",target:o?i.attrs.Target??"":Bt(t,i.attrs.Target??""),external:o})}return e}load(){let t=this.relsOf("_rels/.rels"),e=this.xml("_rels/.rels");for(let i of E(j(e,"Relationships"),"Relationship"))(i.attrs.Type??"").endsWith("/officeDocument")&&(this.part=Bt("",i.attrs.Target??"word/document.xml"));this.rels=this.relsOf(this.part);let r=i=>[...this.rels.values()].find(o=>o.type===i)?.target;for(let i of E(j(this.xml(r("styles")??""),"w:styles"),"w:style")){let o=d(i,"w:pPr"),l=P(d(o,"w:outlineLvl"));this.styles.set(i.attrs["w:styleId"]??"",{name:(P(d(i,"w:name"))??"").toLowerCase(),basedOn:P(d(i,"w:basedOn")),outline:l!==void 0?Number(l):void 0,numPr:d(o,"w:numPr"),jc:P(d(o,"w:jc")),rPr:d(i,"w:rPr")})}let n=j(this.xml(r("numbering")??""),"w:numbering"),s=new Map;for(let i of E(n,"w:abstractNum")){let o=[];for(let l of E(i,"w:lvl"))o[Number(l.attrs["w:ilvl"])||0]={format:P(d(l,"w:numFmt"))??"decimal",text:P(d(l,"w:lvlText"))??"",start:Number(P(d(l,"w:start"))??1)};s.set(i.attrs["w:abstractNumId"]??"",o)}for(let i of E(n,"w:num")){let o=i.attrs["w:numId"]??"";this.levels.set(o,s.get(P(d(i,"w:abstractNumId"))??"")??[]);for(let l of E(i,"w:lvlOverride")){let c=P(d(l,"w:startOverride"));c!==void 0&&this.starts.set(`${o}:${l.attrs["w:ilvl"]}`,Number(c))}}for(let i of E(j(this.xml(r("footnotes")??""),"w:footnotes"),"w:footnote"))this.footnotes.set(i.attrs["w:id"]??"",i);return j(this.xml(this.part),"w:document","w:body")}styleChain(t){let e=[],r=new Set;for(;t&&!r.has(t);){r.add(t);let n=this.styles.get(t);if(!n)break;e.push(n),t=n.basedOn}return e}headingLevel(t,e){let r=P(d(e,"w:outlineLvl"));if(r!==void 0&&Number(r)<6)return Number(r)+1;for(let n of this.styleChain(t)){let s=/^heading (\d)$/.exec(n.name);if(s)return Math.min(6,Number(s[1]));if(n.name==="title")return 1;if(n.outline!==void 0&&n.outline<6)return n.outline+1}return 0}styleKind(t){for(let e of this.styleChain(t)){if(/quote/.test(e.name))return"quote";if(/^(html preformatted|code|source code|macro text)/.test(e.name))return"code"}return null}runStyle(t,e=!1){let{bold:r,italic:n,underline:s,strike:i,vertical:o,color:l,background:c,font:p,size:u}=this.runFormat(t,e),m=Gt.test(p),f=[];l&&f.push(`color: ${l}`),c&&!(m&&qt.has(c))&&f.push(`background-color: ${c}`),p&&!m&&f.push(`font-family: ${p}`),u&&f.push(`font-size: ${u}`);let h=[];r&&h.push("strong"),n&&h.push("em"),s&&h.push("u"),i&&h.push("s"),o==="superscript"&&h.push("sup"),o==="subscript"&&h.push("sub"),m&&h.push("code");let w=h.map($=>`<${$}>`).join(""),g=h.reverse().map($=>`</${$}>`).join("");return f.length&&(w=`<span style="${C(f.join("; "))}">${w}`,g=`${g}</span>`),{open:w,close:g}}formatMarks(t,e=!1){let{bold:r,italic:n,underline:s,strike:i,vertical:o,color:l,background:c,font:p,size:u}=this.runFormat(t,e),m=Gt.test(p),f=[];return r&&f.push({type:"bold"}),n&&f.push({type:"italic"}),s&&f.push({type:"underline"}),i&&f.push({type:"strike"}),m&&f.push({type:"code"}),o==="superscript"&&f.push({type:"superscript"}),o==="subscript"&&f.push({type:"subscript"}),l&&f.push({type:"color",attrs:{value:l}}),c&&!(m&&qt.has(c))&&f.push({type:"background",attrs:{value:c}}),p&&!m&&f.push({type:"font_family",attrs:{value:/\s/.test(p)?`"${p}"`:p}}),u&&f.push({type:"font_size",attrs:{value:u}}),JSON.stringify(f)}runFormat(t,e){let r=[];for(let f of this.styleChain(P(d(t,"w:rStyle"))).reverse())f.rPr&&!(e&&f.name==="hyperlink")&&r.push(f.rPr);t&&r.push(t);let n=!1,s=!1,i=!1,o=!1,l="",c="",p="",u="",m="";for(let f of r){d(f,"w:b")&&!this.inHeader&&(n=F(d(f,"w:b"))),d(f,"w:i")&&(s=F(d(f,"w:i"))),d(f,"w:u")&&!e&&(i=F(d(f,"w:u"))),(d(f,"w:strike")||d(f,"w:dstrike"))&&(o=F(d(f,"w:strike")??d(f,"w:dstrike")));let h=P(d(f,"w:vertAlign"));h&&(l=h);let w=P(d(f,"w:color"));w&&!e&&/^[0-9a-f]{6}$/i.test(w)&&(c=`#${w.toLowerCase()}`);let g=Me[P(d(f,"w:highlight"))??""],$=d(f,"w:shd")?.attrs["w:fill"];g?p=g:$&&/^[0-9a-f]{6}$/i.test($)&&(p=`#${$.toLowerCase()}`);let y=d(f,"w:rFonts")?.attrs["w:ascii"];y&&(u=y.replace(/[;"<>{}]/g,""));let x=Number(P(d(f,"w:sz")));x>0&&(m=`${x/2}pt`)}return{bold:n,italic:s,underline:i,strike:o,vertical:l,color:c,background:p,font:u,size:m}}image(t,e,r,n=""){let s=t?this.rels.get(t):void 0;if(!s)return"";if(s.external)return/^https?:/i.test(s.target)?`<img src="${C(s.target)}" alt="${C(n)}"${e?` width="${e}"`:""}${r?` height="${r}"`:""}>`:"";let i=this.files.get(s.target),o=s.target.split(".").pop()?.toLowerCase()??"",l=Ae[o];return!i||!l?(this.warnings.add(`image format .${o||"?"}`),""):(this.images++,`<img src="data:${l};base64,${Ue(i)}" alt="${C(n)}"${e?` width="${e}"`:""}${r?` height="${r}"`:""}>`)}drawing(t){let e=d(t,"wp:inline")??d(t,"wp:anchor"),r=d(e,"wp:extent"),n=l=>l?Math.round(Number(l)/9525):void 0,s=d(e,"wp:docPr"),i,o=l=>{for(let c of E(l)){if(i)return;c.name==="a:blip"?i=c:o(c)}};return e&&o(e),this.image(i?.attrs["r:embed"]??i?.attrs["r:link"],n(r?.attrs.cx),n(r?.attrs.cy),s?.attrs.descr??s?.attrs.title??"")}vml(t){let e,r,n=o=>{for(let l of E(o))l.name==="v:shape"&&(r=l),l.name==="v:imagedata"?e=l:n(l)};if(n(t),!e)return"";let s=r?.attrs.style??"",i=o=>{let l=new RegExp(`${o}:\\s*([\\d.]+)(pt|px|in)`).exec(s);if(!l)return;let c=Number(l[1]);return Math.round(l[2]==="pt"?c*(4/3):l[2]==="in"?c*96:c)};return this.image(e.attrs["r:id"],i("width"),i("height"),e.attrs["o:title"]??"")}inline(t,e){for(let r of E(t))switch(r.name){case"w:r":this.run(r,e);break;case"w:hyperlink":{let n=r.attrs["r:id"]?this.rels.get(r.attrs["r:id"]):void 0,s=r.attrs["w:anchor"],i=n?.external?n.target:s?`#${s}`:"";i&&e.push(`<a href="${C(i)}">`),e.links++,this.inline(r,e),e.links--,i&&e.push("</a>");break}case"w:ins":case"w:moveTo":this.revisions==="suggestions"?this.revision(r,"ins",e):this.inline(r,e);break;case"w:del":case"w:moveFrom":this.revisions==="suggestions"&&this.revision(r,"del",e);break;case"w:smartTag":case"w:customXml":case"w:fldSimple":case"w:dir":case"w:bdo":this.inline(r,e);break;case"w:sdt":this.inline(d(r,"w:sdtContent")??r,e);break;case"m:oMath":case"m:oMathPara":e.push(`<em>${C(L(r))}</em>`),this.warnings.add("equations");break;default:break}}revision(t,e,r){if(this.wholeRevision===V(t,e)){let l=r.deleted;r.deleted=l||e==="del",this.inline(t,r),r.deleted=l;return}let{key:n,id:s,attrs:i}=this.revisionAttrs(t,e,r);r.push(`<${e}${i}>`);let o=r.deleted;r.deleted=o||e==="del",this.inline(t,r),r.deleted=o,r.push(`</${e}>`),r.revision={key:n,id:s,end:r.pushed}}wholeAttrs({node:t,change:e}){let r=(t.attrs["w:author"]??"").slice(0,80),n=Date.parse(t.attrs["w:date"]??""),s=`w${(t.attrs["w:id"]??"").replace(/[^\w-]/g,"").slice(0,60)||`r${++this.revisionCount}`}`;return` data-suggestion="${C(s)}" data-change="${e}"`+(r?` data-name="${C(r)}"`:"")+(Number.isFinite(n)?` data-time="${n}"`:"")}revisionAttrs(t,e,r){let n=(t.attrs["w:author"]??"").slice(0,80),s=Date.parse(t.attrs["w:date"]??""),i=V(t,e),o=r.revision,l=o&&o.key===i&&o.end===r.pushed?o.id:`w${(t.attrs["w:id"]??"").replace(/[^\w-]/g,"").slice(0,60)||`r${++this.revisionCount}`}`,c=` data-suggestion="${C(l)}"`+(n?` data-name="${C(n)}"`:"")+(Number.isFinite(s)?` data-time="${s}"`:"");return{key:i,id:l,attrs:c}}run(t,e){let r=d(t,"w:rPr");if(d(r,"w:rFonts")?.attrs["w:ascii"]==="Cambria Math"&&e.field!=="code"){let p=E(t,"w:t").map(L).join("");p&&e.push(`<span data-type="inline-math" data-latex="${C(p)}">${C(p)}</span>`);return}let{open:n,close:s}=this.runStyle(r,e.links>0),i=this.revisions==="suggestions"?d(r,"w:rPrChange"):void 0,o=i?this.revisionAttrs(i,"format",e):null;if(i&&o){let p=this.formatMarks(d(i,"w:rPr"),e.links>0);n=`<span${o.attrs} data-format="${C(p)}">${n}`,s=`${s}</span>`}let l="",c=()=>{l&&e.field!=="code"&&e.push(`${n}${l}${s}`),l=""};for(let p of E(t))switch(p.name){case"w:t":l+=C(L(p));break;case"w:delText":e.deleted&&(l+=C(L(p)));break;case"w:tab":case"w:ptab":l+=" ";break;case"w:noBreakHyphen":l+="-";break;case"w:sym":{let u=parseInt(p.attrs["w:char"]??"",16);Number.isFinite(u)&&u<57344&&(l+=C(String.fromCodePoint(u)));break}case"w:br":case"w:cr":c(),p.attrs["w:type"]==="page"?e.pageBreak():p.attrs["w:type"]!=="column"&&e.field!=="code"&&e.push("<br>");break;case"w:drawing":c(),e.field!=="code"&&e.push(this.drawing(p));break;case"w:pict":case"w:object":c(),e.field!=="code"&&e.push(this.vml(p));break;case"w:fldChar":{c();let u=p.attrs["w:fldCharType"];if(u==="begin")e.fields.push({code:"",link:!1}),e.field="code";else if(u==="separate"){let m=e.fields[e.fields.length-1];e.field="result";let f=m&&/^\s*HYPERLINK\s+(?:\\l\s+)?"([^"]+)"/.exec(m.code);if(m&&f){let h=/\\l/.test(m.code.split('"')[0]??"");e.push(`<a href="${C(h?`#${f[1]}`:f[1])}">`),m.link=!0,e.links++}}else u==="end"&&(e.fields.pop()?.link&&(e.push("</a>"),e.links--),e.field=e.fields.length?"result":null);break}case"w:instrText":{let u=e.fields[e.fields.length-1];u&&(u.code+=L(p));break}case"w:footnoteReference":{c();let u=this.footnotes.get(p.attrs["w:id"]??"");if(u){let m=this.notes.length+1;this.notes.push(`<p><sup>${m}</sup> ${this.noteText(u)}</p>`),e.push(`<sup>${m}</sup>`)}break}default:break}c(),o&&(e.revision={key:o.key,id:o.id,end:e.pushed})}noteText(t){return E(t,"w:p").map(e=>{let r=new J;return this.inline(e,r),r.parts().join(" ")}).join(" ").trim()}paragraph(t,e,r){let n=d(t,"w:pPr"),s=P(d(n,"w:pStyle")),i=this.headingLevel(s,n),o=i?null:this.styleKind(s),l=new J;this.inline(t,l);let c=l.parts(),p=this.styleChain(s),u=P(d(n,"w:jc"))??p.find(k=>k.jc)?.jc,m=[];u==="center"?m.push("text-align: center"):u==="right"||u==="end"?m.push("text-align: right"):(u==="both"||u==="distribute")&&m.push("text-align: justify");let f=d(n,"w:ind"),h=Number(f?.attrs["w:left"]??f?.attrs["w:start"]??0),w=d(n,"w:numPr")??p.find(k=>k.numPr)?.numPr,g=P(d(w,"w:numId"));h>0&&!g&&m.push(`margin-left: ${Math.round(h/15)}px`);let $=d(n,"w:spacing"),y=Number($?.attrs["w:line"]);y&&($?.attrs["w:lineRule"]??"auto")==="auto"&&y!==240&&m.push(`line-height: ${Math.round(y/240*100)/100}`);let x=F(d(n,"w:bidi")),v=`${m.length?` style="${m.join("; ")}"`:""}${x?' dir="rtl"':""}`,M=E(t,"w:bookmarkStart").find(k=>k.attrs["w:name"]!=="_GoBack"),T=i&&M?` id="${C(M.attrs["w:name"]??"")}"`:"";if(F(d(n,"w:pageBreakBefore"))&&(e.close(r),r.push(Wt)),c.length===1&&!c[0]&&!i&&d(d(n,"w:pBdr"),"w:bottom")){e.close(r),r.push("<hr>");return}let S=!i&&!g?/^([☐☒☑]) /.exec(c[0]??""):null;if(S&&c.length===1){e.item(r,"checklist",0,!1,"",1,S[1]!=="\u2610");let k=m.filter(R=>!R.startsWith("margin-left"));r.push(`<p${k.length?` style="${k.join("; ")}"`:""}${x?' dir="rtl"':""}>${c[0].slice(2)}</p>`);return}c.forEach((k,R)=>{if(R>0&&(e.close(r),r.push(Wt)),!(!k&&c.length>1)){if(g&&g!=="0"&&R===0){let U=Number(P(d(w,"w:ilvl"))??0),_=this.levels.get(g)?.[U];if(_&&_.format!=="none"){let B=_.format!=="bullet",O=this.starts.get(`${g}:${U}`)??_.start;e.item(r,g,U,B,B?Ne[_.format]??"":"",O),r.push(`<p${v}>${k}</p>`);return}}e.close(r),i?r.push(`<h${i}${T}${v}>${k}</h${i}>`):o==="quote"?r.push(`<blockquote><p${v}>${k}</p></blockquote>`):o==="code"?r.push(`<pre><code>${k.replace(/<br>/g,`
4
+ `)}</code></pre>`):r.push(`<p${v}>${k}</p>`)}})}table(t,e){let r=E(d(t,"w:tblGrid"),"w:gridCol").map(i=>Math.round(Number(i.attrs["w:w"]??0)/15)),n=E(t,"w:tr").map(i=>{let o=Number(P(d(d(i,"w:trPr"),"w:gridBefore"))??0),l=[];for(let c of E(i,"w:tc")){let p=d(c,"w:tcPr"),u=Math.max(1,Number(P(d(p,"w:gridSpan"))??1)),m=d(p,"w:vMerge"),f=m?P(m)==="restart"?"restart":"continue":null;l.push({tc:c,col:o,span:u,merge:f,rowspan:1}),o+=u}return{tr:i,cells:l}});n.forEach((i,o)=>{for(let l of i.cells)if(l.merge==="restart")for(let c=o+1;c<n.length&&n[c].cells.find(u=>u.col===l.col)?.merge==="continue";c++)l.rowspan++}),e.push("<table><tbody>");let s=this.revisions==="suggestions";for(let{tr:i,cells:o}of n){let l=d(i,"w:trPr"),c=F(d(l,"w:tblHeader")),p=Ht(l,"w:ins","w:del");if(p?.change==="delete"&&!s)continue;let u=s&&p?V(p.node,p.kind):null;e.push(s&&p?`<tr${this.wholeAttrs(p)}>`:"<tr>");for(let m of o){if(m.merge==="continue")continue;let f=d(m.tc,"w:tcPr"),h=Ht(f,"w:cellIns","w:cellDel");if(h?.change==="delete"&&!s)continue;let w=s&&h?this.wholeAttrs(h):"";this.wholeRevision=s&&h?V(h.node,h.kind):u;let g=c?"th":"td",$=[],y=d(f,"w:shd")?.attrs["w:fill"];y&&/^[0-9a-f]{6}$/i.test(y)&&$.push(`background-color: #${y.toLowerCase()}`);let x=P(d(f,"w:vAlign"));x==="center"?$.push("vertical-align: middle"):x==="bottom"&&$.push("vertical-align: bottom");let v=r.slice(m.col,m.col+m.span),M=v.length===m.span&&v.every(T=>T>0)?` data-colwidth="${v.join(",")}"`:"";e.push(`<${g}${m.span>1?` colspan="${m.span}"`:""}${m.rowspan>1?` rowspan="${m.rowspan}"`:""}${M}${$.length?` style="${$.join("; ")}"`:""}${w}>`),this.inHeader=c,this.blocks(m.tc,e),this.inHeader=!1,this.wholeRevision=null,e.push(`</${g}>`)}e.push("</tr>")}e.push("</tbody></table>")}blocks(t,e){let r=new dt,n=e.length;for(let s of E(t))s.name==="w:p"?this.paragraph(s,r,e):s.name==="w:tbl"?(r.close(e),this.table(s,e)):s.name==="w:sdt"?(r.close(e),this.blocks(d(s,"w:sdtContent")??s,e)):s.name==="w:altChunk"&&this.warnings.add("embedded content (altChunk)");r.close(e),t.name==="w:body"&&this.notes.length&&e.push("<hr>",...this.notes.splice(0)),e.length===n&&t.name==="w:tc"&&e.push("<p></p>")}page(t){let e=d(t,"w:sectPr"),r=d(e,"w:pgSz"),n=d(e,"w:pgMar");if(!r)return;let s=m=>Math.round(Number(m)/1440*25.4*10)/10,i=s(r.attrs["w:w"]),o=s(r.attrs["w:h"]);if(!(i>0&&o>0))return;r.attrs["w:orient"]==="landscape"&&i<o&&([i,o]=[o,i]);let l={};for(let m of["top","right","bottom","left"]){let f=n?.attrs[`w:${m}`];f!==void 0&&(l[m]=Math.abs(s(f)))}let[c,p]=i<o?[i,o]:[o,i];return{size:Object.keys(Y.PAGE_SIZES).find(m=>Math.abs(Y.PAGE_SIZES[m][0]-c)<1.5&&Math.abs(Y.PAGE_SIZES[m][1]-p)<1.5)??{width:i,height:o},orientation:i>o?"landscape":"portrait",margins:l}}},Wt='<div class="nova-pagebreak" style="break-after: page;"></div>',Gt=/^(consolas|courier( new)?|menlo|monaco|lucida console|source code pro|fira (code|mono)|jetbrains mono|cascadia (code|mono)|monospace)$/i,qt=new Set(["#f3f4f6","#f6f8fa"]),J=class{constructor(){b(this,"current",[]);b(this,"done",[]);b(this,"field",null);b(this,"fields",[]);b(this,"links",0);b(this,"deleted",!1);b(this,"pushed",0);b(this,"revision",null)}push(t){this.current.push(t),this.pushed++}pageBreak(){this.done.push(this.current.join("")),this.current=[]}parts(){return[...this.done,this.current.join("")]}},dt=class{constructor(){b(this,"stack",[])}item(t,e,r,n,s,i,o){let l=n?"ol":"ul",c=o===void 0?"<li>":`<li data-checked="${o}">`;for(;this.stack.length&&this.stack[this.stack.length-1].level>r;)t.push(`</li></${this.stack.pop().tag}>`);let p=this.stack[this.stack.length-1];if(p&&p.level===r){if(p.numId===e&&p.tag===l){t.push(`</li>${c}`);return}t.push(`</li></${this.stack.pop().tag}>`)}let u=(n&&i!==1?` start="${i}"`:"")+(s?` style="list-style-type: ${s}"`:"")+(o===void 0?"":' data-type="checklist"');t.push(`<${l}${u}>${c}`),this.stack.push({numId:e,level:r,tag:l})}close(t){for(;this.stack.length;)t.push(`</li></${this.stack.pop().tag}>`)}};async function Zt(a,t={}){let e=a instanceof Uint8Array?a:new Uint8Array(a),r=await Dt(e),n=new mt(r,t.revisions),s=n.load();if(!s)throw new Error("Not a Word document (.docx)");let i=[];return n.blocks(s,i),{html:i.join(""),page:n.page(s),warnings:[...n.warnings]}}function Te(a){return!!a&&typeof a=="object"&&"view"in a&&"getHTML"in a}function Je(a,t={}){return Te(a)?K(a.view.state.doc,{page:(0,wt.pageLayout)(a)?.layout,...t}):a instanceof Kt.Node?K(a,t):K((0,Vt.createRenderer)(t).doc(a),t)}async function Qe(a,t,e={}){let r=t instanceof Uint8Array?t:new Uint8Array(t instanceof ArrayBuffer?t:await t.arrayBuffer()),n=await Zt(r,{revisions:e.revisions??(a.hasPlugin("suggestions")?"suggestions":"accept")});return e.mode==="insert"?a.insertContent(n.html):a.setContent(n.html),n.page&&(0,wt.pageLayout)(a)?.set(n.page),n}export{Je as exportDocx,Zt as fromDocx,Qe as importDocx,K as toDocx};
5
+ //# sourceMappingURL=index-330c7726.js.map