@eigenpal/docx-editor-core 1.3.2 → 1.4.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 (71) hide show
  1. package/dist/chunk-2WGTGBBS.js +2 -0
  2. package/dist/{chunk-ZAZWHK4J.js → chunk-6IZOFIQH.js} +1 -1
  3. package/dist/{chunk-4MYKVWNF.js → chunk-77GRQUSK.js} +1 -1
  4. package/dist/{chunk-6V3SFHEM.js → chunk-BUEMXRXH.js} +1 -1
  5. package/dist/{chunk-LAJPGQEE.mjs → chunk-CHTIWTHQ.mjs} +1 -1
  6. package/dist/chunk-CRMZH7U7.mjs +2 -0
  7. package/dist/{chunk-LX35TFGF.mjs → chunk-EM33RGHT.mjs} +1 -1
  8. package/dist/{chunk-CDXCFHOY.mjs → chunk-ESCPS4AO.mjs} +1 -1
  9. package/dist/{chunk-7UZJ5YDF.mjs → chunk-EUZLYQRB.mjs} +1 -1
  10. package/dist/{chunk-RAWVGULQ.js → chunk-EV4LVK4X.js} +1 -1
  11. package/dist/{chunk-UEPLDKKM.mjs → chunk-GGUHM74A.mjs} +1 -1
  12. package/dist/{chunk-PMSGJXOE.mjs → chunk-HPAUUQAX.mjs} +1 -1
  13. package/dist/chunk-IUJCUITW.mjs +1 -0
  14. package/dist/chunk-KAOLVBLH.js +1 -0
  15. package/dist/{chunk-APNMO5JT.js → chunk-KXVCCT2A.js} +1 -1
  16. package/dist/chunk-L5NPEM7C.js +1 -0
  17. package/dist/chunk-OEC6SBDV.mjs +1 -0
  18. package/dist/chunk-OF373DBR.mjs +1 -0
  19. package/dist/chunk-Q4IEATDJ.js +1 -0
  20. package/dist/chunk-QAJSNLJR.mjs +1 -0
  21. package/dist/chunk-XLB6AC5Q.js +1 -0
  22. package/dist/{chunk-6WZW3NSJ.js → chunk-ZBCFIW2V.js} +1 -1
  23. package/dist/core.js +1 -1
  24. package/dist/core.mjs +1 -1
  25. package/dist/editor/index.js +1 -1
  26. package/dist/editor/index.mjs +1 -1
  27. package/dist/layout-bridge/clickToPositionDom.js +1 -1
  28. package/dist/layout-bridge/clickToPositionDom.mjs +1 -1
  29. package/dist/layout-bridge/index.d.mts +12 -3
  30. package/dist/layout-bridge/index.d.ts +12 -3
  31. package/dist/layout-bridge/index.js +1 -1
  32. package/dist/layout-bridge/index.mjs +1 -1
  33. package/dist/layout-bridge/tableInsertHover.js +1 -1
  34. package/dist/layout-bridge/tableInsertHover.mjs +1 -1
  35. package/dist/layout-painter/index.js +1 -1
  36. package/dist/layout-painter/index.mjs +1 -1
  37. package/dist/layout-painter/renderPage.js +1 -1
  38. package/dist/layout-painter/renderPage.mjs +1 -1
  39. package/dist/prosemirror/applyFormatting.js +1 -1
  40. package/dist/prosemirror/applyFormatting.mjs +1 -1
  41. package/dist/prosemirror/commands/formatting.js +1 -1
  42. package/dist/prosemirror/commands/formatting.mjs +1 -1
  43. package/dist/prosemirror/commands/index.js +1 -1
  44. package/dist/prosemirror/commands/index.mjs +1 -1
  45. package/dist/prosemirror/commands/paragraph.js +1 -1
  46. package/dist/prosemirror/commands/paragraph.mjs +1 -1
  47. package/dist/prosemirror/conversion/index.js +1 -1
  48. package/dist/prosemirror/conversion/index.mjs +1 -1
  49. package/dist/prosemirror/extensions/index.js +1 -1
  50. package/dist/prosemirror/extensions/index.mjs +1 -1
  51. package/dist/prosemirror/imageCommit.d.mts +18 -1
  52. package/dist/prosemirror/imageCommit.d.ts +18 -1
  53. package/dist/prosemirror/imageCommit.js +1 -1
  54. package/dist/prosemirror/imageCommit.mjs +1 -1
  55. package/dist/prosemirror/index.d.mts +12 -1
  56. package/dist/prosemirror/index.d.ts +12 -1
  57. package/dist/prosemirror/index.js +3 -3
  58. package/dist/prosemirror/index.mjs +3 -3
  59. package/dist/prosemirror/schema/index.js +1 -1
  60. package/dist/prosemirror/schema/index.mjs +1 -1
  61. package/package.json +1 -1
  62. package/dist/chunk-2LEFMTNZ.mjs +0 -1
  63. package/dist/chunk-4GFTMGSV.mjs +0 -1
  64. package/dist/chunk-4PANZ3VU.js +0 -1
  65. package/dist/chunk-4RTVLMRZ.js +0 -2
  66. package/dist/chunk-KKXCBWVG.mjs +0 -1
  67. package/dist/chunk-LJE7HQEJ.mjs +0 -1
  68. package/dist/chunk-PFMM7QON.js +0 -1
  69. package/dist/chunk-QVRNNRG5.js +0 -1
  70. package/dist/chunk-SWBLJF6R.mjs +0 -2
  71. package/dist/chunk-WWBNJ7KF.js +0 -1
