@panphora/clayjs 1.24.1 → 1.25.1
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 +6060 -4662
- package/dist/m/attrs/{refetch-on-save-DPGJJMGN.js → refetch-on-save-5CBFUJUF.js} +1 -1
- package/dist/m/attrs/save-freeze-PUYX32AK.js +1 -0
- package/dist/m/{c-HIX5H5L7.js → c-2A2ATCIH.js} +1 -1
- package/dist/m/{c-BOMQIQ3V.js → c-2EFMJYGJ.js} +1 -1
- package/dist/m/{c-MP6S4AZU.js → c-2GB34XL4.js} +2 -2
- package/dist/m/c-2TJCFPX4.js +4 -0
- package/dist/m/c-33SS5A4Y.js +1 -0
- package/dist/m/{c-PCNJETUA.js → c-34J5HC7N.js} +1 -1
- package/dist/m/{c-AT7GLQGV.js → c-3AAQJAKJ.js} +1 -1
- package/dist/m/c-3F3AADKG.js +1 -0
- package/dist/m/{c-HL6BLJNA.js → c-3WX5FABT.js} +1 -1
- package/dist/m/c-3XNTQQEJ.js +1 -0
- package/dist/m/{c-ZRGEN6QQ.js → c-3Y234AUB.js} +2 -2
- package/dist/m/{c-SUXHUL7U.js → c-42RLKGEY.js} +1 -1
- package/dist/m/{c-2BLVA6IN.js → c-44WITKWQ.js} +1 -1
- package/dist/m/c-47M4QHCK.js +1 -0
- package/dist/m/{c-UOUUI265.js → c-4M2T676V.js} +1 -1
- package/dist/m/{c-SXGEWPFC.js → c-4NAYDOWH.js} +1 -1
- package/dist/m/{c-OCYG4NBQ.js → c-4OZZ7ENT.js} +2 -2
- package/dist/m/{c-UOOIF2AL.js → c-5IIEOPIV.js} +1 -1
- package/dist/m/{c-YDW4VCHP.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-7V6MGMX2.js → c-7Z2625LX.js} +1 -1
- package/dist/m/{c-CTGRDT6E.js → c-A3OKSYRI.js} +1 -1
- package/dist/m/{c-GNI7WHKF.js → c-A5IYL7JI.js} +1 -1
- package/dist/m/c-A5LASUEZ.js +1 -0
- package/dist/m/c-AQVQKFKB.js +1 -0
- package/dist/m/{c-FLEIU6CG.js → c-ASGHHLFX.js} +1 -1
- package/dist/m/c-ASMLERFA.js +7 -0
- package/dist/m/{c-LUXAB2XI.js → c-AZM34SPO.js} +1 -1
- package/dist/m/{c-ZFO5RW6G.js → c-BHLYQGTA.js} +1 -1
- package/dist/m/{c-C5AKJVRH.js → c-BJ2RRQBQ.js} +1 -1
- package/dist/m/{c-FVPNX2GO.js → c-C27EVUQ6.js} +1 -1
- package/dist/m/{c-DFKBGSN2.js → c-C5UGNOC2.js} +1 -1
- package/dist/m/c-C6DXZIXD.js +1 -0
- package/dist/m/{c-EDE45NM7.js → c-C7SUMNMI.js} +1 -1
- package/dist/m/{c-STRI73GQ.js → c-CL5LSATX.js} +1 -1
- package/dist/m/c-CPRGR2II.js +1 -0
- package/dist/m/{c-NFQFV7OP.js → c-D2OPWOWO.js} +1 -1
- package/dist/m/{c-ZKKAF4UT.js → c-D4N4UJCQ.js} +2 -2
- package/dist/m/{c-6LEYVQJK.js → c-DAUQ6JZ3.js} +1 -1
- package/dist/m/{c-ZGCO4J3H.js → c-DDCYVLGG.js} +1 -1
- package/dist/m/{c-KQKKIVLW.js → c-DVMDYRAE.js} +1 -1
- package/dist/m/{c-OG6GFSUX.js → c-DYTBSJBI.js} +1 -1
- package/dist/m/{c-P2HKMJAW.js → c-EAV7A6BT.js} +1 -1
- package/dist/m/{c-X75G43SZ.js → c-EEWPNUM2.js} +1 -1
- package/dist/m/c-EHAR4RJJ.js +3 -0
- package/dist/m/c-EIDZHQHZ.js +1 -0
- package/dist/m/c-ELXMSEN5.js +1 -0
- package/dist/m/{c-QQFHEODI.js → c-EQ5NBOGA.js} +1 -1
- package/dist/m/c-FC5RUFPR.js +1 -0
- package/dist/m/{c-ND3Q2G2I.js → c-GFASNR55.js} +1 -1
- package/dist/m/{c-A4L7APIU.js → c-GNFDX6SU.js} +1 -1
- package/dist/m/{c-LATNQ6Q5.js → c-H3M6UDNV.js} +1 -1
- package/dist/m/{c-YLHTD3KX.js → c-H4M2T4A6.js} +1 -1
- package/dist/m/{c-DDS23EY6.js → c-HXGNH6GY.js} +1 -1
- package/dist/m/{c-PDBNCJCT.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-6IJEVE6B.js → c-KU3PX7LL.js} +1 -1
- package/dist/m/{c-YYMZWQLR.js → c-L6KVXPBO.js} +1 -1
- package/dist/m/{c-CV4T65JE.js → c-LUBZU4AZ.js} +4 -4
- package/dist/m/{c-5FXEKU4Y.js → c-LYNLY3MR.js} +1 -1
- package/dist/m/{c-NQAPWM7O.js → c-MHTO3QAD.js} +1 -1
- package/dist/m/{c-HDVH3MVC.js → c-MKAUC6DB.js} +1 -1
- package/dist/m/c-MLMJUNRV.js +1 -0
- package/dist/m/c-MMEVDN6D.js +1 -0
- package/dist/m/c-MOP5KBWZ.js +1 -0
- package/dist/m/{c-LA2BW7UY.js → c-MZCOGNZL.js} +1 -1
- package/dist/m/{c-XW5TIYYB.js → c-N4GEJMXW.js} +1 -1
- package/dist/m/{c-RS77ODLY.js → c-NL4I4KNG.js} +1 -1
- package/dist/m/{c-2PVGJFI5.js → c-NW4ZFKCY.js} +1 -1
- package/dist/m/{c-PYG2NGWU.js → c-O3DPFZCE.js} +1 -1
- package/dist/m/c-O4YIDULY.js +1 -0
- package/dist/m/{c-LTSPHVAK.js → c-OBMZASYQ.js} +1 -1
- package/dist/m/c-OZOACVUD.js +1 -0
- package/dist/m/{c-YK2L436K.js → c-OZVK3TFI.js} +1 -1
- package/dist/m/c-P73XPAOA.js +1 -0
- package/dist/m/c-PP3CUF3U.js +1 -0
- package/dist/m/{c-B7GOFGQR.js → c-Q2CB57UG.js} +1 -1
- package/dist/m/{c-TWCXBWS3.js → c-QCDVDZIR.js} +1 -1
- package/dist/m/{c-LSVN3OLG.js → c-QL4NYM2L.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-SMLAJASY.js +1 -0
- package/dist/m/{c-MQKSKQHG.js → c-STAPQ2X6.js} +1 -1
- package/dist/m/c-SYVF6ZMF.js +1 -0
- package/dist/m/{c-SE3SIY7Y.js → c-T5IWJOMW.js} +1 -1
- package/dist/m/{c-DD26VXAP.js → c-T7LOTEWO.js} +1 -1
- package/dist/m/{c-47IBJGPQ.js → c-TWB5ZQU4.js} +1 -1
- package/dist/m/c-U35T5NAY.js +1 -0
- package/dist/m/c-U4TWEIKZ.js +1 -0
- package/dist/m/c-UW6MMZ4V.js +1 -0
- package/dist/m/{c-JWDCQL6J.js → c-V5L6HWVL.js} +1 -1
- package/dist/m/c-VGG3UR7I.js +1 -0
- package/dist/m/{c-CZHTXGJS.js → c-VO6RSFCO.js} +1 -1
- package/dist/m/c-VU4WEWPH.js +4 -0
- package/dist/m/c-W7LWCJHD.js +1 -0
- package/dist/m/c-WOJ2RTV4.js +1 -0
- package/dist/m/{c-T3P3AXEW.js → c-WOWGGNCJ.js} +1 -1
- package/dist/m/{c-6RGEQNVV.js → c-XCOQNISP.js} +1 -1
- package/dist/m/{c-SGGGCIVD.js → c-XS7G6U3Z.js} +1 -1
- package/dist/m/{c-4PO3YGDC.js → c-Y3J5LDKB.js} +1 -1
- package/dist/m/c-Y3MPVURA.js +1 -0
- package/dist/m/c-Y6HH7LTM.js +1 -0
- package/dist/m/{c-RO73MKKR.js → c-YRDKVEGR.js} +1 -1
- package/dist/m/{c-FEC6LGFF.js → c-YZGWSCMT.js} +1 -1
- package/dist/m/{c-7CM4GMTS.js → c-ZJ7726FO.js} +1 -1
- package/dist/m/{c-SKMIR5HQ.js → c-ZPI7M5U5.js} +1 -1
- package/dist/m/core/{admin-attrs-ONRWVXPK.js → admin-attrs-43JBA6JB.js} +1 -1
- package/dist/m/core/{autosave-TBKAAAFB.js → autosave-HD7Y7UNV.js} +1 -1
- package/dist/m/core/{conflict-notice-FOEE6I7E.js → conflict-notice-Y2NTMDGJ.js} +1 -1
- package/dist/m/core/draft-mode-M5XNYBMY.js +1 -0
- package/dist/m/core/{host-permission-X4BENZEU.js → host-permission-5BYP24GC.js} +1 -1
- package/dist/m/core/{is-edit-mode-FFHCQ5DR.js → is-edit-mode-73OXKK5H.js} +1 -1
- package/dist/m/core/{persist-6ILUR34S.js → persist-MX3VYVBN.js} +1 -1
- package/dist/m/core/{recovery-APWADU4K.js → recovery-VZF7RJZF.js} +1 -1
- package/dist/m/core/{save-6HT2LABE.js → save-JZ7R4ET2.js} +1 -1
- package/dist/m/core/{save-core-EVMNZQ4V.js → save-core-I4N6S4ED.js} +1 -1
- package/dist/m/core/{site-edits-G4BOZMV4.js → site-edits-TIJDPG6H.js} +1 -1
- package/dist/m/core/{snapshot-FJP5IJL3.js → snapshot-N5MKDGNI.js} +1 -1
- package/dist/m/core/unsaved-warning-BP6ZY3PG.js +1 -0
- package/dist/m/events/{index-B6TGDYMG.js → index-YKQIBZE5.js} +1 -1
- package/dist/m/internals/index-3LAVREAU.js +1 -0
- package/dist/m/lib/{cache-bust-NH7VBWHO.js → cache-bust-BL4KUQAJ.js} +1 -1
- package/dist/m/{loader-GLLVDUZA.js → loader-7ORQVRCK.js} +1 -1
- package/dist/m/manifest-A27A4278.js +1 -0
- package/dist/m/manifest-edit-E8A61EB4.js +1 -0
- package/dist/m/manifest.json +1608 -1498
- package/dist/m/options/{options-55LQHSJ4.js → options-LKIZ7YTG.js} +1 -1
- package/dist/m/page/{editor-KAZDJNND.js → editor-HS2CAV3W.js} +5 -5
- package/dist/m/plugins/{ai-edit-LABECCSN.js → ai-edit-WDV2GLDU.js} +2 -2
- package/dist/m/plugins/{cms-T2HLI7JG.js → cms-4KET6RZT.js} +9 -9
- package/dist/m/plugins/{demo-T7B4RIKL.js → demo-LMCMBILC.js} +1 -1
- package/dist/m/plugins/{derive-6LPJOCAV.js → derive-R4USHZ7P.js} +1 -1
- package/dist/m/plugins/{indicator-J4ABFARX.js → indicator-OLPZ4WFI.js} +1 -1
- package/dist/m/plugins/{live-PGBIEMGB.js → live-CO4VJS46.js} +1 -1
- package/dist/m/plugins/{menu-YZL3X2AJ.js → menu-ESEFQARM.js} +1 -1
- package/dist/m/plugins/{page-WOCNX2IN.js → page-L3VKIQU2.js} +2 -2
- package/dist/m/plugins/{page-view-SJODOOGE.js → page-view-6KNTXABH.js} +1 -1
- package/dist/m/plugins/{people-C4TCWFOQ.js → people-EBWE337I.js} +1 -1
- package/dist/m/plugins/quickcrop-VNRXGRPC.js +26 -0
- package/dist/m/plugins/{richclay-Y2NV44NA.js → richclay-V6WKJTUF.js} +17 -17
- package/dist/m/plugins/sortable-BAG3MSWS.js +1 -0
- package/dist/m/plugins/{source-YK7MO23W.js → source-OYHDXKTB.js} +1 -1
- package/dist/m/plugins/undo-WUK2NLBA.js +1 -0
- package/dist/m/plugins/{upgrade-NNTJBSK2.js → upgrade-SZQJYEQQ.js} +1 -1
- package/dist/m/plugins/{upload-ZKKJV76X.js → upload-NZET3DNQ.js} +1 -1
- package/dist/m/plugins/visitor-drafts-ZE6PCAFP.js +20 -0
- package/dist/m/plugins/{visitor-drafts-owner-LHUHFU3L.js → visitor-drafts-owner-TLECTYWS.js} +1 -1
- package/dist/m/plugins/{visitor-menu-FY4KM2SW.js → visitor-menu-5XY57JQA.js} +1 -1
- package/dist/m/plugins/wire-S5ATC4QI.js +1 -0
- package/dist/m/reader-core-AHOAP5DH.js +77 -0
- package/dist/m/sync/live-sync-DX4K5GDB.js +1 -0
- package/dist/m/ui/index-G7ZJXNMG.js +1 -0
- package/dist/m/vendor/sap-core.vendor-5TWOJYVM.js +7 -0
- package/dist/offline-manifest.json +844 -784
- 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 +27 -37
- package/entries/clay-data.js +1 -1
- package/entries/sap.js +6 -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/draft-mode.js +5 -0
- package/src/core/save-core.js +10 -10
- package/src/core/save.js +10 -10
- package/src/core/snapshot.js +56 -43
- package/src/core/stale-host-notice.js +20 -7
- package/src/lib/dirty-gate.js +19 -0
- package/src/page/editor.js +10 -4
- package/src/page/import-markdown.js +22 -8
- package/src/page/save-projection.js +1 -1
- package/src/plugins/menu/visitor.js +33 -1
- package/src/plugins/quickcrop.js +128 -69
- package/src/plugins/sortable.js +25 -9
- package/src/plugins/visitor-drafts/commit.js +50 -3
- package/src/plugins/visitor-drafts/idb.js +8 -2
- package/src/plugins/visitor-drafts/recovery-menu.js +118 -0
- package/src/plugins/visitor-drafts/recovery.js +64 -0
- package/src/plugins/visitor-drafts/session.js +61 -13
- package/src/plugins/visitor-drafts/store.js +44 -8
- package/src/plugins/visitor-drafts.js +34 -5
- 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 +1 -1
- package/src/sync/wire-profile.js +9 -4
- 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/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 +6 -5
- package/src/vendor/sap-ownership.vendor.js +181 -11
- package/tool-generation/context.md +69 -0
- package/tool-generation/system.md +2 -2
- package/dist/m/attrs/save-freeze-JZHKRQLR.js +0 -1
- package/dist/m/c-277QP5ET.js +0 -1
- package/dist/m/c-3UW5EJ77.js +0 -1
- package/dist/m/c-42ZNV7LI.js +0 -7
- package/dist/m/c-6Q6RGFBF.js +0 -1
- package/dist/m/c-APGHGDZM.js +0 -1
- package/dist/m/c-BGN7RCTJ.js +0 -1
- package/dist/m/c-CJ7QYEWI.js +0 -1
- package/dist/m/c-CVSWLX3X.js +0 -1
- package/dist/m/c-DXPOFLEJ.js +0 -1
- package/dist/m/c-EILLN2H2.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-FYDKYW6E.js +0 -1
- package/dist/m/c-HKSLOVU4.js +0 -1
- package/dist/m/c-HTLYXCUH.js +0 -1
- package/dist/m/c-IUL7PU4P.js +0 -1
- package/dist/m/c-JQF2EUCG.js +0 -1
- package/dist/m/c-MFOSMAVM.js +0 -3
- package/dist/m/c-MQYEDF3Q.js +0 -1
- package/dist/m/c-MR75YPRT.js +0 -1
- package/dist/m/c-NHXOBD6A.js +0 -1
- package/dist/m/c-NVU3DORS.js +0 -1
- package/dist/m/c-OYHI67B6.js +0 -1
- package/dist/m/c-PWJSJEJU.js +0 -1
- package/dist/m/c-QENKN7QI.js +0 -1
- package/dist/m/c-R23UHMXG.js +0 -1
- package/dist/m/c-SGH3UTF3.js +0 -1
- package/dist/m/c-SXNSSHPP.js +0 -1
- package/dist/m/c-TFLRT5JX.js +0 -1
- package/dist/m/c-U4NTUVDZ.js +0 -1
- package/dist/m/c-V2U3F4QX.js +0 -1
- package/dist/m/c-VG5XIN4T.js +0 -1
- package/dist/m/c-VHSMPITY.js +0 -1
- package/dist/m/c-Z4G2UK6T.js +0 -4
- package/dist/m/core/draft-mode-4MCL3LYI.js +0 -1
- package/dist/m/core/unsaved-warning-ITZDIZ2I.js +0 -1
- package/dist/m/internals/index-HS3CQDFW.js +0 -1
- package/dist/m/manifest-50FF1C45.js +0 -1
- package/dist/m/manifest-edit-BE1A621D.js +0 -1
- package/dist/m/plugins/quickcrop-X5MRIBAP.js +0 -26
- package/dist/m/plugins/sortable-XCHQG65Z.js +0 -1
- package/dist/m/plugins/undo-VLRBQNPN.js +0 -1
- package/dist/m/plugins/visitor-drafts-RTZNONHT.js +0 -20
- package/dist/m/plugins/wire-M2NR354P.js +0 -1
- package/dist/m/reader-core-T2S3JC4E.js +0 -77
- package/dist/m/sync/live-sync-Z64YREWQ.js +0 -1
- package/dist/m/ui/index-MGTWOW2C.js +0 -1
- package/dist/m/vendor/sap-core.vendor-QAEPMETX.js +0 -6
- /package/dist/m/{c-QTTJYJMA.js → c-FILLTJA7.js} +0 -0
- /package/dist/m/plugins/{quickcrop-X5MRIBAP.js.LEGAL.txt → quickcrop-VNRXGRPC.js.LEGAL.txt} +0 -0
- /package/dist/m/plugins/{richclay-Y2NV44NA.js.LEGAL.txt → richclay-V6WKJTUF.js.LEGAL.txt} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Et,b as Jn,c as Ro,f as Yo}from"./c-A4L7APIU.js";import{a as $o}from"./c-WNOLMHI2.js";import{a as Bn,b as Dn,e as zn,f as it,g as Mt}from"./c-LS7IVQVW.js";import{a as Po}from"./c-NEQRFC4O.js";import{a as Ct,b as It,c as At,d as ze,e as Ye,f as Kn,g as Tt,h as Hn,i as qn,j as Pt,l as Rt}from"./c-NICICT4P.js";import{b as Co,c as Io}from"./c-LTSPHVAK.js";import"./c-IW6GGOU2.js";import"./c-HAWFNBYG.js";import{a as Re,b as _n,p as Nn,q as Fn,u as Ao,v as To}from"./c-CV4T65JE.js";import{A as An,B as Be,C as ot,D as Tn,E as Pn,F as De,G as Rn,H as Pe,I as rt,J as Yn,K as St,L as $n,M as st,N as jn,O as ue,a as Le,b as kt,c as wn,d as xn,f as Sn,j as On,m as Eo,p as Mn,q as En,r as Cn,s as In,t as vt,v as wt,x as xt,z as Oe}from"./c-GO635CRU.js";import{a as me,b as hn,d as Me,e as _e,g as xe,h as Ne,i as ye,j as Ee,k as gn,l as Fe,m as nt,n as be,o as bn,p as kn,q as Se,r as Ce,u as yn,v as vn,w as yt}from"./c-V2V5FKXX.js";import"./c-DD26VXAP.js";import"./c-CTGRDT6E.js";import"./c-7K4SCQB7.js";import{f as tn,g as nn,i as Qe,j as Ze,k as dt,n as pt,o as et,p as on,s as mt,t as rn,u as Ae,v as de,w as Te,x as ht,y as sn}from"./c-WMRJKQ2V.js";import{g as Ln,p as Ot}from"./c-ZRGEN6QQ.js";import{E as gt,H as bt,I as dn,d as fe,fa as je,g as an,i as fn,ia as pn,ja as mn,na as tt,w as un}from"./c-OH2FPYSY.js";import{b as Vt}from"./c-QY7F6EN6.js";import"./c-FSQXFG5T.js";import{b as pe,c as ln,e as cn}from"./c-RETTCOWO.js";import{a as Wt,b as Ut,d as ft}from"./c-WCG6AKA7.js";import{a as Zt}from"./c-TCCA5BZN.js";import"./c-3LDGIBMN.js";import{c as en}from"./c-57XDY6HC.js";import"./c-YK2L436K.js";import{a as Qt,b as ut}from"./c-QTTJYJMA.js";import"./c-TWCXBWS3.js";import{e as Gt,f as Xt}from"./c-HTLYXCUH.js";import"./c-4ASQPRQL.js";import"./c-GQ6F6IDK.js";import"./c-I2SCCUEW.js";import"./c-5VYOWDTI.js";import"./c-6Q6RGFBF.js";import"./c-SKMIR5HQ.js";import"./c-WYFDLITL.js";import"./c-UGHH4MB3.js";import"./c-LA2BW7UY.js";import"./c-MFOSMAVM.js";import"./c-LD6UVV5R.js";import"./c-PGSBXHUE.js";import"./c-6IJEVE6B.js";import"./c-QQFHEODI.js";import"./c-IJUK2GPW.js";import"./c-EDE45NM7.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-U4NTUVDZ.js";import"./c-PWJSJEJU.js";import"./c-XQXZAO7N.js";import"./c-S7LK4KUE.js";import"./c-VG5XIN4T.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var Yt=new Set(["paragraph","heading","list_item","callout","quote","code_block","toggle"]),Je=(e,o)=>je(e)===je(o);function $t(e,o){let n=o.createElement("article");return n.setAttribute("data-blockeditor",""),n.innerHTML=mn([{id:e.id,t:"paragraph",c:e.c??"",...e.m?{m:e.m}:{}}],{clean:pn(o)}),n}function jo(e,o){let n=new Map(e.map((f,u)=>[f.id,u])),r=new Set(o.map(f=>f.id)),t=new Map,s=0;return o.map(f=>{let u=n.get(f.id);if(u!==void 0)return s=u+1,f;let p={c:f.c??"",m:f.m??null};for(let b=s;b<e.length;b++){let C=e[b];if(!(r.has(C.id)||C.t!==f.t||!Je({c:C.c??"",m:C.m??null},p)))return r.add(C.id),s=b+1,t.set(f.id,C.id),{...f,id:C.id}}return f}).map(f=>t.has(f.parent)?{...f,parent:t.get(f.parent)}:f)}function jt(e,o,n,{doc:r,merge3:t,mergeJson:s}){let a=[],f=jo(e,n),u=new Map(e.map(c=>[c.id,c])),p=new Map(o.map(c=>[c.id,c])),b=new Map(f.map(c=>[c.id,c])),C=o.map(c=>({...c})),M=f.map(c=>({...c})),h=new Map(C.map(c=>[c.id,c])),w=new Map(M.map(c=>[c.id,c]));for(let[c,E]of u){let i=p.get(c),g=b.get(c);if(!i||!g||!Yt.has(E.t)||!Yt.has(i.t)||!Yt.has(g.t))continue;let A={c:E.c??"",m:E.m??null},z={c:i.c??"",m:i.m??null},W={c:g.c??"",m:g.m??null};if(Je(z,A)||Je(W,A)||Je(z,W))continue;if(E.t==="code_block"){for(let P of[h.get(c),w.get(c)])P.c=g.c??"",g.m?P.m=g.m:delete P.m;a.push({id:c,kind:"text",local:i.c??"",remote:g.c??""});continue}let T=t($t(E,r),$t(i,r),$t(g,r));for(let P of T.conflicts)a.push({id:c,kind:"text",local:P.local?.textContent??null,remote:P.remote?.textContent??null});let[U]=tt(T.root,{seed:"",known:new Map});for(let P of[h.get(c),w.get(c)])P.c=U.c,U.m?P.m=U.m:delete P.m}let y=o.map(c=>c.id);for(let[c,E]of u){let i=h.get(c);if(!i||b.has(c)||Je(p.get(c),E))continue;let g=y.indexOf(c)-1;for(;g>=0&&!w.has(y[g]);)g--;let A=g<0?0:M.findIndex(z=>z.id===y[g])+1;M.splice(A,0,{...i}),w.set(c,M[A]),a.push({id:c,kind:"kept-edit"})}let N=s(e,C,M,{onConflict:c=>a.push({kind:"field",path:c.path,local:c.local,remote:c.remote,resolved:c.resolved})}),B=new Set(N.map(c=>c.id)),v=c=>(p.get(c)??u.get(c)??b.get(c))?.parent??null,L=N.map(c=>{let E=c.parent??null;for(;E&&!B.has(E);)E=v(E);return E===(c.parent??null)?c:{...c,parent:E}}),Y=new Map(L.map(c=>[c.id,c.parent??null])),$=c=>{let E=new Set([c]);for(let i=Y.get(c);i;i=Y.get(i)){if(E.has(i))return!0;E.add(i)}return!1};for(let c of L)if($(c.id)){for(let E of[p.get(c.id)?.parent,u.get(c.id)?.parent,null])if(Y.set(c.id,E&&B.has(E)?E:null),!$(c.id))break}return{items:L.map(c=>(c.parent??null)===Y.get(c.id)?c:{...c,parent:Y.get(c.id)}),conflicts:a}}var _o=e=>{try{return Zt(e)}catch{return null}},$e={ok:!0,outcome:"unchanged"},Ke={ok:!1,outcome:"disposed",reason:"adoption-disposed"},He={ok:!1,outcome:"refused",reason:"adoption-refused"},No={ok:!1,outcome:"refused",reason:"adoption-timeout"},Fo={ok:!1,outcome:"error",reason:"adoption-error"},Lo={ok:!0,outcome:"writer-adopts"},Vn=e=>({ok:!0,outcome:"adopted",counts:e}),Wn=1e4;function Bo(e){let o=e.querySelector(Et);return o?{article:o.cloneNode(!0),tags:Jn(e).map(n=>_o(n.textContent))}:null}function Un(e){return new Promise(o=>{if(!e.composing)return o();e.dom.addEventListener("compositionend",()=>setTimeout(()=>o(Un(e)),0),{once:!0})})}function Do({view:e,source:o=null,ready:n=Promise.resolve(),isAdopter:r=()=>!0,idle:t=()=>Un(e),requestCheckpoint:s=()=>{},notice:a=()=>{},snapshot:f=()=>null,mergeTagless:u=!1,seeded:p=!1,writerReady:b=()=>Promise.resolve(),adopted:C=()=>{},hold:M=Gt,release:h=Xt,holdMs:w=Wn,doc:y=document}){let N=o?o.article.innerHTML:null,B=o?o.article:null,v=new Map,L=P=>{let I=P.getAttribute("data-rev");if(!I)return;let K=v.get(I)??[];v.delete(I),v.set(I,K),K.push(P),K.length>10&&K.shift(),v.size>20&&v.delete(v.keys().next().value)};B&&L(B);let Y=Promise.resolve(),$=!1,x,c=new Promise(P=>x=P);async function E(){let P,I=new Promise(K=>{P=setTimeout(()=>K("timeout"),w)});try{return await Promise.race([Promise.resolve(n).then(()=>t()).then(()=>"ready"),c.then(()=>"disposed"),I])}finally{clearTimeout(P)}}function i(P,I,K,j){let{HyperMorph:Q}=Qt(),le=jt(K,I,j,{doc:y,merge3:Q.merge3,mergeJson:Q.mergeJson}),ee=le.conflicts.filter(D=>D.kind==="text"||D.kind==="field"),m=ee.length?f():null,l=Dn(P,le.items,I),k=l&&zn(e.state,l);if(!k)return null;e.dispatch(k),e.dispatch(cn.closeHistory(e.state.tr));let F={edited:l.edited.size,created:l.created.size,deleted:l.deleted.length,moved:l.reordered},{displaced:R}=k.getMeta(Bn);return Object.keys(R).length&&(F.displaced=R),ee.length&&(F.conflicts=ee),m&&(F.copy=m),F}async function g(P){if(u&&!P.tags.length)return A(P);let I=Mt(P.article,P.tags);if(I.kind==="unbased"&&console.warn("page: the article and its data changed together; kept the data"),I.kind!=="adopt")return $e;if(!r())return Lo;M();try{if(await ut(),$)return Ke;if(!r())return He;let K=await E();if(K==="timeout"&&console.warn("page: gave up waiting for the editor; the hand edit was not adopted"),K==="disposed"||$)return Ke;if(K!=="ready")return No;if(!r())return He;let j=gt(e.state.doc),Q=i(j,it(j,y),I.baseItems,I.parsed);return Q?(C(I.A),Vn(Q)):$e}finally{h()}}async function A(P){let I=P.article.getAttribute("data-rev"),K=I&&v.get(I)||[],j=K.at(-1)??B;if(K.slice(0,-1).some(Q=>Q.innerHTML===P.article.innerHTML)||(L(P.article),B=P.article,!j)||j.outerHTML===P.article.outerHTML)return $e;M();try{if(await ut(),$)return Ke;if(!r())return He;if(await b(),$)return Ke;if(!r())return He;if(await E()==="disposed"||$)return Ke;if(!r())return He;let le=gt(e.state.doc),ee=it(le,y),m=new Map(ee.map(F=>[F.id,F])),l=F=>tt(F,{seed:F.getAttribute("data-rev")??"",known:m}),k=i(le,ee,l(j),l(P.article));return k?Vn(k):$e}finally{h()}}async function z(P){try{return await g(P)}catch(I){return console.error("page: adoption failed",I),Fo}}let W=null;function T(P,I=!1){return Y=Y.then(()=>z(P)).then(K=>(I&&(W=K),!K.ok||K.outcome!=="adopted"||(s(),a(K.counts),y.dispatchEvent(new CustomEvent("clay:blockeditor-adopted",{detail:K.counts}))),K)),Y}function U(P){let I=P.detail?.html;if($||typeof I!="string")return;let K=Bo(new DOMParser().parseFromString(I,"text/html"));!K||K.article.innerHTML===N||(N=K.article.innerHTML,T(K))}return y.addEventListener("clay:sync-applied",U),o&&!p&&T(o,!0),{idle:async()=>(await Y,W),saved(P){if(!u||typeof P!="string")return;let I=new DOMParser().parseFromString(P,"text/html").querySelector(Et);I&&(L(I),B=I)},dispose(){$=!0,x(),y.removeEventListener("clay:sync-applied",U)}}}var Gn='["text-delete",',Xn=(e,o)=>o instanceof rn&&o._item&&o._item.parent===e.attrs&&typeof o._item.parentSub=="string"?o._item.parentSub:null,Qn=e=>e==="t"||e==="parent",_t=e=>e.content instanceof de&&e.content.embed.b!==void 0,zo=e=>e.content instanceof ht||e.content instanceof Te||e.content instanceof de&&e.content.embed.b===void 0,eo=e=>{let o=new Map;for(let n of e.stops)(o.get(n.client)??o.set(n.client,[]).get(n.client)).push(n);return o},to=(e,o)=>{let n=o.get(e.id.client);if(!n)return!1;let r=e.id.clock,t=r+e.length;return n.some(s=>s.clock<t&&r<s.clock+s.len)},Jo=(e,o)=>{for(let n=e.left;n;n=n.left){if(n.deleted){if(to(n,o))return null;continue}if(_t(n))return n}return null};function no(e,o,n){let r=eo(n),t=new Set,s=new Set,a=o.changed.get(e.tableFields)??new Set;for(let[h,w]of o.changed){if(h===e.flow)continue;if(h===e.attrs){if(!o.local)return null;for(let N of w){let B=e.attrs.get(N);if(!(B instanceof Ae)||B._item.left||B._item.id.clock<(o.beforeState.get(B._item.id.client)??0))return null;s.add(N)}if(s.size>1)return null;continue}if(h===e.tableFields){for(let N of w){let B=e.tableFields.has(N)?En(N,e.tableFields.get(N)):null;if(B===null)return null;t.add(B)}continue}let y=Xn(e,h);if(y!==null){for(let N of w)if(Qn(N))return null;t.add(y);continue}if(h!==e.gone)return null;for(let N of w)if(typeof N!="string"||!N.startsWith(Gn))return null}let f=e.ydoc.store,u=null,p=null,b=!1,C=h=>{if(!(h instanceof sn))return!1;if(h.parent===e.gone)return typeof h.parentSub=="string"&&h.parentSub.startsWith(Gn);if(h.parent===e.tableFields)return a.has(h.parentSub);if(h.parent===e.attrs)return s.has(h.parentSub);if(h.parent!==e.flow){let y=Xn(e,h.parent);return y!==null&&(s.has(y)||t.has(y)&&!Qn(h.parentSub))}if(_t(h)){if(h.deleted||!s.has(h.content.embed.b))return!1;p=h}else if(!zo(h))return!1;let w=Jo(h,r);return!w||u&&w!==u?!1:(u=w,h.content instanceof Te&&(b=!0),!0)};for(let[h,w]of o.afterState)for(let y=o.beforeState.get(h)??0;y<w;){let N=et(f,{client:h,clock:y});if(!C(N))return null;y=N.id.clock+N.length}let M=!1;for(let[h,w]of o.deleteSet.clients)for(let{clock:y,len:N}of w)for(let B=y;B<y+N;){let v=et(f,{client:h,clock:B});if(!C(v))return null;M=!0,B=v.id.clock+v.length}return s.size&&!p?null:u||t.size?{marker:u,split:p,deleted:M,formats:b,fields:t,remote:!o.local}:null}var Ko=e=>{for(let o in e)return{...e};return null};function oo(e,o,n,r=null){let t=r?.formats??!0,s=r?.split??null,a=o.visible,f=-1,u=0;for(let i=0;i<a.length;i++){let g=a[i];if(g.brk&&g.brk.client===n.id.client&&g.brk.clock===n.id.clock){f=i;break}u+=g.len}if(f<0)return null;let p=a[f];if(p.implicit||p.atom||p.opaque||p.recovered||p.hide)return null;let b=p.runs.findIndex(i=>i.hole!==void 0);if(b>=0&&t||p.items&&o.copies.has(p.baseId))return null;let C=eo(o),M={...p.fmtIn??{}},h=null,w={...p,runs:[],len:1};p.items&&(w.items=[]);let y=w,N=!1,B=Ye(o.holes,u),v=B+1;for(let i=n.right;i;i=i.right){if(i.deleted){if(to(i,C))return null;continue}if(_t(i)&&(i!==s||y!==w)){N=!0;break}let g=v;i.countable&&(v+=i.length);let A=i.content;if(i===s){let z=A.embed.b,W=e.attrs.get(z)?.get("t")||"paragraph";if(!Object.hasOwn(fe.nodes,W)||!fe.nodes[W].isTextblock)return null;let T=Ko(M);w.fmtOut=T,y={kind:"b",id:z,baseId:z,brk:{client:i.id.client,clock:i.id.clock},implicit:!1,runs:[],len:1,atom:!1,items:null,fmtIn:T,fmtOut:null,t:W,opaque:!1},h=null;continue}if(A instanceof Te){A.value===null?delete M[A.key]:M[A.key]=A.value,h=null;continue}if(A instanceof de){y.runs.push({br:!0}),y.items&&y.items.push({at:g,id:Ee(i.id),client:i.id.client,clock:i.id.clock,length:i.length,kind:"br",text:null,blockId:null,raw:{...M}}),y.len+=1;continue}if(A instanceof ht){if(!h){let z=vn(M,y.t);h={marks:z,mk:yn(z)}}y.runs.push({text:A.str,marks:h.marks,mk:h.mk}),y.items&&y.items.push({at:g,id:Ee(i.id),client:i.id.client,clock:i.id.clock,length:i.length,kind:"text",text:A.str,blockId:null,raw:{...M}}),y.len+=A.str.length}else if(i.countable)return null}let L=p.len;if(b<0){if(!ye(M,p.fmtOut??{}))return null}else{if(!N||y.t!==p.t)return null;L=1;for(let i=0;i<b;i++)L+=p.runs[i].br?1:p.runs[i].text.length}let Y=y===w?[w]:[w,y],$=Y.reduce((i,g)=>i+g.len,0)-L,x=B+L,c=i=>i.at>=x?{...i,at:i.at+$}:i;y.fmtOut=p.fmtOut,b>=0&&(y.runs=y.runs.concat(p.runs.slice(b)),y.len+=p.len-L,y.items&&(y.items=y.items.concat(p.items.filter(i=>i.at>=x).map(c))));let E={...o,visible:a.slice(),tokens:o.tokens+$};if(E.visible.splice(f,1,...Y),$){let i=u+L;E.holes=o.holes.map(g=>g.at>=i?{at:g.at+$,len:g.len}:g),E.hidden=o.hidden.map(g=>g.at>=x?{...g,at:g.at+$,items:g.items.map(c)}:g);for(let g=f+Y.length;g<E.visible.length;g+=1){let A=E.visible[g];A.items?.length&&(E.visible[g]={...A,items:A.items.map(c)})}}return E}var Ho=e=>e.br?`
|
|
1
|
+
import{a as Ct,b as It,c as At,d as ze,e as Ye,f as Kn,g as Tt,h as Hn,i as qn,j as Pt,l as Rt}from"./c-NICICT4P.js";import{a as Et,b as Jn,c as Ro,f as Yo}from"./c-GNFDX6SU.js";import{a as $o}from"./c-WNOLMHI2.js";import{a as Bn,b as Dn,e as zn,f as it,g as Mt}from"./c-LS7IVQVW.js";import{a as Po}from"./c-NEQRFC4O.js";import{b as Co,c as Io}from"./c-OBMZASYQ.js";import"./c-IW6GGOU2.js";import"./c-HAWFNBYG.js";import{a as Re,b as _n,p as Nn,q as Fn,u as Ao,v as To}from"./c-LUBZU4AZ.js";import{A as An,B as Be,C as ot,D as Tn,E as Pn,F as De,G as Rn,H as Pe,I as rt,J as Yn,K as St,L as $n,M as st,N as jn,O as ue,a as Le,b as kt,c as wn,d as xn,f as Sn,j as On,m as Eo,p as Mn,q as En,r as Cn,s as In,t as vt,v as wt,x as xt,z as Oe}from"./c-GO635CRU.js";import{a as me,b as hn,d as Me,e as _e,g as xe,h as Ne,i as ye,j as Ee,k as gn,l as Fe,m as nt,n as be,o as bn,p as kn,q as Se,r as Ce,u as yn,v as vn,w as yt}from"./c-V2V5FKXX.js";import"./c-T7LOTEWO.js";import"./c-A3OKSYRI.js";import"./c-7K4SCQB7.js";import{f as tn,g as nn,i as Qe,j as Ze,k as dt,n as pt,o as et,p as on,s as mt,t as rn,u as Ae,v as de,w as Te,x as ht,y as sn}from"./c-WMRJKQ2V.js";import{g as Ln,p as Ot}from"./c-3Y234AUB.js";import{E as gt,H as bt,I as dn,d as fe,fa as je,g as an,i as fn,ia as pn,ja as mn,na as tt,w as un}from"./c-OH2FPYSY.js";import{b as Vt}from"./c-QY7F6EN6.js";import"./c-FSQXFG5T.js";import{b as pe,c as ln,e as cn}from"./c-RETTCOWO.js";import{a as Wt,b as Ut,d as ft}from"./c-JC4RZW4E.js";import{a as Zt}from"./c-TCCA5BZN.js";import"./c-3LDGIBMN.js";import{c as en}from"./c-57XDY6HC.js";import"./c-OZVK3TFI.js";import{a as Qt,b as ut}from"./c-FILLTJA7.js";import"./c-QCDVDZIR.js";import{e as Gt,f as Xt}from"./c-FC5RUFPR.js";import"./c-4ASQPRQL.js";import"./c-GQ6F6IDK.js";import"./c-I2SCCUEW.js";import"./c-5VYOWDTI.js";import"./c-P73XPAOA.js";import"./c-ZPI7M5U5.js";import"./c-WYFDLITL.js";import"./c-UGHH4MB3.js";import"./c-MZCOGNZL.js";import"./c-EHAR4RJJ.js";import"./c-LD6UVV5R.js";import"./c-PGSBXHUE.js";import"./c-KU3PX7LL.js";import"./c-EQ5NBOGA.js";import"./c-IJUK2GPW.js";import"./c-C7SUMNMI.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-U4TWEIKZ.js";import"./c-UW6MMZ4V.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 Yt=new Set(["paragraph","heading","list_item","callout","quote","code_block","toggle"]),Je=(e,o)=>je(e)===je(o);function $t(e,o){let n=o.createElement("article");return n.setAttribute("data-blockeditor",""),n.innerHTML=mn([{id:e.id,t:"paragraph",c:e.c??"",...e.m?{m:e.m}:{}}],{clean:pn(o)}),n}function jo(e,o){let n=new Map(e.map((f,u)=>[f.id,u])),r=new Set(o.map(f=>f.id)),t=new Map,s=0;return o.map(f=>{let u=n.get(f.id);if(u!==void 0)return s=u+1,f;let p={c:f.c??"",m:f.m??null};for(let b=s;b<e.length;b++){let C=e[b];if(!(r.has(C.id)||C.t!==f.t||!Je({c:C.c??"",m:C.m??null},p)))return r.add(C.id),s=b+1,t.set(f.id,C.id),{...f,id:C.id}}return f}).map(f=>t.has(f.parent)?{...f,parent:t.get(f.parent)}:f)}function jt(e,o,n,{doc:r,merge3:t,mergeJson:s}){let a=[],f=jo(e,n),u=new Map(e.map(c=>[c.id,c])),p=new Map(o.map(c=>[c.id,c])),b=new Map(f.map(c=>[c.id,c])),C=o.map(c=>({...c})),M=f.map(c=>({...c})),h=new Map(C.map(c=>[c.id,c])),w=new Map(M.map(c=>[c.id,c]));for(let[c,E]of u){let i=p.get(c),g=b.get(c);if(!i||!g||!Yt.has(E.t)||!Yt.has(i.t)||!Yt.has(g.t))continue;let A={c:E.c??"",m:E.m??null},z={c:i.c??"",m:i.m??null},W={c:g.c??"",m:g.m??null};if(Je(z,A)||Je(W,A)||Je(z,W))continue;if(E.t==="code_block"){for(let P of[h.get(c),w.get(c)])P.c=g.c??"",g.m?P.m=g.m:delete P.m;a.push({id:c,kind:"text",local:i.c??"",remote:g.c??""});continue}let T=t($t(E,r),$t(i,r),$t(g,r));for(let P of T.conflicts)a.push({id:c,kind:"text",local:P.local?.textContent??null,remote:P.remote?.textContent??null});let[U]=tt(T.root,{seed:"",known:new Map});for(let P of[h.get(c),w.get(c)])P.c=U.c,U.m?P.m=U.m:delete P.m}let y=o.map(c=>c.id);for(let[c,E]of u){let i=h.get(c);if(!i||b.has(c)||Je(p.get(c),E))continue;let g=y.indexOf(c)-1;for(;g>=0&&!w.has(y[g]);)g--;let A=g<0?0:M.findIndex(z=>z.id===y[g])+1;M.splice(A,0,{...i}),w.set(c,M[A]),a.push({id:c,kind:"kept-edit"})}let N=s(e,C,M,{onConflict:c=>a.push({kind:"field",path:c.path,local:c.local,remote:c.remote,resolved:c.resolved})}),B=new Set(N.map(c=>c.id)),v=c=>(p.get(c)??u.get(c)??b.get(c))?.parent??null,L=N.map(c=>{let E=c.parent??null;for(;E&&!B.has(E);)E=v(E);return E===(c.parent??null)?c:{...c,parent:E}}),Y=new Map(L.map(c=>[c.id,c.parent??null])),$=c=>{let E=new Set([c]);for(let i=Y.get(c);i;i=Y.get(i)){if(E.has(i))return!0;E.add(i)}return!1};for(let c of L)if($(c.id)){for(let E of[p.get(c.id)?.parent,u.get(c.id)?.parent,null])if(Y.set(c.id,E&&B.has(E)?E:null),!$(c.id))break}return{items:L.map(c=>(c.parent??null)===Y.get(c.id)?c:{...c,parent:Y.get(c.id)}),conflicts:a}}var _o=e=>{try{return Zt(e)}catch{return null}},$e={ok:!0,outcome:"unchanged"},Ke={ok:!1,outcome:"disposed",reason:"adoption-disposed"},He={ok:!1,outcome:"refused",reason:"adoption-refused"},No={ok:!1,outcome:"refused",reason:"adoption-timeout"},Fo={ok:!1,outcome:"error",reason:"adoption-error"},Lo={ok:!0,outcome:"writer-adopts"},Vn=e=>({ok:!0,outcome:"adopted",counts:e}),Wn=1e4;function Bo(e){let o=e.querySelector(Et);return o?{article:o.cloneNode(!0),tags:Jn(e).map(n=>_o(n.textContent))}:null}function Un(e){return new Promise(o=>{if(!e.composing)return o();e.dom.addEventListener("compositionend",()=>setTimeout(()=>o(Un(e)),0),{once:!0})})}function Do({view:e,source:o=null,ready:n=Promise.resolve(),isAdopter:r=()=>!0,idle:t=()=>Un(e),requestCheckpoint:s=()=>{},notice:a=()=>{},snapshot:f=()=>null,mergeTagless:u=!1,seeded:p=!1,writerReady:b=()=>Promise.resolve(),adopted:C=()=>{},hold:M=Gt,release:h=Xt,holdMs:w=Wn,doc:y=document}){let N=o?o.article.innerHTML:null,B=o?o.article:null,v=new Map,L=P=>{let I=P.getAttribute("data-rev");if(!I)return;let K=v.get(I)??[];v.delete(I),v.set(I,K),K.push(P),K.length>10&&K.shift(),v.size>20&&v.delete(v.keys().next().value)};B&&L(B);let Y=Promise.resolve(),$=!1,x,c=new Promise(P=>x=P);async function E(){let P,I=new Promise(K=>{P=setTimeout(()=>K("timeout"),w)});try{return await Promise.race([Promise.resolve(n).then(()=>t()).then(()=>"ready"),c.then(()=>"disposed"),I])}finally{clearTimeout(P)}}function i(P,I,K,j){let{HyperMorph:Q}=Qt(),le=jt(K,I,j,{doc:y,merge3:Q.merge3,mergeJson:Q.mergeJson}),ee=le.conflicts.filter(D=>D.kind==="text"||D.kind==="field"),m=ee.length?f():null,l=Dn(P,le.items,I),k=l&&zn(e.state,l);if(!k)return null;e.dispatch(k),e.dispatch(cn.closeHistory(e.state.tr));let F={edited:l.edited.size,created:l.created.size,deleted:l.deleted.length,moved:l.reordered},{displaced:R}=k.getMeta(Bn);return Object.keys(R).length&&(F.displaced=R),ee.length&&(F.conflicts=ee),m&&(F.copy=m),F}async function g(P){if(u&&!P.tags.length)return A(P);let I=Mt(P.article,P.tags);if(I.kind==="unbased"&&console.warn("page: the article and its data changed together; kept the data"),I.kind!=="adopt")return $e;if(!r())return Lo;M();try{if(await ut(),$)return Ke;if(!r())return He;let K=await E();if(K==="timeout"&&console.warn("page: gave up waiting for the editor; the hand edit was not adopted"),K==="disposed"||$)return Ke;if(K!=="ready")return No;if(!r())return He;let j=gt(e.state.doc),Q=i(j,it(j,y),I.baseItems,I.parsed);return Q?(C(I.A),Vn(Q)):$e}finally{h()}}async function A(P){let I=P.article.getAttribute("data-rev"),K=I&&v.get(I)||[],j=K.at(-1)??B;if(K.slice(0,-1).some(Q=>Q.innerHTML===P.article.innerHTML)||(L(P.article),B=P.article,!j)||j.outerHTML===P.article.outerHTML)return $e;M();try{if(await ut(),$)return Ke;if(!r())return He;if(await b(),$)return Ke;if(!r())return He;if(await E()==="disposed"||$)return Ke;if(!r())return He;let le=gt(e.state.doc),ee=it(le,y),m=new Map(ee.map(F=>[F.id,F])),l=F=>tt(F,{seed:F.getAttribute("data-rev")??"",known:m}),k=i(le,ee,l(j),l(P.article));return k?Vn(k):$e}finally{h()}}async function z(P){try{return await g(P)}catch(I){return console.error("page: adoption failed",I),Fo}}let W=null;function T(P,I=!1){return Y=Y.then(()=>z(P)).then(K=>(I&&(W=K),!K.ok||K.outcome!=="adopted"||(s(),a(K.counts),y.dispatchEvent(new CustomEvent("clay:blockeditor-adopted",{detail:K.counts}))),K)),Y}function U(P){let I=P.detail?.html;if($||typeof I!="string")return;let K=Bo(new DOMParser().parseFromString(I,"text/html"));!K||K.article.innerHTML===N||(N=K.article.innerHTML,T(K))}return y.addEventListener("clay:sync-applied",U),o&&!p&&T(o,!0),{idle:async()=>(await Y,W),saved(P){if(!u||typeof P!="string")return;let I=new DOMParser().parseFromString(P,"text/html").querySelector(Et);I&&(L(I),B=I)},dispose(){$=!0,x(),y.removeEventListener("clay:sync-applied",U)}}}var Gn='["text-delete",',Xn=(e,o)=>o instanceof rn&&o._item&&o._item.parent===e.attrs&&typeof o._item.parentSub=="string"?o._item.parentSub:null,Qn=e=>e==="t"||e==="parent",_t=e=>e.content instanceof de&&e.content.embed.b!==void 0,zo=e=>e.content instanceof ht||e.content instanceof Te||e.content instanceof de&&e.content.embed.b===void 0,eo=e=>{let o=new Map;for(let n of e.stops)(o.get(n.client)??o.set(n.client,[]).get(n.client)).push(n);return o},to=(e,o)=>{let n=o.get(e.id.client);if(!n)return!1;let r=e.id.clock,t=r+e.length;return n.some(s=>s.clock<t&&r<s.clock+s.len)},Jo=(e,o)=>{for(let n=e.left;n;n=n.left){if(n.deleted){if(to(n,o))return null;continue}if(_t(n))return n}return null};function no(e,o,n){let r=eo(n),t=new Set,s=new Set,a=o.changed.get(e.tableFields)??new Set;for(let[h,w]of o.changed){if(h===e.flow)continue;if(h===e.attrs){if(!o.local)return null;for(let N of w){let B=e.attrs.get(N);if(!(B instanceof Ae)||B._item.left||B._item.id.clock<(o.beforeState.get(B._item.id.client)??0))return null;s.add(N)}if(s.size>1)return null;continue}if(h===e.tableFields){for(let N of w){let B=e.tableFields.has(N)?En(N,e.tableFields.get(N)):null;if(B===null)return null;t.add(B)}continue}let y=Xn(e,h);if(y!==null){for(let N of w)if(Qn(N))return null;t.add(y);continue}if(h!==e.gone)return null;for(let N of w)if(typeof N!="string"||!N.startsWith(Gn))return null}let f=e.ydoc.store,u=null,p=null,b=!1,C=h=>{if(!(h instanceof sn))return!1;if(h.parent===e.gone)return typeof h.parentSub=="string"&&h.parentSub.startsWith(Gn);if(h.parent===e.tableFields)return a.has(h.parentSub);if(h.parent===e.attrs)return s.has(h.parentSub);if(h.parent!==e.flow){let y=Xn(e,h.parent);return y!==null&&(s.has(y)||t.has(y)&&!Qn(h.parentSub))}if(_t(h)){if(h.deleted||!s.has(h.content.embed.b))return!1;p=h}else if(!zo(h))return!1;let w=Jo(h,r);return!w||u&&w!==u?!1:(u=w,h.content instanceof Te&&(b=!0),!0)};for(let[h,w]of o.afterState)for(let y=o.beforeState.get(h)??0;y<w;){let N=et(f,{client:h,clock:y});if(!C(N))return null;y=N.id.clock+N.length}let M=!1;for(let[h,w]of o.deleteSet.clients)for(let{clock:y,len:N}of w)for(let B=y;B<y+N;){let v=et(f,{client:h,clock:B});if(!C(v))return null;M=!0,B=v.id.clock+v.length}return s.size&&!p?null:u||t.size?{marker:u,split:p,deleted:M,formats:b,fields:t,remote:!o.local}:null}var Ko=e=>{for(let o in e)return{...e};return null};function oo(e,o,n,r=null){let t=r?.formats??!0,s=r?.split??null,a=o.visible,f=-1,u=0;for(let i=0;i<a.length;i++){let g=a[i];if(g.brk&&g.brk.client===n.id.client&&g.brk.clock===n.id.clock){f=i;break}u+=g.len}if(f<0)return null;let p=a[f];if(p.implicit||p.atom||p.opaque||p.recovered||p.hide)return null;let b=p.runs.findIndex(i=>i.hole!==void 0);if(b>=0&&t||p.items&&o.copies.has(p.baseId))return null;let C=eo(o),M={...p.fmtIn??{}},h=null,w={...p,runs:[],len:1};p.items&&(w.items=[]);let y=w,N=!1,B=Ye(o.holes,u),v=B+1;for(let i=n.right;i;i=i.right){if(i.deleted){if(to(i,C))return null;continue}if(_t(i)&&(i!==s||y!==w)){N=!0;break}let g=v;i.countable&&(v+=i.length);let A=i.content;if(i===s){let z=A.embed.b,W=e.attrs.get(z)?.get("t")||"paragraph";if(!Object.hasOwn(fe.nodes,W)||!fe.nodes[W].isTextblock)return null;let T=Ko(M);w.fmtOut=T,y={kind:"b",id:z,baseId:z,brk:{client:i.id.client,clock:i.id.clock},implicit:!1,runs:[],len:1,atom:!1,items:null,fmtIn:T,fmtOut:null,t:W,opaque:!1},h=null;continue}if(A instanceof Te){A.value===null?delete M[A.key]:M[A.key]=A.value,h=null;continue}if(A instanceof de){y.runs.push({br:!0}),y.items&&y.items.push({at:g,id:Ee(i.id),client:i.id.client,clock:i.id.clock,length:i.length,kind:"br",text:null,blockId:null,raw:{...M}}),y.len+=1;continue}if(A instanceof ht){if(!h){let z=vn(M,y.t);h={marks:z,mk:yn(z)}}y.runs.push({text:A.str,marks:h.marks,mk:h.mk}),y.items&&y.items.push({at:g,id:Ee(i.id),client:i.id.client,clock:i.id.clock,length:i.length,kind:"text",text:A.str,blockId:null,raw:{...M}}),y.len+=A.str.length}else if(i.countable)return null}let L=p.len;if(b<0){if(!ye(M,p.fmtOut??{}))return null}else{if(!N||y.t!==p.t)return null;L=1;for(let i=0;i<b;i++)L+=p.runs[i].br?1:p.runs[i].text.length}let Y=y===w?[w]:[w,y],$=Y.reduce((i,g)=>i+g.len,0)-L,x=B+L,c=i=>i.at>=x?{...i,at:i.at+$}:i;y.fmtOut=p.fmtOut,b>=0&&(y.runs=y.runs.concat(p.runs.slice(b)),y.len+=p.len-L,y.items&&(y.items=y.items.concat(p.items.filter(i=>i.at>=x).map(c))));let E={...o,visible:a.slice(),tokens:o.tokens+$};if(E.visible.splice(f,1,...Y),$){let i=u+L;E.holes=o.holes.map(g=>g.at>=i?{at:g.at+$,len:g.len}:g),E.hidden=o.hidden.map(g=>g.at>=x?{...g,at:g.at+$,items:g.items.map(c)}:g);for(let g=f+Y.length;g<E.visible.length;g+=1){let A=E.visible[g];A.items?.length&&(E.visible[g]={...A,items:A.items.map(c)})}}return E}var Ho=e=>e.br?`
|
|
2
2
|
`:e.hole!==void 0?{hole:e.hole}:{text:e.text,mk:e.mk},qo=e=>{let o=[];for(let n of e.map(Ho)){let r=o[o.length-1];r&&typeof r=="object"&&typeof n=="object"&&r.text!==void 0&&n.text!==void 0&&r.mk===n.mk?o[o.length-1]={text:r.text+n.text,mk:n.mk}:o.push(n)}return o},Zn=(e,o)=>{let n=et(e.ydoc.store,{client:o.client,clock:o.clock});return{client:n.id.client,clock:n.id.clock,len:n.length}},Ve=(e,o)=>rt({...o,copies:[...o.copies],fences:o.fences.map(n=>Zn(e,n)),stops:o.stops.map(n=>Zn(e,n)),visible:o.visible.map(n=>({...n,runs:qo(n.runs)}))});var ro=e=>e===!0?{}:e,so=(e,o)=>ye(ro(e),ro(o));function co(e,o,n,r){let t=e.attrs.get(o);t||(t=new Ae,e.attrs.set(o,t));let s=fe.nodes[n];if(!s){t.get("t")!==n&&t.set("t",n);for(let[p,b]of Object.entries(r??{}))p==="t"||p==="pos"||ye(t.has(p)?t.get(p):void 0,b)||t.set(p,b);return}let a=n==="table"&&t.get("t")==="table"&&!St(o),f=n==="board"&&!St(o),u=a?Cn(e.tableFields,o,In(e,o)):f?wt(e.boardFields,o):null;t.get("t")!==n&&t.set("t",n);for(let p of xe(s)){if(a&&(p==="rows"||p==="cols")||f&&(p==="columns"||p==="cards"))continue;let b=t.has(p)?t.get(p):Ne(s,p);ye(b,r[p])||t.set(p,r[p])}a&&vt(e,o,u,r),f&&xt(e,o,u,r)}function io(e,o){let n=new Map,r=o;for(let t=e.flow._start;t&&r>0;t=t.right){if(t.deleted)continue;let s=t.content;s instanceof Te?s.value===null?n.delete(s.key):n.set(s.key,s.value):t.countable&&(r-=t.length)}return n}function Vo(e){let o=new Set;for(let[r,t]of e)Ce(r)&&t&&o.add(r.split("!")[0]);let n=[];for(let[r,t]of e)!Ce(r)&&t!==null&&t!==void 0&&!o.has(r)&&fe.marks[Se(r)]&&n.push([r,t]);return n}function ao(e){let o=new Set;for(let[r,t]of e)Ce(r)&&t&&o.add(r.split("!")[0]);let n=[];for(let[r,t]of e)!Ce(r)&&t!==null&&t!==void 0&&!o.has(r)&&!fe.marks[Se(r)]&&n.push([r,t]);return n}function fo(e,o={}){let n={},r=!1;for(let[t,s]of e)(Ce(t)||fe.marks[Se(t)])&&(n[t]=s);for(let[t,s]of ao(e))r=!0,o[Se(t)]!==void 0&&(n[t]=s);return{attrs:n,opaque:r}}function Wo(e,o,n){let r=be(e),t={},s=Vo(o),a=new Set;for(let[u,p]of s){let b=Se(u),C=n[b];C!==void 0&&so(C,p)?a.add(b):t[`${u}!${r}`]=!0}for(let[u,p]of ao(o)){let b=Se(u);n[b]!==void 0&&so(n[b],p)&&a.add(b)}for(let[u,p]of Object.entries(n))a.has(u)||(t[`${u}~${be(e)}`]=p);let f=fo(o,n);if(!(!Object.keys(t).length&&!f.opaque))return{...f.attrs,...t}}var Nt=2e3;function Uo(e){let o=[],n=[],r=0;for(let t=0;t<e.length;t++)if(n.push(e[t]),r+=1,r>=Nt&&t+1<e.length){let s=e[t];if(s.k==="c"&&Fe(s.ch.charCodeAt(0)))continue;o.push(n),n=[],r=0}return n.length&&o.push(n),o}function lt(e,o,n,r=s=>s(),t=null){let s=o;for(let a of Uo(n))r(()=>{s+=Xo(e,s,a,t)});return s-o}var Go=(e,o,n)=>{if(!n||!n.length)return null;let r=o,t=e.flow._start;for(;t&&r>0;){if(!t.deleted&&t.countable){if(r<t.length)return null;r-=t.length}t=t.right}for(;t&&(t.deleted||!t.countable);t=t.right)if(t.deleted&&n.some(s=>s.client===t.id.client&&s.clock>=t.id.clock&&s.clock<t.id.clock+t.length))return t;return null},We=(e,o,n,r)=>{let t=Go(e,o,n);if(!t)return r();t.deleted=!1;try{return r()}finally{t.deleted=!0,e.flow._searchMarker&&(e.flow._searchMarker.length=0)}};function Xo(e,o,n,r=null){let t=o,s="",a=null,f=null,u=()=>{if(!s)return;let b=Wo(e,io(e,t),f??{});We(e,t,r,()=>e.flow.insert(t,s,b)),t+=s.length,s=""},p=b=>{let C=fo(io(e,t)).attrs;We(e,t,r,()=>e.flow.insertEmbed(t,b,C)),t+=1};for(let b of n)b.k==="c"?(a!==null&&b.mk!==a&&u(),a=b.mk,f=b.ma,s+=b.ch):b.k==="h"?(u(),a=null,p({br:1})):(u(),a=null,p({b:b.id}),co(e,b.id,b.t,b.attrs));return u(),t-o}var Qo=(e,o,n,r)=>{let t=0;for(let s=e.flow._start;s&&t<r;s=s.right){if(s.deleted||!s.countable)continue;let a=t;if(t+=s.length,t<=n||s.content instanceof de&&s.content.embed?.b!==void 0)continue;let f=Math.max(0,n-a),u=Math.min(s.length,r-a);u<=f||e.gone.set(Pn(s.id.client,s.id.clock+f,o.operationId),{length:u-f,actor:e.ydoc.clientID,sv:o.sv})}};function lo(e,o,n,r=null){for(let t=n.length-1;t>=0;t--){let[s,a]=n[t];if(a<=s)continue;let f=o.physicalRanges(s,a);for(let u=f.length-1;u>=0;u--){let[p,b]=f[u];b<=p||(r&&Qo(e,r,p,b),e.flow.delete(p,b-p))}}}function Zo(e,o,n){let r=!1;for(let t=e.flow._start;t;t=t.right){let s=Ee(t.id);if(s===o){r=!0;continue}if(!r)continue;let a=t.content instanceof de?t.content.embed:null;if(a&&a.b!==void 0&&a.b!==n)return s}return null}function Ft(e,o,n,r,t=null){let{pd:s,map:a,bt:f}=e,u=i=>t===null||t[i],p=0;for(;p<n.length&&p<r.length&&ze(n[p],r[p])&&u(p);)p++;let b=0;for(;b<n.length-p&&b<r.length-p&&ze(n[n.length-1-b],r[r.length-1-b])&&u(n.length-1-b);)b++;let C=i=>i&&i.k==="c"?i.ch.charCodeAt(0):-1;p>0&&Fe(C(n[p-1]))&&(nt(C(n[p]))||nt(C(r[p])))&&p--,b>0&&nt(C(n[n.length-b]))&&(Fe(C(n[n.length-b-1]))||Fe(C(r[r.length-b-1])))&&b--;let M=n.slice(p,n.length-b),h=r.slice(p,r.length-b),w=o+p,y=w+M.length,N=M.filter(i=>i.k==="b").map(i=>i.id).join(",");if(!(M.some(i=>i.k==="b")&&N===h.filter(i=>i.k==="b").map(i=>i.id).join(","))){let i=Le(s.origins);try{for(let T of M){if(T.k!=="b"||!T.brk)continue;let U=i.resolve(T.brk);i.boundaryOf(U)||e.tx(()=>i.recordBoundary(U,{blockId:T.id,kind:"removed"}))}}finally{i.dispose()}let g=new Set;M.forEach((T,U)=>{if(T.k!=="b"||!T.brk)return;let P=w+U,I=P+1;for(;I<f.length&&f[I].k!=="b";)I++;let K=I<=y&&I!==P+1,j=I<f.length?f[I].brk:null;K&&(e.tx(()=>s.gone.set(Be(Ee(T.brk),e.operationId),{blockId:T.id,end:j?Ee(j):null,sv:e.sv})),g.add(P))});let A=[],z=w;for(let T=w;T<y;T++)g.has(T)&&(T>z&&A.push([z,T]),z=T+1);y>z&&A.push([z,y]),e.tx(()=>lo(s,a,A,M.some(T=>T.k==="b")?null:e));let W=new Set(h.filter(T=>T.k==="b").map(T=>T.id));for(let T of M)if(!(T.k!=="b"||!T.brk||W.has(T.id)))for(let U of e.copies.get(T.id)??[]){let P=Be(U,e.operationId);s.gone.has(P)||e.tx(()=>s.gone.set(P,{blockId:T.id,end:Zo(s,U,T.id),sv:e.sv}))}h.length&<(s,a.toPhysical(w,"before"),h,e.tx,e.fences);return}let v=[],L=[],Y=[],$=w,x=0,c=0;for(;x<M.length||c<h.length;){let i=x;for(;i<M.length&&M[i].k!=="b";)i++;let g=c;for(;g<h.length&&h[g].k!=="b";)g++;let A=M.slice(x,i),z=h.slice(c,g);if(A.length&&v.push([$,$+A.length]),z.length&&L.push({at:$,toks:z}),$+=A.length,i<M.length&&(Y.push([M[i],h[g]]),$+=1),x=i+(i<M.length?1:0),c=g+(g<h.length?1:0),i>=M.length&&g>=h.length)break}let E=[...v.map(i=>({at:i[0],d:i})),...L.map(i=>({at:i.at,i}))].sort((i,g)=>g.at-i.at||(i.d?-1:1));for(let i of E)i.d?e.tx(()=>lo(s,a,[i.d],e)):lt(s,a.toPhysical(i.at,"before"),i.i.toks,e.tx,e.fences);for(let[i,g]of Y)e.tx(()=>{if(!fe.nodes[g.t])return;let A=e.recovered.get(i.id);if(A){i.t!==g.t&&s.gone.set(De(A,"t"),g.t);for(let T of xe(fe.nodes[g.t]))ye(i.attrs[T],g.attrs[T])||s.gone.set(De(A,T),g.attrs[T]);return}let z=i.id,W=s.attrs.get(z);if(W){let T=i.t==="table"&&g.t==="table"&&W.get("t")==="table",U=g.t==="board",P=U?i.t==="board"&&W.get("t")==="board"?i.attrs:wt(s.boardFields,z):null;i.t!==g.t&&W.set("t",g.t);for(let I of xe(fe.nodes[g.t])){if(T&&(I==="rows"||I==="cols")||U&&(I==="columns"||I==="cards"))continue;let K=W.has(I)?W.get(I):Ne(fe.nodes[g.t],I);ye(K,g.attrs[I])||W.set(I,g.attrs[I])}T&&vt(s,z,i.attrs,g.attrs),U&&xt(s,z,P,g.attrs)}else co(s,z,g.t,g.attrs)})}function Lt(e,o,n,r,t,s){let{pd:a,map:f}=e,u=`${r}~${be(a)}`,p=be(a),b=o;for(;b<n;){if(s[b].k!=="c"){b++;continue}let C=b;for(;C<n&&s[C].k==="c";)C++;let M=f.physicalRanges(b,C);if(t!==null)for(let[h,w]of M)a.flow.format(h,w-h,{[u]:t});else{let h=0;for(let w of a.flow.toDelta()){let y=typeof w.insert=="string"?w.insert.length:1;for(let[N,B]of M){if(h>=B)break;let v=Math.max(h,N),L=Math.min(h+y,B);if(L>v&&w.attributes){let Y={};for(let[$,x]of Object.entries(w.attributes))Se($)===r&&!Ce($)&&x!==null&&(Y[`${$}!${p}`]=!0);Object.keys(Y).length&&a.flow.format(v,L-v,Y)}}h+=y}}b=C}}var{AddMarkStep:uo,RemoveMarkStep:er,AttrStep:tr,ReplaceStep:nr,Mapping:ct}=ln,po=(e,o,n)=>{let r=e.resolve(o),t=e.resolve(n);return[r.depth&&r.node(1).type.name==="table"?r.before(1):o,t.depth&&t.node(1).type.name==="table"?t.after(1):n]},or=(e,o,n)=>{let r=!1;return e.nodesBetween(o,n,t=>(t.type.name==="table"&&(r=!0),!r&&t.type.name!=="table")),r};function mo(e,o,n,r,t=null,s=!0,a=null,{join:f=!1,open:u=!1}={}){let p=()=>{if(a){let l=a;a=null,l()}},b=[],C=[],M=[];for(let l of o)l.steps.forEach((k,F)=>{b.push(k),C.push(l.docs[F]),M.push(k.getMap())});if(!b.length)return;let h=new ct(M),w=[...Qe(Ze(e.ydoc)).entries()].sort((l,k)=>l[0]-k[0]),y=be(e),N=C[0],B=o[o.length-1].doc,v=n.visible.length===0&&N.childCount===1&&N.firstChild.type.name==="paragraph"?[{id:N.firstChild.attrs.id,implicit:!0,t:"paragraph",len:0}]:n.visible,L=new Map,Y=[];{let l=0;v.forEach(k=>{k.implicit&&Y.push({tok:l,id:k.id,t:k.t}),l+=k.len})}Y.sort((l,k)=>k.tok-l.tok);for(let l of Y)l.alias=bn(e),L.set(l.id,l.alias);let $=L.size?n.holes.map(l=>({at:l.at+Y.filter(k=>k.tok<l.at).length,len:l.len})):n.holes,x=Tt(n.tokens+L.size,$,e.flow.length+L.size),c=[],E=[];b.forEach((l,k)=>{let F=l instanceof uo||l instanceof er;if(F&&!or(C[k],l.from,l.to)){E.push({i:k,step:l});return}let R=new ct(M.slice(0,k)).invert(),D=new ct(M.slice(k+1)),q=[];l instanceof tr?q.push([l.pos,l.pos+1,l.pos,l.pos+1]):F?q.push([l.from,l.to,l.from,l.to]):l.getMap().forEach((O,te,X,G)=>q.push([O,te,X,G]));for(let[O,te,X,G]of q){let[Z,oe]=po(N,R.map(O,-1),R.map(te,1)),[ne,Ge]=po(B,D.map(X,-1),D.map(G,1));c.push({oa:Z,ob:oe,na:ne,nb:Ge})}}),c.sort((l,k)=>l.oa-k.oa||l.na-k.na);let i=[];for(let l of c){let k=i[i.length-1];k&&(l.oa<=k.ob||l.na<=k.nb)?(k.ob=Math.max(k.ob,l.ob),k.nb=Math.max(k.nb,l.nb)):i.push({...l})}let g=!Y.length&&!E.length&&b.every(l=>l instanceof nr)&&o.every(dn),A=g?null:It(N,L,v),z=g?null:It(B,L,v),W=g?[]:Ct(N,L,v),T=g?[]:Ct(B,L,v),U=g?i.map(l=>({r:l,old:At(N,l.oa,l.ob),next:At(B,l.na,l.nb)})):null,P=g?U.reduce((l,k)=>l+k.next.end-k.next.start,0):i.reduce((l,k)=>l+(z[k.nb]-z[k.na]),0),I=P>Nt,K=I?l=>e.ydoc.transact(k=>{k.meta.set(_e,s),p(),l()},me):l=>l(),j={pd:e,map:x,bt:W,tx:K,copies:n.copies,fences:n.fences,sv:w,operationId:y,recovered:new Map(n.visible.filter(l=>l.recovered).map(l=>[l.id,l.sourceKey]))},Q=l=>l.filter(k=>k.k==="b").map(k=>`${k.id}|${k.t}|${JSON.stringify(k.attrs)}`).join(`
|
|
3
3
|
`),le=!g&&(E.length>0||Q(W)!==Q(T)),ee=()=>{for(let F of Y)lt(e,Ye(n.holes,F.tok),[{k:"b",id:F.alias,t:F.t,attrs:Object.fromEntries(xe(fe.nodes[F.t]).map(R=>[R,Ne(fe.nodes[F.t],R)]))}],K);for(let F=i.length-1;F>=0;F--)if(g){let{r:R,old:D,next:q}=U[F],O=D.tokens.map((te,X)=>{let G=h.mapResult(R.oa+X,1),Z=h.mapResult(R.oa+X+1,-1),oe=G.pos-R.na;return!G.deleted&&!Z.deleted&&Z.pos===G.pos+1&&oe>=0&&oe<q.tokens.length&&ze(te,q.tokens[oe])});Ft(j,D.start,D.tokens,q.tokens,O)}else{let R=i[F],D=A[R.oa],q=A[R.ob];Ft(j,D,W.slice(D,q),T.slice(z[R.na],z[R.nb]))}let l=E.length?ue(e):null,k=l?{...j,map:Tt(l.tokens,l.holes,e.flow.length)}:null;for(let{i:F,step:R}of E){let D=new ct(M.slice(F+1)),q=z[D.map(R.from,1)],O=z[D.map(R.to,-1)];if(O<=q)continue;let te=R.mark.type.name,X=R instanceof uo?R.mark.attrs&&Object.keys(R.mark.attrs).length?{...R.mark.attrs}:!0:null;if(an(R.mark)){if(X===null)continue;let G=fn(R.mark.attrs.entries);K(()=>{for(let[Z,oe]of Object.entries(G))Lt(k,q,O,Z,oe,T)});continue}K(()=>Lt(k,q,O,te,X,T))}};f||t?.stopCapturing();let m=t?.captureTimeout;t&&(t.captureTimeout=1/0);try{I?ee():e.ydoc.transact(l=>{l.meta.set(_e,s),p(),ee()},me)}finally{t&&(t.captureTimeout=m),u||t?.stopCapturing()}r.groups++,r.lastGroup={chunked:I,structural:le,regional:g,span:P}}var ke=e=>({status:"refused",code:e}),ho=e=>{if(!e)return"";let o=[];for(let n of Object.keys(e).sort())o.push(`${n}=${JSON.stringify(e[n])}`);return o.join(`
|
|
4
4
|
`)},rr=(e,o,n)=>{let r=n?n.state.doc:null,s=r&&r.childCount===o.visible.length&&o.visible.every((f,u)=>r.child(u).attrs.id===f.id)?r:Re(e,o),a=[];return s.forEach(f=>{f.attrs.id===null||f.attrs.id===void 0||a.push({id:f.attrs.id,parent:f.attrs.parent??null,t:f.type.name})}),a},sr=(e,o)=>{let n=[],r=e.get(o)?.parent??null,t=0;for(;r!=null&&t++<=e.size;)n.push(r),r=e.get(r)?.parent??null;return n},bo=(e,o,n)=>sr(e,n).includes(o),Bt=(e,o,n)=>o===n||bo(e,n,o),Dt=(e,o,n,r,t)=>{if(o?.recovered){let a=De(o.sourceKey,r);(e.gone.has(a)?e.gone.get(a):o.fields?.[r]??null)!==t&&e.gone.set(a,t);return}let s=e.attrs.get(n);s||(s=new Ae,e.attrs.set(n,s)),s.get(r)!==t&&s.set(r,t)},at=(e,o,n,r)=>Dt(e,o,n,"parent",r),ir=8,go={indent:(e,o)=>o.t==="list_item"&&Number.isInteger(e)&&e>=0&&e<=ir,open:(e,o)=>o.t==="toggle"&&typeof e=="boolean",parent:(e,o,n)=>e===null||typeof e=="string"&&n.get(e)?.t==="toggle"&&!Bt(n,e,o.id)},lr=(e,o)=>{if(e?.attrs===void 0)return[];if(!e.attrs||typeof e.attrs!="object"||Array.isArray(e.attrs))return null;let n=[];for(let[r,t]of Object.entries(e.attrs)){let s=o.get(r);if(!s||!t||typeof t!="object"||Array.isArray(t))return null;for(let[a,f]of Object.entries(t)){if(!go[a]||!go[a](f,s,o))return null;n.push({id:r,field:a,value:f})}}return n},cr=(e,o)=>{let n=kt(e.flow,0,e.flow.length),r=[],t=0;for(let s of e.flow.toDelta()){let a=s.attributes;if(typeof s.insert=="string")for(let f=0;f<s.insert.length;f++)r.push({ch:s.insert[f],attrs:a,source:o.resolve(n[t++])});else r.push({embed:s.insert,attrs:a,source:o.resolve(n[t++])})}if(t!==n.length)throw new Error(`The flow delta has ${t} units but the document has ${n.length}`);return r},ar=(e,o,n)=>{let r=new Map;for(let s of o.visible)n.has(s.id)&&s.brk&&r.set(Oe(s.brk),s.id);for(let s of n)for(let a of o.copies.get(s)??[])r.set(a,s);let t=[];for(let s=e.flow._start;s;s=s.right){if(s.deleted||!(s.content instanceof de))continue;let a=s.content.embed?.b;if(a===void 0||r.get(Oe(s.id))!==a)continue;let f=null;for(let u=s.right;u;u=u.right){if(u.deleted||!(u.content instanceof de))continue;let p=u.content.embed?.b;if(!(p===void 0||p===a)){f=Oe(u.id);break}}t.push({key:Oe(s.id),blockId:a,end:f})}return t};function zt({pd:e,view:o,um:n,origins:r,render:t,walked:s=null},a={}){let f=Array.isArray(a?.ids)?[...new Set(a.ids)]:[],u=a?.afterId===void 0?null:a.afterId,p=a?.parent!==void 0,b=s??ue(e,r),C=new Set(b.visible.filter(m=>m.opaque).map(m=>m.id)),M=rr(e,b,o),h=new Map(M.map(m=>[m.id,m])),w=M.map(m=>m.id);if(!f.length)return ke("missing-source");for(let m of f)if(!h.has(m))return ke("missing-source");let y=lr(a,h);if(!y)return ke("invalid-attrs");let N=y.filter(m=>m.field==="parent"),B=new Set(f.filter(m=>!f.some(l=>l!==m&&bo(h,l,m)))),v=M.filter(m=>f.some(l=>Bt(h,m.id,l))),L=new Set(v.map(m=>m.id));if(v.some(m=>C.has(m.id))||y.some(m=>C.has(m.id)))return ke("unsupported-format");let Y=new Map(b.visible.map(m=>[m.id,m]));for(let m of v){let l=Y.get(m.id);if(!l||l.implicit||!l.brk)return ke("missing-source")}let $;if(p)$=a.parent??null;else{let m=new Set(v.filter(l=>B.has(l.id)).map(l=>l.parent));if(m.size!==1)return ke("invalid-parent");$=[...m][0]}if(p&&$!==null){let m=h.get($);if(!m||m.t!=="toggle")return ke("invalid-parent");if(L.has($))return ke("cycle")}if(u!==null){if(typeof u!="string"||!h.has(u))return ke("missing-destination");if(L.has(u))return ke("cycle");if(h.get(u).parent!==$)return ke("missing-destination")}let x=M.filter(m=>!L.has(m.id)),c=0;if(u===null){if($!==null){let m=x.findIndex(k=>k.parent===$),l=x.findIndex(k=>k.id===$);c=m>=0?m:l<0?0:l+1}}else for(c=x.findIndex(m=>m.id===u)+1;c<x.length&&Bt(h,x[c].id,u);)c++;let E=[...x.slice(0,c),...v,...x.slice(c)],i=E.length===w.length&&E.every((m,l)=>m.id===w[l]),g=v.filter(m=>B.has(m.id)&&m.parent!==$),A=v.map(m=>m.id);if(i&&!g.length&&!y.length)return{status:"unchanged"};let z=(()=>{let m=o?.state.selection;if(!(m instanceof pe.TextSelection))return null;let l=R=>{let D=o.state.doc.resolve(R);return D.depth?{id:D.node(1).attrs.id,offset:D.parentOffset}:null},k=l(m.anchor),F=l(m.head);return k&&F&&(L.has(k.id)||L.has(F.id))?{anchor:k,head:F}:null})(),W=()=>{if(!z||!o)return;let m=({id:F,offset:R})=>{let D=null;return o.state.doc.forEach((q,O)=>{D===null&&q.attrs.id===F&&(D=O+1+Math.min(R,q.content.size))}),D},l=m(z.anchor),k=m(z.head);l!==null&&k!==null&&o.dispatch(o.state.tr.setSelection(pe.TextSelection.create(o.state.doc,l,k)).setMeta(Me,!0).setMeta("addToHistory",!1))};if(i)return n?.stopCapturing(),e.ydoc.transact(()=>{if(N.length)for(let m of N)at(e,Y.get(m.id),m.id,m.value);else for(let m of g)at(e,Y.get(m.id),m.id,$);for(let m of y)m.field!=="parent"&&Dt(e,Y.get(m.id),m.id,m.field,m.value)},me),n?.stopCapturing(),t(),W(),{status:"moved",ids:A};let T=[...Qe(Ze(e.ydoc)).entries()].sort((m,l)=>m[0]-l[0]),U=be(e),P=cr(e,r),I=yt(b,e.flow.length),K=[],j=0;for(let m of b.visible){if(L.has(m.id)){let l=[];for(let[k,F]of I.physicalRanges(j,j+m.len))for(let R=k;R<F;R++)l.push(P[R]);K.push({seg:m,units:l})}j+=m.len}for(let m=0;m<K.length;m++){let l=K[m];if(l.seg.id!==A[m])throw new Error(`Captured ${l.seg.id} where ${A[m]} was expected`);if(!l.units.length||l.units[0].embed===void 0||l.units[0].embed.b!==l.seg.id)throw new Error(`The selected block ${l.seg.id} has no physical marker to copy`)}let Q=ar(e,b,L),le=Pe(e.gone),ee=new Map;for(let m of v){let l=Y.get(m.id);if(!l.recovered)continue;let k=b.removals.filter(D=>D.sourceKey===l.sourceKey),F=$n(l.sourceKey,k,le),R=le.restores.find(D=>D.key===F?.key)?.baseline??{type:l.t,attrs:l.fields??{}};ee.set(l.sourceKey,{covers:k.map(D=>D.key),baseline:JSON.parse(JSON.stringify(R))})}if(!Q.length)throw new Error("The selected blocks have no live physical markers to retire");return n?.stopCapturing(),e.ydoc.transact(()=>{for(let O of Q)e.gone.set(Be(O.key,U),{blockId:O.blockId,end:O.end,sv:T});let m=ue(e,r),l=yt(m,e.flow.length),k=m.visible.map(O=>O.id),F=0;if(c>0){let O=k.indexOf(x[c-1].id);F=O<0?0:O+1}let R=0;for(let O=0;O<F;O++)R+=m.visible[O].len;let D=l.toPhysical(R,"before"),q=[];for(let O of K){let te=D,X=null,G=null,Z=()=>{X!==null&&(We(e,D,m.fences,()=>e.flow.insert(D,X,G??void 0)),D+=X.length,X=null)};for(let ne of O.units)ne.ch!==void 0?(X!==null&&ho(ne.attrs)!==ho(G)&&Z(),X===null&&(X="",G=ne.attrs),X+=ne.ch):(Z(),We(e,D,m.fences,()=>e.flow.insertEmbed(D,ne.embed,ne.attrs)),D+=1);Z();let oe=kt(e.flow,te,D);if(oe.length!==O.units.length)throw new Error(`Copied ${O.seg.id} as ${oe.length} units instead of ${O.units.length}`);for(let ne=1;ne<O.units.length;ne++)q.push({dest:oe[ne],source:O.units[ne].source});r.recordBoundary(oe[0],O.seg.recovered?{blockId:O.seg.id,kind:"copy",recoveryOf:O.seg.sourceKey}:{blockId:O.seg.id,kind:"copy"}),O.seg.recovered&&e.gone.set(ot(O.seg.sourceKey,U),ee.get(O.seg.sourceKey)),e.gone.set(Tn(Oe(oe[0])),!0)}if(q.length&&r.recordSpans(q),N.length)for(let O of N)at(e,Y.get(O.id),O.id,O.value);else for(let O of g)at(e,Y.get(O.id),O.id,$);for(let O of y)O.field!=="parent"&&Dt(e,Y.get(O.id),O.id,O.field,O.value)},me),n?.stopCapturing(),t(),W(),{status:"moved",ids:A}}var Jt=e=>{let o=[];return e.forEach(n=>o.push([n.type.name,JSON.stringify(Object.fromEntries(xe(n.type).map(r=>[r,n.attrs[r]]))),n.isTextblock||n.type.name==="table"?JSON.stringify(n.content.toJSON()):null])),JSON.stringify(o)};function fr(e,o){if(e.childCount!==o.childCount)return!1;for(let n=0;n<e.childCount;n++){let r=e.child(n),t=o.child(n);if(r!==t&&(r.type!==t.type||xe(r.type).some(s=>!ye(r.attrs[s],t.attrs[s]))||(r.isTextblock||r.type.name==="table")&&!r.content.eq(t.content)))return!1}return!0}var ur=e=>{let o=[];return e.forEach((n,r)=>{n.type.name==="opaque_block"&&o.push([r,r+n.nodeSize])}),o},dr=(e,o)=>{let n=typeof e.from=="number"?e.from:typeof e.pos=="number"?e.pos:null;if(n===null)return!1;let r=typeof e.to=="number"?e.to:n+1;return o.some(([t,s])=>n<s&&r>t)},Ue=(e,o)=>{let n=e.resolve(o);return n.depth&&n.node(1).type.name==="table"?[n.before(1),n.after(1)]:null};function ko(e,o){let n=e.content.findDiffStart(o.content);if(n===null)return null;let{a:r,b:t}=e.content.findDiffEnd(o.content),s=n-Math.min(r,t);s>0&&(r+=s,t+=s);let a=(f,u)=>{let p=f.resolve(n);return p.parent.isTextblock&&p.sameParent(f.resolve(u))};return(Ue(e,n)||Ue(e,r))&&!(a(e,r)&&a(o,t))?(n=Ue(e,n)?.[0]??n,r=Ue(e,r)?.[1]??r,t=Ue(o,t)?.[1]??t,{start:n,endA:r,endB:t,tables:!0}):{start:n,endA:r,endB:t}}function Kt(e,o=null){let n=new Map;o?.forEach(u=>{u.attrs.id&&n.set(u.attrs.id,u)});let r=[];e.forEach(u=>r.push(u));let t=r.map(u=>({id:u.attrs.id,pos:n.get(u.attrs.id)?.attrs.pos??u.attrs.pos})),s=bt(t,"b"),a=!1,f=r.map((u,p)=>{let b=s[p]?.pos??t[p].pos,C=u.content;if(u.type.name==="table"){let w=[];u.forEach(v=>w.push(v));let y=w.map(v=>({id:v.attrs.id,pos:v.attrs.pos})),N=bt(y,"r"),B=w.map((v,L)=>{let Y=N[L]?.pos??y[L].pos;return Y===v.attrs.pos?v:v.type.create({...v.attrs,pos:Y},v.content,v.marks)});B.some((v,L)=>v!==w[L])&&(C=B)}if(b===u.attrs.pos&&C===u.content)return u;a=!0;let M={...u.attrs,pos:b},h=n.get(u.attrs.id);return h&&C===u.content&&h.hasMarkup(u.type,M,u.marks)&&h.content.eq(C)?h:u.type.create(M,C,u.marks)});return a?e.type.create(e.attrs,f):e}var yo=e=>{let o=new Set,n=null;for(let r=0;r<e.childCount;r++){let{id:t,pos:s}=e.child(r).attrs;if(!t||o.has(t)||!un(s)||n!==null&&n>=s)return!1;o.add(t),n=s}return!0},pr=(e,o)=>{for(let n in e.attrs)if(n!=="pos"&&e.attrs[n]!==o.attrs[n])return!1;return!0};function mr(e,o){if(e.childCount!==o.childCount||!yo(e))return!1;for(let n=0;n<e.childCount;n++){let r=e.child(n),t=o.child(n);if(r===t)continue;if(!(r.type===t.type&&r.marks===t.marks&&pr(r,t))&&!r.hasMarkup(t.type,{...t.attrs,pos:r.attrs.pos},t.marks)||!r.content.eq(t.content)||r.type.name==="table"&&!yo(r))return!1}return!0}var wo=e=>{if(e&&typeof e=="object"){for(let o of Object.keys(e))wo(e[o]);Object.freeze(e)}return e},vo=e=>wo(JSON.parse(JSON.stringify(e))),hr=(e,o)=>{let n=gn(o),r=0;for(let t=e.flow._start;t;t=t.right){if(t.id.client===n.client&&t.id.clock===n.clock)return t.deleted?r:r+t.length;!t.deleted&&t.countable&&(r+=t.length)}return r},gr=(e,o)=>{let n=null;for(let r=e.flow._start;r;r=r.right)r.id.client!==e.ydoc.clientID||!(r.content instanceof de)||r.content.embed?.b!==o||(!n||r.id.clock>n.clock)&&(n=r.id);return n};function xo({pd:e,onNotice:o=()=>{},ownedTokens:n=[],authorToken:r=null,stats:t={groups:0,mismatch:0,renders:0,first:null},captureTimeout:s=500}){let a=null,f=null,u=0,p=-1,b=null,C=0,M=new WeakMap,h=Le(e.origins);f=ue(e,h);let w=new on([e.flow,e.attrs,e.gone,e.tableFields,e.boardFields],{trackedOrigins:new Set([me]),captureTimeout:s,captureTransaction:d=>d.meta.get(_e)!==!1,deleteFilter:d=>{if(d.parent!==e.flow||!(d.content instanceof de))return!0;let S=h.resolve(d.id);return S.client!==d.id.client||S.clock!==d.id.clock||h.boundaryOf(d.id)?.kind!=="copy"}}),y=wn(e,w,h,d=>Pe(d).textDeletes),N=new Set,B=new Set(r?[...n,r]:n),v=r?()=>{let d=An(e.ydoc.clientID);e.origins.get(d)!==r&&e.origins.set(d,r)}:null,L=new Set,Y=new Set,$=0,x=null,c=null,E=d=>{let S=new Set;for(let J of d.blocks)for(let V of J.runs){if(!V.displaced)continue;let H=Rn(V.source)?.client===e.ydoc.clientID;V.author&&(H||B.has(V.author))?S.add(V.author):H&&S.add(null)}if(!S.size)return null;let _=[...S].filter(Boolean).sort();return{kind:"recovered-change",source:d.source,revision:d.revision,blockId:d.blockId,author:_[0]??null,authors:_}},i=d=>{let S=d.list.filter(J=>J.recoverable).map(J=>vo(J)),_=vo(S.map(J=>E(J)).filter(J=>J&&!L.has(`${J.source}\0${J.revision}`)));return Object.freeze({recoverable:Object.freeze(S),notices:Object.freeze(_)})},g=(d,S)=>{if(JSON.stringify(i(st(e,{index:h,walked:S})))===JSON.stringify(d)){t.provedRecoveries=(t.provedRecoveries??0)+1;return}throw t.walkMismatch=(t.walkMismatch??0)+1,new Error("Recovery snapshot built from the displacing sources diverged from a full reduction")},A=()=>{if(x&&x.version===$)return x.snapshot;let d=p===u?f:void 0,S=i(jn(e,{index:h,walked:d}));return t.proveWalks&&g(S,d),x={version:$,snapshot:S},S},z=d=>rt({recoverable:d.recoverable.map(S=>[S.source,S.revision]),notices:d.notices}),W=()=>{$++;let d=A();for(let _ of d.notices){let J=`${_.source}\0${_.revision}`;N.has(J)||(N.add(J),o(_))}if(!Y.size){c=null;return}let S=z(d);if(S!==c){c=S;for(let _ of[...Y])_(d)}},T=d=>{f=d,p=u,b=null,C=0},U=()=>p===u?f:null,P=d=>{let S=Ve(e,d),_=Ve(e,ue(e));if(S===_){t.provedWalks=(t.provedWalks??0)+1;return}throw t.walkMismatch=(t.walkMismatch??0)+1,new Error(`Incremental walk diverged from the full walk:
|
|
@@ -27,4 +27,4 @@ ${_}`)},Q=()=>{if(JSON.stringify(i(st(e,{index:h,walked:f})))!==JSON.stringify(A
|
|
|
27
27
|
.blockeditor-recover-row button, .blockeditor-recover-head button { min-height: 44px; }
|
|
28
28
|
}
|
|
29
29
|
`,yr={heading:"Heading",list_item:"List item",toggle:"Toggle",quote:"Quote",code_block:"Code",callout:"Callout",table:"Table",image:"Image"},qt=280,ve=(e,o,n,r={})=>{let t=e.createElement(o);n&&(t.className=n);for(let[s,a]of Object.entries(r))t.setAttribute(s,a);return t};function vr(e,o){let n=ve(e,"div","blockeditor-recover-text"),r=0;for(let t of o.blocks){for(let s of t.runs){if(s.kind!=="text"||r>=qt)continue;let a=s.text.slice(0,qt-r);r+=a.length,n.append(s.displaced?Object.assign(e.createElement("mark"),{textContent:a}):e.createTextNode(a))}r<qt&&t!==o.blocks[o.blocks.length-1]&&n.append(e.createTextNode(" / "))}return n.textContent||(n.textContent="(no text)"),n}function wr(e){let o=new Set;for(let n of e.blocks)for(let r of n.runs)r.displaced&&o.add(r.author??null);return[...o]}function xr(e,o){let n=null;return e.state.doc.forEach((r,t)=>{n===null&&r.attrs.id===o&&(n=r.isTextblock?t+1:t)}),n===null?!1:(e.dispatch(e.state.tr.setSelection(pe.Selection.near(e.state.doc.resolve(n))).scrollIntoView()),e.focus(),!0)}function Sr({binding:e,mount:o,ownTokens:n=[],onRestored:r=()=>{},onStale:t=()=>{}}){let s=o.ownerDocument,a=new Set(n.filter(Boolean)),f=ve(s,"button","blockeditor-recover",{type:"button","aria-haspopup":"dialog","aria-expanded":"false"}),u=ve(s,"div","blockeditor-recover-panel",{role:"dialog","aria-label":"Recover changes"});f.hidden=!0,u.hidden=!0;let p=ve(s,"div","blockeditor-recover-root");p.append(f,u);let b=Vt({name:"blockeditor-recover",content:p,css:[kr],parent:o}),C={recoverable:[],notices:[]},M=null,h="",w=x=>x.some(c=>a.has(c))?x.length>1?"You and others":"You":x.some(c=>c!==null)?"Another editor":"An earlier edit",y=()=>{u.hidden=!0,M=null,f.setAttribute("aria-expanded","false")},N=x=>{let c;try{c=e.restore(x.source,x.revision)}catch(E){return console.error("[clay] Restore failed:",E),Wt("This change could not be restored.","error"),{status:"failed"}}return c.status==="restored"||c.status==="resolved"?r(c.id):c.status==="stale"&&t(c),c},B=()=>{u.replaceChildren();let x=ve(s,"div","blockeditor-recover-head");x.append(s.createTextNode("Recover changes"));let c=ve(s,"button","",{type:"button"});c.textContent="Close",c.addEventListener("click",()=>{y(),f.focus()}),x.append(c);let E=ve(s,"p","blockeditor-recover-note");E.textContent="Text typed while its block was moved or removed. Restore puts it back as a new block.",u.append(x,E);for(let i of C.recoverable){let g=ve(s,"div","blockeditor-recover-row",{"data-source":i.source});i.source===M&&g.classList.add("is-target");let A=ve(s,"div","blockeditor-recover-meta");A.textContent=`${yr[i.type]??"Paragraph"} \xB7 ${w(wr(i))}`;let z=ve(s,"button","",{type:"button"});z.textContent="Restore",z.addEventListener("click",()=>N(i)),g.append(A,vr(s,i),z),u.append(g)}},v=(x=null)=>{if(!C.recoverable.length)return;M=x,u.hidden=!1,f.setAttribute("aria-expanded","true"),B();let c=[...u.querySelectorAll(".blockeditor-recover-row")];(c.find(i=>i.dataset.source===x)??c[0])?.querySelector("button")?.focus()},L=x=>{let c=x.map(E=>`${E.source}\0${E.revision}`).join(`
|
|
30
|
-
`);if(c!==h){if(h=c,!x.length){ft(Ht);return}Ut(Ht,"warning",{actions:[{label:"Review",onClick:()=>v(x[0].source)},{label:"Dismiss",onClick:()=>{for(let E of x)e.dismiss(E.source,E.revision)}}]})}},Y=x=>{C=x;let c=x.recoverable.length;f.hidden=c===0,f.textContent=`Recover changes (${c})`,c?u.hidden||B():y(),L(x.notices)};f.addEventListener("click",()=>u.hidden?v():y()),u.addEventListener("keydown",x=>{x.key==="Escape"&&(x.stopPropagation(),y(),f.focus())});let $=e.subscribeRecovery(Y);return{open:v,close:y,restore:N,get count(){return C.recoverable.length},destroy(){$(),ft(Ht),b.remove()}}}import("./page/editor-
|
|
30
|
+
`);if(c!==h){if(h=c,!x.length){ft(Ht);return}Ut(Ht,"warning",{actions:[{label:"Review",onClick:()=>v(x[0].source)},{label:"Dismiss",onClick:()=>{for(let E of x)e.dismiss(E.source,E.revision)}}]})}},Y=x=>{C=x;let c=x.recoverable.length;f.hidden=c===0,f.textContent=`Recover changes (${c})`,c?u.hidden||B():y(),L(x.notices)};f.addEventListener("click",()=>u.hidden?v():y()),u.addEventListener("keydown",x=>{x.key==="Escape"&&(x.stopPropagation(),y(),f.focus())});let $=e.subscribeRecovery(Y);return{open:v,close:y,restore:N,get count(){return C.recoverable.length},destroy(){$(),ft(Ht),b.remove()}}}import("./page/editor-HS2CAV3W.js").catch(()=>null);export{Wn as ADOPTION_TIMEOUT_MS,Yo as acceptedPageState,Po as blocksFromYValue,je as canon,Mt as classifyFile,Io as createFeatureLoader,Sr as createRecoverList,br as createYPageBinding,xr as focusBlock,To as heldSlashRange,Ao as holdSlashRange,Do as installAdoption,jt as mergePageModels,Co as observeDocumentTitle,it as readBack,Ro as renderFromTags,$o as seedPageFromArticle,Eo as yValueOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as m}from"./c-
|
|
1
|
+
import{d as m}from"./c-EQ5NBOGA.js";import{f as l}from"./c-C7SUMNMI.js";var _=window.__clayWorkspaceBackground===!0;document.addEventListener("clay:workspace-background",()=>{_=!0});document.addEventListener("clay:workspace-foreground",()=>{_=!1});var c=()=>document.hidden||_,y=class extends EventTarget{constructor(e,{shared:s=!1,sharedData:r=!1,documentURL:n,lane:o,clientId:h,startupCheck:t=!1,keepAliveWhenHidden:a=!1,workerFeatures:d=["live-data"]}={}){super(),this.url=e,this.readyState=0,this.onopen=null,this.onmessage=null,this.onerror=null,this._shared=s&&typeof SharedWorker=="function"&&(!r||o==="live"),this._sharedData=r,this._documentURL=n,this._lane=o,this._clientId=h,this._keepAliveWhenHidden=a,this._workerFeatures=d,this._since=0,this._closed=!1,this._suspended=!1,this._repair=!1,this._startup=t,this._worker=null,this._source=null,this._visibility=()=>{clearTimeout(this._hiddenTimer),c()?(this._worker&&this._postWorker(this._worker,"hidden"),this._keepHidden()||(this._hiddenTimer=setTimeout(()=>this._suspend(),5e3))):this._suspended?this._resume():this._worker&&this._postWorker(this._worker,"visible")},this._pagehide=()=>this._suspend(!0),this._pageshow=()=>{(!c()||this._keepHidden())&&this._resume()},document.addEventListener("visibilitychange",this._visibility),document.addEventListener("clay:workspace-background",this._visibility),document.addEventListener("clay:workspace-foreground",this._visibility),window.addEventListener("pagehide",this._pagehide),window.addEventListener("pageshow",this._pageshow),this._open(),c()&&this._visibility()}_emit(e,s){if(this._closed)return;let r=s===void 0?new Event(e):new MessageEvent(e,{data:s});this.dispatchEvent(r),this[`on${e}`]?.(r)}_postWorker(e,s,r={}){e.port.postMessage({v:this._sharedData?2:1,type:s,...r})}_open(){if(!(this._closed||this._suspended)){if(this.readyState=0,!this._shared)return this._openDirect();try{let e=new SharedWorker(new URL(this._sharedData?"/_/sync/data-worker.js":"/_/sync/worker.js",window.location.origin).href,this._sharedData?"clay-sync-data":"clay-sync");this._worker=e;let s=Date.now(),r=!1;e.onerror=()=>{this._worker===e&&(this._shared=!1,this._repair=!0,this._reopen(),c()&&this._visibility())},this._startTimer=setTimeout(e.onerror,5e3),e.port.onmessage=({data:t})=>{if(!(this._worker!==e||t?.v!==(this._sharedData?2:1))){if(this._sharedData){if(t.type==="unsupported"||t.type==="capacity"){e.onerror();return}if(t.type==="gone"){this.readyState=2,this._emit("error"),this.close();return}if(!r){if(t.type!=="hello")return;if(!Array.isArray(t.features)||!this._workerFeatures.every(a=>t.features.includes(a))){e.onerror();return}r=!0,clearTimeout(this._startTimer),s=Date.now();return}if(t.type==="hello")return}if(s=Date.now(),!this._sharedData&&["status","pong","cursor","frame","gone"].includes(t.type)&&clearTimeout(this._startTimer),t.type==="status")t.state==="open"?(!this._sharedData||this.readyState!==1)&&(this.readyState=1,this._emit("open")):t.state==="connecting"&&(this.readyState=0,this._emit("error"));else if(t.type==="cursor"){clearTimeout(this._startTimer),Number.isSafeInteger(t.seq)&&(this._since=Math.max(this._since,t.seq));let a=t.resync===!0||this._repair,d=this._startup;this._repair=!1,this._startup=!1,this._emit("cursor",JSON.stringify({...t,resync:a,startup:d}))}else if(t.type==="frame"&&typeof t.data=="string")this._remember(t.data),this._emit("message",t.data);else if(this._sharedData&&t.type==="event"&&["data","data-state","data-writer","presence"].includes(t.event)&&t.data!==null&&typeof t.data=="object"&&!Array.isArray(t.data))try{this._emit(t.event,JSON.stringify(t.data))}catch{}else t.type==="gone"&&(this.readyState=2,this._emit("error"),this.close())}},e.port.start(),this._postWorker(e,c()?"hidden":"visible");let n={document:this._documentURL,lane:this._lane,since:this._since};this._sharedData&&this._lane==="live"&&(n.clientId=this._clientId),this._postWorker(e,"subscribe",n);let o=0,h=Date.now();this._pingTimer=setInterval(()=>{if(this._worker!==e)return;let t=Date.now(),a=t-h>15e3*6;if(h=t,s>=o&&(o=0),a||o&&t-o>=15e3*3){this._repair=!0,this._reopen();return}o||(o=t),this._postWorker(e,"ping")},15e3)}catch{this._shared=!1,this._reopen(),c()&&this._visibility()}}}_openDirect(){let e=new EventSource(this.url);this._source=e;let s=!1,r=!1;e.onopen=()=>{if(this._source===e&&(s&&!r&&(this._repair=!0),s=!0,this.readyState=1,this._emit("open"),this._repair||this._startup)){let n=this._repair,o=this._startup;this._repair=!1,this._startup=!1,this._emit("cursor",JSON.stringify({resync:n,startup:o}))}},e.onerror=()=>{this._source===e&&(this.readyState=e.readyState,this._emit("error"))},e.onmessage=n=>{this._source===e&&(this._remember(n.data),this._emit("message",n.data))};for(let n of["cursor","presence","data","data-state","data-writer"])e.addEventListener(n,o=>{this._source===e&&(n==="cursor"&&(r=!0),this._emit(n,o.data))})}_remember(e){try{let{seq:s}=JSON.parse(e);Number.isSafeInteger(s)&&(this._since=Math.max(this._since,s))}catch{}}_disconnect(){if(clearTimeout(this._startTimer),clearInterval(this._pingTimer),this._worker){let e=this._worker;this._worker=null,e.onerror=null,e.port.onmessage=null;try{this._postWorker(e,"unsubscribe")}catch{}e.port.close()}this._source&&(this._source.close(),this._source=null)}_keepHidden(){return this._keepAliveWhenHidden===!0||this._keepAliveWhenHidden==="shared"&&this._shared}_reopen(){let e=(this._sharedData||this._keepAliveWhenHidden===!0)&&this.readyState===1;this.readyState=0,e&&this._emit("error"),this._disconnect(),this._open()}_suspend(e=!1){clearTimeout(this._hiddenTimer),!(this._closed||this._suspended)&&(this._suspended=!0,this._repair=!0,this.readyState=0,e&&this._keepAliveWhenHidden===!0&&this._emit("error"),this._disconnect())}_resume(){clearTimeout(this._hiddenTimer),!(this._closed||!this._suspended)&&(this._suspended=!1,this._open())}close(){this._closed=!0,this.readyState=2,clearTimeout(this._hiddenTimer),this._disconnect(),document.removeEventListener("visibilitychange",this._visibility),document.removeEventListener("clay:workspace-background",this._visibility),document.removeEventListener("clay:workspace-foreground",this._visibility),window.removeEventListener("pagehide",this._pagehide),window.removeEventListener("pageshow",this._pageshow)}};var v="This document was upgraded.",u=!1;function p(i,e){let s=i.querySelector(`meta[name="${e}"]`),r=s?s.getAttribute("content"):null;return r&&r.trim()?r.trim():null}function k(i=document){return p(i,"hyper-version")}function T(i){return typeof i!="string"||!i.includes("hyper-version")?null:p(new DOMParser().parseFromString(i,"text/html"),"hyper-version")}function w(i){let e=k();return!!e&&!!i&&i!==e}function D(i){return u?!0:w(T(i))}function b(i){return u?!0:!i||typeof i.querySelector!="function"?!1:w(p(i,"hyper-version"))}function L(){if(u)return Promise.resolve();u=!0;let i=l?import("./core/save-JZ7R4ET2.js").then(r=>r.holdAllSaves(v),()=>{}):Promise.resolve(),e=new CustomEvent("clay:document-upgraded",{detail:{message:v}}),s=l?Promise.resolve():import("./c-ASMLERFA.js").then(r=>r.start(e),()=>{});return document.dispatchEvent(e),Promise.all([i,s]).then(()=>{})}var g=i=>i==null?"":`&blockeditor-format=${i}`,f={spec:{name:"spec",relayPath:"/_/sync",documentHeader:"Document-URL",snapshotKey:"snapshot",streamPath:(i,e,s,r,n)=>`/_/sync?document-url=${encodeURIComponent(i)}&lane=${e}&resume-id=${s}&client-id=${encodeURIComponent(r)}${g(n)}`},legacy:{name:"legacy",relayPath:"/_/live-sync/save",documentHeader:"Page-URL",snapshotKey:"html",streamPath:(i,e,s,r,n)=>`/_/live-sync/stream?page-url=${encodeURIComponent(i)}&lane=${e}&resume-id=${s}&client-id=${encodeURIComponent(r)}${g(n)}`}};function R(){return m().then(i=>{let e=i?.extensions||[],s=e.includes("sync"),r=e.includes("live-data"),n=e.includes("presence"),o=s&&r&&e.includes("sync-worker-data"),h=s&&(o||e.includes("sync-worker")&&!r&&!n);return{profile:s?f.spec:f.legacy,sharedSync:h,sharedData:o,liveData:r,workerFeatures:n?["live-data","presence"]:["live-data"]}}).catch(()=>({profile:f.legacy,sharedSync:!1,sharedData:!1,liveData:!1,workerFeatures:["live-data"]}))}export{c as a,y as b,D as c,b as d,L as e,f,R as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as g,s as k}from"./c-
|
|
1
|
+
import{n as g,s as k}from"./c-EHAR4RJJ.js";import{a as u,b as r,c as d,h as p}from"./c-KU3PX7LL.js";var v=3e4;function a(){return{ok:!1,code:"failed"}}async function x(n,{etag:o}={}){if(typeof n!="string"||n==="")return a();let m=o!==void 0,y=typeof o=="string"&&o?o:null;if(r()||await p(),!r())return{ok:!1,code:"unsupported"};let s=m?y:u();if(!s)return{ok:!1,code:"conflict"};let i=new AbortController,S=setTimeout(()=>i.abort(),v);try{let{url:c,options:b}=k(n,!0,i.signal,g(),s,!1,null,!1),t=await fetch(c,b),f=await t.text(),e={};if(f)try{e=JSON.parse(f)}catch{e={}}if(!t.ok)return t.status===412?{ok:!1,code:"conflict"}:t.status===401||t.status===403?{ok:!1,code:"forbidden"}:a();let l=typeof e.etag=="string"&&e.etag?e.etag:null;return d(l),{ok:!0,etag:l}}catch{return a()}finally{clearTimeout(S)}}export{x as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as y,f as L,h as $,j as B,m}from"./c-J2ZW4HMR.js";import"./c-A5LASUEZ.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as k}from"./c-N326R2JD.js";import{a as w}from"./c-I2SCCUEW.js";import{f as v}from"./c-C7SUMNMI.js";var j=new Set(["accepted","reverted","reconciled"]),T=Math.random().toString(36).slice(2,8),z=0,l=new Map,f=new Map,p=new Set,h=new Set,x=null,O=20,y=null,b=null,u=[];function E(){b??=import("./c-AZM34SPO.js").then(e=>{for(y=e;u.length;)y.keep(u.shift())},e=>{b=null,console.error("clayjs: the conflict recovery module could not be downloaded; conflicts stay in this tab only",e)})}v&&E();function S(e=""){return`${T}:${e}${++z}`}function m(){return x||=w({id:"live-sync-conflicts",isPending:()=>l.size>0||p.size>0}),x}function g(e){m().changed(),document.dispatchEvent(new CustomEvent("clay:sync-conflicts-changed",{detail:{open:[...l.keys()],added:[],removedIds:[],updatedIds:[],...e}}))}function $(e){if(e.kind==="structure"&&e.detail==="remote-wins")return!1;let t=e.recovery;return t?t.applied===!1&&t.unavailable==="hook-veto"?!1:t.localLost!==!1:!0}var C=["kind","id","label","field"];function I(e){if(!e||typeof e!="object")return null;let t={};for(let n of C){let o=e[n];typeof o=="string"&&o?t[n]=o:typeof o=="number"&&Number.isFinite(o)&&(t[n]=String(o))}return Object.keys(t).length?t:null}function F(e){let t=I(e);return t?(typeof e.open=="function"&&(t.open=e.open),t):null}function A(e,t){for(let n of[...h].reverse()){let o;try{o=n(e,t)}catch(r){console.error("clayjs: a conflict context resolver threw; the conflict stays generic",r);continue}let i=F(o);if(i)return i}return null}function L(e){if(typeof e!="function")throw new TypeError("clay.conflicts.registerContext needs a resolver function");return h.add(e),()=>h.delete(e)}function B(e,t){let n=S(),o=Object.assign(t[0],{id:n,applyId:e.id,source:e.source,ticket:e.ticket,rawReports:t,claimedBy:null});return o.context=A(o,e),l.set(n,o),e.ids.add(n),n}function D({source:e,seq:t=null,etag:n=null,domain:o,root:i,recoveryRoot:r=null}){let c=S("a");return f.set(c,{id:c,source:e,seq:t,etag:n,ticket:0,domain:o,root:i,recoveryRoot:r,ids:new Set}),p.add(c),m().changed(),c}function N(e){if(!e.every(n=>n.kind==="structure"&&n.detail==="insert-collision"&&n.recovery?.applied===!0&&!n.recovery.unavailable&&n.recovery.structure?.localAction==="inserted"&&n.recovery.structure.fragmentKind==="element"))return null;let t=e[0].recovery.subject;return t?.local?.length!==1||t.merged?.length!==1||t.live?.length!==1?null:{local:t.local[0],merged:t.merged[0],live:t.live[0]}}function P(e){let t=new Map(e.map(r=>[r,N(r)])),n=(r,c)=>r.length<c.length&&r.every((s,d)=>s===c[d]),o=(r,c)=>c.reduce((s,d)=>d==="content"?s?.content:s?.childNodes[d],r),i=new Map;for(let r of e){let c=t.get(r),s=r;if(c)for(let d of e){let a=t.get(d);a&&a.local.length<t.get(s).local.length&&n(a.local,c.local)&&n(a.merged,c.merged)&&(a.live.contains(c.live)||o(a.live,c.merged.slice(a.merged.length))===c.live)&&(s=d)}i.has(s)||i.set(s,[...s]),r!==s&&i.get(s).push(...r)}return[...i.values()]}function M(e,t){let n=t.map(i=>l.get(i)).filter(Boolean);if(!n.length)return;let o={apply:e,records:n.map(i=>({rec:i,context:I(i.context)}))};if(y)return y.keep(o);u.push(o),u.length>O&&u.shift(),E()}function Q(e,t,{ticket:n}){let o=f.get(e);if(!o)return[];o.ticket=n;let i=new Map;for(let c of t){if(!$(c))continue;let s=c.recovery?.key??Symbol();i.has(s)||i.set(s,[]),i.get(s).push(c)}let r=P([...i.values()]).map(c=>B(o,c));return r.length&&M(o,r),p.delete(e),r.length||f.delete(e),r.length?g({added:r.map(c=>l.get(c))}):m().changed(),r}function X(e,t,{ticket:n=0}={}){let o=f.get(e);if(!o)return[];o.ticket=n,p.delete(e);let i=B(o,[{kind:"apply-incomplete",detail:null,error:String(t)}]);return l.get(i).rawReports=[],M(o,[i]),g({added:[l.get(i)]}),[i]}var q={get size(){return l.size},list(){return[...l.values()]},get(e){return l.get(e)||null},acknowledge(e,{reason:t}={}){if(!Array.isArray(e))throw new TypeError("clay.conflicts.acknowledge needs an array of ids");if(!j.has(t))throw new TypeError(`clay.conflicts.acknowledge: unknown reason "${t}"`);let n=[];for(let o of e){let i=l.get(o);if(!i)continue;k(i),l.delete(o),n.push(o);let r=f.get(i.applyId);r&&(r.ids.delete(o),r.ids.size||f.delete(i.applyId))}return n.length&&(g({removedIds:n,reason:t}),import("./c-AZM34SPO.js").then(o=>o.dismiss(n),()=>{})),{removedIds:n,remainingIds:[...l.keys()]}},claim(e,{owner:t}){if(!t)throw new TypeError("clay.conflicts.claim needs an owner");for(let i of e){let r=l.get(i);if(r&&r.claimedBy&&r.claimedBy!==t)throw new Error(`conflict ${i} is already claimed by ${r.claimedBy}`)}let n=[];for(let i of e){let r=l.get(i);r&&!r.claimedBy&&(r.claimedBy=t,n.push(i))}n.length&&g({updatedIds:n,reason:"claimed"});let o=!1;return{release(){if(o)return;o=!0;let i=n.filter(r=>l.get(r)?.claimedBy===t);for(let r of i)l.get(r).claimedBy=null;i.length&&g({updatedIds:i,reason:"released"})}}},registerContext:L,contextFor:A,recoveryOf(e){let t=l.get(e);return t&&f.get(t.applyId)||null},hasPendingApply(){return p.size>0}};export{E as a,L as b,D as c,Q as d,X as e,q as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as J}from"./c-ZRGEN6QQ.js";import{d as F}from"./c-OH2FPYSY.js";import{c as z}from"./c-FSQXFG5T.js";import{d as _}from"./c-RETTCOWO.js";import"./c-VHNSBD2M.js";var{Decoration:tt,DecorationSet:et}=_,a=(e,o,n,t={},r=null)=>{let l=e.createElement(o);n&&(l.className=n);for(let[s,i]of Object.entries(t))i!=null&&i!==!1&&l.setAttribute(s,i===!0?"":String(i));return r!==null&&(l.textContent=r),l},ot=(e,o)=>a(e,"span","blockeditor-board-face",{"aria-hidden":"true"},([...String(o).trim()][0]??"?").toUpperCase());function I(e,o){let n=null;return e.state.doc.forEach((t,r)=>{t.attrs.id===o&&t.type===F.nodes.list_item&&t.attrs.kind==="check"&&(n={node:t,pos:r})}),n}function X(e,o,n,t){let r=I(e,o);r&&e.dispatch(J(e.state.tr.setNodeMarkup(r.pos,null,{...r.node.attrs,[n]:t||null})))}var L={person:'<circle cx="8" cy="5.4" r="2.3"/><path d="M3.6 13.2c.6-2.1 2.2-3.3 4.4-3.3s3.8 1.2 4.4 3.3"/>',calendar:'<rect x="2.5" y="3.5" width="11" height="10"/><path d="M2.5 6.8h11M5.5 2v2.4M10.5 2v2.4"/>',clock:'<circle cx="8" cy="8" r="5.5"/><path d="M8 4.8v3.4l2.3 1.4"/>',tick:'<path d="M3.5 8.3l3 3 6-6.2"/>',plus:'<path d="M8 3.5v9M3.5 8h9"/>',clear:'<path d="M4.8 4.8l6.4 6.4M11.2 4.8l-6.4 6.4"/>',"chevron-left":'<path d="M9.8 3.6L5.4 8l4.4 4.4"/>',"chevron-right":'<path d="M6.2 3.6L10.6 8l-4.4 4.4"/>'};function q(e,o){let n=e.createElementNS("http://www.w3.org/2000/svg","svg");return n.setAttribute("viewBox","0 0 16 16"),n.setAttribute("width","14"),n.setAttribute("height","14"),n.setAttribute("fill","none"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","1.5"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),n.setAttribute("aria-hidden","true"),n.innerHTML=o,n}var Z=e=>String(e).padStart(2,"0"),B=/^\d{4}-\d{2}-\d{2}$/,S=(e=new Date)=>`${e.getFullYear()}-${Z(e.getMonth()+1)}-${Z(e.getDate())}`,nt=e=>{let o=new Date(`${e}T00:00:00Z`);return o.setUTCDate(o.getUTCDate()+1),o.toISOString().slice(0,10)};function rt(e,o){if(!e)return"No date";if(!B.test(e))return e;if(e===o)return"Today";if(e===nt(o))return"Tomorrow";let n=e.slice(0,4)===o.slice(0,4);return new Date(`${e}T00:00:00Z`).toLocaleDateString("en-US",{month:"short",day:"numeric",...n?{}:{year:"numeric"},timeZone:"UTC"})}function j(e,{name:o,paths:n,label:t,aria:r,filled:l,overdue:s=!1}){let i=a(e,"button","blockeditor-check-chip",{type:"button","data-check":o,"data-filled":String(l),"data-overdue":s?"true":null,"aria-expanded":"false","aria-label":r});return i.append(q(e,n),a(e,"span","blockeditor-check-chip-label",{},t)),i}var N=null;function G(e,o,{className:n,label:t,check:r,onKey:l=null}){let s=o.ownerDocument,i=s.defaultView;N&&N.close();for(let d of s.querySelectorAll(".blockeditor-check-popup"))d.remove();let y=e.dom.parentNode,h=["relative","absolute","fixed","sticky"].includes(i?.getComputedStyle?.(y)?.position??""),k=y&&h?y:s.body,f=a(s,"div",`blockeditor-check-popup ${n}`,{role:"dialog","aria-label":t,"data-check":r}),A=!1,E=()=>{let d=o.getBoundingClientRect(),c=k===s.body?{top:-(i?.scrollY??0),left:-(i?.scrollX??0)}:k.getBoundingClientRect(),p=f.getBoundingClientRect(),u=p.width||Math.min(264,(i?.innerWidth||292)-28),b=(i?.innerHeight??0)-d.bottom-2,g=p.height>0&&b<p.height;f.style.left=`${Math.round(d.right-u-c.left)}px`,f.style.top=`${Math.round((g?d.top-p.height-2:d.bottom+2)-c.top)}px`},C=d=>{if(!f.isConnected)return w();f.contains(d.target)||o.contains(d.target)||w()},w=({focusAnchor:d=!1}={})=>{if(A)return;A=!0,s.removeEventListener("mousedown",C,!0),i?.removeEventListener("resize",E),i?.removeEventListener("scroll",E,!0),N?.panel===f&&(N=null),f.remove(),o.setAttribute("aria-expanded","false");let c=o.dataset.fromKeys==="true";delete o.dataset.fromKeys,d&&c?e.focus():d&&o.focus()};return f.addEventListener("keydown",d=>{if(d.stopPropagation(),d.key==="Escape"){d.preventDefault(),w({focusAnchor:!0});return}l?.(d,f)}),k.append(f),o.setAttribute("aria-expanded","true"),N={panel:f,close:()=>w()},s.addEventListener("mousedown",C,!0),i?.addEventListener("resize",E),i?.addEventListener("scroll",E,!0),{panel:f,close:w,place:E}}function ct(e,o){let n=new Map;e.state.doc.forEach(t=>{if(t.type!==F.nodes.list_item||t.attrs.kind!=="check")return;let r=String(t.attrs.owner??"").trim();if(!r)return;let l=r.toLowerCase(),s=n.get(l)??{name:r,count:0};s.count+=1,n.set(l,s)});for(let t of o??[]){let r=String((typeof t=="string"?t:t?.name)??"").trim();r&&!n.has(r.toLowerCase())&&n.set(r.toLowerCase(),{name:r,count:0})}return[...n.values()].sort((t,r)=>t.name.localeCompare(r.name))}function at(e,o,n){let t=n.ownerDocument,r=I(e,o)?.node.attrs.owner||"",{panel:l,close:s,place:i}=G(e,n,{className:"blockeditor-check-owner",label:"Assignee",check:"owner-panel",onKey:(c,p)=>{if(c.key!=="ArrowDown"&&c.key!=="ArrowUp")return;c.preventDefault();let u=[...p.querySelectorAll("input, button:not([disabled])")],b=u.indexOf(t.activeElement),g=c.key==="ArrowDown"?1:-1;(b<0?g>0?u[0]:u[u.length-1]:u[(b+g+u.length)%u.length])?.focus()}}),y=a(t,"input","blockeditor-check-search",{type:"text",placeholder:"Find or type a name","aria-label":"Find or type a name"}),h=a(t,"div","blockeditor-check-people"),k=a(t,"button","blockeditor-check-person blockeditor-check-danger",{type:"button","data-check":"clear-owner"});k.append(q(t,L.clear),a(t,"span","blockeditor-check-person-name",{},"Remove assignee")),k.disabled=!r,k.addEventListener("click",()=>A(null)),l.append(y,a(t,"div","blockeditor-check-subhead",{},"People in this document"),h,a(t,"div","blockeditor-check-divider"),k);let f=[],A=c=>{s(),X(e,o,"owner",c)},E=(c,p)=>{let u=c.toLowerCase()===String(r).toLowerCase(),b=a(t,"button","blockeditor-check-person",{type:"button","data-check":"owner-option","data-name":c,"aria-pressed":String(u)});return b.append(ot(t,c),a(t,"span","blockeditor-check-person-name",{},c),a(t,"span","blockeditor-check-person-meta",{},`${p} ${p===1?"item":"items"}`)),u&&b.append(q(t,L.tick)),b.addEventListener("click",()=>A(c)),b},C=c=>{let p=a(t,"button","blockeditor-check-person",{type:"button","data-check":"owner-new","data-name":c}),u=a(t,"span","blockeditor-check-person-name",{},"Assign to ");return u.append(a(t,"strong",null,{},c)),p.append(q(t,L.plus),u,a(t,"span","blockeditor-check-person-meta",{},"New")),p.addEventListener("click",()=>A(c)),p},w=()=>{let c=y.value.trim(),p=c.toLowerCase(),u=ct(e,f),b=[];c&&!u.some(g=>g.name.toLowerCase()===p)&&b.push(C(c));for(let g of u)p&&!g.name.toLowerCase().includes(p)||b.push(E(g.name,g.count));h.replaceChildren(...b)};y.addEventListener("keydown",c=>{if(c.stopPropagation(),c.key==="Escape"){c.preventDefault(),s({focusAnchor:!0});return}c.key==="Enter"&&(c.preventDefault(),h.querySelector("button[data-check]")?.click())}),y.addEventListener("input",w),w(),i(),y.focus();let d=globalThis.clay?.people?.available;d&&Promise.resolve().then(()=>d()).then(c=>{!N||N.panel!==l||(f=Array.isArray(c)?c:[],w())}).catch(()=>{})}var st=["January","February","March","April","May","June","July","August","September","October","November","December"],$=(e,o,n)=>new Date(e,o,n),it=e=>e.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"}),lt=e=>e.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"}),W=e=>{if(!e||!B.test(e))return null;let[o,n,t]=e.split("-").map(Number);return $(o,n-1,t)};function dt(e,o,n){let t=n.ownerDocument,r=I(e,o)?.node.attrs.due||null,l=S(),s=new Date,i=$(s.getFullYear(),s.getMonth(),s.getDate()),y=W(r)??i,h=y.getFullYear(),k=y.getMonth(),{panel:f,close:A,place:E}=G(e,n,{className:"blockeditor-check-date",label:"Due date",check:"date-panel",onKey:(m,D)=>Q(m,D)}),C=m=>{A(),X(e,o,"due",m)},w=a(t,"div","blockeditor-check-quick"),d=(m,D)=>{let M=$(i.getFullYear(),i.getMonth(),i.getDate()+D),x=a(t,"button","blockeditor-check-quick-row",{type:"button","data-check":"date-quick","data-date":S(M)});return x.append(q(t,L.calendar),a(t,"span","blockeditor-check-quick-label",{},m),a(t,"span","blockeditor-check-quick-meta",{},it(M))),x.addEventListener("click",()=>C(S(M))),x};w.append(d("Today",0),d("Tomorrow",1),d("Next week",7));let c=a(t,"div","blockeditor-check-cal"),p=a(t,"div","blockeditor-check-cal-head"),u=a(t,"span","blockeditor-check-cal-month"),b=a(t,"span","blockeditor-check-cal-nav"),g=m=>{let D=$(h,k+m,1);h=D.getFullYear(),k=D.getMonth(),H()},U=a(t,"button","blockeditor-check-cal-btn",{type:"button","aria-label":"Previous month"}),O=a(t,"button","blockeditor-check-cal-btn",{type:"button","aria-label":"Next month"});U.append(q(t,L["chevron-left"])),O.append(q(t,L["chevron-right"])),U.addEventListener("click",()=>g(-1)),O.addEventListener("click",()=>g(1)),b.append(U,O),p.append(u,b);let Y=a(t,"div","blockeditor-check-cal-grid");c.append(p,Y);let H=()=>{u.replaceChildren(a(t,"span",null,{},`${st[k]} `),a(t,"span","blockeditor-check-cal-year",{},String(h)));let m=$(h,k,1),D=$(h,k+1,0).getDate(),M=Math.ceil((m.getDay()+D)/7)*7,x=["S","M","T","W","T","F","S"].map(v=>a(t,"span","blockeditor-check-cal-dow",{},v)),T=[];for(let v=0;v<M;v+=1){let P=$(h,k,1-m.getDay()+v),R=S(P),V=a(t,"button","blockeditor-check-cal-day",{type:"button","data-check":"date-day","data-date":R,"data-outside":String(P.getMonth()!==k),"data-today":String(R===l),"aria-pressed":String(R===r),"aria-label":lt(P)},String(P.getDate()));V.addEventListener("click",()=>C(R)),T.push(V)}Y.replaceChildren(...x,...T)},Q=(m,D)=>{let M=t.activeElement?.closest?.('[data-check="date-day"]');if(!M)return;if(m.key==="Enter"||m.key===" "){m.preventDefault(),M.click();return}let x={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7}[m.key];if(!x)return;m.preventDefault();let T=W(M.dataset.date),v=$(T.getFullYear(),T.getMonth(),T.getDate()+x);(v.getMonth()!==k||v.getFullYear()!==h)&&(h=v.getFullYear(),k=v.getMonth(),H()),D.querySelector(`[data-check="date-day"][data-date="${S(v)}"]`)?.focus()},K=a(t,"button","blockeditor-check-quick-row blockeditor-check-danger",{type:"button","data-check":"clear-date"});K.append(q(t,L.clear),a(t,"span","blockeditor-check-quick-label",{},"Clear date")),K.disabled=!r,K.addEventListener("click",()=>C(null)),f.append(w,c,a(t,"div","blockeditor-check-divider"),K),H(),E(),(Y.querySelector('[data-check="date-day"][aria-pressed="true"]')??Y.querySelector('[data-check="date-day"][data-today="true"]'))?.focus()}function ut(e,o){let n=e.dom.ownerDocument,t=n.createElement("span");t.className="blockeditor-check-controls",t.contentEditable="false",t.dataset.empty=String(!o.attrs.owner&&!o.attrs.due);let r=S(),l=o.attrs.owner||"Unassigned",s=j(n,{name:"owner",paths:L.person,label:l,aria:`Assignee: ${l}`,filled:!!o.attrs.owner}),i=rt(o.attrs.due,r),y=!!o.attrs.due&&!o.attrs.checked&&B.test(o.attrs.due)&&o.attrs.due<r,h=j(n,{name:"date",paths:y?L.clock:L.calendar,label:i,aria:`Due date: ${i}`,filled:!!o.attrs.due,overdue:y});return s.addEventListener("click",()=>at(e,o.attrs.id,s)),h.addEventListener("click",()=>dt(e,o.attrs.id,h)),t.append(s,h),t}function pt(e,o){let n=e.state.selection.$head;if(n.depth!==1||n.parent.type!==F.nodes.list_item||n.parent.attrs.kind!=="check")return!1;let t=n.parent.attrs.id,l=[...e.dom.querySelectorAll(".blockeditor-check-controls")].find(s=>s.dataset.item===t)?.querySelector(`[data-check="${o}"]`);return l?(l.dataset.fromKeys="true",l.click(),!0):!1}function ht(e){let o=[],n=S();return e.doc.forEach((t,r)=>{t.type!==F.nodes.list_item||t.attrs.kind!=="check"||o.push(tt.widget(r+t.nodeSize-1,l=>{let s=ut(l,t);return s.dataset.item=t.attrs.id,s},{key:`${t.attrs.id}:${t.attrs.owner}:${t.attrs.due}:${t.attrs.checked}:${n}`,side:-1,stopEvent:l=>!!l.target.closest?.(".blockeditor-check-chip, .blockeditor-check-popup"),ignoreSelection:!0}))}),et.create(e.doc,o)}function kt(e){let o=S(),n=()=>{e.isDestroyed||S()===o||(o=S(),e.dispatch(e.state.tr.setMeta("addToHistory",!1)))},t=e.dom.ownerDocument.defaultView,r=t.setInterval(n,6e4);return t.document.addEventListener("visibilitychange",n),()=>{t.clearInterval(r),t.document.removeEventListener("visibilitychange",n)}}function gt({view:e=null}={}){let o=e?z(e,{decorations:ht,focusControl:pt}):()=>{},n=e?kt(e):()=>{};return e&&!e.isDestroyed&&e.dispatch(e.state.tr.setMeta("addToHistory",!1)),{id:"checklist",dispose(){o(),n()}}}export{gt as createFeature,ht as decorations,pt as focusControl};
|
|
1
|
+
import{C as J}from"./c-3Y234AUB.js";import{d as F}from"./c-OH2FPYSY.js";import{c as z}from"./c-FSQXFG5T.js";import{d as _}from"./c-RETTCOWO.js";import"./c-VHNSBD2M.js";var{Decoration:tt,DecorationSet:et}=_,a=(e,o,n,t={},r=null)=>{let l=e.createElement(o);n&&(l.className=n);for(let[s,i]of Object.entries(t))i!=null&&i!==!1&&l.setAttribute(s,i===!0?"":String(i));return r!==null&&(l.textContent=r),l},ot=(e,o)=>a(e,"span","blockeditor-board-face",{"aria-hidden":"true"},([...String(o).trim()][0]??"?").toUpperCase());function I(e,o){let n=null;return e.state.doc.forEach((t,r)=>{t.attrs.id===o&&t.type===F.nodes.list_item&&t.attrs.kind==="check"&&(n={node:t,pos:r})}),n}function X(e,o,n,t){let r=I(e,o);r&&e.dispatch(J(e.state.tr.setNodeMarkup(r.pos,null,{...r.node.attrs,[n]:t||null})))}var L={person:'<circle cx="8" cy="5.4" r="2.3"/><path d="M3.6 13.2c.6-2.1 2.2-3.3 4.4-3.3s3.8 1.2 4.4 3.3"/>',calendar:'<rect x="2.5" y="3.5" width="11" height="10"/><path d="M2.5 6.8h11M5.5 2v2.4M10.5 2v2.4"/>',clock:'<circle cx="8" cy="8" r="5.5"/><path d="M8 4.8v3.4l2.3 1.4"/>',tick:'<path d="M3.5 8.3l3 3 6-6.2"/>',plus:'<path d="M8 3.5v9M3.5 8h9"/>',clear:'<path d="M4.8 4.8l6.4 6.4M11.2 4.8l-6.4 6.4"/>',"chevron-left":'<path d="M9.8 3.6L5.4 8l4.4 4.4"/>',"chevron-right":'<path d="M6.2 3.6L10.6 8l-4.4 4.4"/>'};function q(e,o){let n=e.createElementNS("http://www.w3.org/2000/svg","svg");return n.setAttribute("viewBox","0 0 16 16"),n.setAttribute("width","14"),n.setAttribute("height","14"),n.setAttribute("fill","none"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","1.5"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),n.setAttribute("aria-hidden","true"),n.innerHTML=o,n}var Z=e=>String(e).padStart(2,"0"),B=/^\d{4}-\d{2}-\d{2}$/,S=(e=new Date)=>`${e.getFullYear()}-${Z(e.getMonth()+1)}-${Z(e.getDate())}`,nt=e=>{let o=new Date(`${e}T00:00:00Z`);return o.setUTCDate(o.getUTCDate()+1),o.toISOString().slice(0,10)};function rt(e,o){if(!e)return"No date";if(!B.test(e))return e;if(e===o)return"Today";if(e===nt(o))return"Tomorrow";let n=e.slice(0,4)===o.slice(0,4);return new Date(`${e}T00:00:00Z`).toLocaleDateString("en-US",{month:"short",day:"numeric",...n?{}:{year:"numeric"},timeZone:"UTC"})}function j(e,{name:o,paths:n,label:t,aria:r,filled:l,overdue:s=!1}){let i=a(e,"button","blockeditor-check-chip",{type:"button","data-check":o,"data-filled":String(l),"data-overdue":s?"true":null,"aria-expanded":"false","aria-label":r});return i.append(q(e,n),a(e,"span","blockeditor-check-chip-label",{},t)),i}var N=null;function G(e,o,{className:n,label:t,check:r,onKey:l=null}){let s=o.ownerDocument,i=s.defaultView;N&&N.close();for(let d of s.querySelectorAll(".blockeditor-check-popup"))d.remove();let y=e.dom.parentNode,h=["relative","absolute","fixed","sticky"].includes(i?.getComputedStyle?.(y)?.position??""),k=y&&h?y:s.body,f=a(s,"div",`blockeditor-check-popup ${n}`,{role:"dialog","aria-label":t,"data-check":r}),A=!1,E=()=>{let d=o.getBoundingClientRect(),c=k===s.body?{top:-(i?.scrollY??0),left:-(i?.scrollX??0)}:k.getBoundingClientRect(),p=f.getBoundingClientRect(),u=p.width||Math.min(264,(i?.innerWidth||292)-28),b=(i?.innerHeight??0)-d.bottom-2,g=p.height>0&&b<p.height;f.style.left=`${Math.round(d.right-u-c.left)}px`,f.style.top=`${Math.round((g?d.top-p.height-2:d.bottom+2)-c.top)}px`},C=d=>{if(!f.isConnected)return w();f.contains(d.target)||o.contains(d.target)||w()},w=({focusAnchor:d=!1}={})=>{if(A)return;A=!0,s.removeEventListener("mousedown",C,!0),i?.removeEventListener("resize",E),i?.removeEventListener("scroll",E,!0),N?.panel===f&&(N=null),f.remove(),o.setAttribute("aria-expanded","false");let c=o.dataset.fromKeys==="true";delete o.dataset.fromKeys,d&&c?e.focus():d&&o.focus()};return f.addEventListener("keydown",d=>{if(d.stopPropagation(),d.key==="Escape"){d.preventDefault(),w({focusAnchor:!0});return}l?.(d,f)}),k.append(f),o.setAttribute("aria-expanded","true"),N={panel:f,close:()=>w()},s.addEventListener("mousedown",C,!0),i?.addEventListener("resize",E),i?.addEventListener("scroll",E,!0),{panel:f,close:w,place:E}}function ct(e,o){let n=new Map;e.state.doc.forEach(t=>{if(t.type!==F.nodes.list_item||t.attrs.kind!=="check")return;let r=String(t.attrs.owner??"").trim();if(!r)return;let l=r.toLowerCase(),s=n.get(l)??{name:r,count:0};s.count+=1,n.set(l,s)});for(let t of o??[]){let r=String((typeof t=="string"?t:t?.name)??"").trim();r&&!n.has(r.toLowerCase())&&n.set(r.toLowerCase(),{name:r,count:0})}return[...n.values()].sort((t,r)=>t.name.localeCompare(r.name))}function at(e,o,n){let t=n.ownerDocument,r=I(e,o)?.node.attrs.owner||"",{panel:l,close:s,place:i}=G(e,n,{className:"blockeditor-check-owner",label:"Assignee",check:"owner-panel",onKey:(c,p)=>{if(c.key!=="ArrowDown"&&c.key!=="ArrowUp")return;c.preventDefault();let u=[...p.querySelectorAll("input, button:not([disabled])")],b=u.indexOf(t.activeElement),g=c.key==="ArrowDown"?1:-1;(b<0?g>0?u[0]:u[u.length-1]:u[(b+g+u.length)%u.length])?.focus()}}),y=a(t,"input","blockeditor-check-search",{type:"text",placeholder:"Find or type a name","aria-label":"Find or type a name"}),h=a(t,"div","blockeditor-check-people"),k=a(t,"button","blockeditor-check-person blockeditor-check-danger",{type:"button","data-check":"clear-owner"});k.append(q(t,L.clear),a(t,"span","blockeditor-check-person-name",{},"Remove assignee")),k.disabled=!r,k.addEventListener("click",()=>A(null)),l.append(y,a(t,"div","blockeditor-check-subhead",{},"People in this document"),h,a(t,"div","blockeditor-check-divider"),k);let f=[],A=c=>{s(),X(e,o,"owner",c)},E=(c,p)=>{let u=c.toLowerCase()===String(r).toLowerCase(),b=a(t,"button","blockeditor-check-person",{type:"button","data-check":"owner-option","data-name":c,"aria-pressed":String(u)});return b.append(ot(t,c),a(t,"span","blockeditor-check-person-name",{},c),a(t,"span","blockeditor-check-person-meta",{},`${p} ${p===1?"item":"items"}`)),u&&b.append(q(t,L.tick)),b.addEventListener("click",()=>A(c)),b},C=c=>{let p=a(t,"button","blockeditor-check-person",{type:"button","data-check":"owner-new","data-name":c}),u=a(t,"span","blockeditor-check-person-name",{},"Assign to ");return u.append(a(t,"strong",null,{},c)),p.append(q(t,L.plus),u,a(t,"span","blockeditor-check-person-meta",{},"New")),p.addEventListener("click",()=>A(c)),p},w=()=>{let c=y.value.trim(),p=c.toLowerCase(),u=ct(e,f),b=[];c&&!u.some(g=>g.name.toLowerCase()===p)&&b.push(C(c));for(let g of u)p&&!g.name.toLowerCase().includes(p)||b.push(E(g.name,g.count));h.replaceChildren(...b)};y.addEventListener("keydown",c=>{if(c.stopPropagation(),c.key==="Escape"){c.preventDefault(),s({focusAnchor:!0});return}c.key==="Enter"&&(c.preventDefault(),h.querySelector("button[data-check]")?.click())}),y.addEventListener("input",w),w(),i(),y.focus();let d=globalThis.clay?.people?.available;d&&Promise.resolve().then(()=>d()).then(c=>{!N||N.panel!==l||(f=Array.isArray(c)?c:[],w())}).catch(()=>{})}var st=["January","February","March","April","May","June","July","August","September","October","November","December"],$=(e,o,n)=>new Date(e,o,n),it=e=>e.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"}),lt=e=>e.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"}),W=e=>{if(!e||!B.test(e))return null;let[o,n,t]=e.split("-").map(Number);return $(o,n-1,t)};function dt(e,o,n){let t=n.ownerDocument,r=I(e,o)?.node.attrs.due||null,l=S(),s=new Date,i=$(s.getFullYear(),s.getMonth(),s.getDate()),y=W(r)??i,h=y.getFullYear(),k=y.getMonth(),{panel:f,close:A,place:E}=G(e,n,{className:"blockeditor-check-date",label:"Due date",check:"date-panel",onKey:(m,D)=>Q(m,D)}),C=m=>{A(),X(e,o,"due",m)},w=a(t,"div","blockeditor-check-quick"),d=(m,D)=>{let M=$(i.getFullYear(),i.getMonth(),i.getDate()+D),x=a(t,"button","blockeditor-check-quick-row",{type:"button","data-check":"date-quick","data-date":S(M)});return x.append(q(t,L.calendar),a(t,"span","blockeditor-check-quick-label",{},m),a(t,"span","blockeditor-check-quick-meta",{},it(M))),x.addEventListener("click",()=>C(S(M))),x};w.append(d("Today",0),d("Tomorrow",1),d("Next week",7));let c=a(t,"div","blockeditor-check-cal"),p=a(t,"div","blockeditor-check-cal-head"),u=a(t,"span","blockeditor-check-cal-month"),b=a(t,"span","blockeditor-check-cal-nav"),g=m=>{let D=$(h,k+m,1);h=D.getFullYear(),k=D.getMonth(),H()},U=a(t,"button","blockeditor-check-cal-btn",{type:"button","aria-label":"Previous month"}),O=a(t,"button","blockeditor-check-cal-btn",{type:"button","aria-label":"Next month"});U.append(q(t,L["chevron-left"])),O.append(q(t,L["chevron-right"])),U.addEventListener("click",()=>g(-1)),O.addEventListener("click",()=>g(1)),b.append(U,O),p.append(u,b);let Y=a(t,"div","blockeditor-check-cal-grid");c.append(p,Y);let H=()=>{u.replaceChildren(a(t,"span",null,{},`${st[k]} `),a(t,"span","blockeditor-check-cal-year",{},String(h)));let m=$(h,k,1),D=$(h,k+1,0).getDate(),M=Math.ceil((m.getDay()+D)/7)*7,x=["S","M","T","W","T","F","S"].map(v=>a(t,"span","blockeditor-check-cal-dow",{},v)),T=[];for(let v=0;v<M;v+=1){let P=$(h,k,1-m.getDay()+v),R=S(P),V=a(t,"button","blockeditor-check-cal-day",{type:"button","data-check":"date-day","data-date":R,"data-outside":String(P.getMonth()!==k),"data-today":String(R===l),"aria-pressed":String(R===r),"aria-label":lt(P)},String(P.getDate()));V.addEventListener("click",()=>C(R)),T.push(V)}Y.replaceChildren(...x,...T)},Q=(m,D)=>{let M=t.activeElement?.closest?.('[data-check="date-day"]');if(!M)return;if(m.key==="Enter"||m.key===" "){m.preventDefault(),M.click();return}let x={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7}[m.key];if(!x)return;m.preventDefault();let T=W(M.dataset.date),v=$(T.getFullYear(),T.getMonth(),T.getDate()+x);(v.getMonth()!==k||v.getFullYear()!==h)&&(h=v.getFullYear(),k=v.getMonth(),H()),D.querySelector(`[data-check="date-day"][data-date="${S(v)}"]`)?.focus()},K=a(t,"button","blockeditor-check-quick-row blockeditor-check-danger",{type:"button","data-check":"clear-date"});K.append(q(t,L.clear),a(t,"span","blockeditor-check-quick-label",{},"Clear date")),K.disabled=!r,K.addEventListener("click",()=>C(null)),f.append(w,c,a(t,"div","blockeditor-check-divider"),K),H(),E(),(Y.querySelector('[data-check="date-day"][aria-pressed="true"]')??Y.querySelector('[data-check="date-day"][data-today="true"]'))?.focus()}function ut(e,o){let n=e.dom.ownerDocument,t=n.createElement("span");t.className="blockeditor-check-controls",t.contentEditable="false",t.dataset.empty=String(!o.attrs.owner&&!o.attrs.due);let r=S(),l=o.attrs.owner||"Unassigned",s=j(n,{name:"owner",paths:L.person,label:l,aria:`Assignee: ${l}`,filled:!!o.attrs.owner}),i=rt(o.attrs.due,r),y=!!o.attrs.due&&!o.attrs.checked&&B.test(o.attrs.due)&&o.attrs.due<r,h=j(n,{name:"date",paths:y?L.clock:L.calendar,label:i,aria:`Due date: ${i}`,filled:!!o.attrs.due,overdue:y});return s.addEventListener("click",()=>at(e,o.attrs.id,s)),h.addEventListener("click",()=>dt(e,o.attrs.id,h)),t.append(s,h),t}function pt(e,o){let n=e.state.selection.$head;if(n.depth!==1||n.parent.type!==F.nodes.list_item||n.parent.attrs.kind!=="check")return!1;let t=n.parent.attrs.id,l=[...e.dom.querySelectorAll(".blockeditor-check-controls")].find(s=>s.dataset.item===t)?.querySelector(`[data-check="${o}"]`);return l?(l.dataset.fromKeys="true",l.click(),!0):!1}function ht(e){let o=[],n=S();return e.doc.forEach((t,r)=>{t.type!==F.nodes.list_item||t.attrs.kind!=="check"||o.push(tt.widget(r+t.nodeSize-1,l=>{let s=ut(l,t);return s.dataset.item=t.attrs.id,s},{key:`${t.attrs.id}:${t.attrs.owner}:${t.attrs.due}:${t.attrs.checked}:${n}`,side:-1,stopEvent:l=>!!l.target.closest?.(".blockeditor-check-chip, .blockeditor-check-popup"),ignoreSelection:!0}))}),et.create(e.doc,o)}function kt(e){let o=S(),n=()=>{e.isDestroyed||S()===o||(o=S(),e.dispatch(e.state.tr.setMeta("addToHistory",!1)))},t=e.dom.ownerDocument.defaultView,r=t.setInterval(n,6e4);return t.document.addEventListener("visibilitychange",n),()=>{t.clearInterval(r),t.document.removeEventListener("visibilitychange",n)}}function gt({view:e=null}={}){let o=e?z(e,{decorations:ht,focusControl:pt}):()=>{},n=e?kt(e):()=>{};return e&&!e.isDestroyed&&e.dispatch(e.state.tr.setMeta("addToHistory",!1)),{id:"checklist",dispose(){o(),n()}}}export{gt as createFeature,ht as decorations,pt as focusControl};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as H,D as X,d as M,g as L,h as O,j as D,m as I,n as R,o as k,p as C,q as A,r as N,t as $}from"./c-
|
|
1
|
+
import{C as H,D as X,d as M,g as L,h as O,j as D,m as I,n as R,o as k,p as C,q as A,r as N,t as $}from"./c-3Y234AUB.js";import{d as B}from"./c-OH2FPYSY.js";var _=new WeakMap;function g(s){let t=_.get(s);return t||_.set(s,t=O(s)),t}var F=B.nodes,w=s=>s.type===F.list_item,S=s=>s.type===F.toggle,y=s=>s.attrs.parent??null;function J(s,t,e){if(e<0)return[null];let n=[],i=s[e].node;S(i)&&i.attrs.open&&!s[e].hidden&&n.unshift(i.attrs.id);for(let r=y(i);r!==null&&!n.includes(r);){let c=s[t.get(r)];if(!c)break;n.unshift(r),r=y(c.node)}let o=[null];for(let r of n){let c=s[t.get(r)];if(!c.node.attrs.open||c.hidden)break;o.push(r)}return o}function Y(s,t,e,n){let i=y(s[t].node),o=w(s[t].node)?n.indent-s[t].node.attrs.indent:0;return r=>r.i<t||r.i>e||y(r.node)!==i?null:w(r.node)?{parent:n.parent,indent:r.node.attrs.indent+o}:{parent:n.parent}}function Q(s,t){let e=null;s.doc.forEach((n,i)=>{n.attrs.id===t&&S(n)&&(e={n,off:i})}),e&&!e.n.attrs.open&&s.setNodeMarkup(e.off,null,{...e.n.attrs,open:!0})}function P(s,t,e,n,i,o=null){let r=Y(t,e,n,i),c=t[e].at,d=t[n].end,h=o??new C(s.doc.resolve(c),s.doc.resolve(d)),a;if(i.at===c||i.at===d){a=s.tr;for(let l=e;l<=n;l++){let p=r(t[l]);p&&a.setNodeMarkup(t[l].at,null,{...t[l].node.attrs,...p})}a.setSelection(h.map(a.doc,a.mapping)),a.setMeta(L,A(t,e,n,i.at,r))}else a=N(s,t,e,n,i.at,r,h);if(i.open){Q(a,i.open);let l=a.getMeta(L);l&&a.setMeta(L,{...l,attrs:{...l.attrs,[i.open]:{open:!0}}})}return a}function K(s,t,e,n,i){if(i.parent!=null&&t.slice(e,n+1).some(a=>a.node.attrs.id===i.parent))return!1;let o=t[n].end-t[e].at,r=Y(t,e,n,i);for(let a=e;a<=n;a++)if(w(t[a].node)&&(r(t[a])?.indent??t[a].node.attrs.indent)>$)return!1;let c=P(s,t,e,n,i),h=i.at===t[e].at||i.at===t[n].end?t[e].at:i.at>t[e].at?i.at-o:i.at;return D(c.doc,s.doc).every(a=>a.at>=h&&a.at<h+o)}function U(s,t,e,n,i){let o=new Map;t.forEach(l=>{S(l.node)&&l.node.attrs.id&&o.set(l.node.attrs.id,l.i)});let r=i<0?s.doc.content.size:t[i].at;if(r>t[e].at&&r<t[n].end)return[];let c=(i<0?t.length:i)-1,d=J(t,o,c),h=d.indexOf(i<0?null:y(t[i].node)),a=[];for(let l of d.slice(Math.max(0,h))){let p=l===null?0:t[o.get(l)].depth+1,E=c>=0&&w(t[c].node)&&y(t[c].node)===l?t[c].node:null,f=w(t[e].node)&&E?E.attrs.indent+1:0;for(let u=0;u<=f;u++){let m={at:r,parent:l,indent:u,depth:p+(w(t[e].node)?u:0)};K(s,t,e,n,m)&&a.push(m)}}return a}function q(s,t,e,n,i){let o=t[i];if(!o||!S(o.node)||o.node.attrs.open||o.hidden||i>=e&&i<=n||o.at>t[e].at&&o.at<t[n].end)return null;let r=o.node.attrs.id,c={at:t[o.subEnd].end,parent:r,indent:0,depth:o.depth+1,open:r};return K(s,t,e,n,c)?c:null}function z(s,t){let e=null;for(let n of s)(!e||Math.abs(n.depth-t)<Math.abs(e.depth-t))&&(e=n);return e}var Z=4,tt=250,V=8,b=56,W=18;function et(s){for(let t=s.parentElement;t;t=t.parentElement){let e=getComputedStyle(t).overflowY;if((e==="auto"||e==="scroll")&&t.scrollHeight>t.clientHeight)return t}return s.ownerDocument.scrollingElement}var j=new WeakMap;function nt(s,t){let e=j.get(s);if(!e){e=[];for(let n of s){if(n.hidden)continue;let i=t.nodeDOM(n.at);i?.getBoundingClientRect&&e.push({i:n.i,dom:i})}j.set(s,e)}return e}function it(s,t){let e=0,n=s.length;for(;e<n;){let i=e+n>>1,o=s[i].dom.getBoundingClientRect();t<o.top+o.height/2?n=i:e=i+1}return e<s.length?e:-1}var G=class{constructor(t,e,{index:n,onClick:i}){this.view=t,this.grip=e,this.index=n,this.onClick=i,this.shell=t.dom.parentElement,this.line=document.createElement("div"),this.line.className="blockeditor-drop",this.line.hidden=!0,this.line.setAttribute("aria-hidden","true"),this.shell.append(this.line),this.state=null,this.onMove=o=>this.move(o),this.onUp=o=>this.end(o),this.onCancel=o=>{o.pointerId===this.state?.pointer&&this.cancel()},this.onKey=o=>{o.key==="Escape"&&this.state?.active&&(o.preventDefault(),o.stopPropagation(),this.cancel())},this.onOther=o=>{this.state&&o.pointerId!==this.state.pointer&&this.cancel()},this.onBlur=()=>this.cancel(),this.onScroll=()=>{this.state&&!this.state.active&&this.stop()},e.addEventListener("pointerdown",o=>this.start(o))}start(t){if(t.button!==0||this.state)return;let e=this.view.state,n=g(e.doc),i=e.selection,o=Math.min(this.index(),n.length-1),r=i instanceof C&&n[o].at>=i.from&&n[o].end<=i.to,{lo:c,hi:d}=r?i.span(e.doc):I(n,o,o);if(this.state={index:o,span:R(n,c,d),touch:t.pointerType==="touch",pointer:t.pointerId,x0:t.clientX,y0:t.clientY,x:t.clientX,y:t.clientY,hold:0,active:!1,raf:0,gap:void 0,targets:[],target:null},this.grip.setPointerCapture?.(t.pointerId),this.grip.addEventListener("pointermove",this.onMove),this.grip.addEventListener("pointerup",this.onUp),this.grip.addEventListener("pointercancel",this.onCancel),this.grip.addEventListener("lostpointercapture",this.onCancel),this.state.touch){let h=this.state;h.hold=setTimeout(()=>this.held(h),tt),window.addEventListener("pointerdown",this.onOther,!0),window.addEventListener("blur",this.onBlur),window.addEventListener("scroll",this.onScroll,!0)}t.preventDefault()}held(t){if(!(this.state!==t||t.active)){if(t.hold=0,Math.hypot(t.x-t.x0,t.y-t.y0)>V||!this.view.editable)return this.stop();this.begin()}}move(t){let e=this.state;if(!(!e||t.pointerId!==e.pointer)){if(e.x=t.clientX,e.y=t.clientY,e.touch&&!this.view.editable)return e.active?this.cancel():this.stop();if(!e.active){let n=Math.hypot(e.x-e.x0,e.y-e.y0);if(e.touch){n>V&&this.stop();return}if(n<=Z)return;this.begin()}this.track()}}begin(){let t=this.state;if(!t||t.active)return;let e=this.view.state,n=g(e.doc),i=k(n,t.span);if(!i)return this.cancel();t.active=!0,this.view.dispatch(e.tr.setSelection(X(e.doc,i.lo,i.hi))),this.shell.classList.add("is-dragging");let o=this.shell.appendChild(document.createElement("div"));o.style.cssText="position:absolute;visibility:hidden;width:var(--blockeditor-indent)",this.indentPx=o.getBoundingClientRect().width||27,o.remove(),this.scroller=et(this.view.dom),window.addEventListener("keydown",this.onKey,!0),this.loop(),this.track()}track(){let t=this.state,e=this.view,n=e.state;if(!t)return;let i=g(n.doc),o=k(i,t.span);if(!o)return this.cancel();let{lo:r,hi:c}=o,d=nt(i,e),h=it(d,t.y),a=-1,l=null,p=null,E=h<0?d.length:h+1;for(let x=Math.max(0,E-2);x<E;x++){let v=d[x].dom.getBoundingClientRect();t.y>=v.top+v.height/4&&t.y<=v.bottom-v.height/4&&(p={i:d[x].i,bottom:v.bottom}),l=v.bottom+2}h>=0&&(a=d[h].i,l=d[h].dom.getBoundingClientRect().top-2);let f=r<0?null:p&&q(n,i,r,c,p.i),u=f?`summary:${p.i}`:a;(u!==t.gap||n.doc!==t.doc)&&(t.gap=u,t.doc=n.doc,t.targets=r<0?[]:f?[f]:U(n,i,r,c,a)),f&&(l=p.bottom+2);let m=e.dom.getBoundingClientRect().left;t.target=z(t.targets,(t.x-m)/this.indentPx);let T=this.shell.getBoundingClientRect();if(!t.target||l===null){this.line.hidden=!0,this.shell.dataset.drop="none";return}this.shell.dataset.drop="ok",this.line.hidden=!1,this.line.style.setProperty("--blockeditor-drop-y",`${l-T.top}px`),this.line.style.setProperty("--blockeditor-drop-x",`${m-T.left+t.target.depth*this.indentPx}px`),this.line.style.setProperty("--blockeditor-drop-w",`${e.dom.getBoundingClientRect().right-m-t.target.depth*this.indentPx}px`)}loop(){let t=()=>{let e=this.state;if(!e?.active)return;if(e.touch&&!this.view.editable)return this.cancel();let n=this.scroller,i=n===n.ownerDocument.scrollingElement?{top:0,bottom:window.innerHeight}:n.getBoundingClientRect(),o=0;e.y<i.top+b?o=-W*Math.min(1,(i.top+b-e.y)/b):e.y>i.bottom-b&&(o=W*Math.min(1,(e.y-(i.bottom-b))/b)),o&&(n.scrollTop+=o,this.track()),e.raf=requestAnimationFrame(t)};this.state.raf=requestAnimationFrame(t)}end(t){let e=this.state;if(!e||t.pointerId!==e.pointer)return;if(!e.active){if(this.stop(),t.type==="pointerup"){let l=g(this.view.state.doc),p=k(l,e.span);p&&this.onClick(p.lo)}return}if(this.track(),this.state!==e)return;let n=e.target,i=this.view.state,o=g(i.doc),r=k(o,e.span);if(this.stop(),!n||!r)return;let{lo:c,hi:d}=r;if(!n.open&&(n.at===o[c].at||n.at===o[d].end)&&n.parent===(o[c].node.attrs.parent??null)&&(o[c].node.type.name!=="list_item"||n.indent===o[c].node.attrs.indent))return;if(this.view.dispatch(H(P(i,o,c,d,n)).scrollIntoView()),this.view.state.doc===i.doc)return M(this.view,"Move cancelled");let a=d-c+1;M(this.view,`Moved ${a} ${a===1?"block":"blocks"}`),this.view.focus()}cancel(){this.stop(),M(this.view,"Move cancelled")}stop(){let t=this.state;t&&(this.state=null,clearTimeout(t.hold),cancelAnimationFrame(t.raf),this.grip.removeEventListener("pointermove",this.onMove),this.grip.removeEventListener("pointerup",this.onUp),this.grip.removeEventListener("pointercancel",this.onCancel),this.grip.removeEventListener("lostpointercapture",this.onCancel),this.grip.releasePointerCapture?.(t.pointer),window.removeEventListener("pointerdown",this.onOther,!0),window.removeEventListener("blur",this.onBlur),window.removeEventListener("scroll",this.onScroll,!0),window.removeEventListener("keydown",this.onKey,!0),this.shell.classList.remove("is-dragging"),delete this.shell.dataset.drop,this.line.hidden=!0)}destroy(){this.stop(),this.line.remove()}};export{g as a,et as b,G as c};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as k,B as P,C as g,D as T,E as y,F as A,G as E,H as z,I as x,J as O,K as tt,L as et,M as ot,N as B,O as D,R as it,S as K,c as M,d as L,e as f,n as J,s as $,w as v,x as Q,z as Z}from"./c-
|
|
1
|
+
import{A as k,B as P,C as g,D as T,E as y,F as A,G as E,H as z,I as x,J as O,K as tt,L as et,M as ot,N as B,O as D,R as it,S as K,c as M,d as L,e as f,n as J,s as $,w as v,x as Q,z as Z}from"./c-LUBZU4AZ.js";import"./c-GO635CRU.js";import"./c-V2V5FKXX.js";import"./c-T7LOTEWO.js";import"./c-A3OKSYRI.js";import"./c-7K4SCQB7.js";import"./c-WMRJKQ2V.js";import{C as Y,d as N}from"./c-3Y234AUB.js";import{N as G,d as V,z as X}from"./c-OH2FPYSY.js";import"./c-FSQXFG5T.js";import"./c-RETTCOWO.js";import"./c-JC4RZW4E.js";import"./c-57XDY6HC.js";import{a as j}from"./c-I2SCCUEW.js";import"./c-VHNSBD2M.js";var nt=`
|
|
2
2
|
.blockeditor-editor .blockeditor-table { position: relative; }
|
|
3
3
|
.blockeditor-table td { position: relative; }
|
|
4
4
|
.blockeditor-table th { position: relative; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=o=>!!o&&!o.bevel,f=(o,r,n)=>`color-mix(in srgb, ${o}, ${r} ${n}%)`,e=(o,r)=>r?[`${o}:${r}`]:[];function b({hover:o=!1,active:r=!1,focus:n=!1,disabled:c=!1}={}){let u=["base"];return!c&&o&&u.push("hover"),!c&&r&&u.push("active"),n&&u.push("focus"),c&&u.push("disabled"),u}function a(o,r){return o.background&&o.background!==o.surface?r>8?f(o.background,o.text||"currentColor",6):o.background:o.surface?f(o.surface,o.text||"currentColor",r):o.background}function p(o,r,n){let c=[],u={primary:["accent","accentText"],danger:["danger","dangerText"]}[r];if(n==="base"&&c.push(...e("font-family",o.font),...e("border-radius",o.radius)),n==="base"&&o.buttonHeight&&c.push("height:auto","block-size:auto",`min-height:${o.buttonHeight}`),u){let i=o[u[0]],s=o[u[1]];n==="base"&&c.push(...e("background",i),...e("border-color",i),...e("color",s)),n==="hover"&&i&&s&&c.push(`background:${f(i,s,12)}`),n==="active"&&i&&c.push(`border-color:${i}`,...s?[`background:${f(i,s,20)}`]:[]),n==="disabled"&&i&&c.push("opacity:.55")}else r==="quiet"?(n==="base"&&c.push(...e("color",o.text)),n==="hover"&&c.push(...e("background",a(o,7))),n==="active"&&c.push(...e("background",a(o,12))),n==="disabled"&&c.push(...e("color",o.mutedText))):(n==="base"&&c.push(...e("background",o.surface),...e("color",o.text),...e("border-color",o.border)),n==="hover"&&c.push(...e("background",a(o,7))),n==="active"&&c.push(...e("background",a(o,12)),...e("border-color",o.border)),n==="disabled"&&c.push(...e("color",o.mutedText)));return n==="focus"&&o.accent&&c.push(`outline:2px solid ${o.accent}`),c}var d={input:(o,r)=>r==="base"?[...e("font-family",o.font),...e("color",o.text),...e("background",o.surface),...e("border-color",o.border),...e("border-radius",o.radius)]:r==="hover"?e("border-color",o.mutedText):r==="focus"&&o.accent?[`outline:2px solid ${o.accent}`,`border-color:${o.accent}`]:[],surface:(o,r)=>r==="base"?[...e("background",o.surface),...e("color",o.text),...e("border-color",o.border),...e("box-shadow",o.shadow),...e("border-radius",o.radius),...e("font-family",o.font)]:[],text:(o,r)=>r==="base"?[...e("color",o.text),...e("font-family",o.font)]:[],mutedText:(o,r)=>r==="base"?[...e("color",o.mutedText),...e("font-family",o.font)]:[],heading:(o,r)=>r==="base"?[...e("font-family",o.headingFont||o.font),...e("color",o.text)]:[],code:(o,r)=>r==="base"?e("color",o.text):[],well:(o,r)=>r==="base"?[...e("background",o.background),...o.border?[`border:1px solid ${o.border}`]:[],...e("border-radius",o.radius)]:[],overlay:(o,r)=>r==="base"?e("background",o.overlay):[],close:(o,r)=>r==="base"?[...e("background",o.surface),...e("color",o.mutedText),...e("border-color",o.border)]:r==="hover"?e("background",a(o,7)):r==="focus"&&o.accent?[`outline:2px solid ${o.accent}`]:[]};function x(o,r,n="base"){return t(o)?r.startsWith("button.")?p(o.tokens,r.slice(7),n):d[r]?d[r](o.tokens,n):[]:[]}function $(o,r,n){return b(n).flatMap(c=>x(o,r,c))}function m(o,r,n){if(!t(o)||!r?.length)return[];let c=b(n),u=[];for(let i of r){let s=o.parts[i];if(s)for(let l of c)for(let[h,g]of Object.entries(s[l]||{}))u.push(`${h}:${g}`)}return u}function v(o,r,n){t(r)&&n?.length&&o.setAttribute("data-clay-part",n.join(" "))}function k(o,r,n){if(!n)return[];let c=[...o].reverse().find(s=>s.startsWith(`${r}:`)),u=c?c.slice(r.length+1).trim():"",i=[`${r}:${n}px`];return u&&u!==`${n}px`&&i.push(`${r}:max(${n}px, ${u})`),i}function y(o,r){return r?k(o,"min-height",44):[]}export{t as a,b,x as c,$ as d,m as e,v as f,k as g,y as h};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as $}from"./c-EHAR4RJJ.js";import"./c-LD6UVV5R.js";import"./c-PGSBXHUE.js";import"./c-KU3PX7LL.js";import"./c-EQ5NBOGA.js";import"./c-IJUK2GPW.js";import"./c-C7SUMNMI.js";import{c as k}from"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import{b as u}from"./c-CYWLPPUS.js";import"./c-U4TWEIKZ.js";import"./c-UW6MMZ4V.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 O="Some saved data was removed",W={recent:"A change from outside this page removed something you typed","all-typed":"A change from outside this page removed everything you typed",emptied:"A change from outside this page emptied this page's data",unreadable:"A change from outside this page left its data unreadable"},B=3,V=36e5,T="data-guard-done",K=6e3,Y=1500,G=5e3,H=3e4,J=1e4,q=6e3,X=["clay:save-error","clay:save-offline","clay:save-conflict"],I="Could not reach the server. Try again.",z="That did not go through. Try again.",Q="Save your changes first, then try again.",Z="Reload the page, then try again.",n=null,d=null,m=(e,t)=>`${e} ${t}${e===1?"":"s"}`,D=e=>!!e&&typeof e.id=="string"&&e.status==="pending",E=(e,t,i,s)=>s===!0&&!e.refused.has(`${t.id}:${i}`),A=(e,t)=>E(e,t,"restore",t.restorable),f=(e,t)=>E(e,t,"revert",t.canRevert),L=(e,t)=>E(e,t,"put-back",t.canPutBack),p=e=>Array.isArray(e.typed)?e.typed:[],C=e=>!!e.reason,ee=e=>W[e.reason]??O,P=e=>e.reason==="recent"||e.reason==="all-typed",te=e=>P(e)?"info":"warning",M=()=>k()?"omit":"same-origin",N=e=>$()||e.lastExternal>0&&Date.now()-e.lastExternal<J,U=(e={})=>({"Document-URL":location.href,...e});function b(){for(let e of document.querySelectorAll("[data-htmlclay-guard]"))e.remove()}function l(e,t){import("./c-C6DXZIXD.js").then(i=>{d=i,i.default(e,t)},()=>{})}function y(e){let t=e.lossSummary||{},i=t.provenance==="external"?"A change from outside this page":"A save from this page",s=t.removedItems>0?`removed ${m(t.removedItems,"item")}`:t.destroyedAtoms>0?`erased ${m(t.destroyedAtoms,"value")}`:"changed saved data",a=Array.isArray(e.preview)?e.preview[0]:null,o=[`${i} ${s}.`];return a&&o.push(`${a.key}: ${a.yours} before, ${a.now} now.`),o}function ie(e){let t=String(e??"").split(".").filter(s=>s&&!/^\[[^\]]*\]$/.test(s));return(t[t.length-1]??"").replace(/\[[^\]]*\]/g,"").trim().replace(/[_-]+/g," ")||"value"}function ae(e){let t=p(e);if(!t.length)return"";let i=t.slice(0,B).map(a=>`${ie(a.path)}: "${a.yours}"`),s=t.length-i.length;return`${i.join("; ")}${s>0?` and ${s} more.`:"."}`}function se(e){if(e.reason==="all-typed")return"";let t=p(e)[0],i=typeof t?.at=="number"?t.at:Date.parse(t?.at);if(!Number.isFinite(i))return"";let s=Date.now()-i;if(s<0||s>=V)return"";let a=Math.max(1,Math.floor(s/6e4));return`You typed ${p(e).length===1?"it":"them"} ${m(a,"minute")} ago.`}function oe(e,t){if(!C(t)){let s=y(t);return A(e,t)?t.droppedAdditions>0&&s.push(`Restoring removes ${m(t.droppedAdditions,"item")} added or changed since.`):f(e,t)?s.push("This data no longer fits the page, but the whole change can be undone."):s.push("It cannot be restored from here."),f(e,t)&&s.push("Undo the change also removes edits made since."),s.join(" ")}let i=[];if(P(t)){i.push(ae(t)||y(t).join(" "));let s=se(t);s&&i.push(s)}else i.push(y(t).join(" "));return f(e,t)&&i.push("Undo the change also removes edits made since."),i.join(" ")}function ne(e,t){let i=[];return C(t)?(L(e,t)&&i.push({label:"Put it back",onClick:()=>r(e,t,"put-back")}),f(e,t)&&i.push({label:"Undo the change",onClick:()=>r(e,t,"revert")}),i.push({label:"Keep the change",onClick:()=>r(e,t,"dismiss")}),i):(A(e,t)&&i.push({label:"Restore",onClick:()=>r(e,t,"restore")}),f(e,t)&&i.push({label:"Undo the change",onClick:()=>r(e,t,"revert")}),i.push({label:"Keep as is",onClick:()=>r(e,t,"dismiss")}),i)}async function v(e,t){let i=ee(t),s=oe(e,t),a=[t.id,i,t.reason??"",JSON.stringify(p(t)),A(e,t),L(e,t),f(e,t),t.lastWriteAt,s].join("|");if(e.drawn===a)return!0;e.drawn=a,e.eventId=t.id;try{d??=await import("./c-C6DXZIXD.js")}catch{return e.drawn===a&&(e.drawn=null,e.eventId=null),!1}if(n!==e||e.drawn!==a)return!1;let o=e.title;return e.title=i,o&&o!==i&&d.dismissPersistent(o,{now:!0}),d.dismissPersistent(i,{now:!0}),d.toastPersistent(i,te(t),{detail:s,actions:ne(e,t)}),!0}function g(e){let t=e.title;e.drawn=null,e.eventId=null,e.title=null,t&&d?.dismissPersistent(t,{now:!0})}async function h(e){let t=++e.turn;e.lastRead=Date.now();let i=new AbortController,s=setTimeout(()=>i.abort(),K),a;try{let o=await fetch(e.url,{method:"GET",credentials:M(),headers:U(),cache:"no-store",redirect:"manual",signal:i.signal});if(!o.ok)return;a=await o.json()}catch{return}finally{clearTimeout(s)}if(!(n!==e||t!==e.turn)&&!(!a||typeof a!="object"||!("event"in a))){if(D(a.event)){if(e.resolved.has(a.event.id)||e.waiting===a.event.id)return;if(!e.waited.has(a.event.id)&&N(e)){x(e,a.event.id);return}await v(e,a.event)&&b();return}g(e),b()}}function F(e,t){e.resolved.add(t.id),e.eventId===t.id&&g(e)}function le(e,t,i){if(F(e,t),i==="dismiss"){l("Kept the page as it is.","info");return}u.session.set(T,i),e.reload()}function re(e,t,i,s,a){n===e&&(s===200&&a?.ok===!0?le(e,t,i):s===404?(F(e,t),l("This was already taken care of somewhere else. Reload to see the current page.","info")):s===409?(e.drawn=null,l("This page changed after the notice appeared. Check the notice and try again.","warning"),h(e)):s===422?(e.refused.add(`${t.id}:${i}`),e.eventId===t.id&&!e.resolved.has(t.id)&&v(e,t),l(i==="restore"||i==="put-back"?"That data no longer fits this page, so it could not be restored.":"That earlier version is no longer available.","warning")):l(s===401||s===403?Z:s===400?z:I,"error"))}async function de(){let e=window.clay;if(!e?.hasUnsavedChanges?.())return!0;if(typeof e.save?.flush!="function")return!1;try{await e.save.flush()}catch{return!1}return!e.hasUnsavedChanges()}async function r(e,t,i){if(!(e.busy||n!==e)){e.busy=!0;try{if(i!=="dismiss"&&!await de()){n===e&&l(Q,"warning");return}if(n!==e)return;let s=await fetch(e.url,{method:"POST",credentials:M(),headers:U({"Content-Type":"application/json"}),redirect:"manual",body:JSON.stringify({id:t.id,choice:i})}),a=await s.json().catch(()=>null);re(e,t,i,s.status,a)}catch{n===e&&l(I,"error")}finally{e.busy=!1}}}function fe(e,t){let{msgType:i,action:s,data:a}=t.detail||{};if(i==="data-loss"){if(s==="resolved"){if(typeof a?.id!="string")return;e.turn++,e.resolved.add(a.id),e.waiting===a.id&&j(e),e.eventId===a.id&&g(e);return}if(s==="raised"&&D(a)&&!e.resolved.has(a.id)){if(e.turn++,e.waiting===a.id)return;if(!e.waited.has(a.id)&&N(e)){x(e,a.id);return}v(e,a).then(o=>{o&&b()},()=>{})}}}var _=e=>Math.max(e.lastSave+Y,e.lastRead+G);function j(e){return e.waiting?(e.waiting=null,clearTimeout(e.waitTimer),e.waitTimer=null,!0):!1}function S(e,{now:t=!1}={}){!j(e)||n!==e||(t?h(e):R(e))}function x(e,t){e.waited.add(t),e.waiting=t,clearTimeout(e.waitTimer),e.waitTimer=setTimeout(()=>S(e,{now:!0}),q)}function R(e){e.timer||(e.timer=setTimeout(()=>{e.timer=null,n===e&&(_(e)>Date.now()?R(e):h(e))},Math.max(_(e)-Date.now(),0)))}function me({href:e,reload:t=()=>window.location.reload()}){if(n)return;let i;try{i=new URL(e,location.href)}catch{return}if(i.origin!==location.origin)return;let s=new AbortController,a={url:i.href,reload:t,listeners:s,turn:0,lastRead:0,lastSave:0,timer:null,lastExternal:0,waiting:null,waitTimer:null,waited:new Set,busy:!1,drawn:null,eventId:null,title:null,resolved:new Set,refused:new Set};n=a;let{signal:o}=s;document.addEventListener("clay:notification",c=>fe(a,c),{signal:o}),document.addEventListener("clay:sync-applied",c=>{c.detail?.source==="disk"&&(a.lastExternal=Date.now())},{signal:o}),document.addEventListener("clay:save-saved",()=>{a.lastSave=Date.now(),a.waiting?S(a):R(a)},{signal:o});for(let c of X)document.addEventListener(c,()=>S(a,{now:!0}),{signal:o});document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&Date.now()-a.lastRead>=H&&h(a)},{signal:o});let w=u.session.get(T);w&&(u.session.remove(T),l(w==="restore"||w==="put-back"?"Your saved data is back.":"The earlier version is back.","success")),h(a)}function pe(){let e=n;e&&(n=null,e.listeners.abort(),clearTimeout(e.timer),clearTimeout(e.waitTimer),g(e))}export{me as start,pe as stop};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as h}from"./c-
|
|
1
|
+
import{C as h}from"./c-3Y234AUB.js";import"./c-OH2FPYSY.js";import"./c-RETTCOWO.js";import"./c-VHNSBD2M.js";var u=(t,s)=>{let l=-1;return t.forEach((n,a,c)=>{n.attrs.id===s&&(l=c)}),l};function k(t,s,l){let n=t.state,a=u(n.doc,s);if(a<0)return!1;let c=0;for(let e=0;e<a;e++)c+=n.doc.child(e).nodeSize;let r=n.doc.child(a);return t.dispatch(h(n.tr.setNodeMarkup(c,null,{...r.attrs,...l}))),!0}function E(t,s){let l=u(t.state.doc,s);if(l<0)return!1;let n=t.dom.parentElement,a=n.ownerDocument,c=0;for(let o=0;o<l;o++)c+=t.state.doc.child(o).nodeSize;let r=a.createElement("div");r.className="blockeditor-link",r.dataset.mode="alt";let e=a.createElement("input");e.className="blockeditor-link-input",e.type="text",e.value=t.state.doc.child(l).attrs.alt||"",e.placeholder="Describe the image",e.setAttribute("aria-label","Alt text"),r.append(e);let d=t.nodeDOM(c)?.getBoundingClientRect?.(),p=n.getBoundingClientRect();d&&(r.style.setProperty("--blockeditor-pop-x",`${d.left-p.left}px`),r.style.setProperty("--blockeditor-pop-y",`${d.bottom-p.top+6}px`)),n.append(r);let f=!1,i=(o,b=!0)=>{if(f)return;f=!0;let m=e.value.trim();r.remove();let x=u(t.state.doc,s);o&&x>=0&&m!==t.state.doc.child(x).attrs.alt&&k(t,s,{alt:m}),b&&t.focus()};return e.addEventListener("keydown",o=>{o.key==="Enter"?(o.preventDefault(),i(!0)):o.key==="Escape"&&(o.preventDefault(),o.stopPropagation(),i(!1))}),e.addEventListener("blur",()=>i(!0,!1)),e.focus(),!0}export{E as openAltEditor,k as setImageAttrs};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{d as De,h as Je,i as et}from"./c-TRS6TM6O.js";import{a as Ue,b as We}from"./c-Y3J5LDKB.js";import{a as He,b as Ke}from"./c-PZ4XEPUP.js";import"./c-SFKI6OLM.js";import"./c-Q3XOWZEV.js";import"./c-RHMPKZZ7.js";import{d as Ze}from"./c-QHWJ5ZIJ.js";import{a as Se,b as je,c as V,d as Qe,h as pe,i as Le,j as u}from"./c-J2ZW4HMR.js";import{a as te,e as ce,f as de}from"./c-A5LASUEZ.js";import"./c-4JZDZFF6.js";import{b as W,c as ee,e as l,f as qe}from"./c-5RZNFTWD.js";import{b as Ge}from"./c-PKCCHJ5X.js";import"./c-46XYM55L.js";import{a as se,b as T,c as Ve}from"./c-NUHP2XDB.js";import{a as Xe,r as q}from"./c-FC5RUFPR.js";import"./c-4ASQPRQL.js";import"./c-GQ6F6IDK.js";import"./c-I2SCCUEW.js";import"./c-5VYOWDTI.js";import{f as Re}from"./c-P73XPAOA.js";import"./c-ZPI7M5U5.js";import"./c-WYFDLITL.js";import"./c-UGHH4MB3.js";import"./c-MZCOGNZL.js";import"./c-EHAR4RJJ.js";import"./c-LD6UVV5R.js";import"./c-PGSBXHUE.js";import"./c-KU3PX7LL.js";import"./c-EQ5NBOGA.js";import"./c-IJUK2GPW.js";import{f as Ye}from"./c-C7SUMNMI.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-U4TWEIKZ.js";import"./c-UW6MMZ4V.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 I="light-dark(#D08A1E, #E3A33F)",ht=5e3,gt=4e3,mt=500,wt={"another-tab":"in another tab","another-person":"by someone else","an-agent":"by an agent"},yt='<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>',H=(e,t)=>`${e} ${t}${e===1?"":"s"}`,xt="This spot changed again. Review the latest edit or download your copy.",vt="A data value can't be put back from here. Download your copy to keep yours.",w="hidden",Y=!1,L=[],ne=new Set,B=new Set,m=null,Me=0,O=null,b=null,fe=null,h=null,R=!1,K=!1,Ce=!1,Q=new Map,he=0,ue=!1,ie=!1,k=null,X=null,D=null,Be=0,z=!1,ge=0,me=null,re=null,$=[],v=[],ae=!1,we=null,ye=null,c=null,a=null,P=null,G=new Map,M=()=>window.clay?.conflicts||null,ot=()=>$.reduce((e,t)=>e+t.conflicts.length,0)+v.length,_e=()=>{let e=window.clay?.undo;return e&&typeof e.kept=="function"?e:null},xe=()=>M()?.list().filter(e=>!e.claimedBy&&e.kind!=="apply-incomplete")??[],Ie=()=>M()?.list().filter(e=>!e.claimedBy&&e.kind==="apply-incomplete")??[];function Oe(){return O?"upgraded":m?"refused":xe().length?"replaced":Ie().length?"failed":$.length||v.length?"recovered":null}function g(e,t,n){let o=Ve(e,t,n);return t[0]==="all:initial"&&T(o,"color-scheme","inherit"),o.setAttribute("clay",Se),o}function _(e,t){return G.set(t,e),e}function j(e,t){return te(a)&&(de(e,a,t),se(e,ce(a,t,{}))),e}function le(){if(!c)return;let e=window.visualViewport,t=e?Math.max(0,window.innerHeight-e.height-e.offsetTop):0;T(c,"bottom",`calc(${16+t}px + env(safe-area-inset-bottom,0px))`),re&&T(re,"max-height",`${Math.max(160,(e?.height||window.innerHeight)-32)}px`)}function bt(){c=g("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 ${W}`,`color:${l.ink}`,"text-align:left"]),c.setAttribute("data-clay-conflict",""),document.body.appendChild(c),window.visualViewport?.addEventListener("resize",le),window.visualViewport?.addEventListener("scroll",le)}function d(){if(ue)return;ue=!0;let e=()=>{ue=!1,y()};typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,16)}function y(){a=Ze(),ie&&(ie=!1,m&&!q()&&(m=null));let e=Oe();if(e?w==="hidden"&&(w="bar"):(w="hidden",Y=!1,ne.clear(),B.clear(),L=[],x(),me=null,z=!1),!c){if(w==="hidden"&&!k||!document.body)return;bt()}!c.isConnected&&document.body&&document.body.appendChild(c);let t=document.activeElement,n=null;for(let[s,r]of G)r===t&&(n=s);let o=P?P.scrollTop:0;G=new Map,P=null,re=null,c.replaceChildren(),k?c.append(Tt(k)):w==="bar"?c.append(At(e)):w==="panel"&&c.append(Ct(e)),T(c,"display",k||w!=="hidden"?"flex":"none"),P&&(P.scrollTop=o);let i=D||n;i&&G.has(i)&&G.get(i).focus({preventScroll:!0}),k||(D=null),le(),te(a)?(de(c,a,["conflict.root"]),se(c,ce(a,["conflict.root"],{})),T(c,"color-scheme",a.scheme==="light dark"?"light":a.scheme)):(c.removeAttribute("data-clay-part"),Ge(c))}function it(){return j(g("span",["all:initial","display:inline-block","flex:none","width:8px","height:8px","border-radius:50%",`background:${I}`]),["conflict.dot"])}function rt(){return wt[m?.changedBy]||null}function kt(e,t){if(e==="upgraded")return O;if(e==="refused"){let n=rt();return!n&&m.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"?`${H(t,"change")} replaced before this page loaded ${t===1?"is":"are"} still here.`:`Another edit replaced ${H(t,"change")}.`}function $t(e,t){return e==="upgraded"?O:e==="refused"?`This page changed ${rt()||"elsewhere"}`:e==="failed"?"A sync update did not finish":e==="recovered"?`${H(t,"change")} kept from before this page loaded`:`Another edit replaced ${H(t,"change")}`}function Tt(e){let t=pe("div",["display:block",`background:${l["teal-soft"]}`,"padding:10px 14px","width:max-content","max-width:calc(100vw - 24px)"],{theme:a,parts:["conflict.panel"]});return te(a)&&se(t,[`background:${l["teal-soft"]}`]),t.setAttribute("role","status"),t.textContent=e,t}function At(e){let t=e==="failed"?Ie().length:e==="recovered"?ot():xe().length,n=pe("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)"],{theme:a,parts:["conflict.panel"]}),o=kt(e,t);return o!==me&&(n.setAttribute("role",e==="refused"?"alert":"status"),me=o),n.append(it(),u("span",[],o,{theme:a,parts:["conflict.text"]})),e==="upgraded"?(n.append(_(V("Reload",{variant:"primary",onClick:()=>window.location.reload(),theme:a,parts:["conflict.button"],labelParts:["conflict.buttonLabel"]}),"reload")),n):(n.append(_(V("Review",{onClick:Ot,theme:a,parts:["conflict.button"],labelParts:["conflict.buttonLabel"]}),"review")),n)}function A(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 _(V(e,{variant:n,onClick:o,extra:r,theme:a,parts:["conflict.button"],labelParts:["conflict.buttonLabel"]}),t)}function E(e){return u("div",["display:block","padding:0 16px 12px",`color:${l["ink-2"]}`,"font-size:13.5px"],e,{theme:a,parts:["conflict.text"]})}function Ct(e){let t=e==="replaced"?xe():e==="failed"?Ie():[],n=e==="refused"?xe():t,o=e==="recovered"?ot():t.length;if(ne.size)for(let p of t)ne.has(p.id)||B.add(p.id);for(let p of[...B])t.some(F=>F.id===p)||B.delete(p);let i=$t(e,o),s=Math.max(160,(window.visualViewport?.height||window.innerHeight)-32),r=pe("div",["display:flex","flex-direction:column","width:520px","max-width:calc(100vw - 24px)",`max-height:${s}px`],{theme:a,parts:["conflict.panel"]});re=r,r.setAttribute("role","dialog"),r.setAttribute("aria-label",i);let f=j(g("div",["all:initial","display:flex","align-items:center","gap:8px","padding:12px 12px 8px 16px",`font:14px/1.5 ${W}`,`color:${l.ink}`]),["conflict.header"]),C=_(u("b",["font-weight:600","font-size:14.5px","outline:none"],i,{theme:a,parts:["conflict.title"]}),"title");C.setAttribute("tabindex","-1"),f.append(it(),C),e==="replaced"&&B.size&&f.append(u("span",[`font:600 10.5px/1 ${ee}`,"letter-spacing:.12em","text-transform:uppercase","padding:3px 6px",`color:color-mix(in srgb, ${l.brass} 80%, ${l.ink})`,`background:${l["brass-soft"]}`],`${B.size} new`));let J=g("span",["all:initial","display:inline-flex","margin-left:auto"]),Fe=_(Qe(yt,{label:"Minimize",onClick:at,theme:a,parts:["close","conflict.close"]}),"minimize");if(Fe.title="Minimize to the bar. Nothing is accepted until you choose.",J.append(Fe),f.append(J),r.append(f),e==="recovered")return Bt(r),r;if(e==="refused"){if(r.append(E("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(E(`${H(n.length,"earlier replaced edit")} ${n.length===1?"is":"are"} also held in this tab. Download my copy includes them.`)),R&&r.append(E("That did not save either. Your edits here are still here.")),z&&r.append(E("Something changed on the page after your first press, so nothing was dropped. Press Accept theirs again if you still want their version.")),b){let p=j(g("div",["all:initial","display:block","margin:0 16px 12px","padding:8px 10px",`background:color-mix(in srgb, ${I} 14%, transparent)`,`color:${l.ink}`,`font:13px/1.5 ${W}`]),["conflict.warning"]);p.append(g("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(p)}}else e==="upgraded"?r.append(E("Its layout and code changed with it, so this page stops here. Reload to see the new version.")):e==="failed"?r.append(E("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(E("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 N=j(g("div",["all:initial","display:flex","flex-wrap:wrap","gap:8px","padding:0 16px 14px"]),["conflict.actions"]);if(e==="upgraded")return N.append(A("Reload","reload",{variant:"primary",onClick:()=>window.location.reload(),push:!0})),r.append(N),L=[],r;let ft=A(Ce?"Try again":K?"Downloaded":"Download my copy","download",{onClick:Yt});if(N.append(ft),e==="refused"){let p=A(h==="overwrite"?"Saving\u2026":R?"Try again":"Keep mine","keep",{onClick:Vt});p.setDisabled(h==="overwrite"),N.append(p,A(b?"Yes, drop my edits":"Accept theirs","accept",{variant:"primary",onClick:qt,push:!0}))}else{if(e==="replaced"){let p=M().hasPendingApply(),F=A(p?"Finishing the incoming edit\u2026":h==="revert"?"Putting back\u2026":"Revert to mine","revert",{onClick:Ft});F.setDisabled(p||h==="revert"),N.append(F)}N.append(A("Accept theirs","accept",{variant:"primary",onClick:Nt,push:!0}))}if(r.append(N),e==="replaced")if(Y)r.append(Et(t));else{let p=g("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 ${W}`]),F=g("span",["all:initial","display:inline-flex","margin-left:auto"]);F.append(_(V("See the edits",{small:!0,onClick:lt,theme:a,parts:["conflict.button"],labelParts:["conflict.buttonLabel"]}),"list")),p.append(g("span",["all:initial","font:inherit","color:inherit"],H(t.length,"edit")),F),r.append(p)}L=n.map(p=>p.id);for(let p of t)ne.add(p.id);return r}function Et(e){let t=Le(["flex:1 1 auto","margin:0 16px 12px","min-height:0","overflow:auto",`background:${l.sunk}`,`border:1px solid ${l["line-2"]}`],{theme:a,parts:["conflict.well","conflict.list"]}),n=g("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 ${ee}`,"letter-spacing:.12em","text-transform:uppercase"]),o=g("span",["all:initial","display:inline-flex","margin-left:auto"]);return o.append(_(V("Hide",{small:!0,variant:"quiet",onClick:lt,theme:a,parts:["conflict.button"],labelParts:["conflict.buttonLabel"]}),"list")),n.append(g("span",["all:initial","font:inherit","color:inherit","letter-spacing:inherit","text-transform:inherit"],"Replaced edits"),o),t.append(n),e.forEach((i,s)=>t.append(Pt(i,s))),P=t,t}function Ne(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 St={"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"},Lt=e=>St[e]||"the page changed there";function Rt(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(s=>typeof s?.html=="string"&&s.html):null;if(i)return{text:He(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 Dt(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 zt(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",f=((Array.isArray(t.context)?t.context:[]).find(J=>typeof J?.label=="string"&&J.label)??null)?.label||typeof t.label=="string"&&t.label||"Edit",C=Rt(t.steps,i);return{...o,name:f,sentence:`The ${i} of "${f}" was not applied because ${Lt(t.code)}.`,yours:C.text,now:C.id==null?"":Dt(C.id)}}function Mt(e){let t=_e();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 tt=e=>({before:"",hit:e,after:"",cutBefore:!1,cutAfter:!1});function nt(e){let t=u("div",["display:block","padding:8px 12px 10px"],void 0,{theme:a,parts:["conflict.row"],role:null}),n=u("div",["display:flex","align-items:center","gap:8px","font-size:12.5px","font-weight:600",`color:${l["ink-2"]}`,"margin-bottom:4px"],void 0,{theme:a,parts:["conflict.location"],role:null});if(n.append(u("span",[],Ne(e))),t.append(n),e.sentence&&t.append(u("div",["display:block","font-size:13px",`color:${l["ink-2"]}`],e.sentence)),e.yours){let i=u("div",["display:grid","grid-template-columns:44px 1fr","gap:3px 10px","align-items:start",`font:12.5px/1.5 ${ee}`,...e.sentence?["margin-top:4px"]:[]]);i.append(...ve("Yours",tt(e.yours),{mine:!0})),e.now&&i.append(...ve("Now",tt(e.now),{mine:!1})),t.append(i)}let o=g("div",["all:initial","display:flex","flex-wrap:wrap","gap:8px","margin-top:8px"]);return Mt(e).forEach((i,s)=>{let r=A(i.label,`run:${e.id}:${s}`,{onClick:()=>Wt(e,i,r)});o.append(r)}),o.append(A(we===e.id?"Copied":"Copy",`copy:${e.id}`,{onClick:()=>Kt(e)})),o.append(A("Dismiss",`dismiss:${e.id}`,{onClick:()=>st(e)})),t.append(o),t}function Bt(e){e.append(E($.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.")),ae&&e.append(E("That action did not run. The copy is still here."));let t=Le(["flex:1 1 auto","margin:0 16px 12px","min-height:0","overflow:auto",`background:${l.sunk}`,`border:1px solid ${l["line-2"]}`],{theme:a,parts:["conflict.well","conflict.list"]});for(let o of $)for(let i of o.conflicts)t.append(nt(i));for(let o of v)t.append(nt(o));P=t,e.append(t);let n=j(g("div",["all:initial","display:flex","flex-wrap:wrap","gap:8px","padding:0 16px 14px"]),["conflict.actions"]);($.some(o=>o.root)||v.length)&&n.append(A(K?"Downloaded":"Download my copy","download",{onClick:Ut})),e.append(n),L=[]}function ve(e,t,{mine:n}){let o=[u("span",[`color:${l.faint}`,`font-family:${W}`],e,{theme:a,parts:["conflict.valueLabel"],role:null})],i=u("span",["display:-webkit-box","-webkit-line-clamp:2","-webkit-box-orient:vertical","overflow:hidden","overflow-wrap:anywhere",...n?[`color:${l.ink}`]:[`color:${l.muted}`]],void 0,{theme:a,parts:[n?"conflict.mine":"conflict.theirs","conflict.value"],role:null}),s=(t.cutBefore?"\u2026":"")+t.before+t.hit+t.after+(t.cutAfter?"\u2026":"");i.title=s,t.before&&i.append(u("span",[`color:${l.faint}`],(t.cutBefore?"\u2026":"")+t.before,{theme:a,parts:["conflict.before"],role:null}));let r=u("span",n?[`background:color-mix(in srgb, ${I} 18%, transparent)`,"padding:0 4px"]:t.before||t.after?["text-decoration:underline",`text-decoration-color:color-mix(in srgb, ${I} 70%, transparent)`,"text-underline-offset:3px"]:[],t.hit||"(empty)",{theme:a,parts:["conflict.value"],role:null});return i.append(r),t.after&&i.append(u("span",[`color:${l.faint}`],t.after+(t.cutAfter?"\u2026":""),{theme:a,parts:["conflict.after"],role:null})),o.push(i),o}function Pt(e,t){let n=Ke(e),o=u("div",["display:block","padding:8px 12px 10px",...t?[`border-top:1px solid ${l.line}`]:[]],void 0,{theme:a,parts:["conflict.row"],role:null}),i=u("div",["display:flex","align-items:center","gap:4px","font-size:12.5px","font-weight:600",`color:${l["ink-2"]}`,"margin-bottom:4px"],void 0,{theme:a,parts:["conflict.location"],role:null});if(i.append(u("span",[],n.name)),n.target&&n.target.isConnected&&i.append(_(_t(n),`eye:${e.id}`)),o.append(i),n.sentence&&o.append(u("div",["display:block","font-size:13px",`color:${l["ink-2"]}`],n.sentence)),Q.has(e.id)&&o.append(u("div",["display:block","font-size:13px","margin-top:4px",`color:${I}`],Q.get(e.id))),n.yours){let s=u("div",["display:grid","grid-template-columns:44px 1fr","gap:3px 10px","align-items:start",`font:12.5px/1.5 ${ee}`,...n.sentence?["margin-top:4px"]:[]]);s.append(...ve("Yours",n.yours,{mine:!0})),n.now&&s.append(...ve("Now",n.now,{mine:!1})),o.append(s)}return o}function _t(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=g("button",t);n.type="button",n.innerHTML=qe.conflictEye,je(n.firstElementChild,16),n.setAttribute("aria-label",`Show ${e.name} on page`),n.title="Show on page";let o=["button","conflict.button"];de(n,a,o);let i=s=>{n.style.cssText="";let r=te(a)?[...t,...ce(a,o,{}),...s]:[...t,...s];for(let f of r){let C=f.indexOf(":");n.style.setProperty(f.slice(0,C),f.slice(C+1),"important")}};return n.addEventListener("pointerenter",()=>i([`background:color-mix(in srgb, ${I} 16%, transparent)`])),n.addEventListener("pointerleave",()=>i([])),n.addEventListener("focus",()=>i([`outline:2px solid ${l.brass}`,"outline-offset:1px"])),n.addEventListener("blur",()=>i([])),n.addEventListener("click",()=>It(e.target)),n}var S=null,be=null,ke=null;function $e(){clearTimeout(be),window.removeEventListener("scroll",oe,!0),window.removeEventListener("resize",oe),S?.remove(),S=null,ke=null}function oe(){if(!S||!ke)return;let e=ke.getBoundingClientRect();T(S,"left",`${e.left}px`),T(S,"top",`${e.top}px`),T(S,"width",`${e.width}px`),T(S,"height",`${e.height}px`)}function It(e){if($e(),!e||!e.isConnected)return;let n=!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches?"instant":"smooth",o=c?.getBoundingClientRect().top??0,i=c&&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 s=e.getBoundingClientRect(),r=window.innerHeight-i,f=s.height>r-24?s.top-12:s.top+s.height/2-r/2;window.scrollBy?.({top:f,behavior:n})}ke=e,S=j(g("div",["all:initial","color-scheme:inherit","position:fixed","pointer-events:none","z-index:2147483001",`outline:2px solid ${I}`,"outline-offset:3px",`background:color-mix(in srgb, ${I} 14%, transparent)`]),["conflict.previewRing"]),document.body.appendChild(S),oe(),window.addEventListener("scroll",oe,!0),window.addEventListener("resize",oe),be=setTimeout($e,2500)}function Ot(){O||(w="panel",D="title",y())}function at(){$e(),w="bar",x(),D="review",y()}function lt(){Y=!Y,Y&&B.clear(),y()}function Nt(){let e=M(),t=L.filter(n=>{let o=e?.get(n);return o&&!o.claimedBy});e&&t.length&&e.acknowledge(t,{reason:"accepted"}),w=Oe()?"bar":"hidden",D="review",d()}async function Ft(){let e=M();if(h||!e||e.hasPendingApply())return;let t=L.filter(r=>{let f=e.get(r);return f&&!f.claimedBy});if(!t.length)return;h="revert",y();let n=!0,o=r=>{n=!!c?.contains(r.target)};document.addEventListener("focus",o,!0);let i;try{let{revertConflicts:r}=await import("./c-QL4NYM2L.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)}h=null;for(let r of i.blockedIds)Q.set(r,M()?.get(r)?.kind==="json"?vt:xt);w=Oe()?"bar":"hidden",D=n?"review":null;let s=i.saveResult&&(i.saveResult.ok||i.saveResult.msg==="Save already in progress");i.revertedIds.length&&s?Ee(`Put back ${H(i.revertedIds.length,"change")}. Saving.`):y()}var Z=null;async function Yt(){let e=M(),t=m?e?.list()??[]:L.map(o=>e?.get(o)).filter(Boolean),n=await We(t,{refused:!!m});Ce=!n,K=n,clearTimeout(Z),n&&(Z=setTimeout(()=>{K=!1,d()},1200)),y()}async function U(){let e=null;if(De())try{e=await Je()}catch{e=null}let t=_e(),n=null;if(t)try{n=await t.kept()}catch{n=null}let o=!1;if(e?.ok?($=e.records,o=!0):!De()&&$.length&&($=[],o=!0),n?.ok){let i=(Array.isArray(n.records)?n.records:[]).filter(r=>r&&r.supported!==!1).map(zt);i.length===v.length&&i.every((r,f)=>r.id===v[f].id&&r.revision===v[f].revision)||(o=!0),v=i}else n&&v.length&&(v=[],o=!0);o&&d()}async function Ht(e){try{return await navigator.clipboard.writeText(e),!0}catch{}let t=document.createElement("textarea");t.value=e,t.setAttribute("clay",Se),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 Kt(e){let t=e.record?e.yours:`${Ne(e)}
|
|
2
|
+
|
|
3
|
+
Yours:
|
|
4
|
+
${e.yours}
|
|
5
|
+
|
|
6
|
+
Now:
|
|
7
|
+
${e.now}`;if(!await Ht(t)){Ee("Could not copy. Select the text instead.");return}we=e.id,clearTimeout(ye),ye=setTimeout(()=>{we=null,d()},1200),y()}async function Ut(){let e=$.find(o=>o.root),t=[];for(let o of $)for(let i of o.conflicts)t.push({id:i.id,kind:i.kind,name:Ne(i),yours:i.yours,now:i.now,sentence:i.sentence});for(let o of v)t.push({id:o.id,kind:o.kind,name:o.name,yours:o.yours,now:o.now,sentence:o.sentence});let n=await Ue({html:e?.root??null,edits:t});Ce=!n,K=n,clearTimeout(Z),n&&(Z=setTimeout(()=>{K=!1,d()},1200)),y()}async function st(e){let t;try{t=e.record?await _e()?.dismissKept(e.id,{revision:e.revision}):await et([e.id]),t||={ok:!1}}catch{t={ok:!1}}t.ok||Ee("That copy could not be dismissed."),await U(),d()}var ze=new Set;async function Wt(e,t,n=null){if(!ze.has(t)){ze.add(t),n&&(n.disabled=!0,n.setAttribute("aria-busy","true")),ae=!1;try{let o=null;try{o=await t.run(e.record)}catch{o=null}if(o?.ok===!0&&o?.dismiss===!0){await st(e);return}ae=o?.ok!==!0,await U(),d()}finally{ze.delete(t),n&&n.isConnected&&(n.disabled=!1,n.removeAttribute("aria-busy"))}}}function ct(e){e?.detail?.ok===!0&&(ae=!1,U(),d())}function x(){clearTimeout(fe),fe=null,b=null}async function Vt(){if(h)return;let e=++ge;h="overwrite",R=!1,x(),y();let t;try{t=await window.clay?.save?.overwrite?.()}catch{t={ok:!1}}e!==ge||h!=="overwrite"||(!t?.ok&&q()&&(h=null,R=!0),d())}function qt(){if(!b){b={refusalGeneration:Me,ledgerRevision:he,dirtyGeneration:Re().gen},Be=Date.now(),z=!1,clearTimeout(fe),fe=setTimeout(()=>{x(),d()},ht),y();return}if(Date.now()-Be<mt)return;let e=b;Xe({isCurrent:()=>b===e&&e.refusalGeneration===Me&&e.ledgerRevision===he&&e.dirtyGeneration===Re().gen,reload:()=>window.location.reload()})||(x(),z=!0,y())}function Ee(e){k=e,clearTimeout(X),X=setTimeout(()=>{k=null,d()},gt),y()}function Gt(){U(),d()}function dt(){he++,b&&x();for(let e of[...Q.keys()])M()?.get(e)||Q.delete(e);U(),d()}function pt(e){O=e?.detail&&e.detail.message||"This document was upgraded.",k=null,clearTimeout(X),x(),h=null,R=!1,z=!1,w="bar",d()}function ut(e){let t=e?.detail||{};m={generation:++Me,changedBy:t.changedBy,afterTimeout:!!t.afterTimeout,etag:t.etag??null},k=null,clearTimeout(X),x(),h=null,R=!1,ge++,z=!1,d()}function Pe(e){if(q()){e.type==="clay:save-saved"&&queueMicrotask(()=>{q()||Pe(e)});return}let t=h==="overwrite"&&e.type==="clay:save-saved";(m||h)&&(m=null,h=null,R=!1,z=!1,x()),t?Ee("Saved your version over theirs."):d()}function jt(){m&&(ie=!0,d())}function Qt(){!m||q()||(m=null,h=null,R=!1,z=!1,x(),d())}function Xt(e){if(e.key!=="Escape")return;if(b){e.preventDefault(),x(),y();return}if(w!=="panel")return;let t=document.activeElement;t&&t!==document.body&&!c?.contains(t)||(e.preventDefault(),at())}function Zt(e){!b||c?.contains(e.target)||(x(),d())}function Jt(e){k&&D&&!c?.contains(e.target)&&(D=null)}function en(){Ae=new AbortController;let{signal:e}=Ae;document.addEventListener("clay:document-upgraded",pt,{signal:e}),Ye&&(document.addEventListener("clay:sync-conflicts-changed",dt,{signal:e}),document.addEventListener("clay:unsaved-state-changed",d,{signal:e}),document.addEventListener("clay:save-conflict",ut,{signal:e}),document.addEventListener("clay:save-saved",Pe,{signal:e}),document.addEventListener("clay:save-conflict-resolved",Pe,{signal:e}),document.addEventListener("clay:sync-applied",jt,{signal:e}),document.addEventListener("clay:save-conflict-released",Qt,{signal:e}),document.addEventListener("keydown",Xt,{signal:e}),document.addEventListener("input",Zt,{capture:!0,signal:e}),document.addEventListener("focus",Jt,{capture:!0,signal:e}),document.addEventListener("clay:conflict-store-changed",Gt,{signal:e}),document.addEventListener("clay:undo-kept",ct,{signal:e}),M()?.size&&d(),U(),Promise.resolve(window.clay?.ready).catch(()=>{}).then(()=>{e.aborted||U()}))}var tn={"clay:sync-conflicts-changed":dt,"clay:save-conflict":ut,"clay:document-upgraded":pt,"clay:undo-kept":ct},Te=!1,Ae=null;function gn(e){Te||(Te=!0,en());let t=e&&tn[e.type];t&&t(e),m&&(ie=!0,d())}function mn(){Te&&(Te=!1,Ae?.abort(),Ae=null,x(),clearTimeout(X),X=null,clearTimeout(Z),Z=null,clearTimeout(ye),ye=null,clearTimeout(be),be=null,$e(),window.visualViewport?.removeEventListener("resize",le),window.visualViewport?.removeEventListener("scroll",le),c?.remove(),c=null,G=new Map,P=null,re=null,w="hidden",Y=!1,L=[],ne.clear(),B.clear(),Q.clear(),k=null,m=null,O=null,h=null,R=!1,ge++,b=null,Be=0,z=!1,$=[],v=[],ae=!1,ue=!1,ie=!1,D=null,me=null,K=!1,Ce=!1,we=null)}var wn={state:()=>({view:w,listOpen:Y,renderedIds:L.slice(),refused:m,armed:b,busy:h,ledgerRevision:he,upgraded:O}),render:y,resetUpgrade:()=>{O=null}};export{I as WARN,wn as _test,d as schedule,gn as start,mn as stop,Ee as toast};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a}from"./c-PZ4XEPUP.js";import{L as u}from"./c-
|
|
1
|
+
import{b as a}from"./c-PZ4XEPUP.js";import{L as u}from"./c-UW6MMZ4V.js";import"./c-XQXZAO7N.js";import"./c-S7LK4KUE.js";import"./c-MOP5KBWZ.js";import"./c-2YYDMLNZ.js";import{i as s}from"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var d=20,i=null,l=!1,c=[];function h(){i||l||(l=!0,import("./c-OIDRZKAF.js").then(e=>{i=e,l=!1,f()},e=>{l=!1,console.error("clayjs: the conflict recovery module could not be downloaded; conflicts stay in this tab only",e)}))}function f(){if(!i){h();return}for(;c.length;){let e=c.shift();try{i.recordConflicts(e)}catch(o){console.error("clayjs: the conflict could not be stored for a later reload; it is still here",o)}}}function m(e,o){let t=null;try{t=a(e)}catch{}let n=r=>r?(r.cutBefore?"\u2026":"")+r.before+r.hit+r.after+(r.cutAfter?"\u2026":""):"";return{id:String(e.id),kind:String(e.kind??""),key:e.recovery?.key==null?"":String(e.recovery.key),name:t?.name?String(t.name):"",sentence:t?.sentence?String(t.sentence):"",yours:n(t?.yours),now:n(t?.now),context:o}}function y(e){try{let t=(e.recoveryRoot??e.root)?.cloneNode?.(!0);if(!t)return null;for(let n of s)t.removeAttribute(n);return u(t,{prepared:e.domain==="save"})}catch(o){return console.error("clayjs: the conflict recovery page could not be serialized; the conflict text is still stored",o),null}}function k({apply:e,records:o}){try{c.push({apply:{id:e.id,source:e.source,domain:e.domain,seq:e.seq,etag:e.etag,ticket:e.ticket},root:y(e),conflicts:o.map(({rec:t,context:n})=>m(t,n))}),c.length>d&&c.shift(),f()}catch(t){console.error("clayjs: the conflict could not be stored for a later reload; it is still here",t)}}function A(e){import("./c-OIDRZKAF.js").then(o=>o.dismissConflicts(e),()=>{}).catch(()=>{})}export{A as dismiss,k as keep};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{w as T}from"./c-
|
|
1
|
+
import{w as T}from"./c-LUBZU4AZ.js";import"./c-GO635CRU.js";import"./c-V2V5FKXX.js";import"./c-T7LOTEWO.js";import"./c-A3OKSYRI.js";import"./c-7K4SCQB7.js";import"./c-WMRJKQ2V.js";import{d as g}from"./c-3Y234AUB.js";import{d as f,l as M,n as b}from"./c-OH2FPYSY.js";import"./c-FSQXFG5T.js";import{e as x}from"./c-RETTCOWO.js";import{a as k}from"./c-JC4RZW4E.js";import"./c-57XDY6HC.js";import"./c-VHNSBD2M.js";var $="blockeditor-step",l=t=>x.closeHistory(t).setMeta($,!0),y=(t,e)=>!!t&&Object.keys(t.type.attrs).every(r=>t.attrs[r]===e[r]);function C(t,e,r){let o=t.state,{from:n,to:a,empty:u,$from:s}=o.selection,c=o.tr;if(u)y(e.isInSet(o.storedMarks||s.marks()),r)?c.removeStoredMark(e):c.addStoredMark(e.create(r));else{let i=!0;o.doc.nodesBetween(n,a,h=>{i&&h.isText&&!y(e.isInSet(h.marks),r)&&(i=!1)}),i?c.removeMark(n,a,e):c.addMark(n,a,e.create(r))}return t.dispatch(l(c)),!0}function F(t,e){let r=t.state,o=r.tr;return r.selection.empty?o.removeStoredMark(e):o.removeMark(r.selection.from,r.selection.to,e),t.dispatch(l(o)),!0}function p(t,e){let r=t.runFormatCommand;return typeof r!="function"?Promise.resolve({status:"unsupported-host",code:"blockeditor-format-unsupported",retry:!1}):r(e)}function A(t,e,r={},{reset:o=!1}={}){let n=f.marks[e];return n?t.editable?b(t.state,n)?p(t,()=>o?F(t,n):C(t,n,r)):Promise.resolve({status:"refused",code:"mark-not-allowed"}):Promise.resolve({status:"refused",code:"not-editable"}):Promise.resolve({status:"refused",code:"unsupported-format"})}function B(t,e,r,o){let n=t.state.doc,a=()=>{if(t.isDestroyed)return!1;let s=t.state;return s.selection.from!==r||s.selection.to!==o?!1:(t.dispatch(s.tr.replaceSelection(e).scrollIntoView()),!0)},u=()=>{let s=e.content.textBetween(0,e.content.size,`
|
|
2
2
|
`," ");return!t.isDestroyed&&s&&t.state.doc===n&&t.dispatch(t.state.tr.insertText(s,r,o)),!1};p(t,a).then(s=>{s?.status!=="applied"&&(m(t,s?.message??"That format isn\u2019t available here."),u())},u)}function H(t,e,{at:r,from:o,to:n},a){let u=()=>{if(e.isDestroyed)return!1;let s=e.state,c=s.doc.nodeAt(r);if(!c||c.type!==f.nodes.paragraph||c.textContent!=='"')return a();let i=s.tr.delete(r+1,r+2).setNodeMarkup(r,f.nodes.quote,c.attrs);return e.dispatch(l(i.setMeta(t,{transform:i,from:o,to:n,text:" "}))),!0};e.runFormatCommand(u).then(s=>{s?.status!=="applied"&&(s&&m(e,S(s)),a())},a)}var N="This text can\u2019t take that format.",S=t=>t.status==="upgrade-required"?t.message:t.code==="mark-not-allowed"?N:"That format isn\u2019t available here.",m=(t,e)=>{t.isDestroyed||(g(t,e),k(e,"error"))},P=(t,e)=>{e?.status!=="applied"&&m(t,S(e??{}))},d=(t,e,r={},o=void 0)=>{A(t,e,r,o).then(n=>P(t,n))},O=(t,e)=>{p(t,e).then(r=>P(t,r))};function j(t,e,r){if(e==="underline")return d(t,e);let o=e==="text_color"?"Text":"Highlight",n=e==="text_color"?"Automatic":"No highlight";return T(t,r,[...M.map(a=>({key:`${e}_${a}`,label:`${o}: ${a[0].toUpperCase()}${a.slice(1)}`,icon:"\u25CF",run:u=>d(u,e,{color:a})})),{key:`${e}_none`,label:n,icon:"\xD7",run:a=>d(a,e,{},{reset:!0})}])}export{A as formatMark,O as gateTurn,j as nativeMenu,B as pasteFormats,H as quoteFromSpace,m as refuse,p as runFormat,d as runNative};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as D,b as x}from"./c-A7LS5UZW.js";import{b as L,c as M,d as _,f as N}from"./c-
|
|
1
|
+
import{a as D,b as x}from"./c-A7LS5UZW.js";import{b as L,c as M,d as _,f as N}from"./c-VO6RSFCO.js";import"./c-WN3MXOLT.js";import"./c-EQ5NBOGA.js";import"./c-C7SUMNMI.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-U4TWEIKZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var m="This computer",C=64,O=64,R=/^[\x20-\x7e]{1,128}$/;function X(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2)+Date.now().toString(36)}function B(e){return typeof e!="string"?m:e.trim().slice(0,O)||m}function v(e){let r=_(e===void 0?null:e);return r.ok?r.target:null}function j(e,r){let c=null,f=-1;for(let l of r)l.editing===null||l.n<=f||(c=l.editing,f=l.n);return e.editing!==null&&e.n>=f?e.editing:c}function Y({scope:e=null,key:r=null,store:c=N,channel:f=null,label:l=m}={}){let S=B(l),w=r??"clay-live:"+(e??(typeof window<"u"?window.location.pathname:"/")),P="local:"+(e??w),b=X(),i=new Map,d=null,u=0,p=null,I=null,s=null,g=null,a=!1;function h(n){p&&p.post({type:D,from:b,...n})}function y(){let n={id:b,you:!0,n:u,editing:d},t=[];for(let o of i.values())t.push({id:o.id,you:!1,n:o.n,editing:o.editing});let E=[n,...t].sort((o,A)=>o.id<A.id?-1:o.id>A.id?1:0);c.receive({people:[{id:P,name:S,you:!0,canEdit:!0,editing:j(n,t),sessions:E}],anonymous:0})}function T(n){if(!n||n.from===b||typeof n.from!="string"||!R.test(n.from))return;let t=i.get(n.from);if(n.op==="bye"){t&&i.delete(n.from),y();return}if(n.op!=="hello"&&n.op!=="update"&&n.op!=="beat"||!t&&i.size>=C)return;let E=n.op==="beat"?t?t.editing:null:v(n.editing),o=Number.isSafeInteger(n.n)&&n.n>=0?n.n:0;t&&o<t.n||(i.set(n.from,{id:n.from,n:o,editing:E,seenAt:Date.now()}),n.op==="hello"&&!t&&h({op:"hello",n:u,editing:d,label:S}),y())}function U(){if(!a)return;h({op:"beat",n:u});let n=Date.now(),t=!1;for(let[E,o]of i)n-o.seenAt<=M||(i.delete(E),t=!0);t&&y()}function k(n){let t=n&&typeof n=="object"&&"editing"in n?n.editing:null;return d=v(t),u+=1,h({op:"update",n:u,editing:d}),y(),!0}return{sessionId:b,start(){return a||(a=!0,p=f??x(w),I=p.subscribe("presence",T),s=c.attachTransport({send:k}),h({op:"hello",n:u,editing:d,label:S}),y(),g=setInterval(U,L)),s},stop(){a&&(a=!1,g!==null&&clearInterval(g),g=null,h({op:"bye"}),i.clear(),I?.(),I=null,p=null,s?.detach(),s=null)}}}export{m as LOCAL_LABEL,C as MAX_SESSIONS,Y as localPresence};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as K}from"./c-
|
|
1
|
+
import{b as K}from"./c-A3OKSYRI.js";import{d as h}from"./c-3Y234AUB.js";import{d as w,z as C}from"./c-OH2FPYSY.js";import{c as O}from"./c-FSQXFG5T.js";import"./c-RETTCOWO.js";import"./c-VHNSBD2M.js";var z=`
|
|
2
2
|
:where(article[data-blockeditor], .blockeditor-shell) { --blockeditor-board-lane: 274px; --blockeditor-board-gap: 14px; --blockeditor-board-radius: 8px; --blockeditor-board-panel: 360px; }
|
|
3
3
|
.blockeditor-editor .blockeditor-board { margin-block: 1.1em 1.5em; font-size: 15px; line-height: 1.4; white-space: normal; }
|
|
4
4
|
:is(.blockeditor-board, .blockeditor-board-panel) .i { flex: none; width: 16px; height: 16px; }
|