revise 2.1.0 → 2.2.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 (112) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/assets/historyMaterializeWorker-B51R08XN.js +612 -0
  3. package/backend.d.ts +8 -2
  4. package/backend.js +1 -1
  5. package/chunks/AgentPageRenderer-CH8kSTJn.js +1 -0
  6. package/chunks/AgentPageRenderer-P23XVguo.js +1 -0
  7. package/chunks/AttachmentDocumentImporter-B1WOaa7d.js +1 -0
  8. package/chunks/AttachmentDocumentImporter-CT_PJp_e.js +1 -0
  9. package/chunks/{BidiText-C8PBPSQY.js → BidiText-Swm5fl9J.js} +74 -74
  10. package/chunks/DocumentMutator-btiDK57e.js +31 -0
  11. package/chunks/{DocumentScrubber-DS4LFDKS.js → DocumentScrubber-CMPfm_HF.js} +1 -1
  12. package/chunks/{DocumentScrubber-COPepQKE.js → DocumentScrubber-Cm2kH8op.js} +1 -1
  13. package/chunks/{DocumentScrubber-Cf_QqHhF.js → DocumentScrubber-bJoKijol.js} +1 -1
  14. package/chunks/DocumentStylesheet-DreoD7sD.js +7 -0
  15. package/chunks/DocxConverter-BcVG-p5K.js +13 -0
  16. package/chunks/DocxConverter-D2bO5RE-.js +1125 -0
  17. package/chunks/DocxConverter-haCfRuWb.js +13 -0
  18. package/chunks/{DocxGraft-Ba63IRP4.js → DocxGraft-BRKh4mHQ.js} +1 -1
  19. package/chunks/{DocxGraft-DjERgl-z.js → DocxGraft-BxSQtl12.js} +2 -2
  20. package/chunks/{DocxGraft-cYlmw4Ab.js → DocxGraft-C9MBQCnf.js} +1 -1
  21. package/chunks/FileImporter-CszqRfVU.js +1 -0
  22. package/chunks/FileImporter-DObFoCCn.js +1 -0
  23. package/chunks/{HtmlConverter-Sd9t49vH.js → HtmlConverter-DwXB4IDh.js} +12 -12
  24. package/chunks/{MarkdownConverter-BdJgh8xt.js → MarkdownConverter-CUC8GgsS.js} +1 -1
  25. package/chunks/MathRenderer-DT6GyJXb.js +68 -0
  26. package/chunks/OdtConverter-7h9HHMpL.js +125 -0
  27. package/chunks/OdtConverter-Ct4qypJk.js +6 -0
  28. package/chunks/OdtConverter-DFl__sJc.js +6 -0
  29. package/chunks/OfficeImportShared-BY6FdZ8d.js +1 -0
  30. package/chunks/OfficeImportShared-BrZoDM0j.js +30 -0
  31. package/chunks/OfficeImportShared-Bvm-mOyj.js +1 -0
  32. package/chunks/PdfConverter-1wyvoT7X.js +21 -0
  33. package/chunks/PdfConverter-BAoEHILo.js +21 -0
  34. package/chunks/PdfConverter-CKEvFj11.js +448 -0
  35. package/chunks/{PdfImportService-CQCgsRX1.js → PdfImportService-BhLPp5uG.js} +2 -2
  36. package/chunks/{PdfImportService-xl7fstr-.js → PdfImportService-xbzrN__L.js} +2 -2
  37. package/chunks/RtfConverter-Bxn-enp8.js +15 -0
  38. package/chunks/RtfConverter-LZPzBDSr.js +15 -0
  39. package/chunks/RtfConverter-_bacXqr1.js +186 -0
  40. package/chunks/{TableBorders-Cdkc62cX.js → TableBorders-CwnF3jvH.js} +1 -1
  41. package/chunks/{TxtConverter-C-oiFUAp.js → TxtConverter-C7FOwHpH.js} +1 -1
  42. package/chunks/XmlConverter-7oo8oeQB.js +2 -0
  43. package/chunks/XmlConverter-DGORHJcZ.js +96 -0
  44. package/chunks/XmlConverter-DeLHReK_.js +2 -0
  45. package/chunks/ar-ComXvtmh.js +13 -0
  46. package/chunks/backend-DecaBz-I.js +490 -0
  47. package/chunks/base64-sSPOzq-u.js +198 -0
  48. package/chunks/{browser-module-CYGCfEyx.js → browser-module-Dj5o3kuL.js} +1 -1
  49. package/chunks/{browser-module-DgvTMhpA.js → browser-module-UuM_O36W.js} +1 -1
  50. package/chunks/{capture-BAJ2in5p.js → capture-1btcWcPF.js} +1 -1
  51. package/chunks/{carrier-C5VZRMxZ.js → carrier-DQeng6yq.js} +1 -1
  52. package/chunks/de-BkbpIKxx.js +13 -0
  53. package/chunks/es-CKkXujOF.js +13 -0
  54. package/chunks/fil-piIHMc8F.js +13 -0
  55. package/chunks/{footnoteFlatten-Bekh8ZfM.js → footnoteFlatten-DUQticYy.js} +1 -1
  56. package/chunks/fr-DuA8qLje.js +13 -0
  57. package/chunks/{graftExport-CRRm1Oe_.js → graftExport-CYnStOdU.js} +1 -1
  58. package/chunks/index-2TBhRkX7.js +387 -0
  59. package/chunks/{index-B1idHquf.js → index-Bf14eTEW.js} +231 -229
  60. package/chunks/index-BwcX_r62.js +387 -0
  61. package/chunks/{index.es-Bwt05m_b.js → index.es-CI7cDExj.js} +1 -1
  62. package/chunks/{index.es-DAQD57G4.js → index.es-DHpGt6Y5.js} +1 -1
  63. package/chunks/ja-DgrSs555.js +13 -0
  64. package/chunks/{jspdf.es.min-DlTF8uTw.js → jspdf.es.min--GshOuIm.js} +1 -1
  65. package/chunks/{jspdf.es.min-CnNRolk9.js → jspdf.es.min-DurJZ1zW.js} +1 -1
  66. package/chunks/pseudoLocale-BoYTjmiK.js +1 -0
  67. package/chunks/pseudoLocale-DG2NnZmz.js +1 -0
  68. package/chunks/serverDocumentSession-CJ1EH3Tp.js +15 -0
  69. package/chunks/{signatures-CBF7NZUy.js → signatures-Bwt_OGik.js} +1 -1
  70. package/chunks/suggestionAuthorship-B-IuLQlE.js +1 -0
  71. package/chunks/zh-9OF3SWWO.js +13 -0
  72. package/full.js +1 -1
  73. package/index.d.ts +13 -5
  74. package/index.js +1 -1
  75. package/package.json +1 -1
  76. package/root.js +2 -2
  77. package/style.css +1 -1
  78. package/assets/historyMaterializeWorker-C4uxcZEh.js +0 -607
  79. package/chunks/AgentPageRenderer-BFB0arQL.js +0 -1
  80. package/chunks/AgentPageRenderer-Dn6SaRjW.js +0 -1
  81. package/chunks/AttachmentDocumentImporter-BHDJAdky.js +0 -1
  82. package/chunks/AttachmentDocumentImporter-CxOZqzt1.js +0 -1
  83. package/chunks/DocumentMutator-4vBJQ74L.js +0 -31
  84. package/chunks/DocumentStylesheet-byN5dtC6.js +0 -7
  85. package/chunks/DocxConverter-BCEB7jWY.js +0 -1083
  86. package/chunks/DocxConverter-C3NflpDr.js +0 -11
  87. package/chunks/DocxConverter-D9ZNn4nX.js +0 -11
  88. package/chunks/FileImporter-CHXj9sNX.js +0 -1
  89. package/chunks/FileImporter-DetvRoJc.js +0 -1
  90. package/chunks/MathRenderer-B0Y1h1JU.js +0 -62
  91. package/chunks/OdtConverter-BKtyx012.js +0 -1
  92. package/chunks/OdtConverter-Ce9j8PRt.js +0 -1
  93. package/chunks/OdtConverter-D709qfYb.js +0 -31
  94. package/chunks/PdfConverter-BA8XLTAM.js +0 -21
  95. package/chunks/PdfConverter-CkDClffR.js +0 -438
  96. package/chunks/PdfConverter-CxLxd-LJ.js +0 -21
  97. package/chunks/RtfConverter-BZOnMUGH.js +0 -14
  98. package/chunks/RtfConverter-Bs81AfXt.js +0 -14
  99. package/chunks/RtfConverter-DfuE5olb.js +0 -45
  100. package/chunks/XmlConverter-C0FnrVYk.js +0 -70
  101. package/chunks/XmlConverter-CQa8baOF.js +0 -2
  102. package/chunks/XmlConverter-DjEYaIyf.js +0 -2
  103. package/chunks/ar-BdmGnaKI.js +0 -14
  104. package/chunks/backend-BIhAX-Gi.js +0 -484
  105. package/chunks/base64-Qx0OzT4p.js +0 -196
  106. package/chunks/de-DldIXRFC.js +0 -14
  107. package/chunks/es-CnyKlSPK.js +0 -14
  108. package/chunks/index-C-4H81OE.js +0 -378
  109. package/chunks/index-iZC8xN0t.js +0 -378
  110. package/chunks/pseudoLocale-BoJwIubw.js +0 -1
  111. package/chunks/pseudoLocale-DWAm7Dpa.js +0 -1
  112. package/chunks/serverDocumentSession-DASrQAbW.js +0 -15
@@ -0,0 +1,612 @@
1
+ (function(){"use strict";const U=()=>new Map,tn=e=>{const t=U();return e.forEach((n,r)=>{t.set(r,n)}),t},B=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},ui=(e,t)=>{const n=[];for(const[
2
+ r,s]of e)n.push(t(s,r));return n},gi=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},Wt=()=>new Set,en=e=>e[e.length-1],fi=(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n])},ft=Array.from,pi=(e,t)=>{
3
+ for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},mi=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},nn=Array.isArray;class rn{constructor(){this._observers=U()}on(t,n){
4
+ return B(this._observers,t,Wt).add(n),n}once(t,n){const r=(...s)=>{this.off(t,r),n(...s)};this.on(t,r)}off(t,n){const r=this._observers.get(t);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(
5
+ t))}emit(t,n){return ft((this._observers.get(t)||U()).values()).forEach(r=>r(...n))}destroy(){this._observers=U()}}const pt=Math.floor,Ce=Math.abs,Zn=(e,t)=>e<t?e:t,Ct=(e,t)=>e>t?e:t,Qn=e=>e!==0?e<0:1/
6
+ e<0,tr=1,er=2,sn=4,on=8,ne=32,ct=64,F=128,bi=1<<29,Ee=31,cn=63,Et=127,yi=2147483647,nr=Number.MAX_SAFE_INTEGER,wi=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&pt(e)===e),ki=e=>e.toLowerCase(),
7
+ Si=/^\s*/g,_i=e=>e.replace(Si,""),vi=/([A-Z])/g,rr=(e,t)=>_i(e.replace(vi,n=>`${t}${ki(n)}`)),xi=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let s=0;s<n;s++)r[s]=t.codePointAt(
8
+ s);return r},re=typeof TextEncoder<"u"?new TextEncoder:null,Ci=re?e=>re.encode(e):xi;let se=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});se&&se.decode(new Uint8Array).length===
9
+ 1&&(se=null);const Ei=(e,t)=>mi(t,()=>e).join("");class ie{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const Jt=()=>new ie,Ai=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)
10
+ t+=e.bufs[n].length;return t},H=e=>{const t=new Uint8Array(Ai(e));let n=0;for(let r=0;r<e.bufs.length;r++){const s=e.bufs[r];t.set(s,n),n+=s.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),
11
+ n),t},Di=(e,t)=>{const n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(Ct(n,t)*2),e.cpos=0)},N=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.
12
+ push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},oe=N,m=(e,t)=>{for(;t>Et;)N(e,F|Et&t),t=pt(t/128);N(e,Et&t)},Ae=(e,t)=>{const n=Qn(t);for(n&&(t=-t),N(e,(t>cn?F:0)|(n?ct:0)|cn&t),
13
+ t=pt(t/64);t>0;)N(e,(t>Et?F:0)|Et&t),t=pt(t/128)},ln=new Uint8Array(3e4),Pi=ln.length/3,Ni=(e,t)=>{if(t.length<Pi){const n=re.encodeInto(t,ln).written||0;m(e,n);for(let r=0;r<n;r++)N(e,ln[r])}else z(e,
14
+ Ci(t))},Ii=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;m(e,r);for(let s=0;s<r;s++)N(e,n.codePointAt(s))},At=re&&re.encodeInto?Ni:Ii,Mi=(e,t)=>ce(e,H(t)),ce=(e,t)=>{const n=e.cbuf.length,
15
+ r=e.cpos,s=Zn(n-r,t.length),i=t.length-s;e.cbuf.set(t.subarray(0,s),r),e.cpos+=s,i>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Ct(n*2,i)),e.cbuf.set(t.subarray(s)),e.cpos=i)},z=(e,t)=>{m(e,t.byteLength),
16
+ ce(e,t)},an=(e,t)=>{Di(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},Ti=(e,t)=>an(e,4).setFloat32(0,t,!1),Oi=(e,t)=>an(e,8).setFloat64(0,t,!1),Ui=(e,t)=>an(e,8).setBigInt64(0,t,
17
+ !1),sr=new DataView(new ArrayBuffer(4)),Fi=e=>(sr.setFloat32(0,e),sr.getFloat32(0)===e),le=(e,t)=>{switch(typeof t){case"string":N(e,119),At(e,t);break;case"number":wi(t)&&Ce(t)<=yi?(N(e,125),Ae(e,t)):
18
+ Fi(t)?(N(e,124),Ti(e,t)):(N(e,123),Oi(e,t));break;case"bigint":N(e,122),Ui(e,t);break;case"object":if(t===null)N(e,126);else if(nn(t)){N(e,117),m(e,t.length);for(let n=0;n<t.length;n++)le(e,t[n])}else if(t instanceof
19
+ Uint8Array)N(e,116),z(e,t);else{N(e,118);const n=Object.keys(t);m(e,n.length);for(let r=0;r<n.length;r++){const s=n[r];At(e,s),le(e,t[s])}}break;case"boolean":N(e,t?120:121);break;default:N(e,127)}};class ir extends ie{constructor(t){
20
+ super(),this.w=t,this.s=null,this.count=0}write(t){this.s===t?this.count++:(this.count>0&&m(this,this.count-1),this.count=1,this.w(this,t),this.s=t)}}const or=e=>{e.count>0&&(Ae(e.encoder,e.count===1?
21
+ e.s:-e.s),e.count>1&&m(e.encoder,e.count-2))};class De{constructor(){this.encoder=new ie,this.s=0,this.count=0}write(t){this.s===t?this.count++:(or(this),this.count=1,this.s=t)}toUint8Array(){return or(
22
+ this),H(this.encoder)}}const cr=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);Ae(e.encoder,t),e.count>1&&m(e.encoder,e.count-2)}};class dn{constructor(){this.encoder=new ie,this.s=0,this.count=
23
+ 0,this.diff=0}write(t){this.diff===t-this.s?(this.s=t,this.count++):(cr(this),this.count=1,this.diff=t-this.s,this.s=t)}toUint8Array(){return cr(this),H(this.encoder)}}class Li{constructor(){this.sarr=
24
+ [],this.s="",this.lensE=new De}write(t){this.s+=t,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(t.length)}toUint8Array(){const t=new ie;return this.sarr.push(this.s),this.s="",
25
+ At(t,this.sarr.join("")),ce(t,this.lensE.toUint8Array()),H(t)}}const mt=e=>new Error(e),tt=()=>{throw mt("Method unimplemented")},j=()=>{throw mt("Unexpected case")},lr=mt("Unexpected end of array"),ar=mt(
26
+ "Integer out of Range");class Pe{constructor(t){this.arr=t,this.pos=0}}const T=e=>new Pe(e),dr=e=>e.pos!==e.arr.length,Ri=(e,t)=>{const n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.
27
+ pos+=t,n},W=e=>Ri(e,S(e)),Gt=e=>e.arr[e.pos++],S=e=>{let t=0,n=1;const r=e.arr.length;for(;e.pos<r;){const s=e.arr[e.pos++];if(t=t+(s&Et)*n,n*=128,s<F)return t;if(t>nr)throw ar}throw lr},Ne=e=>{let t=e.
28
+ arr[e.pos++],n=t&cn,r=64;const s=(t&ct)>0?-1:1;if((t&F)===0)return s*n;const i=e.arr.length;for(;e.pos<i;){if(t=e.arr[e.pos++],n=n+(t&Et)*r,r*=128,t<F)return s*n;if(n>nr)throw ar}throw lr},Dt=se?e=>se.
29
+ decode(W(e)):e=>{let t=S(e);if(t===0)return"";{let n=String.fromCodePoint(Gt(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(Gt(e));else for(;t>0;){const r=t<1e4?t:1e4,s=e.arr.subarray(e.pos,e.pos+r);
30
+ e.pos+=r,n+=String.fromCodePoint.apply(null,s),t-=r}return decodeURIComponent(escape(n))}},hn=(e,t)=>{const n=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,n},ji=[e=>{},e=>null,Ne,
31
+ e=>hn(e,4).getFloat32(0,!1),e=>hn(e,8).getFloat64(0,!1),e=>hn(e,8).getBigInt64(0,!1),e=>!1,e=>!0,Dt,e=>{const t=S(e),n={};for(let r=0;r<t;r++){const s=Dt(e);n[s]=ae(e)}return n},e=>{const t=S(e),n=[];
32
+ for(let r=0;r<t;r++)n.push(ae(e));return n},W],ae=e=>ji[127-Gt(e)](e);class hr extends Pe{constructor(t,n){super(t),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(
33
+ this),dr(this)?this.count=S(this)+1:this.count=-1),this.count--,this.s}}class Ie extends Pe{constructor(t){super(t),this.s=0,this.count=0}read(){if(this.count===0){this.s=Ne(this);const t=Qn(this.s);this.
34
+ count=1,t&&(this.s=-this.s,this.count=S(this)+2)}return this.count--,this.s}}class un extends Pe{constructor(t){super(t),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const t=Ne(this),n=t&
35
+ 1;this.diff=pt(t/2),this.count=1,n&&(this.count=S(this)+2)}return this.s+=this.diff,this.count--,this.s}}class Vi{constructor(t){this.decoder=new Ie(t),this.str=Dt(this.decoder),this.spos=0}read(){const t=this.
36
+ spos+this.decoder.read(),n=this.str.slice(this.spos,t);return this.spos=t,n}}const Bi=crypto.getRandomValues.bind(crypto),ur=()=>Bi(new Uint32Array(1))[0],zi="10000000-1000-4000-8000"+-1e11,Wi=()=>zi.
37
+ replace(/[018]/g,e=>(e^ur()&15>>e/4).toString(16)),Ji=Date.now,gr=e=>new Promise(e);Promise.all.bind(Promise);const Gi=e=>e===void 0?null:e;class Hi{constructor(){this.map=new Map}setItem(t,n){this.map.
38
+ set(t,n)}getItem(t){return this.map.get(t)}}let fr=new Hi,Xi=!0;try{typeof localStorage<"u"&&localStorage&&(fr=localStorage,Xi=!1)}catch{}const qi=fr,$i=Object.assign,Ki=Object.keys,Yi=(e,t)=>{for(const n in e)
39
+ t(e[n],n)},pr=e=>Ki(e).length,Zi=e=>{for(const t in e)return!1;return!0},Qi=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},to=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),eo=(e,t)=>e===
40
+ t||pr(e)===pr(t)&&Qi(e,(n,r)=>(n!==void 0||to(t,r))&&t[r]===n),no=Object.freeze,mr=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&mr(e[t])}return no(e)},gn=(e,t,n=0)=>{
41
+ try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&gn(e,t,n+1)}},br=e=>e,ro=(e,t)=>t.includes(e),de=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.
42
+ toString.call(typeof process<"u"?process:0)==="[object process]";let et;const so=()=>{if(et===void 0)if(de){et=U();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==
43
+ null&&et.set(t,""),t=r):t!==null&&(et.set(t,r),t=null)}t!==null&&et.set(t,"")}else typeof location=="object"?(et=U(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.
44
+ split("=");et.set(`--${rr(t,"-")}`,n),et.set(`-${rr(t,"-")}`,n)}})):et=U();return et},fn=e=>so().has(e),Me=e=>Gi(de?process.env[e.toUpperCase().replaceAll("-","_")]:qi.getItem(e)),yr=e=>fn("--"+e)||Me(
45
+ e)!==null;yr("production");const io=de&&ro(process.env.FORCE_COLOR,["true","1","2"])||!fn("--no-colors")&&!yr("no-color")&&(!de||process.stdout.isTTY)&&(!de||fn("--color")||Me("COLORTERM")!==null||(Me(
46
+ "TERM")||"").includes("color")),oo=e=>new Uint8Array(e),co=e=>{const t=oo(e.byteLength);return t.set(e),t};class lo{constructor(t,n){this.left=t,this.right=n}}const lt=(e,t)=>new lo(e,t);typeof DOMParser<
47
+ "u"&&new DOMParser;const ao=e=>ui(e,(t,n)=>`${n}:${t};`).join(""),at=Symbol,wr=at(),kr=at(),ho=at(),uo=at(),go=at(),Sr=at(),fo=at(),pn=at(),po=at(),mo=e=>{e.length===1&&e[0]?.constructor===Function&&(e=
48
+ e[0]());const t=[],n=[];let r=0;for(;r<e.length;r++){const s=e[r];if(s===void 0)break;if(s.constructor===String||s.constructor===Number)t.push(s);else if(s.constructor===Object)break}for(r>0&&n.push(t.
49
+ join(""));r<e.length;r++){const s=e[r];s instanceof Symbol||n.push(s)}return n},bo={[wr]:lt("font-weight","bold"),[kr]:lt("font-weight","normal"),[ho]:lt("color","blue"),[go]:lt("color","green"),[uo]:lt(
50
+ "color","grey"),[Sr]:lt("color","red"),[fo]:lt("color","purple"),[pn]:lt("color","orange"),[po]:lt("color","black")},_r=io?e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[],r=U();
51
+ let s=[],i=0;for(;i<e.length;i++){const o=e[i],c=bo[o];if(c!==void 0)r.set(c.left,c.right);else{if(o===void 0)break;if(o.constructor===String||o.constructor===Number){const l=ao(r);i>0||l.length>0?(t.
52
+ push("%c"+o),n.push(l)):t.push(o)}else break}}for(i>0&&(s=n,s.unshift(t.join("")));i<e.length;i++){const o=e[i];o instanceof Symbol||s.push(o)}return s}:mo,mn=(...e)=>{[..._r(e)],xr.forEach(t=>t.print(
53
+ e))},vr=(...e)=>{console.warn(..._r(e)),e.unshift(pn),xr.forEach(t=>t.print(e))},xr=Wt(),Cr=e=>({[Symbol.iterator](){return this},next:e}),yo=(e,t)=>Cr(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));
54
+ return n}),bn=(e,t)=>Cr(()=>{const{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}});class wo extends rn{constructor(t,n){super(),this.doc=t,this.awareness=n}}class yn{constructor(t,n){this.
55
+ clock=t,this.len=n}}class Ht{constructor(){this.clients=new Map}}const Pt=(e,t,n)=>t.clients.forEach((r,s)=>{const i=e.doc.store.clients.get(s);if(i!=null){const o=i[i.length-1],c=o.id.clock+o.length;
56
+ for(let l=0,d=r[l];l<r.length&&d.clock<c;d=r[++l])Jr(e,i,d.clock,d.len,n)}}),ko=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){const s=pt((n+r)/2),i=e[s],o=i.clock;if(o<=t){if(t<o+i.len)return s;n=s+1}else r=
57
+ s-1}return null},Nt=(e,t)=>{const n=e.clients.get(t.client);return n!==void 0&&ko(n,t.clock)!==null},wn=e=>{e.clients.forEach(t=>{t.sort((s,i)=>s.clock-i.clock);let n,r;for(n=1,r=1;n<t.length;n++){const s=t[r-
58
+ 1],i=t[n];s.clock+s.len>=i.clock?s.len=Ct(s.len,i.clock+i.len-s.clock):(r<n&&(t[r]=i),r++)}t.length=r})},It=e=>{const t=new Ht;for(let n=0;n<e.length;n++)e[n].clients.forEach((r,s)=>{if(!t.clients.has(
59
+ s)){const i=r.slice();for(let o=n+1;o<e.length;o++)fi(i,e[o].clients.get(s)||[]);t.clients.set(s,i)}});return wn(t),t},he=(e,t,n,r)=>{B(e.clients,t,()=>[]).push(new yn(n,r))},Te=()=>new Ht,kn=e=>{const t=Te();
60
+ return e.clients.forEach((n,r)=>{const s=[];for(let i=0;i<n.length;i++){const o=n[i];if(o.deleted){const c=o.id.clock;let l=o.length;if(i+1<n.length)for(let d=n[i+1];i+1<n.length&&d.deleted;d=n[++i+1])
61
+ l+=d.length;s.push(new yn(c,l))}}s.length>0&&t.clients.set(r,s)}),t},nt=(e,t)=>{m(e.restEncoder,t.clients.size),ft(t.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{e.resetDsCurVal(),m(e.restEncoder,
62
+ n);const s=r.length;m(e.restEncoder,s);for(let i=0;i<s;i++){const o=r[i];e.writeDsClock(o.clock),e.writeDsLen(o.len)}})},dt=e=>{const t=new Ht,n=S(e.restDecoder);for(let r=0;r<n;r++){e.resetDsCurVal();
63
+ const s=S(e.restDecoder),i=S(e.restDecoder);if(i>0){const o=B(t.clients,s,()=>[]);for(let c=0;c<i;c++)o.push(new yn(e.readDsClock(),e.readDsLen()))}}return t},Er=(e,t,n)=>{const r=new Ht,s=S(e.restDecoder);
64
+ for(let i=0;i<s;i++){e.resetDsCurVal();const o=S(e.restDecoder),c=S(e.restDecoder),l=n.clients.get(o)||[],d=A(n,o);for(let a=0;a<c;a++){const h=e.readDsClock(),u=h+e.readDsLen();if(h<d){d<u&&he(r,o,d,
65
+ u-d);let g=q(l,h),f=l[g];for(!f.deleted&&f.id.clock<h&&(l.splice(g+1,0,Xe(t,f,h-f.id.clock)),g++);g<l.length&&(f=l[g++],f.id.clock<u);)f.deleted||(u<f.id.clock+f.length&&l.splice(g,0,Xe(t,f,u-f.id.clock)),
66
+ f.delete(t))}else he(r,o,h,u-h)}}if(r.clients.size>0){const i=new Y;return m(i.restEncoder,0),nt(i,r),i.toUint8Array()}return null},Ar=(e,t)=>{if(e.clients.size!==t.clients.size)return!1;for(const[n,r]of e.
67
+ clients.entries()){const s=t.clients.get(n);if(s===void 0||r.length!==s.length)return!1;for(let i=0;i<r.length;i++){const o=r[i],c=s[i];if(o.clock!==c.clock||o.len!==c.len)return!1}}return!0},Dr=ur;class rt extends rn{constructor({
68
+ guid:t=Wi(),collectionid:n=null,gc:r=!0,gcFilter:s=()=>!0,meta:i=null,autoLoad:o=!1,shouldLoad:c=!0}={}){super(),this.gc=r,this.gcFilter=s,this.clientID=Dr(),this.guid=t,this.collectionid=n,this.share=
69
+ new Map,this.store=new zr,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=c,this.autoLoad=o,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.
70
+ isDestroyed=!1,this.whenLoaded=gr(d=>{this.on("load",()=>{this.isLoaded=!0,d(this)})});const l=()=>gr(d=>{const a=h=>{(h===void 0||h===!0)&&(this.off("sync",a),d())};this.on("sync",a)});this.on("sync",
71
+ d=>{d===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=d===void 0||d===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const t=this._item;t!==null&&!this.
72
+ shouldLoad&&E(t.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(ft(this.subdocs).map(t=>t.guid))}transact(t,n=null){
73
+ return E(this,t,n)}get(t,n=P){const r=B(this.share,t,()=>{const i=new n;return i._integrate(this,null),i}),s=r.constructor;if(n!==P&&s!==n)if(s===P){const i=new n;i._map=r._map,r._map.forEach(o=>{for(;o!==
74
+ null;o=o.left)o.parent=i}),i._start=r._start;for(let o=i._start;o!==null;o=o.right)o.parent=i;return i._length=r._length,this.share.set(t,i),i._integrate(this,null),i}else throw new Error(`Type with t\
75
+ he name ${t} has already been defined with a different constructor`);return r}getArray(t=""){return this.get(t,ht)}getText(t=""){return this.get(t,Ut)}getMap(t=""){return this.get(t,St)}getXmlElement(t=""){
76
+ return this.get(t,st)}getXmlFragment(t=""){return this.get(t,vt)}toJSON(){const t={};return this.share.forEach((n,r)=>{t[r]=n.toJSON()}),t}destroy(){this.isDestroyed=!0,ft(this.subdocs).forEach(n=>n.destroy());
77
+ const t=this._item;if(t!==null){this._item=null;const n=t.content;n.doc=new rt({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,E(t.parent.doc,r=>{const s=n.doc;t.deleted||r.subdocsAdded.add(s),
78
+ r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class ue{constructor(t){this.restDecoder=t}resetDsCurVal(){}readDsClock(){return S(this.restDecoder)}readDsLen(){
79
+ return S(this.restDecoder)}}class X extends ue{readLeftID(){return y(S(this.restDecoder),S(this.restDecoder))}readRightID(){return y(S(this.restDecoder),S(this.restDecoder))}readClient(){return S(this.
80
+ restDecoder)}readInfo(){return Gt(this.restDecoder)}readString(){return Dt(this.restDecoder)}readParentInfo(){return S(this.restDecoder)===1}readTypeRef(){return S(this.restDecoder)}readLen(){return S(
81
+ this.restDecoder)}readAny(){return ae(this.restDecoder)}readBuf(){return co(W(this.restDecoder))}readJSON(){return JSON.parse(Dt(this.restDecoder))}readKey(){return Dt(this.restDecoder)}}class Pr{constructor(t){
82
+ this.dsCurrVal=0,this.restDecoder=t}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=S(this.restDecoder),this.dsCurrVal}readDsLen(){const t=S(this.restDecoder)+1;return this.dsCurrVal+=
83
+ t,t}}class J extends Pr{constructor(t){super(t),this.keys=[],S(t),this.keyClockDecoder=new un(W(t)),this.clientDecoder=new Ie(W(t)),this.leftClockDecoder=new un(W(t)),this.rightClockDecoder=new un(W(t)),
84
+ this.infoDecoder=new hr(W(t),Gt),this.stringDecoder=new Vi(W(t)),this.parentInfoDecoder=new hr(W(t),Gt),this.typeRefDecoder=new Ie(W(t)),this.lenDecoder=new Ie(W(t))}readLeftID(){return new Mt(this.clientDecoder.
85
+ read(),this.leftClockDecoder.read())}readRightID(){return new Mt(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.
86
+ read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){
87
+ return ae(this.restDecoder)}readBuf(){return W(this.restDecoder)}readJSON(){return ae(this.restDecoder)}readKey(){const t=this.keyClockDecoder.read();if(t<this.keys.length)return this.keys[t];{const n=this.
88
+ stringDecoder.read();return this.keys.push(n),n}}}class Xt{constructor(){this.restEncoder=Jt()}toUint8Array(){return H(this.restEncoder)}resetDsCurVal(){}writeDsClock(t){m(this.restEncoder,t)}writeDsLen(t){
89
+ m(this.restEncoder,t)}}class bt extends Xt{writeLeftID(t){m(this.restEncoder,t.client),m(this.restEncoder,t.clock)}writeRightID(t){m(this.restEncoder,t.client),m(this.restEncoder,t.clock)}writeClient(t){
90
+ m(this.restEncoder,t)}writeInfo(t){oe(this.restEncoder,t)}writeString(t){At(this.restEncoder,t)}writeParentInfo(t){m(this.restEncoder,t?1:0)}writeTypeRef(t){m(this.restEncoder,t)}writeLen(t){m(this.restEncoder,
91
+ t)}writeAny(t){le(this.restEncoder,t)}writeBuf(t){z(this.restEncoder,t)}writeJSON(t){At(this.restEncoder,JSON.stringify(t))}writeKey(t){At(this.restEncoder,t)}}class Oe{constructor(){this.restEncoder=
92
+ Jt(),this.dsCurrVal=0}toUint8Array(){return H(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(t){const n=t-this.dsCurrVal;this.dsCurrVal=t,m(this.restEncoder,n)}writeDsLen(t){t===0&&j(),
93
+ m(this.restEncoder,t-1),this.dsCurrVal+=t}}class Y extends Oe{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new dn,this.clientEncoder=new De,this.leftClockEncoder=new dn,
94
+ this.rightClockEncoder=new dn,this.infoEncoder=new ir(oe),this.stringEncoder=new Li,this.parentInfoEncoder=new ir(oe),this.typeRefEncoder=new De,this.lenEncoder=new De}toUint8Array(){const t=Jt();return m(
95
+ t,0),z(t,this.keyClockEncoder.toUint8Array()),z(t,this.clientEncoder.toUint8Array()),z(t,this.leftClockEncoder.toUint8Array()),z(t,this.rightClockEncoder.toUint8Array()),z(t,H(this.infoEncoder)),z(t,this.
96
+ stringEncoder.toUint8Array()),z(t,H(this.parentInfoEncoder)),z(t,this.typeRefEncoder.toUint8Array()),z(t,this.lenEncoder.toUint8Array()),ce(t,H(this.restEncoder)),H(t)}writeLeftID(t){this.clientEncoder.
97
+ write(t.client),this.leftClockEncoder.write(t.clock)}writeRightID(t){this.clientEncoder.write(t.client),this.rightClockEncoder.write(t.clock)}writeClient(t){this.clientEncoder.write(t)}writeInfo(t){this.
98
+ infoEncoder.write(t)}writeString(t){this.stringEncoder.write(t)}writeParentInfo(t){this.parentInfoEncoder.write(t?1:0)}writeTypeRef(t){this.typeRefEncoder.write(t)}writeLen(t){this.lenEncoder.write(t)}writeAny(t){
99
+ le(this.restEncoder,t)}writeBuf(t){z(this.restEncoder,t)}writeJSON(t){le(this.restEncoder,t)}writeKey(t){const n=this.keyMap.get(t);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.
100
+ write(t)):this.keyClockEncoder.write(n)}}const So=(e,t,n,r)=>{r=Ct(r,t[0].id.clock);const s=q(t,r);m(e.restEncoder,t.length-s),e.writeClient(n),m(e.restEncoder,r);const i=t[s];i.write(e,r-i.id.clock);
101
+ for(let o=s+1;o<t.length;o++)t[o].write(e,0)},Sn=(e,t,n)=>{const r=new Map;n.forEach((s,i)=>{A(t,i)>s&&r.set(i,s)}),fe(t).forEach((s,i)=>{n.has(i)||r.set(i,0)}),m(e.restEncoder,r.size),ft(r.entries()).
102
+ sort((s,i)=>i[0]-s[0]).forEach(([s,i])=>{So(e,t.clients.get(s),s,i)})},_o=(e,t)=>{const n=U(),r=S(e.restDecoder);for(let s=0;s<r;s++){const i=S(e.restDecoder),o=new Array(i),c=e.readClient();let l=S(e.
103
+ restDecoder);n.set(c,{i:0,refs:o});for(let d=0;d<i;d++){const a=e.readInfo();switch(Ee&a){case 0:{const h=e.readLen();o[d]=new V(y(c,l),h),l+=h;break}case 10:{const h=S(e.restDecoder);o[d]=new L(y(c,l),
104
+ h),l+=h;break}default:{const h=(a&(ct|F))===0,u=new x(y(c,l),null,(a&F)===F?e.readLeftID():null,null,(a&ct)===ct?e.readRightID():null,h?e.readParentInfo()?t.get(e.readString()):e.readLeftID():null,h&&
105
+ (a&ne)===ne?e.readString():null,Us(e,a));o[d]=u,l+=u.length}}}}return n},vo=(e,t,n)=>{const r=[];let s=ft(n.keys()).sort((g,f)=>g-f);if(s.length===0)return null;const i=()=>{if(s.length===0)return null;
106
+ let g=n.get(s[s.length-1]);for(;g.refs.length===g.i;)if(s.pop(),s.length>0)g=n.get(s[s.length-1]);else return null;return g};let o=i();if(o===null)return null;const c=new zr,l=new Map,d=(g,f)=>{const p=l.
107
+ get(g);(p==null||p>f)&&l.set(g,f)};let a=o.refs[o.i++];const h=new Map,u=()=>{for(const g of r){const f=g.id.client,p=n.get(f);p?(p.i--,c.clients.set(f,p.refs.slice(p.i)),n.delete(f),p.i=0,p.refs=[]):
108
+ c.clients.set(f,[g]),s=s.filter(_=>_!==f)}r.length=0};for(;;){if(a.constructor!==L){const g=B(h,a.id.client,()=>A(t,a.id.client))-a.id.clock;if(g<0)r.push(a),d(a.id.client,a.id.clock-1),u();else{const f=a.
109
+ getMissing(e,t);if(f!==null){r.push(a);const p=n.get(f)||{refs:[],i:0};if(p.refs.length===p.i)d(f,A(t,f)),u();else{a=p.refs[p.i++];continue}}else(g===0||g<a.length)&&(a.integrate(e,g),h.set(a.id.client,
110
+ a.id.clock+a.length))}}if(r.length>0)a=r.pop();else if(o!==null&&o.i<o.refs.length)a=o.refs[o.i++];else{if(o=i(),o===null)break;a=o.refs[o.i++]}}if(c.clients.size>0){const g=new Y;return Sn(g,c,new Map),
111
+ m(g.restEncoder,0),{missing:l,update:g.toUint8Array()}}return null},xo=(e,t)=>Sn(e,t.doc.store,t.beforeState),_n=(e,t,n,r=new J(e))=>E(t,s=>{s.local=!1;let i=!1;const o=s.doc,c=o.store,l=_o(r,o),d=vo(
112
+ s,c,l),a=c.pendingStructs;if(a){for(const[u,g]of a.missing)if(g<A(c,u)){i=!0;break}if(d){for(const[u,g]of d.missing){const f=a.missing.get(u);(f==null||f>g)&&a.missing.set(u,g)}a.update=pe([a.update,d.
113
+ update])}}else c.pendingStructs=d;const h=Er(r,s,c);if(c.pendingDs){const u=new J(T(c.pendingDs));S(u.restDecoder);const g=Er(u,s,c);h&&g?c.pendingDs=pe([h,g]):c.pendingDs=h||g}else c.pendingDs=h;if(i){
114
+ const u=c.pendingStructs.update;c.pendingStructs=null,Ue(s.doc,u)}},n,!1),Co=(e,t,n)=>_n(e,t,n,new X(e)),Ue=(e,t,n,r=J)=>{const s=T(t);_n(s,e,n,new r(s))},Nr=(e,t,n)=>Ue(e,t,n,X),Eo=(e,t,n=new Map)=>{
115
+ Sn(e,t.store,n),nt(e,kn(t.store))},Ir=(e,t=new Uint8Array([0]),n=new Y)=>{const r=vn(t);Eo(n,e,r);const s=[n.toUint8Array()];if(e.store.pendingDs&&s.push(e.store.pendingDs),e.store.pendingStructs&&s.push(
116
+ Mn(e.store.pendingStructs.update,t)),s.length>1){if(n.constructor===bt)return es(s.map((i,o)=>o===0?i:os(i)));if(n.constructor===Y)return pe(s)}return s[0]},Ao=(e,t)=>Ir(e,t,new bt),Mr=e=>{const t=new Map,
117
+ n=S(e.restDecoder);for(let r=0;r<n;r++){const s=S(e.restDecoder),i=S(e.restDecoder);t.set(s,i)}return t},vn=e=>Mr(new ue(T(e))),xn=(e,t)=>(m(e.restEncoder,t.size),ft(t.entries()).sort((n,r)=>r[0]-n[0]).
118
+ forEach(([n,r])=>{m(e.restEncoder,n),m(e.restEncoder,r)}),e),Do=(e,t)=>xn(e,fe(t.store)),Po=(e,t=new Oe)=>(e instanceof Map?xn(t,e):Do(t,e),t.toUint8Array()),No=e=>Po(e,new Xt);class Io{constructor(){
119
+ this.l=[]}}const Tr=()=>new Io,Or=(e,t)=>e.l.push(t),Ur=(e,t)=>{const n=e.l,r=n.length;e.l=n.filter(s=>t!==s),r===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},
120
+ Fr=(e,t,n)=>gn(e.l,[t,n]);class Mt{constructor(t,n){this.client=t,this.clock=n}}const Tt=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,y=(e,t)=>new Mt(e,t),Lr=(e,t)=>{m(e,t.
121
+ client),m(e,t.clock)},Rr=e=>y(S(e),S(e)),Cn=e=>{for(const[t,n]of e.doc.share.entries())if(n===e)return t;throw j()},ge=(e,t)=>{for(;t!==null;){if(t.parent===e)return!0;t=t.parent._item}return!1},Mo=e=>{
122
+ const t=[];let n=e._start;for(;n;)t.push(n),n=n.right;t.filter(r=>!r.deleted).map(r=>r.content)};class To{constructor(t,n=t.getMap("users")){const r=new Map;this.yusers=n,this.doc=t,this.clients=new Map,
123
+ this.dss=r;const s=(i,o)=>{const c=i.get("ds"),l=i.get("ids"),d=a=>this.clients.set(a,o);c.observe(a=>{a.changes.added.forEach(h=>{h.content.getContent().forEach(u=>{u instanceof Uint8Array&&this.dss.
124
+ set(o,It([this.dss.get(o)||Te(),dt(new ue(T(u)))]))})})}),this.dss.set(o,It(c.map(a=>dt(new ue(T(a)))))),l.observe(a=>a.changes.added.forEach(h=>h.content.getContent().forEach(d))),l.forEach(d)};n.observe(
125
+ i=>{i.keysChanged.forEach(o=>s(n.get(o),o))}),n.forEach(s)}setUserMapping(t,n,r,{filter:s=()=>!0}={}){const i=this.yusers;let o=i.get(r);o||(o=new St,o.set("ids",new ht),o.set("ds",new ht),i.set(r,o)),
126
+ o.get("ids").push([n]),i.observe(c=>{setTimeout(()=>{const l=i.get(r);if(l!==o){o=l,this.clients.forEach((h,u)=>{r===h&&o.get("ids").push([u])});const d=new Xt,a=this.dss.get(r);a&&(nt(d,a),o.get("ds").
127
+ push([d.toUint8Array()]))}},0)}),t.on("afterTransaction",c=>{setTimeout(()=>{const l=o.get("ds"),d=c.deleteSet;if(c.local&&d.clients.size>0&&s(c,d)){const a=new Xt;nt(a,d),l.push([a.toUint8Array()])}})})}getUserByClientId(t){
128
+ return this.clients.get(t)||null}getUserByDeletedId(t){for(const[n,r]of this.dss.entries())if(Nt(r,t))return n;return null}}class Fe{constructor(t,n,r,s=0){this.type=t,this.tname=n,this.item=r,this.assoc=
129
+ s}}const Oo=e=>{const t={};return e.type&&(t.type=e.type),e.tname&&(t.tname=e.tname),e.item&&(t.item=e.item),e.assoc!=null&&(t.assoc=e.assoc),t},Uo=e=>new Fe(e.type==null?null:y(e.type.client,e.type.clock),
130
+ e.tname??null,e.item==null?null:y(e.item.client,e.item.clock),e.assoc==null?0:e.assoc);class jr{constructor(t,n,r=0){this.type=t,this.index=n,this.assoc=r}}const Fo=(e,t,n=0)=>new jr(e,t,n),Le=(e,t,n)=>{
131
+ let r=null,s=null;return e._item===null?s=Cn(e):r=y(e._item.id.client,e._item.id.clock),new Fe(r,s,t,n)},Lo=(e,t,n=0)=>{let r=e._start;if(n<0){if(t===0)return Le(e,null,n);t--}for(;r!==null;){if(!r.deleted&&
132
+ r.countable){if(r.length>t)return Le(e,y(r.id.client,r.id.clock+t),n);t-=r.length}if(r.right===null&&n<0)return Le(e,r.lastId,n);r=r.right}return Le(e,null,n)},Ro=(e,t)=>{const{type:n,tname:r,item:s,assoc:i}=t;
133
+ if(s!==null)m(e,0),Lr(e,s);else if(r!==null)oe(e,1),At(e,r);else if(n!==null)oe(e,2),Lr(e,n);else throw j();return Ae(e,i),e},jo=e=>{const t=Jt();return Ro(t,e),H(t)},Vo=e=>{let t=null,n=null,r=null;switch(S(
134
+ e)){case 0:r=Rr(e);break;case 1:n=Dt(e);break;case 2:t=Rr(e)}const s=dr(e)?Ne(e):0;return new Fe(t,n,r,s)},Bo=e=>Vo(T(e)),zo=(e,t)=>{const n=Ot(e,t),r=t.clock-n.id.clock;return{item:n,diff:r}},Wo=(e,t,n=!0)=>{
135
+ const r=t.store,s=e.item,i=e.type,o=e.tname,c=e.assoc;let l=null,d=0;if(s!==null){if(A(r,s.client)<=s.clock)return null;const a=n?Vn(r,s):zo(r,s),h=a.item;if(!(h instanceof x))return null;if(l=h.parent,
136
+ l._item===null||!l._item.deleted){d=h.deleted||!h.countable?0:a.diff+(c>=0?0:1);let u=h.left;for(;u!==null;)!u.deleted&&u.countable&&(d+=u.length),u=u.left}}else{if(o!==null)l=t.get(o);else if(i!==null){
137
+ if(A(r,i.client)<=i.clock)return null;const{item:a}=n?Vn(r,i):{item:Ot(r,i)};if(a instanceof x&&a.content instanceof K)l=a.content.type;else return null}else throw j();c>=0?d=l._length:d=0}return Fo(l,
138
+ d,e.assoc)},Jo=(e,t)=>e===t||e!==null&&t!==null&&e.tname===t.tname&&Tt(e.item,t.item)&&Tt(e.type,t.type)&&e.assoc===t.assoc;class En{constructor(t,n){this.ds=t,this.sv=n}}const Go=(e,t)=>{const n=e.ds.
139
+ clients,r=t.ds.clients,s=e.sv,i=t.sv;if(s.size!==i.size||n.size!==r.size)return!1;for(const[o,c]of s.entries())if(i.get(o)!==c)return!1;for(const[o,c]of n.entries()){const l=r.get(o)||[];if(c.length!==
140
+ l.length)return!1;for(let d=0;d<c.length;d++){const a=c[d],h=l[d];if(a.clock!==h.clock||a.len!==h.len)return!1}}return!0},Vr=(e,t=new Oe)=>(nt(t,e.ds),xn(t,e.sv),t.toUint8Array()),Ho=e=>Vr(e,new Xt),Br=(e,t=new Pr(
141
+ T(e)))=>new En(dt(t),Mr(t)),Xo=e=>Br(e,new ue(T(e))),An=(e,t)=>new En(e,t),qo=An(Te(),new Map),$o=e=>An(kn(e.store),fe(e.store)),yt=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||
142
+ 0)>e.id.clock&&!Nt(t.ds,e.id),Dn=(e,t)=>{const n=B(e.meta,Dn,Wt),r=e.doc.store;n.has(t)||(t.sv.forEach((s,i)=>{s<A(r,i)&&O(e,y(i,s))}),Pt(e,t.ds,s=>{}),n.add(t))},Ko=(e,t,n=new rt)=>{if(e.gc)throw new Error(
143
+ "Garbage-collection must be disabled in `originDoc`!");const{sv:r,ds:s}=t,i=new Y;return e.transact(o=>{let c=0;r.forEach(l=>{l>0&&c++}),m(i.restEncoder,c);for(const[l,d]of r){if(d===0)continue;d<A(e.
144
+ store,l)&&O(o,y(l,d));const a=e.store.clients.get(l)||[],h=q(a,d-1);m(i.restEncoder,h+1),i.writeClient(l),m(i.restEncoder,0);for(let u=0;u<=h;u++)a[u].write(i,0)}nt(i,s)}),Ue(n,i.toUint8Array(),"snaps\
145
+ hot"),n},Yo=(e,t,n=J)=>{const r=new n(T(t)),s=new wt(r,!1);for(let o=s.curr;o!==null;o=s.next())if((e.sv.get(o.id.client)||0)<o.id.clock+o.length)return!1;const i=It([e.ds,dt(r)]);return Ar(e.ds,i)},Zo=(e,t)=>Yo(
146
+ e,t,X);class zr{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const fe=e=>{const t=new Map;return e.clients.forEach((n,r)=>{const s=n[n.length-1];t.set(r,s.id.clock+
147
+ s.length)}),t},A=(e,t)=>{const n=e.clients.get(t);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},Wr=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(
148
+ t.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==t.id.clock)throw j()}n.push(t)},q=(e,t)=>{let n=0,r=e.length-1,s=e[r],i=s.id.clock;if(i===t)return r;let o=pt(t/(i+s.length-1)*r);for(;n<=
149
+ r;){if(s=e[o],i=s.id.clock,i<=t){if(t<i+s.length)return o;n=o+1}else r=o-1;o=pt((n+r)/2)}throw j()},Ot=(e,t)=>{const n=e.clients.get(t.client);return n[q(n,t.clock)]},Pn=(e,t,n)=>{const r=q(t,n),s=t[r];
150
+ return s.id.clock<n&&s instanceof x?(t.splice(r+1,0,Xe(e,s,n-s.id.clock)),r+1):r},O=(e,t)=>{const n=e.doc.store.clients.get(t.client);return n[Pn(e,n,t.clock)]},Nn=(e,t,n)=>{const r=t.clients.get(n.client),
151
+ s=q(r,n.clock),i=r[s];return n.clock!==i.id.clock+i.length-1&&i.constructor!==V&&r.splice(s+1,0,Xe(e,i,n.clock-i.id.clock+1)),i},Qo=(e,t,n)=>{const r=e.clients.get(t.id.client);r[q(r,t.id.clock)]=n},Jr=(e,t,n,r,s)=>{
152
+ if(r===0)return;const i=n+r;let o=Pn(e,t,n),c;do c=t[o++],i<c.id.clock+c.length&&Pn(e,t,i),s(c);while(o<t.length&&t[o].id.clock<i)};class Gr{constructor(t,n,r){this.doc=t,this.deleteSet=new Ht,this.beforeState=
153
+ fe(t.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=
154
+ new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const Hr=(e,t)=>t.deleteSet.clients.size===0&&!gi(t.afterState,(n,r)=>t.beforeState.get(r)!==n)?!1:(wn(t.deleteSet),xo(e,t),nt(e,t.deleteSet),
155
+ !0),Xr=(e,t,n)=>{const r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&B(e.changed,t,Wt).add(n)},Re=(e,t)=>{let n=e[t],r=e[t-1],s=t;for(;s>0;n=r,r=e[--s-1]){if(r.deleted===
156
+ n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof x&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const i=t-s;return i&&
157
+ e.splice(t+1-i,i),i},qr=(e,t,n)=>{for(const[r,s]of e.clients.entries()){const i=t.clients.get(r);for(let o=s.length-1;o>=0;o--){const c=s[o],l=c.clock+c.len;for(let d=q(i,c.clock),a=i[d];d<i.length&&a.
158
+ id.clock<l;a=i[++d]){const h=i[d];if(c.clock+c.len<=h.id.clock)break;h instanceof x&&h.deleted&&!h.keep&&n(h)&&h.gc(t,!1)}}}},$r=(e,t)=>{e.clients.forEach((n,r)=>{const s=t.clients.get(r);for(let i=n.
159
+ length-1;i>=0;i--){const o=n[i],c=Zn(s.length-1,1+q(s,o.clock+o.len-1));for(let l=c,d=s[l];l>0&&d.id.clock>=o.clock;d=s[l])l-=1+Re(s,l)}})},tc=(e,t,n)=>{qr(e,t,n),$r(e,t)},Kr=(e,t)=>{if(t<e.length){const n=e[t],
160
+ r=n.doc,s=r.store,i=n.deleteSet,o=n._mergeStructs;try{wn(i),n.afterState=fe(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const c=[];n.changed.forEach((l,d)=>c.push(()=>{(d._item===null||!d._item.deleted)&&
161
+ d._callObserver(n,l)})),c.push(()=>{n.changedParentTypes.forEach((l,d)=>{d._dEH.l.length>0&&(d._item===null||!d._item.deleted)&&(l=l.filter(a=>a.target._item===null||!a.target._item.deleted),l.forEach(
162
+ a=>{a.currentTarget=d,a._path=null}),l.sort((a,h)=>a.path.length-h.path.length),Fr(d._dEH,l,n))})}),c.push(()=>r.emit("afterTransaction",[n,r])),gn(c,[]),n._needFormattingCleanup&&Cc(n)}finally{r.gc&&
163
+ qr(i,s,r.gcFilter),$r(i,s),n.afterState.forEach((a,h)=>{const u=n.beforeState.get(h)||0;if(u!==a){const g=s.clients.get(h),f=Ct(q(g,u),1);for(let p=g.length-1;p>=f;)p-=1+Re(g,p)}});for(let a=o.length-
164
+ 1;a>=0;a--){const{client:h,clock:u}=o[a].id,g=s.clients.get(h),f=q(g,u);f+1<g.length&&Re(g,f+1)>1||f>0&&Re(g,f)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(mn(pn,wr,"[y\
165
+ js] ",kr,Sr,"Changed the client-id because another client seems to be using it."),r.clientID=Dr()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const a=new bt;Hr(a,n)&&r.emit("u\
166
+ pdate",[a.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const a=new Y;Hr(a,n)&&r.emit("updateV2",[a.toUint8Array(),n.origin,r,n])}const{subdocsAdded:c,subdocsLoaded:l,subdocsRemoved:d}=n;
167
+ (c.size>0||d.size>0||l.size>0)&&(c.forEach(a=>{a.clientID=r.clientID,a.collectionid==null&&(a.collectionid=r.collectionid),r.subdocs.add(a)}),d.forEach(a=>r.subdocs.delete(a)),r.emit("subdocs",[{loaded:l,
168
+ added:c,removed:d},r,n]),d.forEach(a=>a.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,e])):Kr(e,t+1)}}},E=(e,t,n=null,r=!0)=>{const s=e._transactionCleanups;let i=!1,
169
+ o=null;e._transaction===null&&(i=!0,e._transaction=new Gr(e,n,r),s.push(e._transaction),s.length===1&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{o=t(e._transaction)}finally{
170
+ if(i){const c=e._transaction===s[0];e._transaction=null,c&&Kr(s,0)}}return o};class ec{constructor(t,n){this.insertions=n,this.deletions=t,this.meta=new Map}}const Yr=(e,t,n)=>{Pt(e,n.deletions,r=>{r instanceof
171
+ x&&t.scope.some(s=>s===e.doc||ge(s,r))&&Bn(r,!1)})},Zr=(e,t,n)=>{let r=null;const s=e.doc,i=e.scope;E(s,c=>{for(;t.length>0&&e.currStackItem===null;){const l=s.store,d=t.pop(),a=new Set,h=[];let u=!1;
172
+ Pt(c,d.insertions,g=>{if(g instanceof x){if(g.redone!==null){let{item:f,diff:p}=Vn(l,g.id);p>0&&(f=O(c,y(f.id.client,f.id.clock+p))),g=f}!g.deleted&&i.some(f=>f===c.doc||ge(f,g))&&h.push(g)}}),Pt(c,d.
173
+ deletions,g=>{g instanceof x&&i.some(f=>f===c.doc||ge(f,g))&&!Nt(d.insertions,g.id)&&a.add(g)}),a.forEach(g=>{u=Os(c,g,a,d.insertions,e.ignoreRemoteMapChanges,e)!==null||u});for(let g=h.length-1;g>=0;g--){
174
+ const f=h[g];e.deleteFilter(f)&&(f.delete(c),u=!0)}e.currStackItem=u?d:null}c.changed.forEach((l,d)=>{l.has(null)&&d._searchMarker&&(d._searchMarker.length=0)}),r=c},e);const o=e.currStackItem;if(o!=null){
175
+ const c=r.changedParentTypes;e.emit("stack-item-popped",[{stackItem:o,type:n,changedParentTypes:c,origin:e},e]),e.currStackItem=null}return o};class nc extends rn{constructor(t,{captureTimeout:n=500,captureTransaction:r=l=>!0,
176
+ deleteFilter:s=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:c=nn(t)?t[0].doc:t instanceof rt?t:t.doc}={}){super(),this.scope=[],this.doc=c,this.addToScope(t),this.deleteFilter=
177
+ s,i.add(this),this.trackedOrigins=i,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=
178
+ o,this.captureTimeout=n,this.afterTransactionHandler=l=>{if(!this.captureTransaction(l)||!this.scope.some(_=>l.changedParentTypes.has(_)||_===this.doc)||!this.trackedOrigins.has(l.origin)&&(!l.origin||
179
+ !this.trackedOrigins.has(l.origin.constructor)))return;const d=this.undoing,a=this.redoing,h=d?this.redoStack:this.undoStack;d?this.stopCapturing():a||this.clear(!1,!0);const u=new Ht;l.afterState.forEach(
180
+ (_,k)=>{const b=l.beforeState.get(k)||0,M=_-b;M>0&&he(u,k,b,M)});const g=Ji();let f=!1;if(this.lastChange>0&&g-this.lastChange<this.captureTimeout&&h.length>0&&!d&&!a){const _=h[h.length-1];_.deletions=
181
+ It([_.deletions,l.deleteSet]),_.insertions=It([_.insertions,u])}else h.push(new ec(l.deleteSet,u)),f=!0;!d&&!a&&(this.lastChange=g),Pt(l,l.deleteSet,_=>{_ instanceof x&&this.scope.some(k=>k===l.doc||ge(
182
+ k,_))&&Bn(_,!0)});const p=[{stackItem:h[h.length-1],origin:l.origin,type:d?"redo":"undo",changedParentTypes:l.changedParentTypes},this];f?this.emit("stack-item-added",p):this.emit("stack-item-updated",
183
+ p)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(t){const n=new Set(this.scope);t=nn(t)?t:[t],t.forEach(r=>{n.has(r)||(n.add(r),(r instanceof
184
+ P?r.doc!==this.doc:r!==this.doc)&&vr("[yjs#509] Not same Y.Doc"),this.scope.push(r))})}addTrackedOrigin(t){this.trackedOrigins.add(t)}removeTrackedOrigin(t){this.trackedOrigins.delete(t)}clear(t=!0,n=!0){
185
+ (t&&this.canUndo()||n&&this.canRedo())&&this.doc.transact(r=>{t&&(this.undoStack.forEach(s=>Yr(r,this,s)),this.undoStack=[]),n&&(this.redoStack.forEach(s=>Yr(r,this,s)),this.redoStack=[]),this.emit("s\
186
+ tack-cleared",[{undoStackCleared:t,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let t;try{t=Zr(this,this.undoStack,"undo")}finally{this.undoing=!1}return t}redo(){this.
187
+ redoing=!0;let t;try{t=Zr(this,this.redoStack,"redo")}finally{this.redoing=!1}return t}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(
188
+ this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*rc(e){const t=S(e.restDecoder);for(let n=0;n<t;n++){const r=S(e.restDecoder),s=e.readClient();let i=S(e.restDecoder);
189
+ for(let o=0;o<r;o++){const c=e.readInfo();if(c===10){const l=S(e.restDecoder);yield new L(y(s,i),l),i+=l}else if((Ee&c)!==0){const l=(c&(ct|F))===0,d=new x(y(s,i),null,(c&F)===F?e.readLeftID():null,null,
190
+ (c&ct)===ct?e.readRightID():null,l?e.readParentInfo()?e.readString():e.readLeftID():null,l&&(c&ne)===ne?e.readString():null,Us(e,c));yield d,i+=d.length}else{const l=e.readLen();yield new V(y(s,i),l),
191
+ i+=l}}}}class wt{constructor(t,n){this.gen=rc(t),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.
192
+ curr.constructor===L);return this.curr}}const sc=e=>Qr(e,X),Qr=(e,t=J)=>{const n=[],r=new t(T(e)),s=new wt(r,!1);for(let o=s.curr;o!==null;o=s.next())n.push(o);mn("Structs: ",n);const i=dt(r);mn("Dele\
193
+ teSet: ",i)},ic=e=>ts(e,X),ts=(e,t=J)=>{const n=[],r=new t(T(e)),s=new wt(r,!1);for(let i=s.curr;i!==null;i=s.next())n.push(i);return{structs:n,ds:dt(r)}};class In{constructor(t){this.currClient=0,this.
194
+ startClock=0,this.written=0,this.encoder=t,this.clientStructs=[]}}const es=e=>pe(e,X,bt),ns=(e,t=Oe,n=J)=>{const r=new t,s=new wt(new n(T(e)),!1);let i=s.curr;if(i!==null){let o=0,c=i.id.client,l=i.id.
195
+ clock!==0,d=l?0:i.id.clock+i.length;for(;i!==null;i=s.next())c!==i.id.client&&(d!==0&&(o++,m(r.restEncoder,c),m(r.restEncoder,d)),c=i.id.client,d=0,l=i.id.clock!==0),i.constructor===L&&(l=!0),l||(d=i.
196
+ id.clock+i.length);d!==0&&(o++,m(r.restEncoder,c),m(r.restEncoder,d));const a=Jt();return m(a,o),Mi(a,r.restEncoder),r.restEncoder=a,r.toUint8Array()}else return m(r.restEncoder,0),r.toUint8Array()},oc=e=>ns(
197
+ e,Xt,X),rs=(e,t=J)=>{const n=new Map,r=new Map,s=new wt(new t(T(e)),!1);let i=s.curr;if(i!==null){let o=i.id.client,c=i.id.clock;for(n.set(o,c);i!==null;i=s.next())o!==i.id.client&&(r.set(o,c),n.set(i.
198
+ id.client,i.id.clock),o=i.id.client),c=i.id.clock+i.length;r.set(o,c)}return{from:n,to:r}},cc=e=>rs(e,X),lc=(e,t)=>{if(e.constructor===V){const{client:n,clock:r}=e.id;return new V(y(n,r+t),e.length-t)}else if(e.
199
+ constructor===L){const{client:n,clock:r}=e.id;return new L(y(n,r+t),e.length-t)}else{const n=e,{client:r,clock:s}=n.id;return new x(y(r,s+t),null,y(r,s+t-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.
200
+ splice(t))}},pe=(e,t=J,n=Y)=>{if(e.length===1)return e[0];const r=e.map(a=>new t(T(a)));let s=r.map(a=>new wt(a,!0)),i=null;const o=new n,c=new In(o);for(;s=s.filter(a=>a.curr!==null),s.sort((a,h)=>{if(a.
201
+ curr.id.client===h.curr.id.client){const u=a.curr.id.clock-h.curr.id.clock;return u===0?a.curr.constructor===h.curr.constructor?0:a.curr.constructor===L?1:-1:u}else return h.curr.id.client-a.curr.id.client}),
202
+ s.length!==0;){const a=s[0],h=a.curr.id.client;if(i!==null){let u=a.curr,g=!1;for(;u!==null&&u.id.clock+u.length<=i.struct.id.clock+i.struct.length&&u.id.client>=i.struct.id.client;)u=a.next(),g=!0;if(u===
203
+ null||u.id.client!==h||g&&u.id.clock>i.struct.id.clock+i.struct.length)continue;if(h!==i.struct.id.client)kt(c,i.struct,i.offset),i={struct:u,offset:0},a.next();else if(i.struct.id.clock+i.struct.length<
204
+ u.id.clock)if(i.struct.constructor===L)i.struct.length=u.id.clock+u.length-i.struct.id.clock;else{kt(c,i.struct,i.offset);const f=u.id.clock-i.struct.id.clock-i.struct.length;i={struct:new L(y(h,i.struct.
205
+ id.clock+i.struct.length),f),offset:0}}else{const f=i.struct.id.clock+i.struct.length-u.id.clock;f>0&&(i.struct.constructor===L?i.struct.length-=f:u=lc(u,f)),i.struct.mergeWith(u)||(kt(c,i.struct,i.offset),
206
+ i={struct:u,offset:0},a.next())}}else i={struct:a.curr,offset:0},a.next();for(let u=a.curr;u!==null&&u.id.client===h&&u.id.clock===i.struct.id.clock+i.struct.length&&u.constructor!==L;u=a.next())kt(c,
207
+ i.struct,i.offset),i={struct:u,offset:0}}i!==null&&(kt(c,i.struct,i.offset),i=null),Tn(c);const l=r.map(a=>dt(a)),d=It(l);return nt(o,d),o.toUint8Array()},Mn=(e,t,n=J,r=Y)=>{const s=vn(t),i=new r,o=new In(
208
+ i),c=new n(T(e)),l=new wt(c,!1);for(;l.curr;){const a=l.curr,h=a.id.client,u=s.get(h)||0;if(l.curr.constructor===L){l.next();continue}if(a.id.clock+a.length>u)for(kt(o,a,Ct(u-a.id.clock,0)),l.next();l.
209
+ curr&&l.curr.id.client===h;)kt(o,l.curr,0),l.next();else for(;l.curr&&l.curr.id.client===h&&l.curr.id.clock+l.curr.length<=u;)l.next()}Tn(o);const d=dt(c);return nt(i,d),i.toUint8Array()},ac=(e,t)=>Mn(
210
+ e,t,X,bt),ss=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:H(e.encoder.restEncoder)}),e.encoder.restEncoder=Jt(),e.written=0)},kt=(e,t,n)=>{e.written>0&&e.currClient!==t.id.client&&
211
+ ss(e),e.written===0&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),m(e.encoder.restEncoder,t.id.clock+n)),t.write(e.encoder,n),e.written++},Tn=e=>{ss(e);const t=e.encoder.restEncoder;m(
212
+ t,e.clientStructs.length);for(let n=0;n<e.clientStructs.length;n++){const r=e.clientStructs[n];m(t,r.written),ce(t,r.restEncoder)}},je=(e,t,n,r)=>{const s=new n(T(e)),i=new wt(s,!1),o=new r,c=new In(o);
213
+ for(let d=i.curr;d!==null;d=i.next())kt(c,t(d),0);Tn(c);const l=dt(s);return nt(o,l),o.toUint8Array()},is=({formatting:e=!0,subdocs:t=!0,yxml:n=!0}={})=>{let r=0;const s=U(),i=U(),o=U(),c=U();return c.
214
+ set(null,null),l=>{switch(l.constructor){case V:case L:return l;case x:{const d=l,a=d.content;switch(a.constructor){case Lt:break;case K:{if(n){const h=a.type;h instanceof st&&(h.nodeName=B(i,h.nodeName,
215
+ ()=>"node-"+r)),h instanceof $t&&(h.hookName=B(i,h.hookName,()=>"hook-"+r))}break}case gt:{const h=a;h.arr=h.arr.map(()=>r);break}case Ft:{const h=a;h.content=new Uint8Array([r]);break}case Rt:{const h=a;
216
+ t&&(h.opts={},h.doc.guid=r+"");break}case ut:{const h=a;h.embed={};break}case D:{const h=a;e&&(h.key=B(o,h.key,()=>r+""),h.value=B(c,h.value,()=>({i:r})));break}case Yt:{const h=a;h.arr=h.arr.map(()=>r);
217
+ break}case $:{const h=a;h.str=Ei(r%10+"",h.str.length);break}default:j()}return d.parentSub&&(d.parentSub=B(s,d.parentSub,()=>r+"")),r++,l}default:j()}}},dc=(e,t)=>je(e,is(t),X,bt),hc=(e,t)=>je(e,is(t),
218
+ J,Y),uc=e=>je(e,br,X,Y),os=e=>je(e,br,J,bt),cs="You must not compute changes after the event-handler fired.";class me{constructor(t,n){this.target=t,this.currentTarget=t,this.transaction=n,this._changes=
219
+ null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=gc(this.currentTarget,this.target))}deletes(t){return Nt(this.transaction.deleteSet,t.id)}get keys(){if(this.
220
+ _keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw mt(cs);const t=new Map,n=this.target;this.transaction.changed.get(n).forEach(r=>{if(r!==null){const s=n._map.get(r);let i,o;
221
+ if(this.adds(s)){let c=s.left;for(;c!==null&&this.adds(c);)c=c.left;if(this.deletes(s))if(c!==null&&this.deletes(c))i="delete",o=en(c.content.getContent());else return;else c!==null&&this.deletes(c)?(i=
222
+ "update",o=en(c.content.getContent())):(i="add",o=void 0)}else if(this.deletes(s))i="delete",o=en(s.content.getContent());else return;t.set(r,{action:i,oldValue:o})}}),this._keys=t}return this._keys}get delta(){
223
+ return this.changes.delta}adds(t){return t.id.clock>=(this.transaction.beforeState.get(t.id.client)||0)}get changes(){let t=this._changes;if(t===null){if(this.transaction.doc._transactionCleanups.length===
224
+ 0)throw mt(cs);const n=this.target,r=Wt(),s=Wt(),i=[];if(t={added:r,deleted:s,delta:i,keys:this.keys},this.transaction.changed.get(n).has(null)){let o=null;const c=()=>{o&&i.push(o)};for(let l=n._start;l!==
225
+ null;l=l.right)l.deleted?this.deletes(l)&&!this.adds(l)&&((o===null||o.delete===void 0)&&(c(),o={delete:0}),o.delete+=l.length,s.add(l)):this.adds(l)?((o===null||o.insert===void 0)&&(c(),o={insert:[]}),
226
+ o.insert=o.insert.concat(l.content.getContent()),r.add(l)):((o===null||o.retain===void 0)&&(c(),o={retain:0}),o.retain+=l.length);o!==null&&o.retain===void 0&&c()}this._changes=t}return t}}const gc=(e,t)=>{
227
+ const n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let r=0,s=t._item.parent._start;for(;s!==t._item&&s!==null;)!s.deleted&&s.countable&&(r+=s.length),
228
+ s=s.right;n.unshift(r)}t=t._item.parent}return n},I=()=>{vr("Invalid access: Add Yjs type to a document before reading data.")},ls=80;let On=0;class fc{constructor(t,n){t.marker=!0,this.p=t,this.index=
229
+ n,this.timestamp=On++}}const pc=e=>{e.timestamp=On++},as=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=On++},mc=(e,t,n)=>{if(e.length>=ls){const r=e.reduce((s,i)=>s.timestamp<i.timestamp?
230
+ s:i);return as(r,t,n),r}else{const r=new fc(t,n);return e.push(r),r}},Ve=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;const n=e._searchMarker.length===0?null:e._searchMarker.reduce(
231
+ (i,o)=>Ce(t-i.index)<Ce(t-o.index)?i:o);let r=e._start,s=0;for(n!==null&&(r=n.p,s=n.index,pc(n));r.right!==null&&s<t;){if(!r.deleted&&r.countable){if(t<s+r.length)break;s+=r.length}r=r.right}for(;r.left!==
232
+ null&&s>t;)r=r.left,!r.deleted&&r.countable&&(s-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(s-=r.length);
233
+ return n!==null&&Ce(n.index-s)<r.parent.length/ls?(as(n,r,s),n):mc(e._searchMarker,r,s)},be=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){const s=e[r];if(n>0){let i=s.p;for(i.marker=!1;i&&(i.deleted||!i.countable);)
234
+ i=i.left,i&&!i.deleted&&i.countable&&(s.index-=i.length);if(i===null||i.marker===!0){e.splice(r,1);continue}s.p=i,i.marker=!0}(t<s.index||n>0&&t===s.index)&&(s.index=Ct(t,s.index+n))}},bc=e=>{e.doc??I();
235
+ let t=e._start;const n=[];for(;t;)n.push(t),t=t.right;return n},Be=(e,t,n)=>{const r=e,s=t.changedParentTypes;for(;B(s,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;Fr(r._eH,n,t)};class P{constructor(){
236
+ this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Tr(),this._dEH=Tr(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(t,n){
237
+ this.doc=t,this._item=n}_copy(){throw tt()}clone(){throw tt()}_write(t){}get _first(){let t=this._start;for(;t!==null&&t.deleted;)t=t.right;return t}_callObserver(t,n){!t.local&&this._searchMarker&&(this.
238
+ _searchMarker.length=0)}observe(t){Or(this._eH,t)}observeDeep(t){Or(this._dEH,t)}unobserve(t){Ur(this._eH,t)}unobserveDeep(t){Ur(this._dEH,t)}toJSON(){}}const ds=(e,t,n)=>{e.doc??I(),t<0&&(t=e._length+
239
+ t),n<0&&(n=e._length+n);let r=n-t;const s=[];let i=e._start;for(;i!==null&&r>0;){if(i.countable&&!i.deleted){const o=i.content.getContent();if(o.length<=t)t-=o.length;else{for(let c=t;c<o.length&&r>0;c++)
240
+ s.push(o[c]),r--;t=0}}i=i.right}return s},hs=e=>{e.doc??I();const t=[];let n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let s=0;s<r.length;s++)t.push(r[s])}
241
+ n=n.right}return t},yc=(e,t)=>{const n=[];let r=e._start;for(;r!==null;){if(r.countable&&yt(r,t)){const s=r.content.getContent();for(let i=0;i<s.length;i++)n.push(s[i])}r=r.right}return n},ye=(e,t)=>{
242
+ let n=0,r=e._start;for(e.doc??I();r!==null;){if(r.countable&&!r.deleted){const s=r.content.getContent();for(let i=0;i<s.length;i++)t(s[i],n++,e)}r=r.right}},us=(e,t)=>{const n=[];return ye(e,(r,s)=>{n.
243
+ push(t(r,s,e))}),n},wc=e=>{let t=e._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.
244
+ getContent(),r=0,t=t.right}const s=n[r++];return n.length<=r&&(n=null),{done:!1,value:s}}}},gs=(e,t)=>{e.doc??I();const n=Ve(e,t);let r=e._start;for(n!==null&&(r=n.p,t-=n.index);r!==null;r=r.right)if(!r.
245
+ deleted&&r.countable){if(t<r.length)return r.content.getContent()[t];t-=r.length}},ze=(e,t,n,r)=>{let s=n;const i=e.doc,o=i.clientID,c=i.store,l=n===null?t._start:n.right;let d=[];const a=()=>{d.length>
246
+ 0&&(s=new x(y(o,A(c,o)),s,s&&s.lastId,l,l&&l.id,t,null,new gt(d)),s.integrate(e,0),d=[])};r.forEach(h=>{if(h===null)d.push(h);else switch(h.constructor){case Number:case Object:case Boolean:case Array:case String:
247
+ d.push(h);break;default:switch(a(),h.constructor){case Uint8Array:case ArrayBuffer:s=new x(y(o,A(c,o)),s,s&&s.lastId,l,l&&l.id,t,null,new Ft(new Uint8Array(h))),s.integrate(e,0);break;case rt:s=new x(
248
+ y(o,A(c,o)),s,s&&s.lastId,l,l&&l.id,t,null,new Rt(h)),s.integrate(e,0);break;default:if(h instanceof P)s=new x(y(o,A(c,o)),s,s&&s.lastId,l,l&&l.id,t,null,new K(h)),s.integrate(e,0);else throw new Error(
249
+ "Unexpected content type in insert operation")}}}),a()},fs=()=>mt("Length exceeded!"),ps=(e,t,n,r)=>{if(n>t._length)throw fs();if(n===0)return t._searchMarker&&be(t._searchMarker,n,r.length),ze(e,t,null,
250
+ r);const s=n,i=Ve(t,n);let o=t._start;for(i!==null&&(o=i.p,n-=i.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&
251
+ O(e,y(o.id.client,o.id.clock+n));break}n-=o.length}return t._searchMarker&&be(t._searchMarker,s,r.length),ze(e,t,o,r)},kc=(e,t,n)=>{let r=(t._searchMarker||[]).reduce((s,i)=>i.index>s.index?i:s,{index:0,
252
+ p:t._start}).p;if(r)for(;r.right;)r=r.right;return ze(e,t,r,n)},ms=(e,t,n,r)=>{if(r===0)return;const s=n,i=r,o=Ve(t,n);let c=t._start;for(o!==null&&(c=o.p,n-=o.index);c!==null&&n>0;c=c.right)!c.deleted&&
253
+ c.countable&&(n<c.length&&O(e,y(c.id.client,c.id.clock+n)),n-=c.length);for(;r>0&&c!==null;)c.deleted||(r<c.length&&O(e,y(c.id.client,c.id.clock+r)),c.delete(e),r-=c.length),c=c.right;if(r>0)throw fs();
254
+ t._searchMarker&&be(t._searchMarker,s,-i+r)},We=(e,t,n)=>{const r=t._map.get(n);r!==void 0&&r.delete(e)},Un=(e,t,n,r)=>{const s=t._map.get(n)||null,i=e.doc,o=i.clientID;let c;if(r==null)c=new gt([r]);else
255
+ switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:c=new gt([r]);break;case Uint8Array:c=new Ft(r);break;case rt:c=new Rt(r);break;default:if(r instanceof
256
+ P)c=new K(r);else throw new Error("Unexpected content type")}new x(y(o,A(i.store,o)),s,s&&s.lastId,null,null,t,n,c).integrate(e,0)},Fn=(e,t)=>{e.doc??I();const n=e._map.get(t);return n!==void 0&&!n.deleted?
257
+ n.content.getContent()[n.length-1]:void 0},bs=e=>{const t={};return e.doc??I(),e._map.forEach((n,r)=>{n.deleted||(t[r]=n.content.getContent()[n.length-1])}),t},ys=(e,t)=>{e.doc??I();const n=e._map.get(
258
+ t);return n!==void 0&&!n.deleted},Sc=(e,t,n)=>{let r=e._map.get(t)||null;for(;r!==null&&(!n.sv.has(r.id.client)||r.id.clock>=(n.sv.get(r.id.client)||0));)r=r.left;return r!==null&&yt(r,n)?r.content.getContent()[r.
259
+ length-1]:void 0},ws=(e,t)=>{const n={};return e._map.forEach((r,s)=>{let i=r;for(;i!==null&&(!t.sv.has(i.id.client)||i.id.clock>=(t.sv.get(i.id.client)||0));)i=i.left;i!==null&&yt(i,t)&&(n[s]=i.content.
260
+ getContent()[i.length-1])}),n},Je=e=>(e.doc??I(),yo(e._map.entries(),t=>!t[1].deleted));class ks extends me{}class ht extends P{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){
261
+ const n=new ht;return n.push(t),n}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new ht}clone(){const t=new ht;return t.insert(0,this.
262
+ toArray().map(n=>n instanceof P?n.clone():n)),t}get length(){return this.doc??I(),this._length}_callObserver(t,n){super._callObserver(t,n),Be(this,t,new ks(this,t))}insert(t,n){this.doc!==null?E(this.
263
+ doc,r=>{ps(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}push(t){this.doc!==null?E(this.doc,n=>{kc(n,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,n=1){this.doc!==
264
+ null?E(this.doc,r=>{ms(r,this,t,n)}):this._prelimContent.splice(t,n)}get(t){return gs(this,t)}toArray(){return hs(this)}slice(t=0,n=this.length){return ds(this,t,n)}toJSON(){return this.map(t=>t instanceof
265
+ P?t.toJSON():t)}map(t){return us(this,t)}forEach(t){ye(this,t)}[Symbol.iterator](){return wc(this)}_write(t){t.writeTypeRef(zc)}}const _c=e=>new ht;class Ss extends me{constructor(t,n,r){super(t,n),this.
266
+ keysChanged=r}}class St extends P{constructor(t){super(),this._prelimContent=null,t===void 0?this._prelimContent=new Map:this._prelimContent=new Map(t)}_integrate(t,n){super._integrate(t,n),this._prelimContent.
267
+ forEach((r,s)=>{this.set(s,r)}),this._prelimContent=null}_copy(){return new St}clone(){const t=new St;return this.forEach((n,r)=>{t.set(r,n instanceof P?n.clone():n)}),t}_callObserver(t,n){Be(this,t,new Ss(
268
+ this,t,n))}toJSON(){this.doc??I();const t={};return this._map.forEach((n,r)=>{if(!n.deleted){const s=n.content.getContent()[n.length-1];t[r]=s instanceof P?s.toJSON():s}}),t}get size(){return[...Je(this)].
269
+ length}keys(){return bn(Je(this),t=>t[0])}values(){return bn(Je(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return bn(Je(this),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){
270
+ this.doc??I(),this._map.forEach((n,r)=>{n.deleted||t(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(t){this.doc!==null?E(this.doc,n=>{We(n,this,t)}):this.
271
+ _prelimContent.delete(t)}set(t,n){return this.doc!==null?E(this.doc,r=>{Un(r,this,t,n)}):this._prelimContent.set(t,n),n}get(t){return Fn(this,t)}has(t){return ys(this,t)}clear(){this.doc!==null?E(this.
272
+ doc,t=>{this.forEach(function(n,r,s){We(t,s,r)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(Wc)}}const vc=e=>new St,_t=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&eo(e,t);class Ln{constructor(t,n,r,s){
273
+ this.left=t,this.right=n,this.index=r,this.currentAttributes=s}forward(){switch(this.right===null&&j(),this.right.content.constructor){case D:this.right.deleted||qt(this.currentAttributes,this.right.content);
274
+ break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const _s=(e,t,n)=>{for(;t.right!==null&&n>0;){switch(t.right.content.constructor){case D:
275
+ t.right.deleted||qt(t.currentAttributes,t.right.content);break;default:t.right.deleted||(n<t.right.length&&O(e,y(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length);break}
276
+ t.left=t.right,t.right=t.right.right}return t},Ge=(e,t,n,r)=>{const s=new Map,i=r?Ve(t,n):null;if(i){const o=new Ln(i.p.left,i.p,i.index,s);return _s(e,o,n-i.index)}else{const o=new Ln(null,t._start,0,
277
+ s);return _s(e,o,n)}},vs=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===D&&_t(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.
278
+ content.key),n.forward();const s=e.doc,i=s.clientID;r.forEach((o,c)=>{const l=n.left,d=n.right,a=new x(y(i,A(s.store,i)),l,l&&l.lastId,d,d&&d.id,t,null,new D(c,o));a.integrate(e,0),n.right=a,n.forward()})},
279
+ qt=(e,t)=>{const{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},xs=(e,t)=>{for(;e.right!==null&&(e.right.deleted||e.right.content.constructor===D&&_t(t[e.right.content.key]??null,e.right.content.value));)
280
+ e.forward()},Cs=(e,t,n,r)=>{const s=e.doc,i=s.clientID,o=new Map;for(const c in r){const l=r[c],d=n.currentAttributes.get(c)??null;if(!_t(d,l)){o.set(c,d);const{left:a,right:h}=n;n.right=new x(y(i,A(s.
281
+ store,i)),a,a&&a.lastId,h,h&&h.id,t,null,new D(c,l)),n.right.integrate(e,0),n.forward()}}return o},Rn=(e,t,n,r,s)=>{n.currentAttributes.forEach((u,g)=>{s[g]===void 0&&(s[g]=null)});const i=e.doc,o=i.clientID;
282
+ xs(n,s);const c=Cs(e,t,n,s),l=r.constructor===String?new $(r):r instanceof P?new K(r):new ut(r);let{left:d,right:a,index:h}=n;t._searchMarker&&be(t._searchMarker,n.index,l.getLength()),a=new x(y(o,A(i.
283
+ store,o)),d,d&&d.lastId,a,a&&a.id,t,null,l),a.integrate(e,0),n.right=a,n.index=h,n.forward(),vs(e,t,n,c)},Es=(e,t,n,r,s)=>{const i=e.doc,o=i.clientID;xs(n,s);const c=Cs(e,t,n,s);t:for(;n.right!==null&&
284
+ (r>0||c.size>0&&(n.right.deleted||n.right.content.constructor===D));){if(!n.right.deleted)switch(n.right.content.constructor){case D:{const{key:l,value:d}=n.right.content,a=s[l];if(a!==void 0){if(_t(a,
285
+ d))c.delete(l);else{if(r===0)break t;c.set(l,d)}n.right.delete(e)}else n.currentAttributes.set(l,d);break}default:r<n.right.length&&O(e,y(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}
286
+ n.forward()}if(r>0){let l="";for(;r>0;r--)l+=`
287
+ `;n.right=new x(y(o,A(i.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new $(l)),n.right.integrate(e,0),n.forward()}vs(e,t,n,c)},As=(e,t,n,r,s)=>{let i=t;const o=U();for(;i&&
288
+ (!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===D){const d=i.content;o.set(d.key,d)}i=i.right}let c=0,l=!1;for(;t!==i;){if(n===t&&(l=!0),!t.deleted){const d=t.content;switch(d.constructor){case D:{
289
+ const{key:a,value:h}=d,u=r.get(a)??null;(o.get(a)!==d||u===h)&&(t.delete(e),c++,!l&&(s.get(a)??null)===h&&u!==h&&(u===null?s.delete(a):s.set(a,u))),!l&&!t.deleted&&qt(s,d);break}}}t=t.right}return c},
290
+ xc=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;const n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===D){const r=t.content.key;n.has(r)?
291
+ t.delete(e):n.add(r)}t=t.left}},Ds=e=>{let t=0;return E(e.doc,n=>{let r=e._start,s=e._start,i=U();const o=tn(i);for(;s;){if(s.deleted===!1)switch(s.content.constructor){case D:qt(o,s.content);break;default:
292
+ t+=As(n,r,s,i,o),i=tn(o),r=s;break}s=s.right}}),t},Cc=e=>{const t=new Set,n=e.doc;for(const[r,s]of e.afterState.entries()){const i=e.beforeState.get(r)||0;s!==i&&Jr(e,n.store.clients.get(r),i,s,o=>{!o.
293
+ deleted&&o.content.constructor===D&&o.constructor!==V&&t.add(o.parent)})}E(n,r=>{Pt(e,e.deleteSet,s=>{if(s instanceof V||!s.parent._hasFormatting||t.has(s.parent))return;const i=s.parent;s.content.constructor===
294
+ D?t.add(i):xc(r,s)});for(const s of t)Ds(s)})},Ps=(e,t,n)=>{const r=n,s=tn(t.currentAttributes),i=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case K:case ut:case $:
295
+ n<t.right.length&&O(e,y(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}i&&As(e,i,t.right,s,t.currentAttributes);const o=(t.left||t.right).parent;return o.
296
+ _searchMarker&&be(o._searchMarker,t.index,-r+n),t};class Ns extends me{constructor(t,n,r){super(t,n),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(s=>{s===null?this.childListChanged=!0:this.
297
+ keysChanged.add(s)})}get changes(){if(this._changes===null){const t={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=t}return this._changes}get delta(){if(this._delta===null){
298
+ const t=this.target.doc,n=[];E(t,r=>{const s=new Map,i=new Map;let o=this.target._start,c=null;const l={};let d="",a=0,h=0;const u=()=>{if(c!==null){let g=null;switch(c){case"delete":h>0&&(g={delete:h}),
299
+ h=0;break;case"insert":(typeof d=="object"||d.length>0)&&(g={insert:d},s.size>0&&(g.attributes={},s.forEach((f,p)=>{f!==null&&(g.attributes[p]=f)}))),d="";break;case"retain":a>0&&(g={retain:a},Zi(l)||
300
+ (g.attributes=$i({},l))),a=0;break}g&&n.push(g),c=null}};for(;o!==null;){switch(o.content.constructor){case K:case ut:this.adds(o)?this.deletes(o)||(u(),c="insert",d=o.content.getContent()[0],u()):this.
301
+ deletes(o)?(c!=="delete"&&(u(),c="delete"),h+=1):o.deleted||(c!=="retain"&&(u(),c="retain"),a+=1);break;case $:this.adds(o)?this.deletes(o)||(c!=="insert"&&(u(),c="insert"),d+=o.content.str):this.deletes(
302
+ o)?(c!=="delete"&&(u(),c="delete"),h+=o.length):o.deleted||(c!=="retain"&&(u(),c="retain"),a+=o.length);break;case D:{const{key:g,value:f}=o.content;if(this.adds(o)){if(!this.deletes(o)){const p=s.get(
303
+ g)??null;_t(p,f)?f!==null&&o.delete(r):(c==="retain"&&u(),_t(f,i.get(g)??null)?delete l[g]:l[g]=f)}}else if(this.deletes(o)){i.set(g,f);const p=s.get(g)??null;_t(p,f)||(c==="retain"&&u(),l[g]=p)}else if(!o.
304
+ deleted){i.set(g,f);const p=l[g];p!==void 0&&(_t(p,f)?p!==null&&o.delete(r):(c==="retain"&&u(),f===null?delete l[g]:l[g]=f))}o.deleted||(c==="insert"&&u(),qt(s,o.content));break}}o=o.right}for(u();n.length>
305
+ 0;){const g=n[n.length-1];if(g.retain!==void 0&&g.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class Ut extends P{constructor(t){super(),this._pending=t!==void 0?[()=>this.
306
+ insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??I(),this._length}_integrate(t,n){super._integrate(t,n);try{this._pending.forEach(r=>r())}catch(r){console.error(
307
+ r)}this._pending=null}_copy(){return new Ut}clone(){const t=new Ut;return t.applyDelta(this.toDelta()),t}_callObserver(t,n){super._callObserver(t,n);const r=new Ns(this,t,n);Be(this,t,r),!t.local&&this.
308
+ _hasFormatting&&(t._needFormattingCleanup=!0)}toString(){this.doc??I();let t="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===$&&(t+=n.content.str),n=n.right;return t}toJSON(){
309
+ return this.toString()}applyDelta(t,{sanitize:n=!0}={}){this.doc!==null?E(this.doc,r=>{const s=new Ln(null,this._start,0,new Map);for(let i=0;i<t.length;i++){const o=t[i];if(o.insert!==void 0){const c=!n&&
310
+ typeof o.insert=="string"&&i===t.length-1&&s.right===null&&o.insert.slice(-1)===`
311
+ `?o.insert.slice(0,-1):o.insert;(typeof c!="string"||c.length>0)&&Rn(r,this,s,c,o.attributes||{})}else o.retain!==void 0?Es(r,this,s,o.retain,o.attributes||{}):o.delete!==void 0&&Ps(r,s,o.delete)}}):this.
312
+ _pending.push(()=>this.applyDelta(t))}toDelta(t,n,r){this.doc??I();const s=[],i=new Map,o=this.doc;let c="",l=this._start;function d(){if(c.length>0){const h={};let u=!1;i.forEach((f,p)=>{u=!0,h[p]=f});
313
+ const g={insert:c};u&&(g.attributes=h),s.push(g),c=""}}const a=()=>{for(;l!==null;){if(yt(l,t)||n!==void 0&&yt(l,n))switch(l.content.constructor){case $:{const h=i.get("ychange");t!==void 0&&!yt(l,t)?
314
+ (h===void 0||h.user!==l.id.client||h.type!=="removed")&&(d(),i.set("ychange",r?r("removed",l.id):{type:"removed"})):n!==void 0&&!yt(l,n)?(h===void 0||h.user!==l.id.client||h.type!=="added")&&(d(),i.set(
315
+ "ychange",r?r("added",l.id):{type:"added"})):h!==void 0&&(d(),i.delete("ychange")),c+=l.content.str;break}case K:case ut:{d();const h={insert:l.content.getContent()[0]};if(i.size>0){const u={};h.attributes=
316
+ u,i.forEach((g,f)=>{u[f]=g})}s.push(h);break}case D:yt(l,t)&&(d(),qt(i,l.content));break}l=l.right}d()};return t||n?E(o,h=>{t&&Dn(h,t),n&&Dn(h,n),a()},"cleanup"):a(),s}insert(t,n,r){if(n.length<=0)return;
317
+ const s=this.doc;s!==null?E(s,i=>{const o=Ge(i,this,t,!r);r||(r={},o.currentAttributes.forEach((c,l)=>{r[l]=c})),Rn(i,this,o,n,r)}):this._pending.push(()=>this.insert(t,n,r))}insertEmbed(t,n,r){const s=this.
318
+ doc;s!==null?E(s,i=>{const o=Ge(i,this,t,!r);Rn(i,this,o,n,r||{})}):this._pending.push(()=>this.insertEmbed(t,n,r||{}))}delete(t,n){if(n===0)return;const r=this.doc;r!==null?E(r,s=>{Ps(s,Ge(s,this,t,!0),
319
+ n)}):this._pending.push(()=>this.delete(t,n))}format(t,n,r){if(n===0)return;const s=this.doc;s!==null?E(s,i=>{const o=Ge(i,this,t,!1);o.right!==null&&Es(i,this,o,n,r)}):this._pending.push(()=>this.format(
320
+ t,n,r))}removeAttribute(t){this.doc!==null?E(this.doc,n=>{We(n,this,t)}):this._pending.push(()=>this.removeAttribute(t))}setAttribute(t,n){this.doc!==null?E(this.doc,r=>{Un(r,this,t,n)}):this._pending.
321
+ push(()=>this.setAttribute(t,n))}getAttribute(t){return Fn(this,t)}getAttributes(){return bs(this)}_write(t){t.writeTypeRef(Jc)}}const Ec=e=>new Ut;class jn{constructor(t,n=()=>!0){this._filter=n,this.
322
+ _root=t,this._currentNode=t._start,this._firstCall=!0,t.doc??I()}[Symbol.iterator](){return this}next(){let t=this._currentNode,n=t&&t.content&&t.content.type;if(t!==null&&(!this._firstCall||t.deleted||
323
+ !this._filter(n)))do if(n=t.content.type,!t.deleted&&(n.constructor===st||n.constructor===vt)&&n._start!==null)t=n._start;else for(;t!==null;){const r=t.next;if(r!==null){t=r;break}else t.parent===this.
324
+ _root?t=null:t=t.parent._item}while(t!==null&&(t.deleted||!this._filter(t.content.type)));return this._firstCall=!1,t===null?{value:void 0,done:!0}:(this._currentNode=t,{value:t.content.type,done:!1})}}
325
+ class vt extends P{constructor(){super(),this._prelimContent=[]}get firstChild(){const t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),
326
+ this._prelimContent=null}_copy(){return new vt}clone(){const t=new vt;return t.insert(0,this.toArray().map(n=>n instanceof P?n.clone():n)),t}get length(){return this.doc??I(),this._prelimContent===null?
327
+ this._length:this._prelimContent.length}createTreeWalker(t){return new jn(this,t)}querySelector(t){t=t.toUpperCase();const n=new jn(this,r=>r.nodeName&&r.nodeName.toUpperCase()===t).next();return n.done?
328
+ null:n.value}querySelectorAll(t){return t=t.toUpperCase(),ft(new jn(this,n=>n.nodeName&&n.nodeName.toUpperCase()===t))}_callObserver(t,n){Be(this,t,new Is(this,n,t))}toString(){return us(this,t=>t.toString()).
329
+ join("")}toJSON(){return this.toString()}toDOM(t=document,n={},r){const s=t.createDocumentFragment();return r!==void 0&&r._createAssociation(s,this),ye(this,i=>{s.insertBefore(i.toDOM(t,n,r),null)}),s}insert(t,n){
330
+ this.doc!==null?E(this.doc,r=>{ps(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}insertAfter(t,n){if(this.doc!==null)E(this.doc,r=>{const s=t&&t instanceof P?t._item:t;ze(r,this,s,n)});else{const r=this.
331
+ _prelimContent,s=t===null?0:r.findIndex(i=>i===t)+1;if(s===0&&t!==null)throw mt("Reference item not found");r.splice(s,0,...n)}}delete(t,n=1){this.doc!==null?E(this.doc,r=>{ms(r,this,t,n)}):this._prelimContent.
332
+ splice(t,n)}toArray(){return hs(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return gs(this,t)}slice(t=0,n=this.length){return ds(this,t,n)}forEach(t){ye(this,t)}_write(t){
333
+ t.writeTypeRef(Hc)}}const Ac=e=>new vt;class st extends vt{constructor(t="UNDEFINED"){super(),this.nodeName=t,this._prelimAttrs=new Map}get nextSibling(){const t=this._item?this._item.next:null;return t?
334
+ t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,n){super._integrate(t,n),this._prelimAttrs.forEach((r,s)=>{this.setAttribute(s,r)}),
335
+ this._prelimAttrs=null}_copy(){return new st(this.nodeName)}clone(){const t=new st(this.nodeName),n=this.getAttributes();return Yi(n,(r,s)=>{typeof r=="string"&&t.setAttribute(s,r)}),t.insert(0,this.toArray().
336
+ map(r=>r instanceof P?r.clone():r)),t}toString(){const t=this.getAttributes(),n=[],r=[];for(const c in t)r.push(c);r.sort();const s=r.length;for(let c=0;c<s;c++){const l=r[c];n.push(l+'="'+t[l]+'"')}const i=this.
337
+ nodeName.toLocaleLowerCase(),o=n.length>0?" "+n.join(" "):"";return`<${i}${o}>${super.toString()}</${i}>`}removeAttribute(t){this.doc!==null?E(this.doc,n=>{We(n,this,t)}):this._prelimAttrs.delete(t)}setAttribute(t,n){
338
+ this.doc!==null?E(this.doc,r=>{Un(r,this,t,n)}):this._prelimAttrs.set(t,n)}getAttribute(t){return Fn(this,t)}hasAttribute(t){return ys(this,t)}getAttributes(t){return t?ws(this,t):bs(this)}toDOM(t=document,n={},r){
339
+ const s=t.createElement(this.nodeName),i=this.getAttributes();for(const o in i){const c=i[o];typeof c=="string"&&s.setAttribute(o,c)}return ye(this,o=>{s.appendChild(o.toDOM(t,n,r))}),r!==void 0&&r._createAssociation(
340
+ s,this),s}_write(t){t.writeTypeRef(Gc),t.writeKey(this.nodeName)}}const Dc=e=>new st(e.readKey());class Is extends me{constructor(t,n,r){super(t,r),this.childListChanged=!1,this.attributesChanged=new Set,
341
+ n.forEach(s=>{s===null?this.childListChanged=!0:this.attributesChanged.add(s)})}}class $t extends St{constructor(t){super(),this.hookName=t}_copy(){return new $t(this.hookName)}clone(){const t=new $t(
342
+ this.hookName);return this.forEach((n,r)=>{t.set(r,n)}),t}toDOM(t=document,n={},r){const s=n[this.hookName];let i;return s!==void 0?i=s.createDom(this):i=document.createElement(this.hookName),i.setAttribute(
343
+ "data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(i,this),i}_write(t){t.writeTypeRef(Xc),t.writeKey(this.hookName)}}const Pc=e=>new $t(e.readKey());class Kt extends Ut{get nextSibling(){
344
+ const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_copy(){return new Kt}clone(){const t=new Kt;
345
+ return t.applyDelta(this.toDelta()),t}toDOM(t=document,n,r){const s=t.createTextNode(this.toString());return r!==void 0&&r._createAssociation(s,this),s}toString(){return this.toDelta().map(t=>{const n=[];
346
+ for(const s in t.attributes){const i=[];for(const o in t.attributes[s])i.push({key:o,value:t.attributes[s][o]});i.sort((o,c)=>o.key<c.key?-1:1),n.push({nodeName:s,attrs:i})}n.sort((s,i)=>s.nodeName<i.
347
+ nodeName?-1:1);let r="";for(let s=0;s<n.length;s++){const i=n[s];r+=`<${i.nodeName}`;for(let o=0;o<i.attrs.length;o++){const c=i.attrs[o];r+=` ${c.key}="${c.value}"`}r+=">"}r+=t.insert;for(let s=n.length-
348
+ 1;s>=0;s--)r+=`</${n[s].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(t){t.writeTypeRef(qc)}}const Nc=e=>new Kt;class He{constructor(t,n){this.id=t,this.length=n}get deleted(){
349
+ throw tt()}mergeWith(t){return!1}write(t,n,r){throw tt()}integrate(t,n){throw tt()}}const Ic=0;class V extends He{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor!==t.constructor?
350
+ !1:(this.length+=t.length,!0)}integrate(t,n){n>0&&(this.id.clock+=n,this.length-=n),Wr(t.doc.store,this)}write(t,n){t.writeInfo(Ic),t.writeLen(this.length-n)}getMissing(t,n){return null}}class Ft{constructor(t){
351
+ this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Ft(this.content)}splice(t){throw tt()}mergeWith(t){return!1}integrate(t,n){}delete(t){}gc(t){}write(t,n){
352
+ t.writeBuf(this.content)}getRef(){return 3}}const Mc=e=>new Ft(e.readBuf());class Lt{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Lt(
353
+ this.len)}splice(t){const n=new Lt(this.len-t);return this.len=t,n}mergeWith(t){return this.len+=t.len,!0}integrate(t,n){he(t.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(t){}gc(t){}write(t,n){
354
+ t.writeLen(this.len-n)}getRef(){return 1}}const Tc=e=>new Lt(e.readLen()),Ms=(e,t)=>new rt({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1});class Rt{constructor(t){t._item&&console.error("This d\
355
+ ocument was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=t;const n={};this.opts=n,t.gc||(n.gc=!1),t.autoLoad&&(n.autoLoad=!0),t.meta!==
356
+ null&&(n.meta=t.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Rt(Ms(this.doc.guid,this.opts))}splice(t){throw tt()}mergeWith(t){return!1}integrate(t,n){
357
+ this.doc._item=n,t.subdocsAdded.add(this.doc),this.doc.shouldLoad&&t.subdocsLoaded.add(this.doc)}delete(t){t.subdocsAdded.has(this.doc)?t.subdocsAdded.delete(this.doc):t.subdocsRemoved.add(this.doc)}gc(t){}write(t,n){
358
+ t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}}const Oc=e=>new Rt(Ms(e.readString(),e.readAny()));class ut{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.
359
+ embed]}isCountable(){return!0}copy(){return new ut(this.embed)}splice(t){throw tt()}mergeWith(t){return!1}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeJSON(this.embed)}getRef(){return 5}}const Uc=e=>new ut(
360
+ e.readJSON());class D{constructor(t,n){this.key=t,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new D(this.key,this.value)}splice(t){throw tt()}mergeWith(t){
361
+ return!1}integrate(t,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(t){}gc(t){}write(t,n){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}}const Fc=e=>new D(e.readKey(),
362
+ e.readJSON());class Yt{constructor(t){this.arr=t}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Yt(this.arr)}splice(t){const n=new Yt(this.arr.
363
+ slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){const r=this.arr.length;t.writeLen(r-n);for(let s=n;s<
364
+ r;s++){const i=this.arr[s];t.writeString(i===void 0?"undefined":JSON.stringify(i))}}getRef(){return 2}}const Lc=e=>{const t=e.readLen(),n=[];for(let r=0;r<t;r++){const s=e.readString();s==="undefined"?
365
+ n.push(void 0):n.push(JSON.parse(s))}return new Yt(n)},Rc=Me("node_env")==="development";class gt{constructor(t){this.arr=t,Rc&&mr(t)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){
366
+ return!0}copy(){return new gt(this.arr)}splice(t){const n=new gt(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){
367
+ const r=this.arr.length;t.writeLen(r-n);for(let s=n;s<r;s++){const i=this.arr[s];t.writeAny(i)}}getRef(){return 8}}const jc=e=>{const t=e.readLen(),n=[];for(let r=0;r<t;r++)n.push(e.readAny());return new gt(
368
+ n)};class ${constructor(t){this.str=t}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new $(this.str)}splice(t){const n=new $(this.str.slice(
369
+ t));this.str=this.str.slice(0,t);const r=this.str.charCodeAt(t-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,t-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(t){return this.str+=t.str,!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){
370
+ t.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const Vc=e=>new $(e.readString()),Bc=[_c,vc,Ec,Dc,Ac,Pc,Nc],zc=0,Wc=1,Jc=2,Gc=3,Hc=4,Xc=5,qc=6;class K{constructor(t){this.type=t}getLength(){
371
+ return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new K(this.type._copy())}splice(t){throw tt()}mergeWith(t){return!1}integrate(t,n){this.type._integrate(t.doc,n)}delete(t){
372
+ let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(t.beforeState.get(n.id.client)||0)&&t._mergeStructs.push(n):n.delete(t),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(t.beforeState.
373
+ get(r.id.client)||0)&&t._mergeStructs.push(r):r.delete(t)}),t.changed.delete(this.type)}gc(t){let n=this.type._start;for(;n!==null;)n.gc(t,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{
374
+ for(;r!==null;)r.gc(t,!0),r=r.left}),this.type._map=new Map}write(t,n){this.type._write(t)}getRef(){return 7}}const $c=e=>new K(Bc[e.readTypeRef()](e)),Vn=(e,t)=>{let n=t,r=0,s;do r>0&&(n=y(n.client,n.
375
+ clock+r)),s=Ot(e,n),r=n.clock-s.id.clock,n=s.redone;while(n!==null&&s instanceof x);return{item:s,diff:r}},Bn=(e,t)=>{for(;e!==null&&e.keep!==t;)e.keep=t,e=e.parent._item},Xe=(e,t,n)=>{const{client:r,
376
+ clock:s}=t.id,i=new x(y(r,s+n),t,y(r,s+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&i.markDeleted(),t.keep&&(i.keep=!0),t.redone!==null&&(i.redone=y(t.redone.
377
+ client,t.redone.clock+n)),t.right=i,i.right!==null&&(i.right.left=i),e._mergeStructs.push(i),i.parentSub!==null&&i.right===null&&i.parent._map.set(i.parentSub,i),t.length=n,i},Ts=(e,t)=>pi(e,n=>Nt(n.deletions,
378
+ t)),Os=(e,t,n,r,s,i)=>{const o=e.doc,c=o.store,l=o.clientID,d=t.redone;if(d!==null)return O(e,d);let a=t.parent._item,h=null,u;if(a!==null&&a.deleted===!0){if(a.redone===null&&(!n.has(a)||Os(e,a,n,r,s,
379
+ i)===null))return null;for(;a.redone!==null;)a=O(e,a.redone)}const g=a===null?t.parent:a.content.type;if(t.parentSub===null){for(h=t.left,u=t;h!==null;){let k=h;for(;k!==null&&k.parent._item!==a;)k=k.
380
+ redone===null?null:O(e,k.redone);if(k!==null&&k.parent._item===a){h=k;break}h=h.left}for(;u!==null;){let k=u;for(;k!==null&&k.parent._item!==a;)k=k.redone===null?null:O(e,k.redone);if(k!==null&&k.parent.
381
+ _item===a){u=k;break}u=u.right}}else if(u=null,t.right&&!s){for(h=t;h!==null&&h.right!==null&&(h.right.redone||Nt(r,h.right.id)||Ts(i.undoStack,h.right.id)||Ts(i.redoStack,h.right.id));)for(h=h.right;h.
382
+ redone;)h=O(e,h.redone);if(h&&h.right!==null)return null}else h=g._map.get(t.parentSub)||null;const f=A(c,l),p=y(l,f),_=new x(p,h,h&&h.lastId,u,u&&u.id,g,t.parentSub,t.content.copy());return t.redone=
383
+ p,Bn(_,!0),_.integrate(e,0),_};class x extends He{constructor(t,n,r,s,i,o,c,l){super(t,l.getLength()),this.origin=r,this.left=n,this.right=s,this.rightOrigin=i,this.parent=o,this.parentSub=c,this.redone=
384
+ null,this.content=l,this.info=this.content.isCountable()?er:0}set marker(t){(this.info&on)>0!==t&&(this.info^=on)}get marker(){return(this.info&on)>0}get keep(){return(this.info&tr)>0}set keep(t){this.
385
+ keep!==t&&(this.info^=tr)}get countable(){return(this.info&er)>0}get deleted(){return(this.info&sn)>0}set deleted(t){this.deleted!==t&&(this.info^=sn)}markDeleted(){this.info|=sn}getMissing(t,n){if(this.
386
+ origin&&this.origin.client!==this.id.client&&this.origin.clock>=A(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=
387
+ A(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Mt&&this.id.client!==this.parent.client&&this.parent.clock>=A(n,this.parent.client))return this.parent.
388
+ client;if(this.origin&&(this.left=Nn(t,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=O(t,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===
389
+ V||this.right&&this.right.constructor===V)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===x?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.
390
+ right.constructor===x&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Mt){const r=Ot(n,this.parent);r.constructor===V?this.parent=null:this.parent=
391
+ r.content.type}return null}integrate(t,n){if(n>0&&(this.id.clock+=n,this.left=Nn(t,t.doc.store,y(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.
392
+ length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,s;if(r!==null)s=r.right;else if(this.parentSub!==null)for(s=this.
393
+ parent._map.get(this.parentSub)||null;s!==null&&s.left!==null;)s=s.left;else s=this.parent._start;const i=new Set,o=new Set;for(;s!==null&&s!==this.right;){if(o.add(s),i.add(s),Tt(this.origin,s.origin)){
394
+ if(s.id.client<this.id.client)r=s,i.clear();else if(Tt(this.rightOrigin,s.rightOrigin))break}else if(s.origin!==null&&o.has(Ot(t.doc.store,s.origin)))i.has(Ot(t.doc.store,s.origin))||(r=s,i.clear());else
395
+ break;s=s.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&
396
+ r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==
397
+ null&&this.left.delete(t)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),Wr(t.doc.store,this),this.content.integrate(t,this),Xr(t,this.parent,this.parentSub),
398
+ (this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(t)}else new V(this.id,this.length).integrate(t,0)}get next(){let t=this.right;for(;t!==null&&
399
+ t.deleted;)t=t.right;return t}get prev(){let t=this.left;for(;t!==null&&t.deleted;)t=t.left;return t}get lastId(){return this.length===1?this.id:y(this.id.client,this.id.clock+this.length-1)}mergeWith(t){
400
+ if(this.constructor===t.constructor&&Tt(t.origin,this.lastId)&&this.right===t&&Tt(this.rightOrigin,t.rightOrigin)&&this.id.client===t.id.client&&this.id.clock+this.length===t.id.clock&&this.deleted===
401
+ t.deleted&&this.redone===null&&t.redone===null&&this.content.constructor===t.content.constructor&&this.content.mergeWith(t.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===t&&
402
+ (r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),t.keep&&(this.keep=!0),this.right=t.right,this.right!==null&&(this.right.left=this),this.length+=t.length,!0}return!1}delete(t){if(!this.
403
+ deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),he(t.deleteSet,this.id.client,this.id.clock,this.length),Xr(t,n,this.parentSub),this.content.
404
+ delete(t)}}gc(t,n){if(!this.deleted)throw j();this.content.gc(t),n?Qo(t,this,new V(this.id,this.length)):this.content=new Lt(this.length)}write(t,n){const r=n>0?y(this.id.client,this.id.clock+n-1):this.
405
+ origin,s=this.rightOrigin,i=this.parentSub,o=this.content.getRef()&Ee|(r===null?0:F)|(s===null?0:ct)|(i===null?0:ne);if(t.writeInfo(o),r!==null&&t.writeLeftID(r),s!==null&&t.writeRightID(s),r===null&&
406
+ s===null){const c=this.parent;if(c._item!==void 0){const l=c._item;if(l===null){const d=Cn(c);t.writeParentInfo(!0),t.writeString(d)}else t.writeParentInfo(!1),t.writeLeftID(l.id)}else c.constructor===
407
+ String?(t.writeParentInfo(!0),t.writeString(c)):c.constructor===Mt?(t.writeParentInfo(!1),t.writeLeftID(c)):j();i!==null&&t.writeString(i)}this.content.write(t,n)}}const Us=(e,t)=>Kc[t&Ee](e),Kc=[()=>{
408
+ j()},Tc,Lc,Mc,Vc,Uc,Fc,$c,jc,Oc,()=>{j()}],Yc=10;class L extends He{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor!==t.constructor?!1:(this.length+=t.length,!0)}integrate(t,n){j()}write(t,n){
409
+ t.writeInfo(Yc),m(t.restEncoder,this.length-n)}getMissing(t,n){return null}}const Fs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},Ls="__ $YJS$ __";Fs[Ls]===!0&&
410
+ console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"),Fs[Ls]=!0;var Zc=Object.freeze({__proto__:null,AbsolutePosition:jr,
411
+ AbstractConnector:wo,AbstractStruct:He,AbstractType:P,Array:ht,ContentAny:gt,ContentBinary:Ft,ContentDeleted:Lt,ContentDoc:Rt,ContentEmbed:ut,ContentFormat:D,ContentJSON:Yt,ContentString:$,ContentType:K,
412
+ Doc:rt,GC:V,ID:Mt,Item:x,Map:St,PermanentUserData:To,RelativePosition:Fe,Skip:L,Snapshot:En,Text:Ut,Transaction:Gr,UndoManager:nc,UpdateDecoderV1:X,UpdateDecoderV2:J,UpdateEncoderV1:bt,UpdateEncoderV2:Y,
413
+ XmlElement:st,XmlFragment:vt,XmlHook:$t,XmlText:Kt,YArrayEvent:ks,YEvent:me,YMapEvent:Ss,YTextEvent:Ns,YXmlEvent:Is,applyUpdate:Nr,applyUpdateV2:Ue,cleanupYTextFormatting:Ds,compareIDs:Tt,compareRelativePositions:Jo,
414
+ convertUpdateFormatV1ToV2:uc,convertUpdateFormatV2ToV1:os,createAbsolutePositionFromRelativePosition:Wo,createDeleteSet:Te,createDeleteSetFromStructStore:kn,createDocFromSnapshot:Ko,createID:y,createRelativePositionFromJSON:Uo,
415
+ createRelativePositionFromTypeIndex:Lo,createSnapshot:An,decodeRelativePosition:Bo,decodeSnapshot:Xo,decodeSnapshotV2:Br,decodeStateVector:vn,decodeUpdate:ic,decodeUpdateV2:ts,diffUpdate:ac,diffUpdateV2:Mn,
416
+ emptySnapshot:qo,encodeRelativePosition:jo,encodeSnapshot:Ho,encodeSnapshotV2:Vr,encodeStateAsUpdate:Ao,encodeStateAsUpdateV2:Ir,encodeStateVector:No,encodeStateVectorFromUpdate:oc,encodeStateVectorFromUpdateV2:ns,
417
+ equalDeleteSets:Ar,equalSnapshots:Go,findIndexSS:q,findRootTypeKey:Cn,getItem:Ot,getItemCleanEnd:Nn,getItemCleanStart:O,getState:A,getTypeChildren:bc,isDeleted:Nt,isParentOf:ge,iterateDeletedStructs:Pt,
418
+ logType:Mo,logUpdate:sc,logUpdateV2:Qr,mergeDeleteSets:It,mergeUpdates:es,mergeUpdatesV2:pe,obfuscateUpdate:dc,obfuscateUpdateV2:hc,parseUpdateMeta:cc,parseUpdateMetaV2:rs,readUpdate:Co,readUpdateV2:_n,
419
+ relativePositionToJSON:Oo,snapshot:$o,snapshotContainsUpdate:Zo,transact:E,tryGc:tc,typeListToArraySnapshot:yc,typeMapGetAllSnapshot:ws,typeMapGetSnapshot:Sc});const zn=["lineSpacing","spaceBefore","s\
420
+ paceAfter"],it=(e,t)=>e>>>t|e<<32-t,Qc=e=>it(e,2)^it(e,13)^it(e,22),tl=e=>it(e,6)^it(e,11)^it(e,25),el=e=>it(e,7)^it(e,18)^e>>>3,nl=e=>it(e,17)^it(e,19)^e>>>10,rl=new Uint32Array([1116352408,1899447441,
421
+ 3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,
422
+ 1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,
423
+ 2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,
424
+ 2361852424,2428436474,2756734187,3204031479,3329325298]),sl=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class il{constructor(){const t=new ArrayBuffer(
425
+ 320);this._H=new Uint32Array(t,0,8),this._H.set(sl),this._W=new Uint32Array(t,64,64)}_updateHash(){const t=this._H,n=this._W;for(let h=16;h<64;h++)n[h]=nl(n[h-2])+n[h-7]+el(n[h-15])+n[h-16];let r=t[0],
426
+ s=t[1],i=t[2],o=t[3],c=t[4],l=t[5],d=t[6],a=t[7];for(let h=0,u,g;h<64;h++)u=a+tl(c)+(c&l^~c&d)+rl[h]+n[h]>>>0,g=Qc(r)+(r&s^r&i^s&i)>>>0,a=d,d=l,l=c,c=o+u>>>0,o=i,i=s,s=r,r=u+g>>>0;t[0]+=r,t[1]+=s,t[2]+=
427
+ i,t[3]+=o,t[4]+=c,t[5]+=l,t[6]+=d,t[7]+=a}digest(t){let n=0;for(;n+56<=t.length;){let o=0;for(;o<16&&n+3<t.length;o++)this._W[o]=t[n++]<<24|t[n++]<<16|t[n++]<<8|t[n++];if(n%64!==0){for(this._W.fill(0,
428
+ o,16);n<t.length;)this._W[o]|=t[n]<<(3-n%4)*8,n++;this._W[o]|=F<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let s=0;for(;n<t.length;s++)for(let o=3;o>=0&&n<t.length;o--)this._W[s]|=
429
+ t[n++]<<o*8;r||(this._W[s-(n%4===0?0:1)]|=F<<(3-n%4)*8),this._W[14]=t.byteLength/bi,this._W[15]=t.byteLength*8,this._updateHash();const i=new Uint8Array(32);for(let o=0;o<this._H.length;o++)for(let c=0;c<
430
+ 4;c++)i[o*4+c]=this._H[o]>>>(3-c)*8;return i}}const ol=e=>new il().digest(e),cl="revise:styles:v1",ll="sharedStylesVersion",Rs="_reviseTextStyle",al="_reviseParagraphStyle",js=new Set(["fontFamily","f\
431
+ ontSize","bold","italic","underline","strikethrough","doubleStrikethrough","smallCaps","allCaps","superscript","subscript","hidden","color","backgroundColor","letterSpacing","lang","code","docxRunProp\
432
+ ertyResets","oxmlRPr"]),Vs=new Set(["align","lineSpacing","spaceBefore","spaceAfter","contextualSpacing","direction","tabStops","borders","shading","leftIndent","firstLineIndent","pagination"]);class qe extends Error{constructor(){
433
+ super(...arguments),this.name="SharedStyleError"}}function Bs(e){return JSON.stringify(Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null).sort(([t],[n])=>t<n?-1:t>n?1:0)))}function dl(e,t){return`${e}\
434
+ :${Array.from(ol(new TextEncoder().encode(t)).subarray(0,16),n=>n.toString(16).padStart(2,"0")).join("")}`}function hl(e){return!!e?.share.has("metadata")&&e.getMap("metadata").get(ll)===1}const zs=new WeakMap;
435
+ function Ws(e,t,n){if(t==null)return{};if(!e||typeof t!="string"||!t.startsWith(`${n}:`))throw new qe("Invalid shared style reference");const r=e.getMap(cl).get(t);if(typeof r!="string")throw new qe("\
436
+ Missing shared style definition; resync the document");let s=zs.get(e);s||zs.set(e,s=new Map);const i=s.get(t);if(i?.json===r)return i.marks;if(dl(n,r)!==t)throw new qe("Modified shared style definiti\
437
+ on");const o=JSON.parse(r),c=n==="t"?js:Vs;if(!o||typeof o!="object"||Array.isArray(o)||Object.entries(o).some(([l,d])=>!c.has(l)||!["string","number","boolean"].includes(typeof d)))throw new qe("Inva\
438
+ lid shared style properties");return Object.freeze(o),s.size>=4096&&s.clear(),s.set(t,{json:r,marks:o}),o}function ul(e,t={}){const n={...Ws(e.doc,t[Rs],"t"),...t};delete n[Rs];for(const[r,s]of Object.
439
+ entries(t))js.has(r)&&s!==null&&typeof s=="object"&&s._reviseStyleUnset===1&&Object.keys(s).length===1&&delete n[r];return n}function Js(e){if(!hl(e.doc))return e.toDelta();const t=[];for(const n of e.
440
+ toDelta()){const r=ul(e,n.attributes),s={...n};Object.keys(r).length?s.attributes=r:delete s.attributes;const i=t[t.length-1];i&&typeof i.insert=="string"&&typeof s.insert=="string"&&Bs(i.attributes??
441
+ {})===Bs(s.attributes??{})?i.insert+=s.insert:t.push(s)}return t}function $e(e,t){const n=e.getAttribute(t);return n!=null||!Vs.has(t)||!e.doc?n:Ws(e.doc,e.getAttribute(al),"p")[t]}function gl(e){const t=e.
442
+ notes;if(!t||t.length===0)return;const n=new Map;let r;const s=c=>{if(!c||typeof c!="object")return;if(Array.isArray(c)){for(const d of c)s(d);return}const l=c;if(l.type==="text"){r===void 0&&typeof l.
443
+ text=="string"&&l.text.length>0&&(r=l.marks?.fontFamily),l.marks?.footnoteRef&&!n.has(l.marks.footnoteRef)&&n.set(l.marks.footnoteRef,l.marks?.fontFamily);return}l.children&&s(l.children)};s(e.children);
444
+ let i=!1;const o=t.map(c=>{const l=c.id,d=n.has(l)?n.get(l)??r:r;let a=!1;const h=c.children.map(u=>{if(u.type!=="paragraph"||!Array.isArray(u.children))return u;let g=!1;const f=u.children.map(p=>{if(p.
445
+ type!=="text")return p;const _=p.marks??{};if(_.fontFamily===d||d===void 0&&_.fontFamily===void 0)return p;g=!0;const k={..._};return d===void 0?delete k.fontFamily:k.fontFamily=d,{...p,marks:k}});return g?
446
+ (a=!0,{...u,children:f}):u});return a?(i=!0,{...c,children:h}):c});i&&(e.notes=o)}function Gs(e,t){if(!t)return;const n=new Set(t.split(","));n.has("keepNext")&&(e.keepNext=!0),n.has("keepLines")&&(e.
447
+ keepLines=!0),n.has("noWidow")&&(e.widowControl=!1)}function we(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let t="";for(let n=0;n<6;n++)t+=e.charAt(Math.floor(Math.random()*
448
+ e.length));return t}const fl=[{value:"arial",label:"Arial",cssValue:"Arial, sans-serif"},{value:"helvetica",label:"Helvetica",cssValue:"Helvetica, Arial, sans-serif"},{value:"times",label:"Times New R\
449
+ oman",cssValue:"'Times New Roman', Times, serif"},{value:"computermodern",label:"Computer Modern",cssValue:"KaTeX_Main, 'Times New Roman', serif"},{value:"georgia",label:"Georgia",cssValue:"Georgia, s\
450
+ erif"},{value:"sourceserif4",label:"Source Serif 4",cssValue:"'Source Serif 4', serif"},{value:"garamond",label:"Garamond",cssValue:"Garamond, 'Times New Roman', serif"},{value:"palatino",label:"Palat\
451
+ ino",cssValue:"'Palatino Linotype', Palatino, serif"},{value:"bookman",label:"Bookman",cssValue:"'Bookman Old Style', Bookman, serif"},{value:"verdana",label:"Verdana",cssValue:"Verdana, Geneva, sans-\
452
+ serif"},{value:"trebuchet",label:"Trebuchet MS",cssValue:"'Trebuchet MS', Helvetica, sans-serif"},{value:"courier",label:"Courier New",cssValue:"'Courier New', Courier, monospace"},{value:"lucida",label:"\
453
+ Lucida Console",cssValue:"'Lucida Console', Monaco, monospace"},{value:"impact",label:"Impact",cssValue:"Impact, Charcoal, sans-serif"},{value:"comicsans",label:"Comic Sans MS",cssValue:"'Comic Sans M\
454
+ S', cursive"}];function pl(e){return e.trim().replace(/^["']|["']$/g,"")}const ml=new Map;let Hs={};function bl(e){!e||Object.keys(e).length===0||(Hs={...Hs,...e},ml.clear())}new Set(fl.map(e=>pl(e.cssValue.
455
+ split(",")[0]).toLowerCase()));const yl=["bold","italic","underline","strikethrough","doubleStrikethrough","smallCaps","allCaps","hidden","superscript","subscript"],ke="Arial, sans-serif",wl=new Set(yl);
456
+ function Xs(e){const t=kl(e);for(const n of wl)e?.[n]===!1&&(t[n]=!1);return t}function kl(e){const t={};for(const[n,r]of Object.entries(e??{}))r===!0?t[n]=!0:(typeof r=="string"&&r!==""||typeof r=="n\
457
+ umber")&&(t[n]=r);return t.fontFamily||(t.fontFamily=ke),t}function Sl(e){const t=e;return JSON.stringify(Object.keys(t).sort().map(n=>[n,t[n]]))}function qs(e){const t=[];let n=null;for(const r of e){
458
+ const s=Sl(r.marks??{}),i=t[t.length-1];if(i&&s===n){t[t.length-1]={...i,text:i.text+r.text};continue}t.push(r),n=s}return t}Object.fromEntries("aliceblue:f0f8ff,antiquewhite:faebd7,aqua:00ffff,aquama\
459
+ rine:7fffd4,azure:f0ffff,beige:f5f5dc,bisque:ffe4c4,black:000000,blanchedalmond:ffebcd,blue:0000ff,blueviolet:8a2be2,brown:a52a2a,burlywood:deb887,cadetblue:5f9ea0,chartreuse:7fff00,chocolate:d2691e,c\
460
+ oral:ff7f50,cornflowerblue:6495ed,cornsilk:fff8dc,crimson:dc143c,cyan:00ffff,darkblue:00008b,darkcyan:008b8b,darkgoldenrod:b8860b,darkgray:a9a9a9,darkgreen:006400,darkgrey:a9a9a9,darkkhaki:bdb76b,dark\
461
+ magenta:8b008b,darkolivegreen:556b2f,darkorange:ff8c00,darkorchid:9932cc,darkred:8b0000,darksalmon:e9967a,darkseagreen:8fbc8f,darkslateblue:483d8b,darkslategray:2f4f4f,darkslategrey:2f4f4f,darkturquoi\
462
+ se:00ced1,darkviolet:9400d3,deeppink:ff1493,deepskyblue:00bfff,dimgray:696969,dimgrey:696969,dodgerblue:1e90ff,firebrick:b22222,floralwhite:fffaf0,forestgreen:228b22,fuchsia:ff00ff,gainsboro:dcdcdc,gh\
463
+ ostwhite:f8f8ff,gold:ffd700,goldenrod:daa520,gray:808080,green:008000,greenyellow:adff2f,grey:808080,honeydew:f0fff0,hotpink:ff69b4,indianred:cd5c5c,indigo:4b0082,ivory:fffff0,khaki:f0e68c,lavender:e6\
464
+ e6fa,lavenderblush:fff0f5,lawngreen:7cfc00,lemonchiffon:fffacd,lightblue:add8e6,lightcoral:f08080,lightcyan:e0ffff,lightgoldenrodyellow:fafad2,lightgray:d3d3d3,lightgreen:90ee90,lightgrey:d3d3d3,light\
465
+ pink:ffb6c1,lightsalmon:ffa07a,lightseagreen:20b2aa,lightskyblue:87cefa,lightslategray:778899,lightslategrey:778899,lightsteelblue:b0c4de,lightyellow:ffffe0,lime:00ff00,limegreen:32cd32,linen:faf0e6,m\
466
+ agenta:ff00ff,maroon:800000,mediumaquamarine:66cdaa,mediumblue:0000cd,mediumorchid:ba55d3,mediumpurple:9370db,mediumseagreen:3cb371,mediumslateblue:7b68ee,mediumspringgreen:00fa9a,mediumturquoise:48d1\
467
+ cc,mediumvioletred:c71585,midnightblue:191970,mintcream:f5fffa,mistyrose:ffe4e1,moccasin:ffe4b5,navajowhite:ffdead,navy:000080,oldlace:fdf5e6,olive:808000,olivedrab:6b8e23,orange:ffa500,orangered:ff45\
468
+ 00,orchid:da70d6,palegoldenrod:eee8aa,palegreen:98fb98,paleturquoise:afeeee,palevioletred:db7093,papayawhip:ffefd5,peachpuff:ffdab9,peru:cd853f,pink:ffc0cb,plum:dda0dd,powderblue:b0e0e6,purple:800080,\
469
+ rebeccapurple:663399,red:ff0000,rosybrown:bc8f8f,royalblue:4169e1,saddlebrown:8b4513,salmon:fa8072,sandybrown:f4a460,seagreen:2e8b57,seashell:fff5ee,sienna:a0522d,silver:c0c0c0,skyblue:87ceeb,slateblu\
470
+ e:6a5acd,slategray:708090,slategrey:708090,snow:fffafa,springgreen:00ff7f,steelblue:4682b4,tan:d2b48c,teal:008080,thistle:d8bfd8,tomato:ff6347,turquoise:40e0d0,violet:ee82ee,wheat:f5deb3,white:ffffff,\
471
+ whitesmoke:f5f5f5,yellow:ffff00,yellowgreen:9acd32".split(",").map(e=>e.split(":")));const _l=6,vl=96,Zt=96,xl=1*Zt,Wn=Zt*.5,Cl=1;function El(e){return typeof e!="number"||!Number.isFinite(e)?0:Math.max(
472
+ 0,e)}function Al(e){return typeof e!="number"||!Number.isFinite(e)?0:Math.max(0,Math.round(e))}function Dl(e){if(typeof e!="number"||!Number.isFinite(e))return 0;const t=Math.round(e);return t<0?-1:t>
473
+ 0?1:0}function $s(e,t=Wn){return!Number.isFinite(t)||t<=0?0:Math.max(0,Math.round(El(e)/t))}function Ks(e,t){const n=t?.indentStepPx??Wn;if(t?.firstLine){const s=t?.storedAsUnits?Dl(e):e&&e<0?-1:$s(e,
474
+ n)>0?Cl:0;return s===0?void 0:s}const r=t?.storedAsUnits?Al(e):$s(e,n);return r>0?r:void 0}function Ys(e,t){return typeof e=="object"&&e!==null&&e.constructor?.name===t}function Jn(e){return e instanceof
475
+ st||Ys(e,"YXmlElement")&&typeof e.nodeName=="string"&&typeof e.getAttribute=="function"}function Pl(e){return e instanceof Kt||Ys(e,"YXmlText")&&typeof e.toDelta=="function"}const Nl="Arial, sans-seri\
476
+ f",G=[{attr:"structuralSuggestionId",kind:"string"},{attr:"structuralSuggestionKind",kind:"enum",enum:["insert","delete","split","merge","change"]},{attr:"structuralSuggestionRole",kind:"enum",enum:["\
477
+ before","after"]},{attr:"structuralSuggestionLabel",kind:"string"},{attr:"structuralSuggestionRecord",kind:"string"},{attr:"structuralSuggestionRecords",kind:"string"}],R=[{attr:"diffState",kind:"enum",
478
+ enum:["insert","delete","equal"]},{attr:"suggestionId",kind:"string"}];[...G.map(e=>e.attr),...R.map(e=>e.attr)];const Gn=Object.fromEntries([{type:"paragraph",attrs:[{attr:"heading",kind:"int"},{attr:"\
479
+ align",kind:"string"},{attr:"lineSpacing",kind:"float"},{attr:"spaceBefore",kind:"float"},{attr:"spaceAfter",kind:"float"},{attr:"contextualSpacing",kind:"boolean"},{attr:"styleId",kind:"string"},{attr:"\
480
+ direction",kind:"string"},{attr:"tabStops",kind:"string"},{attr:"borders",kind:"string"},{attr:"shading",kind:"string"},{attr:"oxmlAttrs",kind:"string"},{attr:"oxmlPPr",kind:"string"},{attr:"leftInden\
481
+ t",kind:"float"},{attr:"firstLineIndent",kind:"float"},...G,...R],children:"text"},{type:"list",attrs:[{attr:"variant",kind:"string"},{attr:"startNumber",kind:"int"},{attr:"numberingChainId",kind:"str\
482
+ ing"},{attr:"numberingFormat",kind:"string"},...zn.map(e=>({attr:e,kind:"float"})),{attr:"contextualSpacing",kind:"boolean"},...G,...R],children:"list-items"},{type:"list-item",attrs:[...zn.map(e=>({attr:e,
483
+ kind:"float"})),{attr:"checked",kind:"boolean"},{attr:"indentLevel",kind:"int",validate:e=>e>0},{attr:"direction",kind:"string"},...G],children:"text"},{type:"table",attrs:[{attr:"columnWidths",kind:"\
484
+ json"},{attr:"tableWidth",kind:"int"},{attr:"align",kind:"enum",enum:["left","center","right"]},{attr:"borderColor",kind:"string"},{attr:"borderWidth",kind:"int"},{attr:"borders",kind:"string"},{attr:"\
485
+ cellPadding",kind:"int"},{attr:"hasHeader",kind:"booleanTrue"},{attr:"docxTablePropertyOverrides",kind:"string"},{attr:"oxmlTblPr",kind:"string"},...G,...R],children:"table-rows"},{type:"table-row",attrs:[
486
+ {attr:"oxmlAttrs",kind:"string"},{attr:"oxmlTrPr",kind:"string"},...R,...G],children:"blocks"},{type:"table-cell",attrs:[{attr:"verticalAlign",kind:"string"},{attr:"backgroundColor",kind:"string"},{attr:"\
487
+ borders",kind:"string"},{attr:"padding",kind:"string"},{attr:"colSpan",kind:"int",validate:e=>e>1},{attr:"rowSpan",kind:"int",validate:e=>e>1},{attr:"oxmlTcPr",kind:"string"},...R,...G],children:"bloc\
488
+ ks"},{type:"container",attrs:[{attr:"borderColor",kind:"string"},{attr:"padding",kind:"int"},...G,...R],children:"blocks"},{type:"header-footer",attrs:[{attr:"side",kind:"enum",enum:["header","footer"]},
489
+ {attr:"slot",kind:"enum",enum:["default","first","even"]},{attr:"sectionIndex",kind:"int",validate:e=>e>=0}],children:"blocks"},{type:"footnote",attrs:[{attr:"noteKind",kind:"enum",enum:["endnote"]},...G,
490
+ ...R],children:"blocks"},{type:"code",attrs:[{attr:"language",kind:"string"},{attr:"toolCallId",kind:"string"},{attr:"renderDiagram",kind:"boolean"},{attr:"showDiagramSource",kind:"boolean"},...R,...G],
491
+ children:"rawtext"},{type:"math",attrs:[{attr:"displayMode",kind:"enum",enum:["inline","block"]},{attr:"align",kind:"enum",enum:["left","center","right"]},{attr:"showDiagramSource",kind:"boolean"},...R,
492
+ ...G],children:"rawtext"},{type:"image",attrs:[{attr:"src",kind:"string"},{attr:"sourceUrl",kind:"string"},{attr:"width",kind:"int"},{attr:"height",kind:"int"},{attr:"alt",kind:"string"},{attr:"align",
493
+ kind:"string"},{attr:"uploading",kind:"boolean"},{attr:"tempId",kind:"string"},{attr:"originalFormat",kind:"enum",enum:["emf","wmf"]},{attr:"originalDataUrl",kind:"string"},{attr:"anchorXml",kind:"str\
494
+ ing"},...R,...G],children:"none"},{type:"page-break",attrs:[...R],children:"none"},{type:"docx-raw",attrs:[{attr:"xml",kind:"string"},{attr:"tagName",kind:"string"},{attr:"detail",kind:"string"},{attr:"\
495
+ origin",kind:"enum",enum:["run","body"]},...G,...R],children:"none"},{type:"section-break",attrs:[{attr:"layout",kind:"json"},{attr:"breakType",kind:"enum",enum:["nextPage","continuous","evenPage","od\
496
+ dPage"]},...R],children:"none"},{type:"toc",attrs:[{attr:"direction",kind:"enum",enum:["rtl","ltr"]},{attr:"align",kind:"enum",enum:["left","center","right","justify"]},{attr:"levels",kind:"int",validate:e=>e>=
497
+ 1&&e<=6},{attr:"instr",kind:"string"},{attr:"fontFamily",kind:"string"},{attr:"fontSize",kind:"float",validate:e=>e>=_l&&e<=vl},{attr:"color",kind:"string"},...R],children:"none"},{type:"placeholder",
498
+ attrs:[{attr:"height",kind:"int"}],children:"none"}].map(e=>[e.type,e])),Il={image:{src:"",width:200,height:200},code:{content:""},math:{displayMode:"block"},placeholder:{height:100},list:{variant:"un\
499
+ ordered"}};function Ml(e,t){if(!(t==null||t===""))switch(e.kind){case"string":return t;case"int":{const n=parseInt(t,10);return Number.isNaN(n)||e.validate&&!e.validate(n)?void 0:n}case"float":{const n=parseFloat(
500
+ t);return Number.isNaN(n)||e.validate&&!e.validate(n)?void 0:n}case"boolean":return t==="true"?!0:t==="false"?!1:void 0;case"booleanTrue":return t==="true"?!0:void 0;case"json":try{return JSON.parse(t)}catch{
501
+ return}case"enum":return e.enum?.includes(t)?t:void 0}}function Tl(e){const t=[],n=Js(e);for(const r of n){if(typeof r.insert!="string")continue;const s=r.attributes||{},i={type:"text",text:r.insert,marks:Xs(
502
+ s)};t.push(i)}return qs(t)}function Zs(e){for(let t=0;t<e.length;t++){const n=e.get(t);if(Pl(n))return n}return null}function Qs(e){const t=$e(e,"_emptyTextMarks");let n={fontFamily:Nl};if(t)try{n=JSON.
503
+ parse(t)}catch{}return[{type:"text",text:"",marks:n}]}function Ol(e){const t=Zs(e);if(!t)return Qs(e);const n=Tl(t);return n.length>0?n:Qs(e)}function Ul(e,t){for(const[n,r]of[["leftIndent",!1],["firs\
504
+ tLineIndent",!0]])if(typeof e[n]=="number"){if(e[n]===0)continue;const s=Ks(e[n],{indentStepPx:t.indentStepPx,storedAsUnits:t.storedAsUnits,firstLine:r});s===void 0?delete e[n]:e[n]=s}}function Ke(e,t,n,r){
505
+ const s=e.nodeName,i=Gn[s]??Gn.paragraph,o=Gn[s]?s:"paragraph",c={type:o,id:$e(e,"id")||we()};for(const d of i.attrs){const a=Ml(d,$e(e,d.attr));a!==void 0&&(c[d.field??d.attr]=a)}o==="paragraph"&&Gs(
506
+ c,$e(e,"pagination"));const l=Il[o];if(l)for(const[d,a]of Object.entries(l))c[d]===void 0&&(c[d]=a);switch(i.children){case"text":c.children=Ol(e);break;case"rawtext":{const d=Zs(e);c.content=d?d.toString():
507
+ "";break}case"blocks":{const d=[];for(const a of e.toArray())if(Jn(a)){const h=Ke(a,t);h&&d.push(h)}c.children=d;break}case"list-items":{const d=[];for(const a of e.toArray())if(Jn(a)&&a.nodeName==="l\
508
+ ist-item"){const h=Ke(a,t);h&&d.push(h)}c.children=d;break}case"table-rows":{const d=[];for(const a of e.toArray())if(Jn(a)&&a.nodeName==="table-row"){const h=Ke(a,t);h&&d.push(h)}c.children=d,c.columnWidths===
509
+ void 0&&(c.columnWidths=[]);break}}return(o==="paragraph"||i.children==="text")&&Ul(c,t),c}function Fl(e){return!!e?.children.some(t=>t.type==="text"&&t.text.trim()!=="")}function Ll(e){const t=e.children,
510
+ n=[2,1,0].find(s=>Fl(t[s]))??-1;if(n===-1)return;const r=[];for(let s=0;s<=n;s++){s>0&&r.push({type:"text",text:" "});for(const i of t[s]?.children??[])i.type==="text"&&i.text&&r.push(i)}return{type:"\
511
+ paragraph",id:e.id?`${e.id}-zone`:we(),children:r}}function Rl(e){const t={},n={};for(const r of e){if(r.type!=="header-footer"||r.sectionIndex!==void 0)continue;const s=Ll(r);if(!s)continue;const i=r.
512
+ side==="header"?t:n;i[r.slot]=[s]}return{...Object.keys(t).length>0?{headers:t}:{},...Object.keys(n).length>0?{footers:n}:{}}}const jl=["decimal","lowerRoman","upperRoman"];function ti(e){return typeof e==
513
+ "string"&&jl.includes(e)}const Vl=["top","right","bottom","left"],Bl=["single","double","dotted","dashed"];function ei(e){if(e===null||e==="")return null;if(e===void 0)return;if(typeof e=="string")try{
514
+ e=JSON.parse(e)}catch{return}if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n={offsetFrom:t.offsetFrom==="page"?"page":"text",display:t.display==="firstPage"||t.display==="notFirstPage"?
515
+ t.display:"allPages",zOrder:t.zOrder==="back"?"back":"front"};for(const r of Vl){const s=t[r];if(s!=null){if(!Bl.includes(s.style)||typeof s.color!="string"||!/^#[0-9a-f]{6}$/i.test(s.color)||typeof s.
516
+ widthPt!="number"||!Number.isFinite(s.widthPt)||s.widthPt<.25||s.widthPt>12||typeof s.spacePt!="number"||!Number.isFinite(s.spacePt)||s.spacePt<0||s.spacePt>31)return;n[r]={style:s.style,color:s.color.
517
+ toLowerCase(),widthPt:s.widthPt,spacePt:s.spacePt}}}return n}const Se=(e,t,n)=>typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n?e:void 0;function Hn(e){let t=e;if(typeof e=="string"){const n=e.trim();
518
+ if(n==="")return null;try{t=JSON.parse(n)}catch{return null}}return!t||typeof t!="object"||Array.isArray(t)?null:t}function zl(e){const t=Hn(e);if(!t)return null;const n=typeof t.countBy=="number"&&Number.
519
+ isFinite(t.countBy)&&t.countBy>=1?Math.round(t.countBy):1,r=typeof t.start=="number"&&Number.isFinite(t.start)&&t.start>=1?Math.round(t.start):1,s=t.restart==="newSection"||t.restart==="continuous"?t.
520
+ restart:"newPage",i=typeof t.distancePx=="number"&&Number.isFinite(t.distancePx)&&t.distancePx>=0?t.distancePx:void 0;return{countBy:n,start:r,restart:s,...i!==void 0?{distancePx:i}:{}}}function ni(e){
521
+ const t=Hn(e);if(!t)return null;const n=Se(t.rows,1,200),r=Se(t.pitchPx,8,96);if(n===void 0||r===void 0)return null;const s=Se(t.firstBaselinePx,0,2e3),i=Se(t.distancePx,0,400),o=typeof t.fontFamily==
522
+ "string"&&t.fontFamily.trim()!==""&&t.fontFamily.length<=200?t.fontFamily.trim():void 0,c=Se(t.fontSizePx,4,96);return{rows:Math.round(n),pitchPx:r,...s!==void 0?{firstBaselinePx:s}:{},...i!==void 0?{
523
+ distancePx:i}:{},...o!==void 0?{fontFamily:o}:{},...c!==void 0?{fontSizePx:c}:{}}}function Wl(e){const t=Hn(e);return t?ni({rows:t.gridLines,pitchPx:t.gridPitchPx,fontFamily:t.fontFamily}):null}const Jl=1,
524
+ w={pageBorders:"pageBorders",pageSize:"pageSize",orientation:"pageOrientation",marginPx:"pageMarginPx",marginTopPx:"pageMarginTopPx",marginRightPx:"pageMarginRightPx",marginBottomPx:"pageMarginBottomP\
525
+ x",marginLeftPx:"pageMarginLeftPx",indentStepPx:"indentStepPx",blockSpacingPx:"blockSpacingPx",showPageNumbers:"showPageNumbers",pageNumberPosition:"pageNumberPosition",pageNumberStart:"pageNumberStar\
526
+ t",pageNumberFormat:"pageNumberFormat",pageNumberRestart:"pageNumberRestart",paragraphIndentStorageVersion:"paragraphIndentStorageVersion",hyphenationEnabled:"hyphenationEnabled",lineNumbering:"lineNu\
527
+ mbering",pleadingGrid:"pleadingGrid",columnCount:"columnCount",columnGapTwips:"columnGapTwips",oxmlSectPr:"oxmlSectPr"},Gl=["top-left","top-right","bottom-left","bottom-right"];function ri(e){return typeof e==
528
+ "string"&&Gl.includes(e)}const si={letter:{width:8.5,height:11},tabloid:{width:11,height:17},legal:{width:8.5,height:14},statement:{width:5.5,height:8.5},executive:{width:7.25,height:10.5},folio:{width:8.5,
529
+ height:13},a3:{width:11.6929,height:16.5354},a4:{width:8.2677,height:11.6929},a5:{width:5.8268,height:8.2677},b4:{width:9.8425,height:13.8976},b5:{width:6.9291,height:9.8425}};Object.entries(si).map(([
530
+ e,t])=>({pageSize:e,width:Math.min(t.width,t.height),height:Math.max(t.width,t.height)}));function ii(e){return typeof e=="string"&&Object.prototype.hasOwnProperty.call(si,e)}const Hl=0,Xl=3*Zt,ql=.125*
531
+ Zt,$l=2*Zt,Kl=0,Yl=2*Zt,Zl=12,Ql=1,ta=99999,ot={pageSize:"letter",orientation:"portrait",marginLeftPx:xl,indentStepPx:Wn,blockSpacingPx:Zl,pageNumberPosition:"top-right",pageNumberStart:1,pageNumberFormat:"\
532
+ decimal",columnCount:1,columnGapTwips:720};function Qt(e,t,n){return Math.max(t,Math.min(n,e))}function _e(e){return typeof e!="number"||!Number.isFinite(e)?ot.marginLeftPx:Qt(e,Hl,Xl)}function ea(e){
533
+ return typeof e!="number"||!Number.isFinite(e)?ot.indentStepPx:Qt(e,ql,$l)}function na(e){return typeof e!="number"||!Number.isFinite(e)?ot.blockSpacingPx:Qt(e,Kl,Yl)}function ra(e){return ri(e)?e:ot.
534
+ pageNumberPosition}function sa(e){return typeof e!="number"||!Number.isFinite(e)?ot.pageNumberStart:Qt(Math.round(e),Ql,ta)}function ia(e){return typeof e!="number"||!Number.isFinite(e)?ot.columnCount:
535
+ Qt(Math.round(e),1,12)}function oa(e){return typeof e!="number"||!Number.isFinite(e)?ot.columnGapTwips:Qt(Math.round(e),0,14400)}function Xn(e){const t=e?.pageSize&&ii(e.pageSize)?e.pageSize:ot.pageSize,
536
+ n=e?.orientation==="landscape"||e?.orientation==="portrait"?e.orientation:ot.orientation,r=_e(e?.marginPx);return{pageSize:t,orientation:n,pageBorders:ei(e?.pageBorders),marginTopPx:_e(e?.marginTopPx??
537
+ r),marginRightPx:_e(e?.marginRightPx??r),marginBottomPx:_e(e?.marginBottomPx??r),marginLeftPx:_e(e?.marginLeftPx??r),indentStepPx:ea(e?.indentStepPx),blockSpacingPx:na(e?.blockSpacingPx),showPageNumbers:e?.
538
+ showPageNumbers===!0,pageNumberPosition:ra(e?.pageNumberPosition),pageNumberStart:sa(e?.pageNumberStart),pageNumberFormat:ti(e?.pageNumberFormat)?e.pageNumberFormat:ot.pageNumberFormat,...e?.pageNumberRestart===
539
+ !0?{pageNumberRestart:!0}:{},noteMode:e?.noteMode==="endnotes"?"endnotes":"footnotes",columnCount:ia(e?.columnCount),columnGapTwips:oa(e?.columnGapTwips),hyphenationEnabled:e?.hyphenationEnabled===!0,
540
+ ...(()=>{const s=e?.lineNumbering,i=e?.pleadingGrid,o=Wl(s),c=i!==void 0?ni(i):o;return{lineNumbering:o||c?null:zl(s),pleadingGrid:c}})(),...(()=>{const s=e?.oxmlSectPr;return typeof s=="string"&&s?{oxmlSectPr:s}:
541
+ {}})()}}const ca=[w.pageBorders,w.pageSize,w.orientation,w.marginTopPx,w.marginRightPx,w.marginBottomPx,w.marginLeftPx,w.marginPx,w.indentStepPx,w.blockSpacingPx,w.showPageNumbers,w.pageNumberPosition,
542
+ w.pageNumberStart,w.pageNumberFormat,w.pageNumberRestart,w.hyphenationEnabled,w.lineNumbering,w.pleadingGrid,w.columnCount,w.columnGapTwips,w.oxmlSectPr];function la(e){if(!ca.some(Z=>e.has(Z)))return;
543
+ const t=e.get(w.pageSize),n=e.get(w.orientation),r=e.get(w.marginTopPx),s=e.get(w.marginRightPx),i=e.get(w.marginBottomPx),o=e.get(w.marginLeftPx),c=e.get(w.marginPx),l=e.get(w.indentStepPx),d=e.get(w.
544
+ blockSpacingPx),a=e.get(w.showPageNumbers),h=e.get(w.pageNumberPosition),u=e.get(w.pageNumberStart),g=e.get(w.hyphenationEnabled),f=e.get(w.lineNumbering),p=e.get(w.pleadingGrid),_=e.get(w.columnCount),
545
+ k=e.get(w.columnGapTwips),b=e.get(w.oxmlSectPr),M=ii(t)?t:void 0;return Xn({pageSize:M,orientation:n==="portrait"||n==="landscape"?n:void 0,marginTopPx:typeof r=="number"?r:void 0,marginRightPx:typeof s==
546
+ "number"?s:void 0,marginBottomPx:typeof i=="number"?i:void 0,marginLeftPx:typeof o=="number"?o:void 0,marginPx:typeof c=="number"?c:void 0,indentStepPx:typeof l=="number"?l:void 0,blockSpacingPx:typeof d==
547
+ "number"?d:void 0,showPageNumbers:typeof a=="boolean"?a:void 0,pageNumberPosition:ri(h)?h:void 0,pageNumberStart:typeof u=="number"?u:void 0,pageNumberFormat:ti(e.get(w.pageNumberFormat))?e.get(w.pageNumberFormat):
548
+ void 0,pageNumberRestart:e.get(w.pageNumberRestart)===!0?!0:void 0,hyphenationEnabled:typeof g=="boolean"?g:void 0,pageBorders:ei(e.get(w.pageBorders)),lineNumbering:typeof f=="string"?f:void 0,pleadingGrid:typeof p==
549
+ "string"?p:void 0,columnCount:typeof _=="number"?_:void 0,columnGapTwips:typeof k=="number"?k:void 0,oxmlSectPr:typeof b=="string"&&b?b:void 0})}function aa(e,t){return typeof e=="object"&&e!==null&&e.
550
+ constructor?.name===t}function qn(e){return e instanceof st||aa(e,"YXmlElement")&&typeof e.nodeName=="string"&&typeof e.getAttribute=="function"&&typeof e.setAttribute=="function"&&typeof e.get=="func\
551
+ tion"&&typeof e.length=="number"}function da(e){return e.get(w.paragraphIndentStorageVersion)===Jl}function ha(e){return e.share.has("paragraphs")?e.getArray("paragraphs").length>0:!1}function ua(e){return e.
552
+ share.has("content")?e.getXmlFragment("content").length>0:!1}function ga(e){return!!(ua(e)||ha(e))}const oi={indentStepPx:Xn(void 0).indentStepPx,storedAsUnits:!1};function ci(e,t,n=!1){return Ks(e,{indentStepPx:t.
553
+ indentStepPx,storedAsUnits:t.storedAsUnits,firstLine:n})}function li(e){const t=e.getMap("metadata"),n=t?.get("title"),r=t?.get("pageless"),s=la(t),i={indentStepPx:Xn(s).indentStepPx,storedAsUnits:da(
554
+ t)},o=e.getXmlFragment("content");let c;if(o.length>0){c=[];for(const C of o.toArray())if(qn(C)){const v=$n(C,i);v&&c.push(v)}}else{const C=e.getArray("paragraphs"),v=t?.get("defaultFontFamily");c=[],
555
+ C.forEach(xt=>{const Q=ve(xt,v,i);Q&&c.push(Q)})}const l={type:"doc",children:c};n&&(l.title=n),r!==void 0&&(l.pageless=r),s&&(l.pageLayout=s);const d=t?.get("coreProperties");d&&typeof d=="object"&&Object.
556
+ keys(d).length>0&&(l.coreProperties={...d});const a=t?.get("fontSubstitutes");a&&typeof a=="object"&&Object.keys(a).length>0&&(l.fontSubstitutes={...a},bl(l.fontSubstitutes));const h=e.getXmlFragment(
557
+ "chrome"),u=[];for(const C of h.toArray())if(qn(C)){const v=$n(C,i);v&&v.type==="header-footer"&&u.push(v)}u.length>0&&(l.chrome=u);const g=e.getXmlFragment("notes"),f=[];for(const C of g.toArray())if(qn(
558
+ C)){const v=$n(C,i);v&&v.type==="footnote"&&f.push(v)}const p=l.children.filter(C=>C.type==="footnote");p.length>0&&(l.children=l.children.filter(C=>C.type!=="footnote"),f.push(...p)),f.length>0&&(l.notes=
559
+ f,gl(l));const _=Rl(u),k=t?.get("headers"),b=t?.get("footers"),M=_.headers??(k&&Object.keys(k).length>0?k:void 0),Z=_.footers??(b&&Object.keys(b).length>0?b:void 0);M&&(l.headers=M),Z&&(l.footers=Z);const xe=e.
560
+ getMap("comments");if(xe.size>0){const C=[];xe.forEach(v=>{v&&typeof v=="object"&&C.push(v)}),C.length>0&&(C.sort((v,xt)=>(v.createdAt??"").localeCompare(xt.createdAt??"")),l.comments=C)}const te=e.getMap(
561
+ "sdt-wrappers");if(te.size>0){const C=[];if(te.forEach(v=>{v&&typeof v=="object"&&C.push(v)}),C.length>0){const v=new Map;l.children.forEach((Q,Qe)=>{Q.id&&v.set(Q.id,Qe)});const xt=Q=>Q.blockIds?.[0]??
562
+ Q.startBlockId??"";C.sort((Q,Qe)=>(v.get(xt(Q))??Number.MAX_SAFE_INTEGER)-(v.get(xt(Qe))??Number.MAX_SAFE_INTEGER)||Q.id.localeCompare(Qe.id)),l.sdtWrappers=C}}const ee=e.getMap("oxml-ranges");if(ee.size>
563
+ 0){const C=[];ee.forEach(v=>{v&&typeof v=="object"&&C.push(v)}),C.length>0&&(C.sort((v,xt)=>v.id.localeCompare(xt.id)),l.oxmlRanges=C)}const Vt=e.getMap("metadata").get("stylesXml");typeof Vt=="string"&&
564
+ Vt.length>0&&(l.stylesXml=Vt);const Bt=e.getMap("metadata").get("stylesheet");Bt&&typeof Bt=="object"&&Array.isArray(Bt.paragraphStyles)&&Bt.paragraphStyles.length>0&&(l.stylesheet=Bt);const zt=e.getMap(
565
+ "metadata").get("docxSource");zt&&typeof zt=="object"&&Array.isArray(zt.spans)&&(l.docxSource=zt);const Kn=e.getMap("metadata").get("watermark");typeof Kn=="string"&&Kn.length>0&&(l.watermark=Kn);const Yn=e.
566
+ getMap("metadata").get("chromeImages");return Array.isArray(Yn)&&Yn.length>0&&(l.chromeImages=Yn),l}function $n(e,t=oi){return Ke(e,t)}function ve(e,t,n=oi){const r=e.get("type")||"paragraph",s=e.get(
567
+ "id")||we();switch(r){case"page-break":const i={type:"page-break",id:s};{const o=e.get("diffState"),c=e.get("suggestionId");(o==="insert"||o==="delete"||o==="equal")&&(i.diffState=o),typeof c=="string"&&
568
+ (i.suggestionId=c)}return i;case"section-break":{const o={type:"section-break",id:s},c=e.get("layout");if(typeof c=="string")try{o.layout=JSON.parse(c)}catch{}const l=e.get("breakType");(l==="nextPage"||
569
+ l==="continuous"||l==="evenPage"||l==="oddPage")&&(o.breakType=l);const d=e.get("diffState"),a=e.get("suggestionId");return(d==="insert"||d==="delete"||d==="equal")&&(o.diffState=d),typeof a=="string"&&
570
+ (o.suggestionId=a),o}case"toc":{const o={type:"toc",id:s},c=e.get("levels");typeof c=="number"&&c>=1&&c<=6&&(o.levels=c);const l=e.get("instr");typeof l=="string"&&l!==""&&(o.instr=l);const d=e.get("d\
571
+ irection"),a=e.get("align");(d==="rtl"||d==="ltr")&&(o.direction=d),(a==="left"||a==="center"||a==="right"||a==="justify")&&(o.align=a);const h=e.get("fontFamily");typeof h=="string"&&h!==""&&(o.fontFamily=
572
+ h);const u=e.get("fontSize");typeof u=="number"&&u>0&&(o.fontSize=u);const g=e.get("color");typeof g=="string"&&g!==""&&(o.color=g);const f=e.get("diffState"),p=e.get("suggestionId");return(f==="inser\
573
+ t"||f==="delete"||f==="equal")&&(o.diffState=f),typeof p=="string"&&(o.suggestionId=p),o}case"placeholder":return{type:"placeholder",id:s,height:e.get("height")||100};case"image":{const o={type:"image",
574
+ id:s,src:e.get("src")||"",sourceUrl:e.get("sourceUrl")||void 0,width:e.get("width")||200,height:e.get("height")||200,alt:e.get("alt")||void 0,align:e.get("align")||void 0},c=e.get("diffState"),l=e.get(
575
+ "suggestionId");(c==="insert"||c==="delete"||c==="equal")&&(o.diffState=c),typeof l=="string"&&(o.suggestionId=l);const d=e.get("uploading");d!==void 0&&(o.uploading=d);const a=e.get("tempId");a&&(o.tempId=
576
+ a);const h=e.get("originalFormat");(h==="emf"||h==="wmf")&&(o.originalFormat=h);const u=e.get("originalDataUrl");typeof u=="string"&&u&&(o.originalDataUrl=u);const g=e.get("anchorXml");return typeof g==
577
+ "string"&&g&&(o.anchorXml=g),o}case"list":{const o=e.get("items"),c=[];o&&o.forEach(u=>{const g=fa(u);g&&c.push(g)});const l={type:"list",id:s,variant:e.get("variant")||"unordered",children:c},d=e.get(
578
+ "startNumber");d!==void 0&&(l.startNumber=d);const a=e.get("numberingChainId");a&&(l.numberingChainId=a);const h=e.get("numberingFormat");return h&&(l.numberingFormat=h),l}case"footnote":{const o=e.get(
579
+ "children"),c=[];o&&o.forEach(d=>{const a=ve(d,t,n);a&&c.push(a)});const l={type:"footnote",id:s,children:c};return e.get("noteKind")==="endnote"&&(l.noteKind="endnote"),l}case"container":{const o=e.get(
580
+ "children"),c=[];o&&o.forEach(h=>{const u=ve(h,t,n);u&&c.push(u)});const l={type:"container",id:s,children:c},d=e.get("borderColor");d&&(l.borderColor=d);const a=e.get("padding");return typeof a=="num\
581
+ ber"&&(l.padding=a),l}case"table":{const o=e.get("children"),c=[];o&&o.forEach(b=>{const M=b.get("id")||we(),Z=b.get("children"),xe=[];Z&&Z.forEach(Bt=>{const zt=ve(Bt,t,n);zt&&xe.push(zt)});const te={
582
+ type:"table-row",id:M,children:xe},ee=b.get("oxmlAttrs");typeof ee=="string"&&ee&&(te.oxmlAttrs=ee);const Vt=b.get("oxmlTrPr");typeof Vt=="string"&&Vt&&(te.oxmlTrPr=Vt),c.push(te)});const l=e.get("col\
583
+ umnWidths")||[],d={type:"table",id:s,children:c,columnWidths:l},a=e.get("tableWidth"),h=e.get("align"),u=e.get("borderColor"),g=e.get("borderWidth"),f=e.get("borders"),p=e.get("cellPadding"),_=e.get("\
584
+ hasHeader");a!==void 0&&(d.tableWidth=a),(h==="left"||h==="center"||h==="right")&&(d.align=h),u&&(d.borderColor=u),g!==void 0&&(d.borderWidth=g),typeof f=="string"&&f&&(d.borders=f),p!==void 0&&(d.cellPadding=
585
+ p),_!==void 0&&(d.hasHeader=_);const k=e.get("oxmlTblPr");return typeof k=="string"&&k&&(d.oxmlTblPr=k),d}case"table-cell":{const o=e.get("children"),c=[];o&&o.forEach(_=>{const k=ve(_,t,n);k&&c.push(
586
+ k)});const l={type:"table-cell",id:s,children:c},d=e.get("verticalAlign"),a=e.get("backgroundColor");d&&(l.verticalAlign=d),a&&(l.backgroundColor=a);const h=e.get("borders"),u=e.get("padding");typeof h==
587
+ "string"&&h&&(l.borders=h),typeof u=="string"&&u&&(l.padding=u);const g=Number(e.get("colSpan")),f=Number(e.get("rowSpan"));Number.isFinite(g)&&g>1&&(l.colSpan=g),Number.isFinite(f)&&f>1&&(l.rowSpan=f);
588
+ const p=e.get("oxmlTcPr");return typeof p=="string"&&p&&(l.oxmlTcPr=p),l}case"code":{const o=e.get("renderDiagram"),c=e.get("showDiagramSource"),l={type:"code",id:s,content:e.get("content")||"",language:e.
589
+ get("language")||void 0,renderDiagram:typeof o=="boolean"?o:void 0,showDiagramSource:typeof c=="boolean"?c:void 0},d=e.get("diffState"),a=e.get("suggestionId");return(d==="insert"||d==="delete"||d==="\
590
+ equal")&&(l.diffState=d),typeof a=="string"&&(l.suggestionId=a),l}case"math":{const o=e.get("displayMode")||"block",c={type:"math",id:s,content:e.get("content")||"",displayMode:o},l=e.get("align");(l===
591
+ "left"||l==="center"||l==="right"||l==="justify")&&(c.align=l);const d=e.get("diffState"),a=e.get("suggestionId");return(d==="insert"||d==="delete"||d==="equal")&&(c.diffState=d),typeof a=="string"&&(c.
592
+ suggestionId=a),e.get("showDiagramSource")===!0&&(c.showDiagramSource=!0),c}case"paragraph":default:{const o={type:"paragraph",id:s,children:[]},c=e.get("heading"),l=e.get("align"),d=e.get("lineSpacin\
593
+ g"),a=e.get("leftIndent"),h=e.get("firstLineIndent"),u=e.get("structuralSuggestionId"),g=e.get("structuralSuggestionKind"),f=e.get("structuralSuggestionRole");c!==void 0&&(o.heading=c),l!==void 0&&(o.
594
+ align=l),d!==void 0&&(o.lineSpacing=d),Gs(o,e.get("pagination"));{const b=e.get("styleId");typeof b=="string"&&b&&(o.styleId=b)}{const b=e.get("direction");(b==="rtl"||b==="ltr")&&(o.direction=b)}{const b=e.
595
+ get("tabStops");typeof b=="string"&&b&&(o.tabStops=b)}{const b=e.get("borders");typeof b=="string"&&b&&(o.borders=b)}{const b=e.get("shading");typeof b=="string"&&b&&(o.shading=b)}{const b=e.get("oxml\
596
+ Attrs");typeof b=="string"&&b&&(o.oxmlAttrs=b);const M=e.get("oxmlPPr");typeof M=="string"&&M&&(o.oxmlPPr=M)}typeof u=="string"&&(o.structuralSuggestionId=u),(g==="insert"||g==="delete"||g==="split"||
597
+ g==="merge"||g==="change")&&(o.structuralSuggestionKind=g),(f==="before"||f==="after")&&(o.structuralSuggestionRole=f);const p=ci(a,n);a===0?o.leftIndent=0:p!==void 0&&(o.leftIndent=p);const _=ci(h,n,
598
+ !0);h===0?o.firstLineIndent=0:_!==void 0&&(o.firstLineIndent=_);const k=e.get("content");if(k){const b=ai(k);if(b.length>0)o.children=b;else{const M=e.get("_emptyTextMarks"),Z={type:"text",text:""};M&&
599
+ Object.keys(M).length>0?Z.marks=M:Z.marks={fontFamily:ke},o.children=[Z]}}else o.children=[{type:"text",text:"",marks:{fontFamily:ke}}];return t&&o.children.forEach(b=>{b.type==="text"&&(b.marks={fontFamily:t,
600
+ ...b.marks||{}})}),o}}}function fa(e){if(!e)return null;const t={type:"list-item",id:e.get("id")||we(),children:[]},n=e.get("checked");n!==void 0&&(t.checked=n);const r=e.get("indentLevel");typeof r==
601
+ "number"&&r>0&&(t.indentLevel=r);for(const o of zn){const c=e.get(o);typeof c=="number"&&Number.isFinite(c)&&c>=0&&(t[o]=c)}const s=e.get("direction");(s==="rtl"||s==="ltr")&&(t.direction=s);const i=e.
602
+ get("content");if(i){const o=ai(i);if(o.length>0)t.children=o;else{const c=e.get("_emptyTextMarks");t.children=[{type:"text",text:"",marks:c||{fontFamily:ke}}]}}else t.children=[{type:"text",text:"",marks:{
603
+ fontFamily:ke}}];return t}function ai(e){const t=[];return Js(e).forEach(n=>{if(typeof n.insert=="string"){const r=n.attributes||{},s={type:"text",text:n.insert};s.marks=Xs(r),t.push(s)}}),qs(t)}function jt(e,t){
604
+ let n=e;for(let r=0;r<t.length;r++)n^=t.charCodeAt(r),n=Math.imul(n,16777619);return n>>>0}function di(e,t){if(!e||typeof e!="object")return t;let n=t;if(typeof e.type=="string"&&(n=jt(n,e.type)),typeof e.
605
+ text=="string"&&(n=jt(n,e.text)),typeof e.content=="string"&&(n=jt(n,e.content)),typeof e.language=="string"&&(n=jt(n,e.language)),e.marks&&(n=jt(n,JSON.stringify(e.marks))),Array.isArray(e.children)){
606
+ n=jt(n,"[");for(const r of e.children)n=di(r,n);n=jt(n,"]")}return n>>>0}function pa(e){return di(e,2166136261)}function Ye(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=
607
+ t.charCodeAt(r);return n}function Ze(e,t){try{Nr(e,t),ga(e)||hi(e,t)}catch{hi(e,t)}}function hi(e,t){const n=Zc;if(typeof n.applyUpdateV2=="function")try{n.applyUpdateV2(e,t)}catch(r){console.warn("[H\
608
+ istoryWorker] Failed to apply V2 update:",r)}}function ma(e){const t=new rt({gc:!1});try{const n=Ye(e.snapshotB64);Ze(t,n);const r=e.uptoIndex<0?e.updatesB64.length:e.uptoIndex;for(let s=0;s<r&&s<e.updatesB64.
609
+ length;s++)Ze(t,Ye(e.updatesB64[s]));return li(t)}finally{t.destroy()}}function ba(e){const t=new Set(e.candidateIds),n=[];let r=null;for(const s of e.segments){const i=new rt({gc:!1});try{Ze(i,Ye(s.snapshotB64));
610
+ for(let o=0;o<s.updatesB64.length;o++){Ze(i,Ye(s.updatesB64[o]));const c=s.startUpdateId+o;if(!t.has(c))continue;const l=pa(li(i));l!==r&&(r=l,n.push(c))}}finally{i.destroy()}}return n}self.onmessage=
611
+ e=>{const t=e.data;try{if(t.kind==="filterDistinct"){const s=ba(t),i={id:t.id,kind:"filterDistinct",success:!0,distinctIds:s};self.postMessage(i);return}const n=ma(t),r={id:t.id,success:!0,doc:n};self.
612
+ postMessage(r)}catch(n){const r={id:t.id,kind:t.kind==="filterDistinct"?"filterDistinct":"materialize",success:!1,error:n instanceof Error?n.message:String(n)};self.postMessage(r)}}})();