@tempots/beatui 0.87.2 → 0.87.4

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 (147) hide show
  1. package/dist/{ar-DjMvIww5.js → ar-Dn7AkNO5.js} +1 -1
  2. package/dist/auth/index.cjs.js +1 -1
  3. package/dist/auth/index.es.js +1 -1
  4. package/dist/{auth-divider-BIefTDoO.js → auth-divider-BZPM2Xd3.js} +101 -103
  5. package/dist/{auth-divider-V_Se6Qhe.cjs → auth-divider-Cj-xJxF_.cjs} +1 -1
  6. package/dist/beatui.css +23 -0
  7. package/dist/beatui.tailwind.css +23 -0
  8. package/dist/better-auth/index.cjs.js +1 -1
  9. package/dist/better-auth/index.es.js +12 -12
  10. package/dist/{colors-BmLYKmoH.js → colors-CatA-RXf.js} +9 -9
  11. package/dist/{de-wChFYqM4.js → de-QYhBiWv7.js} +1 -1
  12. package/dist/deep-merge-BmxkFFi1.cjs +1 -0
  13. package/dist/{deep-merge-BRqRzEQs.js → deep-merge-D076XcC5.js} +152 -156
  14. package/dist/{duration-input-BDEb1Bb7.js → duration-input-6RN16H08.js} +5 -5
  15. package/dist/{duration-input-BtFL5Vjx.cjs → duration-input-CJU-yeKk.cjs} +1 -1
  16. package/dist/{editor-toolbar-group-CwCCGzEC.js → editor-toolbar-group-DRCbXeQP.js} +6 -3
  17. package/dist/{es-CmPF3IGl.js → es-Ba31pZAd.js} +1 -1
  18. package/dist/{fa-D696e75R.js → fa-DvLjl_Ha.js} +1 -1
  19. package/dist/{fr-B0jeX1Hx.js → fr-D64yBpAp.js} +1 -1
  20. package/dist/{he-SgAsIYJA.js → he-DHZGEQ7C.js} +1 -1
  21. package/dist/{hi-s9oiIihq.js → hi-CeAXVCvp.js} +1 -1
  22. package/dist/{index-CaWDj1Vg.cjs → index-BIGCKfNz.cjs} +10 -10
  23. package/dist/{index-DdqGL9Jk.js → index-BTITknMc.js} +701 -684
  24. package/dist/{index-qa82MK4Z.cjs → index-Bso_SkEn.cjs} +1 -1
  25. package/dist/{index-B0t-nt7i.js → index-DWDC-qRY.js} +4 -4
  26. package/dist/{index-D2_J_-XS.js → index-rHnH2IGb.js} +77 -77
  27. package/dist/index.cjs.js +2 -2
  28. package/dist/index.es.js +1015 -1018
  29. package/dist/{index.esm-ChUrm4xR.js → index.esm-By0m3ki1.js} +3 -3
  30. package/dist/{input-container-DhUiLmXE.js → input-container-BTyCOubf.js} +1 -1
  31. package/dist/{it-Dc4IMciD.js → it-Im0KgKWL.js} +1 -1
  32. package/dist/{ja-D2t2g5xj.js → ja-lliCbC19.js} +1 -1
  33. package/dist/json-schema/index.cjs.js +1 -1
  34. package/dist/json-schema/index.es.js +97 -103
  35. package/dist/json-schema-display/index.cjs.js +1 -1
  36. package/dist/json-schema-display/index.es.js +15 -15
  37. package/dist/json-structure/index.cjs.js +1 -1
  38. package/dist/json-structure/index.es.js +349 -351
  39. package/dist/{ko-BRylA5JZ.js → ko-B9W4RBBs.js} +1 -1
  40. package/dist/lexical/index.cjs.js +5 -12
  41. package/dist/lexical/index.es.js +54 -84
  42. package/dist/{menu-Ui4lUPHM.js → menu-CV85y3Xf.js} +1 -1
  43. package/dist/{modal-Dkje8L_l.js → modal-CD3DwAlD.js} +5 -5
  44. package/dist/{modal-Coenk8Fy.cjs → modal-jJMS0ZlW.cjs} +1 -1
  45. package/dist/monaco/index.es.js +1 -1
  46. package/dist/{nl-Dh7LUWAn.js → nl-ba5SyHsw.js} +1 -1
  47. package/dist/notice-9lpZ-VDn.cjs +1 -0
  48. package/dist/{notice-BmkckDsD.js → notice-Cc26kgiB.js} +26 -28
  49. package/dist/{oneof-branch-detection-Vov_e3kI.cjs → oneof-branch-detection-BsGhMslW.cjs} +6 -6
  50. package/dist/{oneof-branch-detection-BED_n2MT.js → oneof-branch-detection-DiAtgGQH.js} +1740 -1734
  51. package/dist/{pl-XEG-p1Q9.js → pl-DCiJAZWC.js} +1 -1
  52. package/dist/prosemirror/index.cjs.js +1 -1
  53. package/dist/prosemirror/index.es.js +1 -1
  54. package/dist/{pt-DYsDA2sZ.js → pt-Df5bAGWA.js} +1 -1
  55. package/dist/{ru-BTKBykp-.js → ru-Dg-c670Y.js} +1 -1
  56. package/dist/stack-4VUGISn6.cjs +1 -0
  57. package/dist/{stack-BJgsPJ9A.js → stack-Bm-UZosx.js} +145 -139
  58. package/dist/tailwind/preset.es.js +2 -2
  59. package/dist/tailwind/vite-plugin.es.js +1 -1
  60. package/dist/{text-input-BZmAB3_o.js → text-input-Cux5iiUC.js} +5 -5
  61. package/dist/{theme-BzpMLdvH.js → theme-kQZEeusG.js} +4 -4
  62. package/dist/{toolbar-Pdj-F80l.js → toolbar-DYmKrtic.js} +1 -1
  63. package/dist/{tr-Cp8ZCUic.js → tr-Dhpiq0u_.js} +1 -1
  64. package/dist/{translations-BGblCUBj.js → translations-BLlzvZgw.js} +30 -30
  65. package/dist/{translations-jUYta1_1.js → translations-COSDzhvR.js} +1 -1
  66. package/dist/types/auth-i18n/translations.d.ts +2 -2
  67. package/dist/types/beatui-i18n/translations.d.ts +2 -2
  68. package/dist/types/better-auth/components/authenticated.d.ts +2 -2
  69. package/dist/types/better-auth/components/better-auth-container.d.ts +1 -1
  70. package/dist/types/better-auth/i18n/translations.d.ts +2 -2
  71. package/dist/types/better-auth/provider.d.ts +2 -2
  72. package/dist/types/components/auth/auth-container.d.ts +1 -1
  73. package/dist/types/components/auth/auth-email-prop.d.ts +1 -1
  74. package/dist/types/components/beatui.d.ts +1 -1
  75. package/dist/types/components/button/button.d.ts +1 -1
  76. package/dist/types/components/content/native-pdf-preview.d.ts +1 -1
  77. package/dist/types/components/content/pdfjs-preview.d.ts +1 -1
  78. package/dist/types/components/data/icon.d.ts +1 -1
  79. package/dist/types/components/data/page-drop-zone.d.ts +1 -1
  80. package/dist/types/components/data/unstyled-drop-zone.d.ts +1 -1
  81. package/dist/types/components/editor-toolbar/editor-toolbar-button.d.ts +1 -1
  82. package/dist/types/components/editor-toolbar/editor-toolbar-group.d.ts +1 -1
  83. package/dist/types/components/form/control/control.d.ts +2 -2
  84. package/dist/types/components/form/control/ensure-control.d.ts +1 -1
  85. package/dist/types/components/form/control/list-control.d.ts +1 -1
  86. package/dist/types/components/form/controller/color-controller.d.ts +4 -4
  87. package/dist/types/components/form/input/appearance-selector.d.ts +2 -2
  88. package/dist/types/components/form/input/base64-input.d.ts +1 -1
  89. package/dist/types/components/form/input/base64s-input.d.ts +1 -1
  90. package/dist/types/components/form/input/combobox-tags-input.d.ts +1 -1
  91. package/dist/types/components/form/input/email-input.d.ts +1 -1
  92. package/dist/types/components/form/input/file-input.d.ts +1 -1
  93. package/dist/types/components/form/input/files-input.d.ts +1 -1
  94. package/dist/types/components/form/input/input-options.d.ts +1 -1
  95. package/dist/types/components/form/input/list-input.d.ts +1 -1
  96. package/dist/types/components/form/input/nullable-base64-input.d.ts +1 -1
  97. package/dist/types/components/form/input/nullable-plain-date-input.d.ts +12 -12
  98. package/dist/types/components/form/input/nullable-plain-date-time-input.d.ts +12 -12
  99. package/dist/types/components/form/input/nullable-plain-time-input.d.ts +12 -12
  100. package/dist/types/components/form/input/nullable-plain-year-month-input.d.ts +12 -12
  101. package/dist/types/components/form/input/password-input.d.ts +1 -1
  102. package/dist/types/components/form/input/plain-date-input.d.ts +12 -12
  103. package/dist/types/components/form/input/plain-date-time-input.d.ts +12 -12
  104. package/dist/types/components/form/input/plain-time-input.d.ts +12 -12
  105. package/dist/types/components/form/input/plain-year-month-input.d.ts +12 -12
  106. package/dist/types/components/form/input/select-tags-input.d.ts +3 -3
  107. package/dist/types/components/form/use-form.d.ts +3 -3
  108. package/dist/types/components/i18n/locale-direction.d.ts +1 -1
  109. package/dist/types/components/i18n/locale-selector.d.ts +1 -1
  110. package/dist/types/components/i18n/locale.d.ts +1 -1
  111. package/dist/types/components/i18n/make-i18nprovider.d.ts +2 -2
  112. package/dist/types/components/layout/app-shell.d.ts +1 -1
  113. package/dist/types/components/lexical/code/language-selector.d.ts +1 -1
  114. package/dist/types/components/lexical/floating/block-handle.d.ts +1 -1
  115. package/dist/types/components/lexical/floating/floating-toolbar.d.ts +1 -1
  116. package/dist/types/components/lexical/floating/slash-command-palette.d.ts +1 -1
  117. package/dist/types/components/lexical/table/table-controls.d.ts +1 -1
  118. package/dist/types/components/lexical/toolbar/lexical-toolbar.d.ts +1 -1
  119. package/dist/types/components/lexical/toolbar/toolbar-helpers.d.ts +2 -2
  120. package/dist/types/components/media/pdf-page-viewer.d.ts +1 -1
  121. package/dist/types/components/misc/notification-provider.d.ts +2 -2
  122. package/dist/types/components/navigation/link/button-link.d.ts +1 -1
  123. package/dist/types/components/navigation/link/link.d.ts +1 -1
  124. package/dist/types/components/navigation/link/navigation-link.d.ts +1 -1
  125. package/dist/types/components/navigation/pagination.d.ts +1 -1
  126. package/dist/types/components/navigation/sidebar/sidebar.d.ts +2 -2
  127. package/dist/types/components/navigation/toolbar/toolbar.d.ts +1 -1
  128. package/dist/types/components/prosemirror/link-control.d.ts +1 -1
  129. package/dist/types/components/prosemirror/prosemirror-toolbar.d.ts +1 -1
  130. package/dist/types/components/prosemirror/utils.d.ts +2 -2
  131. package/dist/types/components/theme/theme.d.ts +2 -2
  132. package/dist/types/i18n/translate.d.ts +1 -1
  133. package/dist/types/utils/delay-signal.d.ts +1 -1
  134. package/dist/types/utils/use-animated-toggle.d.ts +22 -22
  135. package/dist/{ur-DkIYJxsF.js → ur-Lr1p8f9y.js} +1 -1
  136. package/dist/{use-animated-toggle-89fKlXxy.js → use-animated-toggle-C7PTmnZi.js} +7 -7
  137. package/dist/{use-form-BSvvERhX.js → use-form-BfzX3bwL.js} +13 -13
  138. package/dist/{use-form-B_mCauP0.cjs → use-form-i97PToWB.cjs} +1 -1
  139. package/dist/{vi-DKw6PBja.js → vi-jozfaxSj.js} +1 -1
  140. package/dist/widget-customization-BZqPoojo.cjs +1 -0
  141. package/dist/{widget-customization-DFr3ycD7.js → widget-customization-fMNSVtuP.js} +29 -29
  142. package/dist/{zh-CaKHseXJ.js → zh-BBYKq49d.js} +1 -1
  143. package/package.json +35 -31
  144. package/dist/deep-merge-CvN7Xvd1.cjs +0 -1
  145. package/dist/notice-DMK7dx9a.cjs +0 -1
  146. package/dist/stack-DcZ_u50f.cjs +0 -1
  147. package/dist/widget-customization-BASfRpF7.cjs +0 -1
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Yu=require("../_commonjsHelpers-DKOUU3wS.cjs"),w=require("@tempots/dom"),wc=require("../link-portal-_tiDFZqh.cjs"),vc=require("../theme-DogY9oT1.cjs"),z_=require("../toolbar-BR8In7O0.cjs"),ct=require("../editor-toolbar-group-BgWLVgMZ.cjs"),nr=require("../translations-gVgMyNno.cjs"),qu=require("../menu-De_-sGeb.cjs"),U_=require("../input-container-B31Seozh.cjs");function L(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function $h(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);t.search=r.toString(),console.warn(`Minified Lexical warning #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const Lt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,K_=Lt&&"documentMode"in document?document.documentMode:null,Nt=Lt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),$n=Lt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),oo=!(!Lt||!("InputEvent"in window)||K_)&&"getTargetRanges"in new window.InputEvent("input"),_s=Lt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),si=Lt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,W_=Lt&&/Android/.test(navigator.userAgent),Ih=Lt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Zu=Lt&&W_&&Ih,ys=Lt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Nt&&!Ih,j_=0,H_=1,J_=2,G_=1,V_=2,Y_=4,q_=8,Z_=16,X_=32,Q_=64,Ec=128,ey=2047,ty=1,ny=2,ry=3,iy=4,sy=5,oy=6,jo=_s||si||ys?" ":"​",Ho=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Yu=require("../_commonjsHelpers-DKOUU3wS.cjs"),w=require("@tempots/dom"),wc=require("../link-portal-_tiDFZqh.cjs"),vc=require("../theme-DogY9oT1.cjs"),qu=require("../menu-De_-sGeb.cjs"),nr=require("../translations-gVgMyNno.cjs"),ct=require("../editor-toolbar-group-BgWLVgMZ.cjs"),z_=require("../toolbar-BR8In7O0.cjs"),U_=require("../input-container-B31Seozh.cjs");function L(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function $h(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);t.search=r.toString(),console.warn(`Minified Lexical warning #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const Lt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,K_=Lt&&"documentMode"in document?document.documentMode:null,Nt=Lt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),$n=Lt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),oo=!(!Lt||!("InputEvent"in window)||K_)&&"getTargetRanges"in new window.InputEvent("input"),_s=Lt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),si=Lt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,W_=Lt&&/Android/.test(navigator.userAgent),Ih=Lt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Zu=Lt&&W_&&Ih,ys=Lt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Nt&&!Ih,j_=0,H_=1,J_=2,G_=1,V_=2,Y_=4,q_=8,Z_=16,X_=32,Q_=64,Ec=128,ey=2047,ty=1,ny=2,ry=3,iy=4,sy=5,oy=6,jo=_s||si||ys?" ":"​",Ho=`
2
2
 
3
3
  `,ly=$n?" ":jo,Fh="֑-߿יִ-﷽ﹰ-ﻼ",Dh="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",ay=new RegExp("^[^"+Dh+"]*["+Fh+"]"),cy=new RegExp("^[^"+Fh+"]*["+Dh+"]"),Pe={bold:1,capitalize:1024,code:16,highlight:Ec,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},uy={directionless:1,unmergeable:2},Xu={center:2,end:6,justify:4,left:1,right:3,start:5},dy={[ny]:"center",[oy]:"end",[iy]:"justify",[ty]:"left",[ry]:"right",[sy]:"start"},fy={normal:0,segmented:2,token:1},hy={[j_]:"normal",[J_]:"segmented",[H_]:"token"},gy="$",Qu="$config";function Lh(n,e,t,r,i,s){let o=n.getFirstChild();for(;o!==null;){const l=o.__key;o.__parent===e&&(A(o)&&Lh(o,l,t,r,i,s),t.has(l)||s.delete(l),i.push(l)),o=o.getNextSibling()}}let Ma=!1,kc=0;function py(n){kc=n.timeStamp}function Yl(n,e,t){const r=n.nodeName==="BR",i=e.__lexicalLineBreak;return i&&(n===i||r&&n.previousSibling===i)||r&&cl(n,t)!==void 0}function my(n,e,t){const r=kt(Et(t));let i=null,s=null;r!==null&&r.anchorNode===n&&(i=r.anchorOffset,s=r.focusOffset);const o=n.nodeValue;o!==null&&Zc(e,o,i,s,!1)}function _y(n,e,t){if(N(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return qt(e)&&t.isAttached()}function yy(n,e,t,r){for(let i=n;i&&!jg(i);i=vs(i)){const s=cl(i,e);if(s!==void 0){const o=q(s,t);if(o)return V(o)||!re(i)?void 0:[i,o]}else if(i===r)return[r,Mg(t)]}}function Rh(n,e,t){Ma=!0;const r=performance.now()-kc>100;try{Wt(n,()=>{const i=O()||(function(f){return f.getEditorState().read(()=>{const h=O();return h!==null?h.clone():null})})(n),s=new Map,o=n.getRootElement(),l=n._editorState,a=n._blockCursorElement;let c=!1,u="";for(let f=0;f<e.length;f++){const h=e[f],g=h.type,p=h.target,m=yy(p,n,l,o);if(!m)continue;const[b,_]=m;if(g==="characterData")r&&D(_)&&qt(p)&&_y(i,p,_)&&my(p,_,n);else if(g==="childList"){c=!0;const y=h.addedNodes;for(let x=0;x<y.length;x++){const v=y[x],k=Vc(v),E=v.parentNode;if(E!=null&&v!==a&&k===null&&!Yl(v,E,n)){if($n){const M=(re(v)?v.innerText:null)||v.nodeValue;M&&(u+=M)}E.removeChild(v)}}const S=h.removedNodes,C=S.length;if(C>0){let x=0;for(let v=0;v<C;v++){const k=S[v];(Yl(k,p,n)||a===k)&&(p.appendChild(k),x++)}C!==x&&s.set(b,_)}}}if(s.size>0)for(const[f,h]of s)h.reconcileObservedMutation(f,n);const d=t.takeRecords();if(d.length>0){for(let f=0;f<d.length;f++){const h=d[f],g=h.addedNodes,p=h.target;for(let m=0;m<g.length;m++){const b=g[m],_=b.parentNode;_==null||b.nodeName!=="BR"||Yl(b,p,n)||_.removeChild(b)}}t.takeRecords()}i!==null&&(c&&Fe(i),$n&&Lg(n)&&i.insertRawText(u))})}finally{Ma=!1}}function Ph(n){const e=n._observer;e!==null&&Rh(n,e.takeRecords(),e)}function Bh(n){(function(e){kc===0&&Et(e).addEventListener("textInput",py,!0)})(n),n._observer=new MutationObserver((e,t)=>{Rh(n,e,t)})}let by=class{key;parse;unparse;isEqual;defaultValue;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||Cy).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0)}};function Tc(n,e){return new by(n,e)}function qi(n,e,t="latest"){const r=(t==="latest"?n.getLatest():n).__state;return r?r.getValue(e):e.defaultValue}function xy(n,e,t){const r=qi(n,t,"direct"),i=qi(e,t,"direct");return t.isEqual(r,i)?null:[r,i]}function Ys(n,e,t){let r;if(Oe(),typeof t=="function"){const s=n.getLatest(),o=qi(s,e);if(r=t(o),e.isEqual(o,r))return s}else r=t;const i=n.getWritable();return Jo(i).updateFromKnown(e,r),i}function zh(n){const e=new Map,t=new Set;for(let r=typeof n=="function"?n:n.replace;r.prototype&&r.prototype.getType!==void 0;r=Object.getPrototypeOf(r)){const{ownNodeConfig:i}=Es(r);if(i&&i.stateConfigs)for(const s of i.stateConfigs){let o;"stateConfig"in s?(o=s.stateConfig,s.flat&&t.add(o.key)):o=s,e.set(o.key,o)}}return{flatKeys:t,sharedConfigMap:e}}let Sy=class Uh{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,r=void 0,i=new Map,s=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=r,this.knownState=i;const{sharedConfigMap:o}=this.sharedNodeState,l=s!==void 0?s:(function(a,c,u){let d=u.size;if(c)for(const f in c){const h=a.get(f);h&&u.has(h)||d++}return d})(o,r,i);this.size=l}getValue(e){const t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let r=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){const i=this.unknownState[e.key];i!==void 0&&(r=e.parse(i)),this.updateFromKnown(e,r)}return r}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState},t={};for(const[r,i]of this.knownState)r.isEqual(i,r.defaultValue)?delete e[r.key]:e[r.key]=r.unparse(i);for(const r of this.sharedNodeState.flatKeys)r in e&&(t[r]=e[r],delete e[r]);return ed(e)&&(t.$=e),t}getWritable(e){if(this.node===e)return this;const{sharedNodeState:t,unknownState:r}=this,i=new Map(this.knownState);return new Uh(e,t,(function(s,o,l){let a;if(l)for(const[c,u]of Object.entries(l)){const d=s.get(c);d?o.has(d)||o.set(d,d.parse(u)):(a=a||{},a[c]=u)}return a})(t.sharedConfigMap,i,r),i,this.size)}updateFromKnown(e,t){const r=e.key;this.sharedNodeState.sharedConfigMap.set(r,e);const{knownState:i,unknownState:s}=this;i.has(e)||s&&r in s||(s&&(delete s[r],this.unknownState=ed(s)),this.size++),i.set(e,t)}updateFromUnknown(e,t){const r=this.sharedNodeState.sharedConfigMap.get(e);r?this.updateFromKnown(r,r.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){const{knownState:t}=this;for(const r of t.keys())t.set(r,r.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(const[r,i]of Object.entries(e))this.updateFromUnknown(r,i)}};function Jo(n){const e=n.getWritable(),t=e.__state?e.__state.getWritable(e):new Sy(e,Kh(e));return e.__state=t,t}function Kh(n){return n.__state?n.__state.sharedNodeState:Hc(mi(),n.getType()).sharedNodeState}function ed(n){if(n)for(const e in n)return n}function Cy(n){return n}function td(n,e,t){for(const[r,i]of e.knownState){if(n.has(r.key))continue;n.add(r.key);const s=t?t.getValue(r):r.defaultValue;if(s!==i&&!r.isEqual(s,i))return!0}return!1}function nd(n,e,t){const{unknownState:r}=e,i=t?t.unknownState:void 0;if(r){for(const[s,o]of Object.entries(r))if(!n.has(s)&&(n.add(s),o!==(i?i[s]:void 0)))return!0}return!1}function rd(n,e){const t=n.__state;return t&&t.node===n?t.getWritable(e):t}function id(n,e){const t=n.__mode,r=n.__format,i=n.__style,s=e.__mode,o=e.__format,l=e.__style,a=n.__state,c=e.__state;return(t===null||t===s)&&(r===null||r===o)&&(i===null||i===l)&&(n.__state===null||a===c||(function(u,d){if(u===d)return!0;if(u&&d&&u.size!==d.size)return!1;const f=new Set;return!(u&&td(f,u,d)||d&&td(f,d,u)||u&&nd(f,u,d)||d&&nd(f,d,u))})(a,c))}function sd(n,e){const t=n.mergeWithSibling(e),r=ie()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function od(n){let e,t,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&D(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(id(e,r)){r=sd(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&D(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(id(r,t)){r=sd(r,t);break}break}t.remove()}}else r.remove()}function In(n){return ld(n.anchor),ld(n.focus),n}function ld(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let r,i;if(t===e.getChildrenSize()?(r=e.getChildAtIndex(t-1),i=!0):(r=e.getChildAtIndex(t),i=!1),D(r)){n.set(r.__key,i?r.getTextContentSize():0,"text",!0);break}if(!A(r))break;n.set(r.__key,i?r.getChildrenSize():0,"element",!0)}}let lr,Ge,Zi,Go,$a,Ia,ar,At,Fa,Xi,ke="",Pt=null,qn=null,Ur=!1,lo=!1;function ao(n,e){const t=ar.get(n);if(e!==null){const r=Pa(n);r.parentNode===e&&e.removeChild(r)}if(At.has(n)||Ge._keyToDOMMap.delete(n),A(t)){const r=uo(t,ar);Da(r,0,r.length-1,null)}t!==void 0&&Qc(Xi,Zi,Go,t,"destroyed")}function Da(n,e,t,r){for(let i=e;i<=t;++i){const s=n[i];s!==void 0&&ao(s,r)}}function Vn(n,e){n.setProperty("text-align",e)}const wy="40px";function Wh(n,e){const t=lr.theme.indent;if(typeof t=="string"){const i=n.classList.contains(t);e>0&&!i?n.classList.add(t):e<1&&i&&n.classList.remove(t)}const r=getComputedStyle(n).getPropertyValue("--lexical-indent-base-value")||wy;n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${r})`)}function jh(n,e){const t=n.style;e===0?Vn(t,""):e===1?Vn(t,"left"):e===2?Vn(t,"center"):e===3?Vn(t,"right"):e===4?Vn(t,"justify"):e===5?Vn(t,"start"):e===6&&Vn(t,"end")}function La(n,e){const t=(function(r){const i=r.__dir;if(i!==null)return i;if(be(r))return null;const s=r.getParentOrThrow();return be(s)&&s.__dir===null?"auto":null})(e);t!==null?n.dir=t:n.removeAttribute("dir")}function co(n,e){const t=At.get(n);t===void 0&&L(60);const r=t.createDOM(lr,Ge);if((function(i,s,o){const l=o._keyToDOMMap;(function(a,c,u){const d=`__lexicalKey_${c._key}`;a[d]=u})(s,o,i),l.set(i,s)})(n,r,Ge),D(t)?r.setAttribute("data-lexical-text","true"):V(t)&&r.setAttribute("data-lexical-decorator","true"),A(t)){const i=t.__indent,s=t.__size;if(La(r,t),i!==0&&Wh(r,i),s!==0){const l=s-1;Ra(uo(t,At),t,0,l,t.getDOMSlot(r))}const o=t.__format;o!==0&&jh(r,o),t.isInline()||Hh(null,t,r)}else{const i=t.getTextContent();if(V(t)){const s=t.decorate(Ge,lr);s!==null&&Jh(n,s),r.contentEditable="false"}ke+=i}return e!==null&&e.insertChild(r),Qc(Xi,Zi,Go,t,"created"),r}function Ra(n,e,t,r,i){const s=ke;ke="";let o=t;for(;o<=r;++o){co(n[o],i);const l=At.get(n[o]);l!==null&&D(l)?Pt===null&&(Pt=l.getFormat(),qn=l.getStyle()):A(l)&&o<r&&!l.isInline()&&(ke+=Ho)}i.element.__lexicalTextContent=ke,ke=s+ke}function ad(n,e){if(n){const t=n.__last;if(t){const r=e.get(t);if(r)return ue(r)?"line-break":V(r)&&r.isInline()?"decorator":null}return"empty"}return null}function Hh(n,e,t){const r=ad(n,ar),i=ad(e,At);r!==i&&e.getDOMSlot(t).setManagedLineBreak(i)}function vy(n,e,t){var r;Pt=null,qn=null,(function(i,s,o){const l=ke,a=i.__size,c=s.__size;ke="";const u=o.element;if(a===1&&c===1){const d=i.__first,f=s.__first;if(d===f)qs(d,u);else{const g=Pa(d),p=co(f,null);try{u.replaceChild(p,g)}catch(m){if(typeof m=="object"&&m!=null){const b=`${m.toString()} Parent: ${u.tagName}, new child: {tag: ${p.tagName} key: ${f}}, old child: {tag: ${g.tagName}, key: ${d}}.`;throw new Error(b)}throw m}ao(d,null)}const h=At.get(f);D(h)&&Pt===null&&(Pt=h.getFormat(),qn=h.getStyle())}else{const d=uo(i,ar),f=uo(s,At);if(d.length!==a&&L(227),f.length!==c&&L(228),a===0)c!==0&&Ra(f,0,0,c-1,o);else if(c===0){if(a!==0){const h=o.after==null&&o.before==null&&o.element.__lexicalLineBreak==null;Da(d,0,a-1,h?null:u),h&&(u.textContent="")}}else(function(h,g,p,m,b,_){const y=m-1,S=b-1;let C,x,v=_.getFirstChild(),k=0,E=0;for(;k<=y&&E<=S;){const I=g[k],K=p[E];if(I===K)v=ql(qs(K,_.element)),k++,E++;else{if(x===void 0&&(x=cd(p,E)),C===void 0)C=cd(g,k);else if(!C.has(I)){k++;continue}if(!x.has(I)){v=ql(Pa(I)),ao(I,_.element),k++,C.delete(I);continue}if(C.has(K)){const R=hr(Ge,K);R!==v&&_.withBefore(v).insertChild(R),v=ql(qs(K,_.element)),k++,E++}else co(K,_.withBefore(v)),E++}const $=At.get(K);$!==null&&D($)?Pt===null&&(Pt=$.getFormat(),qn=$.getStyle()):A($)&&E<=S&&!$.isInline()&&(ke+=Ho)}const M=k>y,T=E>S;if(M&&!T){const I=p[S+1],K=I===void 0?null:Ge.getElementByKey(I);Ra(p,0,E,S,_.withBefore(K))}else T&&!M&&Da(g,k,y,_.element)})(0,d,f,a,c,o)}u.__lexicalTextContent=ke,ke=l+ke})(n,e,e.getDOMSlot(t)),r=e,Pt==null||Pt===r.__textFormat||lo||r.setTextFormat(Pt),(function(i){qn==null||qn===i.__textStyle||lo||i.setTextStyle(qn)})(e)}function uo(n,e){const t=[];let r=n.__first;for(;r!==null;){const i=e.get(r);i===void 0&&L(101),t.push(r),r=i.__next}return t}function qs(n,e){const t=ar.get(n);let r=At.get(n);t!==void 0&&r!==void 0||L(61);const i=Ur||Ia.has(n)||$a.has(n),s=hr(Ge,n);if(t===r&&!i){let o;if(A(t)){const l=s.__lexicalTextContent;typeof l=="string"?o=l:(o=t.getTextContent(),s.__lexicalTextContent=o)}else o=t.getTextContent();return ke+=o,s}if(t!==r&&i&&Qc(Xi,Zi,Go,r,"updated"),r.updateDOM(t,s,lr)){const o=co(n,null);return e===null&&L(62),e.replaceChild(o,s),ao(n,null),o}if(A(t)){A(r)||L(334,n);const o=r.__indent;(Ur||o!==t.__indent)&&Wh(s,o);const l=r.__format;if((Ur||l!==t.__format)&&jh(s,l),i)vy(t,r,s),be(r)||r.isInline()||Hh(t,r,s);else{const a=s.__lexicalTextContent;let c;typeof a=="string"?c=a:(c=t.getTextContent(),s.__lexicalTextContent=c),ke+=c}if((Ur||r.__dir!==t.__dir)&&(La(s,r),be(r)&&!Ur))for(const a of r.getChildren())A(a)&&La(hr(Ge,a.getKey()),a)}else{const o=r.getTextContent();if(V(r)){const l=r.decorate(Ge,lr);l!==null&&Jh(n,l)}ke+=o}if(!lo&&be(r)&&r.__cachedText!==ke){const o=r.getWritable();o.__cachedText=ke,r=o}return s}function Jh(n,e){let t=Ge._pendingDecorators;const r=Ge._decorators;if(t===null){if(r[n]===e)return;t=Og(Ge)}t[n]=e}function ql(n){let e=n.nextSibling;return e!==null&&e===Ge._blockCursorElement&&(e=e.nextSibling),e}function cd(n,e){const t=new Set;for(let r=e;r<n.length;r++)t.add(n[r]);return t}function Ey(n,e,t,r,i,s){ke="",Ur=r===2,Ge=t,lr=t._config,Zi=t._nodes,Go=Ge._listeners.mutation,$a=i,Ia=s,ar=n._nodeMap,At=e._nodeMap,lo=e._readOnly,Fa=new Map(t._keyToDOMMap);const o=new Map;return Xi=o,qs("root",null),Ge=void 0,Zi=void 0,$a=void 0,Ia=void 0,ar=void 0,At=void 0,lr=void 0,Fa=void 0,Xi=void 0,o}function Pa(n){const e=Fa.get(n);return e===void 0&&L(75,n),e}function z(n){return{type:n}}const oi=z("SELECTION_CHANGE_COMMAND"),Nc=z("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),br=z("CLICK_COMMAND"),Ac=z("BEFORE_INPUT_COMMAND"),Oc=z("INPUT_COMMAND"),Mc=z("COMPOSITION_START_COMMAND"),$c=z("COMPOSITION_END_COMMAND"),Ot=z("DELETE_CHARACTER_COMMAND"),cn=z("INSERT_LINE_BREAK_COMMAND"),Fn=z("INSERT_PARAGRAPH_COMMAND"),An=z("CONTROLLED_TEXT_INSERTION_COMMAND"),li=z("PASTE_COMMAND"),Qi=z("REMOVE_TEXT_COMMAND"),cr=z("DELETE_WORD_COMMAND"),ur=z("DELETE_LINE_COMMAND"),ve=z("FORMAT_TEXT_COMMAND"),ai=z("UNDO_COMMAND"),ci=z("REDO_COMMAND"),Ic=z("KEYDOWN_COMMAND"),Vo=z("KEY_ARROW_RIGHT_COMMAND"),fo=z("MOVE_TO_END"),bs=z("KEY_ARROW_LEFT_COMMAND"),es=z("MOVE_TO_START"),dn=z("KEY_ARROW_UP_COMMAND"),dr=z("KEY_ARROW_DOWN_COMMAND"),Dn=z("KEY_ENTER_COMMAND"),Yo=z("KEY_SPACE_COMMAND"),qo=z("KEY_BACKSPACE_COMMAND"),ui=z("KEY_ESCAPE_COMMAND"),Zo=z("KEY_DELETE_COMMAND"),xs=z("KEY_TAB_COMMAND"),ho=z("INSERT_TAB_COMMAND"),Ut=z("INDENT_CONTENT_COMMAND"),sn=z("OUTDENT_CONTENT_COMMAND"),Xo=z("DROP_COMMAND"),Fc=z("FORMAT_ELEMENT_COMMAND"),Qo=z("DRAGSTART_COMMAND"),Dc=z("DRAGOVER_COMMAND"),Gh=z("DRAGEND_COMMAND"),xr=z("COPY_COMMAND"),di=z("CUT_COMMAND"),Xr=z("SELECT_ALL_COMMAND"),Lc=z("CLEAR_EDITOR_COMMAND"),Vh=z("CLEAR_HISTORY_COMMAND"),Fi=z("CAN_REDO_COMMAND"),Di=z("CAN_UNDO_COMMAND"),Rc=z("FOCUS_COMMAND"),fi=z("BLUR_COMMAND"),Yh=z("KEY_MODIFIER_COMMAND"),Xt=Object.freeze({}),Ba=[["keydown",function(n,e){ts=n.timeStamp,qh=n.key,!e.isComposing()&&P(e,Ic,n)}],["pointerdown",function(n,e){const t=n.target,r=n.pointerType;jn(t)&&r!=="touch"&&r!=="pen"&&n.button===0&&Wt(e,()=>{Tg(t)||(Ka=!0)})}],["compositionstart",function(n,e){P(e,Mc,n)}],["compositionend",function(n,e){$n?Li=!0:si||!_s&&!ys?P(e,$c,n):(Wa=!0,ja=n.data)}],["input",function(n,e){n.stopPropagation(),Wt(e,()=>{e.dispatchCommand(Oc,n)},{event:n}),Kr=null}],["click",function(n,e){Wt(e,()=>{const t=O(),r=kt(Et(e)),i=bn();if(r){if(N(t)){const s=t.anchor,o=s.getNode();if(s.type==="element"&&s.offset===0&&t.isCollapsed()&&!be(o)&&fe().getChildrenSize()===1&&o.getTopLevelElementOrThrow().isEmpty()&&i!==null&&t.is(i))r.removeAllRanges(),t.dirty=!0;else if(n.detail===3&&!t.isCollapsed()&&o!==t.focus.getNode()){const l=le(o,a=>A(a)&&!a.isInline());A(l)&&l.select(0)}}else if(n.pointerType==="touch"||n.pointerType==="pen"){const s=r.anchorNode;(re(s)||qt(s))&&Fe(tl(i,r,e,n))}}P(e,br,n)})}],["cut",Xt],["copy",Xt],["dragstart",Xt],["dragover",Xt],["dragend",Xt],["paste",Xt],["focus",Xt],["blur",Xt],["drop",Xt]];oo&&Ba.push(["beforeinput",(n,e)=>(function(t,r){const i=t.inputType;i==="deleteCompositionText"||$n&&Lg(r)||i!=="insertCompositionText"&&P(r,Ac,t)})(n,e)]);let ts=0,qh=null,Zh=0,Kr=null;const za=new WeakMap,go=new WeakMap;let Ua=!1,Ka=!1,Ki=!1,Li=!1,Wa=!1,ja="",Xn=null,Xh=[0,"",0,"root",0];function Qh(n,e,t,r,i){const s=n.anchor,o=n.focus,l=s.getNode(),a=ie(),c=kt(Et(a)),u=c!==null?c.anchorNode:null,d=s.key,f=a.getElementByKey(d),h=t.length;return d!==o.key||!D(l)||(!i&&(!oo||Zh<r+50)||l.isDirty()&&h<2||$g(t))&&s.offset!==o.offset&&!l.isComposing()||Tt(l)||l.isDirty()&&h>1||(i||!oo)&&f!==null&&!l.isComposing()&&u!==fr(f)||c!==null&&e!==null&&(!e.collapsed||e.startContainer!==c.anchorNode||e.startOffset!==c.anchorOffset)||l.getFormat()!==n.format||l.getStyle()!==n.style||(function(g,p){if(p.isSegmented())return!0;if(!g.isCollapsed())return!1;const m=g.anchor.offset,b=p.getParentOrThrow(),_=On(p);return m===0?!p.canInsertTextBefore()||!b.canInsertTextBefore()&&!p.isComposing()||_||(function(y){const S=y.getPreviousSibling();return(D(S)||A(S)&&S.isInline())&&!S.canInsertTextAfter()})(p):m===p.getTextContentSize()&&(!p.canInsertTextAfter()||!b.canInsertTextAfter()&&!p.isComposing()||_)})(n,l)}function ud(n,e){return qt(n)&&n.nodeValue!==null&&e!==0&&e!==n.nodeValue.length}function dd(n,e,t){const{anchorNode:r,anchorOffset:i,focusNode:s,focusOffset:o}=n;Ua&&(Ua=!1,ud(r,i)&&ud(s,o)&&!Xn)||Wt(e,()=>{if(!t)return void Fe(null);if(!pi(e,r,s))return;let l=O();if(Xn&&N(l)&&l.isCollapsed()){const a=l.anchor,c=Xn.anchor;(a.key===c.key&&a.offset===c.offset+1||a.offset===1&&c.getNode().is(a.getNode().getPreviousSibling()))&&(l=Xn.clone(),Fe(l))}if(Xn=null,N(l)){const a=l.anchor,c=a.getNode();if(l.isCollapsed()){n.type==="Range"&&n.anchorNode===n.focusNode&&(l.dirty=!0);const u=Et(e).event,d=u?u.timeStamp:performance.now(),[f,h,g,p,m]=Xh,b=fe(),_=e.isComposing()===!1&&b.getTextContent()==="";if(d<m+200&&a.offset===g&&a.key===p)Zs(l,f,h);else if(a.type==="text")D(c)||L(141),eg(l,c);else if(a.type==="element"&&!_){A(c)||L(259);const y=a.getNode();y.isEmpty()?(function(S,C){const x=C.getTextFormat(),v=C.getTextStyle();Zs(S,x,v)})(l,y):Zs(l,0,"")}}else{const u=a.key,d=l.focus.key,f=l.getNodes(),h=f.length,g=l.isBackward(),p=g?o:i,m=g?i:o,b=g?d:u,_=g?u:d;let y=2047,S=!1;for(let C=0;C<h;C++){const x=f[C],v=x.getTextContentSize();if(D(x)&&v!==0&&!(C===0&&x.__key===b&&p===v||C===h-1&&x.__key===_&&m===0)&&(S=!0,y&=x.getFormat(),y===0))break}l.format=S?y:0}}P(e,oi,void 0)})}function Zs(n,e,t){n.format===e&&n.style===t||(n.format=e,n.style=t,n.dirty=!0)}function eg(n,e){Zs(n,e.getFormat(),e.getStyle())}function tg(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function ky(n){const e=n.inputType,t=tg(n),r=ie(),i=O();if(e==="deleteContentBackward"){if(i===null){const d=bn();if(!N(d))return!0;Fe(d.clone())}if(N(i)){const d=i.anchor.key===i.focus.key;if(s=n.timeStamp,qh==="MediaLast"&&s<ts+30&&r.isComposing()&&d){if(Me(null),ts=0,setTimeout(()=>{Wt(r,()=>{Me(null)})},30),N(i)){const f=i.anchor.getNode();f.markDirty(),D(f)||L(142),eg(i,f)}}else{Me(null),n.preventDefault();const f=i.anchor.getNode(),h=f.getTextContent(),g=f.canInsertTextAfter(),p=i.anchor.offset===0&&i.focus.offset===h.length;let m=Zu&&d&&!p&&g;if(m&&i.isCollapsed()&&(m=!V(vo(i.anchor,!0))),!m){P(r,Ot,!0);const b=O();Zu&&N(b)&&b.isCollapsed()&&(Xn=b,setTimeout(()=>Xn=null))}}return!0}}var s;if(!N(i))return!0;const o=n.data;Kr!==null&&qc(!1,r,Kr),i.dirty&&Kr===null||!i.isCollapsed()||be(i.anchor.getNode())||t===null||i.applyDOMRange(t),Kr=null;const l=i.anchor,a=i.focus,c=l.getNode(),u=a.getNode();if(e==="insertText"||e==="insertTranspose"){if(o===`
4
4
  `)n.preventDefault(),P(r,cn,!1);else if(o===Ho)n.preventDefault(),P(r,Fn,void 0);else if(o==null&&n.dataTransfer){const d=n.dataTransfer.getData("text/plain");n.preventDefault(),i.insertRawText(d)}else o!=null&&Qh(i,t,o,n.timeStamp,!0)?(n.preventDefault(),P(r,An,o)):Kr=o;return Zh=n.timeStamp,!0}switch(n.preventDefault(),e){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":P(r,An,n);break;case"insertFromComposition":Me(null),P(r,An,n);break;case"insertLineBreak":Me(null),P(r,cn,!1);break;case"insertParagraph":Me(null),Ki&&!si?(Ki=!1,P(r,cn,!1)):P(r,Fn,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":P(r,li,n);break;case"deleteByComposition":(function(d,f){return d!==f||A(d)||A(f)||!On(d)||!On(f)})(c,u)&&P(r,Qi,n);break;case"deleteByDrag":case"deleteByCut":P(r,Qi,n);break;case"deleteContent":P(r,Ot,!1);break;case"deleteWordBackward":P(r,cr,!0);break;case"deleteWordForward":P(r,cr,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":P(r,ur,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":P(r,ur,!1);break;case"formatStrikeThrough":P(r,ve,"strikethrough");break;case"formatBold":P(r,ve,"bold");break;case"formatItalic":P(r,ve,"italic");break;case"formatUnderline":P(r,ve,"underline");break;case"historyUndo":P(r,ai,void 0);break;case"historyRedo":P(r,ci,void 0)}return!0}function Ty(n){if(re(n.target)&&Tg(n.target))return!0;const e=ie(),t=O(),r=n.data,i=tg(n);if(r!=null&&N(t)&&Qh(t,i,r,n.timeStamp,!1)){Li&&(po(e,r),Li=!1);const s=t.anchor.getNode(),o=kt(Et(e));if(o===null)return!0;const l=t.isBackward(),a=l?t.anchor.offset:t.focus.offset,c=l?t.focus.offset:t.anchor.offset;oo&&!t.isCollapsed()&&D(s)&&o.anchorNode!==null&&s.getTextContent().slice(0,a)+r+s.getTextContent().slice(a+c)===Fg(o.anchorNode)||P(e,An,r);const u=r.length;$n&&u>1&&n.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=u),_s||si||ys||!e.isComposing()||(ts=0,Me(null))}else qc(!1,e,r!==null?r:void 0),Li&&(po(e,r||void 0),Li=!1);return(function(){Oe();const s=ie();Ph(s)})(),!0}function Ny(n){const e=ie(),t=O();if(N(t)&&!e.isComposing()){const r=t.anchor,i=t.anchor.getNode();Me(r.key),(n.timeStamp<ts+30||r.type==="element"||!t.isCollapsed()||i.getFormat()!==t.format||D(i)&&i.getStyle()!==t.style)&&P(e,An,ly)}return!0}function Ay(n){return po(ie(),n.data),!0}function po(n,e){const t=n._compositionKey;if(Me(null),t!==null&&e!=null){if(e===""){const r=q(t),i=fr(n.getElementByKey(t));return void(i!==null&&i.nodeValue!==null&&D(r)&&Zc(r,i.nodeValue,null,null,!0))}if(e[e.length-1]===`
@@ -11,14 +11,7 @@
11
11
  `?r.push(lt()):o===" "?r.push(Ct()):r.push(de(o))}this.insertNodes(r)}insertText(e){const t=this.anchor,r=this.focus,i=this.format,s=this.style;let o=t,l=r;!this.isCollapsed()&&r.isBefore(t)&&(o=r,l=t),o.type==="element"&&(function(m,b,_,y){const S=m.getNode(),C=S.getChildAtIndex(m.offset),x=de();if(x.setFormat(_),x.setStyle(y),Tr(C))C.splice(0,0,[x]);else{const v=be(S)?H().append(x):x;C===null?S.append(v):C.insertBefore(v)}m.is(b)&&b.set(x.__key,0,"text"),m.set(x.__key,0,"text")})(o,l,i,s),l.type==="element"&&Rn(l,tt(Dt(l,"next")));const a=o.offset;let c=l.offset;const u=this.getNodes(),d=u.length;let f=u[0];D(f)||L(26);const h=f.getTextContent().length,g=f.getParentOrThrow();let p=u[d-1];if(d===1&&l.type==="element"&&(c=h,l.set(o.key,c,"text")),this.isCollapsed()&&a===h&&(Tt(f)||!f.canInsertTextAfter()||!g.canInsertTextAfter()&&f.getNextSibling()===null)){let m=f.getNextSibling();if(D(m)&&m.canInsertTextBefore()&&!Tt(m)||(m=de(),m.setFormat(i),m.setStyle(s),g.canInsertTextAfter()?f.insertAfter(m):g.insertAfter(m)),m.select(0,0),f=m,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&a===0&&(Tt(f)||!f.canInsertTextBefore()||!g.canInsertTextBefore()&&f.getPreviousSibling()===null)){let m=f.getPreviousSibling();if(D(m)&&!Tt(m)||(m=de(),m.setFormat(i),g.canInsertTextBefore()?f.insertBefore(m):g.insertBefore(m)),m.select(),f=m,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&a!==h){const m=de(f.getTextContent());m.setFormat(i),f.replace(m),f=m}else if(!this.isCollapsed()&&e!==""){const m=p.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||A(m)&&(!m.canInsertTextBefore()||!m.canInsertTextAfter()))return this.insertText(""),dg(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(On(f)){const y=de(e);return y.select(),void f.replace(y)}const m=f.getFormat(),b=f.getStyle();if(a!==c||m===i&&b===s){if(He(f)){const y=de(e);return y.setFormat(i),y.setStyle(s),y.select(),void f.replace(y)}}else{if(f.getTextContent()!==""){const y=de(e);if(y.setFormat(i),y.setStyle(s),y.select(),a===0)f.insertBefore(y,!1);else{const[S]=f.splitText(a);S.insertAfter(y,!1)}return void(y.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}f.setFormat(i),f.setStyle(s)}const _=c-a;f=f.spliceText(a,_,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=m,this.style=b))}else{const m=new Set([...f.getParentKeys(),...p.getParentKeys()]),b=A(f)?f:f.getParentOrThrow();let _=A(p)?p:p.getParentOrThrow(),y=p;if(!b.is(_)&&_.isInline())do y=_,_=_.getParentOrThrow();while(_.isInline());if(l.type==="text"&&(c!==0||p.getTextContent()==="")||l.type==="element"&&p.getIndexWithinParent()<c)if(D(p)&&!On(p)&&c!==p.getTextContentSize()){if(p.isSegmented()){const k=de(p.getTextContent());p.replace(k),p=k}be(l.getNode())||l.type!=="text"||(p=p.spliceText(0,c,"")),m.add(p.__key)}else{const k=p.getParentOrThrow();k.canBeEmpty()||k.getChildrenSize()!==1?p.remove():k.remove()}else m.add(p.__key);const S=_.getChildren(),C=new Set(u),x=b.is(_),v=b.isInline()&&f.getNextSibling()===null?b:f;for(let k=S.length-1;k>=0;k--){const E=S[k];if(E.is(f)||A(E)&&E.isParentOf(f))break;E.isAttached()&&(!C.has(E)||E.is(y)?x||v.insertAfter(E,!1):E.remove())}if(!x){let k=_,E=null;for(;k!==null;){const M=k.getChildren(),T=M.length;(T===0||M[T-1].is(E))&&(m.delete(k.__key),E=k),k=k.getParent()}}if(On(f))if(a===h)f.select();else{const k=de(e);k.select(),f.replace(k)}else f=f.spliceText(a,h-a,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=f.getFormat(),this.style=f.getStyle()));for(let k=1;k<d;k++){const E=u[k],M=E.__key;m.has(M)||E.remove()}}}removeText(){const e=O()===this;Ji(this,Vg(No(this))),e&&O()!==this&&Fe(this)}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void Me(null);const r=this.getNodes(),i=[];for(const S of r)D(S)&&i.push(S);const s=S=>{r.forEach(C=>{if(A(C)){const x=C.getFormatFlags(e,S);C.setTextFormat(x)}})},o=i.length;if(o===0)return this.toggleFormat(e),Me(null),void s(t);const l=this.anchor,a=this.focus,c=this.isBackward(),u=c?a:l,d=c?l:a;let f=0,h=i[0],g=u.type==="element"?0:u.offset;if(u.type==="text"&&g===h.getTextContentSize()&&(f=1,h=i[1],g=0),h==null)return;const p=h.getFormatFlags(e,t);s(p);const m=o-1;let b=i[m];const _=d.type==="text"?d.offset:b.getTextContentSize();if(h.is(b)){if(g===_)return;if(Tt(h)||g===0&&_===h.getTextContentSize())h.setFormat(p);else{const S=h.splitText(g,_),C=g===0?S[0]:S[1];C.setFormat(p),u.type==="text"&&u.set(C.__key,0,"text"),d.type==="text"&&d.set(C.__key,_-g,"text")}return void(this.format=p)}g===0||Tt(h)||([,h]=h.splitText(g),g=0),h.setFormat(p);const y=b.getFormatFlags(e,p);_>0&&(_===b.getTextContentSize()||Tt(b)||([b]=b.splitText(_)),b.setFormat(y));for(let S=f+1;S<m;S++){const C=i[S],x=C.getFormatFlags(e,y);C.setFormat(x)}u.type==="text"&&u.set(h.__key,g,"text"),d.type==="text"&&d.set(b.__key,_,"text"),this.format=p|y}insertNodes(e){if(e.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();const g=O();return N(g)||L(134),g.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),r=le(t,dt),i=e[e.length-1];if(A(r)&&"__language"in r){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const g=ea(this);r.splice(g,0,e),i.selectEnd()}return}if(!e.some(g=>(A(g)||V(g))&&!g.isInline())){A(r)||L(211,t.constructor.name,t.getType());const g=ea(this);return r.splice(g,0,e),void i.selectEnd()}const s=(function(g){const p=H();let m=null;for(let b=0;b<g.length;b++){const _=g[b],y=ue(_);if(y||V(_)&&_.isInline()||A(_)&&_.isInline()||D(_)||_.isParentRequired()){if(m===null&&(m=_.createParentElementNode(),p.append(m),y))continue;m!==null&&m.append(_)}else p.append(_),m=null}return p})(e),o=s.getLastDescendant(),l=s.getChildren(),a=!A(r)||!r.isEmpty()?this.insertParagraph():null,c=l[l.length-1];let u=l[0];var d;A(d=u)&&dt(d)&&!d.isEmpty()&&A(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(A(r)||L(211,t.constructor.name,t.getType()),r.append(...u.getChildren()),u=l[1]),u&&(r===null&&L(212,t.constructor.name,t.getType()),(function(g,p){const m=p.getParentOrThrow().getLastChild();let b=p;const _=[p];for(;b!==m;)b.getNextSibling()||L(140),b=b.getNextSibling(),_.push(b);let y=g;for(const S of _)y=y.insertAfter(S)})(r,u));const f=le(o,dt);a&&A(f)&&(a.canMergeWhenEmpty()||dt(c))&&(f.append(...a.getChildren()),a.remove()),A(r)&&r.isEmpty()&&r.remove(),o.selectEnd();const h=A(r)?r.getLastChild():null;ue(h)&&f!==r&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){const o=H();return fe().splice(this.anchor.offset,0,[o]),o.select(),o}const e=ea(this),t=le(this.anchor.getNode(),dt);A(t)||L(213);const r=t.getChildAtIndex(e),i=r?[r,...r.getNextSiblings()]:[],s=t.insertNewAfter(this,!1);return s?(s.append(...i),s.selectStart(),s):null}insertLineBreak(e){const t=lt();if(this.insertNodes([t]),e){const r=t.getParentOrThrow(),i=t.getIndexWithinParent();r.select(i,i)}}extract(){const e=[...this.getNodes()],t=e.length;let r=e[0],i=e[t-1];const[s,o]=yo(this),l=this.isBackward(),[a,c]=l?[this.focus,this.anchor]:[this.anchor,this.focus],[u,d]=l?[o,s]:[s,o];if(t===0)return[];if(t===1){if(D(r)&&!this.isCollapsed()){const f=r.splitText(u,d),h=u===0?f[0]:f[1];return h?(a.set(h.getKey(),0,"text"),c.set(h.getKey(),h.getTextContentSize(),"text"),[h]):[]}return[r]}if(D(r)&&(u===r.getTextContentSize()?e.shift():u!==0&&([,r]=r.splitText(u),e[0]=r,a.set(r.getKey(),0,"text"))),D(i)){const f=i.getTextContent().length;d===0?e.pop():d!==f&&([i]=i.splitText(d),e[e.length-1]=i,c.set(i.getKey(),i.getTextContentSize(),"text"))}return e}modify(e,t,r){if(Ed(this,e,t,r))return;const i=e==="move",s=ie(),o=kt(Et(s));if(!o)return;const l=s._blockCursorElement,a=s._rootElement,c=this.focus.getNode();if(a===null||l===null||!A(c)||c.isInline()||c.canBeEmpty()||Va(l,s,a),this.dirty){let u=hr(s,this.anchor.key),d=hr(s,this.focus.key);this.anchor.type==="text"&&(u=fr(u)),this.focus.type==="text"&&(d=fr(d)),u&&d&&gg(o,u,this.anchor.offset,d,this.focus.offset)}if((function(u,d,f,h){u.modify(d,f,h)})(o,e,t?"backward":"forward",r),o.rangeCount>0){const u=o.getRangeAt(0),d=this.anchor.getNode(),f=be(d)?d:zg(d);if(this.applyDOMRange(u),this.dirty=!0,!i){const h=this.getNodes(),g=[];let p=!1;for(let m=0;m<h.length;m++){const b=h[m];Eo(b,f)?g.push(b):p=!0}if(p&&g.length>0)if(t){const m=g[0];A(m)?m.selectStart():m.getParentOrThrow().selectStart()}else{const m=g[g.length-1];A(m)?m.selectEnd():m.getParentOrThrow().selectEnd()}o.anchorNode===u.startContainer&&o.anchorOffset===u.startOffset||(function(m){const b=m.focus,_=m.anchor,y=_.key,S=_.offset,C=_.type;_.set(b.key,b.offset,b.type,!0),b.set(y,S,C,!0)})(this)}}r==="lineboundary"&&Ed(this,e,t,r,"decorators")}forwardDeletion(e,t,r){if(!r&&(e.type==="element"&&A(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const i=t.getParent(),s=t.getNextSibling()||(i===null?null:i.getNextSibling());if(A(s)&&s.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const r=this.anchor;let i=r.getNode();if(this.forwardDeletion(r,i,e))return;const s=fl(Dt(r,e?"previous":"next"));if(s.getTextSlices().every(l=>l===null||l.distance===0)){let l={type:"initial"};for(const a of s.iterNodeCarets("shadowRoot"))if(ht(a)){if(!a.origin.isInline()){if(a.origin.isShadowRoot()){if(l.type==="merge-block")break;if(A(s.anchor.origin)&&s.anchor.origin.isEmpty()){const c=tt(a);Ji(this,Vt(c,c)),s.anchor.origin.remove()}return}l.type!=="merge-next-block"&&l.type!=="merge-block"||(l={block:l.block,caret:a,type:"merge-block"})}}else{if(l.type==="merge-block")break;if(Ln(a)){if(A(a.origin)){if(a.origin.isInline()){if(!a.origin.isParentOf(s.anchor.origin))break}else l={block:a.origin,type:"merge-next-block"};continue}if(V(a.origin)){if(!a.origin.isIsolated())if(l.type==="merge-next-block"&&(a.origin.isKeyboardSelectable()||!a.origin.isInline())&&A(s.anchor.origin)&&s.anchor.origin.isEmpty()){s.anchor.origin.remove();const c=zc();c.add(a.origin.getKey()),Fe(c)}else a.origin.remove();return}break}}if(l.type==="merge-block"){const{caret:a,block:c}=l;return Ji(this,Vt(!a.origin.isEmpty()&&c.isEmpty()?_i(ye(c,a.direction)):s.anchor,a)),this.removeText()}}const o=this.focus;if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&r.offset===0&&bd(this,r.getNode()))return}else{const l=o.type==="text"?o.getNode():null;if(i=r.type==="text"?r.getNode():null,l!==null&&l.isSegmented()){const a=o.offset,c=l.getTextContentSize();if(l.is(i)||e&&a!==c||!e&&a!==0)return void xd(l,e,a)}else if(i!==null&&i.isSegmented()){const a=r.offset,c=i.getTextContentSize();if(i.is(l)||e&&a!==0||!e&&a!==c)return void xd(i,e,a)}(function(a,c){const u=a.anchor,d=a.focus,f=u.getNode(),h=d.getNode();if(f===h&&u.type==="text"&&d.type==="text"){const g=u.offset,p=d.offset,m=g<p,b=m?g:p,_=m?p:g,y=_-1;b!==y&&(function(S){return!($g(S)||Uy(S))})(f.getTextContent().slice(b,_))&&(c?d.set(d.key,y,d.type):u.set(u.key,y,u.type))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const r=this.anchor.getNode();r.isEmpty()&&be(r.getParent())&&r.getPreviousSibling()===null&&bd(this,r)}}deleteLine(e){this.isCollapsed()&&this.modify("extend",e,"lineboundary"),this.isCollapsed()?this.deleteCharacter(e):this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,r=t.getNode();if(this.forwardDeletion(t,r,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function je(n){return n instanceof el}function yd(n){const e=n.offset;if(n.type==="text")return e;const t=n.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function yo(n){const e=n.getStartEndPoints();if(e===null)return[0,0];const[t,r]=e;return t.type==="element"&&r.type==="element"&&t.key===r.key&&t.offset===r.offset?[0,0]:[yd(t),yd(r)]}function bd(n,e){for(let t=e;t;t=t.getParent()){if(A(t)){if(t.collapseAtStart(n))return!0;if(ze(t))break}if(t.getPreviousSibling())break}return!1}const Uy=(()=>{try{const n=new RegExp("\\p{Emoji}","u"),e=n.test.bind(n);if(e("❤️")&&e("#️⃣")&&e("👍"))return e}catch{}return()=>!1})();function xd(n,e,t){const r=n,i=r.getTextContent().split(/(?=\s)/g),s=i.length;let o=0,l=0;for(let c=0;c<s;c++){const u=c===s-1;if(l=o,o+=i[c].length,e&&o===t||o>t||u){i.splice(c,1),u&&(l=void 0);break}}const a=i.join("").trim();a===""?r.remove():(r.setTextContent(a),r.select(l,l))}function Sd(n,e,t,r){let i,s=e;if(re(n)){let o=!1;const l=n.childNodes,a=l.length,c=r._blockCursorElement;s===a&&(o=!0,s=a-1);let u=l[s],d=!1;if(u===c)u=l[s+1],d=!0;else if(c!==null){const f=c.parentNode;n===f&&e>Array.prototype.indexOf.call(f.children,c)&&s--}if(i=Hr(u),D(i))s=$t(i,o?"next":"previous");else{let f=Hr(n);if(f===null)return null;if(A(f)){const h=r.getElementByKey(f.getKey());h===null&&L(214),[f,s]=f.getDOMSlot(h).resolveChildIndex(f,h,n,e),A(f)||L(215),o&&s>=f.getChildrenSize()&&(s=Math.max(0,f.getChildrenSize()-1));let p=f.getChildAtIndex(s);if(A(p)&&(function(m,b,_){const y=m.getParent();return _===null||y===null||!y.canBeEmpty()||y!==_.getNode()})(p,0,t)){const m=o?p.getLastDescendant():p.getFirstDescendant();m===null?f=p:(p=m,f=A(p)?p:p.getParentOrThrow()),s=0}D(p)?(i=p,f=null,s=$t(p,o?"next":"previous")):p!==f&&o&&!d&&(A(f)||L(216),s=Math.min(f.getChildrenSize(),s+1))}else{const h=f.getIndexWithinParent();s=e===0&&V(f)&&Hr(n)===f?h:h+1,f=f.getParentOrThrow()}if(A(f))return Ne(f.__key,s,"element")}}else i=Hr(n);return D(i)?Ne(i.__key,$t(i,s,"clamp"),"text"):null}function Cd(n,e,t){const r=n.offset,i=n.getNode();if(r===0){const s=i.getPreviousSibling(),o=i.getParent();if(e){if((t||!e)&&s===null&&A(o)&&o.isInline()){const l=o.getPreviousSibling();D(l)&&n.set(l.__key,l.getTextContent().length,"text")}}else A(s)&&!t&&s.isInline()?n.set(s.__key,s.getChildrenSize(),"element"):D(s)&&n.set(s.__key,s.getTextContent().length,"text")}else if(r===i.getTextContent().length){const s=i.getNextSibling(),o=i.getParent();if(e&&A(s)&&s.isInline())n.set(s.__key,0,"element");else if((t||e)&&s===null&&A(o)&&o.isInline()&&!o.canInsertTextAfter()){const l=o.getNextSibling();D(l)&&n.set(l.__key,0,"text")}}}function dg(n,e,t){if(n.type==="text"&&e.type==="text"){const r=n.isBefore(e),i=n.is(e);Cd(n,r,i),Cd(e,!r,i),i&&e.set(n.key,n.offset,n.type);const s=ie();if(s.isComposing()&&s._compositionKey!==n.key&&N(t)){const o=t.anchor,l=t.focus;n.set(o.key,o.offset,o.type,!0),e.set(l.key,l.offset,l.type,!0)}}}function fg(n,e,t,r,i,s){if(n===null||t===null||!pi(i,n,t))return null;const o=Sd(n,e,N(s)?s.anchor:null,i);if(o===null)return null;const l=Sd(t,r,N(s)?s.focus:null,i);if(l===null)return null;if(o.type==="element"&&l.type==="element"){const a=Hr(n),c=Hr(t);if(V(a)&&V(c))return null}return dg(o,l,s),[o,l]}function bo(n){return A(n)&&!n.isInline()}function hg(n,e,t,r,i,s){const o=xn(),l=new wr(Ne(n,e,i),Ne(t,r,s),0,"");return l.dirty=!0,o._selection=l,l}function hi(){const n=Ne("root",0,"element"),e=Ne("root",0,"element");return new wr(n,e,0,"")}function zc(){return new el(new Set)}function Ky(n,e){return tl(null,n,e,null)}function tl(n,e,t,r){const i=t._window;if(i===null)return null;const s=r||i.event,o=s?s.type:void 0,l=o==="selectionchange",a=!Ma&&(l||o==="beforeinput"||o==="compositionstart"||o==="compositionend"||o==="click"&&s&&s.detail===3||o==="drop"||o===void 0);let c,u,d,f;if(N(n)&&!a)return n.clone();if(e===null)return null;if(c=e.anchorNode,u=e.focusNode,d=e.anchorOffset,f=e.focusOffset,(l||o===void 0)&&N(n)&&!pi(t,c,u))return n.clone();const h=fg(c,d,u,f,t,n);if(h===null)return null;const[g,p]=h;return new wr(g,p,N(n)?n.format:0,N(n)?n.style:"")}function O(){return xn()._selection}function bn(){return ie()._editorState._selection}function xo(n,e,t,r=1){const i=n.anchor,s=n.focus,o=i.getNode(),l=s.getNode();if(!e.is(o)&&!e.is(l))return;const a=e.__key;if(n.isCollapsed()){const c=i.offset;if(t<=c&&r>0||t<c&&r<0){const u=Math.max(0,c+r);i.set(a,u,"element"),s.set(a,u,"element"),wd(n)}}else{const c=n.isBackward(),u=c?s:i,d=u.getNode(),f=c?i:s,h=f.getNode();if(e.is(d)){const g=u.offset;(t<=g&&r>0||t<g&&r<0)&&u.set(a,Math.max(0,g+r),"element")}if(e.is(h)){const g=f.offset;(t<=g&&r>0||t<g&&r<0)&&f.set(a,Math.max(0,g+r),"element")}}wd(n)}function wd(n){const e=n.anchor,t=e.offset,r=n.focus,i=r.offset,s=e.getNode(),o=r.getNode();if(n.isCollapsed()){if(!A(s))return;const l=s.getChildrenSize(),a=t>=l,c=a?s.getChildAtIndex(l-1):s.getChildAtIndex(t);if(D(c)){let u=0;a&&(u=c.getTextContentSize()),e.set(c.__key,u,"text"),r.set(c.__key,u,"text")}return}if(A(s)){const l=s.getChildrenSize(),a=t>=l,c=a?s.getChildAtIndex(l-1):s.getChildAtIndex(t);if(D(c)){let u=0;a&&(u=c.getTextContentSize()),e.set(c.__key,u,"text")}}if(A(o)){const l=o.getChildrenSize(),a=i>=l,c=a?o.getChildAtIndex(l-1):o.getChildAtIndex(i);if(D(c)){let u=0;a&&(u=c.getTextContentSize()),r.set(c.__key,u,"text")}}}function So(n,e,t,r,i){let s=null,o=0,l=null;r!==null?(s=r.__key,D(r)?(o=r.getTextContentSize(),l="text"):A(r)&&(o=r.getChildrenSize(),l="element")):i!==null&&(s=i.__key,D(i)?l="text":A(i)&&(l="element")),s!==null&&l!==null?n.set(s,o,l):(o=e.getIndexWithinParent(),o===-1&&(o=t.getChildrenSize()),n.set(t.__key,o,"element"))}function vd(n,e,t,r,i){n.type==="text"?n.set(t,n.offset+(e?0:i),"text"):n.offset>r.getIndexWithinParent()&&n.set(n.key,n.offset-1,"element")}function gg(n,e,t,r,i){try{n.setBaseAndExtent(e,t,r,i)}catch{}}function Wy(n,e,t,r,i,s,o){const l=r.anchorNode,a=r.focusNode,c=r.anchorOffset,u=r.focusOffset,d=document.activeElement;if(i.has(og)&&d!==s||d!==null&&ol(d))return;if(!N(e))return void(n!==null&&pi(t,l,a)&&r.removeAllRanges());const f=e.anchor,h=e.focus,g=f.key,p=h.key,m=hr(t,g),b=hr(t,p),_=f.offset,y=h.offset,S=e.format,C=e.style,x=e.isCollapsed();let v=m,k=b,E=!1;if(f.type==="text"){v=fr(m);const R=f.getNode();E=R.getFormat()!==S||R.getStyle()!==C}else N(n)&&n.anchor.type==="text"&&(E=!0);var M,T,I,K,$;if(h.type==="text"&&(k=fr(b)),v!==null&&k!==null&&(x&&(n===null||E||N(n)&&(n.format!==S||n.style!==C))&&(M=S,T=C,I=_,K=g,$=performance.now(),Xh=[M,T,I,K,$]),c!==_||u!==y||l!==v||a!==k||r.type==="Range"&&x||(d!==null&&s.contains(d)||i.has(Ja)||s.focus({preventScroll:!0}),f.type==="element"))){if(gg(r,v,_,k,y),!$n||!e.isCollapsed()||s===null||i.has(Ja)||document.activeElement!==null&&s.contains(document.activeElement)||s.focus({preventScroll:!0}),!i.has(lg)&&e.isCollapsed()&&s!==null&&s===document.activeElement){const R=N(e)&&e.anchor.type==="element"?v.childNodes[_]||null:r.rangeCount>0?r.getRangeAt(0):null;if(R!==null){let W;if(R instanceof Text){const Z=document.createRange();Z.selectNode(R),W=Z.getBoundingClientRect()}else W=R.getBoundingClientRect();(function(Z,Y,se){const Ke=eu(se),qe=tu(Ke);if(Ke===null||qe===null)return;let{top:j,bottom:pe}=Y,oe=0,Ze=0,Se=se;for(;Se!==null;){const We=Se===Ke.body;if(We)oe=0,Ze=Et(Z).innerHeight;else{const bt=Se.getBoundingClientRect();oe=bt.top,Ze=bt.bottom}let Xe=0;if(j<oe?Xe=-(oe-j):pe>Ze&&(Xe=pe-Ze),Xe!==0)if(We)qe.scrollBy(0,Xe);else{const bt=Se.scrollTop;Se.scrollTop+=Xe;const Ce=Se.scrollTop-bt;j-=Ce,pe-=Ce}if(We)break;Se=vs(Se)}})(t,W,s)}}Ua=!0}}function nl(n){let e=O()||bn();e===null&&(e=fe().selectEnd()),e.insertNodes(n)}function jy(){const n=O();return n===null?"":n.getTextContent()}function ea(n){let e=n;n.isCollapsed()||e.removeText();const t=O();N(t)&&(e=t),N(e)||L(161);const r=e.anchor;let i=r.getNode(),s=r.offset;for(;!dt(i);){const o=i;if([i,s]=Hy(i,s),o.is(i))break}return s}function Hy(n,e){const t=n.getParent();if(!t){const i=H();return fe().append(i),i.select(),[fe(),0]}if(D(n)){const i=n.splitText(e);if(i.length===0)return[t,n.getIndexWithinParent()];const s=e===0?0:1;return[t,i[0].getIndexWithinParent()+s]}if(!A(n)||e===0)return[t,n.getIndexWithinParent()];const r=n.getChildAtIndex(e);if(r){const i=new wr(Ne(n.__key,e,"element"),Ne(n.__key,e,"element"),0,""),s=n.insertNewAfter(i);s&&s.append(r,...r.getNextSiblings())}return[t,n.getIndexWithinParent()+1]}function Ed(n,e,t,r,i="decorators-and-blocks"){if(e==="move"&&r==="character"&&!n.isCollapsed()){const[u,d]=t===n.isBackward()?[n.focus,n.anchor]:[n.anchor,n.focus];return d.set(u.key,u.offset,u.type),!0}const s=Dt(n.focus,t?"previous":"next"),o=r==="lineboundary",l=e==="move";let a=s,c=i==="decorators-and-blocks";if(!uu(a)){for(const u of a){c=!1;const{origin:d}=u;if(!V(d)||d.isIsolated()||(a=u,!o||!d.isInline()))break}if(c)for(const u of fl(s).iterNodeCarets(e==="extend"?"shadowRoot":"root")){if(ht(u))u.origin.isInline()||(a=u);else{if(A(u.origin))continue;V(u.origin)&&!u.origin.isInline()&&(a=u)}break}}if(a===s)return!1;if(l&&!o&&V(a.origin)&&a.origin.isKeyboardSelectable()){const u=zc();return u.add(a.origin.getKey()),Fe(u),!0}return a=tt(a),l&&Rn(n.anchor,a),Rn(n.focus,a),c||!o}let $e=null,Ie=null,st=!1,ta=!1,Xs=0;const kd={characterData:!0,childList:!0,subtree:!0};function vr(){return st||$e!==null&&$e._readOnly}function Oe(){st&&L(13)}function pg(){Xs>99&&L(14)}function xn(){return $e===null&&L(195,mg()),$e}function ie(){return Ie===null&&L(196,mg()),Ie}function mg(){let n=0;const e=new Set,t=Qr.version;if(typeof window<"u")for(const i of document.querySelectorAll("[contenteditable]")){const s=ws(i);if(ll(s))n++;else if(s){let o=String(s.constructor.version||"<0.17.1");o===t&&(o+=" (separately built, likely a bundler configuration issue)"),e.add(o)}}let r=` Detected on the page: ${n} compatible editor(s) with version ${t}`;return e.size&&(r+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),r}function Jy(){return Ie}function Td(n,e,t){const r=e.__type,i=Hc(n,r);let s=t.get(r);s===void 0&&(s=Array.from(i.transforms),t.set(r,s));const o=s.length;for(let l=0;l<o&&(s[l](e),e.isAttached());l++);}function Nd(n,e){return n!==void 0&&n.__key!==e&&n.isAttached()}function _g(n,e){if(!e)return;const t=n._updateTags;let r=e;Array.isArray(e)||(r=[e]);for(const i of r)t.add(i)}function yg(n){return Uc(n,ie()._nodes)}function Uc(n,e){const t=n.type,r=e.get(t);r===void 0&&L(17,t);const i=r.klass;n.type!==i.getType()&&L(18,i.name);const s=i.importJSON(n),o=n.children;if(A(s)&&Array.isArray(o))for(let l=0;l<o.length;l++){const a=Uc(o[l],e);s.append(a)}return s}function Ad(n,e,t){const r=$e,i=st,s=Ie;$e=e,st=!0,Ie=n;try{return t()}finally{$e=r,st=i,Ie=s}}function nn(n,e){const t=n._pendingEditorState,r=n._rootElement,i=n._headless||r===null;if(t===null)return;const s=n._editorState,o=s._selection,l=t._selection,a=n._dirtyType!==0,c=$e,u=st,d=Ie,f=n._updating,h=n._observer;let g=null;if(n._pendingEditorState=null,n._editorState=t,!i&&a&&h!==null){Ie=n,$e=t,st=!1,n._updating=!0;try{const x=n._dirtyType,v=n._dirtyElements,k=n._dirtyLeaves;h.disconnect(),g=Ey(s,t,n,x,v,k)}catch(x){if(x instanceof Error&&n._onError(x),ta)throw x;return vg(n,null,r,t),Bh(n),n._dirtyType=2,ta=!0,nn(n,s),void(ta=!1)}finally{h.observe(r,kd),n._updating=f,$e=c,st=u,Ie=d}}t._readOnly||(t._readOnly=!0);const p=n._dirtyLeaves,m=n._dirtyElements,b=n._normalizedNodes,_=n._updateTags,y=n._deferred;a&&(n._dirtyType=0,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements=new Map,n._normalizedNodes=new Set,n._updateTags=new Set),(function(x,v){const k=x._decorators;let E=x._pendingDecorators||k;const M=v._nodeMap;let T;for(T in E)M.has(T)||(E===k&&(E=Og(x)),delete E[T])})(n,t);const S=i?null:kt(Et(n));if(n._editable&&S!==null&&(a||l===null||l.dirty||!l.is(o))&&r!==null&&!_.has(ag)){Ie=n,$e=t;try{if(h!==null&&h.disconnect(),a||l===null||l.dirty){const x=n._blockCursorElement;x!==null&&Va(x,n,r),Wy(o,l,n,S,_,r)}(function(x,v,k){let E=x._blockCursorElement;if(N(k)&&k.isCollapsed()&&k.anchor.type==="element"&&v.contains(document.activeElement)){const M=k.anchor,T=M.getNode(),I=M.offset;let K=!1,$=null;if(I===T.getChildrenSize())ra(T.getChildAtIndex(I-1))&&(K=!0);else{const R=T.getChildAtIndex(I);if(R!==null&&ra(R)){const W=R.getPreviousSibling();(W===null||ra(W))&&(K=!0,$=x.getElementByKey(R.__key))}}if(K){const R=x.getElementByKey(T.__key);return E===null&&(x._blockCursorElement=E=(function(W){const Z=W.theme,Y=document.createElement("div");Y.contentEditable="false",Y.setAttribute("data-lexical-cursor","true");let se=Z.blockCursor;if(se!==void 0){if(typeof se=="string"){const Ke=hn(se);se=Z.blockCursor=Ke}se!==void 0&&Y.classList.add(...se)}return Y})(x._config)),v.style.caretColor="transparent",void($===null?R.appendChild(E):R.insertBefore(E,$))}}E!==null&&Va(E,x,v)})(n,r,l)}finally{h!==null&&h.observe(r,kd),Ie=d,$e=c}}g!==null&&(function(x,v,k,E,M){const T=Array.from(x._listeners.mutation),I=T.length;for(let K=0;K<I;K++){const[$,R]=T[K];for(const W of R){const Z=v.get(W);Z!==void 0&&$(Z,{dirtyLeaves:E,prevEditorState:M,updateTags:k})}}})(n,g,_,p,s),N(l)||l===null||o!==null&&o.is(l)||n.dispatchCommand(oi,void 0);const C=n._pendingDecorators;C!==null&&(n._decorators=C,n._pendingDecorators=null,Wi("decorator",n,!0,C)),(function(x,v,k){const E=Id(v),M=Id(k);E!==M&&Wi("textcontent",x,!0,M)})(n,e||s,t),Wi("update",n,!0,{dirtyElements:m,dirtyLeaves:p,editorState:t,mutatedNodes:g,normalizedNodes:b,prevEditorState:e||s,tags:_}),(function(x,v){if(x._deferred=[],v.length!==0){const k=x._updating;x._updating=!0;try{for(let E=0;E<v.length;E++)v[E]()}finally{x._updating=k}}})(n,y),(function(x){const v=x._updates;if(v.length!==0){const k=v.shift();if(k){const[E,M]=k;rl(x,E,M)}}})(n)}function Wi(n,e,t,...r){const i=e._updating;e._updating=t;try{const s=Array.from(e._listeners[n]);for(let o=0;o<s.length;o++)s[o].apply(null,r)}finally{e._updating=i}}function Od(n,e){const t=n._updates;let r=e||!1;for(;t.length!==0;){const i=t.shift();if(i){const[s,o]=i,l=n._pendingEditorState;let a;o!==void 0&&(a=o.onUpdate,o.skipTransforms&&(r=!0),o.discrete&&(l===null&&L(191),l._flushSync=!0),a&&n._deferred.push(a),_g(n,o.tag)),l==null?rl(n,s,o):s()}}return r}function rl(n,e,t){const r=n._updateTags;let i,s=!1,o=!1;t!==void 0&&(i=t.onUpdate,_g(n,t.tag),s=t.skipTransforms||!1,o=t.discrete||!1),i&&n._deferred.push(i);const l=n._editorState;let a=n._pendingEditorState,c=!1;(a===null||a._readOnly)&&(a=n._pendingEditorState=bg(a||l),c=!0),a._flushSync=o;const u=$e,d=st,f=Ie,h=n._updating;$e=a,st=!1,n._updating=!0,Ie=n;const g=n._headless||n.getRootElement()===null;jc(null);try{c&&(g?l._selection!==null&&(a._selection=l._selection.clone()):a._selection=(function(_,y){const S=_.getEditorState()._selection,C=kt(Et(_));return N(S)||S==null?tl(S,C,_,y):S.clone()})(n,t&&t.event||null));const m=n._compositionKey;e(),s=Od(n,s),(function(_,y){const S=y.getEditorState()._selection,C=_._selection;if(N(C)){const x=C.anchor,v=C.focus;let k;if(x.type==="text"&&(k=x.getNode(),k.selectionTransform(S,C)),v.type==="text"){const E=v.getNode();k!==E&&E.selectionTransform(S,C)}}})(a,n),n._dirtyType!==0&&(s?(function(_,y){const S=y._dirtyLeaves,C=_._nodeMap;for(const x of S){const v=C.get(x);D(v)&&v.isAttached()&&v.isSimpleText()&&!v.isUnmergeable()&&od(v)}})(a,n):(function(_,y){const S=y._dirtyLeaves,C=y._dirtyElements,x=_._nodeMap,v=kn(),k=new Map;let E=S,M=E.size,T=C,I=T.size;for(;M>0||I>0;){if(M>0){y._dirtyLeaves=new Set;for(const K of E){const $=x.get(K);D($)&&$.isAttached()&&$.isSimpleText()&&!$.isUnmergeable()&&od($),$!==void 0&&Nd($,v)&&Td(y,$,k),S.add(K)}if(E=y._dirtyLeaves,M=E.size,M>0){Xs++;continue}}y._dirtyLeaves=new Set,y._dirtyElements=new Map,T.delete("root")&&T.set("root",!0);for(const K of T){const $=K[0],R=K[1];if(C.set($,R),!R)continue;const W=x.get($);W!==void 0&&Nd(W,v)&&Td(y,W,k)}E=y._dirtyLeaves,M=E.size,T=y._dirtyElements,I=T.size,Xs++}y._dirtyLeaves=S,y._dirtyElements=C})(a,n),Od(n),(function(_,y,S,C){const x=_._nodeMap,v=y._nodeMap,k=[];for(const[E]of C){const M=v.get(E);M!==void 0&&(M.isAttached()||(A(M)&&Lh(M,E,x,v,k,C),x.has(E)||C.delete(E),k.push(E)))}for(const E of k)v.delete(E);for(const E of S){const M=v.get(E);M===void 0||M.isAttached()||(x.has(E)||S.delete(E),v.delete(E))}})(l,a,n._dirtyLeaves,n._dirtyElements)),m!==n._compositionKey&&(a._flushSync=!0);const b=a._selection;if(N(b)){const _=a._nodeMap,y=b.anchor.key,S=b.focus.key;_.get(y)!==void 0&&_.get(S)!==void 0||L(19)}else je(b)&&b._nodes.size===0&&(a._selection=null)}catch(m){return m instanceof Error&&n._onError(m),n._pendingEditorState=l,n._dirtyType=2,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),void nn(n)}finally{$e=u,st=d,Ie=f,n._updating=h,Xs=0}n._dirtyType!==0||n._deferred.length>0||(function(m,b){const _=b.getEditorState()._selection,y=m._selection;if(y!==null){if(y.dirty||!y.is(_))return!0}else if(_!==null)return!0;return!1})(a,n)?a._flushSync?(a._flushSync=!1,nn(n)):c&&Yy(()=>{nn(n)}):(a._flushSync=!1,c&&(r.clear(),n._deferred=[],n._pendingEditorState=null))}function Wt(n,e,t){Ie===n&&t===void 0?e():rl(n,e,t)}class ji{element;before;after;constructor(e,t,r){this.element=e,this.before=t||null,this.after=r||null}withBefore(e){return new ji(this.element,e,this.after)}withAfter(e){return new ji(this.element,this.before,e)}withElement(e){return this.element===e?this:new ji(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return t!==null&&t.parentElement!==this.element&&L(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&L(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&L(224),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(e===null)this.removeManagedLineBreak();else{const t=e==="decorator"&&(ys||si||_s);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,r=e.nodeName==="IMG"?e.nextSibling:null;r&&t.removeChild(r),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===(t.nodeName==="IMG"))return;this.removeManagedLineBreak()}const r=this.element,i=this.before,s=document.createElement("br");if(r.insertBefore(s,i),e){const o=document.createElement("img");o.setAttribute("data-lexical-linebreak","true"),o.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",o.alt="",r.insertBefore(o,s),r.__lexicalLineBreak=o}else r.__lexicalLineBreak=s}getFirstChildOffset(){let e=0;for(let t=this.after;t!==null;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,r,i){if(r===this.element){const a=this.getFirstChildOffset();return[e,Math.min(a+e.getChildrenSize(),Math.max(a,i))]}const s=Md(t,r);s.push(i);const o=Md(t,this.element);let l=e.getIndexWithinParent();for(let a=0;a<o.length;a++){const c=s[a],u=o[a];if(c===void 0||c<u)break;if(c>u){l+=1;break}}return[e.getParentOrThrow(),l]}}function Md(n,e){const t=[];let r=e;for(;r!==n&&r!==null;r=r.parentNode){let i=0;for(let s=r.previousSibling;s!==null;s=s.previousSibling)i++;t.push(i)}return r!==n&&L(225),t.reverse()}class xe extends Kt{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return dy[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const e=ie()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;t!==null;){if(D(t)&&e.push(t),A(t)){const r=t.getAllTextNodes();e.push(...r)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;A(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;A(e);){const t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),r=t.length;if(e>=r){const s=t[r-1];return A(s)&&s.getLastDescendant()||s||null}const i=t[e];return A(i)&&i.getFirstDescendant()||i||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:q(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&L(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:q(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&L(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let r,i;if(e<t/2){for(r=this.getFirstChild(),i=0;r!==null&&i<=e;){if(i===e)return r;r=r.getNextSibling(),i++}return null}for(r=this.getLastChild(),i=t-1;r!==null&&i>=e;){if(i===e)return r;r=r.getPreviousSibling(),i--}return null}getTextContent(){let e="";const t=this.getChildren(),r=t.length;for(let i=0;i<r;i++){const s=t[i];e+=s.getTextContent(),A(s)&&i!==r-1&&!s.isInline()&&(e+=Ho)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),r=t.length;for(let i=0;i<r;i++){const s=t[i];e+=s.getTextContentSize(),A(s)&&i!==r-1&&!s.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==""){const t=Xu[e];return(this.getFormat()&t)!==0}return!1}hasTextFormat(e){const t=Pe[e];return(this.getTextFormat()&t)!==0}getFormatFlags(e,t){return Co(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){Oe();const r=O();let i=e,s=t;const o=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const a=this.getFirstChild();if(D(a)||A(a))return a.select(0,0)}else if(!(e!==void 0&&e!==o||t!==void 0&&t!==o)){const a=this.getLastChild();if(D(a)||A(a))return a.select()}}i===void 0&&(i=o),s===void 0&&(s=o);const l=this.__key;return N(r)?(r.anchor.set(l,i,"element"),r.focus.set(l,s,"element"),r.dirty=!0,r):hg(l,i,l,s,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach(t=>t.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e!==""?Xu[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,r){mo(this)&&L(324,this.__key,this.__type);const i=this.getChildrenSize(),s=this.getWritable();e+t<=i||L(226,String(e),String(t),String(i));const o=s.__key,l=[],a=[],c=this.getChildAtIndex(e+t);let u=null,d=i-t+r.length;if(e!==0)if(e===i)u=this.getLastChild();else{const h=this.getChildAtIndex(e);h!==null&&(u=h.getPreviousSibling())}if(t>0){let h=u===null?this.getFirstChild():u.getNextSibling();for(let g=0;g<t;g++){h===null&&L(100);const p=h.getNextSibling(),m=h.__key;jt(h.getWritable()),a.push(m),h=p}}let f=u;for(const h of r){f!==null&&h.is(f)&&(u=f=f.getPreviousSibling());const g=h.getWritable();g.__parent===o&&d--,jt(g);const p=h.__key;if(f===null)s.__first=p,g.__prev=null;else{const m=f.getWritable();m.__next=p,g.__prev=m.__key}h.__key===o&&L(76),g.__parent=o,l.push(p),f=h}if(e+t===i)f!==null&&(f.getWritable().__next=null,s.__last=f.__key);else if(c!==null){const h=c.getWritable();if(f!==null){const g=f.getWritable();h.__prev=f.__key,g.__next=c.__key}else h.__prev=null}if(s.__size=d,a.length){const h=O();if(N(h)){const g=new Set(a),p=new Set(l),{anchor:m,focus:b}=h;$d(m,g,p)&&So(m,m.getNode(),this,u,c),$d(b,g,p)&&So(b,b.getNode(),this,u,c),d!==0||this.canBeEmpty()||ze(this)||this.remove()}}return s}getDOMSlot(e){return new ji(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(re(t)){const r=this.getIndent();r>0&&(t.style.paddingInlineStart=40*r+"px");const i=this.getDirection();i&&(t.dir=i)}return{element:t}}exportJSON(){const e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),r=this.getTextStyle();return t===0&&r===""||ze(this)||this.getChildren().some(D)||(t!==0&&(e.textFormat=t),r!==""&&(e.textStyle=r)),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,r){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const r=this.getDOMSlot(e);let i=r.getFirstChild();for(let s=this.getFirstChild();s;s=s.getNextSibling()){const o=t.getElementByKey(s.getKey());o!==null&&(i==null?(r.insertChild(o),i=o):i!==o&&r.replaceChild(o,i),i=i.nextSibling)}}}function A(n){return n instanceof xe}function $d(n,e,t){let r=n.getNode();for(;r;){const i=r.__key;if(e.has(i)&&!t.has(i))return!0;r=r.getParent()}return!1}class Ss extends Kt{decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function V(n){return n instanceof Ss}class Er extends xe{__cachedText;static getType(){return"root"}static clone(){return new Er}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){L(51)}getTextContent(){const e=this.__cachedText;return!vr()&&ie()._dirtyType!==0||e===null?super.getTextContent():e}remove(){L(52)}replace(e){L(53)}insertBefore(e){L(54)}insertAfter(e){L(55)}updateDOM(e,t){return!1}splice(e,t,r){for(const i of r)A(i)||V(i)||L(282);return super.splice(e,t,r)}static importJSON(e){return fe().updateFromJSON(e)}collapseAtStart(){return!0}}function be(n){return n instanceof Er}function bg(n){return new Cs(new Map(n._nodeMap))}function Kc(){return new Cs(new Map([["root",new Er]]))}function xg(n){const e=n.exportJSON(),t=n.constructor;if(e.type!==t.getType()&&L(130,t.name),A(n)){const r=e.children;Array.isArray(r)||L(59,t.name);const i=n.getChildren();for(let s=0;s<i.length;s++){const o=xg(i[s]);r.push(o)}}return e}function Sg(n){return n instanceof Cs}class Cs{_nodeMap;_selection;_flushSync;_readOnly;constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return Ad(t&&t.editor||null,this,e)}clone(e){const t=new Cs(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return Ad(null,this,()=>({root:xg(fe())}))}}class il extends xe{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class kr extends xe{static getType(){return"paragraph"}static clone(e){return new kr(e.__key)}createDOM(e){const t=document.createElement("p"),r=Vr(e.theme,"paragraph");return r!==void 0&&t.classList.add(...r),t}updateDOM(e,t,r){return!1}static importDOM(){return{p:e=>({conversion:Gy,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(re(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();r&&(t.style.textAlign=r)}return{element:t}}static importJSON(e){return H().updateFromJSON(e)}exportJSON(){const e=super.exportJSON();if(e.textFormat===void 0||e.textStyle===void 0){const t=this.getChildren().find(D);t?(e.textFormat=t.getFormat(),e.textStyle=t.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,t){const r=H();r.setTextFormat(e.format),r.setTextStyle(e.style);const i=this.getDirection();return r.setDirection(i),r.setFormat(this.getFormatType()),r.setStyle(this.getStyle()),this.insertAfter(r,t),r}collapseAtStart(){const e=this.getChildren();if(e.length===0||D(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function Gy(n){const e=H();return n.style&&(e.setFormat(n.style.textAlign),ul(n,e)),{node:e}}function H(){return Le(new kr)}function Tr(n){return n instanceof kr}const B=0,G=1,Cg=2,wg=3,Wc=4;function vg(n,e,t,r){const i=n._keyToDOMMap;i.clear(),n._editorState=Kc(),n._pendingEditorState=r,n._compositionKey=null,n._dirtyType=0,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),n._normalizedNodes=new Set,n._updateTags=new Set,n._updates=[],n._blockCursorElement=null;const s=n._observer;s!==null&&(s.disconnect(),n._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",i.set("root",t))}function Eg(n){const e=new Set,t=new Set;let r=n;for(;r;){const{ownNodeConfig:i}=Es(r),s=r.transform;if(!t.has(s)){t.add(s);const o=r.transform();o&&e.add(o)}if(i){const o=i.$transform;o&&e.add(o),r=i.extends}else{const o=Object.getPrototypeOf(r);r=o.prototype instanceof Kt&&o!==Kt?o:void 0}}return e}function gi(n){const e=n||{},t=Jy(),r=e.theme||{},i=n===void 0?t:e.parentEditor||null,s=e.disableEvents||!1,o=Kc(),l=e.namespace||(i!==null?i._config.namespace:Ig()),a=e.editorState,c=[Er,Ye,Sr,Cr,kr,il,...e.nodes||[]],{onError:u,html:d}=e,f=e.editable===void 0||e.editable;let h;if(n===void 0&&t!==null)h=t._nodes;else{h=new Map;for(let p=0;p<c.length;p++){let m=c[p],b=null,_=null;if(typeof m!="function"){const C=m;m=C.replace,b=C.with,_=C.withKlass||null}Es(m);const y=m.getType(),S=Eg(m);h.set(y,{exportDOM:d&&d.export?d.export.get(m):void 0,klass:m,replace:b,replaceWithKlass:_,sharedNodeState:zh(c[p]),transforms:S})}}const g=new Qr(o,i,h,{disableEvents:s,namespace:l,theme:r},u||console.error,(function(p,m){const b=new Map,_=new Set,y=S=>{Object.keys(S).forEach(C=>{let x=b.get(C);x===void 0&&(x=[],b.set(C,x)),x.push(S[C])})};return p.forEach(S=>{const C=S.klass.importDOM;if(C==null||_.has(C))return;_.add(C);const x=C.call(S.klass);x!==null&&y(x)}),m&&y(m),b})(h,d?d.import:void 0),f,n);return a!==void 0&&(g._pendingEditorState=a,g._dirtyType=2),(function(p){p.registerCommand(Ac,ky,B),p.registerCommand(Oc,Ty,B),p.registerCommand(Mc,Ny,B),p.registerCommand($c,Ay,B),p.registerCommand(Ic,Oy,B)})(g),g}class Qr{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(e,t,r,i,s,o,l,a){this._createEditorArgs=a,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=i,this._nodes=r,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Ig(),this._onError=s,this._htmlConversions=o,this._editable=l,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,r){r===void 0&&L(35);const i=this._commands;i.has(e)||i.set(e,[new Set,new Set,new Set,new Set,new Set]);const s=i.get(e);s===void 0&&L(36,String(e));const o=s[r];return o.add(t),()=>{o.delete(t),s.every(l=>l.size===0)&&i.delete(e)}}registerMutationListener(e,t,r){const i=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,s=this._listeners.mutation;let o=s.get(t);o===void 0&&(o=new Set,s.set(t,o)),o.add(i);const l=r&&r.skipInitialization;return l!==void 0&&l||this.initializeMutationListener(t,i),()=>{o.delete(i),o.size===0&&s.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return t===void 0&&L(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const r=this._editorState,i=Ya(r).get(t.getType());if(!i)return;const s=new Map;for(const o of i.keys())s.set(o,"created");s.size>0&&e(s,{dirtyLeaves:new Set,prevEditorState:r,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const r=this.getRegisteredNode(e);return r.transforms.add(t),r}registerNodeTransform(e,t){const r=this.registerNodeTransformToKlass(e,t),i=[r],s=r.replaceWithKlass;if(s!=null){const o=this.registerNodeTransformToKlass(s,t);i.push(o)}return(function(o,l){const a=Ya(o.getEditorState()),c=[];for(const u of l){const d=a.get(u);d&&c.push(d)}c.length!==0&&o.update(()=>{for(const u of c)for(const d of u.keys()){const f=q(d);f&&f.markDirty()}},o._pendingEditorState===null?{tag:Gr}:void 0)})(this,i.map(o=>o.klass.getType())),()=>{i.forEach(o=>o.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return P(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const r=Vr(this._config.theme,"root"),i=this._pendingEditorState||this._editorState;if(this._rootElement=e,vg(this,t,e,i),t!==null&&(this._config.disableEvents||My(t),r!=null&&t.classList.remove(...r)),e!==null){const s=tu(e),o=e.style;o.userSelect="text",o.whiteSpace="pre-wrap",o.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=s,this._dirtyType=2,Bh(this),this._updateTags.add(Gr),nn(this),this._config.disableEvents||(function(l,a){const c=l.ownerDocument;za.set(l,c);const u=go.get(c)??0;u<1&&c.addEventListener("selectionchange",rg),go.set(c,u+1),l.__lexicalEditor=a;const d=ng(l);for(let f=0;f<Ba.length;f++){const[h,g]=Ba[f],p=typeof g=="function"?m=>{hd(m)||(fd(m),(a.isEditable()||h==="click")&&g(m,a))}:m=>{if(hd(m))return;fd(m);const b=a.isEditable();switch(h){case"cut":return b&&P(a,di,m);case"copy":return P(a,xr,m);case"paste":return b&&P(a,li,m);case"dragstart":return b&&P(a,Qo,m);case"dragover":return b&&P(a,Dc,m);case"dragend":return b&&P(a,Gh,m);case"focus":return b&&P(a,Rc,m);case"blur":return b&&P(a,fi,m);case"drop":return b&&P(a,Xo,m)}};l.addEventListener(h,p),d.push(()=>{l.removeEventListener(h,p)})}})(e,this),r!=null&&e.classList.add(...r)}else this._window=null,this._updateTags.add(Gr),nn(this);Wi("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&L(38);let r=e;r._readOnly&&(r=bg(e),r._selection=e._selection?e._selection.clone():null),Ph(this);const i=this._pendingEditorState,s=this._updateTags,o=t!==void 0?t.tag:null;i===null||i.isEmpty()||(o!=null&&s.add(o),nn(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,o!=null&&s.add(o),this._updating||nn(this)}parseEditorState(e,t){return(function(r,i,s){const o=Kc(),l=$e,a=st,c=Ie,u=i._dirtyElements,d=i._dirtyLeaves,f=i._cloneNotNeeded,h=i._dirtyType;i._dirtyElements=new Map,i._dirtyLeaves=new Set,i._cloneNotNeeded=new Set,i._dirtyType=0,$e=o,st=!1,Ie=i,jc(null);try{const g=i._nodes;Uc(r.root,g),s&&s(),o._readOnly=!0}catch(g){g instanceof Error&&i._onError(g)}finally{i._dirtyElements=u,i._dirtyLeaves=d,i._cloneNotNeeded=f,i._dirtyType=h,$e=l,st=a,Ie=c}return o})(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return nn(this),this.getEditorState().read(e,{editor:this})}update(e,t){(function(r,i,s){r._updating?r._updates.push([i,s]):rl(r,i,s)})(this,e,t)}focus(e,t={}){const r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),Wt(this,()=>{const i=O(),s=fe();i!==null?i.dirty||Fe(i.clone()):s.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?s.selectStart():s.selectEnd()),Rg("focus"),Pg(()=>{r.removeAttribute("autocapitalize"),e&&e()})}),this._pendingEditorState===null&&r.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const t=kt(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Wi("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}Qr.version="0.40.0+prod.esm";let Ga=null;function jc(n){Ga=n}let kg=1;function Vy(){kg=1}function Hc(n,e){const t=sl(n,e);return t===void 0&&L(30,e),t}function sl(n,e){return n._nodes.get(e)}const Yy=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function Tg(n){return V(gt(n))}function ol(n){const e=document.activeElement;if(!re(e))return!1;const t=e.nodeName;return V(gt(n))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&ws(e)==null)}function pi(n,e,t){const r=n.getRootElement();try{return r!==null&&r.contains(e)&&r.contains(t)&&e!==null&&!ol(e)&&al(e)===n}catch{return!1}}function ll(n){return n instanceof Qr}function al(n){let e=n;for(;e!=null;){const t=ws(e);if(ll(t))return t;e=vs(e)}return null}function ws(n){return n?n.__lexicalEditor:null}function Ng(n){return ay.test(n)?"rtl":cy.test(n)?"ltr":null}function On(n){return He(n)||n.isToken()}function Tt(n){return On(n)||n.isSegmented()}function qt(n){return jn(n)&&n.nodeType===3}function Jc(n){return jn(n)&&n.nodeType===9}function fr(n){let e=n;for(;e!=null;){if(qt(e))return e;e=e.firstChild}return null}function Co(n,e,t){const r=Pe[e];if(t!==null&&(n&r)===(t&r))return n;let i=n^r;return e==="subscript"?i&=~Pe.superscript:e==="superscript"?i&=~Pe.subscript:e==="lowercase"?(i&=~Pe.uppercase,i&=~Pe.capitalize):e==="uppercase"?(i&=~Pe.lowercase,i&=~Pe.capitalize):e==="capitalize"&&(i&=~Pe.lowercase,i&=~Pe.uppercase),i}function Gc(n){return D(n)||ue(n)||V(n)}function Ag(n,e){const t=(function(){const o=Ga;return Ga=null,o})();if((e=e||t&&t.__key)!=null)return void(n.__key=e);Oe(),pg();const r=ie(),i=xn(),s=""+kg++;i._nodeMap.set(s,n),A(n)?r._dirtyElements.set(s,!0):r._dirtyLeaves.add(s),r._cloneNotNeeded.add(s),r._dirtyType=1,n.__key=s}function jt(n){const e=n.getParent();if(e!==null){const t=n.getWritable(),r=e.getWritable(),i=n.getPreviousSibling(),s=n.getNextSibling(),o=s!==null?s.__key:null,l=i!==null?i.__key:null,a=i!==null?i.getWritable():null,c=s!==null?s.getWritable():null;i===null&&(r.__first=o),s===null&&(r.__last=l),a!==null&&(a.__next=o),c!==null&&(c.__prev=l),t.__prev=null,t.__next=null,t.__parent=null,r.__size--}}function wo(n){pg(),mo(n)&&L(323,n.__key,n.__type);const e=n.getLatest(),t=e.__parent,r=xn(),i=ie(),s=r._nodeMap,o=i._dirtyElements;t!==null&&(function(a,c,u){let d=a;for(;d!==null;){if(u.has(d))return;const f=c.get(d);if(f===void 0)break;u.set(d,!1),d=f.__parent}})(t,s,o);const l=e.__key;i._dirtyType=1,A(n)?o.set(l,!0):i._dirtyLeaves.add(l)}function Me(n){Oe();const e=ie(),t=e._compositionKey;if(n!==t){if(e._compositionKey=n,t!==null){const r=q(t);r!==null&&r.getWritable()}if(n!==null){const r=q(n);r!==null&&r.getWritable()}}}function kn(){return vr()?null:ie()._compositionKey}function q(n,e){const t=(e||xn())._nodeMap.get(n);return t===void 0?null:t}function Vc(n,e){const t=cl(n,ie());return t!==void 0?q(t,e):null}function cl(n,e){return n[`__lexicalKey_${e._key}`]}function gt(n,e){let t=n;for(;t!=null;){const r=Vc(t,e);if(r!==null)return r;t=vs(t)}return null}function Og(n){const e=n._decorators,t=Object.assign({},e);return n._pendingDecorators=t,t}function Id(n){return n.read(()=>fe().getTextContent())}function fe(){return Mg(xn())}function Mg(n){return n._nodeMap.get("root")}function Fe(n){Oe();const e=xn();n!==null&&(n.dirty=!0,n.setCachedNodes(null)),e._selection=n}function Hr(n){const e=ie(),t=(function(r,i){let s=r;for(;s!=null;){const o=cl(s,i);if(o!==void 0)return o;s=vs(s)}return null})(n,e);return t===null?n===e.getRootElement()?q("root"):null:q(t)}function $g(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function Yc(n){const e=[];let t=n;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function Ig(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Fg(n){return qt(n)?n.nodeValue:null}function qc(n,e,t){const r=kt(Et(e));if(r===null)return;const i=r.anchorNode;let{anchorOffset:s,focusOffset:o}=r;if(i!==null){let l=Fg(i);const a=gt(i);if(l!==null&&D(a)){if(l===jo&&t){const c=t.length;l=t,s=c,o=c}l!==null&&Zc(a,l,s,o,n)}}}function Zc(n,e,t,r,i){let s=n;if(s.isAttached()&&(i||!s.isDirty())){const o=s.isComposing();let l=e;(o||i)&&e[e.length-1]===jo&&(l=e.slice(0,-1));const a=s.getTextContent();if(i||l!==a){if(l===""){if(Me(null),_s||si||ys)s.remove();else{const p=ie();setTimeout(()=>{p.update(()=>{s.isAttached()&&s.remove()})},20)}return}const c=s.getParent(),u=bn(),d=s.getTextContentSize(),f=kn(),h=s.getKey();if(s.isToken()||f!==null&&h===f&&!o||N(u)&&(c!==null&&!c.canInsertTextBefore()&&u.anchor.offset===0||u.anchor.key===n.__key&&u.anchor.offset===0&&!s.canInsertTextBefore()&&!o||u.focus.key===n.__key&&u.focus.offset===d&&!s.canInsertTextAfter()&&!o))return void s.markDirty();const g=O();if(!N(g)||t===null||r===null)return void Fd(s,l,g);if(g.setTextNodeRange(s,t,s,r),s.isSegmented()){const p=de(s.getTextContent());s.replace(p),s=p}Fd(s,l,g)}}}function Fd(n,e,t){if(n.setTextContent(e),N(t)){const r=n.getKey();for(const i of["anchor","focus"]){const s=t[i];s.type==="text"&&s.key===r&&(s.offset=$t(n,s.offset,"clamp"))}}}function Ls(n,e,t){const r=e[t]||!1;return r==="any"||r===n[t]}function Dg(n,e){return Ls(n,e,"altKey")&&Ls(n,e,"ctrlKey")&&Ls(n,e,"shiftKey")&&Ls(n,e,"metaKey")}function te(n,e,t){return Dg(n,t)&&n.key.toLowerCase()===e.toLowerCase()}const tn={ctrlKey:!Nt,metaKey:Nt},Dd={altKey:Nt,ctrlKey:!Nt};function Ld(n){return n.key==="Backspace"}function Rd(n){return te(n,"a",tn)}function Xc(n){const e=fe();if(N(n)){const t=n.anchor,r=n.focus,i=t.getNode().getTopLevelElementOrThrow().getParentOrThrow();return t.set(i.getKey(),0,"element"),r.set(i.getKey(),i.getChildrenSize(),"element"),In(n),n}{const t=e.select(0,e.getChildrenSize());return Fe(In(t)),t}}function Vr(n,e){n.__lexicalClassNameCache===void 0&&(n.__lexicalClassNameCache={});const t=n.__lexicalClassNameCache,r=t[e];if(r!==void 0)return r;const i=n[e];if(typeof i=="string"){const s=hn(i);return t[e]=s,s}return i}function Qc(n,e,t,r,i){if(t.size===0)return;const s=r.__type,o=r.__key,l=e.get(s);l===void 0&&L(33,s);const a=l.klass;let c=n.get(a);c===void 0&&(c=new Map,n.set(a,c));const u=c.get(o),d=u==="destroyed"&&i==="created";(u===void 0||d)&&c.set(o,d?"updated":i)}function qy(n){const e=n.getType(),t=xn();if(t._readOnly){const s=Ya(t).get(e);return s?Array.from(s.values()):[]}const r=t._nodeMap,i=[];for(const[,s]of r)s instanceof n&&s.__type===e&&s.isAttached()&&i.push(s);return i}function Pd(n,e,t){const r=n.getParent();let i=t,s=n;return r!==null&&(e&&t===0?(i=s.getIndexWithinParent(),s=r):e||t!==s.getChildrenSize()||(i=s.getIndexWithinParent()+1,s=r)),s.getChildAtIndex(e?i-1:i)}function vo(n,e){const t=n.offset;if(n.type==="element")return Pd(n.getNode(),e,t);{const r=n.getNode();if(e&&t===0||!e&&t===r.getTextContentSize()){const i=e?r.getPreviousSibling():r.getNextSibling();return i===null?Pd(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):i}}return null}function Lg(n){const e=Et(n).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function P(n,e,t){return(function(r,i,s){const o=Yc(r);for(let l=4;l>=0;l--)for(let a=0;a<o.length;a++){const c=o[a],u=c._commands.get(i);if(u!==void 0){const d=u[l];if(d!==void 0){const f=Array.from(d),h=f.length;let g=!1;if(Wt(c,()=>{for(let p=0;p<h;p++)if(f[p](s,r))return void(g=!0)}),g)return g}}}return!1})(n,e,t)}function hr(n,e){const t=n._keyToDOMMap.get(e);return t===void 0&&L(75,e),t}function vs(n){const e=n.assignedSlot||n.parentElement;return ko(e)?e.host:e}function eu(n){return Jc(n)?n:re(n)?n.ownerDocument:null}function Zy(n){return ie()._updateTags.has(n)}function Rg(n){Oe(),ie()._updateTags.add(n)}function Pg(n){Oe(),ie()._deferred.push(n)}function Eo(n,e){let t=n.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function tu(n){const e=eu(n);return e?e.defaultView:null}function Et(n){const e=n._window;return e===null&&L(78),e}function Bg(n){return A(n)&&n.isInline()||V(n)&&n.isInline()}function zg(n){let e=n.getParentOrThrow();for(;e!==null;){if(ze(e))return e;e=e.getParentOrThrow()}return e}function ze(n){return be(n)||A(n)&&n.isShadowRoot()}function nu(n){const e=n.constructor.clone(n);return Ag(e,null),e.afterCloneFrom(n),e}function Le(n){const e=ie(),t=n.getType(),r=sl(e,t);r===void 0&&L(200,n.constructor.name,t);const{replace:i,replaceWithKlass:s}=r;if(i!==null){const o=i(n),l=o.constructor;return s!==null?o instanceof s||L(201,s.name,s.getType(),l.name,l.getType(),n.constructor.name,t):o instanceof n.constructor&&l!==n.constructor||L(202,l.name,l.getType(),n.constructor.name,t),o.__key===n.__key&&L(203,n.constructor.name,t,l.name,l.getType()),o}return n}function na(n,e){!be(n.getParent())||A(e)||V(e)||L(99)}function Qn(n){const e=q(n);return e===null&&L(63,n),e}function ra(n){return(V(n)||A(n)&&!n.canBeEmpty())&&!n.isInline()}function Va(n,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=n.parentElement;r!==null&&r.removeChild(n)}function kt(n){return Lt?(n||window).getSelection():null}function Ug(n){const e=tu(n);return e?e.getSelection():null}function Xy(n,e){let t=n.getChildAtIndex(e);t==null&&(t=n),ze(n)&&L(102);const r=o=>{const l=o.getParentOrThrow(),a=ze(l),c=o!==t||a?nu(o):o;if(a)return A(o)&&A(c)||L(133),o.insertAfter(c),[o,c,c];{const[u,d,f]=r(l),h=o.getNextSiblings();return f.append(c,...h),[u,d,c]}},[i,s]=r(t);return[i,s]}function ru(n){return re(n)&&n.tagName==="A"}function re(n){return jn(n)&&n.nodeType===1}function jn(n){return typeof n=="object"&&n!==null&&"nodeType"in n&&typeof n.nodeType=="number"}function ko(n){return jn(n)&&n.nodeType===11}function To(n){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return n.nodeName.match(e)!==null}function ns(n){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return n.nodeName.match(e)!==null}function dt(n){if(V(n)&&!n.isInline())return!0;if(!A(n)||ze(n))return!1;const e=n.getFirstChild(),t=e===null||ue(e)||D(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function mi(){return ie()}const Bd=new WeakMap,Qy=new Map;function Ya(n){if(!n._readOnly&&n.isEmpty())return Qy;n._readOnly||L(192);let e=Bd.get(n);return e||(e=(function(t){const r=new Map;for(const[i,s]of t._nodeMap){const o=s.__type;let l=r.get(o);l||(l=new Map,r.set(o,l)),l.set(i,s)}return r})(n),Bd.set(n,e)),e}function iu(n){const e=n.constructor.clone(n);return e.afterCloneFrom(n),e}function Kg(n){return(e=iu(n))[ig]=!0,e;var e}function ul(n,e){const t=parseInt(n.style.paddingInlineStart,10)||0,r=Math.round(t/40);e.setIndent(r)}function Wg(n){n.__lexicalUnmanaged=!0}function jg(n){return n.__lexicalUnmanaged===!0}function Ai(n,e){return(function(t,r){return Object.prototype.hasOwnProperty.call(t,r)})(n,e)&&n[e]!==Kt[e]}function Es(n){const e=Qu in n.prototype?n.prototype[Qu]():void 0,t=(function(o){if(!(o===Kt||o.prototype instanceof Kt)){let l="<unknown>",a="<unknown>";try{l=o.getType()}catch{}try{Qr.version&&(a=JSON.parse(Qr.version))}catch{}L(290,o.name,l,a)}return o===Ss||o===xe||o===Kt})(n),r=!t&&Ai(n,"getType")?n.getType():void 0;let i,s=r;if(e)if(r)i=e[r];else for(const[o,l]of Object.entries(e))s=o,i=l;if(!t&&s&&(Ai(n,"getType")||(n.getType=()=>s),Ai(n,"clone")||(n.clone=o=>(jc(o),new n)),Ai(n,"importJSON")||(n.importJSON=i&&i.$importJSON||(o=>new n().updateFromJSON(o))),!Ai(n,"importDOM")&&i)){const{importDOM:o}=i;o&&(n.importDOM=()=>o)}return{ownNodeConfig:i,ownNodeType:s}}function Hg(n){const e=mi();return Oe(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(n))).klass}const le=(n,e)=>{let t=n;for(;t!=null&&!be(t);){if(e(t))return t;t=t.getParent()}return null},eb={next:"previous",previous:"next"};class dl{origin;constructor(e){this.origin=e}[Symbol.iterator](){return hl({hasNext:Ln,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return ye(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return ye(this.origin,this.direction)}remove(){const e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){const r=this.getNodeAtCaret();return e.is(this.origin)||e.is(r)||(r===null?this.insert(e):r.replace(e,t)),this}splice(e,t,r="next"){const i=r===this.direction?t:Array.from(t).reverse();let s=this;const o=this.getParentAtCaret(),l=new Map;for(let a=s.getAdjacentCaret();a!==null&&l.size<e;a=a.getAdjacentCaret()){const c=a.origin.getWritable();l.set(c.getKey(),c)}for(const a of i){if(l.size>0){const c=s.getNodeAtCaret();if(c){if(l.delete(c.getKey()),l.delete(a.getKey()),!(c.is(a)||s.origin.is(a))){const u=a.getParent();u&&u.is(o)&&a.remove(),c.replace(a)}}else c===null&&L(263,Array.from(l).join(" "))}else s.insert(a);s=ye(a,this.direction)}for(const a of l.values())a.remove();return this}}class rs extends dl{type="child";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:at(e,this.direction)}getParentCaret(e="root"){return ye(su(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Hn(this.direction);return ye(this.getNodeAtCaret(),e)||at(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof rs&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}}const tb={root:be,shadowRoot:ze};function Hn(n){return eb[n]}function su(n,e="root"){return tb[e](n)?null:n}class gr extends dl{type="sibling";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:ye(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return A(this.origin)?at(this.origin,this.direction):null}getParentCaret(e="root"){return ye(su(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Hn(this.direction);return ye(this.getNodeAtCaret(),e)||at(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof gr&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof gr||e instanceof pr)&&this.direction===e.direction&&this.origin.is(e.origin)}}class pr extends dl{type="text";offset;constructor(e,t){super(e),this.offset=t}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:fn(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return ye(su(this.getParentAtCaret(),e),this.direction)}getFlipped(){return fn(this.origin,Hn(this.direction),this.offset)}isSamePointCaret(e){return e instanceof pr&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof gr||e instanceof pr)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return ye(this.origin,this.direction)}}function Mt(n){return n instanceof pr}function nb(n){return n instanceof dl}function Ln(n){return n instanceof gr}function ht(n){return n instanceof rs}const rb={next:class extends pr{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(n){return this.origin.insertAfter(n),this}},previous:class extends pr{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(n){return this.origin.insertBefore(n),this}}},ib={next:class extends gr{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(n){return this.origin.insertAfter(n),this}},previous:class extends gr{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(n){return this.origin.insertBefore(n),this}}},sb={next:class extends rs{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(n){return this.origin.splice(0,0,[n]),this}},previous:class extends rs{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(n){return this.origin.splice(this.origin.getChildrenSize(),0,[n]),this}}};function ye(n,e){return n?new ib[e](n):null}function fn(n,e,t){return n?new rb[e](n,$t(n,t)):null}function $t(n,e,t="error"){const r=n.getTextContentSize();let i=e==="next"?r:e==="previous"?0:e;return(i<0||i>r)&&(t!=="clamp"&&$h(284,String(e),String(r),n.getKey()),i=i<0?0:r),i}function qa(n,e){return new Gg(n,e)}function at(n,e){return A(n)?new sb[e](n):null}function Jg(n){return n&&n.getChildCaret()||n}function mr(n){return n&&Jg(n.getAdjacentCaret())}class ou{type="node-caret-range";direction;anchor;focus;constructor(e,t,r){this.anchor=e,this.focus=t,this.direction=r}getLatest(){const e=this.anchor.getLatest(),t=this.focus.getLatest();return e===this.anchor&&t===this.focus?this:new ou(e,t,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const e=i=>{const s=this[i].getLatest();return Mt(s)?(function(o,l){const{direction:a,origin:c}=o,u=$t(c,l==="focus"?Hn(a):a);return qa(o,u-o.offset)})(s,i):null},t=e("anchor"),r=e("focus");if(t&&r){const{caret:i}=t,{caret:s}=r;if(i.isSameNodeCaret(s))return[qa(i,s.offset-i.offset),null]}return[t,r]}iterNodeCarets(e="root"){const t=Mt(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),r=this.focus.getLatest(),i=Mt(r),s=o=>o.isSameNodeCaret(r)?null:mr(o)||o.getParentCaret(e);return hl({hasNext:o=>o!==null&&!(i&&r.isSameNodeCaret(o)),initial:t.isSameNodeCaret(r)?null:s(t),map:o=>o,step:s})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class Gg{type="slice";caret;distance;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){const{distance:e,caret:{offset:t}}=this,r=t+e;return r<t?[r,t]:[t,r]}getTextContent(){const[e,t]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,t)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:e,direction:t}}=this,[r,i]=this.getSliceIndices(),s=e.getTextContent();return fn(e.setTextContent(s.slice(0,r)+s.slice(i)),t,r)}}function ob(n){return n instanceof Gg}function fl(n){return Vt(n,ye(fe(),n.direction))}function lu(n){return Vt(n,n)}function Vt(n,e){return n.direction!==e.direction&&L(265),new ou(n,e,n.direction)}function hl(n){const{initial:e,hasNext:t,step:r,map:i}=n;let s=e;return{[Symbol.iterator](){return this},next(){if(!t(s))return{done:!0,value:void 0};const o={done:!1,value:i(s)};return s=r(s),o}}}function au(n,e){const t=Hi(n.origin,e.origin);switch(t===null&&L(275,n.origin.getKey(),e.origin.getKey()),t.type){case"same":{const r=n.type==="text",i=e.type==="text";return r&&i?(function(s,o){return Math.sign(s-o)})(n.offset,e.offset):n.type===e.type?0:r?-1:i?1:n.type==="child"?-1:1}case"ancestor":return n.type==="child"?-1:1;case"descendant":return e.type==="child"?1:-1;case"branch":return cu(t)}}function cu(n){const{a:e,b:t}=n,r=e.__key,i=t.__key;let s=e,o=t;for(;s&&o;s=s.getNextSibling(),o=o.getNextSibling()){if(s.__key===i)return-1;if(o.__key===r)return 1}return s===null?1:-1}function Rs(n,e){return e.is(n)}function zd(n){return A(n)?[n.getLatest(),null]:[n.getParent(),n.getLatest()]}function Hi(n,e){if(n.is(e))return{commonAncestor:n,type:"same"};const t=new Map;for(let[r,i]=zd(n);r;i=r,r=r.getParent())t.set(r,i);for(let[r,i]=zd(e);r;i=r,r=r.getParent()){const s=t.get(r);if(s!==void 0)return s===null?(Rs(n,r)||L(276),{commonAncestor:r,type:"ancestor"}):i===null?(Rs(e,r)||L(277),{commonAncestor:r,type:"descendant"}):((A(s)||Rs(n,s))&&(A(i)||Rs(e,i))&&r.is(s.getParent())&&r.is(i.getParent())||L(278),{a:s,b:i,commonAncestor:r,type:"branch"})}return null}function Dt(n,e){const{type:t,key:r,offset:i}=n,s=Qn(n.key);return t==="text"?(D(s)||L(266,s.getType(),r),fn(s,e,i)):(A(s)||L(267,s.getType(),r),Yg(s,n.offset,e))}function Rn(n,e){const{origin:t,direction:r}=e,i=r==="next";Mt(e)?n.set(t.getKey(),e.offset,"text"):Ln(e)?D(t)?n.set(t.getKey(),$t(t,r),"text"):n.set(t.getParentOrThrow().getKey(),t.getIndexWithinParent()+(i?1:0),"element"):(ht(e)&&A(t)||L(268),n.set(t.getKey(),i?0:t.getChildrenSize(),"element"))}function gl(n){const e=O(),t=N(e)?e:hi();return Ji(t,n),Fe(t),t}function Ji(n,e){Rn(n.anchor,e.anchor),Rn(n.focus,e.focus)}function No(n){const{anchor:e,focus:t}=n,r=Dt(e,"next"),i=Dt(t,"next"),s=au(r,i)<=0?"next":"previous";return Vt(Yt(r,s),Yt(i,s))}function _i(n){const{direction:e,origin:t}=n,r=ye(t,Hn(e)).getNodeAtCaret();return r?ye(r,e):at(t.getParentOrThrow(),e)}function Ud(n,e="root"){const t=[n];for(let r=ht(n)?n.getParentCaret(e):n.getSiblingCaret();r!==null;r=r.getParentCaret(e))t.push(_i(r));return t}function ia(n){return!!n&&n.origin.isAttached()}function Vg(n,e="removeEmptySlices"){if(n.isCollapsed())return n;const t="root",r="next";let i=e;const s=pl(n,r),o=Ud(s.anchor,t),l=Ud(s.focus.getFlipped(),t),a=new Set,c=[];for(const g of s.iterNodeCarets(t))if(ht(g))a.add(g.origin.getKey());else if(Ln(g)){const{origin:p}=g;A(p)&&!a.has(p.getKey())||c.push(p)}for(const g of c)g.remove();for(const g of s.getTextSlices()){if(!g)continue;const{origin:p}=g.caret,m=p.getTextContentSize(),b=_i(ye(p,r)),_=p.getMode();if(Math.abs(g.distance)===m&&i==="removeEmptySlices"||_==="token"&&g.distance!==0)b.remove();else if(g.distance!==0){i="removeEmptySlices";let y=g.removeTextSlice();const S=g.caret.origin;if(_==="segmented"){const C=y.origin,x=de(C.getTextContent()).setStyle(C.getStyle()).setFormat(C.getFormat());b.replaceOrInsert(x),y=fn(x,r,y.offset)}S.is(o[0].origin)&&(o[0]=y),S.is(l[0].origin)&&(l[0]=y.getFlipped())}}let u,d;for(const g of o)if(ia(g)){u=tt(g);break}for(const g of l)if(ia(g)){d=tt(g);break}const f=(function(g,p,m){if(!g||!p)return null;const b=g.getParentAtCaret(),_=p.getParentAtCaret();if(!b||!_)return null;const y=b.getParents().reverse();y.push(b);const S=_.getParents().reverse();S.push(_);const C=Math.min(y.length,S.length);let x;for(x=0;x<C&&y[x]===S[x];x++);const v=(M,T)=>{let I;for(let K=x;K<M.length;K++){const $=M[K];if(ze($))return;!I&&T($)&&(I=$)}return I},k=v(y,dt),E=k&&v(S,M=>m.has(M.getKey())&&dt(M));return k&&E?[k,E]:null})(u,d,a);if(f){const[g,p]=f;at(g,"previous").splice(0,p.getChildren()),p.remove()}const h=[u,d,...o,...l].find(ia);if(h)return lu(Yt(tt(h),n.direction));L(269,JSON.stringify(o.map(g=>g.origin.__key)))}function tt(n){const e=(function(i){let s=i;for(;ht(s);){const o=mr(s);if(!ht(o))break;s=o}return s})(n.getLatest()),{direction:t}=e;if(D(e.origin))return Mt(e)?e:fn(e.origin,t,t);const r=e.getAdjacentCaret();return Ln(r)&&D(r.origin)?fn(r.origin,t,Hn(t)):e}function uu(n){return Mt(n)&&n.offset!==$t(n.origin,n.direction)}function Yt(n,e){return n.direction===e?n:n.getFlipped()}function pl(n,e){return n.direction===e?n:Vt(Yt(n.focus,e),Yt(n.anchor,e))}function Yg(n,e,t){let r=at(n,"next");for(let i=0;i<e;i++){const s=r.getAdjacentCaret();if(s===null)break;r=s}return Yt(r,t)}function lb(n,e="root"){let t=0,r=n,i=mr(r);for(;i===null;){if(t--,i=r.getParentCaret(e),!i)return null;r=i,i=mr(r)}return i&&[i,t]}function ab(n){const{origin:e,offset:t,direction:r}=n;if(t===$t(e,r))return n.getSiblingCaret();if(t===$t(e,Hn(r)))return _i(n.getSiblingCaret());const[i]=e.splitText(t);return D(i)||L(281),Yt(ye(i,"next"),r)}function cb(n,e){return!0}function qg(n,{$copyElementNode:e=nu,$splitTextPointCaretNext:t=ab,rootMode:r="shadowRoot",$shouldSplit:i=cb}={}){if(Mt(n))return t(n);const s=n.getParentCaret(r);if(s){const{origin:o}=s;if(ht(n)&&(!o.canBeEmpty()||!i(o,"first")))return _i(s);const l=(function(a){const c=[];for(let u=a.getAdjacentCaret();u;u=u.getAdjacentCaret())c.push(u.origin);return c})(n);(l.length>0||o.canBeEmpty()&&i(o,"last"))&&s.insert(e(o).splice(0,0,l))}return s}function ub(n){return n}function Zg(...n){return n}function db(n,e){return[n,e]}function fb(n){return n}function Xg(n,e){if(!e||n===e)return n;for(const t in e)if(n[t]!==e[t])return{...n,...e};return n}function hn(...n){const e=[];for(const t of n)if(t&&typeof t=="string")for(const[r]of t.matchAll(/\S+/g))e.push(r);return e}function me(n,...e){const t=hn(...e);t.length>0&&n.classList.add(...t)}function un(n,...e){const t=hn(...e);t.length>0&&n.classList.remove(...t)}function pt(...n){return()=>{for(let e=n.length-1;e>=0;e--)n[e]();n.length=0}}const hb=Object.freeze(Object.defineProperty({__proto__:null,$addUpdateTag:Rg,$applyNodeReplacement:Le,$caretFromPoint:Dt,$caretRangeFromSelection:No,$cloneWithProperties:iu,$cloneWithPropertiesEphemeral:Kg,$comparePointCaretNext:au,$copyNode:nu,$create:Hg,$createLineBreakNode:lt,$createNodeSelection:zc,$createParagraphNode:H,$createPoint:Ne,$createRangeSelection:hi,$createRangeSelectionFromDom:Ky,$createTabNode:Ct,$createTextNode:de,$extendCaretToRange:fl,$findMatchingParent:le,$getAdjacentChildCaret:mr,$getAdjacentNode:vo,$getAdjacentSiblingOrParentSiblingCaret:lb,$getCaretInDirection:Yt,$getCaretRange:Vt,$getCaretRangeInDirection:pl,$getCharacterOffsets:yo,$getChildCaret:at,$getChildCaretAtIndex:Yg,$getChildCaretOrSelf:Jg,$getCollapsedCaretRange:lu,$getCommonAncestor:Hi,$getCommonAncestorResultBranchOrder:cu,$getEditor:mi,$getNearestNodeFromDOMNode:gt,$getNearestRootOrShadowRoot:zg,$getNodeByKey:q,$getNodeByKeyOrThrow:Qn,$getNodeFromDOMNode:Vc,$getPreviousSelection:bn,$getRoot:fe,$getSelection:O,$getSiblingCaret:ye,$getState:qi,$getStateChange:xy,$getTextContent:jy,$getTextNodeOffset:$t,$getTextPointCaret:fn,$getTextPointCaretSlice:qa,$getWritableNodeState:Jo,$hasAncestor:Eo,$hasUpdateTag:Zy,$insertNodes:nl,$isBlockElementNode:bo,$isChildCaret:ht,$isDecoratorNode:V,$isEditorState:Sg,$isElementNode:A,$isExtendableTextPointCaret:uu,$isInlineElementOrDecoratorNode:Bg,$isLeafNode:Gc,$isLineBreakNode:ue,$isNodeCaret:nb,$isNodeSelection:je,$isParagraphNode:Tr,$isRangeSelection:N,$isRootNode:be,$isRootOrShadowRoot:ze,$isSiblingCaret:Ln,$isTabNode:He,$isTextNode:D,$isTextPointCaret:Mt,$isTextPointCaretSlice:ob,$isTokenOrSegmented:Tt,$isTokenOrTab:On,$nodesOfType:qy,$normalizeCaret:tt,$normalizeSelection__EXPERIMENTAL:In,$onUpdate:Pg,$parseSerializedNode:yg,$removeTextFromCaretRange:Vg,$rewindSiblingCaret:_i,$selectAll:Xc,$setCompositionKey:Me,$setPointFromCaret:Rn,$setSelection:Fe,$setSelectionFromCaretRange:gl,$setState:Ys,$splitAtPointCaretNext:qg,$splitNode:Xy,$updateRangeSelectionFromCaretRange:Ji,ArtificialNode__DO_NOT_USE:il,BEFORE_INPUT_COMMAND:Ac,BLUR_COMMAND:fi,CAN_REDO_COMMAND:Fi,CAN_UNDO_COMMAND:Di,CLEAR_EDITOR_COMMAND:Lc,CLEAR_HISTORY_COMMAND:Vh,CLICK_COMMAND:br,COLLABORATION_TAG:og,COMMAND_PRIORITY_CRITICAL:Wc,COMMAND_PRIORITY_EDITOR:B,COMMAND_PRIORITY_HIGH:wg,COMMAND_PRIORITY_LOW:G,COMMAND_PRIORITY_NORMAL:Cg,COMPOSITION_END_COMMAND:$c,COMPOSITION_START_COMMAND:Mc,CONTROLLED_TEXT_INSERTION_COMMAND:An,COPY_COMMAND:xr,CUT_COMMAND:di,DELETE_CHARACTER_COMMAND:Ot,DELETE_LINE_COMMAND:ur,DELETE_WORD_COMMAND:cr,DRAGEND_COMMAND:Gh,DRAGOVER_COMMAND:Dc,DRAGSTART_COMMAND:Qo,DROP_COMMAND:Xo,DecoratorNode:Ss,ElementNode:xe,FOCUS_COMMAND:Rc,FORMAT_ELEMENT_COMMAND:Fc,FORMAT_TEXT_COMMAND:ve,HISTORIC_TAG:_o,HISTORY_MERGE_TAG:Gr,HISTORY_PUSH_TAG:sg,INDENT_CONTENT_COMMAND:Ut,INPUT_COMMAND:Oc,INSERT_LINE_BREAK_COMMAND:cn,INSERT_PARAGRAPH_COMMAND:Fn,INSERT_TAB_COMMAND:ho,INTERNAL_$isBlock:dt,IS_ALL_FORMATTING:ey,IS_BOLD:G_,IS_CODE:Z_,IS_HIGHLIGHT:Ec,IS_ITALIC:V_,IS_STRIKETHROUGH:Y_,IS_SUBSCRIPT:X_,IS_SUPERSCRIPT:Q_,IS_UNDERLINE:q_,KEY_ARROW_DOWN_COMMAND:dr,KEY_ARROW_LEFT_COMMAND:bs,KEY_ARROW_RIGHT_COMMAND:Vo,KEY_ARROW_UP_COMMAND:dn,KEY_BACKSPACE_COMMAND:qo,KEY_DELETE_COMMAND:Zo,KEY_DOWN_COMMAND:Ic,KEY_ENTER_COMMAND:Dn,KEY_ESCAPE_COMMAND:ui,KEY_MODIFIER_COMMAND:Yh,KEY_SPACE_COMMAND:Yo,KEY_TAB_COMMAND:xs,LineBreakNode:Sr,MOVE_TO_END:fo,MOVE_TO_START:es,NODE_STATE_KEY:gy,OUTDENT_CONTENT_COMMAND:sn,PASTE_COMMAND:li,PASTE_TAG:Pc,ParagraphNode:kr,REDO_COMMAND:ci,REMOVE_TEXT_COMMAND:Qi,RootNode:Er,SELECTION_CHANGE_COMMAND:oi,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:Nc,SELECT_ALL_COMMAND:Xr,SKIP_COLLAB_TAG:Iy,SKIP_DOM_SELECTION_TAG:ag,SKIP_SCROLL_INTO_VIEW_TAG:lg,SKIP_SELECTION_FOCUS_TAG:Ja,TEXT_TYPE_TO_FORMAT:Pe,TabNode:Cr,TextNode:Ye,UNDO_COMMAND:ai,addClassNamesToElement:me,buildImportMap:$y,configExtension:Zg,createCommand:z,createEditor:gi,createSharedNodeState:zh,createState:Tc,declarePeerDependency:db,defineExtension:ub,flipDirection:Hn,getDOMOwnerDocument:eu,getDOMSelection:kt,getDOMSelectionFromTarget:Ug,getDOMTextNode:fr,getEditorPropertyFromDOMNode:ws,getNearestEditorFromDOMNode:al,getRegisteredNode:sl,getRegisteredNodeOrThrow:Hc,getStaticNodeConfig:Es,getTextDirection:Ng,getTransformSetFromKlass:Eg,isBlockDomNode:ns,isCurrentlyReadOnlyMode:vr,isDOMDocumentNode:Jc,isDOMNode:jn,isDOMTextNode:qt,isDOMUnmanaged:jg,isDocumentFragment:ko,isExactShortcutMatch:te,isHTMLAnchorElement:ru,isHTMLElement:re,isInlineDomNode:To,isLexicalEditor:ll,isModifierMatch:Dg,isSelectionCapturedInDecoratorInput:ol,isSelectionWithinEditor:pi,makeStepwiseIterator:hl,mergeRegister:pt,normalizeClassNames:hn,removeClassNamesFromElement:un,removeFromParent:jt,resetRandomKey:Vy,safeCast:fb,setDOMUnmanaged:Wg,setNodeIndentFromDOM:ul,shallowMergeConfig:Xg},Symbol.toStringTag,{value:"Module"}));function gb(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const Ao=new Map;function Qg(n){const e={};if(!n)return e;const t=n.split(";");for(const r of t)if(r!==""){const[i,s]=r.split(/:([^]+)/);i&&s&&(e[i.trim()]=s.trim())}return e}function is(n){let e=Ao.get(n);return e===void 0&&(e=Qg(n),Ao.set(n,e)),e}function pb(n){let e="";for(const t in n)t&&(e+=`${t}: ${n[t]};`);return e}function ep(n){const e=mi().getElementByKey(n.getKey());if(e===null)return null;const t=e.ownerDocument.defaultView;return t===null?null:t.getComputedStyle(e)}function tp(n){return ep(be(n)?n:n.getParentOrThrow())}function Kd(n){const e=tp(n);return e!==null&&e.direction==="rtl"}function np(n,e,t="self"){const r=n.getStartEndPoints();if(e.isSelected(n)&&!Tt(e)&&r!==null){const[i,s]=r,o=n.isBackward(),l=i.getNode(),a=s.getNode(),c=e.is(l),u=e.is(a);if(c||u){const[d,f]=yo(n),h=l.is(a),g=e.is(o?a:l),p=e.is(o?l:a);let m,b=0;h?(b=d>f?f:d,m=d>f?d:f):g?(b=o?f:d,m=void 0):p&&(b=0,m=o?d:f);const _=e.__text.slice(b,m);_!==e.__text&&(t==="clone"&&(e=Kg(e)),e.__text=_)}}return e}function mb(n){const e=n.getStyle(),t=Qg(e);Ao.set(e,t)}function Ps(n,e){(N(n)?n.isCollapsed():D(n)||A(n))||gb(280);const t=is(N(n)?n.style:D(n)?n.getStyle():n.getTextStyle()),r=Object.entries(e).reduce((s,[o,l])=>(typeof l=="function"?s[o]=l(t[o],n):l===null?delete s[o]:s[o]=l,s),{...t}),i=pb(r);N(n)||D(n)?n.setStyle(i):n.setTextStyle(i),Ao.set(i,r)}function Bs(n,e){if(N(n)&&n.isCollapsed()){Ps(n,e);const r=n.anchor.getNode();A(r)&&r.isEmpty()&&Ps(r,e)}_b(r=>{Ps(r,e)});const t=n.getNodes();if(t.length>0){const r=new Set;for(const i of t){if(!A(i)||!i.canBeEmpty()||i.getChildrenSize()!==0)continue;const s=i.getKey();r.has(s)||(r.add(s),Ps(i,e))}}}function _b(n){const e=O();if(!e)return;const t=new Map,r=s=>t.get(s.getKey())||[0,s.getTextContentSize()];if(N(e))for(const s of No(e).getTextSlices())s&&t.set(s.caret.origin.getKey(),s.getSliceIndices());const i=e.getNodes();for(const s of i){if(!D(s)||!s.canHaveFormat())continue;const[o,l]=r(s);l!==o&&(Tt(s)||o===0&&l===s.getTextContentSize()?n(s):n(s.splitText(o,l)[o===0?0:1]))}N(e)&&e.anchor.type==="text"&&e.focus.type==="text"&&e.anchor.key===e.focus.key&&yb(e)}function yb(n){if(n.isBackward()){const{anchor:e,focus:t}=n,{key:r,offset:i,type:s}=e;e.set(t.key,t.offset,t.type),t.set(r,i,s)}}function bb(n,e){const t=n.getFormatType(),r=n.getIndent();t!==e.getFormatType()&&e.setFormat(t),r!==e.getIndent()&&e.setIndent(r)}function et(n,e,t=bb){if(n===null)return;const r=n.getStartEndPoints(),i=new Map;let s=null;if(r){const[o,l]=r;s=hi(),s.anchor.set(o.key,o.offset,o.type),s.focus.set(l.key,l.offset,l.type);const a=le(o.getNode(),dt),c=le(l.getNode(),dt);A(a)&&i.set(a.getKey(),a),A(c)&&i.set(c.getKey(),c)}for(const o of n.getNodes())if(A(o)&&dt(o))i.set(o.getKey(),o);else if(r===null){const l=le(o,dt);A(l)&&i.set(l.getKey(),l)}for(const[o,l]of i){const a=e();t(l,a),l.replace(a,!0),s&&(o===s.anchor.key&&s.anchor.set(a.getKey(),s.anchor.offset,s.anchor.type),o===s.focus.key&&s.focus.set(a.getKey(),s.focus.offset,s.focus.type))}s&&n.is(O())&&Fe(s)}function rp(n){const e=ip(n);return e!==null&&e.writingMode==="vertical-rl"}function ip(n){const e=n.anchor.getNode();return A(e)?ep(e):tp(e)}function Oo(n,e){let t=rp(n)?!e:e;sp(n)&&(t=!t);const r=Dt(n.focus,t?"previous":"next");if(uu(r))return!1;for(const i of fl(r)){if(ht(i))return!i.origin.isInline();if(!A(i.origin)){if(V(i.origin))return!0;break}}return!1}function xb(n,e,t,r){n.modify(e?"extend":"move",t,r)}function sp(n){const e=ip(n);return e!==null&&e.direction==="rtl"}function Mo(n,e,t){const r=sp(n);let i;i=rp(n)||r?!t:t,xb(n,e,i,"character")}function Sb(n,e,t){const r=is(n.getStyle());return r!==null&&r[e]||t}function zs(n,e,t=""){let r=null;const i=n.getNodes(),s=n.anchor,o=n.focus,l=n.isBackward(),a=l?o.offset:s.offset,c=l?o.getNode():s.getNode();if(N(n)&&n.isCollapsed()&&n.style!==""){const u=is(n.style);if(u!==null&&e in u)return u[e]}for(let u=0;u<i.length;u++){const d=i[u];if((u===0||a!==0||!d.is(c))&&D(d)){const f=Sb(d,e,t);if(r===null)r=f;else if(r!==f){r="";break}}}return r===null?t:r}function op(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const ml=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Cb=ml&&"documentMode"in document?document.documentMode:null,wb=ml&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);!(!ml||!("InputEvent"in window)||Cb)&&"getTargetRanges"in new window.InputEvent("input");const vb=ml,Eb=wb;function kb(n){return n?n.getAdjacentCaret():null}function Tb(n,e){let t=n;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function Nb(n){const e=le(n,t=>A(t)&&!t.isInline());return A(e)||op(4,n.__key),e}function Ab(n){const e=O()||bn();let t;if(N(e))t=Dt(e.focus,"next");else{if(e!=null){const o=e.getNodes(),l=o[o.length-1];l&&(t=ye(l,"next"))}t=t||at(fe(),"previous").getFlipped().insert(H())}const r=Ob(n,t),i=mr(r),s=ht(i)?tt(i):r;return gl(lu(s)),n.getLatest()}function Ob(n,e,t){let r=Yt(e,"next");for(let i=r;i;i=qg(i,t))r=i;return Mt(r)&&op(283),r.insert(n.isInline()?H().append(n):n),Yt(ye(n.getLatest(),"next"),e.direction)}function on(n,e){return n!==null&&Object.getPrototypeOf(n).constructor.name===e.name}let sa=!(Eb||!vb)&&void 0;function Mb(n,e=!1){let t=1;if((function(){if(sa===void 0){const r=document.createElement("div");r.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(r);const i=r.getBoundingClientRect();r.style.setProperty("zoom","2"),sa=r.getBoundingClientRect().width===i.width,document.body.removeChild(r)}return sa})()||e)for(;n;)t*=Number(window.getComputedStyle(n).getPropertyValue("zoom")),n=n.parentElement;return t}function lp(n,e){return ap(n,e,null)}function ap(n,e,t){let r=!1;for(const i of up(n))e(i)?t!==null&&t(i):(r=!0,A(i)&&ap(i,e,t||(s=>i.insertAfter(s))),i.remove());return r}function cp(n,e){const t=[],r=Array.from(n).reverse();for(let i=r.pop();i!==void 0;i=r.pop())if(e(i))t.push(i);else if(A(i))for(const s of up(i))r.push(s);return t}function up(n){return $b(at(n,"previous"))}function $b(n){return hl({hasNext:Ln,initial:n.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}function dp(n,e){const t=Jc(e)?e.body.childNodes:e.childNodes;let r=[];const i=[];for(const s of t)if(!gp.has(s.nodeName)){const o=pp(s,n,i,!1);o!==null&&(r=r.concat(o))}return(function(s){for(const o of s)o.getNextSibling()instanceof il&&o.insertAfter(lt());for(const o of s){const l=o.getChildren();for(const a of l)o.insertBefore(a);o.remove()}})(i),r}function fp(n,e){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),r=fe().getChildren();for(let i=0;i<r.length;i++)hp(n,r[i],t,e);return t.innerHTML}function hp(n,e,t,r=null){let i=r===null||e.isSelected(r);const s=A(e)&&e.excludeFromCopy("html");let o=e;r!==null&&D(e)&&(o=np(r,e,"clone"));const l=A(o)?o.getChildren():[],a=sl(n,o.getType());let c;c=a&&a.exportDOM!==void 0?a.exportDOM(n,o):o.exportDOM(n);const{element:u,after:d}=c;if(!u)return!1;const f=document.createDocumentFragment();for(let h=0;h<l.length;h++){const g=l[h],p=hp(n,g,f,r);!i&&A(e)&&p&&e.extractWithChild(g,r,"html")&&(i=!0)}if(i&&!s){if((re(u)||ko(u))&&u.append(f),t.append(u),d){const h=d.call(o,u);h&&(ko(u)?u.replaceChildren(h):u.replaceWith(h))}}else t.append(f);return i}const gp=new Set(["STYLE","SCRIPT"]);function pp(n,e,t,r,i=new Map,s){let o=[];if(gp.has(n.nodeName))return o;let l=null;const a=(function(g,p){const{nodeName:m}=g,b=p._htmlConversions.get(m.toLowerCase());let _=null;if(b!==void 0)for(const y of b){const S=y(g);S!==null&&(_===null||(_.priority||0)<=(S.priority||0))&&(_=S)}return _!==null?_.conversion:null})(n,e),c=a?a(n):null;let u=null;if(c!==null){u=c.after;const g=c.node;if(l=Array.isArray(g)?g[g.length-1]:g,l!==null){for(const[,p]of i)if(l=p(l,s),!l)break;l&&o.push(...Array.isArray(g)?g:[l])}c.forChild!=null&&i.set(n.nodeName,c.forChild)}const d=n.childNodes;let f=[];const h=(l==null||!ze(l))&&(l!=null&&bo(l)||r);for(let g=0;g<d.length;g++)f.push(...pp(d[g],e,t,h,new Map(i),l));return u!=null&&(f=u(f)),ns(n)&&(f=Ib(n,f,h?()=>{const g=new il;return t.push(g),g}:H)),l==null?f.length>0?o=o.concat(f):ns(n)&&(function(g){return g.nextSibling==null||g.previousSibling==null?!1:To(g.nextSibling)&&To(g.previousSibling)})(n)&&(o=o.concat(lt())):A(l)&&l.append(...f),o}function Ib(n,e,t){const r=n.style.textAlign,i=[];let s=[];for(let o=0;o<e.length;o++){const l=e[o];if(bo(l))r&&!l.getFormat()&&l.setFormat(r),i.push(l);else if(s.push(l),o===e.length-1||o<e.length-1&&bo(e[o+1])){const a=t();a.setFormat(r),a.append(...s),i.push(a),s=[]}}return i}function $o(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function mp(n,e=O()){return e==null&&$o(166),N(e)&&e.isCollapsed()||e.getNodes().length===0?"":fp(n,e)}function Fb(n,e=O()){return e==null&&$o(166),N(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(Db(n,e))}function Wd(n,e){const t=n.getData("text/plain")||n.getData("text/uri-list");t!=null&&e.insertRawText(t)}function jd(n,e,t){const r=n.getData("application/x-lexical-editor");if(r)try{const l=JSON.parse(r);if(l.namespace===t._config.namespace&&Array.isArray(l.nodes))return Hd(t,Lb(l.nodes),e)}catch(l){console.error(l)}const i=n.getData("text/html"),s=n.getData("text/plain");if(i&&s!==i)try{const l=new DOMParser().parseFromString((function(a){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:c=>c}).createHTML(a):a})(i),"text/html");return Hd(t,dp(t,l),e)}catch(l){console.error(l)}const o=s||n.getData("text/uri-list");if(o!=null)if(N(e)){const l=o.split(/(\r?\n|\t)/);l[l.length-1]===""&&l.pop();for(let a=0;a<l.length;a++){const c=O();if(N(c)){const u=l[a];u===`
12
12
  `||u===`\r
13
13
  `?c.insertParagraph():u===" "?c.insertNodes([Ct()]):c.insertText(u)}}}else e.insertRawText(o)}function Hd(n,e,t){n.dispatchCommand(Nc,{nodes:e,selection:t})||(t.insertNodes(e),(function(r){if(N(r)&&r.isCollapsed()){const i=r.anchor;let s=null;const o=Dt(i,"previous");if(o)if(Mt(o))s=o.origin;else{const l=Vt(o,at(fe(),"next").getFlipped());for(const a of l){if(D(a.origin)){s=a.origin;break}if(A(a.origin)&&!a.origin.isInline())break}}if(s&&D(s)){const l=s.getFormat(),a=s.getStyle();r.format===l&&r.style===a||(r.format=l,r.style=a,r.dirty=!0)}}})(t))}function _p(n,e,t,r=[]){let i=e===null||t.isSelected(e);const s=A(t)&&t.excludeFromCopy("html");let o=t;e!==null&&D(o)&&(o=np(e,o,"clone"));const l=A(o)?o.getChildren():[],a=(function(c){const u=c.exportJSON(),d=c.constructor;if(u.type!==d.getType()&&$o(58,d.name),A(c)){const f=u.children;Array.isArray(f)||$o(59,d.name)}return u})(o);D(o)&&o.getTextContentSize()===0&&(i=!1);for(let c=0;c<l.length;c++){const u=l[c],d=_p(n,e,u,a.children);!i&&A(t)&&d&&t.extractWithChild(u,e,"clone")&&(i=!0)}if(i&&!s)r.push(a);else if(Array.isArray(a.children))for(let c=0;c<a.children.length;c++){const u=a.children[c];r.push(u)}return i}function Db(n,e){const t=[],r=fe().getChildren();for(let i=0;i<r.length;i++)_p(n,e,r[i],t);return{namespace:n._config.namespace,nodes:t}}function Lb(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t],i=yg(r);D(i)&&mb(i),e.push(i)}return e}let Dr=null;async function Jd(n,e,t){if(Dr!==null)return!1;if(e!==null)return new Promise((c,u)=>{n.update(()=>{c(Gd(n,e,t))})});const r=n.getRootElement(),i=n._window||window,s=i.document,o=kt(i);if(r===null||o===null)return!1;const l=s.createElement("span");l.style.cssText="position: fixed; top: -1000px;",l.append(s.createTextNode("#")),r.append(l);const a=new Range;return a.setStart(l,0),a.setEnd(l,1),o.removeAllRanges(),o.addRange(a),new Promise((c,u)=>{const d=n.registerCommand(xr,f=>(on(f,ClipboardEvent)&&(d(),Dr!==null&&(i.clearTimeout(Dr),Dr=null),c(Gd(n,f,t))),!0),Wc);Dr=i.setTimeout(()=>{d(),Dr=null,c(!1)},50),s.execCommand("copy"),l.remove()})}function Gd(n,e,t){if(t===void 0){const i=kt(n._window),s=O();if(!s||s.isCollapsed()||!i)return!1;const o=i.anchorNode,l=i.focusNode;if(o!==null&&l!==null&&!pi(n,o,l))return!1;t=Rb(s)}e.preventDefault();const r=e.clipboardData;return r!==null&&(Pb(r,t),!0)}const yp=[["text/html",mp],["application/x-lexical-editor",Fb]];function Rb(n=O()){const e={"text/plain":n?n.getTextContent():""};if(n){const t=mi();for(const[r,i]of yp){const s=i(t,n);s!==null&&(e[r]=s)}}return e}function Pb(n,e){for(const[t]of yp)e[t]===void 0&&n.setData(t,"");for(const t in e){const r=e[t];r!==void 0&&n.setData(t,r)}}const Bb=Symbol.for("preact-signals");function _l(){if(Mn>1)return void Mn--;let n,e=!1;for(;Gi!==void 0;){let t=Gi;for(Gi=void 0,Za++;t!==void 0;){const r=t.o;if(t.o=void 0,t.f&=-3,!(8&t.f)&&xp(t))try{t.c()}catch(i){e||(n=i,e=!0)}t=r}}if(Za=0,Mn--,e)throw n}function zb(n){if(Mn>0)return n();Mn++;try{return n()}finally{_l()}}let ne,Gi;function Vd(n){const e=ne;ne=void 0;try{return n()}finally{ne=e}}let Mn=0,Za=0,Qs=0;function Yd(n){if(ne===void 0)return;let e=n.n;return e===void 0||e.t!==ne?(e={i:0,S:n,p:ne.s,n:void 0,t:ne,e:void 0,x:void 0,r:e},ne.s!==void 0&&(ne.s.n=e),ne.s=e,n.n=e,32&ne.f&&n.S(e),e):e.i===-1?(e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=ne.s,e.n=void 0,ne.s.n=e,ne.s=e),e):void 0}function Qe(n,e){this.v=n,this.i=0,this.n=void 0,this.t=void 0,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}function bp(n,e){return new Qe(n,e)}function xp(n){for(let e=n.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function qd(n){for(let e=n.s;e!==void 0;e=e.n){const t=e.S.n;if(t!==void 0&&(e.r=t),e.S.n=e,e.i=-1,e.n===void 0){n.s=e;break}}}function Sp(n){let e,t=n.s;for(;t!==void 0;){const r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):e=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}n.s=e}function Lr(n,e){Qe.call(this,void 0),this.x=n,this.s=void 0,this.g=Qs-1,this.f=4,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}function Cp(n){const e=n.u;if(n.u=void 0,typeof e=="function"){Mn++;const t=ne;ne=void 0;try{e()}catch(r){throw n.f&=-2,n.f|=8,du(n),r}finally{ne=t,_l()}}}function du(n){for(let e=n.s;e!==void 0;e=e.n)e.S.U(e);n.x=void 0,n.s=void 0,Cp(n)}function Ub(n){if(ne!==this)throw new Error("Out-of-order effect");Sp(this),ne=n,this.f&=-2,8&this.f&&du(this),_l()}function Wr(n,e){this.x=n,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=e?.name}function fu(n,e){const t=new Wr(n,e);try{t.c()}catch(i){throw t.d(),i}const r=t.d.bind(t);return r[Symbol.dispose]=r,r}function Kb(n,e={}){const t={};for(const r in n){const i=e[r],s=bp(i===void 0?n[r]:i);t[r]=s}return t}Qe.prototype.brand=Bb,Qe.prototype.h=function(){return!0},Qe.prototype.S=function(n){const e=this.t;e!==n&&n.e===void 0&&(n.x=e,this.t=n,e!==void 0?e.e=n:Vd(()=>{var t;(t=this.W)==null||t.call(this)}))},Qe.prototype.U=function(n){if(this.t!==void 0){const e=n.e,t=n.x;e!==void 0&&(e.x=t,n.e=void 0),t!==void 0&&(t.e=e,n.x=void 0),n===this.t&&(this.t=t,t===void 0&&Vd(()=>{var r;(r=this.Z)==null||r.call(this)}))}},Qe.prototype.subscribe=function(n){return fu(()=>{const e=this.value,t=ne;ne=void 0;try{n(e)}finally{ne=t}},{name:"sub"})},Qe.prototype.valueOf=function(){return this.value},Qe.prototype.toString=function(){return this.value+""},Qe.prototype.toJSON=function(){return this.value},Qe.prototype.peek=function(){const n=ne;ne=void 0;try{return this.value}finally{ne=n}},Object.defineProperty(Qe.prototype,"value",{get(){const n=Yd(this);return n!==void 0&&(n.i=this.i),this.v},set(n){if(n!==this.v){if(Za>100)throw new Error("Cycle detected");this.v=n,this.i++,Qs++,Mn++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{_l()}}}}),Lr.prototype=new Qe,Lr.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Qs))return!0;if(this.g=Qs,this.f|=1,this.i>0&&!xp(this))return this.f&=-2,!0;const n=ne;try{qd(this),ne=this;const e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return ne=n,Sp(this),this.f&=-2,!0},Lr.prototype.S=function(n){if(this.t===void 0){this.f|=36;for(let e=this.s;e!==void 0;e=e.n)e.S.S(e)}Qe.prototype.S.call(this,n)},Lr.prototype.U=function(n){if(this.t!==void 0&&(Qe.prototype.U.call(this,n),this.t===void 0)){this.f&=-33;for(let e=this.s;e!==void 0;e=e.n)e.S.U(e)}},Lr.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let n=this.t;n!==void 0;n=n.x)n.t.N()}},Object.defineProperty(Lr.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const n=Yd(this);if(this.h(),n!==void 0&&(n.i=this.i),16&this.f)throw this.v;return this.v}}),Wr.prototype.c=function(){const n=this.S();try{if(8&this.f||this.x===void 0)return;const e=this.x();typeof e=="function"&&(this.u=e)}finally{n()}},Wr.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Cp(this),qd(this),Mn++;const n=ne;return ne=this,Ub.bind(this,n)},Wr.prototype.N=function(){2&this.f||(this.f|=2,this.o=Gi,Gi=this)},Wr.prototype.d=function(){this.f|=8,1&this.f||du(this)},Wr.prototype.dispose=function(){this.d()};function Wb(n){return(typeof n.nodes=="function"?n.nodes():n.nodes)||[]}function ae(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function wp(n,e){if(n&&e&&!Array.isArray(e)&&typeof n=="object"&&typeof e=="object"){const t=n,r=e;for(const i in r)t[i]=wp(t[i],r[i]);return n}return e}const hu=0,Xa=1,vp=2,oa=3,Us=4,Rr=5,la=6,Oi=7;function aa(n){return n.id===hu}function Ep(n){return n.id===vp}function jb(n){return(function(e){return e.id===Xa})(n)||ae(305,String(n.id),String(Xa)),Object.assign(n,{id:vp})}const Hb=new Set;let Jb=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:hu}}mergeConfigs(){let e=this.extension.config||{};const t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Xg;for(const r of this.configs)e=t(e,r);return e}init(e){const t=this.state;Ep(t)||ae(306,String(t.id));const r={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},i={...r,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},s=(function(l,a,c){return Object.assign(l,{config:a,id:oa,registerState:c})})(t,this.mergeConfigs(),r);let o;this.state=s,this.extension.init&&(o=this.extension.init(e,s.config,r)),this.state=(function(l,a,c){return Object.assign(l,{id:Us,initResult:a,registerState:c})})(s,o,i)}build(e){const t=this.state;let r;t.id!==Us&&ae(307,String(t.id),String(Rr)),this.extension.build&&(r=this.extension.build(e,t.config,t.registerState));const i={...t.registerState,getOutput:()=>r,getSignal:this.getSignal.bind(this)};this.state=(function(s,o,l){return Object.assign(s,{id:Rr,output:o,registerState:l})})(t,r,i)}register(e,t){this._signal=t;const r=this.state;r.id!==Rr&&ae(308,String(r.id),String(Rr));const i=this.extension.register&&this.extension.register(e,r.config,r.registerState);return this.state=(function(s){return Object.assign(s,{id:la})})(r),()=>{const s=this.state;s.id!==Oi&&ae(309,String(r.id),String(Oi)),this.state=(function(o){return Object.assign(o,{id:Rr})})(s),i&&i()}}afterRegistration(e){const t=this.state;let r;return t.id!==la&&ae(310,String(t.id),String(la)),this.extension.afterRegistration&&(r=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=(function(i){return Object.assign(i,{id:Oi})})(t),r}getSignal(){return this._signal===void 0&&ae(311),this._signal}getInitResult(){this.extension.init===void 0&&ae(312,this.extension.name);const e=this.state;return(function(t){return t.id>=Us})(e)||ae(313,String(e.id),String(Us)),e.initResult}getInitPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){const e=this.state;return(function(t){return t.id>=oa})(e)||ae(314,String(e.id),String(oa)),{config:e.config}}getPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){const t=this.builder.getExtensionRep(e);return t===void 0&&ae(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){const t=this.builder.getExtensionRep(e);return t===void 0&&ae(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){const e=this.state;return(function(t){return t.id>=Oi})(e)||ae(316,String(e.id),String(Oi)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Hb}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([t])=>t)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){const e=this.state;(function(t){return t.id>=Rr})(e)||ae(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}};const Zd={tag:Gr};function Gb(){const n=fe();n.isEmpty()&&n.append(H())}const Vb={config:{setOptions:Zd,updateOptions:Zd},init:({$initialEditorState:n=Gb})=>({$initialEditorState:n,initialized:!1}),afterRegistration(n,{updateOptions:e,setOptions:t},r){const i=r.getInitResult();if(!i.initialized){i.initialized=!0;const{$initialEditorState:s}=i;if(Sg(s))n.setEditorState(s,t);else if(typeof s=="function")n.update(()=>{s(n)},e);else if(s&&(typeof s=="string"||typeof s=="object")){const o=n.parseEditorState(s);n.setEditorState(o,t)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[Er,Ye,Sr,Cr,kr]},Xd=Symbol.for("@lexical/extension/LexicalBuilder");function Qd(){}function Yb(n){throw n}function Ks(n){return Array.isArray(n)?n:[n]}const ca="0.40.0+prod.esm";let qb=class eo{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=ca,this.roots=e;for(const t of e)this.addExtension(t)}static fromExtensions(e){const t=[Ks(Vb)];for(const r of e)t.push(Ks(r));return new eo(t)}static maybeFromEditor(e){const t=e[Xd];return t&&(t.PACKAGE_VERSION!==ca&&ae(292,t.PACKAGE_VERSION,ca),t instanceof eo||ae(293)),t}static fromEditor(e){const t=eo.maybeFromEditor(e);return t===void 0&&ae(294),t}constructEditor(){const{$initialEditorState:e,onError:t,...r}=this.buildCreateEditorArgs(),i=Object.assign(gi({...r,...t?{onError:s=>{t(s,i)}}:{}}),{[Xd]:this});for(const s of this.sortedExtensionReps())s.build(i);return i}buildEditor(){let e=Qd;function t(){try{e()}finally{e=Qd}}const r=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=pt(this.registerEditor(r),()=>r.setRootElement(null)),r}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){const t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&ae(295,e.name),t}addEdge(e,t,r){const i=this.outgoingConfigEdges.get(e);i?i.set(t,r):this.outgoingConfigEdges.set(e,new Map([[t,r]]));const s=this.incomingEdges.get(t);s?s.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){this._sortedExtensionReps!==void 0&&ae(296);const t=Ks(e),[r]=t;typeof r.name!="string"&&ae(297,typeof r.name);let i=this.extensionNameMap.get(r.name);if(i!==void 0&&i.extension!==r&&ae(298,r.name),!i){i=new Jb(this,r),this.extensionNameMap.set(r.name,i);const s=this.conflicts.get(r.name);typeof s=="string"&&ae(299,r.name,s);for(const o of r.conflictsWith||[])this.extensionNameMap.has(o)&&ae(299,r.name,o),this.conflicts.set(o,r.name);for(const o of r.dependencies||[]){const l=Ks(o);this.addEdge(r.name,l[0].name,l.slice(1)),this.addExtension(l)}for(const[o,l]of r.peerDependencies||[])this.addEdge(r.name,o,l?[l]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const e=[],t=(r,i)=>{let s=r.state;if(Ep(s))return;const o=r.extension.name;var l;aa(s)||ae(300,o,i||"[unknown]"),aa(l=s)||ae(304,String(l.id),String(hu)),s=Object.assign(l,{id:Xa}),r.state=s;const a=this.outgoingConfigEdges.get(o);if(a)for(const c of a.keys()){const u=this.extensionNameMap.get(c);u&&t(u,o)}s=jb(s),r.state=s,e.push(r)};for(const r of this.extensionNameMap.values())aa(r.state)&&t(r);for(const r of e)for(const[i,s]of this.outgoingConfigEdges.get(r.extension.name)||[])if(s.length>0){const o=this.extensionNameMap.get(i);if(o)for(const l of s)o.configs.add(l)}for(const[r,...i]of this.roots)if(i.length>0){const s=this.extensionNameMap.get(r.name);s===void 0&&ae(301,r.name);for(const o of i)s.configs.add(o)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){const t=this.sortedExtensionReps(),r=new AbortController,i=[()=>r.abort()],s=r.signal;for(const o of t){const l=o.register(e,s);l&&i.push(l)}for(const o of t){const l=o.afterRegistration(e);l&&i.push(l)}return pt(...i)}buildCreateEditorArgs(){const e={},t=new Set,r=new Map,i=new Map,s={},o={},l=this.sortedExtensionReps();for(const u of l){const{extension:d}=u;if(d.onError!==void 0&&(e.onError=d.onError),d.disableEvents!==void 0&&(e.disableEvents=d.disableEvents),d.parentEditor!==void 0&&(e.parentEditor=d.parentEditor),d.editable!==void 0&&(e.editable=d.editable),d.namespace!==void 0&&(e.namespace=d.namespace),d.$initialEditorState!==void 0&&(e.$initialEditorState=d.$initialEditorState),d.nodes)for(const f of Wb(d)){if(typeof f!="function"){const h=r.get(f.replace);h&&ae(302,d.name,f.replace.name,h.extension.name),r.set(f.replace,u)}t.add(f)}if(d.html){if(d.html.export)for(const[f,h]of d.html.export.entries())i.set(f,h);d.html.import&&Object.assign(s,d.html.import)}d.theme&&wp(o,d.theme)}Object.keys(o).length>0&&(e.theme=o),t.size&&(e.nodes=[...t]);const a=Object.keys(s).length>0,c=i.size>0;(a||c)&&(e.html={},a&&(e.html.import=s),c&&(e.html.export=i));for(const u of l)u.init(e);return e.onError||(e.onError=Yb),e}};function Zb(n,e){const t=qb.fromEditor(n).extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}function ef(n){const e=window.location.origin,t=r=>{if(r.origin!==e)return;const i=n.getRootElement();if(document.activeElement!==i)return;const s=r.data;if(typeof s=="string"){let o;try{o=JSON.parse(s)}catch{return}if(o&&o.protocol==="nuanria_messaging"&&o.type==="request"){const l=o.payload;if(l&&l.functionId==="makeChanges"){const a=l.args;if(a){const[c,u,d,f,h]=a;n.update(()=>{const g=O();if(N(g)){const p=g.anchor;let m=p.getNode(),b=0,_=0;if(D(m)&&c>=0&&u>=0&&(b=c,_=c+u,g.setTextNodeRange(m,b,m,_)),b===_&&d===""||(g.insertRawText(d),m=p.getNode()),D(m)){b=f,_=f+h;const y=m.getTextContentSize();b=b>y?y:b,_=_>y?y:_,g.setTextNodeRange(m,b,m,_)}r.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function tf(n,e){if(document.caretRangeFromPoint!==void 0){const t=document.caretRangeFromPoint(n,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(n,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}return null}const Nr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Xb=Nr&&"documentMode"in document?document.documentMode:null,Qb=Nr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ex=!(!Nr||!("InputEvent"in window)||Xb)&&"getTargetRanges"in new window.InputEvent("input"),tx=Nr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),nf=Nr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,nx=Nr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),rx=Nr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Qb&&!nx,rf=z("DRAG_DROP_PASTE_FILE");let yl=class kp extends xe{static getType(){return"quote"}static clone(e){return new kp(e.__key)}createDOM(e){const t=document.createElement("blockquote");return me(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:ix,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(re(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();r&&(t.style.textAlign=r);const i=this.getDirection();i&&(t.dir=i)}return{element:t}}static importJSON(e){return yi().updateFromJSON(e)}insertNewAfter(e,t){const r=H(),i=this.getDirection();return r.setDirection(i),this.insertAfter(r,t),r}collapseAtStart(){const e=H();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function yi(){return Le(new yl)}function Qa(n){return n instanceof yl}let bl=class Tp extends xe{__tag;static getType(){return"heading"}static clone(e){return new Tp(e.__tag,e.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}setTag(e){const t=this.getWritable();return this.__tag=e,t}createDOM(e){const t=this.__tag,r=document.createElement(t),i=e.theme.heading;if(i!==void 0){const s=i[t];me(r,s)}return r}updateDOM(e,t,r){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:Pr,priority:0}),h2:e=>({conversion:Pr,priority:0}),h3:e=>({conversion:Pr,priority:0}),h4:e=>({conversion:Pr,priority:0}),h5:e=>({conversion:Pr,priority:0}),h6:e=>({conversion:Pr,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&sf(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>sf(e)?{conversion:t=>({node:ft("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(re(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();r&&(t.style.textAlign=r);const i=this.getDirection();i&&(t.dir=i)}return{element:t}}static importJSON(e){return ft(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,t=!0){const r=e?e.anchor.offset:0,i=this.getLastDescendant(),s=!i||e&&e.anchor.key===i.getKey()&&r===i.getTextContentSize()||!e?H():ft(this.getTag()),o=this.getDirection();if(s.setDirection(o),this.insertAfter(s,t),r===0&&!this.isEmpty()&&e){const l=H();l.select(),this.replace(l,!0)}return s}collapseAtStart(){const e=this.isEmpty()?H():ft(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}};function sf(n){return n.nodeName.toLowerCase()==="span"&&n.style.fontSize==="26pt"}function Pr(n){const e=n.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=ft(e),n.style!==null&&(ul(n,t),t.setFormat(n.style.textAlign))),{node:t}}function ix(n){const e=yi();return n.style!==null&&(e.setFormat(n.style.textAlign),ul(n,e)),{node:e}}function ft(n="h1"){return Le(new bl(n))}function sx(n){return n instanceof bl}function Ws(n){let e=null;if(on(n,DragEvent)?e=n.dataTransfer:on(n,ClipboardEvent)&&(e=n.clipboardData),e===null)return[!1,[],!1];const t=e.types,r=t.includes("Files"),i=t.includes("text/html")||t.includes("text/plain");return[r,Array.from(e.files),i]}function of(n){const e=O();if(!N(e))return!1;const t=new Set,r=e.getNodes();for(let i=0;i<r.length;i++){const s=r[i],o=s.getKey();if(t.has(o))continue;const l=le(s,c=>A(c)&&!c.isInline());if(l===null)continue;const a=l.getKey();l.canIndent()&&!t.has(a)&&(t.add(a),n(l))}return t.size>0}function lf(n){const e=gt(n);return V(e)}function ua(n){for(const e of["lowercase","uppercase","capitalize"])n.hasFormat(e)&&n.toggleFormat(e)}function ox(n){return pt(n.registerCommand(br,e=>{const t=O();return!!je(t)&&(t.clear(),!0)},B),n.registerCommand(Ot,e=>{const t=O();return N(t)?(t.deleteCharacter(e),!0):!!je(t)&&(t.deleteNodes(),!0)},B),n.registerCommand(cr,e=>{const t=O();return!!N(t)&&(t.deleteWord(e),!0)},B),n.registerCommand(ur,e=>{const t=O();return!!N(t)&&(t.deleteLine(e),!0)},B),n.registerCommand(An,e=>{const t=O();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const r=e.dataTransfer;if(r!=null)jd(r,t,n);else if(N(t)){const i=e.data;return i&&t.insertText(i),!0}}return!0},B),n.registerCommand(Qi,()=>{const e=O();return!!N(e)&&(e.removeText(),!0)},B),n.registerCommand(ve,e=>{const t=O();return!!N(t)&&(t.formatText(e),!0)},B),n.registerCommand(Fc,e=>{const t=O();if(!N(t)&&!je(t))return!1;const r=t.getNodes();for(const i of r){const s=le(i,o=>A(o)&&!o.isInline());s!==null&&s.setFormat(e)}return!0},B),n.registerCommand(cn,e=>{const t=O();return!!N(t)&&(t.insertLineBreak(e),!0)},B),n.registerCommand(Fn,()=>{const e=O();return!!N(e)&&(e.insertParagraph(),!0)},B),n.registerCommand(ho,()=>(nl([Ct()]),!0),B),n.registerCommand(Ut,()=>of(e=>{const t=e.getIndent();e.setIndent(t+1)}),B),n.registerCommand(sn,()=>of(e=>{const t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}),B),n.registerCommand(dn,e=>{const t=O();if(je(t)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),r[0].selectPrevious(),!0}else if(N(t)){const r=vo(t.focus,!0);if(!e.shiftKey&&V(r)&&!r.isIsolated()&&!r.isInline())return r.selectPrevious(),e.preventDefault(),!0}return!1},B),n.registerCommand(dr,e=>{const t=O();if(je(t)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),r[0].selectNext(0,0),!0}else if(N(t)){if((function(i){const s=i.focus;return s.key==="root"&&s.offset===fe().getChildrenSize()})(t))return e.preventDefault(),!0;const r=vo(t.focus,!1);if(!e.shiftKey&&V(r)&&!r.isIsolated()&&!r.isInline())return r.selectNext(),e.preventDefault(),!0}return!1},B),n.registerCommand(bs,e=>{const t=O();if(je(t)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),Kd(r[0])?r[0].selectNext(0,0):r[0].selectPrevious(),!0}if(!N(t))return!1;if(Oo(t,!0)){const r=e.shiftKey;return e.preventDefault(),Mo(t,r,!0),!0}return!1},B),n.registerCommand(Vo,e=>{const t=O();if(je(t)){const i=t.getNodes();if(i.length>0)return e.preventDefault(),Kd(i[0])?i[0].selectPrevious():i[0].selectNext(0,0),!0}if(!N(t))return!1;const r=e.shiftKey;return!!Oo(t,!1)&&(e.preventDefault(),Mo(t,r,!1),!0)},B),n.registerCommand(qo,e=>{if(lf(e.target))return!1;const t=O();if(N(t)){if((function(r){if(!r.isCollapsed())return!1;const{anchor:i}=r;if(i.offset!==0)return!1;const s=i.getNode();if(be(s))return!1;const o=Nb(s);return o.getIndent()>0&&(o.is(s)||s.is(o.getFirstDescendant()))})(t))return e.preventDefault(),n.dispatchCommand(sn,void 0);if(nf&&navigator.language==="ko-KR")return!1}else if(!je(t))return!1;return e.preventDefault(),n.dispatchCommand(Ot,!0)},B),n.registerCommand(Zo,e=>{if(lf(e.target))return!1;const t=O();return!(!N(t)&&!je(t))&&(e.preventDefault(),n.dispatchCommand(Ot,!1))},B),n.registerCommand(Dn,e=>{const t=O();if(!N(t))return!1;if(ua(t),e!==null){if((nf||tx||rx)&&ex)return!1;if(e.preventDefault(),e.shiftKey)return n.dispatchCommand(cn,!1)}return n.dispatchCommand(Fn,void 0)},B),n.registerCommand(ui,()=>{const e=O();return!!N(e)&&(n.blur(),!0)},B),n.registerCommand(Xo,e=>{const[,t]=Ws(e);if(t.length>0){const i=tf(e.clientX,e.clientY);if(i!==null){const{offset:s,node:o}=i,l=gt(o);if(l!==null){const a=hi();if(D(l))a.anchor.set(l.getKey(),s,"text"),a.focus.set(l.getKey(),s,"text");else{const u=l.getParentOrThrow().getKey(),d=l.getIndexWithinParent()+1;a.anchor.set(u,d,"element"),a.focus.set(u,d,"element")}const c=In(a);Fe(c)}n.dispatchCommand(rf,t)}return e.preventDefault(),!0}const r=O();return!!N(r)},B),n.registerCommand(Qo,e=>{const[t]=Ws(e),r=O();return!(t&&!N(r))},B),n.registerCommand(Dc,e=>{const[t]=Ws(e),r=O();if(t&&!N(r))return!1;const i=tf(e.clientX,e.clientY);if(i!==null){const s=gt(i.node);V(s)&&e.preventDefault()}return!0},B),n.registerCommand(Xr,()=>(Xc(),!0),B),n.registerCommand(xr,e=>(Jd(n,on(e,ClipboardEvent)?e:null),!0),B),n.registerCommand(di,e=>((async function(t,r){await Jd(r,on(t,ClipboardEvent)?t:null),r.update(()=>{const i=O();N(i)?i.removeText():je(i)&&i.getNodes().forEach(s=>s.remove())})})(e,n),!0),B),n.registerCommand(li,e=>{const[,t,r]=Ws(e);return t.length>0&&!r?(n.dispatchCommand(rf,t),!0):jn(e.target)&&ol(e.target)?!1:O()!==null&&((function(i,s){i.preventDefault(),s.update(()=>{const o=O(),l=on(i,InputEvent)||on(i,KeyboardEvent)?null:i.clipboardData;l!=null&&o!==null&&jd(l,o,s)},{tag:Pc})})(e,n),!0)},B),n.registerCommand(Yo,e=>{const t=O();return N(t)&&ua(t),!1},B),n.registerCommand(xs,e=>{const t=O();return N(t)&&ua(t),!1},B))}function Tn(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function lx(n){let e=1,t=n.getParent();for(;t!=null;){if(Q(t)){const r=t.getParent();if(J(r)){e++,t=r.getParent();continue}Tn(40)}return e}return e}function ec(n){let e=n.getParent();J(e)||Tn(40);let t=e;for(;t!==null;)t=t.getParent(),J(t)&&(e=t);return e}function Np(n){let e=[];const t=n.getChildren().filter(Q);for(let r=0;r<t.length;r++){const i=t[r],s=i.getFirstChild();J(s)?e=e.concat(Np(s)):e.push(i)}return e}function zt(n){return Q(n)&&J(n.getFirstChild())}function af(n){return mt().append(n)}function Ap(n,e){return Q(n)&&(e.length===0||e.length===1&&n.is(e[0])&&n.getChildrenSize()===0)}function Io(n){const e=O();if(e!==null){let t=e.getNodes();if(N(e)){const i=e.getStartEndPoints();i===null&&Tn(143);const[s]=i,o=s.getNode(),l=o.getParent();if(ze(o)){const a=o.getFirstChild();if(a)t=a.selectStart().getNodes();else{const c=H();o.append(c),t=c.select().getNodes()}}else if(Ap(o,t)){const a=ot(n);if(ze(l)){o.replace(a);const c=mt();A(o)&&(c.setFormat(o.getFormatType()),c.setIndent(o.getIndent())),a.append(c)}else if(Q(o)){const c=o.getParentOrThrow();_r(a,c.getChildren()),c.replace(a)}return}}const r=new Set;for(let i=0;i<t.length;i++){const s=t[i];if(A(s)&&s.isEmpty()&&!Q(s)&&!r.has(s.getKey())){cf(s,n);continue}let o=Gc(s)?s.getParent():Q(s)&&s.isEmpty()?s:null;for(;o!=null;){const l=o.getKey();if(J(o)){if(!r.has(l)){const a=ot(n);_r(a,o.getChildren()),o.replace(a),r.add(l)}break}{const a=o.getParent();if(ze(a)&&!r.has(l)){r.add(l),cf(o,n);break}o=a}}}}}function _r(n,e){n.splice(n.getChildrenSize(),0,e)}function cf(n,e){if(J(n))return n;const t=n.getPreviousSibling(),r=n.getNextSibling(),i=mt();let s;if(_r(i,n.getChildren()),J(t)&&e===t.getListType())t.append(i),J(r)&&e===r.getListType()&&(_r(t,r.getChildren()),r.remove()),s=t;else if(J(r)&&e===r.getListType())r.getFirstChildOrThrow().insertBefore(i),s=r;else{const l=ot(e);l.append(i),n.replace(l),s=l}i.setFormat(n.getFormatType()),i.setIndent(n.getIndent());const o=O();return N(o)&&(s.getKey()===o.anchor.key&&o.anchor.set(i.getKey(),o.anchor.offset,"element"),s.getKey()===o.focus.key&&o.focus.set(i.getKey(),o.focus.offset,"element")),n.remove(),s}function gu(n,e){const t=n.getLastChild(),r=e.getFirstChild();t&&r&&zt(t)&&zt(r)&&(gu(t.getFirstChild(),r.getFirstChild()),r.remove());const i=e.getChildren();i.length>0&&n.append(...i),e.remove()}function Op(){const n=O();if(N(n)){const e=new Set,t=n.getNodes(),r=n.anchor.getNode();if(Ap(r,t))e.add(ec(r));else for(let i=0;i<t.length;i++){const s=t[i];if(Gc(s)){const o=Tb(s,Ar);o!=null&&e.add(ec(o))}}for(const i of e){let s=i;const o=Np(i);for(const l of o){const a=H().setTextStyle(n.style).setTextFormat(n.format);_r(a,l.getChildren()),s.insertAfter(a),s=a,l.__key===n.anchor.key&&Rn(n.anchor,tt(at(a,"next"))),l.__key===n.focus.key&&Rn(n.focus,tt(at(a,"next"))),l.remove()}i.remove()}}}function Mp(n){const e=n.getListType()!=="check";let t=n.getStart();for(const r of n.getChildren())Q(r)&&(r.getValue()!==t&&r.setValue(t),e&&r.getLatest().__checked!=null&&r.setChecked(void 0),J(r.getFirstChild())||t++)}function ax(n){const e=new Set;if(zt(n)||e.has(n.getKey()))return;const t=n.getParent(),r=n.getNextSibling(),i=n.getPreviousSibling();if(zt(r)&&zt(i)){const s=i.getFirstChild();if(J(s)){s.append(n);const o=r.getFirstChild();J(o)&&(_r(s,o.getChildren()),r.remove(),e.add(r.getKey()))}}else if(zt(r)){const s=r.getFirstChild();if(J(s)){const o=s.getFirstChild();o!==null&&o.insertBefore(n)}}else if(zt(i)){const s=i.getFirstChild();J(s)&&s.append(n)}else if(J(t)){const s=mt().setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle()),o=ot(t.getListType()).setTextFormat(t.getTextFormat()).setTextStyle(t.getTextStyle());s.append(o),o.append(n),i?i.insertAfter(s):r?r.insertBefore(s):t.append(s)}}function cx(n){if(zt(n))return;const e=n.getParent(),t=e?e.getParent():void 0;if(J(t?t.getParent():void 0)&&Q(t)&&J(e)){const r=e?e.getFirstChild():void 0,i=e?e.getLastChild():void 0;if(n.is(r))t.insertBefore(n),e.isEmpty()&&t.remove();else if(n.is(i))t.insertAfter(n),e.isEmpty()&&t.remove();else{const s=e.getListType(),o=mt(),l=ot(s);o.append(l),n.getPreviousSiblings().forEach(u=>l.append(u));const a=mt(),c=ot(s);a.append(c),_r(c,n.getNextSiblings()),t.insertBefore(o),t.insertAfter(a),t.replace(n)}}}function ux(){const n=O();if(!N(n)||!n.isCollapsed())return!1;const e=n.anchor.getNode();let t=null;if(Q(e)&&e.getChildrenSize()===0)t=e;else if(D(e)){const a=e.getParent();Q(a)&&a.getChildren().every(c=>D(c)&&c.getTextContent().trim()==="")&&(t=a)}if(t===null)return!1;const r=ec(t),i=t.getParent();J(i)||Tn(40);const s=i.getParent();let o;if(ze(s))o=H(),r.insertAfter(o);else{if(!Q(s))return!1;o=mt(),s.insertAfter(o)}o.setTextStyle(n.style).setTextFormat(n.format).select();const l=t.getNextSiblings();if(l.length>0){const a=ot(i.getListType());if(Q(o)){const c=mt();c.append(a),o.insertAfter(c)}else o.insertAfter(a);a.append(...l)}return(function(a){let c=a;for(;c.getNextSibling()==null&&c.getPreviousSibling()==null;){const u=c.getParent();if(u==null||!Q(u)&&!J(u))break;c=u}c.remove()})(t),!0}let Ar=class extends xe{__value;__checked;$config(){return this.config("listitem",{$transform:e=>{if(e.__checked==null)return;const t=e.getParent();J(t)&&t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)},extends:xe,importDOM:{li:()=>({conversion:dx,priority:0})}})}constructor(e=1,t=void 0,r){super(r),this.__value=e===void 0?1:e,this.__checked=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__value=e.__value,this.__checked=e.__checked}createDOM(e){const t=document.createElement("li");return this.updateListItemDOM(null,t,e),t}updateListItemDOM(e,t,r){(function(o,l,a){const c=l.getParent();!J(c)||c.getListType()!=="check"||J(l.getFirstChild())?(o.removeAttribute("role"),o.removeAttribute("tabIndex"),o.removeAttribute("aria-checked")):(o.setAttribute("role","checkbox"),o.setAttribute("tabIndex","-1"),a&&l.__checked===a.__checked||o.setAttribute("aria-checked",l.getChecked()?"true":"false"))})(t,this,e),t.value=this.__value,(function(o,l,a){const c=[],u=[],d=l.list,f=d?d.listitem:void 0;let h;if(d&&d.nested&&(h=d.nested.listitem),f!==void 0&&c.push(...hn(f)),d){const g=a.getParent(),p=J(g)&&g.getListType()==="check",m=a.getChecked();p&&!m||u.push(d.listitemUnchecked),p&&m||u.push(d.listitemChecked),p&&c.push(m?d.listitemChecked:d.listitemUnchecked)}if(h!==void 0){const g=hn(h);a.getChildren().some(p=>J(p))?c.push(...g):u.push(...g)}u.length>0&&un(o,...u),c.length>0&&me(o,...c)})(t,r.theme,this);const i=e?e.__style:"",s=this.__style;i!==s&&(s===""?t.removeAttribute("style"):t.style.cssText=s),(function(o,l,a){const c=is(l.__textStyle);for(const u in c)o.style.setProperty(`--listitem-marker-${u}`,c[u]);if(a)for(const u in is(a.__textStyle))u in c||o.style.removeProperty(`--listitem-marker-${u}`)})(t,this,e)}updateDOM(e,t,r){const i=t;return this.updateListItemDOM(e,i,r),!1}updateFromJSON(e){return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked)}exportDOM(e){const t=this.createDOM(e._config),r=this.getFormatType();r&&(t.style.textAlign=r);const i=this.getDirection();return i&&(t.dir=i),{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...e){for(let t=0;t<e.length;t++){const r=e[t];if(A(r)&&this.canMergeWith(r)){const i=r.getChildren();this.append(...i),r.remove()}else super.append(r)}return this}replace(e,t){if(Q(e))return super.replace(e);this.setIndent(0);const r=this.getParentOrThrow();if(!J(r))return e;if(r.__first===this.getKey())r.insertBefore(e);else if(r.__last===this.getKey())r.insertAfter(e);else{const i=ot(r.getListType());let s=this.getNextSibling();for(;s;){const o=s;s=s.getNextSibling(),i.append(o)}r.insertAfter(e),e.insertAfter(i)}return t&&(A(e)||Tn(139),this.getChildren().forEach(i=>{e.append(i)})),this.remove(),r.getChildrenSize()===0&&r.remove(),e}insertAfter(e,t=!0){const r=this.getParentOrThrow();if(J(r)||Tn(39),Q(e))return super.insertAfter(e,t);const i=this.getNextSiblings();if(r.insertAfter(e,t),i.length!==0){const s=ot(r.getListType());i.forEach(o=>s.append(o)),e.insertAfter(s,t)}return e}remove(e){const t=this.getPreviousSibling(),r=this.getNextSibling();super.remove(e),t&&r&&zt(t)&&zt(r)&&(gu(t.getFirstChild(),r.getFirstChild()),r.remove())}insertNewAfter(e,t=!0){const r=mt().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(r,t),r}collapseAtStart(e){const t=H();this.getChildren().forEach(o=>t.append(o));const r=this.getParentOrThrow(),i=r.getParentOrThrow(),s=Q(i);if(r.getChildrenSize()===1)if(s)r.remove(),i.select();else{r.insertBefore(t),r.remove();const o=e.anchor,l=e.focus,a=t.getKey();o.type==="element"&&o.getNode().is(this)&&o.set(a,o.offset,"element"),l.type==="element"&&l.getNode().is(this)&&l.set(a,l.offset,"element")}else r.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){const t=this.getWritable();return t.__value=e,t}getChecked(){const e=this.getLatest();let t;const r=this.getParent();return J(r)&&(t=r.getListType()),t==="check"?!!e.__checked:void 0}setChecked(e){const t=this.getWritable();return t.__checked=e,t}toggleChecked(){const e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){const e=this.getParent();if(e===null||!this.isAttached())return this.getLatest().__indent;let t=e.getParentOrThrow(),r=0;for(;Q(t);)t=t.getParentOrThrow().getParentOrThrow(),r++;return r}setIndent(e){typeof e!="number"&&Tn(117),(e=Math.floor(e))>=0||Tn(199);let t=this.getIndent();for(;t!==e;)t<e?(ax(this),t++):(cx(this),t--);return this}canInsertAfter(e){return Q(e)}canReplaceWith(e){return Q(e)}canMergeWith(e){return Q(e)||Tr(e)}extractWithChild(e,t){if(!N(t))return!1;const r=t.anchor.getNode(),i=t.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return ot("bullet")}canMergeWhenEmpty(){return!0}};function dx(n){if(n.classList.contains("task-list-item")){for(const t of n.children)if(t.tagName==="INPUT")return uf(t)}if(n.classList.contains("joplin-checkbox")){for(const t of n.children)if(t.classList.contains("checkbox-wrapper")&&t.children.length>0&&t.children[0].tagName==="INPUT")return uf(t.children[0])}const e=n.getAttribute("aria-checked");return{node:mt(e==="true"||e!=="false"&&void 0)}}function uf(n){return n.getAttribute("type")!=="checkbox"?{node:null}:{node:mt(n.hasAttribute("checked"))}}function mt(n){return Le(new Ar(void 0,n))}function Q(n){return n instanceof Ar}let ks=class extends xe{__tag;__start;__listType;$config(){return this.config("list",{$transform:e=>{(function(t){const r=t.getNextSibling();J(r)&&t.getListType()===r.getListType()&&gu(t,r)})(e),Mp(e)},extends:xe,importDOM:{ol:()=>({conversion:ff,priority:0}),ul:()=>({conversion:ff,priority:0})}})}constructor(e="number",t=1,r){super(r);const i=hx[e]||e;this.__listType=i,this.__tag=i==="number"?"ol":"ul",this.__start=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__listType=e.__listType,this.__tag=e.__tag,this.__start=e.__start}getTag(){return this.getLatest().__tag}setListType(e){const t=this.getWritable();return t.__listType=e,t.__tag=e==="number"?"ol":"ul",t}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){const t=this.getWritable();return t.__start=e,t}createDOM(e,t){const r=this.__tag,i=document.createElement(r);return this.__start!==1&&i.setAttribute("start",String(this.__start)),i.__lexicalListType=this.__listType,df(i,e.theme,this),i}updateDOM(e,t,r){return e.__tag!==this.__tag||e.__listType!==this.__listType||(df(t,r.theme,this),!1)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){const t=this.createDOM(e._config,e);return re(t)&&(this.__start!==1&&t.setAttribute("start",String(this.__start)),this.__listType==="check"&&t.setAttribute("__lexicalListType","check")),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,t,r){let i=r;for(let s=0;s<r.length;s++){const o=r[s];Q(o)||(i===r&&(i=[...r]),i[s]=mt().append(!A(o)||J(o)||o.isInline()?o:de(o.getTextContent())))}return super.splice(e,t,i)}extractWithChild(e){return Q(e)}};function df(n,e,t){const r=[],i=[],s=e.list;if(s!==void 0){const o=s[`${t.__tag}Depth`]||[],l=lx(t)-1,a=l%o.length,c=o[a],u=s[t.__tag];let d;const f=s.nested,h=s.checklist;if(f!==void 0&&f.list&&(d=f.list),u!==void 0&&r.push(u),h!==void 0&&t.__listType==="check"&&r.push(h),c!==void 0){r.push(...hn(c));for(let g=0;g<o.length;g++)g!==a&&i.push(t.__tag+g)}if(d!==void 0){const g=hn(d);l>1?r.push(...g):i.push(...g)}}i.length>0&&un(n,...i),r.length>0&&me(n,...r)}function fx(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t];if(Q(r)){e.push(r);const i=r.getChildren();i.length>1&&i.forEach(s=>{J(s)&&e.push(af(s))})}else e.push(af(r))}return e}function ff(n){const e=n.nodeName.toLowerCase();let t=null;return e==="ol"?t=ot("number",n.start):e==="ul"&&(t=(function(r){if(r.getAttribute("__lexicallisttype")==="check"||r.classList.contains("contains-task-list")||r.getAttribute("data-is-checklist")==="1")return!0;for(const i of r.childNodes)if(re(i)&&i.hasAttribute("aria-checked"))return!0;return!1})(n)?ot("check"):ot("bullet")),{after:fx,node:t}}const hx={ol:"number",ul:"bullet"};function ot(n="number",e=1){return Le(new ks(n,e))}function J(n){return n instanceof ks}const xl=z("INSERT_CHECK_LIST_COMMAND");function hf(n){return pt(n.registerCommand(xl,()=>(Io("check"),!0),G),n.registerCommand(dr,e=>mf(e,n,!1),G),n.registerCommand(dn,e=>mf(e,n,!0),G),n.registerCommand(ui,()=>{if(tc()!=null){const e=n.getRootElement();return e?.focus(),!0}return!1},G),n.registerCommand(Yo,e=>{const t=tc();return!(t==null||!n.isEditable())&&(n.update(()=>{const r=gt(t);Q(r)&&(e.preventDefault(),r.toggleChecked())}),!0)},G),n.registerCommand(bs,e=>n.getEditorState().read(()=>{const t=O();if(N(t)&&t.isCollapsed()){const{anchor:r}=t,i=r.type==="element";if(i||r.offset===0){const s=r.getNode(),o=le(s,l=>A(l)&&!l.isInline());if(Q(o)){const l=o.getParent();if(J(l)&&l.getListType()==="check"&&(i||o.getFirstDescendant()===s)){const a=n.getElementByKey(o.__key);if(a!=null&&document.activeElement!==a)return a.focus(),e.preventDefault(),!0}}}}return!1}),G),n.registerRootListener((e,t)=>{e!==null&&(e.addEventListener("click",gf),e.addEventListener("pointerdown",pf)),t!==null&&(t.removeEventListener("click",gf),t.removeEventListener("pointerdown",pf))}))}function $p(n,e){const t=n.target;if(!re(t))return;const r=t.firstChild;if(re(r)&&(r.tagName==="UL"||r.tagName==="OL"))return;const i=t.parentNode;if(!i||i.__lexicalListType!=="check")return;const s=t.getBoundingClientRect(),o=Mb(t),l=n.clientX/o,a=window.getComputedStyle?window.getComputedStyle(t,"::before"):{width:"0px"},c=parseFloat(a.width),u=n.pointerType==="touch"?32:0;(t.dir==="rtl"?l<s.right+u&&l>s.right-c-u:l>s.left-u&&l<s.left+c+u)&&e()}function gf(n){$p(n,()=>{if(re(n.target)){const e=n.target,t=al(e);t!=null&&t.isEditable()&&t.update(()=>{const r=gt(e);Q(r)&&(e.focus(),r.toggleChecked())})}})}function pf(n){$p(n,()=>{n.preventDefault()})}function tc(){const n=document.activeElement;return re(n)&&n.tagName==="LI"&&n.parentNode!=null&&n.parentNode.__lexicalListType==="check"?n:null}function mf(n,e,t){const r=tc();return r!=null&&e.update(()=>{const i=gt(r);if(!Q(i))return;const s=(function(o,l){let a=l?o.getPreviousSibling():o.getNextSibling(),c=o;for(;a==null&&Q(c);)c=c.getParentOrThrow().getParent(),c!=null&&(a=l?c.getPreviousSibling():c.getNextSibling());for(;Q(a);){const u=l?a.getLastChild():a.getFirstChild();if(!J(u))return a;a=l?u.getLastChild():u.getFirstChild()}return null})(i,t);if(s!=null){s.selectStart();const o=e.getElementByKey(s.__key);o!=null&&(n.preventDefault(),setTimeout(()=>{o.focus()},0))}}),!1}const gx=z("UPDATE_LIST_START_COMMAND"),bi=z("INSERT_UNORDERED_LIST_COMMAND"),xi=z("INSERT_ORDERED_LIST_COMMAND"),pu=z("REMOVE_LIST_COMMAND");function da(n){return pt(n.registerCommand(xi,()=>(Io("number"),!0),G),n.registerCommand(gx,e=>{const{listNodeKey:t,newStart:r}=e,i=q(t);return!!J(i)&&(i.getListType()==="number"&&(i.setStart(r),Mp(i)),!0)},G),n.registerCommand(bi,()=>(Io("bullet"),!0),G),n.registerCommand(pu,()=>(Op(),!0),G),n.registerCommand(Fn,()=>ux(),G),n.registerNodeTransform(Ar,e=>{const t=e.getFirstChild();if(t){if(D(t)){const r=t.getStyle(),i=t.getFormat();e.getTextStyle()!==r&&e.setTextStyle(r),e.getTextFormat()!==i&&e.setTextFormat(i)}}else{const r=O();N(r)&&(r.style!==e.getTextStyle()||r.format!==e.getTextFormat())&&r.isCollapsed()&&e.is(r.anchor.getNode())&&e.setTextStyle(r.style).setTextFormat(r.format)}}),n.registerNodeTransform(Ye,e=>{const t=e.getParent();if(Q(t)&&e.is(t.getFirstChild())){const r=e.getStyle(),i=e.getFormat();r===t.getTextStyle()&&i===t.getTextFormat()||t.setTextStyle(r).setTextFormat(i)}}))}function fa(n,e){n.update(()=>Io(e))}function px(n){n.update(()=>Op())}const mu=/^(\d+(?:\.\d+)?)px$/,Te={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class Or extends xe{__colSpan;__rowSpan;__headerState;__width;__backgroundColor;__verticalAlign;static getType(){return"tablecell"}static clone(e){return new Or(e.__headerState,e.__colSpan,e.__width,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__rowSpan=e.__rowSpan,this.__backgroundColor=e.__backgroundColor,this.__verticalAlign=e.__verticalAlign}static importDOM(){return{td:e=>({conversion:_f,priority:0}),th:e=>({conversion:_f,priority:0})}}static importJSON(e){return Ht().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan||1).setRowSpan(e.rowSpan||1).setWidth(e.width||void 0).setBackgroundColor(e.backgroundColor||null).setVerticalAlign(e.verticalAlign||void 0)}constructor(e=Te.NO_STATUS,t=1,r,i){super(i),this.__colSpan=t,this.__rowSpan=1,this.__headerState=e,this.__width=r,this.__backgroundColor=null,this.__verticalAlign=void 0}createDOM(e){const t=document.createElement(this.getTag());return this.__width&&(t.style.width=`${this.__width}px`),this.__colSpan>1&&(t.colSpan=this.__colSpan),this.__rowSpan>1&&(t.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(t.style.backgroundColor=this.__backgroundColor),nc(this.__verticalAlign)&&(t.style.verticalAlign=this.__verticalAlign),me(t,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),t}exportDOM(e){const t=super.exportDOM(e);if(re(t.element)){const r=t.element;r.setAttribute("data-temporary-table-cell-lexical-key",this.getKey()),r.style.border="1px solid black",this.__colSpan>1&&(r.colSpan=this.__colSpan),this.__rowSpan>1&&(r.rowSpan=this.__rowSpan),r.style.width=`${this.getWidth()||75}px`,r.style.verticalAlign=this.getVerticalAlign()||"top",r.style.textAlign="start",this.__backgroundColor===null&&this.hasHeader()&&(r.style.backgroundColor="#f2f3f5")}return t}exportJSON(){return{...super.exportJSON(),...nc(this.__verticalAlign)&&{verticalAlign:this.__verticalAlign},backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,width:this.getWidth()}}getColSpan(){return this.getLatest().__colSpan}setColSpan(e){const t=this.getWritable();return t.__colSpan=e,t}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(e){const t=this.getWritable();return t.__rowSpan=e,t}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e,t=Te.BOTH){const r=this.getWritable();return r.__headerState=e&t|r.__headerState&~t,r}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){const t=this.getWritable();return t.__width=e,t}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){const t=this.getWritable();return t.__backgroundColor=e,t}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(e){const t=this.getWritable();return t.__verticalAlign=e||void 0,t}toggleHeaderStyle(e){const t=this.getWritable();return(t.__headerState&e)===e?t.__headerState-=e:t.__headerState+=e,t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==Te.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor||e.__verticalAlign!==this.__verticalAlign}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function nc(n){return n==="middle"||n==="bottom"}function _f(n){const e=n,t=n.nodeName.toLowerCase();let r;mu.test(e.style.width)&&(r=parseFloat(e.style.width));const i=Ht(t==="th"?Te.ROW:Te.NO_STATUS,e.colSpan,r);i.__rowSpan=e.rowSpan;const s=e.style.backgroundColor;s!==""&&(i.__backgroundColor=s);const o=e.style.verticalAlign;nc(o)&&(i.__verticalAlign=o);const l=e.style,a=(l&&l.textDecoration||"").split(" "),c=l.fontWeight==="700"||l.fontWeight==="bold",u=a.includes("line-through"),d=l.fontStyle==="italic",f=a.includes("underline");return{after:h=>{const g=[];let p=null;const m=()=>{if(p){const b=p.getFirstChild();ue(b)&&p.getChildrenSize()===1&&b.remove()}};for(const b of h)Bg(b)||D(b)||ue(b)?(D(b)&&(c&&b.toggleFormat("bold"),u&&b.toggleFormat("strikethrough"),d&&b.toggleFormat("italic"),f&&b.toggleFormat("underline")),p?p.append(b):(p=H().append(b),g.push(p))):(g.push(b),m(),p=null);return m(),g.length===0&&g.push(H()),g},node:i}}function Ht(n=Te.NO_STATUS,e=1,t){return Le(new Or(n,e,t))}function ge(n){return n instanceof Or}const Ts=z("INSERT_TABLE_COMMAND");function ee(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}class Si extends xe{__height;static getType(){return"tablerow"}static clone(e){return new Si(e.__height,e.__key)}static importDOM(){return{tr:e=>({conversion:mx,priority:0})}}static importJSON(e){return ss().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeight(e.height)}constructor(e,t){super(t),this.__height=e}exportJSON(){const e=this.getHeight();return{...super.exportJSON(),...e===void 0?void 0:{height:e}}}createDOM(e){const t=document.createElement("tr");return this.__height&&(t.style.height=`${this.__height}px`),me(t,e.theme.tableRow),t}extractWithChild(e,t,r){return r==="html"}isShadowRoot(){return!0}setHeight(e){const t=this.getWritable();return t.__height=e,t}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function mx(n){const e=n;let t;return mu.test(e.style.height)&&(t=parseFloat(e.style.height)),{after:r=>cp(r,ge),node:ss(t)}}function ss(n){return Le(new Si(n))}function nt(n){return n instanceof Si}const Ip=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,_x=Ip&&"documentMode"in document?document.documentMode:null;function yx(n,e,t=!0){const r=yu();for(let i=0;i<n;i++){const s=ss();for(let o=0;o<e;o++){let l=Te.NO_STATUS;typeof t=="object"?(i===0&&t.rows&&(l|=Te.ROW),o===0&&t.columns&&(l|=Te.COLUMN)):t&&(i===0&&(l|=Te.ROW),o===0&&(l|=Te.COLUMN));const a=Ht(l),c=H();c.append(de()),a.append(c),s.append(a)}r.append(s)}return r}function bx(n){const e=le(n,t=>ge(t));return ge(e)?e:null}function Fp(n){const e=le(n,t=>Jt(t));if(Jt(e))return e;throw new Error("Expected table cell to be inside of table.")}Ip&&"InputEvent"in window&&!_x&&new window.InputEvent("input");const rc=(n,e)=>n===Te.BOTH||n===e?e:Te.NO_STATUS;function yf(n=!0){const e=O();N(e)||Mr(e)||ee(188);const t=e.anchor.getNode(),r=e.focus.getNode(),[i]=_t(t),[s,,o]=_t(r),[,l,a]=Sn(o,s,i),{startRow:c}=a,{startRow:u}=l;return n?ic(c+i.__rowSpan>u+s.__rowSpan?i:s,!0):ic(u<c?s:i,!1)}function ic(n,e=!0){const[,,t]=_t(n),[r,i]=Sn(t,n,n),s=r[0].length,{startRow:o}=i;let l=null;if(e){const a=o+n.__rowSpan-1,c=r[a],u=ss();for(let f=0;f<s;f++){const{cell:h,startRow:g}=c[f];if(g+h.__rowSpan-1<=a){const p=c[f].cell.__headerState,m=rc(p,Te.COLUMN);u.append(Ht(m).append(H()))}else h.setRowSpan(h.__rowSpan+1)}const d=t.getChildAtIndex(a);nt(d)||ee(256),d.insertAfter(u),l=u}else{const a=o,c=r[a],u=ss();for(let f=0;f<s;f++){const{cell:h,startRow:g}=c[f];if(g===a){const p=c[f].cell.__headerState,m=rc(p,Te.COLUMN);u.append(Ht(m).append(H()))}else h.setRowSpan(h.__rowSpan+1)}const d=t.getChildAtIndex(a);nt(d)||ee(257),d.insertBefore(u),l=u}return l}function bf(n=!0){const e=O();N(e)||Mr(e)||ee(188);const t=e.anchor.getNode(),r=e.focus.getNode(),[i]=_t(t),[s,,o]=_t(r),[,l,a]=Sn(o,s,i),{startColumn:c}=a,{startColumn:u}=l;return n?sc(c+i.__colSpan>u+s.__colSpan?i:s,!0):sc(u<c?s:i,!1)}function sc(n,e=!0,t=!0){const[,,r]=_t(n),[i,s]=Sn(r,n,n),o=i.length,{startColumn:l}=s,a=e?l+n.__colSpan-1:l-1,c=r.getFirstChild();nt(c)||ee(120);let u=null;function d(g=Te.NO_STATUS){const p=Ht(g).append(H());return u===null&&(u=p),p}let f=c;e:for(let g=0;g<o;g++){if(g!==0){const C=f.getNextSibling();nt(C)||ee(121),f=C}const p=i[g],m=p[a<0?0:a].cell.__headerState,b=rc(m,Te.ROW);if(a<0){_u(f,d(b));continue}const{cell:_,startColumn:y,startRow:S}=p[a];if(y+_.__colSpan-1<=a){let C=_,x=S,v=a;for(;x!==g&&C.__rowSpan>1;){if(v-=_.__colSpan,!(v>=0)){f.append(d(b));continue e}{const{cell:k,startRow:E}=p[v];C=k,x=E}}C.insertAfter(d(b))}else _.setColSpan(_.__colSpan+1)}u!==null&&t&&os(u);const h=r.getColWidths();if(h){const g=[...h],p=a<0?0:a,m=g[p];g.splice(p,0,m),r.setColWidths(g)}return u}function xx(){const n=O();N(n)||Mr(n)||ee(188);const[e,t]=n.isBackward()?[n.focus.getNode(),n.anchor.getNode()]:[n.anchor.getNode(),n.focus.getNode()],[r,,i]=_t(e),[s]=_t(t),[o,l,a]=Sn(i,r,s),{startRow:c}=l,{startRow:u}=a,d=u+s.__rowSpan-1;if(o.length===d-c+1)return void i.remove();const f=o[0].length,h=o[d+1],g=i.getChildAtIndex(d+1);for(let p=d;p>=c;p--){for(let b=f-1;b>=0;b--){const{cell:_,startRow:y,startColumn:S}=o[p][b];if(S===b){if(y<c||y+_.__rowSpan-1>d){const C=Math.max(y,c),x=Math.min(_.__rowSpan+y-1,d),v=C<=x?x-C+1:0;_.setRowSpan(_.__rowSpan-v)}if(y>=c&&y+_.__rowSpan-1>d&&p===d){g===null&&ee(122);let C=null;for(let x=0;x<b;x++){const v=h[x],k=v.cell;v.startRow===p+1&&(C=k),k.__colSpan>1&&(x+=k.__colSpan-1)}C===null?_u(g,_):C.insertAfter(_)}}}const m=i.getChildAtIndex(p);nt(m)||ee(206,String(p)),m.remove()}if(h!==void 0){const{cell:p}=h[0];os(p)}else{const p=o[c-1],{cell:m}=p[0];os(m)}}function Sx(){const n=O();N(n)||Mr(n)||ee(188);const e=n.anchor.getNode(),t=n.focus.getNode(),[r,,i]=_t(e),[s]=_t(t),[o,l,a]=Sn(i,r,s),{startColumn:c}=l,{startRow:u,startColumn:d}=a,f=Math.min(c,d),h=Math.max(c+r.__colSpan-1,d+s.__colSpan-1),g=h-f+1;if(o[0].length===h-f+1)return i.selectPrevious(),void i.remove();const p=o.length;for(let y=0;y<p;y++)for(let S=f;S<=h;S++){const{cell:C,startColumn:x}=o[y][S];if(x<f){if(S===f){const v=f-x;C.setColSpan(C.__colSpan-Math.min(g,C.__colSpan-v))}}else if(x+C.__colSpan-1>h){if(S===h){const v=h-x+1;C.setColSpan(C.__colSpan-v)}}else C.remove()}const m=o[u],b=c>d?m[c+r.__colSpan]:m[d+s.__colSpan];if(b!==void 0){const{cell:y}=b;os(y)}else{const y=d<c?m[d-1]:m[c-1],{cell:S}=y;os(S)}const _=i.getColWidths();if(_){const y=[..._];y.splice(f,g),i.setColWidths(y)}}function os(n){const e=n.getFirstDescendant();e==null?n.selectStart():e.getParentOrThrow().selectStart()}function _u(n,e){const t=n.getFirstChild();t!==null?t.insertBefore(e):n.append(e)}function Cx(n){if(n.length===0)return null;const e=Fp(n[0]),[t]=ln(e,null,null);let r=1/0,i=-1/0,s=1/0,o=-1/0;const l=new Set;for(const h of t)for(const g of h){if(!g||!g.cell)continue;const p=g.cell.getKey();if(!l.has(p)&&n.some(m=>m.is(g.cell))){l.add(p);const m=g.startRow,b=g.startColumn,_=g.cell.__rowSpan||1,y=g.cell.__colSpan||1;r=Math.min(r,m),i=Math.max(i,m+_-1),s=Math.min(s,b),o=Math.max(o,b+y-1)}}if(r===1/0||s===1/0)return null;const a=i-r+1,c=o-s+1,u=t[r][s];if(!u.cell)return null;const d=u.cell;d.setColSpan(c),d.setRowSpan(a);const f=new Set([d.getKey()]);for(let h=r;h<=i;h++)for(let g=s;g<=o;g++){const p=t[h][g];if(!p.cell)continue;const m=p.cell,b=m.getKey();f.has(b)||(f.add(b),wx(m)||d.append(...m.getChildren()),m.remove())}return d.getChildrenSize()===0&&d.append(H()),d}function wx(n){if(n.getChildrenSize()!==1)return!1;const e=n.getFirstChildOrThrow();return!(!Tr(e)||!e.isEmpty())}function vx(n){const[e,t,r]=_t(n),i=e.__colSpan,s=e.__rowSpan;if(i===1&&s===1)return;const[o,l]=Sn(r,e,e),{startColumn:a,startRow:c}=l,u=e.__headerState&Te.COLUMN,d=Array.from({length:i},(g,p)=>{let m=u;for(let b=0;m!==0&&b<o.length;b++)m&=o[b][p+a].cell.__headerState;return m}),f=e.__headerState&Te.ROW,h=Array.from({length:s},(g,p)=>{let m=f;for(let b=0;m!==0&&b<o[0].length;b++)m&=o[p+c][b].cell.__headerState;return m});if(i>1){for(let g=1;g<i;g++)e.insertAfter(Ht(d[g]|h[0]).append(H()));e.setColSpan(1)}if(s>1){let g;for(let p=1;p<s;p++){const m=c+p,b=o[m];g=(g||t).getNextSibling(),nt(g)||ee(125);let _=null;for(let y=0;y<a;y++){const S=b[y],C=S.cell;S.startRow===m&&(_=C),C.__colSpan>1&&(y+=C.__colSpan-1)}if(_===null)for(let y=i-1;y>=0;y--)_u(g,Ht(d[y]|h[p]).append(H()));else for(let y=i-1;y>=0;y--)_.insertAfter(Ht(d[y]|h[p]).append(H()))}e.setRowSpan(1)}}function Sn(n,e,t){const[r,i,s]=ln(n,e,t);return i===null&&ee(207),s===null&&ee(208),[r,i,s]}function ln(n,e,t){const r=[];let i=null,s=null;function o(a){let c=r[a];return c===void 0&&(r[a]=c=[]),c}const l=n.getChildren();for(let a=0;a<l.length;a++){const c=l[a];nt(c)||ee(209);const u=o(a);for(let d=c.getFirstChild(),f=0;d!=null;d=d.getNextSibling()){for(ge(d)||ee(147);u[f]!==void 0;)f++;const h={cell:d,startColumn:f,startRow:a},{__rowSpan:g,__colSpan:p}=d;for(let m=0;m<g&&!(a+m>=l.length);m++){const b=o(a+m);for(let _=0;_<p;_++)b[f+_]=h}e!==null&&i===null&&e.is(d)&&(i=h),t!==null&&s===null&&t.is(d)&&(s=h)}}return[r,i,s]}function _t(n){let e;if(n instanceof Or)e=n;else if("__type"in n){const i=le(n,ge);ge(i)||ee(148),e=i}else{const i=le(n.getNode(),ge);ge(i)||ee(148),e=i}const t=e.getParent();nt(t)||ee(149);const r=t.getParent();return Jt(r)||ee(210),[e,t,r]}function Dp(n,e,t){let r,i=Math.min(e.startColumn,t.startColumn),s=Math.min(e.startRow,t.startRow),o=Math.max(e.startColumn+e.cell.__colSpan-1,t.startColumn+t.cell.__colSpan-1),l=Math.max(e.startRow+e.cell.__rowSpan-1,t.startRow+t.cell.__rowSpan-1);do{r=!1;for(let a=0;a<n.length;a++)for(let c=0;c<n[0].length;c++){const u=n[a][c];if(!u)continue;const d=u.startColumn+u.cell.__colSpan-1,f=u.startRow+u.cell.__rowSpan-1,h=u.startColumn<=o&&d>=i,g=u.startRow<=l&&f>=s;if(h&&g){const p=Math.min(i,u.startColumn),m=Math.max(o,d),b=Math.min(s,u.startRow),_=Math.max(l,f);p===i&&m===o&&b===s&&_===l||(i=p,o=m,s=b,l=_,r=!0)}}}while(r);return{maxColumn:o,maxRow:l,minColumn:i,minRow:s}}function xf(n){const[e,,t]=_t(n),r=t.getChildren(),i=r.length,s=r[0].getChildren().length,o=new Array(i);for(let l=0;l<i;l++)o[l]=new Array(s);for(let l=0;l<i;l++){const a=r[l].getChildren();let c=0;for(let u=0;u<a.length;u++){for(;o[l][c];)c++;const d=a[u],f=d.__rowSpan||1,h=d.__colSpan||1;for(let g=0;g<f;g++)for(let p=0;p<h;p++)o[l+g][c+p]=d;if(e===d)return{colSpan:h,columnIndex:c,rowIndex:l,rowSpan:f};c+=h}}return null}function Sf(n){const[[e,t,r,i],[s,o,l,a]]=["anchor","focus"].map(c=>{const u=n[c].getNode(),d=le(u,ge);ge(d)||ee(238,c,u.getKey(),u.getType());const f=d.getParent();nt(f)||ee(239,c);const h=f.getParent();return Jt(h)||ee(240,c),[u,d,f,h]});return i.is(a)||ee(241),{anchorCell:t,anchorNode:e,anchorRow:r,anchorTable:i,focusCell:o,focusNode:s,focusRow:l,focusTable:a}}let Lp=class Rp{tableKey;anchor;focus;_cachedNodes;dirty;constructor(e,t,r){this.anchor=t,this.focus=r,t._selection=this,r._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isValid(){if(this.tableKey==="root"||this.anchor.key==="root"||this.anchor.type!=="element"||this.focus.key==="root"||this.focus.type!=="element")return!1;const e=q(this.tableKey),t=q(this.anchor.key),r=q(this.focus.key);return e!==null&&t!==null&&r!==null}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return Mr(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,t,r){this.dirty=this.dirty||e!==this.tableKey||t!==this.anchor.key||r!==this.focus.key,this.tableKey=e,this.anchor.key=t,this.focus.key=r,this._cachedNodes=null}clone(){return new Rp(this.tableKey,Ne(this.anchor.key,this.anchor.offset,this.anchor.type),Ne(this.focus.key,this.focus.offset,this.focus.type))}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}hasFormat(e){let t=0;this.getNodes().filter(ge).forEach(i=>{const s=i.getFirstChild();Tr(s)&&(t|=s.getTextFormat())});const r=Pe[e];return(t&r)!==0}insertNodes(e){const t=this.focus.getNode();A(t)||ee(151),In(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const{anchorCell:e,focusCell:t}=Sf(this),r=xf(e);r===null&&ee(153);const i=xf(t);i===null&&ee(155);const s=Math.min(r.columnIndex,i.columnIndex),o=Math.max(r.columnIndex+r.colSpan-1,i.columnIndex+i.colSpan-1),l=Math.min(r.rowIndex,i.rowIndex),a=Math.max(r.rowIndex+r.rowSpan-1,i.rowIndex+i.rowSpan-1);return{fromX:Math.min(s,o),fromY:Math.min(l,a),toX:Math.max(s,o),toY:Math.max(l,a)}}getNodes(){if(!this.isValid())return[];const e=this._cachedNodes;if(e!==null)return e;const{anchorTable:t,anchorCell:r,focusCell:i}=Sf(this),s=i.getParents()[1];if(s!==t){if(t.isParentOf(i)){const m=s.getParent();m==null&&ee(159),this.set(this.tableKey,i.getKey(),m.getKey())}else{const m=t.getParent();m==null&&ee(158),this.set(this.tableKey,m.getKey(),i.getKey())}return this.getNodes()}const[o,l,a]=Sn(t,r,i),{minColumn:c,maxColumn:u,minRow:d,maxRow:f}=Dp(o,l,a),h=new Map([[t.getKey(),t]]);let g=null;for(let m=d;m<=f;m++)for(let b=c;b<=u;b++){const{cell:_}=o[m][b],y=_.getParent();nt(y)||ee(160),y!==g&&(h.set(y.getKey(),y),g=y),h.has(_.getKey())||Tx(_,S=>{h.set(S.getKey(),S)})}const p=Array.from(h.values());return vr()||(this._cachedNodes=p),p}getTextContent(){const e=this.getNodes().filter(r=>ge(r));let t="";for(let r=0;r<e.length;r++){const i=e[r],s=i.__parent,o=(e[r+1]||{}).__parent;t+=i.getTextContent()+(o!==s?`
14
- `:" ")}return t}};function Mr(n){return n instanceof Lp}function Ex(){const n=Ne("root",0,"element"),e=Ne("root",0,"element");return new Lp("root",n,e)}function kx(n,e,t){n.getKey(),e.getKey(),t.getKey();const r=O(),i=Mr(r)?r.clone():Ex();return i.set(n.getKey(),e.getKey(),t.getKey()),i}function Tx(n,e){const t=[[n]];for(let r=t.at(-1);r!==void 0&&t.length>0;r=t.at(-1)){const i=r.pop();i===void 0?t.pop():e(i)!==!1&&A(i)&&t.push(i.getChildren())}}function Mi(n){return re(n)&&n.nodeName==="TABLE"}function Nx(n,e){for(let t=e,r=null;t!==null;t=t.getParent()){if(n.is(t))return r;ge(t)&&(r=t)}return null}function oc(n){const e=le(n,Jt);return Jt(e)?e:null}function Ax(n,e,t){return Nx(n,gt(e,t))}function Cf(n,e,t){if(!e.theme.tableAlignment)return;const r=[],i=[];for(const s of["center","right"]){const o=e.theme.tableAlignment[s];o&&(s===t?i:r).push(o)}un(n,...r),me(n,...i)}const Ox=new WeakSet;function wf(n=mi()){return Ox.has(n)}class yr extends xe{__rowStriping;__frozenColumnCount;__frozenRowCount;__colWidths;static getType(){return"table"}getColWidths(){return this.getLatest().__colWidths}setColWidths(e){const t=this.getWritable();return t.__colWidths=e,t}static clone(e){return new yr(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__colWidths=e.__colWidths,this.__rowStriping=e.__rowStriping,this.__frozenColumnCount=e.__frozenColumnCount,this.__frozenRowCount=e.__frozenRowCount}static importDOM(){return{table:e=>({conversion:Mx,priority:1})}}static importJSON(e){return yu().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setRowStriping(e.rowStriping||!1).setFrozenColumns(e.frozenColumnCount||0).setFrozenRows(e.frozenRowCount||0).setColWidths(e.colWidths)}constructor(e){super(e),this.__rowStriping=!1,this.__frozenColumnCount=0,this.__frozenRowCount=0,this.__colWidths=void 0}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),frozenColumnCount:this.__frozenColumnCount?this.__frozenColumnCount:void 0,frozenRowCount:this.__frozenRowCount?this.__frozenRowCount:void 0,rowStriping:this.__rowStriping?this.__rowStriping:void 0}}extractWithChild(e,t,r){return r==="html"}getDOMSlot(e){const t=Mi(e)?e:e.querySelector("table");return Mi(t)||ee(229),super.getDOMSlot(e).withElement(t).withAfter(t.querySelector("colgroup"))}createDOM(e,t){const r=document.createElement("table");this.__style&&(r.style.cssText=this.__style);const i=document.createElement("colgroup");if(r.appendChild(i),Wg(i),me(r,e.theme.table),this.updateTableElement(null,r,e),wf(t)){const s=document.createElement("div"),o=e.theme.tableScrollableWrapper;return o?me(s,o):s.style.cssText="overflow-x: auto;",s.appendChild(r),this.updateTableWrapper(null,s,r,e),s}return r}updateTableWrapper(e,t,r,i){this.__frozenColumnCount!==(e?e.__frozenColumnCount:0)&&(function(s,o,l,a){a>0?(me(s,l.theme.tableFrozenColumn),o.setAttribute("data-lexical-frozen-column","true")):(un(s,l.theme.tableFrozenColumn),o.removeAttribute("data-lexical-frozen-column"))})(t,r,i,this.__frozenColumnCount),this.__frozenRowCount!==(e?e.__frozenRowCount:0)&&(function(s,o,l,a){a>0?(me(s,l.theme.tableFrozenRow),o.setAttribute("data-lexical-frozen-row","true")):(un(s,l.theme.tableFrozenRow),o.removeAttribute("data-lexical-frozen-row"))})(t,r,i,this.__frozenRowCount)}updateTableElement(e,t,r){this.__style!==(e?e.__style:"")&&(t.style.cssText=this.__style),this.__rowStriping!==(!!e&&e.__rowStriping)&&(function(i,s,o){o?(me(i,s.theme.tableRowStriping),i.setAttribute("data-lexical-row-striping","true")):(un(i,s.theme.tableRowStriping),i.removeAttribute("data-lexical-row-striping"))})(t,r,this.__rowStriping),(function(i,s,o,l){const a=i.querySelector("colgroup");if(!a)return;const c=[];for(let u=0;u<o;u++){const d=document.createElement("col"),f=l&&l[u];f&&(d.style.width=`${f}px`),c.push(d)}a.replaceChildren(...c)})(t,0,this.getColumnCount(),this.getColWidths()),Cf(t,r,this.getFormatType())}updateDOM(e,t,r){const i=this.getDOMSlot(t).element;return t===i===wf()||(re(s=t)&&s.nodeName==="DIV"&&this.updateTableWrapper(e,t,i,r),this.updateTableElement(e,i,r),!1);var s}exportDOM(e){const t=super.exportDOM(e),{element:r}=t;return{after:i=>{if(t.after&&(i=t.after(i)),!Mi(i)&&re(i)&&(i=i.querySelector("table")),!Mi(i))return null;Cf(i,e._config,this.getFormatType());const[s]=ln(this,null,null),o=new Map;for(const u of s)for(const d of u){const f=d.cell.getKey();o.has(f)||o.set(f,{colSpan:d.cell.getColSpan(),startColumn:d.startColumn})}const l=new Set;for(const u of i.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")){const d=u.getAttribute("data-temporary-table-cell-lexical-key");if(d){const f=o.get(d);if(u.removeAttribute("data-temporary-table-cell-lexical-key"),f){o.delete(d);for(let h=0;h<f.colSpan;h++)l.add(h+f.startColumn)}}}const a=i.querySelector(":scope > colgroup");if(a){const u=Array.from(i.querySelectorAll(":scope > colgroup > col")).filter((d,f)=>l.has(f));a.replaceChildren(...u)}const c=i.querySelectorAll(":scope > tr");if(c.length>0){const u=document.createElement("tbody");for(const d of c)u.appendChild(d);i.append(u)}return i},element:!Mi(r)&&re(r)?r.querySelector("table"):r}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){const{rows:r,domRows:i}=t;for(let s=0;s<r;s++){const o=i[s];if(o!=null)for(let l=0;l<o.length;l++){const a=o[l];if(a==null)continue;const{elem:c}=a,u=Ax(this,c);if(u!==null&&e.is(u))return{x:l,y:s}}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,t,r){const{domRows:i}=r,s=i[t];if(s==null)return null;const o=s[e<s.length?e:s.length-1];return o??null}getDOMCellFromCordsOrThrow(e,t,r){const i=this.getDOMCellFromCords(e,t,r);if(!i)throw new Error("Cell not found at cords.");return i}getCellNodeFromCords(e,t,r){const i=this.getDOMCellFromCords(e,t,r);if(i==null)return null;const s=gt(i.elem);return ge(s)?s:null}getCellNodeFromCordsOrThrow(e,t,r){const i=this.getCellNodeFromCords(e,t,r);if(!i)throw new Error("Node at cords not TableCellNode.");return i}getRowStriping(){return!!this.getLatest().__rowStriping}setRowStriping(e){const t=this.getWritable();return t.__rowStriping=e,t}setFrozenColumns(e){const t=this.getWritable();return t.__frozenColumnCount=e,t}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(e){const t=this.getWritable();return t.__frozenRowCount=e,t}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){const e=this.getFirstChild();if(!e)return 0;let t=0;return e.getChildren().forEach(r=>{ge(r)&&(t+=r.getColSpan())}),t}}function Mx(n){const e=yu();n.hasAttribute("data-lexical-row-striping")&&e.setRowStriping(!0),n.hasAttribute("data-lexical-frozen-column")&&e.setFrozenColumns(1),n.hasAttribute("data-lexical-frozen-row")&&e.setFrozenRows(1);const t=n.querySelector(":scope > colgroup");if(t){let r=[];for(const i of t.querySelectorAll(":scope > col")){let s=i.style.width||"";if(!mu.test(s)&&(s=i.getAttribute("width")||"",!/^\d+$/.test(s))){r=void 0;break}r.push(parseFloat(s))}r&&e.setColWidths(r)}return{after:r=>cp(r,nt),node:e}}function yu(){return Le(new yr)}function Jt(n){return n instanceof yr}function $x(n){nt(n.getParent())?n.isEmpty()&&n.append(H()):n.remove()}function Ix(n){Jt(n.getParent())?lp(n,ge):n.remove()}function Fx(n){lp(n,nt);const[e]=ln(n,null,null),t=e.reduce((o,l)=>Math.max(o,l.length),0),r=n.getChildren();for(let o=0;o<e.length;++o){const l=r[o];if(!l)continue;nt(l)||ee(254,l.constructor.name,l.getType());const a=e[o].reduce((c,u)=>u?1+c:c,0);if(a!==t)for(let c=a;c<t;++c){const u=Ht();u.append(H()),l.append(u)}}const i=n.getColWidths(),s=n.getColumnCount();if(i&&i.length!==s){let o;if(s<i.length)o=i.slice(0,s);else if(i.length>0){const l=i[i.length-1];o=[...i,...Array(s-i.length).fill(l)]}n.setColWidths(o)}}function Dx(n){if(n.detail<3||!jn(n.target))return!1;const e=gt(n.target);if(e===null)return!1;const t=le(e,r=>A(r)&&!r.isInline());return t===null?!1:!!ge(t.getParent())&&(t.select(0),!0)}function Lx(){const n=O();if(!N(n))return!1;const e=oc(n.anchor.getNode());if(e===null)return!1;const t=fe();if(!t.is(e.getParent())||t.getChildrenSize()!==1)return!1;const[r]=ln(e,null,null);if(r.length===0||r[0].length===0)return!1;const i=r[0][0];if(!i||!i.cell)return!1;const s=r[r.length-1],o=s[s.length-1];if(!o||!o.cell)return!1;const l=kx(e,i.cell,o.cell);return Fe(l),!0}function vf(n,e){n.hasNodes([yr])||ee(255);const{hasNestedTables:t=bp(!1)}=e??{};return pt(n.registerCommand(Ts,r=>(function({rows:i,columns:s,includeHeaders:o},l){const a=O()||bn();if(!a||!N(a)||!l&&oc(a.anchor.getNode()))return!1;const c=yx(Number(i),Number(s),o);Ab(c);const u=c.getFirstDescendant();return D(u)&&u.select(),!0})(r,t.peek()),B),n.registerCommand(Nc,(r,i)=>{if(n!==i)return!1;if((function(l){const{nodes:a,selection:c}=l,u=c.getStartEndPoints(),d=Mr(c),f=N(c),h=f&&le(c.anchor.getNode(),j=>ge(j))!==null&&le(c.focus.getNode(),j=>ge(j))!==null||d;if(a.length!==1||!Jt(a[0])||!h||u===null)return!1;const[g,p]=u,[m,b,_]=_t(g),y=le(p.getNode(),j=>ge(j));if(!(ge(m)&&ge(y)&&nt(b)&&Jt(_)))return!1;const S=a[0],[C,x,v]=Sn(_,m,y),[k]=ln(S,null,null),E=C.length,M=E>0?C[0].length:0;let T=x.startRow,I=x.startColumn,K=k.length,$=K>0?k[0].length:0;if(d){const j=Dp(C,x,v),pe=j.maxRow-j.minRow+1,oe=j.maxColumn-j.minColumn+1;T=j.minRow,I=j.minColumn,K=Math.min(K,pe),$=Math.min($,oe)}let R=!1;const W=Math.min(E,T+K)-1,Z=Math.min(M,I+$)-1,Y=new Set;for(let j=T;j<=W;j++)for(let pe=I;pe<=Z;pe++){const oe=C[j][pe];Y.has(oe.cell.getKey())||oe.cell.__rowSpan===1&&oe.cell.__colSpan===1||(vx(oe.cell),Y.add(oe.cell.getKey()),R=!0)}let[se]=ln(_.getWritable(),null,null);const Ke=K-E+T;for(let j=0;j<Ke;j++)ic(se[E-1][0].cell);const qe=$-M+I;for(let j=0;j<qe;j++)sc(se[0][M-1].cell,!0,!1);[se]=ln(_.getWritable(),null,null);for(let j=T;j<T+K;j++)for(let pe=I;pe<I+$;pe++){const oe=j-T,Ze=pe-I,Se=k[oe][Ze];if(Se.startRow!==oe||Se.startColumn!==Ze)continue;const We=Se.cell;if(We.__rowSpan!==1||We.__colSpan!==1){const Ce=[],wn=Math.min(j+We.__rowSpan,T+K)-1,Ti=Math.min(pe+We.__colSpan,I+$)-1;for(let Zt=j;Zt<=wn;Zt++)for(let Ni=pe;Ni<=Ti;Ni++){const Vl=se[Zt][Ni];Ce.push(Vl.cell)}Cx(Ce),R=!0}const{cell:Xe}=se[j][pe],bt=Xe.getChildren();We.getChildren().forEach(Ce=>{D(Ce)&&H().append(Ce),Xe.append(Ce)}),bt.forEach(Ce=>Ce.remove())}if(d&&R){const[j]=ln(_.getWritable(),null,null);j[x.startRow][x.startColumn].cell.selectEnd()}return!0})(r))return!0;const{selection:s,nodes:o}=r;return t.peek()||n!==i||!N(s)?!1:oc(s.anchor.getNode())!==null&&o.some(Jt)},B),n.registerCommand(Xr,Lx,G),n.registerCommand(br,Dx,B),n.registerNodeTransform(yr,Fx),n.registerNodeTransform(Si,Ix),n.registerNodeTransform(Or,$x))}const Rx=new Set(["http:","https:","mailto:","sms:","tel:"]);class $r extends xe{__url;__target;__rel;__title;static getType(){return"link"}static clone(e){return new $r(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e="",t={},r){super(r);const{target:i=null,rel:s=null,title:o=null}=t;this.__url=e,this.__target=i,this.__rel=s,this.__title=o}createDOM(e){const t=document.createElement("a");return this.updateLinkDOM(null,t,e),me(t,e.theme.link),t}updateLinkDOM(e,t,r){if(ru(t)){e&&e.__url===this.__url||(t.href=this.sanitizeUrl(this.__url));for(const i of["target","rel","title"]){const s=`__${i}`,o=this[s];e&&e[s]===o||(o?t[i]=o:t.removeAttribute(i))}}}updateDOM(e,t,r){return this.updateLinkDOM(e,t,r),!1}static importDOM(){return{a:e=>({conversion:Px,priority:1})}}static importJSON(e){return rr().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setURL(e.url).setRel(e.rel||null).setTarget(e.target||null).setTitle(e.title||null)}sanitizeUrl(e){e=Tf(e);try{const t=new URL(Tf(e));if(!Rx.has(t.protocol))return"about:blank"}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(e){const t=this.getWritable();return t.__url=e,t}getTarget(){return this.getLatest().__target}setTarget(e){const t=this.getWritable();return t.__target=e,t}getRel(){return this.getLatest().__rel}setRel(e){const t=this.getWritable();return t.__rel=e,t}getTitle(){return this.getLatest().__title}setTitle(e){const t=this.getWritable();return t.__title=e,t}insertNewAfter(e,t=!0){const r=rr(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(r,t),r}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,r){if(!N(t))return!1;const i=t.anchor.getNode(),s=t.focus.getNode();return this.isParentOf(i)&&this.isParentOf(s)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function Px(n){let e=null;if(ru(n)){const t=n.textContent;(t!==null&&t!==""||n.children.length>0)&&(e=rr(n.getAttribute("href")||"",{rel:n.getAttribute("rel"),target:n.getAttribute("target"),title:n.getAttribute("title")}))}return{node:e}}function rr(n="",e){return Le(new $r(n,e))}function vn(n){return n instanceof $r}let bu=class Pp extends $r{__isUnlinked;constructor(e="",t={},r){super(e,t,r),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}static getType(){return"autolink"}static clone(e){return new Pp(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,r){return super.updateDOM(e,t,r)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return Ef().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,t=!0){const r=this.getParentOrThrow().insertNewAfter(e,t);if(A(r)){const i=Ef(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return r.append(i),i}return null}};function Ef(n="",e){return Le(new bu(n,e))}function Ri(n){return n instanceof bu}const lc=z("TOGGLE_LINK_COMMAND");function kf(n,e){if(n.type==="element"){const t=n.getNode();return A(t)||(function(r,...i){const s=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",r);for(const l of i)o.append("v",l);throw s.search=o.toString(),Error(`Minified Lexical error #${r}; visit ${s.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(252),t.getChildren()[n.offset+e]||null}return null}function Bx(n,e={}){let t;if(n&&typeof n=="object"){const{url:u,...d}=n;t=u,e={...d,...e}}else t=n;const{target:r,title:i}=e,s=e.rel===void 0?"noreferrer":e.rel,o=O();if(o===null||!N(o)&&!je(o))return;if(je(o)){const u=o.getNodes();return u.length===0?void 0:void u.forEach(d=>{if(t===null){const f=le(d,h=>!Ri(h)&&vn(h));f&&(f.insertBefore(d),f.getChildren().length===0&&f.remove())}else{const f=le(d,h=>!Ri(h)&&vn(h));if(f)f.setURL(t),r!==void 0&&f.setTarget(r),s!==void 0&&f.setRel(s);else{const h=rr(t,{rel:s,target:r});d.insertBefore(h),h.append(d)}}})}const l=o.extract();if(t===null){const u=new Set;return void l.forEach(d=>{const f=le(d,h=>!Ri(h)&&vn(h));if(f!==null){const h=f.getKey();if(u.has(h))return;(function(g,p){const m=new Set(p.filter(k=>g.isParentOf(k)).map(k=>k.getKey())),b=g.getChildren(),_=k=>m.has(k.getKey())||A(k)&&p.some(E=>g.isParentOf(E)&&k.isParentOf(E)),y=b.filter(_);if(y.length===b.length)return b.forEach(k=>g.insertBefore(k)),void g.remove();const S=b.findIndex(_),C=b.findLastIndex(_),x=S===0,v=C===b.length-1;if(x)y.forEach(k=>g.insertBefore(k));else if(v)for(let k=y.length-1;k>=0;k--)g.insertAfter(y[k]);else{for(let E=y.length-1;E>=0;E--)g.insertAfter(y[E]);const k=b.slice(C+1);if(k.length>0){const E=rr(g.getURL(),{rel:g.getRel(),target:g.getTarget(),title:g.getTitle()});y[y.length-1].insertAfter(E),k.forEach(M=>E.append(M))}}})(f,l),u.add(h)}})}const a=new Set,c=u=>{a.has(u.getKey())||(a.add(u.getKey()),u.setURL(t),r!==void 0&&u.setTarget(r),s!==void 0&&u.setRel(s),i!==void 0&&u.setTitle(i))};if(l.length===1){const u=l[0],d=le(u,vn);if(d!==null)return c(d)}(function(u){const d=O();if(!N(d))return u();const f=In(d),h=f.isBackward(),g=kf(f.anchor,h?-1:0),p=kf(f.focus,h?0:-1);if(u(),g||p){const m=O();if(N(m)){const b=m.clone();if(g){const _=g.getParent();_&&b.anchor.set(_.getKey(),g.getIndexWithinParent()+(h?1:0),"element")}if(p){const _=p.getParent();_&&b.focus.set(_.getKey(),p.getIndexWithinParent()+(h?0:1),"element")}Fe(In(b))}}})(()=>{let u=null;for(const d of l){if(!d.isAttached())continue;const f=le(d,vn);if(f){c(f);continue}if(A(d)){if(!d.isInline())continue;if(vn(d)){if(!(Ri(d)||u!==null&&u.getParentOrThrow().isParentOf(d))){c(d),u=d;continue}for(const g of d.getChildren())d.insertBefore(g);d.remove();continue}}const h=d.getPreviousSibling();vn(h)&&h.is(u)?h.append(d):(u=rr(t,{rel:s,target:r,title:i}),d.insertAfter(u),u.append(d))}})}const zx=/^\+?[0-9\s()-]{5,}$/;function Tf(n){return n.match(/^[a-z][a-z0-9+.-]*:/i)||n.match(/^[/#.]/)?n:n.includes("@")?`mailto:${n}`:zx.test(n)?`tel:${n}`:`https://${n}`}const ha=Bx;var ga={exports:{}},Nf;function Ux(){return Nf||(Nf=1,(function(n){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/**
15
- * Prism: Lightweight, robust, elegant syntax highlighting
16
- *
17
- * @license MIT <https://opensource.org/licenses/MIT>
18
- * @author Lea Verou <https://lea.verou.me>
19
- * @namespace
20
- * @public
21
- */var t=(function(r){var i=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,s=0,o={},l={manual:r.Prism&&r.Prism.manual,disableWorkerMessageHandler:r.Prism&&r.Prism.disableWorkerMessageHandler,util:{encode:function _(y){return y instanceof a?new a(y.type,_(y.content),y.alias):Array.isArray(y)?y.map(_):y.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(_){return Object.prototype.toString.call(_).slice(8,-1)},objId:function(_){return _.__id||Object.defineProperty(_,"__id",{value:++s}),_.__id},clone:function _(y,S){S=S||{};var C,x;switch(l.util.type(y)){case"Object":if(x=l.util.objId(y),S[x])return S[x];C={},S[x]=C;for(var v in y)y.hasOwnProperty(v)&&(C[v]=_(y[v],S));return C;case"Array":return x=l.util.objId(y),S[x]?S[x]:(C=[],S[x]=C,y.forEach(function(k,E){C[E]=_(k,S)}),C);default:return y}},getLanguage:function(_){for(;_;){var y=i.exec(_.className);if(y)return y[1].toLowerCase();_=_.parentElement}return"none"},setLanguage:function(_,y){_.className=_.className.replace(RegExp(i,"gi"),""),_.classList.add("language-"+y)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(C){var _=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(C.stack)||[])[1];if(_){var y=document.getElementsByTagName("script");for(var S in y)if(y[S].src==_)return y[S]}return null}},isActive:function(_,y,S){for(var C="no-"+y;_;){var x=_.classList;if(x.contains(y))return!0;if(x.contains(C))return!1;_=_.parentElement}return!!S}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(_,y){var S=l.util.clone(l.languages[_]);for(var C in y)S[C]=y[C];return S},insertBefore:function(_,y,S,C){C=C||l.languages;var x=C[_],v={};for(var k in x)if(x.hasOwnProperty(k)){if(k==y)for(var E in S)S.hasOwnProperty(E)&&(v[E]=S[E]);S.hasOwnProperty(k)||(v[k]=x[k])}var M=C[_];return C[_]=v,l.languages.DFS(l.languages,function(T,I){I===M&&T!=_&&(this[T]=v)}),v},DFS:function _(y,S,C,x){x=x||{};var v=l.util.objId;for(var k in y)if(y.hasOwnProperty(k)){S.call(y,k,y[k],C||k);var E=y[k],M=l.util.type(E);M==="Object"&&!x[v(E)]?(x[v(E)]=!0,_(E,S,null,x)):M==="Array"&&!x[v(E)]&&(x[v(E)]=!0,_(E,S,k,x))}}},plugins:{},highlightAll:function(_,y){l.highlightAllUnder(document,_,y)},highlightAllUnder:function(_,y,S){var C={callback:S,container:_,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};l.hooks.run("before-highlightall",C),C.elements=Array.prototype.slice.apply(C.container.querySelectorAll(C.selector)),l.hooks.run("before-all-elements-highlight",C);for(var x=0,v;v=C.elements[x++];)l.highlightElement(v,y===!0,C.callback)},highlightElement:function(_,y,S){var C=l.util.getLanguage(_),x=l.languages[C];l.util.setLanguage(_,C);var v=_.parentElement;v&&v.nodeName.toLowerCase()==="pre"&&l.util.setLanguage(v,C);var k=_.textContent,E={element:_,language:C,grammar:x,code:k};function M(I){E.highlightedCode=I,l.hooks.run("before-insert",E),E.element.innerHTML=E.highlightedCode,l.hooks.run("after-highlight",E),l.hooks.run("complete",E),S&&S.call(E.element)}if(l.hooks.run("before-sanity-check",E),v=E.element.parentElement,v&&v.nodeName.toLowerCase()==="pre"&&!v.hasAttribute("tabindex")&&v.setAttribute("tabindex","0"),!E.code){l.hooks.run("complete",E),S&&S.call(E.element);return}if(l.hooks.run("before-highlight",E),!E.grammar){M(l.util.encode(E.code));return}if(y&&r.Worker){var T=new Worker(l.filename);T.onmessage=function(I){M(I.data)},T.postMessage(JSON.stringify({language:E.language,code:E.code,immediateClose:!0}))}else M(l.highlight(E.code,E.grammar,E.language))},highlight:function(_,y,S){var C={code:_,grammar:y,language:S};if(l.hooks.run("before-tokenize",C),!C.grammar)throw new Error('The language "'+C.language+'" has no grammar.');return C.tokens=l.tokenize(C.code,C.grammar),l.hooks.run("after-tokenize",C),a.stringify(l.util.encode(C.tokens),C.language)},tokenize:function(_,y){var S=y.rest;if(S){for(var C in S)y[C]=S[C];delete y.rest}var x=new d;return f(x,x.head,_),u(_,x,y,x.head,0),g(x)},hooks:{all:{},add:function(_,y){var S=l.hooks.all;S[_]=S[_]||[],S[_].push(y)},run:function(_,y){var S=l.hooks.all[_];if(!(!S||!S.length))for(var C=0,x;x=S[C++];)x(y)}},Token:a};r.Prism=l;function a(_,y,S,C){this.type=_,this.content=y,this.alias=S,this.length=(C||"").length|0}a.stringify=function _(y,S){if(typeof y=="string")return y;if(Array.isArray(y)){var C="";return y.forEach(function(M){C+=_(M,S)}),C}var x={type:y.type,content:_(y.content,S),tag:"span",classes:["token",y.type],attributes:{},language:S},v=y.alias;v&&(Array.isArray(v)?Array.prototype.push.apply(x.classes,v):x.classes.push(v)),l.hooks.run("wrap",x);var k="";for(var E in x.attributes)k+=" "+E+'="'+(x.attributes[E]||"").replace(/"/g,"&quot;")+'"';return"<"+x.tag+' class="'+x.classes.join(" ")+'"'+k+">"+x.content+"</"+x.tag+">"};function c(_,y,S,C){_.lastIndex=y;var x=_.exec(S);if(x&&C&&x[1]){var v=x[1].length;x.index+=v,x[0]=x[0].slice(v)}return x}function u(_,y,S,C,x,v){for(var k in S)if(!(!S.hasOwnProperty(k)||!S[k])){var E=S[k];E=Array.isArray(E)?E:[E];for(var M=0;M<E.length;++M){if(v&&v.cause==k+","+M)return;var T=E[M],I=T.inside,K=!!T.lookbehind,$=!!T.greedy,R=T.alias;if($&&!T.pattern.global){var W=T.pattern.toString().match(/[imsuy]*$/)[0];T.pattern=RegExp(T.pattern.source,W+"g")}for(var Z=T.pattern||T,Y=C.next,se=x;Y!==y.tail&&!(v&&se>=v.reach);se+=Y.value.length,Y=Y.next){var Ke=Y.value;if(y.length>_.length)return;if(!(Ke instanceof a)){var qe=1,j;if($){if(j=c(Z,se,_,K),!j||j.index>=_.length)break;var Se=j.index,pe=j.index+j[0].length,oe=se;for(oe+=Y.value.length;Se>=oe;)Y=Y.next,oe+=Y.value.length;if(oe-=Y.value.length,se=oe,Y.value instanceof a)continue;for(var Ze=Y;Ze!==y.tail&&(oe<pe||typeof Ze.value=="string");Ze=Ze.next)qe++,oe+=Ze.value.length;qe--,Ke=_.slice(se,oe),j.index-=se}else if(j=c(Z,0,Ke,K),!j)continue;var Se=j.index,We=j[0],Xe=Ke.slice(0,Se),bt=Ke.slice(Se+We.length),Ce=se+Ke.length;v&&Ce>v.reach&&(v.reach=Ce);var wn=Y.prev;Xe&&(wn=f(y,wn,Xe),se+=Xe.length),h(y,wn,qe);var Ti=new a(k,I?l.tokenize(We,I):We,R,We);if(Y=f(y,wn,Ti),bt&&f(y,Y,bt),qe>1){var Zt={cause:k+","+M,reach:Ce};u(_,y,S,Y.prev,se,Zt),v&&Zt.reach>v.reach&&(v.reach=Zt.reach)}}}}}}function d(){var _={value:null,prev:null,next:null},y={value:null,prev:_,next:null};_.next=y,this.head=_,this.tail=y,this.length=0}function f(_,y,S){var C=y.next,x={value:S,prev:y,next:C};return y.next=x,C.prev=x,_.length++,x}function h(_,y,S){for(var C=y.next,x=0;x<S&&C!==_.tail;x++)C=C.next;y.next=C,C.prev=y,_.length-=x}function g(_){for(var y=[],S=_.head.next;S!==_.tail;)y.push(S.value),S=S.next;return y}if(!r.document)return r.addEventListener&&(l.disableWorkerMessageHandler||r.addEventListener("message",function(_){var y=JSON.parse(_.data),S=y.language,C=y.code,x=y.immediateClose;r.postMessage(l.highlight(C,l.languages[S],S)),x&&r.close()},!1)),l;var p=l.util.currentScript();p&&(l.filename=p.src,p.hasAttribute("data-manual")&&(l.manual=!0));function m(){l.manual||l.highlightAll()}if(!l.manual){var b=document.readyState;b==="loading"||b==="interactive"&&p&&p.defer?document.addEventListener("DOMContentLoaded",m):window.requestAnimationFrame?window.requestAnimationFrame(m):window.setTimeout(m,16)}return l})(e);n.exports&&(n.exports=t),typeof Yu.commonjsGlobal<"u"&&(Yu.commonjsGlobal.Prism=t),t.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},t.languages.markup.tag.inside["attr-value"].inside.entity=t.languages.markup.entity,t.languages.markup.doctype.inside["internal-subset"].inside=t.languages.markup,t.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.replace(/&amp;/,"&"))}),Object.defineProperty(t.languages.markup.tag,"addInlined",{value:function(i,s){var o={};o["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:t.languages[s]},o.cdata=/^<!\[CDATA\[|\]\]>$/i;var l={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:o}};l["language-"+s]={pattern:/[\s\S]+/,inside:t.languages[s]};var a={};a[i]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:l},t.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(t.languages.markup.tag,"addAttribute",{value:function(r,i){t.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[i,"language-"+i],inside:t.languages[i]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),t.languages.html=t.languages.markup,t.languages.mathml=t.languages.markup,t.languages.svg=t.languages.markup,t.languages.xml=t.languages.extend("markup",{}),t.languages.ssml=t.languages.xml,t.languages.atom=t.languages.xml,t.languages.rss=t.languages.xml,(function(r){var i=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;r.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+i.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+i.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+i.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+i.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:i,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},r.languages.css.atrule.inside.rest=r.languages.css;var s=r.languages.markup;s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))})(t),t.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},t.languages.javascript=t.languages.extend("clike",{"class-name":[t.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),t.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,t.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:t.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:t.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:t.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:t.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:t.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),t.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:t.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),t.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),t.languages.markup&&(t.languages.markup.tag.addInlined("script","javascript"),t.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),t.languages.js=t.languages.javascript,(function(){if(typeof t>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var r="Loading…",i=function(p,m){return"✖ Error "+p+" while fetching file: "+m},s="✖ Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},l="data-src-status",a="loading",c="loaded",u="failed",d="pre[data-src]:not(["+l+'="'+c+'"]):not(['+l+'="'+a+'"])';function f(p,m,b){var _=new XMLHttpRequest;_.open("GET",p,!0),_.onreadystatechange=function(){_.readyState==4&&(_.status<400&&_.responseText?m(_.responseText):_.status>=400?b(i(_.status,_.statusText)):b(s))},_.send(null)}function h(p){var m=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(p||"");if(m){var b=Number(m[1]),_=m[2],y=m[3];return _?y?[b,Number(y)]:[b,void 0]:[b,b]}}t.hooks.add("before-highlightall",function(p){p.selector+=", "+d}),t.hooks.add("before-sanity-check",function(p){var m=p.element;if(m.matches(d)){p.code="",m.setAttribute(l,a);var b=m.appendChild(document.createElement("CODE"));b.textContent=r;var _=m.getAttribute("data-src"),y=p.language;if(y==="none"){var S=(/\.(\w+)$/.exec(_)||[,"none"])[1];y=o[S]||S}t.util.setLanguage(b,y),t.util.setLanguage(m,y);var C=t.plugins.autoloader;C&&C.loadLanguages(y),f(_,function(x){m.setAttribute(l,c);var v=h(m.getAttribute("data-range"));if(v){var k=x.split(/\r\n?|\n/g),E=v[0],M=v[1]==null?k.length:v[1];E<0&&(E+=k.length),E=Math.max(0,Math.min(E-1,k.length)),M<0&&(M+=k.length),M=Math.max(0,Math.min(M,k.length)),x=k.slice(E,M).join(`
14
+ `:" ")}return t}};function Mr(n){return n instanceof Lp}function Ex(){const n=Ne("root",0,"element"),e=Ne("root",0,"element");return new Lp("root",n,e)}function kx(n,e,t){n.getKey(),e.getKey(),t.getKey();const r=O(),i=Mr(r)?r.clone():Ex();return i.set(n.getKey(),e.getKey(),t.getKey()),i}function Tx(n,e){const t=[[n]];for(let r=t.at(-1);r!==void 0&&t.length>0;r=t.at(-1)){const i=r.pop();i===void 0?t.pop():e(i)!==!1&&A(i)&&t.push(i.getChildren())}}function Mi(n){return re(n)&&n.nodeName==="TABLE"}function Nx(n,e){for(let t=e,r=null;t!==null;t=t.getParent()){if(n.is(t))return r;ge(t)&&(r=t)}return null}function oc(n){const e=le(n,Jt);return Jt(e)?e:null}function Ax(n,e,t){return Nx(n,gt(e,t))}function Cf(n,e,t){if(!e.theme.tableAlignment)return;const r=[],i=[];for(const s of["center","right"]){const o=e.theme.tableAlignment[s];o&&(s===t?i:r).push(o)}un(n,...r),me(n,...i)}const Ox=new WeakSet;function wf(n=mi()){return Ox.has(n)}class yr extends xe{__rowStriping;__frozenColumnCount;__frozenRowCount;__colWidths;static getType(){return"table"}getColWidths(){return this.getLatest().__colWidths}setColWidths(e){const t=this.getWritable();return t.__colWidths=e,t}static clone(e){return new yr(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__colWidths=e.__colWidths,this.__rowStriping=e.__rowStriping,this.__frozenColumnCount=e.__frozenColumnCount,this.__frozenRowCount=e.__frozenRowCount}static importDOM(){return{table:e=>({conversion:Mx,priority:1})}}static importJSON(e){return yu().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setRowStriping(e.rowStriping||!1).setFrozenColumns(e.frozenColumnCount||0).setFrozenRows(e.frozenRowCount||0).setColWidths(e.colWidths)}constructor(e){super(e),this.__rowStriping=!1,this.__frozenColumnCount=0,this.__frozenRowCount=0,this.__colWidths=void 0}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),frozenColumnCount:this.__frozenColumnCount?this.__frozenColumnCount:void 0,frozenRowCount:this.__frozenRowCount?this.__frozenRowCount:void 0,rowStriping:this.__rowStriping?this.__rowStriping:void 0}}extractWithChild(e,t,r){return r==="html"}getDOMSlot(e){const t=Mi(e)?e:e.querySelector("table");return Mi(t)||ee(229),super.getDOMSlot(e).withElement(t).withAfter(t.querySelector("colgroup"))}createDOM(e,t){const r=document.createElement("table");this.__style&&(r.style.cssText=this.__style);const i=document.createElement("colgroup");if(r.appendChild(i),Wg(i),me(r,e.theme.table),this.updateTableElement(null,r,e),wf(t)){const s=document.createElement("div"),o=e.theme.tableScrollableWrapper;return o?me(s,o):s.style.cssText="overflow-x: auto;",s.appendChild(r),this.updateTableWrapper(null,s,r,e),s}return r}updateTableWrapper(e,t,r,i){this.__frozenColumnCount!==(e?e.__frozenColumnCount:0)&&(function(s,o,l,a){a>0?(me(s,l.theme.tableFrozenColumn),o.setAttribute("data-lexical-frozen-column","true")):(un(s,l.theme.tableFrozenColumn),o.removeAttribute("data-lexical-frozen-column"))})(t,r,i,this.__frozenColumnCount),this.__frozenRowCount!==(e?e.__frozenRowCount:0)&&(function(s,o,l,a){a>0?(me(s,l.theme.tableFrozenRow),o.setAttribute("data-lexical-frozen-row","true")):(un(s,l.theme.tableFrozenRow),o.removeAttribute("data-lexical-frozen-row"))})(t,r,i,this.__frozenRowCount)}updateTableElement(e,t,r){this.__style!==(e?e.__style:"")&&(t.style.cssText=this.__style),this.__rowStriping!==(!!e&&e.__rowStriping)&&(function(i,s,o){o?(me(i,s.theme.tableRowStriping),i.setAttribute("data-lexical-row-striping","true")):(un(i,s.theme.tableRowStriping),i.removeAttribute("data-lexical-row-striping"))})(t,r,this.__rowStriping),(function(i,s,o,l){const a=i.querySelector("colgroup");if(!a)return;const c=[];for(let u=0;u<o;u++){const d=document.createElement("col"),f=l&&l[u];f&&(d.style.width=`${f}px`),c.push(d)}a.replaceChildren(...c)})(t,0,this.getColumnCount(),this.getColWidths()),Cf(t,r,this.getFormatType())}updateDOM(e,t,r){const i=this.getDOMSlot(t).element;return t===i===wf()||(re(s=t)&&s.nodeName==="DIV"&&this.updateTableWrapper(e,t,i,r),this.updateTableElement(e,i,r),!1);var s}exportDOM(e){const t=super.exportDOM(e),{element:r}=t;return{after:i=>{if(t.after&&(i=t.after(i)),!Mi(i)&&re(i)&&(i=i.querySelector("table")),!Mi(i))return null;Cf(i,e._config,this.getFormatType());const[s]=ln(this,null,null),o=new Map;for(const u of s)for(const d of u){const f=d.cell.getKey();o.has(f)||o.set(f,{colSpan:d.cell.getColSpan(),startColumn:d.startColumn})}const l=new Set;for(const u of i.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")){const d=u.getAttribute("data-temporary-table-cell-lexical-key");if(d){const f=o.get(d);if(u.removeAttribute("data-temporary-table-cell-lexical-key"),f){o.delete(d);for(let h=0;h<f.colSpan;h++)l.add(h+f.startColumn)}}}const a=i.querySelector(":scope > colgroup");if(a){const u=Array.from(i.querySelectorAll(":scope > colgroup > col")).filter((d,f)=>l.has(f));a.replaceChildren(...u)}const c=i.querySelectorAll(":scope > tr");if(c.length>0){const u=document.createElement("tbody");for(const d of c)u.appendChild(d);i.append(u)}return i},element:!Mi(r)&&re(r)?r.querySelector("table"):r}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){const{rows:r,domRows:i}=t;for(let s=0;s<r;s++){const o=i[s];if(o!=null)for(let l=0;l<o.length;l++){const a=o[l];if(a==null)continue;const{elem:c}=a,u=Ax(this,c);if(u!==null&&e.is(u))return{x:l,y:s}}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,t,r){const{domRows:i}=r,s=i[t];if(s==null)return null;const o=s[e<s.length?e:s.length-1];return o??null}getDOMCellFromCordsOrThrow(e,t,r){const i=this.getDOMCellFromCords(e,t,r);if(!i)throw new Error("Cell not found at cords.");return i}getCellNodeFromCords(e,t,r){const i=this.getDOMCellFromCords(e,t,r);if(i==null)return null;const s=gt(i.elem);return ge(s)?s:null}getCellNodeFromCordsOrThrow(e,t,r){const i=this.getCellNodeFromCords(e,t,r);if(!i)throw new Error("Node at cords not TableCellNode.");return i}getRowStriping(){return!!this.getLatest().__rowStriping}setRowStriping(e){const t=this.getWritable();return t.__rowStriping=e,t}setFrozenColumns(e){const t=this.getWritable();return t.__frozenColumnCount=e,t}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(e){const t=this.getWritable();return t.__frozenRowCount=e,t}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){const e=this.getFirstChild();if(!e)return 0;let t=0;return e.getChildren().forEach(r=>{ge(r)&&(t+=r.getColSpan())}),t}}function Mx(n){const e=yu();n.hasAttribute("data-lexical-row-striping")&&e.setRowStriping(!0),n.hasAttribute("data-lexical-frozen-column")&&e.setFrozenColumns(1),n.hasAttribute("data-lexical-frozen-row")&&e.setFrozenRows(1);const t=n.querySelector(":scope > colgroup");if(t){let r=[];for(const i of t.querySelectorAll(":scope > col")){let s=i.style.width||"";if(!mu.test(s)&&(s=i.getAttribute("width")||"",!/^\d+$/.test(s))){r=void 0;break}r.push(parseFloat(s))}r&&e.setColWidths(r)}return{after:r=>cp(r,nt),node:e}}function yu(){return Le(new yr)}function Jt(n){return n instanceof yr}function $x(n){nt(n.getParent())?n.isEmpty()&&n.append(H()):n.remove()}function Ix(n){Jt(n.getParent())?lp(n,ge):n.remove()}function Fx(n){lp(n,nt);const[e]=ln(n,null,null),t=e.reduce((o,l)=>Math.max(o,l.length),0),r=n.getChildren();for(let o=0;o<e.length;++o){const l=r[o];if(!l)continue;nt(l)||ee(254,l.constructor.name,l.getType());const a=e[o].reduce((c,u)=>u?1+c:c,0);if(a!==t)for(let c=a;c<t;++c){const u=Ht();u.append(H()),l.append(u)}}const i=n.getColWidths(),s=n.getColumnCount();if(i&&i.length!==s){let o;if(s<i.length)o=i.slice(0,s);else if(i.length>0){const l=i[i.length-1];o=[...i,...Array(s-i.length).fill(l)]}n.setColWidths(o)}}function Dx(n){if(n.detail<3||!jn(n.target))return!1;const e=gt(n.target);if(e===null)return!1;const t=le(e,r=>A(r)&&!r.isInline());return t===null?!1:!!ge(t.getParent())&&(t.select(0),!0)}function Lx(){const n=O();if(!N(n))return!1;const e=oc(n.anchor.getNode());if(e===null)return!1;const t=fe();if(!t.is(e.getParent())||t.getChildrenSize()!==1)return!1;const[r]=ln(e,null,null);if(r.length===0||r[0].length===0)return!1;const i=r[0][0];if(!i||!i.cell)return!1;const s=r[r.length-1],o=s[s.length-1];if(!o||!o.cell)return!1;const l=kx(e,i.cell,o.cell);return Fe(l),!0}function vf(n,e){n.hasNodes([yr])||ee(255);const{hasNestedTables:t=bp(!1)}=e??{};return pt(n.registerCommand(Ts,r=>(function({rows:i,columns:s,includeHeaders:o},l){const a=O()||bn();if(!a||!N(a)||!l&&oc(a.anchor.getNode()))return!1;const c=yx(Number(i),Number(s),o);Ab(c);const u=c.getFirstDescendant();return D(u)&&u.select(),!0})(r,t.peek()),B),n.registerCommand(Nc,(r,i)=>{if(n!==i)return!1;if((function(l){const{nodes:a,selection:c}=l,u=c.getStartEndPoints(),d=Mr(c),f=N(c),h=f&&le(c.anchor.getNode(),j=>ge(j))!==null&&le(c.focus.getNode(),j=>ge(j))!==null||d;if(a.length!==1||!Jt(a[0])||!h||u===null)return!1;const[g,p]=u,[m,b,_]=_t(g),y=le(p.getNode(),j=>ge(j));if(!(ge(m)&&ge(y)&&nt(b)&&Jt(_)))return!1;const S=a[0],[C,x,v]=Sn(_,m,y),[k]=ln(S,null,null),E=C.length,M=E>0?C[0].length:0;let T=x.startRow,I=x.startColumn,K=k.length,$=K>0?k[0].length:0;if(d){const j=Dp(C,x,v),pe=j.maxRow-j.minRow+1,oe=j.maxColumn-j.minColumn+1;T=j.minRow,I=j.minColumn,K=Math.min(K,pe),$=Math.min($,oe)}let R=!1;const W=Math.min(E,T+K)-1,Z=Math.min(M,I+$)-1,Y=new Set;for(let j=T;j<=W;j++)for(let pe=I;pe<=Z;pe++){const oe=C[j][pe];Y.has(oe.cell.getKey())||oe.cell.__rowSpan===1&&oe.cell.__colSpan===1||(vx(oe.cell),Y.add(oe.cell.getKey()),R=!0)}let[se]=ln(_.getWritable(),null,null);const Ke=K-E+T;for(let j=0;j<Ke;j++)ic(se[E-1][0].cell);const qe=$-M+I;for(let j=0;j<qe;j++)sc(se[0][M-1].cell,!0,!1);[se]=ln(_.getWritable(),null,null);for(let j=T;j<T+K;j++)for(let pe=I;pe<I+$;pe++){const oe=j-T,Ze=pe-I,Se=k[oe][Ze];if(Se.startRow!==oe||Se.startColumn!==Ze)continue;const We=Se.cell;if(We.__rowSpan!==1||We.__colSpan!==1){const Ce=[],wn=Math.min(j+We.__rowSpan,T+K)-1,Ti=Math.min(pe+We.__colSpan,I+$)-1;for(let Zt=j;Zt<=wn;Zt++)for(let Ni=pe;Ni<=Ti;Ni++){const Vl=se[Zt][Ni];Ce.push(Vl.cell)}Cx(Ce),R=!0}const{cell:Xe}=se[j][pe],bt=Xe.getChildren();We.getChildren().forEach(Ce=>{D(Ce)&&H().append(Ce),Xe.append(Ce)}),bt.forEach(Ce=>Ce.remove())}if(d&&R){const[j]=ln(_.getWritable(),null,null);j[x.startRow][x.startColumn].cell.selectEnd()}return!0})(r))return!0;const{selection:s,nodes:o}=r;return t.peek()||n!==i||!N(s)?!1:oc(s.anchor.getNode())!==null&&o.some(Jt)},B),n.registerCommand(Xr,Lx,G),n.registerCommand(br,Dx,B),n.registerNodeTransform(yr,Fx),n.registerNodeTransform(Si,Ix),n.registerNodeTransform(Or,$x))}const Rx=new Set(["http:","https:","mailto:","sms:","tel:"]);class $r extends xe{__url;__target;__rel;__title;static getType(){return"link"}static clone(e){return new $r(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e="",t={},r){super(r);const{target:i=null,rel:s=null,title:o=null}=t;this.__url=e,this.__target=i,this.__rel=s,this.__title=o}createDOM(e){const t=document.createElement("a");return this.updateLinkDOM(null,t,e),me(t,e.theme.link),t}updateLinkDOM(e,t,r){if(ru(t)){e&&e.__url===this.__url||(t.href=this.sanitizeUrl(this.__url));for(const i of["target","rel","title"]){const s=`__${i}`,o=this[s];e&&e[s]===o||(o?t[i]=o:t.removeAttribute(i))}}}updateDOM(e,t,r){return this.updateLinkDOM(e,t,r),!1}static importDOM(){return{a:e=>({conversion:Px,priority:1})}}static importJSON(e){return rr().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setURL(e.url).setRel(e.rel||null).setTarget(e.target||null).setTitle(e.title||null)}sanitizeUrl(e){e=Tf(e);try{const t=new URL(Tf(e));if(!Rx.has(t.protocol))return"about:blank"}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(e){const t=this.getWritable();return t.__url=e,t}getTarget(){return this.getLatest().__target}setTarget(e){const t=this.getWritable();return t.__target=e,t}getRel(){return this.getLatest().__rel}setRel(e){const t=this.getWritable();return t.__rel=e,t}getTitle(){return this.getLatest().__title}setTitle(e){const t=this.getWritable();return t.__title=e,t}insertNewAfter(e,t=!0){const r=rr(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(r,t),r}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,r){if(!N(t))return!1;const i=t.anchor.getNode(),s=t.focus.getNode();return this.isParentOf(i)&&this.isParentOf(s)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function Px(n){let e=null;if(ru(n)){const t=n.textContent;(t!==null&&t!==""||n.children.length>0)&&(e=rr(n.getAttribute("href")||"",{rel:n.getAttribute("rel"),target:n.getAttribute("target"),title:n.getAttribute("title")}))}return{node:e}}function rr(n="",e){return Le(new $r(n,e))}function vn(n){return n instanceof $r}let bu=class Pp extends $r{__isUnlinked;constructor(e="",t={},r){super(e,t,r),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}static getType(){return"autolink"}static clone(e){return new Pp(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,r){return super.updateDOM(e,t,r)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return Ef().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,t=!0){const r=this.getParentOrThrow().insertNewAfter(e,t);if(A(r)){const i=Ef(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return r.append(i),i}return null}};function Ef(n="",e){return Le(new bu(n,e))}function Ri(n){return n instanceof bu}const lc=z("TOGGLE_LINK_COMMAND");function kf(n,e){if(n.type==="element"){const t=n.getNode();return A(t)||(function(r,...i){const s=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",r);for(const l of i)o.append("v",l);throw s.search=o.toString(),Error(`Minified Lexical error #${r}; visit ${s.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(252),t.getChildren()[n.offset+e]||null}return null}function Bx(n,e={}){let t;if(n&&typeof n=="object"){const{url:u,...d}=n;t=u,e={...d,...e}}else t=n;const{target:r,title:i}=e,s=e.rel===void 0?"noreferrer":e.rel,o=O();if(o===null||!N(o)&&!je(o))return;if(je(o)){const u=o.getNodes();return u.length===0?void 0:void u.forEach(d=>{if(t===null){const f=le(d,h=>!Ri(h)&&vn(h));f&&(f.insertBefore(d),f.getChildren().length===0&&f.remove())}else{const f=le(d,h=>!Ri(h)&&vn(h));if(f)f.setURL(t),r!==void 0&&f.setTarget(r),s!==void 0&&f.setRel(s);else{const h=rr(t,{rel:s,target:r});d.insertBefore(h),h.append(d)}}})}const l=o.extract();if(t===null){const u=new Set;return void l.forEach(d=>{const f=le(d,h=>!Ri(h)&&vn(h));if(f!==null){const h=f.getKey();if(u.has(h))return;(function(g,p){const m=new Set(p.filter(k=>g.isParentOf(k)).map(k=>k.getKey())),b=g.getChildren(),_=k=>m.has(k.getKey())||A(k)&&p.some(E=>g.isParentOf(E)&&k.isParentOf(E)),y=b.filter(_);if(y.length===b.length)return b.forEach(k=>g.insertBefore(k)),void g.remove();const S=b.findIndex(_),C=b.findLastIndex(_),x=S===0,v=C===b.length-1;if(x)y.forEach(k=>g.insertBefore(k));else if(v)for(let k=y.length-1;k>=0;k--)g.insertAfter(y[k]);else{for(let E=y.length-1;E>=0;E--)g.insertAfter(y[E]);const k=b.slice(C+1);if(k.length>0){const E=rr(g.getURL(),{rel:g.getRel(),target:g.getTarget(),title:g.getTitle()});y[y.length-1].insertAfter(E),k.forEach(M=>E.append(M))}}})(f,l),u.add(h)}})}const a=new Set,c=u=>{a.has(u.getKey())||(a.add(u.getKey()),u.setURL(t),r!==void 0&&u.setTarget(r),s!==void 0&&u.setRel(s),i!==void 0&&u.setTitle(i))};if(l.length===1){const u=l[0],d=le(u,vn);if(d!==null)return c(d)}(function(u){const d=O();if(!N(d))return u();const f=In(d),h=f.isBackward(),g=kf(f.anchor,h?-1:0),p=kf(f.focus,h?0:-1);if(u(),g||p){const m=O();if(N(m)){const b=m.clone();if(g){const _=g.getParent();_&&b.anchor.set(_.getKey(),g.getIndexWithinParent()+(h?1:0),"element")}if(p){const _=p.getParent();_&&b.focus.set(_.getKey(),p.getIndexWithinParent()+(h?0:1),"element")}Fe(In(b))}}})(()=>{let u=null;for(const d of l){if(!d.isAttached())continue;const f=le(d,vn);if(f){c(f);continue}if(A(d)){if(!d.isInline())continue;if(vn(d)){if(!(Ri(d)||u!==null&&u.getParentOrThrow().isParentOf(d))){c(d),u=d;continue}for(const g of d.getChildren())d.insertBefore(g);d.remove();continue}}const h=d.getPreviousSibling();vn(h)&&h.is(u)?h.append(d):(u=rr(t,{rel:s,target:r,title:i}),d.insertAfter(u),u.append(d))}})}const zx=/^\+?[0-9\s()-]{5,}$/;function Tf(n){return n.match(/^[a-z][a-z0-9+.-]*:/i)||n.match(/^[/#.]/)?n:n.includes("@")?`mailto:${n}`:zx.test(n)?`tel:${n}`:`https://${n}`}const ha=Bx;var ga={exports:{}},Nf;function Ux(){return Nf||(Nf=1,(function(n){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var t=(function(r){var i=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,s=0,o={},l={manual:r.Prism&&r.Prism.manual,disableWorkerMessageHandler:r.Prism&&r.Prism.disableWorkerMessageHandler,util:{encode:function _(y){return y instanceof a?new a(y.type,_(y.content),y.alias):Array.isArray(y)?y.map(_):y.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(_){return Object.prototype.toString.call(_).slice(8,-1)},objId:function(_){return _.__id||Object.defineProperty(_,"__id",{value:++s}),_.__id},clone:function _(y,S){S=S||{};var C,x;switch(l.util.type(y)){case"Object":if(x=l.util.objId(y),S[x])return S[x];C={},S[x]=C;for(var v in y)y.hasOwnProperty(v)&&(C[v]=_(y[v],S));return C;case"Array":return x=l.util.objId(y),S[x]?S[x]:(C=[],S[x]=C,y.forEach(function(k,E){C[E]=_(k,S)}),C);default:return y}},getLanguage:function(_){for(;_;){var y=i.exec(_.className);if(y)return y[1].toLowerCase();_=_.parentElement}return"none"},setLanguage:function(_,y){_.className=_.className.replace(RegExp(i,"gi"),""),_.classList.add("language-"+y)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(C){var _=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(C.stack)||[])[1];if(_){var y=document.getElementsByTagName("script");for(var S in y)if(y[S].src==_)return y[S]}return null}},isActive:function(_,y,S){for(var C="no-"+y;_;){var x=_.classList;if(x.contains(y))return!0;if(x.contains(C))return!1;_=_.parentElement}return!!S}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(_,y){var S=l.util.clone(l.languages[_]);for(var C in y)S[C]=y[C];return S},insertBefore:function(_,y,S,C){C=C||l.languages;var x=C[_],v={};for(var k in x)if(x.hasOwnProperty(k)){if(k==y)for(var E in S)S.hasOwnProperty(E)&&(v[E]=S[E]);S.hasOwnProperty(k)||(v[k]=x[k])}var M=C[_];return C[_]=v,l.languages.DFS(l.languages,function(T,I){I===M&&T!=_&&(this[T]=v)}),v},DFS:function _(y,S,C,x){x=x||{};var v=l.util.objId;for(var k in y)if(y.hasOwnProperty(k)){S.call(y,k,y[k],C||k);var E=y[k],M=l.util.type(E);M==="Object"&&!x[v(E)]?(x[v(E)]=!0,_(E,S,null,x)):M==="Array"&&!x[v(E)]&&(x[v(E)]=!0,_(E,S,k,x))}}},plugins:{},highlightAll:function(_,y){l.highlightAllUnder(document,_,y)},highlightAllUnder:function(_,y,S){var C={callback:S,container:_,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};l.hooks.run("before-highlightall",C),C.elements=Array.prototype.slice.apply(C.container.querySelectorAll(C.selector)),l.hooks.run("before-all-elements-highlight",C);for(var x=0,v;v=C.elements[x++];)l.highlightElement(v,y===!0,C.callback)},highlightElement:function(_,y,S){var C=l.util.getLanguage(_),x=l.languages[C];l.util.setLanguage(_,C);var v=_.parentElement;v&&v.nodeName.toLowerCase()==="pre"&&l.util.setLanguage(v,C);var k=_.textContent,E={element:_,language:C,grammar:x,code:k};function M(I){E.highlightedCode=I,l.hooks.run("before-insert",E),E.element.innerHTML=E.highlightedCode,l.hooks.run("after-highlight",E),l.hooks.run("complete",E),S&&S.call(E.element)}if(l.hooks.run("before-sanity-check",E),v=E.element.parentElement,v&&v.nodeName.toLowerCase()==="pre"&&!v.hasAttribute("tabindex")&&v.setAttribute("tabindex","0"),!E.code){l.hooks.run("complete",E),S&&S.call(E.element);return}if(l.hooks.run("before-highlight",E),!E.grammar){M(l.util.encode(E.code));return}if(y&&r.Worker){var T=new Worker(l.filename);T.onmessage=function(I){M(I.data)},T.postMessage(JSON.stringify({language:E.language,code:E.code,immediateClose:!0}))}else M(l.highlight(E.code,E.grammar,E.language))},highlight:function(_,y,S){var C={code:_,grammar:y,language:S};if(l.hooks.run("before-tokenize",C),!C.grammar)throw new Error('The language "'+C.language+'" has no grammar.');return C.tokens=l.tokenize(C.code,C.grammar),l.hooks.run("after-tokenize",C),a.stringify(l.util.encode(C.tokens),C.language)},tokenize:function(_,y){var S=y.rest;if(S){for(var C in S)y[C]=S[C];delete y.rest}var x=new d;return f(x,x.head,_),u(_,x,y,x.head,0),g(x)},hooks:{all:{},add:function(_,y){var S=l.hooks.all;S[_]=S[_]||[],S[_].push(y)},run:function(_,y){var S=l.hooks.all[_];if(!(!S||!S.length))for(var C=0,x;x=S[C++];)x(y)}},Token:a};r.Prism=l;function a(_,y,S,C){this.type=_,this.content=y,this.alias=S,this.length=(C||"").length|0}a.stringify=function _(y,S){if(typeof y=="string")return y;if(Array.isArray(y)){var C="";return y.forEach(function(M){C+=_(M,S)}),C}var x={type:y.type,content:_(y.content,S),tag:"span",classes:["token",y.type],attributes:{},language:S},v=y.alias;v&&(Array.isArray(v)?Array.prototype.push.apply(x.classes,v):x.classes.push(v)),l.hooks.run("wrap",x);var k="";for(var E in x.attributes)k+=" "+E+'="'+(x.attributes[E]||"").replace(/"/g,"&quot;")+'"';return"<"+x.tag+' class="'+x.classes.join(" ")+'"'+k+">"+x.content+"</"+x.tag+">"};function c(_,y,S,C){_.lastIndex=y;var x=_.exec(S);if(x&&C&&x[1]){var v=x[1].length;x.index+=v,x[0]=x[0].slice(v)}return x}function u(_,y,S,C,x,v){for(var k in S)if(!(!S.hasOwnProperty(k)||!S[k])){var E=S[k];E=Array.isArray(E)?E:[E];for(var M=0;M<E.length;++M){if(v&&v.cause==k+","+M)return;var T=E[M],I=T.inside,K=!!T.lookbehind,$=!!T.greedy,R=T.alias;if($&&!T.pattern.global){var W=T.pattern.toString().match(/[imsuy]*$/)[0];T.pattern=RegExp(T.pattern.source,W+"g")}for(var Z=T.pattern||T,Y=C.next,se=x;Y!==y.tail&&!(v&&se>=v.reach);se+=Y.value.length,Y=Y.next){var Ke=Y.value;if(y.length>_.length)return;if(!(Ke instanceof a)){var qe=1,j;if($){if(j=c(Z,se,_,K),!j||j.index>=_.length)break;var Se=j.index,pe=j.index+j[0].length,oe=se;for(oe+=Y.value.length;Se>=oe;)Y=Y.next,oe+=Y.value.length;if(oe-=Y.value.length,se=oe,Y.value instanceof a)continue;for(var Ze=Y;Ze!==y.tail&&(oe<pe||typeof Ze.value=="string");Ze=Ze.next)qe++,oe+=Ze.value.length;qe--,Ke=_.slice(se,oe),j.index-=se}else if(j=c(Z,0,Ke,K),!j)continue;var Se=j.index,We=j[0],Xe=Ke.slice(0,Se),bt=Ke.slice(Se+We.length),Ce=se+Ke.length;v&&Ce>v.reach&&(v.reach=Ce);var wn=Y.prev;Xe&&(wn=f(y,wn,Xe),se+=Xe.length),h(y,wn,qe);var Ti=new a(k,I?l.tokenize(We,I):We,R,We);if(Y=f(y,wn,Ti),bt&&f(y,Y,bt),qe>1){var Zt={cause:k+","+M,reach:Ce};u(_,y,S,Y.prev,se,Zt),v&&Zt.reach>v.reach&&(v.reach=Zt.reach)}}}}}}function d(){var _={value:null,prev:null,next:null},y={value:null,prev:_,next:null};_.next=y,this.head=_,this.tail=y,this.length=0}function f(_,y,S){var C=y.next,x={value:S,prev:y,next:C};return y.next=x,C.prev=x,_.length++,x}function h(_,y,S){for(var C=y.next,x=0;x<S&&C!==_.tail;x++)C=C.next;y.next=C,C.prev=y,_.length-=x}function g(_){for(var y=[],S=_.head.next;S!==_.tail;)y.push(S.value),S=S.next;return y}if(!r.document)return r.addEventListener&&(l.disableWorkerMessageHandler||r.addEventListener("message",function(_){var y=JSON.parse(_.data),S=y.language,C=y.code,x=y.immediateClose;r.postMessage(l.highlight(C,l.languages[S],S)),x&&r.close()},!1)),l;var p=l.util.currentScript();p&&(l.filename=p.src,p.hasAttribute("data-manual")&&(l.manual=!0));function m(){l.manual||l.highlightAll()}if(!l.manual){var b=document.readyState;b==="loading"||b==="interactive"&&p&&p.defer?document.addEventListener("DOMContentLoaded",m):window.requestAnimationFrame?window.requestAnimationFrame(m):window.setTimeout(m,16)}return l})(e);n.exports&&(n.exports=t),typeof Yu.commonjsGlobal<"u"&&(Yu.commonjsGlobal.Prism=t),t.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},t.languages.markup.tag.inside["attr-value"].inside.entity=t.languages.markup.entity,t.languages.markup.doctype.inside["internal-subset"].inside=t.languages.markup,t.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.replace(/&amp;/,"&"))}),Object.defineProperty(t.languages.markup.tag,"addInlined",{value:function(i,s){var o={};o["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:t.languages[s]},o.cdata=/^<!\[CDATA\[|\]\]>$/i;var l={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:o}};l["language-"+s]={pattern:/[\s\S]+/,inside:t.languages[s]};var a={};a[i]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:l},t.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(t.languages.markup.tag,"addAttribute",{value:function(r,i){t.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[i,"language-"+i],inside:t.languages[i]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),t.languages.html=t.languages.markup,t.languages.mathml=t.languages.markup,t.languages.svg=t.languages.markup,t.languages.xml=t.languages.extend("markup",{}),t.languages.ssml=t.languages.xml,t.languages.atom=t.languages.xml,t.languages.rss=t.languages.xml,(function(r){var i=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;r.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+i.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+i.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+i.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+i.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:i,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},r.languages.css.atrule.inside.rest=r.languages.css;var s=r.languages.markup;s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))})(t),t.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},t.languages.javascript=t.languages.extend("clike",{"class-name":[t.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),t.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,t.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:t.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:t.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:t.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:t.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:t.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),t.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:t.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),t.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),t.languages.markup&&(t.languages.markup.tag.addInlined("script","javascript"),t.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),t.languages.js=t.languages.javascript,(function(){if(typeof t>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var r="Loading…",i=function(p,m){return"✖ Error "+p+" while fetching file: "+m},s="✖ Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},l="data-src-status",a="loading",c="loaded",u="failed",d="pre[data-src]:not(["+l+'="'+c+'"]):not(['+l+'="'+a+'"])';function f(p,m,b){var _=new XMLHttpRequest;_.open("GET",p,!0),_.onreadystatechange=function(){_.readyState==4&&(_.status<400&&_.responseText?m(_.responseText):_.status>=400?b(i(_.status,_.statusText)):b(s))},_.send(null)}function h(p){var m=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(p||"");if(m){var b=Number(m[1]),_=m[2],y=m[3];return _?y?[b,Number(y)]:[b,void 0]:[b,b]}}t.hooks.add("before-highlightall",function(p){p.selector+=", "+d}),t.hooks.add("before-sanity-check",function(p){var m=p.element;if(m.matches(d)){p.code="",m.setAttribute(l,a);var b=m.appendChild(document.createElement("CODE"));b.textContent=r;var _=m.getAttribute("data-src"),y=p.language;if(y==="none"){var S=(/\.(\w+)$/.exec(_)||[,"none"])[1];y=o[S]||S}t.util.setLanguage(b,y),t.util.setLanguage(m,y);var C=t.plugins.autoloader;C&&C.loadLanguages(y),f(_,function(x){m.setAttribute(l,c);var v=h(m.getAttribute("data-range"));if(v){var k=x.split(/\r\n?|\n/g),E=v[0],M=v[1]==null?k.length:v[1];E<0&&(E+=k.length),E=Math.max(0,Math.min(E-1,k.length)),M<0&&(M+=k.length),M=Math.max(0,Math.min(M,k.length)),x=k.slice(E,M).join(`
22
15
  `),m.hasAttribute("data-start")||m.setAttribute("data-start",String(E+1))}b.textContent=x,t.highlightElement(b)},function(x){m.setAttribute(l,u),b.textContent=x})}}),t.plugins.fileHighlight={highlight:function(m){for(var b=(m||document).querySelectorAll(d),_=0,y;y=b[_++];)t.highlightElement(y)}};var g=!1;t.fileHighlight=function(){g||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),g=!0),t.plugins.fileHighlight.highlight.apply(this,arguments)}})()})(ga)),ga.exports}Ux();Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;Prism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity;Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup;Prism.hooks.add("wrap",function(n){n.type==="entity"&&(n.attributes.title=n.content.replace(/&amp;/,"&"))});Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,t){var r={};r["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[t]},r.cdata=/^<!\[CDATA\[|\]\]>$/i;var i={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:r}};i["language-"+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};var s={};s[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:i},Prism.languages.insertBefore("markup","cdata",s)}});Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(n,e){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+n+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:Prism.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});Prism.languages.html=Prism.languages.markup;Prism.languages.mathml=Prism.languages.markup;Prism.languages.svg=Prism.languages.markup;Prism.languages.xml=Prism.languages.extend("markup",{});Prism.languages.ssml=Prism.languages.xml;Prism.languages.atom=Prism.languages.xml;Prism.languages.rss=Prism.languages.xml;(function(n){var e=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function t(u){return u=u.replace(/<inner>/g,function(){return e}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+u+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,i=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return r}),s=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;n.languages.markdown=n.languages.extend("markup",{}),n.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:n.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+i+s+"(?:"+i+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+i+s+")(?:"+i+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:n.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+i+")"+s+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+i+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:n.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:t(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:t(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:t(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:t(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(u){["url","bold","italic","strike","code-snippet"].forEach(function(d){u!==d&&(n.languages.markdown[u].inside.content.inside[d]=n.languages.markdown[d])})}),n.hooks.add("after-tokenize",function(u){if(u.language!=="markdown"&&u.language!=="md")return;function d(f){if(!(!f||typeof f=="string"))for(var h=0,g=f.length;h<g;h++){var p=f[h];if(p.type!=="code"){d(p.content);continue}var m=p.content[1],b=p.content[3];if(m&&b&&m.type==="code-language"&&b.type==="code-block"&&typeof m.content=="string"){var _=m.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");_=(/[a-z][\w-]*/i.exec(_)||[""])[0].toLowerCase();var y="language-"+_;b.alias?typeof b.alias=="string"?b.alias=[b.alias,y]:b.alias.push(y):b.alias=[y]}}}d(u.tokens)}),n.hooks.add("wrap",function(u){if(u.type==="code-block"){for(var d="",f=0,h=u.classes.length;f<h;f++){var g=u.classes[f],p=/language-(.+)/.exec(g);if(p){d=p[1];break}}var m=n.languages[d];if(m)u.content=n.highlight(c(u.content),m,d);else if(d&&d!=="none"&&n.plugins.autoloader){var b="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);u.attributes.id=b,n.plugins.autoloader.loadLanguages(d,function(){var _=document.getElementById(b);_&&(_.innerHTML=n.highlight(_.textContent,n.languages[d],d))})}}});var o=RegExp(n.languages.markup.tag.pattern.source,"gi"),l={amp:"&",lt:"<",gt:">",quot:'"'},a=String.fromCodePoint||String.fromCharCode;function c(u){var d=u.replace(o,"");return d=d.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(f,h){if(h=h.toLowerCase(),h[0]==="#"){var g;return h[1]==="x"?g=parseInt(h.slice(2),16):g=Number(h.slice(1)),a(g)}else{var p=l[h];return p||f}}),d}n.languages.md=n.languages.markdown})(Prism);Prism.languages.c=Prism.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/});Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}});Prism.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}}});Prism.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/});delete Prism.languages.c.boolean;(function(n){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;n.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},n.languages.css.atrule.inside.rest=n.languages.css;var t=n.languages.markup;t&&(t.tag.addInlined("style","css"),t.tag.addAttribute("style","css"))})(Prism);Prism.languages.objectivec=Prism.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/});delete Prism.languages.objectivec["class-name"];Prism.languages.objc=Prism.languages.objectivec;Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};(function(n){var e=n.languages.powershell={comment:[{pattern:/(^|[^`])<#[\s\S]*?#>/,lookbehind:!0},{pattern:/(^|[^`])#.*/,lookbehind:!0}],string:[{pattern:/"(?:`[\s\S]|[^`"])*"/,greedy:!0,inside:null},{pattern:/'(?:[^']|'')*'/,greedy:!0}],namespace:/\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i,boolean:/\$(?:false|true)\b/i,variable:/\$\w+\b/,function:[/\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i,/\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i],keyword:/\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,operator:{pattern:/(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,lookbehind:!0},punctuation:/[|{}[\];(),.]/};e.string[0].inside={function:{pattern:/(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,lookbehind:!0,inside:e},boolean:e.boolean,variable:e.variable}})(Prism);var Af={},Of;function Kx(){return Of||(Of=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),Af}Kx();var Mf={},$f;function Wx(){return $f||($f=1,(function(n){for(var e=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,t=0;t<2;t++)e=e.replace(/<self>/g,function(){return e});e=e.replace(/<self>/g,function(){return/[^\s\S]/.source}),n.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+e),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},n.languages.rust["closure-params"].inside.rest=n.languages.rust,n.languages.rust.attribute.inside.string=n.languages.rust.string})(Prism)),Mf}Wx();Prism.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+(/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+")+"|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/};Prism.languages.swift["string-literal"].forEach(function(n){n.inside.interpolation.inside=Prism.languages.swift});var If={},Ff;function jx(){return Ff||(Ff=1,(function(n){n.languages.typescript=n.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),n.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete n.languages.typescript.parameter,delete n.languages.typescript["literal-property"];var e=n.languages.extend("typescript",{});delete e["class-name"],n.languages.typescript["class-name"].inside=e,n.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e}}}}),n.languages.ts=n.languages.typescript})(Prism)),If}jx();var Df={},Lf;function Hx(){return Lf||(Lf=1,(function(n){var e=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,t=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,r={pattern:RegExp(/(^|[^\w.])/.source+t+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};n.languages.java=n.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[r,{pattern:RegExp(/(^|[^\w.])/.source+t+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:r.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+t+/[A-Z]\w*\b/.source),lookbehind:!0,inside:r.inside}],keyword:e,function:[n.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),n.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),n.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":r,keyword:e,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+t+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:r.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+t+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:r.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return e.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism)),Df}Hx();var Rf={},Pf;function Jx(){return Pf||(Pf=1,(function(n){var e=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,t=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return e.source});n.languages.cpp=n.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return e.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:e,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),n.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return t})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),n.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:n.languages.cpp}}}}),n.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),n.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:n.languages.extend("cpp",{})}}),n.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},n.languages.cpp["base-clause"])})(Prism)),Rf}Jx();function Sl(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const Gx="javascript";function Bp(n,e){for(const t of n.childNodes){if(re(t)&&t.tagName===e)return!0;Bp(t,e)}return!1}const Pi="data-language",$i="data-highlight-language",js="data-theme";let ir=class zp extends xe{__language;__theme;__isSyntaxHighlightSupported;static getType(){return"code"}static clone(e){return new zp(e.__language,e.__key)}constructor(e,t){super(t),this.__language=e||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}afterCloneFrom(e){super.afterCloneFrom(e),this.__language=e.__language,this.__theme=e.__theme,this.__isSyntaxHighlightSupported=e.__isSyntaxHighlightSupported}createDOM(e){const t=document.createElement("code");me(t,e.theme.code),t.setAttribute("spellcheck","false");const r=this.getLanguage();r&&(t.setAttribute(Pi,r),this.getIsSyntaxHighlightSupported()&&t.setAttribute($i,r));const i=this.getTheme();i&&t.setAttribute(js,i);const s=this.getStyle();return s&&t.setAttribute("style",s),t}updateDOM(e,t,r){const i=this.__language,s=e.__language;i?i!==s&&t.setAttribute(Pi,i):s&&t.removeAttribute(Pi);const o=this.__isSyntaxHighlightSupported;e.__isSyntaxHighlightSupported&&s?o&&i?i!==s&&t.setAttribute($i,i):t.removeAttribute($i):o&&i&&t.setAttribute($i,i);const l=this.__theme,a=e.__theme;l?l!==a&&t.setAttribute(js,l):a&&t.removeAttribute(js);const c=this.__style,u=e.__style;return c?c!==u&&t.setAttribute("style",c):u&&t.removeAttribute("style"),!1}exportDOM(e){const t=document.createElement("pre");me(t,e._config.theme.code),t.setAttribute("spellcheck","false");const r=this.getLanguage();r&&(t.setAttribute(Pi,r),this.getIsSyntaxHighlightSupported()&&t.setAttribute($i,r));const i=this.getTheme();i&&t.setAttribute(js,i);const s=this.getStyle();return s&&t.setAttribute("style",s),{element:t}}static importDOM(){return{code:e=>e.textContent!=null&&(/\r?\n/.test(e.textContent)||Bp(e,"BR"))?{conversion:Bf,priority:1}:null,div:()=>({conversion:Vx,priority:1}),pre:()=>({conversion:Bf,priority:0}),table:e=>pa(e)?{conversion:Yx,priority:3}:null,td:e=>{const t=e,r=t.closest("table");return t.classList.contains("js-file-line")||r&&pa(r)?{conversion:zf,priority:3}:null},tr:e=>{const t=e.closest("table");return t&&pa(t)?{conversion:zf,priority:3}:null}}}static importJSON(e){return St().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language).setTheme(e.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(e,t=!0){const r=this.getChildren(),i=r.length;if(i>=2&&r[i-1].getTextContent()===`
23
16
  `&&r[i-2].getTextContent()===`
24
17
  `&&e.isCollapsed()&&e.anchor.key===this.__key&&e.anchor.offset===i){r[i-1].remove(),r[i-2].remove();const a=H();return this.insertAfter(a,t),a}const{anchor:s,focus:o}=e,l=(s.isBefore(o)?s:o).getNode();if(D(l)){let a=sr(l);const c=[];for(;;)if(He(a))c.push(Ct()),a=a.getNextSibling();else{if(!we(a))break;{let m=0;const b=a.getTextContent(),_=a.getTextContentSize();for(;m<_&&b[m]===" ";)m++;if(m!==0&&c.push(xu(" ".repeat(m))),m!==_)break;a=a.getNextSibling()}}const u=l.splitText(s.offset)[0],d=s.offset===0?0:1,f=u.getIndexWithinParent()+d,h=l.getParentOrThrow(),g=[lt(),...c];h.splice(f,0,g);const p=c[c.length-1];p?p.select():s.offset===0?u.selectPrevious():u.getNextSibling().selectNext(0,0)}if(It(l)){const{offset:a}=e.anchor;l.splice(a,0,[lt()]),l.select(a+1,a+1)}return null}canIndent(){return!1}collapseAtStart(){const e=H();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}setLanguage(e){const t=this.getWritable();return t.__language=e||void 0,t}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(e){const t=this.getWritable();return t.__isSyntaxHighlightSupported=e,t}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(e){const t=this.getWritable();return t.__theme=e||void 0,t}getTheme(){return this.getLatest().__theme}};function St(n,e){return Hg(ir).setLanguage(n).setTheme(e)}function It(n){return n instanceof ir}function Bf(n){return{node:St(n.getAttribute(Pi))}}function Vx(n){const e=n,t=Uf(e);return t||(function(r){let i=r.parentElement;for(;i!==null;){if(Uf(i))return!0;i=i.parentElement}return!1})(e)?{node:t?St():null}:{node:null}}function Yx(){return{node:St()}}function zf(){return{node:null}}function Uf(n){return n.style.fontFamily.match("monospace")!==null}function pa(n){return n.classList.contains("js-file-line-container")}let ls=class Up extends Ye{__highlightType;constructor(e="",t,r){super(e,r),this.__highlightType=t}static getType(){return"code-highlight"}static clone(e){return new Up(e.__text,e.__highlightType||void 0,e.__key)}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){const t=this.getWritable();return t.__highlightType=e||void 0,t}canHaveFormat(){return!1}createDOM(e){const t=super.createDOM(e),r=ma(e.theme,this.__highlightType);return me(t,r),t}updateDOM(e,t,r){const i=super.updateDOM(e,t,r),s=ma(r.theme,e.__highlightType),o=ma(r.theme,this.__highlightType);return s!==o&&(s&&un(t,s),o&&me(t,o)),i}static importJSON(e){return xu().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHighlightType(e.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(e){return this}isParentRequired(){return!0}createParentElementNode(){return St()}};function ma(n,e){return e&&n&&n.codeHighlight&&n.codeHighlight[e]}function xu(n="",e){return Le(new ls(n,e))}function we(n){return n instanceof ls}function Kp(n,e){let t=n;for(let r=ye(n,e);r&&(we(r.origin)||He(r.origin));r=kb(r))t=r.origin;return t}function sr(n){return Kp(n,"previous")}function Yr(n){return Kp(n,"next")}function qx(n){const e=sr(n),t=Yr(n);let r=e;for(;r!==null;){if(we(r)){const s=Ng(r.getTextContent());if(s!==null)return s}if(r===t)break;r=r.getNextSibling()}const i=e.getParent();if(A(i)){const s=i.getDirection();if(s==="ltr"||s==="rtl")return s}return null}function Zx(n,e){let t=null,r=null,i=n,s=e,o=n.getTextContent();for(;;){if(s===0){if(i=i.getPreviousSibling(),i===null)break;if(we(i)||He(i)||ue(i)||Sl(167),ue(i)){t={node:i,offset:1};break}s=Math.max(0,i.getTextContentSize()-1),o=i.getTextContent()}else s--;const a=o[s];we(i)&&a!==" "&&(r={node:i,offset:s})}if(r!==null)return r;let l=null;if(e<n.getTextContentSize())we(n)&&(l=n.getTextContent()[e]);else{const a=n.getNextSibling();we(a)&&(l=a.getTextContent()[0])}if(l!==null&&l!==" ")return t;{const a=(function(c,u){let d=c,f=u,h=c.getTextContent(),g=c.getTextContentSize();for(;;){if(!we(d)||f===g){if(d=d.getNextSibling(),d===null||ue(d))return null;we(d)&&(f=0,h=d.getTextContent(),g=d.getTextContentSize())}if(we(d)){if(h[f]!==" ")return{node:d,offset:f};f++}}})(n,e);return a!==null?a:t}}function Xx(n){const e=Yr(n);return ue(e)&&Sl(168),e}(function(n){n.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var e={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(e).forEach(function(t){var r=e[t],i=[];/^\w+$/.test(t)||i.push(/\w+/.exec(t)[0]),t==="diff"&&i.push("bold"),n.languages.diff[t]={pattern:RegExp("^(?:["+r+`].*(?:\r
@@ -41,6 +34,6 @@
41
34
  `.concat(p):p)}return d.join(`
42
35
  `)}})(n,t)(e)}function im(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}class sm{_offsetMap;_firstNode;_blockOffsetSize;constructor(e,t,r=1){this._offsetMap=e,this._firstNode=t,this._blockOffsetSize=r}createSelectionFromOffsets(e,t,r){const i=this._firstNode;if(i===null)return null;let s=e,o=t,l=zi(i,s,this._blockOffsetSize),a=zi(i,o,this._blockOffsetSize);if(r!==void 0&&(s=ih(s,l,r,this,this._blockOffsetSize),l=zi(i,s,this._blockOffsetSize),o=ih(o,a,r,this,this._blockOffsetSize),a=zi(i,o,this._blockOffsetSize)),l===null||a===null)return null;let c=l.key,u=a.key;const d=q(c),f=q(u);if(d===null||f===null)return null;let h=0,g=0,p="element",m="element";if(l.type==="text"){h=s-l.start,p="text";const _=d.getNextSibling();s!==o&&h===d.getTextContentSize()&&D(_)&&(h=0,c=_.__key)}else l.type==="inline"&&(c=d.getParentOrThrow().getKey(),h=o>l.start?l.end:l.start);a.type==="text"?(g=o-a.start,m="text"):a.type==="inline"&&(u=f.getParentOrThrow().getKey(),g=o>a.start?a.end:a.start);const b=hi();return b===null?null:(b.anchor.set(c,h,p),b.focus.set(u,g,m),b)}getOffsetsFromSelection(e){const t=e.anchor,r=e.focus,i=this._offsetMap,s=t.offset,o=r.offset;let l=-1,a=-1;if(t.type==="text"){const c=i.get(t.key);c!==void 0&&(l=c.start+s)}else{const c=t.getNode().getDescendantByIndex(s);if(c!==null){const u=i.get(c.getKey());u!==void 0&&(l=c.getIndexWithinParent()!==s?u.end:u.start)}}if(r.type==="text"){const c=i.get(r.key);c!==void 0&&(a=c.start+r.offset)}else{const c=r.getNode().getDescendantByIndex(o);if(c!==null){const u=i.get(c.getKey());u!==void 0&&(a=c.getIndexWithinParent()!==o?u.end:u.start)}}return[l,a]}}function ih(n,e,t,r,i){const s=t._offsetMap,o=r._offsetMap,l=new Set;let a=n,c=e;for(;c!==null;){const d=c.key,f=s.get(d),h=c.end-c.start;if(l.add(d),f===void 0)a+=h;else{const m=f.end-f.start;m!==h&&(a+=h-m)}const g=c.prev;if(g!==null){c=g;continue}let p=c.parent;for(;p!==null;){let m=p.prev;if(m!==null){const b=m.key,_=s.get(b),y=m.end-m.start;if(l.add(b),_===void 0)a+=y;else{const S=_.end-_.start;S!==y&&(a+=y-S)}m=m.prev}p=p.parent}break}const u=t._firstNode;if(u!==null){c=zi(u,n,i);let d=!1;for(;c!==null;){if(!l.has(c.key)){d=!0;break}c=c.parent}if(!d)for(;c!==null;){const f=c.key;if(!l.has(f)){const h=o.get(f),g=c.end-c.start;if(h===void 0)a-=g;else{const p=h.end-h.start;g!==p&&(a+=p-g)}}c=c.prev}}return a}function zi(n,e,t){let r=n;for(;r!==null;){if(e<r.end+(r.type!=="element"||t===0?1:0)){const s=r.child;if(s!==null){r=s;continue}return r}const i=r.next;if(i===null)break;r=i}return null}function sh(n,e,t,r,i,s){return{child:n,end:r,key:i,next:null,parent:s,prev:null,start:t,type:e}}function ZS(n,e,t,r,i,s){const o=r.get(e);o===void 0&&im(3);const l=n.offset;if(A(o)){const d=or(o,r),f=d.length===0,h=f?null:om(n,d,null,r,i,s);n.prevIsBlock&&!f||(n.prevIsBlock=!0,n.offset+=s);const g=sh(h,"element",l,l,e,t);h!==null&&(h.parent=g);const p=n.offset;return g.end=p,i.set(e,g),g}n.prevIsBlock=!1;const a=D(o),c=a?o.__text.length:1,u=sh(null,a?"text":"inline",l,n.offset+=c,e,t);return i.set(e,u),u}function om(n,e,t,r,i,s){let o=null,l=null;const a=e.length;for(let c=0;c<a;c++){const u=ZS(n,e[c],t,r,i,s);l===null?o=u:(u.prev=l,l.next=u),l=u}return o}function or(n,e){const t=[];let r=n.__first;for(;r!==null;){const i=e===null?q(r):e.get(r);i==null&&im(174),t.push(r),r=i.__next}return t}const XS=or;function QS(n,e=1,t){const r=(t||n._pendingEditorState||n._editorState)._nodeMap,i=r.get("root"),s=new Map,o=om({offset:0,prevIsBlock:!1},or(i,r),null,r,s,e);return new sm(s,o,e)}const eC=Object.freeze(Object.defineProperty({__proto__:null,$createChildrenArray:or,$createOffsetView:QS,OffsetView:sm,createChildrenArray:XS},Symbol.toStringTag,{value:"Module"})),Gt=()=>new Map,pc=n=>{const e=Gt();return n.forEach((t,r)=>{e.set(r,t)}),e},Ci=(n,e,t)=>{let r=n.get(e);return r===void 0&&n.set(e,r=t()),r},tC=(n,e)=>{const t=[];for(const[r,i]of n)t.push(e(i,r));return t},nC=(n,e)=>{for(const[t,r]of n)if(e(r,t))return!0;return!1},ei=()=>new Set,ba=n=>n[n.length-1],ti=Array.from,vu=(n,e)=>{for(let t=0;t<n.length;t++)if(!e(n[t],t,n))return!1;return!0},lm=(n,e)=>{for(let t=0;t<n.length;t++)if(e(n[t],t,n))return!0;return!1},rC=(n,e)=>{const t=new Array(n);for(let r=0;r<n;r++)t[r]=e(r,t);return t},El=Array.isArray;class iC{constructor(){this._observers=Gt()}on(e,t){return Ci(this._observers,e,ei).add(t),t}once(e,t){const r=(...i)=>{this.off(e,r),t(...i)};this.on(e,r)}off(e,t){const r=this._observers.get(e);r!==void 0&&(r.delete(t),r.size===0&&this._observers.delete(e))}emit(e,t){return ti((this._observers.get(e)||Gt()).values()).forEach(r=>r(...t))}destroy(){this._observers=Gt()}}const gn=Math.floor,to=Math.abs,am=(n,e)=>n<e?n:e,wi=(n,e)=>n>e?n:e,sC=n=>n!==0?n<0:1/n<0,oh=1,lh=2,xa=4,Sa=8,oC=32,cm=64,Lo=128,lC=31,ah=63,Vi=127,aC=2147483647,ch=Number.MAX_SAFE_INTEGER,uh=Number.MIN_SAFE_INTEGER,cC=Number.isInteger||(n=>typeof n=="number"&&isFinite(n)&&gn(n)===n),uC=String.fromCharCode,dC=n=>n.toLowerCase(),fC=/^\s*/g,hC=n=>n.replace(fC,""),gC=/([A-Z])/g,dh=(n,e)=>hC(n.replace(gC,t=>`${e}${dC(t)}`)),pC=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,r=new Uint8Array(t);for(let i=0;i<t;i++)r[i]=e.codePointAt(i);return r},cs=typeof TextEncoder<"u"?new TextEncoder:null,mC=n=>cs.encode(n),_C=cs?mC:pC;let Ca=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Ca&&Ca.decode(new Uint8Array).length===1&&(Ca=null);const yC=(n,e)=>rC(e,()=>n).join("");class As{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const Eu=()=>new As,bC=n=>{let e=n.cpos;for(let t=0;t<n.bufs.length;t++)e+=n.bufs[t].length;return e},an=n=>{const e=new Uint8Array(bC(n));let t=0;for(let r=0;r<n.bufs.length;r++){const i=n.bufs[r];e.set(i,t),t+=i.length}return e.set(new Uint8Array(n.cbuf.buffer,0,n.cpos),t),e},xC=(n,e)=>{const t=n.cbuf.length;t-n.cpos<e&&(n.bufs.push(new Uint8Array(n.cbuf.buffer,0,n.cpos)),n.cbuf=new Uint8Array(wi(t,e)*2),n.cpos=0)},Ae=(n,e)=>{const t=n.cbuf.length;n.cpos===t&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(t*2),n.cpos=0),n.cbuf[n.cpos++]=e},mc=Ae,ce=(n,e)=>{for(;e>Vi;)Ae(n,Lo|Vi&e),e=gn(e/128);Ae(n,Vi&e)},ku=(n,e)=>{const t=sC(e);for(t&&(e=-e),Ae(n,(e>ah?Lo:0)|(t?cm:0)|ah&e),e=gn(e/64);e>0;)Ae(n,(e>Vi?Lo:0)|Vi&e),e=gn(e/128)},_c=new Uint8Array(3e4),SC=_c.length/3,CC=(n,e)=>{if(e.length<SC){const t=cs.encodeInto(e,_c).written||0;ce(n,t);for(let r=0;r<t;r++)Ae(n,_c[r])}else ut(n,_C(e))},wC=(n,e)=>{const t=unescape(encodeURIComponent(e)),r=t.length;ce(n,r);for(let i=0;i<r;i++)Ae(n,t.codePointAt(i))},qr=cs&&cs.encodeInto?CC:wC,Tu=(n,e)=>{const t=n.cbuf.length,r=n.cpos,i=am(t-r,e.length),s=e.length-i;n.cbuf.set(e.subarray(0,i),r),n.cpos+=i,s>0&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(wi(t*2,s)),n.cbuf.set(e.subarray(i)),n.cpos=s)},ut=(n,e)=>{ce(n,e.byteLength),Tu(n,e)},Nu=(n,e)=>{xC(n,e);const t=new DataView(n.cbuf.buffer,n.cpos,e);return n.cpos+=e,t},vC=(n,e)=>Nu(n,4).setFloat32(0,e,!1),EC=(n,e)=>Nu(n,8).setFloat64(0,e,!1),kC=(n,e)=>Nu(n,8).setBigInt64(0,e,!1),fh=new DataView(new ArrayBuffer(4)),TC=n=>(fh.setFloat32(0,n),fh.getFloat32(0)===n),us=(n,e)=>{switch(typeof e){case"string":Ae(n,119),qr(n,e);break;case"number":cC(e)&&to(e)<=aC?(Ae(n,125),ku(n,e)):TC(e)?(Ae(n,124),vC(n,e)):(Ae(n,123),EC(n,e));break;case"bigint":Ae(n,122),kC(n,e);break;case"object":if(e===null)Ae(n,126);else if(El(e)){Ae(n,117),ce(n,e.length);for(let t=0;t<e.length;t++)us(n,e[t])}else if(e instanceof Uint8Array)Ae(n,116),ut(n,e);else{Ae(n,118);const t=Object.keys(e);ce(n,t.length);for(let r=0;r<t.length;r++){const i=t[r];qr(n,i),us(n,e[i])}}break;case"boolean":Ae(n,e?120:121);break;default:Ae(n,127)}};class hh extends As{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&ce(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const gh=n=>{n.count>0&&(ku(n.encoder,n.count===1?n.s:-n.s),n.count>1&&ce(n.encoder,n.count-2))};class no{constructor(){this.encoder=new As,this.s=0,this.count=0}write(e){this.s===e?this.count++:(gh(this),this.count=1,this.s=e)}toUint8Array(){return gh(this),an(this.encoder)}}const ph=n=>{if(n.count>0){const e=n.diff*2+(n.count===1?0:1);ku(n.encoder,e),n.count>1&&ce(n.encoder,n.count-2)}};class wa{constructor(){this.encoder=new As,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(ph(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return ph(this),an(this.encoder)}}class NC{constructor(){this.sarr=[],this.s="",this.lensE=new no}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new As;return this.sarr.push(this.s),this.s="",qr(e,this.sarr.join("")),Tu(e,this.lensE.toUint8Array()),an(e)}}const Pn=n=>new Error(n),Ft=()=>{throw Pn("Method unimplemented")},pn=()=>{throw Pn("Unexpected case")},AC=crypto.getRandomValues.bind(crypto),um=()=>AC(new Uint32Array(1))[0],OC="10000000-1000-4000-8000"+-1e11,MC=()=>OC.replace(/[018]/g,n=>(n^um()&15>>n/4).toString(16)),mh=n=>new Promise(n);Promise.all.bind(Promise);const _h=n=>n===void 0?null:n;class $C{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}}let dm=new $C,IC=!0;try{typeof localStorage<"u"&&localStorage&&(dm=localStorage,IC=!1)}catch{}const FC=dm,ds=Symbol("Equality"),fm=(n,e)=>n===e||!!n?.[ds]?.(e)||!1,DC=n=>typeof n=="object",LC=Object.assign,RC=Object.keys,PC=(n,e)=>{for(const t in n)e(n[t],t)},Ro=n=>RC(n).length,BC=n=>{for(const e in n)return!1;return!0},Os=(n,e)=>{for(const t in n)if(!e(n[t],t))return!1;return!0},Au=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),zC=(n,e)=>n===e||Ro(n)===Ro(e)&&Os(n,(t,r)=>(t!==void 0||Au(e,r))&&fm(e[r],t)),UC=Object.freeze,hm=n=>{for(const e in n){const t=n[e];(typeof t=="object"||typeof t=="function")&&hm(n[e])}return UC(n)},Ou=(n,e,t=0)=>{try{for(;t<n.length;t++)n[t](...e)}finally{t<n.length&&Ou(n,e,t+1)}},ro=(n,e)=>{if(n===e)return!0;if(n==null||e==null||n.constructor!==e.constructor&&(n.constructor||Object)!==(e.constructor||Object))return!1;if(n[ds]!=null)return n[ds](e);switch(n.constructor){case ArrayBuffer:n=new Uint8Array(n),e=new Uint8Array(e);case Uint8Array:{if(n.byteLength!==e.byteLength)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;break}case Set:{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;break}case Map:{if(n.size!==e.size)return!1;for(const t of n.keys())if(!e.has(t)||!ro(n.get(t),e.get(t)))return!1;break}case void 0:case Object:if(Ro(n)!==Ro(e))return!1;for(const t in n)if(!Au(n,t)||!ro(n[t],e[t]))return!1;break;case Array:if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(!ro(n[t],e[t]))return!1;break;default:return!1}return!0},KC=(n,e)=>e.includes(n),fs=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";let Rt;const WC=()=>{if(Rt===void 0)if(fs){Rt=Gt();const n=process.argv;let e=null;for(let t=0;t<n.length;t++){const r=n[t];r[0]==="-"?(e!==null&&Rt.set(e,""),e=r):e!==null&&(Rt.set(e,r),e=null)}e!==null&&Rt.set(e,"")}else typeof location=="object"?(Rt=Gt(),(location.search||"?").slice(1).split("&").forEach(n=>{if(n.length!==0){const[e,t]=n.split("=");Rt.set(`--${dh(e,"-")}`,t),Rt.set(`-${dh(e,"-")}`,t)}})):Rt=Gt();return Rt},yc=n=>WC().has(n),Po=n=>_h(fs?process.env[n.toUpperCase().replaceAll("-","_")]:FC.getItem(n)),gm=n=>yc("--"+n)||Po(n)!==null,jC=gm("production"),HC=fs&&KC(process.env.FORCE_COLOR,["true","1","2"]),JC=HC||!yc("--no-colors")&&!gm("no-color")&&(!fs||process.stdout.isTTY)&&(!fs||yc("--color")||Po("COLORTERM")!==null||(Po("TERM")||"").includes("color"));class GC{constructor(e,t){this.left=e,this.right=t}}const en=(n,e)=>new GC(n,e),yh=n=>n.next()>=.5,va=(n,e,t)=>gn(n.next()*(t+1-e)+e),pm=(n,e,t)=>gn(n.next()*(t+1-e)+e),Mu=(n,e,t)=>pm(n,e,t),VC=n=>uC(Mu(n,97,122)),YC=(n,e=0,t=20)=>{const r=Mu(n,e,t);let i="";for(let s=0;s<r;s++)i+=VC(n);return i},Ea=(n,e)=>e[Mu(n,0,e.length-1)],qC=Symbol("0schema");class ZC{constructor(){this._rerrs=[]}extend(e,t,r,i=null){this._rerrs.push({path:e,expected:t,has:r,message:i})}toString(){const e=[];for(let t=this._rerrs.length-1;t>0;t--){const r=this._rerrs[t];e.push(yC(" ",(this._rerrs.length-t)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
43
36
  `)}}const bc=(n,e)=>n===e?!0:n==null||e==null||n.constructor!==e.constructor?!1:n[ds]?fm(n,e):El(n)?vu(n,t=>lm(e,r=>bc(t,r))):DC(n)?Os(n,(t,r)=>bc(t,e[r])):!1;class rt{static _dilutes=!1;extends(e){let[t,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,t]=[t,r]),bc(t,r)}equals(e){return this.constructor===e.constructor&&ro(this.shape,e.shape)}[qC](){return!0}[ds](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){Ft()}get nullable(){return vi(this,Ol)}get optional(){return new ym(this)}cast(e){return bh(e,this),e}expect(e){return bh(e,this),e}}class $u extends rt{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){const r=e?.constructor===this.shape&&(this._c==null||this._c(e));return!r&&t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?"Constructor match failed":"Check failed"),r}}const Ee=(n,e=null)=>new $u(n,e);Ee($u);class Iu extends rt{constructor(e){super(),this.shape=e}check(e,t){const r=this.shape(e);return!r&&t?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),r}}const Re=n=>new Iu(n);Ee(Iu);class kl extends rt{constructor(e){super(),this.shape=e}check(e,t){const r=this.shape.some(i=>i===e);return!r&&t?.extend(null,this.shape.join(" | "),e.toString()),r}}const Tl=(...n)=>new kl(n),mm=Ee(kl),XC=RegExp.escape||(n=>n.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),_m=n=>{if(ni.check(n))return[XC(n)];if(mm.check(n))return n.shape.map(e=>e+"");if(Tm.check(n))return["[+-]?\\d+.?\\d*"];if(Nm.check(n))return[".*"];if(Bo.check(n))return n.shape.map(_m).flat(1);pn()};class QC extends rt{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(_m).map(t=>`(${t.join("|")})`).join("")+"$")}check(e,t){const r=this._r.exec(e)!=null;return!r&&t?.extend(null,this._r.toString(),e.toString(),"String doesn't match string template."),r}}Ee(QC);const ew=Symbol("optional");class ym extends rt{constructor(e){super(),this.shape=e}check(e,t){const r=e===void 0||this.shape.check(e);return!r&&t?.extend(null,"undefined (optional)","()"),r}get[ew](){return!0}}const tw=Ee(ym);class nw extends rt{check(e,t){return t?.extend(null,"never",typeof e),!1}}Ee(nw);class Nl extends rt{constructor(e,t=!1){super(),this.shape=e,this._isPartial=t}static _dilutes=!0;get partial(){return new Nl(this.shape,!0)}check(e,t){return e==null?(t?.extend(null,"object","null"),!1):Os(this.shape,(r,i)=>{const s=this._isPartial&&!Au(e,i)||r.check(e[i],t);return!s&&t?.extend(i.toString(),r.toString(),typeof e[i],"Object property does not match"),s})}}const rw=n=>new Nl(n),iw=Ee(Nl),sw=Re(n=>n!=null&&(n.constructor===Object||n.constructor==null));class bm extends rt{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&Os(e,(r,i)=>{const s=this.shape.keys.check(i,t);return!s&&t?.extend(i+"","Record",typeof e,s?"Key doesn't match schema":"Value doesn't match value"),s&&this.shape.values.check(r,t)})}}const xm=(n,e)=>new bm(n,e),ow=Ee(bm);class Sm extends rt{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&Os(this.shape,(r,i)=>{const s=r.check(e[i],t);return!s&&t?.extend(i.toString(),"Tuple",typeof r),s})}}const lw=(...n)=>new Sm(n);Ee(Sm);class Cm extends rt{constructor(e){super(),this.shape=e.length===1?e[0]:new Fu(e)}check(e,t){const r=El(e)&&vu(e,i=>this.shape.check(i));return!r&&t?.extend(null,"Array",""),r}}const wm=(...n)=>new Cm(n),aw=Ee(Cm),cw=Re(n=>El(n));class vm extends rt{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){const r=e instanceof this.shape&&(this._c==null||this._c(e));return!r&&t?.extend(null,this.shape.name,e?.constructor.name),r}}const uw=(n,e=null)=>new vm(n,e);Ee(vm);const dw=uw(rt);class fw extends rt{constructor(e){super(),this.len=e.length-1,this.args=lw(...e.slice(-1)),this.res=e[this.len]}check(e,t){const r=e.constructor===Function&&e.length<=this.len;return!r&&t?.extend(null,"function",typeof e),r}}const hw=Ee(fw),gw=Re(n=>typeof n=="function");class pw extends rt{constructor(e){super(),this.shape=e}check(e,t){const r=vu(this.shape,i=>i.check(e,t));return!r&&t?.extend(null,"Intersectinon",typeof e),r}}Ee(pw,n=>n.shape.length>0);class Fu extends rt{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){const r=lm(this.shape,i=>i.check(e,t));return t?.extend(null,"Union",typeof e),r}}const vi=(...n)=>n.findIndex(e=>Bo.check(e))>=0?vi(...n.map(e=>hs(e)).map(e=>Bo.check(e)?e.shape:[e]).flat(1)):n.length===1?n[0]:new Fu(n),Bo=Ee(Fu),Em=()=>!0,zo=Re(Em),mw=Ee(Iu,n=>n.shape===Em),Du=Re(n=>typeof n=="bigint"),_w=Re(n=>n===Du),km=Re(n=>typeof n=="symbol");Re(n=>n===km);const Zr=Re(n=>typeof n=="number"),Tm=Re(n=>n===Zr),ni=Re(n=>typeof n=="string"),Nm=Re(n=>n===ni),Al=Re(n=>typeof n=="boolean"),yw=Re(n=>n===Al),Am=Tl(void 0);Ee(kl,n=>n.shape.length===1&&n.shape[0]===void 0);Tl(void 0);const Ol=Tl(null),bw=Ee(kl,n=>n.shape.length===1&&n.shape[0]===null);Ee(Uint8Array);Ee($u,n=>n.shape===Uint8Array);const xw=vi(Zr,ni,Ol,Am,Du,Al,km);(()=>{const n=wm(zo),e=xm(ni,zo),t=vi(Zr,ni,Ol,Al,n,e);return n.shape=t,e.shape.values=t,t})();const hs=n=>{if(dw.check(n))return n;if(sw.check(n)){const e={};for(const t in n)e[t]=hs(n[t]);return rw(e)}else{if(cw.check(n))return vi(...n.map(hs));if(xw.check(n))return Tl(n);if(gw.check(n))return Ee(n)}pn()},bh=jC?()=>{}:(n,e)=>{const t=new ZC;if(!e.check(n,t))throw Pn(`Expected value to be of type ${e.constructor.name}.
44
- ${t.toString()}`)};class Sw{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:hs(e),h:t}),this}else(e){return this.if(zo,e)}done(){return(e,t)=>{for(let r=0;r<this.patterns.length;r++){const i=this.patterns[r];if(i.if.check(e))return i.h(e,t)}throw Pn("Unhandled pattern")}}}const Cw=n=>new Sw(n),Om=Cw(zo).if(Tm,(n,e)=>va(e,uh,ch)).if(Nm,(n,e)=>YC(e)).if(yw,(n,e)=>yh(e)).if(_w,(n,e)=>BigInt(va(e,uh,ch))).if(Bo,(n,e)=>zr(e,Ea(e,n.shape))).if(iw,(n,e)=>{const t={};for(const r in n.shape){let i=n.shape[r];if(tw.check(i)){if(yh(e))continue;i=i.shape}t[r]=Om(i,e)}return t}).if(aw,(n,e)=>{const t=[],r=pm(e,0,42);for(let i=0;i<r;i++)t.push(zr(e,n.shape));return t}).if(mm,(n,e)=>Ea(e,n.shape)).if(bw,(n,e)=>null).if(hw,(n,e)=>{const t=zr(e,n.res);return()=>t}).if(mw,(n,e)=>zr(e,Ea(e,[Zr,ni,Ol,Am,Du,Al,wm(Zr),xm(vi("a","b","c"),Zr)]))).if(ow,(n,e)=>{const t={},r=va(e,0,3);for(let i=0;i<r;i++){const s=zr(e,n.shape.keys),o=zr(e,n.shape.values);t[s]=o}return t}).done(),zr=(n,e)=>Om(hs(e),n),Ml=typeof document<"u"?document:{};Re(n=>n.nodeType===Tw);typeof DOMParser<"u"&&new DOMParser;Re(n=>n.nodeType===vw);Re(n=>n.nodeType===Ew);const ww=n=>tC(n,(e,t)=>`${t}:${e};`).join(""),vw=Ml.ELEMENT_NODE,Ew=Ml.TEXT_NODE,kw=Ml.DOCUMENT_NODE,Tw=Ml.DOCUMENT_FRAGMENT_NODE;Re(n=>n.nodeType===kw);const Cn=Symbol,Mm=Cn(),$m=Cn(),Nw=Cn(),Aw=Cn(),Ow=Cn(),Im=Cn(),Mw=Cn(),Lu=Cn(),$w=Cn(),Iw=n=>{n.length===1&&n[0]?.constructor===Function&&(n=n[0]());const e=[],t=[];let r=0;for(;r<n.length;r++){const i=n[r];if(i===void 0)break;if(i.constructor===String||i.constructor===Number)e.push(i);else if(i.constructor===Object)break}for(r>0&&t.push(e.join(""));r<n.length;r++){const i=n[r];i instanceof Symbol||t.push(i)}return t},Fw={[Mm]:en("font-weight","bold"),[$m]:en("font-weight","normal"),[Nw]:en("color","blue"),[Ow]:en("color","green"),[Aw]:en("color","grey"),[Im]:en("color","red"),[Mw]:en("color","purple"),[Lu]:en("color","orange"),[$w]:en("color","black")},Dw=n=>{n.length===1&&n[0]?.constructor===Function&&(n=n[0]());const e=[],t=[],r=Gt();let i=[],s=0;for(;s<n.length;s++){const o=n[s],l=Fw[o];if(l!==void 0)r.set(l.left,l.right);else{if(o===void 0)break;if(o.constructor===String||o.constructor===Number){const a=ww(r);s>0||a.length>0?(e.push("%c"+o),t.push(a)):e.push(o)}else break}}for(s>0&&(i=t,i.unshift(e.join("")));s<n.length;s++){const o=n[s];o instanceof Symbol||i.push(o)}return i},Fm=JC?Dw:Iw,Lw=(...n)=>{console.log(...Fm(n)),Dm.forEach(e=>e.print(n))},Rw=(...n)=>{console.warn(...Fm(n)),n.unshift(Lu),Dm.forEach(e=>e.print(n))},Dm=ei(),Lm=n=>({[Symbol.iterator](){return this},next:n}),Pw=(n,e)=>Lm(()=>{let t;do t=n.next();while(!t.done&&!e(t.value));return t}),ka=(n,e)=>Lm(()=>{const{done:t,value:r}=n.next();return{done:t,value:t?void 0:e(r)}});class Bw{constructor(e,t){this.clock=e,this.len=t}}class zw{constructor(){this.clients=new Map}}const Rm=(n,e,t)=>e.clients.forEach((r,i)=>{const s=n.doc.store.clients.get(i);if(s!=null){const o=s[s.length-1],l=o.id.clock+o.length;for(let a=0,c=r[a];a<r.length&&c.clock<l;c=r[++a])jm(n,s,c.clock,c.len,t)}}),Uw=(n,e)=>{let t=0,r=n.length-1;for(;t<=r;){const i=gn((t+r)/2),s=n[i],o=s.clock;if(o<=e){if(e<o+s.len)return i;t=i+1}else r=i-1}return null},Pm=(n,e)=>{const t=n.clients.get(e.client);return t!==void 0&&Uw(t,e.clock)!==null},Bm=n=>{n.clients.forEach(e=>{e.sort((i,s)=>i.clock-s.clock);let t,r;for(t=1,r=1;t<e.length;t++){const i=e[r-1],s=e[t];i.clock+i.len>=s.clock?i.len=wi(i.len,s.clock+s.len-i.clock):(r<t&&(e[r]=s),r++)}e.length=r})},zm=(n,e,t,r)=>{Ci(n.clients,e,()=>[]).push(new Bw(t,r))},Kw=(n,e)=>{ce(n.restEncoder,e.clients.size),ti(e.clients.entries()).sort((t,r)=>r[0]-t[0]).forEach(([t,r])=>{n.resetDsCurVal(),ce(n.restEncoder,t);const i=r.length;ce(n.restEncoder,i);for(let s=0;s<i;s++){const o=r[s];n.writeDsClock(o.clock),n.writeDsLen(o.len)}})},Um=um;class Bn extends iC{constructor({guid:e=MC(),collectionid:t=null,gc:r=!0,gcFilter:i=()=>!0,meta:s=null,autoLoad:o=!1,shouldLoad:l=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=Um(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new Xw,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=l,this.autoLoad=o,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=mh(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const a=()=>mh(c=>{const u=d=>{(d===void 0||d===!0)&&(this.off("sync",u),c())};this.on("sync",u)});this.on("sync",c=>{c===!1&&this.isSynced&&(this.whenSynced=a()),this.isSynced=c===void 0||c===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=a()}load(){const e=this._item;e!==null&&!this.shouldLoad&&he(e.parent.doc,t=>{t.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(ti(this.subdocs).map(e=>e.guid))}transact(e,t=null){return he(this,e,t)}get(e,t=Ue){const r=Ci(this.share,e,()=>{const s=new t;return s._integrate(this,null),s}),i=r.constructor;if(t!==Ue&&i!==t)if(i===Ue){const s=new t;s._map=r._map,r._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=s}),s._start=r._start;for(let o=s._start;o!==null;o=o.right)o.parent=s;return s._length=r._length,this.share.set(e,s),s._integrate(this,null),s}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,Yi)}getText(e=""){return this.get(e,ms)}getMap(e=""){return this.get(e,yt)}getXmlElement(e=""){return this.get(e,_n)}getXmlFragment(e=""){return this.get(e,ri)}toJSON(){const e={};return this.share.forEach((t,r)=>{e[r]=t.toJSON()}),e}destroy(){this.isDestroyed=!0,ti(this.subdocs).forEach(t=>t.destroy());const e=this._item;if(e!==null){this._item=null;const t=e.content;t.doc=new Bn({guid:this.guid,...t.opts,shouldLoad:!1}),t.doc._item=e,he(e.parent.doc,r=>{const i=t.doc;e.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class Ww{constructor(){this.restEncoder=Eu()}toUint8Array(){return an(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){ce(this.restEncoder,e)}writeDsLen(e){ce(this.restEncoder,e)}}class jw extends Ww{writeLeftID(e){ce(this.restEncoder,e.client),ce(this.restEncoder,e.clock)}writeRightID(e){ce(this.restEncoder,e.client),ce(this.restEncoder,e.clock)}writeClient(e){ce(this.restEncoder,e)}writeInfo(e){mc(this.restEncoder,e)}writeString(e){qr(this.restEncoder,e)}writeParentInfo(e){ce(this.restEncoder,e?1:0)}writeTypeRef(e){ce(this.restEncoder,e)}writeLen(e){ce(this.restEncoder,e)}writeAny(e){us(this.restEncoder,e)}writeBuf(e){ut(this.restEncoder,e)}writeJSON(e){qr(this.restEncoder,JSON.stringify(e))}writeKey(e){qr(this.restEncoder,e)}}class Hw{constructor(){this.restEncoder=Eu(),this.dsCurrVal=0}toUint8Array(){return an(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,ce(this.restEncoder,t)}writeDsLen(e){e===0&&pn(),ce(this.restEncoder,e-1),this.dsCurrVal+=e}}class Jw extends Hw{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new wa,this.clientEncoder=new no,this.leftClockEncoder=new wa,this.rightClockEncoder=new wa,this.infoEncoder=new hh(mc),this.stringEncoder=new NC,this.parentInfoEncoder=new hh(mc),this.typeRefEncoder=new no,this.lenEncoder=new no}toUint8Array(){const e=Eu();return ce(e,0),ut(e,this.keyClockEncoder.toUint8Array()),ut(e,this.clientEncoder.toUint8Array()),ut(e,this.leftClockEncoder.toUint8Array()),ut(e,this.rightClockEncoder.toUint8Array()),ut(e,an(this.infoEncoder)),ut(e,this.stringEncoder.toUint8Array()),ut(e,an(this.parentInfoEncoder)),ut(e,this.typeRefEncoder.toUint8Array()),ut(e,this.lenEncoder.toUint8Array()),Tu(e,an(this.restEncoder)),an(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){us(this.restEncoder,e)}writeBuf(e){ut(this.restEncoder,e)}writeJSON(e){us(this.restEncoder,e)}writeKey(e){const t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}}const Gw=(n,e,t,r)=>{r=wi(r,e[0].id.clock);const i=mn(e,r);ce(n.restEncoder,e.length-i),n.writeClient(t),ce(n.restEncoder,r);const s=e[i];s.write(n,r-s.id.clock);for(let o=i+1;o<e.length;o++)e[o].write(n,0)},Vw=(n,e,t)=>{const r=new Map;t.forEach((i,s)=>{it(e,s)>i&&r.set(s,i)}),Ru(e).forEach((i,s)=>{t.has(s)||r.set(s,0)}),ce(n.restEncoder,r.size),ti(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{Gw(n,e.clients.get(i),i,s)})},Yw=(n,e)=>Vw(n,e.doc.store,e.beforeState);class qw{constructor(){this.l=[]}}const xh=()=>new qw,Sh=(n,e)=>n.l.push(e),Ch=(n,e)=>{const t=n.l,r=t.length;n.l=t.filter(i=>e!==i),r===n.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},Km=(n,e,t)=>Ou(n.l,[e,t]);class io{constructor(e,t){this.client=e,this.clock=t}}const Js=(n,e)=>n===e||n!==null&&e!==null&&n.client===e.client&&n.clock===e.clock,_e=(n,e)=>new io(n,e),Zw=n=>{for(const[e,t]of n.doc.share.entries())if(t===n)return e;throw pn()},jr=(n,e)=>e===void 0?!n.deleted:e.sv.has(n.id.client)&&(e.sv.get(n.id.client)||0)>n.id.clock&&!Pm(e.ds,n.id),xc=(n,e)=>{const t=Ci(n.meta,xc,ei),r=n.doc.store;t.has(e)||(e.sv.forEach((i,s)=>{i<it(r,s)&&zn(n,_e(s,i))}),Rm(n,e.ds,i=>{}),t.add(e))};class Xw{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const Ru=n=>{const e=new Map;return n.clients.forEach((t,r)=>{const i=t[t.length-1];e.set(r,i.id.clock+i.length)}),e},it=(n,e)=>{const t=n.clients.get(e);if(t===void 0)return 0;const r=t[t.length-1];return r.id.clock+r.length},Wm=(n,e)=>{let t=n.clients.get(e.id.client);if(t===void 0)t=[],n.clients.set(e.id.client,t);else{const r=t[t.length-1];if(r.id.clock+r.length!==e.id.clock)throw pn()}t.push(e)},mn=(n,e)=>{let t=0,r=n.length-1,i=n[r],s=i.id.clock;if(s===e)return r;let o=gn(e/(s+i.length-1)*r);for(;t<=r;){if(i=n[o],s=i.id.clock,s<=e){if(e<s+i.length)return o;t=o+1}else r=o-1;o=gn((t+r)/2)}throw pn()},Qw=(n,e)=>{const t=n.clients.get(e.client);return t[mn(t,e.clock)]},Ta=Qw,Sc=(n,e,t)=>{const r=mn(e,t),i=e[r];return i.id.clock<t&&i instanceof Je?(e.splice(r+1,0,a_(n,i,t-i.id.clock)),r+1):r},zn=(n,e)=>{const t=n.doc.store.clients.get(e.client);return t[Sc(n,t,e.clock)]},wh=(n,e,t)=>{const r=e.clients.get(t.client),i=mn(r,t.clock),s=r[i];return t.clock!==s.id.clock+s.length-1&&s.constructor!==En&&r.splice(i+1,0,a_(n,s,t.clock-s.id.clock+1)),s},ev=(n,e,t)=>{const r=n.clients.get(e.id.client);r[mn(r,e.id.clock)]=t},jm=(n,e,t,r,i)=>{if(r===0)return;const s=t+r;let o=Sc(n,e,t),l;do l=e[o++],s<l.id.clock+l.length&&Sc(n,e,s),i(l);while(o<e.length&&e[o].id.clock<s)};class tv{constructor(e,t,r){this.doc=e,this.deleteSet=new zw,this.beforeState=Ru(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const vh=(n,e)=>e.deleteSet.clients.size===0&&!nC(e.afterState,(t,r)=>e.beforeState.get(r)!==t)?!1:(Bm(e.deleteSet),Yw(n,e),Kw(n,e.deleteSet),!0),Eh=(n,e,t)=>{const r=e._item;(r===null||r.id.clock<(n.beforeState.get(r.id.client)||0)&&!r.deleted)&&Ci(n.changed,e,ei).add(t)},so=(n,e)=>{let t=n[e],r=n[e-1],i=e;for(;i>0;t=r,r=n[--i-1]){if(r.deleted===t.deleted&&r.constructor===t.constructor&&r.mergeWith(t)){t instanceof Je&&t.parentSub!==null&&t.parent._map.get(t.parentSub)===t&&t.parent._map.set(t.parentSub,r);continue}break}const s=e-i;return s&&n.splice(e+1-s,s),s},nv=(n,e,t)=>{for(const[r,i]of n.clients.entries()){const s=e.clients.get(r);for(let o=i.length-1;o>=0;o--){const l=i[o],a=l.clock+l.len;for(let c=mn(s,l.clock),u=s[c];c<s.length&&u.id.clock<a;u=s[++c]){const d=s[c];if(l.clock+l.len<=d.id.clock)break;d instanceof Je&&d.deleted&&!d.keep&&t(d)&&d.gc(e,!1)}}}},rv=(n,e)=>{n.clients.forEach((t,r)=>{const i=e.clients.get(r);for(let s=t.length-1;s>=0;s--){const o=t[s],l=am(i.length-1,1+mn(i,o.clock+o.len-1));for(let a=l,c=i[a];a>0&&c.id.clock>=o.clock;c=i[a])a-=1+so(i,a)}})},Hm=(n,e)=>{if(e<n.length){const t=n[e],r=t.doc,i=r.store,s=t.deleteSet,o=t._mergeStructs;try{Bm(s),t.afterState=Ru(t.doc.store),r.emit("beforeObserverCalls",[t,r]);const l=[];t.changed.forEach((a,c)=>l.push(()=>{(c._item===null||!c._item.deleted)&&c._callObserver(t,a)})),l.push(()=>{t.changedParentTypes.forEach((a,c)=>{c._dEH.l.length>0&&(c._item===null||!c._item.deleted)&&(a=a.filter(u=>u.target._item===null||!u.target._item.deleted),a.forEach(u=>{u.currentTarget=c,u._path=null}),a.sort((u,d)=>u.path.length-d.path.length),l.push(()=>{Km(c._dEH,a,t)}))}),l.push(()=>r.emit("afterTransaction",[t,r])),l.push(()=>{t._needFormattingCleanup&&pv(t)})}),Ou(l,[])}finally{r.gc&&nv(s,i,r.gcFilter),rv(s,i),t.afterState.forEach((u,d)=>{const f=t.beforeState.get(d)||0;if(f!==u){const h=i.clients.get(d),g=wi(mn(h,f),1);for(let p=h.length-1;p>=g;)p-=1+so(h,p)}});for(let u=o.length-1;u>=0;u--){const{client:d,clock:f}=o[u].id,h=i.clients.get(d),g=mn(h,f);g+1<h.length&&so(h,g+1)>1||g>0&&so(h,g)}if(!t.local&&t.afterState.get(r.clientID)!==t.beforeState.get(r.clientID)&&(Lw(Lu,Mm,"[yjs] ",$m,Im,"Changed the client-id because another client seems to be using it."),r.clientID=Um()),r.emit("afterTransactionCleanup",[t,r]),r._observers.has("update")){const u=new jw;vh(u,t)&&r.emit("update",[u.toUint8Array(),t.origin,r,t])}if(r._observers.has("updateV2")){const u=new Jw;vh(u,t)&&r.emit("updateV2",[u.toUint8Array(),t.origin,r,t])}const{subdocsAdded:l,subdocsLoaded:a,subdocsRemoved:c}=t;(l.size>0||c.size>0||a.size>0)&&(l.forEach(u=>{u.clientID=r.clientID,u.collectionid==null&&(u.collectionid=r.collectionid),r.subdocs.add(u)}),c.forEach(u=>r.subdocs.delete(u)),r.emit("subdocs",[{loaded:a,added:l,removed:c},r,t]),c.forEach(u=>u.destroy())),n.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,n])):Hm(n,e+1)}}},he=(n,e,t=null,r=!0)=>{const i=n._transactionCleanups;let s=!1,o=null;n._transaction===null&&(s=!0,n._transaction=new tv(n,t,r),i.push(n._transaction),i.length===1&&n.emit("beforeAllTransactions",[n]),n.emit("beforeTransaction",[n._transaction,n]));try{o=e(n._transaction)}finally{if(s){const l=n._transaction===i[0];n._transaction=null,l&&Hm(i,0)}}return o},kh="You must not compute changes after the event-handler fired.";class $l{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=iv(this.currentTarget,this.target))}deletes(e){return Pm(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Pn(kh);const e=new Map,t=this.target;this.transaction.changed.get(t).forEach(i=>{if(i!==null){const s=t._map.get(i);let o,l;if(this.adds(s)){let a=s.left;for(;a!==null&&this.adds(a);)a=a.left;if(this.deletes(s))if(a!==null&&this.deletes(a))o="delete",l=ba(a.content.getContent());else return;else a!==null&&this.deletes(a)?(o="update",l=ba(a.content.getContent())):(o="add",l=void 0)}else if(this.deletes(s))o="delete",l=ba(s.content.getContent());else return;e.set(i,{action:o,oldValue:l})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw Pn(kh);const t=this.target,r=ei(),i=ei(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(t).has(null)){let l=null;const a=()=>{l&&s.push(l)};for(let c=t._start;c!==null;c=c.right)c.deleted?this.deletes(c)&&!this.adds(c)&&((l===null||l.delete===void 0)&&(a(),l={delete:0}),l.delete+=c.length,i.add(c)):this.adds(c)?((l===null||l.insert===void 0)&&(a(),l={insert:[]}),l.insert=l.insert.concat(c.content.getContent()),r.add(c)):((l===null||l.retain===void 0)&&(a(),l={retain:0}),l.retain+=c.length);l!==null&&l.retain===void 0&&a()}this._changes=e}return e}}const iv=(n,e)=>{const t=[];for(;e._item!==null&&e!==n;){if(e._item.parentSub!==null)t.unshift(e._item.parentSub);else{let r=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)!i.deleted&&i.countable&&(r+=i.length),i=i.right;t.unshift(r)}e=e._item.parent}return t},Ve=()=>{Rw("Invalid access: Add Yjs type to a document before reading data.")},Jm=80;let Pu=0;class sv{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=Pu++}}const ov=n=>{n.timestamp=Pu++},Gm=(n,e,t)=>{n.p.marker=!1,n.p=e,e.marker=!0,n.index=t,n.timestamp=Pu++},lv=(n,e,t)=>{if(n.length>=Jm){const r=n.reduce((i,s)=>i.timestamp<s.timestamp?i:s);return Gm(r,e,t),r}else{const r=new sv(e,t);return n.push(r),r}},Il=(n,e)=>{if(n._start===null||e===0||n._searchMarker===null)return null;const t=n._searchMarker.length===0?null:n._searchMarker.reduce((s,o)=>to(e-s.index)<to(e-o.index)?s:o);let r=n._start,i=0;for(t!==null&&(r=t.p,i=t.index,ov(t));r.right!==null&&i<e;){if(!r.deleted&&r.countable){if(e<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>e;)r=r.left,!r.deleted&&r.countable&&(i-=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&&(i-=r.length);return t!==null&&to(t.index-i)<r.parent.length/Jm?(Gm(t,r,i),t):lv(n._searchMarker,r,i)},gs=(n,e,t)=>{for(let r=n.length-1;r>=0;r--){const i=n[r];if(t>0){let s=i.p;for(s.marker=!1;s&&(s.deleted||!s.countable);)s=s.left,s&&!s.deleted&&s.countable&&(i.index-=s.length);if(s===null||s.marker===!0){n.splice(r,1);continue}i.p=s,s.marker=!0}(e<i.index||t>0&&e===i.index)&&(i.index=wi(e,i.index+t))}},Fl=(n,e,t)=>{const r=n,i=e.changedParentTypes;for(;Ci(i,n,()=>[]).push(t),n._item!==null;)n=n._item.parent;Km(r._eH,t,e)};class Ue{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=xh(),this._dEH=xh(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw Ft()}clone(){throw Ft()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){Sh(this._eH,e)}observeDeep(e){Sh(this._dEH,e)}unobserve(e){Ch(this._eH,e)}unobserveDeep(e){Ch(this._dEH,e)}toJSON(){}}const Vm=(n,e,t)=>{n.doc??Ve(),e<0&&(e=n._length+e),t<0&&(t=n._length+t);let r=t-e;const i=[];let s=n._start;for(;s!==null&&r>0;){if(s.countable&&!s.deleted){const o=s.content.getContent();if(o.length<=e)e-=o.length;else{for(let l=e;l<o.length&&r>0;l++)i.push(o[l]),r--;e=0}}s=s.right}return i},Ym=n=>{n.doc??Ve();const e=[];let t=n._start;for(;t!==null;){if(t.countable&&!t.deleted){const r=t.content.getContent();for(let i=0;i<r.length;i++)e.push(r[i])}t=t.right}return e},ps=(n,e)=>{let t=0,r=n._start;for(n.doc??Ve();r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let s=0;s<i.length;s++)e(i[s],t++,n)}r=r.right}},qm=(n,e)=>{const t=[];return ps(n,(r,i)=>{t.push(e(r,i,n))}),t},av=n=>{let e=n._start,t=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(t===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};t=e.content.getContent(),r=0,e=e.right}const i=t[r++];return t.length<=r&&(t=null),{done:!1,value:i}}}},Zm=(n,e)=>{n.doc??Ve();const t=Il(n,e);let r=n._start;for(t!==null&&(r=t.p,e-=t.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},Uo=(n,e,t,r)=>{let i=t;const s=n.doc,o=s.clientID,l=s.store,a=t===null?e._start:t.right;let c=[];const u=()=>{c.length>0&&(i=new Je(_e(o,it(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new ii(c)),i.integrate(n,0),c=[])};r.forEach(d=>{if(d===null)c.push(d);else switch(d.constructor){case Number:case Object:case Boolean:case Array:case String:c.push(d);break;default:switch(u(),d.constructor){case Uint8Array:case ArrayBuffer:i=new Je(_e(o,it(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Dl(new Uint8Array(d))),i.integrate(n,0);break;case Bn:i=new Je(_e(o,it(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Ll(d)),i.integrate(n,0);break;default:if(d instanceof Ue)i=new Je(_e(o,it(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Jn(d)),i.integrate(n,0);else throw new Error("Unexpected content type in insert operation")}}}),u()},Xm=()=>Pn("Length exceeded!"),Qm=(n,e,t,r)=>{if(t>e._length)throw Xm();if(t===0)return e._searchMarker&&gs(e._searchMarker,t,r.length),Uo(n,e,null,r);const i=t,s=Il(e,t);let o=e._start;for(s!==null&&(o=s.p,t-=s.index,t===0&&(o=o.prev,t+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(t<=o.length){t<o.length&&zn(n,_e(o.id.client,o.id.clock+t));break}t-=o.length}return e._searchMarker&&gs(e._searchMarker,i,r.length),Uo(n,e,o,r)},cv=(n,e,t)=>{let i=(e._searchMarker||[]).reduce((s,o)=>o.index>s.index?o:s,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return Uo(n,e,i,t)},e_=(n,e,t,r)=>{if(r===0)return;const i=t,s=r,o=Il(e,t);let l=e._start;for(o!==null&&(l=o.p,t-=o.index);l!==null&&t>0;l=l.right)!l.deleted&&l.countable&&(t<l.length&&zn(n,_e(l.id.client,l.id.clock+t)),t-=l.length);for(;r>0&&l!==null;)l.deleted||(r<l.length&&zn(n,_e(l.id.client,l.id.clock+r)),l.delete(n),r-=l.length),l=l.right;if(r>0)throw Xm();e._searchMarker&&gs(e._searchMarker,i,-s+r)},Ko=(n,e,t)=>{const r=e._map.get(t);r!==void 0&&r.delete(n)},Bu=(n,e,t,r)=>{const i=e._map.get(t)||null,s=n.doc,o=s.clientID;let l;if(r==null)l=new ii([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:l=new ii([r]);break;case Uint8Array:l=new Dl(r);break;case Bn:l=new Ll(r);break;default:if(r instanceof Ue)l=new Jn(r);else throw new Error("Unexpected content type")}new Je(_e(o,it(s.store,o)),i,i&&i.lastId,null,null,e,t,l).integrate(n,0)},zu=(n,e)=>{n.doc??Ve();const t=n._map.get(e);return t!==void 0&&!t.deleted?t.content.getContent()[t.length-1]:void 0},t_=n=>{const e={};return n.doc??Ve(),n._map.forEach((t,r)=>{t.deleted||(e[r]=t.content.getContent()[t.length-1])}),e},n_=(n,e)=>{n.doc??Ve();const t=n._map.get(e);return t!==void 0&&!t.deleted},uv=(n,e)=>{const t={};return n._map.forEach((r,i)=>{let s=r;for(;s!==null&&(!e.sv.has(s.id.client)||s.id.clock>=(e.sv.get(s.id.client)||0));)s=s.left;s!==null&&jr(s,e)&&(t[i]=s.content.getContent()[s.length-1])}),t},Gs=n=>(n.doc??Ve(),Pw(n._map.entries(),e=>!e[1].deleted));class dv extends $l{}class Yi extends Ue{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const t=new Yi;return t.push(e),t}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Yi}clone(){const e=new Yi;return e.insert(0,this.toArray().map(t=>t instanceof Ue?t.clone():t)),e}get length(){return this.doc??Ve(),this._length}_callObserver(e,t){super._callObserver(e,t),Fl(this,e,new dv(this,e))}insert(e,t){this.doc!==null?he(this.doc,r=>{Qm(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}push(e){this.doc!==null?he(this.doc,t=>{cv(t,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc!==null?he(this.doc,r=>{e_(r,this,e,t)}):this._prelimContent.splice(e,t)}get(e){return Zm(this,e)}toArray(){return Ym(this)}slice(e=0,t=this.length){return Vm(this,e,t)}toJSON(){return this.map(e=>e instanceof Ue?e.toJSON():e)}map(e){return qm(this,e)}forEach(e){ps(this,e)}[Symbol.iterator](){return av(this)}_write(e){e.writeTypeRef(Sv)}}class fv extends $l{constructor(e,t,r){super(e,t),this.keysChanged=r}}class yt extends Ue{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new yt}clone(){const e=new yt;return this.forEach((t,r)=>{e.set(r,t instanceof Ue?t.clone():t)}),e}_callObserver(e,t){Fl(this,e,new fv(this,e,t))}toJSON(){this.doc??Ve();const e={};return this._map.forEach((t,r)=>{if(!t.deleted){const i=t.content.getContent()[t.length-1];e[r]=i instanceof Ue?i.toJSON():i}}),e}get size(){return[...Gs(this)].length}keys(){return ka(Gs(this),e=>e[0])}values(){return ka(Gs(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return ka(Gs(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??Ve(),this._map.forEach((t,r)=>{t.deleted||e(t.content.getContent()[t.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?he(this.doc,t=>{Ko(t,this,e)}):this._prelimContent.delete(e)}set(e,t){return this.doc!==null?he(this.doc,r=>{Bu(r,this,e,t)}):this._prelimContent.set(e,t),t}get(e){return zu(this,e)}has(e){return n_(this,e)}clear(){this.doc!==null?he(this.doc,e=>{this.forEach(function(t,r,i){Ko(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(Cv)}}const Nn=(n,e)=>n===e||typeof n=="object"&&typeof e=="object"&&n&&e&&zC(n,e);class Cc{constructor(e,t,r,i){this.left=e,this.right=t,this.index=r,this.currentAttributes=i}forward(){switch(this.right===null&&pn(),this.right.content.constructor){case De:this.right.deleted||Ei(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const Th=(n,e,t)=>{for(;e.right!==null&&t>0;){switch(e.right.content.constructor){case De:e.right.deleted||Ei(e.currentAttributes,e.right.content);break;default:e.right.deleted||(t<e.right.length&&zn(n,_e(e.right.id.client,e.right.id.clock+t)),e.index+=e.right.length,t-=e.right.length);break}e.left=e.right,e.right=e.right.right}return e},Vs=(n,e,t,r)=>{const i=new Map,s=r?Il(e,t):null;if(s){const o=new Cc(s.p.left,s.p,s.index,i);return Th(n,o,t-s.index)}else{const o=new Cc(null,e._start,0,i);return Th(n,o,t)}},r_=(n,e,t,r)=>{for(;t.right!==null&&(t.right.deleted===!0||t.right.content.constructor===De&&Nn(r.get(t.right.content.key),t.right.content.value));)t.right.deleted||r.delete(t.right.content.key),t.forward();const i=n.doc,s=i.clientID;r.forEach((o,l)=>{const a=t.left,c=t.right,u=new Je(_e(s,it(i.store,s)),a,a&&a.lastId,c,c&&c.id,e,null,new De(l,o));u.integrate(n,0),t.right=u,t.forward()})},Ei=(n,e)=>{const{key:t,value:r}=e;r===null?n.delete(t):n.set(t,r)},i_=(n,e)=>{for(;n.right!==null;){if(!(n.right.deleted||n.right.content.constructor===De&&Nn(e[n.right.content.key]??null,n.right.content.value)))break;n.forward()}},s_=(n,e,t,r)=>{const i=n.doc,s=i.clientID,o=new Map;for(const l in r){const a=r[l],c=t.currentAttributes.get(l)??null;if(!Nn(c,a)){o.set(l,c);const{left:u,right:d}=t;t.right=new Je(_e(s,it(i.store,s)),u,u&&u.lastId,d,d&&d.id,e,null,new De(l,a)),t.right.integrate(n,0),t.forward()}}return o},Na=(n,e,t,r,i)=>{t.currentAttributes.forEach((f,h)=>{i[h]===void 0&&(i[h]=null)});const s=n.doc,o=s.clientID;i_(t,i);const l=s_(n,e,t,i),a=r.constructor===String?new yn(r):r instanceof Ue?new Jn(r):new ki(r);let{left:c,right:u,index:d}=t;e._searchMarker&&gs(e._searchMarker,t.index,a.getLength()),u=new Je(_e(o,it(s.store,o)),c,c&&c.lastId,u,u&&u.id,e,null,a),u.integrate(n,0),t.right=u,t.index=d,t.forward(),r_(n,e,t,l)},Nh=(n,e,t,r,i)=>{const s=n.doc,o=s.clientID;i_(t,i);const l=s_(n,e,t,i);e:for(;t.right!==null&&(r>0||l.size>0&&(t.right.deleted||t.right.content.constructor===De));){if(!t.right.deleted)switch(t.right.content.constructor){case De:{const{key:a,value:c}=t.right.content,u=i[a];if(u!==void 0){if(Nn(u,c))l.delete(a);else{if(r===0)break e;l.set(a,c)}t.right.delete(n)}else t.currentAttributes.set(a,c);break}default:r<t.right.length&&zn(n,_e(t.right.id.client,t.right.id.clock+r)),r-=t.right.length;break}t.forward()}if(r>0){let a="";for(;r>0;r--)a+=`
45
- `;t.right=new Je(_e(o,it(s.store,o)),t.left,t.left&&t.left.lastId,t.right,t.right&&t.right.id,e,null,new yn(a)),t.right.integrate(n,0),t.forward()}r_(n,e,t,l)},o_=(n,e,t,r,i)=>{let s=e;const o=Gt();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===De){const c=s.content;o.set(c.key,c)}s=s.right}let l=0,a=!1;for(;e!==s;){if(t===e&&(a=!0),!e.deleted){const c=e.content;switch(c.constructor){case De:{const{key:u,value:d}=c,f=r.get(u)??null;(o.get(u)!==c||f===d)&&(e.delete(n),l++,!a&&(i.get(u)??null)===d&&f!==d&&(f===null?i.delete(u):i.set(u,f))),!a&&!e.deleted&&Ei(i,c);break}}}e=e.right}return l},hv=(n,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const t=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===De){const r=e.content.key;t.has(r)?e.delete(n):t.add(r)}e=e.left}},gv=n=>{let e=0;return he(n.doc,t=>{let r=n._start,i=n._start,s=Gt();const o=pc(s);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case De:Ei(o,i.content);break;default:e+=o_(t,r,i,s,o),s=pc(o),r=i;break}i=i.right}}),e},pv=n=>{const e=new Set,t=n.doc;for(const[r,i]of n.afterState.entries()){const s=n.beforeState.get(r)||0;i!==s&&jm(n,t.store.clients.get(r),s,i,o=>{!o.deleted&&o.content.constructor===De&&o.constructor!==En&&e.add(o.parent)})}he(t,r=>{Rm(n,n.deleteSet,i=>{if(i instanceof En||!i.parent._hasFormatting||e.has(i.parent))return;const s=i.parent;i.content.constructor===De?e.add(s):hv(r,i)});for(const i of e)gv(i)})},Ah=(n,e,t)=>{const r=t,i=pc(e.currentAttributes),s=e.right;for(;t>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case Jn:case ki:case yn:t<e.right.length&&zn(n,_e(e.right.id.client,e.right.id.clock+t)),t-=e.right.length,e.right.delete(n);break}e.forward()}s&&o_(n,s,e.right,i,e.currentAttributes);const o=(e.left||e.right).parent;return o._searchMarker&&gs(o._searchMarker,e.index,-r+t),e};class mv extends $l{constructor(e,t,r){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(i=>{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,t=[];he(e,r=>{const i=new Map,s=new Map;let o=this.target._start,l=null;const a={};let c="",u=0,d=0;const f=()=>{if(l!==null){let h=null;switch(l){case"delete":d>0&&(h={delete:d}),d=0;break;case"insert":(typeof c=="object"||c.length>0)&&(h={insert:c},i.size>0&&(h.attributes={},i.forEach((g,p)=>{g!==null&&(h.attributes[p]=g)}))),c="";break;case"retain":u>0&&(h={retain:u},BC(a)||(h.attributes=LC({},a))),u=0;break}h&&t.push(h),l=null}};for(;o!==null;){switch(o.content.constructor){case Jn:case ki:this.adds(o)?this.deletes(o)||(f(),l="insert",c=o.content.getContent()[0],f()):this.deletes(o)?(l!=="delete"&&(f(),l="delete"),d+=1):o.deleted||(l!=="retain"&&(f(),l="retain"),u+=1);break;case yn:this.adds(o)?this.deletes(o)||(l!=="insert"&&(f(),l="insert"),c+=o.content.str):this.deletes(o)?(l!=="delete"&&(f(),l="delete"),d+=o.length):o.deleted||(l!=="retain"&&(f(),l="retain"),u+=o.length);break;case De:{const{key:h,value:g}=o.content;if(this.adds(o)){if(!this.deletes(o)){const p=i.get(h)??null;Nn(p,g)?g!==null&&o.delete(r):(l==="retain"&&f(),Nn(g,s.get(h)??null)?delete a[h]:a[h]=g)}}else if(this.deletes(o)){s.set(h,g);const p=i.get(h)??null;Nn(p,g)||(l==="retain"&&f(),a[h]=p)}else if(!o.deleted){s.set(h,g);const p=a[h];p!==void 0&&(Nn(p,g)?p!==null&&o.delete(r):(l==="retain"&&f(),g===null?delete a[h]:a[h]=g))}o.deleted||(l==="insert"&&f(),Ei(i,o.content));break}}o=o.right}for(f();t.length>0;){const h=t[t.length-1];if(h.retain!==void 0&&h.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}}class ms extends Ue{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Ve(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new ms}clone(){const e=new ms;return e.applyDelta(this.toDelta()),e}_callObserver(e,t){super._callObserver(e,t);const r=new mv(this,e,t);Fl(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??Ve();let e="",t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===yn&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){this.doc!==null?he(this.doc,r=>{const i=new Cc(null,this._start,0,new Map);for(let s=0;s<e.length;s++){const o=e[s];if(o.insert!==void 0){const l=!t&&typeof o.insert=="string"&&s===e.length-1&&i.right===null&&o.insert.slice(-1)===`
46
- `?o.insert.slice(0,-1):o.insert;(typeof l!="string"||l.length>0)&&Na(r,this,i,l,o.attributes||{})}else o.retain!==void 0?Nh(r,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&Ah(r,i,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,t,r){this.doc??Ve();const i=[],s=new Map,o=this.doc;let l="",a=this._start;function c(){if(l.length>0){const d={};let f=!1;s.forEach((g,p)=>{f=!0,d[p]=g});const h={insert:l};f&&(h.attributes=d),i.push(h),l=""}}const u=()=>{for(;a!==null;){if(jr(a,e)||t!==void 0&&jr(a,t))switch(a.content.constructor){case yn:{const d=s.get("ychange");e!==void 0&&!jr(a,e)?(d===void 0||d.user!==a.id.client||d.type!=="removed")&&(c(),s.set("ychange",r?r("removed",a.id):{type:"removed"})):t!==void 0&&!jr(a,t)?(d===void 0||d.user!==a.id.client||d.type!=="added")&&(c(),s.set("ychange",r?r("added",a.id):{type:"added"})):d!==void 0&&(c(),s.delete("ychange")),l+=a.content.str;break}case Jn:case ki:{c();const d={insert:a.content.getContent()[0]};if(s.size>0){const f={};d.attributes=f,s.forEach((h,g)=>{f[g]=h})}i.push(d);break}case De:jr(a,e)&&(c(),Ei(s,a.content));break}a=a.right}c()};return e||t?he(o,d=>{e&&xc(d,e),t&&xc(d,t),u()},"cleanup"):u(),i}insert(e,t,r){if(t.length<=0)return;const i=this.doc;i!==null?he(i,s=>{const o=Vs(s,this,e,!r);r||(r={},o.currentAttributes.forEach((l,a)=>{r[a]=l})),Na(s,this,o,t,r)}):this._pending.push(()=>this.insert(e,t,r))}insertEmbed(e,t,r){const i=this.doc;i!==null?he(i,s=>{const o=Vs(s,this,e,!r);Na(s,this,o,t,r||{})}):this._pending.push(()=>this.insertEmbed(e,t,r||{}))}delete(e,t){if(t===0)return;const r=this.doc;r!==null?he(r,i=>{Ah(i,Vs(i,this,e,!0),t)}):this._pending.push(()=>this.delete(e,t))}format(e,t,r){if(t===0)return;const i=this.doc;i!==null?he(i,s=>{const o=Vs(s,this,e,!1);o.right!==null&&Nh(s,this,o,t,r)}):this._pending.push(()=>this.format(e,t,r))}removeAttribute(e){this.doc!==null?he(this.doc,t=>{Ko(t,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,t){this.doc!==null?he(this.doc,r=>{Bu(r,this,e,t)}):this._pending.push(()=>this.setAttribute(e,t))}getAttribute(e){return zu(this,e)}getAttributes(){return t_(this)}_write(e){e.writeTypeRef(wv)}}class Aa{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Ve()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===_n||t.constructor===ri)&&t._start!==null)e=t._start;else for(;e!==null;){const r=e.next;if(r!==null){e=r;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class ri extends Ue{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new ri}clone(){const e=new ri;return e.insert(0,this.toArray().map(t=>t instanceof Ue?t.clone():t)),e}get length(){return this.doc??Ve(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new Aa(this,e)}querySelector(e){e=e.toUpperCase();const r=new Aa(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),ti(new Aa(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){Fl(this,e,new _v(this,t,e))}toString(){return qm(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,t={},r){const i=e.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),ps(this,s=>{i.insertBefore(s.toDOM(e,t,r),null)}),i}insert(e,t){this.doc!==null?he(this.doc,r=>{Qm(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}insertAfter(e,t){if(this.doc!==null)he(this.doc,r=>{const i=e&&e instanceof Ue?e._item:e;Uo(r,this,i,t)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(s=>s===e)+1;if(i===0&&e!==null)throw Pn("Reference item not found");r.splice(i,0,...t)}}delete(e,t=1){this.doc!==null?he(this.doc,r=>{e_(r,this,e,t)}):this._prelimContent.splice(e,t)}toArray(){return Ym(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return Zm(this,e)}slice(e=0,t=this.length){return Vm(this,e,t)}forEach(e){ps(this,e)}_write(e){e.writeTypeRef(Ev)}}class _n extends ri{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new _n(this.nodeName)}clone(){const e=new _n(this.nodeName),t=this.getAttributes();return PC(t,(r,i)=>{e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof Ue?r.clone():r)),e}toString(){const e=this.getAttributes(),t=[],r=[];for(const l in e)r.push(l);r.sort();const i=r.length;for(let l=0;l<i;l++){const a=r[l];t.push(a+'="'+e[a]+'"')}const s=this.nodeName.toLocaleLowerCase(),o=t.length>0?" "+t.join(" "):"";return`<${s}${o}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?he(this.doc,t=>{Ko(t,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,t){this.doc!==null?he(this.doc,r=>{Bu(r,this,e,t)}):this._prelimAttrs.set(e,t)}getAttribute(e){return zu(this,e)}hasAttribute(e){return n_(this,e)}getAttributes(e){return e?uv(this,e):t_(this)}toDOM(e=document,t={},r){const i=e.createElement(this.nodeName),s=this.getAttributes();for(const o in s){const l=s[o];typeof l=="string"&&i.setAttribute(o,l)}return ps(this,o=>{i.appendChild(o.toDOM(e,t,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(vv),e.writeKey(this.nodeName)}}class _v extends $l{constructor(e,t,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class Un extends ms{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new Un}clone(){const e=new Un;return e.applyDelta(this.toDelta()),e}toDOM(e=document,t,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const t=[];for(const i in e.attributes){const s=[];for(const o in e.attributes[i])s.push({key:o,value:e.attributes[i][o]});s.sort((o,l)=>o.key<l.key?-1:1),t.push({nodeName:i,attrs:s})}t.sort((i,s)=>i.nodeName<s.nodeName?-1:1);let r="";for(let i=0;i<t.length;i++){const s=t[i];r+=`<${s.nodeName}`;for(let o=0;o<s.attrs.length;o++){const l=s.attrs[o];r+=` ${l.key}="${l.value}"`}r+=">"}r+=e.insert;for(let i=t.length-1;i>=0;i--)r+=`</${t[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(kv)}}class l_{constructor(e,t){this.id=e,this.length=t}get deleted(){throw Ft()}mergeWith(e){return!1}write(e,t,r){throw Ft()}integrate(e,t){throw Ft()}}const yv=0;class En extends l_{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),Wm(e.doc.store,this)}write(e,t){e.writeInfo(yv),e.writeLen(this.length-t)}getMissing(e,t){return null}}class Dl{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Dl(this.content)}splice(e){throw Ft()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}}class Wo{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Wo(this.len)}splice(e){const t=new Wo(this.len-e);return this.len=e,t}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){zm(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}}const bv=(n,e)=>new Bn({guid:n,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Ll{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),e.meta!==null&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Ll(bv(this.doc.guid,this.opts))}splice(e){throw Ft()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}class ki{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new ki(this.embed)}splice(e){throw Ft()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}}class De{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new De(this.key,this.value)}splice(e){throw Ft()}mergeWith(e){return!1}integrate(e,t){const r=t.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const xv=Po("node_env")==="development";class ii{constructor(e){this.arr=e,xv&&hm(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new ii(this.arr)}splice(e){const t=new ii(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){const r=this.arr.length;e.writeLen(r-t);for(let i=t;i<r;i++){const s=this.arr[i];e.writeAny(s)}}getRef(){return 8}}class yn{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new yn(this.str)}splice(e){const t=new yn(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",t.str="�"+t.str.slice(1)),t}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}}const Sv=0,Cv=1,wv=2,vv=3,Ev=4,kv=6;class Jn{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Jn(this.type._copy())}splice(e){throw Ft()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;for(;t!==null;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;t!==null;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}}const a_=(n,e,t)=>{const{client:r,clock:i}=e.id,s=new Je(_e(r,i+t),e,_e(r,i+t-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(t));return e.deleted&&s.markDeleted(),e.keep&&(s.keep=!0),e.redone!==null&&(s.redone=_e(e.redone.client,e.redone.clock+t)),e.right=s,s.right!==null&&(s.right.left=s),n._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),e.length=t,s};class Je extends l_{constructor(e,t,r,i,s,o,l,a){super(e,a.getLength()),this.origin=r,this.left=t,this.right=i,this.rightOrigin=s,this.parent=o,this.parentSub=l,this.redone=null,this.content=a,this.info=this.content.isCountable()?lh:0}set marker(e){(this.info&Sa)>0!==e&&(this.info^=Sa)}get marker(){return(this.info&Sa)>0}get keep(){return(this.info&oh)>0}set keep(e){this.keep!==e&&(this.info^=oh)}get countable(){return(this.info&lh)>0}get deleted(){return(this.info&xa)>0}set deleted(e){this.deleted!==e&&(this.info^=xa)}markDeleted(){this.info|=xa}getMissing(e,t){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=it(t,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=it(t,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===io&&this.id.client!==this.parent.client&&this.parent.clock>=it(t,this.parent.client))return this.parent.client;if(this.origin&&(this.left=wh(e,t,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=zn(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===En||this.right&&this.right.constructor===En)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===Je?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===Je&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===io){const r=Ta(t,this.parent);r.constructor===En?this.parent=null:this.parent=r.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=wh(e,e.doc.store,_e(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const s=new Set,o=new Set;for(;i!==null&&i!==this.right;){if(o.add(i),s.add(i),Js(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(Js(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&o.has(Ta(e.doc.store,i.origin)))s.has(Ta(e.doc.store,i.origin))||(r=i,s.clear());else break;i=i.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&&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!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),Wm(e.doc.store,this),this.content.integrate(e,this),Eh(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new En(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:_e(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Js(e.origin,this.lastId)&&this.right===e&&Js(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const t=this.parent._searchMarker;return t&&t.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),zm(e.deleteSet,this.id.client,this.id.clock,this.length),Eh(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw pn();this.content.gc(e),t?ev(e,this,new En(this.id,this.length)):this.content=new Wo(this.length)}write(e,t){const r=t>0?_e(this.id.client,this.id.clock+t-1):this.origin,i=this.rightOrigin,s=this.parentSub,o=this.content.getRef()&lC|(r===null?0:Lo)|(i===null?0:cm)|(s===null?0:oC);if(e.writeInfo(o),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const l=this.parent;if(l._item!==void 0){const a=l._item;if(a===null){const c=Zw(l);e.writeParentInfo(!0),e.writeString(c)}else e.writeParentInfo(!1),e.writeLeftID(a.id)}else l.constructor===String?(e.writeParentInfo(!0),e.writeString(l)):l.constructor===io?(e.writeParentInfo(!1),e.writeLeftID(l)):pn();s!==null&&e.writeString(s)}this.content.write(e,t)}}const c_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},u_="__ $YJS$ __";c_[u_]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");c_[u_]=!0;function Be(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Tv(n,e,t){const r=n.length,i=e.length;let s=0,o=0;for(;s<r&&s<i&&n[s]===e[s]&&s<t;)s++;for(;o+s<r&&o+s<i&&n[r-o-1]===e[i-o-1];)o++;for(;o+s<r&&o+s<i&&n[s]===e[s];)s++;return{index:s,insert:e.slice(s,i-o),remove:r-s-o}}class er{_xmlElem;_key;_parent;_type;constructor(e,t,r){this._key="",this._xmlElem=e,this._parent=t,this._type=r}getPrevNode(e){if(e===null)return null;const t=e.get(this._key);return V(t)?t:null}getNode(){const e=q(this._key);return V(e)?e:null}getSharedType(){return this._xmlElem}getType(){return this._type}getKey(){return this._key}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}syncPropertiesFromLexical(e,t,r){const i=this.getPrevNode(r);Wu(e,this._xmlElem,i,t)}syncPropertiesFromYjs(e,t){const r=this.getNode();r===null&&Be(83),Ku(e,this._xmlElem,r,t)}destroy(e){const t=e.collabNodeMap;t.get(this._key)===this&&t.delete(this._key)}}function d_(n,e,t){const r=new er(n,e,t);return n._collabNode=r,r}class Ui{_map;_key;_parent;_type;constructor(e,t){this._key="",this._map=e,this._parent=t,this._type="linebreak"}getNode(){const e=q(this._key);return ue(e)?e:null}getKey(){return this._key}getSharedType(){return this._map}getType(){return this._type}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}destroy(e){const t=e.collabNodeMap;t.get(this._key)===this&&t.delete(this._key)}}function f_(n,e){const t=new Ui(n,e);return n._collabNode=t,t}class xt{_map;_key;_parent;_text;_type;_normalized;constructor(e,t,r,i){this._key="",this._map=e,this._parent=r,this._text=t,this._type=i,this._normalized=!1}getPrevNode(e){if(e===null)return null;const t=e.get(this._key);return D(t)?t:null}getNode(){const e=q(this._key);return D(e)?e:null}getSharedType(){return this._map}getType(){return this._type}getKey(){return this._key}getSize(){return this._text.length+(this._normalized?0:1)}getOffset(){return this._parent.getChildOffset(this)}spliceText(e,t,r){const i=this._parent._xmlText,s=this.getOffset()+1+e;t!==0&&i.delete(s,t),r!==""&&i.insert(s,r)}syncPropertiesAndTextFromLexical(e,t,r){const i=this.getPrevNode(r),s=t.__text;if(Wu(e,this._map,i,t),i!==null){const o=i.__text;o!==s&&((function(l,a,c,u){const d=O();let f=u.length;if(N(d)&&d.isCollapsed()){const g=d.anchor;g.key===a&&(f=g.offset)}const h=Tv(c,u,f);l.spliceText(h.index,h.remove,h.insert)})(this,t.__key,o,s),this._text=s)}}syncPropertiesAndTextFromYjs(e,t){const r=this.getNode();r===null&&Be(84),Ku(e,this._map,r,t);const i=this._text;r.__text!==i&&r.setTextContent(i)}destroy(e){const t=e.collabNodeMap;t.get(this._key)===this&&t.delete(this._key)}}function h_(n,e,t,r){const i=new xt(n,e,t,r);return n._collabNode=i,i}class rn{_key;_children;_xmlText;_type;_parent;constructor(e,t,r){this._key="",this._children=[],this._xmlText=e,this._type=r,this._parent=t}getPrevNode(e){if(e===null)return null;const t=e.get(this._key);return A(t)?t:null}getNode(){const e=q(this._key);return A(e)?e:null}getSharedType(){return this._xmlText}getType(){return this._type}getKey(){return this._key}isEmpty(){return this._children.length===0}getSize(){return 1}getOffset(){const e=this._parent;return e===null&&Be(90),e.getChildOffset(this)}syncPropertiesFromYjs(e,t){const r=this.getNode();r===null&&Be(91),Ku(e,this._xmlText,r,t)}applyChildrenYjsDelta(e,t){const r=this._children;let i=0,s=null;for(let o=0;o<t.length;o++){const l=t[o],a=l.insert,c=l.delete;if(l.retain!=null)i+=l.retain;else if(typeof c=="number"){let u=c;for(;u>0;){const{node:d,nodeIndex:f,offset:h,length:g}=Oa(this,i,!1);if(d instanceof rn||d instanceof Ui||d instanceof er)r.splice(f,1),u-=1;else{if(!(d instanceof xt))break;{const p=Math.min(u,g),m=f!==0?r[f-1]:null,b=d.getSize();if(h===0&&g===b){r.splice(f,1);const _=Ii(d._text,h,p-1,"");_.length>0&&(m instanceof xt?m._text+=_:this._xmlText.delete(h,_.length))}else d._text=Ii(d._text,h,p,"");u-=p}}}}else{if(a==null)throw new Error("Unexpected delta format");if(typeof a=="string"){const{node:u,offset:d}=Oa(this,i,!0);u instanceof xt?u._text=Ii(u._text,d,0,a):this._xmlText.delete(d,a.length),i+=a.length}else{const u=a,{node:d,nodeIndex:f,length:h}=Oa(this,i,!1),g=p_(e,u,this);if(d instanceof xt&&h>0&&h<d._text.length){const p=d._text,m=p.length-h;d._text=Ii(p,m,h,""),r.splice(f+1,0,g),s=Ii(p,0,m,"")}else r.splice(f,0,g);s!==null&&g instanceof xt&&(g._text=s+g._text,s=null),i+=1}}}}syncChildrenFromYjs(e){const t=this.getNode();t===null&&Be(92);const r=t.__key,i=or(t,null),s=i.length,o=this._children,l=o.length,a=e.collabNodeMap,c=new Set;let u,d,f=0,h=null;l!==s&&(d=t.getWritable());for(let g=0;g<l;g++){const p=i[f],m=o[g],b=m.getNode(),_=m._key;if(b!==null&&p===_){const y=D(b);if(c.add(p),y)if(m._key=p,m instanceof rn){const S=m._xmlText;m.syncPropertiesFromYjs(e,null),m.applyChildrenYjsDelta(e,S.toDelta()),m.syncChildrenFromYjs(e)}else m instanceof xt?m.syncPropertiesAndTextFromYjs(e,null):m instanceof er?m.syncPropertiesFromYjs(e,null):m instanceof Ui||Be(93);h=b,f++}else{if(u===void 0){u=new Set;for(let C=0;C<l;C++){const x=o[C]._key;x!==""&&u.add(x)}}if(b!==null&&p!==void 0&&!u.has(p)){const C=Qn(p);jt(C),g--,f++;continue}d=t.getWritable();const y=Rv(e,m,r),S=y.__key;if(a.set(S,m),h===null){const C=d.getFirstChild();if(d.__first=S,C!==null){const x=C.getWritable();x.__prev=S,y.__next=x.__key}}else{const C=h.getWritable(),x=h.getNextSibling();if(C.__next=S,y.__prev=h.__key,x!==null){const v=x.getWritable();v.__prev=S,y.__next=v.__key}}g===l-1&&(d.__last=S),d.__size++,h=y}}for(let g=0;g<s;g++){const p=i[g];if(!c.has(p)){const m=Qn(p),b=e.collabNodeMap.get(p);b!==void 0&&b.destroy(e),jt(m)}}}syncPropertiesFromLexical(e,t,r){Wu(e,this._xmlText,this.getPrevNode(r),t)}_syncChildFromLexical(e,t,r,i,s,o){const l=this._children[t],a=Qn(r);l instanceof rn&&A(a)?(l.syncPropertiesFromLexical(e,a,i),l.syncChildrenFromLexical(e,a,i,s,o)):l instanceof xt&&D(a)?l.syncPropertiesAndTextFromLexical(e,a,i):l instanceof er&&V(a)&&l.syncPropertiesFromLexical(e,a,i)}syncChildrenFromLexical(e,t,r,i,s){const o=this.getPrevNode(r),l=o===null?[]:or(o,r),a=or(t,null),c=l.length-1,u=a.length-1,d=e.collabNodeMap;let f,h,g=0,p=0;for(;g<=c&&p<=u;){const _=l[g],y=a[p];if(_===y)this._syncChildFromLexical(e,p,y,r,i,s),g++,p++;else{f===void 0&&(f=new Set(l)),h===void 0&&(h=new Set(a));const S=h.has(_),C=f.has(y);if(S){const x=Oh(e,Qn(y),this);d.set(y,x),C?(this.splice(e,p,1,x),g++,p++):(this.splice(e,p,0,x),p++)}else this.splice(e,p,1),g++}}const m=g>c,b=p>u;if(m&&!b)for(;p<=u;++p){const _=a[p],y=Oh(e,Qn(_),this);this.append(y),d.set(_,y)}else if(b&&!m)for(let _=this._children.length-1;_>=p;_--)this.splice(e,_,1)}append(e){const t=this._xmlText,r=this._children,i=r[r.length-1],s=i!==void 0?i.getOffset()+i.getSize():0;if(e instanceof rn)t.insertEmbed(s,e._xmlText);else if(e instanceof xt){const o=e._map;o.parent===null&&t.insertEmbed(s,o),t.insert(s+1,e._text)}else e instanceof Ui?t.insertEmbed(s,e._map):e instanceof er&&t.insertEmbed(s,e._xmlElem);this._children.push(e)}splice(e,t,r,i){const s=this._children,o=s[t];if(o===void 0)return i===void 0&&Be(94),void this.append(i);const l=o.getOffset();l===-1&&Be(95);const a=this._xmlText;if(r!==0&&a.delete(l,o.getSize()),i instanceof rn)a.insertEmbed(l,i._xmlText);else if(i instanceof xt){const c=i._map;c.parent===null&&a.insertEmbed(l,c),a.insert(l+1,i._text)}else i instanceof Ui?a.insertEmbed(l,i._map):i instanceof er&&a.insertEmbed(l,i._xmlElem);if(r!==0){const c=s.slice(t,t+r);for(let u=0;u<c.length;u++)c[u].destroy(e)}i!==void 0?s.splice(t,r,i):s.splice(t,r)}getChildOffset(e){let t=0;const r=this._children;for(let i=0;i<r.length;i++){const s=r[i];if(s===e)return t;t+=s.getSize()}return-1}destroy(e){const t=e.collabNodeMap,r=this._children;for(let i=0;i<r.length;i++)r[i].destroy(e);t.get(this._key)===this&&t.delete(this._key)}}function Uu(n,e,t){const r=new rn(n,e,t);return n._collabNode=r,r}function Nv(n,e,t,r,i){t==null&&Be(81);const s={clientID:t.clientID,cursors:new Map,cursorsContainer:null,doc:t,docMap:r,editor:n,excludedProperties:i||new Map,id:e,nodeProperties:new Map};return(function(o){const{editor:l,nodeProperties:a}=o;l.update(()=>{l._nodes.forEach(c=>{const u=new c.klass,d={};for(const[f,h]of Object.entries(u))g_(f,u,o)||(d[f]=h);a.set(u.__type,Object.freeze(d))})})})(s),s}function Av(n,e,t,r,i,s){r==null&&Be(81);const o=Uu(r.get("root",Un),null,"root");return o._key="root",{...Nv(n,t,r,i,s),collabNodeMap:new Map,root:o}}function Ov(n){return Object.hasOwn(n,"collabNodeMap")}const Mv=new Set(["__key","__parent","__next","__prev","__state"]),$v=new Set(["__first","__last","__size"]),Iv=new Set(["__cachedText"]),Fv=new Set(["__text"]);function g_(n,e,t){if(Mv.has(n)||typeof e[n]=="function")return!0;if(D(e)){if(Fv.has(n))return!0}else if(A(e)&&($v.has(n)||be(e)&&Iv.has(n)))return!0;const r=e.constructor,i=t.excludedProperties.get(r);return i!=null&&i.has(n)}function Dv(n,e){const t=n.__type,{nodeProperties:r}=e,i=r.get(t);return i===void 0&&Be(330,t),i}function Oh(n,e,t){const r=e.__type;let i;if(A(e))i=Uu(new Un,t,r),i.syncPropertiesFromLexical(n,e,null),i.syncChildrenFromLexical(n,e,null,null,null);else if(D(e))i=h_(new yt,e.__text,t,r),i.syncPropertiesAndTextFromLexical(n,e,null);else if(ue(e)){const s=new yt;s.set("__type","linebreak"),i=f_(s,t)}else V(e)?(i=d_(new _n,t,r),i.syncPropertiesFromLexical(n,e,null)):Be(86);return i._key=e.__key,i}function Lv(n){const e=Rl(n,"__type");return typeof e!="string"&&e!==void 0&&Be(87),e}function p_(n,e,t){const r=e._collabNode;if(r===void 0){const i=n.editor._nodes,s=Lv(e);typeof s!="string"&&Be(87),i.get(s)===void 0&&Be(88,s);const o=e.parent,l=t===void 0&&o!==null?p_(n,o):t||null;if(l instanceof rn||Be(89),e instanceof Un)return Uu(e,l,s);if(e instanceof yt)return s==="linebreak"?f_(e,l):h_(e,"",l,s);if(e instanceof _n)return d_(e,l,s)}return r}function Rv(n,e,t){const r=e.getType(),i=n.editor._nodes.get(r);i===void 0&&Be(88,r);const s=new i.klass;if(s.__parent=t,e._key=s.__key,e instanceof rn){const o=e._xmlText;e.syncPropertiesFromYjs(n,null),e.applyChildrenYjsDelta(n,o.toDelta()),e.syncChildrenFromYjs(n)}else e instanceof xt?e.syncPropertiesAndTextFromYjs(n,null):e instanceof er&&e.syncPropertiesFromYjs(n,null);return n.collabNodeMap.set(s.__key,e),s}function Ku(n,e,t,r){const i=r===null?e instanceof yt?Array.from(e.keys()):e instanceof Un||e instanceof _n?Object.keys(e.getAttributes()):Object.keys(e):Array.from(r);let s;for(let o=0;o<i.length;o++){const l=i[o];if(g_(l,t,n)){l==="__state"&&Ov(n)&&(s||(s=t.getWritable()),Pv(e,s));continue}const a=t[l];let c=Rl(e,l);if(a!==c){if(c instanceof Bn){const u=n.docMap;a instanceof Bn&&u.delete(a.guid);const d=gi(),f=c.guid;d._key=f,u.set(f,c),c=d}s===void 0&&(s=t.getWritable()),s[l]=c}}}function Rl(n,e){return n instanceof yt?n.get(e):n instanceof Un||n instanceof _n?n.getAttribute(e):n[e]}function Mh(n,e,t){n instanceof yt?n.set(e,t):n.setAttribute(e,t)}function Pv(n,e){const t=Rl(n,"__state");t instanceof yt&&Jo(e).updateFromJSON(t.toJSON())}function Wu(n,e,t,r){const i=Object.keys(Dv(r,n)),s=n.editor.constructor;(function(o,l,a,c){const u=c.__state,d=Rl(l,"__state");if(!u)return;const[f,h]=u.getInternalState(),g=a&&a.__state,p=d instanceof yt?d:new yt;if(g===u)return;const[m,b]=g&&p.doc?g.getInternalState():[void 0,new Map];if(f)for(const[_,y]of Object.entries(f))m&&y!==m[_]&&p.set(_,y);for(const[_,y]of h)b.get(_)!==y&&p.set(_.key,_.unparse(y));d||Mh(l,"__state",p)})(0,e,t,r);for(let o=0;o<i.length;o++){const l=i[o],a=t===null?void 0:t[l];let c=r[l];if(a!==c){if(c instanceof s){const u=n.docMap;let d;if(a instanceof s){const g=a._key;d=u.get(g),u.delete(g)}const f=d||new Bn,h=f.guid;c._key=h,u.set(h,f),c=f,n.editor.update(()=>{r.markDirty()})}Mh(e,l,c)}}}function Ii(n,e,t,r){return n.slice(0,e)+r+n.slice(e+t)}function Oa(n,e,t){let r=0,i=0;const s=n._children,o=s.length;for(;i<o;i++){const l=s[i],a=r;if(r+=l.getSize(),(t?r>=e:r>e)&&l instanceof xt){let c=e-a-1;return c<0&&(c=0),{length:r-e,node:l,nodeIndex:i,offset:c}}if(r>e)return{length:0,node:l,nodeIndex:i,offset:a};if(i===o-1)return{length:0,node:null,nodeIndex:i+1,offset:a+1}}return{length:0,node:null,nodeIndex:0,offset:0}}Tc("ychange",{isEqual:(n,e)=>n===e,parse:n=>n??null});async function m_(){return hb}async function Pl(n){return ox(n)}async function Bl(n){return mS(n)}async function zl(n,e){const t=qp(),r=e?.delay??300;return Yp(n,t,r)}async function Ul(n){return()=>{}}async function Kl(n){return typeof da=="function"?typeof hf=="function"?pt(da(n),hf(n)):da(n):pt(n.registerCommand(xi,()=>(fa(n,"number"),!0),G),n.registerCommand(bi,()=>(fa(n,"bullet"),!0),G),n.registerCommand(xl,()=>(fa(n,"check"),!0),G),n.registerCommand(pu,()=>(px(n),!0),G))}async function Wl(n){return n.registerCommand(lc,e=>(e===null||typeof e=="string"?ha(e):ha(e.url,e),!0),G)}async function Bv(n,e,t){const r=e?.trigger||"/";let i=!1,s=null,o=0;const l=()=>n.getEditorState().read(()=>{const p=O();if(!N(p)||!p.isCollapsed())return!1;const m=p.anchor,b=m.getNode();if(!D(b))return!1;const _=b.getTextContent(),y=m.offset;if(y===0||_[y-1]!==r)return!1;if(y===1)return!0;const C=_[y-2];return!!/\s/.test(C)}),a=()=>s?n.getEditorState().read(()=>{if(!s)return"";const p=s.getTextContent(),m=p.indexOf(r,o);if(m===-1)return"";const b=O();if(!N(b))return"";const _=b.anchor;if(_.getNode().getKey()!==s.getKey())return"";const S=_.offset;return S<=m?"":p.slice(m+1,S)}):"",c=()=>{n.getEditorState().read(()=>{const p=O();if(N(p)){const m=p.anchor,b=m.getNode();if(D(b)){s=b,o=m.offset-1,i=!0;const _={isActive:!0,filterText:"",anchorNode:s,anchorOffset:o};t?.onTrigger?.(_,d),t?.onUpdate?.(_,d)}}})},u=()=>{i&&(i=!1,s=null,o=0,t?.onDismiss?.())},d=()=>{s&&n.update(()=>{if(!s)return;const p=s.getTextContent(),m=p.indexOf(r,o);if(m===-1)return;const b=O();if(!N(b))return;const _=b.anchor;if(_.getNode().getKey()!==s.getKey())return;const S=_.offset,C=p.slice(0,m),x=p.slice(S);s.setTextContent(C+x);const v=O();N(v)&&(v.anchor.set(s.getKey(),m,"text"),v.focus.set(s.getKey(),m,"text"))})},f=()=>{if(!i)return;const m={isActive:!0,filterText:a(),anchorNode:s,anchorOffset:o};t?.onUpdate?.(m,d)},h=n.registerMutationListener(Ye,p=>{if(!i&&l()){c();return}i&&(s&&!p.has(s.getKey())?f():u())}),g=pt(n.registerUpdateListener(({editorState:p})=>{p.read(()=>{if(!i)return;const m=O();if(!N(m)){u();return}const b=m.anchor,_=b.getNode();if(!s||_.getKey()!==s.getKey()){u();return}const S=s.getTextContent().indexOf(r,o);if(S===-1||b.offset<=S){u();return}})}),n.registerCommand(dr,p=>i?(p.preventDefault(),!0):!1,G),n.registerCommand(dn,p=>i?(p.preventDefault(),!0):!1,G),n.registerCommand(Dn,p=>i?(p?.preventDefault(),!0):!1,G),n.registerCommand(ui,p=>i?(p?.preventDefault(),u(),!0):!1,G));return()=>{u(),h(),g()}}function zv(n,e,t){t(),e.handler(n),n.focus()}const Uv=z("TOGGLE_SLASH_COMMAND_PALETTE"),Ms=z("INSERT_HORIZONTAL_RULE_COMMAND"),Kv=z("INSERT_IMAGE_COMMAND");function jl(n){return n.registerCommand(Ms,()=>{const e=O();if(!N(e))return!1;if(e.focus.getNode()!==null){const r=Ns();e.insertNodes([r]);const i=H();r.insertAfter(i),i.selectStart()}return!0},G)}const __={dependencies:[Ir],export:n=>Vp(n)?"---":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(n,e,t,r)=>{const i=Ns();if(r)n.replace(i);else{n.replace(i);const s=H();i.insertAfter(s),s.selectStart()}},type:"element"},ju=[...wu,__];async function wt(n){let e="";return n.getEditorState().read(()=>{e=qS(ju)}),e}async function Kn(n,e){n.update(()=>{YS(e,ju)})}async function y_(){return ju}const Hu=Object.freeze(Object.defineProperty({__proto__:null,exportToMarkdown:wt,getMarkdownTransformers:y_,importFromMarkdown:Kn},Symbol.toStringTag,{value:"Module"}));async function vt(n){let e="";return n.getEditorState().read(()=>{e=fp(n)}),e}async function Wn(n,e){n.update(()=>{const r=new DOMParser().parseFromString(e,"text/html"),i=dp(n,r);fe().clear(),nl(i)})}const Ju=Object.freeze(Object.defineProperty({__proto__:null,exportToHtml:vt,importFromHtml:Wn},Symbol.toStringTag,{value:"Module"}));async function Wv(n,e,t){let r,i,s;switch(e){case"markdown":r=await wt(n),i="text/markdown",s="md";break;case"html":r=await vt(n),i="text/html",s="html";break;case"json":r=JSON.stringify(n.getEditorState().toJSON(),null,2),i="application/json",s="json";break}const o=new Blob([r],{type:i}),l=URL.createObjectURL(o),a=document.createElement("a");a.href=l,a.download=t??`document.${s}`,a.click(),URL.revokeObjectURL(l)}async function jv(n,e,t){const r=await new Promise((s,o)=>{const l=new FileReader;l.onload=()=>s(l.result),l.onerror=()=>o(l.error),l.readAsText(e)});switch(t??Hv(e.name)){case"markdown":{const{importFromMarkdown:s}=await Promise.resolve().then(()=>Hu);await s(n,r);break}case"html":{const{importFromHtml:s}=await Promise.resolve().then(()=>Ju);await s(n,r);break}case"json":{const s=n.parseEditorState(r);n.setEditorState(s);break}}}function Hv(n){return n.endsWith(".md")||n.endsWith(".markdown")?"markdown":n.endsWith(".html")||n.endsWith(".htm")?"html":"json"}async function Hl(n,e){return typeof vf=="function"?vf(n):()=>{}}async function Jv(n,e=3,t=3){n.dispatchCommand(Ts,{rows:String(e),columns:String(t),includeHeaders:!0})}async function Gv(n,e){return typeof Fo=="function"?Fo(n):()=>{}}async function Vv(n,e){return typeof Fo=="function"?Fo(n):()=>{}}const Yv=/#[\w\u0590-\u05ff]+/;function qv(n){return new Cl(n)}async function Zv(n,e){const t=[],r=rS(n,i=>{const s=Yv.exec(i);return s?{start:s.index,end:s.index+s[0].length}:null},Cl,qv);if(Array.isArray(r)?t.push(...r):typeof r=="function"&&t.push(r),e?.onHashtagClick){const i=n.registerCommand(br,s=>{const o=s.target;if(o.classList.contains("bc-lexical-hashtag")){const l=o.textContent;if(l)return e.onHashtagClick(l.replace("#","")),!0}return!1},G);t.push(i)}return()=>{t.forEach(i=>i())}}const Xv=/((https?:\/\/(www\.)?|www\.)[^\s<>]+)/g,Qv=/([a-zA-Z0-9._+-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/g,e0=[{pattern:Xv,urlTransformer:n=>n.startsWith("http")?n:`https://${n}`},{pattern:Qv,urlTransformer:n=>`mailto:${n}`}];async function t0(n,e){const t=e?.matchers??e0;return n.registerMutationListener(Ye,r=>{n.update(()=>{for(const[i,s]of r){if(s!=="created"&&s!=="updated")continue;const o=q(i);if(!o||!D(o))continue;const l=o.getTextContent();for(const a of t){const c=new RegExp(a.pattern.source,a.pattern.flags);let u;for(;(u=c.exec(l))!==null;)a.urlTransformer(u[0])}}})})}async function n0(n,e){const t=[];return e?.onMarkClick&&t.push(n.registerCommand(br,r=>{const i=r.target;if(i.classList.contains("bc-lexical-mark")){const s=i.dataset.markId;if(s)return e.onMarkClick(s,{id:s,type:i.dataset.markType||"annotation",data:{}}),!0}return!1},G)),()=>t.forEach(r=>r())}async function r0(n,e,t){n.update(()=>{const r=O();N(r)&&oS(r,r.isBackward(),e)})}async function i0(n,e){n.update(()=>{const r=fe().getAllTextNodes().filter(i=>{const s=i.getParent();return as(s)?lS(i,0)?.includes(e)??!1:!1});for(const i of r){const s=i.getParent();as(s)&&sS(s)}})}async function s0(n,e){const{maxLength:t,onOverflow:r}=e;return n.registerUpdateListener(({editorState:i})=>{i.read(()=>{const l=fe().getTextContent().length,a=l>t;r&&r(a,l)})})}async function Jl(n){return typeof ef=="function"?ef(n):()=>{}}async function Gl(n,e){const t=e.docMap??new Map,r=e.id??"lexical",i=e.doc.getText(r),s=Av(n,e.provider,i,e.doc,t),o=n.registerUpdateListener(()=>{});return()=>{o(),s&&typeof s.destroy=="function"&&s.destroy()}}function o0(n){let e={hasSelection:!1,selectedText:"",anchorOffset:0,focusOffset:0};return n.getEditorState().read(()=>{const t=O();N(t)&&(e={hasSelection:!t.isCollapsed(),selectedText:t.getTextContent(),anchorOffset:t.anchor.offset,focusOffset:t.focus.offset})}),e}function Gu(n){let e="";return n.getEditorState().read(()=>{e=fe().getTextContent()}),e}function l0(n){return Gu(n).length}function a0(n){const e=Gu(n).trim();return e?e.split(/\s+/).length:0}async function c0(){return eC}async function $s(n={}){const{nodes:e=[],plugins:t=[],onError:r}=n,s=(await m_()).createEditor({namespace:"BeatUIHeadless",nodes:e,onError:o=>{r?r(o,s):console.error("[BeatUI Headless]",o)},editable:!1});if(t.length>0)for(const o of t)o.register(s);return s}async function u0(n){const e=await $s(),{importFromMarkdown:t}=await Promise.resolve().then(()=>Hu);return await t(e,n),e.getEditorState().toJSON()}async function d0(n){const e=await $s(),{exportToMarkdown:t}=await Promise.resolve().then(()=>Hu),r=e.parseEditorState(JSON.stringify(n));return e.setEditorState(r),await t(e)}async function f0(n){const e=await $s(),{importFromHtml:t}=await Promise.resolve().then(()=>Ju);return await t(e,n),e.getEditorState().toJSON()}async function h0(n){const e=await $s(),{exportToHtml:t}=await Promise.resolve().then(()=>Ju),r=e.parseEditorState(JSON.stringify(n));return e.setEditorState(r),await t(e)}const b_=n=>{const{value:e,format:t,plugins:r,readOnly:i,placeholder:s,class:o,namespace:l="BeatUILexical",heightMode:a="auto",onError:c,onInput:u,onChange:d,onBlur:f,onReady:h}=n;return w.Use(vc.Theme,({appearance:g})=>w.html.div(w.Task(()=>Promise.resolve().then(()=>require("../styles-url-CEDSZTyZ.cjs")),({default:p})=>wc.LinkPortal({id:"beatui-lexical-css",href:p})),w.attr.class("bc-lexical-editor-container"),a==="fixed"?w.attr.class("bc-lexical-editor-container--fixed"):null,w.attr.class(o),w.html.div(w.attr.class("bc-lexical-editor"),w.attr.class(`bc-lexical-editor--${a}`),w.attr.contenteditable(i!=null?w.Value.map(i,p=>p?"false":"true"):"true"),i!=null?w.attr.class(w.Value.map(i,p=>p?"bc-lexical-editor--readonly":"")):null,w.WithElement(p=>{let m=null;const b=[];return(async()=>{try{const y=r??vl("bare"),S=wl(y),C=w.Value.get(t??"markdown"),x=gi({namespace:l,nodes:S,theme:{heading:{h1:"bc-lexical-h1",h2:"bc-lexical-h2",h3:"bc-lexical-h3",h4:"bc-lexical-h4",h5:"bc-lexical-h5",h6:"bc-lexical-h6"},text:{bold:"bc-lexical-bold",italic:"bc-lexical-italic",underline:"bc-lexical-underline",strikethrough:"bc-lexical-strikethrough",code:"bc-lexical-code"},list:{ul:"bc-lexical-ul",ol:"bc-lexical-ol",listitem:"bc-lexical-li",listitemChecked:"bc-lexical-li-checked",listitemUnchecked:"bc-lexical-li-unchecked"},link:"bc-lexical-link",quote:"bc-lexical-blockquote",code:"bc-lexical-code-block",codeHighlight:{},hashtag:"bc-lexical-hashtag",table:"bc-lexical-table",tableCell:"bc-lexical-table-cell",tableCellHeader:"bc-lexical-table-cell-header",tableRow:"bc-lexical-table-row",mark:"bc-lexical-mark",paragraph:"bc-lexical-paragraph"},onError:E=>{c?c(E,x):console.error("[BeatUI Lexical]",E)},editable:i?!w.Value.get(i):!0});m=x,x.setRootElement(p);const v=[];if(y.richText?v.push(Pl(x)):y.plainText&&v.push(Bl(x)),y.history){const E=typeof y.history=="object"?y.history:void 0;v.push(zl(x,E))}if(y.clipboard&&v.push(Ul(x)),y.list&&v.push(Kl(x)),y.link&&v.push(Wl(x)),y.yjs&&v.push(Gl(x,y.yjs)),y.dragon&&v.push(Jl(x)),y.table&&v.push(Hl(x)),(await Promise.all(v)).forEach(E=>{E&&b.push(E)}),b.push(jl(x)),e!=null){const E=w.Value.get(e);if(E!=null&&(E!==""||C==="json"&&typeof E=="object")){if(C==="markdown"&&typeof E=="string")await Kn(x,E);else if(C==="html"&&typeof E=="string")await Wn(x,E);else if(C==="json"&&typeof E=="object")try{const T=JSON.stringify(E),I=x.parseEditorState(T);x.setEditorState(I)}catch(T){console.error("[BeatUI] Failed to parse JSON editor state:",T),c&&c(T instanceof Error?T:new Error(String(T)),x)}}}b.push(x.registerUpdateListener(({editorState:E,dirtyElements:M,dirtyLeaves:T})=>{M.size===0&&T.size===0||u&&E.read(async()=>{if(C==="markdown"){const I=await wt(x);u(I,x)}else if(C==="html"){const I=await vt(x);u(I,x)}else C==="json"&&u(E.toJSON(),x)})})),e!=null&&b.push(w.Value.on(e,async E=>{if(E!=null){if(C==="markdown"&&typeof E=="string"){const M=await wt(x);E!==M&&await Kn(x,E)}else if(C==="html"&&typeof E=="string"){const M=await vt(x);E!==M&&await Wn(x,E)}else if(C==="json"&&typeof E=="object"){const M=JSON.stringify(x.getEditorState().toJSON()),T=JSON.stringify(E);if(M!==T){const I=x.parseEditorState(T);x.setEditorState(I)}}}})),i!=null&&b.push(w.Value.on(i,E=>{x.setEditable(!E)})),b.push(x.registerCommand(fi,()=>(f&&f(x),d&&x.getEditorState().read(async()=>{if(C==="markdown"){const E=await wt(x);d(E,x)}else if(C==="html"){const E=await vt(x);d(E,x)}else C==="json"&&d(x.getEditorState().toJSON(),x)}),!1),G)),b.push(g.on(E=>{const M=x.getRootElement();M&&(M.dataset.theme=E)})),h&&h(x)}catch(y){console.error("[BeatUI] Failed to initialize Lexical editor:",y);const S=p;S.textContent="Failed to load Lexical editor."}})(),w.OnDispose(()=>{try{b.forEach(y=>y())}catch{}try{m?.setRootElement(null)}catch{}})}))))};function x_(n,e,t){const r=(h,g)=>e.map(()=>{const p=n.value;return p?p.getEditorState().read(()=>{const m=O();return N(m)?h(m):g}):g}),i=h=>{const g=h.anchor.getNode();return g.getKey()==="root"?g:g.getTopLevelElementOrThrow()};return{withSelection:r,getAnchorElement:i,textFormatActive:h=>r(g=>g.hasFormat(h),!1),blockTypeActive:h=>r(g=>i(g).getType()===h,!1),listTypeActive:h=>r(g=>{const p=i(g).getParent();return J(p)&&p.getListType()===h},!1),headingActive:h=>e.map(()=>{const g=n.value;return g?g.getEditorState().read(()=>{const p=O();if(N(p)){const m=i(p);if(m.getType()==="heading")return g.getElementByKey(m.getKey())?.tagName===`H${h}`}return!1}):!1}),linkActive:()=>r(h=>{const g=h.anchor.getNode();return g.getParent()?.getType()==="link"||g.getType()==="link"},!1),dispatch:(h,g)=>()=>{const p=n.value;p&&(p.dispatchCommand(h,g),p.focus())},toggleBlock:(h,g)=>()=>{const p=n.value;p&&(p.update(()=>{const m=O();if(N(m)){const b=i(m);et(m,()=>b.getType()===h?H():g())}}),p.focus())},toggleLink:()=>{const h=n.value;h&&(h.getEditorState().read(()=>{const g=O();if(N(g)){const p=g.anchor.getNode();if(p.getParent()?.getType()==="link"||p.getType()==="link")h.dispatchCommand(lc,null);else{const _=prompt(t?.enterUrlMessage?.()??"Enter URL:");_&&h.dispatchCommand(lc,_)}}}),h.focus())}}}function S_(n,e){return t=>r=>ct.EditorToolbarButton({...r,display:t,disabled:n,size:e})}const g0=[{value:"Arial",label:"Arial"},{value:"Courier New",label:"Courier New"},{value:"Georgia",label:"Georgia"},{value:"Times New Roman",label:"Times New Roman"},{value:"Trebuchet MS",label:"Trebuchet MS"},{value:"Verdana",label:"Verdana"}],p0=[{value:"10px",label:"10"},{value:"12px",label:"12"},{value:"14px",label:"14"},{value:"16px",label:"16"},{value:"18px",label:"18"},{value:"20px",label:"20"},{value:"24px",label:"24"},{value:"30px",label:"30"},{value:"36px",label:"36"}];function C_({editor:n,stateUpdate:e,toolbar:t={},readOnly:r=w.signal(!1),size:i="sm"}){const{visibleGroups:s,hiddenGroups:o,maxHeadingLevel:l=3}=t,a=c=>!(o?.includes(c)||s&&!s.includes(c));return w.Use(nr.BeatUII18n,c=>w.Ensure(n,u=>{const d=u,f=c.$.lexical,h=w.signal(a("text-formatting")),g=w.signal(a("headings")),p=w.signal(a("lists")),m=w.signal(a("blocks")),b=w.signal(a("links")),_=w.signal(a("indent")),y=w.signal(a("tables")),S=w.signal(a("history")),C=w.signal(a("clipboard")),x=w.signal(a("font")),v=w.signal(a("color")),k=w.signal(a("clear-formatting")),{getAnchorElement:E,textFormatActive:M,blockTypeActive:T,listTypeActive:I,headingActive:K,linkActive:$,dispatch:R,toggleBlock:W,toggleLink:Z}=x_(d,e,{enterUrlMessage:()=>c.value.lexical.enterUrl}),Y=S_(r,i),se=()=>{const F=d.value;F&&(F.update(()=>{const U=O();N(U)&&et(U,()=>H())}),F.focus())},Ke=F=>{const U=d.value;U&&(U.update(()=>{const X=O();if(N(X)){const Gn=E(X),Is=`h${F}`,B_=U.getElementByKey(Gn.getKey());Gn.getType()==="heading"&&B_?.tagName===`H${F}`?et(X,()=>H()):et(X,()=>ft(Is))}}),U.focus())},qe=Y(h),j=Y(g),pe=Y(p),oe=Y(m),Ze=Y(b),Se=Y(_),We=Y(y),Xe=Y(k),bt=Y(S),Ce=Y(C),wn=()=>{const F=d.value;if(!F)return;const U=F.getRootElement();U&&(U.focus(),document.execCommand("copy"))},Ti=()=>{const F=d.value;if(!F)return;const U=F.getRootElement();U&&(U.focus(),document.execCommand("cut"))},Zt=()=>{const F=d.value;F&&navigator.clipboard.readText().then(U=>{F.update(()=>{const X=O();N(X)&&X.insertText(U)}),F.focus()}).catch(()=>{})},Ni=()=>{const F=d.value;F&&(F.update(()=>{const U=O();if(N(U))for(const X of U.getNodes())D(X)&&(X.setFormat(0),X.setStyle(""))}),F.focus())},Vl=()=>{const F=d.value;F&&(F.dispatchCommand(Ts,{rows:"3",columns:"3",includeHeaders:!0}),F.focus())},Vu={value:"",label:c.value.lexical.defaultOption},T_=[Vu,...t.fontFamilies??g0],N_=[Vu,...t.fontSizes??p0],A_=e.map(()=>{const F=d.value;return F?F.getEditorState().read(()=>{const U=O();return N(U)?zs(U,"font-family",""):""}):""}),O_=e.map(()=>{const F=d.value;return F?F.getEditorState().read(()=>{const U=O();return N(U)?zs(U,"font-size",""):""}):""}),M_=F=>{const U=d.value;U&&(U.update(()=>{const X=O();N(X)&&Bs(X,{"font-family":F||null})}),U.focus())},$_=F=>{const U=d.value;U&&(U.update(()=>{const X=O();N(X)&&Bs(X,{"font-size":F||null})}),U.focus())},I_=e.map(()=>{const F=d.value;return F?F.getEditorState().read(()=>{const U=O();return N(U)&&zs(U,"color","")||"#000000"}):"#000000"}),F_=e.map(()=>{const F=d.value;return F?F.getEditorState().read(()=>{const U=O();return N(U)&&zs(U,"background-color","")||"#ffffff"}):"#ffffff"}),D_=e.map(()=>{const F=d.value;return F?F.getEditorState().read(()=>{const U=O();if(N(U)){const X=E(U);return F.getElementByKey(X.getKey())?.style.backgroundColor||"#ffffff"}return"#ffffff"}):"#ffffff"}),L_=F=>{const U=d.value;U&&(U.update(()=>{const X=O();N(X)&&Bs(X,{color:F})}),U.focus())},R_=F=>{const U=d.value;U&&(U.update(()=>{const X=O();N(X)&&Bs(X,{"background-color":F})}),U.focus())},P_=F=>{const U=d.value;U&&(U.update(()=>{const X=O();if(N(X)){const Gn=E(X),Is=U.getElementByKey(Gn.getKey());Is&&(Is.style.backgroundColor=F)}}),U.focus())};return z_.Toolbar(w.attr.class("bc-lexical-toolbar"),w.When(x,()=>ct.EditorToolbarGroup({display:[x]},w.html.select(w.attr.class("bc-lexical-toolbar-select"),w.attr.title(f.map(F=>F.fontFamily)),w.attr.disabled(r),w.on.change(F=>M_(F.target.value)),...T_.map(F=>w.html.option(w.attr.value(F.value),w.attr.selected(A_.map(U=>U===F.value)),F.label))),w.html.select(w.attr.class("bc-lexical-toolbar-select"),w.attr.title(f.map(F=>F.fontSize)),w.attr.disabled(r),w.on.change(F=>$_(F.target.value)),...N_.map(F=>w.html.option(w.attr.value(F.value),w.attr.selected(O_.map(U=>U===F.value)),F.label))))),w.When(v,()=>ct.EditorToolbarGroup({display:[v]},w.html.label(w.attr.class("bc-lexical-toolbar-color"),w.attr.title(f.map(F=>F.fontColor)),w.html.input(w.attr.type("color"),w.attr.value(I_),w.attr.disabled(r),w.on.input(F=>L_(F.target.value))),w.html.span(w.attr.class("bc-lexical-toolbar-color-icon"),"A")),w.html.label(w.attr.class("bc-lexical-toolbar-color"),w.attr.title(f.map(F=>F.highlightColor)),w.html.input(w.attr.type("color"),w.attr.value(F_),w.attr.disabled(r),w.on.input(F=>R_(F.target.value))),w.html.span(w.attr.class("bc-lexical-toolbar-color-icon bc-lexical-toolbar-color-icon--highlight"),"A")),w.html.label(w.attr.class("bc-lexical-toolbar-color"),w.attr.title(f.map(F=>F.backgroundColor)),w.html.input(w.attr.type("color"),w.attr.value(D_),w.attr.disabled(r),w.on.input(F=>P_(F.target.value))),w.html.span(w.attr.class("bc-lexical-toolbar-color-icon bc-lexical-toolbar-color-icon--bg"),"■")))),ct.EditorToolbarGroup({display:Array(5).fill(h)},qe({active:M("bold"),onClick:R(ve,"bold"),label:f.map(F=>F.bold),icon:"mdi:format-bold"}),qe({active:M("italic"),onClick:R(ve,"italic"),label:f.map(F=>F.italic),icon:"mdi:format-italic"}),qe({active:M("underline"),onClick:R(ve,"underline"),label:f.map(F=>F.underline),icon:"mdi:format-underline"}),qe({active:M("strikethrough"),onClick:R(ve,"strikethrough"),label:f.map(F=>F.strikethrough),icon:"mdi:format-strikethrough"}),qe({active:M("code"),onClick:R(ve,"code"),label:f.map(F=>F.code),icon:"mdi:code-tags"})),ct.EditorToolbarGroup({display:[k]},Xe({active:w.signal(!1),onClick:Ni,label:f.map(F=>F.clearFormatting),icon:"mdi:format-clear"})),ct.EditorToolbarGroup({display:[g,...Array(l).fill(g)]},j({active:T("paragraph"),onClick:se,label:f.map(F=>F.normal),icon:"mdi:format-paragraph"}),...Array.from({length:l},(F,U)=>{const X=U+1;return j({active:K(X),onClick:()=>Ke(X),label:f.map(Gn=>Gn.heading(X)),icon:`mdi:format-header-${X}`})})),ct.EditorToolbarGroup({display:Array(3).fill(p)},pe({active:I("bullet"),onClick:R(bi,void 0),label:f.map(F=>F.bulletList),icon:"mdi:format-list-bulleted"}),pe({active:I("number"),onClick:R(xi,void 0),label:f.map(F=>F.orderedList),icon:"mdi:format-list-numbered"}),pe({active:I("check"),onClick:R(xl,void 0),label:f.map(F=>F.checkList),icon:"mdi:format-list-checks"})),ct.EditorToolbarGroup({display:Array(2).fill(_)},Se({active:w.signal(!1),onClick:R(Ut,void 0),label:f.map(F=>F.indent),icon:"mdi:format-indent-increase"}),Se({active:w.signal(!1),onClick:R(sn,void 0),label:f.map(F=>F.outdent),icon:"mdi:format-indent-decrease"})),ct.EditorToolbarGroup({display:Array(3).fill(m)},oe({active:T("quote"),onClick:W("quote",yi),label:f.map(F=>F.blockquote),icon:"mdi:format-quote-close"}),oe({active:T("code"),onClick:W("code",St),label:f.map(F=>F.codeBlock),icon:"mdi:code-braces"}),oe({active:w.signal(!1),onClick:R(Ms,void 0),label:f.map(F=>F.horizontalRule),icon:"mdi:minus"})),ct.EditorToolbarGroup({display:[y]},We({active:w.signal(!1),onClick:Vl,label:f.map(F=>F.insertTable),icon:"mdi:table-plus"})),ct.EditorToolbarGroup({display:[b]},Ze({active:$(),onClick:Z,label:f.map(F=>F.link),icon:"mdi:link"})),ct.EditorToolbarGroup({display:Array(2).fill(S)},bt({active:w.signal(!1),onClick:R(ai,void 0),label:f.map(F=>F.undo),icon:"mdi:undo"}),bt({active:w.signal(!1),onClick:R(ci,void 0),label:f.map(F=>F.redo),icon:"mdi:redo"})),ct.EditorToolbarGroup({display:Array(3).fill(C)},Ce({active:w.signal(!1),onClick:Ti,label:f.map(F=>F.cut),icon:"mdi:content-cut"}),Ce({active:w.signal(!1),onClick:wn,label:f.map(F=>F.copy),icon:"mdi:content-copy"}),Ce({active:w.signal(!1),onClick:Zt,label:f.map(F=>F.paste),icon:"mdi:content-paste"})))}))}function w_({editor:n,stateUpdate:e,readOnly:t=w.signal(!1)}){const r=w.prop(!1),i=w.prop(0),s=w.prop(0),o=()=>{const p=n.value;if(!p){r.value=!1;return}p.getEditorState().read(()=>{const m=O();if(!N(m)){r.value=!1;return}let _=m.anchor.getNode(),y=null;for(;_;){if(ge(_)){y=_;break}if(_=_.getParent(),!_||_.getKey()==="root")break}if(!y){r.value=!1;return}const S=p.getElementByKey(y.getKey()),C=p.getRootElement();if(S&&C){const x=S.getBoundingClientRect(),v=C.closest(".bc-lexical-editor-container"),k=v?v.getBoundingClientRect():C.getBoundingClientRect();i.value=x.bottom-k.top+4,s.value=x.left-k.left}r.value=!0})};e.onChange(o);const l=()=>{const p=n.value;p&&(p.update(()=>{yf(!1)}),p.focus())},a=()=>{const p=n.value;p&&(p.update(()=>{yf(!0)}),p.focus())},c=()=>{const p=n.value;p&&(p.update(()=>{bf(!1)}),p.focus())},u=()=>{const p=n.value;p&&(p.update(()=>{bf(!0)}),p.focus())},d=()=>{const p=n.value;p&&(p.update(()=>{xx()}),p.focus())},f=()=>{const p=n.value;p&&(p.update(()=>{Sx()}),p.focus())},h=()=>{const p=n.value;p&&(p.update(()=>{const m=O();if(!N(m))return;const b=m.anchor.getNode(),_=bx(b);if(!_)return;Fp(_).remove()}),p.focus())},g=w.html.div(w.attr.class("bc-table-context-menu"),w.attr.role("menu"),w.style.position("absolute"),w.style.top(i.map(p=>`${p}px`)),w.style.left(s.map(p=>`${p}px`)),w.style.zIndex("1000"),w.style.backgroundColor("var(--color-surface)"),w.style.border("1px solid var(--color-border)"),w.style.borderRadius("var(--radius-md)"),w.style.boxShadow("0 2px 8px rgba(0, 0, 0, 0.15)"),w.style.padding("var(--spacing-xs)"),w.style.minWidth("180px"),w.WithElement(p=>{const m=_=>{if(_.key==="Escape"&&r.value){r.value=!1;const y=n.value;y&&y.focus()}},b=_=>{if(r.value&&!p.contains(_.target)){const y=n.value;if(y){const S=y.getRootElement();if(S&&S.contains(_.target))return}r.value=!1}};return document.addEventListener("keydown",m),document.addEventListener("mousedown",b),w.OnDispose(()=>{document.removeEventListener("keydown",m),document.removeEventListener("mousedown",b)})}),Yn("Insert row above",l,t),Yn("Insert row below",a,t),Yn("Insert column left",c,t),Yn("Insert column right",u,t),w.html.div(w.attr.class("bc-table-menu-separator"),w.style.height("1px"),w.style.backgroundColor("var(--color-border)"),w.style.margin("var(--spacing-xs) 0")),Yn("Delete row",d,t,"danger"),Yn("Delete column",f,t,"danger"),Yn("Delete table",h,t,"danger"));return w.When(r,()=>g)}function Yn(n,e,t,r="default"){return w.html.button(w.attr.class("bc-table-menu-button"),w.attr.type("button"),w.attr.role("menuitem"),w.attr.disabled(t),w.on.click(e),w.style.display("block"),w.style.width("100%"),w.style.padding("var(--spacing-xs) var(--spacing-sm)"),w.style.border("none"),w.style.backgroundColor("transparent"),w.style.color(r==="danger"?"var(--color-danger-600)":"var(--color-neutral-900)"),w.style.textAlign("left"),w.style.cursor("pointer"),w.style.borderRadius("var(--radius-sm)"),w.style.fontSize("0.875rem"),w.style.transition("background-color 0.15s"),w.html.span(n))}const m0=n=>{const{value:e,format:t,plugins:r,readOnly:i,placeholder:s,class:o,namespace:l="BeatUILexical",heightMode:a="fixed",toolbar:c,onError:u,onInput:d,onChange:f,onBlur:h,onReady:g}=n,p=w.prop(null),m=w.prop(0),b=y=>typeof y=="object"&&y!==null&&"map"in y&&typeof y.map=="function",_=i!=null?b(i)?i:w.prop(w.Value.get(i)):w.prop(!1);return w.Use(vc.Theme,({appearance:y})=>w.html.div(w.Task(()=>Promise.resolve().then(()=>require("../styles-url-CEDSZTyZ.cjs")),({default:S})=>wc.LinkPortal({id:"beatui-lexical-css",href:S})),w.attr.class("bc-lexical-editor-container"),a==="fixed"?w.attr.class("bc-lexical-editor-container--fixed"):null,w.attr.class(o),w.When(_.map(S=>!S),()=>C_({editor:p,stateUpdate:m,toolbar:c,readOnly:_,size:"sm"})),w_({editor:p,stateUpdate:m,readOnly:_}),w.html.div(w.attr.class("bc-lexical-editor"),w.attr.class(`bc-lexical-editor--${a}`),w.attr.contenteditable(i!=null?w.Value.map(i,S=>S?"false":"true"):"true"),i!=null?w.attr.class(w.Value.map(i,S=>S?"bc-lexical-editor--readonly":"")):null,w.WithElement(S=>{let C=null;const x=[];return(async()=>{try{const k=r??vl("docked"),E=wl(k),M=w.Value.get(t??"markdown"),T=gi({namespace:l,nodes:E,theme:{heading:{h1:"bc-lexical-h1",h2:"bc-lexical-h2",h3:"bc-lexical-h3",h4:"bc-lexical-h4",h5:"bc-lexical-h5",h6:"bc-lexical-h6"},text:{bold:"bc-lexical-bold",italic:"bc-lexical-italic",underline:"bc-lexical-underline",strikethrough:"bc-lexical-strikethrough",code:"bc-lexical-code"},list:{ul:"bc-lexical-ul",ol:"bc-lexical-ol",listitem:"bc-lexical-li",listitemChecked:"bc-lexical-li-checked",listitemUnchecked:"bc-lexical-li-unchecked"},link:"bc-lexical-link",quote:"bc-lexical-blockquote",code:"bc-lexical-code-block",codeHighlight:{},hashtag:"bc-lexical-hashtag",table:"bc-lexical-table",tableCell:"bc-lexical-table-cell",tableCellHeader:"bc-lexical-table-cell-header",tableRow:"bc-lexical-table-row",mark:"bc-lexical-mark",paragraph:"bc-lexical-paragraph"},onError:$=>{u?u($,T):console.error("[BeatUI Lexical]",$)},editable:i?!w.Value.get(i):!0});C=T,p.set(T),T.setRootElement(S);const I=[];if(k.richText?I.push(Pl(T)):k.plainText&&I.push(Bl(T)),k.history){const $=typeof k.history=="object"?k.history:void 0;I.push(zl(T,$))}if(k.clipboard&&I.push(Ul(T)),k.list&&I.push(Kl(T)),k.link&&I.push(Wl(T)),k.yjs&&I.push(Gl(T,k.yjs)),k.dragon&&I.push(Jl(T)),k.table&&I.push(Hl(T)),(await Promise.all(I)).forEach($=>{$&&x.push($)}),x.push(jl(T)),x.push(T.registerCommand(oi,()=>(m.set(m.value+1),!1),G)),x.push(T.registerUpdateListener(({editorState:$,dirtyElements:R,dirtyLeaves:W})=>{(R.size>0||W.size>0)&&m.set(m.value+1),d&&(R.size>0||W.size>0)&&$.read(async()=>{if(M==="markdown"){const Z=await wt(T);d(Z,T)}else if(M==="html"){const Z=await vt(T);d(Z,T)}else M==="json"&&d($.toJSON(),T)})})),e!=null){const $=w.Value.get(e);if($!=null&&($!==""||M==="json"&&typeof $=="object")){if(M==="markdown"&&typeof $=="string")await Kn(T,$);else if(M==="html"&&typeof $=="string")await Wn(T,$);else if(M==="json"&&typeof $=="object")try{const W=JSON.stringify($),Z=T.parseEditorState(W);T.setEditorState(Z)}catch(W){console.error("[BeatUI] Failed to parse JSON editor state:",W),u&&u(W instanceof Error?W:new Error(String(W)),T)}}}e!=null&&x.push(w.Value.on(e,async $=>{if($!=null){if(M==="markdown"&&typeof $=="string"){const R=await wt(T);$!==R&&await Kn(T,$)}else if(M==="html"&&typeof $=="string"){const R=await vt(T);$!==R&&await Wn(T,$)}else if(M==="json"&&typeof $=="object"){const R=JSON.stringify(T.getEditorState().toJSON()),W=JSON.stringify($);if(R!==W){const Z=T.parseEditorState(W);T.setEditorState(Z)}}}})),i!=null&&x.push(w.Value.on(i,$=>{T.setEditable(!$)})),x.push(T.registerCommand(fi,()=>(h&&h(T),f&&T.getEditorState().read(async()=>{if(M==="markdown"){const $=await wt(T);f($,T)}else if(M==="html"){const $=await vt(T);f($,T)}else M==="json"&&f(T.getEditorState().toJSON(),T)}),!1),G)),x.push(y.on($=>{const R=T.getRootElement();R&&(R.dataset.theme=$)})),g&&g(T)}catch(k){console.error("[BeatUI] Failed to initialize Lexical editor:",k);const E=S;E.textContent="Failed to load Lexical editor."}})(),w.OnDispose(()=>{try{x.forEach(k=>k())}catch{}try{C?.setRootElement(null)}catch{}p.set(null)})}))))};function v_({editor:n,stateUpdate:e,groups:t=["text-formatting"],readOnly:r=w.signal(!1),size:i="sm"}){const s=w.prop(!1),o=w.prop(0),l=w.prop(0);return w.Use(nr.BeatUII18n,a=>w.Ensure(n,c=>{const u=c,d=a.$.lexical,f=v=>t.includes(v),{textFormatActive:h,linkActive:g,dispatch:p,toggleLink:m}=x_(u,e,{enterUrlMessage:()=>a.value.lexical.enterUrl}),_=S_(r,i)(w.signal(!0)),y=()=>{const v=u.value;if(!v){s.value=!1;return}const k=v.getRootElement();if(!k){s.value=!1;return}const E=window.getSelection();if(!E||E.rangeCount===0||E.isCollapsed){s.value=!1;return}const M=E.anchorNode;if(M&&!k.contains(M)){s.value=!1;return}const I=E.getRangeAt(0).getBoundingClientRect();if(I.width===0&&I.height===0){s.value=!1;return}const K=40,$=8;let R=I.top-K-$;const W=I.left+I.width/2;R<0&&(R=I.bottom+$),o.value=R,l.value=W,s.value=!0},S=e.onChange(y),C=()=>{y()};document.addEventListener("selectionchange",C);const x=w.html.div(w.attr.class("bc-floating-toolbar"),w.style.position("fixed"),w.style.top(o.map(v=>`${v}px`)),w.style.left(l.map(v=>`${v}px`)),w.style.transform("translateX(-50%)"),w.WithElement(v=>{const k=M=>{if(M.key==="Escape"&&s.value){s.value=!1;const T=u.value;T&&T.focus()}},E=M=>{if(s.value&&!v.contains(M.target)){const T=u.value;if(T){const I=T.getRootElement();if(I&&I.contains(M.target))return}s.value=!1}};return document.addEventListener("keydown",k),document.addEventListener("mousedown",E),w.OnDispose(()=>{S(),document.removeEventListener("keydown",k),document.removeEventListener("mousedown",E),document.removeEventListener("selectionchange",C)})}),...f("text-formatting")?[_({active:h("bold"),onClick:p(ve,"bold"),label:d.map(v=>v.bold),icon:"mdi:format-bold"}),_({active:h("italic"),onClick:p(ve,"italic"),label:d.map(v=>v.italic),icon:"mdi:format-italic"}),_({active:h("underline"),onClick:p(ve,"underline"),label:d.map(v=>v.underline),icon:"mdi:format-underline"}),_({active:h("strikethrough"),onClick:p(ve,"strikethrough"),label:d.map(v=>v.strikethrough),icon:"mdi:format-strikethrough"}),_({active:h("code"),onClick:p(ve,"code"),label:d.map(v=>v.code),icon:"mdi:code-tags"})]:[],...f("links")?[_({active:g(),onClick:m,label:d.map(v=>v.link),icon:"mdi:link"})]:[],...f("clipboard")?[_({active:w.signal(!1),onClick:()=>{const v=u.value;if(!v)return;const k=v.getRootElement();k&&(k.focus(),document.execCommand("cut"))},label:d.map(v=>v.cut),icon:"mdi:content-cut"}),_({active:w.signal(!1),onClick:()=>{const v=u.value;if(!v)return;const k=v.getRootElement();k&&(k.focus(),document.execCommand("copy"))},label:d.map(v=>v.copy),icon:"mdi:content-copy"}),_({active:w.signal(!1),onClick:()=>{const v=u.value;v&&navigator.clipboard.readText().then(k=>{v.update(()=>{const E=O();N(E)&&E.insertText(k)}),v.focus()}).catch(()=>{})},label:d.map(v=>v.paste),icon:"mdi:content-paste"})]:[]);return w.When(s,()=>x)}))}const _0=[{id:"heading1",label:"Heading 1",description:"Large section heading",icon:"mdi:format-header-1",keywords:["h1","heading","title"],category:"Basic blocks",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>ft("h1"))})}},{id:"heading2",label:"Heading 2",description:"Medium section heading",icon:"mdi:format-header-2",keywords:["h2","heading"],category:"Basic blocks",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>ft("h2"))})}},{id:"heading3",label:"Heading 3",description:"Small section heading",icon:"mdi:format-header-3",keywords:["h3","heading"],category:"Basic blocks",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>ft("h3"))})}},{id:"bullet-list",label:"Bullet List",description:"Create a bulleted list",icon:"mdi:format-list-bulleted",keywords:["ul","unordered","bullets"],category:"Lists",handler:n=>{n.dispatchCommand(bi,void 0)}},{id:"ordered-list",label:"Ordered List",description:"Create a numbered list",icon:"mdi:format-list-numbered",keywords:["ol","numbered","1","2","3"],category:"Lists",handler:n=>{n.dispatchCommand(xi,void 0)}},{id:"quote",label:"Quote",description:"Insert a blockquote",icon:"mdi:format-quote-close",keywords:["blockquote","citation"],category:"Basic blocks",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>yi())})}},{id:"code-block",label:"Code Block",description:"Insert a code block",icon:"mdi:code-braces",keywords:["code","pre","programming"],category:"Basic blocks",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>St())})}},{id:"divider",label:"Divider",description:"Insert a horizontal rule",icon:"mdi:minus",keywords:["hr","horizontal","line","separator"],category:"Basic blocks",handler:n=>{n.dispatchCommand(Ms,void 0)}},{id:"table",label:"Table",description:"Insert a table",icon:"mdi:table",keywords:["table","grid","cells","rows","columns"],category:"Advanced",handler:n=>{n.dispatchCommand(Ts,{rows:"3",columns:"3",includeHeaders:!0})}}];function y0({commands:n,isVisible:e,filterText:t,position:r,onSelect:i,onDismiss:s}){const o=w.prop(0),l=t.map(f=>{const h=f.toLowerCase().trim();return h?n.filter(g=>[g.label.toLowerCase(),g.description?.toLowerCase()||"",...g.keywords?.map(m=>m.toLowerCase())||[]].join(" ").includes(h)):n});l.onChange(()=>{o.value=0});const a=f=>{const h=l.value;if(f>=0&&f<h.length){const g=h[f];i(g)}},c=f=>{if(!e.value)return;const g=l.value.length-1;switch(f.key){case"ArrowDown":f.preventDefault(),o.value=Math.min(o.value+1,g);break;case"ArrowUp":f.preventDefault(),o.value=Math.max(o.value-1,0);break;case"Enter":f.preventDefault(),a(o.value);break;case"Escape":f.preventDefault(),s();break}},u=(f,h)=>{const g=o.map(m=>m===h),p=`slash-cmd-${f.id}`;return w.html.div(w.attr.class("bc-slash-command-palette__item"),w.attr.id(p),w.attr.role("option"),w.aria.selected(g),w.WithElement(m=>{const b=()=>{o.value=h},_=()=>{a(h)};return m.addEventListener("mouseenter",b),m.addEventListener("click",_),w.OnDispose(()=>{m.removeEventListener("mouseenter",b),m.removeEventListener("click",_)})}),typeof f.icon=="string"?w.html.div(w.attr.class("bc-slash-command-palette__icon"),nr.Icon({icon:f.icon,size:"sm"})):f.icon,w.html.div(w.attr.class("bc-slash-command-palette__content"),w.html.div(w.attr.class("bc-slash-command-palette__label"),f.label),f.description?w.html.div(w.attr.class("bc-slash-command-palette__description"),f.description):void 0),f.category?w.html.div(w.attr.class("bc-slash-command-palette__category"),f.category):void 0)},d=w.Use(nr.BeatUII18n,f=>w.html.div(w.attr.class("bc-slash-command-palette"),w.attr.role("listbox"),w.aria.label(f.$.lexical.map(h=>h.slashCommands)),w.style.position("absolute"),w.style.top(r.map(h=>`${h.top}px`)),w.style.left(r.map(h=>`${h.left}px`)),w.WithElement(()=>(document.addEventListener("keydown",c),w.OnDispose(()=>{document.removeEventListener("keydown",c)}))),w.When(l.map(h=>h.length===0),()=>w.html.div(w.attr.class("bc-slash-command-palette__empty"),f.$.lexical.map(h=>h.noCommandsFound))),w.ForEach(l,(h,g)=>{const p=h.value;return u(p,g.index)})));return w.When(e,()=>d)}const E_=[{id:"paragraph",label:"Paragraph",icon:"mdi:format-paragraph",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>H())})}},{id:"heading1",label:"Heading 1",icon:"mdi:format-header-1",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>ft("h1"))})}},{id:"heading2",label:"Heading 2",icon:"mdi:format-header-2",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>ft("h2"))})}},{id:"heading3",label:"Heading 3",icon:"mdi:format-header-3",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>ft("h3"))})}},{id:"bullet-list",label:"Bullet List",icon:"mdi:format-list-bulleted",handler:n=>{n.dispatchCommand(bi,void 0)}},{id:"ordered-list",label:"Ordered List",icon:"mdi:format-list-numbered",handler:n=>{n.dispatchCommand(xi,void 0)}},{id:"quote",label:"Quote",icon:"mdi:format-quote-close",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>yi())})}},{id:"code-block",label:"Code Block",icon:"mdi:code-braces",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>St())})}},{id:"divider",label:"Divider",icon:"mdi:minus",handler:n=>{n.dispatchCommand(Ms,void 0)}},{id:"table",label:"Table",icon:"mdi:table",handler:n=>{n.dispatchCommand(Ts,{rows:"3",columns:"3",includeHeaders:!0})}}];function k_({editor:n,stateUpdate:e,readOnly:t=w.signal(!1),commands:r=E_}){const i=w.prop(!1),s=w.prop(!1),o=w.prop(0),l=w.prop(0);return w.Use(nr.BeatUII18n,a=>w.Ensure(n,c=>{const u=c;let d=null,f=!1,h=null,g=null;const p=24,m=4,b=200,_=T=>{if(T===d&&i.value)return;d=T;const I=T.getBoundingClientRect();o.value=I.top,l.value=I.left-p-m,i.value=!0},y=()=>{h!=null&&(clearTimeout(h),h=null)},S=()=>{s.value||(y(),h=setTimeout(()=>{h=null,s.value||(i.value=!1,d=null)},b))},C=()=>{const T=u.value;if(!T)return;const I=T.getRootElement();I&&(k(I),T.getEditorState().read(()=>{const K=O();if(N(K))try{const R=K.anchor.getNode().getTopLevelElementOrThrow(),W=T.getElementByKey(R.getKey());W&&_(W)}catch{}}))},x=T=>{if(s.value)return;const I=u.value;if(!I)return;const K=I.getRootElement();if(K)for(const $ of Array.from(K.children)){const R=$.getBoundingClientRect();if(T.clientY>=R.top&&T.clientY<=R.bottom){y(),_($);return}}},v=()=>{S()},k=T=>{f||(f=!0,T.addEventListener("mousemove",x),T.addEventListener("mouseleave",v))},E=e.onChange(C);return[w.OnDispose(()=>{E(),y();const T=u.value;if(T){const I=T.getRootElement();I&&f&&(I.removeEventListener("mousemove",x),I.removeEventListener("mouseleave",v))}}),w.When(i,()=>w.html.div(w.attr.class("bc-block-handle"),w.style.position("fixed"),w.style.top(o.map(T=>`${T}px`)),w.style.left(l.map(T=>`${T}px`)),w.on.mouseenter(y),w.on.mouseleave(()=>S()),w.WithElement(T=>{T.addEventListener("mousedown",I=>{I.preventDefault()})}),w.html.button(w.attr.class("bc-block-handle__button"),w.attr.type("button"),w.attr.title(a.$.lexical.map(T=>T.changeBlockType)),w.attr.disabled(t),nr.Icon({icon:"mdi:drag-horizontal-variant",size:"sm"}),w.WithElement(T=>{const I=new MutationObserver(()=>{const K=T.getAttribute("aria-expanded")==="true";s.value=K});return I.observe(T,{attributes:!0,attributeFilter:["aria-expanded"]}),w.OnDispose(()=>I.disconnect())}),qu.Menu({items:()=>r.map(T=>qu.MenuItem({key:T.id,content:T.label,startContent:nr.Icon({icon:T.icon,size:"sm"}),onClick:()=>{const I=u.value;I&&(T.handler(I),g?.(),I.focus())}})),placement:"bottom-start",showOn:(T,I)=>(g=I,w.on.click(()=>{s.value?I():(T(),s.value=!0)})),showDelay:0,hideDelay:0,mainAxisOffset:4,onClose:()=>{const T=u.value;T&&T.focus()},ariaLabel:a.value.lexical.blockTypes}))))]}))}const b0=n=>{const{value:e,format:t,plugins:r,readOnly:i,placeholder:s,class:o,namespace:l="BeatUILexical",heightMode:a="auto",floatingToolbarGroups:c,onError:u,onInput:d,onChange:f,onBlur:h,onReady:g}=n,p=w.prop(null),m=w.prop(0),b=y=>typeof y=="object"&&y!==null&&"map"in y&&typeof y.map=="function",_=i!=null?b(i)?i:w.prop(w.Value.get(i)):w.prop(!1);return w.Use(vc.Theme,({appearance:y})=>w.html.div(w.Task(()=>Promise.resolve().then(()=>require("../styles-url-CEDSZTyZ.cjs")),({default:S})=>wc.LinkPortal({id:"beatui-lexical-css",href:S})),w.attr.class("bc-lexical-editor-container"),a==="fixed"?w.attr.class("bc-lexical-editor-container--fixed"):null,w.attr.class(o),v_({editor:p,stateUpdate:m,groups:c??["text-formatting","links"],readOnly:_}),k_({editor:p,stateUpdate:m,readOnly:_}),w_({editor:p,stateUpdate:m,readOnly:_}),w.html.div(w.attr.class("bc-lexical-editor"),w.attr.class(`bc-lexical-editor--${a}`),w.attr.contenteditable(i!=null?w.Value.map(i,S=>S?"false":"true"):"true"),i!=null?w.attr.class(w.Value.map(i,S=>S?"bc-lexical-editor--readonly":"")):null,w.WithElement(S=>{let C=null;const x=[];return(async()=>{try{const k=r??vl("contextual"),E=wl(k),M=w.Value.get(t??"markdown"),T=gi({namespace:l,nodes:E,theme:{heading:{h1:"bc-lexical-h1",h2:"bc-lexical-h2",h3:"bc-lexical-h3",h4:"bc-lexical-h4",h5:"bc-lexical-h5",h6:"bc-lexical-h6"},text:{bold:"bc-lexical-bold",italic:"bc-lexical-italic",underline:"bc-lexical-underline",strikethrough:"bc-lexical-strikethrough",code:"bc-lexical-code"},list:{ul:"bc-lexical-ul",ol:"bc-lexical-ol",listitem:"bc-lexical-li",listitemChecked:"bc-lexical-li-checked",listitemUnchecked:"bc-lexical-li-unchecked"},link:"bc-lexical-link",quote:"bc-lexical-blockquote",code:"bc-lexical-code-block",codeHighlight:{},hashtag:"bc-lexical-hashtag",table:"bc-lexical-table",tableCell:"bc-lexical-table-cell",tableCellHeader:"bc-lexical-table-cell-header",tableRow:"bc-lexical-table-row",mark:"bc-lexical-mark",paragraph:"bc-lexical-paragraph"},onError:$=>{u?u($,T):console.error("[BeatUI Lexical]",$)},editable:i?!w.Value.get(i):!0});C=T,p.set(T),T.setRootElement(S);const I=[];if(k.richText?I.push(Pl(T)):k.plainText&&I.push(Bl(T)),k.history){const $=typeof k.history=="object"?k.history:void 0;I.push(zl(T,$))}if(k.clipboard&&I.push(Ul(T)),k.list&&I.push(Kl(T)),k.link&&I.push(Wl(T)),k.yjs&&I.push(Gl(T,k.yjs)),k.dragon&&I.push(Jl(T)),k.table&&I.push(Hl(T)),(await Promise.all(I)).forEach($=>{$&&x.push($)}),x.push(jl(T)),x.push(T.registerCommand(oi,()=>(m.set(m.value+1),!1),G)),x.push(T.registerUpdateListener(({editorState:$,dirtyElements:R,dirtyLeaves:W})=>{(R.size>0||W.size>0)&&m.set(m.value+1),d&&(R.size>0||W.size>0)&&$.read(async()=>{if(M==="markdown"){const Z=await wt(T);d(Z,T)}else if(M==="html"){const Z=await vt(T);d(Z,T)}else M==="json"&&d($.toJSON(),T)})})),e!=null){const $=w.Value.get(e);if($!=null&&($!==""||M==="json"&&typeof $=="object")){if(M==="markdown"&&typeof $=="string")await Kn(T,$);else if(M==="html"&&typeof $=="string")await Wn(T,$);else if(M==="json"&&typeof $=="object")try{const W=JSON.stringify($),Z=T.parseEditorState(W);T.setEditorState(Z)}catch(W){console.error("[BeatUI] Failed to parse JSON editor state:",W),u&&u(W instanceof Error?W:new Error(String(W)),T)}}}e!=null&&x.push(w.Value.on(e,async $=>{if($!=null){if(M==="markdown"&&typeof $=="string"){const R=await wt(T);$!==R&&await Kn(T,$)}else if(M==="html"&&typeof $=="string"){const R=await vt(T);$!==R&&await Wn(T,$)}else if(M==="json"&&typeof $=="object"){const R=JSON.stringify(T.getEditorState().toJSON()),W=JSON.stringify($);if(R!==W){const Z=T.parseEditorState(W);T.setEditorState(Z)}}}})),i!=null&&x.push(w.Value.on(i,$=>{T.setEditable(!$)})),x.push(T.registerCommand(fi,()=>(h&&h(T),f&&T.getEditorState().read(async()=>{if(M==="markdown"){const $=await wt(T);f($,T)}else if(M==="html"){const $=await vt(T);f($,T)}else M==="json"&&f(T.getEditorState().toJSON(),T)}),!1),G)),x.push(y.on($=>{const R=T.getRootElement();R&&(R.dataset.theme=$)})),g&&g(T)}catch(k){console.error("[BeatUI] Failed to initialize Lexical editor:",k);const E=S;E.textContent="Failed to load Lexical editor."}})(),w.OnDispose(()=>{try{x.forEach(k=>k())}catch{}try{C?.setRootElement(null)}catch{}p.set(null)})}))))},x0=n=>{const{value:e,before:t,after:r,onChange:i,onInput:s,onBlur:o,disabled:l,hasError:a,name:c,placeholder:u,id:d,required:f,tabIndex:h,size:g,class:p,namespace:m,format:b,plugins:_,readOnly:y,onError:S,onReady:C,marks:x}=n,v=l!=null&&y!=null?w.computedOf(l,y)((k,E)=>(k??!1)||(E??!1)):l??y;return U_.InputContainer({disabled:l,hasError:a,size:g,baseContainer:!0,growInput:!0,focusableSelector:"[contenteditable]",before:t,after:r,input:w.html.div(w.attr.class("bc-lexical-editor-input"),w.attr.name(c),w.attr.id(d),f!=null?w.aria.required(f):null,h!=null?w.attr.tabindex(h):null,a!=null?w.attr.class(w.Value.map(a,k=>k?"bc-lexical-editor-input--error":"")):null,b_({value:e,format:b??"markdown",plugins:_,readOnly:v,placeholder:u,namespace:m,class:p,onError:S,onReady:C,onInput:s?(k,E)=>{s(k)}:void 0,onChange:i?(k,E)=>{i(k)}:void 0,onBlur:o?k=>{o()}:void 0}))})};exports.$createHorizontalRuleNode=Ns;exports.$isHorizontalRuleNode=Vp;exports.BLUR_COMMAND=fi;exports.BareEditor=b_;exports.BlockHandle=k_;exports.CLEAR_EDITOR_COMMAND=Lc;exports.CLICK_COMMAND=br;exports.COMMAND_PRIORITY_CRITICAL=Wc;exports.COMMAND_PRIORITY_EDITOR=B;exports.COMMAND_PRIORITY_HIGH=wg;exports.COMMAND_PRIORITY_LOW=G;exports.COMMAND_PRIORITY_NORMAL=Cg;exports.COPY_COMMAND=xr;exports.CUT_COMMAND=di;exports.ContextualEditor=b0;exports.DEFAULT_BLOCK_COMMANDS=E_;exports.DEFAULT_SLASH_COMMANDS=_0;exports.DecoratorNode=Ss;exports.DockedEditor=m0;exports.ElementNode=xe;exports.FOCUS_COMMAND=Rc;exports.FORMAT_ELEMENT_COMMAND=Fc;exports.FORMAT_TEXT_COMMAND=ve;exports.FloatingToolbar=v_;exports.HR_TRANSFORMER=__;exports.HorizontalRuleNode=Ir;exports.INDENT_CONTENT_COMMAND=Ut;exports.INSERT_CHECK_LIST_COMMAND=xl;exports.INSERT_HORIZONTAL_RULE_COMMAND=Ms;exports.INSERT_IMAGE_COMMAND=Kv;exports.INSERT_ORDERED_LIST_COMMAND=xi;exports.INSERT_PARAGRAPH_COMMAND=Fn;exports.INSERT_UNORDERED_LIST_COMMAND=bi;exports.KEY_ENTER_COMMAND=Dn;exports.KEY_ESCAPE_COMMAND=ui;exports.KEY_TAB_COMMAND=xs;exports.LexicalEditorInput=x0;exports.LexicalToolbar=C_;exports.OUTDENT_CONTENT_COMMAND=sn;exports.PASTE_COMMAND=li;exports.REDO_COMMAND=ci;exports.REMOVE_LIST_COMMAND=pu;exports.SELECTION_CHANGE_COMMAND=oi;exports.SlashCommandPalette=y0;exports.TOGGLE_SLASH_COMMAND_PALETTE=Uv;exports.TextNode=Ye;exports.UNDO_COMMAND=ai;exports.applyMark=r0;exports.createCommand=z;exports.createDefaultPluginConfig=vl;exports.createHeadlessEditor=$s;exports.executeSlashCommand=zv;exports.exportEditorToFile=Wv;exports.exportToHtml=vt;exports.exportToMarkdown=wt;exports.getCharacterCount=l0;exports.getMarkdownTransformers=y_;exports.getNodesForPlugins=wl;exports.getSelectionInfo=o0;exports.getTextContent=Gu;exports.getWordCount=a0;exports.htmlToLexicalJson=f0;exports.importFileToEditor=jv;exports.importFromHtml=Wn;exports.importFromMarkdown=Kn;exports.insertTable=Jv;exports.lexicalJsonToHtml=h0;exports.lexicalJsonToMarkdown=d0;exports.loadLexicalCore=m_;exports.loadOffsetUtils=c0;exports.markdownToLexicalJson=u0;exports.registerAutoLinkPlugin=t0;exports.registerClipboardPlugin=Ul;exports.registerCodePlugin=Gv;exports.registerCodeShikiPlugin=Vv;exports.registerDragonPlugin=Jl;exports.registerHashtagPlugin=Zv;exports.registerHistoryPlugin=zl;exports.registerHorizontalRulePlugin=jl;exports.registerLinkPlugin=Wl;exports.registerListPlugin=Kl;exports.registerMarkPlugin=n0;exports.registerOverflowPlugin=s0;exports.registerPlainTextPlugin=Bl;exports.registerRichTextPlugin=Pl;exports.registerSlashCommandsPlugin=Bv;exports.registerTablePlugin=Hl;exports.registerYjsPlugin=Gl;exports.removeMark=i0;
37
+ ${t.toString()}`)};class Sw{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:hs(e),h:t}),this}else(e){return this.if(zo,e)}done(){return(e,t)=>{for(let r=0;r<this.patterns.length;r++){const i=this.patterns[r];if(i.if.check(e))return i.h(e,t)}throw Pn("Unhandled pattern")}}}const Cw=n=>new Sw(n),Om=Cw(zo).if(Tm,(n,e)=>va(e,uh,ch)).if(Nm,(n,e)=>YC(e)).if(yw,(n,e)=>yh(e)).if(_w,(n,e)=>BigInt(va(e,uh,ch))).if(Bo,(n,e)=>zr(e,Ea(e,n.shape))).if(iw,(n,e)=>{const t={};for(const r in n.shape){let i=n.shape[r];if(tw.check(i)){if(yh(e))continue;i=i.shape}t[r]=Om(i,e)}return t}).if(aw,(n,e)=>{const t=[],r=pm(e,0,42);for(let i=0;i<r;i++)t.push(zr(e,n.shape));return t}).if(mm,(n,e)=>Ea(e,n.shape)).if(bw,(n,e)=>null).if(hw,(n,e)=>{const t=zr(e,n.res);return()=>t}).if(mw,(n,e)=>zr(e,Ea(e,[Zr,ni,Ol,Am,Du,Al,wm(Zr),xm(vi("a","b","c"),Zr)]))).if(ow,(n,e)=>{const t={},r=va(e,0,3);for(let i=0;i<r;i++){const s=zr(e,n.shape.keys),o=zr(e,n.shape.values);t[s]=o}return t}).done(),zr=(n,e)=>Om(hs(e),n),Ml=typeof document<"u"?document:{};Re(n=>n.nodeType===Tw);typeof DOMParser<"u"&&new DOMParser;Re(n=>n.nodeType===vw);Re(n=>n.nodeType===Ew);const ww=n=>tC(n,(e,t)=>`${t}:${e};`).join(""),vw=Ml.ELEMENT_NODE,Ew=Ml.TEXT_NODE,kw=Ml.DOCUMENT_NODE,Tw=Ml.DOCUMENT_FRAGMENT_NODE;Re(n=>n.nodeType===kw);const Cn=Symbol,Mm=Cn(),$m=Cn(),Nw=Cn(),Aw=Cn(),Ow=Cn(),Im=Cn(),Mw=Cn(),Lu=Cn(),$w=Cn(),Iw=n=>{n.length===1&&n[0]?.constructor===Function&&(n=n[0]());const e=[],t=[];let r=0;for(;r<n.length;r++){const i=n[r];if(i===void 0)break;if(i.constructor===String||i.constructor===Number)e.push(i);else if(i.constructor===Object)break}for(r>0&&t.push(e.join(""));r<n.length;r++){const i=n[r];i instanceof Symbol||t.push(i)}return t},Fw={[Mm]:en("font-weight","bold"),[$m]:en("font-weight","normal"),[Nw]:en("color","blue"),[Ow]:en("color","green"),[Aw]:en("color","grey"),[Im]:en("color","red"),[Mw]:en("color","purple"),[Lu]:en("color","orange"),[$w]:en("color","black")},Dw=n=>{n.length===1&&n[0]?.constructor===Function&&(n=n[0]());const e=[],t=[],r=Gt();let i=[],s=0;for(;s<n.length;s++){const o=n[s],l=Fw[o];if(l!==void 0)r.set(l.left,l.right);else{if(o===void 0)break;if(o.constructor===String||o.constructor===Number){const a=ww(r);s>0||a.length>0?(e.push("%c"+o),t.push(a)):e.push(o)}else break}}for(s>0&&(i=t,i.unshift(e.join("")));s<n.length;s++){const o=n[s];o instanceof Symbol||i.push(o)}return i},Fm=JC?Dw:Iw,Lw=(...n)=>{console.log(...Fm(n)),Dm.forEach(e=>e.print(n))},Rw=(...n)=>{console.warn(...Fm(n)),n.unshift(Lu),Dm.forEach(e=>e.print(n))},Dm=ei(),Lm=n=>({[Symbol.iterator](){return this},next:n}),Pw=(n,e)=>Lm(()=>{let t;do t=n.next();while(!t.done&&!e(t.value));return t}),ka=(n,e)=>Lm(()=>{const{done:t,value:r}=n.next();return{done:t,value:t?void 0:e(r)}});class Bw{constructor(e,t){this.clock=e,this.len=t}}class zw{constructor(){this.clients=new Map}}const Rm=(n,e,t)=>e.clients.forEach((r,i)=>{const s=n.doc.store.clients.get(i);if(s!=null){const o=s[s.length-1],l=o.id.clock+o.length;for(let a=0,c=r[a];a<r.length&&c.clock<l;c=r[++a])jm(n,s,c.clock,c.len,t)}}),Uw=(n,e)=>{let t=0,r=n.length-1;for(;t<=r;){const i=gn((t+r)/2),s=n[i],o=s.clock;if(o<=e){if(e<o+s.len)return i;t=i+1}else r=i-1}return null},Pm=(n,e)=>{const t=n.clients.get(e.client);return t!==void 0&&Uw(t,e.clock)!==null},Bm=n=>{n.clients.forEach(e=>{e.sort((i,s)=>i.clock-s.clock);let t,r;for(t=1,r=1;t<e.length;t++){const i=e[r-1],s=e[t];i.clock+i.len>=s.clock?i.len=wi(i.len,s.clock+s.len-i.clock):(r<t&&(e[r]=s),r++)}e.length=r})},zm=(n,e,t,r)=>{Ci(n.clients,e,()=>[]).push(new Bw(t,r))},Kw=(n,e)=>{ce(n.restEncoder,e.clients.size),ti(e.clients.entries()).sort((t,r)=>r[0]-t[0]).forEach(([t,r])=>{n.resetDsCurVal(),ce(n.restEncoder,t);const i=r.length;ce(n.restEncoder,i);for(let s=0;s<i;s++){const o=r[s];n.writeDsClock(o.clock),n.writeDsLen(o.len)}})},Um=um;class Bn extends iC{constructor({guid:e=MC(),collectionid:t=null,gc:r=!0,gcFilter:i=()=>!0,meta:s=null,autoLoad:o=!1,shouldLoad:l=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=Um(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new Xw,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=l,this.autoLoad=o,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=mh(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const a=()=>mh(c=>{const u=d=>{(d===void 0||d===!0)&&(this.off("sync",u),c())};this.on("sync",u)});this.on("sync",c=>{c===!1&&this.isSynced&&(this.whenSynced=a()),this.isSynced=c===void 0||c===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=a()}load(){const e=this._item;e!==null&&!this.shouldLoad&&he(e.parent.doc,t=>{t.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(ti(this.subdocs).map(e=>e.guid))}transact(e,t=null){return he(this,e,t)}get(e,t=Ue){const r=Ci(this.share,e,()=>{const s=new t;return s._integrate(this,null),s}),i=r.constructor;if(t!==Ue&&i!==t)if(i===Ue){const s=new t;s._map=r._map,r._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=s}),s._start=r._start;for(let o=s._start;o!==null;o=o.right)o.parent=s;return s._length=r._length,this.share.set(e,s),s._integrate(this,null),s}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,Yi)}getText(e=""){return this.get(e,ms)}getMap(e=""){return this.get(e,yt)}getXmlElement(e=""){return this.get(e,_n)}getXmlFragment(e=""){return this.get(e,ri)}toJSON(){const e={};return this.share.forEach((t,r)=>{e[r]=t.toJSON()}),e}destroy(){this.isDestroyed=!0,ti(this.subdocs).forEach(t=>t.destroy());const e=this._item;if(e!==null){this._item=null;const t=e.content;t.doc=new Bn({guid:this.guid,...t.opts,shouldLoad:!1}),t.doc._item=e,he(e.parent.doc,r=>{const i=t.doc;e.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class Ww{constructor(){this.restEncoder=Eu()}toUint8Array(){return an(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){ce(this.restEncoder,e)}writeDsLen(e){ce(this.restEncoder,e)}}class jw extends Ww{writeLeftID(e){ce(this.restEncoder,e.client),ce(this.restEncoder,e.clock)}writeRightID(e){ce(this.restEncoder,e.client),ce(this.restEncoder,e.clock)}writeClient(e){ce(this.restEncoder,e)}writeInfo(e){mc(this.restEncoder,e)}writeString(e){qr(this.restEncoder,e)}writeParentInfo(e){ce(this.restEncoder,e?1:0)}writeTypeRef(e){ce(this.restEncoder,e)}writeLen(e){ce(this.restEncoder,e)}writeAny(e){us(this.restEncoder,e)}writeBuf(e){ut(this.restEncoder,e)}writeJSON(e){qr(this.restEncoder,JSON.stringify(e))}writeKey(e){qr(this.restEncoder,e)}}class Hw{constructor(){this.restEncoder=Eu(),this.dsCurrVal=0}toUint8Array(){return an(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,ce(this.restEncoder,t)}writeDsLen(e){e===0&&pn(),ce(this.restEncoder,e-1),this.dsCurrVal+=e}}class Jw extends Hw{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new wa,this.clientEncoder=new no,this.leftClockEncoder=new wa,this.rightClockEncoder=new wa,this.infoEncoder=new hh(mc),this.stringEncoder=new NC,this.parentInfoEncoder=new hh(mc),this.typeRefEncoder=new no,this.lenEncoder=new no}toUint8Array(){const e=Eu();return ce(e,0),ut(e,this.keyClockEncoder.toUint8Array()),ut(e,this.clientEncoder.toUint8Array()),ut(e,this.leftClockEncoder.toUint8Array()),ut(e,this.rightClockEncoder.toUint8Array()),ut(e,an(this.infoEncoder)),ut(e,this.stringEncoder.toUint8Array()),ut(e,an(this.parentInfoEncoder)),ut(e,this.typeRefEncoder.toUint8Array()),ut(e,this.lenEncoder.toUint8Array()),Tu(e,an(this.restEncoder)),an(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){us(this.restEncoder,e)}writeBuf(e){ut(this.restEncoder,e)}writeJSON(e){us(this.restEncoder,e)}writeKey(e){const t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}}const Gw=(n,e,t,r)=>{r=wi(r,e[0].id.clock);const i=mn(e,r);ce(n.restEncoder,e.length-i),n.writeClient(t),ce(n.restEncoder,r);const s=e[i];s.write(n,r-s.id.clock);for(let o=i+1;o<e.length;o++)e[o].write(n,0)},Vw=(n,e,t)=>{const r=new Map;t.forEach((i,s)=>{it(e,s)>i&&r.set(s,i)}),Ru(e).forEach((i,s)=>{t.has(s)||r.set(s,0)}),ce(n.restEncoder,r.size),ti(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{Gw(n,e.clients.get(i),i,s)})},Yw=(n,e)=>Vw(n,e.doc.store,e.beforeState);class qw{constructor(){this.l=[]}}const xh=()=>new qw,Sh=(n,e)=>n.l.push(e),Ch=(n,e)=>{const t=n.l,r=t.length;n.l=t.filter(i=>e!==i),r===n.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},Km=(n,e,t)=>Ou(n.l,[e,t]);class io{constructor(e,t){this.client=e,this.clock=t}}const Js=(n,e)=>n===e||n!==null&&e!==null&&n.client===e.client&&n.clock===e.clock,_e=(n,e)=>new io(n,e),Zw=n=>{for(const[e,t]of n.doc.share.entries())if(t===n)return e;throw pn()},jr=(n,e)=>e===void 0?!n.deleted:e.sv.has(n.id.client)&&(e.sv.get(n.id.client)||0)>n.id.clock&&!Pm(e.ds,n.id),xc=(n,e)=>{const t=Ci(n.meta,xc,ei),r=n.doc.store;t.has(e)||(e.sv.forEach((i,s)=>{i<it(r,s)&&zn(n,_e(s,i))}),Rm(n,e.ds,i=>{}),t.add(e))};class Xw{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const Ru=n=>{const e=new Map;return n.clients.forEach((t,r)=>{const i=t[t.length-1];e.set(r,i.id.clock+i.length)}),e},it=(n,e)=>{const t=n.clients.get(e);if(t===void 0)return 0;const r=t[t.length-1];return r.id.clock+r.length},Wm=(n,e)=>{let t=n.clients.get(e.id.client);if(t===void 0)t=[],n.clients.set(e.id.client,t);else{const r=t[t.length-1];if(r.id.clock+r.length!==e.id.clock)throw pn()}t.push(e)},mn=(n,e)=>{let t=0,r=n.length-1,i=n[r],s=i.id.clock;if(s===e)return r;let o=gn(e/(s+i.length-1)*r);for(;t<=r;){if(i=n[o],s=i.id.clock,s<=e){if(e<s+i.length)return o;t=o+1}else r=o-1;o=gn((t+r)/2)}throw pn()},Qw=(n,e)=>{const t=n.clients.get(e.client);return t[mn(t,e.clock)]},Ta=Qw,Sc=(n,e,t)=>{const r=mn(e,t),i=e[r];return i.id.clock<t&&i instanceof Je?(e.splice(r+1,0,a_(n,i,t-i.id.clock)),r+1):r},zn=(n,e)=>{const t=n.doc.store.clients.get(e.client);return t[Sc(n,t,e.clock)]},wh=(n,e,t)=>{const r=e.clients.get(t.client),i=mn(r,t.clock),s=r[i];return t.clock!==s.id.clock+s.length-1&&s.constructor!==En&&r.splice(i+1,0,a_(n,s,t.clock-s.id.clock+1)),s},ev=(n,e,t)=>{const r=n.clients.get(e.id.client);r[mn(r,e.id.clock)]=t},jm=(n,e,t,r,i)=>{if(r===0)return;const s=t+r;let o=Sc(n,e,t),l;do l=e[o++],s<l.id.clock+l.length&&Sc(n,e,s),i(l);while(o<e.length&&e[o].id.clock<s)};class tv{constructor(e,t,r){this.doc=e,this.deleteSet=new zw,this.beforeState=Ru(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const vh=(n,e)=>e.deleteSet.clients.size===0&&!nC(e.afterState,(t,r)=>e.beforeState.get(r)!==t)?!1:(Bm(e.deleteSet),Yw(n,e),Kw(n,e.deleteSet),!0),Eh=(n,e,t)=>{const r=e._item;(r===null||r.id.clock<(n.beforeState.get(r.id.client)||0)&&!r.deleted)&&Ci(n.changed,e,ei).add(t)},so=(n,e)=>{let t=n[e],r=n[e-1],i=e;for(;i>0;t=r,r=n[--i-1]){if(r.deleted===t.deleted&&r.constructor===t.constructor&&r.mergeWith(t)){t instanceof Je&&t.parentSub!==null&&t.parent._map.get(t.parentSub)===t&&t.parent._map.set(t.parentSub,r);continue}break}const s=e-i;return s&&n.splice(e+1-s,s),s},nv=(n,e,t)=>{for(const[r,i]of n.clients.entries()){const s=e.clients.get(r);for(let o=i.length-1;o>=0;o--){const l=i[o],a=l.clock+l.len;for(let c=mn(s,l.clock),u=s[c];c<s.length&&u.id.clock<a;u=s[++c]){const d=s[c];if(l.clock+l.len<=d.id.clock)break;d instanceof Je&&d.deleted&&!d.keep&&t(d)&&d.gc(e,!1)}}}},rv=(n,e)=>{n.clients.forEach((t,r)=>{const i=e.clients.get(r);for(let s=t.length-1;s>=0;s--){const o=t[s],l=am(i.length-1,1+mn(i,o.clock+o.len-1));for(let a=l,c=i[a];a>0&&c.id.clock>=o.clock;c=i[a])a-=1+so(i,a)}})},Hm=(n,e)=>{if(e<n.length){const t=n[e],r=t.doc,i=r.store,s=t.deleteSet,o=t._mergeStructs;try{Bm(s),t.afterState=Ru(t.doc.store),r.emit("beforeObserverCalls",[t,r]);const l=[];t.changed.forEach((a,c)=>l.push(()=>{(c._item===null||!c._item.deleted)&&c._callObserver(t,a)})),l.push(()=>{t.changedParentTypes.forEach((a,c)=>{c._dEH.l.length>0&&(c._item===null||!c._item.deleted)&&(a=a.filter(u=>u.target._item===null||!u.target._item.deleted),a.forEach(u=>{u.currentTarget=c,u._path=null}),a.sort((u,d)=>u.path.length-d.path.length),l.push(()=>{Km(c._dEH,a,t)}))}),l.push(()=>r.emit("afterTransaction",[t,r])),l.push(()=>{t._needFormattingCleanup&&pv(t)})}),Ou(l,[])}finally{r.gc&&nv(s,i,r.gcFilter),rv(s,i),t.afterState.forEach((u,d)=>{const f=t.beforeState.get(d)||0;if(f!==u){const h=i.clients.get(d),g=wi(mn(h,f),1);for(let p=h.length-1;p>=g;)p-=1+so(h,p)}});for(let u=o.length-1;u>=0;u--){const{client:d,clock:f}=o[u].id,h=i.clients.get(d),g=mn(h,f);g+1<h.length&&so(h,g+1)>1||g>0&&so(h,g)}if(!t.local&&t.afterState.get(r.clientID)!==t.beforeState.get(r.clientID)&&(Lw(Lu,Mm,"[yjs] ",$m,Im,"Changed the client-id because another client seems to be using it."),r.clientID=Um()),r.emit("afterTransactionCleanup",[t,r]),r._observers.has("update")){const u=new jw;vh(u,t)&&r.emit("update",[u.toUint8Array(),t.origin,r,t])}if(r._observers.has("updateV2")){const u=new Jw;vh(u,t)&&r.emit("updateV2",[u.toUint8Array(),t.origin,r,t])}const{subdocsAdded:l,subdocsLoaded:a,subdocsRemoved:c}=t;(l.size>0||c.size>0||a.size>0)&&(l.forEach(u=>{u.clientID=r.clientID,u.collectionid==null&&(u.collectionid=r.collectionid),r.subdocs.add(u)}),c.forEach(u=>r.subdocs.delete(u)),r.emit("subdocs",[{loaded:a,added:l,removed:c},r,t]),c.forEach(u=>u.destroy())),n.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,n])):Hm(n,e+1)}}},he=(n,e,t=null,r=!0)=>{const i=n._transactionCleanups;let s=!1,o=null;n._transaction===null&&(s=!0,n._transaction=new tv(n,t,r),i.push(n._transaction),i.length===1&&n.emit("beforeAllTransactions",[n]),n.emit("beforeTransaction",[n._transaction,n]));try{o=e(n._transaction)}finally{if(s){const l=n._transaction===i[0];n._transaction=null,l&&Hm(i,0)}}return o},kh="You must not compute changes after the event-handler fired.";class $l{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=iv(this.currentTarget,this.target))}deletes(e){return Pm(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Pn(kh);const e=new Map,t=this.target;this.transaction.changed.get(t).forEach(i=>{if(i!==null){const s=t._map.get(i);let o,l;if(this.adds(s)){let a=s.left;for(;a!==null&&this.adds(a);)a=a.left;if(this.deletes(s))if(a!==null&&this.deletes(a))o="delete",l=ba(a.content.getContent());else return;else a!==null&&this.deletes(a)?(o="update",l=ba(a.content.getContent())):(o="add",l=void 0)}else if(this.deletes(s))o="delete",l=ba(s.content.getContent());else return;e.set(i,{action:o,oldValue:l})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw Pn(kh);const t=this.target,r=ei(),i=ei(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(t).has(null)){let l=null;const a=()=>{l&&s.push(l)};for(let c=t._start;c!==null;c=c.right)c.deleted?this.deletes(c)&&!this.adds(c)&&((l===null||l.delete===void 0)&&(a(),l={delete:0}),l.delete+=c.length,i.add(c)):this.adds(c)?((l===null||l.insert===void 0)&&(a(),l={insert:[]}),l.insert=l.insert.concat(c.content.getContent()),r.add(c)):((l===null||l.retain===void 0)&&(a(),l={retain:0}),l.retain+=c.length);l!==null&&l.retain===void 0&&a()}this._changes=e}return e}}const iv=(n,e)=>{const t=[];for(;e._item!==null&&e!==n;){if(e._item.parentSub!==null)t.unshift(e._item.parentSub);else{let r=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)!i.deleted&&i.countable&&(r+=i.length),i=i.right;t.unshift(r)}e=e._item.parent}return t},Ve=()=>{Rw("Invalid access: Add Yjs type to a document before reading data.")},Jm=80;let Pu=0;class sv{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=Pu++}}const ov=n=>{n.timestamp=Pu++},Gm=(n,e,t)=>{n.p.marker=!1,n.p=e,e.marker=!0,n.index=t,n.timestamp=Pu++},lv=(n,e,t)=>{if(n.length>=Jm){const r=n.reduce((i,s)=>i.timestamp<s.timestamp?i:s);return Gm(r,e,t),r}else{const r=new sv(e,t);return n.push(r),r}},Il=(n,e)=>{if(n._start===null||e===0||n._searchMarker===null)return null;const t=n._searchMarker.length===0?null:n._searchMarker.reduce((s,o)=>to(e-s.index)<to(e-o.index)?s:o);let r=n._start,i=0;for(t!==null&&(r=t.p,i=t.index,ov(t));r.right!==null&&i<e;){if(!r.deleted&&r.countable){if(e<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>e;)r=r.left,!r.deleted&&r.countable&&(i-=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&&(i-=r.length);return t!==null&&to(t.index-i)<r.parent.length/Jm?(Gm(t,r,i),t):lv(n._searchMarker,r,i)},gs=(n,e,t)=>{for(let r=n.length-1;r>=0;r--){const i=n[r];if(t>0){let s=i.p;for(s.marker=!1;s&&(s.deleted||!s.countable);)s=s.left,s&&!s.deleted&&s.countable&&(i.index-=s.length);if(s===null||s.marker===!0){n.splice(r,1);continue}i.p=s,s.marker=!0}(e<i.index||t>0&&e===i.index)&&(i.index=wi(e,i.index+t))}},Fl=(n,e,t)=>{const r=n,i=e.changedParentTypes;for(;Ci(i,n,()=>[]).push(t),n._item!==null;)n=n._item.parent;Km(r._eH,t,e)};class Ue{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=xh(),this._dEH=xh(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw Ft()}clone(){throw Ft()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){Sh(this._eH,e)}observeDeep(e){Sh(this._dEH,e)}unobserve(e){Ch(this._eH,e)}unobserveDeep(e){Ch(this._dEH,e)}toJSON(){}}const Vm=(n,e,t)=>{n.doc??Ve(),e<0&&(e=n._length+e),t<0&&(t=n._length+t);let r=t-e;const i=[];let s=n._start;for(;s!==null&&r>0;){if(s.countable&&!s.deleted){const o=s.content.getContent();if(o.length<=e)e-=o.length;else{for(let l=e;l<o.length&&r>0;l++)i.push(o[l]),r--;e=0}}s=s.right}return i},Ym=n=>{n.doc??Ve();const e=[];let t=n._start;for(;t!==null;){if(t.countable&&!t.deleted){const r=t.content.getContent();for(let i=0;i<r.length;i++)e.push(r[i])}t=t.right}return e},ps=(n,e)=>{let t=0,r=n._start;for(n.doc??Ve();r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let s=0;s<i.length;s++)e(i[s],t++,n)}r=r.right}},qm=(n,e)=>{const t=[];return ps(n,(r,i)=>{t.push(e(r,i,n))}),t},av=n=>{let e=n._start,t=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(t===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};t=e.content.getContent(),r=0,e=e.right}const i=t[r++];return t.length<=r&&(t=null),{done:!1,value:i}}}},Zm=(n,e)=>{n.doc??Ve();const t=Il(n,e);let r=n._start;for(t!==null&&(r=t.p,e-=t.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},Uo=(n,e,t,r)=>{let i=t;const s=n.doc,o=s.clientID,l=s.store,a=t===null?e._start:t.right;let c=[];const u=()=>{c.length>0&&(i=new Je(_e(o,it(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new ii(c)),i.integrate(n,0),c=[])};r.forEach(d=>{if(d===null)c.push(d);else switch(d.constructor){case Number:case Object:case Boolean:case Array:case String:c.push(d);break;default:switch(u(),d.constructor){case Uint8Array:case ArrayBuffer:i=new Je(_e(o,it(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Dl(new Uint8Array(d))),i.integrate(n,0);break;case Bn:i=new Je(_e(o,it(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Ll(d)),i.integrate(n,0);break;default:if(d instanceof Ue)i=new Je(_e(o,it(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Jn(d)),i.integrate(n,0);else throw new Error("Unexpected content type in insert operation")}}}),u()},Xm=()=>Pn("Length exceeded!"),Qm=(n,e,t,r)=>{if(t>e._length)throw Xm();if(t===0)return e._searchMarker&&gs(e._searchMarker,t,r.length),Uo(n,e,null,r);const i=t,s=Il(e,t);let o=e._start;for(s!==null&&(o=s.p,t-=s.index,t===0&&(o=o.prev,t+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(t<=o.length){t<o.length&&zn(n,_e(o.id.client,o.id.clock+t));break}t-=o.length}return e._searchMarker&&gs(e._searchMarker,i,r.length),Uo(n,e,o,r)},cv=(n,e,t)=>{let i=(e._searchMarker||[]).reduce((s,o)=>o.index>s.index?o:s,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return Uo(n,e,i,t)},e_=(n,e,t,r)=>{if(r===0)return;const i=t,s=r,o=Il(e,t);let l=e._start;for(o!==null&&(l=o.p,t-=o.index);l!==null&&t>0;l=l.right)!l.deleted&&l.countable&&(t<l.length&&zn(n,_e(l.id.client,l.id.clock+t)),t-=l.length);for(;r>0&&l!==null;)l.deleted||(r<l.length&&zn(n,_e(l.id.client,l.id.clock+r)),l.delete(n),r-=l.length),l=l.right;if(r>0)throw Xm();e._searchMarker&&gs(e._searchMarker,i,-s+r)},Ko=(n,e,t)=>{const r=e._map.get(t);r!==void 0&&r.delete(n)},Bu=(n,e,t,r)=>{const i=e._map.get(t)||null,s=n.doc,o=s.clientID;let l;if(r==null)l=new ii([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:l=new ii([r]);break;case Uint8Array:l=new Dl(r);break;case Bn:l=new Ll(r);break;default:if(r instanceof Ue)l=new Jn(r);else throw new Error("Unexpected content type")}new Je(_e(o,it(s.store,o)),i,i&&i.lastId,null,null,e,t,l).integrate(n,0)},zu=(n,e)=>{n.doc??Ve();const t=n._map.get(e);return t!==void 0&&!t.deleted?t.content.getContent()[t.length-1]:void 0},t_=n=>{const e={};return n.doc??Ve(),n._map.forEach((t,r)=>{t.deleted||(e[r]=t.content.getContent()[t.length-1])}),e},n_=(n,e)=>{n.doc??Ve();const t=n._map.get(e);return t!==void 0&&!t.deleted},uv=(n,e)=>{const t={};return n._map.forEach((r,i)=>{let s=r;for(;s!==null&&(!e.sv.has(s.id.client)||s.id.clock>=(e.sv.get(s.id.client)||0));)s=s.left;s!==null&&jr(s,e)&&(t[i]=s.content.getContent()[s.length-1])}),t},Gs=n=>(n.doc??Ve(),Pw(n._map.entries(),e=>!e[1].deleted));class dv extends $l{}class Yi extends Ue{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const t=new Yi;return t.push(e),t}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Yi}clone(){const e=new Yi;return e.insert(0,this.toArray().map(t=>t instanceof Ue?t.clone():t)),e}get length(){return this.doc??Ve(),this._length}_callObserver(e,t){super._callObserver(e,t),Fl(this,e,new dv(this,e))}insert(e,t){this.doc!==null?he(this.doc,r=>{Qm(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}push(e){this.doc!==null?he(this.doc,t=>{cv(t,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc!==null?he(this.doc,r=>{e_(r,this,e,t)}):this._prelimContent.splice(e,t)}get(e){return Zm(this,e)}toArray(){return Ym(this)}slice(e=0,t=this.length){return Vm(this,e,t)}toJSON(){return this.map(e=>e instanceof Ue?e.toJSON():e)}map(e){return qm(this,e)}forEach(e){ps(this,e)}[Symbol.iterator](){return av(this)}_write(e){e.writeTypeRef(Sv)}}class fv extends $l{constructor(e,t,r){super(e,t),this.keysChanged=r}}class yt extends Ue{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new yt}clone(){const e=new yt;return this.forEach((t,r)=>{e.set(r,t instanceof Ue?t.clone():t)}),e}_callObserver(e,t){Fl(this,e,new fv(this,e,t))}toJSON(){this.doc??Ve();const e={};return this._map.forEach((t,r)=>{if(!t.deleted){const i=t.content.getContent()[t.length-1];e[r]=i instanceof Ue?i.toJSON():i}}),e}get size(){return[...Gs(this)].length}keys(){return ka(Gs(this),e=>e[0])}values(){return ka(Gs(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return ka(Gs(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??Ve(),this._map.forEach((t,r)=>{t.deleted||e(t.content.getContent()[t.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?he(this.doc,t=>{Ko(t,this,e)}):this._prelimContent.delete(e)}set(e,t){return this.doc!==null?he(this.doc,r=>{Bu(r,this,e,t)}):this._prelimContent.set(e,t),t}get(e){return zu(this,e)}has(e){return n_(this,e)}clear(){this.doc!==null?he(this.doc,e=>{this.forEach(function(t,r,i){Ko(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(Cv)}}const Nn=(n,e)=>n===e||typeof n=="object"&&typeof e=="object"&&n&&e&&zC(n,e);class Cc{constructor(e,t,r,i){this.left=e,this.right=t,this.index=r,this.currentAttributes=i}forward(){this.right===null&&pn(),this.right.content.constructor===De?this.right.deleted||Ei(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}}const Th=(n,e,t)=>{for(;e.right!==null&&t>0;)e.right.content.constructor===De?e.right.deleted||Ei(e.currentAttributes,e.right.content):e.right.deleted||(t<e.right.length&&zn(n,_e(e.right.id.client,e.right.id.clock+t)),e.index+=e.right.length,t-=e.right.length),e.left=e.right,e.right=e.right.right;return e},Vs=(n,e,t,r)=>{const i=new Map,s=r?Il(e,t):null;if(s){const o=new Cc(s.p.left,s.p,s.index,i);return Th(n,o,t-s.index)}else{const o=new Cc(null,e._start,0,i);return Th(n,o,t)}},r_=(n,e,t,r)=>{for(;t.right!==null&&(t.right.deleted===!0||t.right.content.constructor===De&&Nn(r.get(t.right.content.key),t.right.content.value));)t.right.deleted||r.delete(t.right.content.key),t.forward();const i=n.doc,s=i.clientID;r.forEach((o,l)=>{const a=t.left,c=t.right,u=new Je(_e(s,it(i.store,s)),a,a&&a.lastId,c,c&&c.id,e,null,new De(l,o));u.integrate(n,0),t.right=u,t.forward()})},Ei=(n,e)=>{const{key:t,value:r}=e;r===null?n.delete(t):n.set(t,r)},i_=(n,e)=>{for(;n.right!==null;){if(!(n.right.deleted||n.right.content.constructor===De&&Nn(e[n.right.content.key]??null,n.right.content.value)))break;n.forward()}},s_=(n,e,t,r)=>{const i=n.doc,s=i.clientID,o=new Map;for(const l in r){const a=r[l],c=t.currentAttributes.get(l)??null;if(!Nn(c,a)){o.set(l,c);const{left:u,right:d}=t;t.right=new Je(_e(s,it(i.store,s)),u,u&&u.lastId,d,d&&d.id,e,null,new De(l,a)),t.right.integrate(n,0),t.forward()}}return o},Na=(n,e,t,r,i)=>{t.currentAttributes.forEach((f,h)=>{i[h]===void 0&&(i[h]=null)});const s=n.doc,o=s.clientID;i_(t,i);const l=s_(n,e,t,i),a=r.constructor===String?new yn(r):r instanceof Ue?new Jn(r):new ki(r);let{left:c,right:u,index:d}=t;e._searchMarker&&gs(e._searchMarker,t.index,a.getLength()),u=new Je(_e(o,it(s.store,o)),c,c&&c.lastId,u,u&&u.id,e,null,a),u.integrate(n,0),t.right=u,t.index=d,t.forward(),r_(n,e,t,l)},Nh=(n,e,t,r,i)=>{const s=n.doc,o=s.clientID;i_(t,i);const l=s_(n,e,t,i);e:for(;t.right!==null&&(r>0||l.size>0&&(t.right.deleted||t.right.content.constructor===De));){if(!t.right.deleted)switch(t.right.content.constructor){case De:{const{key:a,value:c}=t.right.content,u=i[a];if(u!==void 0){if(Nn(u,c))l.delete(a);else{if(r===0)break e;l.set(a,c)}t.right.delete(n)}else t.currentAttributes.set(a,c);break}default:r<t.right.length&&zn(n,_e(t.right.id.client,t.right.id.clock+r)),r-=t.right.length;break}t.forward()}if(r>0){let a="";for(;r>0;r--)a+=`
38
+ `;t.right=new Je(_e(o,it(s.store,o)),t.left,t.left&&t.left.lastId,t.right,t.right&&t.right.id,e,null,new yn(a)),t.right.integrate(n,0),t.forward()}r_(n,e,t,l)},o_=(n,e,t,r,i)=>{let s=e;const o=Gt();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===De){const c=s.content;o.set(c.key,c)}s=s.right}let l=0,a=!1;for(;e!==s;){if(t===e&&(a=!0),!e.deleted){const c=e.content;if(c.constructor===De){const{key:u,value:d}=c,f=r.get(u)??null;(o.get(u)!==c||f===d)&&(e.delete(n),l++,!a&&(i.get(u)??null)===d&&f!==d&&(f===null?i.delete(u):i.set(u,f))),!a&&!e.deleted&&Ei(i,c)}}e=e.right}return l},hv=(n,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const t=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===De){const r=e.content.key;t.has(r)?e.delete(n):t.add(r)}e=e.left}},gv=n=>{let e=0;return he(n.doc,t=>{let r=n._start,i=n._start,s=Gt();const o=pc(s);for(;i;)i.deleted===!1&&(i.content.constructor===De?Ei(o,i.content):(e+=o_(t,r,i,s,o),s=pc(o),r=i)),i=i.right}),e},pv=n=>{const e=new Set,t=n.doc;for(const[r,i]of n.afterState.entries()){const s=n.beforeState.get(r)||0;i!==s&&jm(n,t.store.clients.get(r),s,i,o=>{!o.deleted&&o.content.constructor===De&&o.constructor!==En&&e.add(o.parent)})}he(t,r=>{Rm(n,n.deleteSet,i=>{if(i instanceof En||!i.parent._hasFormatting||e.has(i.parent))return;const s=i.parent;i.content.constructor===De?e.add(s):hv(r,i)});for(const i of e)gv(i)})},Ah=(n,e,t)=>{const r=t,i=pc(e.currentAttributes),s=e.right;for(;t>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case Jn:case ki:case yn:t<e.right.length&&zn(n,_e(e.right.id.client,e.right.id.clock+t)),t-=e.right.length,e.right.delete(n);break}e.forward()}s&&o_(n,s,e.right,i,e.currentAttributes);const o=(e.left||e.right).parent;return o._searchMarker&&gs(o._searchMarker,e.index,-r+t),e};class mv extends $l{constructor(e,t,r){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(i=>{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,t=[];he(e,r=>{const i=new Map,s=new Map;let o=this.target._start,l=null;const a={};let c="",u=0,d=0;const f=()=>{if(l!==null){let h=null;switch(l){case"delete":d>0&&(h={delete:d}),d=0;break;case"insert":(typeof c=="object"||c.length>0)&&(h={insert:c},i.size>0&&(h.attributes={},i.forEach((g,p)=>{g!==null&&(h.attributes[p]=g)}))),c="";break;case"retain":u>0&&(h={retain:u},BC(a)||(h.attributes=LC({},a))),u=0;break}h&&t.push(h),l=null}};for(;o!==null;){switch(o.content.constructor){case Jn:case ki:this.adds(o)?this.deletes(o)||(f(),l="insert",c=o.content.getContent()[0],f()):this.deletes(o)?(l!=="delete"&&(f(),l="delete"),d+=1):o.deleted||(l!=="retain"&&(f(),l="retain"),u+=1);break;case yn:this.adds(o)?this.deletes(o)||(l!=="insert"&&(f(),l="insert"),c+=o.content.str):this.deletes(o)?(l!=="delete"&&(f(),l="delete"),d+=o.length):o.deleted||(l!=="retain"&&(f(),l="retain"),u+=o.length);break;case De:{const{key:h,value:g}=o.content;if(this.adds(o)){if(!this.deletes(o)){const p=i.get(h)??null;Nn(p,g)?g!==null&&o.delete(r):(l==="retain"&&f(),Nn(g,s.get(h)??null)?delete a[h]:a[h]=g)}}else if(this.deletes(o)){s.set(h,g);const p=i.get(h)??null;Nn(p,g)||(l==="retain"&&f(),a[h]=p)}else if(!o.deleted){s.set(h,g);const p=a[h];p!==void 0&&(Nn(p,g)?p!==null&&o.delete(r):(l==="retain"&&f(),g===null?delete a[h]:a[h]=g))}o.deleted||(l==="insert"&&f(),Ei(i,o.content));break}}o=o.right}for(f();t.length>0;){const h=t[t.length-1];if(h.retain!==void 0&&h.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}}class ms extends Ue{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Ve(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new ms}clone(){const e=new ms;return e.applyDelta(this.toDelta()),e}_callObserver(e,t){super._callObserver(e,t);const r=new mv(this,e,t);Fl(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??Ve();let e="",t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===yn&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){this.doc!==null?he(this.doc,r=>{const i=new Cc(null,this._start,0,new Map);for(let s=0;s<e.length;s++){const o=e[s];if(o.insert!==void 0){const l=!t&&typeof o.insert=="string"&&s===e.length-1&&i.right===null&&o.insert.slice(-1)===`
39
+ `?o.insert.slice(0,-1):o.insert;(typeof l!="string"||l.length>0)&&Na(r,this,i,l,o.attributes||{})}else o.retain!==void 0?Nh(r,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&Ah(r,i,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,t,r){this.doc??Ve();const i=[],s=new Map,o=this.doc;let l="",a=this._start;function c(){if(l.length>0){const d={};let f=!1;s.forEach((g,p)=>{f=!0,d[p]=g});const h={insert:l};f&&(h.attributes=d),i.push(h),l=""}}const u=()=>{for(;a!==null;){if(jr(a,e)||t!==void 0&&jr(a,t))switch(a.content.constructor){case yn:{const d=s.get("ychange");e!==void 0&&!jr(a,e)?(d===void 0||d.user!==a.id.client||d.type!=="removed")&&(c(),s.set("ychange",r?r("removed",a.id):{type:"removed"})):t!==void 0&&!jr(a,t)?(d===void 0||d.user!==a.id.client||d.type!=="added")&&(c(),s.set("ychange",r?r("added",a.id):{type:"added"})):d!==void 0&&(c(),s.delete("ychange")),l+=a.content.str;break}case Jn:case ki:{c();const d={insert:a.content.getContent()[0]};if(s.size>0){const f={};d.attributes=f,s.forEach((h,g)=>{f[g]=h})}i.push(d);break}case De:jr(a,e)&&(c(),Ei(s,a.content));break}a=a.right}c()};return e||t?he(o,d=>{e&&xc(d,e),t&&xc(d,t),u()},"cleanup"):u(),i}insert(e,t,r){if(t.length<=0)return;const i=this.doc;i!==null?he(i,s=>{const o=Vs(s,this,e,!r);r||(r={},o.currentAttributes.forEach((l,a)=>{r[a]=l})),Na(s,this,o,t,r)}):this._pending.push(()=>this.insert(e,t,r))}insertEmbed(e,t,r){const i=this.doc;i!==null?he(i,s=>{const o=Vs(s,this,e,!r);Na(s,this,o,t,r||{})}):this._pending.push(()=>this.insertEmbed(e,t,r||{}))}delete(e,t){if(t===0)return;const r=this.doc;r!==null?he(r,i=>{Ah(i,Vs(i,this,e,!0),t)}):this._pending.push(()=>this.delete(e,t))}format(e,t,r){if(t===0)return;const i=this.doc;i!==null?he(i,s=>{const o=Vs(s,this,e,!1);o.right!==null&&Nh(s,this,o,t,r)}):this._pending.push(()=>this.format(e,t,r))}removeAttribute(e){this.doc!==null?he(this.doc,t=>{Ko(t,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,t){this.doc!==null?he(this.doc,r=>{Bu(r,this,e,t)}):this._pending.push(()=>this.setAttribute(e,t))}getAttribute(e){return zu(this,e)}getAttributes(){return t_(this)}_write(e){e.writeTypeRef(wv)}}class Aa{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Ve()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===_n||t.constructor===ri)&&t._start!==null)e=t._start;else for(;e!==null;){const r=e.next;if(r!==null){e=r;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class ri extends Ue{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new ri}clone(){const e=new ri;return e.insert(0,this.toArray().map(t=>t instanceof Ue?t.clone():t)),e}get length(){return this.doc??Ve(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new Aa(this,e)}querySelector(e){e=e.toUpperCase();const r=new Aa(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),ti(new Aa(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){Fl(this,e,new _v(this,t,e))}toString(){return qm(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,t={},r){const i=e.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),ps(this,s=>{i.insertBefore(s.toDOM(e,t,r),null)}),i}insert(e,t){this.doc!==null?he(this.doc,r=>{Qm(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}insertAfter(e,t){if(this.doc!==null)he(this.doc,r=>{const i=e&&e instanceof Ue?e._item:e;Uo(r,this,i,t)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(s=>s===e)+1;if(i===0&&e!==null)throw Pn("Reference item not found");r.splice(i,0,...t)}}delete(e,t=1){this.doc!==null?he(this.doc,r=>{e_(r,this,e,t)}):this._prelimContent.splice(e,t)}toArray(){return Ym(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return Zm(this,e)}slice(e=0,t=this.length){return Vm(this,e,t)}forEach(e){ps(this,e)}_write(e){e.writeTypeRef(Ev)}}class _n extends ri{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new _n(this.nodeName)}clone(){const e=new _n(this.nodeName),t=this.getAttributes();return PC(t,(r,i)=>{e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof Ue?r.clone():r)),e}toString(){const e=this.getAttributes(),t=[],r=[];for(const l in e)r.push(l);r.sort();const i=r.length;for(let l=0;l<i;l++){const a=r[l];t.push(a+'="'+e[a]+'"')}const s=this.nodeName.toLocaleLowerCase(),o=t.length>0?" "+t.join(" "):"";return`<${s}${o}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?he(this.doc,t=>{Ko(t,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,t){this.doc!==null?he(this.doc,r=>{Bu(r,this,e,t)}):this._prelimAttrs.set(e,t)}getAttribute(e){return zu(this,e)}hasAttribute(e){return n_(this,e)}getAttributes(e){return e?uv(this,e):t_(this)}toDOM(e=document,t={},r){const i=e.createElement(this.nodeName),s=this.getAttributes();for(const o in s){const l=s[o];typeof l=="string"&&i.setAttribute(o,l)}return ps(this,o=>{i.appendChild(o.toDOM(e,t,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(vv),e.writeKey(this.nodeName)}}class _v extends $l{constructor(e,t,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class Un extends ms{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new Un}clone(){const e=new Un;return e.applyDelta(this.toDelta()),e}toDOM(e=document,t,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const t=[];for(const i in e.attributes){const s=[];for(const o in e.attributes[i])s.push({key:o,value:e.attributes[i][o]});s.sort((o,l)=>o.key<l.key?-1:1),t.push({nodeName:i,attrs:s})}t.sort((i,s)=>i.nodeName<s.nodeName?-1:1);let r="";for(let i=0;i<t.length;i++){const s=t[i];r+=`<${s.nodeName}`;for(let o=0;o<s.attrs.length;o++){const l=s.attrs[o];r+=` ${l.key}="${l.value}"`}r+=">"}r+=e.insert;for(let i=t.length-1;i>=0;i--)r+=`</${t[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(kv)}}class l_{constructor(e,t){this.id=e,this.length=t}get deleted(){throw Ft()}mergeWith(e){return!1}write(e,t,r){throw Ft()}integrate(e,t){throw Ft()}}const yv=0;class En extends l_{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),Wm(e.doc.store,this)}write(e,t){e.writeInfo(yv),e.writeLen(this.length-t)}getMissing(e,t){return null}}class Dl{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Dl(this.content)}splice(e){throw Ft()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}}class Wo{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Wo(this.len)}splice(e){const t=new Wo(this.len-e);return this.len=e,t}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){zm(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}}const bv=(n,e)=>new Bn({guid:n,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Ll{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),e.meta!==null&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Ll(bv(this.doc.guid,this.opts))}splice(e){throw Ft()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}class ki{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new ki(this.embed)}splice(e){throw Ft()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}}class De{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new De(this.key,this.value)}splice(e){throw Ft()}mergeWith(e){return!1}integrate(e,t){const r=t.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const xv=Po("node_env")==="development";class ii{constructor(e){this.arr=e,xv&&hm(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new ii(this.arr)}splice(e){const t=new ii(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){const r=this.arr.length;e.writeLen(r-t);for(let i=t;i<r;i++){const s=this.arr[i];e.writeAny(s)}}getRef(){return 8}}class yn{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new yn(this.str)}splice(e){const t=new yn(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",t.str="�"+t.str.slice(1)),t}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}}const Sv=0,Cv=1,wv=2,vv=3,Ev=4,kv=6;class Jn{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Jn(this.type._copy())}splice(e){throw Ft()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;for(;t!==null;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;t!==null;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}}const a_=(n,e,t)=>{const{client:r,clock:i}=e.id,s=new Je(_e(r,i+t),e,_e(r,i+t-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(t));return e.deleted&&s.markDeleted(),e.keep&&(s.keep=!0),e.redone!==null&&(s.redone=_e(e.redone.client,e.redone.clock+t)),e.right=s,s.right!==null&&(s.right.left=s),n._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),e.length=t,s};class Je extends l_{constructor(e,t,r,i,s,o,l,a){super(e,a.getLength()),this.origin=r,this.left=t,this.right=i,this.rightOrigin=s,this.parent=o,this.parentSub=l,this.redone=null,this.content=a,this.info=this.content.isCountable()?lh:0}set marker(e){(this.info&Sa)>0!==e&&(this.info^=Sa)}get marker(){return(this.info&Sa)>0}get keep(){return(this.info&oh)>0}set keep(e){this.keep!==e&&(this.info^=oh)}get countable(){return(this.info&lh)>0}get deleted(){return(this.info&xa)>0}set deleted(e){this.deleted!==e&&(this.info^=xa)}markDeleted(){this.info|=xa}getMissing(e,t){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=it(t,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=it(t,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===io&&this.id.client!==this.parent.client&&this.parent.clock>=it(t,this.parent.client))return this.parent.client;if(this.origin&&(this.left=wh(e,t,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=zn(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===En||this.right&&this.right.constructor===En)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===Je?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===Je&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===io){const r=Ta(t,this.parent);r.constructor===En?this.parent=null:this.parent=r.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=wh(e,e.doc.store,_e(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const s=new Set,o=new Set;for(;i!==null&&i!==this.right;){if(o.add(i),s.add(i),Js(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(Js(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&o.has(Ta(e.doc.store,i.origin)))s.has(Ta(e.doc.store,i.origin))||(r=i,s.clear());else break;i=i.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&&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!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),Wm(e.doc.store,this),this.content.integrate(e,this),Eh(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new En(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:_e(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Js(e.origin,this.lastId)&&this.right===e&&Js(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const t=this.parent._searchMarker;return t&&t.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),zm(e.deleteSet,this.id.client,this.id.clock,this.length),Eh(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw pn();this.content.gc(e),t?ev(e,this,new En(this.id,this.length)):this.content=new Wo(this.length)}write(e,t){const r=t>0?_e(this.id.client,this.id.clock+t-1):this.origin,i=this.rightOrigin,s=this.parentSub,o=this.content.getRef()&lC|(r===null?0:Lo)|(i===null?0:cm)|(s===null?0:oC);if(e.writeInfo(o),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const l=this.parent;if(l._item!==void 0){const a=l._item;if(a===null){const c=Zw(l);e.writeParentInfo(!0),e.writeString(c)}else e.writeParentInfo(!1),e.writeLeftID(a.id)}else l.constructor===String?(e.writeParentInfo(!0),e.writeString(l)):l.constructor===io?(e.writeParentInfo(!1),e.writeLeftID(l)):pn();s!==null&&e.writeString(s)}this.content.write(e,t)}}const c_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},u_="__ $YJS$ __";c_[u_]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");c_[u_]=!0;function Be(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Tv(n,e,t){const r=n.length,i=e.length;let s=0,o=0;for(;s<r&&s<i&&n[s]===e[s]&&s<t;)s++;for(;o+s<r&&o+s<i&&n[r-o-1]===e[i-o-1];)o++;for(;o+s<r&&o+s<i&&n[s]===e[s];)s++;return{index:s,insert:e.slice(s,i-o),remove:r-s-o}}class er{_xmlElem;_key;_parent;_type;constructor(e,t,r){this._key="",this._xmlElem=e,this._parent=t,this._type=r}getPrevNode(e){if(e===null)return null;const t=e.get(this._key);return V(t)?t:null}getNode(){const e=q(this._key);return V(e)?e:null}getSharedType(){return this._xmlElem}getType(){return this._type}getKey(){return this._key}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}syncPropertiesFromLexical(e,t,r){const i=this.getPrevNode(r);Wu(e,this._xmlElem,i,t)}syncPropertiesFromYjs(e,t){const r=this.getNode();r===null&&Be(83),Ku(e,this._xmlElem,r,t)}destroy(e){const t=e.collabNodeMap;t.get(this._key)===this&&t.delete(this._key)}}function d_(n,e,t){const r=new er(n,e,t);return n._collabNode=r,r}class Ui{_map;_key;_parent;_type;constructor(e,t){this._key="",this._map=e,this._parent=t,this._type="linebreak"}getNode(){const e=q(this._key);return ue(e)?e:null}getKey(){return this._key}getSharedType(){return this._map}getType(){return this._type}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}destroy(e){const t=e.collabNodeMap;t.get(this._key)===this&&t.delete(this._key)}}function f_(n,e){const t=new Ui(n,e);return n._collabNode=t,t}class xt{_map;_key;_parent;_text;_type;_normalized;constructor(e,t,r,i){this._key="",this._map=e,this._parent=r,this._text=t,this._type=i,this._normalized=!1}getPrevNode(e){if(e===null)return null;const t=e.get(this._key);return D(t)?t:null}getNode(){const e=q(this._key);return D(e)?e:null}getSharedType(){return this._map}getType(){return this._type}getKey(){return this._key}getSize(){return this._text.length+(this._normalized?0:1)}getOffset(){return this._parent.getChildOffset(this)}spliceText(e,t,r){const i=this._parent._xmlText,s=this.getOffset()+1+e;t!==0&&i.delete(s,t),r!==""&&i.insert(s,r)}syncPropertiesAndTextFromLexical(e,t,r){const i=this.getPrevNode(r),s=t.__text;if(Wu(e,this._map,i,t),i!==null){const o=i.__text;o!==s&&((function(l,a,c,u){const d=O();let f=u.length;if(N(d)&&d.isCollapsed()){const g=d.anchor;g.key===a&&(f=g.offset)}const h=Tv(c,u,f);l.spliceText(h.index,h.remove,h.insert)})(this,t.__key,o,s),this._text=s)}}syncPropertiesAndTextFromYjs(e,t){const r=this.getNode();r===null&&Be(84),Ku(e,this._map,r,t);const i=this._text;r.__text!==i&&r.setTextContent(i)}destroy(e){const t=e.collabNodeMap;t.get(this._key)===this&&t.delete(this._key)}}function h_(n,e,t,r){const i=new xt(n,e,t,r);return n._collabNode=i,i}class rn{_key;_children;_xmlText;_type;_parent;constructor(e,t,r){this._key="",this._children=[],this._xmlText=e,this._type=r,this._parent=t}getPrevNode(e){if(e===null)return null;const t=e.get(this._key);return A(t)?t:null}getNode(){const e=q(this._key);return A(e)?e:null}getSharedType(){return this._xmlText}getType(){return this._type}getKey(){return this._key}isEmpty(){return this._children.length===0}getSize(){return 1}getOffset(){const e=this._parent;return e===null&&Be(90),e.getChildOffset(this)}syncPropertiesFromYjs(e,t){const r=this.getNode();r===null&&Be(91),Ku(e,this._xmlText,r,t)}applyChildrenYjsDelta(e,t){const r=this._children;let i=0,s=null;for(let o=0;o<t.length;o++){const l=t[o],a=l.insert,c=l.delete;if(l.retain!=null)i+=l.retain;else if(typeof c=="number"){let u=c;for(;u>0;){const{node:d,nodeIndex:f,offset:h,length:g}=Oa(this,i,!1);if(d instanceof rn||d instanceof Ui||d instanceof er)r.splice(f,1),u-=1;else{if(!(d instanceof xt))break;{const p=Math.min(u,g),m=f!==0?r[f-1]:null,b=d.getSize();if(h===0&&g===b){r.splice(f,1);const _=Ii(d._text,h,p-1,"");_.length>0&&(m instanceof xt?m._text+=_:this._xmlText.delete(h,_.length))}else d._text=Ii(d._text,h,p,"");u-=p}}}}else{if(a==null)throw new Error("Unexpected delta format");if(typeof a=="string"){const{node:u,offset:d}=Oa(this,i,!0);u instanceof xt?u._text=Ii(u._text,d,0,a):this._xmlText.delete(d,a.length),i+=a.length}else{const u=a,{node:d,nodeIndex:f,length:h}=Oa(this,i,!1),g=p_(e,u,this);if(d instanceof xt&&h>0&&h<d._text.length){const p=d._text,m=p.length-h;d._text=Ii(p,m,h,""),r.splice(f+1,0,g),s=Ii(p,0,m,"")}else r.splice(f,0,g);s!==null&&g instanceof xt&&(g._text=s+g._text,s=null),i+=1}}}}syncChildrenFromYjs(e){const t=this.getNode();t===null&&Be(92);const r=t.__key,i=or(t,null),s=i.length,o=this._children,l=o.length,a=e.collabNodeMap,c=new Set;let u,d,f=0,h=null;l!==s&&(d=t.getWritable());for(let g=0;g<l;g++){const p=i[f],m=o[g],b=m.getNode(),_=m._key;if(b!==null&&p===_){const y=D(b);if(c.add(p),y)if(m._key=p,m instanceof rn){const S=m._xmlText;m.syncPropertiesFromYjs(e,null),m.applyChildrenYjsDelta(e,S.toDelta()),m.syncChildrenFromYjs(e)}else m instanceof xt?m.syncPropertiesAndTextFromYjs(e,null):m instanceof er?m.syncPropertiesFromYjs(e,null):m instanceof Ui||Be(93);h=b,f++}else{if(u===void 0){u=new Set;for(let C=0;C<l;C++){const x=o[C]._key;x!==""&&u.add(x)}}if(b!==null&&p!==void 0&&!u.has(p)){const C=Qn(p);jt(C),g--,f++;continue}d=t.getWritable();const y=Rv(e,m,r),S=y.__key;if(a.set(S,m),h===null){const C=d.getFirstChild();if(d.__first=S,C!==null){const x=C.getWritable();x.__prev=S,y.__next=x.__key}}else{const C=h.getWritable(),x=h.getNextSibling();if(C.__next=S,y.__prev=h.__key,x!==null){const v=x.getWritable();v.__prev=S,y.__next=v.__key}}g===l-1&&(d.__last=S),d.__size++,h=y}}for(let g=0;g<s;g++){const p=i[g];if(!c.has(p)){const m=Qn(p),b=e.collabNodeMap.get(p);b!==void 0&&b.destroy(e),jt(m)}}}syncPropertiesFromLexical(e,t,r){Wu(e,this._xmlText,this.getPrevNode(r),t)}_syncChildFromLexical(e,t,r,i,s,o){const l=this._children[t],a=Qn(r);l instanceof rn&&A(a)?(l.syncPropertiesFromLexical(e,a,i),l.syncChildrenFromLexical(e,a,i,s,o)):l instanceof xt&&D(a)?l.syncPropertiesAndTextFromLexical(e,a,i):l instanceof er&&V(a)&&l.syncPropertiesFromLexical(e,a,i)}syncChildrenFromLexical(e,t,r,i,s){const o=this.getPrevNode(r),l=o===null?[]:or(o,r),a=or(t,null),c=l.length-1,u=a.length-1,d=e.collabNodeMap;let f,h,g=0,p=0;for(;g<=c&&p<=u;){const _=l[g],y=a[p];if(_===y)this._syncChildFromLexical(e,p,y,r,i,s),g++,p++;else{f===void 0&&(f=new Set(l)),h===void 0&&(h=new Set(a));const S=h.has(_),C=f.has(y);if(S){const x=Oh(e,Qn(y),this);d.set(y,x),C?(this.splice(e,p,1,x),g++,p++):(this.splice(e,p,0,x),p++)}else this.splice(e,p,1),g++}}const m=g>c,b=p>u;if(m&&!b)for(;p<=u;++p){const _=a[p],y=Oh(e,Qn(_),this);this.append(y),d.set(_,y)}else if(b&&!m)for(let _=this._children.length-1;_>=p;_--)this.splice(e,_,1)}append(e){const t=this._xmlText,r=this._children,i=r[r.length-1],s=i!==void 0?i.getOffset()+i.getSize():0;if(e instanceof rn)t.insertEmbed(s,e._xmlText);else if(e instanceof xt){const o=e._map;o.parent===null&&t.insertEmbed(s,o),t.insert(s+1,e._text)}else e instanceof Ui?t.insertEmbed(s,e._map):e instanceof er&&t.insertEmbed(s,e._xmlElem);this._children.push(e)}splice(e,t,r,i){const s=this._children,o=s[t];if(o===void 0)return i===void 0&&Be(94),void this.append(i);const l=o.getOffset();l===-1&&Be(95);const a=this._xmlText;if(r!==0&&a.delete(l,o.getSize()),i instanceof rn)a.insertEmbed(l,i._xmlText);else if(i instanceof xt){const c=i._map;c.parent===null&&a.insertEmbed(l,c),a.insert(l+1,i._text)}else i instanceof Ui?a.insertEmbed(l,i._map):i instanceof er&&a.insertEmbed(l,i._xmlElem);if(r!==0){const c=s.slice(t,t+r);for(let u=0;u<c.length;u++)c[u].destroy(e)}i!==void 0?s.splice(t,r,i):s.splice(t,r)}getChildOffset(e){let t=0;const r=this._children;for(let i=0;i<r.length;i++){const s=r[i];if(s===e)return t;t+=s.getSize()}return-1}destroy(e){const t=e.collabNodeMap,r=this._children;for(let i=0;i<r.length;i++)r[i].destroy(e);t.get(this._key)===this&&t.delete(this._key)}}function Uu(n,e,t){const r=new rn(n,e,t);return n._collabNode=r,r}function Nv(n,e,t,r,i){t==null&&Be(81);const s={clientID:t.clientID,cursors:new Map,cursorsContainer:null,doc:t,docMap:r,editor:n,excludedProperties:i||new Map,id:e,nodeProperties:new Map};return(function(o){const{editor:l,nodeProperties:a}=o;l.update(()=>{l._nodes.forEach(c=>{const u=new c.klass,d={};for(const[f,h]of Object.entries(u))g_(f,u,o)||(d[f]=h);a.set(u.__type,Object.freeze(d))})})})(s),s}function Av(n,e,t,r,i,s){r==null&&Be(81);const o=Uu(r.get("root",Un),null,"root");return o._key="root",{...Nv(n,t,r,i,s),collabNodeMap:new Map,root:o}}function Ov(n){return Object.hasOwn(n,"collabNodeMap")}const Mv=new Set(["__key","__parent","__next","__prev","__state"]),$v=new Set(["__first","__last","__size"]),Iv=new Set(["__cachedText"]),Fv=new Set(["__text"]);function g_(n,e,t){if(Mv.has(n)||typeof e[n]=="function")return!0;if(D(e)){if(Fv.has(n))return!0}else if(A(e)&&($v.has(n)||be(e)&&Iv.has(n)))return!0;const r=e.constructor,i=t.excludedProperties.get(r);return i!=null&&i.has(n)}function Dv(n,e){const t=n.__type,{nodeProperties:r}=e,i=r.get(t);return i===void 0&&Be(330,t),i}function Oh(n,e,t){const r=e.__type;let i;if(A(e))i=Uu(new Un,t,r),i.syncPropertiesFromLexical(n,e,null),i.syncChildrenFromLexical(n,e,null,null,null);else if(D(e))i=h_(new yt,e.__text,t,r),i.syncPropertiesAndTextFromLexical(n,e,null);else if(ue(e)){const s=new yt;s.set("__type","linebreak"),i=f_(s,t)}else V(e)?(i=d_(new _n,t,r),i.syncPropertiesFromLexical(n,e,null)):Be(86);return i._key=e.__key,i}function Lv(n){const e=Rl(n,"__type");return typeof e!="string"&&e!==void 0&&Be(87),e}function p_(n,e,t){const r=e._collabNode;if(r===void 0){const i=n.editor._nodes,s=Lv(e);typeof s!="string"&&Be(87),i.get(s)===void 0&&Be(88,s);const o=e.parent,l=t===void 0&&o!==null?p_(n,o):t||null;if(l instanceof rn||Be(89),e instanceof Un)return Uu(e,l,s);if(e instanceof yt)return s==="linebreak"?f_(e,l):h_(e,"",l,s);if(e instanceof _n)return d_(e,l,s)}return r}function Rv(n,e,t){const r=e.getType(),i=n.editor._nodes.get(r);i===void 0&&Be(88,r);const s=new i.klass;if(s.__parent=t,e._key=s.__key,e instanceof rn){const o=e._xmlText;e.syncPropertiesFromYjs(n,null),e.applyChildrenYjsDelta(n,o.toDelta()),e.syncChildrenFromYjs(n)}else e instanceof xt?e.syncPropertiesAndTextFromYjs(n,null):e instanceof er&&e.syncPropertiesFromYjs(n,null);return n.collabNodeMap.set(s.__key,e),s}function Ku(n,e,t,r){const i=r===null?e instanceof yt?Array.from(e.keys()):e instanceof Un||e instanceof _n?Object.keys(e.getAttributes()):Object.keys(e):Array.from(r);let s;for(let o=0;o<i.length;o++){const l=i[o];if(g_(l,t,n)){l==="__state"&&Ov(n)&&(s||(s=t.getWritable()),Pv(e,s));continue}const a=t[l];let c=Rl(e,l);if(a!==c){if(c instanceof Bn){const u=n.docMap;a instanceof Bn&&u.delete(a.guid);const d=gi(),f=c.guid;d._key=f,u.set(f,c),c=d}s===void 0&&(s=t.getWritable()),s[l]=c}}}function Rl(n,e){return n instanceof yt?n.get(e):n instanceof Un||n instanceof _n?n.getAttribute(e):n[e]}function Mh(n,e,t){n instanceof yt?n.set(e,t):n.setAttribute(e,t)}function Pv(n,e){const t=Rl(n,"__state");t instanceof yt&&Jo(e).updateFromJSON(t.toJSON())}function Wu(n,e,t,r){const i=Object.keys(Dv(r,n)),s=n.editor.constructor;(function(o,l,a,c){const u=c.__state,d=Rl(l,"__state");if(!u)return;const[f,h]=u.getInternalState(),g=a&&a.__state,p=d instanceof yt?d:new yt;if(g===u)return;const[m,b]=g&&p.doc?g.getInternalState():[void 0,new Map];if(f)for(const[_,y]of Object.entries(f))m&&y!==m[_]&&p.set(_,y);for(const[_,y]of h)b.get(_)!==y&&p.set(_.key,_.unparse(y));d||Mh(l,"__state",p)})(0,e,t,r);for(let o=0;o<i.length;o++){const l=i[o],a=t===null?void 0:t[l];let c=r[l];if(a!==c){if(c instanceof s){const u=n.docMap;let d;if(a instanceof s){const g=a._key;d=u.get(g),u.delete(g)}const f=d||new Bn,h=f.guid;c._key=h,u.set(h,f),c=f,n.editor.update(()=>{r.markDirty()})}Mh(e,l,c)}}}function Ii(n,e,t,r){return n.slice(0,e)+r+n.slice(e+t)}function Oa(n,e,t){let r=0,i=0;const s=n._children,o=s.length;for(;i<o;i++){const l=s[i],a=r;if(r+=l.getSize(),(t?r>=e:r>e)&&l instanceof xt){let c=e-a-1;return c<0&&(c=0),{length:r-e,node:l,nodeIndex:i,offset:c}}if(r>e)return{length:0,node:l,nodeIndex:i,offset:a};if(i===o-1)return{length:0,node:null,nodeIndex:i+1,offset:a+1}}return{length:0,node:null,nodeIndex:0,offset:0}}Tc("ychange",{isEqual:(n,e)=>n===e,parse:n=>n??null});async function m_(){return hb}async function Pl(n){return ox(n)}async function Bl(n){return mS(n)}async function zl(n,e){const t=qp(),r=e?.delay??300;return Yp(n,t,r)}async function Ul(n){return()=>{}}async function Kl(n){return typeof da=="function"?typeof hf=="function"?pt(da(n),hf(n)):da(n):pt(n.registerCommand(xi,()=>(fa(n,"number"),!0),G),n.registerCommand(bi,()=>(fa(n,"bullet"),!0),G),n.registerCommand(xl,()=>(fa(n,"check"),!0),G),n.registerCommand(pu,()=>(px(n),!0),G))}async function Wl(n){return n.registerCommand(lc,e=>(e===null||typeof e=="string"?ha(e):ha(e.url,e),!0),G)}async function Bv(n,e,t){const r=e?.trigger||"/";let i=!1,s=null,o=0;const l=()=>n.getEditorState().read(()=>{const p=O();if(!N(p)||!p.isCollapsed())return!1;const m=p.anchor,b=m.getNode();if(!D(b))return!1;const _=b.getTextContent(),y=m.offset;if(y===0||_[y-1]!==r)return!1;if(y===1)return!0;const C=_[y-2];return!!/\s/.test(C)}),a=()=>s?n.getEditorState().read(()=>{if(!s)return"";const p=s.getTextContent(),m=p.indexOf(r,o);if(m===-1)return"";const b=O();if(!N(b))return"";const _=b.anchor;if(_.getNode().getKey()!==s.getKey())return"";const S=_.offset;return S<=m?"":p.slice(m+1,S)}):"",c=()=>{n.getEditorState().read(()=>{const p=O();if(N(p)){const m=p.anchor,b=m.getNode();if(D(b)){s=b,o=m.offset-1,i=!0;const _={isActive:!0,filterText:"",anchorNode:s,anchorOffset:o};t?.onTrigger?.(_,d),t?.onUpdate?.(_,d)}}})},u=()=>{i&&(i=!1,s=null,o=0,t?.onDismiss?.())},d=()=>{s&&n.update(()=>{if(!s)return;const p=s.getTextContent(),m=p.indexOf(r,o);if(m===-1)return;const b=O();if(!N(b))return;const _=b.anchor;if(_.getNode().getKey()!==s.getKey())return;const S=_.offset,C=p.slice(0,m),x=p.slice(S);s.setTextContent(C+x);const v=O();N(v)&&(v.anchor.set(s.getKey(),m,"text"),v.focus.set(s.getKey(),m,"text"))})},f=()=>{if(!i)return;const m={isActive:!0,filterText:a(),anchorNode:s,anchorOffset:o};t?.onUpdate?.(m,d)},h=n.registerMutationListener(Ye,p=>{if(!i&&l()){c();return}i&&(s&&!p.has(s.getKey())?f():u())}),g=pt(n.registerUpdateListener(({editorState:p})=>{p.read(()=>{if(!i)return;const m=O();if(!N(m)){u();return}const b=m.anchor,_=b.getNode();if(!s||_.getKey()!==s.getKey()){u();return}const S=s.getTextContent().indexOf(r,o);if(S===-1||b.offset<=S){u();return}})}),n.registerCommand(dr,p=>i?(p.preventDefault(),!0):!1,G),n.registerCommand(dn,p=>i?(p.preventDefault(),!0):!1,G),n.registerCommand(Dn,p=>i?(p?.preventDefault(),!0):!1,G),n.registerCommand(ui,p=>i?(p?.preventDefault(),u(),!0):!1,G));return()=>{u(),h(),g()}}function zv(n,e,t){t(),e.handler(n),n.focus()}const Uv=z("TOGGLE_SLASH_COMMAND_PALETTE"),Ms=z("INSERT_HORIZONTAL_RULE_COMMAND"),Kv=z("INSERT_IMAGE_COMMAND");function jl(n){return n.registerCommand(Ms,()=>{const e=O();if(!N(e))return!1;if(e.focus.getNode()!==null){const r=Ns();e.insertNodes([r]);const i=H();r.insertAfter(i),i.selectStart()}return!0},G)}const __={dependencies:[Ir],export:n=>Vp(n)?"---":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(n,e,t,r)=>{const i=Ns();if(r)n.replace(i);else{n.replace(i);const s=H();i.insertAfter(s),s.selectStart()}},type:"element"},ju=[...wu,__];async function wt(n){let e="";return n.getEditorState().read(()=>{e=qS(ju)}),e}async function Kn(n,e){n.update(()=>{YS(e,ju)})}async function y_(){return ju}const Hu=Object.freeze(Object.defineProperty({__proto__:null,exportToMarkdown:wt,getMarkdownTransformers:y_,importFromMarkdown:Kn},Symbol.toStringTag,{value:"Module"}));async function vt(n){let e="";return n.getEditorState().read(()=>{e=fp(n)}),e}async function Wn(n,e){n.update(()=>{const r=new DOMParser().parseFromString(e,"text/html"),i=dp(n,r);fe().clear(),nl(i)})}const Ju=Object.freeze(Object.defineProperty({__proto__:null,exportToHtml:vt,importFromHtml:Wn},Symbol.toStringTag,{value:"Module"}));async function Wv(n,e,t){let r,i,s;switch(e){case"markdown":r=await wt(n),i="text/markdown",s="md";break;case"html":r=await vt(n),i="text/html",s="html";break;case"json":r=JSON.stringify(n.getEditorState().toJSON(),null,2),i="application/json",s="json";break}const o=new Blob([r],{type:i}),l=URL.createObjectURL(o),a=document.createElement("a");a.href=l,a.download=t??`document.${s}`,a.click(),URL.revokeObjectURL(l)}async function jv(n,e,t){const r=await new Promise((s,o)=>{const l=new FileReader;l.onload=()=>s(l.result),l.onerror=()=>o(l.error),l.readAsText(e)});switch(t??Hv(e.name)){case"markdown":{const{importFromMarkdown:s}=await Promise.resolve().then(()=>Hu);await s(n,r);break}case"html":{const{importFromHtml:s}=await Promise.resolve().then(()=>Ju);await s(n,r);break}case"json":{const s=n.parseEditorState(r);n.setEditorState(s);break}}}function Hv(n){return n.endsWith(".md")||n.endsWith(".markdown")?"markdown":n.endsWith(".html")||n.endsWith(".htm")?"html":"json"}async function Hl(n,e){return typeof vf=="function"?vf(n):()=>{}}async function Jv(n,e=3,t=3){n.dispatchCommand(Ts,{rows:String(e),columns:String(t),includeHeaders:!0})}async function Gv(n,e){return typeof Fo=="function"?Fo(n):()=>{}}async function Vv(n,e){return typeof Fo=="function"?Fo(n):()=>{}}const Yv=/#[\w\u0590-\u05ff]+/;function qv(n){return new Cl(n)}async function Zv(n,e){const t=[],r=rS(n,i=>{const s=Yv.exec(i);return s?{start:s.index,end:s.index+s[0].length}:null},Cl,qv);if(Array.isArray(r)?t.push(...r):typeof r=="function"&&t.push(r),e?.onHashtagClick){const i=n.registerCommand(br,s=>{const o=s.target;if(o.classList.contains("bc-lexical-hashtag")){const l=o.textContent;if(l)return e.onHashtagClick(l.replace("#","")),!0}return!1},G);t.push(i)}return()=>{t.forEach(i=>i())}}const Xv=/((https?:\/\/(www\.)?|www\.)[^\s<>]+)/g,Qv=/([a-zA-Z0-9._+-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/g,e0=[{pattern:Xv,urlTransformer:n=>n.startsWith("http")?n:`https://${n}`},{pattern:Qv,urlTransformer:n=>`mailto:${n}`}];async function t0(n,e){const t=e?.matchers??e0;return n.registerMutationListener(Ye,r=>{n.update(()=>{for(const[i,s]of r){if(s!=="created"&&s!=="updated")continue;const o=q(i);if(!o||!D(o))continue;const l=o.getTextContent();for(const a of t){const c=new RegExp(a.pattern.source,a.pattern.flags);let u;for(;(u=c.exec(l))!==null;)a.urlTransformer(u[0])}}})})}async function n0(n,e){const t=[];return e?.onMarkClick&&t.push(n.registerCommand(br,r=>{const i=r.target;if(i.classList.contains("bc-lexical-mark")){const s=i.dataset.markId;if(s)return e.onMarkClick(s,{id:s,type:i.dataset.markType||"annotation",data:{}}),!0}return!1},G)),()=>t.forEach(r=>r())}async function r0(n,e,t){n.update(()=>{const r=O();N(r)&&oS(r,r.isBackward(),e)})}async function i0(n,e){n.update(()=>{const r=fe().getAllTextNodes().filter(i=>{const s=i.getParent();return as(s)?lS(i,0)?.includes(e)??!1:!1});for(const i of r){const s=i.getParent();as(s)&&sS(s)}})}async function s0(n,e){const{maxLength:t,onOverflow:r}=e;return n.registerUpdateListener(({editorState:i})=>{i.read(()=>{const l=fe().getTextContent().length,a=l>t;r&&r(a,l)})})}async function Jl(n){return typeof ef=="function"?ef(n):()=>{}}async function Gl(n,e){const t=e.docMap??new Map,r=e.id??"lexical",i=e.doc.getText(r),s=Av(n,e.provider,i,e.doc,t),o=n.registerUpdateListener(()=>{});return()=>{o(),s&&typeof s.destroy=="function"&&s.destroy()}}function o0(n){let e={hasSelection:!1,selectedText:"",anchorOffset:0,focusOffset:0};return n.getEditorState().read(()=>{const t=O();N(t)&&(e={hasSelection:!t.isCollapsed(),selectedText:t.getTextContent(),anchorOffset:t.anchor.offset,focusOffset:t.focus.offset})}),e}function Gu(n){let e="";return n.getEditorState().read(()=>{e=fe().getTextContent()}),e}function l0(n){return Gu(n).length}function a0(n){const e=Gu(n).trim();return e?e.split(/\s+/).length:0}async function c0(){return eC}async function $s(n={}){const{nodes:e=[],plugins:t=[],onError:r}=n,s=(await m_()).createEditor({namespace:"BeatUIHeadless",nodes:e,onError:o=>{r?r(o,s):console.error("[BeatUI Headless]",o)},editable:!1});if(t.length>0)for(const o of t)o.register(s);return s}async function u0(n){const e=await $s(),{importFromMarkdown:t}=await Promise.resolve().then(()=>Hu);return await t(e,n),e.getEditorState().toJSON()}async function d0(n){const e=await $s(),{exportToMarkdown:t}=await Promise.resolve().then(()=>Hu),r=e.parseEditorState(JSON.stringify(n));return e.setEditorState(r),await t(e)}async function f0(n){const e=await $s(),{importFromHtml:t}=await Promise.resolve().then(()=>Ju);return await t(e,n),e.getEditorState().toJSON()}async function h0(n){const e=await $s(),{exportToHtml:t}=await Promise.resolve().then(()=>Ju),r=e.parseEditorState(JSON.stringify(n));return e.setEditorState(r),await t(e)}const b_=n=>{const{value:e,format:t,plugins:r,readOnly:i,placeholder:s,class:o,namespace:l="BeatUILexical",heightMode:a="auto",onError:c,onInput:u,onChange:d,onBlur:f,onReady:h}=n;return w.Use(vc.Theme,({appearance:g})=>w.html.div(w.Task(()=>Promise.resolve().then(()=>require("../styles-url-CEDSZTyZ.cjs")),({default:p})=>wc.LinkPortal({id:"beatui-lexical-css",href:p})),w.attr.class("bc-lexical-editor-container"),a==="fixed"?w.attr.class("bc-lexical-editor-container--fixed"):null,w.attr.class(o),w.html.div(w.attr.class("bc-lexical-editor"),w.attr.class(`bc-lexical-editor--${a}`),w.attr.contenteditable(i!=null?w.Value.map(i,p=>!p):!0),i!=null?w.attr.class(w.Value.map(i,p=>p?"bc-lexical-editor--readonly":"")):null,w.WithElement(p=>{let m=null;const b=[];return(async()=>{try{const y=r??vl("bare"),S=wl(y),C=w.Value.get(t??"markdown"),x=gi({namespace:l,nodes:S,theme:{heading:{h1:"bc-lexical-h1",h2:"bc-lexical-h2",h3:"bc-lexical-h3",h4:"bc-lexical-h4",h5:"bc-lexical-h5",h6:"bc-lexical-h6"},text:{bold:"bc-lexical-bold",italic:"bc-lexical-italic",underline:"bc-lexical-underline",strikethrough:"bc-lexical-strikethrough",code:"bc-lexical-code"},list:{ul:"bc-lexical-ul",ol:"bc-lexical-ol",listitem:"bc-lexical-li",listitemChecked:"bc-lexical-li-checked",listitemUnchecked:"bc-lexical-li-unchecked"},link:"bc-lexical-link",quote:"bc-lexical-blockquote",code:"bc-lexical-code-block",codeHighlight:{},hashtag:"bc-lexical-hashtag",table:"bc-lexical-table",tableCell:"bc-lexical-table-cell",tableCellHeader:"bc-lexical-table-cell-header",tableRow:"bc-lexical-table-row",mark:"bc-lexical-mark",paragraph:"bc-lexical-paragraph"},onError:E=>{c?c(E,x):console.error("[BeatUI Lexical]",E)},editable:i?!w.Value.get(i):!0});m=x,x.setRootElement(p);const v=[];if(y.richText?v.push(Pl(x)):y.plainText&&v.push(Bl(x)),y.history){const E=typeof y.history=="object"?y.history:void 0;v.push(zl(x,E))}if(y.clipboard&&v.push(Ul(x)),y.list&&v.push(Kl(x)),y.link&&v.push(Wl(x)),y.yjs&&v.push(Gl(x,y.yjs)),y.dragon&&v.push(Jl(x)),y.table&&v.push(Hl(x)),(await Promise.all(v)).forEach(E=>{E&&b.push(E)}),b.push(jl(x)),e!=null){const E=w.Value.get(e);if(E!=null&&(E!==""||C==="json"&&typeof E=="object")){if(C==="markdown"&&typeof E=="string")await Kn(x,E);else if(C==="html"&&typeof E=="string")await Wn(x,E);else if(C==="json"&&typeof E=="object")try{const T=JSON.stringify(E),I=x.parseEditorState(T);x.setEditorState(I)}catch(T){console.error("[BeatUI] Failed to parse JSON editor state:",T),c&&c(T instanceof Error?T:new Error(String(T)),x)}}}b.push(x.registerUpdateListener(({editorState:E,dirtyElements:M,dirtyLeaves:T})=>{M.size===0&&T.size===0||u&&E.read(async()=>{if(C==="markdown"){const I=await wt(x);u(I,x)}else if(C==="html"){const I=await vt(x);u(I,x)}else C==="json"&&u(E.toJSON(),x)})})),e!=null&&b.push(w.Value.on(e,async E=>{if(E!=null){if(C==="markdown"&&typeof E=="string"){const M=await wt(x);E!==M&&await Kn(x,E)}else if(C==="html"&&typeof E=="string"){const M=await vt(x);E!==M&&await Wn(x,E)}else if(C==="json"&&typeof E=="object"){const M=JSON.stringify(x.getEditorState().toJSON()),T=JSON.stringify(E);if(M!==T){const I=x.parseEditorState(T);x.setEditorState(I)}}}})),i!=null&&b.push(w.Value.on(i,E=>{x.setEditable(!E)})),b.push(x.registerCommand(fi,()=>(f&&f(x),d&&x.getEditorState().read(async()=>{if(C==="markdown"){const E=await wt(x);d(E,x)}else if(C==="html"){const E=await vt(x);d(E,x)}else C==="json"&&d(x.getEditorState().toJSON(),x)}),!1),G)),b.push(g.on(E=>{const M=x.getRootElement();M&&(M.dataset.theme=E)})),h&&h(x)}catch(y){console.error("[BeatUI] Failed to initialize Lexical editor:",y);const S=p;S.textContent="Failed to load Lexical editor."}})(),w.OnDispose(()=>{try{b.forEach(y=>y())}catch{}try{m?.setRootElement(null)}catch{}})}))))};function x_(n,e,t){const r=(h,g)=>e.map(()=>{const p=n.value;return p?p.getEditorState().read(()=>{const m=O();return N(m)?h(m):g}):g}),i=h=>{const g=h.anchor.getNode();return g.getKey()==="root"?g:g.getTopLevelElementOrThrow()};return{withSelection:r,getAnchorElement:i,textFormatActive:h=>r(g=>g.hasFormat(h),!1),blockTypeActive:h=>r(g=>i(g).getType()===h,!1),listTypeActive:h=>r(g=>{const p=i(g).getParent();return J(p)&&p.getListType()===h},!1),headingActive:h=>e.map(()=>{const g=n.value;return g?g.getEditorState().read(()=>{const p=O();if(N(p)){const m=i(p);if(m.getType()==="heading")return g.getElementByKey(m.getKey())?.tagName===`H${h}`}return!1}):!1}),linkActive:()=>r(h=>{const g=h.anchor.getNode();return g.getParent()?.getType()==="link"||g.getType()==="link"},!1),dispatch:(h,g)=>()=>{const p=n.value;p&&(p.dispatchCommand(h,g),p.focus())},toggleBlock:(h,g)=>()=>{const p=n.value;p&&(p.update(()=>{const m=O();if(N(m)){const b=i(m);et(m,()=>b.getType()===h?H():g())}}),p.focus())},toggleLink:()=>{const h=n.value;h&&(h.getEditorState().read(()=>{const g=O();if(N(g)){const p=g.anchor.getNode();if(p.getParent()?.getType()==="link"||p.getType()==="link")h.dispatchCommand(lc,null);else{const _=prompt(t?.enterUrlMessage?.()??"Enter URL:");_&&h.dispatchCommand(lc,_)}}}),h.focus())}}}function S_(n,e){return t=>r=>ct.EditorToolbarButton({...r,display:t,disabled:n,size:e})}const g0=[{value:"Arial",label:"Arial"},{value:"Courier New",label:"Courier New"},{value:"Georgia",label:"Georgia"},{value:"Times New Roman",label:"Times New Roman"},{value:"Trebuchet MS",label:"Trebuchet MS"},{value:"Verdana",label:"Verdana"}],p0=[{value:"10px",label:"10"},{value:"12px",label:"12"},{value:"14px",label:"14"},{value:"16px",label:"16"},{value:"18px",label:"18"},{value:"20px",label:"20"},{value:"24px",label:"24"},{value:"30px",label:"30"},{value:"36px",label:"36"}];function C_({editor:n,stateUpdate:e,toolbar:t={},readOnly:r=w.signal(!1),size:i="sm"}){const{visibleGroups:s,hiddenGroups:o,maxHeadingLevel:l=3}=t,a=c=>!(o?.includes(c)||s&&!s.includes(c));return w.Use(nr.BeatUII18n,c=>w.Ensure(n,u=>{const d=u,f=c.$.lexical,h=w.signal(a("text-formatting")),g=w.signal(a("headings")),p=w.signal(a("lists")),m=w.signal(a("blocks")),b=w.signal(a("links")),_=w.signal(a("indent")),y=w.signal(a("tables")),S=w.signal(a("history")),C=w.signal(a("clipboard")),x=w.signal(a("font")),v=w.signal(a("color")),k=w.signal(a("clear-formatting")),{getAnchorElement:E,textFormatActive:M,blockTypeActive:T,listTypeActive:I,headingActive:K,linkActive:$,dispatch:R,toggleBlock:W,toggleLink:Z}=x_(d,e,{enterUrlMessage:()=>c.value.lexical.enterUrl}),Y=S_(r,i),se=()=>{const F=d.value;F&&(F.update(()=>{const U=O();N(U)&&et(U,()=>H())}),F.focus())},Ke=F=>{const U=d.value;U&&(U.update(()=>{const X=O();if(N(X)){const Gn=E(X),Is=`h${F}`,B_=U.getElementByKey(Gn.getKey());Gn.getType()==="heading"&&B_?.tagName===`H${F}`?et(X,()=>H()):et(X,()=>ft(Is))}}),U.focus())},qe=Y(h),j=Y(g),pe=Y(p),oe=Y(m),Ze=Y(b),Se=Y(_),We=Y(y),Xe=Y(k),bt=Y(S),Ce=Y(C),wn=()=>{const F=d.value;if(!F)return;const U=F.getRootElement();U&&(U.focus(),document.execCommand("copy"))},Ti=()=>{const F=d.value;if(!F)return;const U=F.getRootElement();U&&(U.focus(),document.execCommand("cut"))},Zt=()=>{const F=d.value;F&&navigator.clipboard.readText().then(U=>{F.update(()=>{const X=O();N(X)&&X.insertText(U)}),F.focus()}).catch(()=>{})},Ni=()=>{const F=d.value;F&&(F.update(()=>{const U=O();if(N(U))for(const X of U.getNodes())D(X)&&(X.setFormat(0),X.setStyle(""))}),F.focus())},Vl=()=>{const F=d.value;F&&(F.dispatchCommand(Ts,{rows:"3",columns:"3",includeHeaders:!0}),F.focus())},Vu={value:"",label:c.value.lexical.defaultOption},T_=[Vu,...t.fontFamilies??g0],N_=[Vu,...t.fontSizes??p0],A_=e.map(()=>{const F=d.value;return F?F.getEditorState().read(()=>{const U=O();return N(U)?zs(U,"font-family",""):""}):""}),O_=e.map(()=>{const F=d.value;return F?F.getEditorState().read(()=>{const U=O();return N(U)?zs(U,"font-size",""):""}):""}),M_=F=>{const U=d.value;U&&(U.update(()=>{const X=O();N(X)&&Bs(X,{"font-family":F||null})}),U.focus())},$_=F=>{const U=d.value;U&&(U.update(()=>{const X=O();N(X)&&Bs(X,{"font-size":F||null})}),U.focus())},I_=e.map(()=>{const F=d.value;return F?F.getEditorState().read(()=>{const U=O();return N(U)&&zs(U,"color","")||"#000000"}):"#000000"}),F_=e.map(()=>{const F=d.value;return F?F.getEditorState().read(()=>{const U=O();return N(U)&&zs(U,"background-color","")||"#ffffff"}):"#ffffff"}),D_=e.map(()=>{const F=d.value;return F?F.getEditorState().read(()=>{const U=O();if(N(U)){const X=E(U);return F.getElementByKey(X.getKey())?.style.backgroundColor||"#ffffff"}return"#ffffff"}):"#ffffff"}),L_=F=>{const U=d.value;U&&(U.update(()=>{const X=O();N(X)&&Bs(X,{color:F})}),U.focus())},R_=F=>{const U=d.value;U&&(U.update(()=>{const X=O();N(X)&&Bs(X,{"background-color":F})}),U.focus())},P_=F=>{const U=d.value;U&&(U.update(()=>{const X=O();if(N(X)){const Gn=E(X),Is=U.getElementByKey(Gn.getKey());Is&&(Is.style.backgroundColor=F)}}),U.focus())};return z_.Toolbar(w.attr.class("bc-lexical-toolbar"),w.When(x,()=>ct.EditorToolbarGroup({display:[x]},w.html.select(w.attr.class("bc-lexical-toolbar-select"),w.attr.title(f.map(F=>F.fontFamily)),w.attr.disabled(r),w.on.change(F=>M_(F.target.value)),...T_.map(F=>w.html.option(w.attr.value(F.value),w.attr.selected(A_.map(U=>U===F.value)),F.label))),w.html.select(w.attr.class("bc-lexical-toolbar-select"),w.attr.title(f.map(F=>F.fontSize)),w.attr.disabled(r),w.on.change(F=>$_(F.target.value)),...N_.map(F=>w.html.option(w.attr.value(F.value),w.attr.selected(O_.map(U=>U===F.value)),F.label))))),w.When(v,()=>ct.EditorToolbarGroup({display:[v]},w.html.label(w.attr.class("bc-lexical-toolbar-color"),w.attr.title(f.map(F=>F.fontColor)),w.html.input(w.attr.type("color"),w.attr.value(I_),w.attr.disabled(r),w.on.input(F=>L_(F.target.value))),w.html.span(w.attr.class("bc-lexical-toolbar-color-icon"),"A")),w.html.label(w.attr.class("bc-lexical-toolbar-color"),w.attr.title(f.map(F=>F.highlightColor)),w.html.input(w.attr.type("color"),w.attr.value(F_),w.attr.disabled(r),w.on.input(F=>R_(F.target.value))),w.html.span(w.attr.class("bc-lexical-toolbar-color-icon bc-lexical-toolbar-color-icon--highlight"),"A")),w.html.label(w.attr.class("bc-lexical-toolbar-color"),w.attr.title(f.map(F=>F.backgroundColor)),w.html.input(w.attr.type("color"),w.attr.value(D_),w.attr.disabled(r),w.on.input(F=>P_(F.target.value))),w.html.span(w.attr.class("bc-lexical-toolbar-color-icon bc-lexical-toolbar-color-icon--bg"),"■")))),ct.EditorToolbarGroup({display:Array(5).fill(h)},qe({active:M("bold"),onClick:R(ve,"bold"),label:f.map(F=>F.bold),icon:"mdi:format-bold"}),qe({active:M("italic"),onClick:R(ve,"italic"),label:f.map(F=>F.italic),icon:"mdi:format-italic"}),qe({active:M("underline"),onClick:R(ve,"underline"),label:f.map(F=>F.underline),icon:"mdi:format-underline"}),qe({active:M("strikethrough"),onClick:R(ve,"strikethrough"),label:f.map(F=>F.strikethrough),icon:"mdi:format-strikethrough"}),qe({active:M("code"),onClick:R(ve,"code"),label:f.map(F=>F.code),icon:"mdi:code-tags"})),ct.EditorToolbarGroup({display:[k]},Xe({active:w.signal(!1),onClick:Ni,label:f.map(F=>F.clearFormatting),icon:"mdi:format-clear"})),ct.EditorToolbarGroup({display:[g,...Array(l).fill(g)]},j({active:T("paragraph"),onClick:se,label:f.map(F=>F.normal),icon:"mdi:format-paragraph"}),...Array.from({length:l},(F,U)=>{const X=U+1;return j({active:K(X),onClick:()=>Ke(X),label:f.map(Gn=>Gn.heading(X)),icon:`mdi:format-header-${X}`})})),ct.EditorToolbarGroup({display:Array(3).fill(p)},pe({active:I("bullet"),onClick:R(bi,void 0),label:f.map(F=>F.bulletList),icon:"mdi:format-list-bulleted"}),pe({active:I("number"),onClick:R(xi,void 0),label:f.map(F=>F.orderedList),icon:"mdi:format-list-numbered"}),pe({active:I("check"),onClick:R(xl,void 0),label:f.map(F=>F.checkList),icon:"mdi:format-list-checks"})),ct.EditorToolbarGroup({display:Array(2).fill(_)},Se({active:w.signal(!1),onClick:R(Ut,void 0),label:f.map(F=>F.indent),icon:"mdi:format-indent-increase"}),Se({active:w.signal(!1),onClick:R(sn,void 0),label:f.map(F=>F.outdent),icon:"mdi:format-indent-decrease"})),ct.EditorToolbarGroup({display:Array(3).fill(m)},oe({active:T("quote"),onClick:W("quote",yi),label:f.map(F=>F.blockquote),icon:"mdi:format-quote-close"}),oe({active:T("code"),onClick:W("code",St),label:f.map(F=>F.codeBlock),icon:"mdi:code-braces"}),oe({active:w.signal(!1),onClick:R(Ms,void 0),label:f.map(F=>F.horizontalRule),icon:"mdi:minus"})),ct.EditorToolbarGroup({display:[y]},We({active:w.signal(!1),onClick:Vl,label:f.map(F=>F.insertTable),icon:"mdi:table-plus"})),ct.EditorToolbarGroup({display:[b]},Ze({active:$(),onClick:Z,label:f.map(F=>F.link),icon:"mdi:link"})),ct.EditorToolbarGroup({display:Array(2).fill(S)},bt({active:w.signal(!1),onClick:R(ai,void 0),label:f.map(F=>F.undo),icon:"mdi:undo"}),bt({active:w.signal(!1),onClick:R(ci,void 0),label:f.map(F=>F.redo),icon:"mdi:redo"})),ct.EditorToolbarGroup({display:Array(3).fill(C)},Ce({active:w.signal(!1),onClick:Ti,label:f.map(F=>F.cut),icon:"mdi:content-cut"}),Ce({active:w.signal(!1),onClick:wn,label:f.map(F=>F.copy),icon:"mdi:content-copy"}),Ce({active:w.signal(!1),onClick:Zt,label:f.map(F=>F.paste),icon:"mdi:content-paste"})))}))}function w_({editor:n,stateUpdate:e,readOnly:t=w.signal(!1)}){const r=w.prop(!1),i=w.prop(0),s=w.prop(0),o=()=>{const p=n.value;if(!p){r.value=!1;return}p.getEditorState().read(()=>{const m=O();if(!N(m)){r.value=!1;return}let _=m.anchor.getNode(),y=null;for(;_;){if(ge(_)){y=_;break}if(_=_.getParent(),!_||_.getKey()==="root")break}if(!y){r.value=!1;return}const S=p.getElementByKey(y.getKey()),C=p.getRootElement();if(S&&C){const x=S.getBoundingClientRect(),v=C.closest(".bc-lexical-editor-container"),k=v?v.getBoundingClientRect():C.getBoundingClientRect();i.value=x.bottom-k.top+4,s.value=x.left-k.left}r.value=!0})};e.onChange(o);const l=()=>{const p=n.value;p&&(p.update(()=>{yf(!1)}),p.focus())},a=()=>{const p=n.value;p&&(p.update(()=>{yf(!0)}),p.focus())},c=()=>{const p=n.value;p&&(p.update(()=>{bf(!1)}),p.focus())},u=()=>{const p=n.value;p&&(p.update(()=>{bf(!0)}),p.focus())},d=()=>{const p=n.value;p&&(p.update(()=>{xx()}),p.focus())},f=()=>{const p=n.value;p&&(p.update(()=>{Sx()}),p.focus())},h=()=>{const p=n.value;p&&(p.update(()=>{const m=O();if(!N(m))return;const b=m.anchor.getNode(),_=bx(b);if(!_)return;Fp(_).remove()}),p.focus())},g=w.html.div(w.attr.class("bc-table-context-menu"),w.attr.role("menu"),w.style.position("absolute"),w.style.top(i.map(p=>`${p}px`)),w.style.left(s.map(p=>`${p}px`)),w.style.zIndex("1000"),w.style.backgroundColor("var(--color-surface)"),w.style.border("1px solid var(--color-border)"),w.style.borderRadius("var(--radius-md)"),w.style.boxShadow("0 2px 8px rgba(0, 0, 0, 0.15)"),w.style.padding("var(--spacing-xs)"),w.style.minWidth("180px"),w.WithElement(p=>{const m=_=>{if(_.key==="Escape"&&r.value){r.value=!1;const y=n.value;y&&y.focus()}},b=_=>{if(r.value&&!p.contains(_.target)){const y=n.value;if(y){const S=y.getRootElement();if(S&&S.contains(_.target))return}r.value=!1}};return document.addEventListener("keydown",m),document.addEventListener("mousedown",b),w.OnDispose(()=>{document.removeEventListener("keydown",m),document.removeEventListener("mousedown",b)})}),Yn("Insert row above",l,t),Yn("Insert row below",a,t),Yn("Insert column left",c,t),Yn("Insert column right",u,t),w.html.div(w.attr.class("bc-table-menu-separator"),w.style.height("1px"),w.style.backgroundColor("var(--color-border)"),w.style.margin("var(--spacing-xs) 0")),Yn("Delete row",d,t,"danger"),Yn("Delete column",f,t,"danger"),Yn("Delete table",h,t,"danger"));return w.When(r,()=>g)}function Yn(n,e,t,r="default"){return w.html.button(w.attr.class("bc-table-menu-button"),w.attr.type("button"),w.attr.role("menuitem"),w.attr.disabled(t),w.on.click(e),w.style.display("block"),w.style.width("100%"),w.style.padding("var(--spacing-xs) var(--spacing-sm)"),w.style.border("none"),w.style.backgroundColor("transparent"),w.style.color(r==="danger"?"var(--color-danger-600)":"var(--color-neutral-900)"),w.style.textAlign("left"),w.style.cursor("pointer"),w.style.borderRadius("var(--radius-sm)"),w.style.fontSize("0.875rem"),w.style.transition("background-color 0.15s"),w.html.span(n))}const m0=n=>{const{value:e,format:t,plugins:r,readOnly:i,placeholder:s,class:o,namespace:l="BeatUILexical",heightMode:a="fixed",toolbar:c,onError:u,onInput:d,onChange:f,onBlur:h,onReady:g}=n,p=w.prop(null),m=w.prop(0),b=y=>typeof y=="object"&&y!==null&&"map"in y&&typeof y.map=="function",_=i!=null?b(i)?i:w.prop(w.Value.get(i)):w.prop(!1);return w.Use(vc.Theme,({appearance:y})=>w.html.div(w.Task(()=>Promise.resolve().then(()=>require("../styles-url-CEDSZTyZ.cjs")),({default:S})=>wc.LinkPortal({id:"beatui-lexical-css",href:S})),w.attr.class("bc-lexical-editor-container"),a==="fixed"?w.attr.class("bc-lexical-editor-container--fixed"):null,w.attr.class(o),w.When(_.map(S=>!S),()=>C_({editor:p,stateUpdate:m,toolbar:c,readOnly:_,size:"sm"})),w_({editor:p,stateUpdate:m,readOnly:_}),w.html.div(w.attr.class("bc-lexical-editor"),w.attr.class(`bc-lexical-editor--${a}`),w.attr.contenteditable(i!=null?w.Value.map(i,S=>!S):!0),i!=null?w.attr.class(w.Value.map(i,S=>S?"bc-lexical-editor--readonly":"")):null,w.WithElement(S=>{let C=null;const x=[];return(async()=>{try{const k=r??vl("docked"),E=wl(k),M=w.Value.get(t??"markdown"),T=gi({namespace:l,nodes:E,theme:{heading:{h1:"bc-lexical-h1",h2:"bc-lexical-h2",h3:"bc-lexical-h3",h4:"bc-lexical-h4",h5:"bc-lexical-h5",h6:"bc-lexical-h6"},text:{bold:"bc-lexical-bold",italic:"bc-lexical-italic",underline:"bc-lexical-underline",strikethrough:"bc-lexical-strikethrough",code:"bc-lexical-code"},list:{ul:"bc-lexical-ul",ol:"bc-lexical-ol",listitem:"bc-lexical-li",listitemChecked:"bc-lexical-li-checked",listitemUnchecked:"bc-lexical-li-unchecked"},link:"bc-lexical-link",quote:"bc-lexical-blockquote",code:"bc-lexical-code-block",codeHighlight:{},hashtag:"bc-lexical-hashtag",table:"bc-lexical-table",tableCell:"bc-lexical-table-cell",tableCellHeader:"bc-lexical-table-cell-header",tableRow:"bc-lexical-table-row",mark:"bc-lexical-mark",paragraph:"bc-lexical-paragraph"},onError:$=>{u?u($,T):console.error("[BeatUI Lexical]",$)},editable:i?!w.Value.get(i):!0});C=T,p.set(T),T.setRootElement(S);const I=[];if(k.richText?I.push(Pl(T)):k.plainText&&I.push(Bl(T)),k.history){const $=typeof k.history=="object"?k.history:void 0;I.push(zl(T,$))}if(k.clipboard&&I.push(Ul(T)),k.list&&I.push(Kl(T)),k.link&&I.push(Wl(T)),k.yjs&&I.push(Gl(T,k.yjs)),k.dragon&&I.push(Jl(T)),k.table&&I.push(Hl(T)),(await Promise.all(I)).forEach($=>{$&&x.push($)}),x.push(jl(T)),x.push(T.registerCommand(oi,()=>(m.set(m.value+1),!1),G)),x.push(T.registerUpdateListener(({editorState:$,dirtyElements:R,dirtyLeaves:W})=>{(R.size>0||W.size>0)&&m.set(m.value+1),d&&(R.size>0||W.size>0)&&$.read(async()=>{if(M==="markdown"){const Z=await wt(T);d(Z,T)}else if(M==="html"){const Z=await vt(T);d(Z,T)}else M==="json"&&d($.toJSON(),T)})})),e!=null){const $=w.Value.get(e);if($!=null&&($!==""||M==="json"&&typeof $=="object")){if(M==="markdown"&&typeof $=="string")await Kn(T,$);else if(M==="html"&&typeof $=="string")await Wn(T,$);else if(M==="json"&&typeof $=="object")try{const W=JSON.stringify($),Z=T.parseEditorState(W);T.setEditorState(Z)}catch(W){console.error("[BeatUI] Failed to parse JSON editor state:",W),u&&u(W instanceof Error?W:new Error(String(W)),T)}}}e!=null&&x.push(w.Value.on(e,async $=>{if($!=null){if(M==="markdown"&&typeof $=="string"){const R=await wt(T);$!==R&&await Kn(T,$)}else if(M==="html"&&typeof $=="string"){const R=await vt(T);$!==R&&await Wn(T,$)}else if(M==="json"&&typeof $=="object"){const R=JSON.stringify(T.getEditorState().toJSON()),W=JSON.stringify($);if(R!==W){const Z=T.parseEditorState(W);T.setEditorState(Z)}}}})),i!=null&&x.push(w.Value.on(i,$=>{T.setEditable(!$)})),x.push(T.registerCommand(fi,()=>(h&&h(T),f&&T.getEditorState().read(async()=>{if(M==="markdown"){const $=await wt(T);f($,T)}else if(M==="html"){const $=await vt(T);f($,T)}else M==="json"&&f(T.getEditorState().toJSON(),T)}),!1),G)),x.push(y.on($=>{const R=T.getRootElement();R&&(R.dataset.theme=$)})),g&&g(T)}catch(k){console.error("[BeatUI] Failed to initialize Lexical editor:",k);const E=S;E.textContent="Failed to load Lexical editor."}})(),w.OnDispose(()=>{try{x.forEach(k=>k())}catch{}try{C?.setRootElement(null)}catch{}p.set(null)})}))))};function v_({editor:n,stateUpdate:e,groups:t=["text-formatting"],readOnly:r=w.signal(!1),size:i="sm"}){const s=w.prop(!1),o=w.prop(0),l=w.prop(0);return w.Use(nr.BeatUII18n,a=>w.Ensure(n,c=>{const u=c,d=a.$.lexical,f=v=>t.includes(v),{textFormatActive:h,linkActive:g,dispatch:p,toggleLink:m}=x_(u,e,{enterUrlMessage:()=>a.value.lexical.enterUrl}),_=S_(r,i)(w.signal(!0)),y=()=>{const v=u.value;if(!v){s.value=!1;return}const k=v.getRootElement();if(!k){s.value=!1;return}const E=window.getSelection();if(!E||E.rangeCount===0||E.isCollapsed){s.value=!1;return}const M=E.anchorNode;if(M&&!k.contains(M)){s.value=!1;return}const I=E.getRangeAt(0).getBoundingClientRect();if(I.width===0&&I.height===0){s.value=!1;return}const K=40,$=8;let R=I.top-K-$;const W=I.left+I.width/2;R<0&&(R=I.bottom+$),o.value=R,l.value=W,s.value=!0},S=e.onChange(y),C=()=>{y()};document.addEventListener("selectionchange",C);const x=w.html.div(w.attr.class("bc-floating-toolbar"),w.style.position("fixed"),w.style.top(o.map(v=>`${v}px`)),w.style.left(l.map(v=>`${v}px`)),w.style.transform("translateX(-50%)"),w.WithElement(v=>{const k=M=>{if(M.key==="Escape"&&s.value){s.value=!1;const T=u.value;T&&T.focus()}},E=M=>{if(s.value&&!v.contains(M.target)){const T=u.value;if(T){const I=T.getRootElement();if(I&&I.contains(M.target))return}s.value=!1}};return document.addEventListener("keydown",k),document.addEventListener("mousedown",E),w.OnDispose(()=>{S(),document.removeEventListener("keydown",k),document.removeEventListener("mousedown",E),document.removeEventListener("selectionchange",C)})}),...f("text-formatting")?[_({active:h("bold"),onClick:p(ve,"bold"),label:d.map(v=>v.bold),icon:"mdi:format-bold"}),_({active:h("italic"),onClick:p(ve,"italic"),label:d.map(v=>v.italic),icon:"mdi:format-italic"}),_({active:h("underline"),onClick:p(ve,"underline"),label:d.map(v=>v.underline),icon:"mdi:format-underline"}),_({active:h("strikethrough"),onClick:p(ve,"strikethrough"),label:d.map(v=>v.strikethrough),icon:"mdi:format-strikethrough"}),_({active:h("code"),onClick:p(ve,"code"),label:d.map(v=>v.code),icon:"mdi:code-tags"})]:[],...f("links")?[_({active:g(),onClick:m,label:d.map(v=>v.link),icon:"mdi:link"})]:[],...f("clipboard")?[_({active:w.signal(!1),onClick:()=>{const v=u.value;if(!v)return;const k=v.getRootElement();k&&(k.focus(),document.execCommand("cut"))},label:d.map(v=>v.cut),icon:"mdi:content-cut"}),_({active:w.signal(!1),onClick:()=>{const v=u.value;if(!v)return;const k=v.getRootElement();k&&(k.focus(),document.execCommand("copy"))},label:d.map(v=>v.copy),icon:"mdi:content-copy"}),_({active:w.signal(!1),onClick:()=>{const v=u.value;v&&navigator.clipboard.readText().then(k=>{v.update(()=>{const E=O();N(E)&&E.insertText(k)}),v.focus()}).catch(()=>{})},label:d.map(v=>v.paste),icon:"mdi:content-paste"})]:[]);return w.When(s,()=>x)}))}const _0=[{id:"heading1",label:"Heading 1",description:"Large section heading",icon:"mdi:format-header-1",keywords:["h1","heading","title"],category:"Basic blocks",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>ft("h1"))})}},{id:"heading2",label:"Heading 2",description:"Medium section heading",icon:"mdi:format-header-2",keywords:["h2","heading"],category:"Basic blocks",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>ft("h2"))})}},{id:"heading3",label:"Heading 3",description:"Small section heading",icon:"mdi:format-header-3",keywords:["h3","heading"],category:"Basic blocks",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>ft("h3"))})}},{id:"bullet-list",label:"Bullet List",description:"Create a bulleted list",icon:"mdi:format-list-bulleted",keywords:["ul","unordered","bullets"],category:"Lists",handler:n=>{n.dispatchCommand(bi,void 0)}},{id:"ordered-list",label:"Ordered List",description:"Create a numbered list",icon:"mdi:format-list-numbered",keywords:["ol","numbered","1","2","3"],category:"Lists",handler:n=>{n.dispatchCommand(xi,void 0)}},{id:"quote",label:"Quote",description:"Insert a blockquote",icon:"mdi:format-quote-close",keywords:["blockquote","citation"],category:"Basic blocks",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>yi())})}},{id:"code-block",label:"Code Block",description:"Insert a code block",icon:"mdi:code-braces",keywords:["code","pre","programming"],category:"Basic blocks",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>St())})}},{id:"divider",label:"Divider",description:"Insert a horizontal rule",icon:"mdi:minus",keywords:["hr","horizontal","line","separator"],category:"Basic blocks",handler:n=>{n.dispatchCommand(Ms,void 0)}},{id:"table",label:"Table",description:"Insert a table",icon:"mdi:table",keywords:["table","grid","cells","rows","columns"],category:"Advanced",handler:n=>{n.dispatchCommand(Ts,{rows:"3",columns:"3",includeHeaders:!0})}}];function y0({commands:n,isVisible:e,filterText:t,position:r,onSelect:i,onDismiss:s}){const o=w.prop(0),l=t.map(f=>{const h=f.toLowerCase().trim();return h?n.filter(g=>[g.label.toLowerCase(),g.description?.toLowerCase()||"",...g.keywords?.map(m=>m.toLowerCase())||[]].join(" ").includes(h)):n});l.onChange(()=>{o.value=0});const a=f=>{const h=l.value;if(f>=0&&f<h.length){const g=h[f];i(g)}},c=f=>{if(!e.value)return;const g=l.value.length-1;switch(f.key){case"ArrowDown":f.preventDefault(),o.value=Math.min(o.value+1,g);break;case"ArrowUp":f.preventDefault(),o.value=Math.max(o.value-1,0);break;case"Enter":f.preventDefault(),a(o.value);break;case"Escape":f.preventDefault(),s();break}},u=(f,h)=>{const g=o.map(m=>m===h),p=`slash-cmd-${f.id}`;return w.html.div(w.attr.class("bc-slash-command-palette__item"),w.attr.id(p),w.attr.role("option"),w.aria.selected(g),w.WithElement(m=>{const b=()=>{o.value=h},_=()=>{a(h)};return m.addEventListener("mouseenter",b),m.addEventListener("click",_),w.OnDispose(()=>{m.removeEventListener("mouseenter",b),m.removeEventListener("click",_)})}),typeof f.icon=="string"?w.html.div(w.attr.class("bc-slash-command-palette__icon"),nr.Icon({icon:f.icon,size:"sm"})):f.icon,w.html.div(w.attr.class("bc-slash-command-palette__content"),w.html.div(w.attr.class("bc-slash-command-palette__label"),f.label),f.description?w.html.div(w.attr.class("bc-slash-command-palette__description"),f.description):void 0),f.category?w.html.div(w.attr.class("bc-slash-command-palette__category"),f.category):void 0)},d=w.Use(nr.BeatUII18n,f=>w.html.div(w.attr.class("bc-slash-command-palette"),w.attr.role("listbox"),w.aria.label(f.$.lexical.map(h=>h.slashCommands)),w.style.position("absolute"),w.style.top(r.map(h=>`${h.top}px`)),w.style.left(r.map(h=>`${h.left}px`)),w.WithElement(()=>(document.addEventListener("keydown",c),w.OnDispose(()=>{document.removeEventListener("keydown",c)}))),w.When(l.map(h=>h.length===0),()=>w.html.div(w.attr.class("bc-slash-command-palette__empty"),f.$.lexical.map(h=>h.noCommandsFound))),w.ForEach(l,(h,g)=>{const p=h.value;return u(p,g.index)})));return w.When(e,()=>d)}const E_=[{id:"paragraph",label:"Paragraph",icon:"mdi:format-paragraph",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>H())})}},{id:"heading1",label:"Heading 1",icon:"mdi:format-header-1",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>ft("h1"))})}},{id:"heading2",label:"Heading 2",icon:"mdi:format-header-2",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>ft("h2"))})}},{id:"heading3",label:"Heading 3",icon:"mdi:format-header-3",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>ft("h3"))})}},{id:"bullet-list",label:"Bullet List",icon:"mdi:format-list-bulleted",handler:n=>{n.dispatchCommand(bi,void 0)}},{id:"ordered-list",label:"Ordered List",icon:"mdi:format-list-numbered",handler:n=>{n.dispatchCommand(xi,void 0)}},{id:"quote",label:"Quote",icon:"mdi:format-quote-close",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>yi())})}},{id:"code-block",label:"Code Block",icon:"mdi:code-braces",handler:n=>{n.update(()=>{const e=O();N(e)&&et(e,()=>St())})}},{id:"divider",label:"Divider",icon:"mdi:minus",handler:n=>{n.dispatchCommand(Ms,void 0)}},{id:"table",label:"Table",icon:"mdi:table",handler:n=>{n.dispatchCommand(Ts,{rows:"3",columns:"3",includeHeaders:!0})}}];function k_({editor:n,stateUpdate:e,readOnly:t=w.signal(!1),commands:r=E_}){const i=w.prop(!1),s=w.prop(!1),o=w.prop(0),l=w.prop(0);return w.Use(nr.BeatUII18n,a=>w.Ensure(n,c=>{const u=c;let d=null,f=!1,h=null,g=null;const p=24,m=4,b=200,_=T=>{if(T===d&&i.value)return;d=T;const I=T.getBoundingClientRect();o.value=I.top,l.value=I.left-p-m,i.value=!0},y=()=>{h!=null&&(clearTimeout(h),h=null)},S=()=>{s.value||(y(),h=setTimeout(()=>{h=null,s.value||(i.value=!1,d=null)},b))},C=()=>{const T=u.value;if(!T)return;const I=T.getRootElement();I&&(k(I),T.getEditorState().read(()=>{const K=O();if(N(K))try{const R=K.anchor.getNode().getTopLevelElementOrThrow(),W=T.getElementByKey(R.getKey());W&&_(W)}catch{}}))},x=T=>{if(s.value)return;const I=u.value;if(!I)return;const K=I.getRootElement();if(K)for(const $ of Array.from(K.children)){const R=$.getBoundingClientRect();if(T.clientY>=R.top&&T.clientY<=R.bottom){y(),_($);return}}},v=()=>{S()},k=T=>{f||(f=!0,T.addEventListener("mousemove",x),T.addEventListener("mouseleave",v))},E=e.onChange(C);return[w.OnDispose(()=>{E(),y();const T=u.value;if(T){const I=T.getRootElement();I&&f&&(I.removeEventListener("mousemove",x),I.removeEventListener("mouseleave",v))}}),w.When(i,()=>w.html.div(w.attr.class("bc-block-handle"),w.style.position("fixed"),w.style.top(o.map(T=>`${T}px`)),w.style.left(l.map(T=>`${T}px`)),w.on.mouseenter(y),w.on.mouseleave(()=>S()),w.WithElement(T=>{T.addEventListener("mousedown",I=>{I.preventDefault()})}),w.html.button(w.attr.class("bc-block-handle__button"),w.attr.type("button"),w.attr.title(a.$.lexical.map(T=>T.changeBlockType)),w.attr.disabled(t),nr.Icon({icon:"mdi:drag-horizontal-variant",size:"sm"}),w.WithElement(T=>{const I=new MutationObserver(()=>{const K=T.getAttribute("aria-expanded")==="true";s.value=K});return I.observe(T,{attributes:!0,attributeFilter:["aria-expanded"]}),w.OnDispose(()=>I.disconnect())}),qu.Menu({items:()=>r.map(T=>qu.MenuItem({key:T.id,content:T.label,startContent:nr.Icon({icon:T.icon,size:"sm"}),onClick:()=>{const I=u.value;I&&(T.handler(I),g?.(),I.focus())}})),placement:"bottom-start",showOn:(T,I)=>(g=I,w.on.click(()=>{s.value?I():(T(),s.value=!0)})),showDelay:0,hideDelay:0,mainAxisOffset:4,onClose:()=>{const T=u.value;T&&T.focus()},ariaLabel:a.value.lexical.blockTypes}))))]}))}const b0=n=>{const{value:e,format:t,plugins:r,readOnly:i,placeholder:s,class:o,namespace:l="BeatUILexical",heightMode:a="auto",floatingToolbarGroups:c,onError:u,onInput:d,onChange:f,onBlur:h,onReady:g}=n,p=w.prop(null),m=w.prop(0),b=y=>typeof y=="object"&&y!==null&&"map"in y&&typeof y.map=="function",_=i!=null?b(i)?i:w.prop(w.Value.get(i)):w.prop(!1);return w.Use(vc.Theme,({appearance:y})=>w.html.div(w.Task(()=>Promise.resolve().then(()=>require("../styles-url-CEDSZTyZ.cjs")),({default:S})=>wc.LinkPortal({id:"beatui-lexical-css",href:S})),w.attr.class("bc-lexical-editor-container"),a==="fixed"?w.attr.class("bc-lexical-editor-container--fixed"):null,w.attr.class(o),v_({editor:p,stateUpdate:m,groups:c??["text-formatting","links"],readOnly:_}),k_({editor:p,stateUpdate:m,readOnly:_}),w_({editor:p,stateUpdate:m,readOnly:_}),w.html.div(w.attr.class("bc-lexical-editor"),w.attr.class(`bc-lexical-editor--${a}`),w.attr.contenteditable(i!=null?w.Value.map(i,S=>!S):!0),i!=null?w.attr.class(w.Value.map(i,S=>S?"bc-lexical-editor--readonly":"")):null,w.WithElement(S=>{let C=null;const x=[];return(async()=>{try{const k=r??vl("contextual"),E=wl(k),M=w.Value.get(t??"markdown"),T=gi({namespace:l,nodes:E,theme:{heading:{h1:"bc-lexical-h1",h2:"bc-lexical-h2",h3:"bc-lexical-h3",h4:"bc-lexical-h4",h5:"bc-lexical-h5",h6:"bc-lexical-h6"},text:{bold:"bc-lexical-bold",italic:"bc-lexical-italic",underline:"bc-lexical-underline",strikethrough:"bc-lexical-strikethrough",code:"bc-lexical-code"},list:{ul:"bc-lexical-ul",ol:"bc-lexical-ol",listitem:"bc-lexical-li",listitemChecked:"bc-lexical-li-checked",listitemUnchecked:"bc-lexical-li-unchecked"},link:"bc-lexical-link",quote:"bc-lexical-blockquote",code:"bc-lexical-code-block",codeHighlight:{},hashtag:"bc-lexical-hashtag",table:"bc-lexical-table",tableCell:"bc-lexical-table-cell",tableCellHeader:"bc-lexical-table-cell-header",tableRow:"bc-lexical-table-row",mark:"bc-lexical-mark",paragraph:"bc-lexical-paragraph"},onError:$=>{u?u($,T):console.error("[BeatUI Lexical]",$)},editable:i?!w.Value.get(i):!0});C=T,p.set(T),T.setRootElement(S);const I=[];if(k.richText?I.push(Pl(T)):k.plainText&&I.push(Bl(T)),k.history){const $=typeof k.history=="object"?k.history:void 0;I.push(zl(T,$))}if(k.clipboard&&I.push(Ul(T)),k.list&&I.push(Kl(T)),k.link&&I.push(Wl(T)),k.yjs&&I.push(Gl(T,k.yjs)),k.dragon&&I.push(Jl(T)),k.table&&I.push(Hl(T)),(await Promise.all(I)).forEach($=>{$&&x.push($)}),x.push(jl(T)),x.push(T.registerCommand(oi,()=>(m.set(m.value+1),!1),G)),x.push(T.registerUpdateListener(({editorState:$,dirtyElements:R,dirtyLeaves:W})=>{(R.size>0||W.size>0)&&m.set(m.value+1),d&&(R.size>0||W.size>0)&&$.read(async()=>{if(M==="markdown"){const Z=await wt(T);d(Z,T)}else if(M==="html"){const Z=await vt(T);d(Z,T)}else M==="json"&&d($.toJSON(),T)})})),e!=null){const $=w.Value.get(e);if($!=null&&($!==""||M==="json"&&typeof $=="object")){if(M==="markdown"&&typeof $=="string")await Kn(T,$);else if(M==="html"&&typeof $=="string")await Wn(T,$);else if(M==="json"&&typeof $=="object")try{const W=JSON.stringify($),Z=T.parseEditorState(W);T.setEditorState(Z)}catch(W){console.error("[BeatUI] Failed to parse JSON editor state:",W),u&&u(W instanceof Error?W:new Error(String(W)),T)}}}e!=null&&x.push(w.Value.on(e,async $=>{if($!=null){if(M==="markdown"&&typeof $=="string"){const R=await wt(T);$!==R&&await Kn(T,$)}else if(M==="html"&&typeof $=="string"){const R=await vt(T);$!==R&&await Wn(T,$)}else if(M==="json"&&typeof $=="object"){const R=JSON.stringify(T.getEditorState().toJSON()),W=JSON.stringify($);if(R!==W){const Z=T.parseEditorState(W);T.setEditorState(Z)}}}})),i!=null&&x.push(w.Value.on(i,$=>{T.setEditable(!$)})),x.push(T.registerCommand(fi,()=>(h&&h(T),f&&T.getEditorState().read(async()=>{if(M==="markdown"){const $=await wt(T);f($,T)}else if(M==="html"){const $=await vt(T);f($,T)}else M==="json"&&f(T.getEditorState().toJSON(),T)}),!1),G)),x.push(y.on($=>{const R=T.getRootElement();R&&(R.dataset.theme=$)})),g&&g(T)}catch(k){console.error("[BeatUI] Failed to initialize Lexical editor:",k);const E=S;E.textContent="Failed to load Lexical editor."}})(),w.OnDispose(()=>{try{x.forEach(k=>k())}catch{}try{C?.setRootElement(null)}catch{}p.set(null)})}))))},x0=n=>{const{value:e,before:t,after:r,onChange:i,onInput:s,onBlur:o,disabled:l,hasError:a,name:c,placeholder:u,id:d,required:f,tabIndex:h,size:g,class:p,namespace:m,format:b,plugins:_,readOnly:y,onError:S,onReady:C,marks:x}=n,v=l!=null&&y!=null?w.computedOf(l,y)((k,E)=>(k??!1)||(E??!1)):l??y;return U_.InputContainer({disabled:l,hasError:a,size:g,baseContainer:!0,growInput:!0,focusableSelector:"[contenteditable]",before:t,after:r,input:w.html.div(w.attr.class("bc-lexical-editor-input"),w.attr.name(c),w.attr.id(d),f!=null?w.aria.required(f):null,h!=null?w.attr.tabindex(h):null,a!=null?w.attr.class(w.Value.map(a,k=>k?"bc-lexical-editor-input--error":"")):null,b_({value:e,format:b??"markdown",plugins:_,readOnly:v,placeholder:u,namespace:m,class:p,onError:S,onReady:C,onInput:s?(k,E)=>{s(k)}:void 0,onChange:i?(k,E)=>{i(k)}:void 0,onBlur:o?k=>{o()}:void 0}))})};exports.$createHorizontalRuleNode=Ns;exports.$isHorizontalRuleNode=Vp;exports.BLUR_COMMAND=fi;exports.BareEditor=b_;exports.BlockHandle=k_;exports.CLEAR_EDITOR_COMMAND=Lc;exports.CLICK_COMMAND=br;exports.COMMAND_PRIORITY_CRITICAL=Wc;exports.COMMAND_PRIORITY_EDITOR=B;exports.COMMAND_PRIORITY_HIGH=wg;exports.COMMAND_PRIORITY_LOW=G;exports.COMMAND_PRIORITY_NORMAL=Cg;exports.COPY_COMMAND=xr;exports.CUT_COMMAND=di;exports.ContextualEditor=b0;exports.DEFAULT_BLOCK_COMMANDS=E_;exports.DEFAULT_SLASH_COMMANDS=_0;exports.DecoratorNode=Ss;exports.DockedEditor=m0;exports.ElementNode=xe;exports.FOCUS_COMMAND=Rc;exports.FORMAT_ELEMENT_COMMAND=Fc;exports.FORMAT_TEXT_COMMAND=ve;exports.FloatingToolbar=v_;exports.HR_TRANSFORMER=__;exports.HorizontalRuleNode=Ir;exports.INDENT_CONTENT_COMMAND=Ut;exports.INSERT_CHECK_LIST_COMMAND=xl;exports.INSERT_HORIZONTAL_RULE_COMMAND=Ms;exports.INSERT_IMAGE_COMMAND=Kv;exports.INSERT_ORDERED_LIST_COMMAND=xi;exports.INSERT_PARAGRAPH_COMMAND=Fn;exports.INSERT_UNORDERED_LIST_COMMAND=bi;exports.KEY_ENTER_COMMAND=Dn;exports.KEY_ESCAPE_COMMAND=ui;exports.KEY_TAB_COMMAND=xs;exports.LexicalEditorInput=x0;exports.LexicalToolbar=C_;exports.OUTDENT_CONTENT_COMMAND=sn;exports.PASTE_COMMAND=li;exports.REDO_COMMAND=ci;exports.REMOVE_LIST_COMMAND=pu;exports.SELECTION_CHANGE_COMMAND=oi;exports.SlashCommandPalette=y0;exports.TOGGLE_SLASH_COMMAND_PALETTE=Uv;exports.TextNode=Ye;exports.UNDO_COMMAND=ai;exports.applyMark=r0;exports.createCommand=z;exports.createDefaultPluginConfig=vl;exports.createHeadlessEditor=$s;exports.executeSlashCommand=zv;exports.exportEditorToFile=Wv;exports.exportToHtml=vt;exports.exportToMarkdown=wt;exports.getCharacterCount=l0;exports.getMarkdownTransformers=y_;exports.getNodesForPlugins=wl;exports.getSelectionInfo=o0;exports.getTextContent=Gu;exports.getWordCount=a0;exports.htmlToLexicalJson=f0;exports.importFileToEditor=jv;exports.importFromHtml=Wn;exports.importFromMarkdown=Kn;exports.insertTable=Jv;exports.lexicalJsonToHtml=h0;exports.lexicalJsonToMarkdown=d0;exports.loadLexicalCore=m_;exports.loadOffsetUtils=c0;exports.markdownToLexicalJson=u0;exports.registerAutoLinkPlugin=t0;exports.registerClipboardPlugin=Ul;exports.registerCodePlugin=Gv;exports.registerCodeShikiPlugin=Vv;exports.registerDragonPlugin=Jl;exports.registerHashtagPlugin=Zv;exports.registerHistoryPlugin=zl;exports.registerHorizontalRulePlugin=jl;exports.registerLinkPlugin=Wl;exports.registerListPlugin=Kl;exports.registerMarkPlugin=n0;exports.registerOverflowPlugin=s0;exports.registerPlainTextPlugin=Bl;exports.registerRichTextPlugin=Pl;exports.registerSlashCommandsPlugin=Bv;exports.registerTablePlugin=Hl;exports.registerYjsPlugin=Gl;exports.removeMark=i0;