@docx-editor.dev/core 2.28.0 → 2.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/automation.cjs +1 -1
  2. package/dist/automation.d.ts +60 -13
  3. package/dist/automation.js +1 -1
  4. package/dist/binding.cjs +1 -1
  5. package/dist/binding.d.ts +21 -13
  6. package/dist/binding.js +1 -1
  7. package/dist/{index-Bsg7oIKP.d.ts → chrome-print-CAs51cpq.d.ts} +31 -21
  8. package/dist/{chunk-VDNNLG6X.js → chunk-236O4YQW.js} +1 -1
  9. package/dist/chunk-4HENIAFG.js +1 -0
  10. package/dist/{chunk-SRPILEWV.cjs → chunk-6JPL6ZAS.cjs} +5 -5
  11. package/dist/{chunk-2RC2EPND.js → chunk-6ZQP4HQ7.js} +1 -1
  12. package/dist/{chunk-ZUHOMK52.cjs → chunk-7WQ7AAHW.cjs} +1 -1
  13. package/dist/{chunk-Z6WBFXJU.js → chunk-BCXH4BXB.js} +3 -3
  14. package/dist/{chunk-QMLCVPCD.cjs → chunk-BY2ACZZ6.cjs} +1 -1
  15. package/dist/chunk-CAJEXXVG.cjs +4 -0
  16. package/dist/chunk-CPWLFPWC.js +30 -0
  17. package/dist/{chunk-6APGXLBB.cjs → chunk-D7ZMDMPX.cjs} +2 -2
  18. package/dist/chunk-DOHF6FA7.cjs +30 -0
  19. package/dist/chunk-DVX32P2P.js +27 -0
  20. package/dist/{chunk-6EYYL7FL.js → chunk-E4LOMDNL.js} +1 -1
  21. package/dist/chunk-EKLM7NWB.cjs +7 -0
  22. package/dist/chunk-G3K63G7P.cjs +27 -0
  23. package/dist/{chunk-5CSUYANV.js → chunk-G4HOFIKJ.js} +1 -1
  24. package/dist/{chunk-K5U2PLDP.cjs → chunk-JLVBDYVQ.cjs} +1 -1
  25. package/dist/chunk-LQX36Z5P.js +7 -0
  26. package/dist/{chunk-TSLBZ26X.js → chunk-LSZ6KPKK.js} +1 -1
  27. package/dist/{chunk-O2AL2HSJ.cjs → chunk-MM5QBMTE.cjs} +1 -1
  28. package/dist/{chunk-ETTO6GK3.js → chunk-OMCG63ZF.js} +1 -1
  29. package/dist/chunk-OSFOJTHU.cjs +18 -0
  30. package/dist/{chunk-E7BQA6UP.js → chunk-RCLZXP3B.js} +1 -1
  31. package/dist/chunk-T6K2QYNZ.cjs +2 -0
  32. package/dist/chunk-TRGAVV2Y.js +4 -0
  33. package/dist/chunk-U4JZVSOE.js +2 -0
  34. package/dist/{chunk-2GO5T2JU.cjs → chunk-UHHYFIDT.cjs} +1 -1
  35. package/dist/chunk-V3N4SOAK.cjs +1 -0
  36. package/dist/{chunk-6AWEKBLB.cjs → chunk-W35WTWAO.cjs} +1 -1
  37. package/dist/chunk-YQ5G6LC7.js +18 -0
  38. package/dist/collaboration/replication.cjs +1 -1
  39. package/dist/collaboration/replication.d.ts +5 -5
  40. package/dist/collaboration/replication.js +1 -1
  41. package/dist/collaboration.d.ts +4 -4
  42. package/dist/contracts/document.d.ts +3 -3
  43. package/dist/contracts/editor.d.ts +9 -10
  44. package/dist/contracts/interaction.d.ts +2 -2
  45. package/dist/contracts/modules.cjs +1 -1
  46. package/dist/contracts/modules.d.ts +33 -9
  47. package/dist/contracts/modules.js +1 -1
  48. package/dist/contracts/types.d.ts +2 -2
  49. package/dist/{custom-node-writes-cvL5rhcD.d.ts → custom-node-writes-Bn6uciLb.d.ts} +2 -2
  50. package/dist/diagnostic-context-B8M79cfK.d.ts +30 -0
  51. package/dist/diagnostic-hints-BeVjfNOv.d.ts +113 -0
  52. package/dist/{document-protection-BAGVGqaP.d.ts → document-protection-CUb55pl_.d.ts} +2 -2
  53. package/dist/{editor-Ci7IZGmG.d.ts → editor-CZQZmTIU.d.ts} +386 -9
  54. package/dist/{editor-scope-OHPwVQ5l.d.ts → editor-scope-7o9xweiJ.d.ts} +1 -1
  55. package/dist/editor.cjs +1 -1
  56. package/dist/editor.d.ts +54 -33
  57. package/dist/editor.js +1 -1
  58. package/dist/export.cjs +2 -2
  59. package/dist/export.d.ts +13 -14
  60. package/dist/export.js +1 -1
  61. package/dist/{font-resolver-BVQB14qT.d.ts → font-resolver-lSBLirLR.d.ts} +3 -3
  62. package/dist/{headless-document-view-qH331moE.d.ts → headless-document-view-pp3q7wIh.d.ts} +2 -2
  63. package/dist/{image-resources-BN-hUgCn.d.ts → image-resources-tXLQShoC.d.ts} +2 -2
  64. package/dist/index.cjs +1 -1
  65. package/dist/index.d.ts +65 -20
  66. package/dist/index.js +1 -1
  67. package/dist/{layout-shaping-BEyuiQOk.d.ts → layout-shaping-BD-dF_rn.d.ts} +1 -1
  68. package/dist/layout.cjs +1 -1
  69. package/dist/layout.d.ts +17 -20
  70. package/dist/layout.js +1 -1
  71. package/dist/{note-properties-4Y9o6Gyk.d.ts → note-properties-qQUjO1GQ.d.ts} +3 -3
  72. package/dist/{omml-equation-CuzBL5DD.d.ts → omml-equation-BUbU0utM.d.ts} +1 -1
  73. package/dist/output.cjs +1 -1
  74. package/dist/output.d.ts +8 -9
  75. package/dist/output.js +1 -1
  76. package/dist/{protocol-Bqk4Izjc.d.ts → protocol-DYzzz2ej.d.ts} +2 -2
  77. package/dist/{review-paragraph-order-DT-n6ouC.d.ts → review-paragraph-order-CN_0l2Cb.d.ts} +1 -1
  78. package/dist/{semantic-cell-selection-D9D1KSXq.d.ts → semantic-cell-selection-eYag3P47.d.ts} +4 -211
  79. package/dist/{semantic-interaction-CIC-PooQ.d.ts → semantic-interaction-kR_QB845.d.ts} +1 -1
  80. package/dist/{semantic-paint-BME37OMv.d.ts → semantic-paint-ZayFF3tD.d.ts} +17 -5
  81. package/dist/{semantic-record-queries-CBlZqZNa.d.ts → semantic-record-queries-Bsgth6lv.d.ts} +1 -1
  82. package/dist/{semantic-records-4B3WwFAi.d.ts → semantic-records-DQmumPgL.d.ts} +1279 -828
  83. package/dist/store.cjs +1 -1
  84. package/dist/store.d.ts +1466 -1464
  85. package/dist/store.js +1 -1
  86. package/dist/{tree-package-fragment-BeeKxDw8.d.ts → tree-package-store-CovjNARF.d.ts} +83 -83
  87. package/dist/{tree-session-contract-CVbmlMlq.d.ts → tree-session-contract-CZVAGl51.d.ts} +6 -6
  88. package/dist/{types-barrel-D3xCgQX6.d.ts → types-barrel-DuC5QBNC.d.ts} +548 -527
  89. package/package.json +3 -3
  90. package/dist/chunk-4GBTELJV.cjs +0 -28
  91. package/dist/chunk-4R3TEXMN.js +0 -18
  92. package/dist/chunk-EO4C5QJW.cjs +0 -2
  93. package/dist/chunk-FIJZIQXA.cjs +0 -18
  94. package/dist/chunk-FRXAOVTB.js +0 -28
  95. package/dist/chunk-J6BVWIDB.js +0 -2
  96. package/dist/chunk-JGNVNT2A.cjs +0 -2
  97. package/dist/chunk-KKIJG3C6.js +0 -2
  98. package/dist/chunk-LWDSDCMO.js +0 -27
  99. package/dist/chunk-NBCVVZOM.cjs +0 -1
  100. package/dist/chunk-O5INAWZQ.js +0 -1
  101. package/dist/chunk-RCHS4ZEH.cjs +0 -27
  102. package/dist/chunk-VHAVHCQY.js +0 -7
  103. package/dist/chunk-VX43VBAX.cjs +0 -7
  104. package/dist/review-pane-D9jm8DcY.d.ts +0 -128
  105. package/dist/revision-projection-DZ4kKVev.d.ts +0 -242
@@ -1 +1 @@
1
- 'use strict';var chunkVX43VBAX_cjs=require('./chunk-VX43VBAX.cjs');require('./chunk-6AWEKBLB.cjs'),require('./chunk-4GBTELJV.cjs'),require('./chunk-ZUHOMK52.cjs'),require('./chunk-O2AL2HSJ.cjs');var chunkJGNVNT2A_cjs=require('./chunk-JGNVNT2A.cjs'),chunk2GO5T2JU_cjs=require('./chunk-2GO5T2JU.cjs'),chunkFIJZIQXA_cjs=require('./chunk-FIJZIQXA.cjs');var j=Object.freeze({document:true,save:true,events:true,selection:false,scrolling:false,layout:false}),D=Object.freeze({kind:"body"});function Y(o,t={}){let m=chunkFIJZIQXA_cjs.Ce(o,t.limits??{});if(!m.ok)return {ok:false,reason:m.reason,...m.limit===void 0?{}:{limit:m.limit},...m.detail?{detail:m.detail}:{}};let p=m.package.parts.get(m.package.mainDocumentPart);if(!p)return {ok:false,reason:"no-main-document-part",detail:m.package.mainDocumentPart};let u=new chunkJGNVNT2A_cjs.T(m.package,chunkJGNVNT2A_cjs.ua(m.package,chunkFIJZIQXA_cjs.Eb(p))),y=t.collaborationModel?.session,c=()=>{},n=K(u,y,()=>c());if(t.pagination){let i,l=-1,e=t.pagination;n.prepare=async f=>{if(!f.operations.some(s=>s.op==="updateFieldResult"))return;i=void 0;let a=u.packageRevision,d=await e(chunkJGNVNT2A_cjs.Ca(u));u.packageRevision===a&&(i=d,l=a);},n.fieldPageContext=(f,a,d)=>{if(u.packageRevision!==l)return null;let s=chunkVX43VBAX_cjs.g(u.currentPackage()).story(f);return s?chunkVX43VBAX_cjs.d(i,s.part,a,d):null};}let r=chunkVX43VBAX_cjs.m({port:n,capabilities:j});return y&&(c=y.attach(chunk2GO5T2JU_cjs.b(u,{documentId:y.documentId}))),{ok:true,host:r}}function G(o,t,m){let p=o.partFor(m);return p?chunkFIJZIQXA_cjs.Na(o,()=>{let u=chunkFIJZIQXA_cjs.Hg(o.currentPackage(),t,p.name);return u?(o.replacePackageShell(u.pkg),u.relationshipId):null},u=>u!==null):null}function K(o,t,m=()=>{}){let p=true,u=0,y=()=>t?(u+=1,{origin:t.identity.role==="agent"?chunkFIJZIQXA_cjs.g.mutationAgent:chunkFIJZIQXA_cjs.g.mutationHuman,actorId:t.identity.actorId,operationId:`${t.identity.actorId}:${t.sessionId}:automation:${u}`,recordsHistory:false}):{},c=n=>(t?.flushPendingJournals(),n);return {localChangeTracking:true,collaborative:()=>!!t,revision:()=>o.packageRevision,currentPackage:()=>p?o.currentPackage():null,apply(n,r=D,i=[]){if(!p)return {ok:false,reason:"disposed"};let l=n(d=>chunkFIJZIQXA_cjs.Hb(t?.identity.actorId,()=>G(o,d,r)));if(l===null)return {ok:false,reason:"unsupported-target"};let e=t?.gateOperations(l,r);if(e)return {ok:false,reason:e};let f=t?o.partFor(r)?.name:void 0,a=o.transact(r,d=>{for(let s of i)d.applyPackage(s);for(let s of l)d.apply(s);f&&d.applyPackage(s=>chunk2GO5T2JU_cjs.a(s,f,l));},y());return a.ok?c({ok:true,changed:a.change!==null}):{ok:false,reason:a.detail?`${a.reason}: ${a.detail}`:a.reason}},applyLifecycle(n){if(!p)return {ok:false,reason:"disposed"};let r=t?.gateOperations([n],D);if(r)return {ok:false,reason:r};let i=chunkFIJZIQXA_cjs.Hb(t?.identity.actorId,()=>o.applyLifecycleOp(n));return i.ok?c({ok:true,changed:i.change!==null}):{ok:false,reason:i.detail?`${i.reason}: ${i.detail}`:i.reason}},applyCommentWrites(n,r){if(!p)return {ok:false,reason:"disposed"};if(n.length===0)return {ok:true,changed:false};let i=t?.gateOperations([],r);if(i)return {ok:false,reason:i};let l=o.resolveStory(r);if(!l.ok)return {ok:false,reason:l.reason};if(l.store.graftPackage(()=>o.currentPackage()),n.every(a=>a.kind==="delete")){let a=n.find(s=>s.kind==="delete"),d=chunkFIJZIQXA_cjs.Hb(t?.identity.actorId,()=>chunkJGNVNT2A_cjs.ea(o,n.flatMap(s=>s.kind==="delete"?[{commentId:s.commentId,...s.parentCommentId===void 0?{}:{parentCommentId:s.parentCommentId}}]:[]),r,a?.kind==="delete"?a.noteId:void 0));return d?c({ok:true,changed:d}):{ok:false,reason:"comment-delete-refused"}}if(n.length!==1)return {ok:false,reason:"mixed-comment-writes"};let e=n[0];if(e.kind==="create"||e.kind==="reply"){let a=chunkFIJZIQXA_cjs.Hb(t?.identity.actorId,()=>chunkJGNVNT2A_cjs.ca(o,{anchor:e.anchor,author:e.author,text:e.text,...e.date===void 0?{}:{date:e.date},...e.kind==="reply"?{replyToCommentId:e.parentCommentId}:{}},r));return a.ok?c({ok:true,changed:true,..."commentId"in a?{commentId:a.commentId}:{}}):{ok:false,reason:a.reason}}if(e.kind!=="resolve")return {ok:false,reason:"unsupported-comment-write"};let f=chunkFIJZIQXA_cjs.Hb(t?.identity.actorId,()=>chunkJGNVNT2A_cjs.da(o,e.commentId,e.resolved));return f.ok?c({ok:true,changed:true}):{ok:false,reason:f.reason}},applyCustomNodeWrite(n,r){if(!p)return {ok:false,reason:"disposed"};let i=t?.gateOperations([],r);if(i)return {ok:false,reason:i};let l=o.resolveStory(r);if(!l.ok)return {ok:false,reason:l.reason};let e=chunkFIJZIQXA_cjs.Hb(t?.identity.actorId,()=>chunkJGNVNT2A_cjs.ma(o,n,r));return e.ok?c({ok:true,changed:e.change!==null}):{ok:false,reason:e.detail?`${e.reason}: ${e.detail}`:e.reason}},save:()=>p?chunkFIJZIQXA_cjs.Ee(o.currentPackage()):null,subscribe:n=>o.subscribe(()=>n()),dispose(){m(),p=false;}}}Object.defineProperty(exports,"AUTOMATION_COMMAND_OPERATIONS",{enumerable:true,get:function(){return chunkVX43VBAX_cjs.i}});Object.defineProperty(exports,"AUTOMATION_QUERY_OPERATIONS",{enumerable:true,get:function(){return chunkVX43VBAX_cjs.h}});Object.defineProperty(exports,"AUTOMATION_SOLITARY_OPERATIONS",{enumerable:true,get:function(){return chunkVX43VBAX_cjs.j}});Object.defineProperty(exports,"HEADER_FOOTER_VARIANTS",{enumerable:true,get:function(){return chunkVX43VBAX_cjs.f}});Object.defineProperty(exports,"createAutomationPaginationProvider",{enumerable:true,get:function(){return chunkVX43VBAX_cjs.e}});Object.defineProperty(exports,"isAutomationCommand",{enumerable:true,get:function(){return chunkVX43VBAX_cjs.l}});Object.defineProperty(exports,"isSolitaryAutomationCommand",{enumerable:true,get:function(){return chunkVX43VBAX_cjs.k}});Object.defineProperty(exports,"paginationSnapshotOf",{enumerable:true,get:function(){return chunkVX43VBAX_cjs.c}});exports.SERVER_AUTOMATION_CAPABILITIES=j;exports.createServerAutomationHost=Y;
1
+ 'use strict';var chunkEKLM7NWB_cjs=require('./chunk-EKLM7NWB.cjs');require('./chunk-W35WTWAO.cjs'),require('./chunk-DOHF6FA7.cjs'),require('./chunk-7WQ7AAHW.cjs'),require('./chunk-MM5QBMTE.cjs'),require('./chunk-T6K2QYNZ.cjs'),require('./chunk-UHHYFIDT.cjs'),require('./chunk-OSFOJTHU.cjs');Object.defineProperty(exports,"AUTOMATION_COMMAND_OPERATIONS",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.e}});Object.defineProperty(exports,"AUTOMATION_QUERY_OPERATIONS",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.d}});Object.defineProperty(exports,"AUTOMATION_SOLITARY_OPERATIONS",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.f}});Object.defineProperty(exports,"HEADER_FOOTER_VARIANTS",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.c}});Object.defineProperty(exports,"SERVER_AUTOMATION_CAPABILITIES",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.n}});Object.defineProperty(exports,"byteSizeBucket",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.u}});Object.defineProperty(exports,"countBucket",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.v}});Object.defineProperty(exports,"createAutomationPaginationProvider",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.l}});Object.defineProperty(exports,"createDiagnosticEmitter",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.w}});Object.defineProperty(exports,"createServerAutomationHost",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.o}});Object.defineProperty(exports,"diagnosticCause",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.y}});Object.defineProperty(exports,"diagnosticCauses",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.x}});Object.defineProperty(exports,"diagnosticCodes",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.q}});Object.defineProperty(exports,"diagnosticErrorName",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.A}});Object.defineProperty(exports,"documentPartKind",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.B}});Object.defineProperty(exports,"exceptionCause",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.z}});Object.defineProperty(exports,"explainDiagnostic",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.p}});Object.defineProperty(exports,"isAutomationCommand",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.h}});Object.defineProperty(exports,"isSolitaryAutomationCommand",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.g}});Object.defineProperty(exports,"openDiagnosticCode",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.r}});Object.defineProperty(exports,"paginationSnapshotOf",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.j}});Object.defineProperty(exports,"reviewDiagnosticCode",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.t}});Object.defineProperty(exports,"storeEditDiagnosticCode",{enumerable:true,get:function(){return chunkEKLM7NWB_cjs.s}});
@@ -11,18 +11,20 @@
11
11
  * @packageDocumentation
