@docx-editor.dev/core 2.17.0 → 2.19.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 (107) hide show
  1. package/README.md +1 -1
  2. package/THIRD_PARTY_NOTICES.md +2 -2
  3. package/dist/automation.cjs +1 -1
  4. package/dist/automation.d.ts +35 -8
  5. package/dist/automation.js +1 -1
  6. package/dist/binding.cjs +1 -1
  7. package/dist/binding.d.ts +9 -11
  8. package/dist/binding.js +1 -1
  9. package/dist/chunk-2ZEU42EA.js +2 -0
  10. package/dist/chunk-4DB7ZFQN.js +1 -0
  11. package/dist/chunk-4KMSEFIG.js +3 -0
  12. package/dist/chunk-72BDQFHY.js +18 -0
  13. package/dist/chunk-77DD4EBC.cjs +11 -0
  14. package/dist/chunk-BEOPUDAB.js +5 -0
  15. package/dist/chunk-CG7CP632.cjs +1 -0
  16. package/dist/chunk-CJCFEXTA.js +11 -0
  17. package/dist/chunk-DQS4KZUX.js +4 -0
  18. package/dist/chunk-FZ2BIMCY.cjs +2 -0
  19. package/dist/chunk-GUPITGJQ.cjs +2 -0
  20. package/dist/chunk-KDYD5TAW.cjs +1 -0
  21. package/dist/chunk-LQ6XWTKQ.cjs +18 -0
  22. package/dist/chunk-MDP5SNK4.cjs +3 -0
  23. package/dist/chunk-MRPPCGCX.cjs +20 -0
  24. package/dist/chunk-MSIFK7TJ.js +1 -0
  25. package/dist/chunk-NJONXJJY.cjs +4 -0
  26. package/dist/chunk-OODFC5R2.js +1 -0
  27. package/dist/chunk-P6VGDI57.js +2 -0
  28. package/dist/{chunk-UIB2MDE3.cjs → chunk-PBM6WERF.cjs} +1 -1
  29. package/dist/chunk-QBMAXYN7.js +20 -0
  30. package/dist/chunk-SUEX3CL7.cjs +5 -0
  31. package/dist/{chunk-UXAWPVH6.js → chunk-THCGTV53.js} +1 -1
  32. package/dist/{chunk-NO7U62I2.cjs → chunk-YVYEJBLL.cjs} +1 -1
  33. package/dist/chunk-ZKQX2PNF.cjs +1 -0
  34. package/dist/{chunk-XXLS6O6B.js → chunk-ZMM5RNM6.js} +1 -1
  35. package/dist/collaboration/replication.cjs +1 -1
  36. package/dist/collaboration/replication.d.ts +2 -4
  37. package/dist/collaboration/replication.js +1 -1
  38. package/dist/collaboration.cjs +1 -1
  39. package/dist/collaboration.d.ts +4 -6
  40. package/dist/collaboration.js +1 -1
  41. package/dist/contracts/editor.d.ts +9 -8
  42. package/dist/contracts/modules.d.ts +7 -9
  43. package/dist/{custom-node-writes-ClTkWM7s.d.ts → custom-node-writes-BqIv94ei.d.ts} +14 -2
  44. package/dist/document-protection-BL5zp8cU.d.ts +19 -0
  45. package/dist/{editor-BlerWPyk.d.ts → editor-WXbTSXx1.d.ts} +14 -7
  46. package/dist/editor.cjs +1 -1
  47. package/dist/editor.css +1 -1
  48. package/dist/editor.d.ts +271 -30
  49. package/dist/editor.js +1 -1
  50. package/dist/export.cjs +2 -2
  51. package/dist/export.d.ts +15 -12
  52. package/dist/export.js +2 -2
  53. package/dist/{failure-BnGjoXf0.d.ts → failure-DNNmwsgD.d.ts} +1 -1
  54. package/dist/{font-resolver-DtADJcLL.d.ts → font-resolver-BSrKnTeR.d.ts} +5 -3
  55. package/dist/harfbuzz.wasm +0 -0
  56. package/dist/{headless-document-view-BDSeMGoK.d.ts → headless-document-view-C4ttQJ5H.d.ts} +11 -3
  57. package/dist/{index-D51bUVBE.d.ts → index-C3As-Xxp.d.ts} +133 -19
  58. package/dist/index.cjs +1 -1
  59. package/dist/index.d.ts +18 -19
  60. package/dist/index.js +1 -1
  61. package/dist/{layout-shaping-rTElghj2.d.ts → layout-shaping-Dqu3JW3p.d.ts} +1 -1
  62. package/dist/layout.cjs +1 -1
  63. package/dist/layout.d.ts +23 -20
  64. package/dist/layout.js +1 -1
  65. package/dist/{note-properties-D5_fXW9K.d.ts → note-properties-RjYgbmXe.d.ts} +2 -2
  66. package/dist/{omml-equation-C9AJfWy5.d.ts → omml-equation-hcP9AUFX.d.ts} +1 -1
  67. package/dist/output.cjs +1 -1
  68. package/dist/output.d.ts +16 -6
  69. package/dist/output.js +1 -1
  70. package/dist/{protocol-K-Djpjjw.d.ts → protocol-OdRd17KZ.d.ts} +172 -7
  71. package/dist/{review-items-CiliAz8H.d.ts → review-items-CJz-kAW8.d.ts} +2 -2
  72. package/dist/{review-paragraph-order-BlSnyg9a.d.ts → review-paragraph-order--jLHXIcd.d.ts} +3 -3
  73. package/dist/{revision-projection-JiDclAFU.d.ts → revision-projection-BIHO_qvw.d.ts} +1 -1
  74. package/dist/{semantic-cell-selection-C-VsxNee.d.ts → semantic-cell-selection-lCYAVCCF.d.ts} +6 -24
  75. package/dist/{semantic-interaction-2vPh96Ey.d.ts → semantic-interaction-0vQXcMZk.d.ts} +2 -19
  76. package/dist/{semantic-paint-BEjYcsPK.d.ts → semantic-paint-BSan4pBk.d.ts} +10 -2
  77. package/dist/{semantic-records-Bc-MGXbM.d.ts → semantic-records-ZcYuB4-H.d.ts} +59 -13
  78. package/dist/store.cjs +1 -1
  79. package/dist/store.d.ts +49 -42
  80. package/dist/store.js +1 -1
  81. package/dist/{tree-op-types-C71G7rIv.d.ts → tree-op-types-DbdM7fJV.d.ts} +84 -4
  82. package/dist/{tree-package-fragment-DRJkmfTW.d.ts → tree-package-fragment-1pdDnhZ_.d.ts} +491 -23
  83. package/dist/{tree-session-contract-Cp5W25RC.d.ts → tree-session-contract-Cgn6fQ-M.d.ts} +34 -9
  84. package/package.json +4 -4
  85. package/dist/chunk-27YEILW4.cjs +0 -20
  86. package/dist/chunk-4RDCLCLB.js +0 -2
  87. package/dist/chunk-7QG5FJ4X.js +0 -1
  88. package/dist/chunk-BML3CNUT.js +0 -2
  89. package/dist/chunk-CHRMIA3I.js +0 -20
  90. package/dist/chunk-FRRMJK2G.js +0 -5
  91. package/dist/chunk-G5GLQ4SX.cjs +0 -1
  92. package/dist/chunk-JP253KIZ.cjs +0 -2
  93. package/dist/chunk-JROG4U3Z.cjs +0 -21
  94. package/dist/chunk-MBXGQN6J.js +0 -1
  95. package/dist/chunk-MDMM3XVQ.js +0 -11
  96. package/dist/chunk-NPZX5O23.cjs +0 -2
  97. package/dist/chunk-OISZDVXT.cjs +0 -5
  98. package/dist/chunk-PRNYSOQL.cjs +0 -1
  99. package/dist/chunk-RXPOTTQQ.js +0 -21
  100. package/dist/chunk-T7JERNXT.cjs +0 -2
  101. package/dist/chunk-TDMGSCCL.cjs +0 -1
  102. package/dist/chunk-VYQTZIYH.js +0 -1
  103. package/dist/chunk-W7GY2IJC.js +0 -2
  104. package/dist/chunk-ZFBNCHRP.cjs +0 -11
  105. package/dist/hf-references-kSSFMq9X.d.ts +0 -70
  106. package/dist/tree-store-BRfhZceK.d.ts +0 -416
  107. /package/dist/{dist-OSUJGKTK.js → dist-PKZR6RSH.js} +0 -0
