@docx-editor.dev/core 2.26.0 → 2.27.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 (106) hide show
  1. package/dist/automation.cjs +1 -1
  2. package/dist/automation.d.ts +14 -10
  3. package/dist/automation.js +1 -1
  4. package/dist/binding.cjs +1 -1
  5. package/dist/binding.d.ts +8 -8
  6. package/dist/binding.js +1 -1
  7. package/dist/chunk-2GK7YQB2.cjs +2 -0
  8. package/dist/chunk-4KZ6L5YF.cjs +15 -0
  9. package/dist/chunk-55AT3MOU.cjs +25 -0
  10. package/dist/chunk-6ZQMII6V.js +1 -0
  11. package/dist/chunk-7IGCWG4H.js +2 -0
  12. package/dist/chunk-7MYITTAH.js +5 -0
  13. package/dist/chunk-AVKVRU7Z.cjs +5 -0
  14. package/dist/{chunk-7RJSH72J.cjs → chunk-CWRBFNK5.cjs} +5 -5
  15. package/dist/chunk-DGPA3TST.cjs +27 -0
  16. package/dist/{chunk-6SEIXJTX.js → chunk-DNXVNQEO.js} +1 -1
  17. package/dist/chunk-FQN4KSFL.cjs +7 -0
  18. package/dist/{chunk-ELQFXMJ5.cjs → chunk-GVUOWHTO.cjs} +1 -1
  19. package/dist/chunk-GWQJ5774.js +5 -0
  20. package/dist/{chunk-5BIASAN3.js → chunk-HAQ72KD7.js} +1 -1
  21. package/dist/{chunk-TKR2MXX4.cjs → chunk-HO5XFO32.cjs} +1 -1
  22. package/dist/{chunk-LWCI65EL.js → chunk-IGR23DV2.js} +1 -1
  23. package/dist/{chunk-EEAV3WIN.js → chunk-JSIX2EOH.js} +1 -1
  24. package/dist/{chunk-CYT3OQFZ.cjs → chunk-K246T47S.cjs} +1 -1
  25. package/dist/chunk-KAXOGCGA.js +1 -0
  26. package/dist/{chunk-AGKIHLWQ.cjs → chunk-LZLTN5A3.cjs} +1 -1
  27. package/dist/chunk-NBCVVZOM.cjs +1 -0
  28. package/dist/{chunk-AJCCS53D.js → chunk-O5INAWZQ.js} +1 -1
  29. package/dist/{chunk-LZDI4P6I.cjs → chunk-OHAXVTWG.cjs} +1 -1
  30. package/dist/chunk-S74GRBNE.js +7 -0
  31. package/dist/chunk-UBLUVNZR.js +27 -0
  32. package/dist/chunk-UMRSBLO7.js +15 -0
  33. package/dist/chunk-VIPMGGUT.js +25 -0
  34. package/dist/chunk-WG4KMSX2.cjs +2 -0
  35. package/dist/chunk-WRLKVNNR.cjs +1 -0
  36. package/dist/chunk-ZU7IVN6G.js +2 -0
  37. package/dist/collaboration/replication.cjs +1 -1
  38. package/dist/collaboration/replication.d.ts +14 -5
  39. package/dist/collaboration/replication.js +1 -1
  40. package/dist/collaboration.d.ts +3 -3
  41. package/dist/contracts/document.d.ts +2 -2
  42. package/dist/contracts/editor.d.ts +8 -8
  43. package/dist/contracts/modules.cjs +1 -1
  44. package/dist/contracts/modules.d.ts +20 -31
  45. package/dist/contracts/modules.js +1 -1
  46. package/dist/contracts/types.d.ts +1 -1
  47. package/dist/{custom-node-writes-Cy9imOjA.d.ts → custom-node-writes-Vzpq9I8_.d.ts} +2 -2
  48. package/dist/{document-protection-Bp19Ad4I.d.ts → document-protection-9zpIHWTE.d.ts} +1 -1
  49. package/dist/{editor-DYUlyKmb.d.ts → editor-B3OBYNrF.d.ts} +29 -34
  50. package/dist/editor.cjs +1 -1
  51. package/dist/editor.css +2 -2
  52. package/dist/editor.d.ts +28 -27
  53. package/dist/editor.js +1 -1
  54. package/dist/export.cjs +2 -2
  55. package/dist/export.d.ts +26 -14
  56. package/dist/export.js +1 -1
  57. package/dist/{font-resolver-u_nE0PI1.d.ts → font-resolver-DN0xNOf_.d.ts} +1 -1
  58. package/dist/{headless-document-view-R9bzzepb.d.ts → headless-document-view-ICYqNkQ1.d.ts} +2 -2
  59. package/dist/{image-resources-DfagDguq.d.ts → image-resources-BDFxcu7W.d.ts} +1 -1
  60. package/dist/{index-Docw8Dcb.d.ts → index-CkQVRJtJ.d.ts} +53 -21
  61. package/dist/index.cjs +1 -1
  62. package/dist/index.d.ts +18 -17
  63. package/dist/index.js +1 -1
  64. package/dist/{layout-shaping-DWitwY73.d.ts → layout-shaping-BvZD_VKP.d.ts} +1 -1
  65. package/dist/layout.cjs +1 -1
  66. package/dist/layout.d.ts +32 -196
  67. package/dist/layout.js +1 -1
  68. package/dist/{note-properties-CmfvOJsi.d.ts → note-properties-CkAk7g-n.d.ts} +1 -1
  69. package/dist/{omml-equation-CZ6IG2ja.d.ts → omml-equation-DuczgG5o.d.ts} +1 -1
  70. package/dist/output.cjs +1 -1
  71. package/dist/output.d.ts +8 -7
  72. package/dist/output.js +1 -1
  73. package/dist/{protocol-DniKeDb8.d.ts → protocol-aKYr8r3u.d.ts} +6 -5
  74. package/dist/{review-paragraph-order-Dc8Q6tfM.d.ts → review-paragraph-order-Ddj5d6rp.d.ts} +1 -1
  75. package/dist/{revision-projection-DfWxdBqA.d.ts → revision-projection-CSNFudZY.d.ts} +74 -3
  76. package/dist/{semantic-cell-selection-Dy_BmmpL.d.ts → semantic-cell-selection-DoqYCz_F.d.ts} +4 -4
  77. package/dist/{semantic-interaction-CvFAj0GR.d.ts → semantic-interaction-G0bjmmmk.d.ts} +1 -1
  78. package/dist/{semantic-paint-Bk9wIXdZ.d.ts → semantic-paint-CsMzF8-O.d.ts} +57 -5
  79. package/dist/semantic-record-queries-1du6lQqS.d.ts +177 -0
  80. package/dist/{semantic-records-COqi8pjP.d.ts → semantic-records-B9OolWGN.d.ts} +15 -5
  81. package/dist/store.cjs +1 -1
  82. package/dist/store.d.ts +22 -17
  83. package/dist/store.js +1 -1
  84. package/dist/{tree-package-fragment-YPyYC1aD.d.ts → tree-package-fragment-DYZIk1rY.d.ts} +3 -3
  85. package/dist/{tree-session-contract-AeY2v0x9.d.ts → tree-session-contract-DQVJOOkv.d.ts} +5 -5
  86. package/dist/{types-barrel-BO73JqHG.d.ts → types-barrel-BFKR8Pzp.d.ts} +134 -110
  87. package/package.json +3 -3
  88. package/dist/chunk-2BK4G4ZN.js +0 -2
  89. package/dist/chunk-2SJX44PC.cjs +0 -2
  90. package/dist/chunk-73PG6L2X.js +0 -1
  91. package/dist/chunk-AN6WM4X4.js +0 -2
  92. package/dist/chunk-ANZ44KQT.cjs +0 -12
  93. package/dist/chunk-DDGGSBAN.js +0 -12
  94. package/dist/chunk-EYK4K2J6.js +0 -1
  95. package/dist/chunk-JNTETUNZ.cjs +0 -1
  96. package/dist/chunk-L6V3IJ3S.js +0 -5
  97. package/dist/chunk-NS22DVWT.cjs +0 -2
  98. package/dist/chunk-QIE3YTU4.cjs +0 -2
  99. package/dist/chunk-QVBFPAGO.js +0 -5
  100. package/dist/chunk-RCCOLZEQ.js +0 -2
  101. package/dist/chunk-SUN62YU6.cjs +0 -5
  102. package/dist/chunk-TKQH7BNE.cjs +0 -1
  103. package/dist/chunk-UJL2GDIM.cjs +0 -25
  104. package/dist/chunk-WQTADNHK.cjs +0 -27
  105. package/dist/chunk-XSHXBJ2J.js +0 -25
  106. package/dist/chunk-YXZEBTDF.js +0 -27
