@docx-editor.dev/core 2.24.0 → 2.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/README.md +9 -3
  2. package/dist/automation.cjs +1 -1
  3. package/dist/automation.d.ts +46 -16
  4. package/dist/automation.js +1 -1
  5. package/dist/binding.cjs +1 -1
  6. package/dist/binding.d.ts +8 -8
  7. package/dist/binding.js +1 -1
  8. package/dist/chunk-2BK4G4ZN.js +2 -0
  9. package/dist/chunk-2SJX44PC.cjs +2 -0
  10. package/dist/chunk-5BIASAN3.js +1 -0
  11. package/dist/{chunk-2LXGB2X7.js → chunk-6SEIXJTX.js} +1 -1
  12. package/dist/chunk-73PG6L2X.js +1 -0
  13. package/dist/chunk-7RJSH72J.cjs +5 -0
  14. package/dist/chunk-AGKIHLWQ.cjs +1 -0
  15. package/dist/chunk-AN6WM4X4.js +2 -0
  16. package/dist/chunk-ANZ44KQT.cjs +12 -0
  17. package/dist/chunk-CYT3OQFZ.cjs +1 -0
  18. package/dist/chunk-DDGGSBAN.js +12 -0
  19. package/dist/chunk-EEAV3WIN.js +3 -0
  20. package/dist/{chunk-JDAAGZNE.cjs → chunk-ELQFXMJ5.cjs} +1 -1
  21. package/dist/chunk-EYK4K2J6.js +1 -0
  22. package/dist/chunk-JNTETUNZ.cjs +1 -0
  23. package/dist/chunk-L6V3IJ3S.js +5 -0
  24. package/dist/chunk-LWCI65EL.js +1 -0
  25. package/dist/chunk-LZDI4P6I.cjs +1 -0
  26. package/dist/chunk-NS22DVWT.cjs +2 -0
  27. package/dist/chunk-QIE3YTU4.cjs +2 -0
  28. package/dist/chunk-QVBFPAGO.js +5 -0
  29. package/dist/chunk-RCCOLZEQ.js +2 -0
  30. package/dist/chunk-SUN62YU6.cjs +5 -0
  31. package/dist/chunk-TKR2MXX4.cjs +3 -0
  32. package/dist/chunk-UJL2GDIM.cjs +25 -0
  33. package/dist/chunk-WQTADNHK.cjs +27 -0
  34. package/dist/chunk-XSHXBJ2J.js +25 -0
  35. package/dist/chunk-YXZEBTDF.js +27 -0
  36. package/dist/collaboration/replication.cjs +1 -1
  37. package/dist/collaboration/replication.d.ts +4 -4
  38. package/dist/collaboration/replication.js +1 -1
  39. package/dist/collaboration.d.ts +3 -3
  40. package/dist/contracts/document.d.ts +2 -2
  41. package/dist/contracts/editor.d.ts +8 -8
  42. package/dist/contracts/modules.d.ts +6 -6
  43. package/dist/contracts/types.d.ts +1 -1
  44. package/dist/{custom-node-writes-77rvPW2-.d.ts → custom-node-writes-Cy9imOjA.d.ts} +2 -2
  45. package/dist/{document-protection-CYIjO-li.d.ts → document-protection-Bp19Ad4I.d.ts} +1 -1
  46. package/dist/{editor-BU6rjQZz.d.ts → editor-DYUlyKmb.d.ts} +145 -9
  47. package/dist/editor.cjs +1 -1
  48. package/dist/editor.css +15 -1
  49. package/dist/editor.d.ts +179 -34
  50. package/dist/editor.js +1 -1
  51. package/dist/export.cjs +2 -2
  52. package/dist/export.d.ts +12 -12
  53. package/dist/export.js +2 -2
  54. package/dist/{font-resolver-CPO7wtg6.d.ts → font-resolver-u_nE0PI1.d.ts} +5 -3
  55. package/dist/{headless-document-view-Cc3fFWhv.d.ts → headless-document-view-R9bzzepb.d.ts} +2 -2
  56. package/dist/{image-resources-DkuzBnTM.d.ts → image-resources-DfagDguq.d.ts} +1 -1
  57. package/dist/{index-BOkQYOsZ.d.ts → index-Docw8Dcb.d.ts} +333 -308
  58. package/dist/index.cjs +1 -1
  59. package/dist/index.d.ts +17 -17
  60. package/dist/index.js +1 -1
  61. package/dist/{layout-shaping-BOOxnLxF.d.ts → layout-shaping-DWitwY73.d.ts} +2 -2
  62. package/dist/layout.cjs +1 -1
  63. package/dist/layout.d.ts +99 -33
  64. package/dist/layout.js +1 -1
  65. package/dist/{note-properties-DMfKK3QU.d.ts → note-properties-CmfvOJsi.d.ts} +1 -1
  66. package/dist/{omml-equation-BY7OdfGY.d.ts → omml-equation-CZ6IG2ja.d.ts} +1 -1
  67. package/dist/output.cjs +1 -1
  68. package/dist/output.d.ts +7 -7
  69. package/dist/output.js +1 -1
  70. package/dist/{protocol-CPAakntQ.d.ts → protocol-DniKeDb8.d.ts} +71 -23
  71. package/dist/{review-paragraph-order-B0BP_wJP.d.ts → review-paragraph-order-Dc8Q6tfM.d.ts} +6 -2
  72. package/dist/{revision-projection-CVJeA2jp.d.ts → revision-projection-DfWxdBqA.d.ts} +1 -1
  73. package/dist/{semantic-cell-selection-BtO2s2Za.d.ts → semantic-cell-selection-Dy_BmmpL.d.ts} +25 -7
  74. package/dist/{semantic-interaction-COMnWyBQ.d.ts → semantic-interaction-CvFAj0GR.d.ts} +1 -1
  75. package/dist/{semantic-paint-C032N0ps.d.ts → semantic-paint-Bk9wIXdZ.d.ts} +2 -2
  76. package/dist/{semantic-records-BSjo-xck.d.ts → semantic-records-COqi8pjP.d.ts} +83 -76
  77. package/dist/store.cjs +1 -1
  78. package/dist/store.d.ts +90 -41
  79. package/dist/store.js +1 -1
  80. package/dist/{tree-package-fragment-BIyGh6L8.d.ts → tree-package-fragment-YPyYC1aD.d.ts} +9 -4
  81. package/dist/{tree-session-contract-CHcCnz3W.d.ts → tree-session-contract-AeY2v0x9.d.ts} +8 -6
  82. package/dist/{types-barrel-DN_-gaRX.d.ts → types-barrel-BO73JqHG.d.ts} +44 -30
  83. package/package.json +4 -4
  84. package/dist/chunk-3OMDEMLL.js +0 -1
  85. package/dist/chunk-6CPYOVRT.cjs +0 -1
  86. package/dist/chunk-AKF5KM2W.cjs +0 -4
  87. package/dist/chunk-BOGQGMMU.cjs +0 -1
  88. package/dist/chunk-CVNDMQIX.cjs +0 -26
  89. package/dist/chunk-DF7F7TNU.cjs +0 -1
  90. package/dist/chunk-G765WG4R.js +0 -1
  91. package/dist/chunk-IEXYOLNR.cjs +0 -5
  92. package/dist/chunk-J3EM5ZEA.js +0 -18
  93. package/dist/chunk-JNE6QF47.js +0 -26
  94. package/dist/chunk-JQTVFP72.cjs +0 -2
  95. package/dist/chunk-JXL25DRU.js +0 -11
  96. package/dist/chunk-KPSGB64S.js +0 -1
  97. package/dist/chunk-P4SBMHHO.cjs +0 -5
  98. package/dist/chunk-QQAF64KN.js +0 -5
  99. package/dist/chunk-SI5FLZGU.js +0 -4
  100. package/dist/chunk-SOUJNWXV.js +0 -1
  101. package/dist/chunk-T4TKRNZT.cjs +0 -11
  102. package/dist/chunk-TBFZZX7Z.cjs +0 -1
  103. package/dist/chunk-VPKKYCZI.cjs +0 -2
  104. package/dist/chunk-W3ZUPQIZ.cjs +0 -18
  105. package/dist/chunk-XMWH2R23.js +0 -5
  106. package/dist/chunk-XWXJB4J7.js +0 -1
  107. package/dist/chunk-YIBEBHT3.js +0 -2
  108. package/dist/chunk-ZSM6X52G.cjs +0 -1
  109. package/dist/chunk-ZXAGLAY2.js +0 -2