@@ -1 +0,0 @@
1
- import {g,a,b,e,c,f,_d,Fe as Fe$1,bd,Va,Ya,_a,$a,Za,Wa,Xa,id,Bc,Lc,Xd,Wd}from'./chunk-RXPOTTQQ.js';import {a as a$2}from'./chunk-VYQTZIYH.js';import {da,la,ma,Gd,a as a$1}from'./chunk-MDMM3XVQ.js';function je(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 Be=64,Fe=Object.freeze({family:"Calibri",sizeHalfPoints:22});function he(e,...n){let o=[e,...n],i=[],t=new Set;for(let u of o)for(let d of u.sources??[]){let c=g(d.request);t.has(c)||(t.add(c),i.push(d));}let r=[],a$1=new Set;for(let u of o)for(let d of u.substitutions??[]){let c=g(d.from);t.has(c)||a$1.has(c)||(a$1.add(c),r.push(d));}return Object.freeze({epoch:e.epoch??0,maxFontBytes:e.maxFontBytes??a,sources:Object.freeze(i),...r.length>0?{substitutions:Object.freeze(r)}:{},defaultFont:e.defaultFont??Fe,...e.language!==void 0?{language:e.language}:{}})}var Re=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function be(e){let n=e?.defaultFont?.family;return n!==void 0&&Re.test(n)?n:Fe.family}var ke="docx-editor.dev/font-resolver",Oe=Symbol.for("docx-editor.dev/font-resolver");function Ve(e){let n={value:true,enumerable:false,configurable:true};try{Object.defineProperty(e,Oe,n),Object.defineProperty(e,ke,n);}catch(o){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:o})}return e}function Ye(e){return typeof e=="function"&&e[Oe]===true}var U=e=>`${e.family.trim().toLowerCase()} ${e.weight} ${e.style}`;function ve(e,n,o){let i=new Map(e.map(t=>[U(t),t]));for(let[t,r]of n)i.set(t,r);for(let t of o)i.has(U(t.to))&&i.set(U(t.from),t.from);return [...i.values()]}async function He(e,n,o={}){return xe(e,n,o)}async function $e(e,n,o={}){return xe(e,n,o)}async function xe(e,n,o){let i=e.map(Ce),t,r=[],a$1=new Map,u=new Set,d=0,c=[],w=new Set,y=[],h=n.resolvedFaces??[],O=n.defaultFamily;for(let k=0;k<e.length;k+=1){Se(n.signal);let F=e[k],B=ve(h,a$1,c),v;try{let b$1=i[k],p;if(b$1){let s=await we(b$1,n.signal);if(!s.ok)throw s.cause;p=s.value;}else if(typeof F=="function"){let s=await we(Promise.resolve(F(Pe(n,O,B,d))).then(f=>({ok:!0,value:f}),f=>({ok:!1,cause:f})),n.signal);if(!s.ok)throw s.cause;p=s.value;}else p=F;if(p==null)continue;if(typeof p=="function"){X(o,F,k,new TypeError("A font origin answered with a function; pass the resolver itself rather than a function returning one"));continue}let S="failures"in p?p.failures:void 0,C=[];if(Array.isArray(S)){let s=Math.min(S.length,b);for(let f=0;f<s;f++)C.push(S[f]);S.length>s&&C.push(new Error("Additional font-origin failures were omitted"));}else S!==void 0&&C.push(S);let T=Te(p,u,d,w,t?"maxFontBytes"in t&&t.maxFontBytes!==void 0?t.maxFontBytes:a:void 0,o.reserveOwnedBytes,o.instrumentation);v=T;for(let s of new Set([...T.dropped,...C]))X(o,F,k,s);let E=T.fragment;y.push(...C);let j=(E.sources??[]).map(s=>(g(s.request),[U(s.request),s.request])),q=[...E.substitutions??[]];!t&&"defaultFont"in E&&(O=be(E)),t||(t=E);let l=new Set(T.sourceKeys);if(l.size>0){c=c.filter(s=>!l.has(g(s.from)));for(let s of l)w.delete(s);}r.push(...E.sources??[]);for(let s of T.sourceKeys)u.add(s);d+=T.ownedBytes;for(let[s,f]of j)a$1.set(s,f);for(let s of q)c.push(s),w.add(g(s.from));}catch(b){if(v?.releaseOwnedBytes?.(),n.signal?.aborted)throw n.signal.reason??b;if(b instanceof V)throw b.cause;X(o,F,k,b);continue}}if(!t)return;let{epoch:N,...x}=he({...t,sources:r,substitutions:c});return y.length===0?x:{...x,failures:Object.freeze(y)}}var V=class extends Error{constructor(o){super("Unable to reserve owned font bytes");this.cause=o;this.name="FontOwnershipReservationError";}cause},Y=class extends RangeError{};async function we(e,n){if(!n)return e;Se(n);let o,i=new Promise((r,a)=>{o=a;}),t=()=>o?.(n.reason);n.addEventListener("abort",t,{once:true});try{return await Promise.race([e,i])}finally{n.removeEventListener("abort",t);}}function Ce(e){if(e===null||typeof e!="object")return;let n;try{n=e.then;}catch(o){return Promise.resolve({ok:false,cause:o})}if(typeof n=="function")return Promise.resolve(e).then(o=>({ok:true,value:o}),o=>({ok:false,cause:o}))}function Te(e$1,n,o,i,t,r,a$1){let u=e$1.sources??[],d=e$1.substitutions??[],c$1="maxFontBytes"in e$1?e$1.maxFontBytes:void 0,w="defaultFont"in e$1?e$1.defaultFont:void 0,y="epoch"in e$1?e$1.epoch:void 0,h="language"in e$1?e$1.language:void 0;if(!Array.isArray(u)||!Array.isArray(d))throw new TypeError("Font origin sources and substitutions must be arrays");let O=u.length,N=d.length;if(O>b)throw new RangeError(`Font source count must not exceed ${b}`);if(N>b)throw new RangeError(`Font substitution count must not exceed ${b}`);let x=c$1??a;if(!Number.isSafeInteger(x)||x<=0||x>a)throw new RangeError(`Font byte ceiling must be a positive safe integer no greater than ${a}`);let k=t??x,F=0,B=[],v=new Set,b$1=[],p=[];for(let l=0;l<O;l+=1){let s=u[l];try{let f=W(s.request),L=s.availability,_=s.faceIndex,g$1=s.hash,P=s.id,M=g(f);if(L!==void 0&&L!=="available"&&L!=="forbidden")throw new TypeError("Font source availability must be available or forbidden");if(!Number.isSafeInteger(_)||_<0)throw new RangeError("Font face index must be a non-negative safe integer");if(typeof g$1!="string"||g$1.length===0)throw new TypeError("Font source hash must be a non-empty string");let z;if(L!=="forbidden"){if(typeof P!="string"||P.length===0)throw new TypeError("Font source id must be a non-empty string");z=s.bytes;let H=e(z);if(H>k)throw new RangeError("Font source exceeds the effective base byte ceiling");if(n.has(M)||v.has(M))continue;if(o+F+H>c)throw new RangeError(`Font sources exceed the aggregate byte ceiling of ${c}`);F+=H;}else z=new Uint8Array(0);if(n.has(M)||v.has(M))continue;if(n.size+v.size>=b)throw new Y(`Font source count must not exceed ${b}`);v.add(M),B.push(M),b$1.push(Object.freeze({request:f,id:P,bytes:z,hash:g$1,faceIndex:_,...L?{availability:L}:{}}));}catch(f){if(f instanceof Y)throw f;p.push(f);}}let S=new Set,C=[];for(let l=0;l<N;l+=1){let s=d[l];try{let f=W(s.from),L=W(s.to);g(f),g(L);let _=s.lineMetrics,g$1=_?Object.freeze({heightEm:_.heightEm,baselineEm:_.baselineEm}):void 0;if(g$1&&(!Number.isFinite(g$1.heightEm)||!Number.isFinite(g$1.baselineEm)||g$1.heightEm<=0||g$1.heightEm>4||g$1.baselineEm<0||g$1.baselineEm>g$1.heightEm))throw new RangeError("Font substitution line metrics must fit within a bounded em box");let P=g(f);if(n.has(P)||v.has(P)||i.has(P)||S.has(P))continue;S.add(P),C.push(Object.freeze({from:f,to:L,...g$1?{lineMetrics:g$1}:{}}));}catch(f){p.push(f);}}if((O>0||N>0)&&b$1.length===0&&C.length===0&&p.length>0)throw p[0];let T=i.size;for(let l of v)i.has(l)&&(T-=1);if(T+S.size>b)throw new RangeError(`Font substitution count must not exceed ${b}`);let E;if(w!==void 0){let l=w.family,s=w.sizeHalfPoints;if(g({family:l,weight:400,style:"normal"}),!Number.isSafeInteger(s)||s<=0)throw new RangeError("Default font size must be a positive safe integer in half-points");E=Object.freeze({family:l,sizeHalfPoints:s});}if(y!==void 0&&(!Number.isSafeInteger(y)||y<0))throw new RangeError("Font configuration epoch must be a non-negative safe integer");if(h!==void 0&&typeof h!="string")throw new TypeError("Font shaping language must be a string");let j;if(F>0&&r)try{j=r(F);}catch(l){throw new V(l)}let q;try{q=b$1.map(l=>f(l,a$1));}catch(l){throw j?.(),l}return {fragment:Object.freeze({sources:Object.freeze(q),substitutions:Object.freeze(C),...y!==void 0?{epoch:y}:{},...c$1!==void 0?{maxFontBytes:c$1}:{},...E?{defaultFont:E}:{},...h!==void 0?{language:h}:{}}),sourceKeys:Object.freeze(B),ownedBytes:F,dropped:Object.freeze(p),releaseOwnedBytes:j}}function Le(e){return !Number.isSafeInteger(e)||e<=0?0:e>c?c:e}function Pe(e,n,o,i){let{committedSourceBytes:t,...r}=e,a=Le(i);return {...r,defaultFamily:n,...o.length>0?{resolvedFaces:o}:{},...a>0?{committedSourceBytes:a}:{}}}function W(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}function Se(e){if(e?.aborted)throw e.reason??new DOMException("Font resolution was aborted","AbortError")}function X(e,n,o,i){let t;try{typeof n=="function"&&n.name.length>0&&(t=n.name);}catch{}let r=Object.freeze({originIndex:o,...t!==void 0?{originName:t}:{},cause:i});if(e.onOriginFailure)try{let u=e.onOriginFailure(r);Promise.resolve(u).catch(d=>{console.warn("[fonts] font-origin diagnostic callback failed",d);});return}catch(u){console.warn("[fonts] font-origin diagnostic callback failed",u);}let a="";try{i instanceof Error&&i.message.length>0&&(a=`: ${i.message}`);}catch{}console.warn(`[fonts] a font origin failed and was skipped${a}`,i);}function Ze(e){let n=e.defaultTabStopPt?.(),o=e.view.part().name,i={view:e.view,measurer:e.measurer,producer:e.producer,cache:e.cache,styleCascade:e.styleCascade,numberingIndex:e.numberingIndex,defaultTabStopPt:n,compatibilityMode:e.compatibilityMode?.(),inlineDrawingLayoutForPart:e.inlineDrawingLayoutForPart,drawingTokenForParagraphForPart:e.drawingTokenForParagraphForPart,drawingLayoutEpochForPart:e.drawingLayoutEpochForPart,linkProjectors:e.linkProjectors,projectFieldLink:e.projectFieldLink,displayMode:e.displayMode,revisionAuthorFilter:e.revisionAuthorFilter},t=_d(i),r={view:e.view,revision:e.revision,measurer:e.measurer,cache:e.cache,session:e.session,producer:e.producer,styleCascade:e.styleCascade,numberingIndex:e.numberingIndex,defaultTabStopPt:n,furniture:e.furniture,compatibilityMode:e.compatibilityMode,linkProjectors:e.linkProjectors,projectFieldLink:e.projectFieldLink,inlineDrawingLayout:e.inlineDrawingLayout,drawingTokenForParagraph:e.drawingTokenForParagraph,drawingLayoutEpoch:e.drawingLayoutEpoch,displayMode:e.displayMode,revisionAuthorFilter:e.revisionAuthorFilter},a={measurer:r.measurer,cache:r.cache,session:r.session,producer:r.producer,styleCascade:r.styleCascade?.(),defaultTabStopPt:r.defaultTabStopPt,compatibilityMode:r.compatibilityMode?.(),numberingIndex:r.numberingIndex?.(),sectionFurniture:r.furniture.sectionFurniture(),furniture:r.furniture.furniture(),projectLink:r.linkProjectors.projectLink,projectFieldLink:r.projectFieldLink,documentProperties:r.view.documentProperties(),inlineDrawingLayout:r.inlineDrawingLayout,drawingTokenForParagraph:r.drawingTokenForParagraph,drawingLayoutEpoch:r.drawingLayoutEpoch,projectionTokenForParagraph:u=>r.linkProjectors.tokenForParagraphForPart(o,u),projectionTokenForTable:u=>r.linkProjectors.tokenForTableForPart(o,u),projectionEpoch:r.linkProjectors.epochForPart(o),notes:t,displayMode:r.displayMode,revisionAuthorFilter:r.revisionAuthorFilter};return Fe$1(r.view.part(),r.revision,a)}function G(e,n){return e.attributes.find(o=>o.localName===n)?.value}function cn(e){let n=new Map,o=i=>{let t=a$2(i??void 0);t!==null&&!n.has(t.toLowerCase())&&n.set(t.toLowerCase(),t);};for(let i of e){let t=[i];for(;t.length;){let r=t.pop();if(r.namespaceUri===da&&(r.localName==="fldSimple"&&o(bd(G(r,"instr")??"")?.font),r.localName==="p"))for(let a of Ie(r))o(a);for(let a=r.children.length-1;a>=0;a--){let u=r.children[a];u.kind!=="textValue"&&t.push(u);}}}return [...n.values()]}function Ie(e){let n=[],o=Va(),i=[];for(let t=e.children.length-1;t>=0;t-=1){let r=e.children[t];r.kind!=="textValue"&&i.push({node:r,containerDepth:0});}for(;i.length>0;){let{node:t,containerDepth:r}=i.pop();if(r>=la||t.namespaceUri===da&&t.localName==="p")continue;if(t.namespaceUri===da&&t.localName==="fldChar"){let u=G(t,"fldCharType");u==="begin"?Ya(o):u==="separate"?(o.nesting===1&&Ee(o,n),_a(o)):u==="end"&&(o.nesting===1&&Ee(o,n),$a(o));continue}if(t.namespaceUri===da&&(t.localName==="instrText"||t.localName==="delInstrText")){Za(o,Ne(t),t.localName==="delInstrText");continue}if(t.namespaceUri===da&&t.localName==="fldSimple"){let u=bd(G(t,"instr")??"");u?.font&&n.push(u.font);}let a=ma(t,r);for(let u=t.children.length-1;u>=0;u-=1){let d=t.children[u];d.kind!=="textValue"&&i.push({node:d,containerDepth:a});}}return Wa(o),n}function Ee(e,n){let o=Xa(e);if(o.overflow)return;let i=bd(o.instruction);i?.font&&n.push(i.font);}function Ne(e){let n="",o=[...e.children].reverse();for(;o.length>0&&n.length<=256;){let i=o.pop();if(i.kind==="textValue")n+=i.value;else for(let t=i.children.length-1;t>=0;t-=1)o.push(i.children[t]);}return n}function ln(e,n,o,i){if(!n)return [];let t=id(n),r=Bc(o,i),a=new Map;for(let u of e)for(let d of Ae(u)){let c=Gd(d.children),w=y=>{if(y)for(let h of y.values())for(let O of [h.markerStyle.fontFamily,h.markerStyle.fontFamilyEastAsia]){let N=a$2(O??void 0);if(N===null)continue;let x=N.toLowerCase();a.has(x)||a.set(x,N);}};w(Lc(c,t,r));for(let y of c){let h=Xd(y);for(let O of h.contents)w(Wd(O,t,r));}}return [...a.values()].sort((u,d)=>u.localeCompare(d))}function Ae(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 o of e.children)o.kind!=="textValue"&&(o.localName==="footnote"||o.localName==="endnote")&&n.push(o);return n}return [e]}var _e={regular:{weight:400,style:"normal"},bold:{weight:700,style:"normal"},italic:{weight:400,style:"italic"},boldItalic:{weight:700,style:"italic"}};function yn(e,n){let o=[],i=[],t=0;for(let r of e){let a$1=r.bytes.byteLength;if(!Number.isSafeInteger(a$1)||a$1>n||a$1>a||a$1>c-t){i.push(r);continue}t+=a$1,o.push(r);}return {sources:o,dropped:i}}function pn(e,n,o){let i=n.reduce((r,a)=>r+a.bytes.byteLength,0),t=new Set(n.filter(r=>r.request.family.trim().length>0).map(r=>g(r.request)));return Me(e,{maxFontBytes:o,aggregateBudget:Math.max(0,c-i),shadowedRequests:t})}function Me(e,n){let o=[],i=[],t=n.aggregateBudget,r=new Set;for(let a of e){let u=_e[a.style],d=Object.freeze({family:a.family,weight:u.weight,style:u.style});if(a.family.trim().length===0){i.push({request:d,partName:a.partName,reason:"malformed"});continue}let c=g(d);if(!(n.shadowedRequests?.has(c)||r.has(c))){if(r.add(c),a.bytes.byteLength>n.maxFontBytes||a.bytes.byteLength>t){i.push({request:d,partName:a.partName,reason:"overLimit"});continue}t-=a.bytes.byteLength,o.push({request:d,id:`embedded:${a.partName}#${a.style}`,bytes:a.bytes,hash:a$1(a.bytes),faceIndex:0});}}return {sources:o,dropped:i}}export{je as a,Be as b,Fe as c,he as d,be as e,ke as f,Oe as g,Ve as h,Ye as i,He as j,$e as k,Ze as l,yn as m,pn as n,Me as o,cn as p,Ie as q,ln as r};