@docx-editor.dev/core 2.21.1 → 2.23.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 (108) hide show
  1. package/README.md +11 -5
  2. package/dist/automation.cjs +1 -1
  3. package/dist/automation.d.ts +13 -12
  4. package/dist/automation.js +1 -1
  5. package/dist/binding.cjs +1 -1
  6. package/dist/binding.d.ts +11 -10
  7. package/dist/binding.js +1 -1
  8. package/dist/chunk-4OAXZNBU.js +5 -0
  9. package/dist/chunk-6745I4XF.cjs +20 -0
  10. package/dist/chunk-6KA3L3FR.cjs +11 -0
  11. package/dist/chunk-6QS5WL63.js +1 -0
  12. package/dist/{chunk-E5OUYRNM.cjs → chunk-BUDXZ7T2.cjs} +5 -5
  13. package/dist/chunk-DYRXA5UJ.cjs +2 -0
  14. package/dist/chunk-DZOGUV7O.js +1 -0
  15. package/dist/chunk-EHT4LKKZ.cjs +1 -0
  16. package/dist/chunk-F5LAOPAD.js +20 -0
  17. package/dist/chunk-FWX535CS.cjs +1 -0
  18. package/dist/chunk-GRVRQBKU.js +1 -0
  19. package/dist/chunk-JN62FLHE.cjs +4 -0
  20. package/dist/{chunk-BF2TOG2V.js → chunk-KRBBWATQ.js} +1 -1
  21. package/dist/chunk-KV5HFE23.cjs +2 -0
  22. package/dist/{chunk-T5B4NMKF.cjs → chunk-PCPBDYEL.cjs} +1 -1
  23. package/dist/chunk-Q4RDWB3U.cjs +18 -0
  24. package/dist/{chunk-4TYA4RLP.cjs → chunk-QK23BSRK.cjs} +1 -1
  25. package/dist/chunk-QTFAXWVI.cjs +1 -0
  26. package/dist/chunk-RLO64PHP.cjs +1 -0
  27. package/dist/chunk-T7RGKBCE.cjs +5 -0
  28. package/dist/{chunk-FPDIJ4RF.js → chunk-UMBHUW6R.js} +1 -1
  29. package/dist/chunk-VE6H5EJA.js +5 -0
  30. package/dist/chunk-WHG23WNI.js +1 -0
  31. package/dist/chunk-XBYZTDF7.js +4 -0
  32. package/dist/chunk-XRBPZCNK.js +11 -0
  33. package/dist/chunk-Y5JCIWTF.js +2 -0
  34. package/dist/chunk-ZA6HEWUM.js +2 -0
  35. package/dist/chunk-ZCRSPN4Q.js +18 -0
  36. package/dist/collaboration/replication.cjs +1 -1
  37. package/dist/collaboration/replication.d.ts +6 -5
  38. package/dist/collaboration/replication.js +1 -1
  39. package/dist/collaboration.d.ts +7 -6
  40. package/dist/contracts/document.d.ts +4 -3
  41. package/dist/contracts/editor.d.ts +9 -9
  42. package/dist/contracts/interaction.d.ts +2 -1
  43. package/dist/contracts/modules.d.ts +9 -8
  44. package/dist/contracts/types.d.ts +1 -1
  45. package/dist/{custom-node-writes-CncR6KfC.d.ts → custom-node-writes-77rvPW2-.d.ts} +4 -3
  46. package/dist/{document-protection-DM6mA8Rf.d.ts → document-protection-CYIjO-li.d.ts} +3 -2
  47. package/dist/{editor-BRh7GuZF.d.ts → editor-DhUQsWWH.d.ts} +179 -52
  48. package/dist/editor.cjs +1 -1
  49. package/dist/editor.css +1 -1
  50. package/dist/editor.d.ts +181 -28
  51. package/dist/editor.js +1 -1
  52. package/dist/export.cjs +2 -2
  53. package/dist/export.d.ts +36 -18
  54. package/dist/export.js +2 -2
  55. package/dist/{failure-DNNmwsgD.d.ts → failure-BIPVQbRm.d.ts} +2 -1
  56. package/dist/{font-resolver-DwuQYj3P.d.ts → font-resolver-BwoHFBlr.d.ts} +3 -2
  57. package/dist/{headless-document-view-C3fc_jV0.d.ts → headless-document-view-Cc3fFWhv.d.ts} +4 -3
  58. package/dist/{image-resources-DxF-SN_8.d.ts → image-resources-DkuzBnTM.d.ts} +3 -2
  59. package/dist/{index-3pNnG4z4.d.ts → index-BYaCkGKO.d.ts} +179 -26
  60. package/dist/index.cjs +1 -1
  61. package/dist/index.d.ts +18 -18
  62. package/dist/index.js +1 -1
  63. package/dist/{layout-shaping-_GGjhhVc.d.ts → layout-shaping-DpWQG26a.d.ts} +7 -3
  64. package/dist/layout.cjs +1 -1
  65. package/dist/layout.d.ts +473 -64
  66. package/dist/layout.js +1 -1
  67. package/dist/{note-properties-CjT31AuP.d.ts → note-properties-DMfKK3QU.d.ts} +3 -2
  68. package/dist/{omml-equation-Bk3OP1fv.d.ts → omml-equation-BY7OdfGY.d.ts} +3 -2
  69. package/dist/output.cjs +1 -1
  70. package/dist/output.d.ts +9 -8
  71. package/dist/output.js +1 -1
  72. package/dist/{protocol-CrbTIW2Z.d.ts → protocol-CPAakntQ.d.ts} +4 -3
  73. package/dist/{review-paragraph-order-D3KZohIL.d.ts → review-paragraph-order-B0BP_wJP.d.ts} +1 -1
  74. package/dist/{revision-projection-kVd7p6Wd.d.ts → revision-projection-CVJeA2jp.d.ts} +3 -2
  75. package/dist/{semantic-cell-selection-CkSsZHDL.d.ts → semantic-cell-selection-B8GF_H2e.d.ts} +10 -6
  76. package/dist/{semantic-interaction-Z2Xa68U5.d.ts → semantic-interaction-DQjtIruQ.d.ts} +3 -2
  77. package/dist/{semantic-paint-BHKprI9P.d.ts → semantic-paint-DoPl85nR.d.ts} +4 -3
  78. package/dist/{semantic-records-StH-AnHK.d.ts → semantic-records-DB0VgWsr.d.ts} +1125 -1039
  79. package/dist/store.cjs +1 -1
  80. package/dist/store.d.ts +17 -16
  81. package/dist/store.js +1 -1
  82. package/dist/{tree-package-fragment-CpEV1gl3.d.ts → tree-package-fragment-BIyGh6L8.d.ts} +4 -3
  83. package/dist/{tree-session-contract-CTT9nM7Z.d.ts → tree-session-contract-CHcCnz3W.d.ts} +7 -6
  84. package/dist/{types-barrel-PwcfEkaX.d.ts → types-barrel-DN_-gaRX.d.ts} +72 -5
  85. package/package.json +3 -3
  86. package/dist/chunk-25OQBAKA.js +0 -2
  87. package/dist/chunk-3B3DQMSL.js +0 -11
  88. package/dist/chunk-3P3DNJYM.js +0 -5
  89. package/dist/chunk-3PA64KPK.js +0 -5
  90. package/dist/chunk-7N77EN2Z.cjs +0 -2
  91. package/dist/chunk-AGWWNVIJ.cjs +0 -1
  92. package/dist/chunk-DFTVN25X.cjs +0 -5
  93. package/dist/chunk-DGONGMAV.js +0 -2
  94. package/dist/chunk-DZYKU2HG.js +0 -1
  95. package/dist/chunk-F4H3LC6M.cjs +0 -2
  96. package/dist/chunk-FGBADUSK.cjs +0 -1
  97. package/dist/chunk-IUTTOBQW.cjs +0 -20
  98. package/dist/chunk-IYCXQAFT.cjs +0 -4
  99. package/dist/chunk-JL3SI5SZ.js +0 -18
  100. package/dist/chunk-OFWUHH52.js +0 -20
  101. package/dist/chunk-OKY6JRJL.js +0 -4
  102. package/dist/chunk-P24FHMQW.cjs +0 -1
  103. package/dist/chunk-QBKAOSVF.cjs +0 -18
  104. package/dist/chunk-RA2TDTEQ.cjs +0 -1
  105. package/dist/chunk-U5GUJKTS.js +0 -1
  106. package/dist/chunk-VP7SDFCM.js +0 -1
  107. package/dist/chunk-XRYSPKKC.js +0 -1
  108. package/dist/chunk-ZZRCVDQU.cjs +0 -11