package/dist/export.js CHANGED
@@ -1,2 +1,2 @@
1
- import {c,l as l$1,d as d$2,e as e$1,v,s,i,o,u}from'./chunk-KPSGB64S.js';import {j as j$1,l,k,q as q$1,h,n,c as c$1,g,_ as _$1,Z,aa}from'./chunk-SI5FLZGU.js';import'./chunk-RIYSCEFQ.js';import {d as d$1,e}from'./chunk-3OMDEMLL.js';export{d as ExportResourceError,c as createNodeImageDecodePort,b as exportDestinationNamed,e as openDocumentForExport}from'./chunk-3OMDEMLL.js';import {d,ea,sa,$,fa,i as i$1,b,e as e$2,Vc,c as c$2,j as j$2,hb,$c,kb,mb,jb,_c,nb,lb,ob,ib,q as q$2,t,o as o$1,_b as _b$1}from'./chunk-J3EM5ZEA.js';import {d as d$3,b as b$1,a}from'./chunk-G765WG4R.js';import'./chunk-XWXJB4J7.js';import {Ka}from'./chunk-XMWH2R23.js';import {eg,fg,_b,Zb,fa as fa$1,E,je,na,ye,oa}from'./chunk-JXL25DRU.js';function I(e,o,t){if(o.environment.features.smcp!==1||!/\p{Ll}/u.test(o.text))return t;let n={...o,environment:{...o.environment,features:{...o.environment.features,smcp:0}}},r=e.shape(n);if(t.glyphs.length!==r.glyphs.length||t.glyphs.some((d,c)=>d.id!==r.glyphs[c]?.id))return t;let i=[],s=0;for(let d of o.text){let c=d.toUpperCase()!==d,y=i.at(-1);y&&(y.lower===c||/\p{M}/u.test(d))?y.text+=d:i.push({text:d,start:s,lower:c}),s+=d.length;}let a=[],u=[],p=[],l=true,g=0;for(let d of o.environment.direction==="rtl"?i.reverse():i){let c=d.lower?.8:1,y=[],R=[],b="",f=d.start;for(let F of d.text){let m=d.lower?F.toUpperCase():F;for(let E=0;E<m.length;E++)y.push(f),R.push(f+F.length);b+=m,f+=F.length;}let h=e.shape({...n,text:b}),x=a.length;for(let[F,m]of h.glyphs.entries()){let E=h.exactAdvancesX?.[F];E===void 0?l=false:p.push(E*c),a.push({...m,cluster:y[m.cluster]??d.start,originX:o$1(g+Math.round(m.originX*c)),originY:o$1(Math.round(m.originY*c)),offsetX:o$1(Math.round(m.offsetX*c)),offsetY:o$1(Math.round(m.offsetY*c)),advanceX:o$1(Math.round(m.advanceX*c)),advanceY:o$1(Math.round(m.advanceY*c)),drawScale:c});}for(let F of h.clusters){let m=y[F.textStart]??d.start,E=R[F.textEnd-1]??f,L=o$1(Math.round(F.advance*c)),A=u.at(-1);A&&A.textStart===m&&A.textEnd===E?u[u.length-1]={...A,glyphEnd:x+F.glyphEnd,advance:o$1(A.advance+L),caretEdges:[o$1(0),o$1(A.advance+L)]}:u.push({...F,textStart:m,textEnd:E,glyphStart:x+F.glyphStart,glyphEnd:x+F.glyphEnd,advance:L,caretEdges:F.caretEdges.map(G=>o$1(Math.round(G*c))),fontSpan:0});}g+=h.glyphs.reduce((F,m)=>F+Math.round(m.advanceX*c),0);}return {...t,glyphs:a,clusters:u,fontSpans:[{...t.fontSpans[0],glyphStart:0,glyphEnd:a.length}],exactAdvancesX:l&&p.length===a.length?p:void 0}}var nt=new WeakMap;function Nt(e){let o=nt.get(e);return o===void 0&&(o=Ct(e.bytes,e.faceIndex),nt.set(e,o)),o}var _t=new Set(["COLR","CBDT","sbix"]),Mt=512;function Ct(e,o){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.byteLength<12)return false;let n=0;if(rt(e,0)==="ttcf"){let i=t.getUint32(8);if(o<0||o>=i||12+4*o+4>e.byteLength||(n=t.getUint32(12+4*o),n+12>e.byteLength))return false}let r=Math.min(t.getUint16(n+4),Mt);for(let i=0;i<r;i++){let s=n+12+i*16;if(s+4>e.byteLength)return false;if(_t.has(rt(e,s)))return true}return false}function rt(e,o){return String.fromCharCode(e[o],e[o+1],e[o+2],e[o+3])}var Ut=/\p{Emoji_Presentation}|️/u;function Bt(e){return Ut.test(e)}function q(e,o){if(e.length<2)return e;let t=e.filter(Nt);if(t.length===0||t.length===e.length)return e;let n=e.filter(r=>!t.includes(r));return Bt(o)?[...t,...n]:[...n,...t]}var qt=2048;function it(e,o,t$1,n){if(!t$1.clusters.length||t$1.clusters.length>qt)return null;let r=(f,h)=>{let{context:x,...F}=o,m={...F,text:h,environment:q$2({...o.environment,font:f})};return I(e,m,e.shape(m))},i=[],s=new Map;for(let f of [...t$1.clusters].sort((h,x)=>h.textStart-x.textStart)){let h=o.environment.font,x=o.text.slice(f.textStart,f.textEnd),F=i.at(-1);if(/^[\uFE0E\uFE0F]$/.test(x)&&F&&F.end===f.textStart){F.end=f.textEnd;continue}if(o.environment.script==="Hebr"&&/^\s+$/u.test(x)&&F&&F.font!==o.environment.font&&F.end===f.textStart){F.end=f.textEnd;continue}if(t$1.glyphs.slice(f.glyphStart,f.glyphEnd).some(E=>E.id===0)){let E=o.text.slice(f.textStart,f.textEnd+1),L=s.get(x)??q(n,E).find(A=>{try{return !r(A,x).glyphs.some(G=>G.id===0)}catch{return false}});if(!L)return null;s.set(x,L),h=L;}let m=i.at(-1);m&&m.font===h&&m.end===f.textStart?m.end=f.textEnd:i.push({start:f.textStart,end:f.textEnd,font:h});}let a=[],u=[],p=[],l=[],g=true,d=0,c=0,y=0,R=0,b=0;for(let f of o.environment.direction==="rtl"?i.reverse():i){let h=r(f.font,o.text.slice(f.start,f.end));if(h.glyphs.some(m=>m.id===0))return null;let x=a.length,F=p.length;for(let m of h.glyphs)a.push({...m,cluster:f.start+m.cluster,originX:o$1(d+m.originX),originY:o$1(c+m.originY)});if(h.exactAdvancesX===void 0)g=false;else for(let m of h.exactAdvancesX)l.push(m);for(let m of h.clusters)u.push({...m,textStart:f.start+m.textStart,textEnd:f.start+m.textEnd,glyphStart:x+m.glyphStart,glyphEnd:x+m.glyphEnd,fontSpan:F});h.glyphs.length&&p.push({font:f.font,glyphStart:x,glyphEnd:a.length,fallbackIndex:f.font===o.environment.font?null:n.indexOf(f.font)}),d+=h.glyphs.reduce((m,E)=>m+E.advanceX,0),c+=h.glyphs.reduce((m,E)=>m+E.advanceY,0),y=Math.max(y,h.metrics.ascent),R=Math.max(R,h.metrics.descent),b=Math.max(b,h.metrics.lineGap);}return t({...t$1,glyphs:a,clusters:u,fontSpans:p,exactAdvancesX:g&&l.length===a.length?l:void 0,metrics:{ascent:o$1(y),descent:o$1(R),lineGap:o$1(b)}},{...o.environment,fallbackOrder:n})}var jt=new Map([["Beng",["bng2","beng"]],["Deva",["dev2","deva"]],["Gujr",["gjr2","gujr"]],["Guru",["gur2","guru"]],["Knda",["knd2","knda"]],["Mlym",["mlm2","mlym"]],["Orya",["ory2","orya"]],["Taml",["tml2","taml"]],["Telu",["tel2","telu"]],["Nkoo",["nko "]]]),zt=512,at=new WeakMap;function Ht(e,o){let t=new Set,n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=c=>c+2<=n.byteLength?n.getUint16(c):-1,i=c=>c+4<=n.byteLength?n.getUint32(c):-1,s=c=>c+4<=n.byteLength?String.fromCharCode(n.getUint8(c),n.getUint8(c+1),n.getUint8(c+2),n.getUint8(c+3)):"",a=0;if(s(0)==="ttcf"){let c=i(8);if(c<0||o<0||o>=c||(a=i(12+o*4),a<0))return t}let u=r(a+4);if(u<0||u>1024)return t;let p=-1;for(let c=0;c<u;c+=1){let y=a+12+c*16;if(s(y)==="GSUB"){p=i(y+8);break}}if(p<0)return t;let l=r(p+4);if(l<=0)return t;let g=p+l,d=r(g);if(d<0)return t;for(let c=0;c<Math.min(d,zt);c+=1){let y=s(g+2+c*6);y&&t.add(y);}return t}function Xt(e,o){let t=at.get(e);return t||(t=Ht(e.bytes,e.faceIndex),at.set(e,t)),(jt.get(o)??[o.toLowerCase()]).some(r=>t.has(r))}function st(e,o){let t=e.filter(n=>Xt(n,o));return t.length===0||t.length===e.length?e:[...t,...e.filter(n=>!t.includes(n))]}function J(e,o,t$1){if(!o.text.includes("\u2011"))return t$1;let n=new Set(t$1.glyphs.filter(i=>i.id===0).map(i=>i.cluster));if(!n.size)return t$1;let r=o.text.replace(/\u2011/g,(i,s)=>n.has(s)?"-":i);if(r===o.text)return t$1;try{let i=e.shape({...o,text:r});return t({...i,text:o.text},o.environment)}catch{return t$1}}function lt(e,o){if(o.length===0)return e;if(o.length>16)throw new RangeError("At most 16 glyph fallback faces are supported");let t=o.map(a=>e.fonts.resolve(a)).filter(a=>!(a instanceof e$2)),n={shape(a){return J(e.shaper,a,e.shaper.shape(a))}},r=new WeakMap,i={shape(a){let u=e.shaper.shape(a),p=r.get(u);if(p&&p.input.text===a.text&&p.input.fontSizeHalfPoints===a.fontSizeHalfPoints&&p.input.bidiLevel===a.bidiLevel&&p.input.context?.before===a.context?.before&&p.input.context?.after===a.context?.after&&p.input.environment===a.environment)return p.run;let l=s(a,J(e.shaper,a,u));return r.set(u,{input:a,run:l}),l}},s=(a,u)=>{let p=I(n,a,u);if(!p.glyphs.some(l=>l.id===0)||/^[\t\n\r\f]*$/.test(a.text))return p;if(/^(Latn|Cyrl|Grek|Hebr|Hani|Hira|Kana|Hang|Zyyy|Zinh)$/.test(a.environment.script)){let l=it(n,a,p,t);if(l)return l}for(let l of st(q(t,a.text),a.environment.script))if(!(l.hash===a.environment.font.hash&&l.faceIndex===a.environment.font.faceIndex))try{let g={...a,environment:q$2({...a.environment,font:l})},d=I(n,g,n.shape(g));if(!d.glyphs.some(c=>c.id===0))return d}catch{}return p};return {...e,shaper:i}}var Q=c$2;function ee(e){return typeof e.admittedFontFace=="function"}var Gt=Object.freeze([{weight:400,style:"normal"},{weight:700,style:"normal"},{weight:400,style:"italic"},{weight:700,style:"italic"}]);function j(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}var dt=new WeakMap;function z(e){let o=dt.get(e);return o||dt.set(e,o=Vt(e)),o}function Vt(e){let o=e.substitution;return Object.freeze({id:e.id,identity:e.identity,family:e.family,request:j(e.request),byteLength:e.byteLength,hash:e.hash,faceIndex:e.faceIndex,substitution:o?Object.freeze({requested:j(o.requested),resolved:j(o.resolved),...o.lineMetrics?{lineMetrics:Object.freeze({...o.lineMetrics})}:{}}):null})}function Wt(e){return Object.freeze({...z(e),bytes:j$2(e)})}function Yt(e,o){if(!e)return null;try{let t=e(o);return !t||t instanceof e$2?null:Wt(t)}catch{return null}}function ct(e){return o=>{if(e.status()!=="active")throw e.unavailable();return Yt(e.resolve(),o)}}function $t(e){return Object.freeze(e.slice(0,Q).map(o=>Object.freeze({request:j(o.request),partName:o.partName,reason:o.reason})))}function te(e,o,t,n,r=[]){let i=new Map;for(let a of [...e,o]){let u=a.toLowerCase();i.has(u)||i.set(u,a);}let s=[...i.values()].map(a=>{let u=[];for(let p of Gt){let l=n?.({family:a,...p});!l||l instanceof e$2||u.push(Object.freeze({...p,sourceFamily:l.family,via:l.substitution?"substitution":"direct",identity:l.identity,id:l.id,hash:l.hash,faceIndex:l.faceIndex,substitution:l.substitution}));}return Object.freeze({family:a,coverage:u.length===4?"complete":u.length>0?"partial":"none",faces:Object.freeze(u)})});return Object.freeze({requestedFamilies:Object.freeze([...e]),defaultFamily:o,families:Object.freeze(s),originFailures:Object.freeze([...t]),droppedEmbeddedFonts:$t(r)})}function oe(e,o){if(o.onFontResolution){try{let t=o.onFontResolution(e);Promise.resolve(t).catch(n=>{console.warn("[fonts] font-resolution diagnostics callback failed",n);});}catch(t){console.warn("[fonts] font-resolution diagnostics callback failed",t);}return}for(let t of e.originFailures)console.warn("[fonts] a document export font origin failed and was skipped",t);for(let t of e.droppedEmbeddedFonts??[])console.warn("[fonts] a document embedded font face was dropped during export",t);}function ne(e,o){if(o.fontPolicy!=="strict"||e.originFailures.length===0&&e.families.every(n=>n.coverage==="complete"))return;let t=e.families.filter(n=>n.coverage!=="complete").map(n=>n.family).join(", ");throw new d$1("layoutFailed",`Strict font policy refused export${t?`; incomplete families: ${t}`:"; a font origin failed"}`)}function H(){return new Map}function re(e,o,t,n){if(t.trim().length===0)return null;let r={family:t,weight:n.bold?700:400,style:n.italic?"italic":"normal"},i=i$1(r),s=o.get(i);if(!s){try{s=e.fonts.resolve(r);}catch{return null}o.set(i,s);}return s instanceof e$2?null:s}function ut(e,o,t){let n=t.fontFamily??e.defaultFont.family;return re(e,o,n,t)}function ie(e){return typeof e.shapeLaidOutText=="function"}function ae(e){let o=H(),t=new WeakMap;return n=>{let r=sa(n.style,n.fontSlot),i=$(n.text,r);if(i.length===0)return null;let s=r.fontFamily??e.defaultFont.family,a=re(e,o,s,r);if(!a)return null;try{if(r.smallCaps&&!_$1(e.shaper,e.environment,a,r,t))return null;let u=Z(e.shaper,e.environment,a,r,i);return Object.freeze({run:u,font:z(u.fontSpans[0]?.font??a),...u.fontSpans.length>1?{fonts:Object.freeze(u.fontSpans.map(p=>z(p.font)))}:{},fixedPointScale:e.environment.fixedPointScale})}catch{return null}}}function pt(e){return o=>{if(e.status()!=="active")throw e.unavailable();return e.shaping()?.shapeLaidOutText(o)??null}}var N=new Map,X=new WeakMap,se=0,_,le=32,ft=d;function mt(){if(_)return _;let e=(async()=>(await c$1(),g(h)))();return _=e,e.catch(()=>{_===e&&(_=void 0);}),e}function yt(e){let o=H();return aa(e,{resolveFont(t){return ut(e,o,t)},fallback:fa()})}async function ht(e,o,t=[],n=false){if(!j$1(e))throw new TypeError("Session exporter shaping requires a prepared font handle");let r=await mt(),i=lt(await q$1(e,r,h,o,n),t);return Object.freeze({createMeasurer:()=>yt(i),resolveFont:s=>i.fonts.resolve(s),shapeLaidOutText:ae(i),producer:["node-export-session",JSON.stringify(t),e.fingerprint,i.operation.shapingHash,`producer:${i.operation.producerVersion}`,`fallback:${ea}`].join("|"),extensionFingerprint:e.fingerprint})}function Kt(e,o){if(!j$1(e))return Promise.reject(new TypeError("Shared exporter shaping requires a prepared font handle"));let t=X.get(e);if(t)return t;let n=l(e),r=N.get(n);if(!r){if(N.size>=le)return Promise.reject(new RangeError(`Shared exporter shaping is limited to ${le} process-wide configurations`));r=(async()=>{let u=k(e).sources.reduce((l,g)=>l+(g.availability==="forbidden"?0:g.bytes.byteLength),0);if(se+u>ft)throw new RangeError(`Shared exporter shaping font bytes are limited to ${ft} process-wide`);se+=u;let p;try{let l=await mt();p=await q$1(e,l,h,o);}catch(l){throw se-=u,l}return Object.freeze({createMeasurer:()=>yt(p),shapeLaidOutText:ae(p),shapingHash:p.operation.shapingHash,producerVersion:p.operation.producerVersion})})(),N.set(n,r),r.catch(()=>{N.get(n)===r&&N.delete(n);});}let i=e.fingerprint,s=r.then(a=>Object.freeze({createMeasurer:a.createMeasurer,shapeLaidOutText:a.shapeLaidOutText,producer:["node-export",i,a.shapingHash,`producer:${a.producerVersion}`,`fallback:${ea}`].join("|"),extensionFingerprint:i}));return X.set(e,s),s.catch(()=>{X.get(e)===s&&X.delete(e);}),s}var Zt="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable";function Jt(e){let o=e.currentPackage(),t=(o.relationships.get(o.mainDocumentPart)??[]).find(r=>r.type===Zt),n;if(t){let r=E(t);r.mode==="Internal"&&r.target.ok&&(n=o.parts.get(r.target.partName));}return n??=o.parts.get("/word/fontTable.xml"),je(o,n)}function gt(e,o$1){let t=Jt(e);if(t.length!==0)return i(n=>{let r=new Set((n.resolvedFaces??[]).map(s=>i$1(s))),i=o(t,{maxFontBytes:b,aggregateBudget:Qt(n),shadowedRequests:r});if(o$1)for(let s of i.dropped){if(o$1.dropped.length>=Q)break;o$1.dropped.push(s);}return {sources:i.sources}})}function Qt(e){let o=e.committedSourceBytes;return o===void 0||!Number.isSafeInteger(o)||o<=0?d:Math.max(0,d-o)}function eo(e){return ee(e)&&ie(e)}var w=0,xt=Symbol("font-resolution-timeout");function to(e){let o=0,t=false;return e?.(w),{reserve:r=>{if(t)throw new Error("Document font-byte lease is already released");if(w+r>d)throw new d$1("layoutFailed",`Active document export font bytes are limited to ${d}; requested ${r} bytes with ${w} bytes already active`);w+=r,o+=r,e?.(w);let i=false;return ()=>{i||t||(i=true,w-=r,o-=r,e?.(w));}},release:()=>{t||(t=true,w-=o,o=0,e?.(w));}}}function ce(e,o){return e.attributes.find(t=>t.localName===o)?.value}function oo(e,o){return e.attributes.find(t=>t.localName===o&&(t.namespaceUri===fa$1||t.namespaceUri===""))?.value}async function no(e$1,o){if(o.reuseAcrossRevisions===true)throw new TypeError("reuseAcrossRevisions requires a live view or caller-supplied measurer; document-aware byte sessions are immutable");if(o.signal?.aborted)return {ok:false,reason:"aborted"};let t=Ka(e$1);if(!t.ok)return t;let{fonts:n,lastResortFonts:r,fontResolutionTimeoutMs:i,fontPolicy:s,onFontResolution:a,glyphFallbacks:u,documentLigatures:p,...l}=o,g=Array.isArray(n)?n:[n],d=r===void 0?[]:Array.isArray(r)?r:[r],c,y;try{y=await ro(t.view,g,{signal:o.signal,timeoutMs:i??o.resourceTimeoutMs,fontPolicy:s,glyphFallbacks:u,documentLigatures:p,lastResortFonts:d,onFontResolution:E=>(c=E,a?.(E))});}catch(E){if(E instanceof d$1&&E.code==="aborted")return {ok:false,reason:"aborted"};throw E}if(!c)throw y?.dispose(),new d$1("layoutFailed","Document font resolution completed without publishing its evidence");let R;try{R=e(t.view,{...l,reuseAcrossRevisions:!1,...y?{measurer:y.createMeasurer(),producer:o.producer??y.producer}:o.producer?{producer:o.producer}:{}});}catch(E){throw y?.dispose(),E}if(!R.ok)return y?.dispose(),R;let b=R.session,f=y,h="active",x=()=>h==="aborted"?new d$1("aborted","Export resource settlement was aborted"):new d$1("disposed","Export session has been disposed"),F=E=>{if(h==="active"){h=E,o.signal?.removeEventListener("abort",m);try{b.dispose();}finally{f?.dispose(),f=void 0;}}},m=()=>F("aborted");return o.signal?.addEventListener("abort",m,{once:true}),o.signal?.aborted&&m(),{ok:true,session:Object.freeze({fontResolution:c,layout:()=>h==="active"?b.layout():Promise.reject(x()),layoutFor:E=>h==="active"?b.layoutFor(E):Promise.reject(x()),validatedImageBytes:E=>h==="active"?b.validatedImageBytes(E):null,admittedFontFace:ct({status:()=>h,unavailable:x,resolve:()=>f?.resolveFont}),shapeLaidOutText:pt({status:()=>h,unavailable:x,shaping:()=>f}),dispose:()=>F("disposed")})}}async function ro(e,o,t={}){if((t.glyphFallbacks?.length??0)>16)throw new RangeError("At most 16 glyph fallback faces are supported");let n$1=io(t.timeoutMs),r=new AbortController,i=()=>r.abort(t.signal?.reason);t.signal?.addEventListener("abort",i,{once:true}),t.signal?.aborted&&i();let s=setTimeout(()=>r.abort(xt),n$1);try{de(r.signal);let a=(async()=>{let u=to(t.onActiveFontBytesChange),p=!1;try{let l=so(e).slice(0,c),g=[],d={dropped:[]},c$1=gt(e,d),y=[...o,...c$1?[c$1]:[],...t.lastResortFonts??[]],R=await l$1(y,{families:[...new Set([...(t.glyphFallbacks??[]).map(x=>x.family),...l])].slice(0,c),defaultFamily:d$2.family,signal:r.signal},{onOriginFailure:x=>g.push(x),reserveOwnedBytes:u.reserve});de(r.signal);let b=e$1(R??{});if(b.sources.length===0){let x=te(l,b.defaultFont.family,g,void 0,d.dropped);oe(x,t),ne(x,t);return}let f=await ht(n(b),void 0,t.glyphFallbacks,t.documentLigatures);de(r.signal);let h=te(l,b.defaultFont.family,g,f.resolveFont,d.dropped);return oe(h,t),ne(h,t),p=!0,Object.freeze({...f,dispose:u.release})}finally{p||u.release();}})();return await Promise.race([a,ao(r.signal)])}finally{clearTimeout(s),t.signal?.removeEventListener("abort",i);}}function io(e){if(e===void 0)return 6e4;if(!Number.isFinite(e)||e<=0)throw new RangeError("timeoutMs must be a positive finite number");return Math.max(1,e)}function ao(e){return new Promise((o,t)=>{let n=()=>{t(Ft(e));};e.aborted?n():e.addEventListener("abort",n,{once:true});})}function Ft(e){let o=e.reason===xt;return new d$1(o?"timedOut":"aborted",o?"Font resolution timed out":"Font resolution was aborted",o?void 0:{cause:e.reason})}function de(e){if(e.aborted)throw Ft(e)}function so(e){let o=[e.part().root],t=[],n=[],r=new Set([e.part().name]),i=(l,g)=>{!g||r.has(g.name)||(r.add(g.name),l.push(g.root));};for(let l of e.headerFooterPartsBySection()){for(let g of l.headers.values())i(t,g);for(let g of l.footers.values())i(t,g);}for(let l of ["footnote","endnote"])n.push(...lo(e,l));let s$1=e.documentThemeFonts(),a={...s$1,major:s$1.major,minor:s$1.minor,majorEastAsia:s$1.majorEastAsia??null,minorEastAsia:s$1.minorEastAsia??null},u=new Map,p=(l,g)=>{let d=d$3(l,e.stylesRoot(),a,uo(l,g)),c=v(l,e.numberingRoot(),e.stylesRoot(),a);for(let y of [...d.direct,...mo(l),...c,...s(l,e.stylesRoot(),a),...d.inherited]){let R=y.toLowerCase();u.has(R)||u.set(R,y);}};return p(o,"body"),p(t,"furniture"),p(n,"note"),[...u.values()]}function lo(e,o){let t=eg(e.currentPackage(),o);if(!t)return [];let n=new Set(fg(e.part()).filter(i=>i.noteKind===o).map(i=>i.noteId)),r=[];for(let i of t.root.children){if(i.kind==="textValue")continue;let s=_b(i),a=Zb(i);(s==="separator"||s==="continuationSeparator"||a!==null&&n.has(a))&&r.push(i);}return r}var co="http://schemas.openxmlformats.org/officeDocument/2006/math";function uo(e,o){let t=new Set;for(let n of e){let r=[],i=[{node:n,context:o}];for(;i.length>0;){let{node:s,context:a}=i.pop();s.namespaceUri===fa$1&&s.localName==="p"&&r.push({paragraph:s,context:a});let u=s.namespaceUri===fa$1&&s.localName==="txbxContent"&&(a==="body"||a==="note")?"detached":a;for(let p=s.children.length-1;p>=0;p-=1){let l=s.children[p];l.kind!=="textValue"&&i.push({node:l,context:u});}}for(let s of r)po(s.paragraph,t,s.context);}return t}function po(e,o,t){let n=hb(),r=null,i=null,s="",a=false,u=false,p=false,l=0,g=[];for(let d=e.children.length-1;d>=0;d-=1){let c=e.children[d];c.kind!=="textValue"&&g.push({node:c,runId:null,visibility:D,containerDepth:0});}for(;g.length>0;){let{node:d,runId:c,visibility:y,containerDepth:R}=g.pop();if(R>=na||d.namespaceUri===fa$1&&d.localName==="p")continue;let b=d.namespaceUri===fa$1&&d.localName==="r"?d.id:c;if(d.namespaceUri===fa$1&&d.localName==="fldSimple"){let f=ce(d,"instr")??"";$c(f,{allowPageFields:t==="body"||t==="furniture",allowRefFields:t==="body"||t==="note",allowPageRef:t==="body",allowAutonum:t==="body"||t==="note"})&&fo(d)!==D&&o.add(d.id);}if(d.namespaceUri===fa$1&&d.localName==="fldChar"){let f=ce(d,"fldCharType");if(f==="begin")kb(n),n.nesting===1&&(r=b,i=null,s="",a=false,u=false,p=ye(d),l=0);else if(f==="separate"){let h=n.nesting===1;if(mb(n),h){let x=jb(n);s=x.instruction,a=x.overflow||n.nestingOverflow,i=b,u=true;}}else if(f==="end"){if(n.nesting===1){if(n.phase==="instruction"){let x=jb(n);s=x.instruction,a=x.overflow||n.nestingOverflow;}if(!a&&_c(s,{hasSeparate:u,hasLegacyFormData:p,allowPageFields:t==="body"||t==="furniture",allowRefFields:t==="body"||t==="note",allowPageRef:t==="body",allowAutonum:t==="body"||t==="note"})&&l!==D){let x=i??r;x&&o.add(x);}}nb(n);}continue}if(d.namespaceUri===fa$1&&(d.localName==="instrText"||d.localName==="delInstrText")){lb(n,Ot(d),d.localName==="delInstrText");continue}n.nesting>0&&ob(n)&&d.namespaceUri===fa$1&&Et(d)&&(l|=y);for(let f=d.children.length-1;f>=0;f-=1){let h=d.children[f];h.kind!=="textValue"&&g.push({node:h,runId:b,visibility:y&St(d),containerDepth:oa(d,R)});}}ib(n);}function Et(e){return e.localName==="t"||e.localName==="delText"?Ot(e).length>0:e.localName==="sym"||e.localName==="tab"||e.localName==="br"}var ue=1,bt=2,Rt=4,D=ue|bt|Rt;function fo(e){let o=[];for(let n of e.children)n.kind!=="textValue"&&o.push({node:n,visibility:D});let t=0;for(;o.length>0;){let{node:n,visibility:r}=o.pop();if(!(n.namespaceUri===fa$1&&n.localName==="p")){if(n.namespaceUri===fa$1&&Et(n)&&(t|=r,t===D))return t;for(let i of n.children)i.kind!=="textValue"&&o.push({node:i,visibility:r&St(n)});}}return t}function St(e){return e.namespaceUri!==fa$1?D:e.localName==="ins"||e.localName==="moveTo"?ue|bt:e.localName==="del"||e.localName==="moveFrom"?ue|Rt:D}function mo(e){let o=new Map,t=n=>{let r=a(n??void 0);if(r===null)return;let i=r.toLowerCase();o.has(i)||o.set(i,r);};for(let n of e){let r=[n];for(;r.length>0;){let i=r.pop();if(i.namespaceUri===co&&t(_b$1),i.namespaceUri===fa$1&&i.localName==="sym"&&t(b$1(oo(i,"font"))),i.namespaceUri===fa$1&&i.localName==="fldSimple"){let s=ce(i,"instr");t(Vc(s??"")?.font??null);}if(i.namespaceUri===fa$1&&i.localName==="p")for(let s of u(i))t(s);for(let s=i.children.length-1;s>=0;s-=1){let a=i.children[s];a.kind!=="textValue"&&r.push(a);}}}return [...o.values()]}function Ot(e){let o="",t=[...e.children].reverse();for(;t.length>0&&o.length<=256;){let n=t.pop();if(n.kind==="textValue")o+=n.value;else for(let r=n.children.length-1;r>=0;r-=1)t.push(n.children[r]);}return o}var At="FILE_TOO_LARGE",vt=8;function yo(e){return typeof e=="object"&&e!==null}function Tt(e){if(!(!yo(e)||typeof e.code!="string"))return e.code}function Lt(e){return e===""||e.toLowerCase()==="localhost"}function ho(e){try{let o=decodeURIComponent(e);return o.includes("\0")?null:o}catch{return null}}function Pt(e){let o=ho(e);if(o===null)return null;let t=[];for(let n of o.split(/[/\\]/))if(!(n===""||n===".")){if(n===".."){if(t.length===0)return null;t.pop();continue}t.push(n);}return `/${t.join("/")}`}function Dt(e){let o=Pt(e);return o===null?null:o.endsWith("/")?o:`${o}/`}function go(e){return e==="/"||/^\/[A-Za-z]:\/$/.test(e)}function xo(e){let o;try{o=typeof e=="string"?new URL(e):new URL("href"in e?e.href:String(e));}catch{throw new TypeError("trustedRoot must be an absolute file: URL")}if(o.protocol!=="file:")throw new TypeError("trustedRoot must use the file: protocol");if(o.username!==""||o.password!=="")throw new TypeError("trustedRoot must not include credentials");if(!Lt(o.host))throw new TypeError("trustedRoot must be a local file: URL");let t=Dt(o.pathname);if(t===null||go(t))throw new TypeError("trustedRoot must be a directory inside the filesystem");let n=new URL("file:///");return n.pathname=t,n}function Fo(e){if(typeof e=="string")return [e];if(typeof e=="object"&&e!==null&&"href"in e)return [e];if(Array.isArray(e))return e;throw new TypeError("trustedRoot must be an absolute file: URL")}function Eo(e){let o=Fo(e);if(o.length===0)throw new TypeError("trustedRoot must name at least one directory");if(o.length>vt)throw new TypeError(`trustedRoot must not exceed ${vt} directories`);return o.map(xo)}function bo(e){if(!Number.isSafeInteger(e)||e<=0)throw new TypeError("maxBytes must be a positive safe integer");if(e>b)throw new TypeError(`maxBytes must not exceed ${b}`);return e}function Ro(e,o){if(e.protocol!=="file:"||e.username!==""||e.password!==""||!Lt(e.host))return null;let t=Pt(e.pathname);if(t===null)return null;for(let n of o){let r=Dt(n.pathname);if(r===null||!t.startsWith(r)||t.length<=r.length)continue;let i=new URL("file:///");return i.pathname=t,i}return null}function So(e){return typeof e=="string"?new URL(e):"href"in e&&typeof e.href=="string"?new URL(e.href):new URL("url"in e?e.url:String(e))}function Oo(e,o,t){let n=t.relative(t.resolve(e),t.resolve(o));return n!==""&&!n.startsWith("..")&&!t.isAbsolute(n)}function wt(e,o,t){return e.some(n=>Oo(n,o,t))}async function vo(e,o){let t=[];for(let n of e)try{t.push(await o(n));}catch(r){if(Tt(r)==="ENOENT")continue;throw r}return t}function wo(e){return async(o,{signal:t,maxBytes:n})=>{if(t?.aborted)throw t.reason;let[{open:r,realpath:i},{constants:s},{fileURLToPath:a},u]=await Promise.all([import('fs/promises'),import('fs'),import('url'),import('path')]),p=e.map(y=>u.resolve(a(y.href))),l=u.resolve(a(typeof o=="string"?o:o.href));if(!wt(p,l,u))throw Object.assign(new Error("packaged file is outside trustedRoot"),{code:"ENOENT"});let g=typeof s.O_NOFOLLOW=="number"?s.O_RDONLY|s.O_NOFOLLOW:"r",d=await r(l,g),c=()=>{d.close();};t?.addEventListener("abort",c,{once:true});try{if(t?.aborted)throw t.reason;let y=await i(l);if(!wt(await vo(p,i),y,u))throw Object.assign(new Error("packaged file is outside trustedRoot"),{code:"ENOENT"});let R=(await d.stat()).size;if(!Number.isSafeInteger(R)||R<0||R>n)throw Object.assign(new Error("packaged file exceeds maxBytes"),{code:At});let b=new Uint8Array(R),f=0;for(;f<b.byteLength;){if(t?.aborted)throw t.reason;let{bytesRead:h}=await d.read(b,f,b.byteLength-f,f);if(h===0)break;f+=h;}if(t?.aborted)throw t.reason;return f===b.byteLength?b:b.slice(0,f)}catch(y){throw t?.aborted?t.reason:y}finally{t?.removeEventListener("abort",c),await d.close().catch(()=>{});}}}function Ao(e){if(e===null||typeof e!="object")throw new TypeError("createPackagedFileFetch requires trustedRoot and maxBytes");if(e.trustedRoot===void 0||e.maxBytes===void 0)throw new TypeError("createPackagedFileFetch requires trustedRoot and maxBytes");let o=Eo(e.trustedRoot),t=bo(e.maxBytes),n=e.read??wo(o),r=e.networkFetch??fetch;return(async(i,s)=>{let a=s?.signal;if(a?.aborted)throw a.reason;let u=So(i);if(u.protocol!=="file:")return r(u,s);let p=Ro(u,o);if(!p)return new Response(null,{status:404});let l=a?new AbortController:void 0,g=()=>l?.abort(a?.reason);a?.addEventListener("abort",g,{once:true});let d;try{if(d=await n(p,{maxBytes:t,...l?{signal:l.signal}:{}}),a?.aborted)throw a.reason;if(d.byteLength>t)return new Response(null,{status:413})}catch(c){if(a?.aborted)throw a.reason;if(l?.signal.aborted)throw l.signal.reason??c;if(c instanceof DOMException&&c.name==="AbortError"||c instanceof Error&&c.name==="AbortError")throw c;let y=Tt(c);if(y===At)return new Response(null,{status:413});if(y==="ENOENT"||y==="ENOTDIR"||y==="ELOOP")return new Response(null,{status:404});throw c}finally{a?.removeEventListener("abort",g);}return new Response(d,{status:200})})}
2
- export{le as MAX_SHARED_EXPORT_SHAPING_CONFIGURATIONS,Kt as acquireSharedExportShaping,Ao as createPackagedFileFetch,ee as hasExportAdmittedFont,ie as hasExportLaidOutText,eo as hasFontBackedExportCapabilities,no as openFontBackedDocumentForExport};
1
+ import {c as c$1,o,d as d$1,f,y,v,j as j$2,r,m,x,l as l$1}from'./chunk-LWCI65EL.js';import {j as j$1,l,k,q as q$1,h,n,c as c$2,g,_ as _$2,Z,aa}from'./chunk-EEAV3WIN.js';import'./chunk-RIYSCEFQ.js';import {d,e}from'./chunk-EYK4K2J6.js';export{d as ExportResourceError,c as createNodeImageDecodePort,b as exportDestinationNamed,e as openDocumentForExport}from'./chunk-EYK4K2J6.js';import {c,da,ra,cc,dc,_ as _$1,ea,h as h$1,a,d as d$3,Zc,b as b$1,i,ib,dd,lb,nb,kb,cd,ob,mb,pb,jb,p,s,n as n$1,ac}from'./chunk-XSHXBJ2J.js';import {d as d$2,b,a as a$1}from'./chunk-5BIASAN3.js';import'./chunk-73PG6L2X.js';import {ab}from'./chunk-L6V3IJ3S.js';import {Ig,Jg,kc,jc,fa,E,Se,oa,ff,pa}from'./chunk-DDGGSBAN.js';function _(e,o,t){if(o.environment.features.smcp!==1||!/\p{Ll}/u.test(o.text))return t;let n={...o,environment:{...o.environment,features:{...o.environment.features,smcp:0}}},r=e.shape(n);if(t.glyphs.length!==r.glyphs.length||t.glyphs.some((u,c)=>u.id!==r.glyphs[c]?.id))return t;let i=[],s=0;for(let u of o.text){let c=u.toUpperCase()!==u,y=i.at(-1);y&&(y.lower===c||/\p{M}/u.test(u))?y.text+=u:i.push({text:u,start:s,lower:c}),s+=u.length;}let a=[],p=[],l=[],d=true,g=0;for(let u of o.environment.direction==="rtl"?i.reverse():i){let c=u.lower?.8:1,y=[],R=[],b="",f=u.start;for(let F of u.text){let m=u.lower?F.toUpperCase():F;for(let E=0;E<m.length;E++)y.push(f),R.push(f+F.length);b+=m,f+=F.length;}let h=e.shape({...n,text:b}),x=a.length;for(let[F,m]of h.glyphs.entries()){let E=h.exactAdvancesX?.[F];E===void 0?d=false:l.push(E*c),a.push({...m,cluster:y[m.cluster]??u.start,originX:n$1(g+Math.round(m.originX*c)),originY:n$1(Math.round(m.originY*c)),offsetX:n$1(Math.round(m.offsetX*c)),offsetY:n$1(Math.round(m.offsetY*c)),advanceX:n$1(Math.round(m.advanceX*c)),advanceY:n$1(Math.round(m.advanceY*c)),drawScale:c});}for(let F of h.clusters){let m=y[F.textStart]??u.start,E=R[F.textEnd-1]??f,T=n$1(Math.round(F.advance*c)),A=p.at(-1);A&&A.textStart===m&&A.textEnd===E?p[p.length-1]={...A,glyphEnd:x+F.glyphEnd,advance:n$1(A.advance+T),caretEdges:[n$1(0),n$1(A.advance+T)]}:p.push({...F,textStart:m,textEnd:E,glyphStart:x+F.glyphStart,glyphEnd:x+F.glyphEnd,advance:T,caretEdges:F.caretEdges.map(G=>n$1(Math.round(G*c))),fontSpan:0});}g+=h.glyphs.reduce((F,m)=>F+Math.round(m.advanceX*c),0);}return {...t,glyphs:a,clusters:p,fontSpans:[{...t.fontSpans[0],glyphStart:0,glyphEnd:a.length}],exactAdvancesX:d&&l.length===a.length?l:void 0}}var st=new WeakMap;function Ut(e){let o=st.get(e);return o===void 0&&(o=zt(e.bytes,e.faceIndex),st.set(e,o)),o}var Bt=new Set(["COLR","CBDT","sbix"]),qt=512;function zt(e,o){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.byteLength<12)return false;let n=0;if(lt(e,0)==="ttcf"){let i=t.getUint32(8);if(o<0||o>=i||12+4*o+4>e.byteLength||(n=t.getUint32(12+4*o),n+12>e.byteLength))return false}let r=Math.min(t.getUint16(n+4),qt);for(let i=0;i<r;i++){let s=n+12+i*16;if(s+4>e.byteLength)return false;if(Bt.has(lt(e,s)))return true}return false}function lt(e,o){return String.fromCharCode(e[o],e[o+1],e[o+2],e[o+3])}var jt=/\p{Emoji_Presentation}|️/u;function Ht(e){return jt.test(e)}function q(e,o){if(e.length<2)return e;let t=e.filter(Ut);if(t.length===0||t.length===e.length)return e;let n=e.filter(r=>!t.includes(r));return Ht(o)?[...t,...n]:[...n,...t]}var Xt=2048;function dt(e,o,t,n){if(!t.clusters.length||t.clusters.length>Xt)return null;let r=(f,h)=>{let{context:x,...F}=o,m={...F,text:h,environment:p({...o.environment,font:f})};return _(e,m,e.shape(m))},i=[],s$1=new Map;for(let f of [...t.clusters].sort((h,x)=>h.textStart-x.textStart)){let h=o.environment.font,x=o.text.slice(f.textStart,f.textEnd),F=i.at(-1);if(/^[\uFE0E\uFE0F]$/.test(x)&&F&&F.end===f.textStart){F.end=f.textEnd;continue}if(o.environment.script==="Hebr"&&/^\s+$/u.test(x)&&F&&F.font!==o.environment.font&&F.end===f.textStart){F.end=f.textEnd;continue}if(t.glyphs.slice(f.glyphStart,f.glyphEnd).some(E=>E.id===0)){let E=o.text.slice(f.textStart,f.textEnd+1),T=s$1.get(x)??q(n,E).find(A=>{try{return !r(A,x).glyphs.some(G=>G.id===0)}catch{return false}});if(!T)return null;s$1.set(x,T),h=T;}let m=i.at(-1);m&&m.font===h&&m.end===f.textStart?m.end=f.textEnd:i.push({start:f.textStart,end:f.textEnd,font:h});}let a=[],p$1=[],l=[],d=[],g=true,u=0,c=0,y=0,R=0,b=0;for(let f of o.environment.direction==="rtl"?i.reverse():i){let h=r(f.font,o.text.slice(f.start,f.end));if(h.glyphs.some(m=>m.id===0))return null;let x=a.length,F=l.length;for(let m of h.glyphs)a.push({...m,cluster:f.start+m.cluster,originX:n$1(u+m.originX),originY:n$1(c+m.originY)});if(h.exactAdvancesX===void 0)g=false;else for(let m of h.exactAdvancesX)d.push(m);for(let m of h.clusters)p$1.push({...m,textStart:f.start+m.textStart,textEnd:f.start+m.textEnd,glyphStart:x+m.glyphStart,glyphEnd:x+m.glyphEnd,fontSpan:F});h.glyphs.length&&l.push({font:f.font,glyphStart:x,glyphEnd:a.length,fallbackIndex:f.font===o.environment.font?null:n.indexOf(f.font)}),u+=h.glyphs.reduce((m,E)=>m+E.advanceX,0),c+=h.glyphs.reduce((m,E)=>m+E.advanceY,0),y=Math.max(y,h.metrics.ascent),R=Math.max(R,h.metrics.descent),b=Math.max(b,h.metrics.lineGap);}return s({...t,glyphs:a,clusters:p$1,fontSpans:l,exactAdvancesX:g&&d.length===a.length?d:void 0,metrics:{ascent:n$1(y),descent:n$1(R),lineGap:n$1(b)}},{...o.environment,fallbackOrder:n})}var Gt=new Map([["Beng",["bng2","beng"]],["Deva",["dev2","deva"]],["Gujr",["gjr2","gujr"]],["Guru",["gur2","guru"]],["Knda",["knd2","knda"]],["Mlym",["mlm2","mlym"]],["Orya",["ory2","orya"]],["Taml",["tml2","taml"]],["Telu",["tel2","telu"]],["Nkoo",["nko "]]]),Vt=512,ut=new WeakMap;function Wt(e,o){let t=new Set,n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=c=>c+2<=n.byteLength?n.getUint16(c):-1,i=c=>c+4<=n.byteLength?n.getUint32(c):-1,s=c=>c+4<=n.byteLength?String.fromCharCode(n.getUint8(c),n.getUint8(c+1),n.getUint8(c+2),n.getUint8(c+3)):"",a=0;if(s(0)==="ttcf"){let c=i(8);if(c<0||o<0||o>=c||(a=i(12+o*4),a<0))return t}let p=r(a+4);if(p<0||p>1024)return t;let l=-1;for(let c=0;c<p;c+=1){let y=a+12+c*16;if(s(y)==="GSUB"){l=i(y+8);break}}if(l<0)return t;let d=r(l+4);if(d<=0)return t;let g=l+d,u=r(g);if(u<0)return t;for(let c=0;c<Math.min(u,Vt);c+=1){let y=s(g+2+c*6);y&&t.add(y);}return t}function Yt(e,o){let t=ut.get(e);return t||(t=Wt(e.bytes,e.faceIndex),ut.set(e,t)),(Gt.get(o)??[o.toLowerCase()]).some(r=>t.has(r))}function ct(e,o){let t=e.filter(n=>Yt(n,o));return t.length===0||t.length===e.length?e:[...t,...e.filter(n=>!t.includes(n))]}function J(e,o,t){if(!o.text.includes("\u2011"))return t;let n=new Set(t.glyphs.filter(i=>i.id===0).map(i=>i.cluster));if(!n.size)return t;let r=o.text.replace(/\u2011/g,(i,s)=>n.has(s)?"-":i);if(r===o.text)return t;try{let i=e.shape({...o,text:r});return s({...i,text:o.text},o.environment)}catch{return t}}function pt(e,o){if(o.length===0)return e;if(o.length>16)throw new RangeError("At most 16 glyph fallback faces are supported");let t=o.map(a=>e.fonts.resolve(a)).filter(a=>!(a instanceof d$3)),n={shape(a){return J(e.shaper,a,e.shaper.shape(a))}},r=new WeakMap,i={shape(a){let p=e.shaper.shape(a),l=r.get(p);if(l&&l.input.text===a.text&&l.input.fontSizeHalfPoints===a.fontSizeHalfPoints&&l.input.bidiLevel===a.bidiLevel&&l.input.context?.before===a.context?.before&&l.input.context?.after===a.context?.after&&l.input.environment===a.environment)return l.run;let d=s(a,J(e.shaper,a,p));return r.set(p,{input:a,run:d}),d}},s=(a,p$1)=>{let l=_(n,a,p$1);if(!l.glyphs.some(d=>d.id===0)||/^[\t\n\r\f]*$/.test(a.text))return l;if(/^(Latn|Cyrl|Grek|Hebr|Hani|Hira|Kana|Hang|Zyyy|Zinh)$/.test(a.environment.script)){let d=dt(n,a,l,t);if(d)return d}for(let d of ct(q(t,a.text),a.environment.script))if(!(d.hash===a.environment.font.hash&&d.faceIndex===a.environment.font.faceIndex))try{let g={...a,environment:p({...a.environment,font:d})},u=_(n,g,n.shape(g));if(!u.glyphs.some(c=>c.id===0))return u}catch{}return l};return {...e,shaper:i}}var Q=b$1;function ee(e){return typeof e.admittedFontFace=="function"}var $t=Object.freeze([{weight:400,style:"normal"},{weight:700,style:"normal"},{weight:400,style:"italic"},{weight:700,style:"italic"}]);function z(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}var ft=new WeakMap;function j(e){let o=ft.get(e);return o||ft.set(e,o=Kt(e)),o}function Kt(e){let o=e.substitution;return Object.freeze({id:e.id,identity:e.identity,family:e.family,request:z(e.request),byteLength:e.byteLength,hash:e.hash,faceIndex:e.faceIndex,substitution:o?Object.freeze({requested:z(o.requested),resolved:z(o.resolved),...o.lineMetrics?{lineMetrics:Object.freeze({...o.lineMetrics})}:{}}):null})}function Zt(e){return Object.freeze({...j(e),bytes:i(e)})}function Jt(e,o){if(!e)return null;try{let t=e(o);return !t||t instanceof d$3?null:Zt(t)}catch{return null}}function mt(e){return o=>{if(e.status()!=="active")throw e.unavailable();return Jt(e.resolve(),o)}}function Qt(e){return Object.freeze(e.slice(0,Q).map(o=>Object.freeze({request:z(o.request),partName:o.partName,reason:o.reason})))}function te(e,o,t,n,r=[]){let i=new Map;for(let a of [...e,o]){let p=a.toLowerCase();i.has(p)||i.set(p,a);}let s=[...i.values()].map(a=>{let p=[];for(let l of $t){let d=n?.({family:a,...l});!d||d instanceof d$3||p.push(Object.freeze({...l,sourceFamily:d.family,via:d.substitution?"substitution":"direct",identity:d.identity,id:d.id,hash:d.hash,faceIndex:d.faceIndex,substitution:d.substitution}));}return Object.freeze({family:a,coverage:p.length===4?"complete":p.length>0?"partial":"none",faces:Object.freeze(p)})});return Object.freeze({requestedFamilies:Object.freeze([...e]),defaultFamily:o,families:Object.freeze(s),originFailures:Object.freeze([...t]),droppedEmbeddedFonts:Qt(r)})}function oe(e,o){if(o.onFontResolution){try{let t=o.onFontResolution(e);Promise.resolve(t).catch(n=>{console.warn("[fonts] font-resolution diagnostics callback failed",n);});}catch(t){console.warn("[fonts] font-resolution diagnostics callback failed",t);}return}for(let t of e.originFailures)console.warn("[fonts] a document export font origin failed and was skipped",t);for(let t of e.droppedEmbeddedFonts??[])console.warn("[fonts] a document embedded font face was dropped during export",t);}function ne(e,o,t=[]){let n=l=>l.trim().toLowerCase(),r=new Set([...e.requestedFamilies,e.defaultFamily].map(n)),i=new Set(t.map(l=>n(l.family))),s=l=>{if(!(l instanceof l$1))return true;let d=n(l.request.family);return r.has(d)||!i.has(d)},a=e.originFailures.some(({cause:l})=>l instanceof m?l.causes.length===0||l.causes.some(s):s(l));if(o.fontPolicy!=="strict"||!a&&e.families.every(l=>l.coverage==="complete"))return;let p=e.families.filter(l=>l.coverage!=="complete").map(l=>l.family).join(", ");throw new d("layoutFailed",`Strict font policy refused export${p?`; incomplete families: ${p}`:"; a font origin failed"}`)}function H(){return new Map}function re(e,o,t,n){if(t.trim().length===0)return null;let r={family:t,weight:n.bold?700:400,style:n.italic?"italic":"normal"},i=h$1(r),s=o.get(i);if(!s){try{s=e.fonts.resolve(r);}catch{return null}o.set(i,s);}return s instanceof d$3?null:s}function yt(e,o,t){let n=t.fontFamily??e.defaultFont.family;return re(e,o,n,t)}function ie(e){return typeof e.shapeLaidOutText=="function"}function ae(e){let o=H(),t=new WeakMap;return n=>{let r=ra(n.style,n.fontSlot),i=cc(n)?dc(n):_$1(n.text,r);if(i.length===0)return null;let s=r.fontFamily??e.defaultFont.family,a=re(e,o,s,r);if(!a)return null;try{if(r.smallCaps&&!_$2(e.shaper,e.environment,a,r,t))return null;let p=Z(e.shaper,e.environment,a,r,i);return Object.freeze({run:p,font:j(p.fontSpans[0]?.font??a),...p.fontSpans.length>1?{fonts:Object.freeze(p.fontSpans.map(l=>j(l.font)))}:{},fixedPointScale:e.environment.fixedPointScale})}catch{return null}}}function ht(e){return o=>{if(e.status()!=="active")throw e.unavailable();return e.shaping()?.shapeLaidOutText(o)??null}}var N=new Map,X=new WeakMap,se=0,M,le=32,gt=c;function xt(){if(M)return M;let e=(async()=>(await c$2(),g(h)))();return M=e,e.catch(()=>{M===e&&(M=void 0);}),e}function Ft(e){let o=H();return aa(e,{resolveFont(t){return yt(e,o,t)},fallback:ea()})}async function Et(e,o,t=[],n=false){if(!j$1(e))throw new TypeError("Session exporter shaping requires a prepared font handle");let r=await xt(),i=pt(await q$1(e,r,h,o,n),t);return Object.freeze({createMeasurer:()=>Ft(i),resolveFont:s=>i.fonts.resolve(s),shapeLaidOutText:ae(i),producer:["node-export-session",JSON.stringify(t),e.fingerprint,i.operation.shapingHash,`producer:${i.operation.producerVersion}`,`fallback:${da}`].join("|"),extensionFingerprint:e.fingerprint})}function eo(e,o){if(!j$1(e))return Promise.reject(new TypeError("Shared exporter shaping requires a prepared font handle"));let t=X.get(e);if(t)return t;let n=l(e),r=N.get(n);if(!r){if(N.size>=le)return Promise.reject(new RangeError(`Shared exporter shaping is limited to ${le} process-wide configurations`));r=(async()=>{let p=k(e).sources.reduce((d,g)=>d+(g.availability==="forbidden"?0:g.bytes.byteLength),0);if(se+p>gt)throw new RangeError(`Shared exporter shaping font bytes are limited to ${gt} process-wide`);se+=p;let l;try{let d=await xt();l=await q$1(e,d,h,o);}catch(d){throw se-=p,d}return Object.freeze({createMeasurer:()=>Ft(l),shapeLaidOutText:ae(l),shapingHash:l.operation.shapingHash,producerVersion:l.operation.producerVersion})})(),N.set(n,r),r.catch(()=>{N.get(n)===r&&N.delete(n);});}let i=e.fingerprint,s=r.then(a=>Object.freeze({createMeasurer:a.createMeasurer,shapeLaidOutText:a.shapeLaidOutText,producer:["node-export",i,a.shapingHash,`producer:${a.producerVersion}`,`fallback:${da}`].join("|"),extensionFingerprint:i}));return X.set(e,s),s.catch(()=>{X.get(e)===s&&X.delete(e);}),s}var to="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable";function oo(e){let o=e.currentPackage(),t=(o.relationships.get(o.mainDocumentPart)??[]).find(r=>r.type===to),n;if(t){let r=E(t);r.mode==="Internal"&&r.target.ok&&(n=o.parts.get(r.target.partName));}return n??=o.parts.get("/word/fontTable.xml"),Se(o,n)}function bt(e,o){let t=oo(e);if(t.length!==0)return j$2(n=>{let r$1=new Set((n.resolvedFaces??[]).map(s=>h$1(s))),i=r(t,{maxFontBytes:a,aggregateBudget:no(n),shadowedRequests:r$1});if(o)for(let s of i.dropped){if(o.dropped.length>=Q)break;o.dropped.push(s);}return {sources:i.sources}})}function no(e){let o=e.committedSourceBytes;return o===void 0||!Number.isSafeInteger(o)||o<=0?c:Math.max(0,c-o)}function ro(e){return ee(e)&&ie(e)}var w=0,Rt=Symbol("font-resolution-timeout");function io(e){let o=0,t=false;return e?.(w),{reserve:r=>{if(t)throw new Error("Document font-byte lease is already released");if(w+r>c)throw new d("layoutFailed",`Active document export font bytes are limited to ${c}; requested ${r} bytes with ${w} bytes already active`);w+=r,o+=r,e?.(w);let i=false;return ()=>{i||t||(i=true,w-=r,o-=r,e?.(w));}},release:()=>{t||(t=true,w-=o,o=0,e?.(w));}}}function ue(e,o){return e.attributes.find(t=>t.localName===o)?.value}function ao(e,o){return e.attributes.find(t=>t.localName===o&&(t.namespaceUri===fa||t.namespaceUri===""))?.value}async function so(e$1,o){if(o.reuseAcrossRevisions===true)throw new TypeError("reuseAcrossRevisions requires a live view or caller-supplied measurer; document-aware byte sessions are immutable");if(o.signal?.aborted)return {ok:false,reason:"aborted"};let t=ab(e$1);if(!t.ok)return t;let{fonts:n,lastResortFonts:r,fontResolutionTimeoutMs:i,fontPolicy:s,onFontResolution:a,glyphFallbacks:p,documentLigatures:l,...d$1}=o,g=Array.isArray(n)?n:[n],u=r===void 0?[]:Array.isArray(r)?r:[r],c,y;try{y=await lo(t.view,g,{signal:o.signal,timeoutMs:i??o.resourceTimeoutMs,fontPolicy:s,glyphFallbacks:p,documentLigatures:l,lastResortFonts:u,onFontResolution:E=>(c=E,a?.(E))});}catch(E){if(E instanceof d&&E.code==="aborted")return {ok:false,reason:"aborted"};throw E}if(!c)throw y?.dispose(),new d("layoutFailed","Document font resolution completed without publishing its evidence");let R;try{R=e(t.view,{...d$1,reuseAcrossRevisions:!1,...y?{measurer:y.createMeasurer(),producer:o.producer??y.producer}:o.producer?{producer:o.producer}:{}});}catch(E){throw y?.dispose(),E}if(!R.ok)return y?.dispose(),R;let b=R.session,f=y,h="active",x=()=>h==="aborted"?new d("aborted","Export resource settlement was aborted"):new d("disposed","Export session has been disposed"),F=E=>{if(h==="active"){h=E,o.signal?.removeEventListener("abort",m);try{b.dispose();}finally{f?.dispose(),f=void 0;}}},m=()=>F("aborted");return o.signal?.addEventListener("abort",m,{once:true}),o.signal?.aborted&&m(),{ok:true,session:Object.freeze({fontResolution:c,layout:()=>h==="active"?b.layout():Promise.reject(x()),layoutFor:E=>h==="active"?b.layoutFor(E):Promise.reject(x()),validatedImageBytes:E=>h==="active"?b.validatedImageBytes(E):null,admittedFontFace:mt({status:()=>h,unavailable:x,resolve:()=>f?.resolveFont}),shapeLaidOutText:ht({status:()=>h,unavailable:x,shaping:()=>f}),dispose:()=>F("disposed")})}}async function lo(e,o$1,t={}){if((t.glyphFallbacks?.length??0)>16)throw new RangeError("At most 16 glyph fallback faces are supported");let n$1=uo(t.timeoutMs),r=new AbortController,i=()=>r.abort(t.signal?.reason);t.signal?.addEventListener("abort",i,{once:true}),t.signal?.aborted&&i();let s=setTimeout(()=>r.abort(Rt),n$1);try{de(r.signal);let a=(async()=>{let p=io(t.onActiveFontBytesChange),l=!1;try{let d=po(e).slice(0,c$1),g=[],u={dropped:[]},c=bt(e,u),y=[...o$1,...c?[c]:[],...t.lastResortFonts??[]],R=await o(y,{families:[...new Set([...(t.glyphFallbacks??[]).map(x=>x.family),...d])].slice(0,c$1),defaultFamily:d$1.family,signal:r.signal},{onOriginFailure:x=>g.push(x),reserveOwnedBytes:p.reserve,maxExecutionFontBytes:h.maxFontBytes});de(r.signal);let b=f(R??{});if(b.sources.length===0){let x=te(d,b.defaultFont.family,g,void 0,u.dropped);oe(x,t),ne(x,t,t.glyphFallbacks);return}let f$1=await Et(n(b),void 0,t.glyphFallbacks,t.documentLigatures);de(r.signal);let h$1=te(d,b.defaultFont.family,g,f$1.resolveFont,u.dropped);return oe(h$1,t),ne(h$1,t,t.glyphFallbacks),l=!0,Object.freeze({...f$1,dispose:p.release})}finally{l||p.release();}})();return await Promise.race([a,co(r.signal)])}finally{clearTimeout(s),t.signal?.removeEventListener("abort",i);}}function uo(e){if(e===void 0)return 6e4;if(!Number.isFinite(e)||e<=0)throw new RangeError("timeoutMs must be a positive finite number");return Math.max(1,e)}function co(e){return new Promise((o,t)=>{let n=()=>{t(St(e));};e.aborted?n():e.addEventListener("abort",n,{once:true});})}function St(e){let o=e.reason===Rt;return new d(o?"timedOut":"aborted",o?"Font resolution timed out":"Font resolution was aborted",o?void 0:{cause:e.reason})}function de(e){if(e.aborted)throw St(e)}function po(e){let o=[e.part().root],t=[],n=[],r=new Set([e.part().name]),i=(d,g)=>{!g||r.has(g.name)||(r.add(g.name),d.push(g.root));};for(let d of e.headerFooterPartsBySection()){for(let g of d.headers.values())i(t,g);for(let g of d.footers.values())i(t,g);}for(let d of ["footnote","endnote"])n.push(...fo(e,d));let s=e.documentThemeFonts(),a={...s,major:s.major,minor:s.minor,majorEastAsia:s.majorEastAsia??null,minorEastAsia:s.minorEastAsia??null},p=new Map,l=(d,g)=>{let u=d$2(d,e.stylesRoot(),a,yo(d,g)),c=y(d,e.numberingRoot(),e.stylesRoot(),a);for(let y of [...u.direct,...xo(d),...c,...v(d,e.stylesRoot(),a),...u.inherited]){let R=y.toLowerCase();p.has(R)||p.set(R,y);}};return l(o,"body"),l(t,"furniture"),l(n,"note"),[...p.values()]}function fo(e,o){let t=Ig(e.currentPackage(),o);if(!t)return [];let n=new Set(Jg(e.part()).filter(i=>i.noteKind===o).map(i=>i.noteId)),r=[];for(let i of t.root.children){if(i.kind==="textValue")continue;let s=kc(i),a=jc(i);(s==="separator"||s==="continuationSeparator"||a!==null&&n.has(a))&&r.push(i);}return r}var mo="http://schemas.openxmlformats.org/officeDocument/2006/math";function yo(e,o){let t=new Set;for(let n of e){let r=[],i=[{node:n,context:o}];for(;i.length>0;){let{node:s,context:a}=i.pop();s.namespaceUri===fa&&s.localName==="p"&&r.push({paragraph:s,context:a});let p=s.namespaceUri===fa&&s.localName==="txbxContent"&&(a==="body"||a==="note")?"detached":a;for(let l=s.children.length-1;l>=0;l-=1){let d=s.children[l];d.kind!=="textValue"&&i.push({node:d,context:p});}}for(let s of r)ho(s.paragraph,t,s.context);}return t}function ho(e,o,t){let n=ib(),r=null,i=null,s="",a=false,p=false,l=false,d=0,g=[];for(let u=e.children.length-1;u>=0;u-=1){let c=e.children[u];c.kind!=="textValue"&&g.push({node:c,runId:null,visibility:D,containerDepth:0});}for(;g.length>0;){let{node:u,runId:c,visibility:y,containerDepth:R}=g.pop();if(R>=oa||u.namespaceUri===fa&&u.localName==="p")continue;let b=u.namespaceUri===fa&&u.localName==="r"?u.id:c;if(u.namespaceUri===fa&&u.localName==="fldSimple"){let f=ue(u,"instr")??"";dd(f,{allowPageFields:t==="body"||t==="furniture",allowRefFields:t==="body"||t==="note",allowPageRef:t==="body",allowAutonum:t==="body"||t==="note"})&&go(u)!==D&&o.add(u.id);}if(u.namespaceUri===fa&&u.localName==="fldChar"){let f=ue(u,"fldCharType");if(f==="begin")lb(n),n.nesting===1&&(r=b,i=null,s="",a=false,p=false,l=ff(u),d=0);else if(f==="separate"){let h=n.nesting===1;if(nb(n),h){let x=kb(n);s=x.instruction,a=x.overflow||n.nestingOverflow,i=b,p=true;}}else if(f==="end"){if(n.nesting===1){if(n.phase==="instruction"){let x=kb(n);s=x.instruction,a=x.overflow||n.nestingOverflow;}if(!a&&cd(s,{hasSeparate:p,hasLegacyFormData:l,allowPageFields:t==="body"||t==="furniture",allowRefFields:t==="body"||t==="note",allowPageRef:t==="body",allowAutonum:t==="body"||t==="note"})&&d!==D){let x=i??r;x&&o.add(x);}}ob(n);}continue}if(u.namespaceUri===fa&&(u.localName==="instrText"||u.localName==="delInstrText")){mb(n,Lt(u),u.localName==="delInstrText");continue}n.nesting>0&&pb(n)&&u.namespaceUri===fa&&Ot(u)&&(d|=y);for(let f=u.children.length-1;f>=0;f-=1){let h=u.children[f];h.kind!=="textValue"&&g.push({node:h,runId:b,visibility:y&At(u),containerDepth:pa(u,R)});}}jb(n);}function Ot(e){return e.localName==="t"||e.localName==="delText"?Lt(e).length>0:e.localName==="sym"||e.localName==="tab"||e.localName==="br"}var ce=1,vt=2,wt=4,D=ce|vt|wt;function go(e){let o=[];for(let n of e.children)n.kind!=="textValue"&&o.push({node:n,visibility:D});let t=0;for(;o.length>0;){let{node:n,visibility:r}=o.pop();if(!(n.namespaceUri===fa&&n.localName==="p")){if(n.namespaceUri===fa&&Ot(n)&&(t|=r,t===D))return t;for(let i of n.children)i.kind!=="textValue"&&o.push({node:i,visibility:r&At(n)});}}return t}function At(e){return e.namespaceUri!==fa?D:e.localName==="ins"||e.localName==="moveTo"?ce|vt:e.localName==="del"||e.localName==="moveFrom"?ce|wt:D}function xo(e){let o=new Map,t=n=>{let r=a$1(n??void 0);if(r===null)return;let i=r.toLowerCase();o.has(i)||o.set(i,r);};for(let n of e){let r=[n];for(;r.length>0;){let i=r.pop();if(i.namespaceUri===mo&&t(ac),i.namespaceUri===fa&&i.localName==="sym"&&t(b(ao(i,"font"))),i.namespaceUri===fa&&i.localName==="fldSimple"){let s=ue(i,"instr");t(Zc(s??"")?.font??null);}if(i.namespaceUri===fa&&i.localName==="p")for(let s of x(i))t(s);for(let s=i.children.length-1;s>=0;s-=1){let a=i.children[s];a.kind!=="textValue"&&r.push(a);}}}return [...o.values()]}function Lt(e){let o="",t=[...e.children].reverse();for(;t.length>0&&o.length<=256;){let n=t.pop();if(n.kind==="textValue")o+=n.value;else for(let r=n.children.length-1;r>=0;r-=1)t.push(n.children[r]);}return o}var Dt="FILE_TOO_LARGE",Tt=8;function Fo(e){return typeof e=="object"&&e!==null}function kt(e){if(!(!Fo(e)||typeof e.code!="string"))return e.code}function It(e){return e===""||e.toLowerCase()==="localhost"}function Eo(e){try{let o=decodeURIComponent(e);return o.includes("\0")?null:o}catch{return null}}function _t(e){let o=Eo(e);if(o===null)return null;let t=[];for(let n of o.split(/[/\\]/))if(!(n===""||n===".")){if(n===".."){if(t.length===0)return null;t.pop();continue}t.push(n);}return `/${t.join("/")}`}function Nt(e){let o=_t(e);return o===null?null:o.endsWith("/")?o:`${o}/`}function bo(e){return e==="/"||/^\/[A-Za-z]:\/$/.test(e)}function Ro(e){let o;try{o=typeof e=="string"?new URL(e):new URL("href"in e?e.href:String(e));}catch{throw new TypeError("trustedRoot must be an absolute file: URL")}if(o.protocol!=="file:")throw new TypeError("trustedRoot must use the file: protocol");if(o.username!==""||o.password!=="")throw new TypeError("trustedRoot must not include credentials");if(!It(o.host))throw new TypeError("trustedRoot must be a local file: URL");let t=Nt(o.pathname);if(t===null||bo(t))throw new TypeError("trustedRoot must be a directory inside the filesystem");let n=new URL("file:///");return n.pathname=t,n}function So(e){if(typeof e=="string")return [e];if(typeof e=="object"&&e!==null&&"href"in e)return [e];if(Array.isArray(e))return e;throw new TypeError("trustedRoot must be an absolute file: URL")}function Oo(e){let o=So(e);if(o.length===0)throw new TypeError("trustedRoot must name at least one directory");if(o.length>Tt)throw new TypeError(`trustedRoot must not exceed ${Tt} directories`);return o.map(Ro)}function vo(e){if(!Number.isSafeInteger(e)||e<=0)throw new TypeError("maxBytes must be a positive safe integer");if(e>a)throw new TypeError(`maxBytes must not exceed ${a}`);return e}function wo(e,o){if(e.protocol!=="file:"||e.username!==""||e.password!==""||!It(e.host))return null;let t=_t(e.pathname);if(t===null)return null;for(let n of o){let r=Nt(n.pathname);if(r===null||!t.startsWith(r)||t.length<=r.length)continue;let i=new URL("file:///");return i.pathname=t,i}return null}function Ao(e){return typeof e=="string"?new URL(e):"href"in e&&typeof e.href=="string"?new URL(e.href):new URL("url"in e?e.url:String(e))}function Lo(e,o,t){let n=t.relative(t.resolve(e),t.resolve(o));return n!==""&&!n.startsWith("..")&&!t.isAbsolute(n)}function Pt(e,o,t){return e.some(n=>Lo(n,o,t))}async function To(e,o){let t=[];for(let n of e)try{t.push(await o(n));}catch(r){if(kt(r)==="ENOENT")continue;throw r}return t}function Po(e){return async(o,{signal:t,maxBytes:n})=>{if(t?.aborted)throw t.reason;let[{open:r,realpath:i},{constants:s},{fileURLToPath:a},p]=await Promise.all([import('fs/promises'),import('fs'),import('url'),import('path')]),l=e.map(y=>p.resolve(a(y.href))),d=p.resolve(a(typeof o=="string"?o:o.href));if(!Pt(l,d,p))throw Object.assign(new Error("packaged file is outside trustedRoot"),{code:"ENOENT"});let g=typeof s.O_NOFOLLOW=="number"?s.O_RDONLY|s.O_NOFOLLOW:"r",u=await r(d,g),c=()=>{u.close();};t?.addEventListener("abort",c,{once:true});try{if(t?.aborted)throw t.reason;let y=await i(d);if(!Pt(await To(l,i),y,p))throw Object.assign(new Error("packaged file is outside trustedRoot"),{code:"ENOENT"});let R=(await u.stat()).size;if(!Number.isSafeInteger(R)||R<0||R>n)throw Object.assign(new Error("packaged file exceeds maxBytes"),{code:Dt});let b=new Uint8Array(R),f=0;for(;f<b.byteLength;){if(t?.aborted)throw t.reason;let{bytesRead:h}=await u.read(b,f,b.byteLength-f,f);if(h===0)break;f+=h;}if(t?.aborted)throw t.reason;return f===b.byteLength?b:b.slice(0,f)}catch(y){throw t?.aborted?t.reason:y}finally{t?.removeEventListener("abort",c),await u.close().catch(()=>{});}}}function Do(e){if(e===null||typeof e!="object")throw new TypeError("createPackagedFileFetch requires trustedRoot and maxBytes");if(e.trustedRoot===void 0||e.maxBytes===void 0)throw new TypeError("createPackagedFileFetch requires trustedRoot and maxBytes");let o=Oo(e.trustedRoot),t=vo(e.maxBytes),n=e.read??Po(o),r=e.networkFetch??fetch;return(async(i,s)=>{let a=s?.signal;if(a?.aborted)throw a.reason;let p=Ao(i);if(p.protocol!=="file:")return r(p,s);let l=wo(p,o);if(!l)return new Response(null,{status:404});let d=a?new AbortController:void 0,g=()=>d?.abort(a?.reason);a?.addEventListener("abort",g,{once:true});let u;try{if(u=await n(l,{maxBytes:t,...d?{signal:d.signal}:{}}),a?.aborted)throw a.reason;if(u.byteLength>t)return new Response(null,{status:413})}catch(c){if(a?.aborted)throw a.reason;if(d?.signal.aborted)throw d.signal.reason??c;if(c instanceof DOMException&&c.name==="AbortError"||c instanceof Error&&c.name==="AbortError")throw c;let y=kt(c);if(y===Dt)return new Response(null,{status:413});if(y==="ENOENT"||y==="ENOTDIR"||y==="ELOOP")return new Response(null,{status:404});throw c}finally{a?.removeEventListener("abort",g);}return new Response(u,{status:200})})}
2
+ export{le as MAX_SHARED_EXPORT_SHAPING_CONFIGURATIONS,eo as acquireSharedExportShaping,Do as createPackagedFileFetch,ee as hasExportAdmittedFont,ie as hasExportLaidOutText,ro as hasFontBackedExportCapabilities,so as openFontBackedDocumentForExport};
@@ -1,4 +1,4 @@
1
- import { F as FontFaceRequest, a as FontConfiguration, b as FontSource, c as FontSourceSubstitution } from './editor-BU6rjQZz.js';
1
+ import { F as FontFaceRequest, a as FontConfiguration, b as FontSource, c as FontSourceSubstitution } from './editor-DYUlyKmb.js';
2
2
 
