@eigenpal/docx-js-editor 0.0.29 → 0.0.31

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 (47) hide show
  1. package/dist/{ClipboardManager-D0D4aUKE.d.ts → ClipboardManager-C0rTRkVQ.d.ts} +29 -1
  2. package/dist/{ClipboardManager-t936d0KD.d.mts → ClipboardManager-CgpKW2At.d.mts} +29 -1
  3. package/dist/PageSetupDialog-2SKHDRTF.js +1 -0
  4. package/dist/PageSetupDialog-SMQJXEBL.mjs +1 -0
  5. package/dist/{chunk-MRWJ3GNH.js → chunk-3Y6ZBC3P.js} +2 -2
  6. package/dist/{chunk-YGTSQZRK.mjs → chunk-6CSL7T4S.mjs} +1 -1
  7. package/dist/chunk-A2DPBJHE.mjs +258 -0
  8. package/dist/chunk-CQR767EJ.mjs +1 -0
  9. package/dist/{chunk-IRO7KGGC.js → chunk-DJI7XTMH.js} +2 -2
  10. package/dist/{chunk-Z35FA4M4.mjs → chunk-FFNGY4AB.mjs} +5 -5
  11. package/dist/chunk-HIITS47V.js +258 -0
  12. package/dist/{chunk-VHWEKJ35.js → chunk-N2UPYG75.js} +5 -5
  13. package/dist/{chunk-VR6PT4IZ.js → chunk-NKJBKWYY.js} +13 -13
  14. package/dist/{chunk-CQRI4YUS.mjs → chunk-OBTGZZLM.mjs} +13 -13
  15. package/dist/{chunk-I6LFWQFR.mjs → chunk-TQATISQV.mjs} +1 -1
  16. package/dist/chunk-ZKKL54FH.js +1 -0
  17. package/dist/core-plugins-reexport.js +1 -1
  18. package/dist/core-plugins-reexport.mjs +1 -1
  19. package/dist/core-reexport.d.mts +2 -2
  20. package/dist/core-reexport.d.ts +2 -2
  21. package/dist/core-reexport.js +1 -1
  22. package/dist/core-reexport.mjs +1 -1
  23. package/dist/headless-reexport.js +2 -2
  24. package/dist/headless-reexport.mjs +1 -1
  25. package/dist/index.d.mts +10 -27
  26. package/dist/index.d.ts +10 -27
  27. package/dist/index.js +23 -66
  28. package/dist/index.mjs +23 -66
  29. package/dist/mcp-reexport.js +10 -10
  30. package/dist/mcp-reexport.mjs +8 -8
  31. package/dist/{react-C-pJU0Y4.d.mts → react-B2h6vE3D.d.mts} +118 -83
  32. package/dist/{react-By80Gfi-.d.ts → react-CAc4htNH.d.ts} +118 -83
  33. package/dist/react.d.mts +2 -2
  34. package/dist/react.d.ts +2 -2
  35. package/dist/react.js +1 -1
  36. package/dist/react.mjs +1 -1
  37. package/dist/selectionRects-D45BP6HQ.js +1 -0
  38. package/dist/selectionRects-Z72BKRLU.mjs +1 -0
  39. package/package.json +1 -1
  40. package/dist/PageSetupDialog-3QCVUNDL.mjs +0 -1
  41. package/dist/PageSetupDialog-ZZTFPZKJ.js +0 -1
  42. package/dist/chunk-G72SXG7G.js +0 -258
  43. package/dist/chunk-MVCTPHRR.mjs +0 -258
  44. package/dist/chunk-QQ63M65M.js +0 -1
  45. package/dist/chunk-TDEHAPMZ.mjs +0 -1
  46. package/dist/selectionRects-6TRAXB7D.js +0 -1
  47. package/dist/selectionRects-IS7ZAS3A.mjs +0 -1
@@ -1 +0,0 @@
1
- 'use strict';function ae(e,t,r,n){let a=e-t-r,o=(n.count-1)*n.gap;return (a-o)/n.count}function U(e){let{pageSize:t,margins:r}=e,n=e.columns??{count:1,gap:0},a=[],o=[],c=r.top,i=t.h-r.bottom;if(i-c<=0)throw new Error("Paginator: page size and margins yield no content area");let u=ae(t.w,r.left,r.right,n),g=c;function l(p){return r.left+p*(u+n.gap)}function m(){let p=a.length+1,S=e.footnoteReservedHeights?.get(p)??0,T=i-S,w={number:p,fragments:[],margins:{...r},size:{...t},footnoteReservedHeight:S>0?S:void 0,columns:n.count>1?{...n}:void 0},C={page:w,cursorY:c,columnIndex:0,topMargin:c,contentBottom:T,trailingSpacing:0};return a.push(w),o.push(C),g=c,e.onNewPage&&e.onNewPage(C),C}function f(){return o.length===0?m():o[o.length-1]}function x(p){return p.contentBottom-p.cursorY}function h(p,S){let T=S||f();return x(T)>=p}function b(p){return p.columnIndex<n.count-1?(p.columnIndex+=1,p.cursorY=g,p.trailingSpacing=0,p):m()}function d(p){let S=f(),T=Number.isFinite(p)&&p>0?p:0,w=S.contentBottom-S.topMargin;if(T>w)return S.cursorY!==S.topMargin&&(S=b(S)),S;for(;!h(T,S);)S=b(S);return S}function k(p,S,T=0,w=0){let C=Math.max(T,f().trailingSpacing),R=C+S,I=d(R),H=I.cursorY===I.topMargin?0:C,L=l(I.columnIndex),B=I.cursorY+H;return p.x=L,p.y=B,I.page.fragments.push(p),I.cursorY=B+S,I.trailingSpacing=w,{state:I,x:L,y:B}}function y(){return m()}function F(){let p=f();return b(p)}function M(p){n=p,u=ae(t.w,r.left,r.right,n);let S=f();S.page.columns=n.count>1?{...n}:void 0,g=S.cursorY,S.columnIndex=0;}return {pages:a,states:o,get columnWidth(){return u},get columns(){return {...n}},getCurrentState:f,getAvailableHeight:()=>x(f()),fits:p=>h(p),ensureFits:d,addFragment:k,forcePageBreak:y,forceColumnBreak:F,getColumnX:l,updateColumns:M}}function j(e){let t=new Map,r=new Set;for(let n=0;n<e.length;n++){if(r.has(n))continue;let a=e[n];if(a.kind!=="paragraph"||!a.attrs?.keepNext)continue;let c=[n],i=n;for(let g=n+1;g<e.length;g++){let l=e[g];if(l.kind==="sectionBreak"||l.kind==="pageBreak"||l.kind==="columnBreak"||l.kind!=="paragraph")break;if(l.attrs?.keepNext)c.push(g),i=g,r.add(g);else break}let s=i+1,u=-1;if(s<e.length){let g=e[s];g.kind!=="sectionBreak"&&g.kind!=="pageBreak"&&g.kind!=="columnBreak"&&(u=s);}t.set(n,{startIndex:n,endIndex:i,memberIndices:c,anchorIndex:u});}return t}function q(e,t,r){let n=0;for(let a of e.memberIndices){let o=t[a],c=r[a];if(o.kind!=="paragraph"||c.kind!=="paragraph")continue;let i=o,s=c,u=i.attrs?.spacing?.before??0;n+=u,n+=s.totalHeight;let g=i.attrs?.spacing?.after??0;n+=g;}if(e.anchorIndex!==-1){let a=r[e.anchorIndex];if(a?.kind==="paragraph"){let o=a;o.lines.length>0&&(n+=o.lines[0].lineHeight);}}return n}function K(e){let t=new Set;for(let r of e.values())for(let n=1;n<r.memberIndices.length;n++)t.add(r.memberIndices[n]);return t}function $(e){return e.kind!=="paragraph"?false:e.attrs?.pageBreakBefore===true}var We={top:4,bottom:4,left:7,right:7},Ue=200;var Be={w:816,h:1056},O={top:96,right:96,bottom:96,left:96};function ie(e){return e.attrs?.spacing?.before??0}function se(e){return e.attrs?.spacing?.after??0}function Fe(e){for(let t=0;t<e.length-1;t++){let r=e[t],n=e[t+1];if(r.kind!=="paragraph"||n.kind!=="paragraph")continue;let a=r.attrs,o=n.attrs;a?.contextualSpacing&&o?.contextualSpacing&&a.styleId&&a.styleId===o.styleId&&(a.spacing&&(a.spacing={...a.spacing,after:0}),o.spacing&&(o.spacing={...o.spacing,before:0}));}}function rt(e,t,r={}){if(e.length!==t.length)throw new Error(`layoutDocument: expected one measure per block (blocks=${e.length}, measures=${t.length})`);let n=r.pageSize??Be,a={top:r.margins?.top??O.top,right:r.margins?.right??O.right,bottom:r.margins?.bottom??O.bottom,left:r.margins?.left??O.left,header:r.margins?.header??r.margins?.top??O.top,footer:r.margins?.footer??r.margins?.bottom??O.bottom};r.headerContentHeights,r.footerContentHeights,r.titlePage,r.evenAndOddHeaders;let o={...a},c=n.w-o.left-o.right;if(c<=0)throw new Error("layoutDocument: page size and margins yield no content area");let i={count:1,gap:0},s=[],u=[];for(let h=0;h<e.length;h++)if(e[h].kind==="sectionBreak"){let b=e[h];s.push(b.columns??i),u.push(b.type);}s.push(r.columns??i),u.push(r.bodyBreakType);let g=s.length>0?s[0]:r.columns,l=U({pageSize:n,margins:o,columns:g,footnoteReservedHeights:r.footnoteReservedHeights});Fe(e);let m=j(e),f=K(m),x=0;for(let h=0;h<e.length;h++){let b=e[h],d=t[h];$(b)&&l.forcePageBreak();let k=m.get(h);if(k&&!f.has(h)){let y=q(k,e,t),F=l.getCurrentState(),M=l.getAvailableHeight(),p=F.contentBottom-F.topMargin;y<=p&&y>M&&F.page.fragments.length>0&&l.forcePageBreak();}switch(b.kind){case "paragraph":Me(b,d,l,c);break;case "table":b.floating?Te(b,d,l,c):we(b,d,l);break;case "image":Ce(b,d,l);break;case "textBox":Re(b,d,l);break;case "pageBreak":l.forcePageBreak();break;case "columnBreak":l.forceColumnBreak();break;case "sectionBreak":{let y=u[x+1]??u[x];Le(b,l,s[x+1]??i,y),x++;break}}}return l.pages.length===0&&l.getCurrentState(),{pageSize:n,pages:l.pages,columns:r.columns,pageGap:r.pageGap}}function Me(e,t,r,n){if(t.kind!=="paragraph")throw new Error("layoutParagraph: expected paragraph measure");let a=t.lines;if(a.length===0){let s=ie(e),u=se(e),g=r.getCurrentState(),l={kind:"paragraph",blockId:e.id,x:r.getColumnX(g.columnIndex),y:g.cursorY+s,width:n,height:0,fromLine:0,toLine:0,pmStart:e.pmStart,pmEnd:e.pmEnd};r.addFragment(l,0,s,u);return}let o=ie(e),c=se(e),i=0;for(;i<a.length;){let s=r.getCurrentState(),u=r.getAvailableHeight(),g=0,l=0;for(let k=i;k<a.length;k++){let y=a[k].lineHeight,F=g+y;if((i===0&&k===i?F+o:F)<=u||l===0)g=F,l++;else break}let m=i===0,f=i+l>=a.length,x=m?o:0,h=f?c:0,b={kind:"paragraph",blockId:e.id,x:r.getColumnX(s.columnIndex),y:0,width:n,height:g,fromLine:i,toLine:i+l,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!m,continuesOnNext:!f},d=r.addFragment(b,g,x,h);b.y=d.y,i+=l,i<a.length&&r.ensureFits(a[i].lineHeight);}}function Pe(e){let t=0;for(let r of e.rows)if(r.isHeader)t++;else break;return t}function z(e,t){let r=0;for(let n=0;n<t&&n<e.rows.length;n++)r+=e.rows[n].height;return r}function we(e,t,r){if(t.kind!=="table")throw new Error("layoutTable: expected table measure");let n=t.rows;if(n.length===0)return;let a=Pe(e),o=z(t,a),c=0;for(;c<n.length;){let i=r.getCurrentState(),s=r.getAvailableHeight(),u=c===0,g=u?i.trailingSpacing:0,l=s-g,m=!u&&a>0?o:0,f=0,x=0;for(let F=c;F<n.length;F++){let M=n[F].height;if(f+M+m<=l||x===0)f+=M,x++;else break}let h=f+m,b=c+x>=n.length,d=r.getColumnX(i.columnIndex);e.justification==="center"?d=d+(r.columnWidth-t.totalWidth)/2:e.justification==="right"?d=d+r.columnWidth-t.totalWidth:e.indent&&(d+=e.indent);let k={kind:"table",blockId:e.id,x:d,y:0,width:t.totalWidth,height:h,fromRow:c,toRow:c+x,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!u,continuesOnNext:!b,headerRowCount:!u&&a>0?a:void 0},y=r.addFragment(k,h,0,0);if(k.y=y.y,k.x=d,c+=x,c<n.length){let F=n[c].height+(a>0?o:0);r.ensureFits(F);}}}function Te(e,t,r,n){if(t.kind!=="table")throw new Error("layoutFloatingTable: expected table measure");let a=r.getCurrentState(),o=e.floating,c=a.page,i=c.margins,s=t.totalWidth,u=t.totalHeight,g=c.size.h-i.top-i.bottom,l=i.left,m=i.top;o?.horzAnchor==="page"&&(l=0),o?.vertAnchor==="page"&&(m=0);let f=r.getColumnX(a.columnIndex);if(o?.tblpX!==void 0)f=l+o.tblpX;else if(o?.tblpXSpec){let y=o.tblpXSpec;y==="left"||y==="inside"?f=l:y==="right"||y==="outside"?f=l+n-s:y==="center"&&(f=l+(n-s)/2);}else e.justification==="center"?f=l+(n-s)/2:e.justification==="right"&&(f=l+n-s);let x=a.cursorY,h=false;if(o?.tblpY!==void 0)x=m+o.tblpY,h=true;else if(o?.tblpYSpec){h=true;let y=o.tblpYSpec;y==="top"?x=m:y==="bottom"?x=m+g-u:y==="center"&&(x=m+(g-u)/2);}h||(x=r.ensureFits(u).cursorY);let b=i.left,d=i.left+n-s;Number.isFinite(d)&&(f=Math.max(b,Math.min(f,d)));let k={kind:"table",blockId:e.id,x:f,y:x,width:s,height:u,fromRow:0,toRow:e.rows.length,pmStart:e.pmStart,pmEnd:e.pmEnd,isFloating:true};a.page.fragments.push(k);}function Ce(e,t,r){if(t.kind!=="image")throw new Error("layoutImage: expected image measure");if(e.anchor?.isAnchored){Ie(e,t,r);return}let n=r.ensureFits(t.height),a={kind:"image",blockId:e.id,x:r.getColumnX(n.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},o=r.addFragment(a,t.height,0,0);a.y=o.y;}function Ie(e,t,r){let n=r.getCurrentState(),a=e.anchor,o=a.offsetH??r.getColumnX(n.columnIndex),c=a.offsetV??n.cursorY,i={kind:"image",blockId:e.id,x:o,y:c,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd,isAnchored:true,zIndex:a.behindDoc?-1:1};n.page.fragments.push(i);}function Re(e,t,r){if(t.kind!=="textBox")throw new Error("layoutTextBox: expected textBox measure");let n=r.ensureFits(t.height),a={kind:"textBox",blockId:e.id,x:r.getColumnX(n.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},o=r.addFragment(a,t.height,0,0);a.y=o.y;}function Le(e,t,r,n){switch(n??"nextPage"){case "nextPage":t.forcePageBreak();break;case "evenPage":{t.forcePageBreak().page.number%2!==0&&t.forcePageBreak();break}case "oddPage":{t.forcePageBreak().page.number%2===0&&t.forcePageBreak();break}}t.updateColumns(r);}var ve={calibri:{googleFont:"Carlito",category:"sans-serif",fallbackStack:["Calibri","Carlito","Arial","Helvetica","sans-serif"],singleLineRatio:1.2207},cambria:{googleFont:"Caladea",category:"serif",fallbackStack:["Cambria","Caladea","Georgia","serif"],singleLineRatio:1.2676},arial:{googleFont:"Arimo",category:"sans-serif",fallbackStack:["Arial","Arimo","Helvetica","sans-serif"],singleLineRatio:1.1499},"times new roman":{googleFont:"Tinos",category:"serif",fallbackStack:["Times New Roman","Tinos","Times","serif"],singleLineRatio:1.1499},"courier new":{googleFont:"Cousine",category:"monospace",fallbackStack:["Courier New","Cousine","Courier","monospace"],singleLineRatio:1.1328},georgia:{googleFont:"Tinos",category:"serif",fallbackStack:["Georgia","Tinos","Times New Roman","serif"],singleLineRatio:1.1362},verdana:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Verdana","Open Sans","Arial","sans-serif"],singleLineRatio:1.2153},tahoma:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Tahoma","Open Sans","Arial","sans-serif"],singleLineRatio:1.2075},"trebuchet ms":{googleFont:"Fira Sans",category:"sans-serif",fallbackStack:["Trebuchet MS","Fira Sans","Arial","sans-serif"],singleLineRatio:1.1431},"comic sans ms":{googleFont:"Comic Neue",category:"cursive",fallbackStack:["Comic Sans MS","Comic Neue","cursive"],singleLineRatio:1.3936},impact:{googleFont:"Anton",category:"sans-serif",fallbackStack:["Impact","Anton","Arial Black","sans-serif"],singleLineRatio:1.2197},"palatino linotype":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Palatino Linotype","EB Garamond","Palatino","Georgia","serif"],singleLineRatio:1.0259},"book antiqua":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Book Antiqua","EB Garamond","Palatino","Georgia","serif"],singleLineRatio:1.0259},garamond:{googleFont:"EB Garamond",category:"serif",fallbackStack:["Garamond","EB Garamond","Georgia","serif"],singleLineRatio:1.068},"century gothic":{googleFont:"Questrial",category:"sans-serif",fallbackStack:["Century Gothic","Questrial","Arial","sans-serif"],singleLineRatio:1.1611},"lucida sans":{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Lucida Sans","Open Sans","Arial","sans-serif"],singleLineRatio:1.1655},"lucida console":{googleFont:"Cousine",category:"monospace",fallbackStack:["Lucida Console","Cousine","Courier New","monospace"],singleLineRatio:1.1387},consolas:{googleFont:"Inconsolata",category:"monospace",fallbackStack:["Consolas","Inconsolata","Cousine","Courier New","monospace"],singleLineRatio:1.1626},"ms mincho":{googleFont:"Noto Serif JP",category:"serif",fallbackStack:["MS Mincho","Noto Serif JP","serif"],singleLineRatio:1.15},"ms gothic":{googleFont:"Noto Sans JP",category:"sans-serif",fallbackStack:["MS Gothic","Noto Sans JP","sans-serif"],singleLineRatio:1.15},simhei:{googleFont:"Noto Sans SC",category:"sans-serif",fallbackStack:["SimHei","Noto Sans SC","sans-serif"],singleLineRatio:1.15},simsun:{googleFont:"Noto Serif SC",category:"serif",fallbackStack:["SimSun","Noto Serif SC","serif"],singleLineRatio:1.15},"malgun gothic":{googleFont:"Noto Sans KR",category:"sans-serif",fallbackStack:["Malgun Gothic","Noto Sans KR","sans-serif"],singleLineRatio:1.15}},He={"sans-serif":"Arial, Helvetica, sans-serif",serif:"Times New Roman, Times, serif",monospace:"Courier New, Courier, monospace",cursive:"cursive",fantasy:"fantasy","system-ui":"system-ui, sans-serif"};function Ee(e){let t=e.toLowerCase();return t.includes("mono")||t.includes("courier")||t.includes("consolas")||t.includes("console")||t.includes("code")||t.includes("terminal")?"monospace":t.includes("times")||t.includes("georgia")||t.includes("garamond")||t.includes("palatino")||t.includes("baskerville")||t.includes("bodoni")||t.includes("cambria")||t.includes("mincho")||t.includes("ming")||t.includes("song")||t.includes("serif")?"serif":t.includes("script")||t.includes("cursive")||t.includes("comic")||t.includes("brush")||t.includes("hand")?"cursive":"sans-serif"}function ce(e){let t=e.trim().toLowerCase(),r=ve[t];if(r)return {googleFont:r.googleFont,cssFallback:r.fallbackStack.map(le).join(", "),originalFont:e,hasGoogleEquivalent:true,singleLineRatio:r.singleLineRatio};let n=Ee(e),a=He[n];return {googleFont:null,cssFallback:`${le(e)}, ${a}`,originalFont:e,hasGoogleEquivalent:false,singleLineRatio:1.15}}function le(e){return ["serif","sans-serif","monospace","cursive","fantasy","system-ui"].includes(e.toLowerCase())?e:/[\s,'"()]/.test(e)?`"${e.replace(/"/g,'\\"')}"`:e}function ct(e,t){if(!t)return null;let n=e.toLowerCase().startsWith("major")?t.majorFont:t.minorFont;if(!n)return null;let a=e.toLowerCase();return a.includes("eastasia")||a.includes("ea")?n.ea??n.latin??null:a.includes("cs")||a.includes("bidi")?n.cs??n.latin??null:n.latin??null}var ge=96,me=11,pe="Calibri",Ne=1,Oe=.8,ze=.2,_=null;function J(){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 pt(){_=null;}var ue=new Map;function fe(e){let t=ue.get(e);if(t===void 0){let r=ce(e);t={cssFallback:r.cssFallback,singleLineRatio:r.singleLineRatio},ue.set(e,t);}return t}function _e(e){return fe(e).cssFallback}function V(e){let t=[];e.italic&&t.push("italic"),e.bold&&t.push("bold");let r=e.fontSize??me,n=de(r);t.push(`${n}px`);let a=e.fontFamily??pe;return t.push(_e(a)),t.join(" ")}function Ye(e){let t=e.fontSize??me,r=e.fontFamily??pe,n=de(t),a=n*Oe,o=n*ze,c=n*Ne;try{let s=J();s.font=V(e);let u=s.measureText("Hg");typeof u.actualBoundingBoxAscent=="number"&&typeof u.actualBoundingBoxDescent=="number"&&(a=u.actualBoundingBoxAscent,o=u.actualBoundingBoxDescent);}catch{}c=Math.max(c,a+o);let i=fe(r).singleLineRatio;return {fontSize:t,ascent:a,descent:o,lineHeight:c,fontFamily:r,singleLineRatio:i}}function ft(e,t){if(!e)return 0;let r=J();r.font=V(t);let a=r.measureText(e).width;return t.letterSpacing&&e.length>1&&(a+=t.letterSpacing*(e.length-1)),a}function Q(e,t){let r=Ye(t);if(!e)return {width:0,charWidths:[],metrics:r};let n=J();n.font=V(t);let a=t.letterSpacing??0,o=[],c=0;for(let i=0;i<e.length;i++){let s=e[i],g=n.measureText(s).width;a&&i<e.length-1&&(g+=a),o.push(g),c+=g;}return {width:c,charWidths:o,metrics:r}}function dt(e,t){if(t.length===0||e<=0)return 0;let r=0;for(let n=0;n<t.length;n++){let a=t[n],o=r+a/2;if(e<=o)return n;r+=a;}return t.length}function de(e){return e*ge/72}function Z(e,t){let r=e.pageGap??0,n=0;for(let a=0;a<t&&a<e.pages.length;a++){let c=e.pages[a].size?.h??e.pageSize.h;n+=c+r;}return n}function he(e,t){return e.findIndex(r=>r.id===t)}function Xe(e,t){let r=0;for(let n=e.fromLine;n<e.toLine&&n<t.lines.length;n++)r+=t.lines[n].lineHeight;return r}function xt(e,t,r,n){let a=[...e.page.fragments].sort((o,c)=>{let i=o.y-c.y;return Math.abs(i)>.5?i:o.x-c.x});for(let o of a){let c=he(t,o.blockId);if(c===-1)continue;let i=t[c],s=r[c];if(!i||!s)continue;let u;if(o.kind==="paragraph"){if(i.kind!=="paragraph"||s.kind!=="paragraph")continue;u=Xe(o,s);}else if(o.kind==="table")u=o.height;else if(o.kind==="image")u=o.height;else continue;let g=n.x>=o.x&&n.x<=o.x+o.width,l=n.y>=o.y&&n.y<=o.y+u;if(g&&l)return {fragment:o,block:i,measure:s,pageIndex:e.pageIndex,localX:n.x-o.x,localY:n.y-o.y}}return null}function kt(e,t,r,n){for(let a of e.page.fragments){if(a.kind!=="table")continue;let o=a,c=n.x>=o.x&&n.x<=o.x+o.width,i=n.y>=o.y&&n.y<=o.y+o.height;if(!c||!i)continue;let s=he(t,o.blockId);if(s===-1)continue;let u=t[s],g=r[s];if(!u||u.kind!=="table"||!g||g.kind!=="table")continue;let l=u,m=g,f=n.x-o.x,x=n.y-o.y,h=o.headerRowCount??0,b=h>0&&o.continuesFromPrev?z(m,h):0,d=0,k=-1;if(m.rows.length===0||l.rows.length===0)continue;if(b>0&&x<b){let B=0;for(let P=0;P<h&&P<m.rows.length;P++){let E=m.rows[P];if(x>=B&&x<B+E.height){k=P;break}B+=E.height;}k===-1&&(k=0);}else {let B=x-b;for(let P=o.fromRow;P<o.toRow&&P<m.rows.length;P++){let E=m.rows[P];if(B>=d&&B<d+E.height){k=P;break}d+=E.height;}}if(k===-1&&(k=Math.min(o.toRow-1,m.rows.length-1),k<o.fromRow))continue;let y=m.rows[k],F=l.rows[k];if(!y||!F)continue;let M=0,p=-1;if(y.cells.length===0||F.cells.length===0)continue;for(let B=0;B<y.cells.length;B++){let P=y.cells[B];if(f>=M&&f<M+P.width){p=B;break}M+=P.width;}if(p===-1&&(p=y.cells.length-1,p<0))continue;let S=y.cells[p],T=F.cells[p];if(!S||!T)continue;let w=0;if(b>0&&k<h)for(let B=0;B<k;B++)w+=m.rows[B]?.height??0;else {w=b;for(let B=o.fromRow;B<k;B++)w+=m.rows[B]?.height??0;}let R=0;for(let B=0;B<p;B++)R+=y.cells[B]?.width??0;let I,v;if(T.blocks&&T.blocks.length>0){let B=T.blocks[0],P=S.blocks[0];B.kind==="paragraph"&&P?.kind==="paragraph"&&(I=B,v=P);}let H=f-R,L=x-w;return {fragment:o,block:l,measure:m,pageIndex:e.pageIndex,rowIndex:k,colIndex:p,cellBlock:I,cellMeasure:v,cellLocalX:Math.max(0,H),cellLocalY:Math.max(0,L)}}return null}function be(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function ee(e,t){return e.findIndex(r=>r.id===t)}function D(e,t){let n=(e.pmStart??0)+1,a=0,o;for(let s=0;s<e.runs.length&&s<=t.toRun;s++){let u=e.runs[s];if(u){if(s<t.fromRun)u.kind==="text"?a+=(u.text??"").length:a+=1;else if(s===t.fromRun){a+=t.fromChar,o=n+a;break}}}o===void 0&&(o=n);let c=0;for(let s=t.fromRun;s<=t.toRun&&s<e.runs.length;s++){let u=e.runs[s];if(u)if(u.kind==="text"){let g=u.text??"",l=s===t.fromRun?t.fromChar:0,m=s===t.toRun?t.toChar:g.length;c+=m-l;}else c+=1;}let i=o+c;return {pmStart:o,pmEnd:i}}function xe(e,t,r,n){let a=[];for(let o=0;o<t.lines.length;o++){let c=t.lines[o],i=D(e,c);i.pmStart===void 0||i.pmEnd===void 0||i.pmEnd>r&&i.pmStart<n&&a.push({line:c,index:o});}return a}function Y(e,t,r){let n=D(e,t);return n.pmStart===void 0?0:Math.max(0,r-n.pmStart)}function X(e,t,r,n){let a=0,o=0;for(let c=t.fromRun;c<=t.toRun&&c<e.runs.length;c++){let i=e.runs[c];if(i){if(i.kind==="tab"){let s=i.width??48;if(o+1>=r)return r<=o?a:a+s;a+=s,o+=1;continue}if(i.kind==="image"){let s=i.width;if(o+1>=r)return r<=o?a:a+s;a+=s,o+=1;continue}if(i.kind==="lineBreak"){if(r<=o)return a;o+=1;continue}if(i.kind==="text"){let s=i.text??"",u=c===t.fromRun,g=c===t.toRun,l=u?t.fromChar:0,m=g?t.toChar:s.length,f=s.slice(l,m);if(o+f.length>=r){let b=r-o,d=be(i),k=Q(f.slice(0,b),d);return a+k.width}let x=be(i),h=Q(f,x);a+=h.width,o+=f.length;}}}return a}function G(e,t){let r=0;for(let n=0;n<t&&n<e.lines.length;n++)r+=e.lines[n].lineHeight;return r}function Mt(e,t,r,n,a){if(n===a)return [];let o=Math.min(n,a),c=Math.max(n,a),i=[];for(let s=0;s<e.pages.length;s++){let u=e.pages[s],g=Z(e,s);for(let l of u.fragments){if(l.kind==="paragraph"){let m=ee(t,l.blockId);if(m===-1)continue;let f=t[m],x=r[m];if(!f||f.kind!=="paragraph"||!x||x.kind!=="paragraph")continue;let h=f,b=x,d=l,k=xe(h,b,o,c);for(let{line:y,index:F}of k){if(F<d.fromLine||F>=d.toLine)continue;let M=D(h,y);if(M.pmStart===void 0||M.pmEnd===void 0)continue;let p=Math.max(M.pmStart,o),S=Math.min(M.pmEnd,c);if(p>=S)continue;let T=Y(h,y,p),w=Y(h,y,S),C=h.attrs?.indent,R=C?.left??0,I=C?.right??0,v=Math.max(0,l.width-R-I),H=X(h,y,T),L=X(h,y,w),B=h.attrs?.alignment??"left",P=0;B==="center"?P=Math.max(0,(v-y.width)/2):B==="right"&&(P=Math.max(0,v-y.width));let E=G(b,F)-G(b,d.fromLine),A=l.x+R+P+Math.min(H,L),W=Math.max(1,Math.abs(L-H)),N=l.y+E;i.push({x:A,y:N+g,width:W,height:y.lineHeight,pageIndex:s});}}if(l.kind==="table"){let m=ee(t,l.blockId);if(m===-1)continue;let f=t[m],x=r[m];if(!f||f.kind!=="table"||!x||x.kind!=="table")continue;let h=f,b=x,d=l,k=d.headerRowCount??0,F=k>0&&d.continuesFromPrev?z(b,k):0;for(let M=d.fromRow;M<d.toRow&&M<h.rows.length;M++){let p=h.rows[M],S=b.rows[M];if(!p||!S)continue;let T=0;for(let w=0;w<p.cells.length;w++){let C=p.cells[w],R=S.cells[w];if(!(!C||!R)){for(let I=0;I<C.blocks.length;I++){let v=C.blocks[I],H=R.blocks[I];if(!v||v.kind!=="paragraph"||!H||H.kind!=="paragraph")continue;let L=v,B=H,P=xe(L,B,o,c),E=0;for(let{line:A,index:W}of P){let N=D(L,A);if(N.pmStart===void 0||N.pmEnd===void 0)continue;let te=Math.max(N.pmStart,o),ne=Math.min(N.pmEnd,c);if(te>=ne)continue;let ke=Y(L,A,te),ye=Y(L,A,ne),re=X(L,A,ke,R.width),oe=X(L,A,ye,R.width),Se=G(B,W);i.push({x:d.x+T+Math.min(re,oe),y:d.y+F+E+Se+g,width:Math.max(1,Math.abs(oe-re)),height:A.lineHeight,pageIndex:s});}E+=B.totalHeight;}T+=R.width;}}F+=S.height;}}if(l.kind==="image"){let m=l.pmStart??0;(l.pmEnd??m+1)>o&&m<c&&i.push({x:l.x,y:l.y+g,width:l.width,height:l.height,pageIndex:s});}}}return i}function Pt(e,t,r,n){for(let a=0;a<e.pages.length;a++){let o=e.pages[a],c=Z(e,a);for(let i of o.fragments){if(i.kind==="paragraph"){let s=ee(t,i.blockId);if(s===-1)continue;let u=t[s],g=r[s];if(!u||u.kind!=="paragraph"||!g||g.kind!=="paragraph")continue;let l=u,m=g,f=i,x=l.pmStart??0,h=l.pmEnd??x;if(n<x||n>h)continue;for(let b=f.fromLine;b<f.toLine;b++){let d=m.lines[b];if(!d)continue;let k=D(l,d);if(!(k.pmStart===void 0||k.pmEnd===void 0)&&n>=k.pmStart&&n<=k.pmEnd){let y=Y(l,d,n),F=l.attrs?.indent,M=F?.left??0,p=F?.right??0,S=Math.max(0,i.width-M-p),T=X(l,d,y),w=l.attrs?.alignment??"left",C=0;w==="center"?C=Math.max(0,(S-d.width)/2):w==="right"&&(C=Math.max(0,S-d.width));let R=G(m,b)-G(m,f.fromLine);return {x:i.x+M+C+T,y:i.y+R+c,height:d.lineHeight,pageIndex:a}}}}if(i.kind==="image"){let s=i.pmStart??0,u=i.pmEnd??s+1;if(n>=s&&n<=u){let g=n===s?0:i.width;return {x:i.x+g,y:i.y+c,height:i.height,pageIndex:a}}}}}return null}function wt(e){return e.length<=1?false:new Set(e.map(r=>r.pageIndex)).size>1}function Tt(e){let t=new Map;for(let r of e){let n=t.get(r.pageIndex)??[];n.push(r),t.set(r.pageIndex,n);}return t}exports.a=ce;exports.b=ct;exports.c=We;exports.d=Ue;exports.e=rt;exports.f=pt;exports.g=Ye;exports.h=ft;exports.i=Q;exports.j=dt;exports.k=de;exports.l=Z;exports.m=xt;exports.n=kt;exports.o=Mt;exports.p=Pt;exports.q=wt;exports.r=Tt;
@@ -1 +0,0 @@
1
- function ae(e,t,r,n){let a=e-t-r,o=(n.count-1)*n.gap;return (a-o)/n.count}function U(e){let{pageSize:t,margins:r}=e,n=e.columns??{count:1,gap:0},a=[],o=[],c=r.top,i=t.h-r.bottom;if(i-c<=0)throw new Error("Paginator: page size and margins yield no content area");let u=ae(t.w,r.left,r.right,n),g=c;function l(p){return r.left+p*(u+n.gap)}function m(){let p=a.length+1,S=e.footnoteReservedHeights?.get(p)??0,T=i-S,w={number:p,fragments:[],margins:{...r},size:{...t},footnoteReservedHeight:S>0?S:void 0,columns:n.count>1?{...n}:void 0},C={page:w,cursorY:c,columnIndex:0,topMargin:c,contentBottom:T,trailingSpacing:0};return a.push(w),o.push(C),g=c,e.onNewPage&&e.onNewPage(C),C}function f(){return o.length===0?m():o[o.length-1]}function x(p){return p.contentBottom-p.cursorY}function h(p,S){let T=S||f();return x(T)>=p}function b(p){return p.columnIndex<n.count-1?(p.columnIndex+=1,p.cursorY=g,p.trailingSpacing=0,p):m()}function d(p){let S=f(),T=Number.isFinite(p)&&p>0?p:0,w=S.contentBottom-S.topMargin;if(T>w)return S.cursorY!==S.topMargin&&(S=b(S)),S;for(;!h(T,S);)S=b(S);return S}function k(p,S,T=0,w=0){let C=Math.max(T,f().trailingSpacing),R=C+S,I=d(R),H=I.cursorY===I.topMargin?0:C,L=l(I.columnIndex),B=I.cursorY+H;return p.x=L,p.y=B,I.page.fragments.push(p),I.cursorY=B+S,I.trailingSpacing=w,{state:I,x:L,y:B}}function y(){return m()}function F(){let p=f();return b(p)}function M(p){n=p,u=ae(t.w,r.left,r.right,n);let S=f();S.page.columns=n.count>1?{...n}:void 0,g=S.cursorY,S.columnIndex=0;}return {pages:a,states:o,get columnWidth(){return u},get columns(){return {...n}},getCurrentState:f,getAvailableHeight:()=>x(f()),fits:p=>h(p),ensureFits:d,addFragment:k,forcePageBreak:y,forceColumnBreak:F,getColumnX:l,updateColumns:M}}function j(e){let t=new Map,r=new Set;for(let n=0;n<e.length;n++){if(r.has(n))continue;let a=e[n];if(a.kind!=="paragraph"||!a.attrs?.keepNext)continue;let c=[n],i=n;for(let g=n+1;g<e.length;g++){let l=e[g];if(l.kind==="sectionBreak"||l.kind==="pageBreak"||l.kind==="columnBreak"||l.kind!=="paragraph")break;if(l.attrs?.keepNext)c.push(g),i=g,r.add(g);else break}let s=i+1,u=-1;if(s<e.length){let g=e[s];g.kind!=="sectionBreak"&&g.kind!=="pageBreak"&&g.kind!=="columnBreak"&&(u=s);}t.set(n,{startIndex:n,endIndex:i,memberIndices:c,anchorIndex:u});}return t}function q(e,t,r){let n=0;for(let a of e.memberIndices){let o=t[a],c=r[a];if(o.kind!=="paragraph"||c.kind!=="paragraph")continue;let i=o,s=c,u=i.attrs?.spacing?.before??0;n+=u,n+=s.totalHeight;let g=i.attrs?.spacing?.after??0;n+=g;}if(e.anchorIndex!==-1){let a=r[e.anchorIndex];if(a?.kind==="paragraph"){let o=a;o.lines.length>0&&(n+=o.lines[0].lineHeight);}}return n}function K(e){let t=new Set;for(let r of e.values())for(let n=1;n<r.memberIndices.length;n++)t.add(r.memberIndices[n]);return t}function $(e){return e.kind!=="paragraph"?false:e.attrs?.pageBreakBefore===true}var We={top:4,bottom:4,left:7,right:7},Ue=200;var Be={w:816,h:1056},O={top:96,right:96,bottom:96,left:96};function ie(e){return e.attrs?.spacing?.before??0}function se(e){return e.attrs?.spacing?.after??0}function Fe(e){for(let t=0;t<e.length-1;t++){let r=e[t],n=e[t+1];if(r.kind!=="paragraph"||n.kind!=="paragraph")continue;let a=r.attrs,o=n.attrs;a?.contextualSpacing&&o?.contextualSpacing&&a.styleId&&a.styleId===o.styleId&&(a.spacing&&(a.spacing={...a.spacing,after:0}),o.spacing&&(o.spacing={...o.spacing,before:0}));}}function rt(e,t,r={}){if(e.length!==t.length)throw new Error(`layoutDocument: expected one measure per block (blocks=${e.length}, measures=${t.length})`);let n=r.pageSize??Be,a={top:r.margins?.top??O.top,right:r.margins?.right??O.right,bottom:r.margins?.bottom??O.bottom,left:r.margins?.left??O.left,header:r.margins?.header??r.margins?.top??O.top,footer:r.margins?.footer??r.margins?.bottom??O.bottom};r.headerContentHeights,r.footerContentHeights,r.titlePage,r.evenAndOddHeaders;let o={...a},c=n.w-o.left-o.right;if(c<=0)throw new Error("layoutDocument: page size and margins yield no content area");let i={count:1,gap:0},s=[],u=[];for(let h=0;h<e.length;h++)if(e[h].kind==="sectionBreak"){let b=e[h];s.push(b.columns??i),u.push(b.type);}s.push(r.columns??i),u.push(r.bodyBreakType);let g=s.length>0?s[0]:r.columns,l=U({pageSize:n,margins:o,columns:g,footnoteReservedHeights:r.footnoteReservedHeights});Fe(e);let m=j(e),f=K(m),x=0;for(let h=0;h<e.length;h++){let b=e[h],d=t[h];$(b)&&l.forcePageBreak();let k=m.get(h);if(k&&!f.has(h)){let y=q(k,e,t),F=l.getCurrentState(),M=l.getAvailableHeight(),p=F.contentBottom-F.topMargin;y<=p&&y>M&&F.page.fragments.length>0&&l.forcePageBreak();}switch(b.kind){case "paragraph":Me(b,d,l,c);break;case "table":b.floating?Te(b,d,l,c):we(b,d,l);break;case "image":Ce(b,d,l);break;case "textBox":Re(b,d,l);break;case "pageBreak":l.forcePageBreak();break;case "columnBreak":l.forceColumnBreak();break;case "sectionBreak":{let y=u[x+1]??u[x];Le(b,l,s[x+1]??i,y),x++;break}}}return l.pages.length===0&&l.getCurrentState(),{pageSize:n,pages:l.pages,columns:r.columns,pageGap:r.pageGap}}function Me(e,t,r,n){if(t.kind!=="paragraph")throw new Error("layoutParagraph: expected paragraph measure");let a=t.lines;if(a.length===0){let s=ie(e),u=se(e),g=r.getCurrentState(),l={kind:"paragraph",blockId:e.id,x:r.getColumnX(g.columnIndex),y:g.cursorY+s,width:n,height:0,fromLine:0,toLine:0,pmStart:e.pmStart,pmEnd:e.pmEnd};r.addFragment(l,0,s,u);return}let o=ie(e),c=se(e),i=0;for(;i<a.length;){let s=r.getCurrentState(),u=r.getAvailableHeight(),g=0,l=0;for(let k=i;k<a.length;k++){let y=a[k].lineHeight,F=g+y;if((i===0&&k===i?F+o:F)<=u||l===0)g=F,l++;else break}let m=i===0,f=i+l>=a.length,x=m?o:0,h=f?c:0,b={kind:"paragraph",blockId:e.id,x:r.getColumnX(s.columnIndex),y:0,width:n,height:g,fromLine:i,toLine:i+l,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!m,continuesOnNext:!f},d=r.addFragment(b,g,x,h);b.y=d.y,i+=l,i<a.length&&r.ensureFits(a[i].lineHeight);}}function Pe(e){let t=0;for(let r of e.rows)if(r.isHeader)t++;else break;return t}function z(e,t){let r=0;for(let n=0;n<t&&n<e.rows.length;n++)r+=e.rows[n].height;return r}function we(e,t,r){if(t.kind!=="table")throw new Error("layoutTable: expected table measure");let n=t.rows;if(n.length===0)return;let a=Pe(e),o=z(t,a),c=0;for(;c<n.length;){let i=r.getCurrentState(),s=r.getAvailableHeight(),u=c===0,g=u?i.trailingSpacing:0,l=s-g,m=!u&&a>0?o:0,f=0,x=0;for(let F=c;F<n.length;F++){let M=n[F].height;if(f+M+m<=l||x===0)f+=M,x++;else break}let h=f+m,b=c+x>=n.length,d=r.getColumnX(i.columnIndex);e.justification==="center"?d=d+(r.columnWidth-t.totalWidth)/2:e.justification==="right"?d=d+r.columnWidth-t.totalWidth:e.indent&&(d+=e.indent);let k={kind:"table",blockId:e.id,x:d,y:0,width:t.totalWidth,height:h,fromRow:c,toRow:c+x,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!u,continuesOnNext:!b,headerRowCount:!u&&a>0?a:void 0},y=r.addFragment(k,h,0,0);if(k.y=y.y,k.x=d,c+=x,c<n.length){let F=n[c].height+(a>0?o:0);r.ensureFits(F);}}}function Te(e,t,r,n){if(t.kind!=="table")throw new Error("layoutFloatingTable: expected table measure");let a=r.getCurrentState(),o=e.floating,c=a.page,i=c.margins,s=t.totalWidth,u=t.totalHeight,g=c.size.h-i.top-i.bottom,l=i.left,m=i.top;o?.horzAnchor==="page"&&(l=0),o?.vertAnchor==="page"&&(m=0);let f=r.getColumnX(a.columnIndex);if(o?.tblpX!==void 0)f=l+o.tblpX;else if(o?.tblpXSpec){let y=o.tblpXSpec;y==="left"||y==="inside"?f=l:y==="right"||y==="outside"?f=l+n-s:y==="center"&&(f=l+(n-s)/2);}else e.justification==="center"?f=l+(n-s)/2:e.justification==="right"&&(f=l+n-s);let x=a.cursorY,h=false;if(o?.tblpY!==void 0)x=m+o.tblpY,h=true;else if(o?.tblpYSpec){h=true;let y=o.tblpYSpec;y==="top"?x=m:y==="bottom"?x=m+g-u:y==="center"&&(x=m+(g-u)/2);}h||(x=r.ensureFits(u).cursorY);let b=i.left,d=i.left+n-s;Number.isFinite(d)&&(f=Math.max(b,Math.min(f,d)));let k={kind:"table",blockId:e.id,x:f,y:x,width:s,height:u,fromRow:0,toRow:e.rows.length,pmStart:e.pmStart,pmEnd:e.pmEnd,isFloating:true};a.page.fragments.push(k);}function Ce(e,t,r){if(t.kind!=="image")throw new Error("layoutImage: expected image measure");if(e.anchor?.isAnchored){Ie(e,t,r);return}let n=r.ensureFits(t.height),a={kind:"image",blockId:e.id,x:r.getColumnX(n.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},o=r.addFragment(a,t.height,0,0);a.y=o.y;}function Ie(e,t,r){let n=r.getCurrentState(),a=e.anchor,o=a.offsetH??r.getColumnX(n.columnIndex),c=a.offsetV??n.cursorY,i={kind:"image",blockId:e.id,x:o,y:c,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd,isAnchored:true,zIndex:a.behindDoc?-1:1};n.page.fragments.push(i);}function Re(e,t,r){if(t.kind!=="textBox")throw new Error("layoutTextBox: expected textBox measure");let n=r.ensureFits(t.height),a={kind:"textBox",blockId:e.id,x:r.getColumnX(n.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},o=r.addFragment(a,t.height,0,0);a.y=o.y;}function Le(e,t,r,n){switch(n??"nextPage"){case "nextPage":t.forcePageBreak();break;case "evenPage":{t.forcePageBreak().page.number%2!==0&&t.forcePageBreak();break}case "oddPage":{t.forcePageBreak().page.number%2===0&&t.forcePageBreak();break}}t.updateColumns(r);}var ve={calibri:{googleFont:"Carlito",category:"sans-serif",fallbackStack:["Calibri","Carlito","Arial","Helvetica","sans-serif"],singleLineRatio:1.2207},cambria:{googleFont:"Caladea",category:"serif",fallbackStack:["Cambria","Caladea","Georgia","serif"],singleLineRatio:1.2676},arial:{googleFont:"Arimo",category:"sans-serif",fallbackStack:["Arial","Arimo","Helvetica","sans-serif"],singleLineRatio:1.1499},"times new roman":{googleFont:"Tinos",category:"serif",fallbackStack:["Times New Roman","Tinos","Times","serif"],singleLineRatio:1.1499},"courier new":{googleFont:"Cousine",category:"monospace",fallbackStack:["Courier New","Cousine","Courier","monospace"],singleLineRatio:1.1328},georgia:{googleFont:"Tinos",category:"serif",fallbackStack:["Georgia","Tinos","Times New Roman","serif"],singleLineRatio:1.1362},verdana:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Verdana","Open Sans","Arial","sans-serif"],singleLineRatio:1.2153},tahoma:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Tahoma","Open Sans","Arial","sans-serif"],singleLineRatio:1.2075},"trebuchet ms":{googleFont:"Fira Sans",category:"sans-serif",fallbackStack:["Trebuchet MS","Fira Sans","Arial","sans-serif"],singleLineRatio:1.1431},"comic sans ms":{googleFont:"Comic Neue",category:"cursive",fallbackStack:["Comic Sans MS","Comic Neue","cursive"],singleLineRatio:1.3936},impact:{googleFont:"Anton",category:"sans-serif",fallbackStack:["Impact","Anton","Arial Black","sans-serif"],singleLineRatio:1.2197},"palatino linotype":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Palatino Linotype","EB Garamond","Palatino","Georgia","serif"],singleLineRatio:1.0259},"book antiqua":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Book Antiqua","EB Garamond","Palatino","Georgia","serif"],singleLineRatio:1.0259},garamond:{googleFont:"EB Garamond",category:"serif",fallbackStack:["Garamond","EB Garamond","Georgia","serif"],singleLineRatio:1.068},"century gothic":{googleFont:"Questrial",category:"sans-serif",fallbackStack:["Century Gothic","Questrial","Arial","sans-serif"],singleLineRatio:1.1611},"lucida sans":{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Lucida Sans","Open Sans","Arial","sans-serif"],singleLineRatio:1.1655},"lucida console":{googleFont:"Cousine",category:"monospace",fallbackStack:["Lucida Console","Cousine","Courier New","monospace"],singleLineRatio:1.1387},consolas:{googleFont:"Inconsolata",category:"monospace",fallbackStack:["Consolas","Inconsolata","Cousine","Courier New","monospace"],singleLineRatio:1.1626},"ms mincho":{googleFont:"Noto Serif JP",category:"serif",fallbackStack:["MS Mincho","Noto Serif JP","serif"],singleLineRatio:1.15},"ms gothic":{googleFont:"Noto Sans JP",category:"sans-serif",fallbackStack:["MS Gothic","Noto Sans JP","sans-serif"],singleLineRatio:1.15},simhei:{googleFont:"Noto Sans SC",category:"sans-serif",fallbackStack:["SimHei","Noto Sans SC","sans-serif"],singleLineRatio:1.15},simsun:{googleFont:"Noto Serif SC",category:"serif",fallbackStack:["SimSun","Noto Serif SC","serif"],singleLineRatio:1.15},"malgun gothic":{googleFont:"Noto Sans KR",category:"sans-serif",fallbackStack:["Malgun Gothic","Noto Sans KR","sans-serif"],singleLineRatio:1.15}},He={"sans-serif":"Arial, Helvetica, sans-serif",serif:"Times New Roman, Times, serif",monospace:"Courier New, Courier, monospace",cursive:"cursive",fantasy:"fantasy","system-ui":"system-ui, sans-serif"};function Ee(e){let t=e.toLowerCase();return t.includes("mono")||t.includes("courier")||t.includes("consolas")||t.includes("console")||t.includes("code")||t.includes("terminal")?"monospace":t.includes("times")||t.includes("georgia")||t.includes("garamond")||t.includes("palatino")||t.includes("baskerville")||t.includes("bodoni")||t.includes("cambria")||t.includes("mincho")||t.includes("ming")||t.includes("song")||t.includes("serif")?"serif":t.includes("script")||t.includes("cursive")||t.includes("comic")||t.includes("brush")||t.includes("hand")?"cursive":"sans-serif"}function ce(e){let t=e.trim().toLowerCase(),r=ve[t];if(r)return {googleFont:r.googleFont,cssFallback:r.fallbackStack.map(le).join(", "),originalFont:e,hasGoogleEquivalent:true,singleLineRatio:r.singleLineRatio};let n=Ee(e),a=He[n];return {googleFont:null,cssFallback:`${le(e)}, ${a}`,originalFont:e,hasGoogleEquivalent:false,singleLineRatio:1.15}}function le(e){return ["serif","sans-serif","monospace","cursive","fantasy","system-ui"].includes(e.toLowerCase())?e:/[\s,'"()]/.test(e)?`"${e.replace(/"/g,'\\"')}"`:e}function ct(e,t){if(!t)return null;let n=e.toLowerCase().startsWith("major")?t.majorFont:t.minorFont;if(!n)return null;let a=e.toLowerCase();return a.includes("eastasia")||a.includes("ea")?n.ea??n.latin??null:a.includes("cs")||a.includes("bidi")?n.cs??n.latin??null:n.latin??null}var ge=96,me=11,pe="Calibri",Ne=1,Oe=.8,ze=.2,_=null;function J(){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 pt(){_=null;}var ue=new Map;function fe(e){let t=ue.get(e);if(t===void 0){let r=ce(e);t={cssFallback:r.cssFallback,singleLineRatio:r.singleLineRatio},ue.set(e,t);}return t}function _e(e){return fe(e).cssFallback}function V(e){let t=[];e.italic&&t.push("italic"),e.bold&&t.push("bold");let r=e.fontSize??me,n=de(r);t.push(`${n}px`);let a=e.fontFamily??pe;return t.push(_e(a)),t.join(" ")}function Ye(e){let t=e.fontSize??me,r=e.fontFamily??pe,n=de(t),a=n*Oe,o=n*ze,c=n*Ne;try{let s=J();s.font=V(e);let u=s.measureText("Hg");typeof u.actualBoundingBoxAscent=="number"&&typeof u.actualBoundingBoxDescent=="number"&&(a=u.actualBoundingBoxAscent,o=u.actualBoundingBoxDescent);}catch{}c=Math.max(c,a+o);let i=fe(r).singleLineRatio;return {fontSize:t,ascent:a,descent:o,lineHeight:c,fontFamily:r,singleLineRatio:i}}function ft(e,t){if(!e)return 0;let r=J();r.font=V(t);let a=r.measureText(e).width;return t.letterSpacing&&e.length>1&&(a+=t.letterSpacing*(e.length-1)),a}function Q(e,t){let r=Ye(t);if(!e)return {width:0,charWidths:[],metrics:r};let n=J();n.font=V(t);let a=t.letterSpacing??0,o=[],c=0;for(let i=0;i<e.length;i++){let s=e[i],g=n.measureText(s).width;a&&i<e.length-1&&(g+=a),o.push(g),c+=g;}return {width:c,charWidths:o,metrics:r}}function dt(e,t){if(t.length===0||e<=0)return 0;let r=0;for(let n=0;n<t.length;n++){let a=t[n],o=r+a/2;if(e<=o)return n;r+=a;}return t.length}function de(e){return e*ge/72}function Z(e,t){let r=e.pageGap??0,n=0;for(let a=0;a<t&&a<e.pages.length;a++){let c=e.pages[a].size?.h??e.pageSize.h;n+=c+r;}return n}function he(e,t){return e.findIndex(r=>r.id===t)}function Xe(e,t){let r=0;for(let n=e.fromLine;n<e.toLine&&n<t.lines.length;n++)r+=t.lines[n].lineHeight;return r}function xt(e,t,r,n){let a=[...e.page.fragments].sort((o,c)=>{let i=o.y-c.y;return Math.abs(i)>.5?i:o.x-c.x});for(let o of a){let c=he(t,o.blockId);if(c===-1)continue;let i=t[c],s=r[c];if(!i||!s)continue;let u;if(o.kind==="paragraph"){if(i.kind!=="paragraph"||s.kind!=="paragraph")continue;u=Xe(o,s);}else if(o.kind==="table")u=o.height;else if(o.kind==="image")u=o.height;else continue;let g=n.x>=o.x&&n.x<=o.x+o.width,l=n.y>=o.y&&n.y<=o.y+u;if(g&&l)return {fragment:o,block:i,measure:s,pageIndex:e.pageIndex,localX:n.x-o.x,localY:n.y-o.y}}return null}function kt(e,t,r,n){for(let a of e.page.fragments){if(a.kind!=="table")continue;let o=a,c=n.x>=o.x&&n.x<=o.x+o.width,i=n.y>=o.y&&n.y<=o.y+o.height;if(!c||!i)continue;let s=he(t,o.blockId);if(s===-1)continue;let u=t[s],g=r[s];if(!u||u.kind!=="table"||!g||g.kind!=="table")continue;let l=u,m=g,f=n.x-o.x,x=n.y-o.y,h=o.headerRowCount??0,b=h>0&&o.continuesFromPrev?z(m,h):0,d=0,k=-1;if(m.rows.length===0||l.rows.length===0)continue;if(b>0&&x<b){let B=0;for(let P=0;P<h&&P<m.rows.length;P++){let E=m.rows[P];if(x>=B&&x<B+E.height){k=P;break}B+=E.height;}k===-1&&(k=0);}else {let B=x-b;for(let P=o.fromRow;P<o.toRow&&P<m.rows.length;P++){let E=m.rows[P];if(B>=d&&B<d+E.height){k=P;break}d+=E.height;}}if(k===-1&&(k=Math.min(o.toRow-1,m.rows.length-1),k<o.fromRow))continue;let y=m.rows[k],F=l.rows[k];if(!y||!F)continue;let M=0,p=-1;if(y.cells.length===0||F.cells.length===0)continue;for(let B=0;B<y.cells.length;B++){let P=y.cells[B];if(f>=M&&f<M+P.width){p=B;break}M+=P.width;}if(p===-1&&(p=y.cells.length-1,p<0))continue;let S=y.cells[p],T=F.cells[p];if(!S||!T)continue;let w=0;if(b>0&&k<h)for(let B=0;B<k;B++)w+=m.rows[B]?.height??0;else {w=b;for(let B=o.fromRow;B<k;B++)w+=m.rows[B]?.height??0;}let R=0;for(let B=0;B<p;B++)R+=y.cells[B]?.width??0;let I,v;if(T.blocks&&T.blocks.length>0){let B=T.blocks[0],P=S.blocks[0];B.kind==="paragraph"&&P?.kind==="paragraph"&&(I=B,v=P);}let H=f-R,L=x-w;return {fragment:o,block:l,measure:m,pageIndex:e.pageIndex,rowIndex:k,colIndex:p,cellBlock:I,cellMeasure:v,cellLocalX:Math.max(0,H),cellLocalY:Math.max(0,L)}}return null}function be(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function ee(e,t){return e.findIndex(r=>r.id===t)}function D(e,t){let n=(e.pmStart??0)+1,a=0,o;for(let s=0;s<e.runs.length&&s<=t.toRun;s++){let u=e.runs[s];if(u){if(s<t.fromRun)u.kind==="text"?a+=(u.text??"").length:a+=1;else if(s===t.fromRun){a+=t.fromChar,o=n+a;break}}}o===void 0&&(o=n);let c=0;for(let s=t.fromRun;s<=t.toRun&&s<e.runs.length;s++){let u=e.runs[s];if(u)if(u.kind==="text"){let g=u.text??"",l=s===t.fromRun?t.fromChar:0,m=s===t.toRun?t.toChar:g.length;c+=m-l;}else c+=1;}let i=o+c;return {pmStart:o,pmEnd:i}}function xe(e,t,r,n){let a=[];for(let o=0;o<t.lines.length;o++){let c=t.lines[o],i=D(e,c);i.pmStart===void 0||i.pmEnd===void 0||i.pmEnd>r&&i.pmStart<n&&a.push({line:c,index:o});}return a}function Y(e,t,r){let n=D(e,t);return n.pmStart===void 0?0:Math.max(0,r-n.pmStart)}function X(e,t,r,n){let a=0,o=0;for(let c=t.fromRun;c<=t.toRun&&c<e.runs.length;c++){let i=e.runs[c];if(i){if(i.kind==="tab"){let s=i.width??48;if(o+1>=r)return r<=o?a:a+s;a+=s,o+=1;continue}if(i.kind==="image"){let s=i.width;if(o+1>=r)return r<=o?a:a+s;a+=s,o+=1;continue}if(i.kind==="lineBreak"){if(r<=o)return a;o+=1;continue}if(i.kind==="text"){let s=i.text??"",u=c===t.fromRun,g=c===t.toRun,l=u?t.fromChar:0,m=g?t.toChar:s.length,f=s.slice(l,m);if(o+f.length>=r){let b=r-o,d=be(i),k=Q(f.slice(0,b),d);return a+k.width}let x=be(i),h=Q(f,x);a+=h.width,o+=f.length;}}}return a}function G(e,t){let r=0;for(let n=0;n<t&&n<e.lines.length;n++)r+=e.lines[n].lineHeight;return r}function Mt(e,t,r,n,a){if(n===a)return [];let o=Math.min(n,a),c=Math.max(n,a),i=[];for(let s=0;s<e.pages.length;s++){let u=e.pages[s],g=Z(e,s);for(let l of u.fragments){if(l.kind==="paragraph"){let m=ee(t,l.blockId);if(m===-1)continue;let f=t[m],x=r[m];if(!f||f.kind!=="paragraph"||!x||x.kind!=="paragraph")continue;let h=f,b=x,d=l,k=xe(h,b,o,c);for(let{line:y,index:F}of k){if(F<d.fromLine||F>=d.toLine)continue;let M=D(h,y);if(M.pmStart===void 0||M.pmEnd===void 0)continue;let p=Math.max(M.pmStart,o),S=Math.min(M.pmEnd,c);if(p>=S)continue;let T=Y(h,y,p),w=Y(h,y,S),C=h.attrs?.indent,R=C?.left??0,I=C?.right??0,v=Math.max(0,l.width-R-I),H=X(h,y,T),L=X(h,y,w),B=h.attrs?.alignment??"left",P=0;B==="center"?P=Math.max(0,(v-y.width)/2):B==="right"&&(P=Math.max(0,v-y.width));let E=G(b,F)-G(b,d.fromLine),A=l.x+R+P+Math.min(H,L),W=Math.max(1,Math.abs(L-H)),N=l.y+E;i.push({x:A,y:N+g,width:W,height:y.lineHeight,pageIndex:s});}}if(l.kind==="table"){let m=ee(t,l.blockId);if(m===-1)continue;let f=t[m],x=r[m];if(!f||f.kind!=="table"||!x||x.kind!=="table")continue;let h=f,b=x,d=l,k=d.headerRowCount??0,F=k>0&&d.continuesFromPrev?z(b,k):0;for(let M=d.fromRow;M<d.toRow&&M<h.rows.length;M++){let p=h.rows[M],S=b.rows[M];if(!p||!S)continue;let T=0;for(let w=0;w<p.cells.length;w++){let C=p.cells[w],R=S.cells[w];if(!(!C||!R)){for(let I=0;I<C.blocks.length;I++){let v=C.blocks[I],H=R.blocks[I];if(!v||v.kind!=="paragraph"||!H||H.kind!=="paragraph")continue;let L=v,B=H,P=xe(L,B,o,c),E=0;for(let{line:A,index:W}of P){let N=D(L,A);if(N.pmStart===void 0||N.pmEnd===void 0)continue;let te=Math.max(N.pmStart,o),ne=Math.min(N.pmEnd,c);if(te>=ne)continue;let ke=Y(L,A,te),ye=Y(L,A,ne),re=X(L,A,ke,R.width),oe=X(L,A,ye,R.width),Se=G(B,W);i.push({x:d.x+T+Math.min(re,oe),y:d.y+F+E+Se+g,width:Math.max(1,Math.abs(oe-re)),height:A.lineHeight,pageIndex:s});}E+=B.totalHeight;}T+=R.width;}}F+=S.height;}}if(l.kind==="image"){let m=l.pmStart??0;(l.pmEnd??m+1)>o&&m<c&&i.push({x:l.x,y:l.y+g,width:l.width,height:l.height,pageIndex:s});}}}return i}function Pt(e,t,r,n){for(let a=0;a<e.pages.length;a++){let o=e.pages[a],c=Z(e,a);for(let i of o.fragments){if(i.kind==="paragraph"){let s=ee(t,i.blockId);if(s===-1)continue;let u=t[s],g=r[s];if(!u||u.kind!=="paragraph"||!g||g.kind!=="paragraph")continue;let l=u,m=g,f=i,x=l.pmStart??0,h=l.pmEnd??x;if(n<x||n>h)continue;for(let b=f.fromLine;b<f.toLine;b++){let d=m.lines[b];if(!d)continue;let k=D(l,d);if(!(k.pmStart===void 0||k.pmEnd===void 0)&&n>=k.pmStart&&n<=k.pmEnd){let y=Y(l,d,n),F=l.attrs?.indent,M=F?.left??0,p=F?.right??0,S=Math.max(0,i.width-M-p),T=X(l,d,y),w=l.attrs?.alignment??"left",C=0;w==="center"?C=Math.max(0,(S-d.width)/2):w==="right"&&(C=Math.max(0,S-d.width));let R=G(m,b)-G(m,f.fromLine);return {x:i.x+M+C+T,y:i.y+R+c,height:d.lineHeight,pageIndex:a}}}}if(i.kind==="image"){let s=i.pmStart??0,u=i.pmEnd??s+1;if(n>=s&&n<=u){let g=n===s?0:i.width;return {x:i.x+g,y:i.y+c,height:i.height,pageIndex:a}}}}}return null}function wt(e){return e.length<=1?false:new Set(e.map(r=>r.pageIndex)).size>1}function Tt(e){let t=new Map;for(let r of e){let n=t.get(r.pageIndex)??[];n.push(r),t.set(r.pageIndex,n);}return t}export{ce as a,ct as b,We as c,Ue as d,rt as e,pt as f,Ye as g,ft as h,Q as i,dt as j,de as k,Z as l,xt as m,kt as n,Mt as o,Pt as p,wt as q,Tt as r};
@@ -1 +0,0 @@
1
- 'use strict';var chunkQQ63M65M_js=require('./chunk-QQ63M65M.js');require('./chunk-H5NTJZO4.js');Object.defineProperty(exports,"getCaretPosition",{enumerable:true,get:function(){return chunkQQ63M65M_js.p}});Object.defineProperty(exports,"groupRectsByPage",{enumerable:true,get:function(){return chunkQQ63M65M_js.r}});Object.defineProperty(exports,"isMultiPageSelection",{enumerable:true,get:function(){return chunkQQ63M65M_js.q}});Object.defineProperty(exports,"selectionToRects",{enumerable:true,get:function(){return chunkQQ63M65M_js.o}});
@@ -1 +0,0 @@
1
- export{p as getCaretPosition,r as groupRectsByPage,q as isMultiPageSelection,o as selectionToRects}from'./chunk-TDEHAPMZ.mjs';import'./chunk-TAUMSKRE.mjs';