@docx-editor.dev/core 2.35.0-canary.20261104032723.sha-43c2012 → 2.35.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 (115) hide show
  1. package/README.md +9 -14
  2. package/dist/automation.cjs +1 -1
  3. package/dist/automation.d.ts +16 -11
  4. package/dist/automation.js +1 -1
  5. package/dist/binding.cjs +1 -1
  6. package/dist/binding.d.ts +12 -12
  7. package/dist/binding.js +1 -1
  8. package/dist/{chrome-print-CK3v5NhC.d.ts → chrome-print-H0uSxdg3.d.ts} +70 -17
  9. package/dist/{chunk-AMOFXSEO.cjs → chunk-2C75IWUN.cjs} +1 -1
  10. package/dist/chunk-2NFQ7OXY.cjs +1 -0
  11. package/dist/chunk-2V3V57SC.js +3 -0
  12. package/dist/chunk-32YOHLEK.cjs +32 -0
  13. package/dist/chunk-4NISR27M.cjs +31 -0
  14. package/dist/chunk-5ZE7ROGP.js +31 -0
  15. package/dist/{chunk-LZ64O473.js → chunk-66ZAVRGB.js} +1 -1
  16. package/dist/{chunk-A5GMOQWD.js → chunk-6767S7UF.js} +1 -1
  17. package/dist/chunk-6BZINLEN.cjs +1 -0
  18. package/dist/{chunk-EBIMIIC3.js → chunk-AVGSD7FB.js} +5 -5
  19. package/dist/{chunk-TZTKEPCC.cjs → chunk-CBJMRC4L.cjs} +1 -1
  20. package/dist/chunk-DCILO4XD.cjs +236 -0
  21. package/dist/{chunk-FBGZOGLU.cjs → chunk-DSIDCA3V.cjs} +4 -4
  22. package/dist/chunk-FLEFHRJG.cjs +5 -0
  23. package/dist/chunk-FMSXJ22B.js +2 -0
  24. package/dist/{chunk-7ACXKFKO.js → chunk-I4OZW2NO.js} +1 -1
  25. package/dist/chunk-JGE2O6IF.cjs +3 -0
  26. package/dist/chunk-K2BBJDM7.js +32 -0
  27. package/dist/chunk-LMASPHYS.js +1 -0
  28. package/dist/chunk-NYZP5NM3.js +4 -0
  29. package/dist/chunk-P3XUE72N.js +236 -0
  30. package/dist/{chunk-JZ4LO3ZZ.js → chunk-Q5YVLUGG.js} +1 -1
  31. package/dist/chunk-QALWAAPL.cjs +4 -0
  32. package/dist/{chunk-ELR6HXOO.js → chunk-QDUMZYTX.js} +1 -1
  33. package/dist/chunk-QLANEOTJ.cjs +7 -0
  34. package/dist/{chunk-4NPNKO5U.cjs → chunk-SJV6WCTP.cjs} +1 -1
  35. package/dist/{chunk-I4WSXFY6.js → chunk-TMCMXIBT.js} +4 -4
  36. package/dist/{chunk-GTICLPKS.cjs → chunk-TY5CE2JR.cjs} +1 -1
  37. package/dist/chunk-UAUB5YV6.js +7 -0
  38. package/dist/{chunk-Q4MUV5KX.cjs → chunk-WWZWT26M.cjs} +1 -1
  39. package/dist/chunk-Y3JSN52G.cjs +2 -0
  40. package/dist/chunk-YD3KSZJM.js +1 -0
  41. package/dist/collaboration/replication.cjs +1 -1
  42. package/dist/collaboration/replication.d.ts +3 -3
  43. package/dist/collaboration/replication.js +1 -1
  44. package/dist/collaboration.d.ts +2 -2
  45. package/dist/contracts/document.d.ts +2 -2
  46. package/dist/contracts/editor.d.ts +8 -8
  47. package/dist/contracts/modules.cjs +1 -1
  48. package/dist/contracts/modules.d.ts +34 -13
  49. package/dist/contracts/modules.js +1 -1
  50. package/dist/contracts/types.d.ts +3 -3
  51. package/dist/{custom-node-writes-BC3z8NwO.d.ts → custom-node-writes-Cj0itq58.d.ts} +2 -2
  52. package/dist/{document-protection-8hXPdn5U.d.ts → document-protection-CDLoYQI3.d.ts} +1 -1
  53. package/dist/{drawing-graphic-kind-_5u2E4ee.d.ts → drawing-graphic-kind-8zt6pugF.d.ts} +2 -2
  54. package/dist/{drawing-preview-package-JyAqL6OV.d.ts → drawing-preview-package-8o9LSfzP.d.ts} +1 -1
  55. package/dist/{editor-BGCdE3tB.d.ts → editor-CujQcn1z.d.ts} +20 -10
  56. package/dist/editor.cjs +1 -1
  57. package/dist/editor.css +3 -3
  58. package/dist/editor.d.ts +52 -29
  59. package/dist/editor.js +1 -1
  60. package/dist/export.cjs +2 -2
  61. package/dist/export.d.ts +6 -6
  62. package/dist/export.js +1 -1
  63. package/dist/index.cjs +1 -1
  64. package/dist/index.d.ts +18 -18
  65. package/dist/index.js +1 -1
  66. package/dist/{layout-shaping-D2qNes9-.d.ts → layout-shaping-ZjLRz_qa.d.ts} +1 -1
  67. package/dist/layout.cjs +1 -1
  68. package/dist/layout.d.ts +25 -21
  69. package/dist/layout.js +1 -1
  70. package/dist/{note-properties-DGPzKUuA.d.ts → note-properties-BRpskBeh.d.ts} +1 -1
  71. package/dist/output.cjs +1 -1
  72. package/dist/output.d.ts +10 -10
  73. package/dist/output.js +1 -1
  74. package/dist/{protocol-0y3iaYj9.d.ts → protocol-GVVQQwCX.d.ts} +13 -2
  75. package/dist/{review-paragraph-order-DeQp2_iu.d.ts → review-paragraph-order-aEHnQTt7.d.ts} +5 -2
  76. package/dist/{revision-projection-CrAv-HP6.d.ts → revision-projection-vU_UiTLx.d.ts} +1 -1
  77. package/dist/{semantic-cell-selection-CeG_qqDV.d.ts → semantic-cell-selection-CaRIISu-.d.ts} +2 -2
  78. package/dist/{semantic-interaction-DcE_ZsiD.d.ts → semantic-interaction-LJtUJJS5.d.ts} +1 -1
  79. package/dist/{semantic-paint-DfeN6UQF.d.ts → semantic-paint-2LBYlQcn.d.ts} +11 -4
  80. package/dist/{semantic-record-queries-qwd9Ict6.d.ts → semantic-record-queries-C_YK2gCz.d.ts} +1 -1
  81. package/dist/{semantic-records-thL1rcmG.d.ts → semantic-records-AU2pIYRp.d.ts} +3 -3
  82. package/dist/store.cjs +1 -1
  83. package/dist/store.d.ts +1664 -1664
  84. package/dist/store.js +1 -1
  85. package/dist/{tree-op-types-CGlwCQXg.d.ts → tree-op-types-DmrePCMo.d.ts} +320 -11
  86. package/dist/{tree-package-store-D0_BOm-r.d.ts → tree-package-fragment-DXZ2B7x0.d.ts} +702 -691
  87. package/dist/{tree-session-contract-DkThhHjy.d.ts → tree-session-contract-D3e-5YNq.d.ts} +19 -4
  88. package/dist/{unsupported-elements-qj0sXi2s.d.ts → unsupported-elements-9Pz4I_F6.d.ts} +1 -1
  89. package/docs/accept-reject-without-scrolling.md +31 -48
  90. package/docs/comment-on-found-text.md +47 -23
  91. package/docs/custom-review-cards.md +50 -34
  92. package/docs/highlight-ranges.md +26 -6
  93. package/docs/index.md +21 -21
  94. package/docs/propose-rewrite.md +87 -138
  95. package/docs/tracked-replacement.md +41 -20
  96. package/package.json +2 -2
  97. package/dist/chunk-4C7JUJDX.cjs +0 -1
  98. package/dist/chunk-4HENIAFG.js +0 -1
  99. package/dist/chunk-6IYKYYWF.js +0 -32
  100. package/dist/chunk-CDAFCPT6.cjs +0 -3
  101. package/dist/chunk-CU6QPXKD.js +0 -2
  102. package/dist/chunk-EMITIPLN.js +0 -4
  103. package/dist/chunk-IGB66DIX.cjs +0 -30
  104. package/dist/chunk-JQPTNBLT.js +0 -236
  105. package/dist/chunk-JVWRILO3.cjs +0 -4
  106. package/dist/chunk-KOYEBRLV.js +0 -1
  107. package/dist/chunk-KZZPOZOF.cjs +0 -2
  108. package/dist/chunk-NPWMZIPA.cjs +0 -32
  109. package/dist/chunk-NS2QCOAS.js +0 -7
  110. package/dist/chunk-O2PGRL5D.js +0 -3
  111. package/dist/chunk-TFJUIP4X.cjs +0 -236
  112. package/dist/chunk-V3N4SOAK.cjs +0 -1
  113. package/dist/chunk-V6FOPP2H.js +0 -30
  114. package/dist/chunk-XFEIUKOS.cjs +0 -7
  115. package/dist/chunk-ZF4N3N3L.cjs +0 -5
@@ -1 +1 @@
1
- 'use strict';var chunkTFJUIP4X_cjs=require('./chunk-TFJUIP4X.cjs');var K=new Set(["document","hdr","ftr","footnotes","endnotes"]),rr=24,H=512,z=chunkTFJUIP4X_cjs.ub(rr);function G(t){let n=t.root;return n.namespaceUri===chunkTFJUIP4X_cjs.pa&&K.has(n.localName)}function tr(t){let n=[],e=r=>{if(r.kind!=="textValue"){r.namespaceUri===chunkTFJUIP4X_cjs.pa&&r.localName==="p"&&n.push(r);for(let a of r.children)e(a);}};return e(t.root),n}function X(t){let n=chunkTFJUIP4X_cjs.Eb(t);let e=[],r=new Set;for(let a of tr(n)){let i=chunkTFJUIP4X_cjs.wb(a);if(!i||!chunkTFJUIP4X_cjs.vb(i))continue;let o=i.toUpperCase();if(r.has(o))continue;r.add(o);let l=chunkTFJUIP4X_cjs.Gm(n,a.id);l!==null&&e.push(Object.freeze({paragraphId:o,nodeId:a.id,text:l}));}return Object.freeze(e)}function er(t){let n=z.get(t.root);if(n)return n;let e=W(t,"byParagraphId");return z.set(t.root,e),e}function W(t,n){let e=chunkTFJUIP4X_cjs.Eb(t);let r=new Map,a=new Set,i=o=>{if(o.kind!=="textValue"){if(o.namespaceUri===chunkTFJUIP4X_cjs.pa&&o.localName==="p"){let l=chunkTFJUIP4X_cjs.wb(o);if(l&&chunkTFJUIP4X_cjs.vb(l)){let s=l.toUpperCase();a.has(s)||(a.add(s),o.kind==="paragraph"&&(n==="byParagraphId"?r.set(s,o.id):r.set(o.id,s)));}}for(let l of o.children)i(l);}};return i(e.root),r}function V(t,n){if(t.length!==n.length)return false;for(let e=0;e<t.length;e+=1)if(t[e].root!==n[e])return false;return true}function $(t){let n=new Map,e=null,r=(o,l,s)=>{for(n.delete(o),n.set(o,{partName:l.name,root:l.root,nodeId:s});n.size>H;){let d=n.keys().next();if(d.done)break;n.delete(d.value);}},a=(o,l)=>{let s=n.get(o);if(!s)return null;let d=l.find(k=>k.name===s.partName);if(!d)return null;if(d.root===s.root)return {part:d,nodeId:s.nodeId};let u=chunkTFJUIP4X_cjs.eb(d,s.nodeId);if(!u||u.kind!=="paragraph")return null;let x=chunkTFJUIP4X_cjs.wb(u);return !x||x.toUpperCase()!==o?null:(r(o,d,s.nodeId),{part:d,nodeId:s.nodeId})};return Object.assign(o=>{let l=t(),s=a(o,l);if(s)return s;if(e&&e.ids.has(o)&&V(l,e.roots))return null;for(let d of l){let u=er(d).get(o);if(u!==void 0)return r(o,d,u),{part:d,nodeId:u}}return (!e||!V(l,e.roots))&&(e={roots:l.map(d=>d.root),ids:new Set}),e.ids.size<H&&e.ids.add(o),null},{forgetIds(o){for(let{paragraphId:l,nodeId:s}of o)n.get(l)?.nodeId!==s&&n.delete(l);},forgetAll(){n.clear();},hasHints(){return n.size>0}})}function Y(t,n,e){if(!t.hasHints())return;let r=[...e.dirty,...e.created];if(e.impact!=="text-local"||r.length===0)return t.forgetAll();let a=[];for(let i of r){let o=n.find(d=>i.startsWith(`${d.name}#`)),l=o?chunkTFJUIP4X_cjs.eb(o,i):null,s=l?.kind==="paragraph"?chunkTFJUIP4X_cjs.wb(l):null;if(!s)return t.forgetAll();a.push({paragraphId:s.toUpperCase(),nodeId:i});}t.forgetIds(a);}function q(t){let n=null;return e=>{let r=t();n?.root!==r.root&&(n={root:r.root,byNodeId:W(r,"byNodeId")});let a=n.byNodeId.get(e);if(a===void 0)return null;let i=chunkTFJUIP4X_cjs.Gm(r,e);return i===null?null:Object.freeze({paragraphId:a,nodeId:e,text:i})}}function Z(t,n){return chunkTFJUIP4X_cjs.Wa(t,n)}var ar=Object.freeze({kind:"body"}),ir=1e6;function A(t,n){if(n<=0||n>=t.length)return false;let e=t.charCodeAt(n-1),r=t.charCodeAt(n);return e>=55296&&e<=56319&&r>=56320&&r<=57343}function lr(t,n,e){if(n===e)return [];let r=0,a=Math.min(n.length,e.length);for(;r<a&&n.charCodeAt(r)===e.charCodeAt(r);)r+=1;for(;r>0&&(A(n,r)||A(e,r));)r-=1;let i=0;for(;i<n.length-r&&i<e.length-r&&n.charCodeAt(n.length-i-1)===e.charCodeAt(e.length-i-1);)i+=1;for(;i>0&&(A(n,n.length-i)||A(e,e.length-i));)i-=1;let o=n.length-r-i,l=e.slice(r,e.length-i),s=[];return o>0&&s.push({op:"deleteText",paragraphId:t,start:r,end:r+o}),l.length>0&&s.push({op:"insertText",paragraphId:t,offset:r,text:l}),Object.freeze(s)}function sr(t){let n=r=>!!r&&r.kind!=="textValue"&&r.namespaceUri===chunkTFJUIP4X_cjs.pa&&r.localName==="t"&&r.attributes.every(a=>a.namespaceUri===chunkTFJUIP4X_cjs.qa&&a.localName==="space")&&r.children.every(a=>a.kind==="textValue"),e=[];for(let r of t){let a=e.at(-1);if(!n(a)||!n(r)){e.push(r);continue}let i=a.children.map(o=>o.kind==="textValue"?o.value:"").join("")+r.children.map(o=>o.kind==="textValue"?o.value:"").join("");e[e.length-1]={...a,attributes:/^\s|\s$/.test(i)?[{kind:"xmlSpace",namespaceUri:chunkTFJUIP4X_cjs.qa,localName:"space",prefix:"xml",value:"preserve"}]:[],children:[{id:a.children[0]?.id??`${a.id}/text`,kind:"textValue",value:i}]};}return e}function F(t){if(t.kind==="textValue")return t;let n=false,e=t.children.map(r=>{let a=F(r);return a!==r&&(n=true),a});if(t.namespaceUri===chunkTFJUIP4X_cjs.pa&&t.localName==="r"){let r=sr(e);(r.length!==e.length||r.some((a,i)=>a!==e[i]))&&(e=[...r],n=true);}return n?{...t,children:e}:t}function dr(t,n,e){let r=t.parts.get(n);if(!r)return t;let a=false,i=new Set;for(let o of e)(o.op==="insertText"||o.op==="deleteText")&&!o.revision&&i.add(o.paragraphId);for(let o of i){let l=chunkTFJUIP4X_cjs.eb(r,o);if(!l||l.kind==="textValue")continue;let s=F(l);if(s===l)continue;let d=chunkTFJUIP4X_cjs.kb(r,o,s,{deferValidation:true});d.ok&&(r=d.part,a=true);}return a?chunkTFJUIP4X_cjs.qg(t,r):t}function pr(t,n){let e=n.documentId.trim();if(e.length===0||e.length>256)throw new TypeError("documentId must contain 1 to 256 characters");let r=()=>X(t.bodyStore().part),a,i=()=>{let p=t.bodyStore().part,c=t.currentPackage();if(a?.pkg===c&&a.body===p)return a.parts;let g=[p];for(let m of c.parts.values())m===p||!G(m)||g.push(m);return a={pkg:c,body:p,parts:Object.freeze(g)},a.parts},o=$(i),l=t.packageRevision,s=t.lastModelChange,d=()=>{let p=t.packageRevision,c=t.lastModelChange;p===l&&c===s||(p===l+1&&c!==null&&c!==s?Y(o,i(),c):o.forgetAll(),l=p,s=c);},u=q(()=>t.bodyStore().part),x=(p,c)=>{if(p.length===0)return {ok:true,changed:false};let g=r(),m=new Set,I=[];for(let h of p){if(typeof h.text!="string"||h.text.length>ir)return {ok:false,reason:"collaboration-text-limit"};if(typeof h.paragraphId!="string"||h.paragraphId.length===0||h.paragraphId.length>256)return {ok:false,reason:"unknown-paragraph-id"};let f=h.paragraphId.toUpperCase();if(m.has(f))return {ok:false,reason:"duplicate-paragraph-id"};m.add(f);let D=g.filter(Q=>Q.paragraphId===f);if(D.length!==1)return {ok:false,reason:"unknown-paragraph-id"};let w=D[0];I.push(...lr(w.nodeId,w.text,h.text));}if(I.length===0)return {ok:true,changed:false};let v=t.transact(ar,h=>{for(let f of I)h.apply(f);h.applyPackage(f=>dr(f,f.mainDocumentPart,I));},{origin:c.origin,actorId:c.actorId,operationId:c.operationId,recordsHistory:false});return v.ok?{ok:true,changed:v.change!==null}:{ok:false,reason:v.detail??v.reason}},k={documentId:e,interactive:n.interactive===true,paragraphs:r,paragraphByNodeId:u,paragraphTextOf(p){for(let c of i()){let g=chunkTFJUIP4X_cjs.Gm(c,p);if(g!==null)return g}return null},paragraphByStableId(p){let c=p.toUpperCase();d();let g=o(c);if(!g)return null;let m=chunkTFJUIP4X_cjs.Gm(g.part,g.nodeId);return m===null?null:Object.freeze({paragraphId:c,nodeId:g.nodeId,text:m})},applyParagraphText(p,c,g){return x([{paragraphId:p,text:c}],g)},applyParagraphTexts:x,applyRemotePackage(p,c){let g=t.publishRemotePackage(p,c);return g.ok?{ok:true,changed:g.change!==null}:{ok:false,reason:g.detail??g.reason}},revision:()=>t.packageRevision,subscribe:p=>t.subscribe(p),observePrimitiveJournal:p=>Z(t,p),hasPendingJournals:()=>chunkTFJUIP4X_cjs.Sa(t),flushPendingJournals:()=>{chunkTFJUIP4X_cjs.Ta(t);},save:()=>chunkTFJUIP4X_cjs.ng(t.currentPackage()),binaryPart(p){let c=t.currentPackage();return c.partBytes.get(p)??c.partBytes.get(p.startsWith("/")?p.slice(1):`/${p}`)??null}};return Object.freeze(k)}function cr(t,n,e){if(n===e||t>n.length)return Math.min(t,e.length);let r=0;for(;r<n.length&&r<e.length&&n[r]===e[r];)r+=1;let a=0;for(;a<n.length-r&&a<e.length-r&&n[n.length-1-a]===e[e.length-1-a];)a+=1;if(t<=r)return Math.min(t,e.length);if(t>n.length-a)return Math.min(e.length,t+e.length-n.length);let i=gr(n,e,r,a),o=i.offsets.get(t);return o===void 0&&(o=(i.table?fr(i.table,t,n,e,r):null)??Pr(t,n,e,r,a)??r,i.offsets.set(t,o)),o}var b=[],ur=16;function gr(t,n,e,r){let a=b.findIndex(o=>o.before===t&&o.after===n);if(a>=0){let[o]=b.splice(a,1);return b.push(o),o}let i={before:t,after:n,table:mr(t,n,e,r),offsets:new Map};return b.length>=ur&&b.shift(),b.push(i),i}var hr=1<<18;function mr(t,n,e,r){let a=t.length-r-e,i=n.length-r-e;if(a*i>hr)return null;let o=i+1,l=new Uint32Array((a+1)*o);for(let s=a-1;s>=0;s-=1)for(let d=i-1;d>=0;d-=1)l[s*o+d]=t[e+s]===n[e+d]?l[(s+1)*o+d+1]+1:Math.max(l[(s+1)*o+d],l[s*o+d+1]);return {lengths:l,width:o,columns:i}}function fr(t,n,e,r,a){let{lengths:i,width:o,columns:l}=t,s=n-a,d=0,u=0;for(;d<s;)u<l&&e[a+d]===r[a+u]?(d+=1,u+=1):u>=l||i[(d+1)*o+u]>=i[d*o+u+1]?d+=1:u+=1;return a+u}var yr=[32,16,8,4];function Pr(t,n,e,r,a){let i=e.slice(r,e.length-a),o=l=>{let s=i.indexOf(l);return s>=0&&i.indexOf(l,s+1)<0?s:null};for(let l of yr){let s=n.slice(Math.max(r,t-l),t);if(s.length===l){let u=o(s);if(u!==null)return r+u+s.length}let d=n.slice(t,Math.min(n.length-a,t+l));if(d.length===l){let u=o(d);if(u!==null)return r+u}}return null}exports.a=dr;exports.b=pr;exports.c=cr;
1
+ 'use strict';var chunkDCILO4XD_cjs=require('./chunk-DCILO4XD.cjs');var K=new Set(["document","hdr","ftr","footnotes","endnotes"]),rr=24,H=512,z=chunkDCILO4XD_cjs.ub(rr);function G(t){let n=t.root;return n.namespaceUri===chunkDCILO4XD_cjs.pa&&K.has(n.localName)}function tr(t){let n=[],e=r=>{if(r.kind!=="textValue"){r.namespaceUri===chunkDCILO4XD_cjs.pa&&r.localName==="p"&&n.push(r);for(let a of r.children)e(a);}};return e(t.root),n}function X(t){let n=chunkDCILO4XD_cjs.Eb(t);let e=[],r=new Set;for(let a of tr(n)){let i=chunkDCILO4XD_cjs.wb(a);if(!i||!chunkDCILO4XD_cjs.vb(i))continue;let o=i.toUpperCase();if(r.has(o))continue;r.add(o);let l=chunkDCILO4XD_cjs.Jm(n,a.id);l!==null&&e.push(Object.freeze({paragraphId:o,nodeId:a.id,text:l}));}return Object.freeze(e)}function er(t){let n=z.get(t.root);if(n)return n;let e=W(t,"byParagraphId");return z.set(t.root,e),e}function W(t,n){let e=chunkDCILO4XD_cjs.Eb(t);let r=new Map,a=new Set,i=o=>{if(o.kind!=="textValue"){if(o.namespaceUri===chunkDCILO4XD_cjs.pa&&o.localName==="p"){let l=chunkDCILO4XD_cjs.wb(o);if(l&&chunkDCILO4XD_cjs.vb(l)){let s=l.toUpperCase();a.has(s)||(a.add(s),o.kind==="paragraph"&&(n==="byParagraphId"?r.set(s,o.id):r.set(o.id,s)));}}for(let l of o.children)i(l);}};return i(e.root),r}function V(t,n){if(t.length!==n.length)return false;for(let e=0;e<t.length;e+=1)if(t[e].root!==n[e])return false;return true}function $(t){let n=new Map,e=null,r=(o,l,s)=>{for(n.delete(o),n.set(o,{partName:l.name,root:l.root,nodeId:s});n.size>H;){let d=n.keys().next();if(d.done)break;n.delete(d.value);}},a=(o,l)=>{let s=n.get(o);if(!s)return null;let d=l.find(k=>k.name===s.partName);if(!d)return null;if(d.root===s.root)return {part:d,nodeId:s.nodeId};let u=chunkDCILO4XD_cjs.eb(d,s.nodeId);if(!u||u.kind!=="paragraph")return null;let x=chunkDCILO4XD_cjs.wb(u);return !x||x.toUpperCase()!==o?null:(r(o,d,s.nodeId),{part:d,nodeId:s.nodeId})};return Object.assign(o=>{let l=t(),s=a(o,l);if(s)return s;if(e&&e.ids.has(o)&&V(l,e.roots))return null;for(let d of l){let u=er(d).get(o);if(u!==void 0)return r(o,d,u),{part:d,nodeId:u}}return (!e||!V(l,e.roots))&&(e={roots:l.map(d=>d.root),ids:new Set}),e.ids.size<H&&e.ids.add(o),null},{forgetIds(o){for(let{paragraphId:l,nodeId:s}of o)n.get(l)?.nodeId!==s&&n.delete(l);},forgetAll(){n.clear();},hasHints(){return n.size>0}})}function Y(t,n,e){if(!t.hasHints())return;let r=[...e.dirty,...e.created];if(e.impact!=="text-local"||r.length===0)return t.forgetAll();let a=[];for(let i of r){let o=n.find(d=>i.startsWith(`${d.name}#`)),l=o?chunkDCILO4XD_cjs.eb(o,i):null,s=l?.kind==="paragraph"?chunkDCILO4XD_cjs.wb(l):null;if(!s)return t.forgetAll();a.push({paragraphId:s.toUpperCase(),nodeId:i});}t.forgetIds(a);}function q(t){let n=null;return e=>{let r=t();n?.root!==r.root&&(n={root:r.root,byNodeId:W(r,"byNodeId")});let a=n.byNodeId.get(e);if(a===void 0)return null;let i=chunkDCILO4XD_cjs.Jm(r,e);return i===null?null:Object.freeze({paragraphId:a,nodeId:e,text:i})}}function Z(t,n){return chunkDCILO4XD_cjs.Wa(t,n)}var ar=Object.freeze({kind:"body"}),ir=1e6;function A(t,n){if(n<=0||n>=t.length)return false;let e=t.charCodeAt(n-1),r=t.charCodeAt(n);return e>=55296&&e<=56319&&r>=56320&&r<=57343}function lr(t,n,e){if(n===e)return [];let r=0,a=Math.min(n.length,e.length);for(;r<a&&n.charCodeAt(r)===e.charCodeAt(r);)r+=1;for(;r>0&&(A(n,r)||A(e,r));)r-=1;let i=0;for(;i<n.length-r&&i<e.length-r&&n.charCodeAt(n.length-i-1)===e.charCodeAt(e.length-i-1);)i+=1;for(;i>0&&(A(n,n.length-i)||A(e,e.length-i));)i-=1;let o=n.length-r-i,l=e.slice(r,e.length-i),s=[];return o>0&&s.push({op:"deleteText",paragraphId:t,start:r,end:r+o}),l.length>0&&s.push({op:"insertText",paragraphId:t,offset:r,text:l}),Object.freeze(s)}function sr(t){let n=r=>!!r&&r.kind!=="textValue"&&r.namespaceUri===chunkDCILO4XD_cjs.pa&&r.localName==="t"&&r.attributes.every(a=>a.namespaceUri===chunkDCILO4XD_cjs.qa&&a.localName==="space")&&r.children.every(a=>a.kind==="textValue"),e=[];for(let r of t){let a=e.at(-1);if(!n(a)||!n(r)){e.push(r);continue}let i=a.children.map(o=>o.kind==="textValue"?o.value:"").join("")+r.children.map(o=>o.kind==="textValue"?o.value:"").join("");e[e.length-1]={...a,attributes:/^\s|\s$/.test(i)?[{kind:"xmlSpace",namespaceUri:chunkDCILO4XD_cjs.qa,localName:"space",prefix:"xml",value:"preserve"}]:[],children:[{id:a.children[0]?.id??`${a.id}/text`,kind:"textValue",value:i}]};}return e}function F(t){if(t.kind==="textValue")return t;let n=false,e=t.children.map(r=>{let a=F(r);return a!==r&&(n=true),a});if(t.namespaceUri===chunkDCILO4XD_cjs.pa&&t.localName==="r"){let r=sr(e);(r.length!==e.length||r.some((a,i)=>a!==e[i]))&&(e=[...r],n=true);}return n?{...t,children:e}:t}function dr(t,n,e){let r=t.parts.get(n);if(!r)return t;let a=false,i=new Set;for(let o of e)(o.op==="insertText"||o.op==="deleteText")&&!o.revision&&i.add(o.paragraphId);for(let o of i){let l=chunkDCILO4XD_cjs.eb(r,o);if(!l||l.kind==="textValue")continue;let s=F(l);if(s===l)continue;let d=chunkDCILO4XD_cjs.kb(r,o,s,{deferValidation:true});d.ok&&(r=d.part,a=true);}return a?chunkDCILO4XD_cjs.rg(t,r):t}function pr(t,n){let e=n.documentId.trim();if(e.length===0||e.length>256)throw new TypeError("documentId must contain 1 to 256 characters");let r=()=>X(t.bodyStore().part),a,i=()=>{let p=t.bodyStore().part,c=t.currentPackage();if(a?.pkg===c&&a.body===p)return a.parts;let g=[p];for(let m of c.parts.values())m===p||!G(m)||g.push(m);return a={pkg:c,body:p,parts:Object.freeze(g)},a.parts},o=$(i),l=t.packageRevision,s=t.lastModelChange,d=()=>{let p=t.packageRevision,c=t.lastModelChange;p===l&&c===s||(p===l+1&&c!==null&&c!==s?Y(o,i(),c):o.forgetAll(),l=p,s=c);},u=q(()=>t.bodyStore().part),x=(p,c)=>{if(p.length===0)return {ok:true,changed:false};let g=r(),m=new Set,I=[];for(let h of p){if(typeof h.text!="string"||h.text.length>ir)return {ok:false,reason:"collaboration-text-limit"};if(typeof h.paragraphId!="string"||h.paragraphId.length===0||h.paragraphId.length>256)return {ok:false,reason:"unknown-paragraph-id"};let f=h.paragraphId.toUpperCase();if(m.has(f))return {ok:false,reason:"duplicate-paragraph-id"};m.add(f);let D=g.filter(Q=>Q.paragraphId===f);if(D.length!==1)return {ok:false,reason:"unknown-paragraph-id"};let w=D[0];I.push(...lr(w.nodeId,w.text,h.text));}if(I.length===0)return {ok:true,changed:false};let v=t.transact(ar,h=>{for(let f of I)h.apply(f);h.applyPackage(f=>dr(f,f.mainDocumentPart,I));},{origin:c.origin,actorId:c.actorId,operationId:c.operationId,recordsHistory:false});return v.ok?{ok:true,changed:v.change!==null}:{ok:false,reason:v.detail??v.reason}},k={documentId:e,interactive:n.interactive===true,paragraphs:r,paragraphByNodeId:u,paragraphTextOf(p){for(let c of i()){let g=chunkDCILO4XD_cjs.Jm(c,p);if(g!==null)return g}return null},paragraphByStableId(p){let c=p.toUpperCase();d();let g=o(c);if(!g)return null;let m=chunkDCILO4XD_cjs.Jm(g.part,g.nodeId);return m===null?null:Object.freeze({paragraphId:c,nodeId:g.nodeId,text:m})},applyParagraphText(p,c,g){return x([{paragraphId:p,text:c}],g)},applyParagraphTexts:x,applyRemotePackage(p,c){let g=t.publishRemotePackage(p,c);return g.ok?{ok:true,changed:g.change!==null}:{ok:false,reason:g.detail??g.reason}},revision:()=>t.packageRevision,subscribe:p=>t.subscribe(p),observePrimitiveJournal:p=>Z(t,p),hasPendingJournals:()=>chunkDCILO4XD_cjs.Sa(t),flushPendingJournals:()=>{chunkDCILO4XD_cjs.Ta(t);},save:()=>chunkDCILO4XD_cjs.ng(t.currentPackage()),binaryPart(p){let c=t.currentPackage();return c.partBytes.get(p)??c.partBytes.get(p.startsWith("/")?p.slice(1):`/${p}`)??null}};return Object.freeze(k)}function cr(t,n,e){if(n===e||t>n.length)return Math.min(t,e.length);let r=0;for(;r<n.length&&r<e.length&&n[r]===e[r];)r+=1;let a=0;for(;a<n.length-r&&a<e.length-r&&n[n.length-1-a]===e[e.length-1-a];)a+=1;if(t<=r)return Math.min(t,e.length);if(t>n.length-a)return Math.min(e.length,t+e.length-n.length);let i=gr(n,e,r,a),o=i.offsets.get(t);return o===void 0&&(o=(i.table?fr(i.table,t,n,e,r):null)??Pr(t,n,e,r,a)??r,i.offsets.set(t,o)),o}var b=[],ur=16;function gr(t,n,e,r){let a=b.findIndex(o=>o.before===t&&o.after===n);if(a>=0){let[o]=b.splice(a,1);return b.push(o),o}let i={before:t,after:n,table:mr(t,n,e,r),offsets:new Map};return b.length>=ur&&b.shift(),b.push(i),i}var hr=1<<18;function mr(t,n,e,r){let a=t.length-r-e,i=n.length-r-e;if(a*i>hr)return null;let o=i+1,l=new Uint32Array((a+1)*o);for(let s=a-1;s>=0;s-=1)for(let d=i-1;d>=0;d-=1)l[s*o+d]=t[e+s]===n[e+d]?l[(s+1)*o+d+1]+1:Math.max(l[(s+1)*o+d],l[s*o+d+1]);return {lengths:l,width:o,columns:i}}function fr(t,n,e,r,a){let{lengths:i,width:o,columns:l}=t,s=n-a,d=0,u=0;for(;d<s;)u<l&&e[a+d]===r[a+u]?(d+=1,u+=1):u>=l||i[(d+1)*o+u]>=i[d*o+u+1]?d+=1:u+=1;return a+u}var yr=[32,16,8,4];function Pr(t,n,e,r,a){let i=e.slice(r,e.length-a),o=l=>{let s=i.indexOf(l);return s>=0&&i.indexOf(l,s+1)<0?s:null};for(let l of yr){let s=n.slice(Math.max(r,t-l),t);if(s.length===l){let u=o(s);if(u!==null)return r+u+s.length}let d=n.slice(t,Math.min(n.length-a,t+l));if(d.length===l){let u=o(d);if(u!==null)return r+u}}return null}exports.a=dr;exports.b=pr;exports.c=cr;