3
3
  /**
4
4
  * A partial font configuration one origin contributes: sources, substitutions, or both.
@@ -91,7 +91,9 @@ type FontResolver = (request: FontResolutionRequest) => FontConfiguration | Font
91
91
  * of lookups (or fetches) before that limit is ever reached.
92
92
  */
93
93
  declare const MAX_RESOLVER_FAMILIES = 64;
94
- /** Word's document default when nothing else says otherwise: Calibri at 11pt. */
94
+ /** The document default font when nothing else says otherwise: Calibri at 11pt. */
95
+ declare const DEFAULT_FONT: FontConfiguration['defaultFont'];
96
+ /** @deprecated Use {@link DEFAULT_FONT}. */
95
97
  declare const WORD_DEFAULT_FONT: FontConfiguration['defaultFont'];
96
98
  /**
97
99
  * Merge a base and any number of fragments into one frozen `FontConfiguration`.
@@ -250,5 +252,5 @@ interface ComposeFontOriginsOptions {
250
252
  */
251
253
  declare function composeFontOrigins(origins: readonly FontOrigin[], request: FontResolutionRequest, options?: ComposeFontOriginsOptions): Promise<FontConfigurationFragment | undefined>;
252
254
 
253
- export { MAX_RESOLVER_FAMILIES as M, WORD_DEFAULT_FONT as W, FONT_RESOLVER_BRAND as b, FONT_RESOLVER_MARK_KEY as c, composeFontConfiguration as j, composeFontOrigins as k, defineFontResolver as l, isFontResolver as m };
255
+ export { DEFAULT_FONT as D, MAX_RESOLVER_FAMILIES as M, WORD_DEFAULT_FONT as W, FONT_RESOLVER_BRAND as b, FONT_RESOLVER_MARK_KEY as c, composeFontConfiguration as j, composeFontOrigins as k, defineFontResolver as l, isFontResolver as m };
254
256
  export type { ComposeFontOriginsOptions as C, FontOriginFailure as F, FontOrigin as a, FontConfigurationBase as d, FontConfigurationFragment as e, FontResolutionRequest as f, FontResolver as g, FontResolverMark as h, MarkedFontResolver as i };
