"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1703],{4610:(e,t,n)=>{n.d(t,{JT:()=>o,k9:()=>i,o6:()=>a});class r{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}}let l=new r,s=!0;try{"undefined"!=typeof localStorage&&localStorage&&(l=localStorage,s=!1)}catch(e){}let o=l,i=e=>s||addEventListener("storage",e),a=e=>s||removeEventListener("storage",e)},13293:(e,t,n)=>{n.d(t,{G:()=>C});var r=n(69717),l=n(30889),s=n(32532),o=n(92749);let i=[];class a extends s.fGB{static getType(){return"mark"}static clone(e){return new a(e.__ids,e.__key)}static importDOM(){return null}static importJSON(e){return c().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIDs(e.ids)}exportJSON(){return{...super.exportJSON(),ids:this.getIDs()}}constructor(e=i,t){super(t),this.__ids=e}createDOM(e){let t=document.createElement("mark");return(0,o.ZB)(t,e.theme.mark),this.__ids.length>1&&(0,o.ZB)(t,e.theme.markOverlap),t}updateDOM(e,t,n){let r=e.__ids,l=this.__ids,s=r.length,i=l.length,a=n.theme.markOverlap;return s!==i&&(1===s?2===i&&(0,o.ZB)(t,a):1===i&&(0,o.HE)(t,a)),!1}hasID(e){return this.getIDs().includes(e)}getIDs(){return Array.from(this.getLatest().__ids)}setIDs(e){let t=this.getWritable();return t.__ids=e,t}addID(e){let t=this.getWritable();return t.__ids.includes(e)?t:t.setIDs([...t.__ids,e])}deleteID(e){let t=this.getWritable(),n=t.__ids.indexOf(e);if(-1===n)return t;let r=Array.from(t.__ids);return r.splice(n,1),t.setIDs(r)}insertNewAfter(e,t=!0){let n=c(this.__ids);return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!(0,s.I2P)(t)||"html"===n)return!1;let r=t.anchor,l=t.focus,o=r.getNode(),i=l.getNode(),a=t.isBackward()?r.offset-l.offset:l.offset-r.offset;return this.isParentOf(o)&&this.isParentOf(i)&&this.getTextContent().length===a}excludeFromCopy(e){return"clone"!==e}}function c(e=i){return(0,s.pTq)(new a(e))}var u=n(41747),f=n(12115),d=n(95155);let h=Object.freeze({"	":"\\t","\n":"\\n"}),g=RegExp(Object.keys(h).join("|"),"g"),p=Object.freeze({ancestorHasNextSibling:"|",ancestorIsLastChild:" ",hasNextSibling:"├",isLastChild:"└",selectedChar:"^",selectedLine:">"}),m=[e=>e.hasFormat("bold")&&"Bold",e=>e.hasFormat("code")&&"Code",e=>e.hasFormat("italic")&&"Italic",e=>e.hasFormat("strikethrough")&&"Strikethrough",e=>e.hasFormat("subscript")&&"Subscript",e=>e.hasFormat("superscript")&&"Superscript",e=>e.hasFormat("underline")&&"Underline",e=>e.hasFormat("highlight")&&"Highlight"],y=[e=>e.hasTextFormat("bold")&&"Bold",e=>e.hasTextFormat("code")&&"Code",e=>e.hasTextFormat("italic")&&"Italic",e=>e.hasTextFormat("strikethrough")&&"Strikethrough",e=>e.hasTextFormat("subscript")&&"Subscript",e=>e.hasTextFormat("superscript")&&"Superscript",e=>e.hasTextFormat("underline")&&"Underline",e=>e.hasTextFormat("highlight")&&"Highlight"],_=[e=>e.isDirectionless()&&"Directionless",e=>e.isUnmergeable()&&"Unmergeable"],b=[e=>e.isToken()&&"Token",e=>e.isSegmented()&&"Segmented"];function v(e,t=!1){let n=Object.entries(h).reduce((e,[t,n])=>e.replace(RegExp(t,"g"),String(n)),e);return t?n.replace(/[^\s]/g,"*"):n}function w(e){let t=m.map(t=>t(e)).filter(Boolean).join(", ").toLocaleLowerCase();return""!==t&&(t="format: "+t),t}let x=(0,f.forwardRef)(function({treeTypeButtonClassName:e,timeTravelButtonClassName:t,timeTravelPanelSliderClassName:n,timeTravelPanelButtonClassName:r,viewClassName:l,timeTravelPanelClassName:s,editorState:o,setEditorState:i,setEditorReadOnly:a,generateContent:c,commandsLog:u=[]},h){let[g,p]=(0,f.useState)([]),[m,y]=(0,f.useState)(""),[_,b]=(0,f.useState)(!1),[v,w]=(0,f.useState)(!1),x=(0,f.useRef)(0),C=(0,f.useRef)(null),[S,k]=(0,f.useState)(!1),[E,T]=(0,f.useState)(!1),[N,I]=(0,f.useState)(!1),F=(0,f.useRef)(),O=(0,f.useRef)([]),D=(0,f.useRef)(0),P=(0,f.useCallback)(e=>{let t=++D.current;c(e).then(e=>{t===D.current&&y(e)}).catch(e=>{t===D.current&&y(`Error rendering tree: ${e.message}

Stack:
${e.stack}`)})},[c]);(0,f.useEffect)(()=>{if((N||!(o._nodeMap.size>1e3)||(T(!0),N))&&(F.current!==o||O.current!==u)){let e=F.current!==o;F.current=o,O.current=u,P(v),!_&&e&&p(e=>[...e,[Date.now(),o]])}},[o,P,v,N,_,u]);let A=g.length;return(0,f.useEffect)(()=>{if(S){let e,t=()=>{let n=x.current;if(n===A-1)return void k(!1);let r=g[n][0];e=setTimeout(()=>{x.current++;let e=x.current,n=C.current;null!==n&&(n.value=String(e)),i(g[e][1]),t()},g[n+1][0]-r)};return t(),()=>{clearTimeout(e)}}},[g,S,A,i]),(0,d.jsxs)("div",{className:l,children:[!N&&E?(0,d.jsxs)("div",{style:{padding:20},children:[(0,d.jsx)("span",{style:{marginRight:20},children:"Detected large EditorState, this can impact debugging performance."}),(0,d.jsx)("button",{onClick:()=>{I(!0)},style:{background:"transparent",border:"1px solid white",color:"white",cursor:"pointer",padding:5},children:"Show full tree"})]}):null,N?null:(0,d.jsx)("button",{onClick:()=>(P(!v),void w(!v)),className:e,type:"button",children:v?"Tree":"Export DOM"}),!_&&(N||!E)&&A>2&&(0,d.jsx)("button",{onClick:()=>{a(!0),x.current=A-1,b(!0)},className:t,type:"button",children:"Time Travel"}),(N||!E)&&(0,d.jsx)("pre",{ref:h,children:m}),_&&(N||!E)&&(0,d.jsxs)("div",{className:s,children:[(0,d.jsx)("button",{className:r,onClick:()=>{x.current===A-1&&(x.current=1),k(!S)},type:"button",children:S?"Pause":"Play"}),(0,d.jsx)("input",{className:n,ref:C,onChange:e=>{let t=Number(e.target.value),n=g[t];n&&(x.current=t,i(n[1]))},type:"range",min:"1",max:A-1}),(0,d.jsx)("button",{className:r,onClick:()=>{a(!1);let e=g.length-1;i(g[e][1]);let t=C.current;null!==t&&(t.value=String(e)),b(!1),k(!1)},type:"button",children:"Exit"})]})]})});function C({treeTypeButtonClassName:e,timeTravelButtonClassName:t,timeTravelPanelSliderClassName:n,timeTravelPanelButtonClassName:i,timeTravelPanelClassName:c,viewClassName:h,editor:m,customPrintNode:C}){let S=f.createRef(),[k,E]=(0,f.useState)(m.getEditorState()),T=function(e){let[t,n]=(0,f.useState)([]);return(0,f.useEffect)(()=>(function(e,t){let n=new Set,r=0;for(let[l]of e._commands)n.add(e.registerCommand(l,e=>(t(t=>{let n=[...t];return n.push({index:r+=1,payload:e,type:l.type?l.type:"UNKNOWN"}),n.length>10&&n.shift(),n}),!1),s.da8));return()=>n.forEach(e=>e())})(e,n),[e]),(0,f.useMemo)(()=>t,[t])}(m);return(0,f.useEffect)(()=>(0,o.Sd)(m.registerUpdateListener(({editorState:e})=>{E(e)}),m.registerEditableListener(()=>{E(m.getEditorState())})),[m]),(0,f.useEffect)(()=>{let e=S.current;if(null!==e)return e.__lexicalEditor=m,()=>{e.__lexicalEditor=null}},[m,S]),(0,d.jsx)(x,{treeTypeButtonClassName:e,timeTravelButtonClassName:t,timeTravelPanelSliderClassName:n,timeTravelPanelButtonClassName:i,viewClassName:h,timeTravelPanelClassName:c,setEditorReadOnly:e=>{let t=m.getRootElement();null!=t&&(t.contentEditable=e?"false":"true")},editorState:k,setEditorState:e=>m.setEditorState(e),generateContent:async function(e){return function(e,t,n,o,i=!1){let c=e.getEditorState(),f=e._config,d=e._compositionKey,h=e._editable;if(n){let t="";return c.read(()=>{t=function(e){let t=document.createElement("div");return t.innerHTML=e.trim(),function e(t,n){let r,l=Array(1+n++).join("  "),s=Array(n-1).join("  ");for(let o=0;o<t.children.length;o++)r=document.createTextNode("\n"+l),t.insertBefore(r,t.children[o]),e(t.children[o],n),t.lastElementChild===t.children[o]&&(r=document.createTextNode("\n"+s),t.appendChild(r));return t}(t,0).innerHTML}((0,r.g)(e))}),t}let m=" root\n",x=c.read(()=>{let e=(0,s.vJq)();return function e(t,n,r=[]){let l=t.getChildren(),o=l.length;l.forEach((t,l)=>{n(t,r.concat(l===o-1?p.isLastChild:p.hasNextSibling)),(0,s.ff4)(t)&&e(t,n,r.concat(l===o-1?p.ancestorIsLastChild:p.ancestorHasNextSibling))})}((0,s.NiT)(),(t,n)=>{let r=`(${t.getKey()})`,c=t.getType()||"",u=t.isSelected();m+=`${u?p.selectedLine:" "} ${n.join(" ")} ${r} ${c} ${function(e,t,n=!1){let r=t?t(e,n):void 0;if(void 0!==r&&r.length>0)return r;if((0,s.kFe)(e)){var o,i;let t,r,l=e.getTextContent(),s=0===l.length?"(empty)":`"${v(l,n)}"`,a=[w(e),(o=e,""!==(t=_.map(e=>e(o)).filter(Boolean).join(", ").toLocaleLowerCase())&&(t="detail: "+t),t),(i=e,""!==(r=b.map(e=>e(i)).filter(Boolean).join(", ").toLocaleLowerCase())&&(r="mode: "+r),r)].filter(Boolean).join(", ");return[s,0!==a.length?`{ ${a} }`:null].filter(Boolean).join(" ").trim()}if((0,l.FJ)(e)){let t,r,l,s=e.getURL(),o=0===s.length?"(empty)":`"${v(s,n)}"`,i=[(null!=(t=e.getTarget())&&(t="target: "+t),t),(null!=(r=e.getRel())&&(r="rel: "+r),r),(null!=(l=e.getTitle())&&(l="title: "+l),l)].filter(Boolean).join(", ");return[o,0!==i.length?`{ ${i} }`:null].filter(Boolean).join(" ").trim()}if(e instanceof a)return`ids: [ ${e.getIDs().join(", ")} ]`;if((0,s.bSg)(e)){let t,n=(""!==(t=y.map(t=>t(e)).filter(Boolean).join(", ").toLocaleLowerCase())&&(t="format: "+t),t);return(""!==n?`{ ${n} }`:"")+(e.__style?`(${e.__style})`:"")}return""}(t,o,i)}
`,m+=function({indent:e,isSelected:t,node:n,nodeKeyDisplay:r,selection:l,typeDisplay:o}){if(!(0,s.kFe)(n)||!(0,s.I2P)(l)||!t||(0,s.ff4)(n))return"";let i=l.anchor,a=l.focus;if(""===n.getTextContent()||i.getNode()===l.focus.getNode()&&i.offset===a.offset)return"";let[c,u]=function(e,t){let n=t.getStartEndPoints();if((0,s.RTZ)(t)||null===n)return[-1,-1];let[r,l]=n,o=e.getTextContent(),i=o.length,a=-1,c=-1;if("text"===r.type&&"text"===l.type){let t=r.getNode(),n=l.getNode();t===n&&e===t&&r.offset!==l.offset?[a,c]=r.offset<l.offset?[r.offset,l.offset]:[l.offset,r.offset]:[a,c]=e===t?t.isBefore(n)?[r.offset,i]:[0,r.offset]:e===n?n.isBefore(t)?[l.offset,i]:[0,l.offset]:[0,i]}let u=(o.slice(0,a).match(g)||[]).length,f=(o.slice(a,c).match(g)||[]).length;return[a+u,c+u+f]}(n,l);if(c===u)return"";let f=e[e.length-1]===p.hasNextSibling?p.ancestorHasNextSibling:p.ancestorIsLastChild,d=[...e.slice(0,e.length-1),f],h=Array(c+1).fill(" "),m=Array(u-c).fill(p.selectedChar),y=o.length+2,_=Array(r.length+y).fill(" ");return[p.selectedLine,d.join(" "),[..._,...h,...m].join("")].join(" ")+"\n"}({indent:n,isSelected:u,node:t,nodeKeyDisplay:r,selection:e,typeDisplay:c})}),null===e?": null":(0,s.I2P)(e)?function(e){let t="",n=w(e);t+=`: range ${""!==n?`{ ${n} }`:""} ${""!==e.style?`{ style: ${e.style} } `:""}`;let r=e.anchor,l=e.focus,s=r.offset,o=l.offset;return t+`
  ├ anchor { key: ${r.key}, offset: ${null===s?"null":s}, type: ${r.type} }
  └ focus { key: ${l.key}, offset: ${null===o?"null":o}, type: ${l.type} }`}(e):(0,u.Ln)(e)?`: table
  └ { table: ${e.tableKey}, anchorCell: ${e.anchor.key}, focusCell: ${e.focus.key} }`:(0,s.RTZ)(e)?`: node
  └ [${Array.from(e._nodes).join(", ")}]`:""});if(m+="\n selection"+x,m+="\n\n commands:",t.length)for(let{index:e,type:n,payload:r}of t)m+=`
  └ ${e}. { type: ${n}, payload: ${r instanceof Event?r.constructor.name:r} }`;else m+="\n  └ None dispatched.";let{version:C}=e.constructor;return m+=`

 editor${C?` (v${C})`:""}:`,m+=`
  └ namespace ${f.namespace}`,null!==d&&(m+=`
  └ compositionKey ${d}`),m+=`
  └ editable ${String(h)}`}(m,T,e,C)},ref:S,commandsLog:T})}},13959:(e,t,n)=>{n.d(t,{s:()=>u});var r=n(90142),l=n(94271),s=n(12115),o=n(95155);function i(e){let t=e.transform();return new Set(t?[t]:[])}let a=()=>{},c=()=>{};function u({initialEditor:e,children:t,initialNodes:n,initialTheme:u,skipCollabChecks:f,skipEditableListener:d}){let h=(0,s.useRef)(!1),g=(0,s.useContext)(l.Gu);null==g&&function(e,...t){let n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;for(let e of(r.append("code",9),t))r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${9}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(9);let[p,{getTheme:m}]=g,y=(0,s.useMemo)(()=>{let t=u||m()||void 0,r=(0,l.Mx)(g,t);void 0!==t&&(e._config.theme=t),e._parentEditor=e._parentEditor||p;let s=e._createEditorArgs,o=s&&s.namespace;if(n)for(let t of(a(),o||(c(),e._config.namespace=p._config.namespace),n)){let n=null,r=null;if("function"!=typeof t){let e=t;t=e.replace,n=e.with,r=e.withKlass||null}let l=e._nodes.get(t.getType());e._nodes.set(t.getType(),{exportDOM:l?l.exportDOM:void 0,klass:t,replace:n,replaceWithKlass:r,transforms:i(t)})}else if(s&&s.nodes)o||(c(),e._config.namespace=p._config.namespace);else{let t=e._nodes=new Map(p._nodes);for(let[n,r]of(o||(e._config.namespace=p._config.namespace),t))e._nodes.set(n,{exportDOM:r.exportDOM,klass:r.klass,replace:r.replace,replaceWithKlass:r.replaceWithKlass,transforms:i(r.klass)})}return[e,r]},[]),{isCollabActive:_,yjsDocMap:b}=(0,r.k)(),v=f||h.current||b.has(e.getKey());return(0,s.useEffect)(()=>{v&&(h.current=!0)},[v]),(0,s.useEffect)(()=>{if(!d){let t=t=>e.setEditable(t);return t(p.isEditable()),p.registerEditableListener(t)}},[e,p,d]),(0,o.jsx)(l.Gu.Provider,{value:y,children:!_||v?t:null})}},21173:(e,t,n)=>{n.d(t,{OK:()=>o,vo:()=>a,id:()=>i,EK:()=>c});var r=n(57802),l=n(67402);let s=Symbol("Equality"),o=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&o(e,t,n+1)}},i=e=>e,a=(e,t)=>{if(e===t)return!0;if(null==e||null==t||e.constructor!==t.constructor)return!1;if(null!=e[s])return e[s](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(let n of e.keys())if(!t.has(n)||!a(e.get(n),t.get(n)))return!1;break;case Object:if(l.Bw(e)!==l.Bw(t))return!1;for(let n in e)if(!l.i5(e,n)||!a(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!a(e[n],t[n]))return!1;break;default:return!1}return!0},c=(e,t)=>t.includes(e);r.cy},28495:(e,t,n)=>{n.d(t,{Ey:()=>u,HR:()=>f,nk:()=>c,zS:()=>a});var r=n(63108),l=n(42878),s=n(44134).hp;let o=e=>new Uint8Array(e),i=(e,t,n)=>new Uint8Array(e,t,n),a=e=>new Uint8Array(e),c=l.Bd?e=>{let t="";for(let n=0;n<e.byteLength;n++)t+=r.QV(e[n]);return btoa(t)}:e=>s.from(e.buffer,e.byteOffset,e.byteLength).toString("base64"),u=l.Bd?e=>{let t=atob(e),n=o(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}:e=>{let t=s.from(e,"base64");return i(t.buffer,t.byteOffset,t.byteLength)},f=e=>{let t=o(e.byteLength);return t.set(e),t}},29979:(e,t,n)=>{n.d(t,{BB:()=>f,QP:()=>_,mx:()=>y});var r=n(94271),l=n(32532),s=n(12115),o=n(92749),i=n(95155);let a="startTransition",c="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,u=c?s.useLayoutEffect:s.useEffect;class f{constructor(e){this.key=e,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(e){this.ref={current:e}}}let d=e=>{let t=document.getElementById("typeahead-menu");if(!t)return;let n=t.getBoundingClientRect();n.top+n.height>window.innerHeight&&t.scrollIntoView({block:"center"}),n.top<0&&t.scrollIntoView({block:"center"}),e.scrollIntoView({block:"nearest"})};function h(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top>r.top&&n.top<r.bottom}let g=(0,l.guI)("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function p({close:e,editor:t,anchorElementRef:n,resolution:r,options:i,menuRenderFn:a,onSelectOption:c,shouldSplitNodeWithQuery:f=!1,commandPriority:h=l.AcJ,preselectFirstItem:p=!0}){let[m,y]=(0,s.useState)(null),_=r.match&&r.match.matchingString;(0,s.useEffect)(()=>{p&&y(0)},[_,p]);let b=(0,s.useCallback)(n=>{t.update(()=>{c(n,null!=r.match&&f?function(e){let t,n=(0,l.vJq)();if(!(0,l.I2P)(n)||!n.isCollapsed())return null;let r=n.anchor;if("text"!==r.type)return null;let s=r.getNode();if(!s.isSimpleText())return null;let o=r.offset,i=s.getTextContent().slice(0,o),a=e.replaceableString.length,c=o-function(e,t,n){let r=n;for(let n=r;n<=t.length;n++)e.slice(-n)===t.substring(0,n)&&(r=n);return r}(i,e.matchingString,a);return c<0?null:(0===c?[t]=s.splitText(o):[,t]=s.splitText(c,o),t)}(r.match):null,e,r.match?r.match.matchingString:"")})},[t,f,r.match,c,e]),v=(0,s.useCallback)(e=>{let n=t.getRootElement();null!==n&&(n.setAttribute("aria-activedescendant","typeahead-item-"+e),y(e))},[t]);return(0,s.useEffect)(()=>()=>{let e=t.getRootElement();null!==e&&e.removeAttribute("aria-activedescendant")},[t]),u(()=>{null===i?y(null):null===m&&p&&v(0)},[i,m,v,p]),(0,s.useEffect)(()=>(0,o.Sd)(t.registerCommand(g,({option:e})=>!(!e.ref||null==e.ref.current)&&(d(e.ref.current),!0),h)),[t,v,h]),(0,s.useEffect)(()=>(0,o.Sd)(t.registerCommand(l.bbF,e=>{if(null!==i&&i.length){let n=null===m?0:m!==i.length-1?m+1:0;v(n);let r=i[n];null!=r.ref&&r.ref.current&&t.dispatchCommand(g,{index:n,option:r}),e.preventDefault(),e.stopImmediatePropagation()}return!0},h),t.registerCommand(l.UDz,e=>{if(null!==i&&i.length){let t=null===m?i.length-1:0!==m?m-1:i.length-1;v(t);let n=i[t];null!=n.ref&&n.ref.current&&d(n.ref.current),e.preventDefault(),e.stopImmediatePropagation()}return!0},h),t.registerCommand(l.Q$N,t=>(t.preventDefault(),t.stopImmediatePropagation(),e(),!0),h),t.registerCommand(l.OXk,e=>null!==i&&null!==m&&null!=i[m]&&(e.preventDefault(),e.stopImmediatePropagation(),b(i[m]),!0),h),t.registerCommand(l.RTo,e=>null!==i&&null!==m&&null!=i[m]&&(null!==e&&(e.preventDefault(),e.stopImmediatePropagation()),b(i[m]),!0),h)),[b,e,t,i,m,v,h]),a(n,(0,s.useMemo)(()=>({options:i,selectOptionAndCleanUp:b,selectedIndex:m,setHighlightedIndex:y}),[b,m,i]),r.match?r.match.matchingString:"")}function m(e,t){null!=t&&(e.className=t),e.setAttribute("aria-label","Typeahead menu"),e.setAttribute("role","listbox"),e.style.display="block",e.style.position="absolute"}function y(e,{minLength:t=1,maxLength:n=75,punctuation:r="\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'\"~=<>_:;"}){return(0,s.useCallback)(l=>{let s=RegExp("(^|\\s|\\()(["+e+"]((?:"+("[^"+e)+r+"\\s]){0,"+n+"}))$").exec(l);if(null!==s){let e=s[1],n=s[3];if(n.length>=t)return{leadOffset:s.index+e.length,matchingString:n,replaceableString:s[2]}}return null},[n,t,e,r])}function _({options:e,onQueryChange:t,onSelectOption:n,onOpen:o,onClose:u,menuRenderFn:f,triggerFn:d,anchorClassName:g,commandPriority:y=l.AcJ,parent:_,preselectFirstItem:b=!0,ignoreEntityBoundary:v=!1}){let[w]=(0,r.DF)(),[x,C]=(0,s.useState)(null),S=function(e,t,n,l=c?document.body:void 0,o=!0){let[i]=(0,r.DF)(),a=(0,s.useRef)(c?document.createElement("div"):null),u=(0,s.useCallback)(()=>{if(null===a.current||void 0===l)return;a.current.style.top=a.current.style.bottom;let t=i.getRootElement(),r=a.current,s=r.firstChild;if(null!==t&&null!==e){let{left:i,top:c,width:u,height:f}=e.getRect(),d=a.current.offsetHeight;if(r.style.top=`${c+d+3+(o?window.pageYOffset:0)}px`,r.style.left=`${i+window.pageXOffset}px`,r.style.height=`${f}px`,r.style.width=`${u}px`,null!==s){s.style.top=`${c}`;let e=s.getBoundingClientRect(),n=e.height,l=e.width,a=t.getBoundingClientRect();i+l>a.right&&(r.style.left=`${a.right-l+window.pageXOffset}px`),(c+n>window.innerHeight||c+n>a.bottom)&&c-a.top>n+f&&(r.style.top=`${c-n-f+(o?window.pageYOffset:0)}px`)}r.isConnected||(m(r,n),l.append(r)),r.setAttribute("id","typeahead-menu"),a.current=r,t.setAttribute("aria-controls","typeahead-menu")}},[i,e,o,n,l]);(0,s.useEffect)(()=>{let t=i.getRootElement();return null!==e&&u(),()=>{null!==t&&t.removeAttribute("aria-controls");let e=a.current;null!==e&&e.isConnected&&(e.remove(),e.removeAttribute("id"))}},[i,u,e]);let f=(0,s.useCallback)(n=>{null!==e&&(n||t(null))},[e,t]);var d=a.current;let[g]=(0,r.DF)();(0,s.useEffect)(()=>{if(null!=d&&null!=e){let e=g.getRootElement(),t=null!=e?function(e,t){let n=getComputedStyle(e),r="absolute"===n.position,l=/(auto|scroll)/;if("fixed"===n.position)return document.body;for(let t=e;t=t.parentElement;)if(n=getComputedStyle(t),(!r||"static"!==n.position)&&l.test(n.overflow+n.overflowY+n.overflowX))return t;return document.body}(e):document.body,n=!1,r=h(d,t),l=function(){n||(window.requestAnimationFrame(function(){u(),n=!1}),n=!0);let e=h(d,t);e!==r&&(r=e,null!=f&&f(e))},s=new ResizeObserver(u);return window.addEventListener("resize",u),document.addEventListener("scroll",l,{capture:!0,passive:!0}),s.observe(d),()=>{s.unobserve(d),window.removeEventListener("resize",u),document.removeEventListener("scroll",l,!0)}}},[d,g,f,u,e]);let p=a.current;return null!=p&&(m(p,n),null!=l&&l.append(p)),a}(x,C,g,_),k=(0,s.useCallback)(()=>{C(null),null!=u&&null!==x&&u()},[u,x]),E=(0,s.useCallback)(e=>{C(e),null!=o&&null===x&&o(e)},[o,x]);return(0,s.useEffect)(()=>{let e=w.registerUpdateListener(()=>{w.getEditorState().read(()=>{var e;let n;if(!w.isEditable())return void k();let r=w._window||window,o=r.document.createRange(),i=(0,l.vJq)(),c=(n=null,w.getEditorState().read(()=>{let e=(0,l.vJq)();(0,l.I2P)(e)&&(n=function(e){let t=e.anchor;if("text"!==t.type)return null;let n=t.getNode();if(!n.isSimpleText())return null;let r=t.offset;return n.getTextContent().slice(0,r)}(e))}),n);if(!(0,l.I2P)(i)||!i.isCollapsed()||null===c||null===o)return void k();let u=d(c,w);if(t(u?u.matchingString:null),null!==u&&(v||!(0===u.leadOffset&&w.getEditorState().read(()=>{let e=(0,l.vJq)();if((0,l.I2P)(e)){let t=e.anchor.getNode().getPreviousSibling();return(0,l.kFe)(t)&&t.isTextEntity()}return!1})))&&null!==function(e,t,n){let r=(0,l.peL)(n);if(null===r||!r.isCollapsed)return!1;let s=r.anchorNode,o=r.anchorOffset;if(null==s||null==o)return!1;try{t.setStart(s,e),t.setEnd(s,o)}catch(e){return!1}return!0}(u.leadOffset,o,r))return e=()=>E({getRect:()=>o.getBoundingClientRect(),match:u}),void(a in s?s[a](e):e());k()})});return()=>{e()}},[w,d,t,x,k,E,v]),(0,s.useEffect)(()=>w.registerEditableListener(e=>{e||k()}),[w,k]),null===x||null===w||null===S.current?null:(0,i.jsx)(p,{close:k,resolution:x,editor:w,anchorElementRef:S,options:e,menuRenderFn:f,shouldSplitNodeWithQuery:!0,onSelectOption:n,commandPriority:y,preselectFirstItem:b})}(0,l.guI)("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND")},32293:(e,t,n)=>{n.d(t,{Mq:()=>s,bD:()=>l,vt:()=>r});let r=e=>Error(e),l=()=>{throw r("Method unimplemented")},s=()=>{throw r("Unexpected case")}},34712:(e,t,n)=>{n.d(t,{$R:()=>B});var r=n(61077),l=n(95279),s=n(28495),o=n(4610);let i=new Map;class a{constructor(e){this.room=e,this.onmessage=null,this._onChange=t=>t.key===e&&null!==this.onmessage&&this.onmessage({data:s.Ey(t.newValue||"")}),o.k9(this._onChange)}postMessage(e){o.JT.setItem(this.room,s.nk(s.zS(e)))}close(){o.o6(this._onChange)}}let c="undefined"==typeof BroadcastChannel?a:BroadcastChannel,u=e=>r._4(i,e,()=>{let t=l.vt(),n=new c(e);return n.onmessage=e=>t.forEach(t=>t(e.data,"broadcastchannel")),{bc:n,subs:t}}),f=(e,t)=>(u(e).subs.add(t),t),d=(e,t)=>{let n=u(e),r=n.subs.delete(t);return r&&0===n.subs.size&&(n.bc.close(),i.delete(e)),r},h=(e,t,n=null)=>{let r=u(e);r.bc.postMessage(t),r.subs.forEach(e=>e(t,n))};var g=n(90224),p=n(83600),m=n(98628),y=n(95644);let _=(e,t)=>{p.zd(e,0);let n=y.FX(t);p.Gu(e,n)},b=(e,t,n)=>{p.zd(e,1),p.Gu(e,y.PR(t,n))},v=(e,t,n)=>b(t,n,m.bo(e)),w=(e,t,n)=>{try{y.QE(t,m.bo(e),n)}catch(e){console.error("Caught error while handling a Yjs update",e)}},x=(e,t)=>{p.zd(e,2),p.Gu(e,t)},C=(e,t,n,r)=>{let l=m.cw(e);switch(l){case 0:v(e,t,n);break;case 1:case 2:w(e,n,r);break;default:throw Error("Unknown message type")}return l},S=(e,t,n)=>{0===m.cw(e)&&n(t,m.t3(e))};var k=n(88755),E=n(95460),T=n(21173);class N extends E.c{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{let e=g._g();null!==this.getLocalState()&&15e3<=e-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());let t=[];this.meta.forEach((n,r)=>{r!==this.clientID&&3e4<=e-n.lastUpdated&&this.states.has(r)&&t.push(r)}),t.length>0&&I(this,t,"timeout")},k.RI(3e3)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){let t=this.clientID,n=this.meta.get(t),r=void 0===n?0:n.clock+1,l=this.states.get(t);null===e?this.states.delete(t):this.states.set(t,e),this.meta.set(t,{clock:r,lastUpdated:g._g()});let s=[],o=[],i=[],a=[];null===e?a.push(t):null==l?null!=e&&s.push(t):(o.push(t),T.vo(l,e)||i.push(t)),(s.length>0||i.length>0||a.length>0)&&this.emit("change",[{added:s,updated:i,removed:a},"local"]),this.emit("update",[{added:s,updated:o,removed:a},"local"])}setLocalStateField(e,t){let n=this.getLocalState();null!==n&&this.setLocalState({...n,[e]:t})}getStates(){return this.states}}let I=(e,t,n)=>{let r=[];for(let n=0;n<t.length;n++){let l=t[n];if(e.states.has(l)){if(e.states.delete(l),l===e.clientID){let t=e.meta.get(l);e.meta.set(l,{clock:t.clock+1,lastUpdated:g._g()})}r.push(l)}}r.length>0&&(e.emit("change",[{added:[],updated:[],removed:r},n]),e.emit("update",[{added:[],updated:[],removed:r},n]))},F=(e,t,n=e.states)=>{let r=t.length,l=p.xv();p.zd(l,r);for(let s=0;s<r;s++){let r=t[s],o=n.get(r)||null,i=e.meta.get(r).clock;p.zd(l,r),p.zd(l,i),p.Qj(l,JSON.stringify(o))}return p.Fo(l)},O=(e,t,n)=>{let r=m.$C(t),l=g._g(),s=[],o=[],i=[],a=[],c=m.cw(r);for(let t=0;t<c;t++){let t=m.cw(r),n=m.cw(r),c=JSON.parse(m.t3(r)),u=e.meta.get(t),f=e.states.get(t),d=void 0===u?0:u.clock;(d<n||d===n&&null===c&&e.states.has(t))&&(null===c?t===e.clientID&&null!=e.getLocalState()?n++:e.states.delete(t):e.states.set(t,c),e.meta.set(t,{clock:n,lastUpdated:l}),void 0===u&&null!==c?s.push(t):void 0!==u&&null===c?a.push(t):null!==c&&(T.vo(c,f)||i.push(t),o.push(t)))}(s.length>0||i.length>0||a.length>0)&&e.emit("change",[{added:s,updated:i,removed:a},n]),(s.length>0||o.length>0||a.length>0)&&e.emit("update",[{added:s,updated:o,removed:a},n])};var D=n(67402);let P=e=>D.Tj(e,(e,t)=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&");var A=n(42878),L=n(49509);let j=[];j[0]=(e,t,n,r,l)=>{p.zd(e,0);let s=C(t,e,n.doc,n);r&&1===s&&!n.synced&&(n.synced=!0)},j[3]=(e,t,n,r,l)=>{p.zd(e,1),p.Gu(e,F(n.awareness,Array.from(n.awareness.getStates().keys())))},j[1]=(e,t,n,r,l)=>{O(n.awareness,m.bo(t),n)},j[2]=(e,t,n,r,l)=>{S(t,n.doc,(e,t)=>M(n,t))};let M=(e,t)=>console.warn(`Permission denied to access ${e.url}.
${t}`),R=(e,t,n)=>{let r=m.$C(t),l=p.xv(),s=m.cw(r),o=e.messageHandlers[s];return o?o(l,r,e,n,s):console.error("Unable to compute message"),l},$=e=>{if(e.shouldConnect&&null===e.ws){let t=new e._WS(e.url);t.binaryType="arraybuffer",e.ws=t,e.wsconnecting=!0,e.wsconnected=!1,e.synced=!1,t.onmessage=n=>{e.wsLastMessageReceived=g._g();let r=R(e,new Uint8Array(n.data),!0);p.Bw(r)>1&&t.send(p.Fo(r))},t.onerror=t=>{e.emit("connection-error",[t,e])},t.onclose=t=>{e.emit("connection-close",[t,e]),e.ws=null,e.wsconnecting=!1,e.wsconnected?(e.wsconnected=!1,e.synced=!1,I(e.awareness,Array.from(e.awareness.getStates().keys()).filter(t=>t!==e.doc.clientID),e),e.emit("status",[{status:"disconnected"}])):e.wsUnsuccessfulReconnects++,setTimeout($,k.jk(100*k.n7(2,e.wsUnsuccessfulReconnects),e.maxBackoffTime),e)},t.onopen=()=>{e.wsLastMessageReceived=g._g(),e.wsconnecting=!1,e.wsconnected=!0,e.wsUnsuccessfulReconnects=0,e.emit("status",[{status:"connected"}]);let n=p.xv();if(p.zd(n,0),_(n,e.doc),t.send(p.Fo(n)),null!==e.awareness.getLocalState()){let n=p.xv();p.zd(n,1),p.Gu(n,F(e.awareness,[e.doc.clientID])),t.send(p.Fo(n))}},e.emit("status",[{status:"connecting"}])}},U=(e,t)=>{let n=e.ws;e.wsconnected&&n&&n.readyState===n.OPEN&&n.send(t),e.bcconnected&&h(e.bcChannel,t,e)};class B extends E.c{constructor(e,t,n,{connect:r=!0,awareness:l=new N(n),params:s={},WebSocketPolyfill:o=WebSocket,resyncInterval:i=-1,maxBackoffTime:a=2500,disableBc:c=!1}={}){for(super();"/"===e[e.length-1];)e=e.slice(0,e.length-1);let u=P(s);this.maxBackoffTime=a,this.bcChannel=e+"/"+t,this.url=e+"/"+t+(0===u.length?"":"?"+u),this.roomname=t,this.doc=n,this._WS=o,this.awareness=l,this.wsconnected=!1,this.wsconnecting=!1,this.bcconnected=!1,this.disableBc=c,this.wsUnsuccessfulReconnects=0,this.messageHandlers=j.slice(),this._synced=!1,this.ws=null,this.wsLastMessageReceived=0,this.shouldConnect=r,this._resyncInterval=0,i>0&&(this._resyncInterval=setInterval(()=>{if(this.ws&&this.ws.readyState===WebSocket.OPEN){let e=p.xv();p.zd(e,0),_(e,n),this.ws.send(p.Fo(e))}},i)),this._bcSubscriber=(e,t)=>{if(t!==this){let t=R(this,new Uint8Array(e),!1);p.Bw(t)>1&&h(this.bcChannel,p.Fo(t),this)}},this._updateHandler=(e,t)=>{if(t!==this){let t=p.xv();p.zd(t,0),x(t,e),U(this,p.Fo(t))}},this.doc.on("update",this._updateHandler),this._awarenessUpdateHandler=({added:e,updated:t,removed:n},r)=>{let s=e.concat(t).concat(n),o=p.xv();p.zd(o,1),p.Gu(o,F(l,s)),U(this,p.Fo(o))},this._exitHandler=()=>{I(this.awareness,[n.clientID],"app closed")},A.Ll&&void 0!==L&&L.on("exit",this._exitHandler),l.on("update",this._awarenessUpdateHandler),this._checkInterval=setInterval(()=>{this.wsconnected&&3e4<g._g()-this.wsLastMessageReceived&&this.ws.close()},3e3),r&&this.connect()}get synced(){return this._synced}set synced(e){this._synced!==e&&(this._synced=e,this.emit("synced",[e]),this.emit("sync",[e]))}destroy(){0!==this._resyncInterval&&clearInterval(this._resyncInterval),clearInterval(this._checkInterval),this.disconnect(),A.Ll&&void 0!==L&&L.off("exit",this._exitHandler),this.awareness.off("update",this._awarenessUpdateHandler),this.doc.off("update",this._updateHandler),super.destroy()}connectBc(){if(this.disableBc)return;this.bcconnected||(f(this.bcChannel,this._bcSubscriber),this.bcconnected=!0);let e=p.xv();p.zd(e,0),_(e,this.doc),h(this.bcChannel,p.Fo(e),this);let t=p.xv();p.zd(t,0),b(t,this.doc),h(this.bcChannel,p.Fo(t),this);let n=p.xv();p.zd(n,3),h(this.bcChannel,p.Fo(n),this);let r=p.xv();p.zd(r,1),p.Gu(r,F(this.awareness,[this.doc.clientID])),h(this.bcChannel,p.Fo(r),this)}disconnectBc(){let e=p.xv();p.zd(e,1),p.Gu(e,F(this.awareness,[this.doc.clientID],new Map)),U(this,p.Fo(e)),this.bcconnected&&(d(this.bcChannel,this._bcSubscriber),this.bcconnected=!1)}disconnect(){this.shouldConnect=!1,this.disconnectBc(),null!==this.ws&&this.ws.close()}connect(){this.shouldConnect=!0,this.wsconnected||null!==this.ws||($(this),this.connectBc())}}},35261:(e,t,n)=>{n.d(t,{yy:()=>h,R8:()=>g});var r=n(42878),l=n(95279);class s{constructor(e,t){this.left=e,this.right=t}}let o=(e,t)=>new s(e,t);var i=n(61077);let a="undefined"!=typeof document?document:{};"undefined"!=typeof DOMParser&&new DOMParser;let c=e=>i.Tj(e,(e,t)=>`${t}:${e};`).join("");a.ELEMENT_NODE,a.TEXT_NODE,a.CDATA_SECTION_NODE,a.COMMENT_NODE,a.DOCUMENT_NODE,a.DOCUMENT_TYPE_NODE,a.DOCUMENT_FRAGMENT_NODE;var u=n(78176);let f={[u.Y]:o("font-weight","bold"),[u.Ny]:o("font-weight","normal"),[u.ft]:o("color","blue"),[u.AV]:o("color","green"),[u.Qu]:o("color","grey"),[u.UH]:o("color","red"),[u.hr]:o("color","purple"),[u.hN]:o("color","orange"),[u.Tx]:o("color","black")},d=r.WI?e=>{1===e.length&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=i.vt(),l=[],s=0;for(;s<e.length;s++){let l=e[s],o=f[l];if(void 0!==o)r.set(o.left,o.right);else{if(void 0===l)break;if(l.constructor===String||l.constructor===Number){let e=c(r);s>0||e.length>0?(t.push("%c"+l),n.push(e)):t.push(l)}else break}}for(s>0&&(l=n).unshift(t.join(""));s<e.length;s++){let t=e[s];t instanceof Symbol||l.push(t)}return l}:u.ET,h=(...e)=>{console.log(...d(e)),p.forEach(t=>t.print(e))},g=(...e)=>{console.warn(...d(e)),e.unshift(u.hN),p.forEach(t=>t.print(e))},p=l.vt()},42878:(e,t,n)=>{let r;n.d(t,{dn:()=>p,Bd:()=>f,Ll:()=>u,WI:()=>y});var l=n(61077),s=n(63108);let o=e=>void 0===e?null:e;var i=n(4610),a=n(21173),c=n(49509);let u=void 0!==c&&c.release&&/node|io\.js/.test(c.release.name)&&"[object process]"===Object.prototype.toString.call(void 0!==c?c:0),f="undefined"!=typeof window&&"undefined"!=typeof document&&!u;"undefined"!=typeof navigator&&/Mac/.test(navigator.platform);let d=[],h=()=>{if(void 0===r)if(u){r=l.vt();let e=c.argv,t=null;for(let n=0;n<e.length;n++){let l=e[n];"-"===l[0]?(null!==t&&r.set(t,""),t=l):null!==t?(r.set(t,l),t=null):d.push(l)}null!==t&&r.set(t,"")}else"object"==typeof location?(r=l.vt(),(location.search||"?").slice(1).split("&").forEach(e=>{if(0!==e.length){let[t,n]=e.split("=");r.set(`--${s.jN(t,"-")}`,n),r.set(`-${s.jN(t,"-")}`,n)}})):r=l.vt();return r},g=e=>h().has(e),p=e=>u?o(c.env[e.toUpperCase().replaceAll("-","_")]):o(i.JT.getItem(e)),m=e=>g("--"+e)||null!==p(e);m("production");let y=u&&a.EK(c.env.FORCE_COLOR,["true","1","2"])||!g("--no-colors")&&!m("no-color")&&(!u||c.stdout.isTTY)&&(!u||g("--color")||null!==p("COLORTERM")||(p("TERM")||"").includes("color"))},49889:(e,t,n)=>{n.d(t,{V:()=>et});var r=n(90142),l=n(94271),s=n(32532),o=n(95644);function i(e,...t){let n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;for(let n of(r.append("code",e),t))r.append("v",n);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function a(e,t,n,r,l){let s=n._offsetMap,o=r._offsetMap,i=new Set,a=e,u=t;for(;null!==u;){let e=u.key,t=s.get(e),n=u.end-u.start;if(i.add(e),void 0===t)a+=n;else{let e=t.end-t.start;e!==n&&(a+=n-e)}let r=u.prev;if(null!==r){u=r;continue}let l=u.parent;for(;null!==l;){let e=l.prev;if(null!==e){let t=e.key,n=s.get(t),r=e.end-e.start;if(i.add(t),void 0===n)a+=r;else{let e=n.end-n.start;e!==r&&(a+=r-e)}e=e.prev}l=l.parent}break}let f=n._firstNode;if(null!==f){u=c(f,e,l);let t=!1;for(;null!==u;){if(!i.has(u.key)){t=!0;break}u=u.parent}if(!t)for(;null!==u;){let e=u.key;if(!i.has(e)){let t=o.get(e),n=u.end-u.start;if(void 0===t)a-=n;else{let e=t.end-t.start;n!==e&&(a+=e-n)}}u=u.prev}}return a}function c(e,t,n){let r=e;for(;null!==r;){if(t<r.end+ +("element"!==r.type||0===n)){let e=r.child;if(null!==e){r=e;continue}return r}let e=r.next;if(null===e)break;r=e}return null}function u(e,t,n,r,l,s){return{child:e,end:r,key:l,next:null,parent:s,prev:null,start:n,type:t}}function f(e,t){let n=[],r=e.__first;for(;null!==r;){let e=null===t?(0,s.nsf)(r):t.get(r);null==e&&i(174),n.push(r),r=e.__next}return n}var d=n(61731);function h(e,...t){let n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;for(let n of(r.append("code",e),t))r.append("v",n);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}class g{constructor(e,t){this._key="",this._map=e,this._parent=t,this._type="linebreak"}getNode(){let e=(0,s.nsf)(this._key);return(0,s.wH$)(e)?e:null}getKey(){return this._key}getSharedType(){return this._map}getType(){return this._type}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}destroy(e){let t=e.collabNodeMap;t.get(this._key)===this&&t.delete(this._key)}}function p(e,t){let n=new g(e,t);return e._collabNode=n,n}class m{constructor(e,t,n,r){this._key="",this._map=e,this._parent=n,this._text=t,this._type=r,this._normalized=!1}getPrevNode(e){if(null===e)return null;let t=e.get(this._key);return(0,s.kFe)(t)?t:null}getNode(){let e=(0,s.nsf)(this._key);return(0,s.kFe)(e)?e:null}getSharedType(){return this._map}getType(){return this._type}getKey(){return this._key}getSize(){return this._text.length+ +!this._normalized}getOffset(){return this._parent.getChildOffset(this)}spliceText(e,t,n){let r=this._parent._xmlText,l=this.getOffset()+1+e;0!==t&&r.delete(l,t),""!==n&&r.insert(l,n)}syncPropertiesAndTextFromLexical(e,t,n){let r=this.getPrevNode(n),l=t.__text;if(I(e,this._map,r,t),null!==r){let e=r.__text;e!==l&&(!function(e,t,n,r){let l=(0,s.vJq)(),o=r.length;if((0,s.I2P)(l)&&l.isCollapsed()){let e=l.anchor;e.key===t&&(o=e.offset)}let i=function(e,t,n){let r=e.length,l=t.length,s=0,o=0;for(;s<r&&s<l&&e[s]===t[s]&&s<n;)s++;for(;o+s<r&&o+s<l&&e[r-o-1]===t[l-o-1];)o++;for(;o+s<r&&o+s<l&&e[s]===t[s];)s++;return{index:s,insert:t.slice(s,l-o),remove:r-s-o}}(n,r,o);e.spliceText(i.index,i.remove,i.insert)}(this,t.__key,e,l),this._text=l)}}syncPropertiesAndTextFromYjs(e,t){let n=this.getNode();null===n&&h(84),E(e,this._map,n,t);let r=this._text;n.__text!==r&&(n.getWritable().__text=r)}destroy(e){let t=e.collabNodeMap;t.get(this._key)===this&&t.delete(this._key)}}function y(e,t,n,r){let l=new m(e,t,n,r);return e._collabNode=l,l}let _=new Set(["__key","__parent","__next","__prev","__state"]),b=new Set(["__first","__last","__size","__dir"]),v=new Set(["__cachedText"]),w=new Set(["__text"]);function x(e,t,n){if(_.has(e)||"function"==typeof t[e])return!0;if((0,s.kFe)(t)){if(w.has(e))return!0}else if((0,s.ff4)(t)&&(b.has(e)||(0,s.hVZ)(t)&&v.has(e)))return!0;let r=t.constructor,l=n.excludedProperties.get(r);return null!=l&&l.has(e)}function C(e,t,n){let r,l=t.__type;if((0,s.ff4)(t))(r=j(new o.ZQ,n,l)).syncPropertiesFromLexical(e,t,null),r.syncChildrenFromLexical(e,t,null,null,null);else if((0,s.kFe)(t))(r=y(new o.T5,t.__text,n,l)).syncPropertiesAndTextFromLexical(e,t,null);else if((0,s.wH$)(t)){let e=new o.T5;e.set("__type","linebreak"),r=p(e,n)}else(0,s.Cyw)(t)?(r=A(new o.WF,n,l)).syncPropertiesFromLexical(e,t,null):h(86);return r._key=t.__key,r}function S(e){let t=T(e,"__type");return"string"!=typeof t&&void 0!==t&&h(87),t}function k(e,t,n){let r=t._collabNode;if(void 0===r){let r=e.editor._nodes,l=S(t);"string"!=typeof l&&h(87),void 0===r.get(l)&&h(88,l);let s=t.parent,i=void 0===n&&null!==s?k(e,s):n||null;if(i instanceof L||h(89),t instanceof o.ZQ)return j(t,i,l);if(t instanceof o.T5)return"linebreak"===l?p(t,i):y(t,"",i,l);if(t instanceof o.WF)return A(t,i,l)}return r}function E(e,t,n,r){let l,i=null===r?t instanceof o.T5?Array.from(t.keys()):Object.keys(t.getAttributes()):Array.from(r);for(let r=0;r<i.length;r++){let a=i[r];if(x(a,n,e)){"__state"===a&&(l||(l=n.getWritable()),function(e,t,n){let r=T(t,"__state");r instanceof o.T5&&(0,s.swd)(n).updateFromJSON(r.toJSON())}(0,t,l));continue}let c=n[a],u=T(t,a);if(c!==u){if(u instanceof o.JA){let t=e.docMap;c instanceof o.JA&&t.delete(c.guid);let n=(0,s.ieJ)(),r=u.guid;n._key=r,t.set(r,u),u=n}void 0===l&&(l=n.getWritable()),l[a]=u}}}function T(e,t){return e instanceof o.T5?e.get(t):e.getAttribute(t)}function N(e,t,n){e instanceof o.T5?e.set(t,n):e.setAttribute(t,n)}function I(e,t,n,r){let l=r.__type,s=e.nodeProperties,i=s.get(l);void 0===i&&(i=Object.keys(r).filter(t=>!x(t,r,e)),s.set(l,i));let a=e.editor.constructor;!function(e,t,n,r){let l=r.__state,s=T(t,"__state");if(!l)return;let[i,a]=l.getInternalState(),c=n&&n.__state,u=s instanceof o.T5?s:new o.T5;if(c===l)return;let[f,d]=c&&u.doc?c.getInternalState():[void 0,new Map];if(i)for(let[e,t]of Object.entries(i))f&&t!==f[e]&&u.set(e,t);for(let[e,t]of a)d.get(e)!==t&&u.set(e.key,e.unparse(t));s||N(t,"__state",u)}(0,t,n,r);for(let l=0;l<i.length;l++){let s=i[l],c=null===n?void 0:n[s],u=r[s];if(c!==u){if(u instanceof a){let t,n=e.docMap;if(c instanceof a){let e=c._key;t=n.get(e),n.delete(e)}let l=t||new o.JA,s=l.guid;u._key=s,n.set(s,l),u=l,e.editor.update(()=>{r.markDirty()})}N(t,s,u)}}}function F(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n)}function O(e,t,n){let r=0,l=0,s=e._children,o=s.length;for(;l<o;l++){let e=s[l],i=r;if(r+=e.getSize(),(n?r>=t:r>t)&&e instanceof m){let n=t-i-1;return n<0&&(n=0),{length:r-t,node:e,nodeIndex:l,offset:n}}if(r>t)return{length:0,node:e,nodeIndex:l,offset:i};if(l===o-1)return{length:0,node:null,nodeIndex:l+1,offset:i+1}}return{length:0,node:null,nodeIndex:0,offset:0}}function D(e){let t=e.anchor,n=e.focus,r=!1;try{let e=t.getNode(),l=n.getNode();(!e.isAttached()||!l.isAttached()||(0,s.kFe)(e)&&t.offset>e.getTextContentSize()||(0,s.kFe)(l)&&n.offset>l.getTextContentSize())&&(r=!0)}catch(e){r=!0}return r}class P{constructor(e,t,n){this._key="",this._xmlElem=e,this._parent=t,this._type=n}getPrevNode(e){if(null===e)return null;let t=e.get(this._key);return(0,s.Cyw)(t)?t:null}getNode(){let e=(0,s.nsf)(this._key);return(0,s.Cyw)(e)?e:null}getSharedType(){return this._xmlElem}getType(){return this._type}getKey(){return this._key}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}syncPropertiesFromLexical(e,t,n){let r=this.getPrevNode(n);I(e,this._xmlElem,r,t)}syncPropertiesFromYjs(e,t){let n=this.getNode();null===n&&h(83),E(e,this._xmlElem,n,t)}destroy(e){let t=e.collabNodeMap;t.get(this._key)===this&&t.delete(this._key)}}function A(e,t,n){let r=new P(e,t,n);return e._collabNode=r,r}class L{constructor(e,t,n){this._key="",this._children=[],this._xmlText=e,this._type=n,this._parent=t}getPrevNode(e){if(null===e)return null;let t=e.get(this._key);return(0,s.ff4)(t)?t:null}getNode(){let e=(0,s.nsf)(this._key);return(0,s.ff4)(e)?e:null}getSharedType(){return this._xmlText}getType(){return this._type}getKey(){return this._key}isEmpty(){return 0===this._children.length}getSize(){return 1}getOffset(){let e=this._parent;return null===e&&h(90),e.getChildOffset(this)}syncPropertiesFromYjs(e,t){let n=this.getNode();null===n&&h(91),E(e,this._xmlText,n,t)}applyChildrenYjsDelta(e,t){let n=this._children,r=0,l=null;for(let s=0;s<t.length;s++){let o=t[s],i=o.insert,a=o.delete;if(null!=o.retain)r+=o.retain;else if("number"==typeof a){let e=a;for(;e>0;){let{node:t,nodeIndex:l,offset:s,length:o}=O(this,r,!1);if(t instanceof L||t instanceof g||t instanceof P)n.splice(l,1),e-=1;else{if(!(t instanceof m))break;{let r=Math.min(e,o),i=0!==l?n[l-1]:null,a=t.getSize();if(0===s&&o===a){n.splice(l,1);let e=F(t._text,s,r-1,"");e.length>0&&(i instanceof m?i._text+=e:this._xmlText.delete(s,e.length))}else t._text=F(t._text,s,r,"");e-=r}}}}else{if(null==i)throw Error("Unexpected delta format");if("string"==typeof i){let{node:e,offset:t}=O(this,r,!0);e instanceof m?e._text=F(e._text,t,0,i):this._xmlText.delete(t,i.length),r+=i.length}else{let{node:t,nodeIndex:s,length:o}=O(this,r,!1),a=k(e,i,this);if(t instanceof m&&o>0&&o<t._text.length){let e=t._text,r=e.length-o;t._text=F(e,r,o,""),n.splice(s+1,0,a),l=F(e,0,r,"")}else n.splice(s,0,a);null!==l&&a instanceof m&&(a._text=l+a._text,l=null),r+=1}}}}syncChildrenFromYjs(e){let t=this.getNode();null===t&&h(92);let n=t.__key,r=f(t,null),l=r.length,o=this._children,i=o.length,a=e.collabNodeMap,c=new Set,u,d,p=0,y=null;i!==l&&(d=t.getWritable());for(let l=0;l<i;l++){let f=r[p],_=o[l],b=_.getNode(),v=_._key;if(null!==b&&f===v){let t=(0,s.kFe)(b);if(c.add(f),t)if(_._key=f,_ instanceof L){let t=_._xmlText;_.syncPropertiesFromYjs(e,null),_.applyChildrenYjsDelta(e,t.toDelta()),_.syncChildrenFromYjs(e)}else _ instanceof m?_.syncPropertiesAndTextFromYjs(e,null):_ instanceof P?_.syncPropertiesFromYjs(e,null):_ instanceof g||h(93);y=b,p++}else{if(void 0===u){u=new Set;for(let e=0;e<i;e++){let t=o[e]._key;""!==t&&u.add(t)}}if(null!==b&&void 0!==f&&!u.has(f)){let e=(0,s.GbW)(f);(0,s.fh4)(e),l--,p++;continue}d=t.getWritable();let r=function(e,t,n){let r=t.getType(),l=e.editor._nodes.get(r);void 0===l&&h(88,r);let s=new l.klass;if(s.__parent=n,t._key=s.__key,t instanceof L){let n=t._xmlText;t.syncPropertiesFromYjs(e,null),t.applyChildrenYjsDelta(e,n.toDelta()),t.syncChildrenFromYjs(e)}else t instanceof m?t.syncPropertiesAndTextFromYjs(e,null):t instanceof P&&t.syncPropertiesFromYjs(e,null);return e.collabNodeMap.set(s.__key,t),s}(e,_,n),c=r.__key;if(a.set(c,_),null===y){let e=d.getFirstChild();if(d.__first=c,null!==e){let t=e.getWritable();t.__prev=c,r.__next=t.__key}}else{let e=y.getWritable(),t=y.getNextSibling();if(e.__next=c,r.__prev=y.__key,null!==t){let e=t.getWritable();e.__prev=c,r.__next=e.__key}}l===i-1&&(d.__last=c),d.__size++,y=r}}for(let t=0;t<l;t++){let n=r[t];if(!c.has(n)){let t=(0,s.GbW)(n),r=e.collabNodeMap.get(n);void 0!==r&&r.destroy(e),(0,s.fh4)(t)}}}syncPropertiesFromLexical(e,t,n){I(e,this._xmlText,this.getPrevNode(n),t)}_syncChildFromLexical(e,t,n,r,l,o){let i=this._children[t],a=(0,s.GbW)(n);i instanceof L&&(0,s.ff4)(a)?(i.syncPropertiesFromLexical(e,a,r),i.syncChildrenFromLexical(e,a,r,l,o)):i instanceof m&&(0,s.kFe)(a)?i.syncPropertiesAndTextFromLexical(e,a,r):i instanceof P&&(0,s.Cyw)(a)&&i.syncPropertiesFromLexical(e,a,r)}syncChildrenFromLexical(e,t,n,r,l){let o=this.getPrevNode(n),i=null===o?[]:f(o,n),a=f(t,null),c=i.length-1,u=a.length-1,d=e.collabNodeMap,h,g,p=0,m=0;for(;p<=c&&m<=u;){let t=i[p],o=a[m];if(t===o)this._syncChildFromLexical(e,m,o,n,r,l),p++,m++;else{void 0===h&&(h=new Set(i)),void 0===g&&(g=new Set(a));let n=g.has(t),r=h.has(o);if(n){let t=C(e,(0,s.GbW)(o),this);d.set(o,t),r?(this.splice(e,m,1,t),p++):this.splice(e,m,0,t),m++}else this.splice(e,m,1),p++}}let y=p>c,_=m>u;if(y&&!_)for(;m<=u;++m){let t=a[m],n=C(e,(0,s.GbW)(t),this);this.append(n),d.set(t,n)}else if(_&&!y)for(let t=this._children.length-1;t>=m;t--)this.splice(e,t,1)}append(e){let t=this._xmlText,n=this._children,r=n[n.length-1],l=void 0!==r?r.getOffset()+r.getSize():0;if(e instanceof L)t.insertEmbed(l,e._xmlText);else if(e instanceof m){let n=e._map;null===n.parent&&t.insertEmbed(l,n),t.insert(l+1,e._text)}else e instanceof g?t.insertEmbed(l,e._map):e instanceof P&&t.insertEmbed(l,e._xmlElem);this._children.push(e)}splice(e,t,n,r){let l=this._children,s=l[t];if(void 0===s)return void 0===r&&h(94),void this.append(r);let o=s.getOffset();-1===o&&h(95);let i=this._xmlText;if(0!==n&&i.delete(o,s.getSize()),r instanceof L)i.insertEmbed(o,r._xmlText);else if(r instanceof m){let e=r._map;null===e.parent&&i.insertEmbed(o,e),i.insert(o+1,r._text)}else r instanceof g?i.insertEmbed(o,r._map):r instanceof P&&i.insertEmbed(o,r._xmlElem);if(0!==n){let r=l.slice(t,t+n);for(let t=0;t<r.length;t++)r[t].destroy(e)}void 0!==r?l.splice(t,n,r):l.splice(t,n)}getChildOffset(e){let t=0,n=this._children;for(let r=0;r<n.length;r++){let l=n[r];if(l===e)return t;t+=l.getSize()}return -1}destroy(e){let t=e.collabNodeMap,n=this._children;for(let t=0;t<n.length;t++)n[t].destroy(e);t.get(this._key)===this&&t.delete(this._key)}}function j(e,t,n){let r=new L(e,t,n);return e._collabNode=r,r}function M(e,t){let n=t.collabNodeMap.get(e.key);if(void 0===n)return null;let r=e.offset,l=n.getSharedType();if(n instanceof m){l=n._parent._xmlText;let e=n.getOffset();if(-1===e)return null;r=e+1+r}else if(n instanceof L&&"element"===e.type){let t=e.getNode();(0,s.ff4)(t)||h(184);let n=0,l=0,o=t.getFirstChild();for(;null!==o&&l++<r;)(0,s.kFe)(o)?n+=o.getTextContentSize()+1:n++,o=o.getNextSibling();r=n}return(0,o.SF)(l,r)}function R(e,t){return(0,o.IT)(e,t.doc)}function $(e,t){if(null==e){if(null!=t)return!0}else if(null==t||!(0,o.uG)(e,t))return!0;return!1}function U(e,t){let n=e.cursorsContainer;if(null!==n){let e=t.selections,r=e.length;for(let t=0;t<r;t++)n.removeChild(e[t])}}function B(e,t){let{anchorPos:n,focusPos:r}=t,l=null,s=0,o=null,i=0;if(null!==n&&null!==r){let t=R(n,e),a=R(r,e);null!==t&&null!==a&&([l,s]=J(t.type,t.index),[o,i]=J(a.type,a.index))}return{anchorCollabNode:l,anchorOffset:s,focusCollabNode:o,focusOffset:i}}function z(e,t){let n=t.awareness.getLocalState();if(null===n)return;let{anchorCollabNode:r,anchorOffset:l,focusCollabNode:o,focusOffset:i}=B(e,n);if(null!==r&&null!==o){let e=r.getKey(),t=o.getKey(),n=(0,s.vJq)();if(!(0,s.I2P)(n))return;W(n.anchor,e,l),W(n.focus,t,i)}}function W(e,t,n){if(e.key!==t||e.offset!==n){let r=(0,s.nsf)(t);if(null!==r&&!(0,s.ff4)(r)&&!(0,s.kFe)(r)){let e=r.getParentOrThrow();t=e.getKey(),n=r.getIndexWithinParent(),r=e}e.set(t,n,(0,s.ff4)(r)?"element":"text")}}function J(e,t){let n=e._collabNode;if(void 0===n)return[null,0];if(n instanceof L){let{node:e,offset:r}=O(n,t,!0);return null===e?[n,0]:[e,r]}return[null,0]}function H(e,t){return t.awareness.getStates()}function K(e,t,n){let{getAwarenessStates:r=H}=n??{},l=Array.from(r(e,t)),o=e.clientID,i=e.cursors,a=e.editor._editorState._nodeMap,c=new Set;for(let t=0;t<l.length;t++){let[n,r]=l[t];if(n!==o){c.add(n);let{name:t,color:l,focusing:o}=r,u=null,f=i.get(n);if(void 0===f&&(f={color:l,name:t,selection:null},i.set(n,f)),o){let{anchorCollabNode:t,anchorOffset:n,focusCollabNode:l,focusOffset:s}=B(e,r);if(null!==t&&null!==l){let e=t.getKey(),r=l.getKey();if(null===(u=f.selection))u=function(e,t,n,r,l){let s=e.color,o=document.createElement("span");o.style.cssText=`position:absolute;top:0;bottom:0;right:-1px;width:1px;background-color:${s};z-index:10;`;let i=document.createElement("span");return i.textContent=e.name,i.style.cssText=`position:absolute;left:-2px;top:-16px;background-color:${s};color:#fff;line-height:12px;font-size:12px;padding:2px;font-family:Arial;font-weight:bold;white-space:nowrap;`,o.appendChild(i),{anchor:{key:t,offset:n},caret:o,color:s,focus:{key:r,offset:l},name:i,selections:[]}}(f,e,n,r,s);else{let t=u.anchor,l=u.focus;t.key=e,t.offset=n,l.key=r,l.offset=s}}}!function(e,t,n,r){let l,o=e.editor,i=o.getRootElement(),a=e.cursorsContainer;if(null===a||null===i)return;let c=a.offsetParent;if(null===c)return;let u=c.getBoundingClientRect(),f=t.selection;if(null===n)return null===f||(t.selection=null,U(e,f));t.selection=n;let h=n.caret,g=n.color,p=n.selections,m=n.anchor,y=n.focus,_=m.key,b=y.key,v=r.get(_),w=r.get(b);if(null==v||null==w)return;if(v===w&&(0,s.wH$)(v))l=[o.getElementByKey(_).getBoundingClientRect()];else{let e=(0,d.cb)(o,v,m.offset,w,y.offset);if(null===e)return;l=(0,d.zT)(o,e)}let x=p.length,C=l.length;for(let e=0;e<C;e++){let t=l[e],n=p[e];if(void 0===n){n=document.createElement("span"),p[e]=n;let t=document.createElement("span");n.appendChild(t),a.appendChild(n)}let r=`position:absolute;top:${t.top-u.top}px;left:${t.left-u.left}px;height:${t.height}px;width:${t.width}px;pointer-events:none;z-index:5;`;n.style.cssText=r,n.firstChild.style.cssText=`${r}left:0;top:0;background-color:${g};opacity:0.3;`,e===C-1&&h.parentNode!==n&&n.appendChild(h)}for(let e=x-1;e>=C;e--){let t=p[e];a.removeChild(t),p.pop()}}(e,f,u,a)}}let u=Array.from(i.keys());for(let t=0;t<u.length;t++){let n=u[t];if(!c.has(n)){let t=i.get(n);void 0!==t&&(function(e,t){let n=t.selection;null!==n&&U(e,n)}(e,t),i.delete(n))}}}function Y(e,t,n,r){let l=t.awareness,o=l.getLocalState();if(null===o)return;let{anchorPos:i,focusPos:a,name:c,color:u,focusing:f,awarenessData:d}=o,h=null,g=null;(null!==r&&(null===i||r.is(n))||null!==n)&&((0,s.I2P)(r)&&(h=M(r.anchor,e),g=M(r.focus,e)),($(i,h)||$(a,g))&&l.setLocalState({...o,anchorPos:h,awarenessData:d,color:u,focusPos:g,focusing:f,name:c}))}let G=(0,s.guI)("CONNECTED_COMMAND"),Z=(0,s.guI)("TOGGLE_CONNECT_COMMAND");function Q(e,t,n,r,l){let{awareness:s}=e,o=s.getLocalState();null===o&&(o={anchorPos:null,awarenessData:l,color:n,focusPos:null,focusing:r,name:t}),o.focusing=r,s.setLocalState(o)}var q=n(12115),V=n(92749),X=n(47650),ee=n(95155);function et({id:e,providerFactory:t,shouldBootstrap:n,username:s,cursorColor:i,cursorsContainerRef:a,initialEditorState:c,excludedProperties:u,awarenessData:f,syncCursorPositionsFn:d}){let g=(0,q.useRef)(!1),p=(0,q.useRef)(!1),m=(0,r.k)(s,i),{yjsDocMap:y,name:_,color:b}=m,[v]=(0,l.DF)();(0,q.useEffect)(()=>(m.isCollabActive=!0,()=>{null==v._parentEditor&&(m.isCollabActive=!1)}),[m,v]);let[w,x]=(0,q.useState)();(0,q.useEffect)(()=>{if(p.current)return;p.current=!0;let n=t(e,y);return x(n),()=>{n.disconnect()}},[e,t,y]);let[C,S]=(0,q.useState)(y.get(e)),[k,E]=(0,q.useState)();return(0,q.useEffect)(()=>{if(!w||g.current)return;g.current=!0;let t=function(e,t,n,r,l,s){null==r&&h(81);let i=j(r.get("root",o.ZQ),null,"root");return i._key="root",{clientID:r.clientID,collabNodeMap:new Map,cursors:new Map,cursorsContainer:null,doc:r,docMap:l,editor:e,excludedProperties:s||new Map,id:n,nodeProperties:new Map,root:i}}(v,0,e,C||y.get(e),y,u);return E(t),()=>{t.root.destroy(t)}},[v,w,e,y,C,u]),w&&k?(0,ee.jsx)(en,{awarenessData:f,binding:k,collabContext:m,color:b,cursorsContainerRef:a,editor:v,id:e,initialEditorState:c,name:_,provider:w,setDoc:S,shouldBootstrap:n,yjsDocMap:y,syncCursorPositionsFn:d}):(0,ee.jsx)(ee.Fragment,{})}function en({editor:e,id:t,provider:n,yjsDocMap:r,name:l,color:i,shouldBootstrap:a,cursorsContainerRef:c,initialEditorState:u,awarenessData:f,collabContext:d,binding:g,setDoc:p,syncCursorPositionsFn:y}){let _=function(e,t,n,r,l,i,a,c,u,f,d,g,p=K){let y=(0,q.useRef)(!1),_=(0,q.useCallback)(()=>n.connect(),[n]),b=(0,q.useCallback)(()=>{try{n.disconnect()}catch(e){}},[n]);(0,q.useEffect)(()=>{var f,v;let{root:w}=c,{awareness:x}=n,C=({status:t})=>{e.dispatchCommand(G,"connected"===t)},E=t=>{a&&t&&w.isEmpty()&&0===w._xmlText._length&&!1===y.current&&e.update(()=>{let t=(0,s.NiT)();if(t.isEmpty())if(d)switch(typeof d){case"string":{let t=e.parseEditorState(d);e.setEditorState(t,{tag:s.T40});break}case"object":e.setEditorState(d,{tag:s.T40});break;case"function":e.update(()=>{(0,s.NiT)().isEmpty()&&d(e)},{tag:s.T40})}else{let n=(0,s.lJ7)();t.append(n);let{activeElement:r}=document;(null!==(0,s.vJq)()||null!==r&&r===e.getRootElement())&&n.select()}},{tag:s.T40}),y.current=!1},T=()=>{p(c,n)},N=(e,t)=>{let r=t.origin;r!==c&&function(e,t,n,r,l=K){let i=e.editor,a=i._editorState;n.forEach(e=>e.delta),i.update(()=>{for(let t=0;t<n.length;t++)!function(e,t){if(t instanceof o.Cr&&function(e,t){let{target:n}=t;if(!n._item||"__state"!==n._item.parentSub||void 0!==S(n)||!(n.parent instanceof o.ZQ||n.parent instanceof o.WF||n.parent instanceof o.T5))return!1;let r=k(e,n.parent).getNode();if(r){let e=(0,s.swd)(r.getWritable());for(let r of t.keysChanged)e.updateFromUnknown(r,n.get(r))}return!0}(e,t))return;let{target:n}=t,r=k(e,n);if(r instanceof L&&t instanceof o.zN){let{keysChanged:n,childListChanged:l,delta:s}=t;n.size>0&&r.syncPropertiesFromYjs(e,n),l&&(r.applyChildrenYjsDelta(e,s),r.syncChildrenFromYjs(e))}else if(r instanceof m&&t instanceof o.Cr){let{keysChanged:n}=t;n.size>0&&r.syncPropertiesAndTextFromYjs(e,n)}else if(r instanceof P&&t instanceof o.xz){let{attributesChanged:n}=t;n.size>0&&r.syncPropertiesFromYjs(e,n)}else h(82)}(e,n[t]);let l=(0,s.vJq)();if((0,s.I2P)(l))if(D(l)){let n=a._selection;(0,s.I2P)(n)&&(z(e,t),D(l))&&function e(t,n){let r=n._nodeMap.get(t);if(!r)return void(0,s.NiT)().selectStart();let l=r.__prev,o=null;l&&(o=(0,s.nsf)(l)),null===o&&null!==r.__parent&&(o=(0,s.nsf)(r.__parent)),null!==o?null!==o&&o.isAttached()?o.selectEnd():e(o.__key,n):(0,s.NiT)().selectStart()}(l.anchor.key,a),Y(e,t,n,(0,s.vJq)())}else z(e,t);r||(0,s.JAT)(s.OQi)},{onUpdate:()=>{l(e,t),i.update(()=>{0===(0,s.NiT)().getChildrenSize()&&(0,s.NiT)().append((0,s.lJ7)())})},skipTransforms:!0,tag:r?s.n0X:s.Ng_})}(c,n,e,r instanceof o.ad,p)};f=document.activeElement===e.getRootElement(),v=g||{},n.awareness.setLocalState({anchorPos:null,awarenessData:v,color:i,focusPos:null,focusing:f,name:l});let I=n=>{!function(e,t){if(e.update(()=>{let e=(0,s.NiT)();e.clear(),e.select()},{tag:s.NsJ}),null==t.cursors)return;let n=t.cursors;if(null==n)return;let r=t.cursorsContainer;if(null==r)return;let l=Array.from(n.values());for(let e=0;e<l.length;e++){let t=l[e].selection;if(t&&null!=t.selections){let n=t.selections;for(let t=0;t<n.length;t++)r.removeChild(n[e])}}}(e,c),u(n),r.set(t,n),y.current=!0};n.on("reload",I),n.on("status",C),n.on("sync",E),x.on("update",T),w.getSharedType().observeDeep(N);let F=e.registerUpdateListener(({prevEditorState:e,editorState:t,dirtyLeaves:r,dirtyElements:l,normalizedNodes:o,tags:i})=>{!1===i.has(s.NsJ)&&c.doc.transact(()=>{t.read(()=>{if(i.has(s.Ng_)||i.has(s.n0X))return void(o.size>0&&function(e,t){let n=Array.from(t),r=e.collabNodeMap,l=[],o=[];for(let e=0;e<n.length;e++){let t=n[e],i=(0,s.nsf)(t),a=r.get(t);if(a instanceof m)if((0,s.kFe)(i))l.push([a,i.__text]);else{let e=a.getOffset();if(-1===e)continue;let t=a._parent;a._normalized=!0,t._xmlText.delete(e,1),o.push(a)}}for(let e=0;e<o.length;e++){let t=o[e],n=t.getKey();r.delete(n);let l=t._parent._children,s=l.indexOf(t);l.splice(s,1)}for(let e=0;e<l.length;e++){let[t,n]=l[e];t._text=n}}(c,o));if(l.has("root")){let t=e._nodeMap,n=(0,s.NiT)(),o=c.root;o.syncPropertiesFromLexical(c,n,t),o.syncChildrenFromLexical(c,n,t,l,r)}let t=(0,s.vJq)();Y(c,n,e._selection,t)})},c)}),O=_();return()=>{!1===y.current&&(O?O.then(b):b()),n.off("sync",E),n.off("status",C),n.off("reload",I),x.off("update",T),w.getSharedType().unobserveDeep(N),r.delete(t),F()}},[c,i,_,b,r,e,t,d,l,n,a,g,u,p]);let v=(0,q.useMemo)(()=>(0,X.createPortal)((0,ee.jsx)("div",{ref:e=>{c.cursorsContainer=e}}),f&&f.current||document.body),[c,f]);return(0,q.useEffect)(()=>e.registerCommand(Z,e=>(e?(console.log("Collaboration connected!"),_()):(console.log("Collaboration disconnected!"),b()),!0),s.jZM),[_,b,e]),v}(e,t,n,r,l,i,a,g,p,c,u,f,y);return d.clientID=g.clientID,function(e,t){let n=(0,q.useMemo)(()=>{var e;return e=t.root.getSharedType(),new o.ad(e,{trackedOrigins:new Set([t,null])})},[t]);(0,q.useEffect)(()=>(0,V.Sd)(e.registerCommand(s.ZKf,()=>(n.undo(),!0),s.jZM),e.registerCommand(s.V30,()=>(n.redo(),!0),s.jZM))),(0,q.useCallback)(()=>{n.clear()},[n]),q.useEffect(()=>{let t=()=>{e.dispatchCommand(s.KfJ,n.undoStack.length>0),e.dispatchCommand(s.WWb,n.redoStack.length>0)};return n.on("stack-item-added",t),n.on("stack-item-popped",t),n.on("stack-cleared",t),()=>{n.off("stack-item-added",t),n.off("stack-item-popped",t),n.off("stack-cleared",t)}},[e,n])}(e,g),(0,q.useEffect)(()=>(0,V.Sd)(e.registerCommand(s.$7r,()=>(Q(n,l,i,!0,f||{}),!1),s.jZM),e.registerCommand(s.I2H,()=>(Q(n,l,i,!1,f||{}),!1),s.jZM)),[i,e,l,n,f]),_}},50047:(e,t,n)=>{n.d(t,{$5:()=>l,n:()=>s});let r=e=>({[Symbol.iterator](){return this},next:e}),l=(e,t)=>r(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),s=(e,t)=>r(()=>{let{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}})},55498:(e,t,n)=>{n.d(t,{vt:()=>r});let r=e=>new Promise(e);Promise.all.bind(Promise)},57802:(e,t,n)=>{n.d(t,{HT:()=>s,HV:()=>r,S2:()=>l,cy:()=>i,zN:()=>o});let r=e=>e[e.length-1],l=(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n])},s=Array.from,o=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},i=Array.isArray},61077:(e,t,n)=>{n.d(t,{C:()=>l,Tj:()=>o,_4:()=>s,bz:()=>i,vt:()=>r});let r=()=>new Map,l=e=>{let t=r();return e.forEach((e,n)=>{t.set(n,e)}),t},s=(e,t,n)=>{let r=e.get(t);return void 0===r&&e.set(t,r=n()),r},o=(e,t)=>{let n=[];for(let[r,l]of e)n.push(t(l,r));return n},i=(e,t)=>{for(let[n,r]of e)if(t(r,n))return!0;return!1}},63108:(e,t,n)=>{n.d(t,{Af:()=>u,QV:()=>r,db:()=>c,jN:()=>a,tv:()=>f});let r=String.fromCharCode;String.fromCodePoint,r(65535);let l=e=>e.toLowerCase(),s=/^\s*/g,o=e=>e.replace(s,""),i=/([A-Z])/g,a=(e,t)=>o(e.replace(i,e=>`${t}${l(e)}`)),c="undefined"!=typeof TextEncoder?new TextEncoder:null,u=c?e=>c.encode(e):e=>{let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.codePointAt(e);return r},f="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});f&&1===f.decode(new Uint8Array).length&&(f=null)},67402:(e,t,n)=>{n.d(t,{Bw:()=>i,Im:()=>c,SQ:()=>d,Tj:()=>o,i5:()=>f,jJ:()=>s,kp:()=>r,ol:()=>g});let r=Object.assign,l=Object.keys,s=(e,t)=>{for(let n in e)t(e[n],n)},o=(e,t)=>{let n=[];for(let r in e)n.push(t(e[r],r));return n},i=e=>l(e).length,a=e=>l(e).length,c=e=>{for(let t in e)return!1;return!0},u=(e,t)=>{for(let n in e)if(!t(e[n],n))return!1;return!0},f=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),d=(e,t)=>e===t||a(e)===a(t)&&u(e,(e,n)=>(void 0!==e||f(t,n))&&t[n]===e),h=Object.freeze,g=e=>{for(let t in e){let n=e[t];("object"==typeof n||"function"==typeof n)&&g(e[t])}return h(e)}},68665:(e,t,n)=>{n.d(t,{S8:()=>l,gZ:()=>s}),crypto.subtle;let r=crypto.getRandomValues.bind(crypto),l=()=>r(new Uint32Array(1))[0],s=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(e^l()&15>>e/4).toString(16))},71055:(e,t,n)=>{n.d(t,{CW:()=>g,D1:()=>s,D7:()=>a,Dk:()=>r,KD:()=>l,KJ:()=>i,P1:()=>f,WD:()=>d,WY:()=>u,vZ:()=>h,wn:()=>o,wt:()=>c});let r=1,l=2,s=4,o=8,i=32,a=64,c=128,u=31,f=63,d=127,h=0x7fffffff,g=0xffffffff},78176:(e,t,n)=>{n.d(t,{ft:()=>i,Y:()=>s,AV:()=>c,Qu:()=>a,hN:()=>d,hr:()=>f,UH:()=>u,Ny:()=>o,Tx:()=>h,ET:()=>g});let r=Symbol;var l=n(90224);let s=r(),o=r(),i=r(),a=r(),c=r(),u=r(),f=r(),d=r(),h=r(),g=e=>{1===e.length&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=0;for(;r<e.length;r++){let n=e[r];if(void 0===n)break;if(n.constructor===String||n.constructor===Number)t.push(n);else if(n.constructor===Object)break}for(r>0&&n.push(t.join(""));r<e.length;r++){let t=e[r];t instanceof Symbol||n.push(t)}return n};l._g()},83600:(e,t,n)=>{n.d(t,{Bw:()=>u,D$:()=>O,FA:()=>P,Fo:()=>f,Gu:()=>w,IO:()=>N,LH:()=>v,QJ:()=>g,Qj:()=>b,Sw:()=>A,cq:()=>I,xv:()=>c,zd:()=>p});var r=n(88755),l=n(99968),s=n(71055),o=n(63108),i=n(57802);class a{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}let c=()=>new a,u=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},f=e=>{let t=new Uint8Array(u(e)),n=0;for(let r=0;r<e.bufs.length;r++){let l=e.bufs[r];t.set(l,n),n+=l.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},d=(e,t)=>{let n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(2*r.T9(n,t)),e.cpos=0)},h=(e,t)=>{let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(2*n),e.cpos=0),e.cbuf[e.cpos++]=t},g=h,p=(e,t)=>{for(;t>s.WD;)h(e,s.wt|s.WD&t),t=r.RI(t/128);h(e,s.WD&t)},m=(e,t)=>{let n=r.sj(t);for(n&&(t=-t),h(e,(t>s.P1?s.wt:0)|(n?s.D7:0)|s.P1&t),t=r.RI(t/64);t>0;)h(e,(t>s.WD?s.wt:0)|s.WD&t),t=r.RI(t/128)},y=new Uint8Array(3e4),_=y.length/3,b=o.db&&o.db.encodeInto?(e,t)=>{if(t.length<_){let n=o.db.encodeInto(t,y).written||0;p(e,n);for(let t=0;t<n;t++)h(e,y[t])}else w(e,o.Af(t))}:(e,t)=>{let n=unescape(encodeURIComponent(t)),r=n.length;p(e,r);for(let t=0;t<r;t++)h(e,n.codePointAt(t))},v=(e,t)=>{let n=e.cbuf.length,l=e.cpos,s=r.jk(n-l,t.length),o=t.length-s;e.cbuf.set(t.subarray(0,s),l),e.cpos+=s,o>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(r.T9(2*n,o)),e.cbuf.set(t.subarray(s)),e.cpos=o)},w=(e,t)=>{p(e,t.byteLength),v(e,t)},x=(e,t)=>{d(e,t);let n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},C=(e,t)=>x(e,4).setFloat32(0,t,!1),S=(e,t)=>x(e,8).setFloat64(0,t,!1),k=(e,t)=>x(e,8).setBigInt64(0,t,!1),E=new DataView(new ArrayBuffer(4)),T=e=>(E.setFloat32(0,e),E.getFloat32(0)===e),N=(e,t)=>{switch(typeof t){case"string":h(e,119),b(e,t);break;case"number":l.Fq(t)&&r.tn(t)<=s.vZ?(h(e,125),m(e,t)):T(t)?(h(e,124),C(e,t)):(h(e,123),S(e,t));break;case"bigint":h(e,122),k(e,t);break;case"object":if(null===t)h(e,126);else if(i.cy(t)){h(e,117),p(e,t.length);for(let n=0;n<t.length;n++)N(e,t[n])}else if(t instanceof Uint8Array)h(e,116),w(e,t);else{h(e,118);let n=Object.keys(t);p(e,n.length);for(let r=0;r<n.length;r++){let l=n[r];b(e,l),N(e,t[l])}}break;case"boolean":h(e,t?120:121);break;default:h(e,127)}};class I extends a{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&p(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}let F=e=>{e.count>0&&(m(e.encoder,1===e.count?e.s:-e.s),e.count>1&&p(e.encoder,e.count-2))};class O{constructor(){this.encoder=new a,this.s=0,this.count=0}write(e){this.s===e?this.count++:(F(this),this.count=1,this.s=e)}toUint8Array(){return F(this),f(this.encoder)}}let D=e=>{if(e.count>0){let t=2*e.diff+ +(1!==e.count);m(e.encoder,t),e.count>1&&p(e.encoder,e.count-2)}};class P{constructor(){this.encoder=new a,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(D(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return D(this),f(this.encoder)}}class A{constructor(){this.sarr=[],this.s="",this.lensE=new O}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){let e=new a;return this.sarr.push(this.s),this.s="",b(e,this.sarr.join("")),v(e,this.lensE.toUint8Array()),f(e)}}},88755:(e,t,n)=>{n.d(t,{RI:()=>r,T9:()=>o,jk:()=>s,n7:()=>i,sj:()=>a,tn:()=>l});let r=Math.floor,l=Math.abs,s=(e,t)=>e<t?e:t,o=(e,t)=>e>t?e:t,i=Math.pow,a=e=>0!==e?e<0:1/e<0},90142:(e,t,n)=>{n.d(t,{k:()=>i});var r=n(12115);let l=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]],s=l[Math.floor(Math.random()*l.length)],o=(0,r.createContext)({clientID:0,color:s[1],isCollabActive:!1,name:s[0],yjsDocMap:new Map});function i(e,t){let n=(0,r.useContext)(o);return null!=e&&(n.name=e),null!=t&&(n.color=t),n}},90224:(e,t,n)=>{n.d(t,{_g:()=>r});let r=Date.now},95279:(e,t,n)=>{n.d(t,{vt:()=>r});let r=()=>new Set},95460:(e,t,n)=>{n.d(t,{W:()=>o,c:()=>i});var r=n(61077),l=n(95279),s=n(57802);class o{constructor(){this._observers=r.vt()}on(e,t){return r._4(this._observers,e,l.vt).add(t),t}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);void 0!==n&&(n.delete(t),0===n.size&&this._observers.delete(e))}emit(e,t){return s.HT((this._observers.get(e)||r.vt()).values()).forEach(e=>e(...t))}destroy(){this._observers=r.vt()}}class i{constructor(){this._observers=r.vt()}on(e,t){r._4(this._observers,e,l.vt).add(t)}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);void 0!==n&&(n.delete(t),0===n.size&&this._observers.delete(e))}emit(e,t){return s.HT((this._observers.get(e)||r.vt()).values()).forEach(e=>e(...t))}destroy(){this._observers=r.vt()}}},98628:(e,t,n)=>{n.d(t,{$C:()=>f,Ib:()=>k,Jg:()=>w,VQ:()=>C,bo:()=>g,cQ:()=>x,cw:()=>m,t3:()=>_,xK:()=>S,xh:()=>p});var r=n(71055),l=n(88755),s=n(99968),o=n(63108),i=n(32293);let a=i.vt("Unexpected end of array"),c=i.vt("Integer out of Range");class u{constructor(e){this.arr=e,this.pos=0}}let f=e=>new u(e),d=e=>e.pos!==e.arr.length,h=(e,t)=>{let n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},g=e=>h(e,m(e)),p=e=>e.arr[e.pos++],m=e=>{let t=0,n=1,l=e.arr.length;for(;e.pos<l;){let l=e.arr[e.pos++];if(t+=(l&r.WD)*n,n*=128,l<r.wt)return t;if(t>s.Is)throw c}throw a},y=e=>{let t=e.arr[e.pos++],n=t&r.P1,l=64,o=(t&r.D7)>0?-1:1;if((t&r.wt)==0)return o*n;let i=e.arr.length;for(;e.pos<i;){if(n+=((t=e.arr[e.pos++])&r.WD)*l,l*=128,t<r.wt)return o*n;if(n>s.Is)throw c}throw a},_=o.tv?e=>o.tv.decode(g(e)):e=>{let t=m(e);if(0===t)return"";{let n=String.fromCodePoint(p(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(p(e));else for(;t>0;){let r=t<1e4?t:1e4,l=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,l),t-=r}return decodeURIComponent(escape(n))}},b=(e,t)=>{let n=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,n},v=[e=>void 0,e=>null,y,e=>b(e,4).getFloat32(0,!1),e=>b(e,8).getFloat64(0,!1),e=>b(e,8).getBigInt64(0,!1),e=>!1,e=>!0,_,e=>{let t=m(e),n={};for(let r=0;r<t;r++)n[_(e)]=w(e);return n},e=>{let t=m(e),n=[];for(let r=0;r<t;r++)n.push(w(e));return n},g],w=e=>v[127-p(e)](e);class x extends u{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return 0===this.count&&(this.s=this.reader(this),d(this)?this.count=m(this)+1:this.count=-1),this.count--,this.s}}class C extends u{constructor(e){super(e),this.s=0,this.count=0}read(){if(0===this.count){this.s=y(this);let e=l.sj(this.s);this.count=1,e&&(this.s=-this.s,this.count=m(this)+2)}return this.count--,this.s}}class S extends u{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(0===this.count){let e=y(this);this.diff=l.RI(e/2),this.count=1,1&e&&(this.count=m(this)+2)}return this.s+=this.diff,this.count--,this.s}}class k{constructor(e){this.decoder=new C(e),this.str=_(this.decoder),this.spos=0}read(){let e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}}},99968:(e,t,n)=>{n.d(t,{Fq:()=>o,Is:()=>s});var r=n(88755),l=n(71055);let s=Number.MAX_SAFE_INTEGER;Number.MIN_SAFE_INTEGER,l.vZ,l.CW;let o=Number.isInteger||(e=>"number"==typeof e&&isFinite(e)&&r.RI(e)===e);Number.parseInt}}]);