dorkos 0.76.0 → 0.81.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/bin/cli.js +5849 -2662
  2. package/dist/client/assets/{AboutPage-BoqHP_rW.js → AboutPage-CG2PlGB9.js} +1 -1
  3. package/dist/client/assets/{AppearancePage-B95H8Nxj.js → AppearancePage-uc6vrPjQ.js} +1 -1
  4. package/dist/client/assets/BaseTanStackRouterDevtoolsPanel-B-iktbLX-CZ9OxU7F.js +539 -0
  5. package/dist/client/assets/{BlintzCanvas-CRXCmtua.js → BlintzCanvas-C0dWt42q.js} +82 -82
  6. package/dist/client/assets/{CanvasCsvContent-pdVBTYKX.js → CanvasCsvContent-DpTj502y.js} +1 -1
  7. package/dist/client/assets/{CanvasFileContent-Cl03ayCc.js → CanvasFileContent-BfbMK0ME.js} +2 -2
  8. package/dist/client/assets/{CanvasModel3dContent-C3g0j2bn.js → CanvasModel3dContent-BjkWZBVq.js} +2 -2
  9. package/dist/client/assets/{CodeMirrorDiff-BQLLfs4g.js → CodeMirrorDiff-BtkeZDXX.js} +1 -1
  10. package/dist/client/assets/{CodeMirrorEditor-BSvvxSHw.js → CodeMirrorEditor-C2mjcn0M.js} +1 -1
  11. package/dist/client/assets/{ConnectionAccessLists-aPcsWZg1.js → ConnectionAccessLists-CrvGcp6D.js} +1 -1
  12. package/dist/client/assets/{ConnectionsPage-BvzkayxV.js → ConnectionsPage-C2q7w1vY.js} +1 -1
  13. package/dist/client/assets/{ConventionPage-Y7bDPPze.js → ConventionPage-CGoZt1nC.js} +2 -2
  14. package/dist/client/assets/{FloatingTanStackRouterDevtools-CNROBv9F-wx_-3fZ2.js → FloatingTanStackRouterDevtools-CqogiFob-Dl7G5M5j.js} +1 -1
  15. package/dist/client/assets/HandlePage-DbVA5ABk.js +1 -0
  16. package/dist/client/assets/LexicalField-CCu1Ihg3.js +24 -0
  17. package/dist/client/assets/{ManagesPage--n7TgT9l.js → ManagesPage-c1KIJkFC.js} +1 -1
  18. package/dist/client/assets/{Model3dViewer-uKAbOmCS.js → Model3dViewer-BO0fwX9g.js} +1 -1
  19. package/dist/client/assets/NamePage-Cvksm2Vr.js +1 -0
  20. package/dist/client/assets/{NotificationsPage-DB4qTW3T.js → NotificationsPage-BVSSDb9i.js} +1 -1
  21. package/dist/client/assets/{PersonalityPopover-DT20V6CQ.js → PersonalityPopover-CI9kf81k.js} +1 -1
  22. package/dist/client/assets/PhotoPage-DOvne6fS.js +1 -0
  23. package/dist/client/assets/{RoomsPage-DEEUnf0J.js → RoomsPage-B7s1XM1i.js} +1 -1
  24. package/dist/client/assets/{RunsOnPopover-D2pucfeO.js → RunsOnPopover-LTrQIz4S.js} +1 -1
  25. package/dist/client/assets/{SessionsPage-DBPX5adt.js → SessionsPage-FLHcXJLg.js} +2 -2
  26. package/dist/client/assets/{SkillsPage-C9HXskYL.js → SkillsPage-loa1-bcL.js} +1 -1
  27. package/dist/client/assets/{TasksPage-Dqf9owXs.js → TasksPage-CjTt9J5n.js} +1 -1
  28. package/dist/client/assets/{ToolsPage-DaoSMDQU.js → ToolsPage-DMnjLq2L.js} +2 -2
  29. package/dist/client/assets/{TopologyGraph-DF6kFfjI.js → TopologyGraph-CRAGEuPI.js} +1 -1
  30. package/dist/client/assets/{agent-browser-BuaZOCOm.js → agent-browser-DH-qe6tt.js} +1 -1
  31. package/dist/client/assets/{highlighted-body-KPVGNVTW-B1wBbLs7.js → highlighted-body-KPVGNVTW-CKyNuC2a.js} +1 -1
  32. package/dist/client/assets/{index-DumYh9rX.js → index-0R0NT72V.js} +1 -1
  33. package/dist/client/assets/{index-D2XIUtpU.js → index-37p1_k_N.js} +1 -1
  34. package/dist/client/assets/{index-D3g04gH1.js → index-9FBdK--F.js} +1 -1
  35. package/dist/client/assets/{index-BNTWz-au.js → index-B0rpOocp.js} +1 -1
  36. package/dist/client/assets/{index-CShzpSy7.js → index-BGLRcYYE.js} +1 -1
  37. package/dist/client/assets/{index--Uyc_XG6.js → index-BHz_iLMm.js} +9 -9
  38. package/dist/client/assets/{index-CA4kPvkQ.js → index-BL-LFVsO.js} +1 -1
  39. package/dist/client/assets/{index-DD2mSWO0.js → index-BPl8DTOI.js} +1 -1
  40. package/dist/client/assets/{index-MMjhiA-J.js → index-BVkt7309.js} +1 -1
  41. package/dist/client/assets/{index-2HT5vouX.js → index-BaITIF12.js} +1 -1
  42. package/dist/client/assets/{index-ByjBP7eT.js → index-BhMgFrop.js} +1 -1
  43. package/dist/client/assets/{index-BvU5XdA6.js → index-BmHCO7JA.js} +1 -1
  44. package/dist/client/assets/{index-VeV-4NUe.js → index-Bq1ocT_z.js} +1 -1
  45. package/dist/client/assets/{index-DaFsjYfq.js → index-C6itZC0I.js} +1 -1
  46. package/dist/client/assets/{index-C3EW9tRL.js → index-CCa_zFfO.js} +1 -1
  47. package/dist/client/assets/{index-BeBR9uSg.js → index-CGYDEGb1.js} +1 -1
  48. package/dist/client/assets/{index-DRYYCdpC.js → index-CPiL-M1V.js} +1 -1
  49. package/dist/client/assets/{index-B6jQgG8Q.js → index-CT4uhPjz.js} +1 -1
  50. package/dist/client/assets/{index-WVQrRVpj.js → index-CWuLOWsu.js} +2 -2
  51. package/dist/client/assets/{index-C7Uur-_Y.js → index-C_H8Na06.js} +3 -3
  52. package/dist/client/assets/{index-BIs_UKpi.js → index-CgTvuqsz.js} +1 -1
  53. package/dist/client/assets/{index-BHQYCx1L.js → index-Cn5LkLHK.js} +1 -1
  54. package/dist/client/assets/{index-DwUKcf_k.js → index-CoJiX2o7.js} +1 -1
  55. package/dist/client/assets/{index-BvT0F_8s.js → index-Criu5f4m.js} +1 -1
  56. package/dist/client/assets/{index-do5L767D.js → index-CugRpUpy.js} +1 -1
  57. package/dist/client/assets/{index-CwYrgtmx.js → index-D-nXANER.js} +1 -1
  58. package/dist/client/assets/{index-B2Ye-nkG.js → index-D2P8UWWS.js} +1 -1
  59. package/dist/client/assets/{index-DEAVZK-q.js → index-DBsoxmLK.js} +1 -1
  60. package/dist/client/assets/{index-Bxcqjip5.js → index-DN2SO8dj.js} +1 -1
  61. package/dist/client/assets/{index-CN4hFvoG.js → index-DRBI-tjH.js} +1 -1
  62. package/dist/client/assets/{index-Cg0bm_ag.js → index-DyAjYNxU.js} +414 -414
  63. package/dist/client/assets/{index-IErk5ecA.js → index-O1R1Ir-o.js} +1 -1
  64. package/dist/client/assets/{index-CpCRZ8P5.js → index-UTvS0wz6.js} +1 -1
  65. package/dist/client/assets/{index-BMsvIr1C.js → index-Z0979U-2.js} +1 -1
  66. package/dist/client/assets/{index-BImpyKDK.js → index-_r_3OCOV.js} +1 -1
  67. package/dist/client/assets/{index-B_p4CrFG.js → index-hnccffr-.js} +1 -1
  68. package/dist/client/assets/{room-files-source-BrzosNI0.js → room-files-source-BmK7_zzB.js} +2 -2
  69. package/dist/client/assets/{soul-file-CMitSV0e.js → soul-file-0ee-EflV.js} +1 -1
  70. package/dist/client/assets/{use-mesh-update-MH2NsGx-.js → use-mesh-update-D1KVLTOA.js} +1 -1
  71. package/dist/client/assets/{use-personality-commit-BHO7hV2D.js → use-personality-commit-KFutjy9j.js} +1 -1
  72. package/dist/client/index.html +1 -1
  73. package/dist/server/index.js +7642 -10600
  74. package/dist/server/index.js.map +2 -2
  75. package/package.json +8 -6
  76. package/dist/client/assets/BaseTanStackRouterDevtoolsPanel-fP2H3uLR-DivgCeAN.js +0 -539
  77. package/dist/client/assets/HandlePage-BeHlZs_e.js +0 -1
  78. package/dist/client/assets/LexicalField-B3z9B3Jc.js +0 -24
  79. package/dist/client/assets/NamePage-Bh6_6TMn.js +0 -1
  80. package/dist/client/assets/PhotoPage-B3qZqkg9.js +0 -1
@@ -0,0 +1,24 @@
1
+ var Hh=Object.defineProperty;var Vh=(n,t,e)=>t in n?Hh(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var k=(n,t,e)=>Vh(n,typeof t!="symbol"?t+"":t,e);import{r as z,j as lt,gn as qh,go as Gh,gp as Yh,gb as Xh,gq as Qh}from"./index-DyAjYNxU.js";function w(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Nu(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);e.search=r.toString(),console.warn(`Minified Lexical warning #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Zh(){return typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0}const ee=Zh();function tg(){return ee&&"documentMode"in document?document.documentMode:null}const eg=tg();function ng(n){return ee&&n.test(navigator.platform)}function ro(n){return ee&&n.test(navigator.userAgent)}const Yn=ng(/Mac|iPod|iPhone|iPad/),Oe=ro(/^(?!.*Seamonkey)(?=.*Firefox).*/i);function rg(){return!(!ee||!("InputEvent"in window)||eg)&&"getTargetRanges"in new window.InputEvent("input")}const Xn=rg();function og(){return ee&&!window.MSStream&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&navigator.maxTouchPoints>1)}const $e=og(),Eu=ro(/Android/),oo=ro(/Version\/[\d.]+.*Safari/)&&!Eu,wu=ro(/^(?=.*Chrome).*/i),Wo=ee&&Eu&&wu,io=ro(/AppleWebKit\/[\d.]+/)&&Yn&&!wu,Ou=128;function ig(){return 2047}const sg=ig(),Br=oo||$e||io?" ":"​",cn=`
2
+
3
+ `,ol=Oe?" ":Br,Ct={bold:1,capitalize:1024,code:16,highlight:Ou,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},$u={directionless:1,unmergeable:2},Qn={center:2,end:6,justify:4,left:1,right:3,start:5};function Mu(n){const t={};for(const e of Object.keys(n))t[n[e]]=e;return t}const Fu=Mu(Qn),il={normal:0,segmented:2,token:1},Au=Mu(il),sl="$",lg=Symbol.for("@lexical/ctrlOrOtherKey"),Ui="$config";function ji(){return gt()._blockCursorElement}function Ji(n){return n!==null&&n.nodeType===1&&n.hasAttribute("data-lexical-slot")}const cg=io||$e||oo;function ec(){const n=ot().createElement("img");n.setAttribute("data-lexical-decorator-boundary","true"),n.alt="";for(const[t,e]of[["position","absolute"],["width","0px"],["height","0px"],["border","0px"],["margin","0px"],["padding","0px"]])n.style.setProperty(t,e,"important");return n}function Uo(n){return n!==null&&n.nodeType===1&&n.hasAttribute("data-lexical-decorator-boundary")}let Du=class $o{constructor(t,e,r){k(this,"element");k(this,"before");k(this,"after");this.element=t,this.before=e||null,this.after=r||null}withBefore(t){return new $o(this.element,t,this.after)}withAfter(t){return new $o(this.element,this.before,t)}withElement(t){return this.element===t?this:new $o(t,this.before,this.after)}insertChild(t){const e=this.getInsertionAnchor();return e!==null&&e.parentElement!==this.element&&w(357),this.element.insertBefore(t,e),this}removeChild(t){return t.parentElement!==this.element&&w(358),this.element.removeChild(t),this}replaceChild(t,e){return e.parentElement!==this.element&&w(359),this.element.replaceChild(t,e),this}getFirstChild(){const t=this.getFirstChildAnchor(),e=t?t.nextSibling:this.element.firstChild;return e===this.getInsertionAnchor()?null:e}getFirstChildAnchor(){return this.after}resolveLeafPosition(t,e,r){if(this.element===t)return e===t&&r===0?"before":"after";const o=nc(t,this.element);if(o===null)return"after";const i=Array.prototype.indexOf.call(t.childNodes,o);if(i<0)return"after";if(e===t)return r<=i?"before":"after";const s=nc(t,e);if(s===null)return"after";const l=Array.prototype.indexOf.call(t.childNodes,s);return l>=0&&l<=i?"before":"after"}getInsertionAnchor(){return this.before}};function nc(n,t){let e=t;for(;e!==null&&e.parentNode!==n;)e=e.parentNode;return e}let Pu=class Mo extends Du{withBefore(t){return new Mo(this.element,t,this.after)}withAfter(t){return new Mo(this.element,this.before,t)}withElement(t){return this.element===t?this:new Mo(t,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()||this.getDecoratorBoundaryAnchor("trailing")}getFirstChildAnchor(){let t=super.getFirstChildAnchor(),e=t?t.nextSibling:this.element.firstChild;for(;Ji(e);)t=e,e=e.nextSibling;Uo(e)&&(t=e,e=e.nextSibling);const r=t?t.nextSibling:this.element.firstChild;return r!==null&&r===ji()?r:t}getDecoratorBoundaryAnchor(t){let e;if(t==="leading"){const r=super.getFirstChildAnchor();for(e=r?r.nextSibling:this.element.firstChild;Ji(e);)e=e.nextSibling}else e=this.before?this.before.previousSibling:this.element.lastChild,e!==null&&e===ji()&&(e=e.previousSibling);return Uo(e)?e:null}setDecoratorBoundaryAnchor(t,e){const r=this.getDecoratorBoundaryAnchor(t);if(e!==(r!==null))if(r!==null)this.element.removeChild(r);else if(t==="leading"){const o=this.getFirstChildAnchor();this.element.insertBefore(ec(),o?o.nextSibling:this.element.firstChild)}else this.element.insertBefore(ec(),this.before)}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){const e=this.element,r=this.after===null?e.firstChild:this.after.nextSibling,o=t==="empty"&&Ji(r)?null:t;if(e.__lexicalLastChildKind!==o)if(e.__lexicalLastChildKind=o,o===null)this.removeManagedLineBreak();else{const i=o==="decorator"&&cg;this.insertManagedLineBreak(i)}}removeManagedLineBreak(){const t=this.getManagedLineBreak();if(t){const e=this.element,r=t.nodeName==="IMG"?t.nextSibling:null;r&&e.removeChild(r),e.removeChild(t),e.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){const e=this.getManagedLineBreak();if(e){if(t===(e.nodeName==="IMG"))return;this.removeManagedLineBreak()}const r=this.element,o=this.before||this.getDecoratorBoundaryAnchor("trailing"),i=ot().createElement("br");if(i.setAttribute("data-lexical-managed-linebreak","true"),r.insertBefore(i,o),t){const s=ot().createElement("img");s.setAttribute("data-lexical-managed-linebreak","true"),s.style.setProperty("display","inline","important"),s.style.setProperty("border","0px","important"),s.style.setProperty("margin","0px","important"),s.alt="",r.insertBefore(s,i),r.__lexicalLineBreak=s}else r.__lexicalLineBreak=i}getFirstChildOffset(){const t=this.getFirstChild(),e=this.getInsertionAnchor();let r=0;for(let o=this.element.firstChild;o!==null&&o!==t&&o!==e;o=o.nextSibling)r++;return r}resolveChildIndex(t,e,r,o){if(r===this.element){const c=this.getFirstChildOffset(),a=ji(),u=this.element.childNodes,f=Math.min(o,u.length);let d=0;for(let h=c;h<f;h++)u[h]!==a&&d++;return[t,Math.min(d,t.getChildrenSize())]}const i=rc(e,r);i.push(o);const s=rc(e,this.element);let l=t.getIndexWithinParent();for(let c=0;c<s.length;c++){const a=i[c],u=s[c];if(a===void 0||a<u)break;if(a>u){l+=1;break}}return[t.getParentOrThrow(),l]}};function rc(n,t){const e=[];let r=t;for(;r!==n&&r!==null;r=r.parentNode){let o=0;for(let i=r.previousSibling;i!==null;i=i.previousSibling)o++;e.push(o)}return r!==n&&w(225),e.reverse()}function ag(){let n;try{n="0.51.0+prod.esm"}catch{}return n??'"<unknown>+source"'}const Iu=ag();let vr=class{constructor(){k(this,"_front",new Set);k(this,"_back",new Set);k(this,"_cache")}get size(){return this._front.size+this._back.size}addBack(t){return delete this._cache,this._front.has(t)||this._back.add(t),this}addFront(t){return delete this._cache,this._back.has(t)||this._front.add(t),this}delete(t){return delete this._cache,this._front.delete(t)||this._back.delete(t)}toArray(){const t=Array.from(this._front).reverse();for(const e of this._back)t.push(e);return t}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}};const en=null;function Lu(n,t=1e3){return n instanceof ps?n.clone():n.size<t?new Map(n):new ps().init(new Map(n),void 0,n.size)}let ps=class Ru{constructor(){k(this,"_mutable",!1);k(this,"_old");k(this,"_nursery");k(this,"_size",0)}clone(){return this._mutable=!1,new Ru().init(this._old,this._nursery,this._size)}init(t,e,r){return this._old=t,this._nursery=e,this._size=r,this}get size(){return this._size}has(t){return this.get(t)!==void 0}getWithTombstone(t){const e=this._nursery&&this._nursery.get(t);return e!==void 0?e:this._old&&this._old.get(t)}get(t){const e=this.getWithTombstone(t);return e===en?void 0:e}shouldCompact(){return this._nursery!==void 0&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(t=!1){if(this._nursery&&this._nursery.size>0&&(t||this.shouldCompact())){const e=new Map(this._old);for(const[r,o]of this._nursery)o!==en?e.set(r,o):e.delete(r);this._old=e,this._nursery=void 0}return this._mutable=!1,this}set(t,e){const r=this.getWithTombstone(t);if(r===e)return this;const o=this.getNursery();return r!==en&&r!==void 0||(this._size++,r===en&&o.delete(t)),o.set(t,e),this}delete(t){const e=this.has(t);return e&&(this.getNursery().set(t,en),this._size--),e}getOrInsert(t,e){const r=this.get(t);return r!==void 0?r:(this.set(t,e),e)}getOrInsertComputed(t,e){const r=this.get(t);if(r!==void 0)return r;const o=e(t);return this.set(t,o),o}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(const t of this.entries())yield t[0]}*values(){for(const t of this.entries())yield t[1]}*entries(){const t=this._nursery,e=this._old;if(t){if(e)for(const r of e){const o=r[0],i=t.get(o);i!==en&&(i!==void 0&&(r[1]=i),yield r)}for(const r of t)r[1]===en||e&&e.has(r[0])||(yield r)}else e&&(yield*e)}forEach(t,e){e!==void 0&&(t=t.bind(e));for(const[r,o]of this.entries())t(o,r,this)}get[Symbol.toStringTag](){return"GenMap"}[Symbol.iterator](){return this.entries()}},Or=!1;function ug(n,t,...e){const r=Or;let o;try{Or=n,o=t()}finally{Or=r}var i;return(i=o)===null||typeof i!="object"&&typeof i!="function"||typeof i.then!="function"||w(421),o}function fg(){return Or}function zu(n){const t=n.exportJSON(Or),e=n.constructor;return t.type!==e.getType()&&w(130,e.name),b(n)&&!Array.isArray(t.children)&&w(59,e.name),t}function jo(n,t,e,r,o,i){if(b(n)){let s=n.getFirstChild();for(;s!==null;){const l=s.__key;s.__parent===t&&((b(s)||un(s)&&s.__slots!==null)&&jo(s,l,e,r,o,i),e.has(l)||i.delete(l),o.push(l)),s=s.getNextSibling()}}for(const s of un(n)&&n.__slots!==null?n.__slots.values():[]){const l=r.get(s);l!==void 0&&Sn(l)&&l.__slotHost===t&&((b(l)||un(l)&&l.__slots!==null)&&jo(l,s,e,r,o,i),e.has(s)||i.delete(s),o.push(s))}}let _s=!1,ll=0;function dg(n){ll=n.timeStamp}function Hi(n,t,e){const r=n.nodeName==="BR",o=t.__lexicalLineBreak;return o&&(n===o||r&&n.previousSibling===o)||r&&gr(n,e)!==void 0}function hg(n,t,e){const r=Lt(Kt(e)),o=r&&Bt(r,e._rootElement);let i=null,s=null;o!==null&&o.anchorNode===n&&(i=o.anchorOffset,s=o.focusOffset);const l=n.nodeValue;l!==null&&Fl(t,l,i,s,!1)}function gg(n,t,e){if(O(n)){const r=n.anchor.getNode();if(r.is(e)&&n.format!==r.getFormat())return!1}return ve(t)&&e.isAttached()}function pg(n,t,e){for(let r=n;r&&!Td(r);r=$n(r)){const o=gr(r,t);if(o!==void 0){const i=nt(o,e);if(i)return J(i)||!q(r)?void 0:[r,i]}}}function Bu(n,t,e){_s=!0;const r=performance.now()-ll>100;try{te(n,()=>{const o=A()||(function(f){return f.read("latest",()=>{const d=A();return d!==null?d.clone():null})})(n),i=new Map,s=n._editorState,l=n._blockCursorElement;let c=!1,a="";for(let f=0;f<t.length;f++){const d=t[f],h=d.type,g=d.target,_=pg(g,n,s);if(!_)continue;const[m,p]=_;if(h==="characterData")r&&M(p)&&ve(g)&&gg(o,g,p)&&hg(g,p,n);else if(h==="childList"){c=!0;const y=d.addedNodes;for(let S=0;S<y.length;S++){const C=y[S],N=ud(C),T=C.parentNode;if(!(T==null||C===l||N!==null||Hi(C,T,n)||Uo(C)||n._slotsUsed&&q(C)&&C.hasAttribute("data-lexical-slot")||Td(C))){if(Oe){const E=(q(C)?C.innerText:null)||C.nodeValue;E&&(a+=E)}T.removeChild(C)}}const x=d.removedNodes,v=x.length;if(v>0){let S=0;for(let C=0;C<v;C++){const N=x[C];Hi(N,g,n)||l===N?(g.appendChild(N),S++):Uo(N)&&S++}v!==S&&i.set(m,p)}}}if(i.size>0)for(const[f,d]of i)d.reconcileObservedMutation(f,n);const u=e.takeRecords();if(u.length>0){for(let f=0;f<u.length;f++){const d=u[f],h=d.addedNodes,g=d.target;for(let _=0;_<h.length;_++){const m=h[_],p=m.parentNode;p==null||m.nodeName!=="BR"||Hi(m,g,n)||p.removeChild(m)}}e.takeRecords()}o!==null&&(c&&St(o),Oe&&_d(n)&&o.insertRawText(a))})}finally{_s=!1}}function Ku(n){const t=n._observer;t!==null&&Bu(n,t.takeRecords(),t)}function Wu(n){(function(t){ll===0&&Kt(t).addEventListener("textInput",dg,!0)})(n),n._observer=new MutationObserver((t,e)=>{Bu(n,t,e)})}function Uu(n,t,e){const{isEqual:r}=n;return t===e||r!==void 0&&r(t,e)}function cl(n,t){return Uu(n,t,n.defaultValue)}function Je(n){return typeof n=="object"&&n!==null}function ne(n,t){const e=Ni(n,t).getter;return Je(e)&&e.getterTable!==void 0||w(405,t),al(e.getterTable)}function ce(n,t){const e=Ni(n,t).setter;return Je(e)&&e.setterTable!==void 0||w(406,t),al(e.setterTable)}function Zn(n,t,e){let{meta:r}=Ni(n,t);for(let o=0;;){if(r.kind==="aliased")return al(r.aliases);r.kind==="nullable"||r.kind==="optional"?r=r.inner.meta:r.kind==="array"?r=r.item.meta:w(407,t,String(e))}}function ae(n,t){const e=Ni(n,t),{setter:r}=e;Je(r)&&r.setterTable!==void 0||w(408,t);const o=String(e.defaultValue);return Ke(r.setterTable,o)||w(409,t,o),r.setterTable[o]}function al(n){return Object.assign(Object.create(null),n)}function Ni(n,t){const e=n.get(t);return e===void 0&&w(410,t),e}function Nn(n,t,e,r,o){o!==void 0&&_g.add(o);const i=e===void 0,s=i?n(void 0):e;return i&&Ju(s),Object.assign(n,{accepts:o,defaultValue:s,isEqual:r,meta:t})}const _g=new WeakSet,ju=new WeakSet;function mg(n){return n!==null&&typeof n=="object"&&ju.add(n),n}function Ju(n){if(n!==null&&typeof n=="object"&&!Object.isFrozen(n)&&!ju.has(n)){Object.freeze(n);for(const t of Object.values(n))Ju(t)}}function Hu(n){const{isEqual:t}=n;return t===void 0?void 0:(e,r)=>e==null||r==null?e===r:t(e,r)}function Vu(n,t){return e=>t(e)||ul(n,e)}function ul(n,t){const{accepts:e}=n;return e!==void 0?e.call(n,t):(function(r,o){const{accepts:i}=r;if(i!==void 0)return ul(r,o)?{parsed:r(o)}:void 0;const s=r(o);return cl(r,s)&&o!==r.defaultValue?void 0:{parsed:s}})(n,t)!==void 0}function Ke(n,t){return Object.prototype.hasOwnProperty.call(n,t)}function re(n=""){return Nn(t=>typeof t=="string"?t:n,{kind:"string"},void 0,void 0,t=>typeof t=="string")}const yg=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function He(n=0,t={}){const{integer:e,clamp:r}=t,o=e&&t.min!==void 0?Math.ceil(t.min):t.min,i=e&&t.max!==void 0?Math.floor(t.max):t.max,s=a=>typeof a=="string"&&yg.test(a)?Number(a):a,l=a=>typeof a=="number"&&Number.isFinite(a)&&(!e||Number.isInteger(a)),c=a=>l(a)&&(o===void 0||a>=o)&&(i===void 0||a<=i);return Nn(a=>{const u=s(a);return r&&l(u)?o!==void 0&&u<o?o:i!==void 0&&u>i?i:u:c(u)?u:n},{clamp:r,integer:e,kind:"number",max:i,min:o},void 0,void 0,a=>r?l(s(a)):c(s(a)))}function fl(n=!1){return Nn(t=>typeof t=="boolean"?t:n,{kind:"boolean"},void 0,void 0,t=>typeof t=="boolean")}function dn(n,...t){const e=mg(t.length!==0?t[0]:n[0]),r=new Set(n);return Nn(o=>o!==void 0&&r.has(o)?o:e,{kind:"enum",values:n},e,void 0,o=>r.has(o)&&(o!==void 0||e===void 0))}function $r(n,t={}){const{defaultAsNull:e}=t;return Nn(r=>{if(r==null)return null;const o=n(r);return e&&cl(n,o)?null:o},{defaultAsNull:e,inner:n,kind:"nullable"},void 0,Hu(n),Vu(n,r=>r==null))}function Jo(n,t={}){const{omitDefault:e}=t;return Nn(r=>{if(r===void 0)return;const o=n(r);return e&&cl(n,o)?void 0:o},{inner:n,kind:"optional",omitDefault:e},void 0,Hu(n),Vu(n,r=>r===void 0))}function xe(){return n=>(function(t){return{meta:{fields:t,kind:"node"}}})(n)}function ms(n,t){const e=r=>typeof r=="string"&&Ke(t,r);return Nn(r=>e(r)?t[r]:n(r),{aliases:t,inner:n,kind:"aliased"},n.defaultValue,n.isEqual,r=>e(r)||ul(n,r))}function Mt(n,t){return qu("withField",n,{getter:{field:t.field,getterTable:t.getterTable,method:t.getter,when:t.when},setter:{field:t.field,method:t.setter,setterTable:t.setterTable}})}function ie(n,t){return qu("withAccessors",n,t)}function qu(n,t,e){return Object.assign(r=>t(r),{accepts:t.accepts,defaultValue:t.defaultValue,getter:e.getter,isEqual:t.isEqual,meta:t.meta,setter:e.setter})}const oc="latest";class xg{constructor(t,e){k(this,"key");k(this,"parse");k(this,"unparse");k(this,"isEqual");k(this,"defaultValue");k(this,"resetOnCopyNode");k(this,"schema");this.key=t;const r="meta"in(o=e.parse)&&typeof o.meta=="object"&&o.meta!==null&&"kind"in o.meta&&typeof o.meta.kind=="string"&&"defaultValue"in o?e.parse:void 0;var o;this.schema=r,this.parse=e.parse.bind(e),this.unparse=(e.unparse||Cg).bind(e),this.isEqual=e.isEqual?e.isEqual.bind(e):r!==void 0&&r.isEqual!==void 0?(i,s)=>Uu(r,i,s):Object.is,this.defaultValue=r!==void 0?r.defaultValue:this.parse(void 0),this.resetOnCopyNode=e.resetOnCopyNode||!1}}function ur(n,t){return new xg(n,t)}function Kr(n,t,e=oc){const r=(e===oc?n.getLatest():n).__state;return r?r.getValue(t):t.defaultValue}function fr(n,t,e){let r;if(xt(),typeof e=="function"){const i=n.getLatest(),s=Kr(i,t);if(r=e(s),t.isEqual(s,r))return i}else r=e;const o=n.getWritable();return Yu(o).updateFromKnown(t,r),o}function vg(n){const t=new Map,e=new Set;for(const{ownNodeConfig:r}of vn(typeof n=="function"?n:n.replace))if(r&&r.stateConfigs)for(const o of r.stateConfigs){let i;"stateConfig"in o?(i=o.stateConfig,o.flat&&e.add(i.key)):i=o,t.set(i.key,i)}return{flatKeys:e,sharedConfigMap:t}}const ic=new Set(["__proto__","constructor","prototype"]);let Sg=class Gu{constructor(t,e,r=void 0,o=new Map,i=void 0){k(this,"node");k(this,"knownState");k(this,"unknownState");k(this,"sharedNodeState");k(this,"size");this.node=t,this.sharedNodeState=e,this.unknownState=r,this.knownState=o;const{sharedConfigMap:s}=this.sharedNodeState,l=i!==void 0?i:(function(c,a,u){let f=u.size;if(a)for(const d in a){const h=c.get(d);h&&u.has(h)||f++}return f})(s,r,o);this.size=l}getValue(t){const e=this.knownState.get(t);if(e!==void 0)return e;this.sharedNodeState.sharedConfigMap.set(t.key,t);let r=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){const o=this.unknownState[t.key];o!==void 0&&(r=t.parse(o)),this.updateFromKnown(t,r)}return r}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const t={...this.unknownState},e={};for(const[r,o]of this.knownState)r.isEqual(o,r.defaultValue)?delete t[r.key]:t[r.key]=r.unparse(o);for(const r of this.sharedNodeState.flatKeys)r in t&&(e[r]=t[r],delete t[r]);return sc(t)&&(e[sl]=t),e}getWritable(t){if(this.node===t)return this;const{sharedNodeState:e,unknownState:r}=this,o=new Map(this.knownState);return new Gu(t,e,(function(i,s,l){let c;if(l)for(const[a,u]of Object.entries(l)){if(ic.has(a))continue;const f=i.get(a);f?s.has(f)||s.set(f,f.parse(u)):(c=c||{},c[a]=u)}return c})(e.sharedConfigMap,o,r),o,this.size)}resetOnCopyNode(){for(const t of this.knownState.keys())t.resetOnCopyNode&&this.knownState.set(t,t.defaultValue);return this}updateFromKnown(t,e){const r=t.key;this.sharedNodeState.sharedConfigMap.set(r,t);const{knownState:o,unknownState:i}=this;o.has(t)||i&&r in i||(i&&(delete i[r],this.unknownState=sc(i)),this.size++),o.set(t,e)}updateFromUnknown(t,e){if(ic.has(t))return;const r=this.sharedNodeState.sharedConfigMap.get(t);r?this.updateFromKnown(r,r.parse(e)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=e)}updateFromJSON(t){const{knownState:e}=this;for(const r of e.keys())e.set(r,r.defaultValue);if(this.size=e.size,this.unknownState=void 0,t)for(const[r,o]of Object.entries(t))this.updateFromUnknown(r,o)}};function Yu(n){const t=n.getWritable(),e=t.__state?t.__state.getWritable(t):new Sg(t,(function(r){return r.__state?r.__state.sharedNodeState:ld(gt(),r.getType()).sharedNodeState})(t));return t.__state=e,e}function Xu(n,t){const e=n.getWritable(),r=t[sl];return(e.__state||r)&&Yu(n).updateFromJSON(r),e}function sc(n){if(n)for(const t in n)return n}function Cg(n){return n}function lc(n,t,e){for(const[r,o]of t.knownState){if(n.has(r.key))continue;n.add(r.key);const i=e?e.getValue(r):r.defaultValue;if(i!==o&&!r.isEqual(i,o))return!0}return!1}function cc(n,t,e){const{unknownState:r}=t,o=e?e.unknownState:void 0;if(r){for(const[i,s]of Object.entries(r))if(!n.has(i)&&(n.add(i),s!==(o?o[i]:void 0)))return!0}return!1}function ac(n,t){const e=n.__state;return e&&e.node===n?e.getWritable(t):e}function uc(n,t){const e=n.__mode,r=n.__format,o=n.__style,i=t.__mode,s=t.__format,l=t.__style,c=n.__state,a=t.__state;return(e===null||e===i)&&(r===null||r===s)&&(o===null||o===l)&&(n.__state===null||c===a||(function(u,f){if(u===f)return!0;const d=new Set;return!(u&&lc(d,u,f)||f&&lc(d,f,u)||u&&cc(d,u,f)||f&&cc(d,f,u))})(c,a))}function fc(n,t){const e=n.mergeWithSibling(t),r=G()._normalizedNodes;return r.add(n.__key),r.add(t.__key),e}function dc(n){let t,e,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(t=r.getPreviousSibling())!==null&&M(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(uc(t,r)){r=fc(t,r);break}break}t.remove()}for(;(e=r.getNextSibling())!==null&&M(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(uc(r,e)){r=fc(r,e);break}break}e.remove()}}else r.remove()}function dl(n){return hc(n.anchor),hc(n.focus),n}function hc(n){for(;n.type==="element";){const t=n.getNode(),e=n.offset;let r,o;if(e===t.getChildrenSize()?(r=t.getChildAtIndex(e-1),o=!0):(r=t.getChildAtIndex(e),o=!1),M(r)){n.set(r.__key,o?r.getTextContentSize():0,"text",!0);break}if(!b(r))break;n.set(r.__key,o?r.getChildrenSize():0,"element",!0)}}const Ho=Symbol.for("@lexical/CachedTextSize");function gc(n,t){return xs.read(()=>{let e=0,r=n;for(let o=0;o<t&&r!==null;o++){const i=oe.get(r);if(i===void 0&&w(345,r),b(i)){const s=st.get(r);if(s!==void 0&&b(s)&&s.__parent!==i.__parent)e+=i.getTextContentSize();else{const l=hn.get(r),c=l&&l.__lexicalTextContent;typeof c!="string"&&w(346,i.getType()),e+=c.length}o<t-1&&!i.isInline()&&(e+=2)}else{const s=i[Ho];s===void 0&&w(347,i.getType(),r),e+=s}r=i.__next}return e},{editor:V})}function Qu(n){b(n)||n[Ho]===void 0&&(n[Ho]=M(n)?n.__text.length:n.getTextContentSize())}const bg=4;let Wr,V,Ur,j="",ht=null,$t=null,wt=null;function he(){return{firstTextKey:wt,format:ht,style:$t}}function Vt(n){n.firstTextKey!==null&&(ht=n.format,$t=n.style,wt=n.firstTextKey)}function ys(n){if(wt!==null)return;const t=n.__lexicalFirstTextKey;if(t===void 0&&w(348),t===null)return;const e=st.get(t);M(e)&&(ht=e.getFormat(),$t=e.getStyle(),wt=t)}let Ei,Mr,Fr,oe,xs,st,hn,vs,jr,gn,ke=!1,Vo=!1;function We(n,t){const e=oe.get(n),r=st.has(n);if(t!==null){const o=ks(n);o.parentNode===t&&t.removeChild(o)}if(!r){if(V._keyToDOMMap.delete(n),b(e)){const o=_i(e,oe);Ss(o,0,o.length-1,null)}if(e!==void 0){for(const o of qt(e).values()){const i=bs(o);We(o,null),i!==null&&i.remove()}Al(jr,Ur,Ei,e,"destroyed")}}}function Ss(n,t,e,r){for(let o=t;o<=e;++o){const i=n[o];i!==void 0&&We(i,r)}}function nn(n,t){n.setProperty("text-align",t)}const Tg="40px";function Zu(n,t){const e=Wr.theme.indent;if(typeof e=="string"){const r=n.classList.contains(e);t>0&&!r?n.classList.add(e):t<1&&r&&n.classList.remove(e)}n.style.setProperty("padding-inline-start",t===0?"":`calc(${t} * var(--lexical-indent-base-value, ${Tg}))`),Xr(n,"class"),Xr(n,"style")}function tf(n,t){const e=n.style;t===0?nn(e,""):t===1?nn(e,"left"):t===2?nn(e,"center"):t===3?nn(e,"right"):t===4?nn(e,"justify"):t===5?nn(e,"start"):t===6&&nn(e,"end"),Xr(n,"style")}function Cs(n,t){const e=(function(r){const o=r.__dir;if(o!==null)return o;if(ut(r))return null;const i=r.getParent();return i===null||Z(i)&&i.__dir===null?"auto":null})(t);e!==null?n.dir=e:n.removeAttribute("dir")}function ef(n){const t=ot().createElement("div");return t.setAttribute("data-lexical-slot",n),t.style.display="none",t}function nf(n,t,e){t||n.contentEditable==="false"?__(e,V):e.removeAttribute("contenteditable")}function pc(n,t,e){const r=j,o=he();j="";let i="";const s=J(n);for(const[l,c]of e){const a=ef(l);nf(t,s,a),t.appendChild(a),j="";const u=he();Ue(c,Ut(n,a,V)),Vt(u),rf(n,l,t,a),i+=j}return Vt(o),j=r,i}function qt(n){return un(n)&&n.__slots!==null?n.__slots:Od}function rf(n,t,e,r){const o=gn.$getSlotTargetElement(n,t,e,V);o!==null&&(r.parentElement!==o&&o.appendChild(r),r.style.display="")}function bs(n){const t=hn.get(n);return t!==void 0?t.parentElement:null}function _c(n,t,e){const r=qt(n),o=qt(t);for(const[u,f]of r)if(!o.has(u)){const d=bs(f);We(f,null),d!==null&&d.remove()}const i=j,s=he();let l="",c=null;const a=J(t);for(const[u,f]of o){const d=r.get(u);let h=d!==void 0?bs(d):null;j="";const g=he();if(h===null){h=ef(u);let _=null;for(const m of e.children)if(!m.hasAttribute("data-lexical-slot")){_=m;break}e.insertBefore(h,_),Ue(f,Ut(t,h,V))}else d===f?Te(f,h):(d!==void 0&&We(d,h),Ue(f,Ut(t,h,V)));if(Vt(g),nf(e,a,h),rf(t,u,e,h),l+=j,h.parentElement===e){const _=c===null?e.firstChild:c.nextSibling;_!==h&&e.insertBefore(h,_),c=h}}return Vt(s),j=i,l}function Ue(n,t){const e=st.get(n);if(e===void 0&&w(60),t!==null){const o=oe.get(n);if(o!==void 0){const i=hn.get(n);if(i!==void 0){const s=Sn(o)?o.__slotHost:null,l=Sn(e)?e.__slotHost:null,c=o.__parent!==e.__parent||s!==l,a=l!==null&&i.parentElement!==t.element;if(c||a)return t.insertChild(i),Te(n,t.element)}}}const r=gn.$createDOM(e,V);if((function(o,i,s){const l=s._keyToDOMMap;fd(i,s,o),l.set(o,i)})(n,r,V),M(e)?r.setAttribute("data-lexical-text","true"):J(e)&&(r.setAttribute("data-lexical-decorator","true"),p_(r,{captureSelection:!0})),b(e)){const o=e.__indent,i=e.__size;Cs(r,e),o!==0&&Zu(r,o);const s=qt(e),l=s.size>0?pc(e,r,s):"";if(i===0)r.__lexicalTextContent=l,r.__lexicalFirstTextKey=null,j+=l,s.size>0&&(r.__lexicalSlotTextLength=l.length);else{const a=j,u=i-1;if(Ts(_i(e,st),e,0,u,Ut(e,r,V)),l!==""){const f=r.__lexicalTextContent||"";r.__lexicalTextContent=l+f,j=a+l+f}s.size>0&&(r.__lexicalSlotTextLength=l.length)}const c=e.__format;c!==0&&tf(r,c),e.isInline()||(sf(null,e,r),of(e,r))}else{const o=e.getTextContent();if(J(e)){const i=e.decorate(V,Wr);i!==null&&lf(n,i),r.contentEditable="false";const s=qt(e);s.size>0&&pc(e,r,s)}j+=o}return t!==null&&t.insertChild(r),gn.$decorateDOM(e,null,r,V),Qu(e),Al(jr,Ur,Ei,e,"created"),r}function Ts(n,t,e,r,o){const i=j,s=he();j="",ht=null,$t=null,wt=null;let l=e;for(;l<=r;++l){const a=he();Ue(n[l],o);const u=st.get(n[l]);u!==null&&M(u)?ht===null&&(ht=u.getFormat(),$t=u.getStyle(),wt=u.__key):b(u)&&l<r&&!u.isInline()&&(j+=cn),Vt(a)}const c=V._keyToDOMMap.get(t.__key);c===void 0&&w(349,t.__key),c.__lexicalTextContent=j,c.__lexicalFirstTextKey=wt,j=i+j,Vt(s)}function mc(n,t){if(!n)return!1;const e=t.get(n);return J(e)&&!e.isInline()}function of(n,t){const e=Ut(n,t,V);e.setDecoratorBoundaryAnchor("leading",mc(n.__first,st)),e.setDecoratorBoundaryAnchor("trailing",mc(n.__last,st))}function sf(n,t,e){const r=Ut(t,e,V),o=(function(i,s){if(i){const l=i.__last;if(l){const c=s.get(l);if(c)return Nt(c)?"line-break":J(c)&&c.isInline()?"decorator":null}return"empty"}return null})(t,st);r.setManagedLineBreak(o)}function kg(n,t,e){var r;ht=null,$t=null,wt=null,(function(o,i,s){const l=j,c=o.__size,a=i.__size;j="";const u=s.element,f=V._keyToDOMMap.get(i.__key);f===void 0&&w(351,i.__key);const d=a-c;if(!ke&&Math.abs(d)<=1&&c>=bg&&o.__first===i.__first&&(d!==0||!V._cloneNotNeeded.has(o.__key))){const h=f.__lexicalTextContent,g=vs.get(o.__key);if(!ke&&typeof h=="string"&&g!==void 0){const _=(function(m,p){const y=p.size;if(y===0||y>=m.__size)return null;let x=m.__last,v=null,S=0;for(;x!==null&&S<y;){if(!p.has(x))return null;v=x;const C=st.get(x);if(C===void 0)return null;x=C.__prev,S++}return S!==y||x!==null&&p.has(x)?null:v})(i,g);if(_!==null){const m=g.size;if(d===0){const p=gc(_,m);let y=_,x=0;for(;y!==null&&x<m;){const T=st.get(y);if(T===void 0)break;const E=he();Te(y,u),M(T)&&ht===null&&(ht=T.getFormat(),$t=T.getStyle(),wt=T.__key),Vt(E),y=T.__next,x++}let v="";for(y=_,x=0;y!==null&&x<m;){const T=st.get(y);if(T===void 0)break;let E;if(b(T)){const $=V._keyToDOMMap.get(y),F=$&&$.__lexicalTextContent;typeof F!="string"&&w(352,T.getType()),E=F}else E=T.getTextContent();v+=E,x<m-1&&b(T)&&!T.isInline()&&(v+=cn),y=T.__next,x++}const S=f.__lexicalSlotTextLength||0,C=S>0?h.slice(S):h,N=C.slice(0,C.length-p)+v;return f.__lexicalTextContent=N,j=l+N,void yc(i,f,g)}if((function(p,y,x,v,S,C,N,T){if(T!==1&&T!==-1||N!==(T===1?2:1))return!1;const $=N-T;let F=p.__last;for(let it=0;it<$-1;it++){if(F===null)return!1;const _t=oe.get(F);if(_t===void 0)return!1;F=_t.__prev}if(F===null)return!1;const D=st.get(C),L=oe.get(F);if(D===void 0||L===void 0||D.__prev!==L.__prev)return!1;const B=[];let U=C;for(let it=0;it<N;it++){if(U===null)return!1;B.push(U);const _t=st.get(U);U=_t?_t.__next:null}const Q=[];U=F;for(let it=0;it<$;it++){if(U===null)return!1;Q.push(U);const _t=oe.get(U);U=_t?_t.__next:null}const H=new Set(Q),Et=new Set(B),et=[];let ft=0,dt=0;for(;ft<$&&dt<N;)if(B[dt]===Q[ft])et.push({key:B[dt],kind:"reconcile"}),ft++,dt++;else if(Et.has(Q[ft])){if(H.has(B[dt]))return!1;et.push({key:B[dt],kind:"create",nextIndex:dt}),dt++}else et.push({key:Q[ft],kind:"destroy"}),ft++;for(;ft<$;)et.push({key:Q[ft++],kind:"destroy"});for(;dt<N;)et.push({key:B[dt],kind:"create",nextIndex:dt}),dt++;const Se=gc(F,$);for(const it of et){const _t=he();if(it.kind==="reconcile")Te(it.key,x.element);else if(it.kind==="destroy")We(it.key,x.element);else{let Ht=null;for(let Fn=it.nextIndex+1;Fn<N;Fn++){const xr=V._keyToDOMMap.get(B[Fn]);if(xr!==void 0){Ht=xr;break}}Ue(it.key,x.withBefore(Ht??x.before))}if(it.kind!=="destroy"){const Ht=st.get(it.key);Ht&&M(Ht)&&ht===null&&(ht=Ht.getFormat(),$t=Ht.getStyle(),wt=Ht.__key)}Vt(_t)}let Jt="";for(let it=0;it<N;it++){const _t=st.get(B[it]);if(_t===void 0)return!1;let Ht;if(b(_t)){const Fn=V._keyToDOMMap.get(B[it]),xr=Fn&&Fn.__lexicalTextContent;typeof xr!="string"&&w(350,_t.getType()),Ht=xr}else Ht=_t.getTextContent();Jt+=Ht,it<N-1&&b(_t)&&!_t.isInline()&&(Jt+=cn)}const Ae=v.__lexicalSlotTextLength||0,yr=Ae>0?S.slice(Ae):S;return v.__lexicalTextContent=yr.slice(0,yr.length-Se)+Jt,!0})(o,0,s,f,h,_,m,d)){const p=f.__lexicalTextContent;return typeof p!="string"&&w(353),j=l+p,void yc(i,f,g)}}}if(d===0){let _=o.__first,m=0;for(;_!==null;){const p=st.get(_);if(p===void 0)break;const y=ke||Fr.has(_)||Mr.has(_),x=he();if(y)Te(_,u);else{let v,S;if(b(p)){S=hn.get(_);const C=S&&S.__lexicalTextContent;typeof C!="string"&&w(354,p.getType()),v=C}else v=p.getTextContent();j+=v,S!==void 0&&ys(S)}M(p)?ht===null&&(ht=p.getFormat(),$t=p.getStyle(),wt=p.__key):b(p)&&m<a-1&&!p.isInline()&&(j+=cn),Vt(x),_=p.__next,m++}return f.__lexicalTextContent=j,f.__lexicalFirstTextKey=wt,void(j=l+j)}}if(c===1&&a===1){const h=o.__first,g=i.__first;if(h===g)Te(h,u);else{const m=ks(h),p=Ue(g,null);try{m.parentNode===u?u.replaceChild(p,m):s.insertChild(p)}catch(y){if(typeof y=="object"&&y!=null){const x=`${y.toString()} Parent: ${u.tagName}, new child: {tag: ${p.tagName} key: ${g}}, old child: {tag: ${m.tagName}, key: ${h}}.`;throw new Error(x)}throw y}We(h,null)}const _=st.get(g);M(_)&&ht===null&&(ht=_.getFormat(),$t=_.getStyle(),wt=_.__key)}else{const h=_i(o,oe),g=_i(i,st);if(h.length!==c&&w(227),g.length!==a&&w(228),c===0)a!==0&&Ts(g,i,0,a-1,s);else if(a===0){if(c!==0){const _=s.after==null&&s.before==null&&qt(i).size===0&&s.element.__lexicalLineBreak==null;Ss(h,0,c-1,_?null:u),_&&(u.textContent="")}}else(function(_,m,p,y,x,v){const S=y-1,C=x-1;let N,T,E=v.getFirstChild(),$=0,F=0;for(;$<=S&&F<=C;){const B=m[$],U=p[F],Q=he();if(B===U)E=Vi(Te(U,v.element)),$++,F++;else{if(T===void 0&&(T=xc(p,F)),N===void 0)N=xc(m,$);else if(!N.has(B)){$++,Vt(Q);continue}if(!T.has(B)){E=Vi(ks(B)),We(B,v.element),$++,N.delete(B),Vt(Q);continue}if(N.has(U)){const Et=rr(V,U);Et!==E&&v.withBefore(E??v.before).insertChild(Et),E=Vi(Te(U,v.element)),$++,F++}else Ue(U,v.withBefore(E??v.before)),F++}const H=st.get(U);H!==null&&M(H)?ht===null&&(ht=H.getFormat(),$t=H.getStyle(),wt=H.__key):b(H)&&F<=C&&!H.isInline()&&(j+=cn),Vt(Q)}const D=$>S,L=F>C;if(D&&!L){const B=p[C+1],U=B===void 0?null:V.getElementByKey(B);Ts(p,_,F,C,v.withBefore(U??v.before))}else L&&!D&&Ss(m,$,S,v.element)})(i,h,g,c,a,s)}f.__lexicalTextContent=j,f.__lexicalFirstTextKey=wt,j=l+j})(n,t,Ut(t,e,V)),Z(t)||(r=t,ht==null||ht===r.__textFormat||Vo||r.setTextFormat(ht),(function(o){$t==null||$t===o.__textStyle||Vo||o.setTextStyle($t)})(t))}function yc(n,t,e){const r=t.__lexicalFirstTextKey;if(r!=null){const o=n.__key;let i=r;for(;i!==null;){const s=st.get(i);if(s===void 0){i=null;break}if(s.__parent===o)break;i=s.__parent}if(i!==null&&!e.has(i)){const s=st.get(r);if(M(s))return ht=s.getFormat(),void($t=s.getStyle())}}t.__lexicalFirstTextKey=wt}function Te(n,t){const e=oe.get(n);let r=st.get(n);e!==void 0&&r!==void 0||w(61);const o=ke||Fr.has(n)||Mr.has(n),i=rr(V,n);if(e===r&&!o){let s;if(b(e)){const l=i.__lexicalTextContent;typeof l!="string"&&w(355,e.getType()),s=l,ys(i)}else s=e.getTextContent();return j+=s,i}if(e!==r&&o&&Al(jr,Ur,Ei,r,"updated"),gn.$updateDOM(r,e,i,V)){const s=Ue(n,null);return t===null&&w(62),t.replaceChild(s,i),We(n,null),s}if(b(e)){b(r)||w(334,n);const s=r.__indent;(ke||s!==e.__indent)&&Zu(i,s);const l=r.__format;(ke||l!==e.__format)&&tf(i,l);const c=o&&(qt(r).size>0||qt(e).size>0)?_c(e,r,i):"";if(o){const a=j;if(kg(e,r,i),r.isInline()||(ut(r)||sf(0,r,i),of(r,i)),c!==""){const u=i.__lexicalTextContent||"";i.__lexicalTextContent=c+u,j=a+c+u,i.__lexicalSlotTextLength=c.length}else(qt(r).size>0||qt(e).size>0)&&(i.__lexicalSlotTextLength=0)}else{const a=i.__lexicalTextContent;typeof a!="string"&&w(356,e.getType()),j+=a,ys(i)}if((ke||r.__dir!==e.__dir||r.__parent!==e.__parent)&&(Cs(i,r),ut(r)&&!ke))for(const a of r.getChildren())b(a)&&Cs(rr(V,a.getKey()),a)}else{const s=r.getTextContent();if(J(r)){const l=r.decorate(V,Wr);l!==null&&lf(n,l),o&&(qt(r).size>0||qt(e).size>0)&&_c(e,r,i)}j+=s}if(!Vo&&ut(r)){const s=r.getLatest();if(s.__cachedText!==j){const l=s.getWritable();l.__cachedText=j,r=l}}return gn.$decorateDOM(r,e,i,V),Qu(r),i}function lf(n,t){let e=V._pendingDecorators;const r=V._decorators;if(e===null){if(r[n]===t)return;e=dd(V)}e[n]=t}function Vi(n){let t=n.nextSibling;return t!==null&&t===V._blockCursorElement&&(t=t.nextSibling),t}function xc(n,t){const e=new Set;for(let r=t;r<n.length;r++)e.add(n[r]);return e}function Ng(n,t,e,r,o,i){j="",ht=null,$t=null,wt=null,ke=r===2,V=e,Wr=e._config,gn=e._config.dom||ci,Ur=e._nodes,Ei=V._listeners.mutation,Mr=o,Fr=i,oe=n._nodeMap,xs=n,st=t._nodeMap,Vo=t._readOnly,hn=Lu(e._keyToDOMMap),vs=(function(){const l=new Map,c=a=>{for(const u of a){const f=st.get(u);if(f===void 0)continue;const d=f.__parent;if(d===null)continue;let h=l.get(d);h===void 0&&(h=new Set,l.set(d,h)),h.add(u)}};return c(Mr.keys()),c(Fr),l})();const s=new Map;return jr=s,Te("root",null),V=void 0,Ur=void 0,Mr=void 0,Fr=void 0,oe=void 0,xs=void 0,st=void 0,Wr=void 0,hn=void 0,vs=void 0,jr=void 0,gn=ci,s}function ks(n){const t=hn.get(n);return t===void 0&&w(75,n),t}function P(n){return{type:n}}const cf=P("SELECTION_CHANGE_COMMAND"),Eg=P("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),af=P("CLICK_COMMAND"),uf=P("BEFORE_INPUT_COMMAND"),ff=P("INPUT_COMMAND"),df=P("COMPOSITION_START_COMMAND"),hf=P("COMPOSITION_END_COMMAND"),an=P("DELETE_CHARACTER_COMMAND"),zn=P("INSERT_LINE_BREAK_COMMAND"),Jr=P("INSERT_PARAGRAPH_COMMAND"),Bn=P("CONTROLLED_TEXT_INSERTION_COMMAND"),wi=P("PASTE_COMMAND"),Fo=P("REMOVE_TEXT_COMMAND"),Hr=P("DELETE_WORD_COMMAND"),Kn=P("DELETE_LINE_COMMAND"),Le=P("FORMAT_TEXT_COMMAND"),wg=P("SET_TEXT_FORMAT_COMMAND"),qo=P("UNDO_COMMAND"),Vr=P("REDO_COMMAND"),gf=P("KEYDOWN_COMMAND"),pf=P("KEY_ARROW_RIGHT_COMMAND"),Ns=P("MOVE_TO_END"),_f=P("KEY_ARROW_LEFT_COMMAND"),Es=P("MOVE_TO_START"),hl=P("KEY_ARROW_UP_COMMAND"),gl=P("KEY_ARROW_DOWN_COMMAND"),so=P("KEY_ENTER_COMMAND"),mf=P("KEY_SPACE_COMMAND"),pl=P("KEY_BACKSPACE_COMMAND"),_l=P("KEY_ESCAPE_COMMAND"),yf=P("KEY_DELETE_COMMAND"),ml=P("KEY_TAB_COMMAND"),Og=P("INSERT_TAB_COMMAND"),$g=P("INDENT_CONTENT_COMMAND"),vc=P("OUTDENT_CONTENT_COMMAND"),yl=P("DROP_COMMAND"),Mg=P("FORMAT_ELEMENT_COMMAND"),xf=P("DRAGSTART_COMMAND"),xl=P("DRAGOVER_COMMAND"),Fg=P("DRAGEND_COMMAND"),Oi=P("COPY_COMMAND"),vl=P("CUT_COMMAND"),vf=P("SELECT_ALL_COMMAND"),Ag=P("CLEAR_EDITOR_COMMAND"),Dg=P("CLEAR_HISTORY_COMMAND"),po=P("CAN_REDO_COMMAND"),_o=P("CAN_UNDO_COMMAND"),Pg=P("FOCUS_COMMAND"),Ig=P("BLUR_COMMAND"),Lg=P("KEY_MODIFIER_COMMAND");function Sf(n,t){return{...t,[lg]:n}}const rn=Sf("metaKey",{ctrlKey:!Yn,metaKey:Yn}),Sc=Sf("altKey",{altKey:Yn,ctrlKey:!Yn}),Cc=[["altKey",1],["ctrlKey",2],["metaKey",4],["shiftKey",8]];function qi(n,t,e){const r=n.get(t);r?r.push(e):n.set(t,[e])}class Rg{constructor(){k(this,"byKey",new Map);k(this,"byCode",new Map)}add(t){const{key:e,modifiers:r={}}=t;e.length>0||w(399);const o=e.toLowerCase();for(const i of(function(s){let l=[0];for(const[c,a]of Cc){const u=s[c]||!1;u==="any"?l=l.concat(l.map(f=>f|a)):u&&(l=l.map(f=>f|a))}return l})(r))qi(this.byKey,`${i}:${o}`,t),e.length===1&&(/[0-9]/.test(e)?qi(this.byCode,`${i}:Digit${e}`,t):/[a-z]/.test(o)&&qi(this.byCode,`${i}:Key${o.toUpperCase()}`,t));return this}matches(t){const e=t.key;if(!e)return[];const r=(function(s){let l=0;for(const[c,a]of Cc)s[c]&&(l|=a);return l})(t),o=this.byKey.get(`${r}:${e.toLowerCase()}`),i=o?o.slice():[];if(this.byCode.size>0&&!(e.length===1&&e.charCodeAt(0)<=127)){const s=this.byCode.get(`${r}:${t.code}`);s&&i.push(...s)}return i}match(t){return this.matches(t)[0]}}function zg(n){const t=new Rg;for(const e of n)t.add(e);return t}function Bg(n){const t=new Map;return{dispose(){for(const e of t.values())e.dispose();t.clear()},register(e,r){let o=t.get(e);o===void 0&&(o={dispose:n(e,r),holders:new Set},t.set(e,o));const i=()=>{const s=t.get(e);s&&s.holders.delete(i)&&s.holders.size===0&&(t.delete(e),s.dispose())};return o.holders.add(i),i}}}function Kg(n,t,e,r){return n.addEventListener(t,e,r),n.removeEventListener.bind(n,t,e,r)}const Ce=Object.freeze({});let Gi;function Wg(){if(Gi!==void 0)return Gi;const n=[["keydown",Zg],["pointerdown",Jg],["compositionstart",Gg],["compositionend",Qg],["input",Vg],["click",jg],["cut",Ce],["copy",Ce],["dragstart",Ce],["dragover",Ce],["dragend",Ce],["paste",Ce],["focus",Ce],["blur",Ce],["drop",Ce]];return Xn&&n.push(["beforeinput",(t,e)=>(function(r,o){const i=r.inputType;i==="deleteCompositionText"||Oe&&_d(o)||i!=="insertCompositionText"&&te(o,()=>{kf(r,o)||R(o,uf,r)},{event:r})})(t,e)]),Gi=n,n}const ws=new WeakMap,Go=new WeakMap,Ug=Bg(n=>(n.addEventListener("selectionchange",Oc),()=>n.removeEventListener("selectionchange",Oc)));function Cf(n,t,e,r,o,i){const s=n.anchor,l=n.focus,c=s.getNode(),a=G();let u;if(i!==void 0)u=i;else{const _=Lt(Kt(a));u=_!==null?Bt(_,a._rootElement):null}const f=u!==null?u.anchorNode:null,d=s.key,h=a.getElementByKey(d),g=e.length;return d!==l.key||!M(c)||(!o&&(!Xn||a._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||c.isDirty()&&g<2||hd(e))&&s.offset!==l.offset&&!c.isComposing()||Yt(c)||c.isDirty()&&g>1||(o||!Xn)&&h!==null&&!c.isComposing()&&f!==je(c,h,a)||u!==null&&t!==null&&(!t.collapsed||t.startContainer!==u.anchorNode||t.startOffset!==u.anchorOffset)||!c.isComposing()&&(c.getFormat()!==n.format||c.getStyle()!==n.style)||(function(_,m){if(m.isSegmented())return!0;if(!_.isCollapsed())return!1;const p=_.anchor.offset,y=m.getParentOrThrow(),x=ai(m);return p===0?!m.canInsertTextBefore()||!y.canInsertTextBefore()&&!m.isComposing()||x||(function(v){const S=v.getPreviousSibling();return(M(S)||b(S)&&S.isInline())&&!S.canInsertTextAfter()})(m):p===m.getTextContentSize()&&(!m.canInsertTextAfter()||!y.canInsertTextAfter()&&!m.isComposing()||x)})(n,c)}function bc(n,t){return ve(n)&&n.nodeValue!==null&&t!==0&&t!==n.nodeValue.length}function Tc(n,t,e){const{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}=Bt(n,t._rootElement),l=t._inputState,c=l.isSelectionChangeFromDOMUpdate;if(c){l.isSelectionChangeFromDOMUpdate=!1;const a=l.selectionChangeFromDOMUpdatePoints;if(l.selectionChangeFromDOMUpdatePoints=null,bc(r,o)&&bc(i,s)&&!l.postDeleteSelectionToRestore&&(a===null||a.anchorNode===r&&a.anchorOffset===o&&a.focusNode===i&&a.focusOffset===s))return}te(t,()=>{if(!e)return void St(null);if(!uo(t,r,i))return;let a=A();if(l.postDeleteSelectionToRestore&&O(a)&&a.isCollapsed()){const f=a.anchor,d=l.postDeleteSelectionToRestore.anchor;(f.key===d.key&&f.offset===d.offset+1||f.offset===1&&d.getNode().is(f.getNode().getPreviousSibling()))&&(a=l.postDeleteSelectionToRestore.clone(),St(a))}if(l.postDeleteSelectionToRestore=null,O(a)){const f=a.anchor,d=f.getNode();if(a.isCollapsed()){n.type==="Range"&&r===i&&(a.dirty=!0);const h=Kt(t).event,g=h?h.timeStamp:performance.now(),{format:_,style:m,offset:p,key:y,timeStamp:x}=l.collapsedSelectionFormat,v=Y(),S=t.isComposing()===!1&&v.getTextContent()==="";if(g<x+200&&f.offset===p&&f.key===y)Ao(a,_,m);else if(f.type==="text")M(d)||w(141),bf(a,d);else if(f.type==="element"&&!S){b(d)||w(259);const C=f.getNode();C.isEmpty()?(function(N,T){const E=T.getTextFormat(),$=T.getTextStyle();Ao(N,E,$)})(a,C):Ao(a,a.format,"")}}else{const h=f.key,g=a.focus.key,_=a.getNodes(),m=_.length,p=a.isBackward(),y=p?s:o,x=p?o:s,v=p?g:h,S=p?h:g;let C=sg,N=!1;for(let T=0;T<m;T++){const E=_[T],$=E.getTextContentSize();if(M(E)&&$!==0&&!(T===0&&E.__key===v&&y===$||T===m-1&&E.__key===S&&x===0)&&(N=!0,C&=E.getFormat(),C===0))break}a.format=N?C:0}}const u=wn();(c||(a!==null?a.dirty||!O(a)||!a.is(u):u!==null))&&R(t,cf)})}function Ao(n,t,e){n.format===t&&n.style===e||(n.format=t,n.style=e,n.dirty=!0)}function bf(n,t){Ao(n,t.getFormat(),t.getStyle())}function jg(n,t){te(t,()=>{const e=A(),r=Lt(Kt(t)),o=wn();if(r){if(O(e)){const i=e.anchor,s=i.getNode();i.type==="element"&&i.offset===0&&e.isCollapsed()&&!ut(s)&&Y().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&o!==null&&e.is(o)&&(r.removeAllRanges(),e.dirty=!0)}else if(n.pointerType==="touch"||n.pointerType==="pen"){const i=Bt(r,t._rootElement).anchorNode;(q(i)||ve(i))&&St(ei(o,r,t,n))}}if(Oe&&r!==null&&r.rangeCount===0){const i=t._rootElement;if(i!==null&&n.target===i){const s=n.clientY;let l=i.childNodes.length;for(let a=0;a<i.childNodes.length;a++){const u=i.childNodes[a];if(q(u)){const f=u.getBoundingClientRect();if(s<=(f.top+f.bottom)/2){l=a;break}}}r.setBaseAndExtent(i,l,i,l);const c=ei(o,r,t,n);c!==null?St(c):r.removeAllRanges()}}R(t,af,n)})}function Jg(n,t){const e=Sd(n),r=n.pointerType;pr(e)&&r!=="touch"&&r!=="pen"&&n.button===0&&te(t,()=>{gi(e,t)||(t._inputState.isSelectionChangeFromMouseDown=!0)})}function Tf(n){if(!n.getTargetRanges)return null;const t=n.getTargetRanges();return t.length===0?null:t[0]}function kc(n){const{lastKeyCode:t}=G()._inputState;if(n==null||n.length<=1||t==null)return;const e=t.length===1?t:t==="Enter"?`
4
+ `:t==="Tab"?" ":null;if(!e)return;const r=A();if(!O(r)||!r.isCollapsed())return;const o=r.anchor.getNode();if(!M(o))return;const{offset:i}=r.anchor;if(o.getTextContentSize()===i){const s=o.getNextSibling();if(e===`
5
+ `){if($e)return;if(Nt(s))s.selectEnd();else if(!s){const l=vt(o,ti),c=l&&l.getNextSibling();b(c)&&c.selectStart()}}else e===" "?pn(s)&&s.selectEnd():M(s)&&s.getTextContent()[0]===e&&s.select(1,1)}else o.getTextContent()[i]===e&&o.select(i+1,i+1)}function qr(n){n.isInsertTextAfterHandledSelectionCommand=!1,n.handledSelectionCommandTimeoutId!==null&&(clearTimeout(n.handledSelectionCommandTimeoutId),n.handledSelectionCommandTimeoutId=null)}function Nc(n){qr(n),n.isInsertTextAfterHandledSelectionCommand=!0,n.handledSelectionCommandTimeoutId=setTimeout(()=>qr(n),0)}function kf(n,t){const e=Sd(n);if(q(e)&&gi(e,t))return!0;const r=t.getRootElement();if(r===null)return!1;const o=ir(r.ownerDocument);return o!==null&&r.contains(o)&&gi(o,t)}function Hg(n){const t=n.inputType,e=Tf(n),r=G(),o=r._inputState,i=A();if(t==="insertText"&&n.data&&o.isInsertTextAfterHandledSelectionCommand){if(qr(o),n.preventDefault(),O(i)&&!i.isCollapsed()){const f=i.isBackward()?i.anchor:i.focus;i.anchor.set(f.key,f.offset,f.type),i.focus.set(f.key,f.offset,f.type)}return!0}if(t==="deleteContentBackward"){if(i===null){const f=wn();if(!O(f))return!0;St(f.clone())}if(O(i)){const f=i.anchor.key===i.focus.key;if((function(d,h){return d.lastKeyCode==="MediaLast"&&h<d.lastKeyDownTimeStamp+30})(o,n.timeStamp)&&r.isComposing()&&f){if(bt(null),o.lastKeyDownTimeStamp=0,setTimeout(()=>{te(r,()=>{bt(null)})},30),O(i)){const d=i.anchor.getNode();d.markDirty(),M(d)||w(142),bf(i,d)}}else{if(bt(null),$e&&e!==null&&!e.collapsed&&(i.applyDOMRange(e),!i.isCollapsed()))return n.preventDefault(),i.removeText(),!0;n.preventDefault();const d=i.anchor.getNode(),h=d.getTextContent(),g=d.canInsertTextAfter(),_=i.anchor.offset===0&&i.focus.offset===h.length;let m=Wo&&f&&!_&&g;if(m&&i.isCollapsed()&&(m=!J(t_(i.anchor,!0))),!m){R(r,an,!0);const p=A();Wo&&O(p)&&p.isCollapsed()&&(o.postDeleteSelectionToRestore=p,setTimeout(()=>o.postDeleteSelectionToRestore=null))}}return!0}}if(!O(i))return t!=="historyUndo"&&t!=="historyRedo"||(n.preventDefault(),R(r,t==="historyUndo"?qo:Vr)),!0;const s=n.data;o.unprocessedBeforeInputData!==null&&Ml(!1,r,o.unprocessedBeforeInputData),i.dirty&&o.unprocessedBeforeInputData===null||!i.isCollapsed()||ut(i.anchor.getNode())||e===null||i.applyDOMRange(e),o.unprocessedBeforeInputData=null;const l=i.anchor,c=i.focus,a=l.getNode(),u=c.getNode();if(t==="insertText"||t==="insertTranspose"){if(s===`
6
+ `)n.preventDefault(),R(r,zn,!1);else if(s===cn)n.preventDefault(),R(r,Jr);else if(s==null&&n.dataTransfer){const f=n.dataTransfer.getData("text/plain");n.preventDefault(),i.insertRawText(f)}else s!=null&&Cf(i,e,s,n.timeStamp,!0)?(n.preventDefault(),R(r,Bn,s),kc(s)):o.unprocessedBeforeInputData=s;return o.lastBeforeInputInsertTextTimeStamp=n.timeStamp,!0}switch(n.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":R(r,Bn,n),kc((n.dataTransfer?n.dataTransfer.getData("text/plain"):null)??n.data);break;case"insertFromComposition":{const f=o.hadOrphanedCompositionEvents;o.hadOrphanedCompositionEvents=!1;const d=r._compositionKey;bt(null),f||R(r,Bn,n),Do(d);break}case"insertLineBreak":bt(null),R(r,zn,!1);break;case"insertParagraph":bt(null),o.isInsertLineBreak&&!$e?(o.isInsertLineBreak=!1,R(r,zn,!1)):R(r,Jr);break;case"insertFromPaste":case"insertFromPasteAsQuotation":R(r,wi,n);break;case"deleteByComposition":(function(f,d){return f!==d||b(f)||b(d)||!ai(f)||!ai(d)})(a,u)&&R(r,Fo,n);break;case"deleteByDrag":xn(Ms),R(r,Fo,n);break;case"deleteByCut":R(r,Fo,n);break;case"deleteContent":R(r,an,!1);break;case"deleteWordBackward":R(r,Hr,!0);break;case"deleteWordForward":R(r,Hr,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":R(r,Kn,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":R(r,Kn,!1);break;case"formatStrikeThrough":R(r,Le,"strikethrough");break;case"formatBold":R(r,Le,"bold");break;case"formatItalic":R(r,Le,"italic");break;case"formatUnderline":R(r,Le,"underline");break;case"historyUndo":R(r,qo);break;case"historyRedo":R(r,Vr)}return!0}function Vg(n,t){n.stopPropagation();const e=t._inputState;qr(e),te(t,()=>{kf(n,t)||t.dispatchCommand(ff,n)},{event:n}),e.unprocessedBeforeInputData=null}function qg(n){const t=G(),e=t._inputState,r=A(),o=n.data,i=Tf(n);let s=!1;if(o!=null&&O(r)){const l=Lt(Kt(t)),c=l!==null?Bt(l,t._rootElement):null,a=n.inputType==="insertCompositionText"&&e.compositionPhase!=="ending-firefox"&&!t.isComposing();a&&(e.hadOrphanedCompositionEvents=!0);const u=r.anchor.getNode(),f=n.inputType==="insertCompositionText"&&e.compositionPhase!=="ending-firefox"&&t.isComposing()&&M(u)&&Yt(u);if(!a&&!f&&Cf(r,i,o,n.timeStamp,!1,c)){if(s=!0,e.compositionPhase==="ending-firefox"){const p=Yo(t,o);if(e.compositionPhase="idle",p)return xn(Gr),ra(),!0}const d=r.anchor.getNode();if(l===null||c===null)return!0;const h=r.isBackward(),g=h?r.anchor.offset:r.focus.offset,_=h?r.focus.offset:r.anchor.offset;Xn&&!r.isCollapsed()&&M(d)&&c.anchorNode!==null&&d.getTextContent().slice(0,g)+o+d.getTextContent().slice(g+_)===pd(c.anchorNode)||R(t,Bn,o);const m=o.length;Oe&&m>1&&n.inputType==="insertCompositionText"&&!t.isComposing()&&(r.anchor.offset-=m,r._cachedNodes=null,r._cachedIsBackward=null),Wo&&t.isComposing()&&(e.lastKeyDownTimeStamp=0,bt(null))}}return s||(Ml(!1,t,o!==null?o:void 0),e.compositionPhase==="ending-firefox"&&(Yo(t,o||void 0),xn(Gr),e.compositionPhase="idle")),ra(),!0}function Gg(n,t){R(t,df,n)}function Yg(n){const t=G(),e=t._inputState,r=A();if(O(r)&&!t.isComposing()){e.compositionPhase="composing",e.hadOrphanedCompositionEvents=!1;const o=r.anchor,i=r.anchor.getNode();if(bt(o.key),xn(Ff),n.timeStamp<e.lastKeyDownTimeStamp+30||o.type==="element"||!r.isCollapsed()||!Wo&&(i.getFormat()!==r.format||M(i)&&i.getStyle()!==r.style)||M(i)&&(Yt(i)||o.offset===0&&!i.canInsertTextBefore()||o.offset===i.getTextContentSize()&&!i.canInsertTextAfter())){R(t,Bn,ol);const s=A();O(s)&&bt(s.anchor.key)}}return!0}function Xg(n){const t=G();return t._inputState.compositionPhase="idle",Yo(t,n.data),xn(Gr),!0}function Do(n){if(n===null)return;const t=nt(n);if(!M(t)||t.getType()==="text"||Yt(t)||!t.isAttached())return;const e=A(),r=O(e)&&e.anchor.key===n?e.anchor.offset:null,o=mt(t.getTextContent());if(o.setFormat(t.getFormat()),o.setStyle(t.getStyle()),t.replace(o),r!==null){const i=Math.min(r,o.getTextContentSize());o.select(i,i)}}function Yo(n,t){const e=n._compositionKey;if(bt(null),e!==null&&t!=null){if(t===""){const o=nt(e),i=n.getElementByKey(e),s=i!==null&&M(o)?je(o,i,n):null;if(s!==null&&s.nodeValue!==null&&M(o)){const l=Lt(Kt(n)),c=l&&Bt(l,n._rootElement);let a=null,u=null;c!==null&&c.anchorNode===s&&(a=c.anchorOffset,u=c.focusOffset),Fl(o,s.nodeValue,a,u,!0)}return Do(e),!1}if(t[t.length-1]===`
7
+ `){const o=A();if(O(o)||ct(o)){if(O(o)){const i=o.focus;o.anchor.set(i.key,i.offset,i.type)}return R(n,so,null),Do(e),!1}}const r=nt(e);if(r!==null&&M(r)&&Yt(r)){r.markDirty();const o=A(),i=r.getTextContentSize(),s=O(o)&&o.anchor.key===e?o.anchor.offset:i;return r.select(s,s).insertText(t),!0}}return Ml(!0,n,t),Do(e),!1}function Qg(n,t){const e=t._inputState;Oe?e.compositionPhase="ending-firefox":$e||!oo&&!io?R(t,hf,n):(e.compositionPhase="ending-safari",e.compositionEndData=n.data)}function Zg(n,t){const e=t._inputState;e.lastKeyDownTimeStamp=n.timeStamp,e.lastKeyCode=n.key,n.key!=="Backspace"&&qr(e),t.isComposing()||R(t,gf,n)}const mo={altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:"any"},Sr={ctrlKey:!0},Ec={metaKey:!0},De={shiftKey:"any"},wc={altKey:"any",shiftKey:"any"};function tp(n){const t=G(),e=t._inputState;if(n.key==null)return!0;if(e.compositionPhase==="ending-safari"){const i=(function(s){return s.key==="Backspace"})(n);if(i&&te(t,()=>{Yo(t,e.compositionEndData)}),e.compositionPhase="idle",e.compositionEndData="",i)return!0}let r=t._keyDownShortcuts;r===null&&(r=zg((function(){const i=(a,u,f)=>({key:a,modifiers:u,onMatch:(d,h)=>{R(h,f,d)}}),s=(a,u,f,d)=>({key:a,modifiers:u,onMatch:(h,g)=>{h.preventDefault(),R(g,f,d)}}),l=(a,u)=>({key:"Enter",modifiers:a,onMatch:(f,d)=>{d._inputState.isInsertLineBreak=u,R(d,so,f)}}),c=(a,u)=>({key:a,modifiers:rn,onMatch:(f,d)=>{const h=d._editorState._selection;h===null||O(h)||(f.preventDefault(),R(d,u,f))}});return[i("ArrowRight",De,pf),i("ArrowLeft",De,_f),i("ArrowUp",wc,hl),i("ArrowDown",wc,gl),l({...mo,shiftKey:!0},!0),l({...mo,shiftKey:!1},!1),i(" ",mo,mf),{key:"Backspace",modifiers:De,onMatch:(a,u)=>{R(u,pl,a)&&Nc(u._inputState)}},i("Escape",mo,_l),i("Delete",{},yf),s("Backspace",Sc,Hr,!0),s("Delete",Sc,Hr,!1),s("b",rn,Le,"bold"),s("u",rn,Le,"underline"),s("i",rn,Le,"italic"),i("Tab",De,ml),s("z",rn,qo,void 0),s("z",{...rn,shiftKey:!0},Vr,void 0),...Yn?[{key:"o",modifiers:Sr,onMatch:(a,u)=>{a.preventDefault(),u._inputState.isInsertLineBreak=!0,R(u,zn,!0)}},i("ArrowLeft",{metaKey:!0,...De},Es),i("ArrowRight",{metaKey:!0,...De},Ns),s("h",Sr,an,!0),s("d",Sr,an,!1),s("Backspace",Ec,Kn,!0),s("Delete",Ec,Kn,!1),s("k",Sr,Kn,!1)]:[i("Home",De,Es),i("End",De,Ns),s("y",Sr,Vr,void 0)],{key:"a",modifiers:rn,onMatch:(a,u)=>{a.preventDefault(),R(u,vf,a)&&Nc(u._inputState)}},c("c",Oi),c("x",vl)]})()),t._keyDownShortcuts=r);const o=r.match(n);return o&&o.onMatch(n,t),(function(i){return i.ctrlKey||i.shiftKey||i.altKey||i.metaKey})(n)&&t.dispatchCommand(Lg,n),!0}function Nf(n){let t=n.__lexicalEventHandles;return t===void 0&&(t=[],n.__lexicalEventHandles=t),t}const Wn=new Map;function Oc(n){const t=o_(n.target);if(t===null)return;const e=Dl(n.target);let r=null,o=null;const i=e!==null?Go.get(e):void 0;if(e!==null){if(i!==void 0){const f=i.editors;let d=i.hasShadowEditor;if(d===void 0){d=!1;for(const h of f)if(h._rootElement!==null&&Me(h._rootElement.getRootNode())){d=!0;break}i.hasShadowEditor=d}if(d){let h=null,g=null;for(const _ of f){const m=_._rootElement;if(m===null)continue;const p=Bt(t,m).anchorNode;if(p!==null&&Jn(p)===_){if(Me(m.getRootNode())){r=_,o=p;break}h===null&&(h=_,g=p)}}r===null&&h!==null&&(r=h,o=g)}else{const h=t.anchorNode;h===null||q(h)&&h.shadowRoot!==null||(r=Jn(h),r!==null&&(o=h))}}if(r===null){const f=ir(e);r=f!==null?Jn(f):null}}if(r===null)return;if(r._inputState.isSelectionChangeFromMouseDown){if(i!==void 0)for(const f of i.editors)f._inputState.isSelectionChangeFromMouseDown=!1;te(r,()=>{const f=wn(),d=o??Bt(t,r._rootElement).anchorNode;(q(d)||ve(d))&&St(ei(f,t,r,n))})}const s=$l(r),l=s[s.length-1],c=l._key,a=Wn.get(c),u=a||l;u!==r&&Tc(t,u,!1),Tc(t,r,!0),r!==l?Wn.set(c,r):a&&Wn.delete(c)}function $c(n){n._lexicalHandled=!0}function Mc(n){return n._lexicalHandled===!0}function ep(n){const t=ws.get(n);if(t===void 0)return;const e=Go.get(t);if(e===void 0)return;ws.delete(n);const r=hr(n);fo(r)?((function(i){if(i._parentEditor!==null){const s=$l(i),l=s[s.length-1]._key;Wn.get(l)===i&&Wn.delete(l)}else Wn.delete(i._key)})(r),e.editors.delete(r),e.hasShadowEditor=void 0,n.__lexicalEditor=null):r&&w(198);const o=Nf(n);for(let i=0;i<o.length;i++)o[i]();n.__lexicalEventHandles=[]}function Os(n,t,e){xt();const r=n.__key,o=n.getParent();if(o===null)return void(Ot(n)!==null&&w(367,r,String(Ot(n))));const i=(function(l){const c=A();if(!O(c)||!b(l))return c;const{anchor:a,focus:u}=c,f=a.getNode(),d=u.getNode();return or(f,l)&&a.set(l.__key,0,"element"),or(d,l)&&u.set(l.__key,0,"element"),c})(n);let s=!1;if(O(i)&&t){const l=i.anchor,c=i.focus;l.key===r&&(ni(l,n,o,n.getPreviousSibling(),n.getNextSibling()),s=!0),c.key===r&&(ni(c,n,o,n.getPreviousSibling(),n.getNextSibling()),s=!0)}else ct(i)&&t&&n.isSelected()&&n.selectPrevious();if(O(i)&&t&&!s&&sn(i,o)){const l=n.getIndexWithinParent();Ee(n),ln(i,o,l,-1)}else Ee(n);e||Z(o)||o.canBeEmpty()||!o.isEmpty()||Os(o,t),t&&i&&ut(o)&&o.isEmpty()&&o.selectEnd()}const Ef=Symbol.for("ephemeral");function Xo(n){return n[Ef]||!1}const Fc={configurable:!0,enumerable:!1,value:void 0,writable:!0};class Tt{constructor(t){k(this,"__type");k(this,"__key");k(this,"__parent");k(this,"__prev");k(this,"__next");k(this,"__state");this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",Fc),Object.defineProperty(this,Ho,Fc),ad(this,t)}static getType(){const{ownNodeType:t}=Ll(this);return t===void 0&&w(64,this.name),t}static clone(t){w(65,this.name)}$config(){return{}}config(t,e){const r=e.extends||wd(this.constructor);return Object.assign(e,{extends:r}),typeof t=="string"&&Object.assign(e,{type:t}),{[t]:e}}afterCloneFrom(t){this.__key===t.__key?(this.__parent=t.__parent,this.__next=t.__next,this.__prev=t.__prev,this.__state=t.__state):t.__state&&(this.__state=t.__state.getWritable(this))}resetOnCopyNodeFrom(t){this.__state&&(this.__state=this.__state.getWritable(this).resetOnCopyNode())}getType(){return this.__type}isInline(){w(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;const e=nt(t);if(e===null)break;t=e.__parent!==null?e.__parent:Ot(e)}return!1}isSelected(t){const e=t||A();if(e==null)return!1;const r=e.getNodes().some(o=>o.__key===this.__key);if(M(this))return r;if(O(e)&&e.anchor.type==="element"&&e.focus.type==="element"){if(e.isCollapsed())return!1;const o=this.getParent();if(J(this)&&this.isInline()&&o){const i=e.isBackward()?e.focus:e.anchor;if(o.is(i.getNode())&&i.offset===o.getChildrenSize()&&this.is(o.getLastChild()))return!1}}return r}getKey(){return this.__key}getIndexWithinParent(){const t=this.getParent();if(t===null)return-1;let e=t.getFirstChild(),r=0;for(;e!==null;){if(this.is(e))return r;r++,e=e.getNextSibling()}return-1}getParent(){const t=this.getLatest().__parent;return t===null?null:nt(t)}getParentOrThrow(){const t=this.getParent();return t===null&&w(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){const e=t.getParent();if(Z(e)||Ot(t)!==null)return b(t)||t===this&&J(t)||w(194),t;t=e}return null}getTopLevelElementOrThrow(){const t=this.getTopLevelElement();return t===null&&w(67,this.__key),t}getParents(){const t=[];let e=this.getParent();for(;e!==null;)t.push(e),e=e.getParent();return t}getParentKeys(){const t=[];let e=this.getParent();for(;e!==null;)t.push(e.__key),e=e.getParent();return t}getPreviousSibling(){const t=this.getLatest().__prev;return t===null?null:nt(t)}getPreviousSiblings(){const t=[],e=this.getParent();if(e===null)return t;let r=e.getFirstChild();for(;r!==null&&!r.is(this);)t.push(r),r=r.getNextSibling();return t}getNextSibling(){const t=this.getLatest().__next;return t===null?null:nt(t)}getNextSiblings(){const t=[];let e=this.getNextSibling();for(;e!==null;)t.push(e),e=e.getNextSibling();return t}getCommonAncestor(t){const e=b(this)?this:this.getParent(),r=b(t)?t:t.getParent(),o=e&&r?Ws(e,r):null;return o?o.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){const e=Ws(this,t);return e!==null&&(e.type==="descendant"||(e.type==="branch"?Ad(e)===-1:(e.type!=="same"&&e.type!=="ancestor"&&w(279),!1)))}isParentOf(t){return or(t,this)}getNodesBetween(t){const e=this.isBefore(t),r=[],o=new Set;let i=this;for(;i!==null;){const s=i.__key;if(o.has(s)||(o.add(s),r.push(i)),i===t)break;const l=b(i)?e?i.getFirstChild():i.getLastChild():null;if(l!==null){i=l;continue}const c=e?i.getNextSibling():i.getPreviousSibling();if(c!==null){i=c;continue}const a=i.getParentOrThrow();if(o.has(a.__key)||r.push(a),a===t)break;let u=null,f=a;do{if(f===null&&w(68),u=e?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),f===null)break;u!==null||o.has(f.__key)||r.push(f)}while(u===null);i=u}return e||r.reverse(),r}isDirty(){const t=G()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(Xo(this))return this;const t=nt(this.__key);return t===null&&w(113),t}getWritable(){if(Xo(this))return this;xt();const t=ue(),e=G(),r=t._nodeMap,o=this.__key,i=this.getLatest(),s=e._cloneNotNeeded,l=A();if(l!==null&&l.setCachedNodes(null),s.has(o))return ui(i),i;const c=bd(i);return s.add(o),ui(c),r.set(o,c),c}getTextContent(){return Md(this)}getTextContentSize(){return this.getTextContent().length}createDOM(t,e){w(70)}updateDOM(t,e,r){w(71)}getDOMSlot(t){return new Du(t)}exportDOM(t){return{element:this.createDOM(t._config,t)}}exportJSON(t=!1){const e=(function(o,i){const s=pi(sr(o.constructor)),{generated:l,isCompactDefault:c}=s,a=l===null?void 0:i?l.exportCompactJSON:l.exportJSON;return a===void 0?(function(u,f,d){const h=d?{type:u.__type}:{};return b(u)&&(h.children=[]),(function(g,_,m,p){for(let y=0;y<_.length;y++){const x=_[y];if(p&&x.derived)continue;let v;if(x.kind==="ownField"){const S=g[x.field];v=x.getterTable===void 0?S:Ke(x.getterTable,S)?x.getterTable[S]:void 0}else v=x.getter.call(g);x.kind==="ownField"&&x.when!==void 0&&(!Ks(x,v)&&x.when.call(g)||(v=void 0)),p&&Ks(x,v)||(m[x.key]=v)}})(u,f,h,d),d||(h.type=u.__type,h.version=1),h})(o,s.getters,i):i?a(o,c):a(o)})(this,t),r=this.__state?this.__state.toJSON():void 0;return r!==void 0&&Object.assign(e,r),e}static importJSON(t){w(18,this.name)}updateFromJSON(t){return Nd(Xu(this,t),t)}static transform(){return null}remove(t){Os(this,!0,t)}replace(t,e){xt();let r=A();r!==null&&(r=r.clone()),is(this,t);const o=this.getLatest(),i=this.__key,s=At(o);s!==null&&w(400,i,o.getType(),s.getKey(),s.getType());const l=t.__key,c=t.getWritable(),a=this.getParentOrThrow().getWritable(),u=a.__size,f=c.getParent(),d=f!==null&&O(r)&&sn(r,f),h=d?c.getIndexWithinParent():-1;Ee(c),d&&f!==null&&O(r)&&ln(r,f,h,-1);const g=o.getPreviousSibling(),_=o.getNextSibling(),m=o.__prev,p=o.__next,y=o.__parent;Os(o,!1,!0),g===null?a.__first=l:g.getWritable().__next=l,c.__prev=m,_===null?a.__last=l:_.getWritable().__prev=l,c.__next=p,c.__parent=y,a.__size=f!==null&&f.is(a)?u-1:u;let x=0;if(e&&(b(this)&&b(c)||w(139),x=c.getChildrenSize(),c.splice(x,0,this.getChildren())),O(r)){St(r);const v=r.anchor,S=r.focus;v.key===i&&(e&&v.type==="element"?v.set(c.__key,x+v.offset,"element"):Ic(v,c)),S.key===i&&(e&&S.type==="element"?S.set(c.__key,x+S.offset,"element"):Ic(S,c))}return ge()===i&&bt(l),c}insertAfter(t,e=!0){xt(),is(this,t);const r=this.getWritable(),o=t.getWritable();this.getParentOrThrow();const i=o.getParent(),s=A();let l=!1,c=!1,a=-1;if(i!==null&&e&&O(s)&&sn(s,i)){const g=i.__key,_=s.anchor,m=s.focus;a=t.getIndexWithinParent(),l=_.type==="element"&&_.key===g&&_.offset===a+1,c=m.type==="element"&&m.key===g&&m.offset===a+1}Ee(o),a!==-1&&i!==null&&O(s)&&ln(s,i,a,-1);const u=this.getNextSibling(),f=this.getParentOrThrow().getWritable(),d=o.__key,h=r.__next;if(u===null?f.__last=d:u.getWritable().__prev=d,f.__size++,r.__next=d,o.__next=h,o.__prev=r.__key,o.__parent=r.__parent,e&&O(s)){const g=f.__key;if(l||c||sn(s,f)){const _=this.getIndexWithinParent();ln(s,f,_+1),l&&s.anchor.set(g,_+2,"element"),c&&s.focus.set(g,_+2,"element")}}return t}insertBefore(t,e=!0){xt(),is(this,t);const r=this.getWritable(),o=t.getWritable();this.getParentOrThrow();const i=o.__key,s=A(),l=o.getParent(),c=l!==null&&e&&O(s)&&sn(s,l),a=c?o.getIndexWithinParent():-1;Ee(o),c&&l!==null&&O(s)&&ln(s,l,a,-1);const u=this.getPreviousSibling(),f=this.getParentOrThrow().getWritable(),d=r.__prev,h=e&&O(s)&&sn(s,f),g=h?this.getIndexWithinParent():-1;return u===null?f.__first=i:u.getWritable().__next=i,f.__size++,r.__prev=i,o.__prev=d,o.__next=r.__key,o.__parent=r.__parent,h&&O(s)&&ln(s,f,g),t}isParentRequired(){return!1}createParentElementNode(){return tt()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,e){xt();const r=At(this);if(r!==null)return r.selectPrevious(t,e);const o=this.getPreviousSibling(),i=this.getParentOrThrow();if(o===null)return i.select(0,0);if(b(o))return o.select();if(!M(o)){const s=o.getIndexWithinParent()+1;return i.select(s,s)}return o.select(t,e)}selectNext(t,e){xt();const r=At(this);if(r!==null)return r.selectNext(t,e);const o=this.getNextSibling(),i=this.getParentOrThrow();if(o===null)return i.select();if(b(o))return o.select(0,0);if(!M(o)){const s=o.getIndexWithinParent();return i.select(s,s)}return o.select(t,e)}markDirty(){this.getWritable()}reconcileObservedMutation(t,e){this.markDirty()}}k(Tt,"importDOM");function wf(n){return n instanceof Tt}const Qo="historic",Of="history-push",Un="history-merge",$f="paste",$s="cut",Mf="collaboration",np="skip-scroll-into-view",rp="skip-dom-selection",Ms="skip-selection-focus",Ff="composition-start",Gr="composition-end",op=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function tr(n,t){if(typeof n=="number")return Number.isFinite(n)?n:t;if(typeof n!="string"||!op.test(n))return t;const e=Number(n);return Number.isFinite(e)?e:t}function Af(n,t,e,r,o){const i=tr(n,t);return i>=e&&i<=r&&Number.isInteger(i)?i:t}const ip=n=>{const t=ne(n,"format"),e=ce(n,"format"),r=ae(n,"format");return{exportJSON:function(o){const i=o.__textFormat,s=o.__textStyle,l=(i!==0||s!=="")&&o.shouldSerializeTextStyles();return{children:[],direction:o.__dir,format:t[o.__format],indent:o.__indent,textFormat:i!==0&&l?i:void 0,textStyle:s!==""&&l?s:void 0,type:o.__type,version:1}},exportCompactJSON:function(o){const i=o.__textFormat,s=o.__textStyle,l=(i!==0||s!=="")&&o.shouldSerializeTextStyles(),c={type:o.__type,children:[]},a=o.__dir;a!=null&&(c.direction=a);const u=t[o.__format];u!==void 0&&u!==""&&(c.format=u);const f=o.__indent;return f!==void 0&&f!==0&&(c.indent=f),i!==void 0&&i!==0&&l&&(c.textFormat=i),s!==void 0&&s!==""&&l&&(c.textStyle=s),c},updateFromJSON:function(o,i){const s=i.direction;o.__dir=s===null||s==="ltr"||s==="rtl"?s:null;const l=i.format;o.__format=typeof l=="string"&&l in e?e[l]:r,o.__indent=Af(i.indent,0,0,1/0),o.__textFormat=tr(i.textFormat,0);const c=i.textStyle;return o.__textStyle=typeof c=="string"?c:"",o}}};function sp(n,t){n.__detail=t.__detail,n.__format=t.__format,n.__mode=t.__mode,n.__style=t.__style,n.__text=t.__text}const lp=n=>{const t=ne(n,"mode"),e=Zn(n,"detail",0),r=Zn(n,"format",0),o=ce(n,"mode"),i=ae(n,"mode");return{exportJSON:function(s){return{detail:s.__detail,format:s.__format,mode:t[s.__mode],style:s.__style,text:s.__text,type:s.__type,version:1}},exportCompactJSON:function(s){const l={type:s.__type},c=s.__detail;c!==void 0&&c!==0&&(l.detail=c);const a=s.__format;a!==void 0&&a!==0&&(l.format=a);const u=t[s.__mode];u!==void 0&&u!=="normal"&&(l.mode=u);const f=s.__style;f!==void 0&&f!==""&&(l.style=f);const d=s.__text;return d!==void 0&&d!==""&&(l.text=d),l},updateFromJSON:function(s,l){const c=l.detail;s.__detail=typeof c=="string"&&c in e?e[c]:tr(c,0);const a=l.format;s.__format=typeof a=="string"&&a in r?r[a]:tr(a,0);const u=l.mode;s.__mode=typeof u=="string"&&u in o?o[u]:i;const f=l.style;s.__style=typeof f=="string"?f:"";const d=l.text;return s.__text=typeof d=="string"?d:"",s},afterCloneFrom:sp}},cp=n=>{const t=ne(n,"format"),e=ce(n,"format"),r=ae(n,"format");return{exportJSON:function(o){const i=o.__textFormat,s=o.__textStyle,l=(i!==0||s!=="")&&o.shouldSerializeTextStyles();return{children:[],direction:o.__dir,format:t[o.__format],indent:o.__indent,textFormat:i!==0&&l?i:void 0,textStyle:s!==""&&l?s:void 0,type:o.__type,version:1}},exportCompactJSON:function(o){const i=o.__textFormat,s=o.__textStyle,l=(i!==0||s!=="")&&o.shouldSerializeTextStyles(),c={type:o.__type,children:[]},a=o.__dir;a!=null&&(c.direction=a);const u=t[o.__format];u!==void 0&&u!==""&&(c.format=u);const f=o.__indent;return f!==void 0&&f!==0&&(c.indent=f),i!==void 0&&i!==0&&l&&(c.textFormat=i),s!==void 0&&s!==""&&l&&(c.textStyle=s),c},updateFromJSON:function(o,i){const s=i.direction;o.__dir=s===null||s==="ltr"||s==="rtl"?s:null;const l=i.format;o.__format=typeof l=="string"&&l in e?e[l]:r,o.__indent=Af(i.indent,0,0,1/0),o.__textFormat=tr(i.textFormat,0);const c=i.textStyle;return o.__textStyle=typeof c=="string"?c:"",o}}},ap=()=>({exportJSON:function(n){return{type:n.__type,version:1}},exportCompactJSON:function(n){return{type:n.__type}}}),up=n=>{const t=ne(n,"mode"),e=Zn(n,"format",0);return{exportJSON:function(r){return{detail:r.__detail,mode:t[r.__mode],text:r.__text,format:r.__format,style:r.__style,type:r.__type,version:1}},exportCompactJSON:function(r){const o={type:r.__type},i=r.__format;i!==void 0&&i!==0&&(o.format=i);const s=r.__style;return s!==void 0&&s!==""&&(o.style=s),o},updateFromJSON:function(r,o){const i=o.format;r.__format=typeof i=="string"&&i in e?e[i]:tr(i,0);const s=o.style;return r.__style=typeof s=="string"?s:"",r}}},fp="!important";function Zo(n){const t={};if(!n)return t;let e="",r="",o=null,i=!1,s=!1,l=!1,c=0;const a=n.length;let u=-1;for(let h=0;h<a;h++){const g=n[h];if(i)g==="*"&&n[h+1]==="/"&&(i=!1,h++);else if(s)u===-1&&(u=h),s=!1;else if(o===null)if(g!=="/"||n[h+1]!=="*")if(g!=='"'&&g!=="'")if(g!=="(")if(g!==")")if(l||g!==":"||c!==0){if(g===";"&&c===0){u!==-1&&(l?r+=n.slice(u,h):e+=n.slice(u,h),u=-1);const _=e.trim(),m=r.trim();_!==""&&m!==""&&(t[_]=m),e="",r="",l=!1;continue}u===-1&&(u=h)}else u!==-1&&(e+=n.slice(u,h),u=-1),l=!0;else u===-1&&(u=h),c=Math.max(0,c-1);else u===-1&&(u=h),c++;else u===-1&&(u=h),o=g;else u!==-1&&(l?r+=n.slice(u,h):e+=n.slice(u,h),u=-1),i=!0,h++;else u===-1&&(u=h),g==="\\"?s=!0:g===o&&(o=null)}u!==-1&&(l?r+=n.slice(u,a):e+=n.slice(u,a));const f=e.trim(),d=r.trim();return f!==""&&d!==""&&(t[f]=d),t}function dp(n,t,e){const r=e.trimEnd(),o=r.length-10;o>=0&&r.slice(o).toLowerCase()===fp?n.setProperty(t,r.slice(0,o).trim(),"important"):n.setProperty(t,e,"")}function jn(n,t,e=""){if(t===e)return;const r=Zo(e),o=Zo(t);for(const i in o)delete r[i],dp(n,i,o[i]);for(const i in r)n.removeProperty(i)}const hp=xe()({detail:Mt(ms(He(),$u),{field:"__detail"}),format:Mt(ms(He(),Ct),{field:"__format"}),mode:Mt(dn(["normal","token","segmented"]),{field:"__mode",getterTable:Au,setterTable:il}),style:Mt(re(),{field:"__style"}),text:Mt(re(),{field:"__text",getter:"getTextContent",setter:"setTextContent"})});function Yi(n,t){return 16&t?"code":t&Ou?"mark":32&t?"sub":64&t?"sup":null}function Xi(n,t){return 1&t?"strong":2&t?"em":"span"}function Df(n,t,e,r,o){const i=r.classList;let s=Hn(o,"base");s!==void 0&&i.add(...s),s=Hn(o,"underlineStrikethrough");let l=!1;const c=8&t&&4&t;s!==void 0&&(8&e&&4&e?(l=!0,c||i.add(...s)):c&&i.remove(...s));for(const a in Ct){const u=Ct[a];if(s=Hn(o,a),s!==void 0)if(e&u){if(l&&(a==="underline"||a==="strikethrough")){t&u&&i.remove(...s);continue}((t&u)===0||c&&a==="underline"||a==="strikethrough")&&i.add(...s)}else t&u&&i.remove(...s)}Xr(r,"class")}function Pf(n,t,e){const r=e.isComposing(),o=n+(r?Br:""),i=gt(),s=Ii(i).$getDOMSlot(e,t,i),l=s.getFirstChild();if(l===null||l.nodeType!==Node.TEXT_NODE)return void s.insertChild(ot().createTextNode(o));const c=l,a=c.nodeValue;if(a!==o)if(r||Oe){const[u,f,d]=(function(h,g){const _=h.length,m=g.length;let p=0,y=0;for(;p<_&&p<m&&h[p]===g[p];)p++;for(;y+p<_&&y+p<m&&h[_-y-1]===g[m-y-1];)y++;return[p,_-p-y,g.slice(p,m-y)]})(a,o);f!==0&&c.deleteData(u,f),c.insertData(u,d)}else c.nodeValue=o}function Ac(n,t,e,r,o,i){Pf(o,n,t);const s=i.theme.text;s!==void 0&&Df(0,0,r,n,s)}function yo(n,t){const e=ot().createElement(t);return e.appendChild(n),e}function Fs(n){return n!=null&&n.__isInlineFormattable===!0}class se extends Tt{constructor(e="",r){super(r);k(this,"__text");k(this,"__format");k(this,"__style");k(this,"__mode");k(this,"__detail");this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}get __isInlineFormattable(){return!0}$config(){return this.config("text",{extends:Tt,generated:lp,importDOM:{"#text":()=>({conversion:mp,priority:0}),b:()=>({conversion:pp,priority:0}),code:()=>({conversion:be,priority:0}),em:()=>({conversion:be,priority:0}),i:()=>({conversion:be,priority:0}),mark:()=>({conversion:be,priority:0}),s:()=>({conversion:be,priority:0}),span:()=>({conversion:gp,priority:0}),strong:()=>({conversion:be,priority:0}),sub:()=>({conversion:be,priority:0}),sup:()=>({conversion:be,priority:0}),u:()=>({conversion:be,priority:0})},json:hp})}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return Au[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===ge()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const r=Ct[e];return(this.getFormat()&r)!==0}isSimpleText(){const e=this.getLatest();return e.__type==="text"&&e.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,r){return mn(this.getLatest().__format,e,r)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,r){const o=this.__format,i=Yi(0,o),s=Xi(0,o),l=i===null?s:i,c=ot().createElement(l);let a=c;this.hasFormat("code")&&c.setAttribute("spellcheck","false"),i!==null&&(a=ot().createElement(s),c.appendChild(a)),Ac(a,this,0,o,this.__text,e);const u=this.__style;return u!==""&&jn(c.style,u),c}updateDOM(e,r,o){const i=this.__text,s=e.__format,l=this.__format,c=Yi(0,s),a=Yi(0,l),u=Xi(0,s),f=Xi(0,l);if((c===null?u:c)!==(a===null?f:a))return!0;if(c===a&&u!==f){const m=r.firstChild;m==null&&w(48);const p=ot().createElement(f);return Ac(p,this,0,l,i,o),r.replaceChild(p,m),!1}let d=r;a!==null&&c!==null&&(d=r.firstChild,d==null&&w(49)),Pf(i,d,this);const h=o.theme.text;h!==void 0&&s!==l&&Df(0,s,l,d,h);const g=e.__style,_=this.__style;return g!==_&&(jn(r.style,_,g),Xr(r,"style")),!1}exportDOM(e){let{element:r}=super.exportDOM(e);return q(r)||w(132),r.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?r.style.textTransform="lowercase":this.hasFormat("uppercase")?r.style.textTransform="uppercase":this.hasFormat("capitalize")&&(r.style.textTransform="capitalize"),this.hasFormat("bold")&&(r=yo(r,"b")),this.hasFormat("italic")&&(r=yo(r,"i")),this.hasFormat("strikethrough")&&(r=yo(r,"s")),this.hasFormat("underline")&&(r=yo(r,"u")),{element:r}}selectionTransform(e,r){}setFormat(e){const r=this.getWritable();return r.__format=typeof e=="string"?Ct[e]:e,r}setDetail(e){const r=this.getWritable();return r.__detail=typeof e=="string"?$u[e]:e,r}setStyle(e){const r=this.getWritable();return r.__style=e,r}toggleFormat(e){const r=mn(this.getFormat(),e,null);return this.setFormat(r)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const r=il[e];if(this.getLatest().__mode===r)return this;const o=this.getWritable();return o.__mode=r,o}setTextContent(e){if(this.getLatest().__text===e)return this;const r=this.getWritable();return r.__text=e,r}select(e,r){xt();let o=e,i=r;const s=A(),l=this.getTextContent(),c=this.__key;if(typeof l=="string"){const a=l.length;o===void 0&&(o=a),i===void 0&&(i=a)}else o=0,i=0;if(!O(s))return Jf(c,o,c,i,"text","text");{const a=ge();a!==s.anchor.key&&a!==s.focus.key||bt(c),s.setTextNodeRange(this,o,this,i)}return s}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,r,o,i){const s=this.getWritable(),l=s.__text,c=o.length;let a=e;a<0&&(a=c+a,a<0&&(a=0));const u=A();if(i&&O(u)){const d=e+c;u.setTextNodeRange(s,d,s,d)}const f=l.slice(0,a)+o+l.slice(a+r);return s.__text=f,s}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){xt();const r=this.getLatest(),o=r.getTextContent();if(o==="")return[];const i=r.__key,s=ge(),l=o.length;e.sort((E,$)=>E-$),e.push(l);const c=[],a=e.length;for(let E=0,$=0;E<l&&$<=a;$++){const F=e[$];F>E&&(c.push(o.slice(E,F)),E=F)}const u=c.length;if(u===1)return[r];const f=c[0],d=r.getParent();let h;const g=r.getFormat(),_=r.getStyle(),m=r.__detail;let p=!1,y=null,x=null;const v=A();if(O(v)){const[E,$]=v.isBackward()?[v.focus,v.anchor]:[v.anchor,v.focus];E.type==="text"&&E.key===i&&(y=E),$.type==="text"&&$.key===i&&(x=$)}r.isSegmented()?(h=mt(f),h.__format=g,h.__style=_,h.__detail=m,h.__state=ac(r,h),p=!0):h=r.setTextContent(f);const S=[h];for(let E=1;E<u;E++){const $=mt(c[E]);$.__format=g,$.__style=_,$.__detail=m,$.__state=ac(r,$);const F=$.__key;s===i&&bt(F),S.push($)}const C=y?y.offset:null,N=x?x.offset:null;let T=0;for(const E of S){if(!y&&!x)break;const $=T+E.getTextContentSize();if(y!==null&&C!==null&&C<=$&&C>=T&&(y.set(E.getKey(),C-T,"text"),C<$&&(y=null)),x!==null&&N!==null&&N<=$&&N>=T){x.set(E.getKey(),N-T,"text");break}T=$}if(d!==null){(function(F){const D=F.getPreviousSibling(),L=F.getNextSibling();D!==null&&ui(D),L!==null&&ui(L)})(this);const E=d.getWritable(),$=this.getIndexWithinParent();p?(E.splice($,0,S),this.remove()):E.splice($,1,S),O(v)&&ln(v,d,$,u-1)}return S}mergeWithSibling(e){const r=e===this.getPreviousSibling();r||e===this.getNextSibling()||w(50);const o=this.__key,i=e.__key,s=this.__text,l=s.length;ge()===i&&bt(o);const c=A();if(O(c)){const d=c.anchor,h=c.focus;d!==null&&d.key===i&&Jc(d,r,o,e,l),h!==null&&h.key===i&&Jc(h,r,o,e,l)}const a=e.__text,u=r?a+s:s+a;this.setTextContent(u);const f=this.getWritable();return e.remove(),f}isTextEntity(){return!1}}function gp(n){return{forChild:Sl(n.style),node:null}}function pp(n){const t=n,e=t.style.fontWeight==="normal";return{forChild:Sl(t.style,e?void 0:"bold"),node:null}}const Dc=new WeakMap;function _p(n){if(!q(n))return!1;if(n.nodeName==="PRE")return!0;const t=n.style.whiteSpace;return typeof t=="string"&&t.startsWith("pre")}function mp(n){const t=n;n.parentElement===null&&w(129);let e=t.textContent||"";if((function(r){let o,i=r.parentNode;const s=[r];for(;i!==null&&(o=Dc.get(i))===void 0&&!_p(i);)s.push(i),i=i.parentNode;const l=o===void 0?i:o;for(let c=0;c<s.length;c++)Dc.set(s[c],l);return l})(t)!==null)return{node:Vf(e)};if(e=e.replace(/\r/g,"").replace(/[ \t\n]+/g," "),e==="")return{node:null};if(e[0]===" "){let r=t,o=!0;for(;r!==null&&(r=Pc(r,!1))!==null;){const i=r.textContent||"";if(i.length>0){/[ \t\n]$/.test(i)&&(e=e.slice(1)),o=!1;break}}o&&(e=e.slice(1))}if(e[e.length-1]===" "){let r=t,o=!0;for(;r!==null&&(r=Pc(r,!0))!==null;)if((r.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){o=!1;break}o&&(e=e.slice(0,e.length-1))}return e===""?{node:null}:{node:mt(e)}}function Pc(n,t){let e=n;for(;;){let r;for(;(r=t?e.nextSibling:e.previousSibling)===null;){const i=e.parentElement;if(i===null)return null;e=i}if(e=r,q(e)){const i=e.style.display;if(i===""&&!Bs(e)||i!==""&&!i.startsWith("inline"))return null}let o=e;for(;(o=t?e.firstChild:e.lastChild)!==null;)e=o;if(ve(e))return e;if(e.nodeName==="BR")return null}}const yp={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function be(n){const t=yp[n.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:Sl(n.style,t),node:null}}function mt(n=""){return fe(new se(n))}function M(n){return n instanceof se}function Sl(n,t){const e=n.fontWeight,r=n.textDecoration.split(" "),o=e==="700"||e==="bold",i=r.includes("line-through"),s=n.fontStyle==="italic",l=r.includes("underline"),c=n.verticalAlign,a=n.textTransform;return u=>((M(u)||Fs(u))&&(o&&!u.hasFormat("bold")&&u.toggleFormat("bold"),i&&!u.hasFormat("strikethrough")&&u.toggleFormat("strikethrough"),s&&!u.hasFormat("italic")&&u.toggleFormat("italic"),l&&!u.hasFormat("underline")&&u.toggleFormat("underline"),c!=="sub"||u.hasFormat("subscript")||u.toggleFormat("subscript"),c!=="super"||u.hasFormat("superscript")||u.toggleFormat("superscript"),a!=="lowercase"&&a!=="uppercase"&&a!=="capitalize"||u.hasFormat(a)||u.toggleFormat(a),t&&!u.hasFormat(t)&&u.toggleFormat(t)),u)}const xp=xe()({detail:ie(He(2),{getter:{field:"__detail"},setter:null}),mode:ie(dn(["normal"]),{getter:{field:"__mode",getterTable:{0:"normal"}},setter:null}),text:ie(re(" "),{getter:{field:"__text",method:"getTextContent"},setter:null})});class $i extends se{$config(){return this.config("tab",{extends:se,generated:up,json:xp})}constructor(t=void 0){super(" ",t),this.__detail=2}createDOM(t){const e=super.createDOM(t),r=Hn(t.theme,"tab");return r!==void 0&&e.classList.add(...r),e}setTextContent(t){return super.setTextContent(" ")}spliceText(t,e,r,o){return r===""&&e===0||r===" "&&e===1||w(286),this}setDetail(t){return t!==2&&w(127),this}setMode(t){return t!=="normal"&&w(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function lo(){return fe(new $i)}function pn(n){return n instanceof $i}class vp{constructor(t,e,r){k(this,"key");k(this,"offset");k(this,"type");k(this,"_selection");this._selection=null,this.key=t,this.offset=e,this.type=r}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){return this.key===t.key?this.offset<t.offset:Xe(Pt(Wt(this,"next")),Pt(Wt(t,"next")))<0}getNode(){const t=nt(this.key);return t===null&&w(20),t}set(t,e,r,o){const i=this._selection,s=this.key;o&&this.key===t&&this.offset===e&&this.type===r||(this.key=t,this.offset=e,this.type=r,_n()||(ge()===s&&bt(t),i!==null&&(i.setCachedNodes(null),O(i)&&(i._cachedIsBackward=null),i.dirty=!0)))}}function ye(n,t,e){return new vp(n,t,e)}function Qi(n,t){let e=t.__key,r=n.offset,o="element";if(M(t)){o="text";const i=t.getTextContentSize();r>i&&(r=i)}else if(!b(t)){const i=t.getNextSibling();if(M(i))e=i.__key,r=0,o="text";else{const s=t.getParent();s&&(e=s.__key,r=t.getIndexWithinParent()+1)}}n.set(e,r,o)}function Ic(n,t){if(b(t)){const e=t.getLastDescendant();b(e)||M(e)?Qi(n,e):Qi(n,t)}else Qi(n,t)}function Lc(n,t,e,r){const o=n.getNode(),i=o.getChildAtIndex(n.offset),s=mt();if(s.setFormat(e),s.setStyle(r),dr(i))i.splice(0,0,[s]);else if(i!==null){const l=Z(o)?tt().append(s):s;i.insertBefore(l)}else if(Z(o)){const l=o.getLastChild();b(l)&&!l.isInline()&&l.isEmpty()?l.append(s):o.append(tt().append(s))}else o.append(s);n.is(t)&&t.set(s.__key,0,"text"),n.set(s.__key,0,"text")}function Rc(n,t,e,r){const o=n.anchor.getNode();M(o)||w(398);const i=n.anchor.offset,s=mt(t);s.setFormat(e),s.setStyle(r);const l=o.getParentOrThrow();if(i===0)l.isInline()&&!o.__prev?l.insertBefore(s):o.insertBefore(s,!1);else if(i===o.getTextContentSize())l.isInline()&&!o.__next?l.insertAfter(s):o.insertAfter(s,!1);else{const[c]=o.splitText(i);c.insertAfter(s,!1)}o.getTextContent()===""&&o.isAttached()&&o.remove(),s.selectEnd(),s.isComposing()&&n.anchor.type==="text"&&n.anchor.set(n.anchor.key,n.anchor.offset-t.length,n.anchor.type)}class Mi{constructor(t){k(this,"_nodes");k(this,"_cachedNodes");k(this,"dirty");this._cachedNodes=null,this._nodes=t,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){if(!ct(t))return!1;const e=this._nodes,r=t._nodes;return e.size===r.size&&Array.from(e).every(o=>r.has(o))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(t){this.dirty=!0,this._nodes.add(t),this._cachedNodes=null}delete(t){this.dirty=!0,this._nodes.delete(t),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(t){return this._nodes.has(t)}clone(){return new Mi(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){const e=this.getNodes().filter(s=>Ot(s)===null),r=e.length;if(r===0)return;const o=e[r-1];let i;if(M(o))i=o.select();else{const s=o.getIndexWithinParent()+1;i=o.getParentOrThrow().select(s,s)}i.insertNodes(t);for(let s=0;s<r;s++)e[s].remove()}getNodes(){const t=this._cachedNodes;if(t!==null)return t;const e=this._nodes,r=[];for(const o of e){const i=nt(o);i!==null&&r.push(i)}return _n()||(this._cachedNodes=r),r}getTextContent(){const t=this.getNodes();let e="";for(let r=0;r<t.length;r++)e+=t[r].getTextContent();return e}deleteNodes(){const t=this.getNodes().filter(e=>Ot(e)===null);if((A()||wn())===this&&t[0]){const e=X(t[0],"next");er(Zt(e,e))}for(const e of t)e.remove();If()}}function If(){const n=Y();if(n.isEmpty()){const t=tt();n.append(t),t.select()}}function Sp(n){const t=(function(e){const r=e.getNode();if(e.offset>0)return e.type==="element"&&b(r)?r.getChildAtIndex(e.offset-1):null;for(let o=r;o!==null&&!Dt(o)&&!Z(o);o=o.getParent()){const i=o.getPreviousSibling();if(i!==null)return i}return null})(n);return Nt(t)&&Nt(t.getPreviousSibling())}function O(n){return n instanceof En}class En{constructor(t,e,r,o){k(this,"format");k(this,"style");k(this,"anchor");k(this,"focus");k(this,"_cachedNodes");k(this,"_cachedIsBackward");k(this,"dirty");this.anchor=t,this.focus=e,t._selection=this,e._selection=this,this._cachedNodes=null,this._cachedIsBackward=null,this.format=r,this.style=o,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return!!O(t)&&this.anchor.is(t.anchor)&&this.focus.is(t.focus)&&this.format===t.format&&this.style===t.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const t=this._cachedNodes;if(t!==null)return t;const e=(function(r){const o=[],[i,s]=r.getTextSlices();i&&o.push(i.caret.origin);const l=new Set,c=new Set;for(const a of r)if(Qt(a)){const{origin:u}=a;o.length===0?l.add(u):(c.add(u),o.push(u))}else{const{origin:u}=a;b(u)&&c.has(u)||o.push(u)}if(s&&o.push(s.caret.origin),Ge(r.focus)&&b(r.focus.origin)&&r.focus.getNodeAtCaret()===null)for(let a=It(r.focus.origin,"previous");Qt(a)&&l.has(a.origin)&&!a.origin.isEmpty()&&a.origin.is(o[o.length-1]);a=Bl(a))l.delete(a.origin),o.pop();for(;o.length>1;){const a=o[o.length-1];if(!b(a)||c.has(a)||a.isEmpty()||l.has(a))break;o.pop()}if(o.length===0&&r.isCollapsed()){const a=Pt(r.anchor),u=Pt(r.anchor.getFlipped()),f=h=>Xt(h)?h.origin:h.getNodeAtCaret(),d=f(a)||f(u)||(r.anchor.getNodeAtCaret()?a.origin:u.origin);o.push(d)}return o})(ao(li(this),"next"));return _n()||(this._cachedNodes=e),e}setTextNodeRange(t,e,r,o){return this.anchor.set(t.__key,e,"text"),this.focus.set(r.__key,o,"text"),this}getTextContent(){const t=this.getNodes();if(t.length===0)return"";const e=t[0],r=t[t.length-1],o=this.anchor,i=this.focus,s=o.isBefore(i),[l,c]=As(this);let a="",u=!0;for(let f=0;f<t.length;f++){const d=t[f];if(b(d)&&!d.isInline()){u||(a+=`
8
+ `);let h="";for(const g of pe(d)){const _=lr(d,g);_!==null&&(h+=_.getTextContent())}h!==""?(a+=h,u=!1):u=!d.isEmpty()}else if(u=!1,M(d)){let h=d.getTextContent();d===e?d===r?o.type==="element"&&i.type==="element"&&i.offset!==o.offset||(h=l<c?h.slice(l,c):h.slice(c,l)):h=s?h.slice(l):h.slice(c):d===r&&(h=s?h.slice(0,c):h.slice(0,l)),a+=h}else!J(d)&&!Nt(d)||d===r&&this.isCollapsed()||(a+=d.getTextContent())}return a}applyDOMRange(t){const e=G(),r=e.getEditorState()._selection,o=jf(t.startContainer,t.startOffset,t.endContainer,t.endOffset,e,r);if(o===null)return;const[i,s,l]=o;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(s.key,s.offset,s.type,!0),l&&(this.dirty=!0),dl(this)}clone(){const t=this.anchor,e=this.focus;return new En(ye(t.key,t.offset,t.type),ye(e.key,e.offset,e.type),this.format,this.style)}toggleFormat(t){this.format=mn(this.format,t,null),this.dirty=!0}setFormat(t){this.format=t,this.dirty=!0}setStyle(t){this.style=t,this.dirty=!0}hasFormat(t){const e=Ct[t];return(this.format&e)!==0}insertRawText(t){this.insertNodes(Vf(t))}insertText(t){let e=this.format,r=this.style;if(!this.isCollapsed()){const f=(this.focus.isBefore(this.anchor)?this.focus:this.anchor).getNode();if(M(f)&&(e=f.getFormat(),r=f.getStyle()),this.removeText(),this.format=e,this.style=r,t==="")return;if(ge()===null)return this.anchor.type==="element"&&Lc(this.anchor,this.focus,e,r),void Rc(this,t,e,r)}this.anchor.type==="element"&&Lc(this.anchor,this.focus,e,r);const o=this.anchor.getNode();M(o)||w(398);const i=this.anchor.offset,s=o.getParentOrThrow(),l=o.getTextContentSize();if(Yt(o)||i===0&&(!o.canInsertTextBefore()||!s.canInsertTextBefore()&&!o.__prev)||i===l&&(!o.canInsertTextAfter()||!s.canInsertTextAfter()&&!o.__next)){if(o.isSegmented()&&i!==0&&i!==l){if(ge()!==null)o.setMode("normal").setFormat(e).setStyle(r);else{const d=mt(o.getTextContent());d.setFormat(e),d.setStyle(r);const h=A()===this;o.replace(d),this.setTextNodeRange(d,i,d,i),h&&A()!==this&&St(this)}return void(t!==""&&this.insertText(t))}if(t==="")return;if(i===0){const d=o.getPreviousSibling();if(M(d)&&d.canInsertTextAfter()&&!Yt(d))d.select();else{const h=mt();h.setFormat(e),h.setStyle(r),s.canInsertTextBefore()?o.insertBefore(h):s.insertBefore(h),h.select()}return void this.insertText(t)}if(i===l){const d=o.getNextSibling();if(M(d)&&d.canInsertTextBefore()&&!Yt(d))d.select(0,0);else{const h=mt();h.setFormat(e),h.setStyle(r),s.canInsertTextAfter()?o.insertAfter(h):s.insertAfter(h),h.select(0,0)}return void this.insertText(t)}const f=mt(t);return f.setFormat(e),f.setStyle(r),o.replace(f),void f.select()}if(t==="")return;const c=s.isInline()&&i===0&&!o.__prev,a=s.isInline()&&i===l&&!o.__next,u=o.getFormat()!==e||o.getStyle()!==r;if(c||a||u){if(o.getTextContent()!==""||c||a)return void Rc(this,t,e,r);o.setFormat(e),o.setStyle(r)}o.spliceText(i,0,t,!0),o.isComposing()&&this.anchor.type==="text"&&this.anchor.set(this.anchor.key,this.anchor.offset-t.length,this.anchor.type)}removeText(){const t=A()===this,e=this.anchor.key;Ro(this,Wp(li(this))),this.isCollapsed()&&(function(r,o){const i=r.anchor;if(i.key===o)return;const s=i.getNode();let l=0,c="";M(s)?(l=s.getFormat(),c=s.getStyle()):b(s)&&(l=s.getTextFormat(),c=s.getTextStyle()),r.format===l&&r.style===c||(r.format=l,r.style=c,r.dirty=!0)})(this,e),t&&A()!==this&&St(this)}formatText(t,e=null){Rf(this,t,e)}insertNodes(t){if(t.length===0)return;this.isCollapsed()||this.removeText();const e=this.anchor.getNode();if(this.anchor.type==="element"&&b(e)&&e.isShadowRoot()&&Ot(e)!==null){let x=e.getFirstChild()??e.append(tt()).getFirstChild();if(x!==null&&!b(x)){const v=tt();x.insertBefore(v),x=v}if(x!==null){x.selectStart();const v=A();return O(v)||w(369),v.insertNodes(t)}}if(this.anchor.type==="element"&&Z(e)){const x=ts(t),v=x.getLastDescendant();return e.splice(this.anchor.offset,0,x.getChildren()),void(v!==null&&v.selectEnd())}const r=this.isBackward()?this.focus:this.anchor;let o=r.getNode(),i=vt(o,Dt);const s=t[t.length-1];if(b(i)&&"__language"in i){if("__language"in t[0])this.insertText(t[0].getTextContent());else{const[,x]=Cr(this);i.splice(x,0,t),s.selectEnd()}return}if(!t.some(x=>(b(x)||J(x))&&!x.isInline())){b(i)||w(211,o.constructor.name,o.getType());const[x,v]=Cr(this,!0);return(b(x)?x:i).splice(v,0,t),void s.selectEnd()}if(b(i)&&Ot(i)!==null){const[,x]=Cr(this),v=Ps(t);i.splice(x,0,v);const S=v[v.length-1];return void(S!==void 0?S.selectEnd():i.select(x,x))}if(i===null){const x=ts(t),v=x.getLastDescendant();let S=Wt(this.anchor,"next");for(const C of x.getChildren())S=rd(C,S);return void(v!==null&&v.selectEnd())}if(b(i)&&!i.isParentRequired()&&!Z(i.getParentOrThrow())){const[,x]=Cr(this),v=Ps(t);i.splice(x,0,v);const S=v[v.length-1];return void(S!==void 0?S.selectEnd():i.select(x,x))}const l=ts(t),c=l.getLastDescendant(),a=l.getChildren(),u=Sp(r),f=!b(i)||!i.isEmpty()?this.insertParagraph():null;f&&!i.isAttached()&&(o=this.anchor.getNode(),i=vt(o,Dt));const d=a[a.length-1];let h=a[0];var g;g=h,u||!b(g)||!Dt(g)||g.isEmpty()||!b(i)||i.isEmpty()&&!i.canMergeWhenEmpty()||(b(i)||w(211,o.constructor.name,o.getType()),i.append(...h.getChildren()),h=a[1]),h&&(i===null&&w(212,o.constructor.name,o.getType()),(function(x,v){const S=v.getParentOrThrow().getLastChild();let C=v;const N=[v];for(;C!==S;)C.getNextSibling()||w(140),C=C.getNextSibling(),N.push(C);let T=x;for(const E of N)T=T.insertAfter(E)})(i,h));const _=vt(c,Dt),m=c.selectEnd();f&&(b(_)&&(f.canMergeWhenEmpty()||Dt(d))?(_.append(...f.getChildren()),f.remove()):f.isEmpty()&&f.remove()),b(i)&&i.isEmpty()&&i.remove();const p=b(i)?i.getLastChild():null;Nt(p)&&_!==i&&p.remove();const y=Pt(Wt(m.anchor,"next"));qe(m.anchor,y),qe(m.focus,y)}insertParagraph(){this.isCollapsed()||this.removeText();const t=this.anchor.getNode();if(this.anchor.type==="element"&&Z(t)){const l=tt();return t.splice(this.anchor.offset,0,[l]),l.select(),l}const[,e]=Cr(this),r=vt(this.anchor.getNode(),Dt);if(r!==null&&Ot(r)!==null)return null;b(r)||w(213);const o=r.getChildAtIndex(e),i=o?[o,...o.getNextSiblings()]:[],s=r.insertNewAfter(this,!1);return s?(s.append(...i),s.selectStart(),s):null}insertLineBreak(t){const e=Ve();if(this.insertNodes([e]),t){const r=e.getParentOrThrow(),o=e.getIndexWithinParent();r.select(o,o)}}extract(){const t=[...this.getNodes()],e=t.length;let r=t[0],o=t[e-1];const[i,s]=As(this),l=this.isBackward(),[c,a]=l?[this.focus,this.anchor]:[this.anchor,this.focus],[u,f]=l?[s,i]:[i,s];if(e===0)return[];if(e===1){if(M(r)&&!this.isCollapsed()){const d=r.splitText(u,f),h=u===0?d[0]:d[1];return h?(c.set(h.getKey(),0,"text"),a.set(h.getKey(),h.getTextContentSize(),"text"),[h]):[]}return[r]}if(M(r)&&(u===r.getTextContentSize()?t.shift():u!==0&&([,r]=r.splitText(u),t[0]=r,c.set(r.getKey(),0,"text"))),M(o)){const d=o.getTextContent().length;f===0?t.pop():f!==d&&([o]=o.splitText(f),t[t.length-1]=o,a.set(o.getKey(),o.getTextContentSize(),"text"))}return t}modify(t,e,r){if(oi(this,t,e,r))return;const o=t==="move",i=G(),s=Lt(Kt(i));if(!s)return;const l=i._blockCursorElement,c=i._rootElement,a=this.focus.getNode();c===null||l===null||!b(a)||a.isInline()||a.canBeEmpty()||di(l,i,c);const u=rr(i,this.focus.key);let f=u;if(this.focus.type==="text"&&(f=M(a)?je(a,u,i):null),this.dirty){const d=rr(i,this.anchor.key);let h=d;if(this.anchor.type==="text"){const g=this.anchor.getNode();h=M(g)?je(g,d,i):null}h&&f&&ri(s,h,this.anchor.offset,f,this.focus.offset)}if(r==="character"&&M(a)&&a.isUnmergeable()&&(e?this.focus.offset===0:this.focus.offset===a.getTextContentSize())){const d=X(a,e?"previous":"next").getNodeAtCaret();if(M(d)){if(!o){const h=d.getTextContentSize();return e?this.focus.set(d.__key,h-1,"text"):this.focus.set(d.__key,1,"text"),void(this.dirty=!0)}{const h=i.getElementByKey(d.getKey()),g=h?je(d,h,i):null;if(g){const _=e?g.length:0;ri(s,g,_,g,_)}}}}if(Bf(s,t,e?"backward":"forward",r,c),s.rangeCount>0){const d=Pi(s,i._rootElement),h=d||s.getRangeAt(0),g=this.anchor.getNode(),_=ut(g)?g:md(g);this.applyDOMRange(h),this.dirty=!0,!o&&(Kf(this,e,_),(d?s.direction!=="backward":s.anchorNode===h.startContainer&&s.anchorOffset===h.startOffset)||zf(this))}r==="lineboundary"&&oi(this,t,e,r,"decorators")}forwardDeletion(t,e,r){if(!r&&(t.type==="element"&&b(e)&&t.offset===e.getChildrenSize()||t.type==="text"&&t.offset===e.getTextContentSize())){const o=e.getParent(),i=e.getNextSibling()||(o===null?null:o.getNextSibling());if(b(i)&&i.isShadowRoot())return!0}return!1}deleteCharacter(t){const e=this.isCollapsed();if(this.isCollapsed()){const r=this.anchor;let o=r.getNode();if(this.forwardDeletion(r,o,t)){const c=b(o)?o.getNextSibling():null;if(!(b(o)&&o.isEmpty()&&b(c)&&c.isShadowRoot()))return}const i=Wt(r,t?"previous":"next"),s=zi(i);if(s.getTextSlices().every(c=>c===null||c.distance===0)){if(r.type==="element"){const a=i.getNodeAtCaret();if(b(a)&&Qr(a)){const u=a.getParent();a.remove();const f=fi(u,a);return void(f!==null&&f.selectStart())}}let c={type:"initial"};for(const a of s.iterNodeCarets("shadowRoot"))if(Qt(a)){if(!a.origin.isInline()){if(a.origin.isShadowRoot()){if(c.type==="merge-block")break;if(b(s.anchor.origin)&&s.anchor.origin.isEmpty()){const u=Pt(a);Ro(this,Zt(u,u)),s.anchor.origin.remove()}return}c.type!=="merge-next-block"&&c.type!=="merge-block"||(c={block:c.block,caret:a,type:"merge-block"})}}else{if(c.type==="merge-block")break;if(Ge(a)){if(b(a.origin)){if(a.origin.isInline()){if(!a.origin.isParentOf(s.anchor.origin))break}else c={block:a.origin,type:"merge-next-block"};continue}if(J(a.origin)){if(!a.origin.isIsolated())if(c.type==="merge-next-block"&&(a.origin.isKeyboardSelectable()||!a.origin.isInline())&&b(s.anchor.origin)&&s.anchor.origin.isEmpty()){s.anchor.origin.remove();const u=bl();u.add(a.origin.getKey()),St(u)}else{const u=a.origin,f=u.getParent();u.remove();const d=fi(f,u);d!==null&&d.selectStart()}return}if(Nt(a.origin))return void a.origin.remove();break}}if(c.type==="merge-block"){const{caret:a,block:u}=c;return pe(u).length>0?void 0:a.origin.isEmpty()&&!u.isEmpty()&&a.origin.getParent()===u.getParent()?void a.origin.remove(!0):(Ro(this,Zt(!a.origin.isEmpty()&&u.isEmpty()?Qe(X(u,a.direction)):s.anchor,a)),this.removeText())}for(let a=r.getNode();a!==null;){if(Ot(a)!==null)return;if(b(a)&&a.isShadowRoot())break;a=a.getParent()}}const l=this.focus;if(Zi(this,t,"character"),this.isCollapsed()){if(t&&r.offset===0&&Bc(this,r.getNode()))return}else{const c=l.type==="text"?l.getNode():null;if(o=r.type==="text"?r.getNode():null,c!==null&&c.isSegmented()){const a=l.offset,u=c.getTextContentSize();if(c.is(o)||t&&a!==u||!t&&a!==0)return void Kc(c,t,a)}else if(o!==null&&o.isSegmented()){const a=r.offset,u=o.getTextContentSize();if(o.is(c)||t&&a!==0||!t&&a!==u)return void Kc(o,t,a)}(function(a,u){const f=a.anchor,d=a.focus,h=f.getNode(),g=d.getNode();if(h===g&&f.type==="text"&&d.type==="text"){const _=f.offset,m=d.offset,p=_<m,y=p?_:m,x=p?m:_,v=x-1;y!==v&&(function(S){return!(hd(S)||Tp(S))})(h.getTextContent().slice(y,x))&&(u?d.set(d.key,v,d.type):f.set(f.key,v,f.type))}})(this,t)}}if(e||Po(this),this.removeText(),t&&!e&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const r=this.anchor.getNode();r.isEmpty()&&ut(r.getParent())&&r.getPreviousSibling()===null&&Bc(this,r),If()}}deleteLine(t){const e=this.isCollapsed(),r=Ds(this.anchor);if(r!==null&&J(At(r)))return this.isCollapsed()||this.focus.set(this.anchor.key,this.anchor.offset,this.anchor.type),void this.deleteCharacter(t);this.isCollapsed()&&Zi(this,t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):vt(this.anchor.getNode(),Dt)!==vt(this.focus.getNode(),Dt)?(this.focus.set(this.anchor.key,this.anchor.offset,this.anchor.type),this.deleteCharacter(t)):(e||Po(this),this.removeText())}deleteWord(t){const e=this.isCollapsed();if(this.isCollapsed()){const r=this.anchor,o=r.getNode();if(this.forwardDeletion(r,o,t))return;Zi(this,t,"word")}this.isCollapsed()?this.deleteCharacter(t):(e||Po(this),this.removeText())}isBackward(){const t=this._cachedIsBackward;if(t!==null)return t;const e=this.focus.isBefore(this.anchor);return _n()||(this._cachedIsBackward=e),e}getStartEndPoints(){return[this.anchor,this.focus]}}function ct(n){return n instanceof Mi}function Lf(n,t){if(ct(n)){for(const p of n.getNodes())Fs(p)&&p.setFormat(t(p.getFormat()));return}if(n.isCollapsed())return n.setFormat(t(n.format)),void bt(null);const e=[];for(const p of n.getNodes())M(p)?e.push(p):b(p)?p.setTextFormat(t(p.getTextFormat())):Fs(p)&&p.setFormat(t(p.getFormat()));const r=e.length;if(r===0)return n.setFormat(t(n.format)),void bt(null);const o=n.anchor,i=n.focus,s=n.isBackward(),l=s?i:o,c=s?o:i;let a=0,u=e[0],f=l.type==="element"?0:l.offset;if(l.type==="text"&&f===u.getTextContentSize()&&(a=1,u=e[1],f=0),u==null)return;const d=r-1;let h=e[d];const g=c.type==="text"?c.offset:h.getTextContentSize();if(u.is(h)){if(f===g)return;const p=t(u.getFormat());if(Yt(u)||f===0&&g===u.getTextContentSize())u.setFormat(p);else{const y=u.splitText(f,g),x=f===0?y[0]:y[1];x.setFormat(p),l.type==="text"&&l.set(x.__key,0,"text"),c.type==="text"&&c.set(x.__key,g-f,"text")}return void(n.format=p)}f===0||Yt(u)||([,u]=u.splitText(f),f=0);const _=t(u.getFormat());u.setFormat(_);const m=t(h.getFormat());g>0&&(g===h.getTextContentSize()||Yt(h)||([h]=h.splitText(g)),h.setFormat(m));for(let p=a+1;p<d;p++){const y=e[p];y.setFormat(t(y.getFormat()))}l.type==="text"&&l.set(u.__key,f,"text"),c.type==="text"&&c.set(h.__key,g,"text"),n.format=_|m}function Cp(n,t){const e=[];for(const[r,o]of Object.entries(t))typeof o=="boolean"&&e.push([r,o]);e.length!==0&&Lf(n,r=>{for(const[o,i]of e)r=mn(r,o,i?Ct[o]:0);return r})}function Rf(n,t,e=null){const r=e===null&&O(n)?mn(n.format,t,null):e;Lf(n,o=>mn(o,t,r))}function zc(n){const t=n.offset;if(n.type==="text")return t;const e=n.getNode();return t===e.getChildrenSize()?e.getTextContent().length:0}function As(n){const t=n.getStartEndPoints();if(t===null)return[0,0];const[e,r]=t;return e.type==="element"&&r.type==="element"&&e.key===r.key&&e.offset===r.offset?[0,0]:[zc(e),zc(r)]}function Bc(n,t){for(let e=t;e;e=e.getParent()){if(b(e)){if(e.collapseAtStart(n))return!0;if(Z(e))break}if(e.getPreviousSibling())break}return!1}function Po(n){const t=Y();!t.isEmpty()&&od(t,n)&&(n.anchor.set(t.getKey(),0,"element"),n.focus.set(t.getKey(),t.getChildrenSize(),"element"))}function zf(n){const t=n.focus,e=n.anchor,r=e.key,o=e.offset,i=e.type;e.set(t.key,t.offset,t.type,!0),t.set(r,o,i,!0)}function Bf(n,t,e,r,o){const i=r==="character"?Bt(n,o):null,s=i&&i.focusNode,l=i?i.focusOffset:0;if(n.modify(t,e,r),i===null||!(function(a,u,f){return a!==null&&a.nodeType===3&&(f==="backward"?u>0:f==="forward"&&u<a.length)})(s,l,e))return;const c=Bt(n,o);c.focusNode===s&&c.focusOffset===l&&n.modify(t,e,r)}function Kf(n,t,e){const r=n.getNodes(),o=r.filter(l=>or(l,e));if(o.length===0||o.length===r.length)return!1;const i=t?o[0]:o[o.length-1],s=b(i)?i:i.getParentOrThrow();return t?s.selectStart():s.selectEnd(),!0}function Zi(n,t,e){if(oi(n,"extend",t,e))return;const r=G(),o=Lt(Kt(r));if(!o||typeof o.modify!="function")return;const i=r._blockCursorElement,s=r._rootElement,l=n.anchor,c=n.focus.getNode();s===null||i===null||!b(c)||c.isInline()||c.canBeEmpty()||di(i,r,s);const a=E=>{const $=E.getNode(),F=r.getElementByKey(E.key);return F!==null&&E.type==="text"&&M($)?je($,F,r):F},u=l.getNode(),f=a(l);if(f===null)return;const d=l.offset,h=n.isCollapsed(),g=n.focus,_=h?f:a(g);if(_===null)return;const m=g.offset;if(ri(o,_,m,_,m),Bf(o,"move",t?"backward":"forward",e,s),o.rangeCount===0)return;const p=Pi(o,s)||o.getRangeAt(0),y=p.startContainer,x=p.startOffset;if(h&&e==="character"&&l.type==="text"&&M(u)&&u.isUnmergeable()&&d===(t?0:u.getTextContentSize())){const E=X(u,t?"previous":"next").getNodeAtCaret();if(M(E)){const $=t?E.getTextContentSize()-1:1;return n.focus.set(E.__key,$,"text"),void(n.dirty=!0)}}if(h&&e==="character"&&l.type==="text"){const E=t?0:u.getTextContentSize(),$=y===f?x:d!==E?E:-1;if($>=0)return void($!==d&&(n.focus.set(l.key,$,"text"),n.dirty=!0))}const[v,S,C,N]=t?[y,x,f,d]:[f,d,y,x],T=ut(u)?u:md(u);n.applyDOMRange({collapsed:!1,endContainer:C,endOffset:N,startContainer:v,startOffset:S}),n.dirty=!0,!Kf(n,t,T)&&t&&zf(n),e==="lineboundary"&&oi(n,"extend",t,e,"decorators")}function bp(){try{const n=new RegExp("\\p{Emoji}","u"),t=n.test.bind(n);if(t("❤️")&&t("#️⃣")&&t("👍"))return t}catch{}return()=>!1}const Tp=bp();function Kc(n,t,e){const r=n,o=r.getTextContent().split(/(?=\s)/g),i=o.length;let s=0,l=0;for(let a=0;a<i;a++){const u=a===i-1;if(l=s,s+=o[a].length,t&&s===e||s>e||u){o.splice(a,1),u&&(l=void 0);break}}const c=o.join("").trim();c===""?r.remove():(r.setTextContent(c),r.select(l,l))}function Wc(n,t,e,r){let o,i=t,s=!1;if(q(n)){let l=!1;const c=n.childNodes,a=c.length,u=r._blockCursorElement;i===a&&a>0&&(l=!0,i=a-1),gr(n,r)!==void 0||gi(n,r)||(s=!0);let f=c[i],d=!1;if(f===u)f=c[i+1],d=!0;else if(u!==null){const h=u.parentNode;n===h&&t>Array.prototype.indexOf.call(h.children,u)&&i--}if(o=Rn(f),M(o))i=_e(o,l?"next":"previous");else{let h=Rn(n);if(h===null)return null;if(b(h)){const g=r.getElementByKey(h.getKey());g===null&&w(214),[h,i]=Ut(h,g,r).resolveChildIndex(h,g,n,t),b(h)||w(215),l&&i>=h.getChildrenSize()&&(i=Math.max(0,h.getChildrenSize()-1));let m=h.getChildAtIndex(i);if(b(m)&&(function(p,y,x){const v=p.getParent();return x===null||v===null||!v.canBeEmpty()||v!==x.getNode()})(m,0,e)){const p=l?m.getLastDescendant():m.getFirstDescendant();p===null?h=m:(m=p,h=b(m)?m:m.getParentOrThrow()),i=0}M(m)?(o=m,h=null,i=_e(m,l?"next":"previous")):m!==h&&l&&!d&&(b(h)||w(216),i=Math.min(h.getChildrenSize(),i+1))}else{const g=At(h),_=g!==null?g:h,m=_.getIndexWithinParent(),p=r.getElementByKey(h.getKey());let y="after";if(p!==null&&Rn(n)===h){const x=Ut(h,p,r);x.element!==p?y=x.resolveLeafPosition(p,n,t):t===0&&J(h)&&(y="before")}i=y==="before"?m:m+1,h=_.getParentOrThrow()}if(b(h))return[ye(h.__key,i,"element"),s]}}else o=Rn(n);return M(o)?[ye(o.__key,_e(o,i,"clamp"),"text"),s]:null}function Uc(n,t,e){const r=n.offset,o=n.getNode();if(r===0){const i=o.getPreviousSibling(),s=o.getParent();if(t){if((e||!t)&&i===null&&b(s)&&s.isInline()){const l=s.getPreviousSibling();M(l)&&n.set(l.__key,l.getTextContent().length,"text")}}else b(i)&&!e&&i.isInline()?n.set(i.__key,i.getChildrenSize(),"element"):M(i)&&!o.isUnmergeable()&&n.set(i.__key,i.getTextContent().length,"text")}else if(r===o.getTextContent().length){const i=o.getNextSibling(),s=o.getParent();if(t&&b(i)&&i.isInline())n.set(i.__key,0,"element");else if((e||t)&&i===null&&b(s)&&s.isInline()&&!s.canInsertTextAfter()&&s.getTextContentSize()>1){const l=s.getNextSibling();M(l)&&n.set(l.__key,0,"text")}}}function Ds(n){const t=nt(n.key);return t===null?null:to(t)}function Wf(n,t,e){const r=Ds(n),o=Ds(t);if(r===o||r!==null&&o!==null&&r.is(o))return!1;const i=e(r,o);if(r!==null)return b(r)?t.set(r.getKey(),i?r.getChildrenSize():0,"element"):t.set(r.getKey(),i?r.getTextContentSize():0,"text"),!0;const s=At(o);if(s===null)return!1;const l=s.getParent();if(l===null)return!1;const c=s.getIndexWithinParent();return t.set(l.getKey(),i?c+1:c,"element"),!0}function Uf(n){const t=Wf(n.anchor,n.focus,(e,r)=>(function(o,i,s,l){if(s!==null&&l!==null){const u=At(s),f=At(l);if(u!==null&&u.is(f)){for(const d of Ri(u).values()){if(d===s.getKey())return!0;if(d===l.getKey())return!1}return!0}return u===null||f===null||u.isBefore(f)}if(s!==null){const u=At(s),f=nt(i.key);return u===null||f===null||!(!u.is(f)&&!u.isParentOf(f))||u.isBefore(f)}const c=At(l),a=nt(o.key);return c!==null&&a!==null&&!c.is(a)&&!c.isParentOf(a)&&a.isBefore(c)})(n.anchor,n.focus,e,r));return t&&(n.dirty=!0),t}function jf(n,t,e,r,o,i){if(n===null||e===null||!uo(o,n,e))return null;const s=Wc(n,t,O(i)?i.anchor:null,o);if(s===null)return null;const l=Wc(e,r,O(i)?i.focus:null,o);if(l===null)return null;const[c,a]=s,[u,f]=l;if(c.type==="element"&&u.type==="element"){const h=Rn(n),g=Rn(e);if(J(h)&&J(g))return null}const d=o._slotsUsed&&Wf(c,u,()=>(n.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return(function(h,g){if(h.type==="text"&&g.type==="text"){const _=h.isBefore(g),m=h.is(g);Uc(h,_,m),Uc(g,!_,m),m&&g.set(h.key,h.offset,h.type)}})(c,u),[c,u,a||f||d]}function ti(n){return b(n)&&!n.isInline()}function Jf(n,t,e,r,o,i){const s=ue(),l=new En(ye(n,t,o),ye(e,r,i),0,"");return l.dirty=!0,s._selection=l,l}function Cl(){const n=ye("root",0,"element"),t=ye("root",0,"element");return new En(n,t,0,"")}function bl(){return new Mi(new Set)}function ei(n,t,e,r){const o=e._window;if(o===null)return null;const i=r||o.event,s=i?i.type:void 0,l=s==="selectionchange",c=!_s&&(l||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&i&&i.detail===3||s==="drop"||s===void 0);let a,u,f,d;if(O(n)&&!c)return n.clone();{if(t===null)return null;const v=Bt(t,e._rootElement);if(a=v.anchorNode,u=v.focusNode,f=v.anchorOffset,d=v.focusOffset,(l||s===void 0)&&O(n)&&!uo(e,a,u))return n.clone()}const h=jf(a,f,u,d,e,n);if(h===null)return null;const[g,_,m]=h;let p=0,y="";if(O(n)){const v=n.anchor;if(g.key===v.key)p=n.format,y=n.style;else{const S=g.getNode();M(S)?(p=S.getFormat(),y=S.getStyle()):b(S)&&(p=S.getTextFormat(),y=S.getTextStyle())}}const x=new En(g,_,p,y);return m&&(x.dirty=!0),x}function A(){return ue()._selection}function wn(){return G()._editorState._selection}function sn(n,t){const e=t.__key;return n.anchor.key===e||n.focus.key===e}function ln(n,t,e,r=1){if(!sn(n,t))return;const o=n.anchor,i=n.focus,s=t.__key;if(n.isCollapsed()){const l=o.offset;if(e<=l&&r>0||e<l&&r<0){const c=Math.max(0,l+r);o.set(s,c,"element"),i.set(s,c,"element"),jc(n)}}else{const l=n.isBackward(),c=l?i:o,a=c.getNode(),u=l?o:i,f=u.getNode();if(t.is(a)){const d=c.offset;(e<=d&&r>0||e<d&&r<0)&&c.set(s,Math.max(0,d+r),"element")}if(t.is(f)){const d=u.offset;(e<=d&&r>0||e<d&&r<0)&&u.set(s,Math.max(0,d+r),"element")}}jc(n)}function jc(n){const t=n.anchor,e=t.offset,r=n.focus,o=r.offset,i=t.getNode(),s=r.getNode();if(n.isCollapsed()){if(!b(i))return;const l=i.getChildrenSize(),c=e>=l,a=c?i.getChildAtIndex(l-1):i.getChildAtIndex(e);if(M(a)){let u=0;c&&(u=a.getTextContentSize()),t.set(a.__key,u,"text"),r.set(a.__key,u,"text")}return}if(b(i)){const l=i.getChildrenSize(),c=e>=l,a=c?i.getChildAtIndex(l-1):i.getChildAtIndex(e);if(M(a)){let u=0;c&&(u=a.getTextContentSize()),t.set(a.__key,u,"text")}}if(b(s)){const l=s.getChildrenSize(),c=o>=l,a=c?s.getChildAtIndex(l-1):s.getChildAtIndex(o);if(M(a)){let u=0;c&&(u=a.getTextContentSize()),r.set(a.__key,u,"text")}}}function ni(n,t,e,r,o){let i=null,s=0,l=null;r!==null?(i=r.__key,M(r)?(s=r.getTextContentSize(),l="text"):b(r)&&(s=r.getChildrenSize(),l="element")):o!==null&&(i=o.__key,M(o)?l="text":b(o)&&(l="element")),i!==null&&l!==null?n.set(i,s,l):(s=t.getIndexWithinParent(),s===-1&&(s=e.getChildrenSize()),n.set(e.__key,s,"element"))}function Jc(n,t,e,r,o){n.type==="text"?n.set(e,n.offset+(t?0:o),"text"):n.offset>r.getIndexWithinParent()&&n.set(n.key,n.offset-1,"element")}function ri(n,t,e,r,o){try{n.setBaseAndExtent(t,e,r,o)}catch{}}function Hc(n,t,e){const r=rr(n,t.getKey());if(b(t)){const o=Ut(t,r,n);return[o.element,e+o.getFirstChildOffset()]}return[r,e]}function kp(n,t,e,r,o,i){const s=i.getRootNode(),l=On(s)||Me(s)?ir(s):null;if(o.has(Mf)&&l!==i||l!==null&&Ol(l,l))return;const c=Bt(r,i);let a;if(!O(t))return void(n!==null&&uo(e,c.anchorNode,c.focusNode)&&r.removeAllRanges());const u=t.anchor,f=t.focus,d=u.getNode(),h=f.getNode(),[g,_]=Hc(e,d,u.offset),[m,p]=Hc(e,h,f.offset),y=t.format,x=t.style,v=t.isCollapsed();let S=g,C=m,N=!1;if(u.type==="text"?(S=M(d)?je(d,g,e):null,N=d.getFormat()!==y||d.getStyle()!==x):O(n)&&n.anchor.type==="text"&&(N=!0),f.type==="text"&&(C=M(h)?je(h,m,e):null),S!==null&&C!==null){if(v&&(n===null||N||O(n)&&(n.format!==y||n.style!==x))&&(function(T,E,$,F,D,L){T._inputState.collapsedSelectionFormat={format:E,key:D,offset:F,style:$,timeStamp:L}})(e,y,x,_,u.key,performance.now()),(r.type!=="Range"||!v)&&c.anchorOffset===_&&c.focusOffset===p&&c.anchorNode===S&&c.focusNode===C){if(l===null||!i.contains(l)){const T=l!==null?Jn(l):null;T!==null&&T!==e||o.has(Ms)||i.focus({preventScroll:!0})}if(u.type!=="element")return}if(ri(r,S,_,C,p),Oe&&t.isCollapsed()&&i!==null&&!o.has(Ms)){const T=hi(i);if(T===null||!i.contains(T)){const E=ir(i.ownerDocument),$=E!==null?Jn(E):null;$!==null&&$!==e||i.focus({preventScroll:!0})}}if(!o.has(np)&&t.isCollapsed()&&i!==null&&i===hi(i)){const T=O(t)&&t.anchor.type==="element"?S.childNodes[_]||null:(a===void 0&&(a=s_(r,i)),a);if(T!==null){let E;if(ve(T)){const $=T.ownerDocument.createRange();$.selectNode(T),E=$.getBoundingClientRect()}else E=T.getBoundingClientRect();(function($,F,D){const L=Dl(D),B=Pl(L);if(L===null||B===null)return;const U=D.getBoundingClientRect();if(F.bottom<U.top)return;let{top:Q,bottom:H}=F,Et=0,et=0,ft=D;for(;ft!==null;){const dt=ft===L.body;if(dt){const Jt=B.visualViewport;if(Jt){const _t=Jt.offsetTop;Et=_t,et=_t+Jt.height}else Et=0,et=Kt($).innerHeight;const Ae=B.getComputedStyle(L.documentElement),yr=parseFloat(Ae.scrollPaddingTop),it=parseFloat(Ae.scrollPaddingBottom);isFinite(yr)&&(Et+=yr),isFinite(it)&&(et-=it)}else{const Jt=ft===D?U:ft.getBoundingClientRect();Et=Jt.top,et=Jt.bottom}let Se=0;if(Q<Et?Se=-(Et-Q):H>et&&(Se=H-et),Se!==0)if(dt)B.scrollBy(0,Se);else{const Jt=ft.scrollTop;ft.scrollTop+=Se;const Ae=ft.scrollTop-Jt;Q-=Ae,H-=Ae}if(dt)break;ft=$n(ft)}})(e,E,i)}}(function(T,E,$,F,D){const L=T._inputState;L.isSelectionChangeFromDOMUpdate=!0,L.selectionChangeFromDOMUpdatePoints=E!==void 0&&$!==void 0&&F!==void 0&&D!==void 0?{anchorNode:E,anchorOffset:$,focusNode:F,focusOffset:D}:null})(e,S,_,C,p)}}function Np(n){let t=A()||wn();t===null&&(t=Y().selectEnd()),t.insertNodes(n)}function Hf(n,t){for(const e of n.split(/(\r?\n|\t)/))e===`
9
+ `||e===`\r
10
+ `?t.linebreak():e===" "?t.tab():e!==""&&t.text(e)}function Vf(n){const t=[];return Hf(n,{linebreak:()=>t.push(Ve()),tab:()=>t.push(lo()),text:e=>t.push(mt(e))}),t}function Ps(n){const t=[];for(const e of n)Nt(e)||(!b(e)&&!J(e)||e.isInline()?t.push(e):b(e)&&t.push(...Ps(e.getChildren())));return t}function Cr(n,t=!1){let e=n;n.isCollapsed()||e.removeText();const r=A();O(r)&&(e=r),O(e)||w(161);const o=e.anchor;let i=o.getNode(),s=o.offset;for(;!Dt(i)&&Ot(i)===null;){const l=i;if([i,s]=Ep(i,s,t),l.is(i))break}return[i,s]}function Ep(n,t,e=!1){const r=n.getParent();if(!r){const i=tt();return Y().append(i),i.select(),[Y(),0]}if(M(n)){const i=n.splitText(t);if(i.length===0)return[r,n.getIndexWithinParent()];const s=t===0?0:1;return[r,i[0].getIndexWithinParent()+s]}if(!b(n)||t===0)return[r,n.getIndexWithinParent()];const o=n.getChildAtIndex(t);if(o){const i=new En(ye(n.__key,t,"element"),ye(n.__key,t,"element"),0,""),s=n.insertNewAfter(i);if(s)s.append(o,...o.getNextSiblings());else if(e)return[n,t]}return[r,n.getIndexWithinParent()+1]}function Vc(n){return Nt(n)||n_(n)||M(n)||n.isParentRequired()}function ts(n){const t=tt();let e=null;for(let r=0;r<n.length;r++){const o=n[r];if(Vc(o)){if(e===null){e=o.createParentElementNode(),t.append(e);const i=n[r+1];if(Nt(o)&&(i===void 0||!Vc(i)))continue}e.append(o)}else t.append(o),e=null}return t}function oi(n,t,e,r,o="decorators-and-blocks"){if(t==="move"&&r==="character"&&!n.isCollapsed()){const[f,d]=e===n.isBackward()?[n.focus,n.anchor]:[n.anchor,n.focus];return d.set(f.key,f.offset,f.type),!0}const i=Wt(n.focus,e?"previous":"next"),s=r==="lineboundary",l=t==="move";let c=i,a=o==="decorators-and-blocks",u=!1;if(!ed(c)){for(const f of c){a=!1;const{origin:d}=f;if(J(d)){if(d.isIsolated()){u=!0;break}if(c=f,s&&d.isInline())continue}break}if(u)return!0;if(a)for(const f of zi(i).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(Qt(f))f.origin.isInline()||(c=f);else{if(b(f.origin))continue;J(f.origin)&&!f.origin.isInline()&&(c=f)}break}}if(c===i)return!1;if(l&&!s&&J(c.origin)&&c.origin.isKeyboardSelectable()){const f=bl();return f.add(c.origin.getKey()),St(f),!0}return c=Pt(c),l&&qe(n.anchor,c),qe(n.focus,c),a||!s}let kt=null,pt=null,zt=!1,es=!1,Io=!1;const ns=new Set;let Lo=0;const qc={characterData:!0,childList:!0,subtree:!0};function _n(){return zt||kt!==null&&kt._readOnly}function xt(){zt&&w(13)}function qf(){Lo>99&&w(14)}function ue(){return kt===null&&w(195,Gf()),kt}function wp(n){ue()!==null&&pt===null&&(pt=n),pt!==n&&Nu(378)}function G(){return pt===null&&w(337,Gf()),pt}function Op(){G()._dirtyType=2}function Gf(){let n=0;const t=new Set,e=nr.version;if(typeof window<"u")for(const o of xd(document)){const i=hr(o);if(fo(i))n++;else if(i){let s=String(i.constructor.version||"<0.17.1");s===e&&(s+=" (separately built, likely a bundler configuration issue)"),t.add(s)}}let r=` Detected on the page: ${n} compatible editor(s) with version ${e}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),r}function Yf(){return pt}function Gc(n,t,e){const r=t.__type,o=ld(n,r);let i=e.get(r);i===void 0&&(i=Array.from(o.transforms),e.set(r,i));const s=i.length;for(let l=0;l<s&&(i[l](t),t.isAttached());l++);}function Yc(n,t){return n!==void 0&&n.__key!==t&&n.isAttached()}function Xf(n,t){if(!t)return;const e=n._updateTags;let r=t;Array.isArray(t)||(r=[t]);for(const o of r)e.add(o)}function $p(n){return ii(n,G()._nodes)}function ii(n,t){const e=n.type,r=t.get(e);r===void 0&&w(17,e);const o=r.klass;n.type!==o.getType()&&w(18,o.name);const i=o.importJSON(n),s=n.children;if(b(i)&&Array.isArray(s))for(let c=0;c<s.length;c++){const a=ii(s[c],t);i.append(a)}const l=n.$slots;if(l){un(i)||w(379,o.name);for(const c in l)F_(i,c,ii(l[c],t))}return i}function Xc(n,t,e){const r=kt,o=zt,i=pt;kt=t,zt=!0,pt=n;try{return e()}finally{kt=r,zt=o,pt=i}}function Re(n,t){const e=Io;Io=!0;try{(function(r,o){const i=r._pendingEditorState,s=r._rootElement,l=r._headless||s===null;if(i===null)return void(!r._updating&&r._deferred.length>0&&Qc(r,r._deferred));const c=r._editorState,a=c._selection,u=i._selection,f=r._dirtyType!==0,d=kt,h=zt,g=pt,_=r._updating,m=r._observer;let p=null;if(r._pendingEditorState=null,r._editorState=i,!l&&f&&m!==null){pt=r,kt=i,zt=!1,r._updating=!0;try{const T=r._dirtyType,E=r._dirtyElements,$=r._dirtyLeaves;m.disconnect(),p=Ng(c,i,r,T,E,$)}catch(T){if(T instanceof Error&&r._onError(T),es)throw T;return id(r,null,s,i),Wu(r),r._dirtyType=2,es=!0,Re(r,c),void(es=!1)}finally{m.observe(s,qc),r._updating=_,kt=d,zt=h,pt=g}}i._readOnly||(i._readOnly=!0);const y=r._dirtyLeaves,x=r._dirtyElements,v=r._normalizedNodes,S=r._updateTags;f&&(r._dirtyType=0,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements=new Map,r._normalizedNodes=new Set),r._updateTags=new Set,(function(T,E){const $=T._decorators;let F=T._pendingDecorators||$;const D=E._nodeMap;let L;for(L in F)D.has(L)||(F===$&&(F=dd(T)),delete F[L])})(r,i);const C=l?null:Lt(Kt(r));if(r._editable&&C!==null&&(f||u===null||u.dirty||!u.is(a))&&s!==null&&!S.has(rp)){pt=r,kt=i;try{if(m!==null&&m.disconnect(),f||u===null||u.dirty){const T=r._blockCursorElement;T!==null&&di(T,r,s),kp(a,u,r,C,S,s)}(function(T,E,$){let F=T._blockCursorElement;if(O($)&&$.isCollapsed()&&$.anchor.type==="element"&&E.contains(hi(E))){const D=$.anchor,L=D.getNode(),B=D.offset;let U=!1,Q=null;if(B===L.getChildrenSize())Qr(L.getChildAtIndex(B-1))&&(U=!0);else{const H=L.getChildAtIndex(B);H!==null&&Qr(H)&&(U=!0,Q=T.getElementByKey(H.__key))}if(U){const H=Ut(L,T.getElementByKey(L.__key),T).element;return F===null&&(T._blockCursorElement=F=(function(Et){const et=Et.theme,ft=ot().createElement("div");ft.contentEditable="false",ft.setAttribute("data-lexical-cursor","true");let dt=et.blockCursor;if(dt!==void 0){if(typeof dt=="string"){const Se=me(dt);dt=et.blockCursor=Se}dt!==void 0&&ft.classList.add(...dt)}return ft})(T._config)),E.style.caretColor="transparent",void(Q===null?H.appendChild(F):H.insertBefore(F,Q))}}F!==null&&di(F,T,E)})(r,s,u)}finally{m!==null&&m.observe(s,qc),pt=g,kt=d}}p!==null&&(function(T,E,$,F,D){const L=Array.from(T._listeners.mutation),B=L.length;for(let U=0;U<B;U++){const[Q,H]=L[U];for(const Et of H){const et=E.get(Et);et!==void 0&&Q(et,{dirtyLeaves:F,prevEditorState:D,updateTags:$})}}})(r,p,S,y,c),O(u)||u===null||a!==null&&a.is(u)||r.dispatchCommand(cf);const N=r._pendingDecorators;N!==null&&(r._decorators=N,r._pendingDecorators=null,Ar("decorator",r,!0,N)),(function(T,E,$){const F=na(E),D=na($);F!==D&&Ar("textcontent",T,!0,D)})(r,o||c,i),Ar("update",r,!0,{dirtyElements:x,dirtyLeaves:y,editorState:i,mutatedNodes:p,normalizedNodes:v,prevEditorState:o||c,tags:S}),!_&&Qc(r,r._deferred),(function(T){const E=T._updates;if(E.length===0)return void(T._cascadeCount=0);if((function(F){ns.has(F)||(ns.add(F),setTimeout(()=>{ns.delete(F),F._cascadeCount=0},0))})(T),T._cascadeCount++>99)return T._updates=[],T._cascadeCount=0,void T._onWarn(new Error(`One or more update listeners are endlessly enqueueing more updates. May have encountered infinite recursion caused by update listeners that trigger additional updates without a stop condition. Editor namespace: ${T._config.namespace}`));const $=E.shift();if($){const[F,D]=$;Yr(T,F,D)}})(r)})(n,t)}finally{Io=e}}function Ar(n,t,e,...r){const o=t._updating;t._updating=e;try{const i=t._listeners[n],s=Array.from(i);for(const[l,c]of s){c&&c();const a=l(...r),u=typeof a=="function"?a:void 0;i.has(l)?i.set(l,u):u&&u()}}finally{t._updating=o}}function Qf(n,t,e,r){const o=$l(n);let i;if(!Io)for(let s=0;s<o.length;s++)o[s]._updating||(o[s]._cascadeCount=0);for(let s=4;s>=0;s--)for(let l=0;l<o.length;l++){const c=o[l];if(l>0&&c._updating){i=c;break}const a=c._commands.get(t);if(a!==void 0){const u=a[s];if(u.size>0){let f=!1;if(te(c,()=>{for(const d of u)if(d(e,r))return void(f=!0)}),f)return f}}}return i&&i.update(()=>{Qf(i,t,e,r)}),!1}function Qc(n,t){if(n._deferred=[],t.length!==0){const e=n._updating;n._updating=!0;try{for(let r=0;r<t.length;r++)t[r]()}finally{n._updating=e}}}function Zc(n,t){const e=n._updates;let r=t||!1;for(;e.length!==0;){const o=e.shift();if(o){const[i,s]=o,l=n._pendingEditorState;let c;s!==void 0&&(c=s.onUpdate,s.skipTransforms&&(r=!0),s.discrete&&(l===null&&w(191),l._flushSync=!0),c&&n._deferred.push(c),Xf(n,s.tag)),l==null?Yr(n,i,s):i()}}return r}function Mp(){const n=ue();xt(),n._flushSync=!0}function Yr(n,t,e){const r=n._updateTags;let o,i=!1,s=!1;e!==void 0&&(o=e.onUpdate,Xf(n,e.tag),i=e.skipTransforms||!1,s=e.discrete||!1),o&&n._deferred.push(o);const l=n._editorState;let c=n._pendingEditorState,a=!1;(c===null||c._readOnly)&&(c=n._pendingEditorState=td(c||l),a=!0),c._flushSync=s;const u=kt,f=zt,d=pt,h=n._updating;kt=c,zt=!1,n._updating=!0,pt=n;const g=n._headless||n.getRootElement()===null;Nl(null);try{a&&(g?l._selection!==null&&(c._selection=l._selection.clone()):c._selection=(function(y,x){const v=y.getEditorState()._selection,S=Lt(Kt(y));return O(v)||v==null?ei(v,S,y,x):v.clone()})(n,e&&e.event||null));const m=n._compositionKey;t(),i=Zc(n,i),(function(y,x){const v=x.getEditorState()._selection,S=y._selection;if(O(S)){const C=S.anchor,N=S.focus;let T;if(C.type==="text"&&(T=C.getNode(),T.selectionTransform(v,S)),N.type==="text"){const E=N.getNode();T!==E&&E.selectionTransform(v,S)}}})(c,n),n._dirtyType!==0&&(i?(function(y,x){const v=x._dirtyLeaves,S=y._nodeMap;for(const C of v){const N=S.get(C);M(N)&&N.isAttached()&&N.isSimpleText()&&!N.isUnmergeable()&&dc(N)}})(c,n):(function(y,x){const v=x._dirtyLeaves,S=x._dirtyElements,C=y._nodeMap,N=ge(),T=new Map;let E=v,$=E.size,F=S,D=F.size;for(;$>0||D>0;){if($>0){x._dirtyLeaves=new Set;for(const L of E){const B=C.get(L);M(B)&&B.isAttached()&&B.isSimpleText()&&!B.isUnmergeable()&&dc(B),B!==void 0&&Yc(B,N)&&Gc(x,B,T),v.add(L)}if(E=x._dirtyLeaves,$=E.size,$>0){Lo++;continue}}x._dirtyLeaves=new Set,x._dirtyElements=new Map,F.delete("root")&&F.set("root",!0);for(const L of F){const B=L[0],U=L[1];if(S.set(B,U),!U)continue;const Q=C.get(B);Q!==void 0&&Yc(Q,N)&&Gc(x,Q,T)}E=x._dirtyLeaves,$=E.size,F=x._dirtyElements,D=F.size,Lo++}x._dirtyLeaves=v,x._dirtyElements=S})(c,n),Zc(n),(function(y,x,v,S){const C=y._nodeMap,N=x._nodeMap,T=[];for(const[F]of S){const D=N.get(F);D!==void 0&&(D.isAttached()||(b(D)&&jo(D,F,C,N,T,S),C.has(F)||S.delete(F),T.push(F)))}for(const F of v){const D=N.get(F);D===void 0||D.isAttached()||(un(D)&&D.__slots!==null&&jo(D,F,C,N,T,v),C.has(F)||v.delete(F),T.push(F))}for(const F of T)N.delete(F);const E=G(),$=E._compositionKey;$===null||N.has($)||(E._compositionKey=null)})(l,c,n._dirtyLeaves,n._dirtyElements)),m!==n._compositionKey&&(c._flushSync=!0);const p=c._selection;if(O(p)){n._slotsUsed&&Uf(p);const y=c._nodeMap,x=p.anchor.key,v=p.focus.key;y.get(x)!==void 0&&y.get(v)!==void 0||w(19)}else ct(p)&&p._nodes.size===0&&(c._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 Re(n)}finally{kt=u,zt=f,pt=d,n._updating=h,Lo=0}n._dirtyType!==0||n._deferred.length>0||(function(m,p){const y=p.getEditorState()._selection,x=m._selection;if(x!==null){if(x.dirty||!x.is(y))return!0}else if(y!==null)return!0;return!1})(c,n)?c._flushSync?(c._flushSync=!1,Re(n)):a&&Xp(()=>{Re(n)}):(c._flushSync=!1,a&&(r.clear(),n._deferred=[],n._pendingEditorState=null))}function te(n,t,e){pt===n&&e===void 0?_n()?Yr(n,t,e):t():Yr(n,t,e)}function Fp(){return{...Fu,0:""}}function Ap(){return{...Qn,"":0}}const Dp=Fp(),Pp=Ap(),Ip=xe()({direction:Mt(dn([null,"ltr","rtl"]),{field:"__dir"}),format:Mt(dn(["","left","start","center","right","end","justify"]),{field:"__format",getter:"getFormatType",getterTable:Dp,setter:"setFormat",setterTable:Pp}),indent:Mt(He(0,{integer:!0,min:0}),{field:"__indent"}),textFormat:ie(He(),{getter:{field:"__textFormat",method:"getSerializedTextFormat",when:"shouldSerializeTextStyles"},setter:{field:"__textFormat"}}),textStyle:ie(re(),{getter:{field:"__textStyle",method:"getSerializedTextStyle",when:"shouldSerializeTextStyles"},setter:{field:"__textStyle"}})});function Lp(n){if(Z(n)){let t=null;for(const e of n.getChildren())t=e.isInline()?(t||e.replace(e.createParentElementNode())).append(e):null}}class yt extends Tt{constructor(e){super(e);k(this,"__first");k(this,"__last");k(this,"__size");k(this,"__format");k(this,"__style");k(this,"__indent");k(this,"__dir");k(this,"__textFormat");k(this,"__textStyle");k(this,"__slotHost");k(this,"__slots");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="",this.__slotHost=null,this.__slots=null}$config(){return this.config(Symbol.for("ElementNode"),{$transform:Lp,extends:Tt,generated:ip,json:Ip})}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__slotHost=e.__slotHost,this.__slotHost!==null&&this.__parent!==null&&w(384,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=e.__slots),this.__style=e.__style,(function(r,o){r.__dir=o.__dir,r.__format=o.__format,r.__indent=o.__indent,r.__textFormat=o.__textFormat,r.__textStyle=o.__textStyle})(this,e)}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return Fu[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let r=this.getFirstChild();for(;r!==null;)e.push(r),r=r.getNextSibling();return e}getChildrenKeys(){const e=[];let r=this.getFirstChild();for(;r!==null;)e.push(r.__key),r=r.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0&&pe(this).length===0}isDirty(){const e=G()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),r=this.getParentOrThrow().getLastChild();return r!==null&&r.is(e)}getAllTextNodes(){const e=[];for(const o of pe(this)){const i=lr(this,o);if(b(i))for(const s of i.getAllTextNodes())e.push(s)}let r=this.getFirstChild();for(;r!==null;){if(M(r)&&e.push(r),b(r))for(const o of r.getAllTextNodes())e.push(o);r=r.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;b(e);){const r=e.getFirstChild();if(r===null)break;e=r}return e}getLastDescendant(){let e=this.getLastChild();for(;b(e);){const r=e.getLastChild();if(r===null)break;e=r}return e}getDescendantByIndex(e){const r=this.getChildren(),o=r.length;if(e>=o){const s=r[o-1];return b(s)&&s.getLastDescendant()||s||null}const i=r[e];return b(i)&&i.getFirstDescendant()||i||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:nt(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&w(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:nt(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&w(96,this.__key),e}getChildAtIndex(e){const r=this.getChildrenSize();let o,i;if(e<r/2){for(o=this.getFirstChild(),i=0;o!==null&&i<=e;){if(i===e)return o;o=o.getNextSibling(),i++}return null}for(o=this.getLastChild(),i=r-1;o!==null&&i>=e;){if(i===e)return o;o=o.getPreviousSibling(),i--}return null}getTextContent(){let e=Md(this);const r=this.getChildren(),o=r.length;for(let i=0;i<o;i++){const s=r[i];e+=s.getTextContent(),b(s)&&i!==o-1&&!s.isInline()&&(e+=cn)}return e}getTextContentSize(){let e=(function(i){let s=0;for(const l of pe(i)){const c=lr(i,l);c!==null&&(s+=c.getTextContentSize())}return s})(this);const r=this.getChildren(),o=r.length;for(let i=0;i<o;i++){const s=r[i];e+=s.getTextContentSize(),b(s)&&i!==o-1&&!s.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==""){const r=Qn[e];return(this.getFormat()&r)!==0}return!1}hasTextFormat(e){const r=Ct[e];return(this.getTextFormat()&r)!==0}getFormatFlags(e,r){return mn(this.getLatest().__textFormat,e,r)}getTextStyle(){return this.getLatest().__textStyle}select(e,r){xt();const o=A();let i=e,s=r;const l=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&r===0){const a=this.getFirstChild();if(M(a)||b(a))return a.select(0,0)}else if(!(e!==void 0&&e!==l||r!==void 0&&r!==l)){const a=this.getLastChild();if(M(a)||b(a))return a.select()}}i===void 0&&(i=l),s===void 0&&(s=l);const c=this.__key;return O(o)?(o.anchor.set(c,i,"element"),o.focus.set(c,s,"element"),o.dirty=!0,o):Jf(c,i,c,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(r=>r.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const r=this.getWritable();return r.__dir=e,r}setFormat(e){const r=this.getWritable();return r.__format=e!==""&&Qn[e]||0,r}setStyle(e){const r=this.getWritable();return r.__style=e||"",r}setTextFormat(e){const r=this.getWritable();return r.__textFormat=e,r}setTextStyle(e){const r=this.getWritable();return r.__textStyle=e,r}setIndent(e){const r=this.getWritable();return r.__indent=e,r}splice(e,r,o){Xo(this)&&w(324,this.__key,this.__type);const i=this.getChildrenSize(),s=this.getWritable();e+r<=i||w(226,String(e),String(r),String(i));for(const g of o);const l=s.__key,c=[],a=[];let u=this.getChildAtIndex(e+r),f=null,d=i-r+o.length;if(e!==0)if(e===i)f=this.getLastChild();else{const g=this.getChildAtIndex(e);g!==null&&(f=g.getPreviousSibling())}if(r>0){let g=f===null?this.getFirstChild():f.getNextSibling();for(let _=0;_<r;_++){g===null&&w(100);const m=g.getNextSibling(),p=g.__key;Ee(g.getWritable()),a.push(p),g=m}}let h=f;for(const g of o){h!==null&&g.is(h)&&(f=h=h.getPreviousSibling()),u!==null&&g.is(u)&&(u=u.getNextSibling());const _=g.getWritable();_.__parent===l&&d--,Ee(_);const m=g.__key;if(h===null)s.__first=m,_.__prev=null;else{const p=h.getWritable();p.__next=m,_.__prev=p.__key}g.__key===l&&w(76),_.__parent=l,c.push(m),h=g}if(u===null)h!==null&&(h.getWritable().__next=null,s.__last=h.__key);else{const g=u.getWritable();if(h!==null){const _=h.getWritable();g.__prev=h.__key,_.__next=u.__key}else g.__prev=null}if(s.__size=d,a.length){const g=A();if(O(g)){const _=new Set(a),m=new Set(c),{anchor:p,focus:y}=g;ta(p,_,m)&&ni(p,p.getNode(),this,f,u),ta(y,_,m)&&ni(y,y.getNode(),this,f,u),d!==0||this.canBeEmpty()||Z(this)||this.remove()}}return s}getDOMSlot(e){return new Pu(e)}exportDOM(e){const{element:r}=super.exportDOM(e);if(q(r)){const o=this.getIndent();o>0&&(r.style.paddingInlineStart=40*o+"px",r.setAttribute("data-lexical-indent",String(o)));const i=this.getDirection();i&&(r.dir=i)}return{element:r}}shouldSerializeTextStyles(){if(Z(this))return!1;for(let e=this.getFirstChild();e!==null;e=e.getNextSibling())if(M(e))return!1;return!0}getSerializedTextFormat(){const e=this.getTextFormat();return e!==0&&this.shouldSerializeTextStyles()?e:void 0}getSerializedTextStyle(){const e=this.getTextStyle();return e!==""&&this.shouldSerializeTextStyles()?e:void 0}insertNewAfter(e,r){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,r,o){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,r){const o=Ut(this,e,r);let i=o.getFirstChild();for(let s=this.getFirstChild();s;s=s.getNextSibling()){const l=r.getElementByKey(s.getKey());l!==null&&(i==null?(o.insertChild(l),i=l):i!==l&&o.replaceChild(l,i),i=i.nextSibling)}}}function b(n){return n instanceof yt}function ta(n,t,e){let r=n.getNode();for(;r;){const o=r.__key;if(t.has(o)&&!e.has(o))return!0;r=r.getParent()}return!1}class Zf extends Tt{constructor(e){super(e);k(this,"__slotHost");k(this,"__slots");this.__slotHost=null,this.__slots=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__slotHost=e.__slotHost,this.__slotHost!==null&&this.__parent!==null&&w(383,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=e.__slots)}decorate(e,r){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function J(n){return n instanceof Zf}class Fi extends yt{constructor(){super("root");k(this,"__cachedText");this.__cachedText=null}$config(){return this.config("root",{extends:yt})}getTopLevelElementOrThrow(){w(51)}getTextContent(){const e=this.__cachedText;return e===null||!_n()&&G()._dirtyType!==0?super.getTextContent():e}remove(){w(52)}replace(e){w(53)}insertBefore(e){w(54)}insertAfter(e){w(55)}updateDOM(e,r){return!1}splice(e,r,o){for(const i of o)b(i)||J(i)||w(282);return super.splice(e,r,o)}static importJSON(e){return Y().updateFromJSON(e)}collapseAtStart(){return!0}}function ut(n){return n instanceof Fi}function td(n){return new co(Lu(n._nodeMap),null,n._slotsUsed)}function Tl(){return new co(new Map([["root",new Fi]]),null,!1)}function Is(n){const t=n.constructor,e=zu(n);if(b(n)){const o=e.children,i=n.getChildren();for(let s=0;s<i.length;s++)o.push(Is(i[s]))}const r=pe(n);if(r.length>0){const o={};for(const i of r){const s=lr(n,i);s===null&&w(366,t.name,i),o[i]=Is(s)}e.$slots=o}return e}function Rp(n){return n instanceof co}class co{constructor(t,e=null,r=!1){k(this,"_nodeMap");k(this,"_selection");k(this,"_flushSync");k(this,"_readOnly");k(this,"_parsed");k(this,"_slotsUsed");this._nodeMap=t,this._selection=e||null,this._flushSync=!1,this._readOnly=!1,this._parsed=!1,this._slotsUsed=r}isEmpty(){return this._nodeMap.size<=1&&this._selection===null}read(t,e){return Xc(e&&e.editor||null,this,t)}clone(t){const e=new co(this._nodeMap,t===void 0?this._selection:t,this._slotsUsed);return e._readOnly=!0,e._parsed=this._parsed,e}toJSON(t){return ug(typeof t=="boolean"&&t,()=>Xc(null,this,()=>({root:Is(Y())})))}}class kl extends yt{$config(){return this.config("artificial",{extends:yt})}createDOM(t){return ot().createElement("div")}}class Ai extends Tt{$config(){return this.config("linebreak",{extends:Tt,generated:ap,importDOM:{br:t=>Bp(t)||Kp(t)?null:{conversion:zp,priority:0}}})}getTextContent(){return`
11
+ `}createDOM(){return ot().createElement("br")}updateDOM(){return!1}isInline(){return!0}}function zp(n){return{node:Ve()}}function Ve(){return fe(new Ai)}function Nt(n){return n instanceof Ai}function Bp(n){const t=n.parentElement;if(t!==null&&Zr(t)){const e=t.firstChild;if(e===n||e.nextSibling===n&&si(e)){const r=t.lastChild;if(r===n||r.previousSibling===n&&si(r))return!0}}return!1}function Kp(n){const t=n.parentElement;if(t!==null&&Zr(t)){const e=t.firstChild;if(e===n||e.nextSibling===n&&si(e))return!1;const r=t.lastChild;if(r===n||r.previousSibling===n&&si(r))return!0}return!1}function si(n){return ve(n)&&/^( |\t|\r?\n)+$/.test(n.textContent||"")}function Wt(n,t){const{type:e,key:r,offset:o}=n,i=r_(n.key);return e==="text"?(M(i)||w(266,i.getType(),r),Ye(i,t,o)):(b(i)||w(267,i.getType(),r),Ls(i,n.offset,t))}function qe(n,t){const{origin:e,direction:r}=t,o=r==="next";Xt(t)?n.set(e.getKey(),t.offset,"text"):Ge(t)?M(e)?n.set(e.getKey(),_e(e,r),"text"):n.set(e.getParentOrThrow().getKey(),e.getIndexWithinParent()+(o?1:0),"element"):(Qt(t)&&b(e)||w(268),n.set(e.getKey(),o?0:e.getChildrenSize(),"element"))}function er(n){const t=A(),e=O(t)?t:Cl();return Ro(e,n),St(e),e}function Ro(n,t){qe(n.anchor,t.anchor),qe(n.focus,t.focus)}function li(n){const{anchor:t,focus:e}=n,r=Wt(t,"next"),o=Wt(e,"next"),i=Xe(r,o)<=0?"next":"previous";return Zt(le(r,i),le(o,i))}function Qe(n){const{direction:t,origin:e}=n,r=X(e,Ze(t)).getNodeAtCaret();return r?X(r,t):It(e.getParentOrThrow(),t)}function ea(n,t="root"){const e=[n];for(let r=Qt(n)?n.getParentCaret(t):n.getSiblingCaret();r!==null;r=r.getParentCaret(t))e.push(Qe(r));return e}function rs(n){return!!n&&n.origin.isAttached()}function Wp(n,t="removeEmptySlices"){if(n.isCollapsed())return n;const e="root",r="next";let o=t;const i=ao(n,r);let s=i.anchor.origin;for(;s!==null&&!Z(s);)s=s.getParent();const l=b(s)?s.getFirstChild():null,c=ea(i.anchor,e),a=ea(i.focus.getFlipped(),e),u=new Set,f=[];for(const p of i.iterNodeCarets(e))if(Qt(p))u.add(p.origin.getKey());else if(Ge(p)){const{origin:y}=p;b(y)&&!u.has(y.getKey())||f.push(y)}const d=new Set;for(const p of f){const y=p.getParent();y===null||u.has(y.getKey())||d.add(y),Ee(p)}for(const p of d)!p.canBeEmpty()&&!Z(p)&&p.isEmpty()&&p.isAttached()&&p.remove();for(const p of i.getTextSlices()){if(!p)continue;const{origin:y}=p.caret,x=y.getTextContentSize(),v=Qe(X(y,r)),S=y.getMode();if(Math.abs(p.distance)===x&&o==="removeEmptySlices"||S==="token"&&p.distance!==0)v.remove();else if(p.distance!==0){o="removeEmptySlices";let C=p.removeTextSlice();const N=p.caret.origin;if(S==="segmented"){const T=C.origin,E=mt(T.getTextContent()).setStyle(T.getStyle()).setFormat(T.getFormat());v.replaceOrInsert(E),C=Ye(E,r,C.offset)}N.is(c[0].origin)&&(c[0]=C),N.is(a[0].origin)&&(a[0]=C.getFlipped())}}let h,g;for(const p of c)if(rs(p)){h=Pt(p);break}for(const p of a)if(rs(p)){g=Pt(p);break}const _=(function(p,y,x){if(!p||!y)return null;const v=p.getParentAtCaret(),S=y.getParentAtCaret();if(!v||!S)return null;const C=v.getParents().reverse();C.push(v);const N=S.getParents().reverse();N.push(S);const T=Math.min(C.length,N.length);let E;for(E=0;E<T&&C[E]===N[E];E++);const $=(L,B)=>{let U;for(let Q=E;Q<L.length;Q++){const H=L[Q];if(Z(H))return;!U&&B(H)&&(U=H)}return U},F=$(C,Dt),D=F&&$(N,L=>x.has(L.getKey())&&Dt(L));return D&&pe(D).length>0?null:F&&D?[F,D]:null})(h,g,u);if(_){const[p,y]=_;It(p,"previous").splice(0,y.getChildren());let x=y.getParent();for(y.remove(!0);x&&x.isEmpty();){const v=x;x=x.getParent(),v.remove(!0)}}else if(g){const p=(function(v){if(Qt(v)){const S=v.origin;if(Dt(S))return S}else{const S=v.getParentAtCaret();if(S&&Dt(S))return S}return null})(g),y=p&&p.getParent(),x=p&&p.getParents().findLast(Dr);if(p&&y&&!ut(y)&&p.isEmpty()&&u.has(p.getKey())&&pe(p).length===0&&(!x||u.has(x.getKey()))){p.remove(!0);let v=y;for(;v&&!ut(v)&&v.isEmpty();){const S=v.getParent();if(S&&ut(S)&&S.getChildrenSize()<=1&&v.canBeEmpty())break;const C=v;v=S,C.remove(!0)}}}fi(s,l)===null&&fi(Y(),null);const m=[h,g,...c,...a].find(rs);if(m)return Bi(le(Pt(m),n.direction));w(269,JSON.stringify(c.map(p=>p.origin.__key)))}function Pt(n){const t=(function(o){let i=o;for(;Qt(i);){const s=Bl(i);if(!Qt(s))break;i=s}return i})(n.getLatest()),{direction:e}=t;if(M(t.origin))return Xt(t)?t:Ye(t.origin,e,e);const r=t.getAdjacentCaret();return Ge(r)&&M(r.origin)?Ye(r.origin,e,Ze(e)):t}function ed(n){return Xt(n)&&n.offset!==_e(n.origin,n.direction)}function ao(n,t){return n.direction===t?n:Zt(le(n.focus,t),le(n.anchor,t))}function Ls(n,t,e){let r=It(n,"next");for(let o=0;o<t;o++){const i=r.getAdjacentCaret();if(i===null)break;r=i}return le(r,e)}function Up(n){const{origin:t,offset:e,direction:r}=n;if(e===_e(t,r))return n.getSiblingCaret();if(e===_e(t,Ze(r)))return Qe(n.getSiblingCaret());const[o]=t.splitText(e);return M(o)||w(281),le(X(o,"next"),r)}function jp(n,t){return!0}function nd(n,{$copyElementNode:t=Ft,$splitTextPointCaretNext:e=Up,rootMode:r="shadowRoot",$shouldSplit:o=jp,removeEmptyDestination:i=!1}={}){if(Xt(n))return e(n);const s=n.getParentCaret(r);if(s){const{origin:l}=s;if(Qt(n)){const a=Qe(s);if(i&&l.isEmpty())return l.remove(),a;if(!l.canBeEmpty()||!o(l,"first"))return a}const c=(function(a){const u=[];for(let f=a.getAdjacentCaret();f;f=f.getAdjacentCaret())u.push(f.origin);return u})(n);(c.length>0||!i&&l.canBeEmpty()&&o(l,"last"))&&s.insert(t(l).splice(0,0,c))}return s}function rd(n,t,e){let r=le(t,"next");Xt(r)&&(r.offset===0?r=X(r.origin,"previous").getFlipped():r.offset===r.origin.getTextContentSize()&&(r=X(r.origin,"next"))),r.origin.is(n)&&(Ge(r)||w(342,n.getKey(),n.getType()),r=Qe(r)),(n.is(r.getNodeAtCaret())||n.is(r.getFlipped().getNodeAtCaret()))&&n.remove(!0);for(let o=r;o;o=nd(o,e))r=o;return Xt(r)&&w(283),r.insert(n.isInline()?tt().append(n):n),le(X(n.getLatest(),"next"),t.direction)}function od(n,t){const e=ao(O(t)?li(t):t,"next"),r=to(e.anchor.origin),o=to(n.getLatest());if(r===null?o!==null:!r.is(o))return!1;const i=Pt(It(n,"next")),s=le(Pt(It(n,"previous")),"next");return Xe(e.anchor,i)<=0&&Xe(e.focus,s)>=0}class Di extends yt{$config(){return this.config("paragraph",{extends:yt,generated:cp,importDOM:{p:()=>({conversion:Jp,priority:0})}})}createDOM(t){const e=ot().createElement("p"),r=Hn(t.theme,"paragraph");return r!==void 0&&e.classList.add(...r),e}updateDOM(t,e,r){return!1}exportDOM(t){const{element:e}=super.exportDOM(t);if(q(e)){this.isEmpty()&&e.append(ot().createElement("br"));const r=this.getFormatType();r&&(e.style.textAlign=r)}return{element:e}}exportJSON(t=!1){const e=super.exportJSON(t);if(e.textFormat===void 0||e.textStyle===void 0){const r=this.getChildren().find(M),o=r?r.getFormat():this.getTextFormat(),i=r?r.getStyle():this.getTextStyle();t&&o===0||(e.textFormat=o),t&&i===""||(e.textStyle=i)}return e}extractWithChild(t,e,r){if(!O(e)||this.getFormatType()===""&&this.getIndent()===0&&this.getStyle()==="")return!1;if(od(this,e)){const o=this.getTextContent();return o!==""&&e.getTextContent()===o}return!1}insertNewAfter(t,e){const r=tt();r.setTextFormat(t.format),r.setTextStyle(t.style);const o=this.getDirection();return r.setDirection(o),r.setFormat(this.getFormatType()),r.setStyle(this.getStyle()),this.insertAfter(r,e),r}collapseAtStart(){if(this.getChildren().every(t=>M(t)&&!/\S/.test(t.getTextContent()))){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function Jp(n){const t=tt();if(Li(t,n),Il(n,t),t.getFormatType()===""){const e=n.getAttribute("align");e&&e&&e in Qn&&t.setFormat(e)}return ho(t,n),{node:t}}function tt(){return fe(new Di)}function dr(n){return n instanceof Di}function Hp(n){console.warn(n)}const K=0,Ln=1,Ne=4,Vp=-8;function id(n,t,e,r,o){const i=n._keyToDOMMap;i.clear(),n._editorState=Tl(),n._pendingEditorState=r,n._compositionKey=null,n._dirtyType=0,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),n._normalizedNodes=new Set,o&&o.preserveUpdateQueue||(n._updateTags=new Set,n._updates=[],n._cascadeCount=0),n._blockCursorElement=null,n._inputState.handledSelectionCommandTimeoutId!==null&&clearTimeout(n._inputState.handledSelectionCommandTimeoutId),n._inputState={collapsedSelectionFormat:{format:0,key:"root",offset:0,style:"",timeStamp:0},compositionEndData:"",compositionPhase:"idle",hadOrphanedCompositionEvents:!1,handledSelectionCommandTimeoutId:null,isInsertLineBreak:!1,isInsertTextAfterHandledSelectionCommand:!1,isSelectionChangeFromDOMUpdate:!1,isSelectionChangeFromMouseDown:!1,lastBeforeInputInsertTextTimeStamp:0,lastKeyCode:null,lastKeyDownTimeStamp:0,postDeleteSelectionToRestore:null,selectionChangeFromDOMUpdatePoints:null,unprocessedBeforeInputData:null};const s=n._observer;s!==null&&(s.disconnect(),n._observer=null),t!==null&&(t.textContent="",(function(l,c){const a=`__lexicalKey_${c._key}`;delete l[a]})(t,n)),e!==null&&(e.textContent="",i.set("root",e),fd(e,n,"root"))}function qp(n){const t=new Set,e=new Set;for(const{klass:r,ownNodeConfig:o}of vn(n)){const i=r.transform;if(!e.has(i)){e.add(i);const s=r.transform();s&&t.add(s)}if(o){const s=o.$transform;s&&t.add(s)}}return t}const ci={$createDOM:(n,t)=>n.createDOM(t._config,t),$decorateDOM:(n,t,e,r)=>{},$exportDOM:(n,t)=>{const e=wl(t,n.getType());return e&&e.exportDOM!==void 0?e.exportDOM(t,n):n.exportDOM(t)},$extractWithChild:(n,t,e,r,o)=>b(n)&&n.extractWithChild(t,e,r),$getDOMSlot:(n,t,e)=>n.getDOMSlot(t),$getSlotTargetElement:(n,t,e,r)=>null,$shouldExclude:(n,t,e)=>b(n)&&n.excludeFromCopy("html"),$shouldInclude:(n,t,e)=>!t||n.isSelected(t),$updateDOM:(n,t,e,r)=>n.updateDOM(t,e,r._config)};function sd(n){const t=n||{},e=Yf(),r=t.theme||{},o=n===void 0?e:t.parentEditor||null,i=t.disableEvents||!1,s=Tl(),l=t.namespace||(o!==null?o._config.namespace:gd()),c=t.editorState,a=[Fi,se,Ai,$i,Di,kl,...t.nodes||[]],{onError:u,onWarn:f,html:d}=t,h=t.editable===void 0||t.editable;let g;if(n===void 0&&e!==null)g=e._nodes;else{g=new Map;for(let m=0;m<a.length;m++){let p=a[m],y=null,x=null;if(p&&typeof p=="object"){const C=p;p=C.replace,y=C.with,x=C.withKlass||null}if(typeof p!="function"||!p.prototype||!(p===Tt||p.prototype instanceof Tt)){let C="<unknown>";try{C=JSON.parse(Iu)}catch{}w(365,String(m-a.length+(t.nodes?t.nodes.length:0)),typeof p=="function"?`${p.name}${typeof p.getType=="function"?` (type ${String(p.getType())})`:""}`:String(p),String(C))}Ll(p);const v=p.getType(),S=qp(p);g.set(v,{exportDOM:d&&d.export?d.export.get(p):void 0,klass:p,replace:y,replaceWithKlass:x,sharedNodeState:vg(a[m]),transforms:S})}}const _=new nr(s,o,g,{disableEvents:i,dom:{...ci,...n&&n.dom},namespace:l,theme:r},u||console.error,f||Hp,(function(m,p){const y=new Map,x=new Set,v=S=>{Object.keys(S).forEach(C=>{let N=y.get(C);N===void 0&&(N=[],y.set(C,N)),N.push(S[C])})};return m.forEach(S=>{const C=S.klass.importDOM;if(C==null||x.has(C))return;x.add(C);const N=C.call(S.klass);N!==null&&v(N)}),p&&v(p),y})(g,d?d.import:void 0),h,n);return c!==void 0&&(_._pendingEditorState=c,_._dirtyType=2),(function(m){m.registerCommand(uf,Hg,K),m.registerCommand(ff,qg,K),m.registerCommand(df,Yg,K),m.registerCommand(hf,Xg,K),m.registerCommand(gf,tp,K)})(_),_}function Gp(n,t){const e=n.get(t);n.delete(t),e&&e()}function br(n,t,e){return n.set(t,e),Gp.bind(null,n,t)}class nr{constructor(t,e,r,o,i,s,l,c,a){k(this,"_headless");k(this,"_parentEditor");k(this,"_rootElement");k(this,"_editorState");k(this,"_pendingEditorState");k(this,"_compositionKey");k(this,"_deferred");k(this,"_keyToDOMMap");k(this,"_updates");k(this,"_updating");k(this,"_cascadeCount");k(this,"_listeners");k(this,"_commands");k(this,"_nodes");k(this,"_decorators");k(this,"_pendingDecorators");k(this,"_config");k(this,"_dirtyType");k(this,"_cloneNotNeeded");k(this,"_dirtyLeaves");k(this,"_dirtyElements");k(this,"_normalizedNodes");k(this,"_updateTags");k(this,"_observer");k(this,"_key");k(this,"_onError");k(this,"_onWarn");k(this,"_htmlConversions");k(this,"_window");k(this,"_editable");k(this,"_blockCursorElement");k(this,"_slotsUsed");k(this,"_keyDownShortcuts");k(this,"_inputState");k(this,"_createEditorArgs");this._createEditorArgs=a,this._parentEditor=e,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new ps,this._updates=[],this._updating=!1,this._cascadeCount=0,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},this._commands=new Map,this._config=o,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=gd(),this._onError=i,this._onWarn=s,this._htmlConversions=l,this._editable=c,this._headless=e!==null&&e._headless,this._window=null,this._blockCursorElement=null,this._slotsUsed=!1,this._keyDownShortcuts=null,this._inputState={collapsedSelectionFormat:{format:0,key:"root",offset:0,style:"",timeStamp:0},compositionEndData:"",compositionPhase:"idle",hadOrphanedCompositionEvents:!1,handledSelectionCommandTimeoutId:null,isInsertLineBreak:!1,isInsertTextAfterHandledSelectionCommand:!1,isSelectionChangeFromDOMUpdate:!1,isSelectionChangeFromMouseDown:!1,lastBeforeInputInsertTextTimeStamp:0,lastKeyCode:null,lastKeyDownTimeStamp:0,postDeleteSelectionToRestore:null,selectionChangeFromDOMUpdatePoints:null,unprocessedBeforeInputData:null}}isComposing(){return this._compositionKey!=null}registerUpdateListener(t){return br(this._listeners.update,t)}registerEditableListener(t){return br(this._listeners.editable,t)}registerDecoratorListener(t){return br(this._listeners.decorator,t)}registerTextContentListener(t){return br(this._listeners.textcontent,t)}registerRootListener(t){const e=this._listeners.root;return jt(br(e,t,t(this._rootElement,null)||void 0),()=>(function(r,o,i){const s=r.get(o);s&&s(),r.set(o,o(...i)||void 0)})(e,t,[null,this._rootElement]))}registerCommand(t,e,r){r===void 0&&w(35);const o=this._commands;o.has(t)||o.set(t,[new vr,new vr,new vr,new vr,new vr]);const i=o.get(t);i===void 0&&w(36,String(t));const s=(function(c){return 7&c})(r),l=i[s];return s!==r?l.addFront(e):l.addBack(e),()=>{l.delete(e),i.every(c=>c.size===0)&&o.delete(t)}}registerMutationListener(t,e,r){const o=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,i=this._listeners.mutation;let s=i.get(e);s===void 0&&(s=new Set,i.set(e,s)),s.add(o);const l=r&&r.skipInitialization;return l!==void 0&&l||this.initializeMutationListener(e,o),()=>{s.delete(o),s.size===0&&i.delete(e)}}getRegisteredNode(t){const e=this._nodes.get(t.getType());return e===void 0&&w(37,t.name),e}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,e){const r=this._editorState,o=la(r).get(e.getType());if(!o)return;const i=new Map;for(const s of o.keys())i.set(s,"created");i.size>0&&t(i,{dirtyLeaves:new Set,prevEditorState:r,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,e){const r=this.getRegisteredNode(t);return r.transforms.add(e),r}registerNodeTransform(t,e){const r=this.registerNodeTransformToKlass(t,e),o=[r],i=r.replaceWithKlass;if(i!=null){const s=this.registerNodeTransformToKlass(i,e);o.push(s)}return(function(s,l){const c=la(s.getEditorState()),a=[];for(const u of l){const f=c.get(u);f&&a.push(f)}a.length!==0&&s.update(()=>{for(const u of a)for(const f of u.keys()){const d=nt(f);d&&d.markDirty()}},s._pendingEditorState===null?{tag:Un}:void 0)})(this,o.map(s=>s.klass.getType())),()=>{o.forEach(s=>s.transforms.delete(e))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,...e){return R(this,t,...e)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){const e=this._rootElement;if(t!==e){const r=Hn(this._config.theme,"root"),o=this._pendingEditorState||this._editorState;if(this._rootElement=t,id(this,e,t,o,{preserveUpdateQueue:!0}),e!==null&&(this._config.disableEvents||ep(e),r!=null&&e.classList.remove(...r)),t!==null){const i=Pl(t),s=t.style;s.userSelect="text",s.whiteSpace="pre-wrap",s.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=i,this._dirtyType=2,Wu(this),this._updateTags.add(Un),Re(this),this._config.disableEvents||(function(l,c){const a=l.ownerDocument;ws.set(l,a);let u=Go.get(a);u===void 0&&(u={editors:new Set,hasShadowEditor:void 0},Go.set(a,u)),u.editors.add(c),u.hasShadowEditor=void 0,l.__lexicalEditor=c;const f=Nf(l);f.push(Ug.register(a));const d=Wg();for(let h=0;h<d.length;h++){const[g,_]=d[h],m=typeof _=="function"?p=>{Mc(p)||($c(p),(c.isEditable()||g==="click")&&_(p,c))}:p=>{if(Mc(p))return;$c(p);const y=c.isEditable();switch(g){case"cut":return y&&R(c,vl,p);case"copy":return R(c,Oi,p);case"paste":return y&&R(c,wi,p);case"dragstart":return y&&R(c,xf,p);case"dragover":return y&&R(c,xl,p);case"dragend":return y&&R(c,Fg,p);case"focus":return y&&R(c,Pg,p);case"blur":return y&&R(c,Ig,p);case"drop":return y&&R(c,yl,p)}};f.push(Kg(l,g,m))}})(t,this),r!=null&&t.classList.add(...r)}else this._window=null,this._updateTags.add(Un),Re(this);Ar("root",this,!1,t,e)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,e){t.isEmpty()&&w(38);let r=t;r._readOnly&&(r=td(t),r._selection=t._selection?t._selection.clone():null),Ku(this);const o=this._pendingEditorState,i=e!==void 0?e.tag:null;o===null||o.isEmpty()||(i!=null&&this._updateTags.add(i),Re(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,this._slotsUsed=this._slotsUsed||t._slotsUsed,te(this,()=>{if(i&&this._updateTags.add(i),t._parsed)for(const[s,l]of r._nodeMap.entries())b(l)?this._dirtyElements.set(s,!0):this._dirtyLeaves.add(s)},{discrete:!this._updating||void 0})}parseEditorState(t,e){return(function(r,o,i){const s=Tl(),l=kt,c=zt,a=pt,u=o._dirtyElements,f=o._dirtyLeaves,d=o._cloneNotNeeded,h=o._dirtyType;o._dirtyElements=new Map,o._dirtyLeaves=new Set,o._cloneNotNeeded=new Set,o._dirtyType=0,kt=s,zt=!1,pt=o,Nl(null);try{const g=o._nodes;ii(r.root,g),i&&i(),s._readOnly=!0,s._parsed=!0}catch(g){g instanceof Error&&o._onError(g)}finally{o._dirtyElements=u,o._dirtyLeaves=f,o._cloneNotNeeded=d,o._dirtyType=h,kt=l,zt=c,pt=a}return s})(typeof t=="string"?JSON.parse(t):t,this,e)}read(...t){const[e,r]=t.length===1?["force-commit",t[0]]:t;return e==="force-commit"&&Re(this),(e==="pending"?this._pendingEditorState||this._editorState:this.getEditorState()).read(r,{editor:this})}update(t,e){(function(r,o,i){r._updating?r._updates.push([o,i]):Yr(r,o,i)})(this,t,e)}focus(t,e={}){const r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),te(this,()=>{const o=A(),i=Y();o!==null?o.dirty||St(o.clone()):i.getChildrenSize()!==0&&(e.defaultSelection==="rootStart"?i.selectStart():i.selectEnd()),xn("focus"),e_(()=>{r.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&r.removeAttribute("autocapitalize"))}blur(){const t=this._rootElement;t!==null&&t.blur();const e=Lt(this._window);e!==null&&e.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,Ar("editable",this,!0,t),this._slotsUsed&&this.update(()=>Op()))}toJSON(){return{editorState:this._editorState.toJSON(fg())}}}k(nr,"version",Iu);let Rs=null;function Nl(n){Rs=n}const El=Symbol("INTERNAL_SKIP_AFTER_CLONE_FROM");let Yp=1;function ld(n,t){const e=wl(n,t);return e===void 0&&w(30,t),e}function wl(n,t){return n._nodes.get(t)}const Xp=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function Ol(n,t){const e=t!==void 0?t:(()=>{const i=n.getRootNode();return On(i)||Me(i)?ir(i):null})();if(!q(e)||e.hasAttribute("data-lexical-slot"))return!1;const r=yn(e),o=e.nodeName;return wf(r)&&(o==="INPUT"||o==="TEXTAREA"||e.contentEditable==="true"&&hr(e)==null)}function uo(n,t,e){const r=n.getRootElement();if(!r)return!1;try{if(!t||!r.contains(t)||!r.contains(e))return!1}catch{return!1}return Jn(t)===n&&n.read("latest",()=>!Ol(t))}function fo(n){return n instanceof nr}function Jn(n){let t=n;for(;t!=null;){const e=hr(t);if(fo(e))return e;t=$n(t)}return null}function hr(n){return n?n.__lexicalEditor:null}function ai(n){return pn(n)||n.isToken()}function Yt(n){return ai(n)||n.isSegmented()}function ve(n){return pr(n)&&n.nodeType===3}function On(n){return pr(n)&&n.nodeType===9}function Qp(n){let t=n;for(;t!=null;){if(ve(t))return t;t=t.firstChild}return null}function mn(n,t,e){const r=Ct[t];if(e!==null&&(n&r)===(e&r))return n;let o=n^r;return t==="subscript"?o&=~Ct.superscript:t==="superscript"?o&=~Ct.subscript:t==="lowercase"?(o&=~Ct.uppercase,o&=~Ct.capitalize):t==="uppercase"?(o&=~Ct.lowercase,o&=~Ct.capitalize):t==="capitalize"&&(o&=~Ct.lowercase,o&=~Ct.uppercase),o}function cd(n){return M(n)||Nt(n)||J(n)}function ad(n,t){const e=(function(){const s=Rs;return Rs=null,s})();if((t=t||e&&e.__key)!=null)return void(n.__key=t);xt(),qf();const r=G(),o=ue(),i=""+Yp++;o._nodeMap.set(i,n),b(n)?r._dirtyElements.set(i,!0):r._dirtyLeaves.add(i),r._cloneNotNeeded.add(i),r._dirtyType===0&&(r._dirtyType=1),n.__key=i}function Ee(n){Ot(n)!==null&&w(380,n.__key,String(Ot(n)));const t=n.getParent();if(t!==null){const e=n.getWritable(),r=t.getWritable(),o=n.getPreviousSibling(),i=n.getNextSibling(),s=i!==null?i.__key:null,l=o!==null?o.__key:null,c=o!==null?o.getWritable():null,a=i!==null?i.getWritable():null;o===null&&(r.__first=s),i===null&&(r.__last=l),c!==null&&(c.__next=s),a!==null&&(a.__prev=l),e.__prev=null,e.__next=null,e.__parent=null,r.__size--}}function ui(n){qf(),Xo(n)&&w(323,n.__key,n.__type);const t=n.getLatest(),e=t.__parent!==null?t.__parent:Sn(t)?t.__slotHost:null,r=ue(),o=G(),i=r._nodeMap,s=o._dirtyElements;e!==null&&(function(c,a,u){let f=c;for(;f!==null;){if(u.has(f))return;const d=a.get(f);if(d===void 0)break;u.set(f,!1),f=d.__parent!==null?d.__parent:Sn(d)?d.__slotHost:null}})(e,i,s);const l=t.__key;o._dirtyType===0&&(o._dirtyType=1),b(n)?s.set(l,!0):o._dirtyLeaves.add(l)}function bt(n){xt();const t=G(),e=t._compositionKey;if(n!==e){if(t._compositionKey=n,e!==null){const r=nt(e);r!==null&&r.getWritable()}if(n!==null){const r=nt(n);r!==null&&r.getWritable()}}}function ge(){return _n()?null:G()._compositionKey}function nt(n,t){const e=(t||ue())._nodeMap.get(n);return e===void 0?null:e}function ud(n,t){const e=gr(n,G());return e!==void 0?nt(e,t):null}function fd(n,t,e){n[`__lexicalKey_${t._key}`]=e}function gr(n,t){return n[`__lexicalKey_${t._key}`]}function yn(n,t){let e=n;for(;e!=null;){const r=ud(e,t);if(r!==null)return r;e=$n(e)}return null}function dd(n){const t=n._decorators,e=Object.assign({},t);return n._pendingDecorators=e,e}function na(n){return n.read(()=>Y().getTextContent())}function Y(){return ue()._nodeMap.get("root")}function fi(n,t){if(!(Z(n)&&n.isAttached()&&n.isEmpty()&&(ut(n)||t!==null&&Dt(t))))return null;const e=tt();return n.append(e),e}function St(n){xt();const t=ue();n!==null&&(n.dirty=!0,n.setCachedNodes(null),O(n)&&G()._slotsUsed&&Uf(n)),t._selection=n}function ra(){xt(),Ku(G())}function Rn(n){const t=(function(e,r){let o=e;for(;o!=null;){const i=gr(o,r);if(i!==void 0)return i;o=$n(o)}return null})(n,G());return t===null?null:nt(t)}function hd(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function $l(n){const t=[];for(let e=n;e!==null;e=e._parentEditor)t.push(e);return t}function gd(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function pd(n){return ve(n)?n.nodeValue:null}function Ml(n,t,e){const r=Lt(Kt(t));if(r===null)return;const o=Bt(r,t._rootElement),i=o.anchorNode;let{anchorOffset:s,focusOffset:l}=o;if(i!==null){let c=pd(i);const a=yn(i);if(c!==null&&M(a)){if((c===Br||c===ol)&&e){const u=e.length;c=e,s=u,l=u}c!==null&&Fl(a,c,s,l,n)}}}function Fl(n,t,e,r,o){let i=n;if(i.isAttached()&&(o||!i.isDirty())){const s=i.isComposing();if(i.isToken()&&s)return;let l=t;if((s||o)&&(t.endsWith(Br)&&(l=t.slice(0,-Br.length)),o)){const a=ol;let u;for(;(u=l.indexOf(a))!==-1;)l=l.slice(0,u)+l.slice(u+a.length),e!==null&&e>u&&(e=Math.max(u,e-a.length)),r!==null&&r>u&&(r=Math.max(u,r-a.length))}const c=i.getTextContent();if(o||l!==c){const a=A();if(l===""){if(bt(null),oo||$e||io)i.remove();else{const _=G();os(i,"",a),setTimeout(()=>{_.update(()=>{i.isAttached()&&i.getTextContent()===""&&i.remove()})},20)}return}const u=i.getParent(),f=wn(),d=i.getTextContentSize(),h=ge(),g=i.getKey();if(i.isToken()&&!s||h!==null&&g===h&&!s||O(f)&&(u!==null&&!u.canInsertTextBefore()&&f.anchor.offset===0||f.anchor.key===n.__key&&f.anchor.offset===0&&!i.canInsertTextBefore()&&!s||f.focus.key===n.__key&&f.focus.offset===d&&!i.canInsertTextAfter()&&!s))return void i.markDirty();if(!O(a)||e===null||r===null)return void os(i,l,a);if(a.setTextNodeRange(i,e,i,r),i.isSegmented()){const _=mt(i.getTextContent());i.replace(_),i=_}os(i,l,a)}}}function os(n,t,e){if(n.setTextContent(t),O(e)){const r=n.getKey();let o=!1;for(const i of["anchor","focus"]){const s=e[i];s.type==="text"&&s.key===r&&(s.offset=_e(n,s.offset,"clamp"),o=!0)}o&&(e._cachedNodes=null,e._cachedIsBackward=null)}}function oa(n){let t=n;for(;t!==null;){const e=t.getParent();if(e===null)return null;if(ut(e))return t;t=e}return null}function xo(n,t){const{anchor:e,focus:r}=n,o=e.key,i=e.offset,s=e.type,l=r.key,c=r.offset,a=r.type;if(dl(n),!ut(t))return n;const u=oa(e.getNode());return b(u)&&u.isShadowRoot()&&u.is(oa(r.getNode()))&&(e.set(o,i,s),r.set(l,c,a)),n}function Zp(n){const t=Y();if(O(n)){const e=n.anchor,r=n.focus,o=e.getNode();if(ut(o))return e.set(o.getKey(),0,"element"),r.set(o.getKey(),o.getChildrenSize(),"element"),xo(n,o),n;const i=o.getTopLevelElementOrThrow(),s=i.getParent();return s===null?(b(i)&&(e.set(i.getKey(),0,"element"),r.set(i.getKey(),i.getChildrenSize(),"element"),xo(n,i)),n):(e.set(s.getKey(),0,"element"),r.set(s.getKey(),s.getChildrenSize(),"element"),xo(n,s),n)}{const e=t.select(0,t.getChildrenSize());return St(xo(e,t)),e}}function Xr(n,t){n.getAttribute(t)===""&&n.removeAttribute(t)}function Hn(n,t){n.__lexicalClassNameCache===void 0&&(n.__lexicalClassNameCache={});const e=n.__lexicalClassNameCache,r=e[t];if(r!==void 0)return r;const o=n[t];if(typeof o=="string"){const i=me(o);return e[t]=i,i}return o}function Al(n,t,e,r,o){if(e.size===0)return;const i=r.__type,s=r.__key,l=t.get(i);l===void 0&&w(33,i);const c=l.klass;let a=n.get(c);a===void 0&&(a=new Map,n.set(c,a));const u=a.get(s),f=u==="destroyed"&&o==="created";(u===void 0||f)&&a.set(s,f?"updated":o)}function ia(n,t,e){const r=n.getParent();let o=e,i=n;return r!==null&&(e===0&&(o=i.getIndexWithinParent(),i=r)),i.getChildAtIndex(o-1)}function t_(n,t){const e=n.offset;if(n.type==="element")return ia(n.getNode(),t,e);{const r=n.getNode();if(e===0||!t){const o=r.getPreviousSibling();return o===null?ia(r.getParentOrThrow(),t,r.getIndexWithinParent()+0):o}}return null}function _d(n){const t=Kt(n).event,e=t&&t.inputType;return e==="insertFromPaste"||e==="insertFromPasteAsQuotation"}function R(n,t,...e){return Qf(n,t,e[0],n)}function rr(n,t){const e=n._keyToDOMMap.get(t);return e===void 0&&w(75,t),e}function $n(n){const t=n.assignedSlot||n.parentElement;if(t!==null)return t;const e=n.parentNode;return Me(e)?e.host:null}function Dl(n){return On(n)?n:q(n)?n.ownerDocument:null}function xn(n){xt(),G()._updateTags.add(n)}function e_(n){xt(),G()._deferred.push(n)}function or(n,t){let e=n.getParent();for(;e!==null;){if(e.is(t))return!0;e=e.getParent()}return!1}function Pl(n){const t=Dl(n);return t?t.defaultView:null}function Kt(n){const t=n._window;return t===null&&w(78),t}function n_(n){return b(n)&&n.isInline()||J(n)&&n.isInline()}function md(n){let t=n.getLatest();for(;t!==null;){if(Ot(t)!==null&&b(t))return t;const e=t.getParentOrThrow();if(Z(e))return e;t=e}return t}function Dr(n){return b(n)&&n.isShadowRoot()}function Z(n){return ut(n)||Dr(n)}function Ft(n,t=!1){const e=n.constructor.clone(n,El);return ad(e,null),e.afterCloneFrom(n),t||e.resetOnCopyNodeFrom(n),e}function fe(n){const t=G(),e=n.getType(),r=wl(t,e);r===void 0&&w(200,n.constructor.name,e);const{replace:o,replaceWithKlass:i}=r;if(o!==null){const s=o(n),l=s.constructor;return i!==null?s instanceof i||w(201,i.name,i.getType(),l.name,l.getType(),n.constructor.name,e):s instanceof n.constructor&&l!==n.constructor||w(202,l.name,l.getType(),n.constructor.name,e),s.__key===n.__key&&w(203,n.constructor.name,e,l.name,l.getType()),s}return n}function is(n,t){!ut(n.getParent())||b(t)||J(t)||w(99)}function r_(n){const t=nt(n);return t===null&&w(63,n),t}function Qr(n){if(!n||n.isInline())return!1;if(J(n))return!0;if(b(n)){if(n.isShadowRoot()){const t=n.getParent();return!(b(t)&&t.isShadowRoot())}return!n.canBeEmpty()}return!1}function di(n,t,e){e.style.removeProperty("caret-color"),t._blockCursorElement=null;const r=n.parentElement;r!==null&&r.removeChild(n)}function Lt(n){return ee?(n||window).getSelection():null}function o_(n){const t=Pl(n);return t?t.getSelection():null}function Me(n){return zs(n)&&"host"in n}const i_=[];function yd(n){const t=n.getRootNode();if(t===n||!Me(t))return i_;const e=[t];let r=t.host;for(;;){const o=r.getRootNode();if(o===r||!Me(o))break;e.push(o),r=o.host}return e}function*xd(n){const t=[n];let e;for(;e=t.pop();){yield*e.querySelectorAll('[data-lexical-editor="true"]');const r=(On(e)?e:e.ownerDocument).createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let o;for(;o=r.nextNode();)o.shadowRoot&&t.push(o.shadowRoot)}}function vd(n){return n!==null?n.ownerDocument:document}function ot(){const n=Yf();return vd(n!==null?n._rootElement:null)}function Pi(n,t){if(t===null||typeof n.getComposedRanges!="function")return null;const e=yd(t);if(e.length===0)return null;const r=n.getComposedRanges;try{const o=r.call(n,{shadowRoots:e})[0];if(o!==void 0)return o}catch{}try{const o=r.apply(n,e)[0];if(o!==void 0)return o}catch{}return null}function s_(n,t){const e=Pi(n,t);if(e!==null){const r=l_(e);if(r!==null)return r}return n.rangeCount>0?n.getRangeAt(0):null}function Bt(n,t){const e=Pi(n,t);return e===null?n:c_(e,a_(n))}function l_(n){const t=n.startContainer.ownerDocument;if(t===null)return null;const e=t.createRange();try{return e.setStart(n.startContainer,n.startOffset),e.setEnd(n.endContainer,n.endOffset),e}catch{return null}}function c_(n,t){const{startContainer:e,startOffset:r,endContainer:o,endOffset:i}=n;return t==="backward"?{anchorNode:o,anchorOffset:i,direction:t,focusNode:e,focusOffset:r}:{anchorNode:e,anchorOffset:r,direction:t,focusNode:o,focusOffset:i}}function a_(n){return n.direction}function hi(n){const t=n.getRootNode();return On(t)||Me(t)?t.activeElement:null}function ir(n){let t=n.activeElement;for(;t!==null&&t.shadowRoot!==null;){const e=t.shadowRoot.activeElement;if(e===null)break;t=e}return t}function Sd(n){const t=n.target;if(t!==null&&q(t)&&t.shadowRoot!==null&&typeof n.composedPath=="function"){const e=n.composedPath();if(e.length>0)return e[0]}return t}function Cd(n){return q(n)&&n.tagName==="A"}function q(n){return pr(n)&&n.nodeType===1}function pr(n){return typeof n=="object"&&n!==null&&"nodeType"in n&&typeof n.nodeType=="number"}function zs(n){return pr(n)&&n.nodeType===11}const u_=/^(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;function Bs(n){return!(!q(n)||!n.style.display.startsWith("inline"))||u_.test(n.nodeName)}const f_=/^(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;function Zr(n){return(!q(n)||!n.style.display.startsWith("inline"))&&f_.test(n.nodeName)}function Dt(n){if(J(n)&&!n.isInline())return!0;if(!b(n)||Z(n))return!1;const t=n.getFirstChild(),e=t===null||Nt(t)||M(t)||t.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&e}function gt(){return G()}function Ii(n=gt()){return n._config.dom||ci}function Ut(n,t,e=gt()){const r=Ii(e).$getDOMSlot(n,t,e);return b(n)&&(d_(r)||w(344,n.getKey(),n.getType())),r}function d_(n){return n instanceof Pu}function je(n,t,e=gt()){return Qp(Ut(n,t,e).element)}const sa=new WeakMap,h_=new Map;function la(n){if(!n._readOnly&&n.isEmpty())return h_;n._readOnly||w(192);let t=sa.get(n);return t||(t=(function(e){const r=new Map;for(const[o,i]of e._nodeMap){const s=i.__type;let l=r.get(s);l||(l=new Map,r.set(s,l)),l.set(o,i)}return r})(n),sa.set(n,t)),t}function bd(n){const t=n.constructor.clone(n,El);return t.afterCloneFrom(n),t}function g_(n){return(t=bd(n))[Ef]=!0,t;var t}function Il(n,t){const e=n.getAttribute("data-lexical-indent");if(e!==null){const i=parseInt(e,10);if(Number.isFinite(i)&&i>=0)return void t.setIndent(i)}const r=parseInt(n.style.paddingInlineStart,10)||0,o=Math.round(r/40);t.setIndent(o)}function ho(n,t){const e=t.getAttribute("dir");return e==="ltr"||e==="rtl"?n.setDirection(e):n}function Li(n,t){const e=t.style.textAlign;return e&&e in Qn?n.setFormat(e):n}function p_(n,t){n.__lexicalUnmanaged=!0,t&&t.captureSelection!==void 0&&(n.__lexicalCapturedSelection=t.captureSelection)}function Td(n){return n.__lexicalUnmanaged===!0}function __(n,t=gt()){const e=t.isEditable();n.contentEditable=e?"true":"false",e?n.__lexicalEditor=t:delete n.__lexicalEditor}function gi(n,t){let e=n;for(;e!=null;){if(e.__lexicalCapturedSelection===!0)return!0;if(q(e)&&e.hasAttribute("data-lexical-slot")||gr(e,t)!==void 0)return!1;e=$n(e)}return!1}function Tr(n,t){return Ke(n,t)&&n[t]!==Tt[t]}const ss=new WeakMap;function sr(n){const t=ss.get(n);return t!==void 0?t:(function(e){const r=e.prototype!=null&&Ui in e.prototype?e.prototype[Ui]():void 0,o=(function(u){if(!(u===Tt||u.prototype instanceof Tt)){let f="<unknown>",d="<unknown>";try{f=u.getType()}catch{}try{nr.version&&(d=JSON.parse(nr.version))}catch{}w(290,u.name,f,d)}return u===Zf||u===yt||u===Tt})(e),i=!o&&Tr(e,"getType")?e.getType:void 0,s=i&&!(ca in i)?i.call(e):void 0;let l,c=s;if(r)if(s)l=r[s];else{for(const[u,f]of Object.entries(r))c=u,l=f;if(!l)for(const u of Object.getOwnPropertySymbols(r)){const f=r[u];if(f){l=f;break}}}const a={compiled:void 0,composed:void 0,config:{declaresOwnConfig:Ke(e.prototype,Ui),klass:e,ownNodeConfig:l,ownNodeType:c},ownFieldsValidated:!1};ss.set(e,a);try{const u=(function(g){const _=g.prototype,m=new Map,{fieldsBaseFirst:p}=Pr(g);for(const[y,x]of p){const v=S_(g,y,x);if(v===null)continue;if(Je(v)){const C=v.field;if(C==="__proto__"&&w(430,g.name,y),v.setterTable!==void 0){const{setterTable:N}=v,{meta:T}=x;for(const E of T.kind==="enum"?T.values:[x.defaultValue])Ke(N,String(E))||w(431,g.name,y,JSON.stringify(E))}m.set(y,{field:C,key:y,kind:"ownField",schema:x,setterTable:v.setterTable});continue}const S=_[v];typeof S!="function"&&w(432,g.name,y,v),m.set(y,{key:y,kind:"field",schema:x,setter:S})}return m.size===0?m_:[...m.values()]})(e),f=(function(g){const _=g.prototype,m=new Map;for(const[p,y]of Pr(g).fieldsDerivedFirst){const x=v_(g,p,y);if(x===null)continue;if(Je(x)){const S=x.field;S==="__proto__"&&w(426,g.name,p);const C=x.when;let N;if(C!==void 0){const T=_[C];typeof T!="function"&&w(427,g.name,p,C),N=T}m.set(p,{defaultValue:y.defaultValue,derived:y.setter===null,field:S,getterTable:x.getterTable,isEqual:y.isEqual,key:p,kind:"ownField",schema:y,when:N});continue}const v=_[x];typeof v!="function"&&w(428,g.name,p,x),m.set(p,{defaultValue:y.defaultValue,derived:y.setter===null,getter:v,isEqual:y.isEqual,key:p,kind:"method",schema:y})}return m.size===0?x_:[...m.values()]})(e),d=Pr(e),h=(function(g,_,m){let p,y=g;for(const{klass:x,ownNodeConfig:v}of vn(g))v&&v.generated!==void 0&&(p===void 0?(p=v.generated,y=x):v.generated===p&&(y=x));return p===void 0?null:y===g||(function(x,v){if(x.getters.length!==v.getters.length||x.setters.length!==v.setters.length)return!1;for(let S=0;S<x.getters.length;S++){const C=x.getters[S],N=v.getters[S];if(C.kind!==N.kind||C.key!==N.key||C.schema!==N.schema||C.derived!==N.derived||C.isEqual!==N.isEqual||!Object.is(C.defaultValue,N.defaultValue)||C.kind==="ownField"&&N.kind==="ownField"&&(C.field!==N.field||C.getterTable===void 0!=(N.getterTable===void 0)))return!1}for(let S=0;S<x.setters.length;S++){const C=x.setters[S],N=v.setters[S];if(C.kind!==N.kind||C.key!==N.key||C.schema!==N.schema||C.kind==="ownField"&&N.kind==="ownField"&&(C.field!==N.field||C.setterTable===void 0!=(N.setterTable===void 0)))return!1}return!0})(m,pi(sr(y)))?p:null})(e,0,{getters:f,setters:u});a.compiled={flatStates:d.flatStates,generated:h===null?null:h(d.fields),getters:f,isCompactDefault:C_(f),setters:u},(function(g,_,m,p){if(!_&&m){if(!Tr(g,"getType")){const y=g,x=function(){return this!==y?Tt.getType.call(this):m};x[ca]=!0,g.getType=x}if(Tr(g,"clone")||(g.clone=(y,x)=>{Nl(y);const v=new g;return x!==El&&v.afterCloneFrom(y),v}),Tr(g,"importJSON")||(g.importJSON=p&&p.$importJSON||(function(y){return x=>{const v=Ed(y);return v.updateFromJSON===Tt.prototype.updateFromJSON?(function(S,C){const N=S.__state||C[sl]!==void 0?Xu(S,C):S;return Nd(N,C)})(v,x):v.updateFromJSON(x)}})(g)),!Tr(g,"importDOM")&&p){const{importDOM:y}=p;y&&(g.importDOM=()=>y)}}})(e,o,c,l),(function(g){for(const{klass:_,ownNodeConfig:m}of vn(g)){const p=_.prototype;if(Ke(p,"afterCloneFrom"))continue;const y=N_(_);if(y.length===0)continue;const x=Object.getPrototypeOf(p),v=m&&m.generated!==void 0?pi(sr(_)).generated:null,S=v!==null&&v.afterCloneFrom||((C,N)=>{const T=C,E=N;for(let $=0;$<y.length;$++){const F=y[$];T[F]=E[F]}});p.afterCloneFrom=function(C){x.afterCloneFrom.call(this,C),S(this,C)},p.afterCloneFrom[k_]=!0}})(e)}catch(u){throw ss.delete(e),u}return a})(n)}function pi(n){const{compiled:t}=n;return t===void 0&&w(422,n.config.klass.name),t}const ca=Symbol("lexical.synthesizedGetType"),m_=[];function kd(n,t,e,r){const o=e.method===void 0?r:e.method,i=Pr(n).declaredBy.get(t);if(i===void 0)return e;const s=n.prototype,l=i.prototype;return aa(s,l,o)&&aa(s,l,r)?e:o}function aa(n,t,e){return n[e]===t[e]}function ua(n){return`set${n.charAt(0).toUpperCase()}${n.slice(1)}`}function fa(n){return`get${n.charAt(0).toUpperCase()}${n.slice(1)}`}const y_={declaredBy:new Map,fields:new Map,fieldsBaseFirst:[],fieldsDerivedFirst:[],flatStates:[]};function Pr(n){const t=sr(n);return t.composed===void 0&&(t.composed=(function(e){const r=[],o=[],i=[];for(const{klass:u,ownNodeConfig:f}of vn(e)){const d=f&&f.json;o.push(u),r.push(d&&d.meta.kind==="node"?Object.entries(d.meta.fields):[]);const h=[];if(f&&f.stateConfigs)for(const g of f.stateConfigs)"stateConfig"in g&&g.flat&&h.push(g.stateConfig);i.push(h)}const s=new Map;for(let u=0;u<r.length;u++)for(const[f,d]of r[u])s.has(f)||s.set(f,d);const l=new Map,c=new Map,a=new Map;for(let u=r.length-1;u>=0;u--){for(const[f,d]of r[u]){const h=s.get(f);h===void 0||l.has(f)||l.set(f,h),h===void 0||d!==h||c.has(f)||c.set(f,o[u])}for(const f of i[u])a.has(f.key)||a.set(f.key,f)}return s.size===0&&a.size===0?y_:{declaredBy:c,fields:l,fieldsBaseFirst:[...l],fieldsDerivedFirst:[...s],flatStates:[...a.values()]}})(n)),t.composed}const x_=[];function v_(n,t,e){const r=e.getter;if(r===null)return null;const o=r===void 0?fa(t):r;return Je(o)?kd(n,t,o,fa(t)):o}function S_(n,t,e){const r=e.setter;if(r===null)return null;const o=r===void 0?ua(t):r;return Je(o)?kd(n,t,o,ua(t)):o}function Ks(n,t){const{defaultValue:e,isEqual:r}=n;return t===void 0||t===e||r!==void 0&&r(t,e)}function C_(n){let t;return(e,r)=>{t===void 0&&(t=new Map(n.map(i=>[i.key,i])));const o=t.get(e);return o!==void 0&&Ks(o,r)}}function b_(n){const{setterTable:t,schema:e}=n,{defaultValue:r}=e;return t===void 0?r:t[String(r)]}function Nd(n,t){const e=sr(n.constructor),{flatStates:r,generated:o,setters:i}=pi(e),s=(function(l,c,a){let u=l;for(let f=0;f<a.length;f++){const d=a[f],h=c[d.key];if(h!==void 0){const g=d.parse(h);u=fr(u,d,()=>g)}}return u})(n,t,r);return o!==null&&o.updateFromJSON!==void 0?o.updateFromJSON(s,t):(function(l,c,a){for(let u=0;u<a.length;u++){const f=a[u],d=f.schema(c[f.key]);f.kind==="ownField"?l[f.field]=f.setterTable===void 0?d:Ke(f.setterTable,d)?f.setterTable[d]:b_(f):f.setter.call(l,d)}return l})(s,t,i)}function Ll(n){return sr(n).config}function T_(n){const t=[];for(const e of[n.getter,n.setter])Je(e)&&e.field!=="__proto__"&&!t.includes(e.field)&&t.push(e.field);return t}const k_="__lexicalSynthesizedAfterCloneFrom";function da(n){const{declaredBy:t,fieldsBaseFirst:e}=Pr(n),r=[];for(const[o,i]of e)if(t.get(o)===n)for(const s of T_(i))r.includes(s)||r.push(s);return r}function N_(n){const t=da(n);if(t.length===0)return t;const e=new Set;for(const{klass:r}of vn(n))if(r!==n)for(const o of da(r))e.add(o);return e.size===0?t:t.filter(r=>!e.has(r))}function*vn(n){for(let t=n;t&&(t===Tt||wf(t.prototype));){const e=Ll(t),r=e.declaresOwnConfig;yield r?e:{...e,ownNodeConfig:void 0},t=r&&e.ownNodeConfig&&e.ownNodeConfig.extends||wd(t)}}function Ed(n){const t=gt();xt();const e=t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(n)),r=new e.klass;return e.replace===null?r:fe(r)}const vt=(n,t)=>{let e=n;for(;e!=null&&!ut(e);){if(t(e))return e;e=e.getParent()}return null};function _i(n,t){const e=[];let r=n.__first;for(;r!==null;){const o=t===null?nt(r):t.get(r);o==null&&w(174),e.push(r),r=o.__next}return e}function wd(n){const t=Object.getPrototypeOf(n);if(typeof t=="function"&&t!==Function.prototype)return t;const e=n.prototype&&Object.getPrototypeOf(n.prototype);return e?e.constructor:null}const Od=new Map;function un(n){return b(n)||J(n)}function Sn(n){return b(n)||J(n)}function Ot(n){const t=n.getLatest();return Sn(t)?t.__slotHost:null}function At(n){const t=Ot(n);if(t===null)return null;const e=nt(t);return b(e)||J(e)||w(370),e}function E_(n){const t=At(n);if(t===null)return null;const e=n.getLatest().__key;for(const[r,o]of Ri(t))if(o===e)return r;return null}function to(n){let t=n.getLatest();for(;t!==null;){if(Ot(t)!==null)return t;t=t.getParent()}return null}function $d(n){if(n===null)return null;const t=O(n)?n.anchor.getNode():n.getNodes()[0]??null;return t===null?null:to(t)}function Ri(n){const t=n.getLatest();return un(t)&&t.__slots!==null?t.__slots:Od}function pe(n){return Array.from(Ri(n).keys())}function lr(n,t){const e=Ri(n).get(t);return e===void 0?null:nt(e)}const w_=["__proto__","constructor","prototype"],ha=Symbol("slotMapOwner");function ga(n){let t=n.__slots;return t!==null&&t[ha]===n||(t=new Map(t),t[ha]=n,n.__slots=t),t}const pa=new WeakMap,O_=[];function $_(n){for(const{ownNodeConfig:t}of vn(n)){const e=t&&t.slots;if(e)return e}return O_}function Md(n){let t="";for(const e of pe(n)){const r=lr(n,e);r!==null&&(t+=r.getTextContent())}return t}function _a(n,t,e){const r=e.get(n),o=e.get(t);return r!==void 0?o!==void 0?r-o:-1:o!==void 0?1:n<t?-1:n>t?1:0}function M_(n){const t=n.__slots;if(t===null||t.size<2)return;const e=(function(s){let l=pa.get(s);if(l===void 0){const c=$_(s),a=new Map;for(const u of c)w_.includes(u)&&w(371,s.name,u),a.has(u)&&w(372,s.name,u),a.set(u,a.size);l=a,pa.set(s,l)}return l})(n.constructor);let r=null,o=!0;for(const s of t.keys()){if(r!==null&&_a(r,s,e)>0){o=!1;break}r=s}if(o)return;const i=Array.from(t).sort(([s],[l])=>_a(s,l,e));t.clear();for(const[s,l]of i)t.set(s,l)}function F_(n,t,e){t!=="__proto__"&&t!=="constructor"&&t!=="prototype"||w(373,t);const r=n.getLatest();if(r.__slots!==null&&r.__slots.get(t)===e.getLatest().__key)return r;(!b(e)&&!J(e)||e.isInline())&&w(374,e.__key);const o=n.getWritable(),i=ga(o),s=i.get(t);s!==void 0&&A_(s);const l=e.getWritable(),c=At(l);if(c!==null){const a=E_(l);a!==null&&ga(c.getWritable()).delete(a),l.__slotHost=null}return Ee(l),l.__slotHost=o.__key,i.set(t,l.__key),M_(o),G()._slotsUsed=!0,ue()._slotsUsed=!0,o}function A_(n){const t=nt(n);if(t===null)return;const e=t.getWritable();Sn(e)||w(377,n),e.__slotHost=null,e.remove()}const D_={next:"previous",previous:"next"};class Rl{constructor(t){k(this,"origin");this.origin=t}[Symbol.iterator](){return Fd({hasNext:Ge,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return X(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return X(this.origin,this.direction)}remove(){const t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,e){const r=this.getNodeAtCaret();return t.is(this.origin)||t.is(r)||(r===null?this.insert(t):r.replace(t,e)),this}splice(t,e,r="next"){const o=r===this.direction?e:Array.from(e).reverse();let i=this;const s=this.getParentAtCaret(),l=new Map;for(let c=i.getAdjacentCaret();c!==null&&l.size<t;c=c.getAdjacentCaret()){const a=c.origin.getWritable();l.set(a.getKey(),a)}for(const c of o){if(l.size>0){const a=i.getNodeAtCaret();if(a){if(l.delete(a.getKey()),l.delete(c.getKey()),!(a.is(c)||i.origin.is(c))){const u=c.getParent();u&&u.is(s)&&c.remove(),a.replace(c)}}else a===null&&w(263,Array.from(l).join(" "))}else i.insert(c);i=X(c,this.direction)}for(const c of l.values())c.remove();return this}}class eo extends Rl{constructor(){super(...arguments);k(this,"type","child")}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:It(e,this.direction)}getParentCaret(e="root"){return X(zl(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Ze(this.direction);return X(this.getNodeAtCaret(),e)||It(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof eo&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}}const P_={root:ut,shadowRoot:Z};function Ze(n){return D_[n]}function zl(n,t="root"){return n===null||P_[t](n)?null:Ot(n)===null?n:null}class Cn extends Rl{constructor(){super(...arguments);k(this,"type","sibling")}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:X(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return b(this.origin)?It(this.origin,this.direction):null}getParentCaret(e="root"){return X(zl(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Ze(this.direction);return X(this.getNodeAtCaret(),e)||It(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof Cn&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof Cn||e instanceof bn)&&this.direction===e.direction&&this.origin.is(e.origin)}}class bn extends Rl{constructor(e,r){super(e);k(this,"type","text");k(this,"offset");this.offset=r}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Ye(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return X(zl(this.getParentAtCaret(),e),this.direction)}getFlipped(){return Ye(this.origin,Ze(this.direction),this.offset)}isSamePointCaret(e){return e instanceof bn&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof Cn||e instanceof bn)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return X(this.origin,this.direction)}}function Xt(n){return n instanceof bn}function Ge(n){return n instanceof Cn}function Qt(n){return n instanceof eo}const I_={next:class extends bn{constructor(){super(...arguments);k(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends bn{constructor(){super(...arguments);k(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},L_={next:class extends Cn{constructor(){super(...arguments);k(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends Cn{constructor(){super(...arguments);k(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},R_={next:class extends eo{constructor(){super(...arguments);k(this,"direction","next")}getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends eo{constructor(){super(...arguments);k(this,"direction","previous")}getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function X(n,t){return n?new L_[t](n):null}function Ye(n,t,e){return n?new I_[t](n,_e(n,e)):null}function _e(n,t,e="error"){const r=n.getTextContentSize();let o=t==="next"?r:t==="previous"?0:t;return(o<0||o>r)&&(e!=="clamp"&&Nu(284,String(t),String(r),n.getKey()),o=o<0?0:r),o}function ma(n,t){return new B_(n,t)}function It(n,t){return b(n)?new R_[t](n):null}function z_(n){return n&&n.getChildCaret()||n}function Bl(n){return n&&z_(n.getAdjacentCaret())}class Kl{constructor(t,e,r){k(this,"type","node-caret-range");k(this,"direction");k(this,"anchor");k(this,"focus");this.anchor=t,this.focus=e,this.direction=r}getLatest(){const t=this.anchor.getLatest(),e=this.focus.getLatest();return t===this.anchor&&e===this.focus?this:new Kl(t,e,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const t=o=>{const i=this[o].getLatest();return Xt(i)?(function(s,l){const{direction:c,origin:a}=s,u=_e(a,l==="focus"?Ze(c):c);return ma(s,u-s.offset)})(i,o):null},e=t("anchor"),r=t("focus");if(e&&r){const{caret:o}=e,{caret:i}=r;if(o.isSameNodeCaret(i))return[ma(o,i.offset-o.offset),null]}return[e,r]}iterNodeCarets(t="root"){const e=Xt(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),r=this.focus.getLatest(),o=Xt(r),i=s=>s.isSameNodeCaret(r)?null:Bl(s)||s.getParentCaret(t);return Fd({hasNext:s=>s!==null&&!(o&&r.isSameNodeCaret(s)),initial:e.isSameNodeCaret(r)?null:i(e),map:s=>s,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class B_{constructor(t,e){k(this,"type","slice");k(this,"caret");k(this,"distance");this.caret=t,this.distance=e}getSliceIndices(){const{distance:t,caret:{offset:e}}=this,r=e+t;return r<e?[r,e]:[e,r]}getTextContent(){const[t,e]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,e)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:t,direction:e}}=this,[r,o]=this.getSliceIndices(),i=t.getTextContent();return Ye(t.setTextContent(i.slice(0,r)+i.slice(o)),e,r)}}function le(n,t){return n.direction===t?n:n.getFlipped()}function zi(n){return Zt(n,le(It(Y(),Ze(n.direction)),n.direction))}function Bi(n){return Zt(n,n)}function Zt(n,t){return n.direction!==t.direction&&w(265),new Kl(n,t,n.direction)}function Fd(n){const{initial:t,hasNext:e,step:r,map:o}=n;let i=t;return{[Symbol.iterator](){return this},next(){if(!e(i))return{done:!0,value:void 0};const s={done:!1,value:o(i)};return i=r(i),s}}}function Xe(n,t){const e=Ws(n.origin,t.origin);switch(e===null&&w(275,n.origin.getKey(),t.origin.getKey()),e.type){case"same":{const r=n.type==="text",o=t.type==="text";return r&&o?(function(i,s){return Math.sign(i-s)})(n.offset,t.offset):n.type===t.type?0:r?-1:o?1:n.type==="child"?-1:1}case"ancestor":return n.type==="child"?-1:1;case"descendant":return t.type==="child"?1:-1;case"branch":return Ad(e)}}function Ad(n){const{a:t,b:e}=n,r=t.__key,o=e.__key;let i=t,s=e;for(;i&&s;i=i.getNextSibling(),s=s.getNextSibling()){if(i.__key===o)return-1;if(s.__key===r)return 1}return i===null?1:-1}function vo(n,t){return t.is(n)}function ya(n){return b(n)?[n.getLatest(),null]:[n.getParent(),n.getLatest()]}function Ws(n,t){if(n.is(t))return{commonAncestor:n,type:"same"};const e=new Map;for(let[r,o]=ya(n);r;o=r,r=r.getParent())e.set(r,o);for(let[r,o]=ya(t);r;o=r,r=r.getParent()){const i=e.get(r);if(i!==void 0)return i===null?(vo(n,r)||w(276),{commonAncestor:r,type:"ancestor"}):o===null?(vo(t,r)||w(277),{commonAncestor:r,type:"descendant"}):((b(i)||vo(n,i))&&(b(o)||vo(t,o))&&r.is(i.getParent())&&r.is(o.getParent())||w(278),{a:i,b:o,commonAncestor:r,type:"branch"})}return null}function K_(n,t){if(!t||n===t)return n;for(const e in t)if(n[e]!==t[e])return{...n,...t};return n}function me(...n){const t=[];for(const e of n)if(e&&typeof e=="string")for(const[r]of e.matchAll(/\S+/g))t.push(r);return t}function Fe(n,...t){const e=me(...t);e.length>0&&n.classList.add(...e)}function Wl(n,...t){const e=me(...t);e.length>0&&n.classList.remove(...e)}function jt(...n){return()=>{for(let t=n.length-1;t>=0;t--)n[t]();n.length=0}}function Dd(n){const t=gt().getElementByKey(n.getKey());if(t===null)return null;const e=t.ownerDocument.defaultView;return e===null?null:e.getComputedStyle(t)}function Pd(n){const t=ut(n)?n:n.getParent();return t&&Dd(t)}function So(n){const t=Pd(n);return t!==null&&t.direction==="rtl"}function Id(n,t,e="self"){const r=n.getStartEndPoints();if(t.isSelected(n)&&!Yt(t)&&r!==null){const[o,i]=r,s=n.isBackward(),l=o.getNode(),c=i.getNode(),a=t.is(l),u=t.is(c);if(a||u){const[f,d]=As(n),h=l.is(c),g=t.is(s?c:l),_=t.is(s?l:c);let m,p=0;h?(p=f>d?d:f,m=f>d?f:d):g?(p=s?d:f,m=void 0):_&&(p=0,m=s?f:d);const y=t.__text.slice(p,m);y!==t.__text&&(e==="clone"&&(t=g_(t)),t.__text=y)}}return t}function Ld(n){const t=Rd(n);return t!==null&&t.writingMode==="vertical-rl"}function Rd(n){const t=n.anchor.getNode();return b(t)?Dd(t):Pd(t)}function xa(n,t){let e=Ld(n)?!t:t;zd(n)&&(e=!e);const r=Wt(n.focus,e?"previous":"next");if(ed(r))return!1;if(Xt(r)&&!pn(r.origin)&&r.origin.isUnmergeable()){const o=r.getNodeAtCaret();if(M(o)&&!pn(o))return!0}for(const o of zi(r)){if(Qt(o))return!o.origin.isInline();if(!b(o.origin)){if(J(o.origin))return!0;break}}return!1}function W_(n,t,e,r){n.modify(t?"extend":"move",e,r)}function zd(n){const t=Rd(n);return t!==null&&t.direction==="rtl"}function va(n,t,e){const r=zd(n);let o;o=Ld(n)||r?!e:e,W_(n,t,o,"character")}function U_(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function j_(n,t){let e=n;for(;e!=null;){if(e instanceof t)return e;e=e.getParent()}return null}function J_(n){const t=vt(n,e=>b(e)&&!e.isInline());return b(t)||U_(4,n.__key),t}function ze(n,t){if(n==null)return!1;const e=Object.getPrototypeOf(n);return e!=null&&e.constructor!=null&&e.constructor.name===t.name}function Co(n){let t=null;if(ze(n,DragEvent)?t=n.dataTransfer:ze(n,ClipboardEvent)&&(t=n.clipboardData),t===null)return[!1,[],!1];const e=t.types,r=e.includes("Files"),o=e.includes("text/html")||e.includes("text/plain");return[r,Array.from(t.files),o]}function Sa(n){const t=A();if(!O(t))return!1;const e=new Set,r=t.getNodes();for(let o=0;o<r.length;o++){const i=r[o],s=i.getKey();if(e.has(s))continue;const l=vt(i,a=>b(a)&&!a.isInline());if(l===null)continue;const c=l.getKey();l.canIndent()&&!e.has(c)&&(e.add(c),n(l))}return e.size>0}var H_=Symbol.for("preact-signals");function Ul(){if(fn>1)fn--;else{var n,t=!1;for((function(){var o=yi;for(yi=void 0;o!==void 0;){var i=o.S;if(i.v===o.v)for(var s=i.t;s!==void 0;s=s.x)s.i===o.i&&(s.i=i.i);o=o.o}})();Lr!==void 0;){var e=Lr;for(Lr=void 0,mi++;e!==void 0;){var r=e.u;if(e.u=void 0,e.f&=-3,!(8&e.f)&&Kd(e))try{e.c()}catch(o){t||(n=o,t=!0)}e=r}}if(mi=0,fn--,t)throw n}}var Ir,at=void 0;function Ki(n){var t=at,e=Ir;at=void 0,Ir=void 0;try{return n()}finally{at=t,Ir=e}}var Lr=void 0,fn=0,mi=0,Ca=0,yi=void 0,xi=0;function Bd(n){if(at!==void 0){var t=n.n;if(t===void 0||t.t!==at)return t={i:0,S:n,p:at.s,n:void 0,t:at,e:void 0,x:void 0,r:t},at.s!==void 0&&(at.s.n=t),at.s=t,n.n=t,32&at.f&&n.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=at.s,t.n=void 0,at.s.n=t,at.s=t),t}}function Rt(n,t){this.v=n,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t==null?void 0:t.watched,this.Z=t==null?void 0:t.unwatched,this.name=t==null?void 0:t.name}Rt.prototype.brand=H_;Rt.prototype.h=function(){return!0};Rt.prototype.S=function(n){var t=this,e=this.t;e!==n&&n.e===void 0&&(n.x=e,this.t=n,e!==void 0?e.e=n:Ki(function(){var r;(r=t.W)==null||r.call(t)}))};Rt.prototype.U=function(n){var t=this;if(this.t!==void 0){var e=n.e,r=n.x;e!==void 0&&(e.x=r,n.e=void 0),r!==void 0&&(r.e=e,n.x=void 0),n===this.t&&(this.t=r,r===void 0&&Ki(function(){var o;(o=t.Z)==null||o.call(t)}))}};Rt.prototype.subscribe=function(n){var t=this;return Jd(function(){var e=t.value;Ki(function(){return n(e)})},{name:"sub"})};Rt.prototype.valueOf=function(){return this.value};Rt.prototype.toString=function(){return this.value+""};Rt.prototype.toJSON=function(){return this.value};Rt.prototype.peek=function(){var n=this;return Ki(function(){return n.value})};Object.defineProperty(Rt.prototype,"value",{get:function(){var n=Bd(this);return n!==void 0&&(n.i=this.i),this.v},set:function(n){if(n!==this.v){if(mi>100)throw new Error("Cycle detected");(function(e){fn!==0&&mi===0&&e.l!==Ca&&(e.l=Ca,yi={S:e,v:e.v,i:e.i,o:yi})})(this),this.v=n,this.i++,xi++,fn++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Ul()}}}});function Us(n,t){return new Rt(n,t)}function Kd(n){for(var t=n.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Wd(n){for(var t=n.s;t!==void 0;t=t.n){var e=t.S.n;if(e!==void 0&&(t.r=e),t.S.n=t,t.i=-1,t.n===void 0){n.s=t;break}}}function Ud(n){for(var t=n.s,e=void 0;t!==void 0;){var 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 _r(n,t){Rt.call(this,void 0,t),this.x=n,this.s=void 0,this.g=xi-1,this.f=4}_r.prototype=new Rt;_r.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===xi))return!0;if(this.g=xi,this.f|=1,this.i>0&&!Kd(this))return this.f&=-2,!0;var n=at;try{Wd(this),at=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return at=n,Ud(this),this.f&=-2,!0};_r.prototype.S=function(n){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Rt.prototype.S.call(this,n)};_r.prototype.U=function(n){if(this.t!==void 0&&(Rt.prototype.U.call(this,n),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};_r.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var n=this.t;n!==void 0;n=n.x)n.t.N()}};Object.defineProperty(_r.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var n=Bd(this);if(this.h(),n!==void 0&&(n.i=this.i),16&this.f)throw this.v;return this.v}});function jd(n){var t=n.m;if(n.m=void 0,typeof t=="function"){fn++;var e=at;at=void 0;try{t()}catch(r){throw n.f&=-2,n.f|=8,jl(n),r}finally{at=e,Ul()}}}function jl(n){for(var t=n.s;t!==void 0;t=t.n)t.S.U(t);n.x=void 0,n.s=void 0,jd(n)}function V_(n){if(at!==this)throw new Error("Out-of-order effect");Ud(this),at=n,this.f&=-2,8&this.f&&jl(this),Ul()}function mr(n,t){this.x=n,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t==null?void 0:t.name,Ir&&Ir.push(this)}mr.prototype.c=function(){var n=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.m=t)}finally{n()}};mr.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,jd(this),Wd(this),fn++;var n=at;return at=this,V_.bind(this,n)};mr.prototype.N=function(){2&this.f||(this.f|=2,this.u=Lr,Lr=this)};mr.prototype.d=function(){this.f|=8,1&this.f||jl(this)};mr.prototype.dispose=function(){this.d()};function Jd(n,t){var e=new mr(n,t);try{e.c()}catch(o){throw e.d(),o}var r=e.d.bind(e);return r[Symbol.dispose]=r,r}function q_(n){return(typeof n.nodes=="function"?n.nodes():n.nodes)||[]}const ba={tag:Un};function G_(){const n=Y();n.isEmpty()&&n.append(tt())}const Y_={config:{setOptions:ba,updateOptions:ba},init:({$initialEditorState:n=G_})=>({$initialEditorState:n,initialized:!1}),afterRegistration(n,{updateOptions:t,setOptions:e},r){const o=r.getInitResult();if(!o.initialized){o.initialized=!0;const{$initialEditorState:i}=o;if(Rp(i))n.setEditorState(i,e);else if(typeof i=="function")n.update(()=>{i(n)},t);else if(i&&(typeof i=="string"||typeof i=="object")){const s=n.parseEditorState(i);n.setEditorState(s,e)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[Fi,se,Ai,$i,Di]};function rt(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function X_(){let n;try{n="0.51.0+prod.esm"}catch{}return n??'"<unknown>+source"'}const Q_=X_(),Z_=new Set(["__proto__","constructor","prototype"]);function Hd(n,t){if(n&&t&&!Array.isArray(t)&&typeof n=="object"&&typeof t=="object"){const e=n,r=t;for(const o in r)!Z_.has(o)&&Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=Hd(e[o],r[o]));return n}return t}const Jl=0,js=1,Vd=2,ls=3,bo=4,An=5,cs=6,kr=7;function as(n){return n.id===Jl}function qd(n){return n.id===Vd}function tm(n){return(function(t){return t.id===js})(n)||rt(305,String(n.id),String(js)),Object.assign(n,{id:Vd})}const em=new Set;let nm=class{constructor(t,e){k(this,"builder");k(this,"configs");k(this,"_dependency");k(this,"_peerNameSet");k(this,"extension");k(this,"state");k(this,"_signal");this.builder=t,this.extension=e,this.configs=new Set,this.state={id:Jl}}mergeConfigs(){let t=this.extension.config||{};const e=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):K_;for(const r of this.configs)t=e(t,r);return t}init(t){const e=this.state;qd(e)||rt(306,String(e.id));const r={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},o={...r,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=(function(l,c,a){return Object.assign(l,{config:c,id:ls,registerState:a})})(e,this.mergeConfigs(),r);let s;this.state=i,this.extension.init&&(s=this.extension.init(t,i.config,r)),this.state=(function(l,c,a){return Object.assign(l,{id:bo,initResult:c,registerState:a})})(i,s,o)}build(t){const e=this.state;let r;e.id!==bo&&rt(307,String(e.id),String(An)),this.extension.build&&(r=this.extension.build(t,e.config,e.registerState));const o={...e.registerState,getOutput:()=>r,getSignal:this.getSignal.bind(this)};this.state=(function(i,s,l){return Object.assign(i,{id:An,output:s,registerState:l})})(e,r,o)}register(t,e){this._signal=e;const r=this.state;r.id!==An&&rt(308,String(r.id),String(An));const o=this.extension.register&&this.extension.register(t,r.config,r.registerState);return this.state=(function(i){return Object.assign(i,{id:cs})})(r),()=>{const i=this.state;i.id!==kr&&rt(309,String(r.id),String(kr)),this.state=(function(s){return Object.assign(s,{id:An})})(i),o&&o()}}afterRegistration(t){const e=this.state;let r;return e.id!==cs&&rt(310,String(e.id),String(cs)),this.extension.afterRegistration&&(r=this.extension.afterRegistration(t,e.config,e.registerState)),this.state=(function(o){return Object.assign(o,{id:kr})})(e),r}getSignal(){return this._signal===void 0&&rt(311),this._signal}getInitResult(){this.extension.init===void 0&&rt(312,this.extension.name);const t=this.state;return(function(e){return e.id>=bo})(t)||rt(313,String(t.id),String(bo)),t.initResult}getInitPeer(t){const e=this.builder.extensionNameMap.get(t);return e?e.getExtensionInitDependency():void 0}getExtensionInitDependency(){const t=this.state;return(function(e){return e.id>=ls})(t)||rt(314,String(t.id),String(ls)),{config:t.config}}getPeer(t){const e=this.builder.extensionNameMap.get(t);return e?e.getExtensionDependency():void 0}getInitDependency(t){const e=this.builder.getExtensionRep(t);return e===void 0&&rt(315,this.extension.name,t.name),e.getExtensionInitDependency()}getDependency(t){const e=this.builder.getExtensionRep(t);return e===void 0&&rt(315,this.extension.name,t.name),e.getExtensionDependency()}getState(){const t=this.state;return(function(e){return e.id>=kr})(t)||rt(316,String(t.id),String(kr)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||em}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([e])=>e)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){const t=this.state;(function(e){return e.id>=An})(t)||rt(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}};const Ta=Symbol.for("@lexical/extension/LexicalBuilder");function ka(){}function rm(n){throw n}function To(n){return Array.isArray(n)?n:[n]}const us=Q_;class Vn{constructor(t){k(this,"roots");k(this,"extensionNameMap");k(this,"outgoingConfigEdges");k(this,"incomingEdges");k(this,"conflicts");k(this,"_sortedExtensionReps");k(this,"PACKAGE_VERSION");this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=us,this.roots=t;for(const e of t)this.addExtension(e)}static fromExtensions(t){const e=[To(Y_)];for(const r of t)e.push(To(r));return new Vn(e)}static maybeFromEditor(t){const e=t[Ta];return e&&(e.PACKAGE_VERSION!==us&&rt(292,e.PACKAGE_VERSION,us),e instanceof Vn||rt(293)),e}static fromEditor(t){const e=Vn.maybeFromEditor(t);return e===void 0&&rt(294),e}constructEditor(){const{$initialEditorState:t,onError:e,onWarn:r,...o}=this.buildCreateEditorArgs(),i=Object.assign(sd({...o,...e?{onError:s=>{e(s,i)}}:{},...r?{onWarn:s=>{r(s,i)}}:{}}),{[Ta]:this});for(const s of this.sortedExtensionReps())s.build(i);return i}buildEditor(){let t=ka;function e(){try{t()}finally{t=ka}}const r=Object.assign(this.constructEditor(),{dispose:e,[Symbol.dispose]:e});return t=jt(this.registerEditor(r),()=>r.setRootElement(null)),r}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){const e=this.extensionNameMap.get(t.name);if(e)return e.extension!==t&&rt(295,t.name),e}addEdge(t,e,r){const o=this.outgoingConfigEdges.get(t);if(o){const s=o.get(e);s?s.push(...r):o.set(e,r)}else this.outgoingConfigEdges.set(t,new Map([[e,r]]));const i=this.incomingEdges.get(e);i?i.add(t):this.incomingEdges.set(e,new Set([t]))}addExtension(t){this._sortedExtensionReps!==void 0&&rt(296);const e=To(t),[r]=e;typeof r.name!="string"&&rt(297,typeof r.name);let o=this.extensionNameMap.get(r.name);if(o!==void 0&&o.extension!==r&&rt(298,r.name),!o){o=new nm(this,r),this.extensionNameMap.set(r.name,o);const i=this.conflicts.get(r.name);typeof i=="string"&&rt(299,r.name,i);for(const s of r.conflictsWith||[])this.extensionNameMap.has(s)&&rt(299,r.name,s),this.conflicts.set(s,r.name);for(const s of r.dependencies||[]){const l=To(s);this.addEdge(r.name,l[0].name,l.slice(1)),this.addExtension(l)}for(const[s,l]of r.peerDependencies||[])this.addEdge(r.name,s,l?[l]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const t=[],e=(r,o)=>{let i=r.state;if(qd(i))return;const s=r.extension.name;var l;as(i)||rt(300,s,o||"[unknown]"),as(l=i)||rt(304,String(l.id),String(Jl)),i=Object.assign(l,{id:js}),r.state=i;const c=this.outgoingConfigEdges.get(s);if(c)for(const a of c.keys()){const u=this.extensionNameMap.get(a);u&&e(u,s)}i=tm(i),r.state=i,t.push(r)};for(const r of this.extensionNameMap.values())as(r.state)&&e(r);for(const r of t)for(const[o,i]of this.outgoingConfigEdges.get(r.extension.name)||[])if(i.length>0){const s=this.extensionNameMap.get(o);if(s)for(const l of i)s.configs.add(l)}for(const[r,...o]of this.roots)if(o.length>0){const i=this.extensionNameMap.get(r.name);i===void 0&&rt(301,r.name);for(const s of o)i.configs.add(s)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){const e=this.sortedExtensionReps(),r=new AbortController,o=[()=>r.abort()],i=r.signal;for(const s of e){const l=s.register(t,i);l&&o.push(l)}for(const s of e){const l=s.afterRegistration(t);l&&o.push(l)}return jt(...o)}buildCreateEditorArgs(){const t={},e=new Set,r=new Map,o=new Map,i={},s={},l=this.sortedExtensionReps();for(const u of l){const{extension:f}=u;if(f.onError!==void 0&&(t.onError=f.onError),f.onWarn!==void 0&&(t.onWarn=f.onWarn),f.disableEvents!==void 0&&(t.disableEvents=f.disableEvents),f.parentEditor!==void 0&&(t.parentEditor=f.parentEditor),f.editable!==void 0&&(t.editable=f.editable),f.namespace!==void 0&&(t.namespace=f.namespace),f.$initialEditorState!==void 0&&(t.$initialEditorState=f.$initialEditorState),f.nodes)for(const d of q_(f)){if(typeof d!="function"){const h=r.get(d.replace);h&&rt(302,f.name,d.replace.name,h.extension.name),r.set(d.replace,u)}e.add(d)}if(f.html){if(f.html.export)for(const[d,h]of f.html.export.entries())o.set(d,h);f.html.import&&Object.assign(i,f.html.import)}f.theme&&Hd(s,f.theme)}Object.keys(s).length>0&&(t.theme=s),e.size&&(t.nodes=Array.from(e));const c=Object.keys(i).length>0,a=o.size>0;(c||a)&&(t.html={},c&&(t.html.import=i),a&&(t.html.export=o));for(const u of l)u.init(t);return t.onError||(t.onError=rm),t}}function go(n,t){const e=Vn.maybeFromEditor(n);if(!e)return;const r=e.extensionNameMap.get(t);return r?r.getExtensionDependency():void 0}function om(n,t){let e;return Us(n(),{unwatched(){e&&(e(),e=void 0)},watched(){this.value=n(),e=t(this)}})}function im(n){return go(gt(),n)}function sm(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let qn;function Gd(n,t){const{key:e}=t;return n&&e in n?n[e]:t.defaultValue}function Yd(n){return qn&&qn.editor===n?qn:void 0}function lm(n,t){if("cfg"in t){const{cfg:e,updater:r}=t;return[e,r(Gd(n,e))]}return t}function cm(n,t){let e=t;for(const r of n){const[o,i]=lm(e,r),s=o.key;if(e===t&&Gd(e,o)===i)continue;const l=e===t||e===void 0?am(t):e;l[s]=i,e=l}return e}function am(n){return Object.create(n||null)}function um(n,t){return[n,t]}function fm(n,t,e,r=gt()){const o=qn,i=Yd(r);try{return qn={...i,editor:r,[n]:t},e()}finally{qn=o}}function dm(n,t=()=>{}){return(e,r=gt())=>o=>{const i=Yd(r),s=i&&i[n],l=cm(e,s||t(r));return l&&l!==s?fm(n,l,o,r):o()}}function hm(n,t,e,r){return Object.assign(ur(Symbol(t),{isEqual:r,parse:e}),{[n]:!0})}function gm(n){if(!On(n))return;const t=n;if(t.querySelector("style")===null)return;const e=new Map;function r(o){let i=e.get(o);if(i===void 0){i=new Set;for(let s=0;s<o.style.length;s++)i.add(o.style[s]);e.set(o,i)}return i}try{for(const o of Array.from(t.styleSheets)){let i;try{i=o.cssRules}catch{continue}for(const s of Array.from(i)){if(!ze(s,CSSStyleRule))continue;let l;try{l=t.querySelectorAll(s.selectorText)}catch{continue}for(const c of Array.from(l)){if(!q(c))continue;const a=r(c);for(let u=0;u<s.style.length;u++){const f=s.style[u];a.has(f)||c.style.setProperty(f,s.style.getPropertyValue(f),s.style.getPropertyPriority(f))}}}}}catch{}}const Xd="@lexical/html/DOM",Qd=Symbol.for("@lexical/html/DOMExportContext");function pm(n,t,e){return hm(Qd,n,t,e)}const _m=pm("isExport",Boolean);function mm(n){const t=go(n,Xd);return t?t.output.defaults:void 0}function ym(n){const t=go(n,Xd);return t?t.output.runtime:void 0}function xm(n=gt()){const t=ym(n);return t?t.getSessionConfig():Ii(n)}const vm=dm(Qd,mm),Zd=new Set(["STYLE","SCRIPT"]);function Sm(n,t){gm(t);const e=On(t)?t.body.childNodes:t.childNodes,r=[],o=[];for(const i of e)if(!Zd.has(i.nodeName)){const s=eh(i,n,o,!1);if(s!==null)for(const l of s)r.push(l)}return(function(i){for(const s of i)s.getParent()&&s.getNextSibling()instanceof kl&&s.insertAfter(Ve());for(const s of i){const l=s.getParent();l&&l.splice(s.getIndexWithinParent(),1,s.getChildren())}})(o),r}function Cm(n,t=null,e=gt()){return vm([um(_m,!0)],e)(()=>{const r=Y(),o=xm(e),i=$d(t),s=n.append.bind(n);for(const l of(b(i)?i:r).getChildren())th(e,l,s,t,o);return n})}function bm(n,t=null){return(typeof document>"u"||typeof window>"u"&&global.window===void 0)&&sm(338),wp(n),Cm(ot().createElement("div"),t,n).innerHTML}function th(n,t,e,r=null,o=Ii(n)){let i=o.$shouldInclude(t,r,n);const s=o.$shouldExclude(t,r,n);let l=t;r!==null&&M(t)&&(l=Id(r,t,"clone"));const c=o.$exportDOM(l,n),{element:a,after:u,append:f,$getChildNodes:d}=c;if(!a)return!1;const h=ot().createDocumentFragment(),g=d?d():b(l)?l.getChildren():[],_=i&&ct(r)&&b(t)?null:r,m=h.append.bind(h);let p=null;for(const y of g){const x=th(n,y,m,_,o);x&&(p=y),!i&&x&&o.$extractWithChild(t,y,r,"html",n)&&(i=!0)}if(i&&!s){if((q(a)||zs(a))&&(f?f(h):a.append(h),(function(y,x){const v=y.lastChild;if(Nt(x)&&q(y)&&Zr(y)&&v!==null&&v.nodeName==="BR"){const S=ot().createElement("br");S.setAttribute("data-lexical-managed-linebreak","true"),y.append(S)}})(a,p)),zs(a)){if(u){const y=u.call(l,a);y&&a.replaceChildren(y)}e(a)}else if(e(a),u){const y=u.call(l,a);y&&a.replaceWith(y)}}else e(h);return i}function eh(n,t,e,r,o=new Map,i){const s=[];if(Zd.has(n.nodeName))return s;let l=null;const c=(function(g,_){const{nodeName:m}=g,p=_._htmlConversions.get(m.toLowerCase());let y=null;if(p!==void 0)for(const x of p){const v=x(g);v!==null&&(y===null||(y.priority||0)<=(v.priority||0))&&(y=v)}return y!==null?y.conversion:null})(n,t),a=c?c(n):null;let u=null;if(a!==null){u=a.after;const g=a.node;if(l=Array.isArray(g)?g[g.length-1]:g,l!==null){for(const[,_]of o)if(l=_(l,i),!l)break;l&&s.push(...Array.isArray(g)?g:[l])}a.forChild!=null&&o.set(n.nodeName,a.forChild)}const f=n.childNodes;let d=[];const h=(l==null||!Z(l))&&(l!=null&&ti(l)||r);for(let g=0;g<f.length;g++)d.push(...eh(f[g],t,e,h,new Map(o),l));if(u!=null&&(d=u(d)),Zr(n)&&(d=Tm(n,d,h?()=>{const g=new kl;return e.push(g),g}:tt)),l==null)if(d.length>0)for(const g of d)s.push(g);else Zr(n)&&(function(g){return g.nextSibling==null||g.previousSibling==null?!1:Bs(g.nextSibling)&&Bs(g.previousSibling)})(n)&&s.push(Ve());else b(l)&&l.append(...d);return s}function Tm(n,t,e){const r=n.style.textAlign,o=[];let i=[];for(let s=0;s<t.length;s++){const l=t[s];if(ti(l))r&&!l.getFormat()&&l.setFormat(r),o.push(l);else if(i.push(l),s===t.length-1||s<t.length-1&&ti(t[s+1])){const c=e();c.setFormat(r),c.append(...i),o.push(c),i=[]}}return o}function Ie(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Js(n){let t=1,e=n.getParent();for(;e!=null;){if(W(e)){const r=e.getParent();if(I(r)){t++,e=r.getParent();continue}Ie(40)}return t}return t}function Hs(n){const t=n.getParent();I(t)||Ie(40);let e=t,r=t;for(;r!==null;)r=r.getParent(),I(r)&&(e=r);return e}function nh(n){let t=[];const e=n.getChildren().filter(W);for(let r=0;r<e.length;r++){const o=e[r],i=o.getFirstChild();I(i)?t=t.concat(nh(i)):t.push(o)}return t}function Gt(n){return W(n)&&I(n.getFirstChild())}function rh(n,t){return t.getValue()}function oh(n,t){return W(n)&&(t.length===0||t.length===1&&n.is(t[0])&&n.getChildrenSize()===0)}function Na(n,t){return I(n)?Ft(n).setListType(t):we(t)}function Ea(n){const t=A();if(t!==null){let e=t.getNodes();if(O(t)){const[o]=t.getStartEndPoints(),i=o.getNode(),s=i.getParent();if(Z(i)){const l=i.getFirstChild();if(l)e=l.selectStart().getNodes();else{const c=tt();i.append(c),e=c.select().getNodes()}}else if(oh(i,e)){if(Z(s)){const l=we(n);i.replace(l);const c=kn();b(i)&&(c.setFormat(i.getFormatType()),c.setIndent(i.getIndent())),l.append(c)}else if(W(i)){const l=i.getParentOrThrow();if(At(l)===null){const c=Na(l,n);Tn(c,l.getChildren()),l.replace(c)}}return}}const r=new Set;for(let o=0;o<e.length;o++){const i=e[o];if(b(i)&&i.isEmpty()&&!W(i)&&At(i)===null&&!r.has(i.getKey())){wa(i,n);continue}let s=cd(i)?i.getParent():W(i)&&i.isEmpty()?i:null;for(;s!=null;){const l=s.getKey();if(I(s)){if(!r.has(l)&&At(s)===null){const c=Na(s,n);Tn(c,s.getChildren()),s.replace(c),r.add(l)}break}{const c=s.getParent();if(Z(c)&&!r.has(l)){r.add(l),wa(s,n);break}s=c}}}}}function Tn(n,t){n.splice(n.getChildrenSize(),0,t)}function wa(n,t){if(I(n))return n;const e=n.getPreviousSibling(),r=n.getNextSibling(),o=kn();let i;if(Tn(o,n.getChildren()),I(e)&&t===e.getListType())e.append(o),I(r)&&t===r.getListType()&&(Tn(e,r.getChildren()),r.remove()),i=e;else if(I(r)&&t===r.getListType())r.getFirstChildOrThrow().insertBefore(o),i=r;else{const l=we(t);l.append(o),n.replace(l),i=l}o.setFormat(n.getFormatType()),o.setIndent(n.getIndent());const s=A();return O(s)&&(i.getKey()===s.anchor.key&&s.anchor.set(o.getKey(),s.anchor.offset,"element"),i.getKey()===s.focus.key&&s.focus.set(o.getKey(),s.focus.offset,"element")),n.remove(),i}function Hl(n,t){const e=n.getLastChild(),r=t.getFirstChild();e&&r&&Gt(e)&&Gt(r)&&e.getFirstChild().getListType()===r.getFirstChild().getListType()&&(Hl(e.getFirstChild(),r.getFirstChild()),r.remove());const o=t.getChildren();o.length>0&&n.append(...o),t.remove()}function km(){const n=A();if(O(n)){const t=new Set,e=n.getNodes(),r=n.anchor.getNode();if(oh(r,e))t.add(Hs(r));else for(let o=0;o<e.length;o++){const i=e[o];if(cd(i)){const s=j_(i,tn);s!=null&&t.add(Hs(s))}}for(const o of t){if(At(o)!==null)continue;let i=o;const s=nh(o);for(const l of s){const c=tt().setTextStyle(n.style).setTextFormat(n.format);c.setFormat(l.getFormatType()).setIndent(l.getIndent()).setDirection(l.getDirection()).setStyle(l.getStyle()),Tn(c,l.getChildren()),i.insertAfter(c),i=c,l.__key===n.anchor.key&&qe(n.anchor,Pt(It(c,"next"))),l.__key===n.focus.key&&qe(n.focus,Pt(It(c,"next"))),l.remove()}o.remove()}}}function ih(n){const t=n.getListType()!=="check";let e=n.getStart();for(const r of n.getChildren())W(r)&&(r.getValue()!==e&&r.setValue(e),t&&r.getLatest().__checked!=null&&r.setChecked(void 0),I(r.getFirstChild())||e++)}function Nm(n){const t=new Set;if(Gt(n)||t.has(n.getKey()))return;const e=n.getParent(),r=n.getNextSibling(),o=n.getPreviousSibling();if(Gt(r)&&Gt(o)){const i=o.getFirstChild();if(I(i)){i.append(n);const s=r.getFirstChild();I(s)&&i.getListType()===s.getListType()&&(Tn(i,s.getChildren()),r.remove(),t.add(r.getKey()))}}else if(Gt(r)){const i=r.getFirstChild();if(I(i)){const s=i.getFirstChild();s!==null&&s.insertBefore(n)}}else if(Gt(o)){const i=o.getFirstChild();I(i)&&i.append(n)}else if(I(e)){const i=Ft(n),s=Ft(e);i.append(s),s.append(n),o?o.insertAfter(i):r?r.insertBefore(i):e.append(i)}}function Oa(n){if(Gt(n))return;const t=n.getParent(),e=t?t.getParent():void 0;if(I(e?e.getParent():void 0)&&W(e)&&I(t)){const r=t?t.getFirstChild():void 0,o=t?t.getLastChild():void 0;if(n.is(r))e.insertBefore(n),t.isEmpty()&&e.remove();else if(n.is(o))e.insertAfter(n),t.isEmpty()&&e.remove();else{const i=Ft(n),s=Ft(t);i.append(s),n.getPreviousSiblings().forEach(a=>s.append(a));const l=Ft(n),c=Ft(t);l.append(c),Tn(c,n.getNextSiblings()),e.insertBefore(i),e.insertAfter(l),e.replace(n)}}}function Em(n=!1){const t=A();if(!O(t)||!t.isCollapsed())return!1;const e=t.anchor.getNode();let r=null;if(W(e)&&e.getChildrenSize()===0)r=e;else if(M(e)){const a=e.getParent();W(a)&&a.getChildren().every(u=>M(u)&&u.getTextContent().trim()==="")&&(r=a)}if(r===null)return!1;const o=Hs(r),i=r.getParent();I(i)||Ie(40);const s=i.getParent();let l;if(Z(s))l=tt(),o.insertAfter(l);else{if(!W(s))return!1;l=Ft(s),s.insertAfter(l)}l.setTextStyle(t.style).setTextFormat(t.format).select();const c=r.getNextSiblings();if(c.length>0){const a=n?rh(0,r):1,u=Ft(i).setStart(a);if(W(l)){const f=Ft(l);f.append(u),l.insertAfter(f)}else l.insertAfter(u);u.append(...c)}return(function(a){let u=a;for(;u.getNextSibling()==null&&u.getPreviousSibling()==null;){const f=u.getParent();if(f==null||!W(f)&&!I(f))break;u=f}u.remove()})(r),!0}const wm=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function Gn(n,t){if(typeof n=="number")return Number.isFinite(n)?n:t;if(typeof n!="string"||!wm.test(n))return t;const e=Number(n);return Number.isFinite(e)?e:t}function Om(n,t){n.__listType=t.__listType,n.__start=t.__start,n.__tag=t.__tag}const $m=n=>{const t=ne(n,"format"),e=ce(n,"format"),r=ae(n,"format"),o=Zn(n,"listType",0);return{exportJSON:function(i){const s=i.__textFormat,l=i.__textStyle,c=(s!==0||l!=="")&&i.shouldSerializeTextStyles();return{children:[],listType:i.__listType,start:i.__start,tag:i.__tag,direction:i.__dir,format:t[i.__format],indent:i.__indent,textFormat:s!==0&&c?s:void 0,textStyle:l!==""&&c?l:void 0,type:i.__type,version:1}},exportCompactJSON:function(i){const s=i.__textFormat,l=i.__textStyle,c=(s!==0||l!=="")&&i.shouldSerializeTextStyles(),a={type:i.__type,children:[]},u=i.__listType;u!==void 0&&u!=="number"&&(a.listType=u);const f=i.__start;f!==void 0&&f!==1&&(a.start=f);const d=i.__dir;d!=null&&(a.direction=d);const h=t[i.__format];h!==void 0&&h!==""&&(a.format=h);const g=i.__indent;return g!==void 0&&g!==0&&(a.indent=g),s!==void 0&&s!==0&&c&&(a.textFormat=s),l!==void 0&&l!==""&&c&&(a.textStyle=l),a},updateFromJSON:function(i,s){const l=s.direction;i.__dir=l===null||l==="ltr"||l==="rtl"?l:null;const c=s.format;i.__format=typeof c=="string"&&c in e?e[c]:r,i.__indent=(function(f,d,h,g){const _=Gn(f,d);return _>=h&&_<=g&&Number.isInteger(_)?_:d})(s.indent,0,0,1/0),i.__textFormat=Gn(s.textFormat,0);const a=s.textStyle;i.__textStyle=typeof a=="string"?a:"";const u=s.listType;return i.setListType(typeof u=="string"&&u in o?o[u]:u==="number"||u==="bullet"||u==="check"?u:"number"),i.__start=Gn(s.start,1),i},afterCloneFrom:Om}};function Mm(n,t){n.__checked=t.__checked,n.__value=t.__value}const Fm=n=>{const t=ne(n,"format"),e=ce(n,"format"),r=ae(n,"format");return{exportJSON:function(o){const i=o.__textFormat,s=o.__textStyle,l=(i!==0||s!=="")&&o.shouldSerializeTextStyles();return{children:[],checked:o.getChecked(),indent:o.getIndent(),value:o.__value,direction:o.__dir,format:t[o.__format],textFormat:i!==0&&l?i:void 0,textStyle:s!==""&&l?s:void 0,type:o.__type,version:1}},exportCompactJSON:function(o){const i=o.__textFormat,s=o.__textStyle,l=(i!==0||s!=="")&&o.shouldSerializeTextStyles(),c={type:o.__type,children:[]},a=o.getChecked();a!==void 0&&(c.checked=a);const u=o.getIndent();u!==void 0&&u!==0&&(c.indent=u);const f=o.__value;f!==void 0&&f!==1&&(c.value=f);const d=o.__dir;d!=null&&(c.direction=d);const h=t[o.__format];return h!==void 0&&h!==""&&(c.format=h),i!==void 0&&i!==0&&l&&(c.textFormat=i),s!==void 0&&s!==""&&l&&(c.textStyle=s),c},updateFromJSON:function(o,i){const s=i.direction;o.__dir=s===null||s==="ltr"||s==="rtl"?s:null;const l=i.format;o.__format=typeof l=="string"&&l in e?e[l]:r,o.setIndent((function(u,f,d,h){const g=Gn(u,NaN);return Number.isFinite(g)&&Number.isInteger(g)?g<d?d:g>h?h:g:f})(i.indent,0,0,128)),o.__textFormat=Gn(i.textFormat,0);const c=i.textStyle;o.__textStyle=typeof c=="string"?c:"";const a=i.checked;return o.__checked=a===void 0?void 0:typeof a=="boolean"&&a,o.__value=Gn(i.value,1),o},afterCloneFrom:Mm}},Am=xe()({checked:ie(Jo(fl()),{setter:{field:"__checked"}}),indent:He(0,{clamp:!0,integer:!0,max:128,min:0}),value:Mt(He(1),{field:"__value"})});let tn=class extends yt{constructor(e=1,r=void 0,o){super(o);k(this,"__value");k(this,"__checked");this.__value=e===void 0?1:e,this.__checked=r}$config(){return this.config("listitem",{$transform:e=>{const r=e.getParent();if(I(r))r.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0);else if(r){const o=e.createParentElementNode();I(o)||Ie(340);const i=[e];for(const s of["previous","next"]){i.reverse();for(const{origin:l}of X(e,s)){if(!W(l))break;i.push(l)}}e.insertBefore(o),o.splice(0,0,i),Z(r)||(rd(o,Qe(X(o,"next")),{$shouldSplit:()=>!1,removeEmptyDestination:!0}),r.isEmpty()&&r.isAttached()&&r.remove())}},extends:yt,generated:Fm,importDOM:{li:()=>({conversion:Dm,priority:0})},json:Am})}createDOM(e){const r=ot().createElement("li");return this.updateListItemDOM(null,r,e),r}updateListItemDOM(e,r,o){(function(l,c){const a=c.getParent();!I(a)||a.getListType()!=="check"||I(c.getFirstChild())?(l.removeAttribute("role"),l.removeAttribute("tabIndex"),l.removeAttribute("aria-checked")):(l.setAttribute("role","checkbox"),l.setAttribute("tabIndex","-1"),l.setAttribute("aria-checked",c.getChecked()?"true":"false"))})(r,this),r.value=this.__value,(function(l,c,a){const u=c.list;if(!u)return;const f=u.listitem,d=u.nested&&u.nested.listitem,h=a.getParent(),g=I(h)&&h.getListType()==="check",_=a.getChecked(),m=a.getChildren().some(x=>I(x)),p=[];u.listitemChecked!==void 0&&p.push(u.listitemChecked),u.listitemUnchecked!==void 0&&p.push(u.listitemUnchecked),d!==void 0&&p.push(...me(d)),p.length>0&&Wl(l,...p);const y=[];if(f!==void 0&&y.push(...me(f)),g){const x=_?u.listitemChecked:u.listitemUnchecked;x!==void 0&&y.push(x)}d!==void 0&&m&&y.push(...me(d)),y.length>0&&Fe(l,...y)})(r,o.theme,this);const i=e?e.__style:"",s=this.__style;i!==s&&jn(r.style,s,i),(function(l,c,a){const u=c.__textStyle,f=a?a.__textStyle:"";if(a!==null&&f===u)return;const d=Zo(u);for(const h in d)l.style.setProperty(`--listitem-marker-${h}`,d[h]);if(f!=="")for(const h in Zo(f))h in d||l.style.removeProperty(`--listitem-marker-${h}`)})(r,this,e)}updateDOM(e,r,o){const i=r;return this.updateListItemDOM(e,i,o),!1}exportDOM(e){const r=this.createDOM(e._config),o=this.getFormatType();o&&(r.style.textAlign=o);const i=this.getDirection();return i&&(r.dir=i),Gt(this)?{after(s){if(q(s)){const l=s.previousElementSibling;if(q(l)&&l.nodeName==="LI"){for(;s.firstChild;)l.append(s.firstChild);s.remove()}}return s},element:r}:{element:r}}append(...e){for(let r=0;r<e.length;r++){const o=e[r];if(b(o)&&this.canMergeWith(o)){const i=o.getChildren();this.append(...i),o.remove()}else super.append(o)}return this}replace(e,r){if(W(e))return super.replace(e);this.setIndent(0);const o=this.getParentOrThrow();if(!I(o))return e;if(o.__first===this.getKey())o.insertBefore(e);else if(o.__last===this.getKey())o.insertAfter(e);else{const l=Ft(o);let c=this.getNextSibling();for(;c;){const a=c;c=c.getNextSibling(),l.append(a)}o.insertAfter(e),e.insertAfter(l)}const i=this.__key;let s=0;if(r&&(b(e)||Ie(139),s=e.getChildrenSize(),e.splice(s,0,this.getChildren())),r&&b(e)){const l=A();if(O(l))for(const c of l.getStartEndPoints())c.key===i&&c.type==="element"&&c.set(e.getKey(),s+c.offset,"element")}return this.remove(),o.getChildrenSize()===0&&o.remove(),e}insertAfter(e,r=!0){const o=this.getParentOrThrow();if(I(o)||Ie(39),W(e))return super.insertAfter(e,r);const i=this.getNextSiblings();if(o.insertAfter(e,r),i.length!==0){const s=Ft(o),l=i[0];s.getListType()==="number"&&W(l)&&s.setStart(rh(0,l)),i.forEach(c=>s.append(c)),e.insertAfter(s,r)}return e}remove(e){const r=this.getPreviousSibling(),o=this.getNextSibling();super.remove(e),r&&o&&Gt(r)&&Gt(o)&&r.getFirstChild().getListType()===o.getFirstChild().getListType()&&(Hl(r.getFirstChild(),o.getFirstChild()),o.remove())}resetOnCopyNodeFrom(e){super.resetOnCopyNodeFrom(e),e.getChecked()&&this.setChecked(!1)}insertNewAfter(e,r=!0){const o=Ft(this);return this.insertAfter(o,r),o}collapseAtStart(e){if(Gt(this))return!1;const r=this.getParentOrThrow();if(W(r.getParentOrThrow()))return Oa(this),!0;const o=tt().append(...this.getChildren()),i=this.getNextSiblings();if(i.length>0){const s=Ft(r);s.append(...i),r.insertAfter(s)}return r.insertAfter(o),this.remove(),r.getChildrenSize()===0&&r.remove(),o.selectStart(),!0}getValue(){return this.getLatest().__value}setValue(e){const r=this.getWritable();return r.__value=e,r}getChecked(){const e=this.getLatest();let r;const o=this.getParent();return I(o)&&(r=o.getListType()),r==="check"?!!e.__checked:void 0}setChecked(e){const r=this.getWritable();return r.__checked=e,r}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 r=e.getParentOrThrow(),o=0;for(;W(r);)r=r.getParentOrThrow().getParentOrThrow(),o++;return o}setIndent(e){typeof e!="number"&&Ie(117),(e=Math.floor(e))>=0||Ie(199);const r=e;let o=this.getIndent();for(;o!==r;)o<r?(Nm(this),o++):(Oa(this),o--);return this}canInsertAfter(e){return W(e)}canReplaceWith(e){return W(e)}canMergeWith(e){return W(e)||dr(e)}extractWithChild(e,r){if(!O(r))return!1;const o=r.anchor.getNode(),i=r.focus.getNode();return this.isParentOf(o)&&this.isParentOf(i)&&this.getTextContent().length===r.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return we("bullet")}canMergeWhenEmpty(){return!0}};function Dm(n){if(n.classList.contains("task-list-item")){for(const r of n.children)if(r.tagName==="INPUT")return $a(r)}if(n.classList.contains("joplin-checkbox")){for(const r of n.children)if(r.classList.contains("checkbox-wrapper")&&r.children.length>0&&r.children[0].tagName==="INPUT")return $a(r.children[0])}const t=n.getAttribute("aria-checked"),e=kn(t==="true"||t!=="false"&&void 0);return Li(e,n),{after:sh.bind(null,e),node:ho(e,n)}}function $a(n){if(n.getAttribute("type")!=="checkbox")return{node:null};const t=kn(n.hasAttribute("checked"));return{after:sh.bind(null,t),node:t}}function sh(n,t){const e=t[0];return t.length===1&&dr(e)&&!n.getFormatType()&&e.getFormatType()?(n.setFormat(e.getFormatType()),e.getChildren()):t}function kn(n){return fe(new tn(void 0,n))}function W(n){return n instanceof tn}const lh={ol:"number",ul:"bullet"},Pm=xe()({listType:ie(ms(dn(["number","bullet","check"]),lh),{getter:{field:"__listType"}}),start:Mt(He(1),{field:"__start"}),tag:ie(dn(["ul","ol"]),{getter:{field:"__tag"},setter:null})});let Mn=class extends yt{constructor(e="number",r=1,o){super(o);k(this,"__tag");k(this,"__start");k(this,"__listType");const i=lh[e]||e;this.__listType=i,this.__tag=i==="number"?"ol":"ul",this.__start=r}$config(){return this.config("list",{$transform:e=>{(function(r){const o=r.getNextSibling();I(o)&&r.getListType()===o.getListType()&&Hl(r,o)})(e),ih(e)},extends:yt,generated:$m,importDOM:{ol:()=>({conversion:Fa,priority:0}),ul:()=>({conversion:Fa,priority:0})},json:Pm})}getTag(){return this.getLatest().__tag}setListType(e){const r=this.getWritable();return r.__listType=e,r.__tag=e==="number"?"ol":"ul",r}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){const r=this.getWritable();return r.__start=e,r}createDOM(e,r){const o=this.__tag,i=ot().createElement(o);return this.__start!==1&&i.setAttribute("start",String(this.__start)),i.__lexicalListType=this.__listType,Ma(i,e.theme,this),i}updateDOM(e,r,o){return e.__tag!==this.__tag||e.__listType!==this.__listType||(Ma(r,o.theme,this),e.__start!==this.__start&&r.setAttribute("start",String(this.__start)),!1)}exportDOM(e){const r=this.createDOM(e._config,e);if(q(r)){this.__start!==1&&r.setAttribute("start",String(this.__start)),this.__listType==="check"&&r.setAttribute("__lexicalListType","check");const o=this.getDirection();o&&(r.dir=o)}return{element:r}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,r,o){let i=o;for(let s=0;s<o.length;s++){const l=o[s];if(!W(l)){i===o&&(i=[...o]);const c=this.createListItemNode();!b(l)||I(l)||l.isInline()?c.append(l):c.append(...l.getChildren()),i[s]=c}}return super.splice(e,r,i)}extractWithChild(e){return W(e)}createListItemNode(){return kn()}};function Ma(n,t,e){const r=[],o=[],i=t.list;if(i!==void 0){const s=i[`${e.__tag}Depth`]||[],l=Js(e)-1,c=l%s.length,a=s[c],u=i[e.__tag];let f;const d=i.nested,h=i.checklist;if(d!==void 0&&d.list&&(f=d.list),u!==void 0&&r.push(u),h!==void 0&&e.__listType==="check"&&r.push(h),a!==void 0){r.push(...me(a));for(let g=0;g<s.length;g++)g!==c&&o.push(...me(s[g]))}if(f!==void 0){const g=me(f);l>1?r.push(...g):o.push(...g)}}o.length>0&&Wl(n,...o),r.length>0&&Fe(n,...r)}function Fa(n){let t;if((function(e){return q(e)&&e.nodeName.toLowerCase()==="ol"})(n)){const e=n.start;t=we("number",e)}else t=(function(e){if(e.getAttribute("__lexicallisttype")==="check"||e.classList.contains("contains-task-list")||e.getAttribute("data-is-checklist")==="1")return!0;for(const r of e.childNodes)if(q(r)&&r.hasAttribute("aria-checked"))return!0;return!1})(n)?we("check"):we("bullet");return ho(t,n),{after:e=>(function(r,o){const i=o.createListItemNode.bind(o),s=[];for(let l=0;l<r.length;l++){const c=r[l];if(W(c)){s.push(c);const a=c.getChildren();a.length>1&&a.forEach(u=>{I(u)&&s.push(i().append(u))})}else s.push(i().append(c))}return s})(e,t),node:t}}function we(n="number",t=1){return fe(new Mn(n,t))}function I(n){return n instanceof Mn}const Im=P("UPDATE_LIST_START_COMMAND"),Lm=P("INSERT_UNORDERED_LIST_COMMAND"),Rm=P("INSERT_ORDERED_LIST_COMMAND"),zm=P("REMOVE_LIST_COMMAND");function Aa(n,t){return jt(n.registerCommand(Rm,()=>(Ea("number"),!0),Ln),n.registerCommand(Im,e=>{const{listNodeKey:r,newStart:o}=e,i=nt(r);return!!I(i)&&(i.getListType()==="number"&&(i.setStart(o),ih(i)),!0)},Ln),n.registerCommand(Lm,()=>(Ea("bullet"),!0),Ln),n.registerCommand(zm,()=>(km(),!0),Ln),n.registerCommand(Jr,()=>Em(!!(t&&t.restoreNumbering)),Ln),n.registerCommand(pl,e=>{const r=A();if(!O(r)||!r.isCollapsed())return!1;const{anchor:o}=r;if(o.offset!==0)return!1;let i=o.getNode();for(;!W(i);){if(i.getPreviousSibling()!==null)return!1;const s=i.getParent();if(s===null)return!1;i=s}return!(!W(i)||!i.collapseAtStart(r))&&(e.preventDefault(),!0)},Vp),n.registerNodeTransform(tn,e=>{const r=e.getFirstChild();if(r){if(M(r)){const o=r.getStyle(),i=r.getFormat();e.getTextStyle()!==o&&e.setTextStyle(o),e.getTextFormat()!==i&&e.setTextFormat(i)}}else{const o=A();O(o)&&(o.style!==e.getTextStyle()||o.format!==e.getTextFormat())&&o.isCollapsed()&&e.is(o.anchor.getNode())&&e.setTextStyle(o.style).setTextFormat(o.format)}}),n.registerNodeTransform(se,e=>{const r=e.getParent();if(W(r)&&e.is(r.getFirstChild())){const o=e.getStyle(),i=e.getFormat();o===r.getTextStyle()&&i===r.getTextFormat()||r.setTextStyle(o).setTextFormat(i)}}))}function Bm(n){const t=e=>{const r=e.getParent();if(I(e.getFirstChild())||!I(r))return;const o=vt(e,i=>W(i)&&I(i.getParent())&&W(i.getPreviousSibling()));if(o===null&&e.getIndent()>0)e.setIndent(0);else if(W(o)){const i=o.getPreviousSibling();if(W(i)){const s=(function(c){let a=c,u=a.getFirstChild();for(;I(u);){const f=u.getLastChild();if(!W(f))break;a=f,u=a.getFirstChild()}return a})(i),l=s.getParent();if(I(l)){const c=Js(l);c+1<Js(r)&&e.setIndent(c)}}}};return n.registerNodeTransform(Mn,e=>{const r=[e];for(;r.length>0;){const o=r.shift();if(I(o)){for(const i of o.getChildren())if(W(i)){t(i);const s=i.getFirstChild();I(s)&&r.push(s)}}}})}const ch=z.createContext(null);function Km(n,t){return{getTheme:function(){return t??null}}}function de(){const n=z.useContext(ch);return n==null&&(function(t,...e){const r=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const i of e)o.append("v",i);throw r.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(8),n}function Wm({hasStrictIndent:n=!1,shouldPreserveNumbering:t=!1}){const[e]=de();return z.useEffect(()=>{if(!e.hasNodes([Mn,tn]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[e]),z.useEffect(()=>jt(Aa(e,{restoreNumbering:t}),n?Bm(e):()=>{}),[e,n,t]),(function(r){z.useEffect(()=>Aa(r),[r])})(e),null}const Um=ee?z.useLayoutEffect:z.useEffect,ko={tag:Un};function jm({initialConfig:n,children:t}){const e=z.useMemo(()=>{const{theme:r,namespace:o,nodes:i,onError:s,onWarn:l,editorState:c,html:a}=n,u=Km(null,r),f=sd({editable:n.editable,html:a,namespace:o,nodes:i,onError:d=>s(d,f),...l?{onWarn:d=>l(d,f)}:{},theme:r});return(function(d,h){if(h!==null){if(h===void 0)d.update(()=>{const g=Y();if(g.isEmpty()){const _=tt();g.append(_);const m=d.getRootElement(),p=ee&&m!==null?hi(m):null;(A()!==null||p!==null&&p===m)&&_.select()}},ko);else if(h!==null)switch(typeof h){case"string":{const g=d.parseEditorState(h);d.setEditorState(g,ko);break}case"object":d.setEditorState(h,ko);break;case"function":d.update(()=>{Y().isEmpty()&&h(d)},ko)}}})(f,c),[f,u]},[]);return Um(()=>{const r=n.editable,[o]=e;o.setEditable(r===void 0||r)},[]),lt.jsx(ch.Provider,{value:e,children:t})}function Jm(){return Y().getTextContent()}function Hm(n,t=!0){if(n)return!1;let e=Jm();return t&&(e=e.trim()),e===""}function Vm(n){if(!Hm(n,!1))return!1;const t=Y().getChildren(),e=t.length;if(e>1)return!1;for(let r=0;r<e;r++){const o=t[r];if(J(o))return!1;if(b(o)){if(!dr(o)||o.__indent!==0)return!1;const i=o.getChildren(),s=i.length;for(let l=0;l<s;l++){const c=i[l];if(!M(c))return!1}}}return!0}function ah(n){return()=>Vm(n)}const Vs=ee?z.useLayoutEffect:z.useEffect;function qm({editor:n,ariaActiveDescendant:t,ariaAutoComplete:e,ariaControls:r,ariaDescribedBy:o,ariaErrorMessage:i,ariaExpanded:s,ariaInvalid:l,ariaLabel:c,ariaLabelledBy:a,ariaMultiline:u,ariaOwns:f,ariaRequired:d,autoCapitalize:h,className:g,id:_,role:m="textbox",spellCheck:p=!0,style:y,tabIndex:x,"data-testid":v,...S},C){const[N,T]=z.useState(n.isEditable()),E=z.useCallback(F=>{F&&F.ownerDocument&&F.ownerDocument.defaultView?n.setRootElement(F):n.setRootElement(null)},[n]),$=z.useMemo(()=>(function(...F){return D=>{for(const L of F)typeof L=="function"?L(D):L!=null&&(L.current=D)}})(C,E),[E,C]);return Vs(()=>(T(n.isEditable()),n.registerEditableListener(F=>{T(F)})),[n]),lt.jsx("div",{"aria-activedescendant":N?t:void 0,"aria-autocomplete":N?e:"none","aria-controls":N?r:void 0,"aria-describedby":o,...i!=null?{"aria-errormessage":i}:{},"aria-expanded":N&&m==="combobox"?!!s:void 0,...l!=null?{"aria-invalid":l}:{},"aria-label":c,"aria-labelledby":a,"aria-multiline":u,"aria-owns":N?f:void 0,"aria-readonly":!N||void 0,"aria-required":d,autoCapitalize:h,className:g,contentEditable:N,"data-testid":v,id:_,ref:$,role:m,spellCheck:p,style:y,tabIndex:x??(N?void 0:-1),...S})}const Gm=z.forwardRef(qm);function Da(n){return n.read("latest",ah(n.isComposing()))}const Pa=z.forwardRef(Ym);function Ym(n,t){const{placeholder:e,...r}=n,[o]=de();return lt.jsxs(lt.Fragment,{children:[lt.jsx(Gm,{editor:o,...r,ref:t}),e!=null&&lt.jsx(Xm,{editor:o,content:e})]})}function Xm({content:n,editor:t}){const e=(function(s){const[l,c]=z.useState(()=>Da(s));return Vs(()=>{function a(){const u=Da(s);c(u)}return a(),jt(s.registerUpdateListener(()=>{a()}),s.registerEditableListener(()=>{a()}))},[s]),l})(t),[r,o]=z.useState(t.isEditable());if(Vs(()=>(o(t.isEditable()),t.registerEditableListener(s=>{o(s)})),[t]),!e)return null;let i=null;return typeof n=="function"?i=n(r):n!==null&&(i=n),i===null?null:lt.jsx("div",{"aria-hidden":!0,children:i})}class Qm extends z.Component{constructor(){super(...arguments);k(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,r){this.props.onError(e instanceof Error?e:new Error(String(e),{cause:e}),r)}render(){return this.state.hasError?this.props.fallback:this.props.children}}function Zm({children:n,fallback:t,onError:e}){return lt.jsx(Qm,{fallback:t===void 0?lt.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}):t,onError:e,children:n})}function ty(n,t,e,r,o){if(n===null||e.size===0&&r.size===0&&!o)return 0;const i=t._selection,s=n._selection;if(o)return 1;if(!(O(i)&&O(s)&&s.isCollapsed()&&i.isCollapsed()))return 0;const l=(function(p,y,x){const v=p._nodeMap,S=[];for(const C of y){const N=v.get(C);N!==void 0&&S.push(N)}for(const[C,N]of x){if(!N)continue;const T=v.get(C);T===void 0||ut(T)||S.push(T)}return S})(t,e,r);if(l.length===0)return 0;if(l.length>1){const p=t._nodeMap,y=p.get(i.anchor.key),x=p.get(s.anchor.key);return y&&x&&!n._nodeMap.has(y.__key)&&M(y)&&y.__text.length===1&&i.anchor.offset===1?2:0}const c=l[0],a=n._nodeMap.get(c.__key);if(!M(a)||!M(c)||a.__mode!==c.__mode)return 0;const u=a.__text,f=c.__text;if(u===f)return 0;const d=i.anchor,h=s.anchor;if(d.key!==h.key||d.type!=="text")return 0;const g=d.offset,_=h.offset,m=f.length-u.length;return m===1&&_===g-1?2:m===-1&&_===g+1?3:m===-1&&_===g?4:0}function ey(n,t,e){let r=e(),o=0,i=r,s=0,l=null;return(c,a,u,f,d,h)=>{const g=e();if(h.has(Ff)&&(i=r,s=o,l=c),h.has(Qo))return o=0,r=g,2;h.has(Gr)&&l&&(r=i,o=s,c=l);const _=h.has($f)||h.has($s)?0:ty(c,a,f,d,n.isComposing()),m=(()=>{const p=u===null||u.editor===n,y=h.has(Of);if(!y&&p&&h.has(Un))return 0;if(_===1)return 2;if(c===null)return 1;const x=a._selection;if(!(f.size>0||d.size>0))return x!==null?0:2;const v=typeof t=="number"?t:t.peek();return y===!1&&_!==0&&_===o&&g<r+v&&p||f.size===1&&(function(S,C,N){const T=C._nodeMap.get(S),E=N._nodeMap.get(S),$=C._selection,F=N._selection;return!(O($)&&O(F)&&$.anchor.type==="element"&&$.focus.type==="element"&&F.anchor.type==="text"&&F.focus.type==="text"||!M(T)||!M(E)||T.__parent!==E.__parent)&&JSON.stringify(C.read(()=>T.exportJSON()))===JSON.stringify(N.read(()=>E.exportJSON()))})(Array.from(f)[0],c,a)?0:1})();return r=g,o=_,m}}function Ia(n,t){if(t!==null&&t.editor===n.editor)return t;const{editor:e}=n,r=e.getEditorState();return r.isEmpty()?null:{editor:e,editorState:r}}function La(n,t){n.undoStack=[],n.redoStack=[],n.current=null}function ny(n,t,e,r=Date.now,o,i=null){const s=ey(n,e,r);return jt(n.registerCommand(qo,()=>((function(l,c,a){const u=c.redoStack,f=c.undoStack;if(f.length!==0){const d=c.current,h=f.pop();if(h){const g=Ia(h,d);g!==null&&(u.push(g),l.dispatchCommand(po,!0))}f.length===0&&l.dispatchCommand(_o,!1),c.current=h||null,h&&h.editor.setEditorState(h.editorState,{tag:Qo})}})(n,t),!0),K),n.registerCommand(Vr,()=>((function(l,c,a){const u=c.redoStack,f=c.undoStack;if(u.length!==0){const d=c.current,h=u.pop();if(h){const g=Ia(h,d);g!==null&&(f.push(g),l.dispatchCommand(_o,!0))}u.length===0&&l.dispatchCommand(po,!1),c.current=h||null,h&&h.editor.setEditorState(h.editorState,{tag:Qo})}})(n,t),!0),K),n.registerCommand(Ag,()=>(La(t),!1),K),n.registerCommand(Dg,()=>(La(t),n.dispatchCommand(po,!1),n.dispatchCommand(_o,!1),!0),K),n.registerUpdateListener(({editorState:l,prevEditorState:c,dirtyLeaves:a,dirtyElements:u,tags:f})=>{const d=t.current,h=t.redoStack,g=t.undoStack,_=d===null?null:d.editorState;if(d!==null&&l===_)return;const m=s(c,l,d,a,u,f);if(m===1){h.length!==0&&(t.redoStack=[],n.dispatchCommand(po,!1));const p=(function(y,x,v){return v===null?null:v.editor===y?{...v}:x.isEmpty()?null:{editor:y,editorState:x}})(n,c,d);if(p!==null){g.push(p);const y=typeof i=="number"||i===null?i:i.peek();y!==null&&g.length>y&&g.splice(0,g.length-y),n.dispatchCommand(_o,!0)}}else if(m===2)return;t.current={editor:n,editorState:l}}))}function ry(){return{current:null,redoStack:[],undoStack:[]}}function oy({delay:n,externalHistoryState:t}){const[e]=de();return(function(r,o,i=1e3){const s=z.useMemo(()=>o||ry(),[o]);z.useEffect(()=>ny(r,s,i),[i,r,s])})(e,t,n),null}const iy=ee?z.useLayoutEffect:z.useEffect;function sy(n){const[t]=de(),e=z.useMemo(()=>n(t),[t,n]),[r,o]=z.useState(()=>e.initialValueFn()),i=z.useRef(r);return iy(()=>{const{initialValueFn:s,subscribe:l}=e,c=s();return i.current!==c&&(i.current=c,o(c)),l(a=>{i.current=a,o(a)})},[e,n]),r}function ly(n){return{initialValueFn:()=>n.isEditable(),subscribe:t=>n.registerEditableListener(t)}}function cy(){return sy(ly)}const ay={name:"@lexical/react/ReactProvider"},uy={bold:"bold",italic:"italic",strikeThrough:"strikethrough",subscript:"subscript",superscript:"superscript",underline:"underline"},vi=Symbol.for("@lexical/dragon/WindowState");function fy(n,t,e){const r=(function(o){let i=o[vi];return i===void 0&&(i={dispose:()=>{},editors:new Map,installs:new Set},o[vi]=i),i})(n);if(r.installs.size===0){const o=gy.bind(n);n.addEventListener("message",o,!0),r.dispose=()=>{n.removeEventListener("message",o,!0)}}if(r.installs.add(t),e){const o=r.editors.get(e)||new Set;o.add(t),r.editors.set(e,o)}return dy.bind(null,n,r,t,e)}function dy(n,t,e,r){if(r){const o=t.editors.get(r);o&&o.delete(e)&&o.size===0&&t.editors.delete(r)}t.installs.delete(e)&&t.installs.size===0&&(t.dispose(),delete n[vi])}function Ra(n){return n&&n.ownerDocument.defaultView}function hy(n){const t=om(()=>Ra(n.getRootElement()),e=>n.registerRootListener(r=>{e.value=Ra(r)}));return Jd(()=>{const e=t.value;if(e)return fy(e,Symbol("@lexical/dragon/editorInstall"),n)})}function gy(n){if(n.origin!==this.location.origin)return;const t=(function(r){const o=r[vi];if(o===void 0)return null;const i=hr(ir(r.document));return fo(i)&&o.editors.has(i)?i:null})(this);if(t===null)return;const e=n.data;if(typeof e=="string"){let r;try{r=JSON.parse(e)}catch{return}if(r&&r.protocol==="nuanria_messaging"&&r.type==="request"){const o=r.payload;if(o&&o.functionId==="makeChanges"){const i=o.args;if(Array.isArray(i)){const[s,l,c,a,u,f]=i;if(![s,l,a,u].every(Number.isFinite)||typeof c!="string"&&c!==-1)return;t.update(()=>{const d=A();if(O(d)){const h=d.anchor;let g=h.getNode(),_=0,m=0;if(M(g)&&s>=0&&l>=0&&(_=s,m=s+l,d.setTextNodeRange(g,_,g,m)),typeof c!="string"||_===m&&c===""||(d.insertRawText(c),g=h.getNode()),M(g)){const p=g.getTextContentSize();_=Math.min(Math.max(a,0),p),m=a<0||u<0?_:Math.min(a+u,p),d.setTextNodeRange(g,_,g,m)}if(typeof f=="string"&&u>0&&!d.isCollapsed()){const p=uy[f];p!==void 0&&d.formatText(p)}n.stopImmediatePropagation()}})}}}}}function Si(n,t,e=null){const r=vd(e),o=e?yd(e):[],i=e!==null&&o.length>0;if(i&&typeof r.caretPositionFromPoint=="function"){const s=r.caretPositionFromPoint(n,t,{shadowRoots:o});if(s!==null&&(function(l,c){for(let a=l;a!==null;){if(a===c)return!0;a=$n(a)}return!1})(s.offsetNode,e))return{node:s.offsetNode,offset:s.offset}}if(i){const s=e.getRootNode();if(Me(s)){const l=s.elementFromPoint(n,t);if(l!==null&&e.contains(l)){const c=(function(a,u,f,d){const h=d.createRange(),g=N=>u<N.top?N.top-u:u>N.bottom?u-N.bottom:0,_=N=>a<N.left?N.left-a:a>N.right?a-N.right:0,m=d.createTreeWalker(f,NodeFilter.SHOW_TEXT);let p=null,y=1/0,x=1/0;for(let N=m.nextNode();N;N=m.nextNode()){h.selectNodeContents(N);for(const T of h.getClientRects()){const E=g(T),$=_(T);(E<y||E===y&&$<x)&&(y=E,x=$,p=N)}}if(p===null)return null;let v=0,S=1/0,C=1/0;for(let N=0;N<=p.length;N++){h.setStart(p,N),h.collapse(!0);const T=h.getBoundingClientRect(),E=g(T),$=Math.abs(a-T.left);(E<S||E===S&&$<C)&&(S=E,C=$,v=N)}return{node:p,offset:v}})(n,t,l,r);if(c!==null)return c}}}if(typeof r.caretRangeFromPoint=="function"){const s=r.caretRangeFromPoint(n,t);return s===null?null:{node:s.startContainer,offset:s.startOffset}}if(typeof r.caretPositionFromPoint=="function"){const s=r.caretPositionFromPoint(n,t);return s===null?null:{node:s.offsetNode,offset:s.offset}}return null}function Ci(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const za={"application/x-lexical-editor":0,"text/html":10,"text/plain":20,"text/uri-list":30};function py(n){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:t=>t}).createHTML(n):n}const Ba=(n,t)=>{if(!O(t))return t.insertRawText(n),!0;t!==A()&&St(t);const e=r=>{const o=A();O(o)&&r(o)};return Hf(n,{linebreak:()=>e(r=>r.insertParagraph()),tab:()=>e(r=>r.insertNodes([lo()])),text:r=>e(o=>o.insertText(r))}),!0},Ka={"application/x-lexical-editor":[(n,t,e)=>{try{const r=gt(),o=JSON.parse(n);if(o&&o.namespace===r._config.namespace&&Array.isArray(o.nodes))return Wa(r,Ty(o.nodes),t),!0}catch(r){console.error(r)}return e()}],"text/html":[(n,t,e)=>{try{const r=gt(),o=new DOMParser().parseFromString(py(n),"text/html");return Wa(r,Sm(r,o),t),!0}catch(r){return console.error(r),e()}}],"text/plain":[Ba],"text/uri-list":[Ba]};function _y(n,t,e,r){if(!n)return!1;const o=i=>!!n[i]&&n[i](t,e,o.bind(null,i-1),r);return o(n.length-1)}function my(n,t,e){const r=t.getData("text/plain");for(const o of(function(i){return Object.keys(i.$importMimeType).filter(s=>i.$importMimeType[s]!==void 0).sort((s,l)=>{const c=i.priority[s],a=i.priority[l];return c===void 0&&a===void 0?s<l?-1:s>l?1:0:c===void 0?1:a===void 0?-1:c-a})})(n)){const i=t.getData(o);if(i&&(o!=="text/html"||i!==r)&&_y(n.$importMimeType[o],i,e,t))return!0}return!1}const yy={$importMimeType:Ka,$insertDataTransfer:(n,t)=>my({$importMimeType:Ka,priority:za},n,t),priority:za},xy={name:"@lexical/clipboard/Import"};function uh(n,t=A()){return t==null&&Ci(166),O(t)&&t.isCollapsed()||t.getNodes().length===0?"":bm(n,t)}function fh(n,t=A()){return t==null&&Ci(166),O(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(by(n,t))}function qs(n,t,e){(function(){const r=im(xy.name);return r?r.output:yy})().$insertDataTransfer(n,t)}const dh="application/x-lexical-drag";function vy(n,t){const e={editorKey:t.getKey()};n.setData(dh,JSON.stringify(e))}function Sy(n,t,e){const r=n.dataTransfer;if(r===null)return!1;const o=(function(a){const u=a.getData(dh);if(!u)return null;let f;try{f=JSON.parse(u)}catch{return null}return(d=f)!==null&&typeof d=="object"&&"editorKey"in d&&typeof d.editorKey=="string"?f:null;var d})(r);if(o===null)return!1;const i=(function(a,u){const f=Si(a.clientX,a.clientY,u.getRootElement());if(f===null)return null;const d=yn(f.node);if(d===null)return null;if(M(d))return Ye(d,"next",f.offset);if(b(d))return Ls(d,f.offset,"next");const h=d.getParent();return h===null?null:Ls(h,d.getIndexWithinParent()+1,"next")})(n,t);if(i===null)return!1;const s=nd(i);if(s===null)return!1;const l=o.editorKey===t.getKey(),c=A();if(l){if(!O(c)||c.isCollapsed())return!1;if((function(a,u){const{anchor:f,focus:d}=ao(li(u),"next");return Xe(f,a)<0&&Xe(a,d)<0})(i,c))return n.preventDefault(),!0;c.removeText()}if(!s.origin.isAttached())return n.preventDefault(),!0;if(e(r,er(Bi(s)),t),!l){const a=t.getRootElement(),u=a?a.ownerDocument:null,f=u?(function(d,h){for(const g of xd(h)){const _=hr(g);if(fo(_)&&_.getKey()===d&&q(g))return g}return null})(o.editorKey,u):null;f!==null&&f.dispatchEvent(new InputEvent("beforeinput",{bubbles:!0,cancelable:!0,inputType:"deleteByDrag"}))}return n.preventDefault(),!0}function Cy(n,t){return Sy(n,t,qs)}function Wa(n,t,e){n.dispatchCommand(Eg,{nodes:t,selection:e})||(e.insertNodes(t),(function(r){if(O(r)&&r.isCollapsed()){const o=r.anchor;let i=null;const s=Wt(o,"previous");if(s)if(Xt(s))i=s.origin;else{const l=Zt(s,It(Y(),"next").getFlipped());for(const c of l){if(M(c.origin)){i=c.origin;break}if(b(c.origin)&&!c.origin.isInline())break}}if(i&&M(i)){const l=i.getFormat(),c=i.getStyle();r.format===l&&r.style===c||(r.format=l,r.style=c,r.dirty=!0)}}})(e))}function Gs(n,t,e,r=[]){let o=t===null||e.isSelected(t);const i=b(e)&&e.excludeFromCopy("clone");let s=e;t!==null&&M(s)&&(s=Id(t,s,"clone"));const l=zu(s),c=b(s)?s.getChildren():[],a=l.children||[];M(s)&&s.getTextContentSize()===0&&(o=!1);const u=o&&ct(t)&&b(e)?null:t;for(let f=0;f<c.length;f++){const d=c[f],h=Gs(n,u,d,a);!o&&b(e)&&h&&e.extractWithChild(d,t,"clone")&&(o=!0)}if(o&&!i){const f=pe(s);if(f.length>0){const d={};for(const h of f){const g=lr(s,h);g===null&&Ci(366,s.constructor.name,h);const _=[];Gs(n,null,g,_),(_.length!==1||b(g)&&g.excludeFromCopy("clone"))&&Ci(435,h,s.constructor.name,String(_.length)),d[h]=_[0]}l.$slots=d}}if(o&&!i)r.push(l);else for(let f=0;f<a.length;f++)r.push(a[f]);return o}function by(n,t){const e=[],r=Y(),o=$d(t),i=(b(o)?o:r).getChildren();for(let s=0;s<i.length;s++)Gs(n,t,i[s],e);return{namespace:n._config.namespace,nodes:e}}function Ty(n){const t=[];for(const e of n)t.push($p(e));return t}let Dn=null;async function Ua(n,t,e){if(Dn!==null)return!1;if(t!==null)return new Promise((a,u)=>{n.update(()=>{a(ja(n,t,e))})});const r=n.getRootElement(),o=n._window||window,i=o.document,s=Lt(o);if(r===null||s===null)return!1;const l=i.createElement("span");l.style.position="fixed",l.style.top="-1000px",l.append(i.createTextNode("#")),r.append(l);const c=i.createRange();return c.setStart(l,0),c.setEnd(l,1),s.removeAllRanges(),s.addRange(c),new Promise((a,u)=>{const f=n.registerCommand(Oi,d=>(ze(d,ClipboardEvent)&&(f(),Dn!==null&&(o.clearTimeout(Dn),Dn=null),a(ja(n,d,e))),!0),Ne);Dn=o.setTimeout(()=>{f(),Dn=null,a(!1)},50),i.execCommand("copy"),l.remove()})}function ja(n,t,e){if(e===void 0){const o=Lt(n._window),i=A();if(!i||i.isCollapsed()||!o)return!1;const s=Bt(o,n.getRootElement()),l=s.anchorNode,c=s.focusNode;if(l!==null&&c!==null&&!uo(n,l,c))return!1;e=hh(i)}t.preventDefault();const r=t.clipboardData;return r!==null&&(gh(r,e),!0)}const ky=[["text/html",uh],["application/x-lexical-editor",fh]];function hh(n=A()){return(function(t,e){const r={"text/plain":""};for(const[o,i]of Object.entries(t))if(i){const s=wy(i,e);s!==null&&(r[o]=s)}return r})(Ny(),n)}function gh(n,t){for(const[e]of ky)t[e]===void 0&&n.setData(e,"");for(const e in t){const r=t[e];r!==void 0&&n.setData(e,r)}}function Ny(n=gt()){const t=go(n,Oy.name);return t?t.output:Ey}const Ey={"application/x-lexical-editor":[(n,t)=>n?fh(gt(),n):t()],"text/html":[(n,t)=>n?uh(gt(),n):t()],"text/plain":[(n,t)=>n?n.getTextContent():t()]};function wy(n,t){const e=r=>n[r]?n[r](t,e.bind(null,r-1)):null;return e(n.length-1)}const Oy={name:"@lexical/clipboard/GetClipboardData"},$y=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function Vl(n,t){if(typeof n=="number")return Number.isFinite(n)?n:t;if(typeof n!="string"||!$y.test(n))return t;const e=Number(n);return Number.isFinite(e)?e:t}function ph(n,t,e,r,o){const i=Vl(n,t);return i>=e&&i<=r&&Number.isInteger(i)?i:t}function My(n,t){n.__tag=t.__tag}const Fy=n=>{const t=ne(n,"format"),e=ce(n,"format"),r=ae(n,"format");return{exportJSON:function(o){const i=o.__textFormat,s=o.__textStyle,l=(i!==0||s!=="")&&o.shouldSerializeTextStyles();return{children:[],tag:o.__tag,direction:o.__dir,format:t[o.__format],indent:o.__indent,textFormat:i!==0&&l?i:void 0,textStyle:s!==""&&l?s:void 0,type:o.__type,version:1}},exportCompactJSON:function(o){const i=o.__textFormat,s=o.__textStyle,l=(i!==0||s!=="")&&o.shouldSerializeTextStyles(),c={type:o.__type,children:[]},a=o.__tag;a!==void 0&&a!=="h1"&&(c.tag=a);const u=o.__dir;u!=null&&(c.direction=u);const f=t[o.__format];f!==void 0&&f!==""&&(c.format=f);const d=o.__indent;return d!==void 0&&d!==0&&(c.indent=d),i!==void 0&&i!==0&&l&&(c.textFormat=i),s!==void 0&&s!==""&&l&&(c.textStyle=s),c},updateFromJSON:function(o,i){const s=i.direction;o.__dir=s===null||s==="ltr"||s==="rtl"?s:null;const l=i.format;o.__format=typeof l=="string"&&l in e?e[l]:r,o.__indent=ph(i.indent,0,0,1/0),o.__textFormat=Vl(i.textFormat,0);const c=i.textStyle;o.__textStyle=typeof c=="string"?c:"";const a=i.tag;return o.__tag=a==="h1"||a==="h2"||a==="h3"||a==="h4"||a==="h5"||a==="h6"?a:"h1",o},afterCloneFrom:My}},Ay=n=>{const t=ne(n,"format"),e=ce(n,"format"),r=ae(n,"format");return{exportJSON:function(o){const i=o.__textFormat,s=o.__textStyle,l=(i!==0||s!=="")&&o.shouldSerializeTextStyles();return{children:[],direction:o.__dir,format:t[o.__format],indent:o.__indent,textFormat:i!==0&&l?i:void 0,textStyle:s!==""&&l?s:void 0,type:o.__type,version:1}},exportCompactJSON:function(o){const i=o.__textFormat,s=o.__textStyle,l=(i!==0||s!=="")&&o.shouldSerializeTextStyles(),c={type:o.__type,children:[]},a=o.__dir;a!=null&&(c.direction=a);const u=t[o.__format];u!==void 0&&u!==""&&(c.format=u);const f=o.__indent;return f!==void 0&&f!==0&&(c.indent=f),i!==void 0&&i!==0&&l&&(c.textFormat=i),s!==void 0&&s!==""&&l&&(c.textStyle=s),c},updateFromJSON:function(o,i){const s=i.direction;o.__dir=s===null||s==="ltr"||s==="rtl"?s:null;const l=i.format;o.__format=typeof l=="string"&&l in e?e[l]:r,o.__indent=ph(i.indent,0,0,1/0),o.__textFormat=Vl(i.textFormat,0);const c=i.textStyle;return o.__textStyle=typeof c=="string"?c:"",o}}},Ja=P("DRAG_DROP_PASTE_FILE"),fs=ur("shadowRoot",{parse:fl()});let ql=class extends yt{$config(){return this.config("quote",{extends:yt,generated:Ay,importDOM:{blockquote:()=>({conversion:Py,priority:0})},stateConfigs:[{flat:!0,stateConfig:fs}]})}isShadowRoot(){return Kr(this,fs)}setIsShadowRoot(t){return fr(this,fs,t)}createDOM(t){const e=ot().createElement("blockquote");return Fe(e,t.theme.quote),e}updateDOM(t,e,r){return!1}exportDOM(t){const{element:e}=super.exportDOM(t);if(q(e)){this.isEmpty()&&e.append(ot().createElement("br"));const r=this.getFormatType();r&&(e.style.textAlign=r);const o=this.getDirection();o&&(e.dir=o)}return{element:e}}static importJSON(t){return Gl().updateFromJSON(t)}insertNewAfter(t,e){const r=tt();r.setTextFormat(t.format),r.setTextStyle(t.style);const o=this.getDirection();return r.setDirection(o),r.setFormat(this.getFormatType()),r.setStyle(this.getStyle()),this.insertAfter(r,e),r}collapseAtStart(){if(this.isShadowRoot()){for(const e of this.getChildren())this.insertBefore(e);return this.remove(),!0}const t=tt();return this.getChildren().forEach(e=>t.append(e)),this.replace(t),!0}canMergeWhenEmpty(){return!0}};function Gl(n){const t=fe(new ql);return n&&n.shadowRoot?t.setIsShadowRoot(!0):t}function bi(n){return n instanceof ql}const Dy=xe()({tag:Mt(dn(["h1","h2","h3","h4","h5","h6"]),{field:"__tag"})});let Wi=class extends yt{constructor(e="h1",r){super(r);k(this,"__tag");this.__tag=e}$config(){return this.config("heading",{extends:yt,generated:Fy,importDOM:{h1:()=>({conversion:Pn,priority:0}),h2:()=>({conversion:Pn,priority:0}),h3:()=>({conversion:Pn,priority:0}),h4:()=>({conversion:Pn,priority:0}),h5:()=>({conversion:Pn,priority:0}),h6:()=>({conversion:Pn,priority:0}),p:e=>{const r=e.firstChild;return r!==null&&Ha(r)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Ha(e)?{conversion:()=>({node:Ti("h1")}),priority:3}:null},json:Dy})}getTag(){return this.getLatest().__tag}setTag(e){const r=this.getWritable();return r.__tag=e,r}createDOM(e){const r=this.__tag,o=ot().createElement(r),i=e.theme.heading;if(i!==void 0){const s=i[r];Fe(o,s)}return o}updateDOM(e,r,o){return e.__tag!==this.__tag}exportDOM(e){const{element:r}=super.exportDOM(e);if(q(r)){this.isEmpty()&&r.append(ot().createElement("br"));const o=this.getFormatType();o&&(r.style.textAlign=o);const i=this.getDirection();i&&(r.dir=i)}return{element:r}}insertNewAfter(e,r=!0){const o=e?e.anchor.offset:0,i=this.getLastDescendant(),s=!i||e&&e.anchor.key===i.getKey()&&o===i.getTextContentSize()||!e?tt():Ti(this.getTag()).setFormat(this.getFormatType()).setStyle(this.getStyle()),l=this.getDirection();if(s.setDirection(l),this.insertAfter(s,r),o===0&&!this.isEmpty()&&e){const c=tt();c.select(),this.replace(c,!0)}return s}collapseAtStart(){if(this.isEmpty()){const e=tt();this.getChildren().forEach(r=>e.append(r)),this.replace(e)}return!0}extractWithChild(){return!0}};function Ha(n){return n.nodeName.toLowerCase()==="span"&&n.style.fontSize==="26pt"}function Pn(n){const t=n.nodeName.toLowerCase();let e=null;return t!=="h1"&&t!=="h2"&&t!=="h3"&&t!=="h4"&&t!=="h5"&&t!=="h6"||(e=Ti(t),Il(n,e),Li(e,n),ho(e,n)),{node:e}}function Py(n){const t=Gl();return Li(t,n),Il(n,t),ho(t,n),{node:t}}function Ti(n="h1"){return fe(new Wi(n))}function Yl(n){return n instanceof Wi}function Va(n){const t=yn(n);return J(t)}function _h(n){const t=n.focus;return t.key==="root"&&t.offset===Y().getChildrenSize()}function mh(n){const t=n.focus;return t.key==="root"&&t.offset===0}function qa(n,t){if(!n.isCollapsed())return!1;const e=t==="next";if(!(e?_h(n):mh(n)))return!1;const r=n.focus.offset;return Qr(Y().getChildAtIndex(e?r-1:r))}function In(n,t,e,r){let o=!1,i=null;if(n.isCollapsed()&&n.anchor.type==="text"){const l=n.anchor.getNode();if(M(l)){i=l;const c=n.anchor.offset,a=c===l.getTextContentSize()&&l.getNextSibling()===null,u=c===0&&l.getPreviousSibling()===null;o=e==="end"&&a||e==="start"&&u||e==="both"&&(a||u)}}let s=!1;for(const[l,c]of Object.entries(r)){if(c==null||!c[t])continue;const a=l;if(c.onlyAtBoundary){if(!(o&&i&&M(i)&&i.hasFormat(a)))continue;s=!0}n.hasFormat(a)&&n.toggleFormat(a)}s&&n.setStyle("")}const Iy={capitalize:{enter:!0,space:!0,tab:!0},lowercase:{enter:!0,space:!0,tab:!0},uppercase:{enter:!0,space:!0,tab:!0}};function No(n,t){return(function(e,r){if(!e.isCollapsed())return!1;const o=Wt(e.focus,r),i=vt(o.origin,Dr);if(!i)return!1;const s=e.focus.getNode();if(!i.is(s)&&!or(s,i))return!1;const l=Zt(o,X(i,r));if(l.getTextSlices().some(f=>f&&f.getTextContentSize()>0))return!1;const c=Zt(l.anchor.getSiblingCaret(),l.focus);let a=c.anchor.origin;for(const f of c){if(!Ge(f)||!f.origin.is(a.getParent()))return!1;a=f.origin}let u=i;for(const f of zi(X(i,r))){if(!f.origin.is(u.getParent())){if(Qr(f.origin)){const d=X(u,r);return er(Zt(d,d)),!0}break}if(!Dr(f.origin))break;u=f.origin}return!1})(n,t)||(function(e,r){if(!e.isCollapsed()||e.anchor.type!=="element")return!1;const o=Wt(e.anchor,r).getNodeAtCaret();return!(!Dr(o)||o.isInline()||(er(Bi(Pt(It(o,r)))),0))})(n,t)}function Ga(n){return J(n)&&!n.isInline()&&!n.isIsolated()&&n.isKeyboardSelectable()}function Eo(n){const t=bl();t.add(n),St(t)}function Ya(n,t){if(!n.isCollapsed())return!1;const e=n.focus,r=e.getNode(),o=t?"previous":"next",i=Wt(e,o);if(e.type==="element"&&b(r)&&Z(r)){const p=i.getNodeAtCaret();return!(p===null||!Ga(p))&&(Eo(p.__key),!0)}const s=vt(b(r)?r:r.getParentOrThrow(),p=>b(p)&&!p.isInline()&&Z(p.getParent()));if(s===null)return!1;const l=X(s,o).getNodeAtCaret();if(l===null||!Ga(l))return!1;if(s.getTextContentSize()===0)return Eo(l.__key),!0;const c=gt().getRootElement();if(c===null)return!1;const a=Lt(c.ownerDocument.defaultView);if(a===null||a.rangeCount===0)return!1;const u=a.anchorNode,f=a.anchorOffset,d=a.focusNode,h=a.focusOffset;a.modify("move",t?"backward":"forward","line");const g=a.anchorNode,_=a.anchorOffset;if(g===null)return Xa(a,u,f,d,h),!1;const m=yn(g);return Xa(a,u,f,d,h),m===null?!1:(g===u&&_===f||!m.is(s)&&!or(m,s))&&(Eo(l.__key),!0)}function Xa(n,t,e,r,o){t!==null&&r!==null&&n.setBaseAndExtent(t,e,r,o)}function Qa(n,t){if(!n.isCollapsed())return!1;const e=n.focus.getNode(),r=vt(b(e)?e:e.getParentOrThrow(),m=>b(m)&&!m.isInline());if(r===null)return!1;const o=gt(),i=o.getRootElement();if(i===null)return!1;const s=i.ownerDocument.defaultView;if(s===null)return!1;let l=!1;for(const m of r.getChildren())if(b(m)&&m.isInline()){const p=o.getElementByKey(m.getKey());if(p!==null){const y=s.getComputedStyle(p).display;if(y==="inline-grid"||y==="inline-flex"){l=!0;break}}}if(!l)return!1;const c=X(r,t?"previous":"next").getNodeAtCaret();if(c===null||!b(c)){if(t){const m=r.getFirstDescendant();M(m)?m.select(0,0):r.select(0,0)}else{const m=r.getLastDescendant();if(M(m)){const p=m.getTextContentSize();m.select(p,p)}else{const p=r.getChildrenSize();r.select(p,p)}}return!0}const a=o.getElementByKey(c.getKey());if(a===null)return!1;const u=Lt(s);if(u===null||u.rangeCount===0)return!1;const f=u.getRangeAt(0).cloneRange();f.collapse(!0);const d=f.getBoundingClientRect(),h=a.getBoundingClientRect(),g=h.top+h.height/2;if(d.height>0){const m=Si(d.left,g,i);if(m!==null&&a.contains(m.node)){const p=i.ownerDocument.createRange();return p.setStart(m.node,m.offset),p.collapse(!0),n.applyDOMRange(p),n.dirty=!0,!0}}const _=t?c.getLastDescendant():c.getFirstDescendant();if(M(_)){const m=t?_.getTextContentSize():0;_.select(m,m)}else{const m=c.getChildrenSize();c.select(t?m:0,t?m:0)}return!0}function wo(n,t){const e=X(n,t),r=e.getAdjacentCaret();r!==null&&b(r.origin)&&!r.origin.isInline()&&r.origin.isShadowRoot()?er(Bi(e)):t==="next"?n.selectNext(0,0):n.selectPrevious()}function Oo(n,t){const e=n.getNodes().map(i=>X(i,"next")).sort(Xe),r=e[0],o=e[e.length-1];if(!r||!o)return!1;for(let i=0;i<e.length-1;i++)if(!e[i+1].origin.is(e[i].getNodeAtCaret()))return!1;return er(ao(Zt(Qe(r),o),t)),Mp(),!0}function Za(n,t,e){e.preventDefault(),e.stopPropagation();const r=n.getNodes();if(r.length===0)return!0;const o=r.map(c=>X(c,"next")).sort(Xe),i=(t?o[0]:o[o.length-1]).origin,s=vt(i,c=>c!==i&&b(c)&&!c.isInline())??Y(),l=t?0:s.getChildrenSize();return s.select(l,l),!0}function Ly(n,t){return n.length>0&&!t}function Ry(n,t=Us(Iy),e=Us(Ly)){return jt(n.registerCommand(af,r=>{const o=A();if(ct(o)){const i=r.target;if(q(i))for(const s of o.getNodes()){const l=n.getElementByKey(s.getKey());if(l!==null&&l.contains(i))return!1}return o.clear(),!0}return O(o)&&In(o,"click","both",t.peek()),!1},K),n.registerCommand(an,r=>{const o=A();return O(o)?(o.deleteCharacter(r),!0):!!ct(o)&&(o.deleteNodes(),!0)},K),n.registerCommand(Hr,r=>{const o=A();return!!O(o)&&(o.deleteWord(r),!0)},K),n.registerCommand(Kn,r=>{const o=A();return!!O(o)&&(o.deleteLine(r),!0)},K),n.registerCommand(Bn,r=>{const o=A();if(typeof r=="string")o!==null&&o.insertText(r);else{if(o===null)return!1;const i=r.dataTransfer;if(i!=null)qs(i,o);else if(O(o)){const s=r.data;return s&&o.insertText(s),!0}}return!0},K),n.registerCommand(Fo,()=>{const r=A();return!!O(r)&&(r.removeText(),!0)},K),n.registerCommand(Le,r=>{const o=A();return!(!O(o)&&!ct(o))&&(Rf(o,r),!0)},K),n.registerCommand(wg,r=>{const o=A();return!(!O(o)&&!ct(o))&&(Cp(o,r),!0)},K),n.registerCommand(Mg,r=>{const o=A();if(!O(o)&&!ct(o))return!1;const i=o.getNodes();for(const s of i){const l=vt(s,c=>b(c)&&!c.isInline());l!==null&&l.setFormat(r)}return!0},K),n.registerCommand(zn,r=>{const o=A();return!!O(o)&&(o.insertLineBreak(r),!0)},K),n.registerCommand(Jr,()=>{const r=A();return!!O(r)&&(r.insertParagraph(),!0)},K),n.registerCommand(Og,()=>{const r=lo(),o=A();return O(o)&&(r.setFormat(o.format),r.setStyle(o.style)),Np([r]),!0},K),n.registerCommand($g,()=>Sa(r=>{const o=r.getIndent();r.setIndent(o+1)}),K),n.registerCommand(vc,()=>Sa(r=>{const o=r.getIndent();o>0&&r.setIndent(Math.max(0,o-1))}),K),n.registerCommand(hl,r=>{let o=A();if(ct(o)){const i=o.getNodes();if(i.length>0){if(!r.shiftKey||!Oo(o,"previous"))return r.preventDefault(),wo(i[0],"previous"),!0;o=A()}}return O(o)&&(mh(o)||!r.shiftKey&&No(o,"previous")||!r.shiftKey&&Ya(o,!0)||!r.shiftKey&&Qa(o,!0))?(r.preventDefault(),!0):!1},K),n.registerCommand(gl,r=>{let o=A();if(ct(o)){const i=o.getNodes();if(i.length>0){if(!r.shiftKey||!Oo(o,"next"))return r.preventDefault(),wo(i[0],"next"),!0;o=A()}}return O(o)&&(_h(o)||!r.shiftKey&&No(o,"next")||!r.shiftKey&&Ya(o,!1)||!r.shiftKey&&Qa(o,!1))?(r.preventDefault(),!0):!1},K),n.registerCommand(_f,r=>{let o=A();if(ct(o)){const s=o.getNodes();if(s.length>0){const l=So(s[0])?"next":"previous";if(!r.shiftKey||!Oo(o,l))return r.preventDefault(),wo(s[0],l),!0;o=A()}}if(!O(o))return!1;const i=So(o.anchor.getNode())?"next":"previous";if(qa(o,i)||!r.shiftKey&&No(o,i))return r.preventDefault(),!0;if(r.shiftKey||In(o,"arrow","start",t.peek()),xa(o,!0)){const s=r.shiftKey;return r.preventDefault(),va(o,s,!0),!0}return!1},K),n.registerCommand(pf,r=>{let o=A();if(ct(o)){const s=o.getNodes();if(s.length>0){const l=So(s[0])?"previous":"next";if(!r.shiftKey||!Oo(o,l))return r.preventDefault(),wo(s[0],l),!0;o=A()}}if(!O(o))return!1;const i=So(o.anchor.getNode())?"previous":"next";if(qa(o,i)||!r.shiftKey&&No(o,i))return r.preventDefault(),!0;if(r.shiftKey||In(o,"arrow","end",t.peek()),xa(o,!1)){const s=r.shiftKey;return r.preventDefault(),va(o,s,!1),!0}return!1},K),n.registerCommand(pl,r=>{const o=A();if(!ct(o)&&Va(r.target))return!1;if(O(o)){if((function(i){if(!i.isCollapsed())return!1;const{anchor:s}=i;if(s.offset!==0)return!1;const l=s.getNode();if(ut(l))return!1;const c=J_(l);return c.getIndent()>0&&(c.is(l)||l.is(c.getFirstDescendant()))})(o))return r.preventDefault(),n.dispatchCommand(vc);if($e&&Xn)return!1}else if(!ct(o))return!1;return r.preventDefault(),n.dispatchCommand(an,!0)},K),n.registerCommand(yf,r=>{const o=A();return!(!ct(o)&&Va(r.target))&&!(!O(o)&&!ct(o))&&(r.preventDefault(),n.dispatchCommand(an,!1))},K),n.registerCommand(so,r=>{let o=A();if(ct(o)){const i=o.getNodes();i.length===1&&J(i[0])&&!i[0].isInline()&&(o=i[0].selectNext())}if(!O(o))return!1;if(In(o,"enter","both",t.peek()),r!==null){if(($e||oo||io)&&Xn)return!1;if(r.preventDefault(),r.shiftKey)return n.dispatchCommand(zn,!1)}return n.dispatchCommand(Jr)},K),n.registerCommand(_l,()=>{const r=A();return!!O(r)&&(n.blur(),!0)},K),n.registerCommand(yl,r=>{const[,o]=Co(r);if(o.length>0){const i=r.clientX,s=r.clientY,l=Si(i,s,n.getRootElement());if(l!==null){const{offset:c,node:a}=l,u=yn(a);if(u!==null){const f=Cl();if(M(u))f.anchor.set(u.getKey(),c,"text"),f.focus.set(u.getKey(),c,"text");else{const h=u.getParentOrThrow().getKey(),g=u.getIndexWithinParent()+1;f.anchor.set(h,g,"element"),f.focus.set(h,g,"element")}const d=dl(f);St(d)}}return n.dispatchCommand(Ja,o),r.preventDefault(),!0}return Cy(r,n)},K),n.registerCommand(xf,r=>{const[o]=Co(r),i=A();return!(o&&!O(i))&&(O(i)&&!i.isCollapsed()&&r.dataTransfer!==null&&(gh(r.dataTransfer,hh(i)),vy(r.dataTransfer,n)),!0)},K),n.registerCommand(xl,r=>{const[o]=Co(r),i=A();if(o&&!O(i))return!1;const s=r.clientX,l=r.clientY,c=Si(s,l,n.getRootElement());if(c!==null){const a=yn(c.node);J(a)&&r.preventDefault()}return!0},K),n.registerCommand(vf,()=>{const r=A();return Zp(O(r)&&to(r.anchor.getNode())!==null?r:null),!0},K),n.registerCommand(Oi,r=>(Ua(n,ze(r,ClipboardEvent)?r:null),!0),K),n.registerCommand(vl,r=>((async function(o,i){i.update(()=>{const s=A();O(s)&&!s.isCollapsed()&&Po(s)},{discrete:!0,tag:$s}),await Ua(i,ze(o,ClipboardEvent)?o:null),i.update(()=>{const s=A();O(s)?s.removeText():ct(s)&&s.getNodes().forEach(l=>l.remove())},{tag:$s})})(r,n),!0),K),n.registerCommand(wi,r=>{const[,o,i]=Co(r);return e.peek()(o,i)&&n.dispatchCommand(Ja,o)?!0:pr(r.target)&&Ol(r.target)?!1:A()!==null&&((function(s,l){s.preventDefault(),l.update(()=>{const c=A(),a=ze(s,InputEvent)||ze(s,KeyboardEvent)?null:s.clipboardData;a!=null&&c!==null&&qs(a,c)},{tag:$f})})(r,n),!0)},K),n.registerCommand(mf,()=>{const r=A();return O(r)&&In(r,"space","both",t.peek()),!1},K),n.registerCommand(ml,()=>{const r=A();return O(r)&&In(r,"tab","both",t.peek()),!1},K),n.registerCommand(Ns,r=>{const o=A();if(ct(o))return Za(o,!1,r);if(!O(o))return!1;const{anchor:i}=o;if(i.type!=="element"||i.offset!==0)return!1;const s=i.getNode();if(!b(s))return!1;const l=s.getFirstChild();if(!J(l)||!l.isInline())return!1;const c=s.getKey(),a=s.selectEnd();return r.shiftKey&&a.anchor.set(c,0,"element"),r.preventDefault(),r.stopPropagation(),!0},K),n.registerCommand(Es,r=>{const o=A();if(ct(o))return Za(o,!0,r);if(!O(o))return!1;const{anchor:i,focus:s}=o,l=vt(s.getNode(),u=>b(u)&&!u.isInline());if(l===null)return!1;const c=l.getFirstChild();if(!J(c)||!c.isInline()||vt(i.getNode(),u=>b(u)&&!u.isInline())!==l)return!1;const a=l.getKey();return(s.type!=="element"||s.key!==a||s.offset!==0)&&(o.focus.set(a,0,"element"),r.shiftKey||o.anchor.set(a,0,"element"),r.preventDefault(),r.stopPropagation(),!0)},K))}function zy(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function By(n,t){const[e,r]=z.useMemo(()=>[s=>n.registerDecoratorListener(s),()=>n.getDecorators()],[n]),o=z.useSyncExternalStore(e,r,r),i=(function(s){const[l,c]=z.useMemo(()=>[s.registerRootListener.bind(s),s.getRootElement.bind(s)],[s]);return z.useSyncExternalStore(l,c,c)})(n);return z.useMemo(()=>{const s=c=>n._onError(c),l=[];for(const c in o){const a=n.getElementByKey(c);if(a!==null){const u=lt.jsx(t,{onError:s,children:lt.jsx(z.Suspense,{fallback:null,children:o[c]})});l.push(qh.createPortal(u,a,c))}}return l},[t,o,n,i])}function Ky({editor:n,ErrorBoundary:t}){return By(n,t)}function Wy({editor:n,ErrorBoundary:t}){return(function(e){const r=Vn.maybeFromEditor(e);if(r&&r.hasExtensionByName(ay.name)){for(const o of["@lexical/plain-text","@lexical/rich-text"])r.hasExtensionByName(o)&&zy(320,o);return!0}return!1})(n)?null:lt.jsx(Ky,{editor:n,ErrorBoundary:t})}const yh=ee?z.useLayoutEffect:z.useEffect;function tu(n){return n.read("latest",ah(n.isComposing()))}function Uy({contentEditable:n,placeholder:t=null,ErrorBoundary:e}){const[r]=de();return(function(o){yh(()=>jt(Ry(o),hy(o)),[o])})(r),lt.jsxs(lt.Fragment,{children:[n,lt.jsx(jy,{content:t}),lt.jsx(Wy,{editor:r,ErrorBoundary:e})]})}function jy({content:n}){const[t]=de(),e=(function(o){const[i,s]=z.useState(()=>tu(o));return yh(()=>{function l(){const c=tu(o);s(c)}return l(),jt(o.registerUpdateListener(()=>{l()}),o.registerEditableListener(()=>{l()}))},[o]),i})(t),r=cy();return e?typeof n=="function"?n(r):n:null}function Jy(n,t){let e=n;for(let r=X(n,t);r&&(Sh(r.origin)||pn(r.origin));r=r.getAdjacentCaret())e=r.origin;return e}function Hy(n){return Jy(n,"previous")}const Vy=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function ki(n,t){if(typeof n=="number")return Number.isFinite(n)?n:t;if(typeof n!="string"||!Vy.test(n))return t;const e=Number(n);return Number.isFinite(e)?e:t}const qy=n=>{const t=ne(n,"format"),e=ce(n,"format"),r=ae(n,"format");return{exportJSON:function(o){const i=o.__textFormat,s=o.__textStyle,l=(i!==0||s!=="")&&o.shouldSerializeTextStyles();return{children:[],language:o.__language,theme:o.__theme,direction:o.__dir,format:t[o.__format],indent:o.__indent,textFormat:i!==0&&l?i:void 0,textStyle:s!==""&&l?s:void 0,type:o.__type,version:1}},exportCompactJSON:function(o){const i=o.__textFormat,s=o.__textStyle,l=(i!==0||s!=="")&&o.shouldSerializeTextStyles(),c={type:o.__type,children:[]},a=o.__language;a!==void 0&&(c.language=a);const u=o.__theme;u!==void 0&&(c.theme=u);const f=o.__dir;f!=null&&(c.direction=f);const d=t[o.__format];d!==void 0&&d!==""&&(c.format=d);const h=o.__indent;return h!==void 0&&h!==0&&(c.indent=h),i!==void 0&&i!==0&&l&&(c.textFormat=i),s!==void 0&&s!==""&&l&&(c.textStyle=s),c},updateFromJSON:function(o,i){const s=i.direction;o.__dir=s===null||s==="ltr"||s==="rtl"?s:null;const l=i.format;o.__format=typeof l=="string"&&l in e?e[l]:r,o.__indent=(function(f,d,h,g){const _=ki(f,d);return _>=h&&_<=g&&Number.isInteger(_)?_:d})(i.indent,0,0,1/0),o.__textFormat=ki(i.textFormat,0);const c=i.textStyle;o.__textStyle=typeof c=="string"?c:"";const a=i.language;o.setLanguage(a==null||typeof a=="string"?a:"");const u=i.theme;return o.setTheme(u===void 0?void 0:typeof u=="string"?u:""),o}}};function Gy(n,t){n.__highlightType=t.__highlightType}const Yy=n=>{const t=ne(n,"mode"),e=Zn(n,"detail",0),r=Zn(n,"format",0),o=ce(n,"mode"),i=ae(n,"mode");return{exportJSON:function(s){return{highlightType:s.__highlightType,detail:s.__detail,format:s.__format,mode:t[s.__mode],style:s.__style,text:s.__text,type:s.__type,version:1}},exportCompactJSON:function(s){const l={type:s.__type},c=s.__highlightType;c!==void 0&&(l.highlightType=c);const a=s.__detail;a!==void 0&&a!==0&&(l.detail=a);const u=s.__format;u!==void 0&&u!==0&&(l.format=u);const f=t[s.__mode];f!==void 0&&f!=="normal"&&(l.mode=f);const d=s.__style;d!==void 0&&d!==""&&(l.style=d);const h=s.__text;return h!==void 0&&h!==""&&(l.text=h),l},updateFromJSON:function(s,l){const c=l.detail;s.__detail=typeof c=="string"&&c in e?e[c]:ki(c,0);const a=l.format;s.setFormat(typeof a=="string"&&a in r?r[a]:ki(a,0));const u=l.mode;s.__mode=typeof u=="string"&&u in o?o[u]:i;const f=l.style;s.__style=typeof f=="string"?f:"";const d=l.text;s.__text=typeof d=="string"?d:"";const h=l.highlightType;return s.setHighlightType(h==null||typeof h=="string"?h:""),s},afterCloneFrom:Gy}},Xy=xe()({language:ie(Jo($r(re())),{getter:{field:"__language"}}),theme:ie(Jo(re()),{getter:{field:"__theme"}})});function xh(n,t){for(const e of n.childNodes)if(q(e)&&e.tagName===t||xh(e,t))return!0;return!1}const Er="data-language",Nr="data-highlight-language",wr="data-theme";let Xl=class extends yt{constructor(e=void 0,r){super(r);k(this,"__language");k(this,"__theme");k(this,"__isSyntaxHighlightSupported");this.__language=e||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}$config(){return this.config("code",{extends:yt,generated:qy,importDOM:{code:e=>e.textContent!=null&&(/\r?\n/.test(e.textContent)||xh(e,"BR"))?{conversion:eu,priority:1}:null,div:()=>({conversion:Qy,priority:1}),pre:()=>({conversion:eu,priority:0}),table:e=>ds(e)?{conversion:Zy,priority:3}:null,td:e=>{const r=e,o=r.closest("table");return r.classList.contains("js-file-line")||o&&ds(o)?{conversion:nu,priority:3}:null},tr:e=>{const r=e.closest("table");return r&&ds(r)?{conversion:nu,priority:3}:null}},json:Xy})}afterCloneFrom(e){super.afterCloneFrom(e),(function(r,o){r.__language=o.__language,r.__theme=o.__theme})(this,e),this.__isSyntaxHighlightSupported=e.__isSyntaxHighlightSupported}createDOM(e){const r=ot().createElement("code");Fe(r,e.theme.code),r.setAttribute("spellcheck","false");const o=this.getLanguage();o&&(r.setAttribute(Er,o),this.getIsSyntaxHighlightSupported()&&r.setAttribute(Nr,o));const i=this.getTheme();i&&r.setAttribute(wr,i);const s=this.getStyle();return s&&jn(r.style,s),r}updateDOM(e,r,o){const i=this.__language,s=e.__language;i?i!==s&&r.setAttribute(Er,i):s&&r.removeAttribute(Er);const l=this.__isSyntaxHighlightSupported;e.__isSyntaxHighlightSupported&&s?l&&i?i!==s&&r.setAttribute(Nr,i):r.removeAttribute(Nr):l&&i&&r.setAttribute(Nr,i);const c=this.__theme,a=e.__theme;c?c!==a&&r.setAttribute(wr,c):a&&r.removeAttribute(wr);const u=this.__style,f=e.__style;return u!==f&&jn(r.style,u,f),!1}exportDOM(e){const r=ot().createElement("pre");Fe(r,e._config.theme.code),r.setAttribute("spellcheck","false");const o=this.getLanguage();o&&(r.setAttribute(Er,o),this.getIsSyntaxHighlightSupported()&&r.setAttribute(Nr,o));const i=this.getTheme();i&&r.setAttribute(wr,i);const s=this.getStyle();return s&&jn(r.style,s),{element:r}}insertNewAfter(e,r=!0){if(!go(gt(),"@lexical/code")){const l=tx(e);if(l)return l}const{anchor:o,focus:i}=e,s=(o.isBefore(i)?o:i).getNode();if(M(s)){let l=Hy(s);const c=[];for(;;)if(pn(l))c.push(lo()),l=l.getNextSibling();else{if(!Sh(l))break;{let _=0;const m=l.getTextContent(),p=l.getTextContentSize();for(;_<p&&m[_]===" ";)_++;if(_!==0&&c.push(nx(" ".repeat(_))),_!==p)break;l=l.getNextSibling()}}const a=s.splitText(o.offset)[0],u=o.offset===0?0:1,f=a.getIndexWithinParent()+u,d=s.getParentOrThrow(),h=[Ve(),...c];d.splice(f,0,h);const g=c[c.length-1];g?g.select():o.offset===0?a.selectPrevious():a.getNextSibling().selectNext(0,0)}if(cr(s)){const{offset:l}=e.anchor;s.splice(l,0,[Ve()]),s.select(l+1,l+1)}return null}canIndent(){return!1}collapseAtStart(){const e=tt();return this.getChildren().forEach(r=>e.append(r)),this.replace(e),!0}setLanguage(e){const r=this.getWritable();return r.__language=e||void 0,r}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(e){const r=this.getWritable();return r.__isSyntaxHighlightSupported=e,r}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(e){const r=this.getWritable();return r.__theme=e||void 0,r}getTheme(){return this.getLatest().__theme}};function Be(n,t){return Ed(Xl).setLanguage(n).setTheme(t)}function cr(n){return n instanceof Xl}function eu(n){return{node:Be(n.getAttribute(Er),n.getAttribute(wr))}}function Qy(n){const t=n,e=ru(t);return e||(function(r){let o=r.parentElement;for(;o!==null;){if(ru(o))return!0;o=o.parentElement}return!1})(t)?{node:e?Be():null}:{node:null}}function Zy(){return{node:Be()}}function nu(){return{node:null}}function ru(n){return n.style.fontFamily.match("monospace")!==null}function ds(n){return n.classList.contains("js-file-line-container")}function tx(n){const{anchor:t}=n;if(n.isCollapsed()&&t.type==="element"){const e=t.getNode();if(cr(e)){const r=e.getChildrenSize();if(r>=2&&t.offset===r){const o=e.getLastChild();if(Nt(o)&&Nt(o.getPreviousSibling())){const i=tt();return e.splice(r-2,2,[]).insertAfter(i,!1),i.select(),i}}}}return null}const ex=xe()({highlightType:ie(Jo($r(re())),{getter:{field:"__highlightType"}})});let vh=class extends se{constructor(e="",r,o){super(e,o);k(this,"__highlightType");this.__highlightType=r}$config(){return this.config("code-highlight",{extends:se,generated:Yy,json:ex})}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){const r=this.getWritable();return r.__highlightType=e||void 0,r}canHaveFormat(){return!1}createDOM(e){const r=super.createDOM(e),o=hs(e.theme,this.__highlightType);return Fe(r,o),r}updateDOM(e,r,o){const i=super.updateDOM(e,r,o),s=hs(o.theme,e.__highlightType),l=hs(o.theme,this.__highlightType);return s!==l&&(s&&Wl(r,s),l&&Fe(r,l)),i}setFormat(e){return this}isParentRequired(){return!0}createParentElementNode(){return Be()}};function hs(n,t){return t&&n&&n.codeHighlight&&n.codeHighlight[t]}function nx(n="",t){return fe(new vh(n,t))}function Sh(n){return n instanceof vh}const rx=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function Ql(n,t){if(typeof n=="number")return Number.isFinite(n)?n:t;if(typeof n!="string"||!rx.test(n))return t;const e=Number(n);return Number.isFinite(e)?e:t}function Ch(n,t,e,r,o){const i=Ql(n,t);return i>=e&&i<=r&&Number.isInteger(i)?i:t}function ox(n,t){n.__rel=t.__rel,n.__target=t.__target,n.__title=t.__title,n.__url=t.__url}const ix=n=>{const t=ne(n,"format"),e=ce(n,"format"),r=ae(n,"format");return{exportJSON:function(o){const i=o.__textFormat,s=o.__textStyle,l=(i!==0||s!=="")&&o.shouldSerializeTextStyles();return{children:[],rel:o.__rel,target:o.__target,title:o.__title,url:o.__url,direction:o.__dir,format:t[o.__format],indent:o.__indent,textFormat:i!==0&&l?i:void 0,textStyle:s!==""&&l?s:void 0,type:o.__type,version:1}},exportCompactJSON:function(o){const i=o.__textFormat,s=o.__textStyle,l=(i!==0||s!=="")&&o.shouldSerializeTextStyles(),c={type:o.__type,children:[]},a=o.__rel;a!=null&&(c.rel=a);const u=o.__target;u!=null&&(c.target=u);const f=o.__title;f!=null&&(c.title=f);const d=o.__url;d!==void 0&&d!==""&&(c.url=d);const h=o.__dir;h!=null&&(c.direction=h);const g=t[o.__format];g!==void 0&&g!==""&&(c.format=g);const _=o.__indent;return _!==void 0&&_!==0&&(c.indent=_),i!==void 0&&i!==0&&l&&(c.textFormat=i),s!==void 0&&s!==""&&l&&(c.textStyle=s),c},updateFromJSON:function(o,i){const s=i.direction;o.__dir=s===null||s==="ltr"||s==="rtl"?s:null;const l=i.format;o.__format=typeof l=="string"&&l in e?e[l]:r,o.__indent=Ch(i.indent,0,0,1/0),o.__textFormat=Ql(i.textFormat,0);const c=i.textStyle;o.__textStyle=typeof c=="string"?c:"";const a=i.rel;o.__rel=typeof a=="string"&&a!==""?a:null;const u=i.target;o.__target=typeof u=="string"&&u!==""?u:null;const f=i.title;o.__title=typeof f=="string"&&f!==""?f:null;const d=i.url;return o.__url=typeof d=="string"?d:"",o},afterCloneFrom:ox}};function sx(n,t){n.__isUnlinked=t.__isUnlinked}const lx=n=>{const t=ne(n,"format"),e=ce(n,"format"),r=ae(n,"format");return{exportJSON:function(o){const i=o.__textFormat,s=o.__textStyle,l=(i!==0||s!=="")&&o.shouldSerializeTextStyles();return{children:[],isUnlinked:o.__isUnlinked,rel:o.__rel,target:o.__target,title:o.__title,url:o.__url,direction:o.__dir,format:t[o.__format],indent:o.__indent,textFormat:i!==0&&l?i:void 0,textStyle:s!==""&&l?s:void 0,type:o.__type,version:1}},exportCompactJSON:function(o){const i=o.__textFormat,s=o.__textStyle,l=(i!==0||s!=="")&&o.shouldSerializeTextStyles(),c={type:o.__type,children:[]},a=o.__isUnlinked;a!==void 0&&a!==!1&&(c.isUnlinked=a);const u=o.__rel;u!=null&&(c.rel=u);const f=o.__target;f!=null&&(c.target=f);const d=o.__title;d!=null&&(c.title=d);const h=o.__url;h!==void 0&&h!==""&&(c.url=h);const g=o.__dir;g!=null&&(c.direction=g);const _=t[o.__format];_!==void 0&&_!==""&&(c.format=_);const m=o.__indent;return m!==void 0&&m!==0&&(c.indent=m),i!==void 0&&i!==0&&l&&(c.textFormat=i),s!==void 0&&s!==""&&l&&(c.textStyle=s),c},updateFromJSON:function(o,i){const s=i.direction;o.__dir=s===null||s==="ltr"||s==="rtl"?s:null;const l=i.format;o.__format=typeof l=="string"&&l in e?e[l]:r,o.__indent=Ch(i.indent,0,0,1/0),o.__textFormat=Ql(i.textFormat,0);const c=i.textStyle;o.__textStyle=typeof c=="string"?c:"";const a=i.rel;o.__rel=typeof a=="string"&&a!==""?a:null;const u=i.target;o.__target=typeof u=="string"&&u!==""?u:null;const f=i.title;o.__title=typeof f=="string"&&f!==""?f:null;const d=i.url;o.__url=typeof d=="string"?d:"";const h=i.isUnlinked;return o.__isUnlinked=typeof h=="boolean"&&h,o},afterCloneFrom:sx}},ou=new Set(["http:","https:","mailto:","sms:","tel:"]),cx=xe()({rel:Mt($r(re(),{defaultAsNull:!0}),{field:"__rel"}),target:Mt($r(re(),{defaultAsNull:!0}),{field:"__target"}),title:Mt($r(re(),{defaultAsNull:!0}),{field:"__title"}),url:Mt(re(),{field:"__url",getter:"getURL",setter:"setURL"})});let no=class extends yt{constructor(e="",r={},o){super(o);k(this,"__url");k(this,"__target");k(this,"__rel");k(this,"__title");const{target:i=null,rel:s=null,title:l=null}=r;this.__url=e,this.__target=i,this.__rel=s,this.__title=l}$config(){return this.config("link",{extends:yt,generated:ix,importDOM:{a:()=>({conversion:ax,priority:1})},json:cx})}createDOM(e){const r=ot().createElement("a");return this.updateLinkDOM(null,r,e),Fe(r,e.theme.link),r}updateLinkDOM(e,r,o){if(Cd(r)){e&&e.__url===this.__url||(r.href=this.sanitizeUrl(this.__url));for(const i of["target","rel","title"]){const s=`__${i}`,l=this[s];e&&e[s]===l||(l?r[i]=l:r.removeAttribute(i))}}}updateDOM(e,r,o){return this.updateLinkDOM(e,r,o),!1}sanitizeUrl(e){const r=e;e=su(e);try{const o=new URL(su(e));if(!ou.has(o.protocol))return"about:blank"}catch{const i=r.replace(/[\u0000-\u001F\u007F\s]/g,"").match(/^([a-z][a-z0-9+.-]*):/i);if(i!=null&&!ou.has(`${i[1].toLowerCase()}:`))return"about:blank"}return e}getURL(){return this.getLatest().__url}setURL(e){const r=this.getWritable();return r.__url=e,r}getTarget(){return this.getLatest().__target}setTarget(e){const r=this.getWritable();return r.__target=e,r}getRel(){return this.getLatest().__rel}setRel(e){const r=this.getWritable();return r.__rel=e,r}getTitle(){return this.getLatest().__title}setTitle(e){const r=this.getWritable();return r.__title=e,r}insertNewAfter(e,r=!0){const o=Ft(this);return this.insertAfter(o,r),o}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,r,o){if(!O(r))return!1;const i=r.anchor.getNode(),s=r.focus.getNode();return(this.is(i)||this.isParentOf(i))&&(this.is(s)||this.isParentOf(s))&&r.getTextContent().length>0}isEmailURI(){return this.getURL().startsWith("mailto:")}isWebSiteURI(){const e=this.getURL();return e.startsWith("https://")||e.startsWith("http://")}shouldMergeAdjacentLink(e){return this.getType()===e.getType()&&this.getURL()===e.getURL()&&this.getTarget()===e.getTarget()&&this.getRel()===e.getRel()&&this.getTitle()===e.getTitle()}};function ax(n){let t=null;if(Cd(n)){const e=n.textContent;(e!==null&&e!==""||n.children.length>0)&&(t=bh(n.getAttribute("href")||"",{rel:n.getAttribute("rel"),target:n.getAttribute("target"),title:n.getAttribute("title")}))}return{node:t}}function bh(n="",t){return fe(new no(n,t))}function iu(n){return n instanceof no}const ux=xe()({isUnlinked:Mt(fl(),{field:"__isUnlinked"})});let fx=class extends no{constructor(e="",r={},o){super(e,r,o);k(this,"__isUnlinked");this.__isUnlinked=r.isUnlinked!==void 0&&r.isUnlinked!==null&&r.isUnlinked}$config(){return this.config("autolink",{extends:no,generated:lx,json:ux})}shouldMergeAdjacentLink(e){return!1}getIsUnlinked(){return this.getLatest().__isUnlinked}setIsUnlinked(e){const r=this.getWritable();return r.__isUnlinked=e,r}createDOM(e){return this.__isUnlinked?ot().createElement("span"):super.createDOM(e)}updateDOM(e,r,o){return super.updateDOM(e,r,o)||e.__isUnlinked!==this.__isUnlinked}};function dx(n){return n instanceof fx}const hx=/^\+?[0-9\s()-]{5,}$/;function su(n){return n.match(/^[a-z][a-z0-9+.-]*:/i)||n.match(/^[/#.]/)?n:n.includes("@")?`mailto:${n}`:hx.test(n)?`tel:${n}`:`https://${n}`}function Ys(n,t){const e={};for(const r of n){const o=t(r);o&&(e[o]?e[o].push(r):e[o]=[r])}return e}function Th(n){const t=Ys(n,e=>e.type);return{element:t.element||[],multilineElement:t["multiline-element"]||[],textFormat:t["text-format"]||[],textMatch:t["text-match"]||[]}}const lu=/[!-/:-@[-`{-~\s]/,cu=/\s/,Xs=/[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~]/,gx=/^\s{0,3}$/;function kh(n){if(!dr(n))return!1;const t=n.getFirstChild();return t==null||n.getChildrenSize()===1&&M(t)&&gx.test(t.getTextContent())}function Qs(n){return n.replace(/\\([!-/:-@[-`{-~])/g,"$1").replace(/&#(\d+);/g,(t,e)=>String.fromCodePoint(Number(e)))}const Nh=/^(\s*)(\d{1,})\.\s/,Eh=/^(\s*)[-*+]\s/,px=/^(\s*)(?:[-*+]\s)?\s?(\[(\s|x)?\])\s/i,Zs=/^(#{1,6})\s/,wh=/^>\s/,Oh=/^([ \t]*`{3,})([\w-]+)?[ \t]?/,tl=/^[ \t]*`{3,}$/,_x=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,mx=/^(?:\|)(.+)(?:\|)\s?$/;function yx(n){if(n[0]!=="|")return!1;const{length:t}=n;let e=1,r=0;for(;e<t;){let o=e;for(n[o]===" "&&o++,n[o]===":"&&o++;n[o]==="-";)o++;if(n[o]===":"&&o++,n[o]===" "&&o++,n[o]!=="|")break;r++,e=o+1}return r>0&&(e===t||e===t-1&&/\s/.test(n[e]))}const au=/^<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,uu=/^<\/[a-z_][\w-]*\s*>/i,fu=n=>new RegExp(`(?:${n.source})$`,n.flags),el=ur("mdListMarker",{parse:n=>typeof n=="string"&&/^[-*+]$/.test(n)?n:"-",resetOnCopyNode:!0}),du=ur("mdCodeFence",{parse:n=>typeof n=="string"&&/^`{3,}$/.test(n)?n:"```",resetOnCopyNode:!0}),$h=ur("mdCodeMeta",{parse:n=>typeof n=="string"?n:"",resetOnCopyNode:!0}),xx=ur("mdHardLineBreak",{parse:n=>typeof n=="string"&&/^(\\| {2,})$/.test(n)?n:"",resetOnCopyNode:!0});function nl(n){if(n.endsWith("\\")){let e=0;for(let r=n.length-1;r>=0&&n[r]==="\\";r--)e++;return e%2==1?[n.slice(0,-1),"\\"]:null}const t=n.match(/^(.*?\S)( {2,})$/);return t?[t[1],t[2]]:null}function vx(n){const t=n.getChildren(),e=t.length-1,r=t[e];if(!M(r))return null;const o=r.getTextContent(),i=nl(o);if(i!==null){const[s,l]=i;return r.setTextContent(s),l}return/^ {2,}$/.test(o)&&(function(s,l){for(let c=l-1;c>=0;c--){if(Nt(s[c]))return!1;if(/\S/.test(s[c].getTextContent()))return!0}return!1})(t,e)?(r.setTextContent(""),o):null}function Mh(n){const t=Ve(),e=vx(n);return e!==null&&fr(t,xx,e),t}function Zl(n){return bi(n)}function hu(n,t){let e=0;for(;e<t&&(n[e]===" "||n[e]===" ");)e++;return n.slice(e)}function Sx(n,t){const e=n.getLastChild();t&&cr(e)&&fr(e,$h,t)}const Fh=n=>(t,e,r,o)=>{const i=n(r);i.append(...e),t.replace(i),o||i.select(0,0)};function rl(n){let t=0;for(const e of n)t+=e===" "?4-t%4:1;return t}let zo=null,Bo=!1;function Cx(n,t,e,r){for(let o=n.length;o<t;o++)n[o]=4*(o+1);n.length=t,n[t]=(function(o,i){let s=o[0];if(i==="check"){const l=s.slice(o[1].length).match(/^[-*+]\s/);l&&(s=o[1]+l[0])}return Math.min(rl(s),rl(o[1])+4)})(e,r)}const Ah=n=>(t,e,r,o)=>{if(Yl(t)||!o&&Zl(t))return!1;const i=t.getPreviousSibling(),s=t.getNextSibling(),l=kn(n==="check"?/^x$/i.test(r[3]||""):void 0),c=r[0].trim()[0],a=n!=="bullet"&&n!=="check"||c!==el.parse(c)?void 0:c,u=zo;let f=i;if(u!==null){if(Bo)for(;f!==null&&kh(f);)f=f.getPreviousSibling();I(f)||(u.length=0)}const d=u===null||u.length===0?(function(g){const _=g.match(/\t/g),m=g.match(/ /g);let p=0;return _&&(p+=_.length),m&&(p+=Math.floor(m.length/4)),p})(r[1]):(function(g,_){const m=rl(_);for(let p=g.length-1;p>=0;p--)if(m>=g[p])return p+1;return 0})(u,r[1]);if(I(s)&&s.getListType()===n){const g=s.getFirstChild();g!==null?g.insertBefore(l):s.append(l),n==="number"&&d===0&&s.setStart(Number(r[2])),t.remove()}else if(I(f)&&(f.getListType()===n||d>0))f.append(l),t.remove();else{const g=we(n,n==="number"?Number(r[2]):void 0);g.append(l),t.replace(g)}l.append(...e),o||l.select(0,0),d&&(l.setIndent(d),(function(g,_,m){const p=g.getParent();if(!I(p)||p.getListType()===_)return;const y=p.getParent();if(!W(y))return;const x=we(_,_==="number"?Number(m[2]):void 0),v=g.getPreviousSibling()===null;x.append(g);const S=kn();S.append(x),v?y.insertBefore(S):y.insertAfter(S),p.getChildrenSize()===0&&y.remove()})(l,n,r));const h=l.getParent();a&&I(h)&&fr(h,el,a),u!==null&&Cx(u,d,r,n)},tc=(n,t,e,r)=>{const o=[],i=n.getChildren();let s=0;for(const l of i)if(W(l)){if(l.getChildrenSize()===1){const h=l.getFirstChild();if(I(h)){const g=tc(h,t,e+1,r);g&&o.push(g);continue}}if(r&&!l.getChildren().some(h=>h.isSelected(r)))continue;const c=" ".repeat(4*e),a=n.getListType(),u=Kr(n,el),f=a==="number"?`${n.getStart()+s}. `:a==="check"?`${u} [${l.getChecked()?"x":" "}] `:u+" ";let d=t(l);a!=="number"&&(d=d.replace(/^(\s{0,3}\d+)(\.\s)/,"$1\\$2")),o.push(c+f+d),s++}return o.join(`
12
+ `)},bx=Fh(n=>{const t="h"+n[1].length;return Ti(t)}),Dh={dependencies:[Wi],export:(n,t)=>{if(!Yl(n))return null;const e=Number(n.getTag().slice(1));return"#".repeat(e)+" "+t(n)},regExp:Zs,replace:(n,t,e,r)=>!(!r&&Zl(n))&&bx(n,t,e,r),triggerOnEnter:!0,type:"element"},Tx={dependencies:[ql],export:(n,t)=>{if(!bi(n))return null;const e=t(n).split(`
13
+ `),r=[];for(const o of e)r.push("> "+o);return r.join(`
14
+ `)},regExp:wh,replace:(n,t,e,r)=>{if(r){const i=n.getPreviousSibling();if(bi(i))return i.splice(i.getChildrenSize(),0,[Mh(i),...t]),void n.remove()}const o=Gl();o.append(...t),n.replace(o),r||o.select(0,0)},triggerOnEnter:!0,type:"element"},Ko={dependencies:[Xl],export:n=>{if(!cr(n))return null;const t=n.getTextContent();let e=Kr(n,du);if(t.indexOf(e)>-1){const i=t.match(/`{3,}/g);if(i){const s=Math.max(...i.map(l=>l.length));e="`".repeat(s+1)}}const r=n.getLanguage()||"",o=r?Kr(n,$h):"";return e+r+(o?" "+o:"")+(t?`
15
+ `+t:"")+`
16
+ `+e},handleImportAfterStartMatch:({lines:n,rootNode:t,startLineIndex:e,startMatch:r})=>{const o=r[1],i=o.trim().length,s=n[e],l=r.index+o.length,c=s.slice(l),a=new RegExp(`\`{${i},}$`);if(a.test(c)){const d=c.match(a),h=c.slice(0,c.lastIndexOf(d[0])),g=[...r];return g[2]="",Ko.replace(t,null,g,d,[h],!0),[!0,e]}const u=new RegExp(`^[ \\t]*\`{${i},}$`);for(let d=e+1;d<n.length;d++){const h=n[d];if(u.test(h)){const g=h.match(u),_=n.slice(e+1,d),m=r[2]?s.slice(r[0].length).trim():"";return _.unshift(m?"":s.slice(r[0].length)),Ko.replace(t,null,r,g,_,!0),Sx(t,m),[!0,d]}}const f=n.slice(e+1);return f.unshift(s.slice(r[0].length)),Ko.replace(t,null,r,null,f,!0),[!0,n.length-1]},regExpEnd:{optional:!0,regExp:tl},regExpStart:Oh,replace:(n,t,e,r,o,i)=>{let s,l;const c=e[1]?e[1].trim():"```",a=e[2]||void 0,u=e[1]?e[1].length-e[1].trimStart().length:0;if(!t&&o){if(o.length===1)r?(s=Be(a),l=hu(o[0],u)):(s=Be(a),l=o[0].startsWith(" ")?o[0].slice(1):o[0]);else{for(s=Be(a),o.length>0&&(o[0].trim().length===0?o.shift():o[0].startsWith(" ")&&(o[0]=o[0].slice(1)));o.length>0&&!o[o.length-1].length;)o.pop();l=o.map(d=>hu(d,u)).join(`
17
+ `)}fr(s,du,c);const f=mt(l);s.append(f),n.append(s)}else if(t){if(!i&&Zl(n))return!1;Fh(f=>Be(f?f[2]:void 0))(n,t,e,i)}},type:"multiline-element"},Ph={dependencies:[Mn,tn],export:(n,t,e)=>I(n)?tc(n,t,0,e):null,regExp:Eh,replace:Ah("bullet"),triggerOnEnter:!0,type:"element"},Ih={dependencies:[Mn,tn],export:(n,t,e)=>I(n)?tc(n,t,0,e):null,regExp:Nh,replace:Ah("number"),triggerOnEnter:!0,type:"element"},Lh={format:["code"],tag:"`",type:"text-format"},kx={format:["highlight"],tag:"==",type:"text-format"},Nx={format:["bold","italic"],tag:"***",type:"text-format"},Ex={format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},Rh={format:["bold"],tag:"**",type:"text-format"},zh={format:["bold"],intraword:!1,tag:"__",type:"text-format"},wx={format:["strikethrough"],tag:"~~",type:"text-format"},Bh={format:["italic"],tag:"*",type:"text-format"},Kh={format:["italic"],intraword:!1,tag:"_",type:"text-format"};function gu(n){return n.replace(/&(?=#\d+;|#[Xx][\dA-Fa-f]+;|[A-Za-z][\dA-Za-z]*;)/g,"&#38;")}const Ox={dependencies:[no],export:(n,t,e)=>{if(!iu(n)||dx(n))return null;const r=t(n);let o=n.getTitle();o!=null&&(o=gu(o).replace(/([\\"])/g,"\\$1"));const i=n.getURL(),s=gu(i),l=i===""||/\s/.test(i)?`<${s.replace(/([\\<>])/g,"\\$1").replace(/\r/g,"&#13;").replace(/\n/g,"&#10;")}>`:s.replace(/([\\()])/g,"\\$1").replace(/^</,"\\<");return o?`[${r}](${l} "${o}")`:`[${r}](${l})`},importRegExp:/(?:\[(.+?)\])(?:\(\s*(?:(?:<((?:\\.|[^<>\n\\])*)>|((?!<)(?:\\[^\s]|\\(?=\s)|\((?:\\[^\s]|[^\s()\\]|\((?:\\[^\s]|[^\s()\\]|\((?:\\[^\s]|[^\s()\\])*\))*\))*\)|[^\s()\\])+))(?:\s+(?:"((?:[^"]*\\")*[^"]*)"|'((?:[^']*\\')*[^']*)'|\(((?:\\.|[^()\\])*)\)))?\s*)?\))/,regExp:/(?:\[([^[\]]*(?:\[[^[\]]*\][^[\]]*)*)\])(?:\(\s*(?:(?:<((?:\\.|[^<>\n\\])*)>|((?!<)(?:\\[^\s]|\\(?=\s)|\((?:\\[^\s]|[^\s()\\]|\((?:\\[^\s]|[^\s()\\]|\((?:\\[^\s]|[^\s()\\])*\))*\))*\)|[^\s()\\])+))(?:\s+(?:"((?:[^"]*\\")*[^"]*)"|'((?:[^']*\\')*[^']*)'|\(((?:\\.|[^()\\])*)\)))?\s*)?\))$/,replace:(n,t)=>{if(vt(n,iu))return;const[,e,r,o,i,s,l]=t,c=Qs(r??o??""),a=i??s??l,u=a!=null?Qs(a):void 0,f=bh(c,{title:u}),d=e.split("[").length-1,h=e.split("]").length-1;let g=e,_="";if(d<h)return;if(d>h){const y=e.split("[");_="["+y[0],g=y.slice(1).join("[")}const m=n.getFormat(),p=mt(g);return p.setFormat(m),f.append(p),n.replace(f),_&&f.insertBefore(mt(_).setFormat(m)),p},trigger:")",type:"text-match"},$x=[Dh,Tx,Ph,Ih],Mx=[Ko],Fx=[Lh,Nx,Ex,Rh,zh,kx,Bh,Kh,wx],Ax=[Ox];function Dx(...n){return n.flat()}const Wh=Dx($x,Mx,Fx,Ax);function Px(n,t=!1){const e=n.split(`
18
+ `);let r=0;const o=[];for(let i=0;i<e.length;i++){const s=e[i],l=s.trimEnd(),c=o[o.length-1],a=i<e.length-1?nl(s):null,u=c!==void 0&&nl(c)!==null;if(_x.test(l))o.push(l);else if(r===0){{const f=l.match(Oh);if(f){r=f[1].trim().length,o.push(l);continue}}l===""||c===""||!c||Zs.test(c)||Zs.test(l)||wh.test(l)||Nh.test(l)||Eh.test(l)||px.test(l)||mx.test(l)||yx(l)||u||!t||au.test(l)||uu.test(l)||fu(uu).test(c)||fu(au).test(c)||tl.test(c)?o.push(!t&&l!==""||a!==null?s:l):o[o.length-1]=c+" "+(a===null?l:s).trimStart()}else{if(tl.test(l)&&l.trim().length>=r){r=0,o.push(l);continue}o.push(s)}}return o.join(`
19
+ `)}function Ix(n,t){const e=n.getTextContent(),r=t.transformersByTag["`"],o=[];let i=null;if(r){const f=(function(d){const h=y=>{let x=0;for(let v=y-1;v>=0&&d[v]==="\\";v--)x++;return x%2==1},g=[];let _=0;for(;_<d.length;)if(d[_]==="`"){let y=1;for(;_+y<d.length&&d[_+y]==="`";)y++;g.push({index:_,length:y}),_+=y}else _++;const m=[];let p=0;for(;p<g.length;){const y=g[p];if(h(y.index)){p++;continue}let x=-1;for(let C=p+1;C<g.length;C++)if(g[C].length===y.length){x=C;break}if(x===-1){p++;continue}const v=g[x];let S=d.slice(y.index+y.length,v.index);S.length>=2&&S.startsWith(" ")&&S.endsWith(" ")&&/[^ ]/.test(S)&&(S=S.slice(1,-1)),m.push({content:S,endIndex:v.index+v.length,startIndex:y.index}),p=x+1}return m})(e);for(const d of f)i||(i={content:d.content,endIndex:d.endIndex,startIndex:d.startIndex,tag:"`"}),o.push({end:d.endIndex,start:d.startIndex})}const s=(function(f,d,h=[]){const g=[],_=new Set(Object.keys(d.transformersByTag).filter(x=>x[0]!=="`").map(x=>x[0])),m=x=>{let v=0;for(let S=x-1;S>=0&&f[S]==="\\";S--)v++;return v%2==1},p=x=>h.some(v=>x>=v.start&&x<v.end);let y=0;for(;y<f.length;){const x=f[y];if(!_.has(x)||m(y)||p(y)){y++;continue}let v=1;for(;y+v<f.length&&f[y+v]===x;)v++;const S=pu(x,f,y,v,!0),C=pu(x,f,y,v,!1);(S||C)&&g.push({active:!0,canClose:C,canOpen:S,char:x,index:y,length:v}),y+=v}return g})(e,t,o),l=s.length>0?(function(f,d,h){const g={};let _=0,m=null;for(;_<d.length;){const p=d[_];if(!p.active||!p.canClose||p.length===0){_++;continue}const y=`${p.char}${p.canOpen}${p.length%3}`,x=g[y]??-1;let v=!1;for(let S=_-1;S>x;S--){const C=d[S];if(!C.active||!C.canOpen||C.length===0||C.char!==p.char||(C.canClose||p.canOpen)&&(C.length+p.length)%3==0&&C.length%3!=0&&p.length%3!=0)continue;const N=Math.min(C.length,p.length),T=Object.keys(h.transformersByTag).filter(F=>F[0]===C.char&&F.length<=N).sort((F,D)=>D.length-F.length)[0];if(!T)continue;v=!0;const E=T.length,$={content:f.slice(C.index+C.length,p.index),endIndex:p.index+E,startIndex:C.index+(C.length-E),tag:T};(!m||$.startIndex<m.startIndex||$.startIndex===m.startIndex&&$.endIndex>m.endIndex)&&(m=$);for(let F=S+1;F<_;F++)d[F].active=!1;C.length-=E,p.length-=E,C.active=C.length>0,p.length>0?p.index+=E:(p.active=!1,_++);break}v||(g[y]=_-1,p.canOpen||(p.active=!1),_++)}return m})(e,s,t):null;let c=null,a=null;if(i&&l?l.startIndex<=i.startIndex&&l.endIndex>=i.endIndex?(c=l,a=t.transformersByTag[l.tag]):(c=i,a=r):i?(c=i,a=r):l&&(c=l,a=t.transformersByTag[l.tag]),!c||!a)return null;const u=[e.slice(c.startIndex,c.endIndex),c.tag,c.content];return u.index=c.startIndex,u.input=e,{endIndex:c.endIndex,isCodeSpan:a===r,match:u,startIndex:c.startIndex,transformer:a}}function pu(n,t,e,r,o){if(!_u(t,e,r,o))return!1;if(n==="*")return!0;if(n==="_"){if(!_u(t,e,r,!o))return!0;const i=o?t[e-1]:t[e+r];return i!==void 0&&Xs.test(i)}return!0}function _u(n,t,e,r){const o=n[t-1],i=n[t+e],[s,l]=r?[i,o]:[o,i];return s!==void 0&&!cu.test(s)&&(!Xs.test(s)||l===void 0||cu.test(l)||Xs.test(l))}function Pe(n){return M(n)&&!n.hasFormat("code")}function on(n,t,e){let r=Ix(n,t),o=(function(s,l){const c=s;let a,u,f,d;for(const h of l){if(!h.replace||!h.importRegExp)continue;const g=c.getTextContent().match(h.importRegExp);if(!g)continue;const _=g.index||0,m=h.getEndIndex?h.getEndIndex(c,g):_+g[0].length;m!==!1&&(a===void 0||u===void 0||_<a&&(m>u||m<=a))&&(a=_,u=m,f=h,d=g)}return a===void 0||u===void 0||f===void 0||d===void 0?null:{endIndex:u,match:d,startIndex:a,transformer:f}})(n,e);if(r&&o&&(r.isCodeSpan?o.startIndex<=r.startIndex&&o.endIndex>=r.endIndex?r=null:o=null:r.startIndex<=o.startIndex&&r.endIndex>=o.endIndex||o.startIndex>r.endIndex?o=null:r=null),r){const s=(function(l,c,a,u,f){const d=l.getTextContent();let h,g,_;if(f[0]===d?h=l:c===0?[h,g]=l.splitText(a):[_,h,g]=l.splitText(c,a),h.setTextContent(f[2]),u)for(const m of u.format)h.hasFormat(m)||h.toggleFormat(m);return{nodeAfter:g,nodeBefore:_,transformedNode:h}})(n,r.startIndex,r.endIndex,r.transformer,r.match);Pe(s.nodeAfter)&&on(s.nodeAfter,t,e),Pe(s.nodeBefore)&&on(s.nodeBefore,t,e),Pe(s.transformedNode)&&on(s.transformedNode,t,e)}else if(o){const s=(function(l,c,a,u,f){let d,h,g;return c===0?[d,h]=l.splitText(a):[g,d,h]=l.splitText(c,a),u.replace?{nodeAfter:h,nodeBefore:g,transformedNode:u.replace(d,f)||void 0}:null})(n,o.startIndex,o.endIndex,o.transformer,o.match);if(!s)return;Pe(s.nodeAfter)&&on(s.nodeAfter,t,e),Pe(s.nodeBefore)&&on(s.nodeBefore,t,e),Pe(s.transformedNode)&&on(s.transformedNode,t,e)}const i=Qs(n.getTextContent());n.setTextContent(i)}function Lx(n,t,e,r=!1){const o=Th(e),i=(function(a){const u={},f={},d=[];for(const h of a){const{tag:g}=h;u[g]=h;const _=g.replace(/(\*|\^|\+)/g,"\\$1");d.push(_),g.length===1?f[g]=g==="`"?new RegExp("(^|[^\\\\`])(`)((?:\\\\`|[^`])+?)(`)(?!`)"):new RegExp(`(^|[^\\\\${_}])(${_})((\\\\${_})?.*?[^${_}\\s](\\\\${_})?)(${_})(?![\\\\${_}])`):f[g]=new RegExp(`(^|[^\\\\])(${_})((\\\\${_})?.*?[^\\s](\\\\${_})?)(${_})(?!\\\\)`)}return{fullMatchRegExpByTag:f,openTagsRegExp:new RegExp(`(${d.join("|")})`,"g"),transformersByTag:u}})(o.textFormat),s=n.split(`
20
+ `),l=s.length;(function(a,u){const f=zo,d=Bo;zo=[],Bo=a;try{return u()}finally{zo=f,Bo=d}})(!r,()=>{for(let a=0;a<l;a++){const u=s[a],[f,d]=Rx(s,a,o.multilineElement,t);f?a=d:zx(u,t,o.element,i,o.textMatch,r)}});const c=t.getChildren();for(const a of c)if(!r&&kh(a)&&t.getChildrenSize()>1)a.remove();else if(b(a))for(const u of a.getAllTextNodes())Bx(u)}function Rx(n,t,e,r){for(const o of e){const{handleImportAfterStartMatch:i,regExpEnd:s,regExpStart:l,replace:c}=o,a=n[t].match(l);if(!a)continue;if(i){const g=i({lines:n,rootNode:r,startLineIndex:t,startMatch:a,transformer:o});if(g===null)continue;if(g)return g}const u=typeof s=="object"&&"regExp"in s?s.regExp:s,f=s&&typeof s=="object"&&"optional"in s?s.optional:!s;let d=t;const h=n.length;for(;d<h;){const g=u?n[d].match(u):null;if(!g&&(!f||f&&d<h-1)){d++;continue}if(g&&t===d&&g.index===a.index){d++;continue}const _=[];if(g&&t===d)_.push(n[t].slice(a[0].length,-g[0].length));else for(let m=t;m<=d;m++)if(m===t){const p=n[m].slice(a[0].length);_.push(p)}else if(m===d&&g){const p=n[m].slice(0,-g[0].length);_.push(p)}else _.push(n[m]);if(c(r,null,a,g,_,!0)!==!1)return[!0,d];break}}return[!1,t]}function zx(n,t,e,r,o,i){const s=mt(n),l=tt();l.append(s),t.append(l);for(const{regExp:c,replace:a}of e){const u=n.match(c);if(u&&(s.setTextContent(n.slice(u[0].length)),a(l,[s],u,!0)!==!1))break}if(on(s,r,o),l.getParent()!==null&&n.length>0){const c=l.getPreviousSibling();if(!i&&(dr(c)||bi(c)||I(c))){let a=c;if(I(c)){const u=c.getLastDescendant();a=u==null?null:vt(u,W)}a!=null&&a.getTextContentSize()>0&&(a.splice(a.getChildrenSize(),0,[Mh(a),...l.getChildren()]),l.remove())}}}function Bx(n){if(pn(n))return;const t=n.getTextContent();if(!t.includes(" "))return;const e=n.getFormat(),r=n.getStyle(),o=[];let i=0;for(let s=t.indexOf(" ");s!==-1;s=t.indexOf(" ",s+1))s>i&&o.push(mt(t.slice(i,s)).setFormat(e).setStyle(r)),o.push(lo()),i=s+1;i<t.length&&o.push(mt(t.slice(i)).setFormat(e).setStyle(r)),n.getParentOrThrow().splice(n.getIndexWithinParent(),1,o)}function Kx(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function mu(n,t,e,r,o){const i=n.getParent();if(!Z(i)||n.getFirstChild()!==t)return!1;const s=t.getTextContent();if(!o&&s[e-1]!==" ")return!1;for(const{regExp:l,replace:c}of r){const a=s.match(l),u=o||a&&a[0].endsWith(" ")?e:e-1;if(a&&a[0].length===u){const f=t.getNextSiblings(),[d,h]=t.splitText(e);if(c(n,h?[h,...f]:f,a,!1)!==!1)return d.remove(),!0}}return!1}function yu(n,t,e,r,o){const i=n.getParent();if(!Z(i)||n.getFirstChild()!==t)return!1;const s=t.getTextContent();if(!o&&s[e-1]!==" ")return!1;for(const{regExpStart:l,replace:c,regExpEnd:a}of r){if(a&&!("optional"in a)||a&&"optional"in a&&!a.optional)continue;const u=s.match(l);if(u){const f=o||u[0].endsWith(" ")?e:e-1;if(u[0].length!==f)continue;const d=t.getNextSiblings(),[h,g]=t.splitText(e);if(c(n,g?[g,...d]:d,u,null,null,!1)!==!1)return h.remove(),!0}}return!1}function Wx(n,t){let e=0;const r=n.getTextContent();for(let o=0;o<t;o++)r[o]==="`"&&e++;return e%2!=0}function xu(n,t,e){const r=e.length;for(let o=t;o>=r;o--){const i=o-r;if(Uh(n,i,e,0,r)&&n[i+r]!==" ")return i}return-1}function vu(n){const t=n.getNode();let e=0;if(M(t))e=n.offset;else if(b(t))for(const r of t.getChildren().slice(0,n.offset))e+=r.getTextContentSize();for(let r=t.getPreviousSibling();r!==null;r=r.getPreviousSibling())e+=r.getTextContentSize();return e}function Uh(n,t,e,r,o){for(let i=0;i<o;i++)if(n[t+i]!==e[r+i])return!1;return!0}function Ux(n,t=Wh){const e=Th(t),r=e.element.filter(c=>c.triggerOnEnter),o=Ys(e.textFormat,({tag:c})=>c[c.length-1]),i=Ys(e.textMatch,({trigger:c})=>c),s=new Set([" "]);for(const c of e.textFormat)s.add(c.tag.slice(-1));for(const c of e.textMatch)c.trigger!==void 0&&s.add(c.trigger);for(const c of t){const a=c.type;if(a==="element"||a==="text-match"||a==="multiline-element"){const u=c.dependencies;for(const f of u)n.hasNode(f)||Kx(173,f.getType())}}const l=(c,a,u)=>!!mu(c,a,u,e.element)||!!yu(c,a,u,e.multilineElement)||!!(function(f,d,h){let g=f.getTextContent();const _=h[g[d-1]];if(_==null)return!1;d<g.length&&(g=g.slice(0,d));for(const m of _){if(!m.replace||!m.regExp)continue;const p=g.match(m.regExp);if(p===null)continue;const y=p.index||0,x=y+p[0].length;let v;return y===0?[v]=f.splitText(x):[,v]=f.splitText(y,x),v.selectNext(0,0),m.replace(v,p),!0}return!1})(a,u,i)||!!(function(f,d,h){const g=f.getTextContent(),_=d-1,m=g[_],p=h[m];if(!p)return!1;for(const y of p){const{tag:x}=y,v=x.length,S=_-v+1;if(v>1&&!Uh(g,S,x,0,v)||g[S-1]===" ")continue;const C=g[_+1];if(y.intraword===!1&&C&&!lu.test(C))continue;const N=f;let T=N,E=xu(g,S,x),$=T;for(;E<0&&($=$.getPreviousSibling())&&!Nt($);)if(M($)){if($.hasFormat("code"))continue;const et=$.getTextContent();T=$,E=xu(et,et.length,x)}if(E<0||T===N&&E+v===S)continue;const F=T.getTextContent();if(E>0&&F[E-1]===m)continue;const D=F[E-1];if(y.intraword===!1&&D&&!lu.test(D)||!y.format.includes("code")&&Wx(T,E))continue;const L=N.getTextContent(),B=L.slice(0,S)+L.slice(_+1);N.setTextContent(B);const U=T===N?B:F;T.setTextContent(U.slice(0,E)+U.slice(E+v));const Q=A(),H=Cl();St(H);const Et=_-v*(T===N?2:1)+1;H.anchor.set(T.__key,E,"text"),H.focus.set(N.__key,Et,"text");for(const et of y.format)H.formatText(et,Ct[et]);H.anchor.set(H.focus.key,H.focus.offset,H.focus.type);for(const et of y.format)H.hasFormat(et)&&H.toggleFormat(et);return O(Q)&&(H.format=Q.format),!0}return!1})(a,u,o);return jt(n.registerUpdateListener(({tags:c,dirtyLeaves:a,editorState:u,prevEditorState:f})=>{if(c.has(Mf)||c.has(Qo)||n.isComposing())return;const d=c.has(Gr),h=u.read(A),g=f.read(A);if(!O(g)||!O(h)||!h.isCollapsed()||h.is(g)&&!d)return;const _=h.anchor.key,m=h.anchor.offset,p=u._nodeMap.get(_);if(M(p)&&a.has(_)&&(d||m===1||!(u.read(()=>vu(h.anchor))>f.read(()=>vu(g.anchor))+1))){if(d){const y=u.read(()=>p.getTextContent())[m-1];if(!s.has(y))return}n.update(()=>{if(!Pe(p))return;const y=p.getParent();y===null||cr(y)||l(y,p,h.anchor.offset)&&xn(Of)})}}),n.registerCommand(so,c=>{if(c!==null&&c.shiftKey)return!1;const a=A();if(!O(a)||!a.isCollapsed())return!1;const u=a.anchor.offset,f=a.anchor.getNode();if(!M(f)||!Pe(f))return!1;const d=f.getParent();return d===null||cr(d)?!1:u===f.getTextContent().length&&!(!yu(d,f,u,e.multilineElement,!0)&&!mu(d,f,u,r,!0))&&(c!==null&&c.preventDefault(),!0)},Ln))}function jx(n,t=Wh,e,r=!1,o=!1){const i=r?n:Px(n,o),s=Y();s.clear(),Lx(i,s,t,r),A()!==null&&s.selectStart()}const Jx="65%",Hx='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="mr-0.5 inline-block size-[0.85em] align-[-0.15em]"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/></svg>';class ar extends se{constructor(e,r,o=null,i){super(`@${e}`,i);k(this,"__handle");k(this,"__kind");k(this,"__identityColor");this.__handle=e,this.__kind=r,this.__identityColor=o}static getType(){return"composer-mention"}static clone(e){return new ar(e.__handle,e.__kind,e.__identityColor,e.__key)}static importJSON(e){return new ar(e.handle,e.kind,e.identityColor).updateFromJSON(e)}exportJSON(){return{...super.exportJSON(),handle:this.__handle,kind:this.__kind,identityColor:this.__identityColor}}isToken(){return!0}createDOM(e){const r=super.createDOM(e),o=this.__kind==="agent";if(r.className=Gh({tone:o?"agent":"neutral",interactive:!1}),r.setAttribute("data-slot","mention-pill"),r.setAttribute("data-kind",this.__kind),r.setAttribute("title",`@${this.__handle}`),o){const i=this.__identityColor??"currentColor";r.style.setProperty("--identity-color",i),r.style.color=`color-mix(in oklch, ${i} ${Jx}, hsl(var(--foreground)))`,r.insertAdjacentHTML("afterbegin",Hx)}return r}updateDOM(e,r,o){return e.__handle!==this.__handle||e.__kind!==this.__kind||e.__identityColor!==this.__identityColor?!0:super.updateDOM(e,r,o)}}function Vx(n){return n instanceof ar}function qx(n,t,e=null){return new ar(n,t,e)}const Gx=[Wi,Mn,tn,ar],Yx={...Dh,regExp:/^(#{1,3})\s/},jh=[Yx,Ph,Ih,Rh,zh,Bh,Kh,Lh];function Xx(n){jx(n.replace(/\\/g,"\\\\"),[...jh])}const gs=[{bit:1,mark:"**"},{bit:2,mark:"*"},{bit:16,mark:"`"}],Qx=`
21
+
22
+ `;function Su(n,t){if(Yl(n))return"#".repeat(Number(n.getTag().slice(1)))+" ";if(W(n)){const e=n.getParent();return I(e)&&e.getListType()==="number"?`${t}. `:"- "}return""}class Zx{constructor(){k(this,"out","");k(this,"collected",[])}syntax(t){this.out+=t}text(t,e){const r=this.out.length;this.out+=e,this.collected.push({key:t.getKey(),start:r,end:this.out.length,textOffset:0})}anchor(t){this.collected.push({key:t.getKey(),start:this.out.length,end:this.out.length,textOffset:0})}finish(){return{markdown:this.out,spans:this.collected}}}function Cu(n,t){n.anchor(t);let e=[];const r=o=>{for(;e.length>o;){const i=e.pop();n.syntax(gs.find(s=>s.bit===i).mark)}};for(const o of t.getChildren()){if(Nt(o)){r(0),n.syntax(`
23
+ `);continue}const i=M(o)?o.getFormat():0,s=gs.filter(c=>(i&c.bit)!==0).map(c=>c.bit);let l=0;for(;l<e.length&&l<s.length&&e[l]===s[l];)l+=1;r(l);for(const c of s.slice(l))n.syntax(gs.find(a=>a.bit===c).mark),e.push(c);M(o)?n.text(o,o.getTextContent()):n.syntax(o.getTextContent())}r(0),e=[]}function t0(n,t){if(I(t)){const e=t.getChildren();let r=t.getStart();e.forEach((o,i)=>{i>0&&n.syntax(`
24
+ `),b(o)&&(n.syntax(Su(o,r)),Cu(n,o)),r+=1});return}if(!b(t)){n.syntax(t.getTextContent());return}n.syntax(Su(t,1)),Cu(n,t)}function Rr(){const n=new Zx;return Y().getChildren().forEach((e,r)=>{r>0&&n.syntax(Qx),t0(n,e)}),n.finish()}function zr(n){const t=A();if(!O(t)||!t.isCollapsed())return null;const e=t.anchor,r=n.spans.find(i=>i.key===e.key);if(r===void 0)return null;if(e.type==="element")return r.start;const o=e.offset-r.textOffset;return Math.min(Math.max(r.start+o,r.start),r.end)}function e0(n,t){const e=n.spans.filter(c=>c.end>c.start),r=e.length>0?e:n.spans;if(r.length===0){Y().selectEnd();return}let o=r[0];for(const c of r)c.start<=t&&(o=c);const i=nt(o.key);if(i===null){Y().selectEnd();return}const s=Math.min(Math.max(t-o.start,0),o.end-o.start),l=o.textOffset+s;if(M(i)){i.select(l,l);return}if(b(i)){i.selectStart();return}Y().selectEnd()}function n0(n){return{textBeforeCaret(){let t=null;return n.getEditorState().read(()=>{const e=Rr(),r=zr(e);t=r===null?null:e.markdown.slice(0,r)}),t},isCaretAtStart(){let t=!0;return n.getEditorState().read(()=>{const e=Rr(),r=zr(e);t=r===null?!0:r===0}),t},isCaretAtEnd(){let t=!0;return n.getEditorState().read(()=>{const e=Rr(),r=zr(e);t=r===null?!0:r===e.markdown.length}),t},insertLineBreak(){n.update(()=>{const t=A();O(t)&&t.insertLineBreak()},{discrete:!0})},consumeEscapeIntoNewline(){n.update(()=>{const t=A();if(!O(t)||!t.isCollapsed())return;const e=t.anchor,r=e.getNode();if(!M(r)||e.offset===0)return;const o=r.getTextContent(),i=e.offset;if(o[i-1]!=="\\")return;r.setTextContent(o.slice(0,i-1)+o.slice(i)),r.select(i-1,i-1);const s=A();O(s)&&s.insertLineBreak()},{discrete:!0})},clearThroughUndoStack(){n.update(()=>{const t=Y();t.clear(),t.selectEnd()},{discrete:!0})},isComposing(){return n.isComposing()}}}function bu(n,t){let e=!1;const r={key:n.key,shiftKey:n.shiftKey,altKey:n.altKey,keyCode:n.keyCode,nativeEvent:n,get defaultPrevented(){return e},preventDefault(){e=!0,n.preventDefault()}};return t(r),e}function r0(){const n=A();if(!O(n))return!1;const t=n.anchor.getNode();return W(t)||t.getParents().some(W)}function o0(n,{surface:t,isPaletteOpen:e,paletteHasResults:r}){if(t===null||n.isComposing||t.isComposing()||n.altKey||n.shiftKey||e&&r)return!1;const o=t.textBeforeCaret();return o!==null&&Yh(o)%2===1?!1:r0()}function i0(n){const[t]=de(),{onKeyDown:e,surface:r,isPaletteOpen:o,paletteHasResults:i}=n;z.useEffect(()=>{const s=l=>l===null?!1:bu(l,e);return jt(t.registerCommand(so,l=>l===null||o0(l,{surface:r,isPaletteOpen:o,paletteHasResults:i})?!1:bu(l,e),Ne),t.registerCommand(_l,s,Ne),t.registerCommand(hl,s,Ne),t.registerCommand(gl,s,Ne),t.registerCommand(ml,s,Ne))},[t,e,r,o,i])}const s0=/(^|\s)@([A-Za-z0-9_.-]+)/;function l0(n){const[t]=de();z.useEffect(()=>{if(n===void 0||n.length===0)return;const e=new Map(n.map(o=>[o.handle,o])),r=t.registerNodeTransform(se,o=>{if(Vx(o)||!M(o)||!o.isSimpleText())return;const i=s0.exec(o.getTextContent());if(i===null)return;const s=e.get(i[2]);if(s===void 0)return;const l=i.index+i[1].length,c=l+i[2].length+1;let a=o;l>0&&(a=a.splitText(l)[1]),a.getTextContentSize()>c-l&&a.splitText(c-l),a.replace(qx(s.handle,s.kind,s.identityColor))});return t.update(()=>{for(const o of Y().getAllTextNodes())o.markDirty()}),r},[t,n])}function Jh(n){return n===null?!1:n.files!==void 0&&n.files.length>0?!0:Array.from(n.items??[]).some(t=>t.kind==="file")}function Tu(n){return n===null?!1:Jh(n)?!0:Xh(Array.from(n.types??[]))}const c0={B:"bold",STRONG:"bold",I:"italic",EM:"italic",CODE:"code"},a0=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE","SVG","MATH"]),u0=new Set(["P","DIV","BR","LI","H1","H2","H3","H4","H5","H6"]);function f0(n){const t=new DOMParser().parseFromString(n,"text/html"),e=[];let r=tt();const o=()=>{r.getChildrenSize()>0&&e.push(r),r=tt()},i=(s,l)=>{if(s.nodeType===Node.TEXT_NODE){const h=s.textContent??"";if(h.length===0)return;const g=mt(h);for(const _ of l)g.toggleFormat(_);r.append(g);return}if(s.nodeType!==Node.ELEMENT_NODE)return;const c=s,a=c.tagName.toUpperCase();if(a0.has(a))return;const u=c0[a],f=u?new Set([...l,u]):l,d=u0.has(a);d&&o();for(const h of Array.from(c.childNodes))i(h,f);d&&o()};for(const s of Array.from(t.body.childNodes))i(s,new Set);return o(),e}function d0(){const[n]=de();z.useEffect(()=>jt(n.registerCommand(wi,t=>{const e=t!==null&&"clipboardData"in t?t.clipboardData??null:null;if(Jh(e))return!0;if(e===null)return!1;const r=t,o=e.getData("text/html");if(!o)return!1;const i=f0(o);if(i.length===0)return!1;const s=A();return O(s)?(r.preventDefault(),s.insertNodes(i),!0):!1},Ne),n.registerCommand(yl,t=>Tu(t.dataTransfer),Ne),n.registerCommand(xl,t=>Tu(t.dataTransfer),Ne)),[n])}const ku="composer-hydrate";function h0({value:n,onChange:t,onCursorChange:e}){const[r]=de(),o=z.useRef(null),i=z.useRef(null),s=z.useRef({onChange:t,onCursorChange:e});return z.useEffect(()=>{s.current={onChange:t,onCursorChange:e}},[t,e]),z.useEffect(()=>r.registerUpdateListener(({editorState:c,dirtyElements:a,dirtyLeaves:u,tags:f})=>{if(f.has(ku))return;const{onChange:d,onCursorChange:h}=s.current;c.read(()=>{const g=a.size===0&&u.size===0,_=i.current;if(g&&_!==null){const y=zr(_);y!==null&&(h==null||h(y));return}const m=Rr();i.current=m,o.current=m.markdown,d(m.markdown);const p=zr(m);p!==null&&(h==null||h(p))})}),[r]),z.useEffect(()=>{n!==o.current&&r.update(()=>{Xx(n),o.current=n,i.current=null},{tag:ku})},[r,n]),{focusAt:z.useCallback(c=>{r.update(()=>{e0(Rr(),c)}),r.focus()},[r])}}const g0={paragraph:"m-0",heading:{h1:"text-base font-semibold",h2:"text-sm font-semibold",h3:"text-sm font-medium"},list:{ul:"list-disc pl-5",ol:"list-decimal pl-5",listitem:"ml-0"},text:{bold:"font-semibold",italic:"italic",code:"bg-muted rounded px-1 py-0.5 font-mono text-[0.9em]"}};function p0(n){console.error("[composer] editor error",n)}const _0="block max-h-[200px] min-h-[24px] w-full overflow-y-auto bg-transparent py-0.5 text-sm focus:outline-none",m0=z.forwardRef(function({value:t,onChange:e,onCursorChange:r,onKeyDown:o,onFocus:i,onBlur:s,placeholder:l,placeholderOverlay:c,isPaletteOpen:a,paletteHasResults:u,paletteListboxId:f,activeDescendantId:d,onSurfaceChange:h,mentionSubjects:g},_){const[m]=de(),p=Qh(),{focusAt:y}=h0({value:t,onChange:e,onCursorChange:r}),x=z.useRef(null),[v,S]=z.useState(null);z.useEffect(()=>{x.current??(x.current=n0(m)),S(x.current),h(x.current)},[m,h]),z.useEffect(()=>Ux(m,[...jh]),[m]),i0({onKeyDown:o,surface:v,isPaletteOpen:a,paletteHasResults:u}),d0(),l0(g),z.useImperativeHandle(_,()=>({focus:()=>m.focus(),focusUnlessTouch:()=>{p||m.focus()},focusAt:y}),[m,p,y]);const C=t.trim().length>0,N=c==null,T={className:_0,role:"combobox","aria-autocomplete":"list","aria-controls":a?f:void 0,"aria-expanded":a??!1,"aria-activedescendant":a?d:void 0,"aria-label":l,"aria-multiline":!0,onFocus:i,onBlur:s};return lt.jsxs("div",{className:"relative min-h-[24px] flex-1",children:[!C&&c,lt.jsx(Uy,{contentEditable:N?lt.jsx(Pa,{...T,"aria-placeholder":l,placeholder:lt.jsx("div",{className:"text-muted-foreground pointer-events-none absolute top-0 left-0 py-0.5 text-sm select-none",children:l})}):lt.jsx(Pa,{...T}),ErrorBoundary:Zm}),lt.jsx(oy,{}),lt.jsx(Wm,{})]})}),$0=z.forwardRef(function(t,e){return lt.jsx(jm,{initialConfig:{namespace:"composer",nodes:Gx,theme:g0,onError:p0},children:lt.jsx(m0,{...t,ref:e})})});export{$0 as default};