@@ -1,5 +1,5 @@
1
- import { d as HeaderFooterParts, e as HeaderFooterSectionResolution, T as TreePackageStore } from './tree-package-fragment-BIyGh6L8.js';
2
- import { Q as OoxmlPackage, O as OoxmlPart, a1 as OoxmlElement, Y as OoxmlPackageRejection } from './types-barrel-DN_-gaRX.js';
1
+ import { c as HeaderFooterParts, d as HeaderFooterSectionResolution, T as TreePackageStore } from './tree-package-fragment-YPyYC1aD.js';
2
+ import { Q as OoxmlPackage, O as OoxmlPart, Z as OoxmlElement, Y as OoxmlPackageRejection } from './types-barrel-BO73JqHG.js';
3
3
 
4
4
  /** The package with a hyperlink relationship guaranteed present, and that relationship's id. */
5
5
  interface EnsuredHyperlinkRelationship {
@@ -1,4 +1,4 @@
1
- import { a4 as DrawingProjection, Q as OoxmlPackage } from './types-barrel-DN_-gaRX.js';
1
+ import { a0 as DrawingProjection, Q as OoxmlPackage } from './types-barrel-BO73JqHG.js';
2
2
 
3
3
  /**
4
4
  * The engine's trust-boundary caps: recursion depth, element counts, and the rest.