@docx-editor.dev/core 2.27.0 → 2.29.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 (124) hide show
  1. package/dist/automation.cjs +1 -1
  2. package/dist/automation.d.ts +76 -16
  3. package/dist/automation.js +1 -1
  4. package/dist/binding.cjs +1 -1
  5. package/dist/binding.d.ts +31 -12
  6. package/dist/binding.js +1 -1
  7. package/dist/{index-CkQVRJtJ.d.ts → chrome-print-CAs51cpq.d.ts} +248 -115
  8. package/dist/chunk-236O4YQW.js +2 -0
  9. package/dist/chunk-4HENIAFG.js +1 -0
  10. package/dist/chunk-6JPL6ZAS.cjs +5 -0
  11. package/dist/chunk-6ZQP4HQ7.js +3 -0
  12. package/dist/{chunk-2GK7YQB2.cjs → chunk-7WQ7AAHW.cjs} +1 -1
  13. package/dist/chunk-BCXH4BXB.js +5 -0
  14. package/dist/chunk-BY2ACZZ6.cjs +1 -0
  15. package/dist/chunk-CAJEXXVG.cjs +4 -0
  16. package/dist/chunk-CPWLFPWC.js +30 -0
  17. package/dist/chunk-D7ZMDMPX.cjs +3 -0
  18. package/dist/chunk-DOHF6FA7.cjs +30 -0
  19. package/dist/chunk-DVX32P2P.js +27 -0
  20. package/dist/chunk-E4LOMDNL.js +1 -0
  21. package/dist/chunk-EKLM7NWB.cjs +7 -0
  22. package/dist/chunk-G3K63G7P.cjs +27 -0
  23. package/dist/chunk-G4HOFIKJ.js +1 -0
  24. package/dist/chunk-JLVBDYVQ.cjs +2 -0
  25. package/dist/chunk-LQX36Z5P.js +7 -0
  26. package/dist/chunk-LSZ6KPKK.js +1 -0
  27. package/dist/chunk-MM5QBMTE.cjs +1 -0
  28. package/dist/chunk-OMCG63ZF.js +1 -0
  29. package/dist/chunk-OSFOJTHU.cjs +18 -0
  30. package/dist/chunk-RCLZXP3B.js +2 -0
  31. package/dist/chunk-T6K2QYNZ.cjs +2 -0
  32. package/dist/chunk-TRGAVV2Y.js +4 -0
  33. package/dist/chunk-U4JZVSOE.js +2 -0
  34. package/dist/chunk-UHHYFIDT.cjs +1 -0
  35. package/dist/chunk-V3N4SOAK.cjs +1 -0
  36. package/dist/chunk-W35WTWAO.cjs +1 -0
  37. package/dist/chunk-YQ5G6LC7.js +18 -0
  38. package/dist/collaboration/replication.cjs +1 -1
  39. package/dist/collaboration/replication.d.ts +42 -6
  40. package/dist/collaboration/replication.js +1 -1
  41. package/dist/collaboration.cjs +1 -1
  42. package/dist/collaboration.d.ts +99 -7
  43. package/dist/collaboration.js +1 -1
  44. package/dist/contracts/document.d.ts +18 -3
  45. package/dist/contracts/editor.d.ts +19 -10
  46. package/dist/contracts/interaction.d.ts +31 -2
  47. package/dist/contracts/modules.cjs +1 -1
  48. package/dist/contracts/modules.d.ts +56 -8
  49. package/dist/contracts/modules.js +1 -1
  50. package/dist/contracts/types.d.ts +11 -2
  51. package/dist/{custom-node-writes-Vzpq9I8_.d.ts → custom-node-writes-Bn6uciLb.d.ts} +2 -2
  52. package/dist/diagnostic-context-B8M79cfK.d.ts +30 -0
  53. package/dist/diagnostic-hints-BeVjfNOv.d.ts +113 -0
  54. package/dist/{document-protection-9zpIHWTE.d.ts → document-protection-CUb55pl_.d.ts} +2 -2
  55. package/dist/{editor-B3OBYNrF.d.ts → editor-CZQZmTIU.d.ts} +770 -141
  56. package/dist/{editor-scope-OHPwVQ5l.d.ts → editor-scope-7o9xweiJ.d.ts} +1 -1
  57. package/dist/editor.cjs +1 -1
  58. package/dist/editor.css +5 -5
  59. package/dist/editor.d.ts +439 -33
  60. package/dist/editor.js +1 -1
  61. package/dist/export.cjs +2 -2
  62. package/dist/export.d.ts +23 -14
  63. package/dist/export.js +2 -2
  64. package/dist/failure-NS2lsya4.d.ts +115 -0
  65. package/dist/{font-resolver-DN0xNOf_.d.ts → font-resolver-lSBLirLR.d.ts} +3 -3
  66. package/dist/{headless-document-view-ICYqNkQ1.d.ts → headless-document-view-pp3q7wIh.d.ts} +2 -2
  67. package/dist/{image-resources-BDFxcu7W.d.ts → image-resources-tXLQShoC.d.ts} +10 -10
  68. package/dist/index.cjs +1 -1
  69. package/dist/index.d.ts +92 -20
  70. package/dist/index.js +1 -1
  71. package/dist/{layout-shaping-BvZD_VKP.d.ts → layout-shaping-BD-dF_rn.d.ts} +1 -1
  72. package/dist/layout.cjs +1 -1
  73. package/dist/layout.d.ts +168 -79
  74. package/dist/layout.js +1 -1
  75. package/dist/{note-properties-CkAk7g-n.d.ts → note-properties-qQUjO1GQ.d.ts} +3 -3
  76. package/dist/{omml-equation-DuczgG5o.d.ts → omml-equation-BUbU0utM.d.ts} +1 -1
  77. package/dist/output.cjs +1 -1
  78. package/dist/output.d.ts +18 -9
  79. package/dist/output.js +1 -1
  80. package/dist/{protocol-aKYr8r3u.d.ts → protocol-DYzzz2ej.d.ts} +44 -4
  81. package/dist/{review-paragraph-order-Ddj5d6rp.d.ts → review-paragraph-order-CN_0l2Cb.d.ts} +5 -2
  82. package/dist/{semantic-cell-selection-DoqYCz_F.d.ts → semantic-cell-selection-eYag3P47.d.ts} +8 -213
  83. package/dist/{semantic-interaction-G0bjmmmk.d.ts → semantic-interaction-kR_QB845.d.ts} +25 -34
  84. package/dist/{semantic-paint-CsMzF8-O.d.ts → semantic-paint-ZayFF3tD.d.ts} +17 -5
  85. package/dist/{semantic-record-queries-1du6lQqS.d.ts → semantic-record-queries-Bsgth6lv.d.ts} +1 -1
  86. package/dist/{semantic-records-B9OolWGN.d.ts → semantic-records-DQmumPgL.d.ts} +1367 -884
  87. package/dist/store.cjs +1 -1
  88. package/dist/store.d.ts +1611 -1586
  89. package/dist/store.js +1 -1
  90. package/dist/{tree-package-fragment-DYZIk1rY.d.ts → tree-package-store-CovjNARF.d.ts} +157 -137
  91. package/dist/{tree-session-contract-DQVJOOkv.d.ts → tree-session-contract-CZVAGl51.d.ts} +8 -6
  92. package/dist/{types-barrel-BFKR8Pzp.d.ts → types-barrel-DuC5QBNC.d.ts} +352 -231
  93. package/package.json +3 -3
  94. package/dist/chunk-4KZ6L5YF.cjs +0 -15
  95. package/dist/chunk-55AT3MOU.cjs +0 -25
  96. package/dist/chunk-6ZQMII6V.js +0 -1
  97. package/dist/chunk-7IGCWG4H.js +0 -2
  98. package/dist/chunk-7MYITTAH.js +0 -5
  99. package/dist/chunk-AVKVRU7Z.cjs +0 -5
  100. package/dist/chunk-CWRBFNK5.cjs +0 -5
  101. package/dist/chunk-DGPA3TST.cjs +0 -27
  102. package/dist/chunk-DNXVNQEO.js +0 -1
  103. package/dist/chunk-FQN4KSFL.cjs +0 -7
  104. package/dist/chunk-GVUOWHTO.cjs +0 -1
  105. package/dist/chunk-GWQJ5774.js +0 -5
  106. package/dist/chunk-HAQ72KD7.js +0 -1
  107. package/dist/chunk-HO5XFO32.cjs +0 -3
  108. package/dist/chunk-IGR23DV2.js +0 -1
  109. package/dist/chunk-JSIX2EOH.js +0 -3
  110. package/dist/chunk-K246T47S.cjs +0 -1
  111. package/dist/chunk-KAXOGCGA.js +0 -1
  112. package/dist/chunk-LZLTN5A3.cjs +0 -1
  113. package/dist/chunk-NBCVVZOM.cjs +0 -1
  114. package/dist/chunk-O5INAWZQ.js +0 -1
  115. package/dist/chunk-OHAXVTWG.cjs +0 -1
  116. package/dist/chunk-S74GRBNE.js +0 -7
  117. package/dist/chunk-UBLUVNZR.js +0 -27
  118. package/dist/chunk-UMRSBLO7.js +0 -15
  119. package/dist/chunk-VIPMGGUT.js +0 -25
  120. package/dist/chunk-WG4KMSX2.cjs +0 -2
  121. package/dist/chunk-WRLKVNNR.cjs +0 -1
  122. package/dist/chunk-ZU7IVN6G.js +0 -2
  123. package/dist/failure-BIPVQbRm.d.ts +0 -65
  124. package/dist/revision-projection-CSNFudZY.d.ts +0 -242
