@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
|
@@ -42,3 +42,72 @@ The script defines `mount(tool)` and may return a cleanup function. `tool` suppl
|
|
|
42
42
|
"summary": "Shows the sum of the amount column in the revenue table."
|
|
43
43
|
}
|
|
44
44
|
```
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# Page tool cookbook: larger examples
|
|
48
|
+
|
|
49
|
+
Four larger worked examples. Each block is a whole reply: the artifact and the state it starts with.
|
|
50
|
+
|
|
51
|
+
## Count from a table
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"artifact": {
|
|
56
|
+
"title": "Nights below freezing",
|
|
57
|
+
"html": "<div class=\"frost\"><p class=\"lead\"><output class=\"big\">0</output> <span class=\"what\">nights below freezing</span></p><p class=\"detail\"></p><p class=\"note\"></p></div>",
|
|
58
|
+
"css": ".frost { max-width: 26rem; display: grid; gap: 0.5rem; } p { margin: 0; } .big { font-size: 3rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; } .detail, .note { font-size: 0.875em; } .note { opacity: 0.75; } p:empty { display: none; }",
|
|
59
|
+
"javascript": "function mount(tool) { const find = (selector) => tool.root.querySelector(selector); const lead = find('.lead'), big = find('.big'), what = find('.what'), detail = find('.detail'), note = find('.note'); const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many); const show = (n) => (Math.round(n * 10) / 10 || 0).toLocaleString(); const number = (value) => { const text = String(value ?? '').trim(); return text !== '' && Number.isFinite(Number(text)) ? Number(text) : null; }; const draw = () => { const table = tool.table('readings'); const rows = table?.rows ?? []; const key = (name) => table?.cols?.find((col) => String(col.name).trim().toLowerCase() === name)?.id ?? name; const nights = rows.map((row) => ({ night: String(row.cells?.[key('night')] ?? '').trim(), low: number(row.cells?.[key('low')]) })).filter((night) => night.low !== null); const skipped = rows.length - nights.length; const frosty = nights.filter((night) => night.low < 0).length; lead.hidden = !table; big.textContent = String(frosty); what.textContent = frosty === 1 ? 'night below freezing' : 'nights below freezing'; note.textContent = skipped ? plural(skipped, 'row', 'rows') + ' skipped: no number in the low column.' : ''; if (!table) detail.textContent = 'This page has no readings table to count from.'; else if (!rows.length) detail.textContent = 'The readings table has no rows yet.'; else if (!nights.length) detail.textContent = ''; else { const coldest = nights.reduce((a, b) => (b.low < a.low ? b : a)); const average = nights.reduce((sum, night) => sum + night.low, 0) / nights.length; detail.textContent = 'Out of ' + plural(nights.length, 'reading', 'readings') + '. Coldest ' + show(coldest.low) + ' °C' + (coldest.night ? ' on ' + coldest.night : '') + ', average ' + show(average) + ' °C.'; } }; const off = tool.on('tables', draw); draw(); return off; }",
|
|
60
|
+
"fallbackHtml": "<p>Counts the nights below freezing in the readings table. Open this page to see the current count.</p>",
|
|
61
|
+
"summary": "Counts the rows of the readings table whose low is under zero, with the coldest night and the average as detail. Says so when the table is missing, empty, or has rows without a number."
|
|
62
|
+
},
|
|
63
|
+
"state": {}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## List with add, edit, remove and undo
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"artifact": {
|
|
72
|
+
"title": "Meeting agenda",
|
|
73
|
+
"html": "<div class=\"agenda\"><p><output class=\"big\">0</output> <span class=\"unit\">minutes planned</span></p><ol></ol><p class=\"empty\">No topics yet. Add the first one below.</p><p class=\"undo\" hidden><span></span> <button type=\"button\">Undo</button></p><form novalidate><label class=\"wide\"><span>Topic</span><input name=\"topic\" type=\"text\" maxlength=\"80\" autocomplete=\"off\" placeholder=\"Budget review\"></label><label><span>Minutes</span><input name=\"minutes\" type=\"text\" inputmode=\"numeric\" maxlength=\"4\" autocomplete=\"off\" placeholder=\"15\"></label><button type=\"submit\" class=\"primary\">Add topic</button><button type=\"button\" class=\"cancel\" hidden>Cancel</button><p class=\"error\" role=\"alert\"></p></form></div>",
|
|
74
|
+
"css": ".agenda { max-width: 30rem; display: grid; gap: 0.75rem; } p, ol { margin: 0; padding: 0; } .big { font-size: 2.5rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; } li { display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.5rem; border-top: 1px solid color-mix(in srgb, currentColor 20%, transparent); } .topic { flex: 1 1 9rem; overflow-wrap: anywhere; } .mins { font-variant-numeric: tabular-nums; } form { display: flex; flex-wrap: wrap; align-items: end; gap: 0.5rem; } label { flex: 0 1 6rem; display: grid; gap: 0.25rem; } label.wide { flex: 1 1 12rem; } label span, .empty, .undo { font-size: 0.875em; } input, button { font: inherit; color: inherit; min-height: 44px; box-sizing: border-box; border: 1px solid color-mix(in srgb, currentColor 40%, transparent); border-radius: 0.375rem; background: transparent; } input { width: 100%; padding: 0 0.625rem; font-size: max(1em, 16px); } input[aria-invalid] { border: 2px solid currentColor; } ::placeholder { color: inherit; opacity: 0.5; } button { min-width: 44px; padding: 0 0.875rem; cursor: pointer; } li button, .undo button { border-color: transparent; padding: 0 0.5rem; text-decoration: underline; } button.primary { background: color-mix(in srgb, currentColor 12%, transparent); border-color: currentColor; font-weight: 600; } :focus-visible { outline: 2px solid currentColor; outline-offset: 2px; } .error { flex-basis: 100%; font-weight: 600; } p:empty, ol:empty, [hidden] { display: none; }",
|
|
75
|
+
"javascript": "function mount(tool) { const doc = tool.root.ownerDocument; const find = (selector) => tool.root.querySelector(selector); const big = find('.big'), unit = find('.unit'), list = find('ol'), empty = find('.empty'), undo = find('.undo'); const form = find('form'), topic = form.elements.topic, minutes = form.elements.minutes; const submit = find('.primary'), cancel = find('.cancel'), error = find('.error'); const stop = new AbortController(); const on = (target, type, handler) => target.addEventListener(type, handler, { signal: stop.signal }); const blank = { topic: '', minutes: '', id: '' }; let removed = null; let drawn = ''; let shown = {}; const read = () => { const data = tool.state.data || {}; const items = data.items || {}; const draft = { ...blank, ...data.draft }; const rows = Object.keys(items).map((id) => ({ id, ...items[id] })).sort((a, b) => a.at - b.at); return { items, rows, draft, editing: items[draft.id] ? draft.id : '' }; }; const put = (path, value) => { try { tool.state.set(path, value); return true; } catch (problem) { return false; } }; const el = (tag, className, text) => { const node = doc.createElement(tag); node.className = className; node.textContent = text; return node; }; const draw = () => { const now = read(); const total = now.rows.reduce((sum, row) => sum + row.minutes, 0); const count = now.rows.length; for (const input of [topic, minutes]) { const text = now.draft[input.name]; if (text !== shown[input.name] && input.value !== text) input.value = text; } shown = now.draft; submit.textContent = now.editing ? 'Save topic' : 'Add topic'; cancel.hidden = !now.editing; big.textContent = String(total); unit.textContent = (total === 1 ? 'minute' : 'minutes') + (count ? ' across ' + count + (count === 1 ? ' topic' : ' topics') : ' planned'); empty.hidden = count > 0; undo.hidden = !removed; undo.firstElementChild.textContent = removed ? 'Removed ' + removed.topic + '.' : ''; const signature = JSON.stringify(now.rows); if (signature === drawn) return; drawn = signature; list.textContent = ''; for (const row of now.rows) { const item = el('li', '', ''); const edit = el('button', 'edit', 'Edit'); const remove = el('button', 'remove', 'Remove'); item.dataset.id = row.id; edit.type = remove.type = 'button'; edit.setAttribute('aria-label', 'Edit ' + row.topic); remove.setAttribute('aria-label', 'Remove ' + row.topic); item.append(el('span', 'topic', row.topic), el('span', 'mins', row.minutes + ' min'), edit, remove); list.append(item); } }; const focusRow = (id, name) => (find('li[data-id=\"' + id + '\"] .' + name) || topic).focus(); const fail = (input, message) => { error.textContent = message; input.setAttribute('aria-invalid', 'true'); input.focus(); }; const full = () => fail(topic, 'This agenda is full. Remove a topic to make room.'); const clearError = () => { error.textContent = ''; topic.removeAttribute('aria-invalid'); minutes.removeAttribute('aria-invalid'); }; on(form, 'input', (event) => { clearError(); put(['draft', event.target.name], event.target.value); }); on(form, 'submit', (event) => { event.preventDefault(); clearError(); const now = read(); const name = topic.value.trim(); const length = minutes.value.trim(); if (!name) return fail(topic, 'Give the topic a name.'); if (!/^\\d+$/.test(length) || Number(length) < 1) return fail(minutes, 'Minutes must be a whole number above 0, such as 15.'); const id = now.editing || 't' + Date.now().toString(36) + Math.random().toString(36).slice(2, 5); if (!put(['items', id], { topic: name, minutes: Number(length), at: now.editing ? now.items[id].at : Date.now() })) return full(); removed = null; put(['draft'], blank); if (now.editing) focusRow(id, 'edit'); else topic.focus(); }); on(list, 'click', (event) => { const button = event.target.closest('button'); const id = button?.closest('li').dataset.id; const item = read().items[id]; if (!item) return; clearError(); if (button.className === 'edit') { if (!put(['draft'], { topic: item.topic, minutes: String(item.minutes), id })) return full(); topic.focus(); } else { removed = { id, topic: item.topic, minutes: item.minutes, at: item.at }; tool.state.delete(['items', id]); undo.lastElementChild.focus(); } }); on(undo.lastElementChild, 'click', () => { const { id, ...item } = removed; if (!put(['items', id], item)) return full(); removed = null; draw(); focusRow(id, 'edit'); }); on(cancel, 'click', () => { const id = read().editing; clearError(); put(['draft'], blank); focusRow(id, 'edit'); }); const off = tool.on('change', draw); draw(); return () => { stop.abort(); off(); }; }",
|
|
76
|
+
"fallbackHtml": "<p>Meeting agenda with a time for each topic. Open this page in an editor to add or change topics.</p>",
|
|
77
|
+
"summary": "Add topics with a length in minutes, edit or remove them, and see the total time. An empty name or a length that is not a whole number gets a message. A removed topic can be put back with Undo."
|
|
78
|
+
},
|
|
79
|
+
"state": {"items":{},"draft":{"topic":"","minutes":"","id":""}}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Stopwatch that keeps time across a reload
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"artifact": {
|
|
88
|
+
"title": "Stopwatch",
|
|
89
|
+
"html": "<div class=\"watch\"><p class=\"time\" role=\"timer\">0:00</p><p class=\"status\">Ready</p><div class=\"actions\"><button type=\"button\" class=\"primary\">Start</button><button type=\"button\" class=\"reset\" hidden>Reset</button></div><p class=\"undo\" hidden><span></span> <button type=\"button\">Undo</button></p></div>",
|
|
90
|
+
"css": ".watch { max-width: 20rem; display: grid; gap: 0.5rem; } p { margin: 0; } .time { font-size: 3.5rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; } .status, .undo { font-size: 0.875em; } .actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; } button { font: inherit; color: inherit; min-width: 44px; min-height: 44px; padding: 0 1rem; border: 1px solid color-mix(in srgb, currentColor 40%, transparent); border-radius: 0.375rem; background: transparent; cursor: pointer; } button.primary { flex: 1; background: CanvasText; border-color: CanvasText; color: Canvas; font-weight: 600; } .undo button { border-color: transparent; padding: 0 0.5rem; text-decoration: underline; } :focus-visible { outline: 2px solid currentColor; outline-offset: 2px; } button.primary:focus-visible { outline-color: CanvasText; } [hidden] { display: none; }",
|
|
91
|
+
"javascript": "function mount(tool) { const find = (selector) => tool.root.querySelector(selector); const time = find('.time'), status = find('.status'), toggle = find('.primary'), reset = find('.reset'), undo = find('.undo'); const stop = new AbortController(); const on = (target, type, handler) => target.addEventListener(type, handler, { signal: stop.signal }); let cleared = null; let waiting = false; const read = () => { const run = (tool.state.data || {}).run || {}; return { since: Number(run.since) || 0, banked: Number(run.banked) || 0 }; }; const elapsed = (run) => run.banked + (run.since ? Math.max(0, Date.now() - run.since) : 0); const clock = (ms) => { const seconds = Math.floor(ms / 1000); const two = (n) => String(n).padStart(2, '0'); const minutes = Math.floor(seconds / 60); return (minutes >= 60 ? Math.floor(minutes / 60) + ':' + two(minutes % 60) : minutes) + ':' + two(seconds % 60); }; const draw = () => { const run = read(); const ms = elapsed(run); time.textContent = clock(ms); toggle.textContent = run.since ? 'Pause' : ms ? 'Resume' : 'Start'; status.textContent = run.since ? 'Running since ' + new Date(run.since).toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' }) : ms ? 'Paused' : 'Ready'; reset.hidden = !ms && !run.since; undo.hidden = !cleared; undo.firstElementChild.textContent = cleared ? 'Cleared ' + clock(elapsed(cleared)) + '.' : ''; if (run.since && !waiting) { waiting = true; tool.schedule(() => { waiting = false; draw(); }, 1000 - (ms % 1000)); } }; on(toggle, 'click', () => { const run = read(); cleared = null; tool.state.set(['run'], run.since ? { since: 0, banked: elapsed(run) } : { since: Date.now(), banked: run.banked }); }); on(reset, 'click', () => { cleared = read(); tool.state.set(['run'], { since: 0, banked: 0 }); undo.lastElementChild.focus(); }); on(undo.lastElementChild, 'click', () => { const run = cleared; cleared = null; tool.state.set(['run'], run); toggle.focus(); }); const off = tool.on('change', draw); draw(); return () => { stop.abort(); off(); }; }",
|
|
92
|
+
"fallbackHtml": "<p>Stopwatch. Open this page in an editor to start, pause or reset it.</p>",
|
|
93
|
+
"summary": "Start, pause and reset a stopwatch. It saves when it was started, not a ticking number, so the time stays right after a reload. A reset can be undone."
|
|
94
|
+
},
|
|
95
|
+
"state": {"run":{"since":0,"banked":0}}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Calculator with messages for invalid input
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"artifact": {
|
|
104
|
+
"title": "Paint needed",
|
|
105
|
+
"html": "<div class=\"paint\"><div class=\"fields\"><label><span>Wall length (m)</span><input name=\"length\" type=\"text\" inputmode=\"decimal\" maxlength=\"12\" autocomplete=\"off\" placeholder=\"14.5\"><small>Add up every wall you will paint.</small></label><label><span>Wall height (m)</span><input name=\"height\" type=\"text\" inputmode=\"decimal\" maxlength=\"12\" autocomplete=\"off\" placeholder=\"2.4\"><small>From the floor to the ceiling.</small></label><label><span>Coverage (m² per litre)</span><input name=\"cover\" type=\"text\" inputmode=\"decimal\" maxlength=\"12\" autocomplete=\"off\" placeholder=\"10\"><small>Printed on the tin.</small></label><div class=\"coats\" role=\"group\" aria-label=\"Coats\"><span>Coats</span><div><button type=\"button\" value=\"1\">1</button><button type=\"button\" value=\"2\">2</button><button type=\"button\" value=\"3\">3</button></div></div></div><div class=\"result\"><p class=\"main\"><output class=\"big\"></output> <span>litres of paint</span></p><p class=\"detail\"></p></div></div>",
|
|
106
|
+
"css": ".paint { max-width: 28rem; display: grid; gap: 1rem; } .fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.75rem; } label, .coats { display: grid; gap: 0.25rem; align-content: start; } span, small, .detail { font-size: 0.875em; } small { opacity: 0.75; } small.error { opacity: 1; font-weight: 600; } input, button { font: inherit; color: inherit; min-height: 44px; box-sizing: border-box; border: 1px solid color-mix(in srgb, currentColor 40%, transparent); border-radius: 0.375rem; background: transparent; } input { width: 100%; padding: 0 0.625rem; font-size: max(1em, 16px); } input[aria-invalid] { border: 2px solid currentColor; } ::placeholder { color: inherit; opacity: 0.5; } .coats div { display: flex; gap: 0.25rem; } button { flex: 1; cursor: pointer; } button[aria-pressed=\"true\"] { background: color-mix(in srgb, currentColor 12%, transparent); border-color: currentColor; font-weight: 600; } :focus-visible { outline: 2px solid currentColor; outline-offset: 2px; } .result { padding-top: 0.75rem; border-top: 1px solid color-mix(in srgb, currentColor 20%, transparent); } p { margin: 0; } .big { font-size: 2.5rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; } [hidden] { display: none; }",
|
|
107
|
+
"javascript": "function mount(tool) { const find = (selector) => tool.root.querySelector(selector); const inputs = Array.from(tool.root.querySelectorAll('input')); const buttons = Array.from(tool.root.querySelectorAll('button')); const hints = inputs.map((input) => input.nextElementSibling.textContent); const main = find('.main'), big = find('.big'), detail = find('.detail'); const stop = new AbortController(); const on = (target, type, handler) => target.addEventListener(type, handler, { signal: stop.signal }); const show = (n) => (Math.round(n * 10) / 10).toLocaleString(); const check = (input, text) => { if (text === '') return { empty: true }; if (!Number.isFinite(Number(text))) return { error: 'Type a plain number, such as ' + input.placeholder + '.' }; if (Number(text) <= 0) return { error: 'This has to be more than 0.' }; return { value: Number(text) }; }; const draw = () => { const data = tool.state.data || {}; const coats = [1, 2, 3].includes(data.coats) ? data.coats : 2; const got = {}; let empty = 0, wrong = 0; inputs.forEach((input, index) => { const text = String(data[input.name] ?? ''); const result = got[input.name] = check(input, text.trim()); const small = input.nextElementSibling; if (input.value !== text) input.value = text; small.textContent = result.error || hints[index]; small.className = result.error ? 'error' : ''; if (result.error) input.setAttribute('aria-invalid', 'true'); else input.removeAttribute('aria-invalid'); wrong += result.error ? 1 : 0; empty += result.empty ? 1 : 0; }); for (const button of buttons) button.setAttribute('aria-pressed', String(Number(button.value) === coats)); main.hidden = wrong + empty > 0; if (wrong) detail.textContent = 'Fix the marked ' + (wrong === 1 ? 'field' : 'fields') + ' to see the amount.'; else if (empty) detail.textContent = 'Fill in every field to see how much paint to buy.'; else { const area = got.length.value * got.height.value; big.textContent = show(area * coats / got.cover.value); detail.textContent = show(area) + ' m² of wall, ' + coats + (coats === 1 ? ' coat' : ' coats') + ', ' + show(got.cover.value) + ' m² per litre.'; } }; on(tool.root, 'input', (event) => tool.state.set([event.target.name], event.target.value)); for (const button of buttons) on(button, 'click', () => tool.state.set(['coats'], Number(button.value))); const off = tool.on('change', draw); draw(); return () => { stop.abort(); off(); }; }",
|
|
108
|
+
"fallbackHtml": "<p>Works out the litres of paint for a room from the wall length, wall height, number of coats and the paint's coverage.</p>",
|
|
109
|
+
"summary": "Enter the wall length, height and coverage and pick the coats to see the litres of paint needed. A field that is not a number above 0 gets a message and no result is shown."
|
|
110
|
+
},
|
|
111
|
+
"state": {"length":"","height":"","cover":"10","coats":2}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
@@ -14,8 +14,8 @@ The tool sits inside someone else's page, so it fits that page instead of bringi
|
|
|
14
14
|
- Inherit the page's type and colour: `font: inherit; color: inherit;`, `currentColor` for lines and icons, and the page's custom properties when you know them. Load no fonts.
|
|
15
15
|
- Separate parts with whitespace first, then a hairline, then a tinted area. Never a card inside a card, and never a coloured stripe on one side of a box: not left, right or top.
|
|
16
16
|
- No eyebrow text above a heading. Labels use the body face one step smaller, in sentence case, with no letter spacing.
|
|
17
|
-
- One filled primary button at most. Fields are flat; buttons are the only raised things. One shadow at most per element.
|
|
18
|
-
- Every control shows a visible focus ring with space around it: `outline: 2px solid currentColor; outline-offset: 2px;` on `:focus-visible`.
|
|
17
|
+
- One filled primary button at most. Fill it with `CanvasText` and write its label in `Canvas`, or tint it with `color-mix(in srgb, currentColor 12%, transparent)` and keep the inherited text colour. Never fill an element with `currentColor` while changing its `color`: `currentColor` is that element's own text colour, so the label disappears. Fields are flat; buttons are the only raised things. One shadow at most per element.
|
|
18
|
+
- Every control shows a visible focus ring with space around it: `outline: 2px solid currentColor; outline-offset: 2px;` on `:focus-visible`. On a filled button, set `outline-color: CanvasText`, because its own `currentColor` is the page colour and the ring would vanish.
|
|
19
19
|
- Checkboxes and radios keep their native behaviour, styled with `accent-color`, 1 to 4 px larger than the default.
|
|
20
20
|
- A styled select uses `appearance: none`, places its arrow as far from the right edge as the text is from the left, and pads the right so text never runs under it.
|
|
21
21
|
- Tables use horizontal rules only. No pure white, no pure black, no gradients, no glows.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"../c-YK2L436K.js";import"../c-TWCXBWS3.js";import"../c-LA2BW7UY.js";import"../c-IJUK2GPW.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";export{a as default};
|
package/dist/m/c-277QP5ET.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d}from"./c-HKSLOVU4.js";import"./c-VHNSBD2M.js";export{c as applyData,d as default,a as engine,b as extractData};
|
package/dist/m/c-3UW5EJ77.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{e as k}from"./c-N326R2JD.js";import{a as w}from"./c-I2SCCUEW.js";import{f as v}from"./c-EDE45NM7.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-LUXAB2XI.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){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 c=F(o);if(c)return c}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:c,recoveryRoot:r=null}){let i=S("a");return f.set(i,{id:i,source:e,seq:t,etag:n,ticket:0,domain:o,root:c,recoveryRoot:r,ids:new Set}),p.add(i),m().changed(),i}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,i)=>r.length<i.length&&r.every((s,d)=>s===i[d]),o=(r,i)=>i.reduce((s,d)=>d==="content"?s?.content:s?.childNodes[d],r),c=new Map;for(let r of e){let i=t.get(r),s=r;if(i)for(let d of e){let a=t.get(d);a&&a.local.length<t.get(s).local.length&&n(a.local,i.local)&&n(a.merged,i.merged)&&(a.live.contains(i.live)||o(a.live,i.merged.slice(a.merged.length))===i.live)&&(s=d)}c.has(s)||c.set(s,[...s]),r!==s&&c.get(s).push(...r)}return[...c.values()]}function M(e,t){let n=t.map(c=>l.get(c)).filter(Boolean);if(!n.length)return;let o={apply:e,records:n.map(c=>({rec:c,context:I(c.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 c=new Map;for(let i of t){if(!$(i))continue;let s=i.recovery?.key??Symbol();c.has(s)||c.set(s,[]),c.get(s).push(i)}let r=P([...c.values()]).map(i=>B(o,i));return r.length&&M(o,r),p.delete(e),r.length||f.delete(e),r.length?g({added:r.map(i=>l.get(i))}):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 c=B(o,[{kind:"apply-incomplete",detail:null,error:String(t)}]);return l.get(c).rawReports=[],M(o,[c]),g({added:[l.get(c)]}),[c]}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 c=l.get(o);if(!c)continue;k(c),l.delete(o),n.push(o);let r=f.get(c.applyId);r&&(r.ids.delete(o),r.ids.size||f.delete(c.applyId))}return n.length&&(g({removedIds:n,reason:t}),import("./c-LUXAB2XI.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 c of e){let r=l.get(c);if(r&&r.claimedBy&&r.claimedBy!==t)throw new Error(`conflict ${c} is already claimed by ${r.claimedBy}`)}let n=[];for(let c of e){let r=l.get(c);r&&!r.claimedBy&&(r.claimedBy=t,n.push(c))}n.length&&g({updatedIds:n,reason:"claimed"});let o=!1;return{release(){if(o)return;o=!0;let c=n.filter(r=>l.get(r)?.claimedBy===t);for(let r of c)l.get(r).claimedBy=null;c.length&&g({updatedIds:c,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};
|
package/dist/m/c-42ZNV7LI.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{d as Ae,h as Ve,i as qe}from"./c-TRS6TM6O.js";import{a as Ne,b as Pe}from"./c-4PO3YGDC.js";import{a as Ie,b as Oe}from"./c-PZ4XEPUP.js";import"./c-SFKI6OLM.js";import"./c-Q3XOWZEV.js";import"./c-RHMPKZZ7.js";import{e as ke,f as Ke,g as W,h as Ue,l as re,m as $e,n as p}from"./c-MR75YPRT.js";import"./c-4JZDZFF6.js";import{b as U,c as Z,e as l,f as Ye}from"./c-5RZNFTWD.js";import{b as He}from"./c-PKCCHJ5X.js";import{b as T,c as Fe}from"./c-NUHP2XDB.js";import{a as We,r as V}from"./c-HTLYXCUH.js";import"./c-4ASQPRQL.js";import"./c-GQ6F6IDK.js";import"./c-I2SCCUEW.js";import"./c-5VYOWDTI.js";import{f as Te}from"./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{f as _e}from"./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 E="light-dark(#D08A1E, #E3A33F)",lt=5e3,st=4e3,dt=500,ct={"another-tab":"in another tab","another-person":"by someone else","an-agent":"by an agent"},pt='<svg viewBox="0 0 12 12" width="12" height="12" aria-hidden="true"><path d="M2.5 9.5h7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="square"/></svg>',F=(e,t)=>`${e} ${t}${e===1?"":"s"}`,ut="This spot changed again. Review the latest edit or download your copy.",ft="A data value can't be put back from here. Download your copy to keep yours.",m="hidden",P=!1,S=[],J=new Set,M=new Set,h=null,Ee=0,I=null,v=null,le=null,u=null,R=!1,Y=!1,ve=!1,G=new Map,se=0,ae=!1,te=!1,b=null,j=null,L=null,Se=0,D=!1,de=0,ce=null,ne=null,k=[],x=[],oe=!1,pe=null,ue=null,s=null,B=null,q=new Map,z=()=>window.clay?.conflicts||null,Qe=()=>k.reduce((e,t)=>e+t.conflicts.length,0)+x.length,Le=()=>{let e=window.clay?.undo;return e&&typeof e.kept=="function"?e:null},fe=()=>z()?.list().filter(e=>!e.claimedBy&&e.kind!=="apply-incomplete")??[],De=()=>z()?.list().filter(e=>!e.claimedBy&&e.kind==="apply-incomplete")??[];function ze(){return I?"upgraded":h?"refused":fe().length?"replaced":De().length?"failed":k.length||x.length?"recovered":null}function f(e,t,n){let o=Fe(e,t,n);return t[0]==="all:initial"&&T(o,"color-scheme","inherit"),o.setAttribute("clay",ke),o}function _(e,t){return q.set(t,e),e}function ie(){if(!s)return;let e=window.visualViewport,t=e?Math.max(0,window.innerHeight-e.height-e.offsetTop):0;T(s,"bottom",`calc(${16+t}px + env(safe-area-inset-bottom,0px))`),ne&&T(ne,"max-height",`${Math.max(160,(e?.height||window.innerHeight)-32)}px`)}function ht(){s=f("div",["all:initial","position:fixed","left:50%","transform:translateX(-50%)","z-index:2147483001","display:none","flex-direction:column","align-items:center","max-width:calc(100vw - 24px)",`font:14px/1.5 ${U}`,`color:${l.ink}`,"text-align:left"]),s.setAttribute("data-clay-conflict",""),document.body.appendChild(s),window.visualViewport?.addEventListener("resize",ie),window.visualViewport?.addEventListener("scroll",ie)}function d(){if(ae)return;ae=!0;let e=()=>{ae=!1,w()};typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,16)}function w(){te&&(te=!1,h&&!V()&&(h=null));let e=ze();if(e?m==="hidden"&&(m="bar"):(m="hidden",P=!1,J.clear(),M.clear(),S=[],y(),ce=null,D=!1),!s){if(m==="hidden"&&!b||!document.body)return;ht()}!s.isConnected&&document.body&&document.body.appendChild(s);let t=document.activeElement,n=null;for(let[a,r]of q)r===t&&(n=a);let o=B?B.scrollTop:0;q=new Map,B=null,ne=null,s.replaceChildren(),b?s.append(wt(b)):m==="bar"?s.append(yt(e)):m==="panel"&&s.append(xt(e)),T(s,"display",b||m!=="hidden"?"flex":"none"),B&&(B.scrollTop=o);let i=L||n;i&&q.has(i)&&q.get(i).focus({preventScroll:!0}),b||(L=null),ie(),He(s)}function Xe(){return f("span",["all:initial","display:inline-block","flex:none","width:8px","height:8px","border-radius:50%",`background:${E}`])}function Ze(){return ct[h?.changedBy]||null}function gt(e,t){if(e==="upgraded")return I;if(e==="refused"){let n=Ze();return!n&&h.afterTimeout?"This page changed elsewhere, possibly by your own save that timed out. Your edits here are safe.":`This page changed ${n||"elsewhere"}. Your edits here are safe.`}return e==="failed"?"A sync update did not finish. Your edits here are safe.":e==="recovered"?`${F(t,"change")} replaced before this page loaded ${t===1?"is":"are"} still here.`:`Another edit replaced ${F(t,"change")}.`}function mt(e,t){return e==="upgraded"?I:e==="refused"?`This page changed ${Ze()||"elsewhere"}`:e==="failed"?"A sync update did not finish":e==="recovered"?`${F(t,"change")} kept from before this page loaded`:`Another edit replaced ${F(t,"change")}`}function wt(e){let t=re("div",["display:block",`border-left:3px solid ${l.teal}`,"padding:10px 14px","width:max-content","max-width:calc(100vw - 24px)"]);return t.setAttribute("role","status"),t.textContent=e,t}function yt(e){let t=e==="failed"?De().length:e==="recovered"?Qe():fe().length,n=re("div",["display:flex","flex-wrap:wrap","align-items:center","gap:10px 12px","padding:8px 8px 8px 14px","width:max-content","max-width:calc(100vw - 24px)"]),o=gt(e,t);return o!==ce&&(n.setAttribute("role",e==="refused"?"alert":"status"),ce=o),n.append(Xe(),p("span",[],o)),e==="upgraded"?(n.append(_(W("Reload",{variant:"primary",onClick:()=>window.location.reload()}),"reload")),n):(n.append(_(W("Review",{onClick:Dt}),"review")),n)}function $(e,t,{variant:n="default",onClick:o,push:i=!1}={}){let r=window.innerWidth<480?["flex:1 1 100%",...n==="primary"?["order:-1"]:[]]:i?["margin-left:auto"]:[];return _(W(e,{variant:n,onClick:o,extra:r}),t)}function A(e){return p("div",["display:block","padding:0 16px 12px",`color:${l["ink-2"]}`,"font-size:13.5px"],e)}function xt(e){let t=e==="replaced"?fe():e==="failed"?De():[],n=e==="refused"?fe():t,o=e==="recovered"?Qe():t.length;if(J.size)for(let c of t)J.has(c.id)||M.add(c.id);for(let c of[...M])t.some(N=>N.id===c)||M.delete(c);let i=mt(e,o),a=Math.max(160,(window.visualViewport?.height||window.innerHeight)-32),r=re("div",["display:flex","flex-direction:column","width:520px","max-width:calc(100vw - 24px)",`max-height:${a}px`]);ne=r,r.setAttribute("role","dialog"),r.setAttribute("aria-label",i);let g=f("div",["all:initial","display:flex","align-items:center","gap:8px","padding:12px 12px 8px 16px",`font:14px/1.5 ${U}`,`color:${l.ink}`]),K=_(p("b",["font-weight:600","font-size:14.5px","outline:none"],i),"title");K.setAttribute("tabindex","-1"),g.append(Xe(),K),e==="replaced"&&M.size&&g.append(p("span",[`font:600 10.5px/1 ${Z}`,"letter-spacing:.12em","text-transform:uppercase","padding:3px 6px",`color:color-mix(in srgb, ${l.brass} 80%, ${l.ink})`,`background:${l["brass-soft"]}`],`${M.size} new`));let X=f("span",["all:initial","display:inline-flex","margin-left:auto"]),Be=_(Ue(pt,{label:"Minimize",onClick:Je}),"minimize");if(Be.title="Minimize to the bar. Nothing is accepted until you choose.",X.append(Be),g.append(X),r.append(g),e==="recovered")return Et(r),r;if(e==="refused"){if(r.append(A("Your edits here are safe and not saved yet; nothing will be overwritten until you choose. Their version is not on this page, so there is no list of edits to compare. Keep yours, which saves over theirs, or accept theirs, which reloads the page and drops your unsaved edits.")),n.length&&r.append(A(`${F(n.length,"earlier replaced edit")} ${n.length===1?"is":"are"} also held in this tab. Download my copy includes them.`)),R&&r.append(A("That did not save either. Your edits here are still here.")),D&&r.append(A("Something changed on the page after your first press, so nothing was dropped. Press Accept theirs again if you still want their version.")),v){let c=f("div",["all:initial","display:block","margin:0 16px 12px","padding:8px 10px",`border-left:3px solid ${E}`,`background:color-mix(in srgb, ${E} 14%, transparent)`,`color:${l.ink}`,`font:13px/1.5 ${U}`]);c.append(f("b",["all:initial","font:inherit","font-weight:700","color:inherit"],"This drops your unsaved edits."),document.createTextNode(" Download your copy first if you might want them. Press again to confirm.")),r.append(c)}}else e==="upgraded"?r.append(A("Its layout and code changed with it, so this page stops here. Reload to see the new version.")):e==="failed"?r.append(A("Part of an update from elsewhere could not be applied, so this page may be missing some of it. Your edits here are safe. Download a copy of the page as you had it, or accept to keep the page as it is.")):r.append(A("The page is showing the other edit. This stays until you choose. You can also save a copy of the page as you had it."));let O=f("div",["all:initial","display:flex","flex-wrap:wrap","gap:8px","padding:0 16px 14px"]);if(e==="upgraded")return O.append($("Reload","reload",{variant:"primary",onClick:()=>window.location.reload(),push:!0})),r.append(O),S=[],r;let at=$(ve?"Try again":Y?"Downloaded":"Download my copy","download",{onClick:Bt});if(O.append(at),e==="refused"){let c=$(u==="overwrite"?"Saving\u2026":R?"Try again":"Keep mine","keep",{onClick:Pt});c.setDisabled(u==="overwrite"),O.append(c,$(v?"Yes, drop my edits":"Accept theirs","accept",{variant:"primary",onClick:Ft,push:!0}))}else{if(e==="replaced"){let c=z().hasPendingApply(),N=$(c?"Finishing the incoming edit\u2026":u==="revert"?"Putting back\u2026":"Revert to mine","revert",{onClick:Mt});N.setDisabled(c||u==="revert"),O.append(N)}O.append($("Accept theirs","accept",{variant:"primary",onClick:zt,push:!0}))}if(r.append(O),e==="replaced")if(P)r.append(vt(t));else{let c=f("div",["all:initial","display:flex","align-items:center","gap:8px",`border-top:1px solid ${l.line}`,"padding:8px 10px 8px 16px",`color:${l.muted}`,`font:13px/1.5 ${U}`]),N=f("span",["all:initial","display:inline-flex","margin-left:auto"]);N.append(_(W("See the edits",{small:!0,onClick:et}),"list")),c.append(f("span",["all:initial","font:inherit","color:inherit"],F(t.length,"edit")),N),r.append(c)}S=n.map(c=>c.id);for(let c of t)J.add(c.id);return r}function vt(e){let t=$e(["flex:1 1 auto","margin:0 16px 12px","min-height:0","overflow:auto",`background:${l.sunk}`,`border:1px solid ${l["line-2"]}`]),n=f("div",["all:initial","position:sticky","top:0","z-index:1","display:flex","align-items:center","gap:8px","padding:8px 12px",`background:${l.sunk}`,`border-bottom:1px solid ${l["line-2"]}`,`color:${l.muted}`,`font:600 10.5px/1 ${Z}`,"letter-spacing:.12em","text-transform:uppercase"]),o=f("span",["all:initial","display:inline-flex","margin-left:auto"]);return o.append(_(W("Hide",{small:!0,variant:"quiet",onClick:et}),"list")),n.append(f("span",["all:initial","font:inherit","color:inherit","letter-spacing:inherit","text-transform:inherit"],"Replaced edits"),o),t.append(n),e.forEach((i,a)=>t.append(St(i,a))),B=t,t}function Me(e){let t=e.context?.label||e.name||(e.context?.kind==="entry"?"Entry":"Edit");return e.context?.field?`${t} \xB7 ${e.context.field}`:t}var bt={"content-changed":"the page changed there","structure-changed":"the structure changed there","target-detached":"that part of the page is gone","duplicate-id":"another part of the page now has the same id",protected:"that region keeps its own history",unsupported:"this kind of step cannot be put back"},kt=e=>bt[e]||"the page changed there";function $t(e,t){let n=Array.isArray(e)?e:[];for(let o of n){if(!o||o.kind!=="text"&&o.kind!=="value")continue;let i=t==="redo"?o.after:o.before;if(typeof i=="string"&&i)return{text:i,id:o.target?.id??null}}for(let o of n){if(!o||o.kind!=="add"&&o.kind!=="remove")continue;let i=Array.isArray(o.nodes)?o.nodes.find(a=>typeof a?.html=="string"&&a.html):null;if(i)return{text:Ie(i.html).replace(/\s+/g," ").trim(),id:o.parent?.id??null}}for(let o of n){if(!o)continue;let i=t==="redo"?o.after:o.before;if(typeof i=="string"&&i)return{text:i,id:o.target?.id??null}}return{text:"",id:null}}function Tt(e){if(e==null||typeof document>"u")return"";let t=window.CSS?.escape?window.CSS.escape(String(e)):String(e).replace(/["\\]/g,"\\$&"),n=null;try{n=document.querySelector(`[data-id="${t}"]`)}catch{return""}if(!n)return"";let o=n.matches?.("input, textarea, select")?n.value:null;return(typeof o=="string"?o:n.textContent??"").replace(/\s+/g," ").trim()}function At(e){let t=e?.payload&&typeof e.payload=="object"?e.payload:{},n=String(e?.key??""),o={id:e?.id,revision:e?.revision,record:e,kind:e?.kind??"conflict"};if(n.startsWith("app:"))return{...o,name:typeof t.label=="string"&&t.label?t.label:n.slice(4),sentence:"",yours:typeof t.text=="string"?t.text:"",now:""};let i=t.direction==="redo"?"redo":"undo",g=((Array.isArray(t.context)?t.context:[]).find(X=>typeof X?.label=="string"&&X.label)??null)?.label||typeof t.label=="string"&&t.label||"Edit",K=$t(t.steps,i);return{...o,name:g,sentence:`The ${i} of "${g}" was not applied because ${kt(t.code)}.`,yours:K.text,now:K.id==null?"":Tt(K.id)}}function Ct(e){let t=Le();if(!e.record||typeof t?.reviewActionsFor!="function")return[];try{return(t.reviewActionsFor(e.record)||[]).filter(n=>n&&typeof n.run=="function"&&n.label)}catch{return[]}}var Ge=e=>({before:"",hit:e,after:"",cutBefore:!1,cutAfter:!1});function je(e){let t=p("div",["display:block","padding:8px 12px 10px"]),n=p("div",["display:flex","align-items:center","gap:8px","font-size:12.5px","font-weight:600",`color:${l["ink-2"]}`,"margin-bottom:4px"]);if(n.append(p("span",[],Me(e))),t.append(n),e.sentence&&t.append(p("div",["display:block","font-size:13px",`color:${l["ink-2"]}`],e.sentence)),e.yours){let i=p("div",["display:grid","grid-template-columns:44px 1fr","gap:3px 10px","align-items:start",`font:12.5px/1.5 ${Z}`,...e.sentence?["margin-top:4px"]:[]]);i.append(...he("Yours",Ge(e.yours),{mine:!0})),e.now&&i.append(...he("Now",Ge(e.now),{mine:!1})),t.append(i)}let o=f("div",["all:initial","display:flex","flex-wrap:wrap","gap:8px","margin-top:8px"]);return Ct(e).forEach((i,a)=>{let r=$(i.label,`run:${e.id}:${a}`,{onClick:()=>Nt(e,i,r)});o.append(r)}),o.append($(pe===e.id?"Copied":"Copy",`copy:${e.id}`,{onClick:()=>It(e)})),o.append($("Dismiss",`dismiss:${e.id}`,{onClick:()=>tt(e)})),t.append(o),t}function Et(e){e.append(A(k.length?"These copies were replaced before this page loaded. The page never puts them back on its own. Copy or download the ones you want; dismiss one when you no longer need it.":"These copies were kept because an undo could not be put back or the page set them aside. The page never puts them back on its own. Copy or download the ones you want; dismiss one when you no longer need it.")),oe&&e.append(A("That action did not run. The copy is still here."));let t=$e(["flex:1 1 auto","margin:0 16px 12px","min-height:0","overflow:auto",`background:${l.sunk}`,`border:1px solid ${l["line-2"]}`]);for(let o of k)for(let i of o.conflicts)t.append(je(i));for(let o of x)t.append(je(o));B=t,e.append(t);let n=f("div",["all:initial","display:flex","flex-wrap:wrap","gap:8px","padding:0 16px 14px"]);(k.some(o=>o.root)||x.length)&&n.append($(Y?"Downloaded":"Download my copy","download",{onClick:Ot})),e.append(n),S=[]}function he(e,t,{mine:n}){let o=[p("span",[`color:${l.faint}`,`font-family:${U}`],e)],i=p("span",["display:-webkit-box","-webkit-line-clamp:2","-webkit-box-orient:vertical","overflow:hidden","overflow-wrap:anywhere",...n?[`color:${l.ink}`]:[`color:${l.muted}`]]),a=(t.cutBefore?"\u2026":"")+t.before+t.hit+t.after+(t.cutAfter?"\u2026":"");i.title=a,t.before&&i.append(p("span",[`color:${l.faint}`],(t.cutBefore?"\u2026":"")+t.before));let r=p("span",n?[`background:color-mix(in srgb, ${E} 18%, transparent)`,"padding:0 4px"]:t.before||t.after?["text-decoration:underline",`text-decoration-color:color-mix(in srgb, ${E} 70%, transparent)`,"text-underline-offset:3px"]:[],t.hit||"(empty)");return i.append(r),t.after&&i.append(p("span",[`color:${l.faint}`],t.after+(t.cutAfter?"\u2026":""))),o.push(i),o}function St(e,t){let n=Oe(e),o=p("div",["display:block","padding:8px 12px 10px",...t?[`border-top:1px solid ${l.line}`]:[]]),i=p("div",["display:flex","align-items:center","gap:4px","font-size:12.5px","font-weight:600",`color:${l["ink-2"]}`,"margin-bottom:4px"]);if(i.append(p("span",[],n.name)),n.target&&n.target.isConnected&&i.append(_(Rt(n),`eye:${e.id}`)),o.append(i),n.sentence&&o.append(p("div",["display:block","font-size:13px",`color:${l["ink-2"]}`],n.sentence)),G.has(e.id)&&o.append(p("div",["display:block","font-size:13px","margin-top:4px",`color:${E}`],G.get(e.id))),n.yours){let a=p("div",["display:grid","grid-template-columns:44px 1fr","gap:3px 10px","align-items:start",`font:12.5px/1.5 ${Z}`,...n.sentence?["margin-top:4px"]:[]]);a.append(...he("Yours",n.yours,{mine:!0})),n.now&&a.append(...he("Now",n.now,{mine:!1})),o.append(a)}return o}function Rt(e){let t=["all:initial","color-scheme:inherit","box-sizing:border-box","cursor:pointer","display:inline-grid","place-items:center","width:22px","height:20px",`color:${l.ink}`],n=f("button",t);n.type="button",n.innerHTML=Ye.conflictEye,Ke(n.firstElementChild,16),n.setAttribute("aria-label",`Show ${e.name} on page`),n.title="Show on page";let o=i=>{n.style.cssText="";for(let a of[...t,...i]){let r=a.indexOf(":");n.style.setProperty(a.slice(0,r),a.slice(r+1),"important")}};return n.addEventListener("pointerenter",()=>o([`background:color-mix(in srgb, ${E} 16%, transparent)`])),n.addEventListener("pointerleave",()=>o([])),n.addEventListener("focus",()=>o([`outline:2px solid ${l.brass}`,"outline-offset:1px"])),n.addEventListener("blur",()=>o([])),n.addEventListener("click",()=>Lt(e.target)),n}var C=null,ge=null,me=null;function we(){clearTimeout(ge),window.removeEventListener("scroll",ee,!0),window.removeEventListener("resize",ee),C?.remove(),C=null,me=null}function ee(){if(!C||!me)return;let e=me.getBoundingClientRect();T(C,"left",`${e.left}px`),T(C,"top",`${e.top}px`),T(C,"width",`${e.width}px`),T(C,"height",`${e.height}px`)}function Lt(e){if(we(),!e||!e.isConnected)return;let n=!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches?"instant":"smooth",o=s?.getBoundingClientRect().top??0,i=s&&o>0?Math.max(0,window.innerHeight-o):0;if(!i)e.scrollIntoView?.({block:"center",behavior:n});else{e.scrollIntoView?.({block:"center",behavior:"instant"});let a=e.getBoundingClientRect(),r=window.innerHeight-i,g=a.height>r-24?a.top-12:a.top+a.height/2-r/2;window.scrollBy?.({top:g,behavior:n})}me=e,C=f("div",["all:initial","color-scheme:inherit","position:fixed","pointer-events:none","z-index:2147483001",`outline:2px solid ${E}`,"outline-offset:3px",`background:color-mix(in srgb, ${E} 14%, transparent)`]),document.body.appendChild(C),ee(),window.addEventListener("scroll",ee,!0),window.addEventListener("resize",ee),ge=setTimeout(we,2500)}function Dt(){I||(m="panel",L="title",w())}function Je(){we(),m="bar",y(),L="review",w()}function et(){P=!P,P&&M.clear(),w()}function zt(){let e=z(),t=S.filter(n=>{let o=e?.get(n);return o&&!o.claimedBy});e&&t.length&&e.acknowledge(t,{reason:"accepted"}),m=ze()?"bar":"hidden",L="review",d()}async function Mt(){let e=z();if(u||!e||e.hasPendingApply())return;let t=S.filter(r=>{let g=e.get(r);return g&&!g.claimedBy});if(!t.length)return;u="revert",w();let n=!0,o=r=>{n=!!s?.contains(r.target)};document.addEventListener("focus",o,!0);let i;try{let{revertConflicts:r}=await import("./c-LSVN3OLG.js");i=await r(t)}catch(r){console.error("[clay] Revert to mine did not finish",r),i={revertedIds:[],blockedIds:t,saveResult:null}}finally{document.removeEventListener("focus",o,!0)}u=null;for(let r of i.blockedIds)G.set(r,z()?.get(r)?.kind==="json"?ft:ut);m=ze()?"bar":"hidden",L=n?"review":null;let a=i.saveResult&&(i.saveResult.ok||i.saveResult.msg==="Save already in progress");i.revertedIds.length&&a?be(`Put back ${F(i.revertedIds.length,"change")}. Saving.`):w()}var Q=null;async function Bt(){let e=z(),t=h?e?.list()??[]:S.map(o=>e?.get(o)).filter(Boolean),n=await Pe(t,{refused:!!h});ve=!n,Y=n,clearTimeout(Q),n&&(Q=setTimeout(()=>{Y=!1,d()},1200)),w()}async function H(){let e=null;if(Ae())try{e=await Ve()}catch{e=null}let t=Le(),n=null;if(t)try{n=await t.kept()}catch{n=null}let o=!1;if(e?.ok?(k=e.records,o=!0):!Ae()&&k.length&&(k=[],o=!0),n?.ok){let i=(Array.isArray(n.records)?n.records:[]).filter(r=>r&&r.supported!==!1).map(At);i.length===x.length&&i.every((r,g)=>r.id===x[g].id&&r.revision===x[g].revision)||(o=!0),x=i}else n&&x.length&&(x=[],o=!0);o&&d()}async function _t(e){try{return await navigator.clipboard.writeText(e),!0}catch{}let t=document.createElement("textarea");t.value=e,t.setAttribute("clay",ke),t.style.setProperty("position","fixed","important"),t.style.setProperty("opacity","0","important"),document.body?.append(t),t.select();let n=!1;try{n=document.execCommand?.("copy")===!0}catch{}return t.remove(),n}async function It(e){let t=e.record?e.yours:`${Me(e)}
|
|
2
|
-
|
|
3
|
-
Yours:
|
|
4
|
-
${e.yours}
|
|
5
|
-
|
|
6
|
-
Now:
|
|
7
|
-
${e.now}`;if(!await _t(t)){be("Could not copy. Select the text instead.");return}pe=e.id,clearTimeout(ue),ue=setTimeout(()=>{pe=null,d()},1200),w()}async function Ot(){let e=k.find(o=>o.root),t=[];for(let o of k)for(let i of o.conflicts)t.push({id:i.id,kind:i.kind,name:Me(i),yours:i.yours,now:i.now,sentence:i.sentence});for(let o of x)t.push({id:o.id,kind:o.kind,name:o.name,yours:o.yours,now:o.now,sentence:o.sentence});let n=await Ne({html:e?.root??null,edits:t});ve=!n,Y=n,clearTimeout(Q),n&&(Q=setTimeout(()=>{Y=!1,d()},1200)),w()}async function tt(e){let t;try{t=e.record?await Le()?.dismissKept(e.id,{revision:e.revision}):await qe([e.id]),t||={ok:!1}}catch{t={ok:!1}}t.ok||be("That copy could not be dismissed."),await H(),d()}var Ce=new Set;async function Nt(e,t,n=null){if(!Ce.has(t)){Ce.add(t),n&&(n.disabled=!0,n.setAttribute("aria-busy","true")),oe=!1;try{let o=null;try{o=await t.run(e.record)}catch{o=null}if(o?.ok===!0&&o?.dismiss===!0){await tt(e);return}oe=o?.ok!==!0,await H(),d()}finally{Ce.delete(t),n&&n.isConnected&&(n.disabled=!1,n.removeAttribute("aria-busy"))}}}function nt(e){e?.detail?.ok===!0&&(oe=!1,H(),d())}function y(){clearTimeout(le),le=null,v=null}async function Pt(){if(u)return;let e=++de;u="overwrite",R=!1,y(),w();let t;try{t=await window.clay?.save?.overwrite?.()}catch{t={ok:!1}}e!==de||u!=="overwrite"||(!t?.ok&&V()&&(u=null,R=!0),d())}function Ft(){if(!v){v={refusalGeneration:Ee,ledgerRevision:se,dirtyGeneration:Te().gen},Se=Date.now(),D=!1,clearTimeout(le),le=setTimeout(()=>{y(),d()},lt),w();return}if(Date.now()-Se<dt)return;let e=v;We({isCurrent:()=>v===e&&e.refusalGeneration===Ee&&e.ledgerRevision===se&&e.dirtyGeneration===Te().gen,reload:()=>window.location.reload()})||(y(),D=!0,w())}function be(e){b=e,clearTimeout(j),j=setTimeout(()=>{b=null,d()},st),w()}function Yt(){H(),d()}function ot(){se++,v&&y();for(let e of[...G.keys()])z()?.get(e)||G.delete(e);H(),d()}function it(e){I=e?.detail&&e.detail.message||"This document was upgraded.",b=null,clearTimeout(j),y(),u=null,R=!1,D=!1,m="bar",d()}function rt(e){let t=e?.detail||{};h={generation:++Ee,changedBy:t.changedBy,afterTimeout:!!t.afterTimeout,etag:t.etag??null},b=null,clearTimeout(j),y(),u=null,R=!1,de++,D=!1,d()}function Re(e){if(V()){e.type==="clay:save-saved"&&queueMicrotask(()=>{V()||Re(e)});return}let t=u==="overwrite"&&e.type==="clay:save-saved";(h||u)&&(h=null,u=null,R=!1,D=!1,y()),t?be("Saved your version over theirs."):d()}function Ht(){h&&(te=!0,d())}function Kt(){!h||V()||(h=null,u=null,R=!1,D=!1,y(),d())}function Ut(e){if(e.key!=="Escape")return;if(v){e.preventDefault(),y(),w();return}if(m!=="panel")return;let t=document.activeElement;t&&t!==document.body&&!s?.contains(t)||(e.preventDefault(),Je())}function Wt(e){!v||s?.contains(e.target)||(y(),d())}function Vt(e){b&&L&&!s?.contains(e.target)&&(L=null)}function qt(){xe=new AbortController;let{signal:e}=xe;document.addEventListener("clay:document-upgraded",it,{signal:e}),_e&&(document.addEventListener("clay:sync-conflicts-changed",ot,{signal:e}),document.addEventListener("clay:unsaved-state-changed",d,{signal:e}),document.addEventListener("clay:save-conflict",rt,{signal:e}),document.addEventListener("clay:save-saved",Re,{signal:e}),document.addEventListener("clay:save-conflict-resolved",Re,{signal:e}),document.addEventListener("clay:sync-applied",Ht,{signal:e}),document.addEventListener("clay:save-conflict-released",Kt,{signal:e}),document.addEventListener("keydown",Ut,{signal:e}),document.addEventListener("input",Wt,{capture:!0,signal:e}),document.addEventListener("focus",Vt,{capture:!0,signal:e}),document.addEventListener("clay:conflict-store-changed",Yt,{signal:e}),document.addEventListener("clay:undo-kept",nt,{signal:e}),z()?.size&&d(),H(),Promise.resolve(window.clay?.ready).catch(()=>{}).then(()=>{e.aborted||H()}))}var Gt={"clay:sync-conflicts-changed":ot,"clay:save-conflict":rt,"clay:document-upgraded":it,"clay:undo-kept":nt},ye=!1,xe=null;function an(e){ye||(ye=!0,qt());let t=e&&Gt[e.type];t&&t(e),h&&(te=!0,d())}function ln(){ye&&(ye=!1,xe?.abort(),xe=null,y(),clearTimeout(j),j=null,clearTimeout(Q),Q=null,clearTimeout(ue),ue=null,clearTimeout(ge),ge=null,we(),window.visualViewport?.removeEventListener("resize",ie),window.visualViewport?.removeEventListener("scroll",ie),s?.remove(),s=null,q=new Map,B=null,ne=null,m="hidden",P=!1,S=[],J.clear(),M.clear(),G.clear(),b=null,h=null,I=null,u=null,R=!1,de++,v=null,Se=0,D=!1,k=[],x=[],oe=!1,ae=!1,te=!1,L=null,ce=null,Y=!1,ve=!1,pe=null)}var sn={state:()=>({view:m,listOpen:P,renderedIds:S.slice(),refused:h,armed:v,busy:u,ledgerRevision:se,upgraded:I}),render:w,resetUpgrade:()=>{I=null}};export{E as WARN,sn as _test,d as schedule,an as start,ln as stop,be as toast};
|
package/dist/m/c-6Q6RGFBF.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as r}from"./c-WYFDLITL.js";import{a as p}from"./c-LA2BW7UY.js";import{f as u}from"./c-EDE45NM7.js";import{n as d,o as l}from"./c-ICMAOOGK.js";var n=0,g=0,c=!1,m=!1,y=!1,i=!1;function o(){!u||i||(i=!0,queueMicrotask(()=>{if(i=!1,typeof document>"u")return;let e=C();if(e===y)return;y=e;let t=document.documentElement;e?t.setAttribute("unsaved","true"):t.removeAttribute("unsaved"),document.dispatchEvent(new CustomEvent(e?"clay:dirty":"clay:clean"))}))}var T=`input${r}, textarea${r}, select${r}`,h=`${d}, ${l}`,a=new WeakMap;function v(){let e=[];for(let t of document.querySelectorAll(T))t.closest(h)||e.push(t);return e}function E(e){let t=e.target;!t||t.nodeType!==1||(t.matches("input, textarea, select")||t.isContentEditable)&&(t.closest(h)||(n++,o()))}function x(){m||(m=!0,p.onAnyChange({omitChangeDetails:!0,require:"dirty"},()=>{c||(n++,o())}),document.addEventListener("input",E,!0),document.addEventListener("change",E,!0))}function L(){c=!0}function k(){c=!1}function f(e){return e instanceof HTMLSelectElement?Array.from(e.selectedOptions,t=>t.value).join("\0"):e instanceof HTMLInputElement&&(e.type==="checkbox"||e.type==="radio")?e.checked?"1":"0":e.value}function M(e){return e instanceof HTMLSelectElement?Array.from(e.options).every(t=>t.selected===t.defaultSelected):e instanceof HTMLInputElement?e.type==="checkbox"||e.type==="radio"?e.checked===e.defaultChecked:e.value===e.defaultValue:e instanceof HTMLTextAreaElement?e.hasAttribute("data-value")?e.value===e.getAttribute("data-value"):e.value===e.defaultValue:!0}function S(){for(let e of v()){let t=f(e);if(a.get(e)!==t){if(M(e)){a.set(e,t);continue}return!0}}return!1}function C(){return n>g||S()}function D(){return n}function O(){let e=[];for(let t of v())e.push([t,f(t)]);return{gen:n,probe:e}}function b(){n++,o()}function H(e){if(e){n===e.gen&&(g=e.gen);for(let[t,s]of e.probe)f(t)===s&&a.set(t,s);o()}}typeof document<"u"&&u&&x();typeof window<"u"&&(window.clay=window.clay||{},window.clay.markDirty=b);export{x as a,L as b,k as c,C as d,D as e,O as f,b as g,H as h};
|
package/dist/m/c-APGHGDZM.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{e as a,f as b,g as c}from"./c-CZHTXGJS.js";import"./c-WN3MXOLT.js";import"./c-QQFHEODI.js";import"./c-EDE45NM7.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-U4NTUVDZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";export{a as PresenceStore,c as default,b as presence};
|
package/dist/m/c-BGN7RCTJ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as d}from"./c-4PO3YGDC.js";import"./c-PZ4XEPUP.js";import"./c-SFKI6OLM.js";import"./c-Q3XOWZEV.js";import"./c-RHMPKZZ7.js";import{g as m,l as v,n as x,q as s}from"./c-MR75YPRT.js";import{a as p}from"./c-4JZDZFF6.js";import{e as f}from"./c-5RZNFTWD.js";import{b as w}from"./c-PKCCHJ5X.js";import{b as c}from"./c-NUHP2XDB.js";import{f as l}from"./c-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 $="Download a copy, then reduce its size; saving still works.",b="Download a copy to keep your work.",t=null,r=null,i=null,a=null;function h(e){return typeof e!="number"||!Number.isFinite(e)||e<0?"an unknown size":e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:e>=1024?`${Math.max(1,Math.round(e/1024))} KB`:`${e} bytes`}function y({bytes:e,maxBytes:n,state:S}){let u=`At the last save attempt: ${h(e)} of ${h(n)}.`;return S==="over"?`This host can't save a file this size. ${u} ${b}`:`This file is getting large. ${u} ${$}`}function o(){if(!t)return;let e=window.visualViewport,n=e?Math.max(0,window.innerHeight-e.height-e.offsetTop):0;c(t,"bottom",`calc(${16+n}px + env(safe-area-inset-bottom,0px))`)}async function z(){await d({})}function A(){t=v("div",["position:fixed","left:50%","transform:translateX(-50%)","z-index:2147483000","display:flex","align-items:center","gap:10px 12px","width:max-content","max-width:calc(100vw - 24px)","flex-wrap:wrap","padding:8px 8px 8px 14px","text-align:left",`color-scheme:${p()}`]),t.setAttribute("clay","editor-ui"),t.setAttribute("data-clay-save-size",""),t.setAttribute("role","status"),r=x("span",[],""),i=m("Download my copy",{small:!0,onClick:z}),s(i,!1,"inline-flex"),t.append(r,i),document.body.appendChild(t),o(),window.visualViewport?.addEventListener("resize",o),window.visualViewport?.addEventListener("scroll",o)}function M(e){t||A(),r.textContent=y(e),s(i,e.state==="over","inline-flex"),o(),w(t,{background:f.surface})}function E(){t&&(window.visualViewport?.removeEventListener("resize",o),window.visualViewport?.removeEventListener("scroll",o),t.remove(),t=null,r=null,i=null)}function g(e){let n=e?.detail;n&&(n.state==="near"||n.state==="over"?M(n):E())}function k(){l||L()}function N(e){l&&(a||=new AbortController,document.addEventListener("clay:save-size",g,{signal:a.signal}),document.addEventListener("clay:modechange",k,{signal:a.signal}),e?.type==="clay:save-size"&&g(e))}function L(){a?.abort(),a=null,E()}export{N as start,L as stop};
|
package/dist/m/c-CJ7QYEWI.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as A,b as m,c as n}from"./c-TWCXBWS3.js";import{a as c}from"./c-VKEDWYDF.js";import{f as i}from"./c-EDE45NM7.js";import{b as l,r as d}from"./c-PWJSJEJU.js";var f="[editmode\\:onclick]";function b(){d(o=>{o.querySelectorAll(f).forEach(t=>{let e=t.getAttribute("onclick");e!==null&&(t.setAttribute("inert-onclick",e),t.removeAttribute("onclick"),n(t,l(t)??t))})})}function p(){i&&c(()=>{E()})}function E(o=document){o.querySelectorAll(f).forEach(t=>{let e=t.getAttribute("inert-onclick");e&&(t.setAttribute("onclick",e),t.removeAttribute("inert-onclick"))})}function D(){document.querySelectorAll(f).forEach(o=>{let t=o.getAttribute("onclick");t&&(o.setAttribute("inert-onclick",t),o.removeAttribute("onclick")),n(o)})}function q(){b(),p()}var O="[viewmode\\:disabled]",S="[viewmode\\:readonly]",u=[[O,"disabled"],[S,"readonly"]];function k(){d(o=>{for(let[t,e]of u)o.querySelectorAll(t).forEach(r=>{if(r.hasAttribute(e))return;let a=l(r),s=a?m(a,e):null;r.setAttribute(e,s===null?"":s),n(r,a??r)})})}function h(){i&&c(()=>{x()})}function x(o=document){for(let[t,e]of u)o.querySelectorAll(t).forEach(r=>{A(r),r.removeAttribute(e)})}function M(){for(let[o,t]of u)document.querySelectorAll(o).forEach(e=>{let r=m(e,t);r===null?e.removeAttribute(t):e.setAttribute(t,r),n(e)})}function P(){k(),h()}export{f as a,E as b,D as c,q as d,O as e,S as f,x as g,M as h,P as i};
|
package/dist/m/c-CVSWLX3X.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as T}from"./c-BPF2NSPV.js";import{b as f}from"./c-CYWLPPUS.js";import"./c-HA6INT6J.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var y="Saved data was overwritten",w="data-guard-done",U=6e3,L=1500,M=5e3,P=3e4,R="Could not reach the server. Try again.",j="That did not go through. Try again.",F="Save your changes first, then try again.",N="Reload the page, then try again.",n=null,l=null,m=(e,s)=>`${e} ${s}${e===1?"":"s"}`,E=e=>!!e&&typeof e.id=="string"&&e.status==="pending",I=(e,s,a,o)=>o===!0&&!e.refused.has(`${s.id}:${a}`),v=(e,s)=>I(e,s,"restore",s.restorable),c=(e,s)=>I(e,s,"revert",s.canRevert),$=()=>T()?"omit":"same-origin",k=(e={})=>({"Document-URL":location.href,...e});function p(){for(let e of document.querySelectorAll("[data-htmlclay-guard]"))e.remove()}function d(e,s){import("./c-NVU3DORS.js").then(a=>{l=a,a.default(e,s)},()=>{})}function S(e,s){let a=s.lossSummary||{},o=a.provenance==="external"?"A change from outside this page":"A save from this page",t=a.removedItems>0?`removed ${m(a.removedItems,"item")}`:a.destroyedAtoms>0?`erased ${m(a.destroyedAtoms,"value")}`:"changed saved data",i=Array.isArray(s.preview)?s.preview[0]:null,r=[`${o} ${t}.`];return i&&r.push(`${i.key}: ${i.yours} before, ${i.now} now.`),v(e,s)?s.droppedAdditions>0&&r.push(`Restoring removes ${m(s.droppedAdditions,"item")} added or changed since.`):c(e,s)?r.push("This data no longer fits the page, but the whole change can be undone."):r.push("It cannot be restored from here."),c(e,s)&&r.push("Undo the change also removes edits made since."),r.join(" ")}function x(e,s){let a=[];return v(e,s)&&a.push({label:"Restore",onClick:()=>g(e,s,"restore")}),c(e,s)&&a.push({label:"Undo the change",onClick:()=>g(e,s,"revert")}),a.push({label:"Keep as is",onClick:()=>g(e,s,"dismiss")}),a}async function b(e,s){let a=[s.id,v(e,s),c(e,s),s.lastWriteAt,S(e,s)].join("|");if(e.drawn===a)return!0;e.drawn=a,e.eventId=s.id;try{l??=await import("./c-NVU3DORS.js")}catch{return e.drawn===a&&(e.drawn=null,e.eventId=null),!1}return n!==e||e.drawn!==a?!1:(l.dismissPersistent(y,{now:!0}),l.toastPersistent(y,"warning",{detail:S(e,s),actions:x(e,s)}),!0)}function u(e){e.drawn=null,e.eventId=null,l?.dismissPersistent(y,{now:!0})}async function h(e){let s=++e.turn;e.lastRead=Date.now();let a=new AbortController,o=setTimeout(()=>a.abort(),U),t;try{let i=await fetch(e.url,{method:"GET",credentials:$(),headers:k(),cache:"no-store",redirect:"manual",signal:a.signal});if(!i.ok)return;t=await i.json()}catch{return}finally{clearTimeout(o)}if(!(n!==e||s!==e.turn)&&!(!t||typeof t!="object"||!("event"in t))){if(E(t.event)){if(e.resolved.has(t.event.id))return;await b(e,t.event)&&p();return}u(e),p()}}function D(e,s){e.resolved.add(s.id),e.eventId===s.id&&u(e)}function O(e,s,a){if(D(e,s),a==="dismiss"){d("Kept the page as it is.","info");return}f.session.set(w,a),e.reload()}function B(e,s,a,o,t){n===e&&(o===200&&t?.ok===!0?O(e,s,a):o===404?(D(e,s),d("This was already taken care of somewhere else. Reload to see the current page.","info")):o===409?(e.drawn=null,d("This page changed after the notice appeared. Check the notice and try again.","warning"),h(e)):o===422?(e.refused.add(`${s.id}:${a}`),e.eventId===s.id&&!e.resolved.has(s.id)&&b(e,s),d(a==="restore"?"That data no longer fits this page, so it could not be restored.":"That earlier version is no longer available.","warning")):d(o===401||o===403?N:o===400?j:R,"error"))}async function G(){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 g(e,s,a){if(!(e.busy||n!==e)){e.busy=!0;try{if(a!=="dismiss"&&!await G()){n===e&&d(F,"warning");return}if(n!==e)return;let o=await fetch(e.url,{method:"POST",credentials:$(),headers:k({"Content-Type":"application/json"}),redirect:"manual",body:JSON.stringify({id:s.id,choice:a})}),t=await o.json().catch(()=>null);B(e,s,a,o.status,t)}catch{n===e&&d(R,"error")}finally{e.busy=!1}}}function K(e,s){let{msgType:a,action:o,data:t}=s.detail||{};if(a==="data-loss"){if(o==="resolved"){if(typeof t?.id!="string")return;e.turn++,e.resolved.add(t.id),e.eventId===t.id&&u(e);return}o==="raised"&&E(t)&&!e.resolved.has(t.id)&&(e.turn++,b(e,t).then(i=>{i&&p()},()=>{}))}}var A=e=>Math.max(e.lastSave+L,e.lastRead+M);function _(e){e.timer||(e.timer=setTimeout(()=>{e.timer=null,n===e&&(A(e)>Date.now()?_(e):h(e))},Math.max(A(e)-Date.now(),0)))}function q({href:e,reload:s=()=>window.location.reload()}){if(n)return;let a;try{a=new URL(e,location.href)}catch{return}if(a.origin!==location.origin)return;let o=new AbortController,t={url:a.href,reload:s,listeners:o,turn:0,lastRead:0,lastSave:0,timer:null,busy:!1,drawn:null,eventId:null,resolved:new Set,refused:new Set};n=t;let{signal:i}=o;document.addEventListener("clay:notification",C=>K(t,C),{signal:i}),document.addEventListener("clay:save-saved",()=>{t.lastSave=Date.now(),_(t)},{signal:i}),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&Date.now()-t.lastRead>=P&&h(t)},{signal:i});let r=f.session.get(w);r&&(f.session.remove(w),d(r==="restore"?"Your saved data is back.":"The earlier version is back.","success")),h(t)}function H(){let e=n;e&&(n=null,e.listeners.abort(),clearTimeout(e.timer),u(e))}export{q as start,H as stop};
|
package/dist/m/c-DXPOFLEJ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./c-UOUUI265.js";import"./c-QHWJ5ZIJ.js";import"./c-ESK4S67I.js";import"./c-MR75YPRT.js";import"./c-4JZDZFF6.js";import"./c-5RZNFTWD.js";import"./c-PKCCHJ5X.js";import"./c-46XYM55L.js";import"./c-NUHP2XDB.js";import"./c-VHNSBD2M.js";export{a as SURFACE_THEME,b as default};
|
package/dist/m/c-EILLN2H2.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as z}from"./c-U4NTUVDZ.js";import"./c-VHNSBD2M.js";function M(e){let n=e?.name||"";return n==="QuotaExceededError"||n==="NS_ERROR_DOM_QUOTA_REACHED"?"quota":n==="VersionError"?"unknown-schema":n==="DataCloneError"?"uncloneable":n==="AbortError"||n==="TransactionInactiveError"||n==="InvalidStateError"?"aborted":n==="SecurityError"||n==="UnknownError"||n==="NotSupportedError"?"unavailable":"error"}var ve="clay-visitor-drafts",Se=1,P="records",Y="parts",Ee=2e3;function T(e,n){let p=new Error(`visitor-drafts: the draft database failed (${e})`);return p.code=e,n!==void 0&&(p.cause=n),p}function ue(e,n){return new Promise((p,w)=>{let b=[],f=e.openCursor(n);f.onerror=()=>w(f.error),f.onsuccess=()=>{let o=f.result;if(!o)return p(b);b.push([o.key,o.value]),o.continue()}})}function de({factory:e=globalThis.indexedDB,keyRange:n=globalThis.IDBKeyRange,name:p=ve,timeout:w=Ee}={}){return new Promise((b,f)=>{if(!e||typeof e.open!="function"||!n)return f(T("unavailable"));let o;try{o=e.open(p,Se)}catch(d){return f(T(M(d),d))}let S=!1,u=(d,h)=>S?!1:(S=!0,clearTimeout(t),d(h),!0),t=setTimeout(()=>u(f,T("blocked")),w);o.onupgradeneeded=()=>{let d=o.result;d.objectStoreNames.contains(P)||d.createObjectStore(P),d.objectStoreNames.contains(Y)||d.createObjectStore(Y)},o.onsuccess=()=>{let d=o.result;u(b,Oe(d,n))||d.close()},o.onerror=()=>u(f,T(M(o.error),o.error)),o.onblocked=()=>u(f,T("blocked"))})}function Oe(e,n){let p=!1;e.onversionchange=()=>{p=!0;try{e.close()}catch{}};function w(t,d){if(p)throw T("closed");try{return e.transaction(t,d)}catch(h){throw T(M(h),h)}}async function b(t){let d=w(P,"readonly"),h=n.bound(t,t+":\uFFFF");try{let s=await ue(d.objectStore(P),h);return new Map(s.filter(([i])=>i===t||i.startsWith(t+":")))}catch(s){throw T(M(s),s)}}async function f(t,d){let h=w(Y,"readonly"),s=n.bound([t,d],[t,d,[]]);try{let i=await ue(h.objectStore(Y),s);return new Map(i.map(([y,g])=>[y[2],g]))}catch(i){throw T(M(i),i)}}function o(t,d,{timeout:h=0}={}){return new Promise((s,i)=>{let y;try{y=w([P,Y],"readwrite")}catch(l){return i(l)}let g=null,k,D=!1,c,E=(l,v)=>{D||(D=!0,clearTimeout(c),l(v))};h>0&&(c=setTimeout(()=>{g=T("blocked");try{y.abort()}catch{}E(i,g)},h)),y.oncomplete=()=>E(s,k),y.onabort=()=>E(i,g||T(y.error?M(y.error):"aborted",y.error));try{let l=y.objectStore(P),v=n.bound(t+":op:",t+":op:\uFFFF"),O={record:l.get(t),meta:l.get(t+":meta"),v1base:l.get(t+":v1base"),names:l.getAllKeys(v),values:l.getAll(v)};O.values.onsuccess=()=>{if(!D)try{let R={record:O.record.result??null,meta:O.meta.result??null,v1base:O.v1base.result??null,rows:O.names.result.map((N,F)=>[N,O.values.result[F]])},x=d(R);for(let[N,F]of x.puts)l.put(F,N);for(let N of x.deletes)l.delete(N);k=x.result}catch(R){g=T(M(R),R);try{y.abort()}catch{}}}}catch(l){g=T(M(l),l);try{y.abort()}catch{}}})}function S(t,d){return new Promise((h,s)=>{if(!/:op:[^:]+$/.test(t))return s(T("bad-op"));let i;try{i=w(P,"readwrite"),i.objectStore(P).put(d,t),i.commit?.()}catch(y){return s(y instanceof Error&&y.code?y:T(M(y),y))}i.oncomplete=()=>h(),i.onabort=()=>s(T(i.error?M(i.error):"aborted",i.error))})}function u(){p=!0;try{e.close()}catch{}}return{readAll:b,readParts:f,change:o,putRow:S,close:u}}var _=e=>e===void 0?void 0:JSON.parse(JSON.stringify(e)),K=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Ae=e=>e+":meta",se=(e,n)=>`${e}:op:${n}`,le=(e,n)=>n===void 0?e+":conflict":`${e}:conflict:${n}`,Z=(e,n)=>`${e}:recovery:${n}`,H=e=>K(e)&&e.v===1&&e.w===void 0&&K(e.data),J=e=>typeof e.id=="string"?e.id:"at:"+e.savedAt,he=(e,n)=>`${e}~${n}`;function Q(e){let n=/^(\d+)~/.exec(e??"");return n?Number(n[1]):null}function Ie(e,n,p){let w={...e},b={...e};for(let[f,o]of Object.entries(n))"b"in o?w[f]=o.b:delete w[f],"m"in o?b[f]=o.m:delete b[f];return p(w,b,e)}var oe=e=>K(e)&&typeof e.tab=="string"&&typeof e.reset=="string"&&Array.isArray(e.ops),$=e=>oe(e)?`op:${e.tab}:${e.ops.at(-1)?.seq??e.acked??0}`:J(e);function ie(e,n){if(K(e)&&n.recovery?.includes($(e)))return!0;if(!oe(e))return!1;let p=Math.max(e.acked??0,e.reset===n.reset?n.tabs[e.tab]?.seq??0:0);return e.ops.every(w=>w.seq<=p)}function ae(e=null){return{gen:Q(e)??1,rev:0,reset:e??"",tabs:{},foreign:null,unit:null}}var q=e=>e&&e.blockeditor?{live:e.live,blockeditor:e.blockeditor}:null;function pe(e,n,p){let w=[...e,n?.id,...n?.ancestry??[]].filter(b=>typeof b=="string");return w.length?w.slice(0,32):["root:"+p.reset]}function ke(e,{record:n,seen:p,direct:w,v1base:b,meta:f}){let o=K(p)&&p.v===1&&K(p.data)&&p.w?.reset===f.reset?p:null,S=t=>t&&typeof t.id=="string"?e.indexOf(t.id):-1,u=[[n,S(n)],[o,o&&w?0:S(o)],[b,S(b)]].filter(([,t])=>t>=0);return u.length?u.reduce((t,d)=>d[1]<t[1]?d:t)[0]:null}function Te(e,{seed:n,newId:p,now:w,merge3:b,unitMark:f,marker:o=null,resets:S=[],chains:u=[],local:t=null,seen:d=null,direct:h=!1}){let s=e.meta?_(e.meta):ae(o);!e.meta&&Number.isInteger(t?.w?.rev)&&(s.rev=t.w.rev);let i=e.record?_(e.record):null,y=e.v1base?_(e.v1base):null,g={conflicts:[],recovered:[],released:[],dropped:[],stale:[],applied:{},changed:!e.meta};function k(c,E=[]){let l=$(c);if(s.recovery?.includes(l))return;g.recovered.push(_(c));let v=[l,...(s.recovery??[]).filter(O=>O!==l&&!E.includes(O))].slice(0,8);return g.dropped=[...new Set([...g.dropped,...s.recovery??[]])].filter(O=>!v.includes(O)),s.recovery=v,g.changed=!0,!0}let D=[...S];o&&o!==s.reset&&D.push({ends:Q(o)===null?null:Q(o)-1,marker:o});for(let c of D){if(c.marker===s.reset||s.ended?.includes(c.marker)||c.ends!==null&&c.ends<s.gen)continue;c.ends!==s.gen&&i&&k(i);let E=typeof t?.reset=="string"?t.reset===c.marker:c.ends===null||Array.isArray(t?.ancestry)&&t.ancestry.includes("root:"+c.marker);H(t)&&J(t)!==s.foreign&&!E&&(k(t),s.foreign=J(t)),s.ended=[...s.ended??[],s.reset].slice(-32),Object.assign(s,{gen:s.gen+1,reset:c.marker,tabs:{},unit:null}),s.rev++,i=null,y=null,g.changed=!0}if(!e.meta&&!i&&K(t)&&t.v===1&&K(t.data)&&(t.w===void 0||t.w.reset===s.reset)){let{w:c,...E}=t;i=_(E),c===void 0&&(y=_(E),s.foreign=J(t),s.rev++)}if(e.meta||(s.unit=f(q(i))),e.meta&&H(t)&&J(t)!==s.foreign){let c=J(t),E=Array.isArray(t.ancestry)?t.ancestry:[],l=i?ke(E,{record:i,seen:d,direct:h,v1base:y,meta:s}):null;if(typeof t.reset=="string"&&s.ended?.includes(t.reset))k(t,E)&&g.released.push(_(t));else if(!i)i=_(t),y=_(t),s.unit=f(q(i)),s.rev++;else if(l){let v=b(l.data,t.data,i.data),O=q(t),R=!!O&&f(O)!==f(q(l)),x=R&&q(i)&&f(q(l))!==s.unit;(v.conflict||x)&&g.conflicts.push(_(i));let N=R?O:q(i);i={v:1,savedAt:t.savedAt??new Date(w).toISOString(),id:p(),ancestry:pe(typeof t.id=="string"?[t.id]:[],i,s),data:v.value,...N&&{live:N.live,blockeditor:N.blockeditor}},R&&(s.unit=f(N)),y=_(t),s.rev++}else k(t,E)&&g.released.push(_(t));s.foreign=c,g.changed=!0}for(let c of u){if(!oe(c))continue;if(c.reset!==s.reset){let v=c.reset===e.meta?.reset?e.meta.tabs[c.tab]?.seq??0:0;c.ops.some(O=>O.seq>Math.max(v,c.acked??0))&&k(c),g.stale.includes(c.tab)||g.stale.push(c.tab);continue}let E=s.tabs[c.tab]?.seq??0,l=Math.max(E,Number.isInteger(c.acked)?c.acked:0);for(let v of c.ops){if(v.seq<=l)continue;if(v.seq!==l+1)break;let O=Ie(i?i.data:n,v.keys??{},b),R=v.unit!==void 0&&i&&q(i)&&v.unit.seen!==s.unit;i&&(O.conflict||R)&&g.conflicts.push(_(i));let x=v.unit!==void 0?v.unit.to:q(i),N=p();i={v:1,savedAt:v.savedAt??new Date(w).toISOString(),id:N,ancestry:pe([],i,s),data:O.value,...x&&{live:x.live,blockeditor:x.blockeditor}},v.unit!==void 0&&(s.unit=f(x)),s.rev++,l=v.seq,g.changed=!0}(l!==E||s.tabs[c.tab])&&(s.tabs[c.tab]={seq:l,at:w},g.changed=!0),g.applied[c.tab]=l}for(let[c,E]of Object.entries(s.tabs))w-(E.at??0)>2592e6&&(delete s.tabs[c],g.changed=!0);return{meta:s,record:i,v1base:y,...g}}var X=e=>{if(e==null)return null;try{return JSON.parse(e)}catch{return null}};function me(e,n,p,w){return e.change(n,b=>{let f={meta:X(b.meta),record:X(b.record),v1base:X(b.v1base)},o=b.rows.map(([h,s])=>[h,X(s)]),S=p(f),u=Te(f,{...S,chains:[...o.map(([,h])=>h),...S.chains??[]]}),t=[],d=[];u.changed&&(t.push([Ae(n),JSON.stringify(u.meta)]),u.record?t.push([n,JSON.stringify(u.record)]):f.record&&d.push(n),u.v1base?t.push([n+":v1base",JSON.stringify(u.v1base)]):f.v1base&&d.push(n+":v1base"));for(let h of u.conflicts)t.push([le(n,J(h)),JSON.stringify(h)]);u.conflicts.length&&t.push([le(n),JSON.stringify(u.conflicts[u.conflicts.length-1])]);for(let h of u.recovered)t.push([Z(n,$(h)),JSON.stringify(h)]);for(let h of u.dropped)d.push(Z(n,h));for(let[h,s]of o)ie(s,u.meta)&&d.push(h);return{puts:t,deletes:d,result:u}},w)}var xe=256*1024,Ne=2*1024,_e=new Set(["v","savedAt","id","ancestry","reset","data"]),Re=10*1e3,Me=1500,ge=2e3,De="This draft was started over in another tab.",qe="This draft was started over in another tab. The earlier draft was kept aside in this browser.",Je="A tab that was open before an update saved another copy of this draft. That copy was kept aside, and this draft was not changed. Reload that tab to go on from this draft.",B=e=>{if(e==null)return null;try{return JSON.parse(e)}catch{return null}};function Pe(e,n){let p={},w=Object.keys(e).every(b=>_e.has(b));for(let[b,f]of Object.entries(e.data))JSON.stringify(f).length<Ne?p[b]=f:w=!1;return JSON.stringify({v:2,savedAt:e.savedAt,id:e.id,ancestry:e.ancestry,idb:!0,...w&&{full:!0},data:p,w:n})}async function je({store:e,storage:n,doc:p=document,now:w=()=>Date.now(),reload:b=()=>window.location.reload()}){let f=await de(),{key:o}=e,S=o+":reset",u=r=>{try{return n?.getItem(r)??null}catch{return null}},t=r=>{try{n?.removeItem(r)}catch{}},d=o+":started-over",h=o+":recovery-notice";try{window.sessionStorage.getItem(d)&&(window.sessionStorage.removeItem(d),window.sessionStorage.getItem(h)||import("./c-NVU3DORS.js").then(r=>r.toastPersistent(De,"info")).catch(()=>{}))}catch{}let s=null,i="",y=null,g=null,k=null,D=0,c=!1,E=e.held()?.id,l=null,v=null,O=new Set;try{let r=window.sessionStorage.getItem(h);if(r){window.sessionStorage.removeItem(h);let a=B(r);ce({id:a?.mark??r},!!a?.reset)}}catch{}function R(r){try{window.sessionStorage.setItem(h,JSON.stringify({mark:r,reset:!0}))}catch{}}function x(r){try{window.sessionStorage.setItem(o+":generation",JSON.stringify({marker:i,reset:r}))}catch{}}function N(){let r=u(S);i=r??"";let a=e.journalSlots().filter(I=>I!==e.slotKey).map(I=>B(u(I)));k=e.stopped()?null:g,D=e.chain().ops.at(-1)?.seq??0;let m=e.held();m?.v===1&&m.w!==void 0&&(l=m);let A=k?[k]:[];return{seed:e.seed(),newId:e.newId,merge3:e.merge3,unitMark:e.unitMark,now:w(),marker:r,resets:A,local:m,seen:l,direct:v!==null&&u(o)===v,chains:e.pending()?[...a,e.chain()]:a}}function F(r){let a=w();for(let m of e.journalSlots()){if(m===e.slotKey)continue;let A=B(u(m));ie(A,r)&&a-(A?.at??0)>Re&&t(m)}}function ee({meta:r,record:a}){let m=e.held();if(H(m)&&J(m)!==r.foreign)return void setTimeout(G,0);if((u(S)??"")!==r.reset)return;if(!a)return void(m&&t(o));if(m?.w&&m.w.reset===r.reset&&m.w.rev>=r.rev)return;let A={rev:r.rev,reset:r.reset},I=JSON.stringify({...a,w:A});try{if(I.length<=xe){n.setItem(o,I),l={...a,w:A};return}}catch{}try{n.setItem(o,Pe(a,A))}catch{}}async function te(r){c=!0;let a=e.chain(),m=$(a),A=a.ops.some(C=>C.seq>D)||r.meta.recovery?.includes(m)?m:r.meta.recovery?.includes(E)?E:null;if(e.acknowledge(D),e.stop({keepPending:!0}),e.unsafe()){try{await f.putRow(se(o,e.tab),JSON.stringify(e.chain()))}catch(C){throw e.failed(C)}e.acknowledge(e.chain().ops.at(-1)?.seq??0)}ee(r),A&&R(A);let I=e.held();I?.w&&I.w.reset!==r.meta.reset&&t(o);try{window.sessionStorage.setItem(d,"1")}catch{}return x(r.meta.reset),c=!1,b(),r}async function we(){let r=e.generation(),a=()=>{e.stop(),z(!1)},m=()=>(u(S)??"")!==r&&(y===null||(u(S)??"")!==i);if(m())return a();let A=y??Q(r);if(A===null){let L=await re.catch(()=>f.change(o,({meta:U})=>({puts:[],deletes:[],result:{meta:B(U)??ae(r)}}),{timeout:ge}));if(m())return a();if(A=L.meta.gen,L.meta.reset!==r){g={ends:null,marker:r};let U=await W();if(e.stopped())return a();A=U.meta.gen}}let I=he(A+1,e.newId());g={ends:A,marker:I};let C=u(o);e.held()?.w&&t(o);try{n.setItem(S,I)}catch{}let fe;try{let L=W();u(S)!==I?await L:await Promise.race([L.catch(()=>{}),new Promise(U=>{fe=setTimeout(U,Me)})]),a()}catch(L){if(g=null,C!==null&&u(o)===null&&(u(S)??"")===r)try{n.setItem(o,C)}catch{}throw L}finally{clearTimeout(fe)}}function ce(r,a=!1){console.warn(a?"visitor-drafts: the draft was started over; the earlier draft was kept in this browser's draft database under":"visitor-drafts: a tab on an earlier ClayJS saved a copy that could not be merged exactly; it was kept in this browser's draft database under",Z(o,$(r))),!O.has(a)&&(O.add(a),import("./c-NVU3DORS.js").then(m=>m.toastPersistent(a?qe:Je,"warning")).catch(()=>{}))}function be(r){let{meta:a,record:m}=r;if(i!==a.reset&&(u(S)??"")===i)try{n.setItem(S,a.reset)}catch{}if(k&&k===g&&a.reset!==e.generation()&&(k.marker===a.reset&&x(a.reset),e.stop(),z(!1)),k===g&&(g=null),e.stopped())return c?te(r):(ee(r),r);if(r.conflicts.length&&console.warn("visitor-drafts: another tab changed the same thing; its copy was kept in this browser's draft database under",o+":conflict"),r.stale.includes(e.tab))return te(r);if(a.reset!==e.generation()){if(!e.fresh())return te(r);e.enter(a.reset)}r.released.length&&ce(r.released[0]),y=a.gen,x(a.reset);let A=e.acknowledge(a.tabs[e.tab]?.seq??0);if(F(a),ee(r),e.pending())return r;if(A&&(z(!1),p.dispatchEvent(new CustomEvent("clay:drafts-saved",{detail:{data:m.data}}))),!e.shown())return s=a.rev,r;e.changed()||(m&&a.rev!==s&&e.take(m.data),E=m?.id,s=a.rev);let I=e.externalUnit(m);return I&&p.dispatchEvent(new CustomEvent("clay:drafts-blockeditor-external",{detail:{live:I.live,adopted:()=>e.adoptedUnit(I)}})),r}let V=null,j=null;function ne(r){return V=me(f,o,N,r).then(be,a=>{throw e.pending()?e.failed(a):a}).finally(()=>{V=null}),V}function W(){return j||(V?(j=V.then(()=>{},()=>{}).then(()=>(j=null,ne())),j):ne())}let G=()=>{W().catch(()=>{})};function ye(){e.unsafe()&&f.putRow(se(o,e.tab),JSON.stringify(e.chain())).catch(()=>{}),e.pending()&&G()}window.addEventListener("storage",r=>{if(r.key===o){let[a,m]=[B(r.oldValue),B(r.newValue)];m?.v===1&&m.w!==void 0?l=m:H(m)&&a?.v===1&&a.w!==void 0&&([l,v]=[a,r.newValue])}(r.key===null||r.key===o||r.key===S)&&G()}),window.addEventListener("pageshow",r=>{r.persisted&&G()}),p.addEventListener("clay:drafts-blockeditor-listening",G);let re=ne({timeout:ge});return re.catch(()=>{}),{first:re,sync:W,hide:ye,startOver:we}}export{xe as FULL_COPY_LIMIT,je as openSession};
|
package/dist/m/c-EODTTNVA.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"./c-ESK4S67I.js";import"./c-MR75YPRT.js";import"./c-4JZDZFF6.js";import"./c-5RZNFTWD.js";import"./c-PKCCHJ5X.js";import"./c-NUHP2XDB.js";import"./c-VHNSBD2M.js";export{c as bevelDialog,a as dismissOf,b as keepFocusIn};
|
package/dist/m/c-ESK4S67I.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as L,b as T,c as w,d as A,f as C,j as v,k as M,l as P,n as S}from"./c-MR75YPRT.js";import{b as N,e as b,f as O,g as f}from"./c-5RZNFTWD.js";import{a as D}from"./c-PKCCHJ5X.js";import{a as I,b as c}from"./c-NUHP2XDB.js";var q=new WeakMap,W='a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [contenteditable], [tabindex]:not([tabindex^="-"])';function G(u,a){let t=[...u.querySelectorAll(W)].filter(i=>i.offsetParent!==null);if(!t.length)return;let s=t.indexOf(document.activeElement);s===-1?(t[0].focus(),a.preventDefault()):a.shiftKey&&s===0?(t[t.length-1].focus(),a.preventDefault()):!a.shiftKey&&s===t.length-1&&(t[0].focus(),a.preventDefault())}var B=`1px solid ${b["line-2"]}`;function K(u,a,t=null,s=[],i=[]){let x=f.dialogCloseHover[0].slice(11),g=["position:absolute","top:-1px","right:-1px","z-index:2","display:grid","place-items:center",a?"height:calc(100% + 1px)":"height:62px","margin:0","padding:0","border:0",...f.dialogClose,...a?[]:[`border-bottom:${B}`],"cursor:pointer","outline:none"],e=v("button",g);if(e.type="button",e.setAttribute("aria-label",u),e.title=u,e.innerHTML=O.dialogClose,!L(t))return C(e.firstElementChild,16),e.addEventListener("pointerenter",()=>c(e,"background",x)),e.addEventListener("pointerleave",()=>c(e,"background",b.face)),e.addEventListener("focus",()=>{c(e,"outline",`2px solid ${b.brass}`),c(e,"outline-offset","-4px")}),e.addEventListener("blur",()=>c(e,"outline","none")),e;let n=["close",...s],r=["icon",...i];A(e,t,n),A(e.firstElementChild,t,r);let o={hover:!1,focus:!1,pressed:!1},l=()=>{let d={hover:o.hover,active:o.pressed,focus:o.focus},h=e.firstElementChild;h.style.cssText="",C(h,16),I(h,w(t,r,d)),M(e,[...g,...o.hover?[`background:${x}`]:[],...o.focus?[`outline:2px solid ${b.brass}`,"outline-offset:-4px"]:[],...T(t,"close",d),...w(t,n,d)])};return e.addEventListener("pointerenter",()=>{o.hover=!0,l()}),e.addEventListener("pointerleave",()=>{o.hover=!1,o.pressed=!1,l()}),e.addEventListener("pointerdown",d=>{d.button!==void 0&&d.button!==0||(o.pressed=!0,l())}),e.addEventListener("pointerup",()=>{o.pressed=!1,l()}),e.addEventListener("focus",()=>{o.focus=!0,l()}),e.addEventListener("blur",()=>{o.focus=!1,o.pressed=!1,l()}),l(),e}function Y({zIndex:u="100",width:a="600px",closable:t=!1,titled:s=!1,theme:i=null,surface:x="modal"}={}){let g=L(i),e=g?i.tokens:{},n=e.spacing,r=k=>x==="modal"?[`dialog.${k}`]:[`dialog.${k}`,`${x}.${k}`],o=v("div",["display:block"],{theme:i,parts:r("root")});o.setAttribute("data-clay-modal",""),g&&o.setAttribute("data-clay-ui",x),o.setAttribute("aria-hidden","true");let l=g&&i.scheme!=="light dark",d=Math.min(parseFloat(a)||600,innerWidth-32),h={x:(innerWidth-d)/2,y:Math.min(96,innerHeight*.1),width:d,height:160};c(o,"color-scheme",l?i.scheme:D(h).scheme);let m=v("div",["position:fixed","inset:0",`z-index:${u}`,"overflow:auto","display:flex","align-items:flex-start","justify-content:center","padding:min(96px, 10vh) 16px 16px",`background:color-mix(in srgb, ${b.ground} 72%, transparent)`],{theme:i,parts:r("overlay"),role:"overlay"});m.tabIndex=-1;let p=P("form",["position:relative","display:flex","flex-direction:column","margin:0",`width:min(${a}, 100%)`,"max-height:calc(100dvh - min(96px, 10vh) - 16px)",...f.dialogPanel],{theme:i,parts:r("panel")});p.setAttribute("role","dialog"),p.setAttribute("aria-modal","true");let $=null,y=null;s&&($=v("div",["position:relative","display:block","flex:none",`padding:20px ${t?"68px":"22px"} 16px 22px`,...f.dialogHeader,...e.border?[`border-bottom-color:${e.border}`]:[],...n?[`padding:${n} ${t?`calc(${n} + 46px)`:n} calc(${n} * .7) ${n}`]:[]],{theme:i,parts:r("header")}),y=S("div",["display:block",...f.dialogHeading,"overflow-wrap:anywhere"],void 0,{theme:i,parts:r("title"),role:"heading"}),y.setAttribute("role","heading"),y.setAttribute("aria-level","2"),$.append(y),p.append($));let F=S("div",["display:block","flex:1 1 auto","min-height:0","overflow-y:auto","overflow-x:hidden",`padding:20px ${t&&!s?"84px":"22px"} 20px 22px`,"overflow-wrap:anywhere",`font:14.5px/1.55 ${N}`,...n?[`padding:${n} ${t&&!s?`calc(${n} + 62px)`:n} ${n} ${n}`]:[]],void 0,{theme:i,parts:r("body")}),H=v("div",["display:flex","flex:none","flex-wrap:wrap","justify-content:flex-end","align-items:center",...f.dialogFooter,...e.border?[`border-top-color:${e.border}`]:[],...n?[`padding:calc(${n} * .65) ${n}`,`gap:calc(${n} / 2)`]:[]],{theme:i,parts:[...r("footer"),...r("actions")]});p.append(F,H);let E=t?K("Close",s,i,r("close"),r("closeIcon")):null;return E&&($||p).append(E),m.append(p),o.append(m),{root:o,overlay:m,panel:p,header:$,heading:y,body:F,footer:H,close:E,theme:i}}export{q as a,G as b,Y as c};
|
package/dist/m/c-FDWR3FL7.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as y,j as L,l as $,n as B,q as m}from"./c-MR75YPRT.js";import{a as _}from"./c-4JZDZFF6.js";import{b as R,c as T,d as N,e as S}from"./c-5RZNFTWD.js";import{b as F}from"./c-PKCCHJ5X.js";import{b}from"./c-NUHP2XDB.js";import{h as P}from"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var D="p,h1,h2,h3,h4,h5,h6,li,dt,dd,blockquote,pre,figcaption,td,th",K="section,article,aside,header,footer,nav,main,div,ul,ol,dl,table,figure,form",v=4,C=()=>typeof matchMedia=="function"&&!!matchMedia("(pointer: coarse)").matches;function w(l,d,f){return l.setAttribute(d,f),l}function H(l=document){let d=n=>n instanceof l.defaultView.Element&&n!==l.body&&n!==l.documentElement&&!n.closest("[data-clay-ai-edit]")&&!n.closest(P),f=n=>{if(!n||!d(n))return null;let r=n.closest(D)||n.closest(K);return r&&r!==l.body?r:null};return{targetAt(n,r){let a=typeof l.elementsFromPoint=="function"?l.elementsFromPoint(n,r):[];for(let s of a||[]){let t=f(s);if(t)return t}return null},between(n,r){if(!n)return r||null;if(!r||n===r)return n;let a=n.compareDocumentPosition(r)&4?n:r,s=a===n?r:n,t=a;for(;t&&!t.contains(s);)t=t.parentElement;return t?t===l.body||t.matches(D)||t.matches(K)?t:f(t)||t:null},rectOf(n){return n.getBoundingClientRect()}}}function U({coarse:l}){let d=`color-scheme:${_()}`,f=(u,i)=>w(u,"data-clay-ai-edit-part",i),n=w(L("div",["position:fixed","inset:0","z-index:99997","background:transparent","touch-action:pan-y","cursor:crosshair",d]),"data-clay-ai-edit","picker"),r=w(L("div",["box-sizing:content-box","position:fixed","z-index:99998","pointer-events:none",`border:2px solid ${S.brass}`,"border-radius:0",d]),"data-clay-ai-edit","picker-ring");m(r,!1);let a=w($("div",["position:fixed","left:50%","bottom:16px","transform:translateX(-50%)","z-index:99999","width:min(35rem, calc(100vw - 32px))","padding:8px 10px","border-radius:12px","gap:8px","align-items:center",`box-shadow:${N}`,`font:13px/1.5 ${R}`,d]),"data-clay-ai-edit","picker-bar");m(a,!1,"flex");let s=f(B("div",["display:block","flex:1","min-width:0","overflow:hidden","text-overflow:ellipsis","white-space:nowrap",`color:${S.muted}`,`font:12.5px/1.5 ${T}`]),"picker-hint");s.textContent="Click or drag blocks";let t=f(y("Whole page",{extra:["flex:none"]}),"picker-whole"),h=f(y("Cancel",{variant:"quiet",extra:["flex:none"]}),"picker-cancel"),c=l?f(y("Continue",{variant:"primary",extra:["flex:none"]}),"picker-continue"):null;c&&m(c,!1,"inline-flex"),a.append(s,t,...c?[c]:[],h),document.body.append(n,r,a);for(let u of[n,r,a])F(u);return{overlay:n,ring:r,bar:a,hint:s,whole:t,more:c,cancel:h}}function ee({surface:l,onPicked:d,onWholePage:f,onCancel:n,build:r}={}){let a=document,s=l||H(a),t=null,h=null,c=!1,u=null,i=null,M=e=>e&&(typeof s.rectOf=="function"?s.rectOf(e):e.getBoundingClientRect())||null,k=e=>s.targetAt(e.clientX,e.clientY)||null;function E(e){if(!t)return;let o=M(e);if(!o){m(t.ring,!1);return}b(t.ring,"left",o.left-5+"px"),b(t.ring,"top",o.top-5+"px"),b(t.ring,"width",o.width+6+"px"),b(t.ring,"height",o.height+6+"px"),m(t.ring,!0)}function X(e,o){if(!e)return;let p=u&&(o||C())&&s.between(u,e)||e;u=p,E(p),t.more&&m(t.more,!0,"inline-flex"),!C()&&d?.(p)}function z(e){!c||e.button>0||(e.preventDefault(),i={x:e.clientX,y:e.clientY,from:k(e),moved:!1,shift:!!e.shiftKey})}function Y(e){if(!c)return;let o=k(e);if(i){let p=e.clientX-i.x,x=e.clientY-i.y;if(!i.moved&&p*p+x*x>v*v&&(i.moved=!0),i.moved){E(i.from&&o?s.between(i.from,o)||o:o||i.from);return}}E(o)}function q(e){if(!c||!i)return;let o=i;i=null;let p=e.clientX-o.x,x=e.clientY-o.y,G=o.moved||p*p+x*x>v*v,g=k(e),A=G&&o.from&&g?s.between(o.from,g)||g:g||o.from;A&&X(A,!!(o.shift||e.shiftKey))}function I(e){!c||e.key!=="Escape"||(O(),n?.())}function V(){if(c)return;c=!0,u=null,i=null,t=(r||U)({coarse:C()}),h=new AbortController;let{signal:e}=h,{overlay:o}=t;o.addEventListener("pointerdown",z,{signal:e}),o.addEventListener("pointermove",Y,{signal:e}),o.addEventListener("pointerup",q,{signal:e}),o.addEventListener("pointercancel",()=>{i=null},{signal:e}),t.whole.addEventListener("click",()=>{c&&f?.()},{signal:e}),t.more?.addEventListener("click",()=>{c&&u&&d?.(u)},{signal:e}),t.cancel.addEventListener("click",()=>{O(),n?.()},{signal:e}),a.addEventListener("keydown",I,{signal:e}),m(t.bar,!0,"flex"),t.whole.focus({preventScroll:!0})}function O(){if(!(!c&&!t)){if(c=!1,u=null,i=null,h?.abort(),h=null,t)for(let e of[t.overlay,t.ring,t.bar])e.remove();t=null}}function W(e){return!t||!e?!1:t.overlay.contains(e)||t.bar.contains(e)}return{open:V,close:O,contains:W,get picking(){return c}}}export{ee as createPicker,H as genericSurface};
|
package/dist/m/c-FYDKYW6E.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e}from"./c-IUL7PU4P.js";import"./c-UOUUI265.js";import"./c-QHWJ5ZIJ.js";import"./c-SXNSSHPP.js";import"./c-UL2YUY52.js";import"./c-QY7F6EN6.js";import"./c-ESK4S67I.js";import"./c-MR75YPRT.js";import"./c-4JZDZFF6.js";import"./c-5RZNFTWD.js";import"./c-PKCCHJ5X.js";import"./c-46XYM55L.js";import"./c-NUHP2XDB.js";import"./c-VKEDWYDF.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";export{a as ask,b as consent,e as init,d as snippet,c as tell};
|
package/dist/m/c-HKSLOVU4.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Ze=Object.defineProperty,Ge=(e,t)=>{for(var r in t)Ze(e,r,{get:t[r],enumerable:!0})},Oe=["textContent","innerText","innerHTML","outerHTML","value","checked","selected","disabled","readOnly","type","tagName","nodeName","nodeType","nodeValue","childElementCount","id","className","classList","baseURI","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","dataset","currentSrc","duration","paused","title","documentURI","contentType"],Qe=new Set(Oe),Ye=new Set(["textContent","innerText","innerHTML","value","checked","selected","disabled","readOnly","type","id","className","title"]),Ne=new Set(["tagName","nodeName","nodeType","nodeValue","childElementCount","classList","baseURI","documentURI","contentType","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","currentSrc","duration","paused","dataset"]),ue=new Set(["checked","selected","disabled","readOnly","paused"]);function et(e,t){return t==null?ue.has(e)?!1:"":ue.has(e)?t==="false"?!1:!!t:t}var O={};Ge(O,{CodecRefused:()=>ot,EmptyListInsert:()=>M,MAX_RULE_DEPTH:()=>W,MaxRuleDepthExceeded:()=>Z,NoRulesTag:()=>nt,RuleTargetReadOnly:()=>Re,RulesParseError:()=>R,ShapeMismatch:()=>Se,UnknownCodec:()=>ke,UnknownRulesVersion:()=>$e,WriteNotRoundTripped:()=>rt,WriteRefused:()=>Ce,WriteRejected:()=>lt});var R=class extends Error{constructor(e,t){super(e),this.name="RulesParseError",this.cause=t}},$e=class extends Error{constructor(e){super(`unknown rules version: ${e}. Library supports "1" and "2".`),this.name="UnknownRulesVersion",this.version=e}},W=20,Z=class extends Error{constructor(e){super(`rule depth exceeded ${W} at path: ${e.join(".")}`),this.name="MaxRuleDepthExceeded",this.path=e}},Se=class extends Error{constructor(e){super(`shape mismatch: ${e.length} field(s) failed validation`),this.name="ShapeMismatch",this.mismatches=e}},M=class extends Error{constructor(e,t){super(t?`cannot add items to empty list at "${e.join(".")}" \u2014 ${t}`:`cannot add items to empty list at "${e.join(".")}" \u2014 no sibling to clone as template. Seed the list with a hidden item first.`),this.name="EmptyListInsert",this.path=e}},Re=class extends Error{constructor(e){super(`cannot write to read-only DOM property "${e}"`),this.name="RuleTargetReadOnly",this.target=e}},Ce=class extends Error{constructor(e){super(`write refused: ${e.length} write(s) broke the content-only policy`),this.name="WriteRefused",this.refusals=e}};function tt(e){return e.reduce((t,r)=>typeof r=="number"?`${t}[${r}]`:t?`${t}.${r}`:String(r),"")||"(root)"}var rt=class extends Error{constructor(e){super(`write did not round-trip at "${tt(e)}"`),this.name="WriteNotRoundTripped",this.path=e}},nt=class extends Error{constructor(e){super(`no <script data-rules-name~="${e}"> rules tag in this document`),this.name="NoRulesTag",this.token=e}},lt=class extends Error{constructor(e,t){super(`write rejected: ${e.length} unknown key(s), ${t.length} rule(s) with no matching element`),this.name="WriteRejected",this.unknownKeys=e,this.unmatched=t}},ke=class extends Error{constructor(e){super(`unknown codec "${e}": no codec by that name is given to this call`),this.name="UnknownCodec",this.code="unknown-codec",this.codec=e}},ot=class extends Error{constructor(e,t){super(t),this.name="CodecRefused",this.code=e}};function C(e){let t=0,r=null,l=-1;for(let n=0;n<e.length;n++){let o=e[n];o==="\\"?n++:r?o===r&&(r=null):o==='"'||o==="'"?r=o:o==="["||o==="("?t++:o==="]"||o===")"?t>0&&t--:o==="@"&&t===0&&(l=n)}return l}var ae="[*]";function $(e){let t=C(e),r=t===-1?e:e.slice(0,t),l=r.endsWith(ae),n={selector:l?r.slice(0,-ae.length):r,prop:t===-1?null:e.slice(t+1)||null};return l&&(n.all=!0),n}function je(e){let t=0,r=null,l=-1,n=!1;for(let o=0;o<e.length;o++){let a=e[o];a==="\\"?o++:r?a===r&&(r=null):a==='"'||a==="'"?r=a:a==="["||a==="("?t++:a==="]"||a===")"?t>0&&t--:t===0&&a===">"?l=o:t===0&&a===","&&(n=!0)}return n||l===-1||!it(e,l+1)?null:e.slice(0,l).trim()||null}function it(e,t){let r=t,l=e.replace(/\s+$/,"").length;for(;r<l&&/\s/.test(e[r]);)r++;let n=0,o=null;for(;r<l;r++){let a=e[r];if(a==="\\")r++;else if(o)a===o&&(o=null);else if(a==='"'||a==="'")o=a;else if(a==="["||a==="(")n++;else if(a==="]"||a===")")n>0&&n--;else if(n===0&&(a==="+"||a==="~"||/\s/.test(a)))return!1}return!0}var ut=/^codec\(([a-z][a-z0-9-]*)\)$/;function G(e){if(typeof e!="string")return null;let t=C(e);if(t===-1)return null;let r=ut.exec(e.slice(t+1));if(!r)return null;let{selector:l,all:n}=$(e);if(n)throw new R("A @codec(name) rule cannot use [*].");return{selector:l,name:r[1]}}var at=/^--[A-Za-z0-9_-]+$/;function Q(e){return typeof e=="string"&&at.test(e)}function Le(e){let t=[],r=[],l=null,n=0;for(let o=0;o<e.length;o++){let a=e[o];if(l){a==="\\"?o++:a===l&&(l=null);continue}if(a==="/"&&e[o+1]==="*"){let i=e.indexOf("*/",o+2);o=i===-1?e.length:i+1;continue}a==='"'||a==="'"?l=a:a==="("?r.push(")"):a==="["?r.push("]"):a==="{"?r.push("}"):(a===")"||a==="]"||a==="}")&&r[r.length-1]===a?r.pop():a===";"&&r.length===0&&(t.push(e.slice(n,o)),n=o+1)}return t.push(e.slice(n)),t}function st(e){let t="",r=null;for(let l=0;l<e.length;l++){let n=e[l];if(r){t+=n,n==="\\"&&l+1<e.length?t+=e[++l]:n===r&&(r=null);continue}if(n==="/"&&e[l+1]==="*"){let o=e.indexOf("*/",l+2);l=o===-1?e.length:o+1,t+=" ";continue}(n==='"'||n==="'")&&(r=n),t+=n}return t}function Me(e){e=st(e);let t=e.indexOf(":");if(t===-1)return null;let r=e.slice(0,t).trim(),l=e.slice(t+1).trim(),n=/!\s*important\s*$/i.exec(l);return n&&(l=l.slice(0,n.index).trim()),{name:r,value:l,important:!!n}}function Y(e,t){if(e==null)return null;let r=null;for(let l of Le(String(e))){let n=Me(l);!n||n.name!==t||(!r||n.important||!r.important)&&(r=n)}return r?r.value:null}function ct(e,t,r){let l=e==null?"":String(e),n=r==null||r==="",o=Le(l),a=o.map(Me),i=a.some(d=>d&&d.name===t&&d.important),u=[],s=!1;o.forEach((d,p)=>{let v=a[p];if(!v||v.name!==t){u.push(d);return}if(n||s)return;let f=/^\s*/.exec(d)[0];u.push(`${f}${t}: ${r}${i?" !important":""}`),s=!0});let c=u.join(";");if(!n&&!s){let d=c.trimEnd();c=d===""?`${t}: ${r}`:`${d}${d.endsWith(";")?" ":"; "}${t}: ${r}`}return c.trim()===""?null:c}function Ie(e,t,r,l){let n=e.attr(t,"style");if((Y(n,r)??"")===l)return;let o=ct(n,r,l);o==null?e.removeAttr(t,"style"):e.attr(t,"style",o)}var se=/^[a-z][a-z0-9-]*$/,ee=new Map;function ft(e,t){if(typeof e!="string"||!se.test(e))throw new Error(`hyper-html-api: invalid codec name ${JSON.stringify(e)} (must match ${se})`);if(!t||typeof t.read!="function"||typeof t.write!="function"||typeof t.same!="function")throw new Error(`hyper-html-api: codec "${e}" needs read, write and same functions`);ee.set(e,t)}function dt(e){return ee.get(e)??null}function pt(){return Object.fromEntries(ee)}var ht='The @codec(name) rule form needs a rules tag with data-rules-version="2".',mt="A @codec(name) rule must be the value of a top level key.";function We(e,t){let r=G(e);return r?{...r,codec:t.codecs[r.name]}:null}function te(e,t={}){let r=t.version??"1",l=t.codecs??{};n(e,0);function n(o,a){if(!(a>W)){if(typeof o=="string"){let i=G(o);if(!i)return;if(r!=="2")throw new R(ht);if(a!==1)throw new R(mt);if(!Object.prototype.hasOwnProperty.call(l,i.name))throw new ke(i.name);return}if(Array.isArray(o)){n(o[1],a+1);return}if(o&&typeof o=="object")for(let i of Object.values(o))n(i,a+1)}}}function q(e,t,r,l={}){if(Object.prototype.hasOwnProperty.call(l,"exclude")&&e.semanticExclude===!1)throw new Error("This adapter does not support semantic exclude queries; omit exclude or use the DOM adapter.");return te(r,l),_(e,t,r,{depth:0,path:[]},l)}function _(e,t,r,l,n){if(l.depth>W)throw new Z(l.path);if(typeof r=="string")return yt(e,t,r,l,n);if(Array.isArray(r)){let[o,a]=r,i=e.find(t,o,n);return De(n,l,i),i.map((u,s)=>_(e,u,a,{depth:l.depth+1,path:[...l.path,s]},n))}if(typeof r=="object"&&r!==null){let o={};for(let[a,i]of Object.entries(r))o[a]=_(e,t,i,{depth:l.depth+1,path:[...l.path,a]},n);return o}return null}function yt(e,t,r,l,n){if(r.endsWith("[]")){let c=r.slice(0,-2),d=e.find(t,c,n);return De(n,l,d),d.map(p=>e.text(p))}let o=We(r,n);if(o)return gt(e,t,o,n);if(r.startsWith("@"))return z(e,t,r.slice(1));let a=C(r);if(a!==-1){let{selector:c,all:d}=$(r),p=r.slice(a+1),v=c?e.find(t,c,n):[t];return d&&n.allMatches?v.map(f=>z(e,f,p)):v.length===0?null:z(e,v[0],p)}if(r===".")return e.text(t);let{selector:i,all:u}=$(r),s=e.find(t,i,n);return u&&n.allMatches?s.map(c=>e.text(c)):s.length===0?null:e.text(s[0])}function gt(e,t,{selector:r,codec:l},n){let o=r?e.find(t,r,n):[t];return o.length===0?null:l.read(e,o[0],{query:n.query,view:n.view,region:n.region})}function De(e,t,r){if(typeof e.onRowsRead=="function")try{e.onRowsRead(t.path.slice(),r)}catch(l){console.warn(`[hyper-html-api] onRowsRead threw at "${t.path.join(".")||"(root)"}"`,l)}}function z(e,t,r){if(Q(r))return Y(e.attr(t,"style"),r);if(Qe.has(r)){let n=e.prop(t,r);return n==null?null:String(n)}return e.attr(t,r)??null}function wt(e,t,r,l){let n=e.length,o=t.length,a=new Array(n).fill(-1);if(l){let h=new Set;for(let y=0;y<n;y++){let w=l[y];!(w>=0&&w<o)||h.has(w)||(a[y]=w,h.add(w))}}if(n===0||o===0)return a;let i=e.map(h=>ce(h,r)),u=t.map(h=>ce(h,r)),s=new Array(o).fill(!1);for(let h of a)h>=0&&(s[h]=!0);let c=new Map;u.forEach((h,y)=>{s[y]||c.set(h,c.has(h)?-1:y)});let d=new Map;i.forEach((h,y)=>{a[y]>=0||d.set(h,(d.get(h)||0)+1)}),i.forEach((h,y)=>{if(a[y]>=0||d.get(h)!==1)return;let w=c.get(h);w===void 0||w===-1||s[w]||(a[y]=w,s[w]=!0)});let p=[];for(let h=0;h<n;h++)a[h]<0&&p.push(h);let v=[];for(let h=0;h<o;h++)s[h]||v.push(h);if(p.length===0||v.length===0)return a;let f=n*o+1,m=vt(e,t,r),g=(h,y)=>m(h,y)*f+Math.abs(h-y);for(let[h,y]of At(p,v,g))a[h]=y;return a}var Pe=e=>typeof e=="object"&&e!==null;function ce(e,t){if(!Pe(t))return e==null?" null":String(e);let r=Object.keys(t);return JSON.stringify(r.map(l=>{let n=JSON.stringify(e?.[l]);return n===void 0?" undef":n}))}function vt(e,t,r){if(!Pe(r))return(i,u)=>e[i]===t[u]?0:1;let l=Object.keys(r),n=i=>l.map(u=>JSON.stringify(i?.[u])),o=e.map(n),a=t.map(n);return(i,u)=>{let s=o[i],c=a[u],d=0;for(let p=0;p<l.length;p++)s[p]!==c[p]&&d++;return d}}function At(e,t,r){return e.length<=t.length?fe(e,t,r,!1):fe(t,e,(l,n)=>r(n,l),!0)}function fe(e,t,r,l){let n=e.length,o=t.length,a=[];for(let d=0;d<=n;d++)a.push(new Float64Array(o+1).fill(1/0));let i=[];for(let d=0;d<=n;d++)i.push(new Uint8Array(o+1));for(let d=0;d<=o;d++)a[n][d]=0;for(let d=n-1;d>=0;d--)for(let p=o-1;p>=0;p--){let v=r(e[d],t[p])+a[d+1][p+1],f=a[d][p+1];v<=f?(a[d][p]=v,i[d][p]=1):a[d][p]=f}let u=[],s=0,c=0;for(;s<n&&c<o;)i[s][c]&&(u.push(l?[t[c],e[s]]:[e[s],t[c]]),s++),c++;return u}function qe(e,t,r,l,n,o,a,i={}){let u=e.find(t,r,i);if(n.length===0){u.forEach(A=>e.remove(A)),V(i,"onRowsApplied",o.path,[]);return}let s=n.length>u.length,c=u[0]||null;if(s&&!c&&(c=xt(e,t,r,i),!c))throw new M(o.path);let d=u.map(A=>Et(e,A,l,i)),p=null;if(s&&c){p=e.clone(c),i.templateAttr&&e.removeAttr(p,i.templateAttr);let A=e.stripIds(p);A>0&&console.warn(`[hyper-html-api] stripped ${A} id attribute(s) from cloned template at "${o.path.join(".")||"(root)"}"`)}let v=wt(n,d,l,bt(e,u,n,o,i)),f=u.length>0?e.parent(u[0]):St(e,t,r,c,o,i),m=u.length>0?Be(e,f,u[0]):0,g=kt(e,u),h=new Set,y=[],w=n.map((A,T)=>{let b=v[T];if(b>=0)return h.add(b),y.push(!1),u[b];y.push(!0);let x=e.clone(p);return e.stripIds(x),x});u.forEach((A,T)=>{h.has(T)||e.remove(A)}),g?Ct(e,f,m,w,y):jt(e,w,y,f,m),Tt(e,w,l,n,o,a,i),V(i,"onRowsApplied",o.path,w)}function V(e,t,r,l){if(typeof e[t]=="function")try{return e[t](r.slice(),l)}catch(n){console.warn(`[hyper-html-api] ${t} threw at "${r.join(".")||"(root)"}"`,n);return}}function bt(e,t,r,l,n){let o=V(n,"identifyRows",l.path,r);if(!Array.isArray(o))return null;let a=new Array(r.length).fill(-1),i=new Set,u=new Map(t.map((s,c)=>[e.identity(s),c]));for(let s=0;s<r.length;s++){if(!o[s])continue;let c=u.get(e.identity(o[s]));c===void 0||i.has(c)||(a[s]=c,i.add(c))}return a}function Tt(e,t,r,l,n,o,a){t.forEach((i,u)=>{if(r===null){let s=l[u],c=s==null?"":String(s);e.text(i)!==c&&e.text(i,c)}else{let s=o(e,i,r,l[u],{depth:n.depth+1,path:[...n.path,u]},a);s&&s!==i&&(t[u]=s)}})}function Et(e,t,r,l){return r===null?e.text(t):q(e,t,r,l.onRowsRead?{...l,onRowsRead:void 0}:l)}function Be(e,t,r){let l=e.children(t);for(let n=0;n<l.length;n++)if(e.sameNode(l[n],r))return n;return-1}function xt(e,t,r,l){if(!l.templateAttr)return null;let n=/^\s*:scope\s*>\s*/.test(r),o=new RegExp(":not\\(\\["+l.templateAttr.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&")+"\\]\\)","g"),a=r.replace(/^\s*:scope\s*>\s*/,"").replace(o,""),i=n?Ot(a):0,u=je(a),s=t;for(;s;){let c=e.find(s,a,{includeRulesTag:!1,templateAttr:null});for(let d of c)if(e.attr(d,l.templateAttr)!=null&&!(n&&!$t(e,t,d,i))&&!(u&&!e.matches(e.parent(d),u)))return d;s=e.parent(s)}return null}function Ot(e){let t=0,r=null,l=1;for(let n=0;n<e.length;n++){let o=e[n];if(o==="\\")n++;else if(r)o===r&&(r=null);else if(o==='"'||o==="'")r=o;else if(o==="["||o==="(")t++;else if(o==="]"||o===")")t>0&&t--;else if(t===0&&o===">")l++;else{if(t===0&&(o==="+"||o==="~"))return null;if(t===0&&/\s/.test(o)){if(!Nt(e,n))return null;for(;n+1<e.length&&/\s/.test(e[n+1]);)n++}}}return l}function Nt(e,t){let r=t;for(;r<e.length&&/\s/.test(e[r]);)r++;let l=t>0?e[t-1]:"",n=r<e.length?e[r]:"";return de(l)||de(n)}function de(e){return e===">"||e==="+"||e==="~"}function $t(e,t,r,l){if(l===null)return!0;let n=r;for(let u=0;u<l;u++)if(n=e.parent(n),!n)return!1;let o=e.prop(t,"tagName");if(!o)return!0;let a=e.prop(n,"tagName");if(!a||String(a).toLowerCase()!==String(o).toLowerCase())return!1;let i=new Set(pe(e,n));return pe(e,t).every(u=>i.has(u))}function pe(e,t){let r=e.attr(t,"class");return r?String(r).split(/\s+/).filter(Boolean):[]}function St(e,t,r,l,n,o){let a=e.parent(l);if(a&&Rt(e,t,a)&&!me(e,a,o))return a;let i=je(r);if(!i)throw new M(n.path,`the list selector "${r}" names no container to hold the new rows \u2014 write it as "container > row" (for example "ol.comments > li") so the cloned row lands in the list`);let u=(i===":scope"?e.prop(t,"tagName")?[t]:[]:e.find(t,i,o)).filter(s=>!me(e,s,o));if(u.length===0)throw new M(n.path,`no container matching "${i}" inside this context to hold the new rows`);if(u.length>1)throw new M(n.path,`"${i}" matches ${u.length} containers inside this context, so the new rows have no single destination`);return u[0]}function Rt(e,t,r){let l=r;for(;l;){if(e.sameNode(l,t))return!0;l=e.parent(l)}return e.parent(t)?!1:e.find(t,"*",{includeRulesTag:!0,templateAttr:null}).some(n=>e.sameNode(n,r))}var he=["no-data","editor-ui"];function me(e,t,r){let l=t;for(;l;){if(r.templateAttr&&e.attr(l,r.templateAttr)!=null||he.some(o=>e.attr(l,o)!=null))return!0;let n=e.attr(l,"clay");if(n&&n.split(/\s+/).some(o=>he.includes(o)))return!0;l=e.parent(l)}return!1}function Ct(e,t,r,l,n){let o=e.children(t),a=o.map(u=>e.identity(u)),i=!1;l.forEach((u,s)=>{let c=e.identity(u),d=r+s;if(a[d]===c)return;if(!n[s]){let v=a.indexOf(c);v!==-1&&(a.splice(v,1),o.splice(v,1))}let p=Math.min(d,o.length);p<o.length?e.insertBefore(o[p],u):o.length?i?e.insertAfter(o[o.length-1],u):(e.insertAt(t,u,d),i=!0):e.insertAt(t,u,0),a.splice(p,0,c),o.splice(p,0,u)})}function kt(e,t){if(t.length<=1)return!0;let r=e.parent(t[0]);if(!r)return!1;let l=new Map(e.children(r).map((o,a)=>[e.identity(o),a])),n=[];for(let o of t){let a=l.get(e.identity(o));if(a===void 0)return!1;n.push(a)}return n.sort((o,a)=>o-a),n[n.length-1]-n[0]===n.length-1}function jt(e,t,r,l,n){let o=null,a=n;for(let i=0;i<t.length;i++){if(!r[i]){o=t[i];continue}let u=o?e.parent(o):l;if(!u)continue;let s=o?Be(e,u,o)+1:a++;e.insertAt(u,t[i],s),o=t[i]}}function B(e,t,r,l,n={}){if(Object.prototype.hasOwnProperty.call(n,"exclude")&&e.semanticExclude===!1)throw new Error("This adapter does not support semantic exclude queries; omit exclude or use the DOM adapter.");te(r,n);let o=[];if(F(r,l,[],o),o.length)throw new Se(o);H(e,t,r,l,{depth:0,path:[]},n)}function H(e,t,r,l,n,o={}){if(n.depth>W)throw new Z(n.path);if(l===void 0)return t;if(typeof r=="string")return Lt(e,t,r,l,n,o);if(Array.isArray(r)){let[a,i]=r;return qe(e,t,a,i,l,n,H,o),t}if(typeof r=="object"&&r!==null){for(let[a,i]of Object.entries(r)){let u=H(e,t,i,l==null?l:l[a],{depth:n.depth+1,path:[...n.path,a]},o);u&&u!==t&&(t=u)}return t}return t}function Lt(e,t,r,l,n,o){if(r.endsWith("[]")){let d=r.slice(0,-2);return qe(e,t,d,null,l,n,H,o),t}let a=We(r,o);if(a){let d=a.selector?e.find(t,a.selector,o):[t];return d.length&&a.codec.write(e,d[0],l,{query:o.query}),t}if(r.startsWith("@"))return ge(e,t,r.slice(1),l);let i=C(r);if(i!==-1){let{selector:d,all:p}=$(r),v=r.slice(i+1),f=d?e.find(t,d,o):[t];for(let m of p?f:f.slice(0,1))ge(e,m,v,l);return t}if(r===".")return ye(e,t,l),t;let{selector:u,all:s}=$(r),c=e.find(t,u,o);for(let d of s?c:c.slice(0,1))ye(e,d,l);return t}function ye(e,t,r){let l=r==null?"":String(r);e.text(t)!==l&&e.text(t,l)}function Mt(e,t,r,l){if(e.styleVar){e.styleVar(t,r,l);return}Ie(e,t,r,l)}function ge(e,t,r,l){if(Q(r))return Mt(e,t,r,l==null?"":String(l).trim()),t;if(Ne.has(r)){let n=e.prop(t,r);if(n===l||n!=null&&l!=null&&String(n)===String(l))return t;throw new Re(r)}if(r==="outerHTML"){let n=l==null?"":String(l);return e.replaceWith(t,n)}if(Ye.has(r)){let n=et(r,l);return e.prop(t,r)!==n&&e.prop(t,r,n),t}if(l==null)e.attr(t,r)!=null&&e.removeAttr(t,r);else{let n=String(l);e.attr(t,r)!==n&&e.attr(t,r,n)}return t}function F(e,t,r,l){if(t!==void 0){if(typeof e=="string"){if(G(e))return;if(e.endsWith("[]")){Array.isArray(t)?t.forEach((n,o)=>{typeof n=="object"&&n!==null&&l.push({path:j([...r,o]),expected:"scalar",got:k(n)})}):l.push({path:j(r),expected:"array",got:k(t)});return}t!==null&&typeof t=="object"&&l.push({path:j(r),expected:"scalar",got:k(t)});return}if(Array.isArray(e)){if(!Array.isArray(t)){l.push({path:j(r),expected:"array",got:k(t)});return}let n=e[1];t.forEach((o,a)=>F(n,o,[...r,a],l));return}if(typeof e=="object"&&e!==null){if(t===null||Array.isArray(t)||typeof t!="object"){l.push({path:j(r),expected:"object",got:k(t)});return}for(let[n,o]of Object.entries(e))F(o,t[n],[...r,n],l)}}}function k(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function j(e){return e.join(".")}function It(e){try{return JSON.parse(e)}catch(t){throw new R(`Invalid strict JSON: ${t.message}`,t)}}function He(e){try{return JSON.parse(e)}catch{}let t={BRACE_OPEN:"{",BRACE_CLOSE:"}",BRACKET_OPEN:"[",BRACKET_CLOSE:"]",COLON:":",COMMA:",",STRING:"STRING",SELECTOR:"SELECTOR",IDENTIFIER:"IDENTIFIER",NUMBER:"NUMBER",BOOLEAN:"BOOLEAN"};function r(n){let o=[],a=0;for(;a<n.length;){let i=n[a];if(/\s/.test(i)){a++;continue}if("{}".includes(i)){o.push({type:i,value:i}),a++;continue}if(i==="["){let d=!1,p=a+1;for(;p<n.length&&/\s/.test(n[p]);)p++;if(p<n.length&&/[a-zA-Z_]/.test(n[p])&&(d=!0),!d){o.push({type:i,value:i}),a++;continue}}if(i==="]"){o.push({type:i,value:i}),a++;continue}if(i===":"){o.push({type:t.COLON,value:i}),a++;continue}if(i===","){o.push({type:t.COMMA,value:i}),a++;continue}if(i==='"'||i==="'"){let d=i,p=a+1;for(;p<n.length&&n[p]!==d;)n[p]==="\\"&&p++,p++;o.push({type:t.STRING,value:n.substring(a+1,p),quoted:!0,sourceQuote:d}),a=p+1;continue}let u=a,s;for(;u<n.length&&!/[{},]/.test(n[u]);)if(n[u]===":"){let d=[":first",":last",":nth-child",":nth-of-type",":first-child",":last-child",":first-of-type",":last-of-type",":only-child",":only-of-type",":hover",":focus",":active",":visited",":disabled",":enabled",":checked",":empty",":root",":target",":not",":before",":after",":nth-last-child",":nth-last-of-type"],p=!1;for(let v of d){let f=v.substring(1);if(n.substring(u+1,u+1+f.length)===f){p=!0,u+=f.length;break}}if(!p)break}else if(n[u]==="["){for(u++;u<n.length&&n[u]!=="]";){if(n[u]==='"'||n[u]==="'"){let d=n[u];for(u++;u<n.length&&n[u]!==d;)n[u]==="\\"&&u++,u++}u++}u<n.length&&n[u]==="]"&&u++}else u++;s=n.substring(a,u);let c=t.IDENTIFIER;/^-?\d+(\.\d+)?$/.test(s)?c=t.NUMBER:s==="true"||s==="false"||s==="null"?c=t.BOOLEAN:/^[.#@\[]|[.#@\[]| /.test(s)&&(c=t.SELECTOR),o.push({type:c,value:s,quoted:!1}),a=u}return o}function l(n){let o="";for(let a=0;a<n.length;a++){let i=n[a];if("{}".includes(i.type)||"[]".includes(i.type)){o+=i.value;continue}if(i.type===t.COLON){o+=i.value;continue}if(i.type===t.COMMA){let u=n[a+1];if(u&&(u.type==="}"||u.type==="]"))continue;o+=i.value;continue}if(i.type===t.STRING&&i.quoted){let u=i.value;i.sourceQuote==="'"&&(u=u.replace(/\\'/g,"'"),u=u.replace(/(\\*)"/g,(s,c)=>c.length%2===0?c+'\\"':s)),o+=`"${u}"`;continue}if(i.type===t.NUMBER||i.type===t.BOOLEAN){o+=i.value;continue}if(i.type===t.SELECTOR||i.type===t.IDENTIFIER){o+=`"${i.value}"`;continue}o+=`"${i.value}"`}return o}try{let n=r(e),o=l(n);return JSON.parse(o)}catch(n){throw new R("Invalid extraction rules syntax: "+n.message,n)}}var Wt=["1","2"],we=/^[a-zA-Z0-9_-]+$/;function re(e,t,r){let l;if(r===void 0)l="script[data-rules-name]";else{if(typeof r!="string"||!we.test(r))throw new Error(`hyper-html-api: invalid rules token ${JSON.stringify(r)} (must match ${we})`);l=`script[data-rules-name~="${r}"]`}let n=e.find(t,l,{includeRulesTag:!0});if(n.length===0)return null;r!==void 0&&n.length>1&&console.warn(`hyper-html-api: ${n.length} rules tags match data-rules-name~="${r}"; using the first.`);let o=n[0],a=e.attr(o,"data-rules-version");if(!Wt.includes(a))throw new $e(a);return{rules:He(e.text(o)),tagNode:o,version:a}}var ne=Object.freeze({data:Object.freeze({tokens:["no-data"],bundles:["editor-ui"]}),save:Object.freeze({tokens:["no-save"],bundles:["editor-ui"]}),snapshot:Object.freeze({tokens:["no-snapshot"],bundles:["editor-ui"]}),watch:Object.freeze({tokens:["no-watch"],bundles:["editor-ui"]}),undo:Object.freeze({tokens:["no-undo"],bundles:["editor-ui"]}),history:Object.freeze({tokens:[],bundles:["editor-ui"]})}),Dt=Object.freeze({"editor-ui":Object.freeze(["no-data","no-save","no-snapshot","no-watch","no-undo"])}),Pt=Object.freeze(["no-save","no-snapshot","no-trigger-autosave","no-dirty","no-watch","no-undo","no-data","freeze","editor-ui","live"]);function U(e,t){if(!e||e.nodeType!==1)return!1;let r=e.getAttribute?.("clay");return!!(r&&r.split(/\s+/).includes(t)||e.hasAttribute?.(t))}function Ue(e,t){if(U(e,t))return!0;for(let[r,l]of Object.entries(Dt))if(l.includes(t)&&U(e,r))return!0;return!1}function J(e){let t=ne[e];if(!t)throw new Error(`Unknown region capability: ${e}`);return[...t.tokens,...t.bundles].flatMap(r=>[`[clay~="${r}"]`,`[${r}]`]).join(", ")}function qt(e,t){let r=e&&e.nodeType===1?e:e?.parentElement;for(;r&&r.nodeType===1;){let l=ne[t];if(!l)throw new Error(`Unknown region capability: ${t}`);if(l.tokens.some(n=>Ue(r,n))||l.bundles.some(n=>U(r,n)))return r;r=r.parentElement}return null}function Bt(e,t){return!!qt(e,t)}var le=Object.freeze({refusedRuleForms:["innerHTML","outerHTML"],refusedTargets:["script","style","template","noscript","iframe","object","embed","xmp","plaintext","noembed","noframes","meta","link","base","animate","set","animatemotion","animatetransform"],refusedAttributes:["style","srcdoc","is","http-equiv","sandbox","allow","nonce","integrity","charset","htmlclaytoken","htmlclayid","data-rules-name","data-rules-version","clay","contenteditable",...Pt],refusedAttributePrefixes:["on"],urlAttributes:["href","src","srcset","action","formaction","poster","cite","data","ping","background","longdesc","usemap","xlink:href","manifest","codebase","icon"],refusedSchemes:["javascript","vbscript","data"],customPropertyValues:Object.freeze({maxLength:200,refusedCharacters:[";","{","}","<",">","\\"],refusedFunctions:["url","src","image","image-set","-webkit-image-set","cross-fade","element","expression","paint"]})}),Ht=new Set(["textContent","innerText"]);function Ut(e){let t=String(e).replace(/^[\u0000- ]+|[\u0000- ]+$/g,"").replace(/[\t\n\r]/g,"").match(/^([a-zA-Z][a-zA-Z0-9+.-]*):/);return t?t[1].toLowerCase():null}var zt=/^[^\t\n\f\r "'>/=\u0000-\u001f\u007f]+$/;function _t(e,t,r=le){if(!zt.test(String(e)))return`attribute name ${JSON.stringify(String(e))} is not valid`;let l=String(e).toLowerCase();if(r.refusedAttributePrefixes.some(n=>l.startsWith(n)))return`attribute "${l}" can run script`;if(r.refusedAttributes.includes(l))return`attribute "${l}" is not content`;if(r.urlAttributes.includes(l)&&t!=null){let n=l==="srcset"?String(t).split(",").map(o=>o.trim().split(/\s+/)[0]).filter(Boolean):[String(t)];for(let o of n){let a=Ut(o);if(a&&r.refusedSchemes.includes(a))return`"${a}:" URLs are not allowed in "${l}"`}}return null}function oe(e,t){let r=e.prop(t,"tagName");return r?String(r).toLowerCase():""}function Vt(e,t){let r=oe(e,t)||"node",l=e.attr(t,"id");return l?`<${r}#${l}>`:`<${r}>`}function Ft(e,t,r){let l=t;for(;l;){let n=oe(e,l);if(n&&r.refusedTargets.includes(n))return n;l=e.parent(l)}return null}function ze(e,t){return e.find(t,"script[data-rules-name]",{includeRulesTag:!0,templateAttr:null}).length>0}function Jt(e,t){return oe(e,t)==="script"&&e.attr(t,"data-rules-name")!=null?!0:ze(e,t)}function Kt(e){if(/[\u0000-\u001f\u007f]/.test(e))return"control characters are not allowed in a custom property value";let t=[],r=null;for(let l=0;l<e.length;l++){let n=e[l];if(r){n===r&&(r=null);continue}if(n==='"'||n==="'")r=n;else{if(n==="/"&&e[l+1]==="*")return"comments are not allowed in a custom property value";if(n==="(")t.push(")");else if(n==="[")t.push("]");else if((n===")"||n==="]")&&t.pop()!==n)return`"${n}" does not close anything in this custom property value`}}return r?"a custom property value must close its quotes":t.length?"a custom property value must close its brackets":null}function Xt(e,t=le){let r=t.customPropertyValues,l=String(e);if(l.length>r.maxLength)return`custom property values are limited to ${r.maxLength} characters`;let n=r.refusedCharacters.find(u=>l.includes(u));if(n)return`${JSON.stringify(n)} is not allowed in a custom property value`;let o=Kt(l);if(o)return o;let a=l.toLowerCase(),i=r.refusedFunctions.find(u=>new RegExp(`(^|[^a-z0-9_-])${u.replace(/[-]/g,"\\-")}\\s*\\(`).test(a));return i?`"${i}()" is not allowed in a custom property value`:null}function ve(e,t=le){let r=[],l=(i,u)=>(r.push({target:Vt(e,i),reason:u}),!1),n=i=>{let u=Ft(e,i,t);return u?l(i,`inside <${u}>, which is not content`):!0},o=i=>n(i)?ze(e,i)?l(i,"a text write here would delete the data rules tag"):!0:!1,a=(i,u,s)=>{if(!n(i))return!1;let c=_t(u,s,t);return c?l(i,c):!0};return{...e,text(i,u){if(u===void 0)return e.text(i);o(i)&&e.text(i,u)},attr(i,u,s){if(s===void 0)return e.attr(i,u);a(i,u,s)&&e.attr(i,u,s)},removeAttr(i,u){a(i,u,null)&&e.removeAttr(i,u)},styleVar(i,u,s){if((Y(e.attr(i,"style"),u)??"")!==s&&n(i)){if(!Q(u))return l(i,`"${u}" is not a custom property`);if(s!==""){let c=Xt(s,t);if(c)return l(i,c)}Ie(e,i,u,s)}},prop(i,u,s){if(s===void 0)return e.prop(i,u);if(t.refusedRuleForms.includes(u))return l(i,`"@${u}" writes HTML, only text is allowed`);if(Ht.has(u)){o(i)&&e.prop(i,u,s);return}a(i,u==="className"?"class":u,s)&&e.prop(i,u,s)},remove(i){if(Jt(e,i)){l(i,"removing this would delete the data rules tag");return}e.remove(i)},replaceWith(i,u){return u===e.prop(i,"outerHTML")||l(i,'"@outerHTML" writes HTML, only text is allowed'),i},refusals:r,assertClean(){if(r.length)throw new Ce(r.slice())}}}function L(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ae(e){return e.reduce((t,r)=>typeof r=="number"?`${t}[${r}]`:t?`${t}.${r}`:r,"")}function Zt(e,t,r,l,n={}){te(r,n);let o=[],a=[];function i(s,c,d){if(Array.isArray(s)){let[,p]=s;if(!Array.isArray(c)||!L(p))return;c.forEach((v,f)=>i(p,v,[...d,f]));return}if(!(!L(s)||!L(c)))for(let p of Object.keys(c))Object.prototype.hasOwnProperty.call(s,p)?i(s[p],c[p],[...d,p]):o.push(Ae([...d,p]))}function u(s,c,d,p){if(d!==void 0){if(typeof c=="string"){if(c.endsWith("[]")||c==="."||c.startsWith("@"))return;let{selector:v}=$(c);if(!v)return;e.find(s,v,n).length===0&&a.push({path:Ae(p),selector:v});return}if(!Array.isArray(c)&&L(c)&&L(d))for(let[v,f]of Object.entries(c))u(s,f,d[v],[...p,v])}}return i(r,l,[]),u(t,r,l,[]),{unknownKeys:o,unmatched:a}}function be(e,t,r){if(r&&typeof r=="object")return{rules:r,tagNode:null,version:"1"};if(typeof r=="string"){let l=t&&t.ownerDocument?t.ownerDocument:t;return re(e,l,r)}return null}var Gt=/:(?:focus(?:-within|-visible)?|hover|active|visited|defined)\b/i;function Qt(e,t){if(!/^(INPUT|TEXTAREA|SELECT|OPTION)$/.test(e.tagName||""))return;let r=(e.getAttribute?.("type")||"").toLowerCase();"value"in e&&"value"in t&&e.tagName!=="OPTION"&&r!=="checkbox"&&r!=="radio"&&r!=="file"&&(t.value=e.value),e.tagName==="INPUT"&&(r==="checkbox"||r==="radio")&&(t.checked=e.checked),e.tagName==="OPTION"&&(t.selected=e.selected),"indeterminate"in e&&"indeterminate"in t&&(t.indeterminate=e.indeterminate)}function Te(e,t,r,l){if(l)return!!e.closest?.(t);let n=e;for(;n?.nodeType===1;){if(n.matches(t))return!0;if(n===r)break;n=n.parentElement}return!1}function Ee(e,t,r,l,n,o){return(o?Bt(e,t):Te(e,r,n,!1))||!!(l&&(o&&e!==n?e.matches(l):Te(e,l,n,o)))}function Yt(e,t){let r=ne[t];return r.tokens.some(l=>Ue(e,l))||r.bundles.some(l=>U(e,l))}var er=new Set(["INPUT","TEXTAREA","SELECT","OPTION"]);function _e(e,t,r,l){if(e.nodeType===1&&l(e)){r.dropped.push(t);return}r.cloneToLive.set(t,e),r.liveToClone.set(e,t);let n=e,o=t;if(e.nodeType===1){if(er.has(e.tagName)&&r.controls.push(e,t),e.tagName==="TEMPLATE"){for(;t.firstChild;)t.removeChild(t.firstChild);n=e.content,o=t.content,r.cloneToLive.set(o,n),r.liveToClone.set(n,o)}}else if(e.nodeType!==11)return;let a=o.firstChild;for(let i=n.firstChild;i&&a;i=i.nextSibling)_e(i,a,r,l),a=a.nextSibling}function D(e,{capability:t="data",exclude:r=null,inherit:l=!0,provenance:n=null}={}){if(!e)throw new TypeError("createContentView requires a DOM context");let o=e.nodeType===9?e:e.ownerDocument;if(!o?.implementation?.createHTMLDocument)throw new TypeError("createContentView requires an HTML DOM implementation");let a=o.implementation.createHTMLDocument(""),i=n||new WeakMap,u=new WeakMap,s=e.nodeType===9?e.documentElement:e;r&&a.documentElement.matches(r);let c=J(t),d=l?f=>Yt(f,t)||!!(r&&f.matches(r)):f=>Ee(f,t,c,r,s,!1),p=null;if(s.nodeType!==1||!Ee(s,t,c,r,s,l)){p=a.importNode(s,!0);let f={cloneToLive:i,liveToClone:u,dropped:[],controls:[]};_e(s,p,f,d);for(let m of f.dropped)m.remove();for(let m=0;m<f.controls.length;m+=2)Qt(f.controls[m],f.controls[m+1])}e.nodeType===9&&p&&(a.replaceChild(p,a.documentElement),u.set(e,a),i.set(a,e));let v=f=>{if(Gt.test(f))throw new Error(`Filtered content queries do not support stateful selector: ${f}`)};return{root:p,document:a,capability:t,selector:J(t),cloneToLive:i,liveToClone:u,original(f){return i.get(f)||null},cloneOf(f){return u.get(f)||null},query(f,m=p){return v(f),Array.from(m.querySelectorAll(f),g=>i.get(g)||g)},text(f=p){return(f===p?p:u.get(f))?.textContent||""},html(f=p){return(f===p?p:u.get(f))?.innerHTML??""},clone(f=p){let m=f===p?p:u.get(f);return m?a.importNode(m,!0):null}}}function Ve(e){return e&&e.nodeType===1&&e.tagName==="SCRIPT"&&e.hasAttribute&&e.hasAttribute("data-rules-name")}function tr(e){return e?(e.nodeType===9||e.nodeType,e):null}function xe(e,t,r){!e||e.nodeType!==1||(t==="value"&&e.tagName==="INPUT"?e.value=r===null?"":r:t==="checked"&&e.tagName==="INPUT"?e.checked=r!==null:t==="selected"&&e.tagName==="OPTION"&&(e.selected=r!==null))}function Fe(e,t){e&&e.tagName==="TEXTAREA"&&(e.value=t)}function Je(e){if(!e||e.nodeType!==1)return;let t=[e,...e.querySelectorAll?e.querySelectorAll("textarea, input, option"):[]];for(let r of t)if(r.tagName==="TEXTAREA")r.value=r.defaultValue;else if(r.tagName==="INPUT"){let l=r.type;l!=="file"&&l!=="checkbox"&&l!=="radio"&&(r.value=r.defaultValue),r.checked=r.defaultChecked}else r.tagName==="OPTION"&&(r.selected=r.defaultSelected)}var E={semanticExclude:!0,find(e,t,r={}){let l=tr(e);if(!l||!l.querySelectorAll)return[];let n=Array.from(l.querySelectorAll(t));r.includeRulesTag||(n=n.filter(i=>!Ve(i)));let o=[];r.skip&&o.push(r.skip);let a=r.templateAttr===null?null:r.templateAttr||"cms-template";if(a&&o.push("["+a+"]"),o.length){let i=o.join(", ");n=n.filter(u=>!u.closest||!u.closest(i))}return n},parent(e){return e?e.parentElement:null},children(e){return e?Array.from(e.children):[]},matches(e,t){return!!(e&&e.matches)&&e.matches(t)},text(e,t){if(t===void 0)return(e.textContent||"").trim();e.textContent=t,Fe(e,t)},attr(e,t,r){if(r===void 0)return e.hasAttribute&&e.hasAttribute(t)?e.getAttribute(t):null;e.setAttribute(t,r),xe(e,t,r)},removeAttr(e,t){e&&e.removeAttribute&&e.removeAttribute(t),xe(e,t,null)},prop(e,t,r){if(r===void 0){let l=e?e[t]:void 0;return l!==void 0?l:null}e[t]=r},clone(e){let t=e.cloneNode(!0);return Je(t),t},insertAt(e,t,r){let l=e.children[r]||null;e.insertBefore(t,l)},insertBefore(e,t){e.parentNode.insertBefore(t,e)},insertAfter(e,t){e.parentNode.insertBefore(t,e.nextSibling)},identity(e){return e||null},remove(e){e&&e.parentNode&&e.parentNode.removeChild(e)},replaceWith(e,t){if(!e||!e.parentNode)throw new Error("dom.replaceWith: node has no parent");let r=e.ownerDocument.createElement("template");r.innerHTML=t;let l=r.content.firstElementChild;if(!l)throw new Error("dom.replaceWith: html did not parse to an element");return e.parentNode.replaceChild(l,e),l},stripIds(e){let t=0;return e.id&&(e.removeAttribute("id"),t++),(e.querySelectorAll?e.querySelectorAll("[id]"):[]).forEach(r=>{r.removeAttribute("id"),t++}),t},sameNode(e,t){return e===t}};function N(e,t={}){if(t.exclude===null)return E;let r=[J("data"),t.exclude].filter(Boolean).join(", "),l=e.nodeType===9?e:e.ownerDocument||e,n=e.nodeType===9?e.documentElement:e;if(!t._write&&!n?.matches?.(r)&&!n?.querySelector?.(r)&&!l?.querySelector?.(r))return E;let o=e.nodeType===9||!e.isConnected?e:e.ownerDocument,a=e.nodeType===9?e:e.ownerDocument,i=null,u=()=>i||(i=D(o,{capability:"data",exclude:t.exclude||null})),s=f=>{let m=u();return f===e?m.cloneOf(e):m.cloneOf(f)||f},c=f=>i?.original(f)||f,d=(f,m)=>{u().liveToClone.set(f,m),u().cloneToLive.set(m,f);let g=f.childNodes||[],h=m.childNodes||[];for(let y=0;y<Math.min(g.length,h.length);y++)d(g[y],h[y])},p=(f,m,g,h)=>{let y=Array.from(f.childNodes).filter(b=>i.cloneOf(b)),w=y[0];for(;w&&y.includes(w);)w=w.nextSibling;for(let b of y)b.remove();if(g==="innerHTML"){let b=a.createElement("template");b.innerHTML=h;for(let x of Array.from(b.content.childNodes))f.insertBefore(x,w||null)}else f.insertBefore(a.createTextNode(h),w||null),Fe(f,h);let A=D(f,{capability:"data",exclude:t.exclude||null});m.replaceChildren(...Array.from(A.root?.childNodes||[]));let T=b=>{let x=A.original(b);x&&(i.liveToClone.set(x,b),i.cloneToLive.set(b,x));for(let Xe of Array.from(b.childNodes||[]))T(Xe)};for(let b of Array.from(m.childNodes))T(b)},v={...E,find(f,m,g={}){let h=s(f);if(!h?.querySelectorAll)return[];let y=u().query(m,h);g.includeRulesTag||(y=y.filter(T=>!Ve(T)));let w=[];g.skip&&w.push(g.skip);let A=g.templateAttr===null?null:g.templateAttr||"cms-template";if(A&&w.push(`[${A}]`),w.length){let T=w.join(", ");y=y.filter(b=>!b.closest?.(T))}return y},parent(f){let m=s(f)?.parentElement;return m?c(m):null},children(f){return Array.from(s(f)?.children||[],c)},text(f,m){if(m===void 0){let y=c(f);return!y?.matches?.(r)&&!y?.querySelector?.(r)?E.text(y):(s(f)?.textContent||"").trim()}let g=c(f);if(!g?.matches?.(r)&&!g?.querySelector?.(r)&&!i){E.text(g,m);return}let h=u().cloneOf(g);h?p(g,h,"textContent",m):E.text(g,m)},attr(f,m,g){let h=c(f);if(g===void 0)return E.attr(h,m);E.attr(h,m,g);let y=i?.cloneOf(h);y&&(E.attr(y,m,g),D(h,{capability:"data",exclude:t.exclude||null}).root===null&&(y.remove(),i.liveToClone.delete(h),i.cloneToLive.delete(y)))},removeAttr(f,m){let g=c(f);E.removeAttr(g,m);let h=i?.cloneOf(g);h&&E.removeAttr(h,m)},prop(f,m,g){let h=c(f);if(g===void 0)return m==="innerHTML"||m==="outerHTML"||m==="textContent"||m==="innerText"?E.prop(s(h),m):E.prop(h,m);let y=m==="innerHTML"||m==="textContent"||m==="innerText",w=y?u().cloneOf(h):i?.cloneOf(h);w&&y?p(h,w,m,g):(E.prop(h,m,g),w&&E.prop(w,m,g))},clone(f){let m=s(f);if(m===f)return E.clone(f);let g=a.importNode(m,!0);return Je(g),g},insertAt(f,m,g){let h=c(f),y=v.children(h)[g]||(()=>{for(let T=h.children.length-1;T>=0;T--){let b=h.children[T];if(u().cloneOf(b))return b.nextElementSibling}return h.firstElementChild})(),w=c(m);h.insertBefore(w,y||null);let A=u().cloneOf(h);if(A){let T=u().cloneOf(w);T||(T=a.importNode(w,!0),d(w,T));let b=Array.from(A.children);A.insertBefore(T,b[g]||null)}},insertBefore(f,m){let g=c(f),h=c(m);g.parentNode.insertBefore(h,g);let y=u().cloneOf(g.parentNode);if(y){let w=u().cloneOf(h);w||(w=a.importNode(h,!0),d(h,w));let A=u().cloneOf(g);A?A.before(w):y.appendChild(w)}},insertAfter(f,m){let g=c(f),h=c(m);g.parentNode.insertBefore(h,g.nextSibling);let y=u().cloneOf(g.parentNode);if(y){let w=u().cloneOf(h);w||(w=a.importNode(h,!0),d(h,w));let A=u().cloneOf(g);A?A.after(w):y.appendChild(w)}},identity(f){return c(f)||null},remove(f){let m=c(f),g=u().cloneOf(m);E.remove(m),g&&E.remove(g)},replaceWith(f,m){let g=c(f),h=u().cloneOf(g),y=E.replaceWith(g,m);if(h){let w=D(y,{capability:"data",exclude:t.exclude||null});if(!w.root)h.remove();else{h.replaceWith(w.root);let A=T=>{let b=w.original(T);b&&(i.liveToClone.set(b,T),i.cloneToLive.set(T,b));for(let x of Array.from(T.childNodes||[]))A(x)};A(w.root)}}return y}};return v}var P=E,I=e=>({codecs:pt(),...e}),ie={extract:(e,t,r={})=>q(N(e,r),e,t,I(r)),apply:(e,t,r,l={})=>B(N(e,{...l,_write:!0}),e,t,r,I(l)),findRulesIn:(e,t)=>re(P,e,t),findRules:(e,t)=>be(P,e,t),bind:(e,t,r={})=>{let l=be(P,e,t);if(!l){let o=typeof t=="string"?`data-rules-name~="${t}"`:"the provided rules object";throw new Error(`hyper-html-api: could not resolve rules for ${o}`)}let n=I({version:l.version,...r});return{...l,get:()=>q(N(e,r),e,l.rules,n),set:o=>B(N(e,{...r,_write:!0}),e,l.rules,o,n)}},codecs:{register:ft,get:dt},parseStrict:It,parseRelaxed:He,ruleAttrIndex:C,splitRule:$,errors:O,DOM_PROPERTIES:Oe},K=e=>!!e&&typeof e.nodeType=="number";function Ke(e){let t=e&&e.ownerDocument?e.ownerDocument:e,r=re(P,t,"api");if(!r)throw new O.NoRulesTag("api");return{rules:r.rules,version:r.version}}function rr(e){if(e.nodeType===9)return e;let t=e.ownerDocument?.documentElement;if(t?.contains(e))return t;let r=e;for(;r.parentNode;)r=r.parentNode;return r}function nr(e){if(e.nodeType!==11||!e.host)return e.cloneNode(!0);let t=e.ownerDocument.createDocumentFragment();for(let r of e.childNodes)t.appendChild(r.cloneNode(!0));return t}function lr(e,t){let r=[];for(;t!==e;){let l=t.parentNode;r.push(Array.prototype.indexOf.call(l.childNodes,t)),t=l}return r.reverse()}function or(e,t){return t.reduce((r,l)=>r.childNodes[l],e)}function S(e,t){let r=e.querySelectorAll?Array.from(e.querySelectorAll(t)):[];return e.matches?.(t)&&r.unshift(e),r}function ir(e,t){let r=S(e,"option"),l=S(t,"option");r.forEach((u,s)=>l[s].selected=u.selected);let n=S(e,"input"),o=S(t,"input");n.forEach((u,s)=>{let c=u.type.toLowerCase();c!=="file"&&(o[s].value=u.value),(c==="checkbox"||c==="radio")&&(o[s].checked=u.checked)});let a=S(e,"textarea"),i=S(t,"textarea");a.forEach((u,s)=>i[s].value=u.value)}function X(e,t){if(t!==void 0){if(typeof e=="string"){if(e.endsWith("[]"))return;let r=e.startsWith("@")?0:C(e);if(r===-1)return;let l=e.slice(r+1);if(Ne.has(l))throw new O.RuleTargetReadOnly(l);return}if(Array.isArray(e)){if(!Array.isArray(t))return;t.forEach(r=>X(e[1],r));return}if(e&&typeof e=="object"&&t&&typeof t=="object"&&!Array.isArray(t))for(let[r,l]of Object.entries(e))X(l,t[r])}}function ur(e,t,r,l){let n=I({templateAttr:"cms-template",version:l}),o=rr(e),a=lr(o,e),i=nr(o);ir(o,i);let u=or(i,a),s=N(i,{...n,_write:!0}),c=Zt(s,u,t,r,n);if(c.unknownKeys.length||c.unmatched.length)throw new O.WriteRejected(c.unknownKeys,c.unmatched);let d=ve(s);B(d,u,t,r,n),d.assertClean(),X(t,r);let p=ve(N(o,{...n,_write:!0}));B(p,e,t,r,n),p.assertClean()}function ar(e){if(!(e instanceof Error))return e;let t=e instanceof O.UnknownCodec||e instanceof O.CodecRefused?e.code:e.name||"Error";try{e.code=t}catch{Object.defineProperty(e,"code",{value:t,configurable:!0,enumerable:!0})}return e instanceof O.WriteRefused?e.details=e.refusals:e instanceof O.WriteRejected?e.details={unknownKeys:e.unknownKeys,unmatched:e.unmatched}:e instanceof O.ShapeMismatch?e.details=e.mismatches:Array.isArray(e.path)?e.details={path:e.path}:typeof e.target=="string"?e.details={target:e.target}:e.token!==void 0?e.details={token:e.token}:e.version!==void 0?e.details={version:e.version}:e.details={},e}function sr(e,t){let r=K(e)?e:document,l=K(e)?t:e;if(l===void 0){let{rules:n,version:o}=Ke(r);return q(N(r),r,n,I({version:o}))}return ie.bind(r,l).get()}function cr(e,t,r){try{if(!K(e))throw new Error("hyper-html-api: applyData(root, data, source?) needs a DOM root as the first argument.");let{rules:l,version:n}=r===void 0?Ke(e):ie.bind(e,r);ur(e,l,t,n)}catch(l){throw ar(l)}return e}var fr={engine:ie,extractData:sr,applyData:cr},dr=fr;export{ie as a,sr as b,cr as c,dr as d};
|
package/dist/m/c-HTLYXCUH.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as Qt}from"./c-4ASQPRQL.js";import{a as Ot}from"./c-GQ6F6IDK.js";import{c as F}from"./c-I2SCCUEW.js";import{b as We}from"./c-5VYOWDTI.js";import{a as Vt,d as $,e as Ge,f as R,h as N}from"./c-6Q6RGFBF.js";import{a as Ke,b as Yt,c as jt,d as zt}from"./c-SKMIR5HQ.js";import{a as $t}from"./c-UGHH4MB3.js";import{a as Lt}from"./c-LA2BW7UY.js";import{a as Rt,f as Ft,g as P,h as Ut,i as qt,j as Bt,m as Ht,u as Gt,w as Wt,x as Kt}from"./c-MFOSMAVM.js";import{b as Nt,h as He}from"./c-PGSBXHUE.js";import{a as qe,c as It,g as bt,h as Be}from"./c-6IJEVE6B.js";import{a as be,f as Re,h as Q}from"./c-IJUK2GPW.js";import{b as K,e as Pt,f as A}from"./c-EDE45NM7.js";import{i as Ct,k as Mt,m as xt}from"./c-U4NTUVDZ.js";import{E as Ue,h as Ne,r as Fe,u as kt,y as V,z as me}from"./c-PWJSJEJU.js";import{d as Dt}from"./c-VG5XIN4T.js";import{a as pe}from"./c-2YYDMLNZ.js";import{d as Et,e as wt,g as At,h as Tt}from"./c-HA6INT6J.js";import{k as _t}from"./c-ICMAOOGK.js";var An="clay:debug:autosave";function ve(){try{return localStorage.getItem(An)==="true"}catch{return!1}}function ge(){return import("./c-CFHW5AMY.js").catch(e=>(console.warn("[autosave-debug] Failed to load the debug logger:",e),null))}function he(e,t){ve()&&ge().then(n=>n?.logSaveCheck(e,t))}function re(e,t=""){ve()&&ge().then(n=>n?.logBaseline(e,t))}function Xt(e,t){ve()&&ge().then(n=>n?.logUnloadDiffSync(e,t))}function Jt(){ve()&&ge().then(e=>e?.preloadIfEnabled())}var U=Number.NEGATIVE_INFINITY;function Tn({firstDirtyAt:e=U,lastActivityAt:t=U,finishedAt:n=U,costMs:o=0}={}){let r=e??U,i=t??U,a=n??U,f=Math.min(3e4,Math.max(1200,4*o)),u=Math.max(i,a)+1500,m=Math.max(r+1e4,a+f);return Math.max(a+1200,Math.min(u,m))}function Zt({now:e=()=>Date.now(),setTimer:t=(r,i)=>setTimeout(r,i),clearTimer:n=r=>clearTimeout(r),run:o=()=>{}}={}){let r=null,i=null,a=U,f=0,u=null,m=null,c=!1,p=!1;function S(){return Tn({firstDirtyAt:r,lastActivityAt:i,finishedAt:a,costMs:f})}function y(){if(!c||p)return;let E=S();if(u!==null){if(m===E)return;n(u)}m=E,u=t(d,Math.max(0,E-e()))}function d(){if(u=null,m=null,!(!c||p)){if(e()<S()){y();return}g()}}function g(){c=!1,p=!0,r=null,i=null;let E;try{E=o()}catch{l();return}Promise.resolve(E).then(l,l)}function l(){p=!1,a=e(),c&&y()}function s({at:E=e()}={}){r===null&&(r=E),i=E,c=!0,y()}function v(){c=!0,y()}function M(E){E>0&&(f=Math.max(E,f*.8))}return{noteActivity:s,request:v,noteCost:M,dueAt:S,costEstimate:()=>f,pending:()=>c||p,running:()=>p}}Fe(e=>{for(let t of Tt)e.removeAttribute(t)});Fe(e=>{for(let t of[...Et,...wt,...At])e.removeAttribute(t)});var x=null;function w(e,t="",n="",o=null){x&&(clearTimeout(x),x=null),document.documentElement.setAttribute("savestatus",e);let r=new CustomEvent(`clay:save-${e}`,{detail:{msg:t,msgType:n,timestamp:Date.now(),...o||{}}});document.dispatchEvent(r),Mn(e,r.detail)}var an=Symbol.for("clay.saveFailureClaimed"),Br=e=>{e?.detail&&(e.detail[an]=!0)},Ee=null,un=()=>(Ee??=import("./c-BOMQIQ3V.js").catch(e=>{throw Ee=null,e}),Ee),Cn=()=>{un().then(e=>e.warm(),()=>{})};for(let e of["beforeinput","keydown","pointerdown"])document.addEventListener(e,Cn,{once:!0,capture:!0});function Mn(e,t){if(e==="saved"){Ee?.then(n=>n.clearFailures(),()=>{});return}e!=="error"&&e!=="offline"||t?.[an]||un().then(n=>n.reportFailure(e),n=>{console.error("clayjs: a save failed and the notice for it could not be downloaded",n)})}function ot(){x&&(clearTimeout(x),x=null),document.documentElement.setAttribute("savestatus","offline")}function xn(){x=setTimeout(()=>{w("saving")},500)}window.addEventListener("offline",()=>{ot()});window.addEventListener("online",()=>{document.documentElement.getAttribute("savestatus")==="offline"&&I().then(e=>{e.msgType==="skipped"&&document.documentElement.getAttribute("savestatus")==="offline"&&document.documentElement.setAttribute("savestatus","saved")})});var q=!1,k="",C="",ie=0,we=new Set,D=!1,L=!1,Ae=!1,B=0,je=!1;function Pn(){B++}function ln(){B!==0&&(B--,!(B>0)&&(fe&&(fe=!1,Z=setTimeout(mt,0)),je&&(je=!1,Oe())))}function _n(){return B>0}var Y=0,ne=!1,ae=!1,Te=!1;function de(e=null){return Y===0||dn(e)}function st(){return ne}function Dn(){if(ne)return!0;try{let e=V({flushUndo:!1});return St(e)?!1:e!==C}catch{return!0}}function Ln(){let e="idle",t=0;return{get phase(){return e},get open(){return e==="open"},changedWhileClosed(){return e==="quiesced"&&Ge()!==t},start(){e==="idle"&&(e="open")},quiesce(){e==="open"&&(e="quiesced",t=Ge(),Y++)},resume(){e==="quiesced"&&(e="open",Y--,!(Y>0)&&(zn(),on()))},stop(){if(e==="stopped")return;let n=e==="quiesced";(n||e==="open")&&Dn()&&(Te=!0),e="stopped",n&&(Y--,Y===0&&on())}}}var en=!1,oe=null,ze=null,Xe=!1;function Hr(e=b){if(!oe||oe.generation!==e)return null;let{bytes:t,etag:n}=oe;return{bytes:t,etag:n}}function Gr({represented:e}={}){let t=R(),{forComparison:n,forDirty:o}=me(),r=typeof e?.etag=="string"&&e.etag?e.etag:null;return!(Xe&&r!==null&&r!==ze)&&Te&&(n!==k||o!==C)?{ok:!1,code:"pending-input"}:(Te=!1,ue(n,o),W=n,ee=!1,vt=!0,ze=r,Xe=!0,N(t),document.documentElement.setAttribute("savestatus","saved"),document.dispatchEvent(new CustomEvent("clay:baseline-settled")),{ok:!0})}var it=Promise.resolve(!1),Ce=!1,kn=()=>(Ce=!0,bt().catch(()=>!1).then(e=>(Ce=!1,e)));function Wr(){return{id:"clay:save",order:10,prepare(e={}){let t=Ln();return e.initial===!0&&t.start(),{enable(){it=kn();let n=e.represented?.etag;typeof n=="string"&&n&&It(n),e.initial!==!0&&(On(),t.start())},quiesce:()=>t.quiesce(),resume:()=>t.resume(),dispose:()=>t.stop()}}}}function On(){en||(en=!0,Vt(),be(),En(),wn())}var O=0,Je=!1,Me=!1,at="Waiting for the AI edit to be kept or reverted",j=new Map;function Kr(e=at){O++,j.set(e,(j.get(e)||0)+1)}function Qr({replay:e=!0,reason:t=at}={}){let n=j.get(t)||0;if(n===0||(n===1?j.delete(t):j.set(t,n-1),O--,O>0))return;let o=Je,r=Me;Je=!1,Me=!1,e&&(o?I():r&&Oe())}function Vr(){return O>0}function ut(){return O===0?null:j.keys().next().value||at}function fn(e,t){if(O===0)return!1;Je=!0,Q();let n=h(ut());return e(n),t(n),n}var H=!1,se=null;function In(e){se=e??null,!H&&(H=!0,Pn())}function bn(){H&&(H=!1,se=null,ln())}function Ze(){return H}function $r(e){if(!H||se&&e!==se)return;H=!1,se=null,!We()&&$()||(document.documentElement.getAttribute("savestatus")==="conflict"&&document.documentElement.setAttribute("savestatus","saved"),document.dispatchEvent(new CustomEvent("clay:save-conflict-resolved",{detail:{timestamp:Date.now()}}))),document.dispatchEvent(new CustomEvent("clay:save-conflict-released",{detail:{etag:e??null}})),ln()}function h(e){return{ok:!1,msg:e,msgType:"skipped",code:null,etag:null}}function lt(e){return($()||F())&&(ne=!0),h(e)}function cn(){return{ok:!1,msg:"You are not allowed to save this document.",msgType:"forbidden",code:"forbidden",status:403,sent:!1,etag:null}}function ft(){return Pt()===!1}var ct=new Set,b=0;function Yr(){return b}function jr(e){typeof e=="number"&&(b=e)}function Rn(e=b){let t=Object.freeze({generation:e});return ct.add(t),t}function Nn(e){ct.delete(e)}function dn(e){return!!e&&ct.has(e)&&e.generation===b}function z(e,t){e!=null&&zt({captureId:e,ok:t.ok===!0,etag:t.etag??null})}function Fn(e,t,n,o,r,i=null,a=null,f=!1){if(z(a,e),e.ok)ne=!1,ue(t,n),xe=i,oe={bytes:i,etag:qe(),generation:b},ze=oe.etag,Xe=!0,Te=!1,q=!1,N(r),w("saved",e.msg||"Saved",e.msgType,{etag:e.etag??null,captureId:a}),re(o,`${k.length} chars`),bn();else if(e.msgType==="conflict"){if(f){x&&(clearTimeout(x),x=null),document.documentElement.setAttribute("savestatus","saved");return}In(e.conflictEtag),w("conflict",e.msg,e.msgType,{hadTimeout:e.hadTimeout===!0,changedBy:e.changedBy??null,afterTimeout:e.afterTimeout===!0,etag:e.conflictEtag??null,code:e.code??null,reason:e.reason??null,retryAfter:e.retryAfter??null,captureId:a})}else if(e.msgType!=="skipped"){let u={status:e.status??null,hadTimeout:e.hadTimeout===!0,code:e.code??null,reason:e.reason??null,retryAfter:e.retryAfter??null,captureId:a};navigator.onLine?w("error",e.msg,"",u):w("offline",e.msg,"",u)}}function pn(){if(!(!D&&!L)&&!Ht()){if(D){D=!1,L=!1,I();return}L=!1,nt.request()}}function zr(){return q}function Xr(e){q=e}function Jr(){return k}function dt(){return C}var xe=null;function Zr(){return xe}function ue(e,t){k=e,C=t,ie++}function eo(e){ue(e,e)}var G=()=>typeof performance<"u"&&performance.now?performance.now():Date.now();var Un=4,tn="Save cancelled: the page changed while it prepared",X=null,le=null,Qe=null,mn=!1;function vn(){return Qe||(Qe=import("./c-OG6GFSUX.js").then(e=>(le=e,e),e=>(mn=!0,console.info("clayjs: sliced save off ("+(e&&e.message?e.message:e)+"); saves prepare in one task"),null))),Qe}function qn(){try{return performance.getEntriesByType("navigation")[0]?.decodedBodySize||0}catch{return 0}}var Bn=()=>typeof xe=="string"?xe.length:qn();function Pe(){return mn||document.hidden||Bt()?!1:Bn()>=307200}function nn(e,t,n){return n?"morph":b!==t.generation||!A?"mode":de(e.permit)?ft()?"refused":ie!==t.baselines?"newer save":Math.max(He(),e.blockeditorFormatFloor)>t.floor?"floor":null:"session"}function Hn(e=150,t=2e3){return new Promise(n=>{let o=G(),r=null,i=()=>{document.removeEventListener("clay:sync-applied",a),n()},a=()=>{clearTimeout(r),r=setTimeout(i,Math.max(0,Math.min(e,t-(G()-o))))};document.addEventListener("clay:sync-applied",a),a()})}async function pt({explicit:e,forced:t=!1,forSave:n,forComparison:o,forDirty:r,captureId:i,gateToken:a,costMs:f,blockeditorFormatFloor:u=0,quietConflict:m=!1,laneHeld:c=!1,lane:p=null,capture:S,noteRecovery:y,release:d,callback:g}){if(y(),e&&!t){if(q=r!==C,he("savePage dirty check",!q),!q){Q(),N(a),d();let s=h("No changes to save");return z(i,s),typeof g=="function"&&g(s),{result:s,dispatched:!1}}}else if(!e){let s=!ee||o!==W,v=o!==k;if(he("throttled vs baseline",!s),he("throttled vs lastSave",!v),!(s&&v)){let M=!1;try{M=!v&&(!document.querySelector(_t)||$()&&r===C)}catch(yt){console.error("savePageThrottled: dirty domain check failed",yt)}M&&N(a),nt.noteCost(f),d();let E=h("No changes to save");return z(i,E),typeof g=="function"&&g(E),{result:E,dispatched:!1}}if(q=!0,!c&&P()){D=!0,d();let M=h("Save already in progress");return z(i,M),typeof g=="function"&&g(M),{result:M,dispatched:!1}}}xn();let l={forComparison:o,forDirty:r};return we.add(l),Ae=!0,new Promise(s=>{Gt(n,i,v=>{Ae=!1,we.delete(l);let M=G();Fn(v,l.forComparison,l.forDirty,t?"updated after force save":"updated after save",a,n,i,m),e||nt.noteCost(f+(G()-M)),typeof g=="function"&&g(v),s({result:v,dispatched:!0}),c||pn()},{capture:S,blockeditorFormatFloor:u,lane:p})})}async function Gn(e,t){let n={over:!1},o=()=>{n.over=!0};document.addEventListener("clay:sync-applied",o);try{for(let i=0;i<2;i++){let a=R(),f={generation:b,baselines:ie,floor:Math.max(He(),e.blockeditorFormatFloor)},u=le.beginSaveCapture({requestRefresh:!0,forRequest:!0,pageFormatMarker:f.floor?{name:Nt,content:String(f.floor)}:null});Yt(u.captureId);let m=null,c={get aborted(){let d=nn(e,f,n.over);return d&&(m=d),!!d}},p;try{p=await le.runPreparedSteps(u.steps(),{budgetMs:Un,signal:c})}catch(d){console.error(`${e.explicit?"savePage":"savePageThrottled"}: preparing the save failed`,d),u.drop();let g={msg:d&&d.message?d.message:"Save failed",msgType:"error",code:d?.code??null,etag:null};return w("error",g.msg,"",{sent:!1,code:g.code}),z(u.captureId,g),typeof e.callback=="function"&&e.callback(g),{result:g,dispatched:!1}}let S=p.aborted?m:nn(e,f,n.over);if(!S){let d=p.result;return await pt({explicit:e.explicit,forced:e.forced,forSave:d.forSave,forComparison:d.forComparison,forDirty:d.forDirty,captureId:d.captureId,gateToken:a,costMs:p.activeMs,blockeditorFormatFloor:e.blockeditorFormatFloor,quietConflict:e.quietConflict,laneHeld:!0,lane:t,capture:d,noteRecovery:()=>jt(d.captureId,d.forSave),release:()=>u.drop(),callback:e.callback})}u.drop();let y=h(tn);if(S==="session"&&(ae=!0),z(u.captureId,y),!(S==="floor"&&i===0)){if(S==="morph"&&e.explicit&&i===0){await Hn(),n.over=!1;continue}return typeof e.callback=="function"&&e.callback(y),{result:y,dispatched:!1}}}let r=h(tn);return typeof e.callback=="function"&&e.callback(r),{result:r,dispatched:!1}}finally{document.removeEventListener("clay:sync-applied",o),qt(t)}}function gn(e){let t=Ut();if(!t)return!1;let n=Gn(e,t).catch(o=>{console.error("save: preparing the save failed",o);let r={msg:o&&o.message?o.message:"Save failed",msgType:"error",code:o?.code??null,etag:null};return w("error",r.msg,"",{sent:!1,code:r.code}),typeof e.callback=="function"&&e.callback(r),{result:r,dispatched:!1}});return X=n,n.then(o=>{X===n&&(X=null),e.resolve(o.result),e.settleSoonQueued(o.result),(o.dispatched||D||L||Le.length)&&pn()}),!0}function ke(e,t=()=>{}){return Ce?it.then(()=>ke(e,t)):te?ce.then(()=>De(e,t)):De(e,t)}function _e(e,t){let n=!1,o=setTimeout(()=>{n=!0,w("saving")},500);return e.then(()=>(clearTimeout(o),t())).then(r=>(n&&!P()&&!$()&&document.documentElement.getAttribute("savestatus")==="saving"&&(document.documentElement.setAttribute("savestatus","saved"),document.dispatchEvent(new CustomEvent("clay:save-status",{detail:{state:"saved"}}))),r))}function De({kind:e,permit:t=null},n=()=>{}){let o=e==="explicit";return new Promise(r=>{if(!A&&!window.clay?.testMode){o&&Q();let s=h("Not in edit mode");return T().forEach(v=>v(s)),n(s),r(s)}if(!de(t)){ae=!0;let s=lt("Save session is quiesced");return o&&T().forEach(v=>v(s)),n(s),r(s)}if(ft()){o&&Q();let s=cn();return w("error",s.msg,"",{code:s.code,status:s.status,sent:!1}),T().forEach(v=>v(s)),n(s),r(s)}if(o){let s=fn(n,r);if(s){T().forEach(v=>v(s));return}if(P()){D=!0;let v=h("Save already in progress");return n(v),r(v)}}else{if(O>0){Me=!0;let s=h(ut());return n(s),r(s)}if(P()&&!ee&&Ae){L=!0;let s=h("Save already in progress");return n(s),r(s)}if(X){L=!0;let s=h("Save already in progress");return n(s),r(s)}if(!ee&&!$()){let s=h("No changes to save");return n(s),r(s)}}let i=window.clay?.source?.ensureForSave?.();if(i)return r(_e(i,()=>De({kind:e,permit:t},n)));if(Pe()&&!le){r(_e(vn(),()=>De({kind:e,permit:t},n)));return}let a=o?T():[],f=s=>a.forEach(v=>v(s));if(!navigator.onLine&&ot(),Pe()&&gn({explicit:o,forced:!1,permit:t,blockeditorFormatFloor:0,quietConflict:!1,settleSoonQueued:f,callback:n,resolve:r}))return;let m=G(),c,p,S,y,d,g=R();try{c=Ue({requestRefresh:!0,forRequest:!0}),{forSave:p,forComparison:S,forDirty:y,captureId:d}=c}catch(s){console.error(`${o?"savePage":"savePageThrottled"}: captureForSaveAndComparison failed`,s),o?(Q(),w("error",s.message,"",{sent:!1,code:s.code??null})):w("error",s.message);let v={msg:s.message,msgType:"error",code:o?s.code??null:null,etag:null};typeof n=="function"&&n(v),r(v),f(v);return}let l=G()-m;pt({explicit:o,forSave:p,forComparison:S,forDirty:y,captureId:d,gateToken:g,costMs:l,capture:c,noteRecovery:()=>Ke({captureId:d,html:p}),release:()=>Ne(c),callback:n}).then(s=>{r(s.result),f(s.result)})})}function I(e=()=>{}){return ke({kind:"explicit"},e)}function Wn(e,t=()=>{}){return ke({kind:"explicit",permit:e},t)}function J(e=()=>{},{quietConflict:t=!1,blockeditorFormatFloor:n=0,permit:o=null}={}){return Ce?it.then(()=>J(e,{quietConflict:t,blockeditorFormatFloor:n,permit:o})):new Promise(r=>{if(!A&&!window.clay?.testMode){let l=h("Not in edit mode");return T().forEach(s=>s(l)),e(l),r(l)}if(!de(o)||o&&!dn(o)){let l=lt("Save session is quiesced");return T().forEach(s=>s(l)),e(l),r(l)}if(ft()){let l=cn();return w("error",l.msg,"",{code:l.code,status:l.status,sent:!1}),T().forEach(s=>s(l)),e(l),r(l)}let i=fn(e,r);if(i){T().forEach(l=>l(i));return}if(P()){D=!0;let l=h("Save already in progress");return T().forEach(s=>s(l)),e(l),r(l)}let a=window.clay?.source?.ensureForSave?.();if(a)return r(_e(a,()=>J(e,{quietConflict:t,blockeditorFormatFloor:n,permit:o})));if(!navigator.onLine&&ot(),Pe()&&!le){r(_e(vn(),()=>J(e,{quietConflict:t,blockeditorFormatFloor:n,permit:o})));return}let u=T(),m=l=>u.forEach(s=>s(l));if(Pe()&&gn({explicit:!0,forced:!0,permit:o,blockeditorFormatFloor:n,quietConflict:t,settleSoonQueued:m,callback:e,resolve:r}))return;let c,p,S,y,d,g=R();try{c=Ue({requestRefresh:!0,forRequest:!0}),{forSave:p,forComparison:S,forDirty:y,captureId:d}=c}catch(l){console.error("savePageForce: captureForSaveAndComparison failed",l),w("error",l.message,"",{sent:!1,code:l.code??null});let s={msg:l.message,msgType:"error",code:l.code??null,etag:null};typeof e=="function"&&e(s),r(s),m(s);return}pt({explicit:!0,forced:!0,forSave:p,forComparison:S,forDirty:y,captureId:d,gateToken:g,costMs:0,blockeditorFormatFloor:n,quietConflict:t,capture:c,noteRecovery:()=>Ke({captureId:d,html:p}),release:()=>Ne(c),callback:e}).then(l=>{r(l.result),m(l.result)})})}Kt(e=>J(()=>{},{permit:e}));function Kn(e){let t=["clay:save-saved","clay:save-error","clay:save-offline","clay:save-conflict"];return new Promise((n,o)=>{let r=null,i=()=>{clearTimeout(r);for(let u of t)document.removeEventListener(u,a)},a=()=>{i(),n()},f=e-Date.now();if(f<=0){o(Object.assign(new Error("Save timed out."),{state:"failed"}));return}r=setTimeout(()=>{i(),o(Object.assign(new Error("Save timed out."),{state:"failed"}))},f);for(let u of t)document.addEventListener(u,a)})}function _(e,t){return Object.assign(new Error(e),{state:t})}function Qn(e,t){return new Promise((n,o)=>{let r=t-Date.now();if(r<=0)return o(_("Save timed out.","failed"));let i=setTimeout(()=>{document.removeEventListener(e,a),o(_("Save timed out.","failed"))},r),a=()=>{clearTimeout(i),n()};document.addEventListener(e,a,{once:!0})})}async function to({keepalive:e=!1,timeoutMs:t=15e3,permit:n=null}={}){if(!A)return{state:"view",etag:null};let o=Date.now()+t,r=n||Rn(),i={over:!1},a=null,f=new Promise((u,m)=>{a=setTimeout(()=>m(Object.assign(_("Save timed out.","failed"),{timedOut:!0})),Math.max(0,t))});try{return await Promise.race([Vn(e,o,r,i),f])}catch(u){throw u&&typeof u.state=="string"?u:_(u?.message||"Save failed","failed")}finally{i.over=!0,clearTimeout(a),n||Nn(r)}}async function Vn(e,t,n,o={over:!1}){if(hn()||await Qn("clay:baseline-settled",t),o.over)return null;let r=!1,i=null;for(let a=0;a<4;a++){if(X&&(await X,o.over)||P()&&(await Kn(t),o.over))return null;if(Ze())throw _("This document has a conflict to resolve.","conflict");let f=R();if(!rt()){if(N(f),F())throw _("This document has unsaved work a save cannot write.","blocked");return ne=!1,{state:r?"saved":"clean",etag:i??qe()}}if(o.over)return null;let u=await Ft(e,()=>Wn(n));if(u.msgType!=="skipped"){if(!u.ok)throw _(u.msg||"Save failed",u.msgType==="conflict"||Ze()?"conflict":"failed");r=!0,i=u.etag??null}}throw _("The document kept changing while saving.","failed")}async function no(e=()=>{}){return await Be({fresh:!0}),J(e)}function ro(e){!A||K||Wt(e,t=>{t.ok?window.location.reload():t.msgType==="skipped"?w("error",t.msg||"Template not saved"):w("error",t.msg||"Failed to save template")})}var $n=Ot(e=>ke({kind:"automatic"},e),1200),Yn=250,jn=1e3,Z=null,rn=0,et=[],Le=[],fe=!1,T=()=>{let e=Le;return Le=[],e};function mt(){if(Z=null,B>0||!de()){fe=!0;return}let e=et;if(et=[],P()){Le.push(...e),I();return}I().then(t=>e.forEach(n=>n(t)))}function oo(){let e=Date.now();return Z===null?rn=e:clearTimeout(Z),new Promise(t=>{et.push(t),Z=setTimeout(mt,Math.max(0,Math.min(Yn,rn+jn-e)))})}function zn(){ae&&(ae=!1,Oe())}function on(){fe&&(fe=!1,Z=setTimeout(mt,0))}var W="",ee=!0,vt=!1;function hn(){return vt}var Ve=!1,Xn=250,Jn=1250,$e=null,Sn="clay:paint-heal:"+location.pathname;function yn(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)|0;return String(t>>>0)}function Zn(e){try{return localStorage.getItem(Sn)===yn(e)}catch{return!1}}function er(e){try{localStorage.setItem(Sn,yn(e))}catch{}}function tr(){return Dt(kt({flushUndo:!1}))}function so(e){!A||K||(clearTimeout($e),$e=setTimeout(async()=>{$e=null,te&&await ce;let t=typeof e=="function"?e():e;t==null||!We()||!hn()||Ze()||_n()||V({flushUndo:!1})===C&&t!==tr()&&(Zn(t)||(er(t),J(()=>{},{quietConflict:!0})))},Xn+Math.random()*Jn))}var Se=null,Ye=null,te=0,ce=Promise.resolve(),gt=!1,ht=[];function nr(){return Ye??=import("./c-KNPDOMDY.js").catch(e=>(Ye=null,console.error("style-comparisons failed to load",e),null)),Ye}async function rr(e){try{if(Se||(Se=(await nr())?.styleComparisonStripper??null),!Se)return;let t=Se(e);k=t(k),C=t(C),W=t(W);for(let n of we)n.forComparison=t(n.forComparison),n.forDirty=t(n.forDirty)}catch(t){console.error("style adoption failed",t)}finally{te--,ht.shift()}}var ye=e=>e.replace(/&/g,"&").replace(/"/g,""");function or(e){if(e.name!==void 0){let n=[`data-name="${ye(e.name)}"`];return e.legacyId!==void 0&&n.push(`id="${ye(e.legacyId)}"`),n}let t=[ye(e.href)];try{let{pathname:n}=new URL(e.href);n&&t.push(ye(n))}catch{}return t}function sr(e){let t=[k,C,W];for(let n of we)t.push(n.forComparison,n.forDirty);return t.some(n=>n&&e.some(o=>o&&n.includes(o)))}function ir(e,t){let n=[];for(let{markers:i,tag:a}of t)for(let f of i)for(let u=e.indexOf(f);u>=0;u=e.indexOf(f,u+f.length)){let m=e.lastIndexOf("<",u);if(m<0||e.slice(m+1,m+1+a.length).toLowerCase()!==a)continue;let c=a==="style"?e.indexOf("</style",u):u;if(c<0)continue;let p=e.indexOf(">",c);p>=0&&n.push([m,p+1])}n.sort((i,a)=>i[0]-a[0]);let o="",r=0;for(let[i,a]of n)i<r||(o+=e.slice(r,i),r=a);return o+e.slice(r)}$t(e=>{let t=or(e);sr(t)&&(te||(gt=!1),te++,ht.push({markers:t,tag:e.name!==void 0?"style":"link"}),ce=ce.then(()=>rr(e)))});function io(){return ce}function St(e){return!te||gt||F()||P()||D||L||ne||typeof e!="string"?!1:e===ir(C,ht)}var ar=500,ur=3e3,lr=1e4,tt=null;function fr(){pe.holdSettle=!1,tt&&tt()}function sn(){if(!A)return;let e=!1,t=null,{forComparison:n,forDirty:o}=me();ue(n,o);let r=ie;W=n,re("immediate capture",`${n.length} chars`);let i=["keydown","pointerdown","drop","input","change","paste"],a=new Set(["Shift","Control","Alt","Meta"]),f=c=>{c.type==="keydown"&&a.has(c.key)||(gt=!0,e||(Ve=!0))};i.forEach(c=>document.addEventListener(c,f,!0));let u=()=>{if(!e){if(e=!0,t&&t(),!Ve&&ie===r){let c=R(),{forComparison:p,forDirty:S}=me();ue(p,S),W=p,N(c),re("settled capture",`${p.length} chars`)}else re("settled skipped",Ve?"user edited":"save occurred during settle");ee=!1,document.documentElement.setAttribute("savestatus","saved"),vt=!0,document.dispatchEvent(new CustomEvent("clay:baseline-settled"))}};tt=u;let m=()=>{pe.holdSettle||u()};t=Lt.onAnyChange({debounce:ar,omitChangeDetails:!0,require:"autosave"},m),setTimeout(()=>{e||m()},ur),setTimeout(()=>{!e&&pe.holdSettle&&fr()},lr)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",sn):sn();function Oe(e=()=>{}){if(!A){let t=h("Not in edit mode");return e(t),Promise.resolve(t)}if(O>0){Me=!0;let t=h(ut());return e(t),Promise.resolve(t)}if(!de()){ae=!0;let t=lt("Save session is quiesced");return e(t),Promise.resolve(t)}if(B>0){je=!0;let t=h("Autosave suspended");return e(t),Promise.resolve(t)}if(!ee&&Ae){L=!0;let t=h("Save already in progress");return e(t),Promise.resolve(t)}return $n(e).catch(t=>{let n={ok:!1,msg:t?.message||"Save failed",msgType:"error",code:null,etag:null};return w("error",n.msg),n})}var nt=Zt({now:G,run:()=>Oe()});function En(){document.addEventListener("keydown",function(e){if((window.navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)&&e.keyCode==83){if(!A)return;e.preventDefault(),e.isTrusted&&Re(),I()}})}function wn(){document.addEventListener("click",e=>{e.target.closest("[trigger-save]")&&(e.isTrusted&&Re(),I())})}function cr(){A&&(Be(),Rt(),be(),En(),wn())}cr();var ao=I;var Ie=!1;function go({isCurrent:e,reload:t}){return e()?(Ie=!0,setTimeout(()=>{Ie=!1},1e3),t(),!0):!1}Jt();function dr(){return st()?!0:A?F()?!0:K?Mt()||xt():window.clay?.demo?!1:rt():!1}function rt(){if(!A)return!1;try{let e=V();return St(e)?!1:e!==dt()}catch{return!0}}window.addEventListener("beforeunload",e=>{if(!A&&!st())return;if(Ie){Ie=!1;return}if(!((!K||Ct())&&!dr())&&(e.preventDefault(),e.returnValue="",!window.clay?.demo&&!F()))try{let n=V(),o=dt();n!==o&&Xt(n,o)}catch{}});export{go as a,dr as b,rt as c,Br as d,Pn as e,ln as f,_n as g,de as h,st as i,Ln as j,Hr as k,Gr as l,Wr as m,Kr as n,Qr as o,Vr as p,ut as q,Ze as r,$r as s,Yr as t,jr as u,Rn as v,Nn as w,zr as x,Xr as y,Jr as z,dt as A,Zr as B,ue as C,eo as D,I as E,J as F,to as G,no as H,ro as I,oo as J,hn as K,tr as L,so as M,io as N,St as O,fr as P,Oe as Q,nt as R,En as S,wn as T,cr as U,ao as V};
|
package/dist/m/c-IUL7PU4P.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as b,b as e}from"./c-UOUUI265.js";import{d as y}from"./c-QHWJ5ZIJ.js";import{c as x}from"./c-SXNSSHPP.js";import{a as T}from"./c-UL2YUY52.js";import{g as H,j as u,n as w,p as N}from"./c-MR75YPRT.js";import{b as h,c as k,e as m}from"./c-5RZNFTWD.js";import{a as v}from"./c-VKEDWYDF.js";function O(t,r,n="",o=!1,l="",a="OK"){let i=y(),c=u("div",["display:flex","flex-direction:column","gap:14px",`font:14.5px/1.55 ${h}`,`color:${m["ink-2"]}`],{theme:i,parts:["dialog.content"],role:"text"}),s=null;o&&(s=N("input",{rules:["display:block","width:100%","margin:0"],theme:i,parts:["dialog.input"]}),s.setAttribute("value",String(l)),s.required=!0,c.append(s)),c.insertAdjacentHTML("beforeend",n),e.title=t,e.html=o||n?c:"",e.width="440px",e[b]=i,e.closeHtml="x",e.no="Cancel",e.yes=a;let d=new Promise((f,g)=>{e.onYes(()=>{let p;if(o&&(p=s.value,!p))return!1;if(r)try{r(p)}catch(C){return x(C.message||"An error occurred","error"),!1}return setTimeout(()=>f(p),0),!0}),e.onNo=()=>{setTimeout(g,0)}});return e.open(),setTimeout(()=>{let f=document.querySelector("[data-clay-modal]");f&&f.addEventListener("click",g=>{let p=g.target.closest("[data-copy]");p&&(T(p.dataset.copy),x("Copied","success"))})},0),d.catch(()=>{}),d}function q(t,r,n="",o=""){return O(t,r,o,!0,n,"OK")}function B(t,r,n=""){return O(t,r,n,!1,"","Confirm")}function F(t,...r){let n=y(),o=u("div",["display:flex","flex-direction:column","gap:12px"],{theme:n,parts:["dialog.content"]});for(let a of r){let i=w("div",[`font:14.5px/1.55 ${h}`,`color:${m["ink-2"]}`,"overflow-wrap:anywhere"],void 0,{theme:n});i.innerHTML=a,o.append(i)}e.title=t,e.html=r.length?o:"",e.width="470px",e[b]=n,e.closeHtml="x",e.yes="OK";let l=new Promise((a,i)=>{e.onYes(()=>(setTimeout(a,0),!0)),e.onNo=()=>{setTimeout(i,0)}});return e.open(),l.catch(()=>{}),l}function R(t,r,n=""){let o=y(),l=u("div",["display:block"],{theme:o,parts:["dialog.content"]}),a=u("div",["display:block","max-width:100%","overflow-x:auto","margin:0 0 14px","padding:14px 16px",`background:${m.sunk}`,`border:1px solid ${m["line-2"]}`],{theme:o,parts:["dialog.well"],role:"well"}),i=w("pre",["display:block","margin:0","white-space:nowrap",`font:13px/1.6 ${k}`],void 0,{theme:o,parts:["dialog.code"],role:"code"});i.innerHTML=r,a.append(i);let c=H("Copy",{small:!0,extra:["margin:0 0 14px"],theme:o,parts:["dialog.button","dialog.copyButton"],labelParts:["dialog.buttonLabel"],onClick:()=>{T(r),x("Copied to clipboard!","success")}});l.append(a,c),l.insertAdjacentHTML("beforeend",n||""),e.title=t,e.html=l,e.width="540px",e[b]=o,e.closeHtml="x",e.yes="";let s=new Promise(d=>{e.onYes(()=>(setTimeout(d,0),!0)),e.onNo=()=>{setTimeout(d,0)}});return e.open(),s}function M(){v(()=>{let t=document.querySelector("[data-clay-modal]");t&&(t.remove(),document.body.style.overflow="")})}M();export{q as a,B as b,F as c,R as d,M as e};
|
package/dist/m/c-JQF2EUCG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as d,b as c,c as o,d as n}from"./c-TWCXBWS3.js";import{a as u}from"./c-VKEDWYDF.js";import{f as a}from"./c-EDE45NM7.js";import{b as l,r as b}from"./c-PWJSJEJU.js";var r="[editmode\\:contenteditable]";function m(){b(e=>{e.querySelectorAll(r).forEach(t=>{n(t),o(t,l(t)??t)})})}function s(){a&&u(()=>{p()})}function p(e=document){e.querySelectorAll(r).forEach(t=>{d(t);let i=t.getAttribute("inert-contenteditable")??t.getAttribute("contenteditable")??c(t,"inert-contenteditable")??"true",f=i.toLowerCase();t.setAttribute("contenteditable",["","true","false","plaintext-only"].includes(f)?i:"true"),t.removeAttribute("inert-contenteditable")})}function y(){document.querySelectorAll(r).forEach(e=>{n(e),o(e)})}function S(){m(),s()}export{r as a,p as b,y as c,S as d};
|