@confidencesystemsinc/sdk 1.8.1 → 1.8.2
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.
- package/dist/index.cjs +1 -1
- package/dist/index.js +21 -21
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -603,4 +603,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
603
603
|
`||s===`\r
|
|
604
604
|
`?r.push(Lo()):s===" "?r.push(ta()):r.push(rt(s))}this.insertNodes(r)}insertText(t){const n=this.anchor,r=this.focus,o=this.format,i=this.style;let s=n,a=r;!this.isCollapsed()&&r.isBefore(n)&&(s=r,a=n),s.type==="element"&&(function(m,y,b,v){const w=m.getNode(),A=w.getChildAtIndex(m.offset),C=rt();if(C.setFormat(b),C.setStyle(v),Bd(A))A.splice(0,0,[C]);else{const _=Ye(w)?Tt().append(C):C;A===null?w.append(_):A.insertBefore(_)}m.is(y)&&y.set(C.__key,0,"text"),m.set(C.__key,0,"text")})(s,a,o,i),a.type==="element"&&$o(a,Yt(nr(a,"next")));const l=s.offset;let c=a.offset;const u=this.getNodes(),f=u.length;let d=u[0];X(d)||U(26);const h=d.getTextContent().length,p=d.getParentOrThrow();let g=u[f-1];if(f===1&&a.type==="element"&&(c=h,a.set(s.key,c,"text")),this.isCollapsed()&&l===h&&(Wn(d)||!d.canInsertTextAfter()||!p.canInsertTextAfter()&&d.getNextSibling()===null)){let m=d.getNextSibling();if(X(m)&&m.canInsertTextBefore()&&!Wn(m)||(m=rt(),m.setFormat(o),m.setStyle(i),p.canInsertTextAfter()?d.insertAfter(m):p.insertAfter(m)),m.select(0,0),d=m,t!=="")return void this.insertText(t)}else if(this.isCollapsed()&&l===0&&(Wn(d)||!d.canInsertTextBefore()||!p.canInsertTextBefore()&&d.getPreviousSibling()===null)){let m=d.getPreviousSibling();if(X(m)&&!Wn(m)||(m=rt(),m.setFormat(o),p.canInsertTextBefore()?d.insertBefore(m):p.insertBefore(m)),m.select(),d=m,t!=="")return void this.insertText(t)}else if(d.isSegmented()&&l!==h){const m=rt(d.getTextContent());m.setFormat(o),d.replace(m),d=m}else if(!this.isCollapsed()&&t!==""){const m=g.getParent();if(!p.canInsertTextBefore()||!p.canInsertTextAfter()||R(m)&&(!m.canInsertTextBefore()||!m.canInsertTextAfter()))return this.insertText(""),ex(this.anchor,this.focus,null),void this.insertText(t)}if(f===1){if(wo(d)){const v=rt(t);return v.select(),void d.replace(v)}const m=d.getFormat(),y=d.getStyle();if(l!==c||m===o&&y===i){if(Xv(d)){const v=rt(t);return v.setFormat(o),v.setStyle(i),v.select(),void d.replace(v)}}else{if(d.getTextContent()!==""){const v=rt(t);if(v.setFormat(o),v.setStyle(i),v.select(),l===0)d.insertBefore(v,!1);else{const[w]=d.splitText(l);w.insertAfter(v,!1)}return void(v.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length))}d.setFormat(o),d.setStyle(i)}const b=c-l;d=d.spliceText(l,b,t,!0),d.getTextContent()===""?d.remove():this.anchor.type==="text"&&(d.isComposing()?this.anchor.offset-=t.length:(this.format=m,this.style=y))}else{const m=new Set([...d.getParentKeys(),...g.getParentKeys()]),y=R(d)?d:d.getParentOrThrow();let b=R(g)?g:g.getParentOrThrow(),v=g;if(!y.is(b)&&b.isInline())do v=b,b=b.getParentOrThrow();while(b.isInline());if(a.type==="text"&&(c!==0||g.getTextContent()==="")||a.type==="element"&&g.getIndexWithinParent()<c)if(X(g)&&!wo(g)&&c!==g.getTextContentSize()){if(g.isSegmented()){const E=rt(g.getTextContent());g.replace(E),g=E}Ye(a.getNode())||a.type!=="text"||(g=g.spliceText(0,c,"")),m.add(g.__key)}else{const E=g.getParentOrThrow();E.canBeEmpty()||E.getChildrenSize()!==1?g.remove():E.remove()}else m.add(g.__key);const w=b.getChildren(),A=new Set(u),C=y.is(b),_=y.isInline()&&d.getNextSibling()===null?y:d;for(let E=w.length-1;E>=0;E--){const N=w[E];if(N.is(d)||R(N)&&N.isParentOf(d))break;N.isAttached()&&(!A.has(N)||N.is(v)?C||_.insertAfter(N,!1):N.remove())}if(!C){let E=b,N=null;for(;E!==null;){const P=E.getChildren(),I=P.length;(I===0||P[I-1].is(N))&&(m.delete(E.__key),N=E),E=E.getParent()}}if(wo(d))if(l===h)d.select();else{const E=rt(t);E.select(),d.replace(E)}else d=d.spliceText(l,h-l,t,!0),d.getTextContent()===""?d.remove():d.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length);for(let E=1;E<f;E++){const N=u[E],P=N.__key;m.has(P)||N.remove()}}}removeText(){const t=Z()===this;Ha(this,N6(dg(this))),t&&Z()!==this&&Pt(this)}formatText(t,n=null){if(this.isCollapsed())return this.toggleFormat(t),void ft(null);const r=this.getNodes(),o=[];for(const w of r)X(w)&&o.push(w);const i=w=>{r.forEach(A=>{if(R(A)){const C=A.getFormatFlags(t,w);A.setTextFormat(C)}})},s=o.length;if(s===0)return this.toggleFormat(t),ft(null),void i(n);const a=this.anchor,l=this.focus,c=this.isBackward(),u=c?l:a,f=c?a:l;let d=0,h=o[0],p=u.type==="element"?0:u.offset;if(u.type==="text"&&p===h.getTextContentSize()&&(d=1,h=o[1],p=0),h==null)return;const g=h.getFormatFlags(t,n);i(g);const m=s-1;let y=o[m];const b=f.type==="text"?f.offset:y.getTextContentSize();if(h.is(y)){if(p===b)return;if(Wn(h)||p===0&&b===h.getTextContentSize())h.setFormat(g);else{const w=h.splitText(p,b),A=p===0?w[0]:w[1];A.setFormat(g),u.type==="text"&&u.set(A.__key,0,"text"),f.type==="text"&&f.set(A.__key,b-p,"text")}return void(this.format=g)}p===0||Wn(h)||([,h]=h.splitText(p),p=0),h.setFormat(g);const v=y.getFormatFlags(t,g);b>0&&(b===y.getTextContentSize()||Wn(y)||([y]=y.splitText(b)),y.setFormat(v));for(let w=d+1;w<m;w++){const A=o[w],C=A.getFormatFlags(t,v);A.setFormat(C)}u.type==="text"&&u.set(h.__key,p,"text"),f.type==="text"&&f.set(y.__key,b,"text"),this.format=g|v}insertNodes(t){if(t.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();const p=Z();return $(p)||U(134),p.insertNodes(t)}const n=(this.isBackward()?this.focus:this.anchor).getNode(),r=at(n,yr),o=t[t.length-1];if(R(r)&&"__language"in r){if("__language"in t[0])this.insertText(t[0].getTextContent());else{const p=Zc(this);r.splice(p,0,t),o.selectEnd()}return}if(!t.some(p=>(R(p)||Te(p))&&!p.isInline())){R(r)||U(211,n.constructor.name,n.getType());const p=Zc(this);return r.splice(p,0,t),void o.selectEnd()}const i=(function(p){const g=Tt();let m=null;for(let y=0;y<p.length;y++){const b=p[y],v=xo(b);if(v||Te(b)&&b.isInline()||R(b)&&b.isInline()||X(b)||b.isParentRequired()){if(m===null&&(m=b.createParentElementNode(),g.append(m),v))continue;m!==null&&m.append(b)}else g.append(b),m=null}return g})(t),s=i.getLastDescendant(),a=i.getChildren(),l=!R(r)||!r.isEmpty()?this.insertParagraph():null,c=a[a.length-1];let u=a[0];var f;R(f=u)&&yr(f)&&!f.isEmpty()&&R(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(R(r)||U(211,n.constructor.name,n.getType()),r.append(...u.getChildren()),u=a[1]),u&&(r===null&&U(212,n.constructor.name,n.getType()),(function(p,g){const m=g.getParentOrThrow().getLastChild();let y=g;const b=[g];for(;y!==m;)y.getNextSibling()||U(140),y=y.getNextSibling(),b.push(y);let v=p;for(const w of b)v=v.insertAfter(w)})(r,u));const d=at(s,yr);l&&R(d)&&(l.canMergeWhenEmpty()||yr(c))&&(d.append(...l.getChildren()),l.remove()),R(r)&&r.isEmpty()&&r.remove(),s.selectEnd();const h=R(r)?r.getLastChild():null;xo(h)&&d!==r&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){const s=Tt();return We().splice(this.anchor.offset,0,[s]),s.select(),s}const t=Zc(this),n=at(this.anchor.getNode(),yr);R(n)||U(213);const r=n.getChildAtIndex(t),o=r?[r,...r.getNextSiblings()]:[],i=n.insertNewAfter(this,!1);return i?(i.append(...o),i.selectStart(),i):null}insertLineBreak(t){const n=Lo();if(this.insertNodes([n]),t){const r=n.getParentOrThrow(),o=n.getIndexWithinParent();r.select(o,o)}}extract(){const t=[...this.getNodes()],n=t.length;let r=t[0],o=t[n-1];const[i,s]=Of(this),a=this.isBackward(),[l,c]=a?[this.focus,this.anchor]:[this.anchor,this.focus],[u,f]=a?[s,i]:[i,s];if(n===0)return[];if(n===1){if(X(r)&&!this.isCollapsed()){const d=r.splitText(u,f),h=u===0?d[0]:d[1];return h?(l.set(h.getKey(),0,"text"),c.set(h.getKey(),h.getTextContentSize(),"text"),[h]):[]}return[r]}if(X(r)&&(u===r.getTextContentSize()?t.shift():u!==0&&([,r]=r.splitText(u),t[0]=r,l.set(r.getKey(),0,"text"))),X(o)){const d=o.getTextContent().length;f===0?t.pop():f!==d&&([o]=o.splitText(f),t[t.length-1]=o,c.set(o.getKey(),o.getTextContentSize(),"text"))}return t}modify(t,n,r){if(Ym(this,t,n,r))return;const o=t==="move",i=Re(),s=en(Xt(i));if(!s)return;const a=i._blockCursorElement,l=i._rootElement,c=this.focus.getNode();if(l===null||a===null||!R(c)||c.isInline()||c.canBeEmpty()||Rf(a,i,l),this.dirty){let u=Do(i,this.anchor.key),f=Do(i,this.focus.key);this.anchor.type==="text"&&(u=Di(u)),this.focus.type==="text"&&(f=Di(f)),u&&f&&ix(s,u,this.anchor.offset,f,this.focus.offset)}if((function(u,f,d,h){u.modify(f,d,h)})(s,t,n?"backward":"forward",r),s.rangeCount>0){const u=s.getRangeAt(0),f=this.anchor.getNode(),d=Ye(f)?f:h6(f);if(this.applyDOMRange(u),this.dirty=!0,!o){const h=this.getNodes(),p=[];let g=!1;for(let m=0;m<h.length;m++){const y=h[m];Lf(y,d)?p.push(y):g=!0}if(g&&p.length>0)if(n){const m=p[0];R(m)?m.selectStart():m.getParentOrThrow().selectStart()}else{const m=p[p.length-1];R(m)?m.selectEnd():m.getParentOrThrow().selectEnd()}s.anchorNode===u.startContainer&&s.anchorOffset===u.startOffset||(function(m){const y=m.focus,b=m.anchor,v=b.key,w=b.offset,A=b.type;b.set(y.key,y.offset,y.type,!0),y.set(v,w,A,!0)})(this)}}r==="lineboundary"&&Ym(this,t,n,r,"decorators")}forwardDeletion(t,n,r){if(!r&&(t.type==="element"&&R(n)&&t.offset===n.getChildrenSize()||t.type==="text"&&t.offset===n.getTextContentSize())){const o=n.getParent(),i=n.getNextSibling()||(o===null?null:o.getNextSibling());if(R(i)&&i.isShadowRoot())return!0}return!1}deleteCharacter(t){const n=this.isCollapsed();if(this.isCollapsed()){const r=this.anchor;let o=r.getNode();if(this.forwardDeletion(r,o,t))return;const i=rh(nr(r,t?"previous":"next"));if(i.getTextSlices().every(a=>a===null||a.distance===0)){let a={type:"initial"};for(const l of i.iterNodeCarets("shadowRoot"))if(Tn(l)){if(!l.origin.isInline()){if(l.origin.isShadowRoot()){if(a.type==="merge-block")break;if(R(i.anchor.origin)&&i.anchor.origin.isEmpty()){const c=Yt(l);Ha(this,Fr(c,c)),i.anchor.origin.remove()}return}a.type!=="merge-next-block"&&a.type!=="merge-block"||(a={block:a.block,caret:l,type:"merge-block"})}}else{if(a.type==="merge-block")break;if(ji(l)){if(R(l.origin)){if(l.origin.isInline()){if(!l.origin.isParentOf(i.anchor.origin))break}else a={block:l.origin,type:"merge-next-block"};continue}if(Te(l.origin)){if(!l.origin.isIsolated())if(a.type==="merge-next-block"&&(l.origin.isKeyboardSelectable()||!l.origin.isInline())&&R(i.anchor.origin)&&i.anchor.origin.isEmpty()){i.anchor.origin.remove();const c=ox();c.add(l.origin.getKey()),Pt(c)}else l.origin.remove();return}break}}if(a.type==="merge-block"){const{caret:l,block:c}=a;return Ha(this,Fr(!l.origin.isEmpty()&&c.isEmpty()?oh(xt(c,l.direction)):i.anchor,l)),this.removeText()}}const s=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&r.offset===0&&Bm(this,r.getNode()))return}else{const a=s.type==="text"?s.getNode():null;if(o=r.type==="text"?r.getNode():null,a!==null&&a.isSegmented()){const l=s.offset,c=a.getTextContentSize();if(a.is(o)||t&&l!==c||!t&&l!==0)return void Wm(a,t,l)}else if(o!==null&&o.isSegmented()){const l=r.offset,c=o.getTextContentSize();if(o.is(a)||t&&l!==0||!t&&l!==c)return void Wm(o,t,l)}(function(l,c){const u=l.anchor,f=l.focus,d=u.getNode(),h=f.getNode();if(d===h&&u.type==="text"&&f.type==="text"){const p=u.offset,g=f.offset,m=p<g,y=m?p:g,b=m?g:p,v=b-1;y!==v&&(function(w){return!(Cx(w)||Z3(w))})(d.getTextContent().slice(y,b))&&(c?f.set(f.key,v,f.type):u.set(u.key,v,u.type))}})(this,t)}}if(this.removeText(),t&&!n&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const r=this.anchor.getNode();r.isEmpty()&&Ye(r.getParent())&&r.getPreviousSibling()===null&&Bm(this,r)}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText()}deleteWord(t){if(this.isCollapsed()){const n=this.anchor,r=n.getNode();if(this.forwardDeletion(n,r,t))return;this.modify("extend",t,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function ot(e){return e instanceof Jl}function Um(e){const t=e.offset;if(e.type==="text")return t;const n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function Of(e){const t=e.getStartEndPoints();if(t===null)return[0,0];const[n,r]=t;return n.type==="element"&&r.type==="element"&&n.key===r.key&&n.offset===r.offset?[0,0]:[Um(n),Um(r)]}function Bm(e,t){for(let n=t;n;n=n.getParent()){if(R(n)){if(n.collapseAtStart(e))return!0;if(jt(n))break}if(n.getPreviousSibling())break}return!1}const Z3=(()=>{try{const e=new RegExp("\\p{Emoji}","u"),t=e.test.bind(e);if(t("❤️")&&t("#️⃣")&&t("👍"))return t}catch{}return()=>!1})();function Wm(e,t,n){const r=e,o=r.getTextContent().split(/(?=\s)/g),i=o.length;let s=0,a=0;for(let c=0;c<i;c++){const u=c===i-1;if(a=s,s+=o[c].length,t&&s===n||s>n||u){o.splice(c,1),u&&(a=void 0);break}}const l=o.join("").trim();l===""?r.remove():(r.setTextContent(l),r.select(a,a))}function Km(e,t,n,r){let o,i=t;if(pt(e)){let s=!1;const a=e.childNodes,l=a.length,c=r._blockCursorElement;i===l&&(s=!0,i=l-1);let u=a[i],f=!1;if(u===c)u=a[i+1],f=!0;else if(c!==null){const d=c.parentNode;e===d&&t>Array.prototype.indexOf.call(d.children,c)&&i--}if(o=ci(u),X(o))i=Pr(o,s?"next":"previous");else{let d=ci(e);if(d===null)return null;if(R(d)){const h=r.getElementByKey(d.getKey());h===null&&U(214),[d,i]=d.getDOMSlot(h).resolveChildIndex(d,h,e,t),R(d)||U(215),s&&i>=d.getChildrenSize()&&(i=Math.max(0,d.getChildrenSize()-1));let g=d.getChildAtIndex(i);if(R(g)&&(function(m,y,b){const v=m.getParent();return b===null||v===null||!v.canBeEmpty()||v!==b.getNode()})(g,0,n)){const m=s?g.getLastDescendant():g.getFirstDescendant();m===null?d=g:(g=m,d=R(g)?g:g.getParentOrThrow()),i=0}X(g)?(o=g,d=null,i=Pr(g,s?"next":"previous")):g!==d&&s&&!f&&(R(d)||U(216),i=Math.min(d.getChildrenSize(),i+1))}else{const h=d.getIndexWithinParent();i=t===0&&Te(d)&&ci(e)===d?h:h+1,d=d.getParentOrThrow()}if(R(d))return Pn(d.__key,i,"element")}}else o=ci(e);return X(o)?Pn(o.__key,Pr(o,i,"clamp"),"text"):null}function Hm(e,t,n){const r=e.offset,o=e.getNode();if(r===0){const i=o.getPreviousSibling(),s=o.getParent();if(t){if((n||!t)&&i===null&&R(s)&&s.isInline()){const a=s.getPreviousSibling();X(a)&&e.set(a.__key,a.getTextContent().length,"text")}}else R(i)&&!n&&i.isInline()?e.set(i.__key,i.getChildrenSize(),"element"):X(i)&&e.set(i.__key,i.getTextContent().length,"text")}else if(r===o.getTextContent().length){const i=o.getNextSibling(),s=o.getParent();if(t&&R(i)&&i.isInline())e.set(i.__key,0,"element");else if((n||t)&&i===null&&R(s)&&s.isInline()&&!s.canInsertTextAfter()){const a=s.getNextSibling();X(a)&&e.set(a.__key,0,"text")}}}function ex(e,t,n){if(e.type==="text"&&t.type==="text"){const r=e.isBefore(t),o=e.is(t);Hm(e,r,o),Hm(t,!r,o),o&&t.set(e.key,e.offset,e.type);const i=Re();if(i.isComposing()&&i._compositionKey!==e.key&&$(n)){const s=n.anchor,a=n.focus;e.set(s.key,s.offset,s.type,!0),t.set(a.key,a.offset,a.type,!0)}}}function tx(e,t,n,r,o,i){if(e===null||n===null||!oa(o,e,n))return null;const s=Km(e,t,$(i)?i.anchor:null,o);if(s===null)return null;const a=Km(n,r,$(i)?i.focus:null,o);if(a===null)return null;if(s.type==="element"&&a.type==="element"){const l=ci(e),c=ci(n);if(Te(l)&&Te(c))return null}return ex(s,a,i),[s,a]}function Pf(e){return R(e)&&!e.isInline()}function nx(e,t,n,r,o,i){const s=Wr(),a=new Wo(Pn(e,t,o),Pn(n,r,i),0,"");return a.dirty=!0,s._selection=a,a}function rx(){const e=Pn("root",0,"element"),t=Pn("root",0,"element");return new Wo(e,t,0,"")}function ox(){return new Jl(new Set)}function jd(e,t,n,r){const o=n._window;if(o===null)return null;const i=r||o.event,s=i?i.type:void 0,a=s==="selectionchange",l=!df&&(a||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&i&&i.detail===3||s==="drop"||s===void 0);let c,u,f,d;if($(e)&&!l)return e.clone();if(t===null)return null;if(c=t.anchorNode,u=t.focusNode,f=t.anchorOffset,d=t.focusOffset,(a||s===void 0)&&$(e)&&!oa(n,c,u))return e.clone();const h=tx(c,f,u,d,n,e);if(h===null)return null;const[p,g]=h;return new Wo(p,g,$(e)?e.format:0,$(e)?e.style:"")}function Z(){return Wr()._selection}function Gi(){return Re()._editorState._selection}function pl(e,t,n,r=1){const o=e.anchor,i=e.focus,s=o.getNode(),a=i.getNode();if(!t.is(s)&&!t.is(a))return;const l=t.__key;if(e.isCollapsed()){const c=o.offset;if(n<=c&&r>0||n<c&&r<0){const u=Math.max(0,c+r);o.set(l,u,"element"),i.set(l,u,"element"),qm(e)}}else{const c=e.isBackward(),u=c?i:o,f=u.getNode(),d=c?o:i,h=d.getNode();if(t.is(f)){const p=u.offset;(n<=p&&r>0||n<p&&r<0)&&u.set(l,Math.max(0,p+r),"element")}if(t.is(h)){const p=d.offset;(n<=p&&r>0||n<p&&r<0)&&d.set(l,Math.max(0,p+r),"element")}}qm(e)}function qm(e){const t=e.anchor,n=t.offset,r=e.focus,o=r.offset,i=t.getNode(),s=r.getNode();if(e.isCollapsed()){if(!R(i))return;const a=i.getChildrenSize(),l=n>=a,c=l?i.getChildAtIndex(a-1):i.getChildAtIndex(n);if(X(c)){let u=0;l&&(u=c.getTextContentSize()),t.set(c.__key,u,"text"),r.set(c.__key,u,"text")}return}if(R(i)){const a=i.getChildrenSize(),l=n>=a,c=l?i.getChildAtIndex(a-1):i.getChildAtIndex(n);if(X(c)){let u=0;l&&(u=c.getTextContentSize()),t.set(c.__key,u,"text")}}if(R(s)){const a=s.getChildrenSize(),l=o>=a,c=l?s.getChildAtIndex(a-1):s.getChildAtIndex(o);if(X(c)){let u=0;l&&(u=c.getTextContentSize()),r.set(c.__key,u,"text")}}}function ml(e,t,n,r,o){let i=null,s=0,a=null;r!==null?(i=r.__key,X(r)?(s=r.getTextContentSize(),a="text"):R(r)&&(s=r.getChildrenSize(),a="element")):o!==null&&(i=o.__key,X(o)?a="text":R(o)&&(a="element")),i!==null&&a!==null?e.set(i,s,a):(s=t.getIndexWithinParent(),s===-1&&(s=n.getChildrenSize()),e.set(n.__key,s,"element"))}function Vm(e,t,n,r,o){e.type==="text"?e.set(n,e.offset+(t?0:o),"text"):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function ix(e,t,n,r,o){try{e.setBaseAndExtent(t,n,r,o)}catch{}}function J3(e,t,n,r,o,i,s){const a=r.anchorNode,l=r.focusNode,c=r.anchorOffset,u=r.focusOffset,f=document.activeElement;if(o.has($3)&&f!==i||f!==null&&Hd(f))return;if(!$(t))return void(e!==null&&oa(n,a,l)&&r.removeAllRanges());const d=t.anchor,h=t.focus,p=d.key,g=h.key,m=Do(n,p),y=Do(n,g),b=d.offset,v=h.offset,w=t.format,A=t.style,C=t.isCollapsed();let _=m,E=y,N=!1;if(d.type==="text"){_=Di(m);const Y=d.getNode();N=Y.getFormat()!==w||Y.getStyle()!==A}else $(e)&&e.anchor.type==="text"&&(N=!0);var P,I,W,j,z;if(h.type==="text"&&(E=Di(y)),_!==null&&E!==null&&(C&&(e===null||N||$(e)&&(e.format!==w||e.style!==A))&&(P=w,I=A,W=b,j=p,z=performance.now(),Kv=[P,I,W,j,z]),c!==b||u!==v||a!==_||l!==E||r.type==="Range"&&C||(f!==null&&i.contains(f)||o.has(W3)||i.focus({preventScroll:!0}),d.type==="element"))){if(ix(r,_,b,E,v),!o.has(U3)&&t.isCollapsed()&&i!==null&&i===document.activeElement){const Y=$(t)&&t.anchor.type==="element"?_.childNodes[b]||null:r.rangeCount>0?r.getRangeAt(0):null;if(Y!==null){let Q;if(Y instanceof Text){const oe=document.createRange();oe.selectNode(Y),Q=oe.getBoundingClientRect()}else Q=Y.getBoundingClientRect();(function(oe,M,re){const L=Tx(re),F=Zd(L);if(L===null||F===null)return;let{top:K,bottom:B}=M,J=0,V=0,ee=re;for(;ee!==null;){const te=ee===L.body;if(te)J=0,V=Xt(oe).innerHeight;else{const ye=ee.getBoundingClientRect();J=ye.top,V=ye.bottom}let pe=0;if(K<J?pe=-(J-K):B>V&&(pe=B-V),pe!==0)if(te)F.scrollBy(0,pe);else{const ye=ee.scrollTop;ee.scrollTop+=pe;const me=ee.scrollTop-ye;K-=me,B-=me}if(te)break;ee=ia(ee)}})(n,Q,i)}}Cf=!0}}function sx(e){let t=Z()||Gi();t===null&&(t=We().selectEnd()),t.insertNodes(e)}function Zc(e){let t=e;e.isCollapsed()||t.removeText();const n=Z();$(n)&&(t=n),$(t)||U(161);const r=t.anchor;let o=r.getNode(),i=r.offset;for(;!yr(o);){const s=o;if([o,i]=X3(o,i),s.is(o))break}return i}function X3(e,t){const n=e.getParent();if(!n){const o=Tt();return We().append(o),o.select(),[We(),0]}if(X(e)){const o=e.splitText(t);if(o.length===0)return[n,e.getIndexWithinParent()];const i=t===0?0:1;return[n,o[0].getIndexWithinParent()+i]}if(!R(e)||t===0)return[n,e.getIndexWithinParent()];const r=e.getChildAtIndex(t);if(r){const o=new Wo(Pn(e.__key,t,"element"),Pn(e.__key,t,"element"),0,""),i=e.insertNewAfter(o);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function Ym(e,t,n,r,o="decorators-and-blocks"){if(t==="move"&&r==="character"&&!e.isCollapsed()){const[u,f]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return f.set(u.key,u.offset,u.type),!0}const i=nr(e.focus,n?"previous":"next"),s=r==="lineboundary",a=t==="move";let l=i,c=o==="decorators-and-blocks";if(!Lx(l)){for(const u of l){c=!1;const{origin:f}=u;if(!Te(f)||f.isIsolated()||(l=u,!s||!f.isInline()))break}if(c)for(const u of rh(i).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(Tn(u))u.origin.isInline()||(l=u);else{if(R(u.origin))continue;Te(u.origin)&&!u.origin.isInline()&&(l=u)}break}}if(l===i)return!1;if(a&&!s&&Te(l.origin)&&l.origin.isKeyboardSelectable()){const u=ox();return u.add(l.origin.getKey()),Pt(u),!0}return l=Yt(l),a&&$o(e.anchor,l),$o(e.focus,l),c||!s}let it=null,st=null,Ft=!1,Jc=!1,Wa=0;const Qm={characterData:!0,childList:!0,subtree:!0};function na(){return Ft||it!==null&&it._readOnly}function bt(){Ft&&U(13)}function ax(){Wa>99&&U(14)}function Wr(){return it===null&&U(195,lx()),it}function Re(){return st===null&&U(196,lx()),st}function lx(){let e=0;const t=new Set,n=Ro.version;if(typeof window<"u")for(const o of document.querySelectorAll("[contenteditable]")){const i=ec(o);if(qd(i))e++;else if(i){let s=String(i.constructor.version||"<0.17.1");s===n&&(s+=" (separately built, likely a bundler configuration issue)"),t.add(s)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),r}function e6(){return st}function Gm(e,t,n){const r=t.__type,o=gx(e,r);let i=n.get(r);i===void 0&&(i=Array.from(o.transforms),n.set(r,i));const s=i.length;for(let a=0;a<s&&(i[a](t),t.isAttached());a++);}function Zm(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function cx(e,t){if(!t)return;const n=e._updateTags;let r=t;Array.isArray(t)||(r=[t]);for(const o of r)n.add(o)}function t6(e){return zd(e,Re()._nodes)}function zd(e,t){const n=e.type,r=t.get(n);r===void 0&&U(17,n);const o=r.klass;e.type!==o.getType()&&U(18,o.name);const i=o.importJSON(e),s=e.children;if(R(i)&&Array.isArray(s))for(let a=0;a<s.length;a++){const l=zd(s[a],t);i.append(l)}return i}function Jm(e,t,n){const r=it,o=Ft,i=st;it=t,Ft=!0,st=e;try{return n()}finally{it=r,Ft=o,st=i}}function Qn(e,t){const n=e._pendingEditorState,r=e._rootElement,o=e._headless||r===null;if(n===null)return;const i=e._editorState,s=i._selection,a=n._selection,l=e._dirtyType!==0,c=it,u=Ft,f=st,d=e._updating,h=e._observer;let p=null;if(e._pendingEditorState=null,e._editorState=n,!o&&l&&h!==null){st=e,it=n,Ft=!1,e._updating=!0;try{const C=e._dirtyType,_=e._dirtyElements,E=e._dirtyLeaves;h.disconnect(),p=v3(i,n,e,C,_,E)}catch(C){if(C instanceof Error&&e._onError(C),Jc)throw C;return px(e,null,r,n),vv(e),e._dirtyType=2,Jc=!0,Qn(e,i),void(Jc=!1)}finally{h.observe(r,Qm),e._updating=d,it=c,Ft=u,st=f}}n._readOnly||(n._readOnly=!0);const g=e._dirtyLeaves,m=e._dirtyElements,y=e._normalizedNodes,b=e._updateTags,v=e._deferred;l&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),(function(C,_){const E=C._decorators;let N=C._pendingDecorators||E;const P=_._nodeMap;let I;for(I in N)P.has(I)||(N===E&&(N=Ax(C)),delete N[I])})(e,n);const w=o?null:en(Xt(e));if(e._editable&&w!==null&&(l||a===null||a.dirty||!a.is(s))&&r!==null&&!b.has(B3)){st=e,it=n;try{if(h!==null&&h.disconnect(),l||a===null||a.dirty){const C=e._blockCursorElement;C!==null&&Rf(C,e,r),J3(s,a,e,w,b,r)}(function(C,_,E){let N=C._blockCursorElement;if($(E)&&E.isCollapsed()&&E.anchor.type==="element"&&_.contains(document.activeElement)){const P=E.anchor,I=P.getNode(),W=P.offset;let j=!1,z=null;if(W===I.getChildrenSize())eu(I.getChildAtIndex(W-1))&&(j=!0);else{const Y=I.getChildAtIndex(W);if(Y!==null&&eu(Y)){const Q=Y.getPreviousSibling();(Q===null||eu(Q))&&(j=!0,z=C.getElementByKey(Y.__key))}}if(j){const Y=C.getElementByKey(I.__key);return N===null&&(C._blockCursorElement=N=(function(Q){const oe=Q.theme,M=document.createElement("div");M.contentEditable="false",M.setAttribute("data-lexical-cursor","true");let re=oe.blockCursor;if(re!==void 0){if(typeof re=="string"){const L=pv(re);re=oe.blockCursor=L}re!==void 0&&M.classList.add(...re)}return M})(C._config)),_.style.caretColor="transparent",void(z===null?Y.appendChild(N):Y.insertBefore(N,z))}}N!==null&&Rf(N,C,_)})(e,r,a)}finally{h!==null&&h.observe(r,Qm),st=f,it=c}}p!==null&&(function(C,_,E,N,P){const I=Array.from(C._listeners.mutation),W=I.length;for(let j=0;j<W;j++){const[z,Y]=I[j];for(const Q of Y){const oe=_.get(Q);oe!==void 0&&z(oe,{dirtyLeaves:N,prevEditorState:P,updateTags:E})}}})(e,p,b,g,i),$(a)||a===null||s!==null&&s.is(a)||e.dispatchCommand(Ql,void 0);const A=e._pendingDecorators;A!==null&&(e._decorators=A,e._pendingDecorators=null,As("decorator",e,!0,A)),(function(C,_,E){const N=ng(_),P=ng(E);N!==P&&As("textcontent",C,!0,P)})(e,t||i,n),As("update",e,!0,{dirtyElements:m,dirtyLeaves:g,editorState:n,mutatedNodes:p,normalizedNodes:y,prevEditorState:t||i,tags:b}),(function(C,_){if(C._deferred=[],_.length!==0){const E=C._updating;C._updating=!0;try{for(let N=0;N<_.length;N++)_[N]()}finally{C._updating=E}}})(e,v),(function(C){const _=C._updates;if(_.length!==0){const E=_.shift();if(E){const[N,P]=E;Xl(C,N,P)}}})(e)}function As(e,t,n,...r){const o=t._updating;t._updating=n;try{const i=Array.from(t._listeners[e]);for(let s=0;s<i.length;s++)i[s].apply(null,r)}finally{t._updating=o}}function Xm(e,t){const n=e._updates;let r=t||!1;for(;n.length!==0;){const o=n.shift();if(o){const[i,s]=o,a=e._pendingEditorState;let l;s!==void 0&&(l=s.onUpdate,s.skipTransforms&&(r=!0),s.discrete&&(a===null&&U(191),a._flushSync=!0),l&&e._deferred.push(l),cx(e,s.tag)),a==null?Xl(e,i,s):i()}}return r}function Xl(e,t,n){const r=e._updateTags;let o,i=!1,s=!1;n!==void 0&&(o=n.onUpdate,cx(e,n.tag),i=n.skipTransforms||!1,s=n.discrete||!1),o&&e._deferred.push(o);const a=e._editorState;let l=e._pendingEditorState,c=!1;(l===null||l._readOnly)&&(l=e._pendingEditorState=fx(l||a),c=!0),l._flushSync=s;const u=it,f=Ft,d=st,h=e._updating;it=l,Ft=!1,e._updating=!0,st=e;const p=e._headless||e.getRootElement()===null;Wd(null);try{c&&(p?a._selection!==null&&(l._selection=a._selection.clone()):l._selection=(function(b,v){const w=b.getEditorState()._selection,A=en(Xt(b));return $(w)||w==null?jd(w,A,b,v):w.clone()})(e,n&&n.event||null));const m=e._compositionKey;t(),i=Xm(e,i),(function(b,v){const w=v.getEditorState()._selection,A=b._selection;if($(A)){const C=A.anchor,_=A.focus;let E;if(C.type==="text"&&(E=C.getNode(),E.selectionTransform(w,A)),_.type==="text"){const N=_.getNode();E!==N&&N.selectionTransform(w,A)}}})(l,e),e._dirtyType!==0&&(i?(function(b,v){const w=v._dirtyLeaves,A=b._nodeMap;for(const C of w){const _=A.get(C);X(_)&&_.isAttached()&&_.isSimpleText()&&!_.isUnmergeable()&&Nm(_)}})(l,e):(function(b,v){const w=v._dirtyLeaves,A=v._dirtyElements,C=b._nodeMap,_=Er(),E=new Map;let N=w,P=N.size,I=A,W=I.size;for(;P>0||W>0;){if(P>0){v._dirtyLeaves=new Set;for(const j of N){const z=C.get(j);X(z)&&z.isAttached()&&z.isSimpleText()&&!z.isUnmergeable()&&Nm(z),z!==void 0&&Zm(z,_)&&Gm(v,z,E),w.add(j)}if(N=v._dirtyLeaves,P=N.size,P>0){Wa++;continue}}v._dirtyLeaves=new Set,v._dirtyElements=new Map,I.delete("root")&&I.set("root",!0);for(const j of I){const z=j[0],Y=j[1];if(A.set(z,Y),!Y)continue;const Q=C.get(z);Q!==void 0&&Zm(Q,_)&&Gm(v,Q,E)}N=v._dirtyLeaves,P=N.size,I=v._dirtyElements,W=I.size,Wa++}v._dirtyLeaves=w,v._dirtyElements=A})(l,e),Xm(e),(function(b,v,w,A){const C=b._nodeMap,_=v._nodeMap,E=[];for(const[N]of A){const P=_.get(N);P!==void 0&&(P.isAttached()||(R(P)&&gv(P,N,C,_,E,A),C.has(N)||A.delete(N),E.push(N)))}for(const N of E)_.delete(N);for(const N of w){const P=_.get(N);P===void 0||P.isAttached()||(C.has(N)||w.delete(N),_.delete(N))}})(a,l,e._dirtyLeaves,e._dirtyElements)),m!==e._compositionKey&&(l._flushSync=!0);const y=l._selection;if($(y)){const b=l._nodeMap,v=y.anchor.key,w=y.focus.key;b.get(v)!==void 0&&b.get(w)!==void 0||U(19)}else ot(y)&&y._nodes.size===0&&(l._selection=null)}catch(m){return m instanceof Error&&e._onError(m),e._pendingEditorState=a,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Qn(e)}finally{it=u,Ft=f,st=d,e._updating=h,Wa=0}e._dirtyType!==0||e._deferred.length>0||(function(m,y){const b=y.getEditorState()._selection,v=m._selection;if(v!==null){if(v.dirty||!v.is(b))return!0}else if(b!==null)return!0;return!1})(l,e)?l._flushSync?(l._flushSync=!1,Qn(e)):c&&a6(()=>{Qn(e)}):(l._flushSync=!1,c&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function Sn(e,t,n){st===e&&n===void 0?t():Xl(e,t,n)}class ks{constructor(t,n,r){D(this,"element");D(this,"before");D(this,"after");this.element=t,this.before=n||null,this.after=r||null}withBefore(t){return new ks(this.element,t,this.after)}withAfter(t){return new ks(this.element,this.before,t)}withElement(t){return this.element===t?this:new ks(t,this.before,this.after)}insertChild(t){const n=this.before||this.getManagedLineBreak();return n!==null&&n.parentElement!==this.element&&U(222),this.element.insertBefore(t,n),this}removeChild(t){return t.parentElement!==this.element&&U(223),this.element.removeChild(t),this}replaceChild(t,n){return n.parentElement!==this.element&&U(224),this.element.replaceChild(t,n),this}getFirstChild(){const t=this.after?this.after.nextSibling:this.element.firstChild;return t===this.before||t===this.getManagedLineBreak()?null:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(t===null)this.removeManagedLineBreak();else{const n=t==="decorator"&&(ea||Vi||Xs);this.insertManagedLineBreak(n)}}removeManagedLineBreak(){const t=this.getManagedLineBreak();if(t){const n=this.element,r=t.nodeName==="IMG"?t.nextSibling:null;r&&n.removeChild(r),n.removeChild(t),n.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){const n=this.getManagedLineBreak();if(n){if(t===(n.nodeName==="IMG"))return;this.removeManagedLineBreak()}const r=this.element,o=this.before,i=document.createElement("br");if(r.insertBefore(i,o),t){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 t=0;for(let n=this.after;n!==null;n=n.previousSibling)t++;return t}resolveChildIndex(t,n,r,o){if(r===this.element){const l=this.getFirstChildOffset();return[t,Math.min(l+t.getChildrenSize(),Math.max(l,o))]}const i=eg(n,r);i.push(o);const s=eg(n,this.element);let a=t.getIndexWithinParent();for(let l=0;l<s.length;l++){const c=i[l],u=s[l];if(c===void 0||c<u)break;if(c>u){a+=1;break}}return[t.getParentOrThrow(),a]}}function eg(e,t){const n=[];let r=t;for(;r!==e&&r!==null;r=r.parentNode){let o=0;for(let i=r.previousSibling;i!==null;i=i.previousSibling)o++;n.push(o)}return r!==e&&U(225),n.reverse()}class Mn extends ln{constructor(n){super(n);D(this,"__first");D(this,"__last");D(this,"__size");D(this,"__format");D(this,"__style");D(this,"__indent");D(this,"__dir");D(this,"__textFormat");D(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(n){super.afterCloneFrom(n),this.__key===n.__key&&(this.__first=n.__first,this.__last=n.__last,this.__size=n.__size),this.__indent=n.__indent,this.__format=n.__format,this.__style=n.__style,this.__dir=n.__dir,this.__textFormat=n.__textFormat,this.__textStyle=n.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const n=this.getFormat();return a3[n]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const n=[];let r=this.getFirstChild();for(;r!==null;)n.push(r),r=r.getNextSibling();return n}getChildrenKeys(){const n=[];let r=this.getFirstChild();for(;r!==null;)n.push(r.__key),r=r.getNextSibling();return n}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const n=Re()._dirtyElements;return n!==null&&n.has(this.__key)}isLastChild(){const n=this.getLatest(),r=this.getParentOrThrow().getLastChild();return r!==null&&r.is(n)}getAllTextNodes(){const n=[];let r=this.getFirstChild();for(;r!==null;){if(X(r)&&n.push(r),R(r)){const o=r.getAllTextNodes();n.push(...o)}r=r.getNextSibling()}return n}getFirstDescendant(){let n=this.getFirstChild();for(;R(n);){const r=n.getFirstChild();if(r===null)break;n=r}return n}getLastDescendant(){let n=this.getLastChild();for(;R(n);){const r=n.getLastChild();if(r===null)break;n=r}return n}getDescendantByIndex(n){const r=this.getChildren(),o=r.length;if(n>=o){const s=r[o-1];return R(s)&&s.getLastDescendant()||s||null}const i=r[n];return R(i)&&i.getFirstDescendant()||i||null}getFirstChild(){const n=this.getLatest().__first;return n===null?null:Xe(n)}getFirstChildOrThrow(){const n=this.getFirstChild();return n===null&&U(45,this.__key),n}getLastChild(){const n=this.getLatest().__last;return n===null?null:Xe(n)}getLastChildOrThrow(){const n=this.getLastChild();return n===null&&U(96,this.__key),n}getChildAtIndex(n){const r=this.getChildrenSize();let o,i;if(n<r/2){for(o=this.getFirstChild(),i=0;o!==null&&i<=n;){if(i===n)return o;o=o.getNextSibling(),i++}return null}for(o=this.getLastChild(),i=r-1;o!==null&&i>=n;){if(i===n)return o;o=o.getPreviousSibling(),i--}return null}getTextContent(){let n="";const r=this.getChildren(),o=r.length;for(let i=0;i<o;i++){const s=r[i];n+=s.getTextContent(),R(s)&&i!==o-1&&!s.isInline()&&(n+=Dr)}return n}getTextContentSize(){let n=0;const r=this.getChildren(),o=r.length;for(let i=0;i<o;i++){const s=r[i];n+=s.getTextContentSize(),R(s)&&i!==o-1&&!s.isInline()&&(n+=2)}return n}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(n){if(n!==""){const r=wm[n];return(this.getFormat()&r)!==0}return!1}hasTextFormat(n){const r=Po[n];return(this.getTextFormat()&r)!==0}getFormatFlags(n,r){return gl(this.getLatest().__textFormat,n,r)}getTextStyle(){return this.getLatest().__textStyle}select(n,r){bt();const o=Z();let i=n,s=r;const a=this.getChildrenSize();if(!this.canBeEmpty()){if(n===0&&r===0){const c=this.getFirstChild();if(X(c)||R(c))return c.select(0,0)}else if(!(n!==void 0&&n!==a||r!==void 0&&r!==a)){const c=this.getLastChild();if(X(c)||R(c))return c.select()}}i===void 0&&(i=a),s===void 0&&(s=a);const l=this.__key;return $(o)?(o.anchor.set(l,i,"element"),o.focus.set(l,s,"element"),o.dirty=!0,o):nx(l,i,l,s,"element","element")}selectStart(){const n=this.getFirstDescendant();return n?n.selectStart():this.select()}selectEnd(){const n=this.getLastDescendant();return n?n.selectEnd():this.select()}clear(){const n=this.getWritable();return this.getChildren().forEach(r=>r.remove()),n}append(...n){return this.splice(this.getChildrenSize(),0,n)}setDirection(n){const r=this.getWritable();return r.__dir=n,r}setFormat(n){return this.getWritable().__format=n!==""?wm[n]:0,this}setStyle(n){return this.getWritable().__style=n||"",this}setTextFormat(n){const r=this.getWritable();return r.__textFormat=n,r}setTextStyle(n){const r=this.getWritable();return r.__textStyle=n,r}setIndent(n){return this.getWritable().__indent=n,this}splice(n,r,o){hl(this)&&U(324,this.__key,this.__type);const i=this.getChildrenSize(),s=this.getWritable();n+r<=i||U(226,String(n),String(r),String(i));const a=s.__key,l=[],c=[],u=this.getChildAtIndex(n+r);let f=null,d=i-r+o.length;if(n!==0)if(n===i)f=this.getLastChild();else{const p=this.getChildAtIndex(n);p!==null&&(f=p.getPreviousSibling())}if(r>0){let p=f===null?this.getFirstChild():f.getNextSibling();for(let g=0;g<r;g++){p===null&&U(100);const m=p.getNextSibling(),y=p.__key;Ao(p.getWritable()),c.push(y),p=m}}let h=f;for(const p of o){h!==null&&p.is(h)&&(f=h=h.getPreviousSibling());const g=p.getWritable();g.__parent===a&&d--,Ao(g);const m=p.__key;if(h===null)s.__first=m,g.__prev=null;else{const y=h.getWritable();y.__next=m,g.__prev=y.__key}p.__key===a&&U(76),g.__parent=a,l.push(m),h=p}if(n+r===i)h!==null&&(h.getWritable().__next=null,s.__last=h.__key);else if(u!==null){const p=u.getWritable();if(h!==null){const g=h.getWritable();p.__prev=h.__key,g.__next=u.__key}else p.__prev=null}if(s.__size=d,c.length){const p=Z();if($(p)){const g=new Set(c),m=new Set(l),{anchor:y,focus:b}=p;tg(y,g,m)&&ml(y,y.getNode(),this,f,u),tg(b,g,m)&&ml(b,b.getNode(),this,f,u),d!==0||this.canBeEmpty()||jt(this)||this.remove()}}return s}getDOMSlot(n){return new ks(n)}exportDOM(n){const{element:r}=super.exportDOM(n);if(pt(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 n={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},r=this.getTextFormat(),o=this.getTextStyle();return r===0&&o===""||jt(this)||this.getChildren().some(X)||(r!==0&&(n.textFormat=r),o!==""&&(n.textStyle=o)),n}updateFromJSON(n){return super.updateFromJSON(n).setFormat(n.format).setIndent(n.indent).setDirection(n.direction).setTextFormat(n.textFormat||0).setTextStyle(n.textStyle||"")}insertNewAfter(n,r){return null}canIndent(){return!0}collapseAtStart(n){return!1}excludeFromCopy(n){return!1}canReplaceWith(n){return!0}canInsertAfter(n){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(n){return!1}extractWithChild(n,r,o){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(n,r){const o=this.getDOMSlot(n);let i=o.getFirstChild();for(let s=this.getFirstChild();s;s=s.getNextSibling()){const a=r.getElementByKey(s.getKey());a!==null&&(i==null?(o.insertChild(a),i=a):i!==a&&o.replaceChild(a,i),i=i.nextSibling)}}}function R(e){return e instanceof Mn}function tg(e,t,n){let r=e.getNode();for(;r;){const o=r.__key;if(t.has(o)&&!n.has(o))return!0;r=r.getParent()}return!1}class ux extends ln{decorate(t,n){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Te(e){return e instanceof ux}class Zi extends Mn{constructor(){super("root");D(this,"__cachedText");this.__cachedText=null}static getType(){return"root"}static clone(){return new Zi}getTopLevelElementOrThrow(){U(51)}getTextContent(){const n=this.__cachedText;return!na()&&Re()._dirtyType!==0||n===null?super.getTextContent():n}remove(){U(52)}replace(n){U(53)}insertBefore(n){U(54)}insertAfter(n){U(55)}updateDOM(n,r){return!1}splice(n,r,o){for(const i of o)R(i)||Te(i)||U(282);return super.splice(n,r,o)}static importJSON(n){return We().updateFromJSON(n)}collapseAtStart(){return!0}}function Ye(e){return e instanceof Zi}function fx(e){return new ra(new Map(e._nodeMap))}function $d(){return new ra(new Map([["root",new Zi]]))}function dx(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&U(130,n.name),R(e)){const r=t.children;Array.isArray(r)||U(59,n.name);const o=e.getChildren();for(let i=0;i<o.length;i++){const s=dx(o[i]);r.push(s)}}return t}function n6(e){return e instanceof ra}class ra{constructor(t,n){D(this,"_nodeMap");D(this,"_selection");D(this,"_flushSync");D(this,"_readOnly");this._nodeMap=t,this._selection=n||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(t,n){return Jm(n&&n.editor||null,this,t)}clone(t){const n=new ra(this._nodeMap,t===void 0?this._selection:t);return n._readOnly=!0,n}toJSON(){return Jm(null,this,()=>({root:dx(We())}))}}class Ud extends Mn{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}}class Ji extends Mn{static getType(){return"paragraph"}static clone(t){return new Ji(t.__key)}createDOM(t){const n=document.createElement("p"),r=bi(t.theme,"paragraph");return r!==void 0&&n.classList.add(...r),n}updateDOM(t,n,r){return!1}static importDOM(){return{p:t=>({conversion:r6,priority:0})}}exportDOM(t){const{element:n}=super.exportDOM(t);if(pt(n)){this.isEmpty()&&n.append(document.createElement("br"));const r=this.getFormatType();r&&(n.style.textAlign=r)}return{element:n}}static importJSON(t){return Tt().updateFromJSON(t)}exportJSON(){const t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){const n=this.getChildren().find(X);n?(t.textFormat=n.getFormat(),t.textStyle=n.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,n){const r=Tt();r.setTextFormat(t.format),r.setTextStyle(t.style);const o=this.getDirection();return r.setDirection(o),r.setFormat(this.getFormatType()),r.setStyle(this.getStyle()),this.insertAfter(r,n),r}collapseAtStart(){const t=this.getChildren();if(t.length===0||X(t[0])&&t[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 r6(e){const t=Tt();return e.style&&(t.setFormat(e.style.textAlign),b6(e,t)),{node:t}}function Tt(){return Kr(new Ji)}function Bd(e){return e instanceof Ji}const we=0,Gn=1,o6=3,hx=4;function px(e,t,n,r){const o=e._keyToDOMMap;o.clear(),e._editorState=$d(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;const i=e._observer;i!==null&&(i.disconnect(),e._observer=null),t!==null&&(t.textContent=""),n!==null&&(n.textContent="",o.set("root",n))}function i6(e){const t=new Set,n=new Set;let r=e;for(;r;){const{ownNodeConfig:o}=rc(r),i=r.transform;if(!n.has(i)){n.add(i);const s=r.transform();s&&t.add(s)}if(o){const s=o.$transform;s&&t.add(s),r=o.extends}else{const s=Object.getPrototypeOf(r);r=s.prototype instanceof ln&&s!==ln?s:void 0}}return t}function mx(e){const t=e||{},n=e6(),r=t.theme||{},o=e===void 0?n:t.parentEditor||null,i=t.disableEvents||!1,s=$d(),a=t.namespace||(o!==null?o._config.namespace:_x()),l=t.editorState,c=[Zi,Br,Yi,Qi,Ji,Ud,...t.nodes||[]],{onError:u,html:f}=t,d=t.editable===void 0||t.editable;let h;if(e===void 0&&n!==null)h=n._nodes;else{h=new Map;for(let g=0;g<c.length;g++){let m=c[g],y=null,b=null;if(typeof m!="function"){const A=m;m=A.replace,y=A.with,b=A.withKlass||null}rc(m);const v=m.getType(),w=i6(m);h.set(v,{exportDOM:f&&f.export?f.export.get(m):void 0,klass:m,replace:y,replaceWithKlass:b,sharedNodeState:p3(c[g]),transforms:w})}}const p=new Ro(s,o,h,{disableEvents:i,namespace:a,theme:r},u||console.error,(function(g,m){const y=new Map,b=new Set,v=w=>{Object.keys(w).forEach(A=>{let C=y.get(A);C===void 0&&(C=[],y.set(A,C)),C.push(w[A])})};return g.forEach(w=>{const A=w.klass.importDOM;if(A==null||b.has(A))return;b.add(A);const C=A.call(w.klass);C!==null&&v(C)}),m&&v(m),y})(h,f?f.import:void 0),d,e);return l!==void 0&&(p._pendingEditorState=l,p._dirtyType=2),(function(g){g.registerCommand(Ev,M3,we),g.registerCommand(Sv,I3,we),g.registerCommand(Tv,L3,we),g.registerCommand(Nv,R3,we),g.registerCommand(Ov,D3,we)})(p),p}class Ro{constructor(t,n,r,o,i,s,a,l){D(this,"_headless");D(this,"_parentEditor");D(this,"_rootElement");D(this,"_editorState");D(this,"_pendingEditorState");D(this,"_compositionKey");D(this,"_deferred");D(this,"_keyToDOMMap");D(this,"_updates");D(this,"_updating");D(this,"_listeners");D(this,"_commands");D(this,"_nodes");D(this,"_decorators");D(this,"_pendingDecorators");D(this,"_config");D(this,"_dirtyType");D(this,"_cloneNotNeeded");D(this,"_dirtyLeaves");D(this,"_dirtyElements");D(this,"_normalizedNodes");D(this,"_updateTags");D(this,"_observer");D(this,"_key");D(this,"_onError");D(this,"_htmlConversions");D(this,"_window");D(this,"_editable");D(this,"_blockCursorElement");D(this,"_createEditorArgs");this._createEditorArgs=l,this._parentEditor=n,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=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=_x(),this._onError=i,this._htmlConversions=s,this._editable=a,this._headless=n!==null&&n._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(t){const n=this._listeners.update;return n.add(t),()=>{n.delete(t)}}registerEditableListener(t){const n=this._listeners.editable;return n.add(t),()=>{n.delete(t)}}registerDecoratorListener(t){const n=this._listeners.decorator;return n.add(t),()=>{n.delete(t)}}registerTextContentListener(t){const n=this._listeners.textcontent;return n.add(t),()=>{n.delete(t)}}registerRootListener(t){const n=this._listeners.root;return t(this._rootElement,null),n.add(t),()=>{t(null,this._rootElement),n.delete(t)}}registerCommand(t,n,r){r===void 0&&U(35);const o=this._commands;o.has(t)||o.set(t,[new Set,new Set,new Set,new Set,new Set]);const i=o.get(t);i===void 0&&U(36,String(t));const s=i[r];return s.add(n),()=>{s.delete(n),i.every(a=>a.size===0)&&o.delete(t)}}registerMutationListener(t,n,r){const o=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,i=this._listeners.mutation;let s=i.get(n);s===void 0&&(s=new Set,i.set(n,s)),s.add(o);const a=r&&r.skipInitialization;return a!==void 0&&a||this.initializeMutationListener(n,o),()=>{s.delete(o),s.size===0&&i.delete(n)}}getRegisteredNode(t){const n=this._nodes.get(t.getType());return n===void 0&&U(37,t.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,n){const r=this._editorState,o=cg(r).get(n.getType());if(!o)return;const i=new Map;for(const s of o.keys())i.set(s,"created");i.size>0&&t(i,{dirtyLeaves:new Set,prevEditorState:r,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,n){const r=this.getRegisteredNode(t);return r.transforms.add(n),r}registerNodeTransform(t,n){const r=this.registerNodeTransformToKlass(t,n),o=[r],i=r.replaceWithKlass;if(i!=null){const s=this.registerNodeTransformToKlass(i,n);o.push(s)}return(function(s,a){const l=cg(s.getEditorState()),c=[];for(const u of a){const f=l.get(u);f&&c.push(f)}c.length!==0&&s.update(()=>{for(const u of c)for(const f of u.keys()){const d=Xe(f);d&&d.markDirty()}},s._pendingEditorState===null?{tag:vo}:void 0)})(this,o.map(s=>s.klass.getType())),()=>{o.forEach(s=>s.transforms.delete(n))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,n){return ie(this,t,n)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){const n=this._rootElement;if(t!==n){const r=bi(this._config.theme,"root"),o=this._pendingEditorState||this._editorState;if(this._rootElement=t,px(this,n,t,o),n!==null&&(this._config.disableEvents||F3(n),r!=null&&n.classList.remove(...r)),t!==null){const i=Zd(t),s=t.style;s.userSelect="text",s.whiteSpace="pre-wrap",s.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=i,this._dirtyType=2,vv(this),this._updateTags.add(vo),Qn(this),this._config.disableEvents||(function(a,l){const c=a.ownerDocument;kf.set(a,c);const u=fl.get(c)??0;u<1&&c.addEventListener("selectionchange",Qv),fl.set(c,u+1),a.__lexicalEditor=l;const f=Yv(a);for(let d=0;d<Af.length;d++){const[h,p]=Af[d],g=typeof p=="function"?m=>{Dm(m)||(Rm(m),(l.isEditable()||h==="click")&&p(m,l))}:m=>{if(Dm(m))return;Rm(m);const y=l.isEditable();switch(h){case"cut":return y&&ie(l,Dd,m);case"copy":return ie(l,Zl,m);case"paste":return y&&ie(l,Gl,m);case"dragstart":return y&&ie(l,$v,m);case"dragover":return y&&ie(l,Uv,m);case"dragend":return y&&ie(l,E3,m);case"focus":return y&&ie(l,N3,m);case"blur":return y&&ie(l,O3,m);case"drop":return y&&ie(l,zv,m)}};a.addEventListener(h,g),f.push(()=>{a.removeEventListener(h,g)})}})(t,this),r!=null&&t.classList.add(...r)}else this._window=null,this._updateTags.add(vo),Qn(this);As("root",this,!1,t,n)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,n){t.isEmpty()&&U(38);let r=t;r._readOnly&&(r=fx(t),r._selection=t._selection?t._selection.clone():null),bv(this);const o=this._pendingEditorState,i=this._updateTags,s=n!==void 0?n.tag:null;o===null||o.isEmpty()||(s!=null&&i.add(s),Qn(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&i.add(s),this._updating||Qn(this)}parseEditorState(t,n){return(function(r,o,i){const s=$d(),a=it,l=Ft,c=st,u=o._dirtyElements,f=o._dirtyLeaves,d=o._cloneNotNeeded,h=o._dirtyType;o._dirtyElements=new Map,o._dirtyLeaves=new Set,o._cloneNotNeeded=new Set,o._dirtyType=0,it=s,Ft=!1,st=o,Wd(null);try{const p=o._nodes;zd(r.root,p),i&&i(),s._readOnly=!0}catch(p){p instanceof Error&&o._onError(p)}finally{o._dirtyElements=u,o._dirtyLeaves=f,o._cloneNotNeeded=d,o._dirtyType=h,it=a,Ft=l,st=c}return s})(typeof t=="string"?JSON.parse(t):t,this,n)}read(t){return Qn(this),this.getEditorState().read(t,{editor:this})}update(t,n){(function(r,o,i){r._updating?r._updates.push([o,i]):Xl(r,o,i)})(this,t,n)}focus(t,n={}){const r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),Sn(this,()=>{const o=Z(),i=We();o!==null?o.dirty||Pt(o.clone()):i.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?i.selectStart():i.selectEnd()),f6("focus"),d6(()=>{r.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&r.removeAttribute("autocapitalize"))}blur(){const t=this._rootElement;t!==null&&t.blur();const n=en(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,As("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}}D(Ro,"version");Ro.version="0.39.0+prod.esm";let Mf=null;function Wd(e){Mf=e}let s6=1;function gx(e,t){const n=Kd(e,t);return n===void 0&&U(30,t),n}function Kd(e,t){return e._nodes.get(t)}const a6=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function yx(e){return Te(Fi(e))}function Hd(e){const t=document.activeElement;if(!pt(t))return!1;const n=t.nodeName;return Te(Fi(e))&&(n==="INPUT"||n==="TEXTAREA"||t.contentEditable==="true"&&ec(t)==null)}function oa(e,t,n){const r=e.getRootElement();try{return r!==null&&r.contains(t)&&r.contains(n)&&t!==null&&!Hd(t)&&bx(t)===e}catch{return!1}}function qd(e){return e instanceof Ro}function bx(e){let t=e;for(;t!=null;){const n=ec(t);if(qd(n))return n;t=ia(t)}return null}function ec(e){return e?e.__lexicalEditor:null}function wo(e){return Xv(e)||e.isToken()}function Wn(e){return wo(e)||e.isSegmented()}function cr(e){return Xi(e)&&e.nodeType===3}function vx(e){return Xi(e)&&e.nodeType===9}function Di(e){let t=e;for(;t!=null;){if(cr(t))return t;t=t.firstChild}return null}function gl(e,t,n){const r=Po[t];if(n!==null&&(e&r)===(n&r))return e;let o=e^r;return t==="subscript"?o&=-65:t==="superscript"?o&=-33:t==="lowercase"?(o&=-513,o&=-1025):t==="uppercase"?(o&=-257,o&=-1025):t==="capitalize"&&(o&=-257,o&=-513),o}function xx(e){return X(e)||xo(e)||Te(e)}function l6(e,t){const n=(function(){const s=Mf;return Mf=null,s})();if((t=t||n&&n.__key)!=null)return void(e.__key=t);bt(),ax();const r=Re(),o=Wr(),i=""+s6++;o._nodeMap.set(i,e),R(e)?r._dirtyElements.set(i,!0):r._dirtyLeaves.add(i),r._cloneNotNeeded.add(i),r._dirtyType=1,e.__key=i}function Ao(e){const t=e.getParent();if(t!==null){const n=e.getWritable(),r=t.getWritable(),o=e.getPreviousSibling(),i=e.getNextSibling(),s=i!==null?i.__key:null,a=o!==null?o.__key:null,l=o!==null?o.getWritable():null,c=i!==null?i.getWritable():null;o===null&&(r.__first=s),i===null&&(r.__last=a),l!==null&&(l.__next=s),c!==null&&(c.__prev=a),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function yl(e){ax(),hl(e)&&U(323,e.__key,e.__type);const t=e.getLatest(),n=t.__parent,r=Wr(),o=Re(),i=r._nodeMap,s=o._dirtyElements;n!==null&&(function(l,c,u){let f=l;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}})(n,i,s);const a=t.__key;o._dirtyType=1,R(e)?s.set(a,!0):o._dirtyLeaves.add(a)}function ft(e){bt();const t=Re(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){const r=Xe(n);r!==null&&r.getWritable()}if(e!==null){const r=Xe(e);r!==null&&r.getWritable()}}}function Er(){return na()?null:Re()._compositionKey}function Xe(e,t){const n=(t||Wr())._nodeMap.get(e);return n===void 0?null:n}function wx(e,t){const n=tc(e,Re());return n!==void 0?Xe(n,t):null}function tc(e,t){return e[`__lexicalKey_${t._key}`]}function Fi(e,t){let n=e;for(;n!=null;){const r=wx(n,t);if(r!==null)return r;n=ia(n)}return null}function Ax(e){const t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function ng(e){return e.read(()=>We().getTextContent())}function We(){return kx(Wr())}function kx(e){return e._nodeMap.get("root")}function Pt(e){bt();const t=Wr();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function ci(e){const t=Re(),n=(function(r,o){let i=r;for(;i!=null;){const s=tc(i,o);if(s!==void 0)return s;i=ia(i)}return null})(e,t);return n===null?e===t.getRootElement()?Xe("root"):null:Xe(n)}function Cx(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Vd(e){const t=[];let n=e;for(;n!==null;)t.push(n),n=n._parentEditor;return t}function _x(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Ex(e){return cr(e)?e.nodeValue:null}function Yd(e,t,n){const r=en(Xt(t));if(r===null)return;const o=r.anchorNode;let{anchorOffset:i,focusOffset:s}=r;if(o!==null){let a=Ex(o);const l=Fi(o);if(a!==null&&X(l)){if(a===Vl&&n){const c=n.length;a=n,i=c,s=c}a!==null&&Qd(l,a,i,s,e)}}}function Qd(e,t,n,r,o){let i=e;if(i.isAttached()&&(o||!i.isDirty())){const s=i.isComposing();let a=t;(s||o)&&t[t.length-1]===Vl&&(a=t.slice(0,-1));const l=i.getTextContent();if(o||a!==l){if(a===""){if(ft(null),Xs||Vi||ea)i.remove();else{const g=Re();setTimeout(()=>{g.update(()=>{i.isAttached()&&i.remove()})},20)}return}const c=i.getParent(),u=Gi(),f=i.getTextContentSize(),d=Er(),h=i.getKey();if(i.isToken()||d!==null&&h===d&&!s||$(u)&&(c!==null&&!c.canInsertTextBefore()&&u.anchor.offset===0||u.anchor.key===e.__key&&u.anchor.offset===0&&!i.canInsertTextBefore()&&!s||u.focus.key===e.__key&&u.focus.offset===f&&!i.canInsertTextAfter()&&!s))return void i.markDirty();const p=Z();if(!$(p)||n===null||r===null)return void rg(i,a,p);if(p.setTextNodeRange(i,n,i,r),i.isSegmented()){const g=rt(i.getTextContent());i.replace(g),i=g}rg(i,a,p)}}}function rg(e,t,n){if(e.setTextContent(t),$(n)){const r=e.getKey();for(const o of["anchor","focus"]){const i=n[o];i.type==="text"&&i.key===r&&(i.offset=Pr(e,i.offset,"clamp"))}}}function Ea(e,t,n){const r=t[n]||!1;return r==="any"||r===e[n]}function c6(e,t){return Ea(e,t,"altKey")&&Ea(e,t,"ctrlKey")&&Ea(e,t,"shiftKey")&&Ea(e,t,"metaKey")}function Ie(e,t,n){return c6(e,n)&&e.key.toLowerCase()===t.toLowerCase()}const Un={ctrlKey:!sn,metaKey:sn},og={altKey:sn,ctrlKey:!sn};function ig(e){return e.key==="Backspace"}function sg(e){return Ie(e,"a",Un)}function u6(e){const t=We();if($(e)){const n=e.anchor,r=e.focus,o=n.getNode().getTopLevelElementOrThrow().getParentOrThrow();return n.set(o.getKey(),0,"element"),r.set(o.getKey(),o.getChildrenSize(),"element"),Ri(e),e}{const n=t.select(0,t.getChildrenSize());return Pt(Ri(n)),n}}function bi(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});const n=e.__lexicalClassNameCache,r=n[t];if(r!==void 0)return r;const o=e[t];if(typeof o=="string"){const i=pv(o);return n[t]=i,i}return o}function Gd(e,t,n,r,o){if(n.size===0)return;const i=r.__type,s=r.__key,a=t.get(i);a===void 0&&U(33,i);const l=a.klass;let c=e.get(l);c===void 0&&(c=new Map,e.set(l,c));const u=c.get(s),f=u==="destroyed"&&o==="created";(u===void 0||f)&&c.set(s,f?"updated":o)}function ag(e,t,n){const r=e.getParent();let o=n,i=e;return r!==null&&(t&&n===0?(o=i.getIndexWithinParent(),i=r):t||n!==i.getChildrenSize()||(o=i.getIndexWithinParent()+1,i=r)),i.getChildAtIndex(t?o-1:o)}function If(e,t){const n=e.offset;if(e.type==="element")return ag(e.getNode(),t,n);{const r=e.getNode();if(t&&n===0||!t&&n===r.getTextContentSize()){const o=t?r.getPreviousSibling():r.getNextSibling();return o===null?ag(r.getParentOrThrow(),t,r.getIndexWithinParent()+(t?0:1)):o}}return null}function Sx(e){const t=Xt(e).event,n=t&&t.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function ie(e,t,n){return(function(r,o,i){const s=Vd(r);for(let a=4;a>=0;a--)for(let l=0;l<s.length;l++){const c=s[l],u=c._commands.get(o);if(u!==void 0){const f=u[a];if(f!==void 0){const d=Array.from(f),h=d.length;let p=!1;if(Sn(c,()=>{for(let g=0;g<h;g++)if(d[g](i,r))return void(p=!0)}),p)return p}}}return!1})(e,t,n)}function nc(e){return!Ye(e)&&!e.isLastChild()&&!e.isInline()}function Do(e,t){const n=e._keyToDOMMap.get(t);return n===void 0&&U(75,t),n}function ia(e){const t=e.assignedSlot||e.parentElement;return Df(t)?t.host:t}function Tx(e){return vx(e)?e:pt(e)?e.ownerDocument:null}function f6(e){bt(),Re()._updateTags.add(e)}function d6(e){bt(),Re()._deferred.push(e)}function Lf(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function Zd(e){const t=Tx(e);return t?t.defaultView:null}function Xt(e){const t=e._window;return t===null&&U(78),t}function h6(e){let t=e.getParentOrThrow();for(;t!==null;){if(jt(t))return t;t=t.getParentOrThrow()}return t}function jt(e){return Ye(e)||R(e)&&e.isShadowRoot()}function Kr(e){const t=Re(),n=e.getType(),r=Kd(t,n);r===void 0&&U(200,e.constructor.name,n);const{replace:o,replaceWithKlass:i}=r;if(o!==null){const s=o(e),a=s.constructor;return i!==null?s instanceof i||U(201,i.name,i.getType(),a.name,a.getType(),e.constructor.name,n):s instanceof e.constructor&&a!==e.constructor||U(202,a.name,a.getType(),e.constructor.name,n),s.__key===e.__key&&U(203,e.constructor.name,n,a.name,a.getType()),s}return e}function Xc(e,t){!Ye(e.getParent())||R(t)||Te(t)||U(99)}function p6(e){const t=Xe(e);return t===null&&U(63,e),t}function eu(e){return(Te(e)||R(e)&&!e.canBeEmpty())&&!e.isInline()}function Rf(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;const r=e.parentElement;r!==null&&r.removeChild(e)}function en(e){return dn?(e||window).getSelection():null}function m6(e){const t=Zd(e);return t?t.getSelection():null}function Nx(e){return pt(e)&&e.tagName==="A"}function pt(e){return Xi(e)&&e.nodeType===1}function Xi(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function Df(e){return Xi(e)&&e.nodeType===11}function Ff(e){const t=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 e.nodeName.match(t)!==null}function bl(e){const t=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 e.nodeName.match(t)!==null}function yr(e){if(Te(e)&&!e.isInline())return!0;if(!R(e)||jt(e))return!1;const t=e.getFirstChild(),n=t===null||xo(t)||X(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&n}function Jd(){return Re()}const lg=new WeakMap,g6=new Map;function cg(e){if(!e._readOnly&&e.isEmpty())return g6;e._readOnly||U(192);let t=lg.get(e);return t||(t=(function(n){const r=new Map;for(const[o,i]of n._nodeMap){const s=i.__type;let a=r.get(s);a||(a=new Map,r.set(s,a)),a.set(o,i)}return r})(e),lg.set(e,t)),t}function Ox(e){const t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function y6(e){return(t=Ox(e))[Gv]=!0,t;var t}function b6(e,t){const n=parseInt(e.style.paddingInlineStart,10)||0,r=Math.round(n/40);t.setIndent(r)}function v6(e){return e.__lexicalUnmanaged===!0}function fs(e,t){return(function(n,r){return Object.prototype.hasOwnProperty.call(n,r)})(e,t)&&e[t]!==ln[t]}function rc(e){const t=Am in e.prototype?e.prototype[Am]():void 0,n=(function(s){if(!(s===ln||s.prototype instanceof ln)){let a="<unknown>",l="<unknown>";try{a=s.getType()}catch{}try{Ro.version&&(l=JSON.parse(Ro.version))}catch{}U(290,s.name,a,l)}return s===ux||s===Mn||s===ln})(e),r=!n&&fs(e,"getType")?e.getType():void 0;let o,i=r;if(t)if(r)o=t[r];else for(const[s,a]of Object.entries(t))i=s,o=a;if(!n&&i&&(fs(e,"getType")||(e.getType=()=>i),fs(e,"clone")||(e.clone=s=>(Wd(s),new e)),fs(e,"importJSON")||(e.importJSON=o&&o.$importJSON||(s=>new e().updateFromJSON(s))),!fs(e,"importDOM")&&o)){const{importDOM:s}=o;s&&(e.importDOM=()=>s)}return{ownNodeConfig:o,ownNodeType:i}}const at=(e,t)=>{let n=e;for(;n!=null&&!Ye(n);){if(t(n))return n;n=n.getParent()}return null},x6={next:"previous",previous:"next"};class Xd{constructor(t){D(this,"origin");this.origin=t}[Symbol.iterator](){return Px({hasNext:ji,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return xt(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return xt(this.origin,this.direction)}remove(){const t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,n){const r=this.getNodeAtCaret();return t.is(this.origin)||t.is(r)||(r===null?this.insert(t):r.replace(t,n)),this}splice(t,n,r="next"){const o=r===this.direction?n:Array.from(n).reverse();let i=this;const s=this.getParentAtCaret(),a=new Map;for(let l=i.getAdjacentCaret();l!==null&&a.size<t;l=l.getAdjacentCaret()){const c=l.origin.getWritable();a.set(c.getKey(),c)}for(const l of o){if(a.size>0){const c=i.getNodeAtCaret();if(c){if(a.delete(c.getKey()),a.delete(l.getKey()),!(c.is(l)||i.origin.is(l))){const u=l.getParent();u&&u.is(s)&&l.remove(),c.replace(l)}}else c===null&&U(263,Array.from(a).join(" "))}else i.insert(l);i=xt(l,this.direction)}for(const l of a.values())l.remove();return this}}class zs extends Xd{constructor(){super(...arguments);D(this,"type","child")}getLatest(){const n=this.origin.getLatest();return n===this.origin?this:un(n,this.direction)}getParentCaret(n="root"){return xt(eh(this.getParentAtCaret(),n),this.direction)}getFlipped(){const n=es(this.direction);return xt(this.getNodeAtCaret(),n)||un(this.origin,n)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(n){return n instanceof zs&&this.direction===n.direction&&this.origin.is(n.origin)}isSamePointCaret(n){return this.isSameNodeCaret(n)}}const w6={root:Ye,shadowRoot:jt};function es(e){return x6[e]}function eh(e,t="root"){return w6[t](e)?null:e}class Fo extends Xd{constructor(){super(...arguments);D(this,"type","sibling")}getLatest(){const n=this.origin.getLatest();return n===this.origin?this:xt(n,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return R(this.origin)?un(this.origin,this.direction):null}getParentCaret(n="root"){return xt(eh(this.getParentAtCaret(),n),this.direction)}getFlipped(){const n=es(this.direction);return xt(this.getNodeAtCaret(),n)||un(this.origin.getParentOrThrow(),n)}isSamePointCaret(n){return n instanceof Fo&&this.direction===n.direction&&this.origin.is(n.origin)}isSameNodeCaret(n){return(n instanceof Fo||n instanceof jo)&&this.direction===n.direction&&this.origin.is(n.origin)}}class jo extends Xd{constructor(n,r){super(n);D(this,"type","text");D(this,"offset");this.offset=r}getLatest(){const n=this.origin.getLatest();return n===this.origin?this:zo(n,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(n="root"){return xt(eh(this.getParentAtCaret(),n),this.direction)}getFlipped(){return zo(this.origin,es(this.direction),this.offset)}isSamePointCaret(n){return n instanceof jo&&this.direction===n.direction&&this.origin.is(n.origin)&&this.offset===n.offset}isSameNodeCaret(n){return(n instanceof Fo||n instanceof jo)&&this.direction===n.direction&&this.origin.is(n.origin)}getSiblingCaret(){return xt(this.origin,this.direction)}}function Or(e){return e instanceof jo}function ji(e){return e instanceof Fo}function Tn(e){return e instanceof zs}const A6={next:class extends jo{constructor(){super(...arguments);D(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends jo{constructor(){super(...arguments);D(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},k6={next:class extends Fo{constructor(){super(...arguments);D(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends Fo{constructor(){super(...arguments);D(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},C6={next:class extends zs{constructor(){super(...arguments);D(this,"direction","next")}getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends zs{constructor(){super(...arguments);D(this,"direction","previous")}getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function xt(e,t){return e?new k6[t](e):null}function zo(e,t,n){return e?new A6[t](e,Pr(e,n)):null}function Pr(e,t,n="error"){const r=e.getTextContentSize();let o=t==="next"?r:t==="previous"?0:t;return(o<0||o>r)&&(n!=="clamp"&&dv(284,String(t),String(r),e.getKey()),o=o<0?0:r),o}function ug(e,t){return new E6(e,t)}function un(e,t){return R(e)?new C6[t](e):null}function _6(e){return e&&e.getChildCaret()||e}function th(e){return e&&_6(e.getAdjacentCaret())}class nh{constructor(t,n,r){D(this,"type","node-caret-range");D(this,"direction");D(this,"anchor");D(this,"focus");this.anchor=t,this.focus=n,this.direction=r}getLatest(){const t=this.anchor.getLatest(),n=this.focus.getLatest();return t===this.anchor&&n===this.focus?this:new nh(t,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const t=o=>{const i=this[o].getLatest();return Or(i)?(function(s,a){const{direction:l,origin:c}=s,u=Pr(c,a==="focus"?es(l):l);return ug(s,u-s.offset)})(i,o):null},n=t("anchor"),r=t("focus");if(n&&r){const{caret:o}=n,{caret:i}=r;if(o.isSameNodeCaret(i))return[ug(o,i.offset-o.offset),null]}return[n,r]}iterNodeCarets(t="root"){const n=Or(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),r=this.focus.getLatest(),o=Or(r),i=s=>s.isSameNodeCaret(r)?null:th(s)||s.getParentCaret(t);return Px({hasNext:s=>s!==null&&!(o&&r.isSameNodeCaret(s)),initial:n.isSameNodeCaret(r)?null:i(n),map:s=>s,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class E6{constructor(t,n){D(this,"type","slice");D(this,"caret");D(this,"distance");this.caret=t,this.distance=n}getSliceIndices(){const{distance:t,caret:{offset:n}}=this,r=n+t;return r<n?[r,n]:[n,r]}getTextContent(){const[t,n]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,n)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:t,direction:n}}=this,[r,o]=this.getSliceIndices(),i=t.getTextContent();return zo(t.setTextContent(i.slice(0,r)+i.slice(o)),n,r)}}function rh(e){return Fr(e,xt(We(),e.direction))}function S6(e){return Fr(e,e)}function Fr(e,t){return e.direction!==t.direction&&U(265),new nh(e,t,e.direction)}function Px(e){const{initial:t,hasNext:n,step:r,map:o}=e;let i=t;return{[Symbol.iterator](){return this},next(){if(!n(i))return{done:!0,value:void 0};const s={done:!1,value:o(i)};return i=r(i),s}}}function Mx(e,t){const n=Ka(e.origin,t.origin);switch(n===null&&U(275,e.origin.getKey(),t.origin.getKey()),n.type){case"same":{const r=e.type==="text",o=t.type==="text";return r&&o?(function(i,s){return Math.sign(i-s)})(e.offset,t.offset):e.type===t.type?0:r?-1:o?1:e.type==="child"?-1:1}case"ancestor":return e.type==="child"?-1:1;case"descendant":return t.type==="child"?1:-1;case"branch":return Ix(n)}}function Ix(e){const{a:t,b:n}=e,r=t.__key,o=n.__key;let i=t,s=n;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 Sa(e,t){return t.is(e)}function fg(e){return R(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function Ka(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};const n=new Map;for(let[r,o]=fg(e);r;o=r,r=r.getParent())n.set(r,o);for(let[r,o]=fg(t);r;o=r,r=r.getParent()){const i=n.get(r);if(i!==void 0)return i===null?(Sa(e,r)||U(276),{commonAncestor:r,type:"ancestor"}):o===null?(Sa(t,r)||U(277),{commonAncestor:r,type:"descendant"}):((R(i)||Sa(e,i))&&(R(o)||Sa(t,o))&&r.is(i.getParent())&&r.is(o.getParent())||U(278),{a:i,b:o,commonAncestor:r,type:"branch"})}return null}function nr(e,t){const{type:n,key:r,offset:o}=e,i=p6(e.key);return n==="text"?(X(i)||U(266,i.getType(),r),zo(i,t,o)):(R(i)||U(267,i.getType(),r),O6(i,e.offset,t))}function $o(e,t){const{origin:n,direction:r}=t,o=r==="next";Or(t)?e.set(n.getKey(),t.offset,"text"):ji(t)?X(n)?e.set(n.getKey(),Pr(n,r),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(o?1:0),"element"):(Tn(t)&&R(n)||U(268),e.set(n.getKey(),o?0:n.getChildrenSize(),"element"))}function T6(e){const t=Z(),n=$(t)?t:rx();return Ha(n,e),Pt(n),n}function Ha(e,t){$o(e.anchor,t.anchor),$o(e.focus,t.focus)}function dg(e){const{anchor:t,focus:n}=e,r=nr(t,"next"),o=nr(n,"next"),i=Mx(r,o)<=0?"next":"previous";return Fr(zi(r,i),zi(o,i))}function oh(e){const{direction:t,origin:n}=e,r=xt(n,es(t)).getNodeAtCaret();return r?xt(r,t):un(n.getParentOrThrow(),t)}function hg(e,t="root"){const n=[e];for(let r=Tn(e)?e.getParentCaret(t):e.getSiblingCaret();r!==null;r=r.getParentCaret(t))n.push(oh(r));return n}function tu(e){return!!e&&e.origin.isAttached()}function N6(e,t="removeEmptySlices"){if(e.isCollapsed())return e;const n="root",r="next";let o=t;const i=Rx(e,r),s=hg(i.anchor,n),a=hg(i.focus.getFlipped(),n),l=new Set,c=[];for(const p of i.iterNodeCarets(n))if(Tn(p))l.add(p.origin.getKey());else if(ji(p)){const{origin:g}=p;R(g)&&!l.has(g.getKey())||c.push(g)}for(const p of c)p.remove();for(const p of i.getTextSlices()){if(!p)continue;const{origin:g}=p.caret,m=g.getTextContentSize(),y=oh(xt(g,r)),b=g.getMode();if(Math.abs(p.distance)===m&&o==="removeEmptySlices"||b==="token"&&p.distance!==0)y.remove();else if(p.distance!==0){o="removeEmptySlices";let v=p.removeTextSlice();const w=p.caret.origin;if(b==="segmented"){const A=v.origin,C=rt(A.getTextContent()).setStyle(A.getStyle()).setFormat(A.getFormat());y.replaceOrInsert(C),v=zo(C,r,v.offset)}w.is(s[0].origin)&&(s[0]=v),w.is(a[0].origin)&&(a[0]=v.getFlipped())}}let u,f;for(const p of s)if(tu(p)){u=Yt(p);break}for(const p of a)if(tu(p)){f=Yt(p);break}const d=(function(p,g,m){if(!p||!g)return null;const y=p.getParentAtCaret(),b=g.getParentAtCaret();if(!y||!b)return null;const v=y.getParents().reverse();v.push(y);const w=b.getParents().reverse();w.push(b);const A=Math.min(v.length,w.length);let C;for(C=0;C<A&&v[C]===w[C];C++);const _=(P,I)=>{let W;for(let j=C;j<P.length;j++){const z=P[j];if(jt(z))return;!W&&I(z)&&(W=z)}return W},E=_(v,yr),N=E&&_(w,P=>m.has(P.getKey())&&yr(P));return E&&N?[E,N]:null})(u,f,l);if(d){const[p,g]=d;un(p,"previous").splice(0,g.getChildren()),g.remove()}const h=[u,f,...s,...a].find(tu);if(h)return S6(zi(Yt(h),e.direction));U(269,JSON.stringify(s.map(p=>p.origin.__key)))}function Yt(e){const t=(function(o){let i=o;for(;Tn(i);){const s=th(i);if(!Tn(s))break;i=s}return i})(e.getLatest()),{direction:n}=t;if(X(t.origin))return Or(t)?t:zo(t.origin,n,n);const r=t.getAdjacentCaret();return ji(r)&&X(r.origin)?zo(r.origin,n,es(n)):t}function Lx(e){return Or(e)&&e.offset!==Pr(e.origin,e.direction)}function zi(e,t){return e.direction===t?e:e.getFlipped()}function Rx(e,t){return e.direction===t?e:Fr(zi(e.focus,t),zi(e.anchor,t))}function O6(e,t,n){let r=un(e,"next");for(let o=0;o<t;o++){const i=r.getAdjacentCaret();if(i===null)break;r=i}return zi(r,n)}function P6(...e){return e}function M6(e,t){if(!t||e===t)return e;for(const n in t)if(e[n]!==t[n])return{...e,...t};return e}const Dx=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,I6=Dx?T.useLayoutEffect:T.useEffect,Ta={tag:vo};function L6({initialConfig:e,children:t}){const n=T.useMemo(()=>{const{theme:r,namespace:o,nodes:i,onError:s,editorState:a,html:l}=e,c=VT(null,r),u=mx({editable:e.editable,html:l,namespace:o,nodes:i,onError:f=>s(f,u),theme:r});return(function(f,d){if(d!==null){if(d===void 0)f.update(()=>{const h=We();if(h.isEmpty()){const p=Tt();h.append(p);const g=Dx?document.activeElement:null;(Z()!==null||g!==null&&g===f.getRootElement())&&p.select()}},Ta);else if(d!==null)switch(typeof d){case"string":{const h=f.parseEditorState(d);f.setEditorState(h,Ta);break}case"object":f.setEditorState(d,Ta);break;case"function":f.update(()=>{We().isEmpty()&&d(f)},Ta)}}})(u,a),[u,c]},[]);return I6(()=>{const r=e.editable,[o]=n;o.setEditable(r===void 0||r)},[]),x.jsx(fv.Provider,{value:n,children:t})}const R6=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?T.useLayoutEffect:T.useEffect;function D6(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function F6(){return(function(e){const[t]=ht(),n=T.useMemo(()=>e(t),[t,e]),[r,o]=T.useState(()=>n.initialValueFn()),i=T.useRef(r);return R6(()=>{const{initialValueFn:s,subscribe:a}=n,l=s();return i.current!==l&&(i.current=l,o(l)),a(c=>{i.current=c,o(c)})},[n,e]),r})(D6)}function j6(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);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.`)}const jf=new Map;function Fx(e){const t={};if(!e)return t;const n=e.split(";");for(const r of n)if(r!==""){const[o,i]=r.split(/:([^]+)/);o&&i&&(t[o.trim()]=i.trim())}return t}function pg(e){let t=jf.get(e);return t===void 0&&(t=Fx(e),jf.set(e,t)),t}function jx(e){const t=Jd().getElementByKey(e.getKey());if(t===null)return null;const n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function zx(e){return jx(Ye(e)?e:e.getParentOrThrow())}function mg(e){const t=zx(e);return t!==null&&t.direction==="rtl"}function $x(e,t,n="self"){const r=e.getStartEndPoints();if(t.isSelected(e)&&!Wn(t)&&r!==null){const[o,i]=r,s=e.isBackward(),a=o.getNode(),l=i.getNode(),c=t.is(a),u=t.is(l);if(c||u){const[f,d]=Of(e),h=a.is(l),p=t.is(s?l:a),g=t.is(s?a:l);let m,y=0;h?(y=f>d?d:f,m=f>d?f:d):p?(y=s?d:f,m=void 0):g&&(y=0,m=s?f:d);const b=t.__text.slice(y,m);b!==t.__text&&(n==="clone"&&(t=y6(t)),t.__text=b)}}return t}function gg(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();const t=e.getNode();return R(t)||j6(177),e.offset===t.getChildrenSize()}function z6(e){const t=e.getStyle(),n=Fx(t);jf.set(t,n)}function Ux(e){const t=Bx(e);return t!==null&&t.writingMode==="vertical-rl"}function Bx(e){const t=e.anchor.getNode();return R(t)?jx(t):zx(t)}function yg(e,t){let n=Ux(e)?!t:t;Wx(e)&&(n=!n);const r=nr(e.focus,n?"previous":"next");if(Lx(r))return!1;for(const o of rh(r)){if(Tn(o))return!o.origin.isInline();if(!R(o.origin)){if(Te(o.origin))return!0;break}}return!1}function $6(e,t,n,r){e.modify(t?"extend":"move",n,r)}function Wx(e){const t=Bx(e);return t!==null&&t.direction==="rtl"}function bg(e,t,n){const r=Wx(e);let o;o=Ux(e)||r?!n:n,$6(e,t,o,"character")}function U6(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);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.`)}const Kx=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,B6=Kx&&"documentMode"in document?document.documentMode:null;!(!Kx||!("InputEvent"in window)||B6)&&"getTargetRanges"in new window.InputEvent("input");function Hx(...e){const t=[];for(const n of e)if(n&&typeof n=="string")for(const[r]of n.matchAll(/\S+/g))t.push(r);return t}function fn(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function ih(e,...t){const n=Hx(...t);n.length>0&&e.classList.add(...n)}function qx(e,...t){const n=Hx(...t);n.length>0&&e.classList.remove(...n)}function W6(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function K6(e){const t=at(e,n=>R(n)&&!n.isInline());return R(t)||U6(4,e.__key),t}function Sr(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}const H6=Symbol.for("preact-signals");function oc(){if(Mr>1)return void Mr--;let e,t=!1;for(;Cs!==void 0;){let n=Cs;for(Cs=void 0,zf++;n!==void 0;){const r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&Vx(n))try{n.c()}catch(o){t||(e=o,t=!0)}n=r}}if(zf=0,Mr--,t)throw e}function q6(e){if(Mr>0)return e();Mr++;try{return e()}finally{oc()}}let Pe,Cs;function vg(e){const t=Pe;Pe=void 0;try{return e()}finally{Pe=t}}let Mr=0,zf=0,qa=0;function xg(e){if(Pe===void 0)return;let t=e.n;return t===void 0||t.t!==Pe?(t={i:0,S:e,p:Pe.s,n:void 0,t:Pe,e:void 0,x:void 0,r:t},Pe.s!==void 0&&(Pe.s.n=t),Pe.s=t,e.n=t,32&Pe.f&&e.S(t),t):t.i===-1?(t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=Pe.s,t.n=void 0,Pe.s.n=t,Pe.s=t),t):void 0}function Ct(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=t==null?void 0:t.watched,this.Z=t==null?void 0:t.unwatched,this.name=t==null?void 0:t.name}function V6(e,t){return new Ct(e,t)}function Vx(e){for(let t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function wg(e){for(let t=e.s;t!==void 0;t=t.n){const n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Yx(e){let t,n=e.s;for(;n!==void 0;){const r=n.p;n.i===-1?(n.S.U(n),r!==void 0&&(r.n=n.n),n.n!==void 0&&(n.n.p=r)):t=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=r}e.s=t}function ti(e,t){Ct.call(this,void 0),this.x=e,this.s=void 0,this.g=qa-1,this.f=4,this.W=t==null?void 0:t.watched,this.Z=t==null?void 0:t.unwatched,this.name=t==null?void 0:t.name}function Qx(e){const t=e.u;if(e.u=void 0,typeof t=="function"){Mr++;const n=Pe;Pe=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,sh(e),r}finally{Pe=n,oc()}}}function sh(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Qx(e)}function Y6(e){if(Pe!==this)throw new Error("Out-of-order effect");Yx(this),Pe=e,this.f&=-2,8&this.f&&sh(this),oc()}function ai(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=t==null?void 0:t.name}function $s(e,t){const n=new ai(e,t);try{n.c()}catch(o){throw n.d(),o}const r=n.d.bind(n);return r[Symbol.dispose]=r,r}function Gx(e,t={}){const n={};for(const r in e){const o=t[r],i=V6(o===void 0?e[r]:o);n[r]=i}return n}Ct.prototype.brand=H6,Ct.prototype.h=function(){return!0},Ct.prototype.S=function(e){const t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t!==void 0?t.e=e:vg(()=>{var n;(n=this.W)==null||n.call(this)}))},Ct.prototype.U=function(e){if(this.t!==void 0){const t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,n===void 0&&vg(()=>{var r;(r=this.Z)==null||r.call(this)}))}},Ct.prototype.subscribe=function(e){return $s(()=>{const t=this.value,n=Pe;Pe=void 0;try{e(t)}finally{Pe=n}},{name:"sub"})},Ct.prototype.valueOf=function(){return this.value},Ct.prototype.toString=function(){return this.value+""},Ct.prototype.toJSON=function(){return this.value},Ct.prototype.peek=function(){const e=Pe;Pe=void 0;try{return this.value}finally{Pe=e}},Object.defineProperty(Ct.prototype,"value",{get(){const e=xg(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(zf>100)throw new Error("Cycle detected");this.v=e,this.i++,qa++,Mr++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{oc()}}}}),ti.prototype=new Ct,ti.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===qa))return!0;if(this.g=qa,this.f|=1,this.i>0&&!Vx(this))return this.f&=-2,!0;const e=Pe;try{wg(this),Pe=this;const t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return Pe=e,Yx(this),this.f&=-2,!0},ti.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(let t=this.s;t!==void 0;t=t.n)t.S.S(t)}Ct.prototype.S.call(this,e)},ti.prototype.U=function(e){if(this.t!==void 0&&(Ct.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(let t=this.s;t!==void 0;t=t.n)t.S.U(t)}},ti.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(ti.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const e=xg(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),ai.prototype.c=function(){const e=this.S();try{if(8&this.f||this.x===void 0)return;const t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}},ai.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Qx(this),wg(this),Mr++;const e=Pe;return Pe=this,Y6.bind(this,e)},ai.prototype.N=function(){2&this.f||(this.f|=2,this.o=Cs,Cs=this)},ai.prototype.d=function(){this.f|=8,1&this.f||sh(this)},ai.prototype.dispose=function(){this.d()};function Q6(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}function Fe(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);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 Zx(e,t){if(e&&t&&!Array.isArray(t)&&typeof e=="object"&&typeof t=="object"){const n=e,r=t;for(const o in r)n[o]=Zx(n[o],r[o]);return e}return t}const ah=0,$f=1,Jx=2,nu=3,Na=4,ni=5,ru=6,ds=7;function ou(e){return e.id===ah}function Xx(e){return e.id===Jx}function G6(e){return(function(t){return t.id===$f})(e)||Fe(305,String(e.id),String($f)),Object.assign(e,{id:Jx})}const Z6=new Set;class J6{constructor(t,n){D(this,"builder");D(this,"configs");D(this,"_dependency");D(this,"_peerNameSet");D(this,"extension");D(this,"state");D(this,"_signal");this.builder=t,this.extension=n,this.configs=new Set,this.state={id:ah}}mergeConfigs(){let t=this.extension.config||{};const n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):M6;for(const r of this.configs)t=n(t,r);return t}init(t){const n=this.state;Xx(n)||Fe(306,String(n.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(a,l,c){return Object.assign(a,{config:l,id:nu,registerState:c})})(n,this.mergeConfigs(),r);let s;this.state=i,this.extension.init&&(s=this.extension.init(t,i.config,r)),this.state=(function(a,l,c){return Object.assign(a,{id:Na,initResult:l,registerState:c})})(i,s,o)}build(t){const n=this.state;let r;n.id!==Na&&Fe(307,String(n.id),String(ni)),this.extension.build&&(r=this.extension.build(t,n.config,n.registerState));const o={...n.registerState,getOutput:()=>r,getSignal:this.getSignal.bind(this)};this.state=(function(i,s,a){return Object.assign(i,{id:ni,output:s,registerState:a})})(n,r,o)}register(t,n){this._signal=n;const r=this.state;r.id!==ni&&Fe(308,String(r.id),String(ni));const o=this.extension.register&&this.extension.register(t,r.config,r.registerState);return this.state=(function(i){return Object.assign(i,{id:ru})})(r),()=>{const i=this.state;i.id!==ds&&Fe(309,String(r.id),String(ds)),this.state=(function(s){return Object.assign(s,{id:ni})})(i),o&&o()}}afterRegistration(t){const n=this.state;let r;return n.id!==ru&&Fe(310,String(n.id),String(ru)),this.extension.afterRegistration&&(r=this.extension.afterRegistration(t,n.config,n.registerState)),this.state=(function(o){return Object.assign(o,{id:ds})})(n),r}getSignal(){return this._signal===void 0&&Fe(311),this._signal}getInitResult(){this.extension.init===void 0&&Fe(312,this.extension.name);const t=this.state;return(function(n){return n.id>=Na})(t)||Fe(313,String(t.id),String(Na)),t.initResult}getInitPeer(t){const n=this.builder.extensionNameMap.get(t);return n?n.getExtensionInitDependency():void 0}getExtensionInitDependency(){const t=this.state;return(function(n){return n.id>=nu})(t)||Fe(314,String(t.id),String(nu)),{config:t.config}}getPeer(t){const n=this.builder.extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}getInitDependency(t){const n=this.builder.getExtensionRep(t);return n===void 0&&Fe(315,this.extension.name,t.name),n.getExtensionInitDependency()}getDependency(t){const n=this.builder.getExtensionRep(t);return n===void 0&&Fe(315,this.extension.name,t.name),n.getExtensionDependency()}getState(){const t=this.state;return(function(n){return n.id>=ds})(t)||Fe(316,String(t.id),String(ds)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Z6}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([n])=>n)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){const t=this.state;(function(n){return n.id>=ni})(t)||Fe(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}}const Ag={tag:vo};function X6(){const e=We();e.isEmpty()&&e.append(Tt())}const eN={config:{setOptions:Ag,updateOptions:Ag},init:({$initialEditorState:e=X6})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},r){const o=r.getInitResult();if(!o.initialized){o.initialized=!0;const{$initialEditorState:i}=o;if(n6(i))e.setEditorState(i,n);else if(typeof i=="function")e.update(()=>{i(e)},t);else if(i&&(typeof i=="string"||typeof i=="object")){const s=e.parseEditorState(i);e.setEditorState(s,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[Zi,Br,Yi,Qi,Ji]},kg=Symbol.for("@lexical/extension/LexicalBuilder");function Cg(){}function tN(e){throw e}function Oa(e){return Array.isArray(e)?e:[e]}const iu="0.39.0+prod.esm";class vi{constructor(t){D(this,"roots");D(this,"extensionNameMap");D(this,"outgoingConfigEdges");D(this,"incomingEdges");D(this,"conflicts");D(this,"_sortedExtensionReps");D(this,"PACKAGE_VERSION");this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=iu,this.roots=t;for(const n of t)this.addExtension(n)}static fromExtensions(t){const n=[Oa(eN)];for(const r of t)n.push(Oa(r));return new vi(n)}static maybeFromEditor(t){const n=t[kg];return n&&(n.PACKAGE_VERSION!==iu&&Fe(292,n.PACKAGE_VERSION,iu),n instanceof vi||Fe(293)),n}static fromEditor(t){const n=vi.maybeFromEditor(t);return n===void 0&&Fe(294),n}constructEditor(){const{$initialEditorState:t,onError:n,...r}=this.buildCreateEditorArgs(),o=Object.assign(mx({...r,...n?{onError:i=>{n(i,o)}}:{}}),{[kg]:this});for(const i of this.sortedExtensionReps())i.build(o);return o}buildEditor(){let t=Cg;function n(){try{t()}finally{t=Cg}}const r=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=fn(this.registerEditor(r),()=>r.setRootElement(null)),r}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){const n=this.extensionNameMap.get(t.name);if(n)return n.extension!==t&&Fe(295,t.name),n}addEdge(t,n,r){const o=this.outgoingConfigEdges.get(t);o?o.set(n,r):this.outgoingConfigEdges.set(t,new Map([[n,r]]));const i=this.incomingEdges.get(n);i?i.add(t):this.incomingEdges.set(n,new Set([t]))}addExtension(t){this._sortedExtensionReps!==void 0&&Fe(296);const n=Oa(t),[r]=n;typeof r.name!="string"&&Fe(297,typeof r.name);let o=this.extensionNameMap.get(r.name);if(o!==void 0&&o.extension!==r&&Fe(298,r.name),!o){o=new J6(this,r),this.extensionNameMap.set(r.name,o);const i=this.conflicts.get(r.name);typeof i=="string"&&Fe(299,r.name,i);for(const s of r.conflictsWith||[])this.extensionNameMap.has(s)&&Fe(299,r.name,s),this.conflicts.set(s,r.name);for(const s of r.dependencies||[]){const a=Oa(s);this.addEdge(r.name,a[0].name,a.slice(1)),this.addExtension(a)}for(const[s,a]of r.peerDependencies||[])this.addEdge(r.name,s,a?[a]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const t=[],n=(r,o)=>{let i=r.state;if(Xx(i))return;const s=r.extension.name;var a;ou(i)||Fe(300,s,o||"[unknown]"),ou(a=i)||Fe(304,String(a.id),String(ah)),i=Object.assign(a,{id:$f}),r.state=i;const l=this.outgoingConfigEdges.get(s);if(l)for(const c of l.keys()){const u=this.extensionNameMap.get(c);u&&n(u,s)}i=G6(i),r.state=i,t.push(r)};for(const r of this.extensionNameMap.values())ou(r.state)&&n(r);for(const r of t)for(const[o,i]of this.outgoingConfigEdges.get(r.extension.name)||[])if(i.length>0){const s=this.extensionNameMap.get(o);if(s)for(const a of i)s.configs.add(a)}for(const[r,...o]of this.roots)if(o.length>0){const i=this.extensionNameMap.get(r.name);i===void 0&&Fe(301,r.name);for(const s of o)i.configs.add(s)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){const n=this.sortedExtensionReps(),r=new AbortController,o=[()=>r.abort()],i=r.signal;for(const s of n){const a=s.register(t,i);a&&o.push(a)}for(const s of n){const a=s.afterRegistration(t);a&&o.push(a)}return fn(...o)}buildCreateEditorArgs(){const t={},n=new Set,r=new Map,o=new Map,i={},s={},a=this.sortedExtensionReps();for(const u of a){const{extension:f}=u;if(f.onError!==void 0&&(t.onError=f.onError),f.disableEvents!==void 0&&(t.disableEvents=f.disableEvents),f.parentEditor!==void 0&&(t.parentEditor=f.parentEditor),f.editable!==void 0&&(t.editable=f.editable),f.namespace!==void 0&&(t.namespace=f.namespace),f.$initialEditorState!==void 0&&(t.$initialEditorState=f.$initialEditorState),f.nodes)for(const d of Q6(f)){if(typeof d!="function"){const h=r.get(d.replace);h&&Fe(302,f.name,d.replace.name,h.extension.name),r.set(d.replace,u)}n.add(d)}if(f.html){if(f.html.export)for(const[d,h]of f.html.export.entries())o.set(d,h);f.html.import&&Object.assign(i,f.html.import)}f.theme&&Zx(s,f.theme)}Object.keys(s).length>0&&(t.theme=s),n.size&&(t.nodes=[...n]);const l=Object.keys(i).length>0,c=o.size>0;(l||c)&&(t.html={},l&&(t.html.import=i),c&&(t.html.export=o));for(const u of a)u.init(t);return t.onError||(t.onError=tN),t}}function nN(e,t){const n=vi.fromEditor(e).extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}const rN={name:"@lexical/react/ReactProvider"};function oN(){return We().getTextContent()}function iN(e,t=!0){if(e)return!1;let n=oN();return t&&(n=n.trim()),n===""}function sN(e){if(!iN(e,!1))return!1;const t=We().getChildren(),n=t.length;if(n>1)return!1;for(let r=0;r<n;r++){const o=t[r];if(Te(o))return!1;if(R(o)){if(!Bd(o)||o.__indent!==0)return!1;const i=o.getChildren(),s=i.length;for(let a=0;a<s;a++){const l=i[r];if(!X(l))return!1}}}return!0}function e1(e){return()=>sN(e)}function aN(e){const t=window.location.origin,n=r=>{if(r.origin!==t)return;const o=e.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 a=s.payload;if(a&&a.functionId==="makeChanges"){const l=a.args;if(l){const[c,u,f,d,h]=l;e.update(()=>{const p=Z();if($(p)){const g=p.anchor;let m=g.getNode(),y=0,b=0;if(X(m)&&c>=0&&u>=0&&(y=c,b=c+u,p.setTextNodeRange(m,y,m,b)),y===b&&f===""||(p.insertRawText(f),m=g.getNode()),X(m)){y=d,b=d+h;const v=m.getTextContentSize();y=y>v?v:y,b=b>v?v:b,p.setTextNodeRange(m,y,m,b)}r.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}function t1(e,t){const n=vx(t)?t.body.childNodes:t.childNodes;let r=[];const o=[];for(const i of n)if(!o1.has(i.nodeName)){const s=i1(i,e,o,!1);s!==null&&(r=r.concat(s))}return(function(i){for(const s of i)s.getNextSibling()instanceof Ud&&s.insertAfter(Lo());for(const s of i){const a=s.getChildren();for(const l of a)s.insertBefore(l);s.remove()}})(o),r}function n1(e,t){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 n=document.createElement("div"),r=We().getChildren();for(let o=0;o<r.length;o++)r1(e,r[o],n,t);return n.innerHTML}function r1(e,t,n,r=null){let o=r===null||t.isSelected(r);const i=R(t)&&t.excludeFromCopy("html");let s=t;r!==null&&X(t)&&(s=$x(r,t,"clone"));const a=R(s)?s.getChildren():[],l=Kd(e,s.getType());let c;c=l&&l.exportDOM!==void 0?l.exportDOM(e,s):s.exportDOM(e);const{element:u,after:f}=c;if(!u)return!1;const d=document.createDocumentFragment();for(let h=0;h<a.length;h++){const p=a[h],g=r1(e,p,d,r);!o&&R(t)&&g&&t.extractWithChild(p,r,"html")&&(o=!0)}if(o&&!i){if((pt(u)||Df(u))&&u.append(d),n.append(u),f){const h=f.call(s,u);h&&(Df(u)?u.replaceChildren(h):u.replaceWith(h))}}else n.append(d);return o}const o1=new Set(["STYLE","SCRIPT"]);function i1(e,t,n,r,o=new Map,i){let s=[];if(o1.has(e.nodeName))return s;let a=null;const l=(function(p,g){const{nodeName:m}=p,y=g._htmlConversions.get(m.toLowerCase());let b=null;if(y!==void 0)for(const v of y){const w=v(p);w!==null&&(b===null||(b.priority||0)<=(w.priority||0))&&(b=w)}return b!==null?b.conversion:null})(e,t),c=l?l(e):null;let u=null;if(c!==null){u=c.after;const p=c.node;if(a=Array.isArray(p)?p[p.length-1]:p,a!==null){for(const[,g]of o)if(a=g(a,i),!a)break;a&&s.push(...Array.isArray(p)?p:[a])}c.forChild!=null&&o.set(e.nodeName,c.forChild)}const f=e.childNodes;let d=[];const h=(a==null||!jt(a))&&(a!=null&&Pf(a)||r);for(let p=0;p<f.length;p++)d.push(...i1(f[p],t,n,h,new Map(o),a));return u!=null&&(d=u(d)),bl(e)&&(d=lN(e,d,h?()=>{const p=new Ud;return n.push(p),p}:Tt)),a==null?d.length>0?s=s.concat(d):bl(e)&&(function(p){return p.nextSibling==null||p.previousSibling==null?!1:Ff(p.nextSibling)&&Ff(p.previousSibling)})(e)&&(s=s.concat(Lo())):R(a)&&a.append(...d),s}function lN(e,t,n){const r=e.style.textAlign,o=[];let i=[];for(let s=0;s<t.length;s++){const a=t[s];if(Pf(a))r&&!a.getFormat()&&a.setFormat(r),o.push(a);else if(i.push(a),s===t.length-1||s<t.length-1&&Pf(t[s+1])){const l=n();l.setFormat(r),l.append(...i),o.push(l),i=[]}}return o}function vl(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);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 cN(e,t=Z()){return t==null&&vl(166),$(t)&&t.isCollapsed()||t.getNodes().length===0?"":n1(e,t)}function uN(e,t=Z()){return t==null&&vl(166),$(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(fN(e,t))}function _g(e,t,n){const r=e.getData("application/x-lexical-editor");if(r)try{const a=JSON.parse(r);if(a.namespace===n._config.namespace&&Array.isArray(a.nodes))return Eg(n,dN(a.nodes),t)}catch(a){console.error(a)}const o=e.getData("text/html"),i=e.getData("text/plain");if(o&&i!==o)try{const a=new DOMParser().parseFromString((function(l){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:c=>c}).createHTML(l):l})(o),"text/html");return Eg(n,t1(n,a),t)}catch(a){console.error(a)}const s=i||e.getData("text/uri-list");if(s!=null)if($(t)){const a=s.split(/(\r?\n|\t)/);a[a.length-1]===""&&a.pop();for(let l=0;l<a.length;l++){const c=Z();if($(c)){const u=a[l];u===`
|
|
605
605
|
`||u===`\r
|
|
606
|
-
`?c.insertParagraph():u===" "?c.insertNodes([ta()]):c.insertText(u)}}}else t.insertRawText(s)}function Eg(e,t,n){e.dispatchCommand(x3,{nodes:t,selection:n})||(n.insertNodes(t),(function(r){if($(r)&&r.isCollapsed()){const o=r.anchor;let i=null;const s=nr(o,"previous");if(s)if(Or(s))i=s.origin;else{const a=Fr(s,un(We(),"next").getFlipped());for(const l of a){if(X(l.origin)){i=l.origin;break}if(R(l.origin)&&!l.origin.isInline())break}}if(i&&X(i)){const a=i.getFormat(),l=i.getStyle();r.format===a&&r.style===l||(r.format=a,r.style=l,r.dirty=!0)}}})(n))}function s1(e,t,n,r=[]){let o=t===null||n.isSelected(t);const i=R(n)&&n.excludeFromCopy("html");let s=n;t!==null&&X(s)&&(s=$x(t,s,"clone"));const a=R(s)?s.getChildren():[],l=(function(c){const u=c.exportJSON(),f=c.constructor;if(u.type!==f.getType()&&vl(58,f.name),R(c)){const d=u.children;Array.isArray(d)||vl(59,f.name)}return u})(s);X(s)&&s.getTextContentSize()===0&&(o=!1);for(let c=0;c<a.length;c++){const u=a[c],f=s1(e,t,u,l.children);!o&&R(n)&&f&&n.extractWithChild(u,t,"clone")&&(o=!0)}if(o&&!i)r.push(l);else if(Array.isArray(l.children))for(let c=0;c<l.children.length;c++){const u=l.children[c];r.push(u)}return o}function fN(e,t){const n=[],r=We().getChildren();for(let o=0;o<r.length;o++)s1(e,t,r[o],n);return{namespace:e._config.namespace,nodes:n}}function dN(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n],o=t6(r);X(o)&&z6(o),t.push(o)}return t}let ri=null;async function Sg(e,t,n){if(ri!==null)return!1;if(t!==null)return new Promise((c,u)=>{e.update(()=>{c(Tg(e,t,n))})});const r=e.getRootElement(),o=e._window||window,i=o.document,s=en(o);if(r===null||s===null)return!1;const a=i.createElement("span");a.style.cssText="position: fixed; top: -1000px;",a.append(i.createTextNode("#")),r.append(a);const l=new Range;return l.setStart(a,0),l.setEnd(a,1),s.removeAllRanges(),s.addRange(l),new Promise((c,u)=>{const f=e.registerCommand(Zl,d=>(Sr(d,ClipboardEvent)&&(f(),ri!==null&&(o.clearTimeout(ri),ri=null),c(Tg(e,d,n))),!0),hx);ri=o.setTimeout(()=>{f(),ri=null,c(!1)},50),i.execCommand("copy"),a.remove()})}function Tg(e,t,n){if(n===void 0){const o=en(e._window),i=Z();if(!i||i.isCollapsed()||!o)return!1;const s=o.anchorNode,a=o.focusNode;if(s!==null&&a!==null&&!oa(e,s,a))return!1;n=hN(i)}t.preventDefault();const r=t.clipboardData;return r!==null&&(pN(r,n),!0)}const a1=[["text/html",cN],["application/x-lexical-editor",uN]];function hN(e=Z()){const t={"text/plain":e?e.getTextContent():""};if(e){const n=Jd();for(const[r,o]of a1){const i=o(n,e);i!==null&&(t[r]=i)}}return t}function pN(e,t){for(const[n]of a1)t[n]===void 0&&e.setData(n,"");for(const n in t){const r=t[n];r!==void 0&&e.setData(n,r)}}function Ng(e,t){if(document.caretRangeFromPoint!==void 0){const n=document.caretRangeFromPoint(e,t);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const n=document.caretPositionFromPoint(e,t);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}const Ko=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,mN=Ko&&"documentMode"in document?document.documentMode:null,gN=Ko&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),yN=!(!Ko||!("InputEvent"in window)||mN)&&"getTargetRanges"in new window.InputEvent("input"),bN=Ko&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Og=Ko&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,vN=Ko&&/^(?=.*Chrome).*/i.test(navigator.userAgent),xN=Ko&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&gN&&!vN,Pg=he("DRAG_DROP_PASTE_FILE");function Pa(e){let t=null;if(Sr(e,DragEvent)?t=e.dataTransfer:Sr(e,ClipboardEvent)&&(t=e.clipboardData),t===null)return[!1,[],!1];const n=t.types,r=n.includes("Files"),o=n.includes("text/html")||n.includes("text/plain");return[r,Array.from(t.files),o]}function Mg(e){const t=Z();if(!$(t))return!1;const n=new Set,r=t.getNodes();for(let o=0;o<r.length;o++){const i=r[o],s=i.getKey();if(n.has(s))continue;const a=at(i,c=>R(c)&&!c.isInline());if(a===null)continue;const l=a.getKey();a.canIndent()&&!n.has(l)&&(n.add(l),e(a))}return n.size>0}function Ig(e){const t=Fi(e);return Te(t)}function su(e){for(const t of["lowercase","uppercase","capitalize"])e.hasFormat(t)&&e.toggleFormat(t)}function wN(e){return fn(e.registerCommand(Md,t=>{const n=Z();return!!ot(n)&&(n.clear(),!0)},we),e.registerCommand(bo,t=>{const n=Z();return $(n)?(n.deleteCharacter(t),!0):!!ot(n)&&(n.deleteNodes(),!0)},we),e.registerCommand(Rs,t=>{const n=Z();return!!$(n)&&(n.deleteWord(t),!0)},we),e.registerCommand(Ds,t=>{const n=Z();return!!$(n)&&(n.deleteLine(t),!0)},we),e.registerCommand(gi,t=>{const n=Z();if(typeof t=="string")n!==null&&n.insertText(t);else{if(n===null)return!1;const r=t.dataTransfer;if(r!=null)_g(r,n,e);else if($(n)){const o=t.data;return o&&n.insertText(o),!0}}return!0},we),e.registerCommand(xf,()=>{const t=Z();return!!$(t)&&(t.removeText(),!0)},we),e.registerCommand(Cn,t=>{const n=Z();return!!$(n)&&(n.formatText(t),!0)},we),e.registerCommand(_3,t=>{const n=Z();if(!$(n)&&!ot(n))return!1;const r=n.getNodes();for(const o of r){const i=at(o,s=>R(s)&&!s.isInline());i!==null&&i.setFormat(t)}return!0},we),e.registerCommand(mi,t=>{const n=Z();return!!$(n)&&(n.insertLineBreak(t),!0)},we),e.registerCommand(Ls,()=>{const t=Z();return!!$(t)&&(t.insertParagraph(),!0)},we),e.registerCommand(k3,()=>(sx([ta()]),!0),we),e.registerCommand(C3,()=>Mg(t=>{const n=t.getIndent();t.setIndent(n+1)}),we),e.registerCommand(Mm,()=>Mg(t=>{const n=t.getIndent();n>0&&t.setIndent(Math.max(0,n-1))}),we),e.registerCommand(Iv,t=>{const n=Z();if(ot(n)){const r=n.getNodes();if(r.length>0)return t.preventDefault(),r[0].selectPrevious(),!0}else if($(n)){const r=If(n.focus,!0);if(!t.shiftKey&&Te(r)&&!r.isIsolated()&&!r.isInline())return r.selectPrevious(),t.preventDefault(),!0}return!1},we),e.registerCommand(Lv,t=>{const n=Z();if(ot(n)){const r=n.getNodes();if(r.length>0)return t.preventDefault(),r[0].selectNext(0,0),!0}else if($(n)){if((function(o){const i=o.focus;return i.key==="root"&&i.offset===We().getChildrenSize()})(n))return t.preventDefault(),!0;const r=If(n.focus,!1);if(!t.shiftKey&&Te(r)&&!r.isIsolated()&&!r.isInline())return r.selectNext(),t.preventDefault(),!0}return!1},we),e.registerCommand(Mv,t=>{const n=Z();if(ot(n)){const r=n.getNodes();if(r.length>0)return t.preventDefault(),mg(r[0])?r[0].selectNext(0,0):r[0].selectPrevious(),!0}if(!$(n))return!1;if(yg(n,!0)){const r=t.shiftKey;return t.preventDefault(),bg(n,r,!0),!0}return!1},we),e.registerCommand(Pv,t=>{const n=Z();if(ot(n)){const o=n.getNodes();if(o.length>0)return t.preventDefault(),mg(o[0])?o[0].selectPrevious():o[0].selectNext(0,0),!0}if(!$(n))return!1;const r=t.shiftKey;return!!yg(n,!1)&&(t.preventDefault(),bg(n,r,!1),!0)},we),e.registerCommand(Dv,t=>{if(Ig(t.target))return!1;const n=Z();if($(n)){if((function(r){if(!r.isCollapsed())return!1;const{anchor:o}=r;if(o.offset!==0)return!1;const i=o.getNode();if(Ye(i))return!1;const s=K6(i);return s.getIndent()>0&&(s.is(i)||i.is(s.getFirstDescendant()))})(n))return t.preventDefault(),e.dispatchCommand(Mm,void 0);if(Og&&navigator.language==="ko-KR")return!1}else if(!ot(n))return!1;return t.preventDefault(),e.dispatchCommand(bo,!0)},we),e.registerCommand(Fv,t=>{if(Ig(t.target))return!1;const n=Z();return!(!$(n)&&!ot(n))&&(t.preventDefault(),e.dispatchCommand(bo,!1))},we),e.registerCommand(Fs,t=>{const n=Z();if(!$(n))return!1;if(su(n),t!==null){if((Og||bN||xN)&&yN)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(mi,!1)}return e.dispatchCommand(Ls,void 0)},we),e.registerCommand(Rd,()=>{const t=Z();return!!$(t)&&(e.blur(),!0)},we),e.registerCommand(zv,t=>{const[,n]=Pa(t);if(n.length>0){const o=Ng(t.clientX,t.clientY);if(o!==null){const{offset:i,node:s}=o,a=Fi(s);if(a!==null){const l=rx();if(X(a))l.anchor.set(a.getKey(),i,"text"),l.focus.set(a.getKey(),i,"text");else{const u=a.getParentOrThrow().getKey(),f=a.getIndexWithinParent()+1;l.anchor.set(u,f,"element"),l.focus.set(u,f,"element")}const c=Ri(l);Pt(c)}e.dispatchCommand(Pg,n)}return t.preventDefault(),!0}const r=Z();return!!$(r)},we),e.registerCommand($v,t=>{const[n]=Pa(t),r=Z();return!(n&&!$(r))},we),e.registerCommand(Uv,t=>{const[n]=Pa(t),r=Z();if(n&&!$(r))return!1;const o=Ng(t.clientX,t.clientY);if(o!==null){const i=Fi(o.node);Te(i)&&t.preventDefault()}return!0},we),e.registerCommand(wf,()=>(u6(),!0),we),e.registerCommand(Zl,t=>(Sg(e,Sr(t,ClipboardEvent)?t:null),!0),we),e.registerCommand(Dd,t=>((async function(n,r){await Sg(r,Sr(n,ClipboardEvent)?n:null),r.update(()=>{const o=Z();$(o)?o.removeText():ot(o)&&o.getNodes().forEach(i=>i.remove())})})(t,e),!0),we),e.registerCommand(Gl,t=>{const[,n,r]=Pa(t);return n.length>0&&!r?(e.dispatchCommand(Pg,n),!0):Xi(t.target)&&Hd(t.target)?!1:Z()!==null&&((function(o,i){o.preventDefault(),i.update(()=>{const s=Z(),a=Sr(o,InputEvent)||Sr(o,KeyboardEvent)?null:o.clipboardData;a!=null&&s!==null&&_g(a,s,i)},{tag:z3})})(t,e),!0)},we),e.registerCommand(Rv,t=>{const n=Z();return $(n)&&su(n),!1},we),e.registerCommand(jv,t=>{const n=Z();return $(n)&&su(n),!1},we))}function AN(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);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.`)}const lh=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?T.useLayoutEffect:T.useEffect;function kN({editor:e,ErrorBoundary:t}){return(function(n,r){const[o,i]=T.useState(()=>n.getDecorators());return lh(()=>n.registerDecoratorListener(s=>{Nn.flushSync(()=>{i(s)})}),[n]),T.useEffect(()=>{i(n.getDecorators())},[n]),T.useMemo(()=>{const s=[],a=Object.keys(o);for(let l=0;l<a.length;l++){const c=a[l],u=x.jsx(r,{onError:d=>n._onError(d),children:x.jsx(T.Suspense,{fallback:null,children:o[c]})}),f=n.getElementByKey(c);f!==null&&s.push(Nn.createPortal(u,f,c))}return s},[r,o,n])})(e,t)}function CN({editor:e,ErrorBoundary:t}){return(function(n){const r=vi.maybeFromEditor(n);if(r&&r.hasExtensionByName(rN.name)){for(const o of["@lexical/plain-text","@lexical/rich-text"])r.hasExtensionByName(o)&&AN(320,o);return!0}return!1})(e)?null:x.jsx(kN,{editor:e,ErrorBoundary:t})}function Lg(e){return e.getEditorState().read(e1(e.isComposing()))}function _N({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){const[r]=ht();return(function(o){lh(()=>fn(wN(o),aN(o)),[o])})(r),x.jsxs(x.Fragment,{children:[e,x.jsx(EN,{content:t}),x.jsx(CN,{editor:r,ErrorBoundary:n})]})}function EN({content:e}){const[t]=ht(),n=(function(o){const[i,s]=T.useState(()=>Lg(o));return lh(()=>{function a(){const l=Lg(o);s(l)}return a(),fn(o.registerUpdateListener(()=>{a()}),o.registerEditableListener(()=>{a()}))},[o]),i})(t),r=F6();return n?typeof e=="function"?e(r):e:null}function SN(e,t,n,r,o){if(e===null||n.size===0&&r.size===0&&!o)return 0;const i=t._selection,s=e._selection;if(o)return 1;if(!($(i)&&$(s)&&s.isCollapsed()&&i.isCollapsed()))return 0;const a=(function(y,b,v){const w=y._nodeMap,A=[];for(const C of b){const _=w.get(C);_!==void 0&&A.push(_)}for(const[C,_]of v){if(!_)continue;const E=w.get(C);E===void 0||Ye(E)||A.push(E)}return A})(t,n,r);if(a.length===0)return 0;if(a.length>1){const y=t._nodeMap,b=y.get(i.anchor.key),v=y.get(s.anchor.key);return b&&v&&!e._nodeMap.has(b.__key)&&X(b)&&b.__text.length===1&&i.anchor.offset===1?2:0}const l=a[0],c=e._nodeMap.get(l.__key);if(!X(c)||!X(l)||c.__mode!==l.__mode)return 0;const u=c.__text,f=l.__text;if(u===f)return 0;const d=i.anchor,h=s.anchor;if(d.key!==h.key||d.type!=="text")return 0;const p=d.offset,g=h.offset,m=f.length-u.length;return m===1&&g===p-1?2:m===-1&&g===p+1?3:m===-1&&g===p?4:0}function TN(e,t){let n=Date.now(),r=0;return(o,i,s,a,l,c)=>{const u=Date.now();if(c.has(Nf))return r=0,n=u,2;const f=SN(o,i,a,l,e.isComposing()),d=(()=>{const h=s===null||s.editor===e,p=c.has(j3);if(!p&&h&&c.has(vo))return 0;if(o===null)return 1;const g=i._selection;if(!(a.size>0||l.size>0))return g!==null?0:2;const m=typeof t=="number"?t:t.peek();return p===!1&&f!==0&&f===r&&u<n+m&&h||a.size===1&&(function(y,b,v){const w=b._nodeMap.get(y),A=v._nodeMap.get(y),C=b._selection,_=v._selection;return!($(C)&&$(_)&&C.anchor.type==="element"&&C.focus.type==="element"&&_.anchor.type==="text"&&_.focus.type==="text"||!X(w)||!X(A)||w.__parent!==A.__parent)&&JSON.stringify(b.read(()=>w.exportJSON()))===JSON.stringify(v.read(()=>A.exportJSON()))})(Array.from(a)[0],o,i)?0:1})();return n=u,r=f,d}}function Rg(e){e.undoStack=[],e.redoStack=[],e.current=null}function l1(e,t,n){const r=TN(e,n);return fn(e.registerCommand(Id,()=>((function(i,s){const a=s.redoStack,l=s.undoStack;if(l.length!==0){const c=s.current,u=l.pop();c!==null&&(a.push(c),i.dispatchCommand(Aa,!0)),l.length===0&&i.dispatchCommand(ka,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:Nf})}})(e,t),!0),we),e.registerCommand(Ld,()=>((function(i,s){const a=s.redoStack,l=s.undoStack;if(a.length!==0){const c=s.current;c!==null&&(l.push(c),i.dispatchCommand(ka,!0));const u=a.pop();a.length===0&&i.dispatchCommand(Aa,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:Nf})}})(e,t),!0),we),e.registerCommand(S3,()=>(Rg(t),!1),we),e.registerCommand(T3,()=>(Rg(t),e.dispatchCommand(Aa,!1),e.dispatchCommand(ka,!1),!0),we),e.registerUpdateListener(({editorState:i,prevEditorState:s,dirtyLeaves:a,dirtyElements:l,tags:c})=>{const u=t.current,f=t.redoStack,d=t.undoStack,h=u===null?null:u.editorState;if(u!==null&&i===h)return;const p=r(s,i,u,a,l,c);if(p===1)f.length!==0&&(t.redoStack=[],e.dispatchCommand(Aa,!1)),u!==null&&(d.push({...u}),e.dispatchCommand(ka,!0));else if(p===2)return;t.current={editor:e,editorState:i}}))}function c1(){return{current:null,redoStack:[],undoStack:[]}}const au={build:(e,{delay:t,createInitialHistoryState:n,disabled:r})=>Gx({delay:t,disabled:r,historyState:n(e)}),config:{createInitialHistoryState:c1,delay:300,disabled:typeof window>"u"},name:"@lexical/history/History",register:(e,t,n)=>{const r=n.getOutput();return $s(()=>r.disabled.value?void 0:l1(e,r.historyState.value,r.delay))}};P6(au,{createInitialHistoryState:()=>{throw new Error("SharedHistory did not inherit parent history")},disabled:!0});function NN({delay:e,externalHistoryState:t}){const[n]=ht();return(function(r,o,i=1e3){const s=T.useMemo(()=>o||c1(),[o]);T.useEffect(()=>l1(r,s,i),[i,r,s])})(n,t,e),null}const u1=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?T.useLayoutEffect:T.useEffect;function ON({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:r,ariaDescribedBy:o,ariaErrorMessage:i,ariaExpanded:s,ariaInvalid:a,ariaLabel:l,ariaLabelledBy:c,ariaMultiline:u,ariaOwns:f,ariaRequired:d,autoCapitalize:h,className:p,id:g,role:m="textbox",spellCheck:y=!0,style:b,tabIndex:v,"data-testid":w,...A},C){const[_,E]=T.useState(e.isEditable()),N=T.useCallback(I=>{I&&I.ownerDocument&&I.ownerDocument.defaultView?e.setRootElement(I):e.setRootElement(null)},[e]),P=T.useMemo(()=>(function(...I){return W=>{for(const j of I)typeof j=="function"?j(W):j!=null&&(j.current=W)}})(C,N),[N,C]);return u1(()=>(E(e.isEditable()),e.registerEditableListener(I=>{E(I)})),[e]),x.jsx("div",{"aria-activedescendant":_?t:void 0,"aria-autocomplete":_?n:"none","aria-controls":_?r:void 0,"aria-describedby":o,...i!=null?{"aria-errormessage":i}:{},"aria-expanded":_&&m==="combobox"?!!s:void 0,...a!=null?{"aria-invalid":a}:{},"aria-label":l,"aria-labelledby":c,"aria-multiline":u,"aria-owns":_?f:void 0,"aria-readonly":!_||void 0,"aria-required":d,autoCapitalize:h,className:p,contentEditable:_,"data-testid":w,id:g,ref:P,role:m,spellCheck:y,style:b,tabIndex:v,...A})}const PN=T.forwardRef(ON);function Dg(e){return e.getEditorState().read(e1(e.isComposing()))}const MN=T.forwardRef(IN);function IN(e,t){const{placeholder:n,...r}=e,[o]=ht();return x.jsxs(x.Fragment,{children:[x.jsx(PN,{editor:o,...r,ref:t}),n!=null&&x.jsx(LN,{editor:o,content:n})]})}function LN({content:e,editor:t}){const n=(function(s){const[a,l]=T.useState(()=>Dg(s));return u1(()=>{function c(){const u=Dg(s);l(u)}return c(),fn(s.registerUpdateListener(()=>{c()}),s.registerEditableListener(()=>{c()}))},[s]),a})(t),[r,o]=T.useState(t.isEditable());if(T.useLayoutEffect(()=>(o(t.isEditable()),t.registerEditableListener(s=>{o(s)})),[t]),!n)return null;let i=null;return typeof e=="function"?i=e(r):e!==null&&(i=e),i===null?null:x.jsx("div",{"aria-hidden":!0,children:i})}const RN=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?T.useLayoutEffect:T.useEffect;function DN({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){const[r]=ht();return RN(()=>{if(n)return r.registerUpdateListener(({editorState:o,dirtyElements:i,dirtyLeaves:s,prevEditorState:a,tags:l})=>{t&&i.size===0&&s.size===0||e&&l.has(vo)||a.isEmpty()||n(o,r,l)})},[r,e,t,n]),null}const FN=T.createContext(null),lu={didCatch:!1,error:null};class jN extends T.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=lu}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(...t){var r,o;const{error:n}=this.state;n!==null&&((o=(r=this.props).onReset)==null||o.call(r,{args:t,reason:"imperative-api"}),this.setState(lu))}componentDidCatch(t,n){var r,o;(o=(r=this.props).onError)==null||o.call(r,t,n)}componentDidUpdate(t,n){var i,s;const{didCatch:r}=this.state,{resetKeys:o}=this.props;r&&n.error!==null&&zN(t.resetKeys,o)&&((s=(i=this.props).onReset)==null||s.call(i,{next:o,prev:t.resetKeys,reason:"keys"}),this.setState(lu))}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:o}=this.props,{didCatch:i,error:s}=this.state;let a=t;if(i){const l={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")a=n(l);else if(r)a=T.createElement(r,l);else if(o!==void 0)a=o;else throw s}return T.createElement(FN.Provider,{value:{didCatch:i,error:s,resetErrorBoundary:this.resetErrorBoundary}},a)}}function zN(e=[],t=[]){return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}function $N({children:e,onError:t}){return x.jsx(jN,{fallback:x.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}const UN={paragraph:"m-0",list:{ol:"list-decimal pl-4",ul:"list-disc pl-4"},text:{bold:"font-semibold",italic:"italic",underline:"underline",strikethrough:"line-through",code:"font-mono"},link:"text-blue-600 hover:text-blue-600 underline cursor-pointer"};function Tr(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);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 Uf(e){let t=1,n=e.getParent();for(;n!=null;){if(Se(n)){const r=n.getParent();if(ve(r)){t++,n=r.getParent();continue}Tr(40)}return t}return t}function Bf(e){let t=e.getParent();ve(t)||Tr(40);let n=t;for(;n!==null;)n=n.getParent(),ve(n)&&(t=n);return t}function f1(e){let t=[];const n=e.getChildren().filter(Se);for(let r=0;r<n.length;r++){const o=n[r],i=o.getFirstChild();ve(i)?t=t.concat(f1(i)):t.push(o)}return t}function wn(e){return Se(e)&&ve(e.getFirstChild())}function Fg(e){return Zt().append(e)}function d1(e,t){return Se(e)&&(t.length===0||t.length===1&&e.is(t[0])&&e.getChildrenSize()===0)}function jg(e){const t=Z();if(t!==null){let n=t.getNodes();if($(t)){const o=t.getStartEndPoints();o===null&&Tr(143);const[i]=o,s=i.getNode(),a=s.getParent();if(jt(s)){const l=s.getFirstChild();if(l)n=l.selectStart().getNodes();else{const c=Tt();s.append(c),n=c.select().getNodes()}}else if(d1(s,n)){const l=Bt(e);if(jt(a)){s.replace(l);const c=Zt();R(s)&&(c.setFormat(s.getFormatType()),c.setIndent(s.getIndent())),l.append(c)}else if(Se(s)){const c=s.getParentOrThrow();Uo(l,c.getChildren()),c.replace(l)}return}}const r=new Set;for(let o=0;o<n.length;o++){const i=n[o];if(R(i)&&i.isEmpty()&&!Se(i)&&!r.has(i.getKey())){zg(i,e);continue}let s=xx(i)?i.getParent():Se(i)&&i.isEmpty()?i:null;for(;s!=null;){const a=s.getKey();if(ve(s)){if(!r.has(a)){const l=Bt(e);Uo(l,s.getChildren()),s.replace(l),r.add(a)}break}{const l=s.getParent();if(jt(l)&&!r.has(a)){r.add(a),zg(s,e);break}s=l}}}}}function Uo(e,t){e.splice(e.getChildrenSize(),0,t)}function zg(e,t){if(ve(e))return e;const n=e.getPreviousSibling(),r=e.getNextSibling(),o=Zt();let i;if(Uo(o,e.getChildren()),ve(n)&&t===n.getListType())n.append(o),ve(r)&&t===r.getListType()&&(Uo(n,r.getChildren()),r.remove()),i=n;else if(ve(r)&&t===r.getListType())r.getFirstChildOrThrow().insertBefore(o),i=r;else{const s=Bt(t);s.append(o),e.replace(s),i=s}return o.setFormat(e.getFormatType()),o.setIndent(e.getIndent()),e.remove(),i}function ch(e,t){const n=e.getLastChild(),r=t.getFirstChild();n&&r&&wn(n)&&wn(r)&&(ch(n.getFirstChild(),r.getFirstChild()),r.remove());const o=t.getChildren();o.length>0&&e.append(...o),t.remove()}function BN(){const e=Z();if($(e)){const t=new Set,n=e.getNodes(),r=e.anchor.getNode();if(d1(r,n))t.add(Bf(r));else for(let o=0;o<n.length;o++){const i=n[o];if(xx(i)){const s=W6(i,ts);s!=null&&t.add(Bf(s))}}for(const o of t){let i=o;const s=f1(o);for(const a of s){const l=Tt().setTextStyle(e.style).setTextFormat(e.format);Uo(l,a.getChildren()),i.insertAfter(l),i=l,a.__key===e.anchor.key&&$o(e.anchor,Yt(un(l,"next"))),a.__key===e.focus.key&&$o(e.focus,Yt(un(l,"next"))),a.remove()}o.remove()}}}function h1(e){const t=e.getListType()!=="check";let n=e.getStart();for(const r of e.getChildren())Se(r)&&(r.getValue()!==n&&r.setValue(n),t&&r.getLatest().__checked!=null&&r.setChecked(void 0),ve(r.getFirstChild())||n++)}function WN(e){const t=new Set;if(wn(e)||t.has(e.getKey()))return;const n=e.getParent(),r=e.getNextSibling(),o=e.getPreviousSibling();if(wn(r)&&wn(o)){const i=o.getFirstChild();if(ve(i)){i.append(e);const s=r.getFirstChild();ve(s)&&(Uo(i,s.getChildren()),r.remove(),t.add(r.getKey()))}}else if(wn(r)){const i=r.getFirstChild();if(ve(i)){const s=i.getFirstChild();s!==null&&s.insertBefore(e)}}else if(wn(o)){const i=o.getFirstChild();ve(i)&&i.append(e)}else if(ve(n)){const i=Zt().setTextFormat(e.getTextFormat()).setTextStyle(e.getTextStyle()),s=Bt(n.getListType()).setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle());i.append(s),s.append(e),o?o.insertAfter(i):r?r.insertBefore(i):n.append(i)}}function KN(e){if(wn(e))return;const t=e.getParent(),n=t?t.getParent():void 0;if(ve(n?n.getParent():void 0)&&Se(n)&&ve(t)){const r=t?t.getFirstChild():void 0,o=t?t.getLastChild():void 0;if(e.is(r))n.insertBefore(e),t.isEmpty()&&n.remove();else if(e.is(o))n.insertAfter(e),t.isEmpty()&&n.remove();else{const i=t.getListType(),s=Zt(),a=Bt(i);s.append(a),e.getPreviousSiblings().forEach(u=>a.append(u));const l=Zt(),c=Bt(i);l.append(c),Uo(c,e.getNextSiblings()),n.insertBefore(s),n.insertAfter(l),n.replace(e)}}}function HN(){const e=Z();if(!$(e)||!e.isCollapsed())return!1;const t=e.anchor.getNode();if(!Se(t)||t.getChildrenSize()!==0)return!1;const n=Bf(t),r=t.getParent();ve(r)||Tr(40);const o=r.getParent();let i;if(jt(o))i=Tt(),n.insertAfter(i);else{if(!Se(o))return!1;i=Zt(),o.insertAfter(i)}i.setTextStyle(e.style).setTextFormat(e.format).select();const s=t.getNextSiblings();if(s.length>0){const a=Bt(r.getListType());if(Se(i)){const l=Zt();l.append(a),i.insertAfter(l)}else i.insertAfter(a);a.append(...s)}return(function(a){let l=a;for(;l.getNextSibling()==null&&l.getPreviousSibling()==null;){const c=l.getParent();if(c==null||!Se(c)&&!ve(c))break;l=c}l.remove()})(t),!0}function xl(...e){const t=[];for(const n of e)if(n&&typeof n=="string")for(const[r]of n.matchAll(/\S+/g))t.push(r);return t}class ts extends Mn{constructor(n=1,r=void 0,o){super(o);D(this,"__value");D(this,"__checked");this.__value=n===void 0?1:n,this.__checked=r}$config(){return this.config("listitem",{$transform:n=>{if(n.__checked==null)return;const r=n.getParent();ve(r)&&r.getListType()!=="check"&&n.getChecked()!=null&&n.setChecked(void 0)},extends:Mn,importDOM:{li:()=>({conversion:qN,priority:0})}})}afterCloneFrom(n){super.afterCloneFrom(n),this.__value=n.__value,this.__checked=n.__checked}createDOM(n){const r=document.createElement("li");return this.updateListItemDOM(null,r,n),r}updateListItemDOM(n,r,o){(function(a,l,c){const u=l.getParent();!ve(u)||u.getListType()!=="check"||ve(l.getFirstChild())?(a.removeAttribute("role"),a.removeAttribute("tabIndex"),a.removeAttribute("aria-checked")):(a.setAttribute("role","checkbox"),a.setAttribute("tabIndex","-1"),c&&l.__checked===c.__checked||a.setAttribute("aria-checked",l.getChecked()?"true":"false"))})(r,this,n),r.value=this.__value,(function(a,l,c){const u=[],f=[],d=l.list,h=d?d.listitem:void 0;let p;if(d&&d.nested&&(p=d.nested.listitem),h!==void 0&&u.push(...xl(h)),d){const g=c.getParent(),m=ve(g)&&g.getListType()==="check",y=c.getChecked();m&&!y||f.push(d.listitemUnchecked),m&&y||f.push(d.listitemChecked),m&&u.push(y?d.listitemChecked:d.listitemUnchecked)}if(p!==void 0){const g=xl(p);c.getChildren().some(m=>ve(m))?u.push(...g):f.push(...g)}f.length>0&&qx(a,...f),u.length>0&&ih(a,...u)})(r,o.theme,this);const i=n?n.__style:"",s=this.__style;i!==s&&(s===""?r.removeAttribute("style"):r.style.cssText=s),(function(a,l,c){const u=pg(l.__textStyle);for(const f in u)a.style.setProperty(`--listitem-marker-${f}`,u[f]);if(c)for(const f in pg(c.__textStyle))f in u||a.style.removeProperty(`--listitem-marker-${f}`)})(r,this,n)}updateDOM(n,r,o){const i=r;return this.updateListItemDOM(n,i,o),!1}updateFromJSON(n){return super.updateFromJSON(n).setValue(n.value).setChecked(n.checked)}exportDOM(n){const r=this.createDOM(n._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(...n){for(let r=0;r<n.length;r++){const o=n[r];if(R(o)&&this.canMergeWith(o)){const i=o.getChildren();this.append(...i),o.remove()}else super.append(o)}return this}replace(n,r){if(Se(n))return super.replace(n);this.setIndent(0);const o=this.getParentOrThrow();if(!ve(o))return n;if(o.__first===this.getKey())o.insertBefore(n);else if(o.__last===this.getKey())o.insertAfter(n);else{const i=Bt(o.getListType());let s=this.getNextSibling();for(;s;){const a=s;s=s.getNextSibling(),i.append(a)}o.insertAfter(n),n.insertAfter(i)}return r&&(R(n)||Tr(139),this.getChildren().forEach(i=>{n.append(i)})),this.remove(),o.getChildrenSize()===0&&o.remove(),n}insertAfter(n,r=!0){const o=this.getParentOrThrow();if(ve(o)||Tr(39),Se(n))return super.insertAfter(n,r);const i=this.getNextSiblings();if(o.insertAfter(n,r),i.length!==0){const s=Bt(o.getListType());i.forEach(a=>s.append(a)),n.insertAfter(s,r)}return n}remove(n){const r=this.getPreviousSibling(),o=this.getNextSibling();super.remove(n),r&&o&&wn(r)&&wn(o)&&(ch(r.getFirstChild(),o.getFirstChild()),o.remove())}insertNewAfter(n,r=!0){const o=Zt().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(o,r),o}collapseAtStart(n){const r=Tt();this.getChildren().forEach(a=>r.append(a));const o=this.getParentOrThrow(),i=o.getParentOrThrow(),s=Se(i);if(o.getChildrenSize()===1)if(s)o.remove(),i.select();else{o.insertBefore(r),o.remove();const a=n.anchor,l=n.focus,c=r.getKey();a.type==="element"&&a.getNode().is(this)&&a.set(c,a.offset,"element"),l.type==="element"&&l.getNode().is(this)&&l.set(c,l.offset,"element")}else o.insertBefore(r),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(n){const r=this.getWritable();return r.__value=n,r}getChecked(){const n=this.getLatest();let r;const o=this.getParent();return ve(o)&&(r=o.getListType()),r==="check"?!!n.__checked:void 0}setChecked(n){const r=this.getWritable();return r.__checked=n,r}toggleChecked(){const n=this.getWritable();return n.setChecked(!n.__checked)}getIndent(){const n=this.getParent();if(n===null||!this.isAttached())return this.getLatest().__indent;let r=n.getParentOrThrow(),o=0;for(;Se(r);)r=r.getParentOrThrow().getParentOrThrow(),o++;return o}setIndent(n){typeof n!="number"&&Tr(117),(n=Math.floor(n))>=0||Tr(199);let r=this.getIndent();for(;r!==n;)r<n?(WN(this),r++):(KN(this),r--);return this}canInsertAfter(n){return Se(n)}canReplaceWith(n){return Se(n)}canMergeWith(n){return Se(n)||Bd(n)}extractWithChild(n,r){if(!$(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 Bt("bullet")}canMergeWhenEmpty(){return!0}}function qN(e){if(e.classList.contains("task-list-item")){for(const n of e.children)if(n.tagName==="INPUT")return $g(n)}if(e.classList.contains("joplin-checkbox")){for(const n of e.children)if(n.classList.contains("checkbox-wrapper")&&n.children.length>0&&n.children[0].tagName==="INPUT")return $g(n.children[0])}const t=e.getAttribute("aria-checked");return{node:Zt(t==="true"||t!=="false"&&void 0)}}function $g(e){return e.getAttribute("type")!=="checkbox"?{node:null}:{node:Zt(e.hasAttribute("checked"))}}function Zt(e){return Kr(new ts(void 0,e))}function Se(e){return e instanceof ts}class sa extends Mn{constructor(n="number",r=1,o){super(o);D(this,"__tag");D(this,"__start");D(this,"__listType");const i=YN[n]||n;this.__listType=i,this.__tag=i==="number"?"ol":"ul",this.__start=r}$config(){return this.config("list",{$transform:n=>{(function(r){const o=r.getNextSibling();ve(o)&&r.getListType()===o.getListType()&&ch(r,o)})(n),h1(n)},extends:Mn,importDOM:{ol:()=>({conversion:Bg,priority:0}),ul:()=>({conversion:Bg,priority:0})}})}afterCloneFrom(n){super.afterCloneFrom(n),this.__listType=n.__listType,this.__tag=n.__tag,this.__start=n.__start}getTag(){return this.getLatest().__tag}setListType(n){const r=this.getWritable();return r.__listType=n,r.__tag=n==="number"?"ol":"ul",r}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(n){const r=this.getWritable();return r.__start=n,r}createDOM(n,r){const o=this.__tag,i=document.createElement(o);return this.__start!==1&&i.setAttribute("start",String(this.__start)),i.__lexicalListType=this.__listType,Ug(i,n.theme,this),i}updateDOM(n,r,o){return n.__tag!==this.__tag||n.__listType!==this.__listType||(Ug(r,o.theme,this),!1)}updateFromJSON(n){return super.updateFromJSON(n).setListType(n.listType).setStart(n.start)}exportDOM(n){const r=this.createDOM(n._config,n);return pt(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(n,r,o){let i=o;for(let s=0;s<o.length;s++){const a=o[s];Se(a)||(i===o&&(i=[...o]),i[s]=Zt().append(!R(a)||ve(a)||a.isInline()?a:rt(a.getTextContent())))}return super.splice(n,r,i)}extractWithChild(n){return Se(n)}}function Ug(e,t,n){const r=[],o=[],i=t.list;if(i!==void 0){const s=i[`${n.__tag}Depth`]||[],a=Uf(n)-1,l=a%s.length,c=s[l],u=i[n.__tag];let f;const d=i.nested,h=i.checklist;if(d!==void 0&&d.list&&(f=d.list),u!==void 0&&r.push(u),h!==void 0&&n.__listType==="check"&&r.push(h),c!==void 0){r.push(...xl(c));for(let p=0;p<s.length;p++)p!==l&&o.push(n.__tag+p)}if(f!==void 0){const p=xl(f);a>1?r.push(...p):o.push(...p)}}o.length>0&&qx(e,...o),r.length>0&&ih(e,...r)}function VN(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n];if(Se(r)){t.push(r);const o=r.getChildren();o.length>1&&o.forEach(i=>{ve(i)&&t.push(Fg(i))})}else t.push(Fg(r))}return t}function Bg(e){const t=e.nodeName.toLowerCase();let n=null;return t==="ol"?n=Bt("number",e.start):t==="ul"&&(n=(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(pt(o)&&o.hasAttribute("aria-checked"))return!0;return!1})(e)?Bt("check"):Bt("bullet")),{after:VN,node:n}}const YN={ol:"number",ul:"bullet"};function Bt(e="number",t=1){return Kr(new sa(e,t))}function ve(e){return e instanceof sa}const QN=he("UPDATE_LIST_START_COMMAND"),p1=he("INSERT_UNORDERED_LIST_COMMAND"),m1=he("INSERT_ORDERED_LIST_COMMAND"),Wf=he("REMOVE_LIST_COMMAND");function GN(e){return fn(e.registerCommand(m1,()=>(jg("number"),!0),Gn),e.registerCommand(QN,t=>{const{listNodeKey:n,newStart:r}=t,o=Xe(n);return!!ve(o)&&(o.getListType()==="number"&&(o.setStart(r),h1(o)),!0)},Gn),e.registerCommand(p1,()=>(jg("bullet"),!0),Gn),e.registerCommand(Wf,()=>(BN(),!0),Gn),e.registerCommand(Ls,()=>HN(),Gn),e.registerNodeTransform(ts,t=>{const n=t.getFirstChild();if(n){if(X(n)){const r=n.getStyle(),o=n.getFormat();t.getTextStyle()!==r&&t.setTextStyle(r),t.getTextFormat()!==o&&t.setTextFormat(o)}}else{const r=Z();$(r)&&(r.style!==t.getTextStyle()||r.format!==t.getTextFormat())&&r.isCollapsed()&&t.is(r.anchor.getNode())&&t.setTextStyle(r.style).setTextFormat(r.format)}}),e.registerNodeTransform(Br,t=>{const n=t.getParent();if(Se(n)&&t.is(n.getFirstChild())){const r=t.getStyle(),o=t.getFormat();r===n.getTextStyle()&&o===n.getTextFormat()||n.setTextStyle(r).setTextFormat(o)}}))}function ZN(e){const t=n=>{const r=n.getParent();if(ve(n.getFirstChild())||!ve(r))return;const o=at(n,i=>Se(i)&&ve(i.getParent())&&Se(i.getPreviousSibling()));if(o===null&&n.getIndent()>0)n.setIndent(0);else if(Se(o)){const i=o.getPreviousSibling();if(Se(i)){const s=(function(l){let c=l,u=c.getFirstChild();for(;ve(u);){const f=u.getLastChild();if(!Se(f))break;c=f,u=c.getFirstChild()}return c})(i),a=s.getParent();if(ve(a)){const l=Uf(a);l+1<Uf(r)&&n.setIndent(l)}}}};return e.registerNodeTransform(sa,n=>{const r=[n];for(;r.length>0;){const o=r.shift();if(ve(o)){for(const i of o.getChildren())if(Se(i)){t(i);const s=i.getFirstChild();ve(s)&&r.push(s)}}}})}const JN=new Set(["http:","https:","mailto:","sms:","tel:"]);class Ho extends Mn{constructor(n="",r={},o){super(o);D(this,"__url");D(this,"__target");D(this,"__rel");D(this,"__title");const{target:i=null,rel:s=null,title:a=null}=r;this.__url=n,this.__target=i,this.__rel=s,this.__title=a}static getType(){return"link"}static clone(n){return new Ho(n.__url,{rel:n.__rel,target:n.__target,title:n.__title},n.__key)}createDOM(n){const r=document.createElement("a");return this.updateLinkDOM(null,r,n),ih(r,n.theme.link),r}updateLinkDOM(n,r,o){if(Nx(r)){n&&n.__url===this.__url||(r.href=this.sanitizeUrl(this.__url));for(const i of["target","rel","title"]){const s=`__${i}`,a=this[s];n&&n[s]===a||(a?r[i]=a:r.removeAttribute(i))}}}updateDOM(n,r,o){return this.updateLinkDOM(n,r,o),!1}static importDOM(){return{a:n=>({conversion:XN,priority:1})}}static importJSON(n){return ko().updateFromJSON(n)}updateFromJSON(n){return super.updateFromJSON(n).setURL(n.url).setRel(n.rel||null).setTarget(n.target||null).setTitle(n.title||null)}sanitizeUrl(n){n=Hg(n);try{const r=new URL(Hg(n));if(!JN.has(r.protocol))return"about:blank"}catch{return n}return n}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(n){const r=this.getWritable();return r.__url=n,r}getTarget(){return this.getLatest().__target}setTarget(n){const r=this.getWritable();return r.__target=n,r}getRel(){return this.getLatest().__rel}setRel(n){const r=this.getWritable();return r.__rel=n,r}getTitle(){return this.getLatest().__title}setTitle(n){const r=this.getWritable();return r.__title=n,r}insertNewAfter(n,r=!0){const o=ko(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(o,r),o}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(n,r,o){if(!$(r))return!1;const i=r.anchor.getNode(),s=r.focus.getNode();return this.isParentOf(i)&&this.isParentOf(s)&&r.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function XN(e){let t=null;if(Nx(e)){const n=e.textContent;(n!==null&&n!==""||e.children.length>0)&&(t=ko(e.getAttribute("href")||"",{rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")}))}return{node:t}}function ko(e="",t){return Kr(new Ho(e,t))}function ut(e){return e instanceof Ho}class ic extends Ho{constructor(n="",r={},o){super(n,r,o);D(this,"__isUnlinked");this.__isUnlinked=r.isUnlinked!==void 0&&r.isUnlinked!==null&&r.isUnlinked}static getType(){return"autolink"}static clone(n){return new ic(n.__url,{isUnlinked:n.__isUnlinked,rel:n.__rel,target:n.__target,title:n.__title},n.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(n){const r=this.getWritable();return r.__isUnlinked=n,r}createDOM(n){return this.__isUnlinked?document.createElement("span"):super.createDOM(n)}updateDOM(n,r,o){return super.updateDOM(n,r,o)||n.__isUnlinked!==this.__isUnlinked}static importJSON(n){return Wg().updateFromJSON(n)}updateFromJSON(n){return super.updateFromJSON(n).setIsUnlinked(n.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(n,r=!0){const o=this.getParentOrThrow().insertNewAfter(n,r);if(R(o)){const i=Wg(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return o.append(i),i}return null}}function Wg(e="",t){return Kr(new ic(e,t))}function so(e){return e instanceof ic}const $i=he("TOGGLE_LINK_COMMAND");function Kg(e,t){if(e.type==="element"){const n=e.getNode();return R(n)||(function(r,...o){const i=new URL("https://lexical.dev/docs/error"),s=new URLSearchParams;s.append("code",r);for(const a of o)s.append("v",a);throw i.search=s.toString(),Error(`Minified Lexical error #${r}; visit ${i.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(252),n.getChildren()[e.offset+t]||null}return null}function cu(e,t={}){let n;if(e&&typeof e=="object"){const{url:u,...f}=e;n=u,t={...f,...t}}else n=e;const{target:r,title:o}=t,i=t.rel===void 0?"noreferrer":t.rel,s=Z();if(s===null||!$(s)&&!ot(s))return;if(ot(s)){const u=s.getNodes();return u.length===0?void 0:void u.forEach(f=>{if(n===null){const d=at(f,h=>!so(h)&&ut(h));d&&(d.insertBefore(f),d.getChildren().length===0&&d.remove())}else{const d=at(f,h=>!so(h)&&ut(h));if(d)d.setURL(n),r!==void 0&&d.setTarget(r),i!==void 0&&d.setRel(i);else{const h=ko(n,{rel:i,target:r});f.insertBefore(h),h.append(f)}}})}const a=s.extract();if(n===null){const u=new Set;return void a.forEach(f=>{const d=f.getParent();if(ut(d)&&!so(d)){const h=d.getKey();if(u.has(h))return;(function(p,g){const m=new Set(g.filter(_=>p.isParentOf(_)).map(_=>_.getKey())),y=p.getChildren(),b=y.filter(_=>m.has(_.getKey()));if(b.length===y.length)return y.forEach(_=>p.insertBefore(_)),void p.remove();const v=y.findIndex(_=>m.has(_.getKey())),w=y.findLastIndex(_=>m.has(_.getKey())),A=v===0,C=w===y.length-1;if(A)b.forEach(_=>p.insertBefore(_));else if(C)for(let _=b.length-1;_>=0;_--)p.insertAfter(b[_]);else{for(let E=b.length-1;E>=0;E--)p.insertAfter(b[E]);const _=y.slice(w+1);if(_.length>0){const E=ko(p.getURL(),{rel:p.getRel(),target:p.getTarget(),title:p.getTitle()});b[b.length-1].insertAfter(E),_.forEach(N=>E.append(N))}}})(d,a),u.add(h)}})}const l=new Set,c=u=>{l.has(u.getKey())||(l.add(u.getKey()),u.setURL(n),r!==void 0&&u.setTarget(r),i!==void 0&&u.setRel(i),o!==void 0&&u.setTitle(o))};if(a.length===1){const u=a[0],f=at(u,ut);if(f!==null)return c(f)}(function(u){const f=Z();if(!$(f))return u();const d=Ri(f),h=d.isBackward(),p=Kg(d.anchor,h?-1:0),g=Kg(d.focus,h?0:-1);if(u(),p||g){const m=Z();if($(m)){const y=m.clone();if(p){const b=p.getParent();b&&y.anchor.set(b.getKey(),p.getIndexWithinParent()+(h?1:0),"element")}if(g){const b=g.getParent();b&&y.focus.set(b.getKey(),g.getIndexWithinParent()+(h?0:1),"element")}Pt(Ri(y))}}})(()=>{let u=null;for(const f of a){if(!f.isAttached())continue;const d=at(f,ut);if(d){c(d);continue}if(R(f)){if(!f.isInline())continue;if(ut(f)){if(!(so(f)||u!==null&&u.getParentOrThrow().isParentOf(f))){c(f),u=f;continue}for(const p of f.getChildren())f.insertBefore(p);f.remove();continue}}const h=f.getPreviousSibling();ut(h)&&h.is(u)?h.append(f):(u=ko(n,{rel:i,target:r,title:o}),f.insertAfter(u),u.append(f))}})}const e5=/^\+?[0-9\s()-]{5,}$/;function Hg(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes("@")?`mailto:${e}`:e5.test(e)?`tel:${e}`:`https://${e}`}function t5(e,t){return fn($s(()=>e.registerCommand($i,n=>{const r=t.validateUrl.peek(),o=t.attributes.peek();if(n===null)return cu(null),!0;if(typeof n=="string")return!(r!==void 0&&!r(n))&&(cu(n,o),!0);{const{url:i,target:s,rel:a,title:l}=n;return cu(i,{...o,rel:a,target:s,title:l}),!0}},Gn)),$s(()=>{const n=t.validateUrl.value;if(!n)return;const r=t.attributes.value;return e.registerCommand(Gl,o=>{const i=Z();if(!$(i)||i.isCollapsed()||!Sr(o,ClipboardEvent)||o.clipboardData===null)return!1;const s=o.clipboardData.getData("text");return!!n(s)&&!i.getNodes().some(a=>R(a))&&(e.dispatchCommand($i,{...r,url:s}),o.preventDefault(),!0)},Gn)}))}function n5({commentType:e,onCommentTypeChange:t,isCommentTypeEditable:n=!0,actions:r,setIsLinkEditMode:o,onAddAttachments:i}){const[s]=ht(),[a,l]=T.useState({bold:!1,italic:!1,underline:!1,strikethrough:!1,code:!1}),[c,u]=T.useState(null),f=T.useRef(null),d=T.useRef(null),h=uh[e];T.useLayoutEffect(()=>s.registerUpdateListener(({editorState:b})=>{b.read(()=>{const v=Z();if(!$(v))return;l({bold:v.hasFormat("bold"),italic:v.hasFormat("italic"),underline:v.hasFormat("underline"),strikethrough:v.hasFormat("strikethrough"),code:v.hasFormat("code")});let w=v.anchor.getNode(),A=null;for(;w;){if(ve(w)){const C=w.getListType();A=C==="bullet"||C==="number"?C:null;break}if(Se(w)){w=w.getParent();continue}w=w.getParent()}u(A)})}),[s]);const p=b=>{s.dispatchCommand(Cn,b)},g=()=>{c!=="bullet"?s.dispatchCommand(p1,void 0):s.dispatchCommand(Wf,void 0)},m=()=>{c!=="number"?s.dispatchCommand(m1,void 0):s.dispatchCommand(Wf,void 0)},y=()=>{s.update(()=>{const b=Z();if(!$(b))return;["bold","italic","underline","strikethrough","code"].forEach(w=>{b.hasFormat(w)&&s.dispatchCommand(Cn,w)})})};return x.jsxs("div",{className:_e("flex items-center w-full",r?"justify-between":"justify-end"),children:[x.jsxs("div",{className:"flex items-center gap-1",children:[x.jsx(ff,{placement:"top-start",minWidth:"fit-content",title:"text formatting menu",trigger:x.jsx(je,{category:"link",size:"smallCollapse",color:"gray400",children:x.jsx(ke,{icon:PS})}),children:x.jsxs("ul",{className:"flex items-start flex-col",children:[x.jsx("li",{className:"flex items-center w-full",children:x.jsxs("button",{type:"button",title:"Bold",onClick:()=>p("bold"),className:_e("cursor-pointer w-full h-full justify-start text-left p-2 hover:bg-gray-100",a.bold?"text-white bg-primary-600 hover:bg-primary-700":"text-gray-400 hover:text-gray-400"),children:[x.jsx(ke,{icon:kS,className:"mr-2"}),"Bold"]})}),x.jsx("li",{className:"flex items-center w-full",children:x.jsxs("button",{type:"button",title:"Italic",onClick:()=>p("italic"),className:_e("cursor-pointer w-full h-full justify-start text-left p-2 hover:bg-gray-100",a.italic?"text-white bg-primary-600 hover:bg-primary-700":"text-gray-400 hover:text-gray-400"),children:[x.jsx(ke,{icon:ES,className:"mr-2"}),"Italic"]})}),x.jsx("li",{className:"flex items-center w-full",children:x.jsxs("button",{type:"button",title:"Underline",onClick:()=>p("underline"),className:_e("cursor-pointer w-full h-full justify-start text-left p-2 hover:bg-gray-100",a.underline?"text-white bg-primary-600 hover:bg-primary-700":"text-gray-400 hover:text-gray-400"),children:[x.jsx(ke,{icon:AS,className:"mr-2"}),"Underline"]})}),x.jsx("li",{className:"flex items-center w-full",children:x.jsxs("button",{type:"button",title:"Strikethrough",onClick:()=>p("strikethrough"),className:_e("cursor-pointer w-full h-full justify-start text-left p-2 hover:bg-gray-100",a.strikethrough?"text-white bg-primary-600 hover:bg-primary-700":"text-gray-400 hover:text-gray-400"),children:[x.jsx(ke,{icon:wS,className:"mr-2"}),"Strikethrough"]})}),x.jsx("li",{className:"flex items-center w-full",children:x.jsxs("button",{type:"button",title:"Monospace",onClick:()=>p("code"),className:_e("cursor-pointer w-full h-full justify-start text-left p-2 hover:bg-gray-100",a.code?"text-white bg-primary-600 hover:bg-primary-700":"text-gray-400 hover:text-gray-400"),children:[x.jsx(ke,{icon:TS,className:"mr-2"}),"Monospace"]})}),x.jsx("hr",{className:"w-full border-gray-200"}),x.jsx("li",{className:"flex items-center w-full",children:x.jsxs("button",{type:"button",title:"Clear formatting",onClick:y,className:"cursor-pointer w-full h-full justify-start text-left p-2 text-gray-400 hover:text-gray-400 hover:bg-gray-100",children:[x.jsx(ke,{icon:_S,className:"mr-2"}),"Clear formatting"]})})]})}),x.jsx(je,{category:"link",size:"smallCollapse",color:"gray400",title:"Format bullet list",onClick:g,children:x.jsx(ke,{icon:MS})}),x.jsx(je,{category:"link",size:"smallCollapse",color:"gray400",title:"Format numbered list",onClick:m,children:x.jsx(ke,{icon:SS})}),x.jsx(je,{category:"link",size:"smallCollapse",color:"gray400",title:"Format link",onClick:()=>{o(!0),s.dispatchCommand($i,"https://")},children:x.jsx(ke,{icon:OS})}),i&&x.jsxs(x.Fragment,{children:[x.jsx(je,{category:"link",size:"smallCollapse",color:"gray400",title:"Add image",className:"border-l-1 border-gray-200 rounded-none",onClick:()=>{var b;(b=f.current)==null||b.click()},children:x.jsx(ke,{icon:CS})}),x.jsx(je,{category:"link",size:"smallCollapse",color:"gray400",title:"Add file",onClick:()=>{var b;(b=d.current)==null||b.click()},children:x.jsx(ke,{icon:NS})})]}),n&&x.jsx(ff,{placement:"top-end",title:"comment type menu",trigger:x.jsx(je,{category:"link",size:"smallCollapse",className:`${h.iconColor} border-l-1 border-gray-200 rounded-none`,children:x.jsx(ke,{icon:h.icon})}),children:x.jsx("ul",{className:"flex items-center justify-between gap-2 p-3",children:y1.map(b=>x.jsx("li",{children:x.jsx(je,{category:"link",size:"none",title:b.title,className:_e(b.color,e===b.type?b.color:"text-gray-400"),onClick:()=>t==null?void 0:t(b.type),children:x.jsx(ke,{icon:b.icon})})},b.type))})})]}),r,x.jsx("input",{type:"file",hidden:!0,id:"image-input",multiple:!0,ref:f,accept:"image/*",onChange:b=>{const v=b.target.files;v&&(i==null||i(v))}}),x.jsx("input",{type:"file",hidden:!0,id:"file-input",multiple:!0,ref:d,accept:"*",onChange:b=>{const v=b.target.files;v&&(i==null||i(v))}})]})}function r5({hasStrictIndent:e=!1}){const[t]=ht();return T.useEffect(()=>{if(!t.hasNodes([sa,ts]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[t]),T.useEffect(()=>{if(e)return ZN(t)},[t,e]),(function(n){T.useEffect(()=>GN(n),[n])})(t),null}function o5({validateUrl:e,attributes:t}){const[n]=ht();return T.useEffect(()=>{if(!n.hasNodes([Ho]))throw new Error("LinkPlugin: LinkNode not registered on editor")}),T.useEffect(()=>t5(n,Gx({attributes:t,validateUrl:e})),[n,e,t]),null}const i5=new Set(["http:","https:","mailto:","sms:","tel:"]);function qg(e){try{const t=new URL(e);if(!i5.has(t.protocol))return"about:blank"}catch{return e}return e}function Vg(e,t,n,r=10,o=5){const i=n.parentElement;if(e===null||!i){t.style.opacity="0",t.style.transform="translate(-10000px, -10000px)";return}const s=t.getBoundingClientRect(),a=n.getBoundingClientRect(),l=i.getBoundingClientRect();let c=e.top-r,u=e.left-o;c<l.top&&(c+=s.height+e.height+r*2),u+s.width>l.right&&(u=l.right-s.width-o),c-=a.top,u-=a.left,t.style.opacity="1",t.style.transform=`translate(${u}px, ${c}px)`}function wl(e){const t=e.anchor,n=e.focus,r=e.anchor.getNode(),o=e.focus.getNode();return r===o?r:e.isBackward()?gg(n)?r:o:gg(t)?r:o}function s5({editor:e,isLink:t,setIsLink:n,anchorElem:r,isLinkEditMode:o,setIsLinkEditMode:i}){const s=T.useRef(null),[a,l]=T.useState(""),[c,u]=T.useState("https://"),[f,d]=T.useState(null),h=T.useCallback(()=>{var A,C;const m=Z();if($(m)){const _=wl(m),E=at(_,ut);E?l(E.getURL()):ut(_)?l(_.getURL()):l(""),o&&u(a)}else if(ot(m)){const _=m.getNodes();if(_.length>0){const E=_[0],N=E.getParent();ut(N)?l(N.getURL()):ut(E)?l(E.getURL()):l(""),o&&u(a)}}const y=s.current,b=en(e._window),v=document.activeElement;if(y===null)return;const w=e.getRootElement();if(m!==null&&w!==null&&e.isEditable()){let _;if(ot(m)){const E=m.getNodes();if(E.length>0){const N=e.getElementByKey(E[0].getKey());N&&(_=N.getBoundingClientRect())}}else b!==null&&w.contains(b.anchorNode)&&(_=(C=(A=b.focusNode)==null?void 0:A.parentElement)==null?void 0:C.getBoundingClientRect());_&&(_.y+=40,Vg(_,y,r)),d(m)}else(!v||v.className!=="link-input")&&(w!==null&&Vg(null,y,r),d(null),i(!1),l(""));return!0},[r,e,i,o,a]);T.useEffect(()=>{const m=r.parentElement,y=()=>{e.getEditorState().read(()=>{h()})};return window.addEventListener("resize",y),m&&m.addEventListener("scroll",y),()=>{window.removeEventListener("resize",y),m&&m.removeEventListener("scroll",y)}},[r.parentElement,e,h]),T.useEffect(()=>fn(e.registerUpdateListener(({editorState:m})=>{m.read(()=>{h()})}),e.registerCommand(Ql,()=>(h(),!0),Gn),e.registerCommand(Rd,()=>t?(n(!1),!0):!1,o6)),[e,h,n,t]),T.useEffect(()=>{e.getEditorState().read(()=>{h()})},[e,h]),T.useEffect(()=>{const m=s.current;if(m===null)return;const y=b=>{!m.contains(b.relatedTarget)&&t&&(n(!1),i(!1))};return m.addEventListener("focusout",y),()=>{m.removeEventListener("focusout",y)}},[n,i,t]);const p=m=>{m.key==="Enter"?g(m):m.key==="Escape"&&(m.preventDefault(),i(!1))},g=m=>{m.preventDefault(),f!==null&&(a!==""&&e.update(()=>{e.dispatchCommand($i,qg(c));const y=Z();if($(y)){const b=wl(y).getParent();if(so(b)){const v=ko(b.getURL(),{rel:b.__rel,target:b.__target,title:b.__title});b.replace(v,!0)}}}),u("https://"),i(!1))};return x.jsx("div",{ref:s,className:"absolute flex top-0 left-0 shadow-lg bg-white z-10 rounded-sm w-full max-w-400",children:t?o?x.jsxs("div",{className:"flex justify-between w-full items-center p-2",children:[x.jsx(Ny,{containerClassName:"px-0 mr-2",autoFocus:!0,className:"mt-0",value:c,onChange:m=>{u(m.target.value)},onKeyDown:m=>{p(m)}}),x.jsxs("div",{className:"flex justify-center items-center gap-4",children:[x.jsx(je,{size:"none",category:"link",color:"gray400",tabIndex:0,onMouseDown:m=>m.preventDefault(),onClick:()=>{i(!1)},children:x.jsx(ke,{icon:Dl})}),x.jsx(je,{size:"none",category:"link",color:"gray400",tabIndex:0,onMouseDown:m=>m.preventDefault(),onClick:g,children:x.jsx(ke,{icon:zy})})]})]}):x.jsxs("div",{className:"flex justify-between w-full items-center p-2",children:[x.jsx("a",{href:qg(a),target:"_blank",rel:"noopener noreferrer",children:a}),x.jsxs("div",{className:"flex items-center gap-4",children:[x.jsx(je,{size:"none",category:"link",color:"gray400",tabIndex:0,onMouseDown:m=>m.preventDefault(),onClick:()=>{u(a),i(!0)},children:x.jsx(ke,{icon:Qk})}),x.jsx(je,{size:"none",category:"link",color:"gray400",tabIndex:0,onMouseDown:m=>m.preventDefault(),onClick:()=>e.dispatchCommand($i,null),children:x.jsx(ke,{icon:sC})})]})]}):null})}function a5(e,t,n,r){const[o,i]=T.useState(e),[s,a]=T.useState(!1);return T.useEffect(()=>{function l(){const c=Z();if($(c)){const u=wl(c),f=at(u,ut),d=at(u,so);if(!(f||d)){a(!1);return}const h=c.getNodes().filter(p=>!xo(p)).find(p=>{const g=at(p,ut),m=at(p,so);return f&&!f.is(g)||g&&!g.is(f)||d&&!d.is(m)||m&&(!m.is(d)||m.getIsUnlinked())});a(!h)}else if(ot(c)){const u=c.getNodes();if(u.length===0){a(!1);return}const f=u[0],d=f.getParent();ut(d)||ut(f)?a(!0):a(!1)}}return fn(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{l()})}),e.registerCommand(Ql,(c,u)=>(l(),i(u),!1),hx),e.registerCommand(Md,c=>{const u=Z();if($(u)){const f=wl(u),d=at(f,ut);if(ut(d)&&(c.metaKey||c.ctrlKey))return window.open(d.getURL(),"_blank"),!0}return!1},Gn))},[e]),Nn.createPortal(x.jsx(s5,{editor:o,isLink:s,anchorElem:t,setIsLink:a,isLinkEditMode:n,setIsLinkEditMode:r}),t)}function l5({anchorElem:e=document.body,isLinkEditMode:t,setIsLinkEditMode:n}){const[r]=ht();return a5(r,e,t,n)}const c5=({url:e,onDelete:t})=>x.jsxs("div",{className:"relative",children:[x.jsx("img",{src:e,alt:"Thumbnail",width:75,height:75,className:"w-[75px] h-[75px] object-cover rounded-lg border border-gray-200"}),x.jsx(je,{size:"smallCollapse",title:"Delete attachment",onClick:t,className:"absolute top-1 left-1 w-[20px] h-[20px] rounded-full",color:"secondary",children:x.jsx(ke,{icon:jy})})]}),u5=({onRemoveFile:e,type:t,label:n})=>{const r=t.toLowerCase(),o=Ib(r);return x.jsxs("div",{className:"relative flex items-center justify-center rounded border border-gray-200",children:[x.jsx(je,{size:"smallCollapse",color:"secondary",className:"absolute top-1 left-1 w-[20px] h-[20px] rounded-full",title:"Remove file",onClick:e,children:x.jsx(ke,{icon:jy})}),x.jsxs("div",{className:"flex items-center justify-center mx-2",children:[x.jsx("span",{className:"text-primary-600 my-2",children:x.jsx(ke,{icon:o,size:"3x",className:"text-primary-600"})}),x.jsx("span",{className:"font-bold p-2",children:n})]})]})},f5=({clearKey:e})=>{const[t]=ht(),n=T.useRef(e);return T.useEffect(()=>{n.current!==e&&(t.update(()=>{We().clear()}),n.current=e)},[e,t]),null},d5=({isOpen:e})=>{const[t]=ht(),n=T.useRef(!1);return T.useEffect(()=>{if(!e){n.current=!1;return}if(n.current)return;const r=()=>{const o=t.getRootElement();if(!o){requestAnimationFrame(r);return}n.current=!0;const i=window.scrollX,s=window.scrollY;try{o.focus({preventScroll:!0})}catch{o.focus()}requestAnimationFrame(()=>window.scrollTo(i,s)),setTimeout(()=>window.scrollTo(i,s),0)};r()},[t,e]),null},h5=({initialValue:e})=>{const[t]=ht(),n=T.useCallback((o,i)=>{const a=new DOMParser().parseFromString(i,"text/html");return t1(o,a)},[]),r=T.useRef(!1);return T.useEffect(()=>{!r.current&&e&&(t.update(()=>{We().clear(),sx(n(t,e))}),r.current=!0)},[t,e,n]),null},p5=({onChange:e})=>{const[t]=ht();return x.jsx(DN,{onChange:n=>{n.read(()=>{const r=n1(t,null);e(r)})}})},m5=({onAddAttachments:e})=>{const[t]=ht();return T.useEffect(()=>{if(!e)return;const n=t.getRootElement();if(!n)return;const r=o=>{const i=o.clipboardData;if(!i)return;const s=i.items;let a=!1;for(let l=0;l<s.length;l++){const c=s[l];if(c.kind==="file"&&c.type.startsWith("image/")){a=!0;break}}if(a){for(let l=0;l<s.length;l++){const c=s[l];if(c.kind==="file"&&c.type.startsWith("image/")){const u=c.getAsFile();if(u){const f=Date.now(),d=u.type.split("/")[1]||"png",h=`image_${f}.${d}`,p=new File([u],h,{type:u.type});e==null||e([p])}}}o.preventDefault(),o.stopPropagation()}};return n.addEventListener("paste",r,!0),()=>{n.removeEventListener("paste",r,!0)}},[t,e]),null},g5=({onSubmit:e})=>{const[t]=ht();return T.useEffect(()=>{if(e)return t.registerCommand(Fs,n=>n&&!n.shiftKey?(n.preventDefault(),e(),!0):!1,1)},[t,e]),null},y5=({setIsLinkEditMode:e})=>{const[t]=ht();return T.useEffect(()=>{const n=t.getRootElement();if(!n)return;const r=o=>{const i=o.metaKey||o.ctrlKey,s=o.key==="k"||o.key==="K";i&&s&&t.getEditorState().read(()=>{const a=Z();$(a)&&!a.isCollapsed()&&(o.preventDefault(),e(!0),t.dispatchCommand($i,"https://"))})};return n.addEventListener("keydown",r),()=>{n.removeEventListener("keydown",r)}},[t,e]),null};function g1({attachments:e,clearKey:t=0,inputFieldClassName:n="",containerClassName:r="",initialValue:o,onChange:i,commentType:s,onCommentTypeChange:a,isCommentTypeEditable:l=!0,actions:c,onAddAttachments:u,onRemoveAttachment:f,onSubmit:d,isOpen:h}){const p={namespace:"comment-editor",theme:UN,nodes:[sa,ts,Ho],onError:A=>{console.error(A)}},[g,m]=T.useState(null),[y,b]=T.useState(!1),v=A=>{A!==null&&m(A)},w=uh[s];return x.jsx("div",{className:r,children:x.jsxs(L6,{initialConfig:p,children:[x.jsxs("div",{className:"relative",children:[x.jsx(_N,{contentEditable:x.jsx("div",{ref:v,children:x.jsx(MN,{className:_e("p-3 outline-none border-0 w-full border-t border-gray-200 rounded-none border-l-3",w.bg,w.border,w.fontColor,n)})}),placeholder:x.jsx("div",{className:"absolute top-3 left-4 text-gray-400 pointer-events-none",children:"Type comment…"}),ErrorBoundary:$N}),x.jsx(r5,{}),x.jsx(o5,{}),g&&x.jsx(l5,{anchorElem:g,isLinkEditMode:y,setIsLinkEditMode:b}),x.jsx(NN,{}),x.jsx(h5,{initialValue:o}),x.jsx(p5,{onChange:i}),x.jsx(g5,{onSubmit:d}),x.jsx(y5,{setIsLinkEditMode:b}),x.jsx(f5,{clearKey:t}),x.jsx(m5,{onAddAttachments:u}),x.jsx(d5,{isOpen:h})]}),e&&e.length>0&&x.jsx("div",{className:"flex flex-wrap justify-start gap-2 p-4",children:e.map(A=>md(A.type)?x.jsx(c5,{url:A.url,onDelete:()=>f==null?void 0:f(A.originFile)},A.originFile.name):x.jsx(u5,{type:A.type,label:A.name,onRemoveFile:()=>f==null?void 0:f(A.originFile)},A.originFile.name))}),x.jsx("div",{className:"border-t border-gray-200 p-2 flex justify-end",children:x.jsx(n5,{commentType:s,onCommentTypeChange:a,isCommentTypeEditable:l,actions:c,setIsLinkEditMode:b,onAddAttachments:u})})]})})}const b5=({asset:e,onSetActiveSrc:t})=>x.jsxs("div",{className:"relative border border-gray-200 rounded-md h-[110px] w-full hover:border-primary-500",children:[x.jsx("img",{src:za(e),onClick:()=>t(za(e)),onKeyDown:n=>{n.key==="Enter"&&t(za(e))},alt:e.name,className:"w-full h-full object-cover rounded-md object-center cursor-zoom-in"}),(e==null?void 0:e.uploading)&&x.jsx("div",{className:"absolute bottom-2 w-full max-w-md mx-auto px-2",children:x.jsx("div",{className:"relative h-2 overflow-hidden rounded-full bg-gray-200",children:x.jsx("div",{className:"absolute left-0 top-0 h-full w-1/3 rounded-full bg-blue-500 animate-progress"})})})]}),v5=({asset:e})=>{var r,o;const t=((o=(r=e==null?void 0:e.mimeType)==null?void 0:r.split("/").pop())==null?void 0:o.toLowerCase())||"",n=Ib(t);return x.jsxs("div",{className:"flex gap-2",children:[(e==null?void 0:e.uploading)&&x.jsx("div",{className:"flex items-center justify-center",children:x.jsx("div",{className:"h-4 w-4 rounded-full border-2 border-gray-300 border-t-blue-500 animate-spin"})}),x.jsx(ke,{icon:n,size:"lg",className:"text-primary-600"}),x.jsx("a",{href:za(e),className:"text-sm text-blue-600 underline",download:!0,target:"_blank",rel:"noopener noreferrer",children:e.name})]})},x5=({commentType:e=dt.INFO,author:t,username:n,comment:r,createdDate:o,onDelete:i,onEdit:s,hasAssets:a,taskAssets:l,taskVerified:c})=>{const f={[dt.INFO]:{bg:"bg-primary-100",border:"border-primary-200",icon:Dy,iconColor:"text-primary-600 hover:text-primary-600",text:"text-primary-900"},[dt.WARNING]:{bg:"bg-warning-100",border:"border-warning-200",icon:My,iconColor:"text-warning-600 hover:text-warning-600",text:"text-warning-900"},[dt.DANGER]:{bg:"bg-danger-100",border:"border-danger-200",icon:$y,iconColor:"text-danger-600 hover:text-danger-600",text:"text-danger-900"},[dt.SUCCESS]:{bg:"bg-success-100",border:"border-success-200",icon:Ly,iconColor:"text-success-600 hover:text-success-600",text:"text-success-900"}}[e],d=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(o||"")).replace(",",""),[h,p]=T.useState(!1),[g,m]=T.useState(zc(r)),[y,b]=T.useState(e),[v,w]=T.useState(""),A=()=>{p(!0)},C=()=>{const N=of.sanitize(g);s(N,y),p(!1)},_=N=>{const P=of.sanitize(g);b(N),s(P,N),p(!1)},E=()=>{p(!1)};return x.jsxs("div",{className:"flex items-start space-x-4 w-full",children:[x.jsx(KT,{alt:t}),x.jsxs("div",{className:"flex-1 min-w-0",children:[x.jsxs("div",{className:`border ${f.border} rounded-sm ${f.bg} shadow-sm flex flex-col items-start justify-between w-full`,children:[x.jsx("div",{className:"p-3 flex flex-col items-start justify-between w-full",children:x.jsxs("div",{className:"w-full",children:[x.jsxs("div",{className:"flex items-center mb-2 justify-between",children:[x.jsxs("div",{children:[x.jsx(ke,{icon:f.icon,size:"lg",className:`mr-2 ${f.iconColor}`}),x.jsx("span",{className:`font-semibold text-sm ${f.text}`,children:t})]}),x.jsx(qT,{commentType:e,taskVerified:c,isUsernameAuthor:n.trim()===t.trim(),onEdit:A,onSaveCommentType:_,onDelete:i})]}),h?x.jsx(g1,{inputFieldClassName:"bg-white border-0 rounded-sm",containerClassName:"bg-white border-0 rounded-sm",onChange:m,commentType:e,isCommentTypeEditable:!1,initialValue:zc(r),actions:x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(je,{category:"outline",size:"smallCollapse",color:"secondary",onClick:E,title:"Cancel edit",children:"Cancel"}),x.jsx(je,{category:"solid",size:"smallCollapse",color:"primary",onClick:C,title:"Save edit",disabled:$a(g),children:"Save"})]})}):x.jsx("div",{className:`text-sm ${f.text}`,dangerouslySetInnerHTML:{__html:zc(r)}})]})}),a&&l&&(l==null?void 0:l.length)>0&&x.jsx("div",{className:`${f.border} border-t w-full p-2 flex gap-2 flex-wrap`,children:l.map(N=>x.jsx(T.Fragment,{children:md(N.mimeType)?x.jsx(b5,{asset:N,onSetActiveSrc:w}):x.jsx(v5,{asset:N})},N.assetId))})]}),x.jsxs("div",{className:"flex gap-2 my-1",children:[o&&x.jsx("time",{dateTime:o,className:"text-xs text-gray-500 opacity-60",children:d}),c&&x.jsxs("span",{className:"text-xs text-success-600 font-semibold flex items-center gap-1",children:[x.jsx(ke,{icon:Ry}),"Comment Required"]})]})]}),x.jsx(_T,{plugins:[BT],open:!!v,zoom:{maxZoomPixelRatio:2},close:()=>w(""),styles:{root:{zIndex:9999999999}},carousel:{finite:!0,preload:0},controller:{closeOnBackdropClick:!0},slides:[{src:v}]})]})},uh={[dt.INFO]:{icon:cC,bg:"bg-primary-100",border:"border-l-primary-500",iconColor:"text-primary-600 hover:text-primary-700",fontColor:"text-primary-900"},[dt.WARNING]:{icon:Gk,bg:"bg-warning-100",border:"border-l-warning-500",iconColor:"text-warning-600 hover:text-warning-700",fontColor:"text-warning-900"},[dt.DANGER]:{icon:dC,bg:"bg-danger-100",border:"border-l-danger-500",iconColor:"text-danger-600 hover:text-danger-700",fontColor:"text-danger-900"},[dt.SUCCESS]:{icon:Ry,bg:"bg-success-100",border:"border-l-success-500",iconColor:"text-success-600 hover:text-success-700",fontColor:"text-success-900"}},y1=Object.entries(uh).map(([e,t])=>({type:e,icon:t.icon,color:t.iconColor,title:`Change comment type to ${e}`})),w5=({comments:e,onClose:t,isOpen:n,taskName:r,taskInstanceId:o,isLoading:i,playbookInstanceId:s,taskVerification:a})=>{const[l,c]=T.useState(""),[u,f]=T.useState(dt.INFO),[d,h]=T.useState(0),[p,g]=T.useState([]),m=T.useRef(null),{username:y}=b1(),{manageComment:b}=h4({playbookInstanceId:s}),v=()=>{const P=p.length,W=p.some(z=>!md(z.mimeType))?"Attachment":"Image",j=P>1?"s":"";return`<p class="m-0"><span style="white-space: pre-wrap;">${W}${j} added.</span></p>`},w=P=>{const I=Array.from(P).map((W,j)=>o4(W,p.length+j+1));g(W=>[...W,...I])},A=P=>{g(I=>I.filter(W=>W.originFile!==P))},C=P=>{f(P)},_=async()=>{if(!p.length&&$a(l)||!o)return;p.length>0&&g([]);const P=of.sanitize(l);c(""),h(I=>I+1),await b({action:"add",comment:p.length>0&&$a(l)?v():P,username:y||"",commentType:u,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,hasAssets:p.length>0,taskInstanceId:o,taskVerified:a,attachments:p}),f(dt.INFO)},E=async P=>{o&&await b({username:y||"",action:"delete",taskVerified:!1,taskInstanceId:o,commentId:P})},N=async({commentId:P,comment:I,commentType:W,hasAssets:j,isAlreadyVerified:z})=>{o&&await b({action:"edit",username:y||"",...I&&{comment:I},taskInstanceId:o,commentId:P,hasAssets:j,taskVerified:z,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,commentType:W})};return T.useLayoutEffect(()=>{m.current&&n&&!i&&e.length>0&&(m.current.scrollTop=m.current.scrollHeight)},[n,i,e.length]),x.jsxs("div",{className:_e("transition-all duration-300 fixed bg-white right-0 bottom-0 h-[100vh] z-[9999999998] flex flex-col min-w-[270px] max-w-[420px] w-[calc(100vw-1rem)] border border-gray-200 rounded-t-sm overflow-hidden",n?"translate-y-0 opacity-100":"translate-y-full opacity-0 pointer-events-none"),children:[x.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-gray-200 px-2 py-4 w-full",children:[x.jsx("h6",{className:"font-semibold text-gray-900 truncate max-w-[300px]",children:r}),x.jsx(je,{color:"grayLight",size:"smallCollapse",rounded:"none",title:"Close comment box",onClick:t,children:x.jsx(ke,{icon:Dl,className:"size-4 text-gray-300"})})]}),x.jsxs("div",{ref:m,className:"flex flex-col flex-1 overflow-y-auto",children:[x.jsxs("div",{className:"flex flex-col justify-end flex-1 gap-4 p-4 pb-[102px]",children:[i&&x.jsx("div",{className:"flex flex-col gap-3",children:[1,2,3].map(P=>x.jsx("div",{className:"h-16 animate-pulse rounded-lg bg-gray-100"},P))}),(e==null?void 0:e.length)>0&&!i&&e.map(P=>x.jsx(x5,{username:y||"",onDelete:()=>E(P.commentId),onEdit:(I,W)=>N({commentId:P.commentId,comment:I,commentType:W,hasAssets:P.hasAssets,isAlreadyVerified:P.taskVerified}),...P},P.commentId)),(e==null?void 0:e.length)===0&&!i&&x.jsxs("div",{className:"flex flex-1 flex-col items-center justify-end gap-3 text-center mb-1",children:[x.jsx("img",{src:n4,className:"opacity-70",alt:"Empty"}),x.jsx("p",{className:"text-gray-400",children:"There is no discussion in this Task."})]})]}),x.jsx(g1,{attachments:p,onChange:c,containerClassName:"fixed bottom-0 left-0 right-0 bg-white",clearKey:d,commentType:u,onCommentTypeChange:C,onAddAttachments:w,onRemoveAttachment:A,onSubmit:_,isOpen:n,actions:x.jsx(je,{category:"link",size:"normalCollapse",title:"Send comment",onClick:_,disabled:$a(l)&&p.length===0,children:x.jsx(ke,{icon:IS})})})]})]})},A5=Cl.replace(/:root,\s*:host/g,":host"),Kf=T.createContext({comments:[],openTaskDetails:null,username:void 0,setOpenTaskDetails:()=>{},prefetchQuery:e=>{}}),b1=()=>{if(!T.useContext(Kf))throw new Error("useCommentContext must be used within a CommentProvider");return T.useContext(Kf)},k5=({playbookInstanceId:e,children:t,username:n})=>{const[r,o]=T.useState({taskInstanceId:null,taskName:"",taskVerification:!1}),{taskInstanceId:i,taskName:s,taskVerification:a}=r||{taskInstanceId:null,taskName:"",taskVerification:!1},{comments:l,isLoading:c,prefetchQuery:u}=c4({taskInstanceId:i||0,enabled:i!==null,username:n});return x.jsxs(Kf.Provider,{value:{comments:l,openTaskDetails:r,setOpenTaskDetails:o,prefetchQuery:u,username:n},children:[t,Nn.createPortal(x.jsxs("div",{id:"cnfdnc-comment-box-root",children:[x.jsx("style",{children:A5}),x.jsx("div",{className:"confidence-playbook",children:x.jsx(w5,{playbookInstanceId:e,comments:l,onClose:()=>o(null),isOpen:!!i,taskName:s,taskInstanceId:i,isLoading:c,taskVerification:a})})]}),LS)]})},C5={[Be.OPEN]:"border-[#C1C5C8] bg-[#F0F1F2]",[Be.IN_PROGRESS]:"bg-[#E6F2FF] border-[#94C8FF]",[Be.IN_REVIEW]:"bg-[#EAF6EC] border-[#A5DAB1]",[Be.COMPLETED]:"bg-[#EAF6EC] border-[#A5DAB1]"},Bn={PHOTO:"photo",SCREENSHOT:"screenshot",COMMENT:"comment",NO_VERIFICATION:null},_5=({task:e,step:t,playbookType:n,onButtonClick:r,viewMode:o="card",canStart:i=!1,isExpanded:s=!1,toggleExpanded:a,playbookId:l,taskStyle:c,listStickyTopBase:u})=>{const[f,d]=T.useState(!1),{taskDetails:h,prefetchQuery:p}=DE({taskId:e.taskId,playbookId:l,enabled:s}),{setOpenTaskDetails:g,prefetchQuery:m}=b1(),{buttons:y}=Bw({taskStatus:e.workflowStatus,canStart:i}),b=T.useMemo(()=>e.imageRequired===0?Bn.NO_VERIFICATION:e.imageRequired===1?Bn.SCREENSHOT:e.imageRequired===2?Bn.PHOTO:e.imageRequired===4?Bn.COMMENT:null,[e.imageRequired]),v=async w=>{try{d(!0),await r(w)}finally{d(!1)}};if(o==="list"){const w=T.useMemo(()=>e.workflowStatus===Be.COMPLETED?"success":e.workflowStatus===Be.IN_PROGRESS?"primary":"default",[e.workflowStatus]),A=T.useMemo(()=>{const C=[];return y.forEach(_=>{_==="START"&&C.push({id:"START",color:"primary",action:"Start",to:Be.IN_PROGRESS}),_==="COMPLETE"&&(!e.taskVerified&&b===Bn.COMMENT&&C.push({id:"ADD_COMMENT",color:"danger",action:"Add Comment",to:"Required"}),C.push({id:"COMPLETE",color:"success",action:"Complete",to:Be.COMPLETED,disabled:!e.taskVerified&&b===Bn.COMMENT}))}),C},[y,b,e.taskVerified]);return x.jsxs("div",{className:_e("flex flex-col"),children:[x.jsxs("div",{className:_e("flex items-center gap-3 p-2 border-gray-200",e.sequenceOrder>0&&"border-t",s&&"bg-white rounded-md border border-t-none shadow-sm sticky"),style:{top:s?u:0},children:[x.jsx("div",{className:"text-gray-200 text-base",children:e.sequenceOrder+1}),x.jsx("div",{onClick:()=>{a==null||a(!s)},onMouseOver:p,className:_e("flex-1 truncate cursor-pointer",s&&"font-medium",e.workflowStatus===Be.COMPLETED&&"text-secondary-400 line-through"),style:{color:e.workflowStatus===Be.IN_PROGRESS&&(c==null?void 0:c.titleColor)||"#1C232D"},children:e.taskInstanceName}),x.jsx(hS,{taskVerified:e.taskVerified,verificationType:b,title:e.workflowStatus,variant:w,transitions:A,onClick:C=>{if(C===ui.ADD_COMMENT){g({taskInstanceId:e.taskInstanceId,taskName:e.taskInstanceName,taskVerification:!0});return}r(C)}}),x.jsx(Yp,{onMouseOver:()=>m(e.taskInstanceId),commentsCount:(e==null?void 0:e.numberOfComments)||0,commentType:(e==null?void 0:e.recentCommentType)||dt.INFO,onClick:()=>g({taskInstanceId:e.taskInstanceId,taskName:e.taskInstanceName,taskVerification:!1})})]}),(h==null?void 0:h.description)&&x.jsx("div",{className:_e(!s&&"hidden","border-gray-200 border p-2 mx-4 mb-4 border-t-none -mt-[1px] bg-gray-100 rounded-b-md"),children:x.jsx(Vp,{description:(h==null?void 0:h.description)||""})})]})}return x.jsxs("div",{className:Es("flex items-stretch rounded-sm overflow-hidden border",C5[e.workflowStatus]),children:[x.jsx(yS,{playbookType:n,status:e.workflowStatus,step:t}),x.jsxs("div",{className:"flex w-full flex-col overflow-x-hidden flex-1 p-2",children:[n==="Sequential"&&x.jsx("div",{className:"-mb-3 self-end pr-2 pt-2",children:x.jsx(vS,{status:e.workflowStatus})}),x.jsxs("div",{className:"space-y-2 divide-y divide-black/10 flex flex-col flex-1",children:[x.jsx("div",{className:_e("text-lg font-medium flex-1 pb-1"),style:{color:e.workflowStatus==="Completed"?"#1C232D":(c==null?void 0:c.titleColor)||"#1C232D"},children:e.taskInstanceName}),b?x.jsxs("div",{className:"flex items-center gap-2 text-sm pb-2",children:[x.jsx(ke,{icon:Iy,className:"size-4"}),x.jsxs("div",{children:[x.jsx("span",{className:"font-medium",children:b===Bn.PHOTO?"Photo":b===Bn.SCREENSHOT?"Screenshot":"Comment"})," ","required"]})]}):x.jsx(x.Fragment,{})]}),(h==null?void 0:h.description)&&x.jsx("div",{className:_e(!s&&"hidden"),children:x.jsx(Vp,{description:(h==null?void 0:h.description)||""})}),(y.length>0||e.hasDescription)&&x.jsxs("div",{className:"flex items-center justify-end gap-4 border-t border-black/10 pt-2",children:[x.jsx("div",{className:"flex-1",children:x.jsx(FE,{buttons:y,onButtonClick:v,disabled:f})}),x.jsx(Yp,{onMouseOver:()=>m(e.taskInstanceId),commentsCount:(e==null?void 0:e.numberOfComments)||0,commentType:(e==null?void 0:e.recentCommentType)||dt.INFO,onClick:()=>g({taskInstanceId:e.taskInstanceId,taskName:e.taskInstanceName,taskVerification:!1})}),a&&x.jsx(je,{size:"smallCollapse",onMouseOver:p,category:"link",onClick:()=>{a()},title:s?"Hide task description":"Show task description",children:x.jsx(ke,{icon:Fy,className:Es("cursor-pointer text-[#0069D9]",s?"rotate-180":"")})})]})]})]})},v1=T.forwardRef(({title:e,className:t,playbookStyle:n,...r},o)=>{var i,s,a;return x.jsx("div",{ref:o,className:_e("border-b border-gray-200 flex items-center",t),style:{backgroundColor:((i=n==null?void 0:n.whiteLabel)==null?void 0:i.titleBackgroundColor)||"#f8f9fa"},...r,children:x.jsx("div",{className:_e("text-xl min-h-16 p-4 font-medium flex-1",{"text-dark":!((s=n==null?void 0:n.whiteLabel)!=null&&s.titleTextColor)}),style:{color:(a=n==null?void 0:n.whiteLabel)==null?void 0:a.titleTextColor},children:e})})});v1.displayName="PlaybookHeader";const E5=Cl.replace(/:root,\s*:host/g,":host"),S5=({playbookInstanceId:e,playbookMode:t,playbookStyle:n,defaultExpanded:r=!0})=>{const{playbook:o,actions:i}=$w(e);if(!o)return x.jsx("div",{});const s=async(a,l)=>{var c;if(a===ui.COMPLETE){const u=(c=o.tasks.find(f=>f.taskInstanceId===l))==null?void 0:c.sequenceOrder;if(u===void 0){console.error("Task not found in playbook");return}return i.completeTask(l,u)}if(a===ui.START)return i.startTask(l)};return x.jsx("div",{className:"confidence-playbook",children:x.jsx(x1,{playbook:o,playbookMode:t,onTaskButtonClick:s,playbookStyle:n,defaultExpanded:r})})},T5=({className:e,children:t,numberOfTasks:n,playbookMode:r})=>x.jsxs("div",{className:_e("w-full p-4",e),children:[n&&x.jsxs("div",{className:_e(r==="card"&&"mb-4"),children:[x.jsx("span",{className:"font-medium",children:"Tasks"})," (",n,")"]}),x.jsx("div",{className:_e(r==="card"&&"space-y-4"),children:t})]}),x1=({playbook:e,playbookMode:t,onTaskButtonClick:n,playbookStyle:r,defaultExpanded:o=!0})=>{var y,b,v,w,A;const{playbookInstanceName:i,tasks:s}=e,a=T.useRef(null),[l,c]=T.useState(0),[u,f]=T.useState(()=>{const C=M2(e.playbookInstanceId);return C!==null?C:o}),d=()=>{f(C=>{const _=!C;return P2(e.playbookInstanceId,_),_})},{isTaskExpanded:h,toggleTaskExpanded:p,isAtLeastOneTaskExpanded:g}=T0(e.playbookInstanceId,{onTaskExpanded:()=>{var C;c(((C=a.current)==null?void 0:C.offsetHeight)||0)}});T.useEffect(()=>{if(g){if(!a.current)throw new Error("Playbook header ref is not set");new ResizeObserver(_=>{var E;for(const N of _)N.contentRect&&c(((E=a.current)==null?void 0:E.offsetHeight)||0)}).observe(a.current)}return()=>{a.current&&new ResizeObserver(()=>{}).unobserve(a.current)}},[g]);const m=T.useMemo(()=>{const C=s.filter(_=>_.workflowStatus===Be.COMPLETED).sort((_,E)=>E.sequenceOrder-_.sequenceOrder)[0];return C?C.sequenceOrder+1:0},[s]);return x.jsxs("div",{className:_e(!(r!=null&&r.overlay)&&"min-h-screen",(r==null?void 0:r.overlay)&&"fixed bottom-0 z-[9999999997] flex","transition-all duration-300 ease-in-out"),...(r==null?void 0:r.overlay)&&{style:{width:"100%",maxWidth:u?((y=r.overlay.size)==null?void 0:y.width)||450:"0rem",height:((b=r.overlay.size)==null?void 0:b.height)||"calc(100vh - 4rem)",maxHeight:"calc(100vh - 4rem)",right:((v=r.overlay.offset)==null?void 0:v.right)!==void 0?r.overlay.offset.right:r.overlay.position==="right"?32:void 0,left:((w=r.overlay.offset)==null?void 0:w.left)!==void 0?r.overlay.offset.left:r.overlay.position==="left"?32:void 0}},children:[(r==null?void 0:r.overlay)&&x.jsx("div",{onClick:d,className:_e("size-9 absolute -left-9 p-1 top-3 z-[9999999997] border-none rounded-l-sm cursor-pointer"),style:{backgroundColor:((A=r==null?void 0:r.whiteLabel)==null?void 0:A.primaryColor)||"#007BFF",boxShadow:"0px 3px 3px 0px #00000040"},children:x.jsx("img",{src:h0,alt:"Confidence Logo",className:"w-full h-full object-contain"})}),x.jsxs("div",{className:_e("flex flex-col flex-1 bg-gray-50",(r==null?void 0:r.overlay)&&"border border-gray-200 shadow-2xl rounded-t-sm overflow-y-auto"),children:[x.jsx(v1,{title:i,className:_e("top-0 sticky z-2"),playbookStyle:r,ref:a}),x.jsx(T5,{playbookMode:t,numberOfTasks:e.numberofTasks,children:s.map((C,_)=>{var E;return x.jsx(_5,{task:C,step:_+1,viewMode:t,playbookId:e.playbookId,canStart:C.sequenceOrder===m,onButtonClick:N=>n(N,C.taskInstanceId),playbookType:"Non-Sequential",taskStyle:{titleColor:(E=r==null?void 0:r.whiteLabel)==null?void 0:E.primaryColor},isExpanded:h(C.taskInstanceId),toggleExpanded:()=>p(C.taskInstanceId),listStickyTopBase:l||104},C.taskId)})})]})]})},N5=({email:e,playbookId:t,playbookMode:n,playbookStyle:r,bank:o="public-sdk",timezone:i="America/Los_Angeles",persistKey:s,defaultExpanded:a=!0})=>{const[l,c]=T.useState(null);return T.useEffect(()=>{(async()=>{const u=q0(t,s);if(u&&u.email===e){c(u.playbookInstanceId);return}const{playbookInstanceId:f,errorCode:d,details:h,message:p}=await N0({bank:o,email:e,timezone:i,playbookUid:t})||{};if(d)throw new Error(`Error initiating playbook: ${p} (Code: ${d}) - Details: ${h}`);if(!f)throw new Error("No playbook instance ID returned from initiation");H0(t,f,e,s),c(f)})()},[]),l?x.jsx(Hr,{playbookInstanceId:l,playbookMode:n,playbookStyle:r,username:e,defaultExpanded:a}):null},O5=({playbookId:e,playbookMode:t="list",playbookStyle:n,btnLabel:r="Start Playbook",btnColor:o="primary",persistKey:i,defaultExpanded:s=!0})=>{const[a,l]=T.useState(null),[c,u]=T.useState(void 0);return T.useEffect(()=>{const f=q0(e,i);f&&(l(f.playbookInstanceId),u(f.email))},[e,i]),x.jsxs(x.Fragment,{children:[x.jsxs(Al.div,{children:[x.jsx(Wk,{playbookId:e,disabled:!!a,onInitiated:(f,d)=>{H0(e,f,d,i),l(f),u(d)},btnLabel:r,btnColor:o}),x.jsx("style",{type:"text/css",children:E5})]}),a&&x.jsx(Hr,{playbookInstanceId:a,playbookMode:t,playbookStyle:n,username:c,defaultExpanded:s})]})},Hr=({playbookInstanceId:e,playbookMode:t,playbookStyle:n,username:r,defaultExpanded:o=!0})=>(console.log("Starting ConfidencePlaybook with instance ID:",e,r),x.jsx(E0,{children:x.jsx(k5,{playbookInstanceId:e,username:r,children:x.jsx(S5,{playbookInstanceId:e,playbookMode:t,playbookStyle:n,defaultExpanded:o})})}));Hr.Context=E0;Hr.View=x1;Hr.AutoInstantiated=N5;Hr.WithInstantiateButton=O5;const w1=Cl.replace(/:root,\s*:host/g,":host"),A1=e=>Nn.createPortal(x.jsxs(Al.div,{style:{position:"relative",zIndex:2147483646},children:[x.jsx("style",{children:w1}),x.jsx(Hr,{...e})]}),document.body),P5=e=>Nn.createPortal(x.jsxs(Al.div,{style:{position:"relative",zIndex:2147483646},children:[x.jsx("style",{children:w1}),x.jsx(Hr.AutoInstantiated,{...e})]}),document.body);A1.AutoInstantiated=P5;exports.ConfidencePlaybook=A1;
|
|
606
|
+
`?c.insertParagraph():u===" "?c.insertNodes([ta()]):c.insertText(u)}}}else t.insertRawText(s)}function Eg(e,t,n){e.dispatchCommand(x3,{nodes:t,selection:n})||(n.insertNodes(t),(function(r){if($(r)&&r.isCollapsed()){const o=r.anchor;let i=null;const s=nr(o,"previous");if(s)if(Or(s))i=s.origin;else{const a=Fr(s,un(We(),"next").getFlipped());for(const l of a){if(X(l.origin)){i=l.origin;break}if(R(l.origin)&&!l.origin.isInline())break}}if(i&&X(i)){const a=i.getFormat(),l=i.getStyle();r.format===a&&r.style===l||(r.format=a,r.style=l,r.dirty=!0)}}})(n))}function s1(e,t,n,r=[]){let o=t===null||n.isSelected(t);const i=R(n)&&n.excludeFromCopy("html");let s=n;t!==null&&X(s)&&(s=$x(t,s,"clone"));const a=R(s)?s.getChildren():[],l=(function(c){const u=c.exportJSON(),f=c.constructor;if(u.type!==f.getType()&&vl(58,f.name),R(c)){const d=u.children;Array.isArray(d)||vl(59,f.name)}return u})(s);X(s)&&s.getTextContentSize()===0&&(o=!1);for(let c=0;c<a.length;c++){const u=a[c],f=s1(e,t,u,l.children);!o&&R(n)&&f&&n.extractWithChild(u,t,"clone")&&(o=!0)}if(o&&!i)r.push(l);else if(Array.isArray(l.children))for(let c=0;c<l.children.length;c++){const u=l.children[c];r.push(u)}return o}function fN(e,t){const n=[],r=We().getChildren();for(let o=0;o<r.length;o++)s1(e,t,r[o],n);return{namespace:e._config.namespace,nodes:n}}function dN(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n],o=t6(r);X(o)&&z6(o),t.push(o)}return t}let ri=null;async function Sg(e,t,n){if(ri!==null)return!1;if(t!==null)return new Promise((c,u)=>{e.update(()=>{c(Tg(e,t,n))})});const r=e.getRootElement(),o=e._window||window,i=o.document,s=en(o);if(r===null||s===null)return!1;const a=i.createElement("span");a.style.cssText="position: fixed; top: -1000px;",a.append(i.createTextNode("#")),r.append(a);const l=new Range;return l.setStart(a,0),l.setEnd(a,1),s.removeAllRanges(),s.addRange(l),new Promise((c,u)=>{const f=e.registerCommand(Zl,d=>(Sr(d,ClipboardEvent)&&(f(),ri!==null&&(o.clearTimeout(ri),ri=null),c(Tg(e,d,n))),!0),hx);ri=o.setTimeout(()=>{f(),ri=null,c(!1)},50),i.execCommand("copy"),a.remove()})}function Tg(e,t,n){if(n===void 0){const o=en(e._window),i=Z();if(!i||i.isCollapsed()||!o)return!1;const s=o.anchorNode,a=o.focusNode;if(s!==null&&a!==null&&!oa(e,s,a))return!1;n=hN(i)}t.preventDefault();const r=t.clipboardData;return r!==null&&(pN(r,n),!0)}const a1=[["text/html",cN],["application/x-lexical-editor",uN]];function hN(e=Z()){const t={"text/plain":e?e.getTextContent():""};if(e){const n=Jd();for(const[r,o]of a1){const i=o(n,e);i!==null&&(t[r]=i)}}return t}function pN(e,t){for(const[n]of a1)t[n]===void 0&&e.setData(n,"");for(const n in t){const r=t[n];r!==void 0&&e.setData(n,r)}}function Ng(e,t){if(document.caretRangeFromPoint!==void 0){const n=document.caretRangeFromPoint(e,t);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const n=document.caretPositionFromPoint(e,t);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}const Ko=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,mN=Ko&&"documentMode"in document?document.documentMode:null,gN=Ko&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),yN=!(!Ko||!("InputEvent"in window)||mN)&&"getTargetRanges"in new window.InputEvent("input"),bN=Ko&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Og=Ko&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,vN=Ko&&/^(?=.*Chrome).*/i.test(navigator.userAgent),xN=Ko&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&gN&&!vN,Pg=he("DRAG_DROP_PASTE_FILE");function Pa(e){let t=null;if(Sr(e,DragEvent)?t=e.dataTransfer:Sr(e,ClipboardEvent)&&(t=e.clipboardData),t===null)return[!1,[],!1];const n=t.types,r=n.includes("Files"),o=n.includes("text/html")||n.includes("text/plain");return[r,Array.from(t.files),o]}function Mg(e){const t=Z();if(!$(t))return!1;const n=new Set,r=t.getNodes();for(let o=0;o<r.length;o++){const i=r[o],s=i.getKey();if(n.has(s))continue;const a=at(i,c=>R(c)&&!c.isInline());if(a===null)continue;const l=a.getKey();a.canIndent()&&!n.has(l)&&(n.add(l),e(a))}return n.size>0}function Ig(e){const t=Fi(e);return Te(t)}function su(e){for(const t of["lowercase","uppercase","capitalize"])e.hasFormat(t)&&e.toggleFormat(t)}function wN(e){return fn(e.registerCommand(Md,t=>{const n=Z();return!!ot(n)&&(n.clear(),!0)},we),e.registerCommand(bo,t=>{const n=Z();return $(n)?(n.deleteCharacter(t),!0):!!ot(n)&&(n.deleteNodes(),!0)},we),e.registerCommand(Rs,t=>{const n=Z();return!!$(n)&&(n.deleteWord(t),!0)},we),e.registerCommand(Ds,t=>{const n=Z();return!!$(n)&&(n.deleteLine(t),!0)},we),e.registerCommand(gi,t=>{const n=Z();if(typeof t=="string")n!==null&&n.insertText(t);else{if(n===null)return!1;const r=t.dataTransfer;if(r!=null)_g(r,n,e);else if($(n)){const o=t.data;return o&&n.insertText(o),!0}}return!0},we),e.registerCommand(xf,()=>{const t=Z();return!!$(t)&&(t.removeText(),!0)},we),e.registerCommand(Cn,t=>{const n=Z();return!!$(n)&&(n.formatText(t),!0)},we),e.registerCommand(_3,t=>{const n=Z();if(!$(n)&&!ot(n))return!1;const r=n.getNodes();for(const o of r){const i=at(o,s=>R(s)&&!s.isInline());i!==null&&i.setFormat(t)}return!0},we),e.registerCommand(mi,t=>{const n=Z();return!!$(n)&&(n.insertLineBreak(t),!0)},we),e.registerCommand(Ls,()=>{const t=Z();return!!$(t)&&(t.insertParagraph(),!0)},we),e.registerCommand(k3,()=>(sx([ta()]),!0),we),e.registerCommand(C3,()=>Mg(t=>{const n=t.getIndent();t.setIndent(n+1)}),we),e.registerCommand(Mm,()=>Mg(t=>{const n=t.getIndent();n>0&&t.setIndent(Math.max(0,n-1))}),we),e.registerCommand(Iv,t=>{const n=Z();if(ot(n)){const r=n.getNodes();if(r.length>0)return t.preventDefault(),r[0].selectPrevious(),!0}else if($(n)){const r=If(n.focus,!0);if(!t.shiftKey&&Te(r)&&!r.isIsolated()&&!r.isInline())return r.selectPrevious(),t.preventDefault(),!0}return!1},we),e.registerCommand(Lv,t=>{const n=Z();if(ot(n)){const r=n.getNodes();if(r.length>0)return t.preventDefault(),r[0].selectNext(0,0),!0}else if($(n)){if((function(o){const i=o.focus;return i.key==="root"&&i.offset===We().getChildrenSize()})(n))return t.preventDefault(),!0;const r=If(n.focus,!1);if(!t.shiftKey&&Te(r)&&!r.isIsolated()&&!r.isInline())return r.selectNext(),t.preventDefault(),!0}return!1},we),e.registerCommand(Mv,t=>{const n=Z();if(ot(n)){const r=n.getNodes();if(r.length>0)return t.preventDefault(),mg(r[0])?r[0].selectNext(0,0):r[0].selectPrevious(),!0}if(!$(n))return!1;if(yg(n,!0)){const r=t.shiftKey;return t.preventDefault(),bg(n,r,!0),!0}return!1},we),e.registerCommand(Pv,t=>{const n=Z();if(ot(n)){const o=n.getNodes();if(o.length>0)return t.preventDefault(),mg(o[0])?o[0].selectPrevious():o[0].selectNext(0,0),!0}if(!$(n))return!1;const r=t.shiftKey;return!!yg(n,!1)&&(t.preventDefault(),bg(n,r,!1),!0)},we),e.registerCommand(Dv,t=>{if(Ig(t.target))return!1;const n=Z();if($(n)){if((function(r){if(!r.isCollapsed())return!1;const{anchor:o}=r;if(o.offset!==0)return!1;const i=o.getNode();if(Ye(i))return!1;const s=K6(i);return s.getIndent()>0&&(s.is(i)||i.is(s.getFirstDescendant()))})(n))return t.preventDefault(),e.dispatchCommand(Mm,void 0);if(Og&&navigator.language==="ko-KR")return!1}else if(!ot(n))return!1;return t.preventDefault(),e.dispatchCommand(bo,!0)},we),e.registerCommand(Fv,t=>{if(Ig(t.target))return!1;const n=Z();return!(!$(n)&&!ot(n))&&(t.preventDefault(),e.dispatchCommand(bo,!1))},we),e.registerCommand(Fs,t=>{const n=Z();if(!$(n))return!1;if(su(n),t!==null){if((Og||bN||xN)&&yN)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(mi,!1)}return e.dispatchCommand(Ls,void 0)},we),e.registerCommand(Rd,()=>{const t=Z();return!!$(t)&&(e.blur(),!0)},we),e.registerCommand(zv,t=>{const[,n]=Pa(t);if(n.length>0){const o=Ng(t.clientX,t.clientY);if(o!==null){const{offset:i,node:s}=o,a=Fi(s);if(a!==null){const l=rx();if(X(a))l.anchor.set(a.getKey(),i,"text"),l.focus.set(a.getKey(),i,"text");else{const u=a.getParentOrThrow().getKey(),f=a.getIndexWithinParent()+1;l.anchor.set(u,f,"element"),l.focus.set(u,f,"element")}const c=Ri(l);Pt(c)}e.dispatchCommand(Pg,n)}return t.preventDefault(),!0}const r=Z();return!!$(r)},we),e.registerCommand($v,t=>{const[n]=Pa(t),r=Z();return!(n&&!$(r))},we),e.registerCommand(Uv,t=>{const[n]=Pa(t),r=Z();if(n&&!$(r))return!1;const o=Ng(t.clientX,t.clientY);if(o!==null){const i=Fi(o.node);Te(i)&&t.preventDefault()}return!0},we),e.registerCommand(wf,()=>(u6(),!0),we),e.registerCommand(Zl,t=>(Sg(e,Sr(t,ClipboardEvent)?t:null),!0),we),e.registerCommand(Dd,t=>((async function(n,r){await Sg(r,Sr(n,ClipboardEvent)?n:null),r.update(()=>{const o=Z();$(o)?o.removeText():ot(o)&&o.getNodes().forEach(i=>i.remove())})})(t,e),!0),we),e.registerCommand(Gl,t=>{const[,n,r]=Pa(t);return n.length>0&&!r?(e.dispatchCommand(Pg,n),!0):Xi(t.target)&&Hd(t.target)?!1:Z()!==null&&((function(o,i){o.preventDefault(),i.update(()=>{const s=Z(),a=Sr(o,InputEvent)||Sr(o,KeyboardEvent)?null:o.clipboardData;a!=null&&s!==null&&_g(a,s,i)},{tag:z3})})(t,e),!0)},we),e.registerCommand(Rv,t=>{const n=Z();return $(n)&&su(n),!1},we),e.registerCommand(jv,t=>{const n=Z();return $(n)&&su(n),!1},we))}function AN(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);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.`)}const lh=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?T.useLayoutEffect:T.useEffect;function kN({editor:e,ErrorBoundary:t}){return(function(n,r){const[o,i]=T.useState(()=>n.getDecorators());return lh(()=>n.registerDecoratorListener(s=>{Nn.flushSync(()=>{i(s)})}),[n]),T.useEffect(()=>{i(n.getDecorators())},[n]),T.useMemo(()=>{const s=[],a=Object.keys(o);for(let l=0;l<a.length;l++){const c=a[l],u=x.jsx(r,{onError:d=>n._onError(d),children:x.jsx(T.Suspense,{fallback:null,children:o[c]})}),f=n.getElementByKey(c);f!==null&&s.push(Nn.createPortal(u,f,c))}return s},[r,o,n])})(e,t)}function CN({editor:e,ErrorBoundary:t}){return(function(n){const r=vi.maybeFromEditor(n);if(r&&r.hasExtensionByName(rN.name)){for(const o of["@lexical/plain-text","@lexical/rich-text"])r.hasExtensionByName(o)&&AN(320,o);return!0}return!1})(e)?null:x.jsx(kN,{editor:e,ErrorBoundary:t})}function Lg(e){return e.getEditorState().read(e1(e.isComposing()))}function _N({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){const[r]=ht();return(function(o){lh(()=>fn(wN(o),aN(o)),[o])})(r),x.jsxs(x.Fragment,{children:[e,x.jsx(EN,{content:t}),x.jsx(CN,{editor:r,ErrorBoundary:n})]})}function EN({content:e}){const[t]=ht(),n=(function(o){const[i,s]=T.useState(()=>Lg(o));return lh(()=>{function a(){const l=Lg(o);s(l)}return a(),fn(o.registerUpdateListener(()=>{a()}),o.registerEditableListener(()=>{a()}))},[o]),i})(t),r=F6();return n?typeof e=="function"?e(r):e:null}function SN(e,t,n,r,o){if(e===null||n.size===0&&r.size===0&&!o)return 0;const i=t._selection,s=e._selection;if(o)return 1;if(!($(i)&&$(s)&&s.isCollapsed()&&i.isCollapsed()))return 0;const a=(function(y,b,v){const w=y._nodeMap,A=[];for(const C of b){const _=w.get(C);_!==void 0&&A.push(_)}for(const[C,_]of v){if(!_)continue;const E=w.get(C);E===void 0||Ye(E)||A.push(E)}return A})(t,n,r);if(a.length===0)return 0;if(a.length>1){const y=t._nodeMap,b=y.get(i.anchor.key),v=y.get(s.anchor.key);return b&&v&&!e._nodeMap.has(b.__key)&&X(b)&&b.__text.length===1&&i.anchor.offset===1?2:0}const l=a[0],c=e._nodeMap.get(l.__key);if(!X(c)||!X(l)||c.__mode!==l.__mode)return 0;const u=c.__text,f=l.__text;if(u===f)return 0;const d=i.anchor,h=s.anchor;if(d.key!==h.key||d.type!=="text")return 0;const p=d.offset,g=h.offset,m=f.length-u.length;return m===1&&g===p-1?2:m===-1&&g===p+1?3:m===-1&&g===p?4:0}function TN(e,t){let n=Date.now(),r=0;return(o,i,s,a,l,c)=>{const u=Date.now();if(c.has(Nf))return r=0,n=u,2;const f=SN(o,i,a,l,e.isComposing()),d=(()=>{const h=s===null||s.editor===e,p=c.has(j3);if(!p&&h&&c.has(vo))return 0;if(o===null)return 1;const g=i._selection;if(!(a.size>0||l.size>0))return g!==null?0:2;const m=typeof t=="number"?t:t.peek();return p===!1&&f!==0&&f===r&&u<n+m&&h||a.size===1&&(function(y,b,v){const w=b._nodeMap.get(y),A=v._nodeMap.get(y),C=b._selection,_=v._selection;return!($(C)&&$(_)&&C.anchor.type==="element"&&C.focus.type==="element"&&_.anchor.type==="text"&&_.focus.type==="text"||!X(w)||!X(A)||w.__parent!==A.__parent)&&JSON.stringify(b.read(()=>w.exportJSON()))===JSON.stringify(v.read(()=>A.exportJSON()))})(Array.from(a)[0],o,i)?0:1})();return n=u,r=f,d}}function Rg(e){e.undoStack=[],e.redoStack=[],e.current=null}function l1(e,t,n){const r=TN(e,n);return fn(e.registerCommand(Id,()=>((function(i,s){const a=s.redoStack,l=s.undoStack;if(l.length!==0){const c=s.current,u=l.pop();c!==null&&(a.push(c),i.dispatchCommand(Aa,!0)),l.length===0&&i.dispatchCommand(ka,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:Nf})}})(e,t),!0),we),e.registerCommand(Ld,()=>((function(i,s){const a=s.redoStack,l=s.undoStack;if(a.length!==0){const c=s.current;c!==null&&(l.push(c),i.dispatchCommand(ka,!0));const u=a.pop();a.length===0&&i.dispatchCommand(Aa,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:Nf})}})(e,t),!0),we),e.registerCommand(S3,()=>(Rg(t),!1),we),e.registerCommand(T3,()=>(Rg(t),e.dispatchCommand(Aa,!1),e.dispatchCommand(ka,!1),!0),we),e.registerUpdateListener(({editorState:i,prevEditorState:s,dirtyLeaves:a,dirtyElements:l,tags:c})=>{const u=t.current,f=t.redoStack,d=t.undoStack,h=u===null?null:u.editorState;if(u!==null&&i===h)return;const p=r(s,i,u,a,l,c);if(p===1)f.length!==0&&(t.redoStack=[],e.dispatchCommand(Aa,!1)),u!==null&&(d.push({...u}),e.dispatchCommand(ka,!0));else if(p===2)return;t.current={editor:e,editorState:i}}))}function c1(){return{current:null,redoStack:[],undoStack:[]}}const au={build:(e,{delay:t,createInitialHistoryState:n,disabled:r})=>Gx({delay:t,disabled:r,historyState:n(e)}),config:{createInitialHistoryState:c1,delay:300,disabled:typeof window>"u"},name:"@lexical/history/History",register:(e,t,n)=>{const r=n.getOutput();return $s(()=>r.disabled.value?void 0:l1(e,r.historyState.value,r.delay))}};P6(au,{createInitialHistoryState:()=>{throw new Error("SharedHistory did not inherit parent history")},disabled:!0});function NN({delay:e,externalHistoryState:t}){const[n]=ht();return(function(r,o,i=1e3){const s=T.useMemo(()=>o||c1(),[o]);T.useEffect(()=>l1(r,s,i),[i,r,s])})(n,t,e),null}const u1=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?T.useLayoutEffect:T.useEffect;function ON({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:r,ariaDescribedBy:o,ariaErrorMessage:i,ariaExpanded:s,ariaInvalid:a,ariaLabel:l,ariaLabelledBy:c,ariaMultiline:u,ariaOwns:f,ariaRequired:d,autoCapitalize:h,className:p,id:g,role:m="textbox",spellCheck:y=!0,style:b,tabIndex:v,"data-testid":w,...A},C){const[_,E]=T.useState(e.isEditable()),N=T.useCallback(I=>{I&&I.ownerDocument&&I.ownerDocument.defaultView?e.setRootElement(I):e.setRootElement(null)},[e]),P=T.useMemo(()=>(function(...I){return W=>{for(const j of I)typeof j=="function"?j(W):j!=null&&(j.current=W)}})(C,N),[N,C]);return u1(()=>(E(e.isEditable()),e.registerEditableListener(I=>{E(I)})),[e]),x.jsx("div",{"aria-activedescendant":_?t:void 0,"aria-autocomplete":_?n:"none","aria-controls":_?r:void 0,"aria-describedby":o,...i!=null?{"aria-errormessage":i}:{},"aria-expanded":_&&m==="combobox"?!!s:void 0,...a!=null?{"aria-invalid":a}:{},"aria-label":l,"aria-labelledby":c,"aria-multiline":u,"aria-owns":_?f:void 0,"aria-readonly":!_||void 0,"aria-required":d,autoCapitalize:h,className:p,contentEditable:_,"data-testid":w,id:g,ref:P,role:m,spellCheck:y,style:b,tabIndex:v,...A})}const PN=T.forwardRef(ON);function Dg(e){return e.getEditorState().read(e1(e.isComposing()))}const MN=T.forwardRef(IN);function IN(e,t){const{placeholder:n,...r}=e,[o]=ht();return x.jsxs(x.Fragment,{children:[x.jsx(PN,{editor:o,...r,ref:t}),n!=null&&x.jsx(LN,{editor:o,content:n})]})}function LN({content:e,editor:t}){const n=(function(s){const[a,l]=T.useState(()=>Dg(s));return u1(()=>{function c(){const u=Dg(s);l(u)}return c(),fn(s.registerUpdateListener(()=>{c()}),s.registerEditableListener(()=>{c()}))},[s]),a})(t),[r,o]=T.useState(t.isEditable());if(T.useLayoutEffect(()=>(o(t.isEditable()),t.registerEditableListener(s=>{o(s)})),[t]),!n)return null;let i=null;return typeof e=="function"?i=e(r):e!==null&&(i=e),i===null?null:x.jsx("div",{"aria-hidden":!0,children:i})}const RN=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?T.useLayoutEffect:T.useEffect;function DN({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){const[r]=ht();return RN(()=>{if(n)return r.registerUpdateListener(({editorState:o,dirtyElements:i,dirtyLeaves:s,prevEditorState:a,tags:l})=>{t&&i.size===0&&s.size===0||e&&l.has(vo)||a.isEmpty()||n(o,r,l)})},[r,e,t,n]),null}const FN=T.createContext(null),lu={didCatch:!1,error:null};class jN extends T.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=lu}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(...t){var r,o;const{error:n}=this.state;n!==null&&((o=(r=this.props).onReset)==null||o.call(r,{args:t,reason:"imperative-api"}),this.setState(lu))}componentDidCatch(t,n){var r,o;(o=(r=this.props).onError)==null||o.call(r,t,n)}componentDidUpdate(t,n){var i,s;const{didCatch:r}=this.state,{resetKeys:o}=this.props;r&&n.error!==null&&zN(t.resetKeys,o)&&((s=(i=this.props).onReset)==null||s.call(i,{next:o,prev:t.resetKeys,reason:"keys"}),this.setState(lu))}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:o}=this.props,{didCatch:i,error:s}=this.state;let a=t;if(i){const l={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")a=n(l);else if(r)a=T.createElement(r,l);else if(o!==void 0)a=o;else throw s}return T.createElement(FN.Provider,{value:{didCatch:i,error:s,resetErrorBoundary:this.resetErrorBoundary}},a)}}function zN(e=[],t=[]){return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}function $N({children:e,onError:t}){return x.jsx(jN,{fallback:x.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}const UN={paragraph:"m-0",list:{ol:"list-decimal pl-4",ul:"list-disc pl-4"},text:{bold:"font-semibold",italic:"italic",underline:"underline",strikethrough:"line-through",code:"font-mono"},link:"text-blue-600 hover:text-blue-600 underline cursor-pointer"};function Tr(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);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 Uf(e){let t=1,n=e.getParent();for(;n!=null;){if(Se(n)){const r=n.getParent();if(ve(r)){t++,n=r.getParent();continue}Tr(40)}return t}return t}function Bf(e){let t=e.getParent();ve(t)||Tr(40);let n=t;for(;n!==null;)n=n.getParent(),ve(n)&&(t=n);return t}function f1(e){let t=[];const n=e.getChildren().filter(Se);for(let r=0;r<n.length;r++){const o=n[r],i=o.getFirstChild();ve(i)?t=t.concat(f1(i)):t.push(o)}return t}function wn(e){return Se(e)&&ve(e.getFirstChild())}function Fg(e){return Zt().append(e)}function d1(e,t){return Se(e)&&(t.length===0||t.length===1&&e.is(t[0])&&e.getChildrenSize()===0)}function jg(e){const t=Z();if(t!==null){let n=t.getNodes();if($(t)){const o=t.getStartEndPoints();o===null&&Tr(143);const[i]=o,s=i.getNode(),a=s.getParent();if(jt(s)){const l=s.getFirstChild();if(l)n=l.selectStart().getNodes();else{const c=Tt();s.append(c),n=c.select().getNodes()}}else if(d1(s,n)){const l=Bt(e);if(jt(a)){s.replace(l);const c=Zt();R(s)&&(c.setFormat(s.getFormatType()),c.setIndent(s.getIndent())),l.append(c)}else if(Se(s)){const c=s.getParentOrThrow();Uo(l,c.getChildren()),c.replace(l)}return}}const r=new Set;for(let o=0;o<n.length;o++){const i=n[o];if(R(i)&&i.isEmpty()&&!Se(i)&&!r.has(i.getKey())){zg(i,e);continue}let s=xx(i)?i.getParent():Se(i)&&i.isEmpty()?i:null;for(;s!=null;){const a=s.getKey();if(ve(s)){if(!r.has(a)){const l=Bt(e);Uo(l,s.getChildren()),s.replace(l),r.add(a)}break}{const l=s.getParent();if(jt(l)&&!r.has(a)){r.add(a),zg(s,e);break}s=l}}}}}function Uo(e,t){e.splice(e.getChildrenSize(),0,t)}function zg(e,t){if(ve(e))return e;const n=e.getPreviousSibling(),r=e.getNextSibling(),o=Zt();let i;if(Uo(o,e.getChildren()),ve(n)&&t===n.getListType())n.append(o),ve(r)&&t===r.getListType()&&(Uo(n,r.getChildren()),r.remove()),i=n;else if(ve(r)&&t===r.getListType())r.getFirstChildOrThrow().insertBefore(o),i=r;else{const s=Bt(t);s.append(o),e.replace(s),i=s}return o.setFormat(e.getFormatType()),o.setIndent(e.getIndent()),e.remove(),i}function ch(e,t){const n=e.getLastChild(),r=t.getFirstChild();n&&r&&wn(n)&&wn(r)&&(ch(n.getFirstChild(),r.getFirstChild()),r.remove());const o=t.getChildren();o.length>0&&e.append(...o),t.remove()}function BN(){const e=Z();if($(e)){const t=new Set,n=e.getNodes(),r=e.anchor.getNode();if(d1(r,n))t.add(Bf(r));else for(let o=0;o<n.length;o++){const i=n[o];if(xx(i)){const s=W6(i,ts);s!=null&&t.add(Bf(s))}}for(const o of t){let i=o;const s=f1(o);for(const a of s){const l=Tt().setTextStyle(e.style).setTextFormat(e.format);Uo(l,a.getChildren()),i.insertAfter(l),i=l,a.__key===e.anchor.key&&$o(e.anchor,Yt(un(l,"next"))),a.__key===e.focus.key&&$o(e.focus,Yt(un(l,"next"))),a.remove()}o.remove()}}}function h1(e){const t=e.getListType()!=="check";let n=e.getStart();for(const r of e.getChildren())Se(r)&&(r.getValue()!==n&&r.setValue(n),t&&r.getLatest().__checked!=null&&r.setChecked(void 0),ve(r.getFirstChild())||n++)}function WN(e){const t=new Set;if(wn(e)||t.has(e.getKey()))return;const n=e.getParent(),r=e.getNextSibling(),o=e.getPreviousSibling();if(wn(r)&&wn(o)){const i=o.getFirstChild();if(ve(i)){i.append(e);const s=r.getFirstChild();ve(s)&&(Uo(i,s.getChildren()),r.remove(),t.add(r.getKey()))}}else if(wn(r)){const i=r.getFirstChild();if(ve(i)){const s=i.getFirstChild();s!==null&&s.insertBefore(e)}}else if(wn(o)){const i=o.getFirstChild();ve(i)&&i.append(e)}else if(ve(n)){const i=Zt().setTextFormat(e.getTextFormat()).setTextStyle(e.getTextStyle()),s=Bt(n.getListType()).setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle());i.append(s),s.append(e),o?o.insertAfter(i):r?r.insertBefore(i):n.append(i)}}function KN(e){if(wn(e))return;const t=e.getParent(),n=t?t.getParent():void 0;if(ve(n?n.getParent():void 0)&&Se(n)&&ve(t)){const r=t?t.getFirstChild():void 0,o=t?t.getLastChild():void 0;if(e.is(r))n.insertBefore(e),t.isEmpty()&&n.remove();else if(e.is(o))n.insertAfter(e),t.isEmpty()&&n.remove();else{const i=t.getListType(),s=Zt(),a=Bt(i);s.append(a),e.getPreviousSiblings().forEach(u=>a.append(u));const l=Zt(),c=Bt(i);l.append(c),Uo(c,e.getNextSiblings()),n.insertBefore(s),n.insertAfter(l),n.replace(e)}}}function HN(){const e=Z();if(!$(e)||!e.isCollapsed())return!1;const t=e.anchor.getNode();if(!Se(t)||t.getChildrenSize()!==0)return!1;const n=Bf(t),r=t.getParent();ve(r)||Tr(40);const o=r.getParent();let i;if(jt(o))i=Tt(),n.insertAfter(i);else{if(!Se(o))return!1;i=Zt(),o.insertAfter(i)}i.setTextStyle(e.style).setTextFormat(e.format).select();const s=t.getNextSiblings();if(s.length>0){const a=Bt(r.getListType());if(Se(i)){const l=Zt();l.append(a),i.insertAfter(l)}else i.insertAfter(a);a.append(...s)}return(function(a){let l=a;for(;l.getNextSibling()==null&&l.getPreviousSibling()==null;){const c=l.getParent();if(c==null||!Se(c)&&!ve(c))break;l=c}l.remove()})(t),!0}function xl(...e){const t=[];for(const n of e)if(n&&typeof n=="string")for(const[r]of n.matchAll(/\S+/g))t.push(r);return t}class ts extends Mn{constructor(n=1,r=void 0,o){super(o);D(this,"__value");D(this,"__checked");this.__value=n===void 0?1:n,this.__checked=r}$config(){return this.config("listitem",{$transform:n=>{if(n.__checked==null)return;const r=n.getParent();ve(r)&&r.getListType()!=="check"&&n.getChecked()!=null&&n.setChecked(void 0)},extends:Mn,importDOM:{li:()=>({conversion:qN,priority:0})}})}afterCloneFrom(n){super.afterCloneFrom(n),this.__value=n.__value,this.__checked=n.__checked}createDOM(n){const r=document.createElement("li");return this.updateListItemDOM(null,r,n),r}updateListItemDOM(n,r,o){(function(a,l,c){const u=l.getParent();!ve(u)||u.getListType()!=="check"||ve(l.getFirstChild())?(a.removeAttribute("role"),a.removeAttribute("tabIndex"),a.removeAttribute("aria-checked")):(a.setAttribute("role","checkbox"),a.setAttribute("tabIndex","-1"),c&&l.__checked===c.__checked||a.setAttribute("aria-checked",l.getChecked()?"true":"false"))})(r,this,n),r.value=this.__value,(function(a,l,c){const u=[],f=[],d=l.list,h=d?d.listitem:void 0;let p;if(d&&d.nested&&(p=d.nested.listitem),h!==void 0&&u.push(...xl(h)),d){const g=c.getParent(),m=ve(g)&&g.getListType()==="check",y=c.getChecked();m&&!y||f.push(d.listitemUnchecked),m&&y||f.push(d.listitemChecked),m&&u.push(y?d.listitemChecked:d.listitemUnchecked)}if(p!==void 0){const g=xl(p);c.getChildren().some(m=>ve(m))?u.push(...g):f.push(...g)}f.length>0&&qx(a,...f),u.length>0&&ih(a,...u)})(r,o.theme,this);const i=n?n.__style:"",s=this.__style;i!==s&&(s===""?r.removeAttribute("style"):r.style.cssText=s),(function(a,l,c){const u=pg(l.__textStyle);for(const f in u)a.style.setProperty(`--listitem-marker-${f}`,u[f]);if(c)for(const f in pg(c.__textStyle))f in u||a.style.removeProperty(`--listitem-marker-${f}`)})(r,this,n)}updateDOM(n,r,o){const i=r;return this.updateListItemDOM(n,i,o),!1}updateFromJSON(n){return super.updateFromJSON(n).setValue(n.value).setChecked(n.checked)}exportDOM(n){const r=this.createDOM(n._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(...n){for(let r=0;r<n.length;r++){const o=n[r];if(R(o)&&this.canMergeWith(o)){const i=o.getChildren();this.append(...i),o.remove()}else super.append(o)}return this}replace(n,r){if(Se(n))return super.replace(n);this.setIndent(0);const o=this.getParentOrThrow();if(!ve(o))return n;if(o.__first===this.getKey())o.insertBefore(n);else if(o.__last===this.getKey())o.insertAfter(n);else{const i=Bt(o.getListType());let s=this.getNextSibling();for(;s;){const a=s;s=s.getNextSibling(),i.append(a)}o.insertAfter(n),n.insertAfter(i)}return r&&(R(n)||Tr(139),this.getChildren().forEach(i=>{n.append(i)})),this.remove(),o.getChildrenSize()===0&&o.remove(),n}insertAfter(n,r=!0){const o=this.getParentOrThrow();if(ve(o)||Tr(39),Se(n))return super.insertAfter(n,r);const i=this.getNextSiblings();if(o.insertAfter(n,r),i.length!==0){const s=Bt(o.getListType());i.forEach(a=>s.append(a)),n.insertAfter(s,r)}return n}remove(n){const r=this.getPreviousSibling(),o=this.getNextSibling();super.remove(n),r&&o&&wn(r)&&wn(o)&&(ch(r.getFirstChild(),o.getFirstChild()),o.remove())}insertNewAfter(n,r=!0){const o=Zt().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(o,r),o}collapseAtStart(n){const r=Tt();this.getChildren().forEach(a=>r.append(a));const o=this.getParentOrThrow(),i=o.getParentOrThrow(),s=Se(i);if(o.getChildrenSize()===1)if(s)o.remove(),i.select();else{o.insertBefore(r),o.remove();const a=n.anchor,l=n.focus,c=r.getKey();a.type==="element"&&a.getNode().is(this)&&a.set(c,a.offset,"element"),l.type==="element"&&l.getNode().is(this)&&l.set(c,l.offset,"element")}else o.insertBefore(r),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(n){const r=this.getWritable();return r.__value=n,r}getChecked(){const n=this.getLatest();let r;const o=this.getParent();return ve(o)&&(r=o.getListType()),r==="check"?!!n.__checked:void 0}setChecked(n){const r=this.getWritable();return r.__checked=n,r}toggleChecked(){const n=this.getWritable();return n.setChecked(!n.__checked)}getIndent(){const n=this.getParent();if(n===null||!this.isAttached())return this.getLatest().__indent;let r=n.getParentOrThrow(),o=0;for(;Se(r);)r=r.getParentOrThrow().getParentOrThrow(),o++;return o}setIndent(n){typeof n!="number"&&Tr(117),(n=Math.floor(n))>=0||Tr(199);let r=this.getIndent();for(;r!==n;)r<n?(WN(this),r++):(KN(this),r--);return this}canInsertAfter(n){return Se(n)}canReplaceWith(n){return Se(n)}canMergeWith(n){return Se(n)||Bd(n)}extractWithChild(n,r){if(!$(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 Bt("bullet")}canMergeWhenEmpty(){return!0}}function qN(e){if(e.classList.contains("task-list-item")){for(const n of e.children)if(n.tagName==="INPUT")return $g(n)}if(e.classList.contains("joplin-checkbox")){for(const n of e.children)if(n.classList.contains("checkbox-wrapper")&&n.children.length>0&&n.children[0].tagName==="INPUT")return $g(n.children[0])}const t=e.getAttribute("aria-checked");return{node:Zt(t==="true"||t!=="false"&&void 0)}}function $g(e){return e.getAttribute("type")!=="checkbox"?{node:null}:{node:Zt(e.hasAttribute("checked"))}}function Zt(e){return Kr(new ts(void 0,e))}function Se(e){return e instanceof ts}class sa extends Mn{constructor(n="number",r=1,o){super(o);D(this,"__tag");D(this,"__start");D(this,"__listType");const i=YN[n]||n;this.__listType=i,this.__tag=i==="number"?"ol":"ul",this.__start=r}$config(){return this.config("list",{$transform:n=>{(function(r){const o=r.getNextSibling();ve(o)&&r.getListType()===o.getListType()&&ch(r,o)})(n),h1(n)},extends:Mn,importDOM:{ol:()=>({conversion:Bg,priority:0}),ul:()=>({conversion:Bg,priority:0})}})}afterCloneFrom(n){super.afterCloneFrom(n),this.__listType=n.__listType,this.__tag=n.__tag,this.__start=n.__start}getTag(){return this.getLatest().__tag}setListType(n){const r=this.getWritable();return r.__listType=n,r.__tag=n==="number"?"ol":"ul",r}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(n){const r=this.getWritable();return r.__start=n,r}createDOM(n,r){const o=this.__tag,i=document.createElement(o);return this.__start!==1&&i.setAttribute("start",String(this.__start)),i.__lexicalListType=this.__listType,Ug(i,n.theme,this),i}updateDOM(n,r,o){return n.__tag!==this.__tag||n.__listType!==this.__listType||(Ug(r,o.theme,this),!1)}updateFromJSON(n){return super.updateFromJSON(n).setListType(n.listType).setStart(n.start)}exportDOM(n){const r=this.createDOM(n._config,n);return pt(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(n,r,o){let i=o;for(let s=0;s<o.length;s++){const a=o[s];Se(a)||(i===o&&(i=[...o]),i[s]=Zt().append(!R(a)||ve(a)||a.isInline()?a:rt(a.getTextContent())))}return super.splice(n,r,i)}extractWithChild(n){return Se(n)}}function Ug(e,t,n){const r=[],o=[],i=t.list;if(i!==void 0){const s=i[`${n.__tag}Depth`]||[],a=Uf(n)-1,l=a%s.length,c=s[l],u=i[n.__tag];let f;const d=i.nested,h=i.checklist;if(d!==void 0&&d.list&&(f=d.list),u!==void 0&&r.push(u),h!==void 0&&n.__listType==="check"&&r.push(h),c!==void 0){r.push(...xl(c));for(let p=0;p<s.length;p++)p!==l&&o.push(n.__tag+p)}if(f!==void 0){const p=xl(f);a>1?r.push(...p):o.push(...p)}}o.length>0&&qx(e,...o),r.length>0&&ih(e,...r)}function VN(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n];if(Se(r)){t.push(r);const o=r.getChildren();o.length>1&&o.forEach(i=>{ve(i)&&t.push(Fg(i))})}else t.push(Fg(r))}return t}function Bg(e){const t=e.nodeName.toLowerCase();let n=null;return t==="ol"?n=Bt("number",e.start):t==="ul"&&(n=(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(pt(o)&&o.hasAttribute("aria-checked"))return!0;return!1})(e)?Bt("check"):Bt("bullet")),{after:VN,node:n}}const YN={ol:"number",ul:"bullet"};function Bt(e="number",t=1){return Kr(new sa(e,t))}function ve(e){return e instanceof sa}const QN=he("UPDATE_LIST_START_COMMAND"),p1=he("INSERT_UNORDERED_LIST_COMMAND"),m1=he("INSERT_ORDERED_LIST_COMMAND"),Wf=he("REMOVE_LIST_COMMAND");function GN(e){return fn(e.registerCommand(m1,()=>(jg("number"),!0),Gn),e.registerCommand(QN,t=>{const{listNodeKey:n,newStart:r}=t,o=Xe(n);return!!ve(o)&&(o.getListType()==="number"&&(o.setStart(r),h1(o)),!0)},Gn),e.registerCommand(p1,()=>(jg("bullet"),!0),Gn),e.registerCommand(Wf,()=>(BN(),!0),Gn),e.registerCommand(Ls,()=>HN(),Gn),e.registerNodeTransform(ts,t=>{const n=t.getFirstChild();if(n){if(X(n)){const r=n.getStyle(),o=n.getFormat();t.getTextStyle()!==r&&t.setTextStyle(r),t.getTextFormat()!==o&&t.setTextFormat(o)}}else{const r=Z();$(r)&&(r.style!==t.getTextStyle()||r.format!==t.getTextFormat())&&r.isCollapsed()&&t.is(r.anchor.getNode())&&t.setTextStyle(r.style).setTextFormat(r.format)}}),e.registerNodeTransform(Br,t=>{const n=t.getParent();if(Se(n)&&t.is(n.getFirstChild())){const r=t.getStyle(),o=t.getFormat();r===n.getTextStyle()&&o===n.getTextFormat()||n.setTextStyle(r).setTextFormat(o)}}))}function ZN(e){const t=n=>{const r=n.getParent();if(ve(n.getFirstChild())||!ve(r))return;const o=at(n,i=>Se(i)&&ve(i.getParent())&&Se(i.getPreviousSibling()));if(o===null&&n.getIndent()>0)n.setIndent(0);else if(Se(o)){const i=o.getPreviousSibling();if(Se(i)){const s=(function(l){let c=l,u=c.getFirstChild();for(;ve(u);){const f=u.getLastChild();if(!Se(f))break;c=f,u=c.getFirstChild()}return c})(i),a=s.getParent();if(ve(a)){const l=Uf(a);l+1<Uf(r)&&n.setIndent(l)}}}};return e.registerNodeTransform(sa,n=>{const r=[n];for(;r.length>0;){const o=r.shift();if(ve(o)){for(const i of o.getChildren())if(Se(i)){t(i);const s=i.getFirstChild();ve(s)&&r.push(s)}}}})}const JN=new Set(["http:","https:","mailto:","sms:","tel:"]);class Ho extends Mn{constructor(n="",r={},o){super(o);D(this,"__url");D(this,"__target");D(this,"__rel");D(this,"__title");const{target:i=null,rel:s=null,title:a=null}=r;this.__url=n,this.__target=i,this.__rel=s,this.__title=a}static getType(){return"link"}static clone(n){return new Ho(n.__url,{rel:n.__rel,target:n.__target,title:n.__title},n.__key)}createDOM(n){const r=document.createElement("a");return this.updateLinkDOM(null,r,n),ih(r,n.theme.link),r}updateLinkDOM(n,r,o){if(Nx(r)){n&&n.__url===this.__url||(r.href=this.sanitizeUrl(this.__url));for(const i of["target","rel","title"]){const s=`__${i}`,a=this[s];n&&n[s]===a||(a?r[i]=a:r.removeAttribute(i))}}}updateDOM(n,r,o){return this.updateLinkDOM(n,r,o),!1}static importDOM(){return{a:n=>({conversion:XN,priority:1})}}static importJSON(n){return ko().updateFromJSON(n)}updateFromJSON(n){return super.updateFromJSON(n).setURL(n.url).setRel(n.rel||null).setTarget(n.target||null).setTitle(n.title||null)}sanitizeUrl(n){n=Hg(n);try{const r=new URL(Hg(n));if(!JN.has(r.protocol))return"about:blank"}catch{return n}return n}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(n){const r=this.getWritable();return r.__url=n,r}getTarget(){return this.getLatest().__target}setTarget(n){const r=this.getWritable();return r.__target=n,r}getRel(){return this.getLatest().__rel}setRel(n){const r=this.getWritable();return r.__rel=n,r}getTitle(){return this.getLatest().__title}setTitle(n){const r=this.getWritable();return r.__title=n,r}insertNewAfter(n,r=!0){const o=ko(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(o,r),o}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(n,r,o){if(!$(r))return!1;const i=r.anchor.getNode(),s=r.focus.getNode();return this.isParentOf(i)&&this.isParentOf(s)&&r.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function XN(e){let t=null;if(Nx(e)){const n=e.textContent;(n!==null&&n!==""||e.children.length>0)&&(t=ko(e.getAttribute("href")||"",{rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")}))}return{node:t}}function ko(e="",t){return Kr(new Ho(e,t))}function ut(e){return e instanceof Ho}class ic extends Ho{constructor(n="",r={},o){super(n,r,o);D(this,"__isUnlinked");this.__isUnlinked=r.isUnlinked!==void 0&&r.isUnlinked!==null&&r.isUnlinked}static getType(){return"autolink"}static clone(n){return new ic(n.__url,{isUnlinked:n.__isUnlinked,rel:n.__rel,target:n.__target,title:n.__title},n.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(n){const r=this.getWritable();return r.__isUnlinked=n,r}createDOM(n){return this.__isUnlinked?document.createElement("span"):super.createDOM(n)}updateDOM(n,r,o){return super.updateDOM(n,r,o)||n.__isUnlinked!==this.__isUnlinked}static importJSON(n){return Wg().updateFromJSON(n)}updateFromJSON(n){return super.updateFromJSON(n).setIsUnlinked(n.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(n,r=!0){const o=this.getParentOrThrow().insertNewAfter(n,r);if(R(o)){const i=Wg(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return o.append(i),i}return null}}function Wg(e="",t){return Kr(new ic(e,t))}function so(e){return e instanceof ic}const $i=he("TOGGLE_LINK_COMMAND");function Kg(e,t){if(e.type==="element"){const n=e.getNode();return R(n)||(function(r,...o){const i=new URL("https://lexical.dev/docs/error"),s=new URLSearchParams;s.append("code",r);for(const a of o)s.append("v",a);throw i.search=s.toString(),Error(`Minified Lexical error #${r}; visit ${i.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(252),n.getChildren()[e.offset+t]||null}return null}function cu(e,t={}){let n;if(e&&typeof e=="object"){const{url:u,...f}=e;n=u,t={...f,...t}}else n=e;const{target:r,title:o}=t,i=t.rel===void 0?"noreferrer":t.rel,s=Z();if(s===null||!$(s)&&!ot(s))return;if(ot(s)){const u=s.getNodes();return u.length===0?void 0:void u.forEach(f=>{if(n===null){const d=at(f,h=>!so(h)&&ut(h));d&&(d.insertBefore(f),d.getChildren().length===0&&d.remove())}else{const d=at(f,h=>!so(h)&&ut(h));if(d)d.setURL(n),r!==void 0&&d.setTarget(r),i!==void 0&&d.setRel(i);else{const h=ko(n,{rel:i,target:r});f.insertBefore(h),h.append(f)}}})}const a=s.extract();if(n===null){const u=new Set;return void a.forEach(f=>{const d=f.getParent();if(ut(d)&&!so(d)){const h=d.getKey();if(u.has(h))return;(function(p,g){const m=new Set(g.filter(_=>p.isParentOf(_)).map(_=>_.getKey())),y=p.getChildren(),b=y.filter(_=>m.has(_.getKey()));if(b.length===y.length)return y.forEach(_=>p.insertBefore(_)),void p.remove();const v=y.findIndex(_=>m.has(_.getKey())),w=y.findLastIndex(_=>m.has(_.getKey())),A=v===0,C=w===y.length-1;if(A)b.forEach(_=>p.insertBefore(_));else if(C)for(let _=b.length-1;_>=0;_--)p.insertAfter(b[_]);else{for(let E=b.length-1;E>=0;E--)p.insertAfter(b[E]);const _=y.slice(w+1);if(_.length>0){const E=ko(p.getURL(),{rel:p.getRel(),target:p.getTarget(),title:p.getTitle()});b[b.length-1].insertAfter(E),_.forEach(N=>E.append(N))}}})(d,a),u.add(h)}})}const l=new Set,c=u=>{l.has(u.getKey())||(l.add(u.getKey()),u.setURL(n),r!==void 0&&u.setTarget(r),i!==void 0&&u.setRel(i),o!==void 0&&u.setTitle(o))};if(a.length===1){const u=a[0],f=at(u,ut);if(f!==null)return c(f)}(function(u){const f=Z();if(!$(f))return u();const d=Ri(f),h=d.isBackward(),p=Kg(d.anchor,h?-1:0),g=Kg(d.focus,h?0:-1);if(u(),p||g){const m=Z();if($(m)){const y=m.clone();if(p){const b=p.getParent();b&&y.anchor.set(b.getKey(),p.getIndexWithinParent()+(h?1:0),"element")}if(g){const b=g.getParent();b&&y.focus.set(b.getKey(),g.getIndexWithinParent()+(h?0:1),"element")}Pt(Ri(y))}}})(()=>{let u=null;for(const f of a){if(!f.isAttached())continue;const d=at(f,ut);if(d){c(d);continue}if(R(f)){if(!f.isInline())continue;if(ut(f)){if(!(so(f)||u!==null&&u.getParentOrThrow().isParentOf(f))){c(f),u=f;continue}for(const p of f.getChildren())f.insertBefore(p);f.remove();continue}}const h=f.getPreviousSibling();ut(h)&&h.is(u)?h.append(f):(u=ko(n,{rel:i,target:r,title:o}),f.insertAfter(u),u.append(f))}})}const e5=/^\+?[0-9\s()-]{5,}$/;function Hg(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes("@")?`mailto:${e}`:e5.test(e)?`tel:${e}`:`https://${e}`}function t5(e,t){return fn($s(()=>e.registerCommand($i,n=>{const r=t.validateUrl.peek(),o=t.attributes.peek();if(n===null)return cu(null),!0;if(typeof n=="string")return!(r!==void 0&&!r(n))&&(cu(n,o),!0);{const{url:i,target:s,rel:a,title:l}=n;return cu(i,{...o,rel:a,target:s,title:l}),!0}},Gn)),$s(()=>{const n=t.validateUrl.value;if(!n)return;const r=t.attributes.value;return e.registerCommand(Gl,o=>{const i=Z();if(!$(i)||i.isCollapsed()||!Sr(o,ClipboardEvent)||o.clipboardData===null)return!1;const s=o.clipboardData.getData("text");return!!n(s)&&!i.getNodes().some(a=>R(a))&&(e.dispatchCommand($i,{...r,url:s}),o.preventDefault(),!0)},Gn)}))}function n5({commentType:e,onCommentTypeChange:t,isCommentTypeEditable:n=!0,actions:r,setIsLinkEditMode:o,onAddAttachments:i}){const[s]=ht(),[a,l]=T.useState({bold:!1,italic:!1,underline:!1,strikethrough:!1,code:!1}),[c,u]=T.useState(null),f=T.useRef(null),d=T.useRef(null),h=uh[e];T.useLayoutEffect(()=>s.registerUpdateListener(({editorState:b})=>{b.read(()=>{const v=Z();if(!$(v))return;l({bold:v.hasFormat("bold"),italic:v.hasFormat("italic"),underline:v.hasFormat("underline"),strikethrough:v.hasFormat("strikethrough"),code:v.hasFormat("code")});let w=v.anchor.getNode(),A=null;for(;w;){if(ve(w)){const C=w.getListType();A=C==="bullet"||C==="number"?C:null;break}if(Se(w)){w=w.getParent();continue}w=w.getParent()}u(A)})}),[s]);const p=b=>{s.dispatchCommand(Cn,b)},g=()=>{c!=="bullet"?s.dispatchCommand(p1,void 0):s.dispatchCommand(Wf,void 0)},m=()=>{c!=="number"?s.dispatchCommand(m1,void 0):s.dispatchCommand(Wf,void 0)},y=()=>{s.update(()=>{const b=Z();if(!$(b))return;["bold","italic","underline","strikethrough","code"].forEach(w=>{b.hasFormat(w)&&s.dispatchCommand(Cn,w)})})};return x.jsxs("div",{className:_e("flex items-center w-full",r?"justify-between":"justify-end"),children:[x.jsxs("div",{className:"flex items-center gap-1",children:[x.jsx(ff,{placement:"top-start",minWidth:"fit-content",title:"text formatting menu",trigger:x.jsx(je,{category:"link",size:"smallCollapse",color:"gray400",children:x.jsx(ke,{icon:PS})}),children:x.jsxs("ul",{className:"flex items-start flex-col",children:[x.jsx("li",{className:"flex items-center w-full",children:x.jsxs("button",{type:"button",title:"Bold",onClick:()=>p("bold"),className:_e("cursor-pointer w-full h-full justify-start text-left p-2 hover:bg-gray-100",a.bold?"text-white bg-primary-600 hover:bg-primary-700":"text-gray-400 hover:text-gray-400"),children:[x.jsx(ke,{icon:kS,className:"mr-2"}),"Bold"]})}),x.jsx("li",{className:"flex items-center w-full",children:x.jsxs("button",{type:"button",title:"Italic",onClick:()=>p("italic"),className:_e("cursor-pointer w-full h-full justify-start text-left p-2 hover:bg-gray-100",a.italic?"text-white bg-primary-600 hover:bg-primary-700":"text-gray-400 hover:text-gray-400"),children:[x.jsx(ke,{icon:ES,className:"mr-2"}),"Italic"]})}),x.jsx("li",{className:"flex items-center w-full",children:x.jsxs("button",{type:"button",title:"Underline",onClick:()=>p("underline"),className:_e("cursor-pointer w-full h-full justify-start text-left p-2 hover:bg-gray-100",a.underline?"text-white bg-primary-600 hover:bg-primary-700":"text-gray-400 hover:text-gray-400"),children:[x.jsx(ke,{icon:AS,className:"mr-2"}),"Underline"]})}),x.jsx("li",{className:"flex items-center w-full",children:x.jsxs("button",{type:"button",title:"Strikethrough",onClick:()=>p("strikethrough"),className:_e("cursor-pointer w-full h-full justify-start text-left p-2 hover:bg-gray-100",a.strikethrough?"text-white bg-primary-600 hover:bg-primary-700":"text-gray-400 hover:text-gray-400"),children:[x.jsx(ke,{icon:wS,className:"mr-2"}),"Strikethrough"]})}),x.jsx("li",{className:"flex items-center w-full",children:x.jsxs("button",{type:"button",title:"Monospace",onClick:()=>p("code"),className:_e("cursor-pointer w-full h-full justify-start text-left p-2 hover:bg-gray-100",a.code?"text-white bg-primary-600 hover:bg-primary-700":"text-gray-400 hover:text-gray-400"),children:[x.jsx(ke,{icon:TS,className:"mr-2"}),"Monospace"]})}),x.jsx("hr",{className:"w-full border-gray-200"}),x.jsx("li",{className:"flex items-center w-full",children:x.jsxs("button",{type:"button",title:"Clear formatting",onClick:y,className:"cursor-pointer w-full h-full justify-start text-left p-2 text-gray-400 hover:text-gray-400 hover:bg-gray-100",children:[x.jsx(ke,{icon:_S,className:"mr-2"}),"Clear formatting"]})})]})}),x.jsx(je,{category:"link",size:"smallCollapse",color:"gray400",title:"Format bullet list",onClick:g,children:x.jsx(ke,{icon:MS})}),x.jsx(je,{category:"link",size:"smallCollapse",color:"gray400",title:"Format numbered list",onClick:m,children:x.jsx(ke,{icon:SS})}),x.jsx(je,{category:"link",size:"smallCollapse",color:"gray400",title:"Format link",onClick:()=>{o(!0),s.dispatchCommand($i,"https://")},children:x.jsx(ke,{icon:OS})}),i&&x.jsxs(x.Fragment,{children:[x.jsx(je,{category:"link",size:"smallCollapse",color:"gray400",title:"Add image",className:"border-l-1 border-gray-200 rounded-none",onClick:()=>{var b;(b=f.current)==null||b.click()},children:x.jsx(ke,{icon:CS})}),x.jsx(je,{category:"link",size:"smallCollapse",color:"gray400",title:"Add file",onClick:()=>{var b;(b=d.current)==null||b.click()},children:x.jsx(ke,{icon:NS})})]}),n&&x.jsx(ff,{placement:"top-end",title:"comment type menu",trigger:x.jsx(je,{category:"link",size:"smallCollapse",className:`${h.iconColor} border-l-1 border-gray-200 rounded-none`,children:x.jsx(ke,{icon:h.icon})}),children:x.jsx("ul",{className:"flex items-center justify-between gap-2 p-3",children:y1.map(b=>x.jsx("li",{children:x.jsx(je,{category:"link",size:"none",title:b.title,className:_e(b.color,e===b.type?b.color:"text-gray-400"),onClick:()=>t==null?void 0:t(b.type),children:x.jsx(ke,{icon:b.icon})})},b.type))})})]}),r,x.jsx("input",{type:"file",hidden:!0,id:"image-input",multiple:!0,ref:f,accept:"image/*",onChange:b=>{const v=b.target.files;v&&(i==null||i(v))}}),x.jsx("input",{type:"file",hidden:!0,id:"file-input",multiple:!0,ref:d,accept:"*",onChange:b=>{const v=b.target.files;v&&(i==null||i(v))}})]})}function r5({hasStrictIndent:e=!1}){const[t]=ht();return T.useEffect(()=>{if(!t.hasNodes([sa,ts]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[t]),T.useEffect(()=>{if(e)return ZN(t)},[t,e]),(function(n){T.useEffect(()=>GN(n),[n])})(t),null}function o5({validateUrl:e,attributes:t}){const[n]=ht();return T.useEffect(()=>{if(!n.hasNodes([Ho]))throw new Error("LinkPlugin: LinkNode not registered on editor")}),T.useEffect(()=>t5(n,Gx({attributes:t,validateUrl:e})),[n,e,t]),null}const i5=new Set(["http:","https:","mailto:","sms:","tel:"]);function qg(e){try{const t=new URL(e);if(!i5.has(t.protocol))return"about:blank"}catch{return e}return e}function Vg(e,t,n,r=10,o=5){const i=n.parentElement;if(e===null||!i){t.style.opacity="0",t.style.transform="translate(-10000px, -10000px)";return}const s=t.getBoundingClientRect(),a=n.getBoundingClientRect(),l=i.getBoundingClientRect();let c=e.top-r,u=e.left-o;c<l.top&&(c+=s.height+e.height+r*2),u+s.width>l.right&&(u=l.right-s.width-o),c-=a.top,u-=a.left,t.style.opacity="1",t.style.transform=`translate(${u}px, ${c}px)`}function wl(e){const t=e.anchor,n=e.focus,r=e.anchor.getNode(),o=e.focus.getNode();return r===o?r:e.isBackward()?gg(n)?r:o:gg(t)?r:o}function s5({editor:e,isLink:t,setIsLink:n,anchorElem:r,isLinkEditMode:o,setIsLinkEditMode:i}){const s=T.useRef(null),[a,l]=T.useState(""),[c,u]=T.useState("https://"),[f,d]=T.useState(null),h=T.useCallback(()=>{var A,C;const m=Z();if($(m)){const _=wl(m),E=at(_,ut);E?l(E.getURL()):ut(_)?l(_.getURL()):l(""),o&&u(a)}else if(ot(m)){const _=m.getNodes();if(_.length>0){const E=_[0],N=E.getParent();ut(N)?l(N.getURL()):ut(E)?l(E.getURL()):l(""),o&&u(a)}}const y=s.current,b=en(e._window),v=document.activeElement;if(y===null)return;const w=e.getRootElement();if(m!==null&&w!==null&&e.isEditable()){let _;if(ot(m)){const E=m.getNodes();if(E.length>0){const N=e.getElementByKey(E[0].getKey());N&&(_=N.getBoundingClientRect())}}else b!==null&&w.contains(b.anchorNode)&&(_=(C=(A=b.focusNode)==null?void 0:A.parentElement)==null?void 0:C.getBoundingClientRect());_&&(_.y+=40,Vg(_,y,r)),d(m)}else(!v||v.className!=="link-input")&&(w!==null&&Vg(null,y,r),d(null),i(!1),l(""));return!0},[r,e,i,o,a]);T.useEffect(()=>{const m=r.parentElement,y=()=>{e.getEditorState().read(()=>{h()})};return window.addEventListener("resize",y),m&&m.addEventListener("scroll",y),()=>{window.removeEventListener("resize",y),m&&m.removeEventListener("scroll",y)}},[r.parentElement,e,h]),T.useEffect(()=>fn(e.registerUpdateListener(({editorState:m})=>{m.read(()=>{h()})}),e.registerCommand(Ql,()=>(h(),!0),Gn),e.registerCommand(Rd,()=>t?(n(!1),!0):!1,o6)),[e,h,n,t]),T.useEffect(()=>{e.getEditorState().read(()=>{h()})},[e,h]),T.useEffect(()=>{const m=s.current;if(m===null)return;const y=b=>{!m.contains(b.relatedTarget)&&t&&(n(!1),i(!1))};return m.addEventListener("focusout",y),()=>{m.removeEventListener("focusout",y)}},[n,i,t]);const p=m=>{m.key==="Enter"?g(m):m.key==="Escape"&&(m.preventDefault(),i(!1))},g=m=>{m.preventDefault(),f!==null&&(a!==""&&e.update(()=>{e.dispatchCommand($i,qg(c));const y=Z();if($(y)){const b=wl(y).getParent();if(so(b)){const v=ko(b.getURL(),{rel:b.__rel,target:b.__target,title:b.__title});b.replace(v,!0)}}}),u("https://"),i(!1))};return x.jsx("div",{ref:s,className:"absolute flex top-0 left-0 shadow-lg bg-white z-10 rounded-sm w-full max-w-400",children:t?o?x.jsxs("div",{className:"flex justify-between w-full items-center p-2",children:[x.jsx(Ny,{containerClassName:"px-0 mr-2",autoFocus:!0,className:"mt-0",value:c,onChange:m=>{u(m.target.value)},onKeyDown:m=>{p(m)}}),x.jsxs("div",{className:"flex justify-center items-center gap-4",children:[x.jsx(je,{size:"none",category:"link",color:"gray400",tabIndex:0,onMouseDown:m=>m.preventDefault(),onClick:()=>{i(!1)},children:x.jsx(ke,{icon:Dl})}),x.jsx(je,{size:"none",category:"link",color:"gray400",tabIndex:0,onMouseDown:m=>m.preventDefault(),onClick:g,children:x.jsx(ke,{icon:zy})})]})]}):x.jsxs("div",{className:"flex justify-between w-full items-center p-2",children:[x.jsx("a",{href:qg(a),target:"_blank",rel:"noopener noreferrer",children:a}),x.jsxs("div",{className:"flex items-center gap-4",children:[x.jsx(je,{size:"none",category:"link",color:"gray400",tabIndex:0,onMouseDown:m=>m.preventDefault(),onClick:()=>{u(a),i(!0)},children:x.jsx(ke,{icon:Qk})}),x.jsx(je,{size:"none",category:"link",color:"gray400",tabIndex:0,onMouseDown:m=>m.preventDefault(),onClick:()=>e.dispatchCommand($i,null),children:x.jsx(ke,{icon:sC})})]})]}):null})}function a5(e,t,n,r){const[o,i]=T.useState(e),[s,a]=T.useState(!1);return T.useEffect(()=>{function l(){const c=Z();if($(c)){const u=wl(c),f=at(u,ut),d=at(u,so);if(!(f||d)){a(!1);return}const h=c.getNodes().filter(p=>!xo(p)).find(p=>{const g=at(p,ut),m=at(p,so);return f&&!f.is(g)||g&&!g.is(f)||d&&!d.is(m)||m&&(!m.is(d)||m.getIsUnlinked())});a(!h)}else if(ot(c)){const u=c.getNodes();if(u.length===0){a(!1);return}const f=u[0],d=f.getParent();ut(d)||ut(f)?a(!0):a(!1)}}return fn(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{l()})}),e.registerCommand(Ql,(c,u)=>(l(),i(u),!1),hx),e.registerCommand(Md,c=>{const u=Z();if($(u)){const f=wl(u),d=at(f,ut);if(ut(d)&&(c.metaKey||c.ctrlKey))return window.open(d.getURL(),"_blank"),!0}return!1},Gn))},[e]),Nn.createPortal(x.jsx(s5,{editor:o,isLink:s,anchorElem:t,setIsLink:a,isLinkEditMode:n,setIsLinkEditMode:r}),t)}function l5({anchorElem:e=document.body,isLinkEditMode:t,setIsLinkEditMode:n}){const[r]=ht();return a5(r,e,t,n)}const c5=({url:e,onDelete:t})=>x.jsxs("div",{className:"relative",children:[x.jsx("img",{src:e,alt:"Thumbnail",width:75,height:75,className:"w-[75px] h-[75px] object-cover rounded-lg border border-gray-200"}),x.jsx(je,{size:"smallCollapse",title:"Delete attachment",onClick:t,className:"absolute top-1 left-1 w-[20px] h-[20px] rounded-full",color:"secondary",children:x.jsx(ke,{icon:jy})})]}),u5=({onRemoveFile:e,type:t,label:n})=>{const r=t.toLowerCase(),o=Ib(r);return x.jsxs("div",{className:"relative flex items-center justify-center rounded border border-gray-200",children:[x.jsx(je,{size:"smallCollapse",color:"secondary",className:"absolute top-1 left-1 w-[20px] h-[20px] rounded-full",title:"Remove file",onClick:e,children:x.jsx(ke,{icon:jy})}),x.jsxs("div",{className:"flex items-center justify-center mx-2",children:[x.jsx("span",{className:"text-primary-600 my-2",children:x.jsx(ke,{icon:o,size:"3x",className:"text-primary-600"})}),x.jsx("span",{className:"font-bold p-2",children:n})]})]})},f5=({clearKey:e})=>{const[t]=ht(),n=T.useRef(e);return T.useEffect(()=>{n.current!==e&&(t.update(()=>{We().clear()}),n.current=e)},[e,t]),null},d5=({isOpen:e})=>{const[t]=ht(),n=T.useRef(!1);return T.useEffect(()=>{if(!e){n.current=!1;return}if(n.current)return;const r=()=>{const o=t.getRootElement();if(!o){requestAnimationFrame(r);return}n.current=!0;const i=window.scrollX,s=window.scrollY;try{o.focus({preventScroll:!0})}catch{o.focus()}requestAnimationFrame(()=>window.scrollTo(i,s)),setTimeout(()=>window.scrollTo(i,s),0)};r()},[t,e]),null},h5=({initialValue:e})=>{const[t]=ht(),n=T.useCallback((o,i)=>{const a=new DOMParser().parseFromString(i,"text/html");return t1(o,a)},[]),r=T.useRef(!1);return T.useEffect(()=>{!r.current&&e&&(t.update(()=>{We().clear(),sx(n(t,e))}),r.current=!0)},[t,e,n]),null},p5=({onChange:e})=>{const[t]=ht();return x.jsx(DN,{onChange:n=>{n.read(()=>{const r=n1(t,null);e(r)})}})},m5=({onAddAttachments:e})=>{const[t]=ht();return T.useEffect(()=>{if(!e)return;const n=t.getRootElement();if(!n)return;const r=o=>{const i=o.clipboardData;if(!i)return;const s=i.items;let a=!1;for(let l=0;l<s.length;l++){const c=s[l];if(c.kind==="file"&&c.type.startsWith("image/")){a=!0;break}}if(a){for(let l=0;l<s.length;l++){const c=s[l];if(c.kind==="file"&&c.type.startsWith("image/")){const u=c.getAsFile();if(u){const f=Date.now(),d=u.type.split("/")[1]||"png",h=`image_${f}.${d}`,p=new File([u],h,{type:u.type});e==null||e([p])}}}o.preventDefault(),o.stopPropagation()}};return n.addEventListener("paste",r,!0),()=>{n.removeEventListener("paste",r,!0)}},[t,e]),null},g5=({onSubmit:e})=>{const[t]=ht();return T.useEffect(()=>{if(e)return t.registerCommand(Fs,n=>n&&!n.shiftKey?(n.preventDefault(),e(),!0):!1,1)},[t,e]),null},y5=({setIsLinkEditMode:e})=>{const[t]=ht();return T.useEffect(()=>{const n=t.getRootElement();if(!n)return;const r=o=>{const i=o.metaKey||o.ctrlKey,s=o.key==="k"||o.key==="K";i&&s&&t.getEditorState().read(()=>{const a=Z();$(a)&&!a.isCollapsed()&&(o.preventDefault(),e(!0),t.dispatchCommand($i,"https://"))})};return n.addEventListener("keydown",r),()=>{n.removeEventListener("keydown",r)}},[t,e]),null};function g1({attachments:e,clearKey:t=0,inputFieldClassName:n="",containerClassName:r="",initialValue:o,onChange:i,commentType:s,onCommentTypeChange:a,isCommentTypeEditable:l=!0,actions:c,onAddAttachments:u,onRemoveAttachment:f,onSubmit:d,isOpen:h}){const p={namespace:"comment-editor",theme:UN,nodes:[sa,ts,Ho],onError:A=>{console.error(A)}},[g,m]=T.useState(null),[y,b]=T.useState(!1),v=A=>{A!==null&&m(A)},w=uh[s];return x.jsx("div",{className:r,children:x.jsxs(L6,{initialConfig:p,children:[x.jsxs("div",{className:"relative",children:[x.jsx(_N,{contentEditable:x.jsx("div",{ref:v,children:x.jsx(MN,{className:_e("p-3 outline-none border-0 w-full border-t border-gray-200 rounded-none border-l-3",w.bg,w.border,w.fontColor,n)})}),placeholder:x.jsx("div",{className:"absolute top-3 left-4 text-gray-400 pointer-events-none",children:"Type comment…"}),ErrorBoundary:$N}),x.jsx(r5,{}),x.jsx(o5,{}),g&&x.jsx(l5,{anchorElem:g,isLinkEditMode:y,setIsLinkEditMode:b}),x.jsx(NN,{}),x.jsx(h5,{initialValue:o}),x.jsx(p5,{onChange:i}),x.jsx(g5,{onSubmit:d}),x.jsx(y5,{setIsLinkEditMode:b}),x.jsx(f5,{clearKey:t}),x.jsx(m5,{onAddAttachments:u}),x.jsx(d5,{isOpen:h})]}),e&&e.length>0&&x.jsx("div",{className:"flex flex-wrap justify-start gap-2 p-4",children:e.map(A=>md(A.type)?x.jsx(c5,{url:A.url,onDelete:()=>f==null?void 0:f(A.originFile)},A.originFile.name):x.jsx(u5,{type:A.type,label:A.name,onRemoveFile:()=>f==null?void 0:f(A.originFile)},A.originFile.name))}),x.jsx("div",{className:"border-t border-gray-200 p-2 flex justify-end",children:x.jsx(n5,{commentType:s,onCommentTypeChange:a,isCommentTypeEditable:l,actions:c,setIsLinkEditMode:b,onAddAttachments:u})})]})})}const b5=({asset:e,onSetActiveSrc:t})=>x.jsxs("div",{className:"relative border border-gray-200 rounded-md h-[110px] w-full hover:border-primary-500",children:[x.jsx("img",{src:za(e),onClick:()=>t(za(e)),onKeyDown:n=>{n.key==="Enter"&&t(za(e))},alt:e.name,className:"w-full h-full object-cover rounded-md object-center cursor-zoom-in"}),(e==null?void 0:e.uploading)&&x.jsx("div",{className:"absolute bottom-2 w-full max-w-md mx-auto px-2",children:x.jsx("div",{className:"relative h-2 overflow-hidden rounded-full bg-gray-200",children:x.jsx("div",{className:"absolute left-0 top-0 h-full w-1/3 rounded-full bg-blue-500 animate-progress"})})})]}),v5=({asset:e})=>{var r,o;const t=((o=(r=e==null?void 0:e.mimeType)==null?void 0:r.split("/").pop())==null?void 0:o.toLowerCase())||"",n=Ib(t);return x.jsxs("div",{className:"flex gap-2",children:[(e==null?void 0:e.uploading)&&x.jsx("div",{className:"flex items-center justify-center",children:x.jsx("div",{className:"h-4 w-4 rounded-full border-2 border-gray-300 border-t-blue-500 animate-spin"})}),x.jsx(ke,{icon:n,size:"lg",className:"text-primary-600"}),x.jsx("a",{href:za(e),className:"text-sm text-blue-600 underline",download:!0,target:"_blank",rel:"noopener noreferrer",children:e.name})]})},x5=({commentType:e=dt.INFO,author:t,username:n,comment:r,createdDate:o,onDelete:i,onEdit:s,hasAssets:a,taskAssets:l,taskVerified:c})=>{const f={[dt.INFO]:{bg:"bg-primary-100",border:"border-primary-200",icon:Dy,iconColor:"text-primary-600 hover:text-primary-600",text:"text-primary-900"},[dt.WARNING]:{bg:"bg-warning-100",border:"border-warning-200",icon:My,iconColor:"text-warning-600 hover:text-warning-600",text:"text-warning-900"},[dt.DANGER]:{bg:"bg-danger-100",border:"border-danger-200",icon:$y,iconColor:"text-danger-600 hover:text-danger-600",text:"text-danger-900"},[dt.SUCCESS]:{bg:"bg-success-100",border:"border-success-200",icon:Ly,iconColor:"text-success-600 hover:text-success-600",text:"text-success-900"}}[e],d=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(o||"")).replace(",",""),[h,p]=T.useState(!1),[g,m]=T.useState(zc(r)),[y,b]=T.useState(e),[v,w]=T.useState(""),A=()=>{p(!0)},C=()=>{const N=of.sanitize(g);s(N,y),p(!1)},_=N=>{const P=of.sanitize(g);b(N),s(P,N),p(!1)},E=()=>{p(!1)};return x.jsxs("div",{className:"flex items-start space-x-4 w-full",children:[x.jsx(KT,{alt:t}),x.jsxs("div",{className:"flex-1 min-w-0",children:[x.jsxs("div",{className:`border ${f.border} rounded-sm ${f.bg} shadow-sm flex flex-col items-start justify-between w-full`,children:[x.jsx("div",{className:"p-3 flex flex-col items-start justify-between w-full",children:x.jsxs("div",{className:"w-full",children:[x.jsxs("div",{className:"flex items-center mb-2 justify-between",children:[x.jsxs("div",{children:[x.jsx(ke,{icon:f.icon,size:"lg",className:`mr-2 ${f.iconColor}`}),x.jsx("span",{className:`font-semibold text-sm ${f.text}`,children:t})]}),x.jsx(qT,{commentType:e,taskVerified:c,isUsernameAuthor:n.trim()===t.trim(),onEdit:A,onSaveCommentType:_,onDelete:i})]}),h?x.jsx(g1,{inputFieldClassName:"bg-white border-0 rounded-sm",containerClassName:"bg-white border-0 rounded-sm",onChange:m,commentType:e,isCommentTypeEditable:!1,initialValue:zc(r),actions:x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(je,{category:"outline",size:"smallCollapse",color:"secondary",onClick:E,title:"Cancel edit",children:"Cancel"}),x.jsx(je,{category:"solid",size:"smallCollapse",color:"primary",onClick:C,title:"Save edit",disabled:$a(g),children:"Save"})]})}):x.jsx("div",{className:`text-sm ${f.text}`,dangerouslySetInnerHTML:{__html:zc(r)}})]})}),a&&l&&(l==null?void 0:l.length)>0&&x.jsx("div",{className:`${f.border} border-t w-full p-2 flex gap-2 flex-wrap`,children:l.map(N=>x.jsx(T.Fragment,{children:md(N.mimeType)?x.jsx(b5,{asset:N,onSetActiveSrc:w}):x.jsx(v5,{asset:N})},N.assetId))})]}),x.jsxs("div",{className:"flex gap-2 my-1",children:[o&&x.jsx("time",{dateTime:o,className:"text-xs text-gray-500 opacity-60",children:d}),c&&x.jsxs("span",{className:"text-xs text-success-600 font-semibold flex items-center gap-1",children:[x.jsx(ke,{icon:Ry}),"Comment Required"]})]})]}),x.jsx(_T,{plugins:[BT],open:!!v,zoom:{maxZoomPixelRatio:2},close:()=>w(""),styles:{root:{zIndex:9999999999}},carousel:{finite:!0,preload:0},controller:{closeOnBackdropClick:!0},slides:[{src:v}]})]})},uh={[dt.INFO]:{icon:cC,bg:"bg-primary-100",border:"border-l-primary-500",iconColor:"text-primary-600 hover:text-primary-700",fontColor:"text-primary-900"},[dt.WARNING]:{icon:Gk,bg:"bg-warning-100",border:"border-l-warning-500",iconColor:"text-warning-600 hover:text-warning-700",fontColor:"text-warning-900"},[dt.DANGER]:{icon:dC,bg:"bg-danger-100",border:"border-l-danger-500",iconColor:"text-danger-600 hover:text-danger-700",fontColor:"text-danger-900"},[dt.SUCCESS]:{icon:Ry,bg:"bg-success-100",border:"border-l-success-500",iconColor:"text-success-600 hover:text-success-700",fontColor:"text-success-900"}},y1=Object.entries(uh).map(([e,t])=>({type:e,icon:t.icon,color:t.iconColor,title:`Change comment type to ${e}`})),w5=({comments:e,onClose:t,isOpen:n,taskName:r,taskInstanceId:o,isLoading:i,playbookInstanceId:s,taskVerification:a})=>{const[l,c]=T.useState(""),[u,f]=T.useState(dt.INFO),[d,h]=T.useState(0),[p,g]=T.useState([]),m=T.useRef(null),{username:y}=b1(),{manageComment:b}=h4({playbookInstanceId:s}),v=()=>{const P=p.length,W=p.some(z=>!md(z.mimeType))?"Attachment":"Image",j=P>1?"s":"";return`<p class="m-0"><span style="white-space: pre-wrap;">${W}${j} added.</span></p>`},w=P=>{const I=Array.from(P).map((W,j)=>o4(W,p.length+j+1));g(W=>[...W,...I])},A=P=>{g(I=>I.filter(W=>W.originFile!==P))},C=P=>{f(P)},_=async()=>{if(!p.length&&$a(l)||!o)return;p.length>0&&g([]);const P=of.sanitize(l);c(""),h(I=>I+1),await b({action:"add",comment:p.length>0&&$a(l)?v():P,username:y||"",commentType:u,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,hasAssets:p.length>0,taskInstanceId:o,taskVerified:a,attachments:p}),f(dt.INFO)},E=async P=>{o&&await b({username:y||"",action:"delete",taskVerified:!1,taskInstanceId:o,commentId:P})},N=async({commentId:P,comment:I,commentType:W,hasAssets:j,isAlreadyVerified:z})=>{o&&await b({action:"edit",username:y||"",...I&&{comment:I},taskInstanceId:o,commentId:P,hasAssets:j,taskVerified:z,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,commentType:W})};return T.useLayoutEffect(()=>{m.current&&n&&!i&&e.length>0&&(m.current.scrollTop=m.current.scrollHeight)},[n,i,e.length]),x.jsxs("div",{className:_e("transition-all duration-300 fixed bg-white right-0 bottom-0 h-[100vh] z-[9999999998] flex flex-col min-w-[270px] max-w-[420px] w-[calc(100vw-1rem)] border border-gray-200 rounded-t-sm overflow-hidden",n?"translate-y-0 opacity-100":"translate-y-full opacity-0 pointer-events-none"),children:[x.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-gray-200 px-2 py-4 w-full",children:[x.jsx("h6",{className:"font-semibold text-gray-900 truncate max-w-[300px]",children:r}),x.jsx(je,{color:"grayLight",size:"smallCollapse",rounded:"none",title:"Close comment box",onClick:t,children:x.jsx(ke,{icon:Dl,className:"size-4 text-gray-300"})})]}),x.jsxs("div",{ref:m,className:"flex flex-col flex-1 overflow-y-auto",children:[x.jsxs("div",{className:"flex flex-col justify-end flex-1 gap-4 p-4 pb-[102px]",children:[i&&x.jsx("div",{className:"flex flex-col gap-3",children:[1,2,3].map(P=>x.jsx("div",{className:"h-16 animate-pulse rounded-lg bg-gray-100"},P))}),(e==null?void 0:e.length)>0&&!i&&e.map(P=>x.jsx(x5,{username:y||"",onDelete:()=>E(P.commentId),onEdit:(I,W)=>N({commentId:P.commentId,comment:I,commentType:W,hasAssets:P.hasAssets,isAlreadyVerified:P.taskVerified}),...P},P.commentId)),(e==null?void 0:e.length)===0&&!i&&x.jsxs("div",{className:"flex flex-1 flex-col items-center justify-end gap-3 text-center mb-1",children:[x.jsx("img",{src:n4,className:"opacity-70",alt:"Empty"}),x.jsx("p",{className:"text-gray-400",children:"There is no discussion in this Task."})]})]}),x.jsx(g1,{attachments:p,onChange:c,containerClassName:"fixed bottom-0 left-0 right-0 bg-white",clearKey:d,commentType:u,onCommentTypeChange:C,onAddAttachments:w,onRemoveAttachment:A,onSubmit:_,isOpen:n,actions:x.jsx(je,{category:"link",size:"normalCollapse",title:"Send comment",onClick:_,disabled:$a(l)&&p.length===0,children:x.jsx(ke,{icon:IS})})})]})]})},Kf=T.createContext({comments:[],openTaskDetails:null,username:void 0,setOpenTaskDetails:()=>{},prefetchQuery:e=>{}}),b1=()=>{if(!T.useContext(Kf))throw new Error("useCommentContext must be used within a CommentProvider");return T.useContext(Kf)},A5=({playbookInstanceId:e,children:t,username:n})=>{const[r,o]=T.useState({taskInstanceId:null,taskName:"",taskVerification:!1}),{taskInstanceId:i,taskName:s,taskVerification:a}=r||{taskInstanceId:null,taskName:"",taskVerification:!1},{comments:l,isLoading:c,prefetchQuery:u}=c4({taskInstanceId:i||0,enabled:i!==null,username:n});return x.jsxs(Kf.Provider,{value:{comments:l,openTaskDetails:r,setOpenTaskDetails:o,prefetchQuery:u,username:n},children:[t,Nn.createPortal(x.jsxs("div",{id:"cnfdnc-comment-box-root",children:[x.jsx("style",{children:Cl}),x.jsx("div",{className:"confidence-playbook",children:x.jsx(w5,{playbookInstanceId:e,comments:l,onClose:()=>o(null),isOpen:!!i,taskName:s,taskInstanceId:i,isLoading:c,taskVerification:a})})]}),LS)]})},k5={[Be.OPEN]:"border-[#C1C5C8] bg-[#F0F1F2]",[Be.IN_PROGRESS]:"bg-[#E6F2FF] border-[#94C8FF]",[Be.IN_REVIEW]:"bg-[#EAF6EC] border-[#A5DAB1]",[Be.COMPLETED]:"bg-[#EAF6EC] border-[#A5DAB1]"},Bn={PHOTO:"photo",SCREENSHOT:"screenshot",COMMENT:"comment",NO_VERIFICATION:null},C5=({task:e,step:t,playbookType:n,onButtonClick:r,viewMode:o="card",canStart:i=!1,isExpanded:s=!1,toggleExpanded:a,playbookId:l,taskStyle:c,listStickyTopBase:u})=>{const[f,d]=T.useState(!1),{taskDetails:h,prefetchQuery:p}=DE({taskId:e.taskId,playbookId:l,enabled:s}),{setOpenTaskDetails:g,prefetchQuery:m}=b1(),{buttons:y}=Bw({taskStatus:e.workflowStatus,canStart:i}),b=T.useMemo(()=>e.imageRequired===0?Bn.NO_VERIFICATION:e.imageRequired===1?Bn.SCREENSHOT:e.imageRequired===2?Bn.PHOTO:e.imageRequired===4?Bn.COMMENT:null,[e.imageRequired]),v=async w=>{try{d(!0),await r(w)}finally{d(!1)}};if(o==="list"){const w=T.useMemo(()=>e.workflowStatus===Be.COMPLETED?"success":e.workflowStatus===Be.IN_PROGRESS?"primary":"default",[e.workflowStatus]),A=T.useMemo(()=>{const C=[];return y.forEach(_=>{_==="START"&&C.push({id:"START",color:"primary",action:"Start",to:Be.IN_PROGRESS}),_==="COMPLETE"&&(!e.taskVerified&&b===Bn.COMMENT&&C.push({id:"ADD_COMMENT",color:"danger",action:"Add Comment",to:"Required"}),C.push({id:"COMPLETE",color:"success",action:"Complete",to:Be.COMPLETED,disabled:!e.taskVerified&&b===Bn.COMMENT}))}),C},[y,b,e.taskVerified]);return x.jsxs("div",{className:_e("flex flex-col"),children:[x.jsxs("div",{className:_e("flex items-center gap-3 p-2 border-gray-200",e.sequenceOrder>0&&"border-t",s&&"bg-white rounded-md border border-t-none shadow-sm sticky"),style:{top:s?u:0},children:[x.jsx("div",{className:"text-gray-200 text-base",children:e.sequenceOrder+1}),x.jsx("div",{onClick:()=>{a==null||a(!s)},onMouseOver:p,className:_e("flex-1 truncate cursor-pointer",s&&"font-medium",e.workflowStatus===Be.COMPLETED&&"text-secondary-400 line-through"),style:{color:e.workflowStatus===Be.IN_PROGRESS&&(c==null?void 0:c.titleColor)||"#1C232D"},children:e.taskInstanceName}),x.jsx(hS,{taskVerified:e.taskVerified,verificationType:b,title:e.workflowStatus,variant:w,transitions:A,onClick:C=>{if(C===ui.ADD_COMMENT){g({taskInstanceId:e.taskInstanceId,taskName:e.taskInstanceName,taskVerification:!0});return}r(C)}}),x.jsx(Yp,{onMouseOver:()=>m(e.taskInstanceId),commentsCount:(e==null?void 0:e.numberOfComments)||0,commentType:(e==null?void 0:e.recentCommentType)||dt.INFO,onClick:()=>g({taskInstanceId:e.taskInstanceId,taskName:e.taskInstanceName,taskVerification:!1})})]}),(h==null?void 0:h.description)&&x.jsx("div",{className:_e(!s&&"hidden","border-gray-200 border p-2 mx-4 mb-4 border-t-none -mt-[1px] bg-gray-100 rounded-b-md"),children:x.jsx(Vp,{description:(h==null?void 0:h.description)||""})})]})}return x.jsxs("div",{className:Es("flex items-stretch rounded-sm overflow-hidden border",k5[e.workflowStatus]),children:[x.jsx(yS,{playbookType:n,status:e.workflowStatus,step:t}),x.jsxs("div",{className:"flex w-full flex-col overflow-x-hidden flex-1 p-2",children:[n==="Sequential"&&x.jsx("div",{className:"-mb-3 self-end pr-2 pt-2",children:x.jsx(vS,{status:e.workflowStatus})}),x.jsxs("div",{className:"space-y-2 divide-y divide-black/10 flex flex-col flex-1",children:[x.jsx("div",{className:_e("text-lg font-medium flex-1 pb-1"),style:{color:e.workflowStatus==="Completed"?"#1C232D":(c==null?void 0:c.titleColor)||"#1C232D"},children:e.taskInstanceName}),b?x.jsxs("div",{className:"flex items-center gap-2 text-sm pb-2",children:[x.jsx(ke,{icon:Iy,className:"size-4"}),x.jsxs("div",{children:[x.jsx("span",{className:"font-medium",children:b===Bn.PHOTO?"Photo":b===Bn.SCREENSHOT?"Screenshot":"Comment"})," ","required"]})]}):x.jsx(x.Fragment,{})]}),(h==null?void 0:h.description)&&x.jsx("div",{className:_e(!s&&"hidden"),children:x.jsx(Vp,{description:(h==null?void 0:h.description)||""})}),(y.length>0||e.hasDescription)&&x.jsxs("div",{className:"flex items-center justify-end gap-4 border-t border-black/10 pt-2",children:[x.jsx("div",{className:"flex-1",children:x.jsx(FE,{buttons:y,onButtonClick:v,disabled:f})}),x.jsx(Yp,{onMouseOver:()=>m(e.taskInstanceId),commentsCount:(e==null?void 0:e.numberOfComments)||0,commentType:(e==null?void 0:e.recentCommentType)||dt.INFO,onClick:()=>g({taskInstanceId:e.taskInstanceId,taskName:e.taskInstanceName,taskVerification:!1})}),a&&x.jsx(je,{size:"smallCollapse",onMouseOver:p,category:"link",onClick:()=>{a()},title:s?"Hide task description":"Show task description",children:x.jsx(ke,{icon:Fy,className:Es("cursor-pointer text-[#0069D9]",s?"rotate-180":"")})})]})]})]})},v1=T.forwardRef(({title:e,className:t,playbookStyle:n,...r},o)=>{var i,s,a;return x.jsx("div",{ref:o,className:_e("border-b border-gray-200 flex items-center",t),style:{backgroundColor:((i=n==null?void 0:n.whiteLabel)==null?void 0:i.titleBackgroundColor)||"#f8f9fa"},...r,children:x.jsx("div",{className:_e("text-xl min-h-16 p-4 font-medium flex-1",{"text-dark":!((s=n==null?void 0:n.whiteLabel)!=null&&s.titleTextColor)}),style:{color:(a=n==null?void 0:n.whiteLabel)==null?void 0:a.titleTextColor},children:e})})});v1.displayName="PlaybookHeader";const _5=Cl.replace(/:root,\s*:host/g,":host"),E5=({playbookInstanceId:e,playbookMode:t,playbookStyle:n,defaultExpanded:r=!0})=>{const{playbook:o,actions:i}=$w(e);if(!o)return x.jsx("div",{});const s=async(a,l)=>{var c;if(a===ui.COMPLETE){const u=(c=o.tasks.find(f=>f.taskInstanceId===l))==null?void 0:c.sequenceOrder;if(u===void 0){console.error("Task not found in playbook");return}return i.completeTask(l,u)}if(a===ui.START)return i.startTask(l)};return x.jsx("div",{className:"confidence-playbook",children:x.jsx(x1,{playbook:o,playbookMode:t,onTaskButtonClick:s,playbookStyle:n,defaultExpanded:r})})},S5=({className:e,children:t,numberOfTasks:n,playbookMode:r})=>x.jsxs("div",{className:_e("w-full p-4",e),children:[n&&x.jsxs("div",{className:_e(r==="card"&&"mb-4"),children:[x.jsx("span",{className:"font-medium",children:"Tasks"})," (",n,")"]}),x.jsx("div",{className:_e(r==="card"&&"space-y-4"),children:t})]}),x1=({playbook:e,playbookMode:t,onTaskButtonClick:n,playbookStyle:r,defaultExpanded:o=!0})=>{var y,b,v,w,A;const{playbookInstanceName:i,tasks:s}=e,a=T.useRef(null),[l,c]=T.useState(0),[u,f]=T.useState(()=>{const C=M2(e.playbookInstanceId);return C!==null?C:o}),d=()=>{f(C=>{const _=!C;return P2(e.playbookInstanceId,_),_})},{isTaskExpanded:h,toggleTaskExpanded:p,isAtLeastOneTaskExpanded:g}=T0(e.playbookInstanceId,{onTaskExpanded:()=>{var C;c(((C=a.current)==null?void 0:C.offsetHeight)||0)}});T.useEffect(()=>{if(g){if(!a.current)throw new Error("Playbook header ref is not set");new ResizeObserver(_=>{var E;for(const N of _)N.contentRect&&c(((E=a.current)==null?void 0:E.offsetHeight)||0)}).observe(a.current)}return()=>{a.current&&new ResizeObserver(()=>{}).unobserve(a.current)}},[g]);const m=T.useMemo(()=>{const C=s.filter(_=>_.workflowStatus===Be.COMPLETED).sort((_,E)=>E.sequenceOrder-_.sequenceOrder)[0];return C?C.sequenceOrder+1:0},[s]);return x.jsxs("div",{className:_e(!(r!=null&&r.overlay)&&"min-h-screen",(r==null?void 0:r.overlay)&&"fixed bottom-0 z-[9999999997] flex","transition-all duration-300 ease-in-out"),...(r==null?void 0:r.overlay)&&{style:{width:"100%",maxWidth:u?((y=r.overlay.size)==null?void 0:y.width)||450:"0rem",height:((b=r.overlay.size)==null?void 0:b.height)||"calc(100vh - 4rem)",maxHeight:"calc(100vh - 4rem)",right:((v=r.overlay.offset)==null?void 0:v.right)!==void 0?r.overlay.offset.right:r.overlay.position==="right"?32:void 0,left:((w=r.overlay.offset)==null?void 0:w.left)!==void 0?r.overlay.offset.left:r.overlay.position==="left"?32:void 0}},children:[(r==null?void 0:r.overlay)&&x.jsx("div",{onClick:d,className:_e("size-9 absolute -left-9 p-1 top-3 z-[9999999997] border-none rounded-l-sm cursor-pointer"),style:{backgroundColor:((A=r==null?void 0:r.whiteLabel)==null?void 0:A.primaryColor)||"#007BFF",boxShadow:"0px 3px 3px 0px #00000040"},children:x.jsx("img",{src:h0,alt:"Confidence Logo",className:"w-full h-full object-contain"})}),x.jsxs("div",{className:_e("flex flex-col flex-1 bg-gray-50",(r==null?void 0:r.overlay)&&"border border-gray-200 shadow-2xl rounded-t-sm overflow-y-auto"),children:[x.jsx(v1,{title:i,className:_e("top-0 sticky z-2"),playbookStyle:r,ref:a}),x.jsx(S5,{playbookMode:t,numberOfTasks:e.numberofTasks,children:s.map((C,_)=>{var E;return x.jsx(C5,{task:C,step:_+1,viewMode:t,playbookId:e.playbookId,canStart:C.sequenceOrder===m,onButtonClick:N=>n(N,C.taskInstanceId),playbookType:"Non-Sequential",taskStyle:{titleColor:(E=r==null?void 0:r.whiteLabel)==null?void 0:E.primaryColor},isExpanded:h(C.taskInstanceId),toggleExpanded:()=>p(C.taskInstanceId),listStickyTopBase:l||104},C.taskId)})})]})]})},T5=({email:e,playbookId:t,playbookMode:n,playbookStyle:r,bank:o="public-sdk",timezone:i="America/Los_Angeles",persistKey:s,defaultExpanded:a=!0})=>{const[l,c]=T.useState(null);return T.useEffect(()=>{(async()=>{const u=q0(t,s);if(u&&u.email===e){c(u.playbookInstanceId);return}const{playbookInstanceId:f,errorCode:d,details:h,message:p}=await N0({bank:o,email:e,timezone:i,playbookUid:t})||{};if(d)throw new Error(`Error initiating playbook: ${p} (Code: ${d}) - Details: ${h}`);if(!f)throw new Error("No playbook instance ID returned from initiation");H0(t,f,e,s),c(f)})()},[]),l?x.jsx(Hr,{playbookInstanceId:l,playbookMode:n,playbookStyle:r,username:e,defaultExpanded:a}):null},N5=({playbookId:e,playbookMode:t="list",playbookStyle:n,btnLabel:r="Start Playbook",btnColor:o="primary",persistKey:i,defaultExpanded:s=!0})=>{const[a,l]=T.useState(null),[c,u]=T.useState(void 0);return T.useEffect(()=>{const f=q0(e,i);f&&(l(f.playbookInstanceId),u(f.email))},[e,i]),x.jsxs(x.Fragment,{children:[x.jsxs(Al.div,{children:[x.jsx(Wk,{playbookId:e,disabled:!!a,onInitiated:(f,d)=>{H0(e,f,d,i),l(f),u(d)},btnLabel:r,btnColor:o}),x.jsx("style",{type:"text/css",children:_5})]}),a&&x.jsx(Hr,{playbookInstanceId:a,playbookMode:t,playbookStyle:n,username:c,defaultExpanded:s})]})},Hr=({playbookInstanceId:e,playbookMode:t,playbookStyle:n,username:r,defaultExpanded:o=!0})=>(console.log("Starting ConfidencePlaybook with instance ID:",e,r),x.jsx(E0,{children:x.jsx(A5,{playbookInstanceId:e,username:r,children:x.jsx(E5,{playbookInstanceId:e,playbookMode:t,playbookStyle:n,defaultExpanded:o})})}));Hr.Context=E0;Hr.View=x1;Hr.AutoInstantiated=T5;Hr.WithInstantiateButton=N5;const w1=Cl.replace(/:root,\s*:host/g,":host"),A1=e=>Nn.createPortal(x.jsxs(Al.div,{style:{position:"relative",zIndex:2147483646},children:[x.jsx("style",{children:w1}),x.jsx(Hr,{...e})]}),document.body),O5=e=>Nn.createPortal(x.jsxs(Al.div,{style:{position:"relative",zIndex:2147483646},children:[x.jsx("style",{children:w1}),x.jsx(Hr.AutoInstantiated,{...e})]}),document.body);A1.AutoInstantiated=O5;exports.ConfidencePlaybook=A1;
|
package/dist/index.js
CHANGED
|
@@ -22882,7 +22882,7 @@ const D5 = ({
|
|
|
22882
22882
|
]
|
|
22883
22883
|
}
|
|
22884
22884
|
);
|
|
22885
|
-
},
|
|
22885
|
+
}, od = Bn({
|
|
22886
22886
|
comments: [],
|
|
22887
22887
|
openTaskDetails: null,
|
|
22888
22888
|
username: void 0,
|
|
@@ -22895,7 +22895,7 @@ const D5 = ({
|
|
|
22895
22895
|
if (!Fn(od))
|
|
22896
22896
|
throw new Error("useCommentContext must be used within a CommentProvider");
|
|
22897
22897
|
return Fn(od);
|
|
22898
|
-
},
|
|
22898
|
+
}, U5 = ({
|
|
22899
22899
|
playbookInstanceId: e,
|
|
22900
22900
|
children: t,
|
|
22901
22901
|
username: n
|
|
@@ -22927,7 +22927,7 @@ const D5 = ({
|
|
|
22927
22927
|
t,
|
|
22928
22928
|
qr(
|
|
22929
22929
|
/* @__PURE__ */ re("div", { id: "cnfdnc-comment-box-root", children: [
|
|
22930
|
-
/* @__PURE__ */ E("style", { children:
|
|
22930
|
+
/* @__PURE__ */ E("style", { children: Dl }),
|
|
22931
22931
|
/* @__PURE__ */ E("div", { className: "confidence-playbook", children: /* @__PURE__ */ E(
|
|
22932
22932
|
$5,
|
|
22933
22933
|
{
|
|
@@ -22947,7 +22947,7 @@ const D5 = ({
|
|
|
22947
22947
|
]
|
|
22948
22948
|
}
|
|
22949
22949
|
);
|
|
22950
|
-
},
|
|
22950
|
+
}, B5 = {
|
|
22951
22951
|
[Ke.OPEN]: "border-[#C1C5C8] bg-[#F0F1F2]",
|
|
22952
22952
|
[Ke.IN_PROGRESS]: "bg-[#E6F2FF] border-[#94C8FF]",
|
|
22953
22953
|
[Ke.IN_REVIEW]: "bg-[#EAF6EC] border-[#A5DAB1]",
|
|
@@ -22957,7 +22957,7 @@ const D5 = ({
|
|
|
22957
22957
|
SCREENSHOT: "screenshot",
|
|
22958
22958
|
COMMENT: "comment",
|
|
22959
22959
|
NO_VERIFICATION: null
|
|
22960
|
-
},
|
|
22960
|
+
}, j5 = ({
|
|
22961
22961
|
task: e,
|
|
22962
22962
|
step: t,
|
|
22963
22963
|
playbookType: n,
|
|
@@ -23093,7 +23093,7 @@ const D5 = ({
|
|
|
23093
23093
|
{
|
|
23094
23094
|
className: Fs(
|
|
23095
23095
|
"flex items-stretch rounded-sm overflow-hidden border",
|
|
23096
|
-
|
|
23096
|
+
B5[e.workflowStatus]
|
|
23097
23097
|
),
|
|
23098
23098
|
children: [
|
|
23099
23099
|
/* @__PURE__ */ E(
|
|
@@ -23210,7 +23210,7 @@ const D5 = ({
|
|
|
23210
23210
|
}
|
|
23211
23211
|
);
|
|
23212
23212
|
Lx.displayName = "PlaybookHeader";
|
|
23213
|
-
const
|
|
23213
|
+
const W5 = Dl.replace(/:root,\s*:host/g, ":host"), K5 = ({
|
|
23214
23214
|
playbookInstanceId: e,
|
|
23215
23215
|
playbookMode: t,
|
|
23216
23216
|
playbookStyle: n,
|
|
@@ -23241,7 +23241,7 @@ const K5 = Dl.replace(/:root,\s*:host/g, ":host"), H5 = ({
|
|
|
23241
23241
|
defaultExpanded: r
|
|
23242
23242
|
}
|
|
23243
23243
|
) }) : /* @__PURE__ */ E("div", {});
|
|
23244
|
-
},
|
|
23244
|
+
}, H5 = ({
|
|
23245
23245
|
className: e,
|
|
23246
23246
|
children: t,
|
|
23247
23247
|
numberOfTasks: n,
|
|
@@ -23355,14 +23355,14 @@ const K5 = Dl.replace(/:root,\s*:host/g, ":host"), H5 = ({
|
|
|
23355
23355
|
}
|
|
23356
23356
|
),
|
|
23357
23357
|
/* @__PURE__ */ E(
|
|
23358
|
-
|
|
23358
|
+
H5,
|
|
23359
23359
|
{
|
|
23360
23360
|
playbookMode: t,
|
|
23361
23361
|
numberOfTasks: e.numberofTasks,
|
|
23362
23362
|
children: s.map((k, C) => {
|
|
23363
23363
|
var _;
|
|
23364
23364
|
return /* @__PURE__ */ E(
|
|
23365
|
-
|
|
23365
|
+
j5,
|
|
23366
23366
|
{
|
|
23367
23367
|
task: k,
|
|
23368
23368
|
step: C + 1,
|
|
@@ -23389,7 +23389,7 @@ const K5 = Dl.replace(/:root,\s*:host/g, ":host"), H5 = ({
|
|
|
23389
23389
|
]
|
|
23390
23390
|
}
|
|
23391
23391
|
);
|
|
23392
|
-
},
|
|
23392
|
+
}, V5 = ({
|
|
23393
23393
|
email: e,
|
|
23394
23394
|
playbookId: t,
|
|
23395
23395
|
playbookMode: n,
|
|
@@ -23433,7 +23433,7 @@ const K5 = Dl.replace(/:root,\s*:host/g, ":host"), H5 = ({
|
|
|
23433
23433
|
defaultExpanded: a
|
|
23434
23434
|
}
|
|
23435
23435
|
) : null;
|
|
23436
|
-
},
|
|
23436
|
+
}, q5 = ({
|
|
23437
23437
|
playbookId: e,
|
|
23438
23438
|
playbookMode: t = "list",
|
|
23439
23439
|
playbookStyle: n,
|
|
@@ -23462,7 +23462,7 @@ const K5 = Dl.replace(/:root,\s*:host/g, ":host"), H5 = ({
|
|
|
23462
23462
|
btnColor: o
|
|
23463
23463
|
}
|
|
23464
23464
|
),
|
|
23465
|
-
/* @__PURE__ */ E("style", { type: "text/css", children:
|
|
23465
|
+
/* @__PURE__ */ E("style", { type: "text/css", children: W5 })
|
|
23466
23466
|
] }),
|
|
23467
23467
|
a && /* @__PURE__ */ E(
|
|
23468
23468
|
to,
|
|
@@ -23486,12 +23486,12 @@ const K5 = Dl.replace(/:root,\s*:host/g, ":host"), H5 = ({
|
|
|
23486
23486
|
e,
|
|
23487
23487
|
r
|
|
23488
23488
|
), /* @__PURE__ */ E(B0, { children: /* @__PURE__ */ E(
|
|
23489
|
-
|
|
23489
|
+
U5,
|
|
23490
23490
|
{
|
|
23491
23491
|
playbookInstanceId: e,
|
|
23492
23492
|
username: r,
|
|
23493
23493
|
children: /* @__PURE__ */ E(
|
|
23494
|
-
|
|
23494
|
+
K5,
|
|
23495
23495
|
{
|
|
23496
23496
|
playbookInstanceId: e,
|
|
23497
23497
|
playbookMode: t,
|
|
@@ -23503,16 +23503,16 @@ const K5 = Dl.replace(/:root,\s*:host/g, ":host"), H5 = ({
|
|
|
23503
23503
|
) }));
|
|
23504
23504
|
to.Context = B0;
|
|
23505
23505
|
to.View = Rx;
|
|
23506
|
-
to.AutoInstantiated =
|
|
23507
|
-
to.WithInstantiateButton =
|
|
23508
|
-
const Dx = Dl.replace(/:root,\s*:host/g, ":host"),
|
|
23506
|
+
to.AutoInstantiated = V5;
|
|
23507
|
+
to.WithInstantiateButton = q5;
|
|
23508
|
+
const Dx = Dl.replace(/:root,\s*:host/g, ":host"), Y5 = (e) => qr(
|
|
23509
23509
|
// SelfShadowComponent z-index is 2147483646 to ensure it is always on top of other elements (except CommentBoxRoot)
|
|
23510
23510
|
/* @__PURE__ */ re(Ll.div, { style: { position: "relative", zIndex: 2147483646 }, children: [
|
|
23511
23511
|
/* @__PURE__ */ E("style", { children: Dx }),
|
|
23512
23512
|
/* @__PURE__ */ E(to, { ...e })
|
|
23513
23513
|
] }),
|
|
23514
23514
|
document.body
|
|
23515
|
-
),
|
|
23515
|
+
), Q5 = (e) => qr(
|
|
23516
23516
|
// SelfShadowComponent z-index is 2147483646 to ensure it is always on top of other elements (except CommentBoxRoot)
|
|
23517
23517
|
/* @__PURE__ */ re(Ll.div, { style: { position: "relative", zIndex: 2147483646 }, children: [
|
|
23518
23518
|
/* @__PURE__ */ E("style", { children: Dx }),
|
|
@@ -23520,7 +23520,7 @@ const Dx = Dl.replace(/:root,\s*:host/g, ":host"), Q5 = (e) => qr(
|
|
|
23520
23520
|
] }),
|
|
23521
23521
|
document.body
|
|
23522
23522
|
);
|
|
23523
|
-
|
|
23523
|
+
Y5.AutoInstantiated = Q5;
|
|
23524
23524
|
export {
|
|
23525
|
-
|
|
23525
|
+
Y5 as ConfidencePlaybook
|
|
23526
23526
|
};
|