@betteroffice/docx 0.0.4 → 0.1.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 (61) hide show
  1. package/README.md +2 -1
  2. package/dist/chunk-24DL53QL.mjs +1 -0
  3. package/dist/chunk-5F6DLQZP.mjs +1 -0
  4. package/dist/{chunk-YTILOUAA.mjs → chunk-BUZ2X5CT.mjs} +1 -1
  5. package/dist/{chunk-B4IR6YP4.mjs → chunk-GHEHBYQK.mjs} +1 -1
  6. package/dist/{chunk-NJHOPXZW.mjs → chunk-HLDJMU3R.mjs} +1 -1
  7. package/dist/{chunk-4V6MDZIK.mjs → chunk-HTDNSQ44.mjs} +1 -1
  8. package/dist/{chunk-NTSSE5QK.mjs → chunk-PI2I3TO5.mjs} +1 -1
  9. package/dist/{chunk-6KDV6AIL.mjs → chunk-TMHG7OAZ.mjs} +1 -1
  10. package/dist/{chunk-NBSLB77E.mjs → chunk-VRGUAKOC.mjs} +1 -1
  11. package/dist/collaboration/index.d.mts +6 -6
  12. package/dist/{content-C3sTRz-u.d.mts → content-DrqzbIr7.d.mts} +67 -18
  13. package/dist/core.d.mts +7 -7
  14. package/dist/core.mjs +1 -1
  15. package/dist/{displayListQueries-DLzpvJV6.d.mts → displayListQueries-DGDR-OWc.d.mts} +87 -50
  16. package/dist/docx/index.d.mts +5 -5
  17. package/dist/docx/index.mjs +1 -1
  18. package/dist/editor/index.d.mts +8 -8
  19. package/dist/{fontLoader-CMH3bZ2Z.d.mts → fontLoader-DnixuYST.d.mts} +1 -1
  20. package/dist/{formatting-BEkIBePP.d.mts → formatting-BqrFPeev.d.mts} +8 -0
  21. package/dist/{frameDelta-B2kC6XiP.d.mts → frameDelta-DMgR8n13.d.mts} +15 -10
  22. package/dist/generated/edit/docx_edit_bg.wasm +0 -0
  23. package/dist/generated/layout/docx_layout_bg.wasm +0 -0
  24. package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
  25. package/dist/generated/parse/docx_parse_bg.wasm +0 -0
  26. package/dist/{index-2piKi4gO.d.mts → index-ImoMd0Ju.d.mts} +32 -65
  27. package/dist/layout/index.d.mts +40 -13
  28. package/dist/layout/index.mjs +1 -1
  29. package/dist/layout/pagination/index.d.mts +4 -4
  30. package/dist/layout/render/index.d.mts +33 -77
  31. package/dist/layout/render/index.mjs +1 -1
  32. package/dist/plugin-api/RenderedDomContext.d.mts +7 -7
  33. package/dist/plugin-api/index.d.mts +3 -3
  34. package/dist/plugin-api/resolveItemPositions.d.mts +3 -3
  35. package/dist/{rustDisplayList-B0M2eBkU.d.mts → rustDisplayList-B9dQoLHI.d.mts} +74 -50
  36. package/dist/{rustMeasureSource-D1KsQvVC.d.mts → rustMeasureSource-C0EZB055.d.mts} +5 -2
  37. package/dist/{selectiveSave-CVoajSKE.d.mts → selectiveSave-CRh-_Y_C.d.mts} +3 -3
  38. package/dist/styles/index.d.mts +3 -3
  39. package/dist/{styles-BK3Jecxs.d.mts → styles-CMybYYHS.d.mts} +1 -1
  40. package/dist/types/content.d.mts +2 -2
  41. package/dist/types/document.d.mts +7 -7
  42. package/dist/{types-C1rv3KM-.d.mts → types-CXLxVF1t.d.mts} +27 -23
  43. package/dist/utils/comments.d.mts +2 -2
  44. package/dist/utils/index.d.mts +11 -13
  45. package/dist/utils/index.mjs +1 -1
  46. package/dist/utils/stylePreview.d.mts +2 -2
  47. package/dist/wasm-CJHQHBDE.mjs +1 -0
  48. package/dist/{wasm-JE7B3ROD.mjs → wasm-T2CRCO7S.mjs} +1 -1
  49. package/dist/wasm-edit.d.mts +505 -173
  50. package/dist/wasm-edit.mjs +1 -1
  51. package/dist/wasm-layout.d.mts +31 -28
  52. package/dist/wasm-layout.mjs +1 -1
  53. package/dist/wasm-opc.mjs +1 -1
  54. package/dist/wasm-parse.mjs +1 -1
  55. package/dist/yrs/index.d.mts +5 -5
  56. package/dist/yrs/index.mjs +1 -1
  57. package/dist/yrs/residentEngineWorker.mjs +1 -1
  58. package/package.json +19 -2
  59. package/dist/chunk-GGEGIQRK.mjs +0 -1
  60. package/dist/chunk-T4EZMUXM.mjs +0 -1
  61. package/dist/wasm-F2ETFAYL.mjs +0 -1
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-T4EZMUXM.mjs';import {a}from'./chunk-TTRUPDAB.mjs';var S={};a(S,{build_display_list_json:()=>A,clear_measure_fonts:()=>D,close_display_list:()=>P,default:()=>J,hit_test_json:()=>X,hit_test_regions_by_handle:()=>z,hit_test_regions_json:()=>M,initSync:()=>H,install_panic_hook:()=>N,layout_document_json:()=>T,measure_paragraph_json:()=>W,open_display_list:()=>Y,outline_glyph_json:()=>O,range_rects_by_handle:()=>K,range_rects_json:()=>B,range_rects_region_by_handle:()=>Q,range_rects_region_json:()=>Z,register_measure_font:()=>I,update_display_list:()=>$,vertical_move_by_handle:()=>ee,vertical_move_json:()=>ne});function A(e){let n,t;try{let _=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=d,s=o.build_display_list_json(_,a);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,y(s[2]);return n=r,t=i,p(r,i)}finally{o.__wbindgen_free(n,t,1);}}function D(){o.clear_measure_fonts();}function P(e){o.close_display_list(e);}function X(e,n,t,r){let i,_;try{let l=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),f=d,u=o.hit_test_json(l,f,n,t,r);var a=u[0],s=u[1];if(u[3])throw a=0,s=0,y(u[2]);return i=a,_=s,p(a,s)}finally{o.__wbindgen_free(i,_,1);}}function z(e,n,t,r){let i,_;try{let l=o.hit_test_regions_by_handle(e,n,t,r);var a=l[0],s=l[1];if(l[3])throw a=0,s=0,y(l[2]);return i=a,_=s,p(a,s)}finally{o.__wbindgen_free(i,_,1);}}function M(e,n,t,r){let i,_;try{let l=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),f=d,u=o.hit_test_regions_json(l,f,n,t,r);var a=u[0],s=u[1];if(u[3])throw a=0,s=0,y(u[2]);return i=a,_=s,p(a,s)}finally{o.__wbindgen_free(i,_,1);}}function N(){o.install_panic_hook();}function T(e){let n,t;try{let _=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=d,s=o.layout_document_json(_,a);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,y(s[2]);return n=r,t=i,p(r,i)}finally{o.__wbindgen_free(n,t,1);}}function W(e){let n,t;try{let _=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=d,s=o.measure_paragraph_json(_,a);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,y(s[2]);return n=r,t=i,p(r,i)}finally{o.__wbindgen_free(n,t,1);}}function Y(e){let n=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),t=d,r=o.open_display_list(n,t);if(r[2])throw y(r[1]);return r[0]>>>0}function O(e,n){let t,r;try{let a=o.outline_glyph_json(e,n);var i=a[0],_=a[1];if(a[3])throw i=0,_=0,y(a[2]);return t=i,r=_,p(i,_)}finally{o.__wbindgen_free(t,r,1);}}function K(e,n,t){let r,i;try{let s=o.range_rects_by_handle(e,n,t);var _=s[0],a=s[1];if(s[3])throw _=0,a=0,y(s[2]);return r=_,i=a,p(_,a)}finally{o.__wbindgen_free(r,i,1);}}function B(e,n,t){let r,i;try{let s=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),l=d,f=o.range_rects_json(s,l,n,t);var _=f[0],a=f[1];if(f[3])throw _=0,a=0,y(f[2]);return r=_,i=a,p(_,a)}finally{o.__wbindgen_free(r,i,1);}}function Q(e,n,t,r,i){let _,a;try{let f=g(n,o.__wbindgen_malloc,o.__wbindgen_realloc),u=d,h=g(t,o.__wbindgen_malloc,o.__wbindgen_realloc),m=d,w=o.range_rects_region_by_handle(e,f,u,h,m,r,i);var s=w[0],l=w[1];if(w[3])throw s=0,l=0,y(w[2]);return _=s,a=l,p(s,l)}finally{o.__wbindgen_free(_,a,1);}}function Z(e,n,t,r,i){let _,a;try{let f=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=d,h=g(n,o.__wbindgen_malloc,o.__wbindgen_realloc),m=d,w=g(t,o.__wbindgen_malloc,o.__wbindgen_realloc),F=d,E=o.range_rects_region_json(f,u,h,m,w,F,r,i);var s=E[0],l=E[1];if(E[3])throw s=0,l=0,y(E[2]);return _=s,a=l,p(s,l)}finally{o.__wbindgen_free(_,a,1);}}function I(e){let n=te(e,o.__wbindgen_malloc),t=d,r=o.register_measure_font(n,t);if(r[2])throw y(r[1]);return r[0]>>>0}function $(e,n){let t=g(n,o.__wbindgen_malloc,o.__wbindgen_realloc),r=d,i=o.update_display_list(e,t,r);if(i[1])throw y(i[0])}function ee(e,n,t,r){let i,_;try{let l=g(t,o.__wbindgen_malloc,o.__wbindgen_realloc),f=d,u=o.vertical_move_by_handle(e,n,l,f,r);var a=u[0],s=u[1];if(u[3])throw a=0,s=0,y(u[2]);return i=a,_=s,p(a,s)}finally{o.__wbindgen_free(i,_,1);}}function ne(e,n,t,r){let i,_;try{let l=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),f=d,u=g(t,o.__wbindgen_malloc,o.__wbindgen_realloc),h=d,m=o.vertical_move_json(l,f,n,u,h,r);var a=m[0],s=m[1];if(m[3])throw a=0,s=0,y(m[2]);return i=a,_=s,p(a,s)}finally{o.__wbindgen_free(i,_,1);}}function k(){return {__proto__:null,"./docx_layout_bg.js":{__proto__:null,__wbg_error_25e7706a73a81f28:function(n,t){console.error(p(n,t));},__wbindgen_cast_0000000000000001:function(n,t){return p(n,t)},__wbindgen_init_externref_table:function(){let n=o.__wbindgen_externrefs,t=n.grow(4);n.set(0,void 0),n.set(t+0,void 0),n.set(t+1,null),n.set(t+2,true),n.set(t+3,false);}}}}function p(e,n){return oe(e>>>0,n)}var x=null;function v(){return (x===null||x.byteLength===0)&&(x=new Uint8Array(o.memory.buffer)),x}function te(e,n){let t=n(e.length*1,1)>>>0;return v().set(e,t/1),d=e.length,t}function g(e,n,t){if(t===void 0){let s=R.encode(e),l=n(s.length,1)>>>0;return v().subarray(l,l+s.length).set(s),d=s.length,l}let r=e.length,i=n(r,1)>>>0,_=v(),a=0;for(;a<r;a++){let s=e.charCodeAt(a);if(s>127)break;_[i+a]=s;}if(a!==r){a!==0&&(e=e.slice(a)),i=t(i,r,r=a+e.length*3,1)>>>0;let s=v().subarray(i+a,i+r),l=R.encodeInto(e,s);a+=l.written,i=t(i,r,a,1)>>>0;}return d=a,i}function y(e){let n=o.__wbindgen_externrefs.get(e);return o.__externref_table_dealloc(e),n}var j=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true});j.decode();var re=2146435072,L=0;function oe(e,n){return L+=n,L>=re&&(j=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}),j.decode(),L=n),j.decode(v().subarray(e,e+n))}var R=new TextEncoder;"encodeInto"in R||(R.encodeInto=function(e,n){let t=R.encode(e);return n.set(t),{read:e.length,written:t.length}});var d=0,o;function q(e,n){return o=e.exports,x=null,o.__wbindgen_start(),o}async function ae(e,n){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,n)}catch(i){if(e.ok&&t(e.type)&&e.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",i);else throw i}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,n)}else {let r=await WebAssembly.instantiate(e,n);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}function t(r){switch(r){case "basic":case "cors":case "default":return true}return false}}function H(e){if(o!==void 0)return o;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let n=k();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let t=new WebAssembly.Instance(e,n);return q(t)}async function J(e){if(o!==void 0)return o;if(e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),e===void 0)throw new Error("docx-layout wasm requires an explicit module or URL");let n=k();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:t,module:r}=await ae(await e,n);return q(t)}var c=a$1({label:"docx-layout",preloadName:"preloadLayoutWasm",assetUrl:()=>new URL("./generated/layout/docx_layout_bg.wasm",import.meta.url),initAsync:J,initSync:H});function de(e){return c.preload(e)}function fe(e,n,t,r){return c.ensure(),M(e,n,t,r)}function ge(e,n,t){return c.ensure(),B(e,n,t)}function b(e){let n=S[e];return typeof n=="function"?n:void 0}function ye(){return c.ensure(),b("open_display_list")!==void 0}function pe(){return c.ensure(),b("range_rects_region_json")!==void 0}function be(e){c.ensure();let n=b("open_display_list");if(!n)throw new Error("open_display_list is not available in the embedded layout wasm yet");return n(e)}function me(e){c.ensure(),b("close_display_list")?.(e);}function we(e,n){c.ensure();let t=b("update_display_list");if(!t)throw new Error("update_display_list is not available in the embedded layout wasm yet");t(e,n);}function he(){return c.ensure(),b("update_display_list")!==void 0}function xe(e,n,t,r){c.ensure();let i=b("hit_test_regions_by_handle");if(!i)throw new Error("hit_test_regions_by_handle is not available in the embedded layout wasm yet");return i(e,n,t,r)}function ve(e,n,t,r){c.ensure();let i=b("vertical_move_json");if(!i)throw new Error("vertical_move_json is not available in the embedded layout wasm");return i(e,n,t,r)}function Re(e,n,t,r){c.ensure();let i=b("vertical_move_by_handle");if(!i)throw new Error("vertical_move_by_handle is not available in the embedded layout wasm");return i(e,n,t,r)}function Ee(e,n,t){c.ensure();let r=b("range_rects_by_handle");if(!r)throw new Error("range_rects_by_handle is not available in the embedded layout wasm yet");return r(e,n,t)}function je(e,n,t,r,i){c.ensure();let _=b("range_rects_region_json");if(!_)throw new Error("range_rects_region_json is not available in the embedded layout wasm yet");return _(e,n,t,r,i)}function Le(e,n,t,r,i){c.ensure();let _=b("range_rects_region_by_handle");if(!_)throw new Error("range_rects_region_by_handle is not available in the embedded layout wasm yet");return _(e,n,t,r,i)}function Ae(e){return c.ensure(),A(e)}function De(e){return c.ensure(),T(e)}function Me(e){return c.ensure(),I(e)}function Te(){c.ensure(),D();}function We(e){return c.ensure(),W(e)}function _e(){let e=O;return typeof e=="function"?e:void 0}function Oe(e,n){c.ensure();let t=_e();if(!t)throw new Error("outline_glyph_json is not available in the embedded layout wasm yet");return t(e,n)}export{de as a,fe as b,ge as c,ye as d,pe as e,be as f,me as g,we as h,he as i,xe as j,ve as k,Re as l,Ee as m,je as n,Le as o,Ae as p,De as q,Me as r,Te as s,We as t,Oe as u};
1
+ import {a as a$1}from'./chunk-5F6DLQZP.mjs';import {a}from'./chunk-TTRUPDAB.mjs';var S={};a(S,{build_display_list_json:()=>A,clear_measure_fonts:()=>D,close_display_list:()=>P,default:()=>J,hit_test_json:()=>X,hit_test_regions_by_handle:()=>z,hit_test_regions_json:()=>M,initSync:()=>H,install_panic_hook:()=>N,layout_document_json:()=>T,measure_paragraph_json:()=>W,open_display_list:()=>Y,outline_glyph_json:()=>O,range_rects_by_handle:()=>K,range_rects_json:()=>B,range_rects_region_by_handle:()=>Q,range_rects_region_json:()=>Z,register_measure_font:()=>I,update_display_list:()=>$,vertical_move_by_handle:()=>ee,vertical_move_json:()=>ne});function A(e){let n,t;try{let _=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=d,s=o.build_display_list_json(_,a);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,y(s[2]);return n=r,t=i,p(r,i)}finally{o.__wbindgen_free(n,t,1);}}function D(){o.clear_measure_fonts();}function P(e){o.close_display_list(e);}function X(e,n,t,r){let i,_;try{let l=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),f=d,u=o.hit_test_json(l,f,n,t,r);var a=u[0],s=u[1];if(u[3])throw a=0,s=0,y(u[2]);return i=a,_=s,p(a,s)}finally{o.__wbindgen_free(i,_,1);}}function z(e,n,t,r){let i,_;try{let l=o.hit_test_regions_by_handle(e,n,t,r);var a=l[0],s=l[1];if(l[3])throw a=0,s=0,y(l[2]);return i=a,_=s,p(a,s)}finally{o.__wbindgen_free(i,_,1);}}function M(e,n,t,r){let i,_;try{let l=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),f=d,u=o.hit_test_regions_json(l,f,n,t,r);var a=u[0],s=u[1];if(u[3])throw a=0,s=0,y(u[2]);return i=a,_=s,p(a,s)}finally{o.__wbindgen_free(i,_,1);}}function N(){o.install_panic_hook();}function T(e){let n,t;try{let _=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=d,s=o.layout_document_json(_,a);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,y(s[2]);return n=r,t=i,p(r,i)}finally{o.__wbindgen_free(n,t,1);}}function W(e){let n,t;try{let _=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=d,s=o.measure_paragraph_json(_,a);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,y(s[2]);return n=r,t=i,p(r,i)}finally{o.__wbindgen_free(n,t,1);}}function Y(e){let n=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),t=d,r=o.open_display_list(n,t);if(r[2])throw y(r[1]);return r[0]>>>0}function O(e,n){let t,r;try{let a=o.outline_glyph_json(e,n);var i=a[0],_=a[1];if(a[3])throw i=0,_=0,y(a[2]);return t=i,r=_,p(i,_)}finally{o.__wbindgen_free(t,r,1);}}function K(e,n,t){let r,i;try{let s=o.range_rects_by_handle(e,n,t);var _=s[0],a=s[1];if(s[3])throw _=0,a=0,y(s[2]);return r=_,i=a,p(_,a)}finally{o.__wbindgen_free(r,i,1);}}function B(e,n,t){let r,i;try{let s=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),l=d,f=o.range_rects_json(s,l,n,t);var _=f[0],a=f[1];if(f[3])throw _=0,a=0,y(f[2]);return r=_,i=a,p(_,a)}finally{o.__wbindgen_free(r,i,1);}}function Q(e,n,t,r,i){let _,a;try{let f=g(n,o.__wbindgen_malloc,o.__wbindgen_realloc),u=d,h=g(t,o.__wbindgen_malloc,o.__wbindgen_realloc),m=d,w=o.range_rects_region_by_handle(e,f,u,h,m,r,i);var s=w[0],l=w[1];if(w[3])throw s=0,l=0,y(w[2]);return _=s,a=l,p(s,l)}finally{o.__wbindgen_free(_,a,1);}}function Z(e,n,t,r,i){let _,a;try{let f=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=d,h=g(n,o.__wbindgen_malloc,o.__wbindgen_realloc),m=d,w=g(t,o.__wbindgen_malloc,o.__wbindgen_realloc),F=d,E=o.range_rects_region_json(f,u,h,m,w,F,r,i);var s=E[0],l=E[1];if(E[3])throw s=0,l=0,y(E[2]);return _=s,a=l,p(s,l)}finally{o.__wbindgen_free(_,a,1);}}function I(e){let n=te(e,o.__wbindgen_malloc),t=d,r=o.register_measure_font(n,t);if(r[2])throw y(r[1]);return r[0]>>>0}function $(e,n){let t=g(n,o.__wbindgen_malloc,o.__wbindgen_realloc),r=d,i=o.update_display_list(e,t,r);if(i[1])throw y(i[0])}function ee(e,n,t,r){let i,_;try{let l=g(t,o.__wbindgen_malloc,o.__wbindgen_realloc),f=d,u=o.vertical_move_by_handle(e,n,l,f,r);var a=u[0],s=u[1];if(u[3])throw a=0,s=0,y(u[2]);return i=a,_=s,p(a,s)}finally{o.__wbindgen_free(i,_,1);}}function ne(e,n,t,r){let i,_;try{let l=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),f=d,u=g(t,o.__wbindgen_malloc,o.__wbindgen_realloc),h=d,m=o.vertical_move_json(l,f,n,u,h,r);var a=m[0],s=m[1];if(m[3])throw a=0,s=0,y(m[2]);return i=a,_=s,p(a,s)}finally{o.__wbindgen_free(i,_,1);}}function k(){return {__proto__:null,"./docx_layout_bg.js":{__proto__:null,__wbg_error_8a5a9c39466377c9:function(n,t){console.error(p(n,t));},__wbindgen_cast_0000000000000001:function(n,t){return p(n,t)},__wbindgen_init_externref_table:function(){let n=o.__wbindgen_externrefs,t=n.grow(4);n.set(0,void 0),n.set(t+0,void 0),n.set(t+1,null),n.set(t+2,true),n.set(t+3,false);}}}}function p(e,n){return oe(e>>>0,n)}var x=null;function v(){return (x===null||x.byteLength===0)&&(x=new Uint8Array(o.memory.buffer)),x}function te(e,n){let t=n(e.length*1,1)>>>0;return v().set(e,t/1),d=e.length,t}function g(e,n,t){if(t===void 0){let s=R.encode(e),l=n(s.length,1)>>>0;return v().subarray(l,l+s.length).set(s),d=s.length,l}let r=e.length,i=n(r,1)>>>0,_=v(),a=0;for(;a<r;a++){let s=e.charCodeAt(a);if(s>127)break;_[i+a]=s;}if(a!==r){a!==0&&(e=e.slice(a)),i=t(i,r,r=a+e.length*3,1)>>>0;let s=v().subarray(i+a,i+r),l=R.encodeInto(e,s);a+=l.written,i=t(i,r,a,1)>>>0;}return d=a,i}function y(e){let n=o.__wbindgen_externrefs.get(e);return o.__externref_table_dealloc(e),n}var j=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true});j.decode();var re=2146435072,L=0;function oe(e,n){return L+=n,L>=re&&(j=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}),j.decode(),L=n),j.decode(v().subarray(e,e+n))}var R=new TextEncoder;"encodeInto"in R||(R.encodeInto=function(e,n){let t=R.encode(e);return n.set(t),{read:e.length,written:t.length}});var d=0,o;function q(e,n){return o=e.exports,x=null,o.__wbindgen_start(),o}async function ae(e,n){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,n)}catch(i){if(e.ok&&t(e.type)&&e.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",i);else throw i}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,n)}else {let r=await WebAssembly.instantiate(e,n);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}function t(r){switch(r){case "basic":case "cors":case "default":return true}return false}}function H(e){if(o!==void 0)return o;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let n=k();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let t=new WebAssembly.Instance(e,n);return q(t)}async function J(e){if(o!==void 0)return o;if(e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),e===void 0)throw new Error("docx-layout requires an explicit module or URL");let n=k();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:t,module:r}=await ae(await e,n);return q(t)}var c=a$1({label:"docx-layout",preloadName:"preloadLayoutWasm",assetUrl:()=>new URL("./generated/layout/docx_layout_bg.wasm",import.meta.url),initAsync:J,initSync:H});function de(e){return c.preload(e)}function fe(e,n,t,r){return c.ensure(),M(e,n,t,r)}function ge(e,n,t){return c.ensure(),B(e,n,t)}function b(e){let n=S[e];return typeof n=="function"?n:void 0}function ye(){return c.ensure(),b("open_display_list")!==void 0}function pe(){return c.ensure(),b("range_rects_region_json")!==void 0}function be(e){c.ensure();let n=b("open_display_list");if(!n)throw new Error("open_display_list is not available in the embedded layout wasm yet");return n(e)}function me(e){c.ensure(),b("close_display_list")?.(e);}function we(e,n){c.ensure();let t=b("update_display_list");if(!t)throw new Error("update_display_list is not available in the embedded layout wasm yet");t(e,n);}function he(){return c.ensure(),b("update_display_list")!==void 0}function xe(e,n,t,r){c.ensure();let i=b("hit_test_regions_by_handle");if(!i)throw new Error("hit_test_regions_by_handle is not available in the embedded layout wasm yet");return i(e,n,t,r)}function ve(e,n,t,r){c.ensure();let i=b("vertical_move_json");if(!i)throw new Error("vertical_move_json is not available in the embedded layout wasm");return i(e,n,t,r)}function Re(e,n,t,r){c.ensure();let i=b("vertical_move_by_handle");if(!i)throw new Error("vertical_move_by_handle is not available in the embedded layout wasm");return i(e,n,t,r)}function Ee(e,n,t){c.ensure();let r=b("range_rects_by_handle");if(!r)throw new Error("range_rects_by_handle is not available in the embedded layout wasm yet");return r(e,n,t)}function je(e,n,t,r,i){c.ensure();let _=b("range_rects_region_json");if(!_)throw new Error("range_rects_region_json is not available in the embedded layout wasm yet");return _(e,n,t,r,i)}function Le(e,n,t,r,i){c.ensure();let _=b("range_rects_region_by_handle");if(!_)throw new Error("range_rects_region_by_handle is not available in the embedded layout wasm yet");return _(e,n,t,r,i)}function Ae(e){return c.ensure(),A(e)}function De(e){return c.ensure(),T(e)}function Me(e){return c.ensure(),I(e)}function Te(){c.ensure(),D();}function We(e){return c.ensure(),W(e)}function _e(){let e=O;return typeof e=="function"?e:void 0}function Oe(e,n){c.ensure();let t=_e();if(!t)throw new Error("outline_glyph_json is not available in the embedded layout wasm yet");return t(e,n)}export{de as a,fe as b,ge as c,ye as d,pe as e,be as f,me as g,we as h,he as i,xe as j,ve as k,Re as l,Ee as m,je as n,Le as o,Ae as p,De as q,Me as r,Te as s,We as t,Oe as u};
@@ -1,11 +1,11 @@
1
- import { C as CollaborationReplica, b as CollaborationTransport, c as CollaborationProviderOptions, d as CollaborationStatus, e as CollaborationPeer, f as CollaborationCursor, g as CollaborationPeerListener, h as CollaborationStatusListener, i as CollaborationErrorListener, j as YrsSelection, Y as YrsSession } from '../index-2piKi4gO.mjs';
2
- export { k as CollaborationAwarenessState, l as CollaborationError, m as CollaborationErrorCode, n as CollaborationPresence, o as CollaborationResolvedUser, p as CollaborationStatusChange, q as CollaborationTextInsertion, r as CollaborationTransportEvent, s as CollaborationUpdateOrigin, t as CollaborationUser } from '../index-2piKi4gO.mjs';
1
+ import { C as CollaborationReplica, b as CollaborationTransport, c as CollaborationProviderOptions, d as CollaborationStatus, e as CollaborationPeer, f as CollaborationCursor, g as CollaborationPeerListener, h as CollaborationStatusListener, i as CollaborationErrorListener, j as YrsSelection, Y as YrsSession } from '../index-ImoMd0Ju.mjs';
2
+ export { k as CollaborationAwarenessState, l as CollaborationError, m as CollaborationErrorCode, n as CollaborationPresence, o as CollaborationResolvedUser, p as CollaborationStatusChange, q as CollaborationTextInsertion, r as CollaborationTransportEvent, s as CollaborationUpdateOrigin, t as CollaborationUser } from '../index-ImoMd0Ju.mjs';
3
3
  import '../types/document.mjs';
4
- import '../content-C3sTRz-u.mjs';
5
- import '../formatting-BEkIBePP.mjs';
4
+ import '../content-DrqzbIr7.mjs';
5
+ import '../formatting-BqrFPeev.mjs';
6
6
  import '../docx/wrapTypes.mjs';
7
- import '../styles-BK3Jecxs.mjs';
8
- import '../frameDelta-B2kC6XiP.mjs';
7
+ import '../styles-CMybYYHS.mjs';
8
+ import '../frameDelta-DMgR8n13.mjs';
9
9
 
10
10
  declare class CollaborationProvider {
11
11
  private readonly replica;
@@ -1,4 +1,4 @@
1
- import { C as ColorValue, y as ThemeColorSlot, a as ParagraphFormatting, b as TextFormatting, c as TableFormatting, d as TableRowFormatting, e as TableCellFormatting, B as BorderSpec, m as ShapeType, k as ShapeFill, l as ShapeOutline, D as ShapeTextBody$1, P as PresetGeometryPathCommand } from './formatting-BEkIBePP.mjs';
1
+ import { C as ColorValue, y as ThemeColorSlot, a as ParagraphFormatting, b as TextFormatting, c as TableFormatting, d as TableRowFormatting, e as TableCellFormatting, B as BorderSpec, m as ShapeType, k as ShapeFill, l as ShapeOutline, D as ShapeTextBody$1, P as PresetGeometryPathCommand } from './formatting-BqrFPeev.mjs';
2
2
  import { WrapType } from './docx/wrapTypes.mjs';
3
3
 
4
4
  interface ShapeFillPaint {
@@ -369,8 +369,8 @@ interface Table {
369
369
  * file, scaled, optionally "washed out" (lightened).
370
370
  *
371
371
  * We model the watermark as a dedicated field on the owning `HeaderFooter`
372
- * rather than as editable run content, so it stays out of the ProseMirror text
373
- * flow while still round-tripping through parse → render → serialize.
372
+ * rather than as editable run content, so it stays out of the text flow while
373
+ * still round-tripping through parse → render → serialize.
374
374
  */
375
375
  /**
376
376
  * Text watermark (e.g. "CONFIDENTIAL", "DRAFT").
@@ -540,16 +540,7 @@ interface Footnote {
540
540
  * and stays editable on round-trip.
541
541
  */
542
542
  content: BlockContent[];
543
- /**
544
- * Verbatim original XML of the entire `<w:footnote>` element, captured at
545
- * parse time ONLY when the note body carries a block-level construct the
546
- * model still can't represent — note-level bookmarks
547
- * (`w:bookmarkStart`/`w:bookmarkEnd`) or `w:customXml`. Block-level `w:sdt`
548
- * is NOT a trigger: it round-trips through the model as `BlockSdt`. When
549
- * present the serializer re-emits these bytes instead of rebuilding from
550
- * `content`, restoring pre-#646 fidelity for the unmodeled constructs.
551
- * See `parseNoteBlockContent` / `serializeNote` for the gate (#646 F3).
552
- */
543
+ /** Verbatim note XML for unmodeled bookmarks or custom XML. */
553
544
  verbatimXml?: string;
554
545
  }
555
546
  /**
@@ -567,7 +558,7 @@ interface Endnote {
567
558
  * on `Footnote.content`.
568
559
  */
569
560
  content: BlockContent[];
570
- /** Verbatim original XML — see `Footnote.verbatimXml` (#646 F3). */
561
+ /** Verbatim note XML for unmodeled blocks. */
571
562
  verbatimXml?: string;
572
563
  }
573
564
 
@@ -1212,9 +1203,9 @@ interface TrackedChangeInfo {
1212
1203
  date?: string;
1213
1204
  }
1214
1205
  /**
1215
- * Tracked-change attribute triple as it appears on PM node attrs
1206
+ * Tracked-change attribute triple as it appears on node attrs
1216
1207
  * (`paragraph.pPrIns`, `tableRow.trIns`, etc). Mirrors `TrackedChangeInfo`
1217
- * but with a `null` date (PM attr defaults) and a `revisionId` name that
1208
+ * but with a `null` date (attr defaults) and a `revisionId` name that
1218
1209
  * matches OOXML's `w:id` more idiomatically on the editor side.
1219
1210
  *
1220
1211
  * Round-trip pairs with `TrackedChangeInfo` via
@@ -1227,7 +1218,7 @@ interface RevisionInfo {
1227
1218
  }
1228
1219
  /**
1229
1220
  * Tracked-cell marker — the OOXML `<w:cellIns>` / `<w:cellDel>` /
1230
- * `<w:cellMerge>` shape attached to a `TableCell` PM node and surfaced
1221
+ * `<w:cellMerge>` shape attached to a `TableCell` node and surfaced
1231
1222
  * to the layout model and painter for visual rendering.
1232
1223
  *
1233
1224
  * `kind` matches the OOXML element name (ins / del / merge).
@@ -1977,6 +1968,35 @@ interface ChartPoint {
1977
1968
  };
1978
1969
  label?: string;
1979
1970
  }
1971
+ /** Run properties from a `c:txPr`; unset fields inherit from the chart. */
1972
+ interface ChartTextProperties {
1973
+ font?: string;
1974
+ sizePt?: number;
1975
+ bold?: boolean;
1976
+ italic?: boolean;
1977
+ color?: string;
1978
+ }
1979
+ /** One `c:dLbl`: an index plus the switches it overrides. */
1980
+ interface ChartPointLabel {
1981
+ index?: number;
1982
+ text?: string;
1983
+ labels: ChartDataLabels;
1984
+ }
1985
+ /** A `c:dLbls`; every switch is optional so an unset one inherits. */
1986
+ interface ChartDataLabels {
1987
+ delete?: boolean;
1988
+ showValue?: boolean;
1989
+ showCategoryName?: boolean;
1990
+ showSeriesName?: boolean;
1991
+ showPercent?: boolean;
1992
+ showLegendKey?: boolean;
1993
+ showBubbleSize?: boolean;
1994
+ separator?: string;
1995
+ position?: string;
1996
+ numberFormat?: string;
1997
+ text?: ChartTextProperties;
1998
+ points?: ChartPointLabel[];
1999
+ }
1980
2000
  interface ChartSeries {
1981
2001
  name?: string;
1982
2002
  categories: string[];
@@ -1995,6 +2015,11 @@ interface ChartSeries {
1995
2015
  color?: string;
1996
2016
  };
1997
2017
  smooth?: boolean;
2018
+ /** `c:xVal` of a scatter or bubble series. */
2019
+ xValues?: number[];
2020
+ /** `c:bubbleSize` of a bubble series. */
2021
+ bubbleSizes?: number[];
2022
+ dataLabels?: ChartDataLabels;
1998
2023
  }
1999
2024
  interface ChartAxis {
2000
2025
  id?: string;
@@ -2016,6 +2041,9 @@ interface ChartAxis {
2016
2041
  minorTickMark?: string;
2017
2042
  tickLabelPosition?: string;
2018
2043
  hidden?: boolean;
2044
+ majorGridlines?: boolean;
2045
+ minorGridlines?: boolean;
2046
+ text?: ChartTextProperties;
2019
2047
  }
2020
2048
  /** One chart-family element inside `c:plotArea`. */
2021
2049
  interface ChartPlotGroup {
@@ -2029,10 +2057,27 @@ interface ChartPlotGroup {
2029
2057
  firstSliceAngle?: number;
2030
2058
  holeSize?: number;
2031
2059
  showDataLabels?: boolean;
2060
+ /** `c:scatterStyle`. */
2061
+ scatterStyle?: 'none' | 'line' | 'lineMarker' | 'marker' | 'smooth' | 'smoothMarker';
2062
+ /** `c:radarStyle`. */
2063
+ radarStyle?: 'standard' | 'marker' | 'filled';
2064
+ /** `c:bubbleScale`, a percentage of the default bubble size. */
2065
+ bubbleScale?: number;
2066
+ /** `c:sizeRepresents`. */
2067
+ sizeRepresents?: 'area' | 'w';
2068
+ /** `c:wireframe` of a surface chart. */
2069
+ wireframe?: boolean;
2070
+ hiLowLines?: boolean;
2071
+ upDownBars?: boolean;
2072
+ /** `c:marker` of a line chart, which switches every series marker off. */
2073
+ marker?: boolean;
2074
+ dataLabels?: ChartDataLabels;
2032
2075
  }
2033
2076
  interface ChartLegend {
2034
2077
  position?: 'left' | 'right' | 'top' | 'bottom';
2035
2078
  visible?: boolean;
2079
+ /** `c:txPr` on the legend; unset fields inherit from the chart. */
2080
+ text?: ChartTextProperties;
2036
2081
  }
2037
2082
  interface Chart {
2038
2083
  type: 'chart';
@@ -2064,6 +2109,10 @@ interface Chart {
2064
2109
  decorative?: boolean;
2065
2110
  /** Stable z-order for anchored charts. Undefined = source order. */
2066
2111
  relativeHeight?: number;
2112
+ /** `c:txPr` on `c:chartSpace`: the root of chart text inheritance. */
2113
+ text?: ChartTextProperties;
2114
+ /** `c:txPr` on `c:title`. */
2115
+ titleText?: ChartTextProperties;
2067
2116
  }
2068
2117
 
2069
- export { type FooterReference as $, type AbstractNumbering as A, type BlockContent as B, type CellMarker as C, type DrawingScene as D, type EndnoteProperties as E, type FootnoteProperties as F, type CommentRangeEnd as G, type HeaderFooter as H, type CommentRangeStart as I, type CommentReferenceContent as J, type ComplexField as K, type ContentPosition as L, DEFAULT_WATERMARK_PRESETS as M, type NoteKind as N, type Deletion as O, type Paragraph as P, type DrawingContent as Q, type RevisionInfo as R, type SectionProperties as S, type DrawingSceneNode as T, type EndnotePosition as U, type Field as V, type Watermark as W, type FieldCharContent as X, type FieldFormData as Y, type FieldInlineContent as Z, type FieldType as _, type SdtControlState as a, type SymbolContent as a$, type FootnotePosition as a0, type HeaderFooterType as a1, type HeaderReference as a2, type Hyperlink as a3, type HyperlinkContent as a4, type Image as a5, type ImageCrop as a6, type ImageEffect as a7, type ImageHyperlink as a8, type ImagePadding as a9, type NumberingInstance as aA, type PageNumberingProperties as aB, type PageOrientation as aC, type ParagraphContent as aD, type ParagraphPropertyChange as aE, type PictureWatermark as aF, type PropertyChangeInfo as aG, type Run as aH, type RunContent as aI, type RunPropertyChange as aJ, type SdtCheckboxGlyph as aK, type SdtDataBinding as aL, type SdtDateState as aM, type SdtGalleryState as aN, type SdtType as aO, type Section as aP, type SectionStart as aQ, type SeparatorContent as aR, type Shape as aS, type ShapeContent as aT, type ShapeFillPaint as aU, type ShapeStrokePaint as aV, type ShapeTextBody as aW, type SimpleField as aX, type SoftHyphenContent as aY, type StructuredFieldContent as aZ, type StructuredFieldTree as a_, type ImagePosition as aa, type ImageRotationBounds as ab, type ImageSize as ac, type ImageTransform as ad, type ImageWrap as ae, type ImageWrapPoint as af, type InlineSdt as ag, type Insertion as ah, type InstrTextContent as ai, type LevelSuffix as aj, type LineNumberRestart as ak, type ListLevel as al, type ListRendering as am, type MathEquation as an, type MoveFrom as ao, type MoveFromRangeEnd as ap, type MoveFromRangeStart as aq, type MoveTo as ar, type MoveToRangeEnd as as, type MoveToRangeStart as at, type NoBreakHyphenContent as au, type NoteNumberRestart as av, type NoteRefMarkContent as aw, type NoteReferenceContent as ax, type NoteSeparatorReference as ay, type NumberFormat as az, type SdtProperties as b, type TabContent as b0, type Table as b1, type TableCell as b2, type TableCellPropertyChange as b3, type TablePropertyChange as b4, type TableRow as b5, type TableRowPropertyChange as b6, type TableStructuralChangeInfo as b7, type TextBox as b8, type TextContent as b9, type TextWatermark as ba, type TrackedChangeInfo as bb, type TrackedRunChange as bc, type VerticalAlign as bd, pictureWatermarkDisplayEmu as be, type ShapeEffect as c, type ShapeTextBodyProperties as d, type Chart as e, type Comment as f, type DocumentBody as g, type NumberingDefinitions as h, type Footnote as i, type Endnote as j, type BookmarkRange as k, type BlockSdt as l, type BookmarkEnd as m, type BookmarkStart as n, type BreakContent as o, type ChartAxis as p, type ChartContent as q, type ChartGrouping as r, type ChartLegend as s, type ChartPlotGroup as t, type ChartPoint as u, type ChartSeries as v, type ChartType as w, type Column as x, type CommentAnchorRange as y, type CommentAuthor as z };
2118
+ export { type FieldInlineContent as $, type AbstractNumbering as A, type BlockContent as B, type CellMarker as C, type DrawingScene as D, type EndnoteProperties as E, type FootnoteProperties as F, type CommentAnchorRange as G, type HeaderFooter as H, type CommentAuthor as I, type CommentRangeEnd as J, type CommentRangeStart as K, type CommentReferenceContent as L, type ComplexField as M, type NoteKind as N, type ContentPosition as O, type Paragraph as P, DEFAULT_WATERMARK_PRESETS as Q, type RevisionInfo as R, type SectionProperties as S, type Deletion as T, type DrawingContent as U, type DrawingSceneNode as V, type Watermark as W, type EndnotePosition as X, type Field as Y, type FieldCharContent as Z, type FieldFormData as _, type SdtControlState as a, type StructuredFieldContent as a$, type FieldType as a0, type FooterReference as a1, type FootnotePosition as a2, type HeaderFooterType as a3, type HeaderReference as a4, type Hyperlink as a5, type HyperlinkContent as a6, type Image as a7, type ImageCrop as a8, type ImageEffect as a9, type NoteSeparatorReference as aA, type NumberFormat as aB, type NumberingInstance as aC, type PageNumberingProperties as aD, type PageOrientation as aE, type ParagraphContent as aF, type ParagraphPropertyChange as aG, type PictureWatermark as aH, type PropertyChangeInfo as aI, type Run as aJ, type RunContent as aK, type RunPropertyChange as aL, type SdtCheckboxGlyph as aM, type SdtDataBinding as aN, type SdtDateState as aO, type SdtGalleryState as aP, type SdtType as aQ, type Section as aR, type SectionStart as aS, type SeparatorContent as aT, type Shape as aU, type ShapeContent as aV, type ShapeFillPaint as aW, type ShapeStrokePaint as aX, type ShapeTextBody as aY, type SimpleField as aZ, type SoftHyphenContent as a_, type ImageHyperlink as aa, type ImagePadding as ab, type ImagePosition as ac, type ImageRotationBounds as ad, type ImageSize as ae, type ImageTransform as af, type ImageWrap as ag, type ImageWrapPoint as ah, type InlineSdt as ai, type Insertion as aj, type InstrTextContent as ak, type LevelSuffix as al, type LineNumberRestart as am, type ListLevel as an, type ListRendering as ao, type MathEquation as ap, type MoveFrom as aq, type MoveFromRangeEnd as ar, type MoveFromRangeStart as as, type MoveTo as at, type MoveToRangeEnd as au, type MoveToRangeStart as av, type NoBreakHyphenContent as aw, type NoteNumberRestart as ax, type NoteRefMarkContent as ay, type NoteReferenceContent as az, type SdtProperties as b, type StructuredFieldTree as b0, type SymbolContent as b1, type TabContent as b2, type Table as b3, type TableCell as b4, type TableCellPropertyChange as b5, type TablePropertyChange as b6, type TableRow as b7, type TableRowPropertyChange as b8, type TableStructuralChangeInfo as b9, type TextBox as ba, type TextContent as bb, type TextWatermark as bc, type TrackedChangeInfo as bd, type TrackedRunChange as be, type VerticalAlign as bf, pictureWatermarkDisplayEmu as bg, type ShapeEffect as c, type ShapeTextBodyProperties as d, type Chart as e, type Comment as f, type DocumentBody as g, type NumberingDefinitions as h, type Footnote as i, type Endnote as j, type BookmarkRange as k, type BlockSdt as l, type BookmarkEnd as m, type BookmarkStart as n, type BreakContent as o, type ChartAxis as p, type ChartContent as q, type ChartDataLabels as r, type ChartGrouping as s, type ChartLegend as t, type ChartPlotGroup as u, type ChartPoint as v, type ChartPointLabel as w, type ChartSeries as x, type ChartType as y, type Column as z };
package/dist/core.d.mts CHANGED
@@ -1,15 +1,15 @@
1
- export { a as attemptSelectiveSave, c as createDocx, p as parseDocx, r as repackDocx, u as updateMultipleFiles } from './selectiveSave-CVoajSKE.mjs';
1
+ export { a as attemptSelectiveSave, c as createDocx, p as parseDocx, r as repackDocx, u as updateMultipleFiles } from './selectiveSave-CRh-_Y_C.mjs';
2
2
  import { Document } from './types/document.mjs';
3
3
  export { DocxPackage } from './types/document.mjs';
4
- import { g as DocumentBody, S as SectionProperties, b1 as Table } from './content-C3sTRz-u.mjs';
5
- export { B as BlockContent, m as BookmarkEnd, n as BookmarkStart, f as Comment, G as CommentRangeEnd, I as CommentRangeStart, O as Deletion, j as Endnote, V as Field, $ as FooterReference, i as Footnote, H as HeaderFooter, a2 as HeaderReference, a3 as Hyperlink, a5 as Image, ah as Insertion, al as ListLevel, ao as MoveFrom, ar as MoveTo, h as NumberingDefinitions, P as Paragraph, aD as ParagraphContent, aH as Run, aI as RunContent, aS as Shape, b2 as TableCell, b5 as TableRow, b8 as TextBox, b9 as TextContent, bb as TrackedChangeInfo, bc as TrackedRunChange } from './content-C3sTRz-u.mjs';
4
+ import { g as DocumentBody, S as SectionProperties, b3 as Table } from './content-DrqzbIr7.mjs';
5
+ export { B as BlockContent, m as BookmarkEnd, n as BookmarkStart, f as Comment, J as CommentRangeEnd, K as CommentRangeStart, T as Deletion, j as Endnote, Y as Field, a1 as FooterReference, i as Footnote, H as HeaderFooter, a4 as HeaderReference, a5 as Hyperlink, a7 as Image, aj as Insertion, an as ListLevel, aq as MoveFrom, at as MoveTo, h as NumberingDefinitions, P as Paragraph, aF as ParagraphContent, aJ as Run, aK as RunContent, aU as Shape, b4 as TableCell, b7 as TableRow, ba as TextBox, bb as TextContent, bd as TrackedChangeInfo, be as TrackedRunChange } from './content-DrqzbIr7.mjs';
6
6
  export { emuToPixels, emuToTwips, formatPx, halfPointsToPixels, pixelsToEmu, pixelsToTwips, pointsToPixels, twipsToEmu, twipsToPixels } from './utils/units.mjs';
7
- export { T as ThemeMatrixCell, b as blendColors, c as canRenderFont, a as colorsEqual, d as createRgbColor, e as createThemeColor, f as darkenColor, g as ensureHexPrefix, h as generateThemeTintShadeMatrix, i as getContrastingColor, j as getLoadedFonts, k as getThemeTintShadeHex, l as isBlack, m as isFontLoaded, n as isFontsLoading, o as isGoogleFontsEnabled, p as isWhite, q as lightenColor, r as loadFont, s as loadFontFromBuffer, t as loadFonts, u as onFontsLoaded, v as parseColorString, w as preloadCommonFonts, x as resolveColor, y as resolveHighlightColor, z as resolveHighlightToCss, A as resolveShadingColor, B as setGoogleFontsEnabled } from './fontLoader-CMH3bZ2Z.mjs';
7
+ export { T as ThemeMatrixCell, b as blendColors, c as canRenderFont, a as colorsEqual, d as createRgbColor, e as createThemeColor, f as darkenColor, g as ensureHexPrefix, h as generateThemeTintShadeMatrix, i as getContrastingColor, j as getLoadedFonts, k as getThemeTintShadeHex, l as isBlack, m as isFontLoaded, n as isFontsLoading, o as isGoogleFontsEnabled, p as isWhite, q as lightenColor, r as loadFont, s as loadFontFromBuffer, t as loadFonts, u as onFontsLoaded, v as parseColorString, w as preloadCommonFonts, x as resolveColor, y as resolveHighlightColor, z as resolveHighlightToCss, A as resolveShadingColor, B as setGoogleFontsEnabled } from './fontLoader-DnixuYST.mjs';
8
8
  export { D as DocxInput, t as toArrayBuffer } from './docxInput-DTbCa48g.mjs';
9
9
  export { EditorPluginCore, PanelConfig, PluginPanelProps, PositionCoordinates, RenderedDomContext } from './plugin-api/index.mjs';
10
- export { B as BlockExtent, F as FootnoteContent, a as Layout, L as LayoutBlock, P as Page, R as ResolvedLine, c as ResolvedSegment } from './types-C1rv3KM-.mjs';
11
- export { a as ParagraphFormatting, b as TextFormatting, f as Theme, x as ThemeColorScheme, z as ThemeFont, A as ThemeFontScheme } from './formatting-BEkIBePP.mjs';
12
- export { d as Relationship, a as Style, S as StyleDefinitions } from './styles-BK3Jecxs.mjs';
10
+ export { B as BlockExtent, F as FootnoteContent, a as Layout, L as LayoutBlock, P as Page, R as ResolvedLine, c as ResolvedSegment } from './types-CXLxVF1t.mjs';
11
+ export { a as ParagraphFormatting, b as TextFormatting, f as Theme, x as ThemeColorScheme, z as ThemeFont, A as ThemeFontScheme } from './formatting-BqrFPeev.mjs';
12
+ export { d as Relationship, a as Style, S as StyleDefinitions } from './styles-CMybYYHS.mjs';
13
13
  import './docx/wrapTypes.mjs';
14
14
 
15
15
  /**
package/dist/core.mjs CHANGED
@@ -1 +1 @@
1
- export{i as attemptSelectiveSave,h as createDocx,a as parseDocx,f as repackDocx,c as serializeDocumentBody,b as serializeDocx,d as serializeSectionProperties,g as updateMultipleFiles}from'./chunk-NTSSE5QK.mjs';export{f as blendColors,r as colorsEqual,o as createRgbColor,n as createThemeColor,d as darkenColor,p as ensureHexPrefix,h as generateThemeTintShadeMatrix,c as getContrastingColor,g as getThemeTintShadeHex,k as isBlack,l as isWhite,e as lightenColor,m as parseColorString,a as resolveColor,i as resolveHighlightColor,q as resolveHighlightToCss,j as resolveShadingColor}from'./chunk-LTVVQMHB.mjs';export{b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,c as pixelsToEmu,h as pixelsToTwips,d as pointsToPixels,j as twipsToEmu,g as twipsToPixels}from'./chunk-CTBUQRYQ.mjs';export{n as canRenderFont,k as getLoadedFonts,g as isFontLoaded,j as isFontsLoading,i as isGoogleFontsEnabled,e as loadFont,o as loadFontFromBuffer,f as loadFonts,l as onFontsLoaded,v as preloadCommonFonts,h as setGoogleFontsEnabled,a as toArrayBuffer}from'./chunk-YTILOUAA.mjs';import'./chunk-6KDV6AIL.mjs';import'./chunk-NJHOPXZW.mjs';import'./chunk-B4IR6YP4.mjs';import'./chunk-T4EZMUXM.mjs';import {b as b$1}from'./chunk-TTRUPDAB.mjs';var ce={includeHeaders:true,includeFooters:true,includePageNumbers:true,pageRange:null,scale:1,printBackground:true,margins:"default"};function me(){return {...ce}}function de(){typeof window<"u"&&window.print();}var fe="@media print { body { margin: 0; padding: 0; } @page { margin: 0; } }";function ge(t="Document",r){if(typeof window>"u")return null;let e=window.open("","_blank");if(!e)return null;e.opener=null;let n=e.document;n.title=t;let o=n.createElement("style");o.textContent=fe,n.head.appendChild(o);let i=new DOMParser().parseFromString(r,"text/html");for(let l of Array.from(i.body.childNodes))n.body.appendChild(n.importNode(l,true));return e}function he(t,r){if(!t||!t.trim())return null;let e=t.trim();if(/^\d+$/.test(e)){let o=parseInt(e,10);return o>=1&&o<=r?{start:o,end:o}:null}let n=e.match(/^(\d+)-(\d+)$/);if(n){let o=parseInt(n[1],10),i=parseInt(n[2],10);if(o>=1&&i<=r&&o<=i)return {start:o,end:i}}return null}function Te(t,r){return t?t.start===t.end?`Page ${t.start}`:`Pages ${t.start}-${t.end}`:`All (${r} pages)`}function be(){return typeof window<"u"&&typeof window.print=="function"}var s=class{constructor(r){b$1(this,"listeners",new Set);b$1(this,"snapshot");b$1(this,"subscribe",r=>(this.listeners.add(r),()=>{this.listeners.delete(r);}));b$1(this,"getSnapshot",()=>this.snapshot);this.snapshot=r;}setSnapshot(r){this.snapshot=r,this.notify();}notify(){for(let r of this.listeners)r();}};var c={TABLE_INDEX:"data-table-index",ROW_INDEX:"data-row",COLUMN_INDEX:"data-col",TABLE_CELL:"data-table-cell"};function g(t,r){if(!(t instanceof Element))return null;let e=t;for(;e&&e!==r;){if(e.tagName==="TD"||e.tagName==="TH"){let n=e.getAttribute(c.ROW_INDEX),o=e.getAttribute(c.COLUMN_INDEX);if(n!==null&&o!==null){let i=e;for(;i&&i!==r;){if(i.tagName==="TABLE"){let l=i.getAttribute(c.TABLE_INDEX);if(l!==null)return {tableIndex:parseInt(l,10),rowIndex:parseInt(n,10),columnIndex:parseInt(o,10)};break}i=i.parentElement;}}break}e=e.parentElement;}return null}function h(t,r){if(!t.package?.document?.content)return null;let e=0;for(let n of t.package.document.content)if(n.type==="table"){if(e===r)return n;e++;}return null}function T(t,r,e){if(!t.package?.document?.content)return t;let n=0,o=t.package.document.content.map(i=>{if(i.type==="table"){if(n===r)return n++,e;n++;}return i});return {...t,package:{...t.package,document:{...t.package.document,content:o}}}}function b(t,r){if(!t.package?.document?.content)return t;let e=0,n=t.package.document.content.filter(o=>{if(o.type==="table"){let i=e===r;return e++,!i}return true});return {...t,package:{...t.package,document:{...t.package.document,content:n}}}}var m=class extends s{constructor(){super({selectedCell:null});}selectCell(r){this.setSnapshot({selectedCell:r});}clearSelection(){this.setSnapshot({selectedCell:null});}isCellSelected(r,e,n){let{selectedCell:o}=this.getSnapshot();return o?o.tableIndex===r&&o.rowIndex===e&&o.columnIndex===n:false}getSelectedCell(){return this.getSnapshot().selectedCell}};var d=class extends s{constructor(){super({notifications:[]});b$1(this,"notifications",[]);b$1(this,"idCounter",0);b$1(this,"timers",new Set);}showError(e,n){return this.addNotification(e,"error",n)}showWarning(e,n){return this.addNotification(e,"warning",n)}showInfo(e,n){return this.addNotification(e,"info",n)}dismiss(e){this.notifications=this.notifications.map(o=>o.id===e?{...o,dismissed:true}:o),this.emitSnapshot();let n=setTimeout(()=>{this.timers.delete(n),this.notifications=this.notifications.filter(o=>o.id!==e),this.emitSnapshot();},300);this.timers.add(n);}clearAll(){this.notifications=[];for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.emitSnapshot();}destroy(){for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.notifications=[];}addNotification(e,n,o){let i=`error-${++this.idCounter}-${Date.now()}`,l={id:i,message:e,severity:n,details:o,timestamp:Date.now()};if(this.notifications=[...this.notifications,l],this.emitSnapshot(),n!=="error"){let f=setTimeout(()=>{this.timers.delete(f),this.dismiss(i);},5e3);this.timers.add(f);}return i}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};var Me="0.0.2";export{d as ErrorManager,s as Subscribable,c as TABLE_DATA_ATTRIBUTES,m as TableSelectionManager,Me as VERSION,b as deleteTableFromDocument,g as findTableFromClick,Te as formatPageRange,me as getDefaultPrintOptions,h as getTableFromDocument,be as isPrintSupported,ge as openPrintWindow,he as parsePageRange,de as triggerPrint,T as updateTableInDocument};
1
+ export{i as attemptSelectiveSave,h as createDocx,a as parseDocx,f as repackDocx,c as serializeDocumentBody,b as serializeDocx,d as serializeSectionProperties,g as updateMultipleFiles}from'./chunk-PI2I3TO5.mjs';export{f as blendColors,r as colorsEqual,o as createRgbColor,n as createThemeColor,d as darkenColor,p as ensureHexPrefix,h as generateThemeTintShadeMatrix,c as getContrastingColor,g as getThemeTintShadeHex,k as isBlack,l as isWhite,e as lightenColor,m as parseColorString,a as resolveColor,i as resolveHighlightColor,q as resolveHighlightToCss,j as resolveShadingColor}from'./chunk-LTVVQMHB.mjs';export{b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,c as pixelsToEmu,h as pixelsToTwips,d as pointsToPixels,j as twipsToEmu,g as twipsToPixels}from'./chunk-CTBUQRYQ.mjs';export{n as canRenderFont,k as getLoadedFonts,g as isFontLoaded,j as isFontsLoading,i as isGoogleFontsEnabled,e as loadFont,o as loadFontFromBuffer,f as loadFonts,l as onFontsLoaded,v as preloadCommonFonts,h as setGoogleFontsEnabled,a as toArrayBuffer}from'./chunk-BUZ2X5CT.mjs';import'./chunk-TMHG7OAZ.mjs';import'./chunk-HLDJMU3R.mjs';import'./chunk-GHEHBYQK.mjs';import'./chunk-5F6DLQZP.mjs';import {b as b$1}from'./chunk-TTRUPDAB.mjs';var ce={includeHeaders:true,includeFooters:true,includePageNumbers:true,pageRange:null,scale:1,printBackground:true,margins:"default"};function me(){return {...ce}}function de(){typeof window<"u"&&window.print();}var fe="@media print { body { margin: 0; padding: 0; } @page { margin: 0; } }";function ge(t="Document",r){if(typeof window>"u")return null;let e=window.open("","_blank");if(!e)return null;e.opener=null;let n=e.document;n.title=t;let o=n.createElement("style");o.textContent=fe,n.head.appendChild(o);let i=new DOMParser().parseFromString(r,"text/html");for(let l of Array.from(i.body.childNodes))n.body.appendChild(n.importNode(l,true));return e}function he(t,r){if(!t||!t.trim())return null;let e=t.trim();if(/^\d+$/.test(e)){let o=parseInt(e,10);return o>=1&&o<=r?{start:o,end:o}:null}let n=e.match(/^(\d+)-(\d+)$/);if(n){let o=parseInt(n[1],10),i=parseInt(n[2],10);if(o>=1&&i<=r&&o<=i)return {start:o,end:i}}return null}function Te(t,r){return t?t.start===t.end?`Page ${t.start}`:`Pages ${t.start}-${t.end}`:`All (${r} pages)`}function be(){return typeof window<"u"&&typeof window.print=="function"}var s=class{constructor(r){b$1(this,"listeners",new Set);b$1(this,"snapshot");b$1(this,"subscribe",r=>(this.listeners.add(r),()=>{this.listeners.delete(r);}));b$1(this,"getSnapshot",()=>this.snapshot);this.snapshot=r;}setSnapshot(r){this.snapshot=r,this.notify();}notify(){for(let r of this.listeners)r();}};var c={TABLE_INDEX:"data-table-index",ROW_INDEX:"data-row",COLUMN_INDEX:"data-col",TABLE_CELL:"data-table-cell"};function g(t,r){if(!(t instanceof Element))return null;let e=t;for(;e&&e!==r;){if(e.tagName==="TD"||e.tagName==="TH"){let n=e.getAttribute(c.ROW_INDEX),o=e.getAttribute(c.COLUMN_INDEX);if(n!==null&&o!==null){let i=e;for(;i&&i!==r;){if(i.tagName==="TABLE"){let l=i.getAttribute(c.TABLE_INDEX);if(l!==null)return {tableIndex:parseInt(l,10),rowIndex:parseInt(n,10),columnIndex:parseInt(o,10)};break}i=i.parentElement;}}break}e=e.parentElement;}return null}function h(t,r){if(!t.package?.document?.content)return null;let e=0;for(let n of t.package.document.content)if(n.type==="table"){if(e===r)return n;e++;}return null}function T(t,r,e){if(!t.package?.document?.content)return t;let n=0,o=t.package.document.content.map(i=>{if(i.type==="table"){if(n===r)return n++,e;n++;}return i});return {...t,package:{...t.package,document:{...t.package.document,content:o}}}}function b(t,r){if(!t.package?.document?.content)return t;let e=0,n=t.package.document.content.filter(o=>{if(o.type==="table"){let i=e===r;return e++,!i}return true});return {...t,package:{...t.package,document:{...t.package.document,content:n}}}}var m=class extends s{constructor(){super({selectedCell:null});}selectCell(r){this.setSnapshot({selectedCell:r});}clearSelection(){this.setSnapshot({selectedCell:null});}isCellSelected(r,e,n){let{selectedCell:o}=this.getSnapshot();return o?o.tableIndex===r&&o.rowIndex===e&&o.columnIndex===n:false}getSelectedCell(){return this.getSnapshot().selectedCell}};var d=class extends s{constructor(){super({notifications:[]});b$1(this,"notifications",[]);b$1(this,"idCounter",0);b$1(this,"timers",new Set);}showError(e,n){return this.addNotification(e,"error",n)}showWarning(e,n){return this.addNotification(e,"warning",n)}showInfo(e,n){return this.addNotification(e,"info",n)}dismiss(e){this.notifications=this.notifications.map(o=>o.id===e?{...o,dismissed:true}:o),this.emitSnapshot();let n=setTimeout(()=>{this.timers.delete(n),this.notifications=this.notifications.filter(o=>o.id!==e),this.emitSnapshot();},300);this.timers.add(n);}clearAll(){this.notifications=[];for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.emitSnapshot();}destroy(){for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.notifications=[];}addNotification(e,n,o){let i=`error-${++this.idCounter}-${Date.now()}`,l={id:i,message:e,severity:n,details:o,timestamp:Date.now()};if(this.notifications=[...this.notifications,l],this.emitSnapshot(),n!=="error"){let f=setTimeout(()=>{this.timers.delete(f),this.dismiss(i);},5e3);this.timers.add(f);}return i}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};var Me="0.0.2";export{d as ErrorManager,s as Subscribable,c as TABLE_DATA_ATTRIBUTES,m as TableSelectionManager,Me as VERSION,b as deleteTableFromDocument,g as findTableFromClick,Te as formatPageRange,me as getDefaultPrintOptions,h as getTableFromDocument,be as isPrintSupported,ge as openPrintWindow,he as parsePageRange,de as triggerPrint,T as updateTableInDocument};
@@ -1,5 +1,5 @@
1
- import { I as ImagePrimitive, D as DisplayList } from './frameDelta-B2kC6XiP.mjs';
2
- import { R as RustDisplayListQueryEngine } from './rustDisplayList-B0M2eBkU.mjs';
1
+ import { I as ImagePrimitive, D as DisplayList } from './frameDelta-DMgR8n13.mjs';
2
+ import { R as RustDisplayListQueryEngine } from './rustDisplayList-B9dQoLHI.mjs';
3
3
 
4
4
  /**
5
5
  * Locate an image primitive in a built DisplayList by its document position.
@@ -8,14 +8,13 @@ import { R as RustDisplayListQueryEngine } from './rustDisplayList-B0M2eBkU.mjs'
8
8
  * rect to place its resize handles, and on the canvas path the painted DOM
9
9
  * image (`.layout-run-image`) is parked/hidden — its rect is unusable. The
10
10
  * display list carries every inline image as an `ImagePrimitive` stamped with
11
- * `docStart` (= the image atom's PM position, the same value the DOM path reads
11
+ * `docStart` (= the image atom's document position, the same value the DOM path reads
12
12
  * from `data-doc-start`), so the primitive found here is the geometry source
13
13
  * that replaces `imageInfo.element.getBoundingClientRect()`.
14
14
  *
15
15
  * Body primitives only: header/footer image primitives carry doc positions in a
16
- * different PM doc (the HF editor), so a body image pmPos must never match one.
16
+ * different doc (the HF editor), so a body image pmPos must never match one.
17
17
  *
18
- * @experimental part of the rust-canvas-engine change; shape may evolve.
19
18
  */
20
19
 
21
20
  type DisplayListImageRegion = 'body' | 'header' | 'footer';
@@ -23,15 +22,15 @@ interface LocatedImagePrimitive {
23
22
  primitive: ImagePrimitive;
24
23
  /** page the primitive paints on (page-local px are relative to this page) */
25
24
  pageIndex: number;
26
- /** PM-document region containing the image. Undefined reads as body. */
25
+ /** Document region containing the image. Undefined reads as body. */
27
26
  region?: DisplayListImageRegion;
28
27
  /** Header/footer relationship id when `region` is not body. */
29
28
  rId?: string;
30
29
  }
31
30
  /**
32
31
  * First body image primitive whose `docStart` equals `pos`, or null. `pos` is
33
- * the image node's PM position (a NodeSelection's `from`, or the left edge of a
34
- * one-atom TextSelection).
32
+ * the image node's document position (a node selection's `from`, or the left
33
+ * edge of a one-atom text selection).
35
34
  */
36
35
  declare function findImagePrimitiveByDocPos(list: DisplayList, pos: number, region?: DisplayListImageRegion, rId?: string): LocatedImagePrimitive | null;
37
36
  /** Topmost positioned image under a page-local point, or null. */
@@ -49,67 +48,93 @@ declare function captureInlinePositionEmuFromDisplayList(queries: DisplayListQue
49
48
  } | undefined;
50
49
 
51
50
  /**
52
- * Synchronous query facade over a built DisplayList, backed by the Rust
51
+ * Synchronous query facade over one built DisplayList, backed by the Rust
53
52
  * hit-testing module (`crates/docx-layout/src/hit.rs`).
54
53
  *
55
- * This is the sole pointer/selection geometry source for the canvas
56
- * renderer (it replaced the deleted painted-DOM resolvers): geometry comes
57
- * from the immutable display list, never from DOM rects.
54
+ * This is the canvas renderer's only source of pointer and selection geometry:
55
+ * every rect comes from the immutable display list, never from DOM rects. A
56
+ * facade is created per display-list build, since the list never mutates in
57
+ * place, and it holds no state a caller has to keep in sync.
58
58
  *
59
- * Perf model: when the embedded wasm carries the session-handle exports, this
60
- * facade parses the display list into the Rust store exactly ONCE
61
- * (`openDisplayList` → handle) and routes every hit-test / range-rect query
62
- * through the by-handle exports — no per-query re-serialization or re-parse.
63
- * The handle is acquired LAZILY: at the first query that needs it, or when the
64
- * host calls `prime()` from idle time. Keystroke-driven facade replacement
65
- * therefore costs no serialization on the input path; superseded generations
66
- * chain their adoption donor so a deferred pickup still ships one page-delta
67
- * instead of a full re-open. When the session exports are absent (before the
68
- * integrator re-embeds the wasm) it falls back to the JSON-arg exports,
69
- * stringifying the list once and reusing the string for every query. Either
70
- * way the query RESULTS are byte-identical — the handle path is pure perf.
59
+ * **Two sources.** A resident editing engine queries its own display list
60
+ * directly and takes no display-list JSON at all. Otherwise the shared layout
61
+ * wasm answers, and the facade prefers a SESSION HANDLE: the list is parsed
62
+ * into the Rust store once (`openDisplayList`) and every later query goes by
63
+ * handle, with no per-query re-serialization. When the session exports are
64
+ * absent it stringifies the list once and reuses that string for the JSON-arg
65
+ * exports. The two paths run the same hit and range logic, so results are
66
+ * byte-identical and only the cost differs.
71
67
  *
72
- * Handle lifecycle: the handle is opened once per facade (per display-list
73
- * build) and released by `dispose()`. Callers that drop the facade without
74
- * disposing (e.g. a React `useMemo` replacement) are covered by a
75
- * `FinalizationRegistry` that closes the handle when the facade is collected;
76
- * the Rust store additionally caps live handles and evicts the oldest, so a
77
- * missed finalize can never grow memory unbounded.
68
+ * **Handle acquisition is lazy** — on the first query that needs one, or when
69
+ * a host calls `prime()` from idle time — so replacing the facade on every
70
+ * keystroke costs no serialization on the input path. A new facade also tries
71
+ * to ADOPT its predecessor's parsed list, shipping a page delta for the pages
72
+ * that changed instead of reopening the whole list; superseded generations
73
+ * chain their donor, so a deferred pickup still costs one delta. The donor's
74
+ * own later queries degrade to its JSON-arg path.
78
75
  *
79
- * Queries are synchronous; until the lazily-imported wasm module resolves they
80
- * return `null`/`[]`. In practice the module is already loaded by the time a
81
- * queries instance exists, because building the display list itself went
82
- * through the same module (`loadRustDisplayListQueryEngine` shares the promise
83
- * with `buildRustDisplayList`).
76
+ * **Handle release.** `dispose()` frees the handle immediately. A facade
77
+ * dropped without it — a `useMemo` replacement, say — is covered by a
78
+ * `FinalizationRegistry`, and the Rust store additionally caps live handles
79
+ * and evicts the oldest, so a missed finalize cannot grow memory without
80
+ * bound.
84
81
  *
85
- * @experimental part of the rust-canvas-engine change; shape may evolve.
82
+ * **Failure.** A wasm TRAP poisons the whole instance: a guard held across the
83
+ * query leaks and every later call into it fails, so the engine is marked dead,
84
+ * all queries stop, and `onDisplayListQuerySourceFailure` subscribers are told
85
+ * to rebuild the session. An ordinary error just falls back — a bad handle is
86
+ * dropped and the query retried over JSON.
87
+ *
88
+ * Queries are synchronous and return `null`/`[]` until the lazily imported
89
+ * wasm module resolves. In practice it is already loaded by the time a facade
90
+ * exists, because building the display list went through the same module.
86
91
  */
87
92
 
88
- /** Query surface implemented by the editing wasm over its resident list. */
93
+ /**
94
+ * Query surface of an editing engine that already holds the display list.
95
+ * None of these take display-list JSON, so this source never opens a handle
96
+ * and never serializes anything.
97
+ */
89
98
  interface ResidentDisplayListQueryEngine {
90
99
  displayHitTestRegionsJson(pageIndex: number, x: number, y: number): string;
91
100
  displayVerticalMoveJson(position: number, direction: 'up' | 'down', goalX: number): string;
92
101
  displayRangeRectsJson(from: number, to: number): string;
93
- displayRangeRectsRegionJson(region: 'body' | 'header' | 'footer', rId: string, from: number, to: number): string;
102
+ displayRangeRectsRegionJson(region: DisplayListHitRegion, partId: string, from: number, to: number): string;
94
103
  }
95
104
  /** which part of a page owns a hit — mirrors `HitRegion` in hit.rs */
96
- type DisplayListHitRegion = 'body' | 'header' | 'footer';
105
+ type DisplayListHitRegion = 'body' | 'header' | 'footer' | 'footnote' | 'endnote';
106
+ /**
107
+ * What a click at a hit point would act on — mirrors `HoverTarget` in hit.rs.
108
+ * `'text'` is the typeable area (a run's box, or the content box around it),
109
+ * which is what a pointer cursor keys off; `pos` cannot say, since it resolves
110
+ * everywhere on a page that carries text.
111
+ */
112
+ type DisplayListHoverTarget = 'text' | 'image' | 'none';
97
113
  /**
98
114
  * Region-aware hit result. For `header`/`footer` the position refers to the
99
- * HF ProseMirror doc identified by `rId`, NOT the body doc — the caller must
100
- * route the selection to that HF editor, exactly like the DOM path scopes
101
- * clicks to `.layout-page-header|footer`.
115
+ * header/footer document identified by `rId`, and for `footnote`/`endnote` to
116
+ * the note story named by `noteId` — NOT the body document, so the caller must
117
+ * route the selection to that editor. `pos` is null when the point is inside
118
+ * the region but resolves to no position.
102
119
  */
103
120
  interface DisplayListRegionHit {
104
121
  region: DisplayListHitRegion;
105
122
  rId?: string;
123
+ /** note whose story a `footnote`/`endnote` position addresses */
124
+ noteId?: number;
106
125
  pos: number | null;
126
+ /** Absent from a wasm build predating it; read that as "not text". */
127
+ target?: DisplayListHoverTarget;
107
128
  }
129
+ /**
130
+ * Result of an up/down caret move. `goalX` is the page-local x to feed back
131
+ * into the next move so a run of them holds one column.
132
+ */
108
133
  interface DisplayListVerticalMove {
109
134
  position: number;
110
135
  goalX: number;
111
136
  }
112
- /** one highlight rectangle of a PM range, page-local px */
137
+ /** one highlight rectangle of a document range, page-local px */
113
138
  interface DisplayListRect {
114
139
  pageIndex: number;
115
140
  x: number;
@@ -174,23 +199,30 @@ interface DisplayListQueries {
174
199
  /** Visual line containing `pos`, or null. */
175
200
  visualLineAtPosition(pos: number): DisplayListVisualLine | null;
176
201
  /** Topmost image under a page-local point. Body by default. */
177
- imageAtPoint(pageIndex: number, x: number, y: number, region?: DisplayListHitRegion, rId?: string): DisplayListImageGeometry | null;
202
+ imageAtPoint(pageIndex: number, x: number, y: number, region?: DisplayListImageRegion, rId?: string): DisplayListImageGeometry | null;
178
203
  /** Image whose atom starts at `pos`. Body by default. */
179
- imageByPos(pos: number, region?: DisplayListHitRegion, rId?: string): DisplayListImageGeometry | null;
204
+ imageByPos(pos: number, region?: DisplayListImageRegion, rId?: string): DisplayListImageGeometry | null;
180
205
  /** region-aware point → doc position (page-local coordinates) */
181
206
  hitTestRegions(pageIndex: number, x: number, y: number): DisplayListRegionHit | null;
182
207
  verticalMove(position: number, direction: 'up' | 'down', goalX?: number): DisplayListVerticalMove | null;
183
- /** body PM range → highlight rects */
208
+ /** body document range → highlight rects */
184
209
  rangeRects(from: number, to: number): DisplayListRect[];
185
210
  /**
186
- * Header/footer PM range → highlight rects for the region's band. `region` is
187
- * `'header' | 'footer'`; `rId` identifies the HF ProseMirror doc, and
211
+ * Header/footer document range → highlight rects for the region's band. `region` is
212
+ * `'header' | 'footer'`; `rId` identifies the HF doc, and
188
213
  * `from`/`to` are positions in THAT doc. The same HF doc paints on every page
189
214
  * carrying the part, so this returns one rect-set per such page (each tagged
190
215
  * with its `pageIndex`) — the caller picks the page it is editing. Returns
191
- * `[]` until the region-aware exports are embedded (feature-detected).
216
+ * `[]` when the region-aware exports are absent, which is feature-detected.
192
217
  */
193
218
  hfRangeRects(region: 'header' | 'footer', rId: string, from: number, to: number): DisplayListRect[];
219
+ /**
220
+ * Note document range → highlight rects for that note's story. `from`/`to`
221
+ * are positions in the `fn:{noteId}` / `en:{noteId}` document, never the
222
+ * body's. A note paints on one page only, so every rect shares its
223
+ * `pageIndex`.
224
+ */
225
+ noteRangeRects(region: 'footnote' | 'endnote', noteId: number, from: number, to: number): DisplayListRect[];
194
226
  /**
195
227
  * Caret geometry for a collapsed HF selection — the HF twin of `caretRect`.
196
228
  * Resolves `[pos, pos+1)` in the HF doc (left edge is the caret), falling back
@@ -198,6 +230,11 @@ interface DisplayListQueries {
198
230
  * caret rect per page carrying the part; the caller picks the edited page.
199
231
  */
200
232
  hfCaretRects(region: 'header' | 'footer', rId: string, pos: number): DisplayListRect[];
233
+ /**
234
+ * Caret geometry for a collapsed selection in a note story — the note twin of
235
+ * `hfCaretRects`. A note paints on one page, so this returns at most one rect.
236
+ */
237
+ noteCaretRects(region: 'footnote' | 'endnote', noteId: number, pos: number): DisplayListRect[];
201
238
  /** Header/footer sidebar anchors, one per page carrying the part. */
202
239
  hfAnchorRects(region: 'header' | 'footer', rId: string, pos: number): DisplayListRect[];
203
240
  /**
@@ -248,4 +285,4 @@ declare function onDisplayListQuerySourceFailure(listener: (error: Error) => voi
248
285
  */
249
286
  declare function createDisplayListQueries(list: DisplayList, engine?: RustDisplayListQueryEngine | ResidentDisplayListQueryEngine, previous?: DisplayListQueries | null): DisplayListQueries;
250
287
 
251
- export { type DisplayListRect as D, type LocatedImagePrimitive as L, type ResidentDisplayListQueryEngine as R, type DisplayListQueries as a, type DisplayListRegionHit as b, type DisplayListHitRegion as c, type DisplayListImageGeometry as d, type DisplayListImageRegion as e, type DisplayListParagraphGeometry as f, type DisplayListQuerySourceState as g, type DisplayListVerticalMove as h, type DisplayListVisualLine as i, captureInlinePositionEmuFromDisplayList as j, createDisplayListQueries as k, findImagePrimitiveAtPoint as l, findImagePrimitiveByDocPos as m, isDisplayListQuerySourceDead as n, onDisplayListQuerySourceFailure as o };
288
+ export { type DisplayListRect as D, type LocatedImagePrimitive as L, type ResidentDisplayListQueryEngine as R, type DisplayListQueries as a, type DisplayListRegionHit as b, type DisplayListHitRegion as c, type DisplayListHoverTarget as d, type DisplayListImageGeometry as e, type DisplayListImageRegion as f, type DisplayListParagraphGeometry as g, type DisplayListQuerySourceState as h, type DisplayListVerticalMove as i, type DisplayListVisualLine as j, captureInlinePositionEmuFromDisplayList as k, createDisplayListQueries as l, findImagePrimitiveAtPoint as m, findImagePrimitiveByDocPos as n, isDisplayListQuerySourceDead as o, onDisplayListQuerySourceFailure as p };
@@ -1,10 +1,10 @@
1
- export { a as attemptSelectiveSave, c as createDocx, p as parseDocx, r as repackDocx, u as updateMultipleFiles } from '../selectiveSave-CVoajSKE.mjs';
1
+ export { a as attemptSelectiveSave, c as createDocx, p as parseDocx, r as repackDocx, u as updateMultipleFiles } from '../selectiveSave-CRh-_Y_C.mjs';
2
2
  import { WrapType } from './wrapTypes.mjs';
3
- import { B as BlockContent, f as Comment, W as Watermark } from '../content-C3sTRz-u.mjs';
3
+ import { B as BlockContent, f as Comment, W as Watermark } from '../content-DrqzbIr7.mjs';
4
4
  import { Document } from '../types/document.mjs';
5
5
  import '../docxInput-DTbCa48g.mjs';
6
- import '../formatting-BEkIBePP.mjs';
7
- import '../styles-BK3Jecxs.mjs';
6
+ import '../formatting-BqrFPeev.mjs';
7
+ import '../styles-CMybYYHS.mjs';
8
8
 
9
9
  type AnchorWrapType = Exclude<WrapType, 'inline'>;
10
10
  type ImageLayoutTarget = AnchorWrapType | 'squareLeft' | 'squareRight' | 'inline';
@@ -71,7 +71,7 @@ declare function toolbarValueToLayoutTarget(value: string): ImageLayoutTarget |
71
71
  * Word / Pages / LibreOffice expect every comment in `comments.xml`
72
72
  * (including REPLY threads) to have matching `commentRangeStart` /
73
73
  * `commentRangeEnd` / `commentReference` markers in `document.xml`.
74
- * The PM document only stamps marks for the parent comment because
74
+ * The document only stamps marks for the parent comment because
75
75
  * replies don't have their own visible range — they share the parent
76
76
  * thread's text. So before serialization we walk the body content and
77
77
  * synthesize parallel range markers for every reply.
@@ -1,2 +1,2 @@
1
- import {e}from'../chunk-NTSSE5QK.mjs';export{i as attemptSelectiveSave,h as createDocx,a as parseDocx,f as repackDocx,g as updateMultipleFiles}from'../chunk-NTSSE5QK.mjs';import'../chunk-YTILOUAA.mjs';import'../chunk-6KDV6AIL.mjs';import'../chunk-NJHOPXZW.mjs';import'../chunk-B4IR6YP4.mjs';import'../chunk-T4EZMUXM.mjs';import'../chunk-TTRUPDAB.mjs';function E(e,t,o,r,i,p){let a=e.includes("w")||e.includes("e"),s=e.includes("n")||e.includes("s"),u=e.includes("w")?-1:1,l=e.includes("n")?-1:1,m=a?r+t*u:r,f=s?i+o*l:i;if(a&&s&&p){let g=Math.max(m/r,f/i);m=r*g,f=i*g;}let d=g=>Math.max(20,Math.min(2e3,g));return {width:a?d(m):r,height:s?d(f):i}}function q(e,t,o){let r=()=>t.position?.horizontal&&t.position.vertical?t.position:o?.initialPositionEmu?{horizontal:{relativeTo:"column",posOffset:o.initialPositionEmu.horizontalEmu},vertical:{relativeTo:"paragraph",posOffset:o.initialPositionEmu.verticalEmu}}:{horizontal:{relativeTo:"column",posOffset:0},vertical:{relativeTo:"paragraph",posOffset:0}};switch(e){case "inline":return {wrapType:"inline",displayMode:"inline",cssFloat:"none",wrapText:void 0,position:void 0,distTop:void 0,distBottom:void 0,distLeft:void 0,distRight:void 0};case "squareLeft":case "squareRight":{let i=e==="squareLeft"?"left":"right";return {wrapType:t.wrapType==="tight"||t.wrapType==="through"?t.wrapType:"square",displayMode:"float",cssFloat:i,wrapText:i==="left"?"right":"left",position:r()}}case "square":case "tight":case "through":{let i=t.cssFloat==="left"||t.cssFloat==="right"?t.cssFloat:"left";return {wrapType:e,displayMode:"float",cssFloat:i,wrapText:i==="left"?"right":"left",position:r()}}case "topAndBottom":return {wrapType:"topAndBottom",displayMode:"block",cssFloat:"none",wrapText:"bothSides",position:r()};case "behind":case "inFront":return {wrapType:e,displayMode:"float",cssFloat:"none",wrapText:"bothSides",position:r()}}}function W(e,t){return e==="inline"?"inline":e==="behind"?"behind":e==="inFront"?"inFront":e==="square"||e==="tight"||e==="through"?t==="right"?"squareRight":"squareLeft":null}var _=[{choice:"inline",i18nLabelKey:"inLineWithText",i18nDescKey:"inLineWithText",iconHint:"inline"},{choice:"squareLeft",i18nLabelKey:"squareLeft",i18nDescKey:"squareLeft",iconHint:"squareLeft"},{choice:"squareRight",i18nLabelKey:"squareRight",i18nDescKey:"squareRight",iconHint:"squareRight"},{choice:"behind",i18nLabelKey:"behindText",i18nDescKey:"behindText",iconHint:"behind"},{choice:"inFront",i18nLabelKey:"inFrontOfText",i18nDescKey:"inFrontOfText",iconHint:"inFront"}];function B(e,t){return true}function z(e){switch(e){case "inline":return "inline";case "square":case "tight":case "through":return "squareLeft";case "topAndBottom":return "topAndBottom";case "behind":return "behind";case "inFront":return "inFront";case "wrapRight":return "squareLeft";case "wrapLeft":return "squareRight";default:return}}function K(e,t){let o=t.filter(p=>p.parentId!=null);if(o.length===0)return;let r=new Map;for(let p of o){let a=r.get(p.parentId);a?a.push(p.id):r.set(p.parentId,[p.id]);}function i(p){for(let a of p)if(a.type==="paragraph"){if(!a.content.some(u=>u.type==="commentRangeStart"||u.type==="commentRangeEnd"))continue;let s=[];for(let u of a.content)if(u.type==="commentRangeStart"){s.push(u);let l=r.get(u.id);if(l)for(let m of l)s.push({type:"commentRangeStart",id:m});}else if(u.type==="commentRangeEnd"){s.push(u);let l=r.get(u.id);if(l)for(let m of l)s.push({type:"commentRangeEnd",id:m});}else s.push(u);a.content=s;}else if(a.type==="table")for(let s of a.rows)for(let u of s.cells)i(u.content);}i(e);}function X(e,t){let o=new Set(t.map(a=>a.id)),r=t.filter(a=>a.parentId!=null&&!o.has(a.parentId));if(r.length===0)return;let i=new Map;for(let a of r){let s=i.get(a.parentId);s?s.push(a.id):i.set(a.parentId,[a.id]);}function p(a){for(let s of a)if(s.type==="paragraph"){if(!s.content.some(f=>(f.type==="insertion"||f.type==="deletion")&&i.has(f.info.id)))continue;let l=[],m=s.content;for(let f=0;f<m.length;f++){let d=m[f];if((d.type==="insertion"||d.type==="deletion")&&i.has(d.info.id)){let g=i.get(d.info.id);for(let y of g)l.push({type:"commentRangeStart",id:y});l.push(d);let h=m[f+1];h&&(h.type==="insertion"||h.type==="deletion")&&h.type!==d.type&&h.info.author===d.info.author&&h.info.date===d.info.date&&(l.push(h),f++);for(let y of g)l.push({type:"commentRangeEnd",id:y});}else l.push(d);}s.content=l;}else if(s.type==="table")for(let u of s.rows)for(let l of u.cells)p(l.content);}p(e);}function $(e){let t=e?.package.headers;if(t){for(let o of t.values())if(o.watermark)return o.watermark}}function G(e){let t=e.package.headers;if(!t||t.size===0)return e;let o=false,r=new Map;for(let[i,p]of t)if(p.watermark){let{watermark:a,...s}=p;r.set(i,s),o=true;}else r.set(i,p);return o?{...e,package:{...e.package,headers:r}}:e}function N(e,t){let o=e.package.headers;if(!o||o.size===0)return e;let r=new Map;for(let[i,p]of o)r.set(i,{...p,watermark:{...t}});return {...e,package:{...e.package,headers:r}}}function j(e){let t=e.package.document,o=[];if(t.sections)for(let r of t.sections)r.properties&&o.push(r.properties);return t.finalSectionProperties&&o.push(t.finalSectionProperties),o}function U(e$1,t){let o=e$1.package,r=o.document,i=o.headers,p=j(e$1),a=new Set;if(i)for(let n of i.values())a.add(n.hdrFtrType);let s=!i||i.size===0,u=p.some(n=>n.titlePg),l=p.some(n=>n.evenAndOddHeaders),m=s,f=u&&!a.has("first"),d=l&&!a.has("even");if(!m&&!f&&!d)return e$1;let g=o.relationships?new Map(o.relationships):new Map,h=new Map(i??[]),y=new Set;for(let n of g.values())n.target&&y.add(n.target.replace(/^\/?word\//,"").toLowerCase());function P(){let n=1;for(;y.has(`header${n}.xml`);)n++;let c=`header${n}.xml`;return y.add(c.toLowerCase()),c}function v(n){let c=`rIdWmHdr${n[0].toUpperCase()}${n.slice(1)}`,I=1;for(;g.has(c);)c=`rIdWmHdr${n[0].toUpperCase()}${n.slice(1)}${I++}`;return g.set(c,{id:c,type:e.header,target:P()}),h.set(c,{type:"header",hdrFtrType:n,content:[],watermark:{...t}}),c}let T={};function F(n){return T[n]??(T[n]=v(n))}function L(n,c){let I=n?.headerReferences?[...n.headerReferences]:[];return I.some(S=>S.type===c)?n??{}:(I.push({type:c,rId:F(c)}),{...n??{},headerReferences:I})}function w(n){let c=n;return m&&(c=L(c,"default")),f&&c?.titlePg&&(c=L(c,"first")),d&&c?.evenAndOddHeaders&&(c=L(c,"even")),c}let M=w(r.finalSectionProperties),k=r.sections?.map(n=>({...n,properties:w(n.properties)??n.properties}));return {...e$1,package:{...o,relationships:g,headers:h,document:{...r,finalSectionProperties:M,...k?{sections:k}:{}}}}}function Y(e,t){if(!t)return G(e);let o=N(e,t);return U(o,t)}
1
+ import {e}from'../chunk-PI2I3TO5.mjs';export{i as attemptSelectiveSave,h as createDocx,a as parseDocx,f as repackDocx,g as updateMultipleFiles}from'../chunk-PI2I3TO5.mjs';import'../chunk-BUZ2X5CT.mjs';import'../chunk-TMHG7OAZ.mjs';import'../chunk-HLDJMU3R.mjs';import'../chunk-GHEHBYQK.mjs';import'../chunk-5F6DLQZP.mjs';import'../chunk-TTRUPDAB.mjs';function E(e,t,o,r,i,p){let a=e.includes("w")||e.includes("e"),s=e.includes("n")||e.includes("s"),u=e.includes("w")?-1:1,l=e.includes("n")?-1:1,m=a?r+t*u:r,f=s?i+o*l:i;if(a&&s&&p){let g=Math.max(m/r,f/i);m=r*g,f=i*g;}let d=g=>Math.max(20,Math.min(2e3,g));return {width:a?d(m):r,height:s?d(f):i}}function q(e,t,o){let r=()=>t.position?.horizontal&&t.position.vertical?t.position:o?.initialPositionEmu?{horizontal:{relativeTo:"column",posOffset:o.initialPositionEmu.horizontalEmu},vertical:{relativeTo:"paragraph",posOffset:o.initialPositionEmu.verticalEmu}}:{horizontal:{relativeTo:"column",posOffset:0},vertical:{relativeTo:"paragraph",posOffset:0}};switch(e){case "inline":return {wrapType:"inline",displayMode:"inline",cssFloat:"none",wrapText:void 0,position:void 0,distTop:void 0,distBottom:void 0,distLeft:void 0,distRight:void 0};case "squareLeft":case "squareRight":{let i=e==="squareLeft"?"left":"right";return {wrapType:t.wrapType==="tight"||t.wrapType==="through"?t.wrapType:"square",displayMode:"float",cssFloat:i,wrapText:i==="left"?"right":"left",position:r()}}case "square":case "tight":case "through":{let i=t.cssFloat==="left"||t.cssFloat==="right"?t.cssFloat:"left";return {wrapType:e,displayMode:"float",cssFloat:i,wrapText:i==="left"?"right":"left",position:r()}}case "topAndBottom":return {wrapType:"topAndBottom",displayMode:"block",cssFloat:"none",wrapText:"bothSides",position:r()};case "behind":case "inFront":return {wrapType:e,displayMode:"float",cssFloat:"none",wrapText:"bothSides",position:r()}}}function W(e,t){return e==="inline"?"inline":e==="behind"?"behind":e==="inFront"?"inFront":e==="square"||e==="tight"||e==="through"?t==="right"?"squareRight":"squareLeft":null}var _=[{choice:"inline",i18nLabelKey:"inLineWithText",i18nDescKey:"inLineWithText",iconHint:"inline"},{choice:"squareLeft",i18nLabelKey:"squareLeft",i18nDescKey:"squareLeft",iconHint:"squareLeft"},{choice:"squareRight",i18nLabelKey:"squareRight",i18nDescKey:"squareRight",iconHint:"squareRight"},{choice:"behind",i18nLabelKey:"behindText",i18nDescKey:"behindText",iconHint:"behind"},{choice:"inFront",i18nLabelKey:"inFrontOfText",i18nDescKey:"inFrontOfText",iconHint:"inFront"}];function B(e,t){return true}function z(e){switch(e){case "inline":return "inline";case "square":case "tight":case "through":return "squareLeft";case "topAndBottom":return "topAndBottom";case "behind":return "behind";case "inFront":return "inFront";case "wrapRight":return "squareLeft";case "wrapLeft":return "squareRight";default:return}}function K(e,t){let o=t.filter(p=>p.parentId!=null);if(o.length===0)return;let r=new Map;for(let p of o){let a=r.get(p.parentId);a?a.push(p.id):r.set(p.parentId,[p.id]);}function i(p){for(let a of p)if(a.type==="paragraph"){if(!a.content.some(u=>u.type==="commentRangeStart"||u.type==="commentRangeEnd"))continue;let s=[];for(let u of a.content)if(u.type==="commentRangeStart"){s.push(u);let l=r.get(u.id);if(l)for(let m of l)s.push({type:"commentRangeStart",id:m});}else if(u.type==="commentRangeEnd"){s.push(u);let l=r.get(u.id);if(l)for(let m of l)s.push({type:"commentRangeEnd",id:m});}else s.push(u);a.content=s;}else if(a.type==="table")for(let s of a.rows)for(let u of s.cells)i(u.content);}i(e);}function X(e,t){let o=new Set(t.map(a=>a.id)),r=t.filter(a=>a.parentId!=null&&!o.has(a.parentId));if(r.length===0)return;let i=new Map;for(let a of r){let s=i.get(a.parentId);s?s.push(a.id):i.set(a.parentId,[a.id]);}function p(a){for(let s of a)if(s.type==="paragraph"){if(!s.content.some(f=>(f.type==="insertion"||f.type==="deletion")&&i.has(f.info.id)))continue;let l=[],m=s.content;for(let f=0;f<m.length;f++){let d=m[f];if((d.type==="insertion"||d.type==="deletion")&&i.has(d.info.id)){let g=i.get(d.info.id);for(let y of g)l.push({type:"commentRangeStart",id:y});l.push(d);let h=m[f+1];h&&(h.type==="insertion"||h.type==="deletion")&&h.type!==d.type&&h.info.author===d.info.author&&h.info.date===d.info.date&&(l.push(h),f++);for(let y of g)l.push({type:"commentRangeEnd",id:y});}else l.push(d);}s.content=l;}else if(s.type==="table")for(let u of s.rows)for(let l of u.cells)p(l.content);}p(e);}function $(e){let t=e?.package.headers;if(t){for(let o of t.values())if(o.watermark)return o.watermark}}function G(e){let t=e.package.headers;if(!t||t.size===0)return e;let o=false,r=new Map;for(let[i,p]of t)if(p.watermark){let{watermark:a,...s}=p;r.set(i,s),o=true;}else r.set(i,p);return o?{...e,package:{...e.package,headers:r}}:e}function N(e,t){let o=e.package.headers;if(!o||o.size===0)return e;let r=new Map;for(let[i,p]of o)r.set(i,{...p,watermark:{...t}});return {...e,package:{...e.package,headers:r}}}function j(e){let t=e.package.document,o=[];if(t.sections)for(let r of t.sections)r.properties&&o.push(r.properties);return t.finalSectionProperties&&o.push(t.finalSectionProperties),o}function U(e$1,t){let o=e$1.package,r=o.document,i=o.headers,p=j(e$1),a=new Set;if(i)for(let n of i.values())a.add(n.hdrFtrType);let s=!i||i.size===0,u=p.some(n=>n.titlePg),l=p.some(n=>n.evenAndOddHeaders),m=s,f=u&&!a.has("first"),d=l&&!a.has("even");if(!m&&!f&&!d)return e$1;let g=o.relationships?new Map(o.relationships):new Map,h=new Map(i??[]),y=new Set;for(let n of g.values())n.target&&y.add(n.target.replace(/^\/?word\//,"").toLowerCase());function P(){let n=1;for(;y.has(`header${n}.xml`);)n++;let c=`header${n}.xml`;return y.add(c.toLowerCase()),c}function v(n){let c=`rIdWmHdr${n[0].toUpperCase()}${n.slice(1)}`,I=1;for(;g.has(c);)c=`rIdWmHdr${n[0].toUpperCase()}${n.slice(1)}${I++}`;return g.set(c,{id:c,type:e.header,target:P()}),h.set(c,{type:"header",hdrFtrType:n,content:[],watermark:{...t}}),c}let T={};function F(n){return T[n]??(T[n]=v(n))}function L(n,c){let I=n?.headerReferences?[...n.headerReferences]:[];return I.some(S=>S.type===c)?n??{}:(I.push({type:c,rId:F(c)}),{...n??{},headerReferences:I})}function w(n){let c=n;return m&&(c=L(c,"default")),f&&c?.titlePg&&(c=L(c,"first")),d&&c?.evenAndOddHeaders&&(c=L(c,"even")),c}let M=w(r.finalSectionProperties),k=r.sections?.map(n=>({...n,properties:w(n.properties)??n.properties}));return {...e$1,package:{...o,relationships:g,headers:h,document:{...r,finalSectionProperties:M,...k?{sections:k}:{}}}}}function Y(e,t){if(!t)return G(e);let o=N(e,t);return U(o,t)}
2
2
  export{_ as IMAGE_LAYOUT_OPTIONS,E as calculateResizedImageDimensions,W as deriveLayoutChoice,$ as getDocumentWatermark,K as injectReplyRangeMarkers,X as injectTCReplyRangeMarkers,B as isImageLayoutOptionEnabled,q as resolveImageLayoutAttrs,Y as setDocumentWatermark,z as toolbarValueToLayoutTarget};