12
12
  * @public
13
13
  */
14
- import { A as AutomationOperation, a as AutomationCapabilities, b as AutomationHost } from './protocol-Bqk4Izjc.js';
15
- export { c as AutomationAlignment, d as AutomationBatchRequest, e as AutomationBatchResponse, f as AutomationChangeEvent, g as AutomationContentControlLock, h as AutomationContentControlRangeLocation, i as AutomationContentControlScope, j as AutomationContentControlSubtype, k as AutomationContentControlValue, l as AutomationError, m as AutomationErrorCode, n as AutomationFontRead, o as AutomationFontWrite, p as AutomationHandle, q as AutomationHandleRef, r as AutomationObjectKind, s as AutomationOperationKind, t as AutomationOperationResult, u as AutomationPageOrientation, v as AutomationPageSetupRead, w as AutomationPageSetupWrite, x as AutomationParagraphFormatRead, y as AutomationParagraphFormatWrite, z as AutomationParagraphRef, B as AutomationPoint, C as AutomationReadingOrder, D as AutomationSaveResult, E as AutomationSearchOptions, F as AutomationSelectionMode, G as AutomationSpan, H as AutomationSpanRef, I as AutomationTextProjection, J as AutomationUnsubscribe, K as AutomationValue } from './protocol-Bqk4Izjc.js';
16
- import { c as HeaderFooterVariant, N as NoteKind } from './tree-package-fragment-BeeKxDw8.js';
17
- import { T as TextMeasurer, S as SemanticLayout } from './semantic-records-4B3WwFAi.js';
18
- import { H as HeadlessDocumentView } from './headless-document-view-qH331moE.js';
19
- import { a1 as OoxmlPackageLimits, Y as OoxmlPackageRejection } from './types-barrel-D3xCgQX6.js';
20
- export { a2 as RevisionAuthorEntry, a3 as RevisionAuthorResult, a4 as RevisionAuthorSkipReason, a5 as RevisionBatchEntry, a6 as RevisionBatchResult, a7 as RevisionBatchSkipReason } from './types-barrel-D3xCgQX6.js';
14
+ import { A as AutomationOperation, a as AutomationCapabilities, b as AutomationHost } from './protocol-DYzzz2ej.js';
15
+ export { c as AutomationAlignment, d as AutomationBatchRequest, e as AutomationBatchResponse, f as AutomationChangeEvent, g as AutomationContentControlLock, h as AutomationContentControlRangeLocation, i as AutomationContentControlScope, j as AutomationContentControlSubtype, k as AutomationContentControlValue, l as AutomationError, m as AutomationErrorCode, n as AutomationFontRead, o as AutomationFontWrite, p as AutomationHandle, q as AutomationHandleRef, r as AutomationObjectKind, s as AutomationOperationKind, t as AutomationOperationResult, u as AutomationPageOrientation, v as AutomationPageSetupRead, w as AutomationPageSetupWrite, x as AutomationParagraphFormatRead, y as AutomationParagraphFormatWrite, z as AutomationParagraphRef, B as AutomationPoint, C as AutomationReadingOrder, D as AutomationSaveResult, E as AutomationSearchOptions, F as AutomationSelectionMode, G as AutomationSpan, H as AutomationSpanRef, I as AutomationTextProjection, J as AutomationUnsubscribe, K as AutomationValue } from './protocol-DYzzz2ej.js';
16
+ import { c as HeaderFooterVariant, N as NoteKind } from './tree-package-store-CovjNARF.js';
17
+ import { T as TextMeasurer, S as SemanticLayout } from './semantic-records-DQmumPgL.js';
18
+ import { H as HeadlessDocumentView } from './headless-document-view-pp3q7wIh.js';
19
+ import { ao as OoxmlPackageLimits, aj as OoxmlPackageRejection } from './types-barrel-DuC5QBNC.js';
20
+ export { ap as RevisionAuthorEntry, a8 as RevisionAuthorResult, aq as RevisionAuthorSkipReason, ar as RevisionBatchEntry, a9 as RevisionBatchResult, as as RevisionBatchSkipDetail, at as RevisionBatchSkipReason, au as RevisionSiteRefusal } from './types-barrel-DuC5QBNC.js';
21
21
  import { CollaborationModuleContribution } from './collaboration.js';
22
- import './image-resources-BN-hUgCn.js';
23
- import './revision-projection-DZ4kKVev.js';
24
- import './omml-equation-CuzBL5DD.js';
25
- import './editor-scope-OHPwVQ5l.js';
22
+ import { B as ByteSizeBucket, b as CountBucket, f as DocumentOpenDiagnosticCode, i as ReviewDiagnosticCode, E as EditDiagnosticCode } from './diagnostic-hints-BeVjfNOv.js';
23
+ export { C as CollaborationDiagnosticCode, c as CustomNodeDiagnosticCode, d as DiagnosticCode, D as DiagnosticErrorName, e as DiagnosticExplanation, a as DocumentPartKind, F as FailureStage, g as FontDiagnosticCode, h as FormattingChangeKind, H as HistoryDiagnosticCode, P as PerformanceDiagnosticCode, R as ReviewChangeKind, j as ReviewOperation, k as diagnosticCodes, l as explainDiagnostic } from './diagnostic-hints-BeVjfNOv.js';
24
+ export { a as diagnosticCause, d as diagnosticCauses, b as diagnosticErrorName, c as documentPartKind, e as exceptionCause } from './diagnostic-context-B8M79cfK.js';
25
+ import './image-resources-tXLQShoC.js';
26
+ import './omml-equation-BUbU0utM.js';
27
+ import './editor-scope-7o9xweiJ.js';
26
28
  import './collaboration/replication.js';
27
29
  import './failure-NS2lsya4.js';
28
30
 