@@ -0,0 +1 @@
1
+ 'use strict';var chunkQ4RDWB3U_cjs=require('./chunk-Q4RDWB3U.cjs'),chunkPCPBDYEL_cjs=require('./chunk-PCPBDYEL.cjs'),chunk6KA3L3FR_cjs=require('./chunk-6KA3L3FR.cjs');var Te=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function D(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"||!Te.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 We(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 Je=64,Ee=Object.freeze({family:"Calibri",sizeHalfPoints:22});function Oe(e,...n){let t=[e,...n],r=[],o=new Set;for(let a of t)for(let d of a.sources??[]){let c=chunkQ4RDWB3U_cjs.i(d.request);o.has(c)||(o.add(c),r.push(d));}let s=[],i=new Set;for(let a of t)for(let d of a.substitutions??[]){let c=chunkQ4RDWB3U_cjs.i(d.from);o.has(c)||i.has(c)||(i.add(c),s.push(d));}let u=D(t.map(a=>a.supportedFamilies));return Object.freeze({...u.length?{supportedFamilies:u}:{},epoch:e.epoch??0,maxFontBytes:e.maxFontBytes??chunkQ4RDWB3U_cjs.b,sources:Object.freeze(r),...s.length>0?{substitutions:Object.freeze(s)}:{},defaultFont:e.defaultFont??Ee,...e.language!==void 0?{language:e.language}:{}})}var Ne=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function we(e){let n=e?.defaultFont?.family;return n!==void 0&&Ne.test(n)?n:Ee.family}var Ie="docx-editor.dev/font-resolver",Ce=Symbol.for("docx-editor.dev/font-resolver");function on(e){let n={value:true,enumerable:false,configurable:true};try{Object.defineProperty(e,Ce,n),Object.defineProperty(e,Ie,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 rn(e){return typeof e=="function"&&e[Ce]===true}var X=e=>`${e.family.trim().toLowerCase()} ${e.weight} ${e.style}`;function Me(e,n,t){let r=new Map(e.map(o=>[X(o),o]));for(let[o,s]of n)r.set(o,s);for(let o of t)r.has(X(o.to))&&r.set(X(o.from),o.from);return [...r.values()]}async function sn(e,n,t={}){return ve(e,n,t)}async function an(e,n,t={}){return ve(e,n,t)}async function ve(e,n,t){let r=e.map(_e),o,s=[],i=[],u=new Map,a=new Set,d=0,c=[],f=new Set,m=[],O=n.resolvedFaces??[],w=n.defaultFamily;for(let b=0;b<e.length;b+=1){ke(n.signal);let k=e[b],I=Me(O,u,c),P;try{let x=r[b],S;if(x){let l=await Re(x,n.signal);if(!l.ok)throw l.cause;S=l.value;}else if(typeof k=="function"){let l=await Re(Promise.resolve(k(Le(n,w,I,d))).then(p=>({ok:!0,value:p}),p=>({ok:!1,cause:p})),n.signal);if(!l.ok)throw l.cause;S=l.value;}else S=k;if(S==null)continue;if(typeof S=="function"){Z(t,k,b,new TypeError("A font origin answered with a function; pass the resolver itself rather than a function returning one"));continue}let R="failures"in S?S.failures:void 0,M=[];if(Array.isArray(R)){let l=Math.min(R.length,chunkQ4RDWB3U_cjs.c);for(let p=0;p<l;p++)M.push(R[p]);R.length>l&&M.push(new Error("Additional font-origin failures were omitted"));}else R!==void 0&&M.push(R);let C=Be(S,a,d,f,o?"maxFontBytes"in o&&o.maxFontBytes!==void 0?o.maxFontBytes:chunkQ4RDWB3U_cjs.b:void 0,t.reserveOwnedBytes,t.instrumentation);P=C;for(let l of new Set([...C.dropped,...M]))Z(t,k,b,l);let E=C.fragment;E.supportedFamilies&&s.push(E.supportedFamilies),m.push(...M);let $=(E.sources??[]).map(l=>(chunkQ4RDWB3U_cjs.i(l.request),[X(l.request),l.request])),y=[...E.substitutions??[]];!o&&"defaultFont"in E&&(w=we(E)),o||(o=E);let g=new Set(C.sourceKeys);if(g.size>0){c=c.filter(l=>!g.has(chunkQ4RDWB3U_cjs.i(l.from)));for(let l of g)f.delete(l);}i.push(...E.sources??[]);for(let l of C.sourceKeys)a.add(l);d+=C.ownedBytes;for(let[l,p]of $)u.set(l,p);for(let l of y)c.push(l),f.add(chunkQ4RDWB3U_cjs.i(l.from));}catch(x){if(P?.releaseOwnedBytes?.(),n.signal?.aborted)throw n.signal.reason??x;if(x instanceof V)throw x.cause;Z(t,k,b,x);continue}}if(!o)return;let{epoch:N,...j}=Oe({...o,supportedFamilies:D(s),sources:i,substitutions:c});return m.length===0?j:{...j,failures:Object.freeze(m)}}var V=class extends Error{constructor(t){super("Unable to reserve owned font bytes");this.cause=t;this.name="FontOwnershipReservationError";}cause},Y=class extends RangeError{};async function Re(e,n){if(!n)return e;ke(n);let t,r=new Promise((s,i)=>{t=i;}),o=()=>t?.(n.reason);n.addEventListener("abort",o,{once:true});try{return await Promise.race([e,r])}finally{n.removeEventListener("abort",o);}}function _e(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 Be(e,n,t,r,o,s,i){let u=e.sources??[],a=e.substitutions??[],d="maxFontBytes"in e?e.maxFontBytes:void 0,c="defaultFont"in e?e.defaultFont:void 0,f="epoch"in e?e.epoch:void 0,m="language"in e?e.language:void 0;if(!Array.isArray(u)||!Array.isArray(a))throw new TypeError("Font origin sources and substitutions must be arrays");let O=u.length,w=a.length;if(O>chunkQ4RDWB3U_cjs.c)throw new RangeError(`Font source count must not exceed ${chunkQ4RDWB3U_cjs.c}`);if(w>chunkQ4RDWB3U_cjs.c)throw new RangeError(`Font substitution count must not exceed ${chunkQ4RDWB3U_cjs.c}`);let N=d??chunkQ4RDWB3U_cjs.b;if(!Number.isSafeInteger(N)||N<=0||N>chunkQ4RDWB3U_cjs.b)throw new RangeError(`Font byte ceiling must be a positive safe integer no greater than ${chunkQ4RDWB3U_cjs.b}`);let j=o??N,b=0,k=[],I=new Set,P=[],x=[];for(let y=0;y<O;y+=1){let g=u[y];try{let l=Q(g.request),p=g.availability,B=g.faceIndex,h=g.hash,A=g.id,L=chunkQ4RDWB3U_cjs.i(l);if(p!==void 0&&p!=="available"&&p!=="forbidden")throw new TypeError("Font source availability must be available or forbidden");if(!Number.isSafeInteger(B)||B<0)throw new RangeError("Font face index must be a non-negative safe integer");if(typeof h!="string"||h.length===0)throw new TypeError("Font source hash must be a non-empty string");let K;if(p!=="forbidden"){if(typeof A!="string"||A.length===0)throw new TypeError("Font source id must be a non-empty string");K=g.bytes;let J=chunkQ4RDWB3U_cjs.f(K);if(J>j)throw new RangeError("Font source exceeds the effective base byte ceiling");if(n.has(L)||I.has(L))continue;if(t+b+J>chunkQ4RDWB3U_cjs.d)throw new RangeError(`Font sources exceed the aggregate byte ceiling of ${chunkQ4RDWB3U_cjs.d}`);b+=J;}else K=new Uint8Array(0);if(n.has(L)||I.has(L))continue;if(n.size+I.size>=chunkQ4RDWB3U_cjs.c)throw new Y(`Font source count must not exceed ${chunkQ4RDWB3U_cjs.c}`);I.add(L),k.push(L),P.push(Object.freeze({request:l,id:A,bytes:K,hash:h,faceIndex:B,...p?{availability:p}:{}}));}catch(l){if(l instanceof Y)throw l;x.push(l);}}let S=new Set,R=[];for(let y=0;y<w;y+=1){let g=a[y];try{let l=Q(g.from),p=Q(g.to);chunkQ4RDWB3U_cjs.i(l),chunkQ4RDWB3U_cjs.i(p);let B=g.lineMetrics,h=B?Object.freeze({heightEm:B.heightEm,baselineEm:B.baselineEm}):void 0;if(h&&(!Number.isFinite(h.heightEm)||!Number.isFinite(h.baselineEm)||h.heightEm<=0||h.heightEm>4||h.baselineEm<0||h.baselineEm>h.heightEm))throw new RangeError("Font substitution line metrics must fit within a bounded em box");let A=chunkQ4RDWB3U_cjs.i(l);if(n.has(A)||I.has(A)||r.has(A)||S.has(A))continue;S.add(A),R.push(Object.freeze({from:l,to:p,...h?{lineMetrics:h}:{}}));}catch(l){x.push(l);}}if((O>0||w>0)&&P.length===0&&R.length===0&&x.length>0)throw x[0];let M=r.size;for(let y of I)r.has(y)&&(M-=1);if(M+S.size>chunkQ4RDWB3U_cjs.c)throw new RangeError(`Font substitution count must not exceed ${chunkQ4RDWB3U_cjs.c}`);let C;if(c!==void 0){let y=c.family,g=c.sizeHalfPoints;if(chunkQ4RDWB3U_cjs.i({family:y,weight:400,style:"normal"}),!Number.isSafeInteger(g)||g<=0)throw new RangeError("Default font size must be a positive safe integer in half-points");C=Object.freeze({family:y,sizeHalfPoints:g});}if(f!==void 0&&(!Number.isSafeInteger(f)||f<0))throw new RangeError("Font configuration epoch must be a non-negative safe integer");if(m!==void 0&&typeof m!="string")throw new TypeError("Font shaping language must be a string");let E;if(b>0&&s)try{E=s(b);}catch(y){throw new V(y)}let $;try{$=P.map(y=>chunkQ4RDWB3U_cjs.g(y,i));}catch(y){throw E?.(),y}return {fragment:Object.freeze({supportedFamilies:D([e.supportedFamilies]),sources:Object.freeze($),substitutions:Object.freeze(R),...f!==void 0?{epoch:f}:{},...d!==void 0?{maxFontBytes:d}:{},...C?{defaultFont:C}:{},...m!==void 0?{language:m}:{}}),sourceKeys:Object.freeze(k),ownedBytes:b,dropped:Object.freeze(x),releaseOwnedBytes:E}}function Pe(e){return !Number.isSafeInteger(e)||e<=0?0:e>chunkQ4RDWB3U_cjs.d?chunkQ4RDWB3U_cjs.d:e}function Le(e,n,t,r){let{committedSourceBytes:o,...s}=e,i=Pe(r);return {...s,defaultFamily:n,...t.length>0?{resolvedFaces:t}:{},...i>0?{committedSourceBytes:i}:{}}}function Q(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}function ke(e){if(e?.aborted)throw e.reason??new DOMException("Font resolution was aborted","AbortError")}function Z(e,n,t,r){let o;try{typeof n=="function"&&n.name.length>0&&(o=n.name);}catch{}let s=Object.freeze({originIndex:t,...o!==void 0?{originName:o}:{},cause:r});if(e.onOriginFailure)try{let u=e.onOriginFailure(s);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 i="";try{r instanceof Error&&r.message.length>0&&(i=`: ${r.message}`);}catch{}console.warn(`[fonts] a font origin failed and was skipped${i}`,r);}function G(e){let n=new WeakMap;return (t,r)=>{let o=new Set;for(let s of t){let i=[{node:s,context:r,next:0}],u=a=>{i.pop();let d=i.at(-1)?.found??o;for(let c of a)d.add(c);};for(;i.length;){let a=i[i.length-1],d=n.get(a.node);if(d?.key===a.context.key){u(d.families);continue}if(!a.children){let m=e(a.node,a.context);a.children=m.children,a.found=new Set(m.families);}let c=a.children[a.next++];if(c){i.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 W(e,n){return e.children.flatMap(t=>t.kind==="textValue"?[]:[{node:t,context:n}])}function qe(e,n){let{styles:t,theme:r,supplementalFamilies:o,depth:s}=n;if(e.kind==="table"){let a=chunkQ4RDWB3U_cjs.Ad(e,468,s,t),d=[];for(let c of a?.rows??[])for(let f of c.cells){let m={...n,depth:s+1,cellStyle:f.styleFormatting,key:`${n.baseKey}|${s+1}|${JSON.stringify(f.styleFormatting)}`};for(let O of f.blocks)d.push({node:O,context:m});}return {children:d.reverse()}}let i=new Set;if(e.kind==="paragraph"){let a=e.children.find(c=>c.kind==="paragraphProperties"),d=chunkQ4RDWB3U_cjs.dc(t,a,n.cellStyle).runProperties;for(let c of chunkQ4RDWB3U_cjs.cd(e,d,void 0,(f,m)=>chunkQ4RDWB3U_cjs.fc(f,m,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=chunkPCPBDYEL_cjs.a((c.fontSlot==="eastAsia"?c.style.fontFamilyEastAsia:c.style.fontFamily)??void 0);f&&i.add(f);}}let u=e.localName==="txbxContent"?{...n,cellStyle:void 0,key:`${n.baseKey}|${s}|undefined`}:n;return {families:[...i],children:W(e,u).reverse()}}function ze(){let e=G(qe),n,t;return (r,o,s)=>{if(!n||t!==o||n.theme!==s){let i=chunkQ4RDWB3U_cjs.cc(o,s);t=o,n={key:`${i.cacheToken}|0|undefined`,baseKey:i.cacheToken,styles:i,theme:s,depth:0,supplementalFamilies:new Set([...Object.values(s.majorSupplemental??{}),...Object.values(s.minorSupplemental??{})])};}return e([...r].reverse(),n)}}function pn(e,n,t){return ze()(e,n,t)}function ee(e,n){return e.attributes.find(t=>t.localName===n)?.value}var De=G((e,n)=>{let t=[];if(e.namespaceUri===chunk6KA3L3FR_cjs.da){if(e.localName==="fldSimple"){let r=chunkQ4RDWB3U_cjs.Vc(ee(e,"instr")??"")?.font;r&&t.push(r);}if(e.localName==="p")for(let r of je(e))t.push(r);}return {families:t,children:W(e,n)}});function vn(e){let n=new Map;for(let t of De(e,{key:""})){let r=chunkPCPBDYEL_cjs.a(t);r!==null&&!n.has(r.toLowerCase())&&n.set(r.toLowerCase(),r);}return [...n.values()]}function je(e){let n=[],t=chunkQ4RDWB3U_cjs.gb(),r=[];for(let o=e.children.length-1;o>=0;o-=1){let s=e.children[o];s.kind!=="textValue"&&r.push({node:s,containerDepth:0});}for(;r.length>0;){let{node:o,containerDepth:s}=r.pop();if(s>=chunk6KA3L3FR_cjs.la||o.namespaceUri===chunk6KA3L3FR_cjs.da&&o.localName==="p")continue;if(o.namespaceUri===chunk6KA3L3FR_cjs.da&&o.localName==="fldChar"){let u=ee(o,"fldCharType");u==="begin"?chunkQ4RDWB3U_cjs.jb(t):u==="separate"?(t.nesting===1&&Ae(t,n),chunkQ4RDWB3U_cjs.lb(t)):u==="end"&&(t.nesting===1&&Ae(t,n),chunkQ4RDWB3U_cjs.mb(t));continue}if(o.namespaceUri===chunk6KA3L3FR_cjs.da&&(o.localName==="instrText"||o.localName==="delInstrText")){chunkQ4RDWB3U_cjs.kb(t,$e(o),o.localName==="delInstrText");continue}if(o.namespaceUri===chunk6KA3L3FR_cjs.da&&o.localName==="fldSimple"){let u=chunkQ4RDWB3U_cjs.Vc(ee(o,"instr")??"");u?.font&&n.push(u.font);}let i=chunk6KA3L3FR_cjs.ma(o,s);for(let u=o.children.length-1;u>=0;u-=1){let a=o.children[u];a.kind!=="textValue"&&r.push({node:a,containerDepth:i});}}return chunkQ4RDWB3U_cjs.hb(t),n}function Ae(e,n){let t=chunkQ4RDWB3U_cjs.ib(e);if(t.overflow)return;let r=chunkQ4RDWB3U_cjs.Vc(t.instruction);r?.font&&n.push(r.font);}function $e(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 Ke=()=>true;function kn(e,n,t,r){if(!n)return [];let o=chunkQ4RDWB3U_cjs.fd(n),s=chunkQ4RDWB3U_cjs.cc(t,r),i=new Map;for(let u of e)for(let a of Ue(u)){let d=chunk6KA3L3FR_cjs.vc(a.children),c=f=>{if(f)for(let m of f.values())for(let O of [m.markerStyle.fontFamily,m.markerStyle.fontFamilyEastAsia]){let w=chunkPCPBDYEL_cjs.a(O??void 0);if(w===null)continue;let N=w.toLowerCase();i.has(N)||i.set(N,w);}};c(chunkQ4RDWB3U_cjs.tc(d,o,s,Ke));for(let f of d){let m=chunkQ4RDWB3U_cjs.$d(f);for(let O of m.contents)c(chunkQ4RDWB3U_cjs._d(O,o,s));}}return [...i.values()].sort((u,a)=>u.localeCompare(a))}function Ue(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 He={regular:{weight:400,style:"normal"},bold:{weight:700,style:"normal"},italic:{weight:400,style:"italic"},boldItalic:{weight:700,style:"italic"}};function Nn(e,n){let t=[],r=[],o=0;for(let s of e){let i=s.bytes.byteLength;if(!Number.isSafeInteger(i)||i>n||i>chunkQ4RDWB3U_cjs.b||i>chunkQ4RDWB3U_cjs.d-o){r.push(s);continue}o+=i,t.push(s);}return {sources:t,dropped:r}}function In(e,n,t){let r=n.reduce((s,i)=>s+i.bytes.byteLength,0),o=new Set(n.filter(s=>s.request.family.trim().length>0).map(s=>chunkQ4RDWB3U_cjs.i(s.request)));return Xe(e,{maxFontBytes:t,aggregateBudget:Math.max(0,chunkQ4RDWB3U_cjs.d-r),shadowedRequests:o})}function Xe(e,n){let t=[],r=[],o=n.aggregateBudget,s=new Set;for(let i of e){let u=He[i.style],a=Object.freeze({family:i.family,weight:u.weight,style:u.style});if(i.family.trim().length===0){r.push({request:a,partName:i.partName,reason:"malformed"});continue}let d=chunkQ4RDWB3U_cjs.i(a);if(!(n.shadowedRequests?.has(d)||s.has(d))){if(s.add(d),i.bytes.byteLength>n.maxFontBytes||i.bytes.byteLength>o){r.push({request:a,partName:i.partName,reason:"overLimit"});continue}o-=i.bytes.byteLength,t.push({request:a,id:`embedded:${i.partName}#${i.style}`,bytes:i.bytes,hash:chunk6KA3L3FR_cjs.a(i.bytes),faceIndex:0});}}return {sources:t,dropped:r}}exports.a=D;exports.b=We;exports.c=Je;exports.d=Ee;exports.e=Oe;exports.f=we;exports.g=Ie;exports.h=Ce;exports.i=on;exports.j=rn;exports.k=sn;exports.l=an;exports.m=Nn;exports.n=In;exports.o=Xe;exports.p=G;exports.q=W;exports.r=ze;exports.s=pn;exports.t=vn;exports.u=je;exports.v=kn;
@@ -0,0 +1 @@
1
+ import {i,b,c,f,d,g,cc,gb,jb,lb,mb,kb,Vc,hb,ib,fd,tc,$d,_d,Ad,dc,cd,fc}from'./chunk-ZCRSPN4Q.js';import {a}from'./chunk-UMBHUW6R.js';import {la,da,ma,vc,a as a$1}from'./chunk-XRBPZCNK.js';var Te=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function D(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"||!Te.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 We(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 Je=64,Ee=Object.freeze({family:"Calibri",sizeHalfPoints:22});function Oe(e,...n){let t=[e,...n],r=[],o=new Set;for(let a of t)for(let d of a.sources??[]){let c=i(d.request);o.has(c)||(o.add(c),r.push(d));}let s=[],i$1=new Set;for(let a of t)for(let d of a.substitutions??[]){let c=i(d.from);o.has(c)||i$1.has(c)||(i$1.add(c),s.push(d));}let u=D(t.map(a=>a.supportedFamilies));return Object.freeze({...u.length?{supportedFamilies:u}:{},epoch:e.epoch??0,maxFontBytes:e.maxFontBytes??b,sources:Object.freeze(r),...s.length>0?{substitutions:Object.freeze(s)}:{},defaultFont:e.defaultFont??Ee,...e.language!==void 0?{language:e.language}:{}})}var Ne=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function we(e){let n=e?.defaultFont?.family;return n!==void 0&&Ne.test(n)?n:Ee.family}var Ie="docx-editor.dev/font-resolver",Ce=Symbol.for("docx-editor.dev/font-resolver");function on(e){let n={value:true,enumerable:false,configurable:true};try{Object.defineProperty(e,Ce,n),Object.defineProperty(e,Ie,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 rn(e){return typeof e=="function"&&e[Ce]===true}var X=e=>`${e.family.trim().toLowerCase()} ${e.weight} ${e.style}`;function Me(e,n,t){let r=new Map(e.map(o=>[X(o),o]));for(let[o,s]of n)r.set(o,s);for(let o of t)r.has(X(o.to))&&r.set(X(o.from),o.from);return [...r.values()]}async function sn(e,n,t={}){return ve(e,n,t)}async function an(e,n,t={}){return ve(e,n,t)}async function ve(e,n,t){let r=e.map(_e),o,s=[],i$1=[],u=new Map,a=new Set,d=0,c$1=[],f=new Set,m=[],O=n.resolvedFaces??[],w=n.defaultFamily;for(let b$1=0;b$1<e.length;b$1+=1){ke(n.signal);let k=e[b$1],I=Me(O,u,c$1),P;try{let x=r[b$1],S;if(x){let l=await Re(x,n.signal);if(!l.ok)throw l.cause;S=l.value;}else if(typeof k=="function"){let l=await Re(Promise.resolve(k(Le(n,w,I,d))).then(p=>({ok:!0,value:p}),p=>({ok:!1,cause:p})),n.signal);if(!l.ok)throw l.cause;S=l.value;}else S=k;if(S==null)continue;if(typeof S=="function"){Z(t,k,b$1,new TypeError("A font origin answered with a function; pass the resolver itself rather than a function returning one"));continue}let R="failures"in S?S.failures:void 0,M=[];if(Array.isArray(R)){let l=Math.min(R.length,c);for(let p=0;p<l;p++)M.push(R[p]);R.length>l&&M.push(new Error("Additional font-origin failures were omitted"));}else R!==void 0&&M.push(R);let C=Be(S,a,d,f,o?"maxFontBytes"in o&&o.maxFontBytes!==void 0?o.maxFontBytes:b:void 0,t.reserveOwnedBytes,t.instrumentation);P=C;for(let l of new Set([...C.dropped,...M]))Z(t,k,b$1,l);let E=C.fragment;E.supportedFamilies&&s.push(E.supportedFamilies),m.push(...M);let $=(E.sources??[]).map(l=>(i(l.request),[X(l.request),l.request])),y=[...E.substitutions??[]];!o&&"defaultFont"in E&&(w=we(E)),o||(o=E);let g=new Set(C.sourceKeys);if(g.size>0){c$1=c$1.filter(l=>!g.has(i(l.from)));for(let l of g)f.delete(l);}i$1.push(...E.sources??[]);for(let l of C.sourceKeys)a.add(l);d+=C.ownedBytes;for(let[l,p]of $)u.set(l,p);for(let l of y)c$1.push(l),f.add(i(l.from));}catch(x){if(P?.releaseOwnedBytes?.(),n.signal?.aborted)throw n.signal.reason??x;if(x instanceof V)throw x.cause;Z(t,k,b$1,x);continue}}if(!o)return;let{epoch:N,...j}=Oe({...o,supportedFamilies:D(s),sources:i$1,substitutions:c$1});return m.length===0?j:{...j,failures:Object.freeze(m)}}var V=class extends Error{constructor(t){super("Unable to reserve owned font bytes");this.cause=t;this.name="FontOwnershipReservationError";}cause},Y=class extends RangeError{};async function Re(e,n){if(!n)return e;ke(n);let t,r=new Promise((s,i)=>{t=i;}),o=()=>t?.(n.reason);n.addEventListener("abort",o,{once:true});try{return await Promise.race([e,r])}finally{n.removeEventListener("abort",o);}}function _e(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 Be(e,n,t,r,o,s,i$1){let u=e.sources??[],a=e.substitutions??[],d$1="maxFontBytes"in e?e.maxFontBytes:void 0,c$1="defaultFont"in e?e.defaultFont:void 0,f$1="epoch"in e?e.epoch:void 0,m="language"in e?e.language:void 0;if(!Array.isArray(u)||!Array.isArray(a))throw new TypeError("Font origin sources and substitutions must be arrays");let O=u.length,w=a.length;if(O>c)throw new RangeError(`Font source count must not exceed ${c}`);if(w>c)throw new RangeError(`Font substitution count must not exceed ${c}`);let N=d$1??b;if(!Number.isSafeInteger(N)||N<=0||N>b)throw new RangeError(`Font byte ceiling must be a positive safe integer no greater than ${b}`);let j=o??N,b$1=0,k=[],I=new Set,P=[],x=[];for(let y=0;y<O;y+=1){let g=u[y];try{let l=Q(g.request),p=g.availability,B=g.faceIndex,h=g.hash,A=g.id,L=i(l);if(p!==void 0&&p!=="available"&&p!=="forbidden")throw new TypeError("Font source availability must be available or forbidden");if(!Number.isSafeInteger(B)||B<0)throw new RangeError("Font face index must be a non-negative safe integer");if(typeof h!="string"||h.length===0)throw new TypeError("Font source hash must be a non-empty string");let K;if(p!=="forbidden"){if(typeof A!="string"||A.length===0)throw new TypeError("Font source id must be a non-empty string");K=g.bytes;let J=f(K);if(J>j)throw new RangeError("Font source exceeds the effective base byte ceiling");if(n.has(L)||I.has(L))continue;if(t+b$1+J>d)throw new RangeError(`Font sources exceed the aggregate byte ceiling of ${d}`);b$1+=J;}else K=new Uint8Array(0);if(n.has(L)||I.has(L))continue;if(n.size+I.size>=c)throw new Y(`Font source count must not exceed ${c}`);I.add(L),k.push(L),P.push(Object.freeze({request:l,id:A,bytes:K,hash:h,faceIndex:B,...p?{availability:p}:{}}));}catch(l){if(l instanceof Y)throw l;x.push(l);}}let S=new Set,R=[];for(let y=0;y<w;y+=1){let g=a[y];try{let l=Q(g.from),p=Q(g.to);i(l),i(p);let B=g.lineMetrics,h=B?Object.freeze({heightEm:B.heightEm,baselineEm:B.baselineEm}):void 0;if(h&&(!Number.isFinite(h.heightEm)||!Number.isFinite(h.baselineEm)||h.heightEm<=0||h.heightEm>4||h.baselineEm<0||h.baselineEm>h.heightEm))throw new RangeError("Font substitution line metrics must fit within a bounded em box");let A=i(l);if(n.has(A)||I.has(A)||r.has(A)||S.has(A))continue;S.add(A),R.push(Object.freeze({from:l,to:p,...h?{lineMetrics:h}:{}}));}catch(l){x.push(l);}}if((O>0||w>0)&&P.length===0&&R.length===0&&x.length>0)throw x[0];let M=r.size;for(let y of I)r.has(y)&&(M-=1);if(M+S.size>c)throw new RangeError(`Font substitution count must not exceed ${c}`);let C;if(c$1!==void 0){let y=c$1.family,g=c$1.sizeHalfPoints;if(i({family:y,weight:400,style:"normal"}),!Number.isSafeInteger(g)||g<=0)throw new RangeError("Default font size must be a positive safe integer in half-points");C=Object.freeze({family:y,sizeHalfPoints:g});}if(f$1!==void 0&&(!Number.isSafeInteger(f$1)||f$1<0))throw new RangeError("Font configuration epoch must be a non-negative safe integer");if(m!==void 0&&typeof m!="string")throw new TypeError("Font shaping language must be a string");let E;if(b$1>0&&s)try{E=s(b$1);}catch(y){throw new V(y)}let $;try{$=P.map(y=>g(y,i$1));}catch(y){throw E?.(),y}return {fragment:Object.freeze({supportedFamilies:D([e.supportedFamilies]),sources:Object.freeze($),substitutions:Object.freeze(R),...f$1!==void 0?{epoch:f$1}:{},...d$1!==void 0?{maxFontBytes:d$1}:{},...C?{defaultFont:C}:{},...m!==void 0?{language:m}:{}}),sourceKeys:Object.freeze(k),ownedBytes:b$1,dropped:Object.freeze(x),releaseOwnedBytes:E}}function Pe(e){return !Number.isSafeInteger(e)||e<=0?0:e>d?d:e}function Le(e,n,t,r){let{committedSourceBytes:o,...s}=e,i=Pe(r);return {...s,defaultFamily:n,...t.length>0?{resolvedFaces:t}:{},...i>0?{committedSourceBytes:i}:{}}}function Q(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}function ke(e){if(e?.aborted)throw e.reason??new DOMException("Font resolution was aborted","AbortError")}function Z(e,n,t,r){let o;try{typeof n=="function"&&n.name.length>0&&(o=n.name);}catch{}let s=Object.freeze({originIndex:t,...o!==void 0?{originName:o}:{},cause:r});if(e.onOriginFailure)try{let u=e.onOriginFailure(s);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 i="";try{r instanceof Error&&r.message.length>0&&(i=`: ${r.message}`);}catch{}console.warn(`[fonts] a font origin failed and was skipped${i}`,r);}function G(e){let n=new WeakMap;return (t,r)=>{let o=new Set;for(let s of t){let i=[{node:s,context:r,next:0}],u=a=>{i.pop();let d=i.at(-1)?.found??o;for(let c of a)d.add(c);};for(;i.length;){let a=i[i.length-1],d=n.get(a.node);if(d?.key===a.context.key){u(d.families);continue}if(!a.children){let m=e(a.node,a.context);a.children=m.children,a.found=new Set(m.families);}let c=a.children[a.next++];if(c){i.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 W(e,n){return e.children.flatMap(t=>t.kind==="textValue"?[]:[{node:t,context:n}])}function qe(e,n){let{styles:t,theme:r,supplementalFamilies:o,depth:s}=n;if(e.kind==="table"){let a=Ad(e,468,s,t),d=[];for(let c of a?.rows??[])for(let f of c.cells){let m={...n,depth:s+1,cellStyle:f.styleFormatting,key:`${n.baseKey}|${s+1}|${JSON.stringify(f.styleFormatting)}`};for(let O of f.blocks)d.push({node:O,context:m});}return {children:d.reverse()}}let i=new Set;if(e.kind==="paragraph"){let a$1=e.children.find(c=>c.kind==="paragraphProperties"),d=dc(t,a$1,n.cellStyle).runProperties;for(let c of cd(e,d,void 0,(f,m)=>fc(f,m,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((c.fontSlot==="eastAsia"?c.style.fontFamilyEastAsia:c.style.fontFamily)??void 0);f&&i.add(f);}}let u=e.localName==="txbxContent"?{...n,cellStyle:void 0,key:`${n.baseKey}|${s}|undefined`}:n;return {families:[...i],children:W(e,u).reverse()}}function ze(){let e=G(qe),n,t;return (r,o,s)=>{if(!n||t!==o||n.theme!==s){let i=cc(o,s);t=o,n={key:`${i.cacheToken}|0|undefined`,baseKey:i.cacheToken,styles:i,theme:s,depth:0,supplementalFamilies:new Set([...Object.values(s.majorSupplemental??{}),...Object.values(s.minorSupplemental??{})])};}return e([...r].reverse(),n)}}function pn(e,n,t){return ze()(e,n,t)}function ee(e,n){return e.attributes.find(t=>t.localName===n)?.value}var De=G((e,n)=>{let t=[];if(e.namespaceUri===da){if(e.localName==="fldSimple"){let r=Vc(ee(e,"instr")??"")?.font;r&&t.push(r);}if(e.localName==="p")for(let r of je(e))t.push(r);}return {families:t,children:W(e,n)}});function vn(e){let n=new Map;for(let t of De(e,{key:""})){let r=a(t);r!==null&&!n.has(r.toLowerCase())&&n.set(r.toLowerCase(),r);}return [...n.values()]}function je(e){let n=[],t=gb(),r=[];for(let o=e.children.length-1;o>=0;o-=1){let s=e.children[o];s.kind!=="textValue"&&r.push({node:s,containerDepth:0});}for(;r.length>0;){let{node:o,containerDepth:s}=r.pop();if(s>=la||o.namespaceUri===da&&o.localName==="p")continue;if(o.namespaceUri===da&&o.localName==="fldChar"){let u=ee(o,"fldCharType");u==="begin"?jb(t):u==="separate"?(t.nesting===1&&Ae(t,n),lb(t)):u==="end"&&(t.nesting===1&&Ae(t,n),mb(t));continue}if(o.namespaceUri===da&&(o.localName==="instrText"||o.localName==="delInstrText")){kb(t,$e(o),o.localName==="delInstrText");continue}if(o.namespaceUri===da&&o.localName==="fldSimple"){let u=Vc(ee(o,"instr")??"");u?.font&&n.push(u.font);}let i=ma(o,s);for(let u=o.children.length-1;u>=0;u-=1){let a=o.children[u];a.kind!=="textValue"&&r.push({node:a,containerDepth:i});}}return hb(t),n}function Ae(e,n){let t=ib(e);if(t.overflow)return;let r=Vc(t.instruction);r?.font&&n.push(r.font);}function $e(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 Ke=()=>true;function kn(e,n,t,r){if(!n)return [];let o=fd(n),s=cc(t,r),i=new Map;for(let u of e)for(let a$1 of Ue(u)){let d=vc(a$1.children),c=f=>{if(f)for(let m of f.values())for(let O of [m.markerStyle.fontFamily,m.markerStyle.fontFamilyEastAsia]){let w=a(O??void 0);if(w===null)continue;let N=w.toLowerCase();i.has(N)||i.set(N,w);}};c(tc(d,o,s,Ke));for(let f of d){let m=$d(f);for(let O of m.contents)c(_d(O,o,s));}}return [...i.values()].sort((u,a)=>u.localeCompare(a))}function Ue(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 He={regular:{weight:400,style:"normal"},bold:{weight:700,style:"normal"},italic:{weight:400,style:"italic"},boldItalic:{weight:700,style:"italic"}};function Nn(e,n){let t=[],r=[],o=0;for(let s of e){let i=s.bytes.byteLength;if(!Number.isSafeInteger(i)||i>n||i>b||i>d-o){r.push(s);continue}o+=i,t.push(s);}return {sources:t,dropped:r}}function In(e,n,t){let r=n.reduce((s,i)=>s+i.bytes.byteLength,0),o=new Set(n.filter(s=>s.request.family.trim().length>0).map(s=>i(s.request)));return Xe(e,{maxFontBytes:t,aggregateBudget:Math.max(0,d-r),shadowedRequests:o})}function Xe(e,n){let t=[],r=[],o=n.aggregateBudget,s=new Set;for(let i$1 of e){let u=He[i$1.style],a=Object.freeze({family:i$1.family,weight:u.weight,style:u.style});if(i$1.family.trim().length===0){r.push({request:a,partName:i$1.partName,reason:"malformed"});continue}let d=i(a);if(!(n.shadowedRequests?.has(d)||s.has(d))){if(s.add(d),i$1.bytes.byteLength>n.maxFontBytes||i$1.bytes.byteLength>o){r.push({request:a,partName:i$1.partName,reason:"overLimit"});continue}o-=i$1.bytes.byteLength,t.push({request:a,id:`embedded:${i$1.partName}#${i$1.style}`,bytes:i$1.bytes,hash:a$1(i$1.bytes),faceIndex:0});}}return {sources:t,dropped:r}}export{D as a,We as b,Je as c,Ee as d,Oe as e,we as f,Ie as g,Ce as h,on as i,rn as j,sn as k,an as l,Nn as m,In as n,Xe as o,G as p,W as q,ze as r,pn as s,vn as t,je as u,kn as v};
@@ -0,0 +1,4 @@
1
+ 'use strict';var chunkQ4RDWB3U_cjs=require('./chunk-Q4RDWB3U.cjs'),chunkT7RGKBCE_cjs=require('./chunk-T7RGKBCE.cjs'),chunk6KA3L3FR_cjs=require('./chunk-6KA3L3FR.cjs');var Vn=4096,zt=e=>typeof e=="number"?String(e):JSON.stringify(e)??typeof e,Le=class{constructor(t){this.onRestart=t;}onRestart;#e=new Map;keyOf(t,n){let r=chunkQ4RDWB3U_cjs.s(n),o=this.#e.get(r);o===void 0&&(this.#e.size>=Vn&&(this.#e.clear(),this.onRestart()),o=this.#e.size,this.#e.set(r,o));let a=`${o}\0${zt(t.fontSizeHalfPoints)}\0${zt(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 $n(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 Nt(e){return e instanceof Error&&/process\.getBuiltinModule/.test(e.message)}function Dt(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 Ht(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 Ut(e,t){let n=`expected HarfBuzz ${e}, loaded ${t}`;return `${n}. The bundled binary does not match this build of the engine.`}var $=Object.freeze({name:"HarfBuzz",version:"14.4.0"}),le=null,se=null;function Ze(){return le?Promise.resolve():se||(se=import('harfbuzzjs').then(e=>{let t=e.versionString();if(t!==$.version)throw new B("shapingLibraryMismatch",{diagnostic:Ut($.version,t)});le=e;}).catch(e=>{throw se=null,e instanceof B?e:Nt(e)?new B("unsupportedRuntime",{diagnostic:Dt(e),cause:e}):new B("wasmUnavailable",{diagnostic:Ht(e),cause:e})}),se)}function qn(){return le!==null}function Zn(){if(!le)throw new B("notInitialized",{diagnostic:"Call initializeHarfBuzz() before creating a text shaper"});return le}var B=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;}},Jn=16*1024*1024,Qn=1e6,er=1e6,tr=1e6,nr=4,rr=512,or=1024*1024,ar=16*1024*1024,ir=32*1024*1024,sr=64*1024*1024,cr=64*1024*1024,lr=1e6,dr=1e6,ur=1e6,pr=64,fr=4096,yr=4*1024*1024,mr=64*1024*1024,hr=64*1024*1024,gr=256*1024*1024,Sr=new Set(["COLR","CPAL","CBDT","CBLC","sbix","SVG "]),Gt=["cmap","head","hhea","hmtx","maxp"],br=(e,t)=>e[t]<<8|e[t+1],xr=(e,t)=>e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3]>>>0,Rr=(e,t)=>String.fromCharCode(e[0],e[1],e[2],e[3])==="ttcf"?xr(e,12+t*4):0,Cr=(e,t)=>{let n=Rr(e,t),r=br(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},Fr=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),vr=(e,t)=>{let n=chunkQ4RDWB3U_cjs.m(e,t);if(!n.valid)return n;let r=Cr(e,t);for(let o of Gt)if(!r.has(o))return {valid:false,diagnostic:`missing required ${o} table`};return {valid:true}},Je=vr,M=(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},Er=(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},Wt=(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");return chunkQ4RDWB3U_cjs.o(Er(BigInt(e)*BigInt(n),BigInt(t),r))},Lr=(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=>Wt(i,a,o,r)},Br=(e,t,n)=>{let r=t*n,o=e*2;return a=>a*r/o},Ir=(e,t)=>{if(t.length===0)return [];let n=[...new Set(t.map(i=>i.cluster))].sort((i,c)=>i-c),r=new Map;for(let i=0;i<n.length;i+=1)r.set(n[i],n[i+1]??e.length);let o=[],a=0;for(;a<t.length;){let i=t[a].cluster,c=a+1;for(;c<t.length&&t[c].cluster===i;)c+=1;let s=t.slice(a,c).reduce((l,f)=>l+f.advanceX,0),d=chunkQ4RDWB3U_cjs.o(s);o.push({textStart:i,textEnd:r.get(i),glyphStart:a,glyphEnd:c,advance:d,caretEdges:Object.freeze([chunkQ4RDWB3U_cjs.o(0),d]),fontSpan:0}),a=c;}return o},k=64,H=8,X=8,Kt=32,Xt=k+2*H,Or=k+H+X,Tr=k+H+2*X,wr=k+H+X,Vt=k+8*H,jt=k+8*X+H,Ar=k+6*X+H,Pr=k+3*X+2*H,_r=k+3*X,de=e=>k+e.length*Uint16Array.BYTES_PER_ELEMENT,Qe=e=>wr+de(e),ce=e=>Kt+e*H,Mr=(e,t)=>Xt+de(e)+Or+Qe(t),zr=e=>Vt+de(e)+ce(e.length)+e.length*jt,kr=e=>{let t=new Set(e.glyphs.map(n=>n.outline));return Vt+de(e.text)+ce(e.glyphs.length)+e.glyphs.length*jt+ce(e.clusters.length)+e.clusters.length*Ar+e.clusters.reduce((n,r)=>n+ce(r.caretEdges.length),0)+ce(e.fontSpans.length)+e.fontSpans.length*Pr+(e.exactAdvancesX===void 0?0:Kt+e.exactAdvancesX.length*X)+_r+[...t].reduce((n,r)=>n+Qe(r.path),0)},Nr=(e,t)=>Xt+de(e)+Tr+t,qe=class{#e;#u;#p;#f;#y;#x;#m;#c=0;#R;#h;#g;#s;#S;#l;#t;#o=new Map;#a=new Map;#n=new Map;#C=new Le(()=>{this.#n.clear(),this.#r=0,this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"cleared",retainedBytes:0}));});#i=0;#r=0;#b=0;#d;constructor(t,n){this.#e=t,this.#u=M(n.maxFontBytes??Jn,"maximum font bytes",cr),this.#p=M(n.maxInputUtf16??Qn,"maximum input UTF-16 code units",lr),this.#f=M(n.maxCodepoints??er,"maximum input code points",dr),this.#y=M(n.maxGlyphs??tr,"maximum shaped glyphs",ur),this.#m=M(n.maxCachedFontBytes??64*1024*1024,"maximum cached font bytes",64*1024*1024),this.#x=M(n.maxCachedFaces??nr,"maximum cached faces",pr),this.#R=M(n.maxCachedShapes??rr,"maximum cached shape results",fr),this.#h=M(n.maxOutlineBytes??or,"maximum outline bytes",yr),this.#g=M(n.maxCachedOutlineBytes??ar,"maximum cached outline bytes",mr),this.#s=M(n.maxShapedRunBytes??ir,"maximum shaped run bytes",hr),this.#S=M(n.maxCachedShapeBytes??sr,"maximum cached shape bytes",gr),this.#l=n.instrumentation?.onFaceCacheEvent,this.#t=n.instrumentation,this.#d=new this.#e.Buffer;}dispose(){this.#o.clear(),this.#c=0,this.#a.clear(),this.#n.clear(),this.#C.clear(),this.#i=0,this.#r=0,this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"cleared",retainedBytes:0})),this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"cleared",retainedBytes:0})),this.#d=void 0;}#v(t,n){let r=this.#o.get(t.identity);if(r)return this.#o.delete(t.identity),this.#o.set(t.identity,r),this.#l?.(Object.freeze({kind:"hit",identity:t.identity})),r;let o=chunkQ4RDWB3U_cjs.k(t);for(let l of Gt)if(!o.has(l))throw new B("malformedFont",{diagnostic:`missing required ${l} table`});this.#t?.onByteCopy?.();let a=new this.#e.Blob(Fr(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 B("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.#m){for(;this.#o.size>=this.#x||this.#c+n.byteLength>this.#m;){let l=this.#o.keys().next().value;if(l===void 0)break;this.#c-=this.#o.get(l).byteLength,this.#o.delete(l),this.#l?.(Object.freeze({kind:"evicted",identity:l}));}this.#o.set(t.identity,d),this.#c+=n.byteLength;}return this.#l?.(Object.freeze({kind:"created",identity:t.identity})),d}#E(t,n,r){let o=JSON.stringify([t.identity,t.unitsPerEm,r,n]),a=this.#a.get(o);if(a)return this.#a.delete(o),this.#a.set(o,a),this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"hit",retainedBytes:this.#i})),a.outline;this.#t?.onOutlinePathCall?.();let i=t.font.glyphToPath(n),c=Qe(i);if(c>this.#h)throw new B("outlineOverLimit",{limit:this.#h,actual:c});let s=Object.freeze({path:i,unitsPerEm:t.unitsPerEm}),d=Mr(o,i);if(d>this.#g)return this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"skipped",retainedBytes:this.#i})),s;for(;this.#i+d>this.#g;){let l=this.#a.keys().next().value;if(l===void 0)break;let f=this.#a.get(l);this.#a.delete(l),this.#i-=f.bytes,this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"evicted",retainedBytes:this.#i}));}return this.#a.set(o,{outline:s,bytes:d}),this.#i+=d,this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"created",retainedBytes:this.#i})),s}#F(t){if(t.length>this.#p)throw new B("textOverLimit",{limit:this.#p,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.#f)throw new B("codepointsOverLimit",{limit:this.#f,actual:n})}}shape(t){if(!this.#d)throw new B("disposed");if(chunkQ4RDWB3U_cjs.l(t.environment.font),t.environment.font.byteLength>this.#u)throw new B("fontOverLimit",{limit:this.#u,actual:t.environment.font.byteLength});this.#F(t.text);let n=zr(t.text);if(n>this.#s)throw new B("shapedRunOverLimit",{limit:this.#s,actual:n});let r=chunkQ4RDWB3U_cjs.q(t.environment),o=this.#C.keyOf(t,r),a=this.#n.get(o);if(a)return this.#b-a.stamp>=Math.max(1,this.#n.size>>1)&&(this.#n.delete(o),this.#n.set(o,a),a.stamp=++this.#b),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!==$.name||r.shapingLibrary.version!==$.version)throw new B("shapingLibraryMismatch");if(r.normalization!=="none")throw new B("unsupportedNormalization");if(!Number.isSafeInteger(t.bidiLevel)||t.bidiLevel<0||(t.bidiLevel&1)===1!=(r.direction==="rtl"))throw new B("invalidBidiLevel");if(Object.keys(r.variationAxes).length>0)throw new B("unsupportedVariationAxes");if(r.fallbackOrder.length>0)throw new B("unsupportedFallback");let i=chunkQ4RDWB3U_cjs.j(r.font),c=chunkQ4RDWB3U_cjs.k(r.font);if([...Sr].some(y=>c.has(y))&&!c.has("glyf")&&!c.has("CFF "))throw new B("unsupportedColorFont");let s=t.text;this.#F(s);let d=t.context?.before??"",l=t.context?.after??"",f=chunkQ4RDWB3U_cjs.p,S=Math.max(String(d).length,String(l).length);if(typeof d!="string"||typeof l!="string"||S>f)throw new B("textOverLimit",{limit:f,actual:S});try{let y=this.#v(r.font,i),{face:b,font:x}=y,m=this.#d;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 h=Object.entries(r.features).map(([I,A])=>new this.#e.Feature(I,A));this.#t?.onShapeCall?.(),this.#e.shape(x,m,h);let g=m.getGlyphInfosAndPositions();if(g.length>this.#y)throw new B("glyphOverLimit",{limit:this.#y,actual:g.length});let R=Lr(b.upem,t.fontSizeHalfPoints,r.fixedPointScale,r.roundingMode),v=Br(b.upem,t.fontSizeHalfPoints,r.fixedPointScale),L=[],T=chunkQ4RDWB3U_cjs.o(0),p=chunkQ4RDWB3U_cjs.o(0),u=new Map,C=JSON.stringify(Object.entries(r.variationAxes).sort(([I],[A])=>I.localeCompare(A))),F=g.map(I=>{L.push(v(I.xAdvance??0));let A=R(I.xAdvance??0),Z=R(I.yAdvance??0),Xn={id:I.codepoint,cluster:I.cluster-d.length,originX:T,originY:p,advanceX:A,advanceY:Z,offsetX:R(I.xOffset??0),offsetY:R(I.yOffset??0),outline:u.get(I.codepoint)??(()=>{let ut=this.#E(y,I.codepoint,C);return u.set(I.codepoint,ut),ut})()};return T=chunkQ4RDWB3U_cjs.o(T+A),p=chunkQ4RDWB3U_cjs.o(p+Z),Xn}),E=x.hExtents(),O=chunkQ4RDWB3U_cjs.t({text:s,direction:r.direction,bidiLevel:t.bidiLevel,glyphs:F,exactAdvancesX:L,clusters:Ir(s,F),fontSpans:F.length===0?[]:[{glyphStart:0,glyphEnd:F.length,font:r.font,fallbackIndex:null}],metrics:{ascent:R(E.ascender),descent:R(-E.descender),lineGap:R(E.lineGap)}},r),_=kr(O);if(_>this.#s)throw new B("shapedRunOverLimit",{limit:this.#s,actual:_});let w=Nr(o,_);if(w>this.#S)return this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"skipped",retainedBytes:this.#r})),O;for(;this.#n.size>=this.#R||this.#r+w>this.#S;){let I=this.#n.keys().next().value;if(I===void 0)break;let A=this.#n.get(I);this.#n.delete(I),this.#r-=A.bytes,this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"evicted",retainedBytes:this.#r}));}return this.#n.set(o,{run:O,bytes:w,stamp:++this.#b}),this.#r+=w,this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"stored",retainedBytes:this.#r})),O}catch(y){throw y instanceof B?y:new B("malformedFont",{diagnostic:y instanceof Error?y.message:"HarfBuzz shaping failed"})}}},et=(e={})=>new qe(Zn(),e);var tt=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}),La=Object.freeze({...tt,maxCachedShapes:4096});function Yt(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:${chunk6KA3L3FR_cjs.a(new TextEncoder().encode(JSON.stringify(n)))}`}var Dr=Object.freeze({}),$t=chunkQ4RDWB3U_cjs.c,Hr="16.0.0",Ur="none",Gr=1e3,Wr="halfToEven",Jt="cluster-edges-only",Kr="Latn",Xr=new Uint8Array(0);var U=class extends Error{code="overLimit";constructor(t){super(t),this.name="LayoutShapingConfigurationError";}};function Vr(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>chunkQ4RDWB3U_cjs.b)throw new U(`Font byte ceiling must not exceed the engine hard maximum of ${chunkQ4RDWB3U_cjs.b}`);let s=o.length,d=a?.length??0;if(s===0||s>chunkQ4RDWB3U_cjs.c)throw new U(`Font source count must be between 1 and ${chunkQ4RDWB3U_cjs.c}`);if(d>$t)throw new U(`Font substitution count must not exceed ${$t}`);let l=0,f=[];for(let b=0;b<s;b+=1){let x=o[b],m=x.request,h=x.availability,g=x.id,R=x.hash,v=x.faceIndex,L=h==="forbidden",T=L?Xr:x.bytes;if(!L){if(typeof g!="string"||g.length===0)throw new TypeError("Resolved font id must not be empty");let p;try{p=chunkQ4RDWB3U_cjs.f(T);}catch{throw new U(`Font source ${g} must provide genuine bytes`)}if(p>r)throw new U(`Font source ${g} exceeds the per-font byte ceiling`);if(l+=p,l>chunkQ4RDWB3U_cjs.d)throw new U(`Font sources exceed the aggregate byte ceiling of ${chunkQ4RDWB3U_cjs.d}`)}f.push(t&&chunkQ4RDWB3U_cjs.h(x)!==void 0?x:Object.freeze({request:Object.freeze({family:m.family,weight:m.weight,style:m.style}),id:g,bytes:T,hash:R,faceIndex:v,...h?{availability:h}:{}}));}let S;if(a){S=[];for(let b=0;b<d;b+=1){let x=a[b],m=x.from,h=x.to,g=x.lineMetrics;S.push(Object.freeze({from:Object.freeze({family:m.family,weight:m.weight,style:m.style}),to:Object.freeze({family:h.family,weight:h.weight,style:h.style}),...g?{lineMetrics:Object.freeze({heightEm:g.heightEm,baselineEm:g.baselineEm})}:{}}));}}let y={epoch:n,maxFontBytes:r,sources:Object.freeze(f),substitutions:S?Object.freeze(S):void 0,defaultFont:Object.freeze({family:i.family,sizeHalfPoints:i.sizeHalfPoints}),language:c};return Object.freeze(y)}function qt(e,t){let n=e.map((o,a)=>({value:o,index:a,key:chunkQ4RDWB3U_cjs.i(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 jr(e,t){let n={family:e.family},r={sizeHalfPoints:e.sizeHalfPoints};return {...n,...t?r:{}}}function Zt(e,t){let n=s=>({family:s.family,weight:s.weight,style:s.style}),r=t?e.sources:qt(e.sources,s=>s.request),o=e.substitutions??[],a=t?o:qt(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=chunkQ4RDWB3U_cjs.h(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:jr(e.defaultFont,t),language:e.language||"en"},c={epoch:e.epoch,maxFontBytes:e.maxFontBytes};return {version:1,...t?c:{},...i}}var Yr=Symbol("prepared-layout-font-configuration"),Be=new WeakMap;function $r(e){return Be.has(e)}function qr(e){let t=Be.get(e);if(!t)throw new TypeError("Invalid prepared layout font configuration");return t.configuration}function Aa(e){let t=Be.get(e);if(!t)throw new TypeError("Invalid prepared layout font configuration");return t.sharedShapingFingerprint}function nt(e,t){return Qt(e,t,false)}function Pa(e,t){return Qt(e,t,true)}function Qt(e,t,n){let r=Vr(e,n),o=Object.freeze({epoch:r.epoch,maxFontBytes:r.maxFontBytes,sources:Object.freeze(r.sources.map(f=>n&&chunkQ4RDWB3U_cjs.h(f)!==void 0?f:chunkQ4RDWB3U_cjs.g(f,{onOwnedByteCopy:t?.onFontByteCopy,onHash:t?.onFontHash}))),substitutions:r.substitutions,defaultFont:r.defaultFont,language:r.language}),a=new TextEncoder,i=Zt(o,true),c=a.encode(JSON.stringify(i)),s=Zt(o,false),d=a.encode(JSON.stringify(s)),l=Object.freeze({[Yr]:true,fingerprint:`font-config:${chunk6KA3L3FR_cjs.a(c)}`});return Be.set(l,{configuration:o,sharedShapingFingerprint:`shared-font-config:${chunk6KA3L3FR_cjs.a(d)}`}),l}function Zr(e){return nt(e).fingerprint}function Jr(e,t){let n=new TextEncoder().encode(JSON.stringify({version:1,environment:e,executionPolicy:Yt(t),ligatureCaretPolicy:Jt,fallback:chunkQ4RDWB3U_cjs.ea}));return `shaping:${chunk6KA3L3FR_cjs.a(n)}`}async function en(e,t,n,r,o=false){let i=$r(e)?e:nt(e,t),c=qr(i),{epoch:s,maxFontBytes:d,sources:l,substitutions:f,defaultFont:S}=c,y=c.language||"en",b=i.fingerprint,x=chunkQ4RDWB3U_cjs.n({epoch:s,maxFontBytes:d,resources:l,substitutions:f,validateFont:Je,instrumentation:{onOwnedByteCopy:t?.onFontByteCopy,onHash:t?.onFontHash,onAdmission:t?.onFontAdmission}});await Ze();let m=Object.freeze({script:Kr,variationAxes:Object.freeze({}),shapingLibrary:$,unicodeDataVersion:Hr,normalization:Ur,language:y,features:Dr,...o?{documentLigatures:true}:{},fixedPointScale:Gr,roundingMode:Wr});return Object.freeze({fonts:x,shaper:n??et(r),defaultFont:S,environment:m,ligatureCaretPolicy:Jt,operation:Object.freeze({resourceEpoch:x.epoch,configEpoch:s,extensionFingerprint:b,shapingHash:Jr(m,r),producerVersion:1})})}async function Qr(e,t){return en(e,t,void 0,tt)}async function _a(e,t,n,r,o=false){return en(e,r,t,n,o)}function eo(e){e.shaper.dispose?.();}function rt(e){let t=new Set([0,e.text.length]);for(let r of chunkQ4RDWB3U_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 Ie(e,t){return rt(e).includes(t)}function to(e,t){return Ie(e,t)}function no(e,t,n){return n>=t&&Ie(e,t)&&Ie(e,n)}function ro(e){let t=chunkQ4RDWB3U_cjs.ka(e.text);return rt(e).map(n=>n===e.text.length?t.length:t.findIndex(r=>r.utf16From===n))}var at="und";function on(){return typeof Intl.Segmenter=="function"}function oo(){let e=Intl.Segmenter;if(typeof e!="function")throw new Error(`Intl.Segmenter is required for word segmentation (locale: ${at})`);return e}function an(){let e=new(oo())(at,{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 ao=/^[\p{L}\p{N}']$/u,io=/^\s$/u;function tn(e){return ao.test(e)}function nn(e){return io.test(e)}function ot(e,t,n,r){let o=e[t],a=e[n-1];return {utf16From:o.utf16From,utf16To:a.utf16To,wordLike:r}}function sn(e){let t=chunkQ4RDWB3U_cjs.ka(e);if(t.length===0)return [];let n=[],r=0;for(;r<t.length;){let o=t[r];if(nn(o.text)){let a=r+1;for(;a<t.length&&nn(t[a].text);)a+=1;n.push(ot(t,r,a,false)),r=a;continue}if(tn(o.text)){let a=r+1;for(;a<t.length&&tn(t[a].text);)a+=1;n.push(ot(t,r,a,true)),r=a;continue}n.push(ot(t,r,r+1,false)),r+=1;}return n}function cn(){return {segment:sn}}function ln(e={}){let t=e.isIntlAvailable??on,n=e.createIntlBoundary??an,r=e.createFallbackBoundary??cn;if(!t())return r();try{return n()}catch{return r()}}var rn;function dn(){return rn??=ln(),rn}function so(e,t=dn()){return t.segment(e)}function co(e,t){return t.map(n=>({graphemeFrom:chunkQ4RDWB3U_cjs.oa(e,n.utf16From),graphemeTo:chunkQ4RDWB3U_cjs.oa(e,n.utf16To),wordLike:n.wordLike}))}var un={resourceEpoch:"resource-scoped",configEpoch:"coarse-gate",extensionFingerprint:"coarse-gate",shapingHash:"coarse-gate",producerVersion:"coarse-gate"},ct=Object.keys(un),pn=ct.filter(e=>un[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`)},lo={resourceEpoch:Oe,configEpoch:Oe,extensionFingerprint:ee,shapingHash:ee,producerVersion:Oe},uo=(e,t)=>{lo[t](e[t],t);},te=e=>{for(let t of ct)uo(e,t);return Object.freeze({resourceEpoch:e.resourceEpoch,configEpoch:e.configEpoch,extensionFingerprint:e.extensionFingerprint,shapingHash:e.shapingHash,producerVersion:e.producerVersion})},po=(e,t)=>{let n=te(e),r=te(t),o=ct.filter(a=>n[a]!==r[a]);return o.length===0?Object.freeze({status:"current"}):Object.freeze({status:"restart",changed:Object.freeze(o)})},it=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)},fo=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:it(e.resourceDependencies),...te(e)})),yo=(e,t)=>{let n=it(e),r=it(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 mo(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=yo(e.resourceDependencies,t.resourceDependencies);if(n)return n;for(let r of pn)if(e[r]!==t[r])return {hit:false,reason:"epoch-changed",epoch:r};return null}var st=class{entries=new Map;get(t,n){let r=this.entries.get(t);if(!r)return {hit:false,reason:"absent"};let o=mo(r.provenance,n);return o||{hit:true,value:r.value,provenance:r.provenance}}set(t,n,r){this.entries.set(t,{value:n,provenance:fo(r)});}evictEpoch(t){let n=te(t),r=0;for(let[o,a]of this.entries){let i=a.provenance;pn.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 fn(e){return e.projected===true?null:e.range}function go(e,t,n){let{page:r,story:o,host:a,noteScopeId:i,noteAreaKind:c}=e,s=o==="header"||o==="footer"?d=>chunkQ4RDWB3U_cjs.ta(d,e.origin,{x:r.box.x,y:r.box.y}):void 0;chunkQ4RDWB3U_cjs.Ca(a,(d,l)=>{let{textboxDepth:f,textboxOwner:S,textboxPath:y,storyOrigin:b}=l,x=f===0?o:"textbox";for(let m of d.lines){let h=[...chunkQ4RDWB3U_cjs.Ja(m)].sort((g,R)=>(t.get(g.paragraphId)??Number.MAX_SAFE_INTEGER)-(t.get(R.paragraphId)??Number.MAX_SAFE_INTEGER));for(let g of h)for(let R of g.spans)n({page:r,story:x,rootStory:o,root:e,storyOrigin:b,absoluteBox:Object.freeze({x:b.x+R.box.x,y:b.y+R.box.y,width:R.box.width,height:R.box.height}),noteScopeId:i,noteAreaKind:c,textboxDepth:f,textboxOwner:S,textboxPath:y,paragraph:d,paragraphId:g.paragraphId,line:m,span:R,sourceRange:fn(R)});}},e.origin,s);}function So(e,t){let n=new Map(chunkQ4RDWB3U_cjs.Pa(e).map((r,o)=>[r,o]));chunkQ4RDWB3U_cjs.za(e,r=>go(r,n,t));}var xo=1,yn=4,V=Object.freeze({top:0,right:0,bottom:0,left:0}),mn=new WeakMap;function Ro(e,t){let n=Co(e);return n===V?t:chunkQ4RDWB3U_cjs.cb(t,n)}function Co(e){let t=e.vectorShape;if(!t)return V;let{cx:n,cy:r}=t.extentEmu;if(!(n>=0)||!(r>=0)||n===0&&r===0)return V;let o=mn.get(t);if(o||(o=Fo(t),mn.set(t,o)),o===V)return V;let a=e.paintBounds,i=e.geometry.contentBounds;if(!(a.width>0||i.width<=0)||!(a.height>0||i.height<=0))return V;let c=n>0?i.width/n:i.height/r,s=r>0?i.height/r:i.width/n,d=(f,S,y)=>{if(y<-1e-3)return 0;let b=f*S-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):V}function Fo(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=xo,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,chunkQ4RDWB3U_cjs.bb(l.strokeWidthEmu))/2;l.subpathsEmu.forEach((S,y)=>{let b=l.subpathsClosed?.[y]!==false,x=vo(S,b),m=b&&x.length>2?x.length:x.length-1,h=[];for(let R=0;R<m;R+=1){let v=x[R],L=x[(R+1)%x.length],T=Math.hypot(L.x-v.x,L.y-v.y),p={x:-(L.y-v.y)/T,y:(L.x-v.x)/T};if(h.push(p),!!Eo(v,L,-s,t+s,-s,n+s))for(let u=0;u<2;u+=1){let C=G[u],F=v.x+(L.x-v.x)*C,E=v.y+(L.y-v.y)*C;c(F+p.x*f,E+p.y*f),c(F-p.x*f,E-p.y*f);}}let g=b&&x.length>2?h.length:h.length-1;for(let R=0;R<g;R+=1){let v=x[(R+1)%x.length];if(!d(v))continue;let L=h[R],T=h[(R+1)%h.length],p=1+L.x*T.x+L.y*T.y;if(p<2/(yn*yn))continue;let u=L.y*-T.x- -L.x*T.y;if(u===0)continue;let C=u>0?-1:1;c(v.x+C*(L.x+T.x)*f/p,v.y+C*(L.y+T.y)*f/p);}});for(let S of l.arrowheadsEmu??[])if(!(!S[0]||!d(S[0])))for(let y of S)c(y.x,y.y);}return r>=0&&o>=0&&a<=t&&i<=n?V:Object.freeze({left:-r,top:-o,right:a-t,bottom:i-n})}function vo(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 G=new Float64Array(2);function Eo(e,t,n,r,o,a){let i=t.x-e.x,c=t.y-e.y;return G[0]=0,G[1]=1,Te(-i,e.x-n)&&Te(i,r-e.x)&&Te(-c,e.y-o)&&Te(c,a-e.y)}function Te(e,t){if(e===0)return t>=0;let n=t/e;return e<0?G[0]=Math.max(G[0],n):G[1]=Math.min(G[1],n),G[0]<=G[1]}function N(e){return (e.kerningEnabled??e.kerningMinPt>0)&&e.kerningMinPt>0&&e.fontSizePt>=e.kerningMinPt}var bn="Calibri, Carlito, Helvetica, Arial, sans-serif",ei=new Map([["calibri","Carlito"]]),Lo=65536,Bo=256;function hn(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 gn(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 Sn=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function xn(e=null){return e!=null&&typeof e.measureText=="function"}function Rn(e={}){let t=e.scale??1;if(!(t>0)||!Number.isFinite(t))return null;let n=e.fallbackFamily??bn,r=e.context??null;if(!xn(r))return null;let o=r,a=gn(hn(e.maxWidthEntries,Lo)),i=gn(hn(e.maxMetricsEntries,Bo)),c=e.fontAlias,s=l=>{let f=l.fontFamily&&Sn.test(l.fontFamily)?l.fontFamily:null,S=f?c?.(f):void 0,y=S&&Sn.test(S)?S:null,b=f?y?`"${y}", "${f}", ${n}`:`"${f}", ${n}`:n,x=l.bold?"bold":"normal",m=l.italic?"italic":"normal",h=l.smallCaps?"small-caps":"normal",g=l.fontSizePt*chunkQ4RDWB3U_cjs.da(l)*t;return `${m} ${h} ${x} ${g}px ${b}`},d=(l,f,S)=>l/t*(S.horizontalScalePercent/100)+f.length*S.characterSpacingPt;return {measure(l,f){if(l.length===0)return 0;let S=s(f),y=`${S}\0${N(f)}\0${l}`,b=a.get(y);if(b!==void 0)return d(b,l,f);o.font=S,"fontKerning"in o&&(o.fontKerning=N(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"||chunkQ4RDWB3U_cjs.ka(l).length!==1)return;o.font=s(f),"fontKerning"in o&&(o.fontKerning=N(f)?"normal":"none");let S=o.textAlign,y=o.direction,b;try{S!==void 0&&(o.textAlign="left"),y!==void 0&&(o.direction="ltr"),b=o.measureText(l);}finally{S!==void 0&&(o.textAlign=S),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 h=f.horizontalScalePercent/(100*t);return {left:-x*h,right:m*h}},lineMetrics(l){let f=l.fontSizePt*chunkQ4RDWB3U_cjs.da(l),S=s(l),y=i.get(S);if(y)return y;let b=f*1.15,x=f*.8;o.font=S,"fontKerning"in o&&(o.fontKerning=N(l)?"normal":"none");let m=o.measureText("Hxg"),h=m.fontBoundingBoxAscent,g=m.fontBoundingBoxDescent;if(typeof h=="number"&&Number.isFinite(h)&&h>0&&(x=h/t,typeof g=="number"&&Number.isFinite(g)&&g>=0)){let v=(h+g)/t;v>0&&(b=Math.max(v,b));}b>0||(b=f*1.15);let R={height:b,baseline:x};return i.set(S,R),R}}}function Io(e=1,t={}){let n=Rn({...t,scale:t.scale??e});return n?{measurer:n,producer:t.fontAlias?"canvas-measurer+embedded":"canvas-measurer"}:{measurer:chunkQ4RDWB3U_cjs.fa(),producer:"fixed-measurer"}}function Oo(e){let t;return n=>{t===void 0&&(t=chunkQ4RDWB3U_cjs.Yc(e.pages)?.hosts??null);let r=t?.get(n);return r?chunkQ4RDWB3U_cjs.Wc(r.pageNumber,r.format):null}}function Cn(e,t){let n=chunkQ4RDWB3U_cjs.xc(e,t.displayMode??chunkQ4RDWB3U_cjs.Ra),r=chunkQ4RDWB3U_cjs.uc({numberingIndex:t.numberingIndex,styleCascade:t.styleCascade},n).listItems,o=t.package?{footnotesPart:chunk6KA3L3FR_cjs.bg(t.package,"footnote"),endnotesPart:chunk6KA3L3FR_cjs.bg(t.package,"endnote")}:void 0,a=chunkQ4RDWB3U_cjs.Uc(n,r,o,t.package?chunkQ4RDWB3U_cjs.Rc(t.package,e,n):void 0,t.displayMode??chunkQ4RDWB3U_cjs.Ra);return {blocks:n,notes:o,context:a}}function Fn(e,t,n,r,o){for(let a of t){if(r.length>=chunk6KA3L3FR_cjs.Vh)return;if(n.tokenForParagraph(a.id)!==""&&chunk6KA3L3FR_cjs.Yh(e,a.id)===null)for(let i of chunk6KA3L3FR_cjs.Xh(a)){if(r.length>=chunk6KA3L3FR_cjs.Vh)return;if(!i.rewritable)continue;let c=chunkQ4RDWB3U_cjs.ob(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&&chunkQ4RDWB3U_cjs.Xc(d.calibration,d.cached,l,Number.NaN)&&(s=l);}}s===null||s===i.cachedText||s.length>chunk6KA3L3FR_cjs.Wh||s.includes(`
2
+ `)||s.includes("\r")||r.push({paragraphId:a.id,fieldNodeId:i.fieldNodeId,text:s});}}}function To(e,t){let{blocks:n,context:r}=Cn(e,t);if(r===null)return null;let o=[];return Fn(e,chunkQ4RDWB3U_cjs.sc(chunkQ4RDWB3U_cjs.mc(n)),r,o,t.pageRefPageNumberOf),o.length===0?null:{op:"refreshFieldResults",updates:o}}function ui(e,t){let{notes:n,context:r}=Cn(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 chunkQ4RDWB3U_cjs.Sc(c,t.displayMode??chunkQ4RDWB3U_cjs.Ra)){if(s.length>=chunk6KA3L3FR_cjs.Vh)break;Fn(c,chunkQ4RDWB3U_cjs.sc(chunkQ4RDWB3U_cjs.mc(d)),r,s);}s.length>0&&o.push({noteKind:i,op:{op:"refreshFieldResults",updates:s}});}return o}function wo(e){return e.box}function vn(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)vn(o,t);}function Ao(e){let t=new Map,n=(o,a,i)=>{if(!(o.kind==="textValue"||i>chunk6KA3L3FR_cjs.kb*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=chunk6KA3L3FR_cjs.ub(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 Po(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 _o(e,t){let n=chunk6KA3L3FR_cjs.yb(e.root);if(n.length===0)return Mo;let r=new Map;t.pages.forEach((i,c)=>{(d=>{for(let l of d){let f=new Set;vn(l,f);for(let S of f){let y=r.get(S)??[];y.push({pageIndex:c,box:wo(l)}),r.set(S,y);}}})(i.fragments);});let o=Ao(e.root),a=[];for(let i of n){let c=chunk6KA3L3FR_cjs.wb(i.node),s=[...i.ancestors.map(S=>chunk6KA3L3FR_cjs.wb(S).lock),c.lock],d=o.get(i.node.id)??[],l=new Map;for(let S of d)for(let y of r.get(S)??[]){let b=l.get(y.pageIndex);l.set(y.pageIndex,b?Po(b,y.box):y.box);}let f=[...l.entries()].sort((S,y)=>S[0]-y[0]).map(([S,y])=>({pageIndex:S,...y}));a.push({controlId:i.node.id,type:c.type,level:chunk6KA3L3FR_cjs.xb(i.node),depth:i.depth,lock:c.lock,effectiveLock:chunk6KA3L3FR_cjs.Bb(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 Mo=Object.freeze([]);function Ln(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 Vo(e,t){let n=new Map;for(let r of e.pages)for(let[o,a]of jo(r,t))n.has(o)||n.set(o,a);return n}var En=new WeakMap;function jo(e,t){let n=En.get(t);n||(n=new WeakMap,En.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 Yo(e,t){let n=chunkT7RGKBCE_cjs.oa(e);if(!n)return null;let r=t.get(n.start.paragraphId);return r?{pageIndex:r.pageIndex,y:r.contentY+Ln(r,n.start.paragraphId,n.start.offset)}:null}var Bn=new WeakMap;function $o(e){let t=Bn.get(e);if(t!==void 0)return t;let n=chunkQ4RDWB3U_cjs.j(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 Bn.set(e,o),o}function In(e,t,n,r,o){if(r>o||Math.abs(n.height-t)>o||!$o(e))return n;let a=t*.3;return {height:n.height+a,baseline:n.baseline+a/2}}var qo="abcdefghijklmnopqrstuvwxyz";function q(e){let t=Math.round(e.fontSizePt*2);return Math.max(1,t)}function W(e,t,n,r,o){let a=r.shaping?.context;return e.shape({text:o,fontSizeHalfPoints:q(r),bidiLevel:r.shaping?.direction==="rtl"?1:0,environment:Zo(t,n,r),...a?{context:a}:{}})}var On=new WeakMap;function Zo(e,t,n){if(!Object.isFrozen(e)||!Object.isFrozen(e.features)||!Object.isFrozen(e.variationAxes)||!Object.isFrozen(e.shapingLibrary))return Tn(e,t,n);let r=n.shaping?.direction??"ltr",o=n.shaping?.script,a=`${r}|${o??""}|${N(n)?1:0}|${e.documentLigatures?chunkQ4RDWB3U_cjs.B(n):""}|${n.smallCaps?1:0}`,i=On.get(e);i||On.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=Tn(e,t,n)),s}function Tn(e,t,n){return chunkQ4RDWB3U_cjs.q({...e,font:t,direction:n.shaping?.direction??"ltr",script:n.shaping?.script==="Zyyy"?e.script:n.shaping?.script??e.script,features:{...e.features,kern:N(n)?1:0,...e.documentLigatures?chunkQ4RDWB3U_cjs.A(n):{},...n.smallCaps?{smcp:1}:{}},fallbackOrder:[]})}function we(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=W(e,t,n,{...r,smallCaps:!0},c),d=W(e,t,n,{...r,smallCaps:!1},c);if(!(s.glyphs.length!==d.glyphs.length||s.glyphs.some((f,S)=>f.id!==d.glyphs[S]?.id))){i=!1;break}}}catch{i=false;}return o.set(n,i),i}function wn(e,t,n,r,o){let a=new WeakMap;return (i,c)=>{let s=chunkQ4RDWB3U_cjs.da(c),d=a.get(i);d||(d=new Map,a.set(i,d));let l=q(c),f=d.get(l);if(f)return s===1?f:{height:f.height*s,baseline:f.baseline*s};let S,y=true,b=i.substitution?.lineMetrics;if(b){let x=l/2;S={height:b.heightEm*x,baseline:b.baselineEm*x};}else try{let x=W(e,t,i,c,""),m=x.metrics.ascent/t.fixedPointScale,h=x.metrics.descent/t.fixedPointScale,g=l/2,R=m+h,v=g*r,L=R>v?v/R:1,T=R*L,p=Math.min(Math.max(0,x.metrics.lineGap/t.fixedPointScale),T*o),u=T+p;u>0?S=In(i,g,{height:u,baseline:m*L+p},p,2/t.fixedPointScale):(S=n.lineMetrics(c),y=!1);}catch{S=n.lineMetrics(c),y=false;}return y?(d.set(l,S),s===1?S:{height:S.height*s,baseline:S.baseline*s}):S}}var lt=new WeakMap;function Jo(e){let t=lt.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))){lt.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 lt.set(e,i??null),i}function An(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=Jo(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 Qo(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 Pn(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 _n(e,t){let n=e.byteLength,r=new DataView(e.buffer,e.byteOffset,n),o=Qo(r,n,t);if(o===null)return null;let a=Pn(r,n,o,1751474532,54);if(a===null)return null;let i=r.getUint16(a+18);if(i<=0)return null;let c=Pn(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 ea=.5,ta=4,Mn=4096;function zn(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=wn(r,i,a,ta,ea),l=new WeakMap,f=new WeakMap,S=new Array(Mn),y=0,b=(p,u,C)=>{let F=S[y];F&&F.cache.delete(F.text),p.set(u,C),S[y]={cache:p,text:u},y=(y+1)%Mn;},x=p=>{let u=l.get(p);if(u!==void 0)return u;let C=o(p);return l.set(p,C),C},m=(p,u,C)=>{let F=C?s:c,E=F.get(p);E||(E=new Map,F.set(p,E));let O=E.get(u);return O||(O=new Map,E.set(u,O)),O},h=new WeakMap,g=p=>{if(!p.shaping?.wordSpacingPt)return p;let u=h.get(p);return u||(u={...p,shaping:{...p.shaping,wordSpacingPt:void 0}},h.set(p,u)),u},R=(p,u)=>u.shaping?.wordSpacingPt?chunkQ4RDWB3U_cjs.Dd(p)*u.shaping.wordSpacingPt:0,v=(p,u)=>a.measure(p,g(u))+R(p,u),L=(p,u)=>{let C=Math.max(0,a.measure(p,g(u))),F=a.caretAdvances?.(p,g(u))??chunkQ4RDWB3U_cjs.Bd(p,C);if(!F||F.length!==p.length+1)return chunkQ4RDWB3U_cjs.Bd(p,v(p,u));let E=Math.max(0,v(p,u)),O=0,_=0;return F.map((w,I)=>{if(I===0)return 0;p[I-1]===" "&&_++;let A=w+_*(u.shaping?.wordSpacingPt??0);return O=Math.max(O,Math.min(E,Number.isFinite(A)?A:O)),I===p.length?E:O})},T=new WeakMap;return {hasResolvedFont(p){return x(p)!==null},strikeoutMetrics(p){let u=x(p);if(!u)return;let C=T.get(u);if(C===void 0&&(C=_n(u.bytes,u.faceIndex),T.set(u,C)),!C)return;let F=q(p)/2*chunkQ4RDWB3U_cjs.da(p);return {offsetPt:C.offsetEm*F,thicknessPt:C.thicknessEm*F}},measure(p,u){if(p.length===0)return 0;let C=x(u);if(!C)return v(p,u);let F=m(C,q(u),u.smallCaps),E=u.shaping?.context,O=u.shaping?`1:${JSON.stringify(E?[u.shaping.script,u.shaping.direction,p,E.before,E.after]:[u.shaping.script,u.shaping.direction,p])}`:`0:${p}`,_=`${N(u)?1:0}:${chunkQ4RDWB3U_cjs.B(u)}:${O}`,w=F.get(_);if(w===void 0){let I=0;try{if(u.smallCaps&&!we(r,i,C,u,f))return v(p,u);let A=W(r,i,C,u,p);if(A.glyphs.some(Z=>Z.id===0))return v(p,u);for(let Z of A.glyphs)I+=Z.advanceX;}catch{return v(p,u)}w=I/i.fixedPointScale,b(F,_,w);}return w*chunkQ4RDWB3U_cjs.da(u)*(u.horizontalScalePercent/100)+p.length*u.characterSpacingPt+R(p,u)},inkBounds(p,u){if(!p||p.length>2||u.shaping?.direction==="rtl"||chunkQ4RDWB3U_cjs.ka(p).length!==1)return;let C=x(u);if(!C)return a.inkBounds?.(p,u);try{if(u.smallCaps&&!we(r,i,C,u,f))return a.inkBounds?.(p,u);let F=W(r,i,C,u,p);return An(F,q(u)/2,i.fixedPointScale,chunkQ4RDWB3U_cjs.da(u)*u.horizontalScalePercent/100)}catch{return}},caretAdvances(p,u){let C=x(u);if(!C)return L(p,u);try{if(u.smallCaps&&!we(r,i,C,u,f))return L(p,u);let F=W(r,i,C,u,p);return F.glyphs.some(E=>E.id===0)?L(p,u):chunkQ4RDWB3U_cjs.Cd(p,F,chunkQ4RDWB3U_cjs.da(u)*(u.horizontalScalePercent/100)/i.fixedPointScale,u.characterSpacingPt,u.shaping?.wordSpacingPt??0)??chunkQ4RDWB3U_cjs.Bd(p,F.glyphs.reduce((E,O)=>E+O.advanceX,0)*chunkQ4RDWB3U_cjs.da(u)*(u.horizontalScalePercent/100)/i.fixedPointScale+p.length*u.characterSpacingPt+R(p,u))}catch{return L(p,u)}},lineMetrics(p,u){let C=x(p);if(!C)return a.lineMetrics(p,u);if(!u||/^[\t\n\r\f ]*$/.test(u))return d(C,p);try{let F=W(r,i,C,p,u),E=0,O=0;for(let _ of F.fontSpans){let w=d(_.font,p);E=Math.max(E,w.baseline),O=Math.max(O,w.height-w.baseline);}if(E+O>0)return {height:E+O,baseline:E}}catch{}return d(C,p)}}}function na(e,t){return zn({...t,shaper:e.shaper,environment:e.environment})}function ra(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=oa(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 oa(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 kn=["text-local","paragraph-local","flow-structural","global"];function Nn(e,t){return kn.indexOf(t)>kn.indexOf(e)?t:e}function aa(e){return {impact:"text-local",paragraphIds:new Set,created:new Set,deleted:new Set,dependencyKeys:new Set,structural:false,revision:e}}function ia(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 h=e.runCooperatively;if(!h)return t(m);let g=h(m);c=g;try{for(;;){let R=g.step();if(R)return R;if(n()!==m.revision)return g.cancel(),d+=1,null;if(c!==g)return null}}finally{c===g&&(c=null);}}function f(m){let h=y(n());h.impact=Nn(h.impact,m.impact),h.structural=h.structural||m.structural;for(let g of m.paragraphIds)h.paragraphIds.add(g);for(let g of m.created)h.created.add(g);for(let g of m.deleted)h.deleted.add(g);for(let g of m.dependencyKeys)h.dependencyKeys.add(g);}let S=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=aa(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 h=S(m),g=l(h);return !g||g.revision!==n()?(s+=1,f(h),b(),false):(r(g,h),true)}return {notify(m){let h=y(n());h.impact=Nn(h.impact,m.impact);for(let g of m.dirty)h.paragraphIds.add(g);for(let g of m.created)h.created.add(g),h.paragraphIds.add(g);for(let g of m.deleted)h.deleted.add(g),h.paragraphIds.add(g);for(let g of m.dependencyKeys)h.dependencyKeys.add(g);for(let g of m.splitJoin)h.structural=true,"split"in g?(h.paragraphIds.add(g.split.from),h.paragraphIds.add(g.split.tail)):(h.paragraphIds.add(g.join.kept),h.paragraphIds.add(g.join.removed));(m.impact==="flow-structural"||m.impact==="global")&&(h.structural=true),b();},invalidateAll(m,h){let g=y(m);g.impact="flow-structural",g.structural=true,h&&g.dependencyKeys.add(h),b();},flush:x,pending:()=>a?S(a):null,cancel(){i?.(),i=null,c?.cancel(),c=null,a=null;},get staleDiscards(){return s},get cancelledRuns(){return d}}}var Dn=new WeakMap;function K(e){let t=Dn.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 S of s){if(S.kind==="paragraph")continue;let y=S.tableId;a.set(y,Math.max(a.get(y)??0,(S.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 S.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 h of x.cells)n.get(y).push({pageIndex:d,tableId:y,row:x,cell:h,rowIndex:m,isHeaderRepeat:x.isHeaderRepeat,offsetX:l,offsetY:f}),i(h.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 Dn.set(e,c),c}function Wn(e){let t=e.columnCount;for(let n of e.rows.values())for(let r of n)t=Math.max(t,j(r).to+1);return t}var j=e=>({from:e.gridColumn,to:e.gridColumn+Math.max(1,e.gridSpan)-1});function sa(e,t,n){if(t.tableId!==n.tableId)return null;let r=K(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(j(t).from,j(n).from),c=Math.max(j(t).to,j(n).to),s=y=>{let{from:b,to:x}=j(y);return x>=i&&b<=c},d=y=>(r.rows.get(y)??[]).some(b=>b.vMergeContinue&&s(b)),l=r.rows.size+Wn(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 h of m){if(!s(h))continue;let{from:g,to:R}=j(h);g<i&&(i=g,b=true),R>c&&(c=R,b=true);}for(;o>0&&d(o);)o-=1,b=true;for(;d(a+1);)a+=1,b=true;if(!b)break}let f=[],S=new Set;for(let y of r.placed){if(y.isHeaderRepeat||y.rowIndex<o||y.rowIndex>a)continue;let{from:b,to:x}=j(y.cell);x<i||b>c||S.has(y.cell.id)||(S.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:ca(e,t.tableId,f)}}function Yi(e,t){return Kn(e,t,true)}function Ae(e,t){return Kn(e,t,false)}function Kn(e,t,n){let r=new Set(t),o=[],a=new Set;for(let i of K(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 chunkQ4RDWB3U_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 ca(e,t,n){let r=Ae(e,n),o=r[0],a=r[r.length-1];return !o||!a?la(e,t):{anchor:{paragraphId:o,offset:0},head:{paragraphId:a,offset:chunkQ4RDWB3U_cjs.$e(e,a).length}}}function la(e,t){let n=K(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 chunkQ4RDWB3U_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 da(e){let t=[...chunkQ4RDWB3U_cjs.ua(e)];for(let n of [e.header,e.footer])n&&t.push(...chunkQ4RDWB3U_cjs.va(n.fragments));for(let n of [e.footnotes,e.endnotes])if(n)for(let r of n.notes)t.push(...chunkQ4RDWB3U_cjs.va(r.fragments));return t}function ua(e,t){let n=new Set(Ae(e,t)),r=[],o=new Set;for(let a of e.pages)for(let i of da(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 pa(e,t){let n=new Set(t),r=[];for(let o of K(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 fa(e,t){let n=K(e).get(t.tableId);if(!n)return "";let r=new Set(t.cellIds),o=n.placed.some(c=>c.cell.logicalGridColumn!==void 0),a=new Map,i=new Set;for(let c of n.placed){if(c.isHeaderRepeat||!r.has(c.cell.id)||i.has(c.cell.id))continue;i.add(c.cell.id);let s=Ae(e,[c.cell.id]).map(f=>chunkQ4RDWB3U_cjs.$e(e,f)).join(`
3
+ `),d=a.get(c.rowIndex),l=c.cell.gridColumn+(o?Math.max(1,c.cell.gridSpan)-1:0);d?d.set(l,s):a.set(c.rowIndex,new Map([[l,s]]));}return [...a.keys()].sort((c,s)=>c-s).map(c=>{let s=a.get(c),d=[];for(let l=0;l<=t.columns.to-t.columns.from;l+=1){let f=o?t.columns.to-l:t.columns.from+l;d.push(s.get(f)??"");}return d.join(" ")}).join(`
4
+ `)}function dt(e,t){return ma(e).get(t)??null}var Hn=new WeakMap;function ya(e){let t=Hn.get(e);if(t)return t;let n=[];for(let r of e.blocks)ne(r,n,new Set);return Hn.set(e,n),n}var Un=new WeakMap;function ma(e){let t=Un.get(e);if(t)return t;let n=new Map;for(let[r,o]of K(e)){let a;for(let i of o.placed)if(!i.isHeaderRepeat)for(let c of ya(i.cell)){let s=n.get(c);s&&s.tableId.length>=r.length||(a??=Wn(o),n.set(c,{tableId:r,rows:o.rows.size,columns:a,rowIndex:i.rowIndex,columnIndex:i.cell.logicalGridColumn??i.cell.gridColumn}));}}return Un.set(e,n),n}function $i(e,t,n){if(n){let a=dt(e,t);if(!a||a.tableId!==n.tableId)return null;let i=n.cellIds[0];if(!i)return null;let c=K(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=dt(e,t);if(!r)return null;let o=K(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 Gn=new WeakMap;function qi(e,t){let n=Gn.get(e);if(n)return n.get(t)??null;let r=new Map;for(let[o,a]of K(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 Gn.set(e,r),r.get(t)??null}function ha(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.$=we;exports.A=an;exports.B=sn;exports.C=cn;exports.D=ln;exports.E=dn;exports.F=so;exports.G=co;exports.H=te;exports.I=po;exports.J=st;exports.K=fn;exports.L=So;exports.M=Ro;exports.N=N;exports.O=bn;exports.P=ei;exports.Q=xn;exports.R=Rn;exports.S=Io;exports.T=Oo;exports.U=To;exports.V=ui;exports.W=_o;exports.X=Ln;exports.Y=Vo;exports.Z=Yo;exports._=W;exports.a=$n;exports.aa=zn;exports.b=$;exports.ba=na;exports.c=Ze;exports.ca=ra;exports.d=qn;exports.da=ia;exports.e=B;exports.ea=sa;exports.f=Je;exports.fa=Yi;exports.g=Wt;exports.ga=Ae;exports.h=et;exports.ha=ua;exports.i=La;exports.ia=pa;exports.j=U;exports.ja=fa;exports.k=$r;exports.ka=dt;exports.l=qr;exports.la=$i;exports.m=Aa;exports.ma=qi;exports.n=nt;exports.na=ha;exports.o=Pa;exports.p=Zr;exports.q=Qr;exports.r=_a;exports.s=eo;exports.t=rt;exports.u=Ie;exports.v=to;exports.w=no;exports.x=ro;exports.y=at;exports.z=on;
@@ -1 +1 @@
1
- import {ug,Ha,Ma,gc,fc,Aa,za,Pi,da,Ba,Lb,Fb,Eb,ea}from'./chunk-3B3DQMSL.js';var X=new Set(["document","hdr","ftr","footnotes","endnotes"]),W=24,U=512,E=ug(W);function z(o){let t=o.root;return t.namespaceUri===da&&X.has(t.localName)}function $(o){let t=[],e=r=>{if(r.kind!=="textValue"){r.namespaceUri===da&&r.localName==="p"&&t.push(r);for(let i of r.children)e(i);}};return e(o.root),t}function V(o){let t=Lb(o);let e=[],r=new Set;for(let i of $(t)){let n=Fb(i);if(!n||!Eb(n))continue;let a=n.toUpperCase();if(r.has(a))continue;r.add(a);let s=Pi(t,i.id);s!==null&&e.push(Object.freeze({paragraphId:a,nodeId:i.id,text:s}));}return Object.freeze(e)}function Y(o){let t=E.get(o.root);if(t)return t;let e=Lb(o);let r=new Map,i=new Set,n=a=>{if(a.kind!=="textValue"){if(a.namespaceUri===da&&a.localName==="p"){let s=Fb(a);if(s&&Eb(s)){let p=s.toUpperCase();i.has(p)||(i.add(p),a.kind==="paragraph"&&r.set(p,a.id));}}for(let s of a.children)n(s);}};return n(e.root),E.set(o.root,r),r}function w(o,t){if(o.length!==t.length)return false;for(let e=0;e<o.length;e+=1)if(o[e].root!==t[e])return false;return true}function B(o){let t=new Map,e=null,r=(n,a,s)=>{for(t.delete(n),t.set(n,{partName:a.name,root:a.root,nodeId:s});t.size>U;){let p=t.keys().next();if(p.done)break;t.delete(p.value);}},i=(n,a)=>{let s=t.get(n);if(!s)return null;let p=a.find(c=>c.name===s.partName);if(!p)return null;if(p.root===s.root)return {part:p,nodeId:s.nodeId};let l=Ha(p,s.nodeId);if(!l||l.kind!=="paragraph")return null;let d=Fb(l);return !d||d.toUpperCase()!==n?null:(r(n,p,s.nodeId),{part:p,nodeId:s.nodeId})};return n=>{let a=o(),s=i(n,a);if(s)return s;if(e&&e.ids.has(n)&&w(a,e.roots))return null;for(let p of a){let l=Y(p).get(n);if(l!==void 0)return r(n,p,l),{part:p,nodeId:l}}return (!e||!w(a,e.roots))&&(e={roots:a.map(p=>p.root),ids:new Set}),e.ids.size<U&&e.ids.add(n),null}}function H(o,t){return Ba(o,t)}var q=Object.freeze({kind:"body"}),F=1e6;function b(o,t){if(t<=0||t>=o.length)return false;let e=o.charCodeAt(t-1),r=o.charCodeAt(t);return e>=55296&&e<=56319&&r>=56320&&r<=57343}function Q(o,t,e){if(t===e)return [];let r=0,i=Math.min(t.length,e.length);for(;r<i&&t.charCodeAt(r)===e.charCodeAt(r);)r+=1;for(;r>0&&(b(t,r)||b(e,r));)r-=1;let n=0;for(;n<t.length-r&&n<e.length-r&&t.charCodeAt(t.length-n-1)===e.charCodeAt(e.length-n-1);)n+=1;for(;n>0&&(b(t,t.length-n)||b(e,e.length-n));)n-=1;let a=t.length-r-n,s=e.slice(r,e.length-n),p=[];return a>0&&p.push({op:"deleteText",paragraphId:o,start:r,end:r+a}),s.length>0&&p.push({op:"insertText",paragraphId:o,offset:r,text:s}),Object.freeze(p)}function K(o){let t=r=>!!r&&r.kind!=="textValue"&&r.namespaceUri===da&&r.localName==="t"&&r.attributes.every(i=>i.namespaceUri===ea&&i.localName==="space")&&r.children.every(i=>i.kind==="textValue"),e=[];for(let r of o){let i=e.at(-1);if(!t(i)||!t(r)){e.push(r);continue}let n=i.children.map(a=>a.kind==="textValue"?a.value:"").join("")+r.children.map(a=>a.kind==="textValue"?a.value:"").join("");e[e.length-1]={...i,attributes:/^\s|\s$/.test(n)?[{kind:"xmlSpace",namespaceUri:ea,localName:"space",prefix:"xml",value:"preserve"}]:[],children:[{id:i.children[0]?.id??`${i.id}/text`,kind:"textValue",value:n}]};}return e}function G(o){if(o.kind==="textValue")return o;let t=false,e=o.children.map(r=>{let i=G(r);return i!==r&&(t=true),i});if(o.namespaceUri===da&&o.localName==="r"){let r=K(e);(r.length!==e.length||r.some((i,n)=>i!==e[n]))&&(e=[...r],t=true);}return t?{...o,children:e}:o}function rr(o,t,e){let r=o.parts.get(t);if(!r)return o;let i=false,n=new Set;for(let a of e)(a.op==="insertText"||a.op==="deleteText")&&!a.revision&&n.add(a.paragraphId);for(let a of n){let s=Ha(r,a);if(!s||s.kind==="textValue")continue;let p=G(s);if(p===s)continue;let l=Ma(r,a,p,{deferValidation:true});l.ok&&(r=l.part,i=true);}return i?gc(o,r):o}function er(o,t){let e=t.documentId.trim();if(e.length===0||e.length>256)throw new TypeError("documentId must contain 1 to 256 characters");let r=()=>V(o.bodyStore().part),i,a=B(()=>{let l=o.bodyStore().part,d=o.currentPackage();if(i?.pkg===d&&i.body===l)return i.parts;let c=[l];for(let g of d.parts.values())g===l||!z(g)||c.push(g);return i={pkg:d,body:l,parts:Object.freeze(c)},i.parts}),s=(l,d)=>{if(l.length===0)return {ok:true,changed:false};let c=r(),g=new Set,h=[];for(let u of l){if(typeof u.text!="string"||u.text.length>F)return {ok:false,reason:"collaboration-text-limit"};if(typeof u.paragraphId!="string"||u.paragraphId.length===0||u.paragraphId.length>256)return {ok:false,reason:"unknown-paragraph-id"};let m=u.paragraphId.toUpperCase();if(g.has(m))return {ok:false,reason:"duplicate-paragraph-id"};g.add(m);let N=c.filter(L=>L.paragraphId===m);if(N.length!==1)return {ok:false,reason:"unknown-paragraph-id"};let T=N[0];h.push(...Q(T.nodeId,T.text,u.text));}if(h.length===0)return {ok:true,changed:false};let y=o.transact(q,u=>{for(let m of h)u.apply(m);u.applyPackage(m=>rr(m,m.mainDocumentPart,h));},{origin:d.origin,actorId:d.actorId,operationId:d.operationId,recordsHistory:false});return y.ok?{ok:true,changed:y.change!==null}:{ok:false,reason:y.detail??y.reason}};return Object.freeze({documentId:e,paragraphs:r,paragraphByNodeId(l){return r().find(d=>d.nodeId===l)??null},paragraphByStableId(l){let d=l.toUpperCase(),c=a(d);if(!c)return null;let g=Pi(c.part,c.nodeId);return g===null?null:Object.freeze({paragraphId:d,nodeId:c.nodeId,text:g})},applyParagraphText(l,d,c){return s([{paragraphId:l,text:d}],c)},applyParagraphTexts:s,applyRemotePackage(l,d){let c=o.publishRemotePackage(l,d);return c.ok?{ok:true,changed:c.change!==null}:{ok:false,reason:c.detail??c.reason}},revision:()=>o.packageRevision,subscribe:l=>o.subscribe(l),observePrimitiveJournal:l=>H(o,l),hasPendingJournals:()=>za(o),flushPendingJournals:()=>{Aa(o);},save:()=>fc(o.currentPackage()),binaryPart(l){let d=o.currentPackage();return d.partBytes.get(l)??d.partBytes.get(l.startsWith("/")?l.slice(1):`/${l}`)??null}})}export{rr as a,er as b};
1
+ import {Yg,Ha,Ma,Kd,Jd,Aa,za,rj,da,Ba,eb,_a,Za,ea}from'./chunk-XRBPZCNK.js';var X=new Set(["document","hdr","ftr","footnotes","endnotes"]),W=24,U=512,E=Yg(W);function z(o){let t=o.root;return t.namespaceUri===da&&X.has(t.localName)}function $(o){let t=[],e=r=>{if(r.kind!=="textValue"){r.namespaceUri===da&&r.localName==="p"&&t.push(r);for(let i of r.children)e(i);}};return e(o.root),t}function V(o){let t=eb(o);let e=[],r=new Set;for(let i of $(t)){let n=_a(i);if(!n||!Za(n))continue;let a=n.toUpperCase();if(r.has(a))continue;r.add(a);let s=rj(t,i.id);s!==null&&e.push(Object.freeze({paragraphId:a,nodeId:i.id,text:s}));}return Object.freeze(e)}function Y(o){let t=E.get(o.root);if(t)return t;let e=eb(o);let r=new Map,i=new Set,n=a=>{if(a.kind!=="textValue"){if(a.namespaceUri===da&&a.localName==="p"){let s=_a(a);if(s&&Za(s)){let p=s.toUpperCase();i.has(p)||(i.add(p),a.kind==="paragraph"&&r.set(p,a.id));}}for(let s of a.children)n(s);}};return n(e.root),E.set(o.root,r),r}function w(o,t){if(o.length!==t.length)return false;for(let e=0;e<o.length;e+=1)if(o[e].root!==t[e])return false;return true}function B(o){let t=new Map,e=null,r=(n,a,s)=>{for(t.delete(n),t.set(n,{partName:a.name,root:a.root,nodeId:s});t.size>U;){let p=t.keys().next();if(p.done)break;t.delete(p.value);}},i=(n,a)=>{let s=t.get(n);if(!s)return null;let p=a.find(c=>c.name===s.partName);if(!p)return null;if(p.root===s.root)return {part:p,nodeId:s.nodeId};let l=Ha(p,s.nodeId);if(!l||l.kind!=="paragraph")return null;let d=_a(l);return !d||d.toUpperCase()!==n?null:(r(n,p,s.nodeId),{part:p,nodeId:s.nodeId})};return n=>{let a=o(),s=i(n,a);if(s)return s;if(e&&e.ids.has(n)&&w(a,e.roots))return null;for(let p of a){let l=Y(p).get(n);if(l!==void 0)return r(n,p,l),{part:p,nodeId:l}}return (!e||!w(a,e.roots))&&(e={roots:a.map(p=>p.root),ids:new Set}),e.ids.size<U&&e.ids.add(n),null}}function H(o,t){return Ba(o,t)}var q=Object.freeze({kind:"body"}),F=1e6;function b(o,t){if(t<=0||t>=o.length)return false;let e=o.charCodeAt(t-1),r=o.charCodeAt(t);return e>=55296&&e<=56319&&r>=56320&&r<=57343}function Q(o,t,e){if(t===e)return [];let r=0,i=Math.min(t.length,e.length);for(;r<i&&t.charCodeAt(r)===e.charCodeAt(r);)r+=1;for(;r>0&&(b(t,r)||b(e,r));)r-=1;let n=0;for(;n<t.length-r&&n<e.length-r&&t.charCodeAt(t.length-n-1)===e.charCodeAt(e.length-n-1);)n+=1;for(;n>0&&(b(t,t.length-n)||b(e,e.length-n));)n-=1;let a=t.length-r-n,s=e.slice(r,e.length-n),p=[];return a>0&&p.push({op:"deleteText",paragraphId:o,start:r,end:r+a}),s.length>0&&p.push({op:"insertText",paragraphId:o,offset:r,text:s}),Object.freeze(p)}function K(o){let t=r=>!!r&&r.kind!=="textValue"&&r.namespaceUri===da&&r.localName==="t"&&r.attributes.every(i=>i.namespaceUri===ea&&i.localName==="space")&&r.children.every(i=>i.kind==="textValue"),e=[];for(let r of o){let i=e.at(-1);if(!t(i)||!t(r)){e.push(r);continue}let n=i.children.map(a=>a.kind==="textValue"?a.value:"").join("")+r.children.map(a=>a.kind==="textValue"?a.value:"").join("");e[e.length-1]={...i,attributes:/^\s|\s$/.test(n)?[{kind:"xmlSpace",namespaceUri:ea,localName:"space",prefix:"xml",value:"preserve"}]:[],children:[{id:i.children[0]?.id??`${i.id}/text`,kind:"textValue",value:n}]};}return e}function G(o){if(o.kind==="textValue")return o;let t=false,e=o.children.map(r=>{let i=G(r);return i!==r&&(t=true),i});if(o.namespaceUri===da&&o.localName==="r"){let r=K(e);(r.length!==e.length||r.some((i,n)=>i!==e[n]))&&(e=[...r],t=true);}return t?{...o,children:e}:o}function rr(o,t,e){let r=o.parts.get(t);if(!r)return o;let i=false,n=new Set;for(let a of e)(a.op==="insertText"||a.op==="deleteText")&&!a.revision&&n.add(a.paragraphId);for(let a of n){let s=Ha(r,a);if(!s||s.kind==="textValue")continue;let p=G(s);if(p===s)continue;let l=Ma(r,a,p,{deferValidation:true});l.ok&&(r=l.part,i=true);}return i?Kd(o,r):o}function er(o,t){let e=t.documentId.trim();if(e.length===0||e.length>256)throw new TypeError("documentId must contain 1 to 256 characters");let r=()=>V(o.bodyStore().part),i,a=B(()=>{let l=o.bodyStore().part,d=o.currentPackage();if(i?.pkg===d&&i.body===l)return i.parts;let c=[l];for(let g of d.parts.values())g===l||!z(g)||c.push(g);return i={pkg:d,body:l,parts:Object.freeze(c)},i.parts}),s=(l,d)=>{if(l.length===0)return {ok:true,changed:false};let c=r(),g=new Set,h=[];for(let u of l){if(typeof u.text!="string"||u.text.length>F)return {ok:false,reason:"collaboration-text-limit"};if(typeof u.paragraphId!="string"||u.paragraphId.length===0||u.paragraphId.length>256)return {ok:false,reason:"unknown-paragraph-id"};let m=u.paragraphId.toUpperCase();if(g.has(m))return {ok:false,reason:"duplicate-paragraph-id"};g.add(m);let N=c.filter(L=>L.paragraphId===m);if(N.length!==1)return {ok:false,reason:"unknown-paragraph-id"};let T=N[0];h.push(...Q(T.nodeId,T.text,u.text));}if(h.length===0)return {ok:true,changed:false};let y=o.transact(q,u=>{for(let m of h)u.apply(m);u.applyPackage(m=>rr(m,m.mainDocumentPart,h));},{origin:d.origin,actorId:d.actorId,operationId:d.operationId,recordsHistory:false});return y.ok?{ok:true,changed:y.change!==null}:{ok:false,reason:y.detail??y.reason}};return Object.freeze({documentId:e,paragraphs:r,paragraphByNodeId(l){return r().find(d=>d.nodeId===l)??null},paragraphByStableId(l){let d=l.toUpperCase(),c=a(d);if(!c)return null;let g=rj(c.part,c.nodeId);return g===null?null:Object.freeze({paragraphId:d,nodeId:c.nodeId,text:g})},applyParagraphText(l,d,c){return s([{paragraphId:l,text:d}],c)},applyParagraphTexts:s,applyRemotePackage(l,d){let c=o.publishRemotePackage(l,d);return c.ok?{ok:true,changed:c.change!==null}:{ok:false,reason:c.detail??c.reason}},revision:()=>o.packageRevision,subscribe:l=>o.subscribe(l),observePrimitiveJournal:l=>H(o,l),hasPendingJournals:()=>za(o),flushPendingJournals:()=>{Aa(o);},save:()=>Jd(o.currentPackage()),binaryPart(l){let d=o.currentPackage();return d.partBytes.get(l)??d.partBytes.get(l.startsWith("/")?l.slice(1):`/${l}`)??null}})}export{rr as a,er as b};