package/dist/export.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkOHAXVTWG_cjs=require('./chunk-OHAXVTWG.cjs'),chunkHO5XFO32_cjs=require('./chunk-HO5XFO32.cjs'),chunkWRLKVNNR_cjs=require('./chunk-WRLKVNNR.cjs'),chunk55AT3MOU_cjs=require('./chunk-55AT3MOU.cjs'),chunkLZLTN5A3_cjs=require('./chunk-LZLTN5A3.cjs');require('./chunk-K246T47S.cjs');var chunkAVKVRU7Z_cjs=require('./chunk-AVKVRU7Z.cjs'),chunk4KZ6L5YF_cjs=require('./chunk-4KZ6L5YF.cjs');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:chunk55AT3MOU_cjs.n(g+Math.round(m.originX*c)),originY:chunk55AT3MOU_cjs.n(Math.round(m.originY*c)),offsetX:chunk55AT3MOU_cjs.n(Math.round(m.offsetX*c)),offsetY:chunk55AT3MOU_cjs.n(Math.round(m.offsetY*c)),advanceX:chunk55AT3MOU_cjs.n(Math.round(m.advanceX*c)),advanceY:chunk55AT3MOU_cjs.n(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=chunk55AT3MOU_cjs.n(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:chunk55AT3MOU_cjs.n(A.advance+T),caretEdges:[chunk55AT3MOU_cjs.n(0),chunk55AT3MOU_cjs.n(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=>chunk55AT3MOU_cjs.n(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:chunk55AT3MOU_cjs.p({...o.environment,font:f})};return _(e,m,e.shape(m))},i=[],s=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.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.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=[],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:chunk55AT3MOU_cjs.n(u+m.originX),originY:chunk55AT3MOU_cjs.n(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.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 chunk55AT3MOU_cjs.s({...t,glyphs:a,clusters:p,fontSpans:l,exactAdvancesX:g&&d.length===a.length?d:void 0,metrics:{ascent:chunk55AT3MOU_cjs.n(y),descent:chunk55AT3MOU_cjs.n(R),lineGap:chunk55AT3MOU_cjs.n(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 chunk55AT3MOU_cjs.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 chunk55AT3MOU_cjs.d)),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)=>{let l=_(n,a,p);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:chunk55AT3MOU_cjs.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=chunk55AT3MOU_cjs.b;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:chunk55AT3MOU_cjs.i(e)})}function Jt(e,o){if(!e)return null;try{let t=e(o);return !t||t instanceof chunk55AT3MOU_cjs.d?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 chunk55AT3MOU_cjs.d||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 chunkOHAXVTWG_cjs.l))return true;let d=n(l.request.family);return r.has(d)||!i.has(d)},a=e.originFailures.some(({cause:l})=>l instanceof chunkOHAXVTWG_cjs.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 chunkWRLKVNNR_cjs.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=chunk55AT3MOU_cjs.h(r),s=o.get(i);if(!s){try{s=e.fonts.resolve(r);}catch{return null}o.set(i,s);}return s instanceof chunk55AT3MOU_cjs.d?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=chunk55AT3MOU_cjs.sa(n.style,n.fontSlot),i=chunk55AT3MOU_cjs.ic(n)?chunk55AT3MOU_cjs.jc(n):chunk55AT3MOU_cjs.$(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&&!chunkHO5XFO32_cjs.$(e.shaper,e.environment,a,r,t))return null;let p=chunkHO5XFO32_cjs._(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=chunk55AT3MOU_cjs.c;function xt(){if(M)return M;let e=(async()=>(await chunkHO5XFO32_cjs.d(),chunkHO5XFO32_cjs.h(chunkHO5XFO32_cjs.i)))();return M=e,e.catch(()=>{M===e&&(M=void 0);}),e}function Ft(e){let o=H();return chunkHO5XFO32_cjs.ba(e,{resolveFont(t){return yt(e,o,t)},fallback:chunk55AT3MOU_cjs.fa()})}async function Et(e,o,t=[],n=false){if(!chunkHO5XFO32_cjs.k(e))throw new TypeError("Session exporter shaping requires a prepared font handle");let r=await xt(),i=pt(await chunkHO5XFO32_cjs.r(e,r,chunkHO5XFO32_cjs.i,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:${chunk55AT3MOU_cjs.ea}`].join("|"),extensionFingerprint:e.fingerprint})}function eo(e,o){if(!chunkHO5XFO32_cjs.k(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=chunkHO5XFO32_cjs.m(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=chunkHO5XFO32_cjs.l(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 chunkHO5XFO32_cjs.r(e,d,chunkHO5XFO32_cjs.i,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:${chunk55AT3MOU_cjs.ea}`].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=chunk4KZ6L5YF_cjs.E(t);r.mode==="Internal"&&r.target.ok&&(n=o.parts.get(r.target.partName));}return n??=o.parts.get("/word/fontTable.xml"),chunk4KZ6L5YF_cjs.Ue(o,n)}function bt(e,o){let t=oo(e);if(t.length!==0)return chunkOHAXVTWG_cjs.j(n=>{let r=new Set((n.resolvedFaces??[]).map(s=>chunk55AT3MOU_cjs.h(s))),i=chunkOHAXVTWG_cjs.r(t,{maxFontBytes:chunk55AT3MOU_cjs.a,aggregateBudget:no(n),shadowedRequests:r});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?chunk55AT3MOU_cjs.c:Math.max(0,chunk55AT3MOU_cjs.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>chunk55AT3MOU_cjs.c)throw new chunkWRLKVNNR_cjs.d("layoutFailed",`Active document export font bytes are limited to ${chunk55AT3MOU_cjs.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===chunk4KZ6L5YF_cjs.fa||t.namespaceUri===""))?.value}async function so(e,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=chunkAVKVRU7Z_cjs.ab(e);if(!t.ok)return t;let{fonts:n,lastResortFonts:r,fontResolutionTimeoutMs:i,fontPolicy:s,onFontResolution:a,glyphFallbacks:p,documentLigatures:l,...d}=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 chunkWRLKVNNR_cjs.d&&E.code==="aborted")return {ok:false,reason:"aborted"};throw E}if(!c)throw y?.dispose(),new chunkWRLKVNNR_cjs.d("layoutFailed","Document font resolution completed without publishing its evidence");let R;try{R=chunkWRLKVNNR_cjs.e(t.view,{...d,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 chunkWRLKVNNR_cjs.d("aborted","Export resource settlement was aborted"):new chunkWRLKVNNR_cjs.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,t={}){if((t.glyphFallbacks?.length??0)>16)throw new RangeError("At most 16 glyph fallback faces are supported");let n=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);try{de(r.signal);let a=(async()=>{let p=io(t.onActiveFontBytesChange),l=!1;try{let d=po(e).slice(0,chunkOHAXVTWG_cjs.c),g=[],u={dropped:[]},c=bt(e,u),y=[...o,...c?[c]:[],...t.lastResortFonts??[]],R=await chunkOHAXVTWG_cjs.o(y,{families:[...new Set([...(t.glyphFallbacks??[]).map(x=>x.family),...d])].slice(0,chunkOHAXVTWG_cjs.c),defaultFamily:chunkOHAXVTWG_cjs.d.family,signal:r.signal},{onOriginFailure:x=>g.push(x),reserveOwnedBytes:p.reserve,maxExecutionFontBytes:chunkHO5XFO32_cjs.i.maxFontBytes});de(r.signal);let b=chunkOHAXVTWG_cjs.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=await Et(chunkHO5XFO32_cjs.o(b),void 0,t.glyphFallbacks,t.documentLigatures);de(r.signal);let h=te(d,b.defaultFont.family,g,f.resolveFont,u.dropped);return oe(h,t),ne(h,t,t.glyphFallbacks),l=!0,Object.freeze({...f,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 chunkWRLKVNNR_cjs.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=chunkLZLTN5A3_cjs.d(d,e.stylesRoot(),a,yo(d,g)),c=chunkOHAXVTWG_cjs.y(d,e.numberingRoot(),e.stylesRoot(),a);for(let y of [...u.direct,...xo(d),...c,...chunkOHAXVTWG_cjs.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=chunk4KZ6L5YF_cjs.Lg(e.currentPackage(),o);if(!t)return [];let n=new Set(chunk4KZ6L5YF_cjs.Mg(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=chunk4KZ6L5YF_cjs.kc(i),a=chunk4KZ6L5YF_cjs.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===chunk4KZ6L5YF_cjs.fa&&s.localName==="p"&&r.push({paragraph:s,context:a});let p=s.namespaceUri===chunk4KZ6L5YF_cjs.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=chunk55AT3MOU_cjs.zb(),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>=chunk4KZ6L5YF_cjs.oa||u.namespaceUri===chunk4KZ6L5YF_cjs.fa&&u.localName==="p")continue;let b=u.namespaceUri===chunk4KZ6L5YF_cjs.fa&&u.localName==="r"?u.id:c;if(u.namespaceUri===chunk4KZ6L5YF_cjs.fa&&u.localName==="fldSimple"){let f=ue(u,"instr")??"";chunk55AT3MOU_cjs.jd(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===chunk4KZ6L5YF_cjs.fa&&u.localName==="fldChar"){let f=ue(u,"fldCharType");if(f==="begin")chunk55AT3MOU_cjs.Cb(n),n.nesting===1&&(r=b,i=null,s="",a=false,p=false,l=chunk4KZ6L5YF_cjs.hf(u),d=0);else if(f==="separate"){let h=n.nesting===1;if(chunk55AT3MOU_cjs.Eb(n),h){let x=chunk55AT3MOU_cjs.Bb(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=chunk55AT3MOU_cjs.Bb(n);s=x.instruction,a=x.overflow||n.nestingOverflow;}if(!a&&chunk55AT3MOU_cjs.id(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);}}chunk55AT3MOU_cjs.Fb(n);}continue}if(u.namespaceUri===chunk4KZ6L5YF_cjs.fa&&(u.localName==="instrText"||u.localName==="delInstrText")){chunk55AT3MOU_cjs.Db(n,Lt(u),u.localName==="delInstrText");continue}n.nesting>0&&chunk55AT3MOU_cjs.Gb(n)&&u.namespaceUri===chunk4KZ6L5YF_cjs.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:chunk4KZ6L5YF_cjs.pa(u,R)});}}chunk55AT3MOU_cjs.Ab(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===chunk4KZ6L5YF_cjs.fa&&n.localName==="p")){if(n.namespaceUri===chunk4KZ6L5YF_cjs.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!==chunk4KZ6L5YF_cjs.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=chunkLZLTN5A3_cjs.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===mo&&t(chunk55AT3MOU_cjs.gc),i.namespaceUri===chunk4KZ6L5YF_cjs.fa&&i.localName==="sym"&&t(chunkLZLTN5A3_cjs.b(ao(i,"font"))),i.namespaceUri===chunk4KZ6L5YF_cjs.fa&&i.localName==="fldSimple"){let s=ue(i,"instr");t(chunk55AT3MOU_cjs.dd(s??"")?.font??null);}if(i.namespaceUri===chunk4KZ6L5YF_cjs.fa&&i.localName==="p")for(let s of chunkOHAXVTWG_cjs.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>chunk55AT3MOU_cjs.a)throw new TypeError(`maxBytes must not exceed ${chunk55AT3MOU_cjs.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
- Object.defineProperty(exports,"ExportResourceError",{enumerable:true,get:function(){return chunkWRLKVNNR_cjs.d}});Object.defineProperty(exports,"createNodeImageDecodePort",{enumerable:true,get:function(){return chunkWRLKVNNR_cjs.c}});Object.defineProperty(exports,"exportDestinationNamed",{enumerable:true,get:function(){return chunkWRLKVNNR_cjs.b}});Object.defineProperty(exports,"openDocumentForExport",{enumerable:true,get:function(){return chunkWRLKVNNR_cjs.e}});exports.MAX_SHARED_EXPORT_SHAPING_CONFIGURATIONS=le;exports.acquireSharedExportShaping=eo;exports.createPackagedFileFetch=Do;exports.hasExportAdmittedFont=ee;exports.hasExportLaidOutText=ie;exports.hasFontBackedExportCapabilities=ro;exports.openFontBackedDocumentForExport=so;
1
+ 'use strict';var chunkJLVBDYVQ_cjs=require('./chunk-JLVBDYVQ.cjs'),chunkD7ZMDMPX_cjs=require('./chunk-D7ZMDMPX.cjs'),chunkW35WTWAO_cjs=require('./chunk-W35WTWAO.cjs'),chunkDOHF6FA7_cjs=require('./chunk-DOHF6FA7.cjs'),chunkBY2ACZZ6_cjs=require('./chunk-BY2ACZZ6.cjs');require('./chunk-MM5QBMTE.cjs');var chunkT6K2QYNZ_cjs=require('./chunk-T6K2QYNZ.cjs'),chunkOSFOJTHU_cjs=require('./chunk-OSFOJTHU.cjs');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=[],b=[],R="",f=u.start;for(let x of u.text){let m=u.lower?x.toUpperCase():x;for(let E=0;E<m.length;E++)y.push(f),b.push(f+x.length);R+=m,f+=x.length;}let h=e.shape({...n,text:R}),F=a.length;for(let[x,m]of h.glyphs.entries()){let E=h.exactAdvancesX?.[x];E===void 0?d=false:l.push(E*c),a.push({...m,cluster:y[m.cluster]??u.start,originX:chunkDOHF6FA7_cjs.n(g+Math.round(m.originX*c)),originY:chunkDOHF6FA7_cjs.n(Math.round(m.originY*c)),offsetX:chunkDOHF6FA7_cjs.n(Math.round(m.offsetX*c)),offsetY:chunkDOHF6FA7_cjs.n(Math.round(m.offsetY*c)),advanceX:chunkDOHF6FA7_cjs.n(Math.round(m.advanceX*c)),advanceY:chunkDOHF6FA7_cjs.n(Math.round(m.advanceY*c)),drawScale:c});}for(let x of h.clusters){let m=y[x.textStart]??u.start,E=b[x.textEnd-1]??f,L=chunkDOHF6FA7_cjs.n(Math.round(x.advance*c)),A=p.at(-1);A&&A.textStart===m&&A.textEnd===E?p[p.length-1]={...A,glyphEnd:F+x.glyphEnd,advance:chunkDOHF6FA7_cjs.n(A.advance+L),caretEdges:[chunkDOHF6FA7_cjs.n(0),chunkDOHF6FA7_cjs.n(A.advance+L)]}:p.push({...x,textStart:m,textEnd:E,glyphStart:F+x.glyphStart,glyphEnd:F+x.glyphEnd,advance:L,caretEdges:x.caretEdges.map(V=>chunkDOHF6FA7_cjs.n(Math.round(V*c))),fontSpan:0});}g+=h.glyphs.reduce((x,m)=>x+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 ut=new WeakMap;function zt(e){let o=ut.get(e);return o===void 0&&(o=Xt(e.bytes,e.faceIndex),ut.set(e,o)),o}var jt=new Set(["COLR","CBDT","sbix"]),Ht=512;function Xt(e,o){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.byteLength<12)return false;let n=0;if(ct(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),Ht);for(let i=0;i<r;i++){let s=n+12+i*16;if(s+4>e.byteLength)return false;if(jt.has(ct(e,s)))return true}return false}function ct(e,o){return String.fromCharCode(e[o],e[o+1],e[o+2],e[o+3])}var Gt=/\p{Emoji_Presentation}|️/u;function Vt(e){return Gt.test(e)}function q(e,o){if(e.length<2)return e;let t=e.filter(zt);if(t.length===0||t.length===e.length)return e;let n=e.filter(r=>!t.includes(r));return Vt(o)?[...t,...n]:[...n,...t]}var Wt=2048;function pt(e,o,t,n){if(!t.clusters.length||t.clusters.length>Wt)return null;let r=(f,h)=>{let{context:F,...x}=o,m={...x,text:h,environment:chunkDOHF6FA7_cjs.p({...o.environment,font:f})};return _(e,m,e.shape(m))},i=[],s=new Map;for(let f of [...t.clusters].sort((h,F)=>h.textStart-F.textStart)){let h=o.environment.font,F=o.text.slice(f.textStart,f.textEnd),x=i.at(-1);if(/^[\uFE0E\uFE0F]$/.test(F)&&x&&x.end===f.textStart){x.end=f.textEnd;continue}if(o.environment.script==="Hebr"&&/^\s+$/u.test(F)&&x&&x.font!==o.environment.font&&x.end===f.textStart){x.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),L=s.get(F)??q(n,E).find(A=>{try{return !r(A,F).glyphs.some(V=>V.id===0)}catch{return false}});if(!L)return null;s.set(F,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=[],p=[],l=[],d=[],g=true,u=0,c=0,y=0,b=0,R=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 F=a.length,x=l.length;for(let m of h.glyphs)a.push({...m,cluster:f.start+m.cluster,originX:chunkDOHF6FA7_cjs.n(u+m.originX),originY:chunkDOHF6FA7_cjs.n(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.push({...m,textStart:f.start+m.textStart,textEnd:f.start+m.textEnd,glyphStart:F+m.glyphStart,glyphEnd:F+m.glyphEnd,fontSpan:x});h.glyphs.length&&l.push({font:f.font,glyphStart:F,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),b=Math.max(b,h.metrics.descent),R=Math.max(R,h.metrics.lineGap);}return chunkDOHF6FA7_cjs.s({...t,glyphs:a,clusters:p,fontSpans:l,exactAdvancesX:g&&d.length===a.length?d:void 0,metrics:{ascent:chunkDOHF6FA7_cjs.n(y),descent:chunkDOHF6FA7_cjs.n(b),lineGap:chunkDOHF6FA7_cjs.n(R)}},{...o.environment,fallbackOrder:n})}var Yt=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 "]]]),$t=512,ft=new WeakMap;function Kt(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,$t);c+=1){let y=s(g+2+c*6);y&&t.add(y);}return t}function Zt(e,o){let t=ft.get(e);return t||(t=Kt(e.bytes,e.faceIndex),ft.set(e,t)),(Yt.get(o)??[o.toLowerCase()]).some(r=>t.has(r))}function mt(e,o){let t=e.filter(n=>Zt(n,o));return t.length===0||t.length===e.length?e:[...t,...e.filter(n=>!t.includes(n))]}function Q(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 chunkDOHF6FA7_cjs.s({...i,text:o.text},o.environment)}catch{return t}}function yt(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 chunkDOHF6FA7_cjs.d)),n={shape(a){return Q(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,Q(e.shaper,a,p));return r.set(p,{input:a,run:d}),d}},s=(a,p)=>{let l=_(n,a,p);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=pt(n,a,l,t);if(d)return d}for(let d of mt(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:chunkDOHF6FA7_cjs.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 ee=chunkDOHF6FA7_cjs.b;function te(e){return typeof e.admittedFontFace=="function"}var Jt=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 ht=new WeakMap;function j(e){let o=ht.get(e);return o||ht.set(e,o=Qt(e)),o}function Qt(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 eo(e){return Object.freeze({...j(e),bytes:chunkDOHF6FA7_cjs.i(e)})}function to(e,o){if(!e)return null;try{let t=e(o);return !t||t instanceof chunkDOHF6FA7_cjs.d?null:eo(t)}catch{return null}}function gt(e){return o=>{if(e.status()!=="active")throw e.unavailable();return to(e.resolve(),o)}}function oo(e){return Object.freeze(e.slice(0,ee).map(o=>Object.freeze({request:z(o.request),partName:o.partName,reason:o.reason})))}function oe(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 Jt){let d=n?.({family:a,...l});!d||d instanceof chunkDOHF6FA7_cjs.d||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:oo(r)})}function ne(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 re(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 chunkJLVBDYVQ_cjs.l))return true;let d=n(l.request.family);return r.has(d)||!i.has(d)},a=e.originFailures.some(({cause:l})=>l instanceof chunkJLVBDYVQ_cjs.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 chunkW35WTWAO_cjs.d("layoutFailed",`Strict font policy refused export${p?`; incomplete families: ${p}`:"; a font origin failed"}`)}function H(){return new Map}function X(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=chunkDOHF6FA7_cjs.h(r),s=o.get(i);if(!s){try{s=e.fonts.resolve(r);}catch{return null}o.set(i,s);}return s instanceof chunkDOHF6FA7_cjs.d?null:s}function xt(e,o,t){let n=t.fontFamily??e.defaultFont.family;return X(e,o,n,t)}function ie(e){return typeof e.shapeLaidOutText=="function"}function no(e){for(let o of e){let t=o.codePointAt(0);if(t!==32&&(t<=255||t>=61440&&t<=61695))return false}return true}function ae(e){let o=H(),t=new WeakMap;return n=>{let r=chunkDOHF6FA7_cjs.ua(n.style,n.fontSlot),i=chunkDOHF6FA7_cjs.dd(n)?chunkDOHF6FA7_cjs.ed(n):chunkDOHF6FA7_cjs.ba(n.text,r);if(i.length===0)return null;let s=r.fontFamily??e.defaultFont.family,a=X(e,o,s,r)??(chunkOSFOJTHU_cjs.b(s)&&no(i)?X(e,o,e.defaultFont.family,r):null);if(!a)return null;try{if(r.smallCaps&&!chunkD7ZMDMPX_cjs.$(e.shaper,e.environment,a,r,t))return null;let p=chunkD7ZMDMPX_cjs._(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 Ft(e){return o=>{if(e.status()!=="active")throw e.unavailable();return e.shaping()?.shapeLaidOutText(o)??null}}var N=new Map,G=new WeakMap,se=0,M,le=32,Et=chunkDOHF6FA7_cjs.c;function bt(){if(M)return M;let e=(async()=>(await chunkD7ZMDMPX_cjs.d(),chunkD7ZMDMPX_cjs.h(chunkD7ZMDMPX_cjs.i)))();return M=e,e.catch(()=>{M===e&&(M=void 0);}),e}function Rt(e){let o=H();return chunkD7ZMDMPX_cjs.ba(e,{resolveFont(t){return xt(e,o,t)},fallback:chunkDOHF6FA7_cjs.ha()})}async function St(e,o,t=[],n=false){if(!chunkD7ZMDMPX_cjs.k(e))throw new TypeError("Session exporter shaping requires a prepared font handle");let r=await bt(),i=yt(await chunkD7ZMDMPX_cjs.r(e,r,chunkD7ZMDMPX_cjs.i,o,n),t);return Object.freeze({createMeasurer:()=>Rt(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:${chunkDOHF6FA7_cjs.ga}`].join("|"),extensionFingerprint:e.fingerprint})}function ro(e,o){if(!chunkD7ZMDMPX_cjs.k(e))return Promise.reject(new TypeError("Shared exporter shaping requires a prepared font handle"));let t=G.get(e);if(t)return t;let n=chunkD7ZMDMPX_cjs.m(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=chunkD7ZMDMPX_cjs.l(e).sources.reduce((d,g)=>d+(g.availability==="forbidden"?0:g.bytes.byteLength),0);if(se+p>Et)throw new RangeError(`Shared exporter shaping font bytes are limited to ${Et} process-wide`);se+=p;let l;try{let d=await bt();l=await chunkD7ZMDMPX_cjs.r(e,d,chunkD7ZMDMPX_cjs.i,o);}catch(d){throw se-=p,d}return Object.freeze({createMeasurer:()=>Rt(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:${chunkDOHF6FA7_cjs.ga}`].join("|"),extensionFingerprint:i}));return G.set(e,s),s.catch(()=>{G.get(e)===s&&G.delete(e);}),s}var io="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable";function ao(e){let o=e.currentPackage(),t=(o.relationships.get(o.mainDocumentPart)??[]).find(r=>r.type===io),n;if(t){let r=chunkOSFOJTHU_cjs.J(t);r.mode==="Internal"&&r.target.ok&&(n=o.parts.get(r.target.partName));}return n??=o.parts.get("/word/fontTable.xml"),chunkOSFOJTHU_cjs.if(o,n)}function Ot(e,o){let t=ao(e);if(t.length!==0)return chunkJLVBDYVQ_cjs.j(n=>{let r=new Set((n.resolvedFaces??[]).map(s=>chunkDOHF6FA7_cjs.h(s))),i=chunkJLVBDYVQ_cjs.C(t,{maxFontBytes:chunkDOHF6FA7_cjs.a,aggregateBudget:so(n),shadowedRequests:r});if(o)for(let s of i.dropped){if(o.dropped.length>=ee)break;o.dropped.push(s);}return {sources:i.sources}})}function so(e){let o=e.committedSourceBytes;return o===void 0||!Number.isSafeInteger(o)||o<=0?chunkDOHF6FA7_cjs.c:Math.max(0,chunkDOHF6FA7_cjs.c-o)}function lo(e){return te(e)&&ie(e)}var w=0,vt=Symbol("font-resolution-timeout");function uo(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>chunkDOHF6FA7_cjs.c)throw new chunkW35WTWAO_cjs.d("layoutFailed",`Active document export font bytes are limited to ${chunkDOHF6FA7_cjs.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 co(e,o){return e.attributes.find(t=>t.localName===o&&(t.namespaceUri===chunkOSFOJTHU_cjs.la||t.namespaceUri===""))?.value}async function po(e,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=chunkT6K2QYNZ_cjs.Ba(e);if(!t.ok)return t;let{fonts:n,lastResortFonts:r,fontResolutionTimeoutMs:i,fontPolicy:s,onFontResolution:a,glyphFallbacks:p,documentLigatures:l,...d}=o,g=Array.isArray(n)?n:[n],u=r===void 0?[]:Array.isArray(r)?r:[r],c,y;try{y=await fo(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 chunkW35WTWAO_cjs.d&&E.code==="aborted")return {ok:false,reason:"aborted"};throw E}if(!c)throw y?.dispose(),new chunkW35WTWAO_cjs.d("layoutFailed","Document font resolution completed without publishing its evidence");let b;try{b=chunkW35WTWAO_cjs.e(t.view,{...d,reuseAcrossRevisions:!1,...y?{measurer:y.createMeasurer(),producer:o.producer??y.producer}:o.producer?{producer:o.producer}:{}});}catch(E){throw y?.dispose(),E}if(!b.ok)return y?.dispose(),b;let R=b.session,f=y,h="active",F=()=>h==="aborted"?new chunkW35WTWAO_cjs.d("aborted","Export resource settlement was aborted"):new chunkW35WTWAO_cjs.d("disposed","Export session has been disposed"),x=E=>{if(h==="active"){h=E,o.signal?.removeEventListener("abort",m);try{R.dispose();}finally{f?.dispose(),f=void 0;}}},m=()=>x("aborted");return o.signal?.addEventListener("abort",m,{once:true}),o.signal?.aborted&&m(),{ok:true,session:Object.freeze({fontResolution:c,layout:()=>h==="active"?R.layout():Promise.reject(F()),layoutFor:E=>h==="active"?R.layoutFor(E):Promise.reject(F()),validatedImageBytes:E=>h==="active"?R.validatedImageBytes(E):null,admittedFontFace:gt({status:()=>h,unavailable:F,resolve:()=>f?.resolveFont}),shapeLaidOutText:Ft({status:()=>h,unavailable:F,shaping:()=>f}),dispose:()=>x("disposed")})}}async function fo(e,o,t={}){if((t.glyphFallbacks?.length??0)>16)throw new RangeError("At most 16 glyph fallback faces are supported");let n=mo(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(vt),n);try{de(r.signal);let a=(async()=>{let p=uo(t.onActiveFontBytesChange),l=!1;try{let d=ho(e).slice(0,chunkJLVBDYVQ_cjs.c),g=chunkJLVBDYVQ_cjs.x(e,d),u=[],c={dropped:[]},y=Ot(e,c),b=[...o,...y?[y]:[],...t.lastResortFonts??[]],R=await chunkJLVBDYVQ_cjs.o(b,{families:[...new Set([...(t.glyphFallbacks??[]).map(x=>x.family),...g.families])].slice(0,chunkJLVBDYVQ_cjs.c),defaultFamily:chunkJLVBDYVQ_cjs.d.family,signal:r.signal},{onOriginFailure:x=>u.push(x),reserveOwnedBytes:p.reserve,maxExecutionFontBytes:chunkD7ZMDMPX_cjs.i.maxFontBytes});de(r.signal);let f=chunkJLVBDYVQ_cjs.z(chunkJLVBDYVQ_cjs.f(R??{}),g);if(f.sources.length===0){let x=oe(d,f.defaultFont.family,u,void 0,c.dropped);ne(x,t),re(x,t,t.glyphFallbacks);return}let h=await St(chunkD7ZMDMPX_cjs.o(f),void 0,t.glyphFallbacks,t.documentLigatures);de(r.signal);let F=oe(d,f.defaultFont.family,u,h.resolveFont,c.dropped);return ne(F,t),re(F,t,t.glyphFallbacks),l=!0,Object.freeze({...h,dispose:p.release})}finally{l||p.release();}})();return await Promise.race([a,yo(r.signal)])}finally{clearTimeout(s),t.signal?.removeEventListener("abort",i);}}function mo(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 yo(e){return new Promise((o,t)=>{let n=()=>{t(wt(e));};e.aborted?n():e.addEventListener("abort",n,{once:true});})}function wt(e){let o=e.reason===vt;return new chunkW35WTWAO_cjs.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 wt(e)}function ho(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(...go(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=chunkBY2ACZZ6_cjs.e(d,e.stylesRoot(),a,Fo(d,g)),c=chunkJLVBDYVQ_cjs.v(d,e.numberingRoot(),e.stylesRoot(),a);for(let y of [...u.direct,...Ro(d),...c,...chunkJLVBDYVQ_cjs.s(d,e.stylesRoot(),a),...u.inherited]){let b=y.toLowerCase();p.has(b)||p.set(b,y);}};return l(o,"body"),l(t,"furniture"),l(n,"note"),[...p.values()]}function go(e,o){let t=chunkOSFOJTHU_cjs.ch(e.currentPackage(),o);if(!t)return [];let n=new Set(chunkOSFOJTHU_cjs.dh(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=chunkOSFOJTHU_cjs.zc(i),a=chunkOSFOJTHU_cjs.yc(i);(s==="separator"||s==="continuationSeparator"||a!==null&&n.has(a))&&r.push(i);}return r}var xo="http://schemas.openxmlformats.org/officeDocument/2006/math";function Fo(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===chunkOSFOJTHU_cjs.la&&s.localName==="p"&&r.push({paragraph:s,context:a});let p=s.namespaceUri===chunkOSFOJTHU_cjs.la&&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)Eo(s.paragraph,t,s.context);}return t}function Eo(e,o,t){let n=chunkDOHF6FA7_cjs.Vb(),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:b}=g.pop();if(b>=chunkOSFOJTHU_cjs.wa||u.namespaceUri===chunkOSFOJTHU_cjs.la&&u.localName==="p")continue;let R=u.namespaceUri===chunkOSFOJTHU_cjs.la&&u.localName==="r"?u.id:c;if(u.namespaceUri===chunkOSFOJTHU_cjs.la&&u.localName==="fldSimple"){let f=ue(u,"instr")??"";chunkDOHF6FA7_cjs.Yc(f,{allowPageFields:t==="body"||t==="furniture",allowRefFields:t==="body"||t==="note",allowPageRef:t==="body",allowAutonum:t==="body"||t==="note"})&&bo(u)!==D&&o.add(u.id);}if(u.namespaceUri===chunkOSFOJTHU_cjs.la&&u.localName==="fldChar"){let f=ue(u,"fldCharType");if(f==="begin")chunkDOHF6FA7_cjs.Yb(n),n.nesting===1&&(r=R,i=null,s="",a=false,p=false,l=chunkOSFOJTHU_cjs.Bf(u),d=0);else if(f==="separate"){let h=n.nesting===1;if(chunkDOHF6FA7_cjs._b(n),h){let F=chunkDOHF6FA7_cjs.Xb(n);s=F.instruction,a=F.overflow||n.nestingOverflow,i=R,p=true;}}else if(f==="end"){if(n.nesting===1){if(n.phase==="instruction"){let F=chunkDOHF6FA7_cjs.Xb(n);s=F.instruction,a=F.overflow||n.nestingOverflow;}if(!a&&chunkDOHF6FA7_cjs.Xc(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 F=i??r;F&&o.add(F);}}chunkDOHF6FA7_cjs.$b(n);}continue}if(u.namespaceUri===chunkOSFOJTHU_cjs.la&&(u.localName==="instrText"||u.localName==="delInstrText")){chunkDOHF6FA7_cjs.Zb(n,Dt(u),u.localName==="delInstrText");continue}n.nesting>0&&chunkDOHF6FA7_cjs.ac(n)&&u.namespaceUri===chunkOSFOJTHU_cjs.la&&At(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:R,visibility:y&Pt(u),containerDepth:chunkOSFOJTHU_cjs.xa(u,b)});}}chunkDOHF6FA7_cjs.Wb(n);}function At(e){return e.localName==="t"||e.localName==="delText"?Dt(e).length>0:e.localName==="sym"||e.localName==="tab"||e.localName==="br"}var ce=1,Tt=2,Lt=4,D=ce|Tt|Lt;function bo(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===chunkOSFOJTHU_cjs.la&&n.localName==="p")){if(n.namespaceUri===chunkOSFOJTHU_cjs.la&&At(n)&&(t|=r,t===D))return t;for(let i of n.children)i.kind!=="textValue"&&o.push({node:i,visibility:r&Pt(n)});}}return t}function Pt(e){return e.namespaceUri!==chunkOSFOJTHU_cjs.la?D:e.localName==="ins"||e.localName==="moveTo"?ce|Tt:e.localName==="del"||e.localName==="moveFrom"?ce|Lt:D}function Ro(e){let o=new Map,t=n=>{let r=chunkBY2ACZZ6_cjs.b(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===xo&&t(chunkDOHF6FA7_cjs.$c),i.namespaceUri===chunkOSFOJTHU_cjs.la&&i.localName==="sym"&&t(chunkBY2ACZZ6_cjs.c(co(i,"font"))),i.namespaceUri===chunkOSFOJTHU_cjs.la&&i.localName==="fldSimple"){let s=ue(i,"instr");t(chunkDOHF6FA7_cjs.Wc(s??"")?.font??null);}if(i.namespaceUri===chunkOSFOJTHU_cjs.la&&i.localName==="p")for(let s of chunkJLVBDYVQ_cjs.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 Dt(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 _t="FILE_TOO_LARGE",kt=8;function So(e){return typeof e=="object"&&e!==null}function Nt(e){if(!(!So(e)||typeof e.code!="string"))return e.code}function Mt(e){return e===""||e.toLowerCase()==="localhost"}function Oo(e){try{let o=decodeURIComponent(e);return o.includes("\0")?null:o}catch{return null}}function Ct(e){let o=Oo(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 Ut(e){let o=Ct(e);return o===null?null:o.endsWith("/")?o:`${o}/`}function vo(e){return e==="/"||/^\/[A-Za-z]:\/$/.test(e)}function wo(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(!Mt(o.host))throw new TypeError("trustedRoot must be a local file: URL");let t=Ut(o.pathname);if(t===null||vo(t))throw new TypeError("trustedRoot must be a directory inside the filesystem");let n=new URL("file:///");return n.pathname=t,n}function Ao(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 To(e){let o=Ao(e);if(o.length===0)throw new TypeError("trustedRoot must name at least one directory");if(o.length>kt)throw new TypeError(`trustedRoot must not exceed ${kt} directories`);return o.map(wo)}function Lo(e){if(!Number.isSafeInteger(e)||e<=0)throw new TypeError("maxBytes must be a positive safe integer");if(e>chunkDOHF6FA7_cjs.a)throw new TypeError(`maxBytes must not exceed ${chunkDOHF6FA7_cjs.a}`);return e}function Po(e,o){if(e.protocol!=="file:"||e.username!==""||e.password!==""||!Mt(e.host))return null;let t=Ct(e.pathname);if(t===null)return null;for(let n of o){let r=Ut(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 Do(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 ko(e,o,t){let n=t.relative(t.resolve(e),t.resolve(o));return n!==""&&!n.startsWith("..")&&!t.isAbsolute(n)}function It(e,o,t){return e.some(n=>ko(n,o,t))}async function Io(e,o){let t=[];for(let n of e)try{t.push(await o(n));}catch(r){if(Nt(r)==="ENOENT")continue;throw r}return t}function _o(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(!It(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(!It(await Io(l,i),y,p))throw Object.assign(new Error("packaged file is outside trustedRoot"),{code:"ENOENT"});let b=(await u.stat()).size;if(!Number.isSafeInteger(b)||b<0||b>n)throw Object.assign(new Error("packaged file exceeds maxBytes"),{code:_t});let R=new Uint8Array(b),f=0;for(;f<R.byteLength;){if(t?.aborted)throw t.reason;let{bytesRead:h}=await u.read(R,f,R.byteLength-f,f);if(h===0)break;f+=h;}if(t?.aborted)throw t.reason;return f===R.byteLength?R:R.slice(0,f)}catch(y){throw t?.aborted?t.reason:y}finally{t?.removeEventListener("abort",c),await u.close().catch(()=>{});}}}function No(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=To(e.trustedRoot),t=Lo(e.maxBytes),n=e.read??_o(o),r=e.networkFetch??fetch;return(async(i,s)=>{let a=s?.signal;if(a?.aborted)throw a.reason;let p=Do(i);if(p.protocol!=="file:")return r(p,s);let l=Po(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=Nt(c);if(y===_t)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
+ Object.defineProperty(exports,"ExportResourceError",{enumerable:true,get:function(){return chunkW35WTWAO_cjs.d}});Object.defineProperty(exports,"createNodeImageDecodePort",{enumerable:true,get:function(){return chunkW35WTWAO_cjs.c}});Object.defineProperty(exports,"exportDestinationNamed",{enumerable:true,get:function(){return chunkW35WTWAO_cjs.b}});Object.defineProperty(exports,"openDocumentForExport",{enumerable:true,get:function(){return chunkW35WTWAO_cjs.e}});exports.MAX_SHARED_EXPORT_SHAPING_CONFIGURATIONS=le;exports.acquireSharedExportShaping=ro;exports.createPackagedFileFetch=No;exports.hasExportAdmittedFont=te;exports.hasExportLaidOutText=ie;exports.hasFontBackedExportCapabilities=lo;exports.openFontBackedDocumentForExport=po;
package/dist/export.d.ts CHANGED
@@ -1,19 +1,28 @@
1
- import { a as ReviewDisplayMode, d as ResolvedRevisionMarkup, e as RevisionMarkupOptions } from './revision-projection-CSNFudZY.js';
2
- import { P as PreservedImageMime, I as ImageResourceLimits, S as SupportedImageMime, a as ImageDecodePort } from './image-resources-BDFxcu7W.js';
3
- import { S as SemanticLayout, o as SemanticReviewArtifactRecord, I as InlineDrawingRecord, A as AnchoredDrawingRecord, p as ListMarkerPictureRecord, T as TextMeasurer, n as FontRequest, q as FontSubstitution, r as ShapedRun, e as StyleSpanRecord } from './semantic-records-B9OolWGN.js';
4
- import { D as DocumentProperties, H as HeadlessDocumentView, a as HeadlessDocumentRejection } from './headless-document-view-ICYqNkQ1.js';
5
- import { P as PreparedLayoutFontConfiguration, L as LayoutShapingInstrumentation } from './layout-shaping-BvZD_VKP.js';
6
- import { F as FontOriginFailure, a as FontOrigin } from './font-resolver-DN0xNOf_.js';
7
- import './types-barrel-BFKR8Pzp.js';
8
- import './editor-scope-OHPwVQ5l.js';
9
- import './omml-equation-DuczgG5o.js';
10
- import './tree-package-fragment-DYZIk1rY.js';
11
- import './editor-B3OBYNrF.js';
1
+ /**
2
+ * `@docx-editor.dev/core/export` — DOM-free semantic export sessions and shared resources.
3
+ *
4
+ * Exporters consume the same published `SemanticLayout` records as the browser painter.
5
+ * They do not parse OOXML or independently derive document semantics.
6
+ *
7
+ * @packageDocumentation
8
+ * @public
9
+ */
10
+ import { S as SemanticLayout, a as ReviewDisplayMode, q as ResolvedRevisionMarkup, r as SemanticReviewArtifactRecord, I as InlineDrawingRecord, A as AnchoredDrawingRecord, s as ListMarkerPictureRecord, t as RevisionMarkupOptions, T as TextMeasurer, p as FontRequest, u as FontSubstitution, v as ShapedRun, g as StyleSpanRecord } from './semantic-records-DQmumPgL.js';
11
+ import { P as PreservedImageMime, b as ImageResourceLimits, S as SupportedImageMime, c as ImageDecodePort } from './image-resources-tXLQShoC.js';
12
+ import { D as DocumentProperties, H as HeadlessDocumentView, a as HeadlessDocumentRejection } from './headless-document-view-pp3q7wIh.js';
13
+ import { P as PreparedLayoutFontConfiguration, L as LayoutShapingInstrumentation } from './layout-shaping-BD-dF_rn.js';
14
+ import { e as FontOriginFailure, d as FontOrigin } from './font-resolver-lSBLirLR.js';
15
+ import './types-barrel-DuC5QBNC.js';
16
+ import './editor-scope-7o9xweiJ.js';
17
+ import './omml-equation-BUbU0utM.js';
18
+ import './tree-package-store-CovjNARF.js';
19
+ import './editor-CZQZmTIU.js';
12
20
  import './contracts/document.js';
13
21
  import './contracts/interaction.js';
14
- import './semantic-interaction-G0bjmmmk.js';
15
- import './document-protection-9zpIHWTE.js';
16
- import './failure-BIPVQbRm.js';
22
+ import './semantic-interaction-kR_QB845.js';
23
+ import './document-protection-CUb55pl_.js';
24
+ import './failure-NS2lsya4.js';
25
+ import './diagnostic-hints-BeVjfNOv.js';
17
26
 
18
27
  /** Source content that cannot be certified by the layout snapshot. @public */
19
28
  interface ExportContentWarning {
package/dist/export.js CHANGED
@@ -1,2 +1,2 @@
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-IGR23DV2.js';import {j as j$1,l,k,q as q$1,h,n,c as c$2,g,_ as _$1,Z,aa}from'./chunk-JSIX2EOH.js';import'./chunk-RIYSCEFQ.js';import {d,e}from'./chunk-KAXOGCGA.js';export{d as ExportResourceError,c as createNodeImageDecodePort,b as exportDestinationNamed,e as openDocumentForExport}from'./chunk-KAXOGCGA.js';import {c,ea,sa,ic,jc as jc$1,$,fa,h as h$1,a,d as d$3,dd,b as b$1,i,zb,jd,Cb,Eb,Bb,id,Fb,Db,Gb,Ab,p,s,n as n$1,gc}from'./chunk-VIPMGGUT.js';import {d as d$2,b,a as a$1}from'./chunk-HAQ72KD7.js';import'./chunk-6ZQMII6V.js';import {ab}from'./chunk-GWQJ5774.js';import {Lg,Mg,kc,jc,fa as fa$1,E,Ue,oa,hf,pa}from'./chunk-UMRSBLO7.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=sa(n.style,n.fontSlot),i=ic(n)?jc$1(n):$(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 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:fa()})}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:${ea}`].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:${ea}`].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"),Ue(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$1||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=Lg(e.currentPackage(),o);if(!t)return [];let n=new Set(Mg(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$1&&s.localName==="p"&&r.push({paragraph:s,context:a});let p=s.namespaceUri===fa$1&&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=zb(),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$1&&u.localName==="p")continue;let b=u.namespaceUri===fa$1&&u.localName==="r"?u.id:c;if(u.namespaceUri===fa$1&&u.localName==="fldSimple"){let f=ue(u,"instr")??"";jd(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$1&&u.localName==="fldChar"){let f=ue(u,"fldCharType");if(f==="begin")Cb(n),n.nesting===1&&(r=b,i=null,s="",a=false,p=false,l=hf(u),d=0);else if(f==="separate"){let h=n.nesting===1;if(Eb(n),h){let x=Bb(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=Bb(n);s=x.instruction,a=x.overflow||n.nestingOverflow;}if(!a&&id(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);}}Fb(n);}continue}if(u.namespaceUri===fa$1&&(u.localName==="instrText"||u.localName==="delInstrText")){Db(n,Lt(u),u.localName==="delInstrText");continue}n.nesting>0&&Gb(n)&&u.namespaceUri===fa$1&&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)});}}Ab(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$1&&n.localName==="p")){if(n.namespaceUri===fa$1&&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$1?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(gc),i.namespaceUri===fa$1&&i.localName==="sym"&&t(b(ao(i,"font"))),i.namespaceUri===fa$1&&i.localName==="fldSimple"){let s=ue(i,"instr");t(dd(s??"")?.font??null);}if(i.namespaceUri===fa$1&&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
+ import {c as c$1,x,o,d as d$1,z as z$1,f,v,s,j as j$2,C,m,u,l as l$1}from'./chunk-236O4YQW.js';import {j as j$1,l,k,q as q$1,h,n,c as c$2,g,_ as _$1,Z,aa}from'./chunk-6ZQP4HQ7.js';import'./chunk-RIYSCEFQ.js';import {d,e}from'./chunk-E4LOMDNL.js';export{d as ExportResourceError,c as createNodeImageDecodePort,b as exportDestinationNamed,e as openDocumentForExport}from'./chunk-E4LOMDNL.js';import {c,ga,ua,dd,ed,ba,ha,h as h$1,a,d as d$2,Wc,b as b$1,i,Vb,Yc,Yb,_b,Xb,Xc,$b,Zb,ac,Wb,p,s as s$1,n as n$1,$c}from'./chunk-CPWLFPWC.js';import {e as e$1,c as c$3,b as b$2}from'./chunk-G4HOFIKJ.js';import'./chunk-LSZ6KPKK.js';import {Ba}from'./chunk-U4JZVSOE.js';import {ch,dh,zc,yc,b,la,J,if as _if,wa,Bf,xa}from'./chunk-YQ5G6LC7.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=[],b=[],R="",f=u.start;for(let x of u.text){let m=u.lower?x.toUpperCase():x;for(let E=0;E<m.length;E++)y.push(f),b.push(f+x.length);R+=m,f+=x.length;}let h=e.shape({...n,text:R}),F=a.length;for(let[x,m]of h.glyphs.entries()){let E=h.exactAdvancesX?.[x];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 x of h.clusters){let m=y[x.textStart]??u.start,E=b[x.textEnd-1]??f,L=n$1(Math.round(x.advance*c)),A=p.at(-1);A&&A.textStart===m&&A.textEnd===E?p[p.length-1]={...A,glyphEnd:F+x.glyphEnd,advance:n$1(A.advance+L),caretEdges:[n$1(0),n$1(A.advance+L)]}:p.push({...x,textStart:m,textEnd:E,glyphStart:F+x.glyphStart,glyphEnd:F+x.glyphEnd,advance:L,caretEdges:x.caretEdges.map(V=>n$1(Math.round(V*c))),fontSpan:0});}g+=h.glyphs.reduce((x,m)=>x+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 ut=new WeakMap;function zt(e){let o=ut.get(e);return o===void 0&&(o=Xt(e.bytes,e.faceIndex),ut.set(e,o)),o}var jt=new Set(["COLR","CBDT","sbix"]),Ht=512;function Xt(e,o){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.byteLength<12)return false;let n=0;if(ct(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),Ht);for(let i=0;i<r;i++){let s=n+12+i*16;if(s+4>e.byteLength)return false;if(jt.has(ct(e,s)))return true}return false}function ct(e,o){return String.fromCharCode(e[o],e[o+1],e[o+2],e[o+3])}var Gt=/\p{Emoji_Presentation}|️/u;function Vt(e){return Gt.test(e)}function q(e,o){if(e.length<2)return e;let t=e.filter(zt);if(t.length===0||t.length===e.length)return e;let n=e.filter(r=>!t.includes(r));return Vt(o)?[...t,...n]:[...n,...t]}var Wt=2048;function pt(e,o,t,n){if(!t.clusters.length||t.clusters.length>Wt)return null;let r=(f,h)=>{let{context:F,...x}=o,m={...x,text:h,environment:p({...o.environment,font:f})};return _(e,m,e.shape(m))},i=[],s=new Map;for(let f of [...t.clusters].sort((h,F)=>h.textStart-F.textStart)){let h=o.environment.font,F=o.text.slice(f.textStart,f.textEnd),x=i.at(-1);if(/^[\uFE0E\uFE0F]$/.test(F)&&x&&x.end===f.textStart){x.end=f.textEnd;continue}if(o.environment.script==="Hebr"&&/^\s+$/u.test(F)&&x&&x.font!==o.environment.font&&x.end===f.textStart){x.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),L=s.get(F)??q(n,E).find(A=>{try{return !r(A,F).glyphs.some(V=>V.id===0)}catch{return false}});if(!L)return null;s.set(F,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=[],p$1=[],l=[],d=[],g=true,u=0,c=0,y=0,b=0,R=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 F=a.length,x=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:F+m.glyphStart,glyphEnd:F+m.glyphEnd,fontSpan:x});h.glyphs.length&&l.push({font:f.font,glyphStart:F,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),b=Math.max(b,h.metrics.descent),R=Math.max(R,h.metrics.lineGap);}return s$1({...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(b),lineGap:n$1(R)}},{...o.environment,fallbackOrder:n})}var Yt=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 "]]]),$t=512,ft=new WeakMap;function Kt(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,$t);c+=1){let y=s(g+2+c*6);y&&t.add(y);}return t}function Zt(e,o){let t=ft.get(e);return t||(t=Kt(e.bytes,e.faceIndex),ft.set(e,t)),(Yt.get(o)??[o.toLowerCase()]).some(r=>t.has(r))}function mt(e,o){let t=e.filter(n=>Zt(n,o));return t.length===0||t.length===e.length?e:[...t,...e.filter(n=>!t.includes(n))]}function Q(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$1({...i,text:o.text},o.environment)}catch{return t}}function yt(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$2)),n={shape(a){return Q(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,Q(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=pt(n,a,l,t);if(d)return d}for(let d of mt(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 ee=b$1;function te(e){return typeof e.admittedFontFace=="function"}var Jt=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 ht=new WeakMap;function j(e){let o=ht.get(e);return o||ht.set(e,o=Qt(e)),o}function Qt(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 eo(e){return Object.freeze({...j(e),bytes:i(e)})}function to(e,o){if(!e)return null;try{let t=e(o);return !t||t instanceof d$2?null:eo(t)}catch{return null}}function gt(e){return o=>{if(e.status()!=="active")throw e.unavailable();return to(e.resolve(),o)}}function oo(e){return Object.freeze(e.slice(0,ee).map(o=>Object.freeze({request:z(o.request),partName:o.partName,reason:o.reason})))}function oe(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 Jt){let d=n?.({family:a,...l});!d||d instanceof d$2||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:oo(r)})}function ne(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 re(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 X(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$2?null:s}function xt(e,o,t){let n=t.fontFamily??e.defaultFont.family;return X(e,o,n,t)}function ie(e){return typeof e.shapeLaidOutText=="function"}function no(e){for(let o of e){let t=o.codePointAt(0);if(t!==32&&(t<=255||t>=61440&&t<=61695))return false}return true}function ae(e){let o=H(),t=new WeakMap;return n=>{let r=ua(n.style,n.fontSlot),i=dd(n)?ed(n):ba(n.text,r);if(i.length===0)return null;let s=r.fontFamily??e.defaultFont.family,a=X(e,o,s,r)??(b(s)&&no(i)?X(e,o,e.defaultFont.family,r):null);if(!a)return null;try{if(r.smallCaps&&!_$1(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 Ft(e){return o=>{if(e.status()!=="active")throw e.unavailable();return e.shaping()?.shapeLaidOutText(o)??null}}var N=new Map,G=new WeakMap,se=0,M,le=32,Et=c;function bt(){if(M)return M;let e=(async()=>(await c$2(),g(h)))();return M=e,e.catch(()=>{M===e&&(M=void 0);}),e}function Rt(e){let o=H();return aa(e,{resolveFont(t){return xt(e,o,t)},fallback:ha()})}async function St(e,o,t=[],n=false){if(!j$1(e))throw new TypeError("Session exporter shaping requires a prepared font handle");let r=await bt(),i=yt(await q$1(e,r,h,o,n),t);return Object.freeze({createMeasurer:()=>Rt(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:${ga}`].join("|"),extensionFingerprint:e.fingerprint})}function ro(e,o){if(!j$1(e))return Promise.reject(new TypeError("Shared exporter shaping requires a prepared font handle"));let t=G.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>Et)throw new RangeError(`Shared exporter shaping font bytes are limited to ${Et} process-wide`);se+=p;let l;try{let d=await bt();l=await q$1(e,d,h,o);}catch(d){throw se-=p,d}return Object.freeze({createMeasurer:()=>Rt(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:${ga}`].join("|"),extensionFingerprint:i}));return G.set(e,s),s.catch(()=>{G.get(e)===s&&G.delete(e);}),s}var io="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable";function ao(e){let o=e.currentPackage(),t=(o.relationships.get(o.mainDocumentPart)??[]).find(r=>r.type===io),n;if(t){let r=J(t);r.mode==="Internal"&&r.target.ok&&(n=o.parts.get(r.target.partName));}return n??=o.parts.get("/word/fontTable.xml"),_if(o,n)}function Ot(e,o){let t=ao(e);if(t.length!==0)return j$2(n=>{let r=new Set((n.resolvedFaces??[]).map(s=>h$1(s))),i=C(t,{maxFontBytes:a,aggregateBudget:so(n),shadowedRequests:r});if(o)for(let s of i.dropped){if(o.dropped.length>=ee)break;o.dropped.push(s);}return {sources:i.sources}})}function so(e){let o=e.committedSourceBytes;return o===void 0||!Number.isSafeInteger(o)||o<=0?c:Math.max(0,c-o)}function lo(e){return te(e)&&ie(e)}var w=0,vt=Symbol("font-resolution-timeout");function uo(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 co(e,o){return e.attributes.find(t=>t.localName===o&&(t.namespaceUri===la||t.namespaceUri===""))?.value}async function po(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=Ba(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 fo(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 b;try{b=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(!b.ok)return y?.dispose(),b;let R=b.session,f=y,h="active",F=()=>h==="aborted"?new d("aborted","Export resource settlement was aborted"):new d("disposed","Export session has been disposed"),x=E=>{if(h==="active"){h=E,o.signal?.removeEventListener("abort",m);try{R.dispose();}finally{f?.dispose(),f=void 0;}}},m=()=>x("aborted");return o.signal?.addEventListener("abort",m,{once:true}),o.signal?.aborted&&m(),{ok:true,session:Object.freeze({fontResolution:c,layout:()=>h==="active"?R.layout():Promise.reject(F()),layoutFor:E=>h==="active"?R.layoutFor(E):Promise.reject(F()),validatedImageBytes:E=>h==="active"?R.validatedImageBytes(E):null,admittedFontFace:gt({status:()=>h,unavailable:F,resolve:()=>f?.resolveFont}),shapeLaidOutText:Ft({status:()=>h,unavailable:F,shaping:()=>f}),dispose:()=>x("disposed")})}}async function fo(e,o$1,t={}){if((t.glyphFallbacks?.length??0)>16)throw new RangeError("At most 16 glyph fallback faces are supported");let n$1=mo(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(vt),n$1);try{de(r.signal);let a=(async()=>{let p=uo(t.onActiveFontBytesChange),l=!1;try{let d=ho(e).slice(0,c$1),g=x(e,d),u=[],c={dropped:[]},y=Ot(e,c),b=[...o$1,...y?[y]:[],...t.lastResortFonts??[]],R=await o(b,{families:[...new Set([...(t.glyphFallbacks??[]).map(x=>x.family),...g.families])].slice(0,c$1),defaultFamily:d$1.family,signal:r.signal},{onOriginFailure:x=>u.push(x),reserveOwnedBytes:p.reserve,maxExecutionFontBytes:h.maxFontBytes});de(r.signal);let f$1=z$1(f(R??{}),g);if(f$1.sources.length===0){let x=oe(d,f$1.defaultFont.family,u,void 0,c.dropped);ne(x,t),re(x,t,t.glyphFallbacks);return}let h$1=await St(n(f$1),void 0,t.glyphFallbacks,t.documentLigatures);de(r.signal);let F=oe(d,f$1.defaultFont.family,u,h$1.resolveFont,c.dropped);return ne(F,t),re(F,t,t.glyphFallbacks),l=!0,Object.freeze({...h$1,dispose:p.release})}finally{l||p.release();}})();return await Promise.race([a,yo(r.signal)])}finally{clearTimeout(s),t.signal?.removeEventListener("abort",i);}}function mo(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 yo(e){return new Promise((o,t)=>{let n=()=>{t(wt(e));};e.aborted?n():e.addEventListener("abort",n,{once:true});})}function wt(e){let o=e.reason===vt;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 wt(e)}function ho(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(...go(e,d));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},p=new Map,l=(d,g)=>{let u=e$1(d,e.stylesRoot(),a,Fo(d,g)),c=v(d,e.numberingRoot(),e.stylesRoot(),a);for(let y of [...u.direct,...Ro(d),...c,...s(d,e.stylesRoot(),a),...u.inherited]){let b=y.toLowerCase();p.has(b)||p.set(b,y);}};return l(o,"body"),l(t,"furniture"),l(n,"note"),[...p.values()]}function go(e,o){let t=ch(e.currentPackage(),o);if(!t)return [];let n=new Set(dh(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=zc(i),a=yc(i);(s==="separator"||s==="continuationSeparator"||a!==null&&n.has(a))&&r.push(i);}return r}var xo="http://schemas.openxmlformats.org/officeDocument/2006/math";function Fo(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===la&&s.localName==="p"&&r.push({paragraph:s,context:a});let p=s.namespaceUri===la&&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)Eo(s.paragraph,t,s.context);}return t}function Eo(e,o,t){let n=Vb(),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:b}=g.pop();if(b>=wa||u.namespaceUri===la&&u.localName==="p")continue;let R=u.namespaceUri===la&&u.localName==="r"?u.id:c;if(u.namespaceUri===la&&u.localName==="fldSimple"){let f=ue(u,"instr")??"";Yc(f,{allowPageFields:t==="body"||t==="furniture",allowRefFields:t==="body"||t==="note",allowPageRef:t==="body",allowAutonum:t==="body"||t==="note"})&&bo(u)!==D&&o.add(u.id);}if(u.namespaceUri===la&&u.localName==="fldChar"){let f=ue(u,"fldCharType");if(f==="begin")Yb(n),n.nesting===1&&(r=R,i=null,s="",a=false,p=false,l=Bf(u),d=0);else if(f==="separate"){let h=n.nesting===1;if(_b(n),h){let F=Xb(n);s=F.instruction,a=F.overflow||n.nestingOverflow,i=R,p=true;}}else if(f==="end"){if(n.nesting===1){if(n.phase==="instruction"){let F=Xb(n);s=F.instruction,a=F.overflow||n.nestingOverflow;}if(!a&&Xc(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 F=i??r;F&&o.add(F);}}$b(n);}continue}if(u.namespaceUri===la&&(u.localName==="instrText"||u.localName==="delInstrText")){Zb(n,Dt(u),u.localName==="delInstrText");continue}n.nesting>0&&ac(n)&&u.namespaceUri===la&&At(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:R,visibility:y&Pt(u),containerDepth:xa(u,b)});}}Wb(n);}function At(e){return e.localName==="t"||e.localName==="delText"?Dt(e).length>0:e.localName==="sym"||e.localName==="tab"||e.localName==="br"}var ce=1,Tt=2,Lt=4,D=ce|Tt|Lt;function bo(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===la&&n.localName==="p")){if(n.namespaceUri===la&&At(n)&&(t|=r,t===D))return t;for(let i of n.children)i.kind!=="textValue"&&o.push({node:i,visibility:r&Pt(n)});}}return t}function Pt(e){return e.namespaceUri!==la?D:e.localName==="ins"||e.localName==="moveTo"?ce|Tt:e.localName==="del"||e.localName==="moveFrom"?ce|Lt:D}function Ro(e){let o=new Map,t=n=>{let r=b$2(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===xo&&t($c),i.namespaceUri===la&&i.localName==="sym"&&t(c$3(co(i,"font"))),i.namespaceUri===la&&i.localName==="fldSimple"){let s=ue(i,"instr");t(Wc(s??"")?.font??null);}if(i.namespaceUri===la&&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 Dt(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 _t="FILE_TOO_LARGE",kt=8;function So(e){return typeof e=="object"&&e!==null}function Nt(e){if(!(!So(e)||typeof e.code!="string"))return e.code}function Mt(e){return e===""||e.toLowerCase()==="localhost"}function Oo(e){try{let o=decodeURIComponent(e);return o.includes("\0")?null:o}catch{return null}}function Ct(e){let o=Oo(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 Ut(e){let o=Ct(e);return o===null?null:o.endsWith("/")?o:`${o}/`}function vo(e){return e==="/"||/^\/[A-Za-z]:\/$/.test(e)}function wo(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(!Mt(o.host))throw new TypeError("trustedRoot must be a local file: URL");let t=Ut(o.pathname);if(t===null||vo(t))throw new TypeError("trustedRoot must be a directory inside the filesystem");let n=new URL("file:///");return n.pathname=t,n}function Ao(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 To(e){let o=Ao(e);if(o.length===0)throw new TypeError("trustedRoot must name at least one directory");if(o.length>kt)throw new TypeError(`trustedRoot must not exceed ${kt} directories`);return o.map(wo)}function Lo(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 Po(e,o){if(e.protocol!=="file:"||e.username!==""||e.password!==""||!Mt(e.host))return null;let t=Ct(e.pathname);if(t===null)return null;for(let n of o){let r=Ut(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 Do(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 ko(e,o,t){let n=t.relative(t.resolve(e),t.resolve(o));return n!==""&&!n.startsWith("..")&&!t.isAbsolute(n)}function It(e,o,t){return e.some(n=>ko(n,o,t))}async function Io(e,o){let t=[];for(let n of e)try{t.push(await o(n));}catch(r){if(Nt(r)==="ENOENT")continue;throw r}return t}function _o(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(!It(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(!It(await Io(l,i),y,p))throw Object.assign(new Error("packaged file is outside trustedRoot"),{code:"ENOENT"});let b=(await u.stat()).size;if(!Number.isSafeInteger(b)||b<0||b>n)throw Object.assign(new Error("packaged file exceeds maxBytes"),{code:_t});let R=new Uint8Array(b),f=0;for(;f<R.byteLength;){if(t?.aborted)throw t.reason;let{bytesRead:h}=await u.read(R,f,R.byteLength-f,f);if(h===0)break;f+=h;}if(t?.aborted)throw t.reason;return f===R.byteLength?R:R.slice(0,f)}catch(y){throw t?.aborted?t.reason:y}finally{t?.removeEventListener("abort",c),await u.close().catch(()=>{});}}}function No(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=To(e.trustedRoot),t=Lo(e.maxBytes),n=e.read??_o(o),r=e.networkFetch??fetch;return(async(i,s)=>{let a=s?.signal;if(a?.aborted)throw a.reason;let p=Do(i);if(p.protocol!=="file:")return r(p,s);let l=Po(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=Nt(c);if(y===_t)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,ro as acquireSharedExportShaping,No as createPackagedFileFetch,te as hasExportAdmittedFont,ie as hasExportLaidOutText,lo as hasFontBackedExportCapabilities,po as openFontBackedDocumentForExport};
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Lifecycle state of one collaboration replica.
3
+ *
4
+ * One axis, because the only question a host has to answer is whether to tell the reader to
5
+ * wait or to reload:
6
+ *
7
+ * - `initializing` — joining. Edits are refused. Recovers on its own.
8
+ * - `ready` — replicating. Accepts edits.
9
+ * - `disconnected` — the transport dropped. The replica is intact and recovers on its own,
10
+ * so wait rather than reload. Edits continue by default, and the buffered updates merge on
11
+ * reconnect. A session created with `offlineEditing: false` refuses them until reconnect.
12
+ * - `error` — this replica does not agree with the room. Edits are refused.
13
+ * {@link CollaborationStatusSnapshot.reason} says why. A remote update the replica could
14
+ * not apply yet heals when a later update completes shared state
15
+ * ({@link CollaborationStatusSnapshot.recovering}). A format or version mismatch needs an
16
+ * upgrade of this client or the room; every other cause needs a rejoin.
17
+ * - `destroyed` — torn down. Terminal.
18
+ *
19
+ * @public
20
+ */
21
+ type CollaborationStatus = 'initializing' | 'ready' | 'disconnected' | 'error' | 'destroyed';
22
+ /**
23
+ * Why a replica refused work, left `ready`, or failed a schema check.
24
+ *
25
+ * Free-form extras (a transport phrase, a blob key, a store refusal) travel in
26
+ * {@link CollaborationFailure.detail}, not here. Branch on the code; log the detail.
27
+ *
28
+ * Codes are grouped by cause, and each group comment names the host action. In `error`, only
29
+ * a remote update that is not applied yet, or one refused local edit, heals on its own. The
30
+ * failure codes table in the collaboration reference lists every code.
31
+ * `transport-disconnected` and `authentication-failed` need opposite answers: wait for the
32
+ * first; refresh the credential and rejoin for the second. `room-generation-changed` means
33
+ * the server compacted the room while this replica was away: save a copy if it holds unsent
34
+ * changes, then rejoin.
35
+ *
36
+ * @public
37
+ */
38
+ type CollaborationFailureCode =
39
+ /** Edit refused by the session gate. The status does not change. Wait for `ready`. */
40
+ 'collaboration-session-destroyed' | 'collaboration-session-not-attached' | 'collaboration-session-not-ready' | 'collaboration-text-limit' | 'experimental-collaboration-body-text-only'
41
+ /** Factory input rejected before joining. Fix the value the host passed. */
42
+ | 'invalid-document-id' | 'invalid-identity' | 'invalid-identity-color' | 'invalid-session-id'
43
+ /** Join or seed did not complete. Connect the provider, check the room id, and retry. */
44
+ | 'already-initialized' | 'document-id-mismatch' | 'initialization-aborted' | 'initialization-timeout' | 'not-initialized'
45
+ /** The seed document cannot seed a room. Fix the file. */
46
+ | 'baseline-too-large' | 'blob-read' | 'invalid-baseline' | 'missing-local-blob' | 'no-main-document-part'
47
+ /** This client and the room have different formats. Terminal. Save local work. */
48
+ | 'collaboration-format-mismatch' | 'protocol-version-mismatch' | 'schema-version-mismatch'
49
+ /** The room is unusable. Terminal. Create a new room from saved bytes. */
50
+ | 'blob-digest-mismatch' | 'concurrent-seed' | 'port-already-attached'
51
+ /** A remote update is not applied yet. Heals when a later update arrives. Wait. */
52
+ | 'duplicate-paragraph-id' | 'invalid-relationships' | 'materialize-dropped-content' | 'missing-blob' | 'missing-root' | 'remote-apply-failed' | 'unknown-paragraph-id'
53
+ /** Over a resource limit. A local edit realigns; shared state over a limit is terminal. */
54
+ | 'blob-store-full' | 'blob-too-large' | 'invalid-blob-descriptor' | 'invalid-bound' | 'invalid-logical-id' | 'invalid-string' | 'prototype-key' | 'text-too-long' | 'too-many-attributes' | 'too-many-children' | 'too-many-nodes' | 'too-many-parts' | 'too-many-relationships' | 'tree-too-deep' | 'unknown-logical-id' | 'unsafe-part-name'
55
+ /** Transport state. Only `transport-disconnected` recovers on its own. */
56
+ | 'authentication-failed' | 'room-generation-changed' | 'transport' | 'transport-disconnected'
57
+ /** Reserved for a room server that refuses a saved room. Passed through, never emitted. */
58
+ | 'invalid-saved-room' | 'saved-room-unavailable'
59
+ /** @deprecated Emitted by nothing. Kept for compatibility; do not branch on these. */
60
+ | 'baseline-digest-mismatch' | 'experimental-collaboration-existing-paragraphs-only' | 'experimental-collaboration-text-only' | 'experimental-collaboration-untracked-text-only' | 'immutable-baseline-changed' | 'immutable-metadata-changed' | 'invalid-shared-metadata' | 'local-mirror-failed' | 'paragraph-set-mismatch' | 'shared-schema-invalid' | 'unsupported-root-key';
61
+ /** True when `value` is a {@link CollaborationFailureCode} member. @public */
62
+ declare function isCollaborationFailureCode(value: string): value is CollaborationFailureCode;
63
+ /** One collaboration failure: a typed code plus optional free-form detail. @public */
64
+ interface CollaborationFailure {
65
+ /** Stable code for application logic. */
66
+ readonly code: CollaborationFailureCode;
67
+ /** Bounded diagnostic text for logs. Not a parsing contract. */
68
+ readonly detail?: string;
69
+ }
70
+ /**
71
+ * Cached status read. Same reference until one of its fields changes.
72
+ *
73
+ * @public
74
+ */
75
+ interface CollaborationStatusSnapshot {
76
+ /** Current lifecycle state. */
77
+ readonly status: CollaborationStatus;
78
+ /** Why the replica holds `status`, or `undefined` when nothing is wrong. */
79
+ readonly reason: CollaborationFailure | undefined;
80
+ /** The most recent `error` reason. Kept after the replica recovers. */
81
+ readonly lastFailure: CollaborationFailure | undefined;
82
+ /**
83
+ * How many failures this session has recorded. It changes with each new failure, also when
84
+ * its code and detail repeat the last one, as a refused edit refused again does. Absent
85
+ * from a session that does not count.
86
+ */
87
+ readonly failureCount?: number;
88
+ /**
89
+ * The session is in `error` but heals by itself: it realigns on the next clean update and
90
+ * returns to its previous status. A host shows a passing notice, not a rejoin action.
91
+ * Absent means false.
92
+ */
93
+ readonly recovering?: boolean;
94
+ /**
95
+ * Edits wait: the room sent an update that depends on one still on its way, and an edit
96
+ * made now could touch the text it changes. The editor refuses edits meanwhile, with
97
+ * `collaboration-session-not-ready`, and accepts them again when the update arrives or the
98
+ * wait times out. Absent means false.
99
+ */
100
+ readonly waiting?: boolean;
101
+ }
102
+ /** @internal */
103
+ interface CollaborationStatusTracker {
104
+ status(): CollaborationStatus;
105
+ snapshot(): CollaborationStatusSnapshot;
106
+ /** `recovering` marks an `error` the session heals by itself. */
107
+ set(status: CollaborationStatus, code?: CollaborationFailureCode, detail?: string, recovering?: boolean): boolean;
108
+ /** Whether edits wait for the room; returns whether the snapshot changed. */
109
+ setWaiting(waiting: boolean): boolean;
110
+ }
111
+ /** @internal */
112
+ declare function createCollaborationStatusTracker(initial?: CollaborationStatus): CollaborationStatusTracker;
113
+
114
+ export { createCollaborationStatusTracker as d, isCollaborationFailureCode as i };
115
+ export type { CollaborationStatus as C, CollaborationStatusSnapshot as a, CollaborationFailureCode as b, CollaborationFailure as c };
@@ -1,4 +1,4 @@
1
- import { F as FontFaceRequest, a as FontConfiguration, b as FontSource, c as FontSourceSubstitution } from './editor-B3OBYNrF.js';
1
+ import { Q as FontFaceRequest, P as FontConfiguration, T as FontSource, U as FontSourceSubstitution } from './editor-CZQZmTIU.js';
2
2
 
3
3
  /**
4
4
  * A partial font configuration one origin contributes: sources, substitutions, or both.
@@ -252,5 +252,5 @@ interface ComposeFontOriginsOptions {
252
252
  */
253
253
  declare function composeFontOrigins(origins: readonly FontOrigin[], request: FontResolutionRequest, options?: ComposeFontOriginsOptions): Promise<FontConfigurationFragment | undefined>;
254
254
 
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 };
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 };
255
+ export { DEFAULT_FONT as D, FONT_RESOLVER_BRAND as F, WORD_DEFAULT_FONT as W, FONT_RESOLVER_MARK_KEY as a, composeFontConfiguration as i, composeFontOrigins as j, defineFontResolver as k, isFontResolver as l, MAX_RESOLVER_FAMILIES as m };
256
+ export type { ComposeFontOriginsOptions as C, MarkedFontResolver as M, FontConfigurationBase as b, FontConfigurationFragment as c, FontOrigin as d, FontOriginFailure as e, FontResolutionRequest as f, FontResolver as g, FontResolverMark as h };
@@ -1,5 +1,5 @@
1
- import { H as HeaderFooterParts, b as HeaderFooterSectionResolution, T as TreePackageStore } from './tree-package-fragment-DYZIk1rY.js';
2
- import { Q as OoxmlPackage, O as OoxmlPart, Z as OoxmlElement, Y as OoxmlPackageRejection } from './types-barrel-BFKR8Pzp.js';
1
+ import { H as HeaderFooterParts, b as HeaderFooterSectionResolution, T as TreePackageStore } from './tree-package-store-CovjNARF.js';
2
+ import { Q as OoxmlPackage, O as OoxmlPart, ak as OoxmlElement, aj as OoxmlPackageRejection } from './types-barrel-DuC5QBNC.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,12 @@
1
- import { a0 as DrawingProjection, Q as OoxmlPackage } from './types-barrel-BFKR8Pzp.js';
1
+ import { an as DrawingProjection, Q as OoxmlPackage } from './types-barrel-DuC5QBNC.js';
2
+
3
+ /** Opaque handle — bytes are reachable only through {@link mintValidatedImageBytes}. */
4
+ interface ValidatedImageBytesHandle {
5
+ readonly registryId: number;
6
+ readonly resourceKey: string;
7
+ readonly contentId: string;
8
+ readonly generation: number;
9
+ }
2
10
 
3
11
  /**
4
12
  * The engine's trust-boundary caps: recursion depth, element counts, and the rest.
@@ -54,14 +62,6 @@ declare const DEFAULT_IMAGE_RESOURCE_LIMITS: ImageResourceLimits;
54
62
  /** Resolve caller overrides into frozen image limits; hard ceilings cannot be raised. */
55
63
  declare function resolveImageResourceLimits(overrides?: Partial<ImageResourceLimits>): ImageResourceLimits;
56
64
 
57
- /** Opaque handle — bytes are reachable only through {@link mintValidatedImageBytes}. */
58
- interface ValidatedImageBytesHandle {
59
- readonly registryId: number;
60
- readonly resourceKey: string;
61
- readonly contentId: string;
62
- readonly generation: number;
63
- }
64
-
65
65
  /**
66
66
  * Raster media the decode port measures and any authoring path may write.
67
67
  *
@@ -208,4 +208,4 @@ declare function imageResourceLookupFor(pkg: OoxmlPackage, options: CreateImageR
208
208
  declare function createImageResourceCache(initialPkg: OoxmlPackage, options: CreateImageResourceCacheOptions): ImageResourceLookup;
209
209
 
210
210
  export { DEFAULT_IMAGE_RESOURCE_LIMITS as D, HARD_CEILINGS as H, MAX_SVG_SNIFF_BYTES as M, resolveSvgIntrinsicSize as d, DEFAULT_LIMITS as f, IMAGE_RESOURCE_HARD_CEILINGS as g, createImageResourceCache as j, hasBoundedSvgRoot as k, imageResourceLookupFor as l, liveDrawingReferenceCount as m, resolveLimits as n, validateGifHeader as o, validateJpegHeader as p, validatePngHeader as q, resolveImageResourceLimits as r, sniffImageMime as s, validateRasterHeader as v };
211
- export type { CreateImageResourceCacheOptions as C, ImageResourceLimits as I, PreservedImageMime as P, RenderableImageMime as R, SupportedImageMime as S, ValidatedImageBytesHandle as V, ImageDecodePort as a, ImageResourceState as b, VectorImageMime as c, ResourceLimits as e, ImageResourceLookup as h, ValidatedRasterHeader as i };
211
+ export type { CreateImageResourceCacheOptions as C, ImageResourceState as I, PreservedImageMime as P, RenderableImageMime as R, SupportedImageMime as S, ValidatedImageBytesHandle as V, VectorImageMime as a, ImageResourceLimits as b, ImageDecodePort as c, ResourceLimits as e, ImageResourceLookup as h, ValidatedRasterHeader as i };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkDGPA3TST_cjs=require('./chunk-DGPA3TST.cjs');require('./chunk-NBCVVZOM.cjs'),require('./chunk-WG4KMSX2.cjs');var chunkOHAXVTWG_cjs=require('./chunk-OHAXVTWG.cjs');require('./chunk-HO5XFO32.cjs'),require('./chunk-FQN4KSFL.cjs'),require('./chunk-WRLKVNNR.cjs'),require('./chunk-55AT3MOU.cjs'),require('./chunk-CWRBFNK5.cjs'),require('./chunk-LZLTN5A3.cjs'),require('./chunk-2GK7YQB2.cjs'),require('./chunk-K246T47S.cjs'),require('./chunk-AVKVRU7Z.cjs'),require('./chunk-BTQKU64Q.cjs'),require('./chunk-GVUOWHTO.cjs'),require('./chunk-4KZ6L5YF.cjs'),require('./chunk-UKVVUHZL.cjs');Object.defineProperty(exports,"CHROME_GROUPS",{enumerable:true,get:function(){return chunkDGPA3TST_cjs.wa}});Object.defineProperty(exports,"CHROME_MENUS",{enumerable:true,get:function(){return chunkDGPA3TST_cjs.Aa}});Object.defineProperty(exports,"ChromeExportError",{enumerable:true,get:function(){return chunkDGPA3TST_cjs.Mb}});Object.defineProperty(exports,"ChromePrintError",{enumerable:true,get:function(){return chunkDGPA3TST_cjs.Ob}});Object.defineProperty(exports,"bindHistoryGroup",{enumerable:true,get:function(){return chunkDGPA3TST_cjs.Cb}});Object.defineProperty(exports,"blankDocumentBytes",{enumerable:true,get:function(){return chunkDGPA3TST_cjs.d}});Object.defineProperty(exports,"chromeMenuSlots",{enumerable:true,get:function(){return chunkDGPA3TST_cjs.Ba}});Object.defineProperty(exports,"commandForSlot",{enumerable:true,get:function(){return chunkDGPA3TST_cjs.ja}});Object.defineProperty(exports,"commandForSlotValue",{enumerable:true,get:function(){return chunkDGPA3TST_cjs.la}});Object.defineProperty(exports,"createDocxEditor",{enumerable:true,get:function(){return chunkDGPA3TST_cjs.cb}});Object.defineProperty(exports,"createFontSource",{enumerable:true,get:function(){return chunkDGPA3TST_cjs.i}});Object.defineProperty(exports,"customFonts",{enumerable:true,get:function(){return chunkDGPA3TST_cjs.j}});Object.defineProperty(exports,"isChromePrintShortcut",{enumerable:true,get:function(){return chunkDGPA3TST_cjs.Pb}});Object.defineProperty(exports,"loadFonts",{enumerable:true,get:function(){return chunkDGPA3TST_cjs.h}});Object.defineProperty(exports,"runChromeExport",{enumerable:true,get:function(){return chunkDGPA3TST_cjs.Nb}});Object.defineProperty(exports,"runChromePrint",{enumerable:true,get:function(){return chunkDGPA3TST_cjs.Qb}});Object.defineProperty(exports,"runToolbarCommand",{enumerable:true,get:function(){return chunkDGPA3TST_cjs.ra}});Object.defineProperty(exports,"toolbarCommandState",{enumerable:true,get:function(){return chunkDGPA3TST_cjs.na}});Object.defineProperty(exports,"DEFAULT_FONT",{enumerable:true,get:function(){return chunkOHAXVTWG_cjs.d}});Object.defineProperty(exports,"FONT_RESOLVER_BRAND",{enumerable:true,get:function(){return chunkOHAXVTWG_cjs.i}});Object.defineProperty(exports,"FONT_RESOLVER_MARK_KEY",{enumerable:true,get:function(){return chunkOHAXVTWG_cjs.h}});Object.defineProperty(exports,"WORD_DEFAULT_FONT",{enumerable:true,get:function(){return chunkOHAXVTWG_cjs.e}});Object.defineProperty(exports,"composeFontConfiguration",{enumerable:true,get:function(){return chunkOHAXVTWG_cjs.f}});Object.defineProperty(exports,"composeFontOrigins",{enumerable:true,get:function(){return chunkOHAXVTWG_cjs.n}});Object.defineProperty(exports,"defineFontResolver",{enumerable:true,get:function(){return chunkOHAXVTWG_cjs.j}});Object.defineProperty(exports,"isFontResolver",{enumerable:true,get:function(){return chunkOHAXVTWG_cjs.k}});
1
+ 'use strict';var chunkG3K63G7P_cjs=require('./chunk-G3K63G7P.cjs');require('./chunk-V3N4SOAK.cjs'),require('./chunk-CAJEXXVG.cjs');var chunkJLVBDYVQ_cjs=require('./chunk-JLVBDYVQ.cjs');require('./chunk-D7ZMDMPX.cjs');var chunkEKLM7NWB_cjs=require('./chunk-EKLM7NWB.cjs');require('./chunk-W35WTWAO.cjs'),require('./chunk-DOHF6FA7.cjs'),require('./chunk-6JPL6ZAS.cjs'),require('./chunk-BY2ACZZ6.cjs'),require('./chunk-7WQ7AAHW.cjs'),require('./chunk-MM5QBMTE.cjs'),require('./chunk-T6K2QYNZ.cjs'),require('./chunk-BTQKU64Q.cjs'),require('./chunk-UHHYFIDT.cjs'),require('./chunk-OSFOJTHU.cjs'),require('./chunk-UKVVUHZL.cjs');var P=1;var O={acceptAllRevisions:true,acceptRevision:true,addComment:true,addRepeatingSectionItem:true,adjustIndent:true,applyFormatting:true,applyVariables:true,clearFormatting:true,commitTableColumnDividerResize:true,commitTableRightEdgeResize:true,convertAllNotes:true,convertNote:true,copy:true,copyFormatting:true,cut:true,deleteColumn:true,deleteImage:true,deleteNote:true,deleteRow:true,deleteTable:true,deleteText:true,editHeaderFooter:true,editTextFormField:true,exitHeaderFooter:true,insertBreak:true,insertColumn:true,insertContentControl:true,insertHyperlink:true,insertImage:true,insertNote:true,insertPageField:true,insertRow:true,insertTable:true,insertText:true,insertTextBox:true,insertToc:true,linkHeaderFooterToPrevious:true,mergeCells:true,mergeParagraphs:true,navigateReviewChange:true,openRevisionMarkupDialog:true,paste:true,pasteFormatting:true,pasteWithoutFormatting:true,proposeDeletion:true,proposeInsertion:true,proposeReplacement:true,redo:true,refreshToc:true,rejectAllRevisions:true,rejectRevision:true,removeContentControl:true,removeHeaderFooter:true,removeHyperlink:true,removeRepeatingSectionItem:true,removeTabMark:true,replaceAllMatches:true,replaceImage:true,replaceMatch:true,replaceText:true,replyComment:true,resolveAllReviewChanges:true,resolveComment:true,selectAll:true,selectTableRegion:true,setAlignment:true,setCellFill:true,setContentControlValue:true,setEditingMode:true,setHeaderFooterOptions:true,setImagePosition:true,setImageProperties:true,setImageWrapType:true,setIndent:true,setLineSpacing:true,setMarkAttr:true,setNoteProperties:true,setPageSetup:true,setParagraphDirection:true,setParagraphFormat:true,setParagraphSpacing:true,setParagraphStyle:true,setReviewChangesAuthor:true,setReviewDisplayMode:true,setSelection:true,setTableBorders:true,setTableCellVerticalAlignment:true,setTableProperties:true,setVariable:true,setWatermark:true,splitCell:true,splitParagraph:true,toggleDocumentProtection:true,toggleHeaderRow:true,toggleList:true,toggleMark:true,toggleParagraphMarks:true,toggleReviewPane:true,transformImage:true,undo:true,unlinkHeaderFooterFromPrevious:true};function T(){return Object.keys(O)}Object.defineProperty(exports,"CHROME_GROUPS",{enumerable:true,get:function(){return chunkG3K63G7P_cjs.Ta}});Object.defineProperty(exports,"CHROME_MENUS",{enumerable:true,get:function(){return chunkG3K63G7P_cjs.Xa}});Object.defineProperty(exports,"ChromeExportError",{enumerable:true,get:function(){return chunkG3K63G7P_cjs.qc}});Object.defineProperty(exports,"ChromePrintError",{enumerable:true,get:function(){return chunkG3K63G7P_cjs.sc}});Object.defineProperty(exports,"bindHistoryGroup",{enumerable:true,get:function(){return chunkG3K63G7P_cjs.gc}});Object.defineProperty(exports,"blankDocumentBytes",{enumerable:true,get:function(){return chunkG3K63G7P_cjs.g}});Object.defineProperty(exports,"chromeMenuSlots",{enumerable:true,get:function(){return chunkG3K63G7P_cjs.Ya}});Object.defineProperty(exports,"commandForSlot",{enumerable:true,get:function(){return chunkG3K63G7P_cjs.ma}});Object.defineProperty(exports,"commandForSlotValue",{enumerable:true,get:function(){return chunkG3K63G7P_cjs.oa}});Object.defineProperty(exports,"createDocxEditor",{enumerable:true,get:function(){return chunkG3K63G7P_cjs.Eb}});Object.defineProperty(exports,"createFontSource",{enumerable:true,get:function(){return chunkG3K63G7P_cjs.l}});Object.defineProperty(exports,"customFonts",{enumerable:true,get:function(){return chunkG3K63G7P_cjs.m}});Object.defineProperty(exports,"diagnosticCodeOfRefusal",{enumerable:true,get:function(){return chunkG3K63G7P_cjs.tb}});Object.defineProperty(exports,"isChromePrintShortcut",{enumerable:true,get:function(){return chunkG3K63G7P_cjs.tc}});Object.defineProperty(exports,"loadFonts",{enumerable:true,get:function(){return chunkG3K63G7P_cjs.k}});Object.defineProperty(exports,"runChromeExport",{enumerable:true,get:function(){return chunkG3K63G7P_cjs.rc}});Object.defineProperty(exports,"runChromePrint",{enumerable:true,get:function(){return chunkG3K63G7P_cjs.uc}});Object.defineProperty(exports,"runToolbarCommand",{enumerable:true,get:function(){return chunkG3K63G7P_cjs.ua}});Object.defineProperty(exports,"toolbarCommandState",{enumerable:true,get:function(){return chunkG3K63G7P_cjs.qa}});Object.defineProperty(exports,"DEFAULT_FONT",{enumerable:true,get:function(){return chunkJLVBDYVQ_cjs.d}});Object.defineProperty(exports,"FONT_RESOLVER_BRAND",{enumerable:true,get:function(){return chunkJLVBDYVQ_cjs.i}});Object.defineProperty(exports,"FONT_RESOLVER_MARK_KEY",{enumerable:true,get:function(){return chunkJLVBDYVQ_cjs.h}});Object.defineProperty(exports,"WORD_DEFAULT_FONT",{enumerable:true,get:function(){return chunkJLVBDYVQ_cjs.e}});Object.defineProperty(exports,"composeFontConfiguration",{enumerable:true,get:function(){return chunkJLVBDYVQ_cjs.f}});Object.defineProperty(exports,"composeFontOrigins",{enumerable:true,get:function(){return chunkJLVBDYVQ_cjs.n}});Object.defineProperty(exports,"defineFontResolver",{enumerable:true,get:function(){return chunkJLVBDYVQ_cjs.j}});Object.defineProperty(exports,"isFontResolver",{enumerable:true,get:function(){return chunkJLVBDYVQ_cjs.k}});Object.defineProperty(exports,"diagnosticCauses",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.x}});Object.defineProperty(exports,"diagnosticCodes",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.q}});Object.defineProperty(exports,"explainDiagnostic",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.p}});exports.DIAGNOSTIC_SCHEMA_VERSION=P;exports.diagnosticCommands=T;