@eigenpal/docx-js-editor 0.0.31 → 0.0.32

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 (46) hide show
  1. package/dist/{chunk-CQR767EJ.mjs → chunk-2HDYCD2Q.mjs} +1 -1
  2. package/dist/chunk-37SLIJPH.mjs +58 -0
  3. package/dist/{chunk-KCUPCJFL.mjs → chunk-6AJI5NPH.mjs} +1 -1
  4. package/dist/chunk-7MGFEP2R.mjs +26 -0
  5. package/dist/chunk-7QTNB64A.mjs +9 -0
  6. package/dist/chunk-EEV6TUOX.mjs +261 -0
  7. package/dist/chunk-EF3LLEN7.js +4 -0
  8. package/dist/{chunk-ZKKL54FH.js → chunk-EV3CM6TU.js} +1 -1
  9. package/dist/chunk-HWWZOJMR.mjs +4 -0
  10. package/dist/{chunk-N2UPYG75.js → chunk-KCOGY3V2.js} +2 -2
  11. package/dist/chunk-KUL2SDYC.js +26 -0
  12. package/dist/chunk-P7WEP4JU.js +9 -0
  13. package/dist/{chunk-FFNGY4AB.mjs → chunk-RTFUE3KK.mjs} +1 -1
  14. package/dist/{chunk-XGL3EGKF.js → chunk-UMDJQ3Q4.js} +4 -4
  15. package/dist/chunk-WH2EK2HU.js +261 -0
  16. package/dist/chunk-ZJNGMDRE.js +58 -0
  17. package/dist/core-plugins-reexport.js +1 -1
  18. package/dist/core-plugins-reexport.mjs +1 -1
  19. package/dist/core-reexport.js +1 -1
  20. package/dist/core-reexport.mjs +1 -1
  21. package/dist/headless-reexport.js +2 -2
  22. package/dist/headless-reexport.mjs +1 -1
  23. package/dist/index.js +2 -2
  24. package/dist/index.mjs +1 -1
  25. package/dist/mcp-reexport.js +3 -3
  26. package/dist/mcp-reexport.mjs +2 -2
  27. package/dist/react.js +1 -1
  28. package/dist/react.mjs +1 -1
  29. package/dist/selectionRects-DEX5THEG.js +1 -0
  30. package/dist/selectionRects-SQTAHMCH.mjs +1 -0
  31. package/dist/styles.css +1 -1
  32. package/dist/ui.js +1 -1
  33. package/dist/ui.mjs +1 -1
  34. package/package.json +2 -1
  35. package/dist/chunk-2KHL5RSD.js +0 -4
  36. package/dist/chunk-3Y6ZBC3P.js +0 -9
  37. package/dist/chunk-6CSL7T4S.mjs +0 -9
  38. package/dist/chunk-7HZRJTOL.mjs +0 -4
  39. package/dist/chunk-A2DPBJHE.mjs +0 -258
  40. package/dist/chunk-DJI7XTMH.js +0 -59
  41. package/dist/chunk-HIITS47V.js +0 -258
  42. package/dist/chunk-NKJBKWYY.js +0 -26
  43. package/dist/chunk-OBTGZZLM.mjs +0 -26
  44. package/dist/chunk-TQATISQV.mjs +0 -59
  45. package/dist/selectionRects-D45BP6HQ.js +0 -1
  46. package/dist/selectionRects-Z72BKRLU.mjs +0 -1
@@ -1 +1 @@
1
- function ee(e,t,r,n){let a=e-t-r,o=(n.count-1)*n.gap;return (a-o)/n.count}function te(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=ee(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,I=i-S,T={number:p,fragments:[],margins:{...r},size:{...t},footnoteReservedHeight:S>0?S:void 0,columns:n.count>1?{...n}:void 0},M={page:T,cursorY:c,columnIndex:0,topMargin:c,contentBottom:I,trailingSpacing:0};return a.push(T),o.push(M),g=c,e.onNewPage&&e.onNewPage(M),M}function f(){return o.length===0?m():o[o.length-1]}function x(p){return p.contentBottom-p.cursorY}function d(p,S){let I=S||f();return x(I)>=p}function b(p){return p.columnIndex<n.count-1?(p.columnIndex+=1,p.cursorY=g,p.trailingSpacing=0,p):m()}function h(p){let S=f(),I=Number.isFinite(p)&&p>0?p:0,T=S.contentBottom-S.topMargin;if(I>T)return S.cursorY!==S.topMargin&&(S=b(S)),S;for(;!d(I,S);)S=b(S);return S}function k(p,S,I=0,T=0){let M=Math.max(I,f().trailingSpacing),C=M+S,R=h(C),E=R.cursorY===R.topMargin?0:M,L=l(R.columnIndex),F=R.cursorY+E;return p.x=L,p.y=F,R.page.fragments.push(p),R.cursorY=F+S,R.trailingSpacing=T,{state:R,x:L,y:F}}function y(){return m()}function B(){let p=f();return b(p)}function w(p){n=p,u=ee(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=>d(p),ensureFits:h,addFragment:k,forcePageBreak:y,forceColumnBreak:B,getColumnX:l,updateColumns:w}}function ne(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 re(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 oe(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 ae(e){return e.kind!=="paragraph"?false:e.attrs?.pageBreakBefore===true}var We={top:4,bottom:4,left:7,right:7},Ue=200;var Fe={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 Be(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 $e(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??Fe,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 d=0;d<e.length;d++)if(e[d].kind==="sectionBreak"){let b=e[d];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=te({pageSize:n,margins:o,columns:g,footnoteReservedHeights:r.footnoteReservedHeights});Be(e);let m=ne(e),f=oe(m),x=0;for(let d=0;d<e.length;d++){let b=e[d],h=t[d];ae(b)&&l.forcePageBreak();let k=m.get(d);if(k&&!f.has(d)){let y=re(k,e,t),B=l.getCurrentState(),w=l.getAvailableHeight(),p=B.contentBottom-B.topMargin;y<=p&&y>w&&B.page.fragments.length>0&&l.forcePageBreak();}switch(b.kind){case "paragraph":we(b,h,l,c);break;case "table":b.floating?Ie(b,h,l,c):Te(b,h,l);break;case "image":Me(b,h,l);break;case "textBox":Ce(b,h,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 we(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,B=g+y;if((i===0&&k===i?B+o:B)<=u||l===0)g=B,l++;else break}let m=i===0,f=i+l>=a.length,x=m?o:0,d=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},h=r.addFragment(b,g,x,d);b.y=h.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 Y(e,t){let r=0;for(let n=0;n<t&&n<e.rows.length;n++)r+=e.rows[n].height;return r}function Te(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=Y(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 B=c;B<n.length;B++){let w=n[B].height;if(f+w+m<=l||x===0)f+=w,x++;else break}let d=f+m,b=c+x>=n.length,h=r.getColumnX(i.columnIndex);e.justification==="center"?h=h+(r.columnWidth-t.totalWidth)/2:e.justification==="right"?h=h+r.columnWidth-t.totalWidth:e.indent&&(h+=e.indent);let k={kind:"table",blockId:e.id,x:h,y:0,width:t.totalWidth,height:d,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,d,0,0);if(k.y=y.y,k.x=h,c+=x,c<n.length){let B=n[c].height+(a>0?o:0);r.ensureFits(B);}}}function Ie(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,d=false;if(o?.tblpY!==void 0)x=m+o.tblpY,d=true;else if(o?.tblpYSpec){d=true;let y=o.tblpYSpec;y==="top"?x=m:y==="bottom"?x=m+g-u:y==="center"&&(x=m+(g-u)/2);}d||(x=r.ensureFits(u).cursorY);let b=i.left,h=i.left+n-s;Number.isFinite(h)&&(f=Math.max(b,Math.min(f,h)));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 Me(e,t,r){if(t.kind!=="image")throw new Error("layoutImage: expected image measure");if(e.anchor?.isAnchored){Re(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 Re(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 Ce(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 He={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}},Ee={"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 ve(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=He[t];if(r)return {googleFont:r.googleFont,cssFallback:r.fallbackStack.map(le).join(", "),originalFont:e,hasGoogleEquivalent:true,singleLineRatio:r.singleLineRatio};let n=ve(e),a=Ee[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 Qe(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,Ye=.2,_=null;function U(){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 nt(){_=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 j(e){let t=[];e.italic&&t.push("italic"),e.bold&&t.push("bold");let r=e.fontSize??me,n=he(r);t.push(`${n}px`);let a=e.fontFamily??pe;return t.push(_e(a)),t.join(" ")}function ze(e){let t=e.fontSize??me,r=e.fontFamily??pe,n=he(t),a=n*Oe,o=n*Ye,c=n*Ne;try{let s=U();s.font=j(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 rt(e,t){if(!e)return 0;let r=U();r.font=j(t);let a=r.measureText(e).width;return t.letterSpacing&&e.length>1&&(a+=t.letterSpacing*(e.length-1)),a}function K(e,t){let r=ze(t);if(!e)return {width:0,charWidths:[],metrics:r};let n=U();n.font=j(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 ot(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 he(e){return e*ge/72}function q(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 de(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 st(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=de(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 lt(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=de(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,d=o.headerRowCount??0,b=d>0&&o.continuesFromPrev?Y(m,d):0,h=0,k=-1;if(m.rows.length===0||l.rows.length===0)continue;if(b>0&&x<b){let F=0;for(let P=0;P<d&&P<m.rows.length;P++){let v=m.rows[P];if(x>=F&&x<F+v.height){k=P;break}F+=v.height;}k===-1&&(k=0);}else {let F=x-b;for(let P=o.fromRow;P<o.toRow&&P<m.rows.length;P++){let v=m.rows[P];if(F>=h&&F<h+v.height){k=P;break}h+=v.height;}}if(k===-1&&(k=Math.min(o.toRow-1,m.rows.length-1),k<o.fromRow))continue;let y=m.rows[k],B=l.rows[k];if(!y||!B)continue;let w=0,p=-1;if(y.cells.length===0||B.cells.length===0)continue;for(let F=0;F<y.cells.length;F++){let P=y.cells[F];if(f>=w&&f<w+P.width){p=F;break}w+=P.width;}if(p===-1&&(p=y.cells.length-1,p<0))continue;let S=y.cells[p],I=B.cells[p];if(!S||!I)continue;let T=0;if(b>0&&k<d)for(let F=0;F<k;F++)T+=m.rows[F]?.height??0;else {T=b;for(let F=o.fromRow;F<k;F++)T+=m.rows[F]?.height??0;}let C=0;for(let F=0;F<p;F++)C+=y.cells[F]?.width??0;let R,H;if(I.blocks&&I.blocks.length>0){let F=I.blocks[0],P=S.blocks[0];F.kind==="paragraph"&&P?.kind==="paragraph"&&(R=F,H=P);}let E=f-C,L=x-T;return {fragment:o,block:l,measure:m,pageIndex:e.pageIndex,rowIndex:k,colIndex:p,cellBlock:R,cellMeasure:H,cellLocalX:Math.max(0,E),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 $(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 z(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,h=be(i),k=K(f.slice(0,b),h);return a+k.width}let x=be(i),d=K(f,x);a+=d.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 pt(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=q(e,s);for(let l of u.fragments){if(l.kind==="paragraph"){let m=$(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 d=f,b=x,h=l,k=xe(d,b,o,c);for(let{line:y,index:B}of k){if(B<h.fromLine||B>=h.toLine)continue;let w=D(d,y);if(w.pmStart===void 0||w.pmEnd===void 0)continue;let p=Math.max(w.pmStart,o),S=Math.min(w.pmEnd,c);if(p>=S)continue;let I=z(d,y,p),T=z(d,y,S),M=d.attrs?.indent,C=M?.left??0,R=M?.right??0,H=Math.max(0,l.width-C-R),E=X(d,y,I),L=X(d,y,T),F=d.attrs?.alignment??"left",P=0;F==="center"?P=Math.max(0,(H-y.width)/2):F==="right"&&(P=Math.max(0,H-y.width));let v=G(b,B)-G(b,h.fromLine),A=l.x+C+P+Math.min(E,L),W=Math.max(1,Math.abs(L-E)),N=l.y+v;i.push({x:A,y:N+g,width:W,height:y.lineHeight,pageIndex:s});}}if(l.kind==="table"){let m=$(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 d=f,b=x,h=l,k=h.headerRowCount??0,B=k>0&&h.continuesFromPrev?Y(b,k):0;for(let w=h.fromRow;w<h.toRow&&w<d.rows.length;w++){let p=d.rows[w],S=b.rows[w];if(!p||!S)continue;let I=0;for(let T=0;T<p.cells.length;T++){let M=p.cells[T],C=S.cells[T];if(!(!M||!C)){for(let R=0;R<M.blocks.length;R++){let H=M.blocks[R],E=C.blocks[R];if(!H||H.kind!=="paragraph"||!E||E.kind!=="paragraph")continue;let L=H,F=E,P=xe(L,F,o,c),v=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 J=Math.max(N.pmStart,o),V=Math.min(N.pmEnd,c);if(J>=V)continue;let ke=z(L,A,J),ye=z(L,A,V),Q=X(L,A,ke,C.width),Z=X(L,A,ye,C.width),Se=G(F,W);i.push({x:h.x+I+Math.min(Q,Z),y:h.y+B+v+Se+g,width:Math.max(1,Math.abs(Z-Q)),height:A.lineHeight,pageIndex:s});}v+=F.totalHeight;}I+=C.width;}}B+=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 ft(e,t,r,n){for(let a=0;a<e.pages.length;a++){let o=e.pages[a],c=q(e,a);for(let i of o.fragments){if(i.kind==="paragraph"){let s=$(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,d=l.pmEnd??x;if(n<x||n>d)continue;for(let b=f.fromLine;b<f.toLine;b++){let h=m.lines[b];if(!h)continue;let k=D(l,h);if(!(k.pmStart===void 0||k.pmEnd===void 0)&&n>=k.pmStart&&n<=k.pmEnd){let y=z(l,h,n),B=l.attrs?.indent,w=B?.left??0,p=B?.right??0,S=Math.max(0,i.width-w-p),I=X(l,h,y),T=l.attrs?.alignment??"left",M=0;T==="center"?M=Math.max(0,(S-h.width)/2):T==="right"&&(M=Math.max(0,S-h.width));let C=G(m,b)-G(m,f.fromLine);return {x:i.x+w+M+I,y:i.y+C+c,height:h.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 ht(e){return e.length<=1?false:new Set(e.map(r=>r.pageIndex)).size>1}function dt(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,Qe as b,We as c,Ue as d,$e as e,nt as f,ze as g,rt as h,K as i,ot as j,he as k,q as l,st as m,lt as n,pt as o,ft as p,ht as q,dt as r};
1
+ function ee(e,t,r,n){let a=e-t-r,o=(n.count-1)*n.gap;return (a-o)/n.count}function te(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=ee(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,I=i-S,T={number:p,fragments:[],margins:{...r},size:{...t},footnoteReservedHeight:S>0?S:void 0,columns:n.count>1?{...n}:void 0},M={page:T,cursorY:c,columnIndex:0,topMargin:c,contentBottom:I,trailingSpacing:0};return a.push(T),o.push(M),g=c,e.onNewPage&&e.onNewPage(M),M}function f(){return o.length===0?m():o[o.length-1]}function x(p){return p.contentBottom-p.cursorY}function d(p,S){let I=S||f();return x(I)>=p}function b(p){return p.columnIndex<n.count-1?(p.columnIndex+=1,p.cursorY=g,p.trailingSpacing=0,p):m()}function h(p){let S=f(),I=Number.isFinite(p)&&p>0?p:0,T=S.contentBottom-S.topMargin;if(I>T)return S.cursorY!==S.topMargin&&(S=b(S)),S;for(;!d(I,S);)S=b(S);return S}function k(p,S,I=0,T=0){let M=Math.max(I,f().trailingSpacing),C=M+S,R=h(C),E=R.cursorY===R.topMargin?0:M,L=l(R.columnIndex),F=R.cursorY+E;return p.x=L,p.y=F,R.page.fragments.push(p),R.cursorY=F+S,R.trailingSpacing=T,{state:R,x:L,y:F}}function y(){return m()}function B(){let p=f();return b(p)}function w(p){n=p,u=ee(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=>d(p),ensureFits:h,addFragment:k,forcePageBreak:y,forceColumnBreak:B,getColumnX:l,updateColumns:w}}function ne(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 re(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 oe(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 ae(e){return e.kind!=="paragraph"?false:e.attrs?.pageBreakBefore===true}var Ue={top:4,bottom:4,left:7,right:7},je=200;var Fe={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 Be(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 Je(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??Fe,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 d=0;d<e.length;d++)if(e[d].kind==="sectionBreak"){let b=e[d];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=te({pageSize:n,margins:o,columns:g,footnoteReservedHeights:r.footnoteReservedHeights});Be(e);let m=ne(e),f=oe(m),x=0;for(let d=0;d<e.length;d++){let b=e[d],h=t[d];ae(b)&&l.forcePageBreak();let k=m.get(d);if(k&&!f.has(d)){let y=re(k,e,t),B=l.getCurrentState(),w=l.getAvailableHeight(),p=B.contentBottom-B.topMargin;y<=p&&y>w&&B.page.fragments.length>0&&l.forcePageBreak();}switch(b.kind){case "paragraph":we(b,h,l,c);break;case "table":b.floating?Ie(b,h,l,c):Te(b,h,l);break;case "image":Me(b,h,l);break;case "textBox":Ce(b,h,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 we(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,B=g+y;if((i===0&&k===i?B+o:B)<=u||l===0)g=B,l++;else break}let m=i===0,f=i+l>=a.length,x=m?o:0,d=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},h=r.addFragment(b,g,x,d);b.y=h.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 Y(e,t){let r=0;for(let n=0;n<t&&n<e.rows.length;n++)r+=e.rows[n].height;return r}function Te(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=Y(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 B=c;B<n.length;B++){let w=n[B].height;if(f+w+m<=l||x===0)f+=w,x++;else break}let d=f+m,b=c+x>=n.length,h=r.getColumnX(i.columnIndex);e.justification==="center"?h=h+(r.columnWidth-t.totalWidth)/2:e.justification==="right"?h=h+r.columnWidth-t.totalWidth:e.indent&&(h+=e.indent);let k={kind:"table",blockId:e.id,x:h,y:0,width:t.totalWidth,height:d,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,d,0,0);if(k.y=y.y,k.x=h,c+=x,c<n.length){let B=n[c].height+(a>0?o:0);r.ensureFits(B);}}}function Ie(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,d=false;if(o?.tblpY!==void 0)x=m+o.tblpY,d=true;else if(o?.tblpYSpec){d=true;let y=o.tblpYSpec;y==="top"?x=m:y==="bottom"?x=m+g-u:y==="center"&&(x=m+(g-u)/2);}d||(x=r.ensureFits(u).cursorY);let b=i.left,h=i.left+n-s;Number.isFinite(h)&&(f=Math.max(b,Math.min(f,h)));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 Me(e,t,r){if(t.kind!=="image")throw new Error("layoutImage: expected image measure");if(e.anchor?.isAnchored){Re(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 Re(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 Ce(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 He={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.1172},"times new roman":{googleFont:"Tinos",category:"serif",fallbackStack:["Times New Roman","Tinos","Times","serif"],singleLineRatio:1.1074},"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}},Ee={"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 ve(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=He[t];if(r)return {googleFont:r.googleFont,cssFallback:r.fallbackStack.map(le).join(", "),originalFont:e,hasGoogleEquivalent:true,singleLineRatio:r.singleLineRatio};let n=ve(e),a=Ee[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 Ze(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 Ae=1440,ge=96,Ne=Ae/ge,me=11,pe="Calibri",Oe=1,Ye=.8,_e=.2,_=null;function U(){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 nt(){_=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 ze(e){return fe(e).cssFallback}function j(e){let t=[];e.italic&&t.push("italic"),e.bold&&t.push("bold");let r=e.fontSize??me,n=he(r);t.push(`${n}px`);let a=e.fontFamily??pe;return t.push(ze(a)),t.join(" ")}function Xe(e){let t=e.fontSize??me,r=e.fontFamily??pe,n=he(t),a=n*Ye,o=n*_e,c=n*Oe;try{let s=U();s.font=j(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 rt(e,t){if(!e)return 0;let r=U();r.font=j(t);let a=r.measureText(e).width;return t.letterSpacing&&e.length>1&&(a+=t.letterSpacing*(e.length-1)),a}function K(e,t){let r=Xe(t);if(!e)return {width:0,charWidths:[],metrics:r};let n=U();n.font=j(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 ot(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 at(e){return e/Ne}function he(e){return e*ge/72}function q(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 de(e,t){return e.findIndex(r=>r.id===t)}function Ge(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 lt(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=de(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=Ge(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 ct(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=de(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,d=o.headerRowCount??0,b=d>0&&o.continuesFromPrev?Y(m,d):0,h=0,k=-1;if(m.rows.length===0||l.rows.length===0)continue;if(b>0&&x<b){let F=0;for(let P=0;P<d&&P<m.rows.length;P++){let v=m.rows[P];if(x>=F&&x<F+v.height){k=P;break}F+=v.height;}k===-1&&(k=0);}else {let F=x-b;for(let P=o.fromRow;P<o.toRow&&P<m.rows.length;P++){let v=m.rows[P];if(F>=h&&F<h+v.height){k=P;break}h+=v.height;}}if(k===-1&&(k=Math.min(o.toRow-1,m.rows.length-1),k<o.fromRow))continue;let y=m.rows[k],B=l.rows[k];if(!y||!B)continue;let w=0,p=-1;if(y.cells.length===0||B.cells.length===0)continue;for(let F=0;F<y.cells.length;F++){let P=y.cells[F];if(f>=w&&f<w+P.width){p=F;break}w+=P.width;}if(p===-1&&(p=y.cells.length-1,p<0))continue;let S=y.cells[p],I=B.cells[p];if(!S||!I)continue;let T=0;if(b>0&&k<d)for(let F=0;F<k;F++)T+=m.rows[F]?.height??0;else {T=b;for(let F=o.fromRow;F<k;F++)T+=m.rows[F]?.height??0;}let C=0;for(let F=0;F<p;F++)C+=y.cells[F]?.width??0;let R,H;if(I.blocks&&I.blocks.length>0){let F=I.blocks[0],P=S.blocks[0];F.kind==="paragraph"&&P?.kind==="paragraph"&&(R=F,H=P);}let E=f-C,L=x-T;return {fragment:o,block:l,measure:m,pageIndex:e.pageIndex,rowIndex:k,colIndex:p,cellBlock:R,cellMeasure:H,cellLocalX:Math.max(0,E),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 $(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 z(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,h=be(i),k=K(f.slice(0,b),h);return a+k.width}let x=be(i),d=K(f,x);a+=d.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 ft(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=q(e,s);for(let l of u.fragments){if(l.kind==="paragraph"){let m=$(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 d=f,b=x,h=l,k=xe(d,b,o,c);for(let{line:y,index:B}of k){if(B<h.fromLine||B>=h.toLine)continue;let w=D(d,y);if(w.pmStart===void 0||w.pmEnd===void 0)continue;let p=Math.max(w.pmStart,o),S=Math.min(w.pmEnd,c);if(p>=S)continue;let I=z(d,y,p),T=z(d,y,S),M=d.attrs?.indent,C=M?.left??0,R=M?.right??0,H=Math.max(0,l.width-C-R),E=X(d,y,I),L=X(d,y,T),F=d.attrs?.alignment??"left",P=0;F==="center"?P=Math.max(0,(H-y.width)/2):F==="right"&&(P=Math.max(0,H-y.width));let v=G(b,B)-G(b,h.fromLine),A=l.x+C+P+Math.min(E,L),W=Math.max(1,Math.abs(L-E)),N=l.y+v;i.push({x:A,y:N+g,width:W,height:y.lineHeight,pageIndex:s});}}if(l.kind==="table"){let m=$(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 d=f,b=x,h=l,k=h.headerRowCount??0,B=k>0&&h.continuesFromPrev?Y(b,k):0;for(let w=h.fromRow;w<h.toRow&&w<d.rows.length;w++){let p=d.rows[w],S=b.rows[w];if(!p||!S)continue;let I=0;for(let T=0;T<p.cells.length;T++){let M=p.cells[T],C=S.cells[T];if(!(!M||!C)){for(let R=0;R<M.blocks.length;R++){let H=M.blocks[R],E=C.blocks[R];if(!H||H.kind!=="paragraph"||!E||E.kind!=="paragraph")continue;let L=H,F=E,P=xe(L,F,o,c),v=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 J=Math.max(N.pmStart,o),V=Math.min(N.pmEnd,c);if(J>=V)continue;let ke=z(L,A,J),ye=z(L,A,V),Q=X(L,A,ke,C.width),Z=X(L,A,ye,C.width),Se=G(F,W);i.push({x:h.x+I+Math.min(Q,Z),y:h.y+B+v+Se+g,width:Math.max(1,Math.abs(Z-Q)),height:A.lineHeight,pageIndex:s});}v+=F.totalHeight;}I+=C.width;}}B+=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 ht(e,t,r,n){for(let a=0;a<e.pages.length;a++){let o=e.pages[a],c=q(e,a);for(let i of o.fragments){if(i.kind==="paragraph"){let s=$(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,d=l.pmEnd??x;if(n<x||n>d)continue;for(let b=f.fromLine;b<f.toLine;b++){let h=m.lines[b];if(!h)continue;let k=D(l,h);if(!(k.pmStart===void 0||k.pmEnd===void 0)&&n>=k.pmStart&&n<=k.pmEnd){let y=z(l,h,n),B=l.attrs?.indent,w=B?.left??0,p=B?.right??0,S=Math.max(0,i.width-w-p),I=X(l,h,y),T=l.attrs?.alignment??"left",M=0;T==="center"?M=Math.max(0,(S-h.width)/2):T==="right"&&(M=Math.max(0,S-h.width));let C=G(m,b)-G(m,f.fromLine);return {x:i.x+w+M+I,y:i.y+C+c,height:h.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 dt(e){return e.length<=1?false:new Set(e.map(r=>r.pageIndex)).size>1}function bt(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,Ze as b,Ue as c,je as d,Je as e,nt as f,Xe as g,rt as h,K as i,ot as j,at as k,he as l,q as m,lt as n,ct as o,ft as p,ht as q,dt as r,bt as s};
@@ -0,0 +1,58 @@
1
+ import {a as a$1}from'./chunk-7MGFEP2R.mjs';import {a}from'./chunk-WOHFANC5.mjs';import {c as c$1}from'./chunk-TAUMSKRE.mjs';function c(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}var O=1e5;function L(){O=1e5;}function M(e){return e!=null&&e!==""&&e!==0?String(e):String(O++)}var ye=new Set(["black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","red","white","yellow"]);function $e(e){if(!e)return "";let t=[];return e.auto?t.push('w:val="auto"'):e.rgb&&t.push(`w:val="${e.rgb}"`),e.themeColor&&t.push(`w:themeColor="${e.themeColor}"`),e.themeTint&&t.push(`w:themeTint="${e.themeTint}"`),e.themeShade&&t.push(`w:themeShade="${e.themeShade}"`),t.length===0?"":`<w:color ${t.join(" ")}/>`}function Te(e){if(!e)return "";let t=[];return e.pattern?t.push(`w:val="${e.pattern}"`):t.push('w:val="clear"'),e.color?.rgb?t.push(`w:color="${e.color.rgb}"`):e.color?.auto&&t.push('w:color="auto"'),e.fill?.rgb?t.push(`w:fill="${e.fill.rgb}"`):e.fill?.auto&&t.push('w:fill="auto"'),e.fill?.themeColor&&t.push(`w:themeFill="${e.fill.themeColor}"`),e.fill?.themeTint&&t.push(`w:themeFillTint="${e.fill.themeTint}"`),e.fill?.themeShade&&t.push(`w:themeFillShade="${e.fill.themeShade}"`),t.length===0?"":`<w:shd ${t.join(" ")}/>`}function C(e){if(!e)return "";let t=[];if(e.styleId&&t.push(`<w:rStyle w:val="${c(e.styleId)}"/>`),e.fontFamily){let o=[];e.fontFamily.ascii&&o.push(`w:ascii="${c(e.fontFamily.ascii)}"`),e.fontFamily.hAnsi&&o.push(`w:hAnsi="${c(e.fontFamily.hAnsi)}"`),e.fontFamily.eastAsia&&o.push(`w:eastAsia="${c(e.fontFamily.eastAsia)}"`),e.fontFamily.cs&&o.push(`w:cs="${c(e.fontFamily.cs)}"`),e.fontFamily.asciiTheme&&o.push(`w:asciiTheme="${e.fontFamily.asciiTheme}"`),e.fontFamily.hAnsiTheme&&o.push(`w:hAnsiTheme="${e.fontFamily.hAnsiTheme}"`),e.fontFamily.eastAsiaTheme&&o.push(`w:eastAsiaTheme="${e.fontFamily.eastAsiaTheme}"`),e.fontFamily.csTheme&&o.push(`w:csTheme="${e.fontFamily.csTheme}"`),o.length>0&&t.push(`<w:rFonts ${o.join(" ")}/>`);}e.bold===true?t.push("<w:b/>"):e.bold===false&&t.push('<w:b w:val="0"/>'),e.boldCs===true?t.push("<w:bCs/>"):e.boldCs===false&&t.push('<w:bCs w:val="0"/>'),e.italic===true?t.push("<w:i/>"):e.italic===false&&t.push('<w:i w:val="0"/>'),e.italicCs===true?t.push("<w:iCs/>"):e.italicCs===false&&t.push('<w:iCs w:val="0"/>'),e.allCaps&&t.push("<w:caps/>"),e.smallCaps&&t.push("<w:smallCaps/>"),e.strike&&t.push("<w:strike/>"),e.doubleStrike&&t.push("<w:dstrike/>"),e.outline&&t.push("<w:outline/>"),e.shadow&&t.push("<w:shadow/>"),e.emboss&&t.push("<w:emboss/>"),e.imprint&&t.push("<w:imprint/>"),e.hidden&&t.push("<w:vanish/>");let n=$e(e.color);if(n&&t.push(n),e.spacing!==void 0&&t.push(`<w:spacing w:val="${e.spacing}"/>`),e.scale!==void 0&&t.push(`<w:w w:val="${e.scale}"/>`),e.kerning!==void 0&&t.push(`<w:kern w:val="${e.kerning}"/>`),e.position!==void 0&&t.push(`<w:position w:val="${e.position}"/>`),e.fontSize!==void 0&&t.push(`<w:sz w:val="${e.fontSize}"/>`),e.fontSizeCs!==void 0&&t.push(`<w:szCs w:val="${e.fontSizeCs}"/>`),e.highlight&&e.highlight!=="none"){if(ye.has(e.highlight))t.push(`<w:highlight w:val="${e.highlight}"/>`);else if(!e.shading){let o=e.highlight.replace(/^#/,"");/^[0-9a-fA-F]{6}$/.test(o)&&t.push(`<w:shd w:val="clear" w:color="auto" w:fill="${o}"/>`);}}if(e.underline){let o=[`w:val="${e.underline.style}"`];e.underline.color&&(e.underline.color.rgb&&o.push(`w:color="${e.underline.color.rgb}"`),e.underline.color.themeColor&&o.push(`w:themeColor="${e.underline.color.themeColor}"`),e.underline.color.themeTint&&o.push(`w:themeTint="${e.underline.color.themeTint}"`),e.underline.color.themeShade&&o.push(`w:themeShade="${e.underline.color.themeShade}"`)),t.push(`<w:u ${o.join(" ")}/>`);}e.effect&&e.effect!=="none"&&t.push(`<w:effect w:val="${e.effect}"/>`),e.emphasisMark&&e.emphasisMark!=="none"&&t.push(`<w:em w:val="${e.emphasisMark}"/>`);let r=Te(e.shading);return r&&t.push(r),e.vertAlign&&e.vertAlign!=="baseline"&&t.push(`<w:vertAlign w:val="${e.vertAlign}"/>`),e.rtl&&t.push("<w:rtl/>"),e.cs&&t.push("<w:cs/>"),t.length===0?"":`<w:rPr>${t.join("")}</w:rPr>`}function Pe(e){return !e.startsWith("<w:rPr>")||!e.endsWith("</w:rPr>")?"":e.slice(7,-8)}function be(e){let t=Number.isInteger(e.info.id)&&e.info.id>=0?e.info.id:0,n=typeof e.info.author=="string"?e.info.author.trim():"",r=n.length>0?n:"Unknown",o=typeof e.info.date=="string"?e.info.date.trim():void 0,i=typeof e.info.rsid=="string"?e.info.rsid.trim():void 0,a=[`w:id="${t}"`,`w:author="${c(r)}"`];o&&a.push(`w:date="${c(o)}"`),i&&a.push(`w:rsid="${c(i)}"`);let s=C(e.previousFormatting)||"<w:rPr/>";return `<w:rPrChange ${a.join(" ")}>${s}</w:rPrChange>`}function Ce(e,t){let n=C(e),r=n?Pe(n):"",o=(t??[]).map(be).join(""),i=`${r}${o}`;return i?`<w:rPr>${i}</w:rPr>`:""}function ve(e){return `<w:t${e.preserveSpace||e.text.startsWith(" ")||e.text.endsWith(" ")||e.text.includes(" ")?' xml:space="preserve"':""}>${c(e.text)}</w:t>`}function Fe(e){return "<w:tab/>"}function Se(e){let t=[];return e.breakType==="page"?t.push('w:type="page"'):e.breakType==="column"?t.push('w:type="column"'):e.breakType==="textWrapping"&&(t.push('w:type="textWrapping"'),e.clear&&e.clear!=="none"&&t.push(`w:clear="${e.clear}"`)),t.length===0?"<w:br/>":`<w:br ${t.join(" ")}/>`}function Ie(e){return `<w:sym w:font="${c(e.font)}" w:char="${c(e.char)}"/>`}function Re(e){return e.type==="footnoteRef"?`<w:footnoteReference w:id="${e.id}"/>`:`<w:endnoteReference w:id="${e.id}"/>`}function Ee(e){let t=[`w:fldCharType="${e.charType}"`];return e.fldLock&&t.push('w:fldLock="true"'),e.dirty&&t.push('w:dirty="true"'),`<w:fldChar ${t.join(" ")}/>`}function Ae(e){return `<w:instrText${e.text.startsWith(" ")||e.text.endsWith(" ")||e.text.includes(" ")?' xml:space="preserve"':""}>${c(e.text)}</w:instrText>`}function De(e){return "<w:softHyphen/>"}function ze(e){return "<w:noBreakHyphen/>"}function k(e){if(!e)return "";if(e.rgb)return `<a:srgbClr val="${e.rgb.replace("#","")}"/>`;if(e.themeColor){let t=`<a:schemeClr val="${e.themeColor}"`;return e.themeTint?t+=`><a:tint val="${e.themeTint}"/></a:schemeClr>`:e.themeShade?t+=`><a:shade val="${e.themeShade}"/></a:schemeClr>`:t+="/>",t}return ""}function ke(e){if(!e||e.type==="none")return "<a:noFill/>";if(e.type==="solid"&&e.color)return `<a:solidFill>${k(e.color)}</a:solidFill>`;if(e.type==="gradient"&&e.gradient){let t=e.gradient,n=t.stops.map(o=>`<a:gs pos="${o.position}">${k(o.color)}</a:gs>`).join(""),r=t.type==="linear"?`<a:lin ang="${(t.angle||0)*6e4}" scaled="1"/>`:"";return `<a:gradFill><a:gsLst>${n}</a:gsLst>${r}</a:gradFill>`}return ""}function N(e){if(!e)return "";let t=[];e.width!=null&&t.push(`w="${e.width}"`),e.cap&&t.push(`cap="${e.cap}"`);let n=[];return e.color&&n.push(`<a:solidFill>${k(e.color)}</a:solidFill>`),e.style&&e.style!=="solid"&&n.push(`<a:prstDash val="${e.style}"/>`),e.headEnd&&n.push(`<a:headEnd type="${e.headEnd.type}"${e.headEnd.width?` w="${e.headEnd.width}"`:""}${e.headEnd.length?` len="${e.headEnd.length}"`:""}/>`),e.tailEnd&&n.push(`<a:tailEnd type="${e.tailEnd.type}"${e.tailEnd.width?` w="${e.tailEnd.width}"`:""}${e.tailEnd.length?` len="${e.tailEnd.length}"`:""}/>`),n.length===0&&t.length===0?"":`<a:ln${t.length?" "+t.join(" "):""}>${n.join("")}</a:ln>`}function H(e){let t=[],n=e.horizontal;t.push(`<wp:positionH relativeFrom="${n.relativeTo}">`),n.alignment?t.push(`<wp:align>${n.alignment}</wp:align>`):t.push(`<wp:posOffset>${n.posOffset||0}</wp:posOffset>`),t.push("</wp:positionH>");let r=e.vertical;return t.push(`<wp:positionV relativeFrom="${r.relativeTo}">`),r.alignment?t.push(`<wp:align>${r.alignment}</wp:align>`):t.push(`<wp:posOffset>${r.posOffset||0}</wp:posOffset>`),t.push("</wp:positionV>"),t.join("")}function W(e){let t=e.wrapText?` wrapText="${e.wrapText}"`:' wrapText="bothSides"';switch(e.type){case "square":return `<wp:wrapSquare${t}/>`;case "tight":return `<wp:wrapTight${t}><wp:wrapPolygon edited="0"><wp:start x="0" y="0"/><wp:lineTo x="0" y="21600"/><wp:lineTo x="21600" y="21600"/><wp:lineTo x="21600" y="0"/><wp:lineTo x="0" y="0"/></wp:wrapPolygon></wp:wrapTight>`;case "through":return `<wp:wrapThrough${t}><wp:wrapPolygon edited="0"><wp:start x="0" y="0"/><wp:lineTo x="0" y="21600"/><wp:lineTo x="21600" y="21600"/><wp:lineTo x="21600" y="0"/><wp:lineTo x="0" y="0"/></wp:wrapPolygon></wp:wrapThrough>`;case "topAndBottom":return "<wp:wrapTopAndBottom/>";case "behind":case "inFront":return "<wp:wrapNone/>";default:return "<wp:wrapNone/>"}}function Be(e,t){let n=e.size.width,r=e.size.height,o=e.rId||"rId1",i=t,a=e.filename||`image${i}`,s="";return e.transform?.rotation&&(s+=` rot="${Math.round(e.transform.rotation*6e4)}"`),e.transform?.flipH&&(s+=' flipH="1"'),e.transform?.flipV&&(s+=' flipV="1"'),['<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">','<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">','<pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">',"<pic:nvPicPr>",`<pic:cNvPr id="${i}" name="${c(a)}"${e.alt?` descr="${c(e.alt)}"`:""}/>`,"<pic:cNvPicPr/>","</pic:nvPicPr>","<pic:blipFill>",`<a:blip r:embed="${o}"/>`,"<a:stretch><a:fillRect/></a:stretch>","</pic:blipFill>","<pic:spPr>",`<a:xfrm${s}>`,'<a:off x="0" y="0"/>',`<a:ext cx="${n}" cy="${r}"/>`,"</a:xfrm>",'<a:prstGeom prst="rect"><a:avLst/></a:prstGeom>',e.outline?N(e.outline):"","</pic:spPr>","</pic:pic>","</a:graphicData>","</a:graphic>"].join("")}function je(e){let t=e.image,n=t.wrap.type!=="inline",r=t.size.width,o=t.size.height,i=t.padding?.top??t.wrap.distT??0,a=t.padding?.bottom??t.wrap.distB??0,s=t.padding?.left??t.wrap.distL??0,l=t.padding?.right??t.wrap.distR??0,p=M(t.id),f=t.title||t.filename||`Picture ${p}`,m=Be(t,p);if(!n)return ["<w:drawing>",`<wp:inline distT="${i}" distB="${a}" distL="${s}" distR="${l}">`,`<wp:extent cx="${r}" cy="${o}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',`<wp:docPr id="${p}" name="${c(f)}"${t.alt?` descr="${c(t.alt)}"`:""}${t.decorative?' hidden="1"':""}/>`,'<wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/></wp:cNvGraphicFramePr>',m,"</wp:inline>","</w:drawing>"].join("");let u=t.wrap.type==="behind"?"1":"0",d=t.position?H(t.position):'<wp:positionH relativeFrom="column"><wp:posOffset>0</wp:posOffset></wp:positionH><wp:positionV relativeFrom="paragraph"><wp:posOffset>0</wp:posOffset></wp:positionV>',g=W(t.wrap);return ["<w:drawing>",`<wp:anchor distT="${i}" distB="${a}" distL="${s}" distR="${l}" simplePos="0" relativeHeight="251658240" behindDoc="${u}" locked="0" layoutInCell="1" allowOverlap="1">`,'<wp:simplePos x="0" y="0"/>',d,`<wp:extent cx="${r}" cy="${o}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',g,`<wp:docPr id="${p}" name="${c(f)}"${t.alt?` descr="${c(t.alt)}"`:""}/>`,'<wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/></wp:cNvGraphicFramePr>',m,"</wp:anchor>","</w:drawing>"].join("")}function Xe(e){return e.map(t=>T(t)).join("")}function Oe(e){let t=e.shape,n=t.size.width,r=t.size.height,o=t.shapeType==="textBox",i=t.wrap&&t.wrap.type!=="inline",a=t.wrap?.distT??0,s=t.wrap?.distB??0,l=t.wrap?.distL??0,p=t.wrap?.distR??0,f=M(t.id),m=t.name||(o?`TextBox ${f}`:`Shape ${f}`),u="";t.transform?.rotation&&(u+=` rot="${Math.round(t.transform.rotation*6e4)}"`),t.transform?.flipH&&(u+=' flipH="1"'),t.transform?.flipV&&(u+=' flipV="1"');let d=["<wps:spPr>",`<a:xfrm${u}>`,'<a:off x="0" y="0"/>',`<a:ext cx="${n}" cy="${r}"/>`,"</a:xfrm>",`<a:prstGeom prst="${t.shapeType==="textBox"?"rect":t.shapeType}"><a:avLst/></a:prstGeom>`,ke(t.fill),N(t.outline),"</wps:spPr>"].join(""),g="";if(t.textBody){let h=t.textBody,y=['rot="0"','vert="horz"'];h.anchor&&y.push(`anchor="${h.anchor==="middle"?"ctr":h.anchor}"`),h.anchorCenter&&y.push('anchorCtr="1"'),h.margins&&(h.margins.left!=null&&y.push(`lIns="${h.margins.left}"`),h.margins.top!=null&&y.push(`tIns="${h.margins.top}"`),h.margins.right!=null&&y.push(`rIns="${h.margins.right}"`),h.margins.bottom!=null&&y.push(`bIns="${h.margins.bottom}"`)),o?g=["<wps:txbx><w:txbxContent>",Xe(h.content),"</w:txbxContent></wps:txbx>",`<wps:bodyPr ${y.join(" ")}/>`].join(""):g=[`<wps:bodyPr ${y.join(" ")}/>`].join("");}let X=['<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">','<a:graphicData uri="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">',["<wps:wsp>",`<wps:cNvSpPr${o?' txBox="1"':""}/>`,d,g,"</wps:wsp>"].join(""),"</a:graphicData>","</a:graphic>"].join("");if(!i)return ["<w:drawing>",`<wp:inline distT="${a}" distB="${s}" distL="${l}" distR="${p}">`,`<wp:extent cx="${n}" cy="${r}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',`<wp:docPr id="${f}" name="${c(m)}"/>`,"<wp:cNvGraphicFramePr/>",X,"</wp:inline>","</w:drawing>"].join("");let de=t.wrap?.type==="behind"?"1":"0",he=t.position?H(t.position):'<wp:positionH relativeFrom="column"><wp:posOffset>0</wp:posOffset></wp:positionH><wp:positionV relativeFrom="paragraph"><wp:posOffset>0</wp:posOffset></wp:positionV>',we=W(t.wrap);return ["<w:drawing>",`<wp:anchor distT="${a}" distB="${s}" distL="${l}" distR="${p}" simplePos="0" relativeHeight="251658240" behindDoc="${de}" locked="0" layoutInCell="1" allowOverlap="1">`,'<wp:simplePos x="0" y="0"/>',he,`<wp:extent cx="${n}" cy="${r}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',we,`<wp:docPr id="${f}" name="${c(m)}"/>`,"<wp:cNvGraphicFramePr/>",X,"</wp:anchor>","</w:drawing>"].join("")}function Le(e){switch(e.type){case "text":return ve(e);case "tab":return Fe();case "break":return Se(e);case "symbol":return Ie(e);case "footnoteRef":case "endnoteRef":return Re(e);case "fieldChar":return Ee(e);case "instrText":return Ae(e);case "softHyphen":return De();case "noBreakHyphen":return ze();case "drawing":return je(e);case "shape":return Oe(e);default:return ""}}function x(e){let t=[],n=Ce(e.formatting,e.propertyChanges);n&&t.push(n);for(let r of e.content){let o=Le(r);o&&t.push(o);}return `<w:r>${t.join("")}</w:r>`}function v(e,t){if(!e||e.style==="none"||e.style==="nil")return "";let n=[`w:val="${e.style}"`];return e.size!==void 0&&n.push(`w:sz="${e.size}"`),e.space!==void 0&&n.push(`w:space="${e.space}"`),e.color&&(e.color.auto?n.push('w:color="auto"'):e.color.rgb&&n.push(`w:color="${e.color.rgb}"`),e.color.themeColor&&n.push(`w:themeColor="${e.color.themeColor}"`),e.color.themeTint&&n.push(`w:themeTint="${e.color.themeTint}"`),e.color.themeShade&&n.push(`w:themeShade="${e.color.themeShade}"`)),e.shadow&&n.push('w:shadow="true"'),e.frame&&n.push('w:frame="true"'),`<w:${t} ${n.join(" ")}/>`}function Me(e){if(!e)return "";let t=[];if(e.top){let n=v(e.top,"top");n&&t.push(n);}if(e.left){let n=v(e.left,"left");n&&t.push(n);}if(e.bottom){let n=v(e.bottom,"bottom");n&&t.push(n);}if(e.right){let n=v(e.right,"right");n&&t.push(n);}if(e.between){let n=v(e.between,"between");n&&t.push(n);}if(e.bar){let n=v(e.bar,"bar");n&&t.push(n);}return t.length===0?"":`<w:pBdr>${t.join("")}</w:pBdr>`}function Ne(e){if(!e)return "";let t=[];return e.pattern?t.push(`w:val="${e.pattern}"`):t.push('w:val="clear"'),e.color?.rgb?t.push(`w:color="${e.color.rgb}"`):e.color?.auto&&t.push('w:color="auto"'),e.fill?.rgb?t.push(`w:fill="${e.fill.rgb}"`):e.fill?.auto&&t.push('w:fill="auto"'),e.fill?.themeColor&&t.push(`w:themeFill="${e.fill.themeColor}"`),e.fill?.themeTint&&t.push(`w:themeFillTint="${e.fill.themeTint}"`),e.fill?.themeShade&&t.push(`w:themeFillShade="${e.fill.themeShade}"`),t.length===0?"":`<w:shd ${t.join(" ")}/>`}function He(e){return !e||e.length===0?"":`<w:tabs>${e.map(n=>{let r=[`w:val="${n.alignment}"`,`w:pos="${n.position}"`];return n.leader&&n.leader!=="none"&&r.push(`w:leader="${n.leader}"`),`<w:tab ${r.join(" ")}/>`}).join("")}</w:tabs>`}function We(e){let t=[];return e.spaceBefore!==void 0&&t.push(`w:before="${e.spaceBefore}"`),e.spaceAfter!==void 0&&t.push(`w:after="${e.spaceAfter}"`),e.lineSpacing!==void 0&&t.push(`w:line="${e.lineSpacing}"`),e.lineSpacingRule&&t.push(`w:lineRule="${e.lineSpacingRule}"`),e.beforeAutospacing&&t.push('w:beforeAutospacing="1"'),e.afterAutospacing&&t.push('w:afterAutospacing="1"'),t.length===0?"":`<w:spacing ${t.join(" ")}/>`}function _e(e){let t=[];return e.indentLeft!==void 0&&t.push(`w:left="${e.indentLeft}"`),e.indentRight!==void 0&&t.push(`w:right="${e.indentRight}"`),e.indentFirstLine!==void 0&&(e.hangingIndent?t.push(`w:hanging="${Math.abs(e.indentFirstLine)}"`):e.indentFirstLine!==0&&t.push(`w:firstLine="${e.indentFirstLine}"`)),t.length===0?"":`<w:ind ${t.join(" ")}/>`}function Ge(e){if(!e)return "";let t=[];return e.ilvl!==void 0&&t.push(`<w:ilvl w:val="${e.ilvl}"/>`),e.numId!==void 0&&t.push(`<w:numId w:val="${e.numId}"/>`),t.length===0?"":`<w:numPr>${t.join("")}</w:numPr>`}function Ue(e){if(!e)return "";let t=[];return e.width!==void 0&&t.push(`w:w="${e.width}"`),e.height!==void 0&&t.push(`w:h="${e.height}"`),e.hAnchor&&t.push(`w:hAnchor="${e.hAnchor}"`),e.vAnchor&&t.push(`w:vAnchor="${e.vAnchor}"`),e.x!==void 0&&t.push(`w:x="${e.x}"`),e.y!==void 0&&t.push(`w:y="${e.y}"`),e.xAlign&&t.push(`w:xAlign="${e.xAlign}"`),e.yAlign&&t.push(`w:yAlign="${e.yAlign}"`),e.wrap&&t.push(`w:wrap="${e.wrap}"`),t.length===0?"":`<w:framePr ${t.join(" ")}/>`}function G(e,t){let n=[];if(e){e.styleId&&n.push(`<w:pStyle w:val="${c(e.styleId)}"/>`),e.keepNext&&n.push("<w:keepNext/>"),e.keepLines&&n.push("<w:keepLines/>"),e.contextualSpacing&&n.push("<w:contextualSpacing/>"),e.pageBreakBefore&&n.push("<w:pageBreakBefore/>");let r=Ue(e.frame);r&&n.push(r),e.widowControl===false?n.push('<w:widowControl w:val="0"/>'):e.widowControl===true&&n.push("<w:widowControl/>");let o=Ge(e.numPr);o&&n.push(o);let i=Me(e.borders);i&&n.push(i);let a=Ne(e.shading);a&&n.push(a);let s=He(e.tabs);s&&n.push(s),e.suppressLineNumbers&&n.push("<w:suppressLineNumbers/>"),e.suppressAutoHyphens&&n.push("<w:suppressAutoHyphens/>");let l=We(e);l&&n.push(l);let p=_e(e);if(p&&n.push(p),e.bidi&&n.push("<w:bidi/>"),e.alignment&&n.push(`<w:jc w:val="${e.alignment}"/>`),e.outlineLevel!==void 0&&n.push(`<w:outlineLvl w:val="${e.outlineLevel}"/>`),e.runProperties){let f=C(e.runProperties);f&&n.push(f);}}return t&&t.length>0&&n.push(...t.map(r=>Ze(r))),n.length===0?"":`<w:pPr>${n.join("")}</w:pPr>`}function Ve(e){return !e.startsWith("<w:pPr>")||!e.endsWith("</w:pPr>")?"":e.slice(7,-8)}function Ze(e){let t=Number.isInteger(e.info.id)&&e.info.id>=0?e.info.id:0,n=typeof e.info.author=="string"?e.info.author.trim():"",r=n.length>0?n:"Unknown",o=typeof e.info.date=="string"?e.info.date.trim():void 0,i=typeof e.info.rsid=="string"?e.info.rsid.trim():void 0,a=[`w:id="${t}"`,`w:author="${c(r)}"`];o&&a.push(`w:date="${c(o)}"`),i&&a.push(`w:rsid="${c(i)}"`);let s=G(e.previousFormatting)||"<w:pPr/>",l=Ve(s),p=l.length>0?`<w:pPr>${l}</w:pPr>`:"<w:pPr/>";return `<w:pPrChange ${a.join(" ")}>${p}</w:pPrChange>`}function B(e){let t=[];e.rId&&t.push(`r:id="${e.rId}"`),e.anchor&&t.push(`w:anchor="${c(e.anchor)}"`),e.tooltip&&t.push(`w:tooltip="${c(e.tooltip)}"`),e.target&&t.push(`w:tgtFrame="${c(e.target)}"`),e.history===false&&t.push('w:history="0"'),e.docLocation&&t.push(`w:docLocation="${c(e.docLocation)}"`);let n=e.children.map(o=>o.type==="run"?x(o):o.type==="bookmarkStart"?U(o):o.type==="bookmarkEnd"?V(o):"").join("");return `<w:hyperlink${t.length>0?" "+t.join(" "):""}>${n}</w:hyperlink>`}function U(e){let t=[`w:id="${e.id}"`,`w:name="${c(e.name)}"`];return e.colFirst!==void 0&&t.push(`w:colFirst="${e.colFirst}"`),e.colLast!==void 0&&t.push(`w:colLast="${e.colLast}"`),`<w:bookmarkStart ${t.join(" ")}/>`}function V(e){return `<w:bookmarkEnd w:id="${e.id}"/>`}function Ye(e){let t=[],n=e.content.find(s=>s.type==="run"),r=n?.formatting?C(n.formatting):"",o=['w:fldCharType="begin"'];e.fldLock&&o.push('w:fldLock="true"'),t.push(`<w:r>${r}<w:fldChar ${o.join(" ")}/></w:r>`);let a=e.instruction.startsWith(" ")||e.instruction.endsWith(" ")||e.instruction.includes(" ")?' xml:space="preserve"':"";t.push(`<w:r>${r}<w:instrText${a}>${c(e.instruction)}</w:instrText></w:r>`),t.push(`<w:r>${r}<w:fldChar w:fldCharType="separate"/></w:r>`);for(let s of e.content)s.type==="run"&&t.push(x(s));return t.push(`<w:r>${r}<w:fldChar w:fldCharType="end"/></w:r>`),t.join("")}function qe(e){let t=[],n=e.fieldResult?.[0]?.formatting,r=n?C(n):"",o=['w:fldCharType="begin"'];if(e.fldLock&&o.push('w:fldLock="true"'),t.push(`<w:r>${r}<w:fldChar ${o.join(" ")}/></w:r>`),e.fieldCode.length>0)t.push(...e.fieldCode.map(i=>x(i)));else {let a=e.instruction.startsWith(" ")||e.instruction.endsWith(" ")||e.instruction.includes(" ")?' xml:space="preserve"':"";t.push(`<w:r>${r}<w:instrText${a}>${c(e.instruction)}</w:instrText></w:r>`);}return t.push(`<w:r>${r}<w:fldChar w:fldCharType="separate"/></w:r>`),t.push(...e.fieldResult.map(i=>x(i))),t.push(`<w:r>${r}<w:fldChar w:fldCharType="end"/></w:r>`),t.join("")}function Je(e){let t=e.properties,n=[];switch(t.alias&&n.push(`<w:alias w:val="${c(t.alias)}"/>`),t.tag&&n.push(`<w:tag w:val="${c(t.tag)}"/>`),t.lock&&t.lock!=="unlocked"&&n.push(`<w:lock w:val="${t.lock}"/>`),t.showingPlaceholder&&n.push("<w:showingPlcHdr/>"),t.sdtType){case "plainText":n.push("<w:text/>");break;case "date":t.dateFormat?n.push(`<w:date w:fullDate="${c(t.dateFormat)}"/>`):n.push("<w:date/>");break;case "dropdown":{let o=(t.listItems??[]).map(i=>`<w:listItem w:displayText="${c(i.displayText)}" w:value="${c(i.value)}"/>`).join("");n.push(`<w:dropDownList>${o}</w:dropDownList>`);break}case "comboBox":{let o=(t.listItems??[]).map(i=>`<w:listItem w:displayText="${c(i.displayText)}" w:value="${c(i.value)}"/>`).join("");n.push(`<w:comboBox>${o}</w:comboBox>`);break}case "checkbox":n.push(`<w14:checkbox><w14:checked w14:val="${t.checked?"1":"0"}"/></w14:checkbox>`);break;case "picture":n.push("<w:picture/>");break}let r=e.content.map(o=>o.type==="run"?x(o):o.type==="hyperlink"?B(o):"").join("");return `<w:sdt><w:sdtPr>${n.join("")}</w:sdtPr><w:sdtContent>${r}</w:sdtContent></w:sdt>`}function _(e,t){let n=[`w:id="${t.id}"`,`w:name="${c(t.name)}"`];return `<w:${e} ${n.join(" ")}/>`}function E(e,t){let n=t.info,r=Number.isInteger(n.id)&&n.id>=0?n.id:0,o=typeof n.author=="string"?n.author.trim():"",i=o.length>0?o:"Unknown",a=typeof n.date=="string"?n.date.trim():void 0,s=[`w:id="${r}"`,`w:author="${c(i)}"`];a&&s.push(`w:date="${c(a)}"`);let l=t.content.map(p=>p.type==="run"?e==="del"||e==="moveFrom"?x(p).replace(/<w:t\b/g,"<w:delText").replace(/<\/w:t>/g,"</w:delText>").replace(/<w:instrText\b/g,"<w:delInstrText").replace(/<\/w:instrText>/g,"</w:delInstrText>"):x(p):p.type==="hyperlink"?B(p):"").join("");return `<w:${e} ${s.join(" ")}>${l}</w:${e}>`}function Ke(e){switch(e.type){case "run":return x(e);case "hyperlink":return B(e);case "bookmarkStart":return U(e);case "bookmarkEnd":return V(e);case "simpleField":return Ye(e);case "complexField":return qe(e);case "inlineSdt":return Je(e);case "commentRangeStart":return `<w:commentRangeStart w:id="${e.id}"/>`;case "commentRangeEnd":return `<w:commentRangeEnd w:id="${e.id}"/><w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:commentReference w:id="${e.id}"/></w:r>`;case "insertion":return E("ins",e);case "deletion":return E("del",e);case "moveFrom":return E("moveFrom",e);case "moveTo":return E("moveTo",e);case "moveFromRangeStart":return _("moveFromRangeStart",e);case "moveFromRangeEnd":return `<w:moveFromRangeEnd w:id="${e.id}"/>`;case "moveToRangeStart":return _("moveToRangeStart",e);case "moveToRangeEnd":return `<w:moveToRangeEnd w:id="${e.id}"/>`;case "mathEquation":return e.ommlXml||"";default:return ""}}function T(e){let t=[],n=[];e.paraId&&n.push(`w14:paraId="${e.paraId}"`),e.textId&&n.push(`w14:textId="${e.textId}"`);let r=n.length>0?" "+n.join(" "):"",o=G(e.formatting,e.propertyChanges);o&&t.push(o);for(let i of e.content){let a=Ke(i);a&&t.push(a);}return `<w:p${r}>${t.join("")}</w:p>`}function Qe(e){let t=Number.isInteger(e.id)&&e.id>=0?e.id:0,n=typeof e.author=="string"?e.author.trim():"",r=n.length>0?n:"Unknown",o=typeof e.date=="string"?e.date.trim():void 0;return {id:t,author:r,date:o}}function b(e,t){let n=Qe(e),r=[`w:id="${n.id}"`,`w:author="${c(n.author)}"`];return n.date&&r.push(`w:date="${c(n.date)}"`),t&&t.trim().length>0&&r.push(`w:rsid="${c(t.trim())}"`),r.join(" ")}function P(e,t){if(!e)return "";let n=[`w:w="${e.value}"`,`w:type="${e.type}"`];return `<w:${t} ${n.join(" ")}/>`}function F(e,t){if(!e||e.style==="none"||e.style==="nil")return "";let n=[`w:val="${e.style}"`];return e.size!==void 0&&n.push(`w:sz="${e.size}"`),e.space!==void 0&&n.push(`w:space="${e.space}"`),e.color&&(e.color.auto?n.push('w:color="auto"'):e.color.rgb&&n.push(`w:color="${e.color.rgb}"`),e.color.themeColor&&n.push(`w:themeColor="${e.color.themeColor}"`),e.color.themeTint&&n.push(`w:themeTint="${e.color.themeTint}"`),e.color.themeShade&&n.push(`w:themeShade="${e.color.themeShade}"`)),e.shadow&&n.push('w:shadow="true"'),e.frame&&n.push('w:frame="true"'),`<w:${t} ${n.join(" ")}/>`}function Z(e,t){if(!e)return "";let n=[];if(e.top){let r=F(e.top,"top");r&&n.push(r);}if(e.left){let r=F(e.left,"left");r&&n.push(r);}if(e.bottom){let r=F(e.bottom,"bottom");r&&n.push(r);}if(e.right){let r=F(e.right,"right");r&&n.push(r);}if(e.insideH){let r=F(e.insideH,"insideH");r&&n.push(r);}if(e.insideV){let r=F(e.insideV,"insideV");r&&n.push(r);}return n.length===0?"":`<w:${t}>${n.join("")}</w:${t}>`}function Y(e,t){if(!e)return "";let n=[];return e.top&&n.push(P(e.top,"top")),e.left&&n.push(P(e.left,"left")),e.bottom&&n.push(P(e.bottom,"bottom")),e.right&&n.push(P(e.right,"right")),n.length===0?"":`<w:${t}>${n.join("")}</w:${t}>`}function q(e){if(!e)return "";let t=[];return e.pattern?t.push(`w:val="${e.pattern}"`):t.push('w:val="clear"'),e.color?.rgb?t.push(`w:color="${e.color.rgb}"`):e.color?.auto&&t.push('w:color="auto"'),e.fill?.rgb?t.push(`w:fill="${e.fill.rgb}"`):e.fill?.auto&&t.push('w:fill="auto"'),e.fill?.themeColor&&t.push(`w:themeFill="${e.fill.themeColor}"`),e.fill?.themeTint&&t.push(`w:themeFillTint="${e.fill.themeTint}"`),e.fill?.themeShade&&t.push(`w:themeFillShade="${e.fill.themeShade}"`),t.length===0?"":`<w:shd ${t.join(" ")}/>`}function et(e){if(!e)return "";let t=[];return e.firstRow&&t.push('w:firstRow="1"'),e.lastRow&&t.push('w:lastRow="1"'),e.firstColumn&&t.push('w:firstColumn="1"'),e.lastColumn&&t.push('w:lastColumn="1"'),e.noHBand&&t.push('w:noHBand="1"'),e.noVBand&&t.push('w:noVBand="1"'),t.length===0?"":`<w:tblLook ${t.join(" ")}/>`}function tt(e){if(!e)return "";let t=[];return e.horzAnchor&&t.push(`w:horzAnchor="${e.horzAnchor}"`),e.vertAnchor&&t.push(`w:vertAnchor="${e.vertAnchor}"`),e.tblpX!==void 0&&t.push(`w:tblpX="${e.tblpX}"`),e.tblpXSpec&&t.push(`w:tblpXSpec="${e.tblpXSpec}"`),e.tblpY!==void 0&&t.push(`w:tblpY="${e.tblpY}"`),e.tblpYSpec&&t.push(`w:tblpYSpec="${e.tblpYSpec}"`),e.topFromText!==void 0&&t.push(`w:topFromText="${e.topFromText}"`),e.bottomFromText!==void 0&&t.push(`w:bottomFromText="${e.bottomFromText}"`),e.leftFromText!==void 0&&t.push(`w:leftFromText="${e.leftFromText}"`),e.rightFromText!==void 0&&t.push(`w:rightFromText="${e.rightFromText}"`),t.length===0?"":`<w:tblpPr ${t.join(" ")}/>`}function J(e,t){let n=[];if(e){e.styleId&&n.push(`<w:tblStyle w:val="${c(e.styleId)}"/>`);let r=tt(e.floating);r&&n.push(r),e.bidi&&n.push("<w:bidiVisual/>");let o=P(e.width,"tblW");o&&n.push(o),e.justification&&n.push(`<w:jc w:val="${e.justification}"/>`);let i=P(e.cellSpacing,"tblCellSpacing");i&&n.push(i);let a=P(e.indent,"tblInd");a&&n.push(a);let s=Z(e.borders,"tblBorders");s&&n.push(s);let l=Y(e.cellMargins,"tblCellMar");l&&n.push(l),e.layout&&n.push(`<w:tblLayout w:type="${e.layout}"/>`);let p=q(e.shading);p&&n.push(p);let f=et(e.look);f&&n.push(f),e.overlap&&n.push(`<w:tblOverlap w:val="${e.overlap}"/>`);}return t&&t.length>0&&n.push(...t.map(r=>rt(r))),n.length===0?"":`<w:tblPr>${n.join("")}</w:tblPr>`}function nt(e){return !e.startsWith("<w:tblPr>")||!e.endsWith("</w:tblPr>")?"":e.slice(9,-10)}function rt(e){let t=b(e.info,e.info.rsid),n=J(e.previousFormatting)||"<w:tblPr/>",r=nt(n),o=r.length>0?`<w:tblPr>${r}</w:tblPr>`:"<w:tblPr/>";return `<w:tblPrChange ${t}>${o}</w:tblPrChange>`}function K(e,t,n){let r=[];if(e){if(e.cantSplit&&r.push("<w:cantSplit/>"),e.header&&r.push("<w:tblHeader/>"),e.height){let o=[`w:val="${e.height.value}"`];e.heightRule&&o.push(`w:hRule="${e.heightRule}"`),r.push(`<w:trHeight ${o.join(" ")}/>`);}e.justification&&r.push(`<w:jc w:val="${e.justification}"/>`),e.hidden&&r.push("<w:hidden/>");}return n&&(n.type==="tableRowInsertion"?r.push(`<w:ins ${b(n.info)}/>`):n.type==="tableRowDeletion"&&r.push(`<w:del ${b(n.info)}/>`)),t&&t.length>0&&r.push(...t.map(o=>it(o))),r.length===0?"":`<w:trPr>${r.join("")}</w:trPr>`}function ot(e){return !e.startsWith("<w:trPr>")||!e.endsWith("</w:trPr>")?"":e.slice(8,-9)}function it(e){let t=b(e.info,e.info.rsid),n=K(e.previousFormatting)||"<w:trPr/>",r=ot(n),o=r.length>0?`<w:trPr>${r}</w:trPr>`:"<w:trPr/>";return `<w:trPrChange ${t}>${o}</w:trPrChange>`}function st(e){if(!e)return "";let n=[e.firstRow?"1":"0",e.lastRow?"1":"0",e.firstColumn?"1":"0",e.lastColumn?"1":"0",e.oddVBand?"1":"0",e.evenVBand?"1":"0",e.oddHBand?"1":"0",e.evenHBand?"1":"0",e.nwCell?"1":"0",e.neCell?"1":"0",e.swCell?"1":"0",e.seCell?"1":"0"].join("");return n==="000000000000"?"":`<w:cnfStyle w:val="${n}"/>`}function Q(e,t,n){let r=[];if(e){let o=st(e.conditionalFormat);o&&r.push(o);let i=P(e.width,"tcW");i&&r.push(i),e.gridSpan&&e.gridSpan>1&&r.push(`<w:gridSpan w:val="${e.gridSpan}"/>`),e.vMerge&&(e.vMerge==="restart"?r.push('<w:vMerge w:val="restart"/>'):r.push("<w:vMerge/>"));let a=Z(e.borders,"tcBorders");a&&r.push(a);let s=q(e.shading);s&&r.push(s),e.noWrap&&r.push("<w:noWrap/>");let l=Y(e.margins,"tcMar");l&&r.push(l),e.textDirection&&r.push(`<w:textDirection w:val="${e.textDirection}"/>`),e.fitText&&r.push("<w:tcFitText/>"),e.verticalAlign&&r.push(`<w:vAlign w:val="${e.verticalAlign}"/>`),e.hideMark&&r.push("<w:hideMark/>");}return n&&(n.type==="tableCellInsertion"?r.push(`<w:cellIns ${b(n.info)}/>`):n.type==="tableCellDeletion"?r.push(`<w:cellDel ${b(n.info)}/>`):n.type==="tableCellMerge"&&r.push(`<w:cellMerge ${b(n.info)}/>`)),t&&t.length>0&&r.push(...t.map(o=>ct(o))),r.length===0?"":`<w:tcPr>${r.join("")}</w:tcPr>`}function at(e){return !e.startsWith("<w:tcPr>")||!e.endsWith("</w:tcPr>")?"":e.slice(8,-9)}function ct(e){let t=b(e.info,e.info.rsid),n=Q(e.previousFormatting)||"<w:tcPr/>",r=at(n),o=r.length>0?`<w:tcPr>${r}</w:tcPr>`:"<w:tcPr/>";return `<w:tcPrChange ${t}>${o}</w:tcPrChange>`}function lt(e){return !e||e.length===0?"":`<w:tblGrid>${e.map(n=>`<w:gridCol w:w="${n}"/>`).join("")}</w:tblGrid>`}function pt(e){let t=[];for(let n of e)n.type==="paragraph"?t.push(T(n)):n.type==="table"&&t.push(I(n));return t.length===0&&t.push("<w:p/>"),t.join("")}function ft(e){let t=[],n=Q(e.formatting,e.propertyChanges,e.structuralChange);return n&&t.push(n),t.push(pt(e.content)),`<w:tc>${t.join("")}</w:tc>`}function ut(e){let t=[],n=K(e.formatting,e.propertyChanges,e.structuralChange);n&&t.push(n);for(let r of e.cells)t.push(ft(r));return `<w:tr>${t.join("")}</w:tr>`}function I(e){let t=[],n=J(e.formatting,e.propertyChanges);n&&t.push(n);let r=lt(e.columnWidths);r&&t.push(r);for(let o of e.rows)t.push(ut(o));return `<w:tbl>${t.join("")}</w:tbl>`}var w={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"};function mt(){let e={wpc:w.wpc,mc:w.mc,o:w.o,r:w.r,m:w.m,v:w.v,wp14:w.wp14,wp:w.wp,w10:w.w10,w:w.w,w14:w.w14,w15:w.w15,wpg:w.wpg,wps:w.wps};return Object.entries(e).map(([t,n])=>`xmlns:${t}="${n}"`).join(" ")}function A(e,t){if(!e||e.style==="none"||e.style==="nil")return "";let n=[`w:val="${e.style}"`];return e.size!==void 0&&n.push(`w:sz="${e.size}"`),e.space!==void 0&&n.push(`w:space="${e.space}"`),e.color&&(e.color.auto?n.push('w:color="auto"'):e.color.rgb&&n.push(`w:color="${e.color.rgb}"`),e.color.themeColor&&n.push(`w:themeColor="${e.color.themeColor}"`),e.color.themeTint&&n.push(`w:themeTint="${e.color.themeTint}"`),e.color.themeShade&&n.push(`w:themeShade="${e.color.themeShade}"`)),e.shadow&&n.push('w:shadow="true"'),e.frame&&n.push('w:frame="true"'),`<w:${t} ${n.join(" ")}/>`}function dt(e){return `<w:headerReference ${[`w:type="${e.type}"`,`r:id="${e.rId}"`].join(" ")}/>`}function ht(e){return `<w:footerReference ${[`w:type="${e.type}"`,`r:id="${e.rId}"`].join(" ")}/>`}function wt(e){if(!e)return "";let t=[];return e.position&&t.push(`<w:pos w:val="${e.position}"/>`),e.numFmt&&t.push(`<w:numFmt w:val="${e.numFmt}"/>`),e.numStart!==void 0&&t.push(`<w:numStart w:val="${e.numStart}"/>`),e.numRestart&&t.push(`<w:numRestart w:val="${e.numRestart}"/>`),t.length===0?"":`<w:footnotePr>${t.join("")}</w:footnotePr>`}function gt(e){if(!e)return "";let t=[];return e.position&&t.push(`<w:pos w:val="${e.position}"/>`),e.numFmt&&t.push(`<w:numFmt w:val="${e.numFmt}"/>`),e.numStart!==void 0&&t.push(`<w:numStart w:val="${e.numStart}"/>`),e.numRestart&&t.push(`<w:numRestart w:val="${e.numRestart}"/>`),t.length===0?"":`<w:endnotePr>${t.join("")}</w:endnotePr>`}function xt(e){let t=[];return e.pageWidth!==void 0&&t.push(`w:w="${e.pageWidth}"`),e.pageHeight!==void 0&&t.push(`w:h="${e.pageHeight}"`),e.orientation==="landscape"&&t.push('w:orient="landscape"'),t.length===0?"":`<w:pgSz ${t.join(" ")}/>`}function yt(e){let t=[];return e.marginTop!==void 0&&t.push(`w:top="${e.marginTop}"`),e.marginRight!==void 0&&t.push(`w:right="${e.marginRight}"`),e.marginBottom!==void 0&&t.push(`w:bottom="${e.marginBottom}"`),e.marginLeft!==void 0&&t.push(`w:left="${e.marginLeft}"`),e.headerDistance!==void 0&&t.push(`w:header="${e.headerDistance}"`),e.footerDistance!==void 0&&t.push(`w:footer="${e.footerDistance}"`),e.gutter!==void 0&&t.push(`w:gutter="${e.gutter}"`),t.length===0?"":`<w:pgMar ${t.join(" ")}/>`}function $t(e){if(!e.columnCount&&!e.columns?.length)return "";let t=[];e.columnCount!==void 0&&e.columnCount>1&&t.push(`w:num="${e.columnCount}"`),e.columnSpace!==void 0&&t.push(`w:space="${e.columnSpace}"`),e.equalWidth!==void 0&&t.push(`w:equalWidth="${e.equalWidth?"1":"0"}"`),e.separator&&t.push('w:sep="1"');let n="";return e.columns&&e.columns.length>0&&(n=e.columns.map(o=>{let i=[];return o.width!==void 0&&i.push(`w:w="${o.width}"`),o.space!==void 0&&i.push(`w:space="${o.space}"`),`<w:col ${i.join(" ")}/>`}).join("")),t.length===0&&!n?"":`<w:cols${t.length>0?" "+t.join(" "):""}>${n}</w:cols>`}function Tt(e){if(!e.lineNumbers)return "";let t=e.lineNumbers,n=[];return t.countBy!==void 0&&n.push(`w:countBy="${t.countBy}"`),t.start!==void 0&&n.push(`w:start="${t.start}"`),t.distance!==void 0&&n.push(`w:distance="${t.distance}"`),t.restart&&n.push(`w:restart="${t.restart}"`),n.length===0?"":`<w:lnNumType ${n.join(" ")}/>`}function Pt(e){if(!e.pageBorders)return "";let t=e.pageBorders,n=[],r=[];if(t.display&&n.push(`w:display="${t.display}"`),t.offsetFrom&&n.push(`w:offsetFrom="${t.offsetFrom}"`),t.zOrder&&n.push(`w:zOrder="${t.zOrder}"`),t.top){let i=A(t.top,"top");i&&r.push(i);}if(t.left){let i=A(t.left,"left");i&&r.push(i);}if(t.bottom){let i=A(t.bottom,"bottom");i&&r.push(i);}if(t.right){let i=A(t.right,"right");i&&r.push(i);}return r.length===0?"":`<w:pgBorders${n.length>0?" "+n.join(" "):""}>${r.join("")}</w:pgBorders>`}function bt(e){if(!e.docGrid)return "";let t=e.docGrid,n=[];return t.type&&n.push(`w:type="${t.type}"`),t.linePitch!==void 0&&n.push(`w:linePitch="${t.linePitch}"`),t.charSpace!==void 0&&n.push(`w:charSpace="${t.charSpace}"`),n.length===0?"":`<w:docGrid ${n.join(" ")}/>`}function Ct(e){if(!e)return "";let t=[];if(e.headerReferences)for(let f of e.headerReferences)t.push(dt(f));if(e.footerReferences)for(let f of e.footerReferences)t.push(ht(f));let n=wt(e.footnotePr);n&&t.push(n);let r=gt(e.endnotePr);r&&t.push(r),e.sectionStart&&t.push(`<w:type w:val="${e.sectionStart}"/>`);let o=xt(e);o&&t.push(o);let i=yt(e);if(i&&t.push(i),e.paperSrcFirst!==void 0||e.paperSrcOther!==void 0){let f=[];e.paperSrcFirst!==void 0&&f.push(`w:first="${e.paperSrcFirst}"`),e.paperSrcOther!==void 0&&f.push(`w:other="${e.paperSrcOther}"`),t.push(`<w:paperSrc ${f.join(" ")}/>`);}let a=Pt(e);a&&t.push(a);let s=Tt(e);s&&t.push(s);let l=$t(e);l&&t.push(l);let p=bt(e);return p&&t.push(p),e.verticalAlign&&t.push(`<w:vAlign w:val="${e.verticalAlign}"/>`),e.bidi&&t.push("<w:bidi/>"),e.titlePg&&t.push("<w:titlePg/>"),e.evenAndOddHeaders&&t.push("<w:evenAndOddHeaders/>"),t.length===0?"":`<w:sectPr>${t.join("")}</w:sectPr>`}function ee(e){if(e.type==="paragraph")return T(e);if(e.type==="table")return I(e);if(e.type==="blockSdt"){let t=e.content.map(o=>ee(o)).join(""),n=e.properties,r=[];return n.alias&&r.push(`<w:alias w:val="${n.alias}"/>`),n.tag&&r.push(`<w:tag w:val="${n.tag}"/>`),`<w:sdt><w:sdtPr>${r.join("")}</w:sdtPr><w:sdtContent>${t}</w:sdtContent></w:sdt>`}return ""}function vt(e){return e.map(t=>ee(t)).join("")}function Ft(e){let t=[];return t.push(vt(e.content)),e.finalSectionProperties&&t.push(Ct(e.finalSectionProperties)),t.join("")}function te(e){L();let t=[];t.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>');let n=mt();return t.push(`<w:document ${n} mc:Ignorable="w14 w15 wp14">`),t.push("<w:body>"),t.push(Ft(e.package.document)),t.push("</w:body>"),t.push("</w:document>"),t.join("")}var R=c$1(a());var St={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"};function It(){return Object.entries(St).map(([e,t])=>`xmlns:${e}="${t}"`).join(" ")}function Rt(e){return e.type==="paragraph"?T(e):e.type==="table"?I(e):""}function ne(e){let t=e.type==="header"?"w:hdr":"w:ftr",n=It(),r=e.content.map(o=>Rt(o)).join("");return r||(r="<w:p><w:pPr/></w:p>"),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <${t} ${n}>${r}</${t}>`}var D='xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16du="http://schemas.microsoft.com/office/word/2023/wordml/word16du" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16sdtfl="http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape"',z='mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"';function re(){return Math.floor(Math.random()*2147483647).toString(16).toUpperCase().padStart(8,"0")}function ae(e){let t="<w:r>",n=[];e.formatting?.bold&&n.push("<w:b/>"),e.formatting?.italic&&n.push("<w:i/>"),n.length>0&&(t+=`<w:rPr>${n.join("")}</w:rPr>`);for(let r of e.content)if(r.type==="text"){let o=r.text!==r.text.trim()||r.text.includes(" ");t+=o?`<w:t xml:space="preserve">${c(r.text)}</w:t>`:`<w:t>${c(r.text)}</w:t>`;}else r.type==="break"&&(t+="<w:br/>");return t+="</w:r>",t}function oe(e,t){let n=t?`<w:p w14:paraId="${t}">`:"<w:p>";for(let r of e.content)r.type==="run"&&(n+=ae(r));return n+="</w:p>",n}function ie(e,t){let n=t?`<w:p w14:paraId="${t}">`:"<w:p>";n+='<w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:annotationRef/></w:r>';for(let r of e.content)r.type==="run"&&(n+=ae(r));return n+="</w:p>",n}function se(e,t){let n=re(),r=[`w:id="${e.id}"`];if(e.author&&r.push(`w:author="${c(e.author)}"`),e.initials?r.push(`w:initials="${c(e.initials)}"`):r.push('w:initials=""'),e.date){let i=e.date.replace(/\.\d{3}Z$/,"Z");r.push(`w:date="${c(i)}"`);}let o=`<w:comment ${r.join(" ")}>`;if(e.content&&e.content.length>0)if(e.content.length===1)o+=ie(e.content[0],n);else {o+=ie(e.content[0]);for(let i=1;i<e.content.length-1;i++)o+=oe(e.content[i]);o+=oe(e.content[e.content.length-1],n);}else o+=`<w:p w14:paraId="${n}"><w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:annotationRef/></w:r></w:p>`;return o+="</w:comment>",t.push({commentId:e.id,lastParaId:n,durableId:re(),parentId:e.parentId,done:e.done}),o}function ce(e){if(!e||e.length===0)return {xml:"",paraInfos:[]};let t=[],n=[];for(let i of e)(i.parentId==null?t:n).push(i);let r=[],o=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:comments ${D} ${z}>`;for(let i of t)o+=se(i,r);for(let i of n)o+=se(i,r);return o+="</w:comments>",{xml:o,paraInfos:r}}function le(e){if(e.length===0)return "";let t=new Map;for(let r of e)t.set(r.commentId,r.lastParaId);let n=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w15:commentsEx ${D} ${z}>`;for(let r of e){let o=`w15:paraId="${r.lastParaId}" w15:done="${r.done?"1":"0"}"`;if(r.parentId!=null){let i=t.get(r.parentId);i&&(o+=` w15:paraIdParent="${i}"`);}n+=`<w15:commentEx ${o} />`;}return n+="</w15:commentsEx>",n}function pe(e){if(e.length===0)return "";let t=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w16cid:commentsIds ${D} ${z}>`;for(let n of e)t+=`<w16cid:commentId w16cid:paraId="${n.lastParaId}" w16cid:durableId="${n.durableId}" />`;return t+="</w16cid:commentsIds>",t}function fe(e,t){if(e.length===0)return "";let n=new Map;for(let o of t)n.set(o.id,o);let r=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w16cex:commentsExtensible ${D} ${z}>`;for(let o of e){let i=n.get(o.commentId);if(!i?.date)continue;let a=o.durableId,s=(i.date.endsWith("Z")?i.date:i.date+"Z").replace(/\.\d{3}Z$/,"Z");r+=`<w16cex:commentExtensible w16cex:durableId="${a}" w16cex:dateUtc="${s}"/>`;}return r+="</w16cex:commentsExtensible>",r}function j(e){let t=0;for(let n of e.matchAll(/Id="rId(\d+)"/g)){let r=parseInt(n[1],10);r>t&&(t=r);}return t}async function Et(e,t,n){let r=e.package.document.comments;if(!r||r.length===0)return;let{xml:o,paraInfos:i}=ce(r);t.file("word/comments.xml",o,{compression:"DEFLATE",compressionOptions:{level:n}});let a=le(i);a&&t.file("word/commentsExtended.xml",a,{compression:"DEFLATE",compressionOptions:{level:n}});let s=pe(i);s&&t.file("word/commentsIds.xml",s,{compression:"DEFLATE",compressionOptions:{level:n}});let l=fe(i,r);l&&t.file("word/commentsExtensible.xml",l,{compression:"DEFLATE",compressionOptions:{level:n}}),await Mt(t,n);}function ue(e){let t=[];for(let n of e)if(n.type==="paragraph"){for(let r of n.content)if(r.type==="run")for(let o of r.content)o.type==="drawing"&&o.image.src?.startsWith("data:")&&t.push(o.image);}else if(n.type==="table")for(let r of n.rows)for(let o of r.cells)t.push(...ue(o.content));return t}var At={"image/png":"png","image/jpeg":"jpeg","image/gif":"gif","image/bmp":"bmp","image/tiff":"tiff","image/webp":"webp","image/svg+xml":"svg"};function Dt(e){let t=e.match(/^data:([^;]+);base64,(.+)$/);if(!t)throw new Error("Invalid data URL");let n=atob(t[2]),r=new Uint8Array(n.length);for(let o=0;o<n.length;o++)r[o]=n.charCodeAt(o);return {data:r.buffer,extension:At[t[1]]||"png"}}async function zt(e,t,n){if(e.length===0)return;let r="word/_rels/document.xml.rels",o=t.file(r);if(!o)return;let i=await o.async("text"),a=j(i),s=0;t.forEach(f=>{let m=f.match(/^word\/media\/image(\d+)\./);if(m){let u=parseInt(m[1],10);u>s&&(s=u);}});let l=[],p=new Set;for(let f of e){let{data:m,extension:u}=Dt(f.src);s++,a++;let d=`image${s}.${u}`,g=`word/media/${d}`,S=`rId${a}`;t.file(g,m,{compression:"DEFLATE",compressionOptions:{level:n}}),l.push(`<Relationship Id="${S}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/${d}"/>`),p.add(u),f.rId=S;}if(l.length>0&&(i=i.replace("</Relationships>",l.join("")+"</Relationships>"),t.file(r,i,{compression:"DEFLATE",compressionOptions:{level:n}})),p.size>0){let f=t.file("[Content_Types].xml");if(f){let m=await f.async("text");for(let u of p)if(!m.includes(`Extension="${u}"`)){let d=Gt(u);m=m.replace("</Types>",`<Default Extension="${u}" ContentType="${d}"/></Types>`);}t.file("[Content_Types].xml",m,{compression:"DEFLATE",compressionOptions:{level:n}});}}}function me(e){let t=[];for(let n of e)if(n.type==="paragraph")for(let r of n.content)r.type==="hyperlink"&&r.href&&!r.rId&&!r.anchor&&t.push(r);else if(n.type==="table")for(let r of n.rows)for(let o of r.cells)t.push(...me(o.content));return t}async function kt(e,t,n){if(e.length===0)return;let r="word/_rels/document.xml.rels",o=t.file(r);if(!o)return;let i=await o.async("text"),a=j(i),s=[];for(let l of e){a++;let p=`rId${a}`;s.push(`<Relationship Id="${p}" Type="${a$1.hyperlink}" Target="${c(l.href)}" TargetMode="External"/>`),l.rId=p;}s.length>0&&(i=i.replace("</Relationships>",s.join("")+"</Relationships>"),t.file(r,i,{compression:"DEFLATE",compressionOptions:{level:n}}));}async function Bt(e,t={}){if(!e.originalBuffer)throw new Error("Cannot repack document: no original buffer for round-trip. Use createDocx() for new documents.");let{compressionLevel:n=6,updateModifiedDate:r=true,modifiedBy:o}=t,i=e,a=await R.default.loadAsync(e.originalBuffer),s=new R.default;for(let[u,d]of Object.entries(a.files)){if(d.dir){s.folder(u.replace(/\/$/,""));continue}let g=await d.async("arraybuffer");s.file(u,g,{compression:"DEFLATE",compressionOptions:{level:n}});}let l=ue(i.package.document.content);await zt(l,s,n);let p=me(i.package.document.content);await kt(p,s,n);let f=te(i);if(s.file("word/document.xml",f,{compression:"DEFLATE",compressionOptions:{level:n}}),Wt(i,s,n),await Et(i,s,n),r){let u="docProps/core.xml",d=a.file(u);if(d){let g=await d.async("text"),S=_t(g,{updateModifiedDate:r,modifiedBy:o});s.file(u,S,{compression:"DEFLATE",compressionOptions:{level:n}});}}return await s.generateAsync({type:"arraybuffer",compression:"DEFLATE",compressionOptions:{level:n}})}var jt="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",Xt="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",Ot="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml",Lt="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml";async function Mt(e,t){let n=[{partName:"/word/comments.xml",contentType:jt,target:"comments.xml",relType:a$1.comments},{partName:"/word/commentsExtended.xml",contentType:Xt,target:"commentsExtended.xml",relType:a$1.commentsExtended},{partName:"/word/commentsIds.xml",contentType:Ot,target:"commentsIds.xml",relType:a$1.commentsIds},{partName:"/word/commentsExtensible.xml",contentType:Lt,target:"commentsExtensible.xml",relType:a$1.commentsExtensible}],r=e.file("[Content_Types].xml");if(r){let a=await r.async("text"),s=false;for(let{partName:l,contentType:p}of n)a.includes(l)||(a=a.replace("</Types>",`<Override PartName="${l}" ContentType="${p}"/></Types>`),s=true);s&&e.file("[Content_Types].xml",a,{compression:"DEFLATE",compressionOptions:{level:t}});}let o="word/_rels/document.xml.rels",i=e.file(o);if(i){let a=await i.async("text"),s=false;for(let{target:l,relType:p}of n)if(!a.includes(l)){let f=`rId${j(a)+1}`;a=a.replace("</Relationships>",`<Relationship Id="${f}" Type="${p}" Target="${l}"/></Relationships>`),s=true;}s&&e.file(o,a,{compression:"DEFLATE",compressionOptions:{level:t}});}}async function xn(e,t,n={}){let r=await R.default.loadAsync(e);return Nt(r,t,n)}async function Nt(e,t,n={}){let{compressionLevel:r=6}=n;for(let[o,i]of t)e.file(o,i,{compression:"DEFLATE",compressionOptions:{level:r}});return e.generateAsync({type:"arraybuffer",compression:"DEFLATE",compressionOptions:{level:r}})}function Ht(e){let t=new Map,n=e.package.relationships;if(!n)return t;let r=[{map:e.package.headers,type:a$1.header},{map:e.package.footers,type:a$1.footer}];for(let{map:o,type:i}of r)if(o)for(let[a,s]of o.entries()){let l=n.get(a);if(l&&l.type===i&&l.target){let p=l.target.startsWith("/")?l.target.slice(1):`word/${l.target}`;t.set(p,ne(s));}}return t}function Wt(e,t,n){let r={level:n};for(let[o,i]of Ht(e))t.file(o,i,{compression:"DEFLATE",compressionOptions:r});}function _t(e,t){let n=e;if(t.updateModifiedDate){let r=new Date().toISOString();n.includes("<dcterms:modified")?n=n.replace(/<dcterms:modified[^>]*>[^<]*<\/dcterms:modified>/,`<dcterms:modified xsi:type="dcterms:W3CDTF">${r}</dcterms:modified>`):n=n.replace("</cp:coreProperties>",`<dcterms:modified xsi:type="dcterms:W3CDTF">${r}</dcterms:modified></cp:coreProperties>`);}return t.modifiedBy&&(n.includes("<cp:lastModifiedBy")?n=n.replace(/<cp:lastModifiedBy>[^<]*<\/cp:lastModifiedBy>/,`<cp:lastModifiedBy>${c(t.modifiedBy)}</cp:lastModifiedBy>`):n=n.replace("</cp:coreProperties>",`<cp:lastModifiedBy>${c(t.modifiedBy)}</cp:lastModifiedBy></cp:coreProperties>`)),n}function Gt(e,t){return {png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",tif:"image/tiff",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp",wmf:"image/x-wmf",emf:"image/x-emf"}[e]||"application/octet-stream"}async function Ut(){let e=new R.default;e.file("[Content_Types].xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
3
+ <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
4
+ <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
5
+ <Default Extension="xml" ContentType="application/xml"/>
6
+ <Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>
7
+ <Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/>
8
+ <Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
9
+ <Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
10
+ </Types>`),e.file("_rels/.rels",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
11
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
12
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
13
+ <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>
14
+ <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
15
+ </Relationships>`),e.file("word/_rels/document.xml.rels",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
16
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
17
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
18
+ </Relationships>`),e.file("word/document.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
19
+ <w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
20
+ <w:body>
21
+ <w:p>
22
+ <w:r>
23
+ <w:t></w:t>
24
+ </w:r>
25
+ </w:p>
26
+ <w:sectPr>
27
+ <w:pgSz w:w="12240" w:h="15840"/>
28
+ <w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/>
29
+ </w:sectPr>
30
+ </w:body>
31
+ </w:document>`),e.file("word/styles.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
32
+ <w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
33
+ <w:docDefaults>
34
+ <w:rPrDefault>
35
+ <w:rPr>
36
+ <w:rFonts w:ascii="Calibri" w:hAnsi="Calibri"/>
37
+ <w:sz w:val="22"/>
38
+ </w:rPr>
39
+ </w:rPrDefault>
40
+ <w:pPrDefault>
41
+ <w:pPr>
42
+ <w:spacing w:after="200" w:line="276" w:lineRule="auto"/>
43
+ </w:pPr>
44
+ </w:pPrDefault>
45
+ </w:docDefaults>
46
+ <w:style w:type="paragraph" w:default="1" w:styleId="Normal">
47
+ <w:name w:val="Normal"/>
48
+ </w:style>
49
+ </w:styles>`);let t=new Date().toISOString();return e.file("docProps/core.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
50
+ <cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
51
+ <dc:creator>EigenPal DOCX Editor</dc:creator>
52
+ <dcterms:created xsi:type="dcterms:W3CDTF">${t}</dcterms:created>
53
+ <dcterms:modified xsi:type="dcterms:W3CDTF">${t}</dcterms:modified>
54
+ </cp:coreProperties>`),e.file("docProps/app.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
55
+ <Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties">
56
+ <Application>EigenPal DOCX Editor</Application>
57
+ <AppVersion>1.0.0</AppVersion>
58
+ </Properties>`),e.generateAsync({type:"arraybuffer",compression:"DEFLATE",compressionOptions:{level:6}})}async function yn(e){let t=await Ut(),n={...e,originalBuffer:t};return Bt(n)}export{Ct as a,Ft as b,te as c,ce as d,le as e,pe as f,fe as g,j as h,Bt as i,jt as j,Xt as k,Ot as l,Lt as m,xn as n,Nt as o,Ht as p,_t as q,yn as r};
@@ -1,4 +1,4 @@
1
- import {h,c,b as b$1,d,a,R}from'./chunk-7HZRJTOL.mjs';import {g,e,f}from'./chunk-6WPRCJ5A.mjs';import {b}from'./chunk-QAZ4233N.mjs';import or,{useRef,useState,useEffect,useCallback,useMemo,useLayoutEffect}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var $t=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 4v4M8 10v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Gt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M13 3L3 13M3 3h4v4M13 13h-4v-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 3v10M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Zt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 4h10M3 8h7M3 12h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Xt=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 3h6M5 3v6M3 5c0 2 1 4 2 4s2-2 2-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M9 7l3 6M15 7l-3 6M10 11h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Jt=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 6c0-1.1.9-2 2-2s2 .9 2 2c0 1.5-2 1.5-2 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("circle",{cx:"8",cy:"12",r:"0.5",fill:"currentColor"})]}),Qt=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M4 12l3-8 3 8M5 10h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 6l2 2-2 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),qt=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 7h4M6 9h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),eo=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"5",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 9c.5.5 1 1 2 1s1.5-.5 2-1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("circle",{cx:"6",cy:"7",r:"0.5",fill:"currentColor"}),jsx("circle",{cx:"10",cy:"7",r:"0.5",fill:"currentColor"})]}),to=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M12 4L4 12M4 4l8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});function oo(e){switch(e){case "askAI":return jsx($t,{});case "rewrite":return jsx(Gt,{});case "expand":return jsx(jt,{});case "summarize":return jsx(Zt,{});case "translate":return jsx(Xt,{});case "explain":return jsx(Jt,{});case "fixGrammar":return jsx(Qt,{});case "makeFormal":return jsx(qt,{});case "makeCasual":return jsx(eo,{});case "custom":return jsx(to,{});default:return null}}var ro=({action:e$1,onClick:t,isHighlighted:o,onMouseEnter:n})=>{let r=e(e$1),i=f(e$1),a=oo(e$1);return jsxs("button",{type:"button",className:`docx-context-menu-item ${o?"docx-context-menu-item-highlighted":""}`,onClick:t,onMouseEnter:n,title:i,role:"menuitem",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"8px 12px",border:"none",background:o?"var(--doc-primary-light)":"transparent",cursor:"pointer",fontSize:"13px",color:"var(--doc-text)",textAlign:"left"},children:[jsx("span",{style:{display:"flex",color:"var(--doc-text-muted)"},children:a}),jsx("span",{children:r})]})},no=({isOpen:e,onSubmit:t,onClose:o,selectedText:n})=>{let[r,i]=useState(""),a=useRef(null);useEffect(()=>{e&&a.current&&a.current.focus();},[e]);let d=l=>{l.preventDefault(),r.trim()&&(t(r.trim()),i(""));},s=l=>{l.key==="Escape"&&o();};return e?jsx("div",{className:"docx-custom-prompt-dialog",style:{position:"absolute",top:"100%",left:0,right:0,padding:"8px",background:"white",borderTop:"1px solid var(--doc-border)"},children:jsxs("form",{onSubmit:d,children:[jsxs("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:['Selected: "',n.slice(0,50),n.length>50?"...":"",'"']}),jsx("input",{ref:a,type:"text",value:r,onChange:l=>i(l.target.value),onKeyDown:s,placeholder:"Enter custom prompt...",style:{width:"100%",padding:"8px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",fontSize:"13px"}}),jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"8px",justifyContent:"flex-end"},children:[jsx("button",{type:"button",onClick:o,style:{padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px"},children:"Cancel"}),jsx("button",{type:"submit",disabled:!r.trim(),style:{padding:"6px 12px",border:"none",borderRadius:"4px",background:r.trim()?"var(--doc-primary)":"var(--doc-border)",color:r.trim()?"white":"var(--doc-text-placeholder)",cursor:r.trim()?"pointer":"not-allowed",fontSize:"12px"},children:"Send"})]})]})}):null},Rn=({isOpen:e,position:t,selectedText:o,selectionContext:n,onAction:r,onClose:i,actions:a=g,showCustomPrompt:d=true,className:s=""})=>{let l=useRef(null),[x,g]=useState(0),[c,u]=useState(false),m=d?[...a,"custom"]:a;useEffect(()=>{if(!e)return;let p=v=>{l.current&&!l.current.contains(v.target)&&i();};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[e,i]),useEffect(()=>{if(!e)return;let p=v=>{switch(v.key){case "Escape":c?u(false):i();break;case "ArrowDown":v.preventDefault(),g(P=>(P+1)%m.length);break;case "ArrowUp":v.preventDefault(),g(P=>(P-1+m.length)%m.length);break;case "Enter":v.preventDefault();let k=m[x];k==="custom"?u(true):(r(k),i());break}};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,x,m,r,i,c]),useEffect(()=>{e&&(g(0),u(false));},[e]);let b=useCallback(()=>{let v=m.length*36+16,k=t.x,P=t.y;return typeof window<"u"&&(k+200>window.innerWidth&&(k=window.innerWidth-200-10),P+v>window.innerHeight&&(P=window.innerHeight-v-10),k<10&&(k=10),P<10&&(P=10)),{position:"fixed",top:P,left:k,minWidth:200,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",zIndex:1e4,padding:"4px 0",overflow:"hidden"}},[t,m.length]),f=p=>{p==="custom"?u(true):(r(p),i());},h=p=>{r("custom",p),i();};return !e||!o?null:jsxs("div",{ref:l,className:`docx-context-menu ${s}`,style:b(),role:"menu","aria-label":"AI actions menu",children:[jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:"11px",color:"var(--doc-text-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:['"',o.slice(0,30),o.length>30?"...":"",'"']}),jsx("div",{role:"group",children:m.map((p,v)=>jsx(ro,{action:p,onClick:()=>f(p),isHighlighted:v===x,onMouseEnter:()=>g(v)},p))}),d&&jsx(no,{isOpen:c,onSubmit:h,onClose:()=>u(false),selectedText:o})]})};function Dn(){let[e,t]=useState(false),[o,n]=useState({x:0,y:0}),[r,i]=useState(""),[a,d]=useState(),s=useCallback((x,g,c)=>{x.preventDefault(),n({x:x.clientX,y:x.clientY}),i(g),d(c),t(true);},[]),l=useCallback(()=>{t(false);},[]);return {isOpen:e,position:o,selectedText:r,selectionContext:a,openMenu:s,closeMenu:l}}function On(e){return {rewrite:"Ctrl+Shift+R",summarize:"Ctrl+Shift+S",translate:"Ctrl+Shift+T",fixGrammar:"Ctrl+Shift+G"}[e]}function An(e,t,o){return !(!t||t.trim().length===0)}function _n(){return [...g]}function Mn(){return ["askAI","rewrite","expand","summarize","translate","explain","fixGrammar","makeFormal","makeCasual","custom"]}var io=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 8l4 4 6-8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),lt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),ao=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 8a6 6 0 0111.318-2.828M14 8a6 6 0 01-11.318 2.828",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M13 2v4h-4M3 14v-4h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),so=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11 2l3 3-9 9H2v-3l9-9z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),lo=()=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{animation:"spin 1s linear infinite"},children:[jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"var(--doc-border)",strokeWidth:"2",fill:"none"}),jsx("path",{d:"M10 2a8 8 0 018 8",stroke:"var(--doc-primary)",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),jsx("style",{children:`
1
+ import {h,c,b as b$1,d,a,R}from'./chunk-HWWZOJMR.mjs';import {g,e,f}from'./chunk-6WPRCJ5A.mjs';import {b}from'./chunk-QAZ4233N.mjs';import or,{useRef,useState,useEffect,useCallback,useMemo,useLayoutEffect}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var $t=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 4v4M8 10v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Gt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M13 3L3 13M3 3h4v4M13 13h-4v-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 3v10M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Zt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 4h10M3 8h7M3 12h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Xt=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 3h6M5 3v6M3 5c0 2 1 4 2 4s2-2 2-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M9 7l3 6M15 7l-3 6M10 11h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Jt=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 6c0-1.1.9-2 2-2s2 .9 2 2c0 1.5-2 1.5-2 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("circle",{cx:"8",cy:"12",r:"0.5",fill:"currentColor"})]}),Qt=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M4 12l3-8 3 8M5 10h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 6l2 2-2 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),qt=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 7h4M6 9h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),eo=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"5",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 9c.5.5 1 1 2 1s1.5-.5 2-1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("circle",{cx:"6",cy:"7",r:"0.5",fill:"currentColor"}),jsx("circle",{cx:"10",cy:"7",r:"0.5",fill:"currentColor"})]}),to=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M12 4L4 12M4 4l8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});function oo(e){switch(e){case "askAI":return jsx($t,{});case "rewrite":return jsx(Gt,{});case "expand":return jsx(jt,{});case "summarize":return jsx(Zt,{});case "translate":return jsx(Xt,{});case "explain":return jsx(Jt,{});case "fixGrammar":return jsx(Qt,{});case "makeFormal":return jsx(qt,{});case "makeCasual":return jsx(eo,{});case "custom":return jsx(to,{});default:return null}}var ro=({action:e$1,onClick:t,isHighlighted:o,onMouseEnter:n})=>{let r=e(e$1),i=f(e$1),a=oo(e$1);return jsxs("button",{type:"button",className:`docx-context-menu-item ${o?"docx-context-menu-item-highlighted":""}`,onClick:t,onMouseEnter:n,title:i,role:"menuitem",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"8px 12px",border:"none",background:o?"var(--doc-primary-light)":"transparent",cursor:"pointer",fontSize:"13px",color:"var(--doc-text)",textAlign:"left"},children:[jsx("span",{style:{display:"flex",color:"var(--doc-text-muted)"},children:a}),jsx("span",{children:r})]})},no=({isOpen:e,onSubmit:t,onClose:o,selectedText:n})=>{let[r,i]=useState(""),a=useRef(null);useEffect(()=>{e&&a.current&&a.current.focus();},[e]);let d=l=>{l.preventDefault(),r.trim()&&(t(r.trim()),i(""));},s=l=>{l.key==="Escape"&&o();};return e?jsx("div",{className:"docx-custom-prompt-dialog",style:{position:"absolute",top:"100%",left:0,right:0,padding:"8px",background:"white",borderTop:"1px solid var(--doc-border)"},children:jsxs("form",{onSubmit:d,children:[jsxs("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:['Selected: "',n.slice(0,50),n.length>50?"...":"",'"']}),jsx("input",{ref:a,type:"text",value:r,onChange:l=>i(l.target.value),onKeyDown:s,placeholder:"Enter custom prompt...",style:{width:"100%",padding:"8px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",fontSize:"13px"}}),jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"8px",justifyContent:"flex-end"},children:[jsx("button",{type:"button",onClick:o,style:{padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px"},children:"Cancel"}),jsx("button",{type:"submit",disabled:!r.trim(),style:{padding:"6px 12px",border:"none",borderRadius:"4px",background:r.trim()?"var(--doc-primary)":"var(--doc-border)",color:r.trim()?"white":"var(--doc-text-placeholder)",cursor:r.trim()?"pointer":"not-allowed",fontSize:"12px"},children:"Send"})]})]})}):null},Rn=({isOpen:e,position:t,selectedText:o,selectionContext:n,onAction:r,onClose:i,actions:a=g,showCustomPrompt:d=true,className:s=""})=>{let l=useRef(null),[x,g]=useState(0),[c,u]=useState(false),m=d?[...a,"custom"]:a;useEffect(()=>{if(!e)return;let p=v=>{l.current&&!l.current.contains(v.target)&&i();};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[e,i]),useEffect(()=>{if(!e)return;let p=v=>{switch(v.key){case "Escape":c?u(false):i();break;case "ArrowDown":v.preventDefault(),g(P=>(P+1)%m.length);break;case "ArrowUp":v.preventDefault(),g(P=>(P-1+m.length)%m.length);break;case "Enter":v.preventDefault();let k=m[x];k==="custom"?u(true):(r(k),i());break}};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,x,m,r,i,c]),useEffect(()=>{e&&(g(0),u(false));},[e]);let b=useCallback(()=>{let v=m.length*36+16,k=t.x,P=t.y;return typeof window<"u"&&(k+200>window.innerWidth&&(k=window.innerWidth-200-10),P+v>window.innerHeight&&(P=window.innerHeight-v-10),k<10&&(k=10),P<10&&(P=10)),{position:"fixed",top:P,left:k,minWidth:200,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",zIndex:1e4,padding:"4px 0",overflow:"hidden"}},[t,m.length]),f=p=>{p==="custom"?u(true):(r(p),i());},h=p=>{r("custom",p),i();};return !e||!o?null:jsxs("div",{ref:l,className:`docx-context-menu ${s}`,style:b(),role:"menu","aria-label":"AI actions menu",children:[jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:"11px",color:"var(--doc-text-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:['"',o.slice(0,30),o.length>30?"...":"",'"']}),jsx("div",{role:"group",children:m.map((p,v)=>jsx(ro,{action:p,onClick:()=>f(p),isHighlighted:v===x,onMouseEnter:()=>g(v)},p))}),d&&jsx(no,{isOpen:c,onSubmit:h,onClose:()=>u(false),selectedText:o})]})};function Dn(){let[e,t]=useState(false),[o,n]=useState({x:0,y:0}),[r,i]=useState(""),[a,d]=useState(),s=useCallback((x,g,c)=>{x.preventDefault(),n({x:x.clientX,y:x.clientY}),i(g),d(c),t(true);},[]),l=useCallback(()=>{t(false);},[]);return {isOpen:e,position:o,selectedText:r,selectionContext:a,openMenu:s,closeMenu:l}}function On(e){return {rewrite:"Ctrl+Shift+R",summarize:"Ctrl+Shift+S",translate:"Ctrl+Shift+T",fixGrammar:"Ctrl+Shift+G"}[e]}function An(e,t,o){return !(!t||t.trim().length===0)}function _n(){return [...g]}function Mn(){return ["askAI","rewrite","expand","summarize","translate","explain","fixGrammar","makeFormal","makeCasual","custom"]}var io=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 8l4 4 6-8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),lt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),ao=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 8a6 6 0 0111.318-2.828M14 8a6 6 0 01-11.318 2.828",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M13 2v4h-4M3 14v-4h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),so=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11 2l3 3-9 9H2v-3l9-9z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),lo=()=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{animation:"spin 1s linear infinite"},children:[jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"var(--doc-border)",strokeWidth:"2",fill:"none"}),jsx("path",{d:"M10 2a8 8 0 018 8",stroke:"var(--doc-primary)",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),jsx("style",{children:`
2
2
  @keyframes spin {
3
3
  from { transform: rotate(0deg); }
4
4
  to { transform: rotate(360deg); }