@@ -158,5 +160,50 @@ interface ServerAutomationHostOptions {
158
160
  */
159
161
  declare function createServerAutomationHost(bytes: Uint8Array, options?: ServerAutomationHostOptions): ServerAutomationHostResult;
160
162
 
161
- export { AUTOMATION_COMMAND_OPERATIONS, AUTOMATION_QUERY_OPERATIONS, AUTOMATION_SOLITARY_OPERATIONS, AutomationCapabilities, AutomationHost, AutomationOperation, HEADER_FOOTER_VARIANTS, SERVER_AUTOMATION_CAPABILITIES, createAutomationPaginationProvider, createServerAutomationHost, isAutomationCommand, isSolitaryAutomationCommand, paginationSnapshotOf };
162
- export type { AutomationPaginationOptions, AutomationPaginationProvider, AutomationPaginationSnapshot, AutomationStoryId, ServerAutomationHostOptions, ServerAutomationHostRejection, ServerAutomationHostResult };
163
+ /**
164
+ * Anonymous diagnostics, the neutral half: store reasons → public codes, size and count
165
+ * buckets, and one delivery path. The browser editor and the headless automation runtime both
166
+ * build their diagnostics here, so a refusal gets the same public code on either host.
167
+ *
168
+ * Only the RESULT of a lookup leaves the engine. A raw reason can be a sentence, and a package
169
+ * `detail` can name parts of the file, so neither is ever copied into a diagnostic.
170
+ */
171
+
172
+ /**
173
+ * The public code for a refused open. `too-large` is the one reason two layers share: the
174
+ * archive reports it WITH the limit it crossed, a single XML part reports it without one.
175
+ *
176
+ * @public
177
+ */
178
+ declare function openDiagnosticCode(reason: string, limit?: string): DocumentOpenDiagnosticCode;
179
+ /**
180
+ * The public code for a store or host refusal reason, or `null` for a reason this table does
181
+ * not know (a sentence, a binding reason). `unsupported-revision:<kind>` counts as
182
+ * `unsupported-revision`.
183
+ *
184
+ * @public
185
+ */
186
+ declare function storeEditDiagnosticCode(reason: string): EditDiagnosticCode | null;
187
+ /** The public code for a skipped tracked change, or null for a reason with no public code. */
188
+ declare function reviewDiagnosticCode(reason: string): ReviewDiagnosticCode | null;
189
+ /** The power-of-two bucket of a byte size. */
190
+ declare function byteSizeBucket(bytes: number): ByteSizeBucket;
191
+ /** The order-of-magnitude bucket of a count. */
192
+ declare function countBucket(count: number): CountBucket;
193
+ /** A diagnostic without the fields the emitter adds. Distributes over the union. */
194
+ type DiagnosticPayload<T> = T extends unknown ? Omit<T, 'schemaVersion' | 'editorSessionId' | 'time'> : never;
195
+ /** One delivery path for one editor or runtime instance. */
196
+ interface DiagnosticEmitter<E> {
197
+ /** Random for this instance and never stored. */
198
+ readonly editorSessionId: string;
199
+ /** Stamp the payload and hand it to every listener. A listener that throws is ignored. */
200
+ deliver(payload: DiagnosticPayload<E>): void;
201
+ }
202
+ /**
203
+ * A delivery path over `listeners`, read at each delivery so a later listener is heard. Generic
204
+ * over the event union, which the editor contracts own: this lane never names them.
205
+ */
206
+ declare function createDiagnosticEmitter<E>(listeners: () => Iterable<(event: E) => unknown>, now?: () => number): DiagnosticEmitter<E>;
207
+
208
+ export { AUTOMATION_COMMAND_OPERATIONS, AUTOMATION_QUERY_OPERATIONS, AUTOMATION_SOLITARY_OPERATIONS, AutomationCapabilities, AutomationHost, AutomationOperation, ByteSizeBucket, CountBucket, DocumentOpenDiagnosticCode, EditDiagnosticCode, HEADER_FOOTER_VARIANTS, ReviewDiagnosticCode, SERVER_AUTOMATION_CAPABILITIES, byteSizeBucket, countBucket, createAutomationPaginationProvider, createDiagnosticEmitter, createServerAutomationHost, isAutomationCommand, isSolitaryAutomationCommand, openDiagnosticCode, paginationSnapshotOf, reviewDiagnosticCode, storeEditDiagnosticCode };
209
+ export type { AutomationPaginationOptions, AutomationPaginationProvider, AutomationPaginationSnapshot, AutomationStoryId, DiagnosticEmitter, DiagnosticPayload, ServerAutomationHostOptions, ServerAutomationHostRejection, ServerAutomationHostResult };
@@ -1 +1 @@
1
- import {m,g,d}from'./chunk-VHAVHCQY.js';export{i as AUTOMATION_COMMAND_OPERATIONS,h as AUTOMATION_QUERY_OPERATIONS,j as AUTOMATION_SOLITARY_OPERATIONS,f as HEADER_FOOTER_VARIANTS,e as createAutomationPaginationProvider,l as isAutomationCommand,k as isSolitaryAutomationCommand,c as paginationSnapshotOf}from'./chunk-VHAVHCQY.js';import'./chunk-6EYYL7FL.js';import'./chunk-FRXAOVTB.js';import'./chunk-E7BQA6UP.js';import'./chunk-TSLBZ26X.js';import {T,ua,Ca,ma,ea,ca,da}from'./chunk-J6BVWIDB.js';import {b,a}from'./chunk-ETTO6GK3.js';import {Ce,Eb,Ee,Hb,Na,Hg,g as g$1}from'./chunk-4R3TEXMN.js';var j=Object.freeze({document:true,save:true,events:true,selection:false,scrolling:false,layout:false}),D=Object.freeze({kind:"body"});function Y(o,t={}){let m$1=Ce(o,t.limits??{});if(!m$1.ok)return {ok:false,reason:m$1.reason,...m$1.limit===void 0?{}:{limit:m$1.limit},...m$1.detail?{detail:m$1.detail}:{}};let p=m$1.package.parts.get(m$1.package.mainDocumentPart);if(!p)return {ok:false,reason:"no-main-document-part",detail:m$1.package.mainDocumentPart};let u=new T(m$1.package,ua(m$1.package,Eb(p))),y=t.collaborationModel?.session,c=()=>{},n=K(u,y,()=>c());if(t.pagination){let i,l=-1,e=t.pagination;n.prepare=async f=>{if(!f.operations.some(s=>s.op==="updateFieldResult"))return;i=void 0;let a=u.packageRevision,d=await e(Ca(u));u.packageRevision===a&&(i=d,l=a);},n.fieldPageContext=(f,a,d$1)=>{if(u.packageRevision!==l)return null;let s=g(u.currentPackage()).story(f);return s?d(i,s.part,a,d$1):null};}let r=m({port:n,capabilities:j});return y&&(c=y.attach(b(u,{documentId:y.documentId}))),{ok:true,host:r}}function G(o,t,m){let p=o.partFor(m);return p?Na(o,()=>{let u=Hg(o.currentPackage(),t,p.name);return u?(o.replacePackageShell(u.pkg),u.relationshipId):null},u=>u!==null):null}function K(o,t,m=()=>{}){let p=true,u=0,y=()=>t?(u+=1,{origin:t.identity.role==="agent"?g$1.mutationAgent:g$1.mutationHuman,actorId:t.identity.actorId,operationId:`${t.identity.actorId}:${t.sessionId}:automation:${u}`,recordsHistory:false}):{},c=n=>(t?.flushPendingJournals(),n);return {localChangeTracking:true,collaborative:()=>!!t,revision:()=>o.packageRevision,currentPackage:()=>p?o.currentPackage():null,apply(n,r=D,i=[]){if(!p)return {ok:false,reason:"disposed"};let l=n(d=>Hb(t?.identity.actorId,()=>G(o,d,r)));if(l===null)return {ok:false,reason:"unsupported-target"};let e=t?.gateOperations(l,r);if(e)return {ok:false,reason:e};let f=t?o.partFor(r)?.name:void 0,a$1=o.transact(r,d=>{for(let s of i)d.applyPackage(s);for(let s of l)d.apply(s);f&&d.applyPackage(s=>a(s,f,l));},y());return a$1.ok?c({ok:true,changed:a$1.change!==null}):{ok:false,reason:a$1.detail?`${a$1.reason}: ${a$1.detail}`:a$1.reason}},applyLifecycle(n){if(!p)return {ok:false,reason:"disposed"};let r=t?.gateOperations([n],D);if(r)return {ok:false,reason:r};let i=Hb(t?.identity.actorId,()=>o.applyLifecycleOp(n));return i.ok?c({ok:true,changed:i.change!==null}):{ok:false,reason:i.detail?`${i.reason}: ${i.detail}`:i.reason}},applyCommentWrites(n,r){if(!p)return {ok:false,reason:"disposed"};if(n.length===0)return {ok:true,changed:false};let i=t?.gateOperations([],r);if(i)return {ok:false,reason:i};let l=o.resolveStory(r);if(!l.ok)return {ok:false,reason:l.reason};if(l.store.graftPackage(()=>o.currentPackage()),n.every(a=>a.kind==="delete")){let a=n.find(s=>s.kind==="delete"),d=Hb(t?.identity.actorId,()=>ea(o,n.flatMap(s=>s.kind==="delete"?[{commentId:s.commentId,...s.parentCommentId===void 0?{}:{parentCommentId:s.parentCommentId}}]:[]),r,a?.kind==="delete"?a.noteId:void 0));return d?c({ok:true,changed:d}):{ok:false,reason:"comment-delete-refused"}}if(n.length!==1)return {ok:false,reason:"mixed-comment-writes"};let e=n[0];if(e.kind==="create"||e.kind==="reply"){let a=Hb(t?.identity.actorId,()=>ca(o,{anchor:e.anchor,author:e.author,text:e.text,...e.date===void 0?{}:{date:e.date},...e.kind==="reply"?{replyToCommentId:e.parentCommentId}:{}},r));return a.ok?c({ok:true,changed:true,..."commentId"in a?{commentId:a.commentId}:{}}):{ok:false,reason:a.reason}}if(e.kind!=="resolve")return {ok:false,reason:"unsupported-comment-write"};let f=Hb(t?.identity.actorId,()=>da(o,e.commentId,e.resolved));return f.ok?c({ok:true,changed:true}):{ok:false,reason:f.reason}},applyCustomNodeWrite(n,r){if(!p)return {ok:false,reason:"disposed"};let i=t?.gateOperations([],r);if(i)return {ok:false,reason:i};let l=o.resolveStory(r);if(!l.ok)return {ok:false,reason:l.reason};let e=Hb(t?.identity.actorId,()=>ma(o,n,r));return e.ok?c({ok:true,changed:e.change!==null}):{ok:false,reason:e.detail?`${e.reason}: ${e.detail}`:e.reason}},save:()=>p?Ee(o.currentPackage()):null,subscribe:n=>o.subscribe(()=>n()),dispose(){m(),p=false;}}}export{j as SERVER_AUTOMATION_CAPABILITIES,Y as createServerAutomationHost};
1
+ export{e as AUTOMATION_COMMAND_OPERATIONS,d as AUTOMATION_QUERY_OPERATIONS,f as AUTOMATION_SOLITARY_OPERATIONS,c as HEADER_FOOTER_VARIANTS,n as SERVER_AUTOMATION_CAPABILITIES,u as byteSizeBucket,v as countBucket,l as createAutomationPaginationProvider,w as createDiagnosticEmitter,o as createServerAutomationHost,y as diagnosticCause,x as diagnosticCauses,q as diagnosticCodes,A as diagnosticErrorName,B as documentPartKind,z as exceptionCause,p as explainDiagnostic,h as isAutomationCommand,g as isSolitaryAutomationCommand,r as openDiagnosticCode,j as paginationSnapshotOf,t as reviewDiagnosticCode,s as storeEditDiagnosticCode}from'./chunk-LQX36Z5P.js';import'./chunk-E4LOMDNL.js';import'./chunk-CPWLFPWC.js';import'./chunk-RCLZXP3B.js';import'./chunk-LSZ6KPKK.js';import'./chunk-U4JZVSOE.js';import'./chunk-OMCG63ZF.js';import'./chunk-YQ5G6LC7.js';
package/dist/binding.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkSRPILEWV_cjs=require('./chunk-SRPILEWV.cjs');require('./chunk-QMLCVPCD.cjs'),require('./chunk-ZUHOMK52.cjs'),require('./chunk-O2AL2HSJ.cjs'),require('./chunk-JGNVNT2A.cjs'),require('./chunk-2GO5T2JU.cjs'),require('./chunk-FIJZIQXA.cjs');Object.defineProperty(exports,"PROJECTION_ORIGIN",{enumerable:true,get:function(){return chunkSRPILEWV_cjs.l}});Object.defineProperty(exports,"bodyParagraphs",{enumerable:true,get:function(){return chunkSRPILEWV_cjs.c}});Object.defineProperty(exports,"docToTreeOps",{enumerable:true,get:function(){return chunkSRPILEWV_cjs.f}});Object.defineProperty(exports,"mountTreeSurface",{enumerable:true,get:function(){return chunkSRPILEWV_cjs.m}});Object.defineProperty(exports,"openTreeSession",{enumerable:true,get:function(){return chunkSRPILEWV_cjs.j}});Object.defineProperty(exports,"partHasNode",{enumerable:true,get:function(){return chunkSRPILEWV_cjs.g}});Object.defineProperty(exports,"reconcileDoc",{enumerable:true,get:function(){return chunkSRPILEWV_cjs.h}});Object.defineProperty(exports,"runPropsOf",{enumerable:true,get:function(){return chunkSRPILEWV_cjs.b}});Object.defineProperty(exports,"treeSchema",{enumerable:true,get:function(){return chunkSRPILEWV_cjs.a}});Object.defineProperty(exports,"treeToDoc",{enumerable:true,get:function(){return chunkSRPILEWV_cjs.e}});
1
+ 'use strict';var chunk6JPL6ZAS_cjs=require('./chunk-6JPL6ZAS.cjs');require('./chunk-BY2ACZZ6.cjs'),require('./chunk-7WQ7AAHW.cjs'),require('./chunk-MM5QBMTE.cjs'),require('./chunk-T6K2QYNZ.cjs'),require('./chunk-UHHYFIDT.cjs'),require('./chunk-OSFOJTHU.cjs');Object.defineProperty(exports,"PROJECTION_ORIGIN",{enumerable:true,get:function(){return chunk6JPL6ZAS_cjs.l}});Object.defineProperty(exports,"bodyParagraphs",{enumerable:true,get:function(){return chunk6JPL6ZAS_cjs.c}});Object.defineProperty(exports,"docToTreeOps",{enumerable:true,get:function(){return chunk6JPL6ZAS_cjs.f}});Object.defineProperty(exports,"mountTreeSurface",{enumerable:true,get:function(){return chunk6JPL6ZAS_cjs.m}});Object.defineProperty(exports,"openTreeSession",{enumerable:true,get:function(){return chunk6JPL6ZAS_cjs.j}});Object.defineProperty(exports,"partHasNode",{enumerable:true,get:function(){return chunk6JPL6ZAS_cjs.g}});Object.defineProperty(exports,"reconcileDoc",{enumerable:true,get:function(){return chunk6JPL6ZAS_cjs.h}});Object.defineProperty(exports,"runPropsOf",{enumerable:true,get:function(){return chunk6JPL6ZAS_cjs.b}});Object.defineProperty(exports,"treeSchema",{enumerable:true,get:function(){return chunk6JPL6ZAS_cjs.a}});Object.defineProperty(exports,"treeToDoc",{enumerable:true,get:function(){return chunk6JPL6ZAS_cjs.e}});
package/dist/binding.d.ts CHANGED
@@ -9,21 +9,27 @@
9
9
  * @public
10
10
  */
11
11
  import { Node, Schema } from 'prosemirror-model';
12
- import { X as OoxmlProperty, Y as OoxmlPackageRejection } from './types-barrel-D3xCgQX6.js';
13
- import { T as TreeDocxSessionView, a as TreeApplyResult } from './tree-session-contract-CVbmlMlq.js';
14
- export { D as DocumentStyleEntry, M as MapResult, b as TreeApplyOptions, c as TreeBindingRejection, d as bodyParagraphs, e as docToTreeOps, p as partHasNode, r as reconcileDoc, t as treeToDoc } from './tree-session-contract-CVbmlMlq.js';
12
+ import { ah as OoxmlProperty, ai as OoxmlPackageResult, aj as OoxmlPackageRejection } from './types-barrel-DuC5QBNC.js';
13
+ import { T as TreeDocxSessionView, a as TreeApplyResult } from './tree-session-contract-CZVAGl51.js';
14
+ export { D as DocumentStyleEntry, M as MapResult, b as TreeApplyOptions, c as TreeBindingRejection, d as bodyParagraphs, e as docToTreeOps, p as partHasNode, r as reconcileDoc, t as treeToDoc } from './tree-session-contract-CZVAGl51.js';
15
15
  import { ReviewModuleContribution } from './contracts/modules.js';
16
- export { S as StoryScope, a as StoryTargetRejection } from './tree-package-fragment-BeeKxDw8.js';
16
+ export { S as StoryScope, a as StoryTargetRejection } from './tree-package-store-CovjNARF.js';
17
17
  import { EditorView } from 'prosemirror-view';
18
- import './editor-scope-OHPwVQ5l.js';
19
- import './image-resources-BN-hUgCn.js';
20
- import './custom-node-writes-cvL5rhcD.js';
21
- import './headless-document-view-qH331moE.js';
18
+ import './editor-scope-7o9xweiJ.js';
19
+ import './image-resources-tXLQShoC.js';
20
+ import './custom-node-writes-Bn6uciLb.js';
21
+ import './headless-document-view-pp3q7wIh.js';
22
22
  import './collaboration/replication.js';
23
- import './revision-projection-DZ4kKVev.js';
24
- import './review-pane-D9jm8DcY.js';
25
- import './collaboration.js';
23
+ import './semantic-records-DQmumPgL.js';
24
+ import './omml-equation-BUbU0utM.js';
25
+ import './editor-CZQZmTIU.js';
26
+ import './contracts/document.js';
27
+ import './contracts/interaction.js';
28
+ import './semantic-interaction-kR_QB845.js';
29
+ import './document-protection-CUb55pl_.js';
26
30
  import './failure-NS2lsya4.js';
31
+ import './diagnostic-hints-BeVjfNOv.js';
32
+ import './collaboration.js';
27
33
 
28
34
  /** Attributes carried by a projected paragraph. */
29
35
  interface ParagraphAttrs {
@@ -86,9 +92,11 @@ type TreeSessionRejection = OoxmlPackageRejection | 'no-main-document-tree';
86
92
  type OpenTreeSessionResult = {
87
93
  readonly ok: true;
88
94
  readonly session: TreeDocxSession;
89
- } | {
95
+ } | Extract<OoxmlPackageResult, {
96
+ readonly ok: false;
97
+ }> | {
90
98
  readonly ok: false;
91
- readonly reason: TreeSessionRejection;
99
+ readonly reason: 'no-main-document-tree';
92
100
  readonly detail?: string;
93
101
  };
94
102
  interface OpenTreeSessionOptions {
package/dist/binding.js CHANGED
@@ -1 +1 @@
1
- export{l as PROJECTION_ORIGIN,c as bodyParagraphs,f as docToTreeOps,m as mountTreeSurface,j as openTreeSession,g as partHasNode,h as reconcileDoc,b as runPropsOf,a as treeSchema,e as treeToDoc}from'./chunk-Z6WBFXJU.js';import'./chunk-5CSUYANV.js';import'./chunk-E7BQA6UP.js';import'./chunk-TSLBZ26X.js';import'./chunk-J6BVWIDB.js';import'./chunk-ETTO6GK3.js';import'./chunk-4R3TEXMN.js';
1
+ export{l as PROJECTION_ORIGIN,c as bodyParagraphs,f as docToTreeOps,m as mountTreeSurface,j as openTreeSession,g as partHasNode,h as reconcileDoc,b as runPropsOf,a as treeSchema,e as treeToDoc}from'./chunk-BCXH4BXB.js';import'./chunk-G4HOFIKJ.js';import'./chunk-RCLZXP3B.js';import'./chunk-LSZ6KPKK.js';import'./chunk-U4JZVSOE.js';import'./chunk-OMCG63ZF.js';import'./chunk-YQ5G6LC7.js';
@@ -1,24 +1,19 @@
1
- import { W as TreeDocOp, co as TextFormFieldRange, cn as TextFormFieldOptions, au as Unsubscribe, E as ExecResult, ao as DrawingPositionInput, aM as DrawingTransform, A as ParagraphTabStop, y as IndentFormatting, z as ParagraphFlags, aB as ParagraphDisagreements, aj as DrawingTreeDocOp, at as SelectionPin, Q as OoxmlPackage, g as ReviewRevisionKind, an as ImageWrapTarget } from './types-barrel-D3xCgQX6.js';
2
- import { k as FieldResultsMode, I as InsertImageInput, S as StoryScope, A as ApplyImagePropertiesInput, i as ImageIntentResult } from './tree-package-fragment-BeeKxDw8.js';
3
- import { a as ImageDecodePort, S as SupportedImageMime } from './image-resources-BN-hUgCn.js';
4
- import './document-protection-BAGVGqaP.js';
1
+ import { c as FontConfigurationFragment, g as FontResolver, M as MarkedFontResolver, f as FontResolutionRequest } from './font-resolver-lSBLirLR.js';
2
+ import { p as DocumentSource, P as FontConfiguration, aK as ZoomMode, y as EditorFontError, s as Editor, R as ReviewPaneOptions, b as EditorCommand, C as CanResult, at as SelectedImageState, X as FormatPainterSurfaceState, ar as ScrollPlacement, aI as TrackedChangePredicate, aH as TrackedChangeFilterMode, Q as FontFaceRequest, T as FontSource, a6 as ImageContext, av as TableBorderEdgeTarget, aw as TableBorderSpec, ax as TableBorderStyle, aC as TableContext } from './editor-CZQZmTIU.js';
3
+ import { V as ViewScope, a as EditorExecOptions } from './editor-scope-7o9xweiJ.js';
4
+ import { ag as TreeDocOp, aS as TextFormFieldRange, aT as TextFormFieldOptions, ae as Unsubscribe, E as ExecResult, _ as DrawingPositionInput, aP as DrawingTransform, A as ParagraphTabStop, y as IndentFormatting, z as ParagraphFlags, a4 as ParagraphDisagreements, ay as DrawingTreeDocOp, ab as SelectionPin, Q as OoxmlPackage, g as ReviewRevisionKind, a1 as ImageWrapTarget } from './types-barrel-DuC5QBNC.js';
5
+ import { c as ImageDecodePort, S as SupportedImageMime } from './image-resources-tXLQShoC.js';
6
+ import { t as RevisionMarkupOptions, a as ReviewDisplayMode, z as RevisionMarkupChromeHandlers, S as SemanticLayout, T as TextMeasurer, C as ContentControlBoundaryRecord, q as ResolvedRevisionMarkup, O as SectionProperties } from './semantic-records-DQmumPgL.js';
7
+ import { F as FieldResultsMode, I as InsertImageInput, S as StoryScope, A as ApplyImagePropertiesInput, i as ImageIntentResult } from './tree-package-store-CovjNARF.js';
5
8
  import { EditorModule, ReviewModuleContribution } from './contracts/modules.js';
6
- import { D as DocumentSource, a as FontConfiguration, Z as ZoomMode, E as EditorFontError, i as Editor, e as EditorCommand, C as CanResult, p as SelectedImageState, z as FormatPainterSurfaceState, g as ScrollPlacement, r as TrackedChangePredicate, q as TrackedChangeFilterMode, F as FontFaceRequest, b as FontSource, I as ImageContext, B as TableBorderEdgeTarget, G as TableBorderSpec, J as TableBorderStyle, K as TableContext } from './editor-Ci7IZGmG.js';
7
- import { e as RevisionMarkupOptions, a as ReviewDisplayMode, i as RevisionMarkupChromeHandlers, d as ResolvedRevisionMarkup } from './revision-projection-DZ4kKVev.js';
8
- import { S as SemanticPosition, a as SemanticSelection, N as NavigationCommand } from './semantic-interaction-CIC-PooQ.js';
9
- import { e as FontConfigurationFragment, g as FontResolver, i as MarkedFontResolver, f as FontResolutionRequest } from './font-resolver-BVQB14qT.js';
10
- import { R as ReviewPaneOptions } from './review-pane-D9jm8DcY.js';
11
9
  import { EditorCollaborationSession, CollaborationRemoteSelection, CollaborationModuleContribution } from './collaboration.js';
12
- import { d as RevisionStyles, R as ReviewAuthorInfo, c as RevisionAuthorStyle, F as FieldShadingMode, f as DrawingPaintStrings } from './semantic-paint-BME37OMv.js';
13
- import { b as ResolvedFootnoteProperties, R as ResolvedEndnoteProperties, A as AuthoredNoteProperties } from './note-properties-4Y9o6Gyk.js';
14
- import { S as SemanticLayout, T as TextMeasurer, C as ContentControlBoundaryRecord } from './semantic-records-4B3WwFAi.js';
15
- import { B as BookmarkIndex } from './custom-node-writes-cvL5rhcD.js';
16
- import { C as CellSelection, S as SectionProperties } from './semantic-cell-selection-D9D1KSXq.js';
17
- import { T as TreeDocxSessionView, a as TreeApplyResult } from './tree-session-contract-CVbmlMlq.js';
10
+ import { d as RevisionStyles, R as ReviewAuthorInfo, c as RevisionAuthorStyle, F as FieldShadingMode, f as DrawingPaintStrings } from './semantic-paint-ZayFF3tD.js';
11
+ import { R as ResolvedFootnoteProperties, a as ResolvedEndnoteProperties, A as AuthoredNoteProperties } from './note-properties-qQUjO1GQ.js';
12
+ import { B as BookmarkIndex } from './custom-node-writes-Bn6uciLb.js';
13
+ import { S as SemanticPosition, a as SemanticSelection, N as NavigationCommand } from './semantic-interaction-kR_QB845.js';
14
+ import { C as CellSelection } from './semantic-cell-selection-eYag3P47.js';
15
+ import { T as TreeDocxSessionView, a as TreeApplyResult } from './tree-session-contract-CZVAGl51.js';
18
16
  import { C as CollaborationStatus } from './failure-NS2lsya4.js';
19
- import { V as ViewScope, b as EditorExecOptions } from './editor-scope-OHPwVQ5l.js';
20
- import './contracts/document.js';
21
- import './contracts/interaction.js';
22
17
 
23
18
  /**
24
19
  * A blank document, freshly zipped per call (the caller may hand the
@@ -782,7 +777,8 @@ declare function canExecuteImageCommand(command: Extract<EditorCommand, {
782
777
  * Run an insert or replace, re-checking the same gates {@link canExecuteImageCommand} applies.
783
778
  *
784
779
  * Async because image bytes must be decoded to derive their natural extent before the drawing can
785
- * be projected — the one editor command that cannot complete synchronously.
780
+ * be projected — the one editor command that cannot complete synchronously. It runs outside
781
+ * `exec`, so it reports a refusal to the editor's diagnostics itself.
786
782
  */
787
783
  declare function executeImageCommand(editor: DocxEditorInstance, command: Extract<EditorCommand, {
788
784
  type: 'insertImage' | 'replaceImage';
@@ -1392,6 +1388,18 @@ interface PaginatedSurfaceOptions {
1392
1388
  */
1393
1389
  readonly pointer?: 'engine' | 'native';
1394
1390
  readonly onChange?: (state: PaginatedSurfaceState) => void;
1391
+ /**
1392
+ * Told each time an edit is refused, with the raw reason: a store code such as `'locked'`,
1393
+ * or the surface's own refusal sentence. The raw reason can be a sentence, so a listener
1394
+ * maps it to a public code before it reports anything.
1395
+ */
1396
+ readonly onRejection?: (reason: string) => void;
1397
+ /**
1398
+ * Told the milliseconds of each layout pass and each paint. For `'input'`, told the browser
1399
+ * timestamp of each key press or pointer press on the pages, so a listener can time it to
1400
+ * the next frame. Numbers only.
1401
+ */
1402
+ readonly onTiming?: (phase: 'layout' | 'paint' | 'input', value: number) => void;
1395
1403
  /**
1396
1404
  * A plain click on an external (or inert) hyperlink, for a host to open its popover with.
1397
1405
  *
@@ -2395,6 +2403,8 @@ type OpenPaginatedResult = {
2395
2403
  readonly ok: false;
2396
2404
  readonly reason: string;
2397
2405
  readonly detail?: string;
2406
+ /** The resource limit the package crossed, when the reason is a size refusal. */
2407
+ readonly limit?: string;
2398
2408
  };
2399
2409
 
2400
2410
  /** One URL to fetch and the face it claims to be. */
@@ -3865,5 +3875,5 @@ interface ChromePrintJob {
3865
3875
  */
3866
3876
  declare function runChromePrint(editor: Pick<Editor, 'save'> & Partial<Pick<Editor, 'snapshot'>>, handlers?: ChromeExportHandlers, container?: Document | Element): Promise<ChromePrintJob>;
3867
3877
 
3868
- export { IMAGE_OVERLAY_NUDGE_SHIFT_PT as $, CHROME_GROUPS as C, DEFAULT_TABLE_CHROME_DRAFT as F, EMU_PER_POINT as I, IMAGE_OVERLAY_NUDGE_PT as _, createFontSource as a$, applyTableChromePick as aJ, bindHistoryGroup as aK, blankDocumentBytes as aL, canExecuteImageCommand as aM, captureImageMutationPreconditions as aN, chromeControlCount as aO, chromeMenuSlots as aP, chromeProbeForSlot as aQ, chromeSlotId as aR, chromeSlotIsToggle as aS, commandExecOptions as aT, commandForSlot as aU, commandForSlotValue as aV, commandForTableChromeSlotValue as aW, computeImageResizeResult as aX, computeMovedImagePosition as aY, computeResizedImageExtentEmu as aZ, createDocxEditor as a_, TABLE_BORDER_STYLE_OPTIONS as ar, TABLE_BORDER_TARGET_OPTIONS as as, TABLE_BORDER_WIDTH_OPTIONS as at, TABLE_CHROME_SLOT_IDS as au, CHROME_MENUS as b, createImageOverlayScrollPort as b0, cssPixelsToLayoutPoints as b1, customFonts as b2, defaultChromeGroups as b3, defaultTableLabel as b4, emuToOverlayPoints as b5, equationAtPosition as b6, executeImageCommand as b7, finalizeImageOverlayInteraction as b8, formattingBarChromeGroups as b9, isChromePrintShortcut as ba, isStaleImageInteractionCommit as bb, isTableChromeSlot as bc, layoutPointsToCssPixels as bd, loadFonts as be, overlayFrameToSheetCssPixels as bf, overlayHostOrigin as bg, pointsToEmu as bh, probeTableChromeCommand as bi, resizePreservesAspect as bj, runChromeExport as bk, runChromePrint as bl, runSave as bm, runTableChromeCommand as bn, runTableCommand as bo, runToolbarCommand as bp, selectedDrawingOverlayTargetOf as bq, selectedImageStateOf as br, surfacePaintScale as bs, tableChromeIconPaths as bt, tableChromeLabelKeyForTarget as bu, tableChromeToolbarState as bv, tableChromeVisible as bw, tableCommandToolbarState as bx, toolbarCommandState as by, toolbarCommandStates as bz, CHROME_UNAVAILABLE_KEY as c, ChromeExportError as g, ChromePrintError as t };
3869
- export type { AnchorFrameOrigin as A, CustomFontsOptions as B, DocxEditorInstance as D, CustomFontsResolver as E, DocxEditorConfig as G, DrawingSelectionIntent as H, EditorCommandExecute as J, EquationActivation as K, EquationChromeHandlers as L, EquationOps as M, FinalizedImageOverlayInteraction as N, OpenPaginatedResult as O, PaginatedSurfaceOptions as P, FontLoadFailure as Q, FontLoadFailureReason as R, FontMeasurementState as S, TableCommandPlan as T, FontUrlSource as U, HistoryGroupBinding as V, HistoryGroupBindingOptions as W, HyperlinkActivation as X, HyperlinkChromeHandlers as Y, HyperlinkOps as Z, PaginatedSurface as a, ImageInteractionSession as a0, ImageOverlayScrollPort as a1, ImageResizeHandle as a2, ImageResizeResult as a3, InvalidTextFormFieldChromeHandlers as a4, InvalidTextFormFieldSession as a5, LoadFontsRequest as a6, LoadFontsResult as a7, OpeningIndicatorHost as a8, OverlayFrameRect as a9, TableChromePick as aA, TableChromeSlotId as aB, TableInteractionLabelKey as aC, TextFormFieldChromeHandlers as aD, TextFormFieldDialogSession as aE, ToolbarCommandState as aF, ToolbarSlotValue as aG, ToolbarValueMap as aH, ToolbarValueSlot as aI, PaginatedSurfaceState as aa, ParagraphPropertyEdit as ab, PopupChromeRegistrationOptions as ac, RemoteCaretLabelAnchor as ad, RemoteCaretLabelHost as ae, ReviewWriteIntent as af, RunTableChromeCommandResult as ag, SectionAnchor as ah, SectionBreakInsertType as ai, SelectedDrawingOverlayTarget as aj, SurfaceEquation as ak, SurfaceFormatting as al, SurfaceHyperlink as am, SurfaceInsertImageInput as an, SurfaceNavigation as ao, SurfaceOverlayCoordinates as ap, SurfaceParagraphFormat as aq, TableBorderStyleOption as av, TableBorderTargetOption as aw, TableBorderTargetValue as ax, TableBorderWidthOption as ay, TableChromeDraft as az, ChromeControl as d, ChromeControlId as e, ChromeControlState as f, ChromeExportFormat as h, ChromeExportHandlers as i, ChromeExportResult as j, ChromeExportView as k, ChromeGroup as l, ChromeGroupId as m, ChromeMenu as n, ChromeMenuEntry as o, ChromeMenuId as p, ChromeMenuItemEntry as q, ChromeMenuSeparatorEntry as r, ChromeMenuSubmenuEntry as s, ChromePrintErrorCode as u, ChromePrintJob as v, ChromePrintOptions as w, ChromeSlotId as x, ContentControlWidgetChromeHandlers as y, ContentControlWidgetSession as z };
3878
+ export { bindHistoryGroup as A, blankDocumentBytes as B, CHROME_GROUPS as C, chromeMenuSlots as E, commandForSlot as G, commandForSlotValue as I, createDocxEditor as J, createFontSource as K, customFonts as M, isChromePrintShortcut as N, loadFonts as O, runChromeExport as P, runChromePrint as Q, runToolbarCommand as R, toolbarCommandState as U, CHROME_UNAVAILABLE_KEY as _, CHROME_MENUS as a, chromeProbeForSlot as a$, DEFAULT_TABLE_CHROME_DRAFT as a7, EMU_PER_POINT as a9, TABLE_BORDER_STYLE_OPTIONS as aG, TABLE_BORDER_TARGET_OPTIONS as aH, TABLE_BORDER_WIDTH_OPTIONS as aI, TABLE_CHROME_SLOT_IDS as aJ, applyTableChromePick as aX, canExecuteImageCommand as aY, captureImageMutationPreconditions as aZ, chromeControlCount as a_, IMAGE_OVERLAY_NUDGE_PT as ag, IMAGE_OVERLAY_NUDGE_SHIFT_PT as ah, ChromeExportError as b, chromeSlotId as b0, chromeSlotIsToggle as b1, commandExecOptions as b2, commandForTableChromeSlotValue as b3, computeImageResizeResult as b4, computeMovedImagePosition as b5, computeResizedImageExtentEmu as b6, createImageOverlayScrollPort as b7, cssPixelsToLayoutPoints as b8, defaultChromeGroups as b9, defaultTableLabel as ba, emuToOverlayPoints as bb, equationAtPosition as bc, executeImageCommand as bd, finalizeImageOverlayInteraction as be, formattingBarChromeGroups as bf, isStaleImageInteractionCommit as bg, isTableChromeSlot as bh, layoutPointsToCssPixels as bi, overlayFrameToSheetCssPixels as bj, overlayHostOrigin as bk, pointsToEmu as bl, probeTableChromeCommand as bm, resizePreservesAspect as bn, runSave as bo, runTableChromeCommand as bp, runTableCommand as bq, selectedDrawingOverlayTargetOf as br, selectedImageStateOf as bs, surfacePaintScale as bt, tableChromeIconPaths as bu, tableChromeLabelKeyForTarget as bv, tableChromeToolbarState as bw, tableChromeVisible as bx, tableCommandToolbarState as by, toolbarCommandStates as bz, ChromePrintError as l };
3879
+ export type { ChromeControl as $, DocxEditorConfig as D, FontLoadFailure as F, HistoryGroupBinding as H, LoadFontsRequest as L, SurfaceHyperlink as S, ToolbarCommandState as T, PaginatedSurfaceOptions as V, OpenPaginatedResult as W, PaginatedSurface as X, TableCommandPlan as Y, AnchorFrameOrigin as Z, ChromeControlId as a0, ChromeControlState as a1, ChromeExportView as a2, ChromeGroup as a3, ChromeGroupId as a4, ContentControlWidgetChromeHandlers as a5, ContentControlWidgetSession as a6, DrawingSelectionIntent as a8, SurfaceEquation as aA, SurfaceFormatting as aB, SurfaceInsertImageInput as aC, SurfaceNavigation as aD, SurfaceOverlayCoordinates as aE, SurfaceParagraphFormat as aF, TableBorderStyleOption as aK, TableBorderTargetOption as aL, TableBorderTargetValue as aM, TableBorderWidthOption as aN, TableChromeDraft as aO, TableChromePick as aP, TableChromeSlotId as aQ, TableInteractionLabelKey as aR, TextFormFieldChromeHandlers as aS, TextFormFieldDialogSession as aT, ToolbarSlotValue as aU, ToolbarValueMap as aV, ToolbarValueSlot as aW, EditorCommandExecute as aa, EquationActivation as ab, EquationChromeHandlers as ac, EquationOps as ad, FinalizedImageOverlayInteraction as ae, HyperlinkOps as af, ImageInteractionSession as ai, ImageOverlayScrollPort as aj, ImageResizeHandle as ak, ImageResizeResult as al, InvalidTextFormFieldChromeHandlers as am, InvalidTextFormFieldSession as an, OpeningIndicatorHost as ao, OverlayFrameRect as ap, PaginatedSurfaceState as aq, ParagraphPropertyEdit as ar, PopupChromeRegistrationOptions as as, RemoteCaretLabelAnchor as at, RemoteCaretLabelHost as au, ReviewWriteIntent as av, RunTableChromeCommandResult as aw, SectionAnchor as ax, SectionBreakInsertType as ay, SelectedDrawingOverlayTarget as az, ChromeExportFormat as c, ChromeExportHandlers as d, ChromeExportResult as e, ChromeMenu as f, ChromeMenuEntry as g, ChromeMenuId as h, ChromeMenuItemEntry as i, ChromeMenuSeparatorEntry as j, ChromeMenuSubmenuEntry as k, ChromePrintErrorCode as m, ChromePrintJob as n, ChromePrintOptions as o, ChromeSlotId as p, CustomFontsOptions as q, CustomFontsResolver as r, DocxEditorInstance as s, FontLoadFailureReason as t, FontMeasurementState as u, FontUrlSource as v, HistoryGroupBindingOptions as w, HyperlinkActivation as x, HyperlinkChromeHandlers as y, LoadFontsResult as z };
@@ -1,2 +1,2 @@
1
- import {h,a,b,e,c,f,Ud,Vb,Yb,_b,$b,Zb,Wc,Wb,Xb,lc,hd,yc,We as We$1,Ve as Ve$1,d,w,Hb,aa,Jb,id,ic,ld}from'./chunk-FRXAOVTB.js';import {b as b$1,a as a$1}from'./chunk-5CSUYANV.js';import {rb,wa,la,xa,Yc,f as f$1,J as J$1,a as a$2}from'./chunk-4R3TEXMN.js';var Ye=/^[\p{L}\p{N}\p{M} \-.+_,;]{1,64}$/u;function $(e){let t=new Map;for(let n of e)if(Array.isArray(n)){for(let o of n.slice(0,2048)){if(typeof o!="string"||!Ye.test(o))continue;let r=o.toLowerCase();if(t.has(r)||t.set(r,o),t.size===2048)break}if(t.size===2048)break}return Object.freeze([...t.values()])}function kt(e){let t=e&&"failures"in e?e.failures:void 0;return e==null||(e.sources?.length??0)===0&&(e.substitutions?.length??0)===0&&(t===void 0||Array.isArray(t)&&t.length===0)?void 0:e}var De=64,re=Object.freeze({family:"Calibri",sizeHalfPoints:22}),At=re;function Y(e,...t){let n=[e,...t],o=[],r=new Set;for(let l of n)for(let c of l.sources??[]){let u=h(c.request);r.has(u)||(r.add(u),o.push(c));}let i=[],s=new Set;for(let l of n)for(let c of l.substitutions??[]){let u=h(c.from);r.has(u)||s.has(u)||(s.add(u),i.push(c));}let a$1=$(n.map(l=>l.supportedFamilies));return Object.freeze({...a$1.length?{supportedFamilies:a$1}:{},epoch:e.epoch??0,maxFontBytes:e.maxFontBytes??a,sources:Object.freeze(o),...i.length>0?{substitutions:Object.freeze(i)}:{},defaultFont:e.defaultFont??re,...e.language!==void 0?{language:e.language}:{}})}var Ge=/^[\p{L}\p{N}\p{M} \-.+_,;]{1,64}$/u;function G(e){let t=e?.defaultFont?.family;return t!==void 0&&Ge.test(t)?t:re.family}var We="docx-editor.dev/font-resolver",ze=Symbol.for("docx-editor.dev/font-resolver");function Lt(e){let t={value:true,enumerable:false,configurable:true};try{Object.defineProperty(e,ze,t),Object.defineProperty(e,We,t);}catch(n){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:n})}return e}function It(e){return typeof e=="function"&&e[ze]===true}var se=class extends RangeError{constructor(n,o,r){super(`Font source ${n.family} (${o} bytes) exceeds the shaping byte ceiling (${r} bytes)`);this.request=n;}request},ae=class extends AggregateError{causes;constructor(t){let n=Object.freeze(t.slice(0,b*2));super(n,`Font origin rejected all ${n.length} face and substitution candidates`),this.causes=n;}},J=e=>`${e.family.trim().toLowerCase()} ${e.weight} ${e.style}`;function Je(e,t,n){let o=new Map(e.map(r=>[J(r),r]));for(let[r,i]of t)o.set(r,i);for(let r of n)o.has(J(r.to))&&o.set(J(r.from),r.from);return [...o.values()]}async function Pt(e,t,n={}){return je(e,t,n)}async function Bt(e,t,n={}){return je(e,t,n)}async function je(e,t,n){let o=n.maxExecutionFontBytes??a;if(!Number.isSafeInteger(o)||o<=0||o>a)throw new RangeError("Font execution byte ceiling is outside the supported range");let r=e.map(Qe),i,s=[],a$1=[],l=new Map,c=new Set,u=0,d=[],m=new Set,y=[],p=t.resolvedFaces??[],F=t.defaultFamily;for(let w=0;w<e.length;w+=1){Ue(t.signal);let R=e[w],A=Je(p,l,d),B;try{let S=r[w],T;if(S){let f=await qe(S,t.signal);if(!f.ok)throw f.cause;T=f.value;}else if(typeof R=="function"){let f=await qe(Promise.resolve(R(tt(t,F,A,u))).then(g=>({ok:!0,value:g}),g=>({ok:!1,cause:g})),t.signal);if(!f.ok)throw f.cause;T=f.value;}else T=R;if(T==null)continue;if(typeof T=="function"){W(n,R,w,new TypeError("A font origin answered with a function; pass the resolver itself rather than a function returning one"));continue}let _="failures"in T?T.failures:void 0,D=[];if(Array.isArray(_)){let f=Math.min(_.length,b);for(let g=0;g<f;g++)D.push(_[g]);_.length>f&&D.push(new Error("Additional font-origin failures were omitted"));}else _!==void 0&&D.push(_);let M;try{M=Ze(T,c,u,m,i?"maxFontBytes"in i&&i.maxFontBytes!==void 0?i.maxFontBytes:a:void 0,n.reserveOwnedBytes,n.instrumentation,o);}catch(f){for(let g of new Set(D))W(n,R,w,g);throw f}B=M;for(let f of new Set([...M.dropped,...D]))W(n,R,w,f);let v=M.fragment;v.supportedFamilies&&s.push(v.supportedFamilies),y.push(...D);let X=(v.sources??[]).map(f=>(h(f.request),[J(f.request),f.request])),b$1=[...v.substitutions??[]];!i&&"defaultFont"in v&&(F=G(v)),i||(i=v);let x=new Set(M.sourceKeys);if(x.size>0){d=d.filter(f=>!x.has(h(f.from)));for(let f of x)m.delete(f);}a$1.push(...v.sources??[]);for(let f of M.sourceKeys)c.add(f);u+=M.ownedBytes;for(let[f,g]of X)l.set(f,g);for(let f of b$1)d.push(f),m.add(h(f.from));}catch(S){if(B?.releaseOwnedBytes?.(),t.signal?.aborted)throw t.signal.reason??S;if(S instanceof Q)throw S.cause;W(n,R,w,S);continue}}if(!i)return;let{epoch:E,...P}=Y({...i,supportedFamilies:$(s),sources:a$1,substitutions:d});return y.length===0?P:{...P,failures:Object.freeze(y)}}var Q=class extends Error{constructor(n){super("Unable to reserve owned font bytes");this.cause=n;this.name="FontOwnershipReservationError";}cause},Z=class extends RangeError{};async function qe(e,t){if(!t)return e;Ue(t);let n,o=new Promise((i,s)=>{n=s;}),r=()=>n?.(t.reason);t.addEventListener("abort",r,{once:true});try{return await Promise.race([e,o])}finally{t.removeEventListener("abort",r);}}function Qe(e){if(e===null||typeof e!="object")return;let t;try{t=e.then;}catch(n){return Promise.resolve({ok:false,cause:n})}if(typeof t=="function")return Promise.resolve(e).then(n=>({ok:true,value:n}),n=>({ok:false,cause:n}))}function Ze(e$1,t,n,o,r,i,s,a$1=a){let l=e$1.sources??[],c$1=e$1.substitutions??[],u="maxFontBytes"in e$1?e$1.maxFontBytes:void 0,d="defaultFont"in e$1?e$1.defaultFont:void 0,m="epoch"in e$1?e$1.epoch:void 0,y="language"in e$1?e$1.language:void 0;if(!Array.isArray(l)||!Array.isArray(c$1))throw new TypeError("Font origin sources and substitutions must be arrays");let p=l.length,F=c$1.length;if(p>b)throw new RangeError(`Font source count must not exceed ${b}`);if(F>b)throw new RangeError(`Font substitution count must not exceed ${b}`);let E=u??a;if(!Number.isSafeInteger(E)||E<=0||E>a)throw new RangeError(`Font byte ceiling must be a positive safe integer no greater than ${a}`);let P=Math.min(r??E,a$1),w=0,R=[],A=new Set,B=[],S=[];for(let b$1=0;b$1<p;b$1+=1){let x=l[b$1];try{let f=ie(x.request),g=h(f);if(t.has(g)||A.has(g))continue;let L=x.availability,O=x.faceIndex,q=x.hash,ne=x.id;if(L!==void 0&&L!=="available"&&L!=="forbidden")throw new TypeError("Font source availability must be available or forbidden");if(!Number.isSafeInteger(O)||O<0)throw new RangeError("Font face index must be a non-negative safe integer");if(typeof q!="string"||q.length===0)throw new TypeError("Font source hash must be a non-empty string");let V;if(L!=="forbidden"){if(typeof ne!="string"||ne.length===0)throw new TypeError("Font source id must be a non-empty string");V=x.bytes;let j=e(V);if(j>P)throw j<=(r??E)?new se(f,j,a$1):new RangeError(`Font source ${f.family} (${j} bytes) exceeds the effective base byte ceiling (${P} bytes)`);if(t.has(g)||A.has(g))continue;if(n+w+j>c)throw new RangeError(`Font sources exceed the aggregate byte ceiling of ${c}`);w+=j;}else V=new Uint8Array(0);if(t.has(g)||A.has(g))continue;if(t.size+A.size>=b)throw new Z(`Font source count must not exceed ${b}`);A.add(g),R.push(g),B.push(Object.freeze({request:f,id:ne,bytes:V,hash:q,faceIndex:O,...L?{availability:L}:{}}));}catch(f){if(f instanceof Z)throw f;S.push(f);}}let T=new Set,_=[];for(let b=0;b<F;b+=1){let x=c$1[b];try{let f=ie(x.from),g=ie(x.to);h(f),h(g);let L=x.lineMetrics,O=L?Object.freeze({heightEm:L.heightEm,baselineEm:L.baselineEm}):void 0;if(O&&(!Number.isFinite(O.heightEm)||!Number.isFinite(O.baselineEm)||O.heightEm<=0||O.heightEm>4||O.baselineEm<0||O.baselineEm>O.heightEm))throw new RangeError("Font substitution line metrics must fit within a bounded em box");let q=h(f);if(t.has(q)||A.has(q)||o.has(q)||T.has(q))continue;T.add(q),_.push(Object.freeze({from:f,to:g,...O?{lineMetrics:O}:{}}));}catch(f){S.push(f);}}if((p>0||F>0)&&B.length===0&&_.length===0&&S.length>0)throw S.length===1?S[0]:new ae(S);let D=o.size;for(let b of A)o.has(b)&&(D-=1);if(D+T.size>b)throw new RangeError(`Font substitution count must not exceed ${b}`);let M;if(d!==void 0){let b=d.family,x=d.sizeHalfPoints;if(h({family:b,weight:400,style:"normal"}),!Number.isSafeInteger(x)||x<=0)throw new RangeError("Default font size must be a positive safe integer in half-points");M=Object.freeze({family:b,sizeHalfPoints:x});}if(m!==void 0&&(!Number.isSafeInteger(m)||m<0))throw new RangeError("Font configuration epoch must be a non-negative safe integer");if(y!==void 0&&typeof y!="string")throw new TypeError("Font shaping language must be a string");let v;if(w>0&&i)try{v=i(w);}catch(b){throw new Q(b)}let X;try{X=B.map(b=>f(b,s));}catch(b){throw v?.(),b}return {fragment:Object.freeze({supportedFamilies:$([e$1.supportedFamilies]),sources:Object.freeze(X),substitutions:Object.freeze(_),...m!==void 0?{epoch:m}:{},...u!==void 0?{maxFontBytes:u}:{},...M?{defaultFont:M}:{},...y!==void 0?{language:y}:{}}),sourceKeys:Object.freeze(R),ownedBytes:w,dropped:Object.freeze(S),releaseOwnedBytes:v}}function et(e){return !Number.isSafeInteger(e)||e<=0?0:e>c?c:e}function tt(e,t,n,o){let{committedSourceBytes:r,...i}=e,s=et(o);return {...i,defaultFamily:t,...n.length>0?{resolvedFaces:n}:{},...s>0?{committedSourceBytes:s}:{}}}function ie(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}function Ue(e){if(e?.aborted)throw e.reason??new DOMException("Font resolution was aborted","AbortError")}function W(e,t,n,o){let r;try{typeof t=="function"&&t.name.length>0&&(r=t.name);}catch{}try{o instanceof Error&&o.stack;}catch{}let i=Object.freeze({originIndex:n,...r!==void 0?{originName:r}:{},cause:o});if(e.onOriginFailure)try{let a=e.onOriginFailure(i);Promise.resolve(a).catch(l=>{console.warn("[fonts] font-origin diagnostic callback failed",l);});return}catch(a){console.warn("[fonts] font-origin diagnostic callback failed",a);}let s="";try{o instanceof Error&&o.message.length>0&&(s=`: ${o.message}`);}catch{}console.warn(`[fonts] a font origin failed and was skipped${s}`,o);}var nt=256,ot=Object.freeze([]);function ee(e){let t=new WeakMap;return (n,o)=>{let r=new Set;for(let i of n){let s=[{node:i,context:o,next:0}],a=l=>{s.pop();let c=s.at(-1)?.found??r;for(let u of l)c.add(u);};for(;s.length;){let l=s[s.length-1],c=t.get(l.node);if(c?.key===l.context.key){a(c.families);continue}if(!l.children){let m=e(l.node,l.context);l.children=m.children,l.found=new Set(m.families);}let u=l.children[l.next++];if(u){s.push({...u,next:0});continue}let d=l.found.size===0?ot:[...l.found];d.length<=nt&&rb(l.node)?t.set(l.node,{key:l.context.key,families:d}):t.delete(l.node),a(d);}}return [...r]}}function te(e,t){return e.children.flatMap(n=>n.kind==="textValue"?[]:[{node:n,context:t}])}var $e=new WeakMap,rt=4096;function Xe(e,t){let n=`${e.baseKey}|${e.depth+1}|${JSON.stringify(t)}`,o=$e.get(e);o||$e.set(e,o=new Map);let r=o.get(n);if(r)return r;let i={...e,depth:e.depth+1,cellStyle:t,key:n};return o.size<rt&&o.set(n,i),i}function it(e,t){let{styles:n,theme:o,supplementalFamilies:r,depth:i}=t;if(e.kind==="table"){let l=Ud(e,468,i,n),c=[];for(let u of l?.rows??[])for(let d of u.cells){let m=Xe(t,d.styleFormatting);for(let y of d.blocks)c.push({node:y,context:m});}return {children:c.reverse()}}let s=new Set;if(e.kind==="paragraph"){let l=e.children.find(u=>u.kind==="paragraphProperties"),c=id(n,l,t.cellStyle).runProperties;for(let u of ic(e,c,void 0,(d,m)=>ld(d,m,n),void 0,void 0,"all-markup",void 0,void 0,o)){if(!u.text||u.fontSlot!=="eastAsia"&&!r.has(u.style.fontFamily??""))continue;let d=b$1((u.fontSlot==="eastAsia"?u.style.fontFamilyEastAsia:u.style.fontFamily)??void 0);d&&s.add(d);}}let a=e.localName==="txbxContent"?{...t,cellStyle:void 0,key:`${t.baseKey}|${i}|undefined`}:t;return {families:[...s],children:te(e,a).reverse()}}function st(){let e=ee(it),t,n,o=(i,s)=>{if(!t||n!==i||t.theme!==s){let a=hd(i,s);n=i,t={key:`${a.cacheToken}|0|undefined`,baseKey:a.cacheToken,styles:a,theme:s,depth:0,supplementalFamilies:new Set([...Object.values(s.majorSupplemental??{}),...Object.values(s.minorSupplemental??{})])};}return t};return Object.assign((i,s,a)=>e([...i].reverse(),o(s,a)),{warmTableRows(i,s,a,l,c){let u=o(l,c),d=Ud(i,468,u.depth,u.styles)?.rows??[];for(let m of d.slice(s,a))for(let y of m.cells)e(y.blocks,Xe(u,y.styleFormatting));return d.length}})}function Ht(e,t,n){return st()(e,t,n)}function le(e,t){return e.attributes.find(n=>n.localName===t)?.value}var at=ee((e,t)=>{let n=[];if(e.namespaceUri===la){if(e.localName==="fldSimple"){let o=Wc(le(e,"instr")??"")?.font;o&&n.push(o);}if(e.localName==="p")for(let o of lt(e))n.push(o);}return {families:n,children:te(e,t)}});function rn(e){let t=new Map;for(let n of at(e,{key:""})){let o=b$1(n);o!==null&&!t.has(o.toLowerCase())&&t.set(o.toLowerCase(),o);}return [...t.values()]}function lt(e){let t=[],n=Vb(),o=[];for(let r=e.children.length-1;r>=0;r-=1){let i=e.children[r];i.kind!=="textValue"&&o.push({node:i,containerDepth:0});}for(;o.length>0;){let{node:r,containerDepth:i}=o.pop();if(i>=wa||r.namespaceUri===la&&r.localName==="p")continue;if(r.namespaceUri===la&&r.localName==="fldChar"){let a=le(r,"fldCharType");a==="begin"?Yb(n):a==="separate"?(n.nesting===1&&Ve(n,t),_b(n)):a==="end"&&(n.nesting===1&&Ve(n,t),$b(n));continue}if(r.namespaceUri===la&&(r.localName==="instrText"||r.localName==="delInstrText")){Zb(n,ut(r),r.localName==="delInstrText");continue}if(r.namespaceUri===la&&r.localName==="fldSimple"){let a=Wc(le(r,"instr")??"");a?.font&&t.push(a.font);}let s=xa(r,i);for(let a=r.children.length-1;a>=0;a-=1){let l=r.children[a];l.kind!=="textValue"&&o.push({node:l,containerDepth:s});}}return Wb(n),t}function Ve(e,t){let n=Xb(e);if(n.overflow)return;let o=Wc(n.instruction);o?.font&&t.push(o.font);}function ut(e){let t="",n=[...e.children].reverse();for(;n.length>0&&t.length<=256;){let o=n.pop();if(o.kind==="textValue")t+=o.value;else for(let r=o.children.length-1;r>=0;r-=1)n.push(o.children[r]);}return t}var ct=()=>true,ft=/[ᄀ-ᇿ⺀-鿿ꥠ-꥿가-퟿豈-﫿︰-﹏＀-￯]/u;function sn(e,t,n,o){if(!t)return [];let r=lc(t),i=hd(n,o),s=new Map;for(let a of e)for(let l of dt(a)){let c=Yc(l.children),u=d=>{if(d)for(let m of d.values()){let y=m.markerText===void 0||ft.test(m.markerText);for(let p of [m.markerStyle.fontFamily,y?m.markerStyle.fontFamilyEastAsia:null]){let F=b$1(p??void 0);if(F===null)continue;let E=F.toLowerCase();s.has(E)||s.set(E,F);}}};u(yc(c,r,i,ct));for(let d of c){let m=We$1(d);for(let y of m.contents)u(Ve$1(y,r,i));}}return [...s.values()].sort((a,l)=>a.localeCompare(l))}function dt(e){if(e.localName==="document"){for(let t of e.children)if(t.kind!=="textValue"&&t.localName==="body")return [t];return []}if(e.localName==="footnotes"||e.localName==="endnotes"){let t=[];for(let n of e.children)n.kind!=="textValue"&&(n.localName==="footnote"||n.localName==="endnote")&&t.push(n);return t}return [e]}var mt="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",yt=256,gt=31;function ue(e,t){return e.kind!=="textValue"&&e.localName===t&&e.namespaceUri===la}function He(e,t){return e.attributes.find(n=>n.localName===t&&n.namespaceUri===la)?.value}function Ke(e){let t=(e.relationships.get(e.mainDocumentPart)??[]).find(a=>a.type===mt),n=t?J$1(t):void 0,r=((n?.mode==="Internal"&&n.target.ok?e.parts.get(n.target.partName):void 0)??e.parts.get("/word/fontTable.xml"))?.root,i=new Map;if(!r||!ue(r,"fonts"))return i;let s=0;for(let a of r.children){if(!ue(a,"font"))continue;if(++s>yt)break;let l=a$1(He(a,"name"));if(!l)continue;let c=a.children.find(y=>ue(y,"altName")),u=c&&c.kind!=="textValue"?He(c,"val"):void 0,d=u!==void 0&&u.length<=gt?a$1(u):null,m=l.trim().toLowerCase();d&&!i.has(m)&&i.set(m,d);}return i}function En(e,t,n){let o=new Set;for(let r of e.substitutions??[]){let i=r.from.family.trim().toLowerCase(),s=r.to.family.trim().toLowerCase(),a=[t.alternates.get(i),t.fallbacks.get(i)].some(l=>l?.trim().toLowerCase()===s);s!==i&&a&&!(n.resolve(r.from)instanceof d)&&o.add(r.from.family.toLowerCase());}return o}function pt(e,t){return e.attributes.find(n=>n.localName===t&&n.namespaceUri===la)?.value}var Ft=new Set(["document","hdr","ftr","footnotes","endnotes","comments","styles","numbering","glossaryDocument"]),ht=new Set(["t","delText","instrText","delInstrText"]),bt=2e6;function xt(e,t){let n=e.stylesRoot(),o=e.documentThemeFonts(),r=[...w(n),...n?Hb(n).run:[]],i=aa(r,o),s=a$1(i.fontFamily??void 0)??t,a=a$1(Jb([{text:"\xE9",props:r,style:i,start:0,end:1}],o)[0]?.style.fontFamily??void 0)??s,l=a$1(i.fontFamilyEastAsia??void 0),c=a$1(i.complexLane?.fontFamily??void 0)??o.minorBidi??t,u=new Map,d=0;for(let p of e.currentPackage().parts.values()){if(p.root.namespaceUri!==la||!Ft.has(p.root.localName))continue;let F=[p.root];for(;F.length>0&&d<bt;){d++;let E=F.pop();if(E.kind!=="textValue"){if(E.namespaceUri===la){if(ht.has(E.localName))continue;if(E.localName==="rFonts"){for(let[P,w]of [["ascii",s],["hAnsi",a],["eastAsia",l],["cs",c]]){let R=a$1(pt(E,P));if(!R||!w)continue;let A=R.trim().toLowerCase(),B=u.get(A)??new Set;B.add(w),u.set(A,B);}continue}}for(let P of E.children)F.push(P);}}}for(let p of a$2)u.delete(p);let m=new Map,y=[];for(let[p,F]of u)F.size===1?m.set(p,[...F][0]):y.push(p);return {fallbacks:m,ambiguousFamilies:y,defaults:new Map([...u].map(([p,F])=>[p,[...F]]))}}function wt(e,t,n=[],o="Calibri"){let r=Ke(e.currentPackage()),i=xt(e,o),s=t.flatMap(c=>{let u=r.get(c.trim().toLowerCase());return u?[u]:[]}),a=new Map,l=t.flatMap(c=>i.defaults.get(c.trim().toLowerCase())??[]).filter(c=>c.trim().toLowerCase()!==o.trim().toLowerCase());for(let c of [...t,...s,...n,...l]){let u=a$1(c);if(u&&!a.has(u.trim().toLowerCase())&&a.set(u.trim().toLowerCase(),u),a.size===De)break}return {families:[...a.values()],alternates:r,fallbacks:i.fallbacks,ambiguousFamilies:i.ambiguousFamilies}}function Sn(e,t,n){let o=G(n),r=wt(e,t,[],o);return {plan:r,request:{families:r.families,defaultFamily:o}}}function On(e,t,n=t.fallbacks){let o=new Map(e.sources.map(a=>[h(a.request),a.request])),r=[],i=new Set((e.substitutions??[]).map(a=>h(a.from))),s=Math.max(0,b-i.size);for(let a of t.families){let l=a.trim().toLowerCase(),c=t.alternates.get(l),u=n.get(l);for(let d of [400,700])for(let m of ["normal","italic"]){let y={family:a,weight:d,style:m};if(!o.has(h(y)))for(let p of [c,u]){if(!p||p.trim().toLowerCase()===l)continue;let F=o.get(h({family:p,weight:d,style:m}));if(F){if(!i.has(h(y))){if(s===0)break;s--;}r.push({from:y,to:F});break}}}}return Y({...e,substitutions:[...r,...e.substitutions??[]]})}var Et={regular:{weight:400,style:"normal"},bold:{weight:700,style:"normal"},italic:{weight:400,style:"italic"},boldItalic:{weight:700,style:"italic"}};function kn(e,t){let n=[],o=[],r=0;for(let i of e){let s=i.bytes.byteLength;if(!Number.isSafeInteger(s)||s>t||s>a||s>c-r){o.push(i);continue}r+=s,n.push(i);}return {sources:n,dropped:o}}function An(e,t,n){let o=t.reduce((i,s)=>i+s.bytes.byteLength,0),r=new Set(t.filter(i=>i.request.family.trim().length>0).map(i=>h(i.request)));return St(e,{maxFontBytes:n,aggregateBudget:Math.max(0,c-o),shadowedRequests:r})}function St(e,t){let n=[],o=[],r=t.aggregateBudget,i=new Set;for(let s of e){let a=Et[s.style],l=Object.freeze({family:s.family,weight:a.weight,style:a.style});if(s.family.trim().length===0){o.push({request:l,partName:s.partName,reason:"malformed"});continue}let c=h(l);if(!(t.shadowedRequests?.has(c)||i.has(c))){if(i.add(c),s.bytes.byteLength>t.maxFontBytes||s.bytes.byteLength>r){o.push({request:l,partName:s.partName,reason:"overLimit"});continue}r-=s.bytes.byteLength,n.push({request:l,id:`embedded:${s.partName}#${s.style}`,bytes:s.bytes,hash:f$1(s.bytes),faceIndex:0});}}return {sources:n,dropped:o}}
1
+ import {h,a,b,e,c,f,Ud,Vb,Yb,_b,$b,Zb,Wc,Wb,Xb,lc,hd,yc,We as We$1,Ve as Ve$1,d,w,Hb,aa,Jb,id,ic,ld}from'./chunk-CPWLFPWC.js';import {b as b$1,a as a$1}from'./chunk-G4HOFIKJ.js';import {rb,wa,la,xa,Yc,f as f$1,J as J$1,a as a$2}from'./chunk-YQ5G6LC7.js';var Ye=/^[\p{L}\p{N}\p{M} \-.+_,;]{1,64}$/u;function $(e){let t=new Map;for(let n of e)if(Array.isArray(n)){for(let o of n.slice(0,2048)){if(typeof o!="string"||!Ye.test(o))continue;let r=o.toLowerCase();if(t.has(r)||t.set(r,o),t.size===2048)break}if(t.size===2048)break}return Object.freeze([...t.values()])}function kt(e){let t=e&&"failures"in e?e.failures:void 0;return e==null||(e.sources?.length??0)===0&&(e.substitutions?.length??0)===0&&(t===void 0||Array.isArray(t)&&t.length===0)?void 0:e}var De=64,re=Object.freeze({family:"Calibri",sizeHalfPoints:22}),At=re;function Y(e,...t){let n=[e,...t],o=[],r=new Set;for(let l of n)for(let c of l.sources??[]){let u=h(c.request);r.has(u)||(r.add(u),o.push(c));}let i=[],s=new Set;for(let l of n)for(let c of l.substitutions??[]){let u=h(c.from);r.has(u)||s.has(u)||(s.add(u),i.push(c));}let a$1=$(n.map(l=>l.supportedFamilies));return Object.freeze({...a$1.length?{supportedFamilies:a$1}:{},epoch:e.epoch??0,maxFontBytes:e.maxFontBytes??a,sources:Object.freeze(o),...i.length>0?{substitutions:Object.freeze(i)}:{},defaultFont:e.defaultFont??re,...e.language!==void 0?{language:e.language}:{}})}var Ge=/^[\p{L}\p{N}\p{M} \-.+_,;]{1,64}$/u;function G(e){let t=e?.defaultFont?.family;return t!==void 0&&Ge.test(t)?t:re.family}var We="docx-editor.dev/font-resolver",ze=Symbol.for("docx-editor.dev/font-resolver");function Lt(e){let t={value:true,enumerable:false,configurable:true};try{Object.defineProperty(e,ze,t),Object.defineProperty(e,We,t);}catch(n){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:n})}return e}function It(e){return typeof e=="function"&&e[ze]===true}var se=class extends RangeError{constructor(n,o,r){super(`Font source ${n.family} (${o} bytes) exceeds the shaping byte ceiling (${r} bytes)`);this.request=n;}request},ae=class extends AggregateError{causes;constructor(t){let n=Object.freeze(t.slice(0,b*2));super(n,`Font origin rejected all ${n.length} face and substitution candidates`),this.causes=n;}},J=e=>`${e.family.trim().toLowerCase()} ${e.weight} ${e.style}`;function Je(e,t,n){let o=new Map(e.map(r=>[J(r),r]));for(let[r,i]of t)o.set(r,i);for(let r of n)o.has(J(r.to))&&o.set(J(r.from),r.from);return [...o.values()]}async function Pt(e,t,n={}){return je(e,t,n)}async function Bt(e,t,n={}){return je(e,t,n)}async function je(e,t,n){let o=n.maxExecutionFontBytes??a;if(!Number.isSafeInteger(o)||o<=0||o>a)throw new RangeError("Font execution byte ceiling is outside the supported range");let r=e.map(Qe),i,s=[],a$1=[],l=new Map,c=new Set,u=0,d=[],m=new Set,y=[],p=t.resolvedFaces??[],F=t.defaultFamily;for(let w=0;w<e.length;w+=1){Ue(t.signal);let R=e[w],A=Je(p,l,d),B;try{let S=r[w],T;if(S){let f=await qe(S,t.signal);if(!f.ok)throw f.cause;T=f.value;}else if(typeof R=="function"){let f=await qe(Promise.resolve(R(tt(t,F,A,u))).then(g=>({ok:!0,value:g}),g=>({ok:!1,cause:g})),t.signal);if(!f.ok)throw f.cause;T=f.value;}else T=R;if(T==null)continue;if(typeof T=="function"){W(n,R,w,new TypeError("A font origin answered with a function; pass the resolver itself rather than a function returning one"));continue}let _="failures"in T?T.failures:void 0,D=[];if(Array.isArray(_)){let f=Math.min(_.length,b);for(let g=0;g<f;g++)D.push(_[g]);_.length>f&&D.push(new Error("Additional font-origin failures were omitted"));}else _!==void 0&&D.push(_);let M;try{M=Ze(T,c,u,m,i?"maxFontBytes"in i&&i.maxFontBytes!==void 0?i.maxFontBytes:a:void 0,n.reserveOwnedBytes,n.instrumentation,o);}catch(f){for(let g of new Set(D))W(n,R,w,g);throw f}B=M;for(let f of new Set([...M.dropped,...D]))W(n,R,w,f);let v=M.fragment;v.supportedFamilies&&s.push(v.supportedFamilies),y.push(...D);let X=(v.sources??[]).map(f=>(h(f.request),[J(f.request),f.request])),b$1=[...v.substitutions??[]];!i&&"defaultFont"in v&&(F=G(v)),i||(i=v);let x=new Set(M.sourceKeys);if(x.size>0){d=d.filter(f=>!x.has(h(f.from)));for(let f of x)m.delete(f);}a$1.push(...v.sources??[]);for(let f of M.sourceKeys)c.add(f);u+=M.ownedBytes;for(let[f,g]of X)l.set(f,g);for(let f of b$1)d.push(f),m.add(h(f.from));}catch(S){if(B?.releaseOwnedBytes?.(),t.signal?.aborted)throw t.signal.reason??S;if(S instanceof Q)throw S.cause;W(n,R,w,S);continue}}if(!i)return;let{epoch:E,...P}=Y({...i,supportedFamilies:$(s),sources:a$1,substitutions:d});return y.length===0?P:{...P,failures:Object.freeze(y)}}var Q=class extends Error{constructor(n){super("Unable to reserve owned font bytes");this.cause=n;this.name="FontOwnershipReservationError";}cause},Z=class extends RangeError{};async function qe(e,t){if(!t)return e;Ue(t);let n,o=new Promise((i,s)=>{n=s;}),r=()=>n?.(t.reason);t.addEventListener("abort",r,{once:true});try{return await Promise.race([e,o])}finally{t.removeEventListener("abort",r);}}function Qe(e){if(e===null||typeof e!="object")return;let t;try{t=e.then;}catch(n){return Promise.resolve({ok:false,cause:n})}if(typeof t=="function")return Promise.resolve(e).then(n=>({ok:true,value:n}),n=>({ok:false,cause:n}))}function Ze(e$1,t,n,o,r,i,s,a$1=a){let l=e$1.sources??[],c$1=e$1.substitutions??[],u="maxFontBytes"in e$1?e$1.maxFontBytes:void 0,d="defaultFont"in e$1?e$1.defaultFont:void 0,m="epoch"in e$1?e$1.epoch:void 0,y="language"in e$1?e$1.language:void 0;if(!Array.isArray(l)||!Array.isArray(c$1))throw new TypeError("Font origin sources and substitutions must be arrays");let p=l.length,F=c$1.length;if(p>b)throw new RangeError(`Font source count must not exceed ${b}`);if(F>b)throw new RangeError(`Font substitution count must not exceed ${b}`);let E=u??a;if(!Number.isSafeInteger(E)||E<=0||E>a)throw new RangeError(`Font byte ceiling must be a positive safe integer no greater than ${a}`);let P=Math.min(r??E,a$1),w=0,R=[],A=new Set,B=[],S=[];for(let b$1=0;b$1<p;b$1+=1){let x=l[b$1];try{let f=ie(x.request),g=h(f);if(t.has(g)||A.has(g))continue;let L=x.availability,O=x.faceIndex,q=x.hash,ne=x.id;if(L!==void 0&&L!=="available"&&L!=="forbidden")throw new TypeError("Font source availability must be available or forbidden");if(!Number.isSafeInteger(O)||O<0)throw new RangeError("Font face index must be a non-negative safe integer");if(typeof q!="string"||q.length===0)throw new TypeError("Font source hash must be a non-empty string");let V;if(L!=="forbidden"){if(typeof ne!="string"||ne.length===0)throw new TypeError("Font source id must be a non-empty string");V=x.bytes;let j=e(V);if(j>P)throw j<=(r??E)?new se(f,j,a$1):new RangeError(`Font source ${f.family} (${j} bytes) exceeds the effective base byte ceiling (${P} bytes)`);if(t.has(g)||A.has(g))continue;if(n+w+j>c)throw new RangeError(`Font sources exceed the aggregate byte ceiling of ${c}`);w+=j;}else V=new Uint8Array(0);if(t.has(g)||A.has(g))continue;if(t.size+A.size>=b)throw new Z(`Font source count must not exceed ${b}`);A.add(g),R.push(g),B.push(Object.freeze({request:f,id:ne,bytes:V,hash:q,faceIndex:O,...L?{availability:L}:{}}));}catch(f){if(f instanceof Z)throw f;S.push(f);}}let T=new Set,_=[];for(let b=0;b<F;b+=1){let x=c$1[b];try{let f=ie(x.from),g=ie(x.to);h(f),h(g);let L=x.lineMetrics,O=L?Object.freeze({heightEm:L.heightEm,baselineEm:L.baselineEm}):void 0;if(O&&(!Number.isFinite(O.heightEm)||!Number.isFinite(O.baselineEm)||O.heightEm<=0||O.heightEm>4||O.baselineEm<0||O.baselineEm>O.heightEm))throw new RangeError("Font substitution line metrics must fit within a bounded em box");let q=h(f);if(t.has(q)||A.has(q)||o.has(q)||T.has(q))continue;T.add(q),_.push(Object.freeze({from:f,to:g,...O?{lineMetrics:O}:{}}));}catch(f){S.push(f);}}if((p>0||F>0)&&B.length===0&&_.length===0&&S.length>0)throw S.length===1?S[0]:new ae(S);let D=o.size;for(let b of A)o.has(b)&&(D-=1);if(D+T.size>b)throw new RangeError(`Font substitution count must not exceed ${b}`);let M;if(d!==void 0){let b=d.family,x=d.sizeHalfPoints;if(h({family:b,weight:400,style:"normal"}),!Number.isSafeInteger(x)||x<=0)throw new RangeError("Default font size must be a positive safe integer in half-points");M=Object.freeze({family:b,sizeHalfPoints:x});}if(m!==void 0&&(!Number.isSafeInteger(m)||m<0))throw new RangeError("Font configuration epoch must be a non-negative safe integer");if(y!==void 0&&typeof y!="string")throw new TypeError("Font shaping language must be a string");let v;if(w>0&&i)try{v=i(w);}catch(b){throw new Q(b)}let X;try{X=B.map(b=>f(b,s));}catch(b){throw v?.(),b}return {fragment:Object.freeze({supportedFamilies:$([e$1.supportedFamilies]),sources:Object.freeze(X),substitutions:Object.freeze(_),...m!==void 0?{epoch:m}:{},...u!==void 0?{maxFontBytes:u}:{},...M?{defaultFont:M}:{},...y!==void 0?{language:y}:{}}),sourceKeys:Object.freeze(R),ownedBytes:w,dropped:Object.freeze(S),releaseOwnedBytes:v}}function et(e){return !Number.isSafeInteger(e)||e<=0?0:e>c?c:e}function tt(e,t,n,o){let{committedSourceBytes:r,...i}=e,s=et(o);return {...i,defaultFamily:t,...n.length>0?{resolvedFaces:n}:{},...s>0?{committedSourceBytes:s}:{}}}function ie(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}function Ue(e){if(e?.aborted)throw e.reason??new DOMException("Font resolution was aborted","AbortError")}function W(e,t,n,o){let r;try{typeof t=="function"&&t.name.length>0&&(r=t.name);}catch{}try{o instanceof Error&&o.stack;}catch{}let i=Object.freeze({originIndex:n,...r!==void 0?{originName:r}:{},cause:o});if(e.onOriginFailure)try{let a=e.onOriginFailure(i);Promise.resolve(a).catch(l=>{console.warn("[fonts] font-origin diagnostic callback failed",l);});return}catch(a){console.warn("[fonts] font-origin diagnostic callback failed",a);}let s="";try{o instanceof Error&&o.message.length>0&&(s=`: ${o.message}`);}catch{}console.warn(`[fonts] a font origin failed and was skipped${s}`,o);}var nt=256,ot=Object.freeze([]);function ee(e){let t=new WeakMap;return (n,o)=>{let r=new Set;for(let i of n){let s=[{node:i,context:o,next:0}],a=l=>{s.pop();let c=s.at(-1)?.found??r;for(let u of l)c.add(u);};for(;s.length;){let l=s[s.length-1],c=t.get(l.node);if(c?.key===l.context.key){a(c.families);continue}if(!l.children){let m=e(l.node,l.context);l.children=m.children,l.found=new Set(m.families);}let u=l.children[l.next++];if(u){s.push({...u,next:0});continue}let d=l.found.size===0?ot:[...l.found];d.length<=nt&&rb(l.node)?t.set(l.node,{key:l.context.key,families:d}):t.delete(l.node),a(d);}}return [...r]}}function te(e,t){return e.children.flatMap(n=>n.kind==="textValue"?[]:[{node:n,context:t}])}var $e=new WeakMap,rt=4096;function Xe(e,t){let n=`${e.baseKey}|${e.depth+1}|${JSON.stringify(t)}`,o=$e.get(e);o||$e.set(e,o=new Map);let r=o.get(n);if(r)return r;let i={...e,depth:e.depth+1,cellStyle:t,key:n};return o.size<rt&&o.set(n,i),i}function it(e,t){let{styles:n,theme:o,supplementalFamilies:r,depth:i}=t;if(e.kind==="table"){let l=Ud(e,468,i,n),c=[];for(let u of l?.rows??[])for(let d of u.cells){let m=Xe(t,d.styleFormatting);for(let y of d.blocks)c.push({node:y,context:m});}return {children:c.reverse()}}let s=new Set;if(e.kind==="paragraph"){let l=e.children.find(u=>u.kind==="paragraphProperties"),c=id(n,l,t.cellStyle).runProperties;for(let u of ic(e,c,void 0,(d,m)=>ld(d,m,n),void 0,void 0,"all-markup",void 0,void 0,o)){if(!u.text||u.fontSlot!=="eastAsia"&&!r.has(u.style.fontFamily??""))continue;let d=b$1((u.fontSlot==="eastAsia"?u.style.fontFamilyEastAsia:u.style.fontFamily)??void 0);d&&s.add(d);}}let a=e.localName==="txbxContent"?{...t,cellStyle:void 0,key:`${t.baseKey}|${i}|undefined`}:t;return {families:[...s],children:te(e,a).reverse()}}function st(){let e=ee(it),t,n,o=(i,s)=>{if(!t||n!==i||t.theme!==s){let a=hd(i,s);n=i,t={key:`${a.cacheToken}|0|undefined`,baseKey:a.cacheToken,styles:a,theme:s,depth:0,supplementalFamilies:new Set([...Object.values(s.majorSupplemental??{}),...Object.values(s.minorSupplemental??{})])};}return t};return Object.assign((i,s,a)=>e([...i].reverse(),o(s,a)),{warmTableRows(i,s,a,l,c){let u=o(l,c),d=Ud(i,468,u.depth,u.styles)?.rows??[];for(let m of d.slice(s,a))for(let y of m.cells)e(y.blocks,Xe(u,y.styleFormatting));return d.length}})}function Ht(e,t,n){return st()(e,t,n)}function le(e,t){return e.attributes.find(n=>n.localName===t)?.value}var at=ee((e,t)=>{let n=[];if(e.namespaceUri===la){if(e.localName==="fldSimple"){let o=Wc(le(e,"instr")??"")?.font;o&&n.push(o);}if(e.localName==="p")for(let o of lt(e))n.push(o);}return {families:n,children:te(e,t)}});function rn(e){let t=new Map;for(let n of at(e,{key:""})){let o=b$1(n);o!==null&&!t.has(o.toLowerCase())&&t.set(o.toLowerCase(),o);}return [...t.values()]}function lt(e){let t=[],n=Vb(),o=[];for(let r=e.children.length-1;r>=0;r-=1){let i=e.children[r];i.kind!=="textValue"&&o.push({node:i,containerDepth:0});}for(;o.length>0;){let{node:r,containerDepth:i}=o.pop();if(i>=wa||r.namespaceUri===la&&r.localName==="p")continue;if(r.namespaceUri===la&&r.localName==="fldChar"){let a=le(r,"fldCharType");a==="begin"?Yb(n):a==="separate"?(n.nesting===1&&Ve(n,t),_b(n)):a==="end"&&(n.nesting===1&&Ve(n,t),$b(n));continue}if(r.namespaceUri===la&&(r.localName==="instrText"||r.localName==="delInstrText")){Zb(n,ut(r),r.localName==="delInstrText");continue}if(r.namespaceUri===la&&r.localName==="fldSimple"){let a=Wc(le(r,"instr")??"");a?.font&&t.push(a.font);}let s=xa(r,i);for(let a=r.children.length-1;a>=0;a-=1){let l=r.children[a];l.kind!=="textValue"&&o.push({node:l,containerDepth:s});}}return Wb(n),t}function Ve(e,t){let n=Xb(e);if(n.overflow)return;let o=Wc(n.instruction);o?.font&&t.push(o.font);}function ut(e){let t="",n=[...e.children].reverse();for(;n.length>0&&t.length<=256;){let o=n.pop();if(o.kind==="textValue")t+=o.value;else for(let r=o.children.length-1;r>=0;r-=1)n.push(o.children[r]);}return t}var ct=()=>true,ft=/[ᄀ-ᇿ⺀-鿿ꥠ-꥿가-퟿豈-﫿︰-﹏＀-￯]/u;function sn(e,t,n,o){if(!t)return [];let r=lc(t),i=hd(n,o),s=new Map;for(let a of e)for(let l of dt(a)){let c=Yc(l.children),u=d=>{if(d)for(let m of d.values()){let y=m.markerText===void 0||ft.test(m.markerText);for(let p of [m.markerStyle.fontFamily,y?m.markerStyle.fontFamilyEastAsia:null]){let F=b$1(p??void 0);if(F===null)continue;let E=F.toLowerCase();s.has(E)||s.set(E,F);}}};u(yc(c,r,i,ct));for(let d of c){let m=We$1(d);for(let y of m.contents)u(Ve$1(y,r,i));}}return [...s.values()].sort((a,l)=>a.localeCompare(l))}function dt(e){if(e.localName==="document"){for(let t of e.children)if(t.kind!=="textValue"&&t.localName==="body")return [t];return []}if(e.localName==="footnotes"||e.localName==="endnotes"){let t=[];for(let n of e.children)n.kind!=="textValue"&&(n.localName==="footnote"||n.localName==="endnote")&&t.push(n);return t}return [e]}var mt="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",yt=256,gt=31;function ue(e,t){return e.kind!=="textValue"&&e.localName===t&&e.namespaceUri===la}function He(e,t){return e.attributes.find(n=>n.localName===t&&n.namespaceUri===la)?.value}function Ke(e){let t=(e.relationships.get(e.mainDocumentPart)??[]).find(a=>a.type===mt),n=t?J$1(t):void 0,r=((n?.mode==="Internal"&&n.target.ok?e.parts.get(n.target.partName):void 0)??e.parts.get("/word/fontTable.xml"))?.root,i=new Map;if(!r||!ue(r,"fonts"))return i;let s=0;for(let a of r.children){if(!ue(a,"font"))continue;if(++s>yt)break;let l=a$1(He(a,"name"));if(!l)continue;let c=a.children.find(y=>ue(y,"altName")),u=c&&c.kind!=="textValue"?He(c,"val"):void 0,d=u!==void 0&&u.length<=gt?a$1(u):null,m=l.trim().toLowerCase();d&&!i.has(m)&&i.set(m,d);}return i}function En(e,t,n){let o=new Set;for(let r of e.substitutions??[]){let i=r.from.family.trim().toLowerCase(),s=r.to.family.trim().toLowerCase(),a=[t.alternates.get(i),t.fallbacks.get(i)].some(l=>l?.trim().toLowerCase()===s);s!==i&&a&&!(n.resolve(r.from)instanceof d)&&o.add(r.from.family.toLowerCase());}return o}function pt(e,t){return e.attributes.find(n=>n.localName===t&&n.namespaceUri===la)?.value}var Ft=new Set(["document","hdr","ftr","footnotes","endnotes","comments","styles","numbering","glossaryDocument"]),ht=new Set(["t","delText","instrText","delInstrText"]),bt=2e6;function xt(e,t){let n=e.stylesRoot(),o=e.documentThemeFonts(),r=[...w(n),...n?Hb(n).run:[]],i=aa(r,o),s=a$1(i.fontFamily??void 0)??t,a=a$1(Jb([{text:"\xE9",props:r,style:i,start:0,end:1}],o)[0]?.style.fontFamily??void 0)??s,l=a$1(i.fontFamilyEastAsia??void 0),c=a$1(i.complexLane?.fontFamily??void 0)??o.minorBidi??t,u=new Map,d=0;for(let p of e.currentPackage().parts.values()){if(p.root.namespaceUri!==la||!Ft.has(p.root.localName))continue;let F=[p.root];for(;F.length>0&&d<bt;){d++;let E=F.pop();if(E.kind!=="textValue"){if(E.namespaceUri===la){if(ht.has(E.localName))continue;if(E.localName==="rFonts"){for(let[P,w]of [["ascii",s],["hAnsi",a],["eastAsia",l],["cs",c]]){let R=a$1(pt(E,P));if(!R||!w)continue;let A=R.trim().toLowerCase(),B=u.get(A)??new Set;B.add(w),u.set(A,B);}continue}}for(let P of E.children)F.push(P);}}}for(let p of a$2)u.delete(p);let m=new Map,y=[];for(let[p,F]of u)F.size===1?m.set(p,[...F][0]):y.push(p);return {fallbacks:m,ambiguousFamilies:y,defaults:new Map([...u].map(([p,F])=>[p,[...F]]))}}function wt(e,t,n=[],o="Calibri"){let r=Ke(e.currentPackage()),i=xt(e,o),s=t.flatMap(c=>{let u=r.get(c.trim().toLowerCase());return u?[u]:[]}),a=new Map,l=t.flatMap(c=>i.defaults.get(c.trim().toLowerCase())??[]).filter(c=>c.trim().toLowerCase()!==o.trim().toLowerCase());for(let c of [...t,...s,...n,...l]){let u=a$1(c);if(u&&!a.has(u.trim().toLowerCase())&&a.set(u.trim().toLowerCase(),u),a.size===De)break}return {families:[...a.values()],alternates:r,fallbacks:i.fallbacks,ambiguousFamilies:i.ambiguousFamilies}}function Sn(e,t,n){let o=G(n),r=wt(e,t,[],o);return {plan:r,request:{families:r.families,defaultFamily:o}}}function On(e,t,n=t.fallbacks){let o=new Map(e.sources.map(a=>[h(a.request),a.request])),r=[],i=new Set((e.substitutions??[]).map(a=>h(a.from))),s=Math.max(0,b-i.size);for(let a of t.families){let l=a.trim().toLowerCase(),c=t.alternates.get(l),u=n.get(l);for(let d of [400,700])for(let m of ["normal","italic"]){let y={family:a,weight:d,style:m};if(!o.has(h(y)))for(let p of [c,u]){if(!p||p.trim().toLowerCase()===l)continue;let F=o.get(h({family:p,weight:d,style:m}));if(F){if(!i.has(h(y))){if(s===0)break;s--;}r.push({from:y,to:F});break}}}}return Y({...e,substitutions:[...r,...e.substitutions??[]]})}var Et={regular:{weight:400,style:"normal"},bold:{weight:700,style:"normal"},italic:{weight:400,style:"italic"},boldItalic:{weight:700,style:"italic"}};function kn(e,t){let n=[],o=[],r=0;for(let i of e){let s=i.bytes.byteLength;if(!Number.isSafeInteger(s)||s>t||s>a||s>c-r){o.push(i);continue}r+=s,n.push(i);}return {sources:n,dropped:o}}function An(e,t,n){let o=t.reduce((i,s)=>i+s.bytes.byteLength,0),r=new Set(t.filter(i=>i.request.family.trim().length>0).map(i=>h(i.request)));return St(e,{maxFontBytes:n,aggregateBudget:Math.max(0,c-o),shadowedRequests:r})}function St(e,t){let n=[],o=[],r=t.aggregateBudget,i=new Set;for(let s of e){let a=Et[s.style],l=Object.freeze({family:s.family,weight:a.weight,style:a.style});if(s.family.trim().length===0){o.push({request:l,partName:s.partName,reason:"malformed"});continue}let c=h(l);if(!(t.shadowedRequests?.has(c)||i.has(c))){if(i.add(c),s.bytes.byteLength>t.maxFontBytes||s.bytes.byteLength>r){o.push({request:l,partName:s.partName,reason:"overLimit"});continue}r-=s.bytes.byteLength,n.push({request:l,id:`embedded:${s.partName}#${s.style}`,bytes:s.bytes,hash:f$1(s.bytes),faceIndex:0});}}return {sources:n,dropped:o}}
2
2
  export{kn as A,An as B,St as C,$ as a,kt as b,De as c,re as d,At as e,Y as f,G as g,We as h,ze as i,Lt as j,It as k,se as l,ae as m,Pt as n,Bt as o,ee as p,te as q,st as r,Ht as s,rn as t,lt as u,sn as v,En as w,wt as x,Sn as y,On as z};
@@ -0,0 +1 @@
1
+ var c=Object.freeze({review:null,collaboration:null,customNodes:Object.freeze([]),customNodePayloadNamespaces:Object.freeze([]),customNodeDiagnostics:Object.freeze([]),diagnosticListeners:Object.freeze([]),wantsDiagnostic:()=>false});function u(e){if(!e||e.length===0)return c;let i=null,t=null,r=[],a=new Set,s=[],d=[],l=[];for(let o of e){o.review&&i===null&&(i=o.review),o.collaboration&&t===null&&(t=o.collaboration),o.customNodes&&r.push(...o.customNodes);for(let n of o.customNodePayloadNamespaces??[])a.add(n);o.onCustomNodeDiagnostic&&s.push(o.onCustomNodeDiagnostic),o.onDiagnostic&&(d.push(o.onDiagnostic),l.push(o.wantsDiagnostic??(()=>true)));}return {review:i,collaboration:t,customNodes:r,customNodePayloadNamespaces:[...a],customNodeDiagnostics:s,diagnosticListeners:d,wantsDiagnostic:o=>l.some(n=>{try{return n(o)===!0}catch{return false}})}}export{u as a};