ryugi-artifacts 1.120.6 → 1.121.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +9 -9
- package/dist/document-engine.cjs +227 -227
- package/dist/viewer/{AgentDock-DIfCUHgZ.js → AgentDock-BNyBNlSy.js} +2 -2
- package/dist/viewer/ArtboardLayout-6tJS23QW.js +14 -0
- package/dist/viewer/ArtifactList-C3N4BjKx.js +2 -0
- package/dist/viewer/{ArtifactModal-Fp67aW8M.js → ArtifactModal-CH9BY3RJ.js} +1 -1
- package/dist/viewer/{BottomSheet-SYC_8Y6k.js → BottomSheet-BFtfrr58.js} +1 -1
- package/dist/viewer/{BrandingMark-D8kdL9jc.js → BrandingMark-QZsHgEQs.js} +1 -1
- package/dist/viewer/{Canvas-CMN5apcj.js → Canvas-C4NA77Id.js} +1 -1
- package/dist/viewer/{CommentPopover-CxFndD1f.js → CommentPopover-BoOuSWYS.js} +1 -1
- package/dist/viewer/{DocumentExportMenu-DyhweUFo.js → DocumentExportMenu-DrN19D4m.js} +1 -1
- package/dist/viewer/DocumentLayout-BjURocqM.js +2 -0
- package/dist/viewer/DocumentPage-H6a9SW4D.js +5 -0
- package/dist/viewer/DraftTray-JF38Iwzo.js +1 -0
- package/dist/viewer/{DraggablePanel-h7D7Tgnv.js → DraggablePanel-fUJe7paG.js} +1 -1
- package/dist/viewer/DropdownMenu-DrocGAAh.js +1 -0
- package/dist/viewer/{GroupVerdict-CSoZ7xIi.js → GroupVerdict-BCr6Cy0G.js} +1 -1
- package/dist/viewer/{HtmlLayout-DursBclJ.js → HtmlLayout-CeRlKG6z.js} +1 -1
- package/dist/viewer/{Input-CkHOfbQE.js → Input-BMZZLY98.js} +1 -1
- package/dist/viewer/MenuSubmenuTrigger-CPcD7vNW.js +1 -0
- package/dist/viewer/{PhoneArtboardBar-DOanenAY.js → PhoneArtboardBar-Dq5U0hhz.js} +1 -1
- package/dist/viewer/{Popover-HS6yjzxl.js → Popover-DxR9Dpf_.js} +1 -1
- package/dist/viewer/PreviewArtifactLayout-CDoR32LC.js +1 -0
- package/dist/viewer/PreviewLayout-C-sly_jL.js +2 -0
- package/dist/viewer/ReportLayout-CXSxsjVb.js +6 -0
- package/dist/viewer/{Segmented-D5ApsVJJ.js → Segmented-DoorRFgs.js} +1 -1
- package/dist/viewer/SelectScrollUpArrow-bXyfVgGf.js +1 -0
- package/dist/viewer/SlidesLayout-BDTPyuCv.js +12 -0
- package/dist/viewer/{SnapshotDocument-C7mV8NQn.js → SnapshotDocument-TKnFyGcv.js} +1 -1
- package/dist/viewer/{SplitFrame-zVgYFiT_.js → SplitFrame-CLquf6QT.js} +1 -1
- package/dist/viewer/StoryboardLayout-DB9qGegh.js +1 -0
- package/dist/viewer/{StoryboardRender-CjFlWvlf.js → StoryboardRender-CX00jo8v.js} +1 -1
- package/dist/viewer/ThreadView-D_g4kidg.js +1 -0
- package/dist/viewer/{Tooltip-Bi4V2FVJ.js → Tooltip-CZKrDYnF.js} +1 -1
- package/dist/viewer/VerifyLayout-DgokULV2.js +1 -0
- package/dist/viewer/{VirtualizedEditor-uWe43zaI-CgOwRELB.js → VirtualizedEditor-uWe43zaI-BlOdeG0b.js} +1 -1
- package/dist/viewer/{VirtualizedRenderer-C_d95FXi-DiZVcTAc.js → VirtualizedRenderer-C_d95FXi-Bb6aPJaZ.js} +1 -1
- package/dist/viewer/{WarningsBadge-CyQbVl6h.js → WarningsBadge-D4Oo4UxO.js} +1 -1
- package/dist/viewer/WhiteboardEditor-DrHOvXez-DTa-K6Xu.js +22 -0
- package/dist/viewer/WhiteboardLayout-F1J1rwTl.js +4 -0
- package/dist/viewer/{WritingCursor-CLEFH9bN.js → WritingCursor-6VjqhSXi.js} +1 -1
- package/dist/viewer/agentLook-60JQrptF.js +1 -0
- package/dist/viewer/{artifact-list-CuXyveqX.js → artifact-list-BuB3wom1.js} +1 -1
- package/dist/viewer/auto-publish-BfutdvfM.js +1 -0
- package/dist/viewer/channel-DST3ZfoT.js +4 -0
- package/dist/viewer/comments-CASb0ByE.js +1 -0
- package/dist/viewer/context-Dt460deL.js +1 -0
- package/dist/viewer/{crop-encode-7FeBhORX.js → crop-encode-BnAM7iWo.js} +1 -1
- package/dist/viewer/{dist-DknksWkX.js → dist-2resm9Wy.js} +1 -1
- package/dist/viewer/{dist-f8YElrUw.js → dist-462HZ4sr.js} +1 -1
- package/dist/viewer/{dist-BKkO1Omj.js → dist-B7GHMwWJ.js} +1 -1
- package/dist/viewer/{dist-Ci8SGeFw.js → dist-B9cyrbzi.js} +1 -1
- package/dist/viewer/{dist-SwdVvEpO.js → dist-Bost_p8b.js} +1 -1
- package/dist/viewer/{dist-i1Gf9O6b.js → dist-Bw8MOHnL.js} +1 -1
- package/dist/viewer/{dist-DQI2slI5.js → dist-CAQYce5C.js} +1 -1
- package/dist/viewer/{dist-DW1-cTNS.js → dist-CEyDZYnP.js} +1 -1
- package/dist/viewer/{dist-CskHZfMU.js → dist-CJicYh3N.js} +1 -1
- package/dist/viewer/{dist-BD6XPyPx.js → dist-CLdHiTLp.js} +1 -1
- package/dist/viewer/{dist-1y-5eBAw.js → dist-CNry8POH.js} +1 -1
- package/dist/viewer/{dist-h__DIjgw.js → dist-CXJ-dwdV.js} +1 -1
- package/dist/viewer/{dist-D0fC7ysz.js → dist-Cfyg-ZFz.js} +1 -1
- package/dist/viewer/dist-CkWqj1vB.js +1 -0
- package/dist/viewer/{dist-Do_0jRES.js → dist-CrYVEXMn.js} +1 -1
- package/dist/viewer/{dist-D8T-VMuH.js → dist-D26TaXjP.js} +1 -1
- package/dist/viewer/{dist-h2T27ekx.js → dist-D32zdSlG.js} +1 -1
- package/dist/viewer/{dist-BI0qFRAy.js → dist-DUysbnVD.js} +1 -1
- package/dist/viewer/{dist-BQ22B1dL.js → dist-DV8S7O88.js} +1 -1
- package/dist/viewer/{dist-DqZiUlRF.js → dist-DlFC92UU.js} +1 -1
- package/dist/viewer/{dist-IhKVX0N7.js → dist-Dr8Mok4z.js} +1 -1
- package/dist/viewer/{dist-CvSBK4r1.js → dist-Dz80ecx_.js} +1 -1
- package/dist/viewer/{dist-Bo1t4X-Z.js → dist-N6Hpo5Ed.js} +1 -1
- package/dist/viewer/{dist-3kOakO1C.js → dist-gLcMD1Nm.js} +1 -1
- package/dist/viewer/{dist-V7e95zqk.js → dist-opUfcW4x.js} +1 -1
- package/dist/viewer/{editor-CLF22MpT.js → editor-rLQcZykK.js} +13 -13
- package/dist/viewer/{fit-BQe9RV4E.js → fit-C4QfFtXk.js} +1 -1
- package/dist/viewer/{icons-CCSPm9SD.js → icons-CDVhjQMS.js} +1 -1
- package/dist/viewer/{imperative-BeC0q_ho.js → imperative-CXmLprLo.js} +1 -1
- package/dist/viewer/index.html +11 -12
- package/dist/viewer/index.js +2 -2
- package/dist/viewer/index4.css +1 -1
- package/dist/viewer/index5.css +13 -0
- package/dist/viewer/{jump-history-B-4GHf3_.js → jump-history-Dyva9tQM.js} +1 -1
- package/dist/viewer/{local-DjzZ1b9A.js → local-B-SW6cqA.js} +1 -1
- package/dist/viewer/local-split-host-BGpkEBjP.js +1 -0
- package/dist/viewer/{plugin-_bGVeqI0-D20LzbhT.js → plugin-_bGVeqI0-C4RRMCGb.js} +2 -2
- package/dist/viewer/preview.html +3 -3
- package/dist/viewer/preview.js +1 -1
- package/dist/viewer/{printDocument-DmnjWjBu.js → printDocument-BhGNF0gC.js} +1 -1
- package/dist/viewer/{ref-DjRYiP25.js → ref-BrUHq8E2.js} +1 -1
- package/dist/viewer/{ref-problem-DkSEcIQm.js → ref-problem-Cvl83U9T.js} +1 -1
- package/dist/viewer/{route-BEA0O_Ry.js → route-i3jkzu-i.js} +2 -2
- package/dist/viewer/{route-messages-o8lg2hOP.js → route-messages-MxWI01S2.js} +1 -1
- package/dist/viewer/settings-BSB6g2PC.js +1 -0
- package/dist/viewer/snap-iBOqhRtA.js +1 -0
- package/dist/viewer/split-CxmPPvad.js +2 -0
- package/dist/viewer/{stable-DP74aChD.js → stable-CK-LXZNI.js} +1 -1
- package/dist/viewer/{styles-BtwjIslZ.js → styles-Dtxz8FDa.js} +1 -1
- package/dist/viewer/transport-ork1P0iQ.js +1 -0
- package/dist/viewer/url-Buh8E05T.js +29 -0
- package/dist/viewer/{useArtifactFeed-CYcXA6yE.js → useArtifactFeed-lKf4zuoV.js} +1 -1
- package/dist/viewer/useCommentPrimary-YlizG1nk.js +1 -0
- package/dist/viewer/useDrafts-WX84YtG1.js +1 -0
- package/dist/viewer/{useLayerZIndex-C1JpT09z.js → useLayerZIndex-C75Wfz8T.js} +1 -1
- package/dist/viewer/useRefBoard-0QUs4dWN.js +1 -0
- package/dist/viewer/{useStoryboardData-CbleqK_E.js → useStoryboardData-BYHJhILA.js} +1 -1
- package/dist/viewer/{view-Bw41z8XN.js → view-BOFvn2hm.js} +1 -1
- package/dist/viewer/view-drafts-DXKEb89H.js +1 -0
- package/dist/viewer/{viewport-CFJHn_Y6-GTpeksto.js → viewport-CFJHn_Y6-B_DJWWd0.js} +1 -1
- package/package.json +2 -2
- package/dist/viewer/ArtboardLayout-BNViVZgT.js +0 -14
- package/dist/viewer/ArtifactList-3kGz4_Vv.js +0 -2
- package/dist/viewer/DocumentLayout-BxFYyKFq.js +0 -2
- package/dist/viewer/DocumentPage-CP8Qy9Ae.js +0 -5
- package/dist/viewer/DropdownMenu-Dza6-jeN.js +0 -1
- package/dist/viewer/MenuSubmenuTrigger-CLeiXsan.js +0 -1
- package/dist/viewer/PreviewArtifactLayout-NXoiF_BV.js +0 -1
- package/dist/viewer/PreviewLayout-eg8-py8p.js +0 -2
- package/dist/viewer/ReportLayout-w7Tkbjp6.js +0 -6
- package/dist/viewer/SelectScrollUpArrow-BFRXZrFq.js +0 -1
- package/dist/viewer/SlidesLayout-B1mwiNJH.js +0 -12
- package/dist/viewer/StoryboardLayout-CWuqD7XK.js +0 -1
- package/dist/viewer/ThreadView-DTGR5uqU.js +0 -1
- package/dist/viewer/VerifyLayout-DtRz6K2y.js +0 -1
- package/dist/viewer/WhiteboardEditor-DrHOvXez-Bd1MyHmC.js +0 -22
- package/dist/viewer/WhiteboardLayout-D-gmpAvD.js +0 -4
- package/dist/viewer/agentLook-BPPrbQJ3.js +0 -1
- package/dist/viewer/auto-publish-DK402eHG.js +0 -1
- package/dist/viewer/channel-RZcAq9dq.js +0 -4
- package/dist/viewer/comments-DUAz1Q9X.js +0 -1
- package/dist/viewer/dist-BjB8i81Z.js +0 -1
- package/dist/viewer/local-split-host-CeKHc_JX.js +0 -1
- package/dist/viewer/settings-BQ3tJuXQ.js +0 -1
- package/dist/viewer/snap-Dh3ZoMla.js +0 -1
- package/dist/viewer/split-BZPaH4G4.js +0 -2
- package/dist/viewer/transport-7BF3TWU4.js +0 -1
- package/dist/viewer/url-BaZreTXB.js +0 -29
- package/dist/viewer/useArtifactSocket-CZwBSmOD.js +0 -1
- package/dist/viewer/useRefBoard-Cj5dzC4F.js +0 -1
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{A as t,E as n,T as r}from"./route-BEA0O_Ry.js";import{t as i}from"./react-DlmbjZJV.js";import{$ as a,$n as o,$t as s,Cr as c,Dr as l,Er as u,In as d,Kt as f,Ln as p,Or as m,Q as h,Qt as g,Rn as _,Sn as v,Sr as y,Tn as b,Tr as x,Wn as S,X as C,Xt as w,Yt as T,Z as E,Zt as D,ar as ee,en as te,et as ne,hr as re,in as ie,kr as ae,mr as oe,nn as se,nt as ce,pr as le,tn as ue,tt as de,ur as fe,vr as pe,wn as me,wr as he}from"./url-BaZreTXB.js";import{t as ge}from"./jsx-runtime-LKYXHABd.js";import{$ as _e,$r as ve,An as ye,B as be,Br as xe,Dn as Se,En as Ce,Ft as we,Gn as Te,Gr as Ee,Gt as De,It as Oe,J as ke,Kr as Ae,Mn as je,O as Me,Pn as Ne,Qr as Pe,R as Fe,S as Ie,Sr as Le,T as Re,Tr as ze,V as Be,Vr as Ve,Xn as He,Xr as Ue,Yr as We,Zr as Ge,_n as Ke,_r as qe,an as Je,cn as Ye,ct as Xe,dr as Ze,ei as Qe,fn as $e,hn as et,hr as tt,i as nt,kr as rt,ni as it,on as at,or as ot,pt as st,qt as ct,rr as lt,sn as ut,ti as dt,v as ft,vn as pt,wr as mt,xr as ht,zn as gt,zr as _t}from"./useLayerZIndex-C1JpT09z.js";import{Dt as vt}from"./MotionConfigContext-BqjwrGj9.js";import{A as yt,C as bt,D as xt,E as St,M as Ct,N as wt,P as Tt,S as Et,T as Dt,_ as Ot,b as kt,c as At,d as jt,j as Mt,k as Nt,l as Pt,s as Ft,u as It,v as Lt,w as Rt}from"./Popover-HS6yjzxl.js";import{t as zt}from"./chevron-right-DBC0wrKu.js";import{i as Bt,n as Vt,r as Ht,t as Ut}from"./stringifyLocale-VcrwrbQl.js";import{t as Wt}from"./code-CTMZ5SpG.js";import{A as Gt,F as Kt,M as qt,N as Jt,O as Yt,P as Xt,S as Zt,_ as Qt,a as $t,b as en,c as O,d as tn,f as nn,g as rn,h as an,i as on,j as sn,k as cn,m as ln,n as un,o as dn,p as fn,r as pn,s as mn,t as hn,u as gn,v as _n,w as vn,x as yn,y as bn}from"./SelectScrollUpArrow-BFRXZrFq.js";import{i as xn,n as Sn,r as Cn,t as k}from"./zoom-out-Cz3087-F.js";import{a as wn,c as Tn,i as En,n as Dn,o as On,r as kn,s as An,t as jn}from"./text-align-start-CO9CK_EW.js";import{a as Mn,i as Nn,n as Pn,t as Fn}from"./ruler-DmQbsUQf.js";import{t as In}from"./maximize-2-Deo2WY_L.js";import{t as Ln}from"./mouse-pointer-2-naHRayvu.js";import{n as Rn,r as zn,t as Bn}from"./undo-2-BH3P-I_n.js";import{t as Vn}from"./plus-C3ivaMGn.js";import{C as Hn,_ as Un,a as Wn,b as Gn,c as Kn,d as qn,f as Jn,g as Yn,h as Xn,i as Zn,l as Qn,m as $n,n as er,o as tr,p as nr,r as rr,s as ir,t as ar,u as or,v as sr,y as cr}from"./MenuSubmenuTrigger-CLeiXsan.js";var lr={name:`activity`,size:24,node:[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]};lr.node;var ur=vt(lr),dr={name:`arrow-down-to-line`,size:24,node:[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]};dr.node;var fr=vt(dr),pr={name:`arrow-up-to-line`,size:24,node:[[`path`,{d:`M5 3h14`,key:`7usisc`}],[`path`,{d:`m18 13-6-6-6 6`,key:`1kf1n9`}],[`path`,{d:`M12 7v14`,key:`1akyts`}]]};pr.node;var mr=vt(pr),hr={name:`dot`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]};hr.node;var gr=vt(hr),_r={name:`equal`,size:24,node:[[`line`,{x1:`5`,x2:`19`,y1:`9`,y2:`9`,key:`1nwqeh`}],[`line`,{x1:`5`,x2:`19`,y1:`15`,y2:`15`,key:`g8yjpy`}]]};_r.node;var vr=vt(_r),yr={name:`grip-horizontal`,size:24,node:[[`circle`,{cx:`12`,cy:`9`,r:`1`,key:`124mty`}],[`circle`,{cx:`19`,cy:`9`,r:`1`,key:`1ruzo2`}],[`circle`,{cx:`5`,cy:`9`,r:`1`,key:`1a8b28`}],[`circle`,{cx:`12`,cy:`15`,r:`1`,key:`1e56xg`}],[`circle`,{cx:`19`,cy:`15`,r:`1`,key:`1a92ep`}],[`circle`,{cx:`5`,cy:`15`,r:`1`,key:`5r1jwy`}]]};yr.node;var br=vt(yr),xr={name:`group`,size:24,node:[[`path`,{d:`M3 7V5c0-1.1.9-2 2-2h2`,key:`adw53z`}],[`path`,{d:`M17 3h2c1.1 0 2 .9 2 2v2`,key:`an4l38`}],[`path`,{d:`M21 17v2c0 1.1-.9 2-2 2h-2`,key:`144t0e`}],[`path`,{d:`M7 21H5c-1.1 0-2-.9-2-2v-2`,key:`rtnfgi`}],[`rect`,{width:`7`,height:`5`,x:`7`,y:`7`,rx:`1`,key:`1eyiv7`}],[`rect`,{width:`7`,height:`5`,x:`10`,y:`12`,rx:`1`,key:`1qlmkx`}]]};xr.node;var Sr=vt(xr),Cr={name:`hash`,size:24,node:[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]};Cr.node;var wr=vt(Cr),Tr={name:`highlighter`,size:24,node:[[`path`,{d:`m9 11-6 6v3h9l3-3`,key:`1a3l36`}],[`path`,{d:`m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4`,key:`14a9rk`}]]};Tr.node;var Er=vt(Tr),Dr={name:`letter-h`,size:24,node:[[`path`,{d:`M18 20V4`,key:`o2hl4u`}],[`path`,{d:`M6 12H18`,key:`1fx1vx`}],[`path`,{d:`M6 20V4`,key:`1w1bmo`}]],aliases:[`heading`]};Dr.node;var Or=vt(Dr),kr={name:`list-ordered`,size:24,node:[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]};kr.node;var Ar=vt(kr),jr={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};jr.node;var Mr=vt(jr),Nr={name:`move-right`,size:24,node:[[`path`,{d:`M18 8L22 12L18 16`,key:`1r0oui`}],[`path`,{d:`M2 12H22`,key:`1m8cig`}]]};Nr.node;var Pr=vt(Nr),Fr={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};Fr.node;var Ir=vt(Fr),Lr={name:`scan-search`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`m16 16-1.9-1.9`,key:`1dq9hf`}]]};Lr.node;var Rr=vt(Lr),zr={name:`slash`,size:24,node:[[`path`,{d:`M22 2 2 22`,key:`y4kqgn`}]]};zr.node;var Br=vt(zr),Vr={name:`spline`,size:24,node:[[`circle`,{cx:`19`,cy:`5`,r:`2`,key:`mhkx31`}],[`circle`,{cx:`5`,cy:`19`,r:`2`,key:`v8kfzx`}],[`path`,{d:`M5 17A12 12 0 0 1 17 5`,key:`1okkup`}]]};Vr.node;var Hr=vt(Vr),Ur={name:`squircle`,size:24,node:[[`path`,{d:`M12 3c7.2 0 9 1.8 9 9s-1.8 9-9 9-9-1.8-9-9 1.8-9 9-9`,key:`garfkc`}]]};Ur.node;var Wr=vt(Ur),Gr={name:`strikethrough`,size:24,node:[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]};Gr.node;var Kr=vt(Gr),qr={name:`ungroup`,size:24,node:[[`rect`,{x:`11`,y:`14`,width:`10`,height:`7`,rx:`2`,key:`nfm8rk`}],[`rect`,{x:`3`,y:`3`,width:`10`,height:`7`,rx:`2`,key:`1ljebb`}]]};qr.node;var Jr=vt(qr),Yr={name:`waypoints`,size:24,node:[[`path`,{d:`m10.586 5.414-5.172 5.172`,key:`4mc350`}],[`path`,{d:`m18.586 13.414-5.172 5.172`,key:`8c96vv`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`circle`,{cx:`12`,cy:`20`,r:`2`,key:`144qzu`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}],[`circle`,{cx:`20`,cy:`12`,r:`2`,key:`1xzzfp`}],[`circle`,{cx:`4`,cy:`12`,r:`2`,key:`1hvhnz`}]]};Yr.node;var Xr=vt(Yr),A=e(i(),1),j=ge(),Zr=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=A.useMemo(()=>({open:t,close:n}),[t,n]);return(0,j.jsx)(bt.Provider,{value:t,children:(0,j.jsx)(xt,{delay:i,timeoutMs:r,children:e.children})})},Qr=class extends St{constructor(){super(Dt(),`Tooltip`)}open(e){this.openByTrigger(e)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select(`open`)??!1}};function $r(){return new Qr}var ei=A.createContext(void 0);function ti(){let e=A.useContext(ei);if(e===void 0)throw Error(Ue(34));return e}var ni=A.forwardRef(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l,...u}=e,[d,f]=A.useState(void 0),[p,m]=ae({controlled:i,default:a,name:`MenuRadioGroup`}),h=dt((e,t)=>{o?.(e,t),t.isCanceled||m(e)}),g=Ee(`div`,e,{state:{disabled:s},ref:t,props:{role:`group`,"aria-labelledby":l??d,"aria-disabled":s||void 0,...u}}),_=A.useMemo(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return(0,j.jsx)(nr.Provider,{value:f,children:(0,j.jsx)(ei.Provider,{value:_,children:g})})}),ri=A.memo(A.forwardRef(function(e,t){let n=cr()?.RadioGroup??ni;return(0,j.jsx)(n,{...e,ref:t})})),ii=A.createContext(void 0);function ai(){let e=A.useContext(ii);if(e===void 0)throw Error(Ue(35));return e}var oi=A.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:u,style:d,...f}=e,{store:p}=Hn(),{value:m,setValue:h,disabled:g}=ti(),_=l({guess:!0,label:a}),v=Ve(i),y=p.useState(`isActive`,_.index),b=p.useState(`floatingNodeId`),x=p.useState(`itemProps`),S=p.useState(`disabled`),C=s||g||S,w=m===u,{getItemProps:T,itemRef:E}=sr({closeOnClick:c,disabled:C,highlighted:y,id:v,store:p,nativeButton:o,nodeId:b,itemMetadata:Un}),D=A.useMemo(()=>({disabled:C,highlighted:y,checked:w}),[C,y,w]);function ee(e){let t=_t(ze,e.nativeEvent,void 0,{preventUnmountOnClose:Qe});h(u,t)}let te=Ee(`div`,e,{state:D,stateAttributesMapping:Yn,props:[x,{role:`menuitemradio`,"aria-checked":w,onClick:ee},f,T],ref:[E,t,_.ref]});return(0,j.jsx)(ii.Provider,{value:D,children:te})}),si=A.forwardRef(function(e,t){let n=Gn(e,t);return n.visible?(0,j.jsx)(oi,{...e,ref:n.ref}):null}),ci=A.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=ai(),c=A.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=ot(s.checked);Se({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}});let f={checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l};return Ee(`span`,e,{state:f,stateAttributesMapping:Yn,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||u})}),li=e(t(),1),ui=new Map;function di(e={}){let{locale:t,...n}=e,r={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...n},i=`${Ut(t)}|${JSON.stringify(r)}`,a=ui.get(i);if(a)return a;let o=new Intl.Collator(t,r),s={contains(e,t,n){if(!t)return!0;let r=sn(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(o.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=sn(e,n);return o.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=sn(e,n),i=t.length;return r.length>=i&&o.compare(r.slice(r.length-i),t)===0}};return ui.set(i,s),s}var fi=``;function pi(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null;for(;t.nextNode();){let e=t.currentNode;e.nodeValue!==``&&(n=e)}return n}function mi(e=!0){let t=je(),n=A.useRef(null);return A.useEffect(()=>{if(!e||pt)return;let r=n.current;if(r==null)return;let i=pi(r);if(i==null)return;let a=i.data,o=`${a}${fi}`;return i.nodeValue=o,t.start(200,()=>{i.nodeValue===o&&(i.nodeValue=a)}),()=>{t.clear(),i.nodeValue===o&&(i.nodeValue=a)}},[e,n,t]),n}function hi(e,t,n,r,i,a,o,s,c,l=2){let u=Xe(n.current,{event:e,orientation:r,loopFocus:i,rtl:a,cols:l,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:t>c?s:t,stopEvent:!0});return st(n.current,u)?void 0:u}var gi=A.createContext(void 0),_i=A.createContext(void 0),vi=A.createContext(void 0),yi=A.createContext(!1),bi=A.createContext(``);function xi(){let e=A.useContext(gi);if(!e)throw Error(Ue(22));return e}function Si(){let e=A.useContext(_i);if(!e)throw Error(Ue(23));return e}function Ci(){let e=A.useContext(vi);if(!e)throw Error(Ue(24));return e}function wi(){return A.useContext(bi)}function Ti(){return A.useContext(yi)}var Ei={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectionChips:e=>{let t=e.selectedValue;return Array.isArray(t)&&t.length>0},hasSelectedValue:e=>{let{selectedValue:t,selectionMode:n}=e;return t==null?!1:n===`multiple`&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?cn(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(e=>an(t,e,n)):an(t,r,n)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemRoot:e=>e.itemRoot,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight};function Di(e){return e==null?void 0:`${e}-popup`}function Oi(e,t){return(n,r)=>n!=null&&e.contains(n,r,t)}var ki=di;function Ai(e,t=!1){let{overflowY:n}=gt(e);return n!==`auto`&&n!==`scroll`?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}var ji=Symbol(`none`),Mi={value:ji,index:-1};function Ni(e,t,n){let r=e.get(t);if(r!==void 0||n===rn)return r;for(let[r,i]of e)if(an(r,t,n))return i}function Pi(e){let{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:a,defaultInputValue:s,inputValue:c,open:l,defaultOpen:u=!1,selectionMode:d,onItemHighlighted:p,name:m,form:h,disabled:g=!1,readOnly:_=!1,required:y=!1,inputRef:b,grid:x=!1,items:C,filteredItems:T,filter:E,filterQuery:te,openOnInputClick:ne=!0,autoHighlight:re=!1,keepHighlight:ie=!1,highlightItemOnHover:oe=!0,loopFocus:se=!0,itemToStringLabel:ce,itemToStringValue:le,isItemEqualToValue:de=rn,virtualized:fe=!1,inline:pe=!1,fillInputOnItemPress:he=!0,modal:ge=!1,limit:_e=-1,autoComplete:Se=`list`,formAutoComplete:Ce,locale:Ee,submitOnItemClick:De=!1}=e,{clearErrors:ke}=w(),{setDirty:je,validityData:Ne,setFilled:Be,name:Ve,disabled:Ke,setTouched:Xe,setFocused:Ze,validationMode:$e,validation:et}=ue(),tt=S(),nt=f({id:t}),ot=ki({locale:Ee}),st=Array.isArray(C)?null:C;if(st&&typeof st.label!=`function`)throw Error(Ue(100));let ct=st?st.data:C,lt=st?.value,ft=lt?void 0:ct,pt=A.useMemo(()=>{if(!T||!lt)return;let e=Yt(T),t=e.map(lt),n;return{values:t,findItem(r,i){if(!n){n=new Map;for(let r=0;r<t.length;r+=1)n.has(t[r])||n.set(t[r],e[r])}return Ni(n,r,i)}}},[T,lt]),gt=A.useMemo(()=>st?e=>st.label(e,de,e=>{let t=pt?.findItem(e,de);return t==null?sn(e,ce):st.itemLabel(t)}):ce,[st,ce,pt,de]),vt=A.useMemo(()=>st?Object.assign(e=>st.itemLabel(e),{selected:e=>sn(e,gt)}):ce,[st,gt,ce]);function yt(e){return sn(e,gt)}let[bt,xt]=A.useState(!1),[St,Ct]=A.useState(null),wt=A.useRef(St),Tt=A.useRef([]),Et=A.useRef([]),Dt=A.useRef(null),Ot=A.useRef(null),kt=A.useRef(null),At=A.useRef(null),jt=A.useRef(null),Mt=A.useRef(!1),Nt=A.useRef(null),Pt=A.useRef(null),Ft=A.useRef(null),It=A.useRef(Mi),Lt=A.useRef(null),Rt=A.useRef([]),zt=A.useRef(null),Bt=Ke||g,Vt=Ve??m,Ht=d===`multiple`,Ut=d===`single`,Wt=c!==void 0||s!==void 0,Kt=ct!==void 0,Xt=T!==void 0,$t;$t=re===`always`?`always`:re?`input-change`:!1;let[O,tn]=ae({controlled:i,default:Ht?r??Pe:r,name:`Combobox`,state:`selectedValue`}),nn=A.useMemo(()=>E===null?()=>!0:E===void 0?Oi(ot,vt):E,[E,ot,vt]),on=it(()=>Wt?s??``:Ut?yt(O):``).current,[cn,ln]=ae({controlled:c,default:on,name:`Combobox`,state:`inputValue`}),[un,dn]=ae({controlled:l,default:u,name:`Combobox`,state:`open`}),fn=Gt(ct),pn=!un&&St!==null?St:String(cn).trim(),mn=Ut?yt(O):``,hn=Ut&&!bt&&pn!==``&&mn.length===pn.length&&ot.contains(mn,pn),gn=hn?``:te??pn,yn=Kt&&Xt&&hn&&(!st||st.hasValue(O,de)),xn=A.useMemo(()=>ct?Yt(ct):Pe,[ct]),Sn=A.useMemo(()=>{if(T&&!yn)return T;if(!ct)return Pe;if(fn){let e=ct,t=[],n=0;for(let r of e){if(_e>-1&&n>=_e)break;let e=_e>-1?_e-n:1/0,i=gn===``?r.items.slice(0,e):[];if(gn!==``)for(let t of r.items){if(i.length>=e)break;nn(t,gn,vt)&&i.push(t)}if(i.length>0){let e={...r,items:i};t.push(e),n+=i.length}}return t}if(gn===``)return _e>-1?xn.slice(0,_e):xn;let e=[];for(let t of xn){if(_e>-1&&e.length>=_e)break;nn(t,gn,vt)&&e.push(t)}return e},[T,yn,ct,fn,gn,_e,nn,vt,xn]),Cn=A.useMemo(()=>{if(pt&&Sn===T)return pt.values;let e=Yt(Sn);return lt?e.map(e=>lt(e)):e},[Sn,T,pt,lt]),k=it(()=>{let e=null;return pe&&un&&Kt&&d!==`none`&&(e=_n(Cn,O,de,Ht)),new Ie({id:nt,labelId:void 0,selectedValue:O,open:un,items:ft,selectionMode:d,name:Vt,form:h,disabled:Bt,readOnly:_,required:y,grid:x,virtualized:fe,openOnInputClick:ne,itemToStringLabel:gt,isItemEqualToValue:de,modal:ge,autoHighlight:$t,submitOnItemClick:De,hasInputValue:Wt,mounted:!1,forceMounted:!1,transitionStatus:`idle`,inline:pe,activeIndex:null,selectedIndex:e,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemRoot:{props:ve,id:nt,selectionMode:d,disabled:Bt,readOnly:_,isItemEqualToValue:de},positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:d===`none`},{onOpenChangeComplete:Qe,setOpen:Qe,setInputValue:Qe,setSelectedValue:Qe,setIndices:Qe,handleSelection:Qe,forceMount:Qe,requestSubmit:Qe,listRef:Tt,labelsRef:Et,popupRef:Dt,emptyRef:jt,inputRef:Ot,startDismissRef:kt,endDismissRef:At,chipsContainerRef:Nt,clearRef:Pt,valuesRef:Rt,pointerDownItemRef:zt,selectionEventRef:Ft},Ei)}).current,wn=d===`none`?cn:O,Tn=A.useMemo(()=>d===`none`?wn:Array.isArray(O)?O.map(e=>qt(e,le)):qt(O,le),[wn,le,d,O]),En=dt(p),Dn=dt(n),On=k.useState(`activeIndex`),kn=k.useState(`selectedIndex`),An=k.useState(`positionerElement`),jn=k.useState(`listElement`),Mn=k.useState(`triggerElement`),Nn=k.useState(`inputElement`),Pn=k.useState(`inputGroupElement`),Fn=k.useState(`inline`),In=k.useState(`inputInsidePopup`),Ln=k.useState(`inputOwnsFormValue`),Rn=Ut&&!In&&cn===mn,zn=ye(Mn),{openMethod:Bn,triggerProps:Vn}=v(un),Hn=dt(()=>Tn);D(In?zn:Ot,nt,wn,Hn,!Bt,m);let Un=dt(()=>{ct?Et.current=Cn.map(yt):k.set(`forceMounted`,!0)}),Wn=dt((e,t,n,r)=>{if(t===-1){if(It.current===Mi)return;It.current=Mi}else It.current={value:e,index:t};En(e,xe(n,r,{index:t}))}),Gn=dt(e=>{let t={};e.activeIndex!==void 0&&(t.activeIndex=e.activeIndex),e.selectedIndex!==void 0&&(t.selectedIndex=e.selectedIndex),k.update(t);let n=e.activeIndex;if(n===void 0)return;let r=e.type||`none`;n===null?Wn(void 0,-1,r,e.event):Wn(Rt.current[n],n,r,e.event)}),Kn=dt((t,n)=>{if(e.onInputValueChange?.(t,n),!n.isCanceled){if(Mt.current=n.reason===Le,n.reason===`input-change`){un&&St!==null&&Ct(null);let e=n.event,r=e.inputType;if(e.type===`compositionend`||r!=null&&r!==``&&r!==`insertReplacementText`){let e=t.trim()!==``;e&&xt(!0),Lt.current={hasQuery:e};let n=k.state.listElement;if(!k.state.virtualized&&n){let e=Dt.current;for(let t of Te(n.firstElementChild??n)){if(!He(t)||(e?!ut(e,t):t.getAttribute(`role`)===`dialog`))break;if(Ai(t)){t.scrollTop=0;break}}}e&&$t&&k.state.activeIndex==null&&(un||Fn)&&k.set(`activeIndex`,0)}}else n.reason===`input-clear`&&t===``&&k.state.inputInsidePopup&&(Lt.current={hasQuery:!1,selection:!0});ln(t)}}),qn=dt(e=>{let t=!e&&In&&!Fn&&cn!==``&&(String(cn).trim()===St||cn===mn);!e&&(t||cn===``||Rn)&&xt(!1),Ct(null),t&&Kn(``,_t(Le))}),[Jn,Yn]=A.useState(!1),Xn=dt((t,n)=>{if(un===t)return;n.reason===`escape-key`&&Kt&&Cn.length===0&&!jt.current&&n.allowPropagation();let r=n,i=Me(r);if(e.onOpenChange?.(t,r),Lt.current?.hasQuery&&n.reason===`input-change`===n.isCanceled&&(Lt.current=null),!n.isCanceled&&(t&&St!==null&&qn(n.reason===ht),!t&&bt&&(Ut?(Fn||Ct(pn),pn===``&&xt(!1)):Ht&&(Fn||Ct(pn),In&&Gn({activeIndex:null}),(!In||Fn)&&Kn(``,_t(Le,n.event,void 0,{isItemPress:n.reason===ze})))),t||Yn(i()),dn(t),!t&&In&&(n.reason===`focus-out`||n.reason===`outside-press`)&&(Xe(!0),Ze(!1),$e===`onBlur`))){let e=d===`none`?cn:O;et.commit(e)}}),Zn=dt((e,t)=>{a?.(e,t),t.isCanceled||(tn(e),(d===`none`&&Dt.current&&he||Ut&&!k.state.inputInsidePopup)&&Kn(yt(e),_t(t.reason,t.event)))}),Qn=dt((e,t)=>{let n=Ye(e),r=Ft.current??e;Ft.current=null;let i=_t(ze,r),a=at(n,`a`)?.getAttribute(`href`);if(a)a.startsWith(`#`)&&Xn(!1,i);else if(Ht){let e=Array.isArray(O)?O:[],n=Zt(e,t,de),r=n?en(e,t,de):[...e,t];if(Zn(r,i),i.isCanceled||!(Ot.current&&Ot.current.value.trim()!==``))return;if(k.state.inputInsidePopup){Kn(``,_t(Le,i.event,void 0,{isItemPress:!0}));let e=Lt.current;e&&!n&&(e.toggledValue=t)}else Xn(!1,i)}else{if(Zn(t,i),i.isCanceled)return;Xn(!1,i)}}),$n=dt(()=>{let e=et.inputRef.current?.form??k.state.inputElement?.form;e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}),er=dt(()=>{if(Dn?.(!1),xt(!1),Ct(null),Gn(d===`none`?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Ht&&Ot.current&&Ot.current.value!==``&&!Mt.current&&Kn(``,_t(Le)),Ut){if(k.state.inputInsidePopup)Ot.current&&Ot.current.value!==``&&Kn(``,_t(Le));else{let e=yt(O);Ot.current&&Ot.current.value!==e&&Kn(e,_t(e===``?Le:rt))}}}),nr=A.useMemo(()=>Fn&&An?{current:at(An,`[role="dialog"]`)}:Dt,[Fn,An]),{mounted:rr,transitionStatus:ir,forceUnmount:ar}=Fe({open:un,ref:nr,preventUnmountOnClose:Jn,setPreventUnmountOnClose:Yn,onUnmount:er});A.useImperativeHandle(e.actionsRef,()=>({unmount:ar,close:()=>Xn(!1,_t(qe))}),[ar,Xn]),Ge(function(){let e=wt.current!==null&&St===null;if(wt.current=St,un&&(!e||!Kt)||(un||(zt.current=null),d===`none`))return;let t=Kt?Cn:Rt.current;Gn({selectedIndex:_n(t,O,de,Ht)})},[un,St,O,d,Ht,Kt,Cn,de,Gn]),Ge(()=>{ct&&(Rt.current=Cn,Tt.current.length=Cn.length)},[ct,Cn]),Ge(()=>{!un&&Lt.current?.hasQuery&&(Lt.current=null)},[un]),Ge(()=>{if(!un&&Fn&&nr.current){Lt.current=null;return}let e=Kt||Xt?Cn:Rt.current,t=Lt.current;if(t){let n=un||Fn||k.state.positionerElement?.hidden===!1;if(t.hasQuery){let t=Ot.current;!$t||String(cn).trim()===``||Fn&&$t!==`always`&&(!t||Je(t.ownerDocument)!==t)?Lt.current=null:n&&(e[0]!==void 0||!Kt&&!Xt)&&(k.set(`activeIndex`,0),Lt.current=null)}else if(String(cn).trim()===``&&(Lt.current=null,n)){let e=t.selection;$t===`always`&&!e&&k.state.selectionMode===`none`&&k.set(`activeIndex`,0),queueMicrotask(()=>{if(!k.state.open&&(!k.state.inline||nr.current)||Ot.current&&Ot.current.value.trim()!==``)return;let n=k.state.selectedValue,r=k.state.selectionMode===`multiple`;if(r&&Array.isArray(n)?n.length>0:k.state.selectionMode!==`none`&&n!=null){let e=Kt||Xt?Cn:Rt.current,i=Qt(e,t.toggledValue,k.state.isItemEqualToValue);k.set(`activeIndex`,i===-1?_n(e,n,k.state.isItemEqualToValue,r):i)}else e?k.set(`activeIndex`,null):$t===`always`&&k.set(`activeIndex`,0)})}}if(!un&&!Fn)return;let n=k.state.activeIndex;if(n==null){if($t===`always`&&e.length>0){k.set(`activeIndex`,0);return}Wn(void 0,-1,rt);return}if(n>=e.length){Wn(void 0,-1,rt),k.set(`activeIndex`,null);return}let r=e[n],i=It.current.value,a=i!==ji&&an(r,i,k.state.isItemEqualToValue);It.current.index===n&&a||Wn(r,n,rt)},[On,$t,Wn,Xt,Kt,Cn,Fn,un,nr,k,cn]),Ge(()=>{Be(d===`none`?String(cn)!==``:Ht?Array.isArray(O)&&O.length>0:O!=null)},[Be,d,cn,O,Ht]),A.useEffect(()=>{Kt&&$t&&Cn.length===0&&Gn({activeIndex:null})},[Kt,$t,Cn.length,Gn]);function or(){un&&pn!==``&&pn!==String(on)&&!Rn&&xt(!0)}function sr(){un&&St!==null&&qn(!1)}let cr=!1;function lr(){!cr&&cn!==mn&&(cr=!0,Kn(mn,_t(rt)))}function ur(){d!==`none`&&(ke(Vt),je(bn(O,Ne.initialValue,de)),et.change(O),Ut&&!Wt&&!In&&lr())}function dr(){Ut&&!Wt&&!In&&!bt&&lr()}function fr(){d===`none`&&(ke(Vt),je(cn!==Ne.initialValue),et.change(cn))}me(pn,or),me(un,sr),me(O,ur),me(mn,dr),me(ct,dr),me(cn,fr);let pr=Jt({open:Fn?!0:un,onOpenChange:Xn,elements:{reference:In?Mn:Nn,floating:An}}),mr=x?`grid`:`listbox`,hr=un||Fn,gr=hr?`true`:`false`,_r=A.useMemo(()=>{let e=Nn?.tagName===`INPUT`,t=Nn==null||e,n=t||hr,r=t?{autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`}:{};return n&&(r.role=`combobox`,r[`aria-expanded`]=gr,r[`aria-haspopup`]=mr,r[`aria-controls`]=hr?jn?.id:void 0,r[`aria-autocomplete`]=_?`none`:Se),{reference:r,floating:{role:`presentation`}}},[Nn,hr,gr,mr,jn?.id,Se,_]),vr=ee(pr,{enabled:!Bt&&ne,event:`mousedown-only`,toggle:!1,touchOpenDelay:In?0:100,reason:mt}),yr=be(pr,{enabled:!Bt&&!Fn,outsidePressEvent:{mouse:`sloppy`,touch:`intentional`},bubbles:Fn?!0:void 0,outsidePress(e){let t=Ye(e);return!ut(Mn,t)&&!ut(Pt.current,t)&&!ut(Nt.current,t)&&!ut(Pn,t)}}),br=o(pr,{enabled:!Bt,id:nt,listRef:Tt,activeIndex:On,selectedIndex:kn,virtual:!0,loopFocus:se,allowEscape:se&&!$t,focusItemOnOpen:bt||d===`none`&&!$t?!1:`auto`,focusItemOnHover:oe,resetOnPointerLeave:!ie,orientation:x?`horizontal`:void 0,rtl:tt===`rtl`,disabledIndices:Pe,grid:x?hi:void 0,onNavigate(e,t){(t||un||Fn&&e===null)&&ir!==`ending`&&Gn({activeIndex:e,type:tr(t),event:t?.nativeEvent})}}),xr=A.useMemo(()=>Ae(br.reference,{onKeyDown(e){x&&k.state.activeIndex==null&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&e.preventBaseUIHandler()}},yr.reference,vr.reference,_r.reference),[br.reference,yr.reference,vr.reference,_r.reference,x,k]),Sr=A.useMemo(()=>Ae(Re,yr.floating),[yr.floating]),Cr=A.useMemo(()=>Ae(br.floating,_r.floating),[br.floating,_r.floating]),wr=A.useMemo(()=>{let e=br.item;return{props:e?{...e,onFocus:void 0}:ve,id:nt,selectionMode:d,disabled:Bt,readOnly:_,isItemEqualToValue:de}},[br.item,nt,d,Bt,_,de]);k.useContextCallback(`setOpen`,Xn),k.useContextCallback(`setInputValue`,Kn),k.useContextCallback(`setSelectedValue`,Zn),k.useContextCallback(`setIndices`,Gn),k.useContextCallback(`handleSelection`,Qn),k.useContextCallback(`forceMount`,Un),k.useContextCallback(`requestSubmit`,$n),k.useContextCallback(`onOpenChangeComplete`,n),vn(()=>{k.update({inline:pe,popupProps:Sr,listProps:Cr,inputProps:xr,triggerProps:Vn,itemRoot:wr})});let Tr={id:nt,selectedValue:O,open:un,mounted:rr,transitionStatus:ir,items:ft,inline:pe,popupProps:Sr,listProps:Cr,inputProps:xr,triggerProps:Vn,itemRoot:wr,openMethod:Bn,selectionMode:d,name:Vt,form:h,disabled:Bt,readOnly:_,required:y,grid:x,virtualized:fe,openOnInputClick:ne,itemToStringLabel:gt,modal:ge,autoHighlight:$t,isItemEqualToValue:de,submitOnItemClick:De,hasInputValue:Wt};Ge(()=>{k.update({...Tr,inputOwnsFormValue:d===`none`&&(pe||!k.state.inputInsidePopup)})},[k,...Object.values(Tr)]);let Er=We(b,et.inputRef),Dr=A.useMemo(()=>({query:pn,hasItems:Kt,filteredItems:Sn,flatFilteredValues:Cn}),[pn,Kt,Sn,Cn]),Or=A.useMemo(()=>Array.isArray(wn)?``:qt(wn,le),[wn,le]),kr=Ht&&Array.isArray(O)&&O.length>0,Ar=Ht||d===`none`&&Ln?void 0:Vt,jr=A.useMemo(()=>!Ht||!Array.isArray(O)||!Vt?null:O.map(e=>{let t=qt(e,le);return(0,j.jsx)(`input`,{type:`hidden`,form:h,name:Vt,value:t,disabled:Bt},t)}),[Ht,O,h,Vt,le,Bt]),Mr=(0,j.jsxs)(A.Fragment,{children:[e.children,(0,j.jsx)(`input`,{...et.getValidationProps(Bt,{onFocus(){In?Mn?.focus():(Ot.current||Mn)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||Bt||_)return;let t=e.currentTarget.value,n=t.toLowerCase(),r=_t(rt,e.nativeEvent),i=()=>Rt.current.findIndex(e=>qt(e,le).toLowerCase()===n||yt(e).toLowerCase()===n);function a(){if(Ht)return;if(d===`none`){Kn(t,r);return}let e=i();e===-1&&(e=Rt.current.findIndex((e,t)=>{let r=Et.current[t];return r!=null&&r.toLowerCase()===n}));let a=e===-1?void 0:Rt.current[e];a!=null&&Zn?.(a,r)}Ut&&(Un(),ct&&i()===-1&&k.set(`forceMounted`,!0)),queueMicrotask(a)}}),id:nt&&Ar==null?`${nt}-hidden-input`:void 0,form:h,name:Ar,autoComplete:Ce,disabled:Bt,required:y&&!kr,readOnly:_,value:Or,ref:Er,style:Ar?Oe:we,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),jr]});return(0,j.jsx)(gi.Provider,{value:k,children:(0,j.jsx)(_i.Provider,{value:pr,children:(0,j.jsx)(yi.Provider,{value:Kt,children:(0,j.jsx)(vi.Provider,{value:Dr,children:(0,j.jsx)(bi.Provider,{value:cn,children:Mr})})})})})}var Fi=`data-popup-side`,Ii=`data-list-empty`,Li={...ct,...ie,popupSide:e=>e?{[Fi]:e}:null,listEmpty:e=>e?{[Ii]:``}:null};function Ri(e){let t=e.useState(`mounted`),n=e.useState(`popupSide`),r=e.useState(`positionerElement`);return t&&r?n:null}function zi(){return Ci().filteredItems.length===0}function Bi(e){return e===`rtl`?[`ArrowRight`,`ArrowLeft`]:[`ArrowLeft`,`ArrowRight`]}function Vi(e,t,n){let r=e.context.listRef.current[t];r&&(e.context.selectionEventRef.current=n,r.click(),e.context.selectionEventRef.current=null)}var Hi=A.createContext(void 0);function Ui(){return A.useContext(Hi)}var Wi=A.createContext(void 0);function Gi(e){let t=A.useContext(Wi);if(t===void 0&&!e)throw Error(Ue(21));return t}var Ki=A.forwardRef(function(e,t){let n=xi(),{buttonRef:r,getButtonProps:i}=Ne({native:!1}),a=We(t,r);function o(e){n.context.setOpen(!1,_t(Ze,e.nativeEvent,e.currentTarget))}let s=i({onClick:o});return(0,j.jsx)(`span`,{ref:a,...s,"aria-label":`Dismiss`,tabIndex:void 0,style:Oe})}),qi=A.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,id:a,style:o,...c}=e,{state:l,disabled:u,setTouched:d,validationMode:f,validation:p}=ue(),{labelId:m}=T(),h=Ui(),_=!!Gi(!0),v=xi(),y=wi(),b=S(),x=v.useState(`required`),C=v.useState(`disabled`),w=v.useState(`readOnly`),E=v.useState(`name`),D=v.useState(`form`),ee=v.useState(`selectionMode`),ne=v.useState(`autoHighlight`),re=v.useState(`inputProps`),ie=v.useState(`triggerProps`),ae=v.useState(`open`),oe=v.useState(`mounted`),ce=v.useState(`selectedValue`),le=v.useState(`id`),de=v.useState(`inline`),fe=v.useState(`modal`),pe=!!ne,me=Ri(v),he=u||C||i,ge=zi(),_e=g(he,v.context.inputRef),ve=_||de,ye=!ve||fe,be=Ve(a??(ve?void 0:le)),xe=_?se:l,[Se,Ce]=A.useState(null),we=A.useRef(!1),Te=A.useRef(null);Ge(()=>{ae||(Te.current=null)},[ae]);let De=ee===`none`&&!_,Oe=dt(e=>{let t=_||v.state.inline;t&&!v.state.hasInputValue&&v.context.setInputValue(``,_t(rt)),v.update({inputElement:e,inputInsidePopup:t,inputOwnsFormValue:De})}),ke=_?c:p.getValidationProps(he,c);function Ae(e){v.context.setIndices({activeIndex:null,selectedIndex:null,type:tr(e),event:e})}let je={...xe,open:ae,disabled:he,readOnly:w,popupSide:me,listEmpty:ge};function Me(e){if(!h)return;let t,n=h.chipsRef.current.length,[r]=Bi(b);return e.key===r&&(e.currentTarget.selectionStart??0)===0&&ce.length>0&&(e.preventDefault(),t=n>0?n-1:void 0),t}let Ne=Ee(`input`,e,{state:je,ref:[t,v.context.inputRef,Oe],props:[re,ie,{value:Se??y,"aria-readonly":w||void 0,"aria-required":x||void 0,"aria-labelledby":m,disabled:he,readOnly:w,required:ee===`none`?x:void 0,form:D,...De&&E&&{name:E},id:be,onFocus(){if(_e(!0),!de)return;let e=Te.current;Te.current=null,e!=null&&Object.hasOwn(v.context.valuesRef.current,e)&&v.context.setIndices({activeIndex:e})},onBlur(){d(!0),_e(!1);let e=v.state.activeIndex;if(de&&e!==null&&ne!==`always`&&(Te.current=e,v.context.setIndices({activeIndex:null})),f===`onBlur`){let e=ee===`none`?y:ce;p.commit(e)}},onCompositionStart(e){Ke||(we.current=!0,Ce(e.currentTarget.value))},onCompositionEnd(e){we.current=!1;let t=e.currentTarget.value;Ce(null),v.context.setInputValue(t,_t(ht,e.nativeEvent))},onChange(e){let t=e.nativeEvent,n=t.inputType,r=!n||n===`insertReplacementText`,i=we.current||!r;function a(e){!w&&!he&&e&&i&&(v.context.setOpen(!0,_t(ht,t)),pe||Ae(t))}if(we.current){let n=e.currentTarget.value;Ce(n),n===``&&!v.state.openOnInputClick&&!v.state.inputInsidePopup&&v.context.setOpen(!1,_t(Le,t));let r=n.trim(),i=pe&&r!==``;a(r),ae&&v.state.activeIndex!==null&&!i&&Ae(t);return}let o=_t(ht,t);if(v.context.setInputValue(e.currentTarget.value,o),o.isCanceled)return;let s=e.currentTarget.value===``,c=_t(Le,t);s&&!v.state.inputInsidePopup&&(ee===`single`&&v.context.setSelectedValue(null,c),v.state.openOnInputClick||v.context.setOpen(!1,c)),a(e.currentTarget.value.trim()),ae&&v.state.activeIndex!==null&&!pe&&Ae(t)},onKeyDown(e){if(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;if(he||w){w&&e.key===`Enter`&&ae&&v.state.activeIndex!==null&&$e(e);return}let t=e.currentTarget,n=t.scrollWidth-t.clientWidth,r=b===`rtl`;if(e.key===`Home`){$e(e);let n=et&&r?t.value.length:0;t.setSelectionRange(n,n),t.scrollLeft=0;return}if(e.key===`End`){$e(e);let i=et&&r?0:t.value.length;t.setSelectionRange(i,i),t.scrollLeft=r?-n:n;return}if(!oe&&e.key===`Escape`){let t=ee===`multiple`&&Array.isArray(ce)?ce.length===0:ce===null,n=_t(tt,e.nativeEvent),r=ee===`multiple`?[]:null;v.context.setInputValue(``,n),v.context.setSelectedValue(r,n),t||v.state.inline||n.isPropagationAllowed||e.stopPropagation();return}if(h&&e.key===`Backspace`&&t.value===``&&Array.isArray(ce)&&ce.length>0){let t=h.chipsRef.current.length,n=t>0?t-1:ce.length-1,r=ce.filter((e,t)=>t!==n);Ae(e.nativeEvent),v.context.setSelectedValue(r,_t(rt,e.nativeEvent));return}let i=Me(e);if(i!==void 0&&h?.chipsRef.current[i]?.focus(),e.which!==229&&e.key===`Enter`&&ae){let t=v.state.activeIndex,n=e.nativeEvent;if(t===null){if(de)return;v.context.setOpen(!1,_t(rt,n));return}$e(e),Vi(v,t,n)}}},ke],stateAttributesMapping:Li}),Pe=_?(0,j.jsx)(te.Provider,{value:s,children:Ne}):Ne;return(0,j.jsxs)(A.Fragment,{children:[ae&&ye&&(0,j.jsx)(Ki,{ref:v.context.startDismissRef}),Pe]})}),Ji=A.createContext(null);function Yi(){return A.useContext(Ji)}function Xi(e){let{children:t}=e,{filteredItems:n}=Ci(),r=Yi(),i=r?r.items:n;return(0,j.jsx)(A.Fragment,{children:i.map(t)})}var Zi=A.forwardRef(function(e,t){var n;let{render:r,className:i,style:a,children:o,...s}=e,c=xi(),l=Si(),u=!!Gi(!0),{filteredItems:d,hasItems:f}=Ci(),p=c.useState(`selectionMode`),h=c.useState(`grid`),g=c.useState(`readOnly`),_=c.useState(`listProps`),v=c.useState(`virtualized`),y=c.useState(`forceMounted`),b=p===`multiple`,x=d.length===0,S=dt(e=>{c.set(`positionerElement`,e)}),C=dt(e=>{c.set(`listElement`,e)}),w=A.useMemo(()=>typeof o==`function`?n||=(0,j.jsx)(Xi,{children:o}):o,[o]),T={empty:x},E=l.useState(`floatingId`),D=Ee(`div`,e,{state:T,ref:[t,C,u?null:S],props:[_,{children:w,tabIndex:-1,id:E,role:h?`grid`:`listbox`,"aria-multiselectable":b?`true`:void 0,"aria-readonly":!h&&g?!0:void 0,onKeyDown(e){if(!(c.state.disabled||c.state.readOnly)&&e.key===`Enter`){let t=c.state.activeIndex;if(t==null)return;$e(e),Vi(c,t,e.nativeEvent)}}},s]});if(v)return D;let ee=f&&!y?void 0:c.context.labelsRef;return(0,j.jsx)(m,{elementsRef:c.context.listRef,labelsRef:ee,children:D})}),Qi=A.createContext(void 0);function $i(){let e=A.useContext(Qi);if(e===void 0)throw Error(Ue(20));return e}var ea=A.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=xi(),a=i.useState(`mounted`),o=i.useState(`forceMounted`);return a||n||o?(0,j.jsx)(Qi.Provider,{value:n,children:(0,j.jsx)(ke,{ref:t,...r})}):null}),ta=A.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=_e,style:v,...y}=e,x=xi(),S=Si(),C=$i(),w=x.useState(`modal`),T=x.useState(`open`),E=x.useState(`mounted`),D=x.useState(`openMethod`),ee=x.useState(`positionerElement`),te=x.useState(`triggerElement`),ne=x.useState(`inputElement`),re=x.useState(`inputGroupElement`),ie=x.useState(`inputInsidePopup`),ae=x.useState(`transitionStatus`),oe=zi(),se=_({anchor:i??(ie?te:re??ne),floatingRootContext:S,positionMethod:a,mounted:E,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:p,collisionBoundary:u,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:C,collisionAvoidance:g,lazyFlip:!0});b(T&&w,D===`touch`,ee,te);let ce={open:T,side:se.side,align:se.align,anchorHidden:se.anchorHidden,empty:oe};Ge(()=>{x.set(`popupSide`,se.side)},[x,se.side]);let le=dt(e=>{x.set(`positionerElement`,e)}),ue=d(e,ce,{styles:se.positionerStyles,transitionStatus:ae,props:y,refs:[t,le],hidden:!E,inert:!T});return(0,j.jsxs)(Wi.Provider,{value:se,children:[E&&w&&(0,j.jsx)(nt,{inert:ft(!T),cutout:re??ne??te}),ue]})}),na={...De,...lt},ra=A.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=xi(),l=Gi(),u=Si(),d=c.useState(`mounted`),f=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`popupProps`),g=c.useState(`transitionStatus`),_=c.useState(`inputInsidePopup`),v=c.useState(`inputElement`),y=c.useState(`modal`),b=c.useState(`id`),x=zi(),S=s.id??(_?Di(b):void 0);Ge(()=>(c.set(`popupId`,c.context.popupRef.current?.id||S),()=>{c.set(`popupId`,void 0)}),[c,S]),Se({open:f,ref:c.context.popupRef,onComplete(){f&&c.context.onOpenChangeComplete(!0)}});let C={open:f,side:l.side,align:l.align,anchorHidden:l.anchorHidden,transitionStatus:g,empty:x},w=Ee(`div`,e,{state:C,ref:[t,c.context.popupRef],props:[h,{id:S,role:_?`dialog`:`presentation`,onFocus(e){let t=Ye(e.nativeEvent);m!==`touch`&&(ut(c.state.listElement,t)||t===e.currentTarget)&&c.context.inputRef.current?.focus()}},p(g),s],stateAttributesMapping:na}),T=a===void 0?_?e=>e===`touch`?c.context.popupRef.current:v:!1:a,E;E=o??(_?void 0:!1);let D=!_||y;return(0,j.jsx)(Be,{context:u,disabled:!d,modal:D,openInteractionType:m,initialFocus:T,returnFocus:E,getInsideElements:()=>[c.context.startDismissRef.current,c.context.endDismissRef.current],children:(0,j.jsxs)(A.Fragment,{children:[w,D&&(0,j.jsx)(Ki,{ref:c.context.endDismissRef})]})})}),ia=A.createContext(void 0),aa=A.createContext(!1);function oa(){return A.useContext(aa)}function sa(e){let{componentProps:t,forwardedRef:n,virtualized:r,indexFromFilter:i}=e,{render:a,className:o,style:s,value:c=null,index:u,disabled:d=!1,nativeButton:f=!1,...p}=t,m=A.useRef(null),h=l({guess:!0,index:u,textRef:m}),g=xi(),_=oa(),v=Ti(),{props:y,id:b,selectionMode:x,disabled:S,readOnly:C,isItemEqualToValue:w}=g.useState(`itemRoot`),T=S||d,E=x!==`none`,D=u??i??h.index,ee=D!==-1,te=g.useState(`isActive`,D),ne=g.useState(`isSelected`,c),re=A.useRef(null),ie=b!=null&&ee?`${b}-${D}`:void 0,ae=ne&&E;Ge(()=>{if(!ee||!r&&u==null)return;let e=g.context.listRef.current;return e[D]=re.current,()=>{delete e[D]}},[ee,r,D,u,g]),Ge(()=>{if(!ee||v)return;let e=g.context.valuesRef.current;return e[D]=c,()=>{delete e[D]}},[ee,v,D,c,g]),Ge(()=>{if(!ee||v)return;let e=g.state.selectedValue,t=g.state.selectedIndex;g.state.selectionMode===`multiple`&&Array.isArray(e)?t=yn(D,c,g.context.valuesRef.current,e,w,t):an(c,e,w)&&(t=D),g.set(`selectedIndex`,t)},[ee,v,g,D,c,w]);let{getButtonProps:oe,buttonRef:se}=Ne({disabled:T,focusableWhenDisabled:!0,native:f,composite:!0}),ce={disabled:T,selected:ae,highlighted:te};function le(e){function t(){g.context.handleSelection(e,c)}g.state.submitOnItemClick?(li.flushSync(t),g.context.requestSubmit()):t()}let ue={id:ie,role:_?`gridcell`:`option`,"aria-selected":E?ae:void 0,tabIndex:void 0,onPointerDownCapture(e){e.isPrimary&&(g.context.pointerDownItemRef.current=e.currentTarget),e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){T||C||le(e.nativeEvent)},onMouseUp(e){let t=g.context.pointerDownItemRef.current===e.currentTarget;g.context.pointerDownItemRef.current=null,T||C||e.button!==0||t||!te||le(e.nativeEvent)}},de=Ee(`div`,t,{ref:[se,n,h.ref,re],state:ce,props:[y,ue,p,oe]}),fe=A.useMemo(()=>({selected:ae,textRef:m}),[ae,m]);return(0,j.jsx)(ia.Provider,{value:fe,children:de})}function ca(e){let{componentProps:t,forwardedRef:n}=e,r=xi().useState(`isItemEqualToValue`),{flatFilteredValues:i}=Ci(),a=t.value??null,o=Qt(i,a,r);return(0,j.jsx)(sa,{componentProps:t,forwardedRef:n,virtualized:!0,indexFromFilter:o})}var la=A.memo(A.forwardRef(function(e,t){let n=xi().useState(`virtualized`);return n&&e.index==null?(0,j.jsx)(ca,{componentProps:e,forwardedRef:t}):(0,j.jsx)(sa,{componentProps:e,forwardedRef:t,virtualized:n,indexFromFilter:void 0})})),ua=A.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{filteredItems:s}=Ci(),c=xi(),l=mi(),u=s.length===0?a:null;return Ee(`div`,e,{ref:[t,c.context.emptyRef,l],props:[{children:u,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})}),da=r(),fa=(0,A.createContext)(null);function pa(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n==null?null:n.getTheme())}}}function ma(){let e=(0,A.useContext)(fa);return e??function(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return 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.`)}(e,...t)}(8),e}function ha(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return 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 M(e,...t){throw ha(e,...t)}function ga(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function _a(){return typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0}var va=_a();function ya(){return va&&`documentMode`in document?document.documentMode:null}var ba=ya();function xa(e){return va&&e.test(navigator.platform)}function Sa(e){return va&&e.test(navigator.userAgent)}var Ca=xa(/Mac|iPod|iPhone|iPad/),wa=Sa(/^(?!.*Seamonkey)(?=.*Firefox).*/i);function Ta(){return!(!va||!(`InputEvent`in window)||ba)&&`getTargetRanges`in new window.InputEvent(`input`)}var Ea=Ta();function Da(){return va&&!window.MSStream&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&navigator.maxTouchPoints>1)}var Oa=Da(),ka=Sa(/Android/),Aa=Sa(/Version\/[\d.]+.*Safari/)&&!ka,ja=Sa(/^(?=.*Chrome).*/i),Ma=va&&ka&&ja,Na=Sa(/AppleWebKit\/[\d.]+/)&&Ca&&!ja;function Pa(){return 2047}var Fa=Pa(),Ia=Aa||Oa||Na?`\xA0`:``,La=`
|
|
2
|
-
|
|
3
|
-
`,Ra=wa?`\xA0`:Ia,za={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Ba={directionless:1,unmergeable:2},Va={center:2,end:6,justify:4,left:1,right:3,start:5};function Ha(e){let t={};for(let n of Object.keys(e))t[e[n]]=n;return t}var Ua=Ha(Va),Wa={normal:0,segmented:2,token:1},Ga=Ha(Wa),Ka=Symbol.for(`@lexical/ctrlOrOtherKey`),qa=`$config`;function Ja(e){return()=>{}}function N(e){return{type:e}}var Ya=N(`SELECTION_CHANGE_COMMAND`),Xa=N(`SELECTION_INSERT_CLIPBOARD_NODES_COMMAND`),Za=N(`CLICK_COMMAND`),Qa=N(`BEFORE_INPUT_COMMAND`),$a=N(`INPUT_COMMAND`),eo=N(`COMPOSITION_START_COMMAND`),to=N(`COMPOSITION_END_COMMAND`),no=N(`DELETE_CHARACTER_COMMAND`),ro=N(`INSERT_LINE_BREAK_COMMAND`),io=N(`INSERT_PARAGRAPH_COMMAND`),ao=N(`CONTROLLED_TEXT_INSERTION_COMMAND`),oo=N(`PASTE_COMMAND`),so=N(`REMOVE_TEXT_COMMAND`),co=N(`DELETE_WORD_COMMAND`),lo=N(`DELETE_LINE_COMMAND`),uo=N(`FORMAT_TEXT_COMMAND`),fo=N(`SET_TEXT_FORMAT_COMMAND`),po=N(`UNDO_COMMAND`),mo=N(`REDO_COMMAND`),ho=N(`KEYDOWN_COMMAND`),go=N(`KEY_ARROW_RIGHT_COMMAND`),_o=N(`MOVE_TO_END`),vo=N(`KEY_ARROW_LEFT_COMMAND`),yo=N(`MOVE_TO_START`),bo=N(`KEY_ARROW_UP_COMMAND`),xo=N(`KEY_ARROW_DOWN_COMMAND`),So=N(`KEY_ENTER_COMMAND`),Co=N(`KEY_SPACE_COMMAND`),wo=N(`KEY_BACKSPACE_COMMAND`),To=N(`KEY_ESCAPE_COMMAND`),Eo=N(`KEY_DELETE_COMMAND`),Do=N(`KEY_TAB_COMMAND`),Oo=N(`INSERT_TAB_COMMAND`),ko=N(`INDENT_CONTENT_COMMAND`),Ao=N(`OUTDENT_CONTENT_COMMAND`),jo=N(`DROP_COMMAND`),Mo=N(`FORMAT_ELEMENT_COMMAND`),No=N(`DRAGSTART_COMMAND`),Po=N(`DRAGOVER_COMMAND`),Fo=N(`DRAGEND_COMMAND`),Io=N(`COPY_COMMAND`),Lo=N(`CUT_COMMAND`),Ro=N(`SELECT_ALL_COMMAND`),zo=N(`CLEAR_EDITOR_COMMAND`),Bo=N(`CLEAR_HISTORY_COMMAND`),Vo=N(`CAN_REDO_COMMAND`),Ho=N(`CAN_UNDO_COMMAND`),Uo=N(`FOCUS_COMMAND`),Wo=N(`BLUR_COMMAND`),Go=N(`KEY_MODIFIER_COMMAND`);function Ko(e,t){return{...t,[Ka]:e}}var qo=Ko(`metaKey`,{ctrlKey:!Ca,metaKey:Ca}),Jo=Ko(`altKey`,{altKey:Ca,ctrlKey:!Ca}),Yo=[[`altKey`,1],[`ctrlKey`,2],[`metaKey`,4],[`shiftKey`,8]];function Xo(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}var Zo=class{byKey=new Map;byCode=new Map;add(e){let{key:t,modifiers:n={}}=e;t.length>0||M(399);let r=t.toLowerCase();for(let i of function(e){let t=[0];for(let[n,r]of Yo){let i=e[n]||!1;i===`any`?t=t.concat(t.map(e=>e|r)):i&&(t=t.map(e=>e|r))}return t}(n))Xo(this.byKey,`${i}:${r}`,e),t.length===1&&(/[0-9]/.test(t)?Xo(this.byCode,`${i}:Digit${t}`,e):/[a-z]/.test(r)&&Xo(this.byCode,`${i}:Key${r.toUpperCase()}`,e));return this}matches(e){let t=e.key;if(!t)return[];let n=function(e){let t=0;for(let[n,r]of Yo)e[n]&&(t|=r);return t}(e),r=this.byKey.get(`${n}:${t.toLowerCase()}`),i=r?r.slice():[];if(this.byCode.size>0&&!(t.length===1&&t.charCodeAt(0)<=127)){let t=this.byCode.get(`${n}:${e.code}`);t&&i.push(...t)}return i}match(e){return this.matches(e)[0]}};function Qo(e){let t=new Zo;for(let n of e)t.add(n);return t}function $o(e){let t=new Map;return{dispose(){for(let e of t.values())e.dispose();t.clear()},register(n,r){let i=t.get(n);i===void 0&&(i={dispose:e(n,r),holders:new Set},t.set(n,i));let a=()=>{let e=t.get(n);e&&e.holders.delete(a)&&e.holders.size===0&&(t.delete(n),e.dispose())};return i.holders.add(a),a}}}function es(){let e;try{e=`0.53.0+prod.esm`}catch{}return e??`"<unknown>+source"`}var ts=es(),ns=class{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){let e=Array.from(this._front).reverse();for(let t of this._back)e.push(t);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}},rs=null;function is(e,t=1e3){return e instanceof as?e.clone():e.size<t?new Map(e):new as().init(new Map(e),void 0,e.size)}var as=class e{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,new e().init(this._old,this._nursery,this._size)}init(e,t,n){return this._old=e,this._nursery=t,this._size=n,this}get size(){return this._size}has(e){return this.get(e)!==void 0}getWithTombstone(e){let t=this._nursery&&this._nursery.get(e);return t===void 0?this._old&&this._old.get(e):t}get(e){let t=this.getWithTombstone(e);return t===rs?void 0:t}shouldCompact(){return this._nursery!==void 0&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(e=!1){if(this._nursery&&this._nursery.size>0&&(e||this.shouldCompact())){let e=new Map(this._old);for(let[t,n]of this._nursery)n===rs?e.delete(t):e.set(t,n);this._old=e,this._nursery=void 0}return this._mutable=!1,this}set(e,t){let n=this.getWithTombstone(e);if(n===t)return this;let r=this.getNursery();return n!==rs&&n!==void 0||(this._size++,n===rs&&r.delete(e)),r.set(e,t),this}delete(e){let t=this.has(e);return t&&(this.getNursery().set(e,rs),this._size--),t}getOrInsert(e,t){let n=this.get(e);return n===void 0?(this.set(e,t),t):n}getOrInsertComputed(e,t){let n=this.get(e);if(n!==void 0)return n;let r=t(e);return this.set(e,r),r}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(let e of this.entries())yield e[0]}*values(){for(let e of this.entries())yield e[1]}*entries(){let e=this._nursery,t=this._old;if(e){if(t)for(let n of t){let t=n[0],r=e.get(t);r!==rs&&(r!==void 0&&(n[1]=r),yield n)}for(let n of e)n[1]===rs||t&&t.has(n[0])||(yield n)}else t&&(yield*t)}forEach(e,t){t!==void 0&&(e=e.bind(t));for(let[t,n]of this.entries())e(n,t,this)}get[Symbol.toStringTag](){return`GenMap`}[Symbol.iterator](){return this.entries()}},os=!1;function ss(e,t,...n){let r=os,i;try{os=e,i=t()}finally{os=r}var a;return(a=i)===null||typeof a!=`object`&&typeof a!=`function`||typeof a.then!=`function`||M(421),i}function cs(){return os}function ls(e){let t=e.exportJSON(os),n=e.constructor;return t.type!==n.getType()&&M(130,n.name),I(e)&&!Array.isArray(t.children)&&M(59,n.name),t}function us(){return qf()._blockCursorElement}function ds(e){return e!==null&&e.nodeType===1&&e.hasAttribute(`data-lexical-slot`)}var fs=Na||Oa||Aa;function ps(){let e=kf().createElement(`img`);e.setAttribute(`data-lexical-decorator-boundary`,`true`),e.alt=``;for(let[t,n]of[[`position`,`absolute`],[`width`,`0px`],[`height`,`0px`],[`border`,`0px`],[`margin`,`0px`],[`padding`,`0px`]])e.style.setProperty(t,n,`important`);return e}function ms(e){return e!==null&&e.nodeType===1&&e.hasAttribute(`data-lexical-decorator-boundary`)}var hs=class e{element;before;after;constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(e){let t=this.getInsertionAnchor();return t!==null&&t.parentElement!==this.element&&M(357),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&M(358),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&M(359),this.element.replaceChild(e,t),this}getFirstChild(){let e=this.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;return t===this.getInsertionAnchor()?null:t}getFirstChildAnchor(){return this.after}resolveLeafPosition(e,t,n){if(this.element===e)return t===e&&n===0?`before`:`after`;let r=gs(e,this.element);if(r===null)return`after`;let i=Array.prototype.indexOf.call(e.childNodes,r);if(i<0)return`after`;if(t===e)return n<=i?`before`:`after`;let a=gs(e,t);if(a===null)return`after`;let o=Array.prototype.indexOf.call(e.childNodes,a);return o>=0&&o<=i?`before`:`after`}getInsertionAnchor(){return this.before}};function gs(e,t){let n=t;for(;n!==null&&n.parentNode!==e;)n=n.parentNode;return n}var _s=class e extends hs{withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()||this.getDecoratorBoundaryAnchor(`trailing`)}getFirstChildAnchor(){let e=super.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;for(;ds(t);)e=t,t=t.nextSibling;ms(t)&&(e=t,t=t.nextSibling);let n=e?e.nextSibling:this.element.firstChild;return n!==null&&n===us()?n:e}getDecoratorBoundaryAnchor(e){let t;if(e===`leading`){let e=super.getFirstChildAnchor();for(t=e?e.nextSibling:this.element.firstChild;ds(t);)t=t.nextSibling}else t=this.before?this.before.previousSibling:this.element.lastChild,t!==null&&t===us()&&(t=t.previousSibling);return ms(t)?t:null}setDecoratorBoundaryAnchor(e,t){let n=this.getDecoratorBoundaryAnchor(e);if(t!==(n!==null)){if(n!==null)this.element.removeChild(n);else if(e===`leading`){let e=this.getFirstChildAnchor();this.element.insertBefore(ps(),e?e.nextSibling:this.element.firstChild)}else this.element.insertBefore(ps(),this.before)}}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){let t=this.element,n=this.after===null?t.firstChild:this.after.nextSibling,r=e===`empty`&&ds(n)?null:e;if(t.__lexicalLastChildKind!==r){if(t.__lexicalLastChildKind=r,r===null)this.removeManagedLineBreak();else{let e=r===`decorator`&&fs;this.insertManagedLineBreak(e)}}}removeManagedLineBreak(){let e=this.element,t=this.getManagedLineBreak();if(t){t.remove();for(let t of e.querySelectorAll(`:scope > [data-lexical-managed-linebreak]`))t.remove();e.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){let t=this.element,n=this.getManagedLineBreak();if(n){let r=e?n.nextSibling:n;if(r&&r===t.querySelector(`:scope > br[data-lexical-managed-linebreak]`))return;this.removeManagedLineBreak()}let r=this.before||this.getDecoratorBoundaryAnchor(`trailing`),i=kf().createElement(`br`);if(i.setAttribute(`data-lexical-managed-linebreak`,`true`),t.insertBefore(i,r),e){let e=kf().createElement(`img`);e.setAttribute(`data-lexical-managed-linebreak`,`true`),e.style.setProperty(`display`,`inline`,`important`),e.style.setProperty(`border`,`0px`,`important`),e.style.setProperty(`margin`,`0px`,`important`),e.alt=``,t.insertBefore(e,i),t.__lexicalLineBreak=e}else t.__lexicalLineBreak=i}getFirstChildOffset(){let e=this.getFirstChild(),t=this.getInsertionAnchor(),n=0;for(let r=this.element.firstChild;r!==null&&r!==e&&r!==t;r=r.nextSibling)n++;return n}resolveChildIndex(e,t,n,r){if(n===this.element){let t=this.getFirstChildOffset(),n=us(),i=this.element.childNodes,a=Math.min(r,i.length),o=0;for(let e=t;e<a;e++)i[e]!==n&&o++;return[e,Math.min(o,e.getChildrenSize())]}let i=vs(t,n);i.push(r);let a=vs(t,this.element),o=e.getIndexWithinParent();for(let e=0;e<a.length;e++){let t=i[e],n=a[e];if(t===void 0||t<n)break;if(t>n){o+=1;break}}return[e.getParentOrThrow(),o]}};function vs(e,t){let n=[],r=t;for(;r!==e&&r!==null;r=r.parentNode){let e=0;for(let t=r.previousSibling;t!==null;t=t.previousSibling)e++;n.push(e)}return r!==e&&M(225),n.reverse()}var ys=!1,bs=0;function xs(){bs=performance.now()}function Ss(e){return W(e)&&e.hasAttribute(`data-lexical-managed-linebreak`)}function Cs(e,t,n){let r=Sf(ff(n)),i=r&&Mf(r,n._rootElement),a=null,o=null;i!==null&&i.anchorNode===e&&(a=i.anchorOffset,o=i.focusOffset);let s=e.nodeValue;s!==null&&Wd(t,s,a,o,!1)}function ws(e,t,n){if(q(e)){let t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return gd(t)&&n.isAttached()}function Ts(e,t,n){for(let r=e;r&&!sp(r);r=rf(r)){let e=kd(r,t);if(e!==void 0){let t=B(e,n);if(t)return L(t)||!W(r)?void 0:[r,t]}}}function Es(e,t,n,r){ys=!0;let i=e._inputState.unprocessedBeforeInputData===null&&performance.now()-bs>100;try{$m(e,()=>{let a=J()||function(e){return e.read(`latest`,()=>{let e=J();return e===null?null:e.clone()})}(e),o=new Map,s=e._editorState,c=e._blockCursorElement,l=!1,u=``;for(let n of t){let t=n.type,d=n.target,f=Ts(d,e,s);if(!f)continue;let[p,m]=f;if(t===`characterData`)r?R(m)&&m.isAttached()&&m.markDirty():i&&R(m)&&gd(d)&&ws(a,d,m)&&Cs(d,m,e);else{l=!0;for(let t of n.addedNodes){let n=kd(t,e);if(t!==c&&t.parentNode===d&&(n?e.getElementByKey(n)!==t:!(e._slotsUsed&&W(t)&&t.hasAttribute(`data-lexical-slot`)||sp(t)))){if(wa){let e=(W(t)?t.innerText:null)||t.nodeValue;e&&(u+=e)}d.removeChild(t)}}for(let e of n.removedNodes){let t=c===e;if(t||ms(e)||Ss(e)){let t=n.nextSibling,r=n.previousSibling;d.insertBefore(e,t&&t.parentNode!==d?r?r.parentNode===d?r.nextSibling:null:d.firstChild:t)}t||o.set(p,m)}}}for(let[t,n]of o)n.reconcileObservedMutation(t,e);let d=n.takeRecords();for(let t of d)for(let n of t.addedNodes)n.nodeName!==`BR`||kd(n,e)||Ss(n)||n.remove();n.takeRecords(),a!==null&&(l&&Fd(a),wa&&tf(e)&&a.insertRawText(u))})}finally{ys=!1}}function Ds(e,t,n){let r=e._observer;if(r!==null){let i=r.takeRecords();(!n||i.length>0)&&Es(e,i,r,t)}}function Os(e){(function(e){ff(e).addEventListener(`textInput`,xs,!0)})(e),e._observer=new MutationObserver((t,n)=>{Es(e,t,n)})}function ks(e,t,n){let{isEqual:r}=e;return t===n||r!==void 0&&r(t,n)}function As(e,t){return ks(e,t,e.defaultValue)}function js(e){return typeof e==`object`&&!!e}function Ms(e,t){let n=Ls(e,t).getter;return js(n)&&n.getterTable!==void 0||M(405,t),Is(n.getterTable)}function Ns(e,t){let n=Ls(e,t).setter;return js(n)&&n.setterTable!==void 0||M(406,t),Is(n.setterTable)}function Ps(e,t,n){let{meta:r}=Ls(e,t);for(let e=0;;)if(r.kind===`aliased`){if(e===n)return Is(r.aliases);e++,r=r.inner.meta}else r.kind===`nullable`||r.kind===`optional`?r=r.inner.meta:r.kind===`array`?r=r.item.meta:M(407,t,String(n))}function Fs(e,t){let n=Ls(e,t),{setter:r}=n;js(r)&&r.setterTable!==void 0||M(408,t);let i=String(n.defaultValue);return Ks(r.setterTable,i)||M(409,t,i),r.setterTable[i]}function Is(e){return Object.assign(Object.create(null),e)}function Ls(e,t){let n=e.get(t);return n===void 0&&M(410,t),n}function Rs(e,t,n,r,i){i!==void 0&&zs.add(i);let a=n===void 0,o=a?e(void 0):n;return a&&Hs(o),Object.assign(e,{accepts:i,defaultValue:o,isEqual:r,meta:t})}var zs=new WeakSet,Bs=new WeakSet;function Vs(e){return typeof e==`object`&&e&&Bs.add(e),e}function Hs(e){if(typeof e==`object`&&e&&!Object.isFrozen(e)&&!Bs.has(e)){Object.freeze(e);for(let t of Object.values(e))Hs(t)}}function Us(e){let{isEqual:t}=e;return t===void 0?void 0:(e,n)=>e==null||n==null?e===n:t(e,n)}function Ws(e,t){return n=>t(n)||Gs(e,n)}function Gs(e,t){let{accepts:n}=e;return n===void 0?function(e,t){let{accepts:n}=e;if(n!==void 0)return Gs(e,t)?{parsed:e(t)}:void 0;let r=e(t);return As(e,r)&&t!==e.defaultValue?void 0:{parsed:r}}(e,t)!==void 0:n.call(e,t)}function Ks(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function qs(e=``){return Rs(t=>typeof t==`string`?t:e,{kind:`string`},void 0,void 0,e=>typeof e==`string`)}var Js=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function Ys(e=0,t={}){let{integer:n,clamp:r}=t,i=n&&t.min!==void 0?Math.ceil(t.min):t.min,a=n&&t.max!==void 0?Math.floor(t.max):t.max,o=e=>typeof e==`string`&&Js.test(e)?Number(e):e,s=e=>typeof e==`number`&&Number.isFinite(e)&&(!n||Number.isInteger(e)),c=e=>s(e)&&(i===void 0||e>=i)&&(a===void 0||e<=a);return Rs(t=>{let n=o(t);return r&&s(n)?i!==void 0&&n<i?i:a!==void 0&&n>a?a:n:c(n)?n:e},{clamp:r,integer:n,kind:`number`,max:a,min:i},void 0,void 0,e=>r?s(o(e)):c(o(e)))}function Xs(e=!1){return Rs(t=>typeof t==`boolean`?t:e,{kind:`boolean`},void 0,void 0,e=>typeof e==`boolean`)}function Zs(e,...t){let n=Vs(t.length===0?e[0]:t[0]),r=new Set(e);return Rs(e=>e!==void 0&&r.has(e)?e:n,{kind:`enum`,values:e},n,void 0,e=>r.has(e)&&(e!==void 0||n===void 0))}function Qs(e,t={}){let{defaultAsNull:n}=t;return Rs(t=>{if(t==null)return null;let r=e(t);return n&&As(e,r)?null:r},{defaultAsNull:n,inner:e,kind:`nullable`},void 0,Us(e),Ws(e,e=>e==null))}function $s(e,t={}){let{omitDefault:n}=t;return Rs(t=>{if(t===void 0)return;let r=e(t);return n&&As(e,r)?void 0:r},{inner:e,kind:`optional`,omitDefault:n},void 0,Us(e),Ws(e,e=>e===void 0))}function ec(){return e=>function(e){return{meta:{fields:e,kind:`node`}}}(e)}function tc(e,t){let n=e=>typeof e==`string`&&Ks(t,e);return Rs(r=>n(r)?t[r]:e(r),{aliases:t,inner:e,kind:`aliased`},e.defaultValue,e.isEqual,t=>n(t)||Gs(e,t))}function nc(e){return Rs(t=>{if(!Array.isArray(t))return[];let n=Array(t.length);for(let r=0;r<t.length;r++)n[r]=e(t[r]);return n},{item:e,kind:`array`},void 0,(t,n)=>{if(!Array.isArray(t)||!Array.isArray(n)||t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!ks(e,t[r],n[r]))return!1;return!0},e=>Array.isArray(e))}function rc(e,t){return ac(0,e,{getter:{field:t.field,getterTable:t.getterTable,method:t.getter,when:t.when},setter:{field:t.field,method:t.setter,setterTable:t.setterTable}},!0===t.derived)}function ic(e,t){return ac(0,e,{getter:t.getter,setter:t.setter},!0===t.derived)}function ac(e,t,n,r=!1){return Object.assign(e=>t(e),{accepts:t.accepts,defaultValue:t.defaultValue,...r?{derived:!0}:{},getter:n.getter,isEqual:t.isEqual,meta:t.meta,setter:n.setter})}var oc=`latest`,sc=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;derived;schema;constructor(e,t){this.key=e,this.derived=!0===t.derived;let n=`meta`in(r=t.parse)&&typeof r.meta==`object`&&r.meta!==null&&`kind`in r.meta&&typeof r.meta.kind==`string`&&`defaultValue`in r?t.parse:void 0;var r;this.schema=n,this.parse=t.parse.bind(t),this.unparse=(t.unparse||vc).bind(t),this.isEqual=t.isEqual?t.isEqual.bind(t):n!==void 0&&n.isEqual!==void 0?(e,t)=>ks(n,e,t):Object.is,this.defaultValue=n===void 0?this.parse(void 0):n.defaultValue,this.resetOnCopyNode=t.resetOnCopyNode||!1}};function cc(e,t){return new sc(e,t)}function lc(e,t,n=oc){let r=(n===`latest`?e.getLatest():e).__state;return r?r.getValue(t):t.defaultValue}function uc(e,t,n){let r;if(Mm(),typeof n==`function`){let i=e.getLatest(),a=lc(i,t);if(r=dc(t,n(a)),t.isEqual(a,r))return i}else r=dc(t,n);let i=e.getWritable();return hc(i).updateFromKnown(t,r),i}function dc(e,t){let{schema:n}=e;return n!==void 0&&n.meta.kind===`set`?e.parse(t):t}function fc(e){let t=new Map,n=new Set;for(let{ownNodeConfig:r}of zp(typeof e==`function`?e:e.replace))if(r&&r.stateConfigs)for(let e of r.stateConfigs){let r;`stateConfig`in e?(r=e.stateConfig,e.flat&&n.add(r.key)):r=e,t.set(r.key,r)}return{flatKeys:n,sharedConfigMap:t}}var pc=new Set([`__proto__`,`constructor`,`prototype`]),mc=class e{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;let{sharedConfigMap:a}=this.sharedNodeState,o=i===void 0?function(e,t,n){let r=n.size;if(t)for(let i in t){let t=e.get(i);t&&n.has(t)||r++}return r}(a,n,r):i;this.size=o}getValue(e){let t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let t=this.unknownState[e.key];t!==void 0&&(n=e.parse(t)),this.knownState.set(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},t={};for(let[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(let n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return _c(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(let[i,a]of Object.entries(n)){if(pc.has(i))continue;let n=e.get(i);n?t.has(n)||t.set(n,n.parse(a)):(r||={},r[i]=a)}return r}(n.sharedConfigMap,i,r),i,this.size)}resetOnCopyNode(){for(let e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){let n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);let{knownState:r,unknownState:i}=this;i&&n in i?(delete i[n],this.unknownState=_c(i)):r.has(e)||this.size++,r.set(e,t)}updateFromUnknown(e,t){if(pc.has(e))return;let n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){let{knownState:t}=this;for(let e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(let[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function hc(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new mc(t,function(e){return e.__state?e.__state.sharedNodeState:ad(qf(),e.getType()).sharedNodeState}(t));return t.__state=n,n}function gc(e,t){let n=e.getWritable(),r=t.$;return(n.__state||r)&&hc(e).updateFromJSON(r),n}function _c(e){if(e)for(let t in e)return e}function vc(e){return e}function yc(e,t,n){for(let[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);let t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function bc(e,t,n){let{unknownState:r}=t,i=n?n.unknownState:void 0;if(r){for(let[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0}return!1}function xc(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function Sc(e){return!ru(e)&&e.getTextContent!==Ql.prototype.getTextContent}var Cc=Symbol.for(`@lexical/CachedTextSize`);function wc(e,t){return zc.read(()=>{let n=0,r=e;for(let e=0;e<t&&r!==null;e++){let i=Rc.get(r);if(i===void 0&&M(345,r),I(i)){let a=Bc.get(r);if(a!==void 0&&I(a)&&a.__parent!==i.__parent)n+=i.getTextContentSize();else{let e=Vc.get(r),t=e&&e.__lexicalTextContent;typeof t!=`string`&&M(346,i.getType()),n+=t.length}e<t-1&&!i.isInline()&&(n+=2)}else if(rl(i).size>0)n+=i.getTextContentSize();else{let e=i[Cc];e===void 0&&M(347,i.getType(),r),n+=e}r=i.__next}return n},{editor:P})}function Tc(e){I(e)||rl(e).size>0||e[Cc]===void 0&&(e[Cc]=R(e)?e.__text.length:e.getTextContentSize())}var Ec=4,Dc,P,Oc,F=``,kc=null,Ac=null,jc=null;function Mc(){return{firstTextKey:jc,format:kc,style:Ac}}function Nc(e){e.firstTextKey!==null&&(kc=e.format,Ac=e.style,jc=e.firstTextKey)}function Pc(e){if(jc!==null)return;let t=e.__lexicalFirstTextKey;if(t===void 0&&M(348),t===null)return;let n=Bc.get(t);R(n)&&(kc=n.getFormat(),Ac=n.getStyle(),jc=t)}var Fc,Ic,Lc,Rc,zc,Bc,Vc,Hc,Uc,Wc,Gc=!1,Kc=!1;function qc(e,t){let n=Rc.get(e),r=Bc.has(e);if(t!==null){let n=vl(e);n.parentNode===t&&t.removeChild(n)}if(!r){if(P._keyToDOMMap.delete(e),I(n)){let e=Vp(n,Rc);Jc(e,0,e.length-1,null)}if(n!==void 0){for(let e of rl(n).values()){let t=al(e);qc(e,null),t!==null&&t.remove()}Zd(Uc,Oc,Fc,n,`destroyed`)}}}function Jc(e,t,n,r){for(let i=t;i<=n;++i){let t=e[i];t!==void 0&&qc(t,r)}}function Yc(e,t){e.setProperty(`text-align`,t)}var Xc=`40px`;function Zc(e,t){let n=Dc.theme.indent;if(typeof n==`string`){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}e.style.setProperty(`padding-inline-start`,t===0?``:`calc(${t} * var(--lexical-indent-base-value, ${Xc}))`),Yd(e,`class`),Yd(e,`style`)}function Qc(e,t){let n=e.style;t===0?Yc(n,``):t===1?Yc(n,`left`):t===2?Yc(n,`center`):t===3?Yc(n,`right`):t===4?Yc(n,`justify`):t===5?Yc(n,`start`):t===6&&Yc(n,`end`),Yd(e,`style`)}function $c(e,t){let n=function(e){let t=e.__dir;if(t!==null)return t;if(ru(e))return null;let n=e.getParent();return n===null||U(n)&&n.__dir===null?`auto`:null}(t);n===null?e.removeAttribute(`dir`):e.dir=n}function el(e){let t=kf().createElement(`div`);return t.setAttribute(`data-lexical-slot`,e),t.style.display=`none`,t}function tl(e,t,n){t||e.contentEditable===`false`?cp(n,P):n.removeAttribute(`contenteditable`)}function nl(e,t,n){let r=F,i=Mc();F=``;let a=``,o=L(e);for(let[r,i]of n){let n=el(r);tl(t,o,n),t.appendChild(n),F=``;let s=Mc();sl(i,Yf(e,n,P)),Nc(s),il(e,r,t,n),a+=F}return Nc(i),F=r,a}function rl(e){return u_(e)&&e.__slots!==null?e.__slots:l_}function il(e,t,n,r){let i=Wc.$getSlotTargetElement(e,t,n,P);i!==null&&(r.parentElement!==i&&i.appendChild(r),r.style.display=``)}function al(e){let t=Vc.get(e);return t===void 0?null:t.parentElement}function ol(e,t,n){let r=rl(e),i=rl(t);for(let[e,t]of r)if(!i.has(e)){let e=al(t);qc(t,null),e!==null&&e.remove()}let a=F,o=Mc(),s=``,c=null,l=L(t);for(let[e,a]of i){let i=r.get(e),o=i===void 0?null:al(i);F=``;let u=Mc();if(o===null){o=el(e);let r=null;for(let e of n.children)if(!e.hasAttribute(`data-lexical-slot`)){r=e;break}n.insertBefore(o,r),sl(a,Yf(t,o,P))}else i===a?pl(a,o):(i!==void 0&&qc(i,o),sl(a,Yf(t,o,P)));if(Nc(u),tl(n,l,o),il(t,e,n,o),s+=F,o.parentElement===n){let e=c===null?n.firstChild:c.nextSibling;e!==o&&n.insertBefore(o,e),c=o}}return Nc(o),F=a,s}function sl(e,t){let n=Bc.get(e);if(n===void 0&&M(60),t!==null){let r=Rc.get(e);if(r!==void 0){let i=Vc.get(e);if(i!==void 0){let a=d_(r)?r.__slotHost:null,o=d_(n)?n.__slotHost:null,s=r.__parent!==n.__parent||a!==o,c=o!==null&&i.parentElement!==t.element;if(s||c)return t.insertChild(i),pl(e,t.element)}}}let r=Wc.$createDOM(n,P);if(function(e,t,n){let r=n._keyToDOMMap;Od(t,n,e),r.set(e,t)}(e,r,P),R(n)?r.setAttribute(`data-lexical-text`,`true`):L(n)&&(r.setAttribute(`data-lexical-decorator`,`true`),op(r,{captureSelection:!0})),I(n)){let e=F,t=n.__indent,i=n.__size;$c(r,n),t!==0&&Zc(r,t);let a=rl(n),o=a.size>0?nl(n,r,a):``;if(i===0)r.__lexicalTextContent=o,r.__lexicalFirstTextKey=null,F+=o,a.size>0&&(r.__lexicalSlotTextLength=o.length);else{let t=i-1;if(cl(Vp(n,Bc),n,0,t,Yf(n,r,P)),o!==``){let t=r.__lexicalTextContent||``;r.__lexicalTextContent=o+t,F=e+o+t}a.size>0&&(r.__lexicalSlotTextLength=o.length)}if(Sc(n)){let t=n.getTextContent();r.__lexicalTextContent=t,F=e+t}let s=n.__format;s!==0&&Qc(r,s),n.isInline()||(dl(0,n,r),ul(n,r))}else{let t=n.getTextContent();if(L(n)){let t=n.decorate(P,Dc);t!==null&&ml(e,t),r.contentEditable=`false`;let i=rl(n);i.size>0&&nl(n,r,i)}F+=t}return t!==null&&t.insertChild(r),Wc.$decorateDOM(n,null,r,P),Tc(n),Zd(Uc,Oc,Fc,n,`created`),r}function cl(e,t,n,r,i){let a=F,o=Mc();F=``,kc=null,Ac=null,jc=null;let s=n;for(;s<=r;++s){let t=Mc();sl(e[s],i);let n=Bc.get(e[s]);n!==null&&R(n)?kc===null&&(kc=n.getFormat(),Ac=n.getStyle(),jc=n.__key):I(n)&&s<r&&!n.isInline()&&(F+=La),Nc(t)}let c=P._keyToDOMMap.get(t.__key);c===void 0&&M(349,t.__key),c.__lexicalTextContent=F,c.__lexicalFirstTextKey=jc,F=a+F,Nc(o)}function ll(e){return L(e)&&!e.isInline()}function ul(e,t,n=Yf(e,t,P)){n.setDecoratorBoundaryAnchor(`leading`,ll(e.getFirstChild())),n.setDecoratorBoundaryAnchor(`trailing`,ll(e.getLastChild()))}function dl(e,t,n){let r=Yf(t,n,P),i=function(e,t){if(e){let n=e.__last;if(n){let e=t.get(n);if(e)return cm(e)?`line-break`:L(e)&&e.isInline()?`decorator`:null}return`empty`}return null}(t,Bc);r.setManagedLineBreak(i)}function fl(e,t,n){let r=t.__lexicalFirstTextKey;if(r!=null){let t=e.__key,i=r;for(;i!==null;){let e=Bc.get(i);if(e===void 0){i=null;break}if(e.__parent===t)break;i=e.__parent}if(i!==null&&!n.has(i)){let e=Bc.get(r);if(R(e))return kc=e.getFormat(),void(Ac=e.getStyle())}}t.__lexicalFirstTextKey=jc}function pl(e,t){let n=Rc.get(e),r=Bc.get(e);n!==void 0&&r!==void 0||M(61);let i=Gc||Lc.has(e)||Ic.has(e),a=nf(P,e);if(n===r&&!i){let e;if(I(n)){let t=a.__lexicalTextContent;typeof t!=`string`&&M(355,n.getType()),e=t,Pc(a)}else e=n.getTextContent();return F+=e,a}if(n!==r&&i&&Zd(Uc,Oc,Fc,r,`updated`),Wc.$updateDOM(r,n,a,P)){let n=sl(e,null);return t===null&&M(62),t.replaceChild(n,a),qc(e,null),n}if(I(n)){I(r)||M(334,e);let t=r.__indent;(Gc||t!==n.__indent)&&Zc(a,t);let o=r.__format;(Gc||o!==n.__format)&&Qc(a,o);let s=i&&(rl(r).size>0||rl(n).size>0)?ol(n,r,a):``;if(i){let e=F;if(function(e,t,n){var r;kc=null,Ac=null,jc=null,function(e,t,n){let r=F,i=e.__size,a=t.__size;F=``;let o=n.element,s=P._keyToDOMMap.get(t.__key);s===void 0&&M(351,t.__key);let c=a-i;if(!Gc&&Math.abs(c)<=1&&i>=Ec&&e.__first===t.__first&&(c!==0||!P._cloneNotNeeded.has(e.__key))){let i=s.__lexicalTextContent,l=Hc.get(e.__key);if(!Gc&&!Sc(t)&&typeof i==`string`&&l!==void 0){let a=function(e,t){let n=t.size;if(n===0||n>=e.__size)return null;let r=e.__last,i=null,a=0;for(;r!==null&&a<n;){if(!t.has(r))return null;i=r;let e=Bc.get(r);if(e===void 0)return null;r=e.__prev,a++}return a!==n||r!==null&&t.has(r)?null:i}(t,l);if(a!==null){let u=l.size;if(c===0){let e=wc(a,u),n=a,c=0;for(;n!==null&&c<u;){let e=Bc.get(n);if(e===void 0)break;let t=Mc();pl(n,o),R(e)&&kc===null&&(kc=e.getFormat(),Ac=e.getStyle(),jc=e.__key),Nc(t),n=e.__next,c++}let d=``;for(n=a,c=0;n!==null&&c<u;){let e=Bc.get(n);if(e===void 0)break;let t;if(I(e)){let r=P._keyToDOMMap.get(n),i=r&&r.__lexicalTextContent;typeof i!=`string`&&M(352,e.getType()),t=i}else t=e.getTextContent();d+=t,c<u-1&&I(e)&&!e.isInline()&&(d+=La),n=e.__next,c++}let f=s.__lexicalSlotTextLength||0,p=f>0?i.slice(f):i,m=p.slice(0,p.length-e)+d;s.__lexicalTextContent=m,F=r+m,fl(t,s,l);return}if(function(e,t,n,r,i,a,o,s){if(s!==1&&s!==-1||o!==(s===1?2:1))return!1;let c=o-s,l=e.__last;for(let e=0;e<c-1;e++){if(l===null)return!1;let e=Rc.get(l);if(e===void 0)return!1;l=e.__prev}if(l===null)return!1;let u=Bc.get(a),d=Rc.get(l);if(u===void 0||d===void 0||u.__prev!==d.__prev)return!1;let f=[],p=a;for(let e=0;e<o;e++){if(p===null)return!1;f.push(p);let e=Bc.get(p);p=e?e.__next:null}let m=[];p=l;for(let e=0;e<c;e++){if(p===null)return!1;m.push(p);let e=Rc.get(p);p=e?e.__next:null}let h=new Set(m),g=new Set(f),_=[],v=0,y=0;for(;v<c&&y<o;)if(f[y]===m[v])_.push({key:f[y],kind:`reconcile`}),v++,y++;else if(g.has(m[v])){if(h.has(f[y]))return!1;_.push({key:f[y],kind:`create`,nextIndex:y}),y++}else _.push({key:m[v],kind:`destroy`}),v++;for(;v<c;)_.push({key:m[v++],kind:`destroy`});for(;y<o;)_.push({key:f[y],kind:`create`,nextIndex:y}),y++;let b=wc(l,c);for(let e of _){let t=Mc();if(e.kind===`reconcile`)pl(e.key,n.element);else if(e.kind===`destroy`)qc(e.key,n.element);else{let t=null;for(let n=e.nextIndex+1;n<o;n++){let e=P._keyToDOMMap.get(f[n]);if(e!==void 0){t=e;break}}sl(e.key,n.withBefore(t??n.before))}if(e.kind!==`destroy`){let t=Bc.get(e.key);t&&R(t)&&kc===null&&(kc=t.getFormat(),Ac=t.getStyle(),jc=t.__key)}Nc(t)}let x=``;for(let e=0;e<o;e++){let t=Bc.get(f[e]);if(t===void 0)return!1;let n;if(I(t)){let r=P._keyToDOMMap.get(f[e]),i=r&&r.__lexicalTextContent;typeof i!=`string`&&M(350,t.getType()),n=i}else n=t.getTextContent();x+=n,e<o-1&&I(t)&&!t.isInline()&&(x+=La)}let S=r.__lexicalSlotTextLength||0,C=S>0?i.slice(S):i;return r.__lexicalTextContent=C.slice(0,C.length-b)+x,!0}(e,0,n,s,i,a,u,c)){let e=s.__lexicalTextContent;typeof e!=`string`&&M(353),F=r+e,fl(t,s,l);return}}}if(c===0){let t=e.__first,n=0;for(;t!==null;){let e=Bc.get(t);if(e===void 0)break;let r=Gc||Lc.has(t)||Ic.has(t),i=Mc();if(r)pl(t,o);else{let n,r;if(I(e)){r=Vc.get(t);let i=r&&r.__lexicalTextContent;typeof i!=`string`&&M(354,e.getType()),n=i}else n=e.getTextContent();F+=n,r!==void 0&&Pc(r)}R(e)?kc===null&&(kc=e.getFormat(),Ac=e.getStyle(),jc=e.__key):I(e)&&n<a-1&&!e.isInline()&&(F+=La),Nc(i),t=e.__next,n++}s.__lexicalTextContent=F,s.__lexicalFirstTextKey=jc,F=r+F;return}}if(i===1&&a===1){let r=e.__first,i=t.__first;if(r===i)pl(r,o);else{let e=vl(r),t=sl(i,null);try{e.parentNode===o?o.replaceChild(t,e):n.insertChild(t)}catch(n){if(typeof n==`object`&&n){let a=`${n.toString()} Parent: ${o.tagName}, new child: {tag: ${t.tagName} key: ${i}}, old child: {tag: ${e.tagName}, key: ${r}}.`;throw Error(a)}throw n}qc(r,null)}let a=Bc.get(i);R(a)&&kc===null&&(kc=a.getFormat(),Ac=a.getStyle(),jc=a.__key)}else{let r=Vp(e,Rc),s=Vp(t,Bc);if(r.length!==i&&M(227),s.length!==a&&M(228),i===0)a!==0&&cl(s,t,0,a-1,n);else if(a===0){if(i!==0){let e=n.after==null&&n.before==null&&rl(t).size===0&&n.element.__lexicalLineBreak==null;Jc(r,0,i-1,e?null:o),e&&(o.textContent=``)}}else(function(e,t,n,r,i,a){let o=r-1,s=i-1,c,l,u=a.getFirstChild(),d=0,f=0;for(;d<=o&&f<=s;){let e=t[d],r=n[f],i=Mc();if(e===r)u=hl(pl(r,a.element)),d++,f++;else{if(l===void 0&&(l=gl(n,f)),c===void 0)c=gl(t,d);else if(!c.has(e)){d++,Nc(i);continue}if(!l.has(e)){let t=vl(e);t.parentNode===a.element&&(u=hl(t)),qc(e,a.element),d++,c.delete(e),Nc(i);continue}if(c.has(r)){let e=nf(P,r);e!==u&&a.withBefore(u??a.before).insertChild(e),u=hl(pl(r,a.element)),d++,f++}else sl(r,a.withBefore(u??a.before)),f++}let o=Bc.get(r);o!==null&&R(o)?kc===null&&(kc=o.getFormat(),Ac=o.getStyle(),jc=o.__key):I(o)&&f<=s&&!o.isInline()&&(F+=La),Nc(i)}let p=d>o,m=f>s;if(p&&!m){let t=n[s+1],r=t===void 0?null:P.getElementByKey(t);cl(n,e,f,s,a.withBefore(r??a.before))}else m&&!p&&Jc(t,d,o,a.element)})(t,r,s,i,a,n)}s.__lexicalTextContent=F,s.__lexicalFirstTextKey=jc,F=r+F}(e,t,Yf(t,n,P)),U(t)||(r=t,kc==null||kc===r.__textFormat||Kc||r.setTextFormat(kc),function(e){Ac==null||Ac===e.__textStyle||Kc||e.setTextStyle(Ac)}(t))}(n,r,a),r.isInline()||(ru(r)||dl(0,r,a),ul(r,a)),s!==``){let t=a.__lexicalTextContent||``;a.__lexicalTextContent=s+t,F=e+s+t,a.__lexicalSlotTextLength=s.length}else(rl(r).size>0||rl(n).size>0)&&(a.__lexicalSlotTextLength=0);if(Sc(r)){let t=r.getTextContent();a.__lexicalTextContent=t,F=e+t}}else{let e=a.__lexicalTextContent;typeof e!=`string`&&M(356,n.getType()),F+=e,Pc(a)}if((Gc||r.__dir!==n.__dir||r.__parent!==n.__parent)&&($c(a,r),ru(r)&&!Gc))for(let e of r.getChildren())I(e)&&$c(nf(P,e.getKey()),e)}else{let t=r.getTextContent();if(L(r)){let t=r.decorate(P,Dc);t!==null&&ml(e,t),i&&(rl(r).size>0||rl(n).size>0)&&ol(n,r,a)}F+=t}if(!Kc&&ru(r)){let e=r.getLatest();if(e.__cachedText!==F){let t=e.getWritable();t.__cachedText=F,r=t}}return Wc.$decorateDOM(r,n,a,P),Tc(r),a}function ml(e,t){let n=P._pendingDecorators,r=P._decorators;if(n===null){if(r[e]===t)return;n=jd(P)}n[e]=t}function hl(e){let t=e.nextSibling;return t!==null&&t===P._blockCursorElement&&(t=t.nextSibling),t}function gl(e,t){let n=new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function _l(e,t,n,r,i,a){F=``,kc=null,Ac=null,jc=null,Gc=r===2,P=n,Dc=n._config,Wc=n._config.dom||hm,Oc=n._nodes,Fc=P._listeners.mutation,Ic=i,Lc=a,Rc=e._nodeMap,zc=e,Bc=t._nodeMap,Kc=t._readOnly,Vc=is(n._keyToDOMMap),Hc=function(){let e=new Map,t=t=>{for(let n of t){let t=Bc.get(n);if(t===void 0)continue;let r=t.__parent;if(r===null)continue;let i=e.get(r);i===void 0&&(i=new Set,e.set(r,i)),i.add(n)}};return t(Ic.keys()),t(Lc),e}();let o=new Map;return Uc=o,pl(`root`,null),P=void 0,Oc=void 0,Ic=void 0,Lc=void 0,Rc=void 0,zc=void 0,Bc=void 0,Dc=void 0,Vc=void 0,Hc=void 0,Uc=void 0,Wc=hm,o}function vl(e){let t=Vc.get(e);return t===void 0&&M(75,e),t}function yl(e,t,n){Mm();let r=e.__key,i=e.getParent();if(i===null)return void(f_(e)!==null&&M(367,r,String(f_(e))));let a=function(e){let t=J();if(!q(t)||!I(e))return t;let{anchor:n,focus:r}=t,i=n.getNode(),a=r.getNode();return uf(i,e)&&n.set(e.__key,0,`element`),uf(a,e)&&r.set(e.__key,0,`element`),t}(e),o=!1;if(q(a)&&t){let t=a.anchor,n=a.focus;t.key===r&&(Vg(t,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0),n.key===r&&(Vg(n,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0)}else cg(a)&&t&&e.isSelected()&&e.selectPrevious();a_(e.getWritable(),t&&!o&&q(a)?a:null),n||U(i)||i.canBeEmpty()||!i.isEmpty()||yl(i,t),t&&a&&ru(i)&&i.isEmpty()&&i.selectEnd()}function bl(e){return e}var xl=Symbol.for(`ephemeral`);function Sl(e){return e[xl]||!1}var Cl={configurable:!0,enumerable:!1,value:void 0,writable:!0},wl=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:e}=jp(this);return e===void 0&&M(64,this.name),e}static clone(e){M(65,this.name)}$config(){return{}}config(e,t){let n=t.extends||Hp(this.constructor);return Object.assign(t,{extends:n}),typeof e==`string`&&Object.assign(t,{type:e}),{[e]:t}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}resetOnCopyNodeFrom(e){this.__state&&=this.__state.getWritable(this).resetOnCopyNode()}static importDOM;constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",Cl),Object.defineProperty(this,Cc,Cl),xd(this,e)}getType(){return this.__type}isInline(){M(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e===`root`)return!0;let t=B(e);if(t===null)break;e=t.__parent===null?f_(t):t.__parent}return!1}isSelected(e){let t=e||J();if(t==null)return!1;let n=t.getNodes().some(e=>e.__key===this.__key);if(R(this))return n;if(q(t)&&t.anchor.type===`element`&&t.focus.type===`element`){if(t.isCollapsed())return!1;let e=this.getParent();if(L(this)&&this.isInline()&&e){let n=t.isBackward()?t.focus:t.anchor;if(e.is(n.getNode())&&n.offset===e.getChildrenSize()&&this.is(e.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){let e=this.getLatest().__parent;return e===null?null:B(e)}getParentOrThrow(){let e=this.getParent();return e===null&&M(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let t=e.getParent();if(U(t)||f_(e)!==null)return I(e)||e===this&&L(e)||M(194),e;e=t}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&M(67,this.__key),e}getParents(){let e=[],t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){let e=[],t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){let e=this.getLatest().__prev;return e===null?null:B(e)}getPreviousSiblings(){return c_(this.getPreviousSibling(),`previous`).reverse()}getNextSibling(){let e=this.getLatest().__next;return e===null?null:B(e)}getNextSiblings(){return c_(this.getNextSibling(),`next`)}is(e){return e!=null&&this.__key===e.__key}isBefore(e){let t=uv(this,e);return t!==null&&(t.type===`descendant`||(t.type===`branch`?sv(t)===-1:(t.type!==`same`&&t.type!==`ancestor`&&M(279),!1)))}isParentOf(e){return uf(e,this)}getNodesBetween(e){let t=this.isBefore(e),n=[],r=this,i=!0,a=0;for(;r!==null&&((i||a===0)&&n.push(r),!r.is(e));){!i&&a>0&&a--;let e=i&&I(r)?t?r.getFirstChild():r.getLastChild():null;e!==null&&a++;let n=e||(t?r.getNextSibling():r.getPreviousSibling());i=n!==null,r=n||r.getParent()}return t?n:n.reverse()}isDirty(){let e=K()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){if(Sl(this))return this;let e=B(this.__key);return e===null&&M(442,this.__key,this.__type),e}getWritable(){if(Sl(this))return this;Mm();let e=Pm(),t=K(),n=this.__key,r=t._cloneNotNeeded,i=r.get(n),a=e._selection;if(a!==null&&a.setCachedNodes(null),i!==void 0)return Cd(i),i;let o=e._nodeMap,s=o.get(n);s===void 0&&M(442,n,this.__type);let c=tp(s);return r.set(n,c),o.set(n,c),Cd(c),c}getTextContent(){return E_(this)}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){M(70)}updateDOM(e,t,n){M(71)}getDOMSlot(e){return new hs(e)}exportDOM(e){return{element:Jf(e).$createDOM(this,e)}}exportJSON(e=!1){let t=function(e,t){let n=pp(fp(e.constructor)),{generated:r,isCompactDefault:i}=n,a=r===null?void 0:t?r.exportCompactJSON:r.exportJSON;return a===void 0?function(e,t,n){let r=n?{type:e.__type}:{};return I(e)&&(r.children=[]),function(e,t,n,r){for(let i=0;i<t.length;i++){let a=t[i];if(r&&a.derived)continue;let o;if(a.kind===`ownField`){let t=Ep(e)[a.field];o=a.getterTable===void 0?t:Ks(a.getterTable,t)?a.getterTable[t]:void 0}else o=a.getter.call(e);a.kind===`ownField`&&a.when!==void 0&&(!Dp(a,o)&&a.when.call(e)||(o=void 0)),r&&Dp(a,o)||(n[a.key]=o)}}(e,t,r,n),n||(r.type=e.__type,r.version=1),r}(e,n.getters,t):t?a(e,i):a(e)}(this,e),n=this.__state?this.__state.toJSON():void 0;return n!==void 0&&Object.assign(t,n),t}static importJSON(e){M(18,this.name)}updateFromJSON(e){return Ap(gc(this,e),e)}static transform(){return null}remove(e){yl(this,!0,e)}replace(e,t){Mm();let n=J();n!==null&&(n=n.clone()),vf(this,e);let r=this.getLatest(),i=this.__key,a=p_(r);a!==null&&M(400,i,r.getType(),a.getKey(),a.getType());let o=e.__key,s=e.getWritable(),c=this.getParentOrThrow().getWritable(),l=c.__size,u=s.getParent();a_(s,q(n)?n:null);let d=r.getPreviousSibling(),f=r.getNextSibling();yl(r,!1,!0),r_(c,s,d&&d.getWritable(),f&&f.getWritable()),c.__size=u!==null&&u.is(c)?l-1:l;let p=0;if(t&&(I(this)&&I(s)||M(139),p=s.getChildrenSize(),s.splice(p,0,this.getChildren())),q(n)){Fd(n);for(let e of[n.anchor,n.focus])e.key===i&&(t&&e.type===`element`?e.set(s.__key,p+e.offset,`element`):tg(e,s))}return Td()===i&&wd(o),s}insertAfter(e,t=!0){return o_(this,`next`,e,t)}insertBefore(e,t=!0){return o_(this,`previous`,e,t)}isParentRequired(){return!1}createParentElementNode(){return z()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){return s_(Y(this,`previous`),e,t)}selectNext(e,t){return s_(Y(this,`next`),e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}};function Tl(e){return e instanceof wl}function El(e,t){let n=e.__mode,r=e.__format,i=e.__style,a=t.__mode,o=t.__format,s=t.__style,c=e.__state,l=t.__state;return(n===null||n===a)&&(r===null||r===o)&&(i===null||i===s)&&(e.__state===null||c===l||function(e,t){if(e===t)return!0;let n=new Set;return!(e&&yc(n,e,t)||t&&yc(n,t,e)||e&&bc(n,e,t)||t&&bc(n,t,e))}(c,l))}function Dl(e,t){let n=e.mergeWithSibling(t),r=K()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function Ol(e){let t,n,r=e;if(!Ed(r)){if(r.__text!==``||!r.isSimpleText()||r.isUnmergeable()){for(;(t=r.getPreviousSibling())!==null&&R(t)&&t.isSimpleText()&&!t.isUnmergeable()&&!Ed(t);){if(t.__text!==``){if(El(t,r)){r=Dl(t,r);break}break}t.remove()}for(;(n=r.getNextSibling())!==null&&R(n)&&n.isSimpleText()&&!n.isUnmergeable()&&!Ed(n);){if(n.__text!==``){if(El(r,n)){r=Dl(r,n);break}break}n.remove()}}else r.remove()}}function kl(e){return Al(e.anchor),Al(e.focus),e}function Al(e){for(;e.type===`element`;){let t=e.getNode(),n=e.offset,r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),R(r)){e.set(r.__key,i?r.getTextContentSize():0,`text`,!0);break}if(!I(r))break;e.set(r.__key,i?r.getChildrenSize():0,`element`,!0)}}var jl=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function Ml(e,t){if(typeof e==`number`)return Number.isFinite(e)?e:t;if(typeof e!=`string`||!jl.test(e))return t;let n=Number(e);return Number.isFinite(n)?n:t}function Nl(e,t,n,r,i){let a=Ml(e,t);return a>=n&&a<=r&&Number.isInteger(a)?a:t}var Pl=e=>{let t=Ms(e,`format`),n=Ns(e,`format`),r=Fs(e,`format`);return{exportJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles();return{children:[],direction:e.__dir,format:t[e.__format],indent:e.__indent,textFormat:n!==0&&i?n:void 0,textStyle:r!==``&&i?r:void 0,type:e.__type,version:1}},exportCompactJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles(),a={type:e.__type,children:[]},o=e.__dir;o!=null&&(a.direction=o);let s=t[e.__format];s!==void 0&&s!==``&&(a.format=s);let c=e.__indent;return c!==void 0&&c!==0&&(a.indent=c),n!==void 0&&n!==0&&i&&(a.textFormat=n),r!==void 0&&r!==``&&i&&(a.textStyle=r),a},updateFromJSON:function(e,t){let i=t.direction;e.__dir=i===null||i===`ltr`||i===`rtl`?i:null;let a=t.format;e.__format=typeof a==`string`&&a in n?n[a]:r,e.__indent=Nl(t.indent,0,0,1/0),e.__textFormat=Ml(t.textFormat,0);let o=t.textStyle;return e.__textStyle=typeof o==`string`?o:``,e}}};function Fl(e,t){e.__detail=t.__detail,e.__format=t.__format,e.__mode=t.__mode,e.__style=t.__style,e.__text=t.__text}var Il=e=>{let t=Ms(e,`mode`),n=Ps(e,`detail`,0),r=Ps(e,`format`,0),i=Ns(e,`mode`),a=Fs(e,`mode`);return{exportJSON:function(e){return{detail:e.__detail,format:e.__format,mode:t[e.__mode],style:e.__style,text:e.__text,type:e.__type,version:1}},exportCompactJSON:function(e){let n={type:e.__type},r=e.__detail;r!==void 0&&r!==0&&(n.detail=r);let i=e.__format;i!==void 0&&i!==0&&(n.format=i);let a=t[e.__mode];a!==void 0&&a!==`normal`&&(n.mode=a);let o=e.__style;o!==void 0&&o!==``&&(n.style=o);let s=e.__text;return s!==void 0&&s!==``&&(n.text=s),n},updateFromJSON:function(e,t){let o=t.detail;e.__detail=typeof o==`string`&&o in n?n[o]:Ml(o,0);let s=t.format;e.__format=typeof s==`string`&&s in r?r[s]:Ml(s,0);let c=t.mode;e.__mode=typeof c==`string`&&c in i?i[c]:a;let l=t.style;e.__style=typeof l==`string`?l:``;let u=t.text;return e.__text=typeof u==`string`?u:``,e},afterCloneFrom:Fl}},Ll=e=>{let t=Ms(e,`format`),n=Ns(e,`format`),r=Fs(e,`format`);return{exportJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles();return{children:[],direction:e.__dir,format:t[e.__format],indent:e.__indent,textFormat:n!==0&&i?n:void 0,textStyle:r!==``&&i?r:void 0,type:e.__type,version:1}},exportCompactJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles(),a={type:e.__type,children:[]},o=e.__dir;o!=null&&(a.direction=o);let s=t[e.__format];s!==void 0&&s!==``&&(a.format=s);let c=e.__indent;return c!==void 0&&c!==0&&(a.indent=c),n!==void 0&&n!==0&&i&&(a.textFormat=n),r!==void 0&&r!==``&&i&&(a.textStyle=r),a},updateFromJSON:function(e,t){let i=t.direction;e.__dir=i===null||i===`ltr`||i===`rtl`?i:null;let a=t.format;e.__format=typeof a==`string`&&a in n?n[a]:r,e.__indent=Nl(t.indent,0,0,1/0),e.__textFormat=Ml(t.textFormat,0);let o=t.textStyle;return e.__textStyle=typeof o==`string`?o:``,e}}},Rl=()=>({exportJSON:function(e){return{type:e.__type,version:1}},exportCompactJSON:function(e){return{type:e.__type}}}),zl=e=>{let t=Ms(e,`mode`),n=Ps(e,`format`,0);return{exportJSON:function(e){return{detail:e.__detail,mode:t[e.__mode],text:e.__text,format:e.__format,style:e.__style,type:e.__type,version:1}},exportCompactJSON:function(e){let t={type:e.__type},n=e.__format;n!==void 0&&n!==0&&(t.format=n);let r=e.__style;return r!==void 0&&r!==``&&(t.style=r),t},updateFromJSON:function(e,t){let r=t.format;e.__format=typeof r==`string`&&r in n?n[r]:Ml(r,0);let i=t.style;return e.__style=typeof i==`string`?i:``,e}}},Bl=new WeakMap;function Vl(e,t){for(let n=e;n!==null&&n!==t;n=Object.getPrototypeOf(n)){let t=n.prototype;if(t!==void 0&&Object.prototype.hasOwnProperty.call(t,`isInline`)&&typeof t.isInline==`function`&&!Pp(t.isInline))try{let t=e.prototype.isInline.call(Object.create(e.prototype));return typeof t==`boolean`?t:null}catch{return null}}}function Hl(e){for(let{ownNodeConfig:t}of zp(e))if(t&&t.children!==void 0)return t.children}function Ul(e){let t=Bl.get(e);if(t===void 0){let n={},r={},i=!1;for(let{klass:t,ownNodeConfig:a}of zp(e))a&&(r.inline===void 0&&a.inline!==void 0&&(n.inline=a.inline,r.inline=t),r.children===void 0&&a.children!==void 0&&(n.children=a.children,r.children=t),i||a.mergeAdjacent===void 0||(i=!0,!1!==a.mergeAdjacent&&(n.mergeAdjacent=a.mergeAdjacent,r.mergeAdjacent=t)));let a=function(e){let t=new Set,n=Sp(e);for(let e of Object.keys(n))!0===n[e].derived&&t.add(e);for(let{ownNodeConfig:n}of zp(e)){let e=n&&n.stateConfigs;if(e)for(let n of e){let e=n instanceof sc?n:n.stateConfig;e.derived&&t.add(e.key)}}return t}(e);r.inline!==void 0&&r.inline!==e&&Vl(e,r.inline)!==void 0&&Vl(e,r.inline)!==n.inline&&(delete n.inline,delete r.inline),r.mergeAdjacent===void 0||r.mergeAdjacent===e||function(e,t,n){let r=Sp(e);for(let e of t.by)if(typeof e==`string`){if(!(e in r))return{entry:e,reason:`unknown`};if(n.has(e))return{entry:e,reason:`derived`}}else if(e.derived)return{entry:String(e.key),reason:`derived-state`};return null}(e,n.mergeAdjacent,a)===null&&function(e,t){if(!Array.isArray(t)||t.includes(`inline`))return null;for(let n of t){if(n===`inline`)continue;let t=Hl(n);if(!(t===`inline`||Array.isArray(t)&&t.includes(`inline`)&&t.every(t=>t===`inline`||t===e||e.prototype instanceof t)))return n}return null}(e,n.children)===null||(delete n.mergeAdjacent,delete r.mergeAdjacent),t=Object.freeze({...n,declaredBy:Object.freeze(r),derived:a,derivedNames:a}),Bl.set(e,t)}return t}function Wl(e){let{derivedNames:t,...n}=Ul(e);return Object.freeze({...n,derived:new Set(t)})}function Gl(e){return!1}function Kl(){return{...Ua,0:``}}function ql(){return{...Va,"":0}}var Jl=Kl(),Yl=ql(),Xl=ec()({direction:rc(Zs([null,`ltr`,`rtl`]),{field:`__dir`}),format:rc(Zs([``,`left`,`start`,`center`,`right`,`end`,`justify`]),{field:`__format`,getter:`getFormatType`,getterTable:Jl,setter:`setFormat`,setterTable:Yl}),indent:rc(Ys(0,{integer:!0,min:0}),{field:`__indent`}),textFormat:ic(Ys(),{getter:{field:`__textFormat`,method:`getSerializedTextFormat`,when:`shouldSerializeTextStyles`},setter:{field:`__textFormat`}}),textStyle:ic(qs(),{getter:{field:`__textStyle`,method:`getSerializedTextStyle`,when:`shouldSerializeTextStyles`},setter:{field:`__textStyle`}})});function Zl(e){if(U(e)&&!Gl(K())){let t=null;for(let n of e.getChildren())t=n.isInline()?(t||n.replace(n.createParentElementNode())).append(n):null}}var Ql=class extends wl{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;__slotHost;__slots;$config(){return this.config(Symbol.for(`ElementNode`),{$transform:Zl,extends:wl,generated:Pl,json:Xl})}constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style=``,this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=``,this.__slotHost=null,this.__slots=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__slotHost=e.__slotHost,this.__slotHost!==null&&this.__parent!==null&&M(384,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=e.__slots),this.__style=e.__style,function(e,t){e.__dir=t.__dir,e.__format=t.__format,e.__indent=t.__indent,e.__textFormat=t.__textFormat,e.__textStyle=t.__textStyle}(this,e)}getFormat(){return this.getLatest().__format}getFormatType(){return Ua[this.getFormat()]||``}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){return c_(this.getFirstChild(),`next`)}getChildrenKeys(){let e=[],t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0&&v_(this).length===0}isDirty(){let e=K()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){let e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){let e=[];for(let t of v_(this)){let n=y_(this,t);if(I(n))for(let t of n.getAllTextNodes())e.push(t)}let t=this.getFirstChild();for(;t!==null;){if(R(t)&&e.push(t),I(t))for(let n of t.getAllTextNodes())e.push(n);t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;I(e);){let t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;I(e);){let t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){let t=e>=this.getChildrenSize(),n=t?this.getLastChild():this.getChildAtIndex(e);return I(n)&&(t?n.getLastDescendant():n.getFirstDescendant())||n}getFirstChild(){let e=this.getLatest().__first;return e===null?null:B(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&M(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return e===null?null:B(e)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&M(96,this.__key),e}getChildAtIndex(e){let t=this.getChildrenSize(),n,r;if(e<t/2){for(n=this.getFirstChild(),r=0;n!==null&&r<=e;){if(r===e)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=t-1;n!==null&&r>=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e=E_(this),t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContent(),I(i)&&r!==n-1&&!i.isInline()&&(e+=La)}return e}getTextContentSize(){let e=function(e){let t=0;for(let n of __(e).values()){let e=B(n);e!==null&&(t+=e.getTextContentSize())}return t}(this),t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContentSize(),I(i)&&r!==n-1&&!i.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==``){let t=Va[e];return(this.getFormat()&t)!==0}return!1}hasTextFormat(e){let t=za[e];return(this.getTextFormat()&t)!==0}getFormatFlags(e,t){return yd(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){Mm();let n=J(),r=e,i=t,a=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){let e=this.getFirstChild();if(R(e)||I(e))return e.select(0,0)}else if(!(e!==void 0&&e!==a||t!==void 0&&t!==a)){let e=this.getLastChild();if(R(e)||I(e))return e.select()}}r===void 0&&(r=a),i===void 0&&(i=a);let o=this.__key;return q(n)?(n.anchor.set(o,r,`element`),n.focus.set(o,i,`element`),n.dirty=!0,n):jg(o,r,o,i,`element`,`element`)}selectStart(){let e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){let e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){let e=this.getWritable();return this.getChildren().forEach(e=>e.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){let t=this.getWritable();return t.__dir=e,t}setFormat(e){let t=this.getWritable();return t.__format=e!==``&&Va[e]||0,t}setStyle(e){let t=this.getWritable();return t.__style=e||``,t}setTextFormat(e){let t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){let t=this.getWritable();return t.__textStyle=e,t}setIndent(e){let t=this.getWritable();return t.__indent=e,t}splice(e,t,n){Sl(this)&&M(324,this.__key,this.__type);let r=this.getChildrenSize(),i=this.getWritable();e+t<=r||M(226,String(e),String(t),String(r));for(let e of n);let a=i.__key,o=[],s=[],c=this.getChildAtIndex(e+t),l=null,u=r-t+n.length;if(e!==0){if(e===r)l=this.getLastChild();else{let t=this.getChildAtIndex(e);t!==null&&(l=t.getPreviousSibling())}}t>0&&(s=function(e,t,n,r){let i=[],a=t;for(let e=0;e<n;e++){a===null&&M(100);let e=a.getNextSibling();i.push(a.getWritable()),a=e}return t_(e,r&&r.getWritable(),a&&a.getWritable()),e.__size-=i.length,i.map(e=>(n_(e),e.__prev=null,e.__next=null,e.__parent=null,e.__key))}(i,l===null?this.getFirstChild():l.getNextSibling(),t,l));let d=n.length>0&&l!==null?l.getWritable():null;for(let e of n){d!==null&&e.is(d)&&(l=d.getPreviousSibling(),d=l&&l.getWritable()),c!==null&&e.is(c)&&(c=c.getNextSibling());let t=e.getWritable();t.__parent===a&&u--,i_(t);let n=e.__key;r_(i,t,d,c&&c.getWritable()),e.__key===a&&M(76),o.push(n),d=t}if(i.__size=u,s.length){let e=J();if(q(e)){let t=new Set(s),n=new Set(o);for(let r of[e.anchor,e.focus])$l(r,t,n)&&Vg(r,r.getNode(),this,l,c);u!==0||this.canBeEmpty()||U(this)||this.remove()}}return i}getDOMSlot(e){return new _s(e)}exportDOM(e){let{element:t}=super.exportDOM(e);if(W(t)){let e=this.getIndent();e>0&&(t.style.paddingInlineStart=40*e+`px`,t.setAttribute(`data-lexical-indent`,String(e)));let n=this.getDirection();n&&(t.dir=n)}return{element:t}}shouldSerializeTextStyles(){if(U(this))return!1;for(let e=this.getFirstChild();e!==null;e=e.getNextSibling())if(R(e))return!1;return!0}getSerializedTextFormat(){let e=this.getTextFormat();return e!==0&&this.shouldSerializeTextStyles()?e:void 0}getSerializedTextStyle(){let e=this.getTextStyle();return e!==``&&this.shouldSerializeTextStyles()?e:void 0}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){t.read(`latest`,()=>{let n=Yf(this,e,t),r=n.element;n.after&&n.after.parentNode!==r&&(n=n.withAfter(null)),n.before&&n.before.parentNode!==r&&(n=n.withBefore(null));let i=n.getManagedLineBreak();i&&n.insertManagedLineBreak(i.nodeName===`IMG`);let a=n.getFirstChild();for(let e of this.getChildrenKeys()){let i=t.getElementByKey(e);if(!i)continue;let o,s=a;for(;s&&!(o=kd(s,t))&&sp(s);)s=s.nextSibling;s!==i&&r.insertBefore(i,o?s:a||n.getInsertionAnchor()),a=i.nextSibling}ul(this,e,n)})}};function I(e){return e instanceof Ql}function $l(e,t,n){let r=e.getNode();for(;r;){let e=r.__key;if(t.has(e)&&!n.has(e))return!0;r=r.getParent()}return!1}var eu=class extends wl{__slotHost;__slots;constructor(e){super(e),this.__slotHost=null,this.__slots=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__slotHost=e.__slotHost,this.__slotHost!==null&&this.__parent!==null&&M(383,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=e.__slots)}decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function L(e){return e instanceof eu}function tu(e){let t=e.getLatest().__cachedText;return t===null||!jm()&&K()._dirtyType!==0?null:t}var nu=class extends Ql{__cachedText;$config(){return this.config(`root`,{extends:Ql})}constructor(){super(`root`),this.__cachedText=null}getTopLevelElementOrThrow(){M(51)}getTextContent(){let e=tu(this);return e===null?super.getTextContent():e}getTextContentSize(){let e=tu(this);return e===null?super.getTextContentSize():e.length}remove(){M(52)}replace(e){M(53)}insertBefore(e){M(54)}insertAfter(e){M(55)}updateDOM(e,t){return!1}splice(e,t,n){for(let e of n)I(e)||L(e)||M(282);return super.splice(e,t,n)}static importJSON(e){return V().updateFromJSON(e)}collapseAtStart(){return!0}};function ru(e){return e instanceof nu}function iu(e){let t={};if(!e)return t;let n=``,r=``,i=null,a=!1,o=!1,s=!1,c=0,l=e.length,u=-1;for(let d=0;d<l;d++){let l=e[d];if(a)l===`*`&&e[d+1]===`/`&&(a=!1,d++);else if(o)u===-1&&(u=d),o=!1;else if(i===null){if(l!==`/`||e[d+1]!==`*`){if(l!==`"`&&l!==`'`){if(l!==`(`){if(l!==`)`){if(s||l!==`:`||c!==0){if(l===`;`&&c===0){u!==-1&&(s?r+=e.slice(u,d):n+=e.slice(u,d),u=-1);let i=n.trim(),a=r.trim();i!==``&&a!==``&&(t[i]=a),n=``,r=``,s=!1;continue}u===-1&&(u=d)}else u!==-1&&(n+=e.slice(u,d),u=-1),s=!0}else u===-1&&(u=d),c=Math.max(0,c-1)}else u===-1&&(u=d),c++}else u===-1&&(u=d),i=l}else u!==-1&&(s?r+=e.slice(u,d):n+=e.slice(u,d),u=-1),a=!0,d++}else u===-1&&(u=d),l===`\\`?o=!0:l===i&&(i=null)}u!==-1&&(s?r+=e.slice(u,l):n+=e.slice(u,l));let d=n.trim(),f=r.trim();return d!==``&&f!==``&&(t[d]=f),t}function au(e,t,n){let r=n.trimEnd(),i=r.length-10;i>=0&&r.slice(i).toLowerCase()===`!important`?e.setProperty(t,r.slice(0,i).trim(),`important`):e.setProperty(t,n,``)}function ou(e,t,n=``){if(t===n)return;let r=iu(n),i=iu(t);for(let t in i)delete r[t],au(e,t,i[t]);for(let t in r)e.removeProperty(t)}var su=ec()({detail:rc(tc(Ys(),Ba),{field:`__detail`}),format:rc(tc(Ys(),za),{field:`__format`}),mode:rc(Zs([`normal`,`token`,`segmented`]),{field:`__mode`,getterTable:Ga,setterTable:Wa}),style:rc(qs(),{field:`__style`}),text:rc(qs(),{field:`__text`,getter:`getTextContent`,setter:`setTextContent`})});function cu(e,t){return 16&t?`code`:128&t?`mark`:32&t?`sub`:64&t?`sup`:null}function lu(e,t){return 1&t?`strong`:2&t?`em`:`span`}function uu(e,t,n,r,i){let a=r.classList,o=Xd(i,`base`);o!==void 0&&a.add(...o),o=Xd(i,`underlineStrikethrough`);let s=!1,c=8&t&&4&t;o!==void 0&&(8&n&&4&n?(s=!0,c||a.add(...o)):c&&a.remove(...o));for(let e in za){let r=za[e];if(o=Xd(i,e),o!==void 0){if(n&r){if(s&&(e===`underline`||e===`strikethrough`)){t&r&&a.remove(...o);continue}((t&r)===0||c&&e===`underline`||e===`strikethrough`)&&a.add(...o)}else t&r&&a.remove(...o)}}Yd(r,`class`)}function du(e,t,n){let r=n.isComposing(),i=e+(r?Ia:``),a=qf(),o=Jf(a).$getDOMSlot(n,t,a),s=o.getFirstChild();if(s===null||s.nodeType!==Node.TEXT_NODE)return void o.insertChild(kf().createTextNode(i));let c=s,l=c.nodeValue;if(l!==i){if(r||wa||ja){let[e,t,n]=function(e,t){let n=e.length,r=t.length,i=0,a=0;for(;i<n&&i<r&&e[i]===t[i];)i++;for(;a+i<n&&a+i<r&&e[n-a-1]===t[r-a-1];)a++;return[i,n-i-a,t.slice(i,r-a)]}(l,i);c.replaceData(e,t,n)}else c.nodeValue=i}}function fu(e,t,n,r,i,a){du(i,e,t);let o=a.theme.text;o!==void 0&&uu(0,0,r,e,o)}function pu(e,t){let n=kf().createElement(t);return n.appendChild(e),n}function mu(e){return e!=null&&!0===e.__isInlineFormattable}var hu=class extends wl{__text;__format;__style;__mode;__detail;get __isInlineFormattable(){return!0}$config(){return this.config(`text`,{extends:wl,generated:Il,importDOM:{"#text":()=>({conversion:bu,priority:0}),b:()=>({conversion:_u,priority:0}),code:()=>({conversion:Cu,priority:0}),em:()=>({conversion:Cu,priority:0}),i:()=>({conversion:Cu,priority:0}),mark:()=>({conversion:Cu,priority:0}),s:()=>({conversion:Cu,priority:0}),span:()=>({conversion:gu,priority:0}),strong:()=>({conversion:Cu,priority:0}),sub:()=>({conversion:Cu,priority:0}),sup:()=>({conversion:Cu,priority:0}),u:()=>({conversion:Cu,priority:0})},json:su})}constructor(e=``,t){super(t),this.__text=e,this.__format=0,this.__style=``,this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){return Ga[this.getLatest().__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Td()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let t=za[e];return(this.getFormat()&t)!==0}isSimpleText(){let e=this.getLatest();return e.__type===`text`&&e.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return yd(this.getLatest().__format,e,t)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,t){let n=this.__format,r=cu(0,n),i=lu(0,n),a=r===null?i:r,o=kf().createElement(a),s=o;this.hasFormat(`code`)&&o.setAttribute(`spellcheck`,`false`),r!==null&&(s=kf().createElement(i),o.appendChild(s)),fu(s,this,0,n,this.__text,e);let c=this.__style;return c!==``&&ou(o.style,c),o}updateDOM(e,t,n){let r=this.__text,i=e.__format,a=this.__format,o=cu(0,i),s=cu(0,a),c=lu(0,i),l=lu(0,a);if((o===null?c:o)!==(s===null?l:s))return!0;if(o===s&&c!==l){let e=t.firstChild;e??M(48);let i=kf().createElement(l);return fu(i,this,0,a,r,n),t.replaceChild(i,e),!1}let u=t;s!==null&&o!==null&&(u=t.firstChild,u??M(49)),du(r,u,this);let d=n.theme.text;d!==void 0&&i!==a&&uu(0,i,a,u,d);let f=e.__style,p=this.__style;return f!==p&&(ou(t.style,p,f),Yd(t,`style`)),!1}exportDOM(e){let{element:t}=super.exportDOM(e);return W(t)||M(132),t.style.whiteSpace=`pre-wrap`,this.hasFormat(`lowercase`)?t.style.textTransform=`lowercase`:this.hasFormat(`uppercase`)?t.style.textTransform=`uppercase`:this.hasFormat(`capitalize`)&&(t.style.textTransform=`capitalize`),this.hasFormat(`bold`)&&(t=pu(t,`b`)),this.hasFormat(`italic`)&&(t=pu(t,`i`)),this.hasFormat(`strikethrough`)&&(t=pu(t,`s`)),this.hasFormat(`underline`)&&(t=pu(t,`u`)),{element:t}}selectionTransform(e,t){}setFormat(e){let t=this.getWritable();return t.__format=typeof e==`string`?za[e]:e,t}setDetail(e){let t=this.getWritable();return t.__detail=typeof e==`string`?Ba[e]:e,t}setStyle(e){let t=this.getWritable();return t.__style=e,t}toggleFormat(e){let t=yd(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){let t=Wa[e];if(this.getLatest().__mode===t)return this;let n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.getLatest().__text===e)return this;let t=this.getWritable();return t.__text=e,t}select(e,t){Mm();let n=e,r=t,i=J(),a=this.getTextContent(),o=this.__key;if(typeof a==`string`){let e=a.length;n===void 0&&(n=e),r===void 0&&(r=e)}else n=0,r=0;if(!q(i))return jg(o,n,o,r,`text`,`text`);{let e=Td();e!==i.anchor.key&&e!==i.focus.key||wd(o),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){let i=this.getWritable(),a=i.__text,o=n.length,s=e;s<0&&(s=o+s,s<0&&(s=0));let c=J();if(r&&q(c)){let t=e+o;c.setTextNodeRange(i,t,i,t)}return i.__text=a.slice(0,s)+n+a.slice(s+t),i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){Mm();let t=this.getLatest(),n=t.getTextContent();if(n===``)return[];let r=t.__key,i=Td(),a=n.length;e.sort((e,t)=>e-t),e.push(a);let o=[],s=e.length;for(let t=0,r=0;t<a&&r<=s;r++){let i=e[r];i>t&&(o.push(n.slice(t,i)),t=i)}let c=o.length;if(c===1)return[t];let l=o[0],u=t.getParent(),d,f=t.getFormat(),p=t.getStyle(),m=t.__detail,h=!1,g=null,_=null,v=J();if(q(v)){let[e,t]=v.isBackward()?[v.focus,v.anchor]:[v.anchor,v.focus];e.type===`text`&&e.key===r&&(g=e),t.type===`text`&&t.key===r&&(_=t)}t.isSegmented()?(d=wu(l),d.__format=f,d.__style=p,d.__detail=m,d.__state=xc(t,d),h=!0):d=t.setTextContent(l);let y=[d];for(let e=1;e<c;e++){let n=wu(o[e]);n.__format=f,n.__style=p,n.__detail=m,n.__state=xc(t,n);let a=n.__key;i===r&&wd(a),y.push(n)}let b=g?g.offset:null,x=_?_.offset:null,S=0;for(let e of y){if(!g&&!_)break;let t=S+e.getTextContentSize();if(g!==null&&b!==null&&b<=t&&b>=S&&(g.set(e.getKey(),b-S,`text`),b<t&&(g=null)),_!==null&&x!==null&&x<=t&&x>=S){_.set(e.getKey(),x-S,`text`);break}S=t}if(u!==null){(function(e){let t=e.getPreviousSibling(),n=e.getNextSibling();t!==null&&Cd(t),n!==null&&Cd(n)})(this);let e=u.getWritable(),t=this.getIndexWithinParent();h?(e.splice(t,0,y),this.remove()):e.splice(t,1,y),q(v)&&Bg(v,u,t,c-1)}return y}mergeWithSibling(e){let t=e===this.getPreviousSibling();t||e===this.getNextSibling()||M(50);let n=this.__key,r=e.__key,i=this.__text,a=i.length;Td()===r&&wd(n);let o=J();if(q(o)){let i=o.anchor,s=o.focus;i!==null&&i.key===r&&Hg(i,t,n,e,a),s!==null&&s.key===r&&Hg(s,t,n,e,a)}let s=e.__text,c=t?s+i:i+s;this.setTextContent(c);let l=this.getWritable();return e.remove(),l}isTextEntity(){return!1}};function gu(e){return{forChild:Tu(e.style),node:null}}function _u(e){let t=e,n=t.style.fontWeight===`normal`;return{forChild:Tu(t.style,n?void 0:`bold`),node:null}}var vu=new WeakMap;function yu(e){if(!W(e))return!1;if(e.nodeName===`PRE`)return!0;let t=e.style.whiteSpace;return typeof t==`string`&&t.startsWith(`pre`)}function bu(e){let t=e;e.parentElement===null&&M(129);let n=t.textContent||``;if(function(e){let t,n=e.parentNode,r=[e];for(;n!==null&&(t=vu.get(n))===void 0&&!yu(n);)r.push(n),n=n.parentNode;let i=t===void 0?n:t;for(let e=0;e<r.length;e++)vu.set(r[e],i);return i}(t)!==null)return{node:Jg(n)};if(n=n.replace(/\r/g,``).replace(/[ \t\n]+/g,` `),n===``)return{node:null};if(n[0]===` `){let e=t,r=!0;for(;e!==null&&(e=xu(e,!1))!==null;){let t=e.textContent||``;if(t.length>0){/[ \t\n]$/.test(t)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===` `){let e=t,r=!0;for(;e!==null&&(e=xu(e,!0))!==null;)if((e.textContent||``).replace(/^( |\t|\r?\n)+/,``).length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===``?{node:null}:{node:wu(n)}}function xu(e,t){let n=e;for(;;){let e;for(;(e=t?n.nextSibling:n.previousSibling)===null;){let e=n.parentElement;if(e===null)return null;n=e}if(n=e,W(n)){let e=n.style.display;if(e===``&&!Uf(n)||e!==``&&!e.startsWith(`inline`))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(gd(n))return n;if(n.nodeName===`BR`)return null}}var Su={code:`code`,em:`italic`,i:`italic`,mark:`highlight`,s:`strikethrough`,strong:`bold`,sub:`subscript`,sup:`superscript`,u:`underline`};function Cu(e){let t=Su[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:Tu(e.style,t),node:null}}function wu(e=``){return _f(new hu(e))}function R(e){return e instanceof hu}function Tu(e,t){let n=e.fontWeight,r=e.textDecoration.split(` `),i=n===`700`||n===`bold`,a=r.includes(`line-through`),o=e.fontStyle===`italic`,s=r.includes(`underline`),c=e.verticalAlign,l=e.textTransform;return e=>((R(e)||mu(e))&&(i&&!e.hasFormat(`bold`)&&e.toggleFormat(`bold`),a&&!e.hasFormat(`strikethrough`)&&e.toggleFormat(`strikethrough`),o&&!e.hasFormat(`italic`)&&e.toggleFormat(`italic`),s&&!e.hasFormat(`underline`)&&e.toggleFormat(`underline`),c!==`sub`||e.hasFormat(`subscript`)||e.toggleFormat(`subscript`),c!==`super`||e.hasFormat(`superscript`)||e.toggleFormat(`superscript`),l!==`lowercase`&&l!==`uppercase`&&l!==`capitalize`||e.hasFormat(l)||e.toggleFormat(l),t&&!e.hasFormat(t)&&e.toggleFormat(t)),e)}function Eu(e,t){let{type:n,key:r,offset:i}=e,a=yf(e.key);return n===`text`?(R(a)||M(266,a.getType(),r),W_(a,t,i)):(I(a)||M(267,a.getType(),r),zu(a,e.offset,t))}function Du(e,t){let{origin:n,direction:r}=t,i=r===`next`;R_(t)?e.set(n.getKey(),t.offset,`text`):z_(t)?R(n)?e.set(n.getKey(),G_(n,r),`text`):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+ +!!i,`element`):(B_(t)&&I(n)||M(268),e.set(n.getKey(),i?0:n.getChildrenSize(),`element`))}function Ou(e){let t=J(),n=q(t)?t:Mg();return ku(n,e),Fd(n),n}function ku(e,t){Du(e.anchor,t.anchor),Du(e.focus,t.focus)}function Au(e){let{anchor:t,focus:n}=e,r=Eu(t,`next`),i=Eu(n,`next`),a=iv(r,i)<=0?`next`:`previous`;return nv($_(r,a),$_(i,a))}function ju(e){let{direction:t,origin:n}=e,r=Y(n,P_(t)).getNodeAtCaret();return r?Y(r,t):q_(n.getParentOrThrow(),t)}function Mu(e,t=`root`){let n=[e];for(let r=B_(e)?e.getParentCaret(t):e.getSiblingCaret();r!==null;r=r.getParentCaret(t))n.push(ju(r));return n}function Nu(e){return!!e&&e.origin.isAttached()}function Pu(e,t=`removeEmptySlices`){if(e.isCollapsed())return e;let n=`root`,r=`next`,i=t,a=Ru(e,r),o=a.anchor.origin;for(;o!==null&&!U(o);)o=o.getParent();let s=I(o)?o.getFirstChild():null,c=Mu(a.anchor,n),l=Mu(a.focus.getFlipped(),n),u=new Set,d=[];for(let e of a.iterNodeCarets(n))if(B_(e))u.add(e.origin.getKey());else if(z_(e)){let{origin:t}=e;I(t)&&!u.has(t.getKey())||d.push(t)}let f=new Set;for(let e of d){let t=e.getParent();t===null||u.has(t.getKey())||f.add(t),Sd(e)}for(let e of f)!e.canBeEmpty()&&!U(e)&&e.isEmpty()&&e.isAttached()&&e.remove();for(let e of a.getTextSlices()){if(!e)continue;let{origin:t}=e.caret,n=t.getTextContentSize(),a=ju(Y(t,r)),o=t.getMode();if(Math.abs(e.distance)===n&&i===`removeEmptySlices`||o===`token`&&e.distance!==0)a.remove();else if(e.distance!==0){i=`removeEmptySlices`;let t=e.removeTextSlice(),n=e.caret.origin;if(o===`segmented`){let e=t.origin,n=wu(e.getTextContent()).setStyle(e.getStyle()).setFormat(e.getFormat());a.replaceOrInsert(n),t=W_(n,r,t.offset)}n.is(c[0].origin)&&(c[0]=t),n.is(l[0].origin)&&(l[0]=t.getFlipped())}}let p=Fu(c),m=Fu(l),h=function(e,t,n){let r=e&&e.getParentAtCaret(),i=t&&t.getParentAtCaret(),a=r&&i&&uv(r,i);if(!a||a.type!==`branch`)return null;let o=(e,t)=>{let r;for(let i=e;i&&!i.is(a.commonAncestor);i=i.getParent()){if(U(i))return;t&&!n.has(i.__key)||!Kf(i)||(r=i)}return r},s=o(r,!1),c=s&&o(i,!0);return s&&c&&v_(c).length===0?[s,c]:null}(p,m,u);if(h){let[e,t]=h;q_(e,`previous`).splice(0,t.getChildren());let n=t.getParent();for(t.remove(!0);n&&n.isEmpty();){let e=n;n=n.getParent(),e.remove(!0)}}else if(m){let e=function(e){if(B_(e)){let t=e.origin;if(Kf(t))return t}else{let t=e.getParentAtCaret();if(t&&Kf(t))return t}return null}(m),t=e&&e.getParent(),n=e&&e.getParents().findLast(hf);if(e&&t&&!ru(t)&&e.isEmpty()&&u.has(e.getKey())&&v_(e).length===0&&(!n||u.has(n.getKey()))){e.remove(!0);let n=t;for(;n&&!ru(n)&&n.isEmpty();){let e=n.getParent();if(e&&ru(e)&&e.getChildrenSize()<=1&&n.canBeEmpty())break;let t=n;n=e,t.remove(!0)}}}Pd(o,s)!==null||o===null||o.isAttached()||Pd(V(),null);let g=Fu([p,m,...c,...l]);if(g)return tv($_(g,e.direction));M(269,JSON.stringify(c.map(e=>e.origin.__key)))}function Fu(e){let t=e.find(Nu);return t&&Iu(t)}function Iu(e){let t=function(e){let t=e;for(;B_(t);){let e=Y_(t);if(!B_(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(R(t.origin))return R_(t)?t:W_(t.origin,n,n);let r=t.getAdjacentCaret();return z_(r)&&R(r.origin)?W_(r.origin,n,P_(n)):t}function Lu(e){return R_(e)&&e.offset!==G_(e.origin,e.direction)}function Ru(e,t){return e.direction===t?e:nv($_(e.focus,t),$_(e.anchor,t))}function zu(e,t,n){let r=e.getChildrenSize(),i=(t>0?Math.min(Math.ceil(t),r):0)-+(n===`next`),a=i<0||i>=r?null:e.getChildAtIndex(i);return a===null?q_(e,n):Y(a,n)}function Bu(e,t=`root`){let n=0,r=e,i=Y_(r);for(;i===null;){if(n--,i=r.getParentCaret(t),!i)return null;r=i,i=Y_(r)}return i&&[i,n]}function Vu(e){let{origin:t,offset:n,direction:r}=e;if(n===G_(t,r))return e.getSiblingCaret();if(n===G_(t,P_(r)))return ju(e.getSiblingCaret());let[i]=t.splitText(n);return R(i)||M(281),$_(Y(i,`next`),r)}function Hu(e,t){for(let n of e)if(n!==null&&n.caret.origin.is(t))return n}function Uu(e,t=null){let{origin:n}=e.caret,[r,i]=e.getSliceIndices();if(r===i)return null;if(r===0&&i===n.getTextContentSize())return n;let a=n.getParent(),o=t&&a&&zg(t,a)?n.getIndexWithinParent():-1,s=t?[t.anchor,t.focus].map(e=>[e,e.key===n.__key&&e.type===`text`?e.offset-r:a!==null&&e.key===a.__key&&e.offset===o?0:null]):[],c=n.splitText(r,i),l=c[r===0?0:1];a&&t&&t!==J()&&Bg(t,a,o,c.length-1);for(let[e,t]of s)t!==null&&e.set(l.__key,t,`text`);return l}function Wu(e,t){return!0}function Gu(e,{$copyElementNode:t=gf,$splitTextPointCaretNext:n=Vu,rootMode:r=`shadowRoot`,$shouldSplit:i=Wu,removeEmptyDestination:a=!1}={}){if(R_(e))return n(e);let o=e.getParentCaret(r);if(o){let{origin:n}=o;if(B_(e)){let e=ju(o);if(a&&n.isEmpty())return n.remove(),e;if(!n.canBeEmpty()||!i(n,`first`))return e}let r=c_((s=e).getNodeAtCaret(),s.direction);(r.length>0||!a&&n.canBeEmpty()&&i(n,`last`))&&o.insert(t(n).splice(0,0,r))}var s;return o}function Ku(e,t,n){let r=$_(t,`next`);R_(r)&&(r.offset===0?r=Y(r.origin,`previous`).getFlipped():r.offset===r.origin.getTextContentSize()&&(r=Y(r.origin,`next`))),r.origin.is(e)&&(z_(r)||M(342,e.getKey(),e.getType()),r=ju(r)),(e.is(r.getNodeAtCaret())||e.is(r.getFlipped().getNodeAtCaret()))&&e.remove(!0);for(let e=r;e;e=Gu(e,n))r=e;return R_(r)&&M(283),r.insert(e.isInline()?z().append(e):e),$_(Y(e.getLatest(),`next`),t.direction)}function qu(e,t){let n=Ru(q(t)?Au(t):t,`next`),r=h_(n.anchor.origin),i=h_(e.getLatest());if(r===null?i!==null:!r.is(i))return!1;let a=Iu(q_(e,`next`)),o=$_(Iu(q_(e,`previous`)),`next`);return iv(n.anchor,a)<=0&&iv(n.focus,o)>=0}var Ju=class extends Ql{$config(){return this.config(`paragraph`,{children:`inline`,extends:Ql,generated:Ll,importDOM:{p:()=>({conversion:Yu,priority:0})}})}createDOM(e){let t=kf().createElement(`p`),n=Xd(e.theme,`paragraph`);return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}exportDOM(e){let{element:t}=super.exportDOM(e);if(W(t)){this.isEmpty()&&t.append(kf().createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}exportJSON(e=!1){let t=super.exportJSON(e);if(t.textFormat===void 0||t.textStyle===void 0){let n=this.getChildren().find(R),r=n?n.getFormat():this.getTextFormat(),i=n?n.getStyle():this.getTextStyle();e&&r===0||(t.textFormat=r),e&&i===``||(t.textStyle=i)}return t}extractWithChild(e,t,n){if(!q(t)||this.getFormatType()===``&&this.getIndent()===0&&this.getStyle()===``)return!1;if(qu(this,t)){let e=this.getTextContent();return e!==``&&t.getTextContent()===e}return!1}insertNewAfter(e,t){let n=z();n.setTextFormat(e.format),n.setTextStyle(e.style);let r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}collapseAtStart(){if(this.getChildren().every(e=>R(e)&&!/\S/.test(e.getTextContent()))){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function Yu(e){let t=z();if(ap(t,e),rp(e,t),t.getFormatType()===``){let n=e.getAttribute(`align`);n&&n&&n in Va&&t.setFormat(n)}return ip(t,e),{node:t}}function z(){return _f(new Ju)}function Xu(e){return e instanceof Ju}var Zu=ec()({detail:ic(Ys(2),{getter:{field:`__detail`},setter:null}),mode:ic(Zs([`normal`]),{getter:{field:`__mode`,getterTable:{0:`normal`}},setter:null}),text:ic(qs(` `),{getter:{field:`__text`,method:`getTextContent`},setter:null})}),Qu=class extends hu{$config(){return this.config(`tab`,{extends:hu,generated:zl,json:Zu})}constructor(e=void 0){super(` `,e),this.__detail=2}createDOM(e){let t=super.createDOM(e),n=Xd(e.theme,`tab`);return n!==void 0&&t.classList.add(...n),t}setTextContent(e){return super.setTextContent(` `)}spliceText(e,t,n,r){return n===``&&t===0||n===` `&&t===1||M(286),this}setDetail(e){return e!==2&&M(127),this}setMode(e){return e!==`normal`&&M(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function $u(){return _f(new Qu)}function ed(e){return e instanceof Qu}var td=null;function nd(e){td=e}var rd=Symbol(`INTERNAL_SKIP_AFTER_CLONE_FROM`),id=1;function ad(e,t){let n=od(e,t);return n===void 0&&M(30,t),n}function od(e,t){return e._nodes.get(t)}var sd=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)};function cd(e,t){let n=t===void 0?(()=>{let t=e.getRootNode();return _d(t)||wf(t)?Lf(t):null})():t;if(!W(n)||n.hasAttribute(`data-lexical-slot`))return!1;let r=Ad(n),i=n.nodeName;return Tl(r)&&(i===`INPUT`||i===`TEXTAREA`||n.contentEditable===`true`&&pd(n)==null)}function ld(e){let t=e===null?null:Rf(e);return Bf(t)&&cd(t)}function ud(e,t,n){let r=e.getRootElement();if(!r)return!1;try{if(!t||!r.contains(t)||!r.contains(n))return!1}catch{return!1}return fd(t)===e&&e.read(`latest`,()=>!cd(t))}function dd(e){return e instanceof ym}function fd(e){let t=e;for(;t!=null;){let e=pd(t);if(dd(e))return e;t=rf(t)}return null}function pd(e){return e?e.__lexicalEditor:null}function md(e){return ed(e)||e.isToken()}function hd(e){return md(e)||e.isSegmented()}function gd(e){return Bf(e)&&e.nodeType===3}function _d(e){return Bf(e)&&e.nodeType===9}function vd(e){let t=e;for(;t!=null;){if(gd(t))return t;t=t.firstChild}return null}function yd(e,t,n){let r=za[t];if(n!==null&&(e&r)===(n&r))return e;let i=e^r;return t===`subscript`?i&=~za.superscript:t===`superscript`?i&=~za.subscript:t===`lowercase`?(i&=~za.uppercase,i&=~za.capitalize):t===`uppercase`?(i&=~za.lowercase,i&=~za.capitalize):t===`capitalize`&&(i&=~za.lowercase,i&=~za.uppercase),i}function bd(e){return R(e)||cm(e)||L(e)}function xd(e,t){let n=function(){let e=td;return td=null,e}();if((t||=n&&n.__key)!=null)return void(e.__key=t);Mm(),Nm();let r=K(),i=Pm(),a=``+id++;i._nodeMap.set(a,e),I(e)?r._dirtyElements.set(a,!0):r._dirtyLeaves.add(a),r._cloneNotNeeded.set(a,e),r._dirtyType===0&&(r._dirtyType=1),e.__key=a}function Sd(e){i_(e.getParent()===null?e:e.getWritable())}function Cd(e){Nm(),Sl(e)&&M(323,e.__key,e.__type);let t=e.__parent===null?d_(e)?e.__slotHost:null:e.__parent,n=Pm(),r=K(),i=n._nodeMap,a=r._dirtyElements;t!==null&&function(e,t,n){let r=e;for(;r!==null;){if(n.has(r))return;let e=t.get(r);if(e===void 0)break;n.set(r,!1),r=e.__parent===null?d_(e)?e.__slotHost:null:e.__parent}}(t,i,a);let o=e.__key;r._dirtyType===0&&(r._dirtyType=1),I(e)?a.set(o,!0):r._dirtyLeaves.add(o)}function wd(e){Mm();let t=K(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let e=B(n);e!==null&&e.getWritable()}if(e!==null){let t=B(e);t!==null&&t.getWritable()}}}function Td(){return jm()?null:K()._compositionKey}function Ed(e){return!Oa&&(Aa||Na)&&e.__text===``&&e.__key===K()._compositionKey}function B(e,t){let n=(t||Pm())._nodeMap.get(e);return n===void 0?null:n}function Dd(e,t){let n=kd(e,K());return n===void 0?null:B(n,t)}function Od(e,t,n){e[`__lexicalKey_${t._key}`]=n}function kd(e,t){return e[`__lexicalKey_${t._key}`]}function Ad(e,t){let n=e;for(;n!=null;){let e=Dd(n,t);if(e!==null)return e;n=rf(n)}return null}function jd(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Md(e){return e.read(()=>V().getTextContent())}function Nd(e,t){let n=ep(e.getEditorState()),r=[];for(let e of t){let t=n.get(e);t&&r.push(t)}r.length!==0&&e.update(()=>{for(let e of r)for(let t of e.keys()){let e=B(t);e&&e.markDirty()}},e._pendingEditorState===null?{tag:`history-merge`}:void 0)}function V(){return Pm()._nodeMap.get(`root`)}function Pd(e,t){if(!(U(e)&&e.isAttached()&&(ru(e)?e.getChildrenSize()===0:e.isEmpty())&&(ru(e)||t!==null&&Kf(t))))return null;let n=z();return e.append(n),n}function Fd(e){Mm();let t=Pm();e!==null&&(e.dirty=!0,e.setCachedNodes(null),q(e)&&K()._slotsUsed&&Dg(e)),t._selection=e}function Id(e){Mm(),Ds(K(),e)}function Ld(e){let t=function(e,t){let n=e;for(;n!=null;){let e=kd(n,t);if(e!==void 0)return e;n=rf(n)}return null}(e,K());return t===null?null:B(t)}function Rd(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function zd(e){let t=[];for(let n=e;n!==null;n=n._parentEditor)t.push(n);return t}var Bd=0;function Vd(){return va?Math.random().toString(36).replace(/[^a-z]+/g,``).substring(0,5):`s${(++Bd).toString(36)}`}function Hd(e){return gd(e)?e.nodeValue:null}function Ud(e,t,n){let r=Sf(ff(t));if(r===null)return;let i=Mf(r,t._rootElement),a=i.anchorNode,{anchorOffset:o,focusOffset:s}=i;if(a!==null){let t=Hd(a),r=Ad(a);if(t!==null&&R(r)){if((t===Ia||t===Ra)&&n){let e=n.length;t=n,o=e,s=e}t!==null&&Wd(r,t,o,s,e)}}}function Wd(e,t,n,r,i){let a=e;if(a.isAttached()&&(i||!a.isDirty())){let o=a.isComposing(),s=!Oa&&(Aa||Na);if(a.isToken()&&o)return;let c=t;if((o||i)&&(!t.endsWith(Ia)||s&&t===a.getTextContent()||(c=t.slice(0,-Ia.length)),i&&!s)){let e=Ra,t;for(;(t=c.indexOf(e))!==-1;)c=c.slice(0,t)+c.slice(t+e.length),n!==null&&n>t&&(n=Math.max(t,n-e.length)),r!==null&&r>t&&(r=Math.max(t,r-e.length))}let l=a.getTextContent();if(i||c!==l){let t=J();if(c===``){if(o&&!i&&s)return void Gd(a,``,t);if(wd(null),Aa||Oa||Na)a.remove();else{let e=K();Gd(a,``,t),setTimeout(()=>{e.update(()=>{a.isAttached()&&a.getTextContent()===``&&a.remove()})},20)}return}let l=a.getParent(),u=Rg(),d=a.getTextContentSize(),f=Td(),p=a.getKey();if(a.isToken()&&!o||f!==null&&p===f&&!o||q(u)&&(l!==null&&!l.canInsertTextBefore()&&u.anchor.offset===0||u.anchor.key===e.__key&&u.anchor.offset===0&&!a.canInsertTextBefore()&&!o||u.focus.key===e.__key&&u.focus.offset===d&&!a.canInsertTextAfter()&&!o))return void a.markDirty();if(!q(t)||n===null||r===null)return void Gd(a,c,t);if(t.setTextNodeRange(a,n,a,r),a.isSegmented()){let e=wu(a.getTextContent());a.replace(e),a=e}Gd(a,c,t)}}}function Gd(e,t,n){if(e.setTextContent(t),q(n)){let t=e.getKey(),r=!1;for(let i of[`anchor`,`focus`]){let a=n[i];a.type===`text`&&a.key===t&&(a.offset=G_(e,a.offset,`clamp`),r=!0)}r&&(n._cachedNodes=null,n._cachedIsBackward=null)}}function Kd(e){let t=e;for(;t!==null;){let e=t.getParent();if(e===null)return null;if(ru(e))return t;t=e}return null}function qd(e,t){let{anchor:n,focus:r}=e,i=n.key,a=n.offset,o=n.type,s=r.key,c=r.offset,l=r.type;if(kl(e),!ru(t))return e;let u=Kd(n.getNode());return I(u)&&u.isShadowRoot()&&u.is(Kd(r.getNode()))&&(n.set(i,a,o),r.set(s,c,l)),e}function Jd(e){let t=V();if(q(e)){let t=e.anchor,n=e.focus,r=t.getNode();if(ru(r))return t.set(r.getKey(),0,`element`),n.set(r.getKey(),r.getChildrenSize(),`element`),qd(e,r),e;let i=r.getTopLevelElementOrThrow(),a=i.getParent();return a===null?(I(i)&&(t.set(i.getKey(),0,`element`),n.set(i.getKey(),i.getChildrenSize(),`element`),qd(e,i)),e):(t.set(a.getKey(),0,`element`),n.set(a.getKey(),a.getChildrenSize(),`element`),qd(e,a),e)}{let e=t.select(0,t.getChildrenSize());return Fd(qd(e,t)),e}}function Yd(e,t){e.getAttribute(t)===``&&e.removeAttribute(t)}function Xd(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,r=n[t];if(r!==void 0)return r;let i=e[t];if(typeof i==`string`){let e=fv(i);return n[t]=e,e}return i}function Zd(e,t,n,r,i){if(n.size===0)return;let a=r.__type,o=r.__key,s=t.get(a);s===void 0&&M(33,a);let c=s.klass,l=e.get(c);l===void 0&&(l=new Map,e.set(c,l));let u=l.get(o),d=u===`destroyed`&&i===`created`;(u===void 0||d)&&l.set(o,d?`updated`:i)}function Qd(e){let t=e.getType(),n=Pm();if(n._readOnly){let e=ep(n).get(t);return e?Array.from(e.values()):[]}let r=n._nodeMap,i=[];for(let[,n]of r)n instanceof e&&n.__type===t&&n.isAttached()&&i.push(n);return i}function $d(e,t,n){let r=e.getParent(),i=n,a=e;return r!==null&&(t&&n===0?(i=a.getIndexWithinParent(),a=r):t||n!==a.getChildrenSize()||(i=a.getIndexWithinParent()+1,a=r)),a.getChildAtIndex(t?i-1:i)}function ef(e,t){let n=e.offset;if(e.type===`element`)return $d(e.getNode(),t,n);{let r=e.getNode();if(t&&n===0||!t&&n===r.getTextContentSize()){let e=t?r.getPreviousSibling():r.getNextSibling();return e===null?$d(r.getParentOrThrow(),t,r.getIndexWithinParent()+ +!t):e}}return null}function tf(e){let t=ff(e).event,n=t&&t.inputType;return n===`insertFromPaste`||n===`insertFromPasteAsQuotation`}function H(e,t,...n){return Jm(e,t,n[0],e)}function nf(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&M(75,t),n}function rf(e){let t=e.assignedSlot||e.parentElement;if(t!==null)return t;let n=e.parentNode;return wf(n)?n.host:null}function af(e){return _d(e)?e:W(e)?e.ownerDocument:null}function of(e,t){let n=parseFloat(e);return isFinite(n)?e.endsWith(`%`)?n*t/100:n:0}function sf(e,t,n,r){let i=t.clientWidth,a=t.scrollWidth-i;if(a<=0)return 0;let o=e.getComputedStyle(t);if(o.overflowX!==`auto`&&o.overflowX!==`scroll`)return 0;let s=t.getBoundingClientRect(),c=t.offsetWidth,l=c>0&&Math.abs(s.width-c)>1?s.width/c:1,u=o.direction===`rtl`,d=s.left+t.clientLeft*l,f=d+of(o.scrollPaddingLeft,i)*l,p=d+(i-of(o.scrollPaddingRight,i))*l,m=n,h=Math.max(r,n+1);h-m>p-f&&(u?m=h-1:h=m+1);let g=0;if(m<f?g=m-f:h>p&&(g=h-p),g===0)return 0;let _=t.scrollLeft,v=_+g/l,y=g>0?Math.ceil(v):Math.floor(v),b=u?Math.min(0,Math.max(-a,y)):Math.max(0,Math.min(a,y)),x=_*l;return Math.abs(b)<Math.abs(_)&&m+x>=f&&h+x<=p&&(b=0),b===_?0:(t.scrollLeft=b,(t.scrollLeft-_)*l)}function cf(e){Mm(),K()._updateTags.add(e)}function lf(e){Mm(),K()._deferred.push(e)}function uf(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function df(e){let t=af(e);return t?t.defaultView:null}function ff(e){let t=e._window;return t===null&&M(78),t}function pf(e){return I(e)&&e.isInline()||L(e)&&e.isInline()}function mf(e){let t=e.getLatest();for(;t!==null;){if(f_(t)!==null&&I(t))return t;let e=t.getParentOrThrow();if(U(e))return e;t=e}return t}function hf(e){return I(e)&&e.isShadowRoot()}function U(e){return ru(e)||hf(e)}function gf(e,t=!1){let n=e.constructor.clone(e,rd);return xd(n,null),n.afterCloneFrom(e),t||n.resetOnCopyNodeFrom(e),n}function _f(e){let t=K(),n=e.getType(),r=od(t,n);r===void 0&&M(200,e.constructor.name,n);let{replace:i,replaceWithKlass:a}=r;if(i!==null){let t=i(e),r=t.constructor;return a===null?t instanceof e.constructor&&r!==e.constructor||M(202,r.name,r.getType(),e.constructor.name,n):t instanceof a||M(201,a.name,a.getType(),r.name,r.getType(),e.constructor.name,n),t.__key===e.__key&&M(203,e.constructor.name,n,r.name,r.getType()),t}return e}function vf(e,t){!ru(e.getParent())||I(t)||L(t)||M(99)}function yf(e){let t=B(e);return t===null&&M(63,e),t}function bf(e){if(!e||e.isInline())return!1;if(L(e))return!0;if(I(e)){if(e.isShadowRoot()){let t=e.getParent();return!(I(t)&&t.isShadowRoot())}return!e.canBeEmpty()}return!1}function xf(e,t,n){n.style.removeProperty(`caret-color`),t._blockCursorElement=null;let r=e.parentElement;r!==null&&r.removeChild(e)}function Sf(e){return va?(e||window).getSelection():null}function Cf(e){let t=df(e);return t?t.getSelection():null}function wf(e){return Vf(e)&&`host`in e}var Tf=[];function Ef(e){let t=e.getRootNode();if(t===e||!wf(t))return Tf;let n=[t],r=t.host;for(;;){let e=r.getRootNode();if(e===r||!wf(e))break;n.push(e),r=e.host}return n}function*Df(e){let t=[e],n;for(;n=t.pop();){yield*n.querySelectorAll(`[data-lexical-editor="true"]`);let e=(_d(n)?n:n.ownerDocument).createTreeWalker(n,NodeFilter.SHOW_ELEMENT),r;for(;r=e.nextNode();)r.shadowRoot&&t.push(r.shadowRoot)}}function Of(e){return e===null?document:e.ownerDocument}function kf(){let e=Rm();return Of(e===null?null:e._rootElement)}function Af(e,t){if(t===null||typeof e.getComposedRanges!=`function`)return null;let n=Ef(t);if(n.length===0)return null;let r=e.getComposedRanges;try{let t=r.call(e,{shadowRoots:n})[0];if(t!==void 0)return t}catch{}try{let t=r.apply(e,n)[0];if(t!==void 0)return t}catch{}return null}function jf(e,t){let n=Af(e,t);if(n!==null){let e=Nf(n);if(e!==null)return e}return e.rangeCount>0?e.getRangeAt(0):null}function Mf(e,t){let n=Af(e,t);return n===null?e:Pf(n,Ff(e))}function Nf(e){let t=e.startContainer.ownerDocument;if(t===null)return null;let n=t.createRange();try{return n.setStart(e.startContainer,e.startOffset),n.setEnd(e.endContainer,e.endOffset),n}catch{return null}}function Pf(e,t){let{startContainer:n,startOffset:r,endContainer:i,endOffset:a}=e;return t===`backward`?{anchorNode:i,anchorOffset:a,direction:t,focusNode:n,focusOffset:r}:{anchorNode:n,anchorOffset:r,direction:t,focusNode:i,focusOffset:a}}function Ff(e){return e.direction}function If(e){let t=e.getRootNode();return _d(t)||wf(t)?t.activeElement:null}function Lf(e){let t=e.activeElement;for(;t!==null&&t.shadowRoot!==null;){let e=t.shadowRoot.activeElement;if(e===null)break;t=e}return t}function Rf(e){let t=e.target;if(t!==null&&W(t)&&t.shadowRoot!==null&&typeof e.composedPath==`function`){let t=e.composedPath();if(t.length>0)return t[0]}return t}function zf(e){return W(e)&&e.tagName===`A`}function W(e){return Bf(e)&&e.nodeType===1}function Bf(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function Vf(e){return Bf(e)&&e.nodeType===11}var Hf=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/i;function Uf(e){return!(!W(e)||!e.style.display.startsWith(`inline`))||Hf.test(e.nodeName)}var Wf=/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/i;function Gf(e){return(!W(e)||!e.style.display.startsWith(`inline`))&&Wf.test(e.nodeName)}function Kf(e){if(L(e)&&!e.isInline())return!0;if(!I(e)||U(e))return!1;let t=e.getFirstChild(),n=t===null||cm(t)||R(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function qf(){return K()}function Jf(e=qf()){return e._config.dom||hm}function Yf(e,t,n=qf()){let r=Jf(n).$getDOMSlot(e,t,n);return I(e)&&(Xf(r)||M(344,e.getKey(),e.getType())),r}function Xf(e){return e instanceof _s}function Zf(e,t,n=qf()){return vd(Yf(e,t,n).element)}var Qf=new WeakMap,$f=new Map;function ep(e){if(!e._readOnly&&e.isEmpty())return $f;e._readOnly||M(192);let t=Qf.get(e);return t||(t=function(e){let t=new Map;for(let[n,r]of e._nodeMap){let e=r.__type,i=t.get(e);i||(i=new Map,t.set(e,i)),i.set(n,r)}return t}(e),Qf.set(e,t)),t}function tp(e){let t=e.constructor.clone(e,rd);return t.afterCloneFrom(e),t}function np(e){return(t=tp(e))[xl]=!0,t;var t}function rp(e,t){let n=e.getAttribute(`data-lexical-indent`);if(n!==null){let e=parseInt(n,10);if(Number.isFinite(e)&&e>=0)return void t.setIndent(e)}let r=parseInt(e.style.paddingInlineStart,10)||0,i=Math.round(r/40);t.setIndent(i)}function ip(e,t){let n=t.getAttribute(`dir`);return n===`ltr`||n===`rtl`?e.setDirection(n):e}function ap(e,t){let n=t.style.textAlign;return n&&n in Va?e.setFormat(n):e}function op(e,t){e.__lexicalUnmanaged=!0,t&&t.captureSelection!==void 0&&(e.__lexicalCapturedSelection=t.captureSelection)}function sp(e){return!0===e.__lexicalUnmanaged}function cp(e,t=qf()){let n=t.isEditable();e.contentEditable=n?`true`:`false`,n?e.__lexicalEditor=t:delete e.__lexicalEditor}function lp(e,t){let n=e;for(;n!=null;){if(!0===n.__lexicalCapturedSelection)return!0;if(W(n)&&n.hasAttribute(`data-lexical-slot`)||kd(n,t)!==void 0)return!1;n=rf(n)}return!1}function up(e,t){return Ks(e,t)&&e[t]!==wl[t]}var dp=new WeakMap;function fp(e){let t=dp.get(e);return t===void 0?function(e){let t=e.prototype!=null&&qa in e.prototype?e.prototype[qa]():void 0,n=function(e){if(!(e===wl||e.prototype instanceof wl)){let t=`<unknown>`,n=`<unknown>`;try{t=e.getType()}catch{}try{ym.version&&(n=JSON.parse(ym.version))}catch{}M(290,e.name,t,n)}return e===eu||e===Ql||e===wl}(e),r=!n&&up(e,`getType`)?e.getType:void 0,i=r&&!(mp in r)?r.call(e):void 0,a,o=i;if(t){if(i)a=t[i];else{for(let[e,n]of Object.entries(t))o=e,a=n;if(!a)for(let e of Object.getOwnPropertySymbols(t)){let n=t[e];if(n){a=n;break}}}}let s={compiled:void 0,composed:void 0,config:{declaresOwnConfig:Ks(e.prototype,qa),klass:e,ownNodeConfig:a,ownNodeType:o},ownFieldsValidated:!1};dp.set(e,s);try{let t=function(e){let t=e.prototype,n=new Map,{fieldsBaseFirst:r}=xp(e);for(let[i,a]of r){let r=Tp(e,i,a);if(r===null)continue;if(js(r)){let t=r.field;if(t===`__proto__`&&M(430,e.name,i),r.setterTable!==void 0){let{setterTable:t}=r,{meta:n}=a;for(let r of n.kind===`enum`?n.values:[a.defaultValue])Ks(t,String(r))||M(431,e.name,i,JSON.stringify(r))}n.set(i,{field:t,key:i,kind:`ownField`,schema:a,setterTable:r.setterTable});continue}let o=t[r];typeof o!=`function`&&M(432,e.name,i,r),n.set(i,{key:i,kind:`field`,schema:a,setter:o})}return n.size===0?hp:[...n.values()]}(e),r=function(e){let t=e.prototype,n=new Map;for(let[r,i]of xp(e).fieldsDerivedFirst){let a=wp(e,r,i);if(a===null)continue;if(js(a)){let o=a.field;o===`__proto__`&&M(426,e.name,r);let s=a.when,c;if(s!==void 0){let n=t[s];typeof n!=`function`&&M(427,e.name,r,s),c=n}n.set(r,{defaultValue:i.defaultValue,derived:i.setter===null,field:o,getterTable:a.getterTable,isEqual:i.isEqual,key:r,kind:`ownField`,schema:i,when:c});continue}let o=t[a];typeof o!=`function`&&M(428,e.name,r,a),n.set(r,{defaultValue:i.defaultValue,derived:i.setter===null,getter:o,isEqual:i.isEqual,key:r,kind:`method`,schema:i})}return n.size===0?Cp:[...n.values()]}(e),i=xp(e),c=function(e,t,n){let r,i=e;for(let{klass:t,ownNodeConfig:n}of zp(e))n&&n.generated!==void 0&&(r===void 0?(r=n.generated,i=t):n.generated===r&&(i=t));return r===void 0?null:i===e||function(e,t){if(e.getters.length!==t.getters.length||e.setters.length!==t.setters.length)return!1;for(let n=0;n<e.getters.length;n++){let r=e.getters[n],i=t.getters[n];if(r.kind!==i.kind||r.key!==i.key||r.schema!==i.schema||r.derived!==i.derived||r.isEqual!==i.isEqual||!Object.is(r.defaultValue,i.defaultValue)||r.kind===`ownField`&&i.kind===`ownField`&&(r.field!==i.field||r.getterTable===void 0!=(i.getterTable===void 0)))return!1}for(let n=0;n<e.setters.length;n++){let r=e.setters[n],i=t.setters[n];if(r.kind!==i.kind||r.key!==i.key||r.schema!==i.schema||r.kind===`ownField`&&i.kind===`ownField`&&(r.field!==i.field||r.setterTable===void 0!=(i.setterTable===void 0)))return!1}return!0}(n,pp(fp(i)))?r:null}(e,0,{getters:r,setters:t});s.compiled={flatStates:i.flatStates,generated:c===null?null:c(i.fields),getters:r,isCompactDefault:Op(r),setters:t},function(e,t,n,r){if(!t&&n){if(!up(e,`getType`)){let t=e,r=function(){return this===t?n:wl.getType.call(this)};r[mp]=!0,e.getType=r}if(up(e,`clone`)||(e.clone=(t,n)=>{nd(t);let r=new e;return n!==rd&&r.afterCloneFrom(t),r}),up(e,`importJSON`)||(e.importJSON=r&&r.$importJSON||function(e){return t=>{let n=Bp(e);return n.updateFromJSON===wl.prototype.updateFromJSON?function(e,t){return Ap(e.__state||t.$!==void 0?gc(e,t):e,t)}(n,t):n.updateFromJSON(t)}}(e)),!up(e,`importDOM`)&&r){let{importDOM:t}=r;t&&(e.importDOM=()=>t)}let t=e.prototype;Ks(t,`getTextContent`)&&!Ks(t,`getTextContentSize`)&&(e.prototype.getTextContentSize=wl.prototype.getTextContentSize)}}(e,n,o,a),function(e){for(let{klass:t,ownNodeConfig:n}of zp(e)){let e=t.prototype;if(Ks(e,`afterCloneFrom`))continue;let r=Rp(t);if(r.length===0)continue;let i=Object.getPrototypeOf(e),a=n&&n.generated!==void 0?pp(fp(t)).generated:null,o=a!==null&&a.afterCloneFrom||((e,t)=>{let n=e,i=t;for(let e=0;e<r.length;e++){let t=r[e];n[t]=i[t]}});e.afterCloneFrom=function(e){i.afterCloneFrom.call(this,e),o(this,e)},e.afterCloneFrom[Ip]=!0}}(e),function(e,t){t&&t.inline!==void 0&&Ks(e.prototype,qa)&&!Object.prototype.hasOwnProperty.call(e.prototype,`isInline`)&&Object.defineProperty(e.prototype,"isInline",{configurable:!0,value:t.inline?Mp:Np,writable:!0})}(e,a)}catch(t){throw dp.delete(e),t}return s}(e):t}function pp(e){let{compiled:t}=e;return t===void 0&&M(422,e.config.klass.name),t}var mp=Symbol(`lexical.synthesizedGetType`),hp=[];function gp(e,t,n,r){let i=n.method===void 0?r:n.method,a=xp(e).declaredBy.get(t);if(a===void 0)return n;let o=e.prototype,s=a.prototype;return _p(o,s,i)&&_p(o,s,r)?n:i}function _p(e,t,n){return e[n]===t[n]}function vp(e){return`set${e.charAt(0).toUpperCase()}${e.slice(1)}`}function yp(e){return`get${e.charAt(0).toUpperCase()}${e.slice(1)}`}var bp={declaredBy:new Map,fields:new Map,fieldsBaseFirst:[],fieldsDerivedFirst:[],flatStates:[]};function xp(e){let t=fp(e);return t.composed===void 0&&(t.composed=function(e){let t=[],n=[],r=[];for(let{klass:i,ownNodeConfig:a}of zp(e)){let e=a&&a.json;n.push(i),t.push(e&&e.meta.kind===`node`?Object.entries(e.meta.fields):[]);let o=[];if(a&&a.stateConfigs)for(let e of a.stateConfigs)`stateConfig`in e&&e.flat&&o.push(e.stateConfig);r.push(o)}let i=new Map;for(let e=0;e<t.length;e++)for(let[n,r]of t[e])i.has(n)||i.set(n,r);let a=new Map,o=new Map,s=new Map;for(let e=t.length-1;e>=0;e--){for(let[r,s]of t[e]){let t=i.get(r);t===void 0||a.has(r)||a.set(r,t),t===void 0||s!==t||o.has(r)||o.set(r,n[e])}for(let t of r[e])s.has(t.key)||s.set(t.key,t)}return i.size===0&&s.size===0?bp:{declaredBy:o,fields:a,fieldsBaseFirst:[...a],fieldsDerivedFirst:[...i],flatStates:[...s.values()]}}(e)),t.composed}function Sp(e){let{fieldsDerivedFirst:t,flatStates:n}=xp(e),r={};for(let e of n)e.schema&&(r[e.key]=e.schema);for(let[e,n]of t)r[e]=n;return r}var Cp=[];function wp(e,t,n){let r=n.getter;if(r===null)return null;let i=r===void 0?yp(t):r;return js(i)?gp(e,t,i,yp(t)):i}function Tp(e,t,n){let r=n.setter;if(r===null)return null;let i=r===void 0?vp(t):r;return js(i)?gp(e,t,i,vp(t)):i}function Ep(e){return e}function Dp(e,t){let{defaultValue:n,isEqual:r}=e;return t===void 0||t===n||r!==void 0&&r(t,n)}function Op(e){let t;return(n,r)=>{t===void 0&&(t=new Map(e.map(e=>[e.key,e])));let i=t.get(n);return i!==void 0&&Dp(i,r)}}function kp(e){let{setterTable:t,schema:n}=e,{defaultValue:r}=n;return t===void 0?r:t[String(r)]}function Ap(e,t){let{flatStates:n,generated:r,setters:i}=pp(fp(e.constructor)),a=function(e,t,n){let r=e;for(let e=0;e<n.length;e++){let i=n[e],a=t[i.key];if(a!==void 0){let e=i.parse(a);r=uc(r,i,()=>e)}}return r}(e,t,n);return r!==null&&r.updateFromJSON!==void 0?r.updateFromJSON(a,t):function(e,t,n){for(let r=0;r<n.length;r++){let i=n[r],a=i.schema(t[i.key]);i.kind===`ownField`?Ep(e)[i.field]=i.setterTable===void 0?a:Ks(i.setterTable,a)?i.setterTable[a]:kp(i):i.setter.call(e,a)}return e}(a,t,i)}function jp(e){return fp(e).config}function Mp(){return!0}function Np(){return!1}function Pp(e){return e===Mp||e===Np}function Fp(e){let t=[];for(let n of[e.getter,e.setter])js(n)&&n.field!==`__proto__`&&!t.includes(n.field)&&t.push(n.field);return t}var Ip=`__lexicalSynthesizedAfterCloneFrom`;function Lp(e){let{declaredBy:t,fieldsBaseFirst:n}=xp(e),r=[];for(let[i,a]of n)if(t.get(i)===e)for(let e of Fp(a))r.includes(e)||r.push(e);return r}function Rp(e){let t=Lp(e);if(t.length===0)return t;let n=new Set;for(let{klass:t}of zp(e))if(t!==e)for(let e of Lp(t))n.add(e);return n.size===0?t:t.filter(e=>!n.has(e))}function*zp(e){for(let t=e;t&&(t===wl||Tl(t.prototype));){let e=jp(t),n=e.declaresOwnConfig;yield n?e:{...e,ownNodeConfig:void 0},t=n&&e.ownNodeConfig&&e.ownNodeConfig.extends||Hp(t)}}function Bp(e){let t=qf();Mm();let n=t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e)),r=new n.klass;return n.replace===null?r:_f(r)}var G=(e,t)=>{let n=e;for(;n!=null&&!ru(n);){if(t(n))return n;n=n.getParent()}return null};function Vp(e,t){let n=[],r=e.__first;for(;r!==null;){let e=t===null?B(r):t.get(r);e??M(174),n.push(r),r=e.__next}return n}function Hp(e){let t=Object.getPrototypeOf(e);if(typeof t==`function`&&t!==Function.prototype)return t;let n=e.prototype&&Object.getPrototypeOf(e.prototype);return n?n.constructor:null}function Up(e){return new qp(is(e._nodeMap),null,e._slotsUsed)}function Wp(){return new qp(new Map([[`root`,new nu]]),null,!1)}function Gp(e){let t=e.constructor,n=ls(e);if(I(e)){let t=n.children,r=e.getChildren();for(let e=0;e<r.length;e++)t.push(Gp(r[e]))}let r=v_(e);if(r.length>0){let i={};for(let n of r){let r=y_(e,n);r===null&&M(366,t.name,n),i[n]=Gp(r)}n.$slots=i}return n}function Kp(e){return e instanceof qp}var qp=class e{_nodeMap;_movedNodes;_selection;_flushSync;_readOnly;_parsed;_slotsUsed;constructor(e,t=null,n=!1){this._nodeMap=e,this._movedNodes=null,this._selection=t||null,this._flushSync=!1,this._readOnly=!1,this._parsed=!1,this._slotsUsed=n}isEmpty(){return this._nodeMap.size<=1&&this._selection===null}read(e,t){return Wm(t&&t.editor||null,this,e)}clone(t){let n=new e(this._nodeMap,t===void 0?this._selection:t,this._slotsUsed);return n._readOnly=!0,n._parsed=this._parsed,n}toJSON(e){return ss(typeof e==`boolean`&&e,()=>Wm(null,this,()=>({root:Gp(V())})))}},Jp=`historic`,Yp=`history-push`,Xp=`history-merge`,Zp=`paste`,Qp=`collaboration`,$p=`skip-collab`,em=`skip-scroll-into-view`,tm=`skip-dom-selection`,nm=`skip-selection-focus`,rm=`composition-end`,im=class extends Ql{$config(){return this.config(`artificial`,{extends:Ql})}createDOM(e){return kf().createElement(`div`)}},am=class extends wl{$config(){return this.config(`linebreak`,{extends:wl,generated:Rl,importDOM:{br:e=>lm(e)||um(e)?null:{conversion:om,priority:0}}})}getTextContent(){return`
|
|
4
|
-
`}createDOM(){return kf().createElement(`br`)}updateDOM(){return!1}isInline(){return!0}};function om(e){return{node:sm()}}function sm(){return _f(new am)}function cm(e){return e instanceof am}function lm(e){let t=e.parentElement;if(t!==null&&Gf(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&dm(n)){let n=t.lastChild;if(n===e||n.previousSibling===e&&dm(n))return!0}}return!1}function um(e){let t=e.parentElement;if(t!==null&&Gf(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&dm(n))return!1;let r=t.lastChild;if(r===e||r.previousSibling===e&&dm(r))return!0}return!1}function dm(e){return gd(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||``)}function fm(e){console.warn(e)}function pm(e,t,n,r,i){let a=e._keyToDOMMap;a.clear(),e._editorState=Wp(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,i&&i.preserveUpdateQueue||(e._updateTags=new Set,e._updates=[],e._cascadeCount=0),e._blockCursorElement=null,e._inputState.handledSelectionCommandTimeoutId!==null&&clearTimeout(e._inputState.handledSelectionCommandTimeoutId),t!==null&&vh(e,t),e._inputState={collapsedSelectionFormat:{format:0,key:`root`,offset:0,style:``,timeStamp:0},composedSegmentedKey:null,compositionPhase:`idle`,hadOrphanedCompositionEvents:!1,handledSelectionCommandTimeoutId:null,isInsertLineBreak:!1,isInsertTextAfterHandledSelectionCommand:!1,isSelectionChangeFromDOMUpdate:!1,isSelectionChangeFromMouseDown:!1,isShiftKeyDown:!1,lastBeforeInputInsertTextTimeStamp:0,lastKeyCode:null,lastKeyDownTimeStamp:0,lastPointerType:``,mouseDrag:null,postDeleteSelectionToRestore:null,savedInputMode:void 0,selectionChangeFromDOMUpdatePoints:null,unprocessedBeforeInputData:null};let o=e._observer;o!==null&&(o.disconnect(),e._observer=null),t!==null&&(t.textContent=``,function(e,t){delete e[`__lexicalKey_${t._key}`]}(t,e)),n!==null&&(n.textContent=``,a.set(`root`,n),Od(n,e,`root`))}function mm(e){let t=new Set,n=new Set;for(let{klass:r,ownNodeConfig:i}of zp(e)){let e=r.transform;if(!n.has(e)){n.add(e);let i=r.transform();i&&t.add(i)}if(i){let e=i.$transform;e&&t.add(e)}}return t}var hm={$createDOM:(e,t)=>e.createDOM(t._config,t),$decorateDOM:(e,t,n,r)=>{},$exportDOM:(e,t)=>{let n=od(t,e.getType());return n&&n.exportDOM!==void 0?n.exportDOM(t,e):e.exportDOM(t)},$extractWithChild:(e,t,n,r,i)=>I(e)&&e.extractWithChild(t,n,r),$getDOMSlot:(e,t,n)=>e.getDOMSlot(t),$getSlotTargetElement:(e,t,n,r)=>null,$shouldExclude:(e,t,n)=>I(e)&&e.excludeFromCopy(`html`),$shouldInclude:(e,t,n)=>!t||e.isSelected(t),$updateDOM:(e,t,n,r)=>e.updateDOM(t,n,r._config)};function gm(e){let t=e||{},n=Rm(),r=t.theme||{},i=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,o=Wp(),s=t.namespace||(i===null?Vd():i._config.namespace),c=t.editorState,l=[nu,hu,am,Qu,Ju,im,...t.nodes||[]],{onError:u,onWarn:d,html:f}=t,p=t.editable===void 0||t.editable,m;if(e===void 0&&n!==null)m=n._nodes;else{m=new Map;for(let e=0;e<l.length;e++){let n=l[e],r=null,i=null;if(n&&typeof n==`object`){let e=n;n=e.replace,r=e.with,i=e.withKlass||null}if(typeof n!=`function`||!n.prototype||!(n===wl||n.prototype instanceof wl)){let r=`<unknown>`;try{r=JSON.parse(ts)}catch{}M(365,String(e-l.length+(t.nodes?t.nodes.length:0)),typeof n==`function`?`${n.name}${typeof n.getType==`function`?` (type ${String(n.getType())})`:``}`:String(n),String(r))}jp(n);let a=n.getType(),o=mm(n);m.set(a,{exportDOM:f&&f.export?f.export.get(n):void 0,klass:n,replace:r,replaceWithKlass:i,sharedNodeState:fc(l[e]),transforms:o})}}let h=new ym(o,i,m,{disableEvents:a,dom:{...hm,...e&&e.dom},namespace:s,theme:r},u||console.error,d||fm,function(e,t){let n=new Map,r=new Set,i=e=>{Object.keys(e).forEach(t=>{let r=n.get(t);r===void 0&&(r=[],n.set(t,r)),r.push(e[t])})};return e.forEach(e=>{let t=e.klass.importDOM;if(t==null||r.has(t))return;r.add(t);let n=t.call(e.klass);n!==null&&i(n)}),t&&i(t),n}(m,f?f.import:void 0),p,e);return c!==void 0&&(h._pendingEditorState=c,h._dirtyType=2),function(e){e.registerCommand(Qa,Oh,0),e.registerCommand($a,Ah,0),e.registerCommand(eo,Mh,0),e.registerCommand(to,Nh,0),e.registerCommand(ho,Wh,0)}(h),h}function _m(e,t){let n=e.get(t);e.delete(t),n&&n()}function vm(e,t,n){return e.set(t,n),_m.bind(null,e,t)}var ym=class{static version=ts;_headless;_recordNodeMoves;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_cascadeCount;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_onWarn;_htmlConversions;_window;_editable;_blockCursorElement;_slotsUsed;_keyDownShortcuts;_inputState;_lastNotifiedSelection;_createEditorArgs;constructor(e,t,n,r,i,a,o,s,c){this._createEditorArgs=c,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new as,this._updates=[],this._updating=!1,this._cascadeCount=0,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Map,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Vd(),this._onError=i,this._onWarn=a,this._htmlConversions=o,this._editable=s,this._headless=t!==null&&t._headless,this._recordNodeMoves=!1,this._window=null,this._blockCursorElement=null,this._slotsUsed=!1,this._keyDownShortcuts=null,this._inputState={collapsedSelectionFormat:{format:0,key:`root`,offset:0,style:``,timeStamp:0},composedSegmentedKey:null,compositionPhase:`idle`,hadOrphanedCompositionEvents:!1,handledSelectionCommandTimeoutId:null,isInsertLineBreak:!1,isInsertTextAfterHandledSelectionCommand:!1,isSelectionChangeFromDOMUpdate:!1,isSelectionChangeFromMouseDown:!1,isShiftKeyDown:!1,lastBeforeInputInsertTextTimeStamp:0,lastKeyCode:null,lastKeyDownTimeStamp:0,lastPointerType:``,mouseDrag:null,postDeleteSelectionToRestore:null,savedInputMode:void 0,selectionChangeFromDOMUpdatePoints:null,unprocessedBeforeInputData:null},this._lastNotifiedSelection=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){return vm(this._listeners.update,e)}registerEditableListener(e){return vm(this._listeners.editable,e)}registerDecoratorListener(e){return vm(this._listeners.decorator,e)}registerTextContentListener(e){return vm(this._listeners.textcontent,e)}registerRootListener(e){let t=this._listeners.root;return eh(vm(t,e,e(this._rootElement,null)||void 0),()=>function(e,t,n){let r=e.get(t);r&&r(),e.set(t,t(...n)||void 0)}(t,e,[null,this._rootElement]))}registerCommand(e,t,n){n===void 0&&M(35);let r=this._commands;r.has(e)||r.set(e,[new ns,new ns,new ns,new ns,new ns]);let i=r.get(e);i===void 0&&M(36,String(e));let a=function(e){return 7&e}(n),o=i[a];return a===n?o.addBack(t):o.addFront(t),()=>{o.delete(t),i.every(e=>e.size===0)&&r.delete(e)}}registerMutationListener(e,t,n){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation,a=i.get(t);a===void 0&&(a=new Set,i.set(t,a)),a.add(r);let o=n&&n.skipInitialization;return o!==void 0&&o||this.initializeMutationListener(t,r),()=>{a.delete(r),a.size===0&&i.delete(t)}}getRegisteredNode(e){let t=this._nodes.get(e.getType());return t===void 0&&M(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){let n=this._editorState,r=ep(n).get(t.getType());if(!r)return;let i=new Map;for(let e of r.keys())i.set(e,`created`);i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set([`registerMutationListener`])})}registerNodeTransformToKlass(e,t){let n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){let n=this.registerNodeTransformToKlass(e,t),r=[n],i=n.replaceWithKlass;if(i!=null){let e=this.registerNodeTransformToKlass(i,t);r.push(e)}return Nd(this,r.map(e=>e.klass.getType())),()=>{r.forEach(e=>e.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,...t){return H(this,e,...t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let t=this._rootElement;if(e!==t){let n=Xd(this._config.theme,`root`),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,pm(this,t,e,r,{preserveUpdateQueue:!0}),t!==null&&(this._config.disableEvents||function(e){let t=ih.get(e);if(t===void 0)return void Zh();let n=ah.get(t);if(n===void 0)return void Zh();ih.delete(e);let r=pd(e);dd(r)?(function(e){if(e._parentEditor!==null){let t=zd(e),n=t[t.length-1]._key;qh.get(n)===e&&qh.delete(n)}else qh.delete(e._key)}(r),n.editors.delete(r),n.hasShadowEditor=void 0,e.__lexicalEditor=null):r&&M(198);let i=Gh(e);for(let e=0;e<i.length;e++)i[e]();e.__lexicalEventHandles=[]}(t),n!=null&&t.classList.remove(...n)),e!==null){let t=df(e),r=e.style;r.userSelect=`text`,r.whiteSpace=`pre-wrap`,r.wordBreak=`break-word`,e.setAttribute(`data-lexical-editor`,`true`),this._window=t,this._dirtyType=2,Os(this),this._updateTags.add(Xp),Gm(this),this._config.disableEvents||function(e,t){let n=e.ownerDocument;ih.set(e,n);let r=ah.get(n);r===void 0&&(r={editors:new Set,hasShadowEditor:void 0},ah.set(n,r)),r.editors.add(t),r.hasShadowEditor=void 0,e.__lexicalEditor=t;let i=Gh(e);i.push(oh.register(n));let a={blur:Wo,click:ph,compositionend:Ih,compositionstart:jh,copy:Io,cut:Lo,dragend:Fo,dragover:Po,dragstart:No,drop:jo,focus:Uo,input:kh,keydown:Lh,paste:oo,pointerdown:yh,...Ea&&{beforeinput:Dh},...Oa&&{keyup:Rh,mousedown:gh}};for(let[n,r]of Object.entries(a))i.push(th(e,n,i=>{Xh(i)||(Yh(i),n===`blur`&&(vh(t,e),t._inputState.isShiftKeyDown=!1,t._inputState.isInsertLineBreak=!1),(t.isEditable()||n===`click`||n===`copy`)&&(typeof r==`function`?r(i,t):H(t,r,i)))}));let o,s=()=>{t._inputState.mouseDrag=null},c=n=>{let i=t._inputState,a=i.mouseDrag;if(o&&o.defaultPrevented&&!n.buttons&&(i.isSelectionChangeFromMouseDown=!1),!a||n.pointerType!==`mouse`)return;let c=n.type===`pointerup`;if(n.type===`pointercancel`||!c&&n.buttons!==1)return s();i.mouseDrag=c?null:n,$m(t,()=>{let o=Sf(ff(t));if(a.type!==`mousedown`){let r=c&&o&&q(J())&&Ig(Rg(),o,t,new Event(`selectionchange`));return r&&Fd(r),xh(t,n,c&&o?Mf(o,e).focusNode:null)}let l=Pg(o,t);if(a.defaultPrevented||!a.shiftKey&&l&&!l.isCollapsed())s();else if(o&&i.isSelectionChangeFromMouseDown){Kh(t,o,new Event(`selectionchange`),r),xh(t,a,Mf(o,e).focusNode);let n=J();q(n)&&n.isCollapsed()&&!n.is(Rg())&&fh(t,n)}})};i.push(nh(n,{pointercancel:c,pointermove:c,pointerup:c},!0),th(ff(t),`blur`,s),t.registerEditableListener(s),nh(e,{contextmenu:s,dragstart:s,keydown:e=>e.getModifierState&&e.getModifierState(e.key)||s(),mousedown:e=>{let n=t._inputState;n.mouseDrag=e.button!==0||e.detail!==1||e.defaultPrevented||n.lastPointerType!==`mouse`||!t.isEditable()||t.isComposing()||lp(Rf(e),t)?null:e}}),th(e,`pointerdown`,e=>{o=e,t._inputState.lastPointerType=e.pointerType},!0)),Oa&&i.push(function(e,t){let n=null,r={capture:!0,passive:!0};return eh(th(e,`touchstart`,e=>{let t=e.touches.length===1?e.touches[0]:null;n=t?{x:t.clientX,y:t.clientY}:null},r),th(e,`touchend`,e=>{let r=e.changedTouches[0];n!==null&&r&&e.touches.length===0&&Math.abs(r.clientX-n.x)<=mh&&Math.abs(r.clientY-n.y)<=mh&&t(e),n=null},r))}(e,n=>function(e,t,n){t._inputState.savedInputMode!==void 0&&(_h(e,t,n)||(Lf(n.ownerDocument)===n&&n.blur(),vh(t,n)))}(n,t,e)))}(e,this),n!=null&&e.classList.add(...n)}else this._window=null,this._updateTags.add(Xp),Gm(this);Km(`root`,this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){let n=e.isEmpty(),r=e;r._readOnly&&(r=Up(e),r._selection=e._selection?e._selection.clone():null),Ds(this);let i=this._pendingEditorState,a=t===void 0?null:t.tag;i===null||i.isEmpty()||(a!=null&&this._updateTags.add(a),Gm(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set(`root`,!1),this._compositionKey=null,this._slotsUsed=this._slotsUsed||e._slotsUsed,$m(this,()=>{if(a&&this._updateTags.add(a),n&&(ga(38),V().append(z())),e._parsed)for(let[e,t]of r._nodeMap.entries())I(t)?this._dirtyElements.set(e,!0):this._dirtyLeaves.add(e)},{discrete:!this._updating||void 0})}parseEditorState(e,t){return function(e,t,n){let r=Wp(),i=xm,a=Cm,o=Sm,s=t._dirtyElements,c=t._dirtyLeaves,l=t._cloneNotNeeded,u=t._dirtyType;t._dirtyElements=new Map,t._dirtyLeaves=new Set,t._cloneNotNeeded=new Map,t._dirtyType=0,xm=r,Cm=!1,Sm=t,nd(null);try{let i=t._nodes;Um(e.root,i),n&&n(),r._readOnly=!0,r._parsed=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=s,t._dirtyLeaves=c,t._cloneNotNeeded=l,t._dirtyType=u,xm=i,Cm=a,Sm=o}return r}(typeof e==`string`?JSON.parse(e):e,this,t)}read(...e){let[t,n]=e.length===1?[`force-commit`,e[0]]:e;return t===`force-commit`&&(Om.has(this)||Gm(this)),(t===`pending`?this._pendingEditorState||this._editorState:this.getEditorState()).read(n,{editor:this})}update(e,t){(function(e,t,n){e._updating?e._updates.push([t,n]):Qm(e,t,n)})(this,e,t)}focus(e,t={}){let n=this._rootElement;n!==null&&(n.setAttribute(`autocapitalize`,`off`),$m(this,()=>{let r=J(),i=V();r===null?i.getChildrenSize()!==0&&(t.defaultSelection===`rootStart`?i.selectStart():i.selectEnd()):r.dirty||Fd(r.clone()),cf(`focus`),lf(()=>{n.removeAttribute(`autocapitalize`),e&&e()})}),this._pendingEditorState===null&&n.removeAttribute(`autocapitalize`))}blur(){let e=this._rootElement;e!==null&&e.blur();let t=Sf(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Km(`editable`,this,!0,e),this._slotsUsed&&this.update(()=>Im()))}toJSON(){return{editorState:this._editorState.toJSON(cs())}}};function bm(e,t,n,r,i,a){if(I(e)){let o=e.__first;for(;o!==null;){let e=r.get(o);if(e===void 0)break;let s=I(e);e.__parent!==t||s&&a.has(o)||((s||u_(e)&&e.__slots!==null)&&bm(e,o,n,r,i,a),n.has(o)||a.delete(o),i.push(o)),o=e.__next}}for(let o of u_(e)&&e.__slots!==null?e.__slots.values():[]){let e=r.get(o);e!==void 0&&d_(e)&&e.__slotHost===t&&((I(e)||u_(e)&&e.__slots!==null)&&bm(e,o,n,r,i,a),n.has(o)||a.delete(o),i.push(o))}}var xm=null,Sm=null,Cm=!1,wm=!1,Tm=!1,Em=new Set,Dm=new Set,Om=new Set,km=0,Am={characterData:!0,childList:!0,subtree:!0};function jm(){return Cm||xm!==null&&xm._readOnly}function Mm(){Cm&&M(13)}function Nm(){km>99&&M(14)}function Pm(){return xm===null&&M(195,Lm()),xm}function Fm(e){Pm()!==null&&Sm===null&&(Sm=e),Sm!==e&&ga(378)}function K(){return Sm===null&&M(337,Lm()),Sm}function Im(){K()._dirtyType=2}function Lm(){let e=0,t=new Set,n=ym.version;if(typeof window<`u`)for(let r of Df(document)){let i=pd(r);if(dd(i))e++;else if(i){let e=String(i.constructor.version||`<0.17.1`);e===n&&(e+=` (separately built, likely a bundler configuration issue)`),t.add(e)}}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 Rm(){return Sm}function zm(e,t,n){let r=t.__type,i=ad(e,r),a=n.get(r);a===void 0&&(a=Array.from(i.transforms),n.set(r,a));let o=a.length;for(let e=0;e<o&&(a[e](t),t.isAttached());e++);}function Bm(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function Vm(e,t){if(!t)return;let n=e._updateTags,r=t;Array.isArray(t)||(r=[t]);for(let e of r)n.add(e)}function Hm(e){return Um(e,K()._nodes)}function Um(e,t){let n=e.type,r=t.get(n);r===void 0&&M(17,n);let i=r.klass;e.type!==i.getType()&&M(18,i.name);let a=i.importJSON(e),o=e.children;if(I(a)&&Array.isArray(o))for(let e=0;e<o.length;e++){let n=Um(o[e],t);a.append(n)}let s=e.$slots;if(s){u_(a)||M(379,i.name);for(let e in s)O_(a,e,Um(s[e],t))}return a}function Wm(e,t,n){let r=xm,i=Cm,a=Sm;xm=t,Cm=!0,Sm=e;try{return n()}finally{xm=r,Cm=i,Sm=a}}function Gm(e,t){e._pendingEditorState!==null&&Sm!==e&&Ds(e,!1,!0);let n=Tm;Tm=!0;try{let n=function(e){if(Dm.has(e))return!1;Dm.add(e);try{for(let t=0;e._pendingEditorState!==null;t++){let n=e._pendingEditorState._selection,r=e._rootElement;if(!qm(e,n))return!1;let i=(n===null||q(n))&&(e._headless||r===null||!r.isConnected);if(i||t===100)return e._lastNotifiedSelection=n===null?null:n.clone(),!i;Qm(e,()=>e.dispatchCommand(Ya),void 0,!0)}return!1}finally{Dm.delete(e)}}(e);(function(e,t){let n=e._pendingEditorState,r=e._rootElement,i=e._headless||r===null;if(n===null)return void(!e._updating&&e._deferred.length>0&&Ym(e,e._deferred));let a=e._editorState,o=a._selection,s=n._selection,c=e._dirtyType!==0,l=xm,u=Cm,d=Sm,f=e._updating,p=e._observer,m=null;if(e._pendingEditorState=null,e._editorState=n,!i&&c&&p!==null){Sm=e,xm=n,Cm=!1,e._updating=!0;try{let t=e._dirtyType,r=e._dirtyElements,i=e._dirtyLeaves;p.disconnect(),m=_l(a,n,e,t,r,i)}catch(t){if(t instanceof Error&&e._onError(t),wm)throw t;pm(e,null,r,n),Os(e),e._dirtyType=2,wm=!0,Gm(e,a),wm=!1;return}finally{p.observe(r,Am),e._updating=f,xm=l,Cm=u,Sm=d}}n._readOnly||=!0;let h=e._dirtyLeaves,g=e._dirtyElements,_=e._normalizedNodes,v=e._updateTags;c&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set),e._updateTags=new Set;let y=e._deferred;f||(e._deferred=[]),function(e,t){let n=e._decorators,r=e._pendingDecorators||n,i=t._nodeMap,a;for(a in r)i.has(a)||(r===n&&(r=jd(e)),delete r[a])}(e,n);let b=i?null:Sf(ff(e));if(e._editable&&b!==null&&(c||s===null||s.dirty||!s.is(o))&&r!==null&&!v.has(`skip-dom-selection`)){Sm=e,xm=n;try{if(p!==null&&p.disconnect(),c||s===null||s.dirty){let t=e._blockCursorElement;t!==null&&xf(t,e,r),Gg(o,s,e,b,v,r)}(function(e,t,n){let r=e._blockCursorElement;if(q(n)&&n.isCollapsed()&&n.anchor.type===`element`&&t.contains(If(t))){let i=n.anchor,a=i.getNode(),o=i.offset,s=!1,c=null;if(o===a.getChildrenSize())bf(a.getChildAtIndex(o-1))&&(s=!0);else{let t=a.getChildAtIndex(o);t!==null&&bf(t)&&(s=!0,c=e.getElementByKey(t.__key))}if(s){let n=Yf(a,e.getElementByKey(a.__key),e).element;r===null&&(e._blockCursorElement=r=function(e){let t=e.theme,n=kf().createElement(`div`);n.contentEditable=`false`,n.setAttribute(`data-lexical-cursor`,`true`);let r=t.blockCursor;return r!==void 0&&(typeof r==`string`&&(r=t.blockCursor=fv(r)),r!==void 0&&n.classList.add(...r)),n}(e._config)),t.style.caretColor=`transparent`,c===null?n.appendChild(r):n.insertBefore(r,c);return}}r!==null&&xf(r,e,t)})(e,r,s)}finally{p!==null&&p.observe(r,Am),Sm=d,xm=l}}let x=Om.has(e);Om.add(e);try{m!==null&&function(e,t,n,r,i){let a=Array.from(e._listeners.mutation),o=a.length;for(let e=0;e<o;e++){let[o,s]=a[e];for(let e of s){let a=t.get(e);a!==void 0&&o(a,{dirtyLeaves:r,prevEditorState:i,updateTags:n})}}}(e,m,v,h,a);let r=e._pendingDecorators;r!==null&&(e._decorators=r,e._pendingDecorators=null,Km(`decorator`,e,!0,r)),function(e,t,n){let r=Md(t),i=Md(n);r!==i&&Km(`textcontent`,e,!0,i)}(e,t||a,n),Km(`update`,e,!0,{dirtyElements:g,dirtyLeaves:h,editorState:n,mutatedNodes:m,normalizedNodes:_,prevEditorState:t||a,tags:v})}finally{x||Om.delete(e)}f||Ym(e,y),function(e){let t=e._updates;if(t.length===0)return void(e._cascadeCount=0);if(function(e){Em.has(e)||(Em.add(e),setTimeout(()=>{Em.delete(e),e._cascadeCount=0},0))}(e),e._cascadeCount++>99)return e._updates=[],e._cascadeCount=0,void e._onWarn(ha(437,e._config.namespace));let n=t.shift();if(n){let[t,r]=n;Qm(e,t,r)}}(e)})(e,t),n&&e._onWarn(ha(436))}finally{Tm=n}}function Km(e,t,n,...r){let i=t._updating;t._updating=n;try{let n=t._listeners[e],i=Array.from(n);for(let[e,t]of i){t&&t();let i=e(...r),a=typeof i==`function`?i:void 0;n.has(e)?n.set(e,a):a&&a()}}finally{t._updating=i}}function qm(e,t){let n=e._lastNotifiedSelection;return t===null?n!==null:!t.is(n)}function Jm(e,t,n,r){let i=zd(e),a;if(!Tm)for(let e=0;e<i.length;e++)i[e]._updating||(i[e]._cascadeCount=0);if(t===Ya){if(Sm!==e||Cm){let i=!1;return $m(e,()=>{i=Jm(e,t,n,r)}),i}let i=Pm()._selection;e._lastNotifiedSelection=i===null?null:i.clone()}for(let e=4;e>=0;e--)for(let o=0;o<i.length;o++){let s=i[o];if(o>0&&s._updating){a=s;break}let c=s._commands.get(t);if(c!==void 0){let t=c[e];if(t.size>0){let e=!1;if($m(s,()=>{for(let i of t)if(i(n,r))return void(e=!0)}),e)return e}}}return a&&a.update(()=>{Jm(a,t,n,r)}),!1}function Ym(e,t){if(e._deferred===t&&(e._deferred=[]),t.length!==0){let n=e._updating;e._updating=!0;try{for(let e=0;e<t.length;e++)t[e]()}finally{e._updating=n}}}function Xm(e,t){let n=e._updates,r=t||!1;for(;n.length!==0;){let t=n.shift();if(t){let[n,i]=t,a=e._pendingEditorState,o;i!==void 0&&(o=i.onUpdate,i.skipTransforms&&(r=!0),i.discrete&&(a===null&&M(191),a._flushSync=!0),o&&e._deferred.push(o),Vm(e,i.tag)),a==null?Qm(e,n,i):n()}}return r}function Zm(){let e=Pm();Mm(),e._flushSync=!0}function Qm(e,t,n,r=!1){let i=e._updateTags,a,o=!1,s=!1;n!==void 0&&(a=n.onUpdate,Vm(e,n.tag),o=n.skipTransforms||!1,s=n.discrete||!1),a&&e._deferred.push(a);let c=e._editorState,l=e._pendingEditorState,u=!1;(l===null||l._readOnly)&&(l=e._pendingEditorState=Up(l||c),u=!0),l._flushSync=s;let d=xm,f=Cm,p=Sm,m=e._updating,h=e._lastNotifiedSelection;xm=l,Cm=!1,e._updating=!0,Sm=e;let g=e._headless||e.getRootElement()===null;nd(null);try{u&&(g?c._selection!==null&&(l._selection=c._selection.clone()):l._selection=function(e,t){let n=e.getEditorState()._selection,r=Sf(ff(e));return q(n)||n==null?Ig(n,r,e,t):n.clone()}(e,n&&n.event||null));let r=e._compositionKey;t(),o=Xm(e,o),function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(q(r)){let e=r.anchor,t=r.focus,i;if(e.type===`text`&&(i=e.getNode(),i.selectionTransform(n,r)),t.type===`text`){let e=t.getNode();i!==e&&e.selectionTransform(n,r)}}}(l,e),e._dirtyType!==0&&(o?function(e,t){let n=t._dirtyLeaves,r=e._nodeMap;for(let e of n){let t=r.get(e);R(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&Ol(t)}}(l,e):function(e,t){let n=t._dirtyLeaves,r=t._dirtyElements,i=e._nodeMap,a=Td(),o=new Map,s=n,c=s.size,l=r,u=l.size;for(;c>0||u>0;){if(c>0){t._dirtyLeaves=new Set;for(let e of s){let r=i.get(e);R(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&Ol(r),r!==void 0&&Bm(r,a)&&zm(t,r,o),n.add(e)}if(s=t._dirtyLeaves,c=s.size,c>0){km++;continue}}t._dirtyLeaves=new Set,t._dirtyElements=new Map,l.delete(`root`)&&l.set(`root`,!0);for(let e of l){let n=e[0],s=e[1];if(r.set(n,s),!s)continue;let c=i.get(n);c!==void 0&&Bm(c,a)&&zm(t,c,o)}s=t._dirtyLeaves,c=s.size,l=t._dirtyElements,u=l.size,km++}t._dirtyLeaves=n,t._dirtyElements=r}(l,e),Xm(e),function(e,t,n,r){let i=e._nodeMap,a=t._nodeMap,o=[];for(let[e]of r){let t=a.get(e);t!==void 0&&(t.isAttached()||(I(t)&&bm(t,e,i,a,o,r),i.has(e)||r.delete(e),o.push(e)))}for(let e of n){let t=a.get(e);t===void 0||t.isAttached()||(u_(t)&&t.__slots!==null&&bm(t,e,i,a,o,n),i.has(e)||n.delete(e),o.push(e))}let s=K(),c=s._cloneNotNeeded;for(let e of o)a.delete(e),c.delete(e);let l=s._compositionKey;l===null||a.has(l)||(s._compositionKey=null)}(c,l,e._dirtyLeaves,e._dirtyElements)),r!==e._compositionKey&&(l._flushSync=!0);let i=l._selection;if(q(i)){e._slotsUsed&&Dg(i);let t=l._nodeMap,n=i.anchor.key,r=i.focus.key;t.get(n)!==void 0&&t.get(r)!==void 0||M(19)}else cg(i)&&i._nodes.size===0&&(l._selection=null)}catch(t){t instanceof Error&&e._onError(t),e._pendingEditorState=c;let n=c._selection;e._lastNotifiedSelection=n===null?null:n.clone(),e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),Gm(e);return}finally{xm=d,Cm=f,Sm=p,e._updating=m,km=0}r||(e._dirtyType!==0||e._deferred.length>0||function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(r!==null){if(r.dirty||!r.is(n))return!0}else if(n!==null)return!0;return!1}(l,e)?l._flushSync?(l._flushSync=!1,Gm(e)):u&&sd(()=>{Gm(e)}):(l._flushSync=!1,u&&(i.clear(),e._deferred=[],e._pendingEditorState=null,e._lastNotifiedSelection=h)))}function $m(e,t,n){Sm===e&&n===void 0?jm()?Qm(e,t,n):t():Qm(e,t,n)}function eh(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function th(e,t,n,r){return e.addEventListener(t,n,r),e.removeEventListener.bind(e,t,n,r)}function nh(e,t,n){return eh(...Object.entries(t).map(([t,r])=>th(e,t,r,n)))}var rh=30,ih=new WeakMap,ah=new WeakMap,oh=$o(e=>(e.addEventListener(`selectionchange`,Jh),()=>e.removeEventListener(`selectionchange`,Jh)));function sh(e,t,n,r,i,a){let o=e.anchor,s=e.focus,c=o.getNode(),l=K(),u;if(a!==void 0)u=a;else{let e=Sf(ff(l));u=e===null?null:Mf(e,l._rootElement)}let d=u===null?null:u.anchorNode,f=o.key,p=l.getElementByKey(f),m=n.length;return f!==s.key||!R(c)||(!i&&(!Ea||l._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||c.isDirty()&&m<2||Rd(n))&&o.offset!==s.offset&&!c.isComposing()||hd(c)||c.isDirty()&&m>1||(i||!Ea)&&p!==null&&!c.isComposing()&&d!==Zf(c,p,l)||u!==null&&t!==null&&(!t.collapsed||t.startContainer!==u.anchorNode||t.startOffset!==u.anchorOffset)||!c.isComposing()&&(c.getFormat()!==e.format||c.getStyle()!==e.style)||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;let n=e.anchor.offset,r=t.getParentOrThrow(),i=md(t);return n===0?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){let t=e.getPreviousSibling();return(R(t)||I(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,c)}function ch(e,t){return gd(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function lh(e,t,n){let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=Mf(e,t._rootElement),s=t._inputState;if(s.isSelectionChangeFromDOMUpdate){s.isSelectionChangeFromDOMUpdate=!1;let e=s.selectionChangeFromDOMUpdatePoints;if(s.selectionChangeFromDOMUpdatePoints=null,ch(r,i)&&ch(a,o)&&!s.postDeleteSelectionToRestore&&(e===null||e.anchorNode===r&&e.anchorOffset===i&&e.focusNode===a&&e.focusOffset===o))return}$m(t,()=>{if(!n)return void Fd(null);if(!ud(t,r,a))return;let c=s.mouseDrag;!c||c.type===`mousedown`&&c.defaultPrevented||xh(t,c,a);let l=bh.has(c),u=J();if(s.postDeleteSelectionToRestore&&q(u)&&u.isCollapsed()){let e=u.anchor,t=s.postDeleteSelectionToRestore.anchor;(e.key===t.key&&e.offset===t.offset+1||e.offset===1&&t.getNode().is(e.getNode().getPreviousSibling()))&&(u=s.postDeleteSelectionToRestore.clone(),Fd(u))}if(s.postDeleteSelectionToRestore=null,q(u)){let n=u.anchor;if(u.isCollapsed())e.type===`Range`&&r===a&&(u.dirty=!0),fh(t,u);else{let e=n.key,t=u.focus,r=t.key,a=u.getNodes(),s=a.length,c=u.isBackward(),[d,f]=l?[n.offset,t.offset]:[i,o],p=c?f:d,m=c?d:f,h=c?r:e,g=c?e:r,_=Fa,v=!1;for(let e=0;e<s;e++){let t=a[e],n=t.getTextContentSize();if(R(t)&&n!==0&&!(e===0&&t.__key===h&&p===n||e===s-1&&t.__key===g&&m===0)&&(v=!0,_&=t.getFormat(),_===0))break}u.format=v?_:0}}(function(e,t,n=!1){(n||qm(e,t))&&e.dispatchCommand(Ya)})(t,u,u!==null&&(u.dirty&&!l||!q(u)))})}function uh(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function dh(e,t){uh(e,t.getFormat(),t.getStyle())}function fh(e,t){let n=t.anchor,r=n.getNode(),i=ff(e).event,a=i?i.timeStamp:performance.now(),{format:o,style:s,offset:c,key:l,timeStamp:u}=e._inputState.collapsedSelectionFormat;a<u+200&&n.offset===c&&n.key===l?uh(t,o,s):n.type===`text`?(R(r)||M(141),dh(t,r)):(e.isComposing()||V().getTextContent()!==``)&&(I(r)||M(259),r.isEmpty()?Lg(t,``):uh(t,t.format,``))}function ph(e,t){$m(t,()=>{let n=J(),r=Sf(ff(t)),i=Rg();if(r){if(q(n)){let e=n.anchor,t=e.getNode();e.type===`element`&&e.offset===0&&n.isCollapsed()&&!ru(t)&&V().getChildrenSize()===1&&t.getTopLevelElementOrThrow().isEmpty()&&i!==null&&n.is(i)&&(r.removeAllRanges(),n.dirty=!0)}else if(e.pointerType===`touch`||e.pointerType===`pen`||Oa&&t._inputState.lastPointerType!==`mouse`){let n=Mf(r,t._rootElement).anchorNode;(W(n)||gd(n))&&Fd(Ig(i,r,t,e))}}if(wa&&r!==null&&r.rangeCount===0){let n=t._rootElement;if(n!==null&&e.target===n){let a=e.clientY,o=n.childNodes.length;for(let e=0;e<n.childNodes.length;e++){let t=n.childNodes[e];if(W(t)){let n=t.getBoundingClientRect();if(a<=(n.top+n.bottom)/2){o=e;break}}}r.setBaseAndExtent(n,o,n,o);let s=Ig(i,r,t,e);s===null?r.removeAllRanges():Fd(s)}}H(t,Za,e)})}var mh=10,hh=`input:not(:disabled),textarea:not(:disabled),select:not(:disabled),button:not(:disabled),a[href],area[href],label,summary,iframe,object,embed,audio[controls],video[controls],[tabindex],[contenteditable]:not([contenteditable="false"])`;function gh(e,t){let n=t.getRootElement();n!==null&&(_h(e,t,n)?(e.preventDefault(),Lf(n.ownerDocument)!==n&&(t._inputState.savedInputMode===void 0&&(t._inputState.savedInputMode=n.getAttribute(`inputmode`)),n.setAttribute(`inputmode`,`none`),n.focus({preventScroll:!0}))):vh(t,n))}function _h(e,t,n){if(t._inputState.lastPointerType===`mouse`)return!1;let r=Rf(e);if(!Bf(r))return!1;let i=!1;for(let e=r;e!==null;e=rf(e)){if(e===n)return i;if(e.nodeType===1){let t=e;if(t.matches(hh))return!1;t.getAttribute(`data-lexical-decorator`)===`true`&&(i=!0)}}return!1}function vh(e,t){let n=e._inputState.savedInputMode;n!==void 0&&(e._inputState.savedInputMode=void 0,n===null?t.removeAttribute(`inputmode`):t.setAttribute(`inputmode`,n))}function yh(e,t){let n=Rf(e),r=e.pointerType;Bf(n)&&r!==`touch`&&r!==`pen`&&e.button===0&&$m(t,()=>{lp(n,t)||(t._inputState.isSelectionChangeFromMouseDown=!0)})}var bh=new WeakSet;function xh(e,t,n=null){let r=J(),i=r&&r.clone();(function(e,t,n){let r=Rg(),i=t.type===`mousedown`,a=i&&!t.shiftKey,o=n&&Ad(n);L(o)&&(i?a&&o.isInline()&&o.selectPrevious():q(r)&&Fd(r.clone()));let s=J(),c=s||(a?Mg():q(r)?r.clone():null),l=e.getRootElement(),u=l&&l.getRootNode();if(!q(c)||a&&!c.isCollapsed()||!_d(u)&&!wf(u))return;let{anchor:d,focus:f}=c;if(!i&&q(r)){let{key:e,offset:t,type:n}=r.anchor;d.set(e,t,n,!0)}let{clientX:p,clientY:m}=t,h=u.elementFromPoint&&u.elementFromPoint(p,m),g=h&&Ad(h),_=(e,t)=>I(e)?t===`next`?e.getLastDescendant():e.getFirstDescendant():e,v=[null],y=I(g)&&!g.isInline()&&(ru(g)?G(f.getNode(),Ag):g);for(let e of y?q_(y,`next`):[])v.push(Y(e.origin,`previous`),e);let b=ff(e),x=b.document.createRange(),S=null;for(let t of v){let n=t?_(t.origin,t.direction):g;if(!L(n)||!n.isInline()||n===S)continue;let r=e.getElementByKey(n.getKey());if(!r)continue;x.selectNodeContents(r);let i=x.getBoundingClientRect(),o=r.getBoundingClientRect(),{bottom:l,left:u,right:h,top:v}=i.height>o.height?i:o;if(t&&(m<v||m>l)){S=n;continue}let y=b.getComputedStyle(rf(r)||r).direction===`rtl`,C=2*p>u+h!==y,w=C?`next`:`previous`,T=t&&t.getNodeAtCaret(),E=T&&e.getElementByKey(T.getKey()),D=E?E.getClientRects():[],ee=D[C?0:D.length-1];if(!t||t.direction===w&&b.getComputedStyle(r).cssFloat===`none`&&(!T||cm(T)||ee&&(C===y?2*ee.right>u+h:2*ee.left<u+h))){if(!n.is(_(ef(f,C),w))){let e=Y(n,w);Du(f,e),a&&Du(d,e)}s||Fd(c);return}}if(L(o)&&!i){let t=b.document,n=t.caretPositionFromPoint&&t.caretPositionFromPoint(p,m,{shadowRoots:wf(u)?[u]:[]}),r=n&&Sg(n.offsetNode,n.offset,null,e);if(r){let[{key:e,offset:t,type:n}]=r;f.set(e,t,n)}}})(e,t,n);let a=J(),o=e._inputState.mouseDrag;o&&a&&!a.is(i)&&bh.add(o),t.type===`mousedown`&&q(a)&&Lg(a,q(i)?i.anchor.key:``)}function Sh(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function Ch(e){let{lastKeyCode:t}=K()._inputState;if(e==null||e.length<=1||t==null)return;let n=t.length===1?t:t===`Enter`?`
|
|
5
|
-
`:t===`Tab`?` `:null;if(!n)return;let r=J();if(!q(r)||!r.isCollapsed())return;let i=r.anchor.getNode();if(!R(i))return;let{offset:a}=r.anchor;if(i.getTextContentSize()===a){let e=i.getNextSibling();if(n===`
|
|
6
|
-
`){if(Oa)return;if(cm(e))e.selectEnd();else if(!e){let e=G(i,Ag),t=e&&e.getNextSibling();I(t)&&t.selectStart()}}else n===` `?ed(e)&&e.selectEnd():R(e)&&e.getTextContent()[0]===n&&e.select(1,1)}else i.getTextContent()[a]===n&&i.select(a+1,a+1)}function wh(e){e.isInsertTextAfterHandledSelectionCommand=!1,e.handledSelectionCommandTimeoutId!==null&&(clearTimeout(e.handledSelectionCommandTimeoutId),e.handledSelectionCommandTimeoutId=null)}function Th(e){Ca&&!Oa&&ja&&(wh(e),e.isInsertTextAfterHandledSelectionCommand=!0,e.handledSelectionCommandTimeoutId=setTimeout(()=>wh(e),0))}function Eh(e,t){let n=Rf(e);if(W(n)&&lp(n,t))return!0;let r=t.getRootElement();if(r===null)return!1;let i=Lf(r.ownerDocument);return i!==null&&r.contains(i)&&(lp(i,t)||cd(r,i))}function Dh(e,t){let n=e.inputType;n===`deleteCompositionText`||wa&&tf(t)||n!==`insertCompositionText`&&$m(t,()=>{Eh(e,t)||H(t,Qa,e)},{event:e})}function Oh(e){let t=e.inputType,n=Sh(e),r=K(),i=r._inputState,a=J();if(t===`insertText`&&e.data&&i.isInsertTextAfterHandledSelectionCommand){if(wh(i),e.preventDefault(),q(a)&&!a.isCollapsed()){let e=a.isBackward()?a.anchor:a.focus;a.anchor.set(e.key,e.offset,e.type),a.focus.set(e.key,e.offset,e.type)}return!0}if(t===`deleteContentBackward`){if(a===null){let e=Rg();if(!q(e))return!0;Fd(e.clone())}if(q(a)){let t=a.anchor.key===a.focus.key;if(function(e,t){return e.lastKeyCode===`MediaLast`&&t<e.lastKeyDownTimeStamp+rh}(i,e.timeStamp)&&r.isComposing()&&t){if(wd(null),i.lastKeyDownTimeStamp=0,setTimeout(()=>{$m(r,()=>{wd(null)})},rh),q(a)){let e=a.anchor.getNode();e.markDirty(),R(e)||M(142),dh(a,e)}}else{if(wd(null),Oa&&n!==null&&!n.collapsed&&(a.applyDOMRange(n),!a.isCollapsed()))return e.preventDefault(),a.removeText(),!0;e.preventDefault();let o=a.anchor.getNode(),s=o.getTextContent(),c=o.canInsertTextAfter(),l=a.anchor.offset===0&&a.focus.offset===s.length,u=Ma&&t&&!l&&c;if(u&&a.isCollapsed()&&(u=!L(ef(a.anchor,!0))),!u){H(r,no,!0);let e=J();Ma&&q(e)&&e.isCollapsed()&&(i.postDeleteSelectionToRestore=e,setTimeout(()=>i.postDeleteSelectionToRestore=null))}}return!0}}if(!q(a))return t!==`historyUndo`&&t!==`historyRedo`||(e.preventDefault(),H(r,t===`historyUndo`?po:mo)),!0;let o=e.data;i.unprocessedBeforeInputData!==null&&Ud(!1,r,i.unprocessedBeforeInputData);let s=!1;if((!a.dirty||i.unprocessedBeforeInputData!==null)&&a.isCollapsed()&&!ru(a.anchor.getNode())&&n!==null){let{key:e,offset:i,type:o}=a.anchor,c=r._slotsUsed&&wg(a.anchor);a.applyDOMRange(n);let l=t.endsWith(`Forward`);if(!1!==c&&(l||t.endsWith(`Backward`))){let n=$h(e,i,o),{anchor:r,focus:u}=a,d=!Eg(wg(r),c)||!Eg(wg(u),c),f=!d&&c!==null&&(l?r.isBefore(n)||u.isBefore(n):n.isBefore(r)||n.isBefore(u));(d||f)&&(r.set(e,i,o),u.set(e,i,o),s=f&&t===`deleteContentForward`)}}i.unprocessedBeforeInputData=null;let c=a.anchor,l=a.focus,u=c.getNode(),d=l.getNode();if(t===`insertText`||t===`insertTranspose`){if(o===`
|
|
7
|
-
`)e.preventDefault(),H(r,ro,!1);else if(o===La)e.preventDefault(),H(r,io);else if(o==null&&e.dataTransfer){let t=e.dataTransfer.getData(`text/plain`);e.preventDefault(),a.insertRawText(t)}else o!=null&&sh(a,n,o,e.timeStamp,!0)?(e.preventDefault(),H(r,ao,o),Ch(o)):i.unprocessedBeforeInputData=o;return i.lastBeforeInputInsertTextTimeStamp=e.timeStamp,!0}switch(e.preventDefault(),t){case`insertFromYank`:case`insertFromDrop`:case`insertReplacementText`:H(r,ao,e),Ch((e.dataTransfer?e.dataTransfer.getData(`text/plain`):null)??e.data);break;case`insertFromComposition`:{i.compositionPhase=`idle`;let t=i.hadOrphanedCompositionEvents;i.hadOrphanedCompositionEvents=!1;let n=r._compositionKey;wd(null),t||H(r,ao,e),Ph(n);break}case`insertLineBreak`:wd(null),i.isInsertLineBreak=!1,H(r,ro,!1);break;case`insertParagraph`:wd(null),i.isInsertLineBreak?(i.isInsertLineBreak=!1,H(r,ro,!1)):H(r,io);break;case`insertFromPaste`:case`insertFromPasteAsQuotation`:H(r,oo,e);break;case`deleteByComposition`:(function(e,t){return e!==t||I(e)||I(t)||!md(e)||!md(t)})(u,d)&&H(r,so,e);break;case`deleteByDrag`:cf(nm),H(r,so,e);break;case`deleteByCut`:H(r,so,e);break;case`deleteContent`:H(r,no,!1);break;case`deleteWordBackward`:H(r,co,!0);break;case`deleteWordForward`:H(r,co,!1);break;case`deleteHardLineBackward`:case`deleteSoftLineBackward`:H(r,lo,!0);break;case`deleteContentForward`:case`deleteHardLineForward`:case`deleteSoftLineForward`:H(r,s?no:lo,!1);break;case`formatStrikeThrough`:H(r,uo,`strikethrough`);break;case`formatBold`:H(r,uo,`bold`);break;case`formatItalic`:H(r,uo,`italic`);break;case`formatUnderline`:H(r,uo,`underline`);break;case`historyUndo`:H(r,po);break;case`historyRedo`:H(r,mo)}return!0}function kh(e,t){e.stopPropagation();let n=t._inputState;wh(n),$m(t,()=>{Eh(e,t)||t.dispatchCommand($a,e)},{event:e}),n.unprocessedBeforeInputData=null}function Ah(e){let t=K(),n=t._inputState,r=J(),i=e.data,a=Sh(e),o=!1,s=!1;if(i!=null&&q(r)){let c=Sf(ff(t)),l=c===null?null:Mf(c,t._rootElement),u=e.inputType===`insertCompositionText`&&n.compositionPhase!==`ending-firefox`&&!t.isComposing();u&&(n.hadOrphanedCompositionEvents=!0);let d=r.anchor.getNode(),f=e.inputType===`insertCompositionText`&&n.compositionPhase!==`ending-firefox`&&t.isComposing()&&R(d)&&hd(d);if(!u&&!f&&sh(r,a,i,e.timeStamp,!1,l)){if(o=!0,n.compositionPhase===`ending-firefox`){let e=Fh(t,i);if(n.compositionPhase=`idle`,e)return cf(rm),Id(),!0}let a=r.anchor.getNode();if(c===null||l===null)return!0;let u=r.isBackward(),d=u?r.anchor.offset:r.focus.offset,f=u?r.focus.offset:r.anchor.offset;Ea&&!r.isCollapsed()&&R(a)&&l.anchorNode!==null&&a.getTextContent().slice(0,d)+i+a.getTextContent().slice(d+f)===Hd(l.anchorNode)||(H(t,ao,i),s=e.inputType===`insertText`);let p=i.length;wa&&p>1&&e.inputType===`insertCompositionText`&&!t.isComposing()&&(r.anchor.offset-=p,r._cachedNodes=null,r._cachedIsBackward=null),Ma&&t.isComposing()&&(n.lastKeyDownTimeStamp=0,wd(null))}}return o||(Ud(!1,t,i===null?void 0:i),n.compositionPhase===`ending-firefox`&&(Fh(t,i||void 0),cf(`composition-end`),n.compositionPhase=`idle`)),Id(s),!0}function jh(e,t){H(t,eo,e)}function Mh(e){let t=K(),n=t._inputState,r=J();if(q(r)&&!t.isComposing()){n.compositionPhase=`composing`,n.hadOrphanedCompositionEvents=!1;let i=r.anchor,a=r.anchor.getNode();if(wd(i.key),cf(`composition-start`),e.timeStamp<n.lastKeyDownTimeStamp+rh||i.type===`element`||!r.isCollapsed()||!Ma&&(a.getFormat()!==r.format||R(a)&&a.getStyle()!==r.style)||R(a)&&(hd(a)||i.offset===0&&!a.canInsertTextBefore()||i.offset===a.getTextContentSize()&&!a.canInsertTextAfter())){Oa||!Aa&&!Na?H(t,ao,Ra):function(e){rg(e,``,!0)}(r);let e=J();q(e)&&wd(e.anchor.key)}}return!0}function Nh(e){let t=K();return t._inputState.compositionPhase=`idle`,Fh(t,e.data),cf(rm),!0}function Ph(e){let t=K()._inputState,n=t.composedSegmentedKey;if(t.composedSegmentedKey=null,e===null||e!==n)return;let r=B(e);if(!R(r)||r.getType()===`text`||hd(r)||!r.isAttached())return;let i=J(),a=q(i)&&i.anchor.key===e?i.anchor.offset:null,o=wu(r.getTextContent());if(o.setFormat(r.getFormat()),o.setStyle(r.getStyle()),r.replace(o),a!==null){let e=Math.min(a,o.getTextContentSize());o.select(e,e)}}function Fh(e,t){let n=e._compositionKey;if(wd(null),n!==null&&t!=null){if(t===``){let t=B(n),r=e.getElementByKey(n),i=r!==null&&R(t)?Zf(t,r,e):null;if(i!==null&&i.nodeValue!==null&&R(t)){let n=Sf(ff(e)),r=n&&Mf(n,e._rootElement),a=null,o=null;r!==null&&r.anchorNode===i&&(a=r.anchorOffset,o=r.focusOffset),Wd(t,i.nodeValue,a,o,!0)}return Ph(n),!1}if(t[t.length-1]===`
|
|
8
|
-
`){let t=J();if(q(t)||cg(t)){if(q(t)){let e=t.focus;t.anchor.set(e.key,e.offset,e.type)}return H(e,So,null),Ph(n),!1}}let r=B(n);if(r!==null&&R(r)&&hd(r)){r.markDirty();let e=J(),i=r.getTextContentSize(),a=q(e)&&e.anchor.key===n?e.anchor.offset:i;return r.select(a,a).insertText(t),!0}}return Ud(!0,e,t),Ph(n),!1}function Ih(e,t){let n=t._inputState;wa?n.compositionPhase=`ending-firefox`:(e.data===``||Oa||!Aa&&!Na)&&H(t,to,e)}function Lh(e,t){let n=t._inputState;Oa&&(n.isShiftKeyDown=e.key===`Shift`||n.isShiftKeyDown&&e.shiftKey&&e.key!==`CapsLock`),n.lastKeyDownTimeStamp=e.timeStamp,n.lastKeyCode=e.key,e.key!==`Backspace`&&wh(n),t.isComposing()||!Oa&&(Aa||Na)&&e.keyCode===229||H(t,ho,e)}function Rh(e,t){e.shiftKey&&e.key!==`CapsLock`||(t._inputState.isShiftKeyDown=!1)}var zh={altKey:`any`,ctrlKey:`any`,metaKey:`any`,shiftKey:`any`},Bh={ctrlKey:!0},Vh={metaKey:!0},Hh={shiftKey:`any`},Uh={altKey:`any`,shiftKey:`any`};function Wh(e){let t=K();if(e.key==null)return!0;let n=t._keyDownShortcuts;n===null&&(n=Qo(function(){let e=(e,t,n)=>({key:e,modifiers:t,onMatch:(e,t)=>{H(t,n,e)}}),t=(e,t,n,r)=>({key:e,modifiers:t,onMatch:(e,t)=>{e.preventDefault(),H(t,n,r)}}),n=(e,t)=>({key:`Enter`,modifiers:e,onMatch:(e,n)=>{let r=n._inputState;r.isInsertLineBreak=t&&(!Oa||r.isShiftKeyDown),H(n,So,e),e.defaultPrevented&&(r.isInsertLineBreak=!1)}}),r=(e,t)=>({key:e,modifiers:qo,onMatch:(e,n)=>{let r=n._editorState._selection;r===null||q(r)||ld(e)||(e.preventDefault(),H(n,t,e))}});return[e(`ArrowRight`,Hh,go),e(`ArrowLeft`,Hh,vo),e(`ArrowUp`,Uh,bo),e(`ArrowDown`,Uh,xo),n({...zh,shiftKey:!0},!0),n({...zh,shiftKey:!1},!1),e(` `,zh,Co),{key:`Backspace`,modifiers:Hh,onMatch:(e,t)=>{H(t,wo,e)&&Th(t._inputState)}},e(`Escape`,zh,To),e(`Delete`,{},Eo),t(`Backspace`,Jo,co,!0),t(`Delete`,Jo,co,!1),t(`b`,qo,uo,`bold`),t(`u`,qo,uo,`underline`),t(`i`,qo,uo,`italic`),e(`Tab`,Hh,Do),t(`z`,qo,po,void 0),t(`z`,{...qo,shiftKey:!0},mo,void 0),...Ca?[{key:`o`,modifiers:Bh,onMatch:(e,t)=>{e.preventDefault(),H(t,ro,!0)}},e(`ArrowLeft`,{metaKey:!0,...Hh},yo),e(`ArrowRight`,{metaKey:!0,...Hh},_o),t(`h`,Bh,no,!0),t(`d`,Bh,no,!1),t(`Backspace`,Vh,lo,!0),t(`Delete`,Vh,lo,!1),t(`k`,Bh,lo,!1)]:[e(`Home`,Hh,yo),e(`End`,Hh,_o),t(`y`,Bh,mo,void 0)],{key:`a`,modifiers:qo,onMatch:(e,t)=>{e.preventDefault(),H(t,Ro,e)&&Th(t._inputState)}},r(`c`,Io),r(`x`,Lo)]}()),t._keyDownShortcuts=n);let r=n.match(e);return r&&r.onMatch(e,t),function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e)&&t.dispatchCommand(Go,e),!0}function Gh(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}function Kh(e,t,n,r){if(r!==void 0)for(let e of r.editors)e._inputState.isSelectionChangeFromMouseDown=!1;let i=Mf(t,e._rootElement).anchorNode;(W(i)||gd(i))&&Fd(Ig(Rg(),t,e,n))}var qh=new Map;function Jh(e){let t=e.target;if(W(t)&&(t.nodeName===`INPUT`||t.nodeName===`TEXTAREA`))return;let n=Cf(t);if(n===null)return;let r=af(t),i=null,a=r===null?void 0:ah.get(r);if(r!==null){if(a!==void 0){let e=a.editors,t=a.hasShadowEditor;if(t===void 0){t=!1;for(let n of e)if(n._rootElement!==null&&wf(n._rootElement.getRootNode())){t=!0;break}a.hasShadowEditor=t}if(t){let t=null;for(let r of e){let e=r._rootElement;if(e===null)continue;let a=Mf(n,e).anchorNode;if(a!==null&&fd(a)===r){if(wf(e.getRootNode())){i=r;break}t===null&&(t=r)}}i===null&&t!==null&&(i=t)}else{let e=n.anchorNode;e===null||W(e)&&e.shadowRoot!==null||(i=fd(e))}}if(i===null){let e=Lf(r);i=e===null?null:fd(e)}}if(i===null)return;i._inputState.isSelectionChangeFromMouseDown&&$m(i,()=>Kh(i,n,e,a));let o=zd(i),s=o[o.length-1],c=s._key,l=qh.get(c),u=l||s;u!==i&&lh(n,u,!1),lh(n,i,!0),i===s?l&&qh.delete(c):qh.set(c,i)}function Yh(e){e._lexicalHandled=!0}function Xh(e){return!0===e._lexicalHandled}var Zh=Ja(),Qh=class{key;offset;type;_selection;constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:iv(Iu(Eu(this,`next`)),Iu(Eu(e,`next`)))<0}getNode(){let e=B(this.key);return e===null&&M(20),e}set(e,t,n,r){let i=this._selection,a=this.key;r&&this.key===e&&this.offset===t&&this.type===n||(this.key=e,this.offset=t,this.type=n,jm()||(Td()===a&&wd(e),i!==null&&(i.setCachedNodes(null),q(i)&&(i._cachedIsBackward=null),i.dirty=!0)))}};function $h(e,t,n){return new Qh(e,t,n)}function eg(e,t){let n=t.__key,r=e.offset,i=`element`;if(R(t)){i=`text`;let e=t.getTextContentSize();r>e&&(r=e)}else if(!I(t)){let e=t.getNextSibling();if(R(e))n=e.__key,r=0,i=`text`;else{let e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function tg(e,t){if(I(t)){let n=t.getLastDescendant();I(n)||R(n)?eg(e,n):eg(e,t)}else eg(e,t)}function ng(e,t,n,r){let i=e.getNode(),a=i.getChildAtIndex(e.offset),o=wu();if(o.setFormat(n),o.setStyle(r),Xu(a))a.splice(0,0,[o]);else if(a!==null){let e=U(i)?z().append(o):o;a.insertBefore(e)}else if(U(i)){let e=i.getLastChild();I(e)&&!e.isInline()&&e.isEmpty()?e.append(o):i.append(z().append(o))}else i.append(o);e.is(t)&&t.set(o.__key,0,`text`),e.set(o.__key,0,`text`)}function rg(e,t,n){let r=e.format,i=e.style;if(!e.isCollapsed()){let a=(e.focus.isBefore(e.anchor)?e.focus:e.anchor).getNode();if(R(a)&&(r=a.getFormat(),i=a.getStyle()),e.removeText(),e.format=r,e.style=i,t===``&&!n)return;if(Td()===null)return e.anchor.type===`element`&&ng(e.anchor,e.focus,r,i),void ig(e,t,r,i)}e.anchor.type===`element`&&ng(e.anchor,e.focus,r,i);let a=e.anchor.getNode();R(a)||M(398);let o=e.anchor.offset,s=a.getParentOrThrow(),c=a.getTextContentSize();if(hd(a)||o===0&&(!a.canInsertTextBefore()||!s.canInsertTextBefore()&&!a.__prev)||o===c&&(!a.canInsertTextAfter()||!s.canInsertTextAfter()&&!a.__next)){if(a.isSegmented()&&o!==0&&o!==c){if(Td()!==null)a.setMode(`normal`).setFormat(r).setStyle(i),K()._inputState.composedSegmentedKey=a.getKey();else{let t=wu(a.getTextContent());t.setFormat(r),t.setStyle(i);let n=J()===e;a.replace(t),e.setTextNodeRange(t,o,t,o),n&&J()!==e&&Fd(e)}(t!==``||n)&&rg(e,t,n);return}if(t===``&&!n)return;if(o===0||o===c){let c=o===0,l=c?`previous`:`next`,u=Y(a,l).getNodeAtCaret(),d;R(u)&&(c?u.canInsertTextAfter():u.canInsertTextBefore())&&!hd(u)?d=u:(d=wu().setFormat(r).setStyle(i),Y((c?s.canInsertTextBefore():s.canInsertTextAfter())?a:s,l).insert(d));let f=c?void 0:0;d.select(f,f),rg(e,t,n);return}let l=wu(t);l.setFormat(r),l.setStyle(i),a.replace(l),l.select();return}if(t===``&&!n)return;let l=s.isInline()&&o===0&&!a.__prev,u=s.isInline()&&o===c&&!a.__next,d=a.getFormat()!==r||a.getStyle()!==i;if(l||u||d){if(a.getTextContent()!==``||l||u)return void ig(e,t,r,i);a.setFormat(r),a.setStyle(i)}a.spliceText(o,0,t,!0),a.isComposing()&&e.anchor.type===`text`&&e.anchor.set(e.anchor.key,e.anchor.offset-t.length,e.anchor.type)}function ig(e,t,n,r){let i=e.anchor.getNode();R(i)||M(398);let a=e.anchor.offset,o=wu(t).setFormat(n).setStyle(r),s=i.getParentOrThrow(),c=a===0,l=c||a===i.getTextContentSize();if(l&&s.isInline()&&!(c?i.__prev:i.__next))Y(s,c?`previous`:`next`).insert(o);else{let e=l?i:i.splitText(a)[0];c?e.insertBefore(o,!1):e.insertAfter(o,!1)}i.getTextContent()===``&&i.isAttached()&&i.remove(),o.selectEnd(),o.isComposing()&&e.anchor.type===`text`&&e.anchor.set(e.anchor.key,e.anchor.offset-t.length,e.anchor.type)}var ag=class e{_nodes;_cachedNodes;dirty;constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!cg(e))return!1;let t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every(e=>n.has(e))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new e(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let t=this.getNodes().filter(e=>f_(e)===null),n=t.length;if(n===0)return;let r=t[n-1],i;if(R(r))i=r.select();else{let e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e<n;e++)t[e].remove()}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=this._nodes,n=[];for(let e of t){let t=B(e);t!==null&&n.push(t)}return jm()||(this._cachedNodes=n),n}getTextContent(){let e=this.getNodes(),t=``;for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}deleteNodes(){let e=this.getNodes().filter(e=>f_(e)===null);if((J()||Rg())===this&&e[0]){let t=Y(e[0],`next`);Ou(nv(t,t))}for(let t of e)t.remove();og()}};function og(){let e=V();if(e.getChildrenSize()===0&&g_(J())===null){let t=z();e.append(t),t.select()}}function q(e){return e instanceof sg}var sg=class e{format;style;anchor;focus;_cachedNodes;_cachedIsBackward;dirty;constructor(e,t,n,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this._cachedIsBackward=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!q(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=function(e){let t=[],[n,r]=e.getTextSlices();n&&t.push(n.caret.origin);let i=new Set,a=0;for(let n of e)if(B_(n)){let{origin:e}=n;t.length===0?i.add(e):(a++,t.push(e))}else{let{origin:e}=n;I(e)&&a!==0?a--:t.push(e)}if(r&&t.push(r.caret.origin),z_(e.focus)&&I(e.focus.origin)&&e.focus.getNodeAtCaret()===null)for(let n=q_(e.focus.origin,`previous`);B_(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(t[t.length-1]);n=Y_(n))i.delete(n.origin),t.pop();for(;t.length>1;){let e=t[t.length-1];if(!I(e)||a>0||e.isEmpty()||i.has(e))break;t.pop()}if(t.length===0&&e.isCollapsed()){let n=Iu(e.anchor),r=Iu(e.anchor.getFlipped()),i=e=>R_(e)?e.origin:e.getNodeAtCaret(),a=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(a)}return t}(Ru(Au(this),`next`));return jm()||(this._cachedNodes=t),t}setTextNodeRange(e,t,n,r){return this.anchor.set(e.__key,t,`text`),this.focus.set(n.__key,r,`text`),this}getTextContent(){if(this.isCollapsed())return``;let e=this.getNodes(),t=Au(this).getTextSlices(),n=``,r=!0;for(let i=0;i<e.length;i++){let a=e[i];if(I(a)&&!a.isInline()){r||(n+=`
|
|
9
|
-
`);let e=``;for(let t of v_(a)){let n=y_(a,t);n!==null&&(e+=n.getTextContent())}e===``?r=!a.isEmpty():(n+=e,r=!1)}else if(r=!1,R(a)){let e=Hu(t,a);n+=e?e.getTextContent():a.getTextContent()}else(L(a)||cm(a))&&(n+=a.getTextContent())}return n}applyDOMRange(e){let t=K(),n=t.getEditorState()._selection,r=kg(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(r===null)return;let[i,a,o]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(a.key,a.offset,a.type,!0),o&&(this.dirty=!0),kl(this)}clone(){let t=this.anchor,n=this.focus;return new e($h(t.key,t.offset,t.type),$h(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(e){this.format=yd(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){let t=za[e];return(this.format&t)!==0}insertRawText(e){this.insertNodes(Jg(e))}insertText(e){rg(this,e,!1)}removeText(){let e=J()===this,t=this.anchor.key;ku(this,Pu(Au(this))),this.isCollapsed()&&Lg(this,t),e&&J()!==this&&Fd(this)}formatText(e,t=null){fg(this,e,t)}insertNodes(e){if(e.length===0)return;this.isCollapsed()||this.removeText();let t=this.anchor.getNode();if(this.anchor.type===`element`&&I(t)&&t.isShadowRoot()&&f_(t)!==null){let n=t.getFirstChild()??t.append(z()).getFirstChild();if(n!==null&&!I(n)){let e=z();n.insertBefore(e),n=e}if(n!==null){n.selectStart();let t=J();return q(t)||M(369),t.insertNodes(e)}}if(this.anchor.type===`element`&&U(t)){let n=$g(e),r=n.getLastDescendant();t.splice(this.anchor.offset,0,n.getChildren()),r!==null&&r.selectEnd();return}let n=this.isBackward()?this.focus:this.anchor,r=n.getNode(),i=G(r,Kf),a=e[e.length-1];if(I(i)&&`__language`in i){if(`__language`in e[0])this.insertText(e[0].getTextContent());else{let[,t]=Xg(this);i.splice(t,0,e),a.selectEnd()}return}if(!e.some(e=>(I(e)||L(e))&&!e.isInline())){I(i)||M(211,r.constructor.name,r.getType());let[t,n]=Xg(this,!0);(I(t)?t:i).splice(n,0,e),a.selectEnd();return}if(i===null){let t=$g(e),n=t.getLastDescendant(),r=Eu(this.anchor,`next`);for(let e of t.getChildren())r=Ku(e,r);n!==null&&n.selectEnd();return}if(I(i)&&(f_(i)!==null||!i.isParentRequired()&&!U(i.getParentOrThrow()))){let[,t]=Xg(this),n=Yg(e);i.splice(t,0,n);let r=n[n.length-1];r===void 0?i.select(t,t):r.selectEnd();return}let o=$g(e),s=o.getLastDescendant(),c=o.getChildren(),l=function(e){let t=function(e){let t=e.getNode();if(e.offset>0)return e.type===`element`&&I(t)?t.getChildAtIndex(e.offset-1):null;for(let e=t;e!==null&&!Kf(e)&&!U(e);e=e.getParent()){let t=e.getPreviousSibling();if(t!==null)return t}return null}(e);return cm(t)&&cm(t.getPreviousSibling())}(n),u=I(i)&&i.isEmpty()?null:this.insertParagraph();u&&!i.isAttached()&&(r=this.anchor.getNode(),i=G(r,Kf));let d=c[c.length-1],f=c[0];var p=f;l||!I(p)||!Kf(p)||p.isEmpty()||!I(i)||i.isEmpty()&&!i.canMergeWhenEmpty()||(I(i)||M(211,r.constructor.name,r.getType()),i.append(...f.getChildren()),f=c[1]),f&&(i===null&&M(212,r.constructor.name,r.getType()),function(e,t){let n=t.getParentOrThrow().getLastChild(),r=t,i=[t];for(;r!==n;)r.getNextSibling()||M(140),r=r.getNextSibling(),i.push(r);let a=e;for(let e of i)a=a.insertAfter(e)}(i,f));let m=G(s,Kf),h=s.selectEnd();u&&(I(m)&&(u.canMergeWhenEmpty()||Kf(d))?(m.append(...u.getChildren()),u.remove()):u.isEmpty()&&u.remove()),I(i)&&i.isEmpty()&&i.remove();let g=I(i)?i.getLastChild():null;cm(g)&&m!==i&&g.remove();let _=Iu(Eu(h.anchor,`next`));Du(h.anchor,_),Du(h.focus,_)}insertParagraph(){this.isCollapsed()||this.removeText();let e=this.anchor.getNode();if(this.anchor.type===`element`&&U(e)){let t=z();return e.splice(this.anchor.offset,0,[t]),t.select(),t}let[,t]=Xg(this),n=G(this.anchor.getNode(),Kf);if(n!==null&&f_(n)!==null)return null;I(n)||M(213);let r=n.getChildAtIndex(t),i=r?[r,...r.getNextSiblings()]:[],a=n.insertNewAfter(this,!1);return a?(a.append(...i),a.selectStart(),a):null}insertLineBreak(e){let t=sm();if(this.insertNodes([t]),e){let e=t.getParentOrThrow(),n=t.getIndexWithinParent();e.select(n,n)}}extract(){let e=this.getNodes();if(this.isCollapsed())return[...e];let t=this.isBackward(),n=Au(this).getTextSlices(),r=[];for(let t of e){let e=Hu(n,t),i=e?Uu(e,this):t;i!==null&&r.push(i)}if(e.length===1&&r.length===1&&R(r[0])){let e=r[0],[n,i]=t?[this.focus,this.anchor]:[this.anchor,this.focus];n.set(e.getKey(),0,`text`),i.set(e.getKey(),e.getTextContentSize(),`text`)}return r}modify(e,t,n){if(e_(this,e,t,n))return;let r=e===`move`,i=K(),a=Sf(ff(i));if(!a)return;let o=i._blockCursorElement,s=i._rootElement,c=this.focus.getNode();s===null||o===null||!I(c)||c.isInline()||c.canBeEmpty()||xf(o,i,s);let l=nf(i,this.focus.key),u=l;if(this.focus.type===`text`&&(u=R(c)?Zf(c,l,i):null),this.dirty){let e=nf(i,this.anchor.key),t=e;if(this.anchor.type===`text`){let n=this.anchor.getNode();t=R(n)?Zf(n,e,i):null}t&&u&&Ug(a,t,this.anchor.offset,u,this.focus.offset)}if(n===`character`&&R(c)&&c.isUnmergeable()&&(t?this.focus.offset===0:this.focus.offset===c.getTextContentSize())){let e=Y(c,t?`previous`:`next`).getNodeAtCaret();if(R(e)){if(!r){let n=e.getTextContentSize();t?this.focus.set(e.__key,n-1,`text`):this.focus.set(e.__key,1,`text`),this.dirty=!0;return}{let n=i.getElementByKey(e.getKey()),r=n?Zf(e,n,i):null;if(r){let e=t?r.length:0;Ug(a,r,e,r,e)}}}}if(hg(a,e,t?`backward`:`forward`,n,s),a.rangeCount>0){let e=Af(a,i._rootElement),n=e||a.getRangeAt(0),o=this.anchor.getNode(),s=ru(o)?o:mf(o);this.applyDOMRange(n),this.dirty=!0,r||(gg(this,t,s),(e?a.direction!==`backward`:a.anchorNode===n.startContainer&&a.anchorOffset===n.startOffset)||mg(this))}n===`lineboundary`&&e_(this,e,t,n,`decorators`)}forwardDeletion(e,t,n){if(!n&&(e.type===`element`&&I(t)&&e.offset===t.getChildrenSize()||e.type===`text`&&e.offset===t.getTextContentSize())){let e=t.getParent(),n=t.getNextSibling()||(e===null?null:e.getNextSibling());if(I(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){let t=this.isCollapsed();if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e)){let e=I(n)?n.getNextSibling():null;if(!(I(n)&&n.isEmpty()&&I(e)&&e.isShadowRoot()))return}let r=Eu(t,e?`previous`:`next`),i=ev(r);if(i.getTextSlices().every(e=>e===null||e.distance===0)){if(t.type===`element`){let e=r.getNodeAtCaret();if(I(e)&&bf(e)){let t=e.getParent();e.remove();let n=Pd(t,e);n!==null&&n.selectStart();return}}let e={type:`initial`};for(let t of i.iterNodeCarets(`shadowRoot`))if(B_(t)){if(!t.origin.isInline()){if(t.origin.isShadowRoot()){if(e.type===`merge-block`)break;if(I(i.anchor.origin)&&i.anchor.origin.isEmpty()){let e=Iu(t);ku(this,nv(e,e)),i.anchor.origin.remove()}return}e.type!==`merge-next-block`&&e.type!==`merge-block`||(e={block:e.block,caret:t,type:`merge-block`})}}else{if(e.type===`merge-block`)break;if(z_(t)){if(I(t.origin)){if(t.origin.isInline()){if(!t.origin.isParentOf(i.anchor.origin))break}else e={block:t.origin,type:`merge-next-block`};continue}if(L(t.origin)){if(!t.origin.isIsolated()){if(e.type===`merge-next-block`&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&I(i.anchor.origin)&&i.anchor.origin.isEmpty()){i.anchor.origin.remove();let e=Ng();e.add(t.origin.getKey()),Fd(e)}else{let e=t.origin,n=e.getParent();e.remove();let r=Pd(n,e);r!==null&&r.selectStart()}}return}if(cm(t.origin))return void t.origin.remove();break}}if(e.type===`merge-block`){let{caret:t,block:n}=e;return v_(n).length>0?void 0:t.origin.isEmpty()&&!n.isEmpty()&&t.origin.getParent()===n.getParent()?void t.origin.remove(!0):(ku(this,nv(!t.origin.isEmpty()&&n.isEmpty()?ju(Y(n,t.direction)):i.anchor,t)),this.removeText())}for(let e=t.getNode();e!==null;){if(f_(e)!==null)return;if(I(e)&&e.isShadowRoot())break;e=e.getParent()}}let a=this.focus;if(_g(this,e,`character`),this.isCollapsed()){if(e&&t.offset===0&&function(e,t){for(let n=t;n;n=n.getParent()){if(I(n)){if(n.collapseAtStart(e))return!0;if(U(n))break}if(n.getPreviousSibling())break}return!1}(this,t.getNode()))return}else{let r=a.type===`text`?a.getNode():null;if(n=t.type===`text`?t.getNode():null,r!==null&&r.isSegmented()){let t=a.offset,i=r.getTextContentSize();if(r.is(n)||e&&t!==i||!e&&t!==0)return void xg(r,e,t)}else if(n!==null&&n.isSegmented()){let i=t.offset,a=n.getTextContentSize();if(n.is(r)||e&&i!==0||!e&&i!==a)return void xg(n,e,i)}(function(e,t){let n=e.anchor,r=e.focus,i=n.getNode();if(i===r.getNode()&&n.type===`text`&&r.type===`text`){let e=n.offset,o=r.offset,s=e<o,c=s?e:o,l=s?o:e,u=l-1;c!==u&&!Rd(a=i.getTextContent().slice(c,l))&&!bg(a)&&(t?r.set(r.key,u,r.type):n.set(n.key,u,n.type))}var a})(this,e)}}t||pg(this),this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type===`element`&&this.anchor.offset===0&&og()}deleteLine(e){lg(this,e,`lineboundary`)}deleteWord(e){lg(this,e,`word`)}isBackward(){let e=this._cachedIsBackward;if(e!==null)return e;let t=this.focus.isBefore(this.anchor);return jm()||(this._cachedIsBackward=t),t}getStartEndPoints(){return[this.anchor,this.focus]}};function cg(e){return e instanceof ag}function lg(e,t,n){let r=e.isCollapsed(),{anchor:i,focus:a}=e,o=!1;if(r){if(n===`word`&&e.forwardDeletion(i,i.getNode(),t))return;o=_g(e,t,n),n===`lineboundary`&&function(e){for(let t of Au(e).iterNodeCarets(`shadowRoot`))if(z_(t)&&cm(t.origin))return void Du(e.focus,ju(t))}(e)}n!==`lineboundary`||e.isCollapsed()||G(i.getNode(),Kf)===G(a.getNode(),Kf)||a.set(i.key,i.offset,i.type),e.isCollapsed()?o||e.deleteCharacter(t):(r||pg(e),e.removeText())}function ug(e,t){if(cg(e)){for(let n of e.getNodes())mu(n)&&n.setFormat(t(n.getFormat()));return}let n=e.isCollapsed()?[]:e.getNodes(),r=n.length?Au(e).getTextSlices():[],i,a,o,s=!1,c=0;for(let l of n)if(R(l)){i&&a&&(i.set(a.__key,0,`text`),i=void 0);let n=Hu(r,l);if(!s&&n&&n.distance===0){let t=e.isBackward()?e.focus:e.anchor;t.type===`text`&&t.key===l.__key&&(i=t)}if(s=!0,n&&n.distance===0)continue;let u=t(l.getFormat()),d=i?l.getTextContentSize():0,f=n&&!hd(l)?Uu(n,e):l;f!==null&&(f.setFormat(u),o===void 0&&(o=u,a=f,i&&f.getTextContentSize()!==d&&(i.set(f.__key,0,`text`),i=void 0)),c=u)}else I(l)?l.setTextFormat(t(l.getTextFormat())):mu(l)&&l.setFormat(t(l.getFormat()));s?o!==void 0&&(e.format=o|c):(e.setFormat(t(e.format)),wd(null))}function dg(e,t){let n=[];for(let[e,r]of Object.entries(t))typeof r==`boolean`&&n.push([e,r]);n.length!==0&&ug(e,e=>{for(let[t,r]of n)e=yd(e,t,r?za[t]:0);return e})}function fg(e,t,n=null){let r=n===null&&q(e)?yd(e.format,t,null):n;ug(e,e=>yd(e,t,r))}function pg(e){let t=V();!t.isEmpty()&&qu(t,e)&&(e.anchor.set(t.getKey(),0,`element`),e.focus.set(t.getKey(),t.getChildrenSize(),`element`))}function mg(e){let t=e.focus,n=e.anchor,r=n.key,i=n.offset,a=n.type;n.set(t.key,t.offset,t.type,!0),t.set(r,i,a,!0)}function hg(e,t,n,r,i){let a=r===`character`?Mf(e,i):null,o=a&&a.focusNode,s=a?a.focusOffset:0;if(e.modify(t,n,r),a===null||!function(e,t,n){return e!==null&&e.nodeType===3&&(n===`backward`?t>0:n===`forward`&&t<e.length)}(o,s,n))return;let c=Mf(e,i);c.focusNode===o&&c.focusOffset===s&&e.modify(t,n,r)}function gg(e,t,n){let r=e.getNodes(),i=r.filter(e=>uf(e,n));if(i.length===0||i.length===r.length)return!1;let a=t?i[0]:i[i.length-1],o=I(a)?a:a.getParentOrThrow();return t?o.selectStart():o.selectEnd(),!0}function _g(e,t,n){if(e_(e,`extend`,t,n))return!1;let r=K(),i=Sf(ff(r));if(!i||typeof i.modify!=`function`)return!1;let a=r._blockCursorElement,o=r._rootElement,s=e.anchor,c=e.focus.getNode();o===null||a===null||!I(c)||c.isInline()||c.canBeEmpty()||xf(a,r,o);let l=e=>{let t=e.getNode(),n=r.getElementByKey(e.key);return n!==null&&e.type===`text`&&R(t)?Zf(t,n,r):n},u=s.getNode(),d=l(s);if(d===null)return!1;let f=s.offset,p=e.isCollapsed(),m=e.focus,h=p?d:l(m);if(h===null)return!1;let g=m.offset;if(Ug(i,h,g,h,g),hg(i,`move`,t?`backward`:`forward`,n,o),i.rangeCount===0)return!1;let _=Af(i,o)||i.getRangeAt(0),v=_.startContainer,y=_.startOffset;if(n===`lineboundary`&&gd(v)&&fd(v)===r){let e=Ld(v);if(L(e)&&e.isInline()&&!e.isIsolated()){let n=r.getElementByKey(e.getKey());n!==null&&n.contains(v)&&(v=n,y=t?0:n.childNodes.length)}}if(p&&n===`character`&&s.type===`text`&&R(u)&&u.isUnmergeable()&&f===(t?0:u.getTextContentSize())){let n=Y(u,t?`previous`:`next`).getNodeAtCaret();if(R(n)){let r=t?n.getTextContentSize()-1:1;return e.focus.set(n.__key,r,`text`),e.dirty=!0,!1}}if(p&&n===`character`&&s.type===`text`){let n=t?0:u.getTextContentSize(),r=v===d?y:f===n?-1:n;if(r>=0)return r!==f&&(e.focus.set(s.key,r,`text`),e.dirty=!0),!1}let b=r._slotsUsed&&Ad(v),x=b?h_(u):null,S=b?h_(b):null;if(b&&!Eg(S,x)&&vg(e.focus,u,x,S,`deletion`,()=>!t))return!0;let[C,w,T,E]=t?[v,y,d,f]:[d,f,v,y],D=ru(u)?u:mf(u);return e.applyDOMRange({collapsed:!1,endContainer:T,endOffset:E,startContainer:C,startOffset:w}),e.dirty=!0,!gg(e,t,D)&&t&&mg(e),!1}function vg(e,t,n,r,i,a){let o=r&&function(e,t){for(let n=p_(e);n!==null;){let e=h_(n);if(Eg(e,t))return e!==null||n.isAttached()?n:null;n=e&&p_(e)}return null}(r,n);if(o===null&&n===null)return!1;let s=a(),c=o&&o.getParent(),l,u;if(o===null||c===null||t!==null&&(o.is(t)||o.isParentOf(t))){let t=o||n;if(!I(t))return t!==null&&function(e,t,n){I(t)?e.set(t.getKey(),n?t.getChildrenSize():0,`element`):e.set(t.getKey(),n?t.getTextContentSize():0,`text`)}(e,t,s),!0;l=t,u=s?t.getChildrenSize():0}else l=c,u=o.getIndexWithinParent()+ +(s===(i===`selection`));return i===`deletion`?function(e,t,n,r){for(;;){let i=t.getChildAtIndex(r?n:n-1);if(R(i))return void e.set(i.getKey(),r?0:i.getTextContentSize(),`text`);if(!I(i)||U(i))break;t=i,n=r?0:i.getChildrenSize()}e.set(t.getKey(),n,`element`)}(e,l,u,!s):e.set(l.getKey(),u,`element`),!0}function yg(){try{let e=RegExp(`\\p{Emoji}`,`u`),t=e.test.bind(e);if(t(`❤️`)&&t(`#️⃣`)&&t(`👍`))return t}catch{}return()=>!1}var bg=yg();function xg(e,t,n){let r=e,i=r.getTextContent().split(/(?=\s)/g),a=i.length,o=0,s=0;for(let e=0;e<a;e++){let r=e===a-1;if(s=o,o+=i[e].length,t&&o===n||o>n||r){i.splice(e,1),r&&(s=void 0);break}}let c=i.join(``).trim();c===``?r.remove():(r.setTextContent(c),r.select(s,s))}function Sg(e,t,n,r){let i,a=t,o=!1;if(W(e)){let s=!1,c=e.childNodes,l=c.length,u=r._blockCursorElement;a===l&&l>0&&(s=!0,a=l-1),kd(e,r)!==void 0||lp(e,r)||(o=!0);let d=c[a],f=!1;if(d===u)d=c[a+1],f=!0;else if(u!==null){let n=u.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,u)&&a--}if(i=Ld(d),R(i))a=G_(i,s?`next`:`previous`);else{let c=Ld(e);if(c===null)return null;if(I(c)){let o=r.getElementByKey(c.getKey());o===null&&M(214);let l=Yf(c,o,r);[c,a]=l.resolveChildIndex(c,o,e,t),I(c)||M(215),s&&a>=c.getChildrenSize()&&(a=Math.max(0,c.getChildrenSize()-1));let u=c.getChildAtIndex(a);if(I(u)&&function(e,t,n){let r=e.getParent();return n===null||r===null||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){let e=s?u.getLastDescendant():u.getFirstDescendant();e===null?c=u:(u=e,c=I(u)?u:u.getParentOrThrow()),a=0}R(u)?(i=u,c=null,a=G_(u,s?`next`:`previous`)):u!==c&&s&&!f&&(I(c)||M(216),a=Math.min(c.getChildrenSize(),a+1))}else{let n=p_(c),i=n===null?c:n,o=i.getIndexWithinParent(),s=r.getElementByKey(c.getKey()),l=`after`;if(s!==null&&Ld(e)===c){let n=Yf(c,s,r);n.element===s?t===0&&L(c)&&(l=`before`):l=n.resolveLeafPosition(s,e,t)}a=l===`before`?o:o+1,c=i.getParentOrThrow()}if(I(c))return[$h(c.__key,a,`element`),o]}}else i=Ld(e);return R(i)?[$h(i.__key,G_(i,a,`clamp`),`text`),o]:null}function Cg(e,t,n){let r=e.getNode();if(Ed(r))return;let i=e.offset===0;if(!i&&e.offset!==r.getTextContent().length)return;let a=i?`previous`:`next`,o=Y(r,a).getNodeAtCaret();if(i===t||!I(o)||!o.isInline()||i&&n){if(i&&!t)R(o)&&!r.isUnmergeable()&&e.set(o.__key,o.getTextContent().length,`text`);else if(o===null&&(n||!i&&t)){let t=r.getParent();if(I(t)&&t.isInline()&&(i||!t.canInsertTextAfter()&&t.getTextContentSize()>1)){let n=Y(t,a).getNodeAtCaret();R(n)&&e.set(n.__key,i?n.getTextContent().length:0,`text`)}}}else e.set(o.__key,i?o.getChildrenSize():0,`element`)}function wg(e){let t=B(e.key);return t===null?null:h_(t)}function Tg(e,t,n){let r=wg(e),i=wg(t);return!Eg(r,i)&&vg(t,B(e.key),r,i,`selection`,n)}function Eg(e,t){return e===null?t===null:e.is(t)}function Dg(e){let t=Tg(e.anchor,e.focus,()=>function(e,t){let n=function(e,t){let n=new Map;for(let t=null,r=e;r!==null;t=r,r=av(r))n.set(r.getKey(),t);for(let e=null,r=t;r!==null;e=r,r=av(r)){let t=n.get(r.getKey());if(t===void 0)continue;let i=r.getLatest();return t===null?e===null?{commonAncestor:i,type:`same`}:{b:e,commonAncestor:i,type:`ancestor`}:e===null?{a:t,commonAncestor:i,type:`descendant`}:{a:t,b:e,commonAncestor:i,type:`branch`}}return null}(e.origin,t.origin);if(n===null)return null;switch(n.type){case`same`:return ov(e,t);case`ancestor`:return e.type===`child`&&f_(n.b)===null?-1:1;case`descendant`:return t.type===`child`&&f_(n.a)===null?1:-1;case`branch`:{let e=f_(n.a)&&n.a.getKey(),t=f_(n.b)&&n.b.getKey();if(e&&t){for(let r of __(n.commonAncestor).values())if(r===e||r===t)return r===e?-1:1}return e?-1:t?1:n.a.isBefore(n.b)?-1:1}}}(Eu(e.anchor,`next`),Eu(e.focus,`next`))!==1);return t&&(e.dirty=!0),t}function Og(e,t){let n=t;for(;n!==null&&n.parentNode!==e;)n=n.parentNode;let r=0;for(let e=n&&n.previousSibling;e;e=e.previousSibling)r++;return r}function kg(e,t,n,r,i,a){if(e===null||n===null||!ud(i,e,n))return null;let o=Sg(e,t,q(a)?a.anchor:null,i);if(o===null)return null;let s=Sg(n,r,q(a)?a.focus:null,i);if(s===null)return null;let[c,l]=o,[u,d]=s;if(c.type===`element`&&u.type===`element`){let t=Ld(e),r=Ld(n);if(L(t)&&L(r))return null}let f=i._slotsUsed&&Tg(c,u,()=>function(e,t,n,r){if(e===n)return r>=t;let i=e.compareDocumentPosition(n);return i&Node.DOCUMENT_POSITION_CONTAINED_BY?Og(e,n)>=t:i&Node.DOCUMENT_POSITION_CONTAINS?r>Og(n,e):(i&Node.DOCUMENT_POSITION_FOLLOWING)!==0}(e,t,n,r));return function(e,t){if(e.type===`text`&&t.type===`text`){let n=e.isBefore(t),r=e.is(t);Cg(e,n,r),Cg(t,!n,r),r&&t.set(e.key,e.offset,e.type)}}(c,u),[c,u,l||d||f]}function Ag(e){return I(e)&&!e.isInline()}function jg(e,t,n,r,i,a){let o=Pm(),s=new sg($h(e,t,i),$h(n,r,a),0,``);return s.dirty=!0,o._selection=s,s}function Mg(){return new sg($h(`root`,0,`element`),$h(`root`,0,`element`),0,``)}function Ng(){return new ag(new Set)}function Pg(e,t){return Ig(null,e,t,null)}var Fg=new Set([` `,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`Backspace`,`Delete`,`End`,`Enter`,`Home`,`Tab`]);function Ig(e,t,n,r){let i=n._window;if(i===null)return null;let a=r||i.event,o=a?a.type:void 0,s=o===`selectionchange`,c=o===`keydown`&&a,l=c&&Rf(c),u=c&&(c.ctrlKey||c.metaKey||Fg.has(c.key))&&Bf(l)&&fd(l)===n,d=!ys&&(s||u||o===`beforeinput`||o===`compositionstart`||o===`compositionend`||o===`click`&&a&&a.detail===3||o===`drop`||o===void 0),f,p,m,h;if(q(e)&&!d)return e.clone();{if(t===null)return null;let r=Mf(t,n._rootElement);if(f=r.anchorNode,p=r.focusNode,m=r.anchorOffset,h=r.focusOffset,(s||u||o===void 0)&&q(e)&&!ud(n,f,p))return e.clone()}let g=kg(f,m,p,h,n,e);if(g===null)return null;let[_,v,y]=g,b=q(e)?e:null,x=new sg(_,v,b?b.format:0,b?b.style:``);return b&&Lg(x,b.anchor.key),x.dirty=y,x}function Lg(e,t){let n=e.anchor;if(n.key===t)return;let r=n.getNode(),i=0,a=``;R(r)?(i=r.getFormat(),a=r.getStyle()):I(r)&&(i=r.getTextFormat(),a=r.getTextStyle()),e.format===i&&e.style===a||(e.format=i,e.style=a,e.dirty=!0)}function J(){return Pm()._selection}function Rg(){return K()._editorState._selection}function zg(e,t){let n=t.__key;return e.anchor.key===n||e.focus.key===n}function Bg(e,t,n,r=1){if(zg(e,t))for(let i of[e.anchor,e.focus]){i.key===t.__key&&(n<=i.offset&&r>0||n<i.offset&&r<0)&&i.set(t.__key,Math.max(0,i.offset+r),`element`);let e=i.getNode();if(I(e)){let t=e.getChildrenSize(),n=i.offset>=t,r=e.getChildAtIndex(n?t-1:i.offset);R(r)&&i.set(r.__key,n?r.getTextContentSize():0,`text`)}}}function Vg(e,t,n,r,i){let a=r||i;if(R(a)||I(a)){let t=R(a);e.set(a.__key,r===null?0:t?a.getTextContentSize():a.getChildrenSize(),t?`text`:`element`)}else{let r=t.getIndexWithinParent();e.set(n.__key,r===-1?n.getChildrenSize():r,`element`)}}function Hg(e,t,n,r,i){e.type===`text`?e.set(n,e.offset+(t?0:i),`text`):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,`element`)}function Ug(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch{}}function Wg(e,t,n){let r=nf(e,t.getKey());if(I(t)){let i=Yf(t,r,e);return[i.element,n+i.getFirstChildOffset()]}return[r,n]}function Gg(e,t,n,r,i,a){let o=a.getRootNode(),s=_d(o)||wf(o)?Lf(o):null;if(i.has(`collaboration`)&&s!==a||s!==null&&cd(s,s))return;let c=Mf(r,a),l;if(!q(t))return void(e!==null&&ud(n,c.anchorNode,c.focusNode)&&r.removeAllRanges());let u=t.anchor,d=t.focus,f=u.getNode(),p=d.getNode(),[m,h]=Wg(n,f,u.offset),[g,_]=Wg(n,p,d.offset),v=t.format,y=t.style,b=t.isCollapsed(),x=m,S=g,C=!1;if(u.type===`text`?(x=R(f)?Zf(f,m,n):null,C=f.getFormat()!==v||f.getStyle()!==y):q(e)&&e.anchor.type===`text`&&(C=!0),d.type===`text`&&(S=R(p)?Zf(p,g,n):null),x===null||S===null)return;let w=b&&R(p)&&Ed(p)&&gd(S)&&S.nodeValue===Ia?Ia.length:_;if(b&&(e===null||C||q(e)&&(e.format!==v||e.style!==y))&&function(e,t,n,r,i,a){e._inputState.collapsedSelectionFormat={format:t,key:i,offset:r,style:n,timeStamp:a}}(n,v,y,u.offset,u.key,performance.now()),(r.type!==`Range`||!b)&&c.anchorOffset===h&&c.focusOffset===w&&c.anchorNode===x&&c.focusNode===S){if(s===null||!a.contains(s)){let e=s===null?null:fd(s);e!==null&&e!==n||i.has(`skip-selection-focus`)||a.focus({preventScroll:!0})}if(u.type!==`element`)return}if(Ug(r,x,h,S,w),wa&&t.isCollapsed()&&a!==null&&!i.has(`skip-selection-focus`)){let e=If(a);if(e===null||!a.contains(e)){let e=Lf(a.ownerDocument),t=e===null?null:fd(e);t!==null&&t!==n||a.focus({preventScroll:!0})}}if(!i.has(`skip-scroll-into-view`)&&t.isCollapsed()&&a!==null&&a===If(a)){let e=q(t)&&t.anchor.type===`element`?function(e,t,n){let r=t.childNodes[n];if(!W(r))return r||null;let i=kd(r,e),a=i===void 0?null:B(i);return a===null||I(a)?r:Yf(a,r,e).element}(n,x,h):(l===void 0&&(l=jf(r,a)),l);if(e!==null){let t;if(gd(e)){let n=e.ownerDocument.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=W(e)?e.getBoundingClientRect():function(e){let t=e.getBoundingClientRect(),{startContainer:n,startOffset:r}=e;if(!e.collapsed||t.width!==0||t.height!==0||!gd(n)||n.length===0)return t;let i=e.cloneRange();return r>0?i.setStart(n,r-1):i.setEnd(n,1),i.getBoundingClientRect()}(e);(function(e,t,n,r=null){let i=af(n),a=df(i);if(i===null||a===null)return;let o=n.getBoundingClientRect();if(t.bottom<o.top)return;if(r!==null&&t.height>0){let{left:e,right:i}=t,o=W(r)?r:rf(r);for(;o!==null&&n.contains(o);){let t=sf(a,o,e,i);e-=t,i-=t,o=o===n?null:rf(o)}}let{top:s,bottom:c}=t,l=0,u=0,d=n;for(;d!==null;){let t=d===i.body;if(t){let t=a.visualViewport;if(t){let e=t.offsetTop;l=e,u=e+t.height}else l=0,u=ff(e).innerHeight;let n=a.getComputedStyle(i.documentElement),r=parseFloat(n.scrollPaddingTop),o=parseFloat(n.scrollPaddingBottom);isFinite(r)&&(l+=r),isFinite(o)&&(u-=o)}else{let e=d===n?o:d.getBoundingClientRect();l=e.top,u=e.bottom}let r=0;if(s<l?r=-(l-s):c>u&&(r=c-u),r!==0){if(t)a.scrollBy(0,r);else{let e=d.scrollTop;d.scrollTop+=r;let t=d.scrollTop-e;s-=t,c-=t}}if(t)break;d=rf(d)}})(n,t,a,x)}}(function(e,t,n,r,i){let a=e._inputState;a.isSelectionChangeFromDOMUpdate=!0,a.selectionChangeFromDOMUpdatePoints=t!==void 0&&n!==void 0&&r!==void 0&&i!==void 0?{anchorNode:t,anchorOffset:n,focusNode:r,focusOffset:i}:null})(n,x,h,S,w)}function Kg(e){let t=J()||Rg();t===null&&(t=V().selectEnd()),t.insertNodes(e)}function qg(e,t){for(let n of e.split(/(\r?\n|\t)/))n===`
|
|
10
|
-
`||n===`\r
|
|
11
|
-
`?t.linebreak():n===` `?t.tab():n!==``&&t.text(n)}function Jg(e){let t=[];return qg(e,{linebreak:()=>t.push(sm()),tab:()=>t.push($u()),text:e=>t.push(wu(e))}),t}function Yg(e){let t=[];for(let n of e)cm(n)||(!I(n)&&!L(n)||n.isInline()?t.push(n):I(n)&&t.push(...Yg(n.getChildren())));return t}function Xg(e,t=!1){let n=e;e.isCollapsed()||n.removeText();let r=J();q(r)&&(n=r),q(n)||M(161);let i=n.anchor,a=i.getNode(),o=i.offset;for(;!Kf(a)&&f_(a)===null;){let e=a;if([a,o]=Zg(a,o,t),e.is(a))break}return[a,o]}function Zg(e,t,n=!1){let r=e.getParent();if(!r){let e=z();return V().append(e),e.select(),[V(),0]}if(R(e)){let n=e.splitText(t);if(n.length===0)return[r,e.getIndexWithinParent()];let i=t===0?0:1;return[r,n[0].getIndexWithinParent()+i]}if(!I(e)||t===0)return[r,e.getIndexWithinParent()];let i=e.getChildAtIndex(t);if(i){let r=new sg($h(e.__key,t,`element`),$h(e.__key,t,`element`),0,``),a=e.insertNewAfter(r);if(a)a.append(i,...i.getNextSiblings());else if(n)return[e,t]}return[r,e.getIndexWithinParent()+1]}function Qg(e){return cm(e)||pf(e)||R(e)||e.isParentRequired()}function $g(e){let t=z(),n=null;for(let r=0;r<e.length;r++){let i=e[r];if(Qg(i)){if(n===null){n=i.createParentElementNode(),t.append(n);let a=e[r+1];if(cm(i)&&(a===void 0||!Qg(a)))continue}n.append(i)}else t.append(i),n=null}return t}function e_(e,t,n,r,i=`decorators-and-blocks`){if(t===`move`&&r===`character`&&!e.isCollapsed()){let[t,r]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return r.set(t.key,t.offset,t.type),!0}let a=Eu(e.focus,n?`previous`:`next`),o=r===`lineboundary`,s=t===`move`,c=a,l=i===`decorators-and-blocks`,u=!1;if(!Lu(c)){for(let e of c){l=!1;let{origin:t}=e;if(L(t)){if(t.isIsolated()){u=!0;break}if(c=e,o&&t.isInline())continue}break}if(u)return!0;if(l)for(let e of ev(a).iterNodeCarets(t===`extend`?`shadowRoot`:`root`)){if(B_(e))e.origin.isInline()||(c=e);else{if(I(e.origin))continue;L(e.origin)&&!e.origin.isInline()&&(c=e)}break}}if(c===a)return!1;if(s&&!o&&L(c.origin)&&c.origin.isKeyboardSelectable()){let e=Ng();return e.add(c.origin.getKey()),Fd(e),!0}return c=Iu(c),s&&Du(e.anchor,c),Du(e.focus,c),l||!o}function t_(e,t,n){let r=t===null?null:t.__key,i=n===null?null:n.__key;t===null?e.__first=i:t.__next=i,n===null?e.__last=r:n.__prev=r}function n_(e){let t=K();if(!t._recordNodeMoves)return;let n=t._editorState._nodeMap;if(n.has(e.__key)){let t=Pm(),r=t._movedNodes||=new WeakMap,i=r.get(n);i===void 0&&(i=new Set,r.set(n,i)),i.add(e.__key)}}function r_(e,t,n,r){let i=t.__key;n===null?e.__first=i:n.__next=i,r===null?e.__last=i:r.__prev=i,t.__prev=n===null?null:n.__key,t.__next=r===null?null:r.__key,t.__parent=e.__key}function i_(e){f_(e)!==null&&M(380,e.__key,String(f_(e)));let t=e.getParent();if(t!==null){let n=t.getWritable();n_(e);let r=e.getPreviousSibling(),i=e.getNextSibling();t_(n,r&&r.getWritable(),i&&i.getWritable()),e.__prev=null,e.__next=null,e.__parent=null,n.__size--}}function a_(e,t){let n=t&&e.getParent(),r=t&&n&&zg(t,n)?e.getIndexWithinParent():-1,i=t&&n&&r!==-1?[t.anchor,t.focus].filter(e=>e.type===`element`&&e.key===n.__key&&e.offset===r+1):null;return t&&n&&r!==-1&&t.isBackward(),i_(e),t&&n&&r!==-1&&Bg(t,n,r,-1),t&&(t._cachedIsBackward=null),i}function o_(e,t,n,r){Mm();let i=t===`next`;vf(e,n);let a=e.getWritable(),o=n.getWritable();e.getParentOrThrow();let s=J(),c=r&&q(s)?s:null,l=a_(o,c),u=e.getParentOrThrow().getWritable(),d=c&&(i&&l!==null&&l.length>0||zg(c,u))?e.getIndexWithinParent()+ +!!i:-1,f=i?e.getNextSibling():e.getPreviousSibling(),p=f&&f.getWritable();if(r_(u,o,i?a:p,i?p:a),u.__size++,c&&d!==-1&&(Bg(c,u,d),i&&l!==null))for(let e of l)e.set(u.__key,d+1,`element`);return n}function s_(e,t,n){Mm();let{origin:r,direction:i}=e,a=i===`next`,o=p_(r);if(o!==null)return a?o.selectNext(t,n):o.selectPrevious(t,n);let s=e.getNodeAtCaret(),c=r.getParentOrThrow();if(s===null)return a?c.select():c.select(0,0);if(I(s))return a?s.select(0,0):s.select();if(R(s))return s.select(t,n);let l=s.getIndexWithinParent()+ +!a;return c.select(l,l)}function c_(e,t){let n=[];for(let r=e;r!==null;r=t===`next`?r.getNextSibling():r.getPreviousSibling())n.push(r);return n}var l_=new Map;function u_(e){return I(e)||L(e)}function d_(e){return I(e)||L(e)}function f_(e){let t=e.getLatest();return d_(t)?t.__slotHost:null}function p_(e){let t=f_(e);if(t===null)return null;let n=B(t);return I(n)||L(n)||M(370),n}function m_(e){let t=p_(e);if(t===null)return null;let n=e.getLatest().__key;for(let[e,r]of __(t))if(r===n)return e;return null}function h_(e){let t=e.getLatest();for(;t!==null;){if(f_(t)!==null)return t;t=t.getParent()}return null}function g_(e){if(e===null)return null;let t=q(e)?e.anchor.getNode():e.getNodes()[0]??null;return t===null?null:h_(t)}function __(e){let t=e.getLatest();return u_(t)&&t.__slots!==null?t.__slots:l_}function v_(e){return Array.from(__(e).keys())}function y_(e,t){let n=__(e).get(t);return n===void 0?null:B(n)}var b_=[`__proto__`,`constructor`,`prototype`],x_=Symbol(`slotMapOwner`);function S_(e){let t=e.__slots;return t!==null&&t[x_]===e||(t=new Map(t),t[x_]=e,e.__slots=t),t}var C_=new WeakMap,w_=[];function T_(e){for(let{ownNodeConfig:t}of zp(e)){let e=t&&t.slots;if(e)return e}return w_}function E_(e){let t=``;for(let n of __(e).values()){let e=B(n);e!==null&&(t+=e.getTextContent())}return t}function D_(e,t,n){let r=n.get(e),i=n.get(t);return r===void 0?i===void 0?e<t?-1:+(e>t):1:i===void 0?-1:r-i}function O_(e,t,n){t!==`__proto__`&&t!==`constructor`&&t!==`prototype`||M(373,t);let r=e.getLatest();if(r.__slots!==null&&r.__slots.get(t)===n.getLatest().__key)return r;(!I(n)&&!L(n)||n.isInline())&&M(374,n.__key);let i=e.getWritable(),a=S_(i),o=a.get(t);o!==void 0&&k_(o);let s=n.getWritable(),c=p_(s);if(c!==null){let e=m_(s);e!==null&&S_(c.getWritable()).delete(e),s.__slotHost=null}return i_(s),s.__slotHost=i.__key,a.set(t,s.__key),function(e){let t=e.__slots;if(t===null||t.size<2)return;let n=function(e){let t=C_.get(e);if(t===void 0){let n=T_(e),r=new Map;for(let t of n)b_.includes(t)&&M(371,e.name,t),r.has(t)&&M(372,e.name,t),r.set(t,r.size);t=r,C_.set(e,t)}return t}(e.constructor),r=null,i=!0;for(let e of t.keys()){if(r!==null&&D_(r,e,n)>0){i=!1;break}r=e}if(i)return;let a=Array.from(t).sort(([e],[t])=>D_(e,t,n));t.clear();for(let[e,n]of a)t.set(e,n)}(i),K()._slotsUsed=!0,Pm()._slotsUsed=!0,i}function k_(e){let t=B(e);if(t===null)return;let n=t.getWritable();d_(n)||M(377,e),n.__slotHost=null,n.remove()}var A_={next:`previous`,previous:`next`},j_=class{origin;constructor(e){this.origin=e}[Symbol.iterator](){return rv({hasNext:z_,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return Y(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Y(this.origin,this.direction)}remove(){let e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){let n=this.getNodeAtCaret();return e.is(this.origin)||e.is(n)||(n===null?this.insert(e):n.replace(e,t)),this}splice(e,t,n=`next`){let r=n===this.direction?t:Array.from(t).reverse(),i=this,a=this.getParentAtCaret(),o=new Map;for(let t=i.getAdjacentCaret();t!==null&&o.size<e;t=t.getAdjacentCaret()){let e=t.origin.getWritable();o.set(e.getKey(),e)}for(let e of r){if(o.size>0){let t=i.getNodeAtCaret();if(t){if(o.delete(t.getKey()),o.delete(e.getKey()),!(t.is(e)||i.origin.is(e))){let n=e.getParent();n&&n.is(a)&&e.remove(),t.replace(e)}}else t===null&&M(263,Array.from(o).join(` `))}else i.insert(e);i=Y(e,this.direction)}for(let e of o.values())e.remove();return this}},M_=class e extends j_{type=`child`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:q_(e,this.direction)}getParentCaret(e=`root`){return Y(F_(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=P_(this.direction);return Y(this.getNodeAtCaret(),e)||q_(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}},N_={root:ru,shadowRoot:U};function P_(e){return A_[e]}function F_(e,t=`root`){return e===null||N_[t](e)?null:f_(e)===null?e:null}var I_=class e extends j_{type=`sibling`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Y(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return I(this.origin)?q_(this.origin,this.direction):null}getParentCaret(e=`root`){return Y(F_(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=P_(this.direction);return Y(this.getNodeAtCaret(),e)||q_(this.origin.getParentOrThrow(),e)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof e||t instanceof L_)&&this.direction===t.direction&&this.origin.is(t.origin)}},L_=class e extends j_{type=`text`;offset;constructor(e,t){super(e),this.offset=t}getLatest(){let e=this.origin.getLatest();return e===this.origin?this:W_(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e=`root`){return Y(F_(this.getParentAtCaret(),e),this.direction)}getFlipped(){return W_(this.origin,P_(this.direction),this.offset)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof I_||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return Y(this.origin,this.direction)}};function R_(e){return e instanceof L_}function z_(e){return e instanceof I_}function B_(e){return e instanceof M_}var V_={next:class extends L_{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends L_{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},H_={next:class extends I_{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends I_{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},U_={next:class extends M_{direction=`next`;getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends M_{direction=`previous`;getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Y(e,t){return e?new H_[t](e):null}function W_(e,t,n){return e?new V_[t](e,G_(e,n)):null}function G_(e,t,n=`error`){let r=e.getTextContentSize(),i=t===`next`?r:t===`previous`?0:t;return(i<0||i>r)&&(n!==`clamp`&&ga(284,String(t),String(r),e.getKey()),i=i<0?0:r),i}function K_(e,t){return new Z_(e,t)}function q_(e,t){return I(e)?new U_[t](e):null}function J_(e){return e&&e.getChildCaret()||e}function Y_(e){return e&&J_(e.getAdjacentCaret())}var X_=class e{type=`node-caret-range`;direction;anchor;focus;constructor(e,t,n){this.anchor=e,this.focus=t,this.direction=n}getLatest(){let t=this.anchor.getLatest(),n=this.focus.getLatest();return t===this.anchor&&n===this.focus?this:new e(t,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let e=this.anchor.getLatest(),t=this.focus.getLatest();return R_(e)&&R_(t)&&e.isSameNodeCaret(t)?[K_(e,t.offset-e.offset),null]:[R_(e)?Q_(e,`anchor`):null,R_(t)?Q_(t,`focus`):null]}iterNodeCarets(e=`root`){let t=R_(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=R_(n),i=t=>t.isSameNodeCaret(n)?null:Y_(t)||t.getParentCaret(e);return rv({hasNext:e=>e!==null&&!(r&&n.isSameNodeCaret(e)),initial:t.isSameNodeCaret(n)?null:i(t),map:e=>e,step:i})}[Symbol.iterator](){return this.iterNodeCarets(`root`)}},Z_=class{type=`slice`;caret;distance;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){let{distance:e,caret:{offset:t}}=this,n=t+e;return n<t?[n,t]:[t,n]}getTextContent(){let[e,t]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,t)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:e,direction:t}}=this,[n,r]=this.getSliceIndices(),i=e.getTextContent();return W_(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}};function Q_(e,t){let{direction:n,origin:r}=e;return K_(e,G_(r,t===`focus`?P_(n):n)-e.offset)}function $_(e,t){return e.direction===t?e:e.getFlipped()}function ev(e){return nv(e,$_(q_(V(),P_(e.direction)),e.direction))}function tv(e){return nv(e,e)}function nv(e,t){return e.direction!==t.direction&&M(265),new X_(e,t,e.direction)}function rv(e){let{initial:t,hasNext:n,step:r,map:i}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!n(a))return{done:!0,value:void 0};let e={done:!1,value:i(a)};return a=r(a),e}}}function iv(e,t){let n=uv(e.origin,t.origin);switch(n===null&&M(275,e.origin.getKey(),t.origin.getKey()),n.type){case`same`:return ov(e,t);case`ancestor`:return e.type===`child`?-1:1;case`descendant`:return t.type===`child`?1:-1;case`branch`:return sv(n)}}function av(e){return e.getParent()||p_(e)}function ov(e,t){let n=e.type===`text`,r=t.type===`text`;return n&&r?function(e,t){return Math.sign(e-t)}(e.offset,t.offset):e.type===t.type?0:n?-1:r?1:e.type===`child`?-1:1}function sv(e){let{a:t,b:n}=e,r=t.__key,i=n.__key,a=t,o=n;for(;a&&o;a=a.getNextSibling(),o=o.getNextSibling()){if(a.__key===i)return-1;if(o.__key===r)return 1}return a===null?1:-1}function cv(e,t){return t.is(e)}function lv(e){return I(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function uv(e,t){if(e.is(t))return{commonAncestor:e,type:`same`};let n=new Map;for(let[t,r]=lv(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=lv(t);r;i=r,r=r.getParent()){let a=n.get(r);if(a!==void 0)return a===null?(cv(e,r)||M(276),{commonAncestor:r,type:`ancestor`}):i===null?(cv(t,r)||M(277),{commonAncestor:r,type:`descendant`}):((I(a)||cv(e,a))&&(I(i)||cv(t,i))&&r.is(a.getParent())&&r.is(i.getParent())||M(278),{a,b:i,commonAncestor:r,type:`branch`})}return null}function dv(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function fv(...e){let t=[];for(let n of e)if(n&&typeof n==`string`)for(let[e]of n.matchAll(/\S+/g))t.push(e);return t}function pv(e,...t){let n=fv(...t);n.length>0&&e.classList.add(...n)}function mv(e,...t){let n=fv(...t);n.length>0&&e.classList.remove(...n)}var hv=`57X6y3wQZNzYjJB2L_10pxbackgroundhimselfUTF-8DEMOGRAPHICSVqvt4KW9`,gv=e=>crypto.getRandomValues(new Uint8Array(e)),_v=(e,t,n)=>{let r=256-256%e.length;if(r===256){let r=e.length-1;return(i=t)=>{if(!i)return``;let a=``;for(;;){let t=n(i),o=i|=0;for(;o--;)if(a+=e[t[o]&r],a.length>=i)return a}}}return(i=t)=>{if(!i)return``;let a=``,o=Math.ceil(409.6*i/r);for(;;){let t=n(o),s=o;for(;s--;)if(t[s]<r&&(a+=e[t[s]%e.length],a.length>=i))return a}}},vv=(e,t=21)=>_v(e,t|0,gv),yv=(e=21)=>{for(var t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));e--;)t+=hv[n[e]&63];return t};function bv(){return V().getTextContent()}function xv(e,t=!0){if(e)return!1;let n=bv();return t&&(n=n.trim()),n===``}function Sv(e){if(!xv(e,!1))return!1;let t=V().getChildren(),n=t.length;if(n>1)return!1;for(let e=0;e<n;e++){let n=t[e];if(L(n))return!1;if(I(n)){if(!Xu(n)||n.__indent!==0)return!1;let e=n.getChildren(),t=e.length;for(let n=0;n<t;n++){let t=e[n];if(!R(t))return!1}}}return!0}function Cv(e){return()=>Sv(e)}var wv=va?A.useLayoutEffect:A.useEffect;function Tv({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:r,ariaDescribedBy:i,ariaErrorMessage:a,ariaExpanded:o,ariaInvalid:s,ariaLabel:c,ariaLabelledBy:l,ariaMultiline:u,ariaOwns:d,ariaRequired:f,autoCapitalize:p,className:m,id:h,role:g,spellCheck:_=!0,style:v,tabIndex:y,"data-testid":b,...x},S){let[C,w]=(0,A.useState)(e.isEditable()),T=(0,A.useCallback)(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),E=(0,A.useMemo)(()=>function(...e){return t=>{for(let n of e)typeof n==`function`?n(t):n!=null&&(n.current=t)}}(S,T),[T,S]);wv(()=>(w(e.isEditable()),e.registerEditableListener(e=>{w(e)})),[e]);let D={"aria-activedescendant":C?t:void 0,"aria-autocomplete":C?n:`none`,"aria-controls":C?r:void 0,"aria-describedby":i,...a==null?{}:{"aria-errormessage":a},"aria-expanded":g===`combobox`?o??!1:void 0,...s==null?{}:{"aria-invalid":s},"aria-label":c,"aria-labelledby":l,"aria-multiline":u,"aria-owns":C?d:void 0,"aria-readonly":!C||void 0,"aria-required":f,...x},ee=[D[`aria-label`],D[`aria-labelledby`],D.title].some(e=>typeof e==`string`&&e.trim()!==``),te=g===void 0?C||ee?`textbox`:void 0:g;return te??(D[`aria-activedescendant`]=void 0,D[`aria-autocomplete`]=void 0,D[`aria-expanded`]=void 0,D[`aria-multiline`]=void 0,D[`aria-placeholder`]=void 0,D[`aria-readonly`]=void 0,D[`aria-required`]=void 0),(0,j.jsx)(`div`,{autoCapitalize:p,className:m,contentEditable:C,"data-testid":b,id:h,ref:E,role:te,spellCheck:_,style:v,tabIndex:y??(C?void 0:-1),...D})}var Ev=(0,A.forwardRef)(Tv);function Dv(e){return e.read(`latest`,Cv(e.isComposing()))}var Ov=(0,A.forwardRef)(kv);function kv(e,t){let{placeholder:n,...r}=e,[i]=ma();return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Ev,{editor:i,...r,ref:t}),n!=null&&(0,j.jsx)(Av,{editor:i,content:n})]})}function Av({content:e,editor:t}){let n=function(e){let[t,n]=(0,A.useState)(()=>Dv(e));return wv(()=>{function t(){let t=Dv(e);n(t)}return t(),eh(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),[r,i]=(0,A.useState)(t.isEditable());if(wv(()=>(i(t.isEditable()),t.registerEditableListener(e=>{i(e)})),[t]),!n)return null;let a=null;return typeof e==`function`?a=e(r):e!==null&&(a=e),a===null?null:(0,j.jsx)(`div`,{"aria-hidden":!0,children:a})}var jv=class extends A.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){this.props.onError(e instanceof Error?e:Error(String(e),{cause:e}),t)}render(){return this.state.hasError?this.props.fallback:this.props.children}};function Mv({children:e,fallback:t,onError:n}){return(0,j.jsx)(jv,{fallback:t===void 0?(0,j.jsx)(`div`,{style:{border:`1px solid #f00`,color:`#f00`,padding:`8px`},children:`An error was thrown.`}):t,onError:n,children:e})}var Nv=va?A.useLayoutEffect:A.useEffect;function Pv(e){let[t]=ma(),n=(0,A.useMemo)(()=>e(t),[t,e]),[r,i]=(0,A.useState)(()=>n.initialValueFn()),a=(0,A.useRef)(r);return Nv(()=>{let{initialValueFn:e,subscribe:t}=n,r=e();return a.current!==r&&(a.current=r,i(r)),t(e=>{a.current=e,i(e)})},[n,e]),r}function Fv(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function Iv(){return Pv(Fv)}function Lv(e){return(typeof e.nodes==`function`?e.nodes():e.nodes)||[]}var Rv={tag:Xp};function zv(){let e=V();e.isEmpty()&&e.append(z())}var Bv={config:{setOptions:Rv,updateOptions:Rv},init:({$initialEditorState:e=zv})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},r){let i=r.getInitResult();if(!i.initialized){i.initialized=!0;let{$initialEditorState:r}=i;if(Kp(r))e.setEditorState(r,n);else if(typeof r==`function`)e.update(()=>{r(e)},t);else if(r&&(typeof r==`string`||typeof r==`object`)){let t=e.parseEditorState(r);e.setEditorState(t,n)}}return()=>{}},name:`@lexical/extension/InitialState`,nodes:[nu,hu,am,Qu,Ju]};function Vv(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return 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.`)}(e,...t)}function Hv(){let e;try{e=`0.53.0+prod.esm`}catch{}return e??`"<unknown>+source"`}var Uv=Hv(),Wv=new Set([`__proto__`,`constructor`,`prototype`]);function Gv(e,t){if(e&&t&&!Array.isArray(t)&&typeof e==`object`&&typeof t==`object`){let n=e,r=t;for(let e in r)!Wv.has(e)&&Object.prototype.hasOwnProperty.call(r,e)&&(n[e]=Gv(n[e],r[e]));return e}return t}function Kv(e){return e.id===0}function qv(e){return e.id===2}var Jv=new Set,Yv=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:0}}mergeConfigs(){let e=this.extension.config||{},t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):dv;for(let n of this.configs)e=t(e,n);return e}init(e){let t=this.state;qv(t)||Vv(306,String(t.id));let n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=function(e,t,n){return Object.assign(e,{config:t,id:3,registerState:n})}(t,this.mergeConfigs(),n),a;this.state=i,this.extension.init&&(a=this.extension.init(e,i.config,n)),this.state=function(e,t,n){return Object.assign(e,{id:4,initResult:t,registerState:n})}(i,a,r)}build(e){let t=this.state,n;t.id!==4&&Vv(307,String(t.id),`5`),this.extension.build&&(n=this.extension.build(e,t.config,t.registerState));let r={...t.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(e,t,n){return Object.assign(e,{id:5,output:t,registerState:n})}(t,n,r)}register(e,t){this._signal=t;let n=this.state;n.id!==5&&Vv(308,String(n.id),`5`);let r=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:6})}(n),()=>{let e=this.state;e.id!==7&&Vv(309,String(n.id),`7`),this.state=function(e){return Object.assign(e,{id:5})}(e),r&&r()}}afterRegistration(e){let t=this.state,n;return t.id!==6&&Vv(310,String(t.id),`6`),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:7})}(t),n}getSignal(){return this._signal===void 0&&Vv(311),this._signal}getInitResult(){this.extension.init===void 0&&Vv(312,this.extension.name);let e=this.state;return function(e){return e.id>=4}(e)||Vv(313,String(e.id),`4`),e.initResult}getInitPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){let e=this.state;return function(e){return e.id>=3}(e)||Vv(314,String(e.id),`3`),{config:e.config}}getPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&Vv(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&Vv(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){let e=this.state;return function(e){return e.id>=7}(e)||Vv(316,String(e.id),`7`),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Jv}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([e])=>e)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){let e=this.state;(function(e){return e.id>=5})(e)||Vv(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}},Xv=Symbol.for(`@lexical/extension/LexicalBuilder`);function Zv(){}function Qv(e){throw e}function $v(e){return Array.isArray(e)?e:[e]}var ey=Uv,ty=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=ey,this.roots=e;for(let t of e)this.addExtension(t)}static fromExtensions(t){let n=[$v(Bv)];for(let e of t)n.push($v(e));return new e(n)}static maybeFromEditor(t){let n=t[Xv];return n&&(n.PACKAGE_VERSION!==ey&&Vv(292,n.PACKAGE_VERSION,ey),n instanceof e||Vv(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&Vv(294),n}constructEditor(){let{$initialEditorState:e,onError:t,onWarn:n,...r}=this.buildCreateEditorArgs(),i=Object.assign(gm({...r,...t?{onError:e=>{t(e,i)}}:{},...n?{onWarn:e=>{n(e,i)}}:{}}),{[Xv]:this});for(let e of this.sortedExtensionReps())e.build(i);return i}buildEditor(){let e=Zv;function t(){try{e()}finally{e=Zv}}let n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=eh(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){let t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&Vv(295,e.name),t}addEdge(e,t,n){let r=this.outgoingConfigEdges.get(e);if(r){let e=r.get(t);e?e.push(...n):r.set(t,n)}else this.outgoingConfigEdges.set(e,new Map([[t,n]]));let i=this.incomingEdges.get(t);i?i.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){this._sortedExtensionReps!==void 0&&Vv(296);let[t]=$v(e);typeof t.name!=`string`&&Vv(297,typeof t.name);let n=this.extensionNameMap.get(t.name);if(n!==void 0&&n.extension!==t&&Vv(298,t.name),!n){n=new Yv(this,t),this.extensionNameMap.set(t.name,n);let e=this.conflicts.get(t.name);typeof e==`string`&&Vv(299,t.name,e);for(let e of t.conflictsWith||[])this.extensionNameMap.has(e)&&Vv(299,t.name,e),this.conflicts.set(e,t.name);for(let e of t.dependencies||[]){let n=$v(e);this.addEdge(t.name,n[0].name,n.slice(1)),this.addExtension(n)}for(let[e,n]of t.peerDependencies||[])this.addEdge(t.name,e,n?[n]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let e=[],t=(n,r)=>{let i=n.state;if(qv(i))return;let a=n.extension.name;var o;Kv(i)||Vv(300,a,r||`[unknown]`),Kv(o=i)||Vv(304,String(o.id),`0`),i=Object.assign(o,{id:1}),n.state=i;let s=this.outgoingConfigEdges.get(a);if(s)for(let e of s.keys()){let n=this.extensionNameMap.get(e);n&&t(n,a)}i=function(e){return function(e){return e.id===1}(e)||Vv(305,String(e.id),`1`),Object.assign(e,{id:2})}(i),n.state=i,e.push(n)};for(let e of this.extensionNameMap.values())Kv(e.state)&&t(e);for(let t of e)for(let[e,n]of this.outgoingConfigEdges.get(t.extension.name)||[])if(n.length>0){let t=this.extensionNameMap.get(e);if(t)for(let e of n)t.configs.add(e)}for(let[e,...t]of this.roots)if(t.length>0){let n=this.extensionNameMap.get(e.name);n===void 0&&Vv(301,e.name);for(let e of t)n.configs.add(e)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){let t=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],i=n.signal;for(let n of t){let t=n.register(e,i);t&&r.push(t)}for(let n of t){let t=n.afterRegistration(e);t&&r.push(t)}return eh(...r)}buildCreateEditorArgs(){let e={},t=new Set,n=new Map,r=new Map,i={},a={},o=this.sortedExtensionReps();for(let s of o){let{extension:o}=s;if(o.onError!==void 0&&(e.onError=o.onError),o.onWarn!==void 0&&(e.onWarn=o.onWarn),o.disableEvents!==void 0&&(e.disableEvents=o.disableEvents),o.parentEditor!==void 0&&(e.parentEditor=o.parentEditor),o.editable!==void 0&&(e.editable=o.editable),o.namespace!==void 0&&(e.namespace=o.namespace),o.$initialEditorState!==void 0&&(e.$initialEditorState=o.$initialEditorState),o.nodes)for(let e of Lv(o)){if(typeof e!=`function`){let t=n.get(e.replace);t&&Vv(302,o.name,e.replace.name,t.extension.name),n.set(e.replace,s)}t.add(e)}if(o.html){if(o.html.export)for(let[e,t]of o.html.export.entries())r.set(e,t);o.html.import&&Object.assign(i,o.html.import)}o.theme&&Gv(a,o.theme)}Object.keys(a).length>0&&(e.theme=a),t.size&&(e.nodes=Array.from(t));let s=Object.keys(i).length>0,c=r.size>0;(s||c)&&(e.html={},s&&(e.html.import=i),c&&(e.html.export=r));for(let t of o)t.init(e);return e.onError||=Qv,e}},ny={name:`@lexical/react/ReactProvider`},ry=Symbol.for(`preact-signals`);function iy(){if(ly>1)ly--;else{var e,t=!1;for((function(){var e=fy;for(fy=void 0;e!==void 0;){var t=e.S;if(t.v===e.v)for(var n=t.t;n!==void 0;n=n.x)n.i===e.i&&(n.i=t.i);e=e.o}})();cy!==void 0;){var n=cy;for(cy=void 0,uy++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&_y(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(uy=0,ly--,t)throw e}}var ay,oy=void 0;function sy(e){var t=oy,n=ay;oy=void 0,ay=void 0;try{return e()}finally{oy=t,ay=n}}var cy=void 0,ly=0,uy=0,dy=0,fy=void 0,py=0;function my(e){if(oy!==void 0){var t=e.n;if(t===void 0||t.t!==oy)return t={i:0,S:e,p:oy.s,n:void 0,t:oy,e:void 0,x:void 0,r:t},oy.s!==void 0&&(oy.s.n=t),oy.s=t,e.n=t,32&oy.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=oy.s,t.n=void 0,oy.s.n=t,oy.s=t),t}}function hy(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}hy.prototype.brand=ry,hy.prototype.h=function(){return!0},hy.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n===void 0?sy(function(){var e;(e=t.W)==null||e.call(t)}):n.e=e)},hy.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&sy(function(){var e;(e=t.Z)==null||e.call(t)}))}},hy.prototype.subscribe=function(e){var t=this;return Ty(function(){var n=t.value;sy(function(){return e(n)})},{name:`sub`})},hy.prototype.valueOf=function(){return this.value},hy.prototype.toString=function(){return this.value+``},hy.prototype.toJSON=function(){return this.value},hy.prototype.peek=function(){var e=this;return sy(function(){return e.value})},Object.defineProperty(hy.prototype,"value",{get:function(){var e=my(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(uy>100)throw Error(`Cycle detected`);(function(e){ly!==0&&uy===0&&e.l!==dy&&(e.l=dy,fy={S:e,v:e.v,i:e.i,o:fy})})(this),this.v=e,this.i++,py++,ly++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{iy()}}}});function gy(e,t){return new hy(e,t)}function _y(e){for(var 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 vy(e){for(var t=e.s;t!==void 0;t=t.n){var 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 yy(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function by(e,t){hy.call(this,void 0,t),this.x=e,this.s=void 0,this.g=py-1,this.f=4}by.prototype=new hy,by.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===py))return!0;if(this.g=py,this.f|=1,this.i>0&&!_y(this))return this.f&=-2,!0;var e=oy;try{vy(this),oy=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return oy=e,yy(this),this.f&=-2,!0},by.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}hy.prototype.S.call(this,e)},by.prototype.U=function(e){if(this.t!==void 0&&(hy.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},by.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(by.prototype,"value",{get:function(){if(1&this.f)throw Error(`Cycle detected`);var e=my(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function xy(e){var t=e.j;if(e.j=void 0,typeof t==`function`){ly++;var n=oy;oy=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,Sy(e),t}finally{oy=n,iy()}}}function Sy(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,xy(e)}function Cy(e){if(oy!==this)throw Error(`Out-of-order effect`);yy(this),oy=e,this.f&=-2;try{8&this.f&&Sy(this)}finally{iy()}}function wy(e,t){this.x=e,this.j=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,ay&&ay.push(this)}wy.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t==`function`&&(this.j=t)}finally{e()}},wy.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,xy(this),vy(this),ly++;var e=oy;return oy=this,Cy.bind(this,e)},wy.prototype.N=function(){2&this.f||(this.f|=2,this.u=cy,cy=this)},wy.prototype.d=function(){this.f|=8,1&this.f||Sy(this)},wy.prototype.dispose=function(){this.d()};function Ty(e,t){var n=new wy(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}function Ey(e,t={}){let n={};for(let r in e){let i=t[r];n[r]=gy(i===void 0?e[r]:i)}return n}function Dy(e,t){let n;return gy(e(),{unwatched(){n&&=(n(),void 0)},watched(){this.value=e(),n=t(this)}})}var Oy={bold:`bold`,italic:`italic`,strikeThrough:`strikethrough`,subscript:`subscript`,superscript:`superscript`,underline:`underline`},ky=Symbol.for(`@lexical/dragon/WindowState`);function Ay(e,t,n){let r=function(e){let t=e[ky];return t===void 0&&(t={dispose:()=>{},editors:new Map,installs:new Set},e[ky]=t),t}(e);if(r.installs.size===0){let t=Py.bind(e);e.addEventListener(`message`,t,!0),r.dispose=()=>{e.removeEventListener(`message`,t,!0)}}if(r.installs.add(t),n){let e=r.editors.get(n)||new Set;e.add(t),r.editors.set(n,e)}return jy.bind(null,e,r,t,n)}function jy(e,t,n,r){if(r){let e=t.editors.get(r);e&&e.delete(n)&&e.size===0&&t.editors.delete(r)}t.installs.delete(n)&&t.installs.size===0&&(t.dispose(),delete e[ky])}function My(e){return e&&e.ownerDocument.defaultView}function Ny(e){let t=Dy(()=>My(e.getRootElement()),t=>e.registerRootListener(e=>{t.value=My(e)}));return Ty(()=>{let n=t.value;if(n)return Ay(n,Symbol(`@lexical/dragon/editorInstall`),e)})}function Py(e){if(e.origin!==this.location.origin)return;let t=function(e){let t=e[ky];if(t===void 0)return null;let n=pd(Lf(e.document));return dd(n)&&t.editors.has(n)?n:null}(this);if(t===null)return;let n=e.data;if(typeof n==`string`){let r;try{r=JSON.parse(n)}catch{return}if(r&&r.protocol===`nuanria_messaging`&&r.type===`request`){let n=r.payload;if(n&&n.functionId===`makeChanges`){let r=n.args;if(Array.isArray(r)){let[n,i,a,o,s,c]=r;if(![n,i,o,s].every(Number.isFinite)||typeof a!=`string`&&a!==-1)return;t.update(()=>{let t=J();if(q(t)){let r=t.anchor,l=r.getNode(),u=0,d=0;if(R(l)&&n>=0&&i>=0&&(u=n,d=n+i,t.setTextNodeRange(l,u,l,d)),typeof a!=`string`||u===d&&a===``||(t.insertRawText(a),l=r.getNode()),R(l)){let e=l.getTextContentSize();u=Math.min(Math.max(o,0),e),d=o<0||s<0?u:Math.min(o+s,e),t.setTextNodeRange(l,u,l,d)}if(typeof c==`string`&&s>0&&!t.isCollapsed()){let e=Oy[c];e!==void 0&&t.formatText(e)}e.stopImmediatePropagation()}})}}}}}function Fy(e,t){let n=ty.maybeFromEditor(e);if(!n)return;let r=n.extensionNameMap.get(t);return r?r.getExtensionDependency():void 0}function Iy(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return 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.`)}(e,...t)}function Ly(e){let t=``;for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function Ry(e){let t=qf().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function zy(e){let t=ru(e)?e:e.getParent();return t&&Ry(t)}function By(e){let t=zy(e);return t!==null&&t.direction===`rtl`}function Vy(e,t,n=`self`){let r=e.getStartEndPoints();if(r!==null&&t.isSelected(e)&&!hd(t)){let[i,a]=e.isBackward()?[r[1],r[0]]:r,o=!q(e)||i.type!==`element`&&a.type!==`element`?void 0:Hu(Au(e).getTextSlices(),t),[s,c]=o?o.getSliceIndices():[t.__key===i.key?i.offset:0,t.__key===a.key?a.offset:void 0],l=t.__text.slice(s,c);l!==t.__text&&(n===`clone`&&(t=np(t)),t.__text=l)}return t}function Hy(e,t){(q(e)?e.isCollapsed():R(e)||I(e))||Iy(280);let n=iu(q(e)?e.style:R(e)?e.getStyle():e.getTextStyle()),r=Ly(Object.entries(t).reduce((t,[r,i])=>(typeof i==`function`?t[r]=i(n[r],e):i===null?delete t[r]:t[r]=i,t),{...n}));q(e)||R(e)?e.setStyle(r):e.setTextStyle(r)}function Uy(e,t){let n=new Set;if(q(e)&&e.isCollapsed()){Hy(e,t);let r=e.anchor.getNode();I(r)&&r.isEmpty()&&(n.add(r.getKey()),Hy(r,t))}Wy(e,e=>{Hy(e,t)});let r=e.getNodes();if(r.length>0)for(let e of r){if(!I(e)||!e.canBeEmpty()||e.getChildrenSize()!==0)continue;let r=e.getKey();n.has(r)||(n.add(r),Hy(e,t))}}function Wy(e,t){if(!e)return;let n=q(e)?Au(e).getTextSlices():[];for(let r of e.getNodes()){if(!R(r)||!r.canHaveFormat())continue;let i=Hu(n,r);(i?i.distance!==0:r.getTextContentSize()!==0)&&t(i&&!hd(r)?Uu(i,q(e)?e:null):r)}q(e)&&e.anchor.type===`text`&&e.focus.type===`text`&&e.anchor.key===e.focus.key&&Gy(e)}function Gy(e){if(e.isBackward()){let{anchor:t,focus:n}=e,{key:r,offset:i,type:a}=t;t.set(n.key,n.offset,n.type),n.set(r,i,a)}}function Ky(e,t){let n=e.getFormatType(),r=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),r!==t.getIndent()&&t.setIndent(r)}function qy(e,t,n){let r=Eu(e,n);if(Lu(r))return!1;for(;r;r=r.getParentCaret()){let e=r.getParentAtCaret();if(!e||r.getNodeAtCaret())return!1;if(t.is(e))return!0}return!1}function Jy(e,t,n=Ky){if(!e)return;let r=e.getStartEndPoints(),i=!1,a=null,o=new Map;if(r){let[t,n]=r,s=G(t.getNode(),Kf);a=G(n.getNode(),Kf);let c=e.isBackward()?`previous`:`next`;i=I(a)&&!a.is(s)&&function(e,t,n){let r=e.getNode();return(!I(r)||!r.isEmpty())&&qy(e,t,n)}(n,a,P_(c)),I(s)&&o.set(s.getKey(),s),I(a)&&!i&&o.set(a.getKey(),a)}for(let t of e.getNodes())if(I(t)&&Kf(t)){if(i&&t.is(a))continue;o.set(t.getKey(),t)}else if(!r){let e=G(t,Kf);I(e)&&o.set(e.getKey(),e)}for(let e of o.values()){if(p_(e)!==null)continue;let r=t();n(e,r),e.replace(r,!0)}}function Yy(e){let t=Xy(e);return t!==null&&t.writingMode===`vertical-rl`}function Xy(e){let t=e.anchor.getNode();return I(t)?Ry(t):zy(t)}function Zy(e,t){let n=Yy(e)?!t:t;$y(e)&&(n=!n);let r=Eu(e.focus,n?`previous`:`next`);if(Lu(r))return!1;if(R_(r)&&!ed(r.origin)&&r.origin.isUnmergeable()){let e=r.getNodeAtCaret();if(R(e)&&!ed(e))return!0}for(let e of ev(r)){if(B_(e))return!e.origin.isInline();if(!I(e.origin)){if(L(e.origin))return!0;break}}return!1}function Qy(e,t,n,r){e.modify(t?`extend`:`move`,n,r)}function $y(e){let t=Xy(e);return t!==null&&t.direction===`rtl`}function eb(e,t,n){let r=$y(e),i;i=Yy(e)||r?!n:n,Qy(e,t,i,`character`)}function tb(e,t,n){let r=iu(e.getStyle());return r!==null&&r[t]||n}function nb(e,t,n=``){let r=null,i=e.getNodes(),a,o;if(q(e)){if(e.isCollapsed()&&e.style!==``){let n=iu(e.style);if(n!==null&&t in n)return n[t]}let{anchor:n,focus:r}=e,i=e.isBackward(),s=i?r.getNode():n.getNode(),c=i?n.getNode():r.getNode(),l=i?r.offset:n.offset,u=i?n.offset:r.offset;R(s)&&l===s.getTextContentSize()&&(a=s),u===0&&(o=c)}for(let e=0;e<i.length;e++){let s=i[e];if(R(s)&&!s.is(e===0?a:o)){let e=tb(s,t,n);if(r===null)r=e;else if(r!==e){r=``;break}}}return r===null?n:r}function rb(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return 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.`)}(e,...t)}function ib(e,t){let n=e.ownerDocument,r=n.defaultView||window,i=r.getComputedStyle(e),a=i.position===`absolute`,o=t?/(auto|scroll|hidden)/:/(auto|scroll)/;if(i.position===`fixed`)return n.body;for(let t=e;t=rf(t);)if(i=r.getComputedStyle(t),(!a||i.position!==`static`)&&o.test(i.overflow+i.overflowY+i.overflowX))return t;return n.body}function ab(e,t){return Array.from(ob(e,t))}function ob(e,t){return cb(`next`,e,t)}function sb(e,t){let n=Bu(Y(e,t));return n&&n[0]}function cb(e,t,n){let r=V(),i=t||r,a=I(i)?q_(i,e):Y(i,e),o=lb(i),s=n?Y_(J_(Y(n,e)))||sb(n,e):sb(i,e),c=o;return rv({hasNext:e=>e!==null,initial:a,map:e=>({depth:c,node:e.origin}),step:e=>{if(e.isSameNodeCaret(s))return null;B_(e)&&c++;let t=Bu(e);return!t||t[0].isSameNodeCaret(s)?null:(c+=t[1],t[0])}})}function lb(e){let t=-1;for(let n=e;n!==null;n=n.getParent()??p_(n))t++;return t}function ub(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function db(e){let t=G(e,e=>I(e)&&!e.isInline());return I(t)||rb(4,e.__key),t}function fb(e){let t=J()||Rg(),n;if(q(t))n=Eu(t.focus,`next`);else{if(t!=null){let e=t.getNodes(),r=e[e.length-1];r&&(n=Y(r,`next`))}n||=q_(V(),`previous`).getFlipped().insert(z())}let r=Ku(e,n,Lu(i=n)||Bu(R_(i)?i.getSiblingCaret():i,`shadowRoot`)!==null?{$shouldSplit:(e,t)=>t!==`last`}:void 0);var i;let a=Y_(r);return Ou(tv(B_(a)?Iu(a):r)),e.getLatest()}function pb(e,t){if(e==null)return!1;let n=Object.getPrototypeOf(e);return n!=null&&n.constructor!=null&&n.constructor.name===t.name}function mb(e){let t=null;if(pb(e,DragEvent)?t=e.dataTransfer:pb(e,ClipboardEvent)&&(t=e.clipboardData),t===null)return[!1,[],!1];let n=t.types,r=n.includes(`Files`),i=n.includes(`text/html`)||n.includes(`text/plain`);return[r,Array.from(t.files),i]}function hb(e){let t=J();if(!q(t))return!1;let n=new Set,r=t.getNodes();for(let t=0;t<r.length;t++){let i=r[t],a=i.getKey();if(n.has(a))continue;let o=G(i,e=>I(e)&&!e.isInline());if(o===null)continue;let s=o.getKey();o.canIndent()&&!n.has(s)&&(n.add(s),e(o))}return n.size>0}function gb(e,t){q_(e,`next`).insert(t)}var _b=!(wa||!va)&&void 0;function vb(e,t=!1){let n=1;if(function(){if(_b===void 0){let e=document.createElement(`div`);e.style.position=`absolute`,e.style.opacity=`0`,e.style.width=`100px`,e.style.left=`-1000px`,document.body.appendChild(e);let t=e.getBoundingClientRect();e.style.setProperty(`zoom`,`2`),_b=e.getBoundingClientRect().width===t.width,document.body.removeChild(e)}return _b}()||t){let t=e&&e.ownerDocument.defaultView||window;for(;e;)n*=Number(t.getComputedStyle(e).getPropertyValue(`zoom`)),e=rf(e)}return n}function yb(e,t){return bb(e,t,null)}function bb(e,t,n){let r=!1;for(let i of Sb(e))t(i)?n!==null&&n(i):(r=!0,I(i)&&bb(i,t,n||(e=>i.insertAfter(e))),i.remove());return r}function xb(e,t){let n=[],r=Array.from(e).reverse();for(let e=r.pop();e!==void 0;e=r.pop())if(t(e))n.push(e);else if(I(e))for(let t of Sb(e))r.push(t);return n}function Sb(e){return Cb(q_(e,`previous`))}function Cb(e){return rv({hasNext:z_,initial:e.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}function wb(e,t){return qy(e,t,`previous`)}function Tb(e,t){return qy(e,t,`next`)}function Eb(e){return Fy(qf(),e)}function Db(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return 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.`)}(e,...t)}function Ob(e){if(!_d(e))return;let t=e;if(t.querySelector(`style`)===null)return;let n=new Map;function r(e){let t=n.get(e);if(t===void 0){t=new Set;for(let n=0;n<e.style.length;n++)t.add(e.style[n]);n.set(e,t)}return t}try{for(let e of Array.from(t.styleSheets)){let n;try{n=e.cssRules}catch{continue}for(let e of Array.from(n)){if(!pb(e,CSSStyleRule))continue;let n;try{n=t.querySelectorAll(e.selectorText)}catch{continue}for(let t of Array.from(n)){if(!W(t))continue;let n=r(t);for(let r=0;r<e.style.length;r++){let i=e.style[r];n.has(i)||t.style.setProperty(i,e.style.getPropertyValue(i),e.style.getPropertyPriority(i))}}}}}catch{}}var kb;function Ab(e,t){let{key:n}=t;return e&&n in e?e[n]:t.defaultValue}function jb(e){return kb&&kb.editor===e?kb:void 0}function Mb(e,t){if(`cfg`in t){let{cfg:n,updater:r}=t;return[n,r(Ab(e,n))]}return t}function Nb(e,t){let n=t;for(let r of e){let[e,i]=Mb(n,r),a=e.key;if(n===t&&Ab(n,e)===i)continue;let o=n===t||n===void 0?Pb(t):n;o[a]=i,n=o}return n}function Pb(e){return Object.create(e||null)}function Fb(e,t){return[e,t]}function Ib(e,t,n,r=qf()){let i=kb,a=jb(r);try{return kb={...a,editor:r,[e]:t},n()}finally{kb=i}}function Lb(e,t=()=>{}){return(n,r=qf())=>i=>{let a=jb(r),o=a&&a[e],s=Nb(n,o||t(r));return s&&s!==o?Ib(e,s,i,r):i()}}function Rb(e,t,n,r){return Object.assign(cc(Symbol(t),{isEqual:r,parse:n}),{[e]:!0})}var zb=`@lexical/html/DOM`,Bb=Symbol.for(`@lexical/html/DOMExportContext`);function Vb(e,t,n){return Rb(Bb,e,t,n)}var Hb=Vb(`isExport`,Boolean);function Ub(e){let t=Fy(e,zb);return t?t.output.defaults:void 0}function Wb(e){let t=Fy(e,zb);return t?t.output.runtime:void 0}function Gb(e=qf()){let t=Wb(e);return t?t.getSessionConfig():Jf(e)}var Kb=Lb(Bb,Ub),qb=new Set([`STYLE`,`SCRIPT`]);function Jb(e,t){Ob(t);let n=_d(t)?t.body.childNodes:t.childNodes,r=[],i=[];for(let t of n)if(!qb.has(t.nodeName)){let n=Qb(t,e,i,!1);if(n!==null)for(let e of n)r.push(e)}return function(e){for(let t of e)t.getParent()&&t.getNextSibling()instanceof im&&t.insertAfter(sm());for(let t of e){let e=t.getParent();e&&e.splice(t.getIndexWithinParent(),1,t.getChildren())}}(i),r}function Yb(e,t=null,n=qf()){return Kb([Fb(Hb,!0)],n)(()=>{let r=V(),i=Gb(n),a=g_(t),o=e.append.bind(e);for(let e of(I(a)?a:r).getChildren())Zb(n,e,o,t,i);return e})}function Xb(e,t=null){return(typeof document>`u`||typeof window>`u`&&global.window===void 0)&&Db(338),Fm(e),Yb(kf().createElement(`div`),t,e).innerHTML}function Zb(e,t,n,r=null,i=Jf(e)){let a=i.$shouldInclude(t,r,e),o=i.$shouldExclude(t,r,e),s=t;r!==null&&R(t)&&(s=Vy(r,t,`clone`));let{element:c,after:l,append:u,$getChildNodes:d}=i.$exportDOM(s,e);if(!c)return!1;let f=kf().createDocumentFragment(),p=d?d():I(s)?s.getChildren():[],m=a&&cg(r)&&I(t)?null:r,h=f.append.bind(f),g=null;for(let n of p){let o=Zb(e,n,h,m,i);o&&(g=n),!a&&o&&i.$extractWithChild(t,n,r,`html`,e)&&(a=!0)}if(a&&!o){if((W(c)||Vf(c))&&(u?u(f):c.append(f),function(e,t){let n=e.lastChild;if(cm(t)&&W(e)&&Gf(e)&&n!==null&&n.nodeName===`BR`){let t=kf().createElement(`br`);t.setAttribute(`data-lexical-managed-linebreak`,`true`),e.append(t)}}(c,g)),Vf(c)){if(l){let e=l.call(s,c);e&&c.replaceChildren(e)}n(c)}else if(n(c),l){let e=l.call(s,c);e&&c.replaceWith(e)}}else n(f);return a}function Qb(e,t,n,r,i=new Map,a){let o=[];if(qb.has(e.nodeName))return o;let s=null,c=function(e,t){let{nodeName:n}=e,r=t._htmlConversions.get(n.toLowerCase()),i=null;if(r!==void 0)for(let t of r){let n=t(e);n!==null&&(i===null||(i.priority||0)<=(n.priority||0))&&(i=n)}return i===null?null:i.conversion}(e,t),l=c?c(e):null,u=null;if(l!==null){u=l.after;let t=l.node;if(s=Array.isArray(t)?t[t.length-1]:t,s!==null){for(let[,e]of i)if(s=e(s,a),!s)break;s&&o.push(...Array.isArray(t)?t:[s])}l.forChild!=null&&i.set(e.nodeName,l.forChild)}let d=e.childNodes,f=[],p=(s==null||!U(s))&&(s!=null&&Ag(s)||r);for(let e=0;e<d.length;e++)f.push(...Qb(d[e],t,n,p,new Map(i),s));if(u!=null&&(f=u(f)),Gf(e)&&(f=function(e,t,n){let r=e.style.textAlign,i=[],a=[];for(let e=0;e<t.length;e++){let o=t[e];if(Ag(o))r&&!o.getFormat()&&o.setFormat(r),i.push(o);else if(a.push(o),e===t.length-1||e<t.length-1&&Ag(t[e+1])){let e=n();e.setFormat(r),e.append(...a),i.push(e),a=[]}}return i}(e,f,p?()=>{let e=new im;return n.push(e),e}:z)),s==null){if(f.length>0)for(let e of f)o.push(e);else Gf(e)&&function(e){return e.nextSibling!=null&&e.previousSibling!=null&&Uf(e.nextSibling)&&Uf(e.previousSibling)}(e)&&o.push(sm())}else I(s)&&s.append(...f);return o}function $b(e,t,n=null){let r=Of(n),i=n?Ef(n):[],a=n!==null&&i.length>0;if(a&&typeof r.caretPositionFromPoint==`function`){let a=r.caretPositionFromPoint(e,t,{shadowRoots:i});if(a!==null&&function(e,t){for(let n=e;n!==null;){if(n===t)return!0;n=rf(n)}return!1}(a.offsetNode,n))return{node:a.offsetNode,offset:a.offset}}if(a){let i=n.getRootNode();if(wf(i)){let a=i.elementFromPoint(e,t);if(a!==null&&n.contains(a)){let n=function(e,t,n,r){let i=r.createRange(),a=e=>t<e.top?e.top-t:t>e.bottom?t-e.bottom:0,o=t=>e<t.left?t.left-e:e>t.right?e-t.right:0,s=r.createTreeWalker(n,NodeFilter.SHOW_TEXT),c=null,l=1/0,u=1/0;for(let e=s.nextNode();e;e=s.nextNode()){i.selectNodeContents(e);for(let t of i.getClientRects()){let n=a(t),r=o(t);(n<l||n===l&&r<u)&&(l=n,u=r,c=e)}}if(c===null)return null;let d=0,f=1/0,p=1/0;for(let t=0;t<=c.length;t++){i.setStart(c,t),i.collapse(!0);let n=i.getBoundingClientRect(),r=a(n),o=Math.abs(e-n.left);(r<f||r===f&&o<p)&&(f=r,p=o,d=t)}return{node:c,offset:d}}(e,t,a,r);if(n!==null)return n}}}if(typeof r.caretRangeFromPoint==`function`){let n=r.caretRangeFromPoint(e,t);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(typeof r.caretPositionFromPoint==`function`){let n=r.caretPositionFromPoint(e,t);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}function ex(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return 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.`)}(e,...t)}var tx={"application/x-lexical-editor":0,"text/html":10,"text/plain":20,"text/uri-list":30};function nx(e){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy(`lexical`,{createHTML:e=>e}).createHTML(e):e}var rx=(e,t)=>{if(!q(t))return t.insertRawText(e),!0;t!==J()&&Fd(t);let n=e=>{let t=J();q(t)&&e(t)};return qg(e,{linebreak:()=>n(e=>e.insertParagraph()),tab:()=>n(e=>e.insertNodes([$u()])),text:e=>n(t=>t.insertText(e))}),!0},ix={"application/x-lexical-editor":[(e,t,n)=>{try{let n=qf(),r=JSON.parse(e);if(r&&r.namespace===n._config.namespace&&Array.isArray(r.nodes))return _x(n,bx(r.nodes),t),!0}catch(e){console.error(e)}return n()}],"text/html":[(e,t,n)=>{try{let n=qf();return _x(n,Jb(n,new DOMParser().parseFromString(nx(e),`text/html`)),t),!0}catch(e){return console.error(e),n()}}],"text/plain":[rx],"text/uri-list":[rx]};function ax(e,t,n,r){if(!e)return!1;let i=(t,n,a)=>!!e[t]&&e[t](n,a,(e=n,r=a)=>i(t-1,e,r),r);return i(e.length-1,t,n)}function ox(e,t,n){let r=t.getData(`text/plain`);for(let i of function(e){return Object.keys(e.$importMimeType).filter(t=>e.$importMimeType[t]!==void 0).sort((t,n)=>{let r=e.priority[t],i=e.priority[n];return r===void 0&&i===void 0?t<n?-1:+(t>n):r===void 0?1:i===void 0?-1:r-i})}(e)){let a=t.getData(i);if(a&&(i!==`text/html`||a!==r)&&ax(e.$importMimeType[i],a,n,t))return!0}return!1}var sx={$importMimeType:ix,$insertDataTransfer:(e,t)=>ox({$importMimeType:ix,priority:tx},e,t),priority:tx},cx={build:(e,t)=>({$importMimeType:t.$importMimeType,$insertDataTransfer:(e,n)=>ox(t,e,n),priority:t.priority}),config:{$importMimeType:ix,priority:tx},mergeConfig(e,t){let n=dv(e,t);if(t.$importMimeType){let r={...e.$importMimeType};for(let[e,n]of Object.entries(t.$importMimeType))if(n){let t=r[e];r[e]=t?[...t,...n]:n}n.$importMimeType=r}return t.priority&&(n.priority={...e.priority,...t.priority}),n},name:`@lexical/clipboard/Import`};function lx(e,t=J()){return t??ex(166),q(t)&&t.isCollapsed()||t.getNodes().length===0?``:Xb(e,t)}function ux(e,t=J()){return t??ex(166),q(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(yx(e,t))}function dx(e,t,n){(function(){let e=Eb(cx.name);return e?e.output:sx})().$insertDataTransfer(e,t)}var fx=`application/x-lexical-drag`;function px(e,t){let n={editorKey:t.getKey()};e.setData(fx,JSON.stringify(n))}function mx(e){let t=e;if(R_(t)){if(t.offset===0)t=ju(t.getSiblingCaret());else{if(t.offset!==t.origin.getTextContentSize())return t;t=t.getSiblingCaret()}}for(;;){let e=t.getParentAtCaret();if(e===null||!e.isInline()||e.isShadowRoot())return t;if(B_(t))t=ju(Y(e,`next`));else{if(t.getNodeAtCaret()!==null)return t;t=Y(e,`next`)}}}function hx(e,t,n){let r=e.dataTransfer;if(r===null)return!1;let i=function(e){let t=e.getData(fx);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}return(r=n)!==null&&typeof r==`object`&&`editorKey`in r&&typeof r.editorKey==`string`?n:null;var r}(r);if(i===null)return!1;let a=function(e,t){let n=$b(e.clientX,e.clientY,t.getRootElement());if(n===null)return null;let r=Ad(n.node);if(r===null)return null;if(R(r))return W_(r,`next`,n.offset);let i=r.getParent();if(I(r)){let e=t.getElementByKey(r.getKey());if(e===null)return null;let a=Yf(r,e,t);return n.node===a.element||i?zu(...a.resolveChildIndex(r,e,n.node,n.offset),`next`):null}return i&&zu(i,r.getIndexWithinParent()+1,`next`)}(e,t);if(a===null)return!1;let o=i.editorKey===t.getKey(),s=J();if(o){if(!q(s)||s.isCollapsed())return!1;if(function(e,t){let{anchor:n,focus:r}=Ru(Au(t),`next`),i=mx(e);return iv(mx(n),i)<=0&&iv(i,mx(r))<=0}(a,s))return e.preventDefault(),!0}let c=Iu(a),l=R_(c)?Gu(c):c;if(l===null)return!1;let u=l.getFlipped();o&&q(s)&&s.removeText();let d=l.origin.isAttached()?l:u;if(d.origin.isAttached()||ex(438),n(r,Ou(tv(d)),t),!o){let e=t.getRootElement(),n=e?e.ownerDocument:null,r=n?function(e,t){for(let n of Df(t)){let t=pd(n);if(dd(t)&&t.getKey()===e&&W(n))return n}return null}(i.editorKey,n):null;r!==null&&r.dispatchEvent(new InputEvent(`beforeinput`,{bubbles:!0,cancelable:!0,inputType:`deleteByDrag`}))}return e.preventDefault(),!0}function gx(e,t){return hx(e,t,dx)}function _x(e,t,n){e.dispatchCommand(Xa,{nodes:t,selection:n})||(n.insertNodes(t),function(e){if(q(e)&&e.isCollapsed()){let t=e.anchor,n=null,r=Eu(t,`previous`);if(r){if(R_(r))n=r.origin;else{let e=nv(r,q_(V(),`next`).getFlipped());for(let t of e){if(R(t.origin)){n=t.origin;break}if(I(t.origin)&&!t.origin.isInline())break}}}if(n&&R(n)){let t=n.getFormat(),r=n.getStyle();e.format===t&&e.style===r||(e.format=t,e.style=r,e.dirty=!0)}}}(n))}function vx(e,t,n,r=[]){let i=t===null||n.isSelected(t),a=I(n)&&n.excludeFromCopy(`clone`),o=n;t!==null&&R(o)&&(o=Vy(t,o,`clone`));let s=ls(o),c=I(o)?o.getChildren():[],l=s.children||[];R(o)&&o.getTextContentSize()===0&&(i=!1);let u=i&&cg(t)&&I(n)?null:t;for(let r=0;r<c.length;r++){let a=c[r],o=vx(e,u,a,l);!i&&I(n)&&o&&n.extractWithChild(a,t,`clone`)&&(i=!0)}if(i&&!a){let t=v_(o);if(t.length>0){let n={};for(let r of t){let t=y_(o,r);t===null&&ex(366,o.constructor.name,r);let i=[];vx(e,null,t,i),(i.length!==1||I(t)&&t.excludeFromCopy(`clone`))&&ex(435,r,o.constructor.name,String(i.length)),n[r]=i[0]}s.$slots=n}}if(i&&!a)r.push(s);else for(let e=0;e<l.length;e++)r.push(l[e]);return i}function yx(e,t){let n=[],r=V(),i=g_(t),a=(I(i)?i:r).getChildren();for(let r=0;r<a.length;r++)vx(e,t,a[r],n);return{namespace:e._config.namespace,nodes:n}}function bx(e){let t=[];for(let n of e)t.push(Hm(n));return t}var xx=null;async function Sx(e,t,n){if(xx!==null)return!1;if(t!==null)return new Promise((r,i)=>{e.update(()=>{r(Cx(e,t,n))})});let r=e.getRootElement(),i=e._window||window,a=i.document,o=Sf(i);if(r===null||o===null)return!1;let s=a.createElement(`span`);s.style.position=`fixed`,s.style.top=`-1000px`,s.append(a.createTextNode(`#`)),r.append(s);let c=a.createRange();return c.setStart(s,0),c.setEnd(s,1),o.removeAllRanges(),o.addRange(c),new Promise((t,r)=>{let o=e.registerCommand(Io,r=>(pb(r,ClipboardEvent)&&(o(),xx!==null&&(i.clearTimeout(xx),xx=null),t(Cx(e,r,n))),!0),4);xx=i.setTimeout(()=>{o(),xx=null,t(!1)},50),a.execCommand(`copy`),s.remove()})}function Cx(e,t,n){if(n===void 0){let t=Sf(e._window),r=J();if(!r||r.isCollapsed()||!t)return!1;let i=Mf(t,e.getRootElement()),a=i.anchorNode,o=i.focusNode;if(a!==null&&o!==null&&!ud(e,a,o))return!1;n=Tx(r)}t.preventDefault();let r=t.clipboardData;return r!==null&&(Ex(r,n),!0)}var wx=[[`text/html`,lx],[`application/x-lexical-editor`,ux]];function Tx(e=J()){return function(e,t){let n={"text/plain":``};for(let[r,i]of Object.entries(e))if(i){let e=kx(i,t);e!==null&&(n[r]=e)}return n}(Dx(),e)}function Ex(e,t){for(let[n]of wx)t[n]===void 0&&e.setData(n,``);for(let n in t){let r=t[n];r!==void 0&&e.setData(n,r)}}function Dx(e=qf()){let t=Fy(e,Ax.name);return t?t.output:Ox}var Ox={"application/x-lexical-editor":[(e,t)=>e?ux(qf(),e):t()],"text/html":[(e,t)=>e?lx(qf(),e):t()],"text/plain":[(e,t)=>e?e.getTextContent():t()]};function kx(e,t){let n=r=>e[r]?e[r](t,n.bind(null,r-1)):null;return n(e.length-1)}var Ax={build:(e,t,n)=>t.$exportMimeType,config:{$exportMimeType:Ox},mergeConfig(e,t){let n=dv(e,t);if(t.$exportMimeType){let r={...e.$exportMimeType};for(let[e,n]of Object.entries(t.$exportMimeType))if(n){let t=r[e];r[e]=t?[...t,...n]:n}n.$exportMimeType=r}return n},name:`@lexical/clipboard/GetClipboardData`},jx=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function Mx(e,t){if(typeof e==`number`)return Number.isFinite(e)?e:t;if(typeof e!=`string`||!jx.test(e))return t;let n=Number(e);return Number.isFinite(n)?n:t}function Nx(e,t,n,r,i){let a=Mx(e,t);return a>=n&&a<=r&&Number.isInteger(a)?a:t}function Px(e,t){e.__tag=t.__tag}var Fx=e=>{let t=Ms(e,`format`),n=Ns(e,`format`),r=Fs(e,`format`);return{exportJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles();return{children:[],tag:e.__tag,direction:e.__dir,format:t[e.__format],indent:e.__indent,textFormat:n!==0&&i?n:void 0,textStyle:r!==``&&i?r:void 0,type:e.__type,version:1}},exportCompactJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles(),a={type:e.__type,children:[]},o=e.__tag;o!==void 0&&o!==`h1`&&(a.tag=o);let s=e.__dir;s!=null&&(a.direction=s);let c=t[e.__format];c!==void 0&&c!==``&&(a.format=c);let l=e.__indent;return l!==void 0&&l!==0&&(a.indent=l),n!==void 0&&n!==0&&i&&(a.textFormat=n),r!==void 0&&r!==``&&i&&(a.textStyle=r),a},updateFromJSON:function(e,t){let i=t.direction;e.__dir=i===null||i===`ltr`||i===`rtl`?i:null;let a=t.format;e.__format=typeof a==`string`&&a in n?n[a]:r,e.__indent=Nx(t.indent,0,0,1/0),e.__textFormat=Mx(t.textFormat,0);let o=t.textStyle;e.__textStyle=typeof o==`string`?o:``;let s=t.tag;return e.__tag=s===`h1`||s===`h2`||s===`h3`||s===`h4`||s===`h5`||s===`h6`?s:`h1`,e},afterCloneFrom:Px}},Ix=e=>{let t=Ms(e,`format`),n=Ns(e,`format`),r=Fs(e,`format`);return{exportJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles();return{children:[],direction:e.__dir,format:t[e.__format],indent:e.__indent,textFormat:n!==0&&i?n:void 0,textStyle:r!==``&&i?r:void 0,type:e.__type,version:1}},exportCompactJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles(),a={type:e.__type,children:[]},o=e.__dir;o!=null&&(a.direction=o);let s=t[e.__format];s!==void 0&&s!==``&&(a.format=s);let c=e.__indent;return c!==void 0&&c!==0&&(a.indent=c),n!==void 0&&n!==0&&i&&(a.textFormat=n),r!==void 0&&r!==``&&i&&(a.textStyle=r),a},updateFromJSON:function(e,t){let i=t.direction;e.__dir=i===null||i===`ltr`||i===`rtl`?i:null;let a=t.format;e.__format=typeof a==`string`&&a in n?n[a]:r,e.__indent=Nx(t.indent,0,0,1/0),e.__textFormat=Mx(t.textFormat,0);let o=t.textStyle;return e.__textStyle=typeof o==`string`?o:``,e}}},Lx=N(`DRAG_DROP_PASTE_FILE`),Rx=cc(`shadowRoot`,{parse:Xs()}),zx=class extends Ql{$config(){return this.config(`quote`,{children:`inline`,extends:Ql,generated:Ix,importDOM:{blockquote:()=>({conversion:Kx,priority:0})},stateConfigs:[{flat:!0,stateConfig:Rx}]})}isShadowRoot(){return lc(this,Rx)}setIsShadowRoot(e){return uc(this,Rx,e)}createDOM(e){let t=kf().createElement(`blockquote`);return pv(t,e.theme.quote),t}updateDOM(e,t,n){return!1}exportDOM(e){let{element:t}=super.exportDOM(e);if(W(t)){this.isEmpty()&&t.append(kf().createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e);let n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return Bx().updateFromJSON(e)}insertNewAfter(e,t){let n=z();n.setTextFormat(e.format),n.setTextStyle(e.style);let r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}collapseAtStart(){if(this.isShadowRoot()){for(let e of this.getChildren())this.insertBefore(e);return this.remove(),!0}let e=z();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function Bx(e){let t=_f(new zx);return e&&e.shadowRoot?t.setIsShadowRoot(!0):t}function Vx(e){return e instanceof zx}var Hx=ec()({tag:rc(Zs([`h1`,`h2`,`h3`,`h4`,`h5`,`h6`]),{field:`__tag`})}),Ux=class extends Ql{__tag;$config(){return this.config(`heading`,{children:`inline`,extends:Ql,generated:Fx,importDOM:{h1:()=>({conversion:Gx,priority:0}),h2:()=>({conversion:Gx,priority:0}),h3:()=>({conversion:Gx,priority:0}),h4:()=>({conversion:Gx,priority:0}),h5:()=>({conversion:Gx,priority:0}),h6:()=>({conversion:Gx,priority:0}),p:e=>{let t=e.firstChild;return t!==null&&Wx(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Wx(e)?{conversion:()=>({node:qx(`h1`)}),priority:3}:null},json:Hx})}constructor(e=`h1`,t){super(t),this.__tag=e}getTag(){return this.getLatest().__tag}setTag(e){let t=this.getWritable();return t.__tag=e,t}createDOM(e){let t=this.__tag,n=kf().createElement(t),r=e.theme.heading;if(r!==void 0){let e=r[t];pv(n,e)}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}exportDOM(e){let{element:t}=super.exportDOM(e);if(W(t)){this.isEmpty()&&t.append(kf().createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e);let n=this.getDirection();n&&(t.dir=n)}return{element:t}}insertNewAfter(e,t=!0){let n=!this.getLastDescendant()||e&&Tb(e.anchor,this),r=e&&wb(e.anchor,this),i=n||!e?z():qx(this.getTag()).setFormat(this.getFormatType()).setStyle(this.getStyle()),a=this.getDirection();if(i.setDirection(a),this.insertAfter(i,t),r&&!this.isEmpty()){let e=z();e.select(),this.replace(e,!0)}return i}collapseAtStart(){if(this.isEmpty()){let e=z();this.getChildren().forEach(t=>e.append(t)),this.replace(e)}return!0}extractWithChild(){return!0}};function Wx(e){return e.nodeName.toLowerCase()===`span`&&e.style.fontSize===`26pt`}function Gx(e){let t=e.nodeName.toLowerCase(),n=null;return t!==`h1`&&t!==`h2`&&t!==`h3`&&t!==`h4`&&t!==`h5`&&t!==`h6`||(n=qx(t),rp(e,n),ap(n,e),ip(n,e)),{node:n}}function Kx(e){let t=Bx();return ap(t,e),rp(e,t),ip(t,e),{node:t}}function qx(e=`h1`){return _f(new Ux(e))}function Jx(e){return e instanceof Ux}function Yx(e){return L(Ad(e))&&!(W(e)&&e.hasAttribute(`data-lexical-slot`))}function Xx(e){let t=e.focus;return t.key===`root`&&t.offset===V().getChildrenSize()}function Zx(e){let t=e.focus;return t.key===`root`&&t.offset===0}function Qx(e,t){if(!e.isCollapsed())return!1;let n=t===`next`;if(!(n?Xx(e):Zx(e)))return!1;let r=e.focus.offset;return bf(V().getChildAtIndex(n?r-1:r))}function $x(e,t,n,r){let i=!1,a=null;if(e.isCollapsed()&&e.anchor.type===`text`){let t=e.anchor.getNode();if(R(t)){a=t;let r=e.anchor.offset,o=r===t.getTextContentSize()&&t.getNextSibling()===null,s=r===0&&t.getPreviousSibling()===null;i=n===`end`&&o||n===`start`&&s||n===`both`&&(o||s)}}let o=!1;for(let[n,s]of Object.entries(r)){if(s==null||!s[t])continue;let r=n;if(s.onlyAtBoundary){if(!(i&&a&&R(a)&&a.hasFormat(r)))continue;o=!0}e.hasFormat(r)&&e.toggleFormat(r)}o&&e.setStyle(``)}var eS={capitalize:{enter:!0,space:!0,tab:!0},lowercase:{enter:!0,space:!0,tab:!0},uppercase:{enter:!0,space:!0,tab:!0}};function tS(e,t){return function(e,t){if(!e.isCollapsed())return!1;let n=Eu(e.focus,t),r=G(n.origin,hf);if(!r)return!1;let i=e.focus.getNode();if(!r.is(i)&&!uf(i,r))return!1;let a=nv(n,Y(r,t));if(a.getTextSlices().some(e=>e&&e.getTextContentSize()>0))return!1;let o=nv(a.anchor.getSiblingCaret(),a.focus),s=o.anchor.origin;for(let e of o){if(!z_(e)||!e.origin.is(s.getParent()))return!1;s=e.origin}let c=r;for(let e of ev(Y(r,t))){if(!e.origin.is(c.getParent())){if(bf(e.origin)){let e=Y(c,t);return Ou(nv(e,e)),!0}break}if(!hf(e.origin))break;c=e.origin}return!1}(e,t)||function(e,t){if(!e.isCollapsed()||e.anchor.type!==`element`)return!1;let n=Eu(e.anchor,t).getNodeAtCaret();return!(!hf(n)||n.isInline()||(Ou(tv(Iu(q_(n,t)))),0))}(e,t)}function nS(e){return L(e)&&!e.isInline()&&!e.isIsolated()&&e.isKeyboardSelectable()}function rS(e){let t=Ng();t.add(e),Fd(t)}function iS(e,t){if(!e.isCollapsed())return!1;let n=e.focus,r=n.getNode(),i=t?`previous`:`next`,a=Eu(n,i);if(n.type===`element`&&I(r)&&U(r)){let e=a.getNodeAtCaret();return!(e===null||!nS(e)||(rS(e.__key),0))}let o=G(I(r)?r:r.getParentOrThrow(),e=>I(e)&&!e.isInline()&&U(e.getParent()));if(o===null)return!1;let s=Y(o,i).getNodeAtCaret();if(s===null||!nS(s))return!1;if(o.getTextContentSize()===0)return rS(s.__key),!0;let c=qf().getRootElement();if(c===null)return!1;let l=Sf(c.ownerDocument.defaultView);if(l===null||l.rangeCount===0)return!1;let u=l.anchorNode,d=l.anchorOffset,f=l.focusNode,p=l.focusOffset;l.modify(`move`,t?`backward`:`forward`,`line`);let m=l.anchorNode,h=l.anchorOffset;if(m===null)return aS(l,u,d,f,p),!1;let g=Ad(m);return aS(l,u,d,f,p),g!==null&&(m===u&&h===d||!g.is(o)&&!uf(g,o))&&(rS(s.__key),!0)}function aS(e,t,n,r,i){t!==null&&r!==null&&e.setBaseAndExtent(t,n,r,i)}function oS(e,t){if(!e.isCollapsed())return!1;let n=e.focus.getNode(),r=G(I(n)?n:n.getParentOrThrow(),e=>I(e)&&!e.isInline());if(r===null)return!1;let i=qf(),a=i.getRootElement();if(a===null)return!1;let o=a.ownerDocument.defaultView;if(o===null)return!1;let s=!1;for(let e of r.getChildren())if(I(e)&&e.isInline()){let t=i.getElementByKey(e.getKey());if(t!==null){let e=o.getComputedStyle(t).display;if(e===`inline-grid`||e===`inline-flex`){s=!0;break}}}if(!s)return!1;let c=Y(r,t?`previous`:`next`).getNodeAtCaret();if(c===null||!I(c)){if(t){let e=r.getFirstDescendant();R(e)?e.select(0,0):r.select(0,0)}else{let e=r.getLastDescendant();if(R(e)){let t=e.getTextContentSize();e.select(t,t)}else{let e=r.getChildrenSize();r.select(e,e)}}return!0}let l=i.getElementByKey(c.getKey());if(l===null)return!1;let u=Sf(o);if(u===null||u.rangeCount===0)return!1;let d=u.getRangeAt(0).cloneRange();d.collapse(!0);let f=d.getBoundingClientRect(),p=l.getBoundingClientRect(),m=p.top+p.height/2;if(f.height>0){let t=$b(f.left,m,a);if(t!==null&&l.contains(t.node)){let n=a.ownerDocument.createRange();return n.setStart(t.node,t.offset),n.collapse(!0),e.applyDOMRange(n),e.dirty=!0,!0}}let h=t?c.getLastDescendant():c.getFirstDescendant();if(R(h)){let e=t?h.getTextContentSize():0;h.select(e,e)}else{let e=c.getChildrenSize();c.select(t?e:0,t?e:0)}return!0}function sS(e,t){let n=Y(e,t),r=n.getAdjacentCaret();r!==null&&I(r.origin)&&!r.origin.isInline()&&r.origin.isShadowRoot()?Ou(tv(n)):t===`next`?e.selectNext(0,0):e.selectPrevious()}function cS(e,t){let n=e.getNodes().map(e=>Y(e,`next`)).sort(iv),r=n[0],i=n[n.length-1];if(!r||!i)return!1;for(let e=0;e<n.length-1;e++)if(!n[e+1].origin.is(n[e].getNodeAtCaret()))return!1;return Ou(Ru(nv(ju(r),i),t)),Zm(),!0}function lS(e,t,n){n.preventDefault(),n.stopPropagation();let r=e.getNodes();if(r.length===0)return!0;let i=r.map(e=>Y(e,`next`)).sort(iv),a=(t?i[0]:i[i.length-1]).origin,o=G(a,e=>e!==a&&I(e)&&!e.isInline())??V(),s=t?0:o.getChildrenSize();return o.select(s,s),!0}function uS(e,t){return e.length>0&&!t}function dS(e,t=gy(eS),n=gy(uS)){return eh(e.registerCommand(Za,n=>{let r=J();if(cg(r)){let t=n.target;if(W(t))for(let n of r.getNodes()){let r=e.getElementByKey(n.getKey());if(r!==null&&r.contains(t))return!1}return r.clear(),!0}return q(r)&&$x(r,`click`,`both`,t.peek()),!1},0),e.registerCommand(no,e=>{let t=J();return q(t)?(t.deleteCharacter(e),!0):!!cg(t)&&(t.deleteNodes(),!0)},0),e.registerCommand(co,e=>{let t=J();return!!q(t)&&(t.deleteWord(e),!0)},0),e.registerCommand(lo,e=>{let t=J();return!!q(t)&&(t.deleteLine(e),!0)},0),e.registerCommand(ao,t=>{let n=J();if(typeof t==`string`)n!==null&&n.insertText(t);else{if(n===null)return!1;let r=t.dataTransfer;if(r!=null)dx(r,n,e);else if(q(n)){let e=t.data;return e&&n.insertText(e),!0}}return!0},0),e.registerCommand(so,()=>{let e=J();return!!q(e)&&(e.removeText(),!0)},0),e.registerCommand(uo,e=>{let t=J();return!(!q(t)&&!cg(t)||(fg(t,e),0))},0),e.registerCommand(fo,e=>{let t=J();return!(!q(t)&&!cg(t)||(dg(t,e),0))},0),e.registerCommand(Mo,e=>{let t=J();if(!q(t)&&!cg(t))return!1;let n=t.getNodes();for(let t of n){let n=G(t,e=>I(e)&&!e.isInline());n!==null&&n.setFormat(e)}return!0},0),e.registerCommand(ro,e=>{let t=J();return!!q(t)&&(t.insertLineBreak(e),!0)},0),e.registerCommand(io,()=>{let e=J();return!!q(e)&&(e.insertParagraph(),!0)},0),e.registerCommand(Oo,()=>{let e=$u(),t=J();return q(t)&&(e.setFormat(t.format),e.setStyle(t.style)),Kg([e]),!0},0),e.registerCommand(ko,()=>hb(e=>{let t=e.getIndent();e.setIndent(t+1)}),0),e.registerCommand(Ao,()=>hb(e=>{let t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}),0),e.registerCommand(bo,e=>{let t=J();if(cg(t)){let n=t.getNodes();if(n.length>0){if(!e.shiftKey||!cS(t,`previous`))return e.preventDefault(),sS(n[0],`previous`),!0;t=J()}}return q(t)&&(Zx(t)||!e.shiftKey&&tS(t,`previous`)||!e.shiftKey&&iS(t,!0)||!e.shiftKey&&oS(t,!0))?(e.preventDefault(),!0):!1},0),e.registerCommand(xo,e=>{let t=J();if(cg(t)){let n=t.getNodes();if(n.length>0){if(!e.shiftKey||!cS(t,`next`))return e.preventDefault(),sS(n[0],`next`),!0;t=J()}}return q(t)&&(Xx(t)||!e.shiftKey&&tS(t,`next`)||!e.shiftKey&&iS(t,!1)||!e.shiftKey&&oS(t,!1))?(e.preventDefault(),!0):!1},0),e.registerCommand(vo,e=>{let n=J();if(cg(n)){let t=n.getNodes();if(t.length>0){let r=By(t[0])?`next`:`previous`;if(!e.shiftKey||!cS(n,r))return e.preventDefault(),sS(t[0],r),!0;n=J()}}if(!q(n))return!1;let r=By(n.anchor.getNode())?`next`:`previous`;if(Qx(n,r)||!e.shiftKey&&tS(n,r))return e.preventDefault(),!0;if(e.shiftKey||$x(n,`arrow`,`start`,t.peek()),Zy(n,!0)){let t=e.shiftKey;return e.preventDefault(),eb(n,t,!0),!0}return!1},0),e.registerCommand(go,e=>{let n=J();if(cg(n)){let t=n.getNodes();if(t.length>0){let r=By(t[0])?`previous`:`next`;if(!e.shiftKey||!cS(n,r))return e.preventDefault(),sS(t[0],r),!0;n=J()}}if(!q(n))return!1;let r=By(n.anchor.getNode())?`previous`:`next`;if(Qx(n,r)||!e.shiftKey&&tS(n,r))return e.preventDefault(),!0;if(e.shiftKey||$x(n,`arrow`,`end`,t.peek()),Zy(n,!1)){let t=e.shiftKey;return e.preventDefault(),eb(n,t,!1),!0}return!1},0),e.registerCommand(wo,t=>{let n=J();if(!cg(n)&&Yx(t.target))return!1;if(q(n)){if(function(e){if(!e.isCollapsed())return!1;let{anchor:t}=e;if(t.offset!==0)return!1;let n=t.getNode();if(ru(n))return!1;let r=db(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(Ao);if(Oa&&Ea)return!1}else if(!cg(n))return!1;return t.preventDefault(),e.dispatchCommand(no,!0)},0),e.registerCommand(Eo,t=>{let n=J();return!(!cg(n)&&Yx(t.target))&&!(!q(n)&&!cg(n))&&(t.preventDefault(),e.dispatchCommand(no,!1))},0),e.registerCommand(So,n=>{let r=J();if(cg(r)){let e=r.getNodes();e.length===1&&L(e[0])&&!e[0].isInline()&&(r=e[0].selectNext())}if(!q(r))return!1;if($x(r,`enter`,`both`,t.peek()),n!==null){if((Oa||Aa||Na)&&Ea)return!1;if(n.preventDefault(),n.shiftKey)return e.dispatchCommand(ro,!1)}return e.dispatchCommand(io)},0),e.registerCommand(To,()=>!!q(J())&&(e.blur(),!0),0),e.registerCommand(jo,t=>{let[,n]=mb(t);if(n.length>0){let r=t.clientX,i=t.clientY,a=$b(r,i,e.getRootElement());if(a!==null){let{offset:e,node:t}=a,n=Ad(t);if(n!==null){let t=Mg();if(R(n))t.anchor.set(n.getKey(),e,`text`),t.focus.set(n.getKey(),e,`text`);else{let e=n.getParentOrThrow().getKey(),r=n.getIndexWithinParent()+1;t.anchor.set(e,r,`element`),t.focus.set(e,r,`element`)}Fd(kl(t))}}return!(!e.dispatchCommand(Lx,n)&&Oa&&n.every(e=>e.type===`text/plain`)||(t.preventDefault(),0))}return gx(t,e)},0),e.registerCommand(No,t=>{let[n]=mb(t),r=J();return!(n&&!q(r)||(q(r)&&!r.isCollapsed()&&t.dataTransfer!==null&&(Ex(t.dataTransfer,Tx(r)),px(t.dataTransfer,e)),0))},0),e.registerCommand(Po,t=>{let[n]=mb(t),r=J();if(n&&!q(r))return!1;let i=t.clientX,a=t.clientY,o=$b(i,a,e.getRootElement());return o!==null&&L(Ad(o.node))&&t.preventDefault(),!0},0),e.registerCommand(Ro,()=>{let e=J();return Jd(q(e)&&h_(e.anchor.getNode())!==null?e:null),!0},0),e.registerCommand(Io,t=>!ld(t)&&(Sx(e,pb(t,ClipboardEvent)?t:null),!0),0),e.registerCommand(Lo,t=>!ld(t)&&(async function(e,t){t.update(()=>{let e=J();q(e)&&!e.isCollapsed()&&pg(e)},{discrete:!0,tag:`cut`}),await Sx(t,pb(e,ClipboardEvent)?e:null),t.update(()=>{let e=J();q(e)?e.removeText():cg(e)&&e.getNodes().forEach(e=>e.remove())},{tag:`cut`})}(t,e),!0),0),e.registerCommand(oo,t=>{let[,r,i]=mb(t);return!(!n.peek()(r,i)||!e.dispatchCommand(Lx,r))||!ld(t)&&J()!==null&&(function(e,t){e.preventDefault(),t.update(()=>{let n=J(),r=pb(e,InputEvent)||pb(e,KeyboardEvent)?null:e.clipboardData;r!=null&&n!==null&&dx(r,n,t)},{tag:`paste`})}(t,e),!0)},0),e.registerCommand(Co,()=>{let e=J();return q(e)&&$x(e,`space`,`both`,t.peek()),!1},0),e.registerCommand(Do,()=>{let e=J();return q(e)&&$x(e,`tab`,`both`,t.peek()),!1},0),e.registerCommand(_o,e=>{let t=J();if(cg(t))return lS(t,!1,e);if(!q(t))return!1;let{anchor:n}=t;if(n.type!==`element`||n.offset!==0)return!1;let r=n.getNode();if(!I(r))return!1;let i=r.getFirstChild();if(!L(i)||!i.isInline())return!1;let a=r.getKey(),o=r.selectEnd();return e.shiftKey&&o.anchor.set(a,0,`element`),e.preventDefault(),e.stopPropagation(),!0},0),e.registerCommand(yo,e=>{let t=J();if(cg(t))return lS(t,!0,e);if(!q(t))return!1;let{anchor:n,focus:r}=t,i=G(r.getNode(),e=>I(e)&&!e.isInline());if(i===null)return!1;let a=i.getFirstChild();if(!L(a)||!a.isInline()||G(n.getNode(),e=>I(e)&&!e.isInline())!==i)return!1;let o=i.getKey();return(r.type!==`element`||r.key!==o||r.offset!==0)&&(t.focus.set(o,0,`element`),e.shiftKey||t.anchor.set(o,0,`element`),e.preventDefault(),e.stopPropagation(),!0)},0))}function fS(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return 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.`)}(e,...t)}function pS({editor:e,ErrorBoundary:t}){return function(e,t){let[n,r]=(0,A.useMemo)(()=>[t=>e.registerDecoratorListener(t),()=>e.getDecorators()],[e]),i=(0,A.useSyncExternalStore)(n,r,r),a=function(e){let[t,n]=(0,A.useMemo)(()=>[e.registerRootListener.bind(e),e.getRootElement.bind(e)],[e]);return(0,A.useSyncExternalStore)(t,n,n)}(e);return(0,A.useMemo)(()=>{let n=t=>e._onError(t),r=[];for(let a in i){let o=e.getElementByKey(a);if(o!==null){let e=(0,j.jsx)(t,{onError:n,children:(0,j.jsx)(A.Suspense,{fallback:null,children:i[a]})});r.push((0,li.createPortal)(e,o,a))}}return r},[t,i,e,a])}(e,t)}function mS({editor:e,ErrorBoundary:t}){return function(e){let t=ty.maybeFromEditor(e);if(t&&t.hasExtensionByName(ny.name)){for(let e of[`@lexical/plain-text`,`@lexical/rich-text`])t.hasExtensionByName(e)&&fS(320,e);return!0}return!1}(e)?null:(0,j.jsx)(pS,{editor:e,ErrorBoundary:t})}var hS=va?A.useLayoutEffect:A.useEffect;function gS(e){return e.read(`latest`,Cv(e.isComposing()))}function _S({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[r]=ma();return function(e){hS(()=>eh(dS(e),Ny(e)),[e])}(r),(0,j.jsxs)(j.Fragment,{children:[e,(0,j.jsx)(vS,{content:t}),(0,j.jsx)(mS,{editor:r,ErrorBoundary:n})]})}function vS({content:e}){let[t]=ma(),n=function(e){let[t,n]=(0,A.useState)(()=>gS(e));return hS(()=>{function t(){let t=gS(e);n(t)}return t(),eh(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),r=Iv();return n?typeof e==`function`?e(r):e:null}var yS=`system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", Tahoma, Arial, sans-serif`,bS=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function xS(e,t){if(typeof e==`number`)return Number.isFinite(e)?e:t;if(typeof e!=`string`||!bS.test(e))return t;let n=Number(e);return Number.isFinite(n)?n:t}function SS(e,t,n,r,i){let a=xS(e,t);return a>=n&&a<=r&&Number.isInteger(a)?a:t}function CS(e,t){e.__rel=t.__rel,e.__target=t.__target,e.__title=t.__title,e.__url=t.__url}var wS=e=>{let t=Ms(e,`format`),n=Ns(e,`format`),r=Fs(e,`format`);return{exportJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles();return{children:[],rel:e.__rel,target:e.__target,title:e.__title,url:e.__url,direction:e.__dir,format:t[e.__format],indent:e.__indent,textFormat:n!==0&&i?n:void 0,textStyle:r!==``&&i?r:void 0,type:e.__type,version:1}},exportCompactJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles(),a={type:e.__type,children:[]},o=e.__rel;o!=null&&(a.rel=o);let s=e.__target;s!=null&&(a.target=s);let c=e.__title;c!=null&&(a.title=c);let l=e.__url;l!==void 0&&l!==``&&(a.url=l);let u=e.__dir;u!=null&&(a.direction=u);let d=t[e.__format];d!==void 0&&d!==``&&(a.format=d);let f=e.__indent;return f!==void 0&&f!==0&&(a.indent=f),n!==void 0&&n!==0&&i&&(a.textFormat=n),r!==void 0&&r!==``&&i&&(a.textStyle=r),a},updateFromJSON:function(e,t){let i=t.direction;e.__dir=i===null||i===`ltr`||i===`rtl`?i:null;let a=t.format;e.__format=typeof a==`string`&&a in n?n[a]:r,e.__indent=SS(t.indent,0,0,1/0),e.__textFormat=xS(t.textFormat,0);let o=t.textStyle;e.__textStyle=typeof o==`string`?o:``;let s=t.rel;e.__rel=typeof s==`string`&&s!==``?s:null;let c=t.target;e.__target=typeof c==`string`&&c!==``?c:null;let l=t.title;e.__title=typeof l==`string`&&l!==``?l:null;let u=t.url;return e.__url=typeof u==`string`?u:``,e},afterCloneFrom:CS}};function TS(e,t){e.__isUnlinked=t.__isUnlinked}var ES=e=>{let t=Ms(e,`format`),n=Ns(e,`format`),r=Fs(e,`format`);return{exportJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles();return{children:[],isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title,url:e.__url,direction:e.__dir,format:t[e.__format],indent:e.__indent,textFormat:n!==0&&i?n:void 0,textStyle:r!==``&&i?r:void 0,type:e.__type,version:1}},exportCompactJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles(),a={type:e.__type,children:[]},o=e.__isUnlinked;o!==void 0&&!1!==o&&(a.isUnlinked=o);let s=e.__rel;s!=null&&(a.rel=s);let c=e.__target;c!=null&&(a.target=c);let l=e.__title;l!=null&&(a.title=l);let u=e.__url;u!==void 0&&u!==``&&(a.url=u);let d=e.__dir;d!=null&&(a.direction=d);let f=t[e.__format];f!==void 0&&f!==``&&(a.format=f);let p=e.__indent;return p!==void 0&&p!==0&&(a.indent=p),n!==void 0&&n!==0&&i&&(a.textFormat=n),r!==void 0&&r!==``&&i&&(a.textStyle=r),a},updateFromJSON:function(e,t){let i=t.direction;e.__dir=i===null||i===`ltr`||i===`rtl`?i:null;let a=t.format;e.__format=typeof a==`string`&&a in n?n[a]:r,e.__indent=SS(t.indent,0,0,1/0),e.__textFormat=xS(t.textFormat,0);let o=t.textStyle;e.__textStyle=typeof o==`string`?o:``;let s=t.rel;e.__rel=typeof s==`string`&&s!==``?s:null;let c=t.target;e.__target=typeof c==`string`&&c!==``?c:null;let l=t.title;e.__title=typeof l==`string`&&l!==``?l:null;let u=t.url;e.__url=typeof u==`string`?u:``;let d=t.isUnlinked;return e.__isUnlinked=typeof d==`boolean`&&d,e},afterCloneFrom:TS}},DS=new Set([`http:`,`https:`,`mailto:`,`sms:`,`tel:`]),OS=ec()({rel:rc(Qs(qs(),{defaultAsNull:!0}),{field:`__rel`}),target:rc(Qs(qs(),{defaultAsNull:!0}),{field:`__target`}),title:rc(Qs(qs(),{defaultAsNull:!0}),{field:`__title`}),url:rc(qs(),{field:`__url`,getter:`getURL`,setter:`setURL`})}),kS=class extends Ql{__url;__target;__rel;__title;$config(){return this.config(`link`,{children:`inline`,extends:Ql,generated:wS,importDOM:{a:()=>({conversion:PS,priority:1})},inline:!0,json:OS,mergeAdjacent:{by:[`url`,`target`,`rel`,`title`]}})}constructor(e=``,t={},n){super(n);let{target:r=null,rel:i=null,title:a=null}=t;this.__url=e,this.__target=r,this.__rel=i,this.__title=a}createDOM(e){let t=kf().createElement(`a`);return this.updateLinkDOM(null,t,e),pv(t,e.theme.link),t}updateLinkDOM(e,t,n){if(zf(t)){e&&e.__url===this.__url||(t.href=this.sanitizeUrl(this.__url));for(let n of[`target`,`rel`,`title`]){let r=`__${n}`,i=this[r];e&&e[r]===i||(i?t[n]=i:t.removeAttribute(n))}}}updateDOM(e,t,n){return this.updateLinkDOM(e,t,n),!1}sanitizeUrl(e){let t=e;e=GS(e);try{let t=new URL(GS(e));if(!DS.has(t.protocol))return`about:blank`}catch{let e=t.replace(/[\u0000-\u001F\u007F\s]/g,``).match(/^([a-z][a-z0-9+.-]*):/i);if(e!=null&&!DS.has(`${e[1].toLowerCase()}:`))return`about:blank`}return e}getURL(){return this.getLatest().__url}setURL(e){let t=this.getWritable();return t.__url=e,t}getTarget(){return this.getLatest().__target}setTarget(e){let t=this.getWritable();return t.__target=e,t}getRel(){return this.getLatest().__rel}setRel(e){let t=this.getWritable();return t.__rel=e,t}getTitle(){return this.getLatest().__title}setTitle(e){let t=this.getWritable();return t.__title=e,t}insertNewAfter(e,t=!0){let n=gf(this);return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!q(t))return!1;let r=t.anchor.getNode(),i=t.focus.getNode();return(this.is(r)||this.isParentOf(r))&&(this.is(i)||this.isParentOf(i))&&t.getTextContent().length>0}isEmailURI(){return this.getURL().startsWith(`mailto:`)}isWebSiteURI(){let e=this.getURL();return e.startsWith(`https://`)||e.startsWith(`http://`)}shouldMergeAdjacentLink(e){return this.getType()===e.getType()&&this.getURL()===e.getURL()&&this.getTarget()===e.getTarget()&&this.getRel()===e.getRel()&&this.getTitle()===e.getTitle()}};function AS(e){let t=Eu(e,`next`);return[t,t.getFlipped()]}function jS(e,t){for(let n of t)if(n.origin.isAttached()){Du(e,Iu(n));return}}function MS(e,t){let n=e.constructor;return t.constructor===n&&Gl(qf())&&Wl(n).declaredBy.mergeAdjacent===n}function NS(e){let t=J(),n=null,r=null;function i(){q(t)&&(jS(t.anchor,n),jS(t.focus,r),kl(t))}q(t)&&(n=AS(t.anchor),r=AS(t.focus));let a=!1,o=!Gl(qf());for(let t of o?q_(e,`next`):[]){let n=t.origin;if(I(n)&&!n.isInline()){let r=n.getChildren();if(r.length>0){let t=gf(e);t.append(...r),n.append(t),a=!0}Ku(n,ju(t),{$shouldSplit:()=>!1})}}function s(e,t,n){let[r,i]=e,a=e=>z_(e)&&e.origin.is(t);if(!a(r)&&!a(i))return e;let o=Iu(q_(n,`next`));return[o,o.getFlipped()]}if(e.isAttached()){let t=e.getPreviousSibling();if(IS(t)&&!MS(t,e)&&t.shouldMergeAdjacentLink(e))return n&&=s(n,t,e),r&&=s(r,t,e),t.append(...e.getChildren()),e.remove(),void i();let o=e.getNextSibling();IS(o)&&!MS(e,o)&&e.shouldMergeAdjacentLink(o)&&(n&&=s(n,e,o),r&&=s(r,e,o),e.append(...o.getChildren()),o.remove(),a=!0)}if(a){if(!e.canBeEmpty()&&e.isEmpty()){let t=e.getParent();e.remove(),t&&t.isEmpty()&&t.remove()}i()}}function PS(e){let t=null;if(zf(e)){let n=e.textContent;(n!==null&&n!==``||e.children.length>0)&&(t=FS(e.getAttribute(`href`)||``,{rel:e.getAttribute(`rel`),target:e.getAttribute(`target`),title:e.getAttribute(`title`)}))}return{node:t}}function FS(e=``,t){return _f(new kS(e,t))}function IS(e){return e instanceof kS}var LS=ec()({isUnlinked:rc(Xs(),{field:`__isUnlinked`})}),RS=class extends kS{__isUnlinked;constructor(e=``,t={},n){super(e,t,n),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}$config(){return this.config(`autolink`,{extends:kS,generated:ES,json:LS,mergeAdjacent:!1})}shouldMergeAdjacentLink(e){return!1}getIsUnlinked(){return this.getLatest().__isUnlinked}setIsUnlinked(e){let t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?kf().createElement(`span`):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}};function zS(e=``,t){return _f(new RS(e,t))}function BS(e){return e instanceof RS}var VS=N(`TOGGLE_LINK_COMMAND`);function HS(e,t){if(e.type===`element`){let n=e.getNode();return I(n)||function(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return 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.`)}(e,...t)}(252),n.getChildren()[e.offset+t]||null}return null}function US(e,t={}){let n;if(e&&typeof e==`object`){let{url:r,...i}=e;n=r,t={...i,...t}}else n=e;let{target:r,title:i}=t,a=t.rel===void 0?`noreferrer`:t.rel,o=J();if(o===null||!q(o)&&!cg(o))return;if(cg(o)){let e=o.getNodes();if(e.length===0)return;e.forEach(e=>{if(n===null){let t=G(e,e=>!BS(e)&&IS(e));t&&(t.insertBefore(e),t.getChildren().length===0&&t.remove())}else{let t=G(e,e=>!BS(e)&&IS(e));if(t)t.setURL(n),r!==void 0&&t.setTarget(r),a!==void 0&&t.setRel(a),i!==void 0&&t.setTitle(i);else{let t=FS(n,{rel:a,target:r,title:i});e.insertBefore(t),t.append(e)}}});return}if(o.isCollapsed()&&n===null)for(let e of o.getNodes()){let t=G(e,e=>!BS(e)&&IS(e));t!==null&&(t.getParentOrThrow().splice(t.getIndexWithinParent(),0,t.getChildren()),t.remove());return}let s=o.extract();if(n===null){let e=new Set;s.forEach(t=>{let n=G(t,e=>!BS(e)&&IS(e));if(n!==null){let t=n.getKey();if(e.has(t))return;(function(e,t){let n=new Set(t.filter(t=>e.isParentOf(t)).map(e=>e.getKey())),r=e.getChildren(),i=r=>n.has(r.getKey())||I(r)&&t.some(t=>e.isParentOf(t)&&r.isParentOf(t)),a=r.filter(i);if(a.length===0&&r.length>0)return;if(a.length===r.length)return r.forEach(t=>e.insertBefore(t)),void e.remove();let o=r.findIndex(i),s=r.findLastIndex(i),c=o===0,l=s===r.length-1;if(c)a.forEach(t=>e.insertBefore(t));else if(l)for(let t=a.length-1;t>=0;t--)e.insertAfter(a[t]);else{for(let t=a.length-1;t>=0;t--)e.insertAfter(a[t]);let t=r.slice(s+1);if(t.length>0){let n=gf(e);a[a.length-1].insertAfter(n),t.forEach(e=>n.append(e))}}})(n,s),e.add(t)}});return}let c=new Set,l=e=>{c.has(e.getKey())||(c.add(e.getKey()),e.setURL(n),r!==void 0&&e.setTarget(r),a!==void 0&&e.setRel(a),i!==void 0&&e.setTitle(i))};if(s.length===1){let e=s[0],t=G(e,IS);if(t!==null)return l(t)}(function(e){let t=J();if(!q(t))return e();let n=kl(t),r=n.isBackward(),i=HS(n.anchor,r?-1:0),a=HS(n.focus,r?0:-1);if(e(),i||a){let e=J();if(q(e)){let t=e.clone();if(i){let e=i.getParent();e&&t.anchor.set(e.getKey(),i.getIndexWithinParent()+ +!!r,`element`)}if(a){let e=a.getParent();e&&t.focus.set(e.getKey(),a.getIndexWithinParent()+ +!r,`element`)}Fd(kl(t))}}})(()=>{let e=null;for(let t of s){if(!t.isAttached())continue;let o=G(t,IS);if(o){l(o);continue}if(I(t)){if(!t.isInline())continue;if(IS(t)){if(!(BS(t)||e!==null&&e.getParentOrThrow().isParentOf(t))){l(t),e=t;continue}for(let e of t.getChildren())t.insertBefore(e);t.remove();continue}}let s=t.getPreviousSibling();IS(s)&&s.is(e)?s.append(t):(e=FS(n,{rel:a,target:r,title:i}),t.insertAfter(e),e.append(t))}})}var WS=/^\+?[0-9\s()-]{5,}$/;function GS(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes(`@`)?`mailto:${e}`:WS.test(e)?`tel:${e}`:`https://${e}`}function KS(e,t){return eh(e.registerNodeTransform(kS,NS),e.registerCommand(VS,e=>{let n=t.validateUrl.peek(),r=t.attributes.peek();if(e===null)return US(null),!0;if(typeof e==`string`)return!(n!==void 0&&!n(e)||(US(e,r),0));{let{url:t,...i}=e;return!(n!==void 0&&!n(t)||(US(t,{...r,...i}),0))}},0),Ty(()=>{let n=t.validateUrl.value;if(!n)return;let r=t.attributes.value;return e.registerCommand(oo,t=>{let i=J();if(!q(i)||i.isCollapsed()||!pb(t,ClipboardEvent)||t.clipboardData===null)return!1;let a=t.clipboardData.getData(`text`);return!!n(a)&&!i.getNodes().some(e=>I(e)||R(e)&&!e.isSimpleText())&&(e.dispatchCommand(VS,{...r,url:a}),t.preventDefault(),!0)},1)}))}function qS(e,t=e=>e){return n=>{let r=e.exec(n);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:t(r[0])}}}function JS(e,t){for(let n=0;n<t.length;n++){let r=t[n](e);if(r)return r}return null}var YS=/[.,;\s]/;function XS(e,t){return t.test(e)}function ZS(e,t){return XS(e[e.length-1],t)}function QS(e,t){return XS(e[0],t)}function $S(e,t){let n=e.getPreviousSibling();return I(n)&&(n=n.getLastDescendant()),n===null||cm(n)||R(n)&&ZS(n.getTextContent(),t)}function eC(e,t){let n=e.getNextSibling();return I(n)&&(n=n.getFirstDescendant()),n===null||cm(n)||R(n)&&QS(n.getTextContent(),t)}function tC(e,t,n,r,i){return!!(e>0?XS(r[e-1],n):$S(i[0],n))&&(t<r.length?XS(r[t],n):eC(i[i.length-1],n))}function nC(e,t,n){let r=[],i=[],a=[],o=0,s=0,c=[...e];for(;c.length>0;){let e=c[0],l=e.getTextContent().length,u=s;s+l<=t?(r.push(e),o+=l):u>=n?a.push(e):i.push(e),s+=l,c.shift()}return[o,r,i,a]}function rC(e,t,n,r){let i=zS(r.url,r.attributes);if(e.length===1){let a,o=e[0];t===0?[a,o]=o.splitText(n):[,a,o]=o.splitText(t,n);let s=wu(r.text);return s.setFormat(a.getFormat()),s.setDetail(a.getDetail()),s.setStyle(a.getStyle()),i.append(s),a.replace(i),o}if(e.length>1){let r=e[0],a,o=r.getTextContent().length;t===0?a=r:[,a]=r.splitText(t);let s=[],c;for(let t=1;t<e.length;t++){let r=e[t],i=r.getTextContent().length,a=o;if(a<n){if(o+i<=n)s.push(r);else{let[e,t]=r.splitText(n-a);s.push(e),c=t}}o+=i}let l=J(),u=l?l.getNodes().find(R):void 0,d=wu(a.getTextContent());return d.setFormat(a.getFormat()),d.setDetail(a.getDetail()),d.setStyle(a.getStyle()),i.append(d,...s),u&&u===a&&(q(l)?d.select(l.anchor.offset,l.focus.offset):cg(l)&&d.select(0,d.getTextContent().length)),a.replace(i),c}}function iC(e,t,n,r){let i=e.getChildren(),a=i.length;for(let t=0;t<a;t++){let r=i[t];if(!R(r)||!r.isSimpleText())return aC(e),void n(null,e.getURL())}let o=e.getTextContent(),s=JS(o,t);if(s===null||s.text!==o||!$S(e,r)||!eC(e,r))return aC(e),void n(null,e.getURL());let c=e.getURL();c!==s.url&&(e.setURL(s.url),n(s.url,c)),s.attributes&&(e.getRel()!==s.attributes.rel&&e.setRel(s.attributes.rel||null),e.getTarget()!==s.attributes.target&&e.setTarget(s.attributes.target||null),e.getTitle()!==s.attributes.title&&e.setTitle(s.attributes.title||null))}function aC(e){let t=e.getChildren();for(let n=t.length-1;n>=0;n--)e.insertAfter(t[n]);return e.remove(),t.map(e=>e.getLatest())}var oC={changeHandlers:[],excludeParents:[],matchers:[],separatorRegex:YS};function sC(e,t=oC){let{matchers:n,changeHandlers:r,excludeParents:i,separatorRegex:a=YS}=t,o=(e,t)=>{for(let n of r)n(e,t)};return eh(e.registerNodeTransform(hu,e=>{let t=e.getParentOrThrow(),r=e.getPreviousSibling();BS(t)?iC(t,n,o,a):!IS(t)&&!i.some(e=>e(t))&&(e.isSimpleText()&&(QS(e.getTextContent(),a)||!BS(r))&&(function(e,t,n,r){for(let t of e){let e=t.getParent();if(BS(e)&&!e.getIsUnlinked())return}let i=[...e],a=i.map(e=>e.getTextContent()).join(``),o,s=a,c=0;for(;(o=JS(s,t))&&o!==null;){let e=o.index,t=e+o.length;if(tC(c+e,c+t,r,a,i)){let[r,,a,l]=nC(i,c+e,c+t),u=!1;for(let e of a){let t=e.getParent();if(BS(t)&&!t.getIsUnlinked()){u=!0;break}}if(u){c+=t,s=s.substring(t);continue}let d=rC(a,c+e-r,c+t-r,o);i=d?[d,...l]:l,n(o.url,null),c=0}else c+=t;s=s.substring(t)}})(function(e){let t=[e],n=e.getNextSibling();for(;n!==null&&R(n)&&n.isSimpleText()&&(t.push(n),!/[\s]/.test(n.getTextContent()));)n=n.getNextSibling();return t}(e),n,o,a),(function(e,t,n,r){let i=e.getParent(),a=e.getPreviousSibling(),o=e.getNextSibling(),s=e.getTextContent();if(!BS(i)||i.getIsUnlinked()){if(BS(a)&&!a.getIsUnlinked()&&a.is(e.getPreviousSibling())&&e.getParent()===a.getParent()){if(!QS(s,r))return aC(a),void n(null,a.getURL());if(c=s,a.isEmailURI()?/^\.[a-zA-Z]{2,}/.test(c):/^\.[a-zA-Z0-9]{1,}/.test(c)){let i=a.getTextContent()+s,o=JS(i,t);o!==null&&o.text===i&&(a.append(e),iC(a,t,n,r),n(null,a.getURL()))}}var c;!BS(o)||o.getIsUnlinked()||ZS(s,r)||o.is(e.getNextSibling())&&e.getParent()===o.getParent()&&(aC(o),n(null,o.getURL()))}})(e,n,o,a))}),e.registerCommand(VS,e=>{let t=J();return!(e!==null||!q(t))&&(t.extract().forEach(e=>{let t=e.getParent();BS(t)&&(t.setIsUnlinked(!t.getIsUnlinked()),t.markDirty())}),!1)},1))}function cC(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return 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.`)}(e,...t)}function lC(e){let t=1,n=e.getParent();for(;n!=null;){if(Z(n)){let e=n.getParent();if(X(e)){t++,n=e.getParent();continue}cC(40)}return t}return t}function uC(e){let t=e.getParent();X(t)||cC(40);let n=t,r=t;for(;r!==null;)r=r.getParent(),X(r)&&(n=r);return n}function dC(e){let t=[],n=e.getChildren().filter(Z);for(let e=0;e<n.length;e++){let r=n[e],i=r.getFirstChild();X(i)?t=t.concat(dC(i)):t.push(r)}return t}function fC(e){return Z(e)&&X(e.getFirstChild())}function pC(e,t){return t.getValue()}function mC(e,t){return Z(e)&&(t.length===0||t.length===1&&e.is(t[0])&&e.getChildrenSize()===0)}function hC(e,t){return X(e)?gf(e).setListType(t):RC(t)}function gC(e){let t=J();if(t!==null){let n=t.getNodes();if(q(t)){let[r]=t.getStartEndPoints(),i=r.getNode(),a=i.getParent();if(U(i)){let e=i.getFirstChild();if(e)n=e.selectStart().getNodes();else{let e=z();i.append(e),n=e.select().getNodes()}}else if(mC(i,n)){if(U(a)){let t=RC(e);i.replace(t);let n=WC();I(i)&&(n.setFormat(i.getFormatType()),n.setIndent(i.getIndent())),t.append(n)}else if(Z(i)){let t=i.getParentOrThrow();if(p_(t)===null){let n=hC(t,e);_C(n,t.getChildren()),t.replace(n)}}return}}let r=new Set;for(let t=0;t<n.length;t++){let i=n[t];if(I(i)&&i.isEmpty()&&!Z(i)&&p_(i)===null&&!r.has(i.getKey())){vC(i,e);continue}let a=bd(i)?i.getParent():Z(i)&&i.isEmpty()?i:null;for(;a!=null;){let t=a.getKey();if(X(a)){if(!r.has(t)&&p_(a)===null){let n=hC(a,e);_C(n,a.getChildren()),a.replace(n),r.add(t)}break}{let n=a.getParent();if(U(n)&&!r.has(t)){r.add(t),vC(a,e);break}a=n}}}}}function _C(e,t){e.splice(e.getChildrenSize(),0,t)}function vC(e,t){if(X(e))return e;let n=e.getPreviousSibling(),r=e.getNextSibling(),i=WC(),a;if(_C(i,e.getChildren()),X(n)&&t===n.getListType())n.append(i),X(r)&&t===r.getListType()&&(_C(n,r.getChildren()),r.remove()),a=n;else if(X(r)&&t===r.getListType())r.getFirstChildOrThrow().insertBefore(i),a=r;else{let n=RC(t);n.append(i),e.replace(n),a=n}i.setFormat(e.getFormatType()),i.setIndent(e.getIndent());let o=J();return q(o)&&(a.getKey()===o.anchor.key&&o.anchor.set(i.getKey(),o.anchor.offset,`element`),a.getKey()===o.focus.key&&o.focus.set(i.getKey(),o.focus.offset,`element`)),e.remove(),a}function yC(e,t){bC(e,t,!1)}function bC(e,t,n){xC(e.getLastChild(),t.getFirstChild(),n);let r=t.getChildren();r.length>0&&e.append(...r),t.remove()}function xC(e,t,n=!1){if(e&&t&&fC(e)&&fC(t)&&(!n||e.getChildrenSize()===1&&t.getChildrenSize()===1)&&e.getFirstChild().getListType()===t.getFirstChild().getListType()){if(bC(e.getFirstChild(),t.getFirstChild(),n),!n)return void t.remove();Ql.prototype.remove.call(t)}}function SC(){let e=J();if(q(e)){let t=new Set,n=e.getNodes(),r=e.anchor.getNode();if(mC(r,n))t.add(uC(r));else for(let e=0;e<n.length;e++){let r=n[e];if(bd(r)){let e=ub(r,BC);e!=null&&t.add(uC(e))}}for(let n of t){if(p_(n)!==null)continue;let t=n,r=dC(n);for(let n of r){let r=z().setTextStyle(e.style).setTextFormat(e.format);r.setFormat(n.getFormatType()).setIndent(n.getIndent()).setDirection(n.getDirection()).setStyle(n.getStyle()),_C(r,n.getChildren()),t.insertAfter(r),t=r,n.__key===e.anchor.key&&Du(e.anchor,Iu(zu(r,e.anchor.offset,`next`))),n.__key===e.focus.key&&Du(e.focus,Iu(zu(r,e.focus.offset,`next`))),n.remove()}n.remove()}}}function CC(e){let t=e.getListType()!==`check`,n=e.getStart();for(let r of e.getChildren())Z(r)&&(r.getValue()!==n&&r.setValue(n),t&&r.getLatest().__checked!=null&&r.setChecked(void 0),X(r.getFirstChild())||n++)}function wC(e){let t=new Set;if(fC(e)||t.has(e.getKey()))return;let n=e.getParent(),r=e.getNextSibling(),i=e.getPreviousSibling();if(fC(r)&&fC(i)){let n=i.getFirstChild();if(X(n)){n.append(e);let i=r.getFirstChild();X(i)&&n.getListType()===i.getListType()&&(_C(n,i.getChildren()),r.remove(),t.add(r.getKey()))}}else if(fC(r)){let t=r.getFirstChild();if(X(t)){let n=t.getFirstChild();n!==null&&n.insertBefore(e)}}else if(fC(i)){let t=i.getFirstChild();X(t)&&t.append(e)}else if(X(n)){let t=gf(e),a=gf(n);t.append(a),a.append(e),i?i.insertAfter(t):r?r.insertBefore(t):n.append(t)}}function TC(e){if(fC(e))return;let t=e.getParent(),n=t?t.getParent():void 0;if(X(n?n.getParent():void 0)&&Z(n)&&X(t)){let r=t?t.getFirstChild():void 0,i=t?t.getLastChild():void 0;if(e.is(r))n.insertBefore(e),t.isEmpty()&&n.remove();else if(e.is(i))n.insertAfter(e),t.isEmpty()&&n.remove();else{let r=gf(e),i=gf(t);r.append(i),e.getPreviousSiblings().forEach(e=>i.append(e));let a=gf(e),o=gf(t);a.append(o),_C(o,e.getNextSiblings()),n.insertBefore(r),n.insertAfter(a),n.replace(e)}}}function EC(e=!1){let t=J();if(!q(t)||!t.isCollapsed())return!1;let n=t.anchor.getNode(),r=null;if(Z(n)&&n.getChildrenSize()===0)r=n;else if(R(n)){let e=n.getParent();Z(e)&&e.getChildren().every(e=>R(e)&&e.getTextContent().trim()===``)&&(r=e)}if(r===null)return!1;let i=uC(r),a=r.getParent();X(a)||cC(40);let o=a.getParent(),s;if(U(o))s=z(),i.insertAfter(s);else{if(!Z(o))return!1;s=gf(o),o.insertAfter(s)}s.setTextStyle(t.style).setTextFormat(t.format).select();let c=r.getNextSiblings();if(c.length>0){let t=e?pC(0,r):1,n=gf(a).setStart(t);if(Z(s)){let e=gf(s);e.append(n),s.insertAfter(e)}else s.insertAfter(n);n.append(...c)}return function(e){let t=e;for(;t.getNextSibling()==null&&t.getPreviousSibling()==null;){let e=t.getParent();if(e==null||!Z(e)&&!X(e))break;t=e}t.remove()}(r),!0}var DC=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function OC(e,t){if(typeof e==`number`)return Number.isFinite(e)?e:t;if(typeof e!=`string`||!DC.test(e))return t;let n=Number(e);return Number.isFinite(n)?n:t}function kC(e,t){e.__listType=t.__listType,e.__start=t.__start,e.__tag=t.__tag}var AC=e=>{let t=Ms(e,`format`),n=Ns(e,`format`),r=Fs(e,`format`),i=Ps(e,`listType`,0);return{exportJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles();return{children:[],listType:e.__listType,start:e.__start,tag:e.__tag,direction:e.__dir,format:t[e.__format],indent:e.__indent,textFormat:n!==0&&i?n:void 0,textStyle:r!==``&&i?r:void 0,type:e.__type,version:1}},exportCompactJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles(),a={type:e.__type,children:[]},o=e.__listType;o!==void 0&&o!==`number`&&(a.listType=o);let s=e.__start;s!==void 0&&s!==1&&(a.start=s);let c=e.__dir;c!=null&&(a.direction=c);let l=t[e.__format];l!==void 0&&l!==``&&(a.format=l);let u=e.__indent;return u!==void 0&&u!==0&&(a.indent=u),n!==void 0&&n!==0&&i&&(a.textFormat=n),r!==void 0&&r!==``&&i&&(a.textStyle=r),a},updateFromJSON:function(e,t){let a=t.direction;e.__dir=a===null||a===`ltr`||a===`rtl`?a:null;let o=t.format;e.__format=typeof o==`string`&&o in n?n[o]:r,e.__indent=function(e){let t=OC(e,0);return t>=0&&t<=1/0&&Number.isInteger(t)?t:0}(t.indent),e.__textFormat=OC(t.textFormat,0);let s=t.textStyle;e.__textStyle=typeof s==`string`?s:``;let c=t.listType;return e.setListType(typeof c==`string`&&c in i?i[c]:c===`number`||c===`bullet`||c===`check`?c:`number`),e.__start=OC(t.start,1),e},afterCloneFrom:kC}};function jC(e,t){e.__checked=t.__checked,e.__value=t.__value}var MC=e=>{let t=Ms(e,`format`),n=Ns(e,`format`),r=Fs(e,`format`);return{exportJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles();return{children:[],checked:e.getChecked(),indent:e.getIndent(),value:e.__value,direction:e.__dir,format:t[e.__format],textFormat:n!==0&&i?n:void 0,textStyle:r!==``&&i?r:void 0,type:e.__type,version:1}},exportCompactJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles(),a={type:e.__type,children:[]},o=e.getChecked();o!==void 0&&(a.checked=o);let s=e.getIndent();s!==void 0&&s!==0&&(a.indent=s);let c=e.__value;c!==void 0&&c!==1&&(a.value=c);let l=e.__dir;l!=null&&(a.direction=l);let u=t[e.__format];return u!==void 0&&u!==``&&(a.format=u),n!==void 0&&n!==0&&i&&(a.textFormat=n),r!==void 0&&r!==``&&i&&(a.textStyle=r),a},updateFromJSON:function(e,t){let i=t.direction;e.__dir=i===null||i===`ltr`||i===`rtl`?i:null;let a=t.format;e.__format=typeof a==`string`&&a in n?n[a]:r,e.setIndent(function(e){let t=OC(e,NaN);return Number.isFinite(t)&&Number.isInteger(t)?t<0?0:t>128?128:t:0}(t.indent)),e.__textFormat=OC(t.textFormat,0);let o=t.textStyle;e.__textStyle=typeof o==`string`?o:``;let s=t.checked;return e.__checked=s===void 0?void 0:typeof s==`boolean`&&s,e.__value=OC(t.value,1),e},afterCloneFrom:jC}},NC={ol:`number`,ul:`bullet`},PC=ec()({listType:ic(tc(Zs([`number`,`bullet`,`check`]),NC),{getter:{field:`__listType`}}),start:rc(Ys(1),{field:`__start`}),tag:ic(Zs([`ul`,`ol`]),{getter:{field:`__tag`},setter:null})}),FC=class extends Ql{__tag;__start;__listType;$config(){return this.config(`list`,{$transform:e=>{(function(e){let t=e.constructor,n=e.getNextSibling();return n!==null&&n.constructor===t&&Gl(qf())&&Wl(t).declaredBy.mergeAdjacent===t})(e)||function(e){let t=e.getNextSibling();X(t)&&e.getListType()===t.getListType()&&yC(e,t)}(e),CC(e)},children:[BC],extends:Ql,generated:AC,importDOM:bl({ol:()=>({conversion:LC,priority:0}),ul:()=>({conversion:LC,priority:0})}),json:PC,mergeAdjacent:{by:[`listType`]}})}constructor(e=`number`,t=1,n){super(n);let r=NC[e]||e;this.__listType=r,this.__tag=r===`number`?`ol`:`ul`,this.__start=t}getTag(){return this.getLatest().__tag}setListType(e){let t=this.getWritable();return t.__listType=e,t.__tag=e===`number`?`ol`:`ul`,t}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){let t=this.getWritable();return t.__start=e,t}createDOM(e,t){let n=this.__tag,r=kf().createElement(n);return this.__start!==1&&r.setAttribute(`start`,String(this.__start)),r.__lexicalListType=this.__listType,IC(r,e.theme,this),r}updateDOM(e,t,n){return e.__tag!==this.__tag||e.__listType!==this.__listType||(IC(t,n.theme,this),e.__start!==this.__start&&t.setAttribute(`start`,String(this.__start)),!1)}exportDOM(e){let t=this.createDOM(e._config,e);if(W(t)){this.__start!==1&&t.setAttribute(`start`,String(this.__start)),this.__listType===`check`&&t.setAttribute(`__lexicalListType`,`check`);let e=this.getDirection();e&&(t.dir=e)}return{element:t}}canBeEmpty(){return!1}INTERNAL_$afterStructureMerge(e,t){xC(e,t,!0)}INTERNAL_$afterStructureSplit(e,t){if(this.getListType()===`number`){let n=e.getStart();for(let e of t)Z(e)&&!X(e.getFirstChild())&&n++;this.setStart(n)}}canIndent(){return!1}splice(e,t,n){let r=n;for(let e=0;e<n.length;e++){let t=n[e];if(!Z(t)){r===n&&(r=[...n]);let i=this.createListItemNode();!I(t)||X(t)||t.isInline()?i.append(t):i.append(...t.getChildren()),r[e]=i}}return super.splice(e,t,r)}extractWithChild(e){return Z(e)}createListItemNode(){return WC()}};function IC(e,t,n){let r=[],i=[],a=t.list;if(a!==void 0){let e=a[`${n.__tag}Depth`]||[],t=lC(n)-1,o=t%e.length,s=e[o],c=a[n.__tag],l,u=a.nested,d=a.checklist;if(u!==void 0&&u.list&&(l=u.list),c!==void 0&&r.push(c),d!==void 0&&n.__listType===`check`&&r.push(d),s!==void 0){r.push(...fv(s));for(let t=0;t<e.length;t++)t!==o&&i.push(...fv(e[t]))}if(l!==void 0){let e=fv(l);t>1?r.push(...e):i.push(...e)}}i.length>0&&mv(e,...i),r.length>0&&pv(e,...r)}function LC(e){let t;if(function(e){return W(e)&&e.nodeName.toLowerCase()===`ol`}(e)){let n=e.start;t=RC(`number`,n)}else t=function(e){if(e.getAttribute(`__lexicallisttype`)===`check`||e.classList.contains(`contains-task-list`)||e.getAttribute(`data-is-checklist`)===`1`)return!0;for(let t of e.childNodes)if(W(t)&&t.hasAttribute(`aria-checked`))return!0;return!1}(e)?RC(`check`):RC(`bullet`);return ip(t,e),{after:e=>function(e,t){let n=t.createListItemNode.bind(t),r=[];for(let t=0;t<e.length;t++){let i=e[t];if(Z(i)){r.push(i);let e=i.getChildren();e.length>1&&e.forEach(e=>{X(e)&&r.push(n().append(e))})}else r.push(n().append(i))}return r}(e,t),node:t}}function RC(e=`number`,t=1){return _f(new FC(e,t))}function X(e){return e instanceof FC}var zC=ec()({checked:ic($s(Xs()),{setter:{field:`__checked`}}),indent:ic(Ys(0,{clamp:!0,integer:!0,max:128,min:0}),{derived:!0}),value:rc(Ys(1),{derived:!0,field:`__value`})}),BC=class extends Ql{__value;__checked;$config(){return this.config(`listitem`,{$transform:e=>{let t=e.getParent();if(X(t))t.getListType()!==`check`&&e.getChecked()!=null&&e.setChecked(void 0);else if(t){let n=e.createParentElementNode();X(n)||cC(340);let r=[e];for(let t of[`previous`,`next`]){r.reverse();for(let{origin:n}of Y(e,t)){if(!Z(n))break;r.push(n)}}let i=Gl(qf()),a=i?function(e,t){let n=J();if(!q(n))return null;let r=e.getKey(),i=t[0].getIndexWithinParent(),a=[n.anchor,n.focus].filter(e=>e.type===`element`&&e.key===r).map(e=>({offset:e.offset,point:e}));return a.length===0?null:e=>{for(let{point:e,offset:n}of a)if(n<=i)e.set(r,n,`element`);else if(n<i+t.length){let r=t[n-i-1];e.set(r.getKey(),r.getChildrenSize(),`element`)}else e.set(r,n-t.length+1,`element`)}}(t,r):null;if(e.insertBefore(n),n.splice(0,0,r),a!==null&&a(n),i)for(let e=t;e!==null&&!U(e);e=e.getParent())e.markDirty();U(t)||i||(Ku(n,ju(Y(n,`next`)),{$shouldSplit:()=>!1,removeEmptyDestination:!0}),t.isEmpty()&&t.isAttached()&&t.remove())}},children:[`inline`,FC],extends:Ql,generated:MC,importDOM:bl({li:()=>({conversion:VC,priority:0})}),json:zC})}constructor(e=1,t=void 0,n){super(n),this.__value=e===void 0?1:e,this.__checked=t}createDOM(e){let t=kf().createElement(`li`);return this.updateListItemDOM(null,t,e),t}updateListItemDOM(e,t,n){(function(e,t){let n=t.getParent();!X(n)||n.getListType()!==`check`||X(t.getFirstChild())?(e.removeAttribute(`role`),e.removeAttribute(`tabIndex`),e.removeAttribute(`aria-checked`)):(e.setAttribute(`role`,`checkbox`),e.setAttribute(`tabIndex`,`-1`),e.setAttribute(`aria-checked`,t.getChecked()?`true`:`false`))})(t,this),t.value=this.__value,function(e,t,n){let r=t.list;if(!r)return;let i=r.listitem,a=r.nested&&r.nested.listitem,o=n.getParent(),s=X(o)&&o.getListType()===`check`,c=n.getChecked(),l=n.getChildren().some(e=>X(e)),u=[];r.listitemChecked!==void 0&&u.push(r.listitemChecked),r.listitemUnchecked!==void 0&&u.push(r.listitemUnchecked),a!==void 0&&u.push(...fv(a)),u.length>0&&mv(e,...u);let d=[];if(i!==void 0&&d.push(...fv(i)),s){let e=c?r.listitemChecked:r.listitemUnchecked;e!==void 0&&d.push(e)}a!==void 0&&l&&d.push(...fv(a)),d.length>0&&pv(e,...d)}(t,n.theme,this);let r=e?e.__style:``,i=this.__style;r!==i&&ou(t.style,i,r),function(e,t,n){let r=t.__textStyle,i=n?n.__textStyle:``;if(n!==null&&i===r)return;let a=iu(r);for(let t in a)e.style.setProperty(`--listitem-marker-${t}`,a[t]);if(i!==``)for(let t in iu(i))t in a||e.style.removeProperty(`--listitem-marker-${t}`)}(t,this,e)}updateDOM(e,t,n){let r=t;return this.updateListItemDOM(e,r,n),!1}exportDOM(e){let t=this.createDOM(e._config),n=this.getFormatType();n&&(t.style.textAlign=n);let r=this.getDirection();return r&&(t.dir=r),fC(this)?{after(e){if(W(e)){let t=e.previousElementSibling;if(W(t)&&t.nodeName===`LI`){for(;e.firstChild;)t.append(e.firstChild);e.remove()}}return e},element:t}:{element:t}}append(...e){for(let t=0;t<e.length;t++){let n=e[t];if(I(n)&&this.canMergeWith(n)){let e=n.getChildren();this.append(...e),n.remove()}else super.append(n)}return this}replace(e,t){if(Z(e))return super.replace(e);this.setIndent(0);let n=this.getParentOrThrow();if(!X(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{let t=gf(n),r=this.getNextSibling();for(;r;){let e=r;r=r.getNextSibling(),t.append(e)}n.insertAfter(e),e.insertAfter(t)}let r=this.__key,i=0;if(t&&(I(e)||cC(139),i=e.getChildrenSize(),e.splice(i,0,this.getChildren())),t&&I(e)){let t=J();if(q(t))for(let n of t.getStartEndPoints())n.key===r&&n.type===`element`&&n.set(e.getKey(),i+n.offset,`element`)}return this.remove(),n.getChildrenSize()===0&&n.remove(),e}insertAfter(e,t=!0){let n=this.getParentOrThrow();if(X(n)||cC(39),Z(e))return super.insertAfter(e,t);let r=this.getNextSiblings();if(n.insertAfter(e,t),r.length!==0){let i=gf(n),a=r[0];i.getListType()===`number`&&Z(a)&&i.setStart(pC(0,a)),r.forEach(e=>i.append(e)),e.insertAfter(i,t)}return e}remove(e){let t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&fC(t)&&fC(n)&&t.getFirstChild().getListType()===n.getFirstChild().getListType()&&(yC(t.getFirstChild(),n.getFirstChild()),n.remove())}resetOnCopyNodeFrom(e){super.resetOnCopyNodeFrom(e),e.getChecked()&&this.setChecked(!1)}insertNewAfter(e,t=!0){let n=gf(this);return this.insertAfter(n,t),n}collapseAtStart(e){if(fC(this))return!1;let t=this.getParentOrThrow();if(Z(t.getParentOrThrow()))return TC(this),!0;let n=z().append(...this.getChildren()),r=this.getNextSiblings();if(r.length>0){let e=gf(t);e.append(...r),t.insertAfter(e)}return t.insertAfter(n),this.remove(),t.getChildrenSize()===0&&t.remove(),n.selectStart(),!0}getValue(){return this.getLatest().__value}setValue(e){let t=this.getWritable();return t.__value=e,t}getChecked(){let e=this.getLatest(),t,n=this.getParent();return X(n)&&(t=n.getListType()),t===`check`?!!e.__checked:void 0}setChecked(e){let t=this.getWritable();return t.__checked=e,t}toggleChecked(){let e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){let e=this.getParent();if(e===null||!this.isAttached())return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;Z(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!=`number`&&cC(117),(e=Math.floor(e))>=0||cC(199);let t=e,n=this.getIndent();for(;n!==t;)n<t?(wC(this),n++):(TC(this),n--);return this}canInsertAfter(e){return Z(e)}canReplaceWith(e){return Z(e)}canMergeWith(e){return Z(e)||Xu(e)}extractWithChild(e,t){if(!q(t))return!1;let n=t.anchor.getNode(),r=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(r)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return RC(`bullet`)}canMergeWhenEmpty(){return!0}};function VC(e){if(e.classList.contains(`task-list-item`)){for(let t of e.children)if(t.tagName===`INPUT`)return HC(t)}if(e.classList.contains(`joplin-checkbox`)){for(let t of e.children)if(t.classList.contains(`checkbox-wrapper`)&&t.children.length>0&&t.children[0].tagName===`INPUT`)return HC(t.children[0])}let t=e.getAttribute(`aria-checked`),n=WC(t===`true`||t!==`false`&&void 0);return ap(n,e),{after:UC.bind(null,n),node:ip(n,e)}}function HC(e){if(e.getAttribute(`type`)!==`checkbox`)return{node:null};let t=WC(e.hasAttribute(`checked`));return{after:UC.bind(null,t),node:t}}function UC(e,t){let n=t[0];return t.length===1&&Xu(n)&&!e.getFormatType()&&n.getFormatType()?(e.setFormat(n.getFormatType()),n.getChildren()):t}function WC(e){return _f(new BC(void 0,e))}function Z(e){return e instanceof BC}var GC=new Set([` `,`Alt`,`ArrowDown`,`ArrowLeft`,`ArrowUp`,`CapsLock`,`Control`,`Escape`,`Meta`,`Shift`]),KC=N(`INSERT_CHECK_LIST_COMMAND`);function qC(e,t){let n=t&&t.disableTakeFocusOnClick||!1,r=typeof n==`boolean`?()=>n:n.peek.bind(n),i=e=>{let t=e.target;if(!W(t))return!1;let n=t.__lexicalCheckListLastHandled;return n!==void 0&&e.timeStamp-n<500},a=`none`,o=e=>{a=function(e,t){let n=!1;return JC(e,()=>{n=!0,e.preventDefault(),t&&e.stopPropagation()}),n}(e,r())?`checkMark`:`content`},s=()=>{a===`content`&&XC(e),a=`none`};return eh(e.registerCommand(KC,()=>(gC(`check`),!0),1),e.registerCommand(xo,t=>$C(t,e,!1),1),e.registerCommand(bo,t=>$C(t,e,!0),1),e.registerCommand(To,()=>QC(e)!=null&&(e.getRootElement()?.focus(),!0),1),e.registerCommand(Co,t=>{let n=QC(e);return!(n==null||!e.isEditable()||(e.update(()=>{let e=Ad(n);Z(e)&&(t.preventDefault(),e.toggleChecked())}),0))},1),e.registerCommand(vo,t=>QC(e)===null?e.read(`latest`,()=>{let n=J();if(q(n)&&n.isCollapsed()){let{anchor:r}=n,i=r.type===`element`;if(i||r.offset===0){let n=r.getNode(),a=G(n,e=>I(e)&&!e.isInline());if(Z(a)){let r=a.getParent();if(X(r)&&r.getListType()===`check`&&(i||a.getFirstDescendant()===n)){let n=e.getElementByKey(a.__key);if(n!=null&&If(n)!==n)return n.focus(),t.preventDefault(),!0}}}}return!1}):(XC(e),!1),1),e.registerRootListener(t=>{if(t!==null)return eh(nh(t,{click:e=>{s(),(e=>{i(e)||YC(e,r())})(e)},pointerup:e=>{s(),(e=>{e.pointerType===`touch`&&(i(e)||((e=>{let t=e.target;W(t)&&(t.__lexicalCheckListLastHandled=e.timeStamp)})(e),YC(e,r())))})(e)}}),nh(t,{beforeinput:()=>XC(e),focusin:()=>{wa&&a===`content`&&XC(e)},keydown:t=>{GC.has(t.key)||XC(e)},mousedown:o,pointerdown:o},{capture:!0}),th(t,`touchstart`,o,{capture:!0,passive:!1}))}))}function JC(e,t){let n=e.target;if(!W(n))return;let r=n.firstChild;if(W(r)&&(r.tagName===`UL`||r.tagName===`OL`))return;let i=n.parentNode;if(!i||i.__lexicalListType!==`check`)return;let a=null,o=null;if(`clientX`in e)a=e.clientX;else if(`touches`in e){let t=e.touches;t.length>0&&(a=t[0].clientX,o=`touch`)}if(a==null)return;let s=n.getBoundingClientRect(),c=a/vb(n),l=n.ownerDocument.defaultView,u=l?l.getComputedStyle(n,`::before`):{width:`0px`},d=parseFloat(u.width),f=o===`touch`||`pointerType`in e&&e.pointerType===`touch`?32:0;(n.dir===`rtl`?c<s.right+f&&c>s.right-d-f:c>s.left-f&&c<s.left+d+f)&&t()}function YC(e,t){JC(e,()=>{if(W(e.target)){let n=e.target,r=fd(n);r!=null&&r.isEditable()&&r.update(()=>{let e=Ad(n);Z(e)&&(t?(cf(`skip-selection-focus`),cf(`skip-dom-selection`)):n.focus(),e.toggleChecked())})}})}function XC(e){let t=e.getRootElement(),n=t?If(t):null;t!==null&&W(n)&&ZC(n)&&t.focus({preventScroll:!0})}function ZC(e){let t=e.parentNode;return e.tagName===`LI`&&t!=null&&t.__lexicalListType===`check`}function QC(e){let t=e.getRootElement(),n=t?If(t):null;return W(n)&&ZC(n)?n:null}function $C(e,t,n){let r=QC(t);if(r!=null){let i=null;t.update(()=>{let a=Ad(r);if(!Z(a))return;let o=function(e,t){let n=t?e.getPreviousSibling():e.getNextSibling(),r=e;for(;n==null&&Z(r);)r=r.getParentOrThrow().getParent(),r!=null&&(n=t?r.getPreviousSibling():r.getNextSibling());for(;Z(n);){let e=t?n.getLastChild():n.getFirstChild();if(!X(e))return n;n=t?e.getLastChild():e.getFirstChild()}return null}(a,n);o!=null&&(o.selectStart(),t.getElementByKey(o.__key)!=null&&(e.preventDefault(),i=o.__key))},{onUpdate:()=>{(i===null?null:t.getElementByKey(i))?.focus()}})}return!1}var ew=N(`UPDATE_LIST_START_COMMAND`),tw=N(`INSERT_UNORDERED_LIST_COMMAND`),nw=N(`INSERT_ORDERED_LIST_COMMAND`),rw=N(`REMOVE_LIST_COMMAND`);function iw(e,t){return eh(e.registerCommand(nw,()=>(gC(`number`),!0),1),e.registerCommand(ew,e=>{let{listNodeKey:t,newStart:n}=e,r=B(t);return!!X(r)&&(r.getListType()===`number`&&(r.setStart(n),CC(r)),!0)},1),e.registerCommand(tw,()=>(gC(`bullet`),!0),1),e.registerCommand(rw,()=>(SC(),!0),1),e.registerCommand(io,()=>EC(!(!t||!t.restoreNumbering)),1),e.registerCommand(wo,e=>{let t=J();if(!q(t)||!t.isCollapsed())return!1;let{anchor:n}=t;if(n.offset!==0)return!1;let r=n.getNode();for(;!Z(r);){if(r.getPreviousSibling()!==null)return!1;let e=r.getParent();if(e===null)return!1;r=e}return!(!Z(r)||!r.collapseAtStart(t)||(e.preventDefault(),0))},-8),e.registerNodeTransform(BC,e=>{let t=e.getFirstChild();if(t){if(R(t)){let n=t.getStyle(),r=t.getFormat();e.getTextStyle()!==n&&e.setTextStyle(n),e.getTextFormat()!==r&&e.setTextFormat(r)}}else{let t=J();q(t)&&(t.style!==e.getTextStyle()||t.format!==e.getTextFormat())&&t.isCollapsed()&&e.is(t.anchor.getNode())&&e.setTextStyle(t.style).setTextFormat(t.format)}}),e.registerNodeTransform(hu,e=>{let t=e.getParent();if(Z(t)&&e.is(t.getFirstChild())){let n=e.getStyle(),r=e.getFormat();n===t.getTextStyle()&&r===t.getTextFormat()||t.setTextStyle(n).setTextFormat(r)}}))}function aw(e){let t=e=>{let t=e.getParent();if(X(e.getFirstChild())||!X(t))return;let n=G(e,e=>Z(e)&&X(e.getParent())&&Z(e.getPreviousSibling()));if(n===null&&e.getIndent()>0)e.setIndent(0);else if(Z(n)){let r=n.getPreviousSibling();if(Z(r)){let n=function(e){let t=e,n=t.getFirstChild();for(;X(n);){let e=n.getLastChild();if(!Z(e))break;t=e,n=t.getFirstChild()}return t}(r).getParent();if(X(n)){let r=lC(n);r+1<lC(t)&&e.setIndent(r)}}}};return e.registerNodeTransform(FC,e=>{let n=[e];for(;n.length>0;){let e=n.shift();if(X(e)){for(let r of e.getChildren())if(Z(r)){t(r);let e=r.getFirstChild();X(e)&&n.push(e)}}}})}function ow({validateUrl:e,attributes:t}){let[n]=ma();return(0,A.useEffect)(()=>{if(!n.hasNodes([kS]))throw Error(`LinkPlugin: LinkNode not registered on editor`)}),(0,A.useEffect)(()=>KS(n,Ey({attributes:t,validateUrl:e})),[n,e,t]),null}function sw({hasStrictIndent:e=!1,shouldPreserveNumbering:t=!1}){let[n]=ma();return(0,A.useEffect)(()=>{if(!n.hasNodes([FC,BC]))throw Error(`ListPlugin: ListNode and/or ListItemNode not registered on editor`)},[n]),(0,A.useEffect)(()=>eh(iw(n,{restoreNumbering:t}),e?aw(n):()=>{}),[n,e,t]),function(e){(0,A.useEffect)(()=>iw(e),[e])}(n),null}var cw={color:{text:`var(--rc-text)`,textSecondary:`var(--rc-text-secondary)`,textTertiary:`var(--rc-text-tertiary)`,textQuaternary:`var(--rc-text-quaternary)`,bg:`var(--rc-bg)`,bgSecondary:`var(--rc-bg-secondary)`,bgTertiary:`var(--rc-bg-tertiary)`,bgElevated:`var(--rc-bg-elevated)`,fill:`var(--rc-fill)`,fillSecondary:`var(--rc-fill-secondary)`,fillTertiary:`var(--rc-fill-tertiary)`,fillQuaternary:`var(--rc-fill-quaternary)`,border:`var(--rc-border)`,borderSubtle:`var(--rc-border-subtle)`,ring:`var(--rc-ring)`,scrim:`var(--rc-scrim)`,accent:`var(--rc-accent)`,accentLight:`var(--rc-accent-light)`,link:`var(--rc-link)`,codeText:`var(--rc-code-text)`,codeBg:`var(--rc-code-bg)`,codeHeaderBg:`var(--rc-code-header-bg)`,hrBorder:`var(--rc-hr-border)`,quoteBorder:`var(--rc-quote-border)`,quoteBg:`var(--rc-quote-bg)`,alertInfo:`var(--rc-alert-info)`,alertWarning:`var(--rc-alert-warning)`,alertTip:`var(--rc-alert-tip)`,alertCaution:`var(--rc-alert-caution)`,alertImportant:`var(--rc-alert-important)`},spacing:{xs:`var(--rc-space-xs)`,sm:`var(--rc-space-sm)`,md:`var(--rc-space-md)`,lg:`var(--rc-space-lg)`,xl:`var(--rc-space-xl)`},flow:{paragraph:`var(--rc-flow-paragraph)`,list:`var(--rc-flow-list)`,block:`var(--rc-flow-block)`,heading:`var(--rc-flow-heading)`},typography:{fontFamily:`var(--rc-font-family)`,fontFamilySans:`var(--rc-font-family-sans)`,fontFamilySerif:`var(--rc-font-family-serif)`,fontFamilyKai:`var(--rc-font-family-kai)`,fontMono:`var(--rc-font-mono)`,fontSize2xs:`var(--rc-font-size-2xs)`,fontSizeXs:`var(--rc-font-size-xs)`,fontSizeSm:`var(--rc-font-size-sm)`,fontSizeMd:`var(--rc-font-size-md)`,fontSizeLg:`var(--rc-font-size-lg)`,fontSizeBase:`var(--rc-font-size-base)`,fontSizeSmall:`var(--rc-font-size-small)`,fontSizeCode:`var(--rc-font-size-code)`,fontSizeCaption:`var(--rc-font-size-caption)`,lineHeight:`var(--rc-line-height)`,lineHeightTight:`var(--rc-line-height-tight)`,lineHeightCompact:`var(--rc-line-height-compact)`,lineHeightCode:`var(--rc-line-height-code)`},borderRadius:{sm:`var(--rc-radius-sm)`,md:`var(--rc-radius-md)`,lg:`var(--rc-radius-lg)`},layout:{maxWidth:`var(--rc-max-width)`},boxShadow:{xs:`var(--rc-shadow-xs)`,topBar:`var(--rc-shadow-top-bar)`,modal:`var(--rc-shadow-modal)`,menu:`var(--rc-shadow-menu)`}},lw={fontFamilySans:`-apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"`,fontFamilySerif:`"Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif`,fontFamilyKai:`"楷体", KaiTi, STKaiti, "Kaiti SC", "LXGW WenKai", "霞鹜文楷", "Noto Serif CJK SC", serif`,fontMono:`"SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, "PingFang SC", "Noto Sans SC", monospace`},uw={fontFamilySans:lw.fontFamilySans,fontFamilySerif:lw.fontFamilySerif,fontFamilyKai:lw.fontFamilyKai,fontMono:lw.fontMono,fontSize2xs:`0.625em`,fontSizeXs:`0.75em`,fontSizeSm:`0.8125em`,fontSizeMd:`0.875em`,fontSizeLg:`1.25em`,fontSizeBase:`16px`,fontSizeSmall:`14px`,fontSizeCode:`0.8125em`,fontSizeCaption:`0.8125em`,lineHeight:`1.75`,lineHeightTight:`1.35`,lineHeightCompact:`1.6`,lineHeightCode:`1.7`},dw={paragraph:`1.25em`,list:`0.375em`,block:`2em`,heading:`2em`},fw={paragraph:`0.6em`,list:`0.25em`,block:`1em`,heading:`1em`};({...uw}),lw.fontFamilySans,{...dw},{...uw},lw.fontFamilySerif,{...uw},lw.fontFamilySans,{...fw},{...uw},lw.fontFamilySans;var pw=A.createContext({className:``,theme:`light`}),mw=A.createContext(null);mw.Provider;function hw(){return A.useContext(mw)??document.body}function gw({className:e,theme:t,children:n}){return(0,j.jsx)(pw.Provider,{value:A.useMemo(()=>({className:e,theme:t}),[e,t]),children:n})}function _w(){return A.useContext(pw)}function vw({children:e}){let{className:t,theme:n}=_w();return t?(0,j.jsx)(`div`,{suppressHydrationWarning:!0,className:t,"data-theme":n,style:{display:`contents`},children:e}):e}function yw(e){let{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,autoComplete:a,...o}=e;return(0,j.jsx)(Pi,{...o,selectionMode:t?`multiple`:`single`,selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i,formAutoComplete:a})}var bw={letterSpacing:`normal`,wordSpacing:`normal`,fontFeatureSettings:`normal`,fontVariant:`normal`,fontStyle:`normal`,fontWeight:400,textTransform:`none`,textIndent:0,color:cw.color.text};({...bw}),cw.typography.fontFamilySans,{...bw},cw.typography.fontFamily,cw.typography.fontMono;var xw={sm:`280px`,md:`320px`,lg:`400px`};`${cw.color.accent}${cw.color.accentLight}`,cw.color.textQuaternary,cw.color.textTertiary,cw.color.textSecondary,cw.color.text;function Sw(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Cw(e){var t=Sw(e,`string`);return typeof t==`symbol`?t:String(t)}function ww(e,t,n){return t=Cw(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Tw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ew(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Tw(Object(n),!0).forEach(function(t){ww(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tw(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Dw(e,t){var n={};for(var r in e)n[r]=t(e[r],r);return n}var Ow=(e,t,n)=>{for(var r of Object.keys(e))if(e[r]!==(t[r]??n[r]))return!1;return!0},kw=e=>{var t=t=>{var n=e.defaultClassName,r=Ew(Ew({},e.defaultVariants),t);for(var i in r){var a=r[i]??e.defaultVariants[i];if(a!=null){var o=a;typeof o==`boolean`&&(o=o===!0?`true`:`false`);var s=e.variantClassNames[i][o];s&&(n+=` `+s)}}for(var[c,l]of e.compoundVariants)Ow(c,r,e.defaultVariants)&&(n+=` `+l);return n};return t.variants=()=>Object.keys(e.variantClassNames),t.classNames={get base(){return e.defaultClassName.split(` `)[0]},get variants(){return Dw(e.variantClassNames,e=>Dw(e,e=>e.split(` `)[0]))}},t},Aw={1:`_73ej2i1`,2:`_73ej2i2`,3:`_73ej2i3`,4:`_73ej2i4`},jw={actionBar:`re-ui-action-bar`,actionButton:`re-ui-action-btn`,actionButtonEnd:`re-ui-action-btn--end`,actionButtonDanger:`re-ui-action-btn--danger`,actionButtonIcon:`re-ui-action-btn--icon`},Mw=kw({defaultClassName:`_73ej2i6`,variantClassNames:{variant:{ghost:`_73ej2i7`,solid:`_73ej2i8`,outline:`_73ej2i9`,accent:`_73ej2ia`},size:{sm:`_73ej2ib`,md:`_73ej2ic`,lg:`_73ej2id`},icon:{true:`_73ej2ie`,false:`_73ej2if`},end:{true:`_73ej2ig`,false:`_73ej2ih`},danger:{true:`_73ej2ii`,false:`_73ej2ij`},rounded:{true:`_73ej2ik`,false:`_73ej2il`}},defaultVariants:{variant:`ghost`,size:`sm`,icon:!1,end:!1,danger:!1,rounded:!1},compoundVariants:[[{icon:!0,size:`sm`},`_73ej2im`],[{icon:!0,size:`md`},`_73ej2in`],[{icon:!0,size:`lg`},`_73ej2io`],[{icon:!0,variant:`outline`},`_73ej2ip`],[{icon:!0,variant:`ghost`},`_73ej2iq`],[{rounded:!0,icon:!0},`_73ej2ir`],[{danger:!0,variant:`solid`},`_73ej2is`],[{danger:!0},`_73ej2it`]]});function Nw({variant:e,size:t,end:n=!1,danger:r=!1,icon:i=!1,rounded:a=!1,level:o,className:s,type:c=`button`,...l}){let u=[jw.actionButton];n&&u.push(jw.actionButtonEnd),r&&u.push(jw.actionButtonDanger),i&&u.push(jw.actionButtonIcon),o&&!i&&u.push(Aw[o]);let d=Mw({variant:e,size:t,end:n,danger:r,icon:i,rounded:a});return(0,j.jsx)(`button`,{className:`${d} ${u.join(` `)}${s?` ${s}`:``}`,type:c,...l})}function Pw(e){let{level:t,...n}=e??{},r=t?` ${Aw[t]}`:``;return`${Mw(n)} ${jw.actionButton}${r}`}kw({defaultClassName:`_15r7gwx5`,variantClassNames:{variant:{info:`_15r7gwx6`,success:`_15r7gwx7`,warning:`_15r7gwx8`,error:`_15r7gwx9`,neutral:`_15r7gwxa`}},defaultVariants:{variant:`info`},compoundVariants:[]});var Fw=`_1b25hgb0`,Iw=`_1b25hgb1`;(0,A.forwardRef)(function({maxRows:e=6,minRows:t=1,className:n,onInput:r,...i},a){let o=(0,A.useRef)(null);(0,A.useImperativeHandle)(a,()=>o.current);let s=(0,A.useCallback)(()=>{let t=o.current;if(!t)return;t.style.height=`auto`;let n=(Number.parseFloat(getComputedStyle(t).lineHeight)||21)*e+16,r=t.scrollHeight;r>n?(t.style.height=`${n}px`,t.classList.add(Iw)):(t.style.height=`${r}px`,t.classList.remove(Iw))},[e]);return(0,A.useEffect)(()=>{s()},[s,i.value]),(0,j.jsx)(`textarea`,{className:`${Fw}${n?` ${n}`:``}`,ref:o,rows:t,onInput:e=>{s(),r?.(e)},...i})}),kw({defaultClassName:`_1vt0sm10`,variantClassNames:{variant:{neutral:`_1vt0sm11`,success:`_1vt0sm12`,error:`_1vt0sm13`,warning:`_1vt0sm14`,info:`_1vt0sm15`},size:{sm:`_1vt0sm16`,md:`_1vt0sm17`}},defaultVariants:{variant:`neutral`,size:`sm`},compoundVariants:[]});var Lw=`_10muorc0`,Rw=`_10muorc2`,zw=`_10muorc3`,Bw=`_10muorc4`,Vw=`_10muorc5`,Hw=`_10muorc6`,Uw=`_10muorc7`;function Ww(...e){return e.filter(Boolean).join(` `)}function Gw({label:e,description:t,checked:n,defaultChecked:r=!1,indeterminate:i=!1,onChange:a,disabled:o=!1,className:s}){let[c,l]=(0,A.useState)(r),u=n!==void 0,d=u?n:c,f=i||d;return(0,j.jsxs)(`button`,{"aria-checked":i?`mixed`:d,"aria-disabled":o,className:Ww(Lw,o&&`_10muorc1`,s),role:`checkbox`,type:`button`,onClick:()=>{if(o)return;let e=i?!0:!d;u||l(e),a?.(e)},children:[(0,j.jsxs)(`span`,{className:Ww(Rw,f?Bw:zw),children:[(0,j.jsx)(`svg`,{"aria-hidden":!0,className:Ww(Vw,d&&!i?Hw:Uw),fill:`none`,viewBox:`0 0 12 12`,children:(0,j.jsx)(`path`,{d:`M2.5 6.25L5 8.75L9.5 3.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.75`})}),(0,j.jsx)(`svg`,{"aria-hidden":!0,className:Ww(Vw,i?Hw:Uw),fill:`none`,viewBox:`0 0 12 12`,children:(0,j.jsx)(`path`,{d:`M3 6H9`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.75`})})]}),(e||t)&&(0,j.jsxs)(`span`,{className:`_10muorc8`,children:[e&&(0,j.jsx)(`span`,{className:Ww(`_10muorc9`,o&&`_10muorca`),children:e}),t&&(0,j.jsx)(`span`,{className:`_10muorcb`,children:t})]})]})}var Kw={javascript:`#f7df1e`,js:`#f7df1e`,typescript:`#3178c6`,ts:`#3178c6`,jsx:`#61dafb`,tsx:`#61dafb`,html:`#e34f26`,css:`#1572b6`,scss:`#cc6699`,json:`#f59e0b`,markdown:`#737373`,md:`#737373`,bash:`#4eaa25`,sh:`#4eaa25`,shell:`#4eaa25`,zsh:`#4eaa25`,python:`#3776ab`,py:`#3776ab`,rust:`#dea584`,go:`#00add8`,java:`#b07219`,c:`#a8b9cc`,cpp:`#00599c`,"c++":`#00599c`,swift:`#fa7343`,kotlin:`#7f52ff`,yaml:`#cb171e`,yml:`#cb171e`,sql:`#e38c00`};function qw(e){return e&&e.trim().toLowerCase()||`text`}var Jw={typescript:`TypeScript`,javascript:`JavaScript`,python:`Python`,shell:`Shell`,bash:`Shell`,sh:`Shell`,zsh:`Shell`,rust:`Rust`,go:`Go`,swift:`Swift`,kotlin:`Kotlin`,java:`Java`,cpp:`C++`,csharp:`C#`,ruby:`Ruby`,markdown:`Markdown`,vue:`Vue`,dart:`Dart`,lua:`Lua`,diff:`Diff`};function Yw(e){return e===`text`?`TEXT`:Jw[e]??e.toUpperCase()}var Xw=`_1gq8hf90`,Zw=`_1gq8hf95`,Qw=`_1gq8hf96 _1gq8hf95`,$w=`_1gq8hf97`,eT=(0,j.jsx)(Kt,{size:14}),tT=(0,j.jsx)(u,{size:14}),nT=(0,j.jsx)(x,{size:14});function rT({children:e,chrome:t=`bar`,className:n,code:r,collapsible:i=!0,language:a,showCopyButton:o=!0,static:s=!1}){let c=qw(a),l=!!a&&c!==`text`,u=t===`compact`?c:Yw(c),d=Kw[c]||`#737373`,f=(0,A.useMemo)(()=>r.split(`
|
|
12
|
-
`).length,[r]),p=(0,A.useMemo)(()=>({"--rc-ln-digits":Math.max(2,String(f).length)}),[f]),[m,h]=(0,A.useState)(!1),g=(0,A.useRef)(void 0),[_,v]=(0,A.useState)(!0),[y,b]=(0,A.useState)(!1),x=(0,A.useRef)(null);(0,A.useEffect)(()=>{if(!i){b(!1);return}let e=x.current;if(!e)return;let t=requestAnimationFrame(()=>{let t=window.innerHeight/2;b(e.scrollHeight>=t)});return()=>cancelAnimationFrame(t)},[e,r,i]),(0,A.useEffect)(()=>()=>clearTimeout(g.current),[]);let S=(0,A.useCallback)(()=>{navigator.clipboard.writeText(r).then(()=>{h(!0),clearTimeout(g.current),g.current=setTimeout(()=>h(!1),2e3)}).catch(()=>{})},[r]),C=i&&y&&_,w=[$w,C&&`_1gq8hf98`].filter(Boolean).join(` `),T=l||o;return(0,j.jsxs)(`div`,{className:`${Xw}${n?` ${n}`:``}`,"data-chrome":t,style:p,children:[T&&(0,j.jsxs)(`div`,{className:`_1gq8hf91`,children:[(0,j.jsx)(`div`,{className:`_1gq8hf92`,children:l&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{"aria-hidden":!0,className:`_1gq8hf93`,style:{backgroundColor:d}}),(0,j.jsx)(`span`,{children:u})]})}),o&&(0,j.jsxs)(`button`,{"aria-label":m?`Copied`:`Copy code`,className:`_1gq8hf94`,"data-copied":m||void 0,type:`button`,onClick:S,children:[m?tT:eT,(0,j.jsx)(`span`,{children:m?`Copied`:`Copy`})]})]}),(0,j.jsxs)(`div`,{className:s?Qw:Zw,children:[(0,j.jsx)(`div`,{className:w,ref:x,children:e}),C&&(0,j.jsx)(`div`,{"aria-hidden":!0,className:`_1gq8hf99`})]}),C&&(0,j.jsxs)(`button`,{className:`_1gq8hf9a`,type:`button`,onClick:()=>v(!1),children:[(0,j.jsx)(`span`,{children:`Expand all · ${f} lines`}),nT]})]})}var iT={ini:`toml`,plaintext:`text`,properties:`toml`},aT=null;async function oT(){let[e,t,r]=await Promise.all([n(()=>import(`./default-Ckb1jcnl.js`),[],import.meta.url),n(()=>import(`./github-light-B4HDwToD.js`),[],import.meta.url),n(()=>import(`./github-dark-C895GGrm.js`),[],import.meta.url)]);return{core:e,dark:r.default,light:t.default}}function sT(){return aT??=oT().then(e=>e,e=>{throw aT=null,e}),aT}function cT(e,t,n,r){let{core:i,dark:a,light:o}=e,s=fT(n,i.isSupportedLanguage);return i.codeToTokens(t,{cssVariablePrefix:r,lang:s,themes:{light:o,dark:a}})}function lT(e){return e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`)}function uT(e){if(e.htmlStyle)return Object.entries(e.htmlStyle).map(([e,t])=>`${e}:${t}`).join(`;`);let t=e.color?[`color:${e.color}`]:[],n=e.fontStyle??0;return n&1&&t.push(`font-style:italic`),n&2&&t.push(`font-weight:bold`),n&4&&t.push(`text-decoration:underline`),t.join(`;`)}function dT(e){let t=uT(e);return`<span${t?` style="${lT(t).replaceAll(`"`,`"`)}"`:``}>${lT(e.content)}</span>`}function fT(e,t){let n=e?.trim().toLowerCase()||`text`,r=iT[n]??n;return t(r)?r:`text`}async function pT(e,t,n){let r=await sT(),{core:i,dark:a,light:o}=r,{tokens:s,fg:c,bg:l}=n?i.codeToTokens(e,{lang:fT(t,i.isSupportedLanguage),theme:n===`dark`?a:o}):cT(r,e,t);return`<pre class="${n?`highlights`:`highlights highlights-themes`}" style="background-color:${l};color:${c}"><code>${s.map(e=>`<span class="line">${e.map(dT).join(``)}</span>`).join(`
|
|
13
|
-
`)}</code></pre>`}var mT=[{id:`angular-html`,name:`Angular HTML`},{id:`angular-ts`,name:`Angular TypeScript`},{id:`asm`,name:`Assembly`},{id:`astro`,name:`Astro`},{id:`bat`,name:`Batch`},{id:`c`,name:`C`},{id:`c3`,name:`C3`},{id:`clojure`,name:`Clojure`},{id:`cmake`,name:`CMake`},{id:`cpp`,name:`C++`},{id:`csharp`,name:`C#`},{id:`css`,name:`CSS`},{id:`cuda`,name:`CUDA`},{id:`dart`,name:`Dart`},{id:`diff`,name:`Diff`},{id:`docker`,name:`Dockerfile`},{id:`elixir`,name:`Elixir`},{id:`elm`,name:`Elm`},{id:`erlang`,name:`Erlang`},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`},{id:`fortran-free-form`,name:`Fortran (Free Form)`},{id:`fsharp`,name:`F#`},{id:`gdresource`,name:`GDResource`},{id:`gdscript`,name:`GDScript`},{id:`gdshader`,name:`GDShader`},{id:`gleam`,name:`Gleam`},{id:`glsl`,name:`GLSL`},{id:`go`,name:`Go`},{id:`graphql`,name:`GraphQL`},{id:`groovy`,name:`Groovy`},{id:`haskell`,name:`Haskell`},{id:`hlsl`,name:`HLSL`},{id:`html`,name:`HTML`},{id:`java`,name:`Java`},{id:`javascript`,name:`JavaScript`},{id:`json`,name:`JSON`},{id:`json5`,name:`JSON5`},{id:`jsonl`,name:`JSON Lines`},{id:`jsx`,name:`JSX`},{id:`julia`,name:`Julia`},{id:`kotlin`,name:`Kotlin`},{id:`latex`,name:`LaTeX`},{id:`less`,name:`Less`},{id:`lisp`,name:`Lisp`},{id:`lua`,name:`Lua`},{id:`make`,name:`Makefile`},{id:`markdown`,name:`Markdown`},{id:`matlab`,name:`MATLAB`},{id:`mdx`,name:`MDX`},{id:`nim`,name:`Nim`},{id:`nix`,name:`Nix`},{id:`objective-c`,name:`Objective-C`},{id:`ocaml`,name:`OCaml`},{id:`pascal`,name:`Pascal`},{id:`perl`,name:`Perl`},{id:`php`,name:`PHP`},{id:`powershell`,name:`PowerShell`},{id:`proto`,name:`Protocol Buffer`},{id:`python`,name:`Python`},{id:`r`,name:`R`},{id:`ruby`,name:`Ruby`},{id:`rust`,name:`Rust`},{id:`sass`,name:`Sass`},{id:`scala`,name:`Scala`},{id:`scss`,name:`SCSS`},{id:`shellscript`,name:`Shell`},{id:`solidity`,name:`Solidity`},{id:`sql`,name:`SQL`},{id:`svelte`,name:`Svelte`},{id:`swift`,name:`Swift`},{id:`terraform`,name:`Terraform`},{id:`toml`,name:`TOML`},{id:`tsrx`,name:`TSRX`},{id:`tsx`,name:`TSX`},{id:`typescript`,name:`TypeScript`},{id:`vue`,name:`Vue`},{id:`wasm`,name:`WebAssembly`},{id:`wgsl`,name:`WGSL`},{id:`xml`,name:`XML`},{id:`yaml`,name:`YAML`},{id:`zig`,name:`Zig`}];function hT({chrome:e,className:t,collapsible:n=!0,code:r,language:i,showCopyButton:a=!0,showLineNumbers:o=!1}){let s=qw(i),[c,l]=(0,A.useState)(null);(0,A.useEffect)(()=>{let e=!1;return l(null),pT(r,s).then(t=>{e||l(t)}).catch(()=>{}),()=>{e=!0}},[r,s]);let u=(0,A.useMemo)(()=>r.split(`
|
|
14
|
-
`),[r]),d=[o&&`_1gq8hf9b`,o&&`_1gq8hf9c`].filter(Boolean).join(` `);return(0,j.jsx)(rT,{static:!0,chrome:e,className:t,code:r,collapsible:n,language:i,showCopyButton:a,children:c?(0,j.jsx)(`div`,{className:d,dangerouslySetInnerHTML:{__html:c}}):(0,j.jsx)(`pre`,{className:d,children:(0,j.jsx)(`code`,{children:u.map((e,t)=>(0,j.jsx)(`span`,{className:`line`,children:e},t))})})})}function gT(e){let t=(0,A.createContext)(void 0);return[({value:e,children:n})=>(0,j.jsx)(t.Provider,{value:e,children:n}),()=>{let n=(0,A.use)(t);if(n===void 0)throw Error(`useContext must be used within ${e??`a Provider`}`);return n}]}var _T=`f2q44l0`,vT={sm:`f2q44l4`,md:`f2q44l5`,lg:`f2q44l6`},yT=`f2q44l7`,bT=`f2q44l8`,xT=`f2q44la`,ST=`f2q44lc`,CT=`f2q44ld`,[wT,TT]=gT(`PopoverContext`);function ET(e){let[t,n]=(0,A.useState)(e?.defaultOpen??!1);(0,A.useEffect)(()=>{e.open!==void 0&&n(e.open)},[e.open]);let r=(t,r)=>{n(t),e.onOpenChange?.(t,r)};return(0,j.jsx)(wT,{value:{isOpen:t},children:(0,j.jsx)(jt,{...e,onOpenChange:r})})}function DT(e){return(0,j.jsx)(It,{...e})}function OT({children:e,...t}){return(0,j.jsx)(Pt,{...t,children:(0,j.jsx)(vw,{children:e})})}function kT(e){return(0,j.jsx)(At,{...e})}function AT({className:e,children:t,flush:n,size:r,...i}){let a=[_T];return r&&a.push(vT[r]),n&&a.push(yT),e&&a.push(e),(0,j.jsx)(Ft,{className:a.join(` `),...i,children:t})}function jT({align:e=`center`,side:t,sideOffset:n=8,className:r,children:i,...a}){return(0,j.jsx)(OT,{children:(0,j.jsx)(kT,{align:e,side:t,sideOffset:n,children:(0,j.jsx)(AT,{className:r,...a,children:i})})})}function MT({actions:e,className:t,icon:n,title:r}){return(0,j.jsxs)(`div`,{className:`${bT}${t?` ${t}`:``}`,children:[n&&(0,j.jsx)(`span`,{className:`f2q44l9`,children:n}),(0,j.jsx)(`span`,{className:xT,children:r}),e&&(0,j.jsx)(`span`,{className:`f2q44lb`,children:e})]})}function NT({children:e,className:t}){return(0,j.jsx)(`div`,{className:`${ST}${t?` ${t}`:``}`,children:e})}function PT({children:e,className:t,hint:n}){return(0,j.jsxs)(`div`,{className:`${CT}${t?` ${t}`:``}`,children:[n&&(0,j.jsx)(`span`,{className:`f2q44le`,children:n}),e]})}var FT={ctrl:`mod`,control:`mod`,cmd:`mod`,command:`mod`,meta:`mod`,mod:`mod`,option:`alt`,opt:`alt`,alt:`alt`,shift:`shift`,return:`enter`,enter:`enter`,esc:`escape`,escape:`escape`,backspace:`backspace`,del:`delete`,delete:`delete`,arrowup:`up`,up:`up`,arrowdown:`down`,down:`down`,arrowleft:`left`,left:`left`,arrowright:`right`,right:`right`,"⌘":`mod`,"⌃":`mod`,"⇧":`shift`,"⌥":`alt`,"↵":`enter`,"⏎":`enter`,"⌫":`backspace`,"⌦":`delete`,"↑":`up`,"↓":`down`,"←":`left`,"→":`right`},IT=/[←↑→↓↵⇧⌃⌘⌥⌦⌫⏎]/g;function LT(e){let t=e.trim().toLowerCase();return FT[t]??t}function RT(e){return(e.includes(`+`)?e.split(`+`):e.replaceAll(IT,e=>`+${e}+`).split(`+`)).filter(e=>e.trim()!==``).map(LT)}var zT={mod:{label:`⌘`,name:`Command`},shift:{label:`⇧`,name:`Shift`},alt:{label:`⌥`,name:`Option`}},BT={mod:{label:`Ctrl`,name:`Control`},shift:{label:`Shift`,name:`Shift`},alt:{label:`Alt`,name:`Alt`}},VT={enter:`Enter`,backspace:`Backspace`,delete:`Delete`,up:`Up`,down:`Down`,left:`Left`,right:`Right`},HT={escape:{label:`Esc`,name:`Escape`},tab:{label:`Tab`,name:`Tab`},space:{label:`Space`,name:`Space`}};function UT(e,t){let n=t===`mac`?zT:BT;if(n[e])return n[e];if(e in VT)return{icon:e,name:VT[e]};if(HT[e])return HT[e];let r=e.length===1?e.toUpperCase():e[0].toUpperCase()+e.slice(1);return{label:r,name:r}}function WT(e){if(!e)return`other`;let t=`${e.platform??``} ${e.userAgent??``}`;return/mac|iphone|ipad|ipod/i.test(t)?`mac`:`other`}var GT=`lhlko40`,KT=`lhlko41`,qT={sm:`lhlko42`,md:`lhlko43`},JT={default:`lhlko44`,muted:`lhlko45`,inverted:`lhlko46`},YT=`lhlko47`,XT=`lhlko48`,ZT=`lhlko49`,QT={enter:yt,backspace:Nt,delete:Nt,up:Mt,down:Tt,left:wt,right:Ct},$T=()=>()=>{},eE=()=>WT(typeof navigator>`u`?void 0:navigator),tE=()=>`other`;function nE(){return(0,A.useSyncExternalStore)($T,eE,tE)}function rE({className:e,keys:t,platform:n,size:r=`md`,tone:i=`default`}){let a=nE(),o=n??a,s=(typeof t==`string`?RT(t):t).map(e=>UT(e,o)),c=r===`sm`?11:12,l=`${KT} ${qT[r]} ${JT[i]}`;return(0,j.jsxs)(`kbd`,{className:`${GT}${e?` ${e}`:``}`,children:[(0,j.jsx)(`span`,{className:ZT,"data-slot":`kbd-label`,children:s.map(e=>e.name).join(` `)}),s.map((e,t)=>{let n=e.icon?QT[e.icon]:void 0;return(0,j.jsx)(`kbd`,{"aria-hidden":`true`,className:l,children:n?(0,j.jsx)(n,{className:e.icon===`delete`?`${YT} ${XT}`:YT,size:c,strokeWidth:2}):e.label},`${e.name}-${t}`)})]})}var iE=`_1cspf2m0`,aE=`_1cspf2m1`;function oE(e){return(0,j.jsx)(Zr,{...e})}function sE(e){return(0,j.jsx)(Rt,{...e})}function cE(e){return(0,j.jsx)(Et,{...e})}function lE({children:e,...t}){return(0,j.jsx)(kt,{...t,children:(0,j.jsx)(vw,{children:e})})}function uE(e){return(0,j.jsx)(Lt,{...e})}function dE({className:e,children:t,shortcut:n,...r}){return(0,j.jsxs)(Ot,{className:`${aE}${e?` ${e}`:``}`,...r,children:[t,n&&(0,j.jsx)(rE,{className:`_1cspf2m2`,keys:n,size:`sm`,tone:`inverted`})]})}function fE({side:e=`top`,sideOffset:t=6,align:n=`center`,className:r,children:i,...a}){return(0,j.jsx)(lE,{children:(0,j.jsx)(uE,{align:n,className:iE,side:e,sideOffset:t,children:(0,j.jsx)(dE,{className:r,...a,children:i})})})}var pE=$r,mE=(e,t,n)=>e<t?t:e>n?n:e,hE=e=>Math.round(mE(e,0,1)*255),gE=e=>e.toString(16).padStart(2,`0`);function _E(e,t,n){let r=(e%360+360)%360/60,i=mE(t,0,1),a=mE(n,0,1),o=a*i,s=o*(1-Math.abs(r%2-1)),c=a-o,l,u,d;return r<1?[l,u,d]=[o,s,0]:r<2?[l,u,d]=[s,o,0]:r<3?[l,u,d]=[0,o,s]:r<4?[l,u,d]=[0,s,o]:r<5?[l,u,d]=[s,0,o]:[l,u,d]=[o,0,s],{r:l+c,g:u+c,b:d+c}}function vE(e,t,n){let r=Math.max(e,t,n),i=r-Math.min(e,t,n),a=r,o=r===0?0:i/r,s=0;return i!==0&&(s=r===e?(t-n)/i%6:r===t?(n-e)/i+2:(e-t)/i+4,s*=60,s<0&&(s+=360)),{h:s,s:o,v:a}}function yE(e){let{r:t,g:n,b:r}=_E(e.h,e.s,e.v),i=`#${gE(hE(t))}${gE(hE(n))}${gE(hE(r))}`;return e.a<1?`${i}${gE(hE(e.a))}`:i}function bE(e){let t=e.trim().replace(/^#/,``);return!/^[\da-f]+$/i.test(t)||((t.length===3||t.length===4)&&(t=t.split(``).map(e=>e+e).join(``)),t.length!==6&&t.length!==8)?null:{r:Number.parseInt(t.slice(0,2),16)/255,g:Number.parseInt(t.slice(2,4),16)/255,b:Number.parseInt(t.slice(4,6),16)/255,a:t.length===8?Number.parseInt(t.slice(6,8),16)/255:1}}function xE(e){let t=bE(e);if(!t)return null;let{h:n,s:r,v:i}=vE(t.r,t.g,t.b);return{h:n,s:r,v:i,a:t.a}}function SE(e){return yE({h:e,s:1,v:1,a:1})}var CE=`_17r50hf0`,wE=`_17r50hf1`,TE=`_17r50hf2`,EE=`_17r50hf3`,DE=`_17r50hf4`,OE=`_17r50hf5`,kE=`_17r50hf6`,AE=`_17r50hf7`,jE=`_17r50hf8`,ME=`_17r50hf9`,NE=`_17r50hfa`,PE=`_17r50hfb`,FE=`_17r50hfc`,IE=`_17r50hfd`,LE=`_17r50hfe`,RE=`_17r50hff`,zE=`_17r50hfg`,BE=`_17r50hfh`,VE=`_17r50hfi`,HE=`_17r50hfj`,UE=`_17r50hfk`,WE=`_17r50hfl`,GE=`_17r50hfm`,KE=`_17r50hfn`,qE=`_17r50hfo`,JE=`_17r50hfp`,YE=`_17r50hfq`,XE=`_17r50hfr`,ZE=`_17r50hfs`,QE=`_17r50hft`,$E=`_17r50hfu`,eD=`_17r50hfx`,tD=`_17r50hfy`,nD=`_17r50hfz`,rD=`_17r50hf10`,iD={h:0,s:0,v:0,a:1};function aD(e){return!e||e===`inherit`||e===`currentColor`?iD:xE(e)??iD}function oD({initialColor:e,onApply:t,onCancel:n,onBack:r}){let[i,a]=(0,A.useState)(()=>aD(e)),[o,s]=(0,A.useState)(()=>yE(aD(e))),[c,l]=(0,A.useState)(!1),[u,d]=(0,A.useState)(!1),f=(0,A.useRef)(e),p=(0,A.useRef)(null),m=(0,A.useRef)(null),h=(0,A.useRef)(null);(0,A.useEffect)(()=>{d(typeof window<`u`&&`EyeDropper`in window)},[]),(0,A.useEffect)(()=>{document.activeElement?.tagName!==`INPUT`&&(s(yE(i)),l(!1))},[i]);let g=yE(i),_=(e,t)=>{let n=e===`sat`?p.current:e===`hue`?m.current:h.current;if(!n)return;let r=n.getBoundingClientRect(),i=mE((t.clientX-r.left)/r.width,0,1),o=mE((t.clientY-r.top)/r.height,0,1);a(t=>e===`sat`?{...t,s:i,v:1-o}:e===`hue`?{...t,h:i*360}:{...t,a:i})},v=e=>t=>{t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),_(e,t)},y=e=>t=>{t.buttons!==0&&_(e,t)},b=e=>{s(e);let t=bE(e);if(!t){l(!0);return}l(!1);let{h:n,s:r,v:i}=vE(t.r,t.g,t.b);a({h:n,s:r,v:i,a:t.a})},x=()=>{c&&(s(g),l(!1))},S=async()=>{let e=window.EyeDropper;if(e)try{let t=bE((await new e().open()).sRGBHex);if(!t)return;let{h:n,s:r,v:i}=vE(t.r,t.g,t.b);a(e=>({h:n,s:r,v:i,a:e.a}))}catch{}},C=()=>t(g),w=SE(i.h),T=yE(i),E=f.current===`inherit`||!f.current?`transparent`:f.current;return(0,j.jsxs)(`div`,{className:BE,children:[(0,j.jsxs)(`button`,{"aria-label":`Back to presets`,className:VE,type:`button`,onClick:r,onMouseDown:e=>e.preventDefault(),children:[(0,j.jsx)(wt,{className:HE}),(0,j.jsx)(`span`,{children:`Back`})]}),(0,j.jsxs)(`div`,{className:UE,ref:p,style:{backgroundColor:w},onPointerDown:v(`sat`),onPointerMove:y(`sat`),children:[(0,j.jsx)(`div`,{className:WE}),(0,j.jsx)(`div`,{className:GE}),(0,j.jsx)(`div`,{className:KE,style:{left:`${i.s*100}%`,top:`${(1-i.v)*100}%`,backgroundColor:yE({...i,a:1})}})]}),(0,j.jsx)(`div`,{className:qE,ref:m,onPointerDown:v(`hue`),onPointerMove:y(`hue`),children:(0,j.jsx)(`div`,{className:XE,style:{left:`${i.h/360*100}%`,backgroundColor:w}})}),(0,j.jsxs)(`div`,{className:JE,ref:h,onPointerDown:v(`alpha`),onPointerMove:y(`alpha`),children:[(0,j.jsx)(`div`,{className:YE,style:{background:`linear-gradient(to right, transparent, ${yE({...i,a:1})})`}}),(0,j.jsx)(`div`,{className:XE,style:{left:`${i.a*100}%`,backgroundColor:g}})]}),(0,j.jsxs)(`div`,{className:ZE,children:[(0,j.jsx)(`input`,{"aria-invalid":c||void 0,"aria-label":`Hex color`,className:`${QE}${c?` ${$E}`:``}`,spellCheck:!1,type:`text`,value:o,onBlur:x,onChange:e=>b(e.target.value)}),u&&(0,j.jsx)(`button`,{"aria-label":`Pick color from screen`,className:`_17r50hfv`,type:`button`,onClick:S,onMouseDown:e=>e.preventDefault(),children:(0,j.jsx)(zn,{className:`_17r50hfw`})}),(0,j.jsxs)(`div`,{"aria-hidden":!0,className:eD,children:[(0,j.jsx)(`div`,{className:tD,style:{backgroundColor:E}}),(0,j.jsx)(`div`,{className:tD,style:{backgroundColor:T}})]})]}),(0,j.jsxs)(`div`,{className:nD,children:[(0,j.jsx)(Nw,{className:rD,size:`md`,variant:`outline`,onClick:n,onMouseDown:e=>e.preventDefault(),children:`Cancel`}),(0,j.jsx)(Nw,{className:rD,size:`md`,variant:`solid`,onClick:C,onMouseDown:e=>e.preventDefault(),children:`Apply`})]})]})}var sD=kw({defaultClassName:`_6d8tz20`,variantClassNames:{size:{sm:`_6d8tz21`,md:`_6d8tz22`},fullWidth:{true:`_6d8tz23`,false:`_6d8tz24`}},defaultVariants:{size:`sm`,fullWidth:!1},compoundVariants:[]}),cD=kw({defaultClassName:`_6d8tz25`,variantClassNames:{ready:{true:`_6d8tz26`,false:`_6d8tz27`}},defaultVariants:{ready:!0},compoundVariants:[]}),lD=kw({defaultClassName:`_6d8tz28`,variantClassNames:{size:{sm:`_6d8tz29`,md:`_6d8tz2a`},active:{true:`_6d8tz2b`,false:`_6d8tz2c`},disabled:{true:`_6d8tz2d`,false:`_6d8tz2e`},fullWidth:{true:`_6d8tz2f`,false:`_6d8tz2g`}},defaultVariants:{size:`sm`,active:!1,disabled:!1,fullWidth:!1},compoundVariants:[]});function uD({items:e,value:t,onChange:n,size:r=`sm`,fullWidth:i=!1,className:a}){let o=(0,A.useRef)(null),s=(0,A.useRef)(new Map),[c,l]=(0,A.useState)({left:0,width:0}),[u,d]=(0,A.useState)(!1),f=(0,A.useCallback)(()=>{let e=o.current,n=s.current.get(t);if(!e||!n)return;let r=e.getBoundingClientRect(),i=n.getBoundingClientRect();l({left:i.left-r.left,width:i.width}),d(!0)},[t]);return(0,A.useEffect)(()=>{f()},[f]),(0,A.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(()=>{f()});return t.observe(e),()=>t.disconnect()},[f]),(0,j.jsxs)(`div`,{"aria-orientation":`horizontal`,className:`${sD({size:r,fullWidth:i})} ${a||``}`.trim(),ref:o,role:`tablist`,onKeyDown:r=>{let i=e.filter(e=>!e.disabled),a=i.findIndex(e=>e.value===t),o=a;switch(r.key){case`ArrowRight`:case`ArrowDown`:r.preventDefault(),o=(a+1)%i.length;break;case`ArrowLeft`:case`ArrowUp`:r.preventDefault(),o=(a-1+i.length)%i.length;break;case`Home`:r.preventDefault(),o=0;break;case`End`:r.preventDefault(),o=i.length-1}if(o!==a){let e=i[o];n(e.value),s.current.get(e.value)?.focus()}},children:[(0,j.jsx)(`div`,{"aria-hidden":`true`,className:cD({ready:u}),style:{left:c.left,width:c.width}}),e.map(e=>{let a=e.value===t;return(0,j.jsx)(`button`,{"aria-selected":a,"data-active":a||void 0,disabled:e.disabled,role:`tab`,tabIndex:a?0:-1,type:`button`,className:lD({size:r,active:a,disabled:!!e.disabled,fullWidth:i}),ref:t=>{t?s.current.set(e.value,t):s.current.delete(e.value)},onClick:()=>n(e.value),children:e.label},e.value)})]})}var dD=`inherit`,fD=[[`Gray`,`#737373`],[`Red`,`#ef4444`],[`Orange`,`#f97316`],[`Amber`,`#f59e0b`],[`Green`,`#22c55e`],[`Teal`,`#14b8a6`],[`Blue`,`#3b82f6`],[`Indigo`,`#6366f1`],[`Purple`,`#a855f7`],[`Pink`,`#ec4899`]],pD=e=>`color-mix(in oklab, ${e} 75%, var(--rc-text, #171717))`,mD=e=>`color-mix(in oklab, ${e} 18%, transparent)`,hD={text:fD.map(([e,t])=>({name:e,value:pD(t)})),background:fD.map(([e,t])=>({name:e,value:mD(t)}))};function gD(e){return!e||e===`inherit`||e===`transparent`}function _D(e,t){return hD[e].find(e=>e.value===t)?.name??t}var vD=8,yD=[{label:`Text`,value:`text`},{label:`Background`,value:`background`}];function bD(e){let t=e.key===`ArrowRight`?1:e.key===`ArrowLeft`?-1:e.key===`ArrowDown`?vD:e.key===`ArrowUp`?-8:0;if(!t)return;let n=Array.from(e.currentTarget.querySelectorAll(`button`)),r=n.indexOf(document.activeElement);if(r===-1)return;let i=n[Math.max(0,Math.min(n.length-1,r+t))];e.preventDefault(),i?.focus()}function xD({current:e,onPick:t,preset:n,target:r}){let i=n.value===dD,a=i?gD(e):e===n.value;return(0,j.jsx)(`button`,{"aria-label":n.name,"aria-pressed":a,className:NE,title:n.name,type:`button`,onClick:()=>t(n.value),onMouseDown:e=>e.preventDefault(),children:i?(0,j.jsx)(`span`,{"data-default-swatch":!0,className:`${PE} ${FE}`}):r===`background`?(0,j.jsx)(`span`,{className:IE,style:{backgroundColor:n.value},children:`A`}):(0,j.jsx)(`span`,{className:PE,style:{backgroundColor:n.value}})})}function SD({current:e,onCustom:t,onPick:n,onTargetChange:r,recent:i,target:a}){let o=[{name:`Default`,value:dD},...hD[a]];return(0,j.jsxs)(`div`,{className:kE,children:[r&&(0,j.jsx)(uD,{fullWidth:!0,items:yD,value:a,onChange:r}),(0,j.jsxs)(`div`,{className:AE,children:[(0,j.jsx)(`div`,{className:jE,children:`Theme colors`}),(0,j.jsx)(`div`,{"aria-label":`Theme colors`,className:ME,role:`group`,onKeyDown:bD,children:o.map(t=>(0,j.jsx)(xD,{current:e,preset:t,target:a,onPick:n},t.value))})]}),i.length>0&&(0,j.jsxs)(`div`,{className:`_17r50hf7`,children:[(0,j.jsx)(`div`,{className:`_17r50hf8`,children:`Recent`}),(0,j.jsx)(`div`,{"aria-label":`Recent colors`,className:`_17r50hf9`,role:`group`,onKeyDown:bD,children:i.map(t=>(0,j.jsx)(xD,{current:e,preset:{name:_D(a,t),value:t},target:a,onPick:n},t))})]}),(0,j.jsx)(`div`,{className:LE,children:(0,j.jsxs)(`button`,{"aria-label":`Custom color`,className:RE,type:`button`,onClick:t,onMouseDown:e=>e.preventDefault(),children:[(0,j.jsx)(Vn,{className:zE}),`Custom…`]})})]})}var CD=5,wD=`haklex:color-picker:recent`,TD={text:[],background:[]},ED=null,DD=new Set;function OD(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`).slice(0,CD):[]}function kD(){if(ED)return ED;ED=TD;try{let e=localStorage.getItem(wD);if(e){let t=JSON.parse(e);ED={text:OD(t.text),background:OD(t.background)}}}catch{ED=TD}return ED}function AD(e){try{return localStorage.setItem(wD,JSON.stringify(e)),!0}catch{return!1}}function jD(e,t){let n=kD(),r=[t,...n[e].filter(e=>e!==t)].slice(0,CD);ED={...n,[e]:r},AD(ED);for(let e of DD)e()}function MD(e){return DD.add(e),()=>{DD.delete(e)}}var ND=()=>TD;function PD(e){return(0,A.useSyncExternalStore)(MD,kD,ND)[e]}function FD({currentColor:e,currentBackground:t,onSelect:n,onSelectBackground:r,className:i,tooltip:a}){let[o,s]=(0,A.useState)(!1),[c,l]=(0,A.useState)(`preset`),[u,d]=(0,A.useState)(`text`),f=PD(u),p=r?u:`text`,m=p===`text`?e:t??``,h=gD(e)?`currentColor`:e,g=gD(t)?void 0:t,_=e=>{s(e),e||l(`preset`)},v=e=>{e!==`inherit`&&jD(p,e),p===`background`?r?.(e):n(e),_(!1)},y=(0,j.jsx)(`button`,{"aria-label":`Text color`,"data-tooltip":a,type:`button`,onMouseDown:e=>e.preventDefault()}),b=(0,j.jsxs)(DT,{className:`${CE}${i?` ${i}`:``}`,render:y,children:[(0,j.jsxs)(`span`,{className:wE,children:[(0,j.jsx)(`span`,{className:TE,style:{color:h,backgroundColor:g},children:`A`}),(0,j.jsx)(`span`,{className:EE,style:{backgroundColor:h}})]}),(0,j.jsx)(x,{className:DE})]});return(0,j.jsxs)(ET,{open:o,onOpenChange:_,children:[a?(0,j.jsxs)(sE,{children:[(0,j.jsx)(cE,{render:b}),(0,j.jsx)(fE,{side:`bottom`,children:a})]}):b,(0,j.jsx)(jT,{className:OE,side:`bottom`,size:`md`,children:c===`preset`?(0,j.jsx)(SD,{current:m,recent:f,target:p,onCustom:()=>l(`picker`),onPick:v,onTargetChange:r?d:void 0}):(0,j.jsx)(oD,{initialColor:m,onApply:v,onBack:()=>l(`preset`),onCancel:()=>_(!1)})})]})}var ID=`_2buwsh1`,LD=`_2buwsh2`,RD=`_2buwsh3`;function zD(e){return(0,j.jsx)(yw,{...e})}function BD({className:e,...t}){return(0,j.jsx)(qi,{className:e??`_2buwsh0`,...t})}function VD({children:e}){return(0,j.jsx)(ea,{children:(0,j.jsx)(vw,{children:e})})}function HD({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,positionMethod:a=`absolute`,children:o,...s}){return(0,j.jsx)(VD,{children:(0,j.jsx)(ta,{align:e,alignOffset:t,positionMethod:a,side:n,sideOffset:r,style:{zIndex:50},children:(0,j.jsx)(ra,{className:`${ID}${i?` ${i}`:``}`,...s,children:o})})})}function UD(e){return(0,j.jsx)(Zi,{...e})}function WD({className:e,...t}){return(0,j.jsx)(la,{className:`${LD}${e?` ${e}`:``}`,...t})}function GD({className:e,...t}){return(0,j.jsx)(ua,{className:`${RD}${e?` ${e}`:``}`,...t})}var KD=`vwlngv0`,qD=`vwlngv1`,JD=`vwlngv5`,YD=`vwlngva`,XD=`vwlngvb`,ZD=`vwlngvc`,QD=`vwlngvd`,$D=`vwlngve`,eO=[],tO=0,nO=new Set;function rO(){for(let e of nO)e()}function iO(e){return nO.add(e),()=>{nO.delete(e)}}function aO(){return eO}function oO(e){let t=`dialog-${++tO}`;return eO=[...eO,{...e,id:t,open:!0}],rO(),()=>cO(t)}function sO(e){eO=eO.filter(t=>t.id!==e),rO()}function cO(e){let t=eO.find(t=>t.id===e);t&&t.open&&(eO=eO.map(t=>t.id===e?{...t,open:!1}:t),rO(),t.onClose?.())}async function lO(e){let t=eO.find(t=>t.id===e);t&&t.open&&(!t.confirmDismiss||await t.confirmDismiss())&&cO(e)}function uO(e){return e===void 0?{}:{"--rc-dialog-width":typeof e==`number`?`${e}px`:xw[e]}}function dO(){for(let e=eO.length-1;e>=0;e--)if(eO[e].open){cO(eO[e].id);return}}function fO({cancelLabel:e=`Keep editing`,confirmLabel:t=`Discard`,description:n=`Your edits haven’t been saved.`,title:r=`Discard changes?`}={}){return new Promise(i=>{let a=!1,o=e=>{a||(a=!0,i(e))};oO({title:r,description:n,showCloseButton:!1,width:360,onClose:()=>o(!1),content:({dismiss:n})=>(0,j.jsxs)(`div`,{className:JD,children:[(0,j.jsx)(Nw,{size:`md`,variant:`outline`,onClick:()=>{o(!1),n()},children:e}),(0,j.jsx)(Nw,{autoFocus:!0,danger:!0,size:`md`,variant:`solid`,onClick:()=>{o(!0),n()},children:t})]})})})}var pO=2400,mO=[],hO=0,gO=new Map,_O=new Set;function vO(){for(let e of _O)e()}function yO(e){let t=gO.get(e.id);t&&clearTimeout(t),gO.delete(e.id),(e.tone!==`loading`||e.duration!==void 0)&&gO.set(e.id,setTimeout(()=>wO(e.id),e.duration??pO))}function bO(e){return _O.add(e),()=>{_O.delete(e)}}function xO(){return mO}function SO(e){let t={...e,id:`toast-${++hO}`};return mO=[...mO,t],yO(t),vO(),t.id}function CO(e,t){let n;mO=mO.map(r=>r.id===e?(n={...r,...t},n):r),n&&(yO(n),vO())}function wO(e){let t=gO.get(e);t&&clearTimeout(t),gO.delete(e),mO.some(t=>t.id===e)&&(mO=mO.filter(t=>t.id!==e),vO())}var TO=`xom7f32`,EO=`xom7f33`,DO=`xom7f34`,OO=`xom7f35`,kO=`xom7f36`,AO=`xom7f37`,jO=`xom7f38`,MO=[];function NO({tone:e}){return e===`loading`?(0,j.jsx)(oe,{className:`${OO} ${kO}`}):e===`success`?(0,j.jsx)(c,{className:`${OO} ${AO}`}):e===`error`?(0,j.jsx)(y,{className:`${OO} ${jO}`}):null}function PO(){let e=(0,A.useSyncExternalStore)(bO,xO,()=>MO);return typeof document>`u`?null:(0,li.createPortal)((0,j.jsx)(vw,{children:(0,j.jsx)(`div`,{"aria-live":`polite`,className:TO,role:`status`,children:e.map(e=>(0,j.jsxs)(`div`,{className:EO,children:[(0,j.jsx)(NO,{tone:e.tone}),(0,j.jsx)(`span`,{className:DO,children:e.title}),e.action&&(0,j.jsx)(Nw,{size:`sm`,onClick:()=>{e.action?.onClick(),wO(e.id)},children:e.action.label})]},e.id))})}),document.body)}function FO(e){if(e.isContentEditable||e.classList.contains(`cm-editor`))return!0;let{overflowY:t}=getComputedStyle(e);return(t===`auto`||t===`scroll`)&&e.scrollHeight>e.clientHeight}function IO(e,t){for(let n=e;n&&n!==t;n=n.parentElement)if(n.scrollTop>0&&FO(n))return!0;return!1}var LO=({item:e,index:t})=>{let{id:n,open:r,title:i,description:a,content:o,className:s,portalClassName:c,theme:l=`light`,clickOutsideToDismiss:u=!0}=e,d=(0,A.useCallback)(()=>cO(n),[n]),f=(0,A.useCallback)(()=>lO(n),[n]);(0,A.useEffect)(()=>{if(!r){let e=setTimeout(()=>sO(n),200);return()=>clearTimeout(e)}},[r,n]),(0,A.useEffect)(()=>{let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}},[]);let p=(0,A.useRef)(null),m=(0,A.useRef)(null),[h,g]=(0,A.useState)(0),[_,v]=(0,A.useState)(!1),y=(0,A.useCallback)(e=>{let t=e.touches[0],n=e.target;n.closest(`.vwlngvc, .vwlngvf`)===null&&IO(n,p.current)||(m.current={startY:t.clientY,startTime:Date.now(),currentY:t.clientY,isDragging:!1})},[]),b=(0,A.useCallback)(e=>{let t=m.current;if(!t)return;let n=e.touches[0],r=n.clientY-t.startY;r<0?t.isDragging&&=(g(0),v(!1),!1):(!t.isDragging&&r>5&&(t.isDragging=!0,v(!0)),t.isDragging&&(e.preventDefault(),t.currentY=n.clientY,g(r)))},[]),x=(0,A.useCallback)(()=>{let e=m.current;if(!e||!e.isDragging){m.current=null;return}let t=e.currentY-e.startY,n=Date.now()-e.startTime,r=t/Math.max(n,1)*1e3,i=(p.current?.offsetHeight??0)*.25;g(0),(t>i||r>500)&&f(),v(!1),m.current=null},[f]),S=50+t,C=p.current?.offsetHeight||1,w=_?Math.max(0,1-h/C):1;return(0,j.jsx)(gw,{className:c??``,theme:l,children:(0,j.jsxs)(vw,{children:[(0,j.jsx)(`div`,{className:YD,style:{zIndex:S,opacity:r?w:0,pointerEvents:r?`auto`:`none`},onClick:u?f:void 0}),(0,j.jsxs)(`div`,{className:`${XD}${s?` ${s}`:``}`,"data-closed":r?void 0:``,"data-open":r?``:void 0,ref:p,style:{zIndex:S+1,transform:_?`translateY(${h}px)`:void 0,transition:_?`none`:`transform 300ms cubic-bezier(0.32, 0.72, 0, 1)`},onTouchEnd:x,onTouchMove:b,onTouchStart:y,children:[(0,j.jsx)(`div`,{className:ZD,children:(0,j.jsx)(`div`,{className:QD})}),(i||a)&&(0,j.jsxs)(`div`,{className:`vwlngvf`,children:[i&&(0,j.jsx)(`div`,{className:`vwlngv6`,children:i}),a&&(0,j.jsx)(`div`,{className:`vwlngv7`,children:a})]}),(0,j.jsx)(`div`,{className:$D,children:(0,A.createElement)(o,{dismiss:d,requestDismiss:f})})]})]})})},RO=`(max-width: 640px)`;function zO(){return(0,A.useSyncExternalStore)(e=>{let t=window.matchMedia(RO);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>window.matchMedia(RO).matches,()=>!1)}function BO(e,t){return e===!0||e===`auto`&&t}var VO=()=>(0,j.jsx)(Ce,{}),HO=({item:e,index:t})=>{let{id:n,open:r,title:i,description:o,content:s,className:c,portalClassName:l,theme:u=`light`,showCloseButton:d=!0,clickOutsideToDismiss:f=!0,width:p}=e,m=(0,A.useCallback)(()=>cO(n),[n]),g=(0,A.useCallback)(()=>lO(n),[n]);(0,A.useEffect)(()=>{if(!r){let e=setTimeout(()=>{sO(n)},150);return()=>clearTimeout(e)}},[r,n]);let _=50+t;return(0,j.jsx)(E,{disablePointerDismissal:!f,open:r,onOpenChange:e=>{e||g()},children:(0,j.jsx)(h,{children:(0,j.jsx)(gw,{className:l??``,theme:u,children:(0,j.jsxs)(vw,{children:[(0,j.jsx)(ce,{className:KD,style:{zIndex:_}}),(0,j.jsxs)(a,{suppressHydrationWarning:!0,className:`${qD}${c?` ${c}`:``}`,"data-theme":u,style:{zIndex:_+1,...uO(p)},children:[(i||o||d)&&(0,j.jsxs)(`div`,{className:`vwlngv3`,children:[(i||o)&&(0,j.jsxs)(`div`,{className:`vwlngv4`,children:[i&&(0,j.jsx)(C,{className:`vwlngv6`,children:i}),o&&(0,j.jsx)(ne,{className:`vwlngv7`,children:o})]}),d&&(0,j.jsx)(de,{className:`vwlngv2`,children:(0,j.jsx)(VO,{})})]}),(0,A.createElement)(s,{dismiss:m,requestDismiss:g})]})]})})})})},UO=({children:e})=>{let t=(0,A.useSyncExternalStore)(iO,aO,aO),n=zO();return(0,j.jsxs)(j.Fragment,{children:[e,(0,j.jsx)(PO,{}),t.map((e,t)=>BO(e.sheet,n)?(0,j.jsx)(LO,{index:t,item:e},e.id):(0,j.jsx)(HO,{index:t,item:e},e.id))]})},WO=`oih0op0`,GO=`oih0op1`,KO=`oih0op2`,qO=`_1sxaacb3`,JO=`_1sxaacb4`,YO=`oih0op3`,XO=`oih0op3`,ZO=`oih0op4`,QO=`oih0op4`,$O=`oih0op5`,ek=`oih0op6`;function tk(e){return(0,j.jsx)(Wn,{"data-slot":`dropdown-menu`,...e})}function nk(e){return(0,j.jsx)(rr,{"data-slot":`dropdown-menu-trigger`,...e})}function rk({children:e}){return(0,j.jsx)(Kn,{children:(0,j.jsx)(vw,{children:e})})}function ik({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,positionMethod:a=`absolute`,children:o,...s}){return(0,j.jsx)(rk,{children:(0,j.jsx)(ir,{align:e,alignOffset:t,className:GO,"data-slot":`dropdown-menu-positioner`,positionMethod:a,side:n,sideOffset:r,style:{zIndex:50},children:(0,j.jsx)(Qn,{className:`${WO}${i?` ${i}`:``}`,"data-slot":`dropdown-menu-content`,...s,children:o})})})}function ak(e){return(0,j.jsx)(Jn,{"data-slot":`dropdown-menu-group`,...e})}function ok({className:e,...t}){return(0,j.jsx)(qn,{className:`${JO}${e?` ${e}`:``}`,"data-slot":`dropdown-menu-label`,...t})}function sk({className:e,children:t,shortcut:n,variant:r=`default`,...i}){let a=[KO,r===`destructive`&&`_1sxaacb1`,e].filter(Boolean).join(` `);return(0,j.jsxs)(or,{className:a,"data-slot":`dropdown-menu-item`,...i,children:[t,n&&(0,j.jsx)(rE,{className:`_1sxaacb2`,keys:n,size:`sm`,tone:`muted`})]})}function ck(e){return(0,j.jsx)(Zn,{...e})}function lk({className:e,children:t,value:n,...r}){return(0,j.jsxs)(ar,{className:`${KO} ${$O}${e?` ${e}`:``}`,"data-slot":`dropdown-menu-sub-trigger`,...r,children:[t,(0,j.jsxs)(`span`,{className:ek,children:[n,(0,j.jsx)(zt,{})]})]})}function uk({className:e,...t}){return(0,j.jsx)(er,{className:`${qO}${e?` ${e}`:``}`,"data-slot":`dropdown-menu-separator`,...t})}function dk(e){return(0,j.jsx)(ri,{"data-slot":`dropdown-menu-radio-group`,...e})}function fk({className:e,children:t,...n}){return(0,j.jsxs)(si,{className:`${KO} ${XO}${e?` ${e}`:``}`,"data-slot":`dropdown-menu-radio-item`,...n,children:[t,(0,j.jsx)(ci,{className:QO,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,j.jsx)(mk,{})})]})}function pk({className:e,children:t,...n}){return(0,j.jsxs)(Xn,{className:`${KO} ${YO}${e?` ${e}`:``}`,"data-slot":`dropdown-menu-checkbox-item`,...n,children:[t,(0,j.jsx)($n,{className:ZO,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:(0,j.jsx)(mk,{})})]})}function mk(){return(0,j.jsx)(u,{size:16})}function hk({editable:e,editor:t,readOnly:n}){let r=(0,A.useCallback)(e=>t.registerEditableListener(e),[t]),i=(0,A.useCallback)(()=>t.isEditable(),[t]),a=(0,A.useSyncExternalStore)(r,i,i);return(0,j.jsx)(j.Fragment,{children:a?e:n})}var gk=`_1i1no470`,_k=`_1i1no471`,vk=`_1i1no472`,yk=`_1i1no473`;function bk({children:e,className:t,error:n,hint:r,id:i,label:a}){return(0,j.jsxs)(`div`,{className:`${gk}${t?` ${t}`:``}`,children:[(0,j.jsx)(`label`,{className:_k,htmlFor:i,children:a}),e,n?(0,j.jsx)(`p`,{className:yk,id:`${i}-error`,role:`alert`,children:n}):r?(0,j.jsx)(`p`,{className:vk,id:`${i}-hint`,children:r}):null]})}var xk=`_1q3gqvh0`,Sk=`_1q3gqvh1`,Ck=`_1q3gqvh2`,wk=`_1q3gqvh4`,Tk=`_1q3gqvh5`,Ek=`_1q3gqvh6`,Dk=`_1q3gqvh8`,Ok=`_1q3gqvh9`,kk=`_1q3gqvha`;function Ak({children:e,className:t,onSave:n}){return(0,j.jsx)(`div`,{className:`${xk}${t?` ${t}`:``}`,onKeyDown:e=>{n&&!e.defaultPrevented&&(e.metaKey||e.ctrlKey)&&(e.key===`s`||e.key===`Enter`)&&(e.preventDefault(),n())},children:e})}function jk({actions:e,center:t,closeLabel:n=`Close`,icon:r,onClose:i,title:a}){return(0,j.jsxs)(`div`,{className:Sk,children:[(0,j.jsxs)(`div`,{className:Ck,children:[r&&(0,j.jsx)(`span`,{className:`_1q3gqvh3`,children:r}),(0,j.jsx)(`span`,{className:wk,children:a})]}),(0,j.jsx)(`div`,{className:Tk,children:t}),(0,j.jsxs)(`div`,{className:Ek,children:[e,i&&(0,j.jsxs)(j.Fragment,{children:[e&&(0,j.jsx)(`span`,{className:`_1q3gqvh7`}),(0,j.jsx)(Nw,{icon:!0,"aria-label":n,size:`md`,title:n,onClick:i,children:(0,j.jsx)(Ce,{})})]})]})]})}function Mk({children:e,className:t}){return(0,j.jsx)(`div`,{className:`${Dk}${t?` ${t}`:``}`,children:e})}function Nk({cancelLabel:e=`Cancel`,children:t,dirty:n,onCancel:r,onSave:i,saveDisabled:a,saveLabel:o=`Save`,status:s}){return(0,j.jsxs)(`div`,{className:Ok,children:[(0,j.jsxs)(`div`,{className:kk,children:[n&&(0,j.jsx)(`span`,{"aria-hidden":!0,className:`_1q3gqvhb`}),s]}),t,r&&(0,j.jsx)(Nw,{size:`md`,variant:`outline`,onClick:r,children:e}),i&&(0,j.jsxs)(Nw,{disabled:a,size:`md`,variant:`solid`,onClick:i,children:[o,(0,j.jsx)(rE,{keys:[`mod`,`s`],size:`sm`,tone:`inverted`})]})]})}var Pk=`_1dj5lvb0`,Fk=`_1dj5lvb1`,Ik=`_1dj5lvb2`,Lk=`_1dj5lvb3`,Rk=`_1dj5lvb4`,zk=`rich-quote`,Bk=`data-quote-attribution-slot`;function Vk(e){if(!e)return!1;let t=e.constructor;return typeof t.getType==`function`&&t.getType()===zk}function Hk(){let e=[],t=n=>{if(Vk(n)&&e.push(n),`getChildren`in n&&typeof n.getChildren==`function`)for(let e of n.getChildren())t(e)};for(let e of V().getChildren())t(e);return e}function Uk(){let e=J();if(!q(e))return null;let t=e.anchor.getNode();for(;t;){if(Vk(t))return t.getKey();t=t.getParent()}return null}function Wk(e){if(!e)return null;for(let t of e.children)if(t.hasAttribute(Bk))return t;return null}var Gk=(e,t)=>e.length===t.length&&e.every((e,n)=>e.key===t[n].key&&e.attribution===t[n].attribution&&e.slot===t[n].slot);function Kk(){let[e]=ma(),[t,n]=(0,A.useState)([]),[r,i]=(0,A.useState)(null),[a,o]=(0,A.useState)(()=>e.isEditable());return(0,A.useEffect)(()=>e.registerEditableListener(o),[e]),(0,A.useEffect)(()=>{let t=()=>{e.getEditorState().read(()=>{let t=[];for(let n of Hk()){let r=Wk(e.getElementByKey(n.getKey()));r&&t.push({key:n.getKey(),attribution:n.getAttribution()??``,slot:r})}n(e=>Gk(e,t)?e:t),i(Uk())})},r=e.registerRootListener(()=>queueMicrotask(t)),a=e.registerUpdateListener(t);return()=>{r(),a()}},[e]),(0,j.jsx)(j.Fragment,{children:t.map(t=>(0,li.createPortal)((0,j.jsx)(Jk,{active:t.key===r,attribution:t.attribution,editable:a,editor:e,quoteKey:t.key,slot:t.slot}),t.slot,t.key))})}var qk=e=>e.stopPropagation(),Jk=(0,A.memo)(function({active:e,attribution:t,editable:n,editor:r,quoteKey:i,slot:a}){let[o,s]=(0,A.useState)(t),[c,l]=(0,A.useState)(!1);(0,A.useEffect)(()=>{c||s(t)},[t,c]),(0,A.useLayoutEffect)(()=>{a.classList.add(Pk),a.toggleAttribute(`data-empty`,!t),a.toggleAttribute(`data-active`,e||c)},[e,t,c,a]),(0,A.useLayoutEffect)(()=>()=>{a.classList.remove(Pk),a.removeAttribute(`data-empty`),a.removeAttribute(`data-active`)},[a]);let u=(0,A.useCallback)(e=>{let n=e.trim()||null;n!==(t||null)&&r.update(()=>{let e=B(i);Vk(e)&&e.setAttribution(n)})},[t,r,i]),d=(0,A.useCallback)(e=>{e.stopPropagation(),e.key===`Enter`?(e.preventDefault(),u(o),e.currentTarget.blur(),r.focus()):e.key===`Escape`&&(e.preventDefault(),s(t),e.currentTarget.blur(),r.focus())},[t,u,r,o]);return n?(0,j.jsxs)(`label`,{className:Ik,children:[(0,j.jsx)(`span`,{"aria-hidden":!0,className:Lk,children:`—`}),(0,j.jsx)(`input`,{"aria-label":`Quote attribution`,className:Rk,placeholder:`Author, Work`,type:`text`,value:o,onBeforeInput:qk,onChange:e=>s(e.target.value),onClick:qk,onCompositionEnd:qk,onCompositionStart:qk,onCompositionUpdate:qk,onCopy:qk,onCut:qk,onDragStart:qk,onDrop:qk,onFocus:()=>l(!0),onInput:qk,onKeyDown:d,onKeyUp:qk,onMouseDown:qk,onPaste:qk,onPointerDown:qk,onBlur:e=>{l(!1),u(e.currentTarget.value)}})]}):t?(0,j.jsxs)(`span`,{className:Fk,children:[`— `,t]}):null}),Yk=`p74a620`,Xk=`p74a621`,Zk=`p74a622`,Qk=`p74a623`,$k=`p74a625`,eA=`p74a626`,tA=`p74a627`;function nA(e){return(0,j.jsx)(ln,{...e})}function rA({children:e,className:t,...n}){return(0,j.jsxs)(fn,{...n,className:`${Yk}${t?` ${t}`:``}`,children:[e,(0,j.jsx)(tn,{className:Xk,children:(0,j.jsx)(x,{size:16})})]})}function iA(e){return(0,j.jsx)(nn,{...e})}function aA({children:e,className:t,align:n=`center`,alignItemWithTrigger:r=!0,side:i=`bottom`,sideOffset:a=4,...o}){return(0,j.jsx)(gn,{children:(0,j.jsx)(vw,{children:(0,j.jsx)(O,{align:n,alignItemWithTrigger:r,className:Zk,side:i,sideOffset:a,children:(0,j.jsxs)(mn,{...o,className:`${Qk}${t?` ${t}`:``}`,children:[(0,j.jsx)(hn,{className:tA,children:(0,j.jsx)(he,{size:16})}),(0,j.jsx)(dn,{children:e}),(0,j.jsx)(un,{className:tA,children:(0,j.jsx)(x,{size:16})})]})})})})}function oA({className:e,children:t,...n}){return(0,j.jsxs)($t,{...n,className:`${$k}${e?` ${e}`:``}`,children:[(0,j.jsx)(pn,{children:t}),(0,j.jsx)(on,{className:eA,children:(0,j.jsx)(u,{size:16})})]})}kw({defaultClassName:`_131cfek1`,variantClassNames:{size:{sm:`_131cfek2`,md:`_131cfek3`,lg:`_131cfek4`}},defaultVariants:{size:`sm`},compoundVariants:[]}),kw({defaultClassName:`_73cmpa2`,variantClassNames:{status:{idle:`_73cmpa3`,active:`_73cmpa4`,success:`_73cmpa5`,error:`_73cmpa6`,warning:`_73cmpa7`},size:{sm:`_73cmpa8`,md:`_73cmpa9`}},defaultVariants:{status:`idle`,size:`sm`},compoundVariants:[]}),kw({defaultClassName:`_73cmpaa`,variantClassNames:{status:{idle:`_73cmpab`,active:`_73cmpac`,success:`_73cmpad`,error:`_73cmpae`,warning:`_73cmpaf`},size:{sm:`_73cmpag`,md:`_73cmpah`}},defaultVariants:{status:`idle`,size:`sm`},compoundVariants:[]});var sA=`i56btd0`,cA=`i56btd1`;function lA({invalid:e,mono:t,className:n,type:r=`text`,...i}){return(0,j.jsx)(`input`,{"aria-invalid":e||void 0,className:`${sA}${t?` ${cA}`:``}${n?` ${n}`:``}`,type:r,...i})}function uA({children:e,fallback:t,threshold:n=.5}){let r=(0,A.useRef)(null),[i,a]=(0,A.useState)(!1);return(0,A.useEffect)(()=>{if(i)return;let e=r.current;if(!e)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(a(!0),t.disconnect())},{threshold:n});return t.observe(e),()=>t.disconnect()},[i,n]),i?(0,j.jsx)(j.Fragment,{children:e}):(0,j.jsx)(`div`,{ref:r,children:t})}function dA(e,t,n){let r=(0,A.useRef)(e);r.current=e;let i=(0,A.useRef)(t?e:null),a=(0,A.useRef)(!1);return(0,A.useEffect)(()=>{i.current=t?r.current:null,a.current=!1},[t]),{apply:(0,A.useCallback)(e=>{n(e,a.current),a.current=!0},[n]),revert:(0,A.useCallback)(()=>{let e=i.current;e&&a.current&&n(e,!0),a.current=!1},[n])}}var fA=va?A.useLayoutEffect:A.useEffect,pA={tag:Xp};function mA({initialConfig:e,children:t}){let n=(0,A.useMemo)(()=>{let{theme:t,namespace:n,nodes:r,onError:i,onWarn:a,editorState:o,html:s}=e,c=pa(null,t),l=gm({editable:e.editable,html:s,namespace:n,nodes:r,onError:e=>i(e,l),...a?{onWarn:e=>a(e,l)}:{},theme:t});return function(e,t){if(t!==null){if(t===void 0)e.update(()=>{let t=V();if(t.isEmpty()){let n=z();t.append(n);let r=e.getRootElement(),i=va&&r!==null?If(r):null;(J()!==null||i!==null&&i===r)&&n.select()}},pA);else if(t!==null)switch(typeof t){case`string`:{let n=e.parseEditorState(t);e.setEditorState(n,pA);break}case`object`:e.setEditorState(t,pA);break;case`function`:e.update(()=>{V().isEmpty()&&t(e)},pA)}}}(l,o),[l,c]},[]);return fA(()=>{let t=e.editable,[r]=n;r.setEditable(t===void 0||t)},[]),(0,j.jsx)(fa.Provider,{value:n,children:t})}function hA(e){return JSON.stringify([e.exportJSON(),I(e)?e.getChildrenKeys():null])}function gA(e,t,n){let r=n(),i=0,a=r,o=0,s=null,c=new Set;return(l,u,d,f,p,m)=>{let h=n();if(m.has(`composition-start`)&&(a=r,o=i,s=l,c.clear()),s!==null){for(let e of f)c.add(e);for(let e of p.keys())c.add(e)}if(m.has(`historic`))return i=0,r=h,s=null,c.clear(),2;let g=m.has(rm);g&&s&&(r=a,i=o,l=s);let _=m.has(`paste`)||m.has(`cut`)?0:function(e,t,n,r,i){if(e===null||n.size===0&&r.size===0&&!i)return 0;let a=t._selection,o=e._selection;if(i)return 1;if(!(q(a)&&q(o)&&o.isCollapsed()&&a.isCollapsed()))return 0;let s=function(e,t,n){let r=e._nodeMap,i=[];for(let e of t){let t=r.get(e);t!==void 0&&i.push(t)}for(let[e,t]of n){if(!t)continue;let n=r.get(e);n===void 0||ru(n)||i.push(n)}return i}(t,n,r);if(s.length===0)return 0;if(s.length>1){let n=t._nodeMap,r=n.get(a.anchor.key),i=n.get(o.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&R(r)&&r.__text.length===1&&a.anchor.offset===1?2:0}let c=s[0],l=e._nodeMap.get(c.__key);if(!R(l)||!R(c)||l.__mode!==c.__mode)return 0;let u=l.__text,d=c.__text;if(u===d)return 0;let f=a.anchor,p=o.anchor;if(f.key!==p.key||f.type!==`text`)return 0;let m=f.offset,h=p.offset,g=d.length-u.length;return g===1&&h===m-1?2:g===-1&&h===m+1?3:g===-1&&h===m?4:0}(l,u,f,p,e.isComposing()),v=!1,y=(()=>{let n=d===null||d.editor===e,a=m.has(Yp),o=!a&&n&&m.has(`history-merge`);if(g&&s!==null&&n&&!a&&function(e,t,n){for(let r of e){let e=t._nodeMap.get(r),i=n._nodeMap.get(r);if(!(e===i||e&&i&&t.read(()=>hA(e))===n.read(()=>hA(i))))return!1}return!0}(c,s,u))return v=!0,0;if(o)return 0;if(_===1)return 2;if(l===null)return 1;let y=u._selection;if(!(f.size>0||p.size>0))return y===null?2:0;let b=typeof t==`number`?t:t.peek();return!1===a&&_!==0&&_===i&&h<r+b&&n||!a&&f.size===1&&function(e,t,n){let r=t._nodeMap.get(e),i=n._nodeMap.get(e),a=t._selection,o=n._selection;return!(q(a)&&q(o)&&a.anchor.type===`element`&&a.focus.type===`element`&&o.anchor.type===`text`&&o.focus.type===`text`||!R(r)||!R(i)||r.__parent!==i.__parent)&&JSON.stringify(t.read(()=>r.exportJSON()))===JSON.stringify(n.read(()=>i.exportJSON()))}(Array.from(f)[0],l,u)?0:1})();return g&&(s=null,c.clear()),v||(r=h,i=_),y}}function _A(e,t){if(t!==null&&t.editor===e.editor)return t;let{editor:n}=e,r=n.getEditorState();return r.isEmpty()?null:{editor:n,editorState:r}}function vA(e,t){e.undoStack=[],e.redoStack=[],e.current=null,t&&t(e)}function yA(e,t,n,r=Date.now,i,a=null){let o=gA(e,n,r),s=()=>{i&&i(t)};return s(),eh(e.registerCommand(po,()=>(function(e,t,n){let r=t.redoStack,i=t.undoStack;if(i.length!==0){let a=t.current,o=i.pop();if(o){let t=_A(o,a);t!==null&&(r.push(t),e.dispatchCommand(Vo,!0))}i.length===0&&e.dispatchCommand(Ho,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(mo,()=>(function(e,t,n){let r=t.redoStack,i=t.undoStack;if(r.length!==0){let a=t.current,o=r.pop();if(o){let t=_A(o,a);t!==null&&(i.push(t),e.dispatchCommand(Ho,!0))}r.length===0&&e.dispatchCommand(Vo,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(zo,()=>(vA(t,i),!1),0),e.registerCommand(Bo,()=>(vA(t,i),e.dispatchCommand(Vo,!1),e.dispatchCommand(Ho,!1),!0),0),e.registerUpdateListener(({editorState:n,prevEditorState:r,dirtyLeaves:i,dirtyElements:c,tags:l})=>{let u=t.current,d=t.redoStack,f=t.undoStack,p=u===null?null:u.editorState;if(u!==null&&n===p)return;let m=o(r,n,u,i,c,l);if(m===1){d.length!==0&&(t.redoStack=[],e.dispatchCommand(Vo,!1));let n=function(e,t,n){return n===null?null:n.editor===e?{...n}:t.isEmpty()?null:{editor:e,editorState:t}}(e,r,u);if(n!==null){f.push(n);let t=typeof a==`number`||a===null?a:a.peek();t!==null&&f.length>t&&f.splice(0,f.length-t),e.dispatchCommand(Ho,!0)}}else if(m===2)return;t.current={editor:e,editorState:n},s()}))}function bA(){return{current:null,redoStack:[],undoStack:[]}}function xA({delay:e,externalHistoryState:t}){let[n]=ma();return function(e,t,n=1e3){let r=(0,A.useMemo)(()=>t||bA(),[t]);(0,A.useEffect)(()=>yA(e,r,n),[n,e,r])}(n,t,e),null}var{PI:SA}=Math,CA=SA+1e-4,wA=.5,TA=[1,1];function EA(e,t,n,r=e=>e){return e*r(.5-t*(.5-n))}var{min:DA}=Math;function OA(e,t,n){let r=DA(1,t/n);return DA(1,e+(DA(1,1-r)-e)*(r*.275))}function kA(e){return[-e[0],-e[1]]}function AA(e,t){return[e[0]+t[0],e[1]+t[1]]}function jA(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}function MA(e,t){return[e[0]-t[0],e[1]-t[1]]}function NA(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function PA(e,t){return[e[0]*t,e[1]*t]}function FA(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}function IA(e,t){return[e[0]/t,e[1]/t]}function LA(e){return[e[1],-e[0]]}function RA(e,t){let n=t[0];return e[0]=t[1],e[1]=-n,e}function zA(e,t){return e[0]*t[0]+e[1]*t[1]}function BA(e,t){return e[0]===t[0]&&e[1]===t[1]}function VA(e){return Math.hypot(e[0],e[1])}function HA(e,t){let n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function UA(e){return IA(e,VA(e))}function WA(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function GA(e,t,n){let r=Math.sin(n),i=Math.cos(n),a=e[0]-t[0],o=e[1]-t[1],s=a*i-o*r,c=a*r+o*i;return[s+t[0],c+t[1]]}function KA(e,t,n,r){let i=Math.sin(r),a=Math.cos(r),o=t[0]-n[0],s=t[1]-n[1],c=o*a-s*i,l=o*i+s*a;return e[0]=c+n[0],e[1]=l+n[1],e}function qA(e,t,n){return AA(e,PA(MA(t,e),n))}function JA(e,t,n,r){let i=n[0]-t[0],a=n[1]-t[1];return e[0]=t[0]+i*r,e[1]=t[1]+a*r,e}function YA(e,t,n){return AA(e,PA(t,n))}var XA=[0,0],ZA=[0,0],QA=[0,0];function $A(e,t){let n=YA(e,UA(LA(MA(e,AA(e,[1,1])))),-t),r=[],i=1/13;for(let t=i;t<=1;t+=i)r.push(GA(n,e,CA*2*t));return r}function ej(e,t,n){let r=[],i=1/n;for(let n=i;n<=1;n+=i)r.push(GA(t,e,CA*n));return r}function tj(e,t,n){let r=MA(t,n),i=PA(r,.5),a=PA(r,.51);return[MA(e,i),MA(e,a),AA(e,a),AA(e,i)]}function nj(e,t,n,r){let i=[],a=YA(e,t,n),o=1/r;for(let t=o;t<1;t+=o)i.push(GA(a,e,CA*3*t));return i}function rj(e,t,n){return[AA(e,PA(t,n)),AA(e,PA(t,n*.99)),MA(e,PA(t,n*.99)),MA(e,PA(t,n))]}function ij(e,t,n){return e===!1||e===void 0?0:e===!0?Math.max(t,n):e}function aj(e,t,n){return e.slice(0,10).reduce((e,r)=>{let i=r.pressure;return t&&(i=OA(e,r.distance,n)),(e+i)/2},e[0].pressure)}function oj(e,t={}){let{size:n=16,smoothing:r=.5,thinning:i=.5,simulatePressure:a=!0,easing:o=e=>e,start:s={},end:c={},last:l=!1}=t,{cap:u=!0,easing:d=e=>e*(2-e)}=s,{cap:f=!0,easing:p=e=>--e*e*e+1}=c;if(e.length===0||n<=0)return[];let m=e[e.length-1].runningLength,h=ij(s.taper,n,m),g=ij(c.taper,n,m),_=(n*r)**2,v=[],y=[],b=aj(e,a,n),x=EA(n,i,e[e.length-1].pressure,o),S,C=e[0].vector,w=e[0].point,T=w,E=w,D=T,ee=!1;for(let t=0;t<e.length;t++){let{pressure:r}=e[t],{point:s,vector:c,distance:l,runningLength:u}=e[t],f=t===e.length-1;if(!f&&m-u<3)continue;i?(a&&(r=OA(b,l,n)),x=EA(n,i,r,o)):x=n/2,S===void 0&&(S=x);let te=u<h?d(u/h):1,ne=m-u<g?p((m-u)/g):1;x=Math.max(.01,x*Math.min(te,ne));let re=(f?e[t]:e[t+1]).vector,ie=f?1:zA(c,re),ae=zA(c,C)<0&&!ee,oe=ie!==null&&ie<0;if(ae||oe){RA(XA,C),FA(XA,XA,x);for(let e=0;e<=1;e+=.07692307692307693)NA(ZA,s,XA),KA(ZA,ZA,s,CA*e),E=[ZA[0],ZA[1]],v.push(E),jA(QA,s,XA),KA(QA,QA,s,CA*-e),D=[QA[0],QA[1]],y.push(D);w=E,T=D,oe&&(ee=!0)}else ee=!1,f?(RA(XA,c),FA(XA,XA,x),v.push(MA(s,XA)),y.push(AA(s,XA))):(JA(XA,re,c,ie),RA(XA,XA),FA(XA,XA,x),NA(ZA,s,XA),E=[ZA[0],ZA[1]],(t<=1||HA(w,E)>_)&&(v.push(E),w=E),jA(QA,s,XA),D=[QA[0],QA[1]],(t<=1||HA(T,D)>_)&&(y.push(D),T=D),b=r,C=c)}let te=[e[0].point[0],e[0].point[1]],ne=e.length>1?[e[e.length-1].point[0],e[e.length-1].point[1]]:AA(e[0].point,[1,1]),re=[],ie=[];if(e.length===1){if(!(h||g)||l)return $A(te,S||x)}else{h||g&&e.length===1||(u?re.push(...ej(te,y[0],13)):re.push(...tj(te,v[0],y[0])));let t=LA(kA(e[e.length-1].vector));g||h&&e.length===1?ie.push(ne):f?ie.push(...nj(ne,t,x,29)):ie.push(...rj(ne,t,x))}return v.concat(ie,y.reverse(),re)}var sj=[0,0];function cj(e){return e!=null&&e>=0}function lj(e,t={}){let{streamline:n=.5,size:r=16,last:i=!1}=t;if(e.length===0)return[];let a=.15+(1-n)*.85,o=Array.isArray(e[0])?e:e.map(({x:e,y:t,pressure:n=wA})=>[e,t,n]);if(o.length===2){let e=o[1];o=o.slice(0,-1);for(let t=1;t<5;t++)o.push(qA(o[0],e,t/4))}o.length===1&&(o=[...o,[...AA(o[0],TA),...o[0].slice(2)]]);let s=[{point:[o[0][0],o[0][1]],pressure:cj(o[0][2])?o[0][2]:.25,vector:[...TA],distance:0,runningLength:0}],c=!1,l=0,u=s[0],d=o.length-1;for(let e=1;e<o.length;e++){let t=i&&e===d?[o[e][0],o[e][1]]:qA(u.point,o[e],a);if(BA(u.point,t))continue;let n=WA(t,u.point);if(l+=n,e<d&&!c){if(l<r)continue;c=!0}NA(sj,u.point,t),u={point:t,pressure:cj(o[e][2])?o[e][2]:wA,vector:UA(sj),distance:n,runningLength:l},s.push(u)}return s[0].vector=s[1]?.vector||[0,0],s}function uj(e,t={}){return oj(lj(e,t),t)}function dj(e,t,n){if(e&&e.length){let[r,i]=t,a=Math.PI/180*n,o=Math.cos(a),s=Math.sin(a);for(let t of e){let[e,n]=t;t[0]=(e-r)*o-(n-i)*s+r,t[1]=(e-r)*s+(n-i)*o+i}}}function fj(e,t,n){let r=[];e.forEach(e=>r.push(...e)),dj(r,t,n)}function pj(e,t){return e[0]===t[0]&&e[1]===t[1]}function mj(e,t,n,r=1){let i=n,a=Math.max(t,.1),o=e[0]&&e[0][0]&&typeof e[0][0]==`number`?[e]:e,s=[0,0];if(i)for(let e of o)dj(e,s,i);let c=hj(o,a,r);if(i){for(let e of o)dj(e,s,-i);fj(c,s,-i)}return c}function hj(e,t,n){let r=[];for(let t of e){let e=[...t];pj(e[0],e[e.length-1])||e.push([e[0][0],e[0][1]]),e.length>2&&r.push(e)}let i=[];t=Math.max(t,.1);let a=[];for(let e of r)for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1];if(n[1]!==r[1]){let e=Math.min(n[1],r[1]);a.push({ymin:e,ymax:Math.max(n[1],r[1]),x:e===n[1]?n[0]:r[0],islope:(r[0]-n[0])/(r[1]-n[1])})}}if(a.sort((e,t)=>e.ymin<t.ymin?-1:e.ymin>t.ymin?1:e.x<t.x?-1:e.x>t.x?1:e.ymax===t.ymax?0:(e.ymax-t.ymax)/Math.abs(e.ymax-t.ymax)),!a.length)return i;let o=[],s=a[0].ymin,c=0;for(;o.length||a.length;){if(a.length){let e=-1;for(let t=0;t<a.length&&!(a[t].ymin>s);t++)e=t;a.splice(0,e+1).forEach(e=>{o.push({s,edge:e})})}if(o=o.filter(e=>!(e.edge.ymax<=s)),o.sort((e,t)=>e.edge.x===t.edge.x?0:(e.edge.x-t.edge.x)/Math.abs(e.edge.x-t.edge.x)),(n!==1||c%t===0)&&o.length>1)for(let e=0;e<o.length;e+=2){let t=e+1;if(t>=o.length)break;let n=o[e].edge,r=o[t].edge;i.push([[Math.round(n.x),s],[Math.round(r.x),s]])}s+=n,o.forEach(e=>{e.edge.x=e.edge.x+n*e.edge.islope}),c++}return i}function gj(e,t){let n=t.hachureAngle+90,r=t.hachureGap;r<0&&(r=t.strokeWidth*4),r=Math.round(Math.max(r,.1));let i=1;return t.roughness>=1&&(t.randomizer?.next()||Math.random())>.7&&(i=r),mj(e,r,n,i||1)}var _j=class{constructor(e){this.helper=e}fillPolygons(e,t){return this._fillPolygons(e,t)}_fillPolygons(e,t){let n=gj(e,t);return{type:`fillSketch`,ops:this.renderLines(n,t)}}renderLines(e,t){let n=[];for(let r of e)n.push(...this.helper.doubleLineOps(r[0][0],r[0][1],r[1][0],r[1][1],t));return n}};function vj(e){let t=e[0],n=e[1];return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2)}var yj=class extends _j{fillPolygons(e,t){let n=t.hachureGap;n<0&&(n=t.strokeWidth*4),n=Math.max(n,.1);let r=gj(e,Object.assign({},t,{hachureGap:n})),i=Math.PI/180*t.hachureAngle,a=[],o=n*.5*Math.cos(i),s=n*.5*Math.sin(i);for(let[e,t]of r)vj([e,t])&&a.push([[e[0]-o,e[1]+s],[...t]],[[e[0]+o,e[1]-s],[...t]]);return{type:`fillSketch`,ops:this.renderLines(a,t)}}},bj=class extends _j{fillPolygons(e,t){let n=this._fillPolygons(e,t),r=Object.assign({},t,{hachureAngle:t.hachureAngle+90}),i=this._fillPolygons(e,r);return n.ops=n.ops.concat(i.ops),n}},xj=class{constructor(e){this.helper=e}fillPolygons(e,t){t=Object.assign({},t,{hachureAngle:0});let n=gj(e,t);return this.dotsOnLines(n,t)}dotsOnLines(e,t){let n=[],r=t.hachureGap;r<0&&(r=t.strokeWidth*4),r=Math.max(r,.1);let i=t.fillWeight;i<0&&(i=t.strokeWidth/2);let a=r/4;for(let o of e){let e=vj(o),s=e/r,c=Math.ceil(s)-1,l=e-c*r,u=(o[0][0]+o[1][0])/2-r/4,d=Math.min(o[0][1],o[1][1]);for(let e=0;e<c;e++){let o=d+l+e*r,s=u-a+Math.random()*2*a,c=o-a+Math.random()*2*a,f=this.helper.ellipse(s,c,i,i,t);n.push(...f.ops)}}return{type:`fillSketch`,ops:n}}},Sj=class{constructor(e){this.helper=e}fillPolygons(e,t){let n=gj(e,t);return{type:`fillSketch`,ops:this.dashedLine(n,t)}}dashedLine(e,t){let n=t.dashOffset<0?t.hachureGap<0?t.strokeWidth*4:t.hachureGap:t.dashOffset,r=t.dashGap<0?t.hachureGap<0?t.strokeWidth*4:t.hachureGap:t.dashGap,i=[];return e.forEach(e=>{let a=vj(e),o=Math.floor(a/(n+r)),s=(a+r-o*(n+r))/2,c=e[0],l=e[1];c[0]>l[0]&&(c=e[1],l=e[0]);let u=Math.atan((l[1]-c[1])/(l[0]-c[0]));for(let e=0;e<o;e++){let a=e*(n+r),o=a+n,l=[c[0]+a*Math.cos(u)+s*Math.cos(u),c[1]+a*Math.sin(u)+s*Math.sin(u)],d=[c[0]+o*Math.cos(u)+s*Math.cos(u),c[1]+o*Math.sin(u)+s*Math.sin(u)];i.push(...this.helper.doubleLineOps(l[0],l[1],d[0],d[1],t))}}),i}},Cj=class{constructor(e){this.helper=e}fillPolygons(e,t){let n=t.hachureGap<0?t.strokeWidth*4:t.hachureGap,r=t.zigzagOffset<0?n:t.zigzagOffset;t=Object.assign({},t,{hachureGap:n+r});let i=gj(e,t);return{type:`fillSketch`,ops:this.zigzagLines(i,r,t)}}zigzagLines(e,t,n){let r=[];return e.forEach(e=>{let i=vj(e),a=Math.round(i/(2*t)),o=e[0],s=e[1];o[0]>s[0]&&(o=e[1],s=e[0]);let c=Math.atan((s[1]-o[1])/(s[0]-o[0]));for(let e=0;e<a;e++){let i=e*2*t,a=(e+1)*2*t,s=Math.sqrt(2*t**2),l=[o[0]+i*Math.cos(c),o[1]+i*Math.sin(c)],u=[o[0]+a*Math.cos(c),o[1]+a*Math.sin(c)],d=[l[0]+s*Math.cos(c+Math.PI/4),l[1]+s*Math.sin(c+Math.PI/4)];r.push(...this.helper.doubleLineOps(l[0],l[1],d[0],d[1],n),...this.helper.doubleLineOps(d[0],d[1],u[0],u[1],n))}}),r}},wj={};function Tj(e,t){let n=e.fillStyle||`hachure`;if(!wj[n])switch(n){case`zigzag`:wj[n]||(wj[n]=new yj(t));break;case`cross-hatch`:wj[n]||(wj[n]=new bj(t));break;case`dots`:wj[n]||(wj[n]=new xj(t));break;case`dashed`:wj[n]||(wj[n]=new Sj(t));break;case`zigzag-line`:wj[n]||(wj[n]=new Cj(t));break;default:n=`hachure`,wj[n]||(wj[n]=new _j(t))}return wj[n]}function Ej(){return Math.floor(Math.random()*2**31)}var Dj=class{constructor(e){this.seed=e}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}},Oj=0,kj=1,Aj=2,jj={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function Mj(e){let t=[];for(;e!==``;)if(e.match(/^([ \t\r\n,]+)/))e=e.substr(RegExp.$1.length);else if(e.match(/^([aAcChHlLmMqQsStTvVzZ])/))t[t.length]={type:Oj,text:RegExp.$1},e=e.substr(RegExp.$1.length);else if(e.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))t[t.length]={type:kj,text:`${parseFloat(RegExp.$1)}`},e=e.substr(RegExp.$1.length);else return[];return t[t.length]={type:Aj,text:``},t}function Nj(e,t){return e.type===t}function Pj(e){let t=[],n=Mj(e),r=`BOD`,i=0,a=n[i];for(;!Nj(a,Aj);){let o=0,s=[];if(r===`BOD`){if(a.text===`M`||a.text===`m`)i++,o=jj[a.text],r=a.text;else return Pj(`M0,0`+e)}else Nj(a,kj)?o=jj[r]:(i++,o=jj[a.text],r=a.text);if(i+o<n.length){for(let e=i;e<i+o;e++){let t=n[e];if(Nj(t,kj))s[s.length]=+t.text;else throw Error(`Param not a number: `+r+`,`+t.text)}if(typeof jj[r]==`number`){let e={key:r,data:s};t.push(e),i+=o,a=n[i],r===`M`&&(r=`L`),r===`m`&&(r=`l`)}else throw Error(`Bad segment: `+r)}else throw Error(`Path data ended short`)}return t}function Fj(e){let t=0,n=0,r=0,i=0,a=[];for(let{key:o,data:s}of e)switch(o){case`M`:a.push({key:`M`,data:[...s]}),[t,n]=s,[r,i]=s;break;case`m`:t+=s[0],n+=s[1],a.push({key:`M`,data:[t,n]}),r=t,i=n;break;case`L`:a.push({key:`L`,data:[...s]}),[t,n]=s;break;case`l`:t+=s[0],n+=s[1],a.push({key:`L`,data:[t,n]});break;case`C`:a.push({key:`C`,data:[...s]}),t=s[4],n=s[5];break;case`c`:{let e=s.map((e,r)=>r%2?e+n:e+t);a.push({key:`C`,data:e}),t=e[4],n=e[5];break}case`Q`:a.push({key:`Q`,data:[...s]}),t=s[2],n=s[3];break;case`q`:{let e=s.map((e,r)=>r%2?e+n:e+t);a.push({key:`Q`,data:e}),t=e[2],n=e[3];break}case`A`:a.push({key:`A`,data:[...s]}),t=s[5],n=s[6];break;case`a`:t+=s[5],n+=s[6],a.push({key:`A`,data:[s[0],s[1],s[2],s[3],s[4],t,n]});break;case`H`:a.push({key:`H`,data:[...s]}),t=s[0];break;case`h`:t+=s[0],a.push({key:`H`,data:[t]});break;case`V`:a.push({key:`V`,data:[...s]}),n=s[0];break;case`v`:n+=s[0],a.push({key:`V`,data:[n]});break;case`S`:a.push({key:`S`,data:[...s]}),t=s[2],n=s[3];break;case`s`:{let e=s.map((e,r)=>r%2?e+n:e+t);a.push({key:`S`,data:e}),t=e[2],n=e[3];break}case`T`:a.push({key:`T`,data:[...s]}),t=s[0],n=s[1];break;case`t`:t+=s[0],n+=s[1],a.push({key:`T`,data:[t,n]});break;case`Z`:case`z`:a.push({key:`Z`,data:[]}),t=r,n=i}return a}function Ij(e){let t=[],n=``,r=0,i=0,a=0,o=0,s=0,c=0;for(let{key:l,data:u}of e){switch(l){case`M`:t.push({key:`M`,data:[...u]}),[r,i]=u,[a,o]=u;break;case`C`:t.push({key:`C`,data:[...u]}),r=u[4],i=u[5],s=u[2],c=u[3];break;case`L`:t.push({key:`L`,data:[...u]}),[r,i]=u;break;case`H`:r=u[0],t.push({key:`L`,data:[r,i]});break;case`V`:i=u[0],t.push({key:`L`,data:[r,i]});break;case`S`:{let e=0,a=0;n===`C`||n===`S`?(e=r+(r-s),a=i+(i-c)):(e=r,a=i),t.push({key:`C`,data:[e,a,...u]}),s=u[0],c=u[1],r=u[2],i=u[3];break}case`T`:{let[e,a]=u,o=0,l=0;n===`Q`||n===`T`?(o=r+(r-s),l=i+(i-c)):(o=r,l=i);let d=r+2*(o-r)/3,f=i+2*(l-i)/3,p=e+2*(o-e)/3,m=a+2*(l-a)/3;t.push({key:`C`,data:[d,f,p,m,e,a]}),s=o,c=l,r=e,i=a;break}case`Q`:{let[e,n,a,o]=u,l=r+2*(e-r)/3,d=i+2*(n-i)/3,f=a+2*(e-a)/3,p=o+2*(n-o)/3;t.push({key:`C`,data:[l,d,f,p,a,o]}),s=e,c=n,r=a,i=o;break}case`A`:{let e=Math.abs(u[0]),n=Math.abs(u[1]),a=u[2],o=u[3],s=u[4],c=u[5],l=u[6];e===0||n===0?(t.push({key:`C`,data:[r,i,c,l,c,l]}),r=c,i=l):(r!==c||i!==l)&&(zj(r,i,c,l,e,n,a,o,s).forEach(function(e){t.push({key:`C`,data:e})}),r=c,i=l);break}case`Z`:t.push({key:`Z`,data:[]}),r=a,i=o}n=l}return t}function Lj(e){return Math.PI*e/180}function Rj(e,t,n){return[e*Math.cos(n)-t*Math.sin(n),e*Math.sin(n)+t*Math.cos(n)]}function zj(e,t,n,r,i,a,o,s,c,l){let u=Lj(o),d=[],f=0,p=0,m=0,h=0;if(l)[f,p,m,h]=l;else{[e,t]=Rj(e,t,-u),[n,r]=Rj(n,r,-u);let o=(e-n)/2,l=(t-r)/2,d=o*o/(i*i)+l*l/(a*a);d>1&&(d=Math.sqrt(d),i=d*i,a=d*a);let g=s===c?-1:1,_=i*i,v=a*a,y=_*v-_*l*l-v*o*o,b=_*l*l+v*o*o,x=g*Math.sqrt(Math.abs(y/b));m=x*i*l/a+(e+n)/2,h=x*-a*o/i+(t+r)/2,f=Math.asin(parseFloat(((t-h)/a).toFixed(9))),p=Math.asin(parseFloat(((r-h)/a).toFixed(9))),e<m&&(f=Math.PI-f),n<m&&(p=Math.PI-p),f<0&&(f=Math.PI*2+f),p<0&&(p=Math.PI*2+p),c&&f>p&&(f-=Math.PI*2),!c&&p>f&&(p-=Math.PI*2)}let g=p-f;if(Math.abs(g)>Math.PI*120/180){let e=p,t=n,s=r;p=c&&p>f?f+Math.PI*120/180*1:f+Math.PI*120/180*-1,n=m+i*Math.cos(p),r=h+a*Math.sin(p),d=zj(n,r,t,s,i,a,o,0,c,[p,e,m,h])}g=p-f;let _=Math.cos(f),v=Math.sin(f),y=Math.cos(p),b=Math.sin(p),x=Math.tan(g/4),S=4/3*i*x,C=4/3*a*x,w=[e,t],T=[e+S*v,t-C*_],E=[n+S*b,r-C*y],D=[n,r];if(T[0]=2*w[0]-T[0],T[1]=2*w[1]-T[1],l)return[T,E,D].concat(d);{d=[T,E,D].concat(d);let e=[];for(let t=0;t<d.length;t+=3){let n=Rj(d[t][0],d[t][1],u),r=Rj(d[t+1][0],d[t+1][1],u),i=Rj(d[t+2][0],d[t+2][1],u);e.push([n[0],n[1],r[0],r[1],i[0],i[1]])}return e}}var Bj={randOffset:eM,randOffsetWithRange:tM,ellipse:Kj,doubleLineOps:nM};function Vj(e,t,n,r,i){return{type:`path`,ops:oM(e,t,n,r,i)}}function Hj(e,t,n){let r=(e||[]).length;if(r>2){let i=[];for(let t=0;t<r-1;t++)i.push(...oM(e[t][0],e[t][1],e[t+1][0],e[t+1][1],n));return t&&i.push(...oM(e[r-1][0],e[r-1][1],e[0][0],e[0][1],n)),{type:`path`,ops:i}}return r===2?Vj(e[0][0],e[0][1],e[1][0],e[1][1],n):{type:`path`,ops:[]}}function Uj(e,t){return Hj(e,!0,t)}function Wj(e,t,n,r,i){return Uj([[e,t],[e+n,t],[e+n,t+r],[e,t+r]],i)}function Gj(e,t){if(e.length){let n=typeof e[0][0]==`number`?[e]:e,r=cM(n[0],1*(1+t.roughness*.2),t),i=t.disableMultiStroke?[]:cM(n[0],1.5*(1+t.roughness*.22),rM(t));for(let e=1;e<n.length;e++){let a=n[e];if(a.length){let e=cM(a,1*(1+t.roughness*.2),t),n=t.disableMultiStroke?[]:cM(a,1.5*(1+t.roughness*.22),rM(t));for(let t of e)t.op!==`move`&&r.push(t);for(let e of n)e.op!==`move`&&i.push(e)}}return{type:`path`,ops:r.concat(i)}}return{type:`path`,ops:[]}}function Kj(e,t,n,r,i){return Jj(e,t,i,qj(n,r,i)).opset}function qj(e,t,n){let r=Math.sqrt(Math.PI*2*Math.sqrt(((e/2)**2+(t/2)**2)/2)),i=Math.ceil(Math.max(n.curveStepCount,n.curveStepCount/Math.sqrt(200)*r)),a=Math.PI*2/i,o=Math.abs(e/2),s=Math.abs(t/2),c=1-n.curveFitting;return o+=Q(o*c,n),s+=Q(s*c,n),{increment:a,rx:o,ry:s}}function Jj(e,t,n,r){let[i,a]=uM(r.increment,e,t,r.rx,r.ry,1,r.increment*aM(.1,aM(.4,1,n),n),n),o=lM(i,null,n);if(!n.disableMultiStroke&&n.roughness!==0){let[i]=uM(r.increment,e,t,r.rx,r.ry,1.5,0,n),a=lM(i,null,n);o=o.concat(a)}return{estimatedPoints:a,opset:{type:`path`,ops:o}}}function Yj(e,t,n,r,i,a,o,s,c){let l=e,u=t,d=Math.abs(n/2),f=Math.abs(r/2);d+=Q(d*.01,c),f+=Q(f*.01,c);let p=i,m=a;for(;p<0;)p+=Math.PI*2,m+=Math.PI*2;m-p>Math.PI*2&&(p=0,m=Math.PI*2);let h=Math.PI*2/c.curveStepCount,g=Math.min(h/2,(m-p)/2),_=dM(g,l,u,d,f,p,m,1,c);if(!c.disableMultiStroke){let e=dM(g,l,u,d,f,p,m,1.5,c);_.push(...e)}return o&&(s?_.push(...oM(l,u,l+d*Math.cos(p),u+f*Math.sin(p),c),...oM(l,u,l+d*Math.cos(m),u+f*Math.sin(m),c)):_.push({op:`lineTo`,data:[l,u]},{op:`lineTo`,data:[l+d*Math.cos(p),u+f*Math.sin(p)]})),{type:`path`,ops:_}}function Xj(e,t){let n=Ij(Fj(Pj(e))),r=[],i=[0,0],a=[0,0];for(let{key:e,data:o}of n)switch(e){case`M`:a=[o[0],o[1]],i=[o[0],o[1]];break;case`L`:r.push(...oM(a[0],a[1],o[0],o[1],t)),a=[o[0],o[1]];break;case`C`:{let[e,n,i,s,c,l]=o;r.push(...fM(e,n,i,s,c,l,a,t)),a=[c,l];break}case`Z`:r.push(...oM(a[0],a[1],i[0],i[1],t)),a=[i[0],i[1]]}return{type:`path`,ops:r}}function Zj(e,t){let n=[];for(let r of e)if(r.length){let e=t.maxRandomnessOffset||0,i=r.length;if(i>2){n.push({op:`move`,data:[r[0][0]+Q(e,t),r[0][1]+Q(e,t)]});for(let a=1;a<i;a++)n.push({op:`lineTo`,data:[r[a][0]+Q(e,t),r[a][1]+Q(e,t)]})}}return{type:`fillPath`,ops:n}}function Qj(e,t){return Tj(t,Bj).fillPolygons(e,t)}function $j(e,t,n,r,i,a,o){let s=e,c=t,l=Math.abs(n/2),u=Math.abs(r/2);l+=Q(l*.01,o),u+=Q(u*.01,o);let d=i,f=a;for(;d<0;)d+=Math.PI*2,f+=Math.PI*2;f-d>Math.PI*2&&(d=0,f=Math.PI*2);let p=(f-d)/o.curveStepCount,m=[];for(let e=d;e<=f;e+=p)m.push([s+l*Math.cos(e),c+u*Math.sin(e)]);return m.push([s+l*Math.cos(f),c+u*Math.sin(f)]),m.push([s,c]),Qj([m],o)}function eM(e,t){return Q(e,t)}function tM(e,t,n){return aM(e,t,n)}function nM(e,t,n,r,i){return oM(e,t,n,r,i,!0)}function rM(e){let t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function iM(e){return e.randomizer||=new Dj(e.seed||0),e.randomizer.next()}function aM(e,t,n,r=1){return n.roughness*r*(iM(n)*(t-e)+e)}function Q(e,t,n=1){return aM(-e,e,t,n)}function oM(e,t,n,r,i,a=!1){let o=a?i.disableMultiStrokeFill:i.disableMultiStroke,s=sM(e,t,n,r,i,!0,!1);if(o)return s;let c=sM(e,t,n,r,i,!0,!0);return s.concat(c)}function sM(e,t,n,r,i,a,o){let s=(e-n)**2+(t-r)**2,c=Math.sqrt(s),l=1;l=c<200?1:c>500?.4:-.0016668*c+1.233334;let u=i.maxRandomnessOffset||0;u*u*100>s&&(u=c/10);let d=u/2,f=.2+iM(i)*.2,p=i.bowing*i.maxRandomnessOffset*(r-t)/200,m=i.bowing*i.maxRandomnessOffset*(e-n)/200;p=Q(p,i,l),m=Q(m,i,l);let h=[],g=()=>Q(d,i,l),_=()=>Q(u,i,l),v=i.preserveVertices;return a&&(o?h.push({op:`move`,data:[e+(v?0:g()),t+(v?0:g())]}):h.push({op:`move`,data:[e+(v?0:Q(u,i,l)),t+(v?0:Q(u,i,l))]})),o?h.push({op:`bcurveTo`,data:[p+e+(n-e)*f+g(),m+t+(r-t)*f+g(),p+e+2*(n-e)*f+g(),m+t+2*(r-t)*f+g(),n+(v?0:g()),r+(v?0:g())]}):h.push({op:`bcurveTo`,data:[p+e+(n-e)*f+_(),m+t+(r-t)*f+_(),p+e+2*(n-e)*f+_(),m+t+2*(r-t)*f+_(),n+(v?0:_()),r+(v?0:_())]}),h}function cM(e,t,n){if(!e.length)return[];let r=[];r.push([e[0][0]+Q(t,n),e[0][1]+Q(t,n)]),r.push([e[0][0]+Q(t,n),e[0][1]+Q(t,n)]);for(let i=1;i<e.length;i++)r.push([e[i][0]+Q(t,n),e[i][1]+Q(t,n)]),i===e.length-1&&r.push([e[i][0]+Q(t,n),e[i][1]+Q(t,n)]);return lM(r,null,n)}function lM(e,t,n){let r=e.length,i=[];if(r>3){let a=[],o=1-n.curveTightness;i.push({op:`move`,data:[e[1][0],e[1][1]]});for(let t=1;t+2<r;t++){let n=e[t];a[0]=[n[0],n[1]],a[1]=[n[0]+(o*e[t+1][0]-o*e[t-1][0])/6,n[1]+(o*e[t+1][1]-o*e[t-1][1])/6],a[2]=[e[t+1][0]+(o*e[t][0]-o*e[t+2][0])/6,e[t+1][1]+(o*e[t][1]-o*e[t+2][1])/6],a[3]=[e[t+1][0],e[t+1][1]],i.push({op:`bcurveTo`,data:[a[1][0],a[1][1],a[2][0],a[2][1],a[3][0],a[3][1]]})}if(t&&t.length===2){let e=n.maxRandomnessOffset;i.push({op:`lineTo`,data:[t[0]+Q(e,n),t[1]+Q(e,n)]})}}else r===3?(i.push({op:`move`,data:[e[1][0],e[1][1]]}),i.push({op:`bcurveTo`,data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):r===2&&i.push(...sM(e[0][0],e[0][1],e[1][0],e[1][1],n,!0,!0));return i}function uM(e,t,n,r,i,a,o,s){let c=s.roughness===0,l=[],u=[];if(c){e/=4,u.push([t+r*Math.cos(-e),n+i*Math.sin(-e)]);for(let a=0;a<=Math.PI*2;a+=e){let e=[t+r*Math.cos(a),n+i*Math.sin(a)];l.push(e),u.push(e)}u.push([t+r*Math.cos(0),n+i*Math.sin(0)]),u.push([t+r*Math.cos(e),n+i*Math.sin(e)])}else{let c=Q(.5,s)-Math.PI/2;u.push([Q(a,s)+t+.9*r*Math.cos(c-e),Q(a,s)+n+.9*i*Math.sin(c-e)]);let d=Math.PI*2+c-.01;for(let o=c;o<d;o+=e){let e=[Q(a,s)+t+r*Math.cos(o),Q(a,s)+n+i*Math.sin(o)];l.push(e),u.push(e)}u.push([Q(a,s)+t+r*Math.cos(c+Math.PI*2+o*.5),Q(a,s)+n+i*Math.sin(c+Math.PI*2+o*.5)]),u.push([Q(a,s)+t+.98*r*Math.cos(c+o),Q(a,s)+n+.98*i*Math.sin(c+o)]),u.push([Q(a,s)+t+.9*r*Math.cos(c+o*.5),Q(a,s)+n+.9*i*Math.sin(c+o*.5)])}return[u,l]}function dM(e,t,n,r,i,a,o,s,c){let l=a+Q(.1,c),u=[];u.push([Q(s,c)+t+.9*r*Math.cos(l-e),Q(s,c)+n+.9*i*Math.sin(l-e)]);for(let a=l;a<=o;a+=e)u.push([Q(s,c)+t+r*Math.cos(a),Q(s,c)+n+i*Math.sin(a)]);return u.push([t+r*Math.cos(o),n+i*Math.sin(o)]),u.push([t+r*Math.cos(o),n+i*Math.sin(o)]),lM(u,null,c)}function fM(e,t,n,r,i,a,o,s){let c=[],l=[s.maxRandomnessOffset||1,(s.maxRandomnessOffset||1)+.3],u=[0,0],d=s.disableMultiStroke?1:2,f=s.preserveVertices;for(let p=0;p<d;p++)p===0?c.push({op:`move`,data:[o[0],o[1]]}):c.push({op:`move`,data:[o[0]+(f?0:Q(l[0],s)),o[1]+(f?0:Q(l[0],s))]}),u=f?[i,a]:[i+Q(l[p],s),a+Q(l[p],s)],c.push({op:`bcurveTo`,data:[e+Q(l[p],s),t+Q(l[p],s),n+Q(l[p],s),r+Q(l[p],s),u[0],u[1]]});return c}function pM(e){return[...e]}function mM(e,t=0){let n=e.length;if(n<3)throw Error(`A curve must have at least three points.`);let r=[];if(n===3)r.push(pM(e[0]),pM(e[1]),pM(e[2]),pM(e[2]));else{let n=[];n.push(e[0],e[0]);for(let t=1;t<e.length;t++)n.push(e[t]),t===e.length-1&&n.push(e[t]);let i=[],a=1-t;r.push(pM(n[0]));for(let e=1;e+2<n.length;e++){let t=n[e];i[0]=[t[0],t[1]],i[1]=[t[0]+(a*n[e+1][0]-a*n[e-1][0])/6,t[1]+(a*n[e+1][1]-a*n[e-1][1])/6],i[2]=[n[e+1][0]+(a*n[e][0]-a*n[e+2][0])/6,n[e+1][1]+(a*n[e][1]-a*n[e+2][1])/6],i[3]=[n[e+1][0],n[e+1][1]],r.push(i[1],i[2],i[3])}}return r}function hM(e,t){return Math.sqrt(gM(e,t))}function gM(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2}function _M(e,t,n){let r=gM(t,n);if(r===0)return gM(e,t);let i=((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r;return i=Math.max(0,Math.min(1,i)),gM(e,vM(t,n,i))}function vM(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function yM(e,t){let n=e[t+0],r=e[t+1],i=e[t+2],a=e[t+3],o=3*r[0]-2*n[0]-a[0];o*=o;let s=3*r[1]-2*n[1]-a[1];s*=s;let c=3*i[0]-2*a[0]-n[0];c*=c;let l=3*i[1]-2*a[1]-n[1];return l*=l,o<c&&(o=c),s<l&&(s=l),o+s}function bM(e,t,n,r){let i=r||[];if(yM(e,t)<n){let n=e[t+0];i.length?hM(i[i.length-1],n)>1&&i.push(n):i.push(n),i.push(e[t+3])}else{let r=.5,a=e[t+0],o=e[t+1],s=e[t+2],c=e[t+3],l=vM(a,o,r),u=vM(o,s,r),d=vM(s,c,r),f=vM(l,u,r),p=vM(u,d,r),m=vM(f,p,r);bM([a,l,f,m],0,n,i),bM([m,p,d,c],0,n,i)}return i}function xM(e,t){return SM(e,0,e.length,t)}function SM(e,t,n,r,i){let a=i||[],o=e[t],s=e[n-1],c=0,l=1;for(let r=t+1;r<n-1;++r){let t=_M(e[r],o,s);t>c&&(c=t,l=r)}return Math.sqrt(c)>r?(SM(e,t,l+1,r,a),SM(e,l,n,r,a)):(a.length||a.push(o),a.push(s)),a}function CM(e,t=.15,n){let r=[],i=(e.length-1)/3;for(let n=0;n<i;n++)bM(e,n*3,t,r);return n&&n>0?SM(r,0,r.length,n):r}function wM(e,t,n){let r=Ij(Fj(Pj(e))),i=[],a=[],o=[0,0],s=[],c=()=>{s.length>=4&&a.push(...CM(s,t)),s=[]},l=()=>{c(),a.length&&(i.push(a),a=[])};for(let{key:e,data:t}of r)switch(e){case`M`:l(),o=[t[0],t[1]],a.push(o);break;case`L`:c(),a.push([t[0],t[1]]);break;case`C`:if(!s.length){let e=a.length?a[a.length-1]:o;s.push([e[0],e[1]])}s.push([t[0],t[1]]),s.push([t[2],t[3]]),s.push([t[4],t[5]]);break;case`Z`:c(),a.push([o[0],o[1]])}if(l(),!n)return i;let u=[];for(let e of i){let t=xM(e,n);t.length&&u.push(t)}return u}var TM=`none`,EM=class{constructor(e){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:`#000`,strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:`hachure`,fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=e||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Ej()}_o(e){return e?Object.assign({},this.defaultOptions,e):this.defaultOptions}_d(e,t,n){return{shape:e,sets:t||[],options:n||this.defaultOptions}}line(e,t,n,r,i){let a=this._o(i);return this._d(`line`,[Vj(e,t,n,r,a)],a)}rectangle(e,t,n,r,i){let a=this._o(i),o=[],s=Wj(e,t,n,r,a);if(a.fill){let i=[[e,t],[e+n,t],[e+n,t+r],[e,t+r]];a.fillStyle===`solid`?o.push(Zj([i],a)):o.push(Qj([i],a))}return a.stroke!==TM&&o.push(s),this._d(`rectangle`,o,a)}ellipse(e,t,n,r,i){let a=this._o(i),o=[],s=qj(n,r,a),c=Jj(e,t,a,s);if(a.fill){if(a.fillStyle===`solid`){let n=Jj(e,t,a,s).opset;n.type=`fillPath`,o.push(n)}else o.push(Qj([c.estimatedPoints],a))}return a.stroke!==TM&&o.push(c.opset),this._d(`ellipse`,o,a)}circle(e,t,n,r){let i=this.ellipse(e,t,n,n,r);return i.shape=`circle`,i}linearPath(e,t){let n=this._o(t);return this._d(`linearPath`,[Hj(e,!1,n)],n)}arc(e,t,n,r,i,a,o=!1,s){let c=this._o(s),l=[],u=Yj(e,t,n,r,i,a,o,!0,c);if(o&&c.fill){if(c.fillStyle===`solid`){let o=Object.assign({},c);o.disableMultiStroke=!0;let s=Yj(e,t,n,r,i,a,!0,!1,o);s.type=`fillPath`,l.push(s)}else l.push($j(e,t,n,r,i,a,c))}return c.stroke!==TM&&l.push(u),this._d(`arc`,l,c)}curve(e,t){let n=this._o(t),r=[],i=Gj(e,n);if(n.fill&&n.fill!==TM){if(n.fillStyle===`solid`){let t=Gj(e,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));r.push({type:`fillPath`,ops:this._mergedShape(t.ops)})}else{let t=[],i=e;if(i.length){let e=typeof i[0][0]==`number`?[i]:i;for(let r of e)r.length<3?t.push(...r):r.length===3?t.push(...CM(mM([r[0],r[0],r[1],r[2]]),10,(1+n.roughness)/2)):t.push(...CM(mM(r),10,(1+n.roughness)/2))}t.length&&r.push(Qj([t],n))}}return n.stroke!==TM&&r.push(i),this._d(`curve`,r,n)}polygon(e,t){let n=this._o(t),r=[],i=Hj(e,!0,n);return n.fill&&(n.fillStyle===`solid`?r.push(Zj([e],n)):r.push(Qj([e],n))),n.stroke!==TM&&r.push(i),this._d(`polygon`,r,n)}path(e,t){let n=this._o(t),r=[];if(!e)return this._d(`path`,r,n);e=(e||``).replace(/\n/g,` `).replace(/(-\s)/g,`-`).replace(`/(ss)/g`,` `);let i=n.fill&&n.fill!==`transparent`&&n.fill!==TM,a=n.stroke!==TM,o=!!(n.simplification&&n.simplification<1),s=o?4-4*(n.simplification||1):(1+n.roughness)/2,c=wM(e,1,s),l=Xj(e,n);if(i){if(n.fillStyle===`solid`){if(c.length===1){let t=Xj(e,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));r.push({type:`fillPath`,ops:this._mergedShape(t.ops)})}else r.push(Zj(c,n))}else r.push(Qj(c,n))}return a&&(o?c.forEach(e=>{r.push(Hj(e,!1,n))}):r.push(l)),this._d(`path`,r,n)}opsToPath(e,t){let n=``;for(let r of e.ops){let e=typeof t==`number`&&t>=0?r.data.map(e=>+e.toFixed(t)):r.data;switch(r.op){case`move`:n+=`M${e[0]} ${e[1]} `;break;case`bcurveTo`:n+=`C${e[0]} ${e[1]}, ${e[2]} ${e[3]}, ${e[4]} ${e[5]} `;break;case`lineTo`:n+=`L${e[0]} ${e[1]} `}}return n.trim()}toPaths(e){let t=e.sets||[],n=e.options||this.defaultOptions,r=[];for(let e of t){let t=null;switch(e.type){case`path`:t={d:this.opsToPath(e),stroke:n.stroke,strokeWidth:n.strokeWidth,fill:TM};break;case`fillPath`:t={d:this.opsToPath(e),stroke:TM,strokeWidth:0,fill:n.fill||TM};break;case`fillSketch`:t=this.fillSketch(e,n)}t&&r.push(t)}return r}fillSketch(e,t){let n=t.fillWeight;return n<0&&(n=t.strokeWidth/2),{d:this.opsToPath(e),stroke:t.fill||TM,strokeWidth:n,fill:TM}}_mergedShape(e){return e.filter((e,t)=>t===0||e.op!==`move`)}};function DM([e,t],[n,r],i){if(!i)return[e,t];let a=Math.cos(i),o=Math.sin(i),s=e-n,c=t-r;return[n+s*a-c*o,r+s*o+c*a]}function OM([e,t],[n,r]){return Math.hypot(n-e,r-t)}function kM(e,t,n){let[r,i]=e,[a,o]=t,[s,c]=n,l=s-a,u=c-o,d=l*l+u*u;if(d===0)return OM(e,t);let f=Math.max(0,Math.min(1,((r-a)*l+(i-o)*u)/d));return OM(e,[a+f*l,o+f*u])}function AM(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let[a,o]of e)t=Math.min(t,a),n=Math.min(n,o),r=Math.max(r,a),i=Math.max(i,o);return[t,n,r,i]}function jM(e,t){return t[0]>=e[0]&&t[1]>=e[1]&&t[2]<=e[2]&&t[3]<=e[3]}function MM(e,t){return e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}function NM(e,t){return[Math.min(e[0],t[0]),Math.min(e[1],t[1]),Math.max(e[0],t[0]),Math.max(e[1],t[1])]}function PM(e){return typeof e.angle==`number`&&Number.isFinite(e.angle)?e.angle:0}function FM(e){return e.type===`line`||e.type===`arrow`||e.type===`freedraw`}function IM(e){return e.points&&e.points.length>0?e.points:[[0,0]]}function LM(e){if(FM(e)){let[t,n,r,i]=AM(IM(e));return[e.x+(t+r)/2,e.y+(n+i)/2]}return[e.x+e.width/2,e.y+e.height/2]}function RM(e){let t=LM(e);return IM(e).map(([n,r])=>DM([e.x+n,e.y+r],t,PM(e)))}function zM(e){if(FM(e))return RM(e);let t=LM(e),{x:n,y:r,width:i,height:a}=e;return[[n,r],[n+i,r],[n+i,r+a],[n,r+a]].map(n=>DM(n,t,PM(e)))}function BM(e){return AM(zM(e))}function VM(e){return e.length===0?[0,0,0,0]:AM(e.flatMap(e=>zM(e)))}function HM(e,t){let[n,r]=DM(t,LM(e),-PM(e));return[n-e.x,r-e.y]}var UM=e=>!!e.backgroundColor&&e.backgroundColor!==`transparent`;function WM(e,t,[n,r],i,a){return n>=-i&&n<=e+i&&r>=-i&&r<=t+i?a?!0:n<=i||n>=e-i||r<=i||r>=t-i:!1}function GM(e,t,[n,r],i,a){let o=e/2,s=t/2;if(o<=0||s<=0)return!1;let c=n-o,l=r-s,u=Math.sqrt(c*c/(o*o)+l*l/(s*s)),d=Math.abs(u-1)*Math.min(o,s);return a&&u<=1?!0:d<=i}function KM(e,t,n,r,i){let a=[e/2,0],o=[e,t/2],s=[e/2,t],c=[0,t/2];return i&&e>0&&t>0&&Math.abs(n[0]-e/2)/(e/2)+Math.abs(n[1]-t/2)/(t/2)<=1?!0:[[a,o],[o,s],[s,c],[c,a]].some(([e,t])=>kM(n,e,t)<=r)}function qM(e,t,n){if(e.length===1)return kM(t,e[0],e[0])<=n;for(let r=0;r<e.length-1;r++)if(kM(t,e[r],e[r+1])<=n)return!0;return!1}function JM(e,t,n){if(e.isDeleted)return!1;let r=n+(Number.isFinite(e.strokeWidth)?e.strokeWidth:0)/2;if(FM(e))return qM(RM(e),t,r);let i=HM(e,t),{width:a,height:o}=e;switch(e.type){case`rectangle`:case`embeddable`:case`iframe`:return WM(a,o,i,r,UM(e));case`ellipse`:return GM(a,o,i,r,UM(e));case`diamond`:return KM(a,o,i,r,UM(e));case`frame`:case`magicframe`:{let[e,t]=i;return e>=0&&e<=a&&t>=-20&&t<0||WM(a,o,i,r,!1)}default:return WM(a,o,i,r,!0)}}function YM(e,t){return e.filter(e=>!e.isDeleted&&jM(t,BM(e)))}var XM=`"LXGW WenKai Screen", "LXGW WenKai", "Excalifont", "Virgil", "Comic Sans MS", "Segoe Print", "Bradley Hand", cursive`,ZM=`Helvetica, "PingFang SC", "Microsoft YaHei", "Segoe UI Emoji", "Segoe UI Symbol", system-ui, sans-serif`,QM=`"Cascadia Code", "Cascadia", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,$M=new Map;function eN(e,t){t?$M.set(e,t):$M.delete(e)}var tN=new Set([2,3,6,8,9]);function nN(e){return!tN.has(e)}function rN(e){let t=e===void 0?void 0:$M.get(e);if(t)return t;switch(e){case 2:case 6:case 9:return ZM;case 3:case 8:return QM;default:return XM}}var iN={strokeColor:`#1e1e1e`,backgroundColor:`transparent`,fillStyle:`hachure`,strokeWidth:2,strokeStyle:`solid`,roughness:1,opacity:100,roundness:`round`,shadow:!1,fontFamily:5,fontSize:20,textAlign:`left`,startArrowhead:null,endArrowhead:`arrow`,arrowType:`round`},aN=1.25,oN=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`;function sN(e=21){let t=crypto.getRandomValues(new Uint8Array(e)),n=``;for(let e of t)n+=oN[e&63];return n}function cN(){return Math.floor(Math.random()*2**31)}var lN=`#1e1e1e`,uN=`#1971c2`,dN=`3px solid #c4c4c4`,fN={fontSize:16,fontWeight:400,lineHeight:1.5},pN={h1:{fontSize:26,fontWeight:600,lineHeight:1.3},h2:{fontSize:22,fontWeight:600,lineHeight:1.35},h3:{fontSize:18,fontWeight:600,lineHeight:1.4}};function mN(e){return e.type===`heading`?pN[e.tag??``]??{...fN,fontWeight:600}:fN}var hN={bold:1,italic:2,strikethrough:4,underline:8,code:16,highlight:128};function gN(e,t){return typeof e.format==`number`&&(e.format&t)!==0}var _N=new Set([`root`,`list`,`listitem`,`quote`]);function vN(e){return _N.has(e.type)}function yN(e){return e?e.type===`text`?e.text??``:typeof e.text==`string`&&!e.children?.length?e.text:e.type===`linebreak`?`
|
|
15
|
-
`:e.type===`tab`?` `:(e.children??[]).map(yN).join(``):``}function bN(e){let t=e?.root;return t&&Array.isArray(t.children)?t:{type:`root`,children:[]}}function xN(e){return{root:{type:`root`,children:e.map(e=>({type:`paragraph`,children:e?[{type:`text`,text:e}]:[]}))}}}var SN=new Set([`rectangle`,`diamond`,`ellipse`,`image`,`svg`,`richtext`]),CN=e=>SN.has(e),wN=e=>e.shadow===!0&&CN(e.type);function TN(e,t){return t.roundness===`sharp`?null:e===`line`||e===`arrow`?{type:2}:[`rectangle`,`diamond`,`embeddable`,`iframe`,`richtext`].includes(e)?{type:3}:null}function EN(e,t,n){return{id:sN(),type:e,x:0,y:0,width:0,height:0,angle:0,strokeColor:n.strokeColor,backgroundColor:n.backgroundColor,fillStyle:n.fillStyle,...n.shadow&&CN(e)?{shadow:!0}:null,strokeWidth:n.strokeWidth,strokeStyle:n.strokeStyle,roughness:n.roughness,opacity:n.opacity,groupIds:[],frameId:null,index:null,roundness:TN(e,n),seed:cN(),version:1,versionNonce:cN(),isDeleted:!1,boundElements:null,updated:Date.now(),link:null,locked:!1,...t}}function DN(e,t,n=iN){return EN(e,t,n)}function ON(e,t,n=iN){let r=e===`arrow`,i=r&&n.arrowType===`elbow`;return{...EN(e,{},r&&n.arrowType!==`round`?{...n,roundness:`sharp`}:n),points:[[0,0]],lastCommittedPoint:null,startBinding:null,endBinding:null,startArrowhead:r?n.startArrowhead:null,endArrowhead:r?n.endArrowhead:null,...r?{elbowed:i}:null,...t}}function kN(e,t=iN){return{...EN(`freedraw`,{},t),points:[],pressures:[],simulatePressure:!0,lastCommittedPoint:null,...e}}function AN(e,t=iN){return{...EN(`text`,{},{...t,roundness:`sharp`}),fontSize:t.fontSize,fontFamily:t.fontFamily,textAlign:t.textAlign,verticalAlign:`top`,containerId:null,originalText:e.text,autoResize:!0,lineHeight:aN,...e}}function jN(e,t=iN){return{...EN(`image`,{},{...t,roundness:`sharp`}),fileId:void 0,status:`pending`,scale:[1,1],crop:null,...e}}function MN(e,t=iN){return{...EN(`richtext`,{},{...t,roundness:`round`,shadow:!1}),strokeColor:`transparent`,backgroundColor:`#ffec99`,fillStyle:`solid`,roughness:0,strokeWidth:1,content:xN([``]),...e}}function NN(e,t=iN){return{...EN(`svg`,{},{...t,roundness:`sharp`,shadow:!1}),svg:``,...e}}function PN(e,t=iN){return{...EN(`frame`,{},{...t,roundness:`sharp`,backgroundColor:`transparent`}),name:null,...e}}var FN=/[\p{Script=Han}\p{Script=Hangul}\p{Script=Hiragana}\p{Script=Katakana}\u3000-\u303F\uFF01-\uFF60]/u;function IN(e,t){let n=VN(t),r=0;for(let t of e)r+=FN.test(t)?n:n*.6;return r}var LN;function RN(){return LN===void 0&&(LN=null,typeof OffscreenCanvas<`u`&&(LN=new OffscreenCanvas(1,1).getContext(`2d`)),!LN&&typeof document<`u`&&!/jsdom/i.test(navigator.userAgent)&&(LN=document.createElement(`canvas`).getContext(`2d`))),LN}var zN=(e,t)=>{let n=RN();return n?(n.font=t,n.measureText(e).width):IN(e,t)};function BN(e,t){return zN(e,t)}function VN(e){let t=/(\d+(?:\.\d+)?)px/.exec(e);return t?Number(t[1]):20}function HN({fontSize:e,fontFamily:t}){return`${e}px ${rN(t)}`}var UN={1:1.25,2:1.15,3:1.2,5:1.25,6:1.35,8:1.15,9:1.15};function WN(e){return UN[e]??1.25}function GN(e,t,n){let r=e.split(`
|
|
16
|
-
`);return{width:Math.max(0,...r.map(e=>BN(e,t))),height:r.length*VN(t)*n}}function KN(e){return FN.test(e)}var qN=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,JN=qN[0],YN=`A${JN.repeat(26)}`;function XN(e,t){if(t!==null&&e>=t)throw Error(`${e} >= ${t}`);if(e.slice(-1)===JN||t&&t.slice(-1)===JN)throw Error(`trailing zero`);if(t){let n=0;for(;(e[n]||JN)===t[n];)n++;if(n>0)return t.slice(0,n)+XN(e.slice(n),t.slice(n))}let n=e?qN.indexOf(e[0]):0,r=t===null?62:qN.indexOf(t[0]);return r-n>1?qN[Math.round(.5*(n+r))]:t&&t.length>1?t.slice(0,1):qN[n]+XN(e.slice(1),null)}function ZN(e){if(e>=`a`&&e<=`z`)return e.charCodeAt(0)-97+2;if(e>=`A`&&e<=`Z`)return 90-e.charCodeAt(0)+2;throw Error(`invalid order key head: ${e}`)}function QN(e){let t=ZN(e[0]);if(t>e.length)throw Error(`invalid order key: ${e}`);return e.slice(0,t)}function $N(e){if(typeof e!=`string`||e.length===0)return!1;try{if(e===YN)return!1;let t=QN(e);return[...e].every(e=>qN.includes(e))?e.slice(t.length).slice(-1)!==JN:!1}catch{return!1}}function eP(e){if(!$N(e))throw Error(`invalid order key: ${e}`)}function tP(e){let[t,...n]=e.split(``),r=!0;for(let e=n.length-1;r&&e>=0;e--){let t=qN.indexOf(n[e])+1;t===62?n[e]=JN:(n[e]=qN[t],r=!1)}if(!r)return t+n.join(``);if(t===`Z`)return`a${JN}`;if(t===`z`)return null;let i=String.fromCharCode(t.charCodeAt(0)+1);return i>`a`?n.push(JN):n.pop(),i+n.join(``)}function nP(e){let[t,...n]=e.split(``),r=!0;for(let e=n.length-1;r&&e>=0;e--){let t=qN.indexOf(n[e])-1;t===-1?n[e]=qN.slice(-1):(n[e]=qN[t],r=!1)}if(!r)return t+n.join(``);if(t===`a`)return`Z${qN.slice(-1)}`;if(t===`A`)return null;let i=String.fromCharCode(t.charCodeAt(0)-1);return i<`Z`?n.push(qN.slice(-1)):n.pop(),i+n.join(``)}function rP(e,t){if(e!==null&&eP(e),t!==null&&eP(t),e!==null&&t!==null&&e>=t)throw Error(`${e} >= ${t}`);if(e===null){if(t===null)return`a${JN}`;let e=QN(t),n=t.slice(e.length);if(e===YN)return e+XN(``,n);if(e<t)return e;let r=nP(e);if(r===null)throw Error(`cannot decrement any more`);return r}if(t===null){let t=QN(e),n=e.slice(t.length),r=tP(t);return r===null?t+XN(n,null):r}let n=QN(e),r=e.slice(n.length),i=QN(t),a=t.slice(i.length);if(n===i)return n+XN(r,a);let o=tP(n);if(o===null)throw Error(`cannot increment any more`);return o<t?o:n+XN(r,null)}function iP(e,t,n){if(n<=0)return[];if(n===1)return[rP(e,t)];if(t===null){let r=rP(e,t),i=[r];for(let e=0;e<n-1;e++)r=rP(r,t),i.push(r);return i}if(e===null){let r=rP(e,t),i=[r];for(let t=0;t<n-1;t++)r=rP(e,r),i.push(r);return i.reverse()}let r=Math.floor(n/2),i=rP(e,t);return[...iP(e,i,r),i,...iP(i,t,n-r-1)]}function aP(e){let t=[],n=null;for(let r of e){let e=$N(r.index)&&(n===null||r.index>n);t.push(e),e&&(n=r.index)}if(t.every(Boolean))return[...e];let r=[...e],i=0;for(;i<r.length;){if(t[i]){i++;continue}let e=i;for(;i<r.length&&!t[i];)i++;let n=iP(e>0?r[e-1].index:null,i<r.length?r[i].index:null,i-e);for(let t=e;t<i;t++)r[t]={...r[t],index:n[t-e]}}return r}function $(e,t={}){return{...e,...t,version:(e.version??0)+1,versionNonce:cN(),updated:Date.now()}}var oP=`http://www.w3.org/2000/svg`,sP=/<svg\b[^>]*>/i;function cP(e){return typeof e==`string`&&/^\s*(?:<\?xml[^>]*>\s*)?(?:<!--[\s\S]*?-->\s*)*<svg[\s/>]/i.test(e)}function lP(e){let t=sP.exec(e);if(!t||/\sxmlns\s*=/.test(t[0]))return e;let n=t.index+4;return`${e.slice(0,n)} xmlns="${oP}"${e.slice(n)}`}function uP(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(lP(e))}`}function dP(e,t){let n=RegExp(`\\s${t}\\s*=\\s*["']([^"']*)["']`,`i`).exec(e);return n?n[1]:null}function fP(e){if(!e)return null;let t=/^\s*(\d+(?:\.\d+)?)\s*(?:px\s*)?$/i.exec(e);return t?Number(t[1]):null}function pP(e){let t=sP.exec(e)?.[0];if(!t)return null;let n=fP(dP(t,`width`)),r=fP(dP(t,`height`));if(n&&r)return{width:n,height:r};let i=dP(t,`viewBox`)?.trim().split(/[\s,]+/).map(Number);return i&&i.length===4&&i[2]>0&&i[3]>0?{width:i[2],height:i[3]}:null}var mP=120,hP=.7;function gP(e){let t=[],n=``;for(let r of e)r===` `||KN(r)?(n&&t.push(n),n=``,t.push(r)):n+=r;return n&&t.push(n),t}function _P(e,t,n){let r=[],i=``;for(let a of e)i&&BN(i+a,t)>n?(r.push(i),i=a):i+=a;return i&&r.push(i),r}function vP(e,t,n){let r=[],i=``,a=()=>{r.push(i.trimEnd()),i=``};for(let o of gP(e)){if(BN(i+o,t)<=n){i+=o;continue}if(o===` `){a();continue}if(i&&a(),BN(o,t)<=n){i=o;continue}let e=_P(o,t,n);for(let t of e.slice(0,-1))r.push(t);i=e.at(-1)??``}return(i||r.length===0)&&a(),r}function yP(e,t,n){return!Number.isFinite(n)||n<=0?e:e.split(`
|
|
17
|
-
`).flatMap(e=>vP(e,t,n)).join(`
|
|
18
|
-
`)}function bP(e){let t=0;for(let n=0;n<e.length-1;n++)t+=OM(e[n],e[n+1]);return t}function xP(e){if(!FM(e))return[e.x+e.width/2,e.y+e.height/2];let t=RM(e);if(t.length===1)return t[0];let n=bP(t)/2;for(let e=0;e<t.length-1;e++){let r=OM(t[e],t[e+1]);if(n<=r){let i=r===0?0:n/r;return[t[e][0]+(t[e+1][0]-t[e][0])*i,t[e][1]+(t[e+1][1]-t[e][1])*i]}n-=r}return t.at(-1)}function SP(e){if(FM(e)){let t=bP(RM(e));return Math.max(mP,t*hP)}return e.type===`ellipse`?Math.round(e.width/2*Math.SQRT2)-10:e.type===`diamond`?Math.round(e.width/2)-10:e.width-10}function CP(e){return e.type===`ellipse`?Math.round(e.height/2*Math.SQRT2)-10:e.type===`diamond`?Math.round(e.height/2)-10:e.height-10}function wP(e,t){return e.type===`ellipse`?Math.ceil((t+10)*2/Math.SQRT2):e.type===`diamond`?Math.ceil((t+10)*2):t+10}function TP(e,t){let n=HN(t),r=t.lineHeight??WN(t.fontFamily),i=t.originalText??t.text,a=yP(i,n,SP(e)),o=GN(a,n,r),s=e;!FM(e)&&o.height>CP(e)&&(s=$(e,{height:wP(e,o.height)}));let c=FM(s),[l,u]=c?xP(s):[s.x+s.width/2,s.y+s.height/2],d=c?`center`:t.textAlign??`center`,f=c?`middle`:t.verticalAlign??`middle`,p=c?o.width/2:SP(s)/2,m=c?o.height/2:CP(s)/2,h=d===`left`?l-p:d===`right`?l+p-o.width:l-o.width/2,g=f===`top`?u-m:f===`bottom`?u+m-o.height:u-o.height/2,_=c?0:PM(s),[v,y]=_?DM([h+o.width/2,g+o.height/2],[l,u],_):[h+o.width/2,g+o.height/2],b={...t,text:a,originalText:i,width:o.width,height:o.height,x:v-o.width/2,y:y-o.height/2,angle:_,textAlign:d,verticalAlign:f,containerId:s.id};return{container:s,text:b}}function EP(e,t){if(t)return TP(t,e).text;let n=HN(e),r=e.lineHeight??WN(e.fontFamily),i=e.originalText??e.text,a=e.autoResize===!1?yP(i,n,e.width):i,o=GN(a,n,r);return{...e,text:a,width:e.autoResize===!1?e.width:o.width,height:o.height}}function DP(e){"@babel/helpers - typeof";return DP=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},DP(e)}function OP(e,t){if(DP(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(DP(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function kP(e){var t=OP(e,`string`);return DP(t)==`symbol`?t:t+``}function AP(e,t,n){return(t=kP(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jP(e){switch(e.type){case`line`:case`arrow`:return ON(e.type,{});case`freedraw`:return kN({});case`text`:return AN({text:e.text??``});case`image`:return jN({});case`svg`:return NN({});case`richtext`:return MN({});case`frame`:case`magicframe`:return{...PN({}),type:e.type};default:return DN(e.type??`rectangle`,{})}}var MP=new Set([`rectangle`,`image`,`embeddable`,`iframe`]);function NP(e){return e.strokeSharpness===`round`?{type:MP.has(e.type??``)?3:2}:null}function PP(e){let t={...jP(e)};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return`roundness`in e&&e.roundness!==void 0||(t.roundness=NP(e)),e.type===`text`&&t.originalText===void 0&&(t.originalText=e.text),e.type===`svg`&&typeof t.svg==`string`&&(t.svg=lP(t.svg)),e.type!==`line`&&e.type!==`arrow`||e.points||(t.points=[[0,0],[e.width??0,e.height??0]]),t}var FP=class extends Error{constructor(e){super(`Could not load ${e}`),AP(this,`font`,void 0),this.font=e,this.name=`FontLoadError`}},IP=e=>e.trim().replaceAll(/^["']|["']$/g,``),LP=new Set(XM.split(`,`).slice(0,4).map(IP));function RP(e){let t=e.split(`,`).map(IP).filter(e=>LP.has(e));if(t.length===0)return!0;try{for(let e of document.fonts)if(t.includes(IP(e.family)))return!0}catch{return!1}return!1}async function zP(e,t){if(typeof document>`u`||!document.fonts?.load)return;let n=new Map;for(let t of e)if(!t.isDeleted){if(t.type===`text`){let e=rN(t.fontFamily),r=`${t.fontSize}px ${e}`,i=n.get(r)??{chars:new Set,stack:e};for(let e of t.originalText??t.text)i.chars.add(e);n.set(r,i)}else if(t.type===`richtext`){let e=rN(t.fontFamily),r=`16px ${e}`,i=n.get(r)??{chars:new Set,stack:e};for(let e of yN(bN(t.content)))i.chars.add(e);n.set(r,i)}}await Promise.all([...n].map(async([e,{chars:n,stack:r}])=>{let i=await document.fonts.load(e,[...n].join(``)).catch(()=>{if(t)throw new FP(e);return[]});if(t&&i.length===0&&!RP(r))throw new FP(e)}))}function BP(e,t){return e.text!==t.text||e.width!==t.width||e.height!==t.height||e.x!==t.x||e.y!==t.y}async function VP(e,t,n={}){let r=aP(e.map(e=>PP(e)));if(!n.refreshDimensions)return r;await zP(r,n.strictFonts??!1);let i=new Map(r.map(e=>[e.id,e]));return r.map(e=>{if(e.type!==`text`)return e;let t=EP(e,e.containerId?i.get(e.containerId):void 0);return BP(e,t)?$(e,t):e})}var HP=(e,t)=>{let{fontSize:n,fontWeight:r}=mN(e);return`${r===600?`bold `:``}${n}px ${rN(t)}`};function UP(e,t,n){let{lineHeight:r}=mN(e),i=HP(e,n);return yP(yN(e),i,Math.max(1,t)).split(`
|
|
19
|
-
`).length*VN(i)*r}function WP(e){return e.type===`list`?20:e.type===`quote`?12:0}function GP(e){return(e.children??[]).some(e=>vN(e)||e.type===`paragraph`||e.type===`heading`)}function KP(e,t,n){let r=0;for(let i of e)vN(i)&&GP(i)?r+=KP(i.children??[],t-WP(i),n):r+=UP(i,t-WP(i),n);return r}var qP=new WeakMap;function JP(e,t,n){let r=bN(e),i=`${t}:${n??``}`,a=qP.get(r),o=a?.get(i);if(o!==void 0)return o;let s=t-24,c=r.children??[],l=(c.length===0?UP({type:`paragraph`},s,n):KP(c,s,n))+24;return a?a.set(i,l):qP.set(r,new Map([[i,l]])),l}var YP={richtext:Object.keys(MN({})),svg:Object.keys(NN({}))};function XP(e){let t=YP[e.type];if(!t||!t.some(t=>!(t in e)||e[t]===void 0)&&Number.isFinite(e.width)&&Number.isFinite(e.height))return e;let n=PP(e);return{...n,width:Number.isFinite(n.width)?n.width:0,height:Number.isFinite(n.height)?n.height:0}}function ZP(e){let t=!1,n=e.map(e=>{let n=XP(e);if(n!==e&&(t=!0),n.type!==`richtext`||n.isDeleted)return n;let r=JP(n.content,n.width,n.fontFamily);return r>n.height?(t=!0,{...n,height:r}):n});return t?n:e}var QP=(0,A.createContext)(null),$P=(0,A.createContext)(null),eF=(0,A.createContext)(!1),tF=(e,t)=>(e+t)/2;function nF(e){let t=e.length;if(t<4)return``;let n=e[0],r=e[1],i=e[2],a=`M${n[0].toFixed(2)},${n[1].toFixed(2)} Q${r[0].toFixed(2)},${r[1].toFixed(2)} ${tF(r[0],i[0]).toFixed(2)},${tF(r[1],i[1]).toFixed(2)} T`;for(let i=2,o=t-1;i<o;i++)n=e[i],r=e[i+1],a+=`${tF(n[0],r[0]).toFixed(2)},${tF(n[1],r[1]).toFixed(2)} `;return`${a}Z`}function rF(e){let t=e.pressures??[],n=e.simulatePressure??t.length===0;return nF(uj(e.points.map(([e,r],i)=>[e,r,n?.5:t[i]??.5]),{simulatePressure:n,size:e.strokeWidth*4.25,thinning:.6,smoothing:.5,streamline:.5,easing:e=>Math.sin(e*Math.PI/2),last:!0}))}var iF=/^(?:https?:|mailto:|#|\/)/i;function aF(e){let t={};for(let n of(e??``).split(`;`)){let[e,...r]=n.split(`:`),i=e?.trim().toLowerCase(),a=r.join(`:`).trim();a&&!/url\(|expression/i.test(a)&&(i===`color`&&(t.color=a),i===`background-color`&&(t.backgroundColor=a))}return t}function oF(e,t){let n=e.text??``,r=aF(e.style);return Object.keys(r).length>0&&(n=(0,j.jsx)(`span`,{style:r,children:n})),gN(e,hN.code)&&(n=(0,j.jsx)(`code`,{children:n})),gN(e,hN.highlight)&&(n=(0,j.jsx)(`mark`,{children:n})),gN(e,hN.underline)&&(n=(0,j.jsx)(`u`,{children:n})),gN(e,hN.strikethrough)&&(n=(0,j.jsx)(`s`,{children:n})),gN(e,hN.italic)&&(n=(0,j.jsx)(`em`,{children:n})),gN(e,hN.bold)&&(n=(0,j.jsx)(`strong`,{children:n})),(0,j.jsx)(`span`,{children:n},t)}function sF(e=[]){return e.map((e,t)=>{switch(e.type){case`text`:return oF(e,t);case`linebreak`:return(0,j.jsx)(`br`,{},t);case`tab`:return(0,j.jsx)(`span`,{children:` `},t);case`link`:case`autolink`:{let n=typeof e.url==`string`&&iF.test(e.url)?e.url:void 0;return(0,j.jsx)(`a`,{href:n,rel:`noopener noreferrer`,style:{color:uN},target:`_blank`,children:sF(e.children)},t)}default:return(0,j.jsx)(`span`,{children:yN(e)},t)}})}function cF(e){let{fontSize:t,fontWeight:n,lineHeight:r}=mN(e);return{fontSize:t,fontWeight:n,lineHeight:r,margin:0,minHeight:t*r}}var lF=new Set([`h1`,`h2`,`h3`,`h4`,`h5`,`h6`]);function uF(e,t){switch(e.type){case`paragraph`:return(0,j.jsx)(`p`,{style:cF(e),children:sF(e.children)},t);case`heading`:{let n=lF.has(e.tag??``)?e.tag:`h4`;return(0,j.jsx)(n,{style:cF(e),children:sF(e.children)},t)}case`quote`:return(0,j.jsx)(`blockquote`,{style:{...cF(e),paddingLeft:9,borderLeft:dN},children:sF(e.children)},t);case`list`:{let n=e.listType===`number`?`ol`:`ul`;return(0,j.jsx)(n,{style:{margin:0,paddingLeft:20},children:(e.children??[]).map((e,t)=>dF(e.type===`listitem`?e:{type:`listitem`,children:[e]},t))},t)}default:return(0,j.jsx)(`p`,{style:cF({type:`paragraph`}),children:yN(e)},t)}}function dF(e,t){let n=e.children??[],r=n.filter(e=>e.type===`list`),i=n.filter(e=>e.type!==`list`);return(0,j.jsxs)(`li`,{style:cF({type:`paragraph`}),children:[sF(i),r.map((e,t)=>uF(e,t))]},t)}var fF={color:lN,fontFamily:XM,overflowWrap:`break-word`,whiteSpace:`pre-wrap`},pF=({content:e})=>(0,j.jsx)(j.Fragment,{children:(bN(e).children??[]).map((e,t)=>uF(e,t))}),mF={xmlns:`http://www.w3.org/1999/xhtml`},hF=({el:e})=>{let t=(0,A.use)($P),n=t&&nN(e.fontFamily)?t:rN(e.fontFamily);return(0,j.jsx)(`foreignObject`,{height:e.height,style:{overflow:`visible`},width:e.width,children:(0,j.jsx)(`div`,{"data-richtext-body":e.id,...mF,style:{...fF,fontFamily:n,boxSizing:`border-box`,width:e.width,minHeight:e.height,padding:12},children:(0,j.jsx)(pF,{content:e.content})})})},gF=.8,_F=6,vF=`#c4c4c4`;function yF(e){let t=(e.children??[]).find(e=>typeof e.style==`string`),n=/(?:^|;)\s*color\s*:\s*([^;]+)/i.exec(t?.style??``);return n?n[1].trim():lN}function bF(e,t,n,r,i,a,o){let{fontSize:s,fontWeight:c,lineHeight:l}=mN(e),u=HP(e,a),d=WP(e),f=yP(yN(e),u,Math.max(1,n-d)).split(`
|
|
20
|
-
`),p=VN(u)*l,m=r.y,h=m+(p-s)/2+s*gF,g=r.nodes.length;e.type===`quote`&&r.nodes.push((0,j.jsx)(`rect`,{fill:vF,height:f.length*p,width:3,x:t,y:m},`q${g}`)),o&&r.nodes.push((0,j.jsx)(`text`,{fill:lN,fontFamily:i,fontSize:s,textAnchor:`end`,x:t-_F,y:h,children:o},`m${g}`)),r.nodes.push((0,j.jsx)(`text`,{fill:yF(e),fontFamily:i,fontSize:s,fontWeight:c,style:{whiteSpace:`pre`},x:t+d,y:h,children:f.map((e,n)=>(0,j.jsx)(`tspan`,{dy:n===0?0:p,x:t+d,children:e||` `},n))},`t${g}`)),r.y+=f.length*p}function xF(e,t,n,r,i,a,o){e.forEach((e,s)=>{if(vN(e)&&GP(e)){let o=WP(e);xF(e.children??[],t+o,n-o,r,i,a,e.type===`list`?e:void 0)}else bF(e,t,n,r,i,a,o?o.listType===`number`?`${s+1}.`:`•`:void 0)})}var SF=({el:e})=>{let t=(0,A.use)($P),n=t&&nN(e.fontFamily)?t:rN(e.fontFamily),r={nodes:[],y:12};return xF(bN(e.content).children??[],12,e.width-24,r,n,e.fontFamily),(0,j.jsx)(`g`,{"data-richtext-body":e.id,children:r.nodes})},CF=null;function wF(){return CF||=new EM,CF}function TF(e,t){let n=EF(e.strokeStyle,e.strokeWidth),r={seed:e.seed||1,stroke:e.strokeColor,strokeWidth:e.strokeWidth,roughness:e.roughness,disableMultiStroke:e.strokeWidth<2,fill:e.backgroundColor===`transparent`?void 0:e.backgroundColor,fillStyle:e.fillStyle,fillWeight:e.strokeWidth/2,hachureGap:e.strokeWidth*4,preserveVertices:!1};return n&&(r.strokeLineDash=n),{...r,...t}}function EF(e,t){if(e!==`solid`){if(e===`dashed`)return[8,8+t];if(e===`dotted`)return[1.5,6+t]}}function DF(e,t){return wF().rectangle(0,0,e.width,e.height,TF(e,t))}function OF(e,t){return wF().ellipse(e.width/2,e.height/2,e.width,e.height,TF(e,t))}function kF(e,t){let n=e.width/2,r=e.height/2;return wF().polygon([[n,0],[e.width,r],[n,e.height],[0,r]],TF(e,t))}function AF(e,t){return wF().path(e,t)}function jF(e,t){return wF().linearPath(e,t)}function MF(e,t){return wF().curve(e,t)}function NF(e){let t=``;for(let{op:n,data:r}of e)switch(n){case`move`:t+=`M${r[0]} ${r[1]} `;break;case`lineTo`:t+=`L${r[0]} ${r[1]} `;break;case`bcurveTo`:t+=`C${r[0]} ${r[1]}, ${r[2]} ${r[3]}, ${r[4]} ${r[5]} `}return t.trim()}function PF(e){return e.sets.map(e=>({type:e.type,d:NF(e.ops)}))}function FF(e,t,n){let r=Math.max(0,Math.min(n,e/2,t/2));return[`M ${r} 0`,`L ${e-r} 0`,`Q ${e} 0 ${e} ${r}`,`L ${e} ${t-r}`,`Q ${e} ${t} ${e-r} ${t}`,`L ${r} ${t}`,`Q 0 ${t} 0 ${t-r}`,`L 0 ${r}`,`Q 0 0 ${r} 0`,`Z`].join(` `)}var IF=.25,LF=32;function RF(e){if(!e.roundness)return 0;if(e.roundness.type===3){let t=Math.min(e.width,e.height);return Math.min(t*IF,LF)}return e.roundness.value??0}var zF=({el:e})=>{let t=(0,A.use)(QP);return cP(e.svg)?(0,j.jsx)(`image`,{filter:t?`url(#${t.filterId})`:void 0,height:e.height,href:uP(e.svg),preserveAspectRatio:`xMidYMid meet`,width:e.width}):(0,j.jsx)(`rect`,{fill:`none`,height:e.height,stroke:`#888`,strokeDasharray:`4 4`,strokeWidth:1,width:e.width})},BF=({el:e,files:t})=>{switch(e.type){case`rectangle`:return(0,j.jsx)(UF,{el:e});case`ellipse`:return(0,j.jsx)(WF,{el:e});case`diamond`:return(0,j.jsx)(GF,{el:e});case`line`:case`arrow`:return(0,j.jsx)(YF,{el:e});case`freedraw`:return(0,j.jsx)(XF,{el:e});case`text`:return(0,j.jsx)(QF,{el:e});case`image`:return(0,j.jsx)(eI,{el:e,files:t});case`svg`:return(0,j.jsx)(zF,{el:e});case`richtext`:return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(UF,{el:e}),(0,j.jsx)($F,{el:e})]});case`frame`:case`magicframe`:return(0,j.jsx)(nI,{el:e});case`embeddable`:case`iframe`:return(0,j.jsx)(rI,{el:e});default:return null}},VF=new Set([`curve`,`polygon`]),HF=({drawable:e,fillColor:t,strokeColor:n,strokeWidth:r})=>{let i=PF(e);return(0,j.jsx)(j.Fragment,{children:i.map((i,a)=>i.type===`path`?(0,j.jsx)(`path`,{d:i.d,fill:`none`,stroke:n,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:r},a):i.type===`fillPath`?(0,j.jsx)(`path`,{d:i.d,fill:t||`none`,fillRule:VF.has(e.shape)?`evenodd`:void 0,stroke:`none`},a):(0,j.jsx)(`path`,{d:i.d,fill:`none`,stroke:t||n,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:e.options.fillWeight??r/2},a))})},UF=({el:e})=>{let t=RF(e),n=TF(e),r=t>0?AF(FF(e.width,e.height,t),n):DF(e);return(0,j.jsx)(HF,{drawable:r,fillColor:e.backgroundColor===`transparent`?void 0:e.backgroundColor,strokeColor:e.strokeColor,strokeWidth:e.strokeWidth})},WF=({el:e})=>{let t=OF(e);return(0,j.jsx)(HF,{drawable:t,fillColor:e.backgroundColor===`transparent`?void 0:e.backgroundColor,strokeColor:e.strokeColor,strokeWidth:e.strokeWidth})},GF=({el:e})=>{let t=kF(e);return(0,j.jsx)(HF,{drawable:t,fillColor:e.backgroundColor===`transparent`?void 0:e.backgroundColor,strokeColor:e.strokeColor,strokeWidth:e.strokeWidth})},KF=18;function qF(e,t){if(e.length<2)return{x:0,y:0,angle:0};let n=t===`end`?e.length-1:0,r=t===`end`?e.length-2:1,[i,a]=e[n],[o,s]=e[r];return{x:i,y:a,angle:Math.atan2(a-s,i-o)}}var JF=({angle:e,color:t,shape:n,strokeWidth:r,x:i,y:a})=>{if(!n)return null;if(n===`arrow`||n===`triangle`||n===`triangle_outline`){let o=KF,s=e+Math.PI-Math.PI/7,c=e+Math.PI+Math.PI/7,l=i+Math.cos(s)*o,u=a+Math.sin(s)*o,d=i+Math.cos(c)*o,f=a+Math.sin(c)*o;return n===`arrow`?(0,j.jsxs)(`g`,{children:[(0,j.jsx)(`line`,{stroke:t,strokeLinecap:`round`,strokeWidth:r,x1:i,x2:l,y1:a,y2:u}),(0,j.jsx)(`line`,{stroke:t,strokeLinecap:`round`,strokeWidth:r,x1:i,x2:d,y1:a,y2:f})]}):(0,j.jsx)(`polygon`,{fill:n===`triangle`?t:`none`,points:`${i},${a} ${l},${u} ${d},${f}`,stroke:t,strokeLinejoin:`round`,strokeWidth:r})}if(n===`dot`||n===`circle`||n===`circle_outline`)return(0,j.jsx)(`circle`,{cx:i,cy:a,fill:n===`circle_outline`?`none`:t,r:KF/3,stroke:t,strokeWidth:r});if(n===`bar`){let n=KF/1.5,o=e+Math.PI/2;return(0,j.jsx)(`line`,{stroke:t,strokeLinecap:`round`,strokeWidth:r,x1:i+Math.cos(o)*n,x2:i-Math.cos(o)*n,y1:a+Math.sin(o)*n,y2:a-Math.sin(o)*n})}return null},YF=({el:e})=>{let t=e.points&&e.points.length>0?e.points:[[0,0],[e.width,e.height]],n=e.roundness?.type===2,r=TF(e,{fill:void 0,fillStyle:void 0}),i=n&&t.length>2?MF(t,r):jF(t,r),a=e.startArrowhead,o=e.type===`arrow`?e.endArrowhead??`arrow`:e.endArrowhead,s=a?qF(t,`start`):null,c=o?qF(t,`end`):null;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(HF,{drawable:i,strokeColor:e.strokeColor,strokeWidth:e.strokeWidth}),a&&s&&(0,j.jsx)(JF,{angle:s.angle+Math.PI,color:e.strokeColor,shape:a,strokeWidth:e.strokeWidth,x:s.x,y:s.y}),o&&c&&(0,j.jsx)(JF,{angle:c.angle,color:e.strokeColor,shape:o,strokeWidth:e.strokeWidth,x:c.x,y:c.y})]})},XF=({el:e})=>{if(!e.points||e.points.length===0)return null;if(e.points.length===1){let[t,n]=e.points[0];return(0,j.jsx)(`circle`,{cx:t,cy:n,fill:e.strokeColor,r:e.strokeWidth})}return(0,j.jsx)(`path`,{d:rF(e),fill:e.strokeColor,stroke:`none`})},ZF=1.25,QF=({el:e})=>{let t=e.lineHeight??ZF,n=e.text.split(`
|
|
21
|
-
`),r=e.fontSize,i=(0,A.use)($P),a=i&&nN(e.fontFamily)?i:rN(e.fontFamily),o=e.textAlign===`center`?`middle`:e.textAlign===`right`?`end`:`start`,s=e.textAlign===`center`?e.width/2:e.textAlign===`right`?e.width:0,c=r*t,l=r*.82;return(0,j.jsx)(`text`,{dominantBaseline:`alphabetic`,fill:e.strokeColor,fontFamily:a,fontSize:r,style:{whiteSpace:`pre`},textAnchor:o,x:s,y:l,children:n.map((e,t)=>(0,j.jsx)(`tspan`,{dy:t===0?0:c,x:s,children:e||` `},t))})},$F=({el:e})=>(0,A.use)(eF)?(0,j.jsx)(SF,{el:e}):(0,j.jsx)(hF,{el:e}),eI=({el:e,files:t})=>{let n=(0,A.use)(QP),r=`rich-excalidraw-crop-${(0,A.useId)().replaceAll(/[^\w-]/g,``)}`,i=e.fileId&&t?t[e.fileId]:void 0;if(!i?.dataURL)return(0,j.jsx)(tI,{el:e,label:`Image`});let a=e.scale?.[0]??1,o=e.scale?.[1]??1,s=a!==1||o!==1?`translate(${a<0?e.width:0} ${o<0?e.height:0}) scale(${a} ${o})`:void 0,c=n?`url(#${n.filterId})`:void 0,l=e.crop;if(l&&l.width>0&&l.height>0){let t=e.width/l.width,n=e.height/l.height,a=l.naturalWidth??l.x+l.width,o=l.naturalHeight??l.y+l.height;return(0,j.jsxs)(`g`,{transform:s,children:[(0,j.jsx)(`clipPath`,{id:r,children:(0,j.jsx)(`rect`,{height:e.height,width:e.width})}),(0,j.jsx)(`image`,{clipPath:`url(#${r})`,filter:c,height:o*n,href:i.dataURL,preserveAspectRatio:`none`,width:a*t,x:-l.x*t,y:-l.y*n})]})}return(0,j.jsx)(`image`,{filter:c,height:e.height,href:i.dataURL,preserveAspectRatio:`none`,transform:s,width:e.width})},tI=({el:e,label:t})=>(0,j.jsxs)(`g`,{children:[(0,j.jsx)(`rect`,{fill:`none`,height:e.height,stroke:e.strokeColor||`#888`,strokeDasharray:`4 4`,strokeWidth:1,width:e.width}),(0,j.jsx)(`text`,{dominantBaseline:`middle`,fill:e.strokeColor||`#888`,fontFamily:rN(1),fontSize:Math.min(16,e.height/4),textAnchor:`middle`,x:e.width/2,y:e.height/2,children:t})]}),nI=({el:e})=>{let t=e.name||(e.type===`magicframe`?`Magic frame`:`Frame`);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`rect`,{fill:`none`,height:e.height,rx:4,stroke:`#bbb`,strokeWidth:1.5,width:e.width}),(0,j.jsx)(`text`,{fill:`#999`,fontFamily:rN(2),fontSize:12,x:4,y:-4,children:t})]})},rI=({el:e})=>(0,j.jsx)(tI,{el:e,label:`Embed`}),iI=({dark:e,id:t})=>(0,j.jsx)(`filter`,{height:`160%`,id:t,width:`140%`,x:`-20%`,y:`-20%`,children:(0,j.jsx)(`feDropShadow`,{dx:`0`,dy:`3`,floodColor:e?`#fff`:`#000`,floodOpacity:`0.14`,stdDeviation:`4`})}),aI=32;function oI(e){let t=ZP(e),n=1/0,r=1/0,i=-1/0,a=-1/0;for(let e of t)e.isDeleted||(n=Math.min(n,e.x),r=Math.min(r,e.y),i=Math.max(i,e.x+e.width),a=Math.max(a,e.y+e.height));return Number.isFinite(n)?{minX:n-aI,minY:r-aI,width:i-n+64,height:a-r+64}:{minX:0,minY:0,width:100,height:100}}var sI=`invert(93%) hue-rotate(180deg)`,cI=({id:e})=>(0,j.jsxs)(`filter`,{colorInterpolationFilters:`sRGB`,id:e,children:[(0,j.jsx)(`feColorMatrix`,{type:`hueRotate`,values:`180`}),(0,j.jsx)(`feColorMatrix`,{type:`matrix`,values:`-1.16279 0 0 0 1.081395 0 -1.16279 0 0 1.081395 0 0 -1.16279 0 1.081395 0 0 0 1 0`})]}),lI=e=>e.type===`frame`||e.type===`magicframe`,uI=4,dI=64;function fI(e){let t=new Map(e.filter(e=>e.type===`arrow`||e.type===`line`).map(e=>[e.id,e])),n=new Map;for(let r of e){if(r.type!==`text`||!r.containerId||!r.text?.trim())continue;let e=t.get(r.containerId);if(!e)continue;let i=e.points??[],a=[0,e.width,...i.map(([e])=>e)],o=[0,e.height,...i.map(([,e])=>e)],s=e.x+Math.min(...a)-dI,c=e.y+Math.min(...o)-dI;n.set(e.id,{area:[s,c,e.x+Math.max(...a)+dI-s,e.y+Math.max(...o)+dI-c],hole:[r.x-uI,r.y-uI,r.width+8,r.height+8]})}return n}var pI=(0,A.memo)(({dark:e=!1,elementProps:t,files:n,handFontOverride:r,hiddenIds:i,scene:a})=>{let o=ZP(a.elements.filter(e=>!e.isDeleted)),s=(0,A.use)($P),c=r??s,l=(0,A.useId)().replaceAll(/[^\w-]/g,``),u=`rich-excalidraw-counter-invert-${l}`,d=new Map(o.filter(lI).map(e=>[e.id,e])),f=new Set(o.map(e=>e.frameId).filter(e=>!!e&&d.has(e))),p=e=>`rich-excalidraw-frame-${l}-${e.replaceAll(/[^\w-]/g,``)}`,m=`rich-excalidraw-shadow-${l}`,h=o.some(wN),g=fI(o),_=e=>`rich-excalidraw-label-${l}-${e.replaceAll(/[^\w-]/g,``)}`,v=e||f.size>0||h||g.size>0;return(0,j.jsx)(QP,{value:e?{filterId:u}:null,children:(0,j.jsxs)($P,{value:c,children:[v&&(0,j.jsxs)(`defs`,{children:[e&&(0,j.jsx)(cI,{id:u}),h&&(0,j.jsx)(iI,{dark:e,id:m}),[...f].map(e=>{let t=d.get(e);return(0,j.jsx)(`clipPath`,{id:p(e),children:(0,j.jsx)(`rect`,{height:t.height,width:t.width,x:t.x,y:t.y})},e)}),[...g].map(([e,{area:t,hole:n}])=>(0,j.jsxs)(`mask`,{height:t[3],id:_(e),maskUnits:`userSpaceOnUse`,width:t[2],x:t[0],y:t[1],children:[(0,j.jsx)(`rect`,{fill:`#fff`,height:t[3],width:t[2],x:t[0],y:t[1]}),(0,j.jsx)(`rect`,{fill:`#000`,height:n[3],width:n[2],x:n[0],y:n[1]})]},e))]}),o.map(e=>{if(i?.has(e.id))return null;let r=(0,j.jsx)(hI,{el:e,extra:t?.(e),files:n},e.id),a=g.has(e.id)?(0,j.jsx)(`g`,{mask:`url(#${_(e.id)})`,children:r},e.id):r,o=wN(e)?(0,j.jsx)(`g`,{filter:`url(#${m})`,children:a},e.id):a;return e.frameId&&f.has(e.frameId)?(0,j.jsx)(`g`,{clipPath:`url(#${p(e.frameId)})`,children:o},e.id):o})]})})});pI.displayName=`SceneContent`;var mI=({className:e,files:t,handFontOverride:n,scene:r,style:i,theme:a=`light`})=>{let o=oI(r.elements.filter(e=>!e.isDeleted)),s=a===`dark`;return(0,j.jsx)(`svg`,{className:e,preserveAspectRatio:`xMidYMid meet`,role:`img`,viewBox:`${o.minX} ${o.minY} ${o.width} ${o.height}`,xmlns:`http://www.w3.org/2000/svg`,style:{width:`100%`,height:`100%`,display:`block`,...s?{filter:sI}:null,...i},children:(0,j.jsx)(pI,{dark:s,files:t??r.files,handFontOverride:n,scene:r})})},hI=({el:e,extra:t,files:n})=>{let r=PM(e)*180/Math.PI,[i,a]=LM(e),o=`translate(${e.x} ${e.y}) rotate(${r} ${i-e.x} ${a-e.y})`;return(0,j.jsx)(`g`,{"data-cx":i,"data-cy":a,"data-id":e.id,"data-type":e.type,opacity:e.opacity==null?1:e.opacity/100,transform:o,...t,children:(0,j.jsx)(BF,{el:e,files:n})})};function gI(e,t,{insets:n={},maxZoom:r=30,minZoom:i=.1,padding:a=0,zoomFactor:o=1}={}){let s=n.left??0,c=n.top??0,l=Math.max(1,t.width-s-(n.right??0)),u=Math.max(1,t.height-c-(n.bottom??0)),[d,f,p,m]=e,h=Math.max(1,p-d),g=Math.max(1,m-f),_=Math.min((l-a*2)/h,(u-a*2)/g)*o,v=Math.min(r,Math.max(i,_));return{zoom:v,scrollX:(s+l/2)/v-(d+h/2),scrollY:(c+u/2)/v-(f+g/2)}}var _I=`hfbknr0`,vI=`hfbknr1`,yI=`hfbknr2`,bI=`hfbknr3`,xI=`hfbknr4`,SI=`hfbknr5`,CI=({onExpand:e,onFit:t,onZoomIn:n,onZoomOut:r,scale:i})=>(0,j.jsxs)(`div`,{className:yI,children:[(0,j.jsx)(`button`,{"aria-label":`Zoom out`,className:bI,title:`Zoom out (⌘/Ctrl + scroll)`,type:`button`,onClick:r,children:(0,j.jsx)(k,{})}),(0,j.jsxs)(`span`,{className:xI,children:[Math.round(i*100),`%`]}),(0,j.jsx)(`button`,{"aria-label":`Zoom in`,className:bI,title:`Zoom in (⌘/Ctrl + scroll)`,type:`button`,onClick:n,children:(0,j.jsx)(Sn,{})}),(0,j.jsx)(`span`,{"aria-hidden":!0,className:SI}),(0,j.jsx)(`button`,{"aria-label":`Fit to content`,className:bI,title:`Fit to content (double-click)`,type:`button`,onClick:t,children:(0,j.jsx)(Rr,{})}),e&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{"aria-hidden":!0,className:`hfbknr5`}),(0,j.jsx)(`button`,{"aria-label":`Fullscreen`,className:`hfbknr3`,title:`Fullscreen`,type:`button`,onClick:t=>e(t.currentTarget),children:(0,j.jsx)(In,{})})]})]}),wI=.05,TI=e=>({s:e.zoom,tx:e.scrollX*e.zoom,ty:e.scrollY*e.zoom}),EI=e=>({scrollX:e.tx/e.s,scrollY:e.ty/e.s,zoom:e.s}),DI=280,OI=e=>!!e&&e.length===4&&e.every(e=>typeof e==`number`);function kI(e,{bounds:t,elements:n,setTransform:r,sizeRef:i,transformRef:a,userInteractedRef:o}){let s=(0,A.useRef)(void 0);(0,A.useEffect)(()=>()=>{s.current!==void 0&&cancelAnimationFrame(s.current)},[]),(0,A.useImperativeHandle)(e,()=>({getViewport:()=>({...EI(a.current),width:i.current.w,height:i.current.h}),focus:(e,c={})=>{let{w:l,h:u}=i.current,d=null;if(OI(e))d=e;else if(e){let t=new Set(e),r=n.filter(e=>t.has(e.id));r.length>0&&(d=VM(r))}else n.length>0&&(d=[t.minX,t.minY,t.minX+t.width,t.minY+t.height]);if(!d||!l||!u)return!1;let f=TI(gI(d,{width:l,height:u},{...c,minZoom:wI,maxZoom:Math.min(c.maxZoom??16,16)}));if(o.current=!0,s.current!==void 0&&cancelAnimationFrame(s.current),s.current=void 0,!c.animate||typeof requestAnimationFrame!=`function`)return r(f),!0;let p=a.current,m=performance.now(),h=c.duration??DI,g=e=>{let t=Math.min(1,(e-m)/h),n=1-(1-t)**3,i=(e,t)=>e+(t-e)*n;r({s:i(p.s,f.s),tx:i(p.tx,f.tx),ty:i(p.ty,f.ty)}),s.current=t<1?requestAnimationFrame(g):void 0};return s.current=requestAnimationFrame(g),!0}}),[t,n,r,i,a,o])}function AI({containerRef:e,mode:t,setTransform:n,transformRef:r,userInteractedRef:i,wheelPan:a,zoomAt:o}){let[s,c]=(0,A.useState)(!1);(0,A.useEffect)(()=>{let t=e.current;if(!t)return;let r=e=>{if(!e.ctrlKey&&!e.metaKey){if(!a)return;e.preventDefault(),i.current=!0;let t=e.shiftKey&&!e.deltaX?e.deltaY:e.deltaX,r=e.shiftKey&&!e.deltaX?0:e.deltaY;n(e=>({s:e.s,tx:e.tx-t,ty:e.ty-r}));return}e.preventDefault();let r=t.getBoundingClientRect();o(e.deltaY>0?.9:1.1,e.clientX-r.left,e.clientY-r.top)};return t.addEventListener(`wheel`,r,{passive:!1}),()=>t.removeEventListener(`wheel`,r)},[e,n,i,a,o]);let l=(0,A.useRef)(new Map),u=(0,A.useRef)(null),d=(0,A.useRef)(null),f=e=>t!==`inline`||e.pointerType!==`touch`,p=()=>{let t=[...l.current.values()],n=e.current;if(t.length<2||!n)return;let i=n.getBoundingClientRect();d.current={distance:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)||1,origScale:r.current.s,origTx:r.current.tx,origTy:r.current.ty,midX:(t[0].x+t[1].x)/2-i.left,midY:(t[0].y+t[1].y)/2-i.top}},m=e=>{!f(e)||e.pointerType===`mouse`&&e.button!==0||e.target.closest(`button`)||(e.currentTarget.setPointerCapture(e.pointerId),l.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),l.current.size===1?(u.current={startX:e.clientX,startY:e.clientY,origTx:r.current.tx,origTy:r.current.ty},c(!0)):l.current.size===2&&(u.current=null,p()))},h=e=>{if(!l.current.has(e.pointerId))return;l.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=d.current;if(t&&l.current.size===2){i.current=!0;let e=[...l.current.values()],r=(Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)||1)/t.distance,a=Math.max(wI,Math.min(16,t.origScale*r)),o=a/t.origScale;n({s:a,tx:t.midX-(t.midX-t.origTx)*o,ty:t.midY-(t.midY-t.origTy)*o});return}let r=u.current;r&&l.current.size===1&&(i.current=!0,n(t=>({s:t.s,tx:r.origTx+e.clientX-r.startX,ty:r.origTy+e.clientY-r.startY})))},g=e=>{l.current.delete(e.pointerId)&&(l.current.size<2&&(d.current=null),l.current.size===0&&(u.current=null,c(!1)),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return{panning:s,onPointerCancel:g,onPointerDown:m,onPointerMove:h,onPointerUp:g}}var jI=1.2,MI=({controls:e=!0,handFontOverride:t,initialViewport:n,mode:r=`inline`,onExpand:i,onViewportChange:a,preserveView:o=!1,ref:s,scene:c,theme:l=`light`,wheelPan:u=!1})=>{let d=(0,A.useRef)(null),[f,p]=(0,A.useState)({w:0,h:0}),[m,h]=(0,A.useState)(()=>n?TI(n):{s:1,tx:0,ty:0}),g=(0,A.useRef)(m),_=(0,A.useRef)(f),v=(0,A.useRef)(!!n),y=(0,A.useRef)(!!n),b=(0,A.useRef)(a);b.current=a;let x=(0,A.useMemo)(()=>c.elements.filter(e=>!e.isDeleted),[c]),S=(0,A.useMemo)(()=>oI(x),[x]);(0,A.useEffect)(()=>{g.current=m,_.current=f,f.w&&f.h&&b.current?.({...EI(m),width:f.w,height:f.h})},[m,f]),kI(s,{bounds:S,elements:x,setTransform:h,sizeRef:_,transformRef:g,userInteractedRef:y}),(0,A.useLayoutEffect)(()=>{let e=d.current;if(!e)return;let t=e.getBoundingClientRect();p({w:t.width,h:t.height});let n=new ResizeObserver(e=>{let t=e[0].contentRect;p({w:t.width,h:t.height})});return n.observe(e),()=>n.disconnect()},[]);let C=(0,A.useCallback)(()=>{if(!f.w||!f.h)return{s:1,tx:0,ty:0};let e=S.width||1,t=S.height||1,n=Math.max(wI,Math.min(16,Math.min((f.w-64)/e,(f.h-64)/t)));return{s:n,tx:f.w/2-(S.minX+e/2)*n,ty:f.h/2-(S.minY+t/2)*n}},[f,S]),w=(0,A.useCallback)(()=>{h(C()),y.current=!1},[C]);(0,A.useLayoutEffect)(()=>{y.current||f.w&&f.h&&(h(C()),o&&(y.current=!0))},[f,C,o]),(0,A.useEffect)(()=>{v.current||o||(y.current=!1)},[c,o]);let T=(0,A.useCallback)((e,t,n)=>{let r=g.current,i=Math.max(wI,Math.min(16,r.s*e)),a=i/r.s;a!==1&&(y.current=!0,h({s:i,tx:t-(t-r.tx)*a,ty:n-(n-r.ty)*a}))},[]),E=AI({containerRef:d,mode:r,setTransform:h,transformRef:g,userInteractedRef:y,wheelPan:u,zoomAt:T}),D=e=>{e.target.closest(`button`)||w()},ee=e=>T(e,f.w/2,f.h/2),te=l===`dark`,ne=`Whiteboard, ${x.length} elements`;return(0,j.jsxs)(`div`,{className:_I,"data-color-scheme":l,"data-mode":r,"data-panning":E.panning,ref:d,onDoubleClick:D,onPointerCancel:E.onPointerCancel,onPointerDown:E.onPointerDown,onPointerMove:E.onPointerMove,onPointerUp:E.onPointerUp,children:[(0,j.jsx)(`svg`,{"aria-label":ne,className:vI,preserveAspectRatio:`xMinYMin meet`,role:`img`,style:te?{filter:sI}:void 0,viewBox:`0 0 ${f.w||1} ${f.h||1}`,xmlns:`http://www.w3.org/2000/svg`,children:(0,j.jsx)(`g`,{transform:`translate(${m.tx} ${m.ty}) scale(${m.s})`,children:(0,j.jsx)(pI,{dark:te,files:c.files,handFontOverride:t,scene:c})})}),e&&(0,j.jsx)(CI,{scale:m.s,onExpand:i,onFit:w,onZoomIn:()=>ee(jI),onZoomOut:()=>ee(1/jI)})]})};function NI(e){let t=[{head:null,followers:[]}];for(let n of e)$N(n.index)?t.push({head:n,followers:[]}):t.at(-1).followers.push(n);let[n,...r]=t;return r.sort((e,t)=>{let n=e.head.index,r=t.head.index;return n===r?e.head.id<t.head.id?-1:1:n<r?-1:1}),[...n.followers,...r.flatMap(e=>[e.head,...e.followers])]}var PI=(e,t)=>{let n=e.version??0,r=t.version??0;return r===n?(t.versionNonce??0)<(e.versionNonce??0):r>n},FI=new Set([`version`,`versionNonce`,`updated`]),II=e=>JSON.stringify(Object.entries(e).filter(([e])=>!FI.has(e))),LI=(e,t)=>e===t||II(e)===II(t);function RI(e,t,n=new Set){let r=new Map(e.map(e=>[e.id,e])),i=new Map,a=[];for(let e of t){let t=r.get(e.id);t&&n.has(e.id)?a.push(e):(!t||PI(t,e))&&i.set(e.id,e)}let o=[...i.values()];return o.length===0?{elements:[...e],accepted:o,deferred:a}:{elements:NI([...e.map(e=>i.get(e.id)??e),...o.filter(e=>!r.has(e.id))]),accepted:o,deferred:a}}var zI=e=>e.trim().replace(/^(['"])(.*)\1$/,`$2`),BI=(e,t)=>{let n=RegExp(`(?:^|[;{\\s])${t}\\s*:\\s*([^;}]+)`,`i`).exec(e);return n?n[1].trim():void 0};function VI(e,t){for(let n of e.split(`,`)){let e=/^u\+([\da-f?]+)(?:-([\da-f]+))?$/i.exec(n.trim());if(!e)continue;let r=Number.parseInt(e[1].replaceAll(`?`,`0`),16),i=Number.parseInt(e[2]??e[1].replaceAll(`?`,`f`),16);for(let e of t)if(e>=r&&e<=i)return!0}return!1}function HI(e){return e.split(`,`).map(e=>zI(e).toLowerCase())}function UI(e,t,n){let r=new Set;for(let e of n.text)r.add(e.codePointAt(0));let i=[];for(let[,a]of e.matchAll(/@font-face\s*\{([^}]*)\}/gi)){let e=zI(BI(a,`font-family`)??``);if(!n.families.has(e.toLowerCase()))continue;let o=BI(a,`unicode-range`);if(o&&!VI(o,r))continue;let s=/url\(([^)]*)\)(?:\s*format\(([^)]*)\))?/i.exec(a);if(!s)continue;let c;try{c=new URL(zI(s[1]),t).href}catch{continue}i.push({family:e,format:s[2]===void 0?void 0:zI(s[2]),style:BI(a,`font-style`),unicodeRange:o,url:c,weight:BI(a,`font-weight`)})}return i}async function WI(e){if(e.startsWith(`data:`))return e;let t=await fetch(e);if(!t.ok)throw Error(`${t.status} ${e}`);let n=await t.blob();return new Promise((e,t)=>{let r=new FileReader;r.onload=()=>e(r.result),r.onerror=()=>t(r.error),r.readAsDataURL(n)})}var GI=4;async function KI(e,t,n,r=0){let i={baseHref:t,cssText:e};return r>=GI?[i]:[...(await Promise.all([...e.matchAll(/@import\s+(?:url\(([^)]*)\)|(["'][^"']*["']))/gi)].map(async e=>{try{let i=new URL(zI(e[1]??e[2]),t).href;return await KI(await n(i),i,n,r+1)}catch{return[]}}))).flat(),i]}async function qI(e){let t=await fetch(e);if(!t.ok)throw Error(`${t.status} ${e}`);return t.text()}async function JI(){return(await Promise.all([...document.styleSheets].map(async e=>{let t=e.href??document.baseURI,n;try{n=[...e.cssRules].map(e=>e.cssText).filter(e=>e.startsWith(`@font-face`)||e.startsWith(`@import`)).join(`
|
|
22
|
-
`)}catch{if(!e.href)return[];try{n=await qI(e.href)}catch{return[]}}return KI(n,t,qI)}))).flat()}async function YI(e){if(typeof document>`u`||e.families.size===0)return``;let t=(await JI()).flatMap(t=>UI(t.cssText,t.baseHref,e));return(await Promise.all(t.map(async e=>{try{let t=await WI(e.url);return[`@font-face{font-family:"${e.family}";src:url("${t}")${e.format?` format("${e.format}")`:``}`,e.weight&&`font-weight:${e.weight}`,e.style&&`font-style:${e.style}`,e.unicodeRange&&`unicode-range:${e.unicodeRange}`].filter(Boolean).join(`;`).concat(`}`)}catch{return``}}))).join(``)}var XI=16,ZI=100;function QI(e,t){let n=new Set,r=``;for(let i of e)if(i.type===`text`){let e=t&&nN(i.fontFamily)?t:rN(i.fontFamily);for(let t of HI(e))n.add(t);r+=i.text}else if(i.type===`richtext`){let e=t&&nN(i.fontFamily)?t:rN(i.fontFamily);for(let t of HI(e))n.add(t);r+=yN(i.content?.root)}return{families:n,text:r}}async function $I(e){if(!e)return e;let t=await Promise.all(Object.entries(e).map(async([e,t])=>{if(!/^https?:/i.test(t.dataURL))return[e,t];try{return[e,{...t,dataURL:await WI(t.dataURL)}]}catch{return[e,t]}}));return Object.fromEntries(t)}async function eL(e,t={}){let{background:n=`#ffffff`,embedFonts:r=!0,handFontOverride:i}=t,a=t.padding??XI,o=ZP(e.elements.filter(e=>!e.isDeleted)),[s,c,l,u]=o.length>0?VM(o):[0,0,ZI,ZI],d=s-a,f=c-a,p=l-s+a*2,m=u-c+a*2,[h,g]=await Promise.all([r?YI(QI(o,i)):``,$I(e.files)]),_=document.createElement(`div`),v=(0,da.createRoot)(_);(0,li.flushSync)(()=>{v.render((0,j.jsxs)(`svg`,{height:m,viewBox:`${d} ${f} ${p} ${m}`,width:p,xmlns:`http://www.w3.org/2000/svg`,children:[h&&(0,j.jsx)(`style`,{children:h}),n&&(0,j.jsx)(`rect`,{"data-export-background":``,fill:n,height:m,width:p,x:d,y:f}),(0,j.jsx)(eF,{value:!0,children:(0,j.jsx)(pI,{files:g,handFontOverride:i,scene:{elements:o,files:g}})})]}))});let y=new XMLSerializer().serializeToString(_.firstElementChild);return v.unmount(),{height:m,svg:y,width:p}}var tL=8192;function nL(e,t,n,r){let i=Math.max(e,t)*n;return i>r?n*r/i:n}function rL(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>t(r),r.onerror=()=>n(Error(`whiteboard export: the svg could not be rasterized`)),r.src=e})}async function iL(e,t={}){let{maxSize:n=tL,mimeType:r=`image/png`,quality:i,scale:a=1,...o}=t,{height:s,svg:c,width:l}=await eL(e,o),u=nL(l,s,a,n),d=URL.createObjectURL(new Blob([c],{type:`image/svg+xml;charset=utf-8`}));try{let e=await rL(d),t=document.createElement(`canvas`);t.width=Math.max(1,Math.round(l*u)),t.height=Math.max(1,Math.round(s*u));let n=t.getContext(`2d`);if(!n)throw Error(`whiteboard export: no 2d canvas context`);return n.drawImage(e,0,0,t.width,t.height),await new Promise((e,n)=>{t.toBlob(t=>t?e(t):n(Error(`whiteboard export: empty image`)),r,i)})}finally{URL.revokeObjectURL(d)}}eN(2,yS);var aL=()=>typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`);function oL(){let[e,t]=(0,A.useState)(()=>aL()?.matches??!1);return(0,A.useEffect)(()=>{let e=aL();if(!e)return;let n=()=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var sL=new Set([`rectangle`,`ellipse`,`diamond`,`arrow`]),cL=new WeakMap;function lL(e){return sL.has(e.type)}function uL(e){return e.boundElements?.find(e=>e.type===`text`)?.id??null}function dL(e,t){return e.getState().elements.find(e=>e.id===t)}function fL(e,t){let n=new Map(t.map(e=>[e.id,e]));e.updateTransient(({elements:e})=>({elements:e.map(e=>n.get(e.id)??e)}))}function pL(e,t){let n=e.getState();if(e.beginTransient(),cL.delete(e),t.containerId){let r=dL(e,t.containerId);if(!r)return;let i=uL(r);if(i&&dL(e,i)){e.setState({editingTextId:i,selectedIds:new Set([r.id])});return}let a=AN({text:``,containerId:r.id,textAlign:`center`,verticalAlign:`middle`},n.currentStyle),o=TP(r,a),s=$(o.container,{boundElements:[...r.boundElements??[],{id:a.id,type:`text`}]});e.updateTransient(({elements:e})=>({elements:[...e.map(e=>e.id===r.id?s:e),o.text]})),cL.set(e,a.id),e.setState({editingTextId:a.id,selectedIds:new Set([r.id])});return}if(t.elementId){e.setState({editingTextId:t.elementId,selectedIds:new Set([t.elementId])});return}let r=t.at??[0,0],i=n.currentStyle,a=i.fontSize*WN(i.fontFamily),o=AN({text:``,x:r[0],y:r[1]-a/2,height:a},i);e.updateTransient(({elements:e})=>({elements:[...e,o]})),cL.set(e,o.id),e.setState({editingTextId:o.id,selectedIds:new Set([o.id])})}function mL(e,t){let n=e.getState().editingTextId,r=n?dL(e,n):void 0;if(!r)return;let i={...r,text:t,originalText:t},a=r.containerId?dL(e,r.containerId):void 0;if(a){let t=TP(a,i);fL(e,[t.text,t.container])}else fL(e,[EP(i)])}function hL(e){let t=e.getState().editingTextId;if(!t)return;let n=dL(e,t),r=cL.get(e)===t;if(cL.delete(e),e.setState({editingTextId:null}),!n){e.endTransient(!1);return}let i=!(n.originalText??n.text).trim();if(i&&r)e.endTransient(!1);else{if(i){let t=n.containerId?dL(e,n.containerId):void 0,r=[$(n,{isDeleted:!0})];t&&r.push($(t,{boundElements:(t.boundElements??[]).filter(e=>e.id!==n.id)})),fL(e,r),e.setState({selectedIds:new Set})}else r||fL(e,[$(dL(e,t)??n)]);e.endTransient(!0)}}function gL(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map;for(let e of t){let t=n.get(e),i=t?uL(t):null,a=i?n.get(i):void 0;if(!t||!a||a.isDeleted)continue;let o=TP(t,a);r.set(a.id,$(a,o.text)),o.container!==t&&r.set(t.id,o.container)}return r.size===0?[...e]:e.map(e=>r.get(e.id)??e)}function _L(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Set,i=t.map(e=>{r.add(e.id);let t=n.get(e.id);return!t||t===e?e:{...e,version:Math.max(t.version??0,e.version??0)+1,versionNonce:cN(),updated:Date.now()}});for(let t of e)r.has(t.id)||i.push(t.isDeleted?t:$(t,{isDeleted:!0}));return i}function vL(e=100){let t=[],n=[];return{push(r){t.push(r),t.length>e&&(t=t.slice(-e)),n=[]},undo(e){let r=t.pop();return r?(n.push(e),r):null},redo(e){let r=n.pop();return r?(t.push(e),r):null},rewrite(e){t=t.map(e),n=n.map(e)},canUndo:()=>t.length>0,canRedo:()=>n.length>0,clear(){t=[],n=[]}}}var yL=`#ffffff`;function bL(e,t){let n=new Map(e.map(e=>[e.id,e]));return aP(t.map(e=>n.get(e.id)===e?e:PP(e)))}function xL(e){let t=new Set;for(let n of e)!n.isDeleted&&n.type===`image`&&n.fileId&&t.add(n.fileId);return t}function SL(e,t={}){let{sync:n=!1}=t,r=e??{},i=r.appState,a=r.files??{},o=Array.isArray(r.elements)?r.elements:[],s=ZP(n?NI(o):o),c=i?.viewBackgroundColor??yL,l=i?.gridSize??null,u={elements:s,files:a,canvasSize:{width:0,height:0},selectedIds:new Set,selectedPointIndex:null,selectionBox:null,suggestedBindingId:null,editingGroupId:null,editingFrameId:null,editingLinearId:null,editingRichTextId:null,editingTextId:null,erasingIds:new Set,tool:`selection`,toolLocked:!1,currentStyle:iN,viewport:{scrollX:0,scrollY:0,zoom:1},gridSize:l,viewBackgroundColor:c},d=new Set,f=vL(),p=null,m=()=>{for(let e of d)e()},h=new Map,g=e=>{let t=h.get(e.id);if(t){PI(t.remote,e)&&h.set(e.id,{...t,remote:e});return}let n=p?.elements.find(t=>t.id===e.id)??u.elements.find(t=>t.id===e.id);n&&h.set(e.id,{baseline:n,remote:e})},_=()=>{let e=new Set;for(let t of[u.editingTextId,u.editingRichTextId,u.editingLinearId])t&&e.add(t);if(u.editingTextId){let t=u.elements.find(e=>e.id===u.editingTextId)?.containerId;t&&e.add(t)}if(p){let t=new Map(p.elements.map(e=>[e.id,e]));for(let n of u.elements)t.get(n.id)!==n&&e.add(n.id)}return e},v=e=>{let t=RI(u.elements,e,_());for(let e of t.deferred)g(e);if(t.accepted.length===0)return null;let n=ZP(aP(t.elements)),r=new Set(t.accepted.map(e=>e.id)),i=n.filter(e=>r.has(e.id)),a=new Map(i.map(e=>[e.id,e])),o=e=>{let t=new Set(e.elements.map(e=>e.id));return{...e,elements:[...e.elements.map(e=>a.get(e.id)??e),...i.filter(e=>!t.has(e.id))]}};f.rewrite(o),p&&=o(p);let s=new Set(n.filter(e=>!e.isDeleted).map(e=>e.id));return{elements:n,selectedIds:new Set([...u.selectedIds].filter(e=>s.has(e)))}},y=()=>{if(h.size===0)return;let e=_(),t=[...h].filter(([t])=>!e.has(t));if(t.length===0)return;let n=new Map(u.elements.map(e=>[e.id,e])),r=new Map,i=[];for(let[e,{baseline:a,remote:o}]of t){h.delete(e);let t=n.get(e);!t||LI(t,a)?i.push(o):PI(t,o)&&r.set(e,$({...t,version:o.version}))}r.size>0&&(u={...u,elements:u.elements.map(e=>r.get(e.id)??e)});let a=i.length>0?v(i):null;a&&(u={...u,...a})},b=e=>{u={...u,...e},y(),m()},x=()=>({elements:u.elements,files:u.files}),S=e=>{let t=x(),n=e(t);if(!n)return null;let r=n.elements?ZP(bL(t.elements,n.elements)):t.elements,i=n.files??t.files;return r===t.elements&&i===t.files?null:{elements:r,files:i}},C=e=>{let t=n?_L(u.elements,e.elements):e.elements,r=new Set(t.filter(e=>!e.isDeleted).map(e=>e.id));b({elements:t,files:e.files,selectedIds:new Set([...u.selectedIds].filter(e=>r.has(e))),editingTextId:null,editingFrameId:null,editingLinearId:null,selectedPointIndex:null,suggestedBindingId:null})};return{getState:()=>u,subscribe(e){return d.add(e),()=>d.delete(e)},setState:b,commit(e){if(p){let t=S(e);t&&b(t);return}let t=x(),n=S(e);n&&(f.push(t),b(n))},applyRemote(e){let t=e.elements?v(e.elements)??{}:{};if(e.files&&Object.keys(e.files).length>0){let n=e.files,r=e=>({...e,files:{...e.files,...n}});f.rewrite(r),p&&=r(p),t.files={...u.files,...n}}Object.keys(t).length>0&&b(t)},amend(e){f.rewrite(e),p&&=e(p);let t=S(t=>e(t));t&&b(t)},beginTransient(){p??=x()},updateTransient(e){let t=S(e);t&&b(t)},endTransient(e){let t=p;if(p=null,!t)return;let r=t.elements===u.elements&&t.files===u.files;if(!e){r||C(t);return}if(r||(f.push(t),!n))return;let i=new Map(t.elements.map(e=>[e.id,e]));b({elements:u.elements.map(e=>i.get(e.id)===e?e:$(e))})},isTransient:()=>p!==null,undo(){let e=f.undo(x());e&&C(e)},redo(){let e=f.redo(x());e&&C(e)},canUndo:f.canUndo,canRedo:f.canRedo,isDirty:()=>u.elements!==s||u.files!==a||u.viewBackgroundColor!==c||u.gridSize!==l,getScene(){let e={...r,elements:u.elements.filter(e=>!e.isDeleted)},t={};u.viewBackgroundColor!==c&&(t.viewBackgroundColor=u.viewBackgroundColor),u.gridSize!==l&&(t.gridSize=u.gridSize),(i||Object.keys(t).length>0)&&(e.appState={...i,...t});let n=xL(u.elements),o={...a};for(let[e,t]of Object.entries(u.files))!(e in a)&&n.has(e)&&(o[e]=t);return(`files`in r||Object.keys(o).length>0)&&(e.files=o),e}}}function CL(e,t){return(0,A.useSyncExternalStore)(e.subscribe,()=>t(e.getState()),()=>t(e.getState()))}function wL(e){return CL(e,e=>e.canvasSize.width>0&&e.canvasSize.width<640)}var TL=`_14kbw0v0`,EL=`_14kbw0v1`,DL=`_14kbw0v3`,OL=`_14kbw0v5`,kL=`_14kbw0v6`,AL=`_14kbw0v7`,jL=`_14kbw0v8`,ML=`_14kbw0v9`,NL=`_14kbw0va`,PL=`_14kbw0vb`,FL=`_14kbw0vc`,IL=`_14kbw0vd`,LL=`_14kbw0ve`,RL=`_14kbw0vf`,zL=`_14kbw0vg`,BL=`_14kbw0vi`,VL=`_14kbw0vj`,HL=`_14kbw0vk`,UL=`_14kbw0vl`,WL=`_14kbw0vn`,GL=`_14kbw0vo`,KL=`_14kbw0vp`,qL=[{tool:`hand`,icon:Nn,key:`H`,label:`Hand`},{tool:`selection`,icon:Ln,key:`V`,label:`Select`},{tool:`rectangle`,icon:Rn,key:`R`,label:`Rectangle`},{tool:`diamond`,icon:xn,key:`D`,label:`Diamond`},{tool:`ellipse`,icon:Bt,key:`O`,label:`Ellipse`},{tool:`arrow`,icon:Pr,key:`A`,label:`Arrow`},{tool:`line`,icon:le,key:`L`,label:`Line`},{tool:`freedraw`,icon:Ir,key:`P`,label:`Draw`},{tool:`text`,icon:fe,key:`T`,label:`Text`},{tool:`card`,icon:En,key:`N`,label:`Card`},{tool:`image`,icon:pe,key:`I`,label:`Image`},{tool:`frame`,icon:Mn,key:`F`,label:`Frame`},{tool:`eraser`,icon:Tn,key:`E`,label:`Eraser`}],JL=({className:e,onToolSelect:t,showKeys:n=!0,store:r,tools:i})=>{let a=CL(r,e=>e.tool),o=CL(r,e=>e.toolLocked),s=o?Xt:Cn;return(0,j.jsxs)(`div`,{className:`${EL}${e?` ${e}`:``}`,role:`toolbar`,children:[(0,j.jsx)(Nw,{icon:!0,"aria-label":o?`Unlock tool`:`Keep tool active`,"aria-pressed":o,className:DL,size:`lg`,variant:`ghost`,onClick:()=>r.setState({toolLocked:!o}),children:(0,j.jsx)(s,{size:16})}),(0,j.jsx)(`span`,{className:OL}),qL.filter(e=>!i||i.has(e.tool)).map(({tool:e,icon:i,key:o,label:s})=>(0,j.jsxs)(Nw,{icon:!0,"aria-label":`${s} (${o})`,"aria-pressed":a===e,className:DL,"data-tool":e,size:`lg`,title:`${s} — ${o}`,variant:`ghost`,onClick:()=>{t?.(e)!==!1&&r.setState({tool:e,selectedIds:e===`selection`?r.getState().selectedIds:new Set})},children:[(0,j.jsx)(i,{size:16}),n&&(0,j.jsx)(`span`,{className:`_14kbw0v4`,children:o})]},e))]})};function YL(e,t){if(!e)return null;let n=t.get(e.elementId);return n?{...e,elementId:n}:null}function XL(e,t){let n=new Map(e.map(e=>[e.id,sN()])),r=new Map,i=e=>(r.has(e)||r.set(e,sN()),r.get(e));return{clones:e.map(e=>{let r={...e,id:n.get(e.id),x:e.x+t[0],y:e.y+t[1],seed:cN(),version:1,versionNonce:cN(),updated:Date.now(),index:null,groupIds:(e.groupIds??[]).map(i),boundElements:e.boundElements?.filter(e=>n.has(e.id)).map(e=>({...e,id:n.get(e.id)}))??null};if(e.type===`text`&&(r.containerId=e.containerId?n.get(e.containerId)??null:null),e.type===`arrow`||e.type===`line`){let t=e;r.startBinding=YL(t.startBinding,n),r.endBinding=YL(t.endBinding,n)}return r.frameId=e.frameId?n.get(e.frameId)??null:null,r}),idMap:n}}function ZL(e){return e.type===`frame`||e.type===`magicframe`}var QL=e=>e.type===`text`?e.containerId??null:null,$L=(e,t)=>jM(BM(e),BM(t)),eR=(e,t)=>MM(BM(e),BM(t));function tR(e,t){return(e.frameId??null)===t?e:$(e,{frameId:t})}function nR(e){let t=new Map(e.map(e=>[e.id,e]));return e.map(e=>{let n=QL(e),r=n?t.get(n):void 0;return r?tR(e,r.frameId??null):e})}function rR(e,t){let n=e.find(e=>e.id===t);return!n||n.isDeleted?[...e]:nR(e.map(e=>e.id===t||e.isDeleted||ZL(e)||QL(e)||e.frameId&&e.frameId!==t?e:e.frameId===t?tR(e,eR(n,e)?t:null):tR(e,$L(n,e)?t:null)))}function iR(e,t){let n=e.filter(e=>ZL(e)&&!e.isDeleted);return nR(e.map(e=>{if(!t.has(e.id)||e.isDeleted||ZL(e)||QL(e)||e.frameId&&t.has(e.frameId))return e;let r=e.frameId?n.find(t=>t.id===e.frameId):void 0;return r&&eR(r,e)?e:tR(e,n.findLast(t=>$L(t,e))?.id??null)}))}function aR(e,t){let n=iR(e,t);for(let r of e)t.has(r.id)&&ZL(r)&&(n=rR(n,r.id));return n}function oR(e,t){let n=new Set(t),r=new Set(e.filter(e=>t.has(e.id)&&ZL(e)).map(e=>e.id));if(r.size===0)return n;for(let t of e)!t.isDeleted&&t.frameId&&r.has(t.frameId)&&n.add(t.id);return n}var sR=e=>!e.isDeleted;function cR(e){return!e.isDeleted&&!e.locked}function lR(e){return e.type===`text`?e.containerId??null:null}function uR(e,t){return e.filter(e=>sR(e)&&e.groupIds?.includes(t)).map(e=>e.id)}function dR(e,t){let n=t.groupIds??[];if(n.length===0)return[t.id];let r=e.editingGroupId,i=r?n.indexOf(r):-1;if(i===0)return[t.id];let a=i>0?n[i-1]:n.at(-1);return uR(e.elements,a)}function fR(e,t,n){let r=new Map(e.map(e=>[e.id,e]));for(let i=e.length-1;i>=0;i--){let a=e[i];if(!cR(a)||!JM(a,t,n))continue;let o=lR(a),s=o?r.get(o):void 0;return s&&cR(s)?s:a}return null}function pR(e,t,n){let r=fR(e.elements,t,n);return r?{hitId:r.id,ids:dR(e,r)}:null}function mR(e,t){let n=new Set(t);for(let r of e){let e=lR(r);e&&t.has(e)&&sR(r)&&n.add(r.id)}return n}function hR(e,t){let n=e.elements.filter(e=>cR(e)&&!lR(e)),r=new Set(YM(n,t).map(e=>e.id)),i=new Set;for(let t of r){let n=dR(e,e.elements.find(e=>e.id===t));if(n.every(e=>r.has(e)))for(let e of n)i.add(e)}return i}function gR(e){return e.elements.filter(t=>sR(t)&&e.selectedIds.has(t.id))}var _R=10;function vR(e){let t=e.getState();return mR(t.elements,t.selectedIds)}function yR(e,t){let n=vR(e);n.size!==0&&e.commit(({elements:e})=>{let r=t([...e],n);if(!r.every((t,n)=>t===e[n]))return{elements:r.map(e=>n.has(e.id)?$(e,{index:null}):e)}})}var bR=e=>yR(e,(e,t)=>[...e.filter(e=>!t.has(e.id)),...e.filter(e=>t.has(e.id))]),xR=e=>yR(e,(e,t)=>[...e.filter(e=>t.has(e.id)),...e.filter(e=>!t.has(e.id))]),SR=e=>yR(e,(e,t)=>{for(let n=e.length-2;n>=0;n--)t.has(e[n].id)&&!t.has(e[n+1].id)&&([e[n],e[n+1]]=[e[n+1],e[n]]);return e}),CR=e=>yR(e,(e,t)=>{for(let n=1;n<e.length;n++)t.has(e[n].id)&&!t.has(e[n-1].id)&&([e[n],e[n-1]]=[e[n-1],e[n]]);return e});function wR(e){let t=vR(e);if(gR(e.getState()).length<2)return;let n=sN();e.commit(({elements:e})=>({elements:e.map(e=>t.has(e.id)?$(e,{groupIds:[...e.groupIds??[],n]}):e)}))}function TR(e){let t=vR(e),n=new Set(gR(e.getState()).map(e=>e.groupIds?.at(-1)).filter(e=>!!e));n.size!==0&&(e.commit(({elements:e})=>({elements:e.map(e=>t.has(e.id)&&e.groupIds?.some(e=>n.has(e))?$(e,{groupIds:e.groupIds.filter(e=>!n.has(e))}):e)})),e.setState({editingGroupId:null}))}function ER(e){let t=e.getState(),n=vR(e);if(n.size===0)return;let{clones:r,idMap:i}=XL(t.elements.filter(e=>n.has(e.id)&&!e.isDeleted),[_R,_R]);e.commit(({elements:e})=>({elements:aR([...e,...r],new Set(r.map(e=>e.id)))})),e.setState({selectedIds:new Set([...t.selectedIds].map(e=>i.get(e)).filter(e=>!!e))})}function DR(e,t){return e.map(e=>{if(t.has(e.id))return $(e,{isDeleted:!0});let n={};if(e.boundElements?.some(e=>t.has(e.id))&&(n.boundElements=e.boundElements.filter(e=>!t.has(e.id))),e.type===`arrow`||e.type===`line`){let r=e;r.startBinding&&t.has(r.startBinding.elementId)&&(n.startBinding=null),r.endBinding&&t.has(r.endBinding.elementId)&&(n.endBinding=null)}return e.frameId&&t.has(e.frameId)&&(n.frameId=null),Object.keys(n).length>0?$(e,n):e})}function OR(e){let t=vR(e);t.size!==0&&(e.commit(({elements:e})=>({elements:DR(e,t)})),e.setState({selectedIds:new Set,selectedPointIndex:null}))}function kR(e){let t=e.getState();e.setState({selectedIds:new Set(t.elements.filter(e=>!e.isDeleted&&!e.locked&&!(e.type===`text`&&e.containerId)).map(e=>e.id)),editingGroupId:null})}var AR=`excalidraw/clipboard`;function jR(e,t){let n={};for(let r of e)r.type===`image`&&r.fileId&&t[r.fileId]&&(n[r.fileId]=t[r.fileId]);return JSON.stringify({type:AR,elements:e,files:n})}function MR(e){let t=e.trim();if(!t)return null;if(t.startsWith(`{`))try{let e=JSON.parse(t);return(e.type===`excalidraw/clipboard`||e.type===`excalidraw`)&&Array.isArray(e.elements)?{elements:e.elements.filter(e=>!e.isDeleted),files:e.files??{}}:null}catch{return{text:e}}return{text:e}}var NR=200,PR=e=>new Promise((t,n)=>{let r=new Image;r.addEventListener(`load`,()=>t({width:r.naturalWidth,height:r.naturalHeight})),r.addEventListener(`error`,n),r.src=e});function FR(e,t,n=600){let r=Math.min(1,n/Math.max(e,t));return{width:Math.round(e*r),height:Math.round(t*r)}}function IR(e){return new Promise((t,n)=>{let r=new FileReader;r.addEventListener(`load`,()=>t(String(r.result))),r.addEventListener(`error`,()=>n(r.error)),r.readAsDataURL(e)})}async function LR(e,t,n,r={}){let i=await IR(t),a=await PR(i).catch(()=>null),{width:o,height:s}=FR(a?.width||NR,a?.height||NR),c=sN(),l=jN({x:n[0]-o/2,y:n[1]-s/2,width:o,height:s,fileId:c,status:`pending`},e.getState().currentStyle),u={id:c,mimeType:t.type||`image/png`,created:Date.now(),dataURL:i};e.commit(({elements:e,files:t})=>({elements:[...e,l],files:{...t,[c]:u}}));let{toolLocked:d,tool:f}=e.getState();e.setState({selectedIds:new Set([l.id]),tool:d?f:`selection`});let p=i;if(r.uploadFile)try{p=await r.uploadFile(t)}catch(e){r.onUploadError?.(e)}return e.amend(e=>{if(!e.elements.some(e=>e.id===l.id))return e;let t=e.files[c];return{elements:e.elements.map(e=>e.id===l.id?$(e,{status:`saved`}):e),files:t?{...e.files,[c]:{...t,dataURL:p}}:e.files}}),l.id}function RR(e){let t=e.getState(),n=mR(t.elements,t.selectedIds);return jR(t.elements.filter(e=>n.has(e.id)&&!e.isDeleted),t.files)}function zR(e){let t=RR(e);return OR(e),t}var BR=200;function VR(e,t,n){let r=t.trim(),i=pP(r)??{width:BR,height:BR},a=Math.min(1,600/Math.max(i.width,i.height)),o=i.width*a,s=i.height*a,c=NN({svg:r,width:o,height:s,x:n[0]-o/2,y:n[1]-s/2},e.getState().currentStyle);e.commit(({elements:e})=>({elements:aR([...e,c],new Set([c.id]))})),e.setState({selectedIds:new Set([c.id]),editingGroupId:null})}function HR(e,t,n){if(cP(t))return VR(e,t,n),!0;let r=MR(t);if(!r)return!1;let i=e.getState().currentStyle;if(`text`in r){let t=i.fontSize*WN(i.fontFamily),a=EP(AN({text:r.text,x:n[0],y:n[1]-t/2},i));return e.commit(({elements:e})=>({elements:[...e,a]})),e.setState({selectedIds:new Set([a.id])}),!0}if(r.elements.length===0)return!1;let[a,o,s,c]=VM(r.elements),l=[n[0]-(a+s)/2,n[1]-(o+c)/2],{clones:u}=XL(r.elements,l);return e.commit(({elements:e,files:t})=>({elements:aR([...e,...u],new Set(u.map(e=>e.id))),files:{...t,...r.files}})),e.setState({selectedIds:new Set(u.filter(e=>!(e.type===`text`&&e.containerId)).map(e=>e.id)),editingGroupId:null}),!0}var UR=e=>`type`in e&&e.type===`separator`,WR={type:`separator`},GR=``;function KR(e){GR=e,typeof navigator<`u`&&navigator.clipboard&&navigator.clipboard.writeText(e).catch(()=>{})}async function qR(){try{return await navigator.clipboard.readText()||GR}catch{return GR}}function JR(e,t){let n=e.getState(),r=pR(n,t,6/n.viewport.zoom);r?r.ids.every(e=>n.selectedIds.has(e))||e.setState({selectedIds:new Set(r.ids)}):n.selectedIds.size>0&&e.setState({selectedIds:new Set})}function YR(e,t){let n=(t,n,r)=>({key:t,label:n,onSelect:()=>r(e)}),r=[];return t.length>1&&r.push(n(`group`,`Group`,wR)),t.some(e=>(e.groupIds?.length??0)>0)&&r.push(n(`ungroup`,`Ungroup`,TR)),[n(`copy`,`Copy`,e=>KR(RR(e))),n(`cut`,`Cut`,e=>KR(zR(e))),n(`duplicate`,`Duplicate`,ER),WR,n(`bring-forward`,`Bring forward`,SR),n(`send-backward`,`Send backward`,CR),n(`bring-to-front`,`Bring to front`,bR),n(`send-to-back`,`Send to back`,xR),...r.length>0?[WR,...r]:[],WR,{...n(`delete`,`Delete`,OR),danger:!0}]}function XR(e,t){return[{key:`paste`,label:`Paste`,onSelect:()=>{qR().then(n=>{n&&HR(e,n,t)})}},{key:`select-all`,label:`Select all`,onSelect:()=>kR(e)}]}function ZR(e,t,n){JR(e,t);let r=gR(e.getState()),i=r.length>0?YR(e,r):XR(e,t),a=n?.({scenePoint:t,selected:r})??[];return a.length>0?[...i,WR,...a]:i}var QR=`_17gtqeu0`,$R=`_17gtqeu1`,ez=`_17gtqeu2`,tz=`var(--rc-accent)`,nz=.1;function rz(e){return Math.min(30,Math.max(nz,e))}function iz([e,t],n){return[e/n.zoom-n.scrollX,t/n.zoom-n.scrollY]}function az([e,t],n){return[(e+n.scrollX)*n.zoom,(t+n.scrollY)*n.zoom]}function oz(e,t,n){let r=rz(n),[i,a]=iz(t,e);return{zoom:r,scrollX:t[0]/r-i,scrollY:t[1]/r-a}}function sz(e,t,n=48){let[r,i,a,o]=e,s=Math.max(1,a-r),c=Math.max(1,o-i),l=rz(Math.min(1,(t.width-n*2)/s,(t.height-n*2)/c));return{zoom:l,scrollX:t.width/2/l-(r+s/2),scrollY:t.height/2/l-(i+c/2)}}var cz=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2];function lz(){let e=new Map,t=null,n=!1;return{down(r,i,a){if(e.set(r,i),t||n)return`ignored`;if(e.size<2)return`single`;let[o,s]=[...e.keys()].slice(-2),c=e.get(o),l=e.get(s);return t={ids:[o,s],distance:Math.max(Math.hypot(l[0]-c[0],l[1]-c[1]),1),zoom:a.zoom,anchor:iz(cz(c,l),a)},`pinch`},move(n,r){if(!e.has(n)||(e.set(n,r),!t))return null;let i=e.get(t.ids[0]),a=e.get(t.ids[1]),o=rz(t.zoom*Math.hypot(a[0]-i[0],a[1]-i[1])/t.distance),[s,c]=cz(i,a);return{zoom:o,scrollX:s/o-t.anchor[0],scrollY:c/o-t.anchor[1]}},up(r){e.delete(r),t&&(t=null,n=!0),e.size===0&&(n=!1)},isActive:()=>t!==null||n}}var uz=`_1yp4ot60`,dz=`_1yp4ot61`,fz=`_1yp4ot62`,pz=`_1yp4ot63`,mz=`_1yp4ot64`,hz=`_1yp4ot65`,gz=`_1yp4ot66`,_z=`_1yp4ot67`,vz=`_1yp4ot68`,yz=`_1yp4ot69`,bz=`_1yp4ot6a`,xz=`_1yp4ot6b`,Sz=`_1yp4ot6c`,Cz=`_1yp4ot6d`,wz=`_1yp4ot6e`,Tz=`_1yp4ot6f`,Ez=new Set([`rectangle`,`diamond`,`ellipse`,`image`,`svg`,`richtext`,`text`,`embeddable`,`iframe`]);function Dz(e){return e.isDeleted||!Ez.has(e.type)?!1:!(e.type===`text`&&e.containerId)}var Oz=60,kz=[[1,0],[0,1],[-1,0],[0,-1]],Az=([e,t])=>kz.findIndex(n=>n[0]===e&&n[1]===t),jz=(e,t)=>e[0]===t[0]&&e[1]===t[1];function Mz(e,t){let[n,r,i,a]=BM(e),o=(t[0]-(n+i)/2)/Math.max((i-n)/2,1e-9),s=(t[1]-(r+a)/2)/Math.max((a-r)/2,1e-9);return Math.abs(o)>=Math.abs(s)?o<0?[-1,0]:[1,0]:s<0?[0,-1]:[0,1]}function Nz(e,t){let n=t[0]-e[0],r=t[1]-e[1];return Math.abs(n)>=Math.abs(r)?n<0?[-1,0]:[1,0]:r<0?[0,-1]:[0,1]}var Pz=([e,t,n,r],i)=>[e-i,t-i,n+i,r+i],Fz=([e,t],[n,r,i,a])=>e>n&&e<i&&t>r&&t<a;function Iz(e,t,[n,r,i,a]){let o=Math.min(e[0],t[0]),s=Math.max(e[0],t[0]),c=Math.min(e[1],t[1]),l=Math.max(e[1],t[1]);return o===s?o>n&&o<i&&l>r&&c<a:c===l?c>r&&c<a&&s>n&&o<i:s>n&&o<i&&l>r&&c<a}function Lz(e,t,n){if(!n)return e;let[r,i,a,o]=Pz(BM(n),20);return t[0]>0?[Math.max(a,e[0]),e[1]]:t[0]<0?[Math.min(r,e[0]),e[1]]:t[1]>0?[e[0],Math.max(o,e[1])]:[e[0],Math.min(i,e[1])]}var Rz=class{constructor(){AP(this,`items`,[]),AP(this,`seq`,0)}get size(){return this.items.length}push(e,t){let n={f:t,key:e,seq:this.seq++},{items:r}=this;r.push(n);let i=r.length-1;for(;i>0;){let e=i-1>>1;if(!this.less(r[i],r[e]))break;[r[i],r[e]]=[r[e],r[i]],i=e}}pop(){let{items:e}=this,t=e[0],n=e.pop();if(e.length>0){e[0]=n;let t=0;for(;;){let n=t*2+1,r=n+1,i=t;if(n<e.length&&this.less(e[n],e[i])&&(i=n),r<e.length&&this.less(e[r],e[i])&&(i=r),i===t)break;[e[t],e[i]]=[e[i],e[t]],t=i}}return t.key}less(e,t){return e.f<t.f||e.f===t.f&&e.seq<t.seq}},zz=e=>[...new Set(e)].sort((e,t)=>e-t);function Bz(e,t,n,r,i){let a=zz([e[0],t[0],(e[0]+t[0])/2,...i.flatMap(e=>[e[0],e[2]])]),o=zz([e[1],t[1],(e[1]+t[1])/2,...i.flatMap(e=>[e[1],e[3]])]),s=a.length,c=e=>[a[e%s],o[Math.floor(e/s)]],l=([e,t])=>o.indexOf(t)*s+a.indexOf(e),u=n=>n!==e&&n!==t&&i.some(e=>Fz(n,e)),d=(e,t)=>i.some(n=>!Fz(e,n)&&!Fz(t,n)&&Iz(e,t,n)),f=l(e),p=l(t),m=new Map,h=new Map,g=new Rz,_=e=>Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1]),v=f*4+n;m.set(v,0),g.push(v,_(e));let y=null;for(;g.size>0;){let n=g.pop(),i=m.get(n);if(y&&i>=y.cost)break;let a=Math.floor(n/4),l=n%4,v=a===f?e:a===p?t:c(a);if(a===p){let e=i+(l===r?0:Oz*1.5);(!y||e<y.cost)&&(y={cost:e,key:n});continue}let b=a%s,x=Math.floor(a/s);for(let e=0;e<4;e++){if((e+2)%4===l)continue;let r=b+kz[e][0],a=x+kz[e][1];if(r<0||a<0||r>=s||a>=o.length)continue;let f=a*s+r,y=f===p?t:c(f);if(u(y)||d(v,y))continue;let S=f*4+e,C=i+Math.abs(y[0]-v[0])+Math.abs(y[1]-v[1])+(e===l?0:Oz);C>=(m.get(S)??1/0)||(m.set(S,C),h.set(S,n),g.push(S,C+_(y)))}}if(!y)return null;let b=[],x=y.key;for(;x!==void 0;){let n=Math.floor(x/4);b.push(n===f?e:n===p?t:c(n)),x=h.get(x)}return b.reverse()}function Vz(e,t=new Set){let n=[];for(let t of e)n.length>0&&jz(n.at(-1),t)||n.push(t);for(let e=n.length-2;e>0;e--){let[r,i,a]=[n[e-1],n[e],n[e+1]];(r[0]===i[0]&&i[0]===a[0]||r[1]===i[1]&&i[1]===a[1])&&!t.has(`${i[0]},${i[1]}`)&&n.splice(e,1)}return n}function Hz(e,t,n){let r=n.startHeading??(n.startTarget?Mz(n.startTarget,t):Nz(e,t)),i=n.endHeading??(n.endTarget?Mz(n.endTarget,e):Nz(t,e)),a=Lz(e,r,n.startTarget),o=Lz(t,i,n.endTarget),s=[n.startTarget,n.endTarget].filter(e=>!!e).map(e=>BM(e)),c=[...n.obstacles,...s].map(e=>Pz(e,20)),l=Bz(a,o,Az(r),(Az(i)+2)%4,c);if(!l){let n=(a[0]+o[0])/2;return Vz([e,a,[n,a[1]],[n,o[1]],o,t])}return Vz([e,...l,t])}function Uz(e,t,n){let[r,i,a,o]=BM(e),s=(r+a)/2,c=(i+o)/2;return t[0]>0?[a+n,c]:t[0]<0?[r-n,c]:t[1]>0?[s,o+n]:[s,i-n]}var Wz=e=>{let[t,n,r,i]=BM(e);return[(t+r)/2,(n+i)/2]};function Gz(e,t){return e.filter(e=>e.id!==t&&Dz(e)).map(e=>BM(e))}function Kz(e,t){let n=t?e.get(t):void 0;return n&&!n.isDeleted?n:null}function qz(e,t){let n=new Map(t.map(e=>[e.id,e])),r=RM(e);if(r.length<2)return e;let i=Kz(n,e.startBinding?.elementId),a=Kz(n,e.endBinding?.elementId),o=[...e.fixedSegments??[]].sort((e,t)=>e.index-t.index).map(t=>({start:[e.x+t.start[0],e.y+t.start[1]],end:[e.x+t.end[0],e.y+t.end[1]]})).filter(e=>!jz(e.start,e.end)),s=o[0]?.start??(a?Wz(a):r.at(-1)),c=o.at(-1)?.end??(i?Wz(i):r[0]),l=r[0],u;i&&(u=Mz(i,s),l=Uz(i,u,e.startBinding?.gap??4));let d=r.at(-1),f;a&&(f=Mz(a,c),d=Uz(a,f,e.endBinding?.gap??4));let p=Gz(t,e.id),m=[],h=l,g=u,_=i;for(let e of o){let t=Nz(e.start,e.end);m.push(...Hz(h,e.start,{obstacles:p,startTarget:_,startHeading:g,endHeading:[-t[0],-t[1]]})),h=e.end,g=t,_=null}m.push(...Hz(h,d,{obstacles:p,startTarget:_,startHeading:g,endTarget:a,endHeading:f}));let v=Vz(m,new Set(o.flatMap(e=>[e.start,e.end]).map(e=>`${e[0]},${e[1]}`))),[y,b]=v[0],x=v.map(([e,t])=>[e-y,t-b]);if(y===e.x&&b===e.y&&x.length===e.points.length&&x.every((t,n)=>jz(t,e.points[n]))&&PM(e)===0)return e;let S=[];for(let e of o){let t=v.findIndex((t,n)=>n>0&&jz(v[n-1],e.start)&&jz(t,e.end));t>0&&S.push({index:t,start:[e.start[0]-y,e.start[1]-b],end:[e.end[0]-y,e.end[1]-b]})}let[C,w,T,E]=AM(x);return $(e,{x:y,y:b,angle:0,points:x,width:T-C,height:E-w,fixedSegments:e.fixedSegments?S:e.fixedSegments})}function Jz(e,t){let n=PM(e),r=LM(e),i=t.map(e=>DM(e,r,-n)),[a,o,s,c]=AM(i),l=[(a+s)/2,(o+c)/2],u=[l[0]-r[0],l[1]-r[1]],d=DM(u,[0,0],n),f=[d[0]-u[0],d[1]-u[1]],p=i.map(([e,t])=>[e+f[0],t+f[1]]),[m,h]=p[0],g=p.map(([e,t])=>[e-m,t-h]);return{...e,x:m,y:h,points:g,width:s-a,height:c-o}}function Yz(e,t,n){let r=RM(e);return r[t]=n,$(e,Jz(e,r))}var Xz=e=>e===`start`?`startBinding`:`endBinding`;function Zz(e,[t,n]){return DM([e.x+t,e.y+n],LM(e),PM(e))}function Qz(e){let{width:t,height:n}=e,r=e.type===`diamond`?[[t/2,0],[t,n/2],[t/2,n],[0,n/2]]:[[0,0],[t,0],[t,n],[0,n]];return r.map((e,t)=>[e,r[(t+1)%r.length]])}function $z(e,t){let[n,r]=HM(e,t),{width:i,height:a}=e;if(e.type===`ellipse`){let e=i/2,t=a/2;if(e<=0||t<=0)return 1/0;let o=Math.hypot((n-e)/e,(r-t)/t);return o<=1?0:(o-1)*Math.min(e,t)}return e.type===`diamond`?i>0&&a>0&&Math.abs(n-i/2)/(i/2)+Math.abs(r-a/2)/(a/2)<=1?0:Math.min(...Qz(e).map(([e,t])=>kM([n,r],e,t))):Math.hypot(Math.max(-n,0,n-i),Math.max(-r,0,r-a))}function eB(e,t,n,r=new Set){let i=15/n;for(let n=e.length-1;n>=0;n--){let a=e[n];if(!r.has(a.id)&&Dz(a)&&$z(a,t)<=i)return a}return null}function tB(e,t,n,r){let i=[r[0]-n[0],r[1]-n[1]],a=t[0]*i[1]-t[1]*i[0];if(Math.abs(a)<1e-12)return null;let o=n[0]-e[0],s=n[1]-e[1],c=(o*i[1]-s*i[0])/a,l=(o*t[1]-s*t[0])/a;return l>=0&&l<=1?c:null}function nB(e,t,n){if(e.type!==`ellipse`)return Qz(e).map(([e,r])=>tB(t,n,e,r)).filter(e=>e!==null);let r=e.width/2,i=e.height/2;if(r<=0||i<=0)return[];let a=(t[0]-r)/r,o=(t[1]-i)/i,s=n[0]/r,c=n[1]/i,l=s*s+c*c,u=2*(a*s+o*c),d=a*a+o*o-1,f=u*u-4*l*d;if(f<0||l===0)return[];let p=Math.sqrt(f);return[(-u-p)/(2*l),(-u+p)/(2*l)]}function rB(e,[t,n]){let r=e.width/2,i=e.height/2;return e.type===`ellipse`?Math.hypot(r*t,i*n):e.type===`diamond`?Math.max(Math.abs(r*t),Math.abs(i*n)):Math.abs(r*t)+Math.abs(i*n)}function iB(e,t){let n=[e.width/2,e.height/2],r=HM(e,t),i=Math.hypot(n[0]-r[0],n[1]-r[1]);if(i<1e-9)return null;let a=[(n[0]-r[0])/i,(n[1]-r[1])/i],o=[-a[1],a[0]];return{c:n,o:r,u:a,n:o,len:i,half:rB(e,o)}}var aB=(e,t,n)=>Math.min(n,Math.max(t,e));function oB(e,t,n){let r=iB(e,t);if(!r||r.half===0)return 0;let i=HM(e,n),a=[i[0]-r.o[0],i[1]-r.o[1]],o=a[0]*r.u[0]+a[1]*r.u[1];return o<1e-9?0:aB(r.len/o*(a[0]*r.n[0]+a[1]*r.n[1])/r.half,-1,1)}function sB(e,t,n,r){let i=iB(e,r);if(!i)return LM(e);let a=aB(t,-1,1)*i.half,o=[i.c[0]+i.n[0]*a,i.c[1]+i.n[1]*a],s=Math.hypot(o[0]-i.o[0],o[1]-i.o[1]);if(s<1e-9)return Zz(e,o);let c=[(o[0]-i.o[0])/s,(o[1]-i.o[1])/s],l=nB(e,i.o,c).filter(e=>e>1e-9);if(l.length===0)return Zz(e,o);let u=Math.max(0,Math.min(...l)-n);return Zz(e,[i.o[0]+c[0]*u,i.o[1]+c[1]*u])}function cB(e,t,n,r){let i=e.boundElements??[];return i.some(e=>e.id===t)===r?e:$(e,{boundElements:r?[...i,{id:t,type:n}]:i.filter(e=>e.id!==t)})}function lB(e,t){let n=e.points.length-1;return t===`start`?[0,Math.min(1,n)]:[n,Math.max(0,n-1)]}function uB(e,t,n){let r=e.find(e=>e.id===t),i=r?.[Xz(n)];if(!r||!i)return[...e];let a=r[Xz(n===`start`?`end`:`start`)]?.elementId===i.elementId,o=$(r,{[Xz(n)]:null});return e.map(e=>e.id===t?o:e.id===i.elementId&&!a?cB(e,t,r.type,!1):e)}function dB(e,t,n,r){let i=uB(e,t,n),a=i.find(e=>e.id===t),o=i.find(e=>e.id===r);if(!a||!o||a.points.length<2)return i;let s=RM(a),[c,l]=lB(a,n),u=oB(o,s[l],s[c]),d={elementId:r,focus:u,gap:4},f={...Yz(a,c,sB(o,u,4,s[l])),[Xz(n)]:d};return i=i.map(e=>e.id===t?f:e.id===r?cB(e,t,a.type,!0):e),i}var fB=(e,t)=>typeof e==`number`&&Number.isFinite(e)?e:t;function pB(e,t,n){let r=t.fixedPoint;return Array.isArray(r)&&r.length===2&&r.every(Number.isFinite)?Zz(e,[r[0]*e.width,r[1]*e.height]):sB(e,fB(t.focus,0),fB(t.gap,4),n)}function mB(e,t,n){let r=RM(e),i=!1;for(let a of n){let n=e[Xz(a)],o=n&&t.get(n.elementId);if(!n||!o||o.isDeleted)continue;let[s,c]=lB(e,a),l=pB(o,n,r[c]);l.every(Number.isFinite)&&(r[s]=l,i=!0)}return i?$(e,Jz(e,r)):e}function hB(e,t){let n=new Map(e.map(e=>[e.id,e]));return e.map(r=>{if(t.has(r.id)||r.type!==`arrow`&&r.type!==`line`)return r;let i=r,a=[`start`,`end`].filter(e=>{let n=i[Xz(e)];return!!n&&t.has(n.elementId)});return a.length===0?r:i.elbowed?qz(i,e):mB(i,n,a)})}function gB(e,t){let n=[...e];for(let r of e)if(!(!t.has(r.id)||r.type!==`arrow`&&r.type!==`line`))for(let e of[`start`,`end`]){let i=r[Xz(e)];i&&!t.has(i.elementId)&&(n=uB(n,r.id,e))}return n}function _B(e,t){let n=gB(e,t),r=hB(n,t),i=new Set(r.filter((e,t)=>e!==n[t]).map(e=>e.id));return i.size>0?gL(r,i):r}function vB(e,t){let n=new Set([t]);for(let r of e)r.type===`text`&&r.containerId===t&&n.add(r.id);return n}function yB(e,t,n,r){return eB(e,n,r,vB(e,t))}function bB(e,t,n,r){let i=[...e];for(let e of n){let n=i.find(e=>e.id===t);if(!n||n.type!==`arrow`)return i;let a=RM(n),o=e===`start`?a[0]:a.at(-1),s=yB(i,t,o,r);i=s?dB(i,t,e,s.id):uB(i,t,e)}return gL(xB(i,t),new Set([t]))}function xB(e,t){return e.map(n=>n.id===t&&n.elbowed?qz(n,e):n)}function SB(e,t){let n=e.getState().elements.find(e=>e.id===t);!n||n.type!==`richtext`||n.isDeleted||n.locked||e.setState({editingRichTextId:t,selectedIds:new Set([t]),editingGroupId:null})}function CB(e){e.getState().editingRichTextId&&e.setState({editingRichTextId:null})}function wB(e,t,n){e.commit(({elements:e})=>({elements:_B(ZP(e.map(e=>e.id===t&&e.type===`richtext`?$(e,{content:n}):e)),new Set([t]))}))}function TB(e,t){let[n]=ZP([MN({x:t[0]-100,y:t[1]-60,width:200,height:120})]);return e.commit(({elements:e})=>({elements:[...e,n]})),e.setState({tool:`selection`}),SB(e,n.id),n.id}function EB(e,t){e.setState({tool:t,selectedIds:t===`selection`?e.getState().selectedIds:new Set})}function DB(e,t){let{gridSize:n}=e.getState();return n&&n>0&&!t.ctrlKey?n:null}var OB=(e,t)=>t?Math.round(e/t)*t:e,kB=([e,t],n)=>n?[OB(e,n),OB(t,n)]:[e,t];function AB(e,t){e.updateTransient(({elements:e})=>({elements:e.map(e=>e.id===t.id?t:e)}))}function jB(e,t){e.updateTransient(({elements:e})=>({elements:[...e,t]}))}function MB(e,t,n=!0){e.updateTransient(({elements:e})=>({elements:aR(e,new Set([t]))})),e.endTransient(!0);let r=e.getState();e.setState({selectedIds:n?new Set([t]):r.selectedIds,tool:r.toolLocked?r.tool:`selection`})}function NB(e){e.endTransient(!1)}function PB(e,t){return e.getState().elements.find(e=>e.id===t)}function FB(){let e=null,t=[0,0],n=[0,0];return{onPointerDown(r,i){let{store:a}=r;n=i.scene,t=kB(i.scene,DB(a,i));let o=MN({x:t[0],y:t[1],width:0,height:0});e=o.id,a.beginTransient(),jB(a,o),a.setState({selectedIds:new Set})},onPointerMove(n,r){if(!e)return;let i=PB(n.store,e);if(!i)return;let a=kB(r.scene,DB(n.store,r));AB(n.store,{...i,x:Math.min(t[0],a[0]),y:Math.min(t[1],a[1]),width:Math.abs(a[0]-t[0]),height:Math.abs(a[1]-t[1])})},onPointerUp(t,r){if(!e)return;let{store:i}=t,a=e;e=null;let o=PB(i,a);if(!o){NB(i);return}let s=i.getState().viewport.zoom;AB(i,ZP([Math.hypot(r.scene[0]-n[0],r.scene[1]-n[1])*s<2?{...o,x:n[0]-100,y:n[1]-60,width:200,height:120}:o])[0]),MB(i,a),SB(i,a)},cancel(t){e&&(e=null,NB(t.store))}}}var IB=4;function LB(e,t,n){let r=e.store.getState(),i=6/r.viewport.zoom,a=new Set(r.erasingIds),o=Math.max(1,Math.ceil(Math.hypot(n[0]-t[0],n[1]-t[1])/IB)),s=r.elements.filter(e=>!a.has(e.id));for(let e=0;e<=o;e++){let r=fR(s,[t[0]+(n[0]-t[0])*e/o,t[1]+(n[1]-t[1])*e/o],i);r&&a.add(r.id)}a.size!==r.erasingIds.size&&e.store.setState({erasingIds:a})}function RB(){let e=null;return{onPointerDown(t,n){e=n.scene,t.store.setState({erasingIds:new Set,selectedIds:new Set}),LB(t,n.scene,n.scene)},onPointerMove(t,n){e&&=(LB(t,e,n.scene),n.scene)},onPointerUp(t){if(!e)return;e=null;let{store:n}=t,r=mR(n.getState().elements,n.getState().erasingIds);n.setState({erasingIds:new Set}),r.size!==0&&n.commit(({elements:e})=>({elements:DR(e,r)}))},cancel(t){e=null,t.store.setState({erasingIds:new Set})}}}function zB(){let e=null;return{onPointerDown(t,n){let{store:r}=t,i=n.pointerType===`pen`,a=kN({x:n.scene[0],y:n.scene[1],points:[[0,0]],pressures:i?[n.pressure]:[],simulatePressure:!i},r.getState().currentStyle);e=a.id,r.beginTransient(),jB(r,a),r.setState({selectedIds:new Set})},onPointerMove(t,n){if(!e)return;let r=PB(t.store,e);if(!r)return;let i=[...r.points,[n.scene[0]-r.x,n.scene[1]-r.y]],[a,o,s,c]=AM(i);AB(t.store,{...r,points:i,pressures:r.simulatePressure?r.pressures:[...r.pressures,n.pressure],width:s-a,height:c-o})},onPointerUp(t){e&&(e=null,t.store.endTransient(!0))},cancel(t){e&&(e=null,t.store.endTransient(!1))}}}function BB(){let e=null,t=null;return{onPointerDown(n,r){e=r.screen,t=n.store.getState().viewport},onPointerMove(n,r){e&&t&&n.store.setState({viewport:{...t,scrollX:t.scrollX+(r.screen[0]-e[0])/t.zoom,scrollY:t.scrollY+(r.screen[1]-e[1])/t.zoom}})},onPointerUp(){e=null,t=null}}}function VB(){return{onPointerDown(e,t){e.requestImage?.(t.scene)},onPointerMove(){},onPointerUp(){}}}var HB=Math.PI/12;function UB(e,t){let[n,r]=t[0],i=t.map(([e,t])=>[e-n,t-r]),[a,o,s,c]=AM(i);return{...e,x:n,y:r,points:i,width:s-a,height:c-o}}function WB(e,t){let n=t[0]-e[0],r=t[1]-e[1],i=Math.hypot(n,r),a=Math.round(Math.atan2(r,n)/HB)*HB;return[e[0]+Math.cos(a)*i,e[1]+Math.sin(a)*i]}function GB(e){return e.points.map(([t,n])=>[e.x+t,e.y+n])}function KB(e,t={}){let n=null,r=`idle`,i=[0,0],a=[0,0],o=!1,s=(t,n,r)=>{let{elements:i,viewport:a}=t.store.getState(),s=e===`arrow`&&!o?yB(i,n.id,r,a.zoom):null;t.store.setState({suggestedBindingId:s?.id??null})},c=(e,r)=>{let i=n?PB(e.store,n):void 0;if(!i)return;let c=kB(r.scene,DB(e.store,r)),l;if(i.elbowed){let{elements:t,viewport:n}=e.store.getState(),r=e=>o?null:yB(t,i.id,e,n.zoom);l=UB(i,Hz(a,c,{obstacles:Gz(t,i.id),startTarget:r(a),endTarget:r(c)}))}else{let e=GB(i),t=e.at(-2)??e[0];e[e.length-1]=r.shiftKey?WB(t,c):c,l=UB(i,e)}t.onPointMoved&&(l=t.onPointMoved(e,l,r)),AB(e.store,l),s(e,l,GB(l).at(-1))},l=(i,a,s)=>{let c=n?PB(i,n):void 0,l=n;if(n=null,r=`idle`,!c||!l)return;let u=GB(c);if(a&&c.elbowed&&(u.length=0),a&&u.pop(),u.length<2){NB(i);return}let d=UB(c,u);if(AB(i,d),e===`arrow`&&!o){let e=i.getState().viewport.zoom;i.updateTransient(({elements:t})=>({elements:bB(t,l,[`start`,`end`],e)}))}i.setState({suggestedBindingId:null}),MB(i,l),s&&t.onFinished?.(s,d)};return{onPointerDown(t,s){let{store:u}=t;if(i=s.screen,o=s.ctrlKey,r!==`multi`&&(a=kB(s.scene,DB(u,s))),r===`multi`&&n){let e=PB(u,n);if(e.elbowed){c(t,s),l(u,!1,t);return}let r=GB(e);AB(u,UB(e,[...r,r.at(-1)]));return}let d=ON(e,{x:a[0],y:a[1],points:[[0,0],[0,0]]},u.getState().currentStyle);n=d.id,r=`dragging`,u.beginTransient(),jB(u,d),u.setState({selectedIds:new Set})},onPointerMove(e,t){r!==`idle`&&(o=t.ctrlKey,c(e,t))},onPointerUp(e,t){r===`dragging`&&(o=t.ctrlKey,Math.hypot(t.screen[0]-i[0],t.screen[1]-i[1])<2?r=`multi`:l(e.store,!1,e))},onDoubleClick(e){r===`multi`&&l(e.store,!0,e)},onKeyDown(e,t){return r===`idle`?!1:t.key===`Enter`||t.key===`Escape`?(l(e.store,!0,e),!0):!1},cancel(e){n&&(r===`multi`?l(e.store,!0,e):(n=null,r=`idle`,e.store.setState({suggestedBindingId:null}),NB(e.store)))}}}function qB(e){return!!e&&(e.type===`line`||e.type===`arrow`)&&!e.locked}function JB(e,t,n){let r=RM(e);return r.splice(t+1,0,n),$(e,Jz(e,r))}function YB(e,t){if(e.points.length<=2)return e;let n=RM(e);return n.splice(t,1),$(e,Jz(e,n))}function XB(e){let t=RM(e),n=[];for(let e=0;e<t.length-1;e++)n.push([(t[e][0]+t[e+1][0])/2,(t[e][1]+t[e+1][1])/2]);return n}function ZB(e){let t=gR(e);return t.length===1&&qB(t[0])?t[0]:null}function QB(e){let t=RM(e),n=[];for(let e=1;e<t.length-2;e++)n.push({index:e,point:[(t[e][0]+t[e+1][0])/2,(t[e][1]+t[e+1][1])/2]});return n}function $B(e,t,n){let r=RM(e),i=+(r[t][1]===r[t+1][1]);r[t][i]=n[i],r[t+1][i]=n[i];let a=Jz(e,r),o=e=>[e[0]-a.x,e[1]-a.y],s=(e.fixedSegments??[]).filter(e=>e.index!==t+1);return $(e,{...a,fixedSegments:[...s,{index:t+1,start:o(r[t]),end:o(r[t+1])}].sort((e,t)=>e.index-t.index)})}function eV(e,t,n){let r=8/n,i=([e,n])=>Math.hypot(t[0]-e,t[1]-n)<=r,a=RM(e);for(let t=a.length-1;t>=0;t--)if((t===0||t===a.length-1||!e.elbowed)&&i(a[t]))return{kind:`point`,index:t};if(e.elbowed){for(let t of QB(e))if(i(t.point))return{kind:`segment`,index:t.index};return null}let o=XB(e);for(let e=0;e<o.length;e++)if(i(o[e]))return{kind:`midpoint`,index:e};return null}function tV(e,t,n){let{store:r}=e,i=r.getState(),a=ZB(i);if(!a)return null;let o=eV(a,t.scene,i.viewport.zoom);if(!o)return null;let s=a,c=o.kind===`point`?o.index:o.kind===`midpoint`?o.index+1:-1,l=c,u=!1,d=t.ctrlKey,f=t.screen,p=(e,t)=>a.type===`arrow`?e===0?`start`:e===t-1?`end`:null:null;return r.setState({selectedPointIndex:o.kind===`point`?o.index:null}),r.beginTransient(),{cancel(){r.setState({suggestedBindingId:null}),r.endTransient(!1),l=-1},move(t){if(!u&&Math.hypot(t.screen[0]-f[0],t.screen[1]-f[1])<2)return;u=!0;let i;i=o.kind===`segment`?$B(s,o.index,t.scene):o.kind===`midpoint`?Yz(JB(s,o.index,t.scene),c,t.scene):Yz(s,c,t.scene);let a=p(c,i.points.length);if(s.elbowed&&a){let e=a===`start`?`startBinding`:`endBinding`;i={...qz({...i,[e]:null},r.getState().elements),[e]:s[e]},l=a===`start`?0:i.points.length-1}n&&(i=n(e,i,l,t)),r.updateTransient(({elements:e})=>({elements:gL(e.map(e=>e.id===i.id?i:e),new Set([i.id]))})),d=t.ctrlKey;let m=p(l,i.points.length),{elements:h,viewport:g}=r.getState(),_=m&&!d?yB(h,i.id,t.scene,g.zoom):null;r.setState({selectedPointIndex:l>=0?l:null,suggestedBindingId:_?.id??null})},end(){let e=r.getState().elements.find(e=>e.id===a.id),t=e&&u?p(l,e.points.length):null;if(t){let e=r.getState().viewport.zoom;r.updateTransient(({elements:n})=>({elements:d?uB(n,a.id,t):bB(n,a.id,[t],e)}))}r.setState({suggestedBindingId:null}),r.endTransient(u),l=-1}}}var nV=1,rV=Math.PI/12;function iV(e){if(FM(e)){let[t,n,r,i]=AM(e.points.length?e.points:[[0,0]]);return[e.x+t,e.y+n,e.x+r,e.y+i]}return[e.x,e.y,e.x+e.width,e.y+e.height]}function aV(e){if(e.length===1){let t=e[0];return{box:iV(t),angle:PM(t),center:LM(t)}}let t=VM(e);return{box:t,angle:0,center:[(t[0]+t[2])/2,(t[1]+t[3])/2]}}function oV(e,t,n=0){let r=8/t,[i,a,o,s]=[e[0]-r,e[1]-r,e[2]+r,e[3]+r],c=(e[0]+e[2])/2,l=(e[1]+e[3])/2,u={nw:[i,a],n:[c,a],ne:[o,a],e:[o,l],se:[o,s],s:[c,s],sw:[i,s],w:[i,l],rotation:[c,a-24/t]};if(!n)return u;let d={};for(let[e,t]of Object.entries(u))d[e]=DM(t,[c,l],n);return d}function sV(e,t,n){let r=8/n;for(let[n,[i,a]]of Object.entries(e))if(Math.hypot(t[0]-i,t[1]-a)<=r)return n;return null}function cV(e,t,n,r){let[i,a,o,s]=e,[c,l]=n;if(t.includes(`e`)&&(o+=c),t.includes(`w`)&&(i+=c),t.includes(`s`)&&(s+=l),t.includes(`n`)&&(a+=l),r.fromCenter&&(t.includes(`e`)&&(i-=c),t.includes(`w`)&&(o-=c),t.includes(`s`)&&(a-=l),t.includes(`n`)&&(s-=l)),r.keepRatio){let n=e[2]-e[0]||1,c=e[3]-e[1]||1,l=t.includes(`e`)||t.includes(`w`),u=t.includes(`n`)||t.includes(`s`),d=(o-i)/n,f=(s-a)/c,p=l&&u?Math.abs(d)>Math.abs(f)?d:f:l?d:f,m=n*p,h=c*p,g=(e[0]+e[2])/2,_=(e[1]+e[3])/2;if(r.fromCenter)return[g-m/2,_-h/2,g+m/2,_+h/2];let v=t.includes(`w`)?e[2]:t.includes(`e`)?e[0]:g-m/2,y=t.includes(`n`)?e[3]:t.includes(`s`)?e[1]:_-h/2,b=t.includes(`w`)?v-m:v,x=t.includes(`n`)?y-h:y;return[b,x,b+m,x+h]}return[Math.min(i,o),Math.min(a,s),Math.max(i,o),Math.max(a,s)]}function lV(e,t,n,r){let[i,a,o,s]=t.box,c=(n[2]-n[0])/(o-i||1),l=(n[3]-n[1])/(s-a||1),u=iV(e),d=r?n:[n[0]+(u[0]-i)*c,n[1]+(u[1]-a)*l,n[0]+(u[2]-i)*c,n[1]+(u[3]-a)*l],f=Math.max(nV,d[2]-d[0]),p=Math.max(nV,d[3]-d[1]),m=[(d[0]+d[2])/2,(d[1]+d[3])/2],h=r?DM(m,t.center,t.angle):m,g={width:f,height:p};if(FM(e)){let t=e.points.length?e.points:[[0,0]],[n,r]=AM(t);g.points=t.map(([e,t])=>[n+(e-n)*c,r+(t-r)*l]),g.x=h[0]-f/2-n,g.y=h[1]-p/2-r}else g.x=h[0]-f/2,g.y=h[1]-p/2;return e.type===`text`&&(g.fontSize=e.fontSize*Math.min(c,l)),$(e,g)}function uV(e,t,n,r,i){if(e.length===0||t===`rotation`)return[...e];let a=aV(e),o=DM([r[0]-n[0],r[1]-n[1]],[0,0],-a.angle),s=i.keepRatio||e.every(e=>e.type===`text`||e.type===`svg`),c=cV(a.box,t,o,{...i,keepRatio:s}),l=e.length===1;return ZP(e.map(e=>lV(e,a,c,l)))}function dV(e){let t=Math.PI*2;return(e%t+t)%t}function fV(e,t,n,r){if(e.length===1){let t=e[0],i=dV(PM(t)+n);return r.snap&&(i=dV(Math.round(i/rV)*rV)),[$(t,{angle:i})]}let i=r.snap?Math.round(n/rV)*rV:n;return e.map(e=>{let n=LM(e),[r,a]=DM(n,t,i);return $(e,{x:e.x+r-n[0],y:e.y+a-n[1],angle:dV(PM(e)+i)})})}function pV(e,t,n,r){return e.map(e=>t.has(e.id)?$(e,{x:e.x+n,y:e.y+r}):e)}function mV(e){let t=gR(e).filter(e=>!(e.type===`text`&&e.containerId));if(t.length===0)return[];if(t.length===1){let[n]=t;if(n.locked||FM(n)&&n.type!==`freedraw`&&n.points.length<=2||n.type===`arrow`&&n.elbowed||e.editingLinearId===n.id)return[]}return t}function hV(e){let t=mV(e);if(t.length===0)return null;let n=aV(t);return oV(n.box,e.viewport.zoom,n.angle)}var gV=(e,t)=>Math.atan2(e[1]-t[1],e[0]-t[0]);function _V(e,t){let{store:n}=e,r=n.getState(),i=hV(r);if(!i)return null;let a=sV(i,t.scene,r.viewport.zoom);if(!a)return null;let o=mV(r),s=new Set(o.map(e=>e.id)),c=aV(o),l=t.scene,u=gV(l,c.center),d=!1;n.beginTransient();let f=e=>{let t=new Map(e.map(e=>[e.id,e]));n.updateTransient(({elements:e})=>({elements:aR(_B(gL(e.map(e=>s.has(e.id)?t.get(e.id):e),s),s),s)}))};return{move(e){if(d=!0,a===`rotation`){let t=gV(e.scene,c.center)-u;f(fV(o,c.center,t,{snap:e.shiftKey}))}else f(uV(o,a,l,kB(e.scene,DB(n,e)),{keepRatio:e.shiftKey,fromCenter:e.altKey}))},end(e){n.endTransient(e&&d)}}}function vV(e,t,n){return r=>r.map(r=>{let i=e.get(r.id);return i?$(i,{x:i.x+t,y:i.y+n}):r})}function yV(e={}){let t=`idle`,n=[0,0],r=!1,i=new Map,a=[0,0],o=new Set,s=null,c=null;return{onPointerDown(l,u){let{store:d}=l;if(c=tV(l,u,e.onPointMove),c){t=`point`;return}if(s=_V(l,u),s){t=`transform`;return}let f=d.getState(),p=pR(f,u.scene,6/f.viewport.zoom);if(n=u.scene,r=!1,!p){o=u.shiftKey?new Set(f.selectedIds):new Set,d.setState({selectedIds:o,editingGroupId:u.shiftKey?f.editingGroupId:null,selectedPointIndex:null}),t=`box`;return}let m=new Set(f.selectedIds);if(u.shiftKey){let e=p.ids.every(e=>m.has(e));for(let t of p.ids)e?m.delete(t):m.add(t)}else m.has(p.hitId)||(m=new Set(p.ids));if(d.setState({selectedIds:m,selectedPointIndex:null}),!m.has(p.hitId)){t=`idle`;return}let h=mR(f.elements,oR(f.elements,m));i=new Map(f.elements.filter(e=>h.has(e.id)).map(e=>[e.id,e]));let[g,_]=VM([...i.values()]);a=[g,_],t=`drag`,d.beginTransient()},onPointerMove(e,l){let{store:u}=e;if(t===`transform`){s?.move(l);return}if(t===`point`){c?.move(l);return}let d=l.scene[0]-n[0],f=l.scene[1]-n[1];if(t===`drag`){let e=u.getState().viewport.zoom;if(!r&&Math.hypot(d,f)*e<2)return;r=!0;let t=DB(u,l);t&&(d=OB(a[0]+d,t)-a[0],f=OB(a[1]+f,t)-a[1]);let n=vV(i,d,f),o=new Set(i.keys());u.updateTransient(({elements:e})=>({elements:aR(_B(n(e),o),o)}))}else if(t===`box`){let e=NM(n,l.scene),t=hR(u.getState(),e);u.setState({selectionBox:e,selectedIds:new Set([...o,...t])})}},onPointerUp(e){let{store:n}=e;t===`transform`&&s?.end(!0),t===`point`&&c?.end(),s=null,c=null,t===`drag`&&n.endTransient(r),t===`box`&&n.setState({selectionBox:null}),t=`idle`},cancel(e){let{store:n}=e;t===`transform`&&s?.end(!1),t===`point`&&c?.cancel(),t===`drag`&&n.endTransient(!1),t===`box`&&n.setState({selectionBox:null}),s=null,c=null,t=`idle`},onDoubleClick(e,t){let{store:n}=e,r=n.getState(),i=pR(r,t.scene,6/r.viewport.zoom);if(!i){n.setState({editingGroupId:null}),pL(n,{at:t.scene});return}let a=r.elements.find(e=>e.id===i.hitId);if(!a)return;if(a.type===`frame`||a.type===`magicframe`){n.setState({editingFrameId:a.id,selectedIds:new Set([a.id])});return}let o=a.groupIds??[],s=r.editingGroupId?o.indexOf(r.editingGroupId):o.length;if(o.length>0&&s>0){let e=o[s-1],t=s-1>0?o[s-2]:null,i=t?r.elements.filter(e=>e.groupIds?.includes(t)).map(e=>e.id):[a.id];n.setState({editingGroupId:e,selectedIds:new Set(i)})}else a.type===`richtext`?SB(n,a.id):a.type===`text`?pL(n,{elementId:a.id}):lL(a)&&pL(n,{containerId:a.id})}}}function bV(e,t,n,r){let i=t[0]-e[0],a=t[1]-e[1];if(n){let e=Math.max(Math.abs(i),Math.abs(a));i=Math.sign(i||1)*e,a=Math.sign(a||1)*e}return r?{x:e[0]-Math.abs(i),y:e[1]-Math.abs(a),width:Math.abs(i)*2,height:Math.abs(a)*2}:{x:Math.min(e[0],e[0]+i),y:Math.min(e[1],e[1]+a),width:Math.abs(i),height:Math.abs(a)}}function xV(e,t={}){let n=null,r=[0,0];return{onPointerDown(t,i){let{store:a}=t,o=a.getState().currentStyle;r=kB(i.scene,DB(a,i));let s={x:r[0],y:r[1],width:0,height:0},c=e===`frame`?PN(s,o):DN(e,s,o);n=c.id,a.beginTransient(),jB(a,c),a.setState({selectedIds:new Set})},onPointerMove(e,t){if(!n)return;let i=PB(e.store,n);if(!i)return;let a=kB(t.scene,DB(e.store,t));AB(e.store,{...i,...bV(r,a,t.shiftKey,t.altKey)})},onPointerUp(e){if(!n)return;let{store:r}=e,i=PB(r,n),a=r.getState().viewport.zoom,o=n;n=null,!i||Math.max(i.width,i.height)*a<2?NB(r):(MB(r,o),t.onCreated?.(e,i))},cancel(e){n&&(n=null,NB(e.store))}}}function SV(){let e=null;return{onPointerDown(t,n){e=n.scene},onPointerMove(){},onPointerUp(t){let n=e;if(e=null,!n)return;let{store:r}=t,i=r.getState(),a=fR(i.elements,n,6/i.viewport.zoom);i.toolLocked||r.setState({tool:`selection`}),a?.type===`text`?pL(r,{elementId:a.id}):a&&lL(a)&&a.type!==`arrow`?pL(r,{containerId:a.id}):pL(r,{at:n})},cancel(){e=null}}}function CV(){return{selection:yV(),hand:BB(),rectangle:xV(`rectangle`),diamond:xV(`diamond`),ellipse:xV(`ellipse`),frame:xV(`frame`),arrow:KB(`arrow`),line:KB(`line`),freedraw:zB(),eraser:RB(),text:SV(),card:FB(),image:VB()}}function wV(e,t){return e[t]??e.selection}var TV=16,EV=`data-whiteboard-chrome`;function DV(e){return e instanceof Element&&!!e.closest(`[data-whiteboard-chrome]`)}var OV=.01,kV=({children:e,context:t,handlers:n,onContextMenu:r,store:i,theme:a})=>{let o=(0,A.useRef)(null),s=(0,A.useRef)(null),c=(0,A.useRef)(!1),l=(0,A.useRef)(null),u=(0,A.useRef)(lz()),d=CL(i,e=>e.elements),f=CL(i,e=>e.files),p=CL(i,e=>e.viewport),m=CL(i,e=>e.editingTextId),h=CL(i,e=>e.editingRichTextId),g=CL(i,e=>e.erasingIds),_=CL(i,e=>e.tool),v=CL(i,e=>e.gridSize),y=(0,A.useRef)(_);(0,A.useEffect)(()=>{let e=y.current;if(y.current=_,e===_)return;let r=wV(n,e);r.cancel?.(t),s.current===r&&(s.current=null)},[t,n,_]);let b=(0,A.useMemo)(()=>({type:`excalidraw`,appState:{},elements:d,files:f}),[d,f]),x=(0,A.useMemo)(()=>m?new Set([m]):void 0,[m]),S=(0,A.useCallback)(e=>{if(e.id===h)return{className:Tz};if(g.has(e.id))return{opacity:.25};if(e.type===`image`&&e.status===`pending`)return{opacity:.5}},[g,h]),C=(0,A.useCallback)(e=>{let t=o.current.getBoundingClientRect(),n=[e.clientX-t.left,e.clientY-t.top];return{screen:n,scene:iz(n,i.getState().viewport),shiftKey:!!e.shiftKey,altKey:!!e.altKey,ctrlKey:!!(e.ctrlKey||e.metaKey),pressure:e.pressure??.5,pointerType:e.pointerType??`mouse`,pointerId:e.pointerId??1}},[i]),w=e=>{if(e.button===2||DV(e.target))return;if(o.current?.focus({preventScroll:!0}),e.currentTarget.setPointerCapture?.(e.pointerId),e.pointerType===`touch`){let n=u.current.down(e.pointerId,C(e).screen,i.getState().viewport);if(n===`pinch`&&(s.current?.cancel?.(t),s.current=null),n!==`single`)return}let r=e.button===1||c.current?n.hand:wV(n,i.getState().tool);s.current=r,r.onPointerDown(t,C(e))},T=e=>{if(e.pointerType===`touch`){let t=u.current,n=t.move(e.pointerId,C(e).screen);if(n&&i.setState({viewport:n}),t.isActive())return}let r=s.current??wV(n,i.getState().tool),a=C(e);l.current=a.scene,r.onPointerMove(t,a)},E=e=>{if(e.pointerType===`touch`){let t=u.current,n=t.isActive();if(t.up(e.pointerId),n)return}let n=s.current;s.current=null,n?.onPointerUp(t,C(e))};(0,A.useEffect)(()=>{let e=o.current;if(!e)return;let n=t=>{if(DV(t.target))return;t.preventDefault();let n=i.getState().viewport,r=e.getBoundingClientRect(),a=[t.clientX-r.left,t.clientY-r.top];if(t.ctrlKey||t.metaKey){i.setState({viewport:oz(n,a,n.zoom*Math.exp(-t.deltaY*OV))});return}let o=t.shiftKey&&!t.deltaX?t.deltaY:t.deltaX,s=t.shiftKey&&!t.deltaX?0:t.deltaY;i.setState({viewport:{...n,scrollX:n.scrollX-o/n.zoom,scrollY:n.scrollY-s/n.zoom}})},r=e=>{e.key===` `&&!(e.target instanceof HTMLTextAreaElement)&&(c.current=e.type===`keydown`)},a=()=>{let t=e.getBoundingClientRect();i.setState({canvasSize:{width:t.width,height:t.height}})};a();let s=typeof ResizeObserver>`u`?null:new ResizeObserver(a);s?.observe(e);let u=()=>{if(l.current)return l.current;let{viewport:e,canvasSize:t}=i.getState();return iz([t.width/2,t.height/2],e)},d=e=>{!e.clipboardData||i.getState().editingTextId||i.getState().editingRichTextId||i.getState().selectedIds.size===0||(e.preventDefault(),e.clipboardData.setData(`text/plain`,e.type===`cut`?zR(i):RR(i)))},f=e=>{let{editingRichTextId:n,editingTextId:r}=i.getState();if(!e.clipboardData||r||n)return;let a=[...e.clipboardData.files??[]].filter(e=>e.type.startsWith(`image/`));a.length>0&&t.onFiles?(e.preventDefault(),t.onFiles(a,u())):HR(i,e.clipboardData.getData(`text/plain`),u())&&e.preventDefault()};return e.addEventListener(`copy`,d),e.addEventListener(`cut`,d),e.addEventListener(`paste`,f),e.addEventListener(`wheel`,n,{passive:!1}),window.addEventListener(`keydown`,r),window.addEventListener(`keyup`,r),()=>{s?.disconnect(),e.removeEventListener(`copy`,d),e.removeEventListener(`cut`,d),e.removeEventListener(`paste`,f),e.removeEventListener(`wheel`,n),window.removeEventListener(`keydown`,r),window.removeEventListener(`keyup`,r)}},[t,i]);let D=(v??TV)*p.zoom,ee=a===`dark`;return(0,j.jsxs)(`div`,{"data-whiteboard-canvas":!0,className:$R,ref:o,tabIndex:0,style:{backgroundSize:`${D}px ${D}px`,backgroundPosition:`${p.scrollX*p.zoom}px ${p.scrollY*p.zoom}px`},onPointerCancel:E,onPointerDown:w,onPointerMove:T,onPointerUp:E,onContextMenu:e=>{DV(e.target)||r?.(C(e))&&e.preventDefault()},onDoubleClick:e=>{DV(e.target)||wV(n,i.getState().tool).onDoubleClick?.(t,C(e))},onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&e.preventDefault()},onDrop:e=>{let n=[...e.dataTransfer.files??[]].filter(e=>e.type.startsWith(`image/`));n.length!==0&&t.onFiles&&(e.preventDefault(),t.onFiles(n,C(e).scene))},children:[(0,j.jsx)(`svg`,{className:ez,style:ee?{filter:sI}:void 0,children:(0,j.jsx)(`g`,{transform:`scale(${p.zoom}) translate(${p.scrollX} ${p.scrollY})`,children:(0,j.jsx)(pI,{dark:ee,elementProps:S,files:f,hiddenIds:x,scene:b})})}),e]})},AV=8,jV=({at:e,items:t,onClose:n})=>{let r=(0,A.useRef)(null),[i,a]=(0,A.useState)(e);return(0,A.useLayoutEffect)(()=>{let t=r.current,n=t?.offsetParent;if(!t||!n)return;let i=n.getBoundingClientRect(),o=t.getBoundingClientRect();i.width&&i.height&&a([Math.max(AV,Math.min(e[0],i.width-o.width-AV)),Math.max(AV,Math.min(e[1],i.height-o.height-AV))])},[e]),(0,A.useEffect)(()=>{let e=r.current;e?.querySelector(`[role="menuitem"]:not([disabled])`)?.focus();let t=t=>{t.target instanceof Node&&e?.contains(t.target)||n()},i=e=>{e.key===`Escape`&&(e.stopPropagation(),e.preventDefault(),n())};return document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`wheel`,t,!0),document.addEventListener(`keydown`,i,!0),window.addEventListener(`blur`,n),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`wheel`,t,!0),document.removeEventListener(`keydown`,i,!0),window.removeEventListener(`blur`,n),window.removeEventListener(`resize`,n)}},[n]),(0,j.jsx)(`div`,{className:`${TL} ${kL}`,ref:r,role:`menu`,style:{left:i[0],top:i[1]},onContextMenu:e=>e.preventDefault(),onKeyDown:e=>{if(e.stopPropagation(),e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let t=[...e.currentTarget.querySelectorAll(`[role="menuitem"]:not([disabled])`)];t.length!==0&&t[(t.indexOf(document.activeElement)+(e.key===`ArrowDown`?1:-1)+t.length)%t.length].focus()},[EV]:``,children:t.map((e,t)=>UR(e)?(0,j.jsx)(`div`,{className:jL,role:`separator`},`separator-${t}`):(0,j.jsx)(`button`,{className:AL,"data-danger":e.danger||void 0,disabled:e.disabled,role:`menuitem`,type:`button`,onClick:()=>{n(),e.onSelect()},children:e.label},e.key))})};function MV(e,t,n){let[r,i]=(0,A.useState)(null),a=(0,A.useRef)(t);a.current=t;let o=(0,A.useRef)(n);o.current=n;let s=(0,A.useCallback)(t=>{let{editingRichTextId:n,editingTextId:r}=e.getState();if(r||n)return!1;let s=ZR(e,t.scene,a.current);return o.current?(o.current({items:s,scenePoint:t.scene,screenPoint:t.screen}),!0):(i({at:t.screen,items:s}),!0)},[e]),c=(0,A.useCallback)(()=>i(null),[]);return{open:s,menu:r?(0,j.jsx)(jV,{at:r.at,items:r.items,onClose:c}):null}}var NV=`gb4lm20`,PV=`gb4lm21`,FV=({frame:e,store:t})=>{let[n,r]=(0,A.useState)(e.name??``),i=(0,A.useRef)(null),a=CL(t,e=>e.viewport),[o,s]=az([e.x,e.y-20],a);(0,A.useEffect)(()=>{i.current?.focus(),i.current?.select()},[]);let c=(0,A.useRef)(!1),l=r=>{if(c.current||(c.current=!0,t.setState({editingFrameId:null}),!r))return;let i=n.trim()||null;i!==(e.name??null)&&t.commit(({elements:t})=>({elements:t.map(t=>t.id===e.id?$(t,{name:i}):t)}))};return(0,j.jsx)(`input`,{"data-frame-name-editor":!0,className:PV,ref:i,value:n,[EV]:``,style:{left:o,top:s,height:20*a.zoom},onBlur:()=>l(!0),onChange:e=>r(e.currentTarget.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&l(!0),e.key===`Escape`&&l(!1)}})},IV=({store:e})=>{let t=CL(e,e=>e.editingFrameId?e.elements.find(t=>t.id===e.editingFrameId):void 0);return!t||t.isDeleted?null:(0,j.jsx)(FV,{frame:t,store:e},t.id)},LV=({store:e,tools:t})=>(0,j.jsx)(`div`,{"data-mobile-dock":!0,"data-whiteboard-chrome":!0,className:`${TL} ${VL}`,children:(0,j.jsx)(JL,{showKeys:!1,store:e,tools:t})}),RV=({store:e})=>{let t=CL(e,e=>e);if(t.selectionBox||t.editingTextId||t.tool!==`selection`)return null;let n=ZB(t);if(!n)return null;let r=RM(n).map((e,n,r)=>({i:n,p:az(e,t.viewport),end:n===0||n===r.length-1})).filter(({end:e})=>e||!n.elbowed),i=n.elbowed?[]:XB(n).map(e=>az(e,t.viewport)),a=n.elbowed?QB(n).map(e=>({...e,point:az(e.point,t.viewport)})):[];return(0,j.jsxs)(`g`,{"data-linear-handles":!0,children:[i.map(([e,t],n)=>(0,j.jsx)(`circle`,{cx:e,cy:t,"data-midpoint":n,fill:tz,fillOpacity:.25,r:3.5},`m${n}`)),a.map(({index:e,point:[t,n]})=>(0,j.jsx)(`rect`,{"data-segment":e,fill:`#fff`,height:6,rx:3,stroke:tz,strokeWidth:1.5,width:12,x:t-6,y:n-3},`s${e}`)),r.map(({i:e,p:[n,r]})=>(0,j.jsx)(`circle`,{cx:n,cy:r,"data-point":e,fill:t.selectedPointIndex===e?tz:`#fff`,r:5,stroke:tz,strokeWidth:1.5},`p${e}`))]})},zV=4.5,BV=5,VV=({store:e})=>{let t=CL(e,e=>e);if(t.selectionBox||t.editingTextId)return null;let n=hV(t);return n?(0,j.jsx)(`g`,{"data-transform-handles":!0,children:Object.entries(n).map(([e,n])=>{let[r,i]=az(n,t.viewport);return(0,j.jsx)(`circle`,{cx:r,cy:i,"data-handle":e,fill:`#fff`,r:e===`rotation`?BV:zV,stroke:tz,strokeWidth:1.5},e)})}):null};function HV(e){if(FM(e)){let[t,n,r,i]=VM([e]);return[[t,n],[r,n],[r,i],[t,i]]}return zM(e)}var UV=e=>e.map(([e,t])=>`${e},${t}`).join(` `),WV=({store:e})=>{let t=CL(e,e=>e),{viewport:n,selectionBox:r}=t,i=gR(t).filter(e=>!(e.type===`text`&&e.containerId)),a=t.suggestedBindingId?t.elements.find(e=>e.id===t.suggestedBindingId&&!e.isDeleted):void 0,o=r?[az([r[0],r[1]],n),az([r[2],r[3]],n)]:null;return(0,j.jsxs)(`svg`,{"data-whiteboard-overlay":!0,className:ez,children:[a&&(0,j.jsx)(`polygon`,{"data-binding-highlight":a.id,fill:`none`,opacity:.6,points:UV(HV(a).map(e=>az(e,n))),stroke:`var(--rc-accent)`,strokeWidth:3}),i.length>1&&i.map(e=>(0,j.jsx)(`polygon`,{fill:`none`,opacity:.5,points:UV(HV(e).map(e=>az(e,n))),stroke:`var(--rc-accent)`,strokeWidth:1},e.id)),i.length===1&&(0,j.jsx)(`polygon`,{"data-selection-frame":!0,fill:`none`,points:UV(HV(i[0]).map(e=>az(e,n))),stroke:`var(--rc-accent)`,strokeWidth:1}),(0,j.jsx)(VV,{store:e}),(0,j.jsx)(RV,{store:e}),o&&(0,j.jsx)(`rect`,{"data-selection-box":!0,fill:`var(--rc-accent)`,fillOpacity:.08,height:o[1][1]-o[0][1],stroke:`var(--rc-accent)`,strokeWidth:1,width:o[1][0]-o[0][0],x:o[0][0],y:o[0][1]})]})},GV={direction:null,format:``,indent:0,version:1},KV=(e,t)=>({type:`text`,text:e,format:typeof t?.format==`number`?t.format:0,style:typeof t?.style==`string`?t.style:``,detail:0,mode:`normal`,version:1});function qV(e){switch(e.type){case`text`:return[KV(e.text??``,e)];case`linebreak`:case`tab`:return[{type:e.type,version:1}];case`link`:case`autolink`:return[{...GV,type:`link`,url:typeof e.url==`string`?e.url:``,rel:`noopener noreferrer`,target:`_blank`,title:null,children:(e.children??[]).flatMap(qV)}];default:{let t=yN(e);return t?[KV(t)]:[]}}}var JV=e=>({...GV,type:`paragraph`,textFormat:0,textStyle:``,children:e});function YV(e,t){let n=(e.children??[]).flatMap(e=>e.type===`list`?[XV(e)]:qV(e));return{...GV,type:`listitem`,value:t+1,checked:void 0,children:n}}function XV(e){let t=e.listType===`number`||e.listType===`check`?e.listType:`bullet`;return{...GV,type:`list`,listType:t,start:1,tag:t===`number`?`ol`:`ul`,children:(e.children??[]).map((e,t)=>YV(e.type===`listitem`?e:{type:`listitem`,children:[e]},t))}}function ZV(e){switch(e.type){case`paragraph`:return JV((e.children??[]).flatMap(qV));case`heading`:{let t=/^h[1-6]$/.test(e.tag??``)?e.tag:`h3`;return{...GV,type:`heading`,tag:t,children:(e.children??[]).flatMap(qV)}}case`quote`:return{...GV,type:`quote`,children:(e.children??[]).flatMap(qV)};case`list`:return XV(e);default:return JV(qV(e))}}function QV(e){let t=(bN(e).children??[]).map(ZV);return{root:{...GV,type:`root`,children:t.length>0?t:[JV([])]}}}var $V=[`#1e1e1e`,`#868e96`,`#e03131`,`#2f9e44`,`#1971c2`,`#f08c00`],eH=[{format:`bold`,icon:On,label:`Bold`},{format:`italic`,icon:An,label:`Italic`},{format:`strikethrough`,icon:Kr,label:`Strikethrough`},{format:`code`,icon:Wt,label:`Inline code`},{format:`highlight`,icon:Er,label:`Highlight`}],tH={discrete:!0},nH=e=>e.preventDefault();function rH(){let e=J();return q(e)?e.anchor.getNode().getTopLevelElement():null}function iH(e){e.update(()=>{let e=J();if(!q(e))return;let t=Jx(rH());Jy(e,()=>t?z():qx(`h3`))},tH)}function aH(e,t){e.getEditorState().read(()=>X(rH()))?e.dispatchCommand(rw,void 0):e.dispatchCommand(t?nw:tw,void 0)}function oH(e){return e.getEditorState().read(()=>{let e=J();return q(e)?e.getNodes().some(e=>IS(e)||IS(e.getParent())):!1})}function sH(e){let t=e.trim();return t?/^(?:https?:|mailto:)/i.test(t)?t:/^[a-z][\w+.-]*:/i.test(t)?null:`https://${t}`:null}var cH=({at:e,host:t})=>{let[n]=ma(),[r,i]=(0,A.useState)(!1),[a,o]=(0,A.useState)(!1);if((0,A.useEffect)(()=>n.registerUpdateListener(({editorState:e})=>{e.read(()=>{let e=J();i(q(e)&&!e.isCollapsed())})}),[n]),!t||!r&&!a)return null;let s=(e,t,n)=>(0,j.jsx)(Nw,{icon:!0,"aria-label":e,size:`sm`,title:e,variant:`ghost`,onClick:n,onMouseDown:nH,children:(0,j.jsx)(t,{size:15})},e);return(0,li.createPortal)((0,j.jsx)(`div`,{"data-richtext-format-bar":!0,className:`${TL} ${WL}`,style:{left:e[0],top:e[1]},onPointerDown:e=>e.stopPropagation(),children:a?(0,j.jsx)(`input`,{autoFocus:!0,"aria-label":`Link URL`,className:KL,placeholder:`https://`,onBlur:()=>o(!1),onKeyDown:e=>{if(e.stopPropagation(),e.key===`Escape`&&o(!1),e.key!==`Enter`)return;let t=sH(e.currentTarget.value);o(!1),t&&n.dispatchCommand(VS,t),n.focus()}}):(0,j.jsxs)(j.Fragment,{children:[eH.map(({format:e,icon:t,label:r})=>s(r,t,()=>n.dispatchCommand(uo,e))),$V.map(e=>(0,j.jsx)(`button`,{"aria-label":`Text colour ${e}`,className:GL,"data-richtext-color":e,style:{background:e},type:`button`,onMouseDown:nH,onClick:()=>n.update(()=>{let t=J();q(t)&&Uy(t,{color:e})},tH)},e)),s(`Heading`,Or,()=>iH(n)),s(`Bulleted list`,wn,()=>aH(n,!1)),s(`Numbered list`,Ar,()=>aH(n,!0)),s(`Link`,re,()=>{oH(n)?n.dispatchCommand(VS,null):o(!0)})]})}),t)},lH={paragraph:fz,heading:{h1:pz,h2:mz,h3:hz,h4:gz,h5:gz,h6:gz},quote:_z,list:{ul:vz,ol:vz,listitem:yz,nested:{listitem:bz}},link:wz,text:{underline:xz,strikethrough:Sz,underlineStrikethrough:Cz}},uH=440,dH=8,fH=(e,t,n)=>Math.min(Math.max(e,t),n);function pH(e,t,n){let r=Math.max(dH,n.width-uH-dH),i=Math.max(44,n.height-dH);return[fH(e,dH,r),fH(t-dH,44,i)]}var mH=[Ux,zx,FC,BC,kS],hH=({onReady:e})=>{let[t]=ma();return(0,A.useEffect)(()=>{e(t),t.focus()},[t,e]),null},gH=({dark:e,el:t,store:n})=>{let r=CL(n,e=>e.viewport),i=CL(n,e=>e.canvasSize),a=(0,A.use)($P),o=(0,A.useRef)(null),[s,c]=(0,A.useState)(null),l=(0,A.useRef)(null),u=t.id,d=(0,A.useMemo)(()=>({namespace:`whiteboard-card`,nodes:mH,theme:lH,editorState:JSON.stringify(QV(t.content)),onError:e=>{throw e}}),[u]);(0,A.useEffect)(()=>()=>{let e=o.current;if(!e)return;let t=JSON.stringify(e.getEditorState().toJSON());t!==l.current&&wB(n,u,JSON.parse(t))},[u,n]);let f=(0,A.useCallback)(e=>{o.current=e,l.current??=JSON.stringify(e.getEditorState().toJSON())},[]),[p,m]=az([t.x,t.y],r),h=PM(t),g=h?` translate(${t.width/2}px, ${t.height/2}px) rotate(${h}rad) translate(${-t.width/2}px, ${-t.height/2}px)`:``;return(0,j.jsx)(`div`,{className:uz,"data-whiteboard-richtext-editor":u,ref:e=>c(e?.parentElement??null),style:{...fF,fontFamily:a&&nN(t.fontFamily)?a:rN(t.fontFamily),left:p,top:m,width:t.width,minHeight:t.height,padding:12,opacity:t.opacity/100,transform:`scale(${r.zoom})${g}`,filter:e?sI:void 0},onPointerDown:e=>e.stopPropagation(),onBlur:e=>{let t=e.relatedTarget;e.currentTarget.contains(t)||t?.closest(`[data-richtext-format-bar]`)||CB(n)},onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&(e.preventDefault(),CB(n))},children:(0,j.jsxs)(mA,{initialConfig:d,children:[(0,j.jsx)(_S,{ErrorBoundary:Mv,contentEditable:(0,j.jsx)(Ov,{className:dz})}),(0,j.jsx)(xA,{}),(0,j.jsx)(sw,{}),(0,j.jsx)(ow,{}),(0,j.jsx)(hH,{onReady:f}),(0,j.jsx)(cH,{at:pH(p,m,i),host:s})]})})},_H=({dark:e=!1,store:t})=>{let n=CL(t,e=>e.editingRichTextId?e.elements.find(t=>t.id===e.editingRichTextId&&t.type===`richtext`):void 0);return n?(0,j.jsx)(gH,{dark:e,el:n,store:t},n.id):null},vH={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]},yH={v:`selection`,h:`hand`,r:`rectangle`,d:`diamond`,o:`ellipse`,a:`arrow`,l:`line`,p:`freedraw`,t:`text`,i:`image`,f:`frame`,e:`eraser`,n:`card`},bH=1.2;function xH(e,t){let{viewport:n,canvasSize:r}=e.getState(),i=[r.width/2,r.height/2];e.setState({viewport:oz(n,i,n.zoom*t)})}function SH(e){let{viewport:t,canvasSize:n}=e.getState();e.setState({viewport:oz(t,[n.width/2,n.height/2],1)})}function CH(e){let{elements:t,canvasSize:n}=e.getState(),r=t.filter(e=>!e.isDeleted);r.length!==0&&n.width!==0&&e.setState({viewport:sz(VM(r),n)})}function wH(e,t){let n=t.key.toLowerCase();return n===`z`?(t.shiftKey?e.redo():e.undo(),!0):n===`y`?(e.redo(),!0):n===`g`?(t.shiftKey?TR(e):wR(e),!0):n===`d`?(ER(e),!0):n===`a`?(kR(e),!0):t.key===`]`||t.key===`}`?(t.shiftKey?bR(e):SR(e),!0):t.key===`[`||t.key===`{`?(t.shiftKey?xR(e):CR(e),!0):t.key===`=`||t.key===`+`?(xH(e,bH),!0):t.key===`-`?(xH(e,1/bH),!0):t.key===`0`?(SH(e),!0):t.key===`'`&&(e.setState({gridSize:e.getState().gridSize?null:20}),!0)}function TH(e,t,n){let r=e.getState();if(r.editingTextId||r.editingRichTextId)return!1;if(t.ctrlKey||t.metaKey)return wH(e,t);let i=vH[t.key];if(i&&r.selectedIds.size>0){let n=t.shiftKey?10:1,a=mR(r.elements,oR(r.elements,r.selectedIds));return e.commit(({elements:e})=>({elements:aR(_B(pV(e,a,i[0]*n,i[1]*n),a),a)})),!0}if(t.key===`Delete`||t.key===`Backspace`){let t=ZB(r);if(t&&r.selectedPointIndex!==null&&t.points.length>2){let n=r.selectedPointIndex;return e.commit(({elements:e})=>({elements:e.map(e=>e.id===t.id?YB(t,n):e)})),e.setState({selectedPointIndex:null}),!0}return OR(e),!0}if(t.key===`Escape`)return e.setState({selectedIds:new Set,editingGroupId:null,editingLinearId:null,selectedPointIndex:null,tool:r.toolLocked?r.tool:`selection`}),!0;if(t.key===`Enter`&&r.selectedIds.size===1){let[t]=r.selectedIds;if(r.elements.find(e=>e.id===t)?.type===`richtext`)return SB(e,t),!0}if(t.key===`!`||t.shiftKey&&t.key===`1`)return CH(e),!0;if(t.key.toLowerCase()===`q`)return e.setState({toolLocked:!r.toolLocked}),!0;let a=!t.altKey&&!t.shiftKey?yH[t.key.toLowerCase()]:void 0;return a&&n&&!n.has(a)?!1:a?(e.setState({tool:a,selectedIds:a===`selection`?r.selectedIds:new Set}),!0):!1}var EH=[`#1e1e1e`,`#e03131`,`#2f9e44`,`#1971c2`,`#f08c00`],DH=[`transparent`,`#ffc9c9`,`#b2f2bb`,`#a5d8ff`,`#ffec99`],OH=[{value:`hachure`,label:`Hachure`,icon:Br},{value:`cross-hatch`,label:`Cross-hatch`,icon:wr},{value:`solid`,label:`Solid`,icon:Rn}],kH=[{value:1,label:`Thin`,icon:le},{value:2,label:`Bold`,icon:vr},{value:4,label:`Extra bold`,icon:Mr}],AH=[{value:`solid`,label:`Solid`,icon:le},{value:`dashed`,label:`Dashed`,icon:br},{value:`dotted`,label:`Dotted`,icon:Ht}],jH=[{value:0,label:`Architect`,icon:Fn},{value:1,label:`Artist`,icon:Hr},{value:2,label:`Cartoonist`,icon:ur}],MH=[{value:`sharp`,label:`Sharp`,icon:Rn},{value:`round`,label:`Round`,icon:Wr}],NH=[{value:!1,label:`None`},{value:!0,label:`Soft`}],PH=[{value:16,label:`S`},{value:20,label:`M`},{value:28,label:`L`},{value:36,label:`XL`}],FH=[{value:5,label:`Hand`},{value:2,label:`Sans`},{value:3,label:`Mono`}],IH=[{value:`left`,label:`Left`,icon:jn},{value:`center`,label:`Center`,icon:kn},{value:`right`,label:`Right`,icon:Dn}],LH=[{value:null,label:`None`,icon:le},{value:`arrow`,label:`Arrow`,icon:Pr},{value:`triangle`,label:`Triangle`,icon:Br},{value:`dot`,label:`Dot`,icon:gr},{value:`bar`,label:`Bar`,icon:Mr}],RH=[{value:`sharp`,label:`Sharp`,icon:Br},{value:`round`,label:`Curved`,icon:Hr},{value:`elbow`,label:`Elbow`,icon:Xr}],zH=[`stroke`,`background`,`fillStyle`,`strokeWidth`,`strokeStyle`,`roughness`],BH=[`stroke`,`fontSize`,`fontFamily`,`textAlign`],VH=[`opacity`,`layers`,`actions`];function HH(e){let t=e.boundElements?.some(e=>e.type===`text`)?BH:[];switch(e.type){case`rectangle`:case`diamond`:return[...zH,`roundness`,`shadow`,...t];case`ellipse`:return[...zH,`shadow`,...t];case`arrow`:return[`stroke`,`strokeWidth`,`strokeStyle`,`roughness`,`arrowheads`,`arrowType`,...t];case`line`:return[`stroke`,`background`,`fillStyle`,`strokeWidth`,`strokeStyle`,`roughness`,`roundness`];case`freedraw`:return[`stroke`,`strokeWidth`];case`text`:return BH;case`richtext`:return[`stroke`,`background`,`strokeWidth`,`roundness`,`shadow`,`fontFamily`];case`image`:case`svg`:return[`shadow`];default:return[]}}function UH(e){if(e.length===0)return new Set;let t=new Set(HH(e[0]));for(let n of e.slice(1)){let e=new Set(HH(n));t=new Set([...t].filter(t=>e.has(t)))}for(let e of VH)t.add(e);return t}function WH(e,t){if(t===`roundness`)return e.roundness?`round`:`sharp`;if(t===`shadow`)return e.shadow===!0;if(t===`fontFamily`&&e.type===`richtext`)return e.fontFamily??5;if(t===`arrowType`){let t=e;return t.elbowed?`elbow`:t.roundness?`round`:`sharp`}return e[t]}function GH(e,t){if(e.length===0)return;let n=WH(e[0],t);return e.every(e=>WH(e,t)===n)?n:`mixed`}var KH=e=>e.type===`text`,qH=e=>e.type===`arrow`;function JH(e,t){let n={},r=new Set([...HH(e),...KH(e)?BH:[]]);if(t.strokeColor!==void 0&&r.has(`stroke`)&&(n.strokeColor=t.strokeColor),t.backgroundColor!==void 0&&r.has(`background`)&&(n.backgroundColor=t.backgroundColor),t.fillStyle!==void 0&&r.has(`fillStyle`)&&(n.fillStyle=t.fillStyle),t.strokeWidth!==void 0&&r.has(`strokeWidth`)&&(n.strokeWidth=t.strokeWidth),t.strokeStyle!==void 0&&r.has(`strokeStyle`)&&(n.strokeStyle=t.strokeStyle),t.roughness!==void 0&&r.has(`roughness`)&&(n.roughness=t.roughness),t.opacity!==void 0&&(n.opacity=t.opacity),t.shadow!==void 0&&r.has(`shadow`)&&(n.shadow=t.shadow),t.roundness!==void 0&&r.has(`roundness`)){let r=e.type===`line`?{type:2}:{type:3};n.roundness=t.roundness===`round`?r:null}if(KH(e)?(t.fontSize!==void 0&&(n.fontSize=t.fontSize),t.fontFamily!==void 0&&(n.fontFamily=t.fontFamily),t.textAlign!==void 0&&!e.containerId&&(n.textAlign=t.textAlign)):e.type===`richtext`&&t.fontFamily!==void 0&&(n.fontFamily=t.fontFamily),qH(e)&&(t.startArrowhead!==void 0&&(n.startArrowhead=t.startArrowhead),t.endArrowhead!==void 0&&(n.endArrowhead=t.endArrowhead),t.arrowType!==void 0&&(n.elbowed=t.arrowType===`elbow`,n.roundness=t.arrowType===`round`?{type:2}:null,!n.elbowed&&e.fixedSegments&&(n.fixedSegments=null))),Object.keys(n).length===0)return e;let i=$(e,n);return KH(i)&&!i.containerId?EP(i):i}function YH(e,t){let n=e.getState();if(e.setState({currentStyle:{...n.currentStyle,...t}}),n.selectedIds.size===0)return;let r=mR(n.elements,n.selectedIds);e.commit(({elements:e})=>{let i=e.map(e=>r.has(e.id)?JH(e,t):e);return{elements:gL(i.map((t,n)=>t.type===`arrow`&&t.elbowed&&!e[n].elbowed?qz(t,i):t),n.selectedIds)}})}function XH(e){let t=gR(e).filter(e=>!(e.type===`text`&&e.containerId));if(t.length>0)return t;switch(e.tool){case`rectangle`:case`diamond`:case`ellipse`:return[DN(e.tool,{},e.currentStyle)];case`arrow`:case`line`:case`freedraw`:return e.tool===`freedraw`?[{...DN(`rectangle`,{}),type:`freedraw`}]:[ON(e.tool,{},e.currentStyle)];case`text`:return[AN({text:``},e.currentStyle)];default:return[]}}var ZH=({children:e,label:t,name:n})=>(0,j.jsxs)(`div`,{className:NL,"data-style-row":n??``,children:[(0,j.jsx)(`span`,{className:PL,children:t}),e]});function QH({choices:e,current:t,onPick:n}){let r=e.map(e=>({value:String(e.value),label:e.icon?(0,j.jsx)(e.icon,{"aria-label":e.label,size:15}):e.label}));return(0,j.jsx)(uD,{fullWidth:!0,items:r,size:`sm`,value:String(t),onChange:t=>{let r=e.find(e=>String(e.value)===t);r&&n(r.value)}})}function $H(e){let t=CL(e,e=>e);if(t.editingTextId||t.selectionBox)return null;let n=XH(t);if(n.length===0)return null;let r=UH(n),i=t.selectedIds.size>0,a=e=>GH(n,e),o=t=>YH(e,t),s=(e,t)=>(0,j.jsx)(`div`,{className:FL,children:t.map(t=>(0,j.jsx)(`button`,{"aria-label":t,"aria-pressed":a(e)===t,className:`${IL}${t===`transparent`?` ${LL}`:``}`,"data-swatch":`${e}:${t}`,style:t===`transparent`?void 0:{background:t},type:`button`,onClick:()=>o({[e]:t})},t))}),c=(t,n,r)=>(0,j.jsx)(Nw,{icon:!0,"aria-label":t,size:`sm`,title:t,variant:`ghost`,onClick:()=>r(e),children:n},t),l=n.some(e=>(e.groupIds??[]).length>0),u=(0,j.jsxs)(j.Fragment,{children:[r.has(`stroke`)&&(0,j.jsx)(ZH,{label:`Stroke`,children:s(`strokeColor`,EH)}),r.has(`background`)&&(0,j.jsx)(ZH,{label:`Background`,children:s(`backgroundColor`,DH)}),r.has(`fillStyle`)&&(0,j.jsx)(ZH,{label:`Fill`,children:(0,j.jsx)(QH,{choices:OH,current:a(`fillStyle`),onPick:e=>o({fillStyle:e})})}),r.has(`strokeWidth`)&&(0,j.jsx)(ZH,{label:`Stroke width`,children:(0,j.jsx)(QH,{choices:kH,current:a(`strokeWidth`),onPick:e=>o({strokeWidth:e})})}),r.has(`strokeStyle`)&&(0,j.jsx)(ZH,{label:`Stroke style`,children:(0,j.jsx)(QH,{choices:AH,current:a(`strokeStyle`),onPick:e=>o({strokeStyle:e})})}),r.has(`roughness`)&&(0,j.jsx)(ZH,{label:`Sloppiness`,children:(0,j.jsx)(QH,{choices:jH,current:a(`roughness`),onPick:e=>o({roughness:e})})}),r.has(`roundness`)&&(0,j.jsx)(ZH,{label:`Edges`,children:(0,j.jsx)(QH,{choices:MH,current:a(`roundness`),onPick:e=>o({roundness:e})})}),r.has(`shadow`)&&(0,j.jsx)(ZH,{label:`Shadow`,name:`shadow`,children:(0,j.jsx)(QH,{choices:NH,current:a(`shadow`),onPick:e=>o({shadow:e})})}),r.has(`arrowType`)&&(0,j.jsx)(ZH,{label:`Arrow type`,children:(0,j.jsx)(QH,{choices:RH,current:a(`arrowType`),onPick:e=>o({arrowType:e})})}),r.has(`arrowheads`)&&(0,j.jsxs)(ZH,{label:`Arrowheads`,children:[(0,j.jsx)(QH,{choices:LH,current:a(`startArrowhead`),onPick:e=>o({startArrowhead:e})}),(0,j.jsx)(QH,{choices:LH,current:a(`endArrowhead`),onPick:e=>o({endArrowhead:e})})]}),r.has(`fontSize`)&&(0,j.jsx)(ZH,{label:`Font size`,children:(0,j.jsx)(QH,{choices:PH,current:a(`fontSize`),onPick:e=>o({fontSize:e})})}),r.has(`fontFamily`)&&(0,j.jsx)(ZH,{label:`Font`,children:(0,j.jsx)(QH,{choices:FH,current:a(`fontFamily`),onPick:e=>o({fontFamily:e})})}),r.has(`textAlign`)&&(0,j.jsx)(ZH,{label:`Align`,children:(0,j.jsx)(QH,{choices:IH,current:a(`textAlign`),onPick:e=>o({textAlign:e})})}),(0,j.jsx)(ZH,{label:`Opacity`,children:(0,j.jsx)(`input`,{"aria-label":`Opacity`,className:RL,max:100,min:0,step:10,type:`range`,value:typeof a(`opacity`)==`number`?a(`opacity`):100,onChange:e=>o({opacity:Number(e.target.value)})})}),i&&(0,j.jsx)(ZH,{label:`Layers`,children:(0,j.jsxs)(`div`,{className:`_14kbw0vc`,children:[c(`Send to back`,(0,j.jsx)(fr,{}),xR),c(`Send backward`,(0,j.jsx)(Tt,{}),CR),c(`Bring forward`,(0,j.jsx)(Mt,{}),SR),c(`Bring to front`,(0,j.jsx)(mr,{}),bR)]})}),i&&(0,j.jsx)(ZH,{label:`Actions`,children:(0,j.jsxs)(`div`,{className:`_14kbw0vc`,children:[c(`Duplicate`,(0,j.jsx)(Kt,{}),ER),n.length>1&&c(`Group`,(0,j.jsx)(Sr,{}),wR),l&&c(`Ungroup`,(0,j.jsx)(Jr,{}),TR),c(`Delete`,(0,j.jsx)(Vt,{}),OR)]})})]});return A.Children.toArray(u.props.children)}var eU=({store:e})=>{let t=$H(e);return t?(0,j.jsx)(`div`,{"data-style-panel":!0,"data-whiteboard-chrome":!0,className:`${TL} ${ML}`,children:t}):null},tU=({store:e})=>{let t=$H(e),n=CL(e,e=>e.selectedIds.size>0),[r,i]=(0,A.useState)(!1);if(!t||!n)return null;let a=r?t:t.slice(0,4);return(0,j.jsxs)(`div`,{"data-style-sheet":!0,"data-whiteboard-chrome":!0,className:HL,children:[(0,j.jsx)(`div`,{className:UL}),a,t.length>4&&(0,j.jsx)(`button`,{"data-style-more":!0,className:`_14kbw0vm`,type:`button`,onClick:()=>i(e=>!e),children:r?`Fewer options`:`More styles and actions`})]})},nU=24,rU=({dark:e=!1,store:t})=>{let n=CL(t,e=>e.editingTextId),r=CL(t,e=>e.editingTextId?e.elements.find(t=>t.id===e.editingTextId):void 0),i=CL(t,e=>e.viewport),a=(0,A.useRef)(null);(0,A.useEffect)(()=>{let e=a.current;e&&(e.focus({preventScroll:!0}),e.setSelectionRange(e.value.length,e.value.length))},[n]);let o=(0,A.use)($P);if(!n||!r)return null;let[s,c]=az([r.x,r.y],i),l=i.zoom,u=r.lineHeight??WN(r.fontFamily);return(0,j.jsx)(`textarea`,{"data-whiteboard-text-editor":!0,className:NV,ref:a,spellCheck:!1,value:r.originalText??r.text,wrap:r.containerId?`soft`:`off`,style:{left:s,top:c,width:Math.max(nU,r.width)*l,height:Math.max(r.height,r.fontSize*u)*l,fontSize:r.fontSize*l,lineHeight:u,fontFamily:o&&nN(r.fontFamily)?o:rN(r.fontFamily),color:r.strokeColor,textAlign:r.textAlign,opacity:r.opacity/100,transform:PM(r)?`rotate(${PM(r)}rad)`:void 0,filter:e?sI:void 0},onBlur:()=>hL(t),onChange:e=>mL(t,e.target.value),onPointerDown:e=>e.stopPropagation(),onKeyDown:e=>{e.stopPropagation(),(e.key===`Escape`||e.key===`Enter`&&(e.metaKey||e.ctrlKey))&&(e.preventDefault(),hL(t))}})},iU=({compact:e=!1,store:t})=>{let n=CL(t,e=>e.viewport.zoom);return CL(t,e=>e.elements),(0,j.jsxs)(`div`,{"data-whiteboard-chrome":!0,className:`${TL} ${zL}${e?` ${BL}`:``}`,children:[(0,j.jsx)(Nw,{icon:!0,"aria-label":`Undo`,disabled:!t.canUndo(),size:`sm`,variant:`ghost`,onClick:()=>t.undo(),children:(0,j.jsx)(Bn,{})}),(0,j.jsx)(Nw,{icon:!0,"aria-label":`Redo`,disabled:!t.canRedo(),size:`sm`,variant:`ghost`,onClick:()=>t.redo(),children:(0,j.jsx)(Pn,{})}),!e&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{className:`_14kbw0v5`}),(0,j.jsx)(Nw,{icon:!0,"aria-label":`Zoom out`,size:`sm`,variant:`ghost`,onClick:()=>xH(t,1/1.2),children:(0,j.jsx)(le,{})}),(0,j.jsxs)(`button`,{"aria-label":`Reset zoom`,className:`_14kbw0vh`,type:`button`,onClick:()=>SH(t),children:[Math.round(n*100),`%`]}),(0,j.jsx)(Nw,{icon:!0,"aria-label":`Zoom in`,size:`sm`,variant:`ghost`,onClick:()=>xH(t,1.2),children:(0,j.jsx)(Vn,{})})]})]})},aU=20,oU=new Set([`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`]);function sU(e){return e instanceof Element&&(e.matches(`input, textarea, select`)||e.isContentEditable)}var cU=({chrome:e={},contextMenuItems:t,handFontOverride:n,initialFit:r=!0,onContextMenu:i,store:a,theme:o,toolbar:s=`inline`,tools:c,uploadFile:l,onUploadError:u})=>{let d=(0,A.useMemo)(()=>c?new Set(c):void 0,[c]),f=(0,A.useMemo)(CV,[]),p=(0,A.useRef)(null),m=(0,A.useRef)(null),h=(0,A.useRef)({});h.current={uploadFile:l,onUploadError:u};let g=(0,A.useMemo)(()=>({store:a,onFiles:(e,t)=>{e.forEach((e,n)=>{let r=n*aU;LR(a,e,[t[0]+r,t[1]+r],h.current)})},requestImage:e=>{m.current=e,p.current?.click()}}),[a]),_=MV(a,t,i),v=CL(a,e=>e.tool),y=wL(a),b=CL(a,e=>e.canvasSize.width),x=(0,A.useRef)(!1);return(0,A.useEffect)(()=>{if(x.current||b<=0||(x.current=!0,!r))return;let{elements:e,canvasSize:t}=a.getState(),n=e.filter(e=>!e.isDeleted);n.length!==0&&a.setState({viewport:sz(VM(n),t)})},[b,r,a]),(0,A.useEffect)(()=>{if(v!==`image`)return;let{viewport:e,canvasSize:t,toolLocked:n}=a.getState();g.requestImage?.(iz([t.width/2,t.height/2],e)),n||a.setState({tool:`selection`})},[g,a,v]),(0,j.jsx)($P,{value:n??null,children:(0,j.jsxs)(`div`,{"data-whiteboard-editor":!0,className:QR,onKeyDown:e=>{sU(e.target)||(e.target instanceof Element&&e.target.hasAttribute(`data-whiteboard-canvas`)||!oU.has(e.key))&&(wV(f,a.getState().tool).onKeyDown?.(g,e.nativeEvent)||TH(a,e,d))&&e.preventDefault()},children:[s===`inline`&&e.toolbar!==!1&&!y&&(0,j.jsx)(`div`,{className:`_14kbw0v2`,children:(0,j.jsx)(JL,{store:a,tools:d})}),(0,j.jsxs)(kV,{context:g,handlers:f,store:a,theme:o,onContextMenu:e.contextMenu===!1?void 0:_.open,children:[(0,j.jsx)(WV,{store:a}),(0,j.jsx)(rU,{dark:o===`dark`,store:a}),(0,j.jsx)(_H,{dark:o===`dark`,store:a}),(0,j.jsx)(IV,{store:a}),e.stylePanel!==!1&&(y?(0,j.jsx)(tU,{store:a}):(0,j.jsx)(eU,{store:a})),e.zoom!==!1&&(0,j.jsx)(iU,{compact:y,store:a}),_.menu,y&&e.mobileDock!==!1&&(0,j.jsx)(LV,{store:a,tools:d})]}),(0,j.jsx)(`input`,{hidden:!0,multiple:!0,accept:`image/*`,ref:p,type:`file`,onChange:e=>{let t=[...e.currentTarget.files??[]];e.currentTarget.value=``,t.length>0&&m.current&&g.onFiles?.(t,m.current)}})]})})};export{dk as $,$s as $i,fc as $n,xo as $r,nw as $t,ZP as A,cf as Aa,v_ as Ai,yb as An,tm as Ar,oE as At,zD as B,pa as Ba,po as Bi,Jy as Bn,wu as Br,pT as Bt,$N as C,ao as Ca,co as Ci,qx as Cn,z_ as Cr,nA as Ct,pP as D,ec as Da,ru as Di,Jb as Dn,B_ as Dr,iA as Dt,PP as E,W as Ea,uv as Ei,Tx as En,Lo as Er,rA as Et,mA as F,sm as Fa,uo as Fi,ab as Fn,Zp as Fr,fO as Ft,UD as G,Sr as Ga,Sf as Gi,Ov as Gn,Eu as Gr,gw as Gt,GD as H,Ir as Ha,L as Hi,gy as Hn,Hm as Hr,SO as Ht,Nw as I,Yh as Ia,Bp as Ii,xb as In,Pg as Ir,pE as It,pk as J,Yp as Ji,Iu as Jn,cg as Jr,_w as Jt,UO as K,Ho as Ki,vv as Kn,No as Kr,vw as Kt,Gw as L,Ro as La,nc as Li,ib as Ln,Eo as Lr,WT as Lt,aP as M,Do as Ma,Ql as Mi,fb as Mn,Rg as Mr,cE as Mt,gI as N,ic as Na,mm as Ni,db as Nn,R as Nr,uA as Nt,sN as O,lo as Oa,ed as Oi,Xb as On,gf as Or,lA as Ot,xA as P,za as Pa,Bf as Pi,hb as Pn,jo as Pr,mT as Pt,ok as Q,Im as Qi,$p as Qn,hu as Qr,tw as Qt,hT as R,ma as Ra,mo as Ri,Uy as Rn,em as Rr,dO as Rt,VM as S,Qs as Sa,ls as Si,Lx as Sn,Fs as Sr,uD as St,AN as T,wa as Ta,Co as Ti,Sx as Tn,_f as Tr,oA as Tt,BD as U,Ar as Ua,io as Ui,Iv as Un,op as Ur,CO as Ut,HD as V,Kr as Va,Rf as Vi,Fy as Vn,Ao as Vr,oO as Vt,WD as W,Er as Wa,$h as Wi,Mv as Wn,Ns as Wr,dA as Wt,ak as X,cc as Xi,Uo as Xn,Mf as Xr,sw as Xt,ik as Y,Mg as Yi,Ad as Yn,ev as Yr,cw as Yt,sk as Z,wo as Zi,th as Zn,Y as Zr,ow as Zt,mI as _,Of as _a,Fd as _i,_S as _n,Du as _r,AT as _t,dB as a,jm as aa,Lu as ai,RC as an,Ag as ar,hk as at,$ as b,Zs as ba,od as bi,Ux as bn,jf as br,DT as bt,UH as c,Ys as ca,nh as ci,qS as cn,So as cr,Ak as ct,wL as d,z as da,Vo as di,FS as dn,Mo as dr,jk as dt,$u as ea,Xp as ei,KC as en,ko as er,fk as et,CL as f,no as fa,Ya as fi,VS as fn,Qp as fr,ET as ft,sI as g,go as ga,kl as gi,yS as gn,Ps as gr,jT as gt,MI as h,Qd as ha,kf as hi,RS as hn,rm as hr,MT as ht,YH as i,vo as ia,q_ as ii,BC as in,B as ir,nk as it,VP as j,uc as ja,ou as ji,pb as jn,ip as jr,sE as jt,EP as k,bo as ka,so as ki,gb as kn,Io as kr,fE as kt,TB as l,If as la,Y_ as li,sC as ln,Ms as lr,Mk as lt,iL as m,mv as ma,N as mi,BS as mn,Oo as mr,PT as mt,cU as n,qf as na,lc as ni,qC as nn,Kg as nr,ck as nt,SL as o,iv as oa,wf as oi,FC as on,rf as or,bk as ot,oL as p,gm as pa,q as pi,IS as pn,_d as pr,NT as pt,tk as q,eh as qi,yv as qn,Za as qr,hw as qt,JL as r,rc as ra,To as ri,X as rn,yf as rr,lk as rt,hL as s,I as sa,Wo as si,WC as sn,fd as sr,rE as st,nz as t,oo as ta,Ng as ti,Z as tn,cm as tr,uk as tt,EB as u,Xs as ua,Ef as ui,kS as un,pf as ur,Nk as ut,pI as v,va,G as vi,zx as vn,Po as vr,OT as vt,TP as w,qs as wa,Jp as wi,Jx as wn,U as wr,aA as wt,oI as x,Xu as xa,ho as xi,Bx as xn,V as xr,Kk as xt,AP as y,eu as ya,pv as yi,Vx as yn,Xa as yr,kT as yt,FD as z,fa as za,y_ as zi,nb as zn,J as zr,Pw as zt};
|