@eigenpal/docx-editor-core 1.3.0 → 1.3.2

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 (107) hide show
  1. package/dist/chunk-2LEFMTNZ.mjs +1 -0
  2. package/dist/chunk-4MYKVWNF.js +1 -0
  3. package/dist/chunk-4PANZ3VU.js +1 -0
  4. package/dist/{chunk-Q5B5GKXD.mjs → chunk-55XWETY4.mjs} +1 -1
  5. package/dist/chunk-6WZW3NSJ.js +1 -0
  6. package/dist/chunk-HKN2NKOG.mjs +1 -0
  7. package/dist/chunk-HPJBZL37.mjs +1 -0
  8. package/dist/{chunk-TURYWKNS.js → chunk-J3YFJDZD.js} +1 -1
  9. package/dist/chunk-JHTURDPX.mjs +1 -0
  10. package/dist/chunk-KKXCBWVG.mjs +1 -0
  11. package/dist/chunk-LJE7HQEJ.mjs +1 -0
  12. package/dist/chunk-LX35TFGF.mjs +1 -0
  13. package/dist/chunk-NRWQ65NX.js +1 -0
  14. package/dist/chunk-PFMM7QON.js +1 -0
  15. package/dist/chunk-PMSGJXOE.mjs +1 -0
  16. package/dist/chunk-QVRNNRG5.js +1 -0
  17. package/dist/chunk-RSU4HTC6.js +1 -0
  18. package/dist/{chunk-L6YTCHOQ.mjs → chunk-UEPLDKKM.mjs} +1 -1
  19. package/dist/chunk-YPQACU4A.js +1 -0
  20. package/dist/{chunk-TJRROR6U.js → chunk-ZAZWHK4J.js} +1 -1
  21. package/dist/core.d.mts +2 -2
  22. package/dist/core.d.ts +2 -2
  23. package/dist/core.js +1 -1
  24. package/dist/core.mjs +1 -1
  25. package/dist/editor/index.d.mts +128 -0
  26. package/dist/editor/index.d.ts +128 -0
  27. package/dist/editor/index.js +1 -0
  28. package/dist/editor/index.mjs +1 -0
  29. package/dist/{footnotes-BtVc6VFl.d.mts → footnotes-BZ24OTAT.d.mts} +11 -1
  30. package/dist/{footnotes-DcUMWXul.d.ts → footnotes-DMsicPGd.d.ts} +11 -1
  31. package/dist/{headerFooterLayout-4E-S4Aay.d.ts → headerFooterLayout-AtAOhM8E.d.ts} +18 -2
  32. package/dist/{headerFooterLayout-DlJLWmpR.d.mts → headerFooterLayout-CU6hvszp.d.mts} +18 -2
  33. package/dist/layout-bridge/clickToPositionDom.js +1 -1
  34. package/dist/layout-bridge/clickToPositionDom.mjs +1 -1
  35. package/dist/layout-bridge/index.d.mts +109 -5
  36. package/dist/layout-bridge/index.d.ts +109 -5
  37. package/dist/layout-bridge/index.js +1 -1
  38. package/dist/layout-bridge/index.mjs +1 -1
  39. package/dist/layout-bridge/measuring/index.d.mts +5 -95
  40. package/dist/layout-bridge/measuring/index.d.ts +5 -95
  41. package/dist/layout-bridge/measuring/index.js +1 -1
  42. package/dist/layout-bridge/measuring/index.mjs +1 -1
  43. package/dist/layout-bridge/tableInsertHover.js +1 -1
  44. package/dist/layout-bridge/tableInsertHover.mjs +1 -1
  45. package/dist/layout-bridge/toFlowBlocks.js +1 -1
  46. package/dist/layout-bridge/toFlowBlocks.mjs +1 -1
  47. package/dist/layout-engine/index.js +1 -1
  48. package/dist/layout-engine/index.mjs +1 -1
  49. package/dist/layout-painter/index.d.mts +2 -2
  50. package/dist/layout-painter/index.d.ts +2 -2
  51. package/dist/layout-painter/index.js +1 -1
  52. package/dist/layout-painter/index.mjs +1 -1
  53. package/dist/layout-painter/renderPage.d.mts +8 -3
  54. package/dist/layout-painter/renderPage.d.ts +8 -3
  55. package/dist/layout-painter/renderPage.js +1 -1
  56. package/dist/layout-painter/renderPage.mjs +1 -1
  57. package/dist/measureBlocksPipeline-BMqbRFQB.d.mts +96 -0
  58. package/dist/measureBlocksPipeline-iYNzAH-o.d.ts +96 -0
  59. package/dist/prosemirror/applyFormatting.d.mts +67 -0
  60. package/dist/prosemirror/applyFormatting.d.ts +67 -0
  61. package/dist/prosemirror/applyFormatting.js +1 -0
  62. package/dist/prosemirror/applyFormatting.mjs +1 -0
  63. package/dist/prosemirror/commentIdAllocator.d.mts +50 -0
  64. package/dist/prosemirror/commentIdAllocator.d.ts +50 -0
  65. package/dist/prosemirror/commentIdAllocator.js +1 -0
  66. package/dist/prosemirror/commentIdAllocator.mjs +1 -0
  67. package/dist/prosemirror/commentOps.d.mts +46 -0
  68. package/dist/prosemirror/commentOps.d.ts +46 -0
  69. package/dist/prosemirror/commentOps.js +1 -0
  70. package/dist/prosemirror/commentOps.mjs +1 -0
  71. package/dist/prosemirror/conversion/index.js +1 -1
  72. package/dist/prosemirror/conversion/index.mjs +1 -1
  73. package/dist/prosemirror/imageCommit.d.mts +35 -0
  74. package/dist/prosemirror/imageCommit.d.ts +35 -0
  75. package/dist/prosemirror/imageCommit.js +1 -0
  76. package/dist/prosemirror/imageCommit.mjs +1 -0
  77. package/dist/prosemirror/index.js +2 -2
  78. package/dist/prosemirror/index.mjs +1 -1
  79. package/dist/prosemirror/paraText.d.mts +52 -0
  80. package/dist/prosemirror/paraText.d.ts +52 -0
  81. package/dist/prosemirror/paraText.js +1 -0
  82. package/dist/prosemirror/paraText.mjs +1 -0
  83. package/dist/prosemirror/queries.d.mts +65 -0
  84. package/dist/prosemirror/queries.d.ts +65 -0
  85. package/dist/prosemirror/queries.js +2 -0
  86. package/dist/prosemirror/queries.mjs +2 -0
  87. package/dist/prosemirror/tableResize.d.mts +58 -0
  88. package/dist/prosemirror/tableResize.d.ts +58 -0
  89. package/dist/prosemirror/tableResize.js +1 -0
  90. package/dist/prosemirror/tableResize.mjs +1 -0
  91. package/dist/utils/autoScroll.d.mts +24 -0
  92. package/dist/utils/autoScroll.d.ts +24 -0
  93. package/dist/utils/autoScroll.js +1 -0
  94. package/dist/utils/autoScroll.mjs +1 -0
  95. package/package.json +73 -1
  96. package/dist/chunk-72KLR6TJ.mjs +0 -1
  97. package/dist/chunk-7JQVKJRN.mjs +0 -1
  98. package/dist/chunk-7WGN2OBZ.js +0 -1
  99. package/dist/chunk-B46V5G46.mjs +0 -1
  100. package/dist/chunk-BUCOTKYY.js +0 -1
  101. package/dist/chunk-FQS436KN.js +0 -1
  102. package/dist/chunk-IUVQJ6PX.mjs +0 -1
  103. package/dist/chunk-JUMHC5Z6.mjs +0 -1
  104. package/dist/chunk-MEVZCB56.mjs +0 -1
  105. package/dist/chunk-T4RYVPAB.js +0 -1
  106. package/dist/chunk-WDBZ3QVB.js +0 -1
  107. package/dist/chunk-XWC67YLW.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-LJE7HQEJ.mjs';import {e}from'./chunk-VW22RZ6C.mjs';function Z(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=D(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 D(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 Xe(e,n){return Z(e,{y:n})?.pageIndex??null}function ee(e,n){return e.findIndex(a=>a.id===n)}function Ne(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 me(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=ee(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=Ne(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 Ye(e,n,a,r){for(let t of e.page.fragments){if(t.kind!=="image")continue;let o=ee(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 ge(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=ee(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 A=m.rows[w];if(x>=M&&x<M+A.height){b=w;break}M+=A.height;}b===-1&&(b=0);}else {let M=x-h;for(let w=o.fromRow;w<o.toRow&&w<m.rows.length;w++){let A=m.rows[w];if(M>=p&&M<p+A.height){b=w;break}p+=A.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 X,I;if(S.blocks&&S.blocks.length>0){let M=S.blocks[0],w=P.blocks[0];M.kind==="paragraph"&&w?.kind==="paragraph"&&(X=M,I=w);}let L=g-R,C=x-y;return {fragment:o,block:c,measure:m,pageIndex:e.pageIndex,rowIndex:b,colIndex:k,cellBlock:X,cellMeasure:I,cellLocalX:Math.max(0,L),cellLocalY:Math.max(0,C)}}return null}function ze(e,n,a,r){let t={pageHit:null,fragmentHit:null,tableCellHit:null};if(t.pageHit=Z(e,r),!t.pageHit)return t;let o=D(e,t.pageHit.pageIndex),s={x:r.x,y:r.y-o};return t.fragmentHit=me(t.pageHit,n,a,s),t.fragmentHit?.fragment.kind==="table"&&(t.tableCellHit=ge(t.pageHit,n,a,s)),t}function We(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 Ge(e,n){return D(e,n)}function Ve(e,n){if(n<0||n>=e.pages.length)return null;let a=D(e,n),t=e.pages[n].size?.h??e.pageSize.h;return {top:a,bottom:a+t}}function te(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function pe(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 be(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 Ue(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 $e(e,n,a,r){let{pmStart:t,pmEnd:o}=be(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=pe(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=te(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 ne(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=Ue(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}=$e(i,u,h,d);return {pmPosition:b,charOffset:p,lineIndex:f}}function xe(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 ne(o)?.pmPosition??null}function qe(e,n){if(n)return xe(n);if(!e)return null;let{fragment:a}=e;return a.kind==="paragraph"?ne(e)?.pmPosition??null:a.kind==="image"?a.pmStart??null:null}function ke(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}=be(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=pe(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=te(p),P=k(b.slice(0,F),k$1);return {x:d+P.width,lineIndex:i}}let T=te(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=ke(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 Je(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 Te(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function oe(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 Me(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=Te(i),b=k(g.slice(0,h),p);return t+b.width}let x=Te(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 Ke(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=D(e,l);for(let c of f.fragments){if(c.kind==="paragraph"){let m=oe(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=Me(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,X=B?.right??0,I=Math.max(0,c.width-R-X),L=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 A=j(h,H)-j(h,p.fromLine),v=c.x+R+w+Math.min(L,C),Y=Math.max(1,Math.abs(C-L)),z=c.y+A;i.push({x:v,y:z+u,width:Y,height:T.lineHeight,pageIndex:l});}}if(c.kind==="table"){let m=oe(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 X=b[y]??0,I=0;for(let L$1=0;L$1<B.cells.length;L$1++){let C=B.cells[L$1],M=R.cells[L$1];if(!C||!M)continue;let w=C.padding?.top??0,A=L(C.blocks,M.blocks,w);for(let v=0;v<C.blocks.length;v++){let Y=C.blocks[v],z=M.blocks[v];if(!Y||Y.kind!=="paragraph"||!z||z.kind!=="paragraph")continue;let N=Y,Le=z,Ae=A.lineTops[v]??[],De=Me(N,Le,o,s);for(let{line:_,index:ve}of De){let $=V(N,_);if($.pmStart===void 0||$.pmEnd===void 0)continue;let ie=Math.max($.pmStart,o),ae=Math.min($.pmEnd,s);if(ie>=ae)continue;let K=S(X+(Ae[ve]??0));if(K+_.lineHeight<=F||K>=P)continue;let _e=W(N,_,ie),Oe=W(N,_,ae),se=G(N,_,_e,M.width),le=G(N,_,Oe,M.width);i.push({x:p.x+I+Math.min(se,le),y:p.y+K+u,width:Math.max(1,Math.abs(le-se)),height:_.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 Qe(e,n,a,r){for(let t=0;t<e.pages.length;t++){let o=e.pages[t],s=D(e,t);for(let i of o.fragments){if(i.kind==="paragraph"){let l=oe(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 Ze(e){return e.length<=1?false:new Set(e.map(a=>a.pageIndex)).size>1}function et(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 tt(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 Fe(e){return ye(e)}function ye(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||tt(t)||n.add(a));}return e.map((a,r)=>{if(a.kind==="table")return nt(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 nt(e){let n=false,a=e.rows.map(r=>{let t=false,o=r.cells.map(s=>{let i=ye(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 ot(e){return e?.align??e?.alignment}function He(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=ot(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 we(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 rt(e){return e?e.kind==="paragraph"||e.kind==="table"?e.totalHeight:e.kind==="image"||e.kind==="textBox"?e.height:0:0}function Pe(e,n,a,r){let t=0,o=a,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=He(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),s=u;}}}return {visualTop:t,visualBottom:o}}function it(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 Se(t,n,a,r)}function Se(e,n,a,r){let t=c(e,{theme:r.theme??void 0});if(t.length===0)return;let o=Fe(t),s=r.measureBlocks(o,n),i=0,l=0;for(let c=0;c<o.length;c++){let m=rt(s[c]);i+=m,we(o[c])&&(l+=m);}let{visualTop:f,visualBottom:u}=Pe(t,s,i,a);return {blocks:o,measures:s,height:i,flowHeight:l,visualTop:f,visualBottom:u}}var J={header:null,footer:null};function at(){J.header=null,J.footer=null;}function Be(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=J[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 J[e]=u,u}function st(e,n,a=globalThis.document){let r=e.state.selection;if(!r.empty)return null;let t=r.head,o=Be(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 lt(e,n,a=globalThis.document){let r=e.state.selection;if(r.empty)return [];let t=r.from,o=r.to,s=[],i=Be(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 Re(e){return e?e.flowHeight??e.height:0}function ct(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(Re)),g=Math.max(0,...(s??[]).map(Re)),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 Ie=816,Ce=1056,U=96,re=48;function E(e){return Math.round(e/1440*96)}function ut(e){return {w:e?.pageWidth?E(e.pageWidth):Ie,h:e?.pageHeight?E(e.pageHeight):Ce}}function ft(e){return {top:e?.marginTop?E(e.marginTop):U,right:e?.marginRight?E(e.marginRight):U,bottom:e?.marginBottom?E(e.marginBottom):U,left:e?.marginLeft?E(e.marginLeft):U,header:e?.headerDistance?E(e.headerDistance):re,footer:e?.footerDistance?E(e.footerDistance):re}}function dt(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 ht(e){let n=e?.columnCount??1;if(n<=1)return;let a=E(e?.columnSpace??720);return {count:n,gap:a,equalWidth:e?.equalWidth??true,separator:e?.separator}}function Ee(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 mt(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(Ee(r[o]??n)),o<t.length&&i===t[o]&&o++;return s}export{at as A,st as B,lt as C,ct as D,Ie as E,Ce as F,U as G,re as H,E as I,ut as J,ft as K,dt as L,ht as M,Ee as N,mt as O,Z as a,D as b,Xe as c,me as d,Ye as e,ge as f,ze as g,We as h,Ge as i,Ve as j,ne as k,xe as l,qe as m,ke as n,je as o,Je as p,Ke as q,Qe as r,Ze as s,et as t,Fe as u,He as v,we as w,Pe as x,it as y,Se as z};
@@ -0,0 +1 @@
1
+ 'use strict';var T=".layout-page-content";function M(l){return Array.from(l.querySelectorAll(`${T} span[data-pm-start][data-pm-end]`))}function B(l){return Array.from(l.querySelectorAll(`${T} .layout-empty-run`))}function I(l){return Array.from(l.querySelectorAll(`${T} [data-pm-start]`))}function q(l,t){return Number.isFinite(t)?l.querySelector(`${T} [data-pm-start="${t}"]`):null}function w(l,t,s,p=1){let g=document.elementsFromPoint(t,s),f=g.find(e=>e.classList.contains("layout-page"));if(!f)return null;let r=g.find(e=>e.tagName==="SPAN"&&e.dataset.pmStart!==void 0&&e.dataset.pmEnd!==void 0);if(r)return L(r,t);let a=g.find(e=>e.classList.contains("layout-empty-run"));if(a){let e=a.closest(".layout-paragraph");if(e&&e.dataset.pmStart)return Number(e.dataset.pmStart)}let c=g.find(e=>e.classList.contains("layout-paragraph")&&e.dataset.pmStart!==void 0);if(c&&c.dataset.pmStart){let e=N(c,t,s);return e!==null?e:Number(c.dataset.pmStart)}let u=g.find(e=>e.classList.contains("layout-table-cell"));return u?N(u,t,s):R(l,f,t,s)}function L(l,t,s){let p=Number(l.dataset.pmStart),g=Number(l.dataset.pmEnd);if(l.classList.contains("layout-run-tab")){let n=l.getBoundingClientRect(),i=(n.left+n.right)/2;return t<i?p:g}let f=l.firstChild;if(!f||f.nodeType!==Node.TEXT_NODE)return p;let r=f,a=r.length;if(a===0)return p;let c=l.ownerDocument;if(!c)return p;let u=0,e=a;for(;u<e;){let n=Math.floor((u+e)/2),i=c.createRange();i.setStart(r,n),i.setEnd(r,n);let m=i.getBoundingClientRect().left;t<m?e=n:u=n+1;}if(u>0&&u<=a){let n=c.createRange();n.setStart(r,u-1),n.setEnd(r,u-1);let i=n.getBoundingClientRect();n.setStart(r,Math.min(u,a)),n.setEnd(r,Math.min(u,a));let o=n.getBoundingClientRect(),m=Math.abs(t-i.left),d=Math.abs(t-o.left);if(m<d)return p+(u-1)}return p+Math.min(u,g-p)}function N(l,t,s){let p=l.querySelector(".layout-empty-run");if(p){let n=p.closest(".layout-paragraph");if(n&&n.dataset.pmStart)return Number(n.dataset.pmStart)}let g=l.querySelectorAll(".layout-line"),f=null,r=1/0;for(let n of Array.from(g)){let i=n,o=i.getBoundingClientRect(),m=(o.top+o.bottom)/2,d=Math.abs(s-m);d<r&&(r=d,f=i);}if(!f){let n=l.querySelector(".layout-paragraph[data-pm-start]");return n?.dataset.pmStart?Number(n.dataset.pmStart):l.dataset.pmStart?Number(l.dataset.pmStart):null}let a=f.querySelectorAll("span[data-pm-start][data-pm-end]");if(a.length===0){let n=f.closest(".layout-paragraph");return n?.dataset.pmStart?Number(n.dataset.pmStart):null}let c=null,u=1/0;for(let n of Array.from(a)){let i=n,o=i.getBoundingClientRect();if(t>=o.left&&t<=o.right)return L(i,t);let m=t<o.left?o.left-t:t-o.right;m<u&&(u=m,c=i);}if(!c)return null;let e=c.getBoundingClientRect();return t<e.left?Number(c.dataset.pmStart):Number(c.dataset.pmEnd)}function R(l,t,s,p,g){if(t.querySelectorAll("span[data-pm-start][data-pm-end]").length===0){let o=t.querySelectorAll(".layout-paragraph");if(o.length>0){let m=o[0];return Number(m.dataset.pmStart)||0}return null}let r=t.querySelectorAll(".layout-line"),a=null,c=1/0;for(let o of Array.from(r)){let m=o,d=m.getBoundingClientRect(),h=(d.top+d.bottom)/2,b=Math.abs(p-h);b<c&&(c=b,a=m);}if(!a)return null;let u=a.querySelectorAll("span[data-pm-start][data-pm-end]");if(u.length===0){let o=a.closest(".layout-paragraph");return o?.dataset.pmStart?Number(o.dataset.pmStart):null}let e=null,n=1/0;for(let o of Array.from(u)){let m=o,d=m.getBoundingClientRect();if(s>=d.left&&s<=d.right)return L(m,s);let h=s<d.left?d.left-s:s-d.right;h<n&&(n=h,e=m);}if(!e)return null;let i=e.getBoundingClientRect();return s<i.left?Number(e.dataset.pmStart):Number(e.dataset.pmEnd)}var D=.5;function A(l,t){let s=l.closest(".layout-table:not(.layout-nested-table)");if(!s)return {left:t.left,top:t.top,right:t.right,bottom:t.bottom};let p=s.getBoundingClientRect(),g=Math.max(t.top,p.top),f=Math.min(t.bottom,p.bottom);return f-g<=D?null:{left:t.left,top:g,right:t.right,bottom:f}}function O(l,t,s,p){let g=[],f=M(l);for(let r of Array.from(f)){let a=r,c=Number(a.dataset.pmStart);if(Number(a.dataset.pmEnd)<=t||c>=s)continue;let e=a.closest(".layout-page"),n=e?Number(e.dataset.pageNumber||1)-1:0,i=y=>{let E=A(a,y);E&&g.push({x:E.left-p.left,y:E.top-p.top,width:E.right-E.left,height:E.bottom-E.top,pageIndex:n});};if(a.classList.contains("layout-run-tab")){i(a.getBoundingClientRect());continue}let o=null;if(a.firstChild?.nodeType===Node.TEXT_NODE?o=a.firstChild:a.firstChild?.nodeType===Node.ELEMENT_NODE&&a.firstChild.tagName==="A"&&a.firstChild.firstChild?.nodeType===Node.TEXT_NODE&&(o=a.firstChild.firstChild),!o)continue;let m=a.ownerDocument;if(!m)continue;let d=Math.max(0,t-c),h=Math.min(o.length,s-c);if(d>=h)continue;let b=m.createRange();b.setStart(o,d),b.setEnd(o,h);for(let y of Array.from(b.getClientRects()))i(y);}return g}function $(l,t,s){let p=M(l);for(let f of Array.from(p)){let r=f,a=Number(r.dataset.pmStart),c=Number(r.dataset.pmEnd);if(r.classList.contains("layout-run-tab")){if(t>=a&&t<c){let u=r.getBoundingClientRect(),e=r.closest(".layout-page"),n=e?Number(e.dataset.pageNumber||1)-1:0,i=r.closest(".layout-line"),o=i?i.offsetHeight:16;return {x:u.left-s.left,y:u.top-s.top,height:o,pageIndex:n}}continue}if(t>=a&&t<=c){let u=r.firstChild;if(!u||u.nodeType!==Node.TEXT_NODE){let E=r.getBoundingClientRect(),S=r.closest(".layout-page"),x=S?Number(S.dataset.pageNumber||1)-1:0,H=r.closest(".layout-line"),C=H?H.offsetHeight:16;return {x:E.left-s.left,y:E.top-s.top,height:C,pageIndex:x}}let e=u,n=Math.min(t-a,e.length),i=r.ownerDocument;if(!i)continue;let o=i.createRange();o.setStart(e,n),o.setEnd(e,n);let m=o.getBoundingClientRect(),d=r.closest(".layout-page"),h=d?Number(d.dataset.pageNumber||1)-1:0,b=r.closest(".layout-line"),y=b?b.offsetHeight:16;return {x:m.left-s.left,y:m.top-s.top,height:y,pageIndex:h}}}let g=l.querySelectorAll(".layout-paragraph");for(let f of Array.from(g)){let r=f,a=Number(r.dataset.pmStart),c=Number(r.dataset.pmEnd);if(t>=a&&t<=c){let e=r.querySelector(".layout-empty-run")||r,n=e.getBoundingClientRect(),i=r.closest(".layout-page"),o=i?Number(i.dataset.pageNumber||1)-1:0,d=(e.closest(".layout-line")||e).offsetHeight||16;return {x:n.left-s.left,y:n.top-s.top,height:d,pageIndex:o}}}return null}exports.a=M;exports.b=B;exports.c=I;exports.d=q;exports.e=w;exports.f=A;exports.g=O;exports.h=$;
@@ -0,0 +1 @@
1
+ 'use strict';var chunkYPQACU4A_js=require('./chunk-YPQACU4A.js'),chunkRSU4HTC6_js=require('./chunk-RSU4HTC6.js'),chunkQVRNNRG5_js=require('./chunk-QVRNNRG5.js'),chunk4Q2IP5FW_js=require('./chunk-4Q2IP5FW.js');function Z(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=D(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 D(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 Xe(e,n){return Z(e,{y:n})?.pageIndex??null}function ee(e,n){return e.findIndex(a=>a.id===n)}function Ne(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 me(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=ee(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=Ne(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 Ye(e,n,a,r){for(let t of e.page.fragments){if(t.kind!=="image")continue;let o=ee(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 ge(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=ee(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 A=m.rows[w];if(x>=M&&x<M+A.height){b=w;break}M+=A.height;}b===-1&&(b=0);}else {let M=x-h;for(let w=o.fromRow;w<o.toRow&&w<m.rows.length;w++){let A=m.rows[w];if(M>=p&&M<p+A.height){b=w;break}p+=A.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 X,I;if(S.blocks&&S.blocks.length>0){let M=S.blocks[0],w=P.blocks[0];M.kind==="paragraph"&&w?.kind==="paragraph"&&(X=M,I=w);}let L=g-R,C=x-y;return {fragment:o,block:c,measure:m,pageIndex:e.pageIndex,rowIndex:b,colIndex:k,cellBlock:X,cellMeasure:I,cellLocalX:Math.max(0,L),cellLocalY:Math.max(0,C)}}return null}function ze(e,n,a,r){let t={pageHit:null,fragmentHit:null,tableCellHit:null};if(t.pageHit=Z(e,r),!t.pageHit)return t;let o=D(e,t.pageHit.pageIndex),s={x:r.x,y:r.y-o};return t.fragmentHit=me(t.pageHit,n,a,s),t.fragmentHit?.fragment.kind==="table"&&(t.tableCellHit=ge(t.pageHit,n,a,s)),t}function We(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 Ge(e,n){return D(e,n)}function Ve(e,n){if(n<0||n>=e.pages.length)return null;let a=D(e,n),t=e.pages[n].size?.h??e.pageSize.h;return {top:a,bottom:a+t}}function te(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function pe(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 be(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 Ue(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 $e(e,n,a,r){let{pmStart:t,pmEnd:o}=be(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=pe(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=te(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 ne(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=Ue(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}=$e(i,u,h,d);return {pmPosition:b,charOffset:p,lineIndex:f}}function xe(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 ne(o)?.pmPosition??null}function qe(e,n){if(n)return xe(n);if(!e)return null;let{fragment:a}=e;return a.kind==="paragraph"?ne(e)?.pmPosition??null:a.kind==="image"?a.pmStart??null:null}function ke(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}=be(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=pe(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=te(p),P=chunkRSU4HTC6_js.k(b.slice(0,F),k);return {x:d+P.width,lineIndex:i}}let T=te(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=ke(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 Je(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 Te(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function oe(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 Me(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=Te(i),b=chunkRSU4HTC6_js.k(g.slice(0,h),p);return t+b.width}let x=Te(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 Ke(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=D(e,l);for(let c of f.fragments){if(c.kind==="paragraph"){let m=oe(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=Me(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,X=B?.right??0,I=Math.max(0,c.width-R-X),L=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 A=j(h,H)-j(h,p.fromLine),v=c.x+R+w+Math.min(L,C),Y=Math.max(1,Math.abs(C-L)),z=c.y+A;i.push({x:v,y:z+u,width:Y,height:T.lineHeight,pageIndex:l});}}if(c.kind==="table"){let m=oe(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 X=b[y]??0,I=0;for(let L=0;L<B.cells.length;L++){let C=B.cells[L],M=R.cells[L];if(!C||!M)continue;let w=C.padding?.top??0,A=chunkRSU4HTC6_js.L(C.blocks,M.blocks,w);for(let v=0;v<C.blocks.length;v++){let Y=C.blocks[v],z=M.blocks[v];if(!Y||Y.kind!=="paragraph"||!z||z.kind!=="paragraph")continue;let N=Y,Le=z,Ae=A.lineTops[v]??[],De=Me(N,Le,o,s);for(let{line:_,index:ve}of De){let $=V(N,_);if($.pmStart===void 0||$.pmEnd===void 0)continue;let ie=Math.max($.pmStart,o),ae=Math.min($.pmEnd,s);if(ie>=ae)continue;let K=S(X+(Ae[ve]??0));if(K+_.lineHeight<=F||K>=P)continue;let _e=W(N,_,ie),Oe=W(N,_,ae),se=G(N,_,_e,M.width),le=G(N,_,Oe,M.width);i.push({x:p.x+I+Math.min(se,le),y:p.y+K+u,width:Math.max(1,Math.abs(le-se)),height:_.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 Qe(e,n,a,r){for(let t=0;t<e.pages.length;t++){let o=e.pages[t],s=D(e,t);for(let i of o.fragments){if(i.kind==="paragraph"){let l=oe(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 Ze(e){return e.length<=1?false:new Set(e.map(a=>a.pageIndex)).size>1}function et(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 tt(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 Fe(e){return ye(e)}function ye(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||tt(t)||n.add(a));}return e.map((a,r)=>{if(a.kind==="table")return nt(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 nt(e){let n=false,a=e.rows.map(r=>{let t=false,o=r.cells.map(s=>{let i=ye(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 ot(e){return e?.align??e?.alignment}function He(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=ot(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 we(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 rt(e){return e?e.kind==="paragraph"||e.kind==="table"?e.totalHeight:e.kind==="image"||e.kind==="textBox"?e.height:0:0}function Pe(e,n,a,r){let t=0,o=a,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=He(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),s=u;}}}return {visualTop:t,visualBottom:o}}function it(e,n,a,r){if(!e||!e.content||e.content.length===0)return;let t=chunkQVRNNRG5_js.b(e.content,{styles:r.styles??void 0,theme:r.theme??null,defaultTabStopTwips:r.defaultTabStopTwips??null});return Se(t,n,a,r)}function Se(e,n,a,r){let t=chunkYPQACU4A_js.c(e,{theme:r.theme??void 0});if(t.length===0)return;let o=Fe(t),s=r.measureBlocks(o,n),i=0,l=0;for(let c=0;c<o.length;c++){let m=rt(s[c]);i+=m,we(o[c])&&(l+=m);}let{visualTop:f,visualBottom:u}=Pe(t,s,i,a);return {blocks:o,measures:s,height:i,flowHeight:l,visualTop:f,visualBottom:u}}var J={header:null,footer:null};function at(){J.header=null,J.footer=null;}function Be(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=J[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 J[e]=u,u}function st(e,n,a=globalThis.document){let r=e.state.selection;if(!r.empty)return null;let t=r.head,o=Be(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 lt(e,n,a=globalThis.document){let r=e.state.selection;if(r.empty)return [];let t=r.from,o=r.to,s=[],i=Be(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 Re(e){return e?e.flowHeight??e.height:0}function ct(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(Re)),g=Math.max(0,...(s??[]).map(Re)),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 Ie=816,Ce=1056,U=96,re=48;function E(e){return Math.round(e/1440*96)}function ut(e){return {w:e?.pageWidth?E(e.pageWidth):Ie,h:e?.pageHeight?E(e.pageHeight):Ce}}function ft(e){return {top:e?.marginTop?E(e.marginTop):U,right:e?.marginRight?E(e.marginRight):U,bottom:e?.marginBottom?E(e.marginBottom):U,left:e?.marginLeft?E(e.marginLeft):U,header:e?.headerDistance?E(e.headerDistance):re,footer:e?.footerDistance?E(e.footerDistance):re}}function dt(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 ht(e){let n=e?.columnCount??1;if(n<=1)return;let a=E(e?.columnSpace??720);return {count:n,gap:a,equalWidth:e?.equalWidth??true,separator:e?.separator}}function Ee(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 mt(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(Ee(r[o]??n)),o<t.length&&i===t[o]&&o++;return s}exports.A=at;exports.B=st;exports.C=lt;exports.D=ct;exports.E=Ie;exports.F=Ce;exports.G=U;exports.H=re;exports.I=E;exports.J=ut;exports.K=ft;exports.L=dt;exports.M=ht;exports.N=Ee;exports.O=mt;exports.a=Z;exports.b=D;exports.c=Xe;exports.d=me;exports.e=Ye;exports.f=ge;exports.g=ze;exports.h=We;exports.i=Ge;exports.j=Ve;exports.k=ne;exports.l=xe;exports.m=qe;exports.n=ke;exports.o=je;exports.p=Je;exports.q=Ke;exports.r=Qe;exports.s=Ze;exports.t=et;exports.u=Fe;exports.v=He;exports.w=we;exports.x=Pe;exports.y=it;exports.z=Se;
@@ -1 +1 @@
1
- import {a as a$1,c as c$1,d,b as b$1,y,I}from'./chunk-72KLR6TJ.mjs';import {b,a,c}from'./chunk-QPFJJPIC.mjs';import {e}from'./chunk-VW22RZ6C.mjs';function De(e){return !b(e.wrapType)&&e.wrapType!=="topAndBottom"}function Xe(e){return e.wrapType==="behind"}function Ne(e){return a(e.wrapType)?true:e.displayMode==="float"}function j(e){return b(e.wrapType)||e.wrapType==="topAndBottom"?false:c(e.wrapType)?true:e.displayMode==="float"&&e.cssFloat!=="none"}function je(e){return e==="left"?"right":e==="right"?"left":"bothSides"}function Ke(e){return {pageWidth:e.size.w,pageHeight:e.size.h,marginLeft:e.margins.left,marginTop:e.margins.top,contentWidth:e.size.w-e.margins.left-e.margins.right,contentHeight:e.size.h-e.margins.top-e.margins.bottom}}function qe(e,i,n,t){let{x:o,side:r}=Te(e,n,t),l=U(e,i,t);return {x:o,y:l,side:r}}function V(e,i,n){return U(e,i,n)}function Te(e$1,i,n){let t=e$1.position?.horizontal;if(!t)return e$1.cssFloat==="right"?{x:i-e$1.width,side:"right"}:{x:0,side:"left"};let o=ye(t.relativeTo,i,n);if(t.align==="right")return {x:o.size?o.base+o.size-e$1.width:0,side:"right"};if(t.align==="left")return {x:o.base,side:"left"};if(t.align==="center")return {x:o.size?o.base+(o.size-e$1.width)/2:0,side:"left"};if(t.posOffset!==void 0){let r=o.base+e(t.posOffset);return {x:r,side:r>i/2?"right":"left"}}return {x:o.base,side:"left"}}function ye(e,i,n){let t=n?.pageWidth??0,o=n?.marginLeft??0;switch(e){case "page":return {base:-o,size:t};case "leftMargin":return {base:-o,size:o};case "rightMargin":return {base:i,size:o};case "character":return {base:0,size:0};default:return {base:0,size:i}}}function U(e$1,i,n){let t=e$1.position?.vertical;if(!t)return i;let o=Fe(t.relativeTo,i,n);return t.align==="top"?o.base:t.align==="center"?o.size?o.base+(o.size-e$1.height)/2:i:t.align==="bottom"?o.size?o.base+o.size-e$1.height:i:t.posOffset!==void 0?o.base+e(t.posOffset):t.relativeTo==="paragraph"||t.relativeTo==="line"?i:o.base}function Fe(e,i,n){let t=n?.pageHeight??0,o=n?.marginTop??0,r=n?.contentHeight??0;switch(e){case "paragraph":case "line":return {base:i,size:0};case "page":return {base:-o,size:t};case "topMargin":return {base:-o,size:o};case "bottomMargin":return {base:r,size:o};default:return {base:0,size:r}}}var K=7,q=0;function Me(e,i){if(e.kind!=="paragraph"||i.kind!=="paragraph")return "totalHeight"in i?i.totalHeight:"height"in i?i.height:0;let n=e.runs.filter(u=>u.kind!=="text"||u.text.length>0);if(!(i.lines.length===1&&n.length>0&&n.every(u=>u.kind==="image")))return i.totalHeight;let o=n.reduce((u,g)=>g.kind==="image"?Math.max(u,g.height):u,0),r=e.attrs?.spacing?.before??0,l=e.attrs?.spacing?.after??0;return r+o+l}function J(e){let i=e?.borders?.top?.width??0,n=e?.borders?.bottom?.width??0;return i+n}function Q(e,i,n){let t=e.columnWidths??[],o=a$1(e.width,e.widthType,i),r=c$1(e),l=o??i;if(e.rows.length>0&&(t=d(t,r,l)),t.length>0&&o){let a=t.reduce((c,s)=>c+s,0);if(a>0&&Math.abs(a-o)>1){let c=o/a;t=t.map(s=>s*c);}}let u=new Map;for(let a of b$1(e))u.set(`${a.rowIndex}-${a.cellIndex}`,a.columnIndex);let g=e.rows.map((a,c)=>({cells:a.cells.map((s,h)=>{let d=s.colSpan??1,y=u.get(`${c}-${h}`)??0,p=0;for(let b=0;b<d&&y+b<t.length;b++)p+=t[y+b]??0;p===0&&(p=(s.width&&s.width>0?s.width:a$1(s.widthValue,s.widthType,l))??100);let M=s.padding?.left??K,P=s.padding?.right??K,T=Math.max(1,p-M-P);return {blocks:s.blocks.map(b=>n(b,T)),width:p,height:0,colSpan:s.colSpan,rowSpan:s.rowSpan}}),height:0})),m=[];for(let a=0;a<g.length;a++){let c=g[a],s=e.rows[a]?.cells,h=0,d=0;for(let P=0;P<c.cells.length;P++){let T=c.cells[P],b=s?.[P],R=0,S=0;for(let z=0;z<T.blocks.length;z++){let k=b?.blocks[z],Z=T.blocks[z];if(!k||!Z)continue;let xe=Me(k,Z),E=k.kind==="paragraph"?k.attrs?.spacing:void 0,O=E?.before??0,Y=E?.after??0;R+=Math.max(S,O)+(xe-O-Y),S=Y;}R+=S,T.height=R;let me=b?.padding?.top??q,be=b?.padding?.bottom??q;T.height+=me+be,(T.rowSpan??1)<=1&&(h=Math.max(h,T.height)),d=Math.max(d,J(b));}let y=e.rows[a],p=y?.height,M=y?.heightRule;m[a]=M==="exact"&&!!p,p&&M==="exact"?c.height=p:p?c.height=Math.max(h+d,p):c.height=h+d;}let x=g.map(a=>a.height);for(let a=0;a<g.length;a++){let c=e.rows[a]?.cells,s=g[a]?.cells;if(!(!c||!s))for(let h=0;h<c.length;h++){let d=c[h]?.rowSpan??1;if(d<=1)continue;let y=Math.min(a+d-1,g.length-1),p=(s[h]?.height??0)+J(c[h]),M=0;for(let b=a;b<=y;b++)M+=x[b]??0;let P=p-M;if(P<=0)continue;let T=y;for(;T>a&&m[T];)T--;m[T]||(g[T].height+=P);}}let f=g.reduce((a,c)=>a+c.height,0),F=t.reduce((a,c)=>a+c,0)||o||i;return {kind:"table",rows:g,columnWidths:t,totalWidth:F,totalHeight:f}}var Pe=4;function we(e,i,n,t){let o=Array.isArray(i)?i[0]??0:i,r=Ce(e,o,n,t),l=r.filter(s=>s.isMarginRelative),u=r.filter(s=>!s.isMarginRelative),g=new Map;for(let s of l){let h=g.get(s.topY)??[];h.push(s),g.set(s.topY,h);}let m=ze(u,Pe),x=[];ee(m,x),ee(Array.from(g.values()),x);let f=new Map;for(let s of x){let h=s.fullWidthBlock&&s.isMarginRelative?0:s.anchorBlockIndex,d=f.get(h)??[],{anchorBlockIndex:y,isMarginRelative:p,...M}=s;d.push(M),f.set(h,d);}let F=new Set(f.keys()),a=0,c=[];return e.map((s,h)=>{F.has(h)&&(a=0,c=f.get(h)??[]);let d=c.length>0?c:void 0,y=Array.isArray(i)?i[h]??o:i,p=n(s,y,d,a);return "totalHeight"in p&&(s.kind==="table"&&s.floating||(a+=p.totalHeight)),p})}function Ce(e,i,n,t){let o=[];for(let r=0;r<e.length;r++){let l=e[r];switch(l.kind){case "paragraph":ve(l,r,i,o);break;case "table":Ae(l,r,i,n,o);break;case "textBox":Ie(l,r,i,o,t);break}}return o}function te(e$1,i,n,t,o,r){let l=0,u=0,g=e$1?.horizontal;if(g?.align==="left")l=n+o;else if(g?.align==="right")u=n+t;else if(g?.posOffset!==void 0){let m=e(g.posOffset);m<r/2?l=m+n+o:u=r-m+t;}else i==="left"?l=n+o:i==="right"&&(u=n+t);return y(l,u,r)}function $(e){let i=e?.vertical?.relativeTo;return i==="margin"||i==="page"}function ve(e$1,i,n,t){for(let o of e$1.runs){if(o.kind!=="image")continue;let r=o;if(!j(r))continue;let l=r.distTop??0,u=r.distBottom??0,g=r.distLeft??12,m=r.distRight??12,x=0,f=r.position?.vertical;f?.align==="top"&&f.relativeTo==="margin"?x=0:f?.posOffset!==void 0&&(x=e(f.posOffset));let F=x+r.height,{leftMargin:a,rightMargin:c}=te(r.position,r.cssFloat,r.width,g,m,n);(a>0||c>0)&&t.push({leftMargin:a,rightMargin:c,topY:x-l,bottomY:F+u,anchorBlockIndex:i,isMarginRelative:$(r.position)});}}function Ae(e,i,n,t,o){let r=e.floating;if(!r)return;let l=Q(e,n,t),u=l.totalWidth,g=l.totalHeight,m=r.leftFromText??12,x=r.rightFromText??12,f=r.topFromText??0,F=r.bottomFromText??0,a=0;r.tblpX!==void 0?a=r.tblpX:r.tblpXSpec?r.tblpXSpec==="left"||r.tblpXSpec==="inside"?a=0:r.tblpXSpec==="right"||r.tblpXSpec==="outside"?a=n-u:r.tblpXSpec==="center"&&(a=(n-u)/2):e.justification==="center"?a=(n-u)/2:e.justification==="right"&&(a=n-u);let c=0,s=0;a<n/2?c=a+u+x:s=n-a+m,{leftMargin:c,rightMargin:s}=y(c,s,n);let h=r.tblpY??0,d=h+g;o.push({leftMargin:c,rightMargin:s,topY:h-f,bottomY:d+F,anchorBlockIndex:i});}function Ie(e$1,i,n,t,o){if(!I(e$1)||b(e$1.wrapType))return;let r=e$1.width??0,l=e$1.height??0;if(r<=0||l<=0)return;let u=e$1.distTop??0,g=e$1.distBottom??0,m=e$1.distLeft??12,x=e$1.distRight??12;if(e$1.wrapType==="topAndBottom"){let s=V({height:l,position:e$1.position},0,o),h=s+l+g;if(h<=0)return;t.push({leftMargin:0,rightMargin:0,topY:Math.max(0,s-u),bottomY:h,anchorBlockIndex:i,isMarginRelative:$(e$1.position),fullWidthBlock:true});return}let f=0;e$1.position?.vertical?.posOffset!==void 0&&(f=e(e$1.position.vertical.posOffset));let F=f+l,{leftMargin:a,rightMargin:c}=te(e$1.position,e$1.cssFloat,r,m,x,n);a<=0&&c<=0||t.push({leftMargin:a,rightMargin:c,topY:f-u,bottomY:F+g,anchorBlockIndex:i,isMarginRelative:$(e$1.position)});}function ze(e,i){let n=[];for(let t of e){let o=n.find(r=>r.some(l=>Math.abs(l.anchorBlockIndex-t.anchorBlockIndex)<=i&&t.topY<l.bottomY&&t.bottomY>l.topY));o?o.push(t):n.push([t]);}return n}function ee(e,i){for(let n of e){let t=Math.min(...n.map(o=>o.anchorBlockIndex));for(let o of n)i.push({...o,anchorBlockIndex:t});}}var ne=2e4,w=new Map;function ie(e,i,n){return `${e}|${i}|${n||0}`}function oe(){for(;w.size>ne;){let e=w.keys().next().value;if(e===void 0)break;w.delete(e);}}function ke(e,i,n=0){let t=ie(e,i,n),o=w.get(t);if(o!==void 0)return w.delete(t),w.set(t,o),o.width}function Be(e,i,n,t){let o=ie(e,i,n);w.set(o,{width:t}),oe();}function re(){w.clear();}function Re(e){!Number.isFinite(e)||e<=0||(ne=e,oe());}function ae(){return w.size}var Se=1e3,se=Se,C=new Map;function ce(e,i,n=false,t=false){return `${e}|${i}|${n}|${t}`}function le(){for(;C.size>se;){let e=C.keys().next().value;if(e===void 0)break;C.delete(e);}}function We(e,i,n=false,t=false){let o=ce(e,i,n,t),r=C.get(o);if(r!==void 0)return C.delete(o),C.set(o,r),r}function $e(e,i,n,t,o){let r=ce(e,i,n,t);C.set(r,o),le();}function ue(){C.clear();}function He(e){!Number.isFinite(e)||e<=0||(se=e,le());}function ge(){return C.size}var Ze=5e3,he=Ze,v=new Map;function H(e){let i=[];for(let t of e.runs)t.kind==="text"?i.push(`t:${t.text}|${t.fontFamily}|${t.fontSize}|${t.bold}|${t.italic}`):t.kind==="tab"?i.push(`tab:${t.width}`):t.kind==="image"?i.push(`img:${t.width}x${t.height}`):t.kind==="lineBreak"&&i.push("br");let n=e.attrs;if(n){n.alignment&&i.push(`align:${n.alignment}`),n.indent&&i.push(`indent:${n.indent.left}|${n.indent.right}|${n.indent.firstLine}|${n.indent.hanging}`),n.spacing&&i.push(`spacing:${n.spacing.before}|${n.spacing.after}|${n.spacing.line}|${n.spacing.lineRule}`),n.defaultFontSize!=null&&i.push(`dfs:${n.defaultFontSize}`),n.defaultFontFamily!=null&&i.push(`dff:${n.defaultFontFamily}`);let t=n.borders;if(t){let o=r=>r?`${r.width??""},${r.style??""},${r.color??""}`:"";i.push(`bdr:${o(t.top)}|${o(t.bottom)}|${o(t.left)}|${o(t.right)}`);}n.suppressEmptyParagraphHeight&&i.push("sup"),n.pPrIns&&i.push(`pins:${n.pPrIns.revisionId}`),n.pPrDel&&i.push(`pdel:${n.pPrDel.revisionId}`);}return i.join("||")}function pe(){for(;v.size>he;){let e=v.keys().next().value;if(e===void 0)break;v.delete(e);}}function Ee(e,i){let n=H(e),t=v.get(n);if(t!==void 0&&t.maxWidth===i)return v.delete(n),v.set(n,t),t.measure}function Oe(e,i,n){let t=H(e);v.set(t,{measure:n,maxWidth:i}),pe();}function fe(){v.clear();}function Ye(e){!Number.isFinite(e)||e<=0||(he=e,pe());}function de(){return v.size}function Le(){re(),ue(),fe();}function Ge(){return ae()+ge()+de()}export{de as A,Le as B,Ge as C,De as a,Xe as b,Ne as c,j as d,je as e,Ke as f,qe as g,V as h,Me as i,Q as j,we as k,ke as l,Be as m,re as n,Re as o,ae as p,We as q,$e as r,ue as s,He as t,ge as u,H as v,Ee as w,Oe as x,fe as y,Ye as z};
1
+ import {a as a$1,c as c$1,d,b as b$1,y,I}from'./chunk-JHTURDPX.mjs';import {b,a,c}from'./chunk-QPFJJPIC.mjs';import {e}from'./chunk-VW22RZ6C.mjs';function De(e){return !b(e.wrapType)&&e.wrapType!=="topAndBottom"}function Xe(e){return e.wrapType==="behind"}function Ne(e){return a(e.wrapType)?true:e.displayMode==="float"}function j(e){return b(e.wrapType)||e.wrapType==="topAndBottom"?false:c(e.wrapType)?true:e.displayMode==="float"&&e.cssFloat!=="none"}function je(e){return e==="left"?"right":e==="right"?"left":"bothSides"}function Ke(e){return {pageWidth:e.size.w,pageHeight:e.size.h,marginLeft:e.margins.left,marginTop:e.margins.top,contentWidth:e.size.w-e.margins.left-e.margins.right,contentHeight:e.size.h-e.margins.top-e.margins.bottom}}function qe(e,i,n,t){let{x:o,side:r}=Te(e,n,t),l=U(e,i,t);return {x:o,y:l,side:r}}function V(e,i,n){return U(e,i,n)}function Te(e$1,i,n){let t=e$1.position?.horizontal;if(!t)return e$1.cssFloat==="right"?{x:i-e$1.width,side:"right"}:{x:0,side:"left"};let o=ye(t.relativeTo,i,n);if(t.align==="right")return {x:o.size?o.base+o.size-e$1.width:0,side:"right"};if(t.align==="left")return {x:o.base,side:"left"};if(t.align==="center")return {x:o.size?o.base+(o.size-e$1.width)/2:0,side:"left"};if(t.posOffset!==void 0){let r=o.base+e(t.posOffset);return {x:r,side:r>i/2?"right":"left"}}return {x:o.base,side:"left"}}function ye(e,i,n){let t=n?.pageWidth??0,o=n?.marginLeft??0;switch(e){case "page":return {base:-o,size:t};case "leftMargin":return {base:-o,size:o};case "rightMargin":return {base:i,size:o};case "character":return {base:0,size:0};default:return {base:0,size:i}}}function U(e$1,i,n){let t=e$1.position?.vertical;if(!t)return i;let o=Fe(t.relativeTo,i,n);return t.align==="top"?o.base:t.align==="center"?o.size?o.base+(o.size-e$1.height)/2:i:t.align==="bottom"?o.size?o.base+o.size-e$1.height:i:t.posOffset!==void 0?o.base+e(t.posOffset):t.relativeTo==="paragraph"||t.relativeTo==="line"?i:o.base}function Fe(e,i,n){let t=n?.pageHeight??0,o=n?.marginTop??0,r=n?.contentHeight??0;switch(e){case "paragraph":case "line":return {base:i,size:0};case "page":return {base:-o,size:t};case "topMargin":return {base:-o,size:o};case "bottomMargin":return {base:r,size:o};default:return {base:0,size:r}}}var K=7,q=0;function Me(e,i){if(e.kind!=="paragraph"||i.kind!=="paragraph")return "totalHeight"in i?i.totalHeight:"height"in i?i.height:0;let n=e.runs.filter(u=>u.kind!=="text"||u.text.length>0);if(!(i.lines.length===1&&n.length>0&&n.every(u=>u.kind==="image")))return i.totalHeight;let o=n.reduce((u,g)=>g.kind==="image"?Math.max(u,g.height):u,0),r=e.attrs?.spacing?.before??0,l=e.attrs?.spacing?.after??0;return r+o+l}function J(e){let i=e?.borders?.top?.width??0,n=e?.borders?.bottom?.width??0;return i+n}function Q(e,i,n){let t=e.columnWidths??[],o=a$1(e.width,e.widthType,i),r=c$1(e),l=o??i;if(e.rows.length>0&&(t=d(t,r,l)),t.length>0&&o){let a=t.reduce((c,s)=>c+s,0);if(a>0&&Math.abs(a-o)>1){let c=o/a;t=t.map(s=>s*c);}}let u=new Map;for(let a of b$1(e))u.set(`${a.rowIndex}-${a.cellIndex}`,a.columnIndex);let g=e.rows.map((a,c)=>({cells:a.cells.map((s,h)=>{let d=s.colSpan??1,y=u.get(`${c}-${h}`)??0,p=0;for(let b=0;b<d&&y+b<t.length;b++)p+=t[y+b]??0;p===0&&(p=(s.width&&s.width>0?s.width:a$1(s.widthValue,s.widthType,l))??100);let M=s.padding?.left??K,P=s.padding?.right??K,T=Math.max(1,p-M-P);return {blocks:s.blocks.map(b=>n(b,T)),width:p,height:0,colSpan:s.colSpan,rowSpan:s.rowSpan}}),height:0})),m=[];for(let a=0;a<g.length;a++){let c=g[a],s=e.rows[a]?.cells,h=0,d=0;for(let P=0;P<c.cells.length;P++){let T=c.cells[P],b=s?.[P],R=0,S=0;for(let z=0;z<T.blocks.length;z++){let k=b?.blocks[z],Z=T.blocks[z];if(!k||!Z)continue;let xe=Me(k,Z),E=k.kind==="paragraph"?k.attrs?.spacing:void 0,O=E?.before??0,Y=E?.after??0;R+=Math.max(S,O)+(xe-O-Y),S=Y;}R+=S,T.height=R;let me=b?.padding?.top??q,be=b?.padding?.bottom??q;T.height+=me+be,(T.rowSpan??1)<=1&&(h=Math.max(h,T.height)),d=Math.max(d,J(b));}let y=e.rows[a],p=y?.height,M=y?.heightRule;m[a]=M==="exact"&&!!p,p&&M==="exact"?c.height=p:p?c.height=Math.max(h+d,p):c.height=h+d;}let x=g.map(a=>a.height);for(let a=0;a<g.length;a++){let c=e.rows[a]?.cells,s=g[a]?.cells;if(!(!c||!s))for(let h=0;h<c.length;h++){let d=c[h]?.rowSpan??1;if(d<=1)continue;let y=Math.min(a+d-1,g.length-1),p=(s[h]?.height??0)+J(c[h]),M=0;for(let b=a;b<=y;b++)M+=x[b]??0;let P=p-M;if(P<=0)continue;let T=y;for(;T>a&&m[T];)T--;m[T]||(g[T].height+=P);}}let f=g.reduce((a,c)=>a+c.height,0),F=t.reduce((a,c)=>a+c,0)||o||i;return {kind:"table",rows:g,columnWidths:t,totalWidth:F,totalHeight:f}}var Pe=4;function we(e,i,n,t){let o=Array.isArray(i)?i[0]??0:i,r=Ce(e,o,n,t),l=r.filter(s=>s.isMarginRelative),u=r.filter(s=>!s.isMarginRelative),g=new Map;for(let s of l){let h=g.get(s.topY)??[];h.push(s),g.set(s.topY,h);}let m=ze(u,Pe),x=[];ee(m,x),ee(Array.from(g.values()),x);let f=new Map;for(let s of x){let h=s.fullWidthBlock&&s.isMarginRelative?0:s.anchorBlockIndex,d=f.get(h)??[],{anchorBlockIndex:y,isMarginRelative:p,...M}=s;d.push(M),f.set(h,d);}let F=new Set(f.keys()),a=0,c=[];return e.map((s,h)=>{F.has(h)&&(a=0,c=f.get(h)??[]);let d=c.length>0?c:void 0,y=Array.isArray(i)?i[h]??o:i,p=n(s,y,d,a);return "totalHeight"in p&&(s.kind==="table"&&s.floating||(a+=p.totalHeight)),p})}function Ce(e,i,n,t){let o=[];for(let r=0;r<e.length;r++){let l=e[r];switch(l.kind){case "paragraph":ve(l,r,i,o);break;case "table":Ae(l,r,i,n,o);break;case "textBox":Ie(l,r,i,o,t);break}}return o}function te(e$1,i,n,t,o,r){let l=0,u=0,g=e$1?.horizontal;if(g?.align==="left")l=n+o;else if(g?.align==="right")u=n+t;else if(g?.posOffset!==void 0){let m=e(g.posOffset);m<r/2?l=m+n+o:u=r-m+t;}else i==="left"?l=n+o:i==="right"&&(u=n+t);return y(l,u,r)}function $(e){let i=e?.vertical?.relativeTo;return i==="margin"||i==="page"}function ve(e$1,i,n,t){for(let o of e$1.runs){if(o.kind!=="image")continue;let r=o;if(!j(r))continue;let l=r.distTop??0,u=r.distBottom??0,g=r.distLeft??12,m=r.distRight??12,x=0,f=r.position?.vertical;f?.align==="top"&&f.relativeTo==="margin"?x=0:f?.posOffset!==void 0&&(x=e(f.posOffset));let F=x+r.height,{leftMargin:a,rightMargin:c}=te(r.position,r.cssFloat,r.width,g,m,n);(a>0||c>0)&&t.push({leftMargin:a,rightMargin:c,topY:x-l,bottomY:F+u,anchorBlockIndex:i,isMarginRelative:$(r.position)});}}function Ae(e,i,n,t,o){let r=e.floating;if(!r)return;let l=Q(e,n,t),u=l.totalWidth,g=l.totalHeight,m=r.leftFromText??12,x=r.rightFromText??12,f=r.topFromText??0,F=r.bottomFromText??0,a=0;r.tblpX!==void 0?a=r.tblpX:r.tblpXSpec?r.tblpXSpec==="left"||r.tblpXSpec==="inside"?a=0:r.tblpXSpec==="right"||r.tblpXSpec==="outside"?a=n-u:r.tblpXSpec==="center"&&(a=(n-u)/2):e.justification==="center"?a=(n-u)/2:e.justification==="right"&&(a=n-u);let c=0,s=0;a<n/2?c=a+u+x:s=n-a+m,{leftMargin:c,rightMargin:s}=y(c,s,n);let h=r.tblpY??0,d=h+g;o.push({leftMargin:c,rightMargin:s,topY:h-f,bottomY:d+F,anchorBlockIndex:i});}function Ie(e$1,i,n,t,o){if(!I(e$1)||b(e$1.wrapType))return;let r=e$1.width??0,l=e$1.height??0;if(r<=0||l<=0)return;let u=e$1.distTop??0,g=e$1.distBottom??0,m=e$1.distLeft??12,x=e$1.distRight??12;if(e$1.wrapType==="topAndBottom"){let s=V({height:l,position:e$1.position},0,o),h=s+l+g;if(h<=0)return;t.push({leftMargin:0,rightMargin:0,topY:Math.max(0,s-u),bottomY:h,anchorBlockIndex:i,isMarginRelative:$(e$1.position),fullWidthBlock:true});return}let f=0;e$1.position?.vertical?.posOffset!==void 0&&(f=e(e$1.position.vertical.posOffset));let F=f+l,{leftMargin:a,rightMargin:c}=te(e$1.position,e$1.cssFloat,r,m,x,n);a<=0&&c<=0||t.push({leftMargin:a,rightMargin:c,topY:f-u,bottomY:F+g,anchorBlockIndex:i,isMarginRelative:$(e$1.position)});}function ze(e,i){let n=[];for(let t of e){let o=n.find(r=>r.some(l=>Math.abs(l.anchorBlockIndex-t.anchorBlockIndex)<=i&&t.topY<l.bottomY&&t.bottomY>l.topY));o?o.push(t):n.push([t]);}return n}function ee(e,i){for(let n of e){let t=Math.min(...n.map(o=>o.anchorBlockIndex));for(let o of n)i.push({...o,anchorBlockIndex:t});}}var ne=2e4,w=new Map;function ie(e,i,n){return `${e}|${i}|${n||0}`}function oe(){for(;w.size>ne;){let e=w.keys().next().value;if(e===void 0)break;w.delete(e);}}function ke(e,i,n=0){let t=ie(e,i,n),o=w.get(t);if(o!==void 0)return w.delete(t),w.set(t,o),o.width}function Be(e,i,n,t){let o=ie(e,i,n);w.set(o,{width:t}),oe();}function re(){w.clear();}function Re(e){!Number.isFinite(e)||e<=0||(ne=e,oe());}function ae(){return w.size}var Se=1e3,se=Se,C=new Map;function ce(e,i,n=false,t=false){return `${e}|${i}|${n}|${t}`}function le(){for(;C.size>se;){let e=C.keys().next().value;if(e===void 0)break;C.delete(e);}}function We(e,i,n=false,t=false){let o=ce(e,i,n,t),r=C.get(o);if(r!==void 0)return C.delete(o),C.set(o,r),r}function $e(e,i,n,t,o){let r=ce(e,i,n,t);C.set(r,o),le();}function ue(){C.clear();}function He(e){!Number.isFinite(e)||e<=0||(se=e,le());}function ge(){return C.size}var Ze=5e3,he=Ze,v=new Map;function H(e){let i=[];for(let t of e.runs)t.kind==="text"?i.push(`t:${t.text}|${t.fontFamily}|${t.fontSize}|${t.bold}|${t.italic}`):t.kind==="tab"?i.push(`tab:${t.width}`):t.kind==="image"?i.push(`img:${t.width}x${t.height}`):t.kind==="lineBreak"&&i.push("br");let n=e.attrs;if(n){n.alignment&&i.push(`align:${n.alignment}`),n.indent&&i.push(`indent:${n.indent.left}|${n.indent.right}|${n.indent.firstLine}|${n.indent.hanging}`),n.spacing&&i.push(`spacing:${n.spacing.before}|${n.spacing.after}|${n.spacing.line}|${n.spacing.lineRule}`),n.defaultFontSize!=null&&i.push(`dfs:${n.defaultFontSize}`),n.defaultFontFamily!=null&&i.push(`dff:${n.defaultFontFamily}`);let t=n.borders;if(t){let o=r=>r?`${r.width??""},${r.style??""},${r.color??""}`:"";i.push(`bdr:${o(t.top)}|${o(t.bottom)}|${o(t.left)}|${o(t.right)}`);}n.suppressEmptyParagraphHeight&&i.push("sup"),n.pPrIns&&i.push(`pins:${n.pPrIns.revisionId}`),n.pPrDel&&i.push(`pdel:${n.pPrDel.revisionId}`);}return i.join("||")}function pe(){for(;v.size>he;){let e=v.keys().next().value;if(e===void 0)break;v.delete(e);}}function Ee(e,i){let n=H(e),t=v.get(n);if(t!==void 0&&t.maxWidth===i)return v.delete(n),v.set(n,t),t.measure}function Oe(e,i,n){let t=H(e);v.set(t,{measure:n,maxWidth:i}),pe();}function fe(){v.clear();}function Ye(e){!Number.isFinite(e)||e<=0||(he=e,pe());}function de(){return v.size}function Le(){re(),ue(),fe();}function Ge(){return ae()+ge()+de()}export{de as A,Le as B,Ge as C,De as a,Xe as b,Ne as c,j as d,je as e,Ke as f,qe as g,V as h,Me as i,Q as j,we as k,ke as l,Be as m,re as n,Re as o,ae as p,We as q,$e as r,ue as s,He as t,ge as u,H as v,Ee as w,Oe as x,fe as y,Ye as z};
@@ -0,0 +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;
@@ -0,0 +1 @@
1
+ import {c,a as a$1,b as b$1}from'./chunk-FCJWLEKT.mjs';import {a as a$2,b}from'./chunk-7E5VBRDL.mjs';import {p}from'./chunk-3G44SFHX.mjs';import {a,b as b$2,o}from'./chunk-67LVRQIR.mjs';import {i,j as j$1,k}from'./chunk-VW22RZ6C.mjs';function F(e,a$2){let i={};for(let t of e)switch(t.type.name){case "bold":i.bold=true;break;case "italic":i.italic=true;break;case "underline":{let n=t.attrs;if(n.style||n.color){let r=n.color?a(n.color,a$2):void 0;i.underline={style:n.style,color:r};}else i.underline=true;break}case "strike":i.strike=true;break;case "textColor":{let n=t.attrs;(n.themeColor||n.rgb)&&(i.color=a({rgb:n.rgb,themeColor:n.themeColor,themeTint:n.themeTint,themeShade:n.themeShade},a$2));break}case "highlight":i.highlight=o(t.attrs.color);break;case "fontSize":{let n=t.attrs;i.fontSize=n.size/2;break}case "fontFamily":{let n=t.attrs;i.fontFamily=n.ascii||n.hAnsi;break}case "characterSpacing":{let n=t.attrs;n.spacing!=null&&n.spacing!==0&&(i.letterSpacing=a$1(n.spacing)),n.position!=null&&n.position!==0&&(i.positionPx=j$1(n.position)),n.scale!=null&&n.scale!==100&&(i.horizontalScale=n.scale),n.kerning!=null&&n.kerning>0&&(i.kerningMinPt=k(n.kerning));break}case "allCaps":i.allCaps=true;break;case "smallCaps":i.smallCaps=true;break;case "emboss":i.emboss=true;break;case "imprint":i.imprint=true;break;case "textShadow":i.textShadow=true;break;case "textOutline":i.textOutline=true;break;case "hidden":i.hidden=true;break;case "rtl":i.rtl=true;break;case "textEffect":{let n=t.attrs.effect;(n==="blinkBackground"||n==="lights"||n==="antsBlack"||n==="antsRed"||n==="shimmer"||n==="sparkle")&&(i.textEffect=n);break}case "emphasisMark":{let n=t.attrs.type;n==="dot"||n==="comma"||n==="circle"||n==="underDot"?i.emphasisMark=n:i.emphasisMark="dot";break}case "superscript":i.superscript=true;break;case "subscript":i.subscript=true;break;case "hyperlink":{let n=t.attrs;i.hyperlink={href:n.href,tooltip:n.tooltip};break}case "footnoteRef":{let n=t.attrs,r=typeof n.id=="string"?parseInt(n.id,10):n.id;n.noteType==="endnote"?i.endnoteRefId=r:i.footnoteRefId=r;break}case "comment":{let n=t.attrs.commentId;n&&(i.commentIds||(i.commentIds=[]),i.commentIds.push(n));break}case "insertion":i.isInsertion=true,i.changeAuthor=t.attrs.author,i.changeDate=t.attrs.date,i.changeRevisionId=t.attrs.revisionId;break;case "deletion":i.isDeletion=true,i.changeAuthor=t.attrs.author,i.changeDate=t.attrs.date,i.changeRevisionId=t.attrs.revisionId;break}return i}function _(e){let a=e.defaultTextFormatting;if(!a)return {};let i={};if(a.fontFamily){let t=a.fontFamily.ascii||a.fontFamily.hAnsi;t&&(i.fontFamily=t);}return a.fontSize!=null&&(i.fontSize=a.fontSize/2),i}function E(e){e.hyperlink&&(e.hyperlink={...e.hyperlink,noDefaultStyle:true},delete e.color,delete e.underline);}function L(e,a,i){let t=[],n=a+1,r=i.theme,s=_(e.attrs),m=e.attrs.styleId,c=typeof m=="string"&&/^TOC\d*$/i.test(m);function g(d,f){if(d.isText&&d.text){let o=F(d.marks,r);c&&E(o);let u={kind:"text",text:d.text,...s,...o,pmStart:f,pmEnd:f+d.nodeSize};t.push(u);}else if(d.type.name==="hardBreak")t.push({kind:"lineBreak",pmStart:f,pmEnd:f+d.nodeSize});else if(d.type.name==="tab"){let o=F(d.marks,r),u={kind:"tab",...s,...o,pmStart:f,pmEnd:f+d.nodeSize};t.push(u);}else if(d.type.name==="image"){let o=d.attrs,u=b$1(o.width||100,o.height||100,i.pageContentHeight),l=F(d.marks,r),b={kind:"image",src:o.src,width:u.width,height:u.height,alt:o.alt,transform:o.transform,wrapType:o.wrapType,displayMode:o.displayMode,cssFloat:o.cssFloat,distTop:o.distTop,distBottom:o.distBottom,distLeft:o.distLeft,distRight:o.distRight,position:o.position,cropTop:o.cropTop,cropRight:o.cropRight,cropBottom:o.cropBottom,cropLeft:o.cropLeft,opacity:o.opacity,isInsertion:l.isInsertion,isDeletion:l.isDeletion,changeAuthor:l.changeAuthor,changeDate:l.changeDate,changeRevisionId:l.changeRevisionId,pmStart:f,pmEnd:f+d.nodeSize};t.push(b);}else if(d.type.name==="field"){let o=d.attrs.fieldType,u=o==="PAGE"?"PAGE":o==="NUMPAGES"?"NUMPAGES":o==="DATE"?"DATE":o==="TIME"?"TIME":"OTHER",l=F(d.marks,r);c&&E(l),t.push({kind:"field",fieldType:u,fallback:d.attrs.displayText||"",...s,...l,pmStart:f,pmEnd:f+d.nodeSize});}else if(d.type.name==="math"){let o=d.attrs.plainText||"[equation]";t.push({kind:"text",text:o,italic:true,fontFamily:"Cambria Math",pmStart:f,pmEnd:f+d.nodeSize});}else if(d.type.name==="sdt"){let o=f+1;d.forEach((u,l)=>{g(u,o+l);});}}return e.forEach((d,f)=>{g(d,n+f);}),t}function U(e){return Math.max(1,Math.round(e/8*1.333))}var G={single:"solid",double:"double",dotted:"dotted",dashed:"dashed",thick:"solid",dashSmallGap:"dashed",dotDash:"dashed",dotDotDash:"dotted",triple:"double",wave:"solid",doubleWave:"double",threeDEmboss:"ridge",threeDEngrave:"groove",outset:"outset",inset:"inset"};function B(e,a$1){if(!e||!e.style||e.style==="none"||e.style==="nil")return;let i$1={style:G[e.style]||"solid",width:U(e.size??0),color:e.color?a(e.color,a$1):"#000000"};return e.space!==void 0&&(i$1.space=i(e.space)),i$1}function D(e,a){let i=e.borders;if(!i)return;let t={},n=["top","bottom","left","right"];for(let r of n){let s=i[r],m=s?B(s,a):void 0;t[r]=m??{width:0,style:"none"};}return Object.keys(t).length>0?t:void 0}function $(e,a){let i=[];for(let t=0;t<=a;t+=1){let n=e[t]??0;if(n<=0)break;i.push(n);}return i.length===0?"1.":`${i.join(".")}.`}var Y=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function N(e,a){if(e<=0)return "";let i=e,t="";for(let[n,r]of Y)for(;i>=n;)t+=r,i-=n;return a?t:t.toLowerCase()}function O(e,a){if(e<=0)return "";let i=e,t="";for(;i>0;){let n=(i-1)%26;t=String.fromCharCode(65+n)+t,i=Math.floor((i-1)/26);}return a?t:t.toLowerCase()}function j(e,a){if(e<=0)return "";switch(a){case "upperRoman":return N(e,true);case "lowerRoman":return N(e,false);case "upperLetter":return O(e,true);case "lowerLetter":return O(e,false);case "decimalZero":return e<10?`0${e}`:String(e);case "none":return "";default:return String(e)}}function H(e,a,i){return e.replace(/%(\d)([.):\]])?/g,(t,n,r="")=>{let s=parseInt(n,10)-1;if(s<0)return "";let m=a[s]??0,c=i?.[s]??"decimal",g=j(m,c);return g?g+r:""})}function X(e,a,i){let t=e.numPr;if(!t)return null;let n=t.numId;if(n==null||n===0)return null;if(e.listIsBullet)return p(e.listMarker||"");let r=t.ilvl??0;if((e.listLevelNumFmts?.[r]??e.listNumFmt)==="none")return e.listMarker?e.listMarker:null;let m=e.listAbstractNumId??n,c=a.get(m)??new Array(9).fill(0),g=`${n}:${r}`;i.has(g)||(i.add(g),e.listStartOverride!=null&&(c[r]=e.listStartOverride-1)),c[r]=(c[r]??0)+1;for(let d=r+1;d<c.length;d+=1)c[d]=0;return a.set(m,c),e.listMarker&&e.listMarker.includes("%")?H(e.listMarker,c,e.listLevelNumFmts??void 0):e.listMarker?e.listMarker:$(c,r)}var V="Calibri",q=11;function K(e,a,i,t,n){let r={};if(e.alignment){let o=e.alignment;o==="both"||o==="distribute"?r.alignment="justify":o==="left"?r.alignment="left":o==="center"?r.alignment="center":o==="right"&&(r.alignment="right");}(e.spaceBefore!=null||e.spaceAfter!=null||e.lineSpacing!=null)&&(r.spacing={},e.spaceBefore!=null&&(r.spacing.before=a$1(e.spaceBefore)),e.spaceAfter!=null&&(r.spacing.after=a$1(e.spaceAfter)),e.lineSpacing!=null&&(e.lineSpacingRule==="exact"||e.lineSpacingRule==="atLeast"?(r.spacing.line=a$1(e.lineSpacing),r.spacing.lineUnit="px",r.spacing.lineRule=e.lineSpacingRule):(r.spacing.line=e.lineSpacing/240,r.spacing.lineUnit="multiplier",r.spacing.lineRule="auto"))),e.spacingExplicit&&(r.spacingExplicit=e.spacingExplicit);let s=e.indentLeft,m=e.indentFirstLine,c=e.hangingIndent;if(e.numPr?.numId&&s==null&&(s=((e.numPr.ilvl??0)+1)*720,m==null&&(m=-360,c=true)),(s!=null||e.indentRight!=null||m!=null)&&(r.indent={},s!=null&&(r.indent.left=a$1(s)),e.indentRight!=null&&(r.indent.right=a$1(e.indentRight)),m!=null&&(c?r.indent.hanging=Math.abs(a$1(m)):r.indent.firstLine=a$1(m))),e.styleId&&(r.styleId=e.styleId),e.borders){let o=e.borders;r.borders={};let u=l=>l?B(l,a):void 0;o.top&&(r.borders.top=u(o.top)),o.bottom&&(r.borders.bottom=u(o.bottom)),o.left&&(r.borders.left=u(o.left)),o.right&&(r.borders.right=u(o.right)),o.between&&(r.borders.between=u(o.between)),o.bar&&(r.borders.bar=u(o.bar)),!r.borders.top&&!r.borders.bottom&&!r.borders.left&&!r.borders.right&&!r.borders.between&&!r.borders.bar&&delete r.borders;}let g=b$2(e.shading?.fill,a);g&&(r.shading=`#${g}`),e.tabs&&e.tabs.length>0&&(r.tabs=e.tabs.map(o=>({val:Z(o.alignment),pos:o.position,leader:o.leader}))),e.pageBreakBefore&&(r.pageBreakBefore=true),e.keepNext&&(r.keepNext=true),e.keepLines&&(r.keepLines=true),e.contextualSpacing&&(r.contextualSpacing=true),e.bidi&&(r.bidi=true),e.styleId&&(r.styleId=e.styleId),e.numPr&&(r.numPr={numId:e.numPr.numId,ilvl:e.numPr.ilvl});let d=i&&t?X(e,i,t):null;d!=null?r.listMarker=d:e.listMarker&&(r.listMarker=e.listMarker),e.listIsBullet!=null&&(r.listIsBullet=e.listIsBullet),e.listMarkerHidden&&(r.listMarkerHidden=true),e.listMarkerFontFamily&&(r.listMarkerFontFamily=e.listMarkerFontFamily),e.listMarkerFontSize&&(r.listMarkerFontSize=e.listMarkerFontSize),e.listMarkerSuffix&&(r.listMarkerSuffix=e.listMarkerSuffix),n!==void 0&&(r.defaultTabStopTwips=n);let f=e.defaultTextFormatting;if(f&&(f.fontSize!=null&&(r.defaultFontSize=f.fontSize/2),f.fontFamily&&(r.defaultFontFamily=f.fontFamily.ascii||f.fontFamily.hAnsi)),e.pPrIns&&(r.pPrIns=e.pPrIns),e.pPrDel&&(r.pPrDel=e.pPrDel),e.numPr){let o=e.pPrChange,u=Array.isArray(o)&&o.some(l=>!l?.previousFormatting?.numPr);e.pPrDel?r.listMarkerRevision="del":(e.pPrIns||u)&&(r.listMarkerRevision="ins");}return r}function Z(e){switch(e){case "left":return "start";case "right":return "end";case "center":return "center";case "decimal":return "decimal";case "bar":return "bar";case "clear":return "clear";case "num":return "start";default:return "start"}}function w(e,a,i){let t=e.attrs,n=L(e,a,i),r=K(t,i.theme,i.listCounters,i.listSeenNumIds,i.defaultTabStopTwips);return {kind:"paragraph",id:c(),runs:n,attrs:r,pmStart:a,pmEnd:a+e.nodeSize}}function J(e,a,i,t){let n=[],r=a+1;e.forEach(l=>{l.type.name==="paragraph"?n.push(w(l,r,i)):l.type.name==="table"&&n.push(W(l,r,i)),r+=l.nodeSize;});let s=e.attrs,m=s.width,c$1=s.widthType,g=m&&(!c$1||c$1==="dxa"||c$1==="auto")?a$1(m):void 0,d=s.margins,f=(l,b)=>{if(l!=null){let h=a$1(l);if(h>0)return h}if(b!=null){let h=a$1(b);if(h>=0)return h}return 0},o={top:f(d?.top,t?.top),right:f(d?.right,t?.right),bottom:f(d?.bottom,t?.bottom),left:f(d?.left,t?.left)},u=s.cellMarker;return {id:c(),blocks:n,colSpan:s.colspan,rowSpan:s.rowspan,width:g,widthValue:m,widthType:c$1,verticalAlign:s.verticalAlign,background:s.backgroundColor?`#${s.backgroundColor}`:void 0,borders:D(s,i.theme),padding:o,noWrap:s.noWrap||void 0,trackedMarker:u??void 0}}function Q(e,a,i,t){let n=[],r=a+1;e.forEach(c=>{(c.type.name==="tableCell"||c.type.name==="tableHeader")&&n.push(J(c,r,i,t)),r+=c.nodeSize;});let s=e.attrs,m=s._originalFormatting;return {id:c(),cells:n,height:s.height?a$1(s.height):void 0,heightRule:s.heightRule??void 0,isHeader:s.isHeader,cantSplit:m?.cantSplit||void 0,trackedIns:s.trIns??void 0,trackedDel:s.trDel??void 0}}function W(e,a,i){let t=[],n=a+1,r=e.attrs.cellMargins;e.forEach(b=>{b.type.name==="tableRow"&&t.push(Q(b,n,i,r)),n+=b.nodeSize;});let m=e.attrs.columnWidths?.map(a$1),c$1=e.attrs.width,g=e.attrs.widthType;if(!m&&t.length>0){let h=t[0].cells.map(k=>k.width);h.every(k=>k!==void 0&&k>0)&&(m=h);}let d=e.attrs.justification,f=e.attrs._originalFormatting,o=f?.indent?.value&&f.indent.type==="dxa"?a$1(f.indent.value):void 0,u=e.attrs.floating,l=u?{horzAnchor:u.horzAnchor,vertAnchor:u.vertAnchor,tblpX:u.tblpX!==void 0?a$1(u.tblpX):void 0,tblpXSpec:u.tblpXSpec,tblpY:u.tblpY!==void 0?a$1(u.tblpY):void 0,tblpYSpec:u.tblpYSpec,topFromText:u.topFromText!==void 0?a$1(u.topFromText):void 0,bottomFromText:u.bottomFromText!==void 0?a$1(u.bottomFromText):void 0,leftFromText:u.leftFromText!==void 0?a$1(u.leftFromText):void 0,rightFromText:u.rightFromText!==void 0?a$1(u.rightFromText):void 0}:void 0;return {kind:"table",id:c(),rows:t,columnWidths:m,width:c$1,widthType:g,justification:d,indent:o,floating:l,pmStart:a,pmEnd:a+e.nodeSize}}function A(e,a,i){let t=e.attrs,n=t.wrapType,r=n==="behind"||n==="inFront",s=b$1(t.width||100,t.height||100,i);return {kind:"image",id:c(),src:t.src,width:s.width,height:s.height,alt:t.alt,transform:t.transform,anchor:r?{isAnchored:true,offsetH:t.distLeft,offsetV:t.distTop,behindDoc:n==="behind"}:void 0,hlinkHref:t.hlinkHref,pmStart:a,pmEnd:a+e.nodeSize}}function ee(e,a,i){let t=e.attrs,n=[];return e.forEach((r,s)=>{if(r.type.name==="paragraph"){let m=w(r,a+1+s,i);n.push(m);}}),{kind:"textBox",id:c(),width:t.width??b,height:t.height??void 0,fillColor:t.fillColor,outlineWidth:t.outlineWidth,outlineColor:t.outlineColor,outlineStyle:t.outlineStyle,margins:{top:t.marginTop??a$2.top,bottom:t.marginBottom??a$2.bottom,left:t.marginLeft??a$2.left,right:t.marginRight??a$2.right},content:n,displayMode:t.displayMode,cssFloat:t.cssFloat,wrapType:t.wrapType,wrapText:t.wrapText,anchorTarget:t.anchorTarget,position:t.position,distTop:t.distTop,distBottom:t.distBottom,distLeft:t.distLeft,distRight:t.distRight,pmStart:a,pmEnd:a+e.nodeSize}}function he(e,a={}){let i=e.attrs?.defaultTabStopTwips,t={...a,defaultFont:a.defaultFont??V,defaultSize:a.defaultSize??q,defaultTabStopTwips:a.defaultTabStopTwips??i},n=[],r=0,s={top:1440,bottom:1440,left:1440,right:1440};t.listCounters||(t.listCounters=new Map),t.listSeenNumIds||(t.listSeenNumIds=new Set);let m=(c$1,g,d)=>{if(c$1.type.name==="blockSdt"){let o=c$1.attrs,u={id:`sdt@${g}`,sdtType:typeof o.sdtType=="string"?o.sdtType:"richText",tag:o.tag!=null?String(o.tag):void 0,alias:o.alias!=null?String(o.alias):void 0,lock:o.lock!=null?String(o.lock):void 0,checked:typeof o.checked=="boolean"?o.checked:void 0,bound:o.dataBinding!=null?true:void 0,repeatingItem:/<w15:repeatingSectionItem[\s/>]/.test(String(o.rawPropertiesXml??""))?true:void 0},l=[...d,u];c$1.forEach((b,h)=>{m(b,g+1+h,l);});return}let f=n.length;switch(c$1.type.name){case "paragraph":{let o=w(c$1,g,t),u=c$1.attrs;n.push(o);let l=u._sectionProperties;if(l||u.sectionBreakType){let b={kind:"sectionBreak",id:c(),type:l?.sectionStart??u.sectionBreakType};if(l){if((l.pageWidth!==void 0||l.pageHeight!==void 0)&&(b.pageSize={w:a$1(l.pageWidth??12240),h:a$1(l.pageHeight??15840)}),l.marginTop!==void 0||l.marginBottom!==void 0||l.marginLeft!==void 0||l.marginRight!==void 0){let k={top:l.marginTop??s.top,bottom:l.marginBottom??s.bottom,left:l.marginLeft??s.left,right:l.marginRight??s.right};b.margins={top:a$1(k.top),bottom:a$1(k.bottom),left:a$1(k.left),right:a$1(k.right)},s=k;}let h=l.columnCount??1;if(h>1){let k={count:h,gap:a$1(l.columnSpace??720),equalWidth:l.equalWidth??true,separator:l.separator};b.columns=k;}}n.push(b);}}break;case "table":n.push(W(c$1,g,t));break;case "image":n.push(A(c$1,g,t.pageContentHeight));break;case "textBox":n.push(ee(c$1,g,t));break;case "horizontalRule":case "pageBreak":{let o={kind:"pageBreak",id:c(),pmStart:g,pmEnd:g+c$1.nodeSize};n.push(o);break}}if(d.length>0)for(let o=f;o<n.length;o++)n[o].sdtGroups=d;};return e.forEach((c,g)=>{m(c,r+g,[]);}),n}export{B as a,H as b,he as c};
@@ -0,0 +1 @@
1
+ function g(i,e){if(!e||!e.trim())return null;let n=null;return i.descendants((t,r)=>n!==null?false:t.isTextblock&&t.attrs?.paraId===e?(n={from:r,to:r+t.nodeSize},false):true),n}function c(i){let e=[];return i.descendants(n=>!n.isText||!n.text?true:n.marks.some(t=>t.type.name==="insertion")?false:(e.push(n.text),true)),e.join("")}function p(i,e,n){if(e>=n)return "";let t=[];return i.nodesBetween(e,n,(r,f)=>{if(!r.isText||!r.text||r.marks.some(o=>o.type.name==="insertion"))return;let u=Math.max(e,f),m=Math.min(n,f+r.text.length);u<m&&t.push(r.text.slice(u-f,m-f));}),t.join("")}function P(i,e,n,t){if(!t)return null;let r="",f=[];i.nodesBetween(e,n,(s,l)=>{!s.isText||!s.text||s.marks.some(b=>b.type.name==="insertion")||(f.push({pos:l,len:s.text.length}),r+=s.text);});let u=r.indexOf(t);if(u===-1||r.indexOf(t,u+1)!==-1)return null;let o=0,a=e,x=e;for(let s of f){let l=o+s.len;if(o<=u&&u<l&&(a=s.pos+(u-o)),o<=u+t.length&&u+t.length<=l){x=s.pos+(u+t.length-o);break}o=l;}return {from:a,to:x}}export{g as a,c as b,p as c,P as d};
@@ -1 +1 @@
1
- 'use strict';var chunkT4RYVPAB_js=require('./chunk-T4RYVPAB.js'),chunkJFZIXFRC_js=require('./chunk-JFZIXFRC.js'),chunk4Q2IP5FW_js=require('./chunk-4Q2IP5FW.js');function De(e){return !chunkJFZIXFRC_js.b(e.wrapType)&&e.wrapType!=="topAndBottom"}function Xe(e){return e.wrapType==="behind"}function Ne(e){return chunkJFZIXFRC_js.a(e.wrapType)?true:e.displayMode==="float"}function j(e){return chunkJFZIXFRC_js.b(e.wrapType)||e.wrapType==="topAndBottom"?false:chunkJFZIXFRC_js.c(e.wrapType)?true:e.displayMode==="float"&&e.cssFloat!=="none"}function je(e){return e==="left"?"right":e==="right"?"left":"bothSides"}function Ke(e){return {pageWidth:e.size.w,pageHeight:e.size.h,marginLeft:e.margins.left,marginTop:e.margins.top,contentWidth:e.size.w-e.margins.left-e.margins.right,contentHeight:e.size.h-e.margins.top-e.margins.bottom}}function qe(e,i,n,t){let{x:o,side:r}=Te(e,n,t),l=U(e,i,t);return {x:o,y:l,side:r}}function V(e,i,n){return U(e,i,n)}function Te(e,i,n){let t=e.position?.horizontal;if(!t)return e.cssFloat==="right"?{x:i-e.width,side:"right"}:{x:0,side:"left"};let o=ye(t.relativeTo,i,n);if(t.align==="right")return {x:o.size?o.base+o.size-e.width:0,side:"right"};if(t.align==="left")return {x:o.base,side:"left"};if(t.align==="center")return {x:o.size?o.base+(o.size-e.width)/2:0,side:"left"};if(t.posOffset!==void 0){let r=o.base+chunk4Q2IP5FW_js.e(t.posOffset);return {x:r,side:r>i/2?"right":"left"}}return {x:o.base,side:"left"}}function ye(e,i,n){let t=n?.pageWidth??0,o=n?.marginLeft??0;switch(e){case "page":return {base:-o,size:t};case "leftMargin":return {base:-o,size:o};case "rightMargin":return {base:i,size:o};case "character":return {base:0,size:0};default:return {base:0,size:i}}}function U(e,i,n){let t=e.position?.vertical;if(!t)return i;let o=Fe(t.relativeTo,i,n);return t.align==="top"?o.base:t.align==="center"?o.size?o.base+(o.size-e.height)/2:i:t.align==="bottom"?o.size?o.base+o.size-e.height:i:t.posOffset!==void 0?o.base+chunk4Q2IP5FW_js.e(t.posOffset):t.relativeTo==="paragraph"||t.relativeTo==="line"?i:o.base}function Fe(e,i,n){let t=n?.pageHeight??0,o=n?.marginTop??0,r=n?.contentHeight??0;switch(e){case "paragraph":case "line":return {base:i,size:0};case "page":return {base:-o,size:t};case "topMargin":return {base:-o,size:o};case "bottomMargin":return {base:r,size:o};default:return {base:0,size:r}}}var K=7,q=0;function Me(e,i){if(e.kind!=="paragraph"||i.kind!=="paragraph")return "totalHeight"in i?i.totalHeight:"height"in i?i.height:0;let n=e.runs.filter(u=>u.kind!=="text"||u.text.length>0);if(!(i.lines.length===1&&n.length>0&&n.every(u=>u.kind==="image")))return i.totalHeight;let o=n.reduce((u,g)=>g.kind==="image"?Math.max(u,g.height):u,0),r=e.attrs?.spacing?.before??0,l=e.attrs?.spacing?.after??0;return r+o+l}function J(e){let i=e?.borders?.top?.width??0,n=e?.borders?.bottom?.width??0;return i+n}function Q(e,i,n){let t=e.columnWidths??[],o=chunkT4RYVPAB_js.a(e.width,e.widthType,i),r=chunkT4RYVPAB_js.c(e),l=o??i;if(e.rows.length>0&&(t=chunkT4RYVPAB_js.d(t,r,l)),t.length>0&&o){let a=t.reduce((c,s)=>c+s,0);if(a>0&&Math.abs(a-o)>1){let c=o/a;t=t.map(s=>s*c);}}let u=new Map;for(let a of chunkT4RYVPAB_js.b(e))u.set(`${a.rowIndex}-${a.cellIndex}`,a.columnIndex);let g=e.rows.map((a,c)=>({cells:a.cells.map((s,h)=>{let d=s.colSpan??1,y=u.get(`${c}-${h}`)??0,p=0;for(let b=0;b<d&&y+b<t.length;b++)p+=t[y+b]??0;p===0&&(p=(s.width&&s.width>0?s.width:chunkT4RYVPAB_js.a(s.widthValue,s.widthType,l))??100);let M=s.padding?.left??K,P=s.padding?.right??K,T=Math.max(1,p-M-P);return {blocks:s.blocks.map(b=>n(b,T)),width:p,height:0,colSpan:s.colSpan,rowSpan:s.rowSpan}}),height:0})),m=[];for(let a=0;a<g.length;a++){let c=g[a],s=e.rows[a]?.cells,h=0,d=0;for(let P=0;P<c.cells.length;P++){let T=c.cells[P],b=s?.[P],R=0,S=0;for(let z=0;z<T.blocks.length;z++){let k=b?.blocks[z],Z=T.blocks[z];if(!k||!Z)continue;let xe=Me(k,Z),E=k.kind==="paragraph"?k.attrs?.spacing:void 0,O=E?.before??0,Y=E?.after??0;R+=Math.max(S,O)+(xe-O-Y),S=Y;}R+=S,T.height=R;let me=b?.padding?.top??q,be=b?.padding?.bottom??q;T.height+=me+be,(T.rowSpan??1)<=1&&(h=Math.max(h,T.height)),d=Math.max(d,J(b));}let y=e.rows[a],p=y?.height,M=y?.heightRule;m[a]=M==="exact"&&!!p,p&&M==="exact"?c.height=p:p?c.height=Math.max(h+d,p):c.height=h+d;}let x=g.map(a=>a.height);for(let a=0;a<g.length;a++){let c=e.rows[a]?.cells,s=g[a]?.cells;if(!(!c||!s))for(let h=0;h<c.length;h++){let d=c[h]?.rowSpan??1;if(d<=1)continue;let y=Math.min(a+d-1,g.length-1),p=(s[h]?.height??0)+J(c[h]),M=0;for(let b=a;b<=y;b++)M+=x[b]??0;let P=p-M;if(P<=0)continue;let T=y;for(;T>a&&m[T];)T--;m[T]||(g[T].height+=P);}}let f=g.reduce((a,c)=>a+c.height,0),F=t.reduce((a,c)=>a+c,0)||o||i;return {kind:"table",rows:g,columnWidths:t,totalWidth:F,totalHeight:f}}var Pe=4;function we(e,i,n,t){let o=Array.isArray(i)?i[0]??0:i,r=Ce(e,o,n,t),l=r.filter(s=>s.isMarginRelative),u=r.filter(s=>!s.isMarginRelative),g=new Map;for(let s of l){let h=g.get(s.topY)??[];h.push(s),g.set(s.topY,h);}let m=ze(u,Pe),x=[];ee(m,x),ee(Array.from(g.values()),x);let f=new Map;for(let s of x){let h=s.fullWidthBlock&&s.isMarginRelative?0:s.anchorBlockIndex,d=f.get(h)??[],{anchorBlockIndex:y,isMarginRelative:p,...M}=s;d.push(M),f.set(h,d);}let F=new Set(f.keys()),a=0,c=[];return e.map((s,h)=>{F.has(h)&&(a=0,c=f.get(h)??[]);let d=c.length>0?c:void 0,y=Array.isArray(i)?i[h]??o:i,p=n(s,y,d,a);return "totalHeight"in p&&(s.kind==="table"&&s.floating||(a+=p.totalHeight)),p})}function Ce(e,i,n,t){let o=[];for(let r=0;r<e.length;r++){let l=e[r];switch(l.kind){case "paragraph":ve(l,r,i,o);break;case "table":Ae(l,r,i,n,o);break;case "textBox":Ie(l,r,i,o,t);break}}return o}function te(e,i,n,t,o,r){let l=0,u=0,g=e?.horizontal;if(g?.align==="left")l=n+o;else if(g?.align==="right")u=n+t;else if(g?.posOffset!==void 0){let m=chunk4Q2IP5FW_js.e(g.posOffset);m<r/2?l=m+n+o:u=r-m+t;}else i==="left"?l=n+o:i==="right"&&(u=n+t);return chunkT4RYVPAB_js.y(l,u,r)}function $(e){let i=e?.vertical?.relativeTo;return i==="margin"||i==="page"}function ve(e,i,n,t){for(let o of e.runs){if(o.kind!=="image")continue;let r=o;if(!j(r))continue;let l=r.distTop??0,u=r.distBottom??0,g=r.distLeft??12,m=r.distRight??12,x=0,f=r.position?.vertical;f?.align==="top"&&f.relativeTo==="margin"?x=0:f?.posOffset!==void 0&&(x=chunk4Q2IP5FW_js.e(f.posOffset));let F=x+r.height,{leftMargin:a,rightMargin:c}=te(r.position,r.cssFloat,r.width,g,m,n);(a>0||c>0)&&t.push({leftMargin:a,rightMargin:c,topY:x-l,bottomY:F+u,anchorBlockIndex:i,isMarginRelative:$(r.position)});}}function Ae(e,i,n,t,o){let r=e.floating;if(!r)return;let l=Q(e,n,t),u=l.totalWidth,g=l.totalHeight,m=r.leftFromText??12,x=r.rightFromText??12,f=r.topFromText??0,F=r.bottomFromText??0,a=0;r.tblpX!==void 0?a=r.tblpX:r.tblpXSpec?r.tblpXSpec==="left"||r.tblpXSpec==="inside"?a=0:r.tblpXSpec==="right"||r.tblpXSpec==="outside"?a=n-u:r.tblpXSpec==="center"&&(a=(n-u)/2):e.justification==="center"?a=(n-u)/2:e.justification==="right"&&(a=n-u);let c=0,s=0;a<n/2?c=a+u+x:s=n-a+m,{leftMargin:c,rightMargin:s}=chunkT4RYVPAB_js.y(c,s,n);let h=r.tblpY??0,d=h+g;o.push({leftMargin:c,rightMargin:s,topY:h-f,bottomY:d+F,anchorBlockIndex:i});}function Ie(e,i,n,t,o){if(!chunkT4RYVPAB_js.I(e)||chunkJFZIXFRC_js.b(e.wrapType))return;let r=e.width??0,l=e.height??0;if(r<=0||l<=0)return;let u=e.distTop??0,g=e.distBottom??0,m=e.distLeft??12,x=e.distRight??12;if(e.wrapType==="topAndBottom"){let s=V({height:l,position:e.position},0,o),h=s+l+g;if(h<=0)return;t.push({leftMargin:0,rightMargin:0,topY:Math.max(0,s-u),bottomY:h,anchorBlockIndex:i,isMarginRelative:$(e.position),fullWidthBlock:true});return}let f=0;e.position?.vertical?.posOffset!==void 0&&(f=chunk4Q2IP5FW_js.e(e.position.vertical.posOffset));let F=f+l,{leftMargin:a,rightMargin:c}=te(e.position,e.cssFloat,r,m,x,n);a<=0&&c<=0||t.push({leftMargin:a,rightMargin:c,topY:f-u,bottomY:F+g,anchorBlockIndex:i,isMarginRelative:$(e.position)});}function ze(e,i){let n=[];for(let t of e){let o=n.find(r=>r.some(l=>Math.abs(l.anchorBlockIndex-t.anchorBlockIndex)<=i&&t.topY<l.bottomY&&t.bottomY>l.topY));o?o.push(t):n.push([t]);}return n}function ee(e,i){for(let n of e){let t=Math.min(...n.map(o=>o.anchorBlockIndex));for(let o of n)i.push({...o,anchorBlockIndex:t});}}var ne=2e4,w=new Map;function ie(e,i,n){return `${e}|${i}|${n||0}`}function oe(){for(;w.size>ne;){let e=w.keys().next().value;if(e===void 0)break;w.delete(e);}}function ke(e,i,n=0){let t=ie(e,i,n),o=w.get(t);if(o!==void 0)return w.delete(t),w.set(t,o),o.width}function Be(e,i,n,t){let o=ie(e,i,n);w.set(o,{width:t}),oe();}function re(){w.clear();}function Re(e){!Number.isFinite(e)||e<=0||(ne=e,oe());}function ae(){return w.size}var Se=1e3,se=Se,C=new Map;function ce(e,i,n=false,t=false){return `${e}|${i}|${n}|${t}`}function le(){for(;C.size>se;){let e=C.keys().next().value;if(e===void 0)break;C.delete(e);}}function We(e,i,n=false,t=false){let o=ce(e,i,n,t),r=C.get(o);if(r!==void 0)return C.delete(o),C.set(o,r),r}function $e(e,i,n,t,o){let r=ce(e,i,n,t);C.set(r,o),le();}function ue(){C.clear();}function He(e){!Number.isFinite(e)||e<=0||(se=e,le());}function ge(){return C.size}var Ze=5e3,he=Ze,v=new Map;function H(e){let i=[];for(let t of e.runs)t.kind==="text"?i.push(`t:${t.text}|${t.fontFamily}|${t.fontSize}|${t.bold}|${t.italic}`):t.kind==="tab"?i.push(`tab:${t.width}`):t.kind==="image"?i.push(`img:${t.width}x${t.height}`):t.kind==="lineBreak"&&i.push("br");let n=e.attrs;if(n){n.alignment&&i.push(`align:${n.alignment}`),n.indent&&i.push(`indent:${n.indent.left}|${n.indent.right}|${n.indent.firstLine}|${n.indent.hanging}`),n.spacing&&i.push(`spacing:${n.spacing.before}|${n.spacing.after}|${n.spacing.line}|${n.spacing.lineRule}`),n.defaultFontSize!=null&&i.push(`dfs:${n.defaultFontSize}`),n.defaultFontFamily!=null&&i.push(`dff:${n.defaultFontFamily}`);let t=n.borders;if(t){let o=r=>r?`${r.width??""},${r.style??""},${r.color??""}`:"";i.push(`bdr:${o(t.top)}|${o(t.bottom)}|${o(t.left)}|${o(t.right)}`);}n.suppressEmptyParagraphHeight&&i.push("sup"),n.pPrIns&&i.push(`pins:${n.pPrIns.revisionId}`),n.pPrDel&&i.push(`pdel:${n.pPrDel.revisionId}`);}return i.join("||")}function pe(){for(;v.size>he;){let e=v.keys().next().value;if(e===void 0)break;v.delete(e);}}function Ee(e,i){let n=H(e),t=v.get(n);if(t!==void 0&&t.maxWidth===i)return v.delete(n),v.set(n,t),t.measure}function Oe(e,i,n){let t=H(e);v.set(t,{measure:n,maxWidth:i}),pe();}function fe(){v.clear();}function Ye(e){!Number.isFinite(e)||e<=0||(he=e,pe());}function de(){return v.size}function Le(){re(),ue(),fe();}function Ge(){return ae()+ge()+de()}exports.A=de;exports.B=Le;exports.C=Ge;exports.a=De;exports.b=Xe;exports.c=Ne;exports.d=j;exports.e=je;exports.f=Ke;exports.g=qe;exports.h=V;exports.i=Me;exports.j=Q;exports.k=we;exports.l=ke;exports.m=Be;exports.n=re;exports.o=Re;exports.p=ae;exports.q=We;exports.r=$e;exports.s=ue;exports.t=He;exports.u=ge;exports.v=H;exports.w=Ee;exports.x=Oe;exports.y=fe;exports.z=Ye;
1
+ 'use strict';var chunkRSU4HTC6_js=require('./chunk-RSU4HTC6.js'),chunkJFZIXFRC_js=require('./chunk-JFZIXFRC.js'),chunk4Q2IP5FW_js=require('./chunk-4Q2IP5FW.js');function De(e){return !chunkJFZIXFRC_js.b(e.wrapType)&&e.wrapType!=="topAndBottom"}function Xe(e){return e.wrapType==="behind"}function Ne(e){return chunkJFZIXFRC_js.a(e.wrapType)?true:e.displayMode==="float"}function j(e){return chunkJFZIXFRC_js.b(e.wrapType)||e.wrapType==="topAndBottom"?false:chunkJFZIXFRC_js.c(e.wrapType)?true:e.displayMode==="float"&&e.cssFloat!=="none"}function je(e){return e==="left"?"right":e==="right"?"left":"bothSides"}function Ke(e){return {pageWidth:e.size.w,pageHeight:e.size.h,marginLeft:e.margins.left,marginTop:e.margins.top,contentWidth:e.size.w-e.margins.left-e.margins.right,contentHeight:e.size.h-e.margins.top-e.margins.bottom}}function qe(e,i,n,t){let{x:o,side:r}=Te(e,n,t),l=U(e,i,t);return {x:o,y:l,side:r}}function V(e,i,n){return U(e,i,n)}function Te(e,i,n){let t=e.position?.horizontal;if(!t)return e.cssFloat==="right"?{x:i-e.width,side:"right"}:{x:0,side:"left"};let o=ye(t.relativeTo,i,n);if(t.align==="right")return {x:o.size?o.base+o.size-e.width:0,side:"right"};if(t.align==="left")return {x:o.base,side:"left"};if(t.align==="center")return {x:o.size?o.base+(o.size-e.width)/2:0,side:"left"};if(t.posOffset!==void 0){let r=o.base+chunk4Q2IP5FW_js.e(t.posOffset);return {x:r,side:r>i/2?"right":"left"}}return {x:o.base,side:"left"}}function ye(e,i,n){let t=n?.pageWidth??0,o=n?.marginLeft??0;switch(e){case "page":return {base:-o,size:t};case "leftMargin":return {base:-o,size:o};case "rightMargin":return {base:i,size:o};case "character":return {base:0,size:0};default:return {base:0,size:i}}}function U(e,i,n){let t=e.position?.vertical;if(!t)return i;let o=Fe(t.relativeTo,i,n);return t.align==="top"?o.base:t.align==="center"?o.size?o.base+(o.size-e.height)/2:i:t.align==="bottom"?o.size?o.base+o.size-e.height:i:t.posOffset!==void 0?o.base+chunk4Q2IP5FW_js.e(t.posOffset):t.relativeTo==="paragraph"||t.relativeTo==="line"?i:o.base}function Fe(e,i,n){let t=n?.pageHeight??0,o=n?.marginTop??0,r=n?.contentHeight??0;switch(e){case "paragraph":case "line":return {base:i,size:0};case "page":return {base:-o,size:t};case "topMargin":return {base:-o,size:o};case "bottomMargin":return {base:r,size:o};default:return {base:0,size:r}}}var K=7,q=0;function Me(e,i){if(e.kind!=="paragraph"||i.kind!=="paragraph")return "totalHeight"in i?i.totalHeight:"height"in i?i.height:0;let n=e.runs.filter(u=>u.kind!=="text"||u.text.length>0);if(!(i.lines.length===1&&n.length>0&&n.every(u=>u.kind==="image")))return i.totalHeight;let o=n.reduce((u,g)=>g.kind==="image"?Math.max(u,g.height):u,0),r=e.attrs?.spacing?.before??0,l=e.attrs?.spacing?.after??0;return r+o+l}function J(e){let i=e?.borders?.top?.width??0,n=e?.borders?.bottom?.width??0;return i+n}function Q(e,i,n){let t=e.columnWidths??[],o=chunkRSU4HTC6_js.a(e.width,e.widthType,i),r=chunkRSU4HTC6_js.c(e),l=o??i;if(e.rows.length>0&&(t=chunkRSU4HTC6_js.d(t,r,l)),t.length>0&&o){let a=t.reduce((c,s)=>c+s,0);if(a>0&&Math.abs(a-o)>1){let c=o/a;t=t.map(s=>s*c);}}let u=new Map;for(let a of chunkRSU4HTC6_js.b(e))u.set(`${a.rowIndex}-${a.cellIndex}`,a.columnIndex);let g=e.rows.map((a,c)=>({cells:a.cells.map((s,h)=>{let d=s.colSpan??1,y=u.get(`${c}-${h}`)??0,p=0;for(let b=0;b<d&&y+b<t.length;b++)p+=t[y+b]??0;p===0&&(p=(s.width&&s.width>0?s.width:chunkRSU4HTC6_js.a(s.widthValue,s.widthType,l))??100);let M=s.padding?.left??K,P=s.padding?.right??K,T=Math.max(1,p-M-P);return {blocks:s.blocks.map(b=>n(b,T)),width:p,height:0,colSpan:s.colSpan,rowSpan:s.rowSpan}}),height:0})),m=[];for(let a=0;a<g.length;a++){let c=g[a],s=e.rows[a]?.cells,h=0,d=0;for(let P=0;P<c.cells.length;P++){let T=c.cells[P],b=s?.[P],R=0,S=0;for(let z=0;z<T.blocks.length;z++){let k=b?.blocks[z],Z=T.blocks[z];if(!k||!Z)continue;let xe=Me(k,Z),E=k.kind==="paragraph"?k.attrs?.spacing:void 0,O=E?.before??0,Y=E?.after??0;R+=Math.max(S,O)+(xe-O-Y),S=Y;}R+=S,T.height=R;let me=b?.padding?.top??q,be=b?.padding?.bottom??q;T.height+=me+be,(T.rowSpan??1)<=1&&(h=Math.max(h,T.height)),d=Math.max(d,J(b));}let y=e.rows[a],p=y?.height,M=y?.heightRule;m[a]=M==="exact"&&!!p,p&&M==="exact"?c.height=p:p?c.height=Math.max(h+d,p):c.height=h+d;}let x=g.map(a=>a.height);for(let a=0;a<g.length;a++){let c=e.rows[a]?.cells,s=g[a]?.cells;if(!(!c||!s))for(let h=0;h<c.length;h++){let d=c[h]?.rowSpan??1;if(d<=1)continue;let y=Math.min(a+d-1,g.length-1),p=(s[h]?.height??0)+J(c[h]),M=0;for(let b=a;b<=y;b++)M+=x[b]??0;let P=p-M;if(P<=0)continue;let T=y;for(;T>a&&m[T];)T--;m[T]||(g[T].height+=P);}}let f=g.reduce((a,c)=>a+c.height,0),F=t.reduce((a,c)=>a+c,0)||o||i;return {kind:"table",rows:g,columnWidths:t,totalWidth:F,totalHeight:f}}var Pe=4;function we(e,i,n,t){let o=Array.isArray(i)?i[0]??0:i,r=Ce(e,o,n,t),l=r.filter(s=>s.isMarginRelative),u=r.filter(s=>!s.isMarginRelative),g=new Map;for(let s of l){let h=g.get(s.topY)??[];h.push(s),g.set(s.topY,h);}let m=ze(u,Pe),x=[];ee(m,x),ee(Array.from(g.values()),x);let f=new Map;for(let s of x){let h=s.fullWidthBlock&&s.isMarginRelative?0:s.anchorBlockIndex,d=f.get(h)??[],{anchorBlockIndex:y,isMarginRelative:p,...M}=s;d.push(M),f.set(h,d);}let F=new Set(f.keys()),a=0,c=[];return e.map((s,h)=>{F.has(h)&&(a=0,c=f.get(h)??[]);let d=c.length>0?c:void 0,y=Array.isArray(i)?i[h]??o:i,p=n(s,y,d,a);return "totalHeight"in p&&(s.kind==="table"&&s.floating||(a+=p.totalHeight)),p})}function Ce(e,i,n,t){let o=[];for(let r=0;r<e.length;r++){let l=e[r];switch(l.kind){case "paragraph":ve(l,r,i,o);break;case "table":Ae(l,r,i,n,o);break;case "textBox":Ie(l,r,i,o,t);break}}return o}function te(e,i,n,t,o,r){let l=0,u=0,g=e?.horizontal;if(g?.align==="left")l=n+o;else if(g?.align==="right")u=n+t;else if(g?.posOffset!==void 0){let m=chunk4Q2IP5FW_js.e(g.posOffset);m<r/2?l=m+n+o:u=r-m+t;}else i==="left"?l=n+o:i==="right"&&(u=n+t);return chunkRSU4HTC6_js.y(l,u,r)}function $(e){let i=e?.vertical?.relativeTo;return i==="margin"||i==="page"}function ve(e,i,n,t){for(let o of e.runs){if(o.kind!=="image")continue;let r=o;if(!j(r))continue;let l=r.distTop??0,u=r.distBottom??0,g=r.distLeft??12,m=r.distRight??12,x=0,f=r.position?.vertical;f?.align==="top"&&f.relativeTo==="margin"?x=0:f?.posOffset!==void 0&&(x=chunk4Q2IP5FW_js.e(f.posOffset));let F=x+r.height,{leftMargin:a,rightMargin:c}=te(r.position,r.cssFloat,r.width,g,m,n);(a>0||c>0)&&t.push({leftMargin:a,rightMargin:c,topY:x-l,bottomY:F+u,anchorBlockIndex:i,isMarginRelative:$(r.position)});}}function Ae(e,i,n,t,o){let r=e.floating;if(!r)return;let l=Q(e,n,t),u=l.totalWidth,g=l.totalHeight,m=r.leftFromText??12,x=r.rightFromText??12,f=r.topFromText??0,F=r.bottomFromText??0,a=0;r.tblpX!==void 0?a=r.tblpX:r.tblpXSpec?r.tblpXSpec==="left"||r.tblpXSpec==="inside"?a=0:r.tblpXSpec==="right"||r.tblpXSpec==="outside"?a=n-u:r.tblpXSpec==="center"&&(a=(n-u)/2):e.justification==="center"?a=(n-u)/2:e.justification==="right"&&(a=n-u);let c=0,s=0;a<n/2?c=a+u+x:s=n-a+m,{leftMargin:c,rightMargin:s}=chunkRSU4HTC6_js.y(c,s,n);let h=r.tblpY??0,d=h+g;o.push({leftMargin:c,rightMargin:s,topY:h-f,bottomY:d+F,anchorBlockIndex:i});}function Ie(e,i,n,t,o){if(!chunkRSU4HTC6_js.I(e)||chunkJFZIXFRC_js.b(e.wrapType))return;let r=e.width??0,l=e.height??0;if(r<=0||l<=0)return;let u=e.distTop??0,g=e.distBottom??0,m=e.distLeft??12,x=e.distRight??12;if(e.wrapType==="topAndBottom"){let s=V({height:l,position:e.position},0,o),h=s+l+g;if(h<=0)return;t.push({leftMargin:0,rightMargin:0,topY:Math.max(0,s-u),bottomY:h,anchorBlockIndex:i,isMarginRelative:$(e.position),fullWidthBlock:true});return}let f=0;e.position?.vertical?.posOffset!==void 0&&(f=chunk4Q2IP5FW_js.e(e.position.vertical.posOffset));let F=f+l,{leftMargin:a,rightMargin:c}=te(e.position,e.cssFloat,r,m,x,n);a<=0&&c<=0||t.push({leftMargin:a,rightMargin:c,topY:f-u,bottomY:F+g,anchorBlockIndex:i,isMarginRelative:$(e.position)});}function ze(e,i){let n=[];for(let t of e){let o=n.find(r=>r.some(l=>Math.abs(l.anchorBlockIndex-t.anchorBlockIndex)<=i&&t.topY<l.bottomY&&t.bottomY>l.topY));o?o.push(t):n.push([t]);}return n}function ee(e,i){for(let n of e){let t=Math.min(...n.map(o=>o.anchorBlockIndex));for(let o of n)i.push({...o,anchorBlockIndex:t});}}var ne=2e4,w=new Map;function ie(e,i,n){return `${e}|${i}|${n||0}`}function oe(){for(;w.size>ne;){let e=w.keys().next().value;if(e===void 0)break;w.delete(e);}}function ke(e,i,n=0){let t=ie(e,i,n),o=w.get(t);if(o!==void 0)return w.delete(t),w.set(t,o),o.width}function Be(e,i,n,t){let o=ie(e,i,n);w.set(o,{width:t}),oe();}function re(){w.clear();}function Re(e){!Number.isFinite(e)||e<=0||(ne=e,oe());}function ae(){return w.size}var Se=1e3,se=Se,C=new Map;function ce(e,i,n=false,t=false){return `${e}|${i}|${n}|${t}`}function le(){for(;C.size>se;){let e=C.keys().next().value;if(e===void 0)break;C.delete(e);}}function We(e,i,n=false,t=false){let o=ce(e,i,n,t),r=C.get(o);if(r!==void 0)return C.delete(o),C.set(o,r),r}function $e(e,i,n,t,o){let r=ce(e,i,n,t);C.set(r,o),le();}function ue(){C.clear();}function He(e){!Number.isFinite(e)||e<=0||(se=e,le());}function ge(){return C.size}var Ze=5e3,he=Ze,v=new Map;function H(e){let i=[];for(let t of e.runs)t.kind==="text"?i.push(`t:${t.text}|${t.fontFamily}|${t.fontSize}|${t.bold}|${t.italic}`):t.kind==="tab"?i.push(`tab:${t.width}`):t.kind==="image"?i.push(`img:${t.width}x${t.height}`):t.kind==="lineBreak"&&i.push("br");let n=e.attrs;if(n){n.alignment&&i.push(`align:${n.alignment}`),n.indent&&i.push(`indent:${n.indent.left}|${n.indent.right}|${n.indent.firstLine}|${n.indent.hanging}`),n.spacing&&i.push(`spacing:${n.spacing.before}|${n.spacing.after}|${n.spacing.line}|${n.spacing.lineRule}`),n.defaultFontSize!=null&&i.push(`dfs:${n.defaultFontSize}`),n.defaultFontFamily!=null&&i.push(`dff:${n.defaultFontFamily}`);let t=n.borders;if(t){let o=r=>r?`${r.width??""},${r.style??""},${r.color??""}`:"";i.push(`bdr:${o(t.top)}|${o(t.bottom)}|${o(t.left)}|${o(t.right)}`);}n.suppressEmptyParagraphHeight&&i.push("sup"),n.pPrIns&&i.push(`pins:${n.pPrIns.revisionId}`),n.pPrDel&&i.push(`pdel:${n.pPrDel.revisionId}`);}return i.join("||")}function pe(){for(;v.size>he;){let e=v.keys().next().value;if(e===void 0)break;v.delete(e);}}function Ee(e,i){let n=H(e),t=v.get(n);if(t!==void 0&&t.maxWidth===i)return v.delete(n),v.set(n,t),t.measure}function Oe(e,i,n){let t=H(e);v.set(t,{measure:n,maxWidth:i}),pe();}function fe(){v.clear();}function Ye(e){!Number.isFinite(e)||e<=0||(he=e,pe());}function de(){return v.size}function Le(){re(),ue(),fe();}function Ge(){return ae()+ge()+de()}exports.A=de;exports.B=Le;exports.C=Ge;exports.a=De;exports.b=Xe;exports.c=Ne;exports.d=j;exports.e=je;exports.f=Ke;exports.g=qe;exports.h=V;exports.i=Me;exports.j=Q;exports.k=we;exports.l=ke;exports.m=Be;exports.n=re;exports.o=Re;exports.p=ae;exports.q=We;exports.r=$e;exports.s=ue;exports.t=He;exports.u=ge;exports.v=H;exports.w=Ee;exports.x=Oe;exports.y=fe;exports.z=Ye;
@@ -0,0 +1 @@
1
+ import {a as a$1}from'./chunk-FCJWLEKT.mjs';import {c as c$2}from'./chunk-7E5VBRDL.mjs';import {a as a$2}from'./chunk-MOCGHQ4A.mjs';import {a,b,c as c$1}from'./chunk-QPFJJPIC.mjs';import {a as a$3}from'./chunk-AMENZY5F.mjs';import {c}from'./chunk-VW22RZ6C.mjs';function q(e,t,n,r){let i=e-t-n,o=(r.count-1)*r.gap;return (i-o)/r.count}function fe(e){let t={...e.pageSize},n={...e.margins},r=e.columns??{count:1,gap:0},i=false,o,s,a=[],l=[];function u(){return t.h-n.bottom}function c(){return u()-n.top}function f(){return t.w-n.left-n.right}if(c()<=0)throw new Error(`Paginator: page size and margins yield no content area (pageSize=${Math.round(t.w)}x${Math.round(t.h)} margins top=${Math.round(n.top)} bottom=${Math.round(n.bottom)} left=${Math.round(n.left)} right=${Math.round(n.right)})`);let b=q(t.w,n.left,n.right,r),S=n.top;function y(d){return n.left+d*(b+r.gap)}function M(){(o||s)&&(o&&(t=o),s&&(n=s),o=void 0,s=void 0,b=q(t.w,n.left,n.right,r));let d=a.length+1,w=n.top,I=u(),m=e.footnoteReservedHeights?.get(d)??0,p=I-m,x={number:d,fragments:[],margins:{...n},size:{...t},footnoteReservedHeight:m>0?m:void 0,columns:r.count>1?{...r}:void 0},h={page:x,cursorY:w,columnIndex:0,topMargin:w,contentBottom:p,trailingSpacing:0};return a.push(x),l.push(h),S=w,e.onNewPage&&e.onNewPage(h),h}function P(){return l.length===0?M():l[l.length-1]}function T(d){return d.contentBottom-d.cursorY}function v(d,w){let I=w||P();return T(I)>=d}function F(d){return d.columnIndex<r.count-1?(d.columnIndex+=1,d.cursorY=S,d.trailingSpacing=0,d):M()}function L(d){let w=P(),I=Number.isFinite(d)&&d>0?d:0;for(;!v(I,w);){let m=w.contentBottom-w.topMargin;if(I>m)return i||(i=true,console.warn(`Paginator: fragment height ${I.toFixed(0)}px exceeds page content height ${m.toFixed(0)}px; placing with overflow.`)),w.cursorY!==w.topMargin&&(w=F(w)),w;w=F(w);}return w}function C(d,w,I=0,m=0){let p=Math.max(I,P().trailingSpacing),x=p+w,h=L(x),B=p,N=y(h.columnIndex),k=h.cursorY+B;return d.x=N,d.y=k,h.page.fragments.push(d),h.cursorY=k+w,h.trailingSpacing=m,{state:h,x:N,y:k}}function g(){if(l.length>0){let d=l[l.length-1];if(d.page.fragments.length===0&&d.cursorY===d.topMargin)return d}return M()}function R(){let d=P();return F(d)}function H(d){r=d,b=q(t.w,n.left,n.right,r);let w=P();w.page.columns=r.count>1?{...r}:void 0,S=w.cursorY,w.columnIndex=0;}function W(d,w,I=true){if(!I){o=d?{...d}:o,s=w?{...w}:s;return}if(d&&(t={...d}),w&&(n={...w}),c()<=0)throw new Error("Paginator: section page size and margins yield no content area");b=q(t.w,n.left,n.right,r),o=void 0,s=void 0;}return {pages:a,states:l,get columnWidth(){return b},get columns(){return {...r}},getCurrentState:P,getAvailableHeight:()=>T(P()),getContentWidth:f,fits:d=>v(d),ensureFits:L,addFragment:C,forcePageBreak:g,forceColumnBreak:R,getColumnX:y,updateColumns:H,updatePageLayout:W}}function ge(e){let t=new Map,n=new Set;for(let r=0;r<e.length;r++){if(n.has(r))continue;let i=e[r];if(i.kind!=="paragraph"||!i.attrs?.keepNext)continue;let s=[r],a=r;for(let c=r+1;c<e.length;c++){let f=e[c];if(f.kind==="sectionBreak"||f.kind==="pageBreak"||f.kind==="columnBreak"||f.kind!=="paragraph")break;if(f.attrs?.keepNext)s.push(c),a=c,n.add(c);else break}let l=a+1,u=-1;if(l<e.length){let c=e[l];c.kind!=="sectionBreak"&&c.kind!=="pageBreak"&&c.kind!=="columnBreak"&&(u=l);}t.set(r,{startIndex:r,endIndex:a,memberIndices:s,anchorIndex:u});}return t}function me(e,t,n){let r=0;for(let i of e.memberIndices){let o=t[i],s=n[i];if(o.kind!=="paragraph"||s.kind!=="paragraph")continue;let a=o,l=s,u=a.attrs?.spacing?.before??0;r+=u,r+=l.totalHeight;let c=a.attrs?.spacing?.after??0;r+=c;}if(e.anchorIndex!==-1){let i=n[e.anchorIndex];if(i?.kind==="paragraph"){let o=i;o.lines.length>0&&(r+=o.lines[0].lineHeight);}}return r}function pe(e){let t=new Set;for(let n of e.values())for(let r=1;r<n.memberIndices.length;r++)t.add(n.memberIndices[r]);return t}function it(e){return e.kind!=="paragraph"?false:e.attrs?.keepLines===true}function de(e){return e.kind!=="paragraph"?false:e.attrs?.pageBreakBefore===true}function K(e){return e.displayMode==="float"||a(e.wrapType)||e.wrapType==="topAndBottom"}function ot(e){return K(e)&&e.wrapType==="topAndBottom"}function at(e){return K(e)&&!b(e.wrapType)&&e.wrapType!=="topAndBottom"}function qt(e,t,n){if(!(!e||e<=0)){if(t==="pct")return n*e/5e3;if(!t||t==="dxa"||t==="auto")return c(e)}}function Ce(e){let t=new Map,n=[];for(let r=0;r<e.rows.length;r++){let i=e.rows[r]?.cells??[],o=t.get(r)??new Set,s=0;for(;o.has(s);)s++;for(let a=0;a<i.length;a++){let l=i[a];if(!l)continue;let u=l.colSpan??1,c=l.rowSpan??1;if(n.push({rowIndex:r,cellIndex:a,columnIndex:s,colSpan:u,rowSpan:c}),c>1)for(let f=r+1;f<r+c;f++){t.has(f)||t.set(f,new Set);let b=t.get(f);for(let S=0;S<u;S++)b.add(s+S);}for(s+=u;o.has(s);)s++;}}return n}function Jt(e){return Math.max(1,...e.rows.map(t=>t.cells.reduce((n,r)=>n+Math.max(1,r.colSpan??1),0)))}function Qt(e,t,n){if(t<=0)return [];let r=n>0?n/t:0;if(e.length===0)return Array(t).fill(r);let i=e.slice(0,t),o=t-i.length;if(o>0){let c=i.filter(b=>b>0),f=c.length>0?c.reduce((b,S)=>b+S,0)/c.length:r;i=i.concat(Array(o).fill(f));}let s=i.reduce((c,f)=>c+(f>0?f:0),0),a=i.filter(c=>c<=0).length;if(s<=0)return Array(t).fill(r);if(a===0)return i;let l=Math.max(0,n-s),u=l>0?l/a:s/Math.max(1,t-a);return i.map(c=>c>0?c:u)}function Re(e,t,n){let r=[],i=[],o=n,s=0,a=t?.length??0;for(let l=0;l<a;l++){let u=t[l],c=e?.[l];if(c?.kind==="paragraph"&&u?.kind==="paragraph"){let f=c.attrs?.spacing;o+=Math.max(s,f?.before??0);let b=[];for(let S of u.lines)o+=S.floatSkipBefore??0,b.push(o),o+=S.lineHeight,i.push(o);r.push(b),s=f?.after??0;}else u&&"totalHeight"in u&&typeof u.totalHeight=="number"?(o+=s+u.totalHeight,r.push([]),i.push(o),s=0):r.push([]);}return {lineTops:r,flatBottoms:i,contentHeight:o-n+s}}function Le(e,t){let n=t.rows.length,r=[],i=0;for(let a=0;a<n;a++)r.push(i),i+=t.rows[a]?.height??0;r.push(i);let o=Ce(e),s=[];for(let a=0;a<n;a++){let l=t.rows[a]?.height??0,u=new Set;u.add(l);for(let c of o){if(c.rowIndex>a||c.rowIndex+c.rowSpan-1<a)continue;let f=e.rows[c.rowIndex]?.cells?.[c.cellIndex],b=t.rows[c.rowIndex]?.cells?.[c.cellIndex];if(!f||!b)continue;let S=f.padding?.top??0,{flatBottoms:y}=Re(f.blocks,b.blocks,S),M=r[a]-r[c.rowIndex];for(let P of y){let T=P-M;T>0&&T<l&&u.add(T);}}s.push([...u].sort((c,f)=>c-f));}return {rowTops:r,breakOffsets:s}}function ke(e,t,n,r){let i=e.breakOffsets[t];if(!i||i.length===0)return 0;let o=n+r,s=0;for(let a of i)if(!(a<=n))if(a<=o)s=a-n;else break;return s}var st=1440,he=96,ve=st/he,Ee=11,We="Calibri",lt=1,ut=.8,ct=.2,$=null;function be(){if(!$){let e=typeof document<"u"?document.createElement("canvas"):null;if(!e)throw new Error("Canvas not available. Ensure this runs in a DOM environment.");if($=e.getContext("2d"),!$)throw new Error("Failed to get 2D context from canvas")}return $}function sn(){$=null;}var Ie=new Map;function He(e){let t=Ie.get(e);if(t===void 0){let n=a$3(e);t={cssFallback:n.cssFallback,singleLineRatio:n.singleLineRatio},Ie.set(e,t);}return t}function ft(e){return He(e).cssFallback}function xe(e){let t=[];e.italic&&t.push("italic"),e.bold&&t.push("bold");let n=e.fontSize??Ee,r=Y(n);t.push(`${r}px`);let i=e.fontFamily??We;return t.push(ft(i)),t.join(" ")}function j(e){let t=e.fontSize??Ee,n=e.fontFamily??We,r=Y(t),i=r*ut,o=r*ct,s=r*lt;try{let l=be();l.font=xe(e);let u=l.measureText("Hg");typeof u.actualBoundingBoxAscent=="number"&&typeof u.actualBoundingBoxDescent=="number"&&(i=u.actualBoundingBoxAscent,o=u.actualBoundingBoxDescent);}catch{}s=Math.max(s,i+o);let a=He(n).singleLineRatio;return {fontSize:t,ascent:i,descent:o,lineHeight:s,fontFamily:n,singleLineRatio:a}}function _(e,t){if(!e)return 0;let n=be();n.font=xe(t);let i=n.measureText(e).width;return t.letterSpacing&&e.length>1&&(i+=t.letterSpacing*(e.length-1)),i}function ln(e,t){let n=_(e,t),r=j(t);return {width:n,height:r.ascent+r.descent,ascent:r.ascent,descent:r.descent}}function Ae(e,t){let n=j(t);if(!e)return {width:0,charWidths:[],metrics:n};let r=be();r.font=xe(t);let i=t.letterSpacing??0,o=[],s=0;for(let a=0;a<e.length;a++){let l=e[a],c=r.measureText(l).width;i&&a<e.length-1&&(c+=i),o.push(c),s+=c;}return {width:s,charWidths:o,metrics:n}}function un(e,t){if(t.length===0||e<=0)return 0;let n=0;for(let r=0;r<t.length;r++){let i=t[r],o=n+i/2;if(e<=o)return r;n+=i;}return t.length}function cn(e,t){if(e<=0||t.length===0)return 0;let n=Math.min(e,t.length),r=0;for(let i=0;i<n;i++)r+=t[i];return r}function fn(e){return e/ve}function gn(e){return Math.round(e*ve)}function Y(e){return e*he/72}function gt(e){return e*72/he}function mn(e){return Y(e/2)}function pn(e){return gt(e)*2}function Se(e){return e/1440*96}function Me(e){return e/96*1440}function mt(e){let{explicitStops:t=[],defaultTabInterval:n=720,leftIndent:r=0}=e,i=t.filter(f=>f.val!=="clear").filter(f=>f.pos>=r),o=t.filter(f=>f.val==="clear").map(f=>f.pos),s=i.reduce((f,b)=>Math.max(f,b.pos),0),a=[...i];r>0&&!i.some(f=>f.pos<=r)&&(o.some(b=>Math.abs(b-r)<20)||a.push({val:"start",pos:r,leader:"none"}));let u=s>0?Math.max(s,r):r,c=r+14400;for(;u<c;){u+=n;let f=i.some(y=>Math.abs(y.pos-u)<20),b=o.some(y=>Math.abs(y-u)<20),S=r>0&&Math.abs(u-r)<20;!f&&!b&&!S&&a.push({val:"start",pos:u,leader:"none"});}return a.sort((f,b)=>f.pos-b.pos)}function Oe(e,t,n={}){let{defaultTabInterval:r=720}=t,i=Me(e),s=mt(t).find(u=>u.pos>i);if(!s){let u=Se(r),c=u-e%u;return c<=0&&(c=u),{width:c,alignment:"default"}}let l=Se(s.pos)-e;if(s.val==="center")l-=(n.followingWidth??0)/2;else if(s.val==="end")l-=n.followingWidth??0;else if(s.val==="decimal")l-=n.decimalPrefixWidth??0;else if(s.val==="bar")return {width:0,leader:s.leader,alignment:"bar"};if(l<1){let u=Se(r),c=u-e%u;return c<=0&&(c=u),{width:c,alignment:"default"}}return {width:l,leader:s.leader,alignment:s.val}}var pt="Calibri",dt=11;function ht(e){let t=e.attrs,n=e.runs?.find(o=>o.kind==="text"),r=t?.listMarkerFontFamily??n?.fontFamily??t?.defaultFontFamily??pt,i=t?.listMarkerFontSize??n?.fontSize??t?.defaultFontSize??dt;return {fontFamily:r,fontSize:i}}function _e(e){let t=e.attrs;if(!t?.listMarker||t.listMarkerHidden)return 0;let n=t.indent,r=n?.hanging??0;if(r>0)return r;let{fontFamily:i,fontSize:o}=ht(e),s={fontFamily:i,fontSize:o},a=_(t.listMarker,s),l=t.listMarkerSuffix??"tab";if(l==="nothing")return a;if(l==="space")return a+_(" ",s);let u=n?.left??0,c=n?.firstLine??0,f=u+c,b=f+a,S=(t.tabs??[]).filter(T=>T.val!=="clear"&&T.val!=="bar").map(T=>a$1(T.pos)).filter(T=>T>=b).sort((T,v)=>T-v)[0],y=a$1(t.defaultTabStopTwips??a$2),M=y>0?(Math.floor(b/y)+1)*y:void 0,P;return S!==void 0&&M!==void 0?P=Math.min(S,M):P=S??M,P===void 0?a+Y(o)*.5:P-f}var D=11,X="Calibri",bt=1.15,te=1,Z=.5;function ze(e,t,n,r=false){let i=1,o=e.length,s=0;for(;i<=o;){let a=i+o>>>1;_(e.slice(0,a),t)<=n?(s=a,i=a+1):o=a-1;}return r&&s===0?1:s}function V(e){return {fontFamily:e.fontFamily??X,fontSize:e.fontSize??D,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function De(e,t,n){let r=Y(e),i=n?.ascent??r*.8,o=n?.descent??r*.2,s=n?.singleLineRatio??1.15,a=r*s,l;if(t?.lineRule==="exact"&&t.line!==void 0)l=t.line;else if(t?.lineRule==="atLeast"&&t.line!==void 0){let u=a*te;l=Math.max(t.line,u);}else t?.line!==void 0&&t?.lineUnit==="multiplier"?l=a*t.line:t?.line!==void 0&&t?.lineUnit==="px"?l=t.line:l=a*te;return {ascent:i,descent:o,lineHeight:l}}function Ne(e,t,n){let r=j({fontSize:e,fontFamily:n??X}),i=De(e,t,r),o=t?.lineRule??"auto";if(o==="auto"||o==="atLeast"){let s=Y(e),a=Math.max(i.lineHeight,s*bt);if(a!==i.lineHeight)return {...i,lineHeight:a}}return i}function J(e){return e.kind==="text"}function Ze(e){return e.kind==="tab"}function Ue(e){return e.kind==="image"}function Xe(e){return e.kind==="lineBreak"}function Ge(e){return e.kind==="field"}function xt(e){return !e.text||e.text.replace(/\u00a0/g," ").trim().length===0}function St(e,t){let n=0;for(let r=t+1;r<e.length;r++){let i=e[r];if(Ze(i)||Xe(i))break;if(J(i))n+=_(i.text||"",V(i));else if(Ge(i)){let o={fontFamily:i.fontFamily??X,fontSize:i.fontSize??D,bold:i.bold,italic:i.italic};n+=_(i.fallback||"1",o);}else Ue(i)&&(n+=i.width||0);}return n}function Mt(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];(r===" "||r==="-"||r===" ")&&t.push(n+1);}return t}function Ke(e,t,n){let r=Math.max(1,n),i=Math.max(0,e),o=Math.max(0,t);return i>=r||o>=r||i+o>=r?{leftMargin:0,rightMargin:0}:{leftMargin:i,rightMargin:o}}function Tt(e,t,n){let r=e.runs,i=e.attrs,o=i?.spacing,s=n?.floatingZones,a=n?.paragraphYOffset??0,l=i?.indent,u=l?.left??0,c=l?.right??0,f=(l?.firstLine??0)-(l?.hanging??0),b=Math.max(1,t-u-c),S=(l?.hanging??0)===0?_e(e):0,y=Math.max(1,b-f-S),M=0,P=0,T=Y(D)*te,v=(m,p)=>{if(!s||s.length===0)return;let x=a+M,h=Ye(x,m,s,p,U)-x;h>0&&(M+=h,P+=h);};v(T,y);let F=ee(M,T,s,a),L=Math.max(1,Q(F,y)),C=[];if(r.length===0){if(i?.suppressEmptyParagraphHeight)return C.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,ascent:0,descent:0,lineHeight:0}),{kind:"paragraph",lines:C,totalHeight:0};let m=i?.defaultFontSize??D,p=i?.defaultFontFamily??X,x=Ne(m,o,p);C.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...x});let h=x.lineHeight;return o?.before&&(h+=o.before),o?.after&&(h+=o.after),{kind:"paragraph",lines:C,totalHeight:h}}if(r.length===1&&J(r[0])&&xt(r[0])){let m=r[0],p=m.fontSize??i?.defaultFontSize??D,x=m.fontFamily??i?.defaultFontFamily??X,h=Ne(p,o,x);C.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...h});let B=h.lineHeight;return o?.before&&(B+=o.before),o?.after&&(B+=o.after),{kind:"paragraph",lines:C,totalHeight:B}}let g={fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,maxFontSize:D,maxFontMetrics:null,maxImageHeightPx:0,availableWidth:L,leftOffset:F.leftMargin,rightOffset:F.rightMargin,segmentZones:F.segments},R=()=>{let m=De(g.maxFontSize,o,g.maxFontMetrics),p={...m};if(g.maxImageHeightPx>p.lineHeight){let h=g.maxImageHeightPx,B=p.descent;g.fromRun===g.toRun?(p.lineHeight=h+B*2,p.ascent=h+B):(p.lineHeight=h+B,p.ascent=h);}let x={fromRun:g.fromRun,fromChar:g.fromChar,toRun:g.toRun,toChar:g.toChar,width:g.width,...p};g.leftOffset>0&&(x.leftOffset=g.leftOffset),g.rightOffset>0&&(x.rightOffset=g.rightOffset),g.segmentZones?.length&&(x.segments=H(x,g.segmentZones)),P>0&&(x.floatSkipBefore=P,P=0),C.push(x),M+=m.lineHeight;},H=(m,p)=>{let x=p[0],h=p[1];if(!x)return;if(!h||m.width<=x.availableWidth+Z)return [{fromRun:m.fromRun,fromChar:m.fromChar,toRun:m.toRun,toChar:m.toChar,width:m.width,leftOffset:x.leftOffset,availableWidth:x.availableWidth}];if(m.fromRun!==m.toRun)return;let B=r[m.fromRun];if(!B||!J(B))return;let N=B,k=N.text.slice(m.fromChar,m.toChar),A=V(N),E=ze(k,A,x.availableWidth);if(E<=0||E>=k.length)return;let z=m.fromChar+E,O=k.slice(0,E),ie=k.slice(E);return [{fromRun:m.fromRun,fromChar:m.fromChar,toRun:m.toRun,toChar:z,width:_(O,A),leftOffset:x.leftOffset,availableWidth:x.availableWidth},{fromRun:m.fromRun,fromChar:z,toRun:m.toRun,toChar:m.toChar,width:_(ie,A),leftOffset:h.leftOffset,availableWidth:h.availableWidth}]},W=(m,p)=>{R();let x=Y(D)*te;v(x,b);let h=ee(M,x,s,a),B=Math.max(1,Q(h,b));g={fromRun:m,fromChar:p,toRun:m,toChar:p,width:0,maxFontSize:D,maxFontMetrics:null,maxImageHeightPx:0,availableWidth:B,leftOffset:h.leftMargin,rightOffset:h.rightMargin,segmentZones:h.segments};},d=m=>{let p=m.fontSize??D;(!g.maxFontMetrics||p>g.maxFontSize)&&(g.maxFontSize=p,g.maxFontMetrics=j(m));};for(let m=0;m<r.length;m++){let p=r[m];if(Xe(p)){g.toRun=m,g.toChar=0,W(m+1,0);continue}if(Ze(p)){let x=V(p);d(x);let h=St(r,m),B=g.width+(g.leftOffset??0),N=C.length===0,k=u+(N?f:0)+B,A={explicitStops:i?.tabs,leftIndent:Me(u)},E=Oe(k,A,{followingWidth:h}).width;if(B+E>g.availableWidth+Z){let z=g.availableWidth-B-h;z>1&&(E=z);}g.width+E>g.availableWidth+Z&&(W(m,0),d(x)),g.width+=E,g.toRun=m,g.toChar=1;continue}if(Ue(p)){let x=p.wrapType,h=p.displayMode==="float"||c$1(x);if(p.position&&h){g.toRun=m,g.toChar=1;continue}if(x==="topAndBottom"||p.displayMode==="block"){g.width>0&&W(m,0);let A=p.height,E=p.distTop??6,z=p.distBottom??6;g.toRun=m,g.toChar=1,g.maxImageHeightPx=A+E+z,W(m+1,0);continue}let B=p.width,k=p.height+(p.distTop??0)+(p.distBottom??0);k>g.maxImageHeightPx&&(g.maxImageHeightPx=k),g.width+B>g.availableWidth+Z&&W(m,0),g.width+=B,g.toRun=m,g.toChar=1;continue}if(Ge(p)){let x=p.fallback||"1",h={fontFamily:p.fontFamily??X,fontSize:p.fontSize??D,bold:p.bold,italic:p.italic};d(h);let B=_(x,h);g.width>0&&g.width+B>g.availableWidth+Z&&(W(m,0),d(h)),g.width+=B,g.toRun=m,g.toChar=1;continue}if(J(p)){let x=p,h=x.text,B=V(x);if(d(B),!h||h.length===0){g.toRun=m,g.toChar=0;continue}let N=Mt(h),k=0;for(;k<h.length;){let A=h.length;for(let O of N)if(O>k){A=O;break}let E=h.slice(k,A),z=_(E,B);if(z>g.availableWidth+Z){let O=0;for(;O<E.length;){let ie=g.availableWidth-g.width+Z,tt=E.slice(O),oe=ze(tt,B,ie);if(oe===0){if(g.width>0){W(m,k+O),d(B);continue}oe=1;}let ae=O+oe,nt=E.slice(O,ae),rt=_(nt,B);g.width+=rt,g.toRun=m,g.toChar=k+ae,O=ae,O<E.length&&(W(m,k+O),d(B));}k=A;continue}g.width>0&&g.width+z>g.availableWidth+Z&&(W(m,k),d(B)),g.width+=z,g.toRun=m,g.toChar=A,k=A;}}}R();let I=C.reduce((m,p)=>m+p.lineHeight+(p.floatSkipBefore??0),0);return o?.before&&(I+=o.before),o?.after&&(I+=o.after),{kind:"paragraph",lines:C,totalHeight:I}}function Cn(e,t){return e.map(n=>Tt(n,t))}function Rn(e){let t=V(e);return Ae(e.text,t).charWidths}function In(e,t){return e.map(n=>{let r=n.x-n.distLeft,i=n.x+n.width+n.distRight,o=n.y-n.distTop,s=n.y+n.height+n.distBottom;if(n.wrapType==="topAndBottom")return {leftMargin:0,rightMargin:0,topY:o,bottomY:s,fullWidthBlock:true};let a=0,l=0,u,c=n.wrapText??"bothSides";c==="right"?a=Te(i):c==="left"?l=ye(r,t):c==="largest"?{leftMargin:a,rightMargin:l}=wt(r,i,t):Pt(r,i,t)?u=Ft(r,i,t):n.side==="left"?a=Te(i):l=ye(r,t);let f=Ke(a,l,t);return {leftMargin:f.leftMargin,rightMargin:f.rightMargin,topY:o,bottomY:s,segments:u}})}function Q(e,t){return e.segments?.reduce((r,i)=>r+i.availableWidth,0)??t-e.leftMargin-e.rightMargin}function ee(e,t,n,r){if(!n||n.length===0)return {leftMargin:0,rightMargin:0};let i=0,o=0,s,a=r+e,l=a+t;for(let u of n)if(!(l<=u.topY||a>=u.bottomY)){if(u.fullWidthBlock)return {leftMargin:0,rightMargin:0,segments:[{leftOffset:0,availableWidth:0}]};if(u.segments?.length){s=s?yt(s,u.segments):u.segments;continue}i=Math.max(i,u.leftMargin),o=Math.max(o,u.rightMargin);}return {leftMargin:i,rightMargin:o,segments:s}}function Ye(e,t,n,r,i){if(!n||n.length===0)return e;let o=e;for(let s=0;s<n.length+2;s++){let a=ee(o,t,n,0);if(Q(a,r)>=i)return o;let u=o+t,c=1/0;for(let f of n)u<=f.topY||o>=f.bottomY||f.bottomY>o&&f.bottomY<c&&(c=f.bottomY);if(!Number.isFinite(c)||c<=o)return o;o=c;}return o}function yt(e,t){let n=[];for(let r of e)for(let i of t){let o=Math.max(r.leftOffset,i.leftOffset),s=Math.min(r.leftOffset+r.availableWidth,i.leftOffset+i.availableWidth);s>o&&n.push({leftOffset:o,availableWidth:s-o});}return n}var U=24;function Pt(e,t,n){return e>U&&t+U<n}function Ft(e,t,n){return [{leftOffset:0,availableWidth:Math.max(0,e)},{leftOffset:Math.max(0,t),availableWidth:Math.max(0,n-t)}].filter(r=>r.availableWidth>1)}function wt(e,t,n){let r=Math.max(0,e);return Math.max(0,n-t)>=r?{leftMargin:Te(t),rightMargin:0}:{leftMargin:0,rightMargin:ye(e,n)}}function Te(e){return Math.max(0,e)}function ye(e,t){return Math.max(0,t-e)}function Bt(e,t){return e==null||!Number.isFinite(e)?0:Math.max(0,Math.min(t,e))}function ne(e,t,n){if(e)return e.kind==="text"?typeof e.pmStart=="number"?e.pmStart+Bt(t,e.text.length):n==="end"?e.pmEnd:void 0:n==="end"?typeof e.pmEnd=="number"?e.pmEnd:typeof e.pmStart=="number"?e.pmStart+1:void 0:e.pmStart}function $e(e,t,n,r){if(t.lines.length===0||n>=r)return {pmStart:e.pmStart,pmEnd:e.pmEnd};let i=t.lines[n],o=t.lines[r-1],s=i?e.runs[i.fromRun]:void 0,a=o?e.runs[o.toRun]:void 0,l=n===0?e.pmStart??ne(s,i?.fromChar??0,"start"):ne(s,i?.fromChar??0,"start"),u=r>=t.lines.length?e.pmEnd??ne(a,o?.toChar??0,"end"):ne(a,o?.toChar??0,"end");return l==null&&(l=e.pmStart),u==null&&(u=e.pmEnd),l!=null&&u!=null&&u<=l&&(u=l+1),{pmStart:l,pmEnd:u}}var je={count:1,gap:0};function Ct(e,t,n){return {activeTopMargin:e.top,activeBottomMargin:e.bottom,activeLeftMargin:e.left,activeRightMargin:e.right,pendingTopMargin:null,pendingBottomMargin:null,pendingLeftMargin:null,pendingRightMargin:null,activePageSize:{...t},pendingPageSize:null,activeColumns:n?{...n}:{...je},pendingColumns:null,activeOrientation:null,pendingOrientation:null,hasAnyPages:false}}function Rt(e,t){return t.count>1}function re(e){return e?{count:e.count,gap:e.gap}:{...je}}function Lt(e,t,n){let r={...t},i=e.type??"continuous",o=e.margins,s=e.pageSize,a=e.orientation;o&&(typeof o.top=="number"&&(r.pendingTopMargin=Math.max(0,o.top)),typeof o.bottom=="number"&&(r.pendingBottomMargin=Math.max(0,o.bottom)),typeof o.left=="number"&&(r.pendingLeftMargin=Math.max(0,o.left)),typeof o.right=="number"&&(r.pendingRightMargin=Math.max(0,o.right))),s&&(r.pendingPageSize={w:s.w,h:s.h}),a&&(r.pendingOrientation=a);let l=Rt((e.margins,void 0),r.activeColumns);switch(i){case "nextPage":return r.pendingColumns=re(void 0),{decision:{forcePageBreak:true,forceMidPageRegion:false},state:r};case "evenPage":return r.pendingColumns=re(void 0),{decision:{forcePageBreak:true,forceMidPageRegion:false,requiredParity:"even"},state:r};case "oddPage":return r.pendingColumns=re(void 0),{decision:{forcePageBreak:true,forceMidPageRegion:false,requiredParity:"odd"},state:r};default:return l?(r.pendingColumns=re(void 0),{decision:{forcePageBreak:false,forceMidPageRegion:true},state:r}):{decision:{forcePageBreak:false,forceMidPageRegion:false},state:r}}}function kt(e){let t={...e};return t.pendingTopMargin!==null&&(t.activeTopMargin=t.pendingTopMargin,t.pendingTopMargin=null),t.pendingBottomMargin!==null&&(t.activeBottomMargin=t.pendingBottomMargin,t.pendingBottomMargin=null),t.pendingLeftMargin!==null&&(t.activeLeftMargin=t.pendingLeftMargin,t.pendingLeftMargin=null),t.pendingRightMargin!==null&&(t.activeRightMargin=t.pendingRightMargin,t.pendingRightMargin=null),t.pendingPageSize!==null&&(t.activePageSize=t.pendingPageSize,t.pendingPageSize=null),t.pendingColumns!==null&&(t.activeColumns=t.pendingColumns,t.pendingColumns=null),t.pendingOrientation!==null&&(t.activeOrientation=t.pendingOrientation,t.pendingOrientation=null),t}function It(e){return {top:e.pendingTopMargin??e.activeTopMargin,bottom:e.pendingBottomMargin??e.activeBottomMargin,left:e.pendingLeftMargin??e.activeLeftMargin,right:e.pendingRightMargin??e.activeRightMargin}}function vt(e){return e.pendingPageSize??e.activePageSize}function Et(e){return e.pendingColumns??e.activeColumns}function Wt(e,t){for(let n=0;n<e.pages.length;n++)for(let r of e.pages[n].fragments){if(r.pmStart==null)continue;let i=r.pmStart,o=r.pmEnd??i+1;if(t>=i&&t<o)return n}return null}var Ht={w:816,h:1056},G={top:96,right:96,bottom:96,left:96},Je={count:1,gap:0};function At(e,t,n){let r=[],i=[],o=t;for(let s=0;s<e.length;s++){if(e[s].kind!=="sectionBreak")continue;let a=e[s],l={pageSize:a.pageSize??o.pageSize,margins:a.margins??o.margins,columns:a.columns};r.push(l),i.push(s),o=l;}return r.push(n),{configs:r,breakIndices:i}}function Qe(e){if(e.runs.length===0)return true;if(e.runs.length!==1)return false;let t=e.runs[0];return t.kind==="text"&&(t.text??"")===""}function Ve(e){let t=e.attrs?.spacing?.before??0;return Qe(e)&&!e.attrs?.spacingExplicit?.before?0:t}function qe(e){let t=e.attrs?.spacing?.after??0;return Qe(e)&&!e.attrs?.spacingExplicit?.after?0:t}function et(e){for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1];if(n.kind!=="paragraph"||r.kind!=="paragraph")continue;let i=n.attrs,o=r.attrs;i?.contextualSpacing&&o?.contextualSpacing&&i.styleId&&i.styleId===o.styleId&&(i.spacing&&(i.spacing={...i.spacing,after:0}),o.spacing&&(o.spacing={...o.spacing,before:0}));}for(let t of e)if(t.kind==="table")for(let n of t.rows)for(let r of n.cells)et(r.blocks);}function Zn(e,t,n={}){if(e.length!==t.length)throw new Error(`layoutDocument: expected one measure per block (blocks=${e.length}, measures=${t.length})`);let r=n.pageSize??Ht,i={top:n.margins?.top??G.top,right:n.margins?.right??G.right,bottom:n.margins?.bottom??G.bottom,left:n.margins?.left??G.left,header:n.margins?.header??n.margins?.top??G.top,footer:n.margins?.footer??n.margins?.bottom??G.bottom};n.headerContentHeights,n.footerContentHeights,n.titlePage,n.evenAndOddHeaders;let o={...i},s=n.finalPageSize??r,a=n.finalMargins??o;if(r.w-o.left-o.right<=0)throw new Error("layoutDocument: page size and margins yield no content area");let u={pageSize:r,margins:o,columns:n.columns},c={pageSize:s,margins:a,columns:n.columns},{configs:f,breakIndices:b}=At(e,u,c),S=[...b.map(F=>e[F].type),n.bodyBreakType],y=f[0]??u,M=fe({pageSize:y.pageSize,margins:y.margins,columns:y.columns??Je,footnoteReservedHeights:n.footnoteReservedHeights});et(e);let P=ge(e),T=pe(P),v=0;for(let F=0;F<e.length;F++){let L=e[F],C=t[F];de(L)&&M.forcePageBreak();let g=P.get(F);if(g&&!T.has(F)){let R=me(g,e,t),H=M.getCurrentState(),W=M.getAvailableHeight(),d=H.contentBottom-H.topMargin;R<=d&&R>W&&H.page.fragments.length>0&&M.forcePageBreak();}switch(L.kind){case "paragraph":Ot(L,C,M,M.getContentWidth());break;case "table":L.floating?Yt(L,C,M,M.getContentWidth()):Nt(L,C,M);break;case "image":Dt(L,C,M);break;case "textBox":Ut(L,C,M);break;case "pageBreak":M.forcePageBreak();break;case "columnBreak":M.forceColumnBreak();break;case "sectionBreak":{let R=S[v+1]??S[v];Xt(L,M,f[v+1]??y,R),v++;break}default:c$2(L,"runLayoutPipeline");}}return M.pages.length===0&&M.getCurrentState(),{pageSize:r,pages:M.pages,columns:n.columns,pageGap:n.pageGap}}function Ot(e,t,n,r){if(t.kind!=="paragraph")throw new Error("layoutParagraph: expected paragraph measure");let i=t.lines;if(i.length===0){let l=Ve(e),u=qe(e),c=n.getCurrentState(),f={kind:"paragraph",blockId:e.id,x:n.getColumnX(c.columnIndex),y:c.cursorY+l,width:r,height:0,fromLine:0,toLine:0,pmStart:e.pmStart,pmEnd:e.pmEnd};n.addFragment(f,0,l,u);return}let o=Ve(e),s=qe(e),a=0;for(;a<i.length;){let l=n.getCurrentState(),u=n.getAvailableHeight(),c=0,f=0;for(let F=a;F<i.length;F++){let L=i[F].lineHeight+(i[F].floatSkipBefore??0),C=c+L;if((a===0&&F===a?C+o:C)<=u||f===0)c=C,f++;else break}let b=a===0,S=a+f>=i.length,y=b?o:0,M=S?s:0,P=$e(e,t,a,a+f),T={kind:"paragraph",blockId:e.id,x:n.getColumnX(l.columnIndex),y:0,width:r,height:c,fromLine:a,toLine:a+f,pmStart:P.pmStart,pmEnd:P.pmEnd,continuesFromPrev:!b,continuesOnNext:!S},v=n.addFragment(T,c,y,M);T.y=v.y,a+=f,a<i.length&&n.ensureFits(i[a].lineHeight);}}function _t(e){let t=0;for(let n of e.rows)if(n.isHeader)t++;else break;return t}function zt(e,t){let n=0;for(let r=0;r<t&&r<e.rows.length;r++)n+=e.rows[r].height;return n}function Nt(e,t,n){if(t.kind!=="table")throw new Error("layoutTable: expected table measure");let r=t.rows;if(r.length===0)return;let i=_t(e),o=zt(t,i),s=Le(e,t),a=0,l=0;for(;a<r.length;){let u=n.getCurrentState(),c=a===0&&l===0,f=c?u.trailingSpacing:0,b=!c&&i>0?o:0,S=n.getAvailableHeight()-f-b,y=a,M=l,P=0,T=a,v=l,F=a,L,C=false;for(;T<r.length;){let w=r[T].height,I=T===y?v:0,m=w-I;if(P+m<=S){P+=m,T+=1,F=T;continue}let p=S-P,x=e.rows[T]?.cantSplit?0:ke(s,T,I,p);x>0?(P+=x,F=T+1,L=I+x,C=true):F>y||(P+=m,F=T+1);break}let g=b+P,R=F===r.length&&!C,H=n.getColumnX(u.columnIndex);e.justification==="center"?H=H+(n.columnWidth-t.totalWidth)/2:e.justification==="right"?H=H+n.columnWidth-t.totalWidth:e.indent&&(H+=e.indent);let W={kind:"table",blockId:e.id,x:H,y:0,width:t.totalWidth,height:g,fromRow:y,toRow:F,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!c,continuesOnNext:!R,headerRowCount:!c&&i>0?i:void 0,topClip:M>0?M:void 0,bottomClip:L},d=n.addFragment(W,g,0,0);if(W.y=d.y,W.x=H,C?(a=F-1,l=L??0):(a=F,l=0),a<r.length){let w=(i>0?o:0)+(r[a].height-l);n.ensureFits(w);}}}function Yt(e,t,n,r){if(t.kind!=="table")throw new Error("layoutFloatingTable: expected table measure");let i=n.getCurrentState(),o=e.floating,s=i.page,a=s.margins,l=t.totalWidth,u=t.totalHeight,c=s.size.h-a.top-a.bottom,f=a.left,b=a.top;o?.horzAnchor==="page"&&(f=0),o?.vertAnchor==="page"&&(b=0),o?.vertAnchor==="text"&&(b=i.cursorY);let S=n.getColumnX(i.columnIndex);if(o?.tblpX!==void 0)S=f+o.tblpX;else if(o?.tblpXSpec){let R=o.tblpXSpec;R==="left"||R==="inside"?S=f:R==="right"||R==="outside"?S=f+r-l:R==="center"&&(S=f+(r-l)/2);}else e.justification==="center"?S=f+(r-l)/2:e.justification==="right"&&(S=f+r-l);let y=i.cursorY,M=false;if(o?.tblpY!==void 0)y=b+o.tblpY,M=true;else if(o?.tblpYSpec){M=true;let R=o.tblpYSpec;R==="top"?y=b:R==="bottom"?y=b+c-u:R==="center"&&(y=b+(c-u)/2);}M||(y=n.ensureFits(u).cursorY);let P=a.left,T=a.left+r-l;Number.isFinite(T)&&(S=Math.max(P,Math.min(S,T)));let v={kind:"table",blockId:e.id,x:S,y,width:l,height:u,fromRow:0,toRow:e.rows.length,pmStart:e.pmStart,pmEnd:e.pmEnd,isFloating:true};i.page.fragments.push(v);let F=o?.leftFromText??0,L=o?.rightFromText??0,C=S-a.left-F,g=a.left+r-(S+l)-L;if(C<U&&g<U){let R=y+u+(o?.bottomFromText??0);R>i.cursorY&&(i.cursorY=R);}}function Dt(e,t,n){if(t.kind!=="image")throw new Error("layoutImage: expected image measure");if(e.anchor?.isAnchored){Zt(e,t,n);return}let r=n.ensureFits(t.height),i={kind:"image",blockId:e.id,x:n.getColumnX(r.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},o=n.addFragment(i,t.height,0,0);i.y=o.y;}function Zt(e,t,n){let r=n.getCurrentState(),i=e.anchor,o=i.offsetH??n.getColumnX(r.columnIndex),s=i.offsetV??r.cursorY,a={kind:"image",blockId:e.id,x:o,y:s,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd,isAnchored:true,zIndex:i.behindDoc?-1:1};r.page.fragments.push(a);}function Ut(e,t,n){if(t.kind!=="textBox")throw new Error("layoutTextBox: expected textBox measure");if(K(e)){let s=n.getCurrentState(),a={kind:"textBox",blockId:e.id,x:n.getColumnX(s.columnIndex),y:s.cursorY,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd,isFloating:true,zIndex:e.wrapType==="behind"?-1:1};s.page.fragments.push(a);return}let r=n.ensureFits(t.height),i={kind:"textBox",blockId:e.id,x:n.getColumnX(r.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},o=n.addFragment(i,t.height,0,0);i.y=o.y;}function Xt(e,t,n,r){switch(r??"nextPage"){case "nextPage":t.updatePageLayout(n.pageSize,n.margins),t.forcePageBreak();break;case "evenPage":{t.updatePageLayout(n.pageSize,n.margins),t.forcePageBreak().page.number%2!==0&&t.forcePageBreak();break}case "oddPage":{t.updatePageLayout(n.pageSize,n.margins),t.forcePageBreak().page.number%2===0&&t.forcePageBreak();break}case "continuous":t.updatePageLayout(n.pageSize,n.margins,false);break}t.updateColumns(n.columns??Je);}export{Cn as A,Rn as B,fe as C,ge as D,me as E,pe as F,it as G,de as H,K as I,ot as J,at as K,Re as L,Ct as M,Lt as N,kt as O,It as P,vt as Q,Et as R,Wt as S,At as T,Zn as U,zt as V,qt as a,Ce as b,Jt as c,Qt as d,be as e,sn as f,xe as g,j as h,_ as i,ln as j,Ae as k,un as l,cn as m,fn as n,gn as o,Y as p,gt as q,mn as r,pn as s,In as t,ee as u,Oe as v,ht as w,_e as x,Ke as y,Tt as z};
@@ -0,0 +1 @@
1
+ import {c as c$2}from'./chunk-HKN2NKOG.mjs';import {c,f,a as a$2,g,b,e as e$1}from'./chunk-55XWETY4.mjs';import {v,w,x,U as U$1,I,J as J$1,K,t,z as z$1,b as b$1}from'./chunk-JHTURDPX.mjs';import {a as a$1,c as c$3}from'./chunk-7E5VBRDL.mjs';import {x as x$1}from'./chunk-3G44SFHX.mjs';import {c as c$1}from'./chunk-LJE7HQEJ.mjs';import {c as c$4}from'./chunk-MOKKS75W.mjs';import {a}from'./chunk-AMENZY5F.mjs';import {e,i}from'./chunk-VW22RZ6C.mjs';function et(e,t,n,o,r){let a=new Map,i=[];for(let m of e.fragments){let s=o(m);if(s.length===0||!("height"in m))continue;let y=m.y-e.margins.top,g=y+m.height;s.forEach((u,E)=>{let b=`${E}:${u.id}`,f=a.get(b);f?(f.top=Math.min(f.top,y),f.bottom=Math.max(f.bottom,g)):(a.set(b,{group:u,depth:E,top:y,bottom:g}),i.push(b));});}let d=2,l=[];for(let m of i){let{group:s,depth:y,top:g,bottom:u}=a.get(m),E=y*(d+1),b=r.createElement("div");b.className="layout-block-sdt-box",b.dataset.sdtGroupId=s.id,b.dataset.sdtType=s.sdtType,b.dataset.sdtDepth=String(y+1),s.tag!=null&&(b.dataset.sdtTag=s.tag),s.alias!=null&&(b.dataset.sdtAlias=s.alias),s.lock!=null&&(b.dataset.sdtLock=s.lock),b.style.position="absolute",b.style.left=`${E}px`,b.style.top=`${g-d}px`,b.style.width=`${n-E*2}px`,b.style.height=`${u-g+d*2}px`;let f=s.alias||s.tag||s.sdtType;if(f){let I=r.createElement("span");I.className="layout-block-sdt-label",I.textContent=f,b.appendChild(I);}let w=wt(s.sdtType);if(w&&s.tag!=null&&!s.bound&&s.lock!=="contentLocked"&&s.lock!=="sdtContentLocked"){let I=r.createElement("button");I.type="button",I.className="layout-sdt-widget",I.dataset.sdtWidget=w,I.dataset.sdtTag=s.tag,I.dataset.sdtGroupId=s.id,I.setAttribute("aria-label",`${w} control ${s.alias||s.tag}`),w==="dropdown"?I.setAttribute("aria-haspopup","listbox"):w==="date"&&I.setAttribute("aria-haspopup","dialog"),I.textContent=w==="dropdown"?"\u25BE":w==="date"?"\u{1F4C5}":s.checked?"\u2612":"\u2610",b.appendChild(I);}if(s.repeatingItem&&!s.bound){let I=r.createElement("div");I.className="layout-sdt-repeat-controls";for(let c of ["add","remove"]){let x=r.createElement("button");x.type="button",x.className="layout-sdt-repeat-btn",x.dataset.sdtRepeat=c,x.dataset.sdtGroupId=s.id,x.setAttribute("aria-label",c==="add"?"Add item":"Remove item"),x.textContent=c==="add"?"\uFF0B":"\u2715",I.appendChild(x);}b.appendChild(I);}t.appendChild(b),l.push(b);}Tt(t,l);}function wt(e){return e==="checkbox"?"checkbox":e==="dropDownList"||e==="comboBox"?"dropdown":e==="date"?"date":null}function Tt(e,t){if(t.length===0||typeof e.addEventListener!="function")return;let n=(d,l)=>{for(let m of t){let s=m.getBoundingClientRect(),y=d>=s.left&&d<=s.right&&l>=s.top&&l<=s.bottom;y!==m.classList.contains("is-active")&&m.classList.toggle("is-active",y);}},o=typeof requestAnimationFrame=="function"?requestAnimationFrame:d=>d(),r=false,a=0,i=0;e.addEventListener("mousemove",d=>{a=d.clientX,i=d.clientY,!r&&(r=true,o(()=>{r=false,n(a,i);}));}),e.addEventListener("mouseleave",()=>{for(let d of t)d.classList.remove("is-active");});}function wn(e,t,n){let o=new Set,r=e.content.size,a=i=>{let d=e.resolve(Math.max(0,Math.min(i,r)));for(let l=1;l<=d.depth;l++)d.node(l).type.name==="blockSdt"&&o.add(`sdt@${d.before(l)}`);};return a(t),n!==t&&a(n),o}function Tn(e,t){let n=e.querySelectorAll(".layout-block-sdt-box");for(let o of n){let r=o.dataset.sdtGroupId,a=r!=null&&t.has(r);a!==o.classList.contains("is-focused")&&o.classList.toggle("is-focused",a);}}var U={fragment:"layout-fragment",paragraph:"layout-fragment-paragraph",table:"layout-fragment-table",image:"layout-fragment-image",line:"layout-line",run:"layout-run"};function Ft(e){return e.kind==="paragraph"}function It(e){return e.kind==="table"}function Ct(e){return e.kind==="image"}function pe(e){e.style.position="absolute",e.style.overflow="hidden";}function Rt(e,t,n){let o=n.createElement("div");return o.className=`${U.fragment} ${U.paragraph}`,pe(o),o.dataset.blockId=String(e.blockId),o.dataset.fromLine=String(e.fromLine),o.dataset.toLine=String(e.toLine),e.pmStart!==void 0&&(o.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(o.dataset.pmEnd=String(e.pmEnd)),e.continuesFromPrev&&(o.dataset.continuesFromPrev="true"),e.continuesOnNext&&(o.dataset.continuesOnNext="true"),o}function Et(e,t,n){let o=n.createElement("div");return o.className=`${U.fragment} ${U.table}`,pe(o),o.dataset.blockId=String(e.blockId),o.dataset.fromRow=String(e.fromRow),o.dataset.toRow=String(e.toRow),e.pmStart!==void 0&&(o.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(o.dataset.pmEnd=String(e.pmEnd)),o}function Lt(e,t,n){let o=n.createElement("div");return o.className=`${U.fragment} ${U.image}`,pe(o),o.dataset.blockId=String(e.blockId),e.pmStart!==void 0&&(o.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(o.dataset.pmEnd=String(e.pmEnd)),e.isAnchored&&(o.dataset.anchored="true"),e.zIndex!==void 0&&(o.style.zIndex=String(e.zIndex)),o}function Fe(e,t,n={}){let o=n.document??document;if(Ft(e))return Rt(e,t,o);if(It(e))return Et(e,t,o);if(Ct(e))return Lt(e,t,o);let r=o.createElement("div");r.className=U.fragment,pe(r);let a=e;return a.blockId!==void 0&&(r.dataset.blockId=String(a.blockId)),a.kind&&(r.dataset.kind=a.kind),r}var B={fragment:"layout-paragraph",line:"layout-line",run:"layout-run",text:"layout-run-text",tab:"layout-run-tab",image:"layout-run-image",lineBreak:"layout-run-linebreak"};function A(e){return e.kind==="text"}function D(e){return e.kind==="tab"}function G(e){return e.kind==="image"}function Y(e){return e.kind==="lineBreak"}function X(e){return e.kind==="field"}var tt={image:"layout-image",imageAnchored:"layout-image-anchored"};function ne(e){return !!(e.cropTop||e.cropRight||e.cropBottom||e.cropLeft||e.opacity!=null&&e.opacity<1)}function oe(e,t){let n=t.cropTop??0,o=t.cropRight??0,r=t.cropBottom??0,a=t.cropLeft??0;(n||o||r||a)&&(e.style.clipPath=`inset(${n*100}% ${o*100}% ${r*100}% ${a*100}%)`),t.opacity!=null&&t.opacity<1&&(e.style.opacity=String(Math.max(0,t.opacity)));}function Z(e,t,n,o,r={}){let a=r.document??document,i=a.createElement("div");i.className=tt.image,e.isAnchored&&i.classList.add(tt.imageAnchored),i.style.position="absolute",i.style.width=`${e.width}px`,i.style.height=`${e.height}px`,i.style.overflow="hidden",e.zIndex!==void 0&&(i.style.zIndex=String(e.zIndex)),t.anchor?.behindDoc&&(i.style.zIndex="-1"),i.dataset.blockId=String(e.blockId),e.pmStart!==void 0&&(i.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(i.dataset.pmEnd=String(e.pmEnd));let d=a.createElement("img");if(d.src=t.src,d.alt=t.alt??"",d.style.width="100%",d.style.height="100%",d.style.objectFit="contain",d.style.display="block",t.transform&&(d.style.transform=t.transform),d.draggable=false,t.hlinkHref){let l=a.createElement("a");l.href=t.hlinkHref,l.target="_blank",l.rel="noopener noreferrer",l.style.display="block",l.style.width="100%",l.style.height="100%",l.appendChild(d),i.appendChild(l);}else i.appendChild(d);return i}function vt(e,t,n){if(t.fontFamily&&(e.style.fontFamily=a(t.fontFamily).cssFallback),t.fontSize){let r=t.fontSize*96/72;e.style.fontSize=`${r}px`;}if(t.bold&&(e.style.fontWeight="bold"),t.italic&&(e.style.fontStyle="italic"),t.color&&(e.style.color=t.color),t.letterSpacing&&(e.style.letterSpacing=`${t.letterSpacing}px`),t.allCaps&&(e.style.textTransform="uppercase"),t.smallCaps&&(e.style.fontVariant="small-caps"),t.positionPx&&(e.style.verticalAlign=`${t.positionPx}px`),t.horizontalScale&&t.horizontalScale!==100&&(e.style.display="inline-block",e.style.transform=`scaleX(${t.horizontalScale/100})`,e.style.transformOrigin="left center"),t.kerningMinPt&&t.kerningMinPt>0&&(t.fontSize??11)>=t.kerningMinPt&&(e.style.fontKerning="normal"),t.emboss&&(e.style.textShadow="1px 1px 1px rgba(255,255,255,0.5), -1px -1px 1px rgba(0,0,0,0.3)"),t.imprint&&(e.style.textShadow="-1px -1px 1px rgba(255,255,255,0.5), 1px 1px 1px rgba(0,0,0,0.3)"),t.textShadow&&!t.emboss&&!t.imprint&&(e.style.textShadow="1px 1px 2px rgba(0,0,0,0.3)"),t.textOutline&&(e.style.webkitTextStroke="1px currentColor",e.style.webkitTextFillColor="transparent"),t.emphasisMark){let r=t.emphasisMark==="comma"?"filled sesame":t.emphasisMark==="circle"?"filled circle":"filled dot",a=t.emphasisMark==="underDot"?"under right":"over right";e.style.textEmphasis=`${r}`,e.style.textEmphasisPosition=a,e.style.webkitTextEmphasis=r,e.style.webkitTextEmphasisPosition=a;}t.highlight&&(e.style.backgroundColor=t.highlight);let o=[];if(t.underline&&(o.push("underline"),typeof t.underline=="object"&&(t.underline.style&&(e.style.textDecorationStyle=t.underline.style),t.underline.color&&(e.style.textDecorationColor=t.underline.color))),t.strike&&o.push("line-through"),t.commentIds&&t.commentIds.length>0){let r=t.commentIds.find(a=>!n||!n.has(a));r!=null&&(e.style.backgroundColor="rgba(255, 212, 0, 0.15)",e.style.borderBottom="1px solid rgba(255, 212, 0, 0.4)",e.dataset.commentId=String(r));}t.isInsertion&&(e.style.backgroundColor="rgba(52, 168, 83, 0.08)",e.style.borderBottom="2px dashed #2e7d32",e.style.paddingBottom="1px",e.classList.add("docx-insertion"),t.changeAuthor&&(e.dataset.changeAuthor=t.changeAuthor),t.changeDate&&(e.dataset.changeDate=t.changeDate),t.changeRevisionId!=null&&(e.dataset.revisionId=String(t.changeRevisionId))),t.isDeletion&&(e.style.backgroundColor="rgba(211, 47, 47, 0.08)",e.style.color="#c62828",o.includes("line-through")||o.push("line-through"),e.style.textDecorationColor="#c62828",e.classList.add("docx-deletion"),t.changeAuthor&&(e.dataset.changeAuthor=t.changeAuthor),t.changeDate&&(e.dataset.changeDate=t.changeDate),t.changeRevisionId!=null&&(e.dataset.revisionId=String(t.changeRevisionId))),o.length>0&&(e.style.textDecorationLine=o.join(" ")),t.superscript&&(e.style.verticalAlign="super",e.style.fontSize="0.75em"),t.subscript&&(e.style.verticalAlign="sub",e.style.fontSize="0.75em"),t.hidden&&(e.classList.add("docx-hidden"),e.style.opacity="0.4",e.style.textDecoration="underline dotted"),t.rtl&&e.setAttribute("dir","rtl"),t.textEffect&&(e.classList.add("docx-text-effect",`docx-text-effect-${t.textEffect}`),e.dataset.effect=t.textEffect);}function j(e,t,n){t!==void 0&&(e.dataset.pmStart=String(t)),n!==void 0&&(e.dataset.pmEnd=String(n));}function re(e,t,n){let o=t.createElement("span");if(o.className=`${B.run} ${B.text}`,vt(o,e,n),j(o,e.pmStart,e.pmEnd),e.hyperlink){let r=t.createElement("a");r.href=e.hyperlink.href,e.hyperlink.href.startsWith("#")||(r.target="_blank",r.rel="noopener noreferrer"),e.hyperlink.tooltip&&(r.title=e.hyperlink.tooltip),r.textContent=e.text,r.style.color="inherit",r.style.textDecoration="inherit",e.hyperlink.noDefaultStyle||(e.color||(r.style.color="#0563c1",o.style.color="#0563c1"),e.underline||(r.style.textDecoration="underline")),o.appendChild(r);}else o.textContent=e.text;return o}var Pt=1e3;function fe(e,t,n,o){let r=t.createElement("span");r.className=`${B.run} ${B.tab}`,r.style.display="inline-block",r.style.width=`${n}px`,j(r,e.pmStart,e.pmEnd);let a=o&&o!=="none"?Bt(o):null;if(a){r.style.position="relative",r.textContent="\u200B";let i=t.createElement("span");i.style.position="absolute",i.style.left="0",i.style.right="0",i.style.top="0",i.style.bottom="0",i.style.overflow="hidden",i.style.whiteSpace="nowrap",i.textContent=a.repeat(Pt),r.appendChild(i);}else r.textContent="\xA0";return r}function Bt(e){switch(e){case "dot":return ".";case "hyphen":return "-";case "underscore":return "_";case "middleDot":return "\xB7";case "heavy":return "_";default:return null}}function rt(e){if(!e)return 0;let t=e.match(/rotate\(([-\d.]+)deg\)/);return t?(parseFloat(t[1])%360+360)%360:0}function it(e,t,n){if(n===0||n===180)return {w:e,h:t};if(n===90||n===270)return {w:t,h:e};let o=n*Math.PI/180,r=Math.abs(Math.sin(o)),a=Math.abs(Math.cos(o));return {w:e*a+t*r,h:e*r+t*a}}function nt(e,t){t.distTop&&(e.style.marginTop=`${t.distTop}px`),t.distBottom&&(e.style.marginBottom=`${t.distBottom}px`);}function Mt(e,t){let n=t.createElement("img");n.className=`${B.run} ${B.image}`,n.src=e.src,n.width=e.width,n.height=e.height,n.style.width=`${e.width}px`,n.style.height=`${e.height}px`,e.alt&&(n.alt=e.alt),e.transform&&(n.style.transform=e.transform,n.style.transformOrigin="center center"),ne(e)&&oe(n,e);let o=rt(e.transform);if(o!==0){let r=it(e.width,e.height,o),a=t.createElement("span");return a.style.display="inline-block",a.style.position="relative",a.style.width=`${r.w}px`,a.style.height=`${r.h}px`,a.style.verticalAlign="middle",n.style.position="absolute",n.style.left=`${(r.w-e.width)/2}px`,n.style.top=`${(r.h-e.height)/2}px`,nt(a,e),j(a,e.pmStart,e.pmEnd),a.appendChild(n),a}return n.style.display="inline-block",n.style.verticalAlign="middle",nt(n,e),j(n,e.pmStart,e.pmEnd),n}function ot(e,t){let n=t.createElement("div");n.className="layout-block-image",n.style.display="block",n.style.textAlign="center",n.style.marginTop=`${e.distTop??6}px`,n.style.marginBottom=`${e.distBottom??6}px`;let o=t.createElement("img");o.src=e.src,o.width=e.width,o.height=e.height,o.style.marginLeft="auto",o.style.marginRight="auto",e.alt&&(o.alt=e.alt),e.transform&&(o.style.transform=e.transform,o.style.transformOrigin="center center"),ne(e)&&oe(o,e);let r=rt(e.transform);if(r!==0){let a=it(e.width,e.height,r);n.style.height=`${a.h}px`,n.style.position="relative",o.style.position="absolute",o.style.left="50%",o.style.top="50%",o.style.marginLeft=`${-e.width/2}px`,o.style.marginRight="0",o.style.marginTop=`${-e.height/2}px`;}return j(n,e.pmStart,e.pmEnd),n.appendChild(o),n}function ge(e,t){let n;return c(e)||e.displayMode==="block"||e.wrapType==="topAndBottom"?n=ot(e,t):n=Mt(e,t),$t(n,e),n}function $t(e,t){if(t.isInsertion)e.style.outline="2px solid #2e7d32",e.style.outlineOffset="1px",e.classList.add("docx-insertion");else if(t.isDeletion)e.style.outline="2px solid #c62828",e.style.outlineOffset="1px",e.style.opacity="0.6",e.classList.add("docx-deletion");else return;t.changeAuthor&&(e.dataset.changeAuthor=t.changeAuthor),t.changeDate&&(e.dataset.changeDate=t.changeDate),t.changeRevisionId!=null&&(e.dataset.revisionId=String(t.changeRevisionId));}function Ie(e,t){let n=t.createElement("br");return n.className=`${B.run} ${B.lineBreak}`,j(n,e.pmStart,e.pmEnd),n}function me(e,t,n){let o=e.fallback??"";switch(e.fieldType){case "PAGE":o=String(n.pageNumber);break;case "NUMPAGES":o=String(n.totalPages);break;case "DATE":o=new Date().toLocaleDateString();break;case "TIME":o=new Date().toLocaleTimeString();break}let r={...e,text:o};return re(r,t,n?.resolvedCommentIds)}function Ce(e,t,n){if(A(e))return re(e,t,n?.resolvedCommentIds);if(D(e))return fe(e,t,48,void 0);if(G(e))return ge(e,t);if(Y(e))return Ie(e,t);if(X(e)&&n)return me(e,t,n);let o=t.createElement("span");return o.className=B.run,o}function lt(e,t){let n=[],o=e.runs;for(let r=t.fromRun;r<=t.toRun;r++){let a=o[r];if(a)if(A(a)){let i=r===t.fromRun?t.fromChar:0,d=r===t.toRun?t.toChar:a.text.length;if(i>0||d<a.text.length){let l=a.text.slice(i,d);n.push({...a,text:l,pmStart:a.pmStart!==void 0?a.pmStart+i:void 0,pmEnd:a.pmStart!==void 0?a.pmStart+d:void 0});}else n.push(a);}else n.push(a);}return n}function at(e){return e==="center"?"center":e==="right"?"flex-end":"flex-start"}function st(e){return [e.pmStart??"no-start",e.pmEnd??"no-end",e.src,e.width,e.height,e.displayMode??"inline",e.wrapType??"none"].join("|")}function Ht(e){return {val:e.val,pos:e.pos,leader:e.leader}}function At(e,t,n){let o="";for(let r=t+1;r<e.length;r++){let a=e[r];if(A(a))o+=a.text;else if(X(a))a.fieldType==="PAGE"&&n?o+=String(n.pageNumber):a.fieldType==="NUMPAGES"&&n?o+=String(n.totalPages):o+=a.fallback??"";else if(D(a)||Y(a))break}return o}var Ot=.5;function zt(e,t,n,o){let r=0;for(let a=t+1;a<e.length;a++){let i=e[a];if(D(i)||Y(i))break;if(A(i))r+=n(i.text||"",i.fontSize,i.fontFamily,i.bold,i.italic);else if(X(i)){let d;i.fieldType==="PAGE"&&o?d=String(o.pageNumber):i.fieldType==="NUMPAGES"&&o?d=String(o.totalPages):d=i.fallback??"",r+=n(d,i.fontSize,i.fontFamily,i.bold,i.italic);}else G(i)&&!c(i)&&(r+=i.width||0);}return r}function Dt(e){let n=e.createElement("canvas").getContext("2d");return (o,r=11,a$1="Calibri",i=false,d=false)=>{if(!n)return o.length*7;let l=a(a$1).cssFallback,m=r*96/72,s=[];return d&&s.push("italic"),i&&s.push("bold"),s.push(`${m}px`,l),n.font=s.join(" "),n.measureText(o).width}}function ue(e,t,n,o,r){let a=o.createElement("div");a.className=B.line,a.style.height=`${t.lineHeight}px`,a.style.lineHeight=`${t.lineHeight}px`;let i=lt(e,t);if(i.length===1&&G(i[0])){let w=i[0].position?.horizontal?.align??n;a.style.display="flex",a.style.alignItems="center",a.style.justifyContent=at(w),a.dataset.flexLine="true";}else i.some(G)&&(a.style.display="flex",a.style.alignItems="baseline",a.style.justifyContent=at(n),a.style.lineHeight="normal",a.dataset.flexLine="true");if(i.length===0){let b=o.createElement("span");return b.className=`${B.run} layout-empty-run`,b.innerHTML="&nbsp;",a.appendChild(b),a}let d=n==="justify",l=false;d&&r&&(l=!r.isLastLine||r.paragraphEndsWithLineBreak,l&&(a.style.textAlign="justify",a.style.textAlignLast="justify",a.style.width=`${r.availableWidth}px`)),a.style.whiteSpace="pre";let m=i.some(b=>A(b)&&b.highlight);a.style.overflow=m?"hidden":"visible";let s=i.some(D),y,g=Dt(o);if(s){let b=r?.tabStops?.map(Ht),f=r?.leftIndentPx?Math.round(r.leftIndentPx*15):0;y={explicitStops:b,leftIndent:f};}let u=0,E=r?.leftIndentPx??0;if(r?.isFirstLine){let b=r?.firstLineIndentPx??0;u=E+b;}else u=E;for(let b=0;b<i.length;b++){let f=i[b];if(D(f)&&y){let w=zt(i,b,g,r?.context),I=At(i,b,r?.context),c$1=I.indexOf("."),x=c$1>=0?g(I.slice(0,c$1)):0,T=v(u,y,{followingWidth:w,decimalPrefixWidth:x}),S=r?.lineRightEdgePx,k=w,p=false;for(let F=b+1;F<i.length&&!Y(i[F]);F++)if(D(i[F])){p=true;break}if(S!==void 0&&T.alignment==="end"&&!p&&u+T.width+k>=S-Ot){a.style.display="flex",a.style.alignItems="baseline",a.style.whiteSpace="nowrap",a.style.textIndent="0",a.dataset.flexLine="true",r?.isFirstLine&&r.firstLineIndentPx&&r.firstLineIndentPx<0&&a.firstElementChild instanceof HTMLElement&&(a.firstElementChild.style.marginLeft=`${r.firstLineIndentPx}px`);let F=fe(f,o,0,T.leader);F.style.flex="1 1 0",F.style.minWidth="0",F.style.width="auto",a.appendChild(F);for(let v=b+1;v<i.length;v++){let L=i[v];if(D(L)||Y(L))break;if(A(L))a.appendChild(re(L,o,r?.context?.resolvedCommentIds));else if(X(L)&&r?.context)a.appendChild(me(L,o,r.context));else if(G(L)){if(c(L))continue;let P=st(L);r?.renderedInlineImageKeys?.has(P)||(r?.renderedInlineImageKeys?.add(P),a.appendChild(ge(L,o)));}else a.appendChild(Ce(L,o,r?.context));}break}let R=T.width;S!==void 0&&u+R+k>S&&(R=Math.max(1,S-u-k));let C=fe(f,o,R,T.leader);a.appendChild(C),u+=R;}else if(A(f)){let w=re(f,o,r?.context?.resolvedCommentIds);if(f.highlight){let T=(f.fontSize?f.fontSize*96/72:14.67)*1.2,S=Math.max(0,t.lineHeight-T);if(S>0){let k=S/2;w.style.paddingTop=`${k}px`,w.style.paddingBottom=`${k}px`;}}a.appendChild(w);let I=f.fontSize||11,c=f.fontFamily||"Calibri";u+=g(f.text,I,c,f.bold,f.italic);}else if(G(f)){if(c(f))continue;let w=st(f);if(r?.renderedInlineImageKeys?.has(w))continue;r?.renderedInlineImageKeys?.add(w);let I=ge(f,o);a.appendChild(I),f.displayMode!=="block"&&f.wrapType!=="topAndBottom"&&(u+=f.width);}else if(Y(f)){let w=Ie(f,o);a.appendChild(w);}else if(X(f)&&r?.context){let w=me(f,o,r.context);a.appendChild(w);let I=f.fallback??"";f.fieldType==="PAGE"?I=String(r.context.pageNumber):f.fieldType==="NUMPAGES"&&(I=String(r.context.totalPages));let c=f.fontSize||11,x=f.fontFamily||"Calibri";u+=g(I,c,x,f.bold,f.italic);}else {let w=Ce(f,o,r?.context);a.appendChild(w);}}return a}function ie(e,t){return !e&&!t?true:!e||!t?false:e.style===t.style&&e.width===t.width&&e.color===t.color}function dt(e,t){return !e&&!t||!e||!t?false:ie(e.top,t.top)&&ie(e.bottom,t.bottom)&&ie(e.left,t.left)&&ie(e.right,t.right)&&ie(e.between,t.between)}var Nt=/[\u0590-\u085F\u08A0-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,Wt=/[\u0041-\u005A\u0061-\u007A\u00C0-\u02B8\u0370-\u0589\u10A0-\u10FF\u1E00-\u1FFF]/;function _t(e){let t=(e.runs??[]).filter(A);if(!t.some(n=>n.rtl))return false;for(let n of t)for(let o of n.text){if(Nt.test(o))return true;if(Wt.test(o))return false}return true}function z(e,t,n,o,r={}){let a=r.document??document,i=a.createElement("div");i.className=B.fragment,i.style.position=o.positioning==="absolute"?"absolute":"relative",i.dataset.blockId=String(e.blockId),i.dataset.fromLine=String(e.fromLine),i.dataset.toLine=String(e.toLine),j(i,e.pmStart,e.pmEnd),e.continuesFromPrev&&(i.dataset.continuesFromPrev="true"),e.continuesOnNext&&(i.dataset.continuesOnNext="true");let d=t.attrs?.pPrIns,l=t.attrs?.pPrDel;if(d||l){let S=d??l;i.classList.add("layout-revision-pmark"),i.classList.add(d?"layout-revision-ins":"layout-revision-del"),i.dataset.revisionId=String(S.revisionId),i.dataset.revisionAuthor=S.author,S.date&&(i.dataset.revisionDate=S.date);}let m=n.lines.slice(e.fromLine,e.toLine),s=t.attrs?.alignment;t.attrs?.styleId&&(i.dataset.styleId=t.attrs.styleId);let y=!!t.attrs?.bidi||_t(t);y&&(i.dir="rtl"),s?s==="center"?i.style.textAlign="center":s==="right"?i.style.textAlign="right":s==="left"?i.style.textAlign="left":i.style.textAlign=y?"right":"left":y&&(i.style.textAlign="right");let g=t.attrs?.indent,u=0,E=0;g&&(y?(g.left&&g.left>0&&(E=g.left),g.right&&g.right>0&&(u=g.right)):(g.left&&g.left>0&&(u=g.left),g.right&&g.right>0&&(E=g.right)));let b=t.attrs?.borders;if(b){let S=L=>{switch(L){case "single":return "solid";case "double":return "double";case "dotted":return "dotted";case "dashed":return "dashed";case "thick":return "solid";case "wave":return "wavy";case "dashSmallGap":return "dashed";case "nil":case "none":return "none";default:return "solid"}};i.style.boxSizing="border-box";let k=L=>`${L.width}px ${S(L.style)} ${L.color}`,p=dt(r.prevBorders,b),h=dt(b,r.nextBorders),R=p?b.between:b.top,C=h?void 0:b.bottom,F=a.createElement("div");if(F.className="layout-paragraph-border",F.style.position="absolute",F.style.pointerEvents="none",F.style.boxSizing="border-box",F.style.left=`${u-(b.left?.space??0)}px`,F.style.right=`${E-(b.right?.space??0)}px`,F.style.top=`${-(R?.space??0)}px`,F.style.bottom=`${-(C?.space??0)}px`,R&&(F.style.borderTop=k(R)),C&&(F.style.borderBottom=k(C)),b.left&&(F.style.borderLeft=k(b.left)),b.right&&(F.style.borderRight=k(b.right)),(R||C||b.left||b.right)&&i.appendChild(F),b.bar){let L=a.createElement("div");L.style.position="absolute",L.style.left="-8px",L.style.top="0",L.style.bottom="0",L.style.borderLeft=k(b.bar),i.style.position="relative",i.appendChild(L);}}t.attrs?.shading&&(i.style.backgroundColor=t.attrs.shading);let f=e.width-u-E,I=t.runs[t.runs.length-1]?.kind==="lineBreak",c=n.lines.length,x$1=0;g?.hanging&&g.hanging>0?x$1=-g.hanging:g?.firstLine&&g.firstLine>0&&(x$1=g.firstLine);let T=r.renderedInlineImageKeys??new Set;for(let S=0;S<m.length;S++){let k=m[S],p=e.fromLine+S,h=p===c-1,R=p===0&&!e.continuesFromPrev,C=k.leftOffset??0,F=k.rightOffset??0,v=f;if(R){let M=g?.hanging&&g.hanging>0,$=g?.firstLine&&g.firstLine>0;M&&g?.hanging?v=f+g.hanging:$&&g?.firstLine&&(v=f-g.firstLine);}if(Gt(k,t)){let M=a.createElement("div");M.className=`${B.line} layout-line-split`,M.style.position="relative",M.style.height=`${k.lineHeight}px`,M.style.lineHeight=`${k.lineHeight}px`;for(let $ of k.segments){let we={fromRun:$.fromRun,fromChar:$.fromChar,toRun:$.toRun,toChar:$.toChar,width:$.width,ascent:k.ascent,descent:k.descent,lineHeight:k.lineHeight},_=ue(t,we,s,a,{availableWidth:$.availableWidth,isLastLine:h,isFirstLine:R,paragraphEndsWithLineBreak:I,tabStops:t.attrs?.tabs,leftIndentPx:u,firstLineIndentPx:R?x$1:0,context:o,renderedInlineImageKeys:T});_.className+=" layout-line-segment",_.style.position="absolute",_.style.left=`${$.leftOffset}px`,_.style.top="0",_.style.width=`${$.availableWidth}px`,M.appendChild(_);}i.appendChild(M);continue}let L=ue(t,k,s,a,{availableWidth:v-C-F,isLastLine:h,isFirstLine:R,paragraphEndsWithLineBreak:I,tabStops:t.attrs?.tabs,leftIndentPx:u,firstLineIndentPx:R?x$1:0,context:o,renderedInlineImageKeys:T,lineRightEdgePx:e.width-E-F});if(C>0||F>0){C>0&&(L.style.marginLeft=`${C}px`),F>0&&(L.style.marginRight=`${F}px`);let M=v-C-F;M>0&&(L.style.width=`${M}px`);}k.floatSkipBefore&&k.floatSkipBefore>0&&(L.style.marginTop=`${k.floatSkipBefore}px`);let P=g?.hanging&&g.hanging>0,Oe=g?.firstLine&&g.firstLine>0,xt=L.dataset.flexLine==="true";if(R?u>0&&P?(L.style.paddingLeft=`${u}px`,xt||(L.style.textIndent=`-${g.hanging}px`)):u>0&&Oe?(L.style.paddingLeft=`${u}px`,L.style.textIndent=`${g.firstLine}px`):u>0?L.style.paddingLeft=`${u}px`:Oe&&(L.style.textIndent=`${g.firstLine}px`):u>0?L.style.paddingLeft=`${u}px`:P&&(L.style.paddingLeft=`${g.hanging}px`),E>0&&(L.style.paddingRight=`${E}px`),R&&t.attrs?.listMarker&&!t.attrs?.listMarkerHidden){let M=g?.hanging??0,$=g?.firstLine??0,we=M>0?Math.max(0,u-M):u+$;L.style.paddingLeft=`${we}px`,L.style.textIndent="0";let{fontFamily:_,fontSize:St}=w(t),kt=Yt(t.attrs.listMarker,x(t),a,_,St,t.attrs.listMarkerRevision);L.insertBefore(kt,L.firstChild);}i.appendChild(L);}if((d||l)&&!e.continuesOnNext){let S=i.lastElementChild;if(S){let k=a.createElement("span");k.className="layout-revision-pmark-glyph",d?k.classList.add("layout-revision-ins"):k.classList.add("layout-revision-del"),k.textContent="\xB6",k.setAttribute("aria-hidden","true"),S.appendChild(k);}}return i}function Gt(e,t){return (e.segments?.length??0)>1&&!t.attrs?.listMarker}function Yt(e,t,n,o,r,a$1){let i=n.createElement("span");return i.className="layout-list-marker",i.style.fontFamily=a(o).cssFallback,i.style.fontSize=`${r*96/72}px`,i.style.textAlign="left",i.style.boxSizing="border-box",i.style.display="inline-block",i.style.minWidth=`${t}px`,i.textContent=e,a$1==="ins"?i.style.color="#2e7d32":a$1==="del"&&(i.style.color="#c62828",i.style.textDecoration="line-through"),i}function q(e,t,n){let o=t.createElement("div");o.className=n.layerClass,o.style.position="absolute",o.style.top="0",o.style.left="0",n.sizing==="inset0"?(o.style.right="0",o.style.bottom="0"):(o.style.width="100%",o.style.height="100%",o.style.overflow="hidden"),o.style.pointerEvents="none",n.layerMode==="front"&&(o.style.zIndex="10");for(let r of e){let a=t.createElement("div");a.className=n.itemClass,a.style.position="absolute",a.style.pointerEvents="auto",a.style.top=`${r.y}px`,a.style.left=`${r.x}px`,r.pmStart!==void 0&&(a.dataset.pmStart=String(r.pmStart)),r.pmEnd!==void 0&&(a.dataset.pmEnd=String(r.pmEnd));let i=t.createElement("img");i.src=r.src,i.style.width=`${r.width}px`,i.style.height=`${r.height}px`,i.style.display="block",i.style.maxWidth="none",i.style.maxHeight="none",r.alt&&(i.alt=r.alt),r.transform&&(i.style.transform=r.transform,i.style.transformOrigin="center center"),ne(r)&&oe(i,r),a.appendChild(i),o.appendChild(a);}return o}function ct(e$2,t,n){let o=[],r=0;for(let a=0;a<e$2.blocks.length;a++){let i=e$2.blocks[a];if(i?.kind!=="paragraph"){let m=t.blocks[a];m&&m.kind==="table"&&(r+=m.totalHeight??0);continue}let d=i;for(let m of d.runs){if(m.kind!=="image")continue;let s=m;if(!c(s))continue;let y=s.position,g=s.distTop??0,u=s.distBottom??0,E=s.distLeft??12,b=s.distRight??12,f="left",w=0;if(y?.horizontal){let c=y.horizontal;c.align==="right"?(f="right",w=n-s.width):c.align==="left"?w=0:c.align==="center"?w=(n-s.width)/2:c.posOffset!==void 0&&(w=e(c.posOffset),f=w>n/2?"right":"left");}else s.cssFloat==="right"&&(f="right",w=n-s.width);let I=r;if(y?.vertical){let c=y.vertical;c.posOffset!==void 0?I=r+e(c.posOffset):c.align==="top"&&(I=0);}w=Math.max(0,Math.min(w,n-s.width)),o.push({src:s.src,width:s.width,height:s.height,alt:s.alt,transform:s.transform,x:w,y:I,side:f,distTop:g,distBottom:u,distLeft:E,distRight:b,wrapText:e$1(s.cssFloat),wrapType:s.wrapType,pmStart:s.pmStart,pmEnd:s.pmEnd});}let l=t.blocks[a];l&&l.kind==="paragraph"&&(r+=l.totalHeight);}return o}function Re(e){return !!e&&e.style!=="none"&&e.style!=="nil"&&e.width!==0}function J(e,t,n){let o=`border${t.charAt(0).toUpperCase()+t.slice(1)}`;if(!Re(n))e.style[o]="none";else {let r=n.width??1,a=n.color??"#000000",i=n.style??"solid";e.style[o]=`${r}px ${i} ${a}`;}}function Ee(e){let t=[],n=0;for(let o of e)t.push(Math.round(n)),n+=o?.height??0;return t.push(Math.round(n)),t}function pt(e,t){let n=e.createElement("div");n.className="layout-table-cut-border",n.style.position="absolute",n.style.left=`${t.x}px`,n.style.width=`${t.width}px`;let o=t.border.width??1;return n.style.top=`${t.edge==="bottom"?t.topY-o:t.topY}px`,J(n,"top",t.border),n}function Le(e,t,n,o){e.classList.add(`ep-revision-${t}`,`ep-revision-${n}`),e.dataset.revisionId=String(o.revisionId),e.dataset.revisionAuthor=o.author,o.date&&(e.dataset.revisionDate=o.date);}var N={table:"layout-table",row:"layout-table-row",cell:"layout-table-cell",cellContent:"layout-table-cell-content",resizeHandle:"layout-table-resize-handle",rowResizeHandle:"layout-table-row-resize-handle",tableEdgeHandleBottom:"layout-table-edge-handle-bottom",tableEdgeHandleRight:"layout-table-edge-handle-right"};function jt(e,t,n,o){let r=o.createElement("div");r.className=N.cellContent,r.style.position="relative";let a=e.padding?.left??7,i=e.padding?.right??7,d=Math.max(0,t.width-a-i);r.style.width=`${d}px`;let l=ct(e,t,d),m;if(l.length>0){m=l.filter(a$2).map(E=>{let b=E.x+E.width+E.distRight,f=E.y-E.distTop,w=E.y+E.height+E.distBottom,I=0,c=0,x=E.wrapText??"bothSides";return x==="right"?I=b:x==="left"?c=d-(E.x-E.distLeft):E.side==="left"?I=b:c=d-(E.x-E.distLeft),{leftMargin:I,rightMargin:c,topY:f,bottomY:w}});let u=l.filter(b);u.length>0&&r.appendChild(q(u,o,{layerClass:"layout-cell-floating-images-layer",itemClass:"layout-cell-floating-image",sizing:"fullSize",layerMode:"behind"}));}let s=0,y=0;for(let u=0;u<e.blocks.length;u++){let E=e.blocks[u],b=t.blocks[u];if(E?.kind==="paragraph"&&b?.kind==="paragraph"){let f=E,w=b,I=f.attrs?.spacing,c=Math.max(y,I?.before??0);s+=c,m&&m.length>0&&(w=z$1(f,d,{floatingZones:m,paragraphYOffset:s}));let x={blockId:f.id,width:d,height:w.totalHeight,fromLine:0,toLine:w.lines.length,pmStart:f.pmStart,pmEnd:f.pmEnd},T={...n,insideTableCell:true},S=z(x,f,w,T,{document:o});S.style.position="relative",c>0&&(S.style.marginTop=`${c}px`),r.appendChild(S),s+=w.totalHeight,y=I?.after??0;}else if(E?.kind==="table"&&b?.kind==="table"){let f=E,w=b,I=y,c=Kt(f,w,n,o);c.style.position="relative",I>0&&(c.style.marginTop=`${I}px`),r.appendChild(c),s+=I+(b.totalHeight??0),y=0;}}y>0&&(r.style.paddingBottom=`${y}px`);let g=l.filter(u=>!b(u));return g.length>0&&r.appendChild(q(g,o,{layerClass:"layout-cell-floating-images-layer",itemClass:"layout-cell-floating-image",sizing:"fullSize",layerMode:"front"})),r}function Kt(e,t,n,o){let r=o.createElement("div");r.className=`${N.table} layout-nested-table`,r.style.position="relative",r.style.width=`${t.totalWidth}px`,r.style.display="block",e.justification==="center"?(r.style.marginLeft="auto",r.style.marginRight="auto"):e.justification==="right"?r.style.marginLeft="auto":e.indent&&(r.style.marginLeft=`${e.indent}px`),r.dataset.blockId=String(e.id),e.pmStart!==void 0&&(r.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(r.dataset.pmEnd=String(e.pmEnd));let a=e.rows[0],i=a?.trackedIns,d=a?.trackedDel,l=(g,u)=>!!g&&!!u&&(g.author??"")===(u.author??"")&&(g.date??null)===(u.date??null),m=e.rows.length>0&&e.rows.every(g=>i?l(g.trackedIns,i):d?l(g.trackedDel,d):false);if(m){let g=i??d,u=i?"ins":"del";r.classList.add("ep-revision-table",`ep-revision-${u}`),r.dataset.revisionId=String(g.revisionId),r.dataset.revisionAuthor=g.author,g.date&&(r.dataset.revisionDate=g.date);}let s=Ee(t.rows),y=new Map;for(let g=0;g<e.rows.length;g++){let u=e.rows[g],E=t.rows[g];if(!u||!E)continue;let b=ve(u,E,g,s[g]??0,t.columnWidths,e.rows.length,n,o,y,s,void 0,m);r.appendChild(b);}return r.style.height=`${s[e.rows.length]??0}px`,r}function ft(e,t,n,o,r,a,i,d){let l=i.createElement("div");l.className=N.cell,e.trackedMarker&&e.trackedMarker.info.revisionId!==d&&Le(l,"cell",e.trackedMarker.kind,e.trackedMarker.info),l.style.position="absolute",l.style.left=`${n}px`,l.style.top="0",l.style.width=`${t.width}px`,l.style.height=`${o}px`,l.style.overflow="hidden",l.style.boxSizing="border-box";let m=e.padding?.top??1,s=e.padding?.right??7,y=e.padding?.bottom??1,g=e.padding?.left??7;l.style.padding=`${m}px ${s}px ${y}px ${g}px`,e.borders&&(r.isFirstRow&&J(l,"top",e.borders.top),J(l,"right",e.borders.right),J(l,"bottom",e.borders.bottom),r.isFirstCol&&J(l,"left",e.borders.left)),e.background&&(l.style.backgroundColor=e.background),e.noWrap&&(l.style.whiteSpace="nowrap");let u=(t.height??0)>=o-.5;if(e.verticalAlign&&!u)switch(l.style.display="flex",l.style.flexDirection="column",e.verticalAlign){case "top":l.style.justifyContent="flex-start";break;case "center":l.style.justifyContent="center";break;case "bottom":l.style.justifyContent="flex-end";break}let E=jt(e,t,a,i);if(l.appendChild(E),e.blocks.length>0){let b=e.blocks[0],f=e.blocks[e.blocks.length-1];b&&"pmStart"in b&&b.pmStart!==void 0&&(l.dataset.pmStart=String(b.pmStart)),f&&"pmEnd"in f&&f.pmEnd!==void 0&&(l.dataset.pmEnd=String(f.pmEnd));}return l}function Vt(e,t){return b$1(e).map(n=>{let o=0;for(let r=0;r<n.columnIndex;r++)o+=t[r]??0;return {rowIndex:n.rowIndex,cellIndex:n.cellIndex,columnIndex:n.columnIndex,x:o,colSpan:n.colSpan,rowSpan:n.rowSpan,cell:e.rows[n.rowIndex].cells[n.cellIndex]}})}function ve(e,t,n,o,r,a,i,d,l,m,s,y){let g=d.createElement("div");g.className=N.row,y||(e.trackedDel?Le(g,"row","del",e.trackedDel):e.trackedIns&&Le(g,"row","ins",e.trackedIns));let u=m&&m.length>n+1?(m[n+1]??0)-(m[n]??0):t.height;g.style.position="absolute",g.style.left="0",g.style.top=`${o}px`,g.style.width="100%",g.style.height=`${u}px`,g.dataset.rowIndex=String(n);let E=new Set;if(l){for(let[,w]of l)if(w.startRow<n&&w.startRow+w.rowSpan>n)for(let I=0;I<w.colSpan;I++)E.add(w.columnIndex+I);}let b=0,f=0;for(;E.has(f);)b+=r[f]??0,f++;for(let w=0;w<e.cells.length;w++){let I=e.cells[w],c=t.cells[w];if(!I||!c)continue;let x=I.colSpan??1,T=I.rowSpan??1,S=u;if(T>1&&m){S=0;for(let F=n;F<n+T&&F<m.length-1;F++)S+=(m[F+1]??0)-(m[F]??0);S===0&&(S=t.height*T);}let k=n===0||s===true,h=f===0;f+x>=r.length;let C=ft(I,c,b,S,{isFirstRow:k,isFirstCol:h},i,d,e.trackedIns?.revisionId??e.trackedDel?.revisionId);if(C.dataset.cellIndex=String(w),C.dataset.columnIndex=String(f),T>1&&(C.dataset.rowSpan=String(T)),g.appendChild(C),T>1&&l){let F=`${n}-${f}`;l.set(F,{cell:I,cellMeasure:c,columnIndex:f,startRow:n,rowSpan:T,colSpan:x,x:b,totalHeight:S});}for(let F=0;F<x&&f+F<r.length;F++)b+=r[f+F]??0;for(f+=x;E.has(f);)b+=r[f]??0,f++;}return g}function Q(e,t,n,o,r={}){let a=r.document??document,i=a.createElement("div");i.className=N.table,i.style.position=o.positioning==="flow"?"relative":"absolute",i.style.width=`${e.width}px`,i.style.overflow="hidden",i.dataset.blockId=String(e.blockId),i.dataset.fromRow=String(e.fromRow),i.dataset.toRow=String(e.toRow),e.pmStart!==void 0&&(i.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(i.dataset.pmEnd=String(e.pmEnd));let d=t.rows[0],l=d?.trackedIns,m=d?.trackedDel,s=(p,h)=>!!p&&!!h&&(p.author??"")===(h.author??"")&&(p.date??null)===(h.date??null),y=t.rows.length>0&&t.rows.every(p=>l?s(p.trackedIns,l):m?s(p.trackedDel,m):false);if(y){let p=l??m,h=l?"ins":"del";i.classList.add("ep-revision-table",`ep-revision-${h}`),i.dataset.revisionId=String(p.revisionId),i.dataset.revisionAuthor=p.author,p.date&&(i.dataset.revisionDate=p.date),i.style.overflowX="visible",i.style.overflowY="hidden";}let g=0;for(let p=0;p<n.columnWidths.length-1;p++){g+=n.columnWidths[p]??0;let h=a.createElement("div");h.className=N.resizeHandle,h.style.position="absolute",h.style.left=`${g-3}px`,h.style.top="0",h.style.width="6px",h.style.height="100%",h.style.cursor="col-resize",h.style.zIndex="10",h.dataset.columnIndex=String(p),h.dataset.tableBlockId=String(e.blockId),e.pmStart!==void 0&&(h.dataset.tablePmStart=String(e.pmStart)),i.appendChild(h);}let u=Ee(n.rows),E=Vt(t,n.columnWidths),b=e.headerRowCount??0,f=0;if(b>0&&e.continuesFromPrev){let p=new Map;for(let h=0;h<b;h++){let R=t.rows[h],C=n.rows[h];if(!R||!C)continue;let F=ve(R,C,h,f,n.columnWidths,t.rows.length,o,a,p,u,h===0,y);F.dataset.repeatedHeader="true",i.appendChild(F),f+=C.height;}}let w=(u[e.fromRow]??0)+(e.topClip??0),I=p=>f+(p-w),c=e.bottomClip!==void 0?Math.round(e.height):I(u[e.toRow]??0);i.style.height=`${c}px`;let x=new Map,T=b>0&&e.continuesFromPrev;for(let p of E){if(p.rowSpan<=1||p.rowIndex>=e.fromRow||p.rowIndex+p.rowSpan<=e.fromRow||T&&p.rowIndex<b)continue;let h=n.rows[p.rowIndex]?.cells?.[p.cellIndex];if(!h)continue;let R=0;for(let P=p.rowIndex;P<p.rowIndex+p.rowSpan&&P<u.length-1;P++)R+=(u[P+1]??0)-(u[P]??0);x.set(`${p.rowIndex}-${p.columnIndex}`,{cell:p.cell,cellMeasure:h,columnIndex:p.columnIndex,startRow:p.rowIndex,rowSpan:p.rowSpan,colSpan:p.colSpan,x:p.x,totalHeight:R});p.rowIndex+p.rowSpan>=t.rows.length;let F=p.columnIndex===0;p.columnIndex+p.colSpan>=n.columnWidths.length;let L=ft(p.cell,h,p.x,R,{isFirstRow:false,isFirstCol:F},o,a);L.style.top=`${I(u[p.rowIndex]??0)}px`,L.dataset.columnIndex=String(p.columnIndex),L.dataset.vmergeContinuation="true",delete L.dataset.pmStart,delete L.dataset.pmEnd,i.appendChild(L);}for(let p=e.fromRow;p<e.toRow;p++){let h=t.rows[p],R=n.rows[p];if(!h||!R)continue;let C=b>0&&e.continuesFromPrev?false:e.continuesFromPrev&&p===e.fromRow&&!e.topClip,F=ve(h,R,p,I(u[p]??0),n.columnWidths,t.rows.length,o,a,x,u,C,y);i.appendChild(F);}let S=(p,h,R,C)=>{for(let F of E){if(F.rowIndex>p||F.rowIndex+F.rowSpan-1<p||C&&!(h==="bottom"?F.rowIndex+F.rowSpan-1>p:F.rowIndex<p))continue;let v=F.cell.borders?.[h];if(!Re(v))continue;let L=0;for(let P=0;P<F.colSpan;P++)L+=n.columnWidths[F.columnIndex+P]??0;i.appendChild(pt(a,{x:F.x,topY:R,width:L,edge:h,border:v}));}};e.topClip?S(e.fromRow,"top",f,false):e.continuesFromPrev&&S(e.fromRow,"top",f,true),e.bottomClip!==void 0?S(e.toRow-1,"bottom",c,false):e.continuesOnNext&&S(e.toRow-1,"bottom",c,true);for(let p=e.fromRow;p<e.toRow-1;p++){let h=I(u[p+1]??0);if(h<=f||h>=e.height)continue;let R=a.createElement("div");R.className=N.rowResizeHandle,R.style.position="absolute",R.style.left="0",R.style.top=`${h-3}px`,R.style.width="100%",R.style.height="6px",R.style.cursor="row-resize",R.style.zIndex="10",R.dataset.rowIndex=String(p),R.dataset.tableBlockId=String(e.blockId),e.pmStart!==void 0&&(R.dataset.tablePmStart=String(e.pmStart)),i.appendChild(R);}let k=e.toRow===t.rows.length&&e.bottomClip===void 0;if(k){let p=a.createElement("div");p.className=N.tableEdgeHandleBottom,p.style.position="absolute",p.style.left="0",p.style.top=`${I(u[e.toRow]??0)-3}px`,p.style.width="100%",p.style.height="6px",p.style.cursor="row-resize",p.style.zIndex="10",p.dataset.rowIndex=String(t.rows.length-1),p.dataset.tableBlockId=String(e.blockId),p.dataset.isEdge="bottom",e.pmStart!==void 0&&(p.dataset.tablePmStart=String(e.pmStart)),i.appendChild(p);}if(k){let p=n.columnWidths.reduce((R,C)=>R+C,0),h=a.createElement("div");h.className=N.tableEdgeHandleRight,h.style.position="absolute",h.style.left=`${p-3}px`,h.style.top="0",h.style.width="6px",h.style.height="100%",h.style.cursor="col-resize",h.style.zIndex="10",h.dataset.columnIndex=String(n.columnWidths.length-1),h.dataset.tableBlockId=String(e.blockId),h.dataset.isEdge="right",e.pmStart!==void 0&&(h.dataset.tablePmStart=String(e.pmStart)),i.appendChild(h);}return i}var Ut={textBox:"layout-textbox"};function ee(e,t,n,o,r={}){let a=r.document??document,i=a.createElement("div");if(i.className=Ut.textBox,i.style.position="absolute",i.style.width=`${e.width}px`,i.style.height=`${e.height}px`,i.style.overflow="hidden",i.style.boxSizing="border-box",Xt(i,e),t.fillColor&&(i.style.backgroundColor=t.fillColor),t.outlineWidth&&t.outlineWidth>0){let s=t.outlineStyle||"solid",y=t.outlineColor||"#000000";i.style.border=`${t.outlineWidth}px ${s} ${y}`;}let d=t.margins??a$1;i.style.padding=`${d.top}px ${d.right}px ${d.bottom}px ${d.left}px`,i.dataset.blockId=String(e.blockId),e.pmStart!==void 0&&(i.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(i.dataset.pmEnd=String(e.pmEnd));let l=e.width-d.left-d.right,m=0;for(let s=0;s<t.content.length;s++){let y=t.content[s],g=n.innerMeasures[s];if(!g)continue;let u={blockId:y.id,width:l,height:g.totalHeight,pmStart:y.pmStart,pmEnd:y.pmEnd,fromLine:0,toLine:g.lines.length},E=z(u,y,g,{...o,positioning:"flow"},{document:a});i.appendChild(E),m+=g.totalHeight;}return i}function Xt(e,t){!t.isFloating&&t.zIndex===void 0||(e.style.zIndex=String(t.zIndex??10));}var qt="layout-watermark-layer";function Zt(e,t){let n=Math.max(e.trim().length,1),o=t/(n*.62);return Math.max(24,Math.min(o,180))}function Jt(e,t,n){let o=n.createElement("div");o.style.position="absolute",o.style.top="50%",o.style.left="50%",o.style.whiteSpace="nowrap",o.style.fontWeight="bold",o.style.color=e.color,o.style.fontFamily=a(e.font).cssFallback,o.style.userSelect="none";let r=t.size.w-t.margins.left-t.margins.right,a$1=e.layout==="diagonal"?r*1.3:r,i=e.fontSize!==void 0?e.fontSize*96/72:Zt(e.text,a$1);o.style.fontSize=`${i}px`,o.style.lineHeight="1",o.style.opacity=e.semitransparent?"0.5":"0.85";let d=e.layout==="diagonal"?-45:0;return o.style.transform=`translate(-50%, -50%) rotate(${d}deg)`,o.style.transformOrigin="center center",o.textContent=e.text,o}function Qt(e,t,n){if(!e.dataUrl)return null;let o=n.createElement("img");o.src=e.dataUrl,o.alt="",o.style.position="absolute",o.style.top="50%",o.style.left="50%",o.style.transform="translate(-50%, -50%)";let r=t.size.w-t.margins.left-t.margins.right,a=e.widthEmu!==void 0?e.widthEmu/(914400/96):r*.75;return o.style.width=`${a*(e.scale||1)}px`,o.style.height="auto",e.washout&&(o.style.opacity="0.5",o.style.filter="brightness(1.4) contrast(0.4)"),o}function gt(e,t,n=document){let o=e.kind==="text"?Jt(e,t,n):Qt(e,t,n);if(!o)return null;let r=n.createElement("div");return r.className=qt,r.setAttribute("aria-hidden","true"),r.style.position="absolute",r.style.inset="0",r.style.overflow="hidden",r.style.pointerEvents="none",r.style.zIndex="0",r.appendChild(o),r}function mt(e){return e?.align??e?.alignment}function en(e$1,t){let n=e$1.position.vertical;if(!n)return e$1.paragraphY;let o=mt(n),r=n.posOffset!==void 0?e(n.posOffset):void 0;if(n.relativeTo==="page"){if(r!==void 0)return r-t.flowTop;if(o==="top")return -t.flowTop;if(o==="bottom")return t.pageHeight-e$1.height-t.flowTop;if(o==="center")return (t.pageHeight-e$1.height)/2-t.flowTop}if(n.relativeTo==="margin"){let a=t.margins.top,i=t.pageHeight-t.margins.top-t.margins.bottom;if(r!==void 0)return a+r-t.flowTop;if(o==="top")return a-t.flowTop;if(o==="bottom")return a+i-e$1.height-t.flowTop;if(o==="center")return a+(i-e$1.height)/2-t.flowTop}return r!==void 0?e$1.paragraphY+r:e$1.paragraphY}function Pe(e$1,t,n){if(!t)return "0";let o=mt(t);if(t.relativeTo==="page"){if(t.posOffset!==void 0)return `${e(t.posOffset)-n.flowLeft}px`;if(o==="right")return `${n.pageWidth-e$1-n.flowLeft}px`;if(o==="center")return `${(n.pageWidth-e$1)/2-n.flowLeft}px`;if(o==="left")return `${-n.flowLeft}px`}return t.posOffset!==void 0?`${e(t.posOffset)}px`:o==="right"?`${n.contentWidth-e$1}px`:o==="center"?`${(n.contentWidth-e$1)/2}px`:"0"}function tn(e,t,n){e.style.left=Pe(t.width,t.position.horizontal,n);}function ut(e,t){let n=e.tblpY??0;e.vertAnchor==="page"?n-=t.flowTop:e.vertAnchor==="margin"&&(n+=t.margins.top-t.flowTop);let o=e.tblpX??0;return e.horzAnchor==="page"?o-=t.flowLeft:e.horzAnchor==="margin"&&(o+=t.margins.left-t.flowLeft),{left:o,top:n}}function Be(e,t,n,o){let r=n.document??document,a=r.createElement("div");a.style.position="relative";let i=t.contentWidth??600,d=[],l=0;for(let m=0;m<e.blocks.length;m++){let s=e.blocks[m],y=e.measures[m];if(!(!s||!y))if(s.kind==="paragraph"){if(y.kind!=="paragraph")continue;let g=s,u=y,E=g.attrs?.spacing?.before??0,b=l,f=[];for(let x of g.runs)if(x.kind==="image"&&"position"in x&&x.position){let T=x;d.push({src:T.src,width:T.width,height:T.height,alt:T.alt,paragraphY:b,position:T.position});}else f.push(x);let w={...g,runs:f},I={blockId:g.id,width:i,height:u.totalHeight,fromLine:0,toLine:u.lines.length,pmStart:g.pmStart,pmEnd:g.pmEnd},c=z(I,w,u,{...t,positioning:"absolute"},{document:r});c.style.top=`${l+E}px`,c.style.left="0",c.style.width=`${i}px`,a.appendChild(c),l+=u.totalHeight;}else if(s.kind==="table"){if(y.kind!=="table")continue;let g={blockId:s.id,width:y.totalWidth,height:y.totalHeight,fromRow:0,toRow:y.rows.length,pmStart:s.pmStart,pmEnd:s.pmEnd},u=Q(g,s,y,{...t,positioning:"absolute"},{document:r});if(s.floating){let{left:E,top:b}=ut(s.floating,o);u.style.top=`${b}px`,u.style.left=`${E}px`,a.appendChild(u);}else u.style.top=`${l}px`,u.style.left="0",a.appendChild(u),l+=y.totalHeight;}else if(s.kind==="image"){if(y.kind!=="image")continue;let g={blockId:s.id,width:y.width,height:y.height,pmStart:s.pmStart,pmEnd:s.pmEnd},u=Z(g,s,y,{...t},{document:r});u.style.top=`${l}px`,u.style.left="0",a.appendChild(u),l+=y.height;}else if(s.kind==="textBox"){if(y.kind!=="textBox")continue;let g={blockId:s.id,width:y.width,height:y.height,pmStart:s.pmStart,pmEnd:s.pmEnd},u=ee(g,s,y,{...t,positioning:"absolute"},{document:r});u.style.top=`${l}px`,u.style.left=Pe(y.width,s.position?.horizontal,o),a.appendChild(u),l+=y.height;}else s.kind==="sectionBreak"||s.kind==="pageBreak"||s.kind==="columnBreak"||c$3(s,"renderHeaderFooterContent");}for(let m of d){let s=r.createElement("img");s.src=m.src,s.width=m.width,s.height=m.height,m.alt&&(s.alt=m.alt),s.style.position="absolute",s.style.display="block",s.style.width=`${m.width}px`,s.style.height=`${m.height}px`,s.style.maxWidth="none",s.style.maxHeight="none",tn(s,m,o),s.style.top=`${en(m,o)}px`,a.appendChild(s);}return a}var ye=12,Me=6;function nn(e,t){if(e.size!==t.size)return false;for(let[n,o]of e)if(t.get(n)!==o)return false;return true}function on(e,t){for(let[n,o]of t)if((e.get(n)??0)<o)return false;return true}function rn(e,t){let n=new Map(e);for(let[o,r]of t)n.set(o,Math.max(n.get(o)??0,r));return n}var $e=8;function To(e){let t=[],n=o=>{for(let r of o)if(r.kind==="paragraph")for(let a of r.runs)a.kind==="text"&&a.footnoteRefId!=null&&t.push({footnoteId:a.footnoteRefId,pmPos:a.pmStart??0});else if(r.kind==="table")for(let a of r.rows)for(let i of a.cells)n(i.blocks);else r.kind==="textBox"&&n(r.content);};return n(e),t}function he(e,t){let n=new Map;if(t.length===0)return n;for(let o of t)for(let r of e){let a=false;for(let i of r.fragments){let d=i.pmStart??-1,l=i.pmEnd??-1;if(d>=0&&l>=0&&o.pmPos>=d&&o.pmPos<l){let m=n.get(r.number)??[];m.includes(o.footnoteId)||m.push(o.footnoteId),n.set(r.number,m),a=true;break}}if(a)break}return n}function an(e,t){if(e.length===0)return [{kind:"paragraph",id:`fn-empty-${t}`,runs:[{kind:"text",text:`${t} `,fontSize:$e,superscript:true}]}];let n=e.map(r=>{if(r.kind!=="paragraph")return r;let a=r;return {...a,runs:a.runs.map(i=>(i.kind==="text"||i.kind==="tab")&&i.fontSize==null?{...i,fontSize:$e}:i)}}),o=n[0];if(o.kind==="paragraph"){let r={kind:"text",text:`${t} `,fontSize:$e,superscript:true};n[0]={...o,runs:[r,...o.runs]};}return n}function sn(e,t,n,o){let r=c$1(e.content,{styles:o.styles??void 0,theme:o.theme??null,defaultTabStopTwips:o.defaultTabStopTwips??null}),a=c$2(r,{theme:o.theme??void 0}),i=an(a,t),d=o.measureBlocks(i,n),l=d.reduce((m,s)=>s.kind==="paragraph"||s.kind==="table"?m+s.totalHeight:s.kind==="image"||s.kind==="textBox"?m+s.height:m,0);return {id:e.id,displayNumber:t,blocks:i,measures:d,height:l}}function Fo(e,t,n,o){let r=new Map,a=new Map;for(let l of e)(l.noteType==="normal"||l.noteType==null)&&a.set(l.id,l);let i=1,d=new Set;for(let l of t){if(d.has(l.footnoteId))continue;d.add(l.footnoteId);let m=a.get(l.footnoteId);m&&(r.set(l.footnoteId,sn(m,i,n,o)),i++);}return r}function He(e,t){let n=new Map;for(let[o,r]of e){let a=0;for(let i of r){let d=t.get(i);d&&(a+=d.height);}a>0&&(a+=ye,n.set(o,a));}return n}function Io(e){let{blocks:t,measures:n,layoutOpts:o,footnoteRefs:r,footnoteContentMap:a,initialLayout:i}=e,d=he(i.pages,r),l=He(d,a);if(l.size===0)return {layout:i,pageFootnoteMap:d,converged:true};let m=i,s=false;for(let y=0;y<Me;y++){m=U$1(t,n,{...o,footnoteReservedHeights:l});let g=he(m.pages,r),u=He(g,a);if(d=g,nn(l,u)){l=u,s=true;break}l=u;}if(!s){let y=l,g=false;for(let u=0;u<Me;u++){m=U$1(t,n,{...o,footnoteReservedHeights:y}),d=he(m.pages,r);let E=He(d,a);if(on(y,E)){g=true;break}y=rn(y,E);}g||(m=U$1(t,n,{...o,footnoteReservedHeights:y}),d=he(m.pages,r)),console.warn(`[docx-editor] footnote layout did not stabilize within ${Me} passes; settling with conservative page reservations. If footnotes appear misplaced, please file a bug with the document.`);}for(let[y,g]of d){let u=m.pages.find(E=>E.number===y);u&&(u.footnoteIds=g);}return {layout:m,pageFootnoteMap:d,converged:s}}function Co(e,t,n){let o=new Map;if(!n?.package?.footnotes)return o;let r=new Map;for(let a of n.package.footnotes)a.noteType&&a.noteType!=="normal"||r.set(a.id,a);for(let[a,i]of e){let d=[];for(let l of i){let m=r.get(l);if(!m)continue;let s=t.get(l),y=s?.displayNumber??0;d.push({displayNumber:String(y),text:x$1(m),content:s});}d.length>0&&o.set(a,d);}return o}function ln(e,t,n,o){let r=o.createElement("div");r.className="layout-footnote-content",r.style.position="relative",r.style.width=`${t}px`,r.style.height=`${e.height}px`;let a=0;for(let i=0;i<e.blocks.length;i++){let d=e.blocks[i],l=e.measures[i];if(!(!d||!l)){if(d.kind==="paragraph"&&l.kind==="paragraph"){let m=d.attrs?.spacing?.before??0,s={blockId:d.id,width:t,height:l.totalHeight,pmStart:d.pmStart,pmEnd:d.pmEnd,fromLine:0,toLine:l.lines.length},y=z(s,d,l,{...n,section:"body",contentWidth:t,positioning:"absolute"},{document:o});y.style.top=`${a+m}px`,y.style.left="0",y.style.width=`${t}px`,y.style.height=`${l.totalHeight}px`,r.appendChild(y),a+=l.totalHeight;}else if(d.kind==="table"&&l.kind==="table"){let m={blockId:d.id,width:l.totalWidth,height:l.totalHeight,pmStart:d.pmStart,pmEnd:d.pmEnd,fromRow:0,toRow:l.rows.length},s=Q(m,d,l,{...n,section:"body",contentWidth:t,positioning:"absolute"},{document:o});s.style.top=`${a}px`,s.style.left="0",r.appendChild(s),a+=l.totalHeight;}else if(d.kind==="image"&&l.kind==="image"){let m={blockId:d.id,width:l.width,height:l.height,pmStart:d.pmStart,pmEnd:d.pmEnd},s=Z(m,d,l,{...n},{document:o});s.style.top=`${a}px`,s.style.left="0",r.appendChild(s),a+=l.height;}else if(d.kind==="textBox"&&l.kind==="textBox"){let m={blockId:d.id,width:l.width,height:l.height,pmStart:d.pmStart,pmEnd:d.pmEnd},s=ee(m,d,l,{...n,section:"body",contentWidth:t,positioning:"absolute"},{document:o});s.style.top=`${a}px`,s.style.left="0",r.appendChild(s),a+=l.height;}}}return r}function dn(e,t){let n=t.createElement("div");n.style.fontSize="10px",n.style.lineHeight="1.3",n.style.marginBottom="4px",n.style.color="#000";let o=t.createElement("sup");o.textContent=e.displayNumber,o.style.fontSize="7px",o.style.marginRight="2px",n.appendChild(o);let r=t.createTextNode(" "+e.text);return n.appendChild(r),n}function ht(e){let t=ye;for(let n of e)n.content&&(t+=n.content.height);return t}function yt(e,t,n,o){let r=o.createElement("div");r.className="layout-footnote-area",r.style.width=`${t}px`;let a=o.createElement("div"),i=.5,d=(ye-i)/2;a.style.width="33%",a.style.height=`${i}px`,a.style.backgroundColor="#000",a.style.marginBottom=`${d}px`,a.style.marginTop=`${d}px`,r.appendChild(a);for(let l of e)r.appendChild(l.content?ln(l.content,t,n,o):dn(l,o));return r}function Ae(e,t,n){let o={pageNumber:e.number,totalPages:t,section:"body",resolvedCommentIds:n.resolvedCommentIds},r={...n};if(n.titlePg&&e.number===1&&(r.headerContent=n.firstPageHeaderContent,r.footerContent=n.firstPageFooterContent),n.footnotesByPage){let a=n.footnotesByPage.get(e.number);a&&a.length>0&&(r.footnoteArea=a);}return {context:o,pageOptions:r}}function bt(e){let t=[];t.push(`s:${e.size.w},${e.size.h}`),t.push(`m:${e.margins.top},${e.margins.right},${e.margins.bottom},${e.margins.left}`),t.push(`n:${e.number}`),e.footnoteReservedHeight&&t.push(`fn:${e.footnoteReservedHeight}`);for(let n of e.fragments){let o=`${n.kind}:${n.blockId},${n.x},${n.y},${n.width},${n.height}`;n.pmStart!==void 0&&(o+=`,ps:${n.pmStart}`),n.pmEnd!==void 0&&(o+=`,pe:${n.pmEnd}`),n.kind==="paragraph"?o+=`,fl:${n.fromLine},tl:${n.toLine}`:n.kind==="table"&&(o+=`,fr:${n.fromRow},tr:${n.toRow}`),t.push(o);}return t.join("|")}function cn(e){let t=[];return e.headerContent&&t.push(`hdr:${e.headerContent.blocks.length},${e.headerContent.height},${e.headerContent.visualTop??0},${e.headerContent.visualBottom??e.headerContent.height}`),e.footerContent&&t.push(`ftr:${e.footerContent.blocks.length},${e.footerContent.height},${e.footerContent.visualTop??0},${e.footerContent.visualBottom??e.footerContent.height}`),e.firstPageHeaderContent&&t.push(`fp-hdr:${e.firstPageHeaderContent.blocks.length},${e.firstPageHeaderContent.height}`),e.firstPageFooterContent&&t.push(`fp-ftr:${e.firstPageFooterContent.blocks.length},${e.firstPageFooterContent.height}`),e.titlePg&&t.push("titlePg"),e.theme&&t.push(`thm:${e.theme.name??"default"}`),e.pageBorders&&t.push(`pb:${JSON.stringify(e.pageBorders)}`),e.headerDistance!==void 0&&t.push(`hd:${e.headerDistance}`),e.footerDistance!==void 0&&t.push(`fd:${e.footerDistance}`),t.join("|")}function pn(e,t){e.style.display="flex",e.style.flexDirection="column",e.style.alignItems="center",e.style.gap=`${t}px`,e.style.padding=`${t}px`,e.style.backgroundColor="var(--doc-bg, #f8f9fa)";}var be=2,fn=8;function gn(e,t,n={}){let o=e.length,r=n.pageGap??24,a=t,i=a.__pageRenderState,d=cn(n),l=o>=fn;if(i&&i.optionsHash===d&&l){let f=i.pageStates,w=i.pageDataMap,I=a.__pageObserver,c=[];for(let S of e)c.push(bt(S));let x=i.totalPages!==o,T=Math.min(f.length,e.length);for(let S=0;S<T;S++){let k=f[S],p=c[S];if(k.fingerprint===p&&!x){let C=w.get(k.element);C&&(C.page=e[S]);continue}let h=k.element,R=w.get(h);R&&(R.page=e[S],R.rendered&&mn(h,w,o,n)),k.fingerprint=p,se(h,e[S].size.w,e[S].size.h,n),h.dataset.pageNumber=String(e[S].number);}if(e.length>f.length){let S=n.document??document;for(let k=f.length;k<e.length;k++){let p=e[k],h=S.createElement("div");h.className=n.pageClassName??W.page,h.dataset.pageNumber=String(p.number),h.dataset.pageIndex=String(k),se(h,p.size.w,p.size.h,n),t.appendChild(h),f.push({element:h,fingerprint:c[k]}),w.set(h,{page:p,index:k,rendered:false}),I&&I.observe(h);}}if(e.length<f.length){for(let S=f.length-1;S>=e.length;S--){let k=f[S].element;I&&I.unobserve(k),w.delete(k),t.removeChild(k);}f.length=e.length;}for(let S=0;S<f.length;S++){let k=w.get(f[S].element);k&&(k.index=S);}return i.totalPages=o,i.currentOptions=n,"incremental"}let s=a.__pageObserver;s&&(s.disconnect(),a.__pageObserver=void 0),t.innerHTML="",a.__pageRenderState=void 0,pn(t,r);let y=[],g=[];for(let f=0;f<e.length;f++){let w=e[f];if(g.push(bt(w)),l){let c=(n.document??document).createElement("div");c.className=n.pageClassName??W.page,c.dataset.pageNumber=String(w.number),c.dataset.pageIndex=String(f),se(c,w.size.w,w.size.h,n),t.appendChild(c),y.push(c);}else {let{context:I,pageOptions:c}=Ae(w,o,n),x=xe(w,I,c);t.appendChild(x),y.push(x);}}if(!l)return "full";let u=new Map;for(let f=0;f<e.length;f++)u.set(y[f],{page:e[f],index:f,rendered:false});let E=new IntersectionObserver(f=>{let w=a.__pageRenderState;if(!w)return;let{currentOptions:I,totalPages:c,pageDataMap:x}=w;for(let p of f){let h=p.target,R=x.get(h);if(R&&p.isIntersecting){ae(h,x,c,I);for(let C=-be;C<=be;C++){let F=R.index+C;F>=0&&F<w.pageStates.length&&F!==R.index&&ae(w.pageStates[F].element,x,c,I);}}}let T=window.innerHeight,S=T*3,k=new Set;for(let[p,h]of x){if(!h.rendered)continue;let R=p.getBoundingClientRect();R.bottom>-S&&R.top<T+S&&k.add(h.index);}for(let[p,h]of x){if(!h.rendered)continue;let R=false;for(let C of k)if(Math.abs(h.index-C)<=be+1){R=true;break}!R&&k.size>0&&un(p,x);}},{root:null,rootMargin:"1500px 0px 1500px 0px"});for(let f of y)E.observe(f);a.__pageObserver=E,a.__pageRenderState={pageStates:y.map((f,w)=>({element:f,fingerprint:g[w]})),totalPages:o,optionsHash:d,pageDataMap:u,currentOptions:n};let b=Math.min(e.length,be+3);for(let f=0;f<b;f++)ae(y[f],u,o,n);return "full"}function ae(e,t,n,o){let r=t.get(e);if(!r||r.rendered)return;let{context:a,pageOptions:i}=Ae(r.page,n,o),d=xe(r.page,a,i);for(;d.firstChild;)e.appendChild(d.firstChild);r.rendered=true;}function mn(e,t,n,o){let r=t.get(e);if(!r)return;let{context:a,pageOptions:i}=Ae(r.page,n,o),l=xe(r.page,a,i).querySelector(`.${W.content}`),m=e.querySelector(`.${W.content}`);l&&m?e.replaceChild(l,m):(e.innerHTML="",r.rendered=false,ae(e,t,n,o));}function un(e,t){let n=t.get(e);!n||!n.rendered||(e.innerHTML="",n.rendered=false);}function hn(e){let n=e.__pageRenderState;if(!n)return 0;let{pageStates:o,totalPages:r,currentOptions:a,pageDataMap:i}=n,d=0;for(let{element:l}of o){let m=i.get(l);!m||m.rendered||(ae(l,i,r,a),d++);}return d}var W={page:"layout-page",content:"layout-page-content",header:"layout-page-header",footer:"layout-page-footer"};function se(e,t,n,o){e.style.position="relative",e.style.width=`${t}px`,e.style.height=`${n}px`,e.style.backgroundColor=o.backgroundColor??"#ffffff",e.style.overflow="hidden",e.style.fontFamily=a("Calibri").cssFallback,e.style.fontSize=`${1056/72}px`,e.style.color="#000000",o.showBorders&&(e.style.border="1px solid #ccc"),o.showShadow&&(e.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.15)");}function yn(e,t){switch(t??"allPages"){case "firstPage":return e===1;case "notFirstPage":return e!==1;default:return true}}function Se(e){return e?.space!==void 0?i(e.space):0}function ke(e,t,n,o){if(!t||t.style==="none"||t.style==="nil")return;let r=c$4(t,n,o);for(let[l,m]of Object.entries(r))e.style[l]=String(m);let a=`border${n}Style`,i=`border${n}Width`;if(e.style[a]==="double"){let l=parseFloat(e.style[i]);(!Number.isFinite(l)||l<3)&&(e.style[i]="3px");}}function bn(e,t,n){let o=t.pageBorders;if(!o||!yn(e.number,o.display)||![o.top,o.bottom,o.left,o.right].some(y=>y&&y.style!=="none"&&y.style!=="nil"))return null;let a=o.offsetFrom??"text",i=Se(o.top),d=Se(o.right),l=Se(o.bottom),m=Se(o.left),s=n.createElement("div");return s.className="layout-page-border",s.style.position="absolute",s.style.pointerEvents="none",s.style.boxSizing="border-box",s.style.zIndex=o.zOrder==="back"?"0":"20",a==="page"?(s.style.top=`${i}px`,s.style.right=`${d}px`,s.style.bottom=`${l}px`,s.style.left=`${m}px`):(s.style.top=`${Math.max(0,e.margins.top-i)}px`,s.style.right=`${Math.max(0,e.margins.right-d)}px`,s.style.bottom=`${Math.max(0,e.margins.bottom-l)}px`,s.style.left=`${Math.max(0,e.margins.left-m)}px`),ke(s,o.top,"Top",t.theme),ke(s,o.bottom,"Bottom",t.theme),ke(s,o.left,"Left",t.theme),ke(s,o.right,"Right",t.theme),s}function xn(e,t){let n=t.margins;e.style.position="absolute",e.style.top=`${n.top}px`,e.style.left=`${n.left}px`,e.style.right=`${n.right}px`,e.style.bottom=`${n.bottom}px`,e.style.overflow="visible";}function Sn(e,t,n){e.style.position="absolute",e.style.left=`${t.x-n.left}px`;let o=t.y-n.top;e.style.top=`${t.kind==="table"?Math.round(o):o}px`,e.style.width=`${t.width}px`,"height"in t&&t.kind!=="table"&&(e.style.height=`${t.height}px`);}function kn(e,t,n,o){let r=[];for(let a of e.runs){if(a.kind!=="image")continue;let i=a;if(!c(i))continue;let d=i.distTop??0,l=i.distBottom??0,m=i.distLeft??12,s=i.distRight??12,{x:y,y:g$1,side:u}=g(i,t,n,o);r.push({src:i.src,width:i.width,height:i.height,alt:i.alt,transform:i.transform,side:u,x:y,y:g$1,distTop:d,distBottom:l,distLeft:m,distRight:s,pmStart:i.pmStart,pmEnd:i.pmEnd,wrapText:e$1(i.cssFloat),wrapType:i.wrapType,cropTop:i.cropTop,cropRight:i.cropRight,cropBottom:i.cropBottom,cropLeft:i.cropLeft,opacity:i.opacity});}return r}function xe(e,t$1,n={}){let o=n.document??document,r=o.createElement("div");if(r.className=n.pageClassName??W.page,r.dataset.pageNumber=String(e.number),se(r,e.size.w,e.size.h,n),n.watermark){let c=gt(n.watermark,e,o);c&&r.appendChild(c);}let a=bn(e,n,o);a&&n.pageBorders?.zOrder==="back"&&r.appendChild(a);let i=o.createElement("div");i.className=W.content,xn(i,e);let d=f(e),l=d.contentWidth,m=[],s=[];for(let c of e.fragments)if(c.kind==="paragraph"&&n.blockLookup){let x=n.blockLookup.get(String(c.blockId));if(x?.block.kind==="paragraph"){let T=x.block,S=c.y-e.margins.top,k=kn(T,S,l,d);m.push(...k);}}for(let c of m)a$2(c)&&s.push({side:c.side,x:c.x,y:c.y,width:c.width,height:c.height,distTop:c.distTop,distBottom:c.distBottom,distLeft:c.distLeft,distRight:c.distRight,wrapText:c.wrapText,wrapType:c.wrapType});if(n.blockLookup)for(let c of e.fragments){if(c.kind!=="table")continue;let x=n.blockLookup.get(String(c.blockId));if(x?.block.kind!=="table")continue;let S=x.block.floating;if(!S)continue;let k=c.x-e.margins.left,p=c.y-e.margins.top,h=S.topFromText??0,R=S.bottomFromText??0,C=S.leftFromText??12,F=S.rightFromText??12,v=k<l/2?"left":"right";s.push({side:v,x:k,y:p,width:c.width,height:c.height,distTop:h,distBottom:R,distLeft:C,distRight:F});}if(n.blockLookup)for(let c of e.fragments){if(c.kind!=="textBox")continue;let x=n.blockLookup.get(String(c.blockId));if(x?.block.kind!=="textBox")continue;let T=x.block;if(!I(T))continue;let S=c.y-e.margins.top,k=g({width:c.width,height:c.height,position:T.position,cssFloat:T.cssFloat},S,l,d);c.x=e.margins.left+k.x,c.y=e.margins.top+k.y,!(!J$1(T)&&!K(T))&&s.push({side:k.side,x:k.x,y:k.y,width:c.width,height:c.height,distTop:T.distTop??0,distBottom:T.distBottom??0,distLeft:T.distLeft??12,distRight:T.distRight??12,wrapText:T.wrapText,wrapType:T.wrapType});}let y=s.length>0?t(s,l):[],g$1=m.filter(b),u=m.filter(c=>!b(c));if(g$1.length>0){let c=q(g$1,o,{layerClass:"layout-floating-images-layer",itemClass:"layout-page-floating-image",sizing:"inset0",layerMode:"behind"});i.appendChild(c);}let E=c=>{if(c.kind!=="paragraph"||!n.blockLookup||!c.blockId)return;let x=n.blockLookup.get(String(c.blockId));if(x?.block.kind==="paragraph")return x.block.attrs?.borders},b$1,f$1=new Map,w=c=>!n.blockLookup||!c.blockId?[]:n.blockLookup.get(String(c.blockId))?.block.sdtGroups??[],I$1=(c,x)=>{if(x.length===0)return;let T=x[x.length-1];c.classList.add("layout-block-sdt"),c.dataset.sdtGroupId=T.id,c.dataset.sdtType=T.sdtType,c.dataset.sdtDepth=String(x.length),T.tag!=null&&(c.dataset.sdtTag=T.tag),T.alias!=null&&(c.dataset.sdtAlias=T.alias),T.lock!=null&&(c.dataset.sdtLock=T.lock);};for(let c=0;c<e.fragments.length;c++){let x=e.fragments[c],T,S={...t$1,section:"body",contentWidth:l},k=x.y-e.margins.top;if(n.blockLookup&&x.blockId){let p=n.blockLookup.get(String(x.blockId));if(x.kind==="paragraph"&&p?.block.kind==="paragraph"&&p?.measure.kind==="paragraph"){let h=p.block,R=c+1<e.fragments.length?E(e.fragments[c+1]):void 0,C=String(x.blockId),F=f$1.get(C);F||(F=new Set,f$1.set(C,F));let v=p.measure;y.length>0&&(v=z$1(h,l,{floatingZones:y,paragraphYOffset:k})),T=z(x,h,v,S,{document:o,prevBorders:b$1,nextBorders:R,renderedInlineImageKeys:F}),b$1=h.attrs?.borders;}else x.kind==="table"&&p?.block.kind==="table"&&p?.measure.kind==="table"?(T=Q(x,p.block,p.measure,S,{document:o}),b$1=void 0):x.kind==="image"&&p?.block.kind==="image"&&p?.measure.kind==="image"?(T=Z(x,p.block,p.measure,S,{document:o}),b$1=void 0):x.kind==="textBox"&&p?.block.kind==="textBox"&&p?.measure.kind==="textBox"?(T=ee(x,p.block,p.measure,S,{document:o}),b$1=void 0):(T=Fe(x,S,{document:o}),b$1=void 0);}else T=Fe(x,S,{document:o}),b$1=void 0;Sn(T,x,{left:e.margins.left,top:e.margins.top}),I$1(T,w(x)),i.appendChild(T);}if(et(e,i,l,w,o),u.length>0){let c=q(u,o,{layerClass:"layout-floating-images-layer",itemClass:"layout-page-floating-image",sizing:"inset0",layerMode:"front"});i.appendChild(c);}if(e.columns&&e.columns.separator&&e.columns.count>1){let c=e.columns.count,x=e.columns.gap,T=(l-(c-1)*x)/c,S=e.size.h-e.margins.top-e.margins.bottom;for(let k=0;k<c-1;k++){let p=(k+1)*T+k*x+x/2,h=o.createElement("div");h.style.position="absolute",h.style.left=`${p}px`,h.style.top="0",h.style.height=`${S}px`,h.style.width="0.5px",h.style.backgroundColor="#000",h.style.pointerEvents="none",i.appendChild(h);}}if(n.footnoteArea&&n.footnoteArea.length>0){let c=yt(n.footnoteArea,l,t$1,o);c.style.position="absolute";let x=Math.max(e.footnoteReservedHeight??0,ht(n.footnoteArea)),T=e.size.h-e.margins.bottom-e.margins.top;c.style.top=`${Math.max(-e.margins.top,T-x)}px`,c.style.left="0",c.style.right="0",i.appendChild(c);}r.appendChild(i);{let x=n.headerDistance??e.margins.header??48,T=e.size.w-e.margins.left-e.margins.right,S=Math.max(e.margins.top-x,48),k=n.headerContent?.visualTop??0,p=n.headerContent?.visualBottom??n.headerContent?.height??0,h=Math.max(p-k,24),R=p>S,C=o.createElement("div");C.className=W.header,C.style.position="absolute",C.style.top=`${x+k}px`,C.style.left=`${e.margins.left}px`,C.style.right=`${e.margins.right}px`,C.style.width=`${T}px`,C.style.height=`${h}px`,C.style.minHeight=`${h}px`;let F=!R;if(n.headerContent&&n.headerContent.blocks.length>0){let v={flowTop:x,flowLeft:e.margins.left,contentWidth:T,pageWidth:e.size.w,pageHeight:e.size.h,margins:e.margins},L=Be(n.headerContent,{...t$1,section:"header",contentWidth:T},n,v);L.style.top=`${-k}px`,L.querySelector("img")&&(F=false),C.appendChild(L);}F&&(C.style.maxHeight=`${S}px`,C.style.overflow="hidden"),r.appendChild(C);}{let x=n.footerDistance??e.margins.footer??48,T=e.size.w-e.margins.left-e.margins.right,S=Math.max(e.margins.bottom-x,48),k=n.footerContent?.visualTop??0,p=n.footerContent?.visualBottom??n.footerContent?.height??0,h=Math.max(p-k,24),R=h>S,C=o.createElement("div");C.className=W.footer,C.style.position="absolute",C.style.top=`${e.size.h-x-h}px`,C.style.left=`${e.margins.left}px`,C.style.right=`${e.margins.right}px`,C.style.width=`${T}px`,C.style.height=`${h}px`,C.style.minHeight=`${h}px`;let F=!R;if(n.footerContent&&n.footerContent.blocks.length>0){let v={flowTop:e.size.h-x-(n.footerContent?.height??0),flowLeft:e.margins.left,contentWidth:T,pageWidth:e.size.w,pageHeight:e.size.h,margins:e.margins},L=Be(n.footerContent,{...t$1,section:"footer",contentWidth:T},n,v);L.style.top=`${-k}px`,L.querySelector("img")&&(F=false),C.appendChild(L);}F&&(C.style.maxHeight=`${S}px`,C.style.overflow="hidden"),r.appendChild(C);}return a&&n.pageBorders?.zOrder!=="back"&&r.appendChild(a),r}export{ut as A,gn as B,hn as C,W as D,se as E,xe as F,ye as a,Me as b,nn as c,To as d,he as e,an as f,sn as g,Fo as h,He as i,Io as j,Co as k,wn as l,Tn as m,U as n,Fe as o,tt as p,Z as q,lt as r,ue as s,z as t,q as u,N as v,Q as w,Ut as x,ee as y,Pe as z};