@@ -1,3 +1,3 @@
1
- 'use strict';var chunkUJL2GDIM_cjs=require('./chunk-UJL2GDIM.cjs'),chunkSUN62YU6_cjs=require('./chunk-SUN62YU6.cjs'),chunkANZ44KQT_cjs=require('./chunk-ANZ44KQT.cjs');var Zn=(e,t,n)=>{let r=e<0n,o=r?-e:e,a=o/t,i=o%t;if(n!=="towardZero"){let d=i*2n;(d>t||d===t&&(n==="halfAwayFromZero"||n==="halfToEven"&&a%2n!==0n))&&(a+=1n);}let c=r?-a:a,s=Number(c);if(!Number.isSafeInteger(s))throw new RangeError("Shaped fixed-point value exceeds the safe integer range");return s},Ze=(e,t,n,r)=>{if(!Number.isSafeInteger(e))throw new RangeError("font units must be a safe integer");if(!Number.isSafeInteger(t)||t<=0)throw new RangeError("fixed-point denominator must be a positive safe integer");if(!Number.isSafeInteger(n)||n<0)throw new RangeError("fixed-point numerator must be a non-negative safe integer");if(e===0||n===0)return chunkUJL2GDIM_cjs.n(0);let o=e*n;if(Number.isSafeInteger(o)){let a=Math.abs(o),i=a%t,c=(a-i)/t;return r!=="towardZero"&&(i>t-i||i===t-i&&(r==="halfAwayFromZero"||r==="halfToEven"&&c%2!==0))&&(c+=1),chunkUJL2GDIM_cjs.n(c===0?0:o<0?-c:c)}return chunkUJL2GDIM_cjs.n(Zn(BigInt(e)*BigInt(n),BigInt(t),r))},Ut=(e,t,n,r)=>{if(!Number.isSafeInteger(t)||t<=0)throw new RangeError("font size must be a positive integer number of half points");if(t>Math.floor(Number.MAX_SAFE_INTEGER/n))throw new RangeError("font size and fixed-point scale product exceeds the safe integer range");let o=t*n,a=e*2;return i=>Ze(i,a,o,r)},Gt=(e,t,n)=>{let r=t*n,o=e*2;return a=>a*r/o};var Jn=4096,Wt=e=>typeof e=="number"?String(e):JSON.stringify(e)??typeof e,Te=class{constructor(t){this.onRestart=t;}onRestart;#e=new Map;keyOf(t,n){let r=chunkUJL2GDIM_cjs.r(n),o=this.#e.get(r);o===void 0&&(this.#e.size>=Jn&&(this.#e.clear(),this.onRestart()),o=this.#e.size,this.#e.set(r,o));let a=`${o}\0${Wt(t.fontSizeHalfPoints)}\0${Wt(t.bidiLevel)}\0`,i=t.context;return !i||i.before===""&&i.after===""?`${a}-${t.text}`:`${a}c${i.before.length},${i.after.length}\0${i.before}${i.after}${t.text}`}clear(){this.#e.clear();}};function Q(e){try{let t=new URL(e);return t.username!==""||t.password!==""||t.search!==""||t.hash!==""?`${t.protocol}//${t.host}${t.pathname}\u2026`:e}catch{let t=e.search(/[?#]/);return t===-1?e:`${e.slice(0,t)}\u2026`}}function Kt(e){return e.replace(/[a-z][a-z0-9+.-]*:\/\/[^\s"')]+/gi,t=>Q(t))}function tr(e){if(typeof e!="string"&&!(e instanceof URL))throw new TypeError(`setHarfBuzzWasmUrl: expected a string or URL, received ${typeof e}`);if(typeof e=="string"&&e.trim()==="")throw new TypeError("setHarfBuzzWasmUrl: expected a non-empty URL");throw new Error("setHarfBuzzWasmUrl is not supported by the CommonJS build, which loads the shaper from node_modules and finds its binary on disk. Import the ESM build instead.");}function Xt(e){return e instanceof Error&&/process\.getBuiltinModule/.test(e.message)}function Vt(e){return `the text shaper cannot start on this Node version: the ESM build reaches Node builtins through \`process.getBuiltinModule\`, added in Node 20.16.0 and 22.3.0. Upgrade Node; \`setHarfBuzzWasmUrl\` does not apply here. (${Kt(e instanceof Error?e.message:String(e))})`}function jt(e){let t=Kt(e instanceof Error?e.message:String(e));return `the HarfBuzz WASM binary could not be loaded from ${"its bundled location"}. If this bundler does not emit \`new URL(..., import.meta.url)\` assets (esbuild, Bun, and library builds that inline dynamic imports), serve \`@docx-editor.dev/core/harfbuzz.wasm\` yourself, point \`setHarfBuzzWasmUrl\` from '@docx-editor.dev/core/layout' at it before creating an editor, and reload the page. (${t})`}function Yt(e,t){let n=`expected HarfBuzz ${e}, loaded ${t}`;return `${n}. The bundled binary does not match this build of the engine.`}var q=Object.freeze({name:"HarfBuzz",version:"14.4.0"}),de=null,ce=null;function Qe(){return de?Promise.resolve():ce||(ce=import('harfbuzzjs').then(e=>{let t=e.versionString();if(t!==q.version)throw new T("shapingLibraryMismatch",{diagnostic:Yt(q.version,t)});de=e;}).catch(e=>{throw ce=null,e instanceof T?e:Xt(e)?new T("unsupportedRuntime",{diagnostic:Vt(e),cause:e}):new T("wasmUnavailable",{diagnostic:jt(e),cause:e})}),ce)}function nr(){return de!==null}function rr(){if(!de)throw new T("notInitialized",{diagnostic:"Call initializeHarfBuzz() before creating a text shaper"});return de}var T=class extends Error{name="HarfBuzzShapingError";code;limit;actual;diagnostic;constructor(t,n={}){super(`HarfBuzz shaping failed (${t})`,{cause:n.cause}),this.code=t,this.limit=n.limit,this.actual=n.actual,this.diagnostic=n.diagnostic;}},or=16*1024*1024,ar=1e6,ir=1e6,sr=1e6,cr=4,lr=512,dr=1024*1024,ur=16*1024*1024,pr=32*1024*1024,fr=64*1024*1024,yr=64*1024*1024,mr=1e6,hr=1e6,gr=1e6,Sr=64,br=4096,xr=4*1024*1024,Rr=64*1024*1024,Cr=64*1024*1024,Fr=256*1024*1024,vr=new Set(["COLR","CPAL","CBDT","CBLC","sbix","SVG "]),$t=["cmap","head","hhea","hmtx","maxp"],Er=(e,t)=>e[t]<<8|e[t+1],Lr=(e,t)=>e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3]>>>0,Tr=(e,t)=>String.fromCharCode(e[0],e[1],e[2],e[3])==="ttcf"?Lr(e,12+t*4):0,Ir=(e,t)=>{let n=Tr(e,t),r=Er(e,n+4),o=new Set;for(let a=0;a<r;a+=1){let i=n+12+a*16;o.add(String.fromCharCode(e[i],e[i+1],e[i+2],e[i+3]));}return o},Br=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),Or=(e,t)=>{let n=chunkUJL2GDIM_cjs.l(e,t);if(!n.valid)return n;let r=Ir(e,t);for(let o of $t)if(!r.has(o))return {valid:false,diagnostic:`missing required ${o} table`};return {valid:true}},et=Or,z=(e,t,n)=>{if(!Number.isSafeInteger(e)||e<=0||e>n)throw new RangeError(`${t} must be a positive safe integer no greater than ${n}`);return e},wr=(e,t,n)=>{if(t.length===0)return [];let r=[],o=0;for(;o<t.length;){let a=t[o].cluster,i=o+1,c=t[o].advanceX;for(;i<t.length&&t[i].cluster===a;)c+=t[i].advanceX,i+=1;let s=chunkUJL2GDIM_cjs.n(c);r.push({textStart:a,textEnd:n==="rtl"?t[o-1]?.cluster??e.length:t[i]?.cluster??e.length,glyphStart:o,glyphEnd:i,advance:s,caretEdges:Object.freeze([chunkUJL2GDIM_cjs.n(0),s]),fontSpan:0}),o=i;}return r},N=64,U=8,G=8,qt=32,tt=N+2*U,Ar=N+U+G,Pr=N+U+2*G,_r=N+U+G,Zt=N+8*U,Jt=N+8*G+U,Mr=N+6*G+U,zr=N+3*G+2*U,kr=N+3*G,ue=e=>N+e.length*Uint16Array.BYTES_PER_ELEMENT,nt=e=>_r+ue(e),le=e=>qt+e*U,Nr=(e,t)=>tt+ue(e)+Ar+nt(t),Dr=e=>Zt+ue(e)+le(e.length)+e.length*Jt,Hr=e=>{let t=new Set(e.glyphs.map(n=>n.outline));return Zt+ue(e.text)+le(e.glyphs.length)+e.glyphs.length*Jt+le(e.clusters.length)+e.clusters.length*Mr+e.clusters.reduce((n,r)=>n+le(r.caretEdges.length),0)+le(e.fontSpans.length)+e.fontSpans.length*zr+(e.exactAdvancesX===void 0?0:qt+e.exactAdvancesX.length*G)+kr+[...t].reduce((n,r)=>n+nt(r.path),0)},Ur=(e,t)=>tt+ue(e)+Pr+t,Je=class{#e;#p;#f;#y;#m;#R;#h;#l=0;#C;#g;#S;#c;#b;#d;#t;#o=new Map;#i=new Map;#s=new Map;#n=new Map;#F=new Te(()=>{this.#n.clear(),this.#r=0,this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"cleared",retainedBytes:0}));});#a=0;#r=0;#x=0;#u;constructor(t,n){this.#e=t,this.#p=z(n.maxFontBytes??or,"maximum font bytes",yr),this.#f=z(n.maxInputUtf16??ar,"maximum input UTF-16 code units",mr),this.#y=z(n.maxCodepoints??ir,"maximum input code points",hr),this.#m=z(n.maxGlyphs??sr,"maximum shaped glyphs",gr),this.#h=z(n.maxCachedFontBytes??64*1024*1024,"maximum cached font bytes",64*1024*1024),this.#R=z(n.maxCachedFaces??cr,"maximum cached faces",Sr),this.#C=z(n.maxCachedShapes??lr,"maximum cached shape results",br),this.#g=z(n.maxOutlineBytes??dr,"maximum outline bytes",xr),this.#S=z(n.maxCachedOutlineBytes??ur,"maximum cached outline bytes",Rr),this.#c=z(n.maxShapedRunBytes??pr,"maximum shaped run bytes",Cr),this.#b=z(n.maxCachedShapeBytes??fr,"maximum cached shape bytes",Fr),this.#d=n.instrumentation?.onFaceCacheEvent,this.#t=n.instrumentation,this.#u=new this.#e.Buffer;}dispose(){this.#o.clear(),this.#l=0,this.#i.clear(),this.#s.clear(),this.#n.clear(),this.#F.clear(),this.#a=0,this.#r=0,this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"cleared",retainedBytes:0})),this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"cleared",retainedBytes:0})),this.#u=void 0;}#E(t,n){let r=this.#o.get(t.identity);if(r)return this.#o.delete(t.identity),this.#o.set(t.identity,r),this.#d?.(Object.freeze({kind:"hit",identity:t.identity})),r;let o=chunkUJL2GDIM_cjs.j(t);for(let l of $t)if(!o.has(l))throw new T("malformedFont",{diagnostic:`missing required ${l} table`});this.#t?.onByteCopy?.();let a=new this.#e.Blob(Br(n)),i=new this.#e.Face(a,t.faceIndex),c=new this.#e.Font(i),s=c.hExtents();if(!Number.isSafeInteger(i.upem)||i.upem<=0||!Number.isSafeInteger(s.ascender)||!Number.isSafeInteger(s.descender)||!Number.isSafeInteger(s.lineGap))throw new T("malformedFont",{diagnostic:"invalid font units or horizontal metrics"});c.setScale(i.upem,i.upem);let d={identity:t.identity,blob:a,face:i,font:c,unitsPerEm:i.upem,byteLength:n.byteLength};if(n.byteLength<=this.#h){for(;this.#o.size>=this.#R||this.#l+n.byteLength>this.#h;){let l=this.#o.keys().next().value;if(l===void 0)break;this.#l-=this.#o.get(l).byteLength,this.#o.delete(l),this.#d?.(Object.freeze({kind:"evicted",identity:l}));}this.#o.set(t.identity,d),this.#l+=n.byteLength;}return this.#d?.(Object.freeze({kind:"created",identity:t.identity})),d}#L(t,n){let r=this.#i.get(t.identity)?.get(n);if(r)return this.#s.delete(r),this.#s.set(r,void 0),this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"hit",retainedBytes:this.#a})),r.outline;this.#t?.onOutlinePathCall?.();let o=t.font.glyphToPath(n),a=nt(o);if(a>this.#g)throw new T("outlineOverLimit",{limit:this.#g,actual:a});let i=Object.freeze({path:o,unitsPerEm:t.unitsPerEm}),c=Nr(t.identity,o)+3*tt+2*G;if(c>this.#S)return this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"skipped",retainedBytes:this.#a})),i;for(;this.#a+c>this.#S;){let l=this.#s.keys().next().value;if(l===void 0)break;this.#s.delete(l);let f=this.#i.get(l.identity);f.delete(l.glyphId),f.size===0&&this.#i.delete(l.identity),this.#a-=l.bytes,this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"evicted",retainedBytes:this.#a}));}let s=this.#i.get(t.identity);s||this.#i.set(t.identity,s=new Map);let d={outline:i,bytes:c,identity:t.identity,glyphId:n};return s.set(n,d),this.#s.set(d,void 0),this.#a+=c,this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"created",retainedBytes:this.#a})),i}#v(t){if(t.length>this.#f)throw new T("textOverLimit",{limit:this.#f,actual:t.length});let n=0;for(let r=0;r<t.length;){let o=t.codePointAt(r);if(r+=o>65535?2:1,n+=1,n>this.#y)throw new T("codepointsOverLimit",{limit:this.#y,actual:n})}}shape(t){if(!this.#u)throw new T("disposed");if(chunkUJL2GDIM_cjs.k(t.environment.font),t.environment.font.byteLength>this.#p)throw new T("fontOverLimit",{limit:this.#p,actual:t.environment.font.byteLength});this.#v(t.text);let n=Dr(t.text);if(n>this.#c)throw new T("shapedRunOverLimit",{limit:this.#c,actual:n});let r=chunkUJL2GDIM_cjs.p(t.environment),o=this.#F.keyOf(t,r),a=this.#n.get(o);if(a)return this.#x-a.stamp>=Math.max(1,this.#n.size>>1)&&(this.#n.delete(o),this.#n.set(o,a),a.stamp=++this.#x),this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"hit",retainedBytes:this.#r})),a.run;if(this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"miss",retainedBytes:this.#r})),r.shapingLibrary.name!==q.name||r.shapingLibrary.version!==q.version)throw new T("shapingLibraryMismatch");if(r.normalization!=="none")throw new T("unsupportedNormalization");if(!Number.isSafeInteger(t.bidiLevel)||t.bidiLevel<0||(t.bidiLevel&1)===1!=(r.direction==="rtl"))throw new T("invalidBidiLevel");if(Object.keys(r.variationAxes).length>0)throw new T("unsupportedVariationAxes");if(r.fallbackOrder.length>0)throw new T("unsupportedFallback");let i=chunkUJL2GDIM_cjs.i(r.font),c=chunkUJL2GDIM_cjs.j(r.font);if([...vr].some(y=>c.has(y))&&!c.has("glyf")&&!c.has("CFF "))throw new T("unsupportedColorFont");let s=t.text;this.#v(s);let d=t.context?.before??"",l=t.context?.after??"",f=chunkUJL2GDIM_cjs.o,h=Math.max(String(d).length,String(l).length);if(typeof d!="string"||typeof l!="string"||h>f)throw new T("textOverLimit",{limit:f,actual:h});try{let y=this.#E(r.font,i),{face:b,font:x}=y,m=this.#u;m.reset(),d||l?m.addText(d+s+l,d.length,s.length):m.addText(s),m.setDirection(r.direction==="rtl"?this.#e.Direction.RTL:this.#e.Direction.LTR),m.setScript(r.script),m.setLanguage(r.language),m.setClusterLevel(this.#e.ClusterLevel.MONOTONE_CHARACTERS);let g=Object.entries(r.features).map(([O,H])=>new this.#e.Feature(O,H));this.#t?.onShapeCall?.(),this.#e.shape(x,m,g);let S=m.getLength();if(S>this.#m)throw new T("glyphOverLimit",{limit:this.#m,actual:S});let C=m.getGlyphInfos(),v=m.getGlyphPositions(),F=Ut(b.upem,t.fontSizeHalfPoints,r.fixedPointScale,r.roundingMode),B=Gt(b.upem,t.fontSizeHalfPoints,r.fixedPointScale),p=[],u=chunkUJL2GDIM_cjs.n(0),R=chunkUJL2GDIM_cjs.n(0),E=new Map,L=C.map((O,H)=>{let re=v[H];p.push(B(re?.xAdvance??0));let yt=F(re?.xAdvance??0),mt=F(re?.yAdvance??0),qn={id:O.codepoint,cluster:O.cluster-d.length,originX:u,originY:R,advanceX:yt,advanceY:mt,offsetX:F(re?.xOffset??0),offsetY:F(re?.yOffset??0),outline:E.get(O.codepoint)??(()=>{let ht=this.#L(y,O.codepoint);return E.set(O.codepoint,ht),ht})()};return u=chunkUJL2GDIM_cjs.n(u+yt),R=chunkUJL2GDIM_cjs.n(R+mt),qn}),I=x.hExtents(),A=chunkUJL2GDIM_cjs.s({text:s,direction:r.direction,bidiLevel:t.bidiLevel,glyphs:L,exactAdvancesX:p,clusters:wr(s,L,r.direction),fontSpans:L.length===0?[]:[{glyphStart:0,glyphEnd:L.length,font:r.font,fallbackIndex:null}],metrics:{ascent:F(I.ascender),descent:F(-I.descender),lineGap:F(I.lineGap)}},r),w=Hr(A);if(w>this.#c)throw new T("shapedRunOverLimit",{limit:this.#c,actual:w});let M=Ur(o,w);if(M>this.#b)return this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"skipped",retainedBytes:this.#r})),A;for(;this.#n.size>=this.#C||this.#r+M>this.#b;){let O=this.#n.keys().next().value;if(O===void 0)break;let H=this.#n.get(O);this.#n.delete(O),this.#r-=H.bytes,this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"evicted",retainedBytes:this.#r}));}return this.#n.set(o,{run:A,bytes:M,stamp:++this.#x}),this.#r+=M,this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"stored",retainedBytes:this.#r})),A}catch(y){throw y instanceof T?y:new T("malformedFont",{diagnostic:y instanceof Error?y.message:"HarfBuzz shaping failed"})}}},rt=(e={})=>new Je(rr(),e);var ot=Object.freeze({maxFontBytes:16*1024*1024,maxInputUtf16:1e6,maxCodepoints:1e6,maxGlyphs:1e6,maxCachedFaces:32,maxCachedFontBytes:64*1024*1024,maxCachedShapes:512,maxOutlineBytes:1024*1024,maxCachedOutlineBytes:16*1024*1024,maxShapedRunBytes:32*1024*1024,maxCachedShapeBytes:64*1024*1024}),Pa=Object.freeze({...ot,maxCachedShapes:4096});function Qt(e){let t={maxFontBytes:e.maxFontBytes,maxInputUtf16:e.maxInputUtf16,maxCodepoints:e.maxCodepoints,maxGlyphs:e.maxGlyphs,maxOutlineBytes:e.maxOutlineBytes,maxShapedRunBytes:e.maxShapedRunBytes},n=["docx-editor-layout-harfbuzz-execution-policy",1,Object.entries(t).sort(([r],[o])=>r<o?-1:r>o?1:0).map(([r,o])=>Object.freeze([r,o]))];return `layout-shaper-policy:sha256:${chunkANZ44KQT_cjs.a(new TextEncoder().encode(JSON.stringify(n)))}`}var Gr=Object.freeze({}),en=chunkUJL2GDIM_cjs.b,Wr="16.0.0",Kr="none",Xr=1e3,Vr="halfToEven",rn="cluster-edges-only",jr="Latn",Yr=new Uint8Array(0);var W=class extends Error{code="overLimit";constructor(t){super(t),this.name="LayoutShapingConfigurationError";}};function $r(e,t){let n=e.epoch,r=e.maxFontBytes,o=e.sources,a=e.substitutions,i=e.defaultFont,c=e.language;if(!Number.isSafeInteger(r)||r<=0||r>chunkUJL2GDIM_cjs.a)throw new W(`Font byte ceiling must not exceed the engine hard maximum of ${chunkUJL2GDIM_cjs.a}`);let s=o.length,d=a?.length??0;if(s===0||s>chunkUJL2GDIM_cjs.b)throw new W(`Font source count must be between 1 and ${chunkUJL2GDIM_cjs.b}`);if(d>en)throw new W(`Font substitution count must not exceed ${en}`);let l=0,f=[];for(let b=0;b<s;b+=1){let x=o[b],m=x.request,g=x.availability,S=x.id,C=x.hash,v=x.faceIndex,F=g==="forbidden",B=F?Yr:x.bytes;if(!F){if(typeof S!="string"||S.length===0)throw new TypeError("Resolved font id must not be empty");let p;try{p=chunkUJL2GDIM_cjs.e(B);}catch{throw new W(`Font source ${S} must provide genuine bytes`)}if(p>r)throw new W(`Font source ${S} exceeds the per-font byte ceiling`);if(l+=p,l>chunkUJL2GDIM_cjs.c)throw new W(`Font sources exceed the aggregate byte ceiling of ${chunkUJL2GDIM_cjs.c}`)}f.push(t&&chunkUJL2GDIM_cjs.g(x)!==void 0?x:Object.freeze({request:Object.freeze({family:m.family,weight:m.weight,style:m.style}),id:S,bytes:B,hash:C,faceIndex:v,...g?{availability:g}:{}}));}let h;if(a){h=[];for(let b=0;b<d;b+=1){let x=a[b],m=x.from,g=x.to,S=x.lineMetrics;h.push(Object.freeze({from:Object.freeze({family:m.family,weight:m.weight,style:m.style}),to:Object.freeze({family:g.family,weight:g.weight,style:g.style}),...S?{lineMetrics:Object.freeze({heightEm:S.heightEm,baselineEm:S.baselineEm})}:{}}));}}let y={epoch:n,maxFontBytes:r,sources:Object.freeze(f),substitutions:h?Object.freeze(h):void 0,defaultFont:Object.freeze({family:i.family,sizeHalfPoints:i.sizeHalfPoints}),language:c};return Object.freeze(y)}function tn(e,t){let n=e.map((o,a)=>({value:o,index:a,key:chunkUJL2GDIM_cjs.h(t(o))})),r=new Set;for(let o of n){if(r.has(o.key))return e;r.add(o.key);}return n.sort((o,a)=>o.key<a.key?-1:o.key>a.key?1:o.index-a.index).map(({value:o})=>o)}function qr(e,t){let n={family:e.family},r={sizeHalfPoints:e.sizeHalfPoints};return {...n,...t?r:{}}}function nn(e,t){let n=s=>({family:s.family,weight:s.weight,style:s.style}),r=t?e.sources:tn(e.sources,s=>s.request),o=e.substitutions??[],a=t?o:tn(o,s=>s.from),i={sources:r.map(s=>{let d=s.availability??"available",l={request:n(s.request),availability:d};if(d==="forbidden")return {...l,...t?{id:s.id,faceIndex:s.faceIndex,declaredHash:s.hash}:{}};let f=chunkUJL2GDIM_cjs.g(s);if(f==null)throw new TypeError("Font configuration identity requires prepared source bytes");return {...l,...t?{id:s.id}:{},faceIndex:s.faceIndex,declaredHash:s.hash,actualHash:f,byteLength:s.bytes.byteLength}}),substitutions:a.map(s=>({from:n(s.from),to:n(s.to),lineMetrics:s.lineMetrics?{heightEm:s.lineMetrics.heightEm,baselineEm:s.lineMetrics.baselineEm}:null})),defaultFont:qr(e.defaultFont,t),language:e.language||"en"},c={epoch:e.epoch,maxFontBytes:e.maxFontBytes};return {version:1,...t?c:{},...i}}var Zr=Symbol("prepared-layout-font-configuration"),Ie=new WeakMap;function Jr(e){return Ie.has(e)}function Qr(e){let t=Ie.get(e);if(!t)throw new TypeError("Invalid prepared layout font configuration");return t.configuration}function Da(e){let t=Ie.get(e);if(!t)throw new TypeError("Invalid prepared layout font configuration");return t.sharedShapingFingerprint}function at(e,t){return on(e,t,false)}function Ha(e,t){return on(e,t,true)}function on(e,t,n){let r=$r(e,n),o=Object.freeze({epoch:r.epoch,maxFontBytes:r.maxFontBytes,sources:Object.freeze(r.sources.map(f=>n&&chunkUJL2GDIM_cjs.g(f)!==void 0?f:chunkUJL2GDIM_cjs.f(f,{onOwnedByteCopy:t?.onFontByteCopy,onHash:t?.onFontHash}))),substitutions:r.substitutions,defaultFont:r.defaultFont,language:r.language}),a=new TextEncoder,i=nn(o,true),c=a.encode(JSON.stringify(i)),s=nn(o,false),d=a.encode(JSON.stringify(s)),l=Object.freeze({[Zr]:true,fingerprint:`font-config:${chunkANZ44KQT_cjs.a(c)}`});return Ie.set(l,{configuration:o,sharedShapingFingerprint:`shared-font-config:${chunkANZ44KQT_cjs.a(d)}`}),l}function eo(e){return at(e).fingerprint}function to(e,t){let n=new TextEncoder().encode(JSON.stringify({version:1,environment:e,executionPolicy:Qt(t),ligatureCaretPolicy:rn,fallback:chunkUJL2GDIM_cjs.da}));return `shaping:${chunkANZ44KQT_cjs.a(n)}`}async function an(e,t,n,r,o=false){let i=Jr(e)?e:at(e,t),c=Qr(i),{epoch:s,maxFontBytes:d,sources:l,substitutions:f,defaultFont:h}=c,y=c.language||"en",b=i.fingerprint,x=chunkUJL2GDIM_cjs.m({epoch:s,maxFontBytes:d,resources:l,substitutions:f,validateFont:et,instrumentation:{onOwnedByteCopy:t?.onFontByteCopy,onHash:t?.onFontHash,onAdmission:t?.onFontAdmission}});await Qe();let m=Object.freeze({script:jr,variationAxes:Object.freeze({}),shapingLibrary:q,unicodeDataVersion:Wr,normalization:Kr,language:y,features:Gr,...o?{documentLigatures:true}:{},fixedPointScale:Xr,roundingMode:Vr});return Object.freeze({fonts:x,shaper:n??rt(r),defaultFont:h,environment:m,ligatureCaretPolicy:rn,operation:Object.freeze({resourceEpoch:x.epoch,configEpoch:s,extensionFingerprint:b,shapingHash:to(m,r),producerVersion:1})})}async function no(e,t){return an(e,t,void 0,ot)}async function Ua(e,t,n,r,o=false){return an(e,r,t,n,o)}function ro(e){e.shaper.dispose?.();}function it(e){let t=new Set([0,e.text.length]);for(let r of chunkUJL2GDIM_cjs.ja(e.text))t.add(r.utf16From),t.add(r.utf16To);let n=new Set([0,e.text.length]);for(let r of e.clusters)n.add(r.textStart),n.add(r.textEnd);return [...t].filter(r=>n.has(r)).sort((r,o)=>r-o)}function Be(e,t){return it(e).includes(t)}function oo(e,t){return Be(e,t)}function ao(e,t,n){return n>=t&&Be(e,t)&&Be(e,n)}function io(e){let t=chunkUJL2GDIM_cjs.ja(e.text);return it(e).map(n=>n===e.text.length?t.length:t.findIndex(r=>r.utf16From===n))}var ct="und";function dn(){return typeof Intl.Segmenter=="function"}function so(){let e=Intl.Segmenter;if(typeof e!="function")throw new Error(`Intl.Segmenter is required for word segmentation (locale: ${ct})`);return e}function un(){let e=new(so())(ct,{granularity:"word"});return {segment(t){let n=[];for(let r of e.segment(t)){let o=r.index,a=o+r.segment.length;n.push({utf16From:o,utf16To:a,wordLike:r.isWordLike===true});}return n}}}var co=/^[\p{L}\p{N}']$/u,lo=/^\s$/u;function sn(e){return co.test(e)}function cn(e){return lo.test(e)}function st(e,t,n,r){let o=e[t],a=e[n-1];return {utf16From:o.utf16From,utf16To:a.utf16To,wordLike:r}}function pn(e){let t=chunkUJL2GDIM_cjs.ja(e);if(t.length===0)return [];let n=[],r=0;for(;r<t.length;){let o=t[r];if(cn(o.text)){let a=r+1;for(;a<t.length&&cn(t[a].text);)a+=1;n.push(st(t,r,a,false)),r=a;continue}if(sn(o.text)){let a=r+1;for(;a<t.length&&sn(t[a].text);)a+=1;n.push(st(t,r,a,true)),r=a;continue}n.push(st(t,r,r+1,false)),r+=1;}return n}function fn(){return {segment:pn}}function yn(e={}){let t=e.isIntlAvailable??dn,n=e.createIntlBoundary??un,r=e.createFallbackBoundary??fn;if(!t())return r();try{return n()}catch{return r()}}var ln;function mn(){return ln??=yn(),ln}function uo(e,t=mn()){return t.segment(e)}function po(e,t){return t.map(n=>({graphemeFrom:chunkUJL2GDIM_cjs.na(e,n.utf16From),graphemeTo:chunkUJL2GDIM_cjs.na(e,n.utf16To),wordLike:n.wordLike}))}var hn={resourceEpoch:"resource-scoped",configEpoch:"coarse-gate",extensionFingerprint:"coarse-gate",shapingHash:"coarse-gate",producerVersion:"coarse-gate"},ut=Object.keys(hn),gn=ut.filter(e=>hn[e]==="coarse-gate"),Oe=(e,t)=>{if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`${t} must be a non-negative safe integer`)},ee=(e,t)=>{if(e.trim().length===0)throw new TypeError(`${t} must not be blank`)},fo={resourceEpoch:Oe,configEpoch:Oe,extensionFingerprint:ee,shapingHash:ee,producerVersion:Oe},yo=(e,t)=>{fo[t](e[t],t);},te=e=>{for(let t of ut)yo(e,t);return Object.freeze({resourceEpoch:e.resourceEpoch,configEpoch:e.configEpoch,extensionFingerprint:e.extensionFingerprint,shapingHash:e.shapingHash,producerVersion:e.producerVersion})},mo=(e,t)=>{let n=te(e),r=te(t),o=ut.filter(a=>n[a]!==r[a]);return o.length===0?Object.freeze({status:"current"}):Object.freeze({status:"restart",changed:Object.freeze(o)})},lt=e=>{let t=e.map(({key:n,fingerprint:r})=>(ee(n,"resource dependency key"),ee(r,"resource dependency fingerprint"),Object.freeze({key:n,fingerprint:r}))).sort((n,r)=>n.key<r.key?-1:n.key>r.key?1:0);for(let n=1;n<t.length;n+=1)if(t[n-1].key===t[n].key)throw new TypeError(`Duplicate resource dependency: ${t[n].key}`);return Object.freeze(t)},ho=e=>(Oe(e.revision,"revision"),ee(e.dependencyFingerprint,"dependencyFingerprint"),ee(e.inputFingerprint,"inputFingerprint"),Object.freeze({revision:e.revision,dependencyFingerprint:e.dependencyFingerprint,inputFingerprint:e.inputFingerprint,resourceDependencies:lt(e.resourceDependencies),...te(e)})),go=(e,t)=>{let n=lt(e),r=lt(t),o=Math.max(n.length,r.length);for(let a=0;a<o;a+=1){let i=n[a],c=r[a];if(i?.key!==c?.key||i?.fingerprint!==c?.fingerprint)return {hit:false,reason:"resource-changed",resourceKey:i?.key??c.key}}return null};function So(e,t){if(e.dependencyFingerprint!==t.dependencyFingerprint)return {hit:false,reason:"dependency-changed"};if(e.inputFingerprint!==t.inputFingerprint)return {hit:false,reason:"input-changed"};let n=go(e.resourceDependencies,t.resourceDependencies);if(n)return n;for(let r of gn)if(e[r]!==t[r])return {hit:false,reason:"epoch-changed",epoch:r};return null}var dt=class{entries=new Map;get(t,n){let r=this.entries.get(t);if(!r)return {hit:false,reason:"absent"};let o=So(r.provenance,n);return o||{hit:true,value:r.value,provenance:r.provenance}}set(t,n,r){this.entries.set(t,{value:n,provenance:ho(r)});}evictEpoch(t){let n=te(t),r=0;for(let[o,a]of this.entries){let i=a.provenance;gn.some(c=>i[c]!==n[c])&&(this.entries.delete(o),r+=1);}return r}evictResources(t,n){let r=te(t),o=this.evictEpoch(r);for(let[a,i]of this.entries)i.provenance.resourceDependencies.some(s=>n.get(s.key)!==s.fingerprint)&&(this.entries.delete(a),o+=1);return o}get size(){return this.entries.size}};function Sn(e){return e.projected===true?null:e.range}function xo(e,t,n){let{page:r,story:o,host:a,noteScopeId:i,noteAreaKind:c}=e,s=o==="header"||o==="footer"?d=>chunkUJL2GDIM_cjs.ta(d,e.origin,{x:r.box.x,y:r.box.y}):void 0;chunkUJL2GDIM_cjs.Ca(a,(d,l)=>{let{textboxDepth:f,textboxOwner:h,textboxPath:y,storyOrigin:b}=l,x=f===0?o:"textbox";for(let m of d.lines){let g=[...chunkUJL2GDIM_cjs.Ia(m)].sort((S,C)=>(t.get(S.paragraphId)??Number.MAX_SAFE_INTEGER)-(t.get(C.paragraphId)??Number.MAX_SAFE_INTEGER));for(let S of g)for(let C of S.spans)n({page:r,story:x,rootStory:o,root:e,storyOrigin:b,absoluteBox:Object.freeze({x:b.x+C.box.x,y:b.y+C.box.y,width:C.box.width,height:C.box.height}),noteScopeId:i,noteAreaKind:c,textboxDepth:f,textboxOwner:h,textboxPath:y,paragraph:d,paragraphId:S.paragraphId,line:m,span:C,sourceRange:Sn(C)});}},e.origin,s);}function Ro(e,t){let n=new Map(chunkUJL2GDIM_cjs.Pa(e).map((r,o)=>[r,o]));chunkUJL2GDIM_cjs.za(e,r=>xo(r,n,t));}var Fo=1,bn=4,j=Object.freeze({top:0,right:0,bottom:0,left:0}),xn=new WeakMap;function vo(e,t){let n=Eo(e);return n===j?t:chunkUJL2GDIM_cjs.eb(t,n)}function Eo(e){let t=e.vectorShape;if(!t)return j;let{cx:n,cy:r}=t.extentEmu;if(!(n>=0)||!(r>=0)||n===0&&r===0)return j;let o=xn.get(t);if(o||(o=Lo(t),xn.set(t,o)),o===j)return j;let a=e.paintBounds,i=e.geometry.contentBounds;if(!(a.width>0||i.width<=0)||!(a.height>0||i.height<=0))return j;let c=n>0?i.width/n:i.height/r,s=r>0?i.height/r:i.width/n,d=(f,h,y)=>{if(y<-1e-3)return 0;let b=f*h-Math.max(0,y);return Number.isFinite(b)&&b>0?b:0},l={left:d(o.left,c,i.x-a.x),top:d(o.top,s,i.y-a.y),right:d(o.right,c,a.x+a.width-(i.x+i.width)),bottom:d(o.bottom,s,a.y+a.height-(i.y+i.height))};return l.left||l.top||l.right||l.bottom?Object.freeze(l):j}function Lo(e){let{cx:t,cy:n}=e.extentEmu,r=0,o=0,a=t,i=n,c=(l,f)=>{r=Math.min(r,l),a=Math.max(a,l),o=Math.min(o,f),i=Math.max(i,f);},s=Fo,d=l=>l.x>=-s&&l.x<=t+s&&l.y>=-s&&l.y<=n+s;for(let l of e.components){if(l.strokeHex===null||l.strokeInset===true)continue;let f=Math.max(1,chunkUJL2GDIM_cjs.db(l.strokeWidthEmu))/2;l.subpathsEmu.forEach((h,y)=>{let b=l.subpathsClosed?.[y]!==false,x=To(h,b),m=b&&x.length>2?x.length:x.length-1,g=[];for(let C=0;C<m;C+=1){let v=x[C],F=x[(C+1)%x.length],B=Math.hypot(F.x-v.x,F.y-v.y),p={x:-(F.y-v.y)/B,y:(F.x-v.x)/B};if(g.push(p),!!Io(v,F,-s,t+s,-s,n+s))for(let u=0;u<2;u+=1){let R=K[u],E=v.x+(F.x-v.x)*R,L=v.y+(F.y-v.y)*R;c(E+p.x*f,L+p.y*f),c(E-p.x*f,L-p.y*f);}}let S=b&&x.length>2?g.length:g.length-1;for(let C=0;C<S;C+=1){let v=x[(C+1)%x.length];if(!d(v))continue;let F=g[C],B=g[(C+1)%g.length],p=1+F.x*B.x+F.y*B.y;if(p<2/(bn*bn))continue;let u=F.y*-B.x- -F.x*B.y;if(u===0)continue;let R=u>0?-1:1;c(v.x+R*(F.x+B.x)*f/p,v.y+R*(F.y+B.y)*f/p);}});for(let h of l.arrowheadsEmu??[])if(!(!h[0]||!d(h[0])))for(let y of h)c(y.x,y.y);}return r>=0&&o>=0&&a<=t&&i<=n?j:Object.freeze({left:-r,top:-o,right:a-t,bottom:i-n})}function To(e,t){let n=[];for(let a of e){let i=n[n.length-1];(!i||i.x!==a.x||i.y!==a.y)&&n.push(a);}let r=n[0],o=n[n.length-1];return t&&n.length>1&&r.x===o.x&&r.y===o.y&&n.pop(),n}var K=new Float64Array(2);function Io(e,t,n,r,o,a){let i=t.x-e.x,c=t.y-e.y;return K[0]=0,K[1]=1,we(-i,e.x-n)&&we(i,r-e.x)&&we(-c,e.y-o)&&we(c,a-e.y)}function we(e,t){if(e===0)return t>=0;let n=t/e;return e<0?K[0]=Math.max(K[0],n):K[1]=Math.min(K[1],n),K[0]<=K[1]}function D(e){return (e.kerningEnabled??e.kerningMinPt>0)&&e.kerningMinPt>0&&e.fontSizePt>=e.kerningMinPt}var vn="Calibri, Carlito, Helvetica, Arial, sans-serif",si=new Map([["calibri","Carlito"]]),Bo=65536,Oo=256;function Rn(e,t){return e===void 0?Math.max(1,Math.floor(t)):Number.isFinite(e)&&e>0?Math.max(1,Math.floor(e)):1}function Cn(e){let t=new Map,n=0;return {get(r){let o=t.get(r);if(o!==void 0)return t.delete(r),t.set(r,o),o},set(r,o){for(t.has(r)&&t.delete(r),t.set(r,o);t.size>e;){let a=t.keys().next();if(a.done)break;t.delete(a.value),n+=1;}},get size(){return t.size},get evictions(){return n}}}var Fn=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function En(e=null){return e!=null&&typeof e.measureText=="function"}function Ln(e={}){let t=e.scale??1;if(!(t>0)||!Number.isFinite(t))return null;let n=e.fallbackFamily??vn,r=e.context??null;if(!En(r))return null;let o=r,a=Cn(Rn(e.maxWidthEntries,Bo)),i=Cn(Rn(e.maxMetricsEntries,Oo)),c=e.fontAlias,s=l=>{let f=l.fontFamily&&Fn.test(l.fontFamily)?l.fontFamily:null,h=f?c?.(f):void 0,y=h&&Fn.test(h)?h:null,b=f?y?`"${y}", "${f}", ${n}`:`"${f}", ${n}`:n,x=l.bold?"bold":"normal",m=l.italic?"italic":"normal",g=l.smallCaps?"small-caps":"normal",S=l.fontSizePt*chunkUJL2GDIM_cjs.ca(l)*t;return `${m} ${g} ${x} ${S}px ${b}`},d=(l,f,h)=>l/t*(h.horizontalScalePercent/100)+f.length*h.characterSpacingPt;return {measure(l,f){if(l.length===0)return 0;let h=s(f),y=`${h}\0${D(f)}\0${l}`,b=a.get(y);if(b!==void 0)return d(b,l,f);o.font=h,"fontKerning"in o&&(o.fontKerning=D(f)?"normal":"none");let x=o.measureText(l).width;return a.set(y,x),d(x,l,f)},inkBounds(l,f){if(!l||l.length>2||f.shaping?.direction==="rtl"||chunkUJL2GDIM_cjs.ja(l).length!==1)return;o.font=s(f),"fontKerning"in o&&(o.fontKerning=D(f)?"normal":"none");let h=o.textAlign,y=o.direction,b;try{h!==void 0&&(o.textAlign="left"),y!==void 0&&(o.direction="ltr"),b=o.measureText(l);}finally{h!==void 0&&(o.textAlign=h),y!==void 0&&(o.direction=y);}let x=b.actualBoundingBoxLeft,m=b.actualBoundingBoxRight;if(x===void 0||m===void 0||!Number.isFinite(x)||!Number.isFinite(m))return;let g=f.horizontalScalePercent/(100*t);return {left:-x*g,right:m*g}},lineMetrics(l){let f=l.fontSizePt*chunkUJL2GDIM_cjs.ca(l),h=s(l),y=i.get(h);if(y)return y;let b=f*1.15,x=f*.8;o.font=h,"fontKerning"in o&&(o.fontKerning=D(l)?"normal":"none");let m=o.measureText("Hxg"),g=m.fontBoundingBoxAscent,S=m.fontBoundingBoxDescent;if(typeof g=="number"&&Number.isFinite(g)&&g>0&&(x=g/t,typeof S=="number"&&Number.isFinite(S)&&S>=0)){let v=(g+S)/t;v>0&&(b=Math.max(v,b));}b>0||(b=f*1.15);let C={height:b,baseline:x};return i.set(h,C),C}}}function wo(e=1,t={}){let n=Ln({...t,scale:t.scale??e});return n?{measurer:n,producer:t.fontAlias?"canvas-measurer+embedded":"canvas-measurer"}:{measurer:chunkUJL2GDIM_cjs.ea(),producer:"fixed-measurer"}}function Ao(e){let t;return n=>{t===void 0&&(t=chunkUJL2GDIM_cjs.ad(e.pages)?.hosts??null);let r=t?.get(n);return r?chunkUJL2GDIM_cjs._c(r.pageNumber,r.format):null}}function Tn(e,t){let n=chunkUJL2GDIM_cjs.Bc(e,t.displayMode??chunkUJL2GDIM_cjs.Ra),r=chunkUJL2GDIM_cjs.yc({numberingIndex:t.numberingIndex,styleCascade:t.styleCascade},n).listItems,o=t.package?{footnotesPart:chunkANZ44KQT_cjs.Ig(t.package,"footnote"),endnotesPart:chunkANZ44KQT_cjs.Ig(t.package,"endnote")}:void 0,a=chunkUJL2GDIM_cjs.Yc(n,r,o,t.package?chunkUJL2GDIM_cjs.Vc(t.package,e,n):void 0,t.displayMode??chunkUJL2GDIM_cjs.Ra);return {blocks:n,notes:o,context:a}}function In(e,t,n,r,o){for(let a of t){if(r.length>=chunkANZ44KQT_cjs.yi)return;if(n.tokenForParagraph(a.id)!==""&&chunkANZ44KQT_cjs.Bi(e,a.id)===null)for(let i of chunkANZ44KQT_cjs.Ai(a)){if(r.length>=chunkANZ44KQT_cjs.yi)return;if(!i.rewritable)continue;let c=chunkUJL2GDIM_cjs.qb(i.instruction);if(c===null)continue;let s=n.liveValueOf(i.fieldNodeId,c);if(s===null&&o&&n.pageRefProjectionOf){let d=n.pageRefProjectionOf(i.fieldNodeId,c);if(d){let l=o(d.targetParagraphId);l!==null&&l.length>0&&chunkUJL2GDIM_cjs.$c(d.calibration,d.cached,l,Number.NaN)&&(s=l);}}s===null||s===i.cachedText||s.length>chunkANZ44KQT_cjs.zi||s.includes("\r")||r.push({paragraphId:a.id,fieldNodeId:i.fieldNodeId,text:s});}}}function Po(e,t){let{blocks:n,context:r}=Tn(e,t);if(r===null)return null;let o=[];return In(e,chunkUJL2GDIM_cjs.wc(chunkUJL2GDIM_cjs.qc(n)),r,o,t.pageRefPageNumberOf),o.length===0?null:{op:"refreshFieldResults",updates:o}}function Si(e,t){let{notes:n,context:r}=Tn(e,t);if(r===null||n===void 0)return [];let o=[],a=[{noteKind:"footnote",notesPart:n.footnotesPart},{noteKind:"endnote",notesPart:n.endnotesPart}];for(let{noteKind:i,notesPart:c}of a){if(!c)continue;let s=[];for(let d of chunkUJL2GDIM_cjs.Wc(c,t.displayMode??chunkUJL2GDIM_cjs.Ra)){if(s.length>=chunkANZ44KQT_cjs.yi)break;In(c,chunkUJL2GDIM_cjs.wc(chunkUJL2GDIM_cjs.qc(d)),r,s);}s.length>0&&o.push({noteKind:i,op:{op:"refreshFieldResults",updates:s}});}return o}function _o(e){return e.box}function Bn(e,t){if(e.kind==="paragraph"){t.add(e.paragraphId);return}for(let n of e.rows)for(let r of n.cells)for(let o of r.blocks)Bn(o,t);}function Mo(e){let t=new Map,n=(o,a,i)=>{if(!(o.kind==="textValue"||i>chunkANZ44KQT_cjs.yb*4)){for(let c of o.children)if(c.kind!=="textValue"){if(c.kind==="paragraph"){for(let s of r)t.get(s)?.push(c.id);n(c,c.id,i+1);continue}if(c.kind==="contentControl"){t.set(c.id,[]),r.push(c.id);let s=chunkANZ44KQT_cjs.Ib(c);s&&n(s,a,i+1),r.pop();let d=t.get(c.id);d&&d.length===0&&a!==null&&d.push(a);continue}n(c,a,i+1);}}},r=[];return n(e,null,0),t}function zo(e,t){let n=Math.min(e.x,t.x),r=Math.min(e.y,t.y);return {x:n,y:r,width:Math.max(e.x+e.width,t.x+t.width)-n,height:Math.max(e.y+e.height,t.y+t.height)-r}}function ko(e,t){let n=chunkANZ44KQT_cjs.Mb(e.root);if(n.length===0)return No;let r=new Map;t.pages.forEach((i,c)=>{(d=>{for(let l of d){let f=new Set;Bn(l,f);for(let h of f){let y=r.get(h)??[];y.push({pageIndex:c,box:_o(l)}),r.set(h,y);}}})(i.fragments);});let o=Mo(e.root),a=[];for(let i of n){let c=chunkANZ44KQT_cjs.Kb(i.node),s=[...i.ancestors.map(h=>chunkANZ44KQT_cjs.Kb(h).lock),c.lock],d=o.get(i.node.id)??[],l=new Map;for(let h of d)for(let y of r.get(h)??[]){let b=l.get(y.pageIndex);l.set(y.pageIndex,b?zo(b,y.box):y.box);}let f=[...l.entries()].sort((h,y)=>h[0]-y[0]).map(([h,y])=>({pageIndex:h,...y}));a.push({controlId:i.node.id,type:c.type,level:chunkANZ44KQT_cjs.Lb(i.node),depth:i.depth,lock:c.lock,effectiveLock:chunkANZ44KQT_cjs.Pb(s),showingPlaceholder:c.showingPlaceholder,temporary:c.temporary,...c.tag===void 0?{}:{tag:c.tag},...c.alias===void 0?{}:{alias:c.alias},...c.id===void 0?{}:{id:c.id},...c.dataBinding===void 0?{}:{dataBinding:c.dataBinding},paragraphIds:d,fragments:f});}return a}var No=Object.freeze([]);function wn(e,t,n){let r=e.lines?.find(o=>{let a=o.spans;if(!a)return n<o.range.end;let i=a.filter(c=>c.range.paragraphId===t);return i.length===a.length?n<o.range.end:i.length>0&&n<i[i.length-1].range.end});return r?r.box.y:e.fragmentY}function $o(e,t){let n=new Map;for(let r of e.pages)for(let[o,a]of qo(r,t))n.has(o)||n.set(o,a);return n}var On=new WeakMap;function qo(e,t){let n=On.get(t);n||(n=new WeakMap,On.set(t,n));let r=n.get(e);if(r)return r;let o=new Map;for(let a of t(e)){let i=new Set([a.paragraphId]);for(let c of a.lines??[])for(let s of c.spans??[])i.add(s.range.paragraphId);for(let c of i)o.has(c)||o.set(c,{pageIndex:e.index,contentY:e.contentBox.y,fragmentY:a.box.y,...a.lines?{lines:a.lines}:{}});}return n.set(e,o),o}function Zo(e,t){let n=chunkSUN62YU6_cjs.va(e);if(!n)return null;let r=t.get(n.start.paragraphId);return r?{pageIndex:r.pageIndex,y:r.contentY+wn(r,n.start.paragraphId,n.start.offset)}:null}var An=new WeakMap;function Jo(e){let t=An.get(e);if(t!==void 0)return t;let n=chunkUJL2GDIM_cjs.i(e),r=new DataView(n.buffer,n.byteOffset,n.byteLength),o=false,a=r.getUint32(0)===1953784678?r.getUint32(12+e.faceIndex*4):0,i=r.getUint16(a+4);for(let c=0;c<i;c++){let s=a+12+c*16;if(r.getUint32(s)!==1330851634)continue;let d=r.getUint32(s+8),l=r.getUint32(s+12);l>=86&&d<=n.byteLength-l&&r.getUint16(d)>=1&&(o=(r.getUint32(d+78)&1966080)!==0);break}return An.set(e,o),o}function Pn(e,t,n,r,o){if(r>o||Math.abs(n.height-t)>o||!Jo(e))return n;let a=t*.3;return {height:n.height+a,baseline:n.baseline+a/2}}var Qo="abcdefghijklmnopqrstuvwxyz";function Z(e){let t=Math.round(e.fontSizePt*2);return Math.max(1,t)}function X(e,t,n,r,o){let a=r.shaping?.context;return e.shape({text:o,fontSizeHalfPoints:Z(r),bidiLevel:r.shaping?.direction==="rtl"?1:0,environment:ea(t,n,r),...a?{context:a}:{}})}var _n=new WeakMap;function ea(e,t,n){if(!Object.isFrozen(e)||!Object.isFrozen(e.features)||!Object.isFrozen(e.variationAxes)||!Object.isFrozen(e.shapingLibrary))return Mn(e,t,n);let r=n.shaping?.direction??"ltr",o=n.shaping?.script,a=`${r}|${o??""}|${D(n)?1:0}|${e.documentLigatures?chunkUJL2GDIM_cjs.A(n):""}|${n.smallCaps?1:0}`,i=_n.get(e);i||_n.set(e,i=new WeakMap);let c=i.get(t);c||i.set(t,c=new Map);let s=c.get(a);return s||c.set(a,s=Mn(e,t,n)),s}function Mn(e,t,n){return chunkUJL2GDIM_cjs.p({...e,font:t,direction:n.shaping?.direction??"ltr",script:n.shaping?.script==="Zyyy"?e.script:n.shaping?.script??e.script,features:{...e.features,kern:D(n)?1:0,...e.documentLigatures?chunkUJL2GDIM_cjs.z(n):{},...n.smallCaps?{smcp:1}:{}},fallbackOrder:[]})}function Ae(e,t,n,r,o){let a=o.get(n);if(a!==void 0)return a;let i=true;try{for(let c of Qo){let s=X(e,t,n,{...r,smallCaps:!0},c),d=X(e,t,n,{...r,smallCaps:!1},c);if(!(s.glyphs.length!==d.glyphs.length||s.glyphs.some((f,h)=>f.id!==d.glyphs[h]?.id))){i=!1;break}}}catch{i=false;}return o.set(n,i),i}function zn(e,t,n,r,o){let a=new WeakMap;return (i,c)=>{let s=chunkUJL2GDIM_cjs.ca(c),d=a.get(i);d||(d=new Map,a.set(i,d));let l=Z(c),f=d.get(l);if(f)return s===1?f:{height:f.height*s,baseline:f.baseline*s};let h,y=true,b=i.substitution?.lineMetrics;if(b){let x=l/2;h={height:b.heightEm*x,baseline:b.baselineEm*x};}else try{let x=X(e,t,i,c,""),m=x.metrics.ascent/t.fixedPointScale,g=x.metrics.descent/t.fixedPointScale,S=l/2,C=m+g,v=S*r,F=C>v?v/C:1,B=C*F,p=Math.min(Math.max(0,x.metrics.lineGap/t.fixedPointScale),B*o),u=B+p;u>0?h=Pn(i,S,{height:u,baseline:m*F+p},p,2/t.fixedPointScale):(h=n.lineMetrics(c),y=!1);}catch{h=n.lineMetrics(c),y=false;}return y?(d.set(l,h),s===1?h:{height:h.height*s,baseline:h.baseline*s}):h}}var pt=new WeakMap;function ta(e){let t=pt.get(e);if(t!==void 0)return t??void 0;let n=e.path;if(!n.startsWith("M")||n.length>1e6||/[^MLQCZ0-9eE+.,\s-]/u.test(n))return;let r=1/0,o=-1/0,a=n.matchAll(/([MLQCZ])([^MLQCZ]*)/gu);for(let c of a){let s=c[1]==="Z"?0:c[1]==="C"?6:c[1]==="Q"?4:2,d=c[2].trim().split(/[\s,]+/u).filter(Boolean).map(Number);if(d.length!==s||d.some(l=>!Number.isFinite(l))){pt.set(e,null);return}for(let l=0;l<d.length;l+=2)r=Math.min(r,d[l]),o=Math.max(o,d[l]);}let i=Number.isFinite(r)&&Number.isFinite(o)?{left:r,right:o}:void 0;return pt.set(e,i??null),i}function kn(e,t,n,r){if(e.clusters.length!==1||e.glyphs.length===0)return;let o=1/0,a=-1/0;for(let c of e.glyphs){if(c.id===0)return;let s=ta(c.outline),d=c.outline.unitsPerEm;if(!s||!(d>0))return;let l=(c.originX+c.offsetX)/n;o=Math.min(o,l+s.left*t*(c.drawScale??1)/d),a=Math.max(a,l+s.right*t*(c.drawScale??1)/d);}let i={left:o*r,right:a*r};return Number.isFinite(i.left)&&Number.isFinite(i.right)?i:void 0}function na(e,t,n){if(t<12)return null;if(e.getUint32(0)!==1953784678)return 0;let o=12+(Number.isSafeInteger(n)&&n>0?n:0)*4;if(o+4>t)return null;let a=e.getUint32(o);return a+12<=t?a:null}function Nn(e,t,n,r,o){let a=e.getUint16(n+4);if(a>4096||n+12+a*16>t)return null;for(let i=0;i<a;i+=1){let c=n+12+i*16;if(e.getUint32(c)!==r)continue;let s=e.getUint32(c+8),d=e.getUint32(c+12);return d<o||s+d>t?null:s}return null}function Dn(e,t){let n=e.byteLength,r=new DataView(e.buffer,e.byteOffset,n),o=na(r,n,t);if(o===null)return null;let a=Nn(r,n,o,1751474532,54);if(a===null)return null;let i=r.getUint16(a+18);if(i<=0)return null;let c=Nn(r,n,o,1330851634,30);if(c===null)return null;let s=r.getInt16(c+26)/i,d=r.getInt16(c+28)/i;return !(s>0)||s>1||!(Math.abs(d)<=1)?null:{offsetEm:d,thicknessEm:s}}var ra=.5,oa=4,Hn=4096;function Un(e){let t="environment"in e?e.environment:void 0,n="environment"in e?void 0:e,{shaper:r,resolveFont:o,fallback:a}=e,i=t??{shapingLibrary:n.shapingLibrary,unicodeDataVersion:n.unicodeDataVersion,script:n?.script??"Latn",fixedPointScale:n?.fixedPointScale??1e3,normalization:n?.normalization??"none",features:n?.features??{},roundingMode:n?.roundingMode??"halfToEven",language:n?.language??"en",variationAxes:{}},c=new WeakMap,s=new WeakMap,d=zn(r,i,a,oa,ra),l=new WeakMap,f=new WeakMap,h=new Array(Hn),y=0,b=(p,u,R)=>{let E=h[y];E&&E.cache.delete(E.text),p.set(u,R),h[y]={cache:p,text:u},y=(y+1)%Hn;},x=p=>{let u=l.get(p);if(u!==void 0)return u;let R=o(p);return l.set(p,R),R},m=(p,u,R)=>{let E=R?s:c,L=E.get(p);L||(L=new Map,E.set(p,L));let I=L.get(u);return I||(I=new Map,L.set(u,I)),I},g=new WeakMap,S=p=>{if(!p.shaping?.wordSpacingPt)return p;let u=g.get(p);return u||(u={...p,shaping:{...p.shaping,wordSpacingPt:void 0}},g.set(p,u)),u},C=(p,u)=>u.shaping?.wordSpacingPt?chunkUJL2GDIM_cjs.Kd(p)*u.shaping.wordSpacingPt:0,v=(p,u)=>a.measure(p,S(u))+C(p,u),F=(p,u)=>{let R=Math.max(0,a.measure(p,S(u))),E=a.caretAdvances?.(p,S(u))??chunkUJL2GDIM_cjs.Id(p,R);if(!E||E.length!==p.length+1)return chunkUJL2GDIM_cjs.Id(p,v(p,u));let L=Math.max(0,v(p,u)),I=0,A=0;return E.map((w,M)=>{if(M===0)return 0;p[M-1]===" "&&A++;let O=w+A*(u.shaping?.wordSpacingPt??0);return I=Math.max(I,Math.min(L,Number.isFinite(O)?O:I)),M===p.length?L:I})},B=new WeakMap;return {hasResolvedFont(p){return x(p)!==null},strikeoutMetrics(p){let u=x(p);if(!u)return;let R=B.get(u);if(R===void 0&&(R=Dn(u.bytes,u.faceIndex),B.set(u,R)),!R)return;let E=Z(p)/2*chunkUJL2GDIM_cjs.ca(p);return {offsetPt:R.offsetEm*E,thicknessPt:R.thicknessEm*E}},measure(p,u){if(p.length===0)return 0;let R=x(u);if(!R)return v(p,u);let E=m(R,Z(u),u.smallCaps),L=u.shaping?.context,I=u.shaping?`1:${JSON.stringify(L?[u.shaping.script,u.shaping.direction,p,L.before,L.after]:[u.shaping.script,u.shaping.direction,p])}`:`0:${p}`,A=`${D(u)?1:0}:${chunkUJL2GDIM_cjs.A(u)}:${I}`,w=E.get(A);if(w===void 0){let M=0;try{if(u.smallCaps&&!Ae(r,i,R,u,f))return v(p,u);let O=X(r,i,R,u,p);if(O.glyphs.some(H=>H.id===0))return v(p,u);for(let H of O.glyphs)M+=H.advanceX;}catch{return v(p,u)}w=M/i.fixedPointScale,b(E,A,w);}return w*chunkUJL2GDIM_cjs.ca(u)*(u.horizontalScalePercent/100)+p.length*u.characterSpacingPt+C(p,u)},inkBounds(p,u){if(!p||p.length>2||u.shaping?.direction==="rtl"||chunkUJL2GDIM_cjs.ja(p).length!==1)return;let R=x(u);if(!R)return a.inkBounds?.(p,u);try{if(u.smallCaps&&!Ae(r,i,R,u,f))return a.inkBounds?.(p,u);let E=X(r,i,R,u,p);return kn(E,Z(u)/2,i.fixedPointScale,chunkUJL2GDIM_cjs.ca(u)*u.horizontalScalePercent/100)}catch{return}},caretAdvances(p,u){let R=x(u);if(!R)return F(p,u);try{if(u.smallCaps&&!Ae(r,i,R,u,f))return F(p,u);let E=X(r,i,R,u,p);return E.glyphs.some(L=>L.id===0)?F(p,u):chunkUJL2GDIM_cjs.Jd(p,E,chunkUJL2GDIM_cjs.ca(u)*(u.horizontalScalePercent/100)/i.fixedPointScale,u.characterSpacingPt,u.shaping?.wordSpacingPt??0)??chunkUJL2GDIM_cjs.Id(p,E.glyphs.reduce((L,I)=>L+I.advanceX,0)*chunkUJL2GDIM_cjs.ca(u)*(u.horizontalScalePercent/100)/i.fixedPointScale+p.length*u.characterSpacingPt+C(p,u))}catch{return F(p,u)}},lineMetrics(p,u){let R=x(p);if(!R)return a.lineMetrics(p,u);if(!u||/^[\t\n\r\f ]*$/.test(u))return d(R,p);try{let E=X(r,i,R,p,u),L=0,I=0;for(let A of E.fontSpans){let w=d(A.font,p);L=Math.max(L,w.baseline),I=Math.max(I,w.height-w.baseline);}if(L+I>0)return {height:L+I,baseline:L}}catch{}return d(R,p)}}}function aa(e,t){return Un({...t,shaper:e.shaper,environment:e.environment})}function ia(e){let{layout:t,viewport:n}=e,r=new Set;if(!n){for(let s of t.pages)r.add(s.index);return r}let o=Math.max(0,Math.trunc(e.overscanPages??1)),a=n.top+n.height,i=-1,c=-1;for(let s of t.pages){let d=s.box.y;d+s.box.height>=n.top&&d<=a&&(i===-1&&(i=s.index),c=s.index);}if(i===-1){let s=sa(t,n.top);s!==null&&(i=s,c=s);}if(i!==-1){let s=Math.max(0,i-o),d=Math.min(t.pages.length-1,c+o);for(let l=s;l<=d;l+=1)r.add(l);}for(let s of e.pinnedPages??[])s>=0&&s<t.pages.length&&r.add(s);return r}function sa(e,t){let n=null,r=Number.POSITIVE_INFINITY;for(let o of e.pages){let a=t<o.box.y?o.box.y-t:t>o.box.y+o.box.height?t-(o.box.y+o.box.height):0;a<r&&(r=a,n=o.index);}return n}var Gn=["text-local","paragraph-local","flow-structural","global"];function Wn(e,t){return Gn.indexOf(t)>Gn.indexOf(e)?t:e}function ca(e){return {impact:"text-local",paragraphIds:new Set,created:new Set,deleted:new Set,dependencyKeys:new Set,structural:false,revision:e}}function la(e){let{run:t,currentRevision:n,publish:r,schedule:o}=e,a=null,i=null,c=null,s=0,d=0;function l(m){let g=e.runCooperatively;if(!g)return t(m);let S=g(m);c=S;try{for(;;){let C=S.step();if(C)return C;if(n()!==m.revision)return S.cancel(),d+=1,null;if(c!==S)return null}}finally{c===S&&(c=null);}}function f(m){let g=y(n());g.impact=Wn(g.impact,m.impact),g.structural=g.structural||m.structural;for(let S of m.paragraphIds)g.paragraphIds.add(S);for(let S of m.created)g.created.add(S);for(let S of m.deleted)g.deleted.add(S);for(let S of m.dependencyKeys)g.dependencyKeys.add(S);}let h=m=>({impact:m.impact,paragraphIds:m.paragraphIds,created:m.created,deleted:m.deleted,dependencyKeys:m.dependencyKeys,structural:m.structural,revision:m.revision});function y(m){return a||(a=ca(m)),a.revision=Math.max(a.revision,m),a}function b(){!o||i||(i=o(()=>{i=null,x();}));}function x(){i&&(i(),i=null),c&&(c.cancel(),c=null,d+=1);let m=a;if(!m)return false;a=null;let g=h(m),S=l(g);return !S||S.revision!==n()?(s+=1,f(g),b(),false):(r(S,g),true)}return {notify(m){let g=y(n());g.impact=Wn(g.impact,m.impact);for(let S of m.dirty)g.paragraphIds.add(S);for(let S of m.created)g.created.add(S),g.paragraphIds.add(S);for(let S of m.deleted)g.deleted.add(S),g.paragraphIds.add(S);for(let S of m.dependencyKeys)g.dependencyKeys.add(S);for(let S of m.splitJoin)g.structural=true,"split"in S?(g.paragraphIds.add(S.split.from),g.paragraphIds.add(S.split.tail)):(g.paragraphIds.add(S.join.kept),g.paragraphIds.add(S.join.removed));(m.impact==="flow-structural"||m.impact==="global")&&(g.structural=true),b();},invalidateAll(m,g){let S=y(m);S.impact="flow-structural",S.structural=true,g&&S.dependencyKeys.add(g),b();},flush:x,pending:()=>a?h(a):null,cancel(){i?.(),i=null,c?.cancel(),c=null,a=null;},get staleDiscards(){return s},get cancelledRuns(){return d}}}var Kn=new WeakMap;function V(e){let t=Kn.get(e);if(t)return t;let n=new Map,r=new Map,o=new Map,a=new Map,i=(s,d,l,f)=>{for(let h of s){if(h.kind==="paragraph")continue;let y=h.tableId;a.set(y,Math.max(a.get(y)??0,(h.columnEdges?.length??1)-1));let b=o.get(y);b||(b=new Map,o.set(y,b),n.set(y,[]),r.set(y,new Map));for(let x of h.rows){let m=b.get(x.id);m===void 0&&(m=b.size,b.set(x.id,m),r.get(y).set(m,x.cells));for(let g of x.cells)n.get(y).push({pageIndex:d,tableId:y,row:x,cell:g,rowIndex:m,isHeaderRepeat:x.isHeaderRepeat,offsetX:l,offsetY:f}),i(g.blocks,d,l,f);}}};for(let s of e.pages){i(s.fragments,s.index,0,0);for(let d of [s.header,s.footer])d&&i(d.fragments,s.index,d.box.x-s.contentBox.x,d.box.y-s.contentBox.y);for(let d of [s.footnotes,s.endnotes])if(d)for(let l of d.notes)i(l.fragments,s.index,l.box.x-s.contentBox.x,l.box.y-s.contentBox.y);}let c=new Map;for(let[s,d]of n)c.set(s,{placed:d,rows:r.get(s)??new Map,columnCount:a.get(s)??0});return Kn.set(e,c),c}function Yn(e){let t=e.columnCount;for(let n of e.rows.values())for(let r of n)t=Math.max(t,Y(r).to+1);return t}var Y=e=>({from:e.gridColumn,to:e.gridColumn+Math.max(1,e.gridSpan)-1});function da(e,t,n){if(t.tableId!==n.tableId)return null;let r=V(e).get(t.tableId);if(!r)return null;let o=Math.min(t.rowIndex,n.rowIndex),a=Math.max(t.rowIndex,n.rowIndex),i=Math.min(Y(t).from,Y(n).from),c=Math.max(Y(t).to,Y(n).to),s=y=>{let{from:b,to:x}=Y(y);return x>=i&&b<=c},d=y=>(r.rows.get(y)??[]).some(b=>b.vMergeContinue&&s(b)),l=r.rows.size+Yn(r)+2;for(let y=0;!(y>l);y+=1){let b=false;for(let[x,m]of r.rows)if(!(x<o||x>a))for(let g of m){if(!s(g))continue;let{from:S,to:C}=Y(g);S<i&&(i=S,b=true),C>c&&(c=C,b=true);}for(;o>0&&d(o);)o-=1,b=true;for(;d(a+1);)a+=1,b=true;if(!b)break}let f=[],h=new Set;for(let y of r.placed){if(y.isHeaderRepeat||y.rowIndex<o||y.rowIndex>a)continue;let{from:b,to:x}=Y(y.cell);x<i||b>c||h.has(y.cell.id)||(h.add(y.cell.id),f.push(y.cell.id));}return f.length===0?null:{kind:"cells",tableId:t.tableId,cellIds:f,rows:{from:o,to:a},columns:{from:i,to:c},text:ua(e,t.tableId,f)}}function ts(e,t){return $n(e,t,true)}function Pe(e,t){return $n(e,t,false)}function $n(e,t,n){let r=new Set(t),o=[],a=new Set;for(let i of V(e).values())for(let c of i.placed)if(!(c.isHeaderRepeat||!r.has(c.cell.id)))for(let s of c.cell.blocks)n&&s.kind!=="paragraph"||ne(s,o,a);return o}function ne(e,t,n){if(e.kind==="paragraph"){for(let r of chunkUJL2GDIM_cjs.Ma(e))n.has(r)||(n.add(r),t.push(r));return}for(let r of e.rows)if(!r.isHeaderRepeat)for(let o of r.cells)for(let a of o.blocks)ne(a,t,n);}function ua(e,t,n){let r=Pe(e,n),o=r[0],a=r[r.length-1];return !o||!a?pa(e,t):{anchor:{paragraphId:o,offset:0},head:{paragraphId:a,offset:chunkUJL2GDIM_cjs.hf(e,a).length}}}function pa(e,t){let n=V(e).get(t);for(let o of n?.placed??[]){if(o.isHeaderRepeat)continue;let a=[];for(let c of o.cell.blocks)ne(c,a,new Set);let i=a[0];if(i){let c={paragraphId:i,offset:0};return {anchor:c,head:c}}}for(let o of e.pages)for(let a of chunkUJL2GDIM_cjs.ua(o)){let i={paragraphId:a.paragraphId,offset:0};return {anchor:i,head:i}}let r={paragraphId:"",offset:0};return {anchor:r,head:r}}function fa(e){let t=[...chunkUJL2GDIM_cjs.ua(e)];for(let n of [e.header,e.footer])n&&t.push(...chunkUJL2GDIM_cjs.va(n.fragments));for(let n of [e.footnotes,e.endnotes])if(n)for(let r of n.notes)t.push(...chunkUJL2GDIM_cjs.va(r.fragments));return t}function ya(e,t){let n=new Set(Pe(e,t)),r=[],o=new Set;for(let a of e.pages)for(let i of fa(a))if(n.has(i.paragraphId))for(let c of i.lines)for(let s of c.spans){let d=`${s.range.paragraphId}:${s.range.start}:${s.range.end}`;o.has(d)||(o.add(d),r.push(s));}return r}function ma(e,t){let n=new Set(t),r=[];for(let o of V(e).values())for(let a of o.placed)n.has(a.cell.id)&&r.push({pageIndex:a.pageIndex,x:a.cell.box.x+a.offsetX,y:a.cell.box.y+a.offsetY,width:a.cell.box.width,height:a.cell.box.height});return r}function ha(e,t,n=chunkUJL2GDIM_cjs.hf){let r=V(e).get(t.tableId);if(!r)return "";let o=new Set(t.cellIds),a=r.placed.some(s=>s.cell.logicalGridColumn!==void 0),i=new Map,c=new Set;for(let s of r.placed){if(s.isHeaderRepeat||!o.has(s.cell.id)||c.has(s.cell.id))continue;c.add(s.cell.id);let d=Pe(e,[s.cell.id]).map(h=>n(e,h)).join(`
1
+ 'use strict';var chunk55AT3MOU_cjs=require('./chunk-55AT3MOU.cjs'),chunkAVKVRU7Z_cjs=require('./chunk-AVKVRU7Z.cjs'),chunk4KZ6L5YF_cjs=require('./chunk-4KZ6L5YF.cjs');var Zn=(e,t,n)=>{let r=e<0n,o=r?-e:e,a=o/t,i=o%t;if(n!=="towardZero"){let d=i*2n;(d>t||d===t&&(n==="halfAwayFromZero"||n==="halfToEven"&&a%2n!==0n))&&(a+=1n);}let c=r?-a:a,s=Number(c);if(!Number.isSafeInteger(s))throw new RangeError("Shaped fixed-point value exceeds the safe integer range");return s},Ze=(e,t,n,r)=>{if(!Number.isSafeInteger(e))throw new RangeError("font units must be a safe integer");if(!Number.isSafeInteger(t)||t<=0)throw new RangeError("fixed-point denominator must be a positive safe integer");if(!Number.isSafeInteger(n)||n<0)throw new RangeError("fixed-point numerator must be a non-negative safe integer");if(e===0||n===0)return chunk55AT3MOU_cjs.n(0);let o=e*n;if(Number.isSafeInteger(o)){let a=Math.abs(o),i=a%t,c=(a-i)/t;return r!=="towardZero"&&(i>t-i||i===t-i&&(r==="halfAwayFromZero"||r==="halfToEven"&&c%2!==0))&&(c+=1),chunk55AT3MOU_cjs.n(c===0?0:o<0?-c:c)}return chunk55AT3MOU_cjs.n(Zn(BigInt(e)*BigInt(n),BigInt(t),r))},Ut=(e,t,n,r)=>{if(!Number.isSafeInteger(t)||t<=0)throw new RangeError("font size must be a positive integer number of half points");if(t>Math.floor(Number.MAX_SAFE_INTEGER/n))throw new RangeError("font size and fixed-point scale product exceeds the safe integer range");let o=t*n,a=e*2;return i=>Ze(i,a,o,r)},Gt=(e,t,n)=>{let r=t*n,o=e*2;return a=>a*r/o};var Jn=4096,Wt=e=>typeof e=="number"?String(e):JSON.stringify(e)??typeof e,Te=class{constructor(t){this.onRestart=t;}onRestart;#e=new Map;keyOf(t,n){let r=chunk55AT3MOU_cjs.r(n),o=this.#e.get(r);o===void 0&&(this.#e.size>=Jn&&(this.#e.clear(),this.onRestart()),o=this.#e.size,this.#e.set(r,o));let a=`${o}\0${Wt(t.fontSizeHalfPoints)}\0${Wt(t.bidiLevel)}\0`,i=t.context;return !i||i.before===""&&i.after===""?`${a}-${t.text}`:`${a}c${i.before.length},${i.after.length}\0${i.before}${i.after}${t.text}`}clear(){this.#e.clear();}};function Q(e){try{let t=new URL(e);return t.username!==""||t.password!==""||t.search!==""||t.hash!==""?`${t.protocol}//${t.host}${t.pathname}\u2026`:e}catch{let t=e.search(/[?#]/);return t===-1?e:`${e.slice(0,t)}\u2026`}}function Kt(e){return e.replace(/[a-z][a-z0-9+.-]*:\/\/[^\s"')]+/gi,t=>Q(t))}function tr(e){if(typeof e!="string"&&!(e instanceof URL))throw new TypeError(`setHarfBuzzWasmUrl: expected a string or URL, received ${typeof e}`);if(typeof e=="string"&&e.trim()==="")throw new TypeError("setHarfBuzzWasmUrl: expected a non-empty URL");throw new Error("setHarfBuzzWasmUrl is not supported by the CommonJS build, which loads the shaper from node_modules and finds its binary on disk. Import the ESM build instead.");}function Xt(e){return e instanceof Error&&/process\.getBuiltinModule/.test(e.message)}function Vt(e){return `the text shaper cannot start on this Node version: the ESM build reaches Node builtins through \`process.getBuiltinModule\`, added in Node 20.16.0 and 22.3.0. Upgrade Node; \`setHarfBuzzWasmUrl\` does not apply here. (${Kt(e instanceof Error?e.message:String(e))})`}function jt(e){let t=Kt(e instanceof Error?e.message:String(e));return `the HarfBuzz WASM binary could not be loaded from ${"its bundled location"}. If this bundler does not emit \`new URL(..., import.meta.url)\` assets (esbuild, Bun, and library builds that inline dynamic imports), serve \`@docx-editor.dev/core/harfbuzz.wasm\` yourself, point \`setHarfBuzzWasmUrl\` from '@docx-editor.dev/core/layout' at it before creating an editor, and reload the page. (${t})`}function Yt(e,t){let n=`expected HarfBuzz ${e}, loaded ${t}`;return `${n}. The bundled binary does not match this build of the engine.`}var q=Object.freeze({name:"HarfBuzz",version:"14.4.0"}),de=null,ce=null;function Qe(){return de?Promise.resolve():ce||(ce=import('harfbuzzjs').then(e=>{let t=e.versionString();if(t!==q.version)throw new T("shapingLibraryMismatch",{diagnostic:Yt(q.version,t)});de=e;}).catch(e=>{throw ce=null,e instanceof T?e:Xt(e)?new T("unsupportedRuntime",{diagnostic:Vt(e),cause:e}):new T("wasmUnavailable",{diagnostic:jt(e),cause:e})}),ce)}function nr(){return de!==null}function rr(){if(!de)throw new T("notInitialized",{diagnostic:"Call initializeHarfBuzz() before creating a text shaper"});return de}var T=class extends Error{name="HarfBuzzShapingError";code;limit;actual;diagnostic;constructor(t,n={}){super(`HarfBuzz shaping failed (${t})`,{cause:n.cause}),this.code=t,this.limit=n.limit,this.actual=n.actual,this.diagnostic=n.diagnostic;}},or=16*1024*1024,ar=1e6,ir=1e6,sr=1e6,cr=4,lr=512,dr=1024*1024,ur=16*1024*1024,pr=32*1024*1024,fr=64*1024*1024,yr=64*1024*1024,mr=1e6,hr=1e6,gr=1e6,Sr=64,br=4096,xr=4*1024*1024,Rr=64*1024*1024,Cr=64*1024*1024,Fr=256*1024*1024,vr=new Set(["COLR","CPAL","CBDT","CBLC","sbix","SVG "]),$t=["cmap","head","hhea","hmtx","maxp"],Er=(e,t)=>e[t]<<8|e[t+1],Lr=(e,t)=>e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3]>>>0,Tr=(e,t)=>String.fromCharCode(e[0],e[1],e[2],e[3])==="ttcf"?Lr(e,12+t*4):0,Ir=(e,t)=>{let n=Tr(e,t),r=Er(e,n+4),o=new Set;for(let a=0;a<r;a+=1){let i=n+12+a*16;o.add(String.fromCharCode(e[i],e[i+1],e[i+2],e[i+3]));}return o},Br=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),Or=(e,t)=>{let n=chunk55AT3MOU_cjs.l(e,t);if(!n.valid)return n;let r=Ir(e,t);for(let o of $t)if(!r.has(o))return {valid:false,diagnostic:`missing required ${o} table`};return {valid:true}},et=Or,z=(e,t,n)=>{if(!Number.isSafeInteger(e)||e<=0||e>n)throw new RangeError(`${t} must be a positive safe integer no greater than ${n}`);return e},wr=(e,t,n)=>{if(t.length===0)return [];let r=[],o=0;for(;o<t.length;){let a=t[o].cluster,i=o+1,c=t[o].advanceX;for(;i<t.length&&t[i].cluster===a;)c+=t[i].advanceX,i+=1;let s=chunk55AT3MOU_cjs.n(c);r.push({textStart:a,textEnd:n==="rtl"?t[o-1]?.cluster??e.length:t[i]?.cluster??e.length,glyphStart:o,glyphEnd:i,advance:s,caretEdges:Object.freeze([chunk55AT3MOU_cjs.n(0),s]),fontSpan:0}),o=i;}return r},N=64,U=8,G=8,qt=32,tt=N+2*U,Ar=N+U+G,Pr=N+U+2*G,_r=N+U+G,Zt=N+8*U,Jt=N+8*G+U,Mr=N+6*G+U,zr=N+3*G+2*U,kr=N+3*G,ue=e=>N+e.length*Uint16Array.BYTES_PER_ELEMENT,nt=e=>_r+ue(e),le=e=>qt+e*U,Nr=(e,t)=>tt+ue(e)+Ar+nt(t),Dr=e=>Zt+ue(e)+le(e.length)+e.length*Jt,Hr=e=>{let t=new Set(e.glyphs.map(n=>n.outline));return Zt+ue(e.text)+le(e.glyphs.length)+e.glyphs.length*Jt+le(e.clusters.length)+e.clusters.length*Mr+e.clusters.reduce((n,r)=>n+le(r.caretEdges.length),0)+le(e.fontSpans.length)+e.fontSpans.length*zr+(e.exactAdvancesX===void 0?0:qt+e.exactAdvancesX.length*G)+kr+[...t].reduce((n,r)=>n+nt(r.path),0)},Ur=(e,t)=>tt+ue(e)+Pr+t,Je=class{#e;#p;#f;#y;#m;#R;#h;#l=0;#C;#g;#S;#c;#b;#d;#t;#o=new Map;#i=new Map;#s=new Map;#n=new Map;#F=new Te(()=>{this.#n.clear(),this.#r=0,this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"cleared",retainedBytes:0}));});#a=0;#r=0;#x=0;#u;constructor(t,n){this.#e=t,this.#p=z(n.maxFontBytes??or,"maximum font bytes",yr),this.#f=z(n.maxInputUtf16??ar,"maximum input UTF-16 code units",mr),this.#y=z(n.maxCodepoints??ir,"maximum input code points",hr),this.#m=z(n.maxGlyphs??sr,"maximum shaped glyphs",gr),this.#h=z(n.maxCachedFontBytes??64*1024*1024,"maximum cached font bytes",64*1024*1024),this.#R=z(n.maxCachedFaces??cr,"maximum cached faces",Sr),this.#C=z(n.maxCachedShapes??lr,"maximum cached shape results",br),this.#g=z(n.maxOutlineBytes??dr,"maximum outline bytes",xr),this.#S=z(n.maxCachedOutlineBytes??ur,"maximum cached outline bytes",Rr),this.#c=z(n.maxShapedRunBytes??pr,"maximum shaped run bytes",Cr),this.#b=z(n.maxCachedShapeBytes??fr,"maximum cached shape bytes",Fr),this.#d=n.instrumentation?.onFaceCacheEvent,this.#t=n.instrumentation,this.#u=new this.#e.Buffer;}dispose(){this.#o.clear(),this.#l=0,this.#i.clear(),this.#s.clear(),this.#n.clear(),this.#F.clear(),this.#a=0,this.#r=0,this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"cleared",retainedBytes:0})),this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"cleared",retainedBytes:0})),this.#u=void 0;}#E(t,n){let r=this.#o.get(t.identity);if(r)return this.#o.delete(t.identity),this.#o.set(t.identity,r),this.#d?.(Object.freeze({kind:"hit",identity:t.identity})),r;let o=chunk55AT3MOU_cjs.j(t);for(let l of $t)if(!o.has(l))throw new T("malformedFont",{diagnostic:`missing required ${l} table`});this.#t?.onByteCopy?.();let a=new this.#e.Blob(Br(n)),i=new this.#e.Face(a,t.faceIndex),c=new this.#e.Font(i),s=c.hExtents();if(!Number.isSafeInteger(i.upem)||i.upem<=0||!Number.isSafeInteger(s.ascender)||!Number.isSafeInteger(s.descender)||!Number.isSafeInteger(s.lineGap))throw new T("malformedFont",{diagnostic:"invalid font units or horizontal metrics"});c.setScale(i.upem,i.upem);let d={identity:t.identity,blob:a,face:i,font:c,unitsPerEm:i.upem,byteLength:n.byteLength};if(n.byteLength<=this.#h){for(;this.#o.size>=this.#R||this.#l+n.byteLength>this.#h;){let l=this.#o.keys().next().value;if(l===void 0)break;this.#l-=this.#o.get(l).byteLength,this.#o.delete(l),this.#d?.(Object.freeze({kind:"evicted",identity:l}));}this.#o.set(t.identity,d),this.#l+=n.byteLength;}return this.#d?.(Object.freeze({kind:"created",identity:t.identity})),d}#L(t,n){let r=this.#i.get(t.identity)?.get(n);if(r)return this.#s.delete(r),this.#s.set(r,void 0),this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"hit",retainedBytes:this.#a})),r.outline;this.#t?.onOutlinePathCall?.();let o=t.font.glyphToPath(n),a=nt(o);if(a>this.#g)throw new T("outlineOverLimit",{limit:this.#g,actual:a});let i=Object.freeze({path:o,unitsPerEm:t.unitsPerEm}),c=Nr(t.identity,o)+3*tt+2*G;if(c>this.#S)return this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"skipped",retainedBytes:this.#a})),i;for(;this.#a+c>this.#S;){let l=this.#s.keys().next().value;if(l===void 0)break;this.#s.delete(l);let f=this.#i.get(l.identity);f.delete(l.glyphId),f.size===0&&this.#i.delete(l.identity),this.#a-=l.bytes,this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"evicted",retainedBytes:this.#a}));}let s=this.#i.get(t.identity);s||this.#i.set(t.identity,s=new Map);let d={outline:i,bytes:c,identity:t.identity,glyphId:n};return s.set(n,d),this.#s.set(d,void 0),this.#a+=c,this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"created",retainedBytes:this.#a})),i}#v(t){if(t.length>this.#f)throw new T("textOverLimit",{limit:this.#f,actual:t.length});let n=0;for(let r=0;r<t.length;){let o=t.codePointAt(r);if(r+=o>65535?2:1,n+=1,n>this.#y)throw new T("codepointsOverLimit",{limit:this.#y,actual:n})}}shape(t){if(!this.#u)throw new T("disposed");if(chunk55AT3MOU_cjs.k(t.environment.font),t.environment.font.byteLength>this.#p)throw new T("fontOverLimit",{limit:this.#p,actual:t.environment.font.byteLength});this.#v(t.text);let n=Dr(t.text);if(n>this.#c)throw new T("shapedRunOverLimit",{limit:this.#c,actual:n});let r=chunk55AT3MOU_cjs.p(t.environment),o=this.#F.keyOf(t,r),a=this.#n.get(o);if(a)return this.#x-a.stamp>=Math.max(1,this.#n.size>>1)&&(this.#n.delete(o),this.#n.set(o,a),a.stamp=++this.#x),this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"hit",retainedBytes:this.#r})),a.run;if(this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"miss",retainedBytes:this.#r})),r.shapingLibrary.name!==q.name||r.shapingLibrary.version!==q.version)throw new T("shapingLibraryMismatch");if(r.normalization!=="none")throw new T("unsupportedNormalization");if(!Number.isSafeInteger(t.bidiLevel)||t.bidiLevel<0||(t.bidiLevel&1)===1!=(r.direction==="rtl"))throw new T("invalidBidiLevel");if(Object.keys(r.variationAxes).length>0)throw new T("unsupportedVariationAxes");if(r.fallbackOrder.length>0)throw new T("unsupportedFallback");let i=chunk55AT3MOU_cjs.i(r.font),c=chunk55AT3MOU_cjs.j(r.font);if([...vr].some(y=>c.has(y))&&!c.has("glyf")&&!c.has("CFF "))throw new T("unsupportedColorFont");let s=t.text;this.#v(s);let d=t.context?.before??"",l=t.context?.after??"",f=chunk55AT3MOU_cjs.o,h=Math.max(String(d).length,String(l).length);if(typeof d!="string"||typeof l!="string"||h>f)throw new T("textOverLimit",{limit:f,actual:h});try{let y=this.#E(r.font,i),{face:b,font:x}=y,m=this.#u;m.reset(),d||l?m.addText(d+s+l,d.length,s.length):m.addText(s),m.setDirection(r.direction==="rtl"?this.#e.Direction.RTL:this.#e.Direction.LTR),m.setScript(r.script),m.setLanguage(r.language),m.setClusterLevel(this.#e.ClusterLevel.MONOTONE_CHARACTERS);let g=Object.entries(r.features).map(([O,H])=>new this.#e.Feature(O,H));this.#t?.onShapeCall?.(),this.#e.shape(x,m,g);let S=m.getLength();if(S>this.#m)throw new T("glyphOverLimit",{limit:this.#m,actual:S});let C=m.getGlyphInfos(),v=m.getGlyphPositions(),F=Ut(b.upem,t.fontSizeHalfPoints,r.fixedPointScale,r.roundingMode),B=Gt(b.upem,t.fontSizeHalfPoints,r.fixedPointScale),p=[],u=chunk55AT3MOU_cjs.n(0),R=chunk55AT3MOU_cjs.n(0),E=new Map,L=C.map((O,H)=>{let re=v[H];p.push(B(re?.xAdvance??0));let yt=F(re?.xAdvance??0),mt=F(re?.yAdvance??0),qn={id:O.codepoint,cluster:O.cluster-d.length,originX:u,originY:R,advanceX:yt,advanceY:mt,offsetX:F(re?.xOffset??0),offsetY:F(re?.yOffset??0),outline:E.get(O.codepoint)??(()=>{let ht=this.#L(y,O.codepoint);return E.set(O.codepoint,ht),ht})()};return u=chunk55AT3MOU_cjs.n(u+yt),R=chunk55AT3MOU_cjs.n(R+mt),qn}),I=x.hExtents(),A=chunk55AT3MOU_cjs.s({text:s,direction:r.direction,bidiLevel:t.bidiLevel,glyphs:L,exactAdvancesX:p,clusters:wr(s,L,r.direction),fontSpans:L.length===0?[]:[{glyphStart:0,glyphEnd:L.length,font:r.font,fallbackIndex:null}],metrics:{ascent:F(I.ascender),descent:F(-I.descender),lineGap:F(I.lineGap)}},r),w=Hr(A);if(w>this.#c)throw new T("shapedRunOverLimit",{limit:this.#c,actual:w});let M=Ur(o,w);if(M>this.#b)return this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"skipped",retainedBytes:this.#r})),A;for(;this.#n.size>=this.#C||this.#r+M>this.#b;){let O=this.#n.keys().next().value;if(O===void 0)break;let H=this.#n.get(O);this.#n.delete(O),this.#r-=H.bytes,this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"evicted",retainedBytes:this.#r}));}return this.#n.set(o,{run:A,bytes:M,stamp:++this.#x}),this.#r+=M,this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"stored",retainedBytes:this.#r})),A}catch(y){throw y instanceof T?y:new T("malformedFont",{diagnostic:y instanceof Error?y.message:"HarfBuzz shaping failed"})}}},rt=(e={})=>new Je(rr(),e);var ot=Object.freeze({maxFontBytes:16*1024*1024,maxInputUtf16:1e6,maxCodepoints:1e6,maxGlyphs:1e6,maxCachedFaces:32,maxCachedFontBytes:64*1024*1024,maxCachedShapes:512,maxOutlineBytes:1024*1024,maxCachedOutlineBytes:16*1024*1024,maxShapedRunBytes:32*1024*1024,maxCachedShapeBytes:64*1024*1024}),Pa=Object.freeze({...ot,maxCachedShapes:4096});function Qt(e){let t={maxFontBytes:e.maxFontBytes,maxInputUtf16:e.maxInputUtf16,maxCodepoints:e.maxCodepoints,maxGlyphs:e.maxGlyphs,maxOutlineBytes:e.maxOutlineBytes,maxShapedRunBytes:e.maxShapedRunBytes},n=["docx-editor-layout-harfbuzz-execution-policy",1,Object.entries(t).sort(([r],[o])=>r<o?-1:r>o?1:0).map(([r,o])=>Object.freeze([r,o]))];return `layout-shaper-policy:sha256:${chunk4KZ6L5YF_cjs.a(new TextEncoder().encode(JSON.stringify(n)))}`}var Gr=Object.freeze({}),en=chunk55AT3MOU_cjs.b,Wr="16.0.0",Kr="none",Xr=1e3,Vr="halfToEven",rn="cluster-edges-only",jr="Latn",Yr=new Uint8Array(0);var W=class extends Error{code="overLimit";constructor(t){super(t),this.name="LayoutShapingConfigurationError";}};function $r(e,t){let n=e.epoch,r=e.maxFontBytes,o=e.sources,a=e.substitutions,i=e.defaultFont,c=e.language;if(!Number.isSafeInteger(r)||r<=0||r>chunk55AT3MOU_cjs.a)throw new W(`Font byte ceiling must not exceed the engine hard maximum of ${chunk55AT3MOU_cjs.a}`);let s=o.length,d=a?.length??0;if(s===0||s>chunk55AT3MOU_cjs.b)throw new W(`Font source count must be between 1 and ${chunk55AT3MOU_cjs.b}`);if(d>en)throw new W(`Font substitution count must not exceed ${en}`);let l=0,f=[];for(let b=0;b<s;b+=1){let x=o[b],m=x.request,g=x.availability,S=x.id,C=x.hash,v=x.faceIndex,F=g==="forbidden",B=F?Yr:x.bytes;if(!F){if(typeof S!="string"||S.length===0)throw new TypeError("Resolved font id must not be empty");let p;try{p=chunk55AT3MOU_cjs.e(B);}catch{throw new W(`Font source ${S} must provide genuine bytes`)}if(p>r)throw new W(`Font source ${S} exceeds the per-font byte ceiling`);if(l+=p,l>chunk55AT3MOU_cjs.c)throw new W(`Font sources exceed the aggregate byte ceiling of ${chunk55AT3MOU_cjs.c}`)}f.push(t&&chunk55AT3MOU_cjs.g(x)!==void 0?x:Object.freeze({request:Object.freeze({family:m.family,weight:m.weight,style:m.style}),id:S,bytes:B,hash:C,faceIndex:v,...g?{availability:g}:{}}));}let h;if(a){h=[];for(let b=0;b<d;b+=1){let x=a[b],m=x.from,g=x.to,S=x.lineMetrics;h.push(Object.freeze({from:Object.freeze({family:m.family,weight:m.weight,style:m.style}),to:Object.freeze({family:g.family,weight:g.weight,style:g.style}),...S?{lineMetrics:Object.freeze({heightEm:S.heightEm,baselineEm:S.baselineEm})}:{}}));}}let y={epoch:n,maxFontBytes:r,sources:Object.freeze(f),substitutions:h?Object.freeze(h):void 0,defaultFont:Object.freeze({family:i.family,sizeHalfPoints:i.sizeHalfPoints}),language:c};return Object.freeze(y)}function tn(e,t){let n=e.map((o,a)=>({value:o,index:a,key:chunk55AT3MOU_cjs.h(t(o))})),r=new Set;for(let o of n){if(r.has(o.key))return e;r.add(o.key);}return n.sort((o,a)=>o.key<a.key?-1:o.key>a.key?1:o.index-a.index).map(({value:o})=>o)}function qr(e,t){let n={family:e.family},r={sizeHalfPoints:e.sizeHalfPoints};return {...n,...t?r:{}}}function nn(e,t){let n=s=>({family:s.family,weight:s.weight,style:s.style}),r=t?e.sources:tn(e.sources,s=>s.request),o=e.substitutions??[],a=t?o:tn(o,s=>s.from),i={sources:r.map(s=>{let d=s.availability??"available",l={request:n(s.request),availability:d};if(d==="forbidden")return {...l,...t?{id:s.id,faceIndex:s.faceIndex,declaredHash:s.hash}:{}};let f=chunk55AT3MOU_cjs.g(s);if(f==null)throw new TypeError("Font configuration identity requires prepared source bytes");return {...l,...t?{id:s.id}:{},faceIndex:s.faceIndex,declaredHash:s.hash,actualHash:f,byteLength:s.bytes.byteLength}}),substitutions:a.map(s=>({from:n(s.from),to:n(s.to),lineMetrics:s.lineMetrics?{heightEm:s.lineMetrics.heightEm,baselineEm:s.lineMetrics.baselineEm}:null})),defaultFont:qr(e.defaultFont,t),language:e.language||"en"},c={epoch:e.epoch,maxFontBytes:e.maxFontBytes};return {version:1,...t?c:{},...i}}var Zr=Symbol("prepared-layout-font-configuration"),Ie=new WeakMap;function Jr(e){return Ie.has(e)}function Qr(e){let t=Ie.get(e);if(!t)throw new TypeError("Invalid prepared layout font configuration");return t.configuration}function Da(e){let t=Ie.get(e);if(!t)throw new TypeError("Invalid prepared layout font configuration");return t.sharedShapingFingerprint}function at(e,t){return on(e,t,false)}function Ha(e,t){return on(e,t,true)}function on(e,t,n){let r=$r(e,n),o=Object.freeze({epoch:r.epoch,maxFontBytes:r.maxFontBytes,sources:Object.freeze(r.sources.map(f=>n&&chunk55AT3MOU_cjs.g(f)!==void 0?f:chunk55AT3MOU_cjs.f(f,{onOwnedByteCopy:t?.onFontByteCopy,onHash:t?.onFontHash}))),substitutions:r.substitutions,defaultFont:r.defaultFont,language:r.language}),a=new TextEncoder,i=nn(o,true),c=a.encode(JSON.stringify(i)),s=nn(o,false),d=a.encode(JSON.stringify(s)),l=Object.freeze({[Zr]:true,fingerprint:`font-config:${chunk4KZ6L5YF_cjs.a(c)}`});return Ie.set(l,{configuration:o,sharedShapingFingerprint:`shared-font-config:${chunk4KZ6L5YF_cjs.a(d)}`}),l}function eo(e){return at(e).fingerprint}function to(e,t){let n=new TextEncoder().encode(JSON.stringify({version:1,environment:e,executionPolicy:Qt(t),ligatureCaretPolicy:rn,fallback:chunk55AT3MOU_cjs.ea}));return `shaping:${chunk4KZ6L5YF_cjs.a(n)}`}async function an(e,t,n,r,o=false){let i=Jr(e)?e:at(e,t),c=Qr(i),{epoch:s,maxFontBytes:d,sources:l,substitutions:f,defaultFont:h}=c,y=c.language||"en",b=i.fingerprint,x=chunk55AT3MOU_cjs.m({epoch:s,maxFontBytes:d,resources:l,substitutions:f,validateFont:et,instrumentation:{onOwnedByteCopy:t?.onFontByteCopy,onHash:t?.onFontHash,onAdmission:t?.onFontAdmission}});await Qe();let m=Object.freeze({script:jr,variationAxes:Object.freeze({}),shapingLibrary:q,unicodeDataVersion:Wr,normalization:Kr,language:y,features:Gr,...o?{documentLigatures:true}:{},fixedPointScale:Xr,roundingMode:Vr});return Object.freeze({fonts:x,shaper:n??rt(r),defaultFont:h,environment:m,ligatureCaretPolicy:rn,operation:Object.freeze({resourceEpoch:x.epoch,configEpoch:s,extensionFingerprint:b,shapingHash:to(m,r),producerVersion:1})})}async function no(e,t){return an(e,t,void 0,ot)}async function Ua(e,t,n,r,o=false){return an(e,r,t,n,o)}function ro(e){e.shaper.dispose?.();}function it(e){let t=new Set([0,e.text.length]);for(let r of chunk55AT3MOU_cjs.ka(e.text))t.add(r.utf16From),t.add(r.utf16To);let n=new Set([0,e.text.length]);for(let r of e.clusters)n.add(r.textStart),n.add(r.textEnd);return [...t].filter(r=>n.has(r)).sort((r,o)=>r-o)}function Be(e,t){return it(e).includes(t)}function oo(e,t){return Be(e,t)}function ao(e,t,n){return n>=t&&Be(e,t)&&Be(e,n)}function io(e){let t=chunk55AT3MOU_cjs.ka(e.text);return it(e).map(n=>n===e.text.length?t.length:t.findIndex(r=>r.utf16From===n))}var ct="und";function dn(){return typeof Intl.Segmenter=="function"}function so(){let e=Intl.Segmenter;if(typeof e!="function")throw new Error(`Intl.Segmenter is required for word segmentation (locale: ${ct})`);return e}function un(){let e=new(so())(ct,{granularity:"word"});return {segment(t){let n=[];for(let r of e.segment(t)){let o=r.index,a=o+r.segment.length;n.push({utf16From:o,utf16To:a,wordLike:r.isWordLike===true});}return n}}}var co=/^[\p{L}\p{N}']$/u,lo=/^\s$/u;function sn(e){return co.test(e)}function cn(e){return lo.test(e)}function st(e,t,n,r){let o=e[t],a=e[n-1];return {utf16From:o.utf16From,utf16To:a.utf16To,wordLike:r}}function pn(e){let t=chunk55AT3MOU_cjs.ka(e);if(t.length===0)return [];let n=[],r=0;for(;r<t.length;){let o=t[r];if(cn(o.text)){let a=r+1;for(;a<t.length&&cn(t[a].text);)a+=1;n.push(st(t,r,a,false)),r=a;continue}if(sn(o.text)){let a=r+1;for(;a<t.length&&sn(t[a].text);)a+=1;n.push(st(t,r,a,true)),r=a;continue}n.push(st(t,r,r+1,false)),r+=1;}return n}function fn(){return {segment:pn}}function yn(e={}){let t=e.isIntlAvailable??dn,n=e.createIntlBoundary??un,r=e.createFallbackBoundary??fn;if(!t())return r();try{return n()}catch{return r()}}var ln;function mn(){return ln??=yn(),ln}function uo(e,t=mn()){return t.segment(e)}function po(e,t){return t.map(n=>({graphemeFrom:chunk55AT3MOU_cjs.oa(e,n.utf16From),graphemeTo:chunk55AT3MOU_cjs.oa(e,n.utf16To),wordLike:n.wordLike}))}var hn={resourceEpoch:"resource-scoped",configEpoch:"coarse-gate",extensionFingerprint:"coarse-gate",shapingHash:"coarse-gate",producerVersion:"coarse-gate"},ut=Object.keys(hn),gn=ut.filter(e=>hn[e]==="coarse-gate"),Oe=(e,t)=>{if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`${t} must be a non-negative safe integer`)},ee=(e,t)=>{if(e.trim().length===0)throw new TypeError(`${t} must not be blank`)},fo={resourceEpoch:Oe,configEpoch:Oe,extensionFingerprint:ee,shapingHash:ee,producerVersion:Oe},yo=(e,t)=>{fo[t](e[t],t);},te=e=>{for(let t of ut)yo(e,t);return Object.freeze({resourceEpoch:e.resourceEpoch,configEpoch:e.configEpoch,extensionFingerprint:e.extensionFingerprint,shapingHash:e.shapingHash,producerVersion:e.producerVersion})},mo=(e,t)=>{let n=te(e),r=te(t),o=ut.filter(a=>n[a]!==r[a]);return o.length===0?Object.freeze({status:"current"}):Object.freeze({status:"restart",changed:Object.freeze(o)})},lt=e=>{let t=e.map(({key:n,fingerprint:r})=>(ee(n,"resource dependency key"),ee(r,"resource dependency fingerprint"),Object.freeze({key:n,fingerprint:r}))).sort((n,r)=>n.key<r.key?-1:n.key>r.key?1:0);for(let n=1;n<t.length;n+=1)if(t[n-1].key===t[n].key)throw new TypeError(`Duplicate resource dependency: ${t[n].key}`);return Object.freeze(t)},ho=e=>(Oe(e.revision,"revision"),ee(e.dependencyFingerprint,"dependencyFingerprint"),ee(e.inputFingerprint,"inputFingerprint"),Object.freeze({revision:e.revision,dependencyFingerprint:e.dependencyFingerprint,inputFingerprint:e.inputFingerprint,resourceDependencies:lt(e.resourceDependencies),...te(e)})),go=(e,t)=>{let n=lt(e),r=lt(t),o=Math.max(n.length,r.length);for(let a=0;a<o;a+=1){let i=n[a],c=r[a];if(i?.key!==c?.key||i?.fingerprint!==c?.fingerprint)return {hit:false,reason:"resource-changed",resourceKey:i?.key??c.key}}return null};function So(e,t){if(e.dependencyFingerprint!==t.dependencyFingerprint)return {hit:false,reason:"dependency-changed"};if(e.inputFingerprint!==t.inputFingerprint)return {hit:false,reason:"input-changed"};let n=go(e.resourceDependencies,t.resourceDependencies);if(n)return n;for(let r of gn)if(e[r]!==t[r])return {hit:false,reason:"epoch-changed",epoch:r};return null}var dt=class{entries=new Map;get(t,n){let r=this.entries.get(t);if(!r)return {hit:false,reason:"absent"};let o=So(r.provenance,n);return o||{hit:true,value:r.value,provenance:r.provenance}}set(t,n,r){this.entries.set(t,{value:n,provenance:ho(r)});}evictEpoch(t){let n=te(t),r=0;for(let[o,a]of this.entries){let i=a.provenance;gn.some(c=>i[c]!==n[c])&&(this.entries.delete(o),r+=1);}return r}evictResources(t,n){let r=te(t),o=this.evictEpoch(r);for(let[a,i]of this.entries)i.provenance.resourceDependencies.some(s=>n.get(s.key)!==s.fingerprint)&&(this.entries.delete(a),o+=1);return o}get size(){return this.entries.size}};function Sn(e){return e.projected===true?null:e.range}function xo(e,t,n){let{page:r,story:o,host:a,noteScopeId:i,noteAreaKind:c}=e,s=o==="header"||o==="footer"?d=>chunk55AT3MOU_cjs.ua(d,e.origin,{x:r.box.x,y:r.box.y}):void 0;chunk55AT3MOU_cjs.Da(a,(d,l)=>{let{textboxDepth:f,textboxOwner:h,textboxPath:y,storyOrigin:b}=l,x=f===0?o:"textbox";for(let m of d.lines){let g=[...chunk55AT3MOU_cjs.Ja(m)].sort((S,C)=>(t.get(S.paragraphId)??Number.MAX_SAFE_INTEGER)-(t.get(C.paragraphId)??Number.MAX_SAFE_INTEGER));for(let S of g)for(let C of S.spans)n({page:r,story:x,rootStory:o,root:e,storyOrigin:b,absoluteBox:Object.freeze({x:b.x+C.box.x,y:b.y+C.box.y,width:C.box.width,height:C.box.height}),noteScopeId:i,noteAreaKind:c,textboxDepth:f,textboxOwner:h,textboxPath:y,paragraph:d,paragraphId:S.paragraphId,line:m,span:C,sourceRange:Sn(C)});}},e.origin,s);}function Ro(e,t){let n=new Map(chunk55AT3MOU_cjs.Qa(e).map((r,o)=>[r,o]));chunk55AT3MOU_cjs.Aa(e,r=>xo(r,n,t));}var Fo=1,bn=4,j=Object.freeze({top:0,right:0,bottom:0,left:0}),xn=new WeakMap;function vo(e,t){let n=Eo(e);return n===j?t:chunk55AT3MOU_cjs.kb(t,n)}function Eo(e){let t=e.vectorShape;if(!t)return j;let{cx:n,cy:r}=t.extentEmu;if(!(n>=0)||!(r>=0)||n===0&&r===0)return j;let o=xn.get(t);if(o||(o=Lo(t),xn.set(t,o)),o===j)return j;let a=e.paintBounds,i=e.geometry.contentBounds;if(!(a.width>0||i.width<=0)||!(a.height>0||i.height<=0))return j;let c=n>0?i.width/n:i.height/r,s=r>0?i.height/r:i.width/n,d=(f,h,y)=>{if(y<-1e-3)return 0;let b=f*h-Math.max(0,y);return Number.isFinite(b)&&b>0?b:0},l={left:d(o.left,c,i.x-a.x),top:d(o.top,s,i.y-a.y),right:d(o.right,c,a.x+a.width-(i.x+i.width)),bottom:d(o.bottom,s,a.y+a.height-(i.y+i.height))};return l.left||l.top||l.right||l.bottom?Object.freeze(l):j}function Lo(e){let{cx:t,cy:n}=e.extentEmu,r=0,o=0,a=t,i=n,c=(l,f)=>{r=Math.min(r,l),a=Math.max(a,l),o=Math.min(o,f),i=Math.max(i,f);},s=Fo,d=l=>l.x>=-s&&l.x<=t+s&&l.y>=-s&&l.y<=n+s;for(let l of e.components){if(l.strokeHex===null||l.strokeInset===true)continue;let f=Math.max(1,chunk55AT3MOU_cjs.jb(l.strokeWidthEmu))/2;l.subpathsEmu.forEach((h,y)=>{let b=l.subpathsClosed?.[y]!==false,x=To(h,b),m=b&&x.length>2?x.length:x.length-1,g=[];for(let C=0;C<m;C+=1){let v=x[C],F=x[(C+1)%x.length],B=Math.hypot(F.x-v.x,F.y-v.y),p={x:-(F.y-v.y)/B,y:(F.x-v.x)/B};if(g.push(p),!!Io(v,F,-s,t+s,-s,n+s))for(let u=0;u<2;u+=1){let R=K[u],E=v.x+(F.x-v.x)*R,L=v.y+(F.y-v.y)*R;c(E+p.x*f,L+p.y*f),c(E-p.x*f,L-p.y*f);}}let S=b&&x.length>2?g.length:g.length-1;for(let C=0;C<S;C+=1){let v=x[(C+1)%x.length];if(!d(v))continue;let F=g[C],B=g[(C+1)%g.length],p=1+F.x*B.x+F.y*B.y;if(p<2/(bn*bn))continue;let u=F.y*-B.x- -F.x*B.y;if(u===0)continue;let R=u>0?-1:1;c(v.x+R*(F.x+B.x)*f/p,v.y+R*(F.y+B.y)*f/p);}});for(let h of l.arrowheadsEmu??[])if(!(!h[0]||!d(h[0])))for(let y of h)c(y.x,y.y);}return r>=0&&o>=0&&a<=t&&i<=n?j:Object.freeze({left:-r,top:-o,right:a-t,bottom:i-n})}function To(e,t){let n=[];for(let a of e){let i=n[n.length-1];(!i||i.x!==a.x||i.y!==a.y)&&n.push(a);}let r=n[0],o=n[n.length-1];return t&&n.length>1&&r.x===o.x&&r.y===o.y&&n.pop(),n}var K=new Float64Array(2);function Io(e,t,n,r,o,a){let i=t.x-e.x,c=t.y-e.y;return K[0]=0,K[1]=1,we(-i,e.x-n)&&we(i,r-e.x)&&we(-c,e.y-o)&&we(c,a-e.y)}function we(e,t){if(e===0)return t>=0;let n=t/e;return e<0?K[0]=Math.max(K[0],n):K[1]=Math.min(K[1],n),K[0]<=K[1]}function D(e){return (e.kerningEnabled??e.kerningMinPt>0)&&e.kerningMinPt>0&&e.fontSizePt>=e.kerningMinPt}var vn="Calibri, Carlito, Helvetica, Arial, sans-serif",si=new Map([["calibri","Carlito"]]),Bo=65536,Oo=256;function Rn(e,t){return e===void 0?Math.max(1,Math.floor(t)):Number.isFinite(e)&&e>0?Math.max(1,Math.floor(e)):1}function Cn(e){let t=new Map,n=0;return {get(r){let o=t.get(r);if(o!==void 0)return t.delete(r),t.set(r,o),o},set(r,o){for(t.has(r)&&t.delete(r),t.set(r,o);t.size>e;){let a=t.keys().next();if(a.done)break;t.delete(a.value),n+=1;}},get size(){return t.size},get evictions(){return n}}}var Fn=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function En(e=null){return e!=null&&typeof e.measureText=="function"}function Ln(e={}){let t=e.scale??1;if(!(t>0)||!Number.isFinite(t))return null;let n=e.fallbackFamily??vn,r=e.context??null;if(!En(r))return null;let o=r,a=Cn(Rn(e.maxWidthEntries,Bo)),i=Cn(Rn(e.maxMetricsEntries,Oo)),c=e.fontAlias,s=l=>{let f=l.fontFamily&&Fn.test(l.fontFamily)?l.fontFamily:null,h=f?c?.(f):void 0,y=h&&Fn.test(h)?h:null,b=f?y?`"${y}", "${f}", ${n}`:`"${f}", ${n}`:n,x=l.bold?"bold":"normal",m=l.italic?"italic":"normal",g=l.smallCaps?"small-caps":"normal",S=l.fontSizePt*chunk55AT3MOU_cjs.da(l)*t;return `${m} ${g} ${x} ${S}px ${b}`},d=(l,f,h)=>l/t*(h.horizontalScalePercent/100)+f.length*h.characterSpacingPt;return {measure(l,f){if(l.length===0)return 0;let h=s(f),y=`${h}\0${D(f)}\0${l}`,b=a.get(y);if(b!==void 0)return d(b,l,f);o.font=h,"fontKerning"in o&&(o.fontKerning=D(f)?"normal":"none");let x=o.measureText(l).width;return a.set(y,x),d(x,l,f)},inkBounds(l,f){if(!l||l.length>2||f.shaping?.direction==="rtl"||chunk55AT3MOU_cjs.ka(l).length!==1)return;o.font=s(f),"fontKerning"in o&&(o.fontKerning=D(f)?"normal":"none");let h=o.textAlign,y=o.direction,b;try{h!==void 0&&(o.textAlign="left"),y!==void 0&&(o.direction="ltr"),b=o.measureText(l);}finally{h!==void 0&&(o.textAlign=h),y!==void 0&&(o.direction=y);}let x=b.actualBoundingBoxLeft,m=b.actualBoundingBoxRight;if(x===void 0||m===void 0||!Number.isFinite(x)||!Number.isFinite(m))return;let g=f.horizontalScalePercent/(100*t);return {left:-x*g,right:m*g}},lineMetrics(l){let f=l.fontSizePt*chunk55AT3MOU_cjs.da(l),h=s(l),y=i.get(h);if(y)return y;let b=f*1.15,x=f*.8;o.font=h,"fontKerning"in o&&(o.fontKerning=D(l)?"normal":"none");let m=o.measureText("Hxg"),g=m.fontBoundingBoxAscent,S=m.fontBoundingBoxDescent;if(typeof g=="number"&&Number.isFinite(g)&&g>0&&(x=g/t,typeof S=="number"&&Number.isFinite(S)&&S>=0)){let v=(g+S)/t;v>0&&(b=Math.max(v,b));}b>0||(b=f*1.15);let C={height:b,baseline:x};return i.set(h,C),C}}}function wo(e=1,t={}){let n=Ln({...t,scale:t.scale??e});return n?{measurer:n,producer:t.fontAlias?"canvas-measurer+embedded":"canvas-measurer"}:{measurer:chunk55AT3MOU_cjs.fa(),producer:"fixed-measurer"}}function Ao(e){let t;return n=>{t===void 0&&(t=chunk55AT3MOU_cjs.gd(e.pages)?.hosts??null);let r=t?.get(n);return r?chunk55AT3MOU_cjs.ed(r.pageNumber,r.format):null}}function Tn(e,t){let n=chunk55AT3MOU_cjs.Hc(e,t.displayMode??chunk55AT3MOU_cjs.Xa),r=chunk55AT3MOU_cjs.Ec({numberingIndex:t.numberingIndex,styleCascade:t.styleCascade},n).listItems,o=t.package?{footnotesPart:chunk4KZ6L5YF_cjs.Lg(t.package,"footnote"),endnotesPart:chunk4KZ6L5YF_cjs.Lg(t.package,"endnote")}:void 0,a=chunk55AT3MOU_cjs.cd(n,r,o,t.package?chunk55AT3MOU_cjs.$c(t.package,e,n):void 0,t.displayMode??chunk55AT3MOU_cjs.Xa);return {blocks:n,notes:o,context:a}}function In(e,t,n,r,o){for(let a of t){if(r.length>=chunk4KZ6L5YF_cjs.Di)return;if(n.tokenForParagraph(a.id)!==""&&chunk4KZ6L5YF_cjs.Gi(e,a.id)===null)for(let i of chunk4KZ6L5YF_cjs.Fi(a)){if(r.length>=chunk4KZ6L5YF_cjs.Di)return;if(!i.rewritable)continue;let c=chunk55AT3MOU_cjs.Hb(i.instruction);if(c===null)continue;let s=n.liveValueOf(i.fieldNodeId,c);if(s===null&&o&&n.pageRefProjectionOf){let d=n.pageRefProjectionOf(i.fieldNodeId,c);if(d){let l=o(d.targetParagraphId);l!==null&&l.length>0&&chunk55AT3MOU_cjs.fd(d.calibration,d.cached,l,Number.NaN)&&(s=l);}}s===null||s===i.cachedText||s.length>chunk4KZ6L5YF_cjs.Ei||s.includes("\r")||r.push({paragraphId:a.id,fieldNodeId:i.fieldNodeId,text:s});}}}function Po(e,t){let{blocks:n,context:r}=Tn(e,t);if(r===null)return null;let o=[];return In(e,chunk55AT3MOU_cjs.Cc(chunk55AT3MOU_cjs.wc(n)),r,o,t.pageRefPageNumberOf),o.length===0?null:{op:"refreshFieldResults",updates:o}}function Si(e,t){let{notes:n,context:r}=Tn(e,t);if(r===null||n===void 0)return [];let o=[],a=[{noteKind:"footnote",notesPart:n.footnotesPart},{noteKind:"endnote",notesPart:n.endnotesPart}];for(let{noteKind:i,notesPart:c}of a){if(!c)continue;let s=[];for(let d of chunk55AT3MOU_cjs.ad(c,t.displayMode??chunk55AT3MOU_cjs.Xa)){if(s.length>=chunk4KZ6L5YF_cjs.Di)break;In(c,chunk55AT3MOU_cjs.Cc(chunk55AT3MOU_cjs.wc(d)),r,s);}s.length>0&&o.push({noteKind:i,op:{op:"refreshFieldResults",updates:s}});}return o}function _o(e){return e.box}function Bn(e,t){if(e.kind==="paragraph"){t.add(e.paragraphId);return}for(let n of e.rows)for(let r of n.cells)for(let o of r.blocks)Bn(o,t);}function Mo(e){let t=new Map,n=(o,a,i)=>{if(!(o.kind==="textValue"||i>chunk4KZ6L5YF_cjs.yb*4)){for(let c of o.children)if(c.kind!=="textValue"){if(c.kind==="paragraph"){for(let s of r)t.get(s)?.push(c.id);n(c,c.id,i+1);continue}if(c.kind==="contentControl"){t.set(c.id,[]),r.push(c.id);let s=chunk4KZ6L5YF_cjs.Ib(c);s&&n(s,a,i+1),r.pop();let d=t.get(c.id);d&&d.length===0&&a!==null&&d.push(a);continue}n(c,a,i+1);}}},r=[];return n(e,null,0),t}function zo(e,t){let n=Math.min(e.x,t.x),r=Math.min(e.y,t.y);return {x:n,y:r,width:Math.max(e.x+e.width,t.x+t.width)-n,height:Math.max(e.y+e.height,t.y+t.height)-r}}function ko(e,t){let n=chunk4KZ6L5YF_cjs.Mb(e.root);if(n.length===0)return No;let r=new Map;t.pages.forEach((i,c)=>{(d=>{for(let l of d){let f=new Set;Bn(l,f);for(let h of f){let y=r.get(h)??[];y.push({pageIndex:c,box:_o(l)}),r.set(h,y);}}})(i.fragments);});let o=Mo(e.root),a=[];for(let i of n){let c=chunk4KZ6L5YF_cjs.Kb(i.node),s=[...i.ancestors.map(h=>chunk4KZ6L5YF_cjs.Kb(h).lock),c.lock],d=o.get(i.node.id)??[],l=new Map;for(let h of d)for(let y of r.get(h)??[]){let b=l.get(y.pageIndex);l.set(y.pageIndex,b?zo(b,y.box):y.box);}let f=[...l.entries()].sort((h,y)=>h[0]-y[0]).map(([h,y])=>({pageIndex:h,...y}));a.push({controlId:i.node.id,type:c.type,level:chunk4KZ6L5YF_cjs.Lb(i.node),depth:i.depth,lock:c.lock,effectiveLock:chunk4KZ6L5YF_cjs.Pb(s),showingPlaceholder:c.showingPlaceholder,temporary:c.temporary,...c.tag===void 0?{}:{tag:c.tag},...c.alias===void 0?{}:{alias:c.alias},...c.id===void 0?{}:{id:c.id},...c.dataBinding===void 0?{}:{dataBinding:c.dataBinding},paragraphIds:d,fragments:f});}return a}var No=Object.freeze([]);function wn(e,t,n){let r=e.lines?.find(o=>{let a=o.spans;if(!a)return n<o.range.end;let i=a.filter(c=>c.range.paragraphId===t);return i.length===a.length?n<o.range.end:i.length>0&&n<i[i.length-1].range.end});return r?r.box.y:e.fragmentY}function $o(e,t){let n=new Map;for(let r of e.pages)for(let[o,a]of qo(r,t))n.has(o)||n.set(o,a);return n}var On=new WeakMap;function qo(e,t){let n=On.get(t);n||(n=new WeakMap,On.set(t,n));let r=n.get(e);if(r)return r;let o=new Map;for(let a of t(e)){let i=new Set([a.paragraphId]);for(let c of a.lines??[])for(let s of c.spans??[])i.add(s.range.paragraphId);for(let c of i)o.has(c)||o.set(c,{pageIndex:e.index,contentY:e.contentBox.y,fragmentY:a.box.y,...a.lines?{lines:a.lines}:{}});}return n.set(e,o),o}function Zo(e,t){let n=chunkAVKVRU7Z_cjs.va(e);if(!n)return null;let r=t.get(n.start.paragraphId);return r?{pageIndex:r.pageIndex,y:r.contentY+wn(r,n.start.paragraphId,n.start.offset)}:null}var An=new WeakMap;function Jo(e){let t=An.get(e);if(t!==void 0)return t;let n=chunk55AT3MOU_cjs.i(e),r=new DataView(n.buffer,n.byteOffset,n.byteLength),o=false,a=r.getUint32(0)===1953784678?r.getUint32(12+e.faceIndex*4):0,i=r.getUint16(a+4);for(let c=0;c<i;c++){let s=a+12+c*16;if(r.getUint32(s)!==1330851634)continue;let d=r.getUint32(s+8),l=r.getUint32(s+12);l>=86&&d<=n.byteLength-l&&r.getUint16(d)>=1&&(o=(r.getUint32(d+78)&1966080)!==0);break}return An.set(e,o),o}function Pn(e,t,n,r,o){if(r>o||Math.abs(n.height-t)>o||!Jo(e))return n;let a=t*.3;return {height:n.height+a,baseline:n.baseline+a/2}}var Qo="abcdefghijklmnopqrstuvwxyz";function Z(e){let t=Math.round(e.fontSizePt*2);return Math.max(1,t)}function X(e,t,n,r,o){let a=r.shaping?.context;return e.shape({text:o,fontSizeHalfPoints:Z(r),bidiLevel:r.shaping?.direction==="rtl"?1:0,environment:ea(t,n,r),...a?{context:a}:{}})}var _n=new WeakMap;function ea(e,t,n){if(!Object.isFrozen(e)||!Object.isFrozen(e.features)||!Object.isFrozen(e.variationAxes)||!Object.isFrozen(e.shapingLibrary))return Mn(e,t,n);let r=n.shaping?.direction??"ltr",o=n.shaping?.script,a=`${r}|${o??""}|${D(n)?1:0}|${e.documentLigatures?chunk55AT3MOU_cjs.B(n):""}|${n.smallCaps?1:0}`,i=_n.get(e);i||_n.set(e,i=new WeakMap);let c=i.get(t);c||i.set(t,c=new Map);let s=c.get(a);return s||c.set(a,s=Mn(e,t,n)),s}function Mn(e,t,n){return chunk55AT3MOU_cjs.p({...e,font:t,direction:n.shaping?.direction??"ltr",script:n.shaping?.script==="Zyyy"?e.script:n.shaping?.script??e.script,features:{...e.features,kern:D(n)?1:0,...e.documentLigatures?chunk55AT3MOU_cjs.A(n):{},...n.smallCaps?{smcp:1}:{}},fallbackOrder:[]})}function Ae(e,t,n,r,o){let a=o.get(n);if(a!==void 0)return a;let i=true;try{for(let c of Qo){let s=X(e,t,n,{...r,smallCaps:!0},c),d=X(e,t,n,{...r,smallCaps:!1},c);if(!(s.glyphs.length!==d.glyphs.length||s.glyphs.some((f,h)=>f.id!==d.glyphs[h]?.id))){i=!1;break}}}catch{i=false;}return o.set(n,i),i}function zn(e,t,n,r,o){let a=new WeakMap;return (i,c)=>{let s=chunk55AT3MOU_cjs.da(c),d=a.get(i);d||(d=new Map,a.set(i,d));let l=Z(c),f=d.get(l);if(f)return s===1?f:{height:f.height*s,baseline:f.baseline*s};let h,y=true,b=i.substitution?.lineMetrics;if(b){let x=l/2;h={height:b.heightEm*x,baseline:b.baselineEm*x};}else try{let x=X(e,t,i,c,""),m=x.metrics.ascent/t.fixedPointScale,g=x.metrics.descent/t.fixedPointScale,S=l/2,C=m+g,v=S*r,F=C>v?v/C:1,B=C*F,p=Math.min(Math.max(0,x.metrics.lineGap/t.fixedPointScale),B*o),u=B+p;u>0?h=Pn(i,S,{height:u,baseline:m*F+p},p,2/t.fixedPointScale):(h=n.lineMetrics(c),y=!1);}catch{h=n.lineMetrics(c),y=false;}return y?(d.set(l,h),s===1?h:{height:h.height*s,baseline:h.baseline*s}):h}}var pt=new WeakMap;function ta(e){let t=pt.get(e);if(t!==void 0)return t??void 0;let n=e.path;if(!n.startsWith("M")||n.length>1e6||/[^MLQCZ0-9eE+.,\s-]/u.test(n))return;let r=1/0,o=-1/0,a=n.matchAll(/([MLQCZ])([^MLQCZ]*)/gu);for(let c of a){let s=c[1]==="Z"?0:c[1]==="C"?6:c[1]==="Q"?4:2,d=c[2].trim().split(/[\s,]+/u).filter(Boolean).map(Number);if(d.length!==s||d.some(l=>!Number.isFinite(l))){pt.set(e,null);return}for(let l=0;l<d.length;l+=2)r=Math.min(r,d[l]),o=Math.max(o,d[l]);}let i=Number.isFinite(r)&&Number.isFinite(o)?{left:r,right:o}:void 0;return pt.set(e,i??null),i}function kn(e,t,n,r){if(e.clusters.length!==1||e.glyphs.length===0)return;let o=1/0,a=-1/0;for(let c of e.glyphs){if(c.id===0)return;let s=ta(c.outline),d=c.outline.unitsPerEm;if(!s||!(d>0))return;let l=(c.originX+c.offsetX)/n;o=Math.min(o,l+s.left*t*(c.drawScale??1)/d),a=Math.max(a,l+s.right*t*(c.drawScale??1)/d);}let i={left:o*r,right:a*r};return Number.isFinite(i.left)&&Number.isFinite(i.right)?i:void 0}function na(e,t,n){if(t<12)return null;if(e.getUint32(0)!==1953784678)return 0;let o=12+(Number.isSafeInteger(n)&&n>0?n:0)*4;if(o+4>t)return null;let a=e.getUint32(o);return a+12<=t?a:null}function Nn(e,t,n,r,o){let a=e.getUint16(n+4);if(a>4096||n+12+a*16>t)return null;for(let i=0;i<a;i+=1){let c=n+12+i*16;if(e.getUint32(c)!==r)continue;let s=e.getUint32(c+8),d=e.getUint32(c+12);return d<o||s+d>t?null:s}return null}function Dn(e,t){let n=e.byteLength,r=new DataView(e.buffer,e.byteOffset,n),o=na(r,n,t);if(o===null)return null;let a=Nn(r,n,o,1751474532,54);if(a===null)return null;let i=r.getUint16(a+18);if(i<=0)return null;let c=Nn(r,n,o,1330851634,30);if(c===null)return null;let s=r.getInt16(c+26)/i,d=r.getInt16(c+28)/i;return !(s>0)||s>1||!(Math.abs(d)<=1)?null:{offsetEm:d,thicknessEm:s}}var ra=.5,oa=4,Hn=4096;function Un(e){let t="environment"in e?e.environment:void 0,n="environment"in e?void 0:e,{shaper:r,resolveFont:o,fallback:a}=e,i=t??{shapingLibrary:n.shapingLibrary,unicodeDataVersion:n.unicodeDataVersion,script:n?.script??"Latn",fixedPointScale:n?.fixedPointScale??1e3,normalization:n?.normalization??"none",features:n?.features??{},roundingMode:n?.roundingMode??"halfToEven",language:n?.language??"en",variationAxes:{}},c=new WeakMap,s=new WeakMap,d=zn(r,i,a,oa,ra),l=new WeakMap,f=new WeakMap,h=new Array(Hn),y=0,b=(p,u,R)=>{let E=h[y];E&&E.cache.delete(E.text),p.set(u,R),h[y]={cache:p,text:u},y=(y+1)%Hn;},x=p=>{let u=l.get(p);if(u!==void 0)return u;let R=o(p);return l.set(p,R),R},m=(p,u,R)=>{let E=R?s:c,L=E.get(p);L||(L=new Map,E.set(p,L));let I=L.get(u);return I||(I=new Map,L.set(u,I)),I},g=new WeakMap,S=p=>{if(!p.shaping?.wordSpacingPt)return p;let u=g.get(p);return u||(u={...p,shaping:{...p.shaping,wordSpacingPt:void 0}},g.set(p,u)),u},C=(p,u)=>u.shaping?.wordSpacingPt?chunk55AT3MOU_cjs.Qd(p)*u.shaping.wordSpacingPt:0,v=(p,u)=>a.measure(p,S(u))+C(p,u),F=(p,u)=>{let R=Math.max(0,a.measure(p,S(u))),E=a.caretAdvances?.(p,S(u))??chunk55AT3MOU_cjs.Od(p,R);if(!E||E.length!==p.length+1)return chunk55AT3MOU_cjs.Od(p,v(p,u));let L=Math.max(0,v(p,u)),I=0,A=0;return E.map((w,M)=>{if(M===0)return 0;p[M-1]===" "&&A++;let O=w+A*(u.shaping?.wordSpacingPt??0);return I=Math.max(I,Math.min(L,Number.isFinite(O)?O:I)),M===p.length?L:I})},B=new WeakMap;return {hasResolvedFont(p){return x(p)!==null},strikeoutMetrics(p){let u=x(p);if(!u)return;let R=B.get(u);if(R===void 0&&(R=Dn(u.bytes,u.faceIndex),B.set(u,R)),!R)return;let E=Z(p)/2*chunk55AT3MOU_cjs.da(p);return {offsetPt:R.offsetEm*E,thicknessPt:R.thicknessEm*E}},measure(p,u){if(p.length===0)return 0;let R=x(u);if(!R)return v(p,u);let E=m(R,Z(u),u.smallCaps),L=u.shaping?.context,I=u.shaping?`1:${JSON.stringify(L?[u.shaping.script,u.shaping.direction,p,L.before,L.after]:[u.shaping.script,u.shaping.direction,p])}`:`0:${p}`,A=`${D(u)?1:0}:${chunk55AT3MOU_cjs.B(u)}:${I}`,w=E.get(A);if(w===void 0){let M=0;try{if(u.smallCaps&&!Ae(r,i,R,u,f))return v(p,u);let O=X(r,i,R,u,p);if(O.glyphs.some(H=>H.id===0))return v(p,u);for(let H of O.glyphs)M+=H.advanceX;}catch{return v(p,u)}w=M/i.fixedPointScale,b(E,A,w);}return w*chunk55AT3MOU_cjs.da(u)*(u.horizontalScalePercent/100)+p.length*u.characterSpacingPt+C(p,u)},inkBounds(p,u){if(!p||p.length>2||u.shaping?.direction==="rtl"||chunk55AT3MOU_cjs.ka(p).length!==1)return;let R=x(u);if(!R)return a.inkBounds?.(p,u);try{if(u.smallCaps&&!Ae(r,i,R,u,f))return a.inkBounds?.(p,u);let E=X(r,i,R,u,p);return kn(E,Z(u)/2,i.fixedPointScale,chunk55AT3MOU_cjs.da(u)*u.horizontalScalePercent/100)}catch{return}},caretAdvances(p,u){let R=x(u);if(!R)return F(p,u);try{if(u.smallCaps&&!Ae(r,i,R,u,f))return F(p,u);let E=X(r,i,R,u,p);return E.glyphs.some(L=>L.id===0)?F(p,u):chunk55AT3MOU_cjs.Pd(p,E,chunk55AT3MOU_cjs.da(u)*(u.horizontalScalePercent/100)/i.fixedPointScale,u.characterSpacingPt,u.shaping?.wordSpacingPt??0)??chunk55AT3MOU_cjs.Od(p,E.glyphs.reduce((L,I)=>L+I.advanceX,0)*chunk55AT3MOU_cjs.da(u)*(u.horizontalScalePercent/100)/i.fixedPointScale+p.length*u.characterSpacingPt+C(p,u))}catch{return F(p,u)}},lineMetrics(p,u){let R=x(p);if(!R)return a.lineMetrics(p,u);if(!u||/^[\t\n\r\f ]*$/.test(u))return d(R,p);try{let E=X(r,i,R,p,u),L=0,I=0;for(let A of E.fontSpans){let w=d(A.font,p);L=Math.max(L,w.baseline),I=Math.max(I,w.height-w.baseline);}if(L+I>0)return {height:L+I,baseline:L}}catch{}return d(R,p)}}}function aa(e,t){return Un({...t,shaper:e.shaper,environment:e.environment})}function ia(e){let{layout:t,viewport:n}=e,r=new Set;if(!n){for(let s of t.pages)r.add(s.index);return r}let o=Math.max(0,Math.trunc(e.overscanPages??1)),a=n.top+n.height,i=-1,c=-1;for(let s of t.pages){let d=s.box.y;d+s.box.height>=n.top&&d<=a&&(i===-1&&(i=s.index),c=s.index);}if(i===-1){let s=sa(t,n.top);s!==null&&(i=s,c=s);}if(i!==-1){let s=Math.max(0,i-o),d=Math.min(t.pages.length-1,c+o);for(let l=s;l<=d;l+=1)r.add(l);}for(let s of e.pinnedPages??[])s>=0&&s<t.pages.length&&r.add(s);return r}function sa(e,t){let n=null,r=Number.POSITIVE_INFINITY;for(let o of e.pages){let a=t<o.box.y?o.box.y-t:t>o.box.y+o.box.height?t-(o.box.y+o.box.height):0;a<r&&(r=a,n=o.index);}return n}var Gn=["text-local","paragraph-local","flow-structural","global"];function Wn(e,t){return Gn.indexOf(t)>Gn.indexOf(e)?t:e}function ca(e){return {impact:"text-local",paragraphIds:new Set,created:new Set,deleted:new Set,dependencyKeys:new Set,structural:false,revision:e}}function la(e){let{run:t,currentRevision:n,publish:r,schedule:o}=e,a=null,i=null,c=null,s=0,d=0;function l(m){let g=e.runCooperatively;if(!g)return t(m);let S=g(m);c=S;try{for(;;){let C=S.step();if(C)return C;if(n()!==m.revision)return S.cancel(),d+=1,null;if(c!==S)return null}}finally{c===S&&(c=null);}}function f(m){let g=y(n());g.impact=Wn(g.impact,m.impact),g.structural=g.structural||m.structural;for(let S of m.paragraphIds)g.paragraphIds.add(S);for(let S of m.created)g.created.add(S);for(let S of m.deleted)g.deleted.add(S);for(let S of m.dependencyKeys)g.dependencyKeys.add(S);}let h=m=>({impact:m.impact,paragraphIds:m.paragraphIds,created:m.created,deleted:m.deleted,dependencyKeys:m.dependencyKeys,structural:m.structural,revision:m.revision});function y(m){return a||(a=ca(m)),a.revision=Math.max(a.revision,m),a}function b(){!o||i||(i=o(()=>{i=null,x();}));}function x(){i&&(i(),i=null),c&&(c.cancel(),c=null,d+=1);let m=a;if(!m)return false;a=null;let g=h(m),S=l(g);return !S||S.revision!==n()?(s+=1,f(g),b(),false):(r(S,g),true)}return {notify(m){let g=y(n());g.impact=Wn(g.impact,m.impact);for(let S of m.dirty)g.paragraphIds.add(S);for(let S of m.created)g.created.add(S),g.paragraphIds.add(S);for(let S of m.deleted)g.deleted.add(S),g.paragraphIds.add(S);for(let S of m.dependencyKeys)g.dependencyKeys.add(S);for(let S of m.splitJoin)g.structural=true,"split"in S?(g.paragraphIds.add(S.split.from),g.paragraphIds.add(S.split.tail)):(g.paragraphIds.add(S.join.kept),g.paragraphIds.add(S.join.removed));(m.impact==="flow-structural"||m.impact==="global")&&(g.structural=true),b();},invalidateAll(m,g){let S=y(m);S.impact="flow-structural",S.structural=true,g&&S.dependencyKeys.add(g),b();},flush:x,pending:()=>a?h(a):null,cancel(){i?.(),i=null,c?.cancel(),c=null,a=null;},get staleDiscards(){return s},get cancelledRuns(){return d}}}var Kn=new WeakMap;function V(e){let t=Kn.get(e);if(t)return t;let n=new Map,r=new Map,o=new Map,a=new Map,i=(s,d,l,f)=>{for(let h of s){if(h.kind==="paragraph")continue;let y=h.tableId;a.set(y,Math.max(a.get(y)??0,(h.columnEdges?.length??1)-1));let b=o.get(y);b||(b=new Map,o.set(y,b),n.set(y,[]),r.set(y,new Map));for(let x of h.rows){let m=b.get(x.id);m===void 0&&(m=b.size,b.set(x.id,m),r.get(y).set(m,x.cells));for(let g of x.cells)n.get(y).push({pageIndex:d,tableId:y,row:x,cell:g,rowIndex:m,isHeaderRepeat:x.isHeaderRepeat,offsetX:l,offsetY:f}),i(g.blocks,d,l,f);}}};for(let s of e.pages){i(s.fragments,s.index,0,0);for(let d of [s.header,s.footer])d&&i(d.fragments,s.index,d.box.x-s.contentBox.x,d.box.y-s.contentBox.y);for(let d of [s.footnotes,s.endnotes])if(d)for(let l of d.notes)i(l.fragments,s.index,l.box.x-s.contentBox.x,l.box.y-s.contentBox.y);}let c=new Map;for(let[s,d]of n)c.set(s,{placed:d,rows:r.get(s)??new Map,columnCount:a.get(s)??0});return Kn.set(e,c),c}function Yn(e){let t=e.columnCount;for(let n of e.rows.values())for(let r of n)t=Math.max(t,Y(r).to+1);return t}var Y=e=>({from:e.gridColumn,to:e.gridColumn+Math.max(1,e.gridSpan)-1});function da(e,t,n){if(t.tableId!==n.tableId)return null;let r=V(e).get(t.tableId);if(!r)return null;let o=Math.min(t.rowIndex,n.rowIndex),a=Math.max(t.rowIndex,n.rowIndex),i=Math.min(Y(t).from,Y(n).from),c=Math.max(Y(t).to,Y(n).to),s=y=>{let{from:b,to:x}=Y(y);return x>=i&&b<=c},d=y=>(r.rows.get(y)??[]).some(b=>b.vMergeContinue&&s(b)),l=r.rows.size+Yn(r)+2;for(let y=0;!(y>l);y+=1){let b=false;for(let[x,m]of r.rows)if(!(x<o||x>a))for(let g of m){if(!s(g))continue;let{from:S,to:C}=Y(g);S<i&&(i=S,b=true),C>c&&(c=C,b=true);}for(;o>0&&d(o);)o-=1,b=true;for(;d(a+1);)a+=1,b=true;if(!b)break}let f=[],h=new Set;for(let y of r.placed){if(y.isHeaderRepeat||y.rowIndex<o||y.rowIndex>a)continue;let{from:b,to:x}=Y(y.cell);x<i||b>c||h.has(y.cell.id)||(h.add(y.cell.id),f.push(y.cell.id));}return f.length===0?null:{kind:"cells",tableId:t.tableId,cellIds:f,rows:{from:o,to:a},columns:{from:i,to:c},text:ua(e,t.tableId,f)}}function ts(e,t){return $n(e,t,true)}function Pe(e,t){return $n(e,t,false)}function $n(e,t,n){let r=new Set(t),o=[],a=new Set;for(let i of V(e).values())for(let c of i.placed)if(!(c.isHeaderRepeat||!r.has(c.cell.id)))for(let s of c.cell.blocks)n&&s.kind!=="paragraph"||ne(s,o,a);return o}function ne(e,t,n){if(e.kind==="paragraph"){for(let r of chunk55AT3MOU_cjs.Na(e))n.has(r)||(n.add(r),t.push(r));return}for(let r of e.rows)if(!r.isHeaderRepeat)for(let o of r.cells)for(let a of o.blocks)ne(a,t,n);}function ua(e,t,n){let r=Pe(e,n),o=r[0],a=r[r.length-1];return !o||!a?pa(e,t):{anchor:{paragraphId:o,offset:0},head:{paragraphId:a,offset:chunk55AT3MOU_cjs.nf(e,a).length}}}function pa(e,t){let n=V(e).get(t);for(let o of n?.placed??[]){if(o.isHeaderRepeat)continue;let a=[];for(let c of o.cell.blocks)ne(c,a,new Set);let i=a[0];if(i){let c={paragraphId:i,offset:0};return {anchor:c,head:c}}}for(let o of e.pages)for(let a of chunk55AT3MOU_cjs.va(o)){let i={paragraphId:a.paragraphId,offset:0};return {anchor:i,head:i}}let r={paragraphId:"",offset:0};return {anchor:r,head:r}}function fa(e){let t=[...chunk55AT3MOU_cjs.va(e)];for(let n of [e.header,e.footer])n&&t.push(...chunk55AT3MOU_cjs.wa(n.fragments));for(let n of [e.footnotes,e.endnotes])if(n)for(let r of n.notes)t.push(...chunk55AT3MOU_cjs.wa(r.fragments));return t}function ya(e,t){let n=new Set(Pe(e,t)),r=[],o=new Set;for(let a of e.pages)for(let i of fa(a))if(n.has(i.paragraphId))for(let c of i.lines)for(let s of c.spans){let d=`${s.range.paragraphId}:${s.range.start}:${s.range.end}`;o.has(d)||(o.add(d),r.push(s));}return r}function ma(e,t){let n=new Set(t),r=[];for(let o of V(e).values())for(let a of o.placed)n.has(a.cell.id)&&r.push({pageIndex:a.pageIndex,x:a.cell.box.x+a.offsetX,y:a.cell.box.y+a.offsetY,width:a.cell.box.width,height:a.cell.box.height});return r}function ha(e,t,n=chunk55AT3MOU_cjs.nf){let r=V(e).get(t.tableId);if(!r)return "";let o=new Set(t.cellIds),a=r.placed.some(s=>s.cell.logicalGridColumn!==void 0),i=new Map,c=new Set;for(let s of r.placed){if(s.isHeaderRepeat||!o.has(s.cell.id)||c.has(s.cell.id))continue;c.add(s.cell.id);let d=Pe(e,[s.cell.id]).map(h=>n(e,h)).join(`
2
2
  `),l=i.get(s.rowIndex),f=s.cell.gridColumn+(a?Math.max(1,s.cell.gridSpan)-1:0);l?l.set(f,d):i.set(s.rowIndex,new Map([[f,d]]));}return [...i.keys()].sort((s,d)=>s-d).map(s=>{let d=i.get(s),l=[];for(let f=0;f<=t.columns.to-t.columns.from;f+=1){let h=a?t.columns.to-f:t.columns.from+f;l.push(d.get(h)??"");}return l.join(" ")}).join(`
3
3
  `)}function ft(e,t){return Sa(e).get(t)??null}var Xn=new WeakMap;function ga(e){let t=Xn.get(e);if(t)return t;let n=[];for(let r of e.blocks)ne(r,n,new Set);return Xn.set(e,n),n}var Vn=new WeakMap;function Sa(e){let t=Vn.get(e);if(t)return t;let n=new Map;for(let[r,o]of V(e)){let a;for(let i of o.placed)if(!i.isHeaderRepeat)for(let c of ga(i.cell)){let s=n.get(c);s&&s.tableId.length>=r.length||(a??=Yn(o),n.set(c,{tableId:r,rows:o.rows.size,columns:a,rowIndex:i.rowIndex,columnIndex:i.cell.logicalGridColumn??i.cell.gridColumn}));}}return Vn.set(e,n),n}function ns(e,t,n){if(n){let a=ft(e,t);if(!a||a.tableId!==n.tableId)return null;let i=n.cellIds[0];if(!i)return null;let c=V(e).get(n.tableId);if(!c)return null;for(let s of c.placed)if(s.cell.id===i)return {tableId:n.tableId,rowId:s.row.id,cellId:i,cellIds:n.cellIds,gridColumnIndex:s.cell.logicalGridColumn??s.cell.gridColumn,isHeaderRepeat:s.isHeaderRepeat};return null}let r=ft(e,t);if(!r)return null;let o=V(e).get(r.tableId);if(!o)return null;for(let a of o.placed){if(a.isHeaderRepeat)continue;let i=[];for(let c of a.cell.blocks)ne(c,i,new Set);if(i.includes(t))return {tableId:r.tableId,rowId:a.row.id,cellId:a.cell.id,cellIds:[a.cell.id],gridColumnIndex:a.cell.logicalGridColumn??a.cell.gridColumn,isHeaderRepeat:a.row.isHeaderRepeat}}return null}var jn=new WeakMap;function rs(e,t){let n=jn.get(e);if(n)return n.get(t)??null;let r=new Map;for(let[o,a]of V(e))for(let i of a.placed){if(i.isHeaderRepeat)continue;let c=[];for(let d of i.cell.blocks)ne(d,c,new Set);let s={tableId:o,rowId:i.row.id,cellId:i.cell.id,rowIndex:i.rowIndex,gridColumn:i.cell.gridColumn,gridSpan:i.cell.gridSpan};for(let d of c){let l=r.get(d);l&&l.tableId.length>=o.length||r.set(d,s);}}return jn.set(e,r),r.get(t)??null}function ba(e,t,n){if(![e,t,n].every(Number.isFinite)||t<=0||n<=0)return {offsetPt:0,count:0};let r=Math.ceil(e/n-1e-9)*n;if(!Number.isFinite(r))return {offsetPt:0,count:0};let o=Math.max(0,r-e);return {offsetPt:o,count:Math.min(8192,Math.max(0,Math.floor((t-o)/n+1e-9)))}}exports.$=Ae;exports.A=un;exports.B=pn;exports.C=fn;exports.D=yn;exports.E=mn;exports.F=uo;exports.G=po;exports.H=te;exports.I=mo;exports.J=dt;exports.K=Sn;exports.L=Ro;exports.M=vo;exports.N=D;exports.O=vn;exports.P=si;exports.Q=En;exports.R=Ln;exports.S=wo;exports.T=Ao;exports.U=Po;exports.V=Si;exports.W=ko;exports.X=wn;exports.Y=$o;exports.Z=Zo;exports._=X;exports.a=Ze;exports.aa=Un;exports.b=tr;exports.ba=aa;exports.c=q;exports.ca=ia;exports.d=Qe;exports.da=la;exports.e=nr;exports.ea=da;exports.f=T;exports.fa=ts;exports.g=et;exports.ga=Pe;exports.h=rt;exports.ha=ya;exports.i=Pa;exports.ia=ma;exports.j=W;exports.ja=ha;exports.k=Jr;exports.ka=ft;exports.l=Qr;exports.la=ns;exports.m=Da;exports.ma=rs;exports.n=at;exports.na=ba;exports.o=Ha;exports.p=eo;exports.q=no;exports.r=Ua;exports.s=ro;exports.t=it;exports.u=Be;exports.v=oo;exports.w=ao;exports.x=io;exports.y=ct;exports.z=dn;
@@ -1 +1 @@
1
- import {h,a,b,e,c,f,gc,ib,lb,nb,ob,mb,Zc,jb,kb,jd,xc,ge,fe,Gd,hc,gd,jc}from'./chunk-XSHXBJ2J.js';import {a as a$1}from'./chunk-5BIASAN3.js';import {oa,fa,pa,Jc,a as a$2}from'./chunk-DDGGSBAN.js';var _e=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function $(e){let n=new Map;for(let t of e)if(Array.isArray(t)){for(let r of t.slice(0,2048)){if(typeof r!="string"||!_e.test(r))continue;let o=r.toLowerCase();if(n.has(o)||n.set(o,r),n.size===2048)break}if(n.size===2048)break}return Object.freeze([...n.values()])}function Ze(e){let n=e&&"failures"in e?e.failures:void 0;return e==null||(e.sources?.length??0)===0&&(e.substitutions?.length??0)===0&&(n===void 0||Array.isArray(n)&&n.length===0)?void 0:e}var en=64,ee=Object.freeze({family:"Calibri",sizeHalfPoints:22}),nn=ee;function Ce(e,...n){let t=[e,...n],r=[],o=new Set;for(let a of t)for(let d of a.sources??[]){let c=h(d.request);o.has(c)||(o.add(c),r.push(d));}let i=[],s=new Set;for(let a of t)for(let d of a.substitutions??[]){let c=h(d.from);o.has(c)||s.has(c)||(s.add(c),i.push(d));}let u=$(t.map(a=>a.supportedFamilies));return Object.freeze({...u.length?{supportedFamilies:u}:{},epoch:e.epoch??0,maxFontBytes:e.maxFontBytes??a,sources:Object.freeze(r),...i.length>0?{substitutions:Object.freeze(i)}:{},defaultFont:e.defaultFont??ee,...e.language!==void 0?{language:e.language}:{}})}var Me=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function ve(e){let n=e?.defaultFont?.family;return n!==void 0&&Me.test(n)?n:ee.family}var Be="docx-editor.dev/font-resolver",Ae=Symbol.for("docx-editor.dev/font-resolver");function ln(e){let n={value:true,enumerable:false,configurable:true};try{Object.defineProperty(e,Ae,n),Object.defineProperty(e,Be,n);}catch(t){throw new TypeError("defineFontResolver cannot mark a frozen or sealed function; mark it before freezing, or wrap it in a fresh function and mark that.",{cause:t})}return e}function un(e){return typeof e=="function"&&e[Ae]===true}var te=class extends RangeError{constructor(t,r,o){super(`Font source ${t.family} (${r} bytes) exceeds the shaping byte ceiling (${o} bytes)`);this.request=t;}request},oe=class extends AggregateError{causes;constructor(n){let t=Object.freeze(n.slice(0,b*2));super(t,`Font origin rejected all ${t.length} face and substitution candidates`),this.causes=t;}},Y=e=>`${e.family.trim().toLowerCase()} ${e.weight} ${e.style}`;function Pe(e,n,t){let r=new Map(e.map(o=>[Y(o),o]));for(let[o,i]of n)r.set(o,i);for(let o of t)r.has(Y(o.to))&&r.set(Y(o.from),o.from);return [...r.values()]}async function cn(e,n,t={}){return Te(e,n,t)}async function dn(e,n,t={}){return Te(e,n,t)}async function Te(e,n,t){let r=t.maxExecutionFontBytes??a;if(!Number.isSafeInteger(r)||r<=0||r>a)throw new RangeError("Font execution byte ceiling is outside the supported range");let o=e.map(Le),i,s=[],u=[],a$1=new Map,d=new Set,c=0,f=[],y=new Set,b$1=[],T=n.resolvedFaces??[],N=n.defaultFamily;for(let x=0;x<e.length;x+=1){Ne(n.signal);let v=e[x],I=Pe(T,a$1,f),L;try{let F=o[x],E;if(F){let l=await ke(F,n.signal);if(!l.ok)throw l.cause;E=l.value;}else if(typeof v=="function"){let l=await ke(Promise.resolve(v(De(n,N,I,c))).then(m=>({ok:!0,value:m}),m=>({ok:!1,cause:m})),n.signal);if(!l.ok)throw l.cause;E=l.value;}else E=v;if(E==null)continue;if(typeof E=="function"){V(t,v,x,new TypeError("A font origin answered with a function; pass the resolver itself rather than a function returning one"));continue}let k="failures"in E?E.failures:void 0,_=[];if(Array.isArray(k)){let l=Math.min(k.length,b);for(let m=0;m<l;m++)_.push(k[m]);k.length>l&&_.push(new Error("Additional font-origin failures were omitted"));}else k!==void 0&&_.push(k);let R;try{R=qe(E,d,c,y,i?"maxFontBytes"in i&&i.maxFontBytes!==void 0?i.maxFontBytes:a:void 0,t.reserveOwnedBytes,t.instrumentation,r);}catch(l){for(let m of new Set(_))V(t,v,x,m);throw l}L=R;for(let l of new Set([...R.dropped,..._]))V(t,v,x,l);let O=R.fragment;O.supportedFamilies&&s.push(O.supportedFamilies),b$1.push(..._);let U=(O.sources??[]).map(l=>(h(l.request),[Y(l.request),l.request])),g=[...O.substitutions??[]];!i&&"defaultFont"in O&&(N=ve(O)),i||(i=O);let p=new Set(R.sourceKeys);if(p.size>0){f=f.filter(l=>!p.has(h(l.from)));for(let l of p)y.delete(l);}u.push(...O.sources??[]);for(let l of R.sourceKeys)d.add(l);c+=R.ownedBytes;for(let[l,m]of U)a$1.set(l,m);for(let l of g)f.push(l),y.add(h(l.from));}catch(F){if(L?.releaseOwnedBytes?.(),n.signal?.aborted)throw n.signal.reason??F;if(F instanceof G)throw F.cause;V(t,v,x,F);continue}}if(!i)return;let{epoch:P,...D}=Ce({...i,supportedFamilies:$(s),sources:u,substitutions:f});return b$1.length===0?D:{...D,failures:Object.freeze(b$1)}}var G=class extends Error{constructor(t){super("Unable to reserve owned font bytes");this.cause=t;this.name="FontOwnershipReservationError";}cause},W=class extends RangeError{};async function ke(e,n){if(!n)return e;Ne(n);let t,r=new Promise((i,s)=>{t=s;}),o=()=>t?.(n.reason);n.addEventListener("abort",o,{once:true});try{return await Promise.race([e,r])}finally{n.removeEventListener("abort",o);}}function Le(e){if(e===null||typeof e!="object")return;let n;try{n=e.then;}catch(t){return Promise.resolve({ok:false,cause:t})}if(typeof n=="function")return Promise.resolve(e).then(t=>({ok:true,value:t}),t=>({ok:false,cause:t}))}function qe(e$1,n,t,r,o,i,s,u=a){let a$1=e$1.sources??[],d=e$1.substitutions??[],c$1="maxFontBytes"in e$1?e$1.maxFontBytes:void 0,f$1="defaultFont"in e$1?e$1.defaultFont:void 0,y="epoch"in e$1?e$1.epoch:void 0,b$1="language"in e$1?e$1.language:void 0;if(!Array.isArray(a$1)||!Array.isArray(d))throw new TypeError("Font origin sources and substitutions must be arrays");let T=a$1.length,N=d.length;if(T>b)throw new RangeError(`Font source count must not exceed ${b}`);if(N>b)throw new RangeError(`Font substitution count must not exceed ${b}`);let P=c$1??a;if(!Number.isSafeInteger(P)||P<=0||P>a)throw new RangeError(`Font byte ceiling must be a positive safe integer no greater than ${a}`);let D=Math.min(o??P,u),x=0,v=[],I=new Set,L=[],F=[];for(let g=0;g<T;g+=1){let p=a$1[g];try{let l=ne(p.request),m=h(l);if(n.has(m)||I.has(m))continue;let A=p.availability,w=p.faceIndex,M=p.hash,Z=p.id;if(A!==void 0&&A!=="available"&&A!=="forbidden")throw new TypeError("Font source availability must be available or forbidden");if(!Number.isSafeInteger(w)||w<0)throw new RangeError("Font face index must be a non-negative safe integer");if(typeof M!="string"||M.length===0)throw new TypeError("Font source hash must be a non-empty string");let K;if(A!=="forbidden"){if(typeof Z!="string"||Z.length===0)throw new TypeError("Font source id must be a non-empty string");K=p.bytes;let q=e(K);if(q>D)throw q<=(o??P)?new te(l,q,u):new RangeError(`Font source ${l.family} (${q} bytes) exceeds the effective base byte ceiling (${D} bytes)`);if(n.has(m)||I.has(m))continue;if(t+x+q>c)throw new RangeError(`Font sources exceed the aggregate byte ceiling of ${c}`);x+=q;}else K=new Uint8Array(0);if(n.has(m)||I.has(m))continue;if(n.size+I.size>=b)throw new W(`Font source count must not exceed ${b}`);I.add(m),v.push(m),L.push(Object.freeze({request:l,id:Z,bytes:K,hash:M,faceIndex:w,...A?{availability:A}:{}}));}catch(l){if(l instanceof W)throw l;F.push(l);}}let E=new Set,k=[];for(let g=0;g<N;g+=1){let p=d[g];try{let l=ne(p.from),m=ne(p.to);h(l),h(m);let A=p.lineMetrics,w=A?Object.freeze({heightEm:A.heightEm,baselineEm:A.baselineEm}):void 0;if(w&&(!Number.isFinite(w.heightEm)||!Number.isFinite(w.baselineEm)||w.heightEm<=0||w.heightEm>4||w.baselineEm<0||w.baselineEm>w.heightEm))throw new RangeError("Font substitution line metrics must fit within a bounded em box");let M=h(l);if(n.has(M)||I.has(M)||r.has(M)||E.has(M))continue;E.add(M),k.push(Object.freeze({from:l,to:m,...w?{lineMetrics:w}:{}}));}catch(l){F.push(l);}}if((T>0||N>0)&&L.length===0&&k.length===0&&F.length>0)throw F.length===1?F[0]:new oe(F);let _=r.size;for(let g of I)r.has(g)&&(_-=1);if(_+E.size>b)throw new RangeError(`Font substitution count must not exceed ${b}`);let R;if(f$1!==void 0){let g=f$1.family,p=f$1.sizeHalfPoints;if(h({family:g,weight:400,style:"normal"}),!Number.isSafeInteger(p)||p<=0)throw new RangeError("Default font size must be a positive safe integer in half-points");R=Object.freeze({family:g,sizeHalfPoints:p});}if(y!==void 0&&(!Number.isSafeInteger(y)||y<0))throw new RangeError("Font configuration epoch must be a non-negative safe integer");if(b$1!==void 0&&typeof b$1!="string")throw new TypeError("Font shaping language must be a string");let O;if(x>0&&i)try{O=i(x);}catch(g){throw new G(g)}let U;try{U=L.map(g=>f(g,s));}catch(g){throw O?.(),g}return {fragment:Object.freeze({supportedFamilies:$([e$1.supportedFamilies]),sources:Object.freeze(U),substitutions:Object.freeze(k),...y!==void 0?{epoch:y}:{},...c$1!==void 0?{maxFontBytes:c$1}:{},...R?{defaultFont:R}:{},...b$1!==void 0?{language:b$1}:{}}),sourceKeys:Object.freeze(v),ownedBytes:x,dropped:Object.freeze(F),releaseOwnedBytes:O}}function ze(e){return !Number.isSafeInteger(e)||e<=0?0:e>c?c:e}function De(e,n,t,r){let{committedSourceBytes:o,...i}=e,s=ze(r);return {...i,defaultFamily:n,...t.length>0?{resolvedFaces:t}:{},...s>0?{committedSourceBytes:s}:{}}}function ne(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}function Ne(e){if(e?.aborted)throw e.reason??new DOMException("Font resolution was aborted","AbortError")}function V(e,n,t,r){let o;try{typeof n=="function"&&n.name.length>0&&(o=n.name);}catch{}let i=Object.freeze({originIndex:t,...o!==void 0?{originName:o}:{},cause:r});if(e.onOriginFailure)try{let u=e.onOriginFailure(i);Promise.resolve(u).catch(a=>{console.warn("[fonts] font-origin diagnostic callback failed",a);});return}catch(u){console.warn("[fonts] font-origin diagnostic callback failed",u);}let s="";try{r instanceof Error&&r.message.length>0&&(s=`: ${r.message}`);}catch{}console.warn(`[fonts] a font origin failed and was skipped${s}`,r);}function J(e){let n=new WeakMap;return (t,r)=>{let o=new Set;for(let i of t){let s=[{node:i,context:r,next:0}],u=a=>{s.pop();let d=s.at(-1)?.found??o;for(let c of a)d.add(c);};for(;s.length;){let a=s[s.length-1],d=n.get(a.node);if(d?.key===a.context.key){u(d.families);continue}if(!a.children){let y=e(a.node,a.context);a.children=y.children,a.found=new Set(y.families);}let c=a.children[a.next++];if(c){s.push({...c,next:0});continue}let f=[...a.found];f.length<=256?n.set(a.node,{key:a.context.key,families:f}):n.delete(a.node),u(f);}}return [...o]}}function Q(e,n){return e.children.flatMap(t=>t.kind==="textValue"?[]:[{node:t,context:n}])}function je(e,n){let{styles:t,theme:r,supplementalFamilies:o,depth:i}=n;if(e.kind==="table"){let a=Gd(e,468,i,t),d=[];for(let c of a?.rows??[])for(let f of c.cells){let y={...n,depth:i+1,cellStyle:f.styleFormatting,key:`${n.baseKey}|${i+1}|${JSON.stringify(f.styleFormatting)}`};for(let b of f.blocks)d.push({node:b,context:y});}return {children:d.reverse()}}let s=new Set;if(e.kind==="paragraph"){let a=e.children.find(c=>c.kind==="paragraphProperties"),d=hc(t,a,n.cellStyle).runProperties;for(let c of gd(e,d,void 0,(f,y)=>jc(f,y,t),void 0,void 0,"all-markup",void 0,void 0,r)){if(!c.text||c.fontSlot!=="eastAsia"&&!o.has(c.style.fontFamily??""))continue;let f=a$1((c.fontSlot==="eastAsia"?c.style.fontFamilyEastAsia:c.style.fontFamily)??void 0);f&&s.add(f);}}let u=e.localName==="txbxContent"?{...n,cellStyle:void 0,key:`${n.baseKey}|${i}|undefined`}:n;return {families:[...s],children:Q(e,u).reverse()}}function $e(){let e=J(je),n,t;return (r,o,i)=>{if(!n||t!==o||n.theme!==i){let s=gc(o,i);t=o,n={key:`${s.cacheToken}|0|undefined`,baseKey:s.cacheToken,styles:s,theme:i,depth:0,supplementalFamilies:new Set([...Object.values(i.majorSupplemental??{}),...Object.values(i.minorSupplemental??{})])};}return e([...r].reverse(),n)}}function bn(e,n,t){return $e()(e,n,t)}function re(e,n){return e.attributes.find(t=>t.localName===n)?.value}var Ue=J((e,n)=>{let t=[];if(e.namespaceUri===fa){if(e.localName==="fldSimple"){let r=Zc(re(e,"instr")??"")?.font;r&&t.push(r);}if(e.localName==="p")for(let r of Ke(e))t.push(r);}return {families:t,children:Q(e,n)}});function Nn(e){let n=new Map;for(let t of Ue(e,{key:""})){let r=a$1(t);r!==null&&!n.has(r.toLowerCase())&&n.set(r.toLowerCase(),r);}return [...n.values()]}function Ke(e){let n=[],t=ib(),r=[];for(let o=e.children.length-1;o>=0;o-=1){let i=e.children[o];i.kind!=="textValue"&&r.push({node:i,containerDepth:0});}for(;r.length>0;){let{node:o,containerDepth:i}=r.pop();if(i>=oa||o.namespaceUri===fa&&o.localName==="p")continue;if(o.namespaceUri===fa&&o.localName==="fldChar"){let u=re(o,"fldCharType");u==="begin"?lb(t):u==="separate"?(t.nesting===1&&Ie(t,n),nb(t)):u==="end"&&(t.nesting===1&&Ie(t,n),ob(t));continue}if(o.namespaceUri===fa&&(o.localName==="instrText"||o.localName==="delInstrText")){mb(t,He(o),o.localName==="delInstrText");continue}if(o.namespaceUri===fa&&o.localName==="fldSimple"){let u=Zc(re(o,"instr")??"");u?.font&&n.push(u.font);}let s=pa(o,i);for(let u=o.children.length-1;u>=0;u-=1){let a=o.children[u];a.kind!=="textValue"&&r.push({node:a,containerDepth:s});}}return jb(t),n}function Ie(e,n){let t=kb(e);if(t.overflow)return;let r=Zc(t.instruction);r?.font&&n.push(r.font);}function He(e){let n="",t=[...e.children].reverse();for(;t.length>0&&n.length<=256;){let r=t.pop();if(r.kind==="textValue")n+=r.value;else for(let o=r.children.length-1;o>=0;o-=1)t.push(r.children[o]);}return n}var Xe=()=>true;function In(e,n,t,r){if(!n)return [];let o=jd(n),i=gc(t,r),s=new Map;for(let u of e)for(let a of Ve(u)){let d=Jc(a.children),c=f=>{if(f)for(let y of f.values())for(let b of [y.markerStyle.fontFamily,y.markerStyle.fontFamilyEastAsia]){let T=a$1(b??void 0);if(T===null)continue;let N=T.toLowerCase();s.has(N)||s.set(N,T);}};c(xc(d,o,i,Xe));for(let f of d){let y=ge(f);for(let b of y.contents)c(fe(b,o,i));}}return [...s.values()].sort((u,a)=>u.localeCompare(a))}function Ve(e){if(e.localName==="document"){for(let n of e.children)if(n.kind!=="textValue"&&n.localName==="body")return [n];return []}if(e.localName==="footnotes"||e.localName==="endnotes"){let n=[];for(let t of e.children)t.kind!=="textValue"&&(t.localName==="footnote"||t.localName==="endnote")&&n.push(t);return n}return [e]}var Ye={regular:{weight:400,style:"normal"},bold:{weight:700,style:"normal"},italic:{weight:400,style:"italic"},boldItalic:{weight:700,style:"italic"}};function Bn(e,n){let t=[],r=[],o=0;for(let i of e){let s=i.bytes.byteLength;if(!Number.isSafeInteger(s)||s>n||s>a||s>c-o){r.push(i);continue}o+=s,t.push(i);}return {sources:t,dropped:r}}function Pn(e,n,t){let r=n.reduce((i,s)=>i+s.bytes.byteLength,0),o=new Set(n.filter(i=>i.request.family.trim().length>0).map(i=>h(i.request)));return Ge(e,{maxFontBytes:t,aggregateBudget:Math.max(0,c-r),shadowedRequests:o})}function Ge(e,n){let t=[],r=[],o=n.aggregateBudget,i=new Set;for(let s of e){let u=Ye[s.style],a=Object.freeze({family:s.family,weight:u.weight,style:u.style});if(s.family.trim().length===0){r.push({request:a,partName:s.partName,reason:"malformed"});continue}let d=h(a);if(!(n.shadowedRequests?.has(d)||i.has(d))){if(i.add(d),s.bytes.byteLength>n.maxFontBytes||s.bytes.byteLength>o){r.push({request:a,partName:s.partName,reason:"overLimit"});continue}o-=s.bytes.byteLength,t.push({request:a,id:`embedded:${s.partName}#${s.style}`,bytes:s.bytes,hash:a$2(s.bytes),faceIndex:0});}}return {sources:t,dropped:r}}export{$ as a,Ze as b,en as c,ee as d,nn as e,Ce as f,ve as g,Be as h,Ae as i,ln as j,un as k,te as l,oe as m,cn as n,dn as o,Bn as p,Pn as q,Ge as r,J as s,Q as t,$e as u,bn as v,Nn as w,Ke as x,In as y};
1
+ import {h,a,b,e,c,f,mc,zb,Cb,Eb,Fb,Db,dd,Ab,Bb,pd,Dc,me,le,Md,nc,md,pc}from'./chunk-VIPMGGUT.js';import {a as a$1}from'./chunk-HAQ72KD7.js';import {oa,fa,pa,Jc,a as a$2}from'./chunk-UMRSBLO7.js';var _e=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function $(e){let n=new Map;for(let t of e)if(Array.isArray(t)){for(let r of t.slice(0,2048)){if(typeof r!="string"||!_e.test(r))continue;let o=r.toLowerCase();if(n.has(o)||n.set(o,r),n.size===2048)break}if(n.size===2048)break}return Object.freeze([...n.values()])}function Ze(e){let n=e&&"failures"in e?e.failures:void 0;return e==null||(e.sources?.length??0)===0&&(e.substitutions?.length??0)===0&&(n===void 0||Array.isArray(n)&&n.length===0)?void 0:e}var en=64,ee=Object.freeze({family:"Calibri",sizeHalfPoints:22}),nn=ee;function Ce(e,...n){let t=[e,...n],r=[],o=new Set;for(let a of t)for(let d of a.sources??[]){let c=h(d.request);o.has(c)||(o.add(c),r.push(d));}let i=[],s=new Set;for(let a of t)for(let d of a.substitutions??[]){let c=h(d.from);o.has(c)||s.has(c)||(s.add(c),i.push(d));}let u=$(t.map(a=>a.supportedFamilies));return Object.freeze({...u.length?{supportedFamilies:u}:{},epoch:e.epoch??0,maxFontBytes:e.maxFontBytes??a,sources:Object.freeze(r),...i.length>0?{substitutions:Object.freeze(i)}:{},defaultFont:e.defaultFont??ee,...e.language!==void 0?{language:e.language}:{}})}var Me=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function ve(e){let n=e?.defaultFont?.family;return n!==void 0&&Me.test(n)?n:ee.family}var Be="docx-editor.dev/font-resolver",Ae=Symbol.for("docx-editor.dev/font-resolver");function ln(e){let n={value:true,enumerable:false,configurable:true};try{Object.defineProperty(e,Ae,n),Object.defineProperty(e,Be,n);}catch(t){throw new TypeError("defineFontResolver cannot mark a frozen or sealed function; mark it before freezing, or wrap it in a fresh function and mark that.",{cause:t})}return e}function un(e){return typeof e=="function"&&e[Ae]===true}var te=class extends RangeError{constructor(t,r,o){super(`Font source ${t.family} (${r} bytes) exceeds the shaping byte ceiling (${o} bytes)`);this.request=t;}request},oe=class extends AggregateError{causes;constructor(n){let t=Object.freeze(n.slice(0,b*2));super(t,`Font origin rejected all ${t.length} face and substitution candidates`),this.causes=t;}},Y=e=>`${e.family.trim().toLowerCase()} ${e.weight} ${e.style}`;function Pe(e,n,t){let r=new Map(e.map(o=>[Y(o),o]));for(let[o,i]of n)r.set(o,i);for(let o of t)r.has(Y(o.to))&&r.set(Y(o.from),o.from);return [...r.values()]}async function cn(e,n,t={}){return Te(e,n,t)}async function dn(e,n,t={}){return Te(e,n,t)}async function Te(e,n,t){let r=t.maxExecutionFontBytes??a;if(!Number.isSafeInteger(r)||r<=0||r>a)throw new RangeError("Font execution byte ceiling is outside the supported range");let o=e.map(Le),i,s=[],u=[],a$1=new Map,d=new Set,c=0,f=[],y=new Set,b$1=[],T=n.resolvedFaces??[],N=n.defaultFamily;for(let x=0;x<e.length;x+=1){Ne(n.signal);let v=e[x],I=Pe(T,a$1,f),L;try{let F=o[x],E;if(F){let l=await ke(F,n.signal);if(!l.ok)throw l.cause;E=l.value;}else if(typeof v=="function"){let l=await ke(Promise.resolve(v(De(n,N,I,c))).then(m=>({ok:!0,value:m}),m=>({ok:!1,cause:m})),n.signal);if(!l.ok)throw l.cause;E=l.value;}else E=v;if(E==null)continue;if(typeof E=="function"){V(t,v,x,new TypeError("A font origin answered with a function; pass the resolver itself rather than a function returning one"));continue}let k="failures"in E?E.failures:void 0,_=[];if(Array.isArray(k)){let l=Math.min(k.length,b);for(let m=0;m<l;m++)_.push(k[m]);k.length>l&&_.push(new Error("Additional font-origin failures were omitted"));}else k!==void 0&&_.push(k);let R;try{R=qe(E,d,c,y,i?"maxFontBytes"in i&&i.maxFontBytes!==void 0?i.maxFontBytes:a:void 0,t.reserveOwnedBytes,t.instrumentation,r);}catch(l){for(let m of new Set(_))V(t,v,x,m);throw l}L=R;for(let l of new Set([...R.dropped,..._]))V(t,v,x,l);let O=R.fragment;O.supportedFamilies&&s.push(O.supportedFamilies),b$1.push(..._);let U=(O.sources??[]).map(l=>(h(l.request),[Y(l.request),l.request])),g=[...O.substitutions??[]];!i&&"defaultFont"in O&&(N=ve(O)),i||(i=O);let p=new Set(R.sourceKeys);if(p.size>0){f=f.filter(l=>!p.has(h(l.from)));for(let l of p)y.delete(l);}u.push(...O.sources??[]);for(let l of R.sourceKeys)d.add(l);c+=R.ownedBytes;for(let[l,m]of U)a$1.set(l,m);for(let l of g)f.push(l),y.add(h(l.from));}catch(F){if(L?.releaseOwnedBytes?.(),n.signal?.aborted)throw n.signal.reason??F;if(F instanceof G)throw F.cause;V(t,v,x,F);continue}}if(!i)return;let{epoch:P,...D}=Ce({...i,supportedFamilies:$(s),sources:u,substitutions:f});return b$1.length===0?D:{...D,failures:Object.freeze(b$1)}}var G=class extends Error{constructor(t){super("Unable to reserve owned font bytes");this.cause=t;this.name="FontOwnershipReservationError";}cause},W=class extends RangeError{};async function ke(e,n){if(!n)return e;Ne(n);let t,r=new Promise((i,s)=>{t=s;}),o=()=>t?.(n.reason);n.addEventListener("abort",o,{once:true});try{return await Promise.race([e,r])}finally{n.removeEventListener("abort",o);}}function Le(e){if(e===null||typeof e!="object")return;let n;try{n=e.then;}catch(t){return Promise.resolve({ok:false,cause:t})}if(typeof n=="function")return Promise.resolve(e).then(t=>({ok:true,value:t}),t=>({ok:false,cause:t}))}function qe(e$1,n,t,r,o,i,s,u=a){let a$1=e$1.sources??[],d=e$1.substitutions??[],c$1="maxFontBytes"in e$1?e$1.maxFontBytes:void 0,f$1="defaultFont"in e$1?e$1.defaultFont:void 0,y="epoch"in e$1?e$1.epoch:void 0,b$1="language"in e$1?e$1.language:void 0;if(!Array.isArray(a$1)||!Array.isArray(d))throw new TypeError("Font origin sources and substitutions must be arrays");let T=a$1.length,N=d.length;if(T>b)throw new RangeError(`Font source count must not exceed ${b}`);if(N>b)throw new RangeError(`Font substitution count must not exceed ${b}`);let P=c$1??a;if(!Number.isSafeInteger(P)||P<=0||P>a)throw new RangeError(`Font byte ceiling must be a positive safe integer no greater than ${a}`);let D=Math.min(o??P,u),x=0,v=[],I=new Set,L=[],F=[];for(let g=0;g<T;g+=1){let p=a$1[g];try{let l=ne(p.request),m=h(l);if(n.has(m)||I.has(m))continue;let A=p.availability,w=p.faceIndex,M=p.hash,Z=p.id;if(A!==void 0&&A!=="available"&&A!=="forbidden")throw new TypeError("Font source availability must be available or forbidden");if(!Number.isSafeInteger(w)||w<0)throw new RangeError("Font face index must be a non-negative safe integer");if(typeof M!="string"||M.length===0)throw new TypeError("Font source hash must be a non-empty string");let K;if(A!=="forbidden"){if(typeof Z!="string"||Z.length===0)throw new TypeError("Font source id must be a non-empty string");K=p.bytes;let q=e(K);if(q>D)throw q<=(o??P)?new te(l,q,u):new RangeError(`Font source ${l.family} (${q} bytes) exceeds the effective base byte ceiling (${D} bytes)`);if(n.has(m)||I.has(m))continue;if(t+x+q>c)throw new RangeError(`Font sources exceed the aggregate byte ceiling of ${c}`);x+=q;}else K=new Uint8Array(0);if(n.has(m)||I.has(m))continue;if(n.size+I.size>=b)throw new W(`Font source count must not exceed ${b}`);I.add(m),v.push(m),L.push(Object.freeze({request:l,id:Z,bytes:K,hash:M,faceIndex:w,...A?{availability:A}:{}}));}catch(l){if(l instanceof W)throw l;F.push(l);}}let E=new Set,k=[];for(let g=0;g<N;g+=1){let p=d[g];try{let l=ne(p.from),m=ne(p.to);h(l),h(m);let A=p.lineMetrics,w=A?Object.freeze({heightEm:A.heightEm,baselineEm:A.baselineEm}):void 0;if(w&&(!Number.isFinite(w.heightEm)||!Number.isFinite(w.baselineEm)||w.heightEm<=0||w.heightEm>4||w.baselineEm<0||w.baselineEm>w.heightEm))throw new RangeError("Font substitution line metrics must fit within a bounded em box");let M=h(l);if(n.has(M)||I.has(M)||r.has(M)||E.has(M))continue;E.add(M),k.push(Object.freeze({from:l,to:m,...w?{lineMetrics:w}:{}}));}catch(l){F.push(l);}}if((T>0||N>0)&&L.length===0&&k.length===0&&F.length>0)throw F.length===1?F[0]:new oe(F);let _=r.size;for(let g of I)r.has(g)&&(_-=1);if(_+E.size>b)throw new RangeError(`Font substitution count must not exceed ${b}`);let R;if(f$1!==void 0){let g=f$1.family,p=f$1.sizeHalfPoints;if(h({family:g,weight:400,style:"normal"}),!Number.isSafeInteger(p)||p<=0)throw new RangeError("Default font size must be a positive safe integer in half-points");R=Object.freeze({family:g,sizeHalfPoints:p});}if(y!==void 0&&(!Number.isSafeInteger(y)||y<0))throw new RangeError("Font configuration epoch must be a non-negative safe integer");if(b$1!==void 0&&typeof b$1!="string")throw new TypeError("Font shaping language must be a string");let O;if(x>0&&i)try{O=i(x);}catch(g){throw new G(g)}let U;try{U=L.map(g=>f(g,s));}catch(g){throw O?.(),g}return {fragment:Object.freeze({supportedFamilies:$([e$1.supportedFamilies]),sources:Object.freeze(U),substitutions:Object.freeze(k),...y!==void 0?{epoch:y}:{},...c$1!==void 0?{maxFontBytes:c$1}:{},...R?{defaultFont:R}:{},...b$1!==void 0?{language:b$1}:{}}),sourceKeys:Object.freeze(v),ownedBytes:x,dropped:Object.freeze(F),releaseOwnedBytes:O}}function ze(e){return !Number.isSafeInteger(e)||e<=0?0:e>c?c:e}function De(e,n,t,r){let{committedSourceBytes:o,...i}=e,s=ze(r);return {...i,defaultFamily:n,...t.length>0?{resolvedFaces:t}:{},...s>0?{committedSourceBytes:s}:{}}}function ne(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}function Ne(e){if(e?.aborted)throw e.reason??new DOMException("Font resolution was aborted","AbortError")}function V(e,n,t,r){let o;try{typeof n=="function"&&n.name.length>0&&(o=n.name);}catch{}let i=Object.freeze({originIndex:t,...o!==void 0?{originName:o}:{},cause:r});if(e.onOriginFailure)try{let u=e.onOriginFailure(i);Promise.resolve(u).catch(a=>{console.warn("[fonts] font-origin diagnostic callback failed",a);});return}catch(u){console.warn("[fonts] font-origin diagnostic callback failed",u);}let s="";try{r instanceof Error&&r.message.length>0&&(s=`: ${r.message}`);}catch{}console.warn(`[fonts] a font origin failed and was skipped${s}`,r);}function J(e){let n=new WeakMap;return (t,r)=>{let o=new Set;for(let i of t){let s=[{node:i,context:r,next:0}],u=a=>{s.pop();let d=s.at(-1)?.found??o;for(let c of a)d.add(c);};for(;s.length;){let a=s[s.length-1],d=n.get(a.node);if(d?.key===a.context.key){u(d.families);continue}if(!a.children){let y=e(a.node,a.context);a.children=y.children,a.found=new Set(y.families);}let c=a.children[a.next++];if(c){s.push({...c,next:0});continue}let f=[...a.found];f.length<=256?n.set(a.node,{key:a.context.key,families:f}):n.delete(a.node),u(f);}}return [...o]}}function Q(e,n){return e.children.flatMap(t=>t.kind==="textValue"?[]:[{node:t,context:n}])}function je(e,n){let{styles:t,theme:r,supplementalFamilies:o,depth:i}=n;if(e.kind==="table"){let a=Md(e,468,i,t),d=[];for(let c of a?.rows??[])for(let f of c.cells){let y={...n,depth:i+1,cellStyle:f.styleFormatting,key:`${n.baseKey}|${i+1}|${JSON.stringify(f.styleFormatting)}`};for(let b of f.blocks)d.push({node:b,context:y});}return {children:d.reverse()}}let s=new Set;if(e.kind==="paragraph"){let a=e.children.find(c=>c.kind==="paragraphProperties"),d=nc(t,a,n.cellStyle).runProperties;for(let c of md(e,d,void 0,(f,y)=>pc(f,y,t),void 0,void 0,"all-markup",void 0,void 0,r)){if(!c.text||c.fontSlot!=="eastAsia"&&!o.has(c.style.fontFamily??""))continue;let f=a$1((c.fontSlot==="eastAsia"?c.style.fontFamilyEastAsia:c.style.fontFamily)??void 0);f&&s.add(f);}}let u=e.localName==="txbxContent"?{...n,cellStyle:void 0,key:`${n.baseKey}|${i}|undefined`}:n;return {families:[...s],children:Q(e,u).reverse()}}function $e(){let e=J(je),n,t;return (r,o,i)=>{if(!n||t!==o||n.theme!==i){let s=mc(o,i);t=o,n={key:`${s.cacheToken}|0|undefined`,baseKey:s.cacheToken,styles:s,theme:i,depth:0,supplementalFamilies:new Set([...Object.values(i.majorSupplemental??{}),...Object.values(i.minorSupplemental??{})])};}return e([...r].reverse(),n)}}function bn(e,n,t){return $e()(e,n,t)}function re(e,n){return e.attributes.find(t=>t.localName===n)?.value}var Ue=J((e,n)=>{let t=[];if(e.namespaceUri===fa){if(e.localName==="fldSimple"){let r=dd(re(e,"instr")??"")?.font;r&&t.push(r);}if(e.localName==="p")for(let r of Ke(e))t.push(r);}return {families:t,children:Q(e,n)}});function Nn(e){let n=new Map;for(let t of Ue(e,{key:""})){let r=a$1(t);r!==null&&!n.has(r.toLowerCase())&&n.set(r.toLowerCase(),r);}return [...n.values()]}function Ke(e){let n=[],t=zb(),r=[];for(let o=e.children.length-1;o>=0;o-=1){let i=e.children[o];i.kind!=="textValue"&&r.push({node:i,containerDepth:0});}for(;r.length>0;){let{node:o,containerDepth:i}=r.pop();if(i>=oa||o.namespaceUri===fa&&o.localName==="p")continue;if(o.namespaceUri===fa&&o.localName==="fldChar"){let u=re(o,"fldCharType");u==="begin"?Cb(t):u==="separate"?(t.nesting===1&&Ie(t,n),Eb(t)):u==="end"&&(t.nesting===1&&Ie(t,n),Fb(t));continue}if(o.namespaceUri===fa&&(o.localName==="instrText"||o.localName==="delInstrText")){Db(t,He(o),o.localName==="delInstrText");continue}if(o.namespaceUri===fa&&o.localName==="fldSimple"){let u=dd(re(o,"instr")??"");u?.font&&n.push(u.font);}let s=pa(o,i);for(let u=o.children.length-1;u>=0;u-=1){let a=o.children[u];a.kind!=="textValue"&&r.push({node:a,containerDepth:s});}}return Ab(t),n}function Ie(e,n){let t=Bb(e);if(t.overflow)return;let r=dd(t.instruction);r?.font&&n.push(r.font);}function He(e){let n="",t=[...e.children].reverse();for(;t.length>0&&n.length<=256;){let r=t.pop();if(r.kind==="textValue")n+=r.value;else for(let o=r.children.length-1;o>=0;o-=1)t.push(r.children[o]);}return n}var Xe=()=>true;function In(e,n,t,r){if(!n)return [];let o=pd(n),i=mc(t,r),s=new Map;for(let u of e)for(let a of Ve(u)){let d=Jc(a.children),c=f=>{if(f)for(let y of f.values())for(let b of [y.markerStyle.fontFamily,y.markerStyle.fontFamilyEastAsia]){let T=a$1(b??void 0);if(T===null)continue;let N=T.toLowerCase();s.has(N)||s.set(N,T);}};c(Dc(d,o,i,Xe));for(let f of d){let y=me(f);for(let b of y.contents)c(le(b,o,i));}}return [...s.values()].sort((u,a)=>u.localeCompare(a))}function Ve(e){if(e.localName==="document"){for(let n of e.children)if(n.kind!=="textValue"&&n.localName==="body")return [n];return []}if(e.localName==="footnotes"||e.localName==="endnotes"){let n=[];for(let t of e.children)t.kind!=="textValue"&&(t.localName==="footnote"||t.localName==="endnote")&&n.push(t);return n}return [e]}var Ye={regular:{weight:400,style:"normal"},bold:{weight:700,style:"normal"},italic:{weight:400,style:"italic"},boldItalic:{weight:700,style:"italic"}};function Bn(e,n){let t=[],r=[],o=0;for(let i of e){let s=i.bytes.byteLength;if(!Number.isSafeInteger(s)||s>n||s>a||s>c-o){r.push(i);continue}o+=s,t.push(i);}return {sources:t,dropped:r}}function Pn(e,n,t){let r=n.reduce((i,s)=>i+s.bytes.byteLength,0),o=new Set(n.filter(i=>i.request.family.trim().length>0).map(i=>h(i.request)));return Ge(e,{maxFontBytes:t,aggregateBudget:Math.max(0,c-r),shadowedRequests:o})}function Ge(e,n){let t=[],r=[],o=n.aggregateBudget,i=new Set;for(let s of e){let u=Ye[s.style],a=Object.freeze({family:s.family,weight:u.weight,style:u.style});if(s.family.trim().length===0){r.push({request:a,partName:s.partName,reason:"malformed"});continue}let d=h(a);if(!(n.shadowedRequests?.has(d)||i.has(d))){if(i.add(d),s.bytes.byteLength>n.maxFontBytes||s.bytes.byteLength>o){r.push({request:a,partName:s.partName,reason:"overLimit"});continue}o-=s.bytes.byteLength,t.push({request:a,id:`embedded:${s.partName}#${s.style}`,bytes:s.bytes,hash:a$2(s.bytes),faceIndex:0});}}return {sources:t,dropped:r}}export{$ as a,Ze as b,en as c,ee as d,nn as e,Ce as f,ve as g,Be as h,Ae as i,ln as j,un as k,te as l,oe as m,cn as n,dn as o,Bn as p,Pn as q,Ge as r,J as s,Q as t,$e as u,bn as v,Nn as w,Ke as x,In as y};