@forsion/unit 2.13.2 → 2.13.3
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/main.mjs +3 -3
- package/package.json +1 -1
- package/release.json +5 -5
- package/web/assets/{ArtificialView-Bs_6B211.js → ArtificialView-DS97zlMg.js} +1 -1
- package/web/assets/{AutomationBuilder-C-IFaaBp.js → AutomationBuilder-BsJc8wuC.js} +1 -1
- package/web/assets/{CalendarConfigView-DEsNvVkD.js → CalendarConfigView-BN8mraSo.js} +1 -1
- package/web/assets/{CalendarView-D7ZUE_dr.js → CalendarView-D55PA1vn.js} +1 -1
- package/web/assets/{CapabilityMenu-CrsaTtDe.js → CapabilityMenu-BVrokPpT.js} +1 -1
- package/web/assets/{CheckboxInput-DVO2-1J7.js → CheckboxInput-BuJ3HPm_.js} +1 -1
- package/web/assets/{Chrome-BvpbCvo1.js → Chrome-amTcZNE4.js} +1 -1
- package/web/assets/{CodeView-CB4kG7Y6.js → CodeView-DRVh13k9.js} +3 -3
- package/web/assets/DashboardGridView-D9s9pez_.css +1 -0
- package/web/assets/{DashboardGridView-tgaj9-SM.js → DashboardGridView-DlFyYfUh.js} +2 -2
- package/web/assets/{EventCard-c6s4uGBu.js → EventCard-DUrn2krw.js} +1 -1
- package/web/assets/{ExcalidrawCanvas-NdV86AR3.js → ExcalidrawCanvas-TpbzBF-J.js} +1 -1
- package/web/assets/{FloatingToc-ldOYWe2C.js → FloatingToc-B1d4-5EL.js} +1 -1
- package/web/assets/HomepageView-DnQ_5Obe.css +1 -0
- package/web/assets/{HomepageView-4joJWYlg.js → HomepageView-nzKfbHM-.js} +1 -1
- package/web/assets/{ImageStudioPanels-DgMYAsHj.js → ImageStudioPanels-B2PTq6Yb.js} +1 -1
- package/web/assets/{ImageStudioView-_CYHoOoG.js → ImageStudioView-Cawr6pGW.js} +1 -1
- package/web/assets/{InlineFiles-BIfsx3R-.js → InlineFiles-DKPH5JHz.js} +1 -1
- package/web/assets/{MarkdownBlock-wYEaBBOr.js → MarkdownBlock-BHpDy2qQ.js} +1 -1
- package/web/assets/{ModelPill-DveHcLqq.js → ModelPill-ChzAM3z1.js} +1 -1
- package/web/assets/{MuseLibraryView-Do9RnKiq.js → MuseLibraryView-DLuQ_jyV.js} +2 -2
- package/web/assets/{MuseView-3GL4Ltoj.js → MuseView-CDDwV6SR.js} +2 -2
- package/web/assets/{PageHistoryPanel-BMQC-V_l.js → PageHistoryPanel-BbdXpjJM.js} +2 -2
- package/web/assets/{PdfAnnotator-CyAw8sgq.js → PdfAnnotator-CW0wPWRB.js} +1 -1
- package/web/assets/{PenRow-BSB-h5Pb.js → PenRow-BY-MZLDQ.js} +1 -1
- package/web/assets/{ProductView-B96OeHOP.js → ProductView-0ieVL3rY.js} +1 -1
- package/web/assets/{RightPanel-BgSeCLnw.js → RightPanel-BRexwQ3W.js} +1 -1
- package/web/assets/RunLocationPicker-BrDfOu8-.css +1 -0
- package/web/assets/RunLocationPicker-CadYiE7C.js +43 -0
- package/web/assets/{SketchCard-DAD0jR0i.js → SketchCard-BcXCdBAs.js} +1 -1
- package/web/assets/{StudioGuestSurface-DlUKXBXv.js → StudioGuestSurface-ZJFKnNYF.js} +1 -1
- package/web/assets/{TodoListView-_yFkPUrw.js → TodoListView-DuRdVFgB.js} +1 -1
- package/web/assets/{Tooltip-DXuy9-1_.js → Tooltip-DtDUL18W.js} +1 -1
- package/web/assets/{UnifiedPage-EJNWKzxN.js → UnifiedPage-D7JTfABH.js} +3 -3
- package/web/assets/{amadeus-manual.en-DzRWr4BL.js → amadeus-manual.en-B8J-svqq.js} +1 -1
- package/web/assets/{amadeus-manual.zh-DW32DkL7.js → amadeus-manual.zh-CkCOFnrg.js} +1 -1
- package/web/assets/appStore-ClD7vq5L.css +1 -0
- package/web/assets/{appStore-CidPWYa0.js → appStore-affnJoin.js} +155 -117
- package/web/assets/{arrow-up-right-KPFbRA41.js → arrow-up-right-R4P9Mmxz.js} +1 -1
- package/web/assets/{astryxBridge-Bupzouso.js → astryxBridge-CT2wZJXs.js} +3 -3
- package/web/assets/{automationListSource-1aOVKBLw.js → automationListSource-JVBMsMbC.js} +1 -1
- package/web/assets/{boardSurface-BHuMoQN-.js → boardSurface-Ce0_vf9f.js} +1 -1
- package/web/assets/{book-open-CBeNsIpo.js → book-open-CcXCToyx.js} +1 -1
- package/web/assets/{calendarNavStore-Duyhbmm_.js → calendarNavStore-tQJRVpum.js} +1 -1
- package/web/assets/{canvasPrefs-CxfyDTMT.js → canvasPrefs-CSuX9aLF.js} +1 -1
- package/web/assets/{chatBoxSurface-OBzO1Z5E.js → chatBoxSurface-IG6Vu4Dz.js} +1 -1
- package/web/assets/{circle-question-mark-M8QUJJYk.js → circle-question-mark-O8AhUz35.js} +1 -1
- package/web/assets/{circle-x-Szwop5L_.js → circle-x-AV2ZWulM.js} +1 -1
- package/web/assets/{client-CPUljePZ.js → client-BqhpYbYL.js} +1 -1
- package/web/assets/{code-xml-n9mgGgkv.js → code-xml-DdR58F83.js} +1 -1
- package/web/assets/{codeStudioStore-DXMQwRzG.js → codeStudioStore-Dq5i8nbE.js} +1 -1
- package/web/assets/codingNavigation-CxdCK78-.js +53 -0
- package/web/assets/codingNavigation-_tOR0ell.css +1 -0
- package/web/assets/{create-C19zqt5N.js → create-BgJN5qsj.js} +2 -2
- package/web/assets/{dashboardSurface-BwcH16Qc.js → dashboardSurface-BY-AFB-r.js} +1 -1
- package/web/assets/{deskCapture-B_LKZSPt.js → deskCapture-BD2qD6NI.js} +1 -1
- package/web/assets/{diff2html-DrCCWvpR.js → diff2html-OoRdHZ_O.js} +1 -1
- package/web/assets/{docx-preview-Bi7wekSM.js → docx-preview-B43XC8Cn.js} +1 -1
- package/web/assets/{emoji-DczIG8SO.js → emoji-BPdA62d7.js} +1 -1
- package/web/assets/{floatingTocSurface-rc1ZC7-I.js → floatingTocSurface-BM2SYE_u.js} +1 -1
- package/web/assets/{foldActions-BGocXE-o.js → foldActions-BcyvNVBs.js} +1 -1
- package/web/assets/{folder-CoOsfQ64.js → folder-CCZqnwRc.js} +1 -1
- package/web/assets/{folder-plus-d5MwIMlf.js → folder-plus-BJKT1Pqg.js} +1 -1
- package/web/assets/{gestures-CXFaEydn.js → gestures-BwPbZDkU.js} +1 -1
- package/web/assets/{hand-fuehbnkI.js → hand-DRu7IJdU.js} +1 -1
- package/web/assets/{hard-drive-Bh1DmZg0.js → hard-drive-CXNJUCXw.js} +1 -1
- package/web/assets/i18n-BMo19xaR.css +1 -0
- package/web/assets/i18n.generated-DvY59Zq3.js +15 -0
- package/web/assets/{imageStudio-Dgl1wZNB.js → imageStudio-Axwmd4GW.js} +2 -2
- package/web/assets/imageStudio-DZ0qGU2s.css +1 -0
- package/web/assets/{index-e-MxdHFO.js → index-B1rE_NwA.js} +1 -1
- package/web/assets/{index-lfow5R3O.js → index-BFTY79aq.js} +1 -1
- package/web/assets/{index-38xsQSS9.js → index-BGEkZBs2.js} +1 -1
- package/web/assets/{index-YRWOePBS.js → index-BO2XJc36.js} +1 -1
- package/web/assets/{index-B5UW6SaE.js → index-BYUntVIZ.js} +2 -2
- package/web/assets/{index-2tD0kijW.js → index-C65u4fXd.js} +1 -1
- package/web/assets/{index-BCG8Wnc4.js → index-C_Ohi-I3.js} +1 -1
- package/web/assets/{index-Dff-DL1v.js → index-CkMhazev.js} +1 -1
- package/web/assets/{index-Dc8iMctf.js → index-CobUnTcv.js} +1 -1
- package/web/assets/{index-Dy07SBfH.js → index-D102FOuM.js} +1 -1
- package/web/assets/{index-B8Co6KG3.js → index-D3CYvMpl.js} +1 -1
- package/web/assets/{index-QjVOA7QM.js → index-D78izbLA.js} +1 -1
- package/web/assets/{index-BPqoEOV_.js → index-DDMXVG0h.js} +1 -1
- package/web/assets/{index-CPLtf9Vc.js → index-DY0M_dpd.js} +1 -1
- package/web/assets/{index-7kdR1oL8.js → index-DcbZwhpE.js} +1 -1
- package/web/assets/{index-D4CSH-v1.js → index-Dlkq7gkE.js} +1 -1
- package/web/assets/{index-Ch0FIsJX.js → index-HqmJW2np.js} +1 -1
- package/web/assets/{index-DcRyQ3eU.js → index-LxlyPm0_.js} +1 -1
- package/web/assets/{index-Ce1sNSS8.js → index-Uq4J2aoW.js} +1 -1
- package/web/assets/{index-DvOrTnw2.js → index-WbVt2P8R.js} +1 -1
- package/web/assets/{index-Df9jregv.js → index-XyjIhkPw.js} +1 -1
- package/web/assets/{index-BqGpbntz.js → index-Y2kzYlZq.js} +1 -1
- package/web/assets/{index-CnDAYLti.js → index-mB0EQkyZ.js} +1 -1
- package/web/assets/{index-fViJsYjM.js → index-pJh7JN7_.js} +1 -1
- package/web/assets/{index-Dx9aIoyo.js → index-taRxNsbp.js} +1 -1
- package/web/assets/{invitePage-Dgl3-c_m.js → invitePage-BW0BH8Ac.js} +1 -1
- package/web/assets/{ipc-CNlIRMtU.js → ipc-D7yENkjV.js} +1 -1
- package/web/assets/{jszip.min-tyV0GaJg.js → jszip.min-UE5d5vPJ.js} +1 -1
- package/web/assets/{layout-grid-DFmwM9NU.js → layout-grid-Hs3eDA07.js} +1 -1
- package/web/assets/{linkFollow-iP2zfbA3.js → linkFollow-Msu1XH9v.js} +4 -4
- package/web/assets/{list-tree-i07HsP3D.js → list-tree-DmuRb-p9.js} +1 -1
- package/web/assets/{listFold-Aea6I0Sa.js → listFold-CKxjyY5_.js} +1 -1
- package/web/assets/{lock-TSDKuCod.js → lock-kffGfeHt.js} +1 -1
- package/web/assets/{log-out-DK84lW5n.js → log-out-B5gEP0tF.js} +1 -1
- package/web/assets/main-DIyFlyfK.js +20 -0
- package/web/assets/markdownEditorSurface-Cx2rqFAY.js +3 -0
- package/web/assets/{message-square-plus-3wFslIMY.js → message-square-plus-DxBPIhPS.js} +1 -1
- package/web/assets/{messages-DEAGRsC3.js → messages-4w1Khzm1.js} +1 -1
- package/web/assets/minus-CfoZ4oxr.js +1 -0
- package/web/assets/{mobileEntry-5UaAITwY.js → mobileEntry-B8JwR53-.js} +1 -1
- package/web/assets/{nativeDownload-B3JGkABw.js → nativeDownload-Udrv_tmU.js} +1 -1
- package/web/assets/{pageChrome-DFi9zs6F.js → pageChrome-D-9npbUE.js} +1 -1
- package/web/assets/{pageChrome-BDHHmRnt.css → pageChrome-eO9pb2fH.css} +1 -1
- package/web/assets/{pageTree-DZ7Eiro-.js → pageTree-CIXFRCLk.js} +2 -2
- package/web/assets/{pen-tool-ChGmX6g_.js → pen-tool-D_Y9We9x.js} +1 -1
- package/web/assets/{pencil-CJsJD7M_.js → pencil-DGiTRzW1.js} +1 -1
- package/web/assets/phoneList-BQfCJwKF.css +1 -0
- package/web/assets/{phoneList-DrxIwJxQ.js → phoneList-DHUia6HT.js} +1 -1
- package/web/assets/{pluginChat-0QI9a8Q1.js → pluginChat-BXuJiMYi.js} +1 -1
- package/web/assets/{redo-2-CI57sDFr.js → redo-2-QgiKEg9T.js} +1 -1
- package/web/assets/{rotate-ccw-xgT_0UN9.js → rotate-ccw-BLoH5er1.js} +1 -1
- package/web/assets/{sharePage-C2Yqx0NQ.js → sharePage-DYYN5usb.js} +2 -2
- package/web/assets/{shareViewer-DKPWhTJv.js → shareViewer-BzuSyJv_.js} +1 -1
- package/web/assets/{star-C9KTji9N.js → star-BmywYD3u.js} +1 -1
- package/web/assets/{tableSurface-cYs6dX6B.js → tableSurface-21LDYY_G.js} +1 -1
- package/web/assets/{terminal-DPZazOQ2.js → terminal-BlmA_Z1C.js} +1 -1
- package/web/assets/{terminalView-CsJmxE_m.js → terminalView-SAxITnRW.js} +1 -1
- package/web/assets/{type-C5J875vb.js → type-DmIL6FB-.js} +1 -1
- package/web/assets/{undo-2-BOUt5qks.js → undo-2-yMeXc8Wi.js} +1 -1
- package/web/assets/{unitAccount-BIAIxKNp.js → unitAccount-BPYRAa3m.js} +1 -1
- package/web/assets/{unitBridge-b2C6zb3a.js → unitBridge-BNVzai6X.js} +1 -1
- package/web/assets/{unitCloudTransport-NGtDDKWo.js → unitCloudTransport-iFweA1xk.js} +1 -1
- package/web/assets/{unitOwnerAccess-CwH9ApZT.js → unitOwnerAccess-Bggl7bDP.js} +1 -1
- package/web/assets/{unitShim-CY8EVkKD.js → unitShim-BP2nBO_k.js} +3 -3
- package/web/assets/{upload-CrbEAW8C.js → upload-D20PZHXc.js} +1 -1
- package/web/assets/userSpaces-CrLrKklx.js +1 -0
- package/web/assets/{viewportLock-Bi3orrUs.css → viewportLock-DO1lzA2N.css} +1 -1
- package/web/assets/viewportLock-tlT6H_Hc.js +629 -0
- package/web/assets/{workflow-DY2Cnaei.js → workflow-Bd6xBHiT.js} +1 -1
- package/web/assets/{zoom-in-BcuPvIYd.js → zoom-in-_TgFOpyv.js} +1 -1
- package/web/index.html +2 -2
- package/web/assets/DashboardGridView-hpRmBr9B.css +0 -1
- package/web/assets/HomepageView-Cxf3AWBu.css +0 -1
- package/web/assets/RunLocationPicker-CEmFio4n.css +0 -1
- package/web/assets/RunLocationPicker-M1UoJyjf.js +0 -38
- package/web/assets/appStore-DeaC1U32.css +0 -1
- package/web/assets/codingNavigation-CCjs1kon.js +0 -53
- package/web/assets/codingNavigation-yp19w6uu.css +0 -1
- package/web/assets/i18n-DjziAw8r.css +0 -1
- package/web/assets/i18n.generated-BiQFRL2U.js +0 -15
- package/web/assets/imageStudio--KF9gwHA.css +0 -1
- package/web/assets/main-D7CEGndC.js +0 -20
- package/web/assets/markdownEditorSurface-DISu_twy.js +0 -3
- package/web/assets/minus-BBdfT_sc.js +0 -1
- package/web/assets/phoneList-DvpzD3zT.css +0 -1
- package/web/assets/userSpaces-B_Njvel_.js +0 -1
- package/web/assets/viewportLock-DZ927PNz.js +0 -629
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as E,r as De,be as Dn,bq as Ya,bp as tf,I as Go,c5 as Xt,c6 as Yo,c7 as vi,t as O,c8 as Ci,U as Si,W as Ai,R as Mi,c9 as Jo,q as Ni,u as tn,j as b,bQ as Lr,ca as Ei,cb as Ti,m as go,n as Ii,am as nf,ar as rf,B as Xo,cc as Ja,K as of,cd as bo,ce as Xa,cf as sf,cg as af,bU as lf,b$ as cf,c0 as Qa,c1 as uf,aw as df,ax as ff,c3 as pf,aO as mf,bM as hf}from"./index-B5UW6SaE.js";import{G as Li,ns as fe,nf as Z,nz as Y,ny as me,ni as j,nu as X,nN as Ie,p0 as Qo,p1 as gf,np as Zo,nr as or,nj as ce,p2 as bf,p3 as jt,p4 as _n,p5 as ot,ot as le,p6 as Ri,p7 as $i,nI as se,p8 as An,p9 as es,pa as yf,pb as st,pc as kf,pd as wf,nq as yo,pe as xf,pf as ts,pg as Di,ph as Je,nK as vf,pi as Cf,nt as Ve,o5 as Sf,pj as Af,pk as _i,pl as Mf,pm as zn,n8 as Nf,n9 as Ef,ou as Qt,pn as Tf,po as If,pp as zi,os as pr,pq as Lf,pr as Oi,ps as Pi,pt as Rf,pu as $f,pv as Df,pw as _f,px as zf,py as Of,pz as Pf,pA as Bf,nA as Kf,pB as jf,pC as Hf,ai as nn,eN as Ff,pD as ft,pE as qf,jG as Wf,pF as Uf,b as Mn,dm as Oe,lH as Fe,I as Bi,pG as mr,pH as Vf,nc as Gf,pI as Yf,cr as Jf,pJ as Xf,pK as Qf,nv as Zf,pL as ep,pM as tp,pN as np,fB as Ki,nU as ji,pO as rp,cW as op,pP as sp,hP as ap,pQ as lp,fV as ko,pR as Zr,N as ip,aJ as cp,kc as up,pS as dp,pT as fp,pU as pp,pV as mp,pW as hp,pX as gp,pY as bp,pZ as yp,ka as kp,k1 as wp,p_ as xp,p$ as vp,q0 as Cp,q1 as Sp,q2 as Ap,q3 as Mp,q4 as Np,q5 as Ep,q6 as Tp,q7 as Ip,q8 as Lp,q9 as Rp,qa as $p,qb as Dp,qc as _p,qd as zp,fj as Op,ov as Pp,fo as Qn,ow as eo,qe as Bp,qf as Kp,qg as jp,qh as Za,nh as el,qi as Hp,qj as Hi,qk as Fp,ql as qp,qm as Wp}from"./appStore-CidPWYa0.js";import{$ as Q,c as F,d as at,e as On,f as _e,g as ns,a as ve,h as Xe,b as Ee,i as rs,j as ue,k as Up}from"./index-BqGpbntz.js";import{s as Fi,b as Rr,e as os,d as Vp,L as tl,m as Gp,f as Yp,a as Jp,u as qi,g as Xp,h as Qp,w as Zp,l as em,j as tm,k as nm,I as nl}from"./linkFollow-iP2zfbA3.js";import"./client-CPUljePZ.js";import{s as rm}from"./emoji-DczIG8SO.js";import{b as om,t as sm,m as am,g as lm}from"./listFold-Aea6I0Sa.js";import{B as im}from"./book-open-CBeNsIpo.js";const cm=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 19H5",key:"vjpgq2"}]],um=Li("text-align-center",cm);const dm=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 19H7",key:"4cu937"}]],fm=Li("text-align-end",dm);De({"settings.notes.spellcheckLabel":{zh:"拼写检查",en:"Spell check"},"settings.notes.spellcheckHint":{zh:"在笔记正文、标题和源码模式里标出拼写错误。代码块、行内代码和公式始终不检查。",en:"Underline misspellings in note text, titles, and source mode. Code blocks, inline code, and formulas are never checked."}});const ss="amadeus.notes.spellcheck",wo="amadeus:notes-spellcheck";function Wi(){try{return localStorage.getItem(ss)!=="0"}catch{return!0}}function r1(e){try{localStorage.setItem(ss,e?"1":"0")}catch{}try{window.dispatchEvent(new Event(wo))}catch{}}function Ui(e){const t=n=>{(!n.key||n.key===ss)&&e()};return window.addEventListener(wo,e),window.addEventListener("storage",t),()=>{window.removeEventListener(wo,e),window.removeEventListener("storage",t)}}function o1(){return E.useSyncExternalStore(Ui,Wi,()=>!0)}const rl={spellcheck:"false"};function ol(e){const t=[];return e.descendants((n,r)=>{if(!n.isTextblock)return!0;if(n.type.spec.code)return!1;const o=r+1;if(n.forEach((s,a)=>{s.isText&&s.marks.some(l=>l.type.spec.code||l.type.name==="inlineCode")&&t.push(Y.inline(o+a,o+a+s.nodeSize,rl))}),n.textContent.includes("$"))for(const s of Fi(Rr(n)))t.push(Y.inline(o+s.from,o+s.to,rl));return!1}),t.length?me.create(e,t):me.empty}const sl=new fe("amadeus-spellcheck"),pm=Q(()=>new Z({key:sl,state:{init:(e,t)=>ol(t.doc),apply:(e,t)=>e.docChanged?ol(e.doc):t},props:{decorations:e=>sl.getState(e),attributes:()=>({spellcheck:Wi()?"true":"false"})},view:e=>({destroy:Ui(()=>e.updateState(e.state))})}));De({"settings.notes.codeAutoPairLabel":{zh:"代码块自动补全括号",en:"Auto-close brackets in code blocks"},"settings.notes.codeAutoPairHint":{zh:"在代码块里输入左括号或引号时自动补上另一半;紧挨着再输入同一个闭合符号会直接跳过。",en:"Typing an opening bracket or quote in a code block inserts the closing half. Typing the same closing character next to it steps over it."}});const as="amadeus.notes.codeAutoPair",xo="amadeus:notes-code-autopair";function Vi(){try{return localStorage.getItem(as)!=="0"}catch{return!0}}function s1(e){try{localStorage.setItem(as,e?"1":"0")}catch{}try{window.dispatchEvent(new Event(xo))}catch{}}function mm(e){const t=n=>{(!n.key||n.key===as)&&e()};return window.addEventListener(xo,e),window.addEventListener("storage",t),()=>{window.removeEventListener(xo,e),window.removeEventListener("storage",t)}}function a1(){return E.useSyncExternalStore(mm,Vi,()=>!0)}const hr={"(":")","[":"]","{":"}",'"':'"',"'":"'","`":"`"},hm=new Set(Object.values(hr)),al=/[\p{L}\p{N}_]/u;function Gi(e,t,n){if(t!==n||!Vi())return null;const r=e.state.doc.resolve(t);return r.parent.type.name!=="code_block"?null:{text:r.parent.textContent,off:r.parentOffset}}function gm(e,t,n,r){const o=Gi(e,t,n);if(!o||r.length!==1)return!1;const s=o.text.charAt(o.off),a=o.text.charAt(o.off-1);if(hm.has(r)&&s===r)return e.dispatch(e.state.tr.setSelection(j.create(e.state.doc,t+1))),!0;const l=hr[r];if(!l||al.test(s)||l===r&&al.test(a))return!1;const i=e.state.tr.insertText(r+l,t,n);return i.setSelection(j.create(i.doc,t+1)),e.dispatch(i),!0}function bm(e){const{from:t,to:n}=e.state.selection,r=Gi(e,t,n);if(!r||r.off===0)return!1;const o=r.text.charAt(r.off-1);return!hr[o]||r.text.charAt(r.off)!==hr[o]?!1:(e.dispatch(e.state.tr.delete(t-1,t+1)),!0)}function ym(e,t){return function(n,r){let{$from:o,$to:s,node:a}=n.selection;if(a&&a.isBlock||o.depth<2||!o.sameParent(s))return!1;let l=o.node(-1);if(l.type!=e)return!1;if(o.parent.content.size==0&&o.node(-1).childCount==o.indexAfter(-1)){if(o.depth==3||o.node(-3).type!=e||o.index(-2)!=o.node(-2).childCount-1)return!1;if(r){let d=X.empty,f=o.index(-1)?1:o.index(-2)?2:3;for(let w=o.depth-f;w>=o.depth-3;w--)d=X.from(o.node(w).copy(d));let m=o.indexAfter(-1)<o.node(-2).childCount?1:o.indexAfter(-2)<o.node(-3).childCount?2:3;d=d.append(X.from(e.createAndFill()));let p=o.before(o.depth-(f-1)),h=n.tr.replace(p,o.after(-m),new Ie(d,4-f,0)),g=-1;h.doc.nodesBetween(p,h.doc.content.size,(w,y)=>{if(g>-1)return!1;w.isTextblock&&w.content.size==0&&(g=y+1)}),g>-1&&h.setSelection(ce.near(h.doc.resolve(g))),r(h.scrollIntoView())}return!0}let i=s.pos==o.end()?l.contentMatchAt(0).defaultType:null,c=n.tr.delete(o.pos,s.pos),u=i?[null,{type:i}]:void 0;return bf(c.doc,o.pos,2,u)?(r&&r(c.split(o.pos,2,u).scrollIntoView()),!0):!1}}function Yi(e){return function(t,n){let{$from:r,$to:o}=t.selection,s=r.blockRange(o,a=>a.childCount>0&&a.firstChild.type==e);return s?n?r.node(s.depth-1).type==e?km(t,n,e,s):wm(t,n,s):!0:!1}}function km(e,t,n,r){let o=e.tr,s=r.end,a=r.$to.end(r.depth);s<a&&(o.step(new Qo(s-1,a,s,a,new Ie(X.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new gf(o.doc.resolve(r.$from.pos),o.doc.resolve(a),r.depth));const l=Zo(r);if(l==null)return!1;o.lift(r,l);let i=o.doc.resolve(o.mapping.map(s,-1)-1);return or(o.doc,i.pos)&&i.nodeBefore.type==i.nodeAfter.type&&o.join(i.pos),t(o.scrollIntoView()),!0}function wm(e,t,n){let r=e.tr,o=n.parent;for(let m=n.end,p=n.endIndex-1,h=n.startIndex;p>h;p--)m-=o.child(p).nodeSize,r.delete(m-1,m+1);let s=r.doc.resolve(n.start),a=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,i=n.endIndex==o.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(l?0:1),u+1,a.content.append(i?X.empty:X.from(o))))return!1;let d=s.pos,f=d+a.nodeSize;return r.step(new Qo(d-(l?1:0),f+(i?1:0),d+1,f-1,new Ie((l?X.empty:X.from(o.copy(X.empty))).append(i?X.empty:X.from(o.copy(X.empty))),l?0:1,i?0:1),l?0:1)),t(r.scrollIntoView()),!0}function Ji(e){return function(t,n){let{$from:r,$to:o}=t.selection,s=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==e);if(!s)return!1;let a=s.startIndex;if(a==0)return!1;let l=s.parent,i=l.child(a-1);if(i.type!=e)return!1;if(n){let c=i.lastChild&&i.lastChild.type==l.type,u=X.from(c?e.create():null),d=new Ie(X.from(e.create(null,X.from(l.type.create(null,u)))),c?3:1,0),f=s.start,m=s.end;n(t.tr.step(new Qo(f-(c?3:1),m,f,m,d,1,!0)).scrollIntoView())}return!0}}function xm(e){const t=new Map;if(!e||!e.type)throw new Error("mdast-util-definitions expected node");return Dn(e,"definition",function(r){const o=ll(r.identifier);o&&!t.get(o)&&t.set(o,r)}),n;function n(r){const o=ll(r);return t.get(o)}}function ll(e){return String(e||"").toUpperCase()}function vm(){return function(e){const t=xm(e);Dn(e,function(n,r,o){if(n.type==="definition"&&o!==void 0&&typeof r=="number")return o.children.splice(r,1),[Ya,r];if(n.type==="imageReference"||n.type==="linkReference"){const s=t(n.identifier);if(s&&o&&typeof r=="number")return o.children[r]=n.type==="imageReference"?{type:"image",url:s.url,title:s.title,alt:n.alt}:{type:"link",url:s.url,title:s.title,children:n.children},[Ya,r]}})}}function Xi(e,t){if(!(t.childCount>=1&&t.lastChild?.type.name==="hardbreak")){e.next(t.content);return}const n=[];t.content.forEach((r,o,s)=>{s!==t.childCount-1&&n.push(r)}),e.next(X.fromArray(n))}function v(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-commonmark",...t}}),e}var ls=On("emphasis");v(ls,{displayName:"Attr<emphasis>",group:"Emphasis"});var Nt=at("emphasis",e=>({attrs:{marker:{default:e.get(jt).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:t=>t==="italic"}],toDOM:t=>["em",e.get(ls.key)(t)],parseMarkdown:{match:t=>t.type==="emphasis",runner:(t,n,r)=>{t.openMark(r,{marker:n.marker}),t.next(n.children),t.closeMark(r)}},toMarkdown:{match:t=>t.type.name==="emphasis",runner:(t,n)=>{t.withMark(n,"emphasis",void 0,{marker:n.attrs.marker})}}}));v(Nt.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"});v(Nt.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});var $r=F("ToggleEmphasis",e=>()=>_n(Nt.type(e)));v($r,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});var is=ue(e=>st(/(?:^|[^*])\*([^*]+)\*$/,Nt.type(e),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:t,start:n})=>t.startsWith("*")?{}:{fullMatch:t.slice(1),start:n+1}}));v(is,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});var cs=ue(e=>st(/\b_(?![_\s])(.*?[^_\s])_\b/,Nt.type(e),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:t,start:n})=>t.startsWith("_")?{}:{fullMatch:t.slice(1),start:n+1}}));v(cs,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});var us=_e("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:e=>{const t=e.get(se);return()=>t.call($r.key)}}});v(us.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"});v(us.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});var ds=On("strong");v(ds,{displayName:"Attr<strong>",group:"Strong"});var rn=at("strong",e=>({attrs:{marker:{default:e.get(jt).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:t=>t.style.fontWeight!="normal"&&null},{tag:"strong"},{style:"font-style",getAttrs:t=>t==="bold"},{style:"font-weight=400",clearMark:t=>t.type.name=="strong"},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM:t=>["strong",e.get(ds.key)(t)],parseMarkdown:{match:t=>t.type==="strong",runner:(t,n,r)=>{t.openMark(r,{marker:n.marker}),t.next(n.children),t.closeMark(r)}},toMarkdown:{match:t=>t.type.name==="strong",runner:(t,n)=>{t.withMark(n,"strong",void 0,{marker:n.attrs.marker})}}}));v(rn.mark,{displayName:"MarkSchema<strong>",group:"Strong"});v(rn.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});var Dr=F("ToggleStrong",e=>()=>_n(rn.type(e)));v(Dr,{displayName:"Command<toggleStrongCommand>",group:"Strong"});var fs=ue(e=>st(new RegExp("(?<![\\w:/])(?:\\*\\*|__)([^*_]+?)(?:\\*\\*|__)(?![\\w/])$"),rn.type(e),{getAttr:t=>({marker:t[0].startsWith("*")?"*":"_"})}));v(fs,{displayName:"InputRule<strong>",group:"Strong"});var ps=_e("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:e=>{const t=e.get(se);return()=>t.call(Dr.key)}}});v(ps.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"});v(ps.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});var ms=On("inlineCode");v(ms,{displayName:"Attr<inlineCode>",group:"InlineCode"});var dt=at("inlineCode",e=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:t=>["code",e.get(ms.key)(t)],parseMarkdown:{match:t=>t.type==="inlineCode",runner:(t,n,r)=>{t.openMark(r),t.addText(n.value),t.closeMark(r)}},toMarkdown:{match:t=>t.type.name==="inlineCode",runner:(t,n,r)=>(t.withMark(n,"inlineCode",r.text||""),!0)}}));v(dt.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"});v(dt.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});var _r=F("ToggleInlineCode",e=>()=>(t,n)=>{const{selection:r,tr:o}=t;if(r.empty)return!1;const{from:s,to:a}=r;return t.doc.rangeHasMark(s,a,dt.type(e))?(n?.(o.removeMark(s,a,dt.type(e))),!0):(Object.keys(t.schema.marks).filter(l=>l!==dt.type.name).map(l=>t.schema.marks[l]).forEach(l=>{o.removeMark(s,a,l)}),n?.(o.addMark(s,a,dt.type(e).create())),!0)});v(_r,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});var hs=ue(e=>st(/(?:`)([^`]+)(?:`)$/,dt.type(e)));v(hs,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});var gs=_e("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:e=>{const t=e.get(se);return()=>t.call(_r.key)}}});v(gs.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"});v(gs.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});var zr=On("link");v(zr,{displayName:"Attr<link>",group:"Link"});var Ge=at("link",e=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:t=>{if(!(t instanceof HTMLElement))throw ot(t);return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM:t=>["a",{...e.get(zr.key)(t),...t.attrs}],parseMarkdown:{match:t=>t.type==="link",runner:(t,n,r)=>{const o=n.url,s=n.title;t.openMark(r,{href:o,title:s}),t.next(n.children),t.closeMark(r)}},toMarkdown:{match:t=>t.type.name==="link",runner:(t,n)=>{t.withMark(n,"link",void 0,{title:n.attrs.title,url:n.attrs.href})}}}));v(Ge.mark,{displayName:"MarkSchema<link>",group:"Link"});var Qi=F("ToggleLink",e=>(t={})=>_n(Ge.type(e),t));v(Qi,{displayName:"Command<toggleLinkCommand>",group:"Link"});var Zi=F("UpdateLink",e=>(t={})=>(n,r)=>{if(!r)return!1;let o,s=-1;const{selection:a}=n,{from:l,to:i}=a;if(n.doc.nodesBetween(l,l===i?i+1:i,(p,h)=>{if(Ge.type(e).isInSet(p.marks))return o=p,s=h,!1}),!o)return!1;const c=o.marks.find(({type:p})=>p===Ge.type(e));if(!c)return!1;const u=s,d=s+o.nodeSize,{tr:f}=n,m=Ge.type(e).create({...c.attrs,...t});return m?(r(f.removeMark(u,d,c).addMark(u,d,m).setSelection(new j(f.selection.$anchor)).scrollIntoView()),!0):!1});v(Zi,{displayName:"Command<updateLinkCommand>",group:"Link"});var bs=ns("doc",()=>({content:"block+",parseMarkdown:{match:({type:e})=>e==="root",runner:(e,t,n)=>{e.injectRoot(t,n)}},toMarkdown:{match:e=>e.type.name==="doc",runner:(e,t)=>{e.openNode("root"),e.next(t.content)}}}));v(bs,{displayName:"NodeSchema<doc>",group:"Doc"});function Cm(e){return tf(e,t=>t.type==="html"&&["<br />","<br>","<br >","<br/>"].includes(t.value?.trim()),(t,n)=>{if(!n.length)return;const r=n[n.length-1];if(!r)return;const o=r.children.indexOf(t);o!==-1&&r.children.splice(o,1)},!0)}var Or=ve("remark-preserve-empty-line",()=>()=>Cm);v(Or.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"});v(Or.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});var Pr=Xe("paragraph");v(Pr,{displayName:"Attr<paragraph>",group:"Paragraph"});var Be=Ee("paragraph",e=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:t=>["p",e.get(Pr.key)(t),0],parseMarkdown:{match:t=>t.type==="paragraph",runner:(t,n,r)=>{t.openNode(r),n.children?t.next(n.children):t.addText(n.value||""),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="paragraph",runner:(t,n)=>{const r=e.get(le).state?.doc.lastChild;t.openNode("paragraph"),(!n.content||n.content.size===0)&&n!==r&&Sm(e)?t.addNode("html",void 0,"<br />"):Xi(t,n),t.closeNode()}}}));function Sm(e){let t=!1;try{e.get(Or.id),t=!0}catch{t=!1}return t}v(Be.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"});v(Be.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});var ys=F("TurnIntoText",e=>()=>An(Be.type(e)));v(ys,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});var ks=_e("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:e=>{const t=e.get(se);return()=>t.call(ys.key)}}});v(ks.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"});v(ks.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});var Am=Array(6).fill(0).map((e,t)=>t+1);function Mm(e){return e.textContent.toLowerCase().trim().replace(/\s+/g,"-")}var Pn=rs(Mm,"headingIdGenerator");v(Pn,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});var Br=Xe("heading");v(Br,{displayName:"Attr<heading>",group:"Heading"});var rt=Ee("heading",e=>{const t=e.get(Pn.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:Am.map(n=>({tag:`h${n}`,getAttrs:r=>{if(!(r instanceof HTMLElement))throw ot(r);return{level:n,id:r.id}}})),toDOM:n=>[`h${n.attrs.level}`,{...e.get(Br.key)(n),id:n.attrs.id||t(n)},0],parseMarkdown:{match:({type:n})=>n==="heading",runner:(n,r,o)=>{const s=r.depth;n.openNode(o,{level:s}),n.next(r.children),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="heading",runner:(n,r)=>{n.openNode("heading",void 0,{depth:r.attrs.level}),Xi(n,r),n.closeNode()}}}});v(rt.node,{displayName:"NodeSchema<heading>",group:"Heading"});v(rt.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});var ec=ue(e=>Di(/^(?<hashes>#+)\s$/,rt.type(e),t=>{const n=t.groups?.hashes?.length||0,{$from:r}=e.get(le).state.selection,o=r.node();if(o.type.name==="heading"){let s=Number(o.attrs.level)+Number(n);return s>6&&(s=6),{level:s}}return{level:n}}));v(ec,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});var kt=F("WrapInHeading",e=>t=>(t??=1,t<1?An(Be.type(e)):An(rt.type(e),{level:t})));v(kt,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});var ws=F("DowngradeHeading",e=>()=>(t,n,r)=>{const{$from:o}=t.selection,s=o.node();if(s.type!==rt.type(e)||!t.selection.empty||o.parentOffset!==0)return!1;const a=s.attrs.level-1;return a?(n?.(t.tr.setNodeMarkup(t.selection.$from.before(),void 0,{...s.attrs,level:a})),!0):An(Be.type(e))(t,n,r)});v(ws,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});var xs=_e("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:e=>{const t=e.get(se);return()=>t.call(kt.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:e=>{const t=e.get(se);return()=>t.call(kt.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:e=>{const t=e.get(se);return()=>t.call(kt.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:e=>{const t=e.get(se);return()=>t.call(kt.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:e=>{const t=e.get(se);return()=>t.call(kt.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:e=>{const t=e.get(se);return()=>t.call(kt.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:e=>{const t=e.get(se);return()=>t.call(ws.key)}}});v(xs.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"});v(xs.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});var Kr=Xe("blockquote");v(Kr,{displayName:"Attr<blockquote>",group:"Blockquote"});var At=Ee("blockquote",e=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:t=>["blockquote",e.get(Kr.key)(t),0],parseMarkdown:{match:({type:t})=>t==="blockquote",runner:(t,n,r)=>{t.openNode(r).next(n.children).closeNode()}},toMarkdown:{match:t=>t.type.name==="blockquote",runner:(t,n)=>{t.openNode("blockquote").next(n.content).closeNode()}}}));v(At.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"});v(At.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});var tc=ue(e=>ts(/^\s*>\s$/,At.type(e)));v(tc,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});var vs=F("WrapInBlockquote",e=>()=>es(At.type(e)));v(vs,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});var Cs=_e("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:e=>{const t=e.get(se);return()=>t.call(vs.key)}}});v(Cs.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"});v(Cs.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});var Ss=Xe("codeBlock",()=>({pre:{},code:{}}));v(Ss,{displayName:"Attr<codeBlock>",group:"CodeBlock"});var Bn=Ee("code_block",e=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:"",validate:"string"}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>{if(!(t instanceof HTMLElement))throw ot(t);return{language:t.dataset.language}}}],toDOM:t=>{const n=e.get(Ss.key)(t),r=t.attrs.language,o=r&&r.length>0?{"data-language":r}:void 0;return["pre",{...n.pre,...o},["code",n.code,0]]},parseMarkdown:{match:({type:t})=>t==="code",runner:(t,n,r)=>{const o=n.lang??"",s=n.value;t.openNode(r,{language:o}),s&&t.addText(s),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="code_block",runner:(t,n)=>{t.addNode("code",void 0,n.content.firstChild?.text||"",{lang:n.attrs.language})}}}));v(Bn.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"});v(Bn.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});var nc=ue(e=>Di(/^```(?<language>[a-z]*)?[\s\n]$/,Bn.type(e),t=>({language:t.groups?.language??""})));v(nc,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});var As=F("CreateCodeBlock",e=>(t="")=>An(Bn.type(e),{language:t}));v(As,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"});var Nm=F("UpdateCodeBlockLanguage",()=>({pos:e,language:t}={pos:-1,language:""})=>(n,r)=>e>=0?(r?.(n.tr.setNodeAttribute(e,"language",t)),!0):!1);v(Nm,{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});var Ms=_e("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:e=>{const t=e.get(se);return()=>t.call(As.key)}}});v(Ms.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"});v(Ms.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});var Ns=Xe("image");v(Ns,{displayName:"Attr<image>",group:"Image"});var on=Ee("image",e=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:"",validate:"string"},alt:{default:"",validate:"string"},title:{default:"",validate:"string"}},parseDOM:[{tag:"img[src]",getAttrs:t=>{if(!(t instanceof HTMLElement))throw ot(t);return{src:t.getAttribute("src")||"",alt:t.getAttribute("alt")||"",title:t.getAttribute("title")||t.getAttribute("alt")||""}}}],toDOM:t=>["img",{...e.get(Ns.key)(t),...t.attrs}],parseMarkdown:{match:({type:t})=>t==="image",runner:(t,n,r)=>{const o=n.url,s=n.alt,a=n.title;t.addNode(r,{src:o,alt:s,title:a})}},toMarkdown:{match:t=>t.type.name==="image",runner:(t,n)=>{t.addNode("image",void 0,void 0,{title:n.attrs.title,url:n.attrs.src,alt:n.attrs.alt})}}}));v(on.node,{displayName:"NodeSchema<image>",group:"Image"});v(on.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});var rc=F("InsertImage",e=>(t={})=>(n,r)=>{if(!r)return!0;const{src:o="",alt:s="",title:a=""}=t,l=on.type(e).create({src:o,alt:s,title:a});return l&&r(n.tr.replaceSelectionWith(l).scrollIntoView()),!0});v(rc,{displayName:"Command<insertImageCommand>",group:"Image"});var oc=F("UpdateImage",e=>(t={})=>(n,r)=>{const o=kf(n.selection,on.type(e));if(!o)return!1;const{node:s,pos:a}=o,l={...s.attrs},{src:i,alt:c,title:u}=t;return i!==void 0&&(l.src=i),c!==void 0&&(l.alt=c),u!==void 0&&(l.title=u),r?.(n.tr.setNodeMarkup(a,void 0,l).scrollIntoView()),!0});v(oc,{displayName:"Command<updateImageCommand>",group:"Image"});var Em=ue(e=>new Je(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(t,n,r,o)=>{const[s,a,l="",i]=n;return s?t.tr.replaceWith(r,o,on.type(e).create({src:l,alt:a,title:i})):null}));v(Em,{displayName:"InputRule<insertImageInputRule>",group:"Image"});var gr=Xe("hardbreak",e=>({"data-type":"hardbreak","data-is-inline":e.attrs.isInline}));v(gr,{displayName:"Attr<hardbreak>",group:"Hardbreak"});var Ye=Ee("hardbreak",e=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:t=>t.attrs.isInline?["span",e.get(gr.key)(t)," "]:["br",e.get(gr.key)(t)],parseMarkdown:{match:({type:t})=>t==="break",runner:(t,n,r)=>{t.addNode(r,{isInline:!!n.data?.isInline})}},leafText:()=>`
|
|
1
|
+
import{d as E,r as De,be as Dn,bq as Ya,bp as tf,I as Go,c5 as Xt,c6 as Yo,c7 as vi,t as O,c8 as Ci,U as Si,W as Ai,R as Mi,c9 as Jo,q as Ni,u as tn,j as b,bQ as Lr,ca as Ei,cb as Ti,m as go,n as Ii,am as nf,ar as rf,B as Xo,cc as Ja,K as of,cd as bo,ce as Xa,cf as sf,cg as af,bU as lf,b$ as cf,c0 as Qa,c1 as uf,aw as df,ax as ff,c3 as pf,aO as mf,bM as hf}from"./index-BYUntVIZ.js";import{G as Li,nt as fe,ng as Z,nA as Y,nz as me,nj as j,nv as X,nO as Ie,p1 as Qo,p2 as gf,nq as Zo,ns as or,nk as ce,p3 as bf,p4 as jt,p5 as _n,p6 as ot,ou as le,p7 as Ri,p8 as $i,nJ as se,p9 as An,pa as es,pb as yf,pc as st,pd as kf,pe as wf,nr as yo,pf as xf,pg as ts,ph as Di,pi as Je,nL as vf,pj as Cf,nu as Ve,o6 as Sf,pk as Af,pl as _i,pm as Mf,pn as zn,n9 as Nf,na as Ef,ov as Qt,po as Tf,pp as If,pq as zi,ot as pr,pr as Lf,ps as Oi,pt as Pi,pu as Rf,pv as $f,pw as Df,px as _f,py as zf,pz as Of,pA as Pf,pB as Bf,nB as Kf,pC as jf,pD as Hf,ai as nn,eN as Ff,mo as ft,pE as qf,jG as Wf,pF as Uf,b as Mn,dm as Oe,lH as Fe,I as Bi,pG as mr,pH as Vf,nd as Gf,pI as Yf,cr as Jf,pJ as Xf,pK as Qf,nw as Zf,pL as ep,pM as tp,pN as np,fB as Ki,nV as ji,pO as rp,cW as op,pP as sp,hP as ap,pQ as lp,fV as ko,pR as Zr,N as ip,aJ as cp,kc as up,pS as dp,pT as fp,pU as pp,pV as mp,pW as hp,pX as gp,pY as bp,pZ as yp,ka as kp,k1 as wp,p_ as xp,p$ as vp,q0 as Cp,q1 as Sp,q2 as Ap,q3 as Mp,q4 as Np,q5 as Ep,q6 as Tp,q7 as Ip,q8 as Lp,q9 as Rp,qa as $p,qb as Dp,qc as _p,qd as zp,fj as Op,ow as Pp,fn as Qn,ox as eo,qe as Bp,qf as Kp,qg as jp,qh as Za,ni as el,qi as Hp,qj as Hi,qk as Fp,ql as qp,qm as Wp}from"./appStore-affnJoin.js";import{$ as Q,c as F,d as at,e as On,f as _e,g as ns,a as ve,h as Xe,b as Ee,i as rs,j as ue,k as Up}from"./index-Y2kzYlZq.js";import{s as Fi,b as Rr,e as os,d as Vp,L as tl,m as Gp,f as Yp,a as Jp,u as qi,g as Xp,h as Qp,w as Zp,l as em,j as tm,k as nm,I as nl}from"./linkFollow-Msu1XH9v.js";import"./client-BqhpYbYL.js";import{s as rm}from"./emoji-BPdA62d7.js";import{b as om,t as sm,m as am,g as lm}from"./listFold-CKxjyY5_.js";import{B as im}from"./book-open-CcXCToyx.js";const cm=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 19H5",key:"vjpgq2"}]],um=Li("text-align-center",cm);const dm=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 19H7",key:"4cu937"}]],fm=Li("text-align-end",dm);De({"settings.notes.spellcheckLabel":{zh:"拼写检查",en:"Spell check"},"settings.notes.spellcheckHint":{zh:"在笔记正文、标题和源码模式里标出拼写错误。代码块、行内代码和公式始终不检查。",en:"Underline misspellings in note text, titles, and source mode. Code blocks, inline code, and formulas are never checked."}});const ss="amadeus.notes.spellcheck",wo="amadeus:notes-spellcheck";function Wi(){try{return localStorage.getItem(ss)!=="0"}catch{return!0}}function r1(e){try{localStorage.setItem(ss,e?"1":"0")}catch{}try{window.dispatchEvent(new Event(wo))}catch{}}function Ui(e){const t=n=>{(!n.key||n.key===ss)&&e()};return window.addEventListener(wo,e),window.addEventListener("storage",t),()=>{window.removeEventListener(wo,e),window.removeEventListener("storage",t)}}function o1(){return E.useSyncExternalStore(Ui,Wi,()=>!0)}const rl={spellcheck:"false"};function ol(e){const t=[];return e.descendants((n,r)=>{if(!n.isTextblock)return!0;if(n.type.spec.code)return!1;const o=r+1;if(n.forEach((s,a)=>{s.isText&&s.marks.some(l=>l.type.spec.code||l.type.name==="inlineCode")&&t.push(Y.inline(o+a,o+a+s.nodeSize,rl))}),n.textContent.includes("$"))for(const s of Fi(Rr(n)))t.push(Y.inline(o+s.from,o+s.to,rl));return!1}),t.length?me.create(e,t):me.empty}const sl=new fe("amadeus-spellcheck"),pm=Q(()=>new Z({key:sl,state:{init:(e,t)=>ol(t.doc),apply:(e,t)=>e.docChanged?ol(e.doc):t},props:{decorations:e=>sl.getState(e),attributes:()=>({spellcheck:Wi()?"true":"false"})},view:e=>({destroy:Ui(()=>e.updateState(e.state))})}));De({"settings.notes.codeAutoPairLabel":{zh:"代码块自动补全括号",en:"Auto-close brackets in code blocks"},"settings.notes.codeAutoPairHint":{zh:"在代码块里输入左括号或引号时自动补上另一半;紧挨着再输入同一个闭合符号会直接跳过。",en:"Typing an opening bracket or quote in a code block inserts the closing half. Typing the same closing character next to it steps over it."}});const as="amadeus.notes.codeAutoPair",xo="amadeus:notes-code-autopair";function Vi(){try{return localStorage.getItem(as)!=="0"}catch{return!0}}function s1(e){try{localStorage.setItem(as,e?"1":"0")}catch{}try{window.dispatchEvent(new Event(xo))}catch{}}function mm(e){const t=n=>{(!n.key||n.key===as)&&e()};return window.addEventListener(xo,e),window.addEventListener("storage",t),()=>{window.removeEventListener(xo,e),window.removeEventListener("storage",t)}}function a1(){return E.useSyncExternalStore(mm,Vi,()=>!0)}const hr={"(":")","[":"]","{":"}",'"':'"',"'":"'","`":"`"},hm=new Set(Object.values(hr)),al=/[\p{L}\p{N}_]/u;function Gi(e,t,n){if(t!==n||!Vi())return null;const r=e.state.doc.resolve(t);return r.parent.type.name!=="code_block"?null:{text:r.parent.textContent,off:r.parentOffset}}function gm(e,t,n,r){const o=Gi(e,t,n);if(!o||r.length!==1)return!1;const s=o.text.charAt(o.off),a=o.text.charAt(o.off-1);if(hm.has(r)&&s===r)return e.dispatch(e.state.tr.setSelection(j.create(e.state.doc,t+1))),!0;const l=hr[r];if(!l||al.test(s)||l===r&&al.test(a))return!1;const i=e.state.tr.insertText(r+l,t,n);return i.setSelection(j.create(i.doc,t+1)),e.dispatch(i),!0}function bm(e){const{from:t,to:n}=e.state.selection,r=Gi(e,t,n);if(!r||r.off===0)return!1;const o=r.text.charAt(r.off-1);return!hr[o]||r.text.charAt(r.off)!==hr[o]?!1:(e.dispatch(e.state.tr.delete(t-1,t+1)),!0)}function ym(e,t){return function(n,r){let{$from:o,$to:s,node:a}=n.selection;if(a&&a.isBlock||o.depth<2||!o.sameParent(s))return!1;let l=o.node(-1);if(l.type!=e)return!1;if(o.parent.content.size==0&&o.node(-1).childCount==o.indexAfter(-1)){if(o.depth==3||o.node(-3).type!=e||o.index(-2)!=o.node(-2).childCount-1)return!1;if(r){let d=X.empty,f=o.index(-1)?1:o.index(-2)?2:3;for(let w=o.depth-f;w>=o.depth-3;w--)d=X.from(o.node(w).copy(d));let m=o.indexAfter(-1)<o.node(-2).childCount?1:o.indexAfter(-2)<o.node(-3).childCount?2:3;d=d.append(X.from(e.createAndFill()));let p=o.before(o.depth-(f-1)),h=n.tr.replace(p,o.after(-m),new Ie(d,4-f,0)),g=-1;h.doc.nodesBetween(p,h.doc.content.size,(w,y)=>{if(g>-1)return!1;w.isTextblock&&w.content.size==0&&(g=y+1)}),g>-1&&h.setSelection(ce.near(h.doc.resolve(g))),r(h.scrollIntoView())}return!0}let i=s.pos==o.end()?l.contentMatchAt(0).defaultType:null,c=n.tr.delete(o.pos,s.pos),u=i?[null,{type:i}]:void 0;return bf(c.doc,o.pos,2,u)?(r&&r(c.split(o.pos,2,u).scrollIntoView()),!0):!1}}function Yi(e){return function(t,n){let{$from:r,$to:o}=t.selection,s=r.blockRange(o,a=>a.childCount>0&&a.firstChild.type==e);return s?n?r.node(s.depth-1).type==e?km(t,n,e,s):wm(t,n,s):!0:!1}}function km(e,t,n,r){let o=e.tr,s=r.end,a=r.$to.end(r.depth);s<a&&(o.step(new Qo(s-1,a,s,a,new Ie(X.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new gf(o.doc.resolve(r.$from.pos),o.doc.resolve(a),r.depth));const l=Zo(r);if(l==null)return!1;o.lift(r,l);let i=o.doc.resolve(o.mapping.map(s,-1)-1);return or(o.doc,i.pos)&&i.nodeBefore.type==i.nodeAfter.type&&o.join(i.pos),t(o.scrollIntoView()),!0}function wm(e,t,n){let r=e.tr,o=n.parent;for(let m=n.end,p=n.endIndex-1,h=n.startIndex;p>h;p--)m-=o.child(p).nodeSize,r.delete(m-1,m+1);let s=r.doc.resolve(n.start),a=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,i=n.endIndex==o.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(l?0:1),u+1,a.content.append(i?X.empty:X.from(o))))return!1;let d=s.pos,f=d+a.nodeSize;return r.step(new Qo(d-(l?1:0),f+(i?1:0),d+1,f-1,new Ie((l?X.empty:X.from(o.copy(X.empty))).append(i?X.empty:X.from(o.copy(X.empty))),l?0:1,i?0:1),l?0:1)),t(r.scrollIntoView()),!0}function Ji(e){return function(t,n){let{$from:r,$to:o}=t.selection,s=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==e);if(!s)return!1;let a=s.startIndex;if(a==0)return!1;let l=s.parent,i=l.child(a-1);if(i.type!=e)return!1;if(n){let c=i.lastChild&&i.lastChild.type==l.type,u=X.from(c?e.create():null),d=new Ie(X.from(e.create(null,X.from(l.type.create(null,u)))),c?3:1,0),f=s.start,m=s.end;n(t.tr.step(new Qo(f-(c?3:1),m,f,m,d,1,!0)).scrollIntoView())}return!0}}function xm(e){const t=new Map;if(!e||!e.type)throw new Error("mdast-util-definitions expected node");return Dn(e,"definition",function(r){const o=ll(r.identifier);o&&!t.get(o)&&t.set(o,r)}),n;function n(r){const o=ll(r);return t.get(o)}}function ll(e){return String(e||"").toUpperCase()}function vm(){return function(e){const t=xm(e);Dn(e,function(n,r,o){if(n.type==="definition"&&o!==void 0&&typeof r=="number")return o.children.splice(r,1),[Ya,r];if(n.type==="imageReference"||n.type==="linkReference"){const s=t(n.identifier);if(s&&o&&typeof r=="number")return o.children[r]=n.type==="imageReference"?{type:"image",url:s.url,title:s.title,alt:n.alt}:{type:"link",url:s.url,title:s.title,children:n.children},[Ya,r]}})}}function Xi(e,t){if(!(t.childCount>=1&&t.lastChild?.type.name==="hardbreak")){e.next(t.content);return}const n=[];t.content.forEach((r,o,s)=>{s!==t.childCount-1&&n.push(r)}),e.next(X.fromArray(n))}function v(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-commonmark",...t}}),e}var ls=On("emphasis");v(ls,{displayName:"Attr<emphasis>",group:"Emphasis"});var Nt=at("emphasis",e=>({attrs:{marker:{default:e.get(jt).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:t=>t==="italic"}],toDOM:t=>["em",e.get(ls.key)(t)],parseMarkdown:{match:t=>t.type==="emphasis",runner:(t,n,r)=>{t.openMark(r,{marker:n.marker}),t.next(n.children),t.closeMark(r)}},toMarkdown:{match:t=>t.type.name==="emphasis",runner:(t,n)=>{t.withMark(n,"emphasis",void 0,{marker:n.attrs.marker})}}}));v(Nt.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"});v(Nt.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});var $r=F("ToggleEmphasis",e=>()=>_n(Nt.type(e)));v($r,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});var is=ue(e=>st(/(?:^|[^*])\*([^*]+)\*$/,Nt.type(e),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:t,start:n})=>t.startsWith("*")?{}:{fullMatch:t.slice(1),start:n+1}}));v(is,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});var cs=ue(e=>st(/\b_(?![_\s])(.*?[^_\s])_\b/,Nt.type(e),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:t,start:n})=>t.startsWith("_")?{}:{fullMatch:t.slice(1),start:n+1}}));v(cs,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});var us=_e("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:e=>{const t=e.get(se);return()=>t.call($r.key)}}});v(us.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"});v(us.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});var ds=On("strong");v(ds,{displayName:"Attr<strong>",group:"Strong"});var rn=at("strong",e=>({attrs:{marker:{default:e.get(jt).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:t=>t.style.fontWeight!="normal"&&null},{tag:"strong"},{style:"font-style",getAttrs:t=>t==="bold"},{style:"font-weight=400",clearMark:t=>t.type.name=="strong"},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM:t=>["strong",e.get(ds.key)(t)],parseMarkdown:{match:t=>t.type==="strong",runner:(t,n,r)=>{t.openMark(r,{marker:n.marker}),t.next(n.children),t.closeMark(r)}},toMarkdown:{match:t=>t.type.name==="strong",runner:(t,n)=>{t.withMark(n,"strong",void 0,{marker:n.attrs.marker})}}}));v(rn.mark,{displayName:"MarkSchema<strong>",group:"Strong"});v(rn.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});var Dr=F("ToggleStrong",e=>()=>_n(rn.type(e)));v(Dr,{displayName:"Command<toggleStrongCommand>",group:"Strong"});var fs=ue(e=>st(new RegExp("(?<![\\w:/])(?:\\*\\*|__)([^*_]+?)(?:\\*\\*|__)(?![\\w/])$"),rn.type(e),{getAttr:t=>({marker:t[0].startsWith("*")?"*":"_"})}));v(fs,{displayName:"InputRule<strong>",group:"Strong"});var ps=_e("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:e=>{const t=e.get(se);return()=>t.call(Dr.key)}}});v(ps.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"});v(ps.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});var ms=On("inlineCode");v(ms,{displayName:"Attr<inlineCode>",group:"InlineCode"});var dt=at("inlineCode",e=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:t=>["code",e.get(ms.key)(t)],parseMarkdown:{match:t=>t.type==="inlineCode",runner:(t,n,r)=>{t.openMark(r),t.addText(n.value),t.closeMark(r)}},toMarkdown:{match:t=>t.type.name==="inlineCode",runner:(t,n,r)=>(t.withMark(n,"inlineCode",r.text||""),!0)}}));v(dt.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"});v(dt.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});var _r=F("ToggleInlineCode",e=>()=>(t,n)=>{const{selection:r,tr:o}=t;if(r.empty)return!1;const{from:s,to:a}=r;return t.doc.rangeHasMark(s,a,dt.type(e))?(n?.(o.removeMark(s,a,dt.type(e))),!0):(Object.keys(t.schema.marks).filter(l=>l!==dt.type.name).map(l=>t.schema.marks[l]).forEach(l=>{o.removeMark(s,a,l)}),n?.(o.addMark(s,a,dt.type(e).create())),!0)});v(_r,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});var hs=ue(e=>st(/(?:`)([^`]+)(?:`)$/,dt.type(e)));v(hs,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});var gs=_e("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:e=>{const t=e.get(se);return()=>t.call(_r.key)}}});v(gs.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"});v(gs.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});var zr=On("link");v(zr,{displayName:"Attr<link>",group:"Link"});var Ge=at("link",e=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:t=>{if(!(t instanceof HTMLElement))throw ot(t);return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM:t=>["a",{...e.get(zr.key)(t),...t.attrs}],parseMarkdown:{match:t=>t.type==="link",runner:(t,n,r)=>{const o=n.url,s=n.title;t.openMark(r,{href:o,title:s}),t.next(n.children),t.closeMark(r)}},toMarkdown:{match:t=>t.type.name==="link",runner:(t,n)=>{t.withMark(n,"link",void 0,{title:n.attrs.title,url:n.attrs.href})}}}));v(Ge.mark,{displayName:"MarkSchema<link>",group:"Link"});var Qi=F("ToggleLink",e=>(t={})=>_n(Ge.type(e),t));v(Qi,{displayName:"Command<toggleLinkCommand>",group:"Link"});var Zi=F("UpdateLink",e=>(t={})=>(n,r)=>{if(!r)return!1;let o,s=-1;const{selection:a}=n,{from:l,to:i}=a;if(n.doc.nodesBetween(l,l===i?i+1:i,(p,h)=>{if(Ge.type(e).isInSet(p.marks))return o=p,s=h,!1}),!o)return!1;const c=o.marks.find(({type:p})=>p===Ge.type(e));if(!c)return!1;const u=s,d=s+o.nodeSize,{tr:f}=n,m=Ge.type(e).create({...c.attrs,...t});return m?(r(f.removeMark(u,d,c).addMark(u,d,m).setSelection(new j(f.selection.$anchor)).scrollIntoView()),!0):!1});v(Zi,{displayName:"Command<updateLinkCommand>",group:"Link"});var bs=ns("doc",()=>({content:"block+",parseMarkdown:{match:({type:e})=>e==="root",runner:(e,t,n)=>{e.injectRoot(t,n)}},toMarkdown:{match:e=>e.type.name==="doc",runner:(e,t)=>{e.openNode("root"),e.next(t.content)}}}));v(bs,{displayName:"NodeSchema<doc>",group:"Doc"});function Cm(e){return tf(e,t=>t.type==="html"&&["<br />","<br>","<br >","<br/>"].includes(t.value?.trim()),(t,n)=>{if(!n.length)return;const r=n[n.length-1];if(!r)return;const o=r.children.indexOf(t);o!==-1&&r.children.splice(o,1)},!0)}var Or=ve("remark-preserve-empty-line",()=>()=>Cm);v(Or.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"});v(Or.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});var Pr=Xe("paragraph");v(Pr,{displayName:"Attr<paragraph>",group:"Paragraph"});var Be=Ee("paragraph",e=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:t=>["p",e.get(Pr.key)(t),0],parseMarkdown:{match:t=>t.type==="paragraph",runner:(t,n,r)=>{t.openNode(r),n.children?t.next(n.children):t.addText(n.value||""),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="paragraph",runner:(t,n)=>{const r=e.get(le).state?.doc.lastChild;t.openNode("paragraph"),(!n.content||n.content.size===0)&&n!==r&&Sm(e)?t.addNode("html",void 0,"<br />"):Xi(t,n),t.closeNode()}}}));function Sm(e){let t=!1;try{e.get(Or.id),t=!0}catch{t=!1}return t}v(Be.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"});v(Be.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});var ys=F("TurnIntoText",e=>()=>An(Be.type(e)));v(ys,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});var ks=_e("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:e=>{const t=e.get(se);return()=>t.call(ys.key)}}});v(ks.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"});v(ks.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});var Am=Array(6).fill(0).map((e,t)=>t+1);function Mm(e){return e.textContent.toLowerCase().trim().replace(/\s+/g,"-")}var Pn=rs(Mm,"headingIdGenerator");v(Pn,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});var Br=Xe("heading");v(Br,{displayName:"Attr<heading>",group:"Heading"});var rt=Ee("heading",e=>{const t=e.get(Pn.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:Am.map(n=>({tag:`h${n}`,getAttrs:r=>{if(!(r instanceof HTMLElement))throw ot(r);return{level:n,id:r.id}}})),toDOM:n=>[`h${n.attrs.level}`,{...e.get(Br.key)(n),id:n.attrs.id||t(n)},0],parseMarkdown:{match:({type:n})=>n==="heading",runner:(n,r,o)=>{const s=r.depth;n.openNode(o,{level:s}),n.next(r.children),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="heading",runner:(n,r)=>{n.openNode("heading",void 0,{depth:r.attrs.level}),Xi(n,r),n.closeNode()}}}});v(rt.node,{displayName:"NodeSchema<heading>",group:"Heading"});v(rt.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});var ec=ue(e=>Di(/^(?<hashes>#+)\s$/,rt.type(e),t=>{const n=t.groups?.hashes?.length||0,{$from:r}=e.get(le).state.selection,o=r.node();if(o.type.name==="heading"){let s=Number(o.attrs.level)+Number(n);return s>6&&(s=6),{level:s}}return{level:n}}));v(ec,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});var kt=F("WrapInHeading",e=>t=>(t??=1,t<1?An(Be.type(e)):An(rt.type(e),{level:t})));v(kt,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});var ws=F("DowngradeHeading",e=>()=>(t,n,r)=>{const{$from:o}=t.selection,s=o.node();if(s.type!==rt.type(e)||!t.selection.empty||o.parentOffset!==0)return!1;const a=s.attrs.level-1;return a?(n?.(t.tr.setNodeMarkup(t.selection.$from.before(),void 0,{...s.attrs,level:a})),!0):An(Be.type(e))(t,n,r)});v(ws,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});var xs=_e("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:e=>{const t=e.get(se);return()=>t.call(kt.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:e=>{const t=e.get(se);return()=>t.call(kt.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:e=>{const t=e.get(se);return()=>t.call(kt.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:e=>{const t=e.get(se);return()=>t.call(kt.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:e=>{const t=e.get(se);return()=>t.call(kt.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:e=>{const t=e.get(se);return()=>t.call(kt.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:e=>{const t=e.get(se);return()=>t.call(ws.key)}}});v(xs.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"});v(xs.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});var Kr=Xe("blockquote");v(Kr,{displayName:"Attr<blockquote>",group:"Blockquote"});var At=Ee("blockquote",e=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:t=>["blockquote",e.get(Kr.key)(t),0],parseMarkdown:{match:({type:t})=>t==="blockquote",runner:(t,n,r)=>{t.openNode(r).next(n.children).closeNode()}},toMarkdown:{match:t=>t.type.name==="blockquote",runner:(t,n)=>{t.openNode("blockquote").next(n.content).closeNode()}}}));v(At.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"});v(At.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});var tc=ue(e=>ts(/^\s*>\s$/,At.type(e)));v(tc,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});var vs=F("WrapInBlockquote",e=>()=>es(At.type(e)));v(vs,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});var Cs=_e("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:e=>{const t=e.get(se);return()=>t.call(vs.key)}}});v(Cs.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"});v(Cs.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});var Ss=Xe("codeBlock",()=>({pre:{},code:{}}));v(Ss,{displayName:"Attr<codeBlock>",group:"CodeBlock"});var Bn=Ee("code_block",e=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:"",validate:"string"}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>{if(!(t instanceof HTMLElement))throw ot(t);return{language:t.dataset.language}}}],toDOM:t=>{const n=e.get(Ss.key)(t),r=t.attrs.language,o=r&&r.length>0?{"data-language":r}:void 0;return["pre",{...n.pre,...o},["code",n.code,0]]},parseMarkdown:{match:({type:t})=>t==="code",runner:(t,n,r)=>{const o=n.lang??"",s=n.value;t.openNode(r,{language:o}),s&&t.addText(s),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="code_block",runner:(t,n)=>{t.addNode("code",void 0,n.content.firstChild?.text||"",{lang:n.attrs.language})}}}));v(Bn.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"});v(Bn.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});var nc=ue(e=>Di(/^```(?<language>[a-z]*)?[\s\n]$/,Bn.type(e),t=>({language:t.groups?.language??""})));v(nc,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});var As=F("CreateCodeBlock",e=>(t="")=>An(Bn.type(e),{language:t}));v(As,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"});var Nm=F("UpdateCodeBlockLanguage",()=>({pos:e,language:t}={pos:-1,language:""})=>(n,r)=>e>=0?(r?.(n.tr.setNodeAttribute(e,"language",t)),!0):!1);v(Nm,{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});var Ms=_e("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:e=>{const t=e.get(se);return()=>t.call(As.key)}}});v(Ms.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"});v(Ms.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});var Ns=Xe("image");v(Ns,{displayName:"Attr<image>",group:"Image"});var on=Ee("image",e=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:"",validate:"string"},alt:{default:"",validate:"string"},title:{default:"",validate:"string"}},parseDOM:[{tag:"img[src]",getAttrs:t=>{if(!(t instanceof HTMLElement))throw ot(t);return{src:t.getAttribute("src")||"",alt:t.getAttribute("alt")||"",title:t.getAttribute("title")||t.getAttribute("alt")||""}}}],toDOM:t=>["img",{...e.get(Ns.key)(t),...t.attrs}],parseMarkdown:{match:({type:t})=>t==="image",runner:(t,n,r)=>{const o=n.url,s=n.alt,a=n.title;t.addNode(r,{src:o,alt:s,title:a})}},toMarkdown:{match:t=>t.type.name==="image",runner:(t,n)=>{t.addNode("image",void 0,void 0,{title:n.attrs.title,url:n.attrs.src,alt:n.attrs.alt})}}}));v(on.node,{displayName:"NodeSchema<image>",group:"Image"});v(on.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});var rc=F("InsertImage",e=>(t={})=>(n,r)=>{if(!r)return!0;const{src:o="",alt:s="",title:a=""}=t,l=on.type(e).create({src:o,alt:s,title:a});return l&&r(n.tr.replaceSelectionWith(l).scrollIntoView()),!0});v(rc,{displayName:"Command<insertImageCommand>",group:"Image"});var oc=F("UpdateImage",e=>(t={})=>(n,r)=>{const o=kf(n.selection,on.type(e));if(!o)return!1;const{node:s,pos:a}=o,l={...s.attrs},{src:i,alt:c,title:u}=t;return i!==void 0&&(l.src=i),c!==void 0&&(l.alt=c),u!==void 0&&(l.title=u),r?.(n.tr.setNodeMarkup(a,void 0,l).scrollIntoView()),!0});v(oc,{displayName:"Command<updateImageCommand>",group:"Image"});var Em=ue(e=>new Je(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(t,n,r,o)=>{const[s,a,l="",i]=n;return s?t.tr.replaceWith(r,o,on.type(e).create({src:l,alt:a,title:i})):null}));v(Em,{displayName:"InputRule<insertImageInputRule>",group:"Image"});var gr=Xe("hardbreak",e=>({"data-type":"hardbreak","data-is-inline":e.attrs.isInline}));v(gr,{displayName:"Attr<hardbreak>",group:"Hardbreak"});var Ye=Ee("hardbreak",e=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:t=>t.attrs.isInline?["span",e.get(gr.key)(t)," "]:["br",e.get(gr.key)(t)],parseMarkdown:{match:({type:t})=>t==="break",runner:(t,n,r)=>{t.addNode(r,{isInline:!!n.data?.isInline})}},leafText:()=>`
|
|
2
2
|
`,toMarkdown:{match:t=>t.type.name==="hardbreak",runner:(t,n)=>{n.attrs.isInline?t.addNode("text",void 0,`
|
|
3
3
|
`):t.addNode("break")}}}));v(Ye.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"});v(Ye.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});var Es=F("InsertHardbreak",e=>()=>(t,n)=>{const{selection:r,tr:o}=t;if(!(r instanceof j))return!1;if(r.empty){const s=r.$from.node();if(s.childCount>0&&s.lastChild?.type.name==="hardbreak")return n?.(o.replaceRangeWith(r.to-1,r.to,t.schema.node("paragraph")).setSelection(ce.near(o.doc.resolve(r.to))).scrollIntoView()),!0}return n?.(o.setMeta("hardbreak",!0).replaceSelectionWith(Ye.type(e).create()).scrollIntoView()),!0});v(Es,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});var Ts=_e("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:e=>{const t=e.get(se);return()=>t.call(Es.key)}}});v(Ts.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"});v(Ts.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});var Is=Xe("hr");v(Is,{displayName:"Attr<hr>",group:"Hr"});var Kn=Ee("hr",e=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:t=>["hr",e.get(Is.key)(t)],parseMarkdown:{match:({type:t})=>t==="thematicBreak",runner:(t,n,r)=>{t.addNode(r)}},toMarkdown:{match:t=>t.type.name==="hr",runner:t=>{t.addNode("thematicBreak")}}}));v(Kn.node,{displayName:"NodeSchema<hr>",group:"Hr"});v(Kn.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});var sc=ue(e=>new Je(/^(?:---|___\s|\*\*\*\s)$/,(t,n,r,o)=>{const{tr:s}=t;return n[0]&&s.replaceWith(r-1,o,Kn.type(e).create()),s}));v(sc,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});var ac=F("InsertHr",e=>()=>(t,n)=>{if(!n)return!0;const r=Be.node.type(e).create(),{tr:o,selection:s}=t,{from:a}=s,l=Kn.type(e).create();if(!l)return!0;const i=o.replaceSelectionWith(l).insert(a,r),c=ce.findFrom(i.doc.resolve(a),1,!0);return c&&n(i.setSelection(c).scrollIntoView()),!0});v(ac,{displayName:"Command<insertHrCommand>",group:"Hr"});var jr=Xe("bulletList");v(jr,{displayName:"Attr<bulletList>",group:"BulletList"});var mt=Ee("bullet_list",e=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:t=>{if(!(t instanceof HTMLElement))throw ot(t);return{spread:t.dataset.spread==="true"}}}],toDOM:t=>["ul",{...e.get(jr.key)(t),"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:t,ordered:n})=>t==="list"&&!n,runner:(t,n,r)=>{const o=n.spread!=null?`${n.spread}`:"false";t.openNode(r,{spread:o}).next(n.children).closeNode()}},toMarkdown:{match:t=>t.type.name==="bullet_list",runner:(t,n)=>{t.openNode("list",void 0,{ordered:!1,spread:n.attrs.spread}).next(n.content).closeNode()}}}));v(mt.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"});v(mt.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});var lc=ue(e=>ts(/^\s*([-+*])\s$/,mt.type(e)));v(lc,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});var Ls=F("WrapInBulletList",e=>()=>es(mt.type(e)));v(Ls,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});var Rs=_e("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:e=>{const t=e.get(se);return()=>t.call(Ls.key)}}});v(Rs.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"});v(Rs.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});var Hr=Xe("orderedList");v(Hr,{displayName:"Attr<orderedList>",group:"OrderedList"});var ht=Ee("ordered_list",e=>({content:"listItem+",group:"block",attrs:{order:{default:1,validate:"number"},spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ol",getAttrs:t=>{if(!(t instanceof HTMLElement))throw ot(t);return{spread:t.dataset.spread,order:t.hasAttribute("start")?Number(t.getAttribute("start")):1}}}],toDOM:t=>["ol",{...e.get(Hr.key)(t),...t.attrs.order===1?{}:{start:t.attrs.order},"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:t,ordered:n})=>t==="list"&&!!n,runner:(t,n,r)=>{const o=n.spread!=null?`${n.spread}`:"true";t.openNode(r,{spread:o,order:n.start??1}).next(n.children).closeNode()}},toMarkdown:{match:t=>t.type.name==="ordered_list",runner:(t,n)=>{t.openNode("list",void 0,{ordered:!0,start:n.attrs.order??1,spread:n.attrs.spread==="true"}),t.next(n.content),t.closeNode()}}}));v(ht.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"});v(ht.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});var ic=ue(e=>ts(/^\s*(\d+)\.\s$/,ht.type(e),t=>({order:Number(t[1])}),(t,n)=>n.childCount+n.attrs.order===Number(t[1])));v(ic,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});var $s=F("WrapInOrderedList",e=>()=>es(ht.type(e)));v($s,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});var Ds=_e("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:e=>{const t=e.get(se);return()=>t.call($s.key)}}});v(Ds.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"});v(Ds.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});var _s=Xe("listItem");v(_s,{displayName:"Attr<listItem>",group:"ListItem"});var bt=Ee("list_item",e=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"•",validate:"string"},listType:{default:"bullet",validate:"string"},spread:{default:!0,validate:"boolean"}},defining:!0,parseDOM:[{tag:"li",getAttrs:t=>{if(!(t instanceof HTMLElement))throw ot(t);return{label:t.dataset.label,listType:t.dataset.listType,spread:t.dataset.spread==="true"}}}],toDOM:t=>["li",{...e.get(_s.key)(t),"data-label":t.attrs.label,"data-list-type":t.attrs.listType,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:t})=>t==="listItem",runner:(t,n,r)=>{const o=n.label!=null?`${n.label}.`:"•",s=n.label!=null?"ordered":"bullet",a=n.spread!=null?`${n.spread}`:"true";t.openNode(r,{label:o,listType:s,spread:a}),t.next(n.children),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="list_item",runner:(t,n)=>{t.openNode("listItem",void 0,{spread:n.attrs.spread}),t.next(n.content),t.closeNode()}}}));v(bt.node,{displayName:"NodeSchema<listItem>",group:"ListItem"});v(bt.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});var zs=F("SinkListItem",e=>()=>Ji(bt.type(e)));v(zs,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});var Os=F("LiftListItem",e=>()=>Yi(bt.type(e)));v(Os,{displayName:"Command<liftListItemCommand>",group:"ListItem"});var Ps=F("SplitListItem",e=>()=>ym(bt.type(e)));v(Ps,{displayName:"Command<splitListItemCommand>",group:"ListItem"});function Tm(e){return(t,n,r)=>{const{selection:o}=t;if(!(o instanceof j))return!1;const{empty:s,$from:a}=o;return!s||a.parentOffset!==0||a.node(-1).type!==bt.type(e)?!1:yf(t,n,r)}}var Bs=F("LiftFirstListItem",e=>()=>Tm(e));v(Bs,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});var Ks=_e("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:e=>{const t=e.get(se);return()=>t.call(Ps.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:e=>{const t=e.get(se);return()=>t.call(zs.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:e=>{const t=e.get(se);return()=>t.call(Os.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:e=>{const t=e.get(se);return()=>t.call(Bs.key)}}});v(Ks.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"});v(Ks.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});var cc=ns("text",()=>({group:"inline",parseMarkdown:{match:({type:e})=>e==="text",runner:(e,t)=>{e.addText(t.value)}},toMarkdown:{match:e=>e.type.name==="text",runner:(e,t)=>{e.addNode("text",void 0,t.text)}}}));v(cc,{displayName:"NodeSchema<text>",group:"Text"});var js=Xe("html");v(js,{displayName:"Attr<html>",group:"Html"});var Hs=Ee("html",e=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:t=>{const n=document.createElement("span"),r={...e.get(js.key)(t),"data-value":t.attrs.value,"data-type":"html"};return n.textContent=t.attrs.value,["span",r,t.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:t=>({value:t.dataset.value??""})}],parseMarkdown:{match:({type:t})=>t==="html",runner:(t,n,r)=>{t.addNode(r,{value:n.value})}},toMarkdown:{match:t=>t.type.name==="html",runner:(t,n)=>{t.addNode("html",void 0,n.attrs.value)}}}));v(Hs.node,{displayName:"NodeSchema<html>",group:"Html"});v(Hs.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});var Im=[bs,Pr,Be,Pn,Br,rt,gr,Ye,Kr,At,Ss,Bn,Is,Kn,Ns,on,jr,mt,Hr,ht,_s,bt,ls,Nt,ds,rn,ms,dt,zr,Ge,js,Hs,cc].flat(),Lm=[tc,lc,ic,nc,sc,ec].flat(),Rm=[is,cs,hs,fs],$m=F("IsMarkSelected",()=>e=>t=>{if(!e)return!1;const{doc:n,selection:r}=t;return n.rangeHasMark(r.from,r.to,e)}),Dm=F("IsNoteSelected",()=>e=>t=>e?wf(t,e).hasNode:!1),_m=F("ClearTextInCurrentBlock",()=>()=>(e,t)=>{let n=e.tr;const{$from:r,$to:o}=n.selection,{pos:s}=r,{pos:a}=o,l=s-r.node().content.size;return l<0?!1:(n=n.deleteRange(l,a),t?.(n),!0)}),zm=F("SetBlockType",()=>e=>(t,n)=>{const{nodeType:r,attrs:o=null}=e??{};if(!r)return!1;const s=t.tr,{from:a,to:l}=s.selection;try{s.setBlockType(a,l,r,o)}catch{return!1}return n?.(s),!0}),Om=F("WrapInBlockType",()=>e=>(t,n)=>{const{nodeType:r,attrs:o=null}=e??{};if(!r)return!1;let s=t.tr;try{const{$from:a,$to:l}=s.selection,i=a.blockRange(l),c=i&&yo(i,r,o);if(!c)return!1;s=s.wrap(i,c)}catch{return!1}return n?.(s),!0}),Pm=F("AddBlockType",()=>e=>(t,n)=>{const{nodeType:r,attrs:o=null}=e??{};if(!r)return!1;const s=t.tr;try{const a=r instanceof xf?r:r.createAndFill(o);if(!a)return!1;s.replaceSelectionWith(a)}catch{return!1}return n?.(s),!0}),Bm=F("SelectTextNearPos",()=>e=>(t,n)=>{const{pos:r}=e??{};if(r==null)return!1;const o=(a,l,i)=>Math.min(Math.max(a,l),i),s=t.tr;try{const a=t.doc.resolve(o(r,0,t.doc.content.size));s.setSelection(j.near(a))}catch{return!1}return n?.(s.scrollIntoView()),!0}),Km=[ys,vs,kt,ws,As,Es,ac,rc,oc,$s,Ls,zs,Ps,Os,Bs,$r,_r,Dr,Qi,Zi,$m,Dm,_m,zm,Om,Pm,Bm],jm=[Cs,Ms,Ts,xs,Ks,Ds,Rs,ks,us,gs,ps].flat(),Fr=ve("remarkAddOrderInList",()=>()=>e=>{Dn(e,"list",t=>{if(t.ordered){const n=t.start??1;t.children.forEach((r,o)=>{r.label=o+n})}})});v(Fr.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"});v(Fr.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});var Fs=ve("remarkLineBreak",()=>()=>e=>{const t=/[\t ]*(?:\r?\n|\r)/g;Dn(e,"text",(n,r,o)=>{if(!n.value||typeof n.value!="string")return;const s=[];let a=0;t.lastIndex=0;let l=t.exec(n.value);for(;l;){const i=l.index;a!==i&&s.push({type:"text",value:n.value.slice(a,i)}),s.push({type:"break",data:{isInline:!0}}),a=i+l[0].length,l=t.exec(n.value)}if(s.length>0&&o&&typeof r=="number")return a<n.value.length&&s.push({type:"text",value:n.value.slice(a)}),o.children.splice(r,1,...s),r+s.length})});v(Fs.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"});v(Fs.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});var qs=ve("remarkInlineLink",()=>vm);v(qs.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"});v(qs.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});var Hm=e=>!!e.children,Fm=e=>e.type==="html";function qm(e,t){return n(e,0,null)[0];function n(r,o,s){if(Hm(r)){const a=[];for(let l=0,i=r.children.length;l<i;l++){const c=r.children[l];if(c){const u=n(c,l,r);if(u)for(let d=0,f=u.length;d<f;d++){const m=u[d];m&&a.push(m)}}}r.children=a}return t(r,o,s)}}var Wm=["root","blockquote","listItem"],Ws=ve("remarkHTMLTransformer",()=>()=>e=>{qm(e,(t,n,r)=>Fm(t)?(r&&Wm.includes(r.type)&&(t.children=[{...t}],delete t.value,t.type="paragraph"),[t]):[t])});v(Ws.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"});v(Ws.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});var Us=ve("remarkMarker",()=>()=>(e,t)=>{const n=r=>t.value.charAt(r.position.start.offset);Dn(e,r=>["strong","emphasis"].includes(r.type),r=>{r.marker=n(r)})});v(Us.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"});v(Us.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});var uc=Q(()=>{let e=!1;const t=new Z({key:new fe("MILKDOWN_INLINE_NODES_CURSOR"),state:{init(){return!1},apply(n){if(!n.selection.empty)return!1;const r=n.selection.$from,o=r.nodeBefore,s=r.nodeAfter;return!!(o&&s&&o.isInline&&!o.isText&&s.isInline&&!s.isText)}},props:{handleDOMEvents:{compositionend:(n,r)=>e?(e=!1,requestAnimationFrame(()=>{if(t.getState(n.state)){const o=n.state.selection.from;r.preventDefault(),n.dispatch(n.state.tr.insertText(r.data||"",o))}}),!0):!1,compositionstart:n=>(t.getState(n.state)&&(e=!0),!1),beforeinput:(n,r)=>{if(t.getState(n.state)&&r instanceof InputEvent&&r.data&&!e){const o=n.state.selection.from;return r.preventDefault(),n.dispatch(n.state.tr.insertText(r.data||"",o)),!0}return!1}},decorations(n){if(t.getState(n)){const r=n.selection.$from.pos,o=document.createElement("span"),s=Y.widget(r,o,{side:-1}),a=document.createElement("span"),l=Y.widget(r,a);return setTimeout(()=>{o.contentEditable="true",a.contentEditable="true"}),me.create(n.doc,[s,l])}return me.empty}}});return t});v(uc,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});var Vs=Q(e=>new Z({key:new fe("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(t,n,r)=>{if(!t.length)return;const[o]=t;if(!o)return;const[s]=o.steps;if(o.getMeta("hardbreak")){if(!(s instanceof Ri))return;const{from:a}=s;return r.tr.setNodeMarkup(a,Ye.type(e),void 0,[])}if(s instanceof $i){let a=r.tr;const{from:l,to:i}=s;return r.doc.nodesBetween(l,i,(c,u)=>{c.type===Ye.type(e)&&(a=a.setNodeMarkup(u,Ye.type(e),void 0,[]))}),a}}}));v(Vs,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});var Gs=rs(["table","code_block"],"hardbreakFilterNodes");v(Gs,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});var dc=Q(e=>{const t=e.get(Gs.key);return new Z({key:new fe("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(n,r)=>{const o=n.getMeta("hardbreak"),[s]=n.steps;if(o&&s){const{from:a}=s,l=r.doc.resolve(a);let i=l.depth,c=!0;for(;i>0;)t.includes(l.node(i).type.name)&&(c=!1),i--;return c}return!0}})});v(dc,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});var fc=Q(e=>{const t=new fe("MILKDOWN_HEADING_ID"),n=r=>{if(r.composing)return;const o=e.get(Pn.key),s=r.state.tr.setMeta("addToHistory",!1);let a=!1;const l={};r.state.doc.descendants((i,c)=>{if(i.type===rt.type(e)){if(i.textContent.trim().length===0)return;const u=i.attrs;let d=o(i);l[d]?(l[d]+=1,d+=`-#${l[d]}`):l[d]=1,u.id!==d&&(a=!0,s.setMeta(t,!0).setNodeMarkup(c,void 0,{...u,id:d}))}}),a&&r.dispatch(s)};return new Z({key:t,view:r=>(n(r),{update:(o,s)=>{o.state.doc.eq(s.doc)||n(o)}})})});v(fc,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});var pc=Q(e=>{const t=(n,r,o)=>{if(!o.selection||n.some(d=>d.getMeta("addToHistory")===!1||!d.isGeneric))return null;const s=ht.type(e),a=mt.type(e),l=bt.type(e),i=(d,f,m=1)=>{let p=!1;const h=`${f+m}.`;return d.label!==h&&(d.label=h,p=!0),p};let c=o.tr,u=!1;return o.doc.descendants((d,f,m,p)=>{if(d.type===a){const h=d.maybeChild(0);h?.type===l&&h.attrs.listType==="ordered"&&(u=!0,c.setNodeMarkup(f,s,{spread:"true"}),d.descendants((g,w,y,C)=>{if(g.type===l){const N={...g.attrs};i(N,C)&&(c=c.setNodeMarkup(w,void 0,N))}return!1}))}else if(d.type===l&&m?.type===s){const h={...d.attrs};let g=!1;h.listType!=="ordered"&&(h.listType="ordered",g=!0),m?.maybeChild(0)&&(g=i(h,p,m?.attrs.order??1)),g&&(c=c.setNodeMarkup(f,void 0,h),u=!0)}}),u?c.setMeta("addToHistory",!1):null};return new Z({key:new fe("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:t})});v(pc,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});var Um=[Vs,Gs,dc,uc,Fr,qs,Fs,Ws,Us,Or,fc,pc].flat(),Vm=[Im,Lm,Rm,Km,jm,Um].flat();let vo,Co;if(typeof WeakMap<"u"){let e=new WeakMap;vo=t=>e.get(t),Co=(t,n)=>(e.set(t,n),n)}else{const e=[];let n=0;vo=r=>{for(let o=0;o<e.length;o+=2)if(e[o]==r)return e[o+1]},Co=(r,o)=>(n==10&&(n=0),e[n++]=r,e[n++]=o)}var J=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const r=t%this.width,o=t/this.width|0;let s=r+1,a=o+1;for(let l=1;s<this.width&&this.map[t+l]==n;l++)s++;for(let l=1;a<this.height&&this.map[t+this.width*l]==n;l++)a++;return{left:r,top:o,right:s,bottom:a}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:r,right:o,top:s,bottom:a}=this.findCell(e);return t=="horiz"?(n<0?r==0:o==this.width)?null:this.map[s*this.width+(n<0?r-1:o)]:(n<0?s==0:a==this.height)?null:this.map[r+this.width*(n<0?s-1:a)]}rectBetween(e,t){const{left:n,right:r,top:o,bottom:s}=this.findCell(e),{left:a,right:l,top:i,bottom:c}=this.findCell(t);return{left:Math.min(n,a),top:Math.min(o,i),right:Math.max(r,l),bottom:Math.max(s,c)}}cellsInRect(e){const t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let o=e.left;o<e.right;o++){const s=r*this.width+o,a=this.map[s];n[a]||(n[a]=!0,!(o==e.left&&o&&this.map[s-1]==a||r==e.top&&r&&this.map[s-this.width]==a)&&t.push(a))}return t}positionAt(e,t,n){for(let r=0,o=0;;r++){const s=o+n.child(r).nodeSize;if(r==e){let a=t+e*this.width;const l=(e+1)*this.width;for(;a<l&&this.map[a]<o;)a++;return a==l?s-1:this.map[a]}o=s}}static get(e){return vo(e)||Co(e,Gm(e))}};function Gm(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);const t=Ym(e),n=e.childCount,r=[];let o=0,s=null;const a=[];for(let c=0,u=t*n;c<u;c++)r[c]=0;for(let c=0,u=0;c<n;c++){const d=e.child(c);u++;for(let p=0;;p++){for(;o<r.length&&r[o]!=0;)o++;if(p==d.childCount)break;const h=d.child(p),{colspan:g,rowspan:w,colwidth:y}=h.attrs;for(let C=0;C<w;C++){if(C+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:w-C});break}const N=o+C*t;for(let A=0;A<g;A++){r[N+A]==0?r[N+A]=u:(s||(s=[])).push({type:"collision",row:c,pos:u,n:g-A});const T=y&&y[A];if(T){const D=(N+A)%t*2,H=a[D];H==null||H!=T&&a[D+1]==1?(a[D]=T,a[D+1]=1):H==T&&a[D+1]++}}}o+=g,u+=h.nodeSize}const f=(c+1)*t;let m=0;for(;o<f;)r[o++]==0&&m++;m&&(s||(s=[])).push({type:"missing",row:c,n:m}),u++}(t===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new J(t,n,r,s);let i=!1;for(let c=0;!i&&c<a.length;c+=2)a[c]!=null&&a[c+1]<n&&(i=!0);return i&&Jm(l,a,e),l}function Ym(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){const o=e.child(r);let s=0;if(n)for(let a=0;a<r;a++){const l=e.child(a);for(let i=0;i<l.childCount;i++){const c=l.child(i);a+c.attrs.rowspan>r&&(s+=c.attrs.colspan)}}for(let a=0;a<o.childCount;a++){const l=o.child(a);s+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}t==-1?t=s:t!=s&&(t=Math.max(t,s))}return t}function Jm(e,t,n){e.problems||(e.problems=[]);const r={};for(let o=0;o<e.map.length;o++){const s=e.map[o];if(r[s])continue;r[s]=!0;const a=n.nodeAt(s);if(!a)throw new RangeError(`No cell with offset ${s} found`);let l=null;const i=a.attrs;for(let c=0;c<i.colspan;c++){const u=t[(o+c)%e.width*2];u!=null&&(!i.colwidth||i.colwidth[c]!=u)&&((l||(l=Xm(i)))[c]=u)}l&&e.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function Xm(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function il(e,t){if(typeof e=="string")return{};const n=e.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map(a=>Number(a)):null,o=Number(e.getAttribute("colspan")||1),s={colspan:o,rowspan:Number(e.getAttribute("rowspan")||1),colwidth:r&&r.length==o?r:null};for(const a in t){const l=t[a].getFromDOM,i=l&&l(e);i!=null&&(s[a]=i)}return s}function cl(e,t){const n={};e.attrs.colspan!=1&&(n.colspan=e.attrs.colspan),e.attrs.rowspan!=1&&(n.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(n["data-colwidth"]=e.attrs.colwidth.join(","));for(const r in t){const o=t[r].setDOMAttr;o&&o(e.attrs[r],n)}return n}function Qm(e){if(e!==null){if(!Array.isArray(e))throw new TypeError("colwidth must be null or an array");for(const t of e)if(typeof t!="number")throw new TypeError("colwidth must be null or an array of numbers")}}function Zm(e){const t=e.cellAttributes||{},n={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:Qm}};for(const r in t)n[r]={default:t[r].default,validate:t[r].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:e.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:e.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:r=>il(r,t)}],toDOM(r){return["td",cl(r,t),0]}},table_header:{content:e.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:r=>il(r,t)}],toDOM(r){return["th",cl(r,t),0]}}}}function qe(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const r=e.nodes[n],o=r.spec.tableRole;o&&(t[o]=r)}}return t}const xt=new fe("selectingCells");function Dt(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function Ke(e){const t=e.selection.$head;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="row")return!0;return!1}function jn(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;const n=Dt(t.$head)||eh(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function eh(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const r=t.type.spec.tableRole;if(r=="cell"||r=="header_cell")return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const r=t.type.spec.tableRole;if(r=="cell"||r=="header_cell")return e.doc.resolve(n-t.nodeSize)}}function So(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function th(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function Ys(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function mc(e,t,n){const r=e.node(-1),o=J.get(r),s=e.start(-1),a=o.nextCell(e.pos-s,t,n);return a==null?null:e.node(0).resolve(s+a)}function _t(e,t,n=1){const r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function nh(e,t,n=1){const r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<n;o++)r.colwidth.splice(t,0,0)}return r}function rh(e,t,n){const r=qe(t.type.schema).header_cell;for(let o=0;o<e.height;o++)if(t.nodeAt(e.map[n+o*e.width]).type!=r)return!1;return!0}var de=class ut extends ce{constructor(t,n=t){const r=t.node(-1),o=J.get(r),s=t.start(-1),a=o.rectBetween(t.pos-s,n.pos-s),l=t.node(0),i=o.cellsInRect(a).filter(u=>u!=n.pos-s);i.unshift(n.pos-s);const c=i.map(u=>{const d=r.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const f=s+u+1;return new Cf(l.resolve(f),l.resolve(f+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=t,this.$headCell=n}map(t,n){const r=t.resolve(n.map(this.$anchorCell.pos)),o=t.resolve(n.map(this.$headCell.pos));if(So(r)&&So(o)&&Ys(r,o)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?ut.rowSelection(r,o):s&&this.isColSelection()?ut.colSelection(r,o):new ut(r,o)}return j.between(r,o)}content(){const t=this.$anchorCell.node(-1),n=J.get(t),r=this.$anchorCell.start(-1),o=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},a=[];for(let i=o.top;i<o.bottom;i++){const c=[];for(let u=i*n.width+o.left,d=o.left;d<o.right;d++,u++){const f=n.map[u];if(s[f])continue;s[f]=!0;const m=n.findCell(f);let p=t.nodeAt(f);if(!p)throw new RangeError(`No cell with offset ${f} found`);const h=o.left-m.left,g=m.right-o.right;if(h>0||g>0){let w=p.attrs;if(h>0&&(w=_t(w,0,h)),g>0&&(w=_t(w,w.colspan-g,g)),m.left<o.left){if(p=p.type.createAndFill(w),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else p=p.type.create(w,p.content)}if(m.top<o.top||m.bottom>o.bottom){const w={...p.attrs,rowspan:Math.min(m.bottom,o.bottom)-Math.max(m.top,o.top)};m.top<o.top?p=p.type.createAndFill(w):p=p.type.create(w,p.content)}c.push(p)}a.push(t.child(i).copy(X.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?t:a;return new Ie(X.from(l),1,1)}replace(t,n=Ie.empty){const r=t.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){const{$from:l,$to:i}=o[a],c=t.mapping.slice(r);t.replace(c.map(l.pos),c.map(i.pos),a?Ie.empty:n)}const s=ce.findFrom(t.doc.resolve(t.mapping.slice(r).map(this.to)),-1);s&&t.setSelection(s)}replaceWith(t,n){this.replace(t,new Ie(X.from(n),0,0))}forEachCell(t){const n=this.$anchorCell.node(-1),r=J.get(n),o=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let a=0;a<s.length;a++)t(n.nodeAt(s[a]),o+s[a])}isColSelection(){const t=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(t,n)>0)return!1;const r=t+this.$anchorCell.nodeAfter.attrs.rowspan,o=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const r=t.node(-1),o=J.get(r),s=t.start(-1),a=o.findCell(t.pos-s),l=o.findCell(n.pos-s),i=t.node(0);return a.top<=l.top?(a.top>0&&(t=i.resolve(s+o.map[a.left])),l.bottom<o.height&&(n=i.resolve(s+o.map[o.width*(o.height-1)+l.right-1]))):(l.top>0&&(n=i.resolve(s+o.map[l.left])),a.bottom<o.height&&(t=i.resolve(s+o.map[o.width*(o.height-1)+a.right-1]))),new ut(t,n)}isRowSelection(){const t=this.$anchorCell.node(-1),n=J.get(t),r=this.$anchorCell.start(-1),o=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(o,s)>0)return!1;const a=o+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,l)==n.width}eq(t){return t instanceof ut&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const r=t.node(-1),o=J.get(r),s=t.start(-1),a=o.findCell(t.pos-s),l=o.findCell(n.pos-s),i=t.node(0);return a.left<=l.left?(a.left>0&&(t=i.resolve(s+o.map[a.top*o.width])),l.right<o.width&&(n=i.resolve(s+o.map[o.width*(l.top+1)-1]))):(l.left>0&&(n=i.resolve(s+o.map[l.top*o.width])),a.right<o.width&&(t=i.resolve(s+o.map[o.width*(a.top+1)-1]))),new ut(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new ut(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new ut(t.resolve(n),t.resolve(r))}getBookmark(){return new oh(this.$anchorCell.pos,this.$headCell.pos)}};de.prototype.visible=!1;ce.jsonID("cell",de);var oh=class hc{constructor(t,n){this.anchor=t,this.head=n}map(t){return new hc(t.map(this.anchor),t.map(this.head))}resolve(t){const n=t.resolve(this.anchor),r=t.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&Ys(n,r)?new de(n,r):ce.near(r,1)}};function sh(e){if(!(e.selection instanceof de))return null;const t=[];return e.selection.forEachCell((n,r)=>{t.push(Y.node(r,r+n.nodeSize,{class:"selectedCell"}))}),me.create(e.doc,t)}function ah({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,o=e.depth;for(;o>=0&&!(e.after(o+1)<e.end(o));o--,n++);for(let s=t.depth;s>=0&&!(t.before(s+1)>t.start(s));s--,r--);return n==r&&/row|table/.test(e.node(o).type.spec.tableRole)}function lh({$from:e,$to:t}){let n,r;for(let o=e.depth;o>0;o--){const s=e.node(o);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let o=t.depth;o>0;o--){const s=t.node(o);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&t.parentOffset===0}function ih(e,t,n){const r=(t||e).selection,o=(t||e).doc;let s,a;if(r instanceof Ve&&(a=r.node.type.spec.tableRole)){if(a=="cell"||a=="header_cell")s=de.create(o,r.from);else if(a=="row"){const l=o.resolve(r.from+1);s=de.rowSelection(l,l)}else if(!n){const l=J.get(r.node),i=r.from+1,c=i+l.map[l.width*l.height-1];s=de.create(o,i+1,c)}}else r instanceof j&&ah(r)?s=j.create(o,r.from):r instanceof j&&lh(r)&&(s=j.create(o,r.$from.start(),r.$from.end()));return s&&(t||(t=e.tr)).setSelection(s),t}const ch=new fe("fix-tables");function gc(e,t,n,r){const o=e.childCount,s=t.childCount;e:for(let a=0,l=0;a<s;a++){const i=t.child(a);for(let c=l,u=Math.min(o,a+3);c<u;c++)if(e.child(c)==i){l=c+1,n+=i.nodeSize;continue e}r(i,n),l<o&&e.child(l).sameMarkup(i)?gc(e.child(l),i,n+1,r):i.nodesBetween(0,i.content.size,r,n+1),n+=i.nodeSize}}function uh(e,t){let n;const r=(o,s)=>{o.type.spec.tableRole=="table"&&(n=dh(e,o,s,n))};return t?t.doc!=e.doc&&gc(t.doc,e.doc,0,r):e.doc.descendants(r),n}function dh(e,t,n,r){const o=J.get(t);if(!o.problems)return r;r||(r=e.tr);const s=[];for(let i=0;i<o.height;i++)s.push(0);for(let i=0;i<o.problems.length;i++){const c=o.problems[i];if(c.type=="collision"){const u=t.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let f=0;f<d.rowspan;f++)s[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,_t(d,d.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=t.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=t.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=r.mapping.map(n);r.delete(u,u+t.nodeSize)}}let a,l;for(let i=0;i<s.length;i++)s[i]&&(a==null&&(a=i),l=i);for(let i=0,c=n+1;i<o.height;i++){const u=t.child(i),d=c+u.nodeSize,f=s[i];if(f>0){let m="cell";u.firstChild&&(m=u.firstChild.type.spec.tableRole);const p=[];for(let g=0;g<f;g++){const w=qe(e.schema)[m].createAndFill();w&&p.push(w)}const h=(i==0||a==i-1)&&l==i?c+1:d-1;r.insert(r.mapping.map(h),p)}c=d}return r.setMeta(ch,{fixTables:!0})}function bc(e){const t=J.get(e),n=[],r=t.height,o=t.width;for(let s=0;s<r;s++){const a=[];for(let l=0;l<o;l++){const i=s*o+l,c=t.map[i];if(s>0){const u=i-o;if(c===t.map[u]){a.push(null);continue}}if(l>0){const u=i-1;if(c===t.map[u]){a.push(null);continue}}a.push(e.nodeAt(c))}n.push(a)}return n}function yc(e,t){const n=[],r=J.get(e),o=r.height,s=r.width;for(let a=0;a<o;a++){const l=e.child(a),i=[];for(let u=0;u<s;u++){const d=t[a][u];if(!d)continue;const f=r.map[a*r.width+u],m=e.nodeAt(f);if(!m)continue;const p=m.type.createChecked(d.attrs,d.content,d.marks);i.push(p)}const c=l.type.createChecked(l.attrs,i,l.marks);n.push(c)}return e.type.createChecked(e.attrs,n,e.marks)}function kc(e,t,n,r){const o=t[0]>n[0]?-1:1,s=e.splice(t[0],t.length),a=s.length%2===0?1:0;let l;return l=o===-1?n[0]:n[n.length-1]-a,e.splice(l,0,...s),e}function Hn(e){return fh(t=>t.type.spec.tableRole==="table",e)}function fh(e,t){for(let n=t.depth;n>=0;n-=1){const r=t.node(n);if(e(r))return{node:r,pos:n===0?0:t.before(n),start:t.start(n),depth:n}}return null}function Ut(e,t){const n=Hn(t.$from);if(!n)return;const r=J.get(n.node);if(!(e<0||e>r.width-1))return r.cellsInRect({left:e,right:e+1,top:0,bottom:r.height}).map(o=>{const s=n.node.nodeAt(o),a=o+n.start;return{pos:a,start:a+1,node:s,depth:n.depth+2}})}function Vt(e,t){const n=Hn(t.$from);if(!n)return;const r=J.get(n.node);if(!(e<0||e>r.height-1))return r.cellsInRect({left:0,right:r.width,top:e,bottom:e+1}).map(o=>{const s=n.node.nodeAt(o),a=o+n.start;return{pos:a,start:a+1,node:s,depth:n.depth+2}})}function ul(e,t,n=t){let r=t,o=n;for(let u=t;u>=0;u--){const d=Ut(u,e.selection);d&&d.forEach(f=>{const m=f.node.attrs.colspan+u-1;m>=r&&(r=u),m>o&&(o=m)})}for(let u=t;u<=o;u++){const d=Ut(u,e.selection);d&&d.forEach(f=>{const m=f.node.attrs.colspan+u-1;f.node.attrs.colspan>1&&m>o&&(o=m)})}const s=[];for(let u=r;u<=o;u++){const d=Ut(u,e.selection);d&&d.length>0&&s.push(u)}r=s[0],o=s[s.length-1];const a=Ut(r,e.selection),l=Vt(0,e.selection);if(!a||!l)return;const i=e.doc.resolve(a[a.length-1].pos);let c;for(let u=o;u>=r;u--){const d=Ut(u,e.selection);if(d&&d.length>0){for(let f=l.length-1;f>=0;f--)if(l[f].pos===d[0].pos){c=d[0];break}if(c)break}}if(c)return{$anchor:i,$head:e.doc.resolve(c.pos),indexes:s}}function dl(e,t,n=t){let r=t,o=n;for(let u=t;u>=0;u--){const d=Vt(u,e.selection);d&&d.forEach(f=>{const m=f.node.attrs.rowspan+u-1;m>=r&&(r=u),m>o&&(o=m)})}for(let u=t;u<=o;u++){const d=Vt(u,e.selection);d&&d.forEach(f=>{const m=f.node.attrs.rowspan+u-1;f.node.attrs.rowspan>1&&m>o&&(o=m)})}const s=[];for(let u=r;u<=o;u++){const d=Vt(u,e.selection);d&&d.length>0&&s.push(u)}r=s[0],o=s[s.length-1];const a=Vt(r,e.selection),l=Ut(0,e.selection);if(!a||!l)return;const i=e.doc.resolve(a[a.length-1].pos);let c;for(let u=o;u>=r;u--){const d=Vt(u,e.selection);if(d&&d.length>0){for(let f=l.length-1;f>=0;f--)if(l[f].pos===d[0].pos){c=d[0];break}if(c)break}}if(c)return{$anchor:i,$head:e.doc.resolve(c.pos),indexes:s}}function fl(e){return e[0].map((t,n)=>e.map(r=>r[n]))}function ph(e){var t,n;const{tr:r,originIndex:o,targetIndex:s,select:a,pos:l}=e,i=Hn(r.doc.resolve(l));if(!i)return!1;const c=(t=ul(r,o))===null||t===void 0?void 0:t.indexes,u=(n=ul(r,s))===null||n===void 0?void 0:n.indexes;if(!c||!u||c.includes(s))return!1;const d=mh(i.node,c,u);if(r.replaceWith(i.pos,i.pos+i.node.nodeSize,d),!a)return!0;const f=J.get(d),m=i.start,p=s,h=f.positionAt(f.height-1,p,d),g=r.doc.resolve(m+h),w=f.positionAt(0,p,d),y=r.doc.resolve(m+w);return r.setSelection(de.colSelection(g,y)),!0}function mh(e,t,n,r){let o=fl(bc(e));return o=kc(o,t,n),o=fl(o),yc(e,o)}function hh(e){var t,n;const{tr:r,originIndex:o,targetIndex:s,select:a,pos:l}=e,i=Hn(r.doc.resolve(l));if(!i)return!1;const c=(t=dl(r,o))===null||t===void 0?void 0:t.indexes,u=(n=dl(r,s))===null||n===void 0?void 0:n.indexes;if(!c||!u||c.includes(s))return!1;const d=gh(i.node,c,u);if(r.replaceWith(i.pos,i.pos+i.node.nodeSize,d),!a)return!0;const f=J.get(d),m=i.start,p=s,h=f.positionAt(p,f.width-1,d),g=r.doc.resolve(m+h),w=f.positionAt(p,0,d),y=r.doc.resolve(m+w);return r.setSelection(de.rowSelection(g,y)),!0}function gh(e,t,n,r){let o=bc(e);return o=kc(o,t,n),yc(e,o)}function Et(e){const t=e.selection,n=jn(e),r=n.node(-1),o=n.start(-1),s=J.get(r);return{...t instanceof de?s.rectBetween(t.$anchorCell.pos-o,t.$headCell.pos-o):s.findCell(n.pos-o),tableStart:o,map:s,table:r}}function Js(e,{map:t,tableStart:n,table:r},o){let s=o>0?-1:0;rh(t,r,o+s)&&(s=o==0||o==t.width?null:0);for(let a=0;a<t.height;a++){const l=a*t.width+o;if(o>0&&o<t.width&&t.map[l-1]==t.map[l]){const i=t.map[l],c=r.nodeAt(i);e.setNodeMarkup(e.mapping.map(n+i),null,nh(c.attrs,o-t.colCount(i))),a+=c.attrs.rowspan-1}else{const i=s==null?qe(r.type.schema).cell:r.nodeAt(t.map[l+s]).type,c=t.positionAt(a,o,r);e.insert(e.mapping.map(n+c),i.createAndFill())}}return e}function bh(e,t){if(!Ke(e))return!1;if(t){const n=Et(e);t(Js(e.tr,n,n.left))}return!0}function yh(e,t){if(!Ke(e))return!1;if(t){const n=Et(e);t(Js(e.tr,n,n.right))}return!0}function wc(e,{map:t,table:n,tableStart:r},o){const s=e.mapping.maps.length;for(let a=0;a<t.height;){const l=a*t.width+o,i=t.map[l],c=n.nodeAt(i),u=c.attrs;if(o>0&&t.map[l-1]==i||o<t.width-1&&t.map[l+1]==i)e.setNodeMarkup(e.mapping.slice(s).map(r+i),null,_t(u,o-t.colCount(i)));else{const d=e.mapping.slice(s).map(r+i);e.delete(d,d+c.nodeSize)}a+=u.rowspan}}function kh(e,t){if(!Ke(e))return!1;if(t){const n=Et(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let o=n.right-1;wc(r,n,o),o!=n.left;o--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=J.get(s)}t(r)}return!0}function xc(e,{map:t,table:n,tableStart:r},o){let s=0;for(let c=0;c<o;c++)s+=n.child(c).nodeSize;const a=s+n.child(o).nodeSize,l=e.mapping.maps.length;e.delete(s+r,a+r);const i=new Set;for(let c=0,u=o*t.width;c<t.width;c++,u++){const d=t.map[u];if(!i.has(d)){if(i.add(d),o>0&&d==t.map[u-t.width]){const f=n.nodeAt(d).attrs;e.setNodeMarkup(e.mapping.slice(l).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(o<t.height&&d==t.map[u+t.width]){const f=n.nodeAt(d),m=f.attrs,p=f.type.create({...m,rowspan:f.attrs.rowspan-1},f.content),h=t.positionAt(o+1,c,n);e.insert(e.mapping.slice(l).map(r+h),p),c+=m.colspan-1}}}}function wh(e,t){if(!Ke(e))return!1;if(t){const n=Et(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let o=n.bottom-1;xc(r,n,o),o!=n.top;o--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=J.get(n.table)}t(r)}return!0}function xh(e,t){return function(n,r){if(!Ke(n))return!1;const o=jn(n);if(o.nodeAfter.attrs[e]===t)return!1;if(r){const s=n.tr;n.selection instanceof de?n.selection.forEachCell((a,l)=>{a.attrs[e]!==t&&s.setNodeMarkup(l,null,{...a.attrs,[e]:t})}):s.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[e]:t}),r(s)}return!0}}function vh(e){return function(t,n){if(!Ke(t))return!1;if(n){const r=qe(t.schema),o=Et(t),s=t.tr,a=o.map.cellsInRect(e=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:e=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=a.map(i=>o.table.nodeAt(i));for(let i=0;i<a.length;i++)l[i].type==r.header_cell&&s.setNodeMarkup(o.tableStart+a[i],r.cell,l[i].attrs);if(s.steps.length===0)for(let i=0;i<a.length;i++)s.setNodeMarkup(o.tableStart+a[i],r.header_cell,l[i].attrs);n(s)}return!0}}function pl(e,t,n){const r=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let o=0;o<r.length;o++){const s=t.table.nodeAt(r[o]);if(s&&s.type!==n.header_cell)return!1}return!0}function Xs(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?vh(e):function(n,r){if(!Ke(n))return!1;if(r){const o=qe(n.schema),s=Et(n),a=n.tr,l=pl("row",s,o),i=pl("column",s,o),c=(e==="column"?l:e==="row"&&i)?1:0,u=e=="column"?{left:0,top:c,right:1,bottom:s.map.height}:e=="row"?{left:c,top:0,right:s.map.width,bottom:1}:s,d=e=="column"?i?o.cell:o.header_cell:e=="row"?l?o.cell:o.header_cell:o.cell;s.map.cellsInRect(u).forEach(f=>{const m=f+s.tableStart,p=a.doc.nodeAt(m);p&&a.setNodeMarkup(m,d,p.attrs)}),r(a)}return!0}}Xs("row",{useDeprecatedLogic:!0});Xs("column",{useDeprecatedLogic:!0});Xs("cell",{useDeprecatedLogic:!0});function Ch(e,t){if(t<0){const n=e.nodeBefore;if(n)return e.pos-n.nodeSize;for(let r=e.index(-1)-1,o=e.before();r>=0;r--){const s=e.node(-1).child(r),a=s.lastChild;if(a)return o-1-a.nodeSize;o-=s.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const n=e.node(-1);for(let r=e.indexAfter(-1),o=e.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return o+1;o+=s.nodeSize}}return null}function Qs(e){return function(t,n){if(!Ke(t))return!1;const r=Ch(jn(t),e);if(r==null)return!1;if(n){const o=t.doc.resolve(r);n(t.tr.setSelection(j.between(o,th(o))).scrollIntoView())}return!0}}function Sh(e,t){const n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Zn(e,t){const n=e.selection;if(!(n instanceof de))return!1;if(t){const r=e.tr,o=qe(e.schema).cell.createAndFill().content;n.forEachCell((s,a)=>{s.content.eq(o)||r.replace(r.mapping.map(a+1),r.mapping.map(a+s.nodeSize-1),new Ie(o,0,0))}),r.docChanged&&t(r)}return!0}function Ah(e){return(t,n)=>{const{from:r,to:o,select:s=!0,pos:a=t.selection.from}=e,l=t.tr;return hh({tr:l,originIndex:r,targetIndex:o,select:s,pos:a})?(n?.(l),!0):!1}}function Mh(e){return(t,n)=>{const{from:r,to:o,select:s=!0,pos:a=t.selection.from}=e,l=t.tr;return ph({tr:l,originIndex:r,targetIndex:o,select:s,pos:a})?(n?.(l),!0):!1}}function Nh(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole=="table");)n--,r--,t=t.child(0).content;const o=t.child(0),s=o.type.spec.tableRole,a=o.type.schema,l=[];if(s=="row")for(let i=0;i<t.childCount;i++){let c=t.child(i).content;const u=i?0:Math.max(0,n-1),d=i<t.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=Ao(qe(a).row,new Ie(c,u,d)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(n||r?Ao(qe(a).row,new Ie(t,n,r)).content:t);else return null;return Eh(a,l)}function Eh(e,t){const n=[];for(let o=0;o<t.length;o++){const s=t[o];for(let a=s.childCount-1;a>=0;a--){const{rowspan:l,colspan:i}=s.child(a).attrs;for(let c=o;c<o+l;c++)n[c]=(n[c]||0)+i}}let r=0;for(let o=0;o<n.length;o++)r=Math.max(r,n[o]);for(let o=0;o<n.length;o++)if(o>=t.length&&t.push(X.empty),n[o]<r){const s=qe(e).cell.createAndFill(),a=[];for(let l=n[o];l<r;l++)a.push(s);t[o]=t[o].append(X.from(a))}return{height:t.length,width:r,rows:t}}function Ao(e,t){const n=e.createAndFill();return new Sf(n).replace(0,n.content.size,t).doc}function Th({width:e,height:t,rows:n},r,o){if(e!=r){const s=[],a=[];for(let l=0;l<n.length;l++){const i=n[l],c=[];for(let u=s[l]||0,d=0;u<r;d++){let f=i.child(d%i.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(_t(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let m=1;m<f.attrs.rowspan;m++)s[l+m]=(s[l+m]||0)+f.attrs.colspan}a.push(X.from(c))}n=a,e=r}if(t!=o){const s=[];for(let a=0,l=0;a<o;a++,l++){const i=[],c=n[l%t];for(let u=0;u<c.childCount;u++){let d=c.child(u);a+d.attrs.rowspan>o&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,o-d.attrs.rowspan)},d.content)),i.push(d)}s.push(X.from(i))}n=s,t=o}return{width:e,height:t,rows:n}}function Ih(e,t,n,r,o,s,a){const l=e.doc.type.schema,i=qe(l);let c,u;if(o>t.width)for(let d=0,f=0;d<t.height;d++){const m=n.child(d);f+=m.nodeSize;const p=[];let h;m.lastChild==null||m.lastChild.type==i.cell?h=c||(c=i.cell.createAndFill()):h=u||(u=i.header_cell.createAndFill());for(let g=t.width;g<o;g++)p.push(h);e.insert(e.mapping.slice(a).map(f-1+r),p)}if(s>t.height){const d=[];for(let p=0,h=(t.height-1)*t.width;p<Math.max(t.width,o);p++){const g=p>=t.width?!1:n.nodeAt(t.map[h+p]).type==i.header_cell;d.push(g?u||(u=i.header_cell.createAndFill()):c||(c=i.cell.createAndFill()))}const f=i.row.create(null,X.from(d)),m=[];for(let p=t.height;p<s;p++)m.push(f);e.insert(e.mapping.slice(a).map(r+n.nodeSize-2),m)}return!!(c||u)}function ml(e,t,n,r,o,s,a,l){if(a==0||a==t.height)return!1;let i=!1;for(let c=o;c<s;c++){const u=a*t.width+c,d=t.map[u];if(t.map[u-t.width]==d){i=!0;const f=n.nodeAt(d),{top:m,left:p}=t.findCell(d);e.setNodeMarkup(e.mapping.slice(l).map(d+r),null,{...f.attrs,rowspan:a-m}),e.insert(e.mapping.slice(l).map(t.positionAt(a,p,n)),f.type.createAndFill({...f.attrs,rowspan:m+f.attrs.rowspan-a})),c+=f.attrs.colspan-1}}return i}function hl(e,t,n,r,o,s,a,l){if(a==0||a==t.width)return!1;let i=!1;for(let c=o;c<s;c++){const u=c*t.width+a,d=t.map[u];if(t.map[u-1]==d){i=!0;const f=n.nodeAt(d),m=t.colCount(d),p=e.mapping.slice(l).map(d+r);e.setNodeMarkup(p,null,_t(f.attrs,a-m,f.attrs.colspan-(a-m))),e.insert(p+f.nodeSize,f.type.createAndFill(_t(f.attrs,0,a-m))),c+=f.attrs.rowspan-1}}return i}function gl(e,t,n,r,o){let s=n?e.doc.nodeAt(n-1):e.doc;if(!s)throw new Error("No table found");let a=J.get(s);const{top:l,left:i}=r,c=i+o.width,u=l+o.height,d=e.tr;let f=0;function m(){if(s=n?d.doc.nodeAt(n-1):d.doc,!s)throw new Error("No table found");a=J.get(s),f=d.mapping.maps.length}Ih(d,a,s,n,c,u,f)&&m(),ml(d,a,s,n,i,c,l,f)&&m(),ml(d,a,s,n,i,c,u,f)&&m(),hl(d,a,s,n,l,u,i,f)&&m(),hl(d,a,s,n,l,u,c,f)&&m();for(let p=l;p<u;p++){const h=a.positionAt(p,i,s),g=a.positionAt(p,c,s);d.replace(d.mapping.slice(f).map(h+n),d.mapping.slice(f).map(g+n),new Ie(o.rows[p-l],0,0))}m(),d.setSelection(new de(d.doc.resolve(n+a.positionAt(l,i,s)),d.doc.resolve(n+a.positionAt(u-1,c-1,s)))),t(d)}const Lh=vf({ArrowLeft:er("horiz",-1),ArrowRight:er("horiz",1),ArrowUp:er("vert",-1),ArrowDown:er("vert",1),"Shift-ArrowLeft":tr("horiz",-1),"Shift-ArrowRight":tr("horiz",1),"Shift-ArrowUp":tr("vert",-1),"Shift-ArrowDown":tr("vert",1),Backspace:Zn,"Mod-Backspace":Zn,Delete:Zn,"Mod-Delete":Zn});function sr(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function er(e,t){return(n,r,o)=>{if(!o)return!1;const s=n.selection;if(s instanceof de)return sr(n,r,ce.near(s.$headCell,t));if(e!="horiz"&&!s.empty)return!1;const a=vc(o,e,t);if(a==null)return!1;if(e=="horiz")return sr(n,r,ce.near(n.doc.resolve(s.head+t),t));{const l=n.doc.resolve(a),i=mc(l,e,t);let c;return i?c=ce.near(i,1):t<0?c=ce.near(n.doc.resolve(l.before(-1)),-1):c=ce.near(n.doc.resolve(l.after(-1)),1),sr(n,r,c)}}}function tr(e,t){return(n,r,o)=>{if(!o)return!1;const s=n.selection;let a;if(s instanceof de)a=s;else{const i=vc(o,e,t);if(i==null)return!1;a=new de(n.doc.resolve(i))}const l=mc(a.$headCell,e,t);return l?sr(n,r,new de(a.$anchorCell,l)):!1}}function Rh(e,t){const n=e.state.doc,r=Dt(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new de(r))),!0):!1}function $h(e,t,n){if(!Ke(e.state))return!1;let r=Nh(n);const o=e.state.selection;if(o instanceof de){r||(r={width:1,height:1,rows:[X.from(Ao(qe(e.state.schema).cell,n))]});const s=o.$anchorCell.node(-1),a=o.$anchorCell.start(-1),l=J.get(s).rectBetween(o.$anchorCell.pos-a,o.$headCell.pos-a);return r=Th(r,l.right-l.left,l.bottom-l.top),gl(e.state,e.dispatch,a,l,r),!0}else if(r){const s=jn(e.state),a=s.start(-1);return gl(e.state,e.dispatch,a,J.get(s.node(-1)).findCell(s.pos-a),r),!0}else return!1}function Dh(e,t){var n;if(t.button!=0||t.ctrlKey||t.metaKey)return;const r=bl(e,t.target);let o;if(t.shiftKey&&e.state.selection instanceof de)s(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&r&&(o=Dt(e.state.selection.$anchor))!=null&&((n=to(e,t))===null||n===void 0?void 0:n.pos)!=o.pos)s(o,t),t.preventDefault();else if(!r)return;function s(i,c){let u=to(e,c);const d=xt.getState(e.state)==null;if(!u||!Ys(i,u))if(d)u=i;else return;const f=new de(i,u);if(d||!e.state.selection.eq(f)){const m=e.state.tr.setSelection(f);d&&m.setMeta(xt,i.pos),e.dispatch(m)}}function a(){e.root.removeEventListener("mouseup",a),e.root.removeEventListener("dragstart",a),e.root.removeEventListener("mousemove",l),xt.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(xt,-1))}function l(i){const c=i,u=xt.getState(e.state);let d;if(u!=null)d=e.state.doc.resolve(u);else if(bl(e,c.target)!=r&&(d=to(e,t),!d))return a();d&&s(d,c)}e.root.addEventListener("mouseup",a),e.root.addEventListener("dragstart",a),e.root.addEventListener("mousemove",l)}function vc(e,t,n){if(!(e.state.selection instanceof j))return null;const{$head:r}=e.state.selection;for(let o=r.depth-1;o>=0;o--){const s=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const a=r.before(o),l=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(l)?a:null}}return null}function bl(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function to(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:o}=n;return r>=0&&Dt(e.state.doc.resolve(r))||Dt(e.state.doc.resolve(o))}var _h=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Mo(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Mo(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Mo(e,t,n,r,o,s){let a=0,l=!0,i=t.firstChild;const c=e.firstChild;if(c){for(let d=0,f=0;d<c.childCount;d++){const{colspan:m,colwidth:p}=c.child(d).attrs;for(let h=0;h<m;h++,f++){const g=o==f?s:p&&p[h],w=g?g+"px":"";if(a+=g||r,g||(l=!1),i)i.style.width!=w&&(i.style.width=w),i=i.nextSibling;else{const y=document.createElement("col");y.style.width=w,t.appendChild(y)}}}for(;i;){var u;const d=i.nextSibling;(u=i.parentNode)===null||u===void 0||u.removeChild(i),i=d}l?(n.style.width=a+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=a+"px")}}const Pe=new fe("tableColumnResizing");function zh({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=_h,lastColumnResizable:o=!0}={}){const s=new Z({key:Pe,state:{init(a,l){var i;const c=(i=s.spec)===null||i===void 0||(i=i.props)===null||i===void 0?void 0:i.nodeViews,u=qe(l.schema).table.name;return r&&c&&(c[u]=(d,f)=>new r(d,n,f)),new Oh(-1,!1)},apply(a,l){return l.apply(a)}},props:{attributes:a=>{const l=Pe.getState(a);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(a,l)=>{Ph(a,l,e,o)},mouseleave:a=>{Bh(a)},mousedown:(a,l)=>{Kh(a,l,t,n)}},decorations:a=>{const l=Pe.getState(a);if(l&&l.activeHandle>-1)return Wh(a,l.activeHandle)},nodeViews:{}}});return s}var Oh=class ar{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(t){const n=this,r=t.getMeta(Pe);if(r&&r.setHandle!=null)return new ar(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new ar(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let o=t.mapping.map(n.activeHandle,-1);return So(t.doc.resolve(o))||(o=-1),new ar(o,n.dragging)}return n}};function Ph(e,t,n,r){if(!e.editable)return;const o=Pe.getState(e.state);if(o&&!o.dragging){const s=Hh(t.target);let a=-1;if(s){const{left:l,right:i}=s.getBoundingClientRect();t.clientX-l<=n?a=yl(e,t,"left",n):i-t.clientX<=n&&(a=yl(e,t,"right",n))}if(a!=o.activeHandle){if(!r&&a!==-1){const l=e.state.doc.resolve(a),i=l.node(-1),c=J.get(i),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Cc(e,a)}}}function Bh(e){if(!e.editable)return;const t=Pe.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&Cc(e,-1)}function Kh(e,t,n,r){var o;if(!e.editable)return!1;const s=(o=e.dom.ownerDocument.defaultView)!==null&&o!==void 0?o:window,a=Pe.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;const l=e.state.doc.nodeAt(a.activeHandle),i=jh(e,a.activeHandle,l.attrs);e.dispatch(e.state.tr.setMeta(Pe,{setDragging:{startX:t.clientX,startWidth:i}}));function c(d){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",u);const f=Pe.getState(e.state);f?.dragging&&(Fh(e,f.activeHandle,kl(f.dragging,d,n)),e.dispatch(e.state.tr.setMeta(Pe,{setDragging:null})))}function u(d){if(!d.which)return c(d);const f=Pe.getState(e.state);if(f&&f.dragging){const m=kl(f.dragging,d,n);wl(e,f.activeHandle,m,r)}}return wl(e,a.activeHandle,i,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",u),t.preventDefault(),!0}function jh(e,t,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const s=e.domAtPos(t);let a=s.node.childNodes[s.offset].offsetWidth,l=n;if(r)for(let i=0;i<n;i++)r[i]&&(a-=r[i],l--);return a/l}function Hh(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function yl(e,t,n,r){const o=n=="right"?-r:r,s=e.posAtCoords({left:t.clientX+o,top:t.clientY});if(!s)return-1;const{pos:a}=s,l=Dt(e.state.doc.resolve(a));if(!l)return-1;if(n=="right")return l.pos;const i=J.get(l.node(-1)),c=l.start(-1),u=i.map.indexOf(l.pos-c);return u%i.width==0?-1:c+i.map[u-1]}function kl(e,t,n){const r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function Cc(e,t){e.dispatch(e.state.tr.setMeta(Pe,{setHandle:t}))}function Fh(e,t,n){const r=e.state.doc.resolve(t),o=r.node(-1),s=J.get(o),a=r.start(-1),l=s.colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1,i=e.state.tr;for(let c=0;c<s.height;c++){const u=c*s.width+l;if(c&&s.map[u]==s.map[u-s.width])continue;const d=s.map[u],f=o.nodeAt(d).attrs,m=f.colspan==1?0:l-s.colCount(d);if(f.colwidth&&f.colwidth[m]==n)continue;const p=f.colwidth?f.colwidth.slice():qh(f.colspan);p[m]=n,i.setNodeMarkup(a+d,null,{...f,colwidth:p})}i.docChanged&&e.dispatch(i)}function wl(e,t,n,r){const o=e.state.doc.resolve(t),s=o.node(-1),a=o.start(-1),l=J.get(s).colCount(o.pos-a)+o.nodeAfter.attrs.colspan-1;let i=e.domAtPos(o.start(-1)).node;for(;i&&i.nodeName!="TABLE";)i=i.parentNode;i&&Mo(s,i.firstChild,i,r,l,n)}function qh(e){return Array(e).fill(0)}function Wh(e,t){const n=[],r=e.doc.resolve(t),o=r.node(-1);if(!o)return me.empty;const s=J.get(o),a=r.start(-1),l=s.colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=l+c*s.width;if((l==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){var i;const d=s.map[u],f=a+d+o.nodeAt(d).nodeSize-1,m=document.createElement("div");m.className="column-resize-handle",!((i=Pe.getState(e))===null||i===void 0)&&i.dragging&&n.push(Y.node(a+d,a+d+o.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(Y.widget(f,m))}}return me.create(e.doc,n)}function Uh({allowTableNodeSelection:e=!1}={}){return new Z({key:xt,state:{init(){return null},apply(t,n){const r=t.getMeta(xt);if(r!=null)return r==-1?null:r;if(n==null||!t.docChanged)return n;const{deleted:o,pos:s}=t.mapping.mapResult(n);return o?null:s}},props:{decorations:sh,handleDOMEvents:{mousedown:Dh},createSelectionBetween(t){return xt.getState(t.state)!=null?t.state.selection:null},handleTripleClick:Rh,handleKeyDown:Lh,handlePaste:$h},appendTransaction(t,n,r){return ih(r,uh(r,n),e)}})}var br=typeof navigator<"u"?navigator:null,Zs=br&&br.userAgent||"",Vh=/Edge\/(\d+)/.exec(Zs),Gh=/MSIE \d/.exec(Zs),Yh=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Zs),Jh=!!(Gh||Yh||Vh),Xh=!Jh&&!!br&&/Apple Computer/.test(br.vendor),Sc=new fe("safari-ime-span"),No=!1,Qh={key:Sc,props:{decorations:Zh,handleDOMEvents:{compositionstart:()=>{No=!0},compositionend:()=>{No=!1}}}};function Zh(e){const{$from:t,$to:n,to:r}=e.selection;if(No&&t.sameParent(n)){const o=Y.widget(r,eg,{ignoreSelection:!0,key:"safari-ime-span"});return me.create(e.doc,[o])}}function eg(e){const t=e.dom.ownerDocument.createElement("span");return t.className="ProseMirror-safari-ime-span",t}var tg=new Z(Xh?Qh:{key:Sc});function q(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-gfm",...t}}),e}var ea=On("strike_through");q(ea,{displayName:"Attr<strikethrough>",group:"Strikethrough"});var sn=at("strike_through",e=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:t=>t==="line-through"}],toDOM:t=>["del",e.get(ea.key)(t)],parseMarkdown:{match:t=>t.type==="delete",runner:(t,n,r)=>{t.openMark(r),t.next(n.children),t.closeMark(r)}},toMarkdown:{match:t=>t.type.name==="strike_through",runner:(t,n)=>{t.withMark(n,"delete")}}}));q(sn.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"});q(sn.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});var Nn=F("ToggleStrikeThrough",e=>()=>_n(sn.type(e)));q(Nn,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});var ta=ue(e=>st(new RegExp("(?<![\\w:/])(~{1,2})(.+?)\\1(?!\\w|\\/)"),sn.type(e)));q(ta,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});var na=_e("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:e=>{const t=e.get(se);return()=>t.call(Nn.key)}}});q(na.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"});q(na.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});var Fn=Zm({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:e=>e.style.textAlign||"left",setDOMAttr:(e,t)=>{t.style=`text-align: ${e||"left"}`}}}}),pt=Ee("table",()=>({...Fn.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:e=>e.type==="table",runner:(e,t,n)=>{const r=t.align,o=t.children.map((s,a)=>({...s,align:r,isHeader:a===0}));e.openNode(n),e.next(o),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="table",runner:(e,t)=>{const n=t.content.firstChild?.content;if(!n)return;const r=[];n.forEach(o=>{r.push(o.attrs.alignment)}),e.openNode("table",void 0,{align:r}),e.next(t.content),e.closeNode()}}}));q(pt.node,{displayName:"NodeSchema<table>",group:"Table"});q(pt.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});var qn=Ee("table_header_row",()=>({...Fn.table_row,disableDropCursor:!0,content:"(table_header)*",parseDOM:[{tag:"tr[data-is-header]"},{tag:"tr",getAttrs:e=>e instanceof HTMLElement&&e.querySelector("th")?{}:!1}],toDOM(){return["tr",{"data-is-header":!0},0]},parseMarkdown:{match:e=>!!(e.type==="tableRow"&&e.isHeader),runner:(e,t,n)=>{const r=t.align,o=t.children.map((s,a)=>({...s,align:r[a],isHeader:t.isHeader}));e.openNode(n),e.next(o),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="table_header_row",runner:(e,t)=>{t.content.size!==0&&(e.openNode("tableRow",void 0,{isHeader:!0}),e.next(t.content),e.closeNode())}}}));q(qn.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"});q(qn.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});var an=Ee("table_row",()=>({...Fn.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:e=>e.type==="tableRow",runner:(e,t,n)=>{const r=t.align,o=t.children.map((s,a)=>({...s,align:r[a]}));e.openNode(n),e.next(o),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="table_row",runner:(e,t)=>{t.content.size!==0&&(e.openNode("tableRow"),e.next(t.content),e.closeNode())}}}));q(an.node,{displayName:"NodeSchema<tableRow>",group:"Table"});q(an.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});var Wn=Ee("table_cell",()=>({...Fn.table_cell,disableDropCursor:!0,parseMarkdown:{match:e=>e.type==="tableCell"&&!e.isHeader,runner:(e,t,n)=>{const r=t.align;e.openNode(n,{alignment:r}).openNode(e.schema.nodes.paragraph).next(t.children).closeNode().closeNode()}},toMarkdown:{match:e=>e.type.name==="table_cell",runner:(e,t)=>{e.openNode("tableCell").next(t.content).closeNode()}}}));q(Wn.node,{displayName:"NodeSchema<tableCell>",group:"Table"});q(Wn.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});var Zt=Ee("table_header",()=>({...Fn.table_header,disableDropCursor:!0,parseMarkdown:{match:e=>e.type==="tableCell"&&!!e.isHeader,runner:(e,t,n)=>{const r=t.align;e.openNode(n,{alignment:r}),e.openNode(e.schema.nodes.paragraph),e.next(t.children),e.closeNode(),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="table_header",runner:(e,t)=>{e.openNode("tableCell"),e.next(t.content),e.closeNode()}}}));q(Zt.node,{displayName:"NodeSchema<tableHeader>",group:"Table"});q(Zt.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});function Ac(e,t=3,n=3){const r=Array(n).fill(0).map(()=>Wn.type(e).createAndFill()),o=Array(n).fill(0).map(()=>Zt.type(e).createAndFill()),s=Array(t).fill(0).map((a,l)=>l===0?qn.type(e).create(null,o):an.type(e).create(null,r));return pt.type(e).create(null,s)}function Mc(e){return(t,n)=>r=>{n=n??r.selection.from;const o=r.doc.resolve(n),s=Mf(i=>i.type.name==="table")(o),a=s?{node:s.node,from:s.start}:void 0,l=e==="row";if(a){const i=J.get(a.node);if(t>=0&&t<(l?i.height:i.width)){const c=i.positionAt(l?t:i.height-1,l?i.width-1:t,a.node),u=r.doc.resolve(a.from+c),d=l?de.rowSelection:de.colSelection,f=i.positionAt(l?t:0,l?0:t,a.node),m=r.doc.resolve(a.from+f);return _i(r.setSelection(d(u,m)))}}return r}}var ng=Mc("row"),rg=Mc("col");function Nc(e,t,{map:n,tableStart:r,table:o},s){const a=Array(s).fill(0).reduce((i,c,u)=>i+o.child(u).nodeSize,r),l=Array(n.width).fill(0).map((i,c)=>{const u=o.nodeAt(n.map[c]);return Wn.type(e).createAndFill({alignment:u?.attrs.alignment})});return t.insert(a,an.type(e).create(null,l)),t}function og(e){const t=Hn(e.$from);if(!t)return;const n=J.get(t.node);return n.cellsInRect({left:0,right:n.width,top:0,bottom:n.height}).map(r=>{const o=t.node.nodeAt(r),s=r+t.start;return{pos:s,start:s+1,node:o}})}function sg(e){const t=og(e.selection);if(t&&t[0]){const n=e.doc.resolve(t[0].pos),r=t[t.length-1];if(r){const o=e.doc.resolve(r.pos);return _i(e.setSelection(new de(o,n)))}}return e}var ra=F("GoToPrevTableCell",()=>()=>Qs(-1));q(ra,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});var oa=F("GoToNextTableCell",()=>()=>Qs(1));q(oa,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});var sa=F("ExitTable",e=>()=>(t,n)=>{if(!Ke(t))return!1;const{$head:r}=t.selection,o=Af(r,pt.type(e));if(!o)return!1;const{to:s}=o,a=t.tr.replaceWith(s,s,Be.type(e).createAndFill());return a.setSelection(ce.near(a.doc.resolve(s),1)).scrollIntoView(),n?.(a),!0});q(sa,{displayName:"Command<breakTableCommand>",group:"Table"});var Ec=F("InsertTable",e=>({row:t,col:n}={})=>(r,o)=>{const{selection:s,tr:a}=r,{from:l}=s,i=Ac(e,t,n),c=a.replaceSelectionWith(i),u=ce.findFrom(c.doc.resolve(l),1,!0);return u&&c.setSelection(u),o?.(c),!0});q(Ec,{displayName:"Command<insertTableCommand>",group:"Table"});var Tc=F("MoveRow",()=>({from:e,to:t,pos:n}={})=>Ah({from:e??0,to:t??0,pos:n}));q(Tc,{displayName:"Command<moveRowCommand>",group:"Table"});var Ic=F("MoveCol",()=>({from:e,to:t,pos:n}={})=>Mh({from:e??0,to:t??0,pos:n}));q(Ic,{displayName:"Command<moveColCommand>",group:"Table"});var Lc=F("SelectRow",()=>(e={index:0})=>(t,n)=>{const{tr:r}=t;return!!n?.(ng(e.index,e.pos)(r))});q(Lc,{displayName:"Command<selectRowCommand>",group:"Table"});var Rc=F("SelectCol",()=>(e={index:0})=>(t,n)=>{const{tr:r}=t;return!!n?.(rg(e.index,e.pos)(r))});q(Rc,{displayName:"Command<selectColCommand>",group:"Table"});var $c=F("SelectTable",()=>()=>(e,t)=>{const{tr:n}=e;return!!t?.(sg(n))});q($c,{displayName:"Command<selectTableCommand>",group:"Table"});var Dc=F("DeleteSelectedCells",()=>()=>(e,t)=>{const{selection:n}=e;if(!(n instanceof de))return!1;const r=n.isRowSelection(),o=n.isColSelection();return r&&o?Sh(e,t):o?kh(e,t):wh(e,t)});q(Dc,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});var _c=F("AddColBefore",()=>()=>bh);q(_c,{displayName:"Command<addColBeforeCommand>",group:"Table"});var zc=F("AddColAfter",()=>()=>yh);q(zc,{displayName:"Command<addColAfterCommand>",group:"Table"});var Oc=F("AddRowBefore",e=>()=>(t,n)=>{if(!Ke(t))return!1;if(n){const r=Et(t);n(Nc(e,t.tr,r,r.top))}return!0});q(Oc,{displayName:"Command<addRowBeforeCommand>",group:"Table"});var Pc=F("AddRowAfter",e=>()=>(t,n)=>{if(!Ke(t))return!1;if(n){const r=Et(t);n(Nc(e,t.tr,r,r.bottom))}return!0});q(Pc,{displayName:"Command<addRowAfterCommand>",group:"Table"});var Bc=F("SetAlign",()=>(e="left")=>xh("alignment",e));q(Bc,{displayName:"Command<setAlignCommand>",group:"Table"});var Kc=ue(e=>new Je(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(t,n,r,o)=>{const s=t.doc.resolve(r);if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),pt.type(e)))return null;const a=Ac(e,Math.max(Number(n.groups?.row??0),2),Number(n.groups?.col)),l=t.tr.replaceRangeWith(r,o,a);return l.setSelection(j.create(l.doc,r+3)).scrollIntoView()}));q(Kc,{displayName:"InputRule<insertTableInputRule>",group:"Table"});var jc=Up(e=>({run:(t,n,r)=>{if(r)return t;function o(c){const u=c.childCount,d=c.lastChild?.childCount??0;if(u===0||d===0)return Be.type(e).create();const f=c.firstChild;if(!(d>0&&f&&f.childCount===0))return c;if(u>=3){const g=c.child(1),w=[];for(let N=0;N<g.childCount;N++){const A=g.child(N);w.push(Zt.type(e).create(A.attrs,A.content,A.marks))}const y=f.type.create(f.attrs,w),C=[];for(let N=2;N<u;N++)C.push(c.child(N));return c.type.create(c.attrs,[y,...C])}const m=Array(d).fill(0).map(()=>Zt.type(e).createAndFill()),p=new Ie(X.from(m),0,0),h=f.replace(0,0,p);return c.replace(0,f.nodeSize,new Ie(X.from(h),0,0))}function s(c){const u=an.type(e),d=[];let f=[],m=!1;function p(){if(f.length===0)return;const h=qn.type(e).createAndFill(),g=pt.type(e).create(null,[h,...f]);d.push(o(g)),f=[]}return c.forEach(h=>{h.type===u?(m=!0,f.push(h)):(p(),d.push(h))}),p(),m?X.from(d):c}function a(c){let u=s(c),d=u!==c;const f=[];return u.forEach(m=>{if(m.type===pt.type(e)){const p=o(m);p!==m&&(d=!0),f.push(p)}else if(m.childCount>0){const p=a(m.content);p!==m.content?(d=!0,f.push(m.copy(p))):f.push(m)}else f.push(m)}),d?X.from(f):c}function l(c){const u=[],d=[];c.forEach(f=>d.push(f));for(let f=0;f<d.length;f++){const m=d[f],p=d[f+1];m.type===Be.type(e)&&m.content.size===0&&p&&p.type===pt.type(e)||u.push(m)}return u.length<d.length?X.from(u):c}let i=a(t.content);return i=l(i),new Ie(X.from(i),t.openStart,t.openEnd)}}));q(jc,{displayName:"PasteRule<table>",group:"Table"});var aa=_e("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:e=>{const t=e.get(se);return()=>t.call(oa.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:e=>{const t=e.get(se);return()=>t.call(ra.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:e=>{const t=e.get(se);return()=>t.call(sa.key)}}});q(aa.ctx,{displayName:"KeymapCtx<table>",group:"Table"});q(aa.shortcuts,{displayName:"Keymap<table>",group:"Table"});var no="footnote_definition",xl="footnoteDefinition",la=Ee("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${no}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw ot(e);return{label:e.dataset.label}},contentElement:"dd"}],toDOM:e=>{const t=e.attrs.label;return["dl",{"data-label":t,"data-type":no},["dt",t],["dd",0]]},parseMarkdown:{match:({type:e})=>e===xl,runner:(e,t,n)=>{e.openNode(n,{label:t.label}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===no,runner:(e,t)=>{e.openNode(xl,void 0,{label:t.attrs.label,identifier:t.attrs.label}).next(t.content).closeNode()}}}));q(la.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"});q(la.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});var ro="footnote_reference",ia=Ee("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${ro}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw ot(e);return{label:e.dataset.label}}}],toDOM:e=>{const t=e.attrs.label;return["sup",{"data-label":t,"data-type":ro},t]},parseMarkdown:{match:({type:e})=>e==="footnoteReference",runner:(e,t,n)=>{e.addNode(n,{label:t.label})}},toMarkdown:{match:e=>e.type.name===ro,runner:(e,t)=>{e.addNode("footnoteReference",void 0,void 0,{label:t.attrs.label,identifier:t.attrs.label})}}}));q(ia.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"});q(ia.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});var ca=bt.extendSchema(e=>t=>{const n=e(t);return{...n,attrs:{...n.attrs,checked:{default:null,validate:"boolean|null"}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:r=>{if(!(r instanceof HTMLElement))throw ot(r);return{label:r.dataset.label,listType:r.dataset.listType,spread:r.dataset.spread,checked:r.dataset.checked?r.dataset.checked==="true":null}}},...n?.parseDOM||[]],toDOM:r=>n.toDOM&&r.attrs.checked==null?n.toDOM(r):["li",{"data-item-type":"task","data-label":r.attrs.label,"data-list-type":r.attrs.listType,"data-spread":r.attrs.spread,"data-checked":r.attrs.checked},0],parseMarkdown:{match:({type:r})=>r==="listItem",runner:(r,o,s)=>{if(o.checked==null){n.parseMarkdown.runner(r,o,s);return}const a=o.label!=null?`${o.label}.`:"•",l=o.checked!=null?!!o.checked:null,i=o.label!=null?"ordered":"bullet",c=o.spread!=null?`${o.spread}`:"true";r.openNode(s,{label:a,listType:i,spread:c,checked:l}),r.next(o.children),r.closeNode()}},toMarkdown:{match:r=>r.type.name==="list_item",runner:(r,o)=>{if(o.attrs.checked==null){n.toMarkdown.runner(r,o);return}const s=o.attrs.label,a=o.attrs.listType,l=o.attrs.spread==="true",i=o.attrs.checked;r.openNode("listItem",void 0,{label:s,listType:a,spread:l,checked:i}),r.next(o.content),r.closeNode()}}}});q(ca.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"});q(ca.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});var Hc=ue(()=>new Je(/^\[(?<checked>\s|x)\]\s$/,(e,t,n,r)=>{const o=e.doc.resolve(n);let s=0,a=o.node(s);for(;a&&a.type.name!=="list_item";)s--,a=o.node(s);if(!a||a.attrs.checked!=null)return null;const l=t.groups?.checked==="x",i=o.before(s),c=e.tr;return c.deleteRange(n,r).setNodeMarkup(i,void 0,{...a.attrs,checked:l}),c}));q(Hc,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});var ag=[na,aa].flat(),lg=[Kc,Hc],ig=[ta],cg=[jc],Fc=Q(()=>tg);q(Fc,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"});var ug=Q(()=>zh({}));q(ug,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});var qc=Q(()=>Uh({allowTableNodeSelection:!0}));q(qc,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});var zt=ve("remarkGFM",()=>Go);q(zt.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});q(zt.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});var dg=new fe("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");function fg(e,t){let n=0;return t.forEach((r,o,s)=>{r===e&&(n=s)}),n}var Wc=Q(()=>new Z({key:dg,appendTransaction:(e,t,n)=>{let r;const o=(s,a)=>{if(r||(r=n.tr),s.type.name!=="table_cell")return;const l=n.doc.resolve(a),i=l.node(l.depth),c=l.node(l.depth-1).firstChild;if(!c)return;const u=fg(s,i),d=c.maybeChild(u);if(!d)return;const f=d.attrs.alignment;f!==s.attrs.alignment&&r.setNodeMarkup(a,void 0,{...s.attrs,alignment:f})};return t.doc!==n.doc&&n.doc.descendants(o),r}}));q(Wc,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});var pg=[Wc,Fc,zt,qc].flat(),mg=[ca,pt,qn,an,Zt,Wn,la,ia,ea,sn].flat(),hg=[oa,ra,sa,Ec,Tc,Ic,Lc,Rc,$c,Dc,Oc,Pc,_c,zc,Bc,Nn],gg=[mg,lg,cg,ig,ag,hg,pg].flat();function bg(e,t,n,r){const o=e.value;if(/^[^*_\\]*\s+$/.test(o)){const s=o.replace(/\s+$/,"");if(!s)return o;const a=o.slice(s.length),l=n.safe(s,{...r,after:a[0],encode:[]});return l===s?o:l+a}return n.safe(o,{...r,encode:[]})}const yg=1,kg=2,Eo=e=>`&#x${e.toString(16).toUpperCase()};`,ua=e=>e>=55296&&e<=57343,yr=e=>!Number.isNaN(e)&&!ua(e)&&vi(e)&&Yo(e)===void 0;function vl(e,t,n){return t===126||t===95?!0:t===42?Io(e,n)!=="punct":!1}function Cl(e,t){const n=Yo(t);return n===yg?{inside:!0,outside:yr(e)}:n===kg?{inside:!1,outside:yr(e)}:{inside:!1,outside:!1}}const Uc=/(?:https?:\/\/|www\.)[^\s<]*$/i,Vc=/^(?:https?:\/\/|www\.)/i,Gc=(e,t,n)=>e?.children?.[t.indexStack[t.indexStack.length-1]+n],Yc=(e,t)=>{const n=Gc(e,t,-1);return n?.type==="text"&&(n.value.charAt(n.value.length-2)==="\\"||Uc.test(n.value))},Jc=(e,t)=>{const n=Gc(e,t,1);return n?.type==="text"&&Vc.test(n.value)},da=new Set(["delete","strong","emphasis"]),en=e=>Array.isArray(e?.children)&&e.children.every(t=>t.type==="text"?!t.value:da.has(t.type)&&en(t));let Ot=!1;function wg(e){Ot=!0;try{return e()}finally{Ot=!1}}const Sl={inside:!1,outside:!1},Xc=(e,t,n,r)=>{if(en(e))return"";const o=n.createTracker(r),s=n.enter("strikethrough"),a=o.move("~~");let l=o.move(n.containerPhrasing(e,{...o.current(),before:a,after:"~"}));const i=l.charCodeAt(0),c=Ot?Sl:Cl(r.before.charCodeAt(r.before.length-1),i);c.inside&&(l=Eo(i)+l.slice(1));const u=l.charCodeAt(l.length-1),d=Ot?Sl:Cl(r.after.charCodeAt(0),u);d.inside&&(l=l.slice(0,-1)+Eo(u));const f=o.move("~~");return s(),n.attentionEncodeSurroundingInfo={after:d.outside&&!Jc(t,n),before:c.outside&&!Yc(t,n)},a+l+f};Xc.peek=e=>en(e)?"":"~";function Qc(e){const t=(n,r,o,s)=>{if(en(n))return"";const a=e(n,r,o,s),l=o.attentionEncodeSurroundingInfo;if(l){const i=n.type==="strong"?2:1,c=a.charCodeAt(i),u=a.charCodeAt(a.length-i-1);l.before&&(Ot||vl(n,c,!1)||Yc(r,o)||!yr(s.before.charCodeAt(s.before.length-1)))&&(l.before=!1),l.after&&(Ot||vl(n,u,!0)||Jc(r,o)||!yr(s.after.charCodeAt(0)))&&(l.after=!1)}return a};return t.peek=(n,r,o)=>en(n)?"":e.peek(n,r,o),t}const xg=Qc(Xt.strong),vg=Qc(Xt.emphasis);function Cg(e){const t=[];for(const n of e.children){const r=t[t.length-1];r&&da.has(n.type)&&n.type===r.type?r.children=[...r.children,...n.children]:t.push(n)}return t}const To=new Set(["strong","emphasis"]),Zc=e=>e.type==="text"?!e.value:da.has(e.type)&&en(e);function eu(e,t){let n=e;for(;;){const r=n.children??[];let o=t?r.length-1:0;for(;o>=0&&o<r.length&&Zc(r[o]);)o+=t?-1:1;if(o<0||o>=r.length)return null;if(!To.has(r[o].type))return{host:n,index:o};n=r[o]}}function Io(e,t){const n=eu(e,t);if(!n)return"ok";const r=n.host.children[n.index];if(r.type==="delete"||r.type==="break")return"ok";if(r.type!=="text")return"punct";const o=r.value,s=t?o.charCodeAt(o.length-1):o.charCodeAt(0);if(t&&(s===42||s===95||s===126))return"ok";if(Yo(s)!==void 0)return"punct";const a=t?o.codePointAt(o.length-(o.length>1&&ua(s)?2:1)):o.codePointAt(0);return!vi(a)||(t?Uc.test(o):Vc.test(o))?"ok":"letter"}function Al(e,t){const n=eu(e,t);if(!n)return!1;const r=n.host.children,o=r[n.index].value,s=t?o.length-(o.length>1&&ua(o.charCodeAt(o.length-1))?2:1):0,a=o.codePointAt(s),l=[{type:"text",value:o.slice(0,s)},{type:Lo,value:Eo(a)},{type:"text",value:o.slice(s+(a>65535?2:1))}];return r.splice(n.index,1,...l.filter(i=>i.type===Lo||i.value)),!0}const Lo="amadeusCharRef",tu=e=>e.value;tu.peek=()=>"&";function nu(e){if(Array.isArray(e?.children)){e.children=Cg(e);for(let t=!Ot;t;){t=!1;const n=e.children.filter(r=>!Zc(r));for(let r=1;r<n.length;r++){const[o,s]=[n[r-1],n[r]];if(!To.has(o.type)||!To.has(s.type))continue;const a=Io(o,!0),l=Io(s,!1);if(a==="letter"&&l==="punct"?t=Al(o,!0):a==="punct"&&l==="letter"&&(t=Al(s,!1)),t)break}}for(const t of e.children)nu(t)}}const Sg=(e,t,n,r)=>(nu(e),Xt.root(e,t,n,r)),Ag=bg,Mg={root:Sg,text:Ag,delete:Xc,strong:xg,emphasis:vg,[Lo]:tu},Ng=zn(e=>{e.update(jt,t=>({...t,handlers:{...t.handlers,...Mg}}))});function Eg(){Nf.call(this),Ef.call(this,{singleTilde:!1})}const Tg=ve("amadeusCjkFriendly",()=>Eg),En="amadeusU",Tn="amadeusFg",In="amadeusBg",fa="amadeusKbd",pa="amadeusSub",ma="amadeusSup",ha=new Map([["kbd",fa],["sub",pa],["sup",ma]]),kr=e=>/^(#[0-9a-fA-F]{3,8}|rgba?\([\d.,%\s/]+\)|hsla?\([\d.,%\s/]+\)|[a-zA-Z]+|var\(--[\w-]+\))$/.test(e.trim());function ru(e){if(e?.type!=="html"||typeof e.value!="string")return null;const t=e.value.trim();if(/^<u>$/i.test(t))return{type:En};const n=/^<([a-z]+)>$/.exec(t),r=n&&ha.get(n[1]);if(r)return{type:r};let o=t.match(/^<span\s+style\s*=\s*"(?:[^"]*;\s*)?color\s*:\s*([^;"]+)[^"]*"\s*>$/i);if(o){const s=o[1].trim();return kr(s)?{type:Tn,color:s}:null}if(o=t.match(/^<mark(?:\s+style\s*=\s*"(?:[^"]*;\s*)?background\s*:\s*([^;"]+)[^"]*")?\s*>$/i),o){const s=(o[1]??"").trim();return s&&!kr(s)?null:{type:In,bg:s}}return null}function ou(e){if(e?.type!=="html"||typeof e.value!="string")return null;const t=e.value.trim();if(/^<\/u>$/i.test(t))return En;if(/^<\/span>$/i.test(t))return Tn;if(/^<\/mark>$/i.test(t))return In;const n=/^<\/([a-z]+)>$/.exec(t);return n&&ha.get(n[1])||null}const Ig=16,Ml=new Set(ha.values()),Lg=new Set(["paragraph","heading","tableCell"]);function Rg(e){const t=new Map,n=new Set,r=o=>{for(const s of o){const a=ru(s)?.type;if(a&&Ml.has(a)){const i=(t.get(a)??0)+1;t.set(a,i),i>1&&n.add(a);continue}const l=ou(s);if(l&&Ml.has(l)){t.set(l,Math.max(0,(t.get(l)??0)-1));continue}Array.isArray(s?.children)&&r(s.children)}};return r(e),n}function su(e,t=new Set){const n=[],r=[{tgt:n,type:null,kind:"real",raw:null,node:null}],o=()=>r[r.length-1];for(const s of e){const a=ru(s),l=a&&!t.has(a.type)?a:null,i=ou(s),c=i&&!t.has(i)?i:null;if(l){const u=r.length-1,d=r.some(f=>f.kind==="real"&&f.type===l.type);if(u>=Ig)o().tgt.push(s),r.push({tgt:o().tgt,type:l.type,kind:"literal",raw:s,node:null});else if(d)r.push({tgt:o().tgt,type:l.type,kind:"phantom",raw:s,node:null});else{const f={...l,children:[]};o().tgt.push(f),r.push({tgt:f.children,type:l.type,kind:"real",raw:s,node:f})}}else if(c&&r.length>1&&o().type===c)r.pop().kind==="literal"&&o().tgt.push(s);else{if(Array.isArray(s?.children)){const u=Lg.has(s.type)?new Set([...t,...Rg(s.children)]):t;s.children=su(s.children,u)}o().tgt.push(s)}}for(;r.length>1;){const s=r.pop();if(s.kind==="real"){const a=o().tgt,l=a.indexOf(s.node);l>=0&&a.splice(l,1,s.raw,...s.node.children)}}return n}function Ft(e,t){const n=(r,o,s,a)=>{const l=s.createTracker(a),i=s.enter("emphasis");let c=l.move(e(r));return c+=s.containerPhrasing(r,{...a,before:">",after:"<"}),c+=l.move(t),i(),c};return n.peek=()=>"<",n}function $g(){const e=this.data();return(e.toMarkdownExtensions||=[]).push({handlers:{[En]:Ft(()=>"<u>","</u>"),[Tn]:Ft(n=>`<span style="color:${n.color}">`,"</span>"),[In]:Ft(n=>n.bg?`<mark style="background:${n.bg}">`:"<mark>","</mark>"),[fa]:Ft(()=>"<kbd>","</kbd>"),[pa]:Ft(()=>"<sub>","</sub>"),[ma]:Ft(()=>"<sup>","</sup>")}}),n=>{Array.isArray(n?.children)&&(n.children=su(n.children))}}const Dg=ve("amadeusInlineHtmlMarks",()=>$g),au=at("amadeusUnderline",()=>({parseDOM:[{tag:"u"}],toDOM:()=>["u",0],parseMarkdown:{match:e=>e.type===En,runner:(e,t,n)=>{e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name==="amadeusUnderline",runner:(e,t)=>{e.withMark(t,En)}}}));function ga(e,t,n){return at(e,()=>({parseDOM:[{tag:t}],toDOM:()=>[t,0],parseMarkdown:{match:r=>r.type===n,runner:(r,o,s)=>{r.openMark(s),r.next(o.children),r.closeMark(s)}},toMarkdown:{match:r=>r.type.name===e,runner:(r,o)=>{r.withMark(o,n)}}}))}const _g=ga("amadeusKbd","kbd",fa),zg=ga("amadeusSub","sub",pa),Og=ga("amadeusSup","sup",ma),ba={"#c62222":"red","#b9450a":"orange","#8f6203":"yellow","#117b38":"green","#06748f":"teal","#2159d3":"blue","#842ed3":"purple","#941555":"magenta","#6a6a6a":"grey","#d34f0b":"orange","#b67c04":"yellow","#149343":"green","#0782a0":"teal","#7a7a7a":"grey","#ca4c0b":"orange","#9e6b03":"yellow","#12873e":"green","#077f9d":"teal","#757575":"grey","#c83030":"red","#db7123":"orange","#ac7400":"yellow","#225c18":"green","#0e4841":"teal","#003c67":"blue","#7c3aed":"purple","#e03131":"red","#e8590c":"orange","#f08c00":"yellow","#2f9e44":"green","#0c8599":"teal","#1971c2":"blue","#9c36b5":"purple","#868e96":"grey"},ya={"#fed5d5":"red","#fedfbb":"orange","#fef3a1":"yellow","#e1fab1":"green","#adf8e9":"teal","#cce2fe":"blue","#edddff":"purple","#ffcece":"magenta","#eaecef":"grey","#fce5e6":"red","#ffebd5":"orange","#fff9b6":"yellow","#f0fccb":"green","#c7f8f2":"teal","#daf0ff":"blue","#ede9ff":"purple","#ffecf6":"magenta","#e6e6e6":"grey","#ffe3e3":"red","#ffe8cc":"orange","#fff3bf":"yellow","#d3f9d8":"green","#c5f6fa":"teal","#d0ebff":"blue","#f3d9fa":"purple","#e9ecef":"grey"};function lu(e){const t=e.trim().toLowerCase(),n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/.exec(t);if(n)return"#"+(n[1].length===3?[...n[1]].map(s=>s+s).join(""):n[1]);const r=/^rgba?\(\s*(\d{1,3})\s*[,\s]\s*(\d{1,3})\s*[,\s]\s*(\d{1,3})\s*(?:[,/]\s*([\d.]+)(%?)\s*)?\)$/.exec(t);if(!r||r[4]!==void 0&&Number(r[4])!==(r[5]?100:1))return null;const o=[r[1],r[2],r[3]].map(Number);return o.some(s=>s>255)?null:"#"+o.map(s=>s.toString(16).padStart(2,"0")).join("")}const iu=e=>{const t={};for(const[n,r]of Object.entries(e))r in t||(t[r]=n);return t},Pg=iu(ba),Bg=iu(ya),cu=(e,t,n,r)=>{const o=lu(r);return o&&e[o]&&(!n||e[o]===n)?o:n&&t[n]?t[n]:null};function Kg(e){const t=e.getAttribute("data-amx-fg");if(t&&kr(t))return{color:t};if(!e.style.color)return!1;const n=cu(ba,Pg,e.getAttribute("data-hlc"),e.style.color);return n?{color:n}:!1}function jg(e){const t=e.getAttribute("data-amx-bg");return t!==null&&(t===""||kr(t))?{bg:t}:{bg:cu(ya,Bg,e.getAttribute("data-hl"),e.style.backgroundColor)??""}}const uu=(e,t)=>e[lu(t)??t.toLowerCase()],Ro=at("amadeusColor",()=>({attrs:{color:{default:""}},parseDOM:[{tag:'span[style*="color"]',getAttrs:e=>Kg(e)}],toDOM:e=>{const t=String(e.attrs.color),n=uu(ba,t);return["span",{style:`color:${t}`,"data-amx-fg":t,...n?{"data-hlc":n}:{}},0]},parseMarkdown:{match:e=>e.type===Tn,runner:(e,t,n)=>{e.openMark(n,{color:t.color}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name==="amadeusColor",runner:(e,t)=>{e.withMark(t,Tn,void 0,{color:t.attrs.color})}}})),$o=at("amadeusBg",()=>({attrs:{bg:{default:""}},parseDOM:[{tag:"mark",getAttrs:e=>jg(e)}],toDOM:e=>{const t=String(e.attrs.bg);if(!t)return["mark",{"data-amx-bg":""},0];const n=uu(ya,t);return["mark",{style:`background:${t}`,"data-amx-bg":t,...n?{"data-hl":n}:{}},0]},parseMarkdown:{match:e=>e.type===In,runner:(e,t,n)=>{e.openMark(n,{bg:t.bg}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name==="amadeusBg",runner:(e,t)=>{e.withMark(t,In,void 0,{bg:t.attrs.bg})}}})),oo=F("AmadeusToggleUnderline",e=>()=>_n(au.type(e)));function du(e,t){return(n,r)=>{const{from:o,to:s,empty:a}=n.selection;return a?!1:(r&&r(n.tr.removeMark(o,s,e).addMark(o,s,e.create(t))),!0)}}function fu(e){return(t,n)=>{const{from:r,to:o,empty:s}=t.selection;return s?!1:(n&&n(t.tr.removeMark(r,o,e)),!0)}}const Nl=F("AmadeusApplyColor",e=>t=>t?du(Ro.type(e),{color:t}):fu(Ro.type(e))),El=F("AmadeusApplyBg",e=>t=>t?du($o.type(e),{bg:t}):fu($o.type(e)));De({"obsinline.comment.title":{zh:"注释(点击编辑)",en:"Comment (click to edit)"}});function pu(e){if(e.indexOf("%%")===-1&&e.indexOf("==")===-1)return[];let t=e;for(const o of Fi(e))t=t.slice(0,o.from)+" ".repeat(o.to-o.from)+t.slice(o.to);const n=[];for(let o=t.indexOf("%%");o!==-1;){const s=t.indexOf("%%",o+2);if(s===-1)break;s>o+2?(n.push({kind:"cmt",from:o,to:s+2}),o=t.indexOf("%%",s+2)):o=t.indexOf("%%",o+1)}const r=new RegExp("(?<!=)==(?![\\s=])([^\\n]*?)(?<![\\s=])==(?!=)","g");for(let o=r.exec(t);o;o=r.exec(t)){const s=o.index,a=s+o[0].length;a-s<=4||n.some(l=>l.kind==="cmt"&&s<l.to&&a>l.from)||n.push({kind:"hl",from:s,to:a})}return n.sort((o,s)=>o.from-s.from)}const Hg=new fe("amadeus-obsidian-inline");function Fg(e,t){const n=document.createElement("span");return n.className="amx-obs-cmt-badge",n.contentEditable="false",n.textContent="%%",n.title=O("obsinline.comment.title"),n.addEventListener("mousedown",r=>{if(!e.editable)return;r.preventDefault();const o=Math.min(t,e.state.doc.content.size);e.dispatch(e.state.tr.setSelection(j.create(e.state.doc,o)).setMeta(Vp,!0)),e.focus()}),n}function qg(e){const t=os(e),{from:n,to:r}=e.selection,o=[];return e.doc.descendants((s,a)=>{if(!s.isTextblock)return!0;if(s.type.spec.code)return!1;const l=s.textContent;if(l.indexOf("%%")===-1&&l.indexOf("==")===-1)return!1;const i=a+1;for(const c of pu(Rr(s))){const u=i+c.from,d=i+c.to,f=t&&n<=d&&r>=u;if(c.kind==="hl"){o.push(Y.inline(u+2,d-2,{class:"amx-obs-hl"}));const m=f?"amx-obs-delim":"amx-obs-hidden";o.push(Y.inline(u,u+2,{class:m}),Y.inline(d-2,d,{class:m}))}else f?o.push(Y.inline(u,d,{class:"amx-obs-cmt"})):(o.push(Y.inline(u,d,{class:"amx-obs-hidden"})),o.push(Y.widget(u,m=>Fg(m,u+2),{side:-1,ignoreSelection:!0,key:`obs-cmt:${u}`})))}return!1}),o.length?me.create(e.doc,o):me.empty}function Wg(){return Q(()=>new Z({key:Hg,props:{decorations:e=>qg(e)}}))}const Ug=(e,t)=>{const{$from:n,$to:r,from:o,to:s,empty:a}=e.selection;if(!n.sameParent(r)||!n.parent.isTextblock||n.parent.type.spec.code)return!0;const l=n.start(),i=pu(Rr(n.parent)).find(p=>p.kind==="hl"&&l+p.from<=o&&s<=l+p.to);if(i)return t?.(e.tr.delete(l+i.to-2,l+i.to).delete(l+i.from,l+i.from+2)),!0;if(a)return!0;const c=e.doc.textBetween(o,s,`
|
|
4
4
|
`,"");if(c.includes(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as e,u as ot,d as l,T,R as ct,r as it}from"./index-
|
|
1
|
+
import{j as e,u as ot,d as l,T,R as ct,r as it}from"./index-BYUntVIZ.js";import{bH as Ie,bG as ut,fD as De,ej as Z,I as Oe,at as dt,c6 as Q,T as mt,ah as ft,ml as pt,mm as xt,bq as ht,ai as vt}from"./appStore-affnJoin.js";import"./client-BqhpYbYL.js";function wt({model:n}){return n.source!=="forsion"?null:e.jsxs(e.Fragment,{children:[!!n.tags?.length&&e.jsx("span",{className:"model-tags",children:n.tags.map((a,u)=>e.jsx("span",{className:"model-tag","data-color":a.color,title:a.text,children:a.text},u))}),n.multiplier!=null&&Number.isFinite(n.multiplier)&&n.multiplier>=0&&e.jsxs("span",{className:"model-multiplier",children:[n.multiplier.toFixed(2),"x"]})]})}const Pt=Ie,jt=n=>`input.thinkingShort.${n}`;function bt(n,a){return a(jt(n))}it({"pill.rowAdvanced":{zh:"高级",en:"Advanced"},"pill.nativeDone":{zh:"完成",en:"Done"},"pill.nativeSearch":{zh:"搜索模型",en:"Search models"},"pill.nativeBack":{zh:"返回",en:"Back"},"pill.rowModel":{zh:"模型",en:"Model"},"pill.rowEffort":{zh:"思考档位",en:"Thinking effort"},"pill.reasoningStrength":{zh:"思考档位",en:"Thinking effort"},"pill.defaultAuxModel":{zh:"默认辅助模型",en:"Default auxiliary model"},"pill.defaultImageModel":{zh:"生图模型",en:"Image generation model"},"pill.defaultVisionModel":{zh:"识图辅助模型",en:"Vision auxiliary model"},"pill.followCloudDefault":{zh:"跟随云端默认",en:"Follow cloud default"},"pill.noModels":{zh:"暂无可用模型",en:"No available models"},"pill.faster":{zh:"更快",en:"Faster"},"pill.smarter":{zh:"更智能",en:"Smarter"},"pill.rowContext":{zh:"上下文上限",en:"Context limit"},"pill.ctxDefault":{zh:"默认 · {n}",en:"Default · {n}"},"pill.ctxMax":{zh:"最大 · {n}",en:"Maximum · {n}"},"pill.ctxHint":{zh:"对本机这个模型的所有会话生效。超过 {n} 后每轮都要重发更多上下文,额度消耗随之上升。",en:"Applies to every conversation with this model on this device. Past {n}, each turn resends more context, so usage rises with it."},"pill.ctxUltra":{zh:"Ultra 下自动用满 {n};关掉 Ultra 后按这里的设置。",en:"Ultra uses the full {n} automatically. This setting applies again once Ultra is off."},"pill.ultra":{zh:"Ultra",en:"Ultra"},"pill.ultraNote":{zh:"思考拉满,主动并行派子代理",en:"Max thinking + parallel subagents"},"pill.ultraTitle":{zh:"Ultra:思考拉满 + 主动并行派子代理(额度消耗会成倍增加)",en:"Ultra: max thinking plus proactive parallel subagents (uses several times the quota)"}});const gt=150,Nt=n=>`input.thinking.${n}`,qe=(n,a)=>bt(n,a),I=n=>n>=1e6?`${Math.floor(n/1e5)/10}M`:`${Math.floor(n/100)/10}k`;function Ue(n){if(n?.contextWindow)return n.contextWindowSource==="override"?n.contextWindow:Math.max(n.contextWindow,n.maxContextWindow??0)}function At(n){const a=n.ultra&&!!n.engineUncapped,u=!!n.ctxInfo&&!n.running&&!!n.ctxInfo.ultra!==a;return!u&&(n.ctxInfo||!a)?{window:n.contextWindow,stale:u}:{window:(a?Ue(n.model):n.model?.contextWindow)||n.contextWindow,stale:u}}function yt(n,a,u=!1){const c=n?.maxContextWindow;if(!n?.contextWindow||!c||!a)return null;const f=n.contextWindowSource==="override";return c<=a&&!f?null:{current:u&&Ue(n)||n.contextWindow,defaultTokens:Math.min(c,a),...c>a?{maxTokens:c}:{},selected:f?c>a&&n.contextWindow===c?"max":null:"default"}}function Mt(n){return T[Math.max(0,Math.min(T.length-1,Math.round(n)))]}function kt(n,a){const u=Math.round(n);return a&&u>=T.length?{level:"max",ultra:!0}:{level:Mt(u),...a?{ultra:!1}:{}}}function $t(n,a){if(a==="imageModelId")return n.filter(c=>c.modelType==="image_gen");const u=n.filter(c=>(c.modelType||"llm")==="llm");return a==="visionModelId"?u.filter(c=>c.supportsVision!==!1):u}const Et=1200;function zt(n,a,u){const c=l.useRef(0),f=l.useRef(null);l.useEffect(()=>{const p=n.current;if(!p)return;f.current!==p&&(f.current=p,c.current=0);const g=()=>p.getAnimations?.({subtree:!0})??[],d=c.current,N=a?1:0,E=Et*Math.abs(N-d);g().forEach(L=>{L.playbackRate=d}),a&&(p.dataset.on="");const k=performance.now();let h=0;const w=L=>{const R=E?Math.min(1,(L-k)/E):1,$=d+(N-d)*R*R*(3-2*R),P=g();c.current=$,P.forEach(b=>{b.playbackRate=$}),p.style.opacity=String(Math.min(1,$*2)),R<1?h=requestAnimationFrame(w):a||delete p.dataset.on};return h=requestAnimationFrame(w),()=>cancelAnimationFrame(h)},[n,a,u])}const ne=({text:n})=>{const a=l.useRef(null),[u,c]=l.useState(0);return l.useLayoutEffect(()=>{const f=a.current;if(!f)return;const p=()=>c(Math.max(0,f.scrollWidth-f.clientWidth));if(typeof ResizeObserver>"u"){p();return}const g=new ResizeObserver(p);return g.observe(f),()=>g.disconnect()},[n]),e.jsx("span",{ref:a,className:`pill-marquee${u>2?" is-over":""}`,style:{"--marquee-shift":`${u}px`},children:e.jsx("span",{className:"pill-marquee__inner",children:n})})};function St({portal:n,anchorRef:a,innerRef:u,style:c,children:f}){const[p,g]=l.useState({x:0,y:0,top:0});return l.useLayoutEffect(()=>{if(!n)return;const d=()=>{const E=a.current;if(!E)return;const k=E.getBoundingClientRect(),h={x:k.left,y:k.bottom+8,top:k.top-8};g(w=>w.x===h.x&&w.y===h.y&&w.top===h.top?w:h)};d(),window.addEventListener("resize",d),window.addEventListener(Z,d),document.addEventListener("scroll",d,!0);const N=new ResizeObserver(d);return a.current&&N.observe(a.current),()=>{window.removeEventListener("resize",d),window.removeEventListener(Z,d),document.removeEventListener("scroll",d,!0),N.disconnect()}},[n,a]),n?ht.createPortal(e.jsx("div",{className:"ui-popover-backdrop",style:{pointerEvents:"none"},"data-cmenu":!0,children:e.jsx(vt,{x:p.x,y:p.y,anchorTop:p.top,prefer:"above",innerRef:u,className:"composer-menu composer-menu--model composer-menu--portal",children:f})}),document.body):e.jsx("div",{ref:u,className:"composer-menu composer-menu--model",style:c,children:f})}const Wt=({className:n,scopeKey:a,onSelectionChange:u,menuPortal:c=!1,open:f,onOpenChange:p,disabled:g,modelId:d,groups:N,onSelect:E,thinkingLevel:k,onThinkingChange:h,allowUltra:w=!1,ultra:L,running:R=!1,supportedThinking:$,effectiveThinking:P,modelsResponse:b,defaultModelIds:se,onDefaultModelChange:ae,onContextWindowChange:re,emptyLabel:le,footnote:oe,title:ce,icon:U,hub:Ct})=>{const{t:r}=ot(),_e=ut(),[ie,J]=l.useState(""),[Be,He]=l.useState(!1),v=f??Be,A=t=>{!t&&B.current?.contains(document.activeElement)&&_.current?.querySelector("button")?.focus({preventScroll:!0}),f===void 0&&He(t),p?.(t)},[W,ue]=l.useState(!1),[m,F]=l.useState(null),[de,Ve]=l.useState("right"),[Ke,Ge]=l.useState(0),_=l.useRef(null),B=l.useRef(null),z=l.useRef(null),[X,me]=l.useState(!1),Qe=N.flatMap(t=>t.options.map(s=>s.id)).join(`
|
|
2
2
|
`);l.useEffect(()=>()=>{z.current?.abort(),z.current=null},[]),l.useLayoutEffect(()=>{z.current&&(z.current.abort(),z.current=null,me(!1),A(!1))},[a,g,d,k,L,Qe]),l.useEffect(()=>{v||(z.current?.abort(),z.current=null,me(!1))},[v]);const fe=l.useRef(null),pe=l.useRef(0),S=()=>window.clearTimeout(pe.current),xe=De(v&&!c,{boundary:".t2-chat-view"}),he=De(m?`${m}:${de}`:"",{boundary:".t2-chat-view"});l.useEffect(()=>{if(!v){S(),F(null),ue(!1),J("");return}const t=j=>!!j?.closest?.("[data-keep-menus]"),s=j=>{!t(j.target)&&!_.current?.contains(j.target)&&!B.current?.contains(j.target)&&A(!1)},o=j=>{j.key==="Escape"&&!document.querySelector("[data-keep-menus]")&&A(!1)};return document.addEventListener("mousedown",s),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("keydown",o)}},[v]),l.useLayoutEffect(()=>{const t=B.current,s=fe.current;if(!m||!t||!s)return;const o=()=>{const G=t.getBoundingClientRect(),Re=(t.closest(".t2c-card")||t.closest(".t2-chat-view"))?.getBoundingClientRect(),Te=t.closest(".t2-chat-view")?.getBoundingClientRect(),Pe=t.querySelector(`[data-pane-trigger="${m}"]`)?.getBoundingClientRect(),Ae=ft(s),We=pt(G.left,G.right,s.offsetWidth,Re?.left??0,Re?.right??window.innerWidth,Ae);if(Ve(q=>q===We?q:We),Pe){const q=xt(Pe.top,s.offsetHeight,G.top,G.bottom,Te?.top??0,Te?.bottom??window.innerHeight,Ae);Ge(Fe=>Math.abs(Fe-q)<.5?Fe:q)}};o(),window.addEventListener("resize",o),window.addEventListener(Z,o);const j=new ResizeObserver(o);j.observe(t),j.observe(s);const Le=t.closest(".t2c-card")||t.closest(".t2-chat-view");return Le&&j.observe(Le),()=>{window.removeEventListener("resize",o),window.removeEventListener(Z,o),j.disconnect()}},[m]);const ve=N.flatMap(t=>t.options),Ze=ve.length>0,Je=ve.find(t=>t.id===d)||b?.models.find(t=>t.id===d),Xe=!h&&!Ze&&!!le,H=Je?.name||le||r("input.selectModel"),i=w&&!!L,y=i?"max":k||"medium",D=i?r("pill.ultra"):qe(y,r),Ye=y!=="off"?` · ${D}`:"",O=T.length-(w?0:1),V=i?O:Math.max(0,T.indexOf(y)),we=`${V/O*100}%`,et=`calc(${we} + ${(.5-V/O)*25}px)`,je=P&&P!==y?` → ${qe(P,r)}`:"",be=y==="max",Y=`${be?" is-max":""}${i?" is-ultra":""}`,ge=l.useRef(null);zt(ge,R,i);const[Ne,ee]=l.useState(0),ye=l.useRef(i);l.useEffect(()=>{i&&!ye.current&&v&&ee(t=>t+1),ye.current=i},[i,v]),l.useEffect(()=>{v||ee(0)},[v]);const Me=l.useId(),x=re&&d&&b?.modelOverridesWritable?yt(b.models.find(t=>t.id===d),b.contextWindowCap,i&&!!b.ultraUncapped):null,ke=t=>{S(),F(null),d&&re?.(d,t)},tt=t=>Ie(t,_e).map(s=>({key:s.key,source:s.source,label:s.provider,options:s.models.map(o=>({...o,description:`${o.provider} · ${o.id}`}))})),nt=t=>$t(b?.models||[],t),st=t=>b?.[t],$e=t=>t?b?.models.find(s=>s.id===t)?.name||t:"",Ee=t=>{const s=se?.[t];if(s)return $e(s);const o=st(t);return o?`${r("pill.followCloudDefault")} · ${$e(o)}`:r("pill.followCloudDefault")},at=[{slot:"backgroundModelId",label:r("pill.defaultAuxModel")},{slot:"imageModelId",label:r("pill.defaultImageModel")},{slot:"visionModelId",label:r("pill.defaultVisionModel")}],M=m&&m!=="model"&&m!=="context"?m:null,ze=m==="model"?N:M?tt(nt(M)):[],rt=ie.trim().toLowerCase(),te=ze.map(t=>({...t,options:t.options.filter(s=>`${t.label} ${s.name} ${s.id} ${s.tags?.map(o=>o.text).join(" ")||""}`.toLowerCase().includes(rt))})).filter(t=>t.options.length),K=m==="model"?d:M&&se?.[M]||"",Se=(t,s)=>{ae?.(t,s),S(),F(null)},C=t=>()=>{S(),m!==t&&J(""),F(t)},Ce=t=>()=>{S(),pe.current=window.setTimeout(C(t),gt)},lt=async()=>{{A(!v);return}};return Xe?e.jsxs("span",{className:`composer-chip composer-chip--readonly${n?` ${n}`:""}`,title:ce,children:[U===void 0?e.jsx(Oe,{size:13}):U,e.jsx(ne,{text:H})]}):e.jsxs("span",{ref:_,className:`model-pill-wrap${v&&!X?" is-open":""}${n?` ${n}`:""}`,"data-cmenu":!0,children:[e.jsxs("button",{type:"button",className:`composer-chip model-pill-btn${v&&!X?" is-open":""}${Y}`,title:ce||r("input.modelChipTitle"),disabled:g,"aria-expanded":v,onClick:()=>{lt()},children:[i&&e.jsx("span",{ref:ge,className:"pill-ultra-streaks","aria-hidden":"true",children:[0,1,2,3].map(t=>e.jsx("i",{},t))}),U===void 0?e.jsx(Oe,{size:13}):U,i?e.jsxs("span",{className:"pill-ultra-label",children:[e.jsx(ne,{text:H}),e.jsx("span",{className:"pill-ultra-tag",children:D})]}):e.jsx(ne,{text:H+Ye}),e.jsx(dt,{size:10})]}),v&&!X&&e.jsxs(St,{portal:c,anchorRef:_,innerRef:t=>{B.current=t,xe.ref.current=t},style:xe.style,children:[h&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`cm-advanced-reveal${W?" is-open":""}`,"aria-hidden":!W,children:e.jsx("div",{className:"cm-advanced-reveal-inner",children:e.jsxs("div",{className:"cm-advanced-list",children:[e.jsxs("div",{className:"cm-row cm-row--static",children:[e.jsx("span",{className:"cm-row-k",children:r("pill.reasoningStrength")}),e.jsxs("span",{className:`cm-row-v${Y}`,children:[D,je]})]}),ae&&at.map(({slot:t,label:s})=>e.jsxs("button",{type:"button",className:`cm-row${m===t?" is-open":""}`,"data-pane-trigger":t,tabIndex:W?0:-1,onFocus:C(t),onClick:C(t),children:[e.jsx("span",{className:"cm-row-k",children:s}),e.jsx("span",{className:"cm-row-v",children:Ee(t)}),e.jsx(Q,{size:13})]},t))]})})}),e.jsxs("button",{type:"button",className:`cm-row cm-advanced-toggle${W?" is-open":""}`,"aria-expanded":W,onClick:()=>{ue(t=>!t),F(null)},children:[e.jsx("span",{className:"cm-row-k",children:r("pill.rowAdvanced")}),e.jsx("span",{className:"cm-row-v"}),e.jsx(Q,{size:13})]})]}),x&&e.jsxs("button",{type:"button",className:`cm-row${m==="context"?" is-open":""}`,"data-pane-trigger":"context",onMouseEnter:Ce("context"),onMouseLeave:S,onFocus:C("context"),onClick:C("context"),children:[e.jsx("span",{className:"cm-row-k",children:r("pill.rowContext")}),e.jsx("span",{className:"cm-row-v",children:I(x.current)}),e.jsx(Q,{size:13})]}),e.jsxs("button",{type:"button",className:`cm-row cm-model-row${m==="model"?" is-open":""}`,"data-pane-trigger":"model",onMouseEnter:Ce("model"),onMouseLeave:S,onFocus:C("model"),onClick:C("model"),children:[e.jsx("span",{className:"cm-row-k",children:r("pill.rowModel")}),e.jsx("span",{className:"cm-row-v",children:H}),e.jsx(Q,{size:13})]}),h&&e.jsxs("div",{className:`cm-effort${Y}`,"data-effort":i?"ultra":y,children:[e.jsxs("div",{className:"cm-effort-head",children:[e.jsx("span",{children:r("pill.rowEffort")}),e.jsxs("span",{className:"cm-effort-value",children:[D,je]},i?"ultra":y)]}),e.jsxs("div",{className:"cm-effort-ends",children:[e.jsx("span",{children:r("pill.faster")}),e.jsx("span",{children:r("pill.smarter")})]}),e.jsxs("div",{className:"cm-effort-slider-wrap",children:[e.jsxs("span",{className:"cm-effort-track","aria-hidden":"true",children:[e.jsx("span",{className:"cm-effort-range",style:{width:we}}),be&&!i&&e.jsx("span",{className:"cm-effort-sparkles",children:Array.from({length:10},(t,s)=>e.jsx("i",{},s))}),i&&e.jsx("span",{className:"cm-effort-streaks",children:Array.from({length:4},(t,s)=>e.jsx("i",{},s))}),e.jsxs("span",{className:"cm-effort-ticks",children:[T.map((t,s)=>e.jsx("i",{className:`${s<=V?" is-on":""}${$&&!$.includes(t)?" is-unsupported":""}`,style:{left:`${s/O*100}%`}},t)),w&&e.jsx("i",{className:`is-ultra-stop${i?" is-on":""}`,style:{left:"100%"}},"ultra")]})]}),e.jsx("span",{className:"cm-effort-thumb",style:{left:et},"aria-hidden":"true",children:Ne>0&&i&&e.jsx("i",{className:"cm-effort-burst",onAnimationEnd:()=>ee(0)},Ne)}),e.jsx("input",{className:"cm-effort-input",type:"range",min:0,max:O,step:1,value:V,"aria-label":r("pill.reasoningStrength"),"aria-valuetext":i?r("pill.ultraTitle"):`${D}${$&&!$.includes(y)?` ${r("pill.thinkUnsupported")}`:""}`,"aria-describedby":i?Me:void 0,title:r(i?"pill.ultraTitle":Nt(y)),onChange:t=>{const s=kt(Number(t.currentTarget.value),w);w?h(s.level,s.ultra):h(s.level)}})]}),i&&e.jsx("div",{id:Me,className:"cm-effort-note",children:r("pill.ultraNote")})]}),oe&&e.jsx("div",{className:"menu-section cm-foot",children:oe}),m&&(m!=="context"||x)&&e.jsx("div",{ref:t=>{fe.current=t,he.ref.current=t},className:`cm-sub ${de}`,"data-pane":m,style:{...he.style,"--cm-sub-top":`${Ke}px`},children:m==="context"&&x?e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:`menu-item${x.selected==="default"?" active":""}`,onClick:()=>ke(null),children:[e.jsx("span",{className:"grow",children:r("pill.ctxDefault",{n:I(x.defaultTokens)})}),e.jsx("span",{className:"mi-check",children:x.selected==="default"?"✓":""})]}),x.maxTokens&&e.jsxs("button",{type:"button",className:`menu-item${x.selected==="max"?" active":""}`,onClick:()=>ke(x.maxTokens),children:[e.jsx("span",{className:"grow",children:r("pill.ctxMax",{n:I(x.maxTokens)})}),e.jsx("span",{className:"mi-check",children:x.selected==="max"?"✓":""})]}),e.jsxs("div",{className:"menu-section cm-foot",children:[i&&b?.ultraUncapped&&x.selected==="default"&&x.maxTokens?e.jsx("div",{children:r("pill.ctxUltra",{n:I(x.maxTokens)})}):null,r("pill.ctxHint",{n:I(x.defaultTokens)})]})]}):e.jsxs(e.Fragment,{children:[ze.reduce((t,s)=>t+s.options.length,0)>=8&&e.jsxs("label",{className:"model-picker-search",children:[e.jsx(mt,{size:12}),e.jsx("input",{"aria-label":r("model.searchPlaceholder"),placeholder:r("model.searchPlaceholder"),value:ie,onChange:t=>J(t.target.value)})]}),M&&e.jsxs("button",{type:"button",className:`menu-item${K?"":" active"}`,onClick:()=>Se(M,""),children:[e.jsx("span",{className:"grow",children:Ee(M)}),e.jsx("span",{className:"mi-check",children:K?"":"✓"})]}),te.map((t,s)=>e.jsxs(ct.Fragment,{children:[t.source&&te[s-1]?.source!==t.source&&e.jsx("div",{className:"menu-source",children:r(t.source==="forsion"?"model.group.forsion":"model.group.direct")}),t.label&&e.jsx("div",{className:"menu-section",children:t.label}),t.options.map(o=>e.jsxs("button",{type:"button",className:`menu-item${o.id===K?" active":""}`,title:o.description,onClick:()=>{m==="model"?(E(o.id),A(!1)):M&&Se(M,o.id)},children:[e.jsx("span",{className:"grow",children:o.name}),o.source&&e.jsx(wt,{model:{source:o.source,tags:o.tags,multiplier:o.multiplier}}),e.jsx("span",{className:"mi-check",children:o.id===K?"✓":""})]},o.id))]},t.key||t.label)),!te.length&&e.jsx("div",{className:"menu-section",children:r("pill.noModels")})]})})]})]})};export{wt as M,Wt as a,At as c,Pt as g,bt as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./UnifiedPage-
|
|
2
|
-
import{u as k,d as l,j as t,_ as T}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./UnifiedPage-D7JTfABH.js","./index-BYUntVIZ.js","./MarkdownBlock-BHpDy2qQ.js","./appStore-affnJoin.js","./nativeDownload-Udrv_tmU.js","./ipc-D7yENkjV.js","./client-BqhpYbYL.js","./appStore-ClD7vq5L.css","./index-Y2kzYlZq.js","./linkFollow-Msu1XH9v.js","./emoji-BPdA62d7.js","./listFold-CKxjyY5_.js","./book-open-CcXCToyx.js","./MarkdownBlock--__nPQGh.css","./pageChrome-D-9npbUE.js","./upload-D20PZHXc.js","./pageChrome-eO9pb2fH.css","./SketchCard-BcXCdBAs.js","./arrow-up-right-R4P9Mmxz.js","./Chrome-amTcZNE4.js","./minus-CfoZ4oxr.js","./canvasPrefs-CSuX9aLF.js","./hand-DRu7IJdU.js","./type-DmIL6FB-.js","./foldActions-BcyvNVBs.js","./lock-kffGfeHt.js","./undo-2-yMeXc8Wi.js","./code-xml-DdR58F83.js","./message-square-plus-DxBPIhPS.js","./UnifiedPage-CWXc_mo1.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as k,d as l,j as t,_ as T}from"./index-BYUntVIZ.js";import{u as N,N as L,aP as C,_ as I,a5 as M,aE as A,cC as P,il as W,t as F,q as H,gl as O}from"./appStore-affnJoin.js";import"./client-BqhpYbYL.js";import"./nativeDownload-Udrv_tmU.js";import"./ipc-D7yENkjV.js";const D=O(()=>T(()=>import("./UnifiedPage-D7JTfABH.js").then(a=>a.j),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]),import.meta.url).then(a=>({default:a.UnifiedPage}))),U=/\.(md|markdown|txt|json|yaml|yml|toml|csv|log)$/i,J=5e3,V=/!\[([^\]]*)\]\(([^)\s]+)(?:\s+"[^"]*")?\)/g;function R(a){const p=a.filter(i=>!i.dir),s=i=>i.startsWith("Journal/");return p.sort((i,u)=>s(i.path)!==s(u.path)?s(i.path)?-1:1:s(i.path)?u.path.localeCompare(i.path):i.path.localeCompare(u.path))}function B(a){try{const p=atob(a),s=Uint8Array.from(p,i=>i.charCodeAt(0));return new TextDecoder("utf-8").decode(s)}catch{return""}}function X(a){return a.replace(V,(p,s,i)=>`[image${s?`: ${s}`:""} — ${i}]`)}const Z=()=>{const{t:a}=k(),p=N(e=>e.cfg),[s,i]=l.useState(""),[u,E]=l.useState([]),[r,y]=l.useState(""),[b,m]=l.useState(""),[h,x]=l.useState(""),f=l.useRef(""),g=l.useRef(null),j=l.useRef(0),S=l.useMemo(()=>R(u),[u]),w=async(e,n)=>{const c=++j.current;if(!U.test(n.path)){m(""),g.current={path:n.path,mtime:n.mtime};return}const d=window.tangu?.readHostFile;if(!d){m("");return}try{const o=await d(`${e}/${n.path}`);if(c!==j.current)return;m(o.tooLarge?`(${o.size} bytes)`:B(String(o.content||""))),x(""),g.current={path:n.path,mtime:n.mtime}}catch(o){c===j.current&&x(o?.message||String(o))}},$=async()=>{try{const e=await W(F()),n=Array.isArray(e?.files)?e.files:[];i(e?.root||""),E(n),x("");const c=R(n),d=c.find(o=>o.path===f.current);if(d){const o=g.current;(!o||o.path!==d.path||o.mtime!==d.mtime)&&await w(e.root,d)}else c.length?(f.current=c[0].path,y(c[0].path),await w(e.root,c[0])):(f.current="",y(""),m(""),g.current=null)}catch(e){x(e?.message||String(e))}};l.useEffect(()=>{let e=!0,n=null;const c=async()=>{e&&(await $(),e&&(n=setTimeout(()=>{c()},J)))};return c(),()=>{e=!1,n&&clearTimeout(n)}},[p]);const _=e=>{f.current=e.path,y(e.path),w(s,e)},z=()=>{!s||!r||H.getState().openView("wsfile",{path:`${s}/${r}`,name:r.split(/[\\/]/).pop()||r},"main",{newTab:!0})},v=l.useMemo(()=>X(b),[b]);return t.jsxs("div",{style:{display:"flex",height:"100%",minHeight:0,minWidth:0},children:[t.jsxs("div",{style:{width:240,flex:"none",borderRight:"var(--border-width, 1px) solid var(--border)",display:"flex",flexDirection:"column",minHeight:0},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"10px 12px",fontWeight:600,fontSize:"var(--ui-font-body, 13px)"},children:[t.jsx(L,{size:14})," ",a("view.museLibrary"),t.jsx("span",{style:{flex:1}}),t.jsx("button",{className:"icon-btn",title:a("muse.lib.refresh"),onClick:()=>{$()},children:t.jsx(C,{size:13})})]}),t.jsxs("div",{style:{overflowY:"auto",flex:1,padding:"0 6px 8px"},children:[S.length===0&&t.jsx("div",{className:"hint",style:{padding:"4px 6px"},children:h||a("muse.lib.empty")}),S.map(e=>t.jsxs("div",{className:"file-row",onClick:()=>_(e),style:{alignItems:"center",background:e.path===r?"var(--overlay-light, rgba(127,127,127,.1))":void 0,borderRadius:"var(--radius-sm)"},children:[e.path.startsWith("Journal/")?t.jsx(I,{size:13}):t.jsx(M,{size:13}),t.jsx("span",{className:"file-name",style:{flex:1,fontSize:"var(--ui-font-meta, 12px)"},children:e.path})]},e.path))]})]}),t.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",minHeight:0},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 14px",borderBottom:"var(--border-width, 1px) solid var(--border)",fontSize:"var(--ui-font-meta, 12px)",color:"var(--text-muted)"},children:[t.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:r?`${s}/${r}`:"",children:r}),r&&t.jsxs("button",{className:"btn ghost sm",onClick:z,children:[t.jsx(A,{size:12})," ",a("muse.lib.openEditor")]})]}),t.jsxs("div",{style:{overflowY:"auto",flex:1,padding:"14px 24px 40px"},children:[h&&t.jsx("div",{className:"hint",style:{color:"var(--danger)"},children:h}),r&&v&&(/\.md$/i.test(r)?t.jsx("div",{className:"am-app tangu-lovable amx-pane amx-editor","data-muse-lib-preview":"amadeus",children:t.jsx(l.Suspense,{fallback:t.jsx("div",{className:"hint",children:r}),children:t.jsx(D,{path:`${s}/${r}`,initial:v,readOnly:!0},`${s}/${r}`)})}):t.jsx(P,{content:v})),r&&!v&&!h&&t.jsx("div",{className:"hint",children:r})]})]})]})};export{Z as MuseLibraryView,X as neutralizeRemoteImages,R as orderFiles};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{u as ie,d as r,j as s,r as ae}from"./index-
|
|
1
|
+
import{u as ie,d as r,j as s,r as ae}from"./index-BYUntVIZ.js";import{G as k,hV as ne,N as le,a5 as ce,q as re,aP as oe,e0 as H,kq as de,jG as pe,cq as R,bK as q,u as b,ab as me,aK as ue,c8 as he,ip as xe,t as c,kr as ge,io as fe,gU as ve,ks as ye,gT as je,kt as Se,cj as be,iE as ke,im as P,ku as we,hE as Ne,kv as ze,kw as Te,gW as Ce}from"./appStore-affnJoin.js";import"./client-BqhpYbYL.js";import{i as U,d as L}from"./automationListSource-JVBMsMbC.js";import{p as Me}from"./approvalText-Cy2UAUAQ.js";import{C as Ae}from"./circle-x-AV2ZWulM.js";import{M as Ie}from"./message-square-plus-DxBPIhPS.js";const $e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]],_e=k("crosshair",$e);const Fe=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],We=k("repeat",Fe);const De=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]],Ee=k("shield-x",De);ae({"special.muse.sleeping":{zh:"休眠至 {time}",en:"Sleeping until {time}"},"special.muse.sleepingTitle":{zh:"Muse 判断暂时没事可做,跳过心跳到这个时刻;你一有动作、规则命中或日程到期都会提前叫醒它。理由:{reason}",en:"Muse found nothing to do and skips its heartbeat until then; your activity, a rule or a due schedule wakes it earlier. Reason: {reason}"}});const He=m=>{const f=new Date(m);return`${String(f.getHours()).padStart(2,"0")}:${String(f.getMinutes()).padStart(2,"0")}`},x=m=>Array.isArray(m)?m:[],Re=({cfg:m,sessions:f,onInjected:w})=>{const{t}=ie(),[l,V]=r.useState(null),[u,N]=r.useState([]),[O,z]=r.useState([]),[v,T]=r.useState([]),[B,C]=r.useState([]),[G,S]=r.useState(""),[p,h]=r.useState(new Set),[g,K]=r.useState(""),[M,o]=r.useState(""),[A,I]=r.useState("");ne(e=>e.refreshNonce);const $=O.filter(e=>!e.actions?.length&&(!e.agentSlug||e.agentSlug==="muse")&&!U({kind:"trigger",triggerId:e.id})),_=B.filter(e=>!U({kind:"schedule",slug:"muse",rowId:e.id})),F=async()=>{const e=await xe(c()).catch(()=>null);V(e),ge(m,"muse",e?.spaceStamp);const n=x(await fe(c(),"pending").catch(()=>[]));if(N(n),h(i=>new Set([...i].filter(a=>n.some(d=>d.id===a)))),z(x(await ve(c()).catch(()=>[]))),T(x(await ye(c(),"pending").catch(()=>[]))),C(await je(c()).then(i=>x(x(i).find(a=>a.slug==="muse")?.entries).filter(a=>a.auto)).catch(()=>[])),e?.sessionId){const a=[...x(await Se(be(e.sessionId),e.sessionId,6).catch(()=>[]))].reverse().find(d=>d.role==="assistant"||d.role==="model");a?.content?S(String(a.content).slice(0,4e3)):e.running||S("")}else S("")};r.useEffect(()=>{let e=!0,n=null;const i=async()=>{e&&(await F(),e&&(n=setTimeout(()=>{i()},4e3)))};return i(),()=>{e=!1,n&&clearTimeout(n)}},[m]);const X=e=>h(n=>{const i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i}),Y=async()=>{if(!(!g||!p.size))try{await we(c(),[...p],g),o(t("special.muse.injected",{n:p.size})),h(new Set),w(g)}catch(e){o(t("special.muse.injectFail",{e:e?.message||e}))}},J=async()=>{if(!p.size)return;const e=u.filter(i=>p.has(i.id));if(!e.length)return;const n=`${t("special.muse.injectPrefix")}
|
|
2
2
|
|
|
3
3
|
`+e.map((i,a)=>`${a+1}. ${i.title}${i.detail?`
|
|
4
4
|
${i.detail}`:""}`).join(`
|
|
5
5
|
|
|
6
|
-
`);try{if(Ne(),!await b.getState().send(n,[],void 0,void 0,void 0,null))return;for(const d of e)await P(c(),d.id,"injected").catch(()=>{});ze(c(),`todos run in a new session by user: ${e.map(d=>`"${d.title}"`).join("; ")}`).catch(()=>{}),o(t("special.muse.injected",{n:e.length})),h(new Set);const a=b.getState().activeId;a&&w(a)}catch(i){o(t("special.muse.injectFail",{e:i?.message||i}))}},Q=e=>o(t("special.muse.actionFail",{e:e?.message||e})),W=async(e,n)=>{try{await P(c(),e,n),N(i=>i.filter(a=>a.id!==e)),h(i=>{const a=new Set(i);return a.delete(e),a})}catch(i){Q(i)}},Z=(e,n)=>L({kind:"trigger",triggerId:e},n,()=>Te(c(),e),()=>{z(i=>i.filter(a=>a.id!==e)),o("")}),ee=(e,n)=>L({kind:"schedule",slug:"muse",rowId:e},n,()=>Ce(c(),"muse",e),()=>{C(i=>i.filter(a=>a.id!==e)),o("")}),D=async(e,n)=>{I(e.id);try{const i=await ke(c(),e.id,n);i.status==="failed"?o(t("special.muse.execFailed",{e:String(i.result||"").slice(0,200)})):o(""),T(a=>a.filter(d=>d.id!==e.id))}catch(i){o(t("special.muse.approveFail",{e:i?.message||i}))}finally{I("")}},se=e=>e.cond.type==="file_chars_gte"?t("special.muse.trigFile",{path:e.cond.path.split(/[\\/]/).pop()||e.cond.path,n:e.cond.n}):e.cond.type==="event_seen"?t("special.muse.trigEvent",{match:e.cond.match}):e.cond.type==="daily_at"?t("special.muse.trigDaily",{time:e.cond.time}):e.cond.type==="at"?e.cond.datetime.replace("T"," "):e.cond.type==="every"?`every ${e.cond.interval}`:"—",te=e=>t(e==="auto"?"settings.special.m.modeAuto":e==="agent"?"settings.special.m.modeAgent":"settings.special.m.modeAsk"),y=!!l?.running,j=!y&&l?.sleepUntil&&l.sleepUntil>Date.now()?l.sleepUntil:0,E=v.length||l?.pendingApprovals||0;return s.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10,fontWeight:600,flexWrap:"wrap"},children:[s.jsx(le,{size:16})," ",t("special.muse.title"),s.jsx("span",{style:{flex:1}}),l?.enabled&&l.mode&&s.jsx("span",{className:"conn-pill",style:{fontSize:"var(--ui-font-meta, 12px)",fontWeight:400},title:t("special.muse.modeLabel"),children:te(l.mode).split(/[((]/)[0]}),E>0&&s.jsx("span",{className:"conn-pill",style:{fontSize:"var(--ui-font-meta, 12px)",fontWeight:400,color:"var(--accent-ink)"},children:t("special.muse.pending",{n:E})}),s.jsxs("span",{className:"conn-pill","data-state":l?.enabled?y?"running":j?"sleeping":"idle":"disabled",style:{fontSize:"var(--ui-font-meta, 12px)"},title:l?.enabled&&j?t("special.muse.sleepingTitle",{reason:l.sleepReason||"—"}):void 0,children:[s.jsx("span",{className:"dot",style:{background:y?"var(--accent-ink)":"var(--text-muted)"}}),l?.enabled?y?t("special.muse.running"):j?t("special.muse.sleeping",{time:
|
|
6
|
+
`);try{if(Ne(),!await b.getState().send(n,[],void 0,void 0,void 0,null))return;for(const d of e)await P(c(),d.id,"injected").catch(()=>{});ze(c(),`todos run in a new session by user: ${e.map(d=>`"${d.title}"`).join("; ")}`).catch(()=>{}),o(t("special.muse.injected",{n:e.length})),h(new Set);const a=b.getState().activeId;a&&w(a)}catch(i){o(t("special.muse.injectFail",{e:i?.message||i}))}},Q=e=>o(t("special.muse.actionFail",{e:e?.message||e})),W=async(e,n)=>{try{await P(c(),e,n),N(i=>i.filter(a=>a.id!==e)),h(i=>{const a=new Set(i);return a.delete(e),a})}catch(i){Q(i)}},Z=(e,n)=>L({kind:"trigger",triggerId:e},n,()=>Te(c(),e),()=>{z(i=>i.filter(a=>a.id!==e)),o("")}),ee=(e,n)=>L({kind:"schedule",slug:"muse",rowId:e},n,()=>Ce(c(),"muse",e),()=>{C(i=>i.filter(a=>a.id!==e)),o("")}),D=async(e,n)=>{I(e.id);try{const i=await ke(c(),e.id,n);i.status==="failed"?o(t("special.muse.execFailed",{e:String(i.result||"").slice(0,200)})):o(""),T(a=>a.filter(d=>d.id!==e.id))}catch(i){o(t("special.muse.approveFail",{e:i?.message||i}))}finally{I("")}},se=e=>e.cond.type==="file_chars_gte"?t("special.muse.trigFile",{path:e.cond.path.split(/[\\/]/).pop()||e.cond.path,n:e.cond.n}):e.cond.type==="event_seen"?t("special.muse.trigEvent",{match:e.cond.match}):e.cond.type==="daily_at"?t("special.muse.trigDaily",{time:e.cond.time}):e.cond.type==="at"?e.cond.datetime.replace("T"," "):e.cond.type==="every"?`every ${e.cond.interval}`:"—",te=e=>t(e==="auto"?"settings.special.m.modeAuto":e==="agent"?"settings.special.m.modeAgent":"settings.special.m.modeAsk"),y=!!l?.running,j=!y&&l?.sleepUntil&&l.sleepUntil>Date.now()?l.sleepUntil:0,E=v.length||l?.pendingApprovals||0;return s.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10,fontWeight:600,flexWrap:"wrap"},children:[s.jsx(le,{size:16})," ",t("special.muse.title"),s.jsx("span",{style:{flex:1}}),l?.enabled&&l.mode&&s.jsx("span",{className:"conn-pill",style:{fontSize:"var(--ui-font-meta, 12px)",fontWeight:400},title:t("special.muse.modeLabel"),children:te(l.mode).split(/[((]/)[0]}),E>0&&s.jsx("span",{className:"conn-pill",style:{fontSize:"var(--ui-font-meta, 12px)",fontWeight:400,color:"var(--accent-ink)"},children:t("special.muse.pending",{n:E})}),s.jsxs("span",{className:"conn-pill","data-state":l?.enabled?y?"running":j?"sleeping":"idle":"disabled",style:{fontSize:"var(--ui-font-meta, 12px)"},title:l?.enabled&&j?t("special.muse.sleepingTitle",{reason:l.sleepReason||"—"}):void 0,children:[s.jsx("span",{className:"dot",style:{background:y?"var(--accent-ink)":"var(--text-muted)"}}),l?.enabled?y?t("special.muse.running"):j?t("special.muse.sleeping",{time:He(j)}):t("special.muse.idle"):t("special.muse.disabled")]}),s.jsx("button",{className:"icon-btn",title:t("muse.openLibrary"),onClick:()=>re.getState().openView("muse-files",{},"main",{newTab:!0}),children:s.jsx(ce,{size:13})}),s.jsx("button",{className:"icon-btn",onClick:()=>{F()},children:s.jsx(oe,{size:13})})]}),(v.length>0||!!l?.pendingApprovals)&&s.jsxs("div",{className:"field",children:[s.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6},children:[s.jsx(H,{size:13})," ",t("special.muse.approvals")]}),v.length===0&&s.jsx("div",{className:"hint",children:t("special.muse.approvalsEmpty")}),v.map(e=>s.jsxs("div",{className:"file-row",style:{cursor:"default",alignItems:"flex-start"},children:[s.jsxs("span",{className:"file-name",style:{flex:1,whiteSpace:"normal"},children:[s.jsx("b",{style:{display:"block",fontFamily:"var(--font-mono, monospace)",fontSize:"var(--ui-font-meta, 12px)",whiteSpace:"pre-wrap",overflowWrap:"anywhere",maxHeight:240,overflow:"auto"},children:e.preview}),Me(e.preview)&&s.jsx("div",{className:"hint",children:t("approval.previewScrollHint")}),s.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"var(--ui-font-meta, 12px)",marginTop:2},children:[e.tool,e.cwd?` · ${e.cwd}`:""," · ",String(e.created_at).replace("T"," ").slice(5,16),e.note&&s.jsx("div",{children:t("special.muse.approvalNote",{note:e.note})})]})]}),s.jsxs("button",{className:"btn primary sm",disabled:A===e.id,title:t("special.muse.approve"),onClick:()=>{D(e,"approve")},children:[s.jsx(H,{size:12})," ",t("special.muse.approve")]}),s.jsx("button",{className:"icon-btn",disabled:A===e.id,title:t("special.muse.reject"),onClick:()=>{D(e,"reject")},children:s.jsx(Ee,{size:13})})]},e.id))]}),l?.enabled&&s.jsxs("div",{className:"field",children:[s.jsx("label",{children:t("special.muse.thinking")}),s.jsx("div",{style:{fontSize:"var(--ui-font-body, 13px)",lineHeight:1.6,whiteSpace:"pre-wrap",maxHeight:220,overflowY:"auto",background:"var(--bg-card)",border:"var(--border-width) solid var(--border)",borderRadius:"var(--radius-sm)",padding:10},children:G||s.jsx("span",{className:"hint",children:l?.enabled?"…":t("special.muse.disabled")})})]}),s.jsxs("div",{className:"field",children:[s.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6},children:[s.jsx(We,{size:13})," ",t("special.muse.tracks")]}),_.length===0&&s.jsx("div",{className:"hint",children:t("special.muse.tracksEmpty")}),_.map(e=>s.jsxs("div",{className:"file-row",style:{cursor:"default",alignItems:"flex-start"},children:[s.jsxs("span",{className:"file-name",style:{flex:1,whiteSpace:"normal"},children:[s.jsx("b",{children:e.name}),s.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"var(--ui-font-meta, 12px)",marginTop:2},children:[de(pe(e.date))||e.date,e.repeat?` · ${t("automation.schedule.every",{ivl:e.repeat})}`:"",e.lastRun?` · ${t("special.muse.trigFired",{t:R(e.lastRun)})}`:"",e.description&&s.jsx("div",{children:e.description})]})]}),s.jsx("button",{className:"icon-btn",title:t("special.muse.trackDelete"),onClick:()=>ee(e.id,e.name),children:s.jsx(q,{size:13})})]},e.id))]}),s.jsxs("div",{className:"field",children:[s.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6},children:[s.jsx(_e,{size:13})," ",t("special.muse.watches"),s.jsx("span",{style:{flex:1}}),s.jsx("a",{style:{cursor:"pointer",fontSize:"var(--ui-font-caption, 11px)",fontWeight:400,color:"var(--accent-ink, var(--accent))"},onClick:()=>{b.getState().closeSettings(),me("automation")},children:t("special.muse.watchesAll")})]}),$.length===0&&s.jsx("div",{className:"hint",children:t("special.muse.watchesHint")}),$.map(e=>s.jsxs("div",{className:"file-row",style:{cursor:"default",alignItems:"flex-start"},children:[s.jsxs("span",{className:"file-name",style:{flex:1,whiteSpace:"normal"},children:[s.jsx("b",{children:e.desc}),s.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"var(--ui-font-meta, 12px)",marginTop:2},children:[se(e),e.lastFiredAt?` · ${t("special.muse.trigFired",{t:R(e.lastFiredAt)})}`:""]})]}),s.jsx("button",{className:"icon-btn",title:t("special.muse.watchDelete"),onClick:()=>Z(e.id,e.desc),children:s.jsx(q,{size:13})})]},e.id))]}),s.jsxs("div",{className:"field",children:[s.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8},children:[t("special.muse.todos"),s.jsx("span",{style:{flex:1}}),u.length>0&&s.jsx("button",{className:"btn ghost sm",onClick:()=>h(p.size===u.length?new Set:new Set(u.map(e=>e.id))),children:t("special.muse.selectAll")})]}),u.length===0&&s.jsx("div",{className:"hint",children:t("special.muse.todosEmpty")}),u.map(e=>s.jsxs("div",{className:"file-row",style:{cursor:"default",alignItems:"flex-start"},children:[s.jsx("input",{type:"checkbox",checked:p.has(e.id),onChange:()=>X(e.id),style:{marginTop:3}}),s.jsxs("span",{className:"file-name",style:{flex:1,whiteSpace:"normal"},children:[s.jsx("b",{children:e.title}),e.detail&&s.jsx("div",{style:{color:"var(--text-muted)",fontSize:"var(--ui-font-meta, 12px)",marginTop:2},children:e.detail})]}),s.jsx("button",{className:"icon-btn",title:t("special.muse.markDone"),onClick:()=>{W(e.id,"done")},children:s.jsx(ue,{size:13})}),s.jsx("button",{className:"icon-btn",title:t("special.muse.dismiss"),onClick:()=>{W(e.id,"dismissed")},children:s.jsx(Ae,{size:13})})]},e.id))]}),u.length>0&&s.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[s.jsxs("select",{value:g,onChange:e=>K(e.target.value),style:{maxWidth:240},children:[s.jsx("option",{value:"",children:t("special.muse.pickSession")}),f.map(e=>s.jsx("option",{value:e.id,children:e.title||e.id.slice(0,8)},e.id))]}),s.jsxs("button",{className:"btn primary sm",disabled:!g||!p.size,onClick:()=>{Y()},children:[s.jsx(he,{size:12})," ",t("special.muse.inject")]}),s.jsxs("button",{className:"btn ghost sm",disabled:!p.size,onClick:()=>{J()},children:[s.jsx(Ie,{size:12})," ",t("special.muse.runNew")]}),M&&s.jsx("span",{style:{fontSize:"var(--ui-font-meta, 12px)",color:"var(--text-muted)"},children:M})]})]})},Ge=Object.freeze(Object.defineProperty({__proto__:null,MuseView:Re},Symbol.toStringTag,{value:"Module"}));export{Re as M,Ee as S,Ge as a};
|