@@ -0,0 +1 @@
1
+ import {c}from'./chunk-HKN2NKOG.mjs';import {V as V$1,L,T,k,l}from'./chunk-JHTURDPX.mjs';import {b}from'./chunk-IUJCUITW.mjs';import {e}from'./chunk-VW22RZ6C.mjs';function ee(e,n){if(e.pages.length===0)return null;let a=e.pageGap??0,r=0,t=null,o=1/0;for(let s=0;s<e.pages.length;s++){let i=e.pages[s],l=i.size?.h??e.pageSize.h,f=r,u=f+l;if(n.y>=f&&n.y<u)return {pageIndex:s,page:i,pageY:n.y-f};let c=f+l/2,m=Math.abs(n.y-c);m<o&&(o=m,t=s),r=u+a;}if(t!==null){let s=e.pages[t],i=A(e,t);return {pageIndex:t,page:s,pageY:Math.max(0,Math.min(n.y-i,s.size?.h??e.pageSize.h))}}return null}function A(e,n){let a=e.pageGap??0,r=0;for(let t=0;t<n&&t<e.pages.length;t++){let s=e.pages[t].size?.h??e.pageSize.h;r+=s+a;}return r}function Ne(e,n){return ee(e,{y:n})?.pageIndex??null}function te(e,n){return e.findIndex(a=>a.id===n)}function Ye(e,n){let a=0;for(let r=e.fromLine;r<e.toLine&&r<n.lines.length;r++)a+=n.lines[r].lineHeight;return a}function ge(e,n,a,r){let t=[...e.page.fragments].sort((o,s)=>{let i=o.y-s.y;return Math.abs(i)>.5?i:o.x-s.x});for(let o of t){let s=te(n,o.blockId);if(s===-1)continue;let i=n[s],l=a[s];if(!i||!l)continue;let f;if(o.kind==="paragraph"){if(i.kind!=="paragraph"||l.kind!=="paragraph")continue;f=Ye(o,l);}else if(o.kind==="table")f=o.height;else if(o.kind==="image")f=o.height;else continue;let u=r.x>=o.x&&r.x<=o.x+o.width,c=r.y>=o.y&&r.y<=o.y+f;if(u&&c)return {fragment:o,block:i,measure:l,pageIndex:e.pageIndex,localX:r.x-o.x,localY:r.y-o.y}}return null}function ze(e,n,a,r){for(let t of e.page.fragments){if(t.kind!=="image")continue;let o=te(n,t.blockId);if(o===-1)continue;let s=n[o],i=a[o];if(!s||!i)continue;let l=r.x>=t.x&&r.x<=t.x+t.width,f=r.y>=t.y&&r.y<=t.y+t.height;if(l&&f)return {fragment:t,block:s,measure:i,pageIndex:e.pageIndex,localX:r.x-t.x,localY:r.y-t.y}}return null}function pe(e,n,a,r){for(let t of e.page.fragments){if(t.kind!=="table")continue;let o=t,s=r.x>=o.x&&r.x<=o.x+o.width,i=r.y>=o.y&&r.y<=o.y+o.height;if(!s||!i)continue;let l=te(n,o.blockId);if(l===-1)continue;let f=n[l],u=a[l];if(!f||f.kind!=="table"||!u||u.kind!=="table")continue;let c=f,m=u,g=r.x-o.x,x=r.y-o.y,d=o.headerRowCount??0,h=d>0&&o.continuesFromPrev?V$1(m,d):0,p=0,b=-1;if(m.rows.length===0||c.rows.length===0)continue;if(h>0&&x<h){let M=0;for(let w=0;w<d&&w<m.rows.length;w++){let L=m.rows[w];if(x>=M&&x<M+L.height){b=w;break}M+=L.height;}b===-1&&(b=0);}else {let M=x-h;for(let w=o.fromRow;w<o.toRow&&w<m.rows.length;w++){let L=m.rows[w];if(M>=p&&M<p+L.height){b=w;break}p+=L.height;}}if(b===-1&&(b=Math.min(o.toRow-1,m.rows.length-1),b<o.fromRow))continue;let T=m.rows[b],H=c.rows[b];if(!T||!H)continue;let F=0,k=-1;if(T.cells.length===0||H.cells.length===0)continue;for(let M=0;M<T.cells.length;M++){let w=T.cells[M];if(g>=F&&g<F+w.width){k=M;break}F+=w.width;}if(k===-1&&(k=T.cells.length-1,k<0))continue;let P=T.cells[k],S=H.cells[k];if(!P||!S)continue;let y=0;if(h>0&&b<d)for(let M=0;M<b;M++)y+=m.rows[M]?.height??0;else {y=h;for(let M=o.fromRow;M<b;M++)y+=m.rows[M]?.height??0;}let R=0;for(let M=0;M<k;M++)R+=T.cells[M]?.width??0;let _,I;if(S.blocks&&S.blocks.length>0){let M=S.blocks[0],w=P.blocks[0];M.kind==="paragraph"&&w?.kind==="paragraph"&&(_=M,I=w);}let E=g-R,C=x-y;return {fragment:o,block:c,measure:m,pageIndex:e.pageIndex,rowIndex:b,colIndex:k,cellBlock:_,cellMeasure:I,cellLocalX:Math.max(0,E),cellLocalY:Math.max(0,C)}}return null}function We(e,n,a,r){let t={pageHit:null,fragmentHit:null,tableCellHit:null};if(t.pageHit=ee(e,r),!t.pageHit)return t;let o=A(e,t.pageHit.pageIndex),s={x:r.x,y:r.y-o};return t.fragmentHit=ge(t.pageHit,n,a,s),t.fragmentHit?.fragment.kind==="table"&&(t.tableCellHit=pe(t.pageHit,n,a,s)),t}function Ge(e){if(e.pages.length===0)return 0;let n=e.pageGap??0,a=0;for(let r=0;r<e.pages.length;r++){let t=e.pages[r];a+=t.size?.h??e.pageSize.h,r<e.pages.length-1&&(a+=n);}return a}function Ve(e,n){return A(e,n)}function Ue(e,n){if(n<0||n>=e.pages.length)return null;let a=A(e,n),t=e.pages[n].size?.h??e.pageSize.h;return {top:a,bottom:a+t}}function ne(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function be(e,n){let a=[];for(let r=n.fromRun;r<=n.toRun&&r<e.runs.length;r++){let t=e.runs[r];if(t){if(t.kind==="tab"||t.kind==="image"||t.kind==="lineBreak"){a.push(t);continue}if(t.kind==="text"){let o=t.text??"",s=r===n.fromRun,i=r===n.toRun;if(s||i){let l=s?n.fromChar:0,f=i?n.toChar:o.length,u=o.slice(l,f);u.length>0&&a.push({...t,text:u});}else a.push(t);}}}return a}function xe(e,n){let a,r,t=e.pmStart??0,o=0;for(let s=0;s<e.runs.length&&s<=n.toRun;s++){let i=e.runs[s];i&&(s<n.fromRun?i.kind==="text"?o+=(i.text??"").length:(i.kind==="tab"||i.kind==="lineBreak"||i.kind==="image")&&(o+=1):s===n.fromRun&&(o+=n.fromChar,a=t+o,i.kind==="text"&&(o=n.fromChar)));}if(a!==void 0){let s=0;for(let i=n.fromRun;i<=n.toRun&&i<e.runs.length;i++){let l=e.runs[i];if(l)if(l.kind==="text"){let f=l.text??"",u=i===n.fromRun?n.fromChar:0,c=i===n.toRun?n.toChar:f.length;s+=c-u;}else (l.kind==="tab"||l.kind==="lineBreak"||l.kind==="image")&&(s+=1);}r=a+s;}return {pmStart:a,pmEnd:r}}function $e(e,n,a,r){let t=0;for(let o=a;o<r&&o<e.lines.length;o++){let i=e.lines[o].lineHeight;if(n>=t&&n<t+i)return o;t+=i;}return r>a?Math.min(r-1,e.lines.length-1):null}function qe(e,n,a,r){let{pmStart:t,pmEnd:o}=xe(e,n);if(t===void 0||o===void 0)return {charOffset:0,pmPosition:e.pmStart??0};let s=e.attrs?.alignment??"left",i=0;s==="center"?i=Math.max(0,(r-n.width)/2):s==="right"&&(i=Math.max(0,r-n.width));let l$1=Math.max(0,a-i);if(l$1<=0)return {charOffset:0,pmPosition:t};let f=be(e,n);if(f.length===0)return {charOffset:0,pmPosition:t};let u=0,c=0;for(let g of f){if(g.kind==="tab"){let x=g.width??48,d=u+x;if(l$1<=d){let h=u+x/2;return l$1<h?{charOffset:c,pmPosition:t+c}:{charOffset:c+1,pmPosition:t+c+1}}u=d,c+=1;continue}if(g.kind==="image"){let x=g.width,d=u+x;if(l$1<=d){let h=u+x/2;return l$1<h?{charOffset:c,pmPosition:t+c}:{charOffset:c+1,pmPosition:t+c+1}}u=d,c+=1;continue}if(g.kind==="lineBreak"){if(l$1>=u)return {charOffset:c,pmPosition:t+c};c+=1;continue}if(g.kind==="text"){let x=g.text??"";if(x.length===0)continue;let d=ne(g),h=k(x,d),p=u+h.width;if(l$1<=p){let b=l$1-u,T=l(b,h.charWidths),H=c+T;return {charOffset:H,pmPosition:t+H}}u=p,c+=x.length;}}return {charOffset:o-t,pmPosition:o}}function oe(e){let{fragment:n,block:a,measure:r,localX:t,localY:o}=e;if(n.kind!=="paragraph"||a.kind!=="paragraph"||r.kind!=="paragraph")return null;let s=n,i=a,l=r,f=$e(l,o,s.fromLine,s.toLine);if(f===null)return null;let u=l.lines[f];if(!u)return null;let c=0;for(let T=s.fromLine;T<f;T++)c+=l.lines[T]?.lineHeight??0;let m=i.attrs?.indent,g=m?.left??0,x=m?.right??0,d=Math.max(0,n.width-g-x),h=t-g,{charOffset:p,pmPosition:b}=qe(i,u,h,d);return {pmPosition:b,charOffset:p,lineIndex:f}}function ke(e){let{cellBlock:n,cellMeasure:a,cellLocalX:r,cellLocalY:t}=e;if(!n||!a)return null;let o={fragment:{kind:"paragraph",blockId:n.id,x:0,y:0,width:a.lines.reduce((i,l)=>Math.max(i,l.width),100),fromLine:0,toLine:a.lines.length,height:a.totalHeight},block:n,measure:a,pageIndex:e.pageIndex,localX:r,localY:t};return oe(o)?.pmPosition??null}function je(e,n){if(n)return ke(n);if(!e)return null;let{fragment:a}=e;return a.kind==="paragraph"?oe(e)?.pmPosition??null:a.kind==="image"?a.pmStart??null:null}function Te(e,n,a,r){let t=e.pmStart??0,o=e.pmEnd??t;if(a<t||a>o)return null;let s=a-t;for(let i=0;i<n.lines.length;i++){let l=n.lines[i],{pmStart:f,pmEnd:u}=xe(e,l);if(f===void 0||u===void 0)continue;let c=f-t,m=u-t;if(s>=c&&s<=m){let g=s-c,x=be(e,l),d=0,h=0;for(let p of x)if(p.kind==="tab"){if(g<=h+1)return g<=h?{x:d,lineIndex:i}:{x:d+(p.width??48),lineIndex:i};d+=p.width??48,h+=1;}else if(p.kind==="image"){if(g<=h+1)return g<=h?{x:d,lineIndex:i}:{x:d+p.width,lineIndex:i};d+=p.width,h+=1;}else if(p.kind==="lineBreak"){if(g<=h)return {x:d,lineIndex:i};h+=1;}else if(p.kind==="text"){let b=p.text??"";if(g<=h+b.length){let F=g-h,k$1=ne(p),P=k(b.slice(0,F),k$1);return {x:d+P.width,lineIndex:i}}let T=ne(p),H=k(b,T);d+=H.width,h+=b.length;}return {x:d,lineIndex:i}}}return null}function Je(e,n,a,r,t,o,s){let i=Te(e,n,a);if(!i)return null;let l=e.attrs?.alignment??"left",f=e.attrs?.indent,u=f?.left??0,c=f?.right??0,m=Math.max(0,o-u-c),g=n.lines[i.lineIndex];if(!g)return null;let x=0;l==="center"?x=Math.max(0,(m-g.width)/2):l==="right"&&(x=Math.max(0,m-g.width));let d=0;for(let h=s;h<i.lineIndex;h++)d+=n.lines[h]?.lineHeight??0;return {x:r+u+x+i.x,y:t+d,height:g.lineHeight}}function Ke(e,n,a={}){let r=a.scope??"body",t=r==="body"?"layout-page-content":`layout-page-${r}`,o=`.${t} .layout-table-cell`,s=e.querySelectorAll(`.${t} .layout-table-cell-selected`);for(let c of Array.from(s))c.classList.remove("layout-table-cell-selected");let i=n.selection;if(!("$anchorCell"in i&&typeof i.forEachCell=="function")||!i.forEachCell)return;let f=[];i.forEachCell((c,m)=>{f.push([m,m+c.nodeSize]);});let u=e.querySelectorAll(o);for(let c of Array.from(u)){let m=c,g=m.dataset.pmStart;if(g===void 0)continue;let x=Number(g);for(let[d,h]of f)if(x>=d&&x<h){m.classList.add("layout-table-cell-selected");break}}}function Me(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function re(e,n){return e.findIndex(a=>a.id===n)}function V(e,n){let r=(e.pmStart??0)+1,t=0,o;for(let l=0;l<e.runs.length&&l<=n.toRun;l++){let f=e.runs[l];if(f){if(l<n.fromRun)f.kind==="text"?t+=(f.text??"").length:t+=1;else if(l===n.fromRun){t+=n.fromChar,o=r+t;break}}}o===void 0&&(o=r);let s=0;for(let l=n.fromRun;l<=n.toRun&&l<e.runs.length;l++){let f=e.runs[l];if(f)if(f.kind==="text"){let u=f.text??"",c=l===n.fromRun?n.fromChar:0,m=l===n.toRun?n.toChar:u.length;s+=m-c;}else s+=1;}let i=o+s;return {pmStart:o,pmEnd:i}}function Fe(e,n,a,r){let t=[];for(let o=0;o<n.lines.length;o++){let s=n.lines[o],i=V(e,s);i.pmStart===void 0||i.pmEnd===void 0||i.pmEnd>a&&i.pmStart<r&&t.push({line:s,index:o});}return t}function W(e,n,a){let r=V(e,n);return r.pmStart===void 0?0:Math.max(0,a-r.pmStart)}function G(e,n,a,r){let t=0,o=0;for(let s=n.fromRun;s<=n.toRun&&s<e.runs.length;s++){let i=e.runs[s];if(i){if(i.kind==="tab"){let l=i.width??48;if(o+1>=a)return a<=o?t:t+l;t+=l,o+=1;continue}if(i.kind==="image"){let l=i.width;if(o+1>=a)return a<=o?t:t+l;t+=l,o+=1;continue}if(i.kind==="lineBreak"){if(a<=o)return t;o+=1;continue}if(i.kind==="text"){let l=i.text??"",f=s===n.fromRun,u=s===n.toRun,c=f?n.fromChar:0,m=u?n.toChar:l.length,g=l.slice(c,m);if(o+g.length>=a){let h=a-o,p=Me(i),b=k(g.slice(0,h),p);return t+b.width}let x=Me(i),d=k(g,x);t+=d.width,o+=g.length;}}}return t}function J(e,n){let a=0;for(let r=0;r<n&&r<e.lines.length;r++)a+=e.lines[r].lineHeight;return a}function Qe(e,n,a,r,t){if(r===t)return [];let o=Math.min(r,t),s=Math.max(r,t),i=[];for(let l=0;l<e.pages.length;l++){let f=e.pages[l],u=A(e,l);for(let c of f.fragments){if(c.kind==="paragraph"){let m=re(n,c.blockId);if(m===-1)continue;let g=n[m],x=a[m];if(!g||g.kind!=="paragraph"||!x||x.kind!=="paragraph")continue;let d=g,h=x,p=c,b=Fe(d,h,o,s);for(let{line:T,index:H}of b){if(H<p.fromLine||H>=p.toLine)continue;let F=V(d,T);if(F.pmStart===void 0||F.pmEnd===void 0)continue;let k=Math.max(F.pmStart,o),P=Math.min(F.pmEnd,s);if(k>=P)continue;let S=W(d,T,k),y=W(d,T,P),B=d.attrs?.indent,R=B?.left??0,_=B?.right??0,I=Math.max(0,c.width-R-_),E=G(d,T,S),C=G(d,T,y),M=d.attrs?.alignment??"left",w=0;M==="center"?w=Math.max(0,(I-T.width)/2):M==="right"&&(w=Math.max(0,I-T.width));let L=J(h,H)-J(h,p.fromLine),D=c.x+R+w+Math.min(E,C),Y=Math.max(1,Math.abs(C-E)),z=c.y+L;i.push({x:D,y:z+u,width:Y,height:T.lineHeight,pageIndex:l});}}if(c.kind==="table"){let m=re(n,c.blockId);if(m===-1)continue;let g=n[m],x=a[m];if(!g||g.kind!=="table"||!x||x.kind!=="table")continue;let d=g,h=x,p=c,b=[],T=0;for(let y=0;y<h.rows.length;y++)b.push(Math.round(T)),T+=h.rows[y]?.height??0;b.push(Math.round(T));let H=p.headerRowCount??0,F=H>0&&p.continuesFromPrev?V$1(h,H):0,k=(b[p.fromRow]??0)+(p.topClip??0),P=p.bottomClip!==void 0?Math.round(p.height):F+((b[p.toRow]??0)-k),S=y=>F+(y-k);for(let y=p.fromRow;y<p.toRow&&y<d.rows.length;y++){let B=d.rows[y],R=h.rows[y];if(!B||!R)continue;let _=b[y]??0,I=0;for(let E=0;E<B.cells.length;E++){let C=B.cells[E],M=R.cells[E];if(!C||!M)continue;let w=C.padding?.top??0,L$1=L(C.blocks,M.blocks,w);for(let D=0;D<C.blocks.length;D++){let Y=C.blocks[D],z=M.blocks[D];if(!Y||Y.kind!=="paragraph"||!z||z.kind!=="paragraph")continue;let X=Y,Ae=z,De=L$1.lineTops[D]??[],ve=Fe(X,Ae,o,s);for(let{line:v,index:Oe}of ve){let q=V(X,v);if(q.pmStart===void 0||q.pmEnd===void 0)continue;let ae=Math.max(q.pmStart,o),se=Math.min(q.pmEnd,s);if(ae>=se)continue;let Q=S(_+(De[Oe]??0));if(Q+v.lineHeight<=F||Q>=P)continue;let _e=W(X,v,ae),Xe=W(X,v,se),le=G(X,v,_e,M.width),ce=G(X,v,Xe,M.width);i.push({x:p.x+I+Math.min(le,ce),y:p.y+Q+u,width:Math.max(1,Math.abs(ce-le)),height:v.lineHeight,pageIndex:l});}}I+=M.width;}}}if(c.kind==="image"){let m=c.pmStart??0;(c.pmEnd??m+1)>o&&m<s&&i.push({x:c.x,y:c.y+u,width:c.width,height:c.height,pageIndex:l});}}}return i}function Ze(e,n,a,r){for(let t=0;t<e.pages.length;t++){let o=e.pages[t],s=A(e,t);for(let i of o.fragments){if(i.kind==="paragraph"){let l=re(n,i.blockId);if(l===-1)continue;let f=n[l],u=a[l];if(!f||f.kind!=="paragraph"||!u||u.kind!=="paragraph")continue;let c=f,m=u,g=i,x=c.pmStart??0,d=c.pmEnd??x;if(r<x||r>d)continue;for(let h=g.fromLine;h<g.toLine;h++){let p=m.lines[h];if(!p)continue;let b=V(c,p);if(!(b.pmStart===void 0||b.pmEnd===void 0)&&r>=b.pmStart&&r<=b.pmEnd){let T=W(c,p,r),H=c.attrs?.indent,F=H?.left??0,k=H?.right??0,P=Math.max(0,i.width-F-k),S=G(c,p,T),y=c.attrs?.alignment??"left",B=0;y==="center"?B=Math.max(0,(P-p.width)/2):y==="right"&&(B=Math.max(0,P-p.width));let R=J(m,h)-J(m,g.fromLine);return {x:i.x+F+B+S,y:i.y+R+s,height:p.lineHeight,pageIndex:t}}}}if(i.kind==="image"){let l=i.pmStart??0,f=i.pmEnd??l+1;if(r>=l&&r<=f){let u=r===l?0:i.width;return {x:i.x+u,y:i.y+s,height:i.height,pageIndex:t}}}}}return null}function et(e){return e.length<=1?false:new Set(e.map(a=>a.pageIndex)).size>1}function tt(e){let n=new Map;for(let a of e){let r=n.get(a.pageIndex)??[];r.push(a),n.set(a.pageIndex,r);}return n}function nt(e){if(e.kind!=="paragraph")return false;let n=e.attrs;return n?!!(n.borders?.top||n.borders?.bottom||n.spacingExplicit?.before||n.spacingExplicit?.after):false}function ye(e){return He(e)}function He(e){let n=new Set;for(let a=1;a<e.length;a++){let r=e[a-1],t=e[a];r.kind==="table"&&t.kind==="paragraph"&&(t.runs.length>0||nt(t)||n.add(a));}return e.map((a,r)=>{if(a.kind==="table")return ot(a);if(a.kind!=="paragraph")return a;let t=n.has(r),o=a.attrs?.spacingExplicit,s=a.attrs?.spacing?.before!=null,i=a.attrs?.spacing?.after!=null,l=s&&!o?.before,f=i&&!o?.after,u=l||f;if(!u&&!t)return a;let c=a.attrs;return u&&c?.spacing&&(c={...c,spacing:{...c.spacing,before:o?.before?c.spacing.before:void 0,after:o?.after?c.spacing.after:void 0}}),t&&(c={...c??{},suppressEmptyParagraphHeight:true}),{...a,attrs:c}})}function ot(e){let n=false,a=e.rows.map(r=>{let t=false,o=r.cells.map(s=>{let i=He(s.blocks);return i.some((f,u)=>f!==s.blocks[u])?(t=true,{...s,blocks:i}):s});return t?(n=true,{...r,cells:o}):r});return n?{...e,rows:a}:e}function rt(e){return e?.align??e?.alignment}function we(e$1,n,a,r){let t=r.section==="header"?r.margins.header??48:r.pageSize.h-(r.margins.footer??48)-a,o=e$1.position?.vertical;if(!o)return n;let s=rt(o),i=o.posOffset!==void 0?e(o.posOffset):void 0;if(o.relativeTo==="page"){if(i!==void 0)return i-t;if(s==="top")return -t;if(s==="bottom")return r.pageSize.h-e$1.height-t;if(s==="center")return (r.pageSize.h-e$1.height)/2-t}if(o.relativeTo==="margin"){let l=r.margins.top,f=r.pageSize.h-r.margins.top-r.margins.bottom;if(i!==void 0)return l+i-t;if(s==="top")return l-t;if(s==="bottom")return l+f-e$1.height-t;if(s==="center")return l+(f-e$1.height)/2-t}return i!==void 0?n+i:n}function Pe(e){switch(e.kind){case "paragraph":case "table":return true;case "image":return !e.anchor?.isAnchored;case "textBox":return e.displayMode===void 0||e.displayMode==="inline";default:return false}}function it(e){return e?e.kind==="paragraph"||e.kind==="table"?e.totalHeight:e.kind==="image"||e.kind==="textBox"?e.height:0:0}function Se(e,n,a,r){let t=0,o=0,s=0;for(let i=0;i<e.length;i++){let l=e[i],f=n[i];if(!(!l||!f)){if(l.kind==="paragraph"&&f.kind==="paragraph"){let u=s,c=u+f.totalHeight;t=Math.min(t,u),o=Math.max(o,c);for(let m of l.runs){if(m.kind!=="image"||!m.position)continue;let g=we(m,u,a,r);t=Math.min(t,g),o=Math.max(o,g+m.height);}s=c;}else if(l.kind==="table"&&f.kind==="table"){let u=s+f.totalHeight;t=Math.min(t,s),o=Math.max(o,u),s=u;}else if(l.kind==="image"&&f.kind==="image"){let u=s+f.height;t=Math.min(t,s),o=Math.max(o,u),s=u;}else if(l.kind==="textBox"&&f.kind==="textBox"){let u=s+f.height;t=Math.min(t,s),o=Math.max(o,u),l.displayMode!=="float"&&(s=u);}}}return {visualTop:t,visualBottom:o}}function at(e,n,a,r){if(!e||!e.content||e.content.length===0)return;let t=b(e.content,{styles:r.styles??void 0,theme:r.theme??null,defaultTabStopTwips:r.defaultTabStopTwips??null});return Be(t,n,a,r)}function Be(e,n,a,r){let t=c(e,{theme:r.theme??void 0});if(t.length===0)return;let o=ye(t),s=r.measureBlocks(o,n),i=0,l=0;for(let c=0;c<o.length;c++){let m=it(s[c]);i+=m,Pe(o[c])&&(l+=m);}let{visualTop:f,visualBottom:u}=Se(o,s,i,a);return {blocks:o,measures:s,height:i,flowHeight:l,visualTop:f,visualBottom:u}}var K={header:null,footer:null};function st(){K.header=null,K.footer=null;}function Re(e,n){let a=n.querySelectorAll(`.layout-page-${e}`);if(a.length===0)return null;let r=n.defaultView,t=r?r.innerHeight/2:0,o=a[0],s=1/0;for(let c of Array.from(a)){let m=c.getBoundingClientRect(),g=Math.abs((m.top+m.bottom)/2-t);g<s&&(s=g,o=c);}let i=K[e];if(i&&i.host===o&&i.host.isConnected)return i;let l=Array.from(o.querySelectorAll("span[data-pm-start][data-pm-end]")),f=Array.from(o.querySelectorAll("[data-pm-start][data-pm-end]")),u={host:o,spans:l,ranged:f};return K[e]=u,u}function lt(e,n,a=globalThis.document){let r=e.state.selection;if(!r.empty)return null;let t=r.head,o=Re(n,a);if(!o)return null;let{host:s,spans:i}=o;for(let d of i){let h=Number(d.dataset.pmStart),p=Number(d.dataset.pmEnd);if(!(!Number.isFinite(h)||!Number.isFinite(p))&&t>=h&&t<=p){let b=s.ownerDocument.createRange(),T=s.ownerDocument.createTreeWalker(d,NodeFilter.SHOW_TEXT),H=t-h,F=T.nextNode();for(;F;){let S=F.data.length;if(H<=S){try{b.setStart(F,H),b.setEnd(F,H);let y=b.getClientRects()[0]??b.getBoundingClientRect();if(y&&y.height>0)return {top:y.top,left:y.left,height:y.height}}catch{}break}H-=S,F=T.nextNode();}let k=d.getBoundingClientRect(),P=(t-h)/Math.max(1,p-h);return {top:k.top,left:k.left+k.width*P,height:k.height}}}let l=s.querySelector(`[data-pm-start="${t}"]`);if(l){let d=l.getBoundingClientRect();return {top:d.top,left:d.left+1,height:d.height||16}}let f=o.ranged,u=null,c=1/0;for(let d of f){let h=Number(d.dataset.pmStart),p=Number(d.dataset.pmEnd);if(!Number.isFinite(h)||!Number.isFinite(p)||t<h||t>p)continue;let b=p-h;b<c&&(c=b,u=d);}if(u){let d=u.getBoundingClientRect(),h=Number(u.dataset.pmEnd),p=t>=h;return {top:d.top,left:p?d.right:d.left+1,height:d.height||16}}let m=null,g=-1/0;for(let d of f){let h=Number(d.dataset.pmStart);Number.isFinite(h)&&(h>t||h>g&&(g=h,m=d));}if(m){let d=m.getBoundingClientRect();return {top:d.top,left:d.right,height:d.height||16}}let x=s.getBoundingClientRect();return {top:x.top+2,left:x.left+2,height:16}}function ct(e,n,a=globalThis.document){let r=e.state.selection;if(r.empty)return [];let t=r.from,o=r.to,s=[],i=Re(n,a);if(!i)return s;let{host:l,spans:f}=i;for(let u of f){let c=Number(u.dataset.pmStart),m=Number(u.dataset.pmEnd);if(!Number.isFinite(c)||!Number.isFinite(m)||m<=t||c>=o)continue;if(u.classList.contains("layout-run-tab")){let p=u.getBoundingClientRect();s.push({top:p.top,left:p.left,width:p.width,height:p.height});continue}let g=null;if(u.firstChild?.nodeType===Node.TEXT_NODE?g=u.firstChild:u.firstChild?.nodeType===Node.ELEMENT_NODE&&u.firstChild.tagName==="A"&&u.firstChild.firstChild?.nodeType===Node.TEXT_NODE&&(g=u.firstChild.firstChild),!g)continue;let x=Math.max(0,t-c),d=Math.min(g.length,o-c);if(x>=d)continue;let h=l.ownerDocument.createRange();h.setStart(g,x),h.setEnd(g,d);for(let p of Array.from(h.getClientRects()))s.push({top:p.top,left:p.left,width:p.width,height:p.height});}return s}function Ie(e){return e?e.flowHeight??e.height:0}function ut(e){let{pageSize:n,margins:a,finalMargins:r,bodyBlocks:t,headers:o,footers:s,warn:i}=e,l=a.header??48,f=a.footer??48,u=a.top-l,c=a.bottom-f,m=Math.max(0,...(o??[]).map(Ie)),g=Math.max(0,...(s??[]).map(Ie)),x=m>u,d=g>c;if(!x&&!d)return {margins:a,finalMargins:r};let h=Math.max(0,n.h-24),p=false,b=F=>{let k={...F};return x&&(k.top=Math.max(F.top,l+m)),d&&(k.bottom=Math.max(F.bottom,f+g)),k.top+k.bottom>h&&(p=true,k.bottom=Math.max(0,Math.min(k.bottom,h-k.top)),k.top+k.bottom>h&&(k.top=Math.max(0,h-k.bottom))),k},T=b(a),H=b(r);if(t)for(let F of t){if(F.kind!=="sectionBreak")continue;let k=F;k.margins&&(k.margins=b(k.margins));}return p&&i&&i(`[layout] header/footer content exceeds page height; clamping margins to preserve a content area. pageHeight=${Math.round(n.h)} headerBand=${Math.round(m)} footerBand=${Math.round(g)} top=${Math.round(T.top)} bottom=${Math.round(T.bottom)}`),{margins:T,finalMargins:H}}var Ce=816,Ee=1056,U=96,ie=48;function $(e){return Math.round(e/1440*96)}function N(e,n){return e!=null?$(e):n}function ft(e){return {w:e?.pageWidth?$(e.pageWidth):Ce,h:e?.pageHeight?$(e.pageHeight):Ee}}function dt(e){return {top:N(e?.marginTop,U),right:N(e?.marginRight,U),bottom:N(e?.marginBottom,U),left:N(e?.marginLeft,U),header:N(e?.headerDistance,ie),footer:N(e?.footerDistance,ie)}}function ht(e,n){let a={header:null,footer:null,firstHeader:null,firstFooter:null};if(!e?.package)return a;let r=e.package.headers,t=e.package.footers,o=null,s=null,i=null,l=null;if(r&&n?.headerReferences){let f=n.headerReferences.find(c=>c.type==="default");f?.rId&&(o=r.get(f.rId)??null);let u=n.headerReferences.find(c=>c.type==="first");u?.rId&&(i=r.get(u.rId)??null);}if(t&&n?.footerReferences){let f=n.footerReferences.find(c=>c.type==="default");f?.rId&&(s=t.get(f.rId)??null);let u=n.footerReferences.find(c=>c.type==="first");u?.rId&&(l=t.get(u.rId)??null);}return n?.titlePg||(!o&&i&&(o=i),!s&&l&&(s=l)),{header:o,footer:s,firstHeader:i,firstFooter:l}}function mt(e){let n=e?.columnCount??1;if(n<=1)return;let a=$(e?.columnSpace??720);return {count:n,gap:a,equalWidth:e?.equalWidth??true,separator:e?.separator}}function Le(e){let n=e.pageSize.w-e.margins.left-e.margins.right,a=e.columns;return !a||a.count<=1?n:Math.floor((n-(a.count-1)*a.gap)/a.count)}function gt(e,n,a){let{configs:r,breakIndices:t}=T(e,n,a),o=0,s=[];for(let i=0;i<e.length;i++)s.push(Le(r[o]??n)),o<t.length&&i===t[o]&&o++;return s}export{st as A,lt as B,ct as C,ut as D,Ce as E,Ee as F,U as G,ie as H,$ as I,ft as J,dt as K,ht as L,mt as M,Le as N,gt as O,ee as a,A as b,Ne as c,ge as d,ze as e,pe as f,We as g,Ge as h,Ve as i,Ue as j,oe as k,ke as l,je as m,Te as n,Je as o,Ke as p,Qe as q,Ze as r,et as s,tt as t,ye as u,we as v,Pe as w,Se as x,at as y,Be as z};
@@ -0,0 +1 @@
1
+ 'use strict';var chunkYPQACU4A_js=require('./chunk-YPQACU4A.js'),chunkRSU4HTC6_js=require('./chunk-RSU4HTC6.js'),chunkXLB6AC5Q_js=require('./chunk-XLB6AC5Q.js'),chunk4Q2IP5FW_js=require('./chunk-4Q2IP5FW.js');function ee(e,n){if(e.pages.length===0)return null;let a=e.pageGap??0,r=0,t=null,o=1/0;for(let s=0;s<e.pages.length;s++){let i=e.pages[s],l=i.size?.h??e.pageSize.h,f=r,u=f+l;if(n.y>=f&&n.y<u)return {pageIndex:s,page:i,pageY:n.y-f};let c=f+l/2,m=Math.abs(n.y-c);m<o&&(o=m,t=s),r=u+a;}if(t!==null){let s=e.pages[t],i=A(e,t);return {pageIndex:t,page:s,pageY:Math.max(0,Math.min(n.y-i,s.size?.h??e.pageSize.h))}}return null}function A(e,n){let a=e.pageGap??0,r=0;for(let t=0;t<n&&t<e.pages.length;t++){let s=e.pages[t].size?.h??e.pageSize.h;r+=s+a;}return r}function Ne(e,n){return ee(e,{y:n})?.pageIndex??null}function te(e,n){return e.findIndex(a=>a.id===n)}function Ye(e,n){let a=0;for(let r=e.fromLine;r<e.toLine&&r<n.lines.length;r++)a+=n.lines[r].lineHeight;return a}function ge(e,n,a,r){let t=[...e.page.fragments].sort((o,s)=>{let i=o.y-s.y;return Math.abs(i)>.5?i:o.x-s.x});for(let o of t){let s=te(n,o.blockId);if(s===-1)continue;let i=n[s],l=a[s];if(!i||!l)continue;let f;if(o.kind==="paragraph"){if(i.kind!=="paragraph"||l.kind!=="paragraph")continue;f=Ye(o,l);}else if(o.kind==="table")f=o.height;else if(o.kind==="image")f=o.height;else continue;let u=r.x>=o.x&&r.x<=o.x+o.width,c=r.y>=o.y&&r.y<=o.y+f;if(u&&c)return {fragment:o,block:i,measure:l,pageIndex:e.pageIndex,localX:r.x-o.x,localY:r.y-o.y}}return null}function ze(e,n,a,r){for(let t of e.page.fragments){if(t.kind!=="image")continue;let o=te(n,t.blockId);if(o===-1)continue;let s=n[o],i=a[o];if(!s||!i)continue;let l=r.x>=t.x&&r.x<=t.x+t.width,f=r.y>=t.y&&r.y<=t.y+t.height;if(l&&f)return {fragment:t,block:s,measure:i,pageIndex:e.pageIndex,localX:r.x-t.x,localY:r.y-t.y}}return null}function pe(e,n,a,r){for(let t of e.page.fragments){if(t.kind!=="table")continue;let o=t,s=r.x>=o.x&&r.x<=o.x+o.width,i=r.y>=o.y&&r.y<=o.y+o.height;if(!s||!i)continue;let l=te(n,o.blockId);if(l===-1)continue;let f=n[l],u=a[l];if(!f||f.kind!=="table"||!u||u.kind!=="table")continue;let c=f,m=u,g=r.x-o.x,x=r.y-o.y,d=o.headerRowCount??0,h=d>0&&o.continuesFromPrev?chunkRSU4HTC6_js.V(m,d):0,p=0,b=-1;if(m.rows.length===0||c.rows.length===0)continue;if(h>0&&x<h){let M=0;for(let w=0;w<d&&w<m.rows.length;w++){let L=m.rows[w];if(x>=M&&x<M+L.height){b=w;break}M+=L.height;}b===-1&&(b=0);}else {let M=x-h;for(let w=o.fromRow;w<o.toRow&&w<m.rows.length;w++){let L=m.rows[w];if(M>=p&&M<p+L.height){b=w;break}p+=L.height;}}if(b===-1&&(b=Math.min(o.toRow-1,m.rows.length-1),b<o.fromRow))continue;let T=m.rows[b],H=c.rows[b];if(!T||!H)continue;let F=0,k=-1;if(T.cells.length===0||H.cells.length===0)continue;for(let M=0;M<T.cells.length;M++){let w=T.cells[M];if(g>=F&&g<F+w.width){k=M;break}F+=w.width;}if(k===-1&&(k=T.cells.length-1,k<0))continue;let P=T.cells[k],S=H.cells[k];if(!P||!S)continue;let y=0;if(h>0&&b<d)for(let M=0;M<b;M++)y+=m.rows[M]?.height??0;else {y=h;for(let M=o.fromRow;M<b;M++)y+=m.rows[M]?.height??0;}let R=0;for(let M=0;M<k;M++)R+=T.cells[M]?.width??0;let _,I;if(S.blocks&&S.blocks.length>0){let M=S.blocks[0],w=P.blocks[0];M.kind==="paragraph"&&w?.kind==="paragraph"&&(_=M,I=w);}let E=g-R,C=x-y;return {fragment:o,block:c,measure:m,pageIndex:e.pageIndex,rowIndex:b,colIndex:k,cellBlock:_,cellMeasure:I,cellLocalX:Math.max(0,E),cellLocalY:Math.max(0,C)}}return null}function We(e,n,a,r){let t={pageHit:null,fragmentHit:null,tableCellHit:null};if(t.pageHit=ee(e,r),!t.pageHit)return t;let o=A(e,t.pageHit.pageIndex),s={x:r.x,y:r.y-o};return t.fragmentHit=ge(t.pageHit,n,a,s),t.fragmentHit?.fragment.kind==="table"&&(t.tableCellHit=pe(t.pageHit,n,a,s)),t}function Ge(e){if(e.pages.length===0)return 0;let n=e.pageGap??0,a=0;for(let r=0;r<e.pages.length;r++){let t=e.pages[r];a+=t.size?.h??e.pageSize.h,r<e.pages.length-1&&(a+=n);}return a}function Ve(e,n){return A(e,n)}function Ue(e,n){if(n<0||n>=e.pages.length)return null;let a=A(e,n),t=e.pages[n].size?.h??e.pageSize.h;return {top:a,bottom:a+t}}function ne(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function be(e,n){let a=[];for(let r=n.fromRun;r<=n.toRun&&r<e.runs.length;r++){let t=e.runs[r];if(t){if(t.kind==="tab"||t.kind==="image"||t.kind==="lineBreak"){a.push(t);continue}if(t.kind==="text"){let o=t.text??"",s=r===n.fromRun,i=r===n.toRun;if(s||i){let l=s?n.fromChar:0,f=i?n.toChar:o.length,u=o.slice(l,f);u.length>0&&a.push({...t,text:u});}else a.push(t);}}}return a}function xe(e,n){let a,r,t=e.pmStart??0,o=0;for(let s=0;s<e.runs.length&&s<=n.toRun;s++){let i=e.runs[s];i&&(s<n.fromRun?i.kind==="text"?o+=(i.text??"").length:(i.kind==="tab"||i.kind==="lineBreak"||i.kind==="image")&&(o+=1):s===n.fromRun&&(o+=n.fromChar,a=t+o,i.kind==="text"&&(o=n.fromChar)));}if(a!==void 0){let s=0;for(let i=n.fromRun;i<=n.toRun&&i<e.runs.length;i++){let l=e.runs[i];if(l)if(l.kind==="text"){let f=l.text??"",u=i===n.fromRun?n.fromChar:0,c=i===n.toRun?n.toChar:f.length;s+=c-u;}else (l.kind==="tab"||l.kind==="lineBreak"||l.kind==="image")&&(s+=1);}r=a+s;}return {pmStart:a,pmEnd:r}}function $e(e,n,a,r){let t=0;for(let o=a;o<r&&o<e.lines.length;o++){let i=e.lines[o].lineHeight;if(n>=t&&n<t+i)return o;t+=i;}return r>a?Math.min(r-1,e.lines.length-1):null}function qe(e,n,a,r){let{pmStart:t,pmEnd:o}=xe(e,n);if(t===void 0||o===void 0)return {charOffset:0,pmPosition:e.pmStart??0};let s=e.attrs?.alignment??"left",i=0;s==="center"?i=Math.max(0,(r-n.width)/2):s==="right"&&(i=Math.max(0,r-n.width));let l=Math.max(0,a-i);if(l<=0)return {charOffset:0,pmPosition:t};let f=be(e,n);if(f.length===0)return {charOffset:0,pmPosition:t};let u=0,c=0;for(let g of f){if(g.kind==="tab"){let x=g.width??48,d=u+x;if(l<=d){let h=u+x/2;return l<h?{charOffset:c,pmPosition:t+c}:{charOffset:c+1,pmPosition:t+c+1}}u=d,c+=1;continue}if(g.kind==="image"){let x=g.width,d=u+x;if(l<=d){let h=u+x/2;return l<h?{charOffset:c,pmPosition:t+c}:{charOffset:c+1,pmPosition:t+c+1}}u=d,c+=1;continue}if(g.kind==="lineBreak"){if(l>=u)return {charOffset:c,pmPosition:t+c};c+=1;continue}if(g.kind==="text"){let x=g.text??"";if(x.length===0)continue;let d=ne(g),h=chunkRSU4HTC6_js.k(x,d),p=u+h.width;if(l<=p){let b=l-u,T=chunkRSU4HTC6_js.l(b,h.charWidths),H=c+T;return {charOffset:H,pmPosition:t+H}}u=p,c+=x.length;}}return {charOffset:o-t,pmPosition:o}}function oe(e){let{fragment:n,block:a,measure:r,localX:t,localY:o}=e;if(n.kind!=="paragraph"||a.kind!=="paragraph"||r.kind!=="paragraph")return null;let s=n,i=a,l=r,f=$e(l,o,s.fromLine,s.toLine);if(f===null)return null;let u=l.lines[f];if(!u)return null;let c=0;for(let T=s.fromLine;T<f;T++)c+=l.lines[T]?.lineHeight??0;let m=i.attrs?.indent,g=m?.left??0,x=m?.right??0,d=Math.max(0,n.width-g-x),h=t-g,{charOffset:p,pmPosition:b}=qe(i,u,h,d);return {pmPosition:b,charOffset:p,lineIndex:f}}function ke(e){let{cellBlock:n,cellMeasure:a,cellLocalX:r,cellLocalY:t}=e;if(!n||!a)return null;let o={fragment:{kind:"paragraph",blockId:n.id,x:0,y:0,width:a.lines.reduce((i,l)=>Math.max(i,l.width),100),fromLine:0,toLine:a.lines.length,height:a.totalHeight},block:n,measure:a,pageIndex:e.pageIndex,localX:r,localY:t};return oe(o)?.pmPosition??null}function je(e,n){if(n)return ke(n);if(!e)return null;let{fragment:a}=e;return a.kind==="paragraph"?oe(e)?.pmPosition??null:a.kind==="image"?a.pmStart??null:null}function Te(e,n,a,r){let t=e.pmStart??0,o=e.pmEnd??t;if(a<t||a>o)return null;let s=a-t;for(let i=0;i<n.lines.length;i++){let l=n.lines[i],{pmStart:f,pmEnd:u}=xe(e,l);if(f===void 0||u===void 0)continue;let c=f-t,m=u-t;if(s>=c&&s<=m){let g=s-c,x=be(e,l),d=0,h=0;for(let p of x)if(p.kind==="tab"){if(g<=h+1)return g<=h?{x:d,lineIndex:i}:{x:d+(p.width??48),lineIndex:i};d+=p.width??48,h+=1;}else if(p.kind==="image"){if(g<=h+1)return g<=h?{x:d,lineIndex:i}:{x:d+p.width,lineIndex:i};d+=p.width,h+=1;}else if(p.kind==="lineBreak"){if(g<=h)return {x:d,lineIndex:i};h+=1;}else if(p.kind==="text"){let b=p.text??"";if(g<=h+b.length){let F=g-h,k=ne(p),P=chunkRSU4HTC6_js.k(b.slice(0,F),k);return {x:d+P.width,lineIndex:i}}let T=ne(p),H=chunkRSU4HTC6_js.k(b,T);d+=H.width,h+=b.length;}return {x:d,lineIndex:i}}}return null}function Je(e,n,a,r,t,o,s){let i=Te(e,n,a);if(!i)return null;let l=e.attrs?.alignment??"left",f=e.attrs?.indent,u=f?.left??0,c=f?.right??0,m=Math.max(0,o-u-c),g=n.lines[i.lineIndex];if(!g)return null;let x=0;l==="center"?x=Math.max(0,(m-g.width)/2):l==="right"&&(x=Math.max(0,m-g.width));let d=0;for(let h=s;h<i.lineIndex;h++)d+=n.lines[h]?.lineHeight??0;return {x:r+u+x+i.x,y:t+d,height:g.lineHeight}}function Ke(e,n,a={}){let r=a.scope??"body",t=r==="body"?"layout-page-content":`layout-page-${r}`,o=`.${t} .layout-table-cell`,s=e.querySelectorAll(`.${t} .layout-table-cell-selected`);for(let c of Array.from(s))c.classList.remove("layout-table-cell-selected");let i=n.selection;if(!("$anchorCell"in i&&typeof i.forEachCell=="function")||!i.forEachCell)return;let f=[];i.forEachCell((c,m)=>{f.push([m,m+c.nodeSize]);});let u=e.querySelectorAll(o);for(let c of Array.from(u)){let m=c,g=m.dataset.pmStart;if(g===void 0)continue;let x=Number(g);for(let[d,h]of f)if(x>=d&&x<h){m.classList.add("layout-table-cell-selected");break}}}function Me(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function re(e,n){return e.findIndex(a=>a.id===n)}function V(e,n){let r=(e.pmStart??0)+1,t=0,o;for(let l=0;l<e.runs.length&&l<=n.toRun;l++){let f=e.runs[l];if(f){if(l<n.fromRun)f.kind==="text"?t+=(f.text??"").length:t+=1;else if(l===n.fromRun){t+=n.fromChar,o=r+t;break}}}o===void 0&&(o=r);let s=0;for(let l=n.fromRun;l<=n.toRun&&l<e.runs.length;l++){let f=e.runs[l];if(f)if(f.kind==="text"){let u=f.text??"",c=l===n.fromRun?n.fromChar:0,m=l===n.toRun?n.toChar:u.length;s+=m-c;}else s+=1;}let i=o+s;return {pmStart:o,pmEnd:i}}function Fe(e,n,a,r){let t=[];for(let o=0;o<n.lines.length;o++){let s=n.lines[o],i=V(e,s);i.pmStart===void 0||i.pmEnd===void 0||i.pmEnd>a&&i.pmStart<r&&t.push({line:s,index:o});}return t}function W(e,n,a){let r=V(e,n);return r.pmStart===void 0?0:Math.max(0,a-r.pmStart)}function G(e,n,a,r){let t=0,o=0;for(let s=n.fromRun;s<=n.toRun&&s<e.runs.length;s++){let i=e.runs[s];if(i){if(i.kind==="tab"){let l=i.width??48;if(o+1>=a)return a<=o?t:t+l;t+=l,o+=1;continue}if(i.kind==="image"){let l=i.width;if(o+1>=a)return a<=o?t:t+l;t+=l,o+=1;continue}if(i.kind==="lineBreak"){if(a<=o)return t;o+=1;continue}if(i.kind==="text"){let l=i.text??"",f=s===n.fromRun,u=s===n.toRun,c=f?n.fromChar:0,m=u?n.toChar:l.length,g=l.slice(c,m);if(o+g.length>=a){let h=a-o,p=Me(i),b=chunkRSU4HTC6_js.k(g.slice(0,h),p);return t+b.width}let x=Me(i),d=chunkRSU4HTC6_js.k(g,x);t+=d.width,o+=g.length;}}}return t}function J(e,n){let a=0;for(let r=0;r<n&&r<e.lines.length;r++)a+=e.lines[r].lineHeight;return a}function Qe(e,n,a,r,t){if(r===t)return [];let o=Math.min(r,t),s=Math.max(r,t),i=[];for(let l=0;l<e.pages.length;l++){let f=e.pages[l],u=A(e,l);for(let c of f.fragments){if(c.kind==="paragraph"){let m=re(n,c.blockId);if(m===-1)continue;let g=n[m],x=a[m];if(!g||g.kind!=="paragraph"||!x||x.kind!=="paragraph")continue;let d=g,h=x,p=c,b=Fe(d,h,o,s);for(let{line:T,index:H}of b){if(H<p.fromLine||H>=p.toLine)continue;let F=V(d,T);if(F.pmStart===void 0||F.pmEnd===void 0)continue;let k=Math.max(F.pmStart,o),P=Math.min(F.pmEnd,s);if(k>=P)continue;let S=W(d,T,k),y=W(d,T,P),B=d.attrs?.indent,R=B?.left??0,_=B?.right??0,I=Math.max(0,c.width-R-_),E=G(d,T,S),C=G(d,T,y),M=d.attrs?.alignment??"left",w=0;M==="center"?w=Math.max(0,(I-T.width)/2):M==="right"&&(w=Math.max(0,I-T.width));let L=J(h,H)-J(h,p.fromLine),D=c.x+R+w+Math.min(E,C),Y=Math.max(1,Math.abs(C-E)),z=c.y+L;i.push({x:D,y:z+u,width:Y,height:T.lineHeight,pageIndex:l});}}if(c.kind==="table"){let m=re(n,c.blockId);if(m===-1)continue;let g=n[m],x=a[m];if(!g||g.kind!=="table"||!x||x.kind!=="table")continue;let d=g,h=x,p=c,b=[],T=0;for(let y=0;y<h.rows.length;y++)b.push(Math.round(T)),T+=h.rows[y]?.height??0;b.push(Math.round(T));let H=p.headerRowCount??0,F=H>0&&p.continuesFromPrev?chunkRSU4HTC6_js.V(h,H):0,k=(b[p.fromRow]??0)+(p.topClip??0),P=p.bottomClip!==void 0?Math.round(p.height):F+((b[p.toRow]??0)-k),S=y=>F+(y-k);for(let y=p.fromRow;y<p.toRow&&y<d.rows.length;y++){let B=d.rows[y],R=h.rows[y];if(!B||!R)continue;let _=b[y]??0,I=0;for(let E=0;E<B.cells.length;E++){let C=B.cells[E],M=R.cells[E];if(!C||!M)continue;let w=C.padding?.top??0,L=chunkRSU4HTC6_js.L(C.blocks,M.blocks,w);for(let D=0;D<C.blocks.length;D++){let Y=C.blocks[D],z=M.blocks[D];if(!Y||Y.kind!=="paragraph"||!z||z.kind!=="paragraph")continue;let X=Y,Ae=z,De=L.lineTops[D]??[],ve=Fe(X,Ae,o,s);for(let{line:v,index:Oe}of ve){let q=V(X,v);if(q.pmStart===void 0||q.pmEnd===void 0)continue;let ae=Math.max(q.pmStart,o),se=Math.min(q.pmEnd,s);if(ae>=se)continue;let Q=S(_+(De[Oe]??0));if(Q+v.lineHeight<=F||Q>=P)continue;let _e=W(X,v,ae),Xe=W(X,v,se),le=G(X,v,_e,M.width),ce=G(X,v,Xe,M.width);i.push({x:p.x+I+Math.min(le,ce),y:p.y+Q+u,width:Math.max(1,Math.abs(ce-le)),height:v.lineHeight,pageIndex:l});}}I+=M.width;}}}if(c.kind==="image"){let m=c.pmStart??0;(c.pmEnd??m+1)>o&&m<s&&i.push({x:c.x,y:c.y+u,width:c.width,height:c.height,pageIndex:l});}}}return i}function Ze(e,n,a,r){for(let t=0;t<e.pages.length;t++){let o=e.pages[t],s=A(e,t);for(let i of o.fragments){if(i.kind==="paragraph"){let l=re(n,i.blockId);if(l===-1)continue;let f=n[l],u=a[l];if(!f||f.kind!=="paragraph"||!u||u.kind!=="paragraph")continue;let c=f,m=u,g=i,x=c.pmStart??0,d=c.pmEnd??x;if(r<x||r>d)continue;for(let h=g.fromLine;h<g.toLine;h++){let p=m.lines[h];if(!p)continue;let b=V(c,p);if(!(b.pmStart===void 0||b.pmEnd===void 0)&&r>=b.pmStart&&r<=b.pmEnd){let T=W(c,p,r),H=c.attrs?.indent,F=H?.left??0,k=H?.right??0,P=Math.max(0,i.width-F-k),S=G(c,p,T),y=c.attrs?.alignment??"left",B=0;y==="center"?B=Math.max(0,(P-p.width)/2):y==="right"&&(B=Math.max(0,P-p.width));let R=J(m,h)-J(m,g.fromLine);return {x:i.x+F+B+S,y:i.y+R+s,height:p.lineHeight,pageIndex:t}}}}if(i.kind==="image"){let l=i.pmStart??0,f=i.pmEnd??l+1;if(r>=l&&r<=f){let u=r===l?0:i.width;return {x:i.x+u,y:i.y+s,height:i.height,pageIndex:t}}}}}return null}function et(e){return e.length<=1?false:new Set(e.map(a=>a.pageIndex)).size>1}function tt(e){let n=new Map;for(let a of e){let r=n.get(a.pageIndex)??[];r.push(a),n.set(a.pageIndex,r);}return n}function nt(e){if(e.kind!=="paragraph")return false;let n=e.attrs;return n?!!(n.borders?.top||n.borders?.bottom||n.spacingExplicit?.before||n.spacingExplicit?.after):false}function ye(e){return He(e)}function He(e){let n=new Set;for(let a=1;a<e.length;a++){let r=e[a-1],t=e[a];r.kind==="table"&&t.kind==="paragraph"&&(t.runs.length>0||nt(t)||n.add(a));}return e.map((a,r)=>{if(a.kind==="table")return ot(a);if(a.kind!=="paragraph")return a;let t=n.has(r),o=a.attrs?.spacingExplicit,s=a.attrs?.spacing?.before!=null,i=a.attrs?.spacing?.after!=null,l=s&&!o?.before,f=i&&!o?.after,u=l||f;if(!u&&!t)return a;let c=a.attrs;return u&&c?.spacing&&(c={...c,spacing:{...c.spacing,before:o?.before?c.spacing.before:void 0,after:o?.after?c.spacing.after:void 0}}),t&&(c={...c??{},suppressEmptyParagraphHeight:true}),{...a,attrs:c}})}function ot(e){let n=false,a=e.rows.map(r=>{let t=false,o=r.cells.map(s=>{let i=He(s.blocks);return i.some((f,u)=>f!==s.blocks[u])?(t=true,{...s,blocks:i}):s});return t?(n=true,{...r,cells:o}):r});return n?{...e,rows:a}:e}function rt(e){return e?.align??e?.alignment}function we(e,n,a,r){let t=r.section==="header"?r.margins.header??48:r.pageSize.h-(r.margins.footer??48)-a,o=e.position?.vertical;if(!o)return n;let s=rt(o),i=o.posOffset!==void 0?chunk4Q2IP5FW_js.e(o.posOffset):void 0;if(o.relativeTo==="page"){if(i!==void 0)return i-t;if(s==="top")return -t;if(s==="bottom")return r.pageSize.h-e.height-t;if(s==="center")return (r.pageSize.h-e.height)/2-t}if(o.relativeTo==="margin"){let l=r.margins.top,f=r.pageSize.h-r.margins.top-r.margins.bottom;if(i!==void 0)return l+i-t;if(s==="top")return l-t;if(s==="bottom")return l+f-e.height-t;if(s==="center")return l+(f-e.height)/2-t}return i!==void 0?n+i:n}function Pe(e){switch(e.kind){case "paragraph":case "table":return true;case "image":return !e.anchor?.isAnchored;case "textBox":return e.displayMode===void 0||e.displayMode==="inline";default:return false}}function it(e){return e?e.kind==="paragraph"||e.kind==="table"?e.totalHeight:e.kind==="image"||e.kind==="textBox"?e.height:0:0}function Se(e,n,a,r){let t=0,o=0,s=0;for(let i=0;i<e.length;i++){let l=e[i],f=n[i];if(!(!l||!f)){if(l.kind==="paragraph"&&f.kind==="paragraph"){let u=s,c=u+f.totalHeight;t=Math.min(t,u),o=Math.max(o,c);for(let m of l.runs){if(m.kind!=="image"||!m.position)continue;let g=we(m,u,a,r);t=Math.min(t,g),o=Math.max(o,g+m.height);}s=c;}else if(l.kind==="table"&&f.kind==="table"){let u=s+f.totalHeight;t=Math.min(t,s),o=Math.max(o,u),s=u;}else if(l.kind==="image"&&f.kind==="image"){let u=s+f.height;t=Math.min(t,s),o=Math.max(o,u),s=u;}else if(l.kind==="textBox"&&f.kind==="textBox"){let u=s+f.height;t=Math.min(t,s),o=Math.max(o,u),l.displayMode!=="float"&&(s=u);}}}return {visualTop:t,visualBottom:o}}function at(e,n,a,r){if(!e||!e.content||e.content.length===0)return;let t=chunkXLB6AC5Q_js.b(e.content,{styles:r.styles??void 0,theme:r.theme??null,defaultTabStopTwips:r.defaultTabStopTwips??null});return Be(t,n,a,r)}function Be(e,n,a,r){let t=chunkYPQACU4A_js.c(e,{theme:r.theme??void 0});if(t.length===0)return;let o=ye(t),s=r.measureBlocks(o,n),i=0,l=0;for(let c=0;c<o.length;c++){let m=it(s[c]);i+=m,Pe(o[c])&&(l+=m);}let{visualTop:f,visualBottom:u}=Se(o,s,i,a);return {blocks:o,measures:s,height:i,flowHeight:l,visualTop:f,visualBottom:u}}var K={header:null,footer:null};function st(){K.header=null,K.footer=null;}function Re(e,n){let a=n.querySelectorAll(`.layout-page-${e}`);if(a.length===0)return null;let r=n.defaultView,t=r?r.innerHeight/2:0,o=a[0],s=1/0;for(let c of Array.from(a)){let m=c.getBoundingClientRect(),g=Math.abs((m.top+m.bottom)/2-t);g<s&&(s=g,o=c);}let i=K[e];if(i&&i.host===o&&i.host.isConnected)return i;let l=Array.from(o.querySelectorAll("span[data-pm-start][data-pm-end]")),f=Array.from(o.querySelectorAll("[data-pm-start][data-pm-end]")),u={host:o,spans:l,ranged:f};return K[e]=u,u}function lt(e,n,a=globalThis.document){let r=e.state.selection;if(!r.empty)return null;let t=r.head,o=Re(n,a);if(!o)return null;let{host:s,spans:i}=o;for(let d of i){let h=Number(d.dataset.pmStart),p=Number(d.dataset.pmEnd);if(!(!Number.isFinite(h)||!Number.isFinite(p))&&t>=h&&t<=p){let b=s.ownerDocument.createRange(),T=s.ownerDocument.createTreeWalker(d,NodeFilter.SHOW_TEXT),H=t-h,F=T.nextNode();for(;F;){let S=F.data.length;if(H<=S){try{b.setStart(F,H),b.setEnd(F,H);let y=b.getClientRects()[0]??b.getBoundingClientRect();if(y&&y.height>0)return {top:y.top,left:y.left,height:y.height}}catch{}break}H-=S,F=T.nextNode();}let k=d.getBoundingClientRect(),P=(t-h)/Math.max(1,p-h);return {top:k.top,left:k.left+k.width*P,height:k.height}}}let l=s.querySelector(`[data-pm-start="${t}"]`);if(l){let d=l.getBoundingClientRect();return {top:d.top,left:d.left+1,height:d.height||16}}let f=o.ranged,u=null,c=1/0;for(let d of f){let h=Number(d.dataset.pmStart),p=Number(d.dataset.pmEnd);if(!Number.isFinite(h)||!Number.isFinite(p)||t<h||t>p)continue;let b=p-h;b<c&&(c=b,u=d);}if(u){let d=u.getBoundingClientRect(),h=Number(u.dataset.pmEnd),p=t>=h;return {top:d.top,left:p?d.right:d.left+1,height:d.height||16}}let m=null,g=-1/0;for(let d of f){let h=Number(d.dataset.pmStart);Number.isFinite(h)&&(h>t||h>g&&(g=h,m=d));}if(m){let d=m.getBoundingClientRect();return {top:d.top,left:d.right,height:d.height||16}}let x=s.getBoundingClientRect();return {top:x.top+2,left:x.left+2,height:16}}function ct(e,n,a=globalThis.document){let r=e.state.selection;if(r.empty)return [];let t=r.from,o=r.to,s=[],i=Re(n,a);if(!i)return s;let{host:l,spans:f}=i;for(let u of f){let c=Number(u.dataset.pmStart),m=Number(u.dataset.pmEnd);if(!Number.isFinite(c)||!Number.isFinite(m)||m<=t||c>=o)continue;if(u.classList.contains("layout-run-tab")){let p=u.getBoundingClientRect();s.push({top:p.top,left:p.left,width:p.width,height:p.height});continue}let g=null;if(u.firstChild?.nodeType===Node.TEXT_NODE?g=u.firstChild:u.firstChild?.nodeType===Node.ELEMENT_NODE&&u.firstChild.tagName==="A"&&u.firstChild.firstChild?.nodeType===Node.TEXT_NODE&&(g=u.firstChild.firstChild),!g)continue;let x=Math.max(0,t-c),d=Math.min(g.length,o-c);if(x>=d)continue;let h=l.ownerDocument.createRange();h.setStart(g,x),h.setEnd(g,d);for(let p of Array.from(h.getClientRects()))s.push({top:p.top,left:p.left,width:p.width,height:p.height});}return s}function Ie(e){return e?e.flowHeight??e.height:0}function ut(e){let{pageSize:n,margins:a,finalMargins:r,bodyBlocks:t,headers:o,footers:s,warn:i}=e,l=a.header??48,f=a.footer??48,u=a.top-l,c=a.bottom-f,m=Math.max(0,...(o??[]).map(Ie)),g=Math.max(0,...(s??[]).map(Ie)),x=m>u,d=g>c;if(!x&&!d)return {margins:a,finalMargins:r};let h=Math.max(0,n.h-24),p=false,b=F=>{let k={...F};return x&&(k.top=Math.max(F.top,l+m)),d&&(k.bottom=Math.max(F.bottom,f+g)),k.top+k.bottom>h&&(p=true,k.bottom=Math.max(0,Math.min(k.bottom,h-k.top)),k.top+k.bottom>h&&(k.top=Math.max(0,h-k.bottom))),k},T=b(a),H=b(r);if(t)for(let F of t){if(F.kind!=="sectionBreak")continue;let k=F;k.margins&&(k.margins=b(k.margins));}return p&&i&&i(`[layout] header/footer content exceeds page height; clamping margins to preserve a content area. pageHeight=${Math.round(n.h)} headerBand=${Math.round(m)} footerBand=${Math.round(g)} top=${Math.round(T.top)} bottom=${Math.round(T.bottom)}`),{margins:T,finalMargins:H}}var Ce=816,Ee=1056,U=96,ie=48;function $(e){return Math.round(e/1440*96)}function N(e,n){return e!=null?$(e):n}function ft(e){return {w:e?.pageWidth?$(e.pageWidth):Ce,h:e?.pageHeight?$(e.pageHeight):Ee}}function dt(e){return {top:N(e?.marginTop,U),right:N(e?.marginRight,U),bottom:N(e?.marginBottom,U),left:N(e?.marginLeft,U),header:N(e?.headerDistance,ie),footer:N(e?.footerDistance,ie)}}function ht(e,n){let a={header:null,footer:null,firstHeader:null,firstFooter:null};if(!e?.package)return a;let r=e.package.headers,t=e.package.footers,o=null,s=null,i=null,l=null;if(r&&n?.headerReferences){let f=n.headerReferences.find(c=>c.type==="default");f?.rId&&(o=r.get(f.rId)??null);let u=n.headerReferences.find(c=>c.type==="first");u?.rId&&(i=r.get(u.rId)??null);}if(t&&n?.footerReferences){let f=n.footerReferences.find(c=>c.type==="default");f?.rId&&(s=t.get(f.rId)??null);let u=n.footerReferences.find(c=>c.type==="first");u?.rId&&(l=t.get(u.rId)??null);}return n?.titlePg||(!o&&i&&(o=i),!s&&l&&(s=l)),{header:o,footer:s,firstHeader:i,firstFooter:l}}function mt(e){let n=e?.columnCount??1;if(n<=1)return;let a=$(e?.columnSpace??720);return {count:n,gap:a,equalWidth:e?.equalWidth??true,separator:e?.separator}}function Le(e){let n=e.pageSize.w-e.margins.left-e.margins.right,a=e.columns;return !a||a.count<=1?n:Math.floor((n-(a.count-1)*a.gap)/a.count)}function gt(e,n,a){let{configs:r,breakIndices:t}=chunkRSU4HTC6_js.T(e,n,a),o=0,s=[];for(let i=0;i<e.length;i++)s.push(Le(r[o]??n)),o<t.length&&i===t[o]&&o++;return s}exports.A=st;exports.B=lt;exports.C=ct;exports.D=ut;exports.E=Ce;exports.F=Ee;exports.G=U;exports.H=ie;exports.I=$;exports.J=ft;exports.K=dt;exports.L=ht;exports.M=mt;exports.N=Le;exports.O=gt;exports.a=ee;exports.b=A;exports.c=Ne;exports.d=ge;exports.e=ze;exports.f=pe;exports.g=We;exports.h=Ge;exports.i=Ve;exports.j=Ue;exports.k=oe;exports.l=ke;exports.m=je;exports.n=Te;exports.o=Je;exports.p=Ke;exports.q=Qe;exports.r=Ze;exports.s=et;exports.t=tt;exports.u=ye;exports.v=we;exports.w=Pe;exports.x=Se;exports.y=at;exports.z=Be;
@@ -0,0 +1 @@
1
+ import {r,q}from'./chunk-CRMZH7U7.mjs';var t=new r(q());t.buildSchema();t.initializeRuntime();var s=t,n=t.getSchema();export{s as a,n as b};
@@ -0,0 +1 @@
1
+ 'use strict';var chunkC45EFOVP_js=require('./chunk-C45EFOVP.js'),chunkJFZIXFRC_js=require('./chunk-JFZIXFRC.js'),chunkRQVHKDXK_js=require('./chunk-RQVHKDXK.js'),chunkL5NPEM7C_js=require('./chunk-L5NPEM7C.js'),chunkLWH66Q7Q_js=require('./chunk-LWH66Q7Q.js'),chunkMJ5FQX7Q_js=require('./chunk-MJ5FQX7Q.js'),chunk4Q2IP5FW_js=require('./chunk-4Q2IP5FW.js'),chunkGSKMHXHG_js=require('./chunk-GSKMHXHG.js');function we(e){if(!e||e.pattern&&e.pattern!=="clear")return;let n=e.fill?.rgb;if(!(!n||e.fill?.auto))return chunkMJ5FQX7Q_js.n(n)}function X(e){if(!e)return [];let n=[];e.bold&&n.push(chunkL5NPEM7C_js.b.mark("bold")),e.italic&&n.push(chunkL5NPEM7C_js.b.mark("italic")),e.underline&&e.underline.style!=="none"&&n.push(chunkL5NPEM7C_js.b.mark("underline",{style:e.underline.style,color:e.underline.color})),(e.strike||e.doubleStrike)&&n.push(chunkL5NPEM7C_js.b.mark("strike",{double:e.doubleStrike||false})),e.color&&!e.color.auto&&n.push(chunkL5NPEM7C_js.b.mark("textColor",{rgb:e.color.rgb,themeColor:e.color.themeColor,themeTint:e.color.themeTint,themeShade:e.color.themeShade}));let o=e.highlight&&e.highlight!=="none"?e.highlight:we(e.shading);return o&&n.push(chunkL5NPEM7C_js.b.mark("highlight",{color:o})),e.fontSize&&n.push(chunkL5NPEM7C_js.b.mark("fontSize",{size:e.fontSize})),e.fontFamily&&n.push(chunkL5NPEM7C_js.b.mark("fontFamily",{ascii:e.fontFamily.ascii,hAnsi:e.fontFamily.hAnsi,eastAsia:e.fontFamily.eastAsia,cs:e.fontFamily.cs,asciiTheme:e.fontFamily.asciiTheme,hAnsiTheme:e.fontFamily.hAnsiTheme,eastAsiaTheme:e.fontFamily.eastAsiaTheme,csTheme:e.fontFamily.csTheme})),e.vertAlign==="superscript"?n.push(chunkL5NPEM7C_js.b.mark("superscript")):e.vertAlign==="subscript"&&n.push(chunkL5NPEM7C_js.b.mark("subscript")),e.allCaps&&n.push(chunkL5NPEM7C_js.b.mark("allCaps")),e.smallCaps&&n.push(chunkL5NPEM7C_js.b.mark("smallCaps")),(e.spacing!=null||e.position!=null||e.scale!=null||e.kerning!=null)&&n.push(chunkL5NPEM7C_js.b.mark("characterSpacing",{spacing:e.spacing??null,position:e.position??null,scale:e.scale??null,kerning:e.kerning??null})),e.emboss&&n.push(chunkL5NPEM7C_js.b.mark("emboss")),e.imprint&&n.push(chunkL5NPEM7C_js.b.mark("imprint")),e.shadow&&n.push(chunkL5NPEM7C_js.b.mark("textShadow")),e.emphasisMark&&e.emphasisMark!=="none"&&n.push(chunkL5NPEM7C_js.b.mark("emphasisMark",{type:e.emphasisMark})),e.outline&&n.push(chunkL5NPEM7C_js.b.mark("textOutline")),e.hidden&&n.push(chunkL5NPEM7C_js.b.mark("hidden")),e.rtl&&n.push(chunkL5NPEM7C_js.b.mark("rtl")),e.effect&&e.effect!=="none"&&n.push(chunkL5NPEM7C_js.b.mark("textEffect",{effect:e.effect})),n}function E(e,n){if(!e)return;if(!n)return e;let o=n.resolveRunStyle(e.styleId);return o?chunkGSKMHXHG_js.b(o,e):e}function ee(e,n){let o="",l,t=e.type==="simpleField"?e.content:e.fieldResult;if(t){for(let s of t)if(s.type==="run"){for(let u of s.content)u.type==="text"&&(o+=u.text);!l&&s.formatting&&(l=s.formatting);}}let r=chunkGSKMHXHG_js.b(n,l),i=X(r);return chunkL5NPEM7C_js.b.node("field",{fieldType:e.fieldType,instruction:e.instruction,displayText:o,fieldKind:e.type==="simpleField"?"simple":"complex",fldLock:e.fldLock??false,dirty:e.dirty??false},void 0,i)}function te(e){return chunkL5NPEM7C_js.b.node("math",{display:e.display,ommlXml:e.ommlXml,plainText:e.plainText||""})}function K(e,n,o){let l=[],t=e.formatting?.styleId?o?.getRunStyleOwnProperties(e.formatting.styleId):void 0,r=chunkGSKMHXHG_js.b(chunkGSKMHXHG_js.b(n,t),e.formatting),i=X(r);for(let s of e.content){let u=pe(s,i);l.push(...u);}return l}function pe(e,n){switch(e.type){case "text":return e.text?[chunkL5NPEM7C_js.b.text(e.text,n)]:[];case "break":return e.breakType==="textWrapping"||!e.breakType?[chunkL5NPEM7C_js.b.node("hardBreak",null,void 0,n)]:[];case "tab":return [chunkL5NPEM7C_js.b.node("tab",null,void 0,n)];case "drawing":return e.image?[xe(e.image)]:[];case "shape":{let t=e.shape;return t.textBody&&t.textBody.content.length>0?[]:[ke(t)]}case "footnoteRef":let o=chunkL5NPEM7C_js.b.mark("footnoteRef",{id:e.id.toString(),noteType:"footnote"});return [chunkL5NPEM7C_js.b.text(e.id.toString(),[...n,o])];case "endnoteRef":let l=chunkL5NPEM7C_js.b.mark("footnoteRef",{id:e.id.toString(),noteType:"endnote"});return [chunkL5NPEM7C_js.b.text(e.id.toString(),[...n,l])];default:return []}}function xe(e){let n=e.size?.width?chunk4Q2IP5FW_js.e(e.size.width):void 0,o=e.size?.height?chunk4Q2IP5FW_js.e(e.size.height):void 0,l=e.wrap.type,t=e.wrap.wrapText,r=e.position?.horizontal?.alignment,i;l==="inline"||l==="topAndBottom"?i="none":l==="square"||l==="tight"||l==="through"?t==="left"?i="right":t==="right"||r==="left"?i="left":r==="right"?i="right":i="none":i="none";let s="inline";l==="inline"?s="inline":l==="topAndBottom"?s="block":chunkJFZIXFRC_js.b(l)||i&&i!=="none"?s="float":s="block";let u;if(e.transform){let P=[];e.transform.rotation&&P.push(`rotate(${e.transform.rotation}deg)`),e.transform.flipH&&P.push("scaleX(-1)"),e.transform.flipV&&P.push("scaleY(-1)"),P.length>0&&(u=P.join(" "));}let c=e.wrap.distT!=null?chunk4Q2IP5FW_js.e(e.wrap.distT):void 0,f=e.wrap.distB!=null?chunk4Q2IP5FW_js.e(e.wrap.distB):void 0,d=e.wrap.distL!=null?chunk4Q2IP5FW_js.e(e.wrap.distL):void 0,m=e.wrap.distR!=null?chunk4Q2IP5FW_js.e(e.wrap.distR):void 0,p;e.position&&(p={horizontal:e.position.horizontal?{relativeTo:e.position.horizontal.relativeTo,posOffset:e.position.horizontal.posOffset,align:e.position.horizontal.alignment}:void 0,vertical:e.position.vertical?{relativeTo:e.position.vertical.relativeTo,posOffset:e.position.vertical.posOffset,align:e.position.vertical.alignment}:void 0});let S,w,M;if(e.outline&&e.outline.width){S=Math.round(e.outline.width/914400*96*100)/100,e.outline.color?.rgb&&(w=`#${e.outline.color.rgb}`);let P={solid:"solid",dot:"dotted",dash:"dashed",lgDash:"dashed",dashDot:"dashed",lgDashDot:"dashed",lgDashDotDot:"dashed",sysDot:"dotted",sysDash:"dashed",sysDashDot:"dashed",sysDashDotDot:"dashed"};M=e.outline.style&&P[e.outline.style]||"solid";}let z=e.padding?.top?chunk4Q2IP5FW_js.e(e.padding.top):void 0,I=e.padding?.bottom?chunk4Q2IP5FW_js.e(e.padding.bottom):void 0,B=e.padding?.left?chunk4Q2IP5FW_js.e(e.padding.left):void 0,g=e.padding?.right?chunk4Q2IP5FW_js.e(e.padding.right):void 0;return chunkL5NPEM7C_js.b.node("image",{src:e.src||"",alt:e.alt,title:e.title,width:n,height:o,rId:e.rId,wrapType:l,displayMode:s,cssFloat:i,transform:u,distTop:c,distBottom:f,distLeft:d,distRight:m,position:p,borderWidth:S,borderColor:w,borderStyle:M,wrapText:t,hlinkHref:e.hlinkHref,cropTop:e.crop?.top,cropRight:e.crop?.right,cropBottom:e.crop?.bottom,cropLeft:e.crop?.left,opacity:e.opacity,effectExtentTop:z,effectExtentBottom:I,effectExtentLeft:B,effectExtentRight:g,layoutInCell:e.layoutInCell,allowOverlap:e.allowOverlap})}function Y(e,n,o){let l=[],t=e.href||(e.anchor?`#${e.anchor}`:""),r=chunkL5NPEM7C_js.b.mark("hyperlink",{href:t,tooltip:e.tooltip,rId:e.rId});for(let i of e.children)if(i.type==="run"){let s=i.formatting?.styleId?o?.getRunStyleOwnProperties(i.formatting.styleId):void 0,u=chunkGSKMHXHG_js.b(chunkGSKMHXHG_js.b(n,s),i.formatting),f=[...X(u),r];for(let d of i.content)l.push(...pe(d,f));}return l}function ke(e){let n=e.size?.width?chunk4Q2IP5FW_js.e(e.size.width):100,o=e.size?.height?chunk4Q2IP5FW_js.e(e.size.height):80,l,t="solid",r,i,s;if(e.fill&&(t=e.fill.type,e.fill.color?.rgb&&(l=`#${e.fill.color.rgb}`),e.fill.type==="gradient"&&e.fill.gradient)){let m=e.fill.gradient;r=m.type,i=m.angle,s=JSON.stringify(m.stops.map(p=>({position:p.position,color:p.color.rgb?`#${p.color.rgb}`:"#000000"})));}let u,c,f;e.outline&&(e.outline.width&&(u=Math.round(e.outline.width/914400*96*100)/100),e.outline.color?.rgb&&(c=`#${e.outline.color.rgb}`),f=e.outline.style||"solid");let d;if(e.transform){let m=[];e.transform.rotation&&m.push(`rotate(${e.transform.rotation}deg)`),e.transform.flipH&&m.push("scaleX(-1)"),e.transform.flipV&&m.push("scaleY(-1)"),m.length>0&&(d=m.join(" "));}return chunkL5NPEM7C_js.b.node("shape",{shapeType:e.shapeType||"rect",shapeId:e.id,width:n,height:o,fillColor:l,fillType:t,gradientType:r,gradientAngle:i,gradientStops:s,outlineWidth:u,outlineColor:c,outlineStyle:f,transform:d})}function V(e,n,o,l){let t=Fe(e,n),r=[],i,s=new Set,u;n&&(u=n.resolveParagraphStyle(e.formatting?.styleId).runFormatting);let c=chunkGSKMHXHG_js.b(u,l);for(let f of e.content){if(f.type==="commentRangeStart")s.add(f.id);else if(f.type==="commentRangeEnd")s.delete(f.id);else if(f.type==="run"){let d=K(f,c,n);s.size>0&&(d=O(d,s)),r.push(...d);}else if(f.type==="hyperlink"){let d=Y(f,c,n);r.push(...d);}else if(f.type==="simpleField"||f.type==="complexField"){let d=ee(f,c);d&&r.push(d);}else if(f.type==="inlineSdt"){let d=me(f,c,n);d&&r.push(d);}else if(f.type==="insertion"){let d=J(f,"insertion",c,n);s.size>0&&(d=O(d,s)),r.push(...d);}else if(f.type==="deletion"){let d=J(f,"deletion",c,n);s.size>0&&(d=O(d,s)),r.push(...d);}else if(f.type==="moveFrom"){let d=J(f,"deletion",c,n,true);s.size>0&&(d=O(d,s)),r.push(...d);}else if(f.type==="moveTo"){let d=J(f,"insertion",c,n,true);s.size>0&&(d=O(d,s)),r.push(...d);}else if(f.type==="mathEquation"){let d=te(f);d&&r.push(d);}f.type==="bookmarkStart"&&(i||(i=[]),i.push({id:f.id,name:f.name}));}return i&&(t.bookmarks=i),chunkL5NPEM7C_js.b.node("paragraph",t,r)}function O(e,n){if(n.size===0)return e;let o=[...n][0],l=chunkL5NPEM7C_js.b.marks.comment.create({commentId:o});return e.map(t=>t.isText?t.mark(l.addToSet(t.marks)):t)}function J(e,n,o,l,t=false){let r=[];for(let s of e.content)s.type==="run"?r.push(...K(s,o,l)):s.type==="hyperlink"&&r.push(...Y(s,o,l));let i=chunkL5NPEM7C_js.b.marks[n].create({revisionId:e.info.id,author:e.info.author,date:e.info.date??null,isMovePair:t});return r.map(s=>s.isText||s.type.allowsMarkType(i.type)?s.mark(i.addToSet(s.marks)):s)}function Fe(e,n){let o=e.formatting,l=o?.styleId,t={paraId:e.paraId??void 0,textId:e.textId??void 0,styleId:l,numPr:o?.numPr,listNumFmt:e.listRendering?.numFmt,listIsBullet:e.listRendering?.isBullet,listMarker:e.listRendering?.marker,listMarkerHidden:e.listRendering?.markerHidden||void 0,listMarkerFontFamily:e.listRendering?.markerFontFamily||void 0,listMarkerFontSize:e.listRendering?.markerFontSize||void 0,listMarkerSuffix:e.listRendering?.markerSuffix||void 0,listLevelNumFmts:e.listRendering?.levelNumFmts||void 0,listAbstractNumId:e.listRendering?.abstractNumId,listStartOverride:e.listRendering?.startOverride,_originalFormatting:o||void 0};if(n){let r=n.resolveParagraphStyle(l),i=r.paragraphFormatting,s=r.runFormatting;t.alignment=o?.alignment??i?.alignment,t.spaceBefore=o?.spaceBefore??i?.spaceBefore,t.spaceAfter=o?.spaceAfter??i?.spaceAfter,t.lineSpacing=o?.lineSpacing??i?.lineSpacing,t.lineSpacingRule=o?.lineSpacingRule??i?.lineSpacingRule,o?.spacingExplicit&&(t.spacingExplicit=o.spacingExplicit),t.indentLeft=o?.indentLeft??i?.indentLeft,t.indentRight=o?.indentRight??i?.indentRight,t.indentFirstLine=o?.indentFirstLine??i?.indentFirstLine,t.hangingIndent=o?.hangingIndent??i?.hangingIndent,t.borders=o?.borders??i?.borders,t.shading=o?.shading??i?.shading,t.tabs=o?.tabs??i?.tabs,t.pageBreakBefore=o?.pageBreakBefore??i?.pageBreakBefore,t.keepNext=o?.keepNext??i?.keepNext,t.keepLines=o?.keepLines??i?.keepLines,t.contextualSpacing=o?.contextualSpacing??i?.contextualSpacing,t.outlineLevel=o?.outlineLevel??i?.outlineLevel,t.bidi=o?.bidi??i?.bidi;let u=n.getDefaultCharacterStyle()?.rPr,c=u?chunkGSKMHXHG_js.b(s,u):s,f=E(o?.runProperties,n);t.defaultTextFormatting=chunkGSKMHXHG_js.b(c,f),!o?.numPr&&i?.numPr&&i.numPr.numId!==0&&(t.numPr=i.numPr);}else t.alignment=o?.alignment,t.spaceBefore=o?.spaceBefore,t.spaceAfter=o?.spaceAfter,t.lineSpacing=o?.lineSpacing,t.lineSpacingRule=o?.lineSpacingRule,o?.spacingExplicit&&(t.spacingExplicit=o.spacingExplicit),t.indentLeft=o?.indentLeft,t.indentRight=o?.indentRight,t.indentFirstLine=o?.indentFirstLine,t.hangingIndent=o?.hangingIndent,t.borders=o?.borders,t.shading=o?.shading,t.tabs=o?.tabs,t.pageBreakBefore=o?.pageBreakBefore,t.keepNext=o?.keepNext,t.keepLines=o?.keepLines,t.outlineLevel=o?.outlineLevel,t.bidi=o?.bidi,t.defaultTextFormatting=E(o?.runProperties,n);if(e.sectionProperties){t._sectionProperties=e.sectionProperties;let r=e.sectionProperties.sectionStart;(r==="nextPage"||r==="continuous"||r==="oddPage"||r==="evenPage")&&(t.sectionBreakType=r);}return e.renderedPageBreakBefore&&(t.renderedPageBreakBefore=true),e.pPrIns&&(t.pPrIns={revisionId:e.pPrIns.id,author:e.pPrIns.author,date:e.pPrIns.date??null}),e.pPrDel&&(t.pPrDel={revisionId:e.pPrDel.id,author:e.pPrDel.author,date:e.pPrDel.date??null}),e.propertyChanges&&e.propertyChanges.length>0&&(t.pPrChange=e.propertyChanges),t}function me(e,n,o){let l=e.properties,t=[];for(let r of e.content)if(r.type==="run"){let i=K(r,n,o);t.push(...i);}else if(r.type==="hyperlink"){let i=Y(r,n,o);t.push(...i);}else if(r.type==="simpleField"||r.type==="complexField"){let i=ee(r,n);i&&t.push(i);}else if(r.type==="inlineSdt"){let i=me(r,n,o);i&&t.push(i);}else if(r.type==="mathEquation"){let i=te(r);i&&t.push(i);}return chunkL5NPEM7C_js.b.node("sdt",chunkC45EFOVP_js.a(l),t.length>0?t:void 0)}function ge(e){function n(l){return l.type==="break"&&l.breakType==="page"}function o(l){if(l.type==="run"){for(let t of l.content)if(n(t))return true;return false}if(l.type==="hyperlink"){for(let t of l.children)if(t.type==="run"&&o(t))return true;return false}if(l.type==="insertion"||l.type==="deletion"){let t=l;for(let r of t.content)if(o(r))return true;return false}return false}for(let l of e.content)if(o(l))return true;return false}function R(e,n,o){if(!e||!n)return;let l=e.getStyle(n);if(!l?.tblStylePr)return;let t=l.tblStylePr.find(u=>u.type===o);if(!t)return;let r=E(t.pPr?.runProperties,e),i=E(t.rPr,e),s=chunkGSKMHXHG_js.b(r,i);return {tcPr:t.tcPr,rPr:s}}function N(e,n){if(!e&&!n)return;if(!e)return n;if(!n)return e;let o={},l=e.tcPr,t=n.tcPr;if(l||t){let r={...l??{},...t??{}};(l?.borders||t?.borders)&&(r.borders={...l?.borders??{},...t?.borders??{}}),(l?.shading||t?.shading)&&(r.shading={...l?.shading??{},...t?.shading??{}}),(l?.margins||t?.margins)&&(r.margins={...l?.margins??{},...t?.margins??{}}),o.tcPr=r;}return o.rPr=chunkGSKMHXHG_js.b(e.rPr,n.rPr),o}function Se(e){let n=new Map,o=e.rows.length,l=new Map;for(let t=0;t<o;t++){let r=e.rows[t],i=0,s=r.cells.map(c=>{let f=c.formatting?.gridSpan??1,d=i;return i+=f,{colIndex:d,vMerge:c.formatting?.vMerge,key:`${t}-${d}`}});if(s.length>0&&s.every(({colIndex:c,vMerge:f})=>f==="continue"&&l.has(c))){for(let{colIndex:c,key:f}of s)l.delete(c),n.set(f,{rowSpan:1,skip:false});continue}for(let{colIndex:c,vMerge:f,key:d}of s){let m=c;if(f==="restart")l.set(m,t),n.set(d,{rowSpan:1,skip:false});else if(f==="continue"){let p=l.get(m);if(p!==void 0){let S=`${p}-${m}`,w=n.get(S);w&&w.rowSpan++,n.set(d,{rowSpan:1,skip:true});}else n.set(d,{rowSpan:1,skip:false});}else l.delete(m),n.set(d,{rowSpan:1,skip:false});}}return n}function ne(e,n,o){let l=Se(e),t=e.columnWidths,r=t?.reduce((P,x)=>P+x,0)??0,i=e.formatting?.styleId,s=e.formatting?.look,u=i?n?.getStyle(i):void 0,c=n?.getDefaultTableStyle(),f=e.formatting?.borders??u?.tblPr?.borders??c?.tblPr?.borders,d=e.formatting?.cellMargins??u?.tblPr?.cellMargins??c?.tblPr?.cellMargins??void 0,m=d?{top:d.top?.value,bottom:d.bottom?.value,left:d.left?.value,right:d.right?.value}:void 0,p={styleId:e.formatting?.styleId,width:e.formatting?.width?.value,widthType:e.formatting?.width?.type,justification:e.formatting?.justification,columnWidths:t,floating:e.formatting?.floating,cellMargins:m,look:e.formatting?.look,_originalFormatting:e.formatting||void 0};e.propertyChanges&&e.propertyChanges.length>0&&(p.tblPrChange=e.propertyChanges);let S={wholeTable:R(n,i,"wholeTable"),firstRow:R(n,i,"firstRow"),lastRow:R(n,i,"lastRow"),firstCol:R(n,i,"firstCol"),lastCol:R(n,i,"lastCol"),band1Horz:R(n,i,"band1Horz"),band2Horz:R(n,i,"band2Horz"),band1Vert:R(n,i,"band1Vert"),band2Vert:R(n,i,"band2Vert"),nwCell:R(n,i,"nwCell"),neCell:R(n,i,"neCell"),swCell:R(n,i,"swCell"),seCell:R(n,i,"seCell")},w=s?.noHBand!==true,M=s?.noVBand!==true,z=0,I=e.rows.length,B=t?.length??Math.max(0,...e.rows.map(P=>P.cells.reduce((x,F)=>x+(F.formatting?.gridSpan??1),0))),g=e.rows.map((P,x)=>{let F=x===0&&!!s?.firstRow,v=x===I-1&&!!s?.lastRow,h=w&&!F&&!v?z%2===0?S.band1Horz:S.band2Horz:void 0;return w&&!F&&!v&&z++,Re(P,n,F,t,r,S,h,M,s,f,x,I,B,l,m,o)});return chunkL5NPEM7C_js.b.node("table",p,g)}function Re(e,n,o,l,t,r,i,s,u,c,f,d,m,p,S,w){let M={height:e.formatting?.height?.value,heightRule:e.formatting?.heightRule,isHeader:!!e.formatting?.header,_originalFormatting:e.formatting||void 0};if(e.structuralChange){let C=e.structuralChange,D={revisionId:C.info.id,author:C.info.author,date:C.info.date??null};C.type==="tableRowInsertion"?M.trIns=D:C.type==="tableRowDeletion"&&(M.trDel=D);}e.propertyChanges&&e.propertyChanges.length>0&&(M.trPrChange=e.propertyChanges);let z=e.cells.length,I=f===0,B=f===(d??1)-1,g=e.formatting?.conditionalFormat,P=g?.firstRow??I,x=g?.lastRow??B,F=m??z,v=0,h=[];for(let C=0;C<e.cells.length;C++){let D=e.cells[C],H=D.formatting?.gridSpan??1,ye=`${f??0}-${v}`,re=p?.get(ye),Pe=re?.skip??false,Ce=re?.rowSpan??1,ie;if(l&&t&&t>0){let q=0;for(let A=0;A<H&&v+A<l.length;A++)q+=l[v+A];ie=Math.round(q/t*100);}if(v+=H,Pe)continue;let le=v-H===0,se=v===F,b=D.formatting?.conditionalFormat,G=b?.firstRow??P,Q=b?.lastRow??x,$=b?.firstColumn??le,W=b?.lastColumn??se,_;if(s){let q=u?.firstColumn?1:0,A=v-H-q;A>=0&&!(u?.lastColumn&&W)&&!(u?.firstColumn&&$)&&(_=A%2===0?r?.band1Vert:r?.band2Vert);}b?.oddVBand?_=r?.band1Vert:b?.evenVBand&&(_=r?.band2Vert);let L=i;g?.oddHBand?L=r?.band1Horz:g?.evenHBand&&(L=r?.band2Horz),b?.oddHBand?L=r?.band1Horz:b?.evenHBand&&(L=r?.band2Horz);let T=r?.wholeTable;T=N(T,L),T=N(T,_),G&&(u?.firstRow||g?.firstRow||b?.firstRow)&&(T=N(T,r?.firstRow)),Q&&(u?.lastRow||g?.lastRow||b?.lastRow)&&(T=N(T,r?.lastRow)),$&&(u?.firstColumn||g?.firstColumn||b?.firstColumn)&&(T=N(T,r?.firstCol)),W&&(u?.lastColumn||g?.lastColumn||b?.lastColumn)&&(T=N(T,r?.lastCol)),G&&$&&(u?.firstRow||g?.firstRow||b?.firstRow)&&(u?.firstColumn||g?.firstColumn||b?.firstColumn)&&(T=N(T,r?.nwCell)),G&&W&&(u?.firstRow||g?.firstRow||b?.firstRow)&&(u?.lastColumn||g?.lastColumn||b?.lastColumn)&&(T=N(T,r?.neCell)),Q&&$&&(u?.lastRow||g?.lastRow||b?.lastRow)&&(u?.firstColumn||g?.firstColumn||b?.firstColumn)&&(T=N(T,r?.swCell)),Q&&W&&(u?.lastRow||g?.lastRow||b?.lastRow)&&(u?.lastColumn||g?.lastColumn||b?.lastColumn)&&(T=N(T,r?.seCell)),h.push(he(D,n,o,ie,T,c,I,B,le,se,Ce,S,w));}if(h.length===0){let C=Math.max(F,1),D={formatting:C>1?{gridSpan:C}:void 0,content:[{type:"paragraph",content:[]}]},H=N(r?.wholeTable,i);h.push(he(D,n,o,t&&t>0?100:void 0,H,c,I,B,true,true,1,S,w));}return chunkL5NPEM7C_js.b.node("tableRow",M,h)}var Me=["top","bottom","left","right","insideH","insideV"];function ve(e,n){if(!e)return e;let o;for(let l of Me){let t=e[l];if(!t?.color?.themeColor||t.color.auto)continue;let r=chunkMJ5FQX7Q_js.b(t.color,n);r&&(o??(o={...e}),o[l]={...t,color:{rgb:r}});}return o??e}function he(e,n,o,l,t,r,i,s,u,c,f,d,m){let p=e.formatting,S=f??1,w=p?.width?.value,M=p?.width?.type;w===void 0&&l!==void 0&&(w=l,M="pct");let z=chunkMJ5FQX7Q_js.b(p?.shading?.fill??t?.tcPr?.shading?.fill,m),I=r?{top:i?r.top:r.insideH,bottom:s?r.bottom:r.insideH,left:u?r.left:r.insideV,right:c?r.right:r.insideV}:void 0,B=t?.tcPr?.borders,g=p?.borders,P=ve(I||B||g?{...I??{},...B??{},...g??{}}:void 0,m),x={colspan:p?.gridSpan??1,rowspan:S,width:w,widthType:M,verticalAlign:p?.verticalAlign,backgroundColor:z,textDirection:p?.textDirection,noWrap:p?.noWrap,borders:P,margins:p?.margins?{top:p.margins.top?.value,bottom:p.margins.bottom?.value,left:p.margins.left?.value,right:p.margins.right?.value}:t?.tcPr?.margins?{top:t.tcPr.margins.top?.value,bottom:t.tcPr.margins.bottom?.value,left:t.tcPr.margins.left?.value,right:t.tcPr.margins.right?.value}:d,_originalFormatting:p||void 0,_originalResolvedFill:z};if(e.structuralChange){let h=e.structuralChange,C={revisionId:h.info.id,author:h.info.author,date:h.info.date??null};h.type==="tableCellInsertion"?x.cellMarker={kind:"ins",info:C}:h.type==="tableCellDeletion"?x.cellMarker={kind:"del",info:C}:h.type==="tableCellMerge"&&(x.cellMarker={kind:"merge",info:C,vMerge:h.vMerge??"cont",...h.vMergeOrig?{vMergeOrig:h.vMergeOrig}:{}});}e.propertyChanges&&e.propertyChanges.length>0&&(x.tcPrChange=e.propertyChanges);let F=[];for(let h of e.content)h.type==="paragraph"?F.push(V(h,n,void 0,t?.rPr)):h.type==="table"&&F.push(ne(h,n));F.length===0&&F.push(chunkL5NPEM7C_js.b.node("paragraph",{},[]));let v=o?"tableHeader":"tableCell";return chunkL5NPEM7C_js.b.node(v,x,F)}function be(e,n){let o=Ne(e),l=V(e,n),t=[],r=o.length>0&&l.content.size===0,{anchored:i,inFlow:s}=Ie(o);for(let u of i)t.push(Te(u,n));r||t.push(l);for(let u of s)t.push(Te(u,n));return t}function Ie(e){let n=[],o=[];for(let l of e)chunkC45EFOVP_js.c(l)?n.push(l):o.push(l);return {anchored:n,inFlow:o}}function Ne(e){let n=[];for(let o of e.content)if(o.type==="run"){for(let l of o.content)if(l.type==="shape"&&"shape"in l){let t=l.shape;t.textBody&&t.textBody.content.length>0&&n.push({type:"textBox",id:t.id,size:t.size,position:t.position,wrap:t.wrap,fill:t.fill,outline:t.outline,content:t.textBody.content,margins:t.textBody.margins});}}return n}function Te(e,n){let o=e.size?.width?chunk4Q2IP5FW_js.e(e.size.width):200,l=e.size?.height?chunk4Q2IP5FW_js.e(e.size.height):void 0,t;e.fill?.color?.rgb&&(t=`#${e.fill.color.rgb}`);let r,i,s;e.outline&&e.outline.width&&(r=Math.round(e.outline.width/914400*96*100)/100,e.outline.color?.rgb&&(i=`#${e.outline.color.rgb}`),s=e.outline.style||"solid");let u=e.margins?.top!=null?chunk4Q2IP5FW_js.e(e.margins.top):4,c=e.margins?.bottom!=null?chunk4Q2IP5FW_js.e(e.margins.bottom):4,f=e.margins?.left!=null?chunk4Q2IP5FW_js.e(e.margins.left):7,d=e.margins?.right!=null?chunk4Q2IP5FW_js.e(e.margins.right):7,m=[];for(let p of e.content)m.push(V(p,n));return m.length===0&&m.push(chunkL5NPEM7C_js.b.node("paragraph",{},[])),chunkL5NPEM7C_js.b.node("textBox",{width:o,height:l,textBoxId:e.id,fillColor:t,outlineWidth:r,outlineColor:i,outlineStyle:s,marginTop:u,marginBottom:c,marginLeft:f,marginRight:d,...chunkC45EFOVP_js.d(e)},m)}function oe(e,n,o,l){let t=[];for(let r of e)if(r.type==="paragraph")t.push(...be(r,n)),l&&ge(r)&&t.push(chunkL5NPEM7C_js.b.node("pageBreak"));else if(r.type==="table")t.push(ne(r,n,o));else if(r.type==="blockSdt"){let i=oe(r.content,n,o,l),s=i.length>0?i:[chunkL5NPEM7C_js.b.node("paragraph",{},[])];t.push(chunkL5NPEM7C_js.b.node("blockSdt",chunkC45EFOVP_js.a(r.properties),s));}return t}function mt(e,n){let o=e.package.theme??null,l=n?.styles?chunkLWH66Q7Q_js.b(n.styles):null,t=oe(e.package.document.content,l,o,true);return t.length===0&&t.push(chunkL5NPEM7C_js.b.node("paragraph",{},[])),t[t.length-1]?.type.name==="blockSdt"&&t.push(chunkL5NPEM7C_js.b.node("paragraph",{},[])),chunkL5NPEM7C_js.b.node("doc",{defaultTabStopTwips:e.package.settings?.defaultTabStop??null,watermark:chunkRQVHKDXK_js.a(e)??null},t)}function Be(e,n){let o=n?.styles?chunkLWH66Q7Q_js.b(n.styles):null,l=n?.theme??null,t=oe(e,o,l,false);return t.length===0&&t.push(chunkL5NPEM7C_js.b.node("paragraph",{},[])),chunkL5NPEM7C_js.b.node("doc",{defaultTabStopTwips:n?.defaultTabStopTwips??null},t)}function gt(e,n){return Be(e,n)}function ht(){return chunkL5NPEM7C_js.b.node("doc",null,[chunkL5NPEM7C_js.b.node("paragraph",{},[])])}exports.a=mt;exports.b=Be;exports.c=gt;exports.d=ht;
@@ -1 +1 @@
1
- 'use strict';var chunkPFMM7QON_js=require('./chunk-PFMM7QON.js'),chunk4Q2IP5FW_js=require('./chunk-4Q2IP5FW.js'),chunkDC7S76ZX_js=require('./chunk-DC7S76ZX.js');var i={runImage:"layout-run-image",blockImage:"layout-block-image",pageFloatingImage:"layout-page-floating-image",cellFloatingImage:"layout-cell-floating-image",pageContent:"layout-page-content",paragraph:"layout-paragraph"},y=[`.${i.pageFloatingImage}`,`.${i.cellFloatingImage}`,`.${i.blockImage}`,`.${i.runImage}`].join(", ");function L(n){if(!(n instanceof Element))return null;let e=n.closest(y);if(!e)return null;let o=e.dataset.pmStart;if(o===void 0)return null;let t=Number(o);return Number.isNaN(t)?null:{pos:t,imageEl:e}}function b(n){if(!(n instanceof HTMLElement))return null;if(n.tagName==="IMG"&&n.classList.contains(i.runImage))return n;let e=n.closest(y);return e&&e.dataset.pmStart?e:null}function x(n,e=1){if(!n.classList.contains(i.runImage))return;let o=n.closest(`.${i.pageContent}`),t=n.closest(`.${i.paragraph}`);if(!o||!t)return;let r=n.getBoundingClientRect(),a=o.getBoundingClientRect(),l=t.getBoundingClientRect(),p=e>0?e:1;return {horizontalEmu:Math.round(chunk4Q2IP5FW_js.f((r.left-a.left)/p)),verticalEmu:Math.round(chunk4Q2IP5FW_js.f((r.top-l.top)/p))}}function T(n,e){return n==="inline"?"inline":n==="behind"?"behind":n==="inFront"?"inFront":n==="square"||n==="tight"||n==="through"?e==="right"?"squareRight":"squareLeft":null}var k=[{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 I(n,e){return true}function E(n){switch(n){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 X(n,e){let o=new Map;for(let t=0;t<n.length;t++){let r=n[t],a=e[t];r&&a&&o.set(String(r.id),{block:r,measure:a});}return o}var c=class{constructor(e={}){chunkDC7S76ZX_js.a(this,"container",null);chunkDC7S76ZX_js.a(this,"blockLookup",new Map);chunkDC7S76ZX_js.a(this,"pageStates",[]);chunkDC7S76ZX_js.a(this,"totalPages",0);chunkDC7S76ZX_js.a(this,"options");chunkDC7S76ZX_js.a(this,"doc");chunkDC7S76ZX_js.a(this,"resolvedCommentIds",new Set);this.options=e,this.doc=e.document??document;}setBlockLookup(e){this.blockLookup=e;}mount(e){this.container=e,this.applyContainerStyles();}unmount(){this.container&&(this.container.innerHTML=""),this.container=null,this.pageStates=[];}applyContainerStyles(){if(!this.container)return;let e=this.options.pageGap??24;this.container.style.display="flex",this.container.style.flexDirection="column",this.container.style.alignItems="center",this.container.style.gap=`${e}px`,this.container.style.padding=`${e}px`,this.container.style.backgroundColor=this.options.containerBackground??"var(--doc-bg, #f8f9fa)",this.container.style.minHeight="100%";}paint(e){if(!this.container)throw new Error("LayoutPainter: not mounted");let{pages:o}=e;this.totalPages=o.length,this.container.innerHTML="",this.pageStates=[];for(let t=0;t<o.length;t++){let r=o[t],a={pageNumber:r.number,totalPages:this.totalPages,section:"body",resolvedCommentIds:this.resolvedCommentIds},l=this.renderPageWithLookup(r,a);this.container.appendChild(l),this.pageStates.push({element:l,pageNumber:r.number,fragmentCount:r.fragments.length});}}renderPageWithLookup(e,o){let t=this.doc.createElement("div");t.className="layout-page",t.dataset.pageNumber=String(e.number),t.style.position="relative",t.style.width=`${e.size.w}px`,t.style.height=`${e.size.h}px`,t.style.backgroundColor=this.options.pageBackground??"#ffffff",t.style.overflow="hidden",this.options.showShadow&&(t.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.15)");let r=this.doc.createElement("div");r.className="layout-page-content",r.style.position="absolute",r.style.top=`${e.margins.top}px`,r.style.left=`${e.margins.left}px`,r.style.right=`${e.margins.right}px`,r.style.bottom=`${e.margins.bottom}px`,r.style.overflow="visible";for(let a of e.fragments){let l=this.renderFragmentWithLookup(a,o);this.applyFragmentPosition(l,a),r.appendChild(l);}return t.appendChild(r),t}renderFragmentWithLookup(e,o){let t=this.blockLookup.get(String(e.blockId));if(e.kind==="paragraph"&&t){let r=t.block,a=t.measure;return chunkPFMM7QON_js.t(e,r,a,o,{document:this.doc})}if(e.kind==="table"&&t){let r=t.block,a=t.measure;return chunkPFMM7QON_js.w(e,r,a,o,{document:this.doc})}if(e.kind==="image"&&t){let r=t.block,a=t.measure;return chunkPFMM7QON_js.q(e,r,a,o,{document:this.doc})}if(e.kind==="textBox"&&t){let r=t.block,a=t.measure;return chunkPFMM7QON_js.y(e,r,a,o,{document:this.doc})}return chunkPFMM7QON_js.o(e,o,{document:this.doc})}applyFragmentPosition(e,o){e.style.position="absolute",e.style.left=`${o.x}px`,e.style.top=`${o.y}px`,e.style.width=`${o.width}px`,"height"in o&&(e.style.height=`${o.height}px`);}getPageCount(){return this.totalPages}getPageElement(e){return this.pageStates[e]?.element??null}scrollToPage(e){let o=this.pageStates.find(t=>t.pageNumber===e);o?.element&&o.element.scrollIntoView({behavior:"smooth",block:"start"});}};function Z(n){return new c(n)}exports.a=i;exports.b=L;exports.c=b;exports.d=x;exports.e=T;exports.f=k;exports.g=I;exports.h=E;exports.i=X;exports.j=c;exports.k=Z;
1
+ 'use strict';var chunkKAOLVBLH_js=require('./chunk-KAOLVBLH.js'),chunk4Q2IP5FW_js=require('./chunk-4Q2IP5FW.js'),chunkDC7S76ZX_js=require('./chunk-DC7S76ZX.js');var i={runImage:"layout-run-image",blockImage:"layout-block-image",pageFloatingImage:"layout-page-floating-image",cellFloatingImage:"layout-cell-floating-image",pageContent:"layout-page-content",paragraph:"layout-paragraph"},y=[`.${i.pageFloatingImage}`,`.${i.cellFloatingImage}`,`.${i.blockImage}`,`.${i.runImage}`].join(", ");function L(n){if(!(n instanceof Element))return null;let e=n.closest(y);if(!e)return null;let o=e.dataset.pmStart;if(o===void 0)return null;let t=Number(o);return Number.isNaN(t)?null:{pos:t,imageEl:e}}function b(n){if(!(n instanceof HTMLElement))return null;if(n.tagName==="IMG"&&n.classList.contains(i.runImage))return n;let e=n.closest(y);return e&&e.dataset.pmStart?e:null}function x(n,e=1){if(!n.classList.contains(i.runImage))return;let o=n.closest(`.${i.pageContent}`),t=n.closest(`.${i.paragraph}`);if(!o||!t)return;let r=n.getBoundingClientRect(),a=o.getBoundingClientRect(),l=t.getBoundingClientRect(),p=e>0?e:1;return {horizontalEmu:Math.round(chunk4Q2IP5FW_js.f((r.left-a.left)/p)),verticalEmu:Math.round(chunk4Q2IP5FW_js.f((r.top-l.top)/p))}}function T(n,e){return n==="inline"?"inline":n==="behind"?"behind":n==="inFront"?"inFront":n==="square"||n==="tight"||n==="through"?e==="right"?"squareRight":"squareLeft":null}var k=[{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 I(n,e){return true}function E(n){switch(n){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 X(n,e){let o=new Map;for(let t=0;t<n.length;t++){let r=n[t],a=e[t];r&&a&&o.set(String(r.id),{block:r,measure:a});}return o}var c=class{constructor(e={}){chunkDC7S76ZX_js.a(this,"container",null);chunkDC7S76ZX_js.a(this,"blockLookup",new Map);chunkDC7S76ZX_js.a(this,"pageStates",[]);chunkDC7S76ZX_js.a(this,"totalPages",0);chunkDC7S76ZX_js.a(this,"options");chunkDC7S76ZX_js.a(this,"doc");chunkDC7S76ZX_js.a(this,"resolvedCommentIds",new Set);this.options=e,this.doc=e.document??document;}setBlockLookup(e){this.blockLookup=e;}mount(e){this.container=e,this.applyContainerStyles();}unmount(){this.container&&(this.container.innerHTML=""),this.container=null,this.pageStates=[];}applyContainerStyles(){if(!this.container)return;let e=this.options.pageGap??24;this.container.style.display="flex",this.container.style.flexDirection="column",this.container.style.alignItems="center",this.container.style.gap=`${e}px`,this.container.style.padding=`${e}px`,this.container.style.backgroundColor=this.options.containerBackground??"var(--doc-bg, #f8f9fa)",this.container.style.minHeight="100%";}paint(e){if(!this.container)throw new Error("LayoutPainter: not mounted");let{pages:o}=e;this.totalPages=o.length,this.container.innerHTML="",this.pageStates=[];for(let t=0;t<o.length;t++){let r=o[t],a={pageNumber:r.number,totalPages:this.totalPages,section:"body",resolvedCommentIds:this.resolvedCommentIds},l=this.renderPageWithLookup(r,a);this.container.appendChild(l),this.pageStates.push({element:l,pageNumber:r.number,fragmentCount:r.fragments.length});}}renderPageWithLookup(e,o){let t=this.doc.createElement("div");t.className="layout-page",t.dataset.pageNumber=String(e.number),t.style.position="relative",t.style.width=`${e.size.w}px`,t.style.height=`${e.size.h}px`,t.style.backgroundColor=this.options.pageBackground??"#ffffff",t.style.overflow="hidden",this.options.showShadow&&(t.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.15)");let r=this.doc.createElement("div");r.className="layout-page-content",r.style.position="absolute",r.style.top=`${e.margins.top}px`,r.style.left=`${e.margins.left}px`,r.style.right=`${e.margins.right}px`,r.style.bottom=`${e.margins.bottom}px`,r.style.overflow="visible";for(let a of e.fragments){let l=this.renderFragmentWithLookup(a,o);this.applyFragmentPosition(l,a),r.appendChild(l);}return t.appendChild(r),t}renderFragmentWithLookup(e,o){let t=this.blockLookup.get(String(e.blockId));if(e.kind==="paragraph"&&t){let r=t.block,a=t.measure;return chunkKAOLVBLH_js.t(e,r,a,o,{document:this.doc})}if(e.kind==="table"&&t){let r=t.block,a=t.measure;return chunkKAOLVBLH_js.w(e,r,a,o,{document:this.doc})}if(e.kind==="image"&&t){let r=t.block,a=t.measure;return chunkKAOLVBLH_js.q(e,r,a,o,{document:this.doc})}if(e.kind==="textBox"&&t){let r=t.block,a=t.measure;return chunkKAOLVBLH_js.y(e,r,a,o,{document:this.doc})}return chunkKAOLVBLH_js.o(e,o,{document:this.doc})}applyFragmentPosition(e,o){e.style.position="absolute",e.style.left=`${o.x}px`,e.style.top=`${o.y}px`,e.style.width=`${o.width}px`,"height"in o&&(e.style.height=`${o.height}px`);}getPageCount(){return this.totalPages}getPageElement(e){return this.pageStates[e]?.element??null}scrollToPage(e){let o=this.pageStates.find(t=>t.pageNumber===e);o?.element&&o.element.scrollIntoView({behavior:"smooth",block:"start"});}};function Z(n){return new c(n)}exports.a=i;exports.b=L;exports.c=b;exports.d=x;exports.e=T;exports.f=k;exports.g=I;exports.h=E;exports.i=X;exports.j=c;exports.k=Z;
package/dist/core.js CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkTE2VQJZG_js=require('./chunk-TE2VQJZG.js'),chunk4G6AJ4ZM_js=require('./chunk-4G6AJ4ZM.js'),chunkY74ANBPV_js=require('./chunk-Y74ANBPV.js'),chunk4PANZ3VU_js=require('./chunk-4PANZ3VU.js');require('./chunk-ZAZWHK4J.js');var chunkPFMM7QON_js=require('./chunk-PFMM7QON.js');require('./chunk-YPQACU4A.js'),require('./chunk-4MYKVWNF.js'),require('./chunk-J3YFJDZD.js'),require('./chunk-RSU4HTC6.js'),require('./chunk-IMKU4O3P.js'),require('./chunk-DROCYKAR.js');var chunkKESNGXGO_js=require('./chunk-KESNGXGO.js'),chunk2SGJZYQF_js=require('./chunk-2SGJZYQF.js'),chunkCZSAC65M_js=require('./chunk-CZSAC65M.js'),chunkNXLJVVVE_js=require('./chunk-NXLJVVVE.js'),chunk3QPKTG2Y_js=require('./chunk-3QPKTG2Y.js'),chunkU4UCHBZ7_js=require('./chunk-U4UCHBZ7.js'),chunkESI4BSBF_js=require('./chunk-ESI4BSBF.js'),chunkTE2AF7FM_js=require('./chunk-TE2AF7FM.js'),chunkBH3ACQ3M_js=require('./chunk-BH3ACQ3M.js'),chunkNAFMAKLK_js=require('./chunk-NAFMAKLK.js'),chunk4BFNWPKW_js=require('./chunk-4BFNWPKW.js'),chunkOTHV7YV2_js=require('./chunk-OTHV7YV2.js');require('./chunk-LERLET2D.js'),require('./chunk-FIGLFSNR.js');var chunkMNOHUTKE_js=require('./chunk-MNOHUTKE.js'),chunkI6PMX4BO_js=require('./chunk-I6PMX4BO.js');require('./chunk-QVRNNRG5.js'),require('./chunk-C45EFOVP.js'),require('./chunk-ISKTBM4L.js'),require('./chunk-JFZIXFRC.js'),require('./chunk-RQVHKDXK.js'),require('./chunk-SCK6ZM5V.js'),require('./chunk-Z3LGMBJC.js'),require('./chunk-3R7QHNI5.js'),require('./chunk-WWBNJ7KF.js'),require('./chunk-4RTVLMRZ.js'),require('./chunk-BHBOAP6Z.js'),require('./chunk-MZ7LW5CH.js'),require('./chunk-N3Y5BUKV.js'),require('./chunk-WVERBZZU.js'),require('./chunk-6LVPRTB6.js'),require('./chunk-LWH66Q7Q.js'),require('./chunk-TUIEV7Q7.js'),require('./chunk-7HANRHHL.js');var chunkMJ5FQX7Q_js=require('./chunk-MJ5FQX7Q.js');require('./chunk-C2BAPYGJ.js');var chunk4Q2IP5FW_js=require('./chunk-4Q2IP5FW.js');require('./chunk-GSKMHXHG.js');var chunkDC7S76ZX_js=require('./chunk-DC7S76ZX.js');function L(i){if(!i||i==="transparent"||i==="inherit")return null;if(i.startsWith("#"))return i.slice(1).toUpperCase();let o=i.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(o){let e=parseInt(o[1]).toString(16).padStart(2,"0"),t=parseInt(o[2]).toString(16).padStart(2,"0"),n=parseInt(o[3]).toString(16).padStart(2,"0");return (e+t+n).toUpperCase()}return null}function h(i){let o=window.getComputedStyle(i),e={};(o.fontWeight==="bold"||parseInt(o.fontWeight)>=700)&&(e.bold=true),o.fontStyle==="italic"&&(e.italic=true);let t=o.textDecoration||o.textDecorationLine;t&&t.includes("underline")&&(e.underline={style:"single"}),t&&t.includes("line-through")&&(e.strike=true);let n=parseFloat(o.fontSize);!isNaN(n)&&n>0&&(e.fontSize=Math.round(n/1.333*2));let r=o.fontFamily.replace(/["']/g,"").split(",")[0].trim();r&&(e.fontFamily={ascii:r});let s=o.color;if(s&&s!=="rgb(0, 0, 0)"){let c=L(s);c&&(e.color={rgb:c});}let l=o.backgroundColor;if(l&&l!=="transparent"&&l!=="rgba(0, 0, 0, 0)"){let c=S(l);c&&(e.shading={fill:{rgb:c}});}return Object.keys(e).length>0?e:void 0}function Lt(i,o){let e=document.createRange();e.selectNodeContents(i);let t=o.compareBoundaryPoints(Range.START_TO_START,e)>=0&&o.compareBoundaryPoints(Range.START_TO_END,e)<=0,n=o.compareBoundaryPoints(Range.END_TO_START,e)>=0&&o.compareBoundaryPoints(Range.END_TO_END,e)<=0;if(t&&n)return o.toString();if(t){let r=document.createRange();return r.setStart(o.startContainer,o.startOffset),r.selectNodeContents(i),r.setEnd(e.endContainer,e.endOffset),r.toString()}else if(n){let r=document.createRange();return r.selectNodeContents(i),r.setEnd(o.endContainer,o.endOffset),r.setStart(e.startContainer,e.startOffset),r.toString()}else if(o.intersectsNode(i))return i.textContent||"";return ""}function F(i){let o=i;for(;o;){if(o.nodeType===Node.ELEMENT_NODE){let e=o;if(e.hasAttribute("data-paragraph-index"))return e}o=o.parentNode;}return null}function f(){let i=window.getSelection();if(!i||i.isCollapsed)return [];let o=[],e=i.getRangeAt(0),t=e.commonAncestorContainer,n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;if(!n)return o;if(n.querySelectorAll(".docx-run").forEach(s=>{if(e.intersectsNode(s)){let l=Lt(s,e);if(l){let c=h(s);o.push({type:"run",formatting:c,content:[{type:"text",text:l}]});}}}),o.length===0){let s=i.toString();s&&o.push({type:"run",content:[{type:"text",text:s}]});}return o}function A(){let i=window.getSelection();if(!i||i.isCollapsed)return null;let o=f();if(o.length===0)return null;let e=i.toString(),t=i.getRangeAt(0),n=F(t.startContainer),r=F(t.endContainer),s=n?parseInt(n.getAttribute("data-paragraph-index")||"0",10):0,l=r?parseInt(r.getAttribute("data-paragraph-index")||"0",10):0;return {text:e,runs:o,startParagraphIndex:s,startRunIndex:0,startOffset:t.startOffset,endParagraphIndex:l,endRunIndex:0,endOffset:t.endOffset,isMultiParagraph:s!==l}}var S=L;var d=class extends chunkY74ANBPV_js.a{constructor(){super({notifications:[]});chunkDC7S76ZX_js.a(this,"notifications",[]);chunkDC7S76ZX_js.a(this,"idCounter",0);chunkDC7S76ZX_js.a(this,"timers",new Set);}showError(e,t){return this.addNotification(e,"error",t)}showWarning(e,t){return this.addNotification(e,"warning",t)}showInfo(e,t){return this.addNotification(e,"info",t)}dismiss(e){this.notifications=this.notifications.map(n=>n.id===e?{...n,dismissed:true}:n),this.emitSnapshot();let t=setTimeout(()=>{this.timers.delete(t),this.notifications=this.notifications.filter(n=>n.id!==e),this.emitSnapshot();},300);this.timers.add(t);}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,t,n){let r=`error-${++this.idCounter}-${Date.now()}`,s={id:r,message:e,severity:t,details:n,timestamp:Date.now()};if(this.notifications=[...this.notifications,s],this.emitSnapshot(),t!=="error"){let l=setTimeout(()=>{this.timers.delete(l),this.dismiss(r);},5e3);this.timers.add(l);}return r}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};function z(i,o){let e=`plugin-styles-${i}`,t=document.getElementById(e);t&&t.remove();let n=document.createElement("style");return n.id=e,n.textContent=o,document.head.appendChild(n),()=>{let r=document.getElementById(e);r&&r.remove();}}var u=class extends chunkY74ANBPV_js.a{constructor(){super({states:new Map,version:0});chunkDC7S76ZX_js.a(this,"plugins",[]);chunkDC7S76ZX_js.a(this,"pluginStates",new Map);chunkDC7S76ZX_js.a(this,"version",0);}initialize(e,t){this.destroyPlugins(),this.plugins=e;for(let n of e)n.initialize&&!this.pluginStates.has(n.id)&&this.pluginStates.set(n.id,n.initialize(t));this.emitSnapshot();}updateStates(e){let t=false;for(let n of this.plugins)if(n.onStateChange){let r=n.onStateChange(e);r!==void 0&&(this.pluginStates.set(n.id,r),t=true);}return t&&(this.version++,this.emitSnapshot()),t}getPluginState(e){return this.pluginStates.get(e)}setPluginState(e,t){this.pluginStates.set(e,t),this.version++,this.emitSnapshot();}destroy(){this.destroyPlugins(),this.emitSnapshot();}destroyPlugins(){for(let e of this.plugins)e.destroy&&e.destroy();this.pluginStates.clear(),this.plugins=[];}emitSnapshot(){this.setSnapshot({states:new Map(this.pluginStates),version:this.version});}};var p=class extends chunkY74ANBPV_js.a{constructor(){super({hasLayout:false,selectionRects:[],caretPosition:null,selectedImageInfo:null,isFocused:false,isDragging:false,isResizingColumn:false,isImageInteracting:false,version:0});chunkDC7S76ZX_js.a(this,"_hasLayout",false);chunkDC7S76ZX_js.a(this,"_selectionRects",[]);chunkDC7S76ZX_js.a(this,"_caretPosition",null);chunkDC7S76ZX_js.a(this,"_isDragging",false);chunkDC7S76ZX_js.a(this,"_dragAnchor",null);chunkDC7S76ZX_js.a(this,"_columnResize",{isResizing:false,startX:0,columnIndex:0,tablePmStart:0,originalWidths:{left:0,right:0}});chunkDC7S76ZX_js.a(this,"_selectedImageInfo",null);chunkDC7S76ZX_js.a(this,"_isImageInteracting",false);chunkDC7S76ZX_js.a(this,"_isFocused",false);chunkDC7S76ZX_js.a(this,"_version",0);}setLayoutReady(e){this._hasLayout=e,this.emitSnapshot();}updateSelection(e,t){this._selectionRects=e,this._caretPosition=t,this.emitSnapshot();}startDrag(e){this._isDragging=true,this._dragAnchor=e,this.emitSnapshot();}endDrag(){this._isDragging=false,this._dragAnchor=null,this.emitSnapshot();}getDragAnchor(){return this._dragAnchor}startColumnResize(e,t,n,r){this._columnResize={isResizing:true,startX:n,columnIndex:t,tablePmStart:e,originalWidths:r},this.emitSnapshot();}endColumnResize(){this._columnResize={...this._columnResize,isResizing:false},this.emitSnapshot();}getColumnResize(){return this._columnResize}setSelectedImage(e){this._selectedImageInfo=e,this.emitSnapshot();}clearSelectedImage(){this._selectedImageInfo=null,this._isImageInteracting=false,this.emitSnapshot();}setImageInteracting(e){this._isImageInteracting=e,this.emitSnapshot();}setFocused(e){this._isFocused=e,this.emitSnapshot();}emitSnapshot(){this._version++,this.setSnapshot({hasLayout:this._hasLayout,selectionRects:this._selectionRects,caretPosition:this._caretPosition,selectedImageInfo:this._selectedImageInfo,isFocused:this._isFocused,isDragging:this._isDragging,isResizingColumn:this._columnResize.isResizing,isImageInteracting:this._isImageInteracting,version:this._version});}};var g=class extends chunkY74ANBPV_js.a{constructor(e={}){let t=e.initialZoom??1;super({loadingState:"idle",parseError:null,isReady:false,zoom:t,fontsLoaded:false,version:0});chunkDC7S76ZX_js.a(this,"_loadingState","idle");chunkDC7S76ZX_js.a(this,"_parseError",null);chunkDC7S76ZX_js.a(this,"_zoom");chunkDC7S76ZX_js.a(this,"_fontsLoaded",false);chunkDC7S76ZX_js.a(this,"_document",null);chunkDC7S76ZX_js.a(this,"_version",0);chunkDC7S76ZX_js.a(this,"onChangeCallback");chunkDC7S76ZX_js.a(this,"onErrorCallback");this._zoom=t,this.onChangeCallback=e.onChange,this.onErrorCallback=e.onError;}setParsingStarted(){this._loadingState="parsing",this._parseError=null,this.emitSnapshot();}setDocumentLoaded(e){this._document=e,this._loadingState="loading-fonts",this._parseError=null,this.emitSnapshot();}setFontsLoaded(){this._fontsLoaded=true,this._loadingState="ready",this.emitSnapshot();}setLoadError(e){this._loadingState="error",this._parseError=e.message,this.onErrorCallback?.(e),this.emitSnapshot();}getDocument(){return this._document}updateDocument(e){this._document=e,this.onChangeCallback?.(e),this.emitSnapshot();}setZoom(e){this._zoom=Math.max(.25,Math.min(4,e)),this.emitSnapshot();}getZoom(){return this._zoom}emitSnapshot(){this._version++,this.setSnapshot({loadingState:this._loadingState,parseError:this._parseError,isReady:this._loadingState==="ready",zoom:this._zoom,fontsLoaded:this._fontsLoaded,version:this._version});}};var to="0.0.2";Object.defineProperty(exports,"AutoSaveManager",{enumerable:true,get:function(){return chunkTE2VQJZG_js.a}});Object.defineProperty(exports,"formatLastSaveTime",{enumerable:true,get:function(){return chunkTE2VQJZG_js.b}});Object.defineProperty(exports,"formatStorageSize",{enumerable:true,get:function(){return chunkTE2VQJZG_js.e}});Object.defineProperty(exports,"getAutoSaveStatusLabel",{enumerable:true,get:function(){return chunkTE2VQJZG_js.c}});Object.defineProperty(exports,"getAutoSaveStorageSize",{enumerable:true,get:function(){return chunkTE2VQJZG_js.d}});Object.defineProperty(exports,"isAutoSaveSupported",{enumerable:true,get:function(){return chunkTE2VQJZG_js.f}});Object.defineProperty(exports,"TABLE_DATA_ATTRIBUTES",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.a}});Object.defineProperty(exports,"TableSelectionManager",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.f}});Object.defineProperty(exports,"deleteTableFromDocument",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.e}});Object.defineProperty(exports,"findTableFromClick",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.b}});Object.defineProperty(exports,"getTableFromDocument",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.c}});Object.defineProperty(exports,"updateTableInDocument",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.d}});Object.defineProperty(exports,"Subscribable",{enumerable:true,get:function(){return chunkY74ANBPV_js.a}});Object.defineProperty(exports,"convertHeaderFooterToContent",{enumerable:true,get:function(){return chunk4PANZ3VU_js.y}});Object.defineProperty(exports,"FOOTNOTE_SEPARATOR_HEIGHT",{enumerable:true,get:function(){return chunkPFMM7QON_js.a}});Object.defineProperty(exports,"MAX_FOOTNOTE_LAYOUT_PASSES",{enumerable:true,get:function(){return chunkPFMM7QON_js.b}});Object.defineProperty(exports,"buildFootnoteContentMap",{enumerable:true,get:function(){return chunkPFMM7QON_js.h}});Object.defineProperty(exports,"buildFootnoteRenderItems",{enumerable:true,get:function(){return chunkPFMM7QON_js.k}});Object.defineProperty(exports,"calculateFootnoteReservedHeights",{enumerable:true,get:function(){return chunkPFMM7QON_js.i}});Object.defineProperty(exports,"collectFootnoteRefs",{enumerable:true,get:function(){return chunkPFMM7QON_js.d}});Object.defineProperty(exports,"footnoteReservedHeightsEqual",{enumerable:true,get:function(){return chunkPFMM7QON_js.c}});Object.defineProperty(exports,"mapFootnotesToPages",{enumerable:true,get:function(){return chunkPFMM7QON_js.e}});Object.defineProperty(exports,"stabilizeFootnoteLayout",{enumerable:true,get:function(){return chunkPFMM7QON_js.j}});Object.defineProperty(exports,"countPageBreaks",{enumerable:true,get:function(){return chunkKESNGXGO_js.n}});Object.defineProperty(exports,"createColumnBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.b}});Object.defineProperty(exports,"createHorizontalRule",{enumerable:true,get:function(){return chunkKESNGXGO_js.g}});Object.defineProperty(exports,"createLineBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.c}});Object.defineProperty(exports,"createPageBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.a}});Object.defineProperty(exports,"createPageBreakParagraph",{enumerable:true,get:function(){return chunkKESNGXGO_js.e}});Object.defineProperty(exports,"createPageBreakRun",{enumerable:true,get:function(){return chunkKESNGXGO_js.d}});Object.defineProperty(exports,"findPageBreaks",{enumerable:true,get:function(){return chunkKESNGXGO_js.o}});Object.defineProperty(exports,"hasPageBreakBefore",{enumerable:true,get:function(){return chunkKESNGXGO_js.m}});Object.defineProperty(exports,"insertHorizontalRule",{enumerable:true,get:function(){return chunkKESNGXGO_js.h}});Object.defineProperty(exports,"insertPageBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.f}});Object.defineProperty(exports,"isBreakContent",{enumerable:true,get:function(){return chunkKESNGXGO_js.l}});Object.defineProperty(exports,"isColumnBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.j}});Object.defineProperty(exports,"isLineBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.k}});Object.defineProperty(exports,"isPageBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.i}});Object.defineProperty(exports,"removePageBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.p}});Object.defineProperty(exports,"DocumentAgent",{enumerable:true,get:function(){return chunk2SGJZYQF_js.a}});Object.defineProperty(exports,"buildExtendedSelectionContext",{enumerable:true,get:function(){return chunk2SGJZYQF_js.h}});Object.defineProperty(exports,"buildSelectionContext",{enumerable:true,get:function(){return chunk2SGJZYQF_js.g}});Object.defineProperty(exports,"getAgentContext",{enumerable:true,get:function(){return chunk2SGJZYQF_js.d}});Object.defineProperty(exports,"getDocumentSummary",{enumerable:true,get:function(){return chunk2SGJZYQF_js.f}});Object.defineProperty(exports,"attemptSelectiveSave",{enumerable:true,get:function(){return chunkCZSAC65M_js.c}});Object.defineProperty(exports,"buildPatchedDocumentXml",{enumerable:true,get:function(){return chunkCZSAC65M_js.b}});Object.defineProperty(exports,"validatePatchSafety",{enumerable:true,get:function(){return chunkCZSAC65M_js.a}});Object.defineProperty(exports,"createDocumentWithText",{enumerable:true,get:function(){return chunkNXLJVVVE_js.b}});Object.defineProperty(exports,"createEmptyDocument",{enumerable:true,get:function(){return chunkNXLJVVVE_js.a}});Object.defineProperty(exports,"docxtemplaterPlugin",{enumerable:true,get:function(){return chunk3QPKTG2Y_js.b}});Object.defineProperty(exports,"detectVariables",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.a}});Object.defineProperty(exports,"detectVariablesDetailed",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.b}});Object.defineProperty(exports,"detectVariablesInBody",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.c}});Object.defineProperty(exports,"detectVariablesInParagraph",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.d}});Object.defineProperty(exports,"documentHasVariables",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.m}});Object.defineProperty(exports,"extractVariablesFromText",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.e}});Object.defineProperty(exports,"formatVariable",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.i}});Object.defineProperty(exports,"hasTemplateVariables",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.f}});Object.defineProperty(exports,"isValidVariableName",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.g}});Object.defineProperty(exports,"parseVariable",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.j}});Object.defineProperty(exports,"removeVariables",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.l}});Object.defineProperty(exports,"replaceVariables",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.k}});Object.defineProperty(exports,"sanitizeVariableName",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.h}});Object.defineProperty(exports,"getTemplateTags",{enumerable:true,get:function(){return chunkESI4BSBF_js.e}});Object.defineProperty(exports,"processTemplate",{enumerable:true,get:function(){return chunkESI4BSBF_js.a}});Object.defineProperty(exports,"processTemplateAsBlob",{enumerable:true,get:function(){return chunkESI4BSBF_js.c}});Object.defineProperty(exports,"processTemplateDetailed",{enumerable:true,get:function(){return chunkESI4BSBF_js.b}});Object.defineProperty(exports,"validateTemplate",{enumerable:true,get:function(){return chunkESI4BSBF_js.f}});Object.defineProperty(exports,"executeCommand",{enumerable:true,get:function(){return chunkTE2AF7FM_js.a}});Object.defineProperty(exports,"executeCommands",{enumerable:true,get:function(){return chunkTE2AF7FM_js.b}});Object.defineProperty(exports,"createDocx",{enumerable:true,get:function(){return chunkBH3ACQ3M_js.t}});Object.defineProperty(exports,"repackDocx",{enumerable:true,get:function(){return chunkBH3ACQ3M_js.i}});Object.defineProperty(exports,"updateMultipleFiles",{enumerable:true,get:function(){return chunkBH3ACQ3M_js.m}});Object.defineProperty(exports,"serializeDocumentBody",{enumerable:true,get:function(){return chunkNAFMAKLK_js.g}});Object.defineProperty(exports,"serializeDocx",{enumerable:true,get:function(){return chunkNAFMAKLK_js.h}});Object.defineProperty(exports,"serializeSectionProperties",{enumerable:true,get:function(){return chunkNAFMAKLK_js.c}});Object.defineProperty(exports,"PluginRegistry",{enumerable:true,get:function(){return chunk4BFNWPKW_js.a}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunk4BFNWPKW_js.b}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunk4BFNWPKW_js.c}});Object.defineProperty(exports,"parseDocx",{enumerable:true,get:function(){return chunkOTHV7YV2_js.f}});Object.defineProperty(exports,"canRenderFont",{enumerable:true,get:function(){return chunkMNOHUTKE_js.h}});Object.defineProperty(exports,"getLoadedFonts",{enumerable:true,get:function(){return chunkMNOHUTKE_js.e}});Object.defineProperty(exports,"isFontLoaded",{enumerable:true,get:function(){return chunkMNOHUTKE_js.c}});Object.defineProperty(exports,"isFontsLoading",{enumerable:true,get:function(){return chunkMNOHUTKE_js.d}});Object.defineProperty(exports,"loadFont",{enumerable:true,get:function(){return chunkMNOHUTKE_js.a}});Object.defineProperty(exports,"loadFontFromBuffer",{enumerable:true,get:function(){return chunkMNOHUTKE_js.i}});Object.defineProperty(exports,"loadFonts",{enumerable:true,get:function(){return chunkMNOHUTKE_js.b}});Object.defineProperty(exports,"onFontsLoaded",{enumerable:true,get:function(){return chunkMNOHUTKE_js.f}});Object.defineProperty(exports,"preloadCommonFonts",{enumerable:true,get:function(){return chunkMNOHUTKE_js.p}});Object.defineProperty(exports,"toArrayBuffer",{enumerable:true,get:function(){return chunkMNOHUTKE_js.s}});Object.defineProperty(exports,"findParagraphByParaId",{enumerable:true,get:function(){return chunkI6PMX4BO_js.b}});Object.defineProperty(exports,"findStartPosForParaId",{enumerable:true,get:function(){return chunkI6PMX4BO_js.a}});Object.defineProperty(exports,"blendColors",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.m}});Object.defineProperty(exports,"colorsEqual",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.r}});Object.defineProperty(exports,"createRgbColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.j}});Object.defineProperty(exports,"createThemeColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.i}});Object.defineProperty(exports,"darkenColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.k}});Object.defineProperty(exports,"ensureHexPrefix",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.n}});Object.defineProperty(exports,"generateThemeTintShadeMatrix",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.q}});Object.defineProperty(exports,"getContrastingColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.g}});Object.defineProperty(exports,"getThemeTintShadeHex",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.p}});Object.defineProperty(exports,"isBlack",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.e}});Object.defineProperty(exports,"isWhite",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.f}});Object.defineProperty(exports,"lightenColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.l}});Object.defineProperty(exports,"parseColorString",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.h}});Object.defineProperty(exports,"resolveColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.a}});Object.defineProperty(exports,"resolveHighlightColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.c}});Object.defineProperty(exports,"resolveHighlightToCss",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.o}});Object.defineProperty(exports,"resolveShadingColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.d}});Object.defineProperty(exports,"emuToPixels",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.e}});Object.defineProperty(exports,"emuToTwips",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.g}});Object.defineProperty(exports,"formatPx",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.p}});Object.defineProperty(exports,"halfPointsToPixels",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.j}});Object.defineProperty(exports,"pixelsToEmu",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.f}});Object.defineProperty(exports,"pixelsToTwips",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.d}});Object.defineProperty(exports,"pointsToPixels",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.i}});Object.defineProperty(exports,"twipsToEmu",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.h}});Object.defineProperty(exports,"twipsToPixels",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.c}});exports.EditorCoordinator=g;exports.ErrorManager=d;exports.LayoutCoordinator=p;exports.PluginLifecycleManager=u;exports.VERSION=to;exports.createSelectionFromDOM=A;exports.extractFormattingFromElement=h;exports.getSelectionRuns=f;exports.injectStyles=z;exports.rgbToHex=S;
1
+ 'use strict';var chunkTE2VQJZG_js=require('./chunk-TE2VQJZG.js'),chunk4G6AJ4ZM_js=require('./chunk-4G6AJ4ZM.js'),chunkY74ANBPV_js=require('./chunk-Y74ANBPV.js'),chunkQ4IEATDJ_js=require('./chunk-Q4IEATDJ.js');require('./chunk-6IZOFIQH.js');var chunkKAOLVBLH_js=require('./chunk-KAOLVBLH.js');require('./chunk-YPQACU4A.js'),require('./chunk-77GRQUSK.js'),require('./chunk-J3YFJDZD.js'),require('./chunk-RSU4HTC6.js'),require('./chunk-IMKU4O3P.js'),require('./chunk-DROCYKAR.js');var chunkKESNGXGO_js=require('./chunk-KESNGXGO.js'),chunk2SGJZYQF_js=require('./chunk-2SGJZYQF.js'),chunkCZSAC65M_js=require('./chunk-CZSAC65M.js'),chunkNXLJVVVE_js=require('./chunk-NXLJVVVE.js'),chunk3QPKTG2Y_js=require('./chunk-3QPKTG2Y.js'),chunkU4UCHBZ7_js=require('./chunk-U4UCHBZ7.js'),chunkESI4BSBF_js=require('./chunk-ESI4BSBF.js'),chunkTE2AF7FM_js=require('./chunk-TE2AF7FM.js'),chunkBH3ACQ3M_js=require('./chunk-BH3ACQ3M.js'),chunkNAFMAKLK_js=require('./chunk-NAFMAKLK.js'),chunk4BFNWPKW_js=require('./chunk-4BFNWPKW.js'),chunkOTHV7YV2_js=require('./chunk-OTHV7YV2.js');require('./chunk-LERLET2D.js'),require('./chunk-FIGLFSNR.js');var chunkMNOHUTKE_js=require('./chunk-MNOHUTKE.js'),chunkI6PMX4BO_js=require('./chunk-I6PMX4BO.js');require('./chunk-XLB6AC5Q.js'),require('./chunk-C45EFOVP.js'),require('./chunk-ISKTBM4L.js'),require('./chunk-JFZIXFRC.js'),require('./chunk-RQVHKDXK.js'),require('./chunk-SCK6ZM5V.js'),require('./chunk-Z3LGMBJC.js'),require('./chunk-3R7QHNI5.js'),require('./chunk-L5NPEM7C.js'),require('./chunk-2WGTGBBS.js'),require('./chunk-BHBOAP6Z.js'),require('./chunk-MZ7LW5CH.js'),require('./chunk-N3Y5BUKV.js'),require('./chunk-WVERBZZU.js'),require('./chunk-6LVPRTB6.js'),require('./chunk-LWH66Q7Q.js'),require('./chunk-TUIEV7Q7.js'),require('./chunk-7HANRHHL.js');var chunkMJ5FQX7Q_js=require('./chunk-MJ5FQX7Q.js');require('./chunk-C2BAPYGJ.js');var chunk4Q2IP5FW_js=require('./chunk-4Q2IP5FW.js');require('./chunk-GSKMHXHG.js');var chunkDC7S76ZX_js=require('./chunk-DC7S76ZX.js');function L(i){if(!i||i==="transparent"||i==="inherit")return null;if(i.startsWith("#"))return i.slice(1).toUpperCase();let o=i.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(o){let e=parseInt(o[1]).toString(16).padStart(2,"0"),t=parseInt(o[2]).toString(16).padStart(2,"0"),n=parseInt(o[3]).toString(16).padStart(2,"0");return (e+t+n).toUpperCase()}return null}function h(i){let o=window.getComputedStyle(i),e={};(o.fontWeight==="bold"||parseInt(o.fontWeight)>=700)&&(e.bold=true),o.fontStyle==="italic"&&(e.italic=true);let t=o.textDecoration||o.textDecorationLine;t&&t.includes("underline")&&(e.underline={style:"single"}),t&&t.includes("line-through")&&(e.strike=true);let n=parseFloat(o.fontSize);!isNaN(n)&&n>0&&(e.fontSize=Math.round(n/1.333*2));let r=o.fontFamily.replace(/["']/g,"").split(",")[0].trim();r&&(e.fontFamily={ascii:r});let s=o.color;if(s&&s!=="rgb(0, 0, 0)"){let c=L(s);c&&(e.color={rgb:c});}let l=o.backgroundColor;if(l&&l!=="transparent"&&l!=="rgba(0, 0, 0, 0)"){let c=S(l);c&&(e.shading={fill:{rgb:c}});}return Object.keys(e).length>0?e:void 0}function Lt(i,o){let e=document.createRange();e.selectNodeContents(i);let t=o.compareBoundaryPoints(Range.START_TO_START,e)>=0&&o.compareBoundaryPoints(Range.START_TO_END,e)<=0,n=o.compareBoundaryPoints(Range.END_TO_START,e)>=0&&o.compareBoundaryPoints(Range.END_TO_END,e)<=0;if(t&&n)return o.toString();if(t){let r=document.createRange();return r.setStart(o.startContainer,o.startOffset),r.selectNodeContents(i),r.setEnd(e.endContainer,e.endOffset),r.toString()}else if(n){let r=document.createRange();return r.selectNodeContents(i),r.setEnd(o.endContainer,o.endOffset),r.setStart(e.startContainer,e.startOffset),r.toString()}else if(o.intersectsNode(i))return i.textContent||"";return ""}function F(i){let o=i;for(;o;){if(o.nodeType===Node.ELEMENT_NODE){let e=o;if(e.hasAttribute("data-paragraph-index"))return e}o=o.parentNode;}return null}function f(){let i=window.getSelection();if(!i||i.isCollapsed)return [];let o=[],e=i.getRangeAt(0),t=e.commonAncestorContainer,n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;if(!n)return o;if(n.querySelectorAll(".docx-run").forEach(s=>{if(e.intersectsNode(s)){let l=Lt(s,e);if(l){let c=h(s);o.push({type:"run",formatting:c,content:[{type:"text",text:l}]});}}}),o.length===0){let s=i.toString();s&&o.push({type:"run",content:[{type:"text",text:s}]});}return o}function A(){let i=window.getSelection();if(!i||i.isCollapsed)return null;let o=f();if(o.length===0)return null;let e=i.toString(),t=i.getRangeAt(0),n=F(t.startContainer),r=F(t.endContainer),s=n?parseInt(n.getAttribute("data-paragraph-index")||"0",10):0,l=r?parseInt(r.getAttribute("data-paragraph-index")||"0",10):0;return {text:e,runs:o,startParagraphIndex:s,startRunIndex:0,startOffset:t.startOffset,endParagraphIndex:l,endRunIndex:0,endOffset:t.endOffset,isMultiParagraph:s!==l}}var S=L;var d=class extends chunkY74ANBPV_js.a{constructor(){super({notifications:[]});chunkDC7S76ZX_js.a(this,"notifications",[]);chunkDC7S76ZX_js.a(this,"idCounter",0);chunkDC7S76ZX_js.a(this,"timers",new Set);}showError(e,t){return this.addNotification(e,"error",t)}showWarning(e,t){return this.addNotification(e,"warning",t)}showInfo(e,t){return this.addNotification(e,"info",t)}dismiss(e){this.notifications=this.notifications.map(n=>n.id===e?{...n,dismissed:true}:n),this.emitSnapshot();let t=setTimeout(()=>{this.timers.delete(t),this.notifications=this.notifications.filter(n=>n.id!==e),this.emitSnapshot();},300);this.timers.add(t);}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,t,n){let r=`error-${++this.idCounter}-${Date.now()}`,s={id:r,message:e,severity:t,details:n,timestamp:Date.now()};if(this.notifications=[...this.notifications,s],this.emitSnapshot(),t!=="error"){let l=setTimeout(()=>{this.timers.delete(l),this.dismiss(r);},5e3);this.timers.add(l);}return r}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};function z(i,o){let e=`plugin-styles-${i}`,t=document.getElementById(e);t&&t.remove();let n=document.createElement("style");return n.id=e,n.textContent=o,document.head.appendChild(n),()=>{let r=document.getElementById(e);r&&r.remove();}}var u=class extends chunkY74ANBPV_js.a{constructor(){super({states:new Map,version:0});chunkDC7S76ZX_js.a(this,"plugins",[]);chunkDC7S76ZX_js.a(this,"pluginStates",new Map);chunkDC7S76ZX_js.a(this,"version",0);}initialize(e,t){this.destroyPlugins(),this.plugins=e;for(let n of e)n.initialize&&!this.pluginStates.has(n.id)&&this.pluginStates.set(n.id,n.initialize(t));this.emitSnapshot();}updateStates(e){let t=false;for(let n of this.plugins)if(n.onStateChange){let r=n.onStateChange(e);r!==void 0&&(this.pluginStates.set(n.id,r),t=true);}return t&&(this.version++,this.emitSnapshot()),t}getPluginState(e){return this.pluginStates.get(e)}setPluginState(e,t){this.pluginStates.set(e,t),this.version++,this.emitSnapshot();}destroy(){this.destroyPlugins(),this.emitSnapshot();}destroyPlugins(){for(let e of this.plugins)e.destroy&&e.destroy();this.pluginStates.clear(),this.plugins=[];}emitSnapshot(){this.setSnapshot({states:new Map(this.pluginStates),version:this.version});}};var p=class extends chunkY74ANBPV_js.a{constructor(){super({hasLayout:false,selectionRects:[],caretPosition:null,selectedImageInfo:null,isFocused:false,isDragging:false,isResizingColumn:false,isImageInteracting:false,version:0});chunkDC7S76ZX_js.a(this,"_hasLayout",false);chunkDC7S76ZX_js.a(this,"_selectionRects",[]);chunkDC7S76ZX_js.a(this,"_caretPosition",null);chunkDC7S76ZX_js.a(this,"_isDragging",false);chunkDC7S76ZX_js.a(this,"_dragAnchor",null);chunkDC7S76ZX_js.a(this,"_columnResize",{isResizing:false,startX:0,columnIndex:0,tablePmStart:0,originalWidths:{left:0,right:0}});chunkDC7S76ZX_js.a(this,"_selectedImageInfo",null);chunkDC7S76ZX_js.a(this,"_isImageInteracting",false);chunkDC7S76ZX_js.a(this,"_isFocused",false);chunkDC7S76ZX_js.a(this,"_version",0);}setLayoutReady(e){this._hasLayout=e,this.emitSnapshot();}updateSelection(e,t){this._selectionRects=e,this._caretPosition=t,this.emitSnapshot();}startDrag(e){this._isDragging=true,this._dragAnchor=e,this.emitSnapshot();}endDrag(){this._isDragging=false,this._dragAnchor=null,this.emitSnapshot();}getDragAnchor(){return this._dragAnchor}startColumnResize(e,t,n,r){this._columnResize={isResizing:true,startX:n,columnIndex:t,tablePmStart:e,originalWidths:r},this.emitSnapshot();}endColumnResize(){this._columnResize={...this._columnResize,isResizing:false},this.emitSnapshot();}getColumnResize(){return this._columnResize}setSelectedImage(e){this._selectedImageInfo=e,this.emitSnapshot();}clearSelectedImage(){this._selectedImageInfo=null,this._isImageInteracting=false,this.emitSnapshot();}setImageInteracting(e){this._isImageInteracting=e,this.emitSnapshot();}setFocused(e){this._isFocused=e,this.emitSnapshot();}emitSnapshot(){this._version++,this.setSnapshot({hasLayout:this._hasLayout,selectionRects:this._selectionRects,caretPosition:this._caretPosition,selectedImageInfo:this._selectedImageInfo,isFocused:this._isFocused,isDragging:this._isDragging,isResizingColumn:this._columnResize.isResizing,isImageInteracting:this._isImageInteracting,version:this._version});}};var g=class extends chunkY74ANBPV_js.a{constructor(e={}){let t=e.initialZoom??1;super({loadingState:"idle",parseError:null,isReady:false,zoom:t,fontsLoaded:false,version:0});chunkDC7S76ZX_js.a(this,"_loadingState","idle");chunkDC7S76ZX_js.a(this,"_parseError",null);chunkDC7S76ZX_js.a(this,"_zoom");chunkDC7S76ZX_js.a(this,"_fontsLoaded",false);chunkDC7S76ZX_js.a(this,"_document",null);chunkDC7S76ZX_js.a(this,"_version",0);chunkDC7S76ZX_js.a(this,"onChangeCallback");chunkDC7S76ZX_js.a(this,"onErrorCallback");this._zoom=t,this.onChangeCallback=e.onChange,this.onErrorCallback=e.onError;}setParsingStarted(){this._loadingState="parsing",this._parseError=null,this.emitSnapshot();}setDocumentLoaded(e){this._document=e,this._loadingState="loading-fonts",this._parseError=null,this.emitSnapshot();}setFontsLoaded(){this._fontsLoaded=true,this._loadingState="ready",this.emitSnapshot();}setLoadError(e){this._loadingState="error",this._parseError=e.message,this.onErrorCallback?.(e),this.emitSnapshot();}getDocument(){return this._document}updateDocument(e){this._document=e,this.onChangeCallback?.(e),this.emitSnapshot();}setZoom(e){this._zoom=Math.max(.25,Math.min(4,e)),this.emitSnapshot();}getZoom(){return this._zoom}emitSnapshot(){this._version++,this.setSnapshot({loadingState:this._loadingState,parseError:this._parseError,isReady:this._loadingState==="ready",zoom:this._zoom,fontsLoaded:this._fontsLoaded,version:this._version});}};var to="0.0.2";Object.defineProperty(exports,"AutoSaveManager",{enumerable:true,get:function(){return chunkTE2VQJZG_js.a}});Object.defineProperty(exports,"formatLastSaveTime",{enumerable:true,get:function(){return chunkTE2VQJZG_js.b}});Object.defineProperty(exports,"formatStorageSize",{enumerable:true,get:function(){return chunkTE2VQJZG_js.e}});Object.defineProperty(exports,"getAutoSaveStatusLabel",{enumerable:true,get:function(){return chunkTE2VQJZG_js.c}});Object.defineProperty(exports,"getAutoSaveStorageSize",{enumerable:true,get:function(){return chunkTE2VQJZG_js.d}});Object.defineProperty(exports,"isAutoSaveSupported",{enumerable:true,get:function(){return chunkTE2VQJZG_js.f}});Object.defineProperty(exports,"TABLE_DATA_ATTRIBUTES",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.a}});Object.defineProperty(exports,"TableSelectionManager",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.f}});Object.defineProperty(exports,"deleteTableFromDocument",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.e}});Object.defineProperty(exports,"findTableFromClick",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.b}});Object.defineProperty(exports,"getTableFromDocument",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.c}});Object.defineProperty(exports,"updateTableInDocument",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.d}});Object.defineProperty(exports,"Subscribable",{enumerable:true,get:function(){return chunkY74ANBPV_js.a}});Object.defineProperty(exports,"convertHeaderFooterToContent",{enumerable:true,get:function(){return chunkQ4IEATDJ_js.y}});Object.defineProperty(exports,"FOOTNOTE_SEPARATOR_HEIGHT",{enumerable:true,get:function(){return chunkKAOLVBLH_js.a}});Object.defineProperty(exports,"MAX_FOOTNOTE_LAYOUT_PASSES",{enumerable:true,get:function(){return chunkKAOLVBLH_js.b}});Object.defineProperty(exports,"buildFootnoteContentMap",{enumerable:true,get:function(){return chunkKAOLVBLH_js.h}});Object.defineProperty(exports,"buildFootnoteRenderItems",{enumerable:true,get:function(){return chunkKAOLVBLH_js.k}});Object.defineProperty(exports,"calculateFootnoteReservedHeights",{enumerable:true,get:function(){return chunkKAOLVBLH_js.i}});Object.defineProperty(exports,"collectFootnoteRefs",{enumerable:true,get:function(){return chunkKAOLVBLH_js.d}});Object.defineProperty(exports,"footnoteReservedHeightsEqual",{enumerable:true,get:function(){return chunkKAOLVBLH_js.c}});Object.defineProperty(exports,"mapFootnotesToPages",{enumerable:true,get:function(){return chunkKAOLVBLH_js.e}});Object.defineProperty(exports,"stabilizeFootnoteLayout",{enumerable:true,get:function(){return chunkKAOLVBLH_js.j}});Object.defineProperty(exports,"countPageBreaks",{enumerable:true,get:function(){return chunkKESNGXGO_js.n}});Object.defineProperty(exports,"createColumnBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.b}});Object.defineProperty(exports,"createHorizontalRule",{enumerable:true,get:function(){return chunkKESNGXGO_js.g}});Object.defineProperty(exports,"createLineBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.c}});Object.defineProperty(exports,"createPageBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.a}});Object.defineProperty(exports,"createPageBreakParagraph",{enumerable:true,get:function(){return chunkKESNGXGO_js.e}});Object.defineProperty(exports,"createPageBreakRun",{enumerable:true,get:function(){return chunkKESNGXGO_js.d}});Object.defineProperty(exports,"findPageBreaks",{enumerable:true,get:function(){return chunkKESNGXGO_js.o}});Object.defineProperty(exports,"hasPageBreakBefore",{enumerable:true,get:function(){return chunkKESNGXGO_js.m}});Object.defineProperty(exports,"insertHorizontalRule",{enumerable:true,get:function(){return chunkKESNGXGO_js.h}});Object.defineProperty(exports,"insertPageBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.f}});Object.defineProperty(exports,"isBreakContent",{enumerable:true,get:function(){return chunkKESNGXGO_js.l}});Object.defineProperty(exports,"isColumnBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.j}});Object.defineProperty(exports,"isLineBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.k}});Object.defineProperty(exports,"isPageBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.i}});Object.defineProperty(exports,"removePageBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.p}});Object.defineProperty(exports,"DocumentAgent",{enumerable:true,get:function(){return chunk2SGJZYQF_js.a}});Object.defineProperty(exports,"buildExtendedSelectionContext",{enumerable:true,get:function(){return chunk2SGJZYQF_js.h}});Object.defineProperty(exports,"buildSelectionContext",{enumerable:true,get:function(){return chunk2SGJZYQF_js.g}});Object.defineProperty(exports,"getAgentContext",{enumerable:true,get:function(){return chunk2SGJZYQF_js.d}});Object.defineProperty(exports,"getDocumentSummary",{enumerable:true,get:function(){return chunk2SGJZYQF_js.f}});Object.defineProperty(exports,"attemptSelectiveSave",{enumerable:true,get:function(){return chunkCZSAC65M_js.c}});Object.defineProperty(exports,"buildPatchedDocumentXml",{enumerable:true,get:function(){return chunkCZSAC65M_js.b}});Object.defineProperty(exports,"validatePatchSafety",{enumerable:true,get:function(){return chunkCZSAC65M_js.a}});Object.defineProperty(exports,"createDocumentWithText",{enumerable:true,get:function(){return chunkNXLJVVVE_js.b}});Object.defineProperty(exports,"createEmptyDocument",{enumerable:true,get:function(){return chunkNXLJVVVE_js.a}});Object.defineProperty(exports,"docxtemplaterPlugin",{enumerable:true,get:function(){return chunk3QPKTG2Y_js.b}});Object.defineProperty(exports,"detectVariables",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.a}});Object.defineProperty(exports,"detectVariablesDetailed",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.b}});Object.defineProperty(exports,"detectVariablesInBody",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.c}});Object.defineProperty(exports,"detectVariablesInParagraph",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.d}});Object.defineProperty(exports,"documentHasVariables",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.m}});Object.defineProperty(exports,"extractVariablesFromText",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.e}});Object.defineProperty(exports,"formatVariable",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.i}});Object.defineProperty(exports,"hasTemplateVariables",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.f}});Object.defineProperty(exports,"isValidVariableName",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.g}});Object.defineProperty(exports,"parseVariable",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.j}});Object.defineProperty(exports,"removeVariables",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.l}});Object.defineProperty(exports,"replaceVariables",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.k}});Object.defineProperty(exports,"sanitizeVariableName",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.h}});Object.defineProperty(exports,"getTemplateTags",{enumerable:true,get:function(){return chunkESI4BSBF_js.e}});Object.defineProperty(exports,"processTemplate",{enumerable:true,get:function(){return chunkESI4BSBF_js.a}});Object.defineProperty(exports,"processTemplateAsBlob",{enumerable:true,get:function(){return chunkESI4BSBF_js.c}});Object.defineProperty(exports,"processTemplateDetailed",{enumerable:true,get:function(){return chunkESI4BSBF_js.b}});Object.defineProperty(exports,"validateTemplate",{enumerable:true,get:function(){return chunkESI4BSBF_js.f}});Object.defineProperty(exports,"executeCommand",{enumerable:true,get:function(){return chunkTE2AF7FM_js.a}});Object.defineProperty(exports,"executeCommands",{enumerable:true,get:function(){return chunkTE2AF7FM_js.b}});Object.defineProperty(exports,"createDocx",{enumerable:true,get:function(){return chunkBH3ACQ3M_js.t}});Object.defineProperty(exports,"repackDocx",{enumerable:true,get:function(){return chunkBH3ACQ3M_js.i}});Object.defineProperty(exports,"updateMultipleFiles",{enumerable:true,get:function(){return chunkBH3ACQ3M_js.m}});Object.defineProperty(exports,"serializeDocumentBody",{enumerable:true,get:function(){return chunkNAFMAKLK_js.g}});Object.defineProperty(exports,"serializeDocx",{enumerable:true,get:function(){return chunkNAFMAKLK_js.h}});Object.defineProperty(exports,"serializeSectionProperties",{enumerable:true,get:function(){return chunkNAFMAKLK_js.c}});Object.defineProperty(exports,"PluginRegistry",{enumerable:true,get:function(){return chunk4BFNWPKW_js.a}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunk4BFNWPKW_js.b}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunk4BFNWPKW_js.c}});Object.defineProperty(exports,"parseDocx",{enumerable:true,get:function(){return chunkOTHV7YV2_js.f}});Object.defineProperty(exports,"canRenderFont",{enumerable:true,get:function(){return chunkMNOHUTKE_js.h}});Object.defineProperty(exports,"getLoadedFonts",{enumerable:true,get:function(){return chunkMNOHUTKE_js.e}});Object.defineProperty(exports,"isFontLoaded",{enumerable:true,get:function(){return chunkMNOHUTKE_js.c}});Object.defineProperty(exports,"isFontsLoading",{enumerable:true,get:function(){return chunkMNOHUTKE_js.d}});Object.defineProperty(exports,"loadFont",{enumerable:true,get:function(){return chunkMNOHUTKE_js.a}});Object.defineProperty(exports,"loadFontFromBuffer",{enumerable:true,get:function(){return chunkMNOHUTKE_js.i}});Object.defineProperty(exports,"loadFonts",{enumerable:true,get:function(){return chunkMNOHUTKE_js.b}});Object.defineProperty(exports,"onFontsLoaded",{enumerable:true,get:function(){return chunkMNOHUTKE_js.f}});Object.defineProperty(exports,"preloadCommonFonts",{enumerable:true,get:function(){return chunkMNOHUTKE_js.p}});Object.defineProperty(exports,"toArrayBuffer",{enumerable:true,get:function(){return chunkMNOHUTKE_js.s}});Object.defineProperty(exports,"findParagraphByParaId",{enumerable:true,get:function(){return chunkI6PMX4BO_js.b}});Object.defineProperty(exports,"findStartPosForParaId",{enumerable:true,get:function(){return chunkI6PMX4BO_js.a}});Object.defineProperty(exports,"blendColors",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.m}});Object.defineProperty(exports,"colorsEqual",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.r}});Object.defineProperty(exports,"createRgbColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.j}});Object.defineProperty(exports,"createThemeColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.i}});Object.defineProperty(exports,"darkenColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.k}});Object.defineProperty(exports,"ensureHexPrefix",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.n}});Object.defineProperty(exports,"generateThemeTintShadeMatrix",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.q}});Object.defineProperty(exports,"getContrastingColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.g}});Object.defineProperty(exports,"getThemeTintShadeHex",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.p}});Object.defineProperty(exports,"isBlack",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.e}});Object.defineProperty(exports,"isWhite",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.f}});Object.defineProperty(exports,"lightenColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.l}});Object.defineProperty(exports,"parseColorString",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.h}});Object.defineProperty(exports,"resolveColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.a}});Object.defineProperty(exports,"resolveHighlightColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.c}});Object.defineProperty(exports,"resolveHighlightToCss",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.o}});Object.defineProperty(exports,"resolveShadingColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.d}});Object.defineProperty(exports,"emuToPixels",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.e}});Object.defineProperty(exports,"emuToTwips",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.g}});Object.defineProperty(exports,"formatPx",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.p}});Object.defineProperty(exports,"halfPointsToPixels",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.j}});Object.defineProperty(exports,"pixelsToEmu",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.f}});Object.defineProperty(exports,"pixelsToTwips",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.d}});Object.defineProperty(exports,"pointsToPixels",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.i}});Object.defineProperty(exports,"twipsToEmu",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.h}});Object.defineProperty(exports,"twipsToPixels",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.c}});exports.EditorCoordinator=g;exports.ErrorManager=d;exports.LayoutCoordinator=p;exports.PluginLifecycleManager=u;exports.VERSION=to;exports.createSelectionFromDOM=A;exports.extractFormattingFromElement=h;exports.getSelectionRuns=f;exports.injectStyles=z;exports.rgbToHex=S;
package/dist/core.mjs CHANGED
@@ -1 +1 @@
1
- export{a as AutoSaveManager,b as formatLastSaveTime,e as formatStorageSize,c as getAutoSaveStatusLabel,d as getAutoSaveStorageSize,f as isAutoSaveSupported}from'./chunk-6NQSIC27.mjs';export{a as TABLE_DATA_ATTRIBUTES,f as TableSelectionManager,e as deleteTableFromDocument,b as findTableFromClick,c as getTableFromDocument,d as updateTableInDocument}from'./chunk-JHZ3HLSR.mjs';import {a}from'./chunk-D6GO7UGD.mjs';export{a as Subscribable}from'./chunk-D6GO7UGD.mjs';export{y as convertHeaderFooterToContent}from'./chunk-2LEFMTNZ.mjs';import'./chunk-UEPLDKKM.mjs';export{a as FOOTNOTE_SEPARATOR_HEIGHT,b as MAX_FOOTNOTE_LAYOUT_PASSES,h as buildFootnoteContentMap,k as buildFootnoteRenderItems,i as calculateFootnoteReservedHeights,d as collectFootnoteRefs,c as footnoteReservedHeightsEqual,e as mapFootnotesToPages,j as stabilizeFootnoteLayout}from'./chunk-KKXCBWVG.mjs';import'./chunk-HKN2NKOG.mjs';import'./chunk-LX35TFGF.mjs';import'./chunk-55XWETY4.mjs';import'./chunk-JHTURDPX.mjs';import'./chunk-FCJWLEKT.mjs';import'./chunk-7E5VBRDL.mjs';export{n as countPageBreaks,b as createColumnBreak,g as createHorizontalRule,c as createLineBreak,a as createPageBreak,e as createPageBreakParagraph,d as createPageBreakRun,o as findPageBreaks,m as hasPageBreakBefore,h as insertHorizontalRule,f as insertPageBreak,l as isBreakContent,j as isColumnBreak,k as isLineBreak,i as isPageBreak,p as removePageBreak}from'./chunk-WTFLNYAT.mjs';export{a as DocumentAgent,h as buildExtendedSelectionContext,g as buildSelectionContext,d as getAgentContext,f as getDocumentSummary}from'./chunk-YNUPP7UG.mjs';export{c as attemptSelectiveSave,b as buildPatchedDocumentXml,a as validatePatchSafety}from'./chunk-FYRJTDC4.mjs';export{b as createDocumentWithText,a as createEmptyDocument}from'./chunk-CKKO4JWE.mjs';export{b as docxtemplaterPlugin}from'./chunk-DFUWJHKF.mjs';export{a as detectVariables,b as detectVariablesDetailed,c as detectVariablesInBody,d as detectVariablesInParagraph,m as documentHasVariables,e as extractVariablesFromText,i as formatVariable,f as hasTemplateVariables,g as isValidVariableName,j as parseVariable,l as removeVariables,k as replaceVariables,h as sanitizeVariableName}from'./chunk-ARHPXIBJ.mjs';export{e as getTemplateTags,a as processTemplate,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-CGJ6S3AH.mjs';export{a as executeCommand,b as executeCommands}from'./chunk-CUY2THAO.mjs';export{t as createDocx,i as repackDocx,m as updateMultipleFiles}from'./chunk-CHN26LLL.mjs';export{g as serializeDocumentBody,h as serializeDocx,c as serializeSectionProperties}from'./chunk-WWNOXNEX.mjs';export{a as PluginRegistry,b as pluginRegistry,c as registerPlugins}from'./chunk-3NRMSZX2.mjs';export{f as parseDocx}from'./chunk-UE2ZKRYB.mjs';import'./chunk-3G44SFHX.mjs';import'./chunk-MOCGHQ4A.mjs';export{h as canRenderFont,e as getLoadedFonts,c as isFontLoaded,d as isFontsLoading,a as loadFont,i as loadFontFromBuffer,b as loadFonts,f as onFontsLoaded,p as preloadCommonFonts,s as toArrayBuffer}from'./chunk-7LRR7RKE.mjs';export{b as findParagraphByParaId,a as findStartPosForParaId}from'./chunk-3SXJPJSV.mjs';import'./chunk-LJE7HQEJ.mjs';import'./chunk-7OW3VCZE.mjs';import'./chunk-LK6I3HMH.mjs';import'./chunk-QPFJJPIC.mjs';import'./chunk-GYWTUUXX.mjs';import'./chunk-7CZEZ3UL.mjs';import'./chunk-W77JXDEV.mjs';import'./chunk-3ANZ3252.mjs';import'./chunk-4GFTMGSV.mjs';import'./chunk-SWBLJF6R.mjs';import'./chunk-MOKKS75W.mjs';import'./chunk-OZMNIX6U.mjs';import'./chunk-AMENZY5F.mjs';import'./chunk-U67MWOPZ.mjs';import'./chunk-BGY3CB37.mjs';import'./chunk-2XP6GLA4.mjs';import'./chunk-ZX26QZJ5.mjs';import'./chunk-MJ6XZFVD.mjs';export{m as blendColors,r as colorsEqual,j as createRgbColor,i as createThemeColor,k as darkenColor,n as ensureHexPrefix,q as generateThemeTintShadeMatrix,g as getContrastingColor,p as getThemeTintShadeHex,e as isBlack,f as isWhite,l as lightenColor,h as parseColorString,a as resolveColor,c as resolveHighlightColor,o as resolveHighlightToCss,d as resolveShadingColor}from'./chunk-67LVRQIR.mjs';import'./chunk-LE67NTCN.mjs';export{e as emuToPixels,g as emuToTwips,p as formatPx,j as halfPointsToPixels,f as pixelsToEmu,d as pixelsToTwips,i as pointsToPixels,h as twipsToEmu,c as twipsToPixels}from'./chunk-VW22RZ6C.mjs';import'./chunk-DI6CRWSW.mjs';import {a as a$1}from'./chunk-QYUPLKLP.mjs';function L(i){if(!i||i==="transparent"||i==="inherit")return null;if(i.startsWith("#"))return i.slice(1).toUpperCase();let o=i.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(o){let e=parseInt(o[1]).toString(16).padStart(2,"0"),t=parseInt(o[2]).toString(16).padStart(2,"0"),n=parseInt(o[3]).toString(16).padStart(2,"0");return (e+t+n).toUpperCase()}return null}function h(i){let o=window.getComputedStyle(i),e={};(o.fontWeight==="bold"||parseInt(o.fontWeight)>=700)&&(e.bold=true),o.fontStyle==="italic"&&(e.italic=true);let t=o.textDecoration||o.textDecorationLine;t&&t.includes("underline")&&(e.underline={style:"single"}),t&&t.includes("line-through")&&(e.strike=true);let n=parseFloat(o.fontSize);!isNaN(n)&&n>0&&(e.fontSize=Math.round(n/1.333*2));let r=o.fontFamily.replace(/["']/g,"").split(",")[0].trim();r&&(e.fontFamily={ascii:r});let s=o.color;if(s&&s!=="rgb(0, 0, 0)"){let c=L(s);c&&(e.color={rgb:c});}let l=o.backgroundColor;if(l&&l!=="transparent"&&l!=="rgba(0, 0, 0, 0)"){let c=S(l);c&&(e.shading={fill:{rgb:c}});}return Object.keys(e).length>0?e:void 0}function Lt(i,o){let e=document.createRange();e.selectNodeContents(i);let t=o.compareBoundaryPoints(Range.START_TO_START,e)>=0&&o.compareBoundaryPoints(Range.START_TO_END,e)<=0,n=o.compareBoundaryPoints(Range.END_TO_START,e)>=0&&o.compareBoundaryPoints(Range.END_TO_END,e)<=0;if(t&&n)return o.toString();if(t){let r=document.createRange();return r.setStart(o.startContainer,o.startOffset),r.selectNodeContents(i),r.setEnd(e.endContainer,e.endOffset),r.toString()}else if(n){let r=document.createRange();return r.selectNodeContents(i),r.setEnd(o.endContainer,o.endOffset),r.setStart(e.startContainer,e.startOffset),r.toString()}else if(o.intersectsNode(i))return i.textContent||"";return ""}function F(i){let o=i;for(;o;){if(o.nodeType===Node.ELEMENT_NODE){let e=o;if(e.hasAttribute("data-paragraph-index"))return e}o=o.parentNode;}return null}function f(){let i=window.getSelection();if(!i||i.isCollapsed)return [];let o=[],e=i.getRangeAt(0),t=e.commonAncestorContainer,n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;if(!n)return o;if(n.querySelectorAll(".docx-run").forEach(s=>{if(e.intersectsNode(s)){let l=Lt(s,e);if(l){let c=h(s);o.push({type:"run",formatting:c,content:[{type:"text",text:l}]});}}}),o.length===0){let s=i.toString();s&&o.push({type:"run",content:[{type:"text",text:s}]});}return o}function A(){let i=window.getSelection();if(!i||i.isCollapsed)return null;let o=f();if(o.length===0)return null;let e=i.toString(),t=i.getRangeAt(0),n=F(t.startContainer),r=F(t.endContainer),s=n?parseInt(n.getAttribute("data-paragraph-index")||"0",10):0,l=r?parseInt(r.getAttribute("data-paragraph-index")||"0",10):0;return {text:e,runs:o,startParagraphIndex:s,startRunIndex:0,startOffset:t.startOffset,endParagraphIndex:l,endRunIndex:0,endOffset:t.endOffset,isMultiParagraph:s!==l}}var S=L;var d=class extends a{constructor(){super({notifications:[]});a$1(this,"notifications",[]);a$1(this,"idCounter",0);a$1(this,"timers",new Set);}showError(e,t){return this.addNotification(e,"error",t)}showWarning(e,t){return this.addNotification(e,"warning",t)}showInfo(e,t){return this.addNotification(e,"info",t)}dismiss(e){this.notifications=this.notifications.map(n=>n.id===e?{...n,dismissed:true}:n),this.emitSnapshot();let t=setTimeout(()=>{this.timers.delete(t),this.notifications=this.notifications.filter(n=>n.id!==e),this.emitSnapshot();},300);this.timers.add(t);}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,t,n){let r=`error-${++this.idCounter}-${Date.now()}`,s={id:r,message:e,severity:t,details:n,timestamp:Date.now()};if(this.notifications=[...this.notifications,s],this.emitSnapshot(),t!=="error"){let l=setTimeout(()=>{this.timers.delete(l),this.dismiss(r);},5e3);this.timers.add(l);}return r}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};function z(i,o){let e=`plugin-styles-${i}`,t=document.getElementById(e);t&&t.remove();let n=document.createElement("style");return n.id=e,n.textContent=o,document.head.appendChild(n),()=>{let r=document.getElementById(e);r&&r.remove();}}var u=class extends a{constructor(){super({states:new Map,version:0});a$1(this,"plugins",[]);a$1(this,"pluginStates",new Map);a$1(this,"version",0);}initialize(e,t){this.destroyPlugins(),this.plugins=e;for(let n of e)n.initialize&&!this.pluginStates.has(n.id)&&this.pluginStates.set(n.id,n.initialize(t));this.emitSnapshot();}updateStates(e){let t=false;for(let n of this.plugins)if(n.onStateChange){let r=n.onStateChange(e);r!==void 0&&(this.pluginStates.set(n.id,r),t=true);}return t&&(this.version++,this.emitSnapshot()),t}getPluginState(e){return this.pluginStates.get(e)}setPluginState(e,t){this.pluginStates.set(e,t),this.version++,this.emitSnapshot();}destroy(){this.destroyPlugins(),this.emitSnapshot();}destroyPlugins(){for(let e of this.plugins)e.destroy&&e.destroy();this.pluginStates.clear(),this.plugins=[];}emitSnapshot(){this.setSnapshot({states:new Map(this.pluginStates),version:this.version});}};var p=class extends a{constructor(){super({hasLayout:false,selectionRects:[],caretPosition:null,selectedImageInfo:null,isFocused:false,isDragging:false,isResizingColumn:false,isImageInteracting:false,version:0});a$1(this,"_hasLayout",false);a$1(this,"_selectionRects",[]);a$1(this,"_caretPosition",null);a$1(this,"_isDragging",false);a$1(this,"_dragAnchor",null);a$1(this,"_columnResize",{isResizing:false,startX:0,columnIndex:0,tablePmStart:0,originalWidths:{left:0,right:0}});a$1(this,"_selectedImageInfo",null);a$1(this,"_isImageInteracting",false);a$1(this,"_isFocused",false);a$1(this,"_version",0);}setLayoutReady(e){this._hasLayout=e,this.emitSnapshot();}updateSelection(e,t){this._selectionRects=e,this._caretPosition=t,this.emitSnapshot();}startDrag(e){this._isDragging=true,this._dragAnchor=e,this.emitSnapshot();}endDrag(){this._isDragging=false,this._dragAnchor=null,this.emitSnapshot();}getDragAnchor(){return this._dragAnchor}startColumnResize(e,t,n,r){this._columnResize={isResizing:true,startX:n,columnIndex:t,tablePmStart:e,originalWidths:r},this.emitSnapshot();}endColumnResize(){this._columnResize={...this._columnResize,isResizing:false},this.emitSnapshot();}getColumnResize(){return this._columnResize}setSelectedImage(e){this._selectedImageInfo=e,this.emitSnapshot();}clearSelectedImage(){this._selectedImageInfo=null,this._isImageInteracting=false,this.emitSnapshot();}setImageInteracting(e){this._isImageInteracting=e,this.emitSnapshot();}setFocused(e){this._isFocused=e,this.emitSnapshot();}emitSnapshot(){this._version++,this.setSnapshot({hasLayout:this._hasLayout,selectionRects:this._selectionRects,caretPosition:this._caretPosition,selectedImageInfo:this._selectedImageInfo,isFocused:this._isFocused,isDragging:this._isDragging,isResizingColumn:this._columnResize.isResizing,isImageInteracting:this._isImageInteracting,version:this._version});}};var g=class extends a{constructor(e={}){let t=e.initialZoom??1;super({loadingState:"idle",parseError:null,isReady:false,zoom:t,fontsLoaded:false,version:0});a$1(this,"_loadingState","idle");a$1(this,"_parseError",null);a$1(this,"_zoom");a$1(this,"_fontsLoaded",false);a$1(this,"_document",null);a$1(this,"_version",0);a$1(this,"onChangeCallback");a$1(this,"onErrorCallback");this._zoom=t,this.onChangeCallback=e.onChange,this.onErrorCallback=e.onError;}setParsingStarted(){this._loadingState="parsing",this._parseError=null,this.emitSnapshot();}setDocumentLoaded(e){this._document=e,this._loadingState="loading-fonts",this._parseError=null,this.emitSnapshot();}setFontsLoaded(){this._fontsLoaded=true,this._loadingState="ready",this.emitSnapshot();}setLoadError(e){this._loadingState="error",this._parseError=e.message,this.onErrorCallback?.(e),this.emitSnapshot();}getDocument(){return this._document}updateDocument(e){this._document=e,this.onChangeCallback?.(e),this.emitSnapshot();}setZoom(e){this._zoom=Math.max(.25,Math.min(4,e)),this.emitSnapshot();}getZoom(){return this._zoom}emitSnapshot(){this._version++,this.setSnapshot({loadingState:this._loadingState,parseError:this._parseError,isReady:this._loadingState==="ready",zoom:this._zoom,fontsLoaded:this._fontsLoaded,version:this._version});}};var to="0.0.2";export{g as EditorCoordinator,d as ErrorManager,p as LayoutCoordinator,u as PluginLifecycleManager,to as VERSION,A as createSelectionFromDOM,h as extractFormattingFromElement,f as getSelectionRuns,z as injectStyles,S as rgbToHex};
1
+ export{a as AutoSaveManager,b as formatLastSaveTime,e as formatStorageSize,c as getAutoSaveStatusLabel,d as getAutoSaveStorageSize,f as isAutoSaveSupported}from'./chunk-6NQSIC27.mjs';export{a as TABLE_DATA_ATTRIBUTES,f as TableSelectionManager,e as deleteTableFromDocument,b as findTableFromClick,c as getTableFromDocument,d as updateTableInDocument}from'./chunk-JHZ3HLSR.mjs';import {a}from'./chunk-D6GO7UGD.mjs';export{a as Subscribable}from'./chunk-D6GO7UGD.mjs';export{y as convertHeaderFooterToContent}from'./chunk-OF373DBR.mjs';import'./chunk-GGUHM74A.mjs';export{a as FOOTNOTE_SEPARATOR_HEIGHT,b as MAX_FOOTNOTE_LAYOUT_PASSES,h as buildFootnoteContentMap,k as buildFootnoteRenderItems,i as calculateFootnoteReservedHeights,d as collectFootnoteRefs,c as footnoteReservedHeightsEqual,e as mapFootnotesToPages,j as stabilizeFootnoteLayout}from'./chunk-OEC6SBDV.mjs';import'./chunk-HKN2NKOG.mjs';import'./chunk-EM33RGHT.mjs';import'./chunk-55XWETY4.mjs';import'./chunk-JHTURDPX.mjs';import'./chunk-FCJWLEKT.mjs';import'./chunk-7E5VBRDL.mjs';export{n as countPageBreaks,b as createColumnBreak,g as createHorizontalRule,c as createLineBreak,a as createPageBreak,e as createPageBreakParagraph,d as createPageBreakRun,o as findPageBreaks,m as hasPageBreakBefore,h as insertHorizontalRule,f as insertPageBreak,l as isBreakContent,j as isColumnBreak,k as isLineBreak,i as isPageBreak,p as removePageBreak}from'./chunk-WTFLNYAT.mjs';export{a as DocumentAgent,h as buildExtendedSelectionContext,g as buildSelectionContext,d as getAgentContext,f as getDocumentSummary}from'./chunk-YNUPP7UG.mjs';export{c as attemptSelectiveSave,b as buildPatchedDocumentXml,a as validatePatchSafety}from'./chunk-FYRJTDC4.mjs';export{b as createDocumentWithText,a as createEmptyDocument}from'./chunk-CKKO4JWE.mjs';export{b as docxtemplaterPlugin}from'./chunk-DFUWJHKF.mjs';export{a as detectVariables,b as detectVariablesDetailed,c as detectVariablesInBody,d as detectVariablesInParagraph,m as documentHasVariables,e as extractVariablesFromText,i as formatVariable,f as hasTemplateVariables,g as isValidVariableName,j as parseVariable,l as removeVariables,k as replaceVariables,h as sanitizeVariableName}from'./chunk-ARHPXIBJ.mjs';export{e as getTemplateTags,a as processTemplate,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-CGJ6S3AH.mjs';export{a as executeCommand,b as executeCommands}from'./chunk-CUY2THAO.mjs';export{t as createDocx,i as repackDocx,m as updateMultipleFiles}from'./chunk-CHN26LLL.mjs';export{g as serializeDocumentBody,h as serializeDocx,c as serializeSectionProperties}from'./chunk-WWNOXNEX.mjs';export{a as PluginRegistry,b as pluginRegistry,c as registerPlugins}from'./chunk-3NRMSZX2.mjs';export{f as parseDocx}from'./chunk-UE2ZKRYB.mjs';import'./chunk-3G44SFHX.mjs';import'./chunk-MOCGHQ4A.mjs';export{h as canRenderFont,e as getLoadedFonts,c as isFontLoaded,d as isFontsLoading,a as loadFont,i as loadFontFromBuffer,b as loadFonts,f as onFontsLoaded,p as preloadCommonFonts,s as toArrayBuffer}from'./chunk-7LRR7RKE.mjs';export{b as findParagraphByParaId,a as findStartPosForParaId}from'./chunk-3SXJPJSV.mjs';import'./chunk-IUJCUITW.mjs';import'./chunk-7OW3VCZE.mjs';import'./chunk-LK6I3HMH.mjs';import'./chunk-QPFJJPIC.mjs';import'./chunk-GYWTUUXX.mjs';import'./chunk-7CZEZ3UL.mjs';import'./chunk-W77JXDEV.mjs';import'./chunk-3ANZ3252.mjs';import'./chunk-QAJSNLJR.mjs';import'./chunk-CRMZH7U7.mjs';import'./chunk-MOKKS75W.mjs';import'./chunk-OZMNIX6U.mjs';import'./chunk-AMENZY5F.mjs';import'./chunk-U67MWOPZ.mjs';import'./chunk-BGY3CB37.mjs';import'./chunk-2XP6GLA4.mjs';import'./chunk-ZX26QZJ5.mjs';import'./chunk-MJ6XZFVD.mjs';export{m as blendColors,r as colorsEqual,j as createRgbColor,i as createThemeColor,k as darkenColor,n as ensureHexPrefix,q as generateThemeTintShadeMatrix,g as getContrastingColor,p as getThemeTintShadeHex,e as isBlack,f as isWhite,l as lightenColor,h as parseColorString,a as resolveColor,c as resolveHighlightColor,o as resolveHighlightToCss,d as resolveShadingColor}from'./chunk-67LVRQIR.mjs';import'./chunk-LE67NTCN.mjs';export{e as emuToPixels,g as emuToTwips,p as formatPx,j as halfPointsToPixels,f as pixelsToEmu,d as pixelsToTwips,i as pointsToPixels,h as twipsToEmu,c as twipsToPixels}from'./chunk-VW22RZ6C.mjs';import'./chunk-DI6CRWSW.mjs';import {a as a$1}from'./chunk-QYUPLKLP.mjs';function L(i){if(!i||i==="transparent"||i==="inherit")return null;if(i.startsWith("#"))return i.slice(1).toUpperCase();let o=i.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(o){let e=parseInt(o[1]).toString(16).padStart(2,"0"),t=parseInt(o[2]).toString(16).padStart(2,"0"),n=parseInt(o[3]).toString(16).padStart(2,"0");return (e+t+n).toUpperCase()}return null}function h(i){let o=window.getComputedStyle(i),e={};(o.fontWeight==="bold"||parseInt(o.fontWeight)>=700)&&(e.bold=true),o.fontStyle==="italic"&&(e.italic=true);let t=o.textDecoration||o.textDecorationLine;t&&t.includes("underline")&&(e.underline={style:"single"}),t&&t.includes("line-through")&&(e.strike=true);let n=parseFloat(o.fontSize);!isNaN(n)&&n>0&&(e.fontSize=Math.round(n/1.333*2));let r=o.fontFamily.replace(/["']/g,"").split(",")[0].trim();r&&(e.fontFamily={ascii:r});let s=o.color;if(s&&s!=="rgb(0, 0, 0)"){let c=L(s);c&&(e.color={rgb:c});}let l=o.backgroundColor;if(l&&l!=="transparent"&&l!=="rgba(0, 0, 0, 0)"){let c=S(l);c&&(e.shading={fill:{rgb:c}});}return Object.keys(e).length>0?e:void 0}function Lt(i,o){let e=document.createRange();e.selectNodeContents(i);let t=o.compareBoundaryPoints(Range.START_TO_START,e)>=0&&o.compareBoundaryPoints(Range.START_TO_END,e)<=0,n=o.compareBoundaryPoints(Range.END_TO_START,e)>=0&&o.compareBoundaryPoints(Range.END_TO_END,e)<=0;if(t&&n)return o.toString();if(t){let r=document.createRange();return r.setStart(o.startContainer,o.startOffset),r.selectNodeContents(i),r.setEnd(e.endContainer,e.endOffset),r.toString()}else if(n){let r=document.createRange();return r.selectNodeContents(i),r.setEnd(o.endContainer,o.endOffset),r.setStart(e.startContainer,e.startOffset),r.toString()}else if(o.intersectsNode(i))return i.textContent||"";return ""}function F(i){let o=i;for(;o;){if(o.nodeType===Node.ELEMENT_NODE){let e=o;if(e.hasAttribute("data-paragraph-index"))return e}o=o.parentNode;}return null}function f(){let i=window.getSelection();if(!i||i.isCollapsed)return [];let o=[],e=i.getRangeAt(0),t=e.commonAncestorContainer,n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;if(!n)return o;if(n.querySelectorAll(".docx-run").forEach(s=>{if(e.intersectsNode(s)){let l=Lt(s,e);if(l){let c=h(s);o.push({type:"run",formatting:c,content:[{type:"text",text:l}]});}}}),o.length===0){let s=i.toString();s&&o.push({type:"run",content:[{type:"text",text:s}]});}return o}function A(){let i=window.getSelection();if(!i||i.isCollapsed)return null;let o=f();if(o.length===0)return null;let e=i.toString(),t=i.getRangeAt(0),n=F(t.startContainer),r=F(t.endContainer),s=n?parseInt(n.getAttribute("data-paragraph-index")||"0",10):0,l=r?parseInt(r.getAttribute("data-paragraph-index")||"0",10):0;return {text:e,runs:o,startParagraphIndex:s,startRunIndex:0,startOffset:t.startOffset,endParagraphIndex:l,endRunIndex:0,endOffset:t.endOffset,isMultiParagraph:s!==l}}var S=L;var d=class extends a{constructor(){super({notifications:[]});a$1(this,"notifications",[]);a$1(this,"idCounter",0);a$1(this,"timers",new Set);}showError(e,t){return this.addNotification(e,"error",t)}showWarning(e,t){return this.addNotification(e,"warning",t)}showInfo(e,t){return this.addNotification(e,"info",t)}dismiss(e){this.notifications=this.notifications.map(n=>n.id===e?{...n,dismissed:true}:n),this.emitSnapshot();let t=setTimeout(()=>{this.timers.delete(t),this.notifications=this.notifications.filter(n=>n.id!==e),this.emitSnapshot();},300);this.timers.add(t);}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,t,n){let r=`error-${++this.idCounter}-${Date.now()}`,s={id:r,message:e,severity:t,details:n,timestamp:Date.now()};if(this.notifications=[...this.notifications,s],this.emitSnapshot(),t!=="error"){let l=setTimeout(()=>{this.timers.delete(l),this.dismiss(r);},5e3);this.timers.add(l);}return r}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};function z(i,o){let e=`plugin-styles-${i}`,t=document.getElementById(e);t&&t.remove();let n=document.createElement("style");return n.id=e,n.textContent=o,document.head.appendChild(n),()=>{let r=document.getElementById(e);r&&r.remove();}}var u=class extends a{constructor(){super({states:new Map,version:0});a$1(this,"plugins",[]);a$1(this,"pluginStates",new Map);a$1(this,"version",0);}initialize(e,t){this.destroyPlugins(),this.plugins=e;for(let n of e)n.initialize&&!this.pluginStates.has(n.id)&&this.pluginStates.set(n.id,n.initialize(t));this.emitSnapshot();}updateStates(e){let t=false;for(let n of this.plugins)if(n.onStateChange){let r=n.onStateChange(e);r!==void 0&&(this.pluginStates.set(n.id,r),t=true);}return t&&(this.version++,this.emitSnapshot()),t}getPluginState(e){return this.pluginStates.get(e)}setPluginState(e,t){this.pluginStates.set(e,t),this.version++,this.emitSnapshot();}destroy(){this.destroyPlugins(),this.emitSnapshot();}destroyPlugins(){for(let e of this.plugins)e.destroy&&e.destroy();this.pluginStates.clear(),this.plugins=[];}emitSnapshot(){this.setSnapshot({states:new Map(this.pluginStates),version:this.version});}};var p=class extends a{constructor(){super({hasLayout:false,selectionRects:[],caretPosition:null,selectedImageInfo:null,isFocused:false,isDragging:false,isResizingColumn:false,isImageInteracting:false,version:0});a$1(this,"_hasLayout",false);a$1(this,"_selectionRects",[]);a$1(this,"_caretPosition",null);a$1(this,"_isDragging",false);a$1(this,"_dragAnchor",null);a$1(this,"_columnResize",{isResizing:false,startX:0,columnIndex:0,tablePmStart:0,originalWidths:{left:0,right:0}});a$1(this,"_selectedImageInfo",null);a$1(this,"_isImageInteracting",false);a$1(this,"_isFocused",false);a$1(this,"_version",0);}setLayoutReady(e){this._hasLayout=e,this.emitSnapshot();}updateSelection(e,t){this._selectionRects=e,this._caretPosition=t,this.emitSnapshot();}startDrag(e){this._isDragging=true,this._dragAnchor=e,this.emitSnapshot();}endDrag(){this._isDragging=false,this._dragAnchor=null,this.emitSnapshot();}getDragAnchor(){return this._dragAnchor}startColumnResize(e,t,n,r){this._columnResize={isResizing:true,startX:n,columnIndex:t,tablePmStart:e,originalWidths:r},this.emitSnapshot();}endColumnResize(){this._columnResize={...this._columnResize,isResizing:false},this.emitSnapshot();}getColumnResize(){return this._columnResize}setSelectedImage(e){this._selectedImageInfo=e,this.emitSnapshot();}clearSelectedImage(){this._selectedImageInfo=null,this._isImageInteracting=false,this.emitSnapshot();}setImageInteracting(e){this._isImageInteracting=e,this.emitSnapshot();}setFocused(e){this._isFocused=e,this.emitSnapshot();}emitSnapshot(){this._version++,this.setSnapshot({hasLayout:this._hasLayout,selectionRects:this._selectionRects,caretPosition:this._caretPosition,selectedImageInfo:this._selectedImageInfo,isFocused:this._isFocused,isDragging:this._isDragging,isResizingColumn:this._columnResize.isResizing,isImageInteracting:this._isImageInteracting,version:this._version});}};var g=class extends a{constructor(e={}){let t=e.initialZoom??1;super({loadingState:"idle",parseError:null,isReady:false,zoom:t,fontsLoaded:false,version:0});a$1(this,"_loadingState","idle");a$1(this,"_parseError",null);a$1(this,"_zoom");a$1(this,"_fontsLoaded",false);a$1(this,"_document",null);a$1(this,"_version",0);a$1(this,"onChangeCallback");a$1(this,"onErrorCallback");this._zoom=t,this.onChangeCallback=e.onChange,this.onErrorCallback=e.onError;}setParsingStarted(){this._loadingState="parsing",this._parseError=null,this.emitSnapshot();}setDocumentLoaded(e){this._document=e,this._loadingState="loading-fonts",this._parseError=null,this.emitSnapshot();}setFontsLoaded(){this._fontsLoaded=true,this._loadingState="ready",this.emitSnapshot();}setLoadError(e){this._loadingState="error",this._parseError=e.message,this.onErrorCallback?.(e),this.emitSnapshot();}getDocument(){return this._document}updateDocument(e){this._document=e,this.onChangeCallback?.(e),this.emitSnapshot();}setZoom(e){this._zoom=Math.max(.25,Math.min(4,e)),this.emitSnapshot();}getZoom(){return this._zoom}emitSnapshot(){this._version++,this.setSnapshot({loadingState:this._loadingState,parseError:this._parseError,isReady:this._loadingState==="ready",zoom:this._zoom,fontsLoaded:this._fontsLoaded,version:this._version});}};var to="0.0.2";export{g as EditorCoordinator,d as ErrorManager,p as LayoutCoordinator,u as PluginLifecycleManager,to as VERSION,A as createSelectionFromDOM,h as extractFormattingFromElement,f as getSelectionRuns,z as injectStyles,S as rgbToHex};
@@ -1 +1 @@
1
- 'use strict';require('../chunk-6WZW3NSJ.js');var chunk4PANZ3VU_js=require('../chunk-4PANZ3VU.js');require('../chunk-ZAZWHK4J.js');var chunkPFMM7QON_js=require('../chunk-PFMM7QON.js'),chunkYPQACU4A_js=require('../chunk-YPQACU4A.js');require('../chunk-4MYKVWNF.js');var chunkJ3YFJDZD_js=require('../chunk-J3YFJDZD.js'),chunkRSU4HTC6_js=require('../chunk-RSU4HTC6.js');require('../chunk-IMKU4O3P.js'),require('../chunk-DROCYKAR.js'),require('../chunk-LERLET2D.js'),require('../chunk-FIGLFSNR.js'),require('../chunk-QVRNNRG5.js'),require('../chunk-C45EFOVP.js'),require('../chunk-ISKTBM4L.js'),require('../chunk-JFZIXFRC.js'),require('../chunk-RQVHKDXK.js'),require('../chunk-SCK6ZM5V.js'),require('../chunk-Z3LGMBJC.js'),require('../chunk-3R7QHNI5.js'),require('../chunk-WWBNJ7KF.js'),require('../chunk-4RTVLMRZ.js'),require('../chunk-BHBOAP6Z.js'),require('../chunk-MZ7LW5CH.js'),require('../chunk-N3Y5BUKV.js'),require('../chunk-WVERBZZU.js'),require('../chunk-6LVPRTB6.js'),require('../chunk-LWH66Q7Q.js'),require('../chunk-TUIEV7Q7.js'),require('../chunk-7HANRHHL.js'),require('../chunk-MJ5FQX7Q.js'),require('../chunk-C2BAPYGJ.js'),require('../chunk-4Q2IP5FW.js'),require('../chunk-GSKMHXHG.js'),require('../chunk-DC7S76ZX.js');function de(a){let{state:t,document:n,pageSize:e,margins:o,columns:p,finalPageSize:d,finalMargins:L,finalColumns:M,pageGap:K,contentWidth:f,theme:m,styles:D,sectionProperties:s,finalSectionProperties:Q,headerContent:X,footerContent:Y,firstPageHeaderContent:Z,firstPageFooterContent:ee,measureBlocks:g,getHfPmDoc:te}=a,oe=e.h-o.top-o.bottom,r=chunkYPQACU4A_js.c(t.doc,{theme:m,pageContentHeight:oe}),ne=chunk4PANZ3VU_js.O(r,{pageSize:e,margins:o,columns:p},{pageSize:d,margins:L,columns:M}),l=g(r,ne,chunkJ3YFJDZD_js.f({size:e,margins:o})),y=chunkPFMM7QON_js.d(r),k=y.length>0&&!!n?.package?.footnotes,H={section:"header",pageSize:e,margins:o},x={section:"footer",pageSize:e,margins:o},T=t.doc.attrs?.defaultTabStopTwips,w={styles:D,theme:m,measureBlocks:g,defaultTabStopTwips:T},c=(i,u)=>{if(!i)return;let _=te(i);return _?chunk4PANZ3VU_js.z(_,f,u,w):chunk4PANZ3VU_js.y(i,f,u,w)},B=c(X,H),R=c(Y,x),F=s?.titlePg===true,v=F?c(Z,H):void 0,z=F?c(ee,x):void 0,re=t.doc.attrs?.watermark??void 0,{margins:ae,finalMargins:ie}=chunk4PANZ3VU_js.D({pageSize:e,margins:o,finalMargins:L,bodyBlocks:r,headers:[B,v],footers:[R,z],warn:i=>console.warn(`[computeLayout] ${i}`)}),se=Q?.sectionStart,P={pageSize:e,margins:ae,finalPageSize:d,finalMargins:ie,columns:M,bodyBreakType:se,pageGap:K},h,E=new Map,S=new Map;if(k){let i=chunkRSU4HTC6_js.U(r,l,P);S=chunkPFMM7QON_js.h(n.package.footnotes,y,f,{styles:D??void 0,theme:m??null,measureBlocks:g,defaultTabStopTwips:T});let u=chunkPFMM7QON_js.j({blocks:r,measures:l,layoutOpts:P,footnoteRefs:y,footnoteContentMap:S,initialLayout:i});h=u.layout,E=u.pageFootnoteMap;}else h=chunkRSU4HTC6_js.U(r,l,P);let W=k?chunkPFMM7QON_js.k(E,S,n):void 0;return {blocks:r,measures:l,layout:h,headerContentForRender:B,footerContentForRender:R,firstPageHeaderForRender:v,firstPageFooterForRender:z,hasTitlePg:F,watermark:re,headerDistancePx:s?.headerDistance?chunk4PANZ3VU_js.I(s.headerDistance):void 0,footerDistancePx:s?.footerDistance?chunk4PANZ3VU_js.I(s.footerDistance):void 0,pageBorders:s?.pageBorders,footnotesByPage:W?.size?W:void 0}}function ue(a,t=e=>requestAnimationFrame(e),n=e=>cancelAnimationFrame(e)){let e=null;return {schedule(o){if(e){e.state=o;return}e={handle:0,state:o};let p=t(()=>{let d=e;e=null,d&&a(d.state);});e&&(e.handle=p);},cancel(){e&&(n(e.handle),e=null);}}}var J=false;function le(a){if(!J){J=true;try{let t=a.scrollIntoView();(typeof t.updated!="number"||(t.updated&4)===0)&&console.warn("[docx-editor] prosemirror-state UPDATED_SCROLL bit shape changed; paginated scroll suppression may be stale. Update PM_UPDATED_SCROLL.");}catch{}}}function ce(a,t){le(t);let n=a;typeof n.updated=="number"&&(n.updated&=-5);}exports.computeLayout=de;exports.createLayoutScheduler=ue;exports.stripScrollFlag=ce;
1
+ 'use strict';require('../chunk-ZBCFIW2V.js');var chunkQ4IEATDJ_js=require('../chunk-Q4IEATDJ.js');require('../chunk-6IZOFIQH.js');var chunkKAOLVBLH_js=require('../chunk-KAOLVBLH.js'),chunkYPQACU4A_js=require('../chunk-YPQACU4A.js');require('../chunk-77GRQUSK.js');var chunkJ3YFJDZD_js=require('../chunk-J3YFJDZD.js'),chunkRSU4HTC6_js=require('../chunk-RSU4HTC6.js');require('../chunk-IMKU4O3P.js'),require('../chunk-DROCYKAR.js'),require('../chunk-LERLET2D.js'),require('../chunk-FIGLFSNR.js'),require('../chunk-XLB6AC5Q.js'),require('../chunk-C45EFOVP.js'),require('../chunk-ISKTBM4L.js'),require('../chunk-JFZIXFRC.js'),require('../chunk-RQVHKDXK.js'),require('../chunk-SCK6ZM5V.js'),require('../chunk-Z3LGMBJC.js'),require('../chunk-3R7QHNI5.js'),require('../chunk-L5NPEM7C.js'),require('../chunk-2WGTGBBS.js'),require('../chunk-BHBOAP6Z.js'),require('../chunk-MZ7LW5CH.js'),require('../chunk-N3Y5BUKV.js'),require('../chunk-WVERBZZU.js'),require('../chunk-6LVPRTB6.js'),require('../chunk-LWH66Q7Q.js'),require('../chunk-TUIEV7Q7.js'),require('../chunk-7HANRHHL.js'),require('../chunk-MJ5FQX7Q.js'),require('../chunk-C2BAPYGJ.js'),require('../chunk-4Q2IP5FW.js'),require('../chunk-GSKMHXHG.js'),require('../chunk-DC7S76ZX.js');function de(a){let{state:t,document:n,pageSize:e,margins:o,columns:p,finalPageSize:d,finalMargins:L,finalColumns:M,pageGap:K,contentWidth:f,theme:m,styles:D,sectionProperties:s,finalSectionProperties:Q,headerContent:X,footerContent:Y,firstPageHeaderContent:Z,firstPageFooterContent:ee,measureBlocks:g,getHfPmDoc:te}=a,oe=e.h-o.top-o.bottom,r=chunkYPQACU4A_js.c(t.doc,{theme:m,pageContentHeight:oe}),ne=chunkQ4IEATDJ_js.O(r,{pageSize:e,margins:o,columns:p},{pageSize:d,margins:L,columns:M}),l=g(r,ne,chunkJ3YFJDZD_js.f({size:e,margins:o})),y=chunkKAOLVBLH_js.d(r),k=y.length>0&&!!n?.package?.footnotes,H={section:"header",pageSize:e,margins:o},x={section:"footer",pageSize:e,margins:o},T=t.doc.attrs?.defaultTabStopTwips,w={styles:D,theme:m,measureBlocks:g,defaultTabStopTwips:T},c=(i,u)=>{if(!i)return;let _=te(i);return _?chunkQ4IEATDJ_js.z(_,f,u,w):chunkQ4IEATDJ_js.y(i,f,u,w)},B=c(X,H),R=c(Y,x),F=s?.titlePg===true,v=F?c(Z,H):void 0,z=F?c(ee,x):void 0,re=t.doc.attrs?.watermark??void 0,{margins:ae,finalMargins:ie}=chunkQ4IEATDJ_js.D({pageSize:e,margins:o,finalMargins:L,bodyBlocks:r,headers:[B,v],footers:[R,z],warn:i=>console.warn(`[computeLayout] ${i}`)}),se=Q?.sectionStart,P={pageSize:e,margins:ae,finalPageSize:d,finalMargins:ie,columns:M,bodyBreakType:se,pageGap:K},h,E=new Map,S=new Map;if(k){let i=chunkRSU4HTC6_js.U(r,l,P);S=chunkKAOLVBLH_js.h(n.package.footnotes,y,f,{styles:D??void 0,theme:m??null,measureBlocks:g,defaultTabStopTwips:T});let u=chunkKAOLVBLH_js.j({blocks:r,measures:l,layoutOpts:P,footnoteRefs:y,footnoteContentMap:S,initialLayout:i});h=u.layout,E=u.pageFootnoteMap;}else h=chunkRSU4HTC6_js.U(r,l,P);let W=k?chunkKAOLVBLH_js.k(E,S,n):void 0;return {blocks:r,measures:l,layout:h,headerContentForRender:B,footerContentForRender:R,firstPageHeaderForRender:v,firstPageFooterForRender:z,hasTitlePg:F,watermark:re,headerDistancePx:s?.headerDistance!=null?chunkQ4IEATDJ_js.I(s.headerDistance):void 0,footerDistancePx:s?.footerDistance!=null?chunkQ4IEATDJ_js.I(s.footerDistance):void 0,pageBorders:s?.pageBorders,footnotesByPage:W?.size?W:void 0}}function ue(a,t=e=>requestAnimationFrame(e),n=e=>cancelAnimationFrame(e)){let e=null;return {schedule(o){if(e){e.state=o;return}e={handle:0,state:o};let p=t(()=>{let d=e;e=null,d&&a(d.state);});e&&(e.handle=p);},cancel(){e&&(n(e.handle),e=null);}}}var J=false;function le(a){if(!J){J=true;try{let t=a.scrollIntoView();(typeof t.updated!="number"||(t.updated&4)===0)&&console.warn("[docx-editor] prosemirror-state UPDATED_SCROLL bit shape changed; paginated scroll suppression may be stale. Update PM_UPDATED_SCROLL.");}catch{}}}function ce(a,t){le(t);let n=a;typeof n.updated=="number"&&(n.updated&=-5);}exports.computeLayout=de;exports.createLayoutScheduler=ue;exports.stripScrollFlag=ce;
@@ -1 +1 @@
1
- import'../chunk-PMSGJXOE.mjs';import {O,D,I,z,y}from'../chunk-2LEFMTNZ.mjs';import'../chunk-UEPLDKKM.mjs';import {d,h,j,k}from'../chunk-KKXCBWVG.mjs';import {c}from'../chunk-HKN2NKOG.mjs';import'../chunk-LX35TFGF.mjs';import {f}from'../chunk-55XWETY4.mjs';import {U}from'../chunk-JHTURDPX.mjs';import'../chunk-FCJWLEKT.mjs';import'../chunk-7E5VBRDL.mjs';import'../chunk-3G44SFHX.mjs';import'../chunk-MOCGHQ4A.mjs';import'../chunk-LJE7HQEJ.mjs';import'../chunk-7OW3VCZE.mjs';import'../chunk-LK6I3HMH.mjs';import'../chunk-QPFJJPIC.mjs';import'../chunk-GYWTUUXX.mjs';import'../chunk-7CZEZ3UL.mjs';import'../chunk-W77JXDEV.mjs';import'../chunk-3ANZ3252.mjs';import'../chunk-4GFTMGSV.mjs';import'../chunk-SWBLJF6R.mjs';import'../chunk-MOKKS75W.mjs';import'../chunk-OZMNIX6U.mjs';import'../chunk-AMENZY5F.mjs';import'../chunk-U67MWOPZ.mjs';import'../chunk-BGY3CB37.mjs';import'../chunk-2XP6GLA4.mjs';import'../chunk-ZX26QZJ5.mjs';import'../chunk-MJ6XZFVD.mjs';import'../chunk-67LVRQIR.mjs';import'../chunk-LE67NTCN.mjs';import'../chunk-VW22RZ6C.mjs';import'../chunk-DI6CRWSW.mjs';import'../chunk-QYUPLKLP.mjs';function de(a){let{state:t,document:n,pageSize:e,margins:o,columns:p,finalPageSize:d$1,finalMargins:L,finalColumns:M,pageGap:K,contentWidth:f$1,theme:m,styles:D$1,sectionProperties:s,finalSectionProperties:Q,headerContent:X,footerContent:Y,firstPageHeaderContent:Z,firstPageFooterContent:ee,measureBlocks:g,getHfPmDoc:te}=a,oe=e.h-o.top-o.bottom,r=c(t.doc,{theme:m,pageContentHeight:oe}),ne=O(r,{pageSize:e,margins:o,columns:p},{pageSize:d$1,margins:L,columns:M}),l=g(r,ne,f({size:e,margins:o})),y$1=d(r),k$1=y$1.length>0&&!!n?.package?.footnotes,H={section:"header",pageSize:e,margins:o},x={section:"footer",pageSize:e,margins:o},T=t.doc.attrs?.defaultTabStopTwips,w={styles:D$1,theme:m,measureBlocks:g,defaultTabStopTwips:T},c$1=(i,u)=>{if(!i)return;let _=te(i);return _?z(_,f$1,u,w):y(i,f$1,u,w)},B=c$1(X,H),R=c$1(Y,x),F=s?.titlePg===true,v=F?c$1(Z,H):void 0,z$1=F?c$1(ee,x):void 0,re=t.doc.attrs?.watermark??void 0,{margins:ae,finalMargins:ie}=D({pageSize:e,margins:o,finalMargins:L,bodyBlocks:r,headers:[B,v],footers:[R,z$1],warn:i=>console.warn(`[computeLayout] ${i}`)}),se=Q?.sectionStart,P={pageSize:e,margins:ae,finalPageSize:d$1,finalMargins:ie,columns:M,bodyBreakType:se,pageGap:K},h$1,E=new Map,S=new Map;if(k$1){let i=U(r,l,P);S=h(n.package.footnotes,y$1,f$1,{styles:D$1??void 0,theme:m??null,measureBlocks:g,defaultTabStopTwips:T});let u=j({blocks:r,measures:l,layoutOpts:P,footnoteRefs:y$1,footnoteContentMap:S,initialLayout:i});h$1=u.layout,E=u.pageFootnoteMap;}else h$1=U(r,l,P);let W=k$1?k(E,S,n):void 0;return {blocks:r,measures:l,layout:h$1,headerContentForRender:B,footerContentForRender:R,firstPageHeaderForRender:v,firstPageFooterForRender:z$1,hasTitlePg:F,watermark:re,headerDistancePx:s?.headerDistance?I(s.headerDistance):void 0,footerDistancePx:s?.footerDistance?I(s.footerDistance):void 0,pageBorders:s?.pageBorders,footnotesByPage:W?.size?W:void 0}}function ue(a,t=e=>requestAnimationFrame(e),n=e=>cancelAnimationFrame(e)){let e=null;return {schedule(o){if(e){e.state=o;return}e={handle:0,state:o};let p=t(()=>{let d=e;e=null,d&&a(d.state);});e&&(e.handle=p);},cancel(){e&&(n(e.handle),e=null);}}}var J=false;function le(a){if(!J){J=true;try{let t=a.scrollIntoView();(typeof t.updated!="number"||(t.updated&4)===0)&&console.warn("[docx-editor] prosemirror-state UPDATED_SCROLL bit shape changed; paginated scroll suppression may be stale. Update PM_UPDATED_SCROLL.");}catch{}}}function ce(a,t){le(t);let n=a;typeof n.updated=="number"&&(n.updated&=-5);}export{de as computeLayout,ue as createLayoutScheduler,ce as stripScrollFlag};
1
+ import'../chunk-HPAUUQAX.mjs';import {O,D,I,z,y}from'../chunk-OF373DBR.mjs';import'../chunk-GGUHM74A.mjs';import {d,h,j,k}from'../chunk-OEC6SBDV.mjs';import {c}from'../chunk-HKN2NKOG.mjs';import'../chunk-EM33RGHT.mjs';import {f}from'../chunk-55XWETY4.mjs';import {U}from'../chunk-JHTURDPX.mjs';import'../chunk-FCJWLEKT.mjs';import'../chunk-7E5VBRDL.mjs';import'../chunk-3G44SFHX.mjs';import'../chunk-MOCGHQ4A.mjs';import'../chunk-IUJCUITW.mjs';import'../chunk-7OW3VCZE.mjs';import'../chunk-LK6I3HMH.mjs';import'../chunk-QPFJJPIC.mjs';import'../chunk-GYWTUUXX.mjs';import'../chunk-7CZEZ3UL.mjs';import'../chunk-W77JXDEV.mjs';import'../chunk-3ANZ3252.mjs';import'../chunk-QAJSNLJR.mjs';import'../chunk-CRMZH7U7.mjs';import'../chunk-MOKKS75W.mjs';import'../chunk-OZMNIX6U.mjs';import'../chunk-AMENZY5F.mjs';import'../chunk-U67MWOPZ.mjs';import'../chunk-BGY3CB37.mjs';import'../chunk-2XP6GLA4.mjs';import'../chunk-ZX26QZJ5.mjs';import'../chunk-MJ6XZFVD.mjs';import'../chunk-67LVRQIR.mjs';import'../chunk-LE67NTCN.mjs';import'../chunk-VW22RZ6C.mjs';import'../chunk-DI6CRWSW.mjs';import'../chunk-QYUPLKLP.mjs';function de(a){let{state:t,document:n,pageSize:e,margins:o,columns:p,finalPageSize:d$1,finalMargins:L,finalColumns:M,pageGap:K,contentWidth:f$1,theme:m,styles:D$1,sectionProperties:s,finalSectionProperties:Q,headerContent:X,footerContent:Y,firstPageHeaderContent:Z,firstPageFooterContent:ee,measureBlocks:g,getHfPmDoc:te}=a,oe=e.h-o.top-o.bottom,r=c(t.doc,{theme:m,pageContentHeight:oe}),ne=O(r,{pageSize:e,margins:o,columns:p},{pageSize:d$1,margins:L,columns:M}),l=g(r,ne,f({size:e,margins:o})),y$1=d(r),k$1=y$1.length>0&&!!n?.package?.footnotes,H={section:"header",pageSize:e,margins:o},x={section:"footer",pageSize:e,margins:o},T=t.doc.attrs?.defaultTabStopTwips,w={styles:D$1,theme:m,measureBlocks:g,defaultTabStopTwips:T},c$1=(i,u)=>{if(!i)return;let _=te(i);return _?z(_,f$1,u,w):y(i,f$1,u,w)},B=c$1(X,H),R=c$1(Y,x),F=s?.titlePg===true,v=F?c$1(Z,H):void 0,z$1=F?c$1(ee,x):void 0,re=t.doc.attrs?.watermark??void 0,{margins:ae,finalMargins:ie}=D({pageSize:e,margins:o,finalMargins:L,bodyBlocks:r,headers:[B,v],footers:[R,z$1],warn:i=>console.warn(`[computeLayout] ${i}`)}),se=Q?.sectionStart,P={pageSize:e,margins:ae,finalPageSize:d$1,finalMargins:ie,columns:M,bodyBreakType:se,pageGap:K},h$1,E=new Map,S=new Map;if(k$1){let i=U(r,l,P);S=h(n.package.footnotes,y$1,f$1,{styles:D$1??void 0,theme:m??null,measureBlocks:g,defaultTabStopTwips:T});let u=j({blocks:r,measures:l,layoutOpts:P,footnoteRefs:y$1,footnoteContentMap:S,initialLayout:i});h$1=u.layout,E=u.pageFootnoteMap;}else h$1=U(r,l,P);let W=k$1?k(E,S,n):void 0;return {blocks:r,measures:l,layout:h$1,headerContentForRender:B,footerContentForRender:R,firstPageHeaderForRender:v,firstPageFooterForRender:z$1,hasTitlePg:F,watermark:re,headerDistancePx:s?.headerDistance!=null?I(s.headerDistance):void 0,footerDistancePx:s?.footerDistance!=null?I(s.footerDistance):void 0,pageBorders:s?.pageBorders,footnotesByPage:W?.size?W:void 0}}function ue(a,t=e=>requestAnimationFrame(e),n=e=>cancelAnimationFrame(e)){let e=null;return {schedule(o){if(e){e.state=o;return}e={handle:0,state:o};let p=t(()=>{let d=e;e=null,d&&a(d.state);});e&&(e.handle=p);},cancel(){e&&(n(e.handle),e=null);}}}var J=false;function le(a){if(!J){J=true;try{let t=a.scrollIntoView();(typeof t.updated!="number"||(t.updated&4)===0)&&console.warn("[docx-editor] prosemirror-state UPDATED_SCROLL bit shape changed; paginated scroll suppression may be stale. Update PM_UPDATED_SCROLL.");}catch{}}}function ce(a,t){le(t);let n=a;typeof n.updated=="number"&&(n.updated&=-5);}export{de as computeLayout,ue as createLayoutScheduler,ce as stripScrollFlag};
@@ -1 +1 @@
1
- 'use strict';var chunk4MYKVWNF_js=require('../chunk-4MYKVWNF.js');require('../chunk-DC7S76ZX.js');Object.defineProperty(exports,"clickToPositionDom",{enumerable:true,get:function(){return chunk4MYKVWNF_js.e}});Object.defineProperty(exports,"clipRectToTableWindow",{enumerable:true,get:function(){return chunk4MYKVWNF_js.f}});Object.defineProperty(exports,"getCaretPositionFromDom",{enumerable:true,get:function(){return chunk4MYKVWNF_js.h}});Object.defineProperty(exports,"getSelectionRectsFromDom",{enumerable:true,get:function(){return chunk4MYKVWNF_js.g}});
1
+ 'use strict';var chunk77GRQUSK_js=require('../chunk-77GRQUSK.js');require('../chunk-DC7S76ZX.js');Object.defineProperty(exports,"clickToPositionDom",{enumerable:true,get:function(){return chunk77GRQUSK_js.e}});Object.defineProperty(exports,"clipRectToTableWindow",{enumerable:true,get:function(){return chunk77GRQUSK_js.f}});Object.defineProperty(exports,"getCaretPositionFromDom",{enumerable:true,get:function(){return chunk77GRQUSK_js.h}});Object.defineProperty(exports,"getSelectionRectsFromDom",{enumerable:true,get:function(){return chunk77GRQUSK_js.g}});
@@ -1 +1 @@
1
- export{e as clickToPositionDom,f as clipRectToTableWindow,h as getCaretPositionFromDom,g as getSelectionRectsFromDom}from'../chunk-LX35TFGF.mjs';import'../chunk-QYUPLKLP.mjs';
1
+ export{e as clickToPositionDom,f as clipRectToTableWindow,h as getCaretPositionFromDom,g as getSelectionRectsFromDom}from'../chunk-EM33RGHT.mjs';import'../chunk-QYUPLKLP.mjs';
@@ -544,7 +544,13 @@ declare const DEFAULT_BODY_MARGIN_PX = 96;
544
544
  declare const DEFAULT_HF_DISTANCE_PX = 48;
545
545
  /** Convert twips to pixels (1 twip = 1/20 point, 96 pixels per inch). */
546
546
  declare function twipsToPixels(twips: number): number;
547
- /** Convert SectionProperties page size (twips) → pixel `{ w, h }`. */
547
+ /**
548
+ * Convert SectionProperties page size (twips) → pixel `{ w, h }`.
549
+ *
550
+ * Page size is a SIZE: a literal `0` (malformed `w:pgSz`) defaults to Letter
551
+ * rather than rendering a zero-area page — so the truthy guard is intentional
552
+ * here (contrast `getMargins`, where `0` is honored). See `twipsToPxOr`.
553
+ */
548
554
  declare function getPageSize(sp: SectionProperties | null | undefined): {
549
555
  w: number;
550
556
  h: number;
@@ -552,8 +558,11 @@ declare function getPageSize(sp: SectionProperties | null | undefined): {
552
558
  /**
553
559
  * Convert SectionProperties margins (twips) → pixel `PageMargins`.
554
560
  *
555
- * `header` / `footer` default to 48px (Word's 0.5-inch default) so the
556
- * HF margin-extension math doesn't have to special-case undefined.
561
+ * Every distance is an OFFSET, so an explicit `0` is honored (full-bleed body
562
+ * margins; a header/footer pinned to the page edge — issue #740). Only an
563
+ * ABSENT distance falls back to Word's default. `header`/`footer` default to
564
+ * 48px (Word's 0.5in) so the HF margin-extension math needn't special-case
565
+ * undefined.
557
566
  */
558
567
  declare function getMargins(sp: SectionProperties | null | undefined): PageMargins;
559
568
  /**
@@ -544,7 +544,13 @@ declare const DEFAULT_BODY_MARGIN_PX = 96;
544
544
  declare const DEFAULT_HF_DISTANCE_PX = 48;
545
545
  /** Convert twips to pixels (1 twip = 1/20 point, 96 pixels per inch). */
546
546
  declare function twipsToPixels(twips: number): number;
547
- /** Convert SectionProperties page size (twips) → pixel `{ w, h }`. */
547
+ /**
548
+ * Convert SectionProperties page size (twips) → pixel `{ w, h }`.
549
+ *
550
+ * Page size is a SIZE: a literal `0` (malformed `w:pgSz`) defaults to Letter
551
+ * rather than rendering a zero-area page — so the truthy guard is intentional
552
+ * here (contrast `getMargins`, where `0` is honored). See `twipsToPxOr`.
553
+ */
548
554
  declare function getPageSize(sp: SectionProperties | null | undefined): {
549
555
  w: number;
550
556
  h: number;
@@ -552,8 +558,11 @@ declare function getPageSize(sp: SectionProperties | null | undefined): {
552
558
  /**
553
559
  * Convert SectionProperties margins (twips) → pixel `PageMargins`.
554
560
  *
555
- * `header` / `footer` default to 48px (Word's 0.5-inch default) so the
556
- * HF margin-extension math doesn't have to special-case undefined.
561
+ * Every distance is an OFFSET, so an explicit `0` is honored (full-bleed body
562
+ * margins; a header/footer pinned to the page edge — issue #740). Only an
563
+ * ABSENT distance falls back to Word's default. `header`/`footer` default to
564
+ * 48px (Word's 0.5in) so the HF margin-extension math needn't special-case
565
+ * undefined.
557
566
  */
558
567
  declare function getMargins(sp: SectionProperties | null | undefined): PageMargins;
559
568
  /**