@panphora/clayjs 1.25.0 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all.js +1 -1
- package/dist/clay-dom.js +1 -1
- package/dist/clay-events.js +1 -1
- package/dist/clay-internals.js +1 -1
- package/dist/clay-options.js +1 -1
- package/dist/clay-router.js +1 -1
- package/dist/clay-ui.js +1 -1
- package/dist/clay-utils.js +1 -1
- package/dist/clay.js +1 -1
- package/dist/clay.standalone.js +5570 -4173
- package/dist/m/attrs/{save-freeze-MH3AOD56.js → save-freeze-PUYX32AK.js} +1 -1
- package/dist/m/{c-BOMQIQ3V.js → c-2EFMJYGJ.js} +1 -1
- package/dist/m/c-2EPHRF47.js +1 -0
- package/dist/m/{c-JD2VFAYG.js → c-2SUFMUZX.js} +2 -2
- package/dist/m/{c-CITLTVQ4.js → c-2TJCFPX4.js} +1 -1
- package/dist/m/c-33SS5A4Y.js +1 -0
- package/dist/m/{c-V2FPBRO6.js → c-34J5HC7N.js} +1 -1
- package/dist/m/c-3F3AADKG.js +1 -0
- package/dist/m/{c-TCFVG3I4.js → c-3S3647J6.js} +1 -1
- package/dist/m/{c-GY4BREDT.js → c-3S5TNRZA.js} +1 -1
- package/dist/m/{c-GDNZEOOZ.js → c-3WX5FABT.js} +1 -1
- package/dist/m/{c-AI3H6ETU.js → c-3XGLJAS7.js} +2 -2
- package/dist/m/c-42WBOKFM.js +1 -0
- package/dist/m/c-47M4QHCK.js +1 -0
- package/dist/m/{c-UOUUI265.js → c-4M2T676V.js} +1 -1
- package/dist/m/{c-GEAG5XAK.js → c-4TP3UXBT.js} +1 -1
- package/dist/m/{c-IESDKFO6.js → c-5ELELG2F.js} +1 -1
- package/dist/m/{c-X3V4RWMA.js → c-5ZYLTN3Q.js} +1 -1
- package/dist/m/{c-5PZYDWTW.js → c-67TBU56I.js} +1 -1
- package/dist/m/{c-WNOLMHI2.js → c-6BGJAJ67.js} +1 -1
- package/dist/m/{c-4Q6QIODW.js → c-755ZOHOM.js} +1 -1
- package/dist/m/c-7Q4XYDF4.js +1 -0
- package/dist/m/c-7RHOMAMR.js +1 -0
- package/dist/m/c-A5LASUEZ.js +1 -0
- package/dist/m/{c-IL5IVTOG.js → c-ABOBD7F3.js} +1 -1
- package/dist/m/c-AQVQKFKB.js +1 -0
- package/dist/m/{c-QDVG4NAZ.js → c-ARO6CPMA.js} +1 -1
- package/dist/m/{c-ORLPQFNU.js → c-AZM34SPO.js} +1 -1
- package/dist/m/{c-XUZMRQ7O.js → c-BCS3AZQZ.js} +1 -1
- package/dist/m/c-BOS7GONO.js +1 -0
- package/dist/m/{c-SUAC5RSG.js → c-C5UGNOC2.js} +1 -1
- package/dist/m/c-C6DXZIXD.js +1 -0
- package/dist/m/{c-WSTUCBHV.js → c-CPRGR2II.js} +1 -1
- package/dist/m/{c-NICICT4P.js → c-DEYHCYJB.js} +1 -1
- package/dist/m/{c-WGQVSKKC.js → c-DYTBSJBI.js} +1 -1
- package/dist/m/{c-DT7E76Z2.js → c-DZT6W2NG.js} +1 -1
- package/dist/m/{c-O2QZDVZ2.js → c-EEWPNUM2.js} +1 -1
- package/dist/m/{c-MFB74XVN.js → c-EHAR4RJJ.js} +2 -2
- package/dist/m/c-EHJWIGWN.js +1 -0
- package/dist/m/c-EIDZHQHZ.js +1 -0
- package/dist/m/{c-V2V5FKXX.js → c-EIUKME3W.js} +1 -1
- package/dist/m/c-ELXMSEN5.js +1 -0
- package/dist/m/c-EXZOA6XY.js +7 -0
- package/dist/m/{c-FKTALXNV.js → c-EYFMAR3M.js} +1 -1
- package/dist/m/c-FC5RUFPR.js +1 -0
- package/dist/m/{c-FBOO2UY3.js → c-FUN6AKFE.js} +1 -1
- package/dist/m/{c-V4B3RUWB.js → c-GFASNR55.js} +1 -1
- package/dist/m/{c-XMIDHEKF.js → c-GY36NO7C.js} +1 -1
- package/dist/m/{c-UD4VDBGJ.js → c-H3M6UDNV.js} +1 -1
- package/dist/m/{c-SFZRY6RT.js → c-H47C6PJZ.js} +1 -1
- package/dist/m/{c-MUM53J5J.js → c-H4M2T4A6.js} +1 -1
- package/dist/m/{c-U7F66I64.js → c-HYNM5U6B.js} +1 -1
- package/dist/m/c-J2YYLEVM.js +1 -0
- package/dist/m/c-J2ZW4HMR.js +1 -0
- package/dist/m/{c-WCG6AKA7.js → c-JC4RZW4E.js} +1 -1
- package/dist/m/c-K2ZHQMPF.js +1 -0
- package/dist/m/c-KD2ME5UN.js +2 -0
- package/dist/m/{c-Z2OZFX3N.js → c-L6KVXPBO.js} +1 -1
- package/dist/m/{c-GO635CRU.js → c-LAKBBJOU.js} +2 -2
- package/dist/m/{c-4AE2A2LK.js → c-LETPPG2F.js} +1 -1
- package/dist/m/{c-SFYTKRU7.js → c-MKAUC6DB.js} +1 -1
- package/dist/m/{c-WDFQ7PBU.js → c-MMEVDN6D.js} +1 -1
- package/dist/m/{c-LS7IVQVW.js → c-MMV5JULA.js} +1 -1
- package/dist/m/{c-NEQRFC4O.js → c-MVVEIJUU.js} +1 -1
- package/dist/m/{c-SXZYVXD6.js → c-N362HNGO.js} +1 -1
- package/dist/m/{c-7K4SCQB7.js → c-ND3W7D5U.js} +1 -1
- package/dist/m/{c-3E2IK5HU.js → c-NNHNXD6M.js} +1 -1
- package/dist/m/{c-D62HRSZK.js → c-NYJ577NL.js} +1 -1
- package/dist/m/{c-YFO6ZJLQ.js → c-O3DPFZCE.js} +1 -1
- package/dist/m/c-OZOACVUD.js +1 -0
- package/dist/m/{c-MV7TEUTD.js → c-OZVK3TFI.js} +1 -1
- package/dist/m/{c-ZEA3DCG3.js → c-PWILUN4T.js} +1 -1
- package/dist/m/{c-BCWYEG6P.js → c-QA3Q3MDI.js} +1 -1
- package/dist/m/{c-XHZIKRCV.js → c-QKOKMQXA.js} +1 -1
- package/dist/m/{c-TGIMBAWE.js → c-RBWVF4N5.js} +1 -1
- package/dist/m/c-RES2S5Q3.js +1 -0
- package/dist/m/c-RFGELYEU.js +2 -0
- package/dist/m/c-RGFPLQGV.js +1 -0
- package/dist/m/{c-RGAALCDU.js → c-SPOEDIMP.js} +1 -1
- package/dist/m/{c-YX2MC7YL.js → c-SRW5OBCF.js} +1 -1
- package/dist/m/{c-C6YZNU6E.js → c-SYOA4T7V.js} +1 -1
- package/dist/m/c-SYVF6ZMF.js +1 -0
- package/dist/m/{c-NADLYVAH.js → c-TJ5PFOJ2.js} +1 -1
- package/dist/m/{c-KYTVZT4D.js → c-TKV273YU.js} +1 -1
- package/dist/m/c-U35T5NAY.js +1 -0
- package/dist/m/{c-PRZNJUYZ.js → c-UEKJWXCB.js} +2 -2
- package/dist/m/c-UW6MMZ4V.js +1 -0
- package/dist/m/{c-XQTERKQA.js → c-V4DBV5ZV.js} +1 -1
- package/dist/m/c-VGG3UR7I.js +1 -0
- package/dist/m/c-VU4WEWPH.js +4 -0
- package/dist/m/{c-5Q5XBN56.js → c-W7LWCJHD.js} +1 -1
- package/dist/m/c-WHMZCRQD.js +6 -0
- package/dist/m/{c-WMRJKQ2V.js → c-WHQUZM2V.js} +1 -1
- package/dist/m/c-WOJ2RTV4.js +1 -0
- package/dist/m/{c-ZJG6C2WL.js → c-WOWGGNCJ.js} +1 -1
- package/dist/m/{c-ZORVIXUR.js → c-XHD7XJTE.js} +1 -1
- package/dist/m/c-XONFK3WC.js +1 -0
- package/dist/m/{c-HGG7M2S3.js → c-Y3J5LDKB.js} +1 -1
- package/dist/m/{c-JB5YU57S.js → c-Y3MPVURA.js} +1 -1
- package/dist/m/c-Y6HH7LTM.js +1 -0
- package/dist/m/{c-52OC3OH3.js → c-YRDKVEGR.js} +1 -1
- package/dist/m/c-YYIN4NAF.js +30 -0
- package/dist/m/{c-WVCT3ITX.js → c-YZGWSCMT.js} +1 -1
- package/dist/m/c-ZFAPQQIB.js +1 -0
- package/dist/m/core/{admin-attrs-ZI6K6UGM.js → admin-attrs-43JBA6JB.js} +1 -1
- package/dist/m/core/{autosave-BSM2ABJL.js → autosave-HD7Y7UNV.js} +1 -1
- package/dist/m/core/{conflict-notice-7EQLDYPA.js → conflict-notice-UNDOD4BL.js} +1 -1
- package/dist/m/core/{persist-2SZO3PCE.js → persist-MX3VYVBN.js} +1 -1
- package/dist/m/core/{save-K6Q47J2X.js → save-JZ7R4ET2.js} +1 -1
- package/dist/m/core/{save-core-U3Z44XBO.js → save-core-I4N6S4ED.js} +1 -1
- package/dist/m/core/site-edits-C22O53GS.js +1 -0
- package/dist/m/core/{snapshot-PWCHYFL6.js → snapshot-N5MKDGNI.js} +1 -1
- package/dist/m/core/{unsaved-warning-2WRZLJH5.js → unsaved-warning-BP6ZY3PG.js} +1 -1
- package/dist/m/internals/{index-FSLC4M7J.js → index-3LAVREAU.js} +1 -1
- package/dist/m/loader-DCKCZKY6.js +1 -0
- package/dist/m/manifest-7954CBE3.js +1 -0
- package/dist/m/manifest-edit-93AA79D7.js +1 -0
- package/dist/m/manifest.json +1240 -1179
- package/dist/m/page/{editor-PKSPJ2XJ.js → editor-UF3CIA6V.js} +5 -5
- package/dist/m/plugins/{ai-edit-3LG6MGS3.js → ai-edit-WDV2GLDU.js} +2 -2
- package/dist/m/plugins/{cms-T2HLI7JG.js → cms-KG6TCTR3.js} +9 -9
- package/dist/m/plugins/{derive-7DR5TUDH.js → derive-R4USHZ7P.js} +1 -1
- package/dist/m/plugins/{indicator-CTKX4EY7.js → indicator-OLPZ4WFI.js} +1 -1
- package/dist/m/plugins/{live-IFLL6YN5.js → live-DF5YS5AH.js} +1 -1
- package/dist/m/plugins/{menu-YJZ3JWBC.js → menu-ESEFQARM.js} +1 -1
- package/dist/m/plugins/page-GZSU77JS.js +2 -0
- package/dist/m/plugins/{page-view-NMCCU6MF.js → page-view-7MM3FEAR.js} +1 -1
- package/dist/m/plugins/{people-6WIWCZEG.js → people-EBWE337I.js} +1 -1
- package/dist/m/plugins/quickcrop-UHURKA2F.js +26 -0
- package/dist/m/plugins/richclay-MXH2GFAZ.js +549 -0
- package/dist/m/plugins/sortable-BAG3MSWS.js +1 -0
- package/dist/m/plugins/{source-7LSGOV46.js → source-OYHDXKTB.js} +1 -1
- package/dist/m/plugins/undo-KLHAGV75.js +1 -0
- package/dist/m/plugins/{upgrade-MMPZUCDM.js → upgrade-SZQJYEQQ.js} +1 -1
- package/dist/m/plugins/{visitor-drafts-V5YB7XDH.js → visitor-drafts-ZE6PCAFP.js} +2 -2
- package/dist/m/plugins/{visitor-menu-QDV2MYJN.js → visitor-menu-5XY57JQA.js} +1 -1
- package/dist/m/plugins/{wire-3YGUO3GE.js → wire-S5ATC4QI.js} +1 -1
- package/dist/m/reader-core-AHOAP5DH.js +77 -0
- package/dist/m/sync/{live-sync-XMXXZS3G.js → live-sync-RZQSDMZW.js} +1 -1
- package/dist/m/ui/index-G7ZJXNMG.js +1 -0
- package/dist/m/vendor/{sap-core.vendor-JANUQULT.js → sap-core.vendor-5TWOJYVM.js} +4 -4
- package/dist/offline-manifest.json +780 -750
- package/dist/server/core.cjs +4245 -2614
- package/dist/server/markdown.cjs +1 -0
- package/dist/server/markdown.mjs +7 -0
- package/docs/guide.md +26 -37
- package/entries/clay-data.js +1 -1
- package/entries/sap.js +5 -5
- package/package.json +6 -2
- package/packed-contract.json +3 -0
- package/src/attrs/save-freeze.js +1 -1
- package/src/core/admin-contenteditable.js +1 -1
- package/src/core/admin-inputs.js +1 -1
- package/src/core/admin-onclick.js +1 -1
- package/src/core/admin-resources.js +5 -2
- package/src/core/conflict-notice-ui.js +59 -34
- package/src/core/save.js +9 -9
- package/src/core/site-edits.js +1 -1
- package/src/core/snapshot.js +56 -43
- package/src/core/stale-host-notice.js +20 -7
- package/src/loader-logic.js +0 -13
- package/src/page/boot-pack.js +1 -0
- package/src/page/editor.js +10 -4
- package/src/page/history-intent.js +111 -4
- package/src/page/import-markdown.js +22 -8
- package/src/page/save-projection.js +1 -1
- package/src/page/ybind/bridge.js +14 -7
- package/src/page/ybind/moves.js +437 -3
- package/src/page/ybind/origins.js +1 -1
- package/src/page/ybind/recovery.js +1 -1
- package/src/plugins/page.js +48 -4
- package/src/plugins/quickcrop.js +128 -69
- package/src/plugins/richclay.js +136 -0
- package/src/plugins/sortable.js +25 -9
- package/src/plugins/undo.js +169 -7
- package/src/recovery/undo.js +14 -7
- package/src/server/markdown/index.js +23 -0
- package/src/sync/conflicts.js +3 -1
- package/src/sync/data-guard-notice.js +137 -18
- package/src/sync/live-sync.js +24 -0
- package/src/ui/bevel-controls.js +4 -1
- package/src/ui/dialogs.js +11 -7
- package/src/ui/modal.js +9 -7
- package/src/ui/toast.js +67 -32
- package/src/ui/vendor-skin.js +9 -4
- package/src/vendor/hyper-html-api-data.vendor.js +1 -1
- package/src/vendor/hyper-html-api-upgrade.vendor.js +2 -2
- package/src/vendor/hyper-undo.vendor.js +1 -1
- package/src/vendor/hypercms.vendor.js +7 -7
- package/src/vendor/richclay.vendor.js +16 -16
- package/src/vendor/sap-core.vendor.js +4 -4
- package/tool-generation/context.md +69 -0
- package/tool-generation/system.md +1 -1
- package/dist/m/c-277QP5ET.js +0 -1
- package/dist/m/c-5SZ6KFR5.js +0 -1
- package/dist/m/c-CU33V6RW.js +0 -4
- package/dist/m/c-CVSWLX3X.js +0 -1
- package/dist/m/c-DXPOFLEJ.js +0 -1
- package/dist/m/c-EODTTNVA.js +0 -1
- package/dist/m/c-ESK4S67I.js +0 -1
- package/dist/m/c-FDWR3FL7.js +0 -1
- package/dist/m/c-FJDTDGDA.js +0 -1
- package/dist/m/c-FYDKYW6E.js +0 -1
- package/dist/m/c-HKSLOVU4.js +0 -1
- package/dist/m/c-IJHF4IO6.js +0 -1
- package/dist/m/c-IUL7PU4P.js +0 -1
- package/dist/m/c-JWW6BHWD.js +0 -6
- package/dist/m/c-K4M76VPM.js +0 -7
- package/dist/m/c-M7ITYKMF.js +0 -1
- package/dist/m/c-MR75YPRT.js +0 -1
- package/dist/m/c-NFQFV7OP.js +0 -2
- package/dist/m/c-NHXOBD6A.js +0 -1
- package/dist/m/c-NVU3DORS.js +0 -1
- package/dist/m/c-PNZIJFG7.js +0 -1
- package/dist/m/c-QWB53KRW.js +0 -1
- package/dist/m/c-RHPHMTF2.js +0 -2
- package/dist/m/c-RWJ3OSCP.js +0 -1
- package/dist/m/c-SEVOS4UE.js +0 -1
- package/dist/m/c-SGG6MUXW.js +0 -1
- package/dist/m/c-SXNSSHPP.js +0 -1
- package/dist/m/c-TFLRT5JX.js +0 -1
- package/dist/m/c-TLQINES7.js +0 -30
- package/dist/m/c-U65PREMC.js +0 -1
- package/dist/m/c-V5L6HWVL.js +0 -1
- package/dist/m/c-VMXCX52Q.js +0 -1
- package/dist/m/c-YYGUHSZR.js +0 -1
- package/dist/m/core/site-edits-CFMF6GHD.js +0 -1
- package/dist/m/loader-RC54UV7H.js +0 -1
- package/dist/m/manifest-3B84C829.js +0 -1
- package/dist/m/manifest-edit-1CB79AD4.js +0 -1
- package/dist/m/plugins/page-GTDPYGE4.js +0 -2
- package/dist/m/plugins/quickcrop-X5MRIBAP.js +0 -26
- package/dist/m/plugins/richclay-L3BZMX4I.js +0 -549
- package/dist/m/plugins/sortable-365SRRL3.js +0 -1
- package/dist/m/plugins/undo-UES4KS7B.js +0 -1
- package/dist/m/reader-core-VR7EL4WV.js +0 -77
- package/dist/m/ui/index-MGTWOW2C.js +0 -1
- /package/dist/m/{c-QTTJYJMA.js → c-FILLTJA7.js} +0 -0
- /package/dist/m/plugins/{quickcrop-X5MRIBAP.js.LEGAL.txt → quickcrop-UHURKA2F.js.LEGAL.txt} +0 -0
- /package/dist/m/plugins/{richclay-L3BZMX4I.js.LEGAL.txt → richclay-MXH2GFAZ.js.LEGAL.txt} +0 -0
package/dist/m/c-EODTTNVA.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"./c-ESK4S67I.js";import"./c-MR75YPRT.js";import"./c-4JZDZFF6.js";import"./c-5RZNFTWD.js";import"./c-PKCCHJ5X.js";import"./c-NUHP2XDB.js";import"./c-VHNSBD2M.js";export{c as bevelDialog,a as dismissOf,b as keepFocusIn};
|
package/dist/m/c-ESK4S67I.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as L,b as T,c as w,d as A,f as C,j as v,k as M,l as P,n as S}from"./c-MR75YPRT.js";import{b as N,e as b,f as O,g as f}from"./c-5RZNFTWD.js";import{a as D}from"./c-PKCCHJ5X.js";import{a as I,b as c}from"./c-NUHP2XDB.js";var q=new WeakMap,W='a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [contenteditable], [tabindex]:not([tabindex^="-"])';function G(u,a){let t=[...u.querySelectorAll(W)].filter(i=>i.offsetParent!==null);if(!t.length)return;let s=t.indexOf(document.activeElement);s===-1?(t[0].focus(),a.preventDefault()):a.shiftKey&&s===0?(t[t.length-1].focus(),a.preventDefault()):!a.shiftKey&&s===t.length-1&&(t[0].focus(),a.preventDefault())}var B=`1px solid ${b["line-2"]}`;function K(u,a,t=null,s=[],i=[]){let x=f.dialogCloseHover[0].slice(11),g=["position:absolute","top:-1px","right:-1px","z-index:2","display:grid","place-items:center",a?"height:calc(100% + 1px)":"height:62px","margin:0","padding:0","border:0",...f.dialogClose,...a?[]:[`border-bottom:${B}`],"cursor:pointer","outline:none"],e=v("button",g);if(e.type="button",e.setAttribute("aria-label",u),e.title=u,e.innerHTML=O.dialogClose,!L(t))return C(e.firstElementChild,16),e.addEventListener("pointerenter",()=>c(e,"background",x)),e.addEventListener("pointerleave",()=>c(e,"background",b.face)),e.addEventListener("focus",()=>{c(e,"outline",`2px solid ${b.brass}`),c(e,"outline-offset","-4px")}),e.addEventListener("blur",()=>c(e,"outline","none")),e;let n=["close",...s],r=["icon",...i];A(e,t,n),A(e.firstElementChild,t,r);let o={hover:!1,focus:!1,pressed:!1},l=()=>{let d={hover:o.hover,active:o.pressed,focus:o.focus},h=e.firstElementChild;h.style.cssText="",C(h,16),I(h,w(t,r,d)),M(e,[...g,...o.hover?[`background:${x}`]:[],...o.focus?[`outline:2px solid ${b.brass}`,"outline-offset:-4px"]:[],...T(t,"close",d),...w(t,n,d)])};return e.addEventListener("pointerenter",()=>{o.hover=!0,l()}),e.addEventListener("pointerleave",()=>{o.hover=!1,o.pressed=!1,l()}),e.addEventListener("pointerdown",d=>{d.button!==void 0&&d.button!==0||(o.pressed=!0,l())}),e.addEventListener("pointerup",()=>{o.pressed=!1,l()}),e.addEventListener("focus",()=>{o.focus=!0,l()}),e.addEventListener("blur",()=>{o.focus=!1,o.pressed=!1,l()}),l(),e}function Y({zIndex:u="100",width:a="600px",closable:t=!1,titled:s=!1,theme:i=null,surface:x="modal"}={}){let g=L(i),e=g?i.tokens:{},n=e.spacing,r=k=>x==="modal"?[`dialog.${k}`]:[`dialog.${k}`,`${x}.${k}`],o=v("div",["display:block"],{theme:i,parts:r("root")});o.setAttribute("data-clay-modal",""),g&&o.setAttribute("data-clay-ui",x),o.setAttribute("aria-hidden","true");let l=g&&i.scheme!=="light dark",d=Math.min(parseFloat(a)||600,innerWidth-32),h={x:(innerWidth-d)/2,y:Math.min(96,innerHeight*.1),width:d,height:160};c(o,"color-scheme",l?i.scheme:D(h).scheme);let m=v("div",["position:fixed","inset:0",`z-index:${u}`,"overflow:auto","display:flex","align-items:flex-start","justify-content:center","padding:min(96px, 10vh) 16px 16px",`background:color-mix(in srgb, ${b.ground} 72%, transparent)`],{theme:i,parts:r("overlay"),role:"overlay"});m.tabIndex=-1;let p=P("form",["position:relative","display:flex","flex-direction:column","margin:0",`width:min(${a}, 100%)`,"max-height:calc(100dvh - min(96px, 10vh) - 16px)",...f.dialogPanel],{theme:i,parts:r("panel")});p.setAttribute("role","dialog"),p.setAttribute("aria-modal","true");let $=null,y=null;s&&($=v("div",["position:relative","display:block","flex:none",`padding:20px ${t?"68px":"22px"} 16px 22px`,...f.dialogHeader,...e.border?[`border-bottom-color:${e.border}`]:[],...n?[`padding:${n} ${t?`calc(${n} + 46px)`:n} calc(${n} * .7) ${n}`]:[]],{theme:i,parts:r("header")}),y=S("div",["display:block",...f.dialogHeading,"overflow-wrap:anywhere"],void 0,{theme:i,parts:r("title"),role:"heading"}),y.setAttribute("role","heading"),y.setAttribute("aria-level","2"),$.append(y),p.append($));let F=S("div",["display:block","flex:1 1 auto","min-height:0","overflow-y:auto","overflow-x:hidden",`padding:20px ${t&&!s?"84px":"22px"} 20px 22px`,"overflow-wrap:anywhere",`font:14.5px/1.55 ${N}`,...n?[`padding:${n} ${t&&!s?`calc(${n} + 62px)`:n} ${n} ${n}`]:[]],void 0,{theme:i,parts:r("body")}),H=v("div",["display:flex","flex:none","flex-wrap:wrap","justify-content:flex-end","align-items:center",...f.dialogFooter,...e.border?[`border-top-color:${e.border}`]:[],...n?[`padding:calc(${n} * .65) ${n}`,`gap:calc(${n} / 2)`]:[]],{theme:i,parts:[...r("footer"),...r("actions")]});p.append(F,H);let E=t?K("Close",s,i,r("close"),r("closeIcon")):null;return E&&($||p).append(E),m.append(p),o.append(m),{root:o,overlay:m,panel:p,header:$,heading:y,body:F,footer:H,close:E,theme:i}}export{q as a,G as b,Y as c};
|
package/dist/m/c-FDWR3FL7.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as y,j as L,l as $,n as B,q as m}from"./c-MR75YPRT.js";import{a as _}from"./c-4JZDZFF6.js";import{b as R,c as T,d as N,e as S}from"./c-5RZNFTWD.js";import{b as F}from"./c-PKCCHJ5X.js";import{b}from"./c-NUHP2XDB.js";import{h as P}from"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var D="p,h1,h2,h3,h4,h5,h6,li,dt,dd,blockquote,pre,figcaption,td,th",K="section,article,aside,header,footer,nav,main,div,ul,ol,dl,table,figure,form",v=4,C=()=>typeof matchMedia=="function"&&!!matchMedia("(pointer: coarse)").matches;function w(l,d,f){return l.setAttribute(d,f),l}function H(l=document){let d=n=>n instanceof l.defaultView.Element&&n!==l.body&&n!==l.documentElement&&!n.closest("[data-clay-ai-edit]")&&!n.closest(P),f=n=>{if(!n||!d(n))return null;let r=n.closest(D)||n.closest(K);return r&&r!==l.body?r:null};return{targetAt(n,r){let a=typeof l.elementsFromPoint=="function"?l.elementsFromPoint(n,r):[];for(let s of a||[]){let t=f(s);if(t)return t}return null},between(n,r){if(!n)return r||null;if(!r||n===r)return n;let a=n.compareDocumentPosition(r)&4?n:r,s=a===n?r:n,t=a;for(;t&&!t.contains(s);)t=t.parentElement;return t?t===l.body||t.matches(D)||t.matches(K)?t:f(t)||t:null},rectOf(n){return n.getBoundingClientRect()}}}function U({coarse:l}){let d=`color-scheme:${_()}`,f=(u,i)=>w(u,"data-clay-ai-edit-part",i),n=w(L("div",["position:fixed","inset:0","z-index:99997","background:transparent","touch-action:pan-y","cursor:crosshair",d]),"data-clay-ai-edit","picker"),r=w(L("div",["box-sizing:content-box","position:fixed","z-index:99998","pointer-events:none",`border:2px solid ${S.brass}`,"border-radius:0",d]),"data-clay-ai-edit","picker-ring");m(r,!1);let a=w($("div",["position:fixed","left:50%","bottom:16px","transform:translateX(-50%)","z-index:99999","width:min(35rem, calc(100vw - 32px))","padding:8px 10px","border-radius:12px","gap:8px","align-items:center",`box-shadow:${N}`,`font:13px/1.5 ${R}`,d]),"data-clay-ai-edit","picker-bar");m(a,!1,"flex");let s=f(B("div",["display:block","flex:1","min-width:0","overflow:hidden","text-overflow:ellipsis","white-space:nowrap",`color:${S.muted}`,`font:12.5px/1.5 ${T}`]),"picker-hint");s.textContent="Click or drag blocks";let t=f(y("Whole page",{extra:["flex:none"]}),"picker-whole"),h=f(y("Cancel",{variant:"quiet",extra:["flex:none"]}),"picker-cancel"),c=l?f(y("Continue",{variant:"primary",extra:["flex:none"]}),"picker-continue"):null;c&&m(c,!1,"inline-flex"),a.append(s,t,...c?[c]:[],h),document.body.append(n,r,a);for(let u of[n,r,a])F(u);return{overlay:n,ring:r,bar:a,hint:s,whole:t,more:c,cancel:h}}function ee({surface:l,onPicked:d,onWholePage:f,onCancel:n,build:r}={}){let a=document,s=l||H(a),t=null,h=null,c=!1,u=null,i=null,M=e=>e&&(typeof s.rectOf=="function"?s.rectOf(e):e.getBoundingClientRect())||null,k=e=>s.targetAt(e.clientX,e.clientY)||null;function E(e){if(!t)return;let o=M(e);if(!o){m(t.ring,!1);return}b(t.ring,"left",o.left-5+"px"),b(t.ring,"top",o.top-5+"px"),b(t.ring,"width",o.width+6+"px"),b(t.ring,"height",o.height+6+"px"),m(t.ring,!0)}function X(e,o){if(!e)return;let p=u&&(o||C())&&s.between(u,e)||e;u=p,E(p),t.more&&m(t.more,!0,"inline-flex"),!C()&&d?.(p)}function z(e){!c||e.button>0||(e.preventDefault(),i={x:e.clientX,y:e.clientY,from:k(e),moved:!1,shift:!!e.shiftKey})}function Y(e){if(!c)return;let o=k(e);if(i){let p=e.clientX-i.x,x=e.clientY-i.y;if(!i.moved&&p*p+x*x>v*v&&(i.moved=!0),i.moved){E(i.from&&o?s.between(i.from,o)||o:o||i.from);return}}E(o)}function q(e){if(!c||!i)return;let o=i;i=null;let p=e.clientX-o.x,x=e.clientY-o.y,G=o.moved||p*p+x*x>v*v,g=k(e),A=G&&o.from&&g?s.between(o.from,g)||g:g||o.from;A&&X(A,!!(o.shift||e.shiftKey))}function I(e){!c||e.key!=="Escape"||(O(),n?.())}function V(){if(c)return;c=!0,u=null,i=null,t=(r||U)({coarse:C()}),h=new AbortController;let{signal:e}=h,{overlay:o}=t;o.addEventListener("pointerdown",z,{signal:e}),o.addEventListener("pointermove",Y,{signal:e}),o.addEventListener("pointerup",q,{signal:e}),o.addEventListener("pointercancel",()=>{i=null},{signal:e}),t.whole.addEventListener("click",()=>{c&&f?.()},{signal:e}),t.more?.addEventListener("click",()=>{c&&u&&d?.(u)},{signal:e}),t.cancel.addEventListener("click",()=>{O(),n?.()},{signal:e}),a.addEventListener("keydown",I,{signal:e}),m(t.bar,!0,"flex"),t.whole.focus({preventScroll:!0})}function O(){if(!(!c&&!t)){if(c=!1,u=null,i=null,h?.abort(),h=null,t)for(let e of[t.overlay,t.ring,t.bar])e.remove();t=null}}function W(e){return!t||!e?!1:t.overlay.contains(e)||t.bar.contains(e)}return{open:V,close:O,contains:W,get picking(){return c}}}export{ee as createPicker,H as genericSurface};
|
package/dist/m/c-FJDTDGDA.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as d,b as c,c as o,d as n}from"./c-QCDVDZIR.js";import{a as u}from"./c-VKEDWYDF.js";import{f as a}from"./c-C7SUMNMI.js";import{b as l,r as b}from"./c-PNZIJFG7.js";var r="[editmode\\:contenteditable]";function m(){b(e=>{e.querySelectorAll(r).forEach(t=>{n(t),o(t,l(t)??t)})})}function s(){a&&u(()=>{p()})}function p(e=document){e.querySelectorAll(r).forEach(t=>{d(t);let i=t.getAttribute("inert-contenteditable")??t.getAttribute("contenteditable")??c(t,"inert-contenteditable")??"true",f=i.toLowerCase();t.setAttribute("contenteditable",["","true","false","plaintext-only"].includes(f)?i:"true"),t.removeAttribute("inert-contenteditable")})}function y(){document.querySelectorAll(r).forEach(e=>{n(e),o(e)})}function S(){m(),s()}export{r as a,p as b,y as c,S as d};
|
package/dist/m/c-FYDKYW6E.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e}from"./c-IUL7PU4P.js";import"./c-UOUUI265.js";import"./c-QHWJ5ZIJ.js";import"./c-SXNSSHPP.js";import"./c-UL2YUY52.js";import"./c-QY7F6EN6.js";import"./c-ESK4S67I.js";import"./c-MR75YPRT.js";import"./c-4JZDZFF6.js";import"./c-5RZNFTWD.js";import"./c-PKCCHJ5X.js";import"./c-46XYM55L.js";import"./c-NUHP2XDB.js";import"./c-VKEDWYDF.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";export{a as ask,b as consent,e as init,d as snippet,c as tell};
|
package/dist/m/c-HKSLOVU4.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Ze=Object.defineProperty,Ge=(e,t)=>{for(var r in t)Ze(e,r,{get:t[r],enumerable:!0})},Oe=["textContent","innerText","innerHTML","outerHTML","value","checked","selected","disabled","readOnly","type","tagName","nodeName","nodeType","nodeValue","childElementCount","id","className","classList","baseURI","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","dataset","currentSrc","duration","paused","title","documentURI","contentType"],Qe=new Set(Oe),Ye=new Set(["textContent","innerText","innerHTML","value","checked","selected","disabled","readOnly","type","id","className","title"]),Ne=new Set(["tagName","nodeName","nodeType","nodeValue","childElementCount","classList","baseURI","documentURI","contentType","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","currentSrc","duration","paused","dataset"]),ue=new Set(["checked","selected","disabled","readOnly","paused"]);function et(e,t){return t==null?ue.has(e)?!1:"":ue.has(e)?t==="false"?!1:!!t:t}var O={};Ge(O,{CodecRefused:()=>ot,EmptyListInsert:()=>M,MAX_RULE_DEPTH:()=>W,MaxRuleDepthExceeded:()=>Z,NoRulesTag:()=>nt,RuleTargetReadOnly:()=>Re,RulesParseError:()=>R,ShapeMismatch:()=>Se,UnknownCodec:()=>ke,UnknownRulesVersion:()=>$e,WriteNotRoundTripped:()=>rt,WriteRefused:()=>Ce,WriteRejected:()=>lt});var R=class extends Error{constructor(e,t){super(e),this.name="RulesParseError",this.cause=t}},$e=class extends Error{constructor(e){super(`unknown rules version: ${e}. Library supports "1" and "2".`),this.name="UnknownRulesVersion",this.version=e}},W=20,Z=class extends Error{constructor(e){super(`rule depth exceeded ${W} at path: ${e.join(".")}`),this.name="MaxRuleDepthExceeded",this.path=e}},Se=class extends Error{constructor(e){super(`shape mismatch: ${e.length} field(s) failed validation`),this.name="ShapeMismatch",this.mismatches=e}},M=class extends Error{constructor(e,t){super(t?`cannot add items to empty list at "${e.join(".")}" \u2014 ${t}`:`cannot add items to empty list at "${e.join(".")}" \u2014 no sibling to clone as template. Seed the list with a hidden item first.`),this.name="EmptyListInsert",this.path=e}},Re=class extends Error{constructor(e){super(`cannot write to read-only DOM property "${e}"`),this.name="RuleTargetReadOnly",this.target=e}},Ce=class extends Error{constructor(e){super(`write refused: ${e.length} write(s) broke the content-only policy`),this.name="WriteRefused",this.refusals=e}};function tt(e){return e.reduce((t,r)=>typeof r=="number"?`${t}[${r}]`:t?`${t}.${r}`:String(r),"")||"(root)"}var rt=class extends Error{constructor(e){super(`write did not round-trip at "${tt(e)}"`),this.name="WriteNotRoundTripped",this.path=e}},nt=class extends Error{constructor(e){super(`no <script data-rules-name~="${e}"> rules tag in this document`),this.name="NoRulesTag",this.token=e}},lt=class extends Error{constructor(e,t){super(`write rejected: ${e.length} unknown key(s), ${t.length} rule(s) with no matching element`),this.name="WriteRejected",this.unknownKeys=e,this.unmatched=t}},ke=class extends Error{constructor(e){super(`unknown codec "${e}": no codec by that name is given to this call`),this.name="UnknownCodec",this.code="unknown-codec",this.codec=e}},ot=class extends Error{constructor(e,t){super(t),this.name="CodecRefused",this.code=e}};function C(e){let t=0,r=null,l=-1;for(let n=0;n<e.length;n++){let o=e[n];o==="\\"?n++:r?o===r&&(r=null):o==='"'||o==="'"?r=o:o==="["||o==="("?t++:o==="]"||o===")"?t>0&&t--:o==="@"&&t===0&&(l=n)}return l}var ae="[*]";function $(e){let t=C(e),r=t===-1?e:e.slice(0,t),l=r.endsWith(ae),n={selector:l?r.slice(0,-ae.length):r,prop:t===-1?null:e.slice(t+1)||null};return l&&(n.all=!0),n}function je(e){let t=0,r=null,l=-1,n=!1;for(let o=0;o<e.length;o++){let a=e[o];a==="\\"?o++:r?a===r&&(r=null):a==='"'||a==="'"?r=a:a==="["||a==="("?t++:a==="]"||a===")"?t>0&&t--:t===0&&a===">"?l=o:t===0&&a===","&&(n=!0)}return n||l===-1||!it(e,l+1)?null:e.slice(0,l).trim()||null}function it(e,t){let r=t,l=e.replace(/\s+$/,"").length;for(;r<l&&/\s/.test(e[r]);)r++;let n=0,o=null;for(;r<l;r++){let a=e[r];if(a==="\\")r++;else if(o)a===o&&(o=null);else if(a==='"'||a==="'")o=a;else if(a==="["||a==="(")n++;else if(a==="]"||a===")")n>0&&n--;else if(n===0&&(a==="+"||a==="~"||/\s/.test(a)))return!1}return!0}var ut=/^codec\(([a-z][a-z0-9-]*)\)$/;function G(e){if(typeof e!="string")return null;let t=C(e);if(t===-1)return null;let r=ut.exec(e.slice(t+1));if(!r)return null;let{selector:l,all:n}=$(e);if(n)throw new R("A @codec(name) rule cannot use [*].");return{selector:l,name:r[1]}}var at=/^--[A-Za-z0-9_-]+$/;function Q(e){return typeof e=="string"&&at.test(e)}function Le(e){let t=[],r=[],l=null,n=0;for(let o=0;o<e.length;o++){let a=e[o];if(l){a==="\\"?o++:a===l&&(l=null);continue}if(a==="/"&&e[o+1]==="*"){let i=e.indexOf("*/",o+2);o=i===-1?e.length:i+1;continue}a==='"'||a==="'"?l=a:a==="("?r.push(")"):a==="["?r.push("]"):a==="{"?r.push("}"):(a===")"||a==="]"||a==="}")&&r[r.length-1]===a?r.pop():a===";"&&r.length===0&&(t.push(e.slice(n,o)),n=o+1)}return t.push(e.slice(n)),t}function st(e){let t="",r=null;for(let l=0;l<e.length;l++){let n=e[l];if(r){t+=n,n==="\\"&&l+1<e.length?t+=e[++l]:n===r&&(r=null);continue}if(n==="/"&&e[l+1]==="*"){let o=e.indexOf("*/",l+2);l=o===-1?e.length:o+1,t+=" ";continue}(n==='"'||n==="'")&&(r=n),t+=n}return t}function Me(e){e=st(e);let t=e.indexOf(":");if(t===-1)return null;let r=e.slice(0,t).trim(),l=e.slice(t+1).trim(),n=/!\s*important\s*$/i.exec(l);return n&&(l=l.slice(0,n.index).trim()),{name:r,value:l,important:!!n}}function Y(e,t){if(e==null)return null;let r=null;for(let l of Le(String(e))){let n=Me(l);!n||n.name!==t||(!r||n.important||!r.important)&&(r=n)}return r?r.value:null}function ct(e,t,r){let l=e==null?"":String(e),n=r==null||r==="",o=Le(l),a=o.map(Me),i=a.some(d=>d&&d.name===t&&d.important),u=[],s=!1;o.forEach((d,p)=>{let v=a[p];if(!v||v.name!==t){u.push(d);return}if(n||s)return;let f=/^\s*/.exec(d)[0];u.push(`${f}${t}: ${r}${i?" !important":""}`),s=!0});let c=u.join(";");if(!n&&!s){let d=c.trimEnd();c=d===""?`${t}: ${r}`:`${d}${d.endsWith(";")?" ":"; "}${t}: ${r}`}return c.trim()===""?null:c}function Ie(e,t,r,l){let n=e.attr(t,"style");if((Y(n,r)??"")===l)return;let o=ct(n,r,l);o==null?e.removeAttr(t,"style"):e.attr(t,"style",o)}var se=/^[a-z][a-z0-9-]*$/,ee=new Map;function ft(e,t){if(typeof e!="string"||!se.test(e))throw new Error(`hyper-html-api: invalid codec name ${JSON.stringify(e)} (must match ${se})`);if(!t||typeof t.read!="function"||typeof t.write!="function"||typeof t.same!="function")throw new Error(`hyper-html-api: codec "${e}" needs read, write and same functions`);ee.set(e,t)}function dt(e){return ee.get(e)??null}function pt(){return Object.fromEntries(ee)}var ht='The @codec(name) rule form needs a rules tag with data-rules-version="2".',mt="A @codec(name) rule must be the value of a top level key.";function We(e,t){let r=G(e);return r?{...r,codec:t.codecs[r.name]}:null}function te(e,t={}){let r=t.version??"1",l=t.codecs??{};n(e,0);function n(o,a){if(!(a>W)){if(typeof o=="string"){let i=G(o);if(!i)return;if(r!=="2")throw new R(ht);if(a!==1)throw new R(mt);if(!Object.prototype.hasOwnProperty.call(l,i.name))throw new ke(i.name);return}if(Array.isArray(o)){n(o[1],a+1);return}if(o&&typeof o=="object")for(let i of Object.values(o))n(i,a+1)}}}function q(e,t,r,l={}){if(Object.prototype.hasOwnProperty.call(l,"exclude")&&e.semanticExclude===!1)throw new Error("This adapter does not support semantic exclude queries; omit exclude or use the DOM adapter.");return te(r,l),_(e,t,r,{depth:0,path:[]},l)}function _(e,t,r,l,n){if(l.depth>W)throw new Z(l.path);if(typeof r=="string")return yt(e,t,r,l,n);if(Array.isArray(r)){let[o,a]=r,i=e.find(t,o,n);return De(n,l,i),i.map((u,s)=>_(e,u,a,{depth:l.depth+1,path:[...l.path,s]},n))}if(typeof r=="object"&&r!==null){let o={};for(let[a,i]of Object.entries(r))o[a]=_(e,t,i,{depth:l.depth+1,path:[...l.path,a]},n);return o}return null}function yt(e,t,r,l,n){if(r.endsWith("[]")){let c=r.slice(0,-2),d=e.find(t,c,n);return De(n,l,d),d.map(p=>e.text(p))}let o=We(r,n);if(o)return gt(e,t,o,n);if(r.startsWith("@"))return z(e,t,r.slice(1));let a=C(r);if(a!==-1){let{selector:c,all:d}=$(r),p=r.slice(a+1),v=c?e.find(t,c,n):[t];return d&&n.allMatches?v.map(f=>z(e,f,p)):v.length===0?null:z(e,v[0],p)}if(r===".")return e.text(t);let{selector:i,all:u}=$(r),s=e.find(t,i,n);return u&&n.allMatches?s.map(c=>e.text(c)):s.length===0?null:e.text(s[0])}function gt(e,t,{selector:r,codec:l},n){let o=r?e.find(t,r,n):[t];return o.length===0?null:l.read(e,o[0],{query:n.query,view:n.view,region:n.region})}function De(e,t,r){if(typeof e.onRowsRead=="function")try{e.onRowsRead(t.path.slice(),r)}catch(l){console.warn(`[hyper-html-api] onRowsRead threw at "${t.path.join(".")||"(root)"}"`,l)}}function z(e,t,r){if(Q(r))return Y(e.attr(t,"style"),r);if(Qe.has(r)){let n=e.prop(t,r);return n==null?null:String(n)}return e.attr(t,r)??null}function wt(e,t,r,l){let n=e.length,o=t.length,a=new Array(n).fill(-1);if(l){let h=new Set;for(let y=0;y<n;y++){let w=l[y];!(w>=0&&w<o)||h.has(w)||(a[y]=w,h.add(w))}}if(n===0||o===0)return a;let i=e.map(h=>ce(h,r)),u=t.map(h=>ce(h,r)),s=new Array(o).fill(!1);for(let h of a)h>=0&&(s[h]=!0);let c=new Map;u.forEach((h,y)=>{s[y]||c.set(h,c.has(h)?-1:y)});let d=new Map;i.forEach((h,y)=>{a[y]>=0||d.set(h,(d.get(h)||0)+1)}),i.forEach((h,y)=>{if(a[y]>=0||d.get(h)!==1)return;let w=c.get(h);w===void 0||w===-1||s[w]||(a[y]=w,s[w]=!0)});let p=[];for(let h=0;h<n;h++)a[h]<0&&p.push(h);let v=[];for(let h=0;h<o;h++)s[h]||v.push(h);if(p.length===0||v.length===0)return a;let f=n*o+1,m=vt(e,t,r),g=(h,y)=>m(h,y)*f+Math.abs(h-y);for(let[h,y]of At(p,v,g))a[h]=y;return a}var Pe=e=>typeof e=="object"&&e!==null;function ce(e,t){if(!Pe(t))return e==null?" null":String(e);let r=Object.keys(t);return JSON.stringify(r.map(l=>{let n=JSON.stringify(e?.[l]);return n===void 0?" undef":n}))}function vt(e,t,r){if(!Pe(r))return(i,u)=>e[i]===t[u]?0:1;let l=Object.keys(r),n=i=>l.map(u=>JSON.stringify(i?.[u])),o=e.map(n),a=t.map(n);return(i,u)=>{let s=o[i],c=a[u],d=0;for(let p=0;p<l.length;p++)s[p]!==c[p]&&d++;return d}}function At(e,t,r){return e.length<=t.length?fe(e,t,r,!1):fe(t,e,(l,n)=>r(n,l),!0)}function fe(e,t,r,l){let n=e.length,o=t.length,a=[];for(let d=0;d<=n;d++)a.push(new Float64Array(o+1).fill(1/0));let i=[];for(let d=0;d<=n;d++)i.push(new Uint8Array(o+1));for(let d=0;d<=o;d++)a[n][d]=0;for(let d=n-1;d>=0;d--)for(let p=o-1;p>=0;p--){let v=r(e[d],t[p])+a[d+1][p+1],f=a[d][p+1];v<=f?(a[d][p]=v,i[d][p]=1):a[d][p]=f}let u=[],s=0,c=0;for(;s<n&&c<o;)i[s][c]&&(u.push(l?[t[c],e[s]]:[e[s],t[c]]),s++),c++;return u}function qe(e,t,r,l,n,o,a,i={}){let u=e.find(t,r,i);if(n.length===0){u.forEach(A=>e.remove(A)),V(i,"onRowsApplied",o.path,[]);return}let s=n.length>u.length,c=u[0]||null;if(s&&!c&&(c=xt(e,t,r,i),!c))throw new M(o.path);let d=u.map(A=>Et(e,A,l,i)),p=null;if(s&&c){p=e.clone(c),i.templateAttr&&e.removeAttr(p,i.templateAttr);let A=e.stripIds(p);A>0&&console.warn(`[hyper-html-api] stripped ${A} id attribute(s) from cloned template at "${o.path.join(".")||"(root)"}"`)}let v=wt(n,d,l,bt(e,u,n,o,i)),f=u.length>0?e.parent(u[0]):St(e,t,r,c,o,i),m=u.length>0?Be(e,f,u[0]):0,g=kt(e,u),h=new Set,y=[],w=n.map((A,T)=>{let b=v[T];if(b>=0)return h.add(b),y.push(!1),u[b];y.push(!0);let x=e.clone(p);return e.stripIds(x),x});u.forEach((A,T)=>{h.has(T)||e.remove(A)}),g?Ct(e,f,m,w,y):jt(e,w,y,f,m),Tt(e,w,l,n,o,a,i),V(i,"onRowsApplied",o.path,w)}function V(e,t,r,l){if(typeof e[t]=="function")try{return e[t](r.slice(),l)}catch(n){console.warn(`[hyper-html-api] ${t} threw at "${r.join(".")||"(root)"}"`,n);return}}function bt(e,t,r,l,n){let o=V(n,"identifyRows",l.path,r);if(!Array.isArray(o))return null;let a=new Array(r.length).fill(-1),i=new Set,u=new Map(t.map((s,c)=>[e.identity(s),c]));for(let s=0;s<r.length;s++){if(!o[s])continue;let c=u.get(e.identity(o[s]));c===void 0||i.has(c)||(a[s]=c,i.add(c))}return a}function Tt(e,t,r,l,n,o,a){t.forEach((i,u)=>{if(r===null){let s=l[u],c=s==null?"":String(s);e.text(i)!==c&&e.text(i,c)}else{let s=o(e,i,r,l[u],{depth:n.depth+1,path:[...n.path,u]},a);s&&s!==i&&(t[u]=s)}})}function Et(e,t,r,l){return r===null?e.text(t):q(e,t,r,l.onRowsRead?{...l,onRowsRead:void 0}:l)}function Be(e,t,r){let l=e.children(t);for(let n=0;n<l.length;n++)if(e.sameNode(l[n],r))return n;return-1}function xt(e,t,r,l){if(!l.templateAttr)return null;let n=/^\s*:scope\s*>\s*/.test(r),o=new RegExp(":not\\(\\["+l.templateAttr.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&")+"\\]\\)","g"),a=r.replace(/^\s*:scope\s*>\s*/,"").replace(o,""),i=n?Ot(a):0,u=je(a),s=t;for(;s;){let c=e.find(s,a,{includeRulesTag:!1,templateAttr:null});for(let d of c)if(e.attr(d,l.templateAttr)!=null&&!(n&&!$t(e,t,d,i))&&!(u&&!e.matches(e.parent(d),u)))return d;s=e.parent(s)}return null}function Ot(e){let t=0,r=null,l=1;for(let n=0;n<e.length;n++){let o=e[n];if(o==="\\")n++;else if(r)o===r&&(r=null);else if(o==='"'||o==="'")r=o;else if(o==="["||o==="(")t++;else if(o==="]"||o===")")t>0&&t--;else if(t===0&&o===">")l++;else{if(t===0&&(o==="+"||o==="~"))return null;if(t===0&&/\s/.test(o)){if(!Nt(e,n))return null;for(;n+1<e.length&&/\s/.test(e[n+1]);)n++}}}return l}function Nt(e,t){let r=t;for(;r<e.length&&/\s/.test(e[r]);)r++;let l=t>0?e[t-1]:"",n=r<e.length?e[r]:"";return de(l)||de(n)}function de(e){return e===">"||e==="+"||e==="~"}function $t(e,t,r,l){if(l===null)return!0;let n=r;for(let u=0;u<l;u++)if(n=e.parent(n),!n)return!1;let o=e.prop(t,"tagName");if(!o)return!0;let a=e.prop(n,"tagName");if(!a||String(a).toLowerCase()!==String(o).toLowerCase())return!1;let i=new Set(pe(e,n));return pe(e,t).every(u=>i.has(u))}function pe(e,t){let r=e.attr(t,"class");return r?String(r).split(/\s+/).filter(Boolean):[]}function St(e,t,r,l,n,o){let a=e.parent(l);if(a&&Rt(e,t,a)&&!me(e,a,o))return a;let i=je(r);if(!i)throw new M(n.path,`the list selector "${r}" names no container to hold the new rows \u2014 write it as "container > row" (for example "ol.comments > li") so the cloned row lands in the list`);let u=(i===":scope"?e.prop(t,"tagName")?[t]:[]:e.find(t,i,o)).filter(s=>!me(e,s,o));if(u.length===0)throw new M(n.path,`no container matching "${i}" inside this context to hold the new rows`);if(u.length>1)throw new M(n.path,`"${i}" matches ${u.length} containers inside this context, so the new rows have no single destination`);return u[0]}function Rt(e,t,r){let l=r;for(;l;){if(e.sameNode(l,t))return!0;l=e.parent(l)}return e.parent(t)?!1:e.find(t,"*",{includeRulesTag:!0,templateAttr:null}).some(n=>e.sameNode(n,r))}var he=["no-data","editor-ui"];function me(e,t,r){let l=t;for(;l;){if(r.templateAttr&&e.attr(l,r.templateAttr)!=null||he.some(o=>e.attr(l,o)!=null))return!0;let n=e.attr(l,"clay");if(n&&n.split(/\s+/).some(o=>he.includes(o)))return!0;l=e.parent(l)}return!1}function Ct(e,t,r,l,n){let o=e.children(t),a=o.map(u=>e.identity(u)),i=!1;l.forEach((u,s)=>{let c=e.identity(u),d=r+s;if(a[d]===c)return;if(!n[s]){let v=a.indexOf(c);v!==-1&&(a.splice(v,1),o.splice(v,1))}let p=Math.min(d,o.length);p<o.length?e.insertBefore(o[p],u):o.length?i?e.insertAfter(o[o.length-1],u):(e.insertAt(t,u,d),i=!0):e.insertAt(t,u,0),a.splice(p,0,c),o.splice(p,0,u)})}function kt(e,t){if(t.length<=1)return!0;let r=e.parent(t[0]);if(!r)return!1;let l=new Map(e.children(r).map((o,a)=>[e.identity(o),a])),n=[];for(let o of t){let a=l.get(e.identity(o));if(a===void 0)return!1;n.push(a)}return n.sort((o,a)=>o-a),n[n.length-1]-n[0]===n.length-1}function jt(e,t,r,l,n){let o=null,a=n;for(let i=0;i<t.length;i++){if(!r[i]){o=t[i];continue}let u=o?e.parent(o):l;if(!u)continue;let s=o?Be(e,u,o)+1:a++;e.insertAt(u,t[i],s),o=t[i]}}function B(e,t,r,l,n={}){if(Object.prototype.hasOwnProperty.call(n,"exclude")&&e.semanticExclude===!1)throw new Error("This adapter does not support semantic exclude queries; omit exclude or use the DOM adapter.");te(r,n);let o=[];if(F(r,l,[],o),o.length)throw new Se(o);H(e,t,r,l,{depth:0,path:[]},n)}function H(e,t,r,l,n,o={}){if(n.depth>W)throw new Z(n.path);if(l===void 0)return t;if(typeof r=="string")return Lt(e,t,r,l,n,o);if(Array.isArray(r)){let[a,i]=r;return qe(e,t,a,i,l,n,H,o),t}if(typeof r=="object"&&r!==null){for(let[a,i]of Object.entries(r)){let u=H(e,t,i,l==null?l:l[a],{depth:n.depth+1,path:[...n.path,a]},o);u&&u!==t&&(t=u)}return t}return t}function Lt(e,t,r,l,n,o){if(r.endsWith("[]")){let d=r.slice(0,-2);return qe(e,t,d,null,l,n,H,o),t}let a=We(r,o);if(a){let d=a.selector?e.find(t,a.selector,o):[t];return d.length&&a.codec.write(e,d[0],l,{query:o.query}),t}if(r.startsWith("@"))return ge(e,t,r.slice(1),l);let i=C(r);if(i!==-1){let{selector:d,all:p}=$(r),v=r.slice(i+1),f=d?e.find(t,d,o):[t];for(let m of p?f:f.slice(0,1))ge(e,m,v,l);return t}if(r===".")return ye(e,t,l),t;let{selector:u,all:s}=$(r),c=e.find(t,u,o);for(let d of s?c:c.slice(0,1))ye(e,d,l);return t}function ye(e,t,r){let l=r==null?"":String(r);e.text(t)!==l&&e.text(t,l)}function Mt(e,t,r,l){if(e.styleVar){e.styleVar(t,r,l);return}Ie(e,t,r,l)}function ge(e,t,r,l){if(Q(r))return Mt(e,t,r,l==null?"":String(l).trim()),t;if(Ne.has(r)){let n=e.prop(t,r);if(n===l||n!=null&&l!=null&&String(n)===String(l))return t;throw new Re(r)}if(r==="outerHTML"){let n=l==null?"":String(l);return e.replaceWith(t,n)}if(Ye.has(r)){let n=et(r,l);return e.prop(t,r)!==n&&e.prop(t,r,n),t}if(l==null)e.attr(t,r)!=null&&e.removeAttr(t,r);else{let n=String(l);e.attr(t,r)!==n&&e.attr(t,r,n)}return t}function F(e,t,r,l){if(t!==void 0){if(typeof e=="string"){if(G(e))return;if(e.endsWith("[]")){Array.isArray(t)?t.forEach((n,o)=>{typeof n=="object"&&n!==null&&l.push({path:j([...r,o]),expected:"scalar",got:k(n)})}):l.push({path:j(r),expected:"array",got:k(t)});return}t!==null&&typeof t=="object"&&l.push({path:j(r),expected:"scalar",got:k(t)});return}if(Array.isArray(e)){if(!Array.isArray(t)){l.push({path:j(r),expected:"array",got:k(t)});return}let n=e[1];t.forEach((o,a)=>F(n,o,[...r,a],l));return}if(typeof e=="object"&&e!==null){if(t===null||Array.isArray(t)||typeof t!="object"){l.push({path:j(r),expected:"object",got:k(t)});return}for(let[n,o]of Object.entries(e))F(o,t[n],[...r,n],l)}}}function k(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function j(e){return e.join(".")}function It(e){try{return JSON.parse(e)}catch(t){throw new R(`Invalid strict JSON: ${t.message}`,t)}}function He(e){try{return JSON.parse(e)}catch{}let t={BRACE_OPEN:"{",BRACE_CLOSE:"}",BRACKET_OPEN:"[",BRACKET_CLOSE:"]",COLON:":",COMMA:",",STRING:"STRING",SELECTOR:"SELECTOR",IDENTIFIER:"IDENTIFIER",NUMBER:"NUMBER",BOOLEAN:"BOOLEAN"};function r(n){let o=[],a=0;for(;a<n.length;){let i=n[a];if(/\s/.test(i)){a++;continue}if("{}".includes(i)){o.push({type:i,value:i}),a++;continue}if(i==="["){let d=!1,p=a+1;for(;p<n.length&&/\s/.test(n[p]);)p++;if(p<n.length&&/[a-zA-Z_]/.test(n[p])&&(d=!0),!d){o.push({type:i,value:i}),a++;continue}}if(i==="]"){o.push({type:i,value:i}),a++;continue}if(i===":"){o.push({type:t.COLON,value:i}),a++;continue}if(i===","){o.push({type:t.COMMA,value:i}),a++;continue}if(i==='"'||i==="'"){let d=i,p=a+1;for(;p<n.length&&n[p]!==d;)n[p]==="\\"&&p++,p++;o.push({type:t.STRING,value:n.substring(a+1,p),quoted:!0,sourceQuote:d}),a=p+1;continue}let u=a,s;for(;u<n.length&&!/[{},]/.test(n[u]);)if(n[u]===":"){let d=[":first",":last",":nth-child",":nth-of-type",":first-child",":last-child",":first-of-type",":last-of-type",":only-child",":only-of-type",":hover",":focus",":active",":visited",":disabled",":enabled",":checked",":empty",":root",":target",":not",":before",":after",":nth-last-child",":nth-last-of-type"],p=!1;for(let v of d){let f=v.substring(1);if(n.substring(u+1,u+1+f.length)===f){p=!0,u+=f.length;break}}if(!p)break}else if(n[u]==="["){for(u++;u<n.length&&n[u]!=="]";){if(n[u]==='"'||n[u]==="'"){let d=n[u];for(u++;u<n.length&&n[u]!==d;)n[u]==="\\"&&u++,u++}u++}u<n.length&&n[u]==="]"&&u++}else u++;s=n.substring(a,u);let c=t.IDENTIFIER;/^-?\d+(\.\d+)?$/.test(s)?c=t.NUMBER:s==="true"||s==="false"||s==="null"?c=t.BOOLEAN:/^[.#@\[]|[.#@\[]| /.test(s)&&(c=t.SELECTOR),o.push({type:c,value:s,quoted:!1}),a=u}return o}function l(n){let o="";for(let a=0;a<n.length;a++){let i=n[a];if("{}".includes(i.type)||"[]".includes(i.type)){o+=i.value;continue}if(i.type===t.COLON){o+=i.value;continue}if(i.type===t.COMMA){let u=n[a+1];if(u&&(u.type==="}"||u.type==="]"))continue;o+=i.value;continue}if(i.type===t.STRING&&i.quoted){let u=i.value;i.sourceQuote==="'"&&(u=u.replace(/\\'/g,"'"),u=u.replace(/(\\*)"/g,(s,c)=>c.length%2===0?c+'\\"':s)),o+=`"${u}"`;continue}if(i.type===t.NUMBER||i.type===t.BOOLEAN){o+=i.value;continue}if(i.type===t.SELECTOR||i.type===t.IDENTIFIER){o+=`"${i.value}"`;continue}o+=`"${i.value}"`}return o}try{let n=r(e),o=l(n);return JSON.parse(o)}catch(n){throw new R("Invalid extraction rules syntax: "+n.message,n)}}var Wt=["1","2"],we=/^[a-zA-Z0-9_-]+$/;function re(e,t,r){let l;if(r===void 0)l="script[data-rules-name]";else{if(typeof r!="string"||!we.test(r))throw new Error(`hyper-html-api: invalid rules token ${JSON.stringify(r)} (must match ${we})`);l=`script[data-rules-name~="${r}"]`}let n=e.find(t,l,{includeRulesTag:!0});if(n.length===0)return null;r!==void 0&&n.length>1&&console.warn(`hyper-html-api: ${n.length} rules tags match data-rules-name~="${r}"; using the first.`);let o=n[0],a=e.attr(o,"data-rules-version");if(!Wt.includes(a))throw new $e(a);return{rules:He(e.text(o)),tagNode:o,version:a}}var ne=Object.freeze({data:Object.freeze({tokens:["no-data"],bundles:["editor-ui"]}),save:Object.freeze({tokens:["no-save"],bundles:["editor-ui"]}),snapshot:Object.freeze({tokens:["no-snapshot"],bundles:["editor-ui"]}),watch:Object.freeze({tokens:["no-watch"],bundles:["editor-ui"]}),undo:Object.freeze({tokens:["no-undo"],bundles:["editor-ui"]}),history:Object.freeze({tokens:[],bundles:["editor-ui"]})}),Dt=Object.freeze({"editor-ui":Object.freeze(["no-data","no-save","no-snapshot","no-watch","no-undo"])}),Pt=Object.freeze(["no-save","no-snapshot","no-trigger-autosave","no-dirty","no-watch","no-undo","no-data","freeze","editor-ui","live"]);function U(e,t){if(!e||e.nodeType!==1)return!1;let r=e.getAttribute?.("clay");return!!(r&&r.split(/\s+/).includes(t)||e.hasAttribute?.(t))}function Ue(e,t){if(U(e,t))return!0;for(let[r,l]of Object.entries(Dt))if(l.includes(t)&&U(e,r))return!0;return!1}function J(e){let t=ne[e];if(!t)throw new Error(`Unknown region capability: ${e}`);return[...t.tokens,...t.bundles].flatMap(r=>[`[clay~="${r}"]`,`[${r}]`]).join(", ")}function qt(e,t){let r=e&&e.nodeType===1?e:e?.parentElement;for(;r&&r.nodeType===1;){let l=ne[t];if(!l)throw new Error(`Unknown region capability: ${t}`);if(l.tokens.some(n=>Ue(r,n))||l.bundles.some(n=>U(r,n)))return r;r=r.parentElement}return null}function Bt(e,t){return!!qt(e,t)}var le=Object.freeze({refusedRuleForms:["innerHTML","outerHTML"],refusedTargets:["script","style","template","noscript","iframe","object","embed","xmp","plaintext","noembed","noframes","meta","link","base","animate","set","animatemotion","animatetransform"],refusedAttributes:["style","srcdoc","is","http-equiv","sandbox","allow","nonce","integrity","charset","htmlclaytoken","htmlclayid","data-rules-name","data-rules-version","clay","contenteditable",...Pt],refusedAttributePrefixes:["on"],urlAttributes:["href","src","srcset","action","formaction","poster","cite","data","ping","background","longdesc","usemap","xlink:href","manifest","codebase","icon"],refusedSchemes:["javascript","vbscript","data"],customPropertyValues:Object.freeze({maxLength:200,refusedCharacters:[";","{","}","<",">","\\"],refusedFunctions:["url","src","image","image-set","-webkit-image-set","cross-fade","element","expression","paint"]})}),Ht=new Set(["textContent","innerText"]);function Ut(e){let t=String(e).replace(/^[\u0000- ]+|[\u0000- ]+$/g,"").replace(/[\t\n\r]/g,"").match(/^([a-zA-Z][a-zA-Z0-9+.-]*):/);return t?t[1].toLowerCase():null}var zt=/^[^\t\n\f\r "'>/=\u0000-\u001f\u007f]+$/;function _t(e,t,r=le){if(!zt.test(String(e)))return`attribute name ${JSON.stringify(String(e))} is not valid`;let l=String(e).toLowerCase();if(r.refusedAttributePrefixes.some(n=>l.startsWith(n)))return`attribute "${l}" can run script`;if(r.refusedAttributes.includes(l))return`attribute "${l}" is not content`;if(r.urlAttributes.includes(l)&&t!=null){let n=l==="srcset"?String(t).split(",").map(o=>o.trim().split(/\s+/)[0]).filter(Boolean):[String(t)];for(let o of n){let a=Ut(o);if(a&&r.refusedSchemes.includes(a))return`"${a}:" URLs are not allowed in "${l}"`}}return null}function oe(e,t){let r=e.prop(t,"tagName");return r?String(r).toLowerCase():""}function Vt(e,t){let r=oe(e,t)||"node",l=e.attr(t,"id");return l?`<${r}#${l}>`:`<${r}>`}function Ft(e,t,r){let l=t;for(;l;){let n=oe(e,l);if(n&&r.refusedTargets.includes(n))return n;l=e.parent(l)}return null}function ze(e,t){return e.find(t,"script[data-rules-name]",{includeRulesTag:!0,templateAttr:null}).length>0}function Jt(e,t){return oe(e,t)==="script"&&e.attr(t,"data-rules-name")!=null?!0:ze(e,t)}function Kt(e){if(/[\u0000-\u001f\u007f]/.test(e))return"control characters are not allowed in a custom property value";let t=[],r=null;for(let l=0;l<e.length;l++){let n=e[l];if(r){n===r&&(r=null);continue}if(n==='"'||n==="'")r=n;else{if(n==="/"&&e[l+1]==="*")return"comments are not allowed in a custom property value";if(n==="(")t.push(")");else if(n==="[")t.push("]");else if((n===")"||n==="]")&&t.pop()!==n)return`"${n}" does not close anything in this custom property value`}}return r?"a custom property value must close its quotes":t.length?"a custom property value must close its brackets":null}function Xt(e,t=le){let r=t.customPropertyValues,l=String(e);if(l.length>r.maxLength)return`custom property values are limited to ${r.maxLength} characters`;let n=r.refusedCharacters.find(u=>l.includes(u));if(n)return`${JSON.stringify(n)} is not allowed in a custom property value`;let o=Kt(l);if(o)return o;let a=l.toLowerCase(),i=r.refusedFunctions.find(u=>new RegExp(`(^|[^a-z0-9_-])${u.replace(/[-]/g,"\\-")}\\s*\\(`).test(a));return i?`"${i}()" is not allowed in a custom property value`:null}function ve(e,t=le){let r=[],l=(i,u)=>(r.push({target:Vt(e,i),reason:u}),!1),n=i=>{let u=Ft(e,i,t);return u?l(i,`inside <${u}>, which is not content`):!0},o=i=>n(i)?ze(e,i)?l(i,"a text write here would delete the data rules tag"):!0:!1,a=(i,u,s)=>{if(!n(i))return!1;let c=_t(u,s,t);return c?l(i,c):!0};return{...e,text(i,u){if(u===void 0)return e.text(i);o(i)&&e.text(i,u)},attr(i,u,s){if(s===void 0)return e.attr(i,u);a(i,u,s)&&e.attr(i,u,s)},removeAttr(i,u){a(i,u,null)&&e.removeAttr(i,u)},styleVar(i,u,s){if((Y(e.attr(i,"style"),u)??"")!==s&&n(i)){if(!Q(u))return l(i,`"${u}" is not a custom property`);if(s!==""){let c=Xt(s,t);if(c)return l(i,c)}Ie(e,i,u,s)}},prop(i,u,s){if(s===void 0)return e.prop(i,u);if(t.refusedRuleForms.includes(u))return l(i,`"@${u}" writes HTML, only text is allowed`);if(Ht.has(u)){o(i)&&e.prop(i,u,s);return}a(i,u==="className"?"class":u,s)&&e.prop(i,u,s)},remove(i){if(Jt(e,i)){l(i,"removing this would delete the data rules tag");return}e.remove(i)},replaceWith(i,u){return u===e.prop(i,"outerHTML")||l(i,'"@outerHTML" writes HTML, only text is allowed'),i},refusals:r,assertClean(){if(r.length)throw new Ce(r.slice())}}}function L(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ae(e){return e.reduce((t,r)=>typeof r=="number"?`${t}[${r}]`:t?`${t}.${r}`:r,"")}function Zt(e,t,r,l,n={}){te(r,n);let o=[],a=[];function i(s,c,d){if(Array.isArray(s)){let[,p]=s;if(!Array.isArray(c)||!L(p))return;c.forEach((v,f)=>i(p,v,[...d,f]));return}if(!(!L(s)||!L(c)))for(let p of Object.keys(c))Object.prototype.hasOwnProperty.call(s,p)?i(s[p],c[p],[...d,p]):o.push(Ae([...d,p]))}function u(s,c,d,p){if(d!==void 0){if(typeof c=="string"){if(c.endsWith("[]")||c==="."||c.startsWith("@"))return;let{selector:v}=$(c);if(!v)return;e.find(s,v,n).length===0&&a.push({path:Ae(p),selector:v});return}if(!Array.isArray(c)&&L(c)&&L(d))for(let[v,f]of Object.entries(c))u(s,f,d[v],[...p,v])}}return i(r,l,[]),u(t,r,l,[]),{unknownKeys:o,unmatched:a}}function be(e,t,r){if(r&&typeof r=="object")return{rules:r,tagNode:null,version:"1"};if(typeof r=="string"){let l=t&&t.ownerDocument?t.ownerDocument:t;return re(e,l,r)}return null}var Gt=/:(?:focus(?:-within|-visible)?|hover|active|visited|defined)\b/i;function Qt(e,t){if(!/^(INPUT|TEXTAREA|SELECT|OPTION)$/.test(e.tagName||""))return;let r=(e.getAttribute?.("type")||"").toLowerCase();"value"in e&&"value"in t&&e.tagName!=="OPTION"&&r!=="checkbox"&&r!=="radio"&&r!=="file"&&(t.value=e.value),e.tagName==="INPUT"&&(r==="checkbox"||r==="radio")&&(t.checked=e.checked),e.tagName==="OPTION"&&(t.selected=e.selected),"indeterminate"in e&&"indeterminate"in t&&(t.indeterminate=e.indeterminate)}function Te(e,t,r,l){if(l)return!!e.closest?.(t);let n=e;for(;n?.nodeType===1;){if(n.matches(t))return!0;if(n===r)break;n=n.parentElement}return!1}function Ee(e,t,r,l,n,o){return(o?Bt(e,t):Te(e,r,n,!1))||!!(l&&(o&&e!==n?e.matches(l):Te(e,l,n,o)))}function Yt(e,t){let r=ne[t];return r.tokens.some(l=>Ue(e,l))||r.bundles.some(l=>U(e,l))}var er=new Set(["INPUT","TEXTAREA","SELECT","OPTION"]);function _e(e,t,r,l){if(e.nodeType===1&&l(e)){r.dropped.push(t);return}r.cloneToLive.set(t,e),r.liveToClone.set(e,t);let n=e,o=t;if(e.nodeType===1){if(er.has(e.tagName)&&r.controls.push(e,t),e.tagName==="TEMPLATE"){for(;t.firstChild;)t.removeChild(t.firstChild);n=e.content,o=t.content,r.cloneToLive.set(o,n),r.liveToClone.set(n,o)}}else if(e.nodeType!==11)return;let a=o.firstChild;for(let i=n.firstChild;i&&a;i=i.nextSibling)_e(i,a,r,l),a=a.nextSibling}function D(e,{capability:t="data",exclude:r=null,inherit:l=!0,provenance:n=null}={}){if(!e)throw new TypeError("createContentView requires a DOM context");let o=e.nodeType===9?e:e.ownerDocument;if(!o?.implementation?.createHTMLDocument)throw new TypeError("createContentView requires an HTML DOM implementation");let a=o.implementation.createHTMLDocument(""),i=n||new WeakMap,u=new WeakMap,s=e.nodeType===9?e.documentElement:e;r&&a.documentElement.matches(r);let c=J(t),d=l?f=>Yt(f,t)||!!(r&&f.matches(r)):f=>Ee(f,t,c,r,s,!1),p=null;if(s.nodeType!==1||!Ee(s,t,c,r,s,l)){p=a.importNode(s,!0);let f={cloneToLive:i,liveToClone:u,dropped:[],controls:[]};_e(s,p,f,d);for(let m of f.dropped)m.remove();for(let m=0;m<f.controls.length;m+=2)Qt(f.controls[m],f.controls[m+1])}e.nodeType===9&&p&&(a.replaceChild(p,a.documentElement),u.set(e,a),i.set(a,e));let v=f=>{if(Gt.test(f))throw new Error(`Filtered content queries do not support stateful selector: ${f}`)};return{root:p,document:a,capability:t,selector:J(t),cloneToLive:i,liveToClone:u,original(f){return i.get(f)||null},cloneOf(f){return u.get(f)||null},query(f,m=p){return v(f),Array.from(m.querySelectorAll(f),g=>i.get(g)||g)},text(f=p){return(f===p?p:u.get(f))?.textContent||""},html(f=p){return(f===p?p:u.get(f))?.innerHTML??""},clone(f=p){let m=f===p?p:u.get(f);return m?a.importNode(m,!0):null}}}function Ve(e){return e&&e.nodeType===1&&e.tagName==="SCRIPT"&&e.hasAttribute&&e.hasAttribute("data-rules-name")}function tr(e){return e?(e.nodeType===9||e.nodeType,e):null}function xe(e,t,r){!e||e.nodeType!==1||(t==="value"&&e.tagName==="INPUT"?e.value=r===null?"":r:t==="checked"&&e.tagName==="INPUT"?e.checked=r!==null:t==="selected"&&e.tagName==="OPTION"&&(e.selected=r!==null))}function Fe(e,t){e&&e.tagName==="TEXTAREA"&&(e.value=t)}function Je(e){if(!e||e.nodeType!==1)return;let t=[e,...e.querySelectorAll?e.querySelectorAll("textarea, input, option"):[]];for(let r of t)if(r.tagName==="TEXTAREA")r.value=r.defaultValue;else if(r.tagName==="INPUT"){let l=r.type;l!=="file"&&l!=="checkbox"&&l!=="radio"&&(r.value=r.defaultValue),r.checked=r.defaultChecked}else r.tagName==="OPTION"&&(r.selected=r.defaultSelected)}var E={semanticExclude:!0,find(e,t,r={}){let l=tr(e);if(!l||!l.querySelectorAll)return[];let n=Array.from(l.querySelectorAll(t));r.includeRulesTag||(n=n.filter(i=>!Ve(i)));let o=[];r.skip&&o.push(r.skip);let a=r.templateAttr===null?null:r.templateAttr||"cms-template";if(a&&o.push("["+a+"]"),o.length){let i=o.join(", ");n=n.filter(u=>!u.closest||!u.closest(i))}return n},parent(e){return e?e.parentElement:null},children(e){return e?Array.from(e.children):[]},matches(e,t){return!!(e&&e.matches)&&e.matches(t)},text(e,t){if(t===void 0)return(e.textContent||"").trim();e.textContent=t,Fe(e,t)},attr(e,t,r){if(r===void 0)return e.hasAttribute&&e.hasAttribute(t)?e.getAttribute(t):null;e.setAttribute(t,r),xe(e,t,r)},removeAttr(e,t){e&&e.removeAttribute&&e.removeAttribute(t),xe(e,t,null)},prop(e,t,r){if(r===void 0){let l=e?e[t]:void 0;return l!==void 0?l:null}e[t]=r},clone(e){let t=e.cloneNode(!0);return Je(t),t},insertAt(e,t,r){let l=e.children[r]||null;e.insertBefore(t,l)},insertBefore(e,t){e.parentNode.insertBefore(t,e)},insertAfter(e,t){e.parentNode.insertBefore(t,e.nextSibling)},identity(e){return e||null},remove(e){e&&e.parentNode&&e.parentNode.removeChild(e)},replaceWith(e,t){if(!e||!e.parentNode)throw new Error("dom.replaceWith: node has no parent");let r=e.ownerDocument.createElement("template");r.innerHTML=t;let l=r.content.firstElementChild;if(!l)throw new Error("dom.replaceWith: html did not parse to an element");return e.parentNode.replaceChild(l,e),l},stripIds(e){let t=0;return e.id&&(e.removeAttribute("id"),t++),(e.querySelectorAll?e.querySelectorAll("[id]"):[]).forEach(r=>{r.removeAttribute("id"),t++}),t},sameNode(e,t){return e===t}};function N(e,t={}){if(t.exclude===null)return E;let r=[J("data"),t.exclude].filter(Boolean).join(", "),l=e.nodeType===9?e:e.ownerDocument||e,n=e.nodeType===9?e.documentElement:e;if(!t._write&&!n?.matches?.(r)&&!n?.querySelector?.(r)&&!l?.querySelector?.(r))return E;let o=e.nodeType===9||!e.isConnected?e:e.ownerDocument,a=e.nodeType===9?e:e.ownerDocument,i=null,u=()=>i||(i=D(o,{capability:"data",exclude:t.exclude||null})),s=f=>{let m=u();return f===e?m.cloneOf(e):m.cloneOf(f)||f},c=f=>i?.original(f)||f,d=(f,m)=>{u().liveToClone.set(f,m),u().cloneToLive.set(m,f);let g=f.childNodes||[],h=m.childNodes||[];for(let y=0;y<Math.min(g.length,h.length);y++)d(g[y],h[y])},p=(f,m,g,h)=>{let y=Array.from(f.childNodes).filter(b=>i.cloneOf(b)),w=y[0];for(;w&&y.includes(w);)w=w.nextSibling;for(let b of y)b.remove();if(g==="innerHTML"){let b=a.createElement("template");b.innerHTML=h;for(let x of Array.from(b.content.childNodes))f.insertBefore(x,w||null)}else f.insertBefore(a.createTextNode(h),w||null),Fe(f,h);let A=D(f,{capability:"data",exclude:t.exclude||null});m.replaceChildren(...Array.from(A.root?.childNodes||[]));let T=b=>{let x=A.original(b);x&&(i.liveToClone.set(x,b),i.cloneToLive.set(b,x));for(let Xe of Array.from(b.childNodes||[]))T(Xe)};for(let b of Array.from(m.childNodes))T(b)},v={...E,find(f,m,g={}){let h=s(f);if(!h?.querySelectorAll)return[];let y=u().query(m,h);g.includeRulesTag||(y=y.filter(T=>!Ve(T)));let w=[];g.skip&&w.push(g.skip);let A=g.templateAttr===null?null:g.templateAttr||"cms-template";if(A&&w.push(`[${A}]`),w.length){let T=w.join(", ");y=y.filter(b=>!b.closest?.(T))}return y},parent(f){let m=s(f)?.parentElement;return m?c(m):null},children(f){return Array.from(s(f)?.children||[],c)},text(f,m){if(m===void 0){let y=c(f);return!y?.matches?.(r)&&!y?.querySelector?.(r)?E.text(y):(s(f)?.textContent||"").trim()}let g=c(f);if(!g?.matches?.(r)&&!g?.querySelector?.(r)&&!i){E.text(g,m);return}let h=u().cloneOf(g);h?p(g,h,"textContent",m):E.text(g,m)},attr(f,m,g){let h=c(f);if(g===void 0)return E.attr(h,m);E.attr(h,m,g);let y=i?.cloneOf(h);y&&(E.attr(y,m,g),D(h,{capability:"data",exclude:t.exclude||null}).root===null&&(y.remove(),i.liveToClone.delete(h),i.cloneToLive.delete(y)))},removeAttr(f,m){let g=c(f);E.removeAttr(g,m);let h=i?.cloneOf(g);h&&E.removeAttr(h,m)},prop(f,m,g){let h=c(f);if(g===void 0)return m==="innerHTML"||m==="outerHTML"||m==="textContent"||m==="innerText"?E.prop(s(h),m):E.prop(h,m);let y=m==="innerHTML"||m==="textContent"||m==="innerText",w=y?u().cloneOf(h):i?.cloneOf(h);w&&y?p(h,w,m,g):(E.prop(h,m,g),w&&E.prop(w,m,g))},clone(f){let m=s(f);if(m===f)return E.clone(f);let g=a.importNode(m,!0);return Je(g),g},insertAt(f,m,g){let h=c(f),y=v.children(h)[g]||(()=>{for(let T=h.children.length-1;T>=0;T--){let b=h.children[T];if(u().cloneOf(b))return b.nextElementSibling}return h.firstElementChild})(),w=c(m);h.insertBefore(w,y||null);let A=u().cloneOf(h);if(A){let T=u().cloneOf(w);T||(T=a.importNode(w,!0),d(w,T));let b=Array.from(A.children);A.insertBefore(T,b[g]||null)}},insertBefore(f,m){let g=c(f),h=c(m);g.parentNode.insertBefore(h,g);let y=u().cloneOf(g.parentNode);if(y){let w=u().cloneOf(h);w||(w=a.importNode(h,!0),d(h,w));let A=u().cloneOf(g);A?A.before(w):y.appendChild(w)}},insertAfter(f,m){let g=c(f),h=c(m);g.parentNode.insertBefore(h,g.nextSibling);let y=u().cloneOf(g.parentNode);if(y){let w=u().cloneOf(h);w||(w=a.importNode(h,!0),d(h,w));let A=u().cloneOf(g);A?A.after(w):y.appendChild(w)}},identity(f){return c(f)||null},remove(f){let m=c(f),g=u().cloneOf(m);E.remove(m),g&&E.remove(g)},replaceWith(f,m){let g=c(f),h=u().cloneOf(g),y=E.replaceWith(g,m);if(h){let w=D(y,{capability:"data",exclude:t.exclude||null});if(!w.root)h.remove();else{h.replaceWith(w.root);let A=T=>{let b=w.original(T);b&&(i.liveToClone.set(b,T),i.cloneToLive.set(T,b));for(let x of Array.from(T.childNodes||[]))A(x)};A(w.root)}}return y}};return v}var P=E,I=e=>({codecs:pt(),...e}),ie={extract:(e,t,r={})=>q(N(e,r),e,t,I(r)),apply:(e,t,r,l={})=>B(N(e,{...l,_write:!0}),e,t,r,I(l)),findRulesIn:(e,t)=>re(P,e,t),findRules:(e,t)=>be(P,e,t),bind:(e,t,r={})=>{let l=be(P,e,t);if(!l){let o=typeof t=="string"?`data-rules-name~="${t}"`:"the provided rules object";throw new Error(`hyper-html-api: could not resolve rules for ${o}`)}let n=I({version:l.version,...r});return{...l,get:()=>q(N(e,r),e,l.rules,n),set:o=>B(N(e,{...r,_write:!0}),e,l.rules,o,n)}},codecs:{register:ft,get:dt},parseStrict:It,parseRelaxed:He,ruleAttrIndex:C,splitRule:$,errors:O,DOM_PROPERTIES:Oe},K=e=>!!e&&typeof e.nodeType=="number";function Ke(e){let t=e&&e.ownerDocument?e.ownerDocument:e,r=re(P,t,"api");if(!r)throw new O.NoRulesTag("api");return{rules:r.rules,version:r.version}}function rr(e){if(e.nodeType===9)return e;let t=e.ownerDocument?.documentElement;if(t?.contains(e))return t;let r=e;for(;r.parentNode;)r=r.parentNode;return r}function nr(e){if(e.nodeType!==11||!e.host)return e.cloneNode(!0);let t=e.ownerDocument.createDocumentFragment();for(let r of e.childNodes)t.appendChild(r.cloneNode(!0));return t}function lr(e,t){let r=[];for(;t!==e;){let l=t.parentNode;r.push(Array.prototype.indexOf.call(l.childNodes,t)),t=l}return r.reverse()}function or(e,t){return t.reduce((r,l)=>r.childNodes[l],e)}function S(e,t){let r=e.querySelectorAll?Array.from(e.querySelectorAll(t)):[];return e.matches?.(t)&&r.unshift(e),r}function ir(e,t){let r=S(e,"option"),l=S(t,"option");r.forEach((u,s)=>l[s].selected=u.selected);let n=S(e,"input"),o=S(t,"input");n.forEach((u,s)=>{let c=u.type.toLowerCase();c!=="file"&&(o[s].value=u.value),(c==="checkbox"||c==="radio")&&(o[s].checked=u.checked)});let a=S(e,"textarea"),i=S(t,"textarea");a.forEach((u,s)=>i[s].value=u.value)}function X(e,t){if(t!==void 0){if(typeof e=="string"){if(e.endsWith("[]"))return;let r=e.startsWith("@")?0:C(e);if(r===-1)return;let l=e.slice(r+1);if(Ne.has(l))throw new O.RuleTargetReadOnly(l);return}if(Array.isArray(e)){if(!Array.isArray(t))return;t.forEach(r=>X(e[1],r));return}if(e&&typeof e=="object"&&t&&typeof t=="object"&&!Array.isArray(t))for(let[r,l]of Object.entries(e))X(l,t[r])}}function ur(e,t,r,l){let n=I({templateAttr:"cms-template",version:l}),o=rr(e),a=lr(o,e),i=nr(o);ir(o,i);let u=or(i,a),s=N(i,{...n,_write:!0}),c=Zt(s,u,t,r,n);if(c.unknownKeys.length||c.unmatched.length)throw new O.WriteRejected(c.unknownKeys,c.unmatched);let d=ve(s);B(d,u,t,r,n),d.assertClean(),X(t,r);let p=ve(N(o,{...n,_write:!0}));B(p,e,t,r,n),p.assertClean()}function ar(e){if(!(e instanceof Error))return e;let t=e instanceof O.UnknownCodec||e instanceof O.CodecRefused?e.code:e.name||"Error";try{e.code=t}catch{Object.defineProperty(e,"code",{value:t,configurable:!0,enumerable:!0})}return e instanceof O.WriteRefused?e.details=e.refusals:e instanceof O.WriteRejected?e.details={unknownKeys:e.unknownKeys,unmatched:e.unmatched}:e instanceof O.ShapeMismatch?e.details=e.mismatches:Array.isArray(e.path)?e.details={path:e.path}:typeof e.target=="string"?e.details={target:e.target}:e.token!==void 0?e.details={token:e.token}:e.version!==void 0?e.details={version:e.version}:e.details={},e}function sr(e,t){let r=K(e)?e:document,l=K(e)?t:e;if(l===void 0){let{rules:n,version:o}=Ke(r);return q(N(r),r,n,I({version:o}))}return ie.bind(r,l).get()}function cr(e,t,r){try{if(!K(e))throw new Error("hyper-html-api: applyData(root, data, source?) needs a DOM root as the first argument.");let{rules:l,version:n}=r===void 0?Ke(e):ie.bind(e,r);ur(e,l,t,n)}catch(l){throw ar(l)}return e}var fr={engine:ie,extractData:sr,applyData:cr},dr=fr;export{ie as a,sr as b,cr as c,dr as d};
|
package/dist/m/c-IJHF4IO6.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as A,b as m,c as n}from"./c-QCDVDZIR.js";import{a as c}from"./c-VKEDWYDF.js";import{f as i}from"./c-C7SUMNMI.js";import{b as l,r as d}from"./c-PNZIJFG7.js";var f="[editmode\\:onclick]";function b(){d(o=>{o.querySelectorAll(f).forEach(t=>{let e=t.getAttribute("onclick");e!==null&&(t.setAttribute("inert-onclick",e),t.removeAttribute("onclick"),n(t,l(t)??t))})})}function p(){i&&c(()=>{E()})}function E(o=document){o.querySelectorAll(f).forEach(t=>{let e=t.getAttribute("inert-onclick");e&&(t.setAttribute("onclick",e),t.removeAttribute("inert-onclick"))})}function D(){document.querySelectorAll(f).forEach(o=>{let t=o.getAttribute("onclick");t&&(o.setAttribute("inert-onclick",t),o.removeAttribute("onclick")),n(o)})}function q(){b(),p()}var O="[viewmode\\:disabled]",S="[viewmode\\:readonly]",u=[[O,"disabled"],[S,"readonly"]];function k(){d(o=>{for(let[t,e]of u)o.querySelectorAll(t).forEach(r=>{if(r.hasAttribute(e))return;let a=l(r),s=a?m(a,e):null;r.setAttribute(e,s===null?"":s),n(r,a??r)})})}function h(){i&&c(()=>{x()})}function x(o=document){for(let[t,e]of u)o.querySelectorAll(t).forEach(r=>{A(r),r.removeAttribute(e)})}function M(){for(let[o,t]of u)document.querySelectorAll(o).forEach(e=>{let r=m(e,t);r===null?e.removeAttribute(t):e.setAttribute(t,r),n(e)})}function P(){k(),h()}export{f as a,E as b,D as c,q as d,O as e,S as f,x as g,M as h,P as i};
|
package/dist/m/c-IUL7PU4P.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as b,b as e}from"./c-UOUUI265.js";import{d as y}from"./c-QHWJ5ZIJ.js";import{c as x}from"./c-SXNSSHPP.js";import{a as T}from"./c-UL2YUY52.js";import{g as H,j as u,n as w,p as N}from"./c-MR75YPRT.js";import{b as h,c as k,e as m}from"./c-5RZNFTWD.js";import{a as v}from"./c-VKEDWYDF.js";function O(t,r,n="",o=!1,l="",a="OK"){let i=y(),c=u("div",["display:flex","flex-direction:column","gap:14px",`font:14.5px/1.55 ${h}`,`color:${m["ink-2"]}`],{theme:i,parts:["dialog.content"],role:"text"}),s=null;o&&(s=N("input",{rules:["display:block","width:100%","margin:0"],theme:i,parts:["dialog.input"]}),s.setAttribute("value",String(l)),s.required=!0,c.append(s)),c.insertAdjacentHTML("beforeend",n),e.title=t,e.html=o||n?c:"",e.width="440px",e[b]=i,e.closeHtml="x",e.no="Cancel",e.yes=a;let d=new Promise((f,g)=>{e.onYes(()=>{let p;if(o&&(p=s.value,!p))return!1;if(r)try{r(p)}catch(C){return x(C.message||"An error occurred","error"),!1}return setTimeout(()=>f(p),0),!0}),e.onNo=()=>{setTimeout(g,0)}});return e.open(),setTimeout(()=>{let f=document.querySelector("[data-clay-modal]");f&&f.addEventListener("click",g=>{let p=g.target.closest("[data-copy]");p&&(T(p.dataset.copy),x("Copied","success"))})},0),d.catch(()=>{}),d}function q(t,r,n="",o=""){return O(t,r,o,!0,n,"OK")}function B(t,r,n=""){return O(t,r,n,!1,"","Confirm")}function F(t,...r){let n=y(),o=u("div",["display:flex","flex-direction:column","gap:12px"],{theme:n,parts:["dialog.content"]});for(let a of r){let i=w("div",[`font:14.5px/1.55 ${h}`,`color:${m["ink-2"]}`,"overflow-wrap:anywhere"],void 0,{theme:n});i.innerHTML=a,o.append(i)}e.title=t,e.html=r.length?o:"",e.width="470px",e[b]=n,e.closeHtml="x",e.yes="OK";let l=new Promise((a,i)=>{e.onYes(()=>(setTimeout(a,0),!0)),e.onNo=()=>{setTimeout(i,0)}});return e.open(),l.catch(()=>{}),l}function R(t,r,n=""){let o=y(),l=u("div",["display:block"],{theme:o,parts:["dialog.content"]}),a=u("div",["display:block","max-width:100%","overflow-x:auto","margin:0 0 14px","padding:14px 16px",`background:${m.sunk}`,`border:1px solid ${m["line-2"]}`],{theme:o,parts:["dialog.well"],role:"well"}),i=w("pre",["display:block","margin:0","white-space:nowrap",`font:13px/1.6 ${k}`],void 0,{theme:o,parts:["dialog.code"],role:"code"});i.innerHTML=r,a.append(i);let c=H("Copy",{small:!0,extra:["margin:0 0 14px"],theme:o,parts:["dialog.button","dialog.copyButton"],labelParts:["dialog.buttonLabel"],onClick:()=>{T(r),x("Copied to clipboard!","success")}});l.append(a,c),l.insertAdjacentHTML("beforeend",n||""),e.title=t,e.html=l,e.width="540px",e[b]=o,e.closeHtml="x",e.yes="";let s=new Promise(d=>{e.onYes(()=>(setTimeout(d,0),!0)),e.onNo=()=>{setTimeout(d,0)}});return e.open(),s}function M(){v(()=>{let t=document.querySelector("[data-clay-modal]");t&&(t.remove(),document.body.style.overflow="")})}M();export{q as a,B as b,F as c,R as d,M as e};
|
package/dist/m/c-JWW6BHWD.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{F as mt,K as ot,O as $e,r as Ie,v as Le,w as ft,x as De}from"./c-GO635CRU.js";import{a as Ae,d as pt,g as Oe,h as ve}from"./c-V2V5FKXX.js";import{f as Pe,o as Re}from"./c-DT7E76Z2.js";import{a as gt,c as Be}from"./c-C6YZNU6E.js";import{C as w,D as zt,E as We,F as Ft,G as Ue,H as Ge,a as _e,d as P,e as S,f as He,h as J,i as ze,m as Fe,p as z,s as Ht,u as Ke,v as Ve,y as je,z as qe}from"./c-AI3H6ETU.js";import{A as y,B as dt,C as we,F as Y,K as Se,L as ht,M as Nt,N as Te,O as Ee,P as Ce,a as be,c as ke,d as g,fa as nt,g as ye,h as xe,u as ut,v as Me,w as N,x as A,y as H,z as I}from"./c-OH2FPYSY.js";import{b as Ne}from"./c-FSQXFG5T.js";import{b as C,d as Pt,f as at,g as ge,h as Rt}from"./c-RETTCOWO.js";import{a as R}from"./c-WCG6AKA7.js";var Ye=new WeakMap;function Je(n){let t=Ye.get(n);if(t)return t;t={};for(let[e,o]of I(n.attrs.cols).entries()){let s=[];n.forEach(r=>{e<r.childCount&&s.push(r.child(e).textContent.trim())}),t[o]=Ee(n.attrs.cols[o].kind,s)}return Ye.set(n,t),t}var Cs=Object.freeze({text:"Aa",number:"#",date:"\u{1F4C5}"}),As=Object.freeze({text:"Text",number:"Number",date:"Date"});var Kt=(n,t,e)=>{let o=n.attrs.get(t.baseId),s={};for(let r of Oe(e))s[r]=o&&o.has(r)?o.get(r):ve(e,r);return e.name==="board"&&Object.assign(s,Le(n.boardFields,t.baseId)),e.name==="table"&&Object.assign(s,Ie(n.tableFields,t.baseId,{cols:s.cols,rows:s.rows})),s},Xe=n=>n===void 0?n:JSON.parse(JSON.stringify(n)),qn=(n,t)=>{let e={},o=n.attrs.get(t.baseId);return o&&o.forEach((s,r)=>{r!=="pos"&&(e[r]=Xe(s))}),e.t=t.t,e};function Bs(n,t,e=null){let o=d=>{if(d.opaque){let a=d.recovered?{...Xe(d.fields??{})}:qn(n,d);return{b:d,type:g.nodes.opaque_block,fields:a,opaque:!0}}let u=g.nodes[d.t]??g.nodes.paragraph;return{b:d,type:u,fields:{...d.fields??Kt(n,d,u)}}},s=t.visible.map(d=>{let u=e?.get(d);return u?{b:d,node:u}:o(d)}),r=new Map(s.map((d,u)=>[d.b.id,u])),i=d=>s[d].node?s[d].node.attrs.parent:s[d].fields.parent,l=d=>(d.b.recovered?n.gone._map.get(mt(d.b.sourceKey,"parent")):n.attrs.get(d.b.baseId)?._map.get("parent"))?.id??{clock:-1,client:-1};for(let d of r.keys()){let u=new Map,a=[],h=d;for(;r.has(h)&&!u.has(h);)u.set(h,a.length),a.push(h),h=i(r.get(h));if(!u.has(h))continue;let f=a.slice(u.get(h)).reduce((b,x)=>{let O=l(s[r.get(b)]),_=l(s[r.get(x)]);return O.clock<_.clock||O.clock===_.clock&&O.client<_.client?b:x}),m=r.get(f);s[m].node&&(s[m]=o(s[m].b)),s[m].fields.parent=null}let c=s.map(({b:d,node:u,type:a,fields:h,opaque:p})=>{if(u)return u;if(p){let b=[];for(let x of d.runs)x.hole||(x.br?b.push(g.nodes.hard_break.create()):b.push(g.text(x.text,x.marks)));return a.create({id:d.id,pos:null,raw:h},b)}let f={id:d.id,pos:null,...h};if(a.name==="table"&&Object.keys(f.rows??{}).length&&Object.keys(f.cols??{}).length)return Y(g,d.id,{t:"table",...f});if(!a.isTextblock)return a.create(f);let m=[];for(let b of d.runs)b.hole||(b.br?m.push(g.nodes.hard_break.create()):m.push(g.text(b.text,b.marks)));return a.create(f,m)});return c.length?g.nodes.doc.create(null,c):g.nodes.doc.createAndFill()}var E=n=>({status:"refused",code:n}),bt=n=>JSON.parse(JSON.stringify(n)),Wn=["title","owner","due"],Un=/^\d{4}-\d{2}-\d{2}$/,kt=(n,t)=>n==="title"?typeof t=="string":n==="due"?t===null||typeof t=="string"&&Un.test(t):t===null||typeof t=="string"&&t.length>0,Gn=n=>n!==null&&typeof n=="object"&&!Array.isArray(n);function Qe(n,t){let e=t>0?n[t-1]:null,o=n.slice(t).find(r=>e===null||r>e)??null,s=r=>(e===null||r>e)&&(o===null||r<o);for(let[r,i]of[[e,o],[null,o],[e,null]]){if(r!==null&&!N(r)||i!==null&&!N(i)||r!==null&&i!==null&&r>=i)continue;let l=A(r,i);if(s(l))return l}return`${n.reduce((r,i)=>i>r?i:r,"")}V`}function Vt(n,t,e){let o=n.map(t),s=e>0?o[e-1]:null,r=e;for(;s!==null&&r<o.length&&o[r]===s;)r++;if(r===e)return{pos:Qe(o,e),rekey:[]};let i=o.slice(r).find(c=>c>s)??null,l=[];for(let c=e,d=s;c<=r;c++)l.push(d=Qe(i===null?[d]:[d,i],1));return{pos:l[0],rekey:n.slice(e,r).map((c,d)=>[c,l[d+1]])}}var yt=(n,t,e)=>{let{pos:o,rekey:s}=Vt(t,r=>n[r].pos,e);for(let[r,i]of s)n[r]={...n[r],pos:i};return o};function qs({pd:n,um:t=null,origins:e=null,render:o=()=>{}}){let s=u=>{if(typeof u!="string")return null;let a=$e(n,e).visible.find(p=>p.id===u);if(!a||a.t!=="board")return null;let h=a.fields??Kt(n,a,g.nodes.board);return{columns:bt(h.columns??{}),cards:bt(h.cards??{})}},r=(u,a,h,p)=>{let f=ot(u);return t?.stopCapturing(),n.ydoc.transact(()=>{if(!f)De(n,u,a,h);else for(let m of["columns","cards"])nt(a[m])!==nt(h[m])&&n.gone.set(mt(f,m),bt(h[m]))},Ae),t?.stopCapturing(),o(),p},i=(u,a,h=null)=>I(Object.fromEntries(Object.entries(u.cards).filter(([p,f])=>f.col===a&&p!==h))),l=(u,a)=>a===void 0?u.length:a===null?0:u.indexOf(a)+1,c=(u,a)=>a!=null&&!u.includes(a),d=(u,a)=>{let h=s(u);return h?a(h,bt(h)):E("missing-board")};return{read:u=>s(u),removed(u){return s(u)?ot(u)?{columns:{},cards:{}}:ft(n.boardFields,u):null},createColumn:(u,{name:a="",afterId:h}={})=>d(u,(p,f)=>{if(typeof a!="string")return E("invalid-value");let m=I(p.columns);if(c(m,h))return E("missing-destination");let b=y("c");return f.columns[b]={pos:yt(f.columns,m,l(m,h)),name:a},r(u,p,f,{status:"created",id:b})}),renameColumn:(u,a,h)=>d(u,(p,f)=>Object.hasOwn(p.columns,a)?typeof h!="string"?E("invalid-value"):p.columns[a].name===h?{status:"unchanged"}:(f.columns[a].name=h,r(u,p,f,{status:"changed"})):E("missing-column")),moveColumn:(u,a,{afterId:h=null}={})=>d(u,(p,f)=>{if(!Object.hasOwn(p.columns,a))return E("missing-column");let m=I(p.columns).filter(O=>O!==a);if(c(m,h))return E("missing-destination");let b=l(m,h),x=I(p.columns);return[...m.slice(0,b),a,...m.slice(b)].every((O,_)=>O===x[_])?{status:"unchanged"}:(f.columns[a].pos=yt(f.columns,m,b),r(u,p,f,{status:"moved"}))}),removeColumn:(u,a)=>d(u,(h,p)=>Object.hasOwn(h.columns,a)?(delete p.columns[a],r(u,h,p,{status:"removed",cards:i(h,a).length})):E("missing-column")),restoreColumn:(u,a)=>d(u,(h,p)=>{if(Object.hasOwn(h.columns,a))return{status:"unchanged"};let f=ot(u)?null:ft(n.boardFields,u).columns[a];return f?(p.columns[a]=f,r(u,h,p,{status:"restored"})):E("missing-column")}),createCard:(u,{columnId:a,title:h="",owner:p=null,due:f=null,afterId:m}={})=>d(u,(b,x)=>{if(!Object.hasOwn(b.columns,a))return E("missing-column");if(!kt("title",h)||!kt("owner",p)||!kt("due",f))return E("invalid-value");let O=i(b,a);if(c(O,m))return E("missing-destination");let _=y("k");return x.cards[_]={pos:yt(x.cards,O,l(O,m)),col:a,title:h,...p!==null?{owner:p}:{},...f!==null?{due:f}:{}},r(u,b,x,{status:"created",id:_})}),editCard:(u,a,h)=>d(u,(p,f)=>{if(!Object.hasOwn(p.cards,a))return E("missing-card");if(!Gn(h)||!Object.keys(h).length||Object.keys(h).some(b=>!Wn.includes(b)))return E("invalid-field");if(Object.entries(h).some(([b,x])=>!kt(b,x)))return E("invalid-value");let m={...p.cards[a]};for(let[b,x]of Object.entries(h))x===null?delete m[b]:m[b]=x;return nt(m)===nt(p.cards[a])?{status:"unchanged"}:(f.cards[a]=m,r(u,p,f,{status:"changed"}))}),moveCard:(u,a,{columnId:h,afterId:p=null}={})=>d(u,(f,m)=>{if(!Object.hasOwn(f.cards,a))return E("missing-card");if(!Object.hasOwn(f.columns,h))return E("missing-column");let b=i(f,h,a);if(c(b,p))return E("missing-destination");let x=l(b,p),O=f.cards[a];if(O.col===h){let _=i(f,h);if([...b.slice(0,x),a,...b.slice(x)].every((ct,jn)=>ct===_[jn]))return{status:"unchanged"}}return m.cards[a]={...O,col:h,pos:yt(m.cards,b,x)},r(u,f,m,{status:"moved"})}),removeCard:(u,a)=>d(u,(h,p)=>Object.hasOwn(h.cards,a)?(delete p.cards[a],r(u,h,p,{status:"removed"})):E("missing-card")),restoreCard:(u,a)=>d(u,(h,p)=>{if(Object.hasOwn(h.cards,a))return{status:"unchanged"};let f=ot(u)?null:ft(n.boardFields,u).cards[a];return f?(p.cards[a]=f,r(u,h,p,{status:"restored"})):E("missing-card")})}}var xt="blockeditor-history-intent",Yn=500,Jn=(n,t)=>{let e=n.resolve(t);return e.depth?e.node(1).attrs.id:null},Xn=n=>(n.storedMarks??n.selection.$from.marks()).map(t=>`${t.type.name}:${JSON.stringify(t.attrs)}`).sort().join(",");function qt(n,t,e,o){return{kind:"insert",blockId:Jn(n.doc,t),from:t,end:t+o.length,replaced:t!==e,text:o,marks:Xn(n),at:Date.now()}}function Ys(n,t){return!n||!t||n.kind!==t.kind?!1:t.kind==="compose"?n.id===t.id:n.blockId!==t.blockId||t.at-n.at>Yn?!1:t.kind==="insert"?!t.replaced&&t.from===n.end&&t.marks===n.marks&&!(/\s$/.test(n.text)&&/^\S/.test(t.text)):t.direction===n.direction&&(t.direction<0?t.to===n.from:t.from===n.from)}var Qn={deleteContentBackward:-1,deleteContentForward:1},jt=new WeakMap,Zn=1e3,Wt="blockeditor-derived";function to(n){let t=jt.get(n)??null;return jt.delete(n),t}function eo(n,t){if(!t||n.before!==t.doc||Date.now()-t.at>Zn||n.getMeta(He)||n.steps.length!==1)return null;let e=n.steps[0];if(e.slice?.size!==0||e.from===e.to)return null;let o=n.before.resolve(e.from),s=n.before.resolve(e.to);return!o.parent.isTextblock||!o.sameParent(s)?null:{kind:"delete",blockId:o.depth?o.node(1).attrs.id:null,direction:t.direction,from:e.from,to:e.to,at:t.at}}function Js(n,t=null){let e=t?to(t):null,o=n.filter(i=>!i.getMeta(Wt));if(o.length!==1)return null;let s=o[0],r=s.getMeta("composition");return r!=null?{kind:"compose",id:r,at:Date.now()}:s.getMeta(xt)??eo(s,e)}function Xs(){return new C.Plugin({props:{handleTextInput(n,t,e,o,s){return n.dispatch(s().setMeta(xt,qt(n.state,t,e,o))),!0},handleDOMEvents:{beforeinput(n,t){let e=Qn[t.inputType];return e&&jt.set(n,{direction:e,at:Date.now(),doc:n.state.doc}),!1}}}})}function no(n,t){if(!n||!/<table[\s>]/i.test(n))return null;let e=t.defaultView?.DOMParser??globalThis.DOMParser;if(!e)return null;let o=new e().parseFromString(n,"text/html").body,s=[...o.querySelectorAll("table")].filter(d=>!d.parentElement.closest("table"));if(s.length!==1)return null;let r=o.cloneNode(!0);for(let d of r.querySelectorAll("table, style, script, template, meta, title"))d.remove();if(r.textContent.trim())return null;let i=s[0];return{grid:[...i.querySelectorAll("tr")].filter(d=>d.closest("table")===i).map(d=>[...d.children].filter(u=>u.tagName==="TD"||u.tagName==="TH").map(u=>dt(je.parse(u,{topNode:g.nodes.table_cell.create()})))).filter(d=>d.length),own:!!i.querySelector("td[data-col]")}}function oo(n){if(!n||!n.includes(" "))return null;let{header:t,rows:e}=ht(n.replace(/\r?\n$/,""),{delimiter:" "});return{grid:[t,...e],own:!1}}function Ze(n,t,e=globalThis.document){let o=null;try{o=no(n,e)}catch{o=null}if(!o&&!/<table[\s>]/i.test(n||""))try{o=oo(t)}catch{o=null}if(!o||!o.grid.length)return null;let s=Math.max(...o.grid.map(r=>r.length));for(let r of o.grid)for(;r.length<s;)r.push("");return{...o,width:s,height:o.grid.length}}function Mt(n,{header:t=n.length>1}={}){let e=Math.max(0,...n.map(a=>a.length));if(!e)return null;let o=t?n[0]:[],s=t?n.slice(1):n,r=Array.from({length:e},()=>y("c")),i=H(null,null,e),l=Object.fromEntries(r.map((a,h)=>[a,{pos:i[h],name:ut(o[h]??"").replace(/\s+/g," ").trim()||`Column ${h+1}`}])),c=s.length?s:[[]],d=H(null,null,c.length),u=Object.fromEntries(c.map((a,h)=>[y("r"),{pos:d[h],cells:Object.fromEntries(r.map((p,f)=>[p,a[f]??""]))}]));return Y(g,y(),{t:"table",pos:null,cols:l,rows:u})}var{Plugin:so,TextSelection:ro}=C,Ut=g.nodes;var on=(n,t)=>{let e=null;return n.forEach((o,s)=>{!e&&o.type===Ut.table&&o.attrs.id===t&&(e={node:o,pos:s})}),e};function V(n,t){if(!t)return null;let e=on(n,t.table);if(!e)return null;let o=[];e.node.forEach(p=>o.push(p.attrs.id));let s=I(e.node.attrs.cols),r=[o.indexOf(t.anchor[0]),o.indexOf(t.head[0])],i=[s.indexOf(t.anchor[1]),s.indexOf(t.head[1])];if(r.includes(-1)||i.includes(-1))return null;let l=Math.min(...r),c=Math.max(...r),d=Math.min(...i),u=Math.max(...i),a=[],h=e.pos+1;return e.node.forEach((p,f,m)=>{if(m>=l&&m<=c){let b=[],x=h+1;p.forEach((O,_,ct)=>{ct>=d&&ct<=u&&b.push({cell:O,pos:x}),x+=O.nodeSize}),a.push(b)}h+=p.nodeSize}),{...e,top:l,bottom:c,left:d,right:u,cells:a}}var st=(n,t)=>{let e=n.resolve(t);for(let o=e.depth;o>0;o--)if(e.node(o).type===Ut.table_cell&&o>=3)return{table:e.node(o-2).attrs.id,row:e.node(o-1).attrs.id,col:e.node(o).attrs.col,start:e.start(o)};return null};function wt(n,t,e){let o=st(n.state.doc,t),s=st(n.state.doc,e);if(!o||!s||o.table!==s.table)return!1;let r={table:o.table,anchor:[o.row,o.col],head:[s.row,s.col]},i=n.state.tr.setSelection(ro.create(n.state.doc,s.start)).setMeta(S,r);n.dispatch(i);let l=V(n.state.doc,r),c=l?(l.bottom-l.top+1)*(l.right-l.left+1):0;return P(n,`${c} ${c===1?"cell":"cells"} selected`),!0}function fr(n,t,e,o){let s=n.state.doc.nodeAt(t);if(s?.type!==Ut.table||!s.childCount)return!1;let r=s.childCount-1,i=s.child(0).childCount-1,l=(c,d)=>{let u=t+1;for(let a=0;a<c;a++)u+=s.child(a).nodeSize;u++;for(let a=0;a<d;a++)u+=s.child(c).child(a).nodeSize;return u+1};return e==="row"?wt(n,l(o,0),l(o,i)):wt(n,l(0,o),l(r,o))}var io=new Set(["Shift","Control","Alt","Meta","CapsLock"]),lo=n=>/[\t\n\r"]/.test(n)?`"${n.replace(/"/g,'""')}"`:n;function co(n,t){let e=n.cells.map(r=>r.map(({cell:i})=>lo(ut(dt(i)))).join(" ")).join(`
|
|
2
|
-
`),o=t.createElement("table"),s=o.appendChild(t.createElement("tbody"));for(let r of n.cells){let i=s.appendChild(t.createElement("tr"));for(let{cell:l}of r){let c=i.appendChild(t.createElement("td"));c.dataset.col=l.attrs.col,c.append(qe.serializeFragment(l.content,{document:t}))}}return{text:e,html:o.outerHTML}}function tn(n,t){let e=V(n.doc,S.getState(n));if(!e)return!1;if(t){let o=n.tr;for(let s of[...e.cells].reverse())for(let{cell:r,pos:i}of[...s].reverse())r.content.size&&o.delete(i+1,i+r.nodeSize-1);o.setMeta(S,S.getState(n)),t(w(o))}return!0}var en=(n,t,e)=>{let{text:o,html:s}=co(t,e.dom.ownerDocument);n.clipboardData.setData("text/plain",o),n.clipboardData.setData("text/html",s),n.preventDefault()},ao=(n,t)=>(e,o,s)=>{let r=S.getState(e),i=V(e.doc,r);if(!i||!s)return!1;let l=[],c=I(i.node.attrs.cols);i.node.forEach(a=>l.push(a.attrs.id));let d=Math.max(0,Math.min(l.length-1,l.indexOf(r.head[0])+n)),u=Math.max(0,Math.min(c.length-1,c.indexOf(r.head[1])+t));return o&&o(e.tr.setMeta(S,{...r,head:[l[d],c[u]]})),!0},nn=(n,t)=>{let e=t.target?.closest?.("td");if(!e||!n.dom.contains(e))return null;try{return n.posAtDOM(e,0)}catch{return null}};function mr(){let n=null;return new so({key:S,state:{init:()=>null,apply(t,e,o,s){let r=t.getMeta(S);return r!==void 0?r:!e||t.selectionSet||t.docChanged&&!t.getMeta(pt)?null:V(s.doc,e)?e:null}},props:{attributes:t=>S.getState(t)?{class:"has-cell-rect"}:{},createSelectionBetween:t=>S.getState(t.state)?t.state.selection:null,decorations(t){let e=V(t.doc,S.getState(t));return e?Pt.DecorationSet.create(t.doc,e.cells.flat().map(({cell:o,pos:s})=>Pt.Decoration.node(s,s+o.nodeSize,{class:"is-cell-selected"}))):null},handleKeyDown(t,e){let o=t.state;if(!S.getState(o))return!1;if(e.key==="Escape")return t.dispatch(o.tr.setMeta(S,null)),!0;if(e.key==="Backspace"||e.key==="Delete")return tn(o,t.dispatch);if(e.shiftKey){let s={ArrowUp:[-1,0],ArrowDown:[1,0],ArrowLeft:[0,-1],ArrowRight:[0,1]}[e.key];if(s)return ao(...s)(o,t.dispatch,t)}return io.has(e.key)||(e.metaKey||e.ctrlKey)&&(e.key==="a"||e.key==="c"||e.key==="x"||e.key==="v")||t.dispatch(o.tr.setMeta(S,null)),!1},handleDOMEvents:{mousedown(t,e){if(e.button!==0)return!1;!e.shiftKey&&S.getState(t.state)&&t.dispatch(t.state.tr.setMeta(S,null));let o=nn(t,e);if(o===null)return!1;if(e.shiftKey){let c=S.getState(t.state),d=(c&&uo(t.state.doc,c))??t.state.selection.$anchor.pos;return st(t.state.doc,d)?(e.preventDefault(),wt(t,d,o)):!1}let s=t.dom.ownerDocument,r=o,i=c=>{let d=nn(t,c);if(d===null)return;let u=st(t.state.doc,r),a=st(t.state.doc,d);if(!u||!a||u.table!==a.table)return;let h=S.getState(t.state);u.row===a.row&&u.col===a.col&&!h||h&&h.head[0]===a.row&&h.head[1]===a.col||(c.preventDefault(),wt(t,r,d))},l=()=>{s.removeEventListener("mouseover",i),s.removeEventListener("mouseup",l),n=null};return n?.(),n=l,s.addEventListener("mouseover",i),s.addEventListener("mouseup",l),!1},copy(t,e){let o=V(t.state.doc,S.getState(t.state));return!o||!e.clipboardData?!1:(en(e,o,t),!0)},cut(t,e){let o=V(t.state.doc,S.getState(t.state));return!o||!e.clipboardData?!1:(en(e,o,t),tn(t.state,t.dispatch),!0)}}},view:()=>({destroy:()=>n?.()})})}function uo(n,t){let e=on(n,t.table),o=null;return e?.node.forEach((s,r)=>{if(s.attrs.id!==t.anchor[0])return;let i=e.pos+1+r+1;s.forEach(l=>{l.attrs.col===t.anchor[1]&&(o=i+1),i+=l.nodeSize})}),o}var sn=n=>{let t=V(n.doc,S.getState(n));return t?{row:t.top,cell:t.left,rows:t.bottom-t.top+1,cols:t.right-t.left+1}:null};var Gt=new WeakMap;var{Plugin:ho,TextSelection:j}=C,T=g.nodes,Jt=256*1024,B=n=>I(n.attrs.cols),rn=n=>{let t=n.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type===T.table){let o=t.node(e),s=e<t.depth?t.index(e):0,r=e+1<t.depth?t.index(e+1):0;return{table:o,pos:t.before(e),row:s,cell:r}}return null},rt=(n,t,e,o)=>{let s=n.nodeAt(t);if(!s||!s.childCount)return null;e=Math.max(0,Math.min(e,s.childCount-1)),o=Math.max(0,Math.min(o,s.child(e).childCount-1));let r=t+1;for(let i=0;i<e;i++)r+=s.child(i).nodeSize;r++;for(let i=0;i<o;i++)r+=s.child(e).child(i).nodeSize;return r+1},St=(n,t=A())=>T.table_row.create({id:y("r"),pos:t},n.map(e=>T.table_cell.create({col:e}))),L=(n,t,e)=>T.table.create({...n.attrs,...t},e);function D(n,t,e){let o=rn(n);if(!o)return!1;let s=e(o.table,o);if(!s)return!1;if(t){let{table:r,row:i=o.row,cell:l=o.cell}=s,c=n.tr.replaceWith(o.pos,o.pos+o.table.nodeSize,r),d=rt(c.doc,o.pos,i,l);d!==null&&c.setSelection(j.create(c.doc,d)),t(w(c))}return!0}function F(n,t,e,o=null,s=null,r=null){r??=o?n.doc.resolve(o.from).index(0):n.selection.$head.index(0);let i=n.doc.child(r),l=0;for(let h=0;h<r;h++)l+=n.doc.child(h).nodeSize;let c=i.isTextblock&&(i.content.size===0||o?.from===l+1&&o?.to===l+i.nodeSize-1),d=n.doc.maybeChild(r+1),u=c?i.attrs.pos:A(i.attrs.pos,d?.attrs.pos??null),a=e.type.create({...e.attrs,pos:u,parent:i.attrs.parent??null},e.content);if(t){let h=n.tr;o&&h.delete(o.from,o.to);let p=h.mapping.map(l),f=h.doc.child(r),m=c?p:p+f.nodeSize;if(h.replaceWith(m,c?p+f.nodeSize:m,a),s){let b=s.type.create({...s.attrs,pos:A(u,d?.attrs.pos??null),parent:i.attrs.parent??null},s.content);h.insert(m+a.nodeSize,b)}h.setSelection(j.create(h.doc,rt(h.doc,m,0,0))),t(w(h).scrollIntoView())}return!0}function ln(n=3,t=3){if(!Number.isInteger(n)||!Number.isInteger(t)||n<1||t<1)return null;let e=Array.from({length:t},()=>y("c")),o=H(null,null,t),s=Object.fromEntries(e.map((l,c)=>[l,{pos:o[c],name:`Column ${c+1}`}])),i=H(null,null,n).map(l=>St(e,l));return T.table.create({id:y(),cols:s},i)}var Xt=n=>(t,e)=>{let o=rn(t);if(!o||t.selection.$head.parent.type!==T.table_cell)return!1;let s=o.table.child(o.row).childCount,r=o.row,i=o.cell;return n==="down"?r++:(i+=n,i>=s&&(r++,i=0),i<0&&(r--,i=s-1)),r<0?!0:r>=o.table.childCount?n===-1?!0:po(t,e,o,i):(e&&e(t.tr.setSelection(j.create(t.doc,rt(t.doc,o.pos,r,i))).scrollIntoView()),!0)};function po(n,t,e,o){let s=[...e.table.content.content];if(s.push(St(B(e.table),A(s.at(-1).attrs.pos,null))),t){let r=n.tr.replaceWith(e.pos,e.pos+e.table.nodeSize,L(e.table,{sort:null},s));r.setSelection(j.create(r.doc,rt(r.doc,e.pos,s.length-1,o))),t(w(r).scrollIntoView())}return!0}var fo=Xt(1),mo=Xt(-1),go=Xt("down"),bo=(n=!0)=>(t,e)=>D(t,e,(o,s)=>{let r=[...o.content.content],i=s.row+(n?1:0),l=A(r[i-1]?.attrs.pos??null,r[i]?.attrs.pos??null);return r.splice(i,0,St(B(o),l)),{table:L(o,{sort:null},r),row:i}}),Lr=(n,t)=>D(n,t,(e,o)=>{let s=[...e.content.content];if(s.length===1){let r=s[0];s[0]=T.table_row.create(r.attrs,B(e).map(i=>T.table_cell.create({col:i})))}else s.splice(o.row,1);return{table:L(e,{sort:null},s),row:Math.min(o.row,s.length-1)}}),cn=(n,t,e,o,s)=>{let{pos:r,rekey:i}=Vt(t,c=>n[c]?.pos??"",e),l={...n,[o]:{...s,pos:r}};for(let[c,d]of i)l[c]={...l[c],pos:d};return l},Dr=(n=!0)=>(t,e)=>D(t,e,(o,s)=>{let r=B(o),i=s.cell+(n?1:0),l=y("c"),c=cn(o.attrs.cols,r,i,l,{name:`Column ${r.length+1}`}),d=o.content.content.map(u=>{let a=[...u.content.content];return a.splice(i,0,T.table_cell.create({col:l})),T.table_row.create(u.attrs,a)});return{table:L(o,{cols:c},d),cell:i}}),$r=(n,t)=>D(n,t,(e,o)=>{let s=B(e);if(s.length<=1)return null;let r={...e.attrs.cols};delete r[s[o.cell]];let i=e.content.content.map(l=>T.table_row.create(l.attrs,l.content.content.filter((c,d)=>d!==o.cell)));return{table:L(e,{cols:r,sort:e.attrs.sort?.col===s[o.cell]?null:e.attrs.sort},i),cell:Math.min(o.cell,s.length-2)}}),_r=n=>(t,e)=>D(t,e,(o,s)=>{let r=s.row+n;if(r<0||r>=o.childCount)return null;let i=[...o.content.content],[l]=i.splice(s.row,1);i.splice(r,0,l);let c=A(i[r-1]?.attrs.pos??null,i[r+1]?.attrs.pos??null);return i[r]=T.table_row.create({...l.attrs,pos:c},l.content),{table:L(o,{sort:null},i),row:r}}),Br=n=>(t,e)=>D(t,e,(o,s)=>{let r=B(o),i=s.cell+n;if(i<0||i>=r.length)return null;let l=[...r],[c]=l.splice(s.cell,1);l.splice(i,0,c);let d=cn(o.attrs.cols,l.filter(a=>a!==c),i,c,o.attrs.cols[c]),u=o.content.content.map(a=>{let h=[...a.content.content],[p]=h.splice(s.cell,1);return h.splice(i,0,p),T.table_row.create(a.attrs,h)});return{table:L(o,{cols:d},u),cell:i}}),ko=48,yo=1200,Pr=160,an=n=>Number.isFinite(n)&&n>0?Math.round(Math.min(yo,Math.max(ko,n))):null,Rr=n=>(t,e)=>D(t,e,o=>{let s=B(o);if(!s.some(i=>o.attrs.cols[i].width))return null;let r={};for(let i of s){let{width:l,...c}=o.attrs.cols[i];r[i]=c}return{table:L(o,{cols:r},o.content),cell:Math.max(0,s.indexOf(n))}}),Nr=(n,t)=>(e,o)=>D(e,o,s=>{let r={...s.attrs.cols},i=!1;for(let[l,c]of Object.entries(n)){let d=an(c);!r[l]||d===null||r[l].width===d||(r[l]={...r[l],width:d},i=!0)}return i?{table:L(s,{cols:r},s.content),cell:B(s).indexOf(t)}:null}),Hr=(n,t)=>(e,o)=>D(e,o,s=>{let r=s.attrs.cols[n];if(!r)return null;let i=t===null?null:an(t);if(t!==null&&i===null||(r.width??null)===i)return null;let{width:l,...c}=r,d={...s.attrs.cols,[n]:i===null?c:{...r,width:i}};return{table:L(s,{cols:d},s.content),cell:B(s).indexOf(n)}}),zr=(n,t)=>(e,o)=>D(e,o,s=>{if(!s.attrs.cols[n]||!String(t).trim())return null;let r={...s.attrs.cols,[n]:{...s.attrs.cols[n],name:String(t).trim()}};return{table:L(s,{cols:r},s.content)}}),Fr=(n,t)=>(e,o)=>D(e,o,s=>{if(!s.attrs.cols[n]||!(t==="auto"||Te.includes(t)))return null;let{kind:r,...i}=s.attrs.cols[n],l={...s.attrs.cols,[n]:t==="auto"?i:{...s.attrs.cols[n],kind:t}};return{table:L(s,{cols:l,sort:s.attrs.sort?.col===n?null:s.attrs.sort},s.content)}}),Kr=(n,t="asc")=>(e,o)=>D(e,o,s=>{if(!s.attrs.cols[n]||!["asc","desc"].includes(t))return null;let r=B(s).indexOf(n),i=Je(s)[n],l=[...s.content.content].map((u,a)=>({row:u,previous:a,text:u.child(r).textContent.trim()}));l.sort((u,a)=>{if(!u.text||!a.text)return!u.text&&!a.text?u.previous-a.previous:u.text?-1:1;let h=i==="number"?Nt(u.text):u.text,p=i==="number"?Nt(a.text):a.text;if(h==null||p==null)return h==null&&p==null?u.previous-a.previous:h==null?1:-1;let f=i==="number"?h-p:i==="date"?h<p?-1:h>p?1:0:h.localeCompare(p,void 0,{numeric:!0,sensitivity:"base"});return f?t==="asc"?f:-f:u.previous-a.previous});let c=H(null,null,l.length),d=l.map(({row:u},a)=>T.table_row.create({...u.attrs,pos:c[a]},u.content));return{table:L(s,{sort:{col:n,dir:t}},d)}}),Yt=(n,t=null)=>(e,o)=>D(e,o,(s,r)=>{let i=B(s),l=t?.row??r.row,c=t?.cell??r.cell,d=[...s.content.content];n.forEach((a,h)=>{let p=l+h;p>=d.length&&d.push(St(i,A(d.at(-1).attrs.pos,null)));let f=[...d[p].content.content];a.forEach((m,b)=>{c+b<i.length&&(f[c+b]=T.table_cell.create({col:i[c+b]},we(g,m)))}),d[p]=T.table_row.create(d[p].attrs,f)});let u=Math.max(1,...n.map(a=>a.length));return{table:L(s,{sort:null},d),row:l+n.length-1,cell:Math.min(c+u-1,i.length-1)}}),xo=n=>new TextEncoder().encode(JSON.stringify(n.toJSON())).length;function Mo(n,t){let e=t.clipboardData;if(!e||e.files?.length)return!1;let o=n.state;if(o.selection.$from.parent.type.spec.code)return!1;let s=sn(o),r=e.getData("text/plain").replace(/\r?\n$/,""),i=Ze(e.getData("text/html"),e.getData("text/plain"),n.dom.ownerDocument)??(s&&r&&!/[\r\n]/.test(r)?{grid:[[r]],width:1,height:1,own:!1}:null);if(!i)return!1;if(s&&s.rows*s.cols>1&&i.width*i.height===1)return Yt(Array.from({length:s.rows},()=>Array(s.cols).fill(i.grid[0][0])),{row:s.row,cell:s.cell})(o,n.dispatch);if(s)return Yt(i.grid,{row:s.row,cell:s.cell})(o,n.dispatch);if(o.selection.$head.parent.type===T.table_cell)return i.width*i.height<2?!1:Yt(i.grid)(o,n.dispatch);if(i.width*i.height<2||i.own||i.height<2&&!/<table[\s>]/i.test(e.getData("text/html")))return!1;let l=Mt(i.grid,{header:i.height>1});if(!l)return!1;if(xo(l)>Jt)return R("This paste is too large for one table.","error"),!0;let{from:c,to:d,empty:u,$from:a,$to:h}=o.selection;if(!u&&a.index(0)!==h.index(0)){let p=o.tr.deleteSelection();return F(o.apply(p),f=>{for(let m of f.steps)p.step(m);p.setSelection(j.create(p.doc,f.selection.from)),n.dispatch(w(p).scrollIntoView())},l)}return F(o,n.dispatch,l,u?null:{from:c,to:d})}var Vr=at.keymap({Tab:fo,"Shift-Tab":mo,Enter:go,"Mod-Enter":bo(!0)});function wo(n,t){let e=Gt.get(t.target),o=e?.getPos();if(o==null||t.button||t.shiftKey||!n.editable)return!1;t.preventDefault();let s=t.clientX<e.contentDOM.getBoundingClientRect().left;return n.dispatch(n.state.tr.setSelection(j.create(n.state.doc,o+1+(s?0:e.node.content.size)))),n.focus(),e.openDate(),!0}function jr(){return new ho({props:{handlePaste:Mo,handleDOMEvents:{mousedown:wo},handleClickOn(n,t,e,o,s,r){if(e.type!==T.table_cell||!r||s.button)return!1;let i=n.nodeDOM(o),l=i&&Gt.get(i);return l&&l.openDate(),!1}},appendTransaction(n,t,e){if(!n.some(r=>r.docChanged&&!r.getMeta(pt)))return null;let o=new Map;t.doc.forEach(r=>{r.type===T.table&&o.set(r.attrs.id,r)});let s=e.tr;return e.doc.forEach((r,i)=>{if(r.type!==T.table||!r.attrs.sort)return;let l=o.get(r.attrs.id),c=r.attrs.sort.col;if(!l)return;let d=h=>Object.fromEntries(h.content.content.map(p=>[p.attrs.id,p.content.content.find(f=>f.attrs.col===c)?.textContent])),u=d(l),a=d(r);(Object.keys(u).length!==Object.keys(a).length||Object.keys(u).some(h=>u[h]!==a[h]||!Object.hasOwn(a,h)))&&s.setNodeMarkup(i,null,{...r.attrs,sort:null})}),s.docChanged?s.setMeta(Wt,!0):null}})}function qr(n,t,e){let o=n.state.doc.nodeAt(t);if(o?.type!==T.table_cell)return!1;let s=n.state.tr.replaceWith(t+1,t+o.nodeSize-1,e?g.text(e):[]);return n.dispatch(s.setSelection(j.create(s.doc,t+1+e.length))),!0}function Wr(n,t,e,o){let s=rt(n.state.doc,t,e,o);return s===null?!1:(n.dispatch(n.state.tr.setSelection(j.create(n.state.doc,s))),!0)}var{TextSelection:So}=C,Qt=g.nodes,To=Object.freeze(["To do","In progress","Done"]),un=(n,t)=>N(n)&&(t===null||N(t)&&n<t)?A(n,t):null;function Zt(n=To){let t=H(null,null,n.length),e=Object.fromEntries(n.map((o,s)=>[y("c"),{pos:t[s],name:o}]));return Qt.board.create({id:y(),columns:e,cards:{}})}function dn(n,t,e=Zt(),o=null,s=null){let r=n.tr;o&&r.delete(o.from,o.to),s??=r.doc.resolve(r.mapping.map(n.selection.head)).index(0);let i=J(r.doc),l=r.doc.child(s),c=l.isTextblock&&l.content.size===0,d=c?s:i[s].subEnd,u=c?i[s].at:i[d].end,a=i[d+1]?.node.attrs.pos??null,h=l.attrs.parent??null,p=c?l.attrs.pos:un(i[d].node.attrs.pos,a),f=Qt.board.create({...e.attrs,pos:p,parent:h}),m=Qt.paragraph.create({id:y(),pos:un(p,a),parent:h});return r.replaceWith(u,c?i[s].end:u,[f,m]),r.setSelection(So.create(r.doc,u+f.nodeSize+1)),t&&t(w(r).scrollIntoView()),!0}function hn(n){let t=[];return n.forEach(e=>{e.type===g.nodes.table&&I(e.attrs.cols).length>1&&t.push(e)}),t}function ni(n,t){let e="",o=0,s=null;return n.forEach(r=>{s===null&&(r.type===g.nodes.heading&&(e=r.textContent),r.type===g.nodes.table&&(o+=1,r.attrs.id===t&&(s=e||`Table ${o}`),e=""))}),s}var pn=new Set(["blockeditor-format-unsupported","unsupported-host"]),Eo="This host can't store that yet, so nothing was added.",Co="That didn't go through. Try again.",Ao="That couldn't be added here.";function fn(n,t){let e=t?.status==="upgrade-required"&&t.message?t.message:pn.has(t?.code)||pn.has(t?.status)?Eo:t?.retry===!0?Co:Ao;n.isDestroyed||(P(n,e),R(e,"error"))}async function Tt(n,t){if(typeof n.runFormatCommand!="function")return fn(n,{code:"blockeditor-format-unsupported"}),{ok:!1,code:"blockeditor-format-unsupported"};let e=await n.runFormatCommand(t);return e?.status==="applied"?e.result:(fn(n,e),{ok:!1,code:e?.code??e?.status??"blockeditor-format-refused",retry:e?.retry===!0})}var{TextSelection:it}=C,v=g.nodes,q=[{key:"text",label:"Text",description:"Plain writing",icon:"T",type:"paragraph",aliases:["p","paragraph","plain"]},{key:"h1",label:"Heading 1",description:"Big section heading",icon:"H1",type:"heading",attrs:{level:1},hint:"#",aliases:["h1","title"]},{key:"h2",label:"Heading 2",description:"Medium section heading",icon:"H2",type:"heading",attrs:{level:2},hint:"##",aliases:["h2","subtitle"]},{key:"h3",label:"Heading 3",description:"Small section heading",icon:"H3",type:"heading",attrs:{level:3},hint:"###",aliases:["h3"]},{key:"bullet",label:"Bulleted list",description:"A simple list",icon:"\u2022",type:"list_item",attrs:{kind:"bullet"},hint:"-",aliases:["ul","bullet","list","unordered"]},{key:"ordered",label:"Numbered list",description:"A list with numbers",icon:"1.",type:"list_item",attrs:{kind:"ordered"},hint:"1.",aliases:["ol","num","numbered","ordered"]},{key:"check",label:"Checklist",description:"Tasks to tick off",icon:"\u2610",type:"list_item",attrs:{kind:"check"},hint:"[]",aliases:["todo","to-do","task","check","checkbox"]},{key:"toggle",label:"Toggle",description:"Hide details under a line",icon:"\u25B8",type:"toggle",attrs:{open:!0},hint:">",aliases:["collapse","details","fold"]},{key:"toggle-h1",label:"Toggle heading 1",description:"Collapsible heading",icon:"H1",type:"toggle",attrs:{open:!0,level:1},aliases:["toggle heading"]},{key:"toggle-h2",label:"Toggle heading 2",description:"Collapsible heading",icon:"H2",type:"toggle",attrs:{open:!0,level:2},aliases:["toggle heading"]},{key:"toggle-h3",label:"Toggle heading 3",description:"Collapsible heading",icon:"H3",type:"toggle",attrs:{open:!0,level:3},aliases:["toggle heading"]},{key:"callout",label:"Callout",description:"Make a note stand out",icon:"!",type:"callout",aliases:["note","aside","info"]},{key:"quote",label:"Quote",description:"Set text apart as a quotation",icon:"\u201C",type:"quote",hint:'"',aliases:["blockquote","quotation","cite"]},{key:"code",label:"Code",description:"Code with highlighting",icon:"</>",type:"code_block",hint:"```",aliases:["pre","snippet"]}],Oo=[{key:"divider",label:"Divider",description:"A line between sections",icon:"\u2014",hint:"---",aliases:["hr","line","separator","rule"],insert:"divider"},{key:"toc",label:"Table of contents",description:"Links to this page's headings",icon:"\u2261",aliases:["toc","contents","outline","index"],insert:"toc"},{key:"image",label:"Image",description:"Upload or paste a picture",icon:"\u25A3",aliases:["img","picture","photo"],insert:"image"},{key:"file",label:"File",description:"Attach any file",icon:"\u2398",aliases:["upload","attachment","pdf"],insert:"file"},{key:"table",label:"Table",description:"Rows and columns, paste from a spreadsheet",icon:"\u25A6",aliases:["grid","spreadsheet"],insert:"table"},{key:"csv",label:"Import CSV\u2026",description:"Turn a CSV file into a table",icon:"\u21E7",aliases:["comma separated","import"],insert:"csv"},{key:"board",label:"Board",description:"Cards in columns, like a kanban",icon:"\u25A5",aliases:["kanban","cards","columns","status"],insert:"board"},{key:"mention",label:"Mention",description:"Name someone on the page",icon:"@",aliases:["person","people","assign"],command:"mentions"},{key:"date",label:"Date",description:"Today, tomorrow or a calendar day",icon:"\u25A7",aliases:["calendar","today","tomorrow","due"],command:"dates"},{key:"emoji",label:"Emoji",description:"Insert one glyph",icon:"\u263A",aliases:["smiley","glyph","symbol"],command:"emoji"},{key:"import-markdown",label:"Import Markdown\u2026",description:"Turn a Markdown file into blocks",icon:"M\u2193",aliases:["md","markdown","import"],command:"importMarkdown"}],vo={key:"chart",label:"Chart",description:"A bar or line chart from a table",icon:"\u{1F4CA}",aliases:["graph","plot","bar","line"],insert:"chart"},te=n=>(Ne.get(n)?.ensure("chart")??Promise.resolve()).catch(()=>{}).then(()=>n.isDestroyed?null:import("./c-5SZ6KFR5.js")),At=[...q,...Oo],gn=(n,t=At)=>hn(n.doc).length?[...t,vo]:t;function Ot(n){let t=n.type.name;return q.find(e=>e.type===t&&(!e.attrs||(t==="heading"||t==="toggle"?(e.attrs.level??null)===(n.attrs.level??null):t==="list_item"?e.attrs.kind===n.attrs.kind:!0)))??q[0]}var ee=(n,t)=>{let e=0;for(let o=0;o<t;o++)e+=n.child(o).nodeSize;return e};function G(n,t,e){let o=ee(n.doc,t),s=n.doc.child(t),r={id:s.attrs.id,pos:s.attrs.pos,parent:s.attrs.parent};return s.type===v.list_item&&e.type==="list_item"&&(r.indent=s.attrs.indent),n.setBlockType(o+1,o+s.nodeSize-1,v[e.type],{...r,...e.attrs||{}})}var bn=Object.freeze({status:"refused",code:"unsupported-format"}),Io=xe([]).type,Lo=n=>{let t=!1;return n.forEach(e=>{!t&&e.marks.some(ye)&&(t=!0)}),t};function Q(n,t){return!n.isTextblock||n.type===v.opaque_block?!1:!Lo(n)||v[t.type].allowsMarkType(Io)}var kn=n=>n.type==="toggle"&&n.attrs?.level!=null,Et=(n,t)=>{let e=-1;return n.forEach((o,s,r)=>{o.attrs.id===t&&(e=r)}),e},ne={ok:!1,code:"stale-target"};function yn(n,t,e){let o=()=>e.map(r=>Et(n.state.doc,r)),s=()=>{let r=o();if(r.includes(-1))return ne;if(r.some(l=>!Q(n.state.doc.child(l),t)))return bn;let i=n.state.tr;for(let l of r)G(i,l,t);return n.dispatch(w(i).scrollIntoView()),n.focus(),{ok:!0}};return kn(t)?Tt(n,s):t.type==="quote"?import("./c-TCFVG3I4.js").then(r=>n.isDestroyed?!1:r.gateTurn(n,s)):s()}function xn(n,t,e=n.tr){let o=J(e.doc),{to:s}=ze(o,t),r=e.doc.child(t);return e.insert(s,v.paragraph.create({parent:r.attrs.parent??null})),e.setSelection(it.create(e.doc,s+1))}var X=(n,t)=>N(n)&&(t===null||N(t)&&n<t)?A(n,t):null;function oe(n,t){let e=ee(n.doc,t),o=n.doc.child(t),s=n.doc.maybeChild(t+1),{id:r,pos:i,parent:l}=o.attrs;return n.replaceWith(e,e+o.nodeSize,[v.divider.create({id:r,pos:i,parent:l}),v.paragraph.create({id:y(),pos:X(i,s?s.attrs.pos:null),parent:l})]),n.setSelection(it.create(n.doc,e+2))}function Do(n,t,e=n.tr){let o=e.doc.child(t);if(o.type===v.paragraph&&o.content.size===0)return oe(e,t);let s=J(e.doc),r=s[t].subEnd,i=s[r].end,l=s[r+1]?.node.attrs.pos??null,c=X(s[r].node.attrs.pos,l),d=o.attrs.parent??null;return e.insert(i,[v.divider.create({id:y(),pos:c,parent:d}),v.paragraph.create({id:y(),pos:X(c,l),parent:d})]),e.setSelection(it.create(e.doc,i+2))}function $o(n,t){let e=ee(n.doc,t),o=n.doc.child(t),s=n.doc.maybeChild(t+1),{id:r,pos:i,parent:l}=o.attrs;return n.replaceWith(e,e+o.nodeSize,[v.toc.create({id:r,pos:i,parent:l,maxLevel:3}),v.paragraph.create({id:y(),pos:X(i,s?s.attrs.pos:null),parent:l})]),n.setSelection(it.create(n.doc,e+2))}function _o(n,t,e=n.tr){let o=e.doc.child(t);if(o.type===v.paragraph&&o.content.size===0)return $o(e,t);let s=J(e.doc),r=s[t].subEnd,i=s[r].end,l=s[r+1]?.node.attrs.pos??null,c=X(s[r].node.attrs.pos,l),d=o.attrs.parent??null;return e.insert(i,[v.toc.create({id:y(),pos:c,parent:d,maxLevel:3}),v.paragraph.create({id:y(),pos:X(c,l),parent:d})]),e.setSelection(it.create(e.doc,i+2))}function Bo(n,t){if(n.length<2||n.length>32)return 1/0;let e=-1,o=0;for(let s of n){let r=t.indexOf(s,e+1);if(r<0)return 1/0;o+=r-e-1,e=r}return o}function Mn(n,t){let e=t.trim().toLowerCase();if(!e)return n;let o=s=>{let r=s.label.toLowerCase(),i=[s.key,...s.aliases||[],...s.hint?[s.hint]:[]].map(c=>c.toLowerCase());if(r===e||i.includes(e))return[0,0];if(r.startsWith(e))return[1,0];if([...r.split(/\s+/),...i].some(c=>c.startsWith(e)))return[2,0];if([r,...i].some(c=>c.includes(e)))return[3,0];if(e.length>=3&&s.description&&s.description.toLowerCase().split(/[^a-z0-9]+/).some(c=>c.startsWith(e)))return[4,0];let l=Math.min(...[r,s.key,...s.aliases||[]].map(c=>Bo(e,c.toLowerCase())));return l===1/0?null:[5,l]};return n.map((s,r)=>({it:s,order:r,rank:o(s)})).filter(s=>s.rank).sort((s,r)=>s.rank[0]-r.rank[0]||s.rank[1]-r.rank[1]||s.order-r.order).map(s=>s.it)}function mn(n,t,e,o){let s=n.state,r=s.tr;o&&r.delete(o.from,o.to);let i=r.doc.child(e);return i.isTextblock&&i.content.size===0&&!Q(i,t)?bn:(t.insert==="divider"?r=Do(s,e,r):i.isTextblock&&i.content.size===0?r=G(r,e,t):(r=xn(s,e,r),r=G(r,r.doc.resolve(r.selection.head).index(0),t)),n.dispatch(w(r).scrollIntoView()),n.focus(),!0)}function Po(n,t,e=null){let o=n.state,s=o.doc.maybeChild(t)?.attrs.id??null,r=e&&{...e,text:o.doc.textBetween(e.from,e.to)};return Tt(n,()=>{let i=n.state;if((s===null?-1:Et(i.doc,s))<0||r&&i.doc.textBetween(r.from,r.to)!==r.text)return ne;let c=r?i.tr.delete(r.from,r.to):i.tr;return c=_o(i,Et(c.doc,s),c),n.dispatch(w(c).scrollIntoView()),n.focus(),{ok:!0}})}var Z=(n,t,e)=>import("./page/editor-PKSPJ2XJ.js").then(({runPageCommand:o})=>n.isDestroyed?{ok:!1,code:"not-editing"}:o(n,t,e));function Ro(n,t,e){return e&&n.dispatch(n.state.tr.delete(e.from,e.to)),Z(n,t,{})}function wn(n,t,e,o=null){let s=n.state;if(t.insert==="image"||t.insert==="file")return Re(n,t.insert==="image"?"image/*":"",Pe(s,e),o);if(t.insert==="csv")return Ct(n,o);if(t.insert==="table")return F(s,n.dispatch,ln(),o,null,e);if(t.insert==="board")return dn(s,n.dispatch,Zt(),o,e);if(t.insert==="chart")return te(n).then(l=>l&&!n.isDestroyed?l.chartFromSlash(n,e,o):!1);if(t.insert==="toc")return Po(n,e,o);if(t.command)return Ro(n,t.command,o);if(!kn(t)&&t.type!=="quote")return mn(n,t,e,o);let r=s.doc.maybeChild(e)?.attrs.id??null,i=o&&{...o,text:s.doc.textBetween(o.from,o.to)};return Tt(n,()=>{let l=n.state,c=r===null?-1:Et(l.doc,r);return c<0||i&&l.doc.textBetween(i.from,i.to)!==i.text?ne:mn(n,t,c,i)})}var{InputRule:ie}=Rt,W=g.nodes,vt=(n,t,e)=>n.doc.rangeHasMark(t,e,g.marks.code)||!!g.marks.code.isInSet(n.storedMarks||n.selection.$from.marks()),tt=(n,t,e=["paragraph"],o=!1)=>new ie(n,(s,r,i,l)=>{let c=s.doc.resolve(i);return!s.selection.empty||c.depth!==1||c.parentOffset!==0||!e.includes(c.parent.type.name)||o&&l!==c.end()||vt(s,i,l)?null:w(G(s.tr.delete(i,l),c.index(0),typeof t=="function"?t(r):t))}),No=new ie(/^---$/,(n,t,e,o)=>{let s=n.doc.resolve(e);return!n.selection.empty||s.depth!==1||s.parent.type!==W.paragraph||s.parentOffset!==0||s.parent.content.size!==o-e||vt(n,e,o)?null:w(oe(n.tr,s.index(0)))}),le=`\\s\\(\\[\\{'\u2018\u201C"`,Ho=new RegExp(`[${le}]`),se=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Sn=n=>`([^\\s${n}](?:[\\s\\S]*?[^\\s${n}])?)`,It=(n,t)=>!!n?.isComposing||n?.keyCode===229||!!t?.composing,Tn=n=>{let t=0;for(let e=n.length-1;e>=0&&n[e]==="\\";e--)t++;return t},zo=(n,t)=>{let e=n.doc.resolve(t);return!e.parent.inlineContent||Tn(e.parent.textBetween(0,e.parentOffset,null,"\uFFFC"))%2?!1:e.parentOffset===0||Ho.test(e.parent.textBetween(e.parentOffset-1,e.parentOffset))},Fo=(n,t,e,o,s)=>{let r=s(t);if(!r||!n.selection.empty||e<0||e>o||o>n.doc.content.size)return null;let i=n.doc.resolve(e),l=n.doc.resolve(o);if(!i.sameParent(l)||!i.parent.inlineContent)return null;let[c,d,u,a]=t;if(vt(n,e,o))return null;let h=c.slice(d.length,c.length-u.length-a.length),p=e+d.length;if(!zo(n,p)||Tn(c.slice(0,c.length-a.length))%2)return null;let f=c.length-(o-e);if(f<0)return null;let m=n.tr;f&&m.insertText(c.slice(-f),o,o);let b=p+h.length,x=b+u.length;return m.delete(x,e+c.length),m.delete(p,b),m.addMark(p,p+u.length,r),m.removeStoredMark(r.type),w(m)},En=(n,t)=>new ie(n,(e,o,s,r)=>Fo(e,o,s,r,t),{inCodeMark:!1}),et=(n,t,e)=>En(new RegExp(`(^|[${le}])${se(n)}${Sn(se(t))}(${se(t)})$`),()=>e.create()),Ko=En(new RegExp(`(^|[${le}])\\[${Sn("\\[\\]")}(\\]\\([^()\\s]*\\))$`),n=>{let t=be(n[3].slice(2,-1));return t?g.marks.link.create({href:t}):null}),Vo=[et("**","**",g.marks.strong),et("__","__",g.marks.strong),et("*","*",g.marks.em),et("_","_",g.marks.em),et("`","`",g.marks.code),et("~~","~~",g.marks.strike),Ko],re=["paragraph","list_item"],jo=[tt(/^(#{1,3})\s$/,n=>({type:"heading",attrs:{level:n[1].length}})),tt(/^[-*+]\s$/,{type:"list_item",attrs:{kind:"bullet"}},re),tt(/^\d+[.)]\s$/,{type:"list_item",attrs:{kind:"ordered"}},re),tt(/^\[( |x|X)?\]\s$/,n=>({type:"list_item",attrs:{kind:"check",checked:!!n[1]&&n[1]!==" "}}),re),tt(/^>\s$/,{type:"toggle",attrs:{open:!0}}),tt(/^```$/,{type:"code_block"},["paragraph"],!0),No,...Vo];function qo(n,t,e,o,s){if(s!==" "||e!==o)return!1;let r=t.state,i=r.doc.resolve(e),l=i.parent;if(i.depth!==1||l.type!==W.paragraph||i.parentOffset!==1||l.textContent!=='"'||!t.editable||typeof t.runFormatCommand!="function")return!1;let c=()=>{t.isDestroyed||t.state.doc!==r.doc||t.dispatch(t.state.tr.insertText(" ",e,o))},d=i.before(1);return import("./c-TCFVG3I4.js").then(({quoteFromSpace:u})=>u(n,t,{at:d,from:e,to:o},c),c),!0}var Oi=()=>{let n=Rt.inputRules({rules:jo}),t=n.props.handleTextInput;return n.props.handleTextInput=(e,o,s,r)=>qo(n,e,o,s,r)||t(e,o,s,r),n},Wo=/^\s*\|(.*)\|\s*$/;function Uo(n,t){let{$from:e,empty:o}=n.selection;if(!o||e.depth!==1||e.parent.type!==W.paragraph||e.parentOffset!==e.parent.content.size||vt(n,e.start(),e.end()))return!1;let s=Wo.exec(e.parent.textContent);if(!s)return!1;let r=s[1].split("|").map(l=>l.trim());if(!r.some(Boolean))return!1;let i=Mt([r,r.map(()=>"")],{header:!0});return F(n,t,i,{from:e.start(),to:e.end()})}var vi=()=>at.keymap({Enter:(n,t,e)=>!It(null,e)&&Uo(n,t)});function Ii(n,t){let{$from:e,empty:o}=n.selection;if(!o||e.depth!==1||e.parentOffset!==0)return!1;let s=e.parent;return s.type===W.heading||s.type===W.callout||s.type===W.quote||s.type===W.code_block&&s.content.size===0?(t&&t(w(n.tr.setNodeMarkup(e.before(),W.paragraph,{id:s.attrs.id,pos:s.attrs.pos,parent:s.attrs.parent}))),!0):!1}var{Plugin:In,PluginKey:Ln,TextSelection:$t,NodeSelection:Go}=C,Dn=g.marks,U=g.nodes,Dt=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform)?"\u2318":"Ctrl+",$n=n=>{let t=gt(n.doc),{lo:e,hi:o}=n.selection.span(n.doc);return t.slice(e,o+1).filter(s=>s.up===t[e].up)},Lt=(n,t)=>n.state.doc.child(t).attrs.id,Yo=(n,t)=>{let e=0;for(let o=0;o<t;o++)e+=n.child(o).nodeSize;return e},Cn=["aria-haspopup","aria-controls","aria-activedescendant"],Jo="That block is no longer available.",he="This block holds content from a newer version, so it can't be converted here.";function ce(n){let t=n.visualViewport;return t?{left:t.offsetLeft,top:t.offsetTop,width:t.width,height:t.height}:{left:0,top:0,width:n.innerWidth,height:n.innerHeight}}function Xo(n,t,e,o=0){let s=$,r=Math.min(t,Math.max(0,n.width-s*2));return{left:n.left+(n.width-r)/2,top:Math.max(n.top+s,n.top+n.height-e-o-s),width:r}}function Qo(n,t=globalThis.location){return`${t.origin}${t.pathname}${t.search}#${encodeURIComponent(n)}`}function Zo(n){if(!n)return;let t=()=>R("Link copied"),e=()=>R("Could not copy the link.","error");if(!globalThis.navigator?.clipboard?.writeText){e();return}globalThis.navigator.clipboard.writeText(Qo(n)).then(t,e)}var _n=[{key:"up",label:"Move up",icon:"up",hint:`${Dt}\u21E7\u2191`,run:n=>Ht(-1)(n.state,n.dispatch)},{key:"down",label:"Move down",icon:"down",hint:`${Dt}\u21E7\u2193`,run:n=>Ht(1)(n.state,n.dispatch)},{key:"indent",label:"Indent",icon:"indent",hint:"Tab",run:n=>{let t=n.state.doc;Ke(n.state,n.dispatch),n.state.doc===t&&(P(n,"Indent works on list items and inside toggles."),R("Indent works on list items and inside toggles."))}},{key:"outdent",label:"Outdent",icon:"outdent",hint:"\u21E7Tab",run:n=>Ve(n.state,n.dispatch)},{key:"duplicate",label:"Duplicate",icon:"duplicate",hint:`${Dt}D`,run:n=>Ue(n.state,n.dispatch)},{key:"delete",label:"Delete",icon:"trash",hint:"Del",run:n=>Ft(n.state,n.dispatch)},{key:"turn",label:"Turn into",icon:"turn",hint:"\u203A",only:"text",run:(n,t)=>t.openMenu("turn",t.plus)},{key:"link",label:"Copy link",icon:"link",run:(n,t,e)=>Zo(n.state.doc.child(e).attrs.id)},{key:"alt",label:"Alt text\u2026",icon:"alt",only:"image",focus:!1,run:(n,t,e)=>{let o=Lt(n,e);return import("./c-IESDKFO6.js").then(s=>s.openAltEditor(n,o))}},{key:"small",label:"Small",icon:"small",only:"image",run:(n,t,e)=>{let o=Lt(n,e);return import("./c-IESDKFO6.js").then(s=>s.setImageAttrs(n,o,{width:240}))}},{key:"medium",label:"Medium",icon:"medium",only:"image",run:(n,t,e)=>{let o=Lt(n,e);return import("./c-IESDKFO6.js").then(s=>s.setImageAttrs(n,o,{width:480}))}},{key:"full",label:"Full width",icon:"full",only:"image",run:(n,t,e)=>{let o=Lt(n,e);return import("./c-IESDKFO6.js").then(s=>s.setImageAttrs(n,o,{width:null}))}},{key:"chart",label:"Chart this table",icon:"chart",only:"table",run:(n,t,e)=>{let o=Yo(n.state.doc,e);return te(n).then(({insertChartAfterTable:s})=>s(n,o))}},{key:"csv",label:"Import CSV\u2026",icon:"csv",only:"table",focus:!1,run:(n,t,e)=>Ct(n,null,n.state.doc.child(e).attrs.id)}],ts=n=>{if(!(n.selection instanceof z))return[];let t=$n(n),e=t.every(r=>r.node.isTextblock),o=t.length===1&&t[0].node.type===U.image,s=t.length===1&&t[0].node.type===U.table;return _n.filter(r=>r.only==="text"?e:r.only==="image"?o:r.only==="table"?s:!0)},M=n=>`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n}</svg>`,K={plus:M('<path d="M8 3.5v9M3.5 8h9"/>'),grip:M('<path stroke-width="2.2" d="M6 3.5h.01M10 3.5h.01M6 8h.01M10 8h.01M6 12.5h.01M10 12.5h.01"/>'),strong:M('<path d="M5 3h4a2.5 2.5 0 0 1 0 5H5zM5 8h4.6a2.5 2.5 0 0 1 0 5H5z"/>'),em:M('<path d="M10 3H6.5M9.5 13H6M9 3l-2 10"/>'),strike:M('<path d="M3 8h10M10.8 5.2C10.5 4 9.4 3.2 8 3.2c-1.7 0-2.8.9-2.8 2.1M5.2 10.8c.3 1.2 1.4 2 2.8 2 1.7 0 2.8-.9 2.8-2.1"/>'),code:M('<path d="M6 4.5 2.5 8 6 11.5M10 4.5 13.5 8 10 11.5"/>'),link:M('<path d="M7 9a2.5 2.5 0 0 0 3.5 0l2-2A2.5 2.5 0 0 0 9 3.5l-.7.7M9 7a2.5 2.5 0 0 0-3.5 0l-2 2A2.5 2.5 0 0 0 7 12.5l.7-.7"/>'),bullet:M('<path d="M6.5 4.5h7M6.5 8h7M6.5 11.5h7"/><path stroke-width="2.4" d="M3 4.5h.01M3 8h.01M3 11.5h.01"/>'),ordered:M('<path d="M7 4.5h6.5M7 8h6.5M7 11.5h6.5M2.5 3.5l1-.5v3M2.5 9.3c.2-.5.6-.8 1.1-.8.6 0 1 .4 1 .9 0 .9-2.1 1.4-2.1 2.6h2.1"/>'),check:M('<rect x="2.5" y="2.5" width="11" height="11" rx="2.5"/><path d="M5.5 8.2l1.8 1.8 3.4-4"/>'),more:M('<path stroke-width="2.2" d="M3 8h.01M8 8h.01M13 8h.01"/>'),gear:M('<g transform="scale(0.6667)" stroke-width="2.25"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></g>'),close:M('<path d="M4 4l8 8M12 4l-8 8"/>'),up:M('<path d="M8 13V3.5M4 7.5 8 3.5l4 4"/>'),down:M('<path d="M8 3v9.5M4 8.5l4 4 4-4"/>'),indent:M('<path d="M2.5 3.5h11M7 8h6.5M2.5 12.5h11M2.5 6l2.5 2-2.5 2"/>'),outdent:M('<path d="M2.5 3.5h11M7 8h6.5M2.5 12.5h11M5 6 2.5 8 5 10"/>'),duplicate:M('<rect x="5.5" y="5.5" width="8" height="8" rx="1.5"/><path d="M10.5 3.5v-.5A1.5 1.5 0 0 0 9 1.5H4A1.5 1.5 0 0 0 2.5 3v5A1.5 1.5 0 0 0 4 9.5h.5"/>'),trash:M('<path d="M3 4.5h10M6.5 4.5V3h3v1.5M4.5 4.5l.6 8.5h5.8l.6-8.5"/>'),turn:M('<path d="M3 5.5h9.5M10 3l2.5 2.5L10 8M13 10.5H3.5M6 8l-2.5 2.5L6 13"/>'),chart:M('<path d="M3 13V3M3 13h10.5M6 10.5V8M9 10.5V5.5M12 10.5V7"/>'),csv:M('<path d="M4 1.5h5L12.5 5v9.5h-8.5zM9 1.5V5h3.5M8 7.5v5M6 10.5l2 2 2-2"/>'),alt:M('<path d="M2.5 12.5 5.5 4l3 8.5M3.6 9.5h3.8M10 12.5V7.5M10 8.5c.4-.7 1.1-1 2-1h.5"/>'),small:M('<rect x="5" y="5" width="6" height="6" rx="1"/>'),medium:M('<rect x="3.5" y="3.5" width="9" height="9" rx="1.2"/>'),full:M('<rect x="1.5" y="3.5" width="13" height="9" rx="1.2"/>')},ae=[["strong","Bold"],["em","Italic"],["strike","Strikethrough"],["link","Link"],["bullet","Bulleted list"],["ordered","Numbered list"],["check","Checklist"],["code","Code"]],Bn=new Set(["strong","em","link"]),es=new Set(["up","down","indent","outdent"]),ns=204,os=52,$=8,Pn=new Set(["bullet","ordered","check"]),ss=[["assignees","Checklist assignees"],["dates","Checklist due dates"]],rs=new Set(["paragraph","heading","list_item"]),lt=n=>{let t=n.selection;if(t instanceof z)return $n(n).map(l=>l.i);let{$from:e,$to:o,empty:s}=t,r=Math.min(!s&&o.depth===0?o.index(0)-1:o.index(0),n.doc.childCount-1),i=[];for(let l=e.index(0);l<=r;l++)i.push(l);return i},Rn=n=>lt(n).filter(t=>{let e=n.doc.child(t);return e.isTextblock&&e.type!==U.code_block}),Nn=(n,t)=>n.type===U.list_item&&n.attrs.kind===t,Hn=(n,t)=>{let e=Rn(n);return e.length>0&&e.every(o=>Nn(n.doc.child(o),t))},is=n=>{let t="";return n.forEach(e=>{t+=e.isText?e.text:e.type===U.hard_break?`
|
|
3
|
-
`:""}),t};function ls(n){let{$from:t,$to:e,empty:o}=n.selection;if(o||!(n.selection instanceof $t)||t.depth!==1||e.depth!==1||t.parentOffset!==0||e.parentOffset!==e.parent.content.size)return null;let s=lt(n);return s.every(r=>rs.has(n.doc.child(r).type.name))?s:null}function cs(n,t){let e=n.doc.child(t[0]),o=n.selection.$from.before(1),s=n.selection.$to.after(1),r=t.map(u=>is(n.doc.child(u))).join(`
|
|
4
|
-
`),{id:i,pos:l,parent:c}=e.attrs,d=n.tr.replaceWith(o,s,U.code_block.create({id:i,pos:l,parent:c},r?g.text(r):null));return d.setSelection($t.create(d.doc,o+1,o+1+r.length))}function as(n,t){let e=n.tr,o=n.doc.resolve(n.selection.from).before(1),s=0;for(let r of[...t].reverse()){let i=0;for(let h=0;h<r;h++)i+=n.doc.child(h).nodeSize;let l=n.doc.child(r),{id:c,pos:d,parent:u}=l.attrs,a=l.textContent.split(`
|
|
5
|
-
`).map((h,p)=>U.paragraph.create(p===0?{id:c,pos:d,parent:u}:{parent:u},h?g.text(h):null));e.replaceWith(i,i+l.nodeSize,a),s||(s=i+a.reduce((h,p)=>h+p.nodeSize,0))}return s=e.mapping.slice(1).map(s),e.setSelection($t.create(e.doc,o+1,s-1))}var zn=n=>{let t=lt(n);return t.length>0&&t.every(e=>n.doc.child(e).type===U.code_block)?t:null};function An(n,t){if(Pn.has(t))return Hn(n,t);if(t==="code"&&zn(n))return!0;let e=Dn[t],{from:o,to:s,empty:r,$from:i}=n.selection;return r?!!e.isInSet(n.storedMarks||i.marks()):n.doc.rangeHasMark(o,s,e)}function us(n,t){let e=n.state,o=Hn(e,t),s=q.find(l=>l.key===(o?"text":t)),r=Rn(e).filter(l=>o||!Nn(e.doc.child(l),t));if(r.some(l=>!Q(e.doc.child(l),s))){P(n,he);return}let i=e.tr;for(let l of r)G(i,l,s);i.docChanged&&n.dispatch(w(i))}var ue=(n,t,e)=>import("./c-TCFVG3I4.js").then(o=>o.nativeMenu(n,e,t.pickedFrom??t.more));function On(n,t){if(t==="link")return _e(n);let e=n.state,o=t==="code"?zn(e):null,s=t==="code"&&!o?ls(e):null;Pn.has(t)?us(n,t):o?n.dispatch(w(as(e,o)).scrollIntoView()):s&&s.some(r=>!Q(e.doc.child(r),q.find(i=>i.key==="code")))?P(n,he):s?n.dispatch(w(cs(e,s)).scrollIntoView()):ge.toggleMark(Dn[t])(e,n.dispatch),n.focus()}var k=(n,t,e={})=>{let o=document.createElement(n);t&&(o.className=t);for(let[s,r]of Object.entries(e))o.setAttribute(s,r);return o};function vn(n,t){let e=k("button",`blockeditor-tool${Bn.has(n)?" blockeditor-tool-primary":" blockeditor-tool-desk"}`,{type:"button","data-cmd":n,"aria-label":t,title:t});return e.innerHTML=K[n],e}var ds=1600,hs=0,ps=new Ln("blockeditor-chrome"),pe=new WeakMap,_t=new Ln("blockeditor-slash-range"),fs={init:()=>null,apply(n,t){let e=t;if(e&&n.docChanged){let s=n.mapping.map(e.from,1),r=n.mapping.map(e.to,-1);e=s<=r&&n.doc.textBetween(s,r)===e.text?{...e,from:s,to:r}:null}let o=n.getMeta(_t);return o!==void 0&&(e=o),e}},Yi=()=>new In({key:_t,state:fs}),Fn=(n,t)=>{let e=t?n.state.doc.textBetween(t.from,t.to):null;n.dispatch(n.state.tr.setMeta(_t,t?{...t,text:e}:null))},Kn=n=>{let t=_t.getState(n);return t?{from:t.from,to:t.to}:null};function Ji(n,t,e,{persist:o=!1}={}){let s=pe.get(n);return s?(s.openMenu("external",t),s.menu.externalItems=e,s.menu.persist=o,s.renderMenu(),!0):!1}function Xi(n,t,e){let o=pe.get(n),s=o?.menu;return!s||s.anchor!==t||!e||e===t?!1:(s.anchor=e,e.setAttribute("aria-expanded","true"),n.dom.setAttribute("aria-controls",o.menuId),!0)}var de=class{constructor(t,e,o){this.view=t,this.onAiTool=e,this.mediaNote=o,this.shell=t.dom.parentElement,this.menu=null,this.priorAria=null,this.movedTimer=0,this.hover=null,this.pendingHover=null,this.win=t.dom.ownerDocument.defaultView??globalThis,this.frame=null,this.destroyed=!1,this.probe=null,this.roving=null,this.remote=!1,this.dock=k("div","blockeditor-dock",{role:"toolbar","aria-label":"Formatting"}),this.turn=k("button","blockeditor-tool blockeditor-tool-turn blockeditor-tool-desk",{type:"button","aria-haspopup":"menu"}),this.more=k("button","blockeditor-tool blockeditor-tool-primary blockeditor-tool-more",{type:"button","aria-label":"More",title:"More","aria-haspopup":"menu"}),this.more.innerHTML=K.more,this.settingsBtn=k("button","blockeditor-tool blockeditor-tool-desk blockeditor-tool-settings",{type:"button","aria-label":"Document settings",title:"Document settings","aria-haspopup":"dialog","aria-expanded":"false"}),this.settingsBtn.innerHTML=K.gear,this.settingsEl=null,this.settingsOpen=!1,this.settingsAnchor=null,this.settingSwitches={},this.dock.append(this.turn,k("span","blockeditor-tool-sep blockeditor-tool-desk"),...ae.map(([i,l])=>vn(i,l)),this.more),this.dock.insertBefore(this.settingsBtn,this.more),this.settingsBtn.hidden=!this.settingsAPI,this.plus=k("button","blockeditor-plus",{type:"button","aria-label":"Add a block",title:"Add a block"}),this.plus.innerHTML=K.plus,this.grip=k("button","blockeditor-grip",{type:"button","aria-label":"Block actions",title:"Drag to move, click for actions","aria-haspopup":"menu"}),this.grip.innerHTML=K.grip,this.bubble=k("div","blockeditor-bubble",{role:"toolbar","aria-label":"Selection",hidden:""}),this.bubbleTurn=k("button","blockeditor-tool blockeditor-tool-turn",{type:"button","aria-haspopup":"menu"}),this.bubbleMore=k("button","blockeditor-tool blockeditor-tool-primary blockeditor-tool-more",{type:"button","aria-label":"More",title:"More","aria-haspopup":"menu"}),this.bubbleMore.innerHTML=K.more,this.bubble.append(this.bubbleTurn,k("span","blockeditor-tool-sep"),...ae.map(([i,l])=>vn(i,l)),this.bubbleMore),this.menuId=`blockeditor-menu-${++hs}`,this.menuEl=k("div","blockeditor-menu",{role:"menu",id:this.menuId,hidden:""}),this.scrim=k("div","blockeditor-scrim",{hidden:""}),this.shell.insertBefore(this.dock,t.dom),this.shell.append(this.plus,this.grip,this.bubble,this.scrim,this.menuEl);let s=i=>i.preventDefault();for(let i of[this.dock,this.plus,this.grip,this.bubble,this.menuEl])i.addEventListener("mousedown",s);for(let i of[this.dock,this.bubble])i.addEventListener("click",l=>{let c=l.target.closest("[data-cmd]");c&&On(this.view,c.dataset.cmd)});this.turn.addEventListener("click",()=>this.toggleMenu("turn",this.turn)),this.more.addEventListener("click",()=>this.toggleMenu("more",this.more)),this.settingsBtn.addEventListener("click",()=>this.toggleSettings()),this.bubbleTurn.addEventListener("click",()=>this.toggleMenu("turn",this.bubbleTurn)),this.bubbleMore.addEventListener("click",()=>this.toggleMenu("more",this.bubbleMore)),this.dock.addEventListener("keydown",i=>this.dockKey(i)),this.plus.addEventListener("click",()=>this.fromPlus()),this.grip.addEventListener("click",i=>{i.detail===0&&this.gripAction(this.gutterIndex())}),this.drag=new Be(t,this.grip,{index:()=>this.gutterIndex(),onClick:i=>this.gripAction(i)});let r=!1;this.scrim.addEventListener("pointerdown",()=>{r=!0}),this.scrim.addEventListener("click",()=>{r&&this.closeMenu(),r=!1}),this.menuEl.addEventListener("click",i=>{let l=i.target.closest(".blockeditor-menu-item");l&&this.pick(Number(l.dataset.index))}),this.menuEl.addEventListener("keydown",i=>{this.key(i)&&i.preventDefault()}),this.onMove=i=>{this.shell.classList.add("is-moved"),clearTimeout(this.movedTimer),this.movedTimer=setTimeout(()=>this.shell.classList.remove("is-moved"),ds),this.trackHover(i)},this.onKey=()=>{clearTimeout(this.movedTimer),this.shell.classList.remove("is-moved"),this.pendingHover=null,this.setHover(null)},this.onLeave=()=>{this.pendingHover=null,this.setHover(null)},this.onResize=()=>{this.scheduleLayout(),this.placeSettings()},this.onDocDown=i=>{this.settingsOpen&&![this.settingsEl,this.settingsAnchor].some(l=>l?.contains(i.target))&&this.closeSettings(),this.menu&&([this.menuEl,this.plus,this.grip,this.turn,this.bubbleTurn,this.bubbleMore].some(l=>l.contains(i.target))||this.closeMenu())},this.onSettingsKey=i=>{i.key!=="Escape"||!this.settingsOpen||(i.preventDefault(),i.stopPropagation(),this.closeSettings(!0))},document.addEventListener("mousedown",this.onDocDown,!0),document.addEventListener("keydown",this.onSettingsKey,!0),this.shell.addEventListener("mousemove",this.onMove),this.shell.addEventListener("mouseleave",this.onLeave),this.shell.addEventListener("keydown",this.onKey),this.win.addEventListener("resize",this.onResize),this.win.addEventListener("scroll",this.onResize,!0),this.win.visualViewport?.addEventListener("resize",this.onResize),this.win.visualViewport?.addEventListener("scroll",this.onResize),this.update(t,null)}blockIndex(){let t=this.view.state,e=t.selection,o=e instanceof z||e instanceof Go?e.from:e.head;return Math.min(t.doc.resolve(o).index(0),t.doc.childCount-1)}isPhone(){return!!this.win?.matchMedia?.("(max-width: 560px)").matches}gutterIndex(){return this.isPhone()?this.blockIndex():(this.settleHover(),Math.min(this.hover??this.blockIndex(),this.view.state.doc.childCount-1))}dockControls(){let t=[...this.dock.querySelectorAll("button")].filter(e=>this.rendered(e));return this.isPhone()?t.filter(e=>e.classList.contains("blockeditor-tool-primary")):t}inRoving(t){return!t||!this.dock.contains(t)||this.isPhone()&&!t.classList.contains("blockeditor-tool-primary")?!1:this.rendered(t)}rendered(t){if(t.hidden)return!1;let e=this.win?.getComputedStyle?.(t);return!e||e.display!=="none"}setRoving(t){this.roving=t;let e=new Set(this.dockControls());for(let o of this.dock.querySelectorAll("button"))o.tabIndex=o===t&&e.has(o)?0:-1}leaveToToolbar(){queueMicrotask(()=>{this.view.isDestroyed||this.focusToolbar()})}focusToolbar(){let[t]=this.dockControls();return t?(this.setRoving(t),t.focus(),!0):!1}dockKey(t){if(t.key==="Escape"){t.preventDefault(),this.view.focus();return}if(t.key!=="ArrowRight"&&t.key!=="ArrowLeft")return;let e=this.dockControls(),o=e.indexOf(t.target);if(o<0)return;t.preventDefault();let s=e[(o+(t.key==="ArrowRight"?1:-1)+e.length)%e.length];this.setRoving(s),s.focus()}selectionIds(){let t=this.view.state;return lt(t).map(e=>t.doc.child(e).attrs.id)}idIndex(t){let e=-1;return this.view.state.doc.forEach((o,s,r)=>{o.attrs.id===t&&(e=r)}),e}invoker(){let t=this.menu;if(!t||t.slashAt!==null)return this.view.dom;let e=t.anchor;return e&&e!==this.view.dom&&e.isConnected&&(e.tagName==="BUTTON"||e.hasAttribute("tabindex"))?e:this.view.dom}selectCaretBlock(t=null){let e=this.view.state;if(e.selection instanceof z)return;let o=(t??[]).map(r=>this.idIndex(r)).filter(r=>r>=0),s=o.length?o[0]:this.blockIndex();this.view.dispatch(e.tr.setSelection(zt(e.doc,s,o.length?o[o.length-1]:s)))}gripAction(t){this.menu?this.closeMenu():this.openActions(this.grip,t)}trackHover(t){this.menu||this.drag.state||[this.plus,this.grip,this.dock,this.bubble].some(e=>e.contains(t.target))||(this.pendingHover={clientY:t.clientY},this.scheduleLayout())}hoverAt(t){let e=this.view,o=e.posAtCoords({left:e.dom.getBoundingClientRect().left+2,top:t});if(!o)return;let s=e.state.doc,r=gt(s),i=Math.min(s.resolve(o.inside>=0?o.inside:o.pos).index(0),r.length-1);for(;i>0&&r[i].hidden;)i--;this.hover=i}setHover(t){t!==this.hover&&(this.hover=t,this.scheduleLayout())}settleHover(){if(!this.pendingHover)return;let{clientY:t}=this.pendingHover;this.pendingHover=null,this.hoverAt(t)}fromPlus(){this.view.focus();let t=this.gutterIndex();this.openMenu("insert",this.plus,null,null,this.view.state.doc.child(t).attrs.id)}buildSettings(){if(this.settingsEl)return this.settingsEl;let t=k("div","blockeditor-settings",{role:"dialog","aria-label":"Document settings",hidden:""}),e=k("div","blockeditor-settings-head"),o=k("span","blockeditor-settings-title");o.textContent="Document settings";let s=k("button","blockeditor-settings-close",{type:"button","aria-label":"Close settings"});s.innerHTML=K.close,s.addEventListener("click",()=>this.closeSettings(!0)),e.append(o,s);let r=ss.map(([l,c])=>{let d=k("div","blockeditor-settings-row"),u=k("span","blockeditor-settings-name",{id:`${this.menuId}-set-${l}`});u.textContent=c;let a=k("button","blockeditor-settings-switch",{type:"button",role:"switch","aria-checked":"true","aria-labelledby":u.id,"data-setting":l});return a.append(k("span","blockeditor-settings-knob")),a.addEventListener("click",()=>this.flipSetting(l)),this.settingSwitches[l]=a,d.append(u,a),d}),i=k("div","blockeditor-settings-note");return i.textContent="Hidden values stay saved and come back when turned on.",t.append(e,...r,i),this.settingsEl=t,this.shell.append(t),t}flipSetting(t){let e=this.settingSwitches[t],o=e.getAttribute("aria-checked")!=="true";e.setAttribute("aria-checked",String(o)),Promise.resolve().then(()=>this.settingsAPI.set(t,o)).catch(()=>{e.setAttribute("aria-checked",String(!o)),R("That setting could not be saved.","error")})}openSettings(t=this.settingsBtn){if(!this.settingsAPI)return;this.menu&&this.closeMenu();let e=this.buildSettings(),o=this.settingsAPI.read();for(let[s,r]of Object.entries(this.settingSwitches))r.setAttribute("aria-checked",String(o[s]!==!1));this.settingsOpen=!0,this.settingsAnchor=t,t.setAttribute("aria-expanded","true"),e.hidden=!1,this.placeSettings(),e.querySelector(".blockeditor-settings-close")?.focus({preventScroll:!0})}closeSettings(t=!1){if(!this.settingsOpen)return;let e=this.settingsAnchor;this.settingsOpen=!1,this.settingsAnchor=null,this.settingsEl&&(this.settingsEl.hidden=!0),e?.setAttribute("aria-expanded","false"),t&&e?.isConnected&&e.focus({preventScroll:!0})}toggleSettings(){this.settingsOpen?this.closeSettings(!0):this.openSettings(this.settingsBtn)}placeSettings(){let t=this.settingsEl;if(!t||t.hidden||!this.settingsAnchor)return;let e=this.settingsAnchor.getBoundingClientRect(),o=t.offsetWidth||264,s=t.offsetHeight||0;if(this.isPhone()){let c=ce(this.win),d=Math.max(c.left+$,Math.min(e.right-o,c.left+c.width-$-o)),u=e.top-6-s;u<c.top+$&&(u=Math.min(e.bottom+6,c.top+c.height-$-s)),t.style.setProperty("--blockeditor-pop-x",`${d}px`),t.style.setProperty("--blockeditor-pop-y",`${Math.max(c.top+$,u)}px`);return}let r=this.shell.getBoundingClientRect(),i=Math.max(8,Math.min(e.right-r.left-o,Math.max(8,r.width-o-8))),l=e.bottom-r.top+6;l+s>this.win.innerHeight-8&&e.top-r.top-6-s>=8&&(l=e.top-r.top-6-s),t.style.setProperty("--blockeditor-pop-x",`${i}px`),t.style.setProperty("--blockeditor-pop-y",`${l}px`)}toggleMenu(t,e){this.menu?this.closeMenu():this.openMenu(t,e)}slashKey(t){let e=this.view.state.doc.resolve(t);return`${e.parent.attrs.id}\0${this.view.state.doc.textBetween(e.start(),t-1)}`}openMenu(t,e,o=null,s=null,r=null){this.closeSettings(),this.menu={mode:t,anchor:e,slashAt:o,anchorId:r,ids:s??(t==="insert"?[]:this.selectionIds()),query:"",active:0,items:[],persist:!1},e.setAttribute("aria-expanded","true"),o!==null?(this.priorAria||(this.priorAria=Cn.map(i=>[i,this.view.dom.getAttribute(i)])),this.view.dom.setAttribute("aria-haspopup","listbox")):this.view.dom.setAttribute("aria-haspopup","menu"),this.view.dom.setAttribute("aria-controls",this.menuId),this.renderMenu()}closeMenu(){if(this.menu?.anchor.setAttribute("aria-expanded","false"),this.menu=null,this.menuEl.hidden=!0,this.scrim.hidden=!0,this.priorAria){for(let[t,e]of this.priorAria)e===null?this.view.dom.removeAttribute(t):this.view.dom.setAttribute(t,e);this.priorAria=null}else for(let t of Cn)this.view.dom.removeAttribute(t)}moreItems(){let t=this.isPhone(),e=t?ae.filter(([s])=>!Bn.has(s)).map(([s,r])=>({key:s,label:r,icon:s,run:i=>On(i,s)})):[],o=_n.filter(s=>es.has(s.key)).map(s=>({...s,blocks:!0}));return[...e,{key:"underline",label:"Underline",icon:"U",hint:`${Dt}u`,run:(s,r)=>ue(s,r,"underline")},{key:"text_color",label:"Text color",icon:"A",hint:"\u203A",run:(s,r)=>ue(s,r,"text_color")},{key:"highlight",label:"Highlight",icon:"\u25A0",hint:"\u203A",run:(s,r)=>ue(s,r,"highlight")},...t?[{key:"turn",label:"Turn into",icon:"turn",run:(s,r)=>r.openMenu("turn",r.more)}]:[],{key:"insert",label:"Insert",icon:"+",run:(s,r)=>r.openMenu("insert",r.pickedFrom??r.more,null,null,s.state.doc.child(r.blockIndex()).attrs.id)},...o,...t&&this.settingsAPI?[{key:"settings",label:"Document settings",icon:"gear",focus:!1,run:(s,r)=>r.openSettings(r.more)}]:[],{key:"titleIcon",label:"Page icon",icon:"\u263A",run:s=>Z(s,"titleIcon")},...this.mediaNote?[]:[{key:"titleCover",label:"Add cover",icon:"\u25A4",run:s=>Z(s,"titleCover")}],{key:"exportHtml",label:"Export reading copy",icon:"\u21E9",run:s=>Z(s,"exportHtml")},{key:"exportMarkdown",label:"Export as Markdown",icon:"M\u21E9",run:s=>Z(s,"exportMarkdown")}]}menuItems(t){if(t.mode==="external")return t.externalItems||[];if(t.mode==="actions")return ts(this.view.state);if(t.mode==="more")return this.moreItems();let e=this.onAiTool?[...At,{key:"ai",label:"Make a tool with AI\u2026",icon:"\u2726",aliases:["tool","generate"],insert:"ai"}]:At,o=this.mediaNote?e.filter(r=>r.key!=="image"&&r.key!=="file"):e,s=t.mode==="turn"?q:gn(this.view.state,o);return Mn(s,t.query)}currentTypes(){let t=this.view.state;return new Set(lt(t).map(e=>Ot(t.doc.child(e)).key))}openActions(t=this.plus,e=null){let o=this.view.state,s=gt(o.doc),r=o.selection,i=e!==null&&r instanceof z&&r.span(o.doc).lo<=e&&e<=r.span(o.doc).hi,{lo:l,hi:c}=e===null||i?We(o,s):Fe(s,e,e);this.view.dispatch(o.tr.setSelection(zt(o.doc,l,c,s)));let d=[];for(let u=l;u<=c;u++)d.push(o.doc.child(u).attrs.id);this.openMenu("actions",t,null,d)}renderMenu(){let t=this.menu;t.items=this.menuItems(t),t.active=Math.min(t.active,Math.max(0,t.items.length-1));let e=t.slashAt!==null,o=t.mode==="turn"?this.currentTypes():null;this.menuEl.setAttribute("role",e?"listbox":"menu");let s=[];if(t.mode==="turn"){let r=k("div","blockeditor-menu-title");r.textContent=t.query?`Turn into \u201C${t.query}\u201D`:"Turn into",s.push(r)}if(!t.items.length){let r=k("div","blockeditor-menu-empty");r.textContent="No matching blocks",s.push(r)}if(t.items.forEach((r,i)=>{let l=i===t.active,c=o?o.size===1&&r.key===[...o][0]:typeof r.checked=="boolean"?r.checked:null,d=t.mode==="turn"?"menuitemradio":typeof c=="boolean"?"menuitemcheckbox":e?"option":"menuitem",u=k("button",`blockeditor-menu-item${l?" is-active":""}`,{type:"button",role:d,tabindex:!e&&l?"0":"-1",id:`${this.menuId}-${i}`,"data-index":String(i),...d==="menuitemradio"?{}:{"aria-selected":l?"true":"false"},...typeof c=="boolean"?{"aria-checked":String(c)}:{}}),a=k("span","blockeditor-menu-icon");K[r.icon]?a.innerHTML=K[r.icon]:a.textContent=r.icon||"";let h=k("span","blockeditor-menu-label");if(h.textContent=r.label,r.description){let p=k("span","blockeditor-menu-text"),f=k("span","blockeditor-menu-desc");f.textContent=r.description,p.append(h,f),u.append(a,p)}else u.append(a,h);if(r.hint){let p=k("span","blockeditor-menu-hint");p.textContent=r.hint,u.append(p)}s.push(u)}),this.mediaNote&&t.mode!=="turn"&&t.mode!=="actions"&&t.mode!=="more"&&t.mode!=="external"){let r=k("div","blockeditor-menu-note",{role:"note"});r.textContent=this.mediaNote,s.push(r)}this.menuEl.replaceChildren(...s),e&&t.items.length?this.view.dom.setAttribute("aria-activedescendant",`${this.menuId}-${t.active}`):this.view.dom.removeAttribute("aria-activedescendant"),this.menuEl.hidden=!1,this.scrim.hidden=!1,this.scheduleLayout(),e||this.menuEl.querySelectorAll("button")[t.active]?.focus({preventScroll:!0})}pick(t){let e=this.menu,o=e?.items[t];if(!o)return;let s=this.view.state,r=e.slashAt!==null&&s.selection.head>=e.slashAt?{from:e.slashAt-1,to:s.selection.head}:null,i=e.mode==="insert"?e.anchorId?[e.anchorId]:[]:e.ids,l=i.some(d=>!d||this.idIndex(d)<0),c=i.length?this.idIndex(i[0]):-1;if(this.pickedFrom=e.anchor,this.closeMenu(),l&&e.mode!=="external"){P(this.view,Jo),this.view.focus();return}if(e.mode==="turn"){if(i.some(d=>!Q(s.doc.child(this.idIndex(d)),o))){P(this.view,he),this.view.focus();return}yn(this.view,o,i)}else e.mode==="actions"||e.mode==="more"||e.mode==="external"?(o.blocks&&this.selectCaretBlock(i),o.run(this.view,this,c>=0?c:this.blockIndex()),!this.menu&&o.focus!==!1&&this.view.focus()):o.insert==="ai"?this.onAiTool(this.view,r):wn(this.view,o,c>=0?c:this.blockIndex(),r)}key(t){if(It(t,this.view))return!1;let e=this.menu;if(!e)return t.key==="Escape"&&!t.metaKey&&!t.ctrlKey&&!t.altKey&&this.view.state.selection instanceof z&&this.leaveToToolbar(),!1;if((t.key==="Backspace"||t.key==="Delete")&&e.mode==="actions"&&this.view.state.selection instanceof z)return this.closeMenu(),this.view.focus(),Ft(this.view.state,this.view.dispatch),!0;if(t.key==="ArrowDown"||t.key==="ArrowUp")return e.items.length&&(e.active=(e.active+(t.key==="ArrowDown"?1:-1)+e.items.length)%e.items.length,this.renderMenu()),!0;if(t.key==="Enter")return e.items.length&&this.pick(e.active),!0;if(t.key==="Tab"&&e.slashAt===null)return this.closeMenu(),!1;if(t.key==="Escape"){let o=this.invoker();return e.slashAt!==null&&(this.dismissedSlash=this.slashKey(e.slashAt)),this.closeMenu(),o===this.view.dom?this.view.focus():o?.focus?.(),!0}return!1}slashQuery(){let t=this.menu;if(!t||t.slashAt===null)return;let{$head:e}=this.view.state.selection,o=e.start();if(e.pos<t.slashAt||t.slashAt<o||this.view.state.doc.textBetween(t.slashAt-1,t.slashAt)!=="/")return this.closeMenu();if(t.query=this.view.state.doc.textBetween(t.slashAt,e.pos),t.active=0,/\s$/.test(t.query)&&!this.menuItems(t).length)return this.closeMenu();this.renderMenu()}scheduleLayout(){this.frame!==null||this.destroyed||(this.frame=this.win.requestAnimationFrame(()=>{if(this.frame=null,this.destroyed)return;let t=this.measureLayout();this.paintLayout(t)}))}safeBottom(){return this.probe||(this.probe=k("div","blockeditor-safe-probe"),this.shell.append(this.probe)),parseFloat(this.win.getComputedStyle(this.probe).paddingBottom)||0}menuBox(t){let e=ce(this.win),o=Math.max(0,e.height-$*2),s=Math.min(280,Math.max(0,e.width-$*2)),r=this.menuEl.style.getPropertyValue("--blockeditor-pop-max");this.menuEl.style.removeProperty("--blockeditor-pop-max");let i=this.menuEl.offsetHeight||0;r&&this.menuEl.style.setProperty("--blockeditor-pop-max",r);let l=Math.min(i,o),c=Math.max(e.left+$,Math.min(t.left,e.left+e.width-$-s)),d=t.top-6-l;return d<e.top+$&&(d=Math.min(t.top+t.height+6,e.top+e.height-$-l)),{left:c,top:d,width:s,maxHeight:o}}measureLayout(){let t=this.view,e=t.state;this.settleHover();let o=this.shell.getBoundingClientRect(),s=t.dom.getBoundingClientRect(),r=this.gutterIndex(),i=0;for(let a=0;a<r;a++)i+=e.doc.child(a).nodeSize;let l=t.nodeDOM(i),c={textLeft:s.left-o.left,gutter:null,bubble:null,menu:null,bar:null,desk:!1};if(l&&l.getBoundingClientRect){let a=l.getBoundingClientRect(),h=parseFloat(getComputedStyle(l).lineHeight)||a.height;c.gutter={top:a.top-o.top+Math.min(a.height,h)/2,left:a.left-o.left}}let d=this.isPhone();if(d){let a=ce(this.win),h=this.dock.offsetHeight||os;c.bar={...Xo(a,this.dock.offsetWidth||ns,h,this.safeBottom()),height:h}}else c.desk=!!this.dock.style.left;let u=e.selection;if(!this.bubble.hidden&&!d){let a=t.coordsAtPos(u.from),h=t.coordsAtPos(u.to,-1),p=(Math.min(a.left,h.left)+Math.max(a.right,h.right))/2;c.bubble={x:p-o.left,y:Math.min(a.top,h.top)-o.top}}if(this.menu&&d){let a=this.menuBox(c.bar);c.menu={x:a.left,y:a.top,width:a.width,maxHeight:a.maxHeight}}else if(this.menu){let a=this.menu,h,p;if(a.slashAt!==null){let f=t.coordsAtPos(a.slashAt-1);h=f.left,p=f.bottom+6;let m=this.menuEl.offsetHeight;p+m>this.win.innerHeight-8&&f.top-6-m>=8&&(p=f.top-6-m)}else{let f=a.anchor===this.plus?l?.getBoundingClientRect?.()??s:a.anchor.getBoundingClientRect();h=f.left,p=f.bottom+6;let m=this.menuEl.offsetHeight;p+m>this.win.innerHeight-8&&f.top-6-m>=8&&(p=f.top-6-m)}c.menu={x:Math.max(8,Math.min(h-o.left,o.width-280)),y:p-o.top}}return c}paintLayout(t){if(t.bar)this.dock.style.left=`${t.bar.left}px`,this.dock.style.top=`${t.bar.top}px`,this.dock.style.width=`${t.bar.width}px`,this.grip.style.setProperty("--blockeditor-grip-lift",`${t.bar.height}px`);else{if(t.desk)for(let e of["left","top","width"])this.dock.style.removeProperty(e);this.grip.style.removeProperty("--blockeditor-grip-lift")}if(t.gutter)for(let e of[this.plus,this.grip])e.style.setProperty("--blockeditor-plus-top",`${t.gutter.top}px`),e.style.setProperty("--blockeditor-plus-left",`${t.gutter.left}px`);this.plus.style.setProperty("--blockeditor-text-left",`${t.textLeft}px`),t.bubble&&(this.bubble.style.setProperty("--blockeditor-pop-x",`${t.bubble.x}px`),this.bubble.style.setProperty("--blockeditor-pop-y",`${t.bubble.y}px`)),t.menu&&(this.menuEl.style.setProperty("--blockeditor-pop-x",`${t.menu.x}px`),this.menuEl.style.setProperty("--blockeditor-pop-y",`${t.menu.y}px`),t.menu.width!==void 0&&(this.menuEl.style.setProperty("--blockeditor-pop-width",`${t.menu.width}px`),this.menuEl.style.setProperty("--blockeditor-pop-max",`${t.menu.maxHeight}px`)))}get settingsAPI(){return globalThis.clay?.blockeditor?.settings??null}update(t,e){let o=!this.settingsAPI;if(this.settingsBtn.hidden!==o&&(this.settingsBtn.hidden=o),this.view=t,this.menu&&this.menu.slashAt===null&&e&&e.doc!==t.state.doc)if(this.menu.persist&&this.menu.anchor?.isConnected)this.scheduleLayout();else{let c=this.menuEl.contains(document.activeElement);this.closeMenu(),c&&t.focus()}let s=t.state,r=s.doc.child(this.blockIndex());this.turn.textContent=`${Ot(r).label} \u25BE`,this.bubbleTurn.textContent=this.turn.textContent;for(let c of this.dock.querySelectorAll("[data-cmd]"))c.setAttribute("aria-pressed",String(An(s,c.dataset.cmd)));let l=!!this.menu&&[this.bubbleTurn,this.bubbleMore].includes(this.menu.anchor)||!s.selection.empty&&s.selection instanceof $t&&t.hasFocus();if(this.bubble.hidden=!l,l)for(let c of this.bubble.querySelectorAll("[data-cmd]"))c.setAttribute("aria-pressed",String(An(s,c.dataset.cmd)));if(this.grip.classList.toggle("is-on",s.selection instanceof z),this.inRoving(this.roving)||this.setRoving(this.dockControls()[0]),!this.menu&&e&&e.doc!==s.doc&&!this.remote&&t.hasFocus()&&s.selection.empty){let c=s.selection.$head;if(c.depth===1&&c.parent.isTextblock&&!c.parent.type.spec.code){let d=s.doc.textBetween(c.start(),c.pos),u=/(?:^|\s)\/([a-z]*)$/i.exec(d),a=u?c.start()+u.index+u[0].indexOf("/")+1:null;u&&this.slashKey(a)!==this.dismissedSlash&&this.openMenu("insert",this.plus,a,null,c.parent.attrs.id)}}this.slashQuery(),this.scheduleLayout()}destroy(){this.destroyed=!0,this.frame!==null&&this.win.cancelAnimationFrame(this.frame),this.frame=null,clearTimeout(this.movedTimer),this.drag.destroy(),this.shell.removeEventListener("mousemove",this.onMove),this.shell.removeEventListener("mouseleave",this.onLeave),this.shell.removeEventListener("keydown",this.onKey),this.win.removeEventListener("resize",this.onResize),this.win.removeEventListener("scroll",this.onResize,!0),this.win.visualViewport?.removeEventListener("resize",this.onResize),this.win.visualViewport?.removeEventListener("scroll",this.onResize),document.removeEventListener("mousedown",this.onDocDown,!0),document.removeEventListener("keydown",this.onSettingsKey,!0);for(let t of[this.dock,this.plus,this.grip,this.bubble,this.scrim,this.menuEl,this.settingsEl,this.probe])t?.remove()}};function Qi({onAiTool:n=null,mediaNote:t=null}={}){let e=null;return new In({key:ps,view(o){return e=new de(o,n,t),pe.set(o,e),e},filterTransaction(o){return e&&o.docChanged&&(e.remote=!!o.getMeta(Me)),!0},props:{handleKeyDown(o,s){return e?s.key==="/"&&(s.metaKey||s.ctrlKey)&&!s.altKey&&!e.menu?(s.preventDefault(),e.openActions(),!0):e.key(s):!1},handleTextInput(o,s,r,i){if(i!=="/"||!e)return!1;let l=Ge(o,i);l&&(s=o.state.selection.from-1);let c=o.state.doc.resolve(s);if(c.depth!==1||!c.parent.isTextblock||c.parent.type.spec.code||c.parentOffset>0&&!/\s/.test(o.state.doc.textBetween(s-1,s,"",`
|
|
6
|
-
`)))return l;l||o.dispatch(o.state.tr.insertText("/",s,r).setMeta(xt,qt(o.state,s,r,"/")));let d=Math.min(o.state.doc.resolve(s).index(0),o.state.doc.childCount-1);return e.openMenu("insert",e.plus,s+1,null,o.state.doc.child(d).attrs.id),!0},handleDOMEvents:{keydown(o,s){return It(s,o)},blur(o){return e&&!(e.menu&&[e.bubbleTurn,e.bubbleMore].includes(e.menu.anchor))&&(e.bubble.hidden=!0),!1}}}})}var{Plugin:ms}=C,me=new WeakMap,gs=n=>typeof n.text=="function"?n.text():new Promise((t,e)=>{let o=new FileReader;o.onload=()=>t(o.result),o.onerror=()=>e(o.error),o.readAsText(n)});function Bt(n,t){let e=n.dom.ownerDocument,o=n.dom.parentElement.querySelector(".blockeditor-csv-error");o||(o=e.createElement("div"),o.className="blockeditor-csv-error",o.setAttribute("role","alert"),n.dom.parentElement.append(o)),o.textContent=t}function bs(n){let t=0,e=Ce(n,{maxBytes:Jt,newId:()=>y(t++<n.header.length?"c":"r")});if(!Object.keys(e.cols).length)return null;if(!Object.keys(e.rows).length){let o=Object.fromEntries(Object.keys(e.cols).map(s=>[s,""]));e.rows[y("r")]={pos:A(),cells:o}}return{node:Y(g,y(),{t:"table",pos:null,cols:e.cols,rows:e.rows}),truncated:e.truncated}}async function ks({kept:n,total:t}){let e=`This file has ${t} rows. The first ${n} fit in a table.`,o=globalThis.clay?.confirm,s=globalThis.clay?.modal;o||(o=(await import("./c-FYDKYW6E.js")).consent,s=(await import("./c-DXPOFLEJ.js")).default);let r=o(e);s&&(s.yes=`Insert first ${n} rows and attach the file`);try{return await r,!0}catch{return!1}}var ys=(n,t)=>{let e=-1;return n.forEach((o,s,r)=>{e<0&&o.type===g.nodes.table&&o.attrs.id===t&&(e=r)}),e},xs=n=>{let t=!0;return n.descendants(e=>(e.isText&&(t=!1),t)),t};function Ms(n,t,e,o){let s=n.state,r=ys(s.doc,e);if(r<0)return F(s,n.dispatch,t,null,o);let i=0;for(let u=0;u<r;u++)i+=s.doc.child(u).nodeSize;let l=s.doc.child(r);if(!xs(l)||o){let u=s.doc.maybeChild(r+1),a=l.attrs.parent??null,h=A(l.attrs.pos,u?.attrs.pos??null),p=t.type.create({...t.attrs,pos:h,parent:a},t.content),f=i+l.nodeSize,m=s.tr.insert(f,p);return o&&m.insert(f+p.nodeSize,o.type.create({...o.attrs,pos:A(h,u?.attrs.pos??null),parent:a},o.content)),m.setSelection(C.TextSelection.create(m.doc,f+3)),n.dispatch(w(m).scrollIntoView()),!0}let c=t.type.create({...t.attrs,id:l.attrs.id,pos:l.attrs.pos,parent:l.attrs.parent},t.content),d=s.tr.replaceWith(i,i+l.nodeSize,c);return d.setSelection(C.TextSelection.create(d.doc,i+3)),n.dispatch(w(d).scrollIntoView()),!0}async function fe(n,t,{upload:e,remove:o=null,table:s=null}={}){try{n.dom.parentElement.querySelector(".blockeditor-csv-error")?.remove();let r=ht(await gs(t)),i=bs(r);if(!i)return Bt(n,"Couldn't read this CSV: no columns."),!1;let l=null;if(i.truncated){if(!await ks(i.truncated))return!1;let u=await e?.(t),a=ke(u?.uploads?.[0]?.url);if(!u?.ok||!a)return Bt(n,"Couldn't attach the original CSV."),!1;l=g.nodes.file.create({id:y(),src:a,name:t.name,size:t.size??null,mime:t.type||"text/csv"})}if(n.isDestroyed)return!1;if(s)return Ms(n,i.node,s,l);let c=o?Kn(n.state):null;return o&&!c&&Ss(n,o.block),F(n.state,n.dispatch,i.node,c,l)}catch(r){return r instanceof Se?Bt(n,`Couldn't read this CSV: unclosed quote on line ${r.line}.`):Bt(n,"Couldn't read this CSV."),!1}}function Ct(n,t=null,e=null){let o=me.get(n);return o?(t&&Fn(n,t),o._remove=t?{...t,block:ws(n.state.doc,t.from)}:null,o._table=e,o.click(),!0):!1}var ws=(n,t)=>n.child(n.resolve(Math.max(0,Math.min(t,n.content.size))).index(0)).attrs.id;function Ss(n,t){let e=n.state,o=null;return e.doc.forEach((s,r)=>{o===null&&s.attrs.id===t&&(o=r)}),o===null?!1:(n.dispatch(e.tr.setSelection(C.TextSelection.near(e.doc.resolve(o)))),!0)}var Vn=n=>[...n].filter(t=>/\.csv$/i.test(t.name||"")||/^(text\/csv|application\/csv)$/i.test(t.type||""));function al({upload:n}){return new ms({view(t){let e=t.dom.ownerDocument.createElement("input");return e.type="file",e.accept=".csv,text/csv",e.hidden=!0,e.className="blockeditor-csv-input",t.dom.parentElement.append(e),me.set(t,e),e.addEventListener("change",()=>{let o=e.files?.[0];o&&fe(t,o,{upload:n,remove:e._remove,table:e._table}),e._remove=null,e._table=null,e.value=""}),{destroy(){me.delete(t),e.remove()}}},props:{handlePaste(t,e){let o=Vn(e.clipboardData?.files||[]);return o.length?(e.preventDefault(),fe(t,o[0],{upload:n}),!0):!1},handleDrop(t,e,o,s){let r=Vn(e.dataTransfer?.files||[]);if(s||!r.length)return!1;e.preventDefault();let i=t.posAtCoords({left:e.clientX,top:e.clientY});return i&&t.dispatch(t.state.tr.setSelection(C.TextSelection.near(t.state.doc.resolve(i.pos)))),fe(t,r[0],{upload:n}),!0}}})}export{Bs as a,qs as b,Je as c,Cs as d,As as e,al as f,hn as g,ni as h,Tt as i,It as j,Oi as k,vi as l,Ii as m,fr as n,mr as o,Ys as p,Js as q,Xs as r,te as s,Yi as t,Fn as u,Kn as v,Ji as w,Xi as x,Qi as y,Gt as z,bo as A,Lr as B,Dr as C,$r as D,_r as E,Br as F,ko as G,yo as H,Pr as I,Rr as J,Nr as K,Hr as L,zr as M,Fr as N,Kr as O,Vr as P,jr as Q,qr as R,Wr as S};
|
package/dist/m/c-K4M76VPM.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{d as Ae,h as Ve,i as qe}from"./c-TRS6TM6O.js";import{a as Ne,b as Pe}from"./c-HGG7M2S3.js";import{a as Ie,b as Oe}from"./c-PZ4XEPUP.js";import"./c-SFKI6OLM.js";import"./c-Q3XOWZEV.js";import"./c-RHMPKZZ7.js";import{e as ke,f as Ke,g as W,h as Ue,l as re,m as $e,n as p}from"./c-MR75YPRT.js";import"./c-4JZDZFF6.js";import{b as U,c as Z,e as l,f as Ye}from"./c-5RZNFTWD.js";import{b as He}from"./c-PKCCHJ5X.js";import{b as T,c as Fe}from"./c-NUHP2XDB.js";import{a as We,r as V}from"./c-VMXCX52Q.js";import"./c-4ASQPRQL.js";import"./c-GQ6F6IDK.js";import"./c-I2SCCUEW.js";import"./c-5VYOWDTI.js";import{f as Te}from"./c-P73XPAOA.js";import"./c-ZPI7M5U5.js";import"./c-WYFDLITL.js";import"./c-UGHH4MB3.js";import"./c-MZCOGNZL.js";import"./c-MFB74XVN.js";import"./c-LD6UVV5R.js";import"./c-PGSBXHUE.js";import"./c-KU3PX7LL.js";import"./c-EQ5NBOGA.js";import"./c-IJUK2GPW.js";import{f as _e}from"./c-C7SUMNMI.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-U4TWEIKZ.js";import"./c-PNZIJFG7.js";import"./c-XQXZAO7N.js";import"./c-S7LK4KUE.js";import"./c-MOP5KBWZ.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var E="light-dark(#D08A1E, #E3A33F)",lt=5e3,st=4e3,dt=500,ct={"another-tab":"in another tab","another-person":"by someone else","an-agent":"by an agent"},pt='<svg viewBox="0 0 12 12" width="12" height="12" aria-hidden="true"><path d="M2.5 9.5h7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="square"/></svg>',F=(e,t)=>`${e} ${t}${e===1?"":"s"}`,ut="This spot changed again. Review the latest edit or download your copy.",ft="A data value can't be put back from here. Download your copy to keep yours.",m="hidden",P=!1,S=[],J=new Set,M=new Set,h=null,Ee=0,I=null,v=null,le=null,u=null,R=!1,Y=!1,ve=!1,G=new Map,se=0,ae=!1,te=!1,b=null,j=null,L=null,Se=0,D=!1,de=0,ce=null,ne=null,k=[],x=[],oe=!1,pe=null,ue=null,s=null,B=null,q=new Map,z=()=>window.clay?.conflicts||null,Qe=()=>k.reduce((e,t)=>e+t.conflicts.length,0)+x.length,Le=()=>{let e=window.clay?.undo;return e&&typeof e.kept=="function"?e:null},fe=()=>z()?.list().filter(e=>!e.claimedBy&&e.kind!=="apply-incomplete")??[],De=()=>z()?.list().filter(e=>!e.claimedBy&&e.kind==="apply-incomplete")??[];function ze(){return I?"upgraded":h?"refused":fe().length?"replaced":De().length?"failed":k.length||x.length?"recovered":null}function f(e,t,n){let o=Fe(e,t,n);return t[0]==="all:initial"&&T(o,"color-scheme","inherit"),o.setAttribute("clay",ke),o}function _(e,t){return q.set(t,e),e}function ie(){if(!s)return;let e=window.visualViewport,t=e?Math.max(0,window.innerHeight-e.height-e.offsetTop):0;T(s,"bottom",`calc(${16+t}px + env(safe-area-inset-bottom,0px))`),ne&&T(ne,"max-height",`${Math.max(160,(e?.height||window.innerHeight)-32)}px`)}function ht(){s=f("div",["all:initial","position:fixed","left:50%","transform:translateX(-50%)","z-index:2147483001","display:none","flex-direction:column","align-items:center","max-width:calc(100vw - 24px)",`font:14px/1.5 ${U}`,`color:${l.ink}`,"text-align:left"]),s.setAttribute("data-clay-conflict",""),document.body.appendChild(s),window.visualViewport?.addEventListener("resize",ie),window.visualViewport?.addEventListener("scroll",ie)}function d(){if(ae)return;ae=!0;let e=()=>{ae=!1,w()};typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,16)}function w(){te&&(te=!1,h&&!V()&&(h=null));let e=ze();if(e?m==="hidden"&&(m="bar"):(m="hidden",P=!1,J.clear(),M.clear(),S=[],y(),ce=null,D=!1),!s){if(m==="hidden"&&!b||!document.body)return;ht()}!s.isConnected&&document.body&&document.body.appendChild(s);let t=document.activeElement,n=null;for(let[a,r]of q)r===t&&(n=a);let o=B?B.scrollTop:0;q=new Map,B=null,ne=null,s.replaceChildren(),b?s.append(wt(b)):m==="bar"?s.append(yt(e)):m==="panel"&&s.append(xt(e)),T(s,"display",b||m!=="hidden"?"flex":"none"),B&&(B.scrollTop=o);let i=L||n;i&&q.has(i)&&q.get(i).focus({preventScroll:!0}),b||(L=null),ie(),He(s)}function Xe(){return f("span",["all:initial","display:inline-block","flex:none","width:8px","height:8px","border-radius:50%",`background:${E}`])}function Ze(){return ct[h?.changedBy]||null}function gt(e,t){if(e==="upgraded")return I;if(e==="refused"){let n=Ze();return!n&&h.afterTimeout?"This page changed elsewhere, possibly by your own save that timed out. Your edits here are safe.":`This page changed ${n||"elsewhere"}. Your edits here are safe.`}return e==="failed"?"A sync update did not finish. Your edits here are safe.":e==="recovered"?`${F(t,"change")} replaced before this page loaded ${t===1?"is":"are"} still here.`:`Another edit replaced ${F(t,"change")}.`}function mt(e,t){return e==="upgraded"?I:e==="refused"?`This page changed ${Ze()||"elsewhere"}`:e==="failed"?"A sync update did not finish":e==="recovered"?`${F(t,"change")} kept from before this page loaded`:`Another edit replaced ${F(t,"change")}`}function wt(e){let t=re("div",["display:block",`border-left:3px solid ${l.teal}`,"padding:10px 14px","width:max-content","max-width:calc(100vw - 24px)"]);return t.setAttribute("role","status"),t.textContent=e,t}function yt(e){let t=e==="failed"?De().length:e==="recovered"?Qe():fe().length,n=re("div",["display:flex","flex-wrap:wrap","align-items:center","gap:10px 12px","padding:8px 8px 8px 14px","width:max-content","max-width:calc(100vw - 24px)"]),o=gt(e,t);return o!==ce&&(n.setAttribute("role",e==="refused"?"alert":"status"),ce=o),n.append(Xe(),p("span",[],o)),e==="upgraded"?(n.append(_(W("Reload",{variant:"primary",onClick:()=>window.location.reload()}),"reload")),n):(n.append(_(W("Review",{onClick:Dt}),"review")),n)}function $(e,t,{variant:n="default",onClick:o,push:i=!1}={}){let r=window.innerWidth<480?["flex:1 1 100%",...n==="primary"?["order:-1"]:[]]:i?["margin-left:auto"]:[];return _(W(e,{variant:n,onClick:o,extra:r}),t)}function A(e){return p("div",["display:block","padding:0 16px 12px",`color:${l["ink-2"]}`,"font-size:13.5px"],e)}function xt(e){let t=e==="replaced"?fe():e==="failed"?De():[],n=e==="refused"?fe():t,o=e==="recovered"?Qe():t.length;if(J.size)for(let c of t)J.has(c.id)||M.add(c.id);for(let c of[...M])t.some(N=>N.id===c)||M.delete(c);let i=mt(e,o),a=Math.max(160,(window.visualViewport?.height||window.innerHeight)-32),r=re("div",["display:flex","flex-direction:column","width:520px","max-width:calc(100vw - 24px)",`max-height:${a}px`]);ne=r,r.setAttribute("role","dialog"),r.setAttribute("aria-label",i);let g=f("div",["all:initial","display:flex","align-items:center","gap:8px","padding:12px 12px 8px 16px",`font:14px/1.5 ${U}`,`color:${l.ink}`]),K=_(p("b",["font-weight:600","font-size:14.5px","outline:none"],i),"title");K.setAttribute("tabindex","-1"),g.append(Xe(),K),e==="replaced"&&M.size&&g.append(p("span",[`font:600 10.5px/1 ${Z}`,"letter-spacing:.12em","text-transform:uppercase","padding:3px 6px",`color:color-mix(in srgb, ${l.brass} 80%, ${l.ink})`,`background:${l["brass-soft"]}`],`${M.size} new`));let X=f("span",["all:initial","display:inline-flex","margin-left:auto"]),Be=_(Ue(pt,{label:"Minimize",onClick:Je}),"minimize");if(Be.title="Minimize to the bar. Nothing is accepted until you choose.",X.append(Be),g.append(X),r.append(g),e==="recovered")return Et(r),r;if(e==="refused"){if(r.append(A("Your edits here are safe and not saved yet; nothing will be overwritten until you choose. Their version is not on this page, so there is no list of edits to compare. Keep yours, which saves over theirs, or accept theirs, which reloads the page and drops your unsaved edits.")),n.length&&r.append(A(`${F(n.length,"earlier replaced edit")} ${n.length===1?"is":"are"} also held in this tab. Download my copy includes them.`)),R&&r.append(A("That did not save either. Your edits here are still here.")),D&&r.append(A("Something changed on the page after your first press, so nothing was dropped. Press Accept theirs again if you still want their version.")),v){let c=f("div",["all:initial","display:block","margin:0 16px 12px","padding:8px 10px",`border-left:3px solid ${E}`,`background:color-mix(in srgb, ${E} 14%, transparent)`,`color:${l.ink}`,`font:13px/1.5 ${U}`]);c.append(f("b",["all:initial","font:inherit","font-weight:700","color:inherit"],"This drops your unsaved edits."),document.createTextNode(" Download your copy first if you might want them. Press again to confirm.")),r.append(c)}}else e==="upgraded"?r.append(A("Its layout and code changed with it, so this page stops here. Reload to see the new version.")):e==="failed"?r.append(A("Part of an update from elsewhere could not be applied, so this page may be missing some of it. Your edits here are safe. Download a copy of the page as you had it, or accept to keep the page as it is.")):r.append(A("The page is showing the other edit. This stays until you choose. You can also save a copy of the page as you had it."));let O=f("div",["all:initial","display:flex","flex-wrap:wrap","gap:8px","padding:0 16px 14px"]);if(e==="upgraded")return O.append($("Reload","reload",{variant:"primary",onClick:()=>window.location.reload(),push:!0})),r.append(O),S=[],r;let at=$(ve?"Try again":Y?"Downloaded":"Download my copy","download",{onClick:Bt});if(O.append(at),e==="refused"){let c=$(u==="overwrite"?"Saving\u2026":R?"Try again":"Keep mine","keep",{onClick:Pt});c.setDisabled(u==="overwrite"),O.append(c,$(v?"Yes, drop my edits":"Accept theirs","accept",{variant:"primary",onClick:Ft,push:!0}))}else{if(e==="replaced"){let c=z().hasPendingApply(),N=$(c?"Finishing the incoming edit\u2026":u==="revert"?"Putting back\u2026":"Revert to mine","revert",{onClick:Mt});N.setDisabled(c||u==="revert"),O.append(N)}O.append($("Accept theirs","accept",{variant:"primary",onClick:zt,push:!0}))}if(r.append(O),e==="replaced")if(P)r.append(vt(t));else{let c=f("div",["all:initial","display:flex","align-items:center","gap:8px",`border-top:1px solid ${l.line}`,"padding:8px 10px 8px 16px",`color:${l.muted}`,`font:13px/1.5 ${U}`]),N=f("span",["all:initial","display:inline-flex","margin-left:auto"]);N.append(_(W("See the edits",{small:!0,onClick:et}),"list")),c.append(f("span",["all:initial","font:inherit","color:inherit"],F(t.length,"edit")),N),r.append(c)}S=n.map(c=>c.id);for(let c of t)J.add(c.id);return r}function vt(e){let t=$e(["flex:1 1 auto","margin:0 16px 12px","min-height:0","overflow:auto",`background:${l.sunk}`,`border:1px solid ${l["line-2"]}`]),n=f("div",["all:initial","position:sticky","top:0","z-index:1","display:flex","align-items:center","gap:8px","padding:8px 12px",`background:${l.sunk}`,`border-bottom:1px solid ${l["line-2"]}`,`color:${l.muted}`,`font:600 10.5px/1 ${Z}`,"letter-spacing:.12em","text-transform:uppercase"]),o=f("span",["all:initial","display:inline-flex","margin-left:auto"]);return o.append(_(W("Hide",{small:!0,variant:"quiet",onClick:et}),"list")),n.append(f("span",["all:initial","font:inherit","color:inherit","letter-spacing:inherit","text-transform:inherit"],"Replaced edits"),o),t.append(n),e.forEach((i,a)=>t.append(St(i,a))),B=t,t}function Me(e){let t=e.context?.label||e.name||(e.context?.kind==="entry"?"Entry":"Edit");return e.context?.field?`${t} \xB7 ${e.context.field}`:t}var bt={"content-changed":"the page changed there","structure-changed":"the structure changed there","target-detached":"that part of the page is gone","duplicate-id":"another part of the page now has the same id",protected:"that region keeps its own history",unsupported:"this kind of step cannot be put back"},kt=e=>bt[e]||"the page changed there";function $t(e,t){let n=Array.isArray(e)?e:[];for(let o of n){if(!o||o.kind!=="text"&&o.kind!=="value")continue;let i=t==="redo"?o.after:o.before;if(typeof i=="string"&&i)return{text:i,id:o.target?.id??null}}for(let o of n){if(!o||o.kind!=="add"&&o.kind!=="remove")continue;let i=Array.isArray(o.nodes)?o.nodes.find(a=>typeof a?.html=="string"&&a.html):null;if(i)return{text:Ie(i.html).replace(/\s+/g," ").trim(),id:o.parent?.id??null}}for(let o of n){if(!o)continue;let i=t==="redo"?o.after:o.before;if(typeof i=="string"&&i)return{text:i,id:o.target?.id??null}}return{text:"",id:null}}function Tt(e){if(e==null||typeof document>"u")return"";let t=window.CSS?.escape?window.CSS.escape(String(e)):String(e).replace(/["\\]/g,"\\$&"),n=null;try{n=document.querySelector(`[data-id="${t}"]`)}catch{return""}if(!n)return"";let o=n.matches?.("input, textarea, select")?n.value:null;return(typeof o=="string"?o:n.textContent??"").replace(/\s+/g," ").trim()}function At(e){let t=e?.payload&&typeof e.payload=="object"?e.payload:{},n=String(e?.key??""),o={id:e?.id,revision:e?.revision,record:e,kind:e?.kind??"conflict"};if(n.startsWith("app:"))return{...o,name:typeof t.label=="string"&&t.label?t.label:n.slice(4),sentence:"",yours:typeof t.text=="string"?t.text:"",now:""};let i=t.direction==="redo"?"redo":"undo",g=((Array.isArray(t.context)?t.context:[]).find(X=>typeof X?.label=="string"&&X.label)??null)?.label||typeof t.label=="string"&&t.label||"Edit",K=$t(t.steps,i);return{...o,name:g,sentence:`The ${i} of "${g}" was not applied because ${kt(t.code)}.`,yours:K.text,now:K.id==null?"":Tt(K.id)}}function Ct(e){let t=Le();if(!e.record||typeof t?.reviewActionsFor!="function")return[];try{return(t.reviewActionsFor(e.record)||[]).filter(n=>n&&typeof n.run=="function"&&n.label)}catch{return[]}}var Ge=e=>({before:"",hit:e,after:"",cutBefore:!1,cutAfter:!1});function je(e){let t=p("div",["display:block","padding:8px 12px 10px"]),n=p("div",["display:flex","align-items:center","gap:8px","font-size:12.5px","font-weight:600",`color:${l["ink-2"]}`,"margin-bottom:4px"]);if(n.append(p("span",[],Me(e))),t.append(n),e.sentence&&t.append(p("div",["display:block","font-size:13px",`color:${l["ink-2"]}`],e.sentence)),e.yours){let i=p("div",["display:grid","grid-template-columns:44px 1fr","gap:3px 10px","align-items:start",`font:12.5px/1.5 ${Z}`,...e.sentence?["margin-top:4px"]:[]]);i.append(...he("Yours",Ge(e.yours),{mine:!0})),e.now&&i.append(...he("Now",Ge(e.now),{mine:!1})),t.append(i)}let o=f("div",["all:initial","display:flex","flex-wrap:wrap","gap:8px","margin-top:8px"]);return Ct(e).forEach((i,a)=>{let r=$(i.label,`run:${e.id}:${a}`,{onClick:()=>Nt(e,i,r)});o.append(r)}),o.append($(pe===e.id?"Copied":"Copy",`copy:${e.id}`,{onClick:()=>It(e)})),o.append($("Dismiss",`dismiss:${e.id}`,{onClick:()=>tt(e)})),t.append(o),t}function Et(e){e.append(A(k.length?"These copies were replaced before this page loaded. The page never puts them back on its own. Copy or download the ones you want; dismiss one when you no longer need it.":"These copies were kept because an undo could not be put back or the page set them aside. The page never puts them back on its own. Copy or download the ones you want; dismiss one when you no longer need it.")),oe&&e.append(A("That action did not run. The copy is still here."));let t=$e(["flex:1 1 auto","margin:0 16px 12px","min-height:0","overflow:auto",`background:${l.sunk}`,`border:1px solid ${l["line-2"]}`]);for(let o of k)for(let i of o.conflicts)t.append(je(i));for(let o of x)t.append(je(o));B=t,e.append(t);let n=f("div",["all:initial","display:flex","flex-wrap:wrap","gap:8px","padding:0 16px 14px"]);(k.some(o=>o.root)||x.length)&&n.append($(Y?"Downloaded":"Download my copy","download",{onClick:Ot})),e.append(n),S=[]}function he(e,t,{mine:n}){let o=[p("span",[`color:${l.faint}`,`font-family:${U}`],e)],i=p("span",["display:-webkit-box","-webkit-line-clamp:2","-webkit-box-orient:vertical","overflow:hidden","overflow-wrap:anywhere",...n?[`color:${l.ink}`]:[`color:${l.muted}`]]),a=(t.cutBefore?"\u2026":"")+t.before+t.hit+t.after+(t.cutAfter?"\u2026":"");i.title=a,t.before&&i.append(p("span",[`color:${l.faint}`],(t.cutBefore?"\u2026":"")+t.before));let r=p("span",n?[`background:color-mix(in srgb, ${E} 18%, transparent)`,"padding:0 4px"]:t.before||t.after?["text-decoration:underline",`text-decoration-color:color-mix(in srgb, ${E} 70%, transparent)`,"text-underline-offset:3px"]:[],t.hit||"(empty)");return i.append(r),t.after&&i.append(p("span",[`color:${l.faint}`],t.after+(t.cutAfter?"\u2026":""))),o.push(i),o}function St(e,t){let n=Oe(e),o=p("div",["display:block","padding:8px 12px 10px",...t?[`border-top:1px solid ${l.line}`]:[]]),i=p("div",["display:flex","align-items:center","gap:4px","font-size:12.5px","font-weight:600",`color:${l["ink-2"]}`,"margin-bottom:4px"]);if(i.append(p("span",[],n.name)),n.target&&n.target.isConnected&&i.append(_(Rt(n),`eye:${e.id}`)),o.append(i),n.sentence&&o.append(p("div",["display:block","font-size:13px",`color:${l["ink-2"]}`],n.sentence)),G.has(e.id)&&o.append(p("div",["display:block","font-size:13px","margin-top:4px",`color:${E}`],G.get(e.id))),n.yours){let a=p("div",["display:grid","grid-template-columns:44px 1fr","gap:3px 10px","align-items:start",`font:12.5px/1.5 ${Z}`,...n.sentence?["margin-top:4px"]:[]]);a.append(...he("Yours",n.yours,{mine:!0})),n.now&&a.append(...he("Now",n.now,{mine:!1})),o.append(a)}return o}function Rt(e){let t=["all:initial","color-scheme:inherit","box-sizing:border-box","cursor:pointer","display:inline-grid","place-items:center","width:22px","height:20px",`color:${l.ink}`],n=f("button",t);n.type="button",n.innerHTML=Ye.conflictEye,Ke(n.firstElementChild,16),n.setAttribute("aria-label",`Show ${e.name} on page`),n.title="Show on page";let o=i=>{n.style.cssText="";for(let a of[...t,...i]){let r=a.indexOf(":");n.style.setProperty(a.slice(0,r),a.slice(r+1),"important")}};return n.addEventListener("pointerenter",()=>o([`background:color-mix(in srgb, ${E} 16%, transparent)`])),n.addEventListener("pointerleave",()=>o([])),n.addEventListener("focus",()=>o([`outline:2px solid ${l.brass}`,"outline-offset:1px"])),n.addEventListener("blur",()=>o([])),n.addEventListener("click",()=>Lt(e.target)),n}var C=null,ge=null,me=null;function we(){clearTimeout(ge),window.removeEventListener("scroll",ee,!0),window.removeEventListener("resize",ee),C?.remove(),C=null,me=null}function ee(){if(!C||!me)return;let e=me.getBoundingClientRect();T(C,"left",`${e.left}px`),T(C,"top",`${e.top}px`),T(C,"width",`${e.width}px`),T(C,"height",`${e.height}px`)}function Lt(e){if(we(),!e||!e.isConnected)return;let n=!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches?"instant":"smooth",o=s?.getBoundingClientRect().top??0,i=s&&o>0?Math.max(0,window.innerHeight-o):0;if(!i)e.scrollIntoView?.({block:"center",behavior:n});else{e.scrollIntoView?.({block:"center",behavior:"instant"});let a=e.getBoundingClientRect(),r=window.innerHeight-i,g=a.height>r-24?a.top-12:a.top+a.height/2-r/2;window.scrollBy?.({top:g,behavior:n})}me=e,C=f("div",["all:initial","color-scheme:inherit","position:fixed","pointer-events:none","z-index:2147483001",`outline:2px solid ${E}`,"outline-offset:3px",`background:color-mix(in srgb, ${E} 14%, transparent)`]),document.body.appendChild(C),ee(),window.addEventListener("scroll",ee,!0),window.addEventListener("resize",ee),ge=setTimeout(we,2500)}function Dt(){I||(m="panel",L="title",w())}function Je(){we(),m="bar",y(),L="review",w()}function et(){P=!P,P&&M.clear(),w()}function zt(){let e=z(),t=S.filter(n=>{let o=e?.get(n);return o&&!o.claimedBy});e&&t.length&&e.acknowledge(t,{reason:"accepted"}),m=ze()?"bar":"hidden",L="review",d()}async function Mt(){let e=z();if(u||!e||e.hasPendingApply())return;let t=S.filter(r=>{let g=e.get(r);return g&&!g.claimedBy});if(!t.length)return;u="revert",w();let n=!0,o=r=>{n=!!s?.contains(r.target)};document.addEventListener("focus",o,!0);let i;try{let{revertConflicts:r}=await import("./c-GY4BREDT.js");i=await r(t)}catch(r){console.error("[clay] Revert to mine did not finish",r),i={revertedIds:[],blockedIds:t,saveResult:null}}finally{document.removeEventListener("focus",o,!0)}u=null;for(let r of i.blockedIds)G.set(r,z()?.get(r)?.kind==="json"?ft:ut);m=ze()?"bar":"hidden",L=n?"review":null;let a=i.saveResult&&(i.saveResult.ok||i.saveResult.msg==="Save already in progress");i.revertedIds.length&&a?be(`Put back ${F(i.revertedIds.length,"change")}. Saving.`):w()}var Q=null;async function Bt(){let e=z(),t=h?e?.list()??[]:S.map(o=>e?.get(o)).filter(Boolean),n=await Pe(t,{refused:!!h});ve=!n,Y=n,clearTimeout(Q),n&&(Q=setTimeout(()=>{Y=!1,d()},1200)),w()}async function H(){let e=null;if(Ae())try{e=await Ve()}catch{e=null}let t=Le(),n=null;if(t)try{n=await t.kept()}catch{n=null}let o=!1;if(e?.ok?(k=e.records,o=!0):!Ae()&&k.length&&(k=[],o=!0),n?.ok){let i=(Array.isArray(n.records)?n.records:[]).filter(r=>r&&r.supported!==!1).map(At);i.length===x.length&&i.every((r,g)=>r.id===x[g].id&&r.revision===x[g].revision)||(o=!0),x=i}else n&&x.length&&(x=[],o=!0);o&&d()}async function _t(e){try{return await navigator.clipboard.writeText(e),!0}catch{}let t=document.createElement("textarea");t.value=e,t.setAttribute("clay",ke),t.style.setProperty("position","fixed","important"),t.style.setProperty("opacity","0","important"),document.body?.append(t),t.select();let n=!1;try{n=document.execCommand?.("copy")===!0}catch{}return t.remove(),n}async function It(e){let t=e.record?e.yours:`${Me(e)}
|
|
2
|
-
|
|
3
|
-
Yours:
|
|
4
|
-
${e.yours}
|
|
5
|
-
|
|
6
|
-
Now:
|
|
7
|
-
${e.now}`;if(!await _t(t)){be("Could not copy. Select the text instead.");return}pe=e.id,clearTimeout(ue),ue=setTimeout(()=>{pe=null,d()},1200),w()}async function Ot(){let e=k.find(o=>o.root),t=[];for(let o of k)for(let i of o.conflicts)t.push({id:i.id,kind:i.kind,name:Me(i),yours:i.yours,now:i.now,sentence:i.sentence});for(let o of x)t.push({id:o.id,kind:o.kind,name:o.name,yours:o.yours,now:o.now,sentence:o.sentence});let n=await Ne({html:e?.root??null,edits:t});ve=!n,Y=n,clearTimeout(Q),n&&(Q=setTimeout(()=>{Y=!1,d()},1200)),w()}async function tt(e){let t;try{t=e.record?await Le()?.dismissKept(e.id,{revision:e.revision}):await qe([e.id]),t||={ok:!1}}catch{t={ok:!1}}t.ok||be("That copy could not be dismissed."),await H(),d()}var Ce=new Set;async function Nt(e,t,n=null){if(!Ce.has(t)){Ce.add(t),n&&(n.disabled=!0,n.setAttribute("aria-busy","true")),oe=!1;try{let o=null;try{o=await t.run(e.record)}catch{o=null}if(o?.ok===!0&&o?.dismiss===!0){await tt(e);return}oe=o?.ok!==!0,await H(),d()}finally{Ce.delete(t),n&&n.isConnected&&(n.disabled=!1,n.removeAttribute("aria-busy"))}}}function nt(e){e?.detail?.ok===!0&&(oe=!1,H(),d())}function y(){clearTimeout(le),le=null,v=null}async function Pt(){if(u)return;let e=++de;u="overwrite",R=!1,y(),w();let t;try{t=await window.clay?.save?.overwrite?.()}catch{t={ok:!1}}e!==de||u!=="overwrite"||(!t?.ok&&V()&&(u=null,R=!0),d())}function Ft(){if(!v){v={refusalGeneration:Ee,ledgerRevision:se,dirtyGeneration:Te().gen},Se=Date.now(),D=!1,clearTimeout(le),le=setTimeout(()=>{y(),d()},lt),w();return}if(Date.now()-Se<dt)return;let e=v;We({isCurrent:()=>v===e&&e.refusalGeneration===Ee&&e.ledgerRevision===se&&e.dirtyGeneration===Te().gen,reload:()=>window.location.reload()})||(y(),D=!0,w())}function be(e){b=e,clearTimeout(j),j=setTimeout(()=>{b=null,d()},st),w()}function Yt(){H(),d()}function ot(){se++,v&&y();for(let e of[...G.keys()])z()?.get(e)||G.delete(e);H(),d()}function it(e){I=e?.detail&&e.detail.message||"This document was upgraded.",b=null,clearTimeout(j),y(),u=null,R=!1,D=!1,m="bar",d()}function rt(e){let t=e?.detail||{};h={generation:++Ee,changedBy:t.changedBy,afterTimeout:!!t.afterTimeout,etag:t.etag??null},b=null,clearTimeout(j),y(),u=null,R=!1,de++,D=!1,d()}function Re(e){if(V()){e.type==="clay:save-saved"&&queueMicrotask(()=>{V()||Re(e)});return}let t=u==="overwrite"&&e.type==="clay:save-saved";(h||u)&&(h=null,u=null,R=!1,D=!1,y()),t?be("Saved your version over theirs."):d()}function Ht(){h&&(te=!0,d())}function Kt(){!h||V()||(h=null,u=null,R=!1,D=!1,y(),d())}function Ut(e){if(e.key!=="Escape")return;if(v){e.preventDefault(),y(),w();return}if(m!=="panel")return;let t=document.activeElement;t&&t!==document.body&&!s?.contains(t)||(e.preventDefault(),Je())}function Wt(e){!v||s?.contains(e.target)||(y(),d())}function Vt(e){b&&L&&!s?.contains(e.target)&&(L=null)}function qt(){xe=new AbortController;let{signal:e}=xe;document.addEventListener("clay:document-upgraded",it,{signal:e}),_e&&(document.addEventListener("clay:sync-conflicts-changed",ot,{signal:e}),document.addEventListener("clay:unsaved-state-changed",d,{signal:e}),document.addEventListener("clay:save-conflict",rt,{signal:e}),document.addEventListener("clay:save-saved",Re,{signal:e}),document.addEventListener("clay:save-conflict-resolved",Re,{signal:e}),document.addEventListener("clay:sync-applied",Ht,{signal:e}),document.addEventListener("clay:save-conflict-released",Kt,{signal:e}),document.addEventListener("keydown",Ut,{signal:e}),document.addEventListener("input",Wt,{capture:!0,signal:e}),document.addEventListener("focus",Vt,{capture:!0,signal:e}),document.addEventListener("clay:conflict-store-changed",Yt,{signal:e}),document.addEventListener("clay:undo-kept",nt,{signal:e}),z()?.size&&d(),H(),Promise.resolve(window.clay?.ready).catch(()=>{}).then(()=>{e.aborted||H()}))}var Gt={"clay:sync-conflicts-changed":ot,"clay:save-conflict":rt,"clay:document-upgraded":it,"clay:undo-kept":nt},ye=!1,xe=null;function an(e){ye||(ye=!0,qt());let t=e&&Gt[e.type];t&&t(e),h&&(te=!0,d())}function ln(){ye&&(ye=!1,xe?.abort(),xe=null,y(),clearTimeout(j),j=null,clearTimeout(Q),Q=null,clearTimeout(ue),ue=null,clearTimeout(ge),ge=null,we(),window.visualViewport?.removeEventListener("resize",ie),window.visualViewport?.removeEventListener("scroll",ie),s?.remove(),s=null,q=new Map,B=null,ne=null,m="hidden",P=!1,S=[],J.clear(),M.clear(),G.clear(),b=null,h=null,I=null,u=null,R=!1,de++,v=null,Se=0,D=!1,k=[],x=[],oe=!1,ae=!1,te=!1,L=null,ce=null,Y=!1,ve=!1,pe=null)}var sn={state:()=>({view:m,listOpen:P,renderedIds:S.slice(),refused:h,armed:v,busy:u,ledgerRevision:se,upgraded:I}),render:w,resetUpgrade:()=>{I=null}};export{E as WARN,sn as _test,d as schedule,an as start,ln as stop,be as toast};
|
package/dist/m/c-M7ITYKMF.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as d}from"./c-HGG7M2S3.js";import"./c-PZ4XEPUP.js";import"./c-SFKI6OLM.js";import"./c-Q3XOWZEV.js";import"./c-RHMPKZZ7.js";import{g as m,l as v,n as x,q as s}from"./c-MR75YPRT.js";import{a as p}from"./c-4JZDZFF6.js";import{e as f}from"./c-5RZNFTWD.js";import{b as w}from"./c-PKCCHJ5X.js";import{b as c}from"./c-NUHP2XDB.js";import{f as l}from"./c-C7SUMNMI.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-U4TWEIKZ.js";import"./c-PNZIJFG7.js";import"./c-XQXZAO7N.js";import"./c-S7LK4KUE.js";import"./c-MOP5KBWZ.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var $="Download a copy, then reduce its size; saving still works.",b="Download a copy to keep your work.",t=null,r=null,i=null,a=null;function h(e){return typeof e!="number"||!Number.isFinite(e)||e<0?"an unknown size":e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:e>=1024?`${Math.max(1,Math.round(e/1024))} KB`:`${e} bytes`}function y({bytes:e,maxBytes:n,state:S}){let u=`At the last save attempt: ${h(e)} of ${h(n)}.`;return S==="over"?`This host can't save a file this size. ${u} ${b}`:`This file is getting large. ${u} ${$}`}function o(){if(!t)return;let e=window.visualViewport,n=e?Math.max(0,window.innerHeight-e.height-e.offsetTop):0;c(t,"bottom",`calc(${16+n}px + env(safe-area-inset-bottom,0px))`)}async function z(){await d({})}function A(){t=v("div",["position:fixed","left:50%","transform:translateX(-50%)","z-index:2147483000","display:flex","align-items:center","gap:10px 12px","width:max-content","max-width:calc(100vw - 24px)","flex-wrap:wrap","padding:8px 8px 8px 14px","text-align:left",`color-scheme:${p()}`]),t.setAttribute("clay","editor-ui"),t.setAttribute("data-clay-save-size",""),t.setAttribute("role","status"),r=x("span",[],""),i=m("Download my copy",{small:!0,onClick:z}),s(i,!1,"inline-flex"),t.append(r,i),document.body.appendChild(t),o(),window.visualViewport?.addEventListener("resize",o),window.visualViewport?.addEventListener("scroll",o)}function M(e){t||A(),r.textContent=y(e),s(i,e.state==="over","inline-flex"),o(),w(t,{background:f.surface})}function E(){t&&(window.visualViewport?.removeEventListener("resize",o),window.visualViewport?.removeEventListener("scroll",o),t.remove(),t=null,r=null,i=null)}function g(e){let n=e?.detail;n&&(n.state==="near"||n.state==="over"?M(n):E())}function k(){l||L()}function N(e){l&&(a||=new AbortController,document.addEventListener("clay:save-size",g,{signal:a.signal}),document.addEventListener("clay:modechange",k,{signal:a.signal}),e?.type==="clay:save-size"&&g(e))}function L(){a?.abort(),a=null,E()}export{N as start,L as stop};
|
package/dist/m/c-MR75YPRT.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as M,e as y,g as a,h as g}from"./c-5RZNFTWD.js";import{a as x,b as R,c as E}from"./c-NUHP2XDB.js";var V=e=>!!e&&!e.bevel,z=(e,o,t)=>`color-mix(in srgb, ${e}, ${o} ${t}%)`,s=(e,o)=>o?[`${e}:${o}`]:[];function Y({hover:e=!1,active:o=!1,focus:t=!1,disabled:r=!1}={}){let n=["base"];return!r&&e&&n.push("hover"),!r&&o&&n.push("active"),t&&n.push("focus"),r&&n.push("disabled"),n}function N(e,o){return e.background&&e.background!==e.surface?o>8?z(e.background,e.text||"currentColor",6):e.background:e.surface?z(e.surface,e.text||"currentColor",o):e.background}function re(e,o,t){let r=[],n={primary:["accent","accentText"],danger:["danger","dangerText"]}[o];if(t==="base"&&r.push(...s("font-family",e.font),...s("border-radius",e.radius)),t==="base"&&e.buttonHeight&&r.push("height:auto","block-size:auto",`min-height:${e.buttonHeight}`),n){let i=e[n[0]],c=e[n[1]];t==="base"&&r.push(...s("background",i),...s("border-color",i),...s("color",c)),t==="hover"&&i&&c&&r.push(`background:${z(i,c,12)}`),t==="active"&&i&&r.push(`border-color:${i}`,...c?[`background:${z(i,c,20)}`]:[]),t==="disabled"&&i&&r.push("opacity:.55")}else o==="quiet"?(t==="base"&&r.push(...s("color",e.text)),t==="hover"&&r.push(...s("background",N(e,7))),t==="active"&&r.push(...s("background",N(e,12))),t==="disabled"&&r.push(...s("color",e.mutedText))):(t==="base"&&r.push(...s("background",e.surface),...s("color",e.text),...s("border-color",e.border)),t==="hover"&&r.push(...s("background",N(e,7))),t==="active"&&r.push(...s("background",N(e,12)),...s("border-color",e.border)),t==="disabled"&&r.push(...s("color",e.mutedText)));return t==="focus"&&e.accent&&r.push(`outline:2px solid ${e.accent}`),r}var X={input:(e,o)=>o==="base"?[...s("font-family",e.font),...s("color",e.text),...s("background",e.surface),...s("border-color",e.border),...s("border-radius",e.radius)]:o==="hover"?s("border-color",e.mutedText):o==="focus"&&e.accent?[`outline:2px solid ${e.accent}`,`border-color:${e.accent}`]:[],surface:(e,o)=>o==="base"?[...s("background",e.surface),...s("color",e.text),...s("border-color",e.border),...s("box-shadow",e.shadow),...s("border-radius",e.radius),...s("font-family",e.font)]:[],text:(e,o)=>o==="base"?[...s("color",e.text),...s("font-family",e.font)]:[],mutedText:(e,o)=>o==="base"?[...s("color",e.mutedText),...s("font-family",e.font)]:[],heading:(e,o)=>o==="base"?[...s("font-family",e.headingFont||e.font),...s("color",e.text)]:[],code:(e,o)=>o==="base"?s("color",e.text):[],well:(e,o)=>o==="base"?[...s("background",e.background),...e.border?[`border:1px solid ${e.border}`]:[],...s("border-radius",e.radius)]:[],overlay:(e,o)=>o==="base"?s("background",e.overlay):[],close:(e,o)=>o==="base"?[...s("background",e.surface),...s("color",e.mutedText),...s("border-color",e.border)]:o==="hover"?s("background",N(e,7)):o==="focus"&&e.accent?[`outline:2px solid ${e.accent}`]:[]};function ne(e,o,t="base"){return V(e)?o.startsWith("button.")?re(e.tokens,o.slice(7),t):X[o]?X[o](e.tokens,t):[]:[]}function C(e,o,t){return Y(t).flatMap(r=>ne(e,o,r))}function $(e,o,t){if(!V(e)||!o?.length)return[];let r=Y(t),n=[];for(let i of o){let c=e.parts[i];if(c)for(let d of r)for(let[b,L]of Object.entries(c[d]||{}))n.push(`${b}:${L}`)}return n}function w(e,o,t){V(o)&&t?.length&&e.setAttribute("data-clay-part",t.join(" "))}function O(e,o,t){if(!t)return[];let r=[...e].reverse().find(c=>c.startsWith(`${o}:`)),n=r?r.slice(o.length+1).trim():"",i=[`${o}:${t}px`];return n&&n!==`${t}px`&&i.push(`${o}:max(${t}px, ${n})`),i}var ie="no-save no-watch no-snapshot",m=["all:initial","color-scheme:inherit","direction:ltr","unicode-bidi:isolate"],J={normal:[`font:500 14px/1.45 ${M}`,"padding:4px 12px"],small:[`font:500 12.5px/1.45 ${M}`,"padding:1px 8px"]},P={default:{rest:a.button,hover:a.buttonHover,active:a.buttonActive},primary:{rest:a.buttonPrimary,hover:[...a.buttonPrimaryHoverBase,...a.buttonPrimaryHover],active:a.buttonPrimaryActive},quiet:{rest:[...a.button,...a.buttonQuiet],hover:[...a.buttonHover,...a.buttonQuietHover],active:[...a.buttonActive,...a.buttonQuietActive]},danger:{rest:a.buttonDanger,hover:a.buttonDangerHover,active:a.buttonDangerActive}},S=e=>typeof matchMedia=="function"&&matchMedia(e).matches,F=!1,_=new Set;typeof document<"u"&&(document.addEventListener("keydown",()=>{F=!0;for(let e of _)e()},!0),document.addEventListener("pointerdown",()=>{F=!1},!0));function A(e){return e.setAttribute("clay",ie),e}function B(e,o){e.style.cssText="",x(e,o)}var se="http://www.w3.org/2000/svg",ue=new Set(["path","circle","rect","line","polyline","polygon","ellipse","g"]);function ee(e,o){if(!(!e||e.namespaceURI!==se)){A(e),x(e,[...m,"color:inherit","display:block",`width:${o}px`,`height:${o}px`,"overflow:visible","visibility:visible","opacity:1","transform:none","pointer-events:none"]);for(let t of e.querySelectorAll("*")){if(!ue.has(t.localName))continue;let r=(i,c)=>t.getAttribute(i)??c,n=["visibility:visible","opacity:1","transform:none","display:inline",`fill:${r("fill",e.getAttribute("fill")??"currentColor")}`,`stroke:${r("stroke",e.getAttribute("stroke")??"none")}`];for(let i of["stroke-width","stroke-linecap","stroke-linejoin"]){let c=t.getAttribute(i)??e.getAttribute(i);c!==null&&n.push(`${i}:${c}`)}t.localName==="path"&&t.hasAttribute("d")&&n.push(`d:path("${t.getAttribute("d")}")`),x(t,n)}}}function oe(e,{variant:o="default",small:t=!1,onClick:r=null,extra:n=[],labelExtra:i=[],onState:c=null,theme:d=null,parts:b=[],labelParts:L=[]}={}){let h=P[o]||P.default,I=t?J.small:J.normal,j=S("(prefers-reduced-motion: reduce)"),q=S("(forced-colors: active)"),Z=S("(pointer: coarse)"),Q=S("(max-width: 760px)"),u={hovered:!1,pressed:!1,focusVisible:!1,disabled:!1},U=new Map,v=A(E("button",[]));v.type="button";let T=A(E("span",[]));T.textContent=e,v.append(T);let W=P[o]?o:"default",G=["button",`button.${W}`,...b],K=["buttonLabel",...L];w(v,d,G),w(T,d,K);function f(){let l=[...m,"box-sizing:border-box",...h.rest,...I];if(u.disabled?l.push(...a.buttonDisabled):(u.hovered&&l.push(...h.hover),u.pressed&&l.push(...h.active)),u.focusVisible&&l.push(...a.focus),q&&l.push(...g.forcedColors),Z&&l.push(...g.coarseButton),Q&&l.push("min-height:44px"),l.push(...n),V(d)){let k={hover:u.hovered,active:u.pressed,focus:u.focusVisible,disabled:u.disabled};l.push(...C(d,`button.${W}`,k),...$(d,G,k)),q&&l.push(...g.forcedColors),l.push(...O(l,"min-height",Q?44:Z?40:0))}for(let[k,te]of U)l.push(`${k}:${te}`);B(v,l);let p=[...m,"font:inherit","color:inherit",...a.buttonLabel];if(u.disabled?p.push(...a.buttonDisabledLabel):u.pressed&&p.push(...j?g.reducedMotion:a.buttonActiveLabel),p.push(...i),V(d)){let k={hover:u.hovered,active:u.pressed,focus:u.focusVisible,disabled:u.disabled};p.push(...$(d,K,k)),u.pressed&&!u.disabled&&j&&p.push(...g.reducedMotion)}B(T,p),c?.({...u})}function D(){let l;try{l=v.matches(":focus-visible")}catch{l=!1}let p=l||F;p!==u.focusVisible&&(u.focusVisible=p,f())}let H=(l,p)=>v.addEventListener(l,p);return H("pointerenter",()=>{u.hovered=!0,f()}),H("pointerleave",()=>{u.hovered=!1,u.pressed=!1,f()}),H("pointercancel",()=>{u.pressed=!1,f()}),H("pointerdown",l=>{l.button!==void 0&&l.button!==0||u.disabled||(u.pressed=!0,f())}),H("pointerup",()=>{u.pressed=!1,f()}),H("keydown",l=>{(l.key===" "||l.key==="Enter")&&!u.disabled&&(u.pressed=!0,f())}),H("keyup",()=>{u.pressed&&(u.pressed=!1,f())}),H("focus",()=>{_.add(D),u.focusVisible=!1,D(),f()}),H("blur",()=>{_.delete(D),u.focusVisible=!1,u.pressed=!1,f()}),H("click",l=>{if(u.pressed&&(u.pressed=!1,f()),u.disabled){l.preventDefault(),l.stopImmediatePropagation();return}r&&r(l)}),v.setLabel=l=>{T.textContent=l},v.setDisabled=l=>{u.disabled=!!l,u.disabled?v.setAttribute("aria-disabled","true"):v.removeAttribute("aria-disabled"),f()},v.isDisabled=()=>u.disabled,v.pin=l=>{for(let[p,k]of Object.entries(l))U.set(p,k);f()},f(),v}function ge(e,{label:o,onClick:t=null}){let r=oe("",{small:!0,onClick:t,extra:["width:26px","height:26px","padding:0","display:inline-grid","place-items:center"],labelExtra:["display:inline-grid","width:12px","height:12px"]});return r.firstChild.innerHTML=e,ee(r.firstChild.firstElementChild,12),r.setAttribute("aria-label",o),r.title=o,r}var le=["position:absolute","top:-1px","right:-1px","z-index:2","display:block","width:68px","height:68px","padding:0","margin:0","border:0","outline:none","background:transparent","clip-path:polygon(0 4%, 0 0, 100% 0, 100% 100%, 94% 100%)"],ce="M132 132.5 1 1.5h131v131Z",ae="M0 0h3v1.5h1.5V3H6v1.5h1.5V6H9v1.5h1.5V9H12v1.5h1.5V12H15v1.5h1.5V15H18v1.5h1.5V18H21v1.5h1.5V21H24v1.5h1.5V24H27v1.5h1.5V27H30v1.5h1.5V30H33v1.5h1.5V33H36v1.5h1.5V36H39v1.5h1.5V39H42v1.5h1.5V42H45v1.5h1.5V45H48v1.5h1.5V48H51v1.5h1.5V51H54v1.5h1.5V54H57v1.5h1.5V57H60v1.5h1.5V60H63v1.5h1.5V63H66v1.5h1.5V66H69v1.5h1.5V69H72v1.5h1.5V72H75v1.5h1.5V75H78v1.5h1.5V78H81v1.5h1.5V81H84v1.5h1.5V84H87v1.5h1.5V87H90v1.5h1.5V90H93v1.5h1.5V93H96v1.5h1.5V96H99v1.5h1.5V99h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v3h-3V132H129v-1.5h-1.5V129H126v-1.5h-1.5V126H123v-1.5h-1.5V123H120v-1.5h-1.5V120H117v-1.5h-1.5V117H114v-1.5h-1.5V114H111v-1.5h-1.5V111H108v-1.5h-1.5V108H105v-1.5h-1.5V105H102v-1.5h-1.5V102H99v-1.5h-1.5V99H96v-1.5h-1.5V96H93v-1.5h-1.5V93H90v-1.5h-1.5V90H87v-1.5h-1.5V87H84v-1.5h-1.5V84H81v-1.5h-1.5V81H78v-1.5h-1.5V78H75v-1.5h-1.5V75H72v-1.5h-1.5V72H69v-1.5h-1.5V69H66v-1.5h-1.5V66H63v-1.5h-1.5V63H60v-1.5h-1.5V60H57v-1.5h-1.5V57H54v-1.5h-1.5V54H51v-1.5h-1.5V51H48v-1.5h-1.5V48H45v-1.5h-1.5V45H42v-1.5h-1.5V42H39v-1.5h-1.5V39H36v-1.5h-1.5V36H33v-1.5h-1.5V33H30v-1.5h-1.5V30H27v-1.5h-1.5V27H24v-1.5h-1.5V24H21v-1.5h-1.5V21H18v-1.5h-1.5V18H15v-1.5h-1.5V15H12v-1.5h-1.5V12H9v-1.5H7.5V9H6V7.5H4.5V6H3V4.5H1.5V3H0V0ZM108.8 22h5.2v5.1h-2.6v2.6H109v2.6h-2.6v2.6h-2.6v2.5h-2.6v5.2h2.6V45h2.6v2.6h2.6v2.6h2.5v2.6h2.6V58h-5.1v-2.6h-2.6V53h-2.6v-2.6h-2.6v-2.6h-2.5v-2.6h-5.2v2.6H91v2.6h-2.6v2.6h-2.6v2.5h-2.6V58H78v-5.1h2.6v-2.6H83v-2.6h2.6v-2.6h2.6v-2.5h2.6v-5.2h-2.6V35h-2.6v-2.6h-2.6v-2.6h-2.5v-2.6H78V22h5.2v2.6h2.5V27h2.6v2.6h2.6v2.6h2.5v2.6h5.2v-2.6h2.5v-2.6h2.6v-2.6h2.6v-2.5h2.5V22Z";function me({label:e="Close",onClick:o=null}={}){let t=null,r=null,n=({hovered:d,focusVisible:b})=>{t&&(R(t,"fill",b?y.brass:d?y.face:y.sunk),R(r,"fill",b?y.face:y.ink))},i=oe("",{variant:"quiet",onClick:o,extra:le,labelExtra:["display:block","width:100%","height:100%"],onState:n});i.setAttribute("aria-label",e),i.firstChild.innerHTML=`<svg viewBox="0 0 134 134" xmlns="http://www.w3.org/2000/svg"><path d="${ce}"/><path fill-rule="evenodd" clip-rule="evenodd" d="${ae}"/></svg>`;let c=i.firstChild.firstElementChild;return ee(c,68),[t,r]=c.children,R(r,"fill-rule","evenodd"),R(r,"clip-rule","evenodd"),n({hovered:!1,focusVisible:!1}),i}function ke(e,o=[],{theme:t=null,parts:r=[],role:n=null}={}){let i=A(E(e,[...m,"box-sizing:border-box",...o]));if(V(t)){n&&x(i,C(t,n,{}));let c=[...["text","mutedText","well"].includes(n)?[n]:[],...r];x(i,$(t,c,{})),w(i,t,c)}return i}function ye(e,o){B(e,[...m,"box-sizing:border-box",...o])}function $e(e,o=[],{theme:t=null,parts:r=[],role:n="surface"}={}){let i=A(E(e,[...m,"box-sizing:border-box",...a.surface,`font:14px/1.5 ${M}`,...o]));return V(t)&&(n&&x(i,C(t,n,{})),x(i,$(t,r,{})),w(i,t,r)),i}function we(e=[],{theme:o=null,parts:t=[],role:r="well"}={}){let n=A(E("div",[...m,"display:block","box-sizing:border-box",`font:14px/1.5 ${M}`,`color:${y.ink}`,...a.recess,...e]));if(V(o)){r&&x(n,C(o,r,{}));let i=[...["text","mutedText","well"].includes(r)?[r]:[],...t];x(n,$(o,i,{})),w(n,o,i)}return n}function Ae(e,o=[],t,{theme:r=null,parts:n=[],role:i="text"}={}){let c=A(E(e,[...m,"font:inherit",`color:${y.ink}`,...o]));if(t!=null&&(c.textContent=t),V(r)){i&&x(c,C(r,i,{}));let d=[...["text","mutedText","well"].includes(i)?[i]:[],...n];x(c,$(r,d,{})),w(c,r,d)}return c}function de(e,{rules:o=[],theme:t=null,parts:r=[]}={}){let n={hovered:!1,focused:!1},i=S("(forced-colors: active)"),c=S("(pointer: coarse)");A(e);let d=["input",...r];w(e,t,d);function b(){let L=e.localName==="textarea"?e.style.getPropertyValue("height"):"",h=[...m,"box-sizing:border-box",...a.input];if(n.hovered&&h.push(...a.inputHover),n.focused&&h.push(...a.inputFocus),i&&h.push(...g.forcedColors),h.push(...o),c&&h.push(...g.coarseInput),V(t)){let I={hover:n.hovered&&!e.disabled,focus:n.focused,disabled:!!e.disabled};h.push(...C(t,"input",I),...$(t,d,I)),i&&h.push(...g.forcedColors),c&&h.push(...O(h,"font-size",16))}L&&h.push(`height:${L}`),B(e,h)}return e.addEventListener("pointerenter",()=>{n.hovered=!0,b()}),e.addEventListener("pointerleave",()=>{n.hovered=!1,b()}),e.addEventListener("focus",()=>{n.focused=!0,b()}),e.addEventListener("blur",()=>{n.focused=!1,b()}),b(),e}function Ee(e="input",o={}){let t=document.createElement(e);return e==="input"&&(t.type="text"),de(t,o)}function Ce(e,o,t="block"){e.hidden=!o,e.pin?e.pin({display:o?t:"none"}):R(e,"display",o?t:"none")}export{V as a,C as b,$ as c,w as d,ie as e,ee as f,oe as g,ge as h,me as i,ke as j,ye as k,$e as l,we as m,Ae as n,de as o,Ee as p,Ce as q};
|
package/dist/m/c-NFQFV7OP.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{e as a}from"./c-MR75YPRT.js";import{a as c}from"./c-4JZDZFF6.js";var s=e=>e.nodeType===1&&e.hasAttribute("data-clay-skin");function f(e){for(let t of e.childNodes)if(!s(t))return t;return null}function d(e,t){if(t.parentNode!==e)return!1;for(let n=t.previousSibling;n;n=n.previousSibling)if(!s(n))return!1;return!0}var u=new Map;function y(e){return`
|
|
2
|
-
@layer clay-skin{:is(${e.join(", ")}){color-scheme:${c()} !important}}`}function m(e,t,{roots:n}={}){u.set(e,{css:t,roots:n});let o=document.head||document.documentElement,i=null;for(let l of o.querySelectorAll("style[data-clay-skin]"))l.getAttribute("data-clay-skin")===e&&(i=l);i||(i=document.createElement("style"),i.setAttribute("clay",a),i.setAttribute("data-clay-skin",e));let r=n?t+y(n):t;return i.textContent!==r&&(i.textContent=r),d(o,i)||o.insertBefore(i,f(o)),i}typeof document<"u"&&document.addEventListener("clay:sync-applied",()=>{for(let[e,{css:t,roots:n}]of u)m(e,t,{roots:n})});export{m as a};
|
package/dist/m/c-NHXOBD6A.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{l as u}from"./c-MR75YPRT.js";import{a as d}from"./c-4JZDZFF6.js";import{b as c,e as n}from"./c-5RZNFTWD.js";import{b as s}from"./c-PKCCHJ5X.js";import{a as l,b as f}from"./c-5KXDKC5G.js";import{a,b as i}from"./c-NUHP2XDB.js";import"./c-VHNSBD2M.js";var p={error:"Couldn't save",offline:"Offline, will retry",blocked:"Can't save here",unavailable:"Can't store changes: download a copy"},x=new Set(["saving","pending","acknowledged"]),b=new Set(["saved","checkpointed"]),h=[`background:${n["ox-soft"]}`,`color:${n.ox}`,`border-color:color-mix(in srgb, ${n.ox} 28%, ${n["ox-soft"]})`],e=null;function g(){if(e&&e.isConnected)return e;let o=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return e=u("div",["position:fixed","right:16px","bottom:16px","z-index:2147483000","padding:4px 12px",`font:500 13px/1.6 ${c}`,"opacity:0",`transition:${o?"none":"opacity .25s"}`,"pointer-events:none",`color-scheme:${d()}`]),e.setAttribute("data-clay-indicator",""),e.setAttribute("role","status"),document.body.appendChild(e),e}function r(){e&&(i(e,"opacity","0"),e.textContent="",delete e.dataset.state)}function C(){r()}function S(o,m){if(x.has(o))return;if(b.has(o))return r();if(o==="retrying"){e?.dataset.state==="error"&&r();return}if(!p[o]||o==="error"&&m?.[f])return;if(l.toasts&&o!=="blocked"){r();return}let t=g();t.textContent=p[o],t.dataset.state=o,a(t,h),s(t,{background:null}),i(t,"opacity","1")}function k(){e?.remove(),e=null}export{k as remove,S as show,C as standDown};
|
package/dist/m/c-NVU3DORS.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"./c-SXNSSHPP.js";import"./c-QY7F6EN6.js";import"./c-MR75YPRT.js";import"./c-4JZDZFF6.js";import"./c-5RZNFTWD.js";import"./c-PKCCHJ5X.js";import"./c-NUHP2XDB.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";export{c as default,b as dismissPersistent,a as toastPersistent};
|
package/dist/m/c-PNZIJFG7.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as $}from"./c-XQXZAO7N.js";import{e as Y}from"./c-S7LK4KUE.js";import{c as z}from"./c-MOP5KBWZ.js";import{b as H,i as I,o as F}from"./c-HA6INT6J.js";import{c as D,h as A,j as T,k as _,n as C,o as L}from"./c-ICMAOOGK.js";var K=[],f=[],g=new WeakMap,w=null,U=null,b=0;function de(){return b}function G(e){return g.get(e)||null}var M=new WeakMap,v=null;function he(){return v}function me(e){v&&e&&(v.artifact=e)}var R=null,x=new Map;function ye(e){R=e}function ve(e){return e==null?null:x.get(e)??null}function Se(e){return e&&M.get(e)||null}function X(e){e&&(M.delete(e),x.delete(e.captureId))}function J(e){let t=o=>{if(o.hasAttribute("onbeforesave")||o.hasAttribute("onbeforesnapshot"))return!0;let r=o.localName==="template"&&o.content?o.content:o;for(let n of r.children)if(t(n))return!0;return!1};return e.nodeType===1?t(e):!1}function a(e){for(let t of e.querySelectorAll(L))t.remove()}function m(e,t){for(let o of e.querySelectorAll(`[${t}]`))if(a(e),!(o!==e&&!e.contains(o)))try{new Function(o.getAttribute(t)).call(o)}catch(r){console.error(`[${t}] handler failed:`,r)}}var O=null;function Ce(e){O=e}function xe(e){return O?.(e),e}function Ae(e){K.push(e)}function Te(e,{steps:t=null}={}){w=e,U=t}var j="http://www.w3.org/1999/xhtml";function P(e){let t=B(e);if(!t.length)return"<!DOCTYPE html>"+e.outerHTML;let o=V(t),r;try{r="<!DOCTYPE html>"+e.outerHTML}finally{for(let[n,c]of t)n.replaceChildren(...c)}for(let[n,c]of o)r=r.split(n).join(c);return r}function B(e){let t=[],o=r=>{for(let n of r.childNodes)if(n.nodeType===1){if(n.localName==="noscript"&&n.namespaceURI===j){let c=Array.from(n.childNodes);c.length&&c.every(l=>l.nodeType===3)&&t.push([n,c]);continue}o(n.localName==="template"&&n.content?n.content:n)}};return o(e),t}function ge(e){let t=[],o=r=>{for(let n of r.childNodes)if(n.nodeType===1){if(n.localName==="noscript"&&n.namespaceURI===j){n.firstChild&&t.push(n);continue}o(n.localName==="template"&&n.content?n.content:n)}};o(e.documentElement??e);for(let r of t)r.replaceChildren(r.ownerDocument.createTextNode(r.innerHTML));return e}function V(e){let t=Math.random().toString(36).slice(2);return e.map(([o,r],n)=>{let c=`\uE000clay-noscript-${t}-${n}\uE000`;return o.replaceChildren(o.ownerDocument.createTextNode(c)),[c,r.map(l=>l.data).join("")]})}function W(e,t){let o=v;v=e;try{return t()}finally{v=o}}function N(e,t=null){if(t&&R){let r=null;try{r=R(e)}catch{}r&&x.set(t.captureId,r)}let o=P(e);if(!w)return o;try{return W(t,()=>w(e,o))}catch(r){return console.error("clayjs: save renderer failed, sending the full serialization",r),o}}function we(e){f.push(e)}function h(e,t=!0){let o=window.__preventOnclone;window.__preventOnclone=!0;try{return e.cloneNode(t)}finally{window.__preventOnclone=o}}function k(e,t){let o=g.get(e);o&&g.set(t,o);let r=e.children,n=t.children;for(let c=0;c<r.length;c++)k(r[c],n[c])}function p({flushUndo:e=!0,authored:t=!0,forSave:o=!1,requestRefresh:r=!1,context:n=null}={}){e&&typeof window<"u"&&window.clay?.undo?.flush&&window.clay.undo.flush();let l=$(document.documentElement,{capability:"snapshot",provenance:g}).root;for(let u of K)a(l),u(l,{original:G,forSave:o,requestRefresh:r});return Y(l),O?.(l),a(l),n&&(n.authoredHandlers=J(l)),t&&m(l,"onbeforesnapshot"),a(l),D(l),F(l),H(l),l}function E(e,{authored:t=!0}={}){a(e),t&&m(e,"onbeforesave");for(let o of f)a(e),o(e);a(e);for(let o of e.querySelectorAll(A))o.remove();return q(e),e}function q(e){for(let t of e.querySelectorAll("[sap-error]"))t.removeAttribute("sap-error")}function Q({flushUndo:e=!0,authored:t=!0}={}){return E(p({flushUndo:e,authored:t}),{authored:t})}var Z=["style","class"];function ee(e){z(e);for(let t of Z){e.getAttribute(t)===""&&e.removeAttribute(t);for(let o of e.querySelectorAll(`[${t}=""]`))o.removeAttribute(t)}}function S(e){return ee(e),"<!DOCTYPE html>"+e.outerHTML}function Re({flushUndo:e=!0}={}){let t=p({flushUndo:e});m(t,"onbeforesave");for(let o of t.querySelectorAll(T))o.remove();for(let o of f)a(t),o(t);return a(t),S(t)}function ke({flushUndo:e=!0}={}){let t=p({flushUndo:e});m(t,"onbeforesave");for(let o of t.querySelectorAll(C))o.remove();for(let o of f)a(t),o(t);return a(t),S(t)}function Ee({flushUndo:e=!0}={}){let t=p({flushUndo:e});m(t,"onbeforesave");let o=t.querySelector(_)?h(t):null;o&&k(t,o);for(let c of t.querySelectorAll(T))c.remove();for(let c of f)a(t),c(t);a(t);let r=S(t),n=r;if(o){for(let c of o.querySelectorAll(C))c.remove();for(let c of f)a(o),c(o);a(o),n=S(o)}return{forComparison:r,forDirty:n}}function te({emitForSync:e=!0,flushUndo:t=!0,requestRefresh:o=!1,forRequest:r=!1,pageFormatMarker:n=null,sliced:c=!1}={}){if(!Number.isSafeInteger(b+1))throw new Error("Save capture identity exhausted");let l=++b,u=r?{captureId:l,authoredHandlers:!1,artifact:null}:null,s=p({flushUndo:t,forSave:e,requestRefresh:o,context:u});e&&document.dispatchEvent(new CustomEvent("clay:snapshot-ready",{detail:{documentElement:s,forSave:!0,captureId:l,sliced:c}})),m(s,"onbeforesave");let y=h(s);k(s,y);let d=s.querySelector(_)?h(s):null;d&&k(s,d);for(let i of f)a(s),i(s);a(s);for(let i of s.querySelectorAll(A))i.remove();q(s);for(let i of y.querySelectorAll(T))i.remove();for(let i of f)a(y),i(y);if(a(y),d){for(let i of d.querySelectorAll(C))i.remove();for(let i of f)a(d),i(d);a(d)}return{captureId:l,context:u,pageFormatMarker:n,clone:s,compareClone:y,dirtyClone:d,renderer:w,rendererSteps:U,pageStateReader:R,result:null}}function oe(e){if(!e.context||!e.pageStateReader)return;let t=null;try{t=e.pageStateReader(e.clone)}catch{}t&&x.set(e.captureId,t)}function re(e,{forSave:t,forComparison:o,forDirty:r}){let n={forSave:t,forComparison:o,forDirty:r,captureId:e.captureId};return e.context&&e.context.artifact&&M.set(n,e.context.artifact),e.result=n,n}function ne(e){X(e.result),x.delete(e.captureId),e.context&&(e.context.artifact=null),e.clone=e.compareClone=e.dirtyClone=null,e.result=null}function _e(e={}){let t=te(e);try{oe(t);let o=P(t.clone),r=t.compareClone?S(t.compareClone):null,n=t.dirtyClone?S(t.dirtyClone):r,c=t.renderer?W(t.context,()=>t.renderer(t.clone,o)):o;return re(t,{forSave:c,forComparison:r,forDirty:n})}catch(o){throw ne(t),o}}function be(){let e=p({flushUndo:!1});m(e,"onbeforesave");let t=h(e),o=new WeakMap;(function r(n,c){o.set(n,c);let l=n.children,u=c.children;for(let s=0;s<l.length;s++)r(l[s],u[s])})(t,e);for(let r of f)a(e),r(e);a(e);for(let r of e.querySelectorAll(A))r.remove();q(e);for(let r of t.querySelectorAll(C))r.remove();for(let r of f)a(t),r(t);return a(t),{saveClone:e,compareClone:t,pairMap:o}}function ce({emitForSync:e=!0}={}){let t=p();return e&&document.dispatchEvent(new CustomEvent("clay:snapshot-ready",{detail:{documentElement:t}})),N(E(t))}function Me(e){let t=h(e,!1);for(let u of I)t.removeAttribute(u);let o=t.outerHTML,r=`</${t.localName}>`,n=B(e),c=n.length?V(n):[],l;try{l=e.innerHTML}finally{for(let[u,s]of n)u.replaceChildren(...s)}for(let[u,s]of c)l=l.split(u).join(s);return"<!DOCTYPE html>"+o.slice(0,o.length-r.length)+l+r}function Oe(e){return h(e)}function Pe(){return p().querySelector("body").innerHTML}function Ne({transform:e=null,flushUndo:t=!0}={}){if(!e&&t)return ce({emitForSync:!1});let o=p({flushUndo:t});if(e){let r=e(o);if(r&&typeof r.then=="function")throw new TypeError("getHTML: the transform must be synchronous")}return N(E(o))}function qe(e,{prepared:t=!1}={}){let o=h(e);return P(t?o:E(o,{authored:!1}))}function He(){return N(Q({flushUndo:!1,authored:!1}))}export{de as a,G as b,he as c,me as d,ye as e,ve as f,Se as g,X as h,Ce as i,xe as j,Ae as k,Te as l,P as m,B as n,ge as o,V as p,W as q,we as r,h as s,p as t,Q as u,ee as v,S as w,Re as x,ke as y,Ee as z,te as A,oe as B,re as C,ne as D,_e as E,be as F,ce as G,Me as H,Oe as I,Pe as J,Ne as K,qe as L,He as M};
|