@fgbg/mdocs 0.8.16 → 0.8.19

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 (107) hide show
  1. package/README.md +114 -76
  2. package/agent-skills/changelog/SKILL.md +21 -1
  3. package/agent-skills/index/SKILL.md +1 -1
  4. package/agent-skills/index.json +4 -4
  5. package/agent-skills/usage-agent-dev-loop/SKILL.md +7 -7
  6. package/agent-skills/usage-onboarding-ai/SKILL.md +98 -29
  7. package/agent-skills/usage-settings/SKILL.md +4 -4
  8. package/dist/server/agent/Agent/almost-empty.js +15 -0
  9. package/dist/server/agent/Agent/almost-empty.js.map +1 -0
  10. package/dist/server/agent/Agent/almost-empty.test.js +20 -0
  11. package/dist/server/agent/Agent/almost-empty.test.js.map +1 -0
  12. package/dist/server/agent/Agent/choice-pending.js +71 -0
  13. package/dist/server/agent/Agent/choice-pending.js.map +1 -0
  14. package/dist/server/agent/Agent/choice-pending.test.js +58 -0
  15. package/dist/server/agent/Agent/choice-pending.test.js.map +1 -0
  16. package/dist/server/agent/Agent/run.js +49 -3
  17. package/dist/server/agent/Agent/run.js.map +1 -1
  18. package/dist/server/agent/Agent/system-prompt.js +6 -5
  19. package/dist/server/agent/Agent/system-prompt.js.map +1 -1
  20. package/dist/server/agent/Agent/tools-account.js +16 -3
  21. package/dist/server/agent/Agent/tools-account.js.map +1 -1
  22. package/dist/server/agent/Agent/tools-choice.js +70 -0
  23. package/dist/server/agent/Agent/tools-choice.js.map +1 -0
  24. package/dist/server/agent/Agent/tools-coding.js +6 -3
  25. package/dist/server/agent/Agent/tools-coding.js.map +1 -1
  26. package/dist/server/agent/Agent/tools-overwrite.js +158 -0
  27. package/dist/server/agent/Agent/tools-overwrite.js.map +1 -0
  28. package/dist/server/routes/agent.routes.js +54 -0
  29. package/dist/server/routes/agent.routes.js.map +1 -1
  30. package/dist/server/search/document-index-manager.js +11 -8
  31. package/dist/server/search/document-index-manager.js.map +1 -1
  32. package/dist/web/assets/AgentChatPanel-CLKeiDeR.js +1 -0
  33. package/dist/web/assets/AiWriteWorkbench-Ecp214S5.js +6 -0
  34. package/dist/web/assets/DiagramEditor-BTRe45TX-DzJEhM4C.js +2 -0
  35. package/dist/web/assets/DocumentEditor-NPbbAape.js +21 -0
  36. package/dist/web/assets/{MergeView-BqQuuHxp.js → MergeView-BnWbq08U.js} +2 -2
  37. package/dist/web/assets/PlaygroundPage-BSGipUkC.js +8 -0
  38. package/dist/web/assets/SettingsPage-OklrFCx7.js +1 -0
  39. package/dist/web/assets/Toolbar-DjPuWk5G.js +126 -0
  40. package/dist/web/assets/VisitorPickerModal-BUS-cOq0.js +1 -0
  41. package/dist/web/assets/copy-hWOco_4c.js +11 -0
  42. package/dist/web/assets/diagram-gfUK8OHx.js +3016 -0
  43. package/dist/web/assets/editor-ONzd_YnO.js +16 -0
  44. package/dist/web/assets/history-AMIEbyMc.js +6 -0
  45. package/dist/web/assets/index-BksNm27A.css +1 -0
  46. package/dist/web/assets/index-C46BU1-j.js +185 -0
  47. package/dist/web/assets/meta2d-C8Z4cn-d.js +110 -0
  48. package/dist/web/assets/meta2dEngine-BD2XbzaV-D7hJ1H1g.js +1 -0
  49. package/dist/web/assets/motion-C4pN8CfU.js +8 -0
  50. package/dist/web/assets/plus-CnKbiP8x.js +6 -0
  51. package/dist/web/assets/react-B7vrA7AR.js +2126 -0
  52. package/dist/web/assets/react-vendor-BNpqFP9B.js +242 -0
  53. package/dist/web/assets/ui-DxdLi_28.js +3126 -0
  54. package/dist/web/index.html +28 -3
  55. package/package.json +2 -2
  56. package/dist/web/assets/_baseUniq-CTLDRefi.js +0 -1
  57. package/dist/web/assets/arc-C6HVu_cL.js +0 -1
  58. package/dist/web/assets/architectureDiagram-Q4EWVU46-BGZyIwfI.js +0 -36
  59. package/dist/web/assets/blockDiagram-DXYQGD6D-BnmQmYk5.js +0 -132
  60. package/dist/web/assets/c4Diagram-AHTNJAMY-D5ZSFyGW.js +0 -10
  61. package/dist/web/assets/channel-ComR_5wI.js +0 -1
  62. package/dist/web/assets/chunk-4BX2VUAB-bB7dqglW.js +0 -1
  63. package/dist/web/assets/chunk-4TB4RGXK-DLOuFWAV.js +0 -206
  64. package/dist/web/assets/chunk-55IACEB6-F-vn8P_5.js +0 -1
  65. package/dist/web/assets/chunk-EDXVE4YY-DJggdpTr.js +0 -1
  66. package/dist/web/assets/chunk-FMBD7UC4-CGFWLCLP.js +0 -15
  67. package/dist/web/assets/chunk-OYMX7WX6-nDiR5vU7.js +0 -231
  68. package/dist/web/assets/chunk-QZHKN3VN-D29FhQRL.js +0 -1
  69. package/dist/web/assets/chunk-YZCP3GAM-BmFALtIq.js +0 -1
  70. package/dist/web/assets/classDiagram-6PBFFD2Q-CxGT_r56.js +0 -1
  71. package/dist/web/assets/classDiagram-v2-HSJHXN6E-CxGT_r56.js +0 -1
  72. package/dist/web/assets/clone-J85LHgdR.js +0 -1
  73. package/dist/web/assets/cose-bilkent-S5V4N54A-J4Iar7P4.js +0 -1
  74. package/dist/web/assets/cytoscape.esm-BiciSPf8.js +0 -331
  75. package/dist/web/assets/dagre-KV5264BT-Cg07vwKD.js +0 -4
  76. package/dist/web/assets/defaultLocale-DX6XiGOO.js +0 -1
  77. package/dist/web/assets/diagram-5BDNPKRD-D0FP-ifV.js +0 -10
  78. package/dist/web/assets/diagram-G4DWMVQ6-CNejTsu2.js +0 -24
  79. package/dist/web/assets/diagram-MMDJMWI5-DEQjM6f7.js +0 -43
  80. package/dist/web/assets/diagram-TYMM5635-CRGZl6sR.js +0 -24
  81. package/dist/web/assets/erDiagram-SMLLAGMA-BGOATwuq.js +0 -85
  82. package/dist/web/assets/flowDiagram-DWJPFMVM-DVHizH8q.js +0 -162
  83. package/dist/web/assets/ganttDiagram-T4ZO3ILL-dLF_Rbaw.js +0 -292
  84. package/dist/web/assets/gitGraphDiagram-UUTBAWPF-BNMxCpkL.js +0 -106
  85. package/dist/web/assets/graph-p7_cO2pv.js +0 -1
  86. package/dist/web/assets/index-5eJ_7IuO.css +0 -1
  87. package/dist/web/assets/index-DoJ58x_f.js +0 -6291
  88. package/dist/web/assets/infoDiagram-42DDH7IO-BDffsV8g.js +0 -2
  89. package/dist/web/assets/ishikawaDiagram-UXIWVN3A-C7fw-Hwt.js +0 -70
  90. package/dist/web/assets/journeyDiagram-VCZTEJTY-CuEYHG93.js +0 -139
  91. package/dist/web/assets/kanban-definition-6JOO6SKY-iodYb2rc.js +0 -89
  92. package/dist/web/assets/layout-Dblo7Nv4.js +0 -1
  93. package/dist/web/assets/linear-Dj7ICVZv.js +0 -1
  94. package/dist/web/assets/min-BC0MiAVU.js +0 -1
  95. package/dist/web/assets/mindmap-definition-QFDTVHPH-Bi8kR-nH.js +0 -96
  96. package/dist/web/assets/pieDiagram-DEJITSTG-DFXNJaaz.js +0 -30
  97. package/dist/web/assets/quadrantDiagram-34T5L4WZ-eG750Sg7.js +0 -7
  98. package/dist/web/assets/requirementDiagram-MS252O5E-BOS23lbk.js +0 -84
  99. package/dist/web/assets/sankeyDiagram-XADWPNL6-iuLPdF16.js +0 -10
  100. package/dist/web/assets/sequenceDiagram-FGHM5R23-9dOhL1F_.js +0 -157
  101. package/dist/web/assets/stateDiagram-FHFEXIEX-DiYubp3u.js +0 -1
  102. package/dist/web/assets/stateDiagram-v2-QKLJ7IA2-C0u2afgY.js +0 -1
  103. package/dist/web/assets/timeline-definition-GMOUNBTQ-B7K2SCHF.js +0 -120
  104. package/dist/web/assets/vennDiagram-DHZGUBPP-DwsDXISO.js +0 -34
  105. package/dist/web/assets/wardley-RL74JXVD-DOtyNPcb.js +0 -162
  106. package/dist/web/assets/wardleyDiagram-NUSXRM2D-IO3BUkVB.js +0 -20
  107. package/dist/web/assets/xychartDiagram-5P7HB3ND-B_eC9Ig0.js +0 -7
@@ -0,0 +1,16 @@
1
+ var du=Object.defineProperty;var hu=(n,e,t)=>e in n?du(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var x=(n,e,t)=>hu(n,typeof e!="symbol"?e+"":e,t);function O(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function ea(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);t.search=r.toString(),console.warn(`Minified Lexical warning #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const Gt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,gu=Gt&&"documentMode"in document?document.documentMode:null,Ut=Gt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ae=Gt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),zr=!(!Gt||!("InputEvent"in window)||gu)&&"getTargetRanges"in new window.InputEvent("input"),oo=Gt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ar=Gt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,pu=Gt&&/Android/.test(navigator.userAgent),na=Gt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Yo=Gt&&pu&&na,io=Gt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ut&&!na,_u=0,mu=1,yu=2,Bh=1,Jh=2,Hh=4,Uh=8,jh=16,Vh=32,Yh=64,ra=128,Cu=1,Su=2,xu=3,vu=4,bu=5,wu=6,Qn=oo||ar||io?" ":"​",so=`
2
+
3
+ `,$i=Ae?" ":Qn,Me={bold:1,capitalize:1024,code:16,highlight:ra,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Nu={directionless:1,unmergeable:2},qo={center:2,end:6,justify:4,left:1,right:3,start:5},Tu={[Su]:"center",[wu]:"end",[vu]:"justify",[Cu]:"left",[xu]:"right",[bu]:"start"},ku={normal:0,segmented:2,token:1},Eu={[_u]:"normal",[yu]:"segmented",[mu]:"token"},xs="$config";function oa(n,e,t,r,o,i){let s=n.getFirstChild();for(;s!==null;){const l=s.__key;s.__parent===e&&(b(s)&&oa(s,l,t,r,o,i),t.has(l)||i.delete(l),o.push(l)),s=s.getNextSibling()}}let Xo=!1,Pi=0;function Ou(n){Pi=n.timeStamp}function Eo(n,e,t){const r=n.nodeName==="BR",o=e.__lexicalLineBreak;return o&&(n===o||r&&n.previousSibling===o)||r&&_o(n,t)!==void 0}function Au(n,e,t){const r=wt(Kt(t));let o=null,i=null;r!==null&&r.anchorNode===n&&(o=r.anchorOffset,i=r.focusOffset);const s=n.nodeValue;s!==null&&rs(e,s,o,i,!1)}function Mu(n,e,t){if(E(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return ve(e)&&t.isAttached()}function Fu(n,e,t,r){for(let o=n;o&&!If(o);o=hr(o)){const i=_o(o,e);if(i!==void 0){const s=tt(i,t);if(s)return Y(s)||!nt(o)?void 0:[o,s]}else if(o===r)return[r,sc(t)]}}function ia(n,e,t){Xo=!0;const r=performance.now()-Pi>100;try{re(n,()=>{const o=M()||function(d){return d.getEditorState().read(()=>{const g=M();return g!==null?g.clone():null})}(n),i=new Map,s=n.getRootElement(),l=n._editorState,a=n._blockCursorElement;let c=!1,u="";for(let d=0;d<e.length;d++){const g=e[d],h=g.type,p=g.target,_=Fu(p,n,l,s);if(!_)continue;const[m,y]=_;if(h==="characterData")r&&F(y)&&ve(p)&&Mu(o,p,y)&&Au(p,y,n);else if(h==="childList"){c=!0;const C=g.addedNodes;for(let S=0;S<C.length;S++){const T=C[S],k=oc(T),w=T.parentNode;if(w!=null&&T!==a&&k===null&&!Eo(T,w,n)){if(Ae){const A=(nt(T)?T.innerText:null)||T.nodeValue;A&&(u+=A)}w.removeChild(T)}}const v=g.removedNodes,N=v.length;if(N>0){let S=0;for(let T=0;T<N;T++){const k=v[T];(Eo(k,p,n)||a===k)&&(p.appendChild(k),S++)}N!==S&&i.set(m,y)}}}if(i.size>0)for(const[d,g]of i)g.reconcileObservedMutation(d,n);const f=t.takeRecords();if(f.length>0){for(let d=0;d<f.length;d++){const g=f[d],h=g.addedNodes,p=g.target;for(let _=0;_<h.length;_++){const m=h[_],y=m.parentNode;y==null||m.nodeName!=="BR"||Eo(m,p,n)||y.removeChild(m)}}t.takeRecords()}o!==null&&(c&&et(o),Ae&&uc(n)&&o.insertRawText(u))})}finally{Xo=!1}}function sa(n){const e=n._observer;e!==null&&ia(n,e.takeRecords(),e)}function la(n){(function(e){Pi===0&&Kt(e).addEventListener("textInput",Ou,!0)})(n),n._observer=new MutationObserver((e,t)=>{ia(n,e,t)})}let $u=class{constructor(e,t){x(this,"key");x(this,"parse");x(this,"unparse");x(this,"isEqual");x(this,"defaultValue");x(this,"resetOnCopyNode");this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||Ku).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function Pu(n,e){return new $u(n,e)}function Du(n){const e=new Map,t=new Set;for(let r=typeof n=="function"?n:n.replace;r.prototype&&r.prototype.getType!==void 0;r=Object.getPrototypeOf(r)){const{ownNodeConfig:o}=mo(r);if(o&&o.stateConfigs)for(const i of o.stateConfigs){let s;"stateConfig"in i?(s=i.stateConfig,i.flat&&t.add(s.key)):s=i,e.set(s.key,s)}}return{flatKeys:t,sharedConfigMap:e}}let Ru=class aa{constructor(e,t,r=void 0,o=new Map,i=void 0){x(this,"node");x(this,"knownState");x(this,"unknownState");x(this,"sharedNodeState");x(this,"size");this.node=e,this.sharedNodeState=t,this.unknownState=r,this.knownState=o;const{sharedConfigMap:s}=this.sharedNodeState,l=i!==void 0?i:function(a,c,u){let f=u.size;if(c)for(const d in c){const g=a.get(d);g&&u.has(g)||f++}return f}(s,r,o);this.size=l}getValue(e){const t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let r=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){const o=this.unknownState[e.key];o!==void 0&&(r=e.parse(o)),this.updateFromKnown(e,r)}return r}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState},t={};for(const[r,o]of this.knownState)r.isEqual(o,r.defaultValue)?delete e[r.key]:e[r.key]=r.unparse(o);for(const r of this.sharedNodeState.flatKeys)r in e&&(t[r]=e[r],delete e[r]);return vs(e)&&(t.$=e),t}getWritable(e){if(this.node===e)return this;const{sharedNodeState:t,unknownState:r}=this,o=new Map(this.knownState);return new aa(e,t,function(i,s,l){let a;if(l)for(const[c,u]of Object.entries(l)){const f=i.get(c);f?s.has(f)||s.set(f,f.parse(u)):(a=a||{},a[c]=u)}return a}(t.sharedConfigMap,o,r),o,this.size)}resetOnCopyNode(){for(const e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){const r=e.key;this.sharedNodeState.sharedConfigMap.set(r,e);const{knownState:o,unknownState:i}=this;o.has(e)||i&&r in i||(i&&(delete i[r],this.unknownState=vs(i)),this.size++),o.set(e,t)}updateFromUnknown(e,t){const r=this.sharedNodeState.sharedConfigMap.get(e);r?this.updateFromKnown(r,r.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){const{knownState:t}=this;for(const r of t.keys())t.set(r,r.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(const[r,o]of Object.entries(e))this.updateFromUnknown(r,o)}};function Lu(n){const e=n.getWritable(),t=e.__state?e.__state.getWritable(e):new Ru(e,ca(e));return e.__state=t,t}function ca(n){return n.__state?n.__state.sharedNodeState:Qa(Dn(),n.getType()).sharedNodeState}function vs(n){if(n)for(const e in n)return n}function Ku(n){return n}function bs(n,e,t){for(const[r,o]of e.knownState){if(n.has(r.key))continue;n.add(r.key);const i=t?t.getValue(r):r.defaultValue;if(i!==o&&!r.isEqual(i,o))return!0}return!1}function ws(n,e,t){const{unknownState:r}=e,o=t?t.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 Ns(n,e){const t=n.__state;return t&&t.node===n?t.getWritable(e):t}function Ts(n,e){const t=n.__mode,r=n.__format,o=n.__style,i=e.__mode,s=e.__format,l=e.__style,a=n.__state,c=e.__state;return(t===null||t===i)&&(r===null||r===s)&&(o===null||o===l)&&(n.__state===null||a===c||function(u,f){if(u===f)return!0;if(u&&f&&u.size!==f.size)return!1;const d=new Set;return!(u&&bs(d,u,f)||f&&bs(d,f,u)||u&&ws(d,u,f)||f&&ws(d,f,u))}(a,c))}function ks(n,e){const t=n.mergeWithSibling(e),r=Z()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function Es(n){let e,t,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&F(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Ts(e,r)){r=ks(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&F(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Ts(r,t)){r=ks(r,t);break}break}t.remove()}}else r.remove()}function Zn(n){return Os(n.anchor),Os(n.focus),n}function Os(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let r,o;if(t===e.getChildrenSize()?(r=e.getChildAtIndex(t-1),o=!0):(r=e.getChildAtIndex(t),o=!1),F(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)}}let je,Ct,tr,lo,Go,Qo,Ve,Vt,Zo,er,ft="",ee=null,Ie=null,gn=!1,Wr=!1;function Br(n,e){const t=Ve.get(n);if(e!==null){const r=ri(n);r.parentNode===e&&e.removeChild(r)}if(Vt.has(n)||Ct._keyToDOMMap.delete(n),b(t)){const r=Hr(t,Ve);ti(r,0,r.length-1,null)}t!==void 0&&os(er,tr,lo,t,"destroyed")}function ti(n,e,t,r){for(let o=e;o<=t;++o){const i=n[o];i!==void 0&&Br(i,r)}}function Ke(n,e){n.setProperty("text-align",e)}const Iu="40px";function ua(n,e){const t=je.theme.indent;if(typeof t=="string"){const o=n.classList.contains(t);e>0&&!o?n.classList.add(t):e<1&&o&&n.classList.remove(t)}if(e===0)return void n.style.setProperty("padding-inline-start","");const r=getComputedStyle(Ct._rootElement||n).getPropertyValue("--lexical-indent-base-value")||Iu;n.style.setProperty("padding-inline-start",`calc(${e} * ${r})`)}function fa(n,e){const t=n.style;e===0?Ke(t,""):e===1?Ke(t,"left"):e===2?Ke(t,"center"):e===3?Ke(t,"right"):e===4?Ke(t,"justify"):e===5?Ke(t,"start"):e===6&&Ke(t,"end")}function ei(n,e){const t=function(r){const o=r.__dir;if(o!==null)return o;if(at(r))return null;const i=r.getParentOrThrow();return at(i)&&i.__dir===null?"auto":null}(e);t!==null?n.dir=t:n.removeAttribute("dir")}function Jr(n,e){const t=Vt.get(n);t===void 0&&O(60);const r=t.createDOM(je,Ct);if(function(o,i,s){const l=s._keyToDOMMap;(function(a,c,u){const f=`__lexicalKey_${c._key}`;a[f]=u})(i,s,o),l.set(o,i)}(n,r,Ct),F(t)?r.setAttribute("data-lexical-text","true"):Y(t)&&r.setAttribute("data-lexical-decorator","true"),b(t)){const o=t.__indent,i=t.__size;if(ei(r,t),o!==0&&ua(r,o),i!==0){const l=i-1;ni(Hr(t,Vt),t,0,l,t.getDOMSlot(r))}const s=t.__format;s!==0&&fa(r,s),t.isInline()||da(null,t,r)}else{const o=t.getTextContent();if(Y(t)){const i=t.decorate(Ct,je);i!==null&&ha(n,i),r.contentEditable="false"}ft+=o}return e!==null&&e.insertChild(r),os(er,tr,lo,t,"created"),r}function ni(n,e,t,r,o){const i=ft;ft="";let s=t;for(;s<=r;++s){Jr(n[s],o);const l=Vt.get(n[s]);l!==null&&F(l)?ee===null&&(ee=l.getFormat(),Ie=l.getStyle()):b(l)&&s<r&&!l.isInline()&&(ft+=so)}o.element.__lexicalTextContent=ft,ft=i+ft}function As(n,e){if(n){const t=n.__last;if(t){const r=e.get(t);if(r)return Jt(r)?"line-break":Y(r)&&r.isInline()?"decorator":null}return"empty"}return null}function da(n,e,t){const r=As(n,Ve),o=As(e,Vt);r!==o&&e.getDOMSlot(t).setManagedLineBreak(o)}function zu(n,e,t){var r;ee=null,Ie=null,function(o,i,s){const l=ft,a=o.__size,c=i.__size;ft="";const u=s.element;if(a===1&&c===1){const f=o.__first,d=i.__first;if(f===d)Mr(f,u);else{const h=ri(f),p=Jr(d,null);try{u.replaceChild(p,h)}catch(_){if(typeof _=="object"&&_!=null){const m=`${_.toString()} Parent: ${u.tagName}, new child: {tag: ${p.tagName} key: ${d}}, old child: {tag: ${h.tagName}, key: ${f}}.`;throw new Error(m)}throw _}Br(f,null)}const g=Vt.get(d);F(g)&&ee===null&&(ee=g.getFormat(),Ie=g.getStyle())}else{const f=Hr(o,Ve),d=Hr(i,Vt);if(f.length!==a&&O(227),d.length!==c&&O(228),a===0)c!==0&&ni(d,0,0,c-1,s);else if(c===0){if(a!==0){const g=s.after==null&&s.before==null&&s.element.__lexicalLineBreak==null;ti(f,0,a-1,g?null:u),g&&(u.textContent="")}}else(function(g,h,p,_,m,y){const C=_-1,v=m-1;let N,S,T=y.getFirstChild(),k=0,w=0;for(;k<=C&&w<=v;){const K=h[k],I=p[w];if(K===I)T=Oo(Mr(I,y.element)),k++,w++;else{if(S===void 0&&(S=Ms(p,w)),N===void 0)N=Ms(h,k);else if(!N.has(K)){k++;continue}if(!S.has(K)){T=Oo(ri(K)),Br(K,y.element),k++,N.delete(K);continue}if(N.has(I)){const G=kn(Ct,I);G!==T&&y.withBefore(T).insertChild(G),T=Oo(Mr(I,y.element)),k++,w++}else Jr(I,y.withBefore(T)),w++}const z=Vt.get(I);z!==null&&F(z)?ee===null&&(ee=z.getFormat(),Ie=z.getStyle()):b(z)&&w<=v&&!z.isInline()&&(ft+=so)}const A=k>C,$=w>v;if(A&&!$){const K=p[v+1],I=K===void 0?null:Ct.getElementByKey(K);ni(p,0,w,v,y.withBefore(I))}else $&&!A&&ti(h,k,C,y.element)})(0,f,d,a,c,s)}u.__lexicalTextContent=ft,ft=l+ft}(n,e,e.getDOMSlot(t)),r=e,ee==null||ee===r.__textFormat||Wr||r.setTextFormat(ee),function(o){Ie==null||Ie===o.__textStyle||Wr||o.setTextStyle(Ie)}(e)}function Hr(n,e){const t=[];let r=n.__first;for(;r!==null;){const o=e.get(r);o===void 0&&O(101),t.push(r),r=o.__next}return t}function Mr(n,e){const t=Ve.get(n);let r=Vt.get(n);t!==void 0&&r!==void 0||O(61);const o=gn||Qo.has(n)||Go.has(n),i=kn(Ct,n);if(t===r&&!o){let s;if(b(t)){const l=i.__lexicalTextContent;typeof l=="string"?s=l:(s=t.getTextContent(),i.__lexicalTextContent=s)}else s=t.getTextContent();return ft+=s,i}if(t!==r&&o&&os(er,tr,lo,r,"updated"),r.updateDOM(t,i,je)){const s=Jr(n,null);return e===null&&O(62),e.replaceChild(s,i),Br(n,null),s}if(b(t)){b(r)||O(334,n);const s=r.__indent;(gn||s!==t.__indent)&&ua(i,s);const l=r.__format;if((gn||l!==t.__format)&&fa(i,l),o)zu(t,r,i),at(r)||r.isInline()||da(t,r,i);else{const a=i.__lexicalTextContent;let c;typeof a=="string"?c=a:(c=t.getTextContent(),i.__lexicalTextContent=c),ft+=c}if((gn||r.__dir!==t.__dir)&&(ei(i,r),at(r)&&!gn))for(const a of r.getChildren())b(a)&&ei(kn(Ct,a.getKey()),a)}else{const s=r.getTextContent();if(Y(r)){const l=r.decorate(Ct,je);l!==null&&ha(n,l)}ft+=s}if(!Wr&&at(r)&&r.__cachedText!==ft){const s=r.getWritable();s.__cachedText=ft,r=s}return i}function ha(n,e){let t=Ct._pendingDecorators;const r=Ct._decorators;if(t===null){if(r[n]===e)return;t=ic(Ct)}t[n]=e}function Oo(n){let e=n.nextSibling;return e!==null&&e===Ct._blockCursorElement&&(e=e.nextSibling),e}function Ms(n,e){const t=new Set;for(let r=e;r<n.length;r++)t.add(n[r]);return t}function Wu(n,e,t,r,o,i){ft="",gn=r===2,Ct=t,je=t._config,tr=t._nodes,lo=Ct._listeners.mutation,Go=o,Qo=i,Ve=n._nodeMap,Vt=e._nodeMap,Wr=e._readOnly,Zo=new Map(t._keyToDOMMap);const s=new Map;return er=s,Mr("root",null),Ct=void 0,tr=void 0,Go=void 0,Qo=void 0,Ve=void 0,Vt=void 0,je=void 0,Zo=void 0,er=void 0,s}function ri(n){const e=Zo.get(n);return e===void 0&&O(75,n),e}function R(n){return{type:n}}const pe=R("SELECTION_CHANGE_COMMAND"),ga=R("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Di=R("CLICK_COMMAND"),pa=R("BEFORE_INPUT_COMMAND"),_a=R("INPUT_COMMAND"),ma=R("COMPOSITION_START_COMMAND"),ya=R("COMPOSITION_END_COMMAND"),Ee=R("DELETE_CHARACTER_COMMAND"),Sn=R("INSERT_LINE_BREAK_COMMAND"),Ye=R("INSERT_PARAGRAPH_COMMAND"),Be=R("CONTROLLED_TEXT_INSERTION_COMMAND"),Ri=R("PASTE_COMMAND"),oi=R("REMOVE_TEXT_COMMAND"),Nn=R("DELETE_WORD_COMMAND"),qe=R("DELETE_LINE_COMMAND"),_e=R("FORMAT_TEXT_COMMAND"),Li=R("UNDO_COMMAND"),Ki=R("REDO_COMMAND"),Ca=R("KEYDOWN_COMMAND"),Ii=R("KEY_ARROW_RIGHT_COMMAND"),Bu=R("MOVE_TO_END"),zi=R("KEY_ARROW_LEFT_COMMAND"),Ju=R("MOVE_TO_START"),Wi=R("KEY_ARROW_UP_COMMAND"),Bi=R("KEY_ARROW_DOWN_COMMAND"),Ur=R("KEY_ENTER_COMMAND"),Sa=R("KEY_SPACE_COMMAND"),Ji=R("KEY_BACKSPACE_COMMAND"),Hi=R("KEY_ESCAPE_COMMAND"),Ui=R("KEY_DELETE_COMMAND"),ji=R("KEY_TAB_COMMAND"),Hu=R("INSERT_TAB_COMMAND"),Uu=R("INDENT_CONTENT_COMMAND"),Fs=R("OUTDENT_CONTENT_COMMAND"),xa=R("DROP_COMMAND"),va=R("FORMAT_ELEMENT_COMMAND"),ba=R("DRAGSTART_COMMAND"),wa=R("DRAGOVER_COMMAND"),ju=R("DRAGEND_COMMAND"),ao=R("COPY_COMMAND"),co=R("CUT_COMMAND"),jr=R("SELECT_ALL_COMMAND"),Vu=R("CLEAR_EDITOR_COMMAND"),Yu=R("CLEAR_HISTORY_COMMAND"),yr=R("CAN_REDO_COMMAND"),Cr=R("CAN_UNDO_COMMAND"),Na=R("FOCUS_COMMAND"),qu=R("BLUR_COMMAND"),Xu=R("KEY_MODIFIER_COMMAND"),le=Object.freeze({}),ii=[["keydown",function(n,e){nr=n.timeStamp,Ta=n.key,!e.isComposing()&&P(e,Ca,n)}],["pointerdown",function(n,e){const t=n.target,r=n.pointerType;se(t)&&r!=="touch"&&r!=="pen"&&n.button===0&&re(e,()=>{Za(t)||(ai=!0)})}],["compositionstart",function(n,e){P(e,ma,n)}],["compositionend",function(n,e){Ae?Bn=!0:ar||!oo&&!io?P(e,ya,n):(Fr=!0,$r=n.data)}],["input",function(n,e){n.stopPropagation(),re(e,()=>{e.dispatchCommand(_a,n)},{event:n}),pn=null}],["click",function(n,e){re(e,()=>{const t=M(),r=wt(Kt(e)),o=Lt();if(r){if(E(t)){const i=t.anchor,s=i.getNode();if(i.type==="element"&&i.offset===0&&t.isCollapsed()&&!at(s)&&ct().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&o!==null&&t.is(o))r.removeAllRanges(),t.dirty=!0;else if(n.detail===3&&!t.isCollapsed()&&s!==t.focus.getNode()){const l=B(s,a=>b(a)&&!a.isInline());b(l)&&l.select(0)}}else if(n.pointerType==="touch"||n.pointerType==="pen"){const i=r.anchorNode;(nt(i)||ve(i))&&et(ho(o,r,e,n))}}P(e,Di,n)})}],["cut",le],["copy",le],["dragstart",le],["dragover",le],["dragend",le],["paste",le],["focus",le],["blur",le],["drop",le]];zr&&ii.push(["beforeinput",(n,e)=>function(t,r){const o=t.inputType;o==="deleteCompositionText"||Ae&&uc(r)||o!=="insertCompositionText"&&P(r,pa,t)}(n,e)]);let nr=0,Ta=null,ka=0,pn=null;const si=new WeakMap,Vr=new WeakMap;let li=!1,ai=!1,jn=!1,Bn=!1,Fr=!1,$r="",ze=null,Ea=[0,"",0,"root",0];function Oa(n,e,t,r,o){const i=n.anchor,s=n.focus,l=i.getNode(),a=Z(),c=wt(Kt(a)),u=c!==null?c.anchorNode:null,f=i.key,d=a.getElementByKey(f),g=t.length;return f!==s.key||!F(l)||(!o&&(!zr||ka<r+50)||l.isDirty()&&g<2||lc(t))&&i.offset!==s.offset&&!l.isComposing()||ue(l)||l.isDirty()&&g>1||(o||!zr)&&d!==null&&!l.isComposing()&&u!==Tn(d)||c!==null&&e!==null&&(!e.collapsed||e.startContainer!==c.anchorNode||e.startOffset!==c.anchorOffset)||!l.isComposing()&&(l.getFormat()!==n.format||l.getStyle()!==n.style)||function(h,p){if(p.isSegmented())return!0;if(!h.isCollapsed())return!1;const _=h.anchor.offset,m=p.getParentOrThrow(),y=Je(p);return _===0?!p.canInsertTextBefore()||!m.canInsertTextBefore()&&!p.isComposing()||y||function(C){const v=C.getPreviousSibling();return(F(v)||b(v)&&v.isInline())&&!v.canInsertTextAfter()}(p):_===p.getTextContentSize()&&(!p.canInsertTextAfter()||!m.canInsertTextAfter()&&!p.isComposing()||y)}(n,l)}function $s(n,e){return ve(n)&&n.nodeValue!==null&&e!==0&&e!==n.nodeValue.length}function Ps(n,e,t){const{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}=n;li&&(li=!1,$s(r,o)&&$s(i,s)&&!ze)||re(e,()=>{if(!t)return void et(null);if(!dr(e,r,i))return;let l=M();if(ze&&E(l)&&l.isCollapsed()){const a=l.anchor,c=ze.anchor;(a.key===c.key&&a.offset===c.offset+1||a.offset===1&&c.getNode().is(a.getNode().getPreviousSibling()))&&(l=ze.clone(),et(l))}if(ze=null,E(l)){const a=l.anchor,c=a.getNode();if(l.isCollapsed()){n.type==="Range"&&n.anchorNode===n.focusNode&&(l.dirty=!0);const u=Kt(e).event,f=u?u.timeStamp:performance.now(),[d,g,h,p,_]=Ea,m=ct(),y=e.isComposing()===!1&&m.getTextContent()==="";if(f<_+200&&a.offset===h&&a.key===p)Pr(l,d,g);else if(a.type==="text")F(c)||O(141),Aa(l,c);else if(a.type==="element"&&!y){b(c)||O(259);const C=a.getNode();C.isEmpty()?function(v,N){const S=N.getTextFormat(),T=N.getTextStyle();Pr(v,S,T)}(l,C):Pr(l,l.format,"")}}else{const u=a.key,f=l.focus.key,d=l.getNodes(),g=d.length,h=l.isBackward(),p=h?s:o,_=h?o:s,m=h?f:u,y=h?u:f;let C=2047,v=!1;for(let N=0;N<g;N++){const S=d[N],T=S.getTextContentSize();if(F(S)&&T!==0&&!(N===0&&S.__key===m&&p===T||N===g-1&&S.__key===y&&_===0)&&(v=!0,C&=S.getFormat(),C===0))break}l.format=v?C:0}}P(e,pe,void 0)})}function Pr(n,e,t){n.format===e&&n.style===t||(n.format=e,n.style=t,n.dirty=!0)}function Aa(n,e){Pr(n,e.getFormat(),e.getStyle())}function Ma(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function Gu(n){const e=n.inputType,t=Ma(n),r=Z(),o=M();if(e==="deleteContentBackward"){if(o===null){const f=Lt();if(!E(f))return!0;et(f.clone())}if(E(o)){const f=o.anchor.key===o.focus.key;if(i=n.timeStamp,Ta==="MediaLast"&&i<nr+30&&r.isComposing()&&f){if(yt(null),nr=0,setTimeout(()=>{re(r,()=>{yt(null)})},30),E(o)){const d=o.anchor.getNode();d.markDirty(),F(d)||O(142),Aa(o,d)}}else{yt(null),n.preventDefault();const d=o.anchor.getNode(),g=d.getTextContent(),h=d.canInsertTextAfter(),p=o.anchor.offset===0&&o.focus.offset===g.length;let _=Yo&&f&&!p&&h;if(_&&o.isCollapsed()&&(_=!Y(gi(o.anchor,!0))),!_){P(r,Ee,!0);const m=M();Yo&&E(m)&&m.isCollapsed()&&(ze=m,setTimeout(()=>ze=null))}}return!0}}var i;if(!E(o))return!0;const s=n.data;pn!==null&&ns(!1,r,pn),o.dirty&&pn===null||!o.isCollapsed()||at(o.anchor.getNode())||t===null||o.applyDOMRange(t),pn=null;const l=o.anchor,a=o.focus,c=l.getNode(),u=a.getNode();if(e==="insertText"||e==="insertTranspose"){if(s===`
4
+ `)n.preventDefault(),P(r,Sn,!1);else if(s===so)n.preventDefault(),P(r,Ye,void 0);else if(s==null&&n.dataTransfer){const f=n.dataTransfer.getData("text/plain");n.preventDefault(),o.insertRawText(f)}else s!=null&&Oa(o,t,s,n.timeStamp,!0)?(n.preventDefault(),P(r,Be,s)):pn=s;return ka=n.timeStamp,!0}switch(n.preventDefault(),e){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":P(r,Be,n);break;case"insertFromComposition":yt(null),P(r,Be,n);break;case"insertLineBreak":yt(null),P(r,Sn,!1);break;case"insertParagraph":yt(null),jn&&!ar?(jn=!1,P(r,Sn,!1)):P(r,Ye,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":P(r,Ri,n);break;case"deleteByComposition":(function(f,d){return f!==d||b(f)||b(d)||!Je(f)||!Je(d)})(c,u)&&P(r,oi,n);break;case"deleteByDrag":case"deleteByCut":P(r,oi,n);break;case"deleteContent":P(r,Ee,!1);break;case"deleteWordBackward":P(r,Nn,!0);break;case"deleteWordForward":P(r,Nn,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":P(r,qe,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":P(r,qe,!1);break;case"formatStrikeThrough":P(r,_e,"strikethrough");break;case"formatBold":P(r,_e,"bold");break;case"formatItalic":P(r,_e,"italic");break;case"formatUnderline":P(r,_e,"underline");break;case"historyUndo":P(r,Li,void 0);break;case"historyRedo":P(r,Ki,void 0)}return!0}function Qu(n){if(nt(n.target)&&Za(n.target))return!0;const e=Z(),t=M(),r=n.data,o=Ma(n);if(r!=null&&E(t)&&Oa(t,o,r,n.timeStamp,!1)){Bn&&(Yr(e,r),Bn=!1);const i=t.anchor.getNode(),s=wt(Kt(e));if(s===null)return!0;const l=t.isBackward(),a=l?t.anchor.offset:t.focus.offset,c=l?t.focus.offset:t.anchor.offset;zr&&!t.isCollapsed()&&F(i)&&s.anchorNode!==null&&i.getTextContent().slice(0,a)+r+i.getTextContent().slice(a+c)===cc(s.anchorNode)||P(e,Be,r);const u=r.length;Ae&&u>1&&n.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=u),Yo&&e.isComposing()&&(nr=0,yt(null))}else ns(!1,e,r!==null?r:void 0),Bn&&(Yr(e,r||void 0),Bn=!1);return function(){mt();const i=Z();sa(i)}(),!0}function Zu(n){const e=Z(),t=M();if(E(t)&&!e.isComposing()){const r=t.anchor,o=t.anchor.getNode();yt(r.key),is(Da),(n.timeStamp<nr+30||r.type==="element"||!t.isCollapsed()||o.getFormat()!==t.format||F(o)&&o.getStyle()!==t.style)&&P(e,Be,$i)}return!0}function tf(n){return Yr(Z(),n.data),is(Ra),!0}function Yr(n,e){const t=n._compositionKey;if(yt(null),t!==null&&e!=null){if(e===""){const r=tt(t),o=Tn(n.getElementByKey(t));if(o!==null&&o.nodeValue!==null&&F(r)){const i=wt(Kt(n));let s=null,l=null;i!==null&&i.anchorNode===o&&(s=i.anchorOffset,l=i.focusOffset),rs(r,o.nodeValue,s,l,!0)}return}if(e[e.length-1]===`
5
+ `){const r=M();if(E(r)||Ft(r)){if(E(r)){const o=r.focus;r.anchor.set(o.key,o.offset,o.type)}return void P(n,Ur,null)}}}ns(!0,n,e)}function ef(n){const e=Z();if(n.key==null)return!0;if(Fr){if(ll(n))return re(e,()=>{Yr(e,$r)}),Fr=!1,$r="",!0;Fr=!1,$r=""}if(function(t){return X(t,"ArrowRight",{shiftKey:"any"})}(n))P(e,Ii,n);else if(function(t){return X(t,"ArrowRight",ce)}(n))P(e,Bu,n);else if(function(t){return X(t,"ArrowLeft",{shiftKey:"any"})}(n))P(e,zi,n);else if(function(t){return X(t,"ArrowLeft",ce)}(n))P(e,Ju,n);else if(function(t){return X(t,"ArrowUp",{altKey:"any",shiftKey:"any"})}(n))P(e,Wi,n);else if(function(t){return X(t,"ArrowDown",{altKey:"any",shiftKey:"any"})}(n))P(e,Bi,n);else if(function(t){return X(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(n))jn=!0,P(e,Ur,n);else if(function(t){return t.key===" "}(n))P(e,Sa,n);else if(function(t){return Ut&&X(t,"o",{ctrlKey:!0})}(n))n.preventDefault(),jn=!0,P(e,Sn,!0);else if(function(t){return X(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(n))jn=!1,P(e,Ur,n);else if(function(t){return X(t,"Backspace",{shiftKey:"any"})||Ut&&X(t,"h",{ctrlKey:!0})}(n))ll(n)?P(e,Ji,n):(n.preventDefault(),P(e,Ee,!0));else if(function(t){return t.key==="Escape"}(n))P(e,Hi,n);else if(function(t){return X(t,"Delete",{})||Ut&&X(t,"d",{ctrlKey:!0})}(n))(function(t){return t.key==="Delete"})(n)?P(e,Ui,n):(n.preventDefault(),P(e,Ee,!1));else if(function(t){return X(t,"Backspace",sl)}(n))n.preventDefault(),P(e,Nn,!0);else if(function(t){return X(t,"Delete",sl)}(n))n.preventDefault(),P(e,Nn,!1);else if(function(t){return Ut&&X(t,"Backspace",{metaKey:!0})}(n))n.preventDefault(),P(e,qe,!0);else if(function(t){return Ut&&(X(t,"Delete",{metaKey:!0})||X(t,"k",{ctrlKey:!0}))}(n))n.preventDefault(),P(e,qe,!1);else if(function(t){return X(t,"b",ce)}(n))n.preventDefault(),P(e,_e,"bold");else if(function(t){return X(t,"u",ce)}(n))n.preventDefault(),P(e,_e,"underline");else if(function(t){return X(t,"i",ce)}(n))n.preventDefault(),P(e,_e,"italic");else if(function(t){return X(t,"Tab",{shiftKey:"any"})}(n))P(e,ji,n);else if(function(t){return X(t,"z",ce)}(n))n.preventDefault(),P(e,Li,void 0);else if(function(t){return Ut?X(t,"z",{metaKey:!0,shiftKey:!0}):X(t,"y",{ctrlKey:!0})||X(t,"z",{ctrlKey:!0,shiftKey:!0})}(n))n.preventDefault(),P(e,Ki,void 0);else{const t=e._editorState._selection;t===null||E(t)?al(n)&&(n.preventDefault(),P(e,jr,n)):function(r){return X(r,"c",ce)}(n)?(n.preventDefault(),P(e,ao,n)):function(r){return X(r,"x",ce)}(n)?(n.preventDefault(),P(e,co,n)):al(n)&&(n.preventDefault(),P(e,jr,n))}return function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey}(n)&&e.dispatchCommand(Xu,n),!0}function Fa(n){let e=n.__lexicalEventHandles;return e===void 0&&(e=[],n.__lexicalEventHandles=e),e}const xn=new Map;function $a(n){const e=Df(n.target);if(e===null)return;const t=tc(e.anchorNode);if(t===null)return;ai&&(ai=!1,re(t,()=>{const a=Lt(),c=e.anchorNode;(nt(c)||ve(c))&&et(ho(a,e,t,n))}));const r=es(t),o=r[r.length-1],i=o._key,s=xn.get(i),l=s||o;l!==t&&Ps(e,l,!1),Ps(e,t,!0),t!==o?xn.set(i,t):s&&xn.delete(i)}function Ds(n){n._lexicalHandled=!0}function Rs(n){return n._lexicalHandled===!0}function nf(n){const e=si.get(n);if(e===void 0)return;const t=Vr.get(e);if(t===void 0)return;const r=t-1;r>=0||O(164),si.delete(n),Vr.set(e,r),r===0&&e.removeEventListener("selectionchange",$a);const o=po(n);ts(o)?(function(s){if(s._parentEditor!==null){const l=es(s),a=l[l.length-1]._key;xn.get(a)===s&&xn.delete(a)}else xn.delete(s._key)}(o),n.__lexicalEditor=null):o&&O(198);const i=Fa(n);for(let s=0;s<i.length;s++)i[s]();n.__lexicalEventHandles=[]}function ci(n,e,t){mt();const r=n.__key,o=n.getParent();if(o===null)return;const i=function(l){const a=M();if(!E(a)||!b(l))return a;const{anchor:c,focus:u}=a,f=c.getNode(),d=u.getNode();return pi(f,l)&&c.set(l.__key,0,"element"),pi(d,l)&&u.set(l.__key,0,"element"),a}(n);let s=!1;if(E(i)&&e){const l=i.anchor,a=i.focus;l.key===r&&(Gr(l,n,o,n.getPreviousSibling(),n.getNextSibling()),s=!0),a.key===r&&(Gr(a,n,o,n.getPreviousSibling(),n.getNextSibling()),s=!0)}else Ft(i)&&e&&n.isSelected()&&n.selectPrevious();if(E(i)&&e&&!s){const l=n.getIndexWithinParent();He(n),Xr(i,o,l,-1)}else He(n);t||Et(o)||o.canBeEmpty()||!o.isEmpty()||ci(o,e),e&&i&&at(o)&&o.isEmpty()&&o.selectEnd()}const Pa=Symbol.for("ephemeral");function qr(n){return n[Pa]||!1}class Yt{constructor(e){x(this,"__type");x(this,"__key");x(this,"__parent");x(this,"__prev");x(this,"__next");x(this,"__state");this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),rc(this,e)}static getType(){const{ownNodeType:e}=mo(this);return e===void 0&&O(64,this.name),e}static clone(e){O(65,this.name)}$config(){return{}}config(e,t){const r=t.extends||Object.getPrototypeOf(this.constructor);return Object.assign(t,{extends:r,type:e}),{[e]:t}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}resetOnCopyNodeFrom(e){this.__state&&(this.__state=this.__state.getWritable(this).resetOnCopyNode())}getType(){return this.__type}isInline(){O(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=tt(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){const t=e||M();if(t==null)return!1;const r=t.getNodes().some(o=>o.__key===this.__key);if(F(this))return r;if(E(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const o=this.getParent();if(Y(this)&&this.isInline()&&o){const i=t.isBackward()?t.focus:t.anchor;if(o.is(i.getNode())&&i.offset===o.getChildrenSize()&&this.is(o.getLastChild()))return!1}}return r}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),r=0;for(;t!==null;){if(this.is(t))return r;r++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return e===null?null:tt(e)}getParentOrThrow(){const e=this.getParent();return e===null&&O(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(Et(t))return b(e)||e===this&&Y(e)||O(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&O(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return e===null?null:tt(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(t===null)return e;let r=t.getFirstChild();for(;r!==null&&!r.is(this);)e.push(r),r=r.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return e===null?null:tt(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=b(this)?this:this.getParent(),r=b(e)?e:e.getParent(),o=t&&r?Rr(t,r):null;return o?o.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){const t=Rr(this,e);return t!==null&&(t.type==="descendant"||(t.type==="branch"?pc(t)===-1:(t.type!=="same"&&t.type!=="ancestor"&&O(279),!1)))}isParentOf(e){const t=Rr(this,e);return t!==null&&t.type==="ancestor"}getNodesBetween(e){const t=this.isBefore(e),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===e)break;const l=b(i)?t?i.getFirstChild():i.getLastChild():null;if(l!==null){i=l;continue}const a=t?i.getNextSibling():i.getPreviousSibling();if(a!==null){i=a;continue}const c=i.getParentOrThrow();if(o.has(c.__key)||r.push(c),c===e)break;let u=null,f=c;do{if(f===null&&O(68),u=t?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 t||r.reverse(),r}isDirty(){const e=Z()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){if(qr(this))return this;const e=tt(this.__key);return e===null&&O(113),e}getWritable(){if(qr(this))return this;mt();const e=Re(),t=Z(),r=e._nodeMap,o=this.__key,i=this.getLatest(),s=t._cloneNotNeeded,l=M();if(l!==null&&l.setCachedNodes(null),s.has(o))return Zr(i),i;const a=dc(i);return s.add(o),Zr(a),r.set(o,a),a}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){O(70)}updateDOM(e,t,r){O(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){const e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){O(18,this.name)}updateFromJSON(e){return function(t,r){const o=t.getWritable(),i=r.$;let s=i;for(const l of ca(o).flatKeys)l in r&&(s!==void 0&&s!==i||(s={...i}),s[l]=r[l]);return(o.__state||s)&&Lu(t).updateFromJSON(s),o}(this,e)}static transform(){return null}remove(e){ci(this,!0,e)}replace(e,t){mt();let r=M();r!==null&&(r=r.clone()),Do(this,e);const o=this.getLatest(),i=this.__key,s=e.__key,l=e.getWritable(),a=this.getParentOrThrow().getWritable(),c=a.__size;He(l);const u=o.getPreviousSibling(),f=o.getNextSibling(),d=o.__prev,g=o.__next,h=o.__parent;if(ci(o,!1,!0),u===null?a.__first=s:u.getWritable().__next=s,l.__prev=d,f===null?a.__last=s:f.getWritable().__prev=s,l.__next=g,l.__parent=h,a.__size=c,t&&(b(this)&&b(l)||O(139),this.getChildren().forEach(p=>{l.append(p)})),E(r)){et(r);const p=r.anchor,_=r.focus;p.key===i&&Ws(p,l),_.key===i&&Ws(_,l)}return Ne()===i&&yt(s),l}insertAfter(e,t=!0){mt(),Do(this,e);const r=this.getWritable(),o=e.getWritable(),i=o.getParent(),s=M();let l=!1,a=!1;if(i!==null){const g=e.getIndexWithinParent();if(He(o),E(s)){const h=i.__key,p=s.anchor,_=s.focus;l=p.type==="element"&&p.key===h&&p.offset===g+1,a=_.type==="element"&&_.key===h&&_.offset===g+1}}const c=this.getNextSibling(),u=this.getParentOrThrow().getWritable(),f=o.__key,d=r.__next;if(c===null?u.__last=f:c.getWritable().__prev=f,u.__size++,r.__next=f,o.__next=d,o.__prev=r.__key,o.__parent=r.__parent,t&&E(s)){const g=this.getIndexWithinParent();Xr(s,u,g+1);const h=u.__key;l&&s.anchor.set(h,g+2,"element"),a&&s.focus.set(h,g+2,"element")}return e}insertBefore(e,t=!0){mt(),Do(this,e);const r=this.getWritable(),o=e.getWritable(),i=o.__key;He(o);const s=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),a=r.__prev,c=this.getIndexWithinParent();s===null?l.__first=i:s.getWritable().__next=i,l.__size++,r.__prev=i,o.__prev=a,o.__next=r.__key,o.__parent=r.__parent;const u=M();return t&&E(u)&&Xr(u,this.getParentOrThrow(),c),e}isParentRequired(){return!1}createParentElementNode(){return H()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){mt();const r=this.getPreviousSibling(),o=this.getParentOrThrow();if(r===null)return o.select(0,0);if(b(r))return r.select();if(!F(r)){const i=r.getIndexWithinParent()+1;return o.select(i,i)}return r.select(e,t)}selectNext(e,t){mt();const r=this.getNextSibling(),o=this.getParentOrThrow();if(r===null)return o.select();if(b(r))return r.select(0,0);if(!F(r)){const i=r.getIndexWithinParent();return o.select(i,i)}return r.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}x(Yt,"importDOM");const ui="historic",rf="history-push",Vn="history-merge",of="paste",sf="collaboration",lf="skip-scroll-into-view",af="skip-dom-selection",Ls="skip-selection-focus",Da="composition-start",Ra="composition-end";class On extends Yt{static getType(){return"linebreak"}static clone(e){return new On(e.__key)}constructor(e){super(e)}getTextContent(){return`
6
+ `}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>function(t){const r=t.parentElement;if(r!==null&&to(r)){const o=r.firstChild;if(o===t||o.nextSibling===t&&Sr(o)){const i=r.lastChild;if(i===t||i.previousSibling===t&&Sr(i))return!0}}return!1}(e)||function(t){const r=t.parentElement;if(r!==null&&to(r)){const o=r.firstChild;if(o===t||o.nextSibling===t&&Sr(o))return!1;const i=r.lastChild;if(i===t||i.previousSibling===t&&Sr(i))return!0}return!1}(e)?null:{conversion:cf,priority:0}}}static importJSON(e){return Ce().updateFromJSON(e)}}function cf(n){return{node:Ce()}}function Ce(){return Ht(new On)}function Jt(n){return n instanceof On}function Sr(n){return ve(n)&&/^( |\t|\r?\n)+$/.test(n.textContent||"")}function Ao(n,e){return 16&e?"code":e&ra?"mark":32&e?"sub":64&e?"sup":null}function Mo(n,e){return 1&e?"strong":2&e?"em":"span"}function La(n,e,t,r,o){const i=r.classList;let s=vn(o,"base");s!==void 0&&i.add(...s),s=vn(o,"underlineStrikethrough");let l=!1;const a=8&e&&4&e;s!==void 0&&(8&t&&4&t?(l=!0,a||i.add(...s)):a&&i.remove(...s));for(const c in Me){const u=Me[c];if(s=vn(o,c),s!==void 0)if(t&u){if(l&&(c==="underline"||c==="strikethrough")){e&u&&i.remove(...s);continue}(!(e&u)||a&&c==="underline"||c==="strikethrough")&&i.add(...s)}else e&u&&i.remove(...s)}}function Ka(n,e,t){const r=e.firstChild,o=t.isComposing(),i=n+(o?Qn:"");if(r==null)e.textContent=i;else{const s=r.nodeValue;if(s!==i)if(o||Ae){const[l,a,c]=function(u,f){const d=u.length,g=f.length;let h=0,p=0;for(;h<d&&h<g&&u[h]===f[h];)h++;for(;p+h<d&&p+h<g&&u[d-p-1]===f[g-p-1];)p++;return[h,d-h-p,f.slice(h,g-p)]}(s,i);a!==0&&r.deleteData(l,a),r.insertData(l,c)}else r.nodeValue=i}}function Ks(n,e,t,r,o,i){Ka(o,n,e);const s=i.theme.text;s!==void 0&&La(0,0,r,n,s)}function xr(n,e){const t=document.createElement(e);return t.appendChild(n),t}class xe extends Yt{constructor(t="",r){super(r);x(this,"__text");x(this,"__format");x(this,"__style");x(this,"__mode");x(this,"__detail");this.__text=t,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}static getType(){return"text"}static clone(t){return new xe(t.__text,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__text=t.__text,this.__format=t.__format,this.__style=t.__style,this.__mode=t.__mode,this.__detail=t.__detail}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const t=this.getLatest();return Eu[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Ne()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){const r=Me[t];return(this.getFormat()&r)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(t,r){return Qr(this.getLatest().__format,t,r)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,r){const o=this.__format,i=Ao(0,o),s=Mo(0,o),l=i===null?s:i,a=document.createElement(l);let c=a;this.hasFormat("code")&&a.setAttribute("spellcheck","false"),i!==null&&(c=document.createElement(s),a.appendChild(c)),Ks(c,this,0,o,this.__text,t);const u=this.__style;return u!==""&&(a.style.cssText=u),a}updateDOM(t,r,o){const i=this.__text,s=t.__format,l=this.__format,a=Ao(0,s),c=Ao(0,l),u=Mo(0,s),f=Mo(0,l);if((a===null?u:a)!==(c===null?f:c))return!0;if(a===c&&u!==f){const _=r.firstChild;_==null&&O(48);const m=document.createElement(f);return Ks(m,this,0,l,i,o),r.replaceChild(m,_),!1}let d=r;c!==null&&a!==null&&(d=r.firstChild,d==null&&O(49)),Ka(i,d,this);const g=o.theme.text;g!==void 0&&s!==l&&La(0,s,l,d,g);const h=t.__style,p=this.__style;return h!==p&&(r.style.cssText=p),!1}static importDOM(){return{"#text":()=>({conversion:hf,priority:0}),b:()=>({conversion:ff,priority:0}),code:()=>({conversion:ae,priority:0}),em:()=>({conversion:ae,priority:0}),i:()=>({conversion:ae,priority:0}),mark:()=>({conversion:ae,priority:0}),s:()=>({conversion:ae,priority:0}),span:()=>({conversion:uf,priority:0}),strong:()=>({conversion:ae,priority:0}),sub:()=>({conversion:ae,priority:0}),sup:()=>({conversion:ae,priority:0}),u:()=>({conversion:ae,priority:0})}}static importJSON(t){return st().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(t){let{element:r}=super.exportDOM(t);return nt(r)||O(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=xr(r,"b")),this.hasFormat("italic")&&(r=xr(r,"i")),this.hasFormat("strikethrough")&&(r=xr(r,"s")),this.hasFormat("underline")&&(r=xr(r,"u")),{element:r}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,r){}setFormat(t){const r=this.getWritable();return r.__format=typeof t=="string"?Me[t]:t,r}setDetail(t){const r=this.getWritable();return r.__detail=typeof t=="string"?Nu[t]:t,r}setStyle(t){const r=this.getWritable();return r.__style=t,r}toggleFormat(t){const r=Qr(this.getFormat(),t,null);return this.setFormat(r)}toggleDirectionless(){const t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){const t=this.getWritable();return t.__detail^=2,t}setMode(t){const r=ku[t];if(this.__mode===r)return this;const o=this.getWritable();return o.__mode=r,o}setTextContent(t){if(this.__text===t)return this;const r=this.getWritable();return r.__text=t,r}select(t,r){mt();let o=t,i=r;const s=M(),l=this.getTextContent(),a=this.__key;if(typeof l=="string"){const c=l.length;o===void 0&&(o=c),i===void 0&&(i=c)}else o=0,i=0;if(!E(s))return Wa(a,o,a,i,"text","text");{const c=Ne();c!==s.anchor.key&&c!==s.focus.key||yt(a),s.setTextNodeRange(this,o,this,i)}return s}selectStart(){return this.select(0,0)}selectEnd(){const t=this.getTextContentSize();return this.select(t,t)}spliceText(t,r,o,i){const s=this.getWritable(),l=s.__text,a=o.length;let c=t;c<0&&(c=a+c,c<0&&(c=0));const u=M();if(i&&E(u)){const d=t+a;u.setTextNodeRange(s,d,s,d)}const f=l.slice(0,c)+o+l.slice(c+r);return s.__text=f,s}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...t){mt();const r=this.getLatest(),o=r.getTextContent();if(o==="")return[];const i=r.__key,s=Ne(),l=o.length;t.sort((w,A)=>w-A),t.push(l);const a=[],c=t.length;for(let w=0,A=0;w<l&&A<=c;A++){const $=t[A];$>w&&(a.push(o.slice(w,$)),w=$)}const u=a.length;if(u===1)return[r];const f=a[0],d=r.getParent();let g;const h=r.getFormat(),p=r.getStyle(),_=r.__detail;let m=!1,y=null,C=null;const v=M();if(E(v)){const[w,A]=v.isBackward()?[v.focus,v.anchor]:[v.anchor,v.focus];w.type==="text"&&w.key===i&&(y=w),A.type==="text"&&A.key===i&&(C=A)}r.isSegmented()?(g=st(f),g.__format=h,g.__style=p,g.__detail=_,g.__state=Ns(r,g),m=!0):g=r.setTextContent(f);const N=[g];for(let w=1;w<u;w++){const A=st(a[w]);A.__format=h,A.__style=p,A.__detail=_,A.__state=Ns(r,A);const $=A.__key;s===i&&yt($),N.push(A)}const S=y?y.offset:null,T=C?C.offset:null;let k=0;for(const w of N){if(!y&&!C)break;const A=k+w.getTextContentSize();if(y!==null&&S!==null&&S<=A&&S>=k&&(y.set(w.getKey(),S-k,"text"),S<A&&(y=null)),C!==null&&T!==null&&T<=A&&T>=k){C.set(w.getKey(),T-k,"text");break}k=A}if(d!==null){(function($){const K=$.getPreviousSibling(),I=$.getNextSibling();K!==null&&Zr(K),I!==null&&Zr(I)})(this);const w=d.getWritable(),A=this.getIndexWithinParent();m?(w.splice(A,0,N),this.remove()):w.splice(A,1,N),E(v)&&Xr(v,d,A,u-1)}return N}mergeWithSibling(t){const r=t===this.getPreviousSibling();r||t===this.getNextSibling()||O(50);const o=this.__key,i=t.__key,s=this.__text,l=s.length;Ne()===i&&yt(o);const a=M();if(E(a)){const d=a.anchor,g=a.focus;d!==null&&d.key===i&&Ys(d,r,o,t,l),g!==null&&g.key===i&&Ys(g,r,o,t,l)}const c=t.__text,u=r?c+s:s+c;this.setTextContent(u);const f=this.getWritable();return t.remove(),f}isTextEntity(){return!1}}function uf(n){return{forChild:Vi(n.style),node:null}}function ff(n){const e=n,t=e.style.fontWeight==="normal";return{forChild:Vi(e.style,t?void 0:"bold"),node:null}}const Is=new WeakMap;function df(n){if(!nt(n))return!1;if(n.nodeName==="PRE")return!0;const e=n.style.whiteSpace;return typeof e=="string"&&e.startsWith("pre")}function hf(n){const e=n;n.parentElement===null&&O(129);let t=e.textContent||"";if(function(r){let o,i=r.parentNode;const s=[r];for(;i!==null&&(o=Is.get(i))===void 0&&!df(i);)s.push(i),i=i.parentNode;const l=o===void 0?i:o;for(let a=0;a<s.length;a++)Is.set(s[a],l);return l}(e)!==null){const r=t.split(/(\r?\n|\t)/),o=[],i=r.length;for(let s=0;s<i;s++){const l=r[s];l===`
7
+ `||l===`\r
8
+ `?o.push(Ce()):l===" "?o.push(Mn()):l!==""&&o.push(st(l))}return{node:o}}if(t=t.replace(/\r/g,"").replace(/[ \t\n]+/g," "),t==="")return{node:null};if(t[0]===" "){let r=e,o=!0;for(;r!==null&&(r=zs(r,!1))!==null;){const i=r.textContent||"";if(i.length>0){/[ \t\n]$/.test(i)&&(t=t.slice(1)),o=!1;break}}o&&(t=t.slice(1))}if(t[t.length-1]===" "){let r=e,o=!0;for(;r!==null&&(r=zs(r,!0))!==null;)if((r.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){o=!1;break}o&&(t=t.slice(0,t.length-1))}return t===""?{node:null}:{node:st(t)}}function zs(n,e){let t=n;for(;;){let r;for(;(r=e?t.nextSibling:t.previousSibling)===null;){const i=t.parentElement;if(i===null)return null;t=i}if(t=r,nt(t)){const i=t.style.display;if(i===""&&!yi(t)||i!==""&&!i.startsWith("inline"))return null}let o=t;for(;(o=e?t.firstChild:t.lastChild)!==null;)t=o;if(ve(t))return t;if(t.nodeName==="BR")return null}}const gf={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function ae(n){const e=gf[n.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:Vi(n.style,e),node:null}}function st(n=""){return Ht(new xe(n))}function F(n){return n instanceof xe}function Vi(n,e){const t=n.fontWeight,r=n.textDecoration.split(" "),o=t==="700"||t==="bold",i=r.includes("line-through"),s=n.fontStyle==="italic",l=r.includes("underline"),a=n.verticalAlign;return c=>(F(c)&&(o&&!c.hasFormat("bold")&&c.toggleFormat("bold"),i&&!c.hasFormat("strikethrough")&&c.toggleFormat("strikethrough"),s&&!c.hasFormat("italic")&&c.toggleFormat("italic"),l&&!c.hasFormat("underline")&&c.toggleFormat("underline"),a!=="sub"||c.hasFormat("subscript")||c.toggleFormat("subscript"),a!=="super"||c.hasFormat("superscript")||c.toggleFormat("superscript"),e&&!c.hasFormat(e)&&c.toggleFormat(e)),c)}class An extends xe{static getType(){return"tab"}static clone(e){return new An(e.__key)}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}createDOM(e){const t=super.createDOM(e),r=vn(e.theme,"tab");return r!==void 0&&t.classList.add(...r),t}static importJSON(e){return Mn().updateFromJSON(e)}setTextContent(e){return e!==" "&&e!==""&&ea(126),super.setTextContent(" ")}spliceText(e,t,r,o){return r===""&&t===0||r===" "&&t===1||O(286),this}setDetail(e){return e!==2&&O(127),this}setMode(e){return e!=="normal"&&O(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Mn(){return Ht(new An)}function cr(n){return n instanceof An}class pf{constructor(e,t,r){x(this,"key");x(this,"offset");x(this,"type");x(this,"_selection");this._selection=null,this.key=e,this.offset=t,this.type=r}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:gc(kt(Xt(this,"next")),kt(Xt(e,"next")))<0}getNode(){const e=tt(this.key);return e===null&&O(20),e}set(e,t,r,o){const i=this._selection,s=this.key;o&&this.key===e&&this.offset===t&&this.type===r||(this.key=e,this.offset=t,this.type=r,Fn()||(Ne()===s&&yt(e),i!==null&&(i.setCachedNodes(null),i.dirty=!0)))}}function Dt(n,e,t){return new pf(n,e,t)}function Fo(n,e){let t=e.__key,r=n.offset,o="element";if(F(e)){o="text";const i=e.getTextContentSize();r>i&&(r=i)}else if(!b(e)){const i=e.getNextSibling();if(F(i))t=i.__key,r=0,o="text";else{const s=e.getParent();s&&(t=s.__key,r=e.getIndexWithinParent()+1)}}n.set(t,r,o)}function Ws(n,e){if(b(e)){const t=e.getLastDescendant();b(t)||F(t)?Fo(n,t):Fo(n,e)}else Fo(n,e)}class uo{constructor(e){x(this,"_nodes");x(this,"_cachedNodes");x(this,"dirty");this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Ft(e))return!1;const t=this._nodes,r=e._nodes;return t.size===r.size&&Array.from(t).every(o=>r.has(o))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new uo(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),r=t.length,o=t[r-1];let i;if(F(o))i=o.select();else{const s=o.getIndexWithinParent()+1;i=o.getParentOrThrow().select(s,s)}i.insertNodes(e);for(let s=0;s<r;s++)t[s].remove()}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this._nodes,r=[];for(const o of t){const i=tt(o);i!==null&&r.push(i)}return Fn()||(this._cachedNodes=r),r}getTextContent(){const e=this.getNodes();let t="";for(let r=0;r<e.length;r++)t+=e[r].getTextContent();return t}deleteNodes(){const e=this.getNodes();if((M()||Lt())===this&&e[0]){const t=it(e[0],"next");_c($e(t,t))}for(const t of e)t.remove()}}function E(n){return n instanceof on}class on{constructor(e,t,r,o){x(this,"format");x(this,"style");x(this,"anchor");x(this,"focus");x(this,"_cachedNodes");x(this,"dirty");this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=r,this.style=o,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!E(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=function(r){const o=[],[i,s]=r.getTextSlices();i&&o.push(i.caret.origin);const l=new Set,a=new Set;for(const c of r)if(Ot(c)){const{origin:u}=c;o.length===0?l.add(u):(a.add(u),o.push(u))}else{const{origin:u}=c;b(u)&&a.has(u)||o.push(u)}if(s&&o.push(s.caret.origin),Fe(r.focus)&&b(r.focus.origin)&&r.focus.getNodeAtCaret()===null)for(let c=vt(r.focus.origin,"previous");Ot(c)&&l.has(c.origin)&&!c.origin.isEmpty()&&c.origin.is(o[o.length-1]);c=tn(c))l.delete(c.origin),o.pop();for(;o.length>1;){const c=o[o.length-1];if(!b(c)||a.has(c)||c.isEmpty()||l.has(c))break;o.pop()}if(o.length===0&&r.isCollapsed()){const c=kt(r.anchor),u=kt(r.anchor.getFlipped()),f=g=>oe(g)?g.origin:g.getNodeAtCaret(),d=f(c)||f(u)||(r.anchor.getNodeAtCaret()?c.origin:u.origin);o.push(d)}return o}(mc(gl(this),"next"));return Fn()||(this._cachedNodes=t),t}setTextNodeRange(e,t,r,o){this.anchor.set(e.__key,t,"text"),this.focus.set(r.__key,o,"text")}getTextContent(){const e=this.getNodes();if(e.length===0)return"";const t=e[0],r=e[e.length-1],o=this.anchor,i=this.focus,s=o.isBefore(i),[l,a]=fi(this);let c="",u=!0;for(let f=0;f<e.length;f++){const d=e[f];if(b(d)&&!d.isInline())u||(c+=`
9
+ `),u=!d.isEmpty();else if(u=!1,F(d)){let g=d.getTextContent();d===t?d===r?o.type==="element"&&i.type==="element"&&i.offset!==o.offset||(g=l<a?g.slice(l,a):g.slice(a,l)):g=s?g.slice(l):g.slice(a):d===r&&(g=s?g.slice(0,a):g.slice(0,l)),c+=g}else!Y(d)&&!Jt(d)||d===r&&this.isCollapsed()||(c+=d.getTextContent())}return c}applyDOMRange(e){const t=Z(),r=t.getEditorState()._selection,o=za(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,r);if(o===null)return;const[i,s]=o;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(s.key,s.offset,s.type,!0),Zn(this)}clone(){const e=this.anchor,t=this.focus;return new on(Dt(e.key,e.offset,e.type),Dt(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=Qr(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=Me[e];return(this.format&t)!==0}insertRawText(e){const t=e.split(/(\r?\n|\t)/),r=[],o=t.length;for(let i=0;i<o;i++){const s=t[i];s===`
10
+ `||s===`\r
11
+ `?r.push(Ce()):s===" "?r.push(Mn()):r.push(st(s))}this.insertNodes(r)}insertText(e){const t=this.anchor,r=this.focus,o=this.format,i=this.style;let s=t,l=r;!this.isCollapsed()&&r.isBefore(t)&&(s=r,l=t),s.type==="element"&&function(_,m,y,C){const v=_.getNode(),N=v.getChildAtIndex(_.offset),S=st();if(S.setFormat(y),S.setStyle(C),fr(N))N.splice(0,0,[S]);else{const T=at(v)?H().append(S):S;N===null?v.append(T):N.insertBefore(T)}_.is(m)&&m.set(S.__key,0,"text"),_.set(S.__key,0,"text")}(s,l,o,i),l.type==="element"&&jt(l,kt(Xt(l,"next")));const a=s.offset;let c=l.offset;const u=this.getNodes(),f=u.length;let d=u[0];F(d)||O(26);const g=d.getTextContent().length,h=d.getParentOrThrow();let p=u[f-1];if(f===1&&l.type==="element"&&(c=g,l.set(s.key,c,"text")),this.isCollapsed()&&a===g&&(ue(d)||!d.canInsertTextAfter()||!h.canInsertTextAfter()&&d.getNextSibling()===null)){let _=d.getNextSibling();if(F(_)&&_.canInsertTextBefore()&&!ue(_)||(_=st(),_.setFormat(o),_.setStyle(i),h.canInsertTextAfter()?d.insertAfter(_):h.insertAfter(_)),_.select(0,0),d=_,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&a===0&&(ue(d)||!d.canInsertTextBefore()||!h.canInsertTextBefore()&&d.getPreviousSibling()===null)){let _=d.getPreviousSibling();if(F(_)&&!ue(_)||(_=st(),_.setFormat(o),h.canInsertTextBefore()?d.insertBefore(_):h.insertBefore(_)),_.select(),d=_,e!=="")return void this.insertText(e)}else if(d.isSegmented()&&a!==g){const _=st(d.getTextContent());_.setFormat(o),d.replace(_),d=_}else if(!this.isCollapsed()&&e!==""){const _=p.getParent();if(!h.canInsertTextBefore()||!h.canInsertTextAfter()||b(_)&&(!_.canInsertTextBefore()||!_.canInsertTextAfter()))return this.insertText(""),Ia(this.anchor,this.focus),void this.insertText(e)}if(f===1){if(Je(d)){const C=st(e);return C.select(),void d.replace(C)}const _=d.getFormat(),m=d.getStyle();if(a!==c||_===o&&m===i){if(cr(d)){const C=st(e);return C.setFormat(o),C.setStyle(i),C.select(),void d.replace(C)}}else{if(d.getTextContent()!==""){const C=st(e);if(C.setFormat(o),C.setStyle(i),C.select(),a===0)d.insertBefore(C,!1);else{const[v]=d.splitText(a);v.insertAfter(C,!1)}return void(C.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}d.setFormat(o),d.setStyle(i)}const y=c-a;d=d.spliceText(a,y,e,!0),d.getTextContent()===""?d.remove():this.anchor.type==="text"&&(this.format=_,this.style=m,d.isComposing()&&(this.anchor.offset-=e.length))}else{const _=new Set([...d.getParentKeys(),...p.getParentKeys()]),m=b(d)?d:d.getParentOrThrow();let y=b(p)?p:p.getParentOrThrow(),C=p;if(!m.is(y)&&y.isInline())do C=y,y=y.getParentOrThrow();while(y.isInline());if(l.type==="text"&&(c!==0||p.getTextContent()==="")||l.type==="element"&&p.getIndexWithinParent()<c)if(F(p)&&!Je(p)&&c!==p.getTextContentSize()){if(p.isSegmented()){const k=st(p.getTextContent());p.replace(k),p=k}at(l.getNode())||l.type!=="text"||(p=p.spliceText(0,c,"")),_.add(p.__key)}else{const k=p.getParentOrThrow();k.canBeEmpty()||k.getChildrenSize()!==1?p.remove():k.remove()}else _.add(p.__key);const v=y.getChildren(),N=new Set(u),S=m.is(y),T=m.isInline()&&d.getNextSibling()===null?m:d;for(let k=v.length-1;k>=0;k--){const w=v[k];if(w.is(d)||b(w)&&w.isParentOf(d))break;w.isAttached()&&(!N.has(w)||w.is(C)?S||T.insertAfter(w,!1):w.remove())}if(!S){let k=y,w=null;for(;k!==null;){const A=k.getChildren(),$=A.length;($===0||A[$-1].is(w))&&(_.delete(k.__key),w=k),k=k.getParent()}}if(Je(d))if(a===g)d.select();else{const k=st(e);k.select(),d.replace(k)}else d=d.spliceText(a,g-a,e,!0),d.getTextContent()===""?d.remove():this.anchor.type==="text"&&(this.format=d.getFormat(),this.style=d.getStyle(),d.isComposing()&&(this.anchor.offset-=e.length));for(let k=1;k<f;k++){const w=u[k],A=w.__key;_.has(A)||w.remove()}}}removeText(){const e=M()===this;Lr(this,Yf(gl(this))),e&&M()!==this&&et(this)}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void yt(null);const r=this.getNodes(),o=[];for(const v of r)F(v)&&o.push(v);const i=v=>{r.forEach(N=>{if(b(N)){const S=N.getFormatFlags(e,v);N.setTextFormat(S)}})},s=o.length;if(s===0)return this.toggleFormat(e),yt(null),void i(t);const l=this.anchor,a=this.focus,c=this.isBackward(),u=c?a:l,f=c?l:a;let d=0,g=o[0],h=u.type==="element"?0:u.offset;if(u.type==="text"&&h===g.getTextContentSize()&&(d=1,g=o[1],h=0),g==null)return;const p=g.getFormatFlags(e,t);i(p);const _=s-1;let m=o[_];const y=f.type==="text"?f.offset:m.getTextContentSize();if(g.is(m)){if(h===y)return;if(ue(g)||h===0&&y===g.getTextContentSize())g.setFormat(p);else{const v=g.splitText(h,y),N=h===0?v[0]:v[1];N.setFormat(p),u.type==="text"&&u.set(N.__key,0,"text"),f.type==="text"&&f.set(N.__key,y-h,"text")}return void(this.format=p)}h===0||ue(g)||([,g]=g.splitText(h),h=0),g.setFormat(p);const C=m.getFormatFlags(e,p);y>0&&(y===m.getTextContentSize()||ue(m)||([m]=m.splitText(y)),m.setFormat(C));for(let v=d+1;v<_;v++){const N=o[v],S=N.getFormatFlags(e,C);N.setFormat(S)}u.type==="text"&&u.set(g.__key,h,"text"),f.type==="text"&&f.set(m.__key,y,"text"),this.format=p|C}insertNodes(e){if(e.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();const h=M();return E(h)||O(134),h.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),r=B(t,Bt),o=e[e.length-1];if(b(r)&&"__language"in r){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const h=$o(this);r.splice(h,0,e),o.selectEnd()}return}if(!e.some(h=>(b(h)||Y(h))&&!h.isInline())){b(r)||O(211,t.constructor.name,t.getType());const h=$o(this);return r.splice(h,0,e),void o.selectEnd()}const i=function(h){const p=H();let _=null;for(let m=0;m<h.length;m++){const y=h[m],C=Jt(y);if(C||Y(y)&&y.isInline()||b(y)&&y.isInline()||F(y)||y.isParentRequired()){if(_===null&&(_=y.createParentElementNode(),p.append(_),C))continue;_!==null&&_.append(y)}else p.append(y),_=null}return p}(e),s=i.getLastDescendant(),l=i.getChildren(),a=!b(r)||!r.isEmpty()?this.insertParagraph():null,c=l[l.length-1];let u=l[0];var f;b(f=u)&&Bt(f)&&!f.isEmpty()&&b(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(b(r)||O(211,t.constructor.name,t.getType()),r.append(...u.getChildren()),u=l[1]),u&&(r===null&&O(212,t.constructor.name,t.getType()),function(h,p){const _=p.getParentOrThrow().getLastChild();let m=p;const y=[p];for(;m!==_;)m.getNextSibling()||O(140),m=m.getNextSibling(),y.push(m);let C=h;for(const v of y)C=C.insertAfter(v)}(r,u));const d=B(s,Bt);a&&b(d)&&(a.canMergeWhenEmpty()||Bt(c))&&(d.append(...a.getChildren()),a.remove()),b(r)&&r.isEmpty()&&r.remove(),s.selectEnd();const g=b(r)?r.getLastChild():null;Jt(g)&&d!==r&&g.remove()}insertParagraph(){if(this.anchor.key==="root"){const s=H();return ct().splice(this.anchor.offset,0,[s]),s.select(),s}const e=$o(this),t=B(this.anchor.getNode(),Bt);b(t)||O(213);const r=t.getChildAtIndex(e),o=r?[r,...r.getNextSiblings()]:[],i=t.insertNewAfter(this,!1);return i?(i.append(...o),i.selectStart(),i):null}insertLineBreak(e){const t=Ce();if(this.insertNodes([t]),e){const r=t.getParentOrThrow(),o=t.getIndexWithinParent();r.select(o,o)}}extract(){const e=[...this.getNodes()],t=e.length;let r=e[0],o=e[t-1];const[i,s]=fi(this),l=this.isBackward(),[a,c]=l?[this.focus,this.anchor]:[this.anchor,this.focus],[u,f]=l?[s,i]:[i,s];if(t===0)return[];if(t===1){if(F(r)&&!this.isCollapsed()){const d=r.splitText(u,f),g=u===0?d[0]:d[1];return g?(a.set(g.getKey(),0,"text"),c.set(g.getKey(),g.getTextContentSize(),"text"),[g]):[]}return[r]}if(F(r)&&(u===r.getTextContentSize()?e.shift():u!==0&&([,r]=r.splitText(u),e[0]=r,a.set(r.getKey(),0,"text"))),F(o)){const d=o.getTextContent().length;f===0?e.pop():f!==d&&([o]=o.splitText(f),e[e.length-1]=o,c.set(o.getKey(),o.getTextContentSize(),"text"))}return e}modify(e,t,r){if(Xs(this,e,t,r))return;const o=e==="move",i=Z(),s=wt(Kt(i));if(!s)return;const l=i._blockCursorElement,a=i._rootElement,c=this.focus.getNode();if(a===null||l===null||!b(c)||c.isInline()||c.canBeEmpty()||_i(l,i,a),this.dirty){let u=kn(i,this.anchor.key),f=kn(i,this.focus.key);this.anchor.type==="text"&&(u=Tn(u)),this.focus.type==="text"&&(f=Tn(f)),u&&f&&Ja(s,u,this.anchor.offset,f,this.focus.offset)}if(function(u,f,d,g){u.modify(f,d,g)}(s,e,t?"backward":"forward",r),s.rangeCount>0){const u=s.getRangeAt(0),f=this.anchor.getNode(),d=at(f)?f:Pf(f);if(this.applyDOMRange(u),this.dirty=!0,!o){const g=this.getNodes(),h=[];let p=!1;for(let _=0;_<g.length;_++){const m=g[_];pi(m,d)?h.push(m):p=!0}if(p&&h.length>0)if(t){const _=h[0];b(_)?_.selectStart():_.getParentOrThrow().selectStart()}else{const _=h[h.length-1];b(_)?_.selectEnd():_.getParentOrThrow().selectEnd()}s.anchorNode===u.startContainer&&s.anchorOffset===u.startOffset||function(_){const m=_.focus,y=_.anchor,C=y.key,v=y.offset,N=y.type;y.set(m.key,m.offset,m.type,!0),m.set(C,v,N,!0)}(this)}}r==="lineboundary"&&Xs(this,e,t,r,"decorators")}forwardDeletion(e,t,r){if(!r&&(e.type==="element"&&b(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const o=t.getParent(),i=t.getNextSibling()||(o===null?null:o.getNextSibling());if(b(i)&&i.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const r=this.anchor;let o=r.getNode();if(this.forwardDeletion(r,o,e))return;const i=or(Xt(r,e?"previous":"next"));if(i.getTextSlices().every(l=>l===null||l.distance===0)){let l={type:"initial"};for(const a of i.iterNodeCarets("shadowRoot"))if(Ot(a)){if(!a.origin.isInline()){if(a.origin.isShadowRoot()){if(l.type==="merge-block")break;if(b(i.anchor.origin)&&i.anchor.origin.isEmpty()){const c=kt(a);Lr(this,$e(c,c)),i.anchor.origin.remove()}return}l.type!=="merge-next-block"&&l.type!=="merge-block"||(l={block:l.block,caret:a,type:"merge-block"})}}else{if(l.type==="merge-block")break;if(Fe(a)){if(b(a.origin)){if(a.origin.isInline()){if(!a.origin.isParentOf(i.anchor.origin))break}else l={block:a.origin,type:"merge-next-block"};continue}if(Y(a.origin)){if(!a.origin.isIsolated())if(l.type==="merge-next-block"&&(a.origin.isKeyboardSelectable()||!a.origin.isInline())&&b(i.anchor.origin)&&i.anchor.origin.isEmpty()){i.anchor.origin.remove();const c=Ba();c.add(a.origin.getKey()),et(c)}else a.origin.remove();return}break}}if(l.type==="merge-block"){const{caret:a,block:c}=l;return Lr(this,$e(!a.origin.isEmpty()&&c.isEmpty()?gr(it(c,a.direction)):i.anchor,a)),this.removeText()}}const s=this.focus;if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&r.offset===0&&Js(this,r.getNode()))return}else{const l=s.type==="text"?s.getNode():null;if(o=r.type==="text"?r.getNode():null,l!==null&&l.isSegmented()){const a=s.offset,c=l.getTextContentSize();if(l.is(o)||e&&a!==c||!e&&a!==0)return void Hs(l,e,a)}else if(o!==null&&o.isSegmented()){const a=r.offset,c=o.getTextContentSize();if(o.is(l)||e&&a!==0||!e&&a!==c)return void Hs(o,e,a)}(function(a,c){const u=a.anchor,f=a.focus,d=u.getNode(),g=f.getNode();if(d===g&&u.type==="text"&&f.type==="text"){const h=u.offset,p=f.offset,_=h<p,m=_?h:p,y=_?p:h,C=y-1;m!==C&&function(v){return!(lc(v)||_f(v))}(d.getTextContent().slice(m,y))&&(c?f.set(f.key,C,f.type):u.set(u.key,C,u.type))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const r=this.anchor.getNode();r.isEmpty()&&at(r.getParent())&&r.getPreviousSibling()===null&&Js(this,r)}}deleteLine(e){this.isCollapsed()&&this.modify("extend",e,"lineboundary"),this.isCollapsed()?this.deleteCharacter(e):this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,r=t.getNode();if(this.forwardDeletion(t,r,e))return;this.modify("extend",e,"word")}this.isCollapsed()?this.deleteCharacter(e):this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Ft(n){return n instanceof uo}function Bs(n){const e=n.offset;if(n.type==="text")return e;const t=n.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function fi(n){const e=n.getStartEndPoints();if(e===null)return[0,0];const[t,r]=e;return t.type==="element"&&r.type==="element"&&t.key===r.key&&t.offset===r.offset?[0,0]:[Bs(t),Bs(r)]}function Js(n,e){for(let t=e;t;t=t.getParent()){if(b(t)){if(t.collapseAtStart(n))return!0;if(Et(t))break}if(t.getPreviousSibling())break}return!1}const _f=(()=>{try{const n=new RegExp("\\p{Emoji}","u"),e=n.test.bind(n);if(e("❤️")&&e("#️⃣")&&e("👍"))return e}catch{}return()=>!1})();function Hs(n,e,t){const r=n,o=r.getTextContent().split(/(?=\s)/g),i=o.length;let s=0,l=0;for(let c=0;c<i;c++){const u=c===i-1;if(l=s,s+=o[c].length,e&&s===t||s>t||u){o.splice(c,1),u&&(l=void 0);break}}const a=o.join("").trim();a===""?r.remove():(r.setTextContent(a),r.select(l,l))}function Us(n,e,t,r){let o,i=e;if(nt(n)){let s=!1;const l=n.childNodes,a=l.length,c=r._blockCursorElement;i===a&&(s=!0,i=a-1);let u=l[i],f=!1;if(u===c)u=l[i+1],f=!0;else if(c!==null){const d=c.parentNode;n===d&&e>Array.prototype.indexOf.call(d.children,c)&&i--}if(o=Cn(u),F(o))i=ie(o,s?"next":"previous");else{let d=Cn(n);if(d===null)return null;if(b(d)){const g=r.getElementByKey(d.getKey());g===null&&O(214),[d,i]=d.getDOMSlot(g).resolveChildIndex(d,g,n,e),b(d)||O(215),s&&i>=d.getChildrenSize()&&(i=Math.max(0,d.getChildrenSize()-1));let p=d.getChildAtIndex(i);if(b(p)&&function(_,m,y){const C=_.getParent();return y===null||C===null||!C.canBeEmpty()||C!==y.getNode()}(p,0,t)){const _=s?p.getLastDescendant():p.getFirstDescendant();_===null?d=p:(p=_,d=b(p)?p:p.getParentOrThrow()),i=0}F(p)?(o=p,d=null,i=ie(p,s?"next":"previous")):p!==d&&s&&!f&&(b(d)||O(216),i=Math.min(d.getChildrenSize(),i+1))}else{const g=d.getIndexWithinParent();i=e===0&&Y(d)&&Cn(n)===d?g:g+1,d=d.getParentOrThrow()}if(b(d))return Dt(d.__key,i,"element")}}else o=Cn(n);return F(o)?Dt(o.__key,ie(o,i,"clamp"),"text"):null}function js(n,e,t){const r=n.offset,o=n.getNode();if(r===0){const i=o.getPreviousSibling(),s=o.getParent();if(e){if((t||!e)&&i===null&&b(s)&&s.isInline()){const l=s.getPreviousSibling();F(l)&&n.set(l.__key,l.getTextContent().length,"text")}}else b(i)&&!t&&i.isInline()?n.set(i.__key,i.getChildrenSize(),"element"):F(i)&&n.set(i.__key,i.getTextContent().length,"text")}else if(r===o.getTextContent().length){const i=o.getNextSibling(),s=o.getParent();if(e&&b(i)&&i.isInline())n.set(i.__key,0,"element");else if((t||e)&&i===null&&b(s)&&s.isInline()&&!s.canInsertTextAfter()){const l=s.getNextSibling();F(l)&&n.set(l.__key,0,"text")}}}function Ia(n,e,t){if(n.type==="text"&&e.type==="text"){const r=n.isBefore(e),o=n.is(e);js(n,r,o),js(e,!r,o),o&&e.set(n.key,n.offset,n.type)}}function za(n,e,t,r,o,i){if(n===null||t===null||!dr(o,n,t))return null;const s=Us(n,e,E(i)?i.anchor:null,o);if(s===null)return null;const l=Us(t,r,E(i)?i.focus:null,o);if(l===null)return null;if(s.type==="element"&&l.type==="element"){const a=Cn(n),c=Cn(t);if(Y(a)&&Y(c))return null}return Ia(s,l),[s,l]}function di(n){return b(n)&&!n.isInline()}function Wa(n,e,t,r,o,i){const s=Re(),l=new on(Dt(n,e,o),Dt(t,r,i),0,"");return l.dirty=!0,s._selection=l,l}function fo(){const n=Dt("root",0,"element"),e=Dt("root",0,"element");return new on(n,e,0,"")}function Ba(){return new uo(new Set)}function mf(n,e){return ho(null,n,e,null)}function ho(n,e,t,r){const o=t._window;if(o===null)return null;const i=r||o.event,s=i?i.type:void 0,l=s==="selectionchange",a=!Xo&&(l||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&i&&i.detail===3||s==="drop"||s===void 0);let c,u,f,d;if(E(n)&&!a)return n.clone();if(e===null)return null;if(c=e.anchorNode,u=e.focusNode,f=e.anchorOffset,d=e.focusOffset,(l||s===void 0)&&E(n)&&!dr(t,c,u))return n.clone();const g=za(c,f,u,d,t,n);if(g===null)return null;const[h,p]=g;let _=0,m="";if(E(n)){const y=n.anchor;if(h.key===y.key)_=n.format,m=n.style;else{const C=h.getNode();F(C)?(_=C.getFormat(),m=C.getStyle()):b(C)&&(_=C.getTextFormat(),m=C.getTextStyle())}}return new on(h,p,_,m)}function M(){return Re()._selection}function Lt(){return Z()._editorState._selection}function Xr(n,e,t,r=1){const o=n.anchor,i=n.focus,s=o.getNode(),l=i.getNode();if(!e.is(s)&&!e.is(l))return;const a=e.__key;if(n.isCollapsed()){const c=o.offset;if(t<=c&&r>0||t<c&&r<0){const u=Math.max(0,c+r);o.set(a,u,"element"),i.set(a,u,"element"),Vs(n)}}else{const c=n.isBackward(),u=c?i:o,f=u.getNode(),d=c?o:i,g=d.getNode();if(e.is(f)){const h=u.offset;(t<=h&&r>0||t<h&&r<0)&&u.set(a,Math.max(0,h+r),"element")}if(e.is(g)){const h=d.offset;(t<=h&&r>0||t<h&&r<0)&&d.set(a,Math.max(0,h+r),"element")}}Vs(n)}function Vs(n){const e=n.anchor,t=e.offset,r=n.focus,o=r.offset,i=e.getNode(),s=r.getNode();if(n.isCollapsed()){if(!b(i))return;const l=i.getChildrenSize(),a=t>=l,c=a?i.getChildAtIndex(l-1):i.getChildAtIndex(t);if(F(c)){let u=0;a&&(u=c.getTextContentSize()),e.set(c.__key,u,"text"),r.set(c.__key,u,"text")}return}if(b(i)){const l=i.getChildrenSize(),a=t>=l,c=a?i.getChildAtIndex(l-1):i.getChildAtIndex(t);if(F(c)){let u=0;a&&(u=c.getTextContentSize()),e.set(c.__key,u,"text")}}if(b(s)){const l=s.getChildrenSize(),a=o>=l,c=a?s.getChildAtIndex(l-1):s.getChildAtIndex(o);if(F(c)){let u=0;a&&(u=c.getTextContentSize()),r.set(c.__key,u,"text")}}}function Gr(n,e,t,r,o){let i=null,s=0,l=null;r!==null?(i=r.__key,F(r)?(s=r.getTextContentSize(),l="text"):b(r)&&(s=r.getChildrenSize(),l="element")):o!==null&&(i=o.__key,F(o)?l="text":b(o)&&(l="element")),i!==null&&l!==null?n.set(i,s,l):(s=e.getIndexWithinParent(),s===-1&&(s=t.getChildrenSize()),n.set(t.__key,s,"element"))}function Ys(n,e,t,r,o){n.type==="text"?n.set(t,n.offset+(e?0:o),"text"):n.offset>r.getIndexWithinParent()&&n.set(n.key,n.offset-1,"element")}function Ja(n,e,t,r,o){try{n.setBaseAndExtent(e,t,r,o)}catch{}}function qs(n,e,t){const r=kn(n,e.getKey());if(b(e)){const o=e.getDOMSlot(r);return[o.element,t+o.getFirstChildOffset()]}return[r,t]}function yf(n,e,t,r,o,i,s){const l=r.anchorNode,a=r.focusNode,c=r.anchorOffset,u=r.focusOffset,f=document.activeElement;if(o.has(sf)&&f!==i||f!==null&&Zi(f))return;if(!E(e))return void(n!==null&&dr(t,l,a)&&r.removeAllRanges());const d=e.anchor,g=e.focus,h=d.getNode(),p=g.getNode(),[_,m]=qs(t,h,d.offset),[y,C]=qs(t,p,g.offset),v=e.format,N=e.style,S=e.isCollapsed();let T=_,k=y,w=!1;var A,$,K,I,z;if(d.type==="text"?(T=Tn(_),w=h.getFormat()!==v||h.getStyle()!==N):E(n)&&n.anchor.type==="text"&&(w=!0),g.type==="text"&&(k=Tn(y)),T!==null&&k!==null&&(S&&(n===null||w||E(n)&&(n.format!==v||n.style!==N))&&(A=v,$=N,K=m,I=d.key,z=performance.now(),Ea=[A,$,K,I,z]),c!==m||u!==C||l!==T||a!==k||r.type==="Range"&&S||(f!==null&&i.contains(f)||o.has(Ls)||i.focus({preventScroll:!0}),d.type==="element"))){if(Ja(r,T,m,k,C),!Ae||!e.isCollapsed()||i===null||o.has(Ls)||document.activeElement!==null&&i.contains(document.activeElement)||i.focus({preventScroll:!0}),!o.has(lf)&&e.isCollapsed()&&i!==null&&i===document.activeElement){const G=E(e)&&e.anchor.type==="element"?T.childNodes[m]||null:r.rangeCount>0?r.getRangeAt(0):null;if(G!==null){let dt;if(G instanceof Text){const Mt=document.createRange();Mt.selectNode(G),dt=Mt.getBoundingClientRect()}else dt=G.getBoundingClientRect();(function(Mt,ut,Nt){const be=fc(Nt),Ln=ss(be);if(be===null||Ln===null)return;let{top:V,bottom:St}=ut,xt=0,we=0,It=Nt;for(;It!==null;){const Qt=It===be.body;if(Qt){xt=0,we=Kt(Mt).innerHeight;const te=Ln.getComputedStyle(be.documentElement),Le=parseFloat(te.scrollPaddingTop),zt=parseFloat(te.scrollPaddingBottom);isFinite(Le)&&(xt+=Le),isFinite(zt)&&(we-=zt)}else{const te=It.getBoundingClientRect();xt=te.top,we=te.bottom}let Zt=0;if(V<xt?Zt=-(xt-V):St>we&&(Zt=St-we),Zt!==0)if(Qt)Ln.scrollBy(0,Zt);else{const te=It.scrollTop;It.scrollTop+=Zt;const Le=It.scrollTop-te;V-=Le,St-=Le}if(Qt)break;It=hr(It)}})(t,dt,i)}}li=!0}}function Cf(n){let e=M()||Lt();e===null&&(e=ct().selectEnd()),e.insertNodes(n)}function $o(n){let e=n;n.isCollapsed()||e.removeText();const t=M();E(t)&&(e=t),E(e)||O(161);const r=e.anchor;let o=r.getNode(),i=r.offset;for(;!Bt(o);){const s=o;if([o,i]=Sf(o,i),s.is(o))break}return i}function Sf(n,e){const t=n.getParent();if(!t){const o=H();return ct().append(o),o.select(),[ct(),0]}if(F(n)){const o=n.splitText(e);if(o.length===0)return[t,n.getIndexWithinParent()];const i=e===0?0:1;return[t,o[0].getIndexWithinParent()+i]}if(!b(n)||e===0)return[t,n.getIndexWithinParent()];const r=n.getChildAtIndex(e);if(r){const o=new on(Dt(n.__key,e,"element"),Dt(n.__key,e,"element"),0,""),i=n.insertNewAfter(o);i&&i.append(r,...r.getNextSiblings())}return[t,n.getIndexWithinParent()+1]}function Xs(n,e,t,r,o="decorators-and-blocks"){if(e==="move"&&r==="character"&&!n.isCollapsed()){const[u,f]=t===n.isBackward()?[n.focus,n.anchor]:[n.anchor,n.focus];return f.set(u.key,u.offset,u.type),!0}const i=Xt(n.focus,t?"previous":"next"),s=r==="lineboundary",l=e==="move";let a=i,c=o==="decorators-and-blocks";if(!fs(a)){for(const u of a){c=!1;const{origin:f}=u;if(!Y(f)||f.isIsolated()||(a=u,!s||!f.isInline()))break}if(c)for(const u of or(i).iterNodeCarets(e==="extend"?"shadowRoot":"root")){if(Ot(u))u.origin.isInline()||(a=u);else{if(b(u.origin))continue;Y(u.origin)&&!u.origin.isInline()&&(a=u)}break}}if(a===i)return!1;if(l&&!s&&Y(a.origin)&&a.origin.isKeyboardSelectable()){const u=Ba();return u.add(a.origin.getKey()),et(u),!0}return a=kt(a),l&&jt(n.anchor,a),jt(n.focus,a),c||!s}let ht=null,gt=null,Pt=!1,Po=!1,Dr=0;const Gs={characterData:!0,childList:!0,subtree:!0};function Fn(){return Pt||ht!==null&&ht._readOnly}function mt(){Pt&&O(13)}function Ha(){Dr>99&&O(14)}function Re(){return ht===null&&O(195,Ua()),ht}function Z(){return gt===null&&O(196,Ua()),gt}function Ua(){let n=0;const e=new Set,t=Xe.version;if(typeof window<"u")for(const o of document.querySelectorAll("[contenteditable]")){const i=po(o);if(ts(i))n++;else if(i){let s=String(i.constructor.version||"<0.17.1");s===t&&(s+=" (separately built, likely a bundler configuration issue)"),e.add(s)}}let r=` Detected on the page: ${n} compatible editor(s) with version ${t}`;return e.size&&(r+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),r}function xf(){return gt}function Qs(n,e,t){const r=e.__type,o=Qa(n,r);let i=t.get(r);i===void 0&&(i=Array.from(o.transforms),t.set(r,i));const s=i.length;for(let l=0;l<s&&(i[l](e),e.isAttached());l++);}function Zs(n,e){return n!==void 0&&n.__key!==e&&n.isAttached()}function ja(n,e){if(!e)return;const t=n._updateTags;let r=e;Array.isArray(e)||(r=[e]);for(const o of r)t.add(o)}function vf(n){return Yi(n,Z()._nodes)}function Yi(n,e){const t=n.type,r=e.get(t);r===void 0&&O(17,t);const o=r.klass;n.type!==o.getType()&&O(18,o.name);const i=o.importJSON(n),s=n.children;if(b(i)&&Array.isArray(s))for(let l=0;l<s.length;l++){const a=Yi(s[l],e);i.append(a)}return i}function tl(n,e,t){const r=ht,o=Pt,i=gt;ht=e,Pt=!0,gt=n;try{return t()}finally{ht=r,Pt=o,gt=i}}function he(n,e){const t=n._pendingEditorState,r=n._rootElement,o=n._headless||r===null;if(t===null)return;const i=n._editorState,s=i._selection,l=t._selection,a=n._dirtyType!==0,c=ht,u=Pt,f=gt,d=n._updating,g=n._observer;let h=null;if(n._pendingEditorState=null,n._editorState=t,!o&&a&&g!==null){gt=n,ht=t,Pt=!1,n._updating=!0;try{const S=n._dirtyType,T=n._dirtyElements,k=n._dirtyLeaves;g.disconnect(),h=Wu(i,t,n,S,T,k)}catch(S){if(S instanceof Error&&n._onError(S),Po)throw S;return Xa(n,null,r,t),la(n),n._dirtyType=2,Po=!0,he(n,i),void(Po=!1)}finally{g.observe(r,Gs),n._updating=d,ht=c,Pt=u,gt=f}}t._readOnly||(t._readOnly=!0);const p=n._dirtyLeaves,_=n._dirtyElements,m=n._normalizedNodes,y=n._updateTags,C=n._deferred;a&&(n._dirtyType=0,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements=new Map,n._normalizedNodes=new Set,n._updateTags=new Set),function(S,T){const k=S._decorators;let w=S._pendingDecorators||k;const A=T._nodeMap;let $;for($ in w)A.has($)||(w===k&&(w=ic(S)),delete w[$])}(n,t);const v=o?null:wt(Kt(n));if(n._editable&&v!==null&&(a||l===null||l.dirty||!l.is(s))&&r!==null&&!y.has(af)){gt=n,ht=t;try{if(g!==null&&g.disconnect(),a||l===null||l.dirty){const S=n._blockCursorElement;S!==null&&_i(S,n,r),yf(s,l,n,v,y,r)}(function(S,T,k){let w=S._blockCursorElement;if(E(k)&&k.isCollapsed()&&k.anchor.type==="element"&&T.contains(document.activeElement)){const A=k.anchor,$=A.getNode(),K=A.offset;let I=!1,z=null;if(K===$.getChildrenSize())Ro($.getChildAtIndex(K-1))&&(I=!0);else{const G=$.getChildAtIndex(K);if(G!==null&&Ro(G)){const dt=G.getPreviousSibling();(dt===null||Ro(dt))&&(I=!0,z=S.getElementByKey(G.__key))}}if(I){const G=S.getElementByKey($.__key);return w===null&&(S._blockCursorElement=w=function(dt){const Mt=dt.theme,ut=document.createElement("div");ut.contentEditable="false",ut.setAttribute("data-lexical-cursor","true");let Nt=Mt.blockCursor;if(Nt!==void 0){if(typeof Nt=="string"){const be=Pe(Nt);Nt=Mt.blockCursor=be}Nt!==void 0&&ut.classList.add(...Nt)}return ut}(S._config)),T.style.caretColor="transparent",void(z===null?G.appendChild(w):G.insertBefore(w,z))}}w!==null&&_i(w,S,T)})(n,r,l)}finally{g!==null&&g.observe(r,Gs),gt=f,ht=c}}h!==null&&function(S,T,k,w,A){const $=Array.from(S._listeners.mutation),K=$.length;for(let I=0;I<K;I++){const[z,G]=$[I];for(const dt of G){const Mt=T.get(dt);Mt!==void 0&&z(Mt,{dirtyLeaves:w,prevEditorState:A,updateTags:k})}}}(n,h,y,p,i),E(l)||l===null||s!==null&&s.is(l)||n.dispatchCommand(pe,void 0);const N=n._pendingDecorators;N!==null&&(n._decorators=N,n._pendingDecorators=null,Yn("decorator",n,!0,N)),function(S,T,k){const w=ol(T),A=ol(k);w!==A&&Yn("textcontent",S,!0,A)}(n,e||i,t),Yn("update",n,!0,{dirtyElements:_,dirtyLeaves:p,editorState:t,mutatedNodes:h,normalizedNodes:m,prevEditorState:e||i,tags:y}),function(S,T){if(S._deferred=[],T.length!==0){const k=S._updating;S._updating=!0;try{for(let w=0;w<T.length;w++)T[w]()}finally{S._updating=k}}}(n,C),function(S){const T=S._updates;if(T.length!==0){const k=T.shift();if(k){const[w,A]=k;go(S,w,A)}}}(n)}function Yn(n,e,t,...r){const o=e._updating;e._updating=t;try{const i=e._listeners[n],s=Array.from(i);for(const[l,a]of s){a&&a();const c=l(...r);i.has(l)?i.set(l,c):c&&c()}}finally{e._updating=o}}function el(n,e){const t=n._updates;let r=e||!1;for(;t.length!==0;){const o=t.shift();if(o){const[i,s]=o,l=n._pendingEditorState;let a;s!==void 0&&(a=s.onUpdate,s.skipTransforms&&(r=!0),s.discrete&&(l===null&&O(191),l._flushSync=!0),a&&n._deferred.push(a),ja(n,s.tag)),l==null?go(n,i,s):i()}}return r}function go(n,e,t){const r=n._updateTags;let o,i=!1,s=!1;t!==void 0&&(o=t.onUpdate,ja(n,t.tag),i=t.skipTransforms||!1,s=t.discrete||!1),o&&n._deferred.push(o);const l=n._editorState;let a=n._pendingEditorState,c=!1;(a===null||a._readOnly)&&(a=n._pendingEditorState=Ya(a||l),c=!0),a._flushSync=s;const u=ht,f=Pt,d=gt,g=n._updating;ht=a,Pt=!1,n._updating=!0,gt=n;const h=n._headless||n.getRootElement()===null;Gi(null);try{c&&(h?l._selection!==null&&(a._selection=l._selection.clone()):a._selection=function(y,C){const v=y.getEditorState()._selection,N=wt(Kt(y));return E(v)||v==null?ho(v,N,y,C):v.clone()}(n,t&&t.event||null));const _=n._compositionKey;e(),i=el(n,i),function(y,C){const v=C.getEditorState()._selection,N=y._selection;if(E(N)){const S=N.anchor,T=N.focus;let k;if(S.type==="text"&&(k=S.getNode(),k.selectionTransform(v,N)),T.type==="text"){const w=T.getNode();k!==w&&w.selectionTransform(v,N)}}}(a,n),n._dirtyType!==0&&(i?function(y,C){const v=C._dirtyLeaves,N=y._nodeMap;for(const S of v){const T=N.get(S);F(T)&&T.isAttached()&&T.isSimpleText()&&!T.isUnmergeable()&&Es(T)}}(a,n):function(y,C){const v=C._dirtyLeaves,N=C._dirtyElements,S=y._nodeMap,T=Ne(),k=new Map;let w=v,A=w.size,$=N,K=$.size;for(;A>0||K>0;){if(A>0){C._dirtyLeaves=new Set;for(const I of w){const z=S.get(I);F(z)&&z.isAttached()&&z.isSimpleText()&&!z.isUnmergeable()&&Es(z),z!==void 0&&Zs(z,T)&&Qs(C,z,k),v.add(I)}if(w=C._dirtyLeaves,A=w.size,A>0){Dr++;continue}}C._dirtyLeaves=new Set,C._dirtyElements=new Map,$.delete("root")&&$.set("root",!0);for(const I of $){const z=I[0],G=I[1];if(N.set(z,G),!G)continue;const dt=S.get(z);dt!==void 0&&Zs(dt,T)&&Qs(C,dt,k)}w=C._dirtyLeaves,A=w.size,$=C._dirtyElements,K=$.size,Dr++}C._dirtyLeaves=v,C._dirtyElements=N}(a,n),el(n),function(y,C,v,N){const S=y._nodeMap,T=C._nodeMap,k=[];for(const[w]of N){const A=T.get(w);A!==void 0&&(A.isAttached()||(b(A)&&oa(A,w,S,T,k,N),S.has(w)||N.delete(w),k.push(w)))}for(const w of k)T.delete(w);for(const w of v){const A=T.get(w);A===void 0||A.isAttached()||(S.has(w)||v.delete(w),T.delete(w))}}(l,a,n._dirtyLeaves,n._dirtyElements)),_!==n._compositionKey&&(a._flushSync=!0);const m=a._selection;if(E(m)){const y=a._nodeMap,C=m.anchor.key,v=m.focus.key;y.get(C)!==void 0&&y.get(v)!==void 0||O(19)}else Ft(m)&&m._nodes.size===0&&(a._selection=null)}catch(_){return _ instanceof Error&&n._onError(_),n._pendingEditorState=l,n._dirtyType=2,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),void he(n)}finally{ht=u,Pt=f,gt=d,n._updating=g,Dr=0}n._dirtyType!==0||n._deferred.length>0||function(_,m){const y=m.getEditorState()._selection,C=_._selection;if(C!==null){if(C.dirty||!C.is(y))return!0}else if(y!==null)return!0;return!1}(a,n)?a._flushSync?(a._flushSync=!1,he(n)):c&&Of(()=>{he(n)}):(a._flushSync=!1,c&&(r.clear(),n._deferred=[],n._pendingEditorState=null))}function re(n,e,t){gt===n&&t===void 0?e():go(n,e,t)}class qn{constructor(e,t,r){x(this,"element");x(this,"before");x(this,"after");this.element=e,this.before=t||null,this.after=r||null}withBefore(e){return new qn(this.element,e,this.after)}withAfter(e){return new qn(this.element,this.before,e)}withElement(e){return this.element===e?this:new qn(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return t!==null&&t.parentElement!==this.element&&O(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&O(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&O(224),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(e===null)this.removeManagedLineBreak();else{const t=e==="decorator"&&(io||ar||oo);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,r=e.nodeName==="IMG"?e.nextSibling:null;r&&t.removeChild(r),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===(t.nodeName==="IMG"))return;this.removeManagedLineBreak()}const r=this.element,o=this.before,i=document.createElement("br");if(r.insertBefore(i,o),e){const s=document.createElement("img");s.setAttribute("data-lexical-linebreak","true"),s.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",s.alt="",r.insertBefore(s,i),r.__lexicalLineBreak=s}else r.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let t=this.after;t!==null;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,r,o){if(r===this.element){const a=this.getFirstChildOffset();return[e,Math.min(a+e.getChildrenSize(),Math.max(a,o))]}const i=nl(t,r);i.push(o);const s=nl(t,this.element);let l=e.getIndexWithinParent();for(let a=0;a<s.length;a++){const c=i[a],u=s[a];if(c===void 0||c<u)break;if(c>u){l+=1;break}}return[e.getParentOrThrow(),l]}}function nl(n,e){const t=[];let r=e;for(;r!==n&&r!==null;r=r.parentNode){let o=0;for(let i=r.previousSibling;i!==null;i=i.previousSibling)o++;t.push(o)}return r!==n&&O(225),t.reverse()}class At extends Yt{constructor(t){super(t);x(this,"__first");x(this,"__last");x(this,"__size");x(this,"__format");x(this,"__style");x(this,"__indent");x(this,"__dir");x(this,"__textFormat");x(this,"__textStyle");this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(t){super.afterCloneFrom(t),this.__key===t.__key&&(this.__first=t.__first,this.__last=t.__last,this.__size=t.__size),this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const t=this.getFormat();return Tu[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const t=[];let r=this.getFirstChild();for(;r!==null;)t.push(r),r=r.getNextSibling();return t}getChildrenKeys(){const t=[];let r=this.getFirstChild();for(;r!==null;)t.push(r.__key),r=r.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const t=Z()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){const t=this.getLatest(),r=this.getParentOrThrow().getLastChild();return r!==null&&r.is(t)}getAllTextNodes(){const t=[];let r=this.getFirstChild();for(;r!==null;){if(F(r)&&t.push(r),b(r)){const o=r.getAllTextNodes();t.push(...o)}r=r.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;b(t);){const r=t.getFirstChild();if(r===null)break;t=r}return t}getLastDescendant(){let t=this.getLastChild();for(;b(t);){const r=t.getLastChild();if(r===null)break;t=r}return t}getDescendantByIndex(t){const r=this.getChildren(),o=r.length;if(t>=o){const s=r[o-1];return b(s)&&s.getLastDescendant()||s||null}const i=r[t];return b(i)&&i.getFirstDescendant()||i||null}getFirstChild(){const t=this.getLatest().__first;return t===null?null:tt(t)}getFirstChildOrThrow(){const t=this.getFirstChild();return t===null&&O(45,this.__key),t}getLastChild(){const t=this.getLatest().__last;return t===null?null:tt(t)}getLastChildOrThrow(){const t=this.getLastChild();return t===null&&O(96,this.__key),t}getChildAtIndex(t){const r=this.getChildrenSize();let o,i;if(t<r/2){for(o=this.getFirstChild(),i=0;o!==null&&i<=t;){if(i===t)return o;o=o.getNextSibling(),i++}return null}for(o=this.getLastChild(),i=r-1;o!==null&&i>=t;){if(i===t)return o;o=o.getPreviousSibling(),i--}return null}getTextContent(){let t="";const r=this.getChildren(),o=r.length;for(let i=0;i<o;i++){const s=r[i];t+=s.getTextContent(),b(s)&&i!==o-1&&!s.isInline()&&(t+=so)}return t}getTextContentSize(){let t=0;const r=this.getChildren(),o=r.length;for(let i=0;i<o;i++){const s=r[i];t+=s.getTextContentSize(),b(s)&&i!==o-1&&!s.isInline()&&(t+=2)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(t!==""){const r=qo[t];return(this.getFormat()&r)!==0}return!1}hasTextFormat(t){const r=Me[t];return(this.getTextFormat()&r)!==0}getFormatFlags(t,r){return Qr(this.getLatest().__textFormat,t,r)}getTextStyle(){return this.getLatest().__textStyle}select(t,r){mt();const o=M();let i=t,s=r;const l=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&r===0){const c=this.getFirstChild();if(F(c)||b(c))return c.select(0,0)}else if(!(t!==void 0&&t!==l||r!==void 0&&r!==l)){const c=this.getLastChild();if(F(c)||b(c))return c.select()}}i===void 0&&(i=l),s===void 0&&(s=l);const a=this.__key;return E(o)?(o.anchor.set(a,i,"element"),o.focus.set(a,s,"element"),o.dirty=!0,o):Wa(a,i,a,s,"element","element")}selectStart(){const t=this.getFirstDescendant();return t?t.selectStart():this.select()}selectEnd(){const t=this.getLastDescendant();return t?t.selectEnd():this.select()}clear(){const t=this.getWritable();return this.getChildren().forEach(r=>r.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){const r=this.getWritable();return r.__dir=t,r}setFormat(t){return this.getWritable().__format=t!==""?qo[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){const r=this.getWritable();return r.__textFormat=t,r}setTextStyle(t){const r=this.getWritable();return r.__textStyle=t,r}setIndent(t){return this.getWritable().__indent=t,this}splice(t,r,o){qr(this)&&O(324,this.__key,this.__type);const i=this.getChildrenSize(),s=this.getWritable();t+r<=i||O(226,String(t),String(r),String(i));const l=s.__key,a=[],c=[],u=this.getChildAtIndex(t+r);let f=null,d=i-r+o.length;if(t!==0)if(t===i)f=this.getLastChild();else{const h=this.getChildAtIndex(t);h!==null&&(f=h.getPreviousSibling())}if(r>0){let h=f===null?this.getFirstChild():f.getNextSibling();for(let p=0;p<r;p++){h===null&&O(100);const _=h.getNextSibling(),m=h.__key;He(h.getWritable()),c.push(m),h=_}}let g=f;for(const h of o){g!==null&&h.is(g)&&(f=g=g.getPreviousSibling());const p=h.getWritable();p.__parent===l&&d--,He(p);const _=h.__key;if(g===null)s.__first=_,p.__prev=null;else{const m=g.getWritable();m.__next=_,p.__prev=m.__key}h.__key===l&&O(76),p.__parent=l,a.push(_),g=h}if(t+r===i)g!==null&&(g.getWritable().__next=null,s.__last=g.__key);else if(u!==null){const h=u.getWritable();if(g!==null){const p=g.getWritable();h.__prev=g.__key,p.__next=u.__key}else h.__prev=null}if(s.__size=d,c.length){const h=M();if(E(h)){const p=new Set(c),_=new Set(a),{anchor:m,focus:y}=h;rl(m,p,_)&&Gr(m,m.getNode(),this,f,u),rl(y,p,_)&&Gr(y,y.getNode(),this,f,u),d!==0||this.canBeEmpty()||Et(this)||this.remove()}}return s}getDOMSlot(t){return new qn(t)}exportDOM(t){const{element:r}=super.exportDOM(t);if(nt(r)){const o=this.getIndent();o>0&&(r.style.paddingInlineStart=40*o+"px");const i=this.getDirection();i&&(r.dir=i)}return{element:r}}exportJSON(){const t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},r=this.getTextFormat(),o=this.getTextStyle();return r===0&&o===""||Et(this)||this.getChildren().some(F)||(r!==0&&(t.textFormat=r),o!==""&&(t.textStyle=o)),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,r){return null}canIndent(){return!0}collapseAtStart(t){return!1}excludeFromCopy(t){return!1}canReplaceWith(t){return!0}canInsertAfter(t){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(t){return!1}extractWithChild(t,r,o){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(t,r){const o=this.getDOMSlot(t);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 At}function rl(n,e,t){let r=n.getNode();for(;r;){const o=r.__key;if(e.has(o)&&!t.has(o))return!0;r=r.getParent()}return!1}class Va extends Yt{decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Y(n){return n instanceof Va}class $n extends At{constructor(){super("root");x(this,"__cachedText");this.__cachedText=null}static getType(){return"root"}static clone(){return new $n}getTopLevelElementOrThrow(){O(51)}getTextContent(){const t=this.__cachedText;return!Fn()&&Z()._dirtyType!==0||t===null?super.getTextContent():t}remove(){O(52)}replace(t){O(53)}insertBefore(t){O(54)}insertAfter(t){O(55)}updateDOM(t,r){return!1}splice(t,r,o){for(const i of o)b(i)||Y(i)||O(282);return super.splice(t,r,o)}static importJSON(t){return ct().updateFromJSON(t)}collapseAtStart(){return!0}}function at(n){return n instanceof $n}function Ya(n){return new ur(new Map(n._nodeMap))}function qi(){return new ur(new Map([["root",new $n]]))}function qa(n){const e=n.exportJSON(),t=n.constructor;if(e.type!==t.getType()&&O(130,t.name),b(n)){const r=e.children;Array.isArray(r)||O(59,t.name);const o=n.getChildren();for(let i=0;i<o.length;i++){const s=qa(o[i]);r.push(s)}}return e}function bf(n){return n instanceof ur}class ur{constructor(e,t){x(this,"_nodeMap");x(this,"_selection");x(this,"_flushSync");x(this,"_readOnly");this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return tl(t&&t.editor||null,this,e)}clone(e){const t=new ur(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return tl(null,this,()=>({root:qa(ct())}))}}class Xi extends At{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class Pn extends At{static getType(){return"paragraph"}static clone(e){return new Pn(e.__key)}createDOM(e){const t=document.createElement("p"),r=vn(e.theme,"paragraph");return r!==void 0&&t.classList.add(...r),t}updateDOM(e,t,r){return!1}static importDOM(){return{p:e=>({conversion:wf,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(nt(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();r&&(t.style.textAlign=r)}return{element:t}}static importJSON(e){return H().updateFromJSON(e)}exportJSON(){const e=super.exportJSON();if(e.textFormat===void 0||e.textStyle===void 0){const t=this.getChildren().find(F);t?(e.textFormat=t.getFormat(),e.textStyle=t.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,t){const r=H();r.setTextFormat(e.format),r.setTextStyle(e.style);const o=this.getDirection();return r.setDirection(o),r.setFormat(this.getFormatType()),r.setStyle(this.getStyle()),this.insertAfter(r,t),r}collapseAtStart(){const e=this.getChildren();if(e.length===0||F(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function wf(n){const e=H();if(n.style&&(e.setFormat(n.style.textAlign),ls(n,e)),e.getFormatType()===""){const t=n.getAttribute("align");t&&t&&t in qo&&e.setFormat(t)}return{node:e}}function H(){return Ht(new Pn)}function fr(n){return n instanceof Pn}const W=0,_n=1,Xh=2,Wt=3,Nf=4;function Xa(n,e,t,r){const o=n._keyToDOMMap;o.clear(),n._editorState=qi(),n._pendingEditorState=r,n._compositionKey=null,n._dirtyType=0,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),n._normalizedNodes=new Set,n._updateTags=new Set,n._updates=[],n._blockCursorElement=null;const i=n._observer;i!==null&&(i.disconnect(),n._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",o.set("root",t))}function Tf(n){const e=new Set,t=new Set;let r=n;for(;r;){const{ownNodeConfig:o}=mo(r),i=r.transform;if(!t.has(i)){t.add(i);const s=r.transform();s&&e.add(s)}if(o){const s=o.$transform;s&&e.add(s),r=o.extends}else{const s=Object.getPrototypeOf(r);r=s.prototype instanceof Yt&&s!==Yt?s:void 0}}return e}function Ga(n){const e=n||{},t=xf(),r=e.theme||{},o=n===void 0?t:e.parentEditor||null,i=e.disableEvents||!1,s=qi(),l=e.namespace||(o!==null?o._config.namespace:ac()),a=e.editorState,c=[$n,xe,On,An,Pn,Xi,...e.nodes||[]],{onError:u,html:f}=e,d=e.editable===void 0||e.editable;let g;if(n===void 0&&t!==null)g=t._nodes;else{g=new Map;for(let p=0;p<c.length;p++){let _=c[p],m=null,y=null;if(typeof _!="function"){const N=_;_=N.replace,m=N.with,y=N.withKlass||null}mo(_);const C=_.getType(),v=Tf(_);g.set(C,{exportDOM:f&&f.export?f.export.get(_):void 0,klass:_,replace:m,replaceWithKlass:y,sharedNodeState:Du(c[p]),transforms:v})}}const h=new Xe(s,o,g,{disableEvents:i,namespace:l,theme:r},u||console.error,function(p,_){const m=new Map,y=new Set,C=v=>{Object.keys(v).forEach(N=>{let S=m.get(N);S===void 0&&(S=[],m.set(N,S)),S.push(v[N])})};return p.forEach(v=>{const N=v.klass.importDOM;if(N==null||y.has(N))return;y.add(N);const S=N.call(v.klass);S!==null&&C(S)}),_&&C(_),m}(g,f?f.import:void 0),d,n);return a!==void 0&&(h._pendingEditorState=a,h._dirtyType=2),function(p){p.registerCommand(pa,Gu,W),p.registerCommand(_a,Qu,W),p.registerCommand(ma,Zu,W),p.registerCommand(ya,tf,W),p.registerCommand(Ca,ef,W)}(h),h}function kf(n,e){const t=n.get(e);n.delete(e),t&&t()}function Kn(n,e,t){return n.set(e,t),kf.bind(null,n,e)}class Xe{constructor(e,t,r,o,i,s,l,a){x(this,"_headless");x(this,"_parentEditor");x(this,"_rootElement");x(this,"_editorState");x(this,"_pendingEditorState");x(this,"_compositionKey");x(this,"_deferred");x(this,"_keyToDOMMap");x(this,"_updates");x(this,"_updating");x(this,"_listeners");x(this,"_commands");x(this,"_nodes");x(this,"_decorators");x(this,"_pendingDecorators");x(this,"_config");x(this,"_dirtyType");x(this,"_cloneNotNeeded");x(this,"_dirtyLeaves");x(this,"_dirtyElements");x(this,"_normalizedNodes");x(this,"_updateTags");x(this,"_observer");x(this,"_key");x(this,"_onError");x(this,"_htmlConversions");x(this,"_window");x(this,"_editable");x(this,"_blockCursorElement");x(this,"_createEditorArgs");this._createEditorArgs=a,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new 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=ac(),this._onError=i,this._htmlConversions=s,this._editable=l,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){return Kn(this._listeners.update,e)}registerEditableListener(e){return Kn(this._listeners.editable,e)}registerDecoratorListener(e){return Kn(this._listeners.decorator,e)}registerTextContentListener(e){return Kn(this._listeners.textcontent,e)}registerRootListener(e){const t=this._listeners.root;return De(Kn(t,e,e(this._rootElement,null)||void 0),()=>function(r,o,i){const s=r.get(o);s&&s(),r.set(o,o(...i)||void 0)}(t,e,[null,this._rootElement]))}registerCommand(e,t,r){r===void 0&&O(35);const o=this._commands;o.has(e)||o.set(e,[new Set,new Set,new Set,new Set,new Set]);const i=o.get(e);i===void 0&&O(36,String(e));const s=i[r];return s.add(t),()=>{s.delete(t),i.every(l=>l.size===0)&&o.delete(e)}}registerMutationListener(e,t,r){const o=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation;let s=i.get(t);s===void 0&&(s=new Set,i.set(t,s)),s.add(o);const l=r&&r.skipInitialization;return l!==void 0&&l||this.initializeMutationListener(t,o),()=>{s.delete(o),s.size===0&&i.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return t===void 0&&O(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const r=this._editorState,o=fl(r).get(t.getType());if(!o)return;const i=new Map;for(const s of o.keys())i.set(s,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:r,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const r=this.getRegisteredNode(e);return r.transforms.add(t),r}registerNodeTransform(e,t){const r=this.registerNodeTransformToKlass(e,t),o=[r],i=r.replaceWithKlass;if(i!=null){const s=this.registerNodeTransformToKlass(i,t);o.push(s)}return function(s,l){const a=fl(s.getEditorState()),c=[];for(const u of l){const f=a.get(u);f&&c.push(f)}c.length!==0&&s.update(()=>{for(const u of c)for(const f of u.keys()){const d=tt(f);d&&d.markDirty()}},s._pendingEditorState===null?{tag:Vn}:void 0)}(this,o.map(s=>s.klass.getType())),()=>{o.forEach(s=>s.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return P(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const r=vn(this._config.theme,"root"),o=this._pendingEditorState||this._editorState;if(this._rootElement=e,Xa(this,t,e,o),t!==null&&(this._config.disableEvents||nf(t),r!=null&&t.classList.remove(...r)),e!==null){const i=ss(e),s=e.style;s.userSelect="text",s.whiteSpace="pre-wrap",s.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=i,this._dirtyType=2,la(this),this._updateTags.add(Vn),he(this),this._config.disableEvents||function(l,a){const c=l.ownerDocument;si.set(l,c);const u=Vr.get(c)??0;u<1&&c.addEventListener("selectionchange",$a),Vr.set(c,u+1),l.__lexicalEditor=a;const f=Fa(l);for(let d=0;d<ii.length;d++){const[g,h]=ii[d],p=typeof h=="function"?_=>{Rs(_)||(Ds(_),(a.isEditable()||g==="click")&&h(_,a))}:_=>{if(Rs(_))return;Ds(_);const m=a.isEditable();switch(g){case"cut":return m&&P(a,co,_);case"copy":return P(a,ao,_);case"paste":return m&&P(a,Ri,_);case"dragstart":return m&&P(a,ba,_);case"dragover":return m&&P(a,wa,_);case"dragend":return m&&P(a,ju,_);case"focus":return m&&P(a,Na,_);case"blur":return m&&P(a,qu,_);case"drop":return m&&P(a,xa,_)}};l.addEventListener(g,p),f.push(()=>{l.removeEventListener(g,p)})}}(e,this),r!=null&&e.classList.add(...r)}else this._window=null,this._updateTags.add(Vn),he(this);Yn("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&O(38);let r=e;r._readOnly&&(r=Ya(e),r._selection=e._selection?e._selection.clone():null),sa(this);const o=this._pendingEditorState,i=this._updateTags,s=t!==void 0?t.tag:null;o===null||o.isEmpty()||(s!=null&&i.add(s),he(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&i.add(s),this._updating||he(this)}parseEditorState(e,t){return function(r,o,i){const s=qi(),l=ht,a=Pt,c=gt,u=o._dirtyElements,f=o._dirtyLeaves,d=o._cloneNotNeeded,g=o._dirtyType;o._dirtyElements=new Map,o._dirtyLeaves=new Set,o._cloneNotNeeded=new Set,o._dirtyType=0,ht=s,Pt=!1,gt=o,Gi(null);try{const h=o._nodes;Yi(r.root,h),i&&i(s),s._readOnly=!0}catch(h){h instanceof Error&&o._onError(h)}finally{o._dirtyElements=u,o._dirtyLeaves=f,o._cloneNotNeeded=d,o._dirtyType=g,ht=l,Pt=a,gt=c}return s}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return he(this),this.getEditorState().read(e,{editor:this})}update(e,t){(function(r,o,i){r._updating?r._updates.push([o,i]):go(r,o,i)})(this,e,t)}focus(e,t={}){const r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),re(this,()=>{const o=M(),i=ct();o!==null?o.dirty||et(o.clone()):i.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?i.selectStart():i.selectEnd()),is("focus"),Ff(()=>{r.removeAttribute("autocapitalize"),e&&e()})}),this._pendingEditorState===null&&r.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const t=wt(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Yn("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}x(Xe,"version");Xe.version="0.42.0+prod.esm";let hi=null;function Gi(n){hi=n}let Ef=1;function Qa(n,e){const t=Qi(n,e);return t===void 0&&O(30,e),t}function Qi(n,e){return n._nodes.get(e)}const Of=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function Za(n){return Y(Rt(n))}function Zi(n){const e=document.activeElement;if(!nt(e))return!1;const t=e.nodeName;return Y(Rt(n))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&po(e)==null)}function dr(n,e,t){const r=n.getRootElement();try{return r!==null&&r.contains(e)&&r.contains(t)&&e!==null&&!Zi(e)&&tc(e)===n}catch{return!1}}function ts(n){return n instanceof Xe}function tc(n){let e=n;for(;e!=null;){const t=po(e);if(ts(t))return t;e=hr(e)}return null}function po(n){return n?n.__lexicalEditor:null}function Je(n){return cr(n)||n.isToken()}function ue(n){return Je(n)||n.isSegmented()}function ve(n){return se(n)&&n.nodeType===3}function ec(n){return se(n)&&n.nodeType===9}function Tn(n){let e=n;for(;e!=null;){if(ve(e))return e;e=e.firstChild}return null}function Qr(n,e,t){const r=Me[e];if(t!==null&&(n&r)===(t&r))return n;let o=n^r;return e==="subscript"?o&=-65:e==="superscript"?o&=-33:e==="lowercase"?(o&=-513,o&=-1025):e==="uppercase"?(o&=-257,o&=-1025):e==="capitalize"&&(o&=-257,o&=-513),o}function nc(n){return F(n)||Jt(n)||Y(n)}function rc(n,e){const t=function(){const s=hi;return hi=null,s}();if((e=e||t&&t.__key)!=null)return void(n.__key=e);mt(),Ha();const r=Z(),o=Re(),i=""+Ef++;o._nodeMap.set(i,n),b(n)?r._dirtyElements.set(i,!0):r._dirtyLeaves.add(i),r._cloneNotNeeded.add(i),r._dirtyType=1,n.__key=i}function He(n){const e=n.getParent();if(e!==null){const t=n.getWritable(),r=e.getWritable(),o=n.getPreviousSibling(),i=n.getNextSibling(),s=i!==null?i.__key:null,l=o!==null?o.__key:null,a=o!==null?o.getWritable():null,c=i!==null?i.getWritable():null;o===null&&(r.__first=s),i===null&&(r.__last=l),a!==null&&(a.__next=s),c!==null&&(c.__prev=l),t.__prev=null,t.__next=null,t.__parent=null,r.__size--}}function Zr(n){Ha(),qr(n)&&O(323,n.__key,n.__type);const e=n.getLatest(),t=e.__parent,r=Re(),o=Z(),i=r._nodeMap,s=o._dirtyElements;t!==null&&function(a,c,u){let f=a;for(;f!==null;){if(u.has(f))return;const d=c.get(f);if(d===void 0)break;u.set(f,!1),f=d.__parent}}(t,i,s);const l=e.__key;o._dirtyType=1,b(n)?s.set(l,!0):o._dirtyLeaves.add(l)}function yt(n){mt();const e=Z(),t=e._compositionKey;if(n!==t){if(e._compositionKey=n,t!==null){const r=tt(t);r!==null&&r.getWritable()}if(n!==null){const r=tt(n);r!==null&&r.getWritable()}}}function Ne(){return Fn()?null:Z()._compositionKey}function tt(n,e){const t=(e||Re())._nodeMap.get(n);return t===void 0?null:t}function oc(n,e){const t=_o(n,Z());return t!==void 0?tt(t,e):null}function _o(n,e){return n[`__lexicalKey_${e._key}`]}function Rt(n,e){let t=n;for(;t!=null;){const r=oc(t,e);if(r!==null)return r;t=hr(t)}return null}function ic(n){const e=n._decorators,t=Object.assign({},e);return n._pendingDecorators=t,t}function ol(n){return n.read(()=>ct().getTextContent())}function ct(){return sc(Re())}function sc(n){return n._nodeMap.get("root")}function et(n){mt();const e=Re();n!==null&&(n.dirty=!0,n.setCachedNodes(null)),e._selection=n}function Cn(n){const e=Z(),t=function(r,o){let i=r;for(;i!=null;){const s=_o(i,o);if(s!==void 0)return s;i=hr(i)}return null}(n,e);return t===null?n===e.getRootElement()?tt("root"):null:tt(t)}function lc(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function es(n){const e=[];for(let t=n;t!==null;t=t._updating?null:t._parentEditor)e.push(t);return e}function ac(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function cc(n){return ve(n)?n.nodeValue:null}function ns(n,e,t){const r=wt(Kt(e));if(r===null)return;const o=r.anchorNode;let{anchorOffset:i,focusOffset:s}=r;if(o!==null){let l=cc(o);const a=Rt(o);if(l!==null&&F(a)){if((l===Qn||l===$i)&&t){const c=t.length;l=t,i=c,s=c}l!==null&&rs(a,l,i,s,n)}}}function rs(n,e,t,r,o){let i=n;if(i.isAttached()&&(o||!i.isDirty())){const s=i.isComposing();let l=e;if((s||o)&&(e.endsWith(Qn)&&(l=e.slice(0,-Qn.length)),o)){const c=$i;let u;for(;(u=l.indexOf(c))!==-1;)l=l.slice(0,u)+l.slice(u+c.length),t!==null&&t>u&&(t=Math.max(u,t-c.length)),r!==null&&r>u&&(r=Math.max(u,r-c.length))}const a=i.getTextContent();if(o||l!==a){if(l===""){if(yt(null),oo||ar||io)i.remove();else{const p=Z();setTimeout(()=>{p.update(()=>{i.isAttached()&&i.remove()})},20)}return}const c=i.getParent(),u=Lt(),f=i.getTextContentSize(),d=Ne(),g=i.getKey();if(i.isToken()||d!==null&&g===d&&!s||E(u)&&(c!==null&&!c.canInsertTextBefore()&&u.anchor.offset===0||u.anchor.key===n.__key&&u.anchor.offset===0&&!i.canInsertTextBefore()&&!s||u.focus.key===n.__key&&u.focus.offset===f&&!i.canInsertTextAfter()&&!s))return void i.markDirty();const h=M();if(!E(h)||t===null||r===null)return void il(i,l,h);if(h.setTextNodeRange(i,t,i,r),i.isSegmented()){const p=st(i.getTextContent());i.replace(p),i=p}il(i,l,h)}}}function il(n,e,t){if(n.setTextContent(e),E(t)){const r=n.getKey();for(const o of["anchor","focus"]){const i=t[o];i.type==="text"&&i.key===r&&(i.offset=ie(n,i.offset,"clamp"))}}}function vr(n,e,t){const r=e[t]||!1;return r==="any"||r===n[t]}function Af(n,e){return vr(n,e,"altKey")&&vr(n,e,"ctrlKey")&&vr(n,e,"shiftKey")&&vr(n,e,"metaKey")}function X(n,e,t){if(!Af(n,t))return!1;if(n.key.toLowerCase()===e.toLowerCase())return!0;if(e.length>1||n.key.length===1&&n.key.charCodeAt(0)<=127)return!1;const r="Key"+e.toUpperCase();return n.code===r}const ce={ctrlKey:!Ut,metaKey:Ut},sl={altKey:Ut,ctrlKey:!Ut};function ll(n){return n.key==="Backspace"}function al(n){return X(n,"a",ce)}function Mf(n){const e=ct();if(E(n)){const t=n.anchor,r=n.focus,o=t.getNode().getTopLevelElementOrThrow().getParentOrThrow();return t.set(o.getKey(),0,"element"),r.set(o.getKey(),o.getChildrenSize(),"element"),Zn(n),n}{const t=e.select(0,e.getChildrenSize());return et(Zn(t)),t}}function vn(n,e){n.__lexicalClassNameCache===void 0&&(n.__lexicalClassNameCache={});const t=n.__lexicalClassNameCache,r=t[e];if(r!==void 0)return r;const o=n[e];if(typeof o=="string"){const i=Pe(o);return t[e]=i,i}return o}function os(n,e,t,r,o){if(t.size===0)return;const i=r.__type,s=r.__key,l=e.get(i);l===void 0&&O(33,i);const a=l.klass;let c=n.get(a);c===void 0&&(c=new Map,n.set(a,c));const u=c.get(s),f=u==="destroyed"&&o==="created";(u===void 0||f)&&c.set(s,f?"updated":o)}function cl(n,e,t){const r=n.getParent();let o=t,i=n;return r!==null&&(e&&t===0?(o=i.getIndexWithinParent(),i=r):e||t!==i.getChildrenSize()||(o=i.getIndexWithinParent()+1,i=r)),i.getChildAtIndex(e?o-1:o)}function gi(n,e){const t=n.offset;if(n.type==="element")return cl(n.getNode(),e,t);{const r=n.getNode();if(e&&t===0||!e&&t===r.getTextContentSize()){const o=e?r.getPreviousSibling():r.getNextSibling();return o===null?cl(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):o}}return null}function uc(n){const e=Kt(n).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function P(n,e,t){return function(r,o,i){const s=es(r);for(let l=4;l>=0;l--)for(let a=0;a<s.length;a++){const c=s[a],u=c._commands.get(o);if(u!==void 0){const f=u[l];if(f!==void 0){const d=Array.from(f),g=d.length;let h=!1;if(re(c,()=>{for(let p=0;p<g;p++)if(d[p](i,r))return void(h=!0)}),h)return h}}}return!1}(n,e,t)}function kn(n,e){const t=n._keyToDOMMap.get(e);return t===void 0&&O(75,e),t}function hr(n){const e=n.assignedSlot||n.parentElement;return mi(e)?e.host:e}function fc(n){return ec(n)?n:nt(n)?n.ownerDocument:null}function is(n){mt(),Z()._updateTags.add(n)}function Ff(n){mt(),Z()._deferred.push(n)}function pi(n,e){let t=n.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function ss(n){const e=fc(n);return e?e.defaultView:null}function Kt(n){const e=n._window;return e===null&&O(78),e}function $f(n){return b(n)&&n.isInline()||Y(n)&&n.isInline()}function Pf(n){let e=n.getParentOrThrow();for(;e!==null;){if(Et(e))return e;e=e.getParentOrThrow()}return e}function Et(n){return at(n)||b(n)&&n.isShadowRoot()}function $t(n,e=!1){const t=n.constructor.clone(n);return rc(t,null),t.afterCloneFrom(n),e||t.resetOnCopyNodeFrom(n),t}function Ht(n){const e=Z(),t=n.getType(),r=Qi(e,t);r===void 0&&O(200,n.constructor.name,t);const{replace:o,replaceWithKlass:i}=r;if(o!==null){const s=o(n),l=s.constructor;return i!==null?s instanceof i||O(201,i.name,i.getType(),l.name,l.getType(),n.constructor.name,t):s instanceof n.constructor&&l!==n.constructor||O(202,l.name,l.getType(),n.constructor.name,t),s.__key===n.__key&&O(203,n.constructor.name,t,l.name,l.getType()),s}return n}function Do(n,e){!at(n.getParent())||b(e)||Y(e)||O(99)}function Xn(n){const e=tt(n);return e===null&&O(63,n),e}function Ro(n){return(Y(n)||b(n)&&!n.canBeEmpty())&&!n.isInline()}function _i(n,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=n.parentElement;r!==null&&r.removeChild(n)}function wt(n){return Gt?(n||window).getSelection():null}function Df(n){const e=ss(n);return e?e.getSelection():null}function Gh(n){return nt(n)&&n.tagName==="A"}function nt(n){return se(n)&&n.nodeType===1}function se(n){return typeof n=="object"&&n!==null&&"nodeType"in n&&typeof n.nodeType=="number"}function mi(n){return se(n)&&n.nodeType===11}function yi(n){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return n.nodeName.match(e)!==null}function to(n){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return n.nodeName.match(e)!==null}function Bt(n){if(Y(n)&&!n.isInline())return!0;if(!b(n)||Et(n))return!1;const e=n.getFirstChild(),t=e===null||Jt(e)||F(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function Dn(){return Z()}const ul=new WeakMap,Rf=new Map;function fl(n){if(!n._readOnly&&n.isEmpty())return Rf;n._readOnly||O(192);let e=ul.get(n);return e||(e=function(t){const r=new Map;for(const[o,i]of t._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),ul.set(n,e)),e}function dc(n){const e=n.constructor.clone(n);return e.afterCloneFrom(n),e}function Lf(n){return(e=dc(n))[Pa]=!0,e;var e}function ls(n,e){const t=parseInt(n.style.paddingInlineStart,10)||0,r=Math.round(t/40);e.setIndent(r)}function Kf(n){n.__lexicalUnmanaged=!0}function If(n){return n.__lexicalUnmanaged===!0}function In(n,e){return function(t,r){return Object.prototype.hasOwnProperty.call(t,r)}(n,e)&&n[e]!==Yt[e]}function mo(n){const e=xs in n.prototype?n.prototype[xs]():void 0,t=function(s){if(!(s===Yt||s.prototype instanceof Yt)){let l="<unknown>",a="<unknown>";try{l=s.getType()}catch{}try{Xe.version&&(a=JSON.parse(Xe.version))}catch{}O(290,s.name,l,a)}return s===Va||s===At||s===Yt}(n),r=!t&&In(n,"getType")?n.getType():void 0;let o,i=r;if(e)if(r)o=e[r];else for(const[s,l]of Object.entries(e))i=s,o=l;if(!t&&i&&(In(n,"getType")||(n.getType=()=>i),In(n,"clone")||(n.clone=s=>(Gi(s),new n)),In(n,"importJSON")||(n.importJSON=o&&o.$importJSON||(s=>new n().updateFromJSON(s))),!In(n,"importDOM")&&o)){const{importDOM:s}=o;s&&(n.importDOM=()=>s)}return{ownNodeConfig:o,ownNodeType:i}}function zf(n){const e=Dn();return mt(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(n))).klass}const B=(n,e)=>{let t=n;for(;t!=null&&!at(t);){if(e(t))return t;t=t.getParent()}return null},Wf={next:"previous",previous:"next"};class as{constructor(e){x(this,"origin");this.origin=e}[Symbol.iterator](){return yo({hasNext:Fe,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return it(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return it(this.origin,this.direction)}remove(){const e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){const r=this.getNodeAtCaret();return e.is(this.origin)||e.is(r)||(r===null?this.insert(e):r.replace(e,t)),this}splice(e,t,r="next"){const o=r===this.direction?t:Array.from(t).reverse();let i=this;const s=this.getParentAtCaret(),l=new Map;for(let a=i.getAdjacentCaret();a!==null&&l.size<e;a=a.getAdjacentCaret()){const c=a.origin.getWritable();l.set(c.getKey(),c)}for(const a of o){if(l.size>0){const c=i.getNodeAtCaret();if(c){if(l.delete(c.getKey()),l.delete(a.getKey()),!(c.is(a)||i.origin.is(a))){const u=a.getParent();u&&u.is(s)&&a.remove(),c.replace(a)}}else c===null&&O(263,Array.from(l).join(" "))}else i.insert(a);i=it(a,this.direction)}for(const a of l.values())a.remove();return this}}class rr extends as{constructor(){super(...arguments);x(this,"type","child")}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:vt(t,this.direction)}getParentCaret(t="root"){return it(cs(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=sn(this.direction);return it(this.getNodeAtCaret(),t)||vt(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof rr&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}}const Bf={root:at,shadowRoot:Et};function sn(n){return Wf[n]}function cs(n,e="root"){return Bf[e](n)?null:n}class Ge extends as{constructor(){super(...arguments);x(this,"type","sibling")}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:it(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return b(this.origin)?vt(this.origin,this.direction):null}getParentCaret(t="root"){return it(cs(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=sn(this.direction);return it(this.getNodeAtCaret(),t)||vt(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof Ge&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof Ge||t instanceof Qe)&&this.direction===t.direction&&this.origin.is(t.origin)}}class Qe extends as{constructor(t,r){super(t);x(this,"type","text");x(this,"offset");this.offset=r}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:Ze(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return it(cs(this.getParentAtCaret(),t),this.direction)}getFlipped(){return Ze(this.origin,sn(this.direction),this.offset)}isSamePointCaret(t){return t instanceof Qe&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof Ge||t instanceof Qe)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return it(this.origin,this.direction)}}function oe(n){return n instanceof Qe}function Fe(n){return n instanceof Ge}function Ot(n){return n instanceof rr}const Jf={next:class extends Qe{constructor(){super(...arguments);x(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Qe{constructor(){super(...arguments);x(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Hf={next:class extends Ge{constructor(){super(...arguments);x(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Ge{constructor(){super(...arguments);x(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Uf={next:class extends rr{constructor(){super(...arguments);x(this,"direction","next")}getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends rr{constructor(){super(...arguments);x(this,"direction","previous")}getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function it(n,e){return n?new Hf[e](n):null}function Ze(n,e,t){return n?new Jf[e](n,ie(n,t)):null}function ie(n,e,t="error"){const r=n.getTextContentSize();let o=e==="next"?r:e==="previous"?0:e;return(o<0||o>r)&&(t!=="clamp"&&ea(284,String(e),String(r),n.getKey()),o=o<0?0:r),o}function dl(n,e){return new Vf(n,e)}function vt(n,e){return b(n)?new Uf[e](n):null}function jf(n){return n&&n.getChildCaret()||n}function tn(n){return n&&jf(n.getAdjacentCaret())}class us{constructor(e,t,r){x(this,"type","node-caret-range");x(this,"direction");x(this,"anchor");x(this,"focus");this.anchor=e,this.focus=t,this.direction=r}getLatest(){const e=this.anchor.getLatest(),t=this.focus.getLatest();return e===this.anchor&&t===this.focus?this:new us(e,t,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const e=o=>{const i=this[o].getLatest();return oe(i)?function(s,l){const{direction:a,origin:c}=s,u=ie(c,l==="focus"?sn(a):a);return dl(s,u-s.offset)}(i,o):null},t=e("anchor"),r=e("focus");if(t&&r){const{caret:o}=t,{caret:i}=r;if(o.isSameNodeCaret(i))return[dl(o,i.offset-o.offset),null]}return[t,r]}iterNodeCarets(e="root"){const t=oe(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),r=this.focus.getLatest(),o=oe(r),i=s=>s.isSameNodeCaret(r)?null:tn(s)||s.getParentCaret(e);return yo({hasNext:s=>s!==null&&!(o&&r.isSameNodeCaret(s)),initial:t.isSameNodeCaret(r)?null:i(t),map:s=>s,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class Vf{constructor(e,t){x(this,"type","slice");x(this,"caret");x(this,"distance");this.caret=e,this.distance=t}getSliceIndices(){const{distance:e,caret:{offset:t}}=this,r=t+e;return r<t?[r,t]:[t,r]}getTextContent(){const[e,t]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,t)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:e,direction:t}}=this,[r,o]=this.getSliceIndices(),i=e.getTextContent();return Ze(e.setTextContent(i.slice(0,r)+i.slice(o)),t,r)}}function or(n){return $e(n,it(ct(),n.direction))}function hc(n){return $e(n,n)}function $e(n,e){return n.direction!==e.direction&&O(265),new us(n,e,n.direction)}function yo(n){const{initial:e,hasNext:t,step:r,map:o}=n;let i=e;return{[Symbol.iterator](){return this},next(){if(!t(i))return{done:!0,value:void 0};const s={done:!1,value:o(i)};return i=r(i),s}}}function gc(n,e){const t=Rr(n.origin,e.origin);switch(t===null&&O(275,n.origin.getKey(),e.origin.getKey()),t.type){case"same":{const r=n.type==="text",o=e.type==="text";return r&&o?function(i,s){return Math.sign(i-s)}(n.offset,e.offset):n.type===e.type?0:r?-1:o?1:n.type==="child"?-1:1}case"ancestor":return n.type==="child"?-1:1;case"descendant":return e.type==="child"?1:-1;case"branch":return pc(t)}}function pc(n){const{a:e,b:t}=n,r=e.__key,o=t.__key;let i=e,s=t;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 br(n,e){return e.is(n)}function hl(n){return b(n)?[n.getLatest(),null]:[n.getParent(),n.getLatest()]}function Rr(n,e){if(n.is(e))return{commonAncestor:n,type:"same"};const t=new Map;for(let[r,o]=hl(n);r;o=r,r=r.getParent())t.set(r,o);for(let[r,o]=hl(e);r;o=r,r=r.getParent()){const i=t.get(r);if(i!==void 0)return i===null?(br(n,r)||O(276),{commonAncestor:r,type:"ancestor"}):o===null?(br(e,r)||O(277),{commonAncestor:r,type:"descendant"}):((b(i)||br(n,i))&&(b(o)||br(e,o))&&r.is(i.getParent())&&r.is(o.getParent())||O(278),{a:i,b:o,commonAncestor:r,type:"branch"})}return null}function Xt(n,e){const{type:t,key:r,offset:o}=n,i=Xn(n.key);return t==="text"?(F(i)||O(266,i.getType(),r),Ze(i,e,o)):(b(i)||O(267,i.getType(),r),qf(i,n.offset,e))}function jt(n,e){const{origin:t,direction:r}=e,o=r==="next";oe(e)?n.set(t.getKey(),e.offset,"text"):Fe(e)?F(t)?n.set(t.getKey(),ie(t,r),"text"):n.set(t.getParentOrThrow().getKey(),t.getIndexWithinParent()+(o?1:0),"element"):(Ot(e)&&b(t)||O(268),n.set(t.getKey(),o?0:t.getChildrenSize(),"element"))}function _c(n){const e=M(),t=E(e)?e:fo();return Lr(t,n),et(t),t}function Lr(n,e){jt(n.anchor,e.anchor),jt(n.focus,e.focus)}function gl(n){const{anchor:e,focus:t}=n,r=Xt(e,"next"),o=Xt(t,"next"),i=gc(r,o)<=0?"next":"previous";return $e(Se(r,i),Se(o,i))}function gr(n){const{direction:e,origin:t}=n,r=it(t,sn(e)).getNodeAtCaret();return r?it(r,e):vt(t.getParentOrThrow(),e)}function pl(n,e="root"){const t=[n];for(let r=Ot(n)?n.getParentCaret(e):n.getSiblingCaret();r!==null;r=r.getParentCaret(e))t.push(gr(r));return t}function Lo(n){return!!n&&n.origin.isAttached()}function Yf(n,e="removeEmptySlices"){if(n.isCollapsed())return n;const t="root",r="next";let o=e;const i=mc(n,r),s=pl(i.anchor,t),l=pl(i.focus.getFlipped(),t),a=new Set,c=[];for(const h of i.iterNodeCarets(t))if(Ot(h))a.add(h.origin.getKey());else if(Fe(h)){const{origin:p}=h;b(p)&&!a.has(p.getKey())||c.push(p)}for(const h of c)h.remove();for(const h of i.getTextSlices()){if(!h)continue;const{origin:p}=h.caret,_=p.getTextContentSize(),m=gr(it(p,r)),y=p.getMode();if(Math.abs(h.distance)===_&&o==="removeEmptySlices"||y==="token"&&h.distance!==0)m.remove();else if(h.distance!==0){o="removeEmptySlices";let C=h.removeTextSlice();const v=h.caret.origin;if(y==="segmented"){const N=C.origin,S=st(N.getTextContent()).setStyle(N.getStyle()).setFormat(N.getFormat());m.replaceOrInsert(S),C=Ze(S,r,C.offset)}v.is(s[0].origin)&&(s[0]=C),v.is(l[0].origin)&&(l[0]=C.getFlipped())}}let u,f;for(const h of s)if(Lo(h)){u=kt(h);break}for(const h of l)if(Lo(h)){f=kt(h);break}const d=function(h,p,_){if(!h||!p)return null;const m=h.getParentAtCaret(),y=p.getParentAtCaret();if(!m||!y)return null;const C=m.getParents().reverse();C.push(m);const v=y.getParents().reverse();v.push(y);const N=Math.min(C.length,v.length);let S;for(S=0;S<N&&C[S]===v[S];S++);const T=(A,$)=>{let K;for(let I=S;I<A.length;I++){const z=A[I];if(Et(z))return;!K&&$(z)&&(K=z)}return K},k=T(C,Bt),w=k&&T(v,A=>_.has(A.getKey())&&Bt(A));return k&&w?[k,w]:null}(u,f,a);if(d){const[h,p]=d;vt(h,"previous").splice(0,p.getChildren());let _=p.getParent();for(p.remove(!0);_&&_.isEmpty();){const m=_;_=_.getParent(),m.remove(!0)}}const g=[u,f,...s,...l].find(Lo);if(g)return hc(Se(kt(g),n.direction));O(269,JSON.stringify(s.map(h=>h.origin.__key)))}function kt(n){const e=function(o){let i=o;for(;Ot(i);){const s=tn(i);if(!Ot(s))break;i=s}return i}(n.getLatest()),{direction:t}=e;if(F(e.origin))return oe(e)?e:Ze(e.origin,t,t);const r=e.getAdjacentCaret();return Fe(r)&&F(r.origin)?Ze(r.origin,t,sn(t)):e}function fs(n){return oe(n)&&n.offset!==ie(n.origin,n.direction)}function Se(n,e){return n.direction===e?n:n.getFlipped()}function mc(n,e){return n.direction===e?n:$e(Se(n.focus,e),Se(n.anchor,e))}function qf(n,e,t){let r=vt(n,"next");for(let o=0;o<e;o++){const i=r.getAdjacentCaret();if(i===null)break;r=i}return Se(r,t)}function yc(n,e="root"){let t=0,r=n,o=tn(r);for(;o===null;){if(t--,o=r.getParentCaret(e),!o)return null;r=o,o=tn(r)}return o&&[o,t]}function Xf(n){const{origin:e,offset:t,direction:r}=n;if(t===ie(e,r))return n.getSiblingCaret();if(t===ie(e,sn(r)))return gr(n.getSiblingCaret());const[o]=e.splitText(t);return F(o)||O(281),Se(it(o,"next"),r)}function Gf(n,e){return!0}function Qf(n,{$copyElementNode:e=$t,$splitTextPointCaretNext:t=Xf,rootMode:r="shadowRoot",$shouldSplit:o=Gf}={}){if(oe(n))return t(n);const i=n.getParentCaret(r);if(i){const{origin:s}=i;if(Ot(n)&&(!s.canBeEmpty()||!o(s,"first")))return gr(i);const l=function(a){const c=[];for(let u=a.getAdjacentCaret();u;u=u.getAdjacentCaret())c.push(u.origin);return c}(n);(l.length>0||s.canBeEmpty()&&o(s,"last"))&&i.insert(e(s).splice(0,0,l))}return i}function Zf(...n){return n}function td(n,e){if(!e||n===e)return n;for(const t in e)if(n[t]!==e[t])return{...n,...e};return n}function Pe(...n){const e=[];for(const t of n)if(t&&typeof t=="string")for(const[r]of t.matchAll(/\S+/g))e.push(r);return e}function pt(n,...e){const t=Pe(...e);t.length>0&&n.classList.add(...t)}function ye(n,...e){const t=Pe(...e);t.length>0&&n.classList.remove(...t)}function De(...n){return()=>{for(let e=n.length-1;e>=0;e--)n[e]();n.length=0}}function Qh(n){const e=Ga(n);return e._headless=!0,["registerDecoratorListener","registerRootListener","registerMutationListener","getRootElement","setRootElement","getElementByKey","focus","blur"].forEach(t=>{e[t]=()=>{throw new Error(`${t} is not supported in headless mode`)}}),e}function ed(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const Ci=new Map;function Cc(n){const e={};if(!n)return e;const t=n.split(";");for(const r of t)if(r!==""){const[o,i]=r.split(/:([^]+)/);o&&i&&(e[o.trim()]=i.trim())}return e}function _l(n){let e=Ci.get(n);return e===void 0&&(e=Cc(n),Ci.set(n,e)),e}function Sc(n){const e=Dn().getElementByKey(n.getKey());if(e===null)return null;const t=e.ownerDocument.defaultView;return t===null?null:t.getComputedStyle(e)}function xc(n){return Sc(at(n)?n:n.getParentOrThrow())}function ml(n){const e=xc(n);return e!==null&&e.direction==="rtl"}function vc(n,e,t="self"){const r=n.getStartEndPoints();if(e.isSelected(n)&&!ue(e)&&r!==null){const[o,i]=r,s=n.isBackward(),l=o.getNode(),a=i.getNode(),c=e.is(l),u=e.is(a);if(c||u){const[f,d]=fi(n),g=l.is(a),h=e.is(s?a:l),p=e.is(s?l:a);let _,m=0;g?(m=f>d?d:f,_=f>d?f:d):h?(m=s?d:f,_=void 0):p&&(m=0,_=s?f:d);const y=e.__text.slice(m,_);y!==e.__text&&(t==="clone"&&(e=Lf(e)),e.__text=y)}}return e}function Zh(n){if(n.type==="text")return n.offset===n.getNode().getTextContentSize();const e=n.getNode();return b(e)||ed(177),n.offset===e.getChildrenSize()}function nd(n){const e=n.getStyle(),t=Cc(e);Ci.set(e,t)}function rd(n,e){const t=n.getFormatType(),r=n.getIndent();t!==e.getFormatType()&&e.setFormat(t),r!==e.getIndent()&&e.setIndent(r)}function tg(n,e,t=rd){if(n===null)return;const r=n.getStartEndPoints(),o=new Map;let i=null;if(r){const[s,l]=r;i=fo(),i.anchor.set(s.key,s.offset,s.type),i.focus.set(l.key,l.offset,l.type);const a=B(s.getNode(),Bt),c=B(l.getNode(),Bt);b(a)&&o.set(a.getKey(),a),b(c)&&o.set(c.getKey(),c)}for(const s of n.getNodes())if(b(s)&&Bt(s))o.set(s.getKey(),s);else if(r===null){const l=B(s,Bt);b(l)&&o.set(l.getKey(),l)}for(const[s,l]of o){const a=e();t(l,a),l.replace(a,!0),i&&(s===i.anchor.key&&i.anchor.set(a.getKey(),i.anchor.offset,i.anchor.type),s===i.focus.key&&i.focus.set(a.getKey(),i.focus.offset,i.focus.type))}i&&n.is(M())&&et(i)}function bc(n){const e=wc(n);return e!==null&&e.writingMode==="vertical-rl"}function wc(n){const e=n.anchor.getNode();return b(e)?Sc(e):xc(e)}function yl(n,e){let t=bc(n)?!e:e;Nc(n)&&(t=!t);const r=Xt(n.focus,t?"previous":"next");if(fs(r))return!1;for(const o of or(r)){if(Ot(o))return!o.origin.isInline();if(!b(o.origin)){if(Y(o.origin))return!0;break}}return!1}function od(n,e,t,r){n.modify(e?"extend":"move",t,r)}function Nc(n){const e=wc(n);return e!==null&&e.direction==="rtl"}function Cl(n,e,t){const r=Nc(n);let o;o=bc(n)||r?!t:t,od(n,e,o,"character")}function Tc(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const pr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,id=pr&&"documentMode"in document?document.documentMode:null,sd=pr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ld=pr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);!(!pr||!("InputEvent"in window)||id)&&"getTargetRanges"in new window.InputEvent("input");const ad=pr,eg=sd,cd=ld;function ud(n,e){return Array.from(fd(n))}function fd(n,e){return hd("next",n)}function dd(n,e){const t=yc(it(n,e));return t&&t[0]}function hd(n,e,t){const r=ct(),o=e||r,i=b(o)?vt(o,n):it(o,n),s=gd(o),l=dd(o,n);let a=s;return yo({hasNext:c=>c!==null,initial:i,map:c=>({depth:a,node:c.origin}),step:c=>{if(c.isSameNodeCaret(l))return null;Ot(c)&&a++;const u=yc(c);return!u||u[0].isSameNodeCaret(l)?null:(a+=u[1],u[0])}})}function gd(n){let e=-1;for(let t=n;t!==null;t=t.getParent())e++;return e}function pd(n,e){let t=n;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function _d(n){const e=B(n,t=>b(t)&&!t.isInline());return b(e)||Tc(4,n.__key),e}function md(n){const e=M()||Lt();let t;if(E(e))t=Xt(e.focus,"next");else{if(e!=null){const s=e.getNodes(),l=s[s.length-1];l&&(t=it(l,"next"))}t=t||vt(ct(),"previous").getFlipped().insert(H())}const r=yd(n,t),o=tn(r),i=Ot(o)?kt(o):r;return _c(hc(i)),n.getLatest()}function yd(n,e,t){let r=Se(e,"next");for(let o=r;o;o=Qf(o,t))r=o;return oe(r)&&Tc(283),r.insert(n.isInline()?H().append(n):n),Se(it(n.getLatest(),"next"),e.direction)}function ng(n,e){const t=e();return n.replace(t),t.append(n),t}function Te(n,e){return n!==null&&Object.getPrototypeOf(n).constructor.name===e.name}function rg(n,e){const t=[];for(let r=0;r<n.length;r++){const o=e(n[r]);o!==null&&t.push(o)}return t}function Sl(n){const e=M();if(!E(e))return!1;const t=new Set,r=e.getNodes();for(let o=0;o<r.length;o++){const i=r[o],s=i.getKey();if(t.has(s))continue;const l=B(i,c=>b(c)&&!c.isInline());if(l===null)continue;const a=l.getKey();l.canIndent()&&!t.has(a)&&(t.add(a),n(l))}return t.size>0}function Cd(n,e){vt(n,"next").insert(e)}let Ko=!(cd||!ad)&&void 0;function og(n,e=!1){let t=1;if(function(){if(Ko===void 0){const r=document.createElement("div");r.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(r);const o=r.getBoundingClientRect();r.style.setProperty("zoom","2"),Ko=r.getBoundingClientRect().width===o.width,document.body.removeChild(r)}return Ko}()||e)for(;n;)t*=Number(window.getComputedStyle(n).getPropertyValue("zoom")),n=n.parentElement;return t}function kc(n,e){return Ec(n,e,null)}function Ec(n,e,t){let r=!1;for(const o of Ac(n))e(o)?t!==null&&t(o):(r=!0,b(o)&&Ec(o,e,t||(i=>o.insertAfter(i))),o.remove());return r}function Oc(n,e){const t=[],r=Array.from(n).reverse();for(let o=r.pop();o!==void 0;o=r.pop())if(e(o))t.push(o);else if(b(o))for(const i of Ac(o))r.push(i);return t}function Ac(n){return Sd(vt(n,"previous"))}function Sd(n){return yo({hasNext:Fe,initial:n.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}const xd=Symbol.for("preact-signals");function Co(){if(Oe>1)return void Oe--;let n,e=!1;for(;Gn!==void 0;){let t=Gn;for(Gn=void 0,Si++;t!==void 0;){const r=t.o;if(t.o=void 0,t.f&=-3,!(8&t.f)&&Fc(t))try{t.c()}catch(o){e||(n=o,e=!0)}t=r}}if(Si=0,Oe--,e)throw n}function vd(n){if(Oe>0)return n();Oe++;try{return n()}finally{Co()}}let q,Gn;function xl(n){const e=q;q=void 0;try{return n()}finally{q=e}}let Oe=0,Si=0,Kr=0;function vl(n){if(q===void 0)return;let e=n.n;return e===void 0||e.t!==q?(e={i:0,S:n,p:q.s,n:void 0,t:q,e:void 0,x:void 0,r:e},q.s!==void 0&&(q.s.n=e),q.s=e,n.n=e,32&q.f&&n.S(e),e):e.i===-1?(e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=q.s,e.n=void 0,q.s.n=e,q.s=e),e):void 0}function Tt(n,e){this.v=n,this.i=0,this.n=void 0,this.t=void 0,this.W=e==null?void 0:e.watched,this.Z=e==null?void 0:e.unwatched,this.name=e==null?void 0:e.name}function Mc(n,e){return new Tt(n,e)}function Fc(n){for(let e=n.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function bl(n){for(let e=n.s;e!==void 0;e=e.n){const t=e.S.n;if(t!==void 0&&(e.r=t),e.S.n=e,e.i=-1,e.n===void 0){n.s=e;break}}}function $c(n){let e,t=n.s;for(;t!==void 0;){const r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):e=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}n.s=e}function cn(n,e){Tt.call(this,void 0),this.x=n,this.s=void 0,this.g=Kr-1,this.f=4,this.W=e==null?void 0:e.watched,this.Z=e==null?void 0:e.unwatched,this.name=e==null?void 0:e.name}function Pc(n){const e=n.u;if(n.u=void 0,typeof e=="function"){Oe++;const t=q;q=void 0;try{e()}catch(r){throw n.f&=-2,n.f|=8,ds(n),r}finally{q=t,Co()}}}function ds(n){for(let e=n.s;e!==void 0;e=e.n)e.S.U(e);n.x=void 0,n.s=void 0,Pc(n)}function bd(n){if(q!==this)throw new Error("Out-of-order effect");$c(this),q=n,this.f&=-2,8&this.f&&ds(this),Co()}function mn(n,e){this.x=n,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=e==null?void 0:e.name}function hs(n,e){const t=new mn(n,e);try{t.c()}catch(o){throw t.d(),o}const r=t.d.bind(t);return r[Symbol.dispose]=r,r}function Dc(n,e={}){const t={};for(const r in n){const o=e[r],i=Mc(o===void 0?n[r]:o);t[r]=i}return t}Tt.prototype.brand=xd,Tt.prototype.h=function(){return!0},Tt.prototype.S=function(n){const e=this.t;e!==n&&n.e===void 0&&(n.x=e,this.t=n,e!==void 0?e.e=n:xl(()=>{var t;(t=this.W)==null||t.call(this)}))},Tt.prototype.U=function(n){if(this.t!==void 0){const e=n.e,t=n.x;e!==void 0&&(e.x=t,n.e=void 0),t!==void 0&&(t.e=e,n.x=void 0),n===this.t&&(this.t=t,t===void 0&&xl(()=>{var r;(r=this.Z)==null||r.call(this)}))}},Tt.prototype.subscribe=function(n){return hs(()=>{const e=this.value,t=q;q=void 0;try{n(e)}finally{q=t}},{name:"sub"})},Tt.prototype.valueOf=function(){return this.value},Tt.prototype.toString=function(){return this.value+""},Tt.prototype.toJSON=function(){return this.value},Tt.prototype.peek=function(){const n=q;q=void 0;try{return this.value}finally{q=n}},Object.defineProperty(Tt.prototype,"value",{get(){const n=vl(this);return n!==void 0&&(n.i=this.i),this.v},set(n){if(n!==this.v){if(Si>100)throw new Error("Cycle detected");this.v=n,this.i++,Kr++,Oe++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Co()}}}}),cn.prototype=new Tt,cn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Kr))return!0;if(this.g=Kr,this.f|=1,this.i>0&&!Fc(this))return this.f&=-2,!0;const n=q;try{bl(this),q=this;const e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return q=n,$c(this),this.f&=-2,!0},cn.prototype.S=function(n){if(this.t===void 0){this.f|=36;for(let e=this.s;e!==void 0;e=e.n)e.S.S(e)}Tt.prototype.S.call(this,n)},cn.prototype.U=function(n){if(this.t!==void 0&&(Tt.prototype.U.call(this,n),this.t===void 0)){this.f&=-33;for(let e=this.s;e!==void 0;e=e.n)e.S.U(e)}},cn.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let n=this.t;n!==void 0;n=n.x)n.t.N()}},Object.defineProperty(cn.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const n=vl(this);if(this.h(),n!==void 0&&(n.i=this.i),16&this.f)throw this.v;return this.v}}),mn.prototype.c=function(){const n=this.S();try{if(8&this.f||this.x===void 0)return;const e=this.x();typeof e=="function"&&(this.u=e)}finally{n()}},mn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Pc(this),bl(this),Oe++;const n=q;return q=this,bd.bind(this,n)},mn.prototype.N=function(){2&this.f||(this.f|=2,this.o=Gn,Gn=this)},mn.prototype.d=function(){this.f|=8,1&this.f||ds(this)},mn.prototype.dispose=function(){this.d()};function wd(n){return(typeof n.nodes=="function"?n.nodes():n.nodes)||[]}Pu("format",{parse:n=>typeof n=="number"?n:0});function Q(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Rc(n,e){if(n&&e&&!Array.isArray(e)&&typeof n=="object"&&typeof e=="object"){const t=n,r=e;for(const o in r)t[o]=Rc(t[o],r[o]);return n}return e}const gs=0,xi=1,Lc=2,Io=3,wr=4,un=5,zo=6,zn=7;function Wo(n){return n.id===gs}function Kc(n){return n.id===Lc}function Nd(n){return function(e){return e.id===xi}(n)||Q(305,String(n.id),String(xi)),Object.assign(n,{id:Lc})}const Td=new Set;let kd=class{constructor(e,t){x(this,"builder");x(this,"configs");x(this,"_dependency");x(this,"_peerNameSet");x(this,"extension");x(this,"state");x(this,"_signal");this.builder=e,this.extension=t,this.configs=new Set,this.state={id:gs}}mergeConfigs(){let e=this.extension.config||{};const t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):td;for(const r of this.configs)e=t(e,r);return e}init(e){const t=this.state;Kc(t)||Q(306,String(t.id));const r={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},o={...r,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=function(l,a,c){return Object.assign(l,{config:a,id:Io,registerState:c})}(t,this.mergeConfigs(),r);let s;this.state=i,this.extension.init&&(s=this.extension.init(e,i.config,r)),this.state=function(l,a,c){return Object.assign(l,{id:wr,initResult:a,registerState:c})}(i,s,o)}build(e){const t=this.state;let r;t.id!==wr&&Q(307,String(t.id),String(un)),this.extension.build&&(r=this.extension.build(e,t.config,t.registerState));const o={...t.registerState,getOutput:()=>r,getSignal:this.getSignal.bind(this)};this.state=function(i,s,l){return Object.assign(i,{id:un,output:s,registerState:l})}(t,r,o)}register(e,t){this._signal=t;const r=this.state;r.id!==un&&Q(308,String(r.id),String(un));const o=this.extension.register&&this.extension.register(e,r.config,r.registerState);return this.state=function(i){return Object.assign(i,{id:zo})}(r),()=>{const i=this.state;i.id!==zn&&Q(309,String(r.id),String(zn)),this.state=function(s){return Object.assign(s,{id:un})}(i),o&&o()}}afterRegistration(e){const t=this.state;let r;return t.id!==zo&&Q(310,String(t.id),String(zo)),this.extension.afterRegistration&&(r=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(o){return Object.assign(o,{id:zn})}(t),r}getSignal(){return this._signal===void 0&&Q(311),this._signal}getInitResult(){this.extension.init===void 0&&Q(312,this.extension.name);const e=this.state;return function(t){return t.id>=wr}(e)||Q(313,String(e.id),String(wr)),e.initResult}getInitPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){const e=this.state;return function(t){return t.id>=Io}(e)||Q(314,String(e.id),String(Io)),{config:e.config}}getPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){const t=this.builder.getExtensionRep(e);return t===void 0&&Q(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){const t=this.builder.getExtensionRep(e);return t===void 0&&Q(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){const e=this.state;return function(t){return t.id>=zn}(e)||Q(316,String(e.id),String(zn)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Td}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([t])=>t)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){const e=this.state;(function(t){return t.id>=un})(e)||Q(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}};const wl={tag:Vn};function Ed(){const n=ct();n.isEmpty()&&n.append(H())}const Od={config:{setOptions:wl,updateOptions:wl},init:({$initialEditorState:n=Ed})=>({$initialEditorState:n,initialized:!1}),afterRegistration(n,{updateOptions:e,setOptions:t},r){const o=r.getInitResult();if(!o.initialized){o.initialized=!0;const{$initialEditorState:i}=o;if(bf(i))n.setEditorState(i,t);else if(typeof i=="function")n.update(()=>{i(n)},e);else if(i&&(typeof i=="string"||typeof i=="object")){const s=n.parseEditorState(i);n.setEditorState(s,t)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[$n,xe,On,An,Pn]},Nl=Symbol.for("@lexical/extension/LexicalBuilder");function Tl(){}function Ad(n){throw n}function Nr(n){return Array.isArray(n)?n:[n]}const Bo="0.42.0+prod.esm";let Md=class Ir{constructor(e){x(this,"roots");x(this,"extensionNameMap");x(this,"outgoingConfigEdges");x(this,"incomingEdges");x(this,"conflicts");x(this,"_sortedExtensionReps");x(this,"PACKAGE_VERSION");this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=Bo,this.roots=e;for(const t of e)this.addExtension(t)}static fromExtensions(e){const t=[Nr(Od)];for(const r of e)t.push(Nr(r));return new Ir(t)}static maybeFromEditor(e){const t=e[Nl];return t&&(t.PACKAGE_VERSION!==Bo&&Q(292,t.PACKAGE_VERSION,Bo),t instanceof Ir||Q(293)),t}static fromEditor(e){const t=Ir.maybeFromEditor(e);return t===void 0&&Q(294),t}constructEditor(){const{$initialEditorState:e,onError:t,...r}=this.buildCreateEditorArgs(),o=Object.assign(Ga({...r,...t?{onError:i=>{t(i,o)}}:{}}),{[Nl]:this});for(const i of this.sortedExtensionReps())i.build(o);return o}buildEditor(){let e=Tl;function t(){try{e()}finally{e=Tl}}const r=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=De(this.registerEditor(r),()=>r.setRootElement(null)),r}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){const t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&Q(295,e.name),t}addEdge(e,t,r){const o=this.outgoingConfigEdges.get(e);o?o.set(t,r):this.outgoingConfigEdges.set(e,new Map([[t,r]]));const i=this.incomingEdges.get(t);i?i.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){this._sortedExtensionReps!==void 0&&Q(296);const t=Nr(e),[r]=t;typeof r.name!="string"&&Q(297,typeof r.name);let o=this.extensionNameMap.get(r.name);if(o!==void 0&&o.extension!==r&&Q(298,r.name),!o){o=new kd(this,r),this.extensionNameMap.set(r.name,o);const i=this.conflicts.get(r.name);typeof i=="string"&&Q(299,r.name,i);for(const s of r.conflictsWith||[])this.extensionNameMap.has(s)&&Q(299,r.name,s),this.conflicts.set(s,r.name);for(const s of r.dependencies||[]){const l=Nr(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 e=[],t=(r,o)=>{let i=r.state;if(Kc(i))return;const s=r.extension.name;var l;Wo(i)||Q(300,s,o||"[unknown]"),Wo(l=i)||Q(304,String(l.id),String(gs)),i=Object.assign(l,{id:xi}),r.state=i;const a=this.outgoingConfigEdges.get(s);if(a)for(const c of a.keys()){const u=this.extensionNameMap.get(c);u&&t(u,s)}i=Nd(i),r.state=i,e.push(r)};for(const r of this.extensionNameMap.values())Wo(r.state)&&t(r);for(const r of e)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&&Q(301,r.name);for(const s of o)i.configs.add(s)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){const t=this.sortedExtensionReps(),r=new AbortController,o=[()=>r.abort()],i=r.signal;for(const s of t){const l=s.register(e,i);l&&o.push(l)}for(const s of t){const l=s.afterRegistration(e);l&&o.push(l)}return De(...o)}buildCreateEditorArgs(){const e={},t=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&&(e.onError=f.onError),f.disableEvents!==void 0&&(e.disableEvents=f.disableEvents),f.parentEditor!==void 0&&(e.parentEditor=f.parentEditor),f.editable!==void 0&&(e.editable=f.editable),f.namespace!==void 0&&(e.namespace=f.namespace),f.$initialEditorState!==void 0&&(e.$initialEditorState=f.$initialEditorState),f.nodes)for(const d of wd(f)){if(typeof d!="function"){const g=r.get(d.replace);g&&Q(302,f.name,d.replace.name,g.extension.name),r.set(d.replace,u)}t.add(d)}if(f.html){if(f.html.export)for(const[d,g]of f.html.export.entries())o.set(d,g);f.html.import&&Object.assign(i,f.html.import)}f.theme&&Rc(s,f.theme)}Object.keys(s).length>0&&(e.theme=s),t.size&&(e.nodes=[...t]);const a=Object.keys(i).length>0,c=o.size>0;(a||c)&&(e.html={},a&&(e.html.import=i),c&&(e.html.export=o));for(const u of l)u.init(e);return e.onError||(e.onError=Ad),e}};function Fd(n,e){const t=Md.fromEditor(n).extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}function $d(n,e,t,r,o){if(n===null||t.size===0&&r.size===0&&!o)return 0;const i=e._selection,s=n._selection;if(o)return 1;if(!(E(i)&&E(s)&&s.isCollapsed()&&i.isCollapsed()))return 0;const l=function(m,y,C){const v=m._nodeMap,N=[];for(const S of y){const T=v.get(S);T!==void 0&&N.push(T)}for(const[S,T]of C){if(!T)continue;const k=v.get(S);k===void 0||at(k)||N.push(k)}return N}(e,t,r);if(l.length===0)return 0;if(l.length>1){const m=e._nodeMap,y=m.get(i.anchor.key),C=m.get(s.anchor.key);return y&&C&&!n._nodeMap.has(y.__key)&&F(y)&&y.__text.length===1&&i.anchor.offset===1?2:0}const a=l[0],c=n._nodeMap.get(a.__key);if(!F(c)||!F(a)||c.__mode!==a.__mode)return 0;const u=c.__text,f=a.__text;if(u===f)return 0;const d=i.anchor,g=s.anchor;if(d.key!==g.key||d.type!=="text")return 0;const h=d.offset,p=g.offset,_=f.length-u.length;return _===1&&p===h-1?2:_===-1&&p===h+1?3:_===-1&&p===h?4:0}function Pd(n,e,t){let r=t(),o=0,i=r,s=0,l=null;return(a,c,u,f,d,g)=>{const h=t();if(g.has(Da)&&(i=r,s=o,l=a),g.has(ui))return o=0,r=h,2;g.has(Ra)&&l&&(r=i,o=s,a=l);const p=$d(a,c,f,d,n.isComposing()),_=(()=>{const m=u===null||u.editor===n,y=g.has(rf);if(!y&&m&&g.has(Vn))return 0;if(p===1)return 2;if(a===null)return 1;const C=c._selection;if(!(f.size>0||d.size>0))return C!==null?0:2;const v=typeof e=="number"?e:e.peek();return y===!1&&p!==0&&p===o&&h<r+v&&m||f.size===1&&function(N,S,T){const k=S._nodeMap.get(N),w=T._nodeMap.get(N),A=S._selection,$=T._selection;return!(E(A)&&E($)&&A.anchor.type==="element"&&A.focus.type==="element"&&$.anchor.type==="text"&&$.focus.type==="text"||!F(k)||!F(w)||k.__parent!==w.__parent)&&JSON.stringify(S.read(()=>k.exportJSON()))===JSON.stringify(T.read(()=>w.exportJSON()))}(Array.from(f)[0],a,c)?0:1})();return r=h,o=p,_}}function kl(n){n.undoStack=[],n.redoStack=[],n.current=null}function Dd(n,e,t,r=Date.now){const o=Pd(n,t,r);return De(n.registerCommand(Li,()=>(function(i,s){const l=s.redoStack,a=s.undoStack;if(a.length!==0){const c=s.current,u=a.pop();c!==null&&(l.push(c),i.dispatchCommand(yr,!0)),a.length===0&&i.dispatchCommand(Cr,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:ui})}}(n,e),!0),W),n.registerCommand(Ki,()=>(function(i,s){const l=s.redoStack,a=s.undoStack;if(l.length!==0){const c=s.current;c!==null&&(a.push(c),i.dispatchCommand(Cr,!0));const u=l.pop();l.length===0&&i.dispatchCommand(yr,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:ui})}}(n,e),!0),W),n.registerCommand(Vu,()=>(kl(e),!1),W),n.registerCommand(Yu,()=>(kl(e),n.dispatchCommand(yr,!1),n.dispatchCommand(Cr,!1),!0),W),n.registerUpdateListener(({editorState:i,prevEditorState:s,dirtyLeaves:l,dirtyElements:a,tags:c})=>{const u=e.current,f=e.redoStack,d=e.undoStack,g=u===null?null:u.editorState;if(u!==null&&i===g)return;const h=o(s,i,u,l,a,c);if(h===1)f.length!==0&&(e.redoStack=[],n.dispatchCommand(yr,!1)),u!==null&&(d.push({...u}),n.dispatchCommand(Cr,!0));else if(h===2)return;e.current={editor:n,editorState:i}}))}function Rd(){return{current:null,redoStack:[],undoStack:[]}}const Jo={build:(n,{delay:e,createInitialHistoryState:t,disabled:r,now:o})=>Dc({delay:e,disabled:r,historyState:t(n),now:o}),config:{createInitialHistoryState:Rd,delay:300,disabled:typeof window>"u",now:Date.now},name:"@lexical/history/History",register:(n,e,t)=>{const r=t.getOutput();return hs(()=>r.disabled.value?void 0:Dd(n,r.historyState.value,r.delay,()=>r.now.peek()()))}};Zf(Jo,{disabled:!0});function Ld(n,e){const t=ec(e)?e.body.childNodes:e.childNodes;let r=[];const o=[];for(const i of t)if(!zc.has(i.nodeName)){const s=Wc(i,n,o,!1);s!==null&&(r=r.concat(s))}return function(i){for(const s of i)s.getNextSibling()instanceof Xi&&s.insertAfter(Ce());for(const s of i){const l=s.getChildren();for(const a of l)s.insertBefore(a);s.remove()}}(o),r}function Kd(n,e){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),r=ct().getChildren();for(let o=0;o<r.length;o++)Ic(n,r[o],t,e);return t.innerHTML}function Ic(n,e,t,r=null){let o=r===null||e.isSelected(r);const i=b(e)&&e.excludeFromCopy("html");let s=e;r!==null&&F(e)&&(s=vc(r,e,"clone"));const l=b(s)?s.getChildren():[],a=Qi(n,s.getType());let c;c=a&&a.exportDOM!==void 0?a.exportDOM(n,s):s.exportDOM(n);const{element:u,after:f}=c;if(!u)return!1;const d=document.createDocumentFragment();for(let g=0;g<l.length;g++){const h=l[g],p=Ic(n,h,d,r);!o&&b(e)&&p&&e.extractWithChild(h,r,"html")&&(o=!0)}if(o&&!i){if((nt(u)||mi(u))&&u.append(d),t.append(u),f){const g=f.call(s,u);g&&(mi(u)?u.replaceChildren(g):u.replaceWith(g))}}else t.append(d);return o}const zc=new Set(["STYLE","SCRIPT"]);function Wc(n,e,t,r,o=new Map,i){let s=[];if(zc.has(n.nodeName))return s;let l=null;const a=function(h,p){const{nodeName:_}=h,m=p._htmlConversions.get(_.toLowerCase());let y=null;if(m!==void 0)for(const C of m){const v=C(h);v!==null&&(y===null||(y.priority||0)<=(v.priority||0))&&(y=v)}return y!==null?y.conversion:null}(n,e),c=a?a(n):null;let u=null;if(c!==null){u=c.after;const h=c.node;if(l=Array.isArray(h)?h[h.length-1]:h,l!==null){for(const[,p]of o)if(l=p(l,i),!l)break;l&&s.push(...Array.isArray(h)?h:[l])}c.forChild!=null&&o.set(n.nodeName,c.forChild)}const f=n.childNodes;let d=[];const g=(l==null||!Et(l))&&(l!=null&&di(l)||r);for(let h=0;h<f.length;h++)d.push(...Wc(f[h],e,t,g,new Map(o),l));return u!=null&&(d=u(d)),to(n)&&(d=Id(n,d,g?()=>{const h=new Xi;return t.push(h),h}:H)),l==null?d.length>0?s=s.concat(d):to(n)&&function(h){return h.nextSibling==null||h.previousSibling==null?!1:yi(h.nextSibling)&&yi(h.previousSibling)}(n)&&(s=s.concat(Ce())):b(l)&&l.append(...d),s}function Id(n,e,t){const r=n.style.textAlign,o=[];let i=[];for(let s=0;s<e.length;s++){const l=e[s];if(di(l))r&&!l.getFormat()&&l.setFormat(r),o.push(l);else if(i.push(l),s===e.length-1||s<e.length-1&&di(e[s+1])){const a=t();a.setFormat(r),a.append(...i),o.push(a),i=[]}}return o}function eo(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function zd(n,e=M()){return e==null&&eo(166),E(e)&&e.isCollapsed()||e.getNodes().length===0?"":Kd(n,e)}function Wd(n,e=M()){return e==null&&eo(166),E(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(Bd(n,e))}function El(n,e,t){const r=n.getData("application/x-lexical-editor");if(r)try{const l=JSON.parse(r);if(l.namespace===t._config.namespace&&Array.isArray(l.nodes))return Ol(t,Jd(l.nodes),e)}catch(l){console.error(l)}const o=n.getData("text/html"),i=n.getData("text/plain");if(o&&i!==o)try{const l=new DOMParser().parseFromString(function(a){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:c=>c}).createHTML(a):a}(o),"text/html");return Ol(t,Ld(t,l),e)}catch(l){console.error(l)}const s=i||n.getData("text/uri-list");if(s!=null)if(E(e)){const l=s.split(/(\r?\n|\t)/);l[l.length-1]===""&&l.pop();for(let a=0;a<l.length;a++){const c=M();if(E(c)){const u=l[a];u===`
12
+ `||u===`\r
13
+ `?c.insertParagraph():u===" "?c.insertNodes([Mn()]):c.insertText(u)}}}else e.insertRawText(s)}function Ol(n,e,t){n.dispatchCommand(ga,{nodes:e,selection:t})||(t.insertNodes(e),function(r){if(E(r)&&r.isCollapsed()){const o=r.anchor;let i=null;const s=Xt(o,"previous");if(s)if(oe(s))i=s.origin;else{const l=$e(s,vt(ct(),"next").getFlipped());for(const a of l){if(F(a.origin)){i=a.origin;break}if(b(a.origin)&&!a.origin.isInline())break}}if(i&&F(i)){const l=i.getFormat(),a=i.getStyle();r.format===l&&r.style===a||(r.format=l,r.style=a,r.dirty=!0)}}}(t))}function Bc(n,e,t,r=[]){let o=e===null||t.isSelected(e);const i=b(t)&&t.excludeFromCopy("html");let s=t;e!==null&&F(s)&&(s=vc(e,s,"clone"));const l=b(s)?s.getChildren():[],a=function(c){const u=c.exportJSON(),f=c.constructor;if(u.type!==f.getType()&&eo(58,f.name),b(c)){const d=u.children;Array.isArray(d)||eo(59,f.name)}return u}(s);F(s)&&s.getTextContentSize()===0&&(o=!1);for(let c=0;c<l.length;c++){const u=l[c],f=Bc(n,e,u,a.children);!o&&b(t)&&f&&t.extractWithChild(u,e,"clone")&&(o=!0)}if(o&&!i)r.push(a);else if(Array.isArray(a.children))for(let c=0;c<a.children.length;c++){const u=a.children[c];r.push(u)}return o}function Bd(n,e){const t=[],r=ct().getChildren();for(let o=0;o<r.length;o++)Bc(n,e,r[o],t);return{namespace:n._config.namespace,nodes:t}}function Jd(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t],o=vf(r);F(o)&&nd(o),e.push(o)}return e}let fn=null;async function vi(n,e,t){if(fn!==null)return!1;if(e!==null)return new Promise((c,u)=>{n.update(()=>{c(Al(n,e,t))})});const r=n.getRootElement(),o=n._window||window,i=o.document,s=wt(o);if(r===null||s===null)return!1;const l=i.createElement("span");l.style.cssText="position: fixed; top: -1000px;",l.append(i.createTextNode("#")),r.append(l);const a=new Range;return a.setStart(l,0),a.setEnd(l,1),s.removeAllRanges(),s.addRange(a),new Promise((c,u)=>{const f=n.registerCommand(ao,d=>(Te(d,ClipboardEvent)&&(f(),fn!==null&&(o.clearTimeout(fn),fn=null),c(Al(n,d,t))),!0),Nf);fn=o.setTimeout(()=>{f(),fn=null,c(!1)},50),i.execCommand("copy"),l.remove()})}function Al(n,e,t){if(t===void 0){const o=wt(n._window),i=M();if(!i||i.isCollapsed()||!o)return!1;const s=o.anchorNode,l=o.focusNode;if(s!==null&&l!==null&&!dr(n,s,l))return!1;t=Hc(i)}e.preventDefault();const r=e.clipboardData;return r!==null&&(Hd(r,t),!0)}const Jc=[["text/html",zd],["application/x-lexical-editor",Wd]];function Hc(n=M()){const e={"text/plain":n?n.getTextContent():""};if(n){const t=Dn();for(const[r,o]of Jc){const i=o(t,n);i!==null&&(e[r]=i)}}return e}function Hd(n,e){for(const[t]of Jc)e[t]===void 0&&n.setData(t,"");for(const t in e){const r=e[t];r!==void 0&&n.setData(t,r)}}const ps=/^(\d+(?:\.\d+)?)px$/,lt={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class ln extends At{constructor(t=lt.NO_STATUS,r=1,o,i){super(i);x(this,"__colSpan");x(this,"__rowSpan");x(this,"__headerState");x(this,"__width");x(this,"__backgroundColor");x(this,"__verticalAlign");this.__colSpan=r,this.__rowSpan=1,this.__headerState=t,this.__width=o,this.__backgroundColor=null,this.__verticalAlign=void 0}static getType(){return"tablecell"}static clone(t){return new ln(t.__headerState,t.__colSpan,t.__width,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__rowSpan=t.__rowSpan,this.__backgroundColor=t.__backgroundColor,this.__verticalAlign=t.__verticalAlign,this.__colSpan=t.__colSpan,this.__headerState=t.__headerState,this.__width=t.__width}static importDOM(){return{td:t=>({conversion:Ml,priority:0}),th:t=>({conversion:Ml,priority:0})}}static importJSON(t){return qt().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setHeaderStyles(t.headerState).setColSpan(t.colSpan||1).setRowSpan(t.rowSpan||1).setWidth(t.width||void 0).setBackgroundColor(t.backgroundColor||null).setVerticalAlign(t.verticalAlign||void 0)}createDOM(t){const r=document.createElement(this.getTag());return this.__width&&(r.style.width=`${this.__width}px`),this.__colSpan>1&&(r.colSpan=this.__colSpan),this.__rowSpan>1&&(r.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(r.style.backgroundColor=this.__backgroundColor),bi(this.__verticalAlign)&&(r.style.verticalAlign=this.__verticalAlign),pt(r,t.theme.tableCell,this.hasHeader()&&t.theme.tableCellHeader),r}exportDOM(t){const r=super.exportDOM(t);if(nt(r.element)){const o=r.element;o.setAttribute("data-temporary-table-cell-lexical-key",this.getKey()),o.style.border="1px solid black",this.__colSpan>1&&(o.colSpan=this.__colSpan),this.__rowSpan>1&&(o.rowSpan=this.__rowSpan),o.style.width=`${this.getWidth()||75}px`,o.style.verticalAlign=this.getVerticalAlign()||"top",o.style.textAlign="start",this.__backgroundColor===null&&this.hasHeader()&&(o.style.backgroundColor="#f2f3f5")}return r}exportJSON(){return{...super.exportJSON(),...bi(this.__verticalAlign)&&{verticalAlign:this.__verticalAlign},backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,width:this.getWidth()}}getColSpan(){return this.getLatest().__colSpan}setColSpan(t){const r=this.getWritable();return r.__colSpan=t,r}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(t){const r=this.getWritable();return r.__rowSpan=t,r}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(t,r=lt.BOTH){const o=this.getWritable();return o.__headerState=t&r|o.__headerState&~r,o}getHeaderStyles(){return this.getLatest().__headerState}setWidth(t){const r=this.getWritable();return r.__width=t,r}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(t){const r=this.getWritable();return r.__backgroundColor=t,r}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(t){const r=this.getWritable();return r.__verticalAlign=t||void 0,r}toggleHeaderStyle(t){const r=this.getWritable();return(r.__headerState&t)===t?r.__headerState-=t:r.__headerState+=t,r}hasHeaderState(t){return(this.getHeaderStyles()&t)===t}hasHeader(){return this.getLatest().__headerState!==lt.NO_STATUS}updateDOM(t){return t.__headerState!==this.__headerState||t.__width!==this.__width||t.__colSpan!==this.__colSpan||t.__rowSpan!==this.__rowSpan||t.__backgroundColor!==this.__backgroundColor||t.__verticalAlign!==this.__verticalAlign}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function bi(n){return n==="middle"||n==="bottom"}function Ml(n){const e=n,t=n.nodeName.toLowerCase();let r;ps.test(e.style.width)&&(r=parseFloat(e.style.width));let o=lt.NO_STATUS;t==="th"&&(o=e.getAttribute("scope")==="col"?lt.COLUMN:lt.ROW);const i=qt(o,e.colSpan,r);i.__rowSpan=e.rowSpan;const s=e.style.backgroundColor;s!==""&&(i.__backgroundColor=s);const l=e.style.verticalAlign;bi(l)&&(i.__verticalAlign=l);const a=e.style,c=(a&&a.textDecoration||"").split(" "),u=a.fontWeight==="700"||a.fontWeight==="bold",f=c.includes("line-through"),d=a.fontStyle==="italic",g=c.includes("underline");return{after:h=>{const p=[];let _=null;const m=()=>{if(_){const y=_.getFirstChild();Jt(y)&&_.getChildrenSize()===1&&y.remove()}};for(const y of h)$f(y)||F(y)||Jt(y)?(F(y)&&(u&&y.toggleFormat("bold"),f&&y.toggleFormat("strikethrough"),d&&y.toggleFormat("italic"),g&&y.toggleFormat("underline")),_?_.append(y):(_=H().append(y),p.push(_))):(p.push(y),m(),_=null);return m(),p.length===0&&p.push(H()),p},node:i}}function qt(n=lt.NO_STATUS,e=1,t){return Ht(new ln(n,e,t))}function L(n){return n instanceof ln}const Ud=R("INSERT_TABLE_COMMAND");function D(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}class _r extends At{constructor(t,r){super(r);x(this,"__height");this.__height=t}static getType(){return"tablerow"}static clone(t){return new _r(t.__height,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__height=t.__height}static importDOM(){return{tr:t=>({conversion:jd,priority:0})}}static importJSON(t){return ir().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setHeight(t.height)}exportJSON(){const t=this.getHeight();return{...super.exportJSON(),...t===void 0?void 0:{height:t}}}createDOM(t){const r=document.createElement("tr");return this.__height&&(r.style.height=`${this.__height}px`),pt(r,t.theme.tableRow),r}extractWithChild(t,r,o){return o==="html"}isShadowRoot(){return!0}setHeight(t){const r=this.getWritable();return r.__height=t,r}getHeight(){return this.getLatest().__height}updateDOM(t){return t.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function jd(n){const e=n;let t;return ps.test(e.style.height)&&(t=parseFloat(e.style.height)),{after:r=>Oc(r,L),node:ir(t)}}function ir(n){return Ht(new _r(n))}function rt(n){return n instanceof _r}const _s=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Vd=_s&&"documentMode"in document?document.documentMode:null,Fl=_s&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);function Yd(n,e,t=!0){const r=ys();for(let o=0;o<n;o++){const i=ir();for(let s=0;s<e;s++){let l=lt.NO_STATUS;typeof t=="object"?(o===0&&t.rows&&(l|=lt.ROW),s===0&&t.columns&&(l|=lt.COLUMN)):t&&(o===0&&(l|=lt.ROW),s===0&&(l|=lt.COLUMN));const a=qt(l),c=H();c.append(st()),a.append(c),i.append(a)}r.append(i)}return r}function sg(n){const e=B(n,t=>L(t));return L(e)?e:null}function Uc(n){const e=B(n,t=>rt(t));if(rt(e))return e;throw new Error("Expected table cell to be inside of table row.")}function jc(n){const e=B(n,t=>ot(t));if(ot(e))return e;throw new Error("Expected table cell to be inside of table.")}function lg(n){const e=Uc(n);return jc(e).getChildren().findIndex(t=>t.is(e))}function ag(n){return Uc(n).getChildren().findIndex(e=>e.is(n))}_s&&"InputEvent"in window&&!Vd&&new window.InputEvent("input");const wi=(n,e)=>n===lt.BOTH||n===e?e:lt.NO_STATUS;function cg(n=!0){const e=M();E(e)||j(e)||D(188);const t=e.anchor.getNode(),r=e.focus.getNode(),[o]=_t(t),[i,,s]=_t(r),[,l,a]=bt(s,i,o),{startRow:c}=a,{startRow:u}=l;return n?Ni(c+o.__rowSpan>u+i.__rowSpan?o:i,!0):Ni(u<c?i:o,!1)}function Ni(n,e=!0){const[,,t]=_t(n),[r,o]=bt(t,n,n),i=r[0].length,{startRow:s}=o;let l=null;if(e){const a=s+n.__rowSpan-1,c=r[a],u=ir();for(let d=0;d<i;d++){const{cell:g,startRow:h}=c[d];if(h+g.__rowSpan-1<=a){const p=c[d].cell.__headerState,_=wi(p,lt.COLUMN);u.append(qt(_).append(H()))}else g.setRowSpan(g.__rowSpan+1)}const f=t.getChildAtIndex(a);rt(f)||D(256),f.insertAfter(u),l=u}else{const a=s,c=r[a],u=ir();for(let d=0;d<i;d++){const{cell:g,startRow:h}=c[d];if(h===a){const p=c[d].cell.__headerState,_=wi(p,lt.COLUMN);u.append(qt(_).append(H()))}else g.setRowSpan(g.__rowSpan+1)}const f=t.getChildAtIndex(a);rt(f)||D(257),f.insertBefore(u),l=u}return l}function ug(n=!0){const e=M();E(e)||j(e)||D(188);const t=e.anchor.getNode(),r=e.focus.getNode(),[o]=_t(t),[i,,s]=_t(r),[,l,a]=bt(s,i,o),{startColumn:c}=a,{startColumn:u}=l;return n?Ti(c+o.__colSpan>u+i.__colSpan?o:i,!0):Ti(u<c?i:o,!1)}function Ti(n,e=!0,t=!0){const[,,r]=_t(n),[o,i]=bt(r,n,n),s=o.length,{startColumn:l}=i,a=e?l+n.__colSpan-1:l-1,c=r.getFirstChild();rt(c)||D(120);let u=null;function f(h=lt.NO_STATUS){const p=qt(h).append(H());return u===null&&(u=p),p}let d=c;t:for(let h=0;h<s;h++){if(h!==0){const N=d.getNextSibling();rt(N)||D(121),d=N}const p=o[h],_=p[a<0?0:a].cell.__headerState,m=wi(_,lt.ROW);if(a<0){ms(d,f(m));continue}const{cell:y,startColumn:C,startRow:v}=p[a];if(C+y.__colSpan-1<=a){let N=y,S=v,T=a;for(;S!==h&&N.__rowSpan>1;){if(T-=y.__colSpan,!(T>=0)){d.append(f(m));continue t}{const{cell:k,startRow:w}=p[T];N=k,S=w}}N.insertAfter(f(m))}else y.setColSpan(y.__colSpan+1)}u!==null&&t&&sr(u);const g=r.getColWidths();if(g){const h=[...g],p=a<0?0:a,_=h[p];h.splice(p,0,_),r.setColWidths(h)}return u}function fg(){const n=M();E(n)||j(n)||D(188);const[e,t]=n.isBackward()?[n.focus.getNode(),n.anchor.getNode()]:[n.anchor.getNode(),n.focus.getNode()],[r,,o]=_t(e),[i]=_t(t),[s,l,a]=bt(o,r,i),{startRow:c}=l,{startRow:u}=a,f=u+i.__rowSpan-1;if(s.length===f-c+1)return void o.remove();const d=s[0].length,g=s[f+1],h=o.getChildAtIndex(f+1);for(let p=f;p>=c;p--){for(let m=d-1;m>=0;m--){const{cell:y,startRow:C,startColumn:v}=s[p][m];if(v===m){if(C<c||C+y.__rowSpan-1>f){const N=Math.max(C,c),S=Math.min(y.__rowSpan+C-1,f),T=N<=S?S-N+1:0;y.setRowSpan(y.__rowSpan-T)}if(C>=c&&C+y.__rowSpan-1>f&&p===f){h===null&&D(122);let N=null;for(let S=0;S<m;S++){const T=g[S],k=T.cell;T.startRow===p+1&&(N=k),k.__colSpan>1&&(S+=k.__colSpan-1)}N===null?ms(h,y):N.insertAfter(y)}}}const _=o.getChildAtIndex(p);rt(_)||D(206,String(p)),_.remove()}if(g!==void 0){const{cell:p}=g[0];sr(p)}else{const p=s[c-1],{cell:_}=p[0];sr(_)}}function dg(){const n=M();E(n)||j(n)||D(188);const e=n.anchor.getNode(),t=n.focus.getNode(),[r,,o]=_t(e),[i]=_t(t),[s,l,a]=bt(o,r,i),{startColumn:c}=l,{startRow:u,startColumn:f}=a,d=Math.min(c,f),g=Math.max(c+r.__colSpan-1,f+i.__colSpan-1),h=g-d+1;if(s[0].length===g-d+1)return o.selectPrevious(),void o.remove();const p=s.length;for(let C=0;C<p;C++)for(let v=d;v<=g;v++){const{cell:N,startColumn:S}=s[C][v];if(S<d){if(v===d){const T=d-S;N.setColSpan(N.__colSpan-Math.min(h,N.__colSpan-T))}}else if(S+N.__colSpan-1>g){if(v===g){const T=g-S+1;N.setColSpan(N.__colSpan-T)}}else N.remove()}const _=s[u],m=c>f?_[c+r.__colSpan]:_[f+i.__colSpan];if(m!==void 0){const{cell:C}=m;sr(C)}else{const C=f<c?_[f-1]:_[c-1],{cell:v}=C;sr(v)}const y=o.getColWidths();if(y){const C=[...y];C.splice(d,h),o.setColWidths(C)}}function sr(n){const e=n.getFirstDescendant();e==null?n.selectStart():e.getParentOrThrow().selectStart()}function ms(n,e){const t=n.getFirstChild();t!==null?t.insertBefore(e):n.append(e)}function qd(n){if(n.length===0)return null;const e=jc(n[0]),[t]=me(e,null,null);let r=1/0,o=-1/0,i=1/0,s=-1/0;const l=new Set;for(const g of t)for(const h of g){if(!h||!h.cell)continue;const p=h.cell.getKey();if(!l.has(p)&&n.some(_=>_.is(h.cell))){l.add(p);const _=h.startRow,m=h.startColumn,y=h.cell.__rowSpan||1,C=h.cell.__colSpan||1;r=Math.min(r,_),o=Math.max(o,_+y-1),i=Math.min(i,m),s=Math.max(s,m+C-1)}}if(r===1/0||i===1/0)return null;const a=o-r+1,c=s-i+1,u=t[r][i];if(!u.cell)return null;const f=u.cell;f.setColSpan(c),f.setRowSpan(a);const d=new Set([f.getKey()]);for(let g=r;g<=o;g++)for(let h=i;h<=s;h++){const p=t[g][h];if(!p.cell)continue;const _=p.cell,m=_.getKey();d.has(m)||(d.add(m),Xd(_)||f.append(..._.getChildren()),_.remove())}return f.getChildrenSize()===0&&f.append(H()),f}function Xd(n){if(n.getChildrenSize()!==1)return!1;const e=n.getFirstChildOrThrow();return!(!fr(e)||!e.isEmpty())}function hg(){const n=M();E(n)||j(n)||D(188);const e=n.anchor.getNode(),t=B(e,L);return L(t)||D(148),Vc(t)}function Vc(n){const[e,t,r]=_t(n),o=e.__colSpan,i=e.__rowSpan;if(o===1&&i===1)return;const[s,l]=bt(r,e,e),{startColumn:a,startRow:c}=l,u=e.__headerState&lt.COLUMN,f=Array.from({length:o},(h,p)=>{let _=u;for(let m=0;_!==0&&m<s.length;m++)_&=s[m][p+a].cell.__headerState;return _}),d=e.__headerState&lt.ROW,g=Array.from({length:i},(h,p)=>{let _=d;for(let m=0;_!==0&&m<s[0].length;m++)_&=s[p+c][m].cell.__headerState;return _});if(o>1){for(let h=1;h<o;h++)e.insertAfter(qt(f[h]|g[0]).append(H()));e.setColSpan(1)}if(i>1){let h;for(let p=1;p<i;p++){const _=c+p,m=s[_];h=(h||t).getNextSibling(),rt(h)||D(125);let y=null;for(let C=0;C<a;C++){const v=m[C],N=v.cell;v.startRow===_&&(y=N),N.__colSpan>1&&(C+=N.__colSpan-1)}if(y===null)for(let C=o-1;C>=0;C--)ms(h,qt(f[C]|g[p]).append(H()));else for(let C=o-1;C>=0;C--)y.insertAfter(qt(f[C]|g[p]).append(H()))}e.setRowSpan(1)}}function bt(n,e,t){const[r,o,i]=me(n,e,t);return o===null&&D(207),i===null&&D(208),[r,o,i]}function me(n,e,t){const r=[];let o=null,i=null;function s(a){let c=r[a];return c===void 0&&(r[a]=c=[]),c}const l=n.getChildren();for(let a=0;a<l.length;a++){const c=l[a];rt(c)||D(209);const u=s(a);for(let f=c.getFirstChild(),d=0;f!=null;f=f.getNextSibling()){for(L(f)||D(147);u[d]!==void 0;)d++;const g={cell:f,startColumn:d,startRow:a},{__rowSpan:h,__colSpan:p}=f;for(let _=0;_<h&&!(a+_>=l.length);_++){const m=s(a+_);for(let y=0;y<p;y++)m[d+y]=g}e!==null&&o===null&&e.is(f)&&(o=g),t!==null&&i===null&&t.is(f)&&(i=g)}}return[r,o,i]}function _t(n){let e;if(n instanceof ln)e=n;else if("__type"in n){const o=B(n,L);L(o)||D(148),e=o}else{const o=B(n.getNode(),L);L(o)||D(148),e=o}const t=e.getParent();rt(t)||D(149);const r=t.getParent();return ot(r)||D(210),[e,t,r]}function no(n,e,t){let r,o=Math.min(e.startColumn,t.startColumn),i=Math.min(e.startRow,t.startRow),s=Math.max(e.startColumn+e.cell.__colSpan-1,t.startColumn+t.cell.__colSpan-1),l=Math.max(e.startRow+e.cell.__rowSpan-1,t.startRow+t.cell.__rowSpan-1);do{r=!1;for(let a=0;a<n.length;a++)for(let c=0;c<n[0].length;c++){const u=n[a][c];if(!u)continue;const f=u.startColumn+u.cell.__colSpan-1,d=u.startRow+u.cell.__rowSpan-1,g=u.startColumn<=s&&f>=o,h=u.startRow<=l&&d>=i;if(g&&h){const p=Math.min(o,u.startColumn),_=Math.max(s,f),m=Math.min(i,u.startRow),y=Math.max(l,d);p===o&&_===s&&m===i&&y===l||(o=p,s=_,i=m,l=y,r=!0)}}}while(r);return{maxColumn:s,maxRow:l,minColumn:o,minRow:i}}function $l(n){const[e,,t]=_t(n),r=t.getChildren(),o=r.length,i=r[0].getChildren().length,s=new Array(o);for(let l=0;l<o;l++)s[l]=new Array(i);for(let l=0;l<o;l++){const a=r[l].getChildren();let c=0;for(let u=0;u<a.length;u++){for(;s[l][c];)c++;const f=a[u],d=f.__rowSpan||1,g=f.__colSpan||1;for(let h=0;h<d;h++)for(let p=0;p<g;p++)s[l+h][c+p]=f;if(e===f)return{colSpan:g,columnIndex:c,rowIndex:l,rowSpan:d};c+=g}}return null}function Pl(n){const[[e,t,r,o],[i,s,l,a]]=["anchor","focus"].map(c=>{const u=n[c].getNode(),f=B(u,L);L(f)||D(238,c,u.getKey(),u.getType());const d=f.getParent();rt(d)||D(239,c);const g=d.getParent();return ot(g)||D(240,c),[u,f,d,g]});return o.is(a)||D(241),{anchorCell:t,anchorNode:e,anchorRow:r,anchorTable:o,focusCell:s,focusNode:i,focusRow:l,focusTable:a}}let Yc=class qc{constructor(e,t,r){x(this,"tableKey");x(this,"anchor");x(this,"focus");x(this,"_cachedNodes");x(this,"dirty");this.anchor=t,this.focus=r,t._selection=this,r._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isValid(){if(this.tableKey==="root"||this.anchor.key==="root"||this.anchor.type!=="element"||this.focus.key==="root"||this.focus.type!=="element")return!1;const e=tt(this.tableKey),t=tt(this.anchor.key),r=tt(this.focus.key);return e!==null&&t!==null&&r!==null}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return j(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,t,r){this.dirty=this.dirty||e!==this.tableKey||t!==this.anchor.key||r!==this.focus.key,this.tableKey=e,this.anchor.key=t,this.focus.key=r,this._cachedNodes=null}clone(){return new qc(this.tableKey,Dt(this.anchor.key,this.anchor.offset,this.anchor.type),Dt(this.focus.key,this.focus.offset,this.focus.type))}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}hasFormat(e){let t=0;this.getNodes().filter(L).forEach(o=>{const i=o.getFirstChild();fr(i)&&(t|=i.getTextFormat())});const r=Me[e];return(t&r)!==0}insertNodes(e){const t=this.focus.getNode();b(t)||D(151),Zn(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const{anchorCell:e,focusCell:t}=Pl(this),r=$l(e);r===null&&D(153);const o=$l(t);o===null&&D(155);const i=Math.min(r.columnIndex,o.columnIndex),s=Math.max(r.columnIndex+r.colSpan-1,o.columnIndex+o.colSpan-1),l=Math.min(r.rowIndex,o.rowIndex),a=Math.max(r.rowIndex+r.rowSpan-1,o.rowIndex+o.rowSpan-1);return{fromX:Math.min(i,s),fromY:Math.min(l,a),toX:Math.max(i,s),toY:Math.max(l,a)}}getNodes(){if(!this.isValid())return[];const e=this._cachedNodes;if(e!==null)return e;const{anchorTable:t,anchorCell:r,focusCell:o}=Pl(this),i=o.getParents()[1];if(i!==t){if(t.isParentOf(o)){const _=i.getParent();_==null&&D(159),this.set(this.tableKey,o.getKey(),_.getKey())}else{const _=t.getParent();_==null&&D(158),this.set(this.tableKey,_.getKey(),o.getKey())}return this.getNodes()}const[s,l,a]=bt(t,r,o),{minColumn:c,maxColumn:u,minRow:f,maxRow:d}=no(s,l,a),g=new Map([[t.getKey(),t]]);let h=null;for(let _=f;_<=d;_++)for(let m=c;m<=u;m++){const{cell:y}=s[_][m],C=y.getParent();rt(C)||D(160),C!==h&&(g.set(C.getKey(),C),h=C),g.has(y.getKey())||Qd(y,v=>{g.set(v.getKey(),v)})}const p=Array.from(g.values());return Fn()||(this._cachedNodes=p),p}getTextContent(){const e=this.getNodes().filter(r=>L(r));let t="";for(let r=0;r<e.length;r++){const o=e[r],i=o.__parent,s=(e[r+1]||{}).__parent;t+=o.getTextContent()+(s!==i?`
14
+ `:" ")}return t}};function j(n){return n instanceof Yc}function Gd(){const n=Dt("root",0,"element"),e=Dt("root",0,"element");return new Yc("root",n,e)}function ki(n,e,t){n.getKey(),e.getKey(),t.getKey();const r=M(),o=j(r)?r.clone():Gd();return o.set(n.getKey(),e.getKey(),t.getKey()),o}function Qd(n,e){const t=[[n]];for(let r=t.at(-1);r!==void 0&&t.length>0;r=t.at(-1)){const o=r.pop();o===void 0?t.pop():e(o)!==!1&&b(o)&&t.push(o.getChildren())}}function Xc(n,e=Dn()){const t=tt(n);ot(t)||D(231,n);const r=en(t,e.getElementByKey(n));return r===null&&D(232,n),{tableElement:r,tableNode:t}}let Zd=class{constructor(){x(this,"observers");x(this,"nextFocus");x(this,"shouldCheckSelectionForTable");this.observers=new Map,this.nextFocus=null,this.shouldCheckSelectionForTable=null}setNextFocus(e){this.nextFocus=e}getAndClearNextFocus(){const{nextFocus:e}=this;return e!==null&&(this.nextFocus=null),e}setShouldCheckSelectionForTable(e){this.shouldCheckSelectionForTable=e}getAndClearShouldCheckSelectionForTable(){const{shouldCheckSelectionForTable:e}=this;return e?(this.shouldCheckSelectionForTable=null,e):null}},th=class{constructor(e,t){x(this,"focusX");x(this,"focusY");x(this,"listenersToRemove");x(this,"table");x(this,"isHighlightingCells");x(this,"anchorX");x(this,"anchorY");x(this,"tableNodeKey");x(this,"anchorCell");x(this,"focusCell");x(this,"anchorCellNodeKey");x(this,"focusCellNodeKey");x(this,"editor");x(this,"tableSelection");x(this,"hasHijackedSelectionStyles");x(this,"isSelecting");x(this,"pointerType");x(this,"abortController");x(this,"listenerOptions");this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=t,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.isSelecting=!1,this.pointerType=null,this.abortController=new AbortController,this.listenerOptions={signal:this.abortController.signal},this.trackTable()}getTable(){return this.table}removeListeners(){this.abortController.abort("removeListeners"),Array.from(this.listenersToRemove).forEach(e=>e()),this.listenersToRemove.clear()}$lookup(){return Xc(this.tableNodeKey,this.editor)}trackTable(){const e=new MutationObserver(t=>{this.editor.getEditorState().read(()=>{let r=!1;for(let s=0;s<t.length;s++){const l=t[s].target.nodeName;if(l==="TABLE"||l==="TBODY"||l==="THEAD"||l==="TR"){r=!0;break}}if(!r)return;const{tableNode:o,tableElement:i}=this.$lookup();this.table=wn(o,i)},{editor:this.editor})});this.editor.getEditorState().read(()=>{const{tableNode:t,tableElement:r}=this.$lookup();this.table=wn(t,r),e.observe(r,{attributes:!0,childList:!0,subtree:!0})},{editor:this.editor})}$clearHighlight(e=!0){const t=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.$enableHighlightStyle();const{tableNode:r,tableElement:o}=this.$lookup();Tr(t,wn(r,o),null),e&&M()!==null&&(et(null),t.dispatchCommand(pe,void 0))}$enableHighlightStyle(){const e=this.editor,{tableElement:t}=this.$lookup();ye(t,e._config.theme.tableSelection),t.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1}$disableHighlightStyle(){const{tableElement:e}=this.$lookup();pt(e,this.editor._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0}$updateTableTableSelection(e){if(e!==null){e.tableKey!==this.tableNodeKey&&D(233,e.tableKey,this.tableNodeKey);const t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.$disableHighlightStyle(),this.updateDOMSelection(),Tr(t,this.table,this.tableSelection)}else this.$clearHighlight()}updateDOMSelection(){if(this.anchorCell!==null&&this.focusCell!==null){const e=wt(this.editor._window);e&&e.rangeCount>0&&e.removeAllRanges()}}$setFocusCellForSelection(e,t=!1){const r=this.editor,{tableNode:o}=this.$lookup(),i=e.x,s=e.y;if(this.focusCell=e,!this.isHighlightingCells&&(t||this.anchorX!==i||this.anchorY!==s||this.tableSelection!=null&&this.anchorCellNodeKey!=null)&&(this.isHighlightingCells=!0,this.$disableHighlightStyle()),this.focusX!==-1&&this.focusY!==-1&&i===this.focusX&&s===this.focusY)return!1;if(this.focusX=i,this.focusY=s,this.isHighlightingCells){const l=Oi(o,e.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null){let a=l;if(a===null&&t&&(a=o.getCellNodeFromCords(i,s,this.table)),a!==null){const c=this.$getAnchorTableCellOrThrow();return this.focusCellNodeKey=a.getKey(),this.tableSelection=ki(o,c,a),et(this.tableSelection),r.dispatchCommand(pe,void 0),Tr(r,this.table,this.tableSelection),!0}}}return!1}$getAnchorTableCell(){return this.anchorCellNodeKey?tt(this.anchorCellNodeKey):null}$getAnchorTableCellOrThrow(){const e=this.$getAnchorTableCell();return e===null&&D(234),e}$getFocusTableCell(){return this.focusCellNodeKey?tt(this.focusCellNodeKey):null}$getFocusTableCellOrThrow(){const e=this.$getFocusTableCell();return e===null&&D(235),e}$setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y,this.focusX=-1,this.focusY=-1,this.focusCell=null,this.focusCellNodeKey=null;const{tableNode:t}=this.$lookup(),r=Oi(t,e.elem);if(r!==null){const o=r.getKey();this.tableSelection!=null?(this.tableSelection=this.tableSelection.clone(),this.tableSelection.set(t.getKey(),o,o)):this.tableSelection=ki(t,r,r),this.anchorCellNodeKey=o}}$formatCells(e){const t=M();j(t)||D(236);const r=fo(),o=r.anchor,i=r.focus,s=t.getNodes().filter(L);s.length>0||D(237);const l=s[0].getFirstChild(),a=fr(l)?l.getFormatFlags(e,null):null;s.forEach(c=>{o.set(c.getKey(),0,"element"),i.set(c.getKey(),c.getChildrenSize(),"element"),r.formatText(e,a)}),et(t),this.editor.dispatchCommand(pe,void 0)}$clearText(){const{editor:e}=this,t=tt(this.tableNodeKey);if(!ot(t))throw new Error("Expected TableNode.");const r=M();j(r)||D(253);const o=r.getNodes().filter(L),i=t.getFirstChild(),s=t.getLastChild();if(o.length>0&&i!==null&&s!==null&&rt(i)&&rt(s)&&o[0]===i.getFirstChild()&&o[o.length-1]===s.getLastChild()){t.selectPrevious();const l=t.getParent();return t.remove(),void(at(l)&&l.isEmpty()&&e.dispatchCommand(Ye,void 0))}o.forEach(l=>{if(b(l)){const a=H(),c=st();a.append(c),l.append(a),l.getChildren().forEach(u=>{u!==a&&u.remove()})}}),Tr(e,this.table,null),et(null),e.dispatchCommand(pe,void 0)}};const bn="__lexicalTableSelection";function yn(n){return nt(n)&&n.nodeName==="TABLE"}function en(n,e){if(!e)return e;const t=yn(e)?e:n.getDOMSlot(e).element;return t.nodeName!=="TABLE"&&D(245,e.nodeName),t}function So(n){return n._window}function lr(n,e){for(let t=e,r=null;t!==null;t=t.getParent()){if(n.is(t))return r;L(t)&&(r=t)}return null}const eh=[[Bi,"down"],[Wi,"up"],[zi,"backward"],[Ii,"forward"]],nh=[Nn,qe,Ee],rh=[Ji,Ui];function oh(n,e){const t=n.getRootElement(),r=n._window;if(!t||!r)return()=>{};const o=i=>{const s=i.target;if(i.button!==0||!se(s)||!t.contains(s))return;const l=function(a){const c=ro(a);if(c===null)return null;let u=c.elem;for(;u!=null;){if(u.nodeName==="TABLE"&&bn in u&&u[bn])return{cellElement:c,tableElement:u,tableObserver:u[bn]};u=u.parentNode}return null}(s);n.update(()=>{if(j(M())){for(const[f]of e.observers.values())f.$clearHighlight(!1);et(null),n.dispatchCommand(pe,void 0)}if(!l)return;const{tableObserver:a,tableElement:c,cellElement:u}=l;(function(f,d,g,h,p,_){const m=f._window;if(!m)return;const y=N=>{if(p.isSelecting)return;p.isSelecting=!0,N!==null&&p.anchorCell===null&&f.update(()=>{p.$setAnchorCellForSelection(N)});const S=()=>{p.isSelecting=!1,m.removeEventListener("pointerup",S),m.removeEventListener("pointermove",T)},T=k=>{if(!($=>!(1&~$.buttons))(k)&&p.isSelecting)return p.isSelecting=!1,m.removeEventListener("pointerup",S),void m.removeEventListener("pointermove",T);if(!se(k.target))return;let w=null;const A=!(Fl||h.contains(k.target));if(A)w=Rl(h,k.target);else for(const $ of document.elementsFromPoint(k.clientX,k.clientY))if(w=Rl(h,$),w)break;if(w){const $=w;p.anchorCell===null&&f.update(()=>{p.$setAnchorCellForSelection($)}),p.focusCell!==null&&w.elem===p.focusCell.elem||(_.setNextFocus({focusCell:w,override:A,tableKey:p.tableNodeKey}),f.dispatchCommand(pe,void 0))}};m.addEventListener("pointerup",S,p.listenerOptions),m.addEventListener("pointermove",T,p.listenerOptions)};p.pointerType=d.pointerType;const C=Xn(p.tableNodeKey),v=Lt();if(Fl&&d.shiftKey&&fe(v,C)&&(E(v)||j(v))){const N=v.anchor.getNode(),S=lr(C,v.anchor.getNode());S?(p.$setAnchorCellForSelection(We(p,S)),p.$setFocusCellForSelection(g),ge(d)):(C.isBefore(N)?C.selectStart():C.selectEnd()).anchor.set(v.anchor.key,v.anchor.offset,v.anchor.type)}else d.pointerType!=="touch"&&p.$setAnchorCellForSelection(g);y(g)})(n,i,u,c,a,e)})};return r.addEventListener("pointerdown",o),()=>{r.removeEventListener("pointerdown",o)}}function ih(n,e,t,r,o){const i=t.getRootElement(),s=So(t);i!==null&&s!==null||D(246);const l=new th(t,n.getKey()),a=en(n,e);(function(d,g){Dl(d)!==null&&D(205),d[bn]=g})(a,l),l.listenersToRemove.add(()=>function(d,g){Dl(d)===g&&delete d[bn]}(a,l));const c=d=>{d.detail>=3&&se(d.target)&&ro(d.target)!==null&&d.preventDefault()};a.addEventListener("mousedown",c,l.listenerOptions),l.listenersToRemove.add(()=>{a.removeEventListener("mousedown",c)});for(const[d,g]of eh)l.listenersToRemove.add(t.registerCommand(d,h=>Zc(t,h,g,n,l,o),Wt));l.listenersToRemove.add(t.registerCommand(Hi,d=>{const g=M();if(j(g)){const h=lr(n,g.focus.getNode());if(h!==null)return ge(d),h.selectEnd(),!0}return!1},Wt));const u=d=>()=>{const g=M();if(!fe(g,n))return!1;if(j(g))return l.$clearText(),!0;if(E(g)){if(!L(lr(n,g.anchor.getNode())))return!1;const h=g.anchor.getNode(),p=g.focus.getNode(),_=n.isParentOf(h),m=n.isParentOf(p);if(_&&!m||m&&!_)return l.$clearText(),!0;const y=B(g.anchor.getNode(),v=>b(v)),C=y&&B(y,v=>b(v)&&L(v.getParent()));if(!b(C)||!b(y))return!1;if(d===qe&&C.getPreviousSibling()===null)return!0}return!1};for(const d of nh)l.listenersToRemove.add(t.registerCommand(d,u(d),Wt));const f=d=>{const g=M();if(!j(g)&&!E(g))return!1;const h=n.isParentOf(g.anchor.getNode());if(h!==n.isParentOf(g.focus.getNode())){const p=h?"anchor":"focus",_=h?"focus":"anchor",{key:m,offset:y,type:C}=g[_];return n[g[p].isBefore(g[_])?"selectPrevious":"selectNext"]()[_].set(m,y,C),!1}return!!fe(g,n)&&!!j(g)&&(d&&(d.preventDefault(),d.stopPropagation()),l.$clearText(),!0)};for(const d of rh)l.listenersToRemove.add(t.registerCommand(d,f,Wt));return l.listenersToRemove.add(t.registerCommand(co,d=>{const g=M();if(g){if(!j(g)&&!E(g))return!1;vi(t,Te(d,ClipboardEvent)?d:null,Hc(g));const h=f(d);return E(g)?(g.removeText(),!0):h}return!1},Wt)),l.listenersToRemove.add(t.registerCommand(_e,d=>{const g=M();if(!fe(g,n))return!1;if(j(g))return l.$formatCells(d),!0;if(E(g)){const h=B(g.anchor.getNode(),p=>L(p));if(!L(h))return!1}return!1},Wt)),l.listenersToRemove.add(t.registerCommand(va,d=>{const g=M();if(!j(g)||!fe(g,n))return!1;const h=g.anchor.getNode(),p=g.focus.getNode();if(!L(h)||!L(p))return!1;if(function(k,w){if(j(k)){const A=k.anchor.getNode(),$=k.focus.getNode();if(w&&A&&$){const[K]=bt(w,A,$);return A.getKey()===K[0][0].cell.getKey()&&$.getKey()===K[K.length-1].at(-1).cell.getKey()}}return!1}(g,n))return n.setFormat(d),!0;const[_,m,y]=bt(n,h,p),C=Math.max(m.startRow+m.cell.__rowSpan-1,y.startRow+y.cell.__rowSpan-1),v=Math.max(m.startColumn+m.cell.__colSpan-1,y.startColumn+y.cell.__colSpan-1),N=Math.min(m.startRow,y.startRow),S=Math.min(m.startColumn,y.startColumn),T=new Set;for(let k=N;k<=C;k++)for(let w=S;w<=v;w++){const A=_[k][w].cell;if(T.has(A))continue;T.add(A),A.setFormat(d);const $=A.getChildren();for(let K=0;K<$.length;K++){const I=$[K];b(I)&&!I.isInline()&&I.setFormat(d)}}return!0},Wt)),l.listenersToRemove.add(t.registerCommand(Be,d=>{const g=M();if(!fe(g,n))return!1;if(j(g))return l.$clearHighlight(),!1;if(E(g)){const h=B(g.anchor.getNode(),p=>L(p));if(!L(h))return!1;if(typeof d=="string"){const p=Kl(t,g,n);if(p)return Ll(p,n,[st(d)]),!0}}return!1},Wt)),r&&l.listenersToRemove.add(t.registerCommand(ji,d=>{const g=M();if(!E(g)||!g.isCollapsed()||!fe(g,n))return!1;const h=Jn(g.anchor.getNode());return!(h===null||!n.is(En(h)))&&(ge(d),function(p,_){const m=_==="next"?"getNextSibling":"getPreviousSibling",y=_==="next"?"getFirstChild":"getLastChild",C=p[m]();if(b(C))return C.selectEnd();const v=B(p,rt);v===null&&D(247);for(let S=v[m]();rt(S);S=S[m]()){const T=S[y]();if(b(T))return T.selectEnd()}const N=B(v,ot);N===null&&D(248),_==="next"?N.selectNext():N.selectPrevious()}(h,d.shiftKey?"previous":"next"),!0)},Wt)),l.listenersToRemove.add(t.registerCommand(Na,d=>n.isSelected(),Wt)),l.listenersToRemove.add(t.registerCommand(Ye,()=>{const d=M();if(!E(d)||!d.isCollapsed()||!fe(d,n))return!1;const g=Kl(t,d,n);return!!g&&(Ll(g,n),!0)},Wt)),l}function sh(n,e){const t=M(),r=Lt(),o=n.getAndClearNextFocus();if(o!==null){const{tableKey:l,focusCell:a}=o,c=n.observers.get(l);c||D(335,l);const[u]=c;if(j(t)&&t.tableKey===u.tableNodeKey)return(a.x!==u.focusX||a.y!==u.focusY)&&(u.$setFocusCellForSelection(a),!0);if(u.anchorCell!==null&&u.anchorCellNodeKey!==null&&a.elem!==u.anchorCell.elem&&u.tableSelection!==null)return u.$setFocusCellForSelection(a,!0),!0}const i=n.getAndClearShouldCheckSelectionForTable();if(i&&E(r)&&E(t)&&t.isCollapsed()){const l=Xn(i),a=t.anchor.getNode(),c=l.getFirstChild(),u=Jn(a);if(u!==null&&rt(c)){const f=c.getFirstChild();if(L(f)&&l.is(B(u,d=>d.is(l)||d.is(f))))return f.selectStart(),!0}}j(t)&&function(l,a){const c=So(l),u=Lt();if(!a.is(u))return;const f=Xn(a.tableKey),d=wt(c);if(d&&d.anchorNode&&d.focusNode){const g=Rt(d.focusNode),h=g&&!f.isParentOf(g),p=Rt(d.anchorNode),_=p&&f.isParentOf(p);if(h&&_&&d.rangeCount>0){const m=mf(d,l);m&&(m.anchor.set(f.getKey(),a.isBackward()?f.getChildrenSize():0,"element"),d.removeAllRanges(),et(m))}}}(e,t),E(t)&&function(l,a){const c=Lt(),{anchor:u,focus:f}=l,d=u.getNode(),g=f.getNode(),h=Jn(d),p=Jn(g),_=h?En(h):null,m=p?En(p):null,y=l.isBackward(),C=h&&p&&_&&m&&_.is(m),v=m&&(!_||_.isParentOf(m)),N=_&&(!m||m.isParentOf(_));if(v){const S=l.clone(),[T]=bt(m,p,p),k=T[0][0].cell,w=T[T.length-1].at(-1).cell;S.focus.set(y?k.getKey():w.getKey(),y?0:w.getChildrenSize(),"element"),et(S)}else if(N){const S=l.clone(),[T]=bt(_,h,h),k=T[0][0].cell,w=T[T.length-1].at(-1).cell;S.anchor.set(y?w.getKey():k.getKey(),y?w.getChildrenSize():0,"element"),et(S)}else if(C){const S=a.observers.get(_.getKey());S||D(335,_.getKey());const[T]=S;if(h.is(p)||(T.$setAnchorCellForSelection(We(T,h)),T.$setFocusCellForSelection(We(T,p),!0)),T.pointerType==="touch"&&T.isSelecting&&l.isCollapsed()&&E(c)&&c.isCollapsed()){const k=Jn(c.anchor.getNode());k&&!k.is(p)&&(T.$setAnchorCellForSelection(We(T,k)),T.$setFocusCellForSelection(We(T,p),!0),T.pointerType=null)}}}(t,n);const s=n.observers.entries().map(([l,[a]])=>({tableNode:Xn(l),tableObserver:a})).toArray();for(const{tableNode:l,tableObserver:a}of s)lh(e,l,a);return!1}function lh(n,e,t){const r=M(),o=Lt();r&&!r.is(o)&&(j(r)||j(o))&&t.tableSelection&&!t.tableSelection.is(o)&&(j(r)&&r.tableKey===t.tableNodeKey?t.$updateTableTableSelection(r):!j(r)&&j(o)&&o.tableKey===t.tableNodeKey&&t.$updateTableTableSelection(null)),t.hasHijackedSelectionStyles&&!e.isSelected()?function(i,s){s.$enableHighlightStyle(),Ei(s.table,l=>{const a=l.elem;l.highlighted=!1,Qc(i,l),a.getAttribute("style")||a.removeAttribute("style")})}(n,t):!t.hasHijackedSelectionStyles&&e.isSelected()&&function(i,s){s.$disableHighlightStyle(),Ei(s.table,l=>{l.highlighted=!0,Gc(i,l)})}(n,t)}function Dl(n){return n[bn]||null}function ro(n){let e=n;for(;e!=null;){const t=e.nodeName;if(t==="TD"||t==="TH"){const r=e._cell;return r===void 0?null:r}e=e.parentNode}return null}function Rl(n,e){if(!n.contains(e))return null;let t=null;for(let r=e;r!=null;r=r.parentNode){if(r===n)return t;const o=r.nodeName;o!=="TD"&&o!=="TH"||(t=r._cell||null)}return null}function wn(n,e){const t=[],r={columns:0,domRows:t,rows:0};let o=en(n,e).querySelector("tr"),i=0,s=0;for(t.length=0;o!=null;){const l=o.nodeName;if(l==="TD"||l==="TH"){const u={elem:o,hasBackgroundColor:o.style.backgroundColor!=="",highlighted:!1,x:i,y:s};o._cell=u;let f=t[s];f===void 0&&(f=t[s]=[]),f[i]=u}else{const u=o.firstChild;if(u!=null){o=u;continue}}const a=o.nextSibling;if(a!=null){i++,o=a;continue}const c=o.parentNode;if(c!=null){const u=c.nextSibling;if(u==null)break;s++,i=0,o=u}}return r.columns=i+1,r.rows=s+1,r}function Tr(n,e,t){const r=new Set(t?t.getNodes():[]);Ei(e,(o,i)=>{const s=o.elem;r.has(i)?(o.highlighted=!0,Gc(n,o)):(o.highlighted=!1,Qc(n,o),s.getAttribute("style")||s.removeAttribute("style"))})}function Ei(n,e){const{domRows:t}=n;for(let r=0;r<t.length;r++){const o=t[r];if(o)for(let i=0;i<o.length;i++){const s=o[i];if(!s)continue;const l=Rt(s.elem);l!==null&&e(s,l,{x:i,y:r})}}}const ah=(n,e,t,r,o)=>{const i=o==="forward";switch(o){case"backward":case"forward":return t!==(i?n.table.columns-1:0)?Er(e.getCellNodeFromCordsOrThrow(t+(i?1:-1),r,n.table),i):r!==(i?n.table.rows-1:0)?Er(e.getCellNodeFromCordsOrThrow(i?0:n.table.columns-1,r+(i?1:-1),n.table),i):i?e.selectNext():e.selectPrevious(),!0;case"up":return r!==0?Er(e.getCellNodeFromCordsOrThrow(t,r-1,n.table),!1):e.selectPrevious(),!0;case"down":return r!==n.table.rows-1?Er(e.getCellNodeFromCordsOrThrow(t,r+1,n.table),!0):e.selectNext(),!0;default:return!1}};function Ho(n,e){let t,r;if(e.startColumn===n.minColumn)t="minColumn";else{if(e.startColumn+e.cell.__colSpan-1!==n.maxColumn)return null;t="maxColumn"}if(e.startRow===n.minRow)r="minRow";else{if(e.startRow+e.cell.__rowSpan-1!==n.maxRow)return null;r="maxRow"}return[t,r]}function kr([n,e]){return[n==="minColumn"?"maxColumn":"minColumn",e==="minRow"?"maxRow":"minRow"]}function dn(n,e,[t,r]){const o=e[r],i=n[o];i===void 0&&D(250,r,String(o));const s=e[t],l=i[s];return l===void 0&&D(250,t,String(s)),l}function ch(n,e,t,r,o){const i=no(e,t,r),s=function(S,T){const{minColumn:k,maxColumn:w,minRow:A,maxRow:$}=T;let K=1,I=1,z=1,G=1;const dt=S[A],Mt=S[$];for(let ut=k;ut<=w;ut++)K=Math.max(K,dt[ut].cell.__rowSpan),G=Math.max(G,Mt[ut].cell.__rowSpan);for(let ut=A;ut<=$;ut++)I=Math.max(I,S[ut][k].cell.__colSpan),z=Math.max(z,S[ut][w].cell.__colSpan);return{bottomSpan:G,leftSpan:I,rightSpan:z,topSpan:K}}(e,i),{topSpan:l,leftSpan:a,bottomSpan:c,rightSpan:u}=s,f=function(S,T){const k=Ho(S,T);return k===null&&D(249,T.cell.getKey()),k}(i,t),[d,g]=kr(f);let h=i[d],p=i[g];o==="forward"?h+=d==="maxColumn"?1:a:o==="backward"?h-=d==="minColumn"?1:u:o==="down"?p+=g==="maxRow"?1:l:o==="up"&&(p-=g==="minRow"?1:c);const _=e[p];if(_===void 0)return!1;const m=_[h];if(m===void 0)return!1;const[y,C]=function(S,T,k){const w=no(S,T,k),A=Ho(w,T);if(A)return[dn(S,w,A),dn(S,w,kr(A))];const $=Ho(w,k);if($)return[dn(S,w,kr($)),dn(S,w,$)];const K=["minColumn","minRow"];return[dn(S,w,K),dn(S,w,kr(K))]}(e,t,m),v=We(n,y.cell),N=We(n,C.cell);return n.$setAnchorCellForSelection(v),n.$setFocusCellForSelection(N,!0),!0}function fe(n,e){if(E(n)||j(n)){const t=e.isParentOf(n.anchor.getNode()),r=e.isParentOf(n.focus.getNode());return t&&r}return!1}function Er(n,e){e?n.selectStart():n.selectEnd()}function Gc(n,e){const t=e.elem,r=n._config.theme;L(Rt(t))||D(131),pt(t,r.tableCellSelected)}function Qc(n,e){const t=e.elem;L(Rt(t))||D(131);const r=n._config.theme;ye(t,r.tableCellSelected)}function Jn(n){const e=B(n,L);return L(e)?e:null}function En(n){const e=B(n,ot);return ot(e)?e:null}function uh(n,e,t,r,o,i,s){const l=Xt(t.focus,o?"previous":"next");if(fs(l))return!1;let a=l;for(const _ of or(l).iterNodeCarets("shadowRoot")){if(!Fe(_)||!b(_.origin))return!1;a=_}const c=a.getParentAtCaret();if(!L(c))return!1;const u=c,f=function(_){for(const m of or(_).iterNodeCarets("root")){const{origin:y}=m;if(L(y)){if(Ot(m))return vt(y,_.direction)}else if(!rt(y))break}return null}(it(u,a.direction)),d=B(u,ot);if(!d||!d.is(i))return!1;const g=n.getElementByKey(u.getKey()),h=ro(g);if(!g||!h)return!1;const p=fh(n,d);if(s.table=p,f)if(r==="extend"){const _=ro(n.getElementByKey(f.origin.getKey()));if(!_)return!1;s.$setAnchorCellForSelection(h),s.$setFocusCellForSelection(_,!0)}else{const _=kt(f);jt(t.anchor,_),jt(t.focus,_)}else if(r==="extend")s.$setAnchorCellForSelection(h),s.$setFocusCellForSelection(h,!0);else{const _=function(m){const y=tn(m);return Ot(y)?kt(y):m}(it(d,l.direction));jt(t.anchor,_),jt(t.focus,_)}return ge(e),!0}function Zc(n,e,t,r,o,i){if((t==="up"||t==="down")&&function(l){const a=l.getRootElement();return a?a.hasAttribute("aria-controls")&&a.getAttribute("aria-controls")==="typeahead-menu":!1}(n))return!1;const s=M();if(!fe(s,r)){if(E(s)){if(t==="backward"){if(s.focus.offset>0)return!1;const l=function(c){for(let u=c,f=c;f!==null;u=f,f=f.getParent())if(b(f)){if(f!==u&&f.getFirstChild()!==u)return null;if(!f.isInline())return f}return null}(s.focus.getNode());if(!l)return!1;const a=l.getPreviousSibling();return!!ot(a)&&(ge(e),e.shiftKey?s.focus.set(a.getParentOrThrow().getKey(),a.getIndexWithinParent(),"element"):a.selectEnd(),!0)}if(e.shiftKey&&(t==="up"||t==="down")){const l=s.focus.getNode();if(!s.isCollapsed()&&(t==="up"&&!s.isBackward()||t==="down"&&s.isBackward())){let a=B(l,g=>ot(g));if(L(a)&&(a=B(a,ot)),a!==r||!a)return!1;const c=t==="down"?a.getNextSibling():a.getPreviousSibling();if(!c)return!1;let u=0;t==="up"&&b(c)&&(u=c.getChildrenSize());let f=c;t==="up"&&b(c)&&(f=c.getLastChild()||c,u=F(f)?f.getTextContentSize():0);const d=s.clone();return d.focus.set(f.getKey(),u,F(f)?"text":"element"),et(d),ge(e),!0}if(Et(l)){const a=t==="up"?s.getNodes()[s.getNodes().length-1]:s.getNodes()[0];if(a&&lr(r,a)!==null){const c=r.getFirstDescendant(),u=r.getLastDescendant();if(!c||!u)return!1;const[f]=_t(c),[d]=_t(u),g=r.getCordsFromCellNode(f,o.table),h=r.getCordsFromCellNode(d,o.table),p=r.getDOMCellFromCordsOrThrow(g.x,g.y,o.table),_=r.getDOMCellFromCordsOrThrow(h.x,h.y,o.table);return o.$setAnchorCellForSelection(p),o.$setFocusCellForSelection(_,!0),!0}return!1}{let a=B(l,u=>b(u)&&!u.isInline());if(L(a)&&(a=B(a,ot)),!a)return!1;const c=t==="down"?a.getNextSibling():a.getPreviousSibling();if(ot(c)&&o.tableNodeKey===c.getKey()){const u=c.getFirstDescendant(),f=c.getLastDescendant();if(!u||!f)return!1;const[d]=_t(u),[g]=_t(f),h=s.clone();return h.focus.set((t==="up"?d:g).getKey(),t==="up"?0:g.getChildrenSize(),"element"),ge(e),et(h),!0}}}}return t==="down"&&Ai(n)&&i.setShouldCheckSelectionForTable(r.getKey()),!1}if(E(s)){if(t==="backward"||t==="forward")return uh(n,e,s,e.shiftKey?"extend":"move",t==="backward",r,o);if(s.isCollapsed()){const{anchor:l,focus:a}=s,c=B(l.getNode(),L),u=B(a.getNode(),L);if(!L(c)||!c.is(u))return!1;const f=En(c);if(f!==r&&f!=null){const y=en(f,n.getElementByKey(f.getKey()));if(y!=null)return o.table=wn(f,y),Zc(n,e,t,f,o,i)}const d=n.getElementByKey(c.__key),g=n.getElementByKey(l.key);if(g==null||d==null)return!1;let h;if(l.type==="element")h=g.getBoundingClientRect();else{const y=wt(So(n));if(y===null||y.rangeCount===0)return!1;h=y.getRangeAt(0).getBoundingClientRect()}const p=t==="up"?c.getFirstChild():c.getLastChild();if(p==null)return!1;const _=n.getElementByKey(p.__key);if(_==null)return!1;const m=_.getBoundingClientRect();if(t==="up"?m.top>h.top-h.height:h.bottom+h.height>m.bottom){ge(e);const y=r.getCordsFromCellNode(c,o.table);if(!e.shiftKey)return ah(o,r,y.x,y.y,t);{const C=r.getDOMCellFromCordsOrThrow(y.x,y.y,o.table);o.$setAnchorCellForSelection(C),o.$setFocusCellForSelection(C,!0)}return!0}}}else if(j(s)){const{anchor:l,focus:a}=s,c=B(l.getNode(),L),u=B(a.getNode(),L),[f]=s.getNodes();ot(f)||D(251);const d=en(f,n.getElementByKey(f.getKey()));if(!L(c)||!L(u)||!ot(f)||d==null)return!1;o.$updateTableTableSelection(s);const g=wn(f,d),h=r.getCordsFromCellNode(c,g),p=r.getDOMCellFromCordsOrThrow(h.x,h.y,g);if(o.$setAnchorCellForSelection(p),ge(e),e.shiftKey){const[_,m,y]=bt(r,c,u);return ch(o,_,m,y,t)}return u.selectEnd(),!0}return!1}function ge(n){n.preventDefault(),n.stopImmediatePropagation(),n.stopPropagation()}function Ll(n,e,t){const r=H();n==="first"?e.insertBefore(r):e.insertAfter(r),r.append(...t||[]),r.selectEnd()}function Kl(n,e,t){const r=t.getParent();if(!r)return;const o=wt(So(n));if(!o)return;const i=o.anchorNode,s=n.getElementByKey(r.getKey()),l=en(t,n.getElementByKey(t.getKey()));if(!i||!s||!l||!s.contains(i)||l.contains(i))return;const a=B(e.anchor.getNode(),y=>L(y));if(!a)return;const c=B(a,y=>ot(y));if(!ot(c)||!c.is(t))return;const[u,f]=bt(t,a,a),d=u[0][0],g=u[u.length-1][u[0].length-1],{startRow:h,startColumn:p}=f,_=h===d.startRow&&p===d.startColumn,m=h===g.startRow&&p===g.startColumn;return _?"first":m?"last":void 0}function We(n,e){const{tableNode:t}=n.$lookup(),r=t.getCordsFromCellNode(e,n.table);return t.getDOMCellFromCordsOrThrow(r.x,r.y,n.table)}function Oi(n,e,t){return lr(n,Rt(e,t))}function Il(n,e,t){const r=n.querySelector("colgroup");if(!r)return;const o=[];for(let i=0;i<e;i++){const s=document.createElement("col"),l=t&&t[i];l&&(s.style.width=`${l}px`),o.push(s)}r.replaceChildren(...o)}function zl(n,e,t){if(!e.theme.tableAlignment)return;const r=[],o=[];for(const i of["center","right"]){const s=e.theme.tableAlignment[i];s&&(i===t?o:r).push(s)}ye(n,...r),pt(n,...o)}const tu=new WeakSet;function Ai(n=Dn()){return tu.has(n)}function _g(n,e){tu.add(n)}class nn extends At{constructor(t){super(t);x(this,"__rowStriping");x(this,"__frozenColumnCount");x(this,"__frozenRowCount");x(this,"__colWidths");this.__rowStriping=!1,this.__frozenColumnCount=0,this.__frozenRowCount=0,this.__colWidths=void 0}static getType(){return"table"}getColWidths(){return this.getLatest().__colWidths}setColWidths(t){const r=this.getWritable();return r.__colWidths=t,r}static clone(t){return new nn(t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__colWidths=t.__colWidths,this.__rowStriping=t.__rowStriping,this.__frozenColumnCount=t.__frozenColumnCount,this.__frozenRowCount=t.__frozenRowCount}static importDOM(){return{table:t=>({conversion:dh,priority:1})}}static importJSON(t){return ys().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setRowStriping(t.rowStriping||!1).setFrozenColumns(t.frozenColumnCount||0).setFrozenRows(t.frozenRowCount||0).setColWidths(t.colWidths)}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),frozenColumnCount:this.__frozenColumnCount?this.__frozenColumnCount:void 0,frozenRowCount:this.__frozenRowCount?this.__frozenRowCount:void 0,rowStriping:this.__rowStriping?this.__rowStriping:void 0}}extractWithChild(t,r,o){return o==="html"}getDOMSlot(t){const r=yn(t)?t:t.querySelector("table");return yn(r)||D(229),super.getDOMSlot(t).withElement(r).withAfter(r.querySelector("colgroup"))}createDOM(t,r){const o=document.createElement("table");this.__style&&(o.style.cssText=this.__style);const i=document.createElement("colgroup");if(o.appendChild(i),Kf(i),pt(o,t.theme.table),this.updateTableElement(null,o,t),Ai(r)){const s=document.createElement("div"),l=t.theme.tableScrollableWrapper;return l?pt(s,l):s.style.cssText="overflow-x: auto;",s.appendChild(o),this.updateTableWrapper(null,s,o,t),s}return o}updateTableWrapper(t,r,o,i){this.__frozenColumnCount!==(t?t.__frozenColumnCount:0)&&function(s,l,a,c){c>0?(pt(s,a.theme.tableFrozenColumn),l.setAttribute("data-lexical-frozen-column","true")):(ye(s,a.theme.tableFrozenColumn),l.removeAttribute("data-lexical-frozen-column"))}(r,o,i,this.__frozenColumnCount),this.__frozenRowCount!==(t?t.__frozenRowCount:0)&&function(s,l,a,c){c>0?(pt(s,a.theme.tableFrozenRow),l.setAttribute("data-lexical-frozen-row","true")):(ye(s,a.theme.tableFrozenRow),l.removeAttribute("data-lexical-frozen-row"))}(r,o,i,this.__frozenRowCount)}updateTableElement(t,r,o){this.__style!==(t?t.__style:"")&&(r.style.cssText=this.__style),this.__rowStriping!==(!!t&&t.__rowStriping)&&function(l,a,c){c?(pt(l,a.theme.tableRowStriping),l.setAttribute("data-lexical-row-striping","true")):(ye(l,a.theme.tableRowStriping),l.removeAttribute("data-lexical-row-striping"))}(r,o,this.__rowStriping);const i=t?t.getColumnCount():0,s=t?t.__colWidths:void 0;this.getColumnCount()===i&&this.getColWidths()===s||Il(r,this.getColumnCount(),this.getColWidths()),zl(r,o,this.getFormatType())}updateDOM(t,r,o){const i=this.getDOMSlot(r).element;return r===i===Ai()||(nt(s=r)&&s.nodeName==="DIV"&&this.updateTableWrapper(t,r,i,o),this.updateTableElement(t,i,o),!1);var s}scaleDOMColWidths(t,r){const o=this.getColWidths();o&&Il(this.getDOMSlot(t).element,this.getColumnCount(),o.map(i=>i*r))}exportDOM(t){const r=super.exportDOM(t),{element:o}=r;return{after:i=>{if(r.after&&(i=r.after(i)),!yn(i)&&nt(i)&&(i=i.querySelector("table")),!yn(i))return null;zl(i,t._config,this.getFormatType());const[s]=me(this,null,null),l=new Map;for(const f of s)for(const d of f){const g=d.cell.getKey();l.has(g)||l.set(g,{colSpan:d.cell.getColSpan(),startColumn:d.startColumn})}const a=new Set;for(const f of i.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")){const d=f.getAttribute("data-temporary-table-cell-lexical-key");if(d){const g=l.get(d);if(f.removeAttribute("data-temporary-table-cell-lexical-key"),g){l.delete(d);for(let h=0;h<g.colSpan;h++)a.add(h+g.startColumn)}}}const c=i.querySelector(":scope > colgroup");if(c){const f=Array.from(i.querySelectorAll(":scope > colgroup > col")).filter((d,g)=>a.has(g));c.replaceChildren(...f)}const u=i.querySelectorAll(":scope > tr");if(u.length>0){const f=document.createElement("tbody");for(const d of u)f.appendChild(d);i.append(f)}return i},element:!yn(o)&&nt(o)?o.querySelector("table"):o}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(t,r){const{rows:o,domRows:i}=r;for(let s=0;s<o;s++){const l=i[s];if(l!=null)for(let a=0;a<l.length;a++){const c=l[a];if(c==null)continue;const{elem:u}=c,f=Oi(this,u);if(f!==null&&t.is(f))return{x:a,y:s}}}throw new Error("Cell not found in table.")}getDOMCellFromCords(t,r,o){const{domRows:i}=o,s=i[r];if(s==null)return null;const l=s[t<s.length?t:s.length-1];return l??null}getDOMCellFromCordsOrThrow(t,r,o){const i=this.getDOMCellFromCords(t,r,o);if(!i)throw new Error("Cell not found at cords.");return i}getCellNodeFromCords(t,r,o){const i=this.getDOMCellFromCords(t,r,o);if(i==null)return null;const s=Rt(i.elem);return L(s)?s:null}getCellNodeFromCordsOrThrow(t,r,o){const i=this.getCellNodeFromCords(t,r,o);if(!i)throw new Error("Node at cords not TableCellNode.");return i}getRowStriping(){return!!this.getLatest().__rowStriping}setRowStriping(t){const r=this.getWritable();return r.__rowStriping=t,r}setFrozenColumns(t){const r=this.getWritable();return r.__frozenColumnCount=t,r}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(t){const r=this.getWritable();return r.__frozenRowCount=t,r}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){const t=this.getFirstChild();if(!t)return 0;let r=0;return t.getChildren().forEach(o=>{L(o)&&(r+=o.getColSpan())}),r}}function fh(n,e){const t=n.getElementByKey(e.getKey());return t===null&&D(230),wn(e,t)}function dh(n){const e=ys();n.hasAttribute("data-lexical-row-striping")&&e.setRowStriping(!0),n.hasAttribute("data-lexical-frozen-column")&&e.setFrozenColumns(1),n.hasAttribute("data-lexical-frozen-row")&&e.setFrozenRows(1);const t=n.querySelector(":scope > colgroup");if(t){let r=[];for(const o of t.querySelectorAll(":scope > col")){let i=o.style.width||"";if(!ps.test(i)&&(i=o.getAttribute("width")||"",!/^\d+$/.test(i))){r=void 0;break}r.push(parseFloat(i))}r&&e.setColWidths(r)}return{after:r=>Oc(r,rt),node:e}}function ys(){return Ht(new nn)}function ot(n){return n instanceof nn}function hh(n){rt(n.getParent())?n.isEmpty()&&n.append(H()):n.remove()}function gh(n){ot(n.getParent())?kc(n,L):n.remove()}function ph(n){kc(n,rt);const[e]=me(n,null,null),t=e.reduce((s,l)=>Math.max(s,l.length),0),r=n.getChildren();for(let s=0;s<e.length;++s){const l=r[s];if(!l)continue;rt(l)||D(254,l.constructor.name,l.getType());const a=e[s].reduce((c,u)=>u?1+c:c,0);if(a!==t)for(let c=a;c<t;++c){const u=qt();u.append(H()),l.append(u)}}const o=n.getColWidths(),i=n.getColumnCount();if(o&&o.length!==i){let s;if(i<o.length)s=o.slice(0,i);else if(o.length>0){const l=o[o.length-1];s=[...o,...Array(i-o.length).fill(l)]}n.setColWidths(s)}}function _h(n){if(n.detail<3||!se(n.target))return!1;const e=Rt(n.target);if(e===null)return!1;const t=B(e,r=>b(r)&&!r.isInline());return t===null?!1:!!L(t.getParent())&&(t.select(0),!0)}function mh(){const n=M();if(!E(n))return!1;const e=En(n.anchor.getNode());if(e===null)return!1;const t=ct();if(!t.is(e.getParent())||t.getChildrenSize()!==1)return!1;const[r]=me(e,null,null);if(r.length===0||r[0].length===0)return!1;const o=r[0][0];if(!o||!o.cell)return!1;const i=r[r.length-1],s=i[i.length-1];if(!s||!s.cell)return!1;const l=ki(e,o.cell,s.cell);return et(l),!0}function mg(n){return n.registerNodeTransform(ln,e=>{if(e.getColSpan()>1||e.getRowSpan()>1){const[,,t]=_t(e),[r]=bt(t,e,e),o=r.length,i=r[0].length;let s=t.getFirstChild();rt(s)||D(175);const l=[];for(let a=0;a<o;a++){a!==0&&(s=s.getNextSibling(),rt(s)||D(175));let c=null;for(let u=0;u<i;u++){const f=r[a][u],d=f.cell;if(f.startRow===a&&f.startColumn===u)c=d,l.push(d);else if(d.getColSpan()>1||d.getRowSpan()>1){L(d)||D(176);const g=qt(d.__headerState);c!==null?c.insertAfter(g):Cd(s,g)}}}for(const a of l)a.setColSpan(1),a.setRowSpan(1)}})}function yg(n,e=!0){const t=new Zd,r=(o,i,s)=>{const l=en(o,s),a=ih(o,l,n,e,t);t.observers.set(i,[a,l])};return De(oh(n,t),n.registerCommand(pe,()=>sh(t,n),Wt),n.registerMutationListener(nn,o=>{n.getEditorState().read(()=>{for(const[i,s]of o){const l=t.observers.get(i);if(s==="created"||s==="updated"){const{tableNode:a,tableElement:c}=Xc(i);l===void 0?r(a,i,c):c!==l[1]&&(l[0].removeListeners(),t.observers.delete(i),r(a,i,c))}else s==="destroyed"&&l!==void 0&&(l[0].removeListeners(),t.observers.delete(i))}},{editor:n})},{skipInitialization:!1}),()=>{for(const[,[o]]of t.observers)o.removeListeners()})}function Cg(n,e){n.hasNodes([nn])||D(255);const{hasNestedTables:t=Mc(!1)}={};return De(n.registerCommand(Ud,r=>function({rows:o,columns:i,includeHeaders:s},l){const a=M()||Lt();if(!a||!E(a)||!l&&En(a.anchor.getNode()))return!1;const c=Yd(Number(o),Number(i),s);md(c);const u=c.getFirstDescendant();return F(u)&&u.select(),!0}(r,t.peek()),W),n.registerCommand(ga,(r,o)=>n===o&&function(i,s){const{nodes:l,selection:a}=i;if(!l.some(f=>ot(f)||ud(f).some(d=>ot(d.node))))return!1;const c=j(a),u=E(a);return u&&B(a.anchor.getNode(),f=>L(f))!==null&&B(a.focus.getNode(),f=>L(f))!==null||c?l.length===1&&ot(l[0])?function(f,d){const g=d.getStartEndPoints(),h=j(d);if(g===null)return!1;const[p,_]=g,[m,y,C]=_t(p),v=B(_.getNode(),V=>L(V));if(!(L(m)&&L(v)&&rt(y)&&ot(C)))return!1;const[N,S,T]=bt(C,m,v),[k]=me(f,null,null),w=N.length,A=w>0?N[0].length:0;let $=S.startRow,K=S.startColumn,I=k.length,z=I>0?k[0].length:0;if(h){const V=no(N,S,T),St=V.maxRow-V.minRow+1,xt=V.maxColumn-V.minColumn+1;$=V.minRow,K=V.minColumn,I=Math.min(I,St),z=Math.min(z,xt)}let G=!1;const dt=Math.min(w,$+I)-1,Mt=Math.min(A,K+z)-1,ut=new Set;for(let V=$;V<=dt;V++)for(let St=K;St<=Mt;St++){const xt=N[V][St];ut.has(xt.cell.getKey())||xt.cell.__rowSpan===1&&xt.cell.__colSpan===1||(Vc(xt.cell),ut.add(xt.cell.getKey()),G=!0)}let[Nt]=me(C.getWritable(),null,null);const be=I-w+$;for(let V=0;V<be;V++)Ni(Nt[w-1][0].cell);const Ln=z-A+K;for(let V=0;V<Ln;V++)Ti(Nt[0][A-1].cell,!0,!1);[Nt]=me(C.getWritable(),null,null);for(let V=$;V<$+I;V++)for(let St=K;St<K+z;St++){const xt=V-$,we=St-K,It=k[xt][we];if(It.startRow!==xt||It.startColumn!==we)continue;const Qt=It.cell;if(Qt.__rowSpan!==1||Qt.__colSpan!==1){const zt=[],cu=Math.min(V+Qt.__rowSpan,$+I)-1,uu=Math.min(St+Qt.__colSpan,K+z)-1;for(let To=V;To<=cu;To++)for(let ko=St;ko<=uu;ko++){const fu=Nt[To][ko];zt.push(fu.cell)}qd(zt),G=!0}const{cell:Zt}=Nt[V][St],te=Qt.getBackgroundColor();te!=null&&Zt.setBackgroundColor(te);const Le=Zt.getChildren();Qt.getChildren().forEach(zt=>{F(zt)&&H().append(zt),Zt.append(zt)}),Le.forEach(zt=>zt.remove())}if(h&&G){const[V]=me(C.getWritable(),null,null);V[S.startRow][S.startColumn].cell.selectEnd()}return!0}(l[0],a):!(u&&s.peek()&&!function(f){return!!(j(f)&&!f.focus.getNode().is(f.anchor.getNode())||E(f)&&L(f.anchor.getNode())&&!f.anchor.getNode().is(f.focus.getNode()))}(a)):!1}(r,t),W),n.registerCommand(jr,mh,_n),n.registerCommand(Di,_h,W),n.registerNodeTransform(nn,ph),n.registerNodeTransform(_r,gh),n.registerNodeTransform(ln,hh))}function Sg(n){const e=window.location.origin,t=r=>{if(r.origin!==e)return;const o=n.getRootElement();if(document.activeElement!==o)return;const i=r.data;if(typeof i=="string"){let s;try{s=JSON.parse(i)}catch{return}if(s&&s.protocol==="nuanria_messaging"&&s.type==="request"){const l=s.payload;if(l&&l.functionId==="makeChanges"){const a=l.args;if(a){const[c,u,f,d,g]=a;n.update(()=>{const h=M();if(E(h)){const p=h.anchor;let _=p.getNode(),m=0,y=0;if(F(_)&&c>=0&&u>=0&&(m=c,y=c+u,h.setTextNodeRange(_,m,_,y)),m===y&&f===""||(h.insertRawText(f),_=p.getNode()),F(_)){m=d,y=d+g;const C=_.getTextContentSize();m=m>C?C:m,y=y>C?C:y,h.setTextNodeRange(_,m,_,y)}r.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function Wl(n,e){if(document.caretRangeFromPoint!==void 0){const t=document.caretRangeFromPoint(n,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(n,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}return null}const an=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,yh=an&&"documentMode"in document?document.documentMode:null,Ch=an&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Sh=!(!an||!("InputEvent"in window)||yh)&&"getTargetRanges"in new window.InputEvent("input"),xh=an&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Bl=an&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,vh=an&&/^(?=.*Chrome).*/i.test(navigator.userAgent),bh=an&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ch&&!vh,Jl=R("DRAG_DROP_PASTE_FILE");class xo extends At{static getType(){return"quote"}static clone(e){return new xo(e.__key)}createDOM(e){const t=document.createElement("blockquote");return pt(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:wh,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(nt(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();r&&(t.style.textAlign=r);const o=this.getDirection();o&&(t.dir=o)}return{element:t}}static importJSON(e){return eu().updateFromJSON(e)}insertNewAfter(e,t){const r=H(),o=this.getDirection();return r.setDirection(o),this.insertAfter(r,t),r}collapseAtStart(){const e=H();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function eu(){return Ht(new xo)}function xg(n){return n instanceof xo}class vo extends At{constructor(t="h1",r){super(r);x(this,"__tag");this.__tag=t}static getType(){return"heading"}static clone(t){return new vo(t.__tag,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__tag=t.__tag}getTag(){return this.getLatest().__tag}setTag(t){const r=this.getWritable();return r.__tag=t,r}createDOM(t){const r=this.__tag,o=document.createElement(r),i=t.theme.heading;if(i!==void 0){const s=i[r];pt(o,s)}return o}updateDOM(t,r,o){return t.__tag!==this.__tag}static importDOM(){return{h1:t=>({conversion:hn,priority:0}),h2:t=>({conversion:hn,priority:0}),h3:t=>({conversion:hn,priority:0}),h4:t=>({conversion:hn,priority:0}),h5:t=>({conversion:hn,priority:0}),h6:t=>({conversion:hn,priority:0}),p:t=>{const r=t.firstChild;return r!==null&&Hl(r)?{conversion:()=>({node:null}),priority:3}:null},span:t=>Hl(t)?{conversion:r=>({node:Hn("h1")}),priority:3}:null}}exportDOM(t){const{element:r}=super.exportDOM(t);if(nt(r)){this.isEmpty()&&r.append(document.createElement("br"));const o=this.getFormatType();o&&(r.style.textAlign=o);const i=this.getDirection();i&&(r.dir=i)}return{element:r}}static importJSON(t){return Hn(t.tag).updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTag(t.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(t,r=!0){const o=t?t.anchor.offset:0,i=this.getLastDescendant(),s=!i||t&&t.anchor.key===i.getKey()&&o===i.getTextContentSize()||!t?H():Hn(this.getTag()),l=this.getDirection();if(s.setDirection(l),this.insertAfter(s,r),o===0&&!this.isEmpty()&&t){const a=H();a.select(),this.replace(a,!0)}return s}collapseAtStart(){const t=this.isEmpty()?H():Hn(this.getTag());return this.getChildren().forEach(r=>t.append(r)),this.replace(t),!0}extractWithChild(){return!0}}function Hl(n){return n.nodeName.toLowerCase()==="span"&&n.style.fontSize==="26pt"}function hn(n){const e=n.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=Hn(e),n.style!==null&&(ls(n,t),t.setFormat(n.style.textAlign))),{node:t}}function wh(n){const e=eu();return n.style!==null&&(e.setFormat(n.style.textAlign),ls(n,e)),{node:e}}function Hn(n="h1"){return Ht(new vo(n))}function vg(n){return n instanceof vo}function Or(n){let e=null;if(Te(n,DragEvent)?e=n.dataTransfer:Te(n,ClipboardEvent)&&(e=n.clipboardData),e===null)return[!1,[],!1];const t=e.types,r=t.includes("Files"),o=t.includes("text/html")||t.includes("text/plain");return[r,Array.from(e.files),o]}function Ul(n){const e=Rt(n);return Y(e)}function Uo(n){for(const e of["lowercase","uppercase","capitalize"])n.hasFormat(e)&&n.toggleFormat(e)}function bg(n){return De(n.registerCommand(Di,e=>{const t=M();return!!Ft(t)&&(t.clear(),!0)},W),n.registerCommand(Ee,e=>{const t=M();return E(t)?(t.deleteCharacter(e),!0):!!Ft(t)&&(t.deleteNodes(),!0)},W),n.registerCommand(Nn,e=>{const t=M();return!!E(t)&&(t.deleteWord(e),!0)},W),n.registerCommand(qe,e=>{const t=M();return!!E(t)&&(t.deleteLine(e),!0)},W),n.registerCommand(Be,e=>{const t=M();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const r=e.dataTransfer;if(r!=null)El(r,t,n);else if(E(t)){const o=e.data;return o&&t.insertText(o),!0}}return!0},W),n.registerCommand(oi,()=>{const e=M();return!!E(e)&&(e.removeText(),!0)},W),n.registerCommand(_e,e=>{const t=M();return!!E(t)&&(t.formatText(e),!0)},W),n.registerCommand(va,e=>{const t=M();if(!E(t)&&!Ft(t))return!1;const r=t.getNodes();for(const o of r){const i=B(o,s=>b(s)&&!s.isInline());i!==null&&i.setFormat(e)}return!0},W),n.registerCommand(Sn,e=>{const t=M();return!!E(t)&&(t.insertLineBreak(e),!0)},W),n.registerCommand(Ye,()=>{const e=M();return!!E(e)&&(e.insertParagraph(),!0)},W),n.registerCommand(Hu,()=>{const e=Mn(),t=M();return E(t)&&(e.setFormat(t.format),e.setStyle(t.style)),Cf([e]),!0},W),n.registerCommand(Uu,()=>Sl(e=>{const t=e.getIndent();e.setIndent(t+1)}),W),n.registerCommand(Fs,()=>Sl(e=>{const t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}),W),n.registerCommand(Wi,e=>{const t=M();if(Ft(t)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),r[0].selectPrevious(),!0}else if(E(t)){const r=gi(t.focus,!0);if(!e.shiftKey&&Y(r)&&!r.isIsolated()&&!r.isInline())return r.selectPrevious(),e.preventDefault(),!0}return!1},W),n.registerCommand(Bi,e=>{const t=M();if(Ft(t)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),r[0].selectNext(0,0),!0}else if(E(t)){if(function(o){const i=o.focus;return i.key==="root"&&i.offset===ct().getChildrenSize()}(t))return e.preventDefault(),!0;const r=gi(t.focus,!1);if(!e.shiftKey&&Y(r)&&!r.isIsolated()&&!r.isInline())return r.selectNext(),e.preventDefault(),!0}return!1},W),n.registerCommand(zi,e=>{const t=M();if(Ft(t)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),ml(r[0])?r[0].selectNext(0,0):r[0].selectPrevious(),!0}if(!E(t))return!1;if(yl(t,!0)){const r=e.shiftKey;return e.preventDefault(),Cl(t,r,!0),!0}return!1},W),n.registerCommand(Ii,e=>{const t=M();if(Ft(t)){const o=t.getNodes();if(o.length>0)return e.preventDefault(),ml(o[0])?o[0].selectPrevious():o[0].selectNext(0,0),!0}if(!E(t))return!1;const r=e.shiftKey;return!!yl(t,!1)&&(e.preventDefault(),Cl(t,r,!1),!0)},W),n.registerCommand(Ji,e=>{if(Ul(e.target))return!1;const t=M();if(E(t)){if(function(r){if(!r.isCollapsed())return!1;const{anchor:o}=r;if(o.offset!==0)return!1;const i=o.getNode();if(at(i))return!1;const s=_d(i);return s.getIndent()>0&&(s.is(i)||i.is(s.getFirstDescendant()))}(t))return e.preventDefault(),n.dispatchCommand(Fs,void 0);if(Bl&&navigator.language==="ko-KR")return!1}else if(!Ft(t))return!1;return e.preventDefault(),n.dispatchCommand(Ee,!0)},W),n.registerCommand(Ui,e=>{if(Ul(e.target))return!1;const t=M();return!(!E(t)&&!Ft(t))&&(e.preventDefault(),n.dispatchCommand(Ee,!1))},W),n.registerCommand(Ur,e=>{const t=M();if(!E(t))return!1;if(Uo(t),e!==null){if((Bl||xh||bh)&&Sh)return!1;if(e.preventDefault(),e.shiftKey)return n.dispatchCommand(Sn,!1)}return n.dispatchCommand(Ye,void 0)},W),n.registerCommand(Hi,()=>{const e=M();return!!E(e)&&(n.blur(),!0)},W),n.registerCommand(xa,e=>{const[,t]=Or(e);if(t.length>0){const o=Wl(e.clientX,e.clientY);if(o!==null){const{offset:i,node:s}=o,l=Rt(s);if(l!==null){const a=fo();if(F(l))a.anchor.set(l.getKey(),i,"text"),a.focus.set(l.getKey(),i,"text");else{const u=l.getParentOrThrow().getKey(),f=l.getIndexWithinParent()+1;a.anchor.set(u,f,"element"),a.focus.set(u,f,"element")}const c=Zn(a);et(c)}n.dispatchCommand(Jl,t)}return e.preventDefault(),!0}const r=M();return!!E(r)},W),n.registerCommand(ba,e=>{const[t]=Or(e),r=M();return!(t&&!E(r))},W),n.registerCommand(wa,e=>{const[t]=Or(e),r=M();if(t&&!E(r))return!1;const o=Wl(e.clientX,e.clientY);if(o!==null){const i=Rt(o.node);Y(i)&&e.preventDefault()}return!0},W),n.registerCommand(jr,()=>(Mf(),!0),W),n.registerCommand(ao,e=>(vi(n,Te(e,ClipboardEvent)?e:null),!0),W),n.registerCommand(co,e=>(async function(t,r){await vi(r,Te(t,ClipboardEvent)?t:null),r.update(()=>{const o=M();E(o)?o.removeText():Ft(o)&&o.getNodes().forEach(i=>i.remove())})}(e,n),!0),W),n.registerCommand(Ri,e=>{const[,t,r]=Or(e);return t.length>0&&!r?(n.dispatchCommand(Jl,t),!0):se(e.target)&&Zi(e.target)?!1:M()!==null&&(function(o,i){o.preventDefault(),i.update(()=>{const s=M(),l=Te(o,InputEvent)||Te(o,KeyboardEvent)?null:o.clipboardData;l!=null&&s!==null&&El(l,s,i)},{tag:of})}(e,n),!0)},W),n.registerCommand(Sa,e=>{const t=M();return E(t)&&Uo(t),!1},W),n.registerCommand(ji,e=>{const t=M();return E(t)&&Uo(t),!1},W))}function ke(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Mi(n){let e=1,t=n.getParent();for(;t!=null;){if(U(t)){const r=t.getParent();if(J(r)){e++,t=r.getParent();continue}ke(40)}return e}return e}function Fi(n){let e=n.getParent();J(e)||ke(40);let t=e;for(;t!==null;)t=t.getParent(),J(t)&&(e=t);return e}function nu(n){let e=[];const t=n.getChildren().filter(U);for(let r=0;r<t.length;r++){const o=t[r],i=o.getFirstChild();J(i)?e=e.concat(nu(i)):e.push(o)}return e}function ne(n){return U(n)&&J(n.getFirstChild())}function jl(n){return Rn().append(n)}function ru(n,e){return U(n)&&(e.length===0||e.length===1&&n.is(e[0])&&n.getChildrenSize()===0)}function Vl(n){const e=M();if(e!==null){let t=e.getNodes();if(E(e)){const o=e.getStartEndPoints();o===null&&ke(143);const[i]=o,s=i.getNode(),l=s.getParent();if(Et(s)){const a=s.getFirstChild();if(a)t=a.selectStart().getNodes();else{const c=H();s.append(c),t=c.select().getNodes()}}else if(ru(s,t)){const a=Ue(n);if(Et(l)){s.replace(a);const c=Rn();b(s)&&(c.setFormat(s.getFormatType()),c.setIndent(s.getIndent())),a.append(c)}else if(U(s)){const c=s.getParentOrThrow();rn(a,c.getChildren()),c.replace(a)}return}}const r=new Set;for(let o=0;o<t.length;o++){const i=t[o];if(b(i)&&i.isEmpty()&&!U(i)&&!r.has(i.getKey())){Yl(i,n);continue}let s=nc(i)?i.getParent():U(i)&&i.isEmpty()?i:null;for(;s!=null;){const l=s.getKey();if(J(s)){if(!r.has(l)){const a=Ue(n);rn(a,s.getChildren()),s.replace(a),r.add(l)}break}{const a=s.getParent();if(Et(a)&&!r.has(l)){r.add(l),Yl(s,n);break}s=a}}}}}function rn(n,e){n.splice(n.getChildrenSize(),0,e)}function Yl(n,e){if(J(n))return n;const t=n.getPreviousSibling(),r=n.getNextSibling(),o=Rn();let i;if(rn(o,n.getChildren()),J(t)&&e===t.getListType())t.append(o),J(r)&&e===r.getListType()&&(rn(t,r.getChildren()),r.remove()),i=t;else if(J(r)&&e===r.getListType())r.getFirstChildOrThrow().insertBefore(o),i=r;else{const l=Ue(e);l.append(o),n.replace(l),i=l}o.setFormat(n.getFormatType()),o.setIndent(n.getIndent());const s=M();return E(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 Cs(n,e){const t=n.getLastChild(),r=e.getFirstChild();t&&r&&ne(t)&&ne(r)&&(Cs(t.getFirstChild(),r.getFirstChild()),r.remove());const o=e.getChildren();o.length>0&&n.append(...o),e.remove()}function Nh(){const n=M();if(E(n)){const e=new Set,t=n.getNodes(),r=n.anchor.getNode();if(ru(r,t))e.add(Fi(r));else for(let o=0;o<t.length;o++){const i=t[o];if(nc(i)){const s=pd(i,bo);s!=null&&e.add(Fi(s))}}for(const o of e){let i=o;const s=nu(o);for(const l of s){const a=H().setTextStyle(n.style).setTextFormat(n.format);rn(a,l.getChildren()),i.insertAfter(a),i=a,l.__key===n.anchor.key&&jt(n.anchor,kt(vt(a,"next"))),l.__key===n.focus.key&&jt(n.focus,kt(vt(a,"next"))),l.remove()}o.remove()}}}function ou(n){const e=n.getListType()!=="check";let t=n.getStart();for(const r of n.getChildren())U(r)&&(r.getValue()!==t&&r.setValue(t),e&&r.getLatest().__checked!=null&&r.setChecked(void 0),J(r.getFirstChild())||t++)}function Th(n){const e=new Set;if(ne(n)||e.has(n.getKey()))return;const t=n.getParent(),r=n.getNextSibling(),o=n.getPreviousSibling();if(ne(r)&&ne(o)){const i=o.getFirstChild();if(J(i)){i.append(n);const s=r.getFirstChild();J(s)&&(rn(i,s.getChildren()),r.remove(),e.add(r.getKey()))}}else if(ne(r)){const i=r.getFirstChild();if(J(i)){const s=i.getFirstChild();s!==null&&s.insertBefore(n)}}else if(ne(o)){const i=o.getFirstChild();J(i)&&i.append(n)}else if(J(t)){const i=$t(n),s=$t(t);i.append(s),s.append(n),o?o.insertAfter(i):r?r.insertBefore(i):t.append(i)}}function kh(n){if(ne(n))return;const e=n.getParent(),t=e?e.getParent():void 0;if(J(t?t.getParent():void 0)&&U(t)&&J(e)){const r=e?e.getFirstChild():void 0,o=e?e.getLastChild():void 0;if(n.is(r))t.insertBefore(n),e.isEmpty()&&t.remove();else if(n.is(o))t.insertAfter(n),e.isEmpty()&&t.remove();else{const i=$t(n),s=$t(e);i.append(s),n.getPreviousSiblings().forEach(c=>s.append(c));const l=$t(n),a=$t(e);l.append(a),rn(a,n.getNextSiblings()),t.insertBefore(i),t.insertAfter(l),t.replace(n)}}}function Eh(n=!1){const e=M();if(!E(e)||!e.isCollapsed())return!1;const t=e.anchor.getNode();let r=null;if(U(t)&&t.getChildrenSize()===0)r=t;else if(F(t)){const c=t.getParent();U(c)&&c.getChildren().every(u=>F(u)&&u.getTextContent().trim()==="")&&(r=c)}if(r===null)return!1;const o=Fi(r),i=r.getParent();J(i)||ke(40);const s=i.getParent();let l;if(Et(s))l=H(),o.insertAfter(l);else{if(!U(s))return!1;l=$t(s),s.insertAfter(l)}l.setTextStyle(e.style).setTextFormat(e.format).select();const a=r.getNextSiblings();if(a.length>0){const c=n?function(f,d){return f.getStart()+d.getIndexWithinParent()}(i,r):1,u=$t(i).setStart(c);if(U(l)){const f=$t(l);f.append(u),l.insertAfter(f)}else l.insertAfter(u);u.append(...a)}return function(c){let u=c;for(;u.getNextSibling()==null&&u.getPreviousSibling()==null;){const f=u.getParent();if(f==null||!U(f)&&!J(f))break;u=f}u.remove()}(r),!0}class bo extends At{constructor(t=1,r=void 0,o){super(o);x(this,"__value");x(this,"__checked");this.__value=t===void 0?1:t,this.__checked=r}$config(){return this.config("listitem",{$transform:t=>{if(t.__checked==null)return;const r=t.getParent();J(r)&&r.getListType()!=="check"&&t.getChecked()!=null&&t.setChecked(void 0)},extends:At,importDOM:{li:()=>({conversion:Oh,priority:0})}})}afterCloneFrom(t){super.afterCloneFrom(t),this.__value=t.__value,this.__checked=t.__checked}createDOM(t){const r=document.createElement("li");return this.updateListItemDOM(null,r,t),r}updateListItemDOM(t,r,o){(function(l,a,c){const u=a.getParent();!J(u)||u.getListType()!=="check"||J(a.getFirstChild())?(l.removeAttribute("role"),l.removeAttribute("tabIndex"),l.removeAttribute("aria-checked")):(l.setAttribute("role","checkbox"),l.setAttribute("tabIndex","-1"),c&&a.__checked===c.__checked||l.setAttribute("aria-checked",a.getChecked()?"true":"false"))})(r,this,t),r.value=this.__value,function(l,a,c){const u=[],f=[],d=a.list,g=d?d.listitem:void 0;let h;if(d&&d.nested&&(h=d.nested.listitem),g!==void 0&&u.push(...Pe(g)),d){const p=c.getParent(),_=J(p)&&p.getListType()==="check",m=c.getChecked();_&&!m||f.push(d.listitemUnchecked),_&&m||f.push(d.listitemChecked),_&&u.push(m?d.listitemChecked:d.listitemUnchecked)}if(h!==void 0){const p=Pe(h);c.getChildren().some(_=>J(_))?u.push(...p):f.push(...p)}f.length>0&&ye(l,...f),u.length>0&&pt(l,...u)}(r,o.theme,this);const i=t?t.__style:"",s=this.__style;i!==s&&(s===""?r.removeAttribute("style"):r.style.cssText=s),function(l,a,c){const u=_l(a.__textStyle);for(const f in u)l.style.setProperty(`--listitem-marker-${f}`,u[f]);if(c)for(const f in _l(c.__textStyle))f in u||l.style.removeProperty(`--listitem-marker-${f}`)}(r,this,t)}updateDOM(t,r,o){const i=r;return this.updateListItemDOM(t,i,o),!1}updateFromJSON(t){return super.updateFromJSON(t).setValue(t.value).setChecked(t.checked)}exportDOM(t){const r=this.createDOM(t._config),o=this.getFormatType();o&&(r.style.textAlign=o);const i=this.getDirection();return i&&(r.dir=i),{element:r}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...t){for(let r=0;r<t.length;r++){const o=t[r];if(b(o)&&this.canMergeWith(o)){const i=o.getChildren();this.append(...i),o.remove()}else super.append(o)}return this}replace(t,r){if(U(t))return super.replace(t);this.setIndent(0);const o=this.getParentOrThrow();if(!J(o))return t;if(o.__first===this.getKey())o.insertBefore(t);else if(o.__last===this.getKey())o.insertAfter(t);else{const i=$t(o);let s=this.getNextSibling();for(;s;){const l=s;s=s.getNextSibling(),i.append(l)}o.insertAfter(t),t.insertAfter(i)}return r&&(b(t)||ke(139),this.getChildren().forEach(i=>{t.append(i)})),this.remove(),o.getChildrenSize()===0&&o.remove(),t}insertAfter(t,r=!0){const o=this.getParentOrThrow();if(J(o)||ke(39),U(t))return super.insertAfter(t,r);const i=this.getNextSiblings();if(o.insertAfter(t,r),i.length!==0){const s=$t(o);i.forEach(l=>s.append(l)),t.insertAfter(s,r)}return t}remove(t){const r=this.getPreviousSibling(),o=this.getNextSibling();super.remove(t),r&&o&&ne(r)&&ne(o)&&(Cs(r.getFirstChild(),o.getFirstChild()),o.remove())}resetOnCopyNodeFrom(t){super.resetOnCopyNodeFrom(t),t.getChecked()&&this.setChecked(!1)}insertNewAfter(t,r=!0){const o=$t(this);return this.insertAfter(o,r),o}collapseAtStart(t){const r=H();this.getChildren().forEach(l=>r.append(l));const o=this.getParentOrThrow(),i=o.getParentOrThrow(),s=U(i);if(o.getChildrenSize()===1)if(s)o.remove(),i.select();else{o.insertBefore(r),o.remove();const l=t.anchor,a=t.focus,c=r.getKey();l.type==="element"&&l.getNode().is(this)&&l.set(c,l.offset,"element"),a.type==="element"&&a.getNode().is(this)&&a.set(c,a.offset,"element")}else o.insertBefore(r),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(t){const r=this.getWritable();return r.__value=t,r}getChecked(){const t=this.getLatest();let r;const o=this.getParent();return J(o)&&(r=o.getListType()),r==="check"?!!t.__checked:void 0}setChecked(t){const r=this.getWritable();return r.__checked=t,r}toggleChecked(){const t=this.getWritable();return t.setChecked(!t.__checked)}getIndent(){const t=this.getParent();if(t===null||!this.isAttached())return this.getLatest().__indent;let r=t.getParentOrThrow(),o=0;for(;U(r);)r=r.getParentOrThrow().getParentOrThrow(),o++;return o}setIndent(t){typeof t!="number"&&ke(117),(t=Math.floor(t))>=0||ke(199);let r=this.getIndent();for(;r!==t;)r<t?(Th(this),r++):(kh(this),r--);return this}canInsertAfter(t){return U(t)}canReplaceWith(t){return U(t)}canMergeWith(t){return U(t)||fr(t)}extractWithChild(t,r){if(!E(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 Ue("bullet")}canMergeWhenEmpty(){return!0}}function Oh(n){if(n.classList.contains("task-list-item")){for(const t of n.children)if(t.tagName==="INPUT")return ql(t)}if(n.classList.contains("joplin-checkbox")){for(const t of n.children)if(t.classList.contains("checkbox-wrapper")&&t.children.length>0&&t.children[0].tagName==="INPUT")return ql(t.children[0])}const e=n.getAttribute("aria-checked");return{node:Rn(e==="true"||e!=="false"&&void 0)}}function ql(n){return n.getAttribute("type")!=="checkbox"?{node:null}:{node:Rn(n.hasAttribute("checked"))}}function Rn(n){return Ht(new bo(void 0,n))}function U(n){return n instanceof bo}class Ss extends At{constructor(t="number",r=1,o){super(o);x(this,"__tag");x(this,"__start");x(this,"__listType");const i=Mh[t]||t;this.__listType=i,this.__tag=i==="number"?"ol":"ul",this.__start=r}$config(){return this.config("list",{$transform:t=>{(function(r){const o=r.getNextSibling();J(o)&&r.getListType()===o.getListType()&&Cs(r,o)})(t),ou(t)},extends:At,importDOM:{ol:()=>({conversion:Gl,priority:0}),ul:()=>({conversion:Gl,priority:0})}})}afterCloneFrom(t){super.afterCloneFrom(t),this.__listType=t.__listType,this.__tag=t.__tag,this.__start=t.__start}getTag(){return this.getLatest().__tag}setListType(t){const r=this.getWritable();return r.__listType=t,r.__tag=t==="number"?"ol":"ul",r}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(t){const r=this.getWritable();return r.__start=t,r}createDOM(t,r){const o=this.__tag,i=document.createElement(o);return this.__start!==1&&i.setAttribute("start",String(this.__start)),i.__lexicalListType=this.__listType,Xl(i,t.theme,this),i}updateDOM(t,r,o){return t.__tag!==this.__tag||t.__listType!==this.__listType||(Xl(r,o.theme,this),t.__start!==this.__start&&r.setAttribute("start",String(this.__start)),!1)}updateFromJSON(t){return super.updateFromJSON(t).setListType(t.listType).setStart(t.start)}exportDOM(t){const r=this.createDOM(t._config,t);return nt(r)&&(this.__start!==1&&r.setAttribute("start",String(this.__start)),this.__listType==="check"&&r.setAttribute("__lexicalListType","check")),{element:r}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(t,r,o){const i=o.find(U)??this.getChildren().find(U),s=i?()=>$t(i):Rn;let l=o;for(let a=0;a<o.length;a++){const c=o[a];U(c)||(l===o&&(l=[...o]),l[a]=s().append(!b(c)||J(c)||c.isInline()?c:st(c.getTextContent())))}return super.splice(t,r,l)}extractWithChild(t){return U(t)}}function Xl(n,e,t){const r=[],o=[],i=e.list;if(i!==void 0){const s=i[`${t.__tag}Depth`]||[],l=Mi(t)-1,a=l%s.length,c=s[a],u=i[t.__tag];let f;const d=i.nested,g=i.checklist;if(d!==void 0&&d.list&&(f=d.list),u!==void 0&&r.push(u),g!==void 0&&t.__listType==="check"&&r.push(g),c!==void 0){r.push(...Pe(c));for(let h=0;h<s.length;h++)h!==a&&o.push(t.__tag+h)}if(f!==void 0){const h=Pe(f);l>1?r.push(...h):o.push(...h)}}o.length>0&&ye(n,...o),r.length>0&&pt(n,...r)}function Ah(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t];if(U(r)){e.push(r);const o=r.getChildren();o.length>1&&o.forEach(i=>{J(i)&&e.push(jl(i))})}else e.push(jl(r))}return e}function Gl(n){const e=n.nodeName.toLowerCase();let t=null;return e==="ol"?t=Ue("number",n.start):e==="ul"&&(t=function(r){if(r.getAttribute("__lexicallisttype")==="check"||r.classList.contains("contains-task-list")||r.getAttribute("data-is-checklist")==="1")return!0;for(const o of r.childNodes)if(nt(o)&&o.hasAttribute("aria-checked"))return!0;return!1}(n)?Ue("check"):Ue("bullet")),{after:Ah,node:t}}const Mh={ol:"number",ul:"bullet"};function Ue(n="number",e=1){return Ht(new Ss(n,e))}function J(n){return n instanceof Ss}const Fh=R("UPDATE_LIST_START_COMMAND"),$h=R("INSERT_UNORDERED_LIST_COMMAND"),Ph=R("INSERT_ORDERED_LIST_COMMAND"),Dh=R("REMOVE_LIST_COMMAND");function wg(n,e){return De(n.registerCommand(Ph,()=>(Vl("number"),!0),_n),n.registerCommand(Fh,t=>{const{listNodeKey:r,newStart:o}=t,i=tt(r);return!!J(i)&&(i.getListType()==="number"&&(i.setStart(o),ou(i)),!0)},_n),n.registerCommand($h,()=>(Vl("bullet"),!0),_n),n.registerCommand(Dh,()=>(Nh(),!0),_n),n.registerCommand(Ye,()=>Eh(!1),_n),n.registerNodeTransform(bo,t=>{const r=t.getFirstChild();if(r){if(F(r)){const o=r.getStyle(),i=r.getFormat();t.getTextStyle()!==o&&t.setTextStyle(o),t.getTextFormat()!==i&&t.setTextFormat(i)}}else{const o=M();E(o)&&(o.style!==t.getTextStyle()||o.format!==t.getTextFormat())&&o.isCollapsed()&&t.is(o.anchor.getNode())&&t.setTextStyle(o.style).setTextFormat(o.format)}}),n.registerNodeTransform(xe,t=>{const r=t.getParent();if(U(r)&&t.is(r.getFirstChild())){const o=t.getStyle(),i=t.getFormat();o===r.getTextStyle()&&i===r.getTextFormat()||r.setTextStyle(o).setTextFormat(i)}}))}function Ng(n){const e=t=>{const r=t.getParent();if(J(t.getFirstChild())||!J(r))return;const o=B(t,i=>U(i)&&J(i.getParent())&&U(i.getPreviousSibling()));if(o===null&&t.getIndent()>0)t.setIndent(0);else if(U(o)){const i=o.getPreviousSibling();if(U(i)){const s=function(a){let c=a,u=c.getFirstChild();for(;J(u);){const f=u.getLastChild();if(!U(f))break;c=f,u=c.getFirstChild()}return c}(i),l=s.getParent();if(J(l)){const a=Mi(l);a+1<Mi(r)&&t.setIndent(a)}}}};return n.registerNodeTransform(Ss,t=>{const r=[t];for(;r.length>0;){const o=r.shift();if(J(o)){for(const i of o.getChildren())if(U(i)){e(i);const s=i.getFirstChild();J(s)&&r.push(s)}}}})}function iu(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function su(n,e){let t=n;for(let r=it(n,e);r&&(de(r.origin)||cr(r.origin));r=r.getAdjacentCaret())t=r.origin;return t}function Rh(n){return su(n,"previous")}function Lh(n){return su(n,"next")}function Tg(n,e){let t=null,r=null,o=n,i=e,s=n.getTextContent();for(;;){if(i===0){if(o=o.getPreviousSibling(),o===null)break;if(de(o)||cr(o)||Jt(o)||iu(167),Jt(o)){t={node:o,offset:1};break}i=Math.max(0,o.getTextContentSize()-1),s=o.getTextContent()}else i--;const a=s[i];de(o)&&a!==" "&&(r={node:o,offset:i})}if(r!==null)return r;let l=null;if(e<n.getTextContentSize())de(n)&&(l=n.getTextContent()[e]);else{const a=n.getNextSibling();de(a)&&(l=a.getTextContent()[0])}if(l!==null&&l!==" ")return t;{const a=function(c,u){let f=c,d=u,g=c.getTextContent(),h=c.getTextContentSize();for(;;){if(!de(f)||d===h){if(f=f.getNextSibling(),f===null||Jt(f))return null;de(f)&&(d=0,g=f.getTextContent(),h=f.getTextContentSize())}if(de(f)){if(g[d]!==" ")return{node:f,offset:d};d++}}}(n,e);return a!==null?a:t}}function kg(n){const e=Lh(n);return Jt(e)&&iu(168),e}const Eg="javascript";function lu(n,e){for(const t of n.childNodes){if(nt(t)&&t.tagName===e)return!0;lu(t,e)}return!1}const Un="data-language",Wn="data-highlight-language",Ar="data-theme";class wo extends At{constructor(t,r){super(r);x(this,"__language");x(this,"__theme");x(this,"__isSyntaxHighlightSupported");this.__language=t||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}static getType(){return"code"}static clone(t){return new wo(t.__language,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__language=t.__language,this.__theme=t.__theme,this.__isSyntaxHighlightSupported=t.__isSyntaxHighlightSupported}createDOM(t){const r=document.createElement("code");pt(r,t.theme.code),r.setAttribute("spellcheck","false");const o=this.getLanguage();o&&(r.setAttribute(Un,o),this.getIsSyntaxHighlightSupported()&&r.setAttribute(Wn,o));const i=this.getTheme();i&&r.setAttribute(Ar,i);const s=this.getStyle();return s&&r.setAttribute("style",s),r}updateDOM(t,r,o){const i=this.__language,s=t.__language;i?i!==s&&r.setAttribute(Un,i):s&&r.removeAttribute(Un);const l=this.__isSyntaxHighlightSupported;t.__isSyntaxHighlightSupported&&s?l&&i?i!==s&&r.setAttribute(Wn,i):r.removeAttribute(Wn):l&&i&&r.setAttribute(Wn,i);const a=this.__theme,c=t.__theme;a?a!==c&&r.setAttribute(Ar,a):c&&r.removeAttribute(Ar);const u=this.__style,f=t.__style;return u?u!==f&&r.setAttribute("style",u):f&&r.removeAttribute("style"),!1}exportDOM(t){const r=document.createElement("pre");pt(r,t._config.theme.code),r.setAttribute("spellcheck","false");const o=this.getLanguage();o&&(r.setAttribute(Un,o),this.getIsSyntaxHighlightSupported()&&r.setAttribute(Wn,o));const i=this.getTheme();i&&r.setAttribute(Ar,i);const s=this.getStyle();return s&&r.setAttribute("style",s),{element:r}}static importDOM(){return{code:t=>t.textContent!=null&&(/\r?\n/.test(t.textContent)||lu(t,"BR"))?{conversion:Ql,priority:1}:null,div:()=>({conversion:Ih,priority:1}),pre:()=>({conversion:Ql,priority:0}),table:t=>jo(t)?{conversion:zh,priority:3}:null,td:t=>{const r=t,o=r.closest("table");return r.classList.contains("js-file-line")||o&&jo(o)?{conversion:Zl,priority:3}:null},tr:t=>{const r=t.closest("table");return r&&jo(r)?{conversion:Zl,priority:3}:null}}}static importJSON(t){return mr().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setLanguage(t.language).setTheme(t.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(t,r=!0){const o=this.getChildren(),i=o.length;if(i>=2&&o[i-1].getTextContent()===`
15
+ `&&o[i-2].getTextContent()===`
16
+ `&&t.isCollapsed()&&t.anchor.key===this.__key&&t.anchor.offset===i){o[i-1].remove(),o[i-2].remove();const c=H();return this.insertAfter(c,r),c}const{anchor:s,focus:l}=t,a=(s.isBefore(l)?s:l).getNode();if(F(a)){let c=Rh(a);const u=[];for(;;)if(cr(c))u.push(Mn()),c=c.getNextSibling();else{if(!de(c))break;{let m=0;const y=c.getTextContent(),C=c.getTextContentSize();for(;m<C&&y[m]===" ";)m++;if(m!==0&&u.push(au(" ".repeat(m))),m!==C)break;c=c.getNextSibling()}}const f=a.splitText(s.offset)[0],d=s.offset===0?0:1,g=f.getIndexWithinParent()+d,h=a.getParentOrThrow(),p=[Ce(),...u];h.splice(g,0,p);const _=u[u.length-1];_?_.select():s.offset===0?f.selectPrevious():f.getNextSibling().selectNext(0,0)}if(Kh(a)){const{offset:c}=t.anchor;a.splice(c,0,[Ce()]),a.select(c+1,c+1)}return null}canIndent(){return!1}collapseAtStart(){const t=H();return this.getChildren().forEach(r=>t.append(r)),this.replace(t),!0}setLanguage(t){const r=this.getWritable();return r.__language=t||void 0,r}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(t){const r=this.getWritable();return r.__isSyntaxHighlightSupported=t,r}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(t){const r=this.getWritable();return r.__theme=t||void 0,r}getTheme(){return this.getLatest().__theme}}function mr(n,e){return zf(wo).setLanguage(n).setTheme(e)}function Kh(n){return n instanceof wo}function Ql(n){return{node:mr(n.getAttribute(Un))}}function Ih(n){const e=n,t=ta(e);return t||function(r){let o=r.parentElement;for(;o!==null;){if(ta(o))return!0;o=o.parentElement}return!1}(e)?{node:t?mr():null}:{node:null}}function zh(){return{node:mr()}}function Zl(){return{node:null}}function ta(n){return n.style.fontFamily.match("monospace")!==null}function jo(n){return n.classList.contains("js-file-line-container")}class No extends xe{constructor(t="",r,o){super(t,o);x(this,"__highlightType");this.__highlightType=r}static getType(){return"code-highlight"}static clone(t){return new No(t.__text,t.__highlightType||void 0,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__highlightType=t.__highlightType}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(t){const r=this.getWritable();return r.__highlightType=t||void 0,r}canHaveFormat(){return!1}createDOM(t){const r=super.createDOM(t),o=Vo(t.theme,this.__highlightType);return pt(r,o),r}updateDOM(t,r,o){const i=super.updateDOM(t,r,o),s=Vo(o.theme,t.__highlightType),l=Vo(o.theme,this.__highlightType);return s!==l&&(s&&ye(r,s),l&&pt(r,l)),i}static importJSON(t){return au().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setHighlightType(t.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(t){return this}isParentRequired(){return!0}createParentElementNode(){return mr()}}function Vo(n,e){return e&&n&&n.codeHighlight&&n.codeHighlight[e]}function au(n="",e){return Ht(new No(n,e))}function de(n){return n instanceof No}export{M as $,At as A,et as B,Zn as C,Ri as D,Ur as E,Va as F,B as G,_n as H,ao as I,Ba as J,Hd as K,Y as L,Ji as M,ji as N,Ft as O,tt as P,Nf as Q,j as R,Ca as S,zi as T,Hi as U,H as V,Vn as W,Wt as X,fr as Y,Wi as Z,Hc as _,pt as a,mc as a$,Bi as a0,W as a1,fi as a2,rf as a3,Vl as a4,U as a5,J as a6,Zh as a7,de as a8,Cf as a9,Xh as aA,Ki as aB,Li as aC,_e as aD,tg as aE,pe as aF,Xt as aG,oe as aH,$e as aI,vt as aJ,og as aK,jh as aL,tc as aM,Be as aN,wt as aO,wo as aP,No as aQ,Hu as aR,Mn as aS,Uu as aT,Fs as aU,Ju as aV,Bu as aW,Rh as aX,Lh as aY,Dt as aZ,_c as a_,Di as aa,vo as ab,xo as ac,Ce as ad,eu as ae,vg as af,Hn as ag,bg as ah,ad as ai,Sg as aj,Dd as ak,Sn as al,Ye as am,di as an,Jt as ao,vf as ap,ga as aq,Rt as ar,Et as as,ng as at,Bh as au,Jh as av,Hh as aw,Vh as ax,Yh as ay,Uh as az,Gh as b,kt as b0,it as b1,Ze as b2,cr as b3,Tg as b4,kg as b5,Eg as b6,au as b7,Ss as b8,bo as b9,Yd as bA,md as bB,lg as bC,rt as bD,lf as bE,me as bF,cg as bG,ug as bH,fg as bI,dg as bJ,lt as bK,ag as bL,rg as bM,_d as bN,ro as bO,_t as bP,qd as bQ,hg as bR,An as bS,mr as bT,fh as bU,yr as bV,Cr as bW,wg as ba,Ng as bb,xa as bc,Jl as bd,nn as be,_r as bf,ln as bg,mg as bh,_g as bi,Cg as bj,yg as bk,sg as bl,jc as bm,en as bn,Dl as bo,Xc as bp,ye as bq,at as br,pd as bs,Ue as bt,Ph as bu,$h as bv,Rn as bw,Df as bx,Lt as by,En as bz,b as c,nt as d,Ga as e,L as f,ot as g,xg as h,eg as i,Rd as j,Ht as k,xe as l,fo as m,R as n,Gd as o,st as p,Af as q,De as r,sf as s,Qh as t,ui as u,Ii as v,E as w,Kh as x,F as y,ct as z};