@panphora/clayjs 1.16.0 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all.js +1 -1
- package/dist/clay-dom.js +1 -1
- package/dist/clay-events.js +1 -1
- package/dist/clay-internals.js +1 -1
- package/dist/clay-options.js +1 -1
- package/dist/clay-router.js +1 -1
- package/dist/clay-ui.js +1 -1
- package/dist/clay-utils.js +1 -1
- package/dist/clay.js +1 -1
- package/dist/clay.standalone.js +7917 -5621
- package/dist/m/attrs/refetch-on-save-ZUE7PSCI.js +1 -0
- package/dist/m/attrs/save-freeze-MYNVXREN.js +1 -0
- package/dist/m/c-2YYDMLNZ.js +1 -0
- package/dist/m/c-336SGU5W.js +1 -0
- package/dist/m/c-3H6BZDNJ.js +6 -0
- package/dist/m/{c-LR4CGEPT.js → c-3RUU4TPX.js} +1 -1
- package/dist/m/c-3XIRD4NU.js +1 -0
- package/dist/m/c-4DFEJ2PO.js +3 -0
- package/dist/m/c-56QRZTZH.js +1 -0
- package/dist/m/c-5J4E7O4Y.js +4 -0
- package/dist/m/c-5LKDWQTL.js +19 -0
- package/dist/m/c-5QWQ7A5L.js +1 -0
- package/dist/m/c-5RJFTLSF.js +1 -0
- package/dist/m/c-6AZOGAPE.js +1 -0
- package/dist/m/{c-Y6USGTS5.js → c-6CRUUXOX.js} +5 -5
- package/dist/m/{c-54RCDCBU.js → c-6KEVEQ7L.js} +1 -1
- package/dist/m/{c-LTGMXXKO.js → c-6NC5I2TV.js} +1 -1
- package/dist/m/{c-YDH7Q3NY.js → c-74MGYWZF.js} +1 -1
- package/dist/m/{c-Z36J63PP.js → c-7OLLJPWP.js} +1 -1
- package/dist/m/c-A3E3NIMC.js +1 -0
- package/dist/m/{c-5R4PTRG2.js → c-AMSNPOCX.js} +1 -1
- package/dist/m/c-B3JM5ZXC.js +1 -0
- package/dist/m/c-BPF2NSPV.js +1 -0
- package/dist/m/c-BQ6LOBEE.js +1 -0
- package/dist/m/c-CJ3A7ZKE.js +1 -0
- package/dist/m/c-CQHPGKX2.js +1 -0
- package/dist/m/c-DCXOXBF3.js +1 -0
- package/dist/m/c-DFS4XZJV.js +2 -0
- package/dist/m/{c-F3CKJTJS.js → c-DNENWY4O.js} +1 -1
- package/dist/m/c-E4LIR5X5.js +1 -0
- package/dist/m/c-EVCQ3BKA.js +1 -0
- package/dist/m/{c-5Y6TNX5W.js → c-EZU56NQV.js} +2 -2
- package/dist/m/c-FDNHHZY5.js +1 -0
- package/dist/m/{c-SWRJFCNN.js → c-FRLHSY7E.js} +1 -1
- package/dist/m/c-FROJUZMV.js +1 -0
- package/dist/m/c-G2JPKCTP.js +1 -0
- package/dist/m/c-GB6TU7WV.js +1 -0
- package/dist/m/{c-GB3JTV6E.js → c-GFJJEBTU.js} +1 -1
- package/dist/m/{c-J7CA54IP.js → c-GSFIGKOP.js} +1 -1
- package/dist/m/{c-OYTFP5QN.js → c-GY422N3Q.js} +1 -1
- package/dist/m/c-HAWFNBYG.js +1 -0
- package/dist/m/{c-33HUYEDI.js → c-HDDEEL77.js} +1 -1
- package/dist/m/c-HFKUVACH.js +1 -0
- package/dist/m/c-HHDFCNHV.js +1 -0
- package/dist/m/c-I2ZATQCD.js +2 -0
- package/dist/m/c-IEM4NTCS.js +1 -0
- package/dist/m/c-IW6GGOU2.js +1 -0
- package/dist/m/{c-SGCCC4FW.js → c-JDCX26UP.js} +2 -2
- package/dist/m/c-JRKY44DK.js +1 -0
- package/dist/m/c-JU3NK25H.js +1 -0
- package/dist/m/{c-VFX45IZQ.js → c-KAU6E43D.js} +1 -1
- package/dist/m/c-KBS3UV6B.js +1 -0
- package/dist/m/c-KGVGROZT.js +1 -0
- package/dist/m/{c-YG2NJYS6.js → c-KQ6TYJAP.js} +2 -2
- package/dist/m/{c-2JL6E75N.js → c-KU3ZFADW.js} +1 -1
- package/dist/m/c-LWLBHLVC.js +3 -0
- package/dist/m/c-M2L47S2X.js +7 -0
- package/dist/m/c-MFP2ZWD4.js +1 -0
- package/dist/m/{c-4YSCRICO.js → c-MKSQ4Y57.js} +1 -1
- package/dist/m/{c-2M73252O.js → c-NUFFJVVJ.js} +1 -1
- package/dist/m/c-NUHSPT5P.js +1 -0
- package/dist/m/c-O72HVYSA.js +1 -0
- package/dist/m/c-OW5QIGG3.js +1 -0
- package/dist/m/c-PGRCK73F.js +1 -0
- package/dist/m/{c-4DRMS4QG.js → c-PS5ARVWR.js} +1 -1
- package/dist/m/c-Q622NS2Y.js +1 -0
- package/dist/m/c-Q7NQD65V.js +1 -0
- package/dist/m/c-QH63LQOS.js +1 -0
- package/dist/m/{c-TQZ2JYHD.js → c-QICP2YR5.js} +1 -1
- package/dist/m/{c-7VGZ7RU5.js → c-QJ4OM3G6.js} +1 -1
- package/dist/m/{c-MMUIUUZG.js → c-R3L7ZJGB.js} +1 -1
- package/dist/m/c-R7IWVINQ.js +1 -0
- package/dist/m/{c-HVYXIS72.js → c-RSMOODDU.js} +1 -1
- package/dist/m/{c-KKWLDOPM.js → c-RYUXUUBX.js} +1 -1
- package/dist/m/c-S4ZEH46B.js +9 -0
- package/dist/m/c-SDAXDM2D.js +1 -0
- package/dist/m/c-SMBZG5X4.js +1 -0
- package/dist/m/{c-UXBMRDZB.js → c-SMGU7RT3.js} +1 -1
- package/dist/m/c-SPIORRYS.js +1 -0
- package/dist/m/c-SWLRT66R.js +1 -0
- package/dist/m/c-SZGYW5HT.js +1 -0
- package/dist/m/c-TCJTVAFN.js +1 -0
- package/dist/m/{c-HRDCD3WN.js → c-TJ6WOJL3.js} +1 -1
- package/dist/m/c-TYLXX4NF.js +21 -0
- package/dist/m/c-U62OB4BT.js +1 -0
- package/dist/m/{c-NMJRXKPC.js → c-U6YWUAR3.js} +1 -1
- package/dist/m/c-UDCSU5G5.js +2 -0
- package/dist/m/{c-NZMNXVF6.js → c-UDUUJPFZ.js} +1 -1
- package/dist/m/c-VE6ZMYMC.js +1 -0
- package/dist/m/c-VG5XIN4T.js +1 -0
- package/dist/m/c-VHM5XQHK.js +1 -0
- package/dist/m/c-VI5RMSVY.js +1 -0
- package/dist/m/c-VRZN56XY.js +1 -0
- package/dist/m/c-W5MCHEGA.js +1 -0
- package/dist/m/c-WDC5GVKU.js +1 -0
- package/dist/m/c-WWXIDH4O.js +28 -0
- package/dist/m/{c-QIX5BJYN.js → c-XCNTK76U.js} +1 -1
- package/dist/m/c-XMS6DPBR.js +1 -0
- package/dist/m/c-Y5HBBIQ4.js +1 -0
- package/dist/m/{c-5M4YEKCX.js → c-ZVPVXTJF.js} +1 -1
- package/dist/m/c-ZVRKXKM7.js +1 -0
- package/dist/m/{c-HT33EQRN.js → c-ZWIOJGMT.js} +1 -1
- package/dist/m/core/admin-attrs-QHOKPJ7W.js +1 -0
- package/dist/m/core/autosave-HRYGUWV6.js +1 -0
- package/dist/m/core/conflict-notice-6MROJN2L.js +1 -0
- package/dist/m/core/host-permission-FNXVEFNE.js +1 -0
- package/dist/m/core/is-edit-mode-KTWA3O5N.js +1 -0
- package/dist/m/core/{persist-HKHA66IY.js → persist-JFYRHMRJ.js} +1 -1
- package/dist/m/core/recovery-FLTCC2OC.js +1 -0
- package/dist/m/core/save-HQZ4S667.js +1 -0
- package/dist/m/core/save-core-KGQWFUNH.js +1 -0
- package/dist/m/core/snapshot-EGQZNT45.js +1 -0
- package/dist/m/core/unsaved-warning-IDJLD66H.js +1 -0
- package/dist/m/events/index-RN2JNGBV.js +1 -0
- package/dist/m/internals/index-PVXGPUDA.js +1 -0
- package/dist/m/lib/cache-bust-MUMFXZK6.js +1 -0
- package/dist/m/loader-S4I7GKXR.js +1 -0
- package/dist/m/manifest-4C419D67.js +1 -0
- package/dist/m/manifest-edit-B077F288.js +1 -0
- package/dist/m/manifest.json +1555 -1058
- package/dist/m/options/options-EJMS3K24.js +1 -0
- package/dist/m/page/{editor-XUTB2HB2.js → editor-NNJA4OKD.js} +21 -8
- package/dist/m/plugins/{ai-edit-ZQ4CGWIP.js → ai-edit-QN4PMMNL.js} +1 -1
- package/dist/m/plugins/demo-RM5IR6AO.js +1 -0
- package/dist/m/plugins/indicator-URDBBOQO.js +1 -0
- package/dist/m/plugins/live-HFWD4OIH.js +1 -0
- package/dist/m/plugins/{menu-HCKO3DSP.js → menu-3HIEQSI6.js} +2 -2
- package/dist/m/plugins/page-JOKB6XPR.js +2 -0
- package/dist/m/plugins/page-view-NXOJHNW6.js +1 -0
- package/dist/m/plugins/people-SGPJKANK.js +1 -0
- package/dist/m/plugins/{richclay-RC3L2F6X.js → richclay-NRQDSWX6.js} +2 -2
- package/dist/m/plugins/sortable-GWT4PWDV.js +1 -0
- package/dist/m/plugins/source-4ZRSAIYM.js +1 -0
- package/dist/m/plugins/undo-VDA5P7FH.js +1 -0
- package/dist/m/plugins/{upgrade-ZNYODP5Y.js → upgrade-W7FG5VFG.js} +1 -1
- package/dist/m/plugins/upload-WLYKK6TL.js +1 -0
- package/dist/m/plugins/visitor-drafts-LIDY7NH6.js +21 -0
- package/dist/m/plugins/visitor-drafts-owner-ZXCKBZE7.js +1 -0
- package/dist/m/plugins/wire-4N6GYAF6.js +1 -0
- package/dist/m/{reader-core-ILWLXVMP.js → reader-core-DXYCURFF.js} +2 -2
- package/dist/m/sync/live-sync-J7VMYTKS.js +1 -0
- package/dist/m/ui/{index-EVHKMKBL.js → index-3JLVI27O.js} +1 -1
- package/dist/offline-manifest.json +857 -623
- package/dist/page/themes/light-1.css +25 -1
- package/dist/server/core.cjs +115 -24
- package/package.json +1 -1
- package/src/core/boot-phase.js +2 -1
- package/src/core/conflict-download.js +3 -29
- package/src/core/download.js +32 -0
- package/src/core/host-meta.js +18 -0
- package/src/core/save-core.js +8 -4
- package/src/core/save.js +4 -4
- package/src/core/snapshot.js +39 -1
- package/src/lib/autosave-scheduler.js +3 -4
- package/src/page/blocks.js +34 -1
- package/src/page/board-views.js +2 -16
- package/src/page/chart-tables.js +11 -0
- package/src/page/chart.js +6 -10
- package/src/page/checkpoint-proof.js +289 -0
- package/src/page/chrome.js +24 -6
- package/src/page/document-title-dom.js +12 -0
- package/src/page/document-title-runtime.js +15 -1
- package/src/page/document-title.js +4 -1
- package/src/page/editor.js +77 -12
- package/src/page/emoji-data.js +162 -0
- package/src/page/features/board.js +12 -3
- package/src/page/features/chart.js +11 -0
- package/src/page/features/dates.js +180 -0
- package/src/page/features/emoji.js +187 -0
- package/src/page/features/mentions.js +188 -0
- package/src/page/features/registry.js +6 -1
- package/src/page/features/table.js +2 -2
- package/src/page/format-command.js +9 -0
- package/src/page/format-host.js +54 -0
- package/src/page/format-native-commands.js +142 -0
- package/src/page/format-native.js +42 -0
- package/src/page/inline.js +32 -8
- package/src/page/items.js +15 -3
- package/src/page/markdown.js +26 -2
- package/src/page/mention-picker.js +99 -0
- package/src/page/merge.js +1 -1
- package/src/page/projection.js +58 -15
- package/src/page/save-projection.js +39 -0
- package/src/page/save-states.js +1 -1
- package/src/page/schema.js +33 -0
- package/src/page/themes/content.css +25 -1
- package/src/page/themes/light-1.css +25 -1
- package/src/page/view-hooks.js +32 -0
- package/src/page/ybind/binding.js +31 -4
- package/src/page/ybind/marks.js +2 -1
- package/src/page/ybind/provider.js +13 -2
- package/src/page/ybind/recovery-replay.js +362 -4
- package/src/plugins/live.js +37 -1
- package/src/plugins/page.js +117 -3
- package/src/plugins/visitor-drafts/intro.js +2 -1
- package/src/server/checkpoint/index.js +2 -2
- package/src/sync/saved-stream.js +17 -8
- package/dist/m/attrs/refetch-on-save-NWPPXOCZ.js +0 -1
- package/dist/m/attrs/save-freeze-FUP4Q4X3.js +0 -1
- package/dist/m/c-35NBGMZB.js +0 -1
- package/dist/m/c-3IQRECYS.js +0 -1
- package/dist/m/c-4B6H4G5V.js +0 -1
- package/dist/m/c-4FFHZM32.js +0 -1
- package/dist/m/c-66O32MV3.js +0 -28
- package/dist/m/c-7O6AFR65.js +0 -1
- package/dist/m/c-ANQTJ3B5.js +0 -2
- package/dist/m/c-AYVOREBE.js +0 -1
- package/dist/m/c-B2ZXPOS3.js +0 -3
- package/dist/m/c-BMIZKMPV.js +0 -1
- package/dist/m/c-CJZSLMVQ.js +0 -1
- package/dist/m/c-DBE6ORSI.js +0 -1
- package/dist/m/c-EDHUR4MX.js +0 -1
- package/dist/m/c-EY6UOM54.js +0 -1
- package/dist/m/c-F7Y6FLPY.js +0 -1
- package/dist/m/c-FA4DZVTC.js +0 -1
- package/dist/m/c-G2BUZITR.js +0 -1
- package/dist/m/c-GBGWXTX4.js +0 -1
- package/dist/m/c-GHBCCVG4.js +0 -1
- package/dist/m/c-IB52R237.js +0 -1
- package/dist/m/c-IKWNE4R4.js +0 -1
- package/dist/m/c-IU3IYEU6.js +0 -1
- package/dist/m/c-IZ2EBRAJ.js +0 -1
- package/dist/m/c-KR4UW4KW.js +0 -1
- package/dist/m/c-KY3VJGUA.js +0 -8
- package/dist/m/c-LXENEBV7.js +0 -1
- package/dist/m/c-PPOSCAQD.js +0 -1
- package/dist/m/c-QQHEX6HA.js +0 -1
- package/dist/m/c-R7RMANJI.js +0 -9
- package/dist/m/c-RI4NT75Y.js +0 -1
- package/dist/m/c-RUJKSUQW.js +0 -1
- package/dist/m/c-T4VO4OCB.js +0 -1
- package/dist/m/c-TR6RMDQ7.js +0 -3
- package/dist/m/c-UKHTLWUW.js +0 -1
- package/dist/m/c-UNN7LWCT.js +0 -1
- package/dist/m/c-V7PZZRG7.js +0 -1
- package/dist/m/c-VL52ADDR.js +0 -1
- package/dist/m/c-WWDBYXLK.js +0 -1
- package/dist/m/c-XNNW2CWK.js +0 -1
- package/dist/m/c-Z4VRC7GU.js +0 -7
- package/dist/m/c-Z6K52OLP.js +0 -19
- package/dist/m/c-ZDY2MDAA.js +0 -21
- package/dist/m/core/admin-attrs-VGNLAUDK.js +0 -1
- package/dist/m/core/autosave-E4PEFPZ6.js +0 -1
- package/dist/m/core/conflict-notice-VQ6Y64PH.js +0 -1
- package/dist/m/core/host-permission-XN3K2IW3.js +0 -1
- package/dist/m/core/is-edit-mode-JXHDVGUL.js +0 -1
- package/dist/m/core/recovery-TBBSICE2.js +0 -1
- package/dist/m/core/save-WUCHTQBE.js +0 -1
- package/dist/m/core/save-core-FJVHT5M3.js +0 -1
- package/dist/m/core/snapshot-F3SWDZMM.js +0 -1
- package/dist/m/core/unsaved-warning-STKBHE6G.js +0 -1
- package/dist/m/events/index-23DPTUT4.js +0 -1
- package/dist/m/internals/index-WOVAP3RU.js +0 -1
- package/dist/m/lib/cache-bust-CGWT6ZJI.js +0 -1
- package/dist/m/loader-HXX6YNH5.js +0 -1
- package/dist/m/manifest-F22DEDAC.js +0 -1
- package/dist/m/manifest-edit-C3C7376B.js +0 -1
- package/dist/m/options/options-2LH76JQ3.js +0 -1
- package/dist/m/plugins/demo-ZIBFAA3R.js +0 -1
- package/dist/m/plugins/indicator-PV4YW2ID.js +0 -1
- package/dist/m/plugins/live-NUTTXSBS.js +0 -1
- package/dist/m/plugins/page-KSUH7G6J.js +0 -2
- package/dist/m/plugins/page-view-W73OW7WI.js +0 -1
- package/dist/m/plugins/people-AJJ32YCG.js +0 -1
- package/dist/m/plugins/sortable-YRMQX3ZU.js +0 -1
- package/dist/m/plugins/source-KHK5UUSK.js +0 -1
- package/dist/m/plugins/undo-OF2L3CXU.js +0 -1
- package/dist/m/plugins/upload-XSGNILUY.js +0 -1
- package/dist/m/plugins/visitor-drafts-XK5GW55Q.js +0 -21
- package/dist/m/plugins/visitor-drafts-owner-KSSH75EV.js +0 -1
- package/dist/m/plugins/wire-ZWVWKF76.js +0 -1
- package/dist/m/sync/live-sync-4AUVXVJU.js +0 -1
- /package/dist/m/plugins/{richclay-RC3L2F6X.js.LEGAL.txt → richclay-NRQDSWX6.js.LEGAL.txt} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as Ge,c as Ye}from"../c-7DJDKPGL.js";import{g as te}from"../c-QJ4OM3G6.js";import{a as ee}from"../c-WYFDLITL.js";import"../c-ZWIOJGMT.js";import"../c-IJUK2GPW.js";import{j as Fe}from"../c-OW5QIGG3.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import{a as Xe}from"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import{l as Je}from"../c-HA6INT6J.js";import"../c-DCFSEJZG.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";var Ze=(()=>{var d=Object.defineProperty,c=Object.getOwnPropertyDescriptor,b=Object.getOwnPropertyNames,w=Object.prototype.hasOwnProperty,N=(e,r)=>{for(var t in r)d(e,t,{get:r[t],enumerable:!0})},B=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of b(r))!w.call(e,i)&&i!==t&&d(e,i,{get:()=>r[i],enumerable:!(n=c(r,i))||n.enumerable});return e},F=e=>B(d({},"__esModule",{value:!0}),e),C={};N(C,{default:()=>Ht,undo:()=>de});function X(e,r=null){let t=[];if(e.type==="attributes"){let n=e.target,i=e.attributeName,a=e.oldValue,l=n.getAttribute(i);return a==null&&l!=null?t.push({kind:"attr-add",target:n,name:i,newValue:l}):a!=null&&l==null?t.push({kind:"attr-remove",target:n,name:i,oldValue:a}):a!==l&&t.push({kind:"attr-set",target:n,name:i,oldValue:a,newValue:l}),t}if(e.type==="characterData")return t.push({kind:"text",target:e.target,oldValue:e.oldValue,newValue:e.target.data}),t;if(e.type==="childList"){let n=e.target,i=e.nextSibling,a=e.nextSibling;for(;a&&r?.(a);)a=a.nextSibling;let l=e.previousSibling;for(;l&&r?.(l);)l=l.previousSibling;let s=r?Array.from(e.addedNodes).filter(v=>!r(v)):Array.from(e.addedNodes),m=r?Array.from(e.removedNodes).filter(v=>!r(v)):Array.from(e.removedNodes);return s.length>0&&t.push({kind:"add",parent:n,nodes:s,before:i,afterAuthored:a,beforeAuthored:l,record:e}),m.length>0&&t.push({kind:"remove",parent:n,nodes:m,before:i,afterAuthored:a,beforeAuthored:l,record:e}),t}return t}function it(e,r=null){let t=[],n=new Map;for(let i of e){if(i.type==="attributes"){let a=i.target,l=i.attributeName,s=n.get(a);s||(s=new Map,n.set(a,s)),s.has(l)||(s.set(l,{idx:t.length,oldValue:i.oldValue}),t.push(null));continue}for(let a of X(i,r))t.push(a)}for(let[i,a]of n)for(let[l,s]of a){let m=s.oldValue,v=i.getAttribute(l),h=null;m===v?h=null:m==null?h={kind:"attr-add",target:i,name:l,newValue:v}:v==null?h={kind:"attr-remove",target:i,name:l,oldValue:m}:h={kind:"attr-set",target:i,name:l,oldValue:m,newValue:v},t[s.idx]=h}return t.filter(i=>i!=null)}function at(e){let r=[],t=new Map;for(let i of e){let a=be(i);if(a==null){r.push(i);continue}let l=t.get(i.target);l||(l=new Map,t.set(i.target,l));let s=l.get(a);if(s==null){let m=ve(i);if(m.oldValue===m.newValue)continue;l.set(a,r.length),r.push({...i,...m})}else r[s]={...r[s],newValue:ve(i).newValue}}let n=[];for(let i of r){if(be(i)==null){n.push(i);continue}i.oldValue!==i.newValue&&n.push(lt(i))}return n}var ut=new Set(["attr-set","attr-add","attr-remove","text","value"]);function be(e){return ut.has(e.kind)?e.kind==="text"?"#text":e.kind==="value"?`#${e.prop||"value"}`:e.name==null?null:`@${e.name}`:null}function ve(e){return e.kind==="attr-add"?{oldValue:null,newValue:e.newValue}:e.kind==="attr-remove"?{oldValue:e.oldValue,newValue:null}:{oldValue:e.oldValue,newValue:e.newValue}}function lt(e){return e.kind!=="attr-add"&&e.kind!=="attr-remove"?e:e.oldValue==null&&e.newValue!=null?{...e,kind:"attr-add"}:e.oldValue!=null&&e.newValue==null?{...e,kind:"attr-remove"}:{...e,kind:"attr-set"}}var ke=new WeakMap,dt=0;function O(e){let r=ke.get(e);return r||(r=`n${++dt}`,ke.set(e,r)),r}function x(e){return!!e&&typeof e=="object"&&typeof e.nodeType=="number"}function st(e){return e.kind==="add"||e.kind==="remove"}function Ae(e,r){let t=[],n=e.childNodes;if(!n)return t;for(let i of n)r&&r(i)||t.push(O(i));return t}function W(e,r,t=null,n=null){if(!x(e))return null;if(e.nodeType===3)return`#text:${JSON.stringify(e.data)}`;if(e.nodeType===8)return`#comment:${JSON.stringify(e.data)}`;if(e.nodeType!==1)return`#node:${e.nodeType}`;let i=[];if(e.attributes){for(let l of e.attributes)ct(l.name,e,r,t)||i.push(`${l.name}=${JSON.stringify(l.value)}`);i.sort()}let a=[];if(e.childNodes)for(let l of e.childNodes)ft(l,n)||a.push(W(l,r,t,n));return`<${String(e.tagName||"").toLowerCase()}${i.length?` ${i.join(" ")}`:""}>${a.join("")}</>`}function ne(e,r=[]){if(!x(e))return r;if(e.nodeType===1){let t=e.getAttribute&&e.getAttribute("data-id");t&&r.push(t)}if(e.childNodes)for(let t of e.childNodes)ne(t,r);return r}function ct(e,r,t,n=null){if(typeof t!="function")return!1;try{return!!t(e,r,n)}catch{return!1}}function ft(e,r){if(typeof r!="function")return!1;try{return!!r(e)}catch{return!1}}function Ee(e,r){if(typeof r!="function")return[];let t=[],n=i=>{if(!x(i))return;let a=!1;try{a=!!r(i)}catch{a=!1}if(a&&t.push(R(i,"protected")),i.childNodes)for(let l of i.childNodes)n(l)};for(let i of e)n(i);return t}function R(e,r,t=null){let n=e;n&&n.nodeType!==1&&(n=n.parentElement);let i=n&&typeof n.closest=="function"?n.closest("[data-id]"):null;return!i&&t&&typeof t.closest=="function"&&(i=t.closest("[data-id]")),{id:(i?i.getAttribute("data-id"):null)||null,kind:r||null}}function pt(e,r,t=null){return(e||[]).filter(x).map(n=>R(n,r,t))}function H(e){return{replayable:!1,reason:e,steps:[]}}function G(e,r){let t=[[r.afterAuthored,i=>i],[r.beforeAuthored,i=>i+1],[r.before,i=>i]],n=!1;for(let[i,a]of t){if(!x(i))continue;n=!0;let l=e.indexOf(O(i));if(l>=0)return a(l)}return n?null:e.length}function mt(e,r={}){let t=r.isIgnored||null,n=r.ignoreAttribute||null,i=at(e),a=[];for(let h of i){if(!st(h)){if(!x(h.target))return H("non-dom-target");continue}if(!x(h.parent))return H("non-dom-parent");let k=Array.from(h.nodes||[]).filter(x);if(k.length!==0){if(k.length!==Array.from(h.nodes||[]).length)return H("non-dom-node");a.push({primitive:h,nodes:k,parent:h.parent})}}if(gt(a))return H("in-record-move");let l=ht(a,t);if(!l)return H("ambiguous-structure");let s=yt(a,l),m=new Map(a.map(h=>[h.primitive,h])),v=[];for(let h of i){let k=m.get(h);if(!k){v.push(bt(h));continue}let V=s.get(k);if(V){V.at===k&&v.push(V.step);continue}v.push(wt(k,l.get(k),n,t))}return{replayable:!0,reason:null,steps:v}}function gt(e){let r=new Map;for(let t of e){let n=t.primitive.record;if(!n)continue;let i=r.get(n);i||(i=new Map,r.set(n,i));for(let a of t.nodes){let l=i.get(a);l||(l=new Set,i.set(a,l)),l.add(t.primitive.kind)}}for(let t of r.values())for(let n of t.values())if(n.size>1)return!0;return!1}function ht(e,r){let t=new Map;for(let i of e)t.has(i.parent)||t.set(i.parent,Ae(i.parent,r));let n=new Map;for(let i=e.length-1;i>=0;i--){let a=e[i],l=t.get(a.parent);if(!l)return null;let s=l.slice(),m;if(a.primitive.kind==="add"){let v=a.nodes.map(O);if(!v.every(h=>l.includes(h)))return null;m=l.filter(h=>!v.includes(h))}else{let v=G(s,a.primitive);if(v==null)return null;m=s.slice(),m.splice(v,0,...a.nodes.map(O))}n.set(a,{before:m,after:s}),t.set(a.parent,m)}return n}function yt(e,r){let t=new Map,n=new Map;e.forEach((a,l)=>{for(let s of a.nodes){let m=O(s);a.primitive.kind==="remove"?t.set(m,{item:a,index:l,node:s}):n.set(m,{item:a,index:l,node:s})}});let i=new Map;for(let[a,l]of t){let s=n.get(a);if(!s||s.index<l.index||l.item.nodes.length!==1||s.item.nodes.length!==1)continue;let m={type:"move",node:l.node,sourceParent:l.item.parent,destParent:s.item.parent,source:r.get(l.item),dest:r.get(s.item),sourceSlot:l.item.primitive,destSlot:s.item.primitive,targets:[R(l.node,"move")]};i.set(l.item,{step:m,at:s.item}),i.set(s.item,{step:m,at:s.item})}return i}function wt(e,r,t,n){let i=e.primitive.kind;return{type:i==="add"?"add":"restore",parent:e.parent,nodes:e.nodes,seqBefore:r.before,seqAfter:r.after,slot:e.primitive,content:e.nodes.map(a=>W(a,t,e.parent,n)),ids:i==="remove"?e.nodes.flatMap(a=>ne(a)):[],targets:pt(e.nodes,i==="add"?"added":"removed",e.parent)}}function bt(e){return{type:e.kind,primitive:e,targets:[R(e.target,e.name||e.prop||"text")]}}function vt(e,r,t={}){if(!e||!e.replayable)return{ok:!1,code:"unsupported",targets:[]};let n={isIgnored:t.isIgnored||null,ignoreAttribute:t.ignoreAttribute||null,isProtected:t.isProtected||null,inScope:t.inScope||(()=>!0),liveNodesWithIds:t.liveNodesWithIds||(()=>[]),sim:new Map,planned:new Map,operations:[]};for(let i=0;i<e.steps.length;i++){let a=e.steps[r==="undo"?e.steps.length-1-i:i],l=At(a,r,n);if(l)return{ok:!1,code:l.code,targets:l.targets}}return{ok:!0,operations:n.operations}}function q(e,r){return e.sim.has(r)||e.sim.set(r,Ae(r,e.isIgnored)),e.sim.get(r)}function Ve(e,r){for(let t=e;t;t=t.parentNode)if(r.planned.has(t))return r.planned.get(t);return r.inScope(e)}function Ne(e,r){return r.liveNodesWithIds(e).filter(t=>Ve(t,r)).length>0}function E(e,r){return{code:e,targets:r||[]}}function kt(e){return e.kind==="text"?e.target.data:e.kind==="value"?typeof e.read=="function"?e.read(e.target):e.target[e.prop||"value"]:e.target.getAttribute(e.name)}function At(e,r,t){let n=r==="undo";return e.type==="move"?Pt(e,n,t):e.type==="add"?Vt(e,n,t):e.type==="restore"?Nt(e,n,t):Et(e,n,t)}function Et(e,r,t){let n=e.primitive,i=r?n.newValue:n.oldValue,a=r?n.oldValue:n.newValue;return x(n.target)?Ve(n.target,t)?n.kind==="value"&&typeof n.write=="function"&&typeof n.read!="function"?E("unsupported",e.targets):kt(n)!==i?E("content-changed",e.targets):(n.kind==="value"?t.operations.push({type:"value",target:n.target,prop:n.prop||"value",value:a,read:n.read||null,write:n.write||null}):n.kind==="text"?t.operations.push({type:"text",target:n.target,data:a}):t.operations.push({type:"attr",target:n.target,name:n.name,value:a??null}),null):E("target-detached",e.targets):E("unsupported",e.targets)}function Vt(e,r,t){if(!x(e.parent)||!t.inScope(e.parent))return E("target-detached",e.targets);if(r){if(!$(q(t,e.parent),e.seqAfter))return E("structure-changed",e.targets);let s=Ee(e.nodes,t.isProtected);if(s.length>0)return E("protected",s);for(let m=0;m<e.nodes.length;m++)if(W(e.nodes[m],t.ignoreAttribute,e.parent,t.isIgnored)!==e.content[m])return E("content-changed",e.targets);for(let m of e.nodes)t.operations.push({type:"remove",node:m}),t.planned.set(m,!1);return t.sim.set(e.parent,e.seqBefore.slice()),null}if(!$(q(t,e.parent),e.seqBefore))return E("structure-changed",e.targets);for(let s of e.nodes)if(s.parentNode)return E("structure-changed",e.targets);let n=e.nodes.flatMap(s=>ne(s));if(n.length>0&&Ne(n,t))return E("duplicate-id",e.targets);let i=G(e.seqBefore,e.slot);if(i==null)return E("unsupported",e.targets);let a=e.seqBefore.slice(),l=i;for(let s of e.nodes)t.operations.push({type:"insert",parent:e.parent,node:s,beforeId:a[l]??null}),a=a.slice(0,l).concat(O(s),a.slice(l)),l+=1,t.planned.set(s,!0);return t.sim.set(e.parent,e.seqAfter.slice()),null}function Nt(e,r,t){if(!x(e.parent)||!t.inScope(e.parent))return E("target-detached",e.targets);if(r){if(!$(q(t,e.parent),e.seqAfter))return E("structure-changed",e.targets);for(let s=0;s<e.nodes.length;s++){let m=e.nodes[s];if(m.parentNode||W(m,t.ignoreAttribute,e.parent,t.isIgnored)!==e.content[s])return E("content-changed",e.targets)}if(e.ids.length>0&&Ne(e.ids,t))return E("duplicate-id",e.targets);let i=G(e.seqAfter,e.slot);if(i==null)return E("unsupported",e.targets);let a=e.seqAfter.slice(),l=i;for(let s of e.nodes)t.operations.push({type:"insert",parent:e.parent,node:s,beforeId:a[l]??null}),a=a.slice(0,l).concat(O(s),a.slice(l)),l+=1,t.planned.set(s,!0);return t.sim.set(e.parent,e.seqBefore.slice()),null}if(!$(q(t,e.parent),e.seqBefore))return E("structure-changed",e.targets);let n=Ee(e.nodes,t.isProtected);if(n.length>0)return E("protected",n);for(let i=0;i<e.nodes.length;i++){let a=e.nodes[i];if(a.parentNode!==e.parent||W(a,t.ignoreAttribute,e.parent,t.isIgnored)!==e.content[i])return E("content-changed",e.targets)}for(let i of e.nodes)t.operations.push({type:"remove",node:i}),t.planned.set(i,!1);return t.sim.set(e.parent,e.seqAfter.slice()),null}function xt(e,r){let t=e.indexOf(r);return t<0?null:e.slice(0,t).concat(e.slice(t+1))}function Pt(e,r,t){let n=O(e.node),i=r?e.destParent:e.sourceParent,a=r?e.sourceParent:e.destParent,l=q(t,i),s=q(t,a),m=r?e.dest.after:e.source.before,v=r?e.source.after:e.dest.before,h=r?e.sourceSlot:e.destSlot;if(!x(i)||!x(a)||!t.inScope(i)||!t.inScope(a))return E("target-detached",e.targets);if(!$(l,m))return E("structure-changed",e.targets);let k=i===a?xt(s,n):s;if(!$(k,v))return E("structure-changed",e.targets);let V=G(v,h);return V==null?E("unsupported",e.targets):(t.operations.push({type:"insert",parent:a,node:e.node,beforeId:v[V]??null}),t.planned.set(e.node,!0),r?(t.sim.set(a,e.source.before.slice()),i!==a&&t.sim.set(i,e.dest.before.slice())):(t.sim.set(a,e.dest.after.slice()),i!==a&&t.sim.set(i,e.source.after.slice())),null)}function $(e,r){if(!e||!r||e.length!==r.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==r[t])return!1;return!0}function St(e,r){for(let t of e.childNodes||[])if(O(t)===r)return t;return null}function xe(e,r){typeof e.write=="function"?e.write(e.target,r):e.target[e.prop]=r}function It(e){let r=[];try{for(let t of e)Rt(t,r);return{ok:!0}}catch(t){for(let n=r.length-1;n>=0;n--)try{r[n]()}catch{}return{ok:!1,error:t}}}function Rt(e,r){if(e.type==="attr"){let t=e.target.getAttribute(e.name);e.value==null?e.target.removeAttribute(e.name):e.target.setAttribute(e.name,e.value),r.push(()=>{t==null?e.target.removeAttribute(e.name):e.target.setAttribute(e.name,t)});return}if(e.type==="text"){let t=e.target.data;e.target.data=e.data,r.push(()=>{e.target.data=t});return}if(e.type==="value"){let t=typeof e.read=="function"?e.read(e.target):e.target[e.prop];xe(e,e.value),r.push(()=>xe(e,t));return}if(e.type==="insert"){let t=e.beforeId==null?null:St(e.parent,e.beforeId);if(e.beforeId!=null&&!t)throw new Error("hyper-undo: replay anchor vanished");let n=e.node.parentNode,i=e.node.nextSibling;e.parent.insertBefore(e.node,t),r.push(()=>{n?n.insertBefore(e.node,i&&i.parentNode===n?i:null):e.node.parentNode===e.parent&&e.parent.removeChild(e.node)});return}if(e.type==="remove"){let t=e.node.parentNode;if(!t)throw new Error("hyper-undo: replay target is no longer attached");let n=e.node.nextSibling;t.removeChild(e.node),r.push(()=>t.insertBefore(e.node,n))}}var Ct=['[src^="chrome-extension://"]','[href^="chrome-extension://"]','[src^="moz-extension://"]','[href^="moz-extension://"]','[src^="safari-web-extension://"]','[href^="safari-web-extension://"]','[id="1p-menu-live-region"]',"com-1password-button","com-1password-menu","com-1password-notification","grammarly-extension","grammarly-desktop-integration","lt-div","lt-card","lt-toolbar","lt-highlighter","[data-lastpass-root]","[data-lastpass-icon-root]","[data-dashlane-shadowhost]","[data-klarna-extension]",'[class*="klarna-extension"]',".skiptranslate","#goog-gt-tt",".goog-te-banner-frame",".goog-te-balloon-frame","style.darkreader","style[data-darkreader-mode]","style[data-darkreader-scheme]","#loom-companion-mv3","loom-container","[ext-id]"],Ot=["data-grammarly","data-lt","data-1p","data-com-onepassword","data-lastpass","data-lp","data-kwimpala","data-bitwarden","data-bw","data-dashlane","data-np","data-protonpass","data-proton-pass","data-keeper","data-rf","data-roboform","data-honey","data-rakuten","data-capital-one","data-wikibuy","data-klarna","data-darkreader","data-evernote","data-pocket","data-pin"],Mt=Ct.join(","),Tt=new RegExp("^(?:"+Ot.join("|")+")(?:-|$)"),$r=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"]})}),jt=Object.freeze({"editor-ui":Object.freeze(["no-data","no-save","no-snapshot","no-watch","no-undo"])}),qt=Object.freeze(["no-save","no-snapshot","no-trigger-autosave","no-dirty","no-watch","no-undo","no-data","freeze","editor-ui","live"]);function oe(e,r){if(!e||e.nodeType!==1)return!1;let t=e.getAttribute?.("clay");return!!(t&&t.split(/\s+/).includes(r)||e.hasAttribute?.(r))}function Pe(e,r){if(oe(e,r))return!0;for(let[t,n]of Object.entries(jt))if(n.includes(r)&&oe(e,t))return!0;return!1}function $t(e){return e==="clay"||qt.includes(e)}var Lt=["mutations-ignore","save-remove","save-ignore","save-freeze","no-undo","no-watch"];function Kt(){if(typeof window>"u")return null;let e=window.clay?.region||window.hyperclay?.region;return e&&typeof e.resolveRegionPolicy=="function"?e.resolveRegionPolicy:null}function ie(e){let r=Kt();if(r)try{if(!r(e).undoable)return!0}catch{}let t=e&&e.nodeType!==1?e.parentElement:e;if(t&&t.closest&&t.closest(Mt))return!0;for(;t&&t.nodeType===1;){if(Pe(t,"no-undo")||Pe(t,"no-watch"))return!0;for(let n of Lt)if(oe(t,n))return!0;t=t.parentElement}return!1}function zt(e){let r=e.target,t=r.cloneNode(!1),n=t;for(;r.parentElement;){r=r.parentElement;let i=r.cloneNode(!1);i.appendChild(t),t=i}return e.oldValue==null?n.removeAttribute(e.attributeName):n.setAttribute(e.attributeName,e.oldValue),ie(n)}function ae(e,r,t){if(t?.type==="attributes"&&$t(t.attributeName)){if(ie(e)&&zt(t))return!0}else if(ie(e))return!0;if(t&&t.type==="attributes"){if(t.attributeName&&Tt.test(t.attributeName.toLowerCase()))return!0;if(r)try{if(r(t.attributeName,t.target))return!0}catch{}}return!1}function Dt(){let e=new Map;function r(i,a){let l=e.get(i);return l||(l=new Set,e.set(i,l)),l.add(a),()=>t(i,a)}function t(i,a){let l=e.get(i);l&&l.delete(a)}function n(i,a){let l=e.get(i);if(l)for(let s of Array.from(l))try{s(a)}catch(m){console.error("[hyper-undo] listener threw",m)}}return{on:r,off:t,emit:n}}var _t={maxHistory:100,idleWindowMs:500,idleLabel:"Edit",recording:"automatic",ignoreAttribute:null,isProtected:null,ignoreNode:null,debug:!1};function Se(e){let r={..._t,...e};if(!r.scope)throw new Error("hyper-undo: scope is required");let t=Dt(),n=[],i=[],a=`u${Math.random().toString(36).slice(2,8)}`,l=0,s=null,m=[],v=null,h=null,k=0,V=!1,L=r.recording==="commands"?"commands":"automatic",S=null,K=!1;function P(...o){r.debug&&console.log("[hyper-undo]",...o)}function Jt(){V||(V=!0,h=Ft(z),h.observe(r.scope,{childList:!0,attributes:!0,characterData:!0,subtree:!0,attributeOldValue:!0,characterDataOldValue:!0}),P("started"))}function Ft(o){let u=typeof document<"u"&&r.scope===document.body,f=typeof window<"u"&&(window.clay?.Mutation||window.hyperclay?.Mutation)||null;return u&&f&&typeof f.createObserver=="function"?(P("sourcing records from the platform Mutation hub (shared observer)"),f.createObserver(o)):new MutationObserver(o)}function Oe(){V&&(V=!1,h&&(h.disconnect(),h=null),D(),n.length=0,i.length=0,m=[],s=null,S=null,K=!1,k=0,P("stopped"))}function Xt(){let o=r.scope;return!!(o&&o.nodeType===1&&o.isConnected===!1)}function z(o){Me(o,!1)}function Me(o,u){if(S){for(let g of o)S.records.push(g);return}if(L==="commands"||k>0)return;let f=se(Gt(o),u);if(f.length>0){for(let g of f)m.push(g);Te()}}function Gt(o){return typeof r.ignoreNode!="function"?o:o.filter(u=>{if(u.type!=="childList")return!0;let f=[...u.addedNodes,...u.removedNodes];return f.length===0?!0:!f.every(g=>Yt(g))})}function Yt(o){try{return!!r.ignoreNode(o)}catch{return!1}}function se(o,u=!1){let f=o.filter(g=>(mr(g.target)||u&&He(g.target))&&!ae(g.target,r.ignoreAttribute,g));return it(f,g=>ae(g,r.ignoreAttribute))}function Te(){D(),v=setTimeout(je,r.idleWindowMs)}function D(){v!=null&&(clearTimeout(v),v=null)}function je(){if(v=null,m.length===0)return;let o=m;m=[],Y(r.idleLabel,o)}function Y(o,u){let f=mt(u,{isIgnored:ce,ignoreAttribute:qe});if(f.steps.length===0)return P("commit",o,"with nothing to record"),t.emit("commit"),null;let g={id:`${a}-${++l}`,label:o,timestamp:Date.now(),primitives:u,certificate:f};for(n.push(g),i.length=0,s=null;n.length>r.maxHistory;)n.shift();return P("commit",o,"primitives:",u.length),t.emit("commit"),g}function ce(o){return ae(o,r.ignoreAttribute)}function qe(o,u,f=null){if(typeof r.ignoreAttribute!="function")return!1;try{return!!r.ignoreAttribute(o,u,f)}catch{return!1}}function Zt(o){if(typeof r.isProtected!="function")return!1;try{return!!r.isProtected(o)}catch{return!1}}function Qt(o,u){if(!V)throw new Error("hyper-undo: scope not started");if(L==="commands")return Ke(o,u,{honorPause:!0,receipt:!1});z(h.takeRecords()),_();let f=k===0?$e():null,g=u();if(g&&typeof g.then=="function")throw new Error("hyper-undo: commit() fn must be synchronous; returned a Promise");if(Me(h.takeRecords(),!0),f!=null&&Le(f),m.length===0){t.emit("commit");return}D();let A=m;m=[],Y(o,A)}function er(o){if(!V)throw new Error("hyper-undo: scope not started");if(!h)return;if(k>1){h.takeRecords();return}_();let u=se(h.takeRecords(),!0);u.length!==0&&(D(),Y(o,u))}function tr(){h&&h.takeRecords()}function fe(){let o=r.scope;return o&&o.ownerDocument||(typeof document<"u"?document:null)}function Z(){let o=fe();return!o||!o.head||typeof o.head.querySelector!="function"?null:o.head.querySelector("title")}function $e(){let o=Z();return o?o.textContent:null}function Le(o){let u=Z();if(!u||o==null)return;let f=u.textContent;f!==o&&De({kind:"value",target:u,prop:"textContent",oldValue:o,newValue:f})}function rr(o){if(!o)return null;let u=fe();if(!u||o.target!==u||o.prop!=="title")return o;let f=Z();return f?{kind:"value",target:f,prop:"textContent",oldValue:o.oldValue,newValue:o.newValue}:null}function nr(){if(typeof window>"u")return!1;let o=window.clay?.effect||window.hyperclay?.effect;return!!(o&&o.running)}function or(){h&&z(h.takeRecords()),_(),S={records:[],primitives:[]}}function ir(){let o=S;if(S=null,!o)return[];let u=se(o.records,!0);for(let f of o.primitives)u.push(f);return u}function Ke(o,u,{honorPause:f,receipt:g}){if(typeof u!="function")throw new Error("hyper-undo: command() needs a synchronous function");if(S)throw new Error("hyper-undo: command() cannot nest inside another command");if(K)throw new Error("hyper-undo: command() cannot run during undo or redo");if(nr())throw new Error("hyper-undo: command() cannot run inside a derived-effect context");if(u.constructor&&u.constructor.name==="AsyncFunction")throw new Error("hyper-undo: command() fn must be synchronous; it was declared async");let A=f&&k>0,I=A?null:$e();or();let M=[],j=null,U;try{try{U=u()}catch(wr){j=wr}if(h&&z(h.takeRecords()),U&&typeof U.then=="function"){try{U.then(void 0,()=>{})}catch{}j||(j=new Error("hyper-undo: command() fn must be synchronous; returned a Promise"))}A||Le(I)}finally{M=ir()}let Q=A||M.length===0?null:Y(o,M);if(j)throw j;return g?Q?{id:Q.id,label:Q.label}:null:Q}function ar(o,u){if(!V)throw new Error("hyper-undo: scope not started");return Ke(o,u,{honorPause:!1,receipt:!0})}function ur(o){if(o!=="automatic"&&o!=="commands")throw new Error("hyper-undo: setRecording() takes 'automatic' or 'commands'");if(S)throw new Error("hyper-undo: setRecording() cannot change while a command is running");return L===o||(_(),L=o,P("recording",o)),L}function ze(o){if(!V||!o||!S&&(k>0||L==="commands"))return;let u=rr(o);u&&De(u)}function De(o){if(S){S.primitives.push(o);return}m.push(o),Te()}function lr(o,{prop:u="value",oldValue:f,newValue:g,read:A,write:I}={}){!o||f===g||ze({kind:"value",target:o,prop:u,oldValue:f,newValue:g,read:A,write:I})}function _(){k===0&&h&&z(h.takeRecords()),m.length!==0&&(D(),je())}function _e(){k===0&&h&&z(h.takeRecords()),k++,P("paused",k)}function Ue(){k!==0&&(k--,k===0&&h&&h.takeRecords(),P("resumed",k))}function Be(o,u){if(Xt())return Oe(),{ok:!1,code:"disconnected"};_();let f=o==="undo"?n:i,g=o==="undo"?i:n,A=f.at(-1);if(!A)return{ok:!1,code:"empty"};if(u&&u!==A.id){let U=We(u)||A;return pe(U,o,"stale-entry")}let I;K=!0;try{I=vt(A.certificate,o,{isIgnored:ce,ignoreAttribute:qe,isProtected:Zt,inScope:gr,liveNodesWithIds:hr})}finally{K=!1}if(!I.ok)return pe(A,o,I.code,I.targets);_e();let M;K=!0;try{M=It(I.operations)}finally{K=!1,Ue()}if(!M.ok)return P(`${o} failed and was rolled back`,M.error),pe(A,o,"replay-error");f.pop(),g.push(A),s=null;let j={ok:!0,entryId:A.id,label:A.label,direction:o};return P(o,A.label),t.emit(o,j),j}function dr(o){return Be("undo",o&&o.entryId)}function sr(o){return Be("redo",o&&o.entryId)}function We(o){return n.find(u=>u.id===o)||i.find(u=>u.id===o)||null}function pe(o,u,f,g=[]){return s={entryId:o.id,direction:u,code:f,targets:g},P("refused",u,f),t.emit("refused",{entryId:o.id,label:o.label,direction:u,code:f,targets:g}),{ok:!1,code:f,entryId:o.id,label:o.label,direction:u}}function cr(o){if(!s||s.entryId!==o)return{ok:!1,code:"not-refused",entryId:o};let u=s.direction,f=u==="undo"?n:i,g=f.at(-1);return!g||g.id!==o?{ok:!1,code:"stale-entry",entryId:o}:(f.pop(),s=null,P("discarded",g.label),t.emit("discard",{entryId:o,label:g.label,direction:u}),{ok:!0,entryId:o,direction:u})}function fr(o){let u=We(o);if(!u||!u.certificate||!u.certificate.replayable)return null;let f=s&&s.entryId===u.id?{direction:s.direction,code:s.code,targets:(s.targets||[]).map(g=>({id:g.id??null,kind:g.kind??null}))}:null;return{id:u.id,label:u.label,timestamp:u.timestamp,refused:f,steps:u.certificate.steps.map(pr)}}function pr(o){if(o.type==="move")return{kind:"move",node:{id:R(o.node).id},from:{id:R(o.sourceParent).id},to:{id:R(o.destParent).id}};if(o.type==="add"||o.type==="restore")return{kind:o.type==="add"?"add":"remove",parent:{id:R(o.parent).id},nodes:o.nodes.map((I,M)=>({id:R(I).id,html:o.content[M]??null}))};let u=o.primitive,f={id:R(u.target).id},g=u.oldValue??null,A=u.newValue??null;return o.type==="value"?{kind:"value",target:f,prop:u.prop??"value",before:g,after:A}:o.type==="text"?{kind:"text",target:f,before:g,after:A}:o.type==="attr-set"||o.type==="attr-add"||o.type==="attr-remove"?{kind:"attribute",target:f,name:u.name??null,before:g,after:A}:{kind:o.type,target:f,before:g,after:A}}function mr(o){let u=r.scope;return!u||!o?!1:o===u||typeof u.contains=="function"&&u.contains(o)}function He(o){let u=fe(),f=u&&u.head;if(!f||!o)return!1;let g=o.nodeType===1?o:o.parentElement;for(;g&&g!==f;g=g.parentElement)if(g.localName==="title")return!1;return g===f}function gr(o){let u=r.scope;return!o||!u?!1:o===u||Z()===o||He(o)?!0:typeof u.contains=="function"?u.contains(o):!1}function hr(o){let u=r.scope;if(!o||o.length===0||typeof u?.querySelectorAll!="function")return[];let f=new Set(o),g=[];for(let A of u.querySelectorAll("[data-id]"))f.has(A.getAttribute("data-id"))&&(ce(A)||g.push(A));return g}function yr(){h&&h.takeRecords(),n.length=0,i.length=0,m=[],s=null,D(),P("cleared"),t.emit("clear")}return{_config:r,start:Jt,stop:Oe,commit:Qt,commitCaptured:er,discardCaptured:tr,flush:_,command:ar,setRecording:ur,record:ze,recordValue:lr,undo:dr,redo:sr,clear:yr,discard:cr,describe:fr,pause:_e,resume:Ue,on:t.on,off:t.off,get canUndo(){return n.length>0},get canRedo(){return i.length>0},get isPaused(){return k>0},get history(){return n.map(o=>{let u={id:o.id,label:o.label,timestamp:o.timestamp};return s&&s.entryId===o.id&&(u.refused={direction:s.direction,code:s.code,targets:s.targets}),u})},get future(){return i.map(o=>{let u={id:o.id,label:o.label,timestamp:o.timestamp};return s&&s.entryId===o.id&&(u.refused={direction:s.direction,code:s.code,targets:s.targets}),u}).reverse()},get scope(){return r.scope}}}function Ut(e){let r=typeof e.composedPath=="function"?e.composedPath():[],t=r.length>0?r:Bt(e.target);for(let n of t){if(!n||n.nodeType!==1)continue;let i=String(n.tagName||"").toUpperCase();if(i==="INPUT"||i==="TEXTAREA"||i==="SELECT"||n.isContentEditable===!0)return!0;let a=n.getAttribute&&n.getAttribute("contenteditable");if(a!=null&&String(a).toLowerCase()!=="false")return!0}return!1}function Bt(e){let r=[];for(let t=e;t;t=t.parentNode||(t.host??null))r.push(t);return r}function Wt(e,r){let t=n=>{let i=e.scope;if(i&&i.nodeType===1&&i.isConnected===!1){r&&r();return}if(n.defaultPrevented||n.isComposing||n.keyCode===229||Ut(n))return;let a=n.target,l=e._config.shadowKeydownIn;if(a&&a.closest&&Array.isArray(l))for(let m of l)try{if(a.closest(m))return}catch{}if(!(n.metaKey||n.ctrlKey))return;let s=(n.key||"").toLowerCase();if(s==="z"&&!n.shiftKey){n.preventDefault(),n.stopPropagation(),e.undo();return}if(s==="z"&&n.shiftKey){n.preventDefault(),n.stopPropagation(),e.redo();return}if(s==="y"&&!n.shiftKey){n.preventDefault(),n.stopPropagation(),e.redo();return}};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)}var ue=[".CodeMirror",".cm-editor",".monaco-editor",".ace_editor",".ql-editor",".tiptap",".ProseMirror",".overtype-input","[data-richclay-active]"],p=null,le=null,Ie=null,T=null;function Re(e,r){if(T){if(T.inst===e)return T.cleanup;throw new Error("hyper-undo: another scope already owns the global Cmd+Z binding (bindKeys: true). Stop it first, or use bindKeys: false for additional scopes.")}let t=Wt(e,r);return T={inst:e,cleanup:t},t}function Ce(e){T&&T.inst===e&&(T.cleanup(),T=null)}var de={defaults:{shadowKeydownIn:ue},start(e={}){let r=e.scope||(typeof document<"u"?document.body:null);if(!r)throw new Error("hyper-undo: no scope (need document.body or explicit { scope })");if(p){if(le===r)return console.warn("[hyper-undo] start() called again on existing singleton; ignoring new options"),p;throw new Error("hyper-undo: start() called with a different scope while the singleton is already started. Use undo.create({ scope }) for additional scopes, or call undo.stop() first.")}let t={...e,scope:r,shadowKeydownIn:e.shadowKeydownIn||ue};return p=Se(t),p.start(),le=r,e.bindKeys!==!1&&(Ie=Re(p,()=>de.stop())),p},stop(){p&&(Ce(p),Ie=null,p.stop(),p=null,le=null)},create(e={}){let r=e.scope||(typeof document<"u"?document.body:null);if(!r)throw new Error("hyper-undo: no scope (need document.body or explicit { scope })");let t={...e,scope:r,shadowKeydownIn:e.shadowKeydownIn||ue},n=Se(t),i=null,a={_config:n._config,commit:n.commit,command:n.command,setRecording:n.setRecording,commitCaptured:n.commitCaptured,discardCaptured:n.discardCaptured,flush:n.flush,record:n.record,recordValue:n.recordValue,undo:n.undo,redo:n.redo,clear:n.clear,discard:n.discard,describe:n.describe,pause:n.pause,resume:n.resume,on:n.on,off:n.off,get canUndo(){return n.canUndo},get canRedo(){return n.canRedo},get isPaused(){return n.isPaused},get history(){return n.history},get future(){return n.future},get scope(){return n.scope},start(){e.bindKeys&&(i=Re(n,()=>a.stop())),n.start()},stop(){Ce(n),i=null,n.stop()}};return a},commit(e,r){return p?p.commit(e,r):void 0},command(e,r){return p?p.command(e,r):void 0},setRecording(e){return p?p.setRecording(e):void 0},commitCaptured(e){return p?p.commitCaptured(e):void 0},discardCaptured(){return p?p.discardCaptured():void 0},record(e){return p?p.record(e):void 0},recordValue(e,r){return p?p.recordValue(e,r):void 0},undo(e){return p?p.undo(e):void 0},redo(e){return p?p.redo(e):void 0},clear(){return p?p.clear():void 0},discard(e){return p?p.discard(e):void 0},describe(e){return p?p.describe(e):void 0},pause(){return p?p.pause():void 0},resume(){return p?p.resume():void 0},flush(){return p?p.flush():void 0},on(e,r){return p?p.on(e,r):void 0},off(e,r){return p?p.off(e,r):void 0},get canUndo(){return p?p.canUndo:!1},get canRedo(){return p?p.canRedo:!1},get history(){return p?p.history:[]},get future(){return p?p.future:[]},get isPaused(){return p?p.isPaused:!1}},Ht=de;return F(C)})();window.__hyperclayNoAutoExport||(window.hyperclay=window.hyperclay||{},window.hyperclay.undo=Ze.undo,window.h=window.hyperclay);var y=Ze.undo;var ge=new Set,nt=(d={})=>{let c=d.ignoreAttribute;return{...d,ignoreAttribute:(b,w,N)=>ge.has(b)||Je(b,w)||Xe(w,b,N)||Ge(b,w)||(c?c(b,w,N):!1),isProtected:d.isProtected||br,ignoreNode:d.ignoreNode||Ye}};function br(d){let c=window.clay?.region?.resolveRegionPolicy;if(!c||d.nodeType!==1)return!1;let b=c(d);if(b.undoable!==!1||b.persist==="none")return!1;let w=d.parentElement;return!w||c(w).undoable!==!1}var vr=y.create.bind(y);y.create=d=>vr(nt(d));var he=null,kr=y.setRecording.bind(y);y.setRecording=d=>(he=d??null,kr(d));var Qe=()=>y.history.at(-1)?.id??null,Ar=y.command.bind(y);y.command=(d,c)=>{let b=Ar(d,c);return b&&te(),b};var Er=y.commit.bind(y),et=!1;y.commit=(d,c)=>{!et&&window.clay?.effect?.running&&(et=!0,console.warn(`clay.effect: undo.commit("${d}") was called inside an effect. Run commands from event handlers, not from an effect.`));let b=Qe(),w=Er(d,c);return(w||Qe()!==b)&&te(),w};var Vr=`input${ee}:not([type="password"]):not([type="hidden"]):not([type="file"]), textarea${ee}, select${ee}`;function Nr(){let d=c=>window.clay?.region?.resolveRegionPolicy?.(c)?.undoable!==!1;document.querySelectorAll(Vr).forEach(c=>{if(!d(c))return;if(c.tagName==="SELECT"){for(let C of c.options){let X=C.hasAttribute("selected");C.selected!==X&&(C.selected=X)}return}let b=(c.getAttribute("type")||"text").toLowerCase();if(c.tagName==="INPUT"&&(b==="checkbox"||b==="radio")){let C=c.hasAttribute("checked");c.checked!==C&&(c.checked=C);return}let w=c.tagName==="TEXTAREA"?c.getAttribute("data-value")??c.textContent:c.getAttribute("value")??"";if(c.value===w)return;let N=c===document.activeElement,B,F;try{B=c.selectionStart,F=c.selectionEnd}catch{}if(c.value=w,N&&B!=null)try{c.setSelectionRange(Math.min(B,w.length),Math.min(F,w.length))}catch{}})}var tt=d=>{d?.ok&&(te(),Nr())},rt=({entryId:d,label:c,direction:b,code:w})=>{document.dispatchEvent(new CustomEvent("clay:undo-refused",{detail:{ok:!1,code:w,entryId:d,label:c,direction:b}})),xr({ok:!1,code:w,entryId:d,label:c,direction:b})},me=null;function ot(){return me??=import("../c-5RJFTLSF.js").catch(d=>(me=null,console.error("clayjs: the undo recovery module could not be downloaded; a refused step stays in this tab only",d),null)),me}async function xr(d){let c={ok:!1,code:"unavailable"};try{let w=await ot();w&&(c=await w.keepRefusal(y,d))}catch{c={ok:!1,code:"error"}}let b=c?.ok===!0?{ok:!0,entryId:d.entryId,direction:d.direction}:{ok:!1,code:c?.code||"error",entryId:d.entryId,direction:d.direction};document.dispatchEvent(new CustomEvent("clay:undo-kept",{detail:b}))}var we=(d,c)=>(...b)=>ot().then(w=>w?w[d](...b):c,()=>c),Pr=we("keep",{ok:!1,code:"unavailable"});y.ignoreAttribute=d=>{let c=String(d||"");return c?(ge.add(c),()=>{ge.delete(c)}):()=>{}};y.keep=async d=>{let c=await Pr(d);return c?.ok===!0&&document.dispatchEvent(new CustomEvent("clay:undo-kept",{detail:{ok:!0,key:d?.key==null?null:`app:${d.key}`}})),c};y.kept=we("kept",{ok:!1,code:"unavailable",records:[]});y.dismissKept=we("dismissKept",{ok:!1,code:"unavailable"});var ye=new Set;y.reviewActions=d=>typeof d!="function"?()=>{}:(ye.add(d),()=>{ye.delete(d)});y.reviewActionsFor=d=>{let c=[];for(let b of ye){let w;try{w=b(d)}catch(N){console.error("clayjs: a review action could not describe itself; the copy stays reviewable",N);continue}for(let N of Array.isArray(w)?w:[])N&&typeof N.run=="function"&&N.label&&c.push(N)}return c};var Sr=["commit","undo","redo","refused","discard","clear"],re=()=>{let d=!!J?.started;document.dispatchEvent(new CustomEvent("clay:undo-change",{detail:{canUndo:d&&y.canUndo,canRedo:d&&y.canRedo,undo:d&&y.history.at(-1)||null,redo:d&&y.future?.[0]||null}}))},J=null;function Ir(){return{started:!1,admitted:!1,subscriptions:[]}}var Rr=d=>d?d.signal?.aborted?!0:typeof d.isCurrent=="function"&&!d.isCurrent():!1;function Cr(){return typeof document>"u"||document.readyState!=="loading"?Promise.resolve():new Promise(d=>document.addEventListener("DOMContentLoaded",d,{once:!0}))}function Or(d){return{enable(){if(!d.started){d.started=!0,d.admitted=!0,y.start(nt({bindKeys:!0,...he?{recording:he}:{}}));for(let c of["undo","redo"])y.on(c,tt),d.subscriptions.push({type:c,handler:tt});y.on("refused",rt),d.subscriptions.push({type:"refused",handler:rt});for(let c of Sr)y.on(c,re),d.subscriptions.push({type:c,handler:re});re()}},quiesce(){d.admitted&&(d.admitted=!1,y.pause())},resume(){d.admitted||(d.admitted=!0,y.resume())},dispose(){if(d.admitted=!1,J===d&&(J=null),!!d.started){d.started=!1;for(let{type:c,handler:b}of d.subscriptions.splice(0))y.off(c,b);y.stop(),re()}}}}function Mr(){return{id:"clay:undo",order:350,async prepare(d={}){if(d.initial===!0)return Tr();if(await Cr(),Rr(d))throw Object.assign(new Error("clay:undo prepared for a stale generation"),{code:"stale-document"});return Or(J||(J=Ir()))}}}async function Tr(){let d=await qr;return{enable(){},quiesce:()=>d?.quiesce(),resume:()=>d?.resume(),dispose:()=>d?.dispose()}}async function jr(){if(!Fe()||typeof document>"u")return null;let d=await Mr().prepare();return d.enable(),d}var qr=jr();var Jr=y;export{Jr as default,jr as init,Mr as modeParticipant,qr as ready,Nr as restoreControls,y as undo,Mr as undoParticipant};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as y}from"../c-4WKFKEKF.js";import"../c-VHNSBD2M.js";var U="hha:upgrade-check:",L=1440*60*1e3,b="upgrade-dismissed",A="A new version of this template is available.";function g(t,e){let n=t.querySelector(`meta[name="${e}"]`),a=n?n.getAttribute("content"):null;return a&&a.trim()?a.trim():null}function C(t){try{let e=globalThis.localStorage.getItem(t);return e?JSON.parse(e):null}catch{return null}}function I(t,e){try{globalThis.localStorage.setItem(t,JSON.stringify(e))}catch{}}async function R(t){let e=globalThis.crypto&&globalThis.crypto.subtle;if(!e)return null;let n=await e.digest("SHA-256",t);return[...new Uint8Array(n)].map(a=>a.toString(16).padStart(2,"0")).join("")}async function E(t,e){try{let n=await t(e,{credentials:"omit"});return n.ok?n:null}catch{return null}}async function k(t,e,{fetchFn:n,now:a}){let r=new URL(t);r.pathname=r.pathname.replace(/\.html$/,".json");let u=`${U}${r.href}:${e}`,l=C(u);if(l&&typeof l.checkedAt=="number"&&a-l.checkedAt<L)return{latest:l.latest,latestUrl:r};let i=await E(n,r.href);if(!i)return{latest:null,latestUrl:r};let s=null;try{s=await i.json()}catch{return{latest:null,latestUrl:r}}return I(u,{checkedAt:a,latest:s}),{latest:s,latestUrl:r}}async function M({doc:t=document,loc:e=location,fetchFn:n=(r,u)=>fetch(r,u),now:a=Date.now()}={}){let r=typeof window<"u"&&window.clay||{};if(!r.canEdit||r.isDraftMode)return null;let u=g(t,"hyper-source"),l=g(t,"hyper-version");if(!u||!l)return null;let i;try{i=new URL(u,e?e.href:void 0)}catch{return null}if(!i.pathname.endsWith(".html")||e&&i.origin===e.origin&&i.pathname===e.pathname)return null;let s=new URL(i.href);s.pathname=s.pathname.replace(/\.html$/,".json");let{latest:o}=await k(i.href,l,{fetchFn:n,now:a});if(!o||typeof o!="object"||typeof o.version!="string"||!y(o.version,l))return null;let f=r.storage&&r.storage.local;if(f&&f.get(b)===o.version||typeof o.html!="string"||!o.html)return null;let h=new URL(o.html,s).href,m=await E(n,h);if(!m)return null;let p;try{p=await m.arrayBuffer()}catch{return null}let d=await R(p);return!d||d!==String(o.sha256||"").toLowerCase()?null:{version:o.version,html:h,sha256:d,latestUrl:s.href}}function P(t){let e=window.clay,n=e&&e.storage&&e.storage.local;n&&n.set(b,t)}function T(t){return!!(t&&Array.isArray(t.plugins)&&t.plugins.includes("menu"))}function S(t){return!!(t&&t.menu&&typeof t.menu.addItem=="function")}function $(t){return S(t)||!T(t)?Promise.resolve():new Promise(e=>{let n=a=>{!a.detail||a.detail.plugin!=="menu"||(document.removeEventListener("clay:plugin-ready",n),document.removeEventListener("clay:plugin-failed",n),e())};document.addEventListener("clay:plugin-ready",n),document.addEventListener("clay:plugin-failed",n)})}async function j(t,e=typeof window<"u"?window.clay:null){let n=()=>document.dispatchEvent(new CustomEvent("clay:upgrade-requested",{detail:t}));return await $(e),S(e)?(e.menu.addItem({id:"upgrade",label:`Upgrade to version ${t.version}`,badge:!0,run:n}),"menu"):e&&typeof e.toastPersistent=="function"?(e.toastPersistent(A,"info",{actions:[{label:"Upgrade",onClick:n},{label:"Not now",onClick:()=>P(t.version)}]}),"notice"):null}var w=!1;async function v(t={}){if(w)return null;w=!0;let e=window.clay;await Promise.resolve(e&&e.loaded&&e.loaded.ui).catch(()=>{});let n=await M(t).catch(()=>null);return n?(await j(n),n):null}async function O(t,e){return(await import("../c-
|
|
1
|
+
import{a as y}from"../c-4WKFKEKF.js";import"../c-VHNSBD2M.js";var U="hha:upgrade-check:",L=1440*60*1e3,b="upgrade-dismissed",A="A new version of this template is available.";function g(t,e){let n=t.querySelector(`meta[name="${e}"]`),a=n?n.getAttribute("content"):null;return a&&a.trim()?a.trim():null}function C(t){try{let e=globalThis.localStorage.getItem(t);return e?JSON.parse(e):null}catch{return null}}function I(t,e){try{globalThis.localStorage.setItem(t,JSON.stringify(e))}catch{}}async function R(t){let e=globalThis.crypto&&globalThis.crypto.subtle;if(!e)return null;let n=await e.digest("SHA-256",t);return[...new Uint8Array(n)].map(a=>a.toString(16).padStart(2,"0")).join("")}async function E(t,e){try{let n=await t(e,{credentials:"omit"});return n.ok?n:null}catch{return null}}async function k(t,e,{fetchFn:n,now:a}){let r=new URL(t);r.pathname=r.pathname.replace(/\.html$/,".json");let u=`${U}${r.href}:${e}`,l=C(u);if(l&&typeof l.checkedAt=="number"&&a-l.checkedAt<L)return{latest:l.latest,latestUrl:r};let i=await E(n,r.href);if(!i)return{latest:null,latestUrl:r};let s=null;try{s=await i.json()}catch{return{latest:null,latestUrl:r}}return I(u,{checkedAt:a,latest:s}),{latest:s,latestUrl:r}}async function M({doc:t=document,loc:e=location,fetchFn:n=(r,u)=>fetch(r,u),now:a=Date.now()}={}){let r=typeof window<"u"&&window.clay||{};if(!r.canEdit||r.isDraftMode)return null;let u=g(t,"hyper-source"),l=g(t,"hyper-version");if(!u||!l)return null;let i;try{i=new URL(u,e?e.href:void 0)}catch{return null}if(!i.pathname.endsWith(".html")||e&&i.origin===e.origin&&i.pathname===e.pathname)return null;let s=new URL(i.href);s.pathname=s.pathname.replace(/\.html$/,".json");let{latest:o}=await k(i.href,l,{fetchFn:n,now:a});if(!o||typeof o!="object"||typeof o.version!="string"||!y(o.version,l))return null;let f=r.storage&&r.storage.local;if(f&&f.get(b)===o.version||typeof o.html!="string"||!o.html)return null;let h=new URL(o.html,s).href,m=await E(n,h);if(!m)return null;let p;try{p=await m.arrayBuffer()}catch{return null}let d=await R(p);return!d||d!==String(o.sha256||"").toLowerCase()?null:{version:o.version,html:h,sha256:d,latestUrl:s.href}}function P(t){let e=window.clay,n=e&&e.storage&&e.storage.local;n&&n.set(b,t)}function T(t){return!!(t&&Array.isArray(t.plugins)&&t.plugins.includes("menu"))}function S(t){return!!(t&&t.menu&&typeof t.menu.addItem=="function")}function $(t){return S(t)||!T(t)?Promise.resolve():new Promise(e=>{let n=a=>{!a.detail||a.detail.plugin!=="menu"||(document.removeEventListener("clay:plugin-ready",n),document.removeEventListener("clay:plugin-failed",n),e())};document.addEventListener("clay:plugin-ready",n),document.addEventListener("clay:plugin-failed",n)})}async function j(t,e=typeof window<"u"?window.clay:null){let n=()=>document.dispatchEvent(new CustomEvent("clay:upgrade-requested",{detail:t}));return await $(e),S(e)?(e.menu.addItem({id:"upgrade",label:`Upgrade to version ${t.version}`,badge:!0,run:n}),"menu"):e&&typeof e.toastPersistent=="function"?(e.toastPersistent(A,"info",{actions:[{label:"Upgrade",onClick:n},{label:"Not now",onClick:()=>P(t.version)}]}),"notice"):null}var w=!1;async function v(t={}){if(w)return null;w=!0;let e=window.clay;await Promise.resolve(e&&e.loaded&&e.loaded.ui).catch(()=>{});let n=await M(t).catch(()=>null);return n?(await j(n),n):null}async function O(t,e){return(await import("../c-NUHSPT5P.js")).replace(t,e)}function N(t){import("../c-UDCSU5G5.js").then(e=>e.start(t.detail)).catch(e=>console.error("clayjs: the upgrade could not start:",e))}var c=typeof window<"u"?window.clay:null;if(c&&c.canEdit&&!c.isDraftMode){document.addEventListener("clay:upgrade-requested",N);let t=c.ready;t&&typeof t.then=="function"?t.then(()=>v(),()=>{}):v()}export{j as announce,M as findUpdate,O as replace,v as start};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as r,c as p,d as n,e as u}from"../c-KAU6E43D.js";import"../c-2SPVQSHC.js";import"../c-VRZN56XY.js";import"../c-OW5QIGG3.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import"../c-HA6INT6J.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";function o(a,{requiredAccess:t,...i}={}){return r(t),p(a,{...i,requiredAccess:t})}o.mount=async(a,t)=>(await import("../c-3RUU4TPX.js")).mount(a,t);o.start=n;var c=o;export{c as default,u as modeParticipant,o as upload};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{b as We,c as Ue}from"../c-BTDI4Y23.js";import{a as qe,b as _e,c as ze,d as Fe}from"../c-MTQHWQC3.js";import{b as Be,e as He,g as me}from"../c-OW5QIGG3.js";import{d as Ie}from"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import{d as te,f as De,h as Pe,j as F}from"../c-N7JPUPGC.js";import"../c-HA6INT6J.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";var Ut=Object.defineProperty,qt=(e,t)=>{for(var r in t)Ut(e,r,{get:t[r],enumerable:!0})},ut=["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"],_t=new Set(ut),zt=new Set(["textContent","innerText","innerHTML","value","checked","selected","disabled","readOnly","type","id","className","title"]),ct=new Set(["tagName","nodeName","nodeType","nodeValue","childElementCount","classList","baseURI","documentURI","contentType","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","currentSrc","duration","paused","dataset"]),Ve=new Set(["checked","selected","disabled","readOnly","paused"]);function Ft(e,t){return t==null?Ve.has(e)?!1:"":Ve.has(e)?t==="false"?!1:!!t:t}var P={};qt(P,{EmptyListInsert:()=>Z,MAX_RULE_DEPTH:()=>se,MaxRuleDepthExceeded:()=>Te,NoRulesTag:()=>Kt,RuleTargetReadOnly:()=>pt,RulesParseError:()=>Ee,ShapeMismatch:()=>ft,UnknownRulesVersion:()=>dt,WriteNotRoundTripped:()=>Jt,WriteRefused:()=>ht,WriteRejected:()=>Zt});var Ee=class extends Error{constructor(e,t){super(e),this.name="RulesParseError",this.cause=t}},dt=class extends Error{constructor(e){super(`unknown rules version: ${e}. Library supports "1".`),this.name="UnknownRulesVersion",this.version=e}},se=20,Te=class extends Error{constructor(e){super(`rule depth exceeded ${se} at path: ${e.join(".")}`),this.name="MaxRuleDepthExceeded",this.path=e}},ft=class extends Error{constructor(e){super(`shape mismatch: ${e.length} field(s) failed validation`),this.name="ShapeMismatch",this.mismatches=e}},Z=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}},pt=class extends Error{constructor(e){super(`cannot write to read-only DOM property "${e}"`),this.name="RuleTargetReadOnly",this.target=e}},ht=class extends Error{constructor(e){super(`write refused: ${e.length} write(s) broke the content-only policy`),this.name="WriteRefused",this.refusals=e}};function Vt(e){return e.reduce((t,r)=>typeof r=="number"?`${t}[${r}]`:t?`${t}.${r}`:String(r),"")||"(root)"}var Jt=class extends Error{constructor(e){super(`write did not round-trip at "${Vt(e)}"`),this.name="WriteNotRoundTripped",this.path=e}},Kt=class extends Error{constructor(e){super(`no <script data-rules-name~="${e}"> rules tag in this document`),this.name="NoRulesTag",this.token=e}},Zt=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}};function z(e){let t=0,r=null,n=-1;for(let o=0;o<e.length;o++){let l=e[o];l==="\\"?o++:r?l===r&&(r=null):l==='"'||l==="'"?r=l:l==="["||l==="("?t++:l==="]"||l===")"?t>0&&t--:l==="@"&&t===0&&(n=o)}return n}function Xt(e){let t=z(e);return t===-1?{selector:e,prop:null}:{selector:e.slice(0,t),prop:e.slice(t+1)||null}}function mt(e){let t=0,r=null,n=-1,o=!1;for(let l=0;l<e.length;l++){let a=e[l];a==="\\"?l++:r?a===r&&(r=null):a==='"'||a==="'"?r=a:a==="["||a==="("?t++:a==="]"||a===")"?t>0&&t--:t===0&&a===">"?n=l:t===0&&a===","&&(o=!0)}return o||n===-1||!Yt(e,n+1)?null:e.slice(0,n).trim()||null}function Yt(e,t){let r=t,n=e.replace(/\s+$/,"").length;for(;r<n&&/\s/.test(e[r]);)r++;let o=0,l=null;for(;r<n;r++){let a=e[r];if(a==="\\")r++;else if(l)a===l&&(l=null);else if(a==='"'||a==="'")l=a;else if(a==="["||a==="(")o++;else if(a==="]"||a===")")o>0&&o--;else if(o===0&&(a==="+"||a==="~"||/\s/.test(a)))return!1}return!0}var Gt=/^--[A-Za-z0-9_-]+$/;function Oe(e){return typeof e=="string"&&Gt.test(e)}function yt(e){let t=[],r=[],n=null,o=0;for(let l=0;l<e.length;l++){let a=e[l];if(n){a==="\\"?l++:a===n&&(n=null);continue}if(a==="/"&&e[l+1]==="*"){let i=e.indexOf("*/",l+2);l=i===-1?e.length:i+1;continue}a==='"'||a==="'"?n=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(o,l)),o=l+1)}return t.push(e.slice(o)),t}function Qt(e){let t="",r=null;for(let n=0;n<e.length;n++){let o=e[n];if(r){t+=o,o==="\\"&&n+1<e.length?t+=e[++n]:o===r&&(r=null);continue}if(o==="/"&&e[n+1]==="*"){let l=e.indexOf("*/",n+2);n=l===-1?e.length:l+1,t+=" ";continue}(o==='"'||o==="'")&&(r=o),t+=o}return t}function gt(e){e=Qt(e);let t=e.indexOf(":");if(t===-1)return null;let r=e.slice(0,t).trim(),n=e.slice(t+1).trim(),o=/!\s*important\s*$/i.exec(n);return o&&(n=n.slice(0,o.index).trim()),{name:r,value:n,important:!!o}}function xe(e,t){if(e==null)return null;let r=null;for(let n of yt(String(e))){let o=gt(n);!o||o.name!==t||(!r||o.important||!r.important)&&(r=o)}return r?r.value:null}function er(e,t,r){let n=e==null?"":String(e),o=r==null||r==="",l=yt(n),a=l.map(gt),i=a.some(h=>h&&h.name===t&&h.important),s=[],u=!1;l.forEach((h,p)=>{let A=a[p];if(!A||A.name!==t){s.push(h);return}if(o||u)return;let d=/^\s*/.exec(h)[0];s.push(`${d}${t}: ${r}${i?" !important":""}`),u=!0});let c=s.join(";");if(!o&&!u){let h=c.trimEnd();c=h===""?`${t}: ${r}`:`${h}${h.endsWith(";")?" ":"; "}${t}: ${r}`}return c.trim()===""?null:c}function vt(e,t,r,n){let o=e.attr(t,"style");if((xe(o,r)??"")===n)return;let l=er(o,r,n);l==null?e.removeAttr(t,"style"):e.attr(t,"style",l)}function oe(e,t,r,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.");return ye(e,t,r,{depth:0,path:[]},n)}function ye(e,t,r,n,o){if(n.depth>se)throw new Te(n.path);if(typeof r=="string")return tr(e,t,r,n,o);if(Array.isArray(r)){let[l,a]=r,i=e.find(t,l,o);return wt(o,n,i),i.map((s,u)=>ye(e,s,a,{depth:n.depth+1,path:[...n.path,u]},o))}if(typeof r=="object"&&r!==null){let l={};for(let[a,i]of Object.entries(r))l[a]=ye(e,t,i,{depth:n.depth+1,path:[...n.path,a]},o);return l}return null}function tr(e,t,r,n,o){if(r.endsWith("[]")){let i=r.slice(0,-2),s=e.find(t,i,o);return wt(o,n,s),s.map(u=>e.text(u))}if(r.startsWith("@"))return Je(e,t,r.slice(1));let l=z(r);if(l!==-1){let i=r.slice(0,l),s=r.slice(l+1),u=i?e.find(t,i,o):[t];return u.length===0?null:Je(e,u[0],s)}if(r===".")return e.text(t);let a=e.find(t,r,o);return a.length===0?null:e.text(a[0])}function wt(e,t,r){if(typeof e.onRowsRead=="function")try{e.onRowsRead(t.path.slice(),r)}catch(n){console.warn(`[hyper-html-api] onRowsRead threw at "${t.path.join(".")||"(root)"}"`,n)}}function Je(e,t,r){if(Oe(r))return xe(e.attr(t,"style"),r);if(_t.has(r)){let o=e.prop(t,r);return o==null?null:String(o)}return e.attr(t,r)??null}function rr(e,t,r,n){let o=e.length,l=t.length,a=new Array(o).fill(-1);if(n){let f=new Set;for(let g=0;g<o;g++){let v=n[g];!(v>=0&&v<l)||f.has(v)||(a[g]=v,f.add(v))}}if(o===0||l===0)return a;let i=e.map(f=>Ke(f,r)),s=t.map(f=>Ke(f,r)),u=new Array(l).fill(!1);for(let f of a)f>=0&&(u[f]=!0);let c=new Map;s.forEach((f,g)=>{u[g]||c.set(f,c.has(f)?-1:g)});let h=new Map;i.forEach((f,g)=>{a[g]>=0||h.set(f,(h.get(f)||0)+1)}),i.forEach((f,g)=>{if(a[g]>=0||h.get(f)!==1)return;let v=c.get(f);v===void 0||v===-1||u[v]||(a[g]=v,u[v]=!0)});let p=[];for(let f=0;f<o;f++)a[f]<0&&p.push(f);let A=[];for(let f=0;f<l;f++)u[f]||A.push(f);if(p.length===0||A.length===0)return a;let d=o*l+1,m=nr(e,t,r),y=(f,g)=>m(f,g)*d+Math.abs(f-g);for(let[f,g]of or(p,A,y))a[f]=g;return a}var bt=e=>typeof e=="object"&&e!==null;function Ke(e,t){if(!bt(t))return e==null?" null":String(e);let r=Object.keys(t);return JSON.stringify(r.map(n=>{let o=JSON.stringify(e?.[n]);return o===void 0?" undef":o}))}function nr(e,t,r){if(!bt(r))return(i,s)=>e[i]===t[s]?0:1;let n=Object.keys(r),o=i=>n.map(s=>JSON.stringify(i?.[s])),l=e.map(o),a=t.map(o);return(i,s)=>{let u=l[i],c=a[s],h=0;for(let p=0;p<n.length;p++)u[p]!==c[p]&&h++;return h}}function or(e,t,r){return e.length<=t.length?Ze(e,t,r,!1):Ze(t,e,(n,o)=>r(o,n),!0)}function Ze(e,t,r,n){let o=e.length,l=t.length,a=[];for(let h=0;h<=o;h++)a.push(new Float64Array(l+1).fill(1/0));let i=[];for(let h=0;h<=o;h++)i.push(new Uint8Array(l+1));for(let h=0;h<=l;h++)a[o][h]=0;for(let h=o-1;h>=0;h--)for(let p=l-1;p>=0;p--){let A=r(e[h],t[p])+a[h+1][p+1],d=a[h][p+1];A<=d?(a[h][p]=A,i[h][p]=1):a[h][p]=d}let s=[],u=0,c=0;for(;u<o&&c<l;)i[u][c]&&(s.push(n?[t[c],e[u]]:[e[u],t[c]]),u++),c++;return s}function At(e,t,r,n,o,l,a,i={}){let s=e.find(t,r,i);if(o.length===0){s.forEach(T=>e.remove(T)),ge(i,"onRowsApplied",l.path,[]);return}let u=o.length>s.length,c=s[0]||null;if(u&&!c&&(c=sr(e,t,r,i),!c))throw new Z(l.path);let h=s.map(T=>ar(e,T,n,i)),p=null;if(u&&c){p=e.clone(c),i.templateAttr&&e.removeAttr(p,i.templateAttr);let T=e.stripIds(p);T>0&&console.warn(`[hyper-html-api] stripped ${T} id attribute(s) from cloned template at "${l.path.join(".")||"(root)"}"`)}let A=rr(o,h,n,lr(e,s,o,l,i)),d=s.length>0?e.parent(s[0]):fr(e,t,r,c,l,i),m=s.length>0?Et(e,d,s[0]):0,y=mr(e,s),f=new Set,g=[],v=o.map((T,O)=>{let x=A[O];if(x>=0)return f.add(x),g.push(!1),s[x];g.push(!0);let C=e.clone(p);return e.stripIds(C),C});s.forEach((T,O)=>{f.has(O)||e.remove(T)}),y?hr(e,d,m,v,g):yr(e,v,g,d,m),ir(e,v,n,o,l,a,i),ge(i,"onRowsApplied",l.path,v)}function ge(e,t,r,n){if(typeof e[t]=="function")try{return e[t](r.slice(),n)}catch(o){console.warn(`[hyper-html-api] ${t} threw at "${r.join(".")||"(root)"}"`,o);return}}function lr(e,t,r,n,o){let l=ge(o,"identifyRows",n.path,r);if(!Array.isArray(l))return null;let a=new Array(r.length).fill(-1),i=new Set,s=new Map(t.map((u,c)=>[e.identity(u),c]));for(let u=0;u<r.length;u++){if(!l[u])continue;let c=s.get(e.identity(l[u]));c===void 0||i.has(c)||(a[u]=c,i.add(c))}return a}function ir(e,t,r,n,o,l,a){t.forEach((i,s)=>{if(r===null){let u=n[s],c=u==null?"":String(u);e.text(i)!==c&&e.text(i,c)}else{let u=l(e,i,r,n[s],{depth:o.depth+1,path:[...o.path,s]},a);u&&u!==i&&(t[s]=u)}})}function ar(e,t,r,n){return r===null?e.text(t):oe(e,t,r,n.onRowsRead?{...n,onRowsRead:void 0}:n)}function Et(e,t,r){let n=e.children(t);for(let o=0;o<n.length;o++)if(e.sameNode(n[o],r))return o;return-1}function sr(e,t,r,n){if(!n.templateAttr)return null;let o=/^\s*:scope\s*>\s*/.test(r),l=new RegExp(":not\\(\\["+n.templateAttr.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&")+"\\]\\)","g"),a=r.replace(/^\s*:scope\s*>\s*/,"").replace(l,""),i=o?ur(a):0,s=mt(a),u=t;for(;u;){let c=e.find(u,a,{includeRulesTag:!1,templateAttr:null});for(let h of c)if(e.attr(h,n.templateAttr)!=null&&!(o&&!dr(e,t,h,i))&&!(s&&!e.matches(e.parent(h),s)))return h;u=e.parent(u)}return null}function ur(e){let t=0,r=null,n=1;for(let o=0;o<e.length;o++){let l=e[o];if(l==="\\")o++;else if(r)l===r&&(r=null);else if(l==='"'||l==="'")r=l;else if(l==="["||l==="(")t++;else if(l==="]"||l===")")t>0&&t--;else if(t===0&&l===">")n++;else{if(t===0&&(l==="+"||l==="~"))return null;if(t===0&&/\s/.test(l)){if(!cr(e,o))return null;for(;o+1<e.length&&/\s/.test(e[o+1]);)o++}}}return n}function cr(e,t){let r=t;for(;r<e.length&&/\s/.test(e[r]);)r++;let n=t>0?e[t-1]:"",o=r<e.length?e[r]:"";return Xe(n)||Xe(o)}function Xe(e){return e===">"||e==="+"||e==="~"}function dr(e,t,r,n){if(n===null)return!0;let o=r;for(let s=0;s<n;s++)if(o=e.parent(o),!o)return!1;let l=e.prop(t,"tagName");if(!l)return!0;let a=e.prop(o,"tagName");if(!a||String(a).toLowerCase()!==String(l).toLowerCase())return!1;let i=new Set(Ye(e,o));return Ye(e,t).every(s=>i.has(s))}function Ye(e,t){let r=e.attr(t,"class");return r?String(r).split(/\s+/).filter(Boolean):[]}function fr(e,t,r,n,o,l){let a=e.parent(n);if(a&&pr(e,t,a)&&!Qe(e,a,l))return a;let i=mt(r);if(!i)throw new Z(o.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 s=(i===":scope"?e.prop(t,"tagName")?[t]:[]:e.find(t,i,l)).filter(u=>!Qe(e,u,l));if(s.length===0)throw new Z(o.path,`no container matching "${i}" inside this context to hold the new rows`);if(s.length>1)throw new Z(o.path,`"${i}" matches ${s.length} containers inside this context, so the new rows have no single destination`);return s[0]}function pr(e,t,r){let n=r;for(;n;){if(e.sameNode(n,t))return!0;n=e.parent(n)}return e.parent(t)?!1:e.find(t,"*",{includeRulesTag:!0,templateAttr:null}).some(o=>e.sameNode(o,r))}var Ge=["no-data","editor-ui"];function Qe(e,t,r){let n=t;for(;n;){if(r.templateAttr&&e.attr(n,r.templateAttr)!=null||Ge.some(l=>e.attr(n,l)!=null))return!0;let o=e.attr(n,"clay");if(o&&o.split(/\s+/).some(l=>Ge.includes(l)))return!0;n=e.parent(n)}return!1}function hr(e,t,r,n,o){let l=e.children(t),a=l.map(s=>e.identity(s)),i=!1;n.forEach((s,u)=>{let c=e.identity(s),h=r+u;if(a[h]===c)return;if(!o[u]){let A=a.indexOf(c);A!==-1&&(a.splice(A,1),l.splice(A,1))}let p=Math.min(h,l.length);p<l.length?e.insertBefore(l[p],s):l.length?i?e.insertAfter(l[l.length-1],s):(e.insertAt(t,s,h),i=!0):e.insertAt(t,s,0),a.splice(p,0,c),l.splice(p,0,s)})}function mr(e,t){if(t.length<=1)return!0;let r=e.parent(t[0]);if(!r)return!1;let n=new Map(e.children(r).map((l,a)=>[e.identity(l),a])),o=[];for(let l of t){let a=n.get(e.identity(l));if(a===void 0)return!1;o.push(a)}return o.sort((l,a)=>l-a),o[o.length-1]-o[0]===o.length-1}function yr(e,t,r,n,o){let l=null,a=o;for(let i=0;i<t.length;i++){if(!r[i]){l=t[i];continue}let s=l?e.parent(l):n;if(!s)continue;let u=l?Et(e,s,l)+1:a++;e.insertAt(s,t[i],u),l=t[i]}}function le(e,t,r,n,o={}){if(Object.prototype.hasOwnProperty.call(o,"exclude")&&e.semanticExclude===!1)throw new Error("This adapter does not support semantic exclude queries; omit exclude or use the DOM adapter.");let l=[];if(ve(r,n,[],l),l.length)throw new ft(l);ie(e,t,r,n,{depth:0,path:[]},o)}function ie(e,t,r,n,o,l={}){if(o.depth>se)throw new Te(o.path);if(n===void 0)return t;if(typeof r=="string")return gr(e,t,r,n,o,l);if(Array.isArray(r)){let[a,i]=r;return At(e,t,a,i,n,o,ie,l),t}if(typeof r=="object"&&r!==null){for(let[a,i]of Object.entries(r)){let s=ie(e,t,i,n==null?n:n[a],{depth:o.depth+1,path:[...o.path,a]},l);s&&s!==t&&(t=s)}return t}return t}function gr(e,t,r,n,o,l){if(r.endsWith("[]")){let s=r.slice(0,-2);return At(e,t,s,null,n,o,ie,l),t}if(r.startsWith("@"))return tt(e,t,r.slice(1),n);let a=z(r);if(a!==-1){let s=r.slice(0,a),u=r.slice(a+1),c=s?e.find(t,s,l):[t];return c.length===0||tt(e,c[0],u,n),t}if(r===".")return et(e,t,n),t;let i=e.find(t,r,l);return i.length===0||et(e,i[0],n),t}function et(e,t,r){let n=r==null?"":String(r);e.text(t)!==n&&e.text(t,n)}function vr(e,t,r,n){if(e.styleVar){e.styleVar(t,r,n);return}vt(e,t,r,n)}function tt(e,t,r,n){if(Oe(r))return vr(e,t,r,n==null?"":String(n).trim()),t;if(ct.has(r)){let o=e.prop(t,r);if(o===n||o!=null&&n!=null&&String(o)===String(n))return t;throw new pt(r)}if(r==="outerHTML"){let o=n==null?"":String(n);return e.replaceWith(t,o)}if(zt.has(r)){let o=Ft(r,n);return e.prop(t,r)!==o&&e.prop(t,r,o),t}if(n==null)e.attr(t,r)!=null&&e.removeAttr(t,r);else{let o=String(n);e.attr(t,r)!==o&&e.attr(t,r,o)}return t}function ve(e,t,r,n){if(t!==void 0){if(typeof e=="string"){if(e.endsWith("[]")){Array.isArray(t)?t.forEach((o,l)=>{typeof o=="object"&&o!==null&&n.push({path:J([...r,l]),expected:"scalar",got:V(o)})}):n.push({path:J(r),expected:"array",got:V(t)});return}t!==null&&typeof t=="object"&&n.push({path:J(r),expected:"scalar",got:V(t)});return}if(Array.isArray(e)){if(!Array.isArray(t)){n.push({path:J(r),expected:"array",got:V(t)});return}let o=e[1];t.forEach((l,a)=>ve(o,l,[...r,a],n));return}if(typeof e=="object"&&e!==null){if(t===null||Array.isArray(t)||typeof t!="object"){n.push({path:J(r),expected:"object",got:V(t)});return}for(let[o,l]of Object.entries(e))ve(l,t[o],[...r,o],n)}}}function V(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function J(e){return e.join(".")}function wr(e){try{return JSON.parse(e)}catch(t){throw new Ee(`Invalid strict JSON: ${t.message}`,t)}}function Tt(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(o){let l=[],a=0;for(;a<o.length;){let i=o[a];if(/\s/.test(i)){a++;continue}if("{}".includes(i)){l.push({type:i,value:i}),a++;continue}if(i==="["){let h=!1,p=a+1;for(;p<o.length&&/\s/.test(o[p]);)p++;if(p<o.length&&/[a-zA-Z_]/.test(o[p])&&(h=!0),!h){l.push({type:i,value:i}),a++;continue}}if(i==="]"){l.push({type:i,value:i}),a++;continue}if(i===":"){l.push({type:t.COLON,value:i}),a++;continue}if(i===","){l.push({type:t.COMMA,value:i}),a++;continue}if(i==='"'||i==="'"){let h=i,p=a+1;for(;p<o.length&&o[p]!==h;)o[p]==="\\"&&p++,p++;l.push({type:t.STRING,value:o.substring(a+1,p),quoted:!0,sourceQuote:h}),a=p+1;continue}let s=a,u;for(;s<o.length&&!/[{},]/.test(o[s]);)if(o[s]===":"){let h=[":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 A of h){let d=A.substring(1);if(o.substring(s+1,s+1+d.length)===d){p=!0,s+=d.length;break}}if(!p)break}else if(o[s]==="["){for(s++;s<o.length&&o[s]!=="]";){if(o[s]==='"'||o[s]==="'"){let h=o[s];for(s++;s<o.length&&o[s]!==h;)o[s]==="\\"&&s++,s++}s++}s<o.length&&o[s]==="]"&&s++}else s++;u=o.substring(a,s);let c=t.IDENTIFIER;/^-?\d+(\.\d+)?$/.test(u)?c=t.NUMBER:u==="true"||u==="false"||u==="null"?c=t.BOOLEAN:/^[.#@\[]|[.#@\[]| /.test(u)&&(c=t.SELECTOR),l.push({type:c,value:u,quoted:!1}),a=s}return l}function n(o){let l="";for(let a=0;a<o.length;a++){let i=o[a];if("{}".includes(i.type)||"[]".includes(i.type)){l+=i.value;continue}if(i.type===t.COLON){l+=i.value;continue}if(i.type===t.COMMA){let s=o[a+1];if(s&&(s.type==="}"||s.type==="]"))continue;l+=i.value;continue}if(i.type===t.STRING&&i.quoted){let s=i.value;i.sourceQuote==="'"&&(s=s.replace(/\\'/g,"'"),s=s.replace(/(\\*)"/g,(u,c)=>c.length%2===0?c+'\\"':u)),l+=`"${s}"`;continue}if(i.type===t.NUMBER||i.type===t.BOOLEAN){l+=i.value;continue}if(i.type===t.SELECTOR||i.type===t.IDENTIFIER){l+=`"${i.value}"`;continue}l+=`"${i.value}"`}return l}try{let o=r(e),l=n(o);return JSON.parse(l)}catch(o){throw new Ee("Invalid extraction rules syntax: "+o.message,o)}}var br="1",rt=/^[a-zA-Z0-9_-]+$/;function ke(e,t,r){let n;if(r===void 0)n="script[data-rules-name]";else{if(typeof r!="string"||!rt.test(r))throw new Error(`hyper-html-api: invalid rules token ${JSON.stringify(r)} (must match ${rt})`);n=`script[data-rules-name~="${r}"]`}let o=e.find(t,n,{includeRulesTag:!0});if(o.length===0)return null;r!==void 0&&o.length>1&&console.warn(`hyper-html-api: ${o.length} rules tags match data-rules-name~="${r}"; using the first.`);let l=o[0],a=e.attr(l,"data-rules-version");if(a!==br)throw new dt(a);return{rules:Tt(e.text(l)),tagNode:l}}var Se=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"]})}),Ar=Object.freeze({"editor-ui":Object.freeze(["no-data","no-save","no-snapshot","no-watch","no-undo"])}),Er=Object.freeze(["no-save","no-snapshot","no-trigger-autosave","no-dirty","no-watch","no-undo","no-data","freeze","editor-ui","live"]);function ae(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 Ot(e,t){if(ae(e,t))return!0;for(let[r,n]of Object.entries(Ar))if(n.includes(t)&&ae(e,r))return!0;return!1}function we(e){let t=Se[e];if(!t)throw new Error(`Unknown region capability: ${e}`);return[...t.tokens,...t.bundles].flatMap(r=>[`[clay~="${r}"]`,`[${r}]`]).join(", ")}function Tr(e,t){let r=e&&e.nodeType===1?e:e?.parentElement;for(;r&&r.nodeType===1;){let n=Se[t];if(!n)throw new Error(`Unknown region capability: ${t}`);if(n.tokens.some(o=>Ot(r,o))||n.bundles.some(o=>ae(r,o)))return r;r=r.parentElement}return null}function Or(e,t){return!!Tr(e,t)}var Ne=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",...Er],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"]})}),xr=new Set(["textContent","innerText"]);function kr(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 Sr=/^[^\t\n\f\r "'>/=\u0000-\u001f\u007f]+$/;function Nr(e,t,r=Ne){if(!Sr.test(String(e)))return`attribute name ${JSON.stringify(String(e))} is not valid`;let n=String(e).toLowerCase();if(r.refusedAttributePrefixes.some(o=>n.startsWith(o)))return`attribute "${n}" can run script`;if(r.refusedAttributes.includes(n))return`attribute "${n}" is not content`;if(r.urlAttributes.includes(n)&&t!=null){let o=n==="srcset"?String(t).split(",").map(l=>l.trim().split(/\s+/)[0]).filter(Boolean):[String(t)];for(let l of o){let a=kr(l);if(a&&r.refusedSchemes.includes(a))return`"${a}:" URLs are not allowed in "${n}"`}}return null}function Le(e,t){let r=e.prop(t,"tagName");return r?String(r).toLowerCase():""}function Lr(e,t){let r=Le(e,t)||"node",n=e.attr(t,"id");return n?`<${r}#${n}>`:`<${r}>`}function Rr(e,t,r){let n=t;for(;n;){let o=Le(e,n);if(o&&r.refusedTargets.includes(o))return o;n=e.parent(n)}return null}function xt(e,t){return e.find(t,"script[data-rules-name]",{includeRulesTag:!0,templateAttr:null}).length>0}function Cr(e,t){return Le(e,t)==="script"&&e.attr(t,"data-rules-name")!=null?!0:xt(e,t)}function $r(e){if(/[\u0000-\u001f\u007f]/.test(e))return"control characters are not allowed in a custom property value";let t=[],r=null;for(let n=0;n<e.length;n++){let o=e[n];if(r){o===r&&(r=null);continue}if(o==='"'||o==="'")r=o;else{if(o==="/"&&e[n+1]==="*")return"comments are not allowed in a custom property value";if(o==="(")t.push(")");else if(o==="[")t.push("]");else if((o===")"||o==="]")&&t.pop()!==o)return`"${o}" 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 Mr(e,t=Ne){let r=t.customPropertyValues,n=String(e);if(n.length>r.maxLength)return`custom property values are limited to ${r.maxLength} characters`;let o=r.refusedCharacters.find(s=>n.includes(s));if(o)return`${JSON.stringify(o)} is not allowed in a custom property value`;let l=$r(n);if(l)return l;let a=n.toLowerCase(),i=r.refusedFunctions.find(s=>new RegExp(`(^|[^a-z0-9_-])${s.replace(/[-]/g,"\\-")}\\s*\\(`).test(a));return i?`"${i}()" is not allowed in a custom property value`:null}function nt(e,t=Ne){let r=[],n=(i,s)=>(r.push({target:Lr(e,i),reason:s}),!1),o=i=>{let s=Rr(e,i,t);return s?n(i,`inside <${s}>, which is not content`):!0},l=i=>o(i)?xt(e,i)?n(i,"a text write here would delete the data rules tag"):!0:!1,a=(i,s,u)=>{if(!o(i))return!1;let c=Nr(s,u,t);return c?n(i,c):!0};return{...e,text(i,s){if(s===void 0)return e.text(i);l(i)&&e.text(i,s)},attr(i,s,u){if(u===void 0)return e.attr(i,s);a(i,s,u)&&e.attr(i,s,u)},removeAttr(i,s){a(i,s,null)&&e.removeAttr(i,s)},styleVar(i,s,u){if((xe(e.attr(i,"style"),s)??"")!==u&&o(i)){if(!Oe(s))return n(i,`"${s}" is not a custom property`);if(u!==""){let c=Mr(u,t);if(c)return n(i,c)}vt(e,i,s,u)}},prop(i,s,u){if(u===void 0)return e.prop(i,s);if(t.refusedRuleForms.includes(s))return n(i,`"@${s}" writes HTML, only text is allowed`);if(xr.has(s)){l(i)&&e.prop(i,s,u);return}a(i,s==="className"?"class":s,u)&&e.prop(i,s,u)},remove(i){if(Cr(e,i)){n(i,"removing this would delete the data rules tag");return}e.remove(i)},replaceWith(i,s){return s===e.prop(i,"outerHTML")||n(i,'"@outerHTML" writes HTML, only text is allowed'),i},refusals:r,assertClean(){if(r.length)throw new ht(r.slice())}}}function K(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ot(e){return e.reduce((t,r)=>typeof r=="number"?`${t}[${r}]`:t?`${t}.${r}`:r,"")}function jr(e,t,r,n,o={}){let l=[],a=[];function i(u,c,h){if(Array.isArray(u)){let[,p]=u;if(!Array.isArray(c)||!K(p))return;c.forEach((A,d)=>i(p,A,[...h,d]));return}if(!(!K(u)||!K(c)))for(let p of Object.keys(c))Object.prototype.hasOwnProperty.call(u,p)?i(u[p],c[p],[...h,p]):l.push(ot([...h,p]))}function s(u,c,h,p){if(h!==void 0){if(typeof c=="string"){if(c.endsWith("[]")||c==="."||c.startsWith("@"))return;let A=z(c),d=A===-1?c:c.slice(0,A);if(!d)return;e.find(u,d,o).length===0&&a.push({path:ot(p),selector:d});return}if(!Array.isArray(c)&&K(c)&&K(h))for(let[A,d]of Object.entries(c))s(u,d,h[A],[...p,A])}}return i(r,n,[]),s(t,r,n,[]),{unknownKeys:l,unmatched:a}}function lt(e,t,r){if(r&&typeof r=="object")return{rules:r,tagNode:null};if(typeof r=="string"){let n=t&&t.ownerDocument?t.ownerDocument:t;return ke(e,n,r)}return null}var Ir=/:(?:focus(?:-within|-visible)?|hover|active|visited|defined)\b/i;function Dr(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 it(e,t,r,n){if(n)return!!e.closest?.(t);let o=e;for(;o?.nodeType===1;){if(o.matches(t))return!0;if(o===r)break;o=o.parentElement}return!1}function at(e,t,r,n,o,l){return(l?Or(e,t):it(e,r,o,!1))||!!(n&&(l&&e!==o?e.matches(n):it(e,n,o,l)))}function Pr(e,t){let r=Se[t];return r.tokens.some(n=>Ot(e,n))||r.bundles.some(n=>ae(e,n))}var Br=new Set(["INPUT","TEXTAREA","SELECT","OPTION"]);function kt(e,t,r,n){if(e.nodeType===1&&n(e)){r.dropped.push(t);return}r.cloneToLive.set(t,e),r.liveToClone.set(e,t);let o=e,l=t;if(e.nodeType===1){if(Br.has(e.tagName)&&r.controls.push(e,t),e.tagName==="TEMPLATE"){for(;t.firstChild;)t.removeChild(t.firstChild);o=e.content,l=t.content,r.cloneToLive.set(l,o),r.liveToClone.set(o,l)}}else if(e.nodeType!==11)return;let a=l.firstChild;for(let i=o.firstChild;i&&a;i=i.nextSibling)kt(i,a,r,n),a=a.nextSibling}function re(e,{capability:t="data",exclude:r=null,inherit:n=!0,provenance:o=null}={}){if(!e)throw new TypeError("createContentView requires a DOM context");let l=e.nodeType===9?e:e.ownerDocument;if(!l?.implementation?.createHTMLDocument)throw new TypeError("createContentView requires an HTML DOM implementation");let a=l.implementation.createHTMLDocument(""),i=o||new WeakMap,s=new WeakMap,u=e.nodeType===9?e.documentElement:e;r&&a.documentElement.matches(r);let c=we(t),h=n?d=>Pr(d,t)||!!(r&&d.matches(r)):d=>at(d,t,c,r,u,!1),p=null;if(u.nodeType!==1||!at(u,t,c,r,u,n)){p=a.importNode(u,!0);let d={cloneToLive:i,liveToClone:s,dropped:[],controls:[]};kt(u,p,d,h);for(let m of d.dropped)m.remove();for(let m=0;m<d.controls.length;m+=2)Dr(d.controls[m],d.controls[m+1])}e.nodeType===9&&p&&(a.replaceChild(p,a.documentElement),s.set(e,a),i.set(a,e));let A=d=>{if(Ir.test(d))throw new Error(`Filtered content queries do not support stateful selector: ${d}`)};return{root:p,document:a,capability:t,selector:we(t),cloneToLive:i,liveToClone:s,original(d){return i.get(d)||null},cloneOf(d){return s.get(d)||null},query(d,m=p){return A(d),Array.from(m.querySelectorAll(d),y=>i.get(y)||y)},text(d=p){return(d===p?p:s.get(d))?.textContent||""},html(d=p){return(d===p?p:s.get(d))?.innerHTML??""},clone(d=p){let m=d===p?p:s.get(d);return m?a.importNode(m,!0):null}}}function St(e){return e&&e.nodeType===1&&e.tagName==="SCRIPT"&&e.hasAttribute&&e.hasAttribute("data-rules-name")}function Hr(e){return e?(e.nodeType===9||e.nodeType,e):null}function st(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 Nt(e,t){e&&e.tagName==="TEXTAREA"&&(e.value=t)}function Lt(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 n=r.type;n!=="file"&&n!=="checkbox"&&n!=="radio"&&(r.value=r.defaultValue),r.checked=r.defaultChecked}else r.tagName==="OPTION"&&(r.selected=r.defaultSelected)}var S={semanticExclude:!0,find(e,t,r={}){let n=Hr(e);if(!n||!n.querySelectorAll)return[];let o=Array.from(n.querySelectorAll(t));r.includeRulesTag||(o=o.filter(i=>!St(i)));let l=[];r.skip&&l.push(r.skip);let a=r.templateAttr===null?null:r.templateAttr||"cms-template";if(a&&l.push("["+a+"]"),l.length){let i=l.join(", ");o=o.filter(s=>!s.closest||!s.closest(i))}return o},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,Nt(e,t)},attr(e,t,r){if(r===void 0)return e.hasAttribute&&e.hasAttribute(t)?e.getAttribute(t):null;e.setAttribute(t,r),st(e,t,r)},removeAttr(e,t){e&&e.removeAttribute&&e.removeAttribute(t),st(e,t,null)},prop(e,t,r){if(r===void 0){let n=e?e[t]:void 0;return n!==void 0?n:null}e[t]=r},clone(e){let t=e.cloneNode(!0);return Lt(t),t},insertAt(e,t,r){let n=e.children[r]||null;e.insertBefore(t,n)},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 n=r.content.firstElementChild;if(!n)throw new Error("dom.replaceWith: html did not parse to an element");return e.parentNode.replaceChild(n,e),n},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 H(e,t={}){if(t.exclude===null)return S;let r=[we("data"),t.exclude].filter(Boolean).join(", "),n=e.nodeType===9?e:e.ownerDocument||e,o=e.nodeType===9?e.documentElement:e;if(!t._write&&!o?.matches?.(r)&&!o?.querySelector?.(r)&&!n?.querySelector?.(r))return S;let l=e.nodeType===9||!e.isConnected?e:e.ownerDocument,a=e.nodeType===9?e:e.ownerDocument,i=null,s=()=>i||(i=re(l,{capability:"data",exclude:t.exclude||null})),u=d=>{let m=s();return d===e?m.cloneOf(e):m.cloneOf(d)||d},c=d=>i?.original(d)||d,h=(d,m)=>{s().liveToClone.set(d,m),s().cloneToLive.set(m,d);let y=d.childNodes||[],f=m.childNodes||[];for(let g=0;g<Math.min(y.length,f.length);g++)h(y[g],f[g])},p=(d,m,y,f)=>{let g=Array.from(d.childNodes).filter(x=>i.cloneOf(x)),v=g[0];for(;v&&g.includes(v);)v=v.nextSibling;for(let x of g)x.remove();if(y==="innerHTML"){let x=a.createElement("template");x.innerHTML=f;for(let C of Array.from(x.content.childNodes))d.insertBefore(C,v||null)}else d.insertBefore(a.createTextNode(f),v||null),Nt(d,f);let T=re(d,{capability:"data",exclude:t.exclude||null});m.replaceChildren(...Array.from(T.root?.childNodes||[]));let O=x=>{let C=T.original(x);C&&(i.liveToClone.set(C,x),i.cloneToLive.set(x,C));for(let W of Array.from(x.childNodes||[]))O(W)};for(let x of Array.from(m.childNodes))O(x)},A={...S,find(d,m,y={}){let f=u(d);if(!f?.querySelectorAll)return[];let g=s().query(m,f);y.includeRulesTag||(g=g.filter(O=>!St(O)));let v=[];y.skip&&v.push(y.skip);let T=y.templateAttr===null?null:y.templateAttr||"cms-template";if(T&&v.push(`[${T}]`),v.length){let O=v.join(", ");g=g.filter(x=>!x.closest?.(O))}return g},parent(d){let m=u(d)?.parentElement;return m?c(m):null},children(d){return Array.from(u(d)?.children||[],c)},text(d,m){if(m===void 0){let g=c(d);return!g?.matches?.(r)&&!g?.querySelector?.(r)?S.text(g):(u(d)?.textContent||"").trim()}let y=c(d);if(!y?.matches?.(r)&&!y?.querySelector?.(r)&&!i){S.text(y,m);return}let f=s().cloneOf(y);f?p(y,f,"textContent",m):S.text(y,m)},attr(d,m,y){let f=c(d);if(y===void 0)return S.attr(f,m);S.attr(f,m,y);let g=i?.cloneOf(f);g&&(S.attr(g,m,y),re(f,{capability:"data",exclude:t.exclude||null}).root===null&&(g.remove(),i.liveToClone.delete(f),i.cloneToLive.delete(g)))},removeAttr(d,m){let y=c(d);S.removeAttr(y,m);let f=i?.cloneOf(y);f&&S.removeAttr(f,m)},prop(d,m,y){let f=c(d);if(y===void 0)return m==="innerHTML"||m==="outerHTML"||m==="textContent"||m==="innerText"?S.prop(u(f),m):S.prop(f,m);let g=m==="innerHTML"||m==="textContent"||m==="innerText",v=g?s().cloneOf(f):i?.cloneOf(f);v&&g?p(f,v,m,y):(S.prop(f,m,y),v&&S.prop(v,m,y))},clone(d){let m=u(d);if(m===d)return S.clone(d);let y=a.importNode(m,!0);return Lt(y),y},insertAt(d,m,y){let f=c(d),g=A.children(f)[y]||(()=>{for(let O=f.children.length-1;O>=0;O--){let x=f.children[O];if(s().cloneOf(x))return x.nextElementSibling}return f.firstElementChild})(),v=c(m);f.insertBefore(v,g||null);let T=s().cloneOf(f);if(T){let O=s().cloneOf(v);O||(O=a.importNode(v,!0),h(v,O));let x=Array.from(T.children);T.insertBefore(O,x[y]||null)}},insertBefore(d,m){let y=c(d),f=c(m);y.parentNode.insertBefore(f,y);let g=s().cloneOf(y.parentNode);if(g){let v=s().cloneOf(f);v||(v=a.importNode(f,!0),h(f,v));let T=s().cloneOf(y);T?T.before(v):g.appendChild(v)}},insertAfter(d,m){let y=c(d),f=c(m);y.parentNode.insertBefore(f,y.nextSibling);let g=s().cloneOf(y.parentNode);if(g){let v=s().cloneOf(f);v||(v=a.importNode(f,!0),h(f,v));let T=s().cloneOf(y);T?T.after(v):g.appendChild(v)}},identity(d){return c(d)||null},remove(d){let m=c(d),y=s().cloneOf(m);S.remove(m),y&&S.remove(y)},replaceWith(d,m){let y=c(d),f=s().cloneOf(y),g=S.replaceWith(y,m);if(f){let v=re(g,{capability:"data",exclude:t.exclude||null});if(!v.root)f.remove();else{f.replaceWith(v.root);let T=O=>{let x=v.original(O);x&&(i.liveToClone.set(x,O),i.cloneToLive.set(O,x));for(let C of Array.from(O.childNodes||[]))T(C)};T(v.root)}}return g}};return A}var ne=S,ue={extract:(e,t,r={})=>oe(H(e,r),e,t,r),apply:(e,t,r,n={})=>le(H(e,{...n,_write:!0}),e,t,r,n),findRulesIn:(e,t)=>ke(ne,e,t),findRules:(e,t)=>lt(ne,e,t),bind:(e,t,r={})=>{let n=lt(ne,e,t);if(!n){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}`)}return{...n,get:()=>oe(H(e,r),e,n.rules,r),set:o=>le(H(e,{...r,_write:!0}),e,n.rules,o,r)}},parseStrict:wr,parseRelaxed:Tt,ruleAttrIndex:z,splitRule:Xt,errors:P,DOM_PROPERTIES:ut},be=e=>!!e&&typeof e.nodeType=="number";function Rt(e){let t=e&&e.ownerDocument?e.ownerDocument:e,r=ke(ne,t,"api");if(!r)throw new P.NoRulesTag("api");return r.rules}function Wr(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 Ur(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 qr(e,t){let r=[];for(;t!==e;){let n=t.parentNode;r.push(Array.prototype.indexOf.call(n.childNodes,t)),t=n}return r.reverse()}function _r(e,t){return t.reduce((r,n)=>r.childNodes[n],e)}function _(e,t){let r=e.querySelectorAll?Array.from(e.querySelectorAll(t)):[];return e.matches?.(t)&&r.unshift(e),r}function zr(e,t){let r=_(e,"option"),n=_(t,"option");r.forEach((s,u)=>n[u].selected=s.selected);let o=_(e,"input"),l=_(t,"input");o.forEach((s,u)=>{let c=s.type.toLowerCase();c!=="file"&&(l[u].value=s.value),(c==="checkbox"||c==="radio")&&(l[u].checked=s.checked)});let a=_(e,"textarea"),i=_(t,"textarea");a.forEach((s,u)=>i[u].value=s.value)}function Ae(e,t){if(t!==void 0){if(typeof e=="string"){if(e.endsWith("[]"))return;let r=e.startsWith("@")?0:z(e);if(r===-1)return;let n=e.slice(r+1);if(ct.has(n))throw new P.RuleTargetReadOnly(n);return}if(Array.isArray(e)){if(!Array.isArray(t))return;t.forEach(r=>Ae(e[1],r));return}if(e&&typeof e=="object"&&t&&typeof t=="object"&&!Array.isArray(t))for(let[r,n]of Object.entries(e))Ae(n,t[r])}}function Fr(e,t,r){let n={templateAttr:"cms-template"},o=Wr(e),l=qr(o,e),a=Ur(o);zr(o,a);let i=_r(a,l),s=H(a,{...n,_write:!0}),u=jr(s,i,t,r,n);if(u.unknownKeys.length||u.unmatched.length)throw new P.WriteRejected(u.unknownKeys,u.unmatched);let c=nt(s);le(c,i,t,r,n),c.assertClean(),Ae(t,r);let h=nt(H(o,{...n,_write:!0}));le(h,e,t,r,n),h.assertClean()}function Vr(e){if(!(e instanceof Error))return e;let t=e.name||"Error";try{e.code=t}catch{Object.defineProperty(e,"code",{value:t,configurable:!0,enumerable:!0})}return e instanceof P.WriteRefused?e.details=e.refusals:e instanceof P.WriteRejected?e.details={unknownKeys:e.unknownKeys,unmatched:e.unmatched}:e instanceof P.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 X(e,t){let r=be(e)?e:document,n=be(e)?t:e;return n===void 0?oe(H(r),r,Rt(r)):ue.bind(r,n).get()}function Y(e,t,r){try{if(!be(e))throw new Error("hyper-html-api: applyData(root, data, source?) needs a DOM root as the first argument.");let n=r===void 0?Rt(e):ue.bind(e,r).rules;Fr(e,n,t)}catch(n){throw Vr(n)}return e}var Jr="clay:visitor-drafts:",Ct=1;function Ce(){try{return window.localStorage}catch{return null}}var I=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function Kr(e){let t=[];for(let r of e.matchAll(/([^.[\]]+)|\[(\d+)\]/g))t.push(r[2]!==void 0?Number(r[2]):r[1]);return t}function Zr(e,t){let r=Kr(t),n=e;for(let o=0;o<r.length-1;o++)if(n=n?.[r[o]],n==null||typeof n!="object")return;n&&typeof n=="object"&&delete n[r[r.length-1]]}function B(e,t){return Array.isArray(e)?Array.isArray(t)&&t.length===e.length&&e.every((r,n)=>B(r,t[n])):I(e)?I(t)&&Object.keys(e).every(r=>B(e[r],t[r])):e===t}function ce(e,t){return B(e,t)&&B(t,e)}var $t=e=>Array.isArray(e)&&e.every(t=>I(t)&&(typeof t.id=="string"||typeof t.id=="number"))&&new Set(e.map(t=>t.id)).size===e.length;function de(e,t,r=!1){if(I(e)&&I(t)){let n={...e};for(let o of Object.keys(t))o in e?n[o]=de(e[o],t[o]):r||(n[o]=t[o]);return n}if($t(e)&&$t(t)){let n=new Map(t.map(o=>[o.id,o]));return e.map(o=>n.has(o.id)?de(o,n.get(o.id)):o)}return e}function Mt(e,t,r){if(ce(t,r)||ce(r,e))return{value:t,conflict:!1};if(ce(t,e))return{value:r,conflict:!1};if(I(t)&&I(r)){let n={},o=!1;for(let l of new Set([...Object.keys(t),...Object.keys(r)])){let a=Mt(I(e)?e[l]:void 0,t[l],r[l]);o||=a.conflict,a.value!==void 0&&(n[l]=a.value)}return{value:n,conflict:o}}return{value:t,conflict:!0}}function Re(e,t){F(!0),e.dispatchEvent(new CustomEvent("clay:drafts-store-failed",{detail:{error:t}}));let r=new Error("Couldn't save in this browser. Storage is full or turned off.");return r.code="draft-storage",r}function jt({doc:e=document,storage:t=Ce(),now:r=()=>new Date}={}){let n=te(e),o=Jr+n,l=ue.findRulesIn(e,"api").rules,a=null,i=null,s=null,u=!1;function c(){try{return t?t.getItem(o):null}catch{return null}}function h(b){try{let w=JSON.parse(b);if(I(w)&&w.v===Ct&&I(w.data))return w}catch{}return null}function p(){let b=c();return b==null?null:{raw:b,record:h(b)}}function A(){return X(e,l)}function d(){let b=window.clay?.getHTML;return typeof b!="function"?A():X(new DOMParser().parseFromString(b.call(window.clay),"text/html"),l)}function m(){try{if(typeof t.keys=="function")return t.keys();let b=[];for(let w=0;w<t.length;w++)b.push(t.key(w));return b}catch{return[]}}function y(){try{return JSON.stringify(d())}catch{return null}}function f(b,{keepSlot:w=!1}={}){let k=m().find(j=>j.startsWith(o+":unreadable:")&&t.getItem(j)===b);if(k){if(s=null,!w)try{t.removeItem(o)}catch{}return k}let N=o+":unreadable:"+r().toISOString();try{t.setItem(N,b)}catch{return s=b,console.warn("visitor-drafts: this browser's saved copy no longer fits the page, and there is no room to keep it aside; nothing will be saved over it"),null}if(s=null,!w)try{t.removeItem(o)}catch{}return console.warn(w?"visitor-drafts: part of this browser's saved copy no longer fits the page; the original was kept under":"visitor-drafts: this browser's saved copy no longer fits the page; it was kept under",N),N}function g(b){let w=de(JSON.parse(JSON.stringify(b)),A(),!0),k=[];for(let N=0;N<4;N++){let j=e.cloneNode(!0);try{Y(j,w,l)}catch(R){let pe=R?.details?.unknownKeys??R?.unknownKeys;if(Array.isArray(pe)&&pe.length){for(let q of pe)Zr(w,q);continue}let he=Object.keys(w).filter(q=>{try{return Y(e.cloneNode(!0),{[q]:w[q]},l),!1}catch{return!0}});if(!he.length)return null;for(let q of he)delete w[q];k.push(...he);continue}let ee=X(j,l),U=Object.keys(w).filter(R=>!B(w[R],ee[R]));if(!U.length)return{data:w,dropped:k};for(let R of U)delete w[R];k.push(...U)}return null}function v(b){let w=f(b);return w||(a=b),i=A(),w?{restored:!1,hadDraft:!0,parked:!0}:{restored:!1,hadDraft:!0,parked:!1,blocked:!0}}function T(){let b=p();if(!b)return i=A(),{restored:!1,hadDraft:!1};if(!b.record)return v(b.raw);let w=g(b.record.data);if(!w||!Object.keys(w.data).length)return v(b.raw);if(Y(e,w.data,l),a=b.raw,i=A(),w.dropped.length){let k=f(b.raw,{keepSlot:!0});return{restored:!0,hadDraft:!0,data:w.data,partial:!0,parked:!!k,blocked:!k}}return{restored:!0,hadDraft:!0,data:w.data}}function O(){if(u)return!1;try{return!B(d(),i)}catch{return!0}}function x(b){let w=o+":conflict";try{t.setItem(w,b)}catch(k){throw Re(e,k)}console.warn("visitor-drafts: another tab changed the same thing; its copy was kept under",w)}function C(b){let w=c(),k=w==null?null:h(w);if(!k)return{data:b,stored:null};let N=b;if(w!==a){let j=Mt(i,b,k.data);j.conflict&&x(w),N=j.value}return N=de(N,k.data),{data:N,stored:ce(N,k.data)?w:null}}function W(b){let w=g(b);if(!w||!Object.keys(w.data).length)return null;Y(e,w.data,l);try{window.Sap?.refresh?.()}catch{}return e.dispatchEvent(new CustomEvent("clay:drafts-restored",{detail:{restored:!0,hadDraft:!0,parked:!1,external:!0}})),w.data}function Q(b){if(u)return null;if(s!=null&&f(s,{keepSlot:!0})===null)throw Re(e,new Error("an earlier saved copy could not be kept aside"));let w=X(new DOMParser().parseFromString(b,"text/html"),l),k=c();if(B(w,i)&&(k===a||k==null))return F(!1),e.dispatchEvent(new CustomEvent("clay:drafts-saved",{detail:{data:w,unchanged:!0}})),w;let{data:N,stored:j}=C(w),ee=j??JSON.stringify({v:Ct,savedAt:r().toISOString(),data:N});if(!j)try{if(!t)throw new Error("no storage");t.setItem(o,ee)}catch(R){throw Re(e,R)}let U=Object.keys(w).filter(R=>!B(w[R],N[R]));return U.length&&W(Object.fromEntries(U.map(R=>[R,N[R]]))),a=ee,i=N,F(!1),e.dispatchEvent(new CustomEvent("clay:drafts-saved",{detail:{data:N}})),N}function E(){try{return Q(window.clay.getHTML()),!0}catch{return!1}}function L(){return u||!O()?!0:E()}function $(){if(u)return!1;let b=c();if(b==null||b===a||O())return!1;let w=h(b),k=w&&W(w.data);return k?(a=b,i={...i,...k},!0):!1}function D(){u=!0,s=null,F(!1);try{t.removeItem(o)}catch{}}return{slot:n,key:o,rules:l,read:p,restore:T,write:Q,writeLive:E,flush:L,changed:O,adoptExternal:$,park:f,clear:D,snapshot:y}}function It(e,t){let r=`clay:visitor-drafts:${e}:ui`,n=()=>({v:1,prompt:{},intro:{done:null},src:null}),o=n();try{let l=JSON.parse(t?.getItem(r)||"null");l&&typeof l=="object"&&l.v===1&&(o={...n(),...l})}catch{}return{get:()=>o,save(){try{t?.setItem(r,JSON.stringify(o))}catch{}},reset(){o=n();try{t?.removeItem(r)}catch{}}}}var Xr=/^[a-z0-9][a-z0-9-]{0,39}$/;function Dt(e,t=window.location.search){let r=e.get(),n=null;try{n=new URLSearchParams(t).get("src")}catch{}return!r.src&&n&&Xr.test(n)&&(r.src=n,e.save()),r.src}function Pt(e,t=window.location){let r=t.pathname.replace(/\/+$/,"");return r&&!/\.(html|htmlclay)$/.test(r)&&(r+=".html"),`/_/download${r}?as=htmlclay${e?`&src=${encodeURIComponent(e)}`:""}`}var Yr="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@500&family=IBM+Plex+Sans:wght@400;500;600&family=Newsreader:opsz,wght@6..72,500&display=swap",Gr=`<aside class="hcp" id="hcp" hidden aria-label="Download this app" data-hcp-state="tab" data-hcp-reason="open" sap-ignore clay="editor-ui">
|
|
2
|
+
<section class="hcp-card" id="hcp-card" role="dialog" aria-modal="false" aria-labelledby="hcp-title">
|
|
3
|
+
<button type="button" class="hcp-x" data-hcp="minimize" aria-label="Minimize"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square" aria-hidden="true"><path d="M5 12h14"/></svg></button>
|
|
4
|
+
<div class="hcp-kicker">Free download</div>
|
|
5
|
+
<h2 class="hcp-title" id="hcp-title"><span data-hcp-for="use">Your work is saved in this browser only.</span><span data-hcp-for="open">This app is free to keep.</span><span data-hcp-for="return">Your work is saved in this browser only.</span><span data-hcp-for="error">Your work isn't being saved in this browser.</span></h2>
|
|
6
|
+
<p class="hcp-body"><span data-hcp-for="open">Download it as one file and use it on your computer, no account needed.</span><span data-hcp-for="use">Download the file to keep it on your computer for good.</span><span data-hcp-for="return">Download the file to keep it on your computer for good.</span><span data-hcp-for="error">Storage is full or turned off here. Download the file to keep what you've done.</span></p>
|
|
7
|
+
<div class="hcp-file">
|
|
8
|
+
<svg width="20" height="20" viewBox="0 0 256 256" fill="currentColor" aria-hidden="true"><path d="M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"/></svg>
|
|
9
|
+
<div><b class="hcp-name" data-hcp-name>This app</b><small>One file with the whole app and your work in it</small></div>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="hcp-actions">
|
|
12
|
+
<a class="hcp-btn hcp-btn--primary" data-hcp-link href="/_/download?as=htmlclay"><span><svg width="16" height="16" viewBox="0 0 256 256" fill="currentColor" aria-hidden="true"><path d="M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"/></svg>Download free</span></a>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="hcp-foot"><button type="button" class="hcp-quiet" data-hcp="dismiss">Don’t show again</button></div>
|
|
15
|
+
</section>
|
|
16
|
+
<div class="hcp-dock">
|
|
17
|
+
<button type="button" class="hcp-btn hcp-tab" data-hcp="open" aria-controls="hcp-card" aria-expanded="false" aria-label="This app is free to keep"><span><svg width="16" height="16" viewBox="0 0 256 256" fill="currentColor" aria-hidden="true"><path d="M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"/></svg><span class="hcp-tab__label">This app is free to keep</span><span class="hcp-tab__mini">Keep</span></span></button>
|
|
18
|
+
<button type="button" class="hcp-x" data-hcp="minimize" aria-label="Minimize download notice"><svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" aria-hidden="true"><path d="M1.4 0 6 4.6 10.6 0 12 1.4 7.4 6 12 10.6 10.6 12 6 7.4 1.4 12 0 10.6 4.6 6 0 1.4z"/></svg></button>
|
|
19
|
+
</div>
|
|
20
|
+
</aside>`;async function Bt({memory:e,appName:t,link:r}){if(!document.getElementById("hcp-style")){let{PROMPT_CSS:E}=await import("../c-SGIA4IEQ.js");document.head.insertAdjacentHTML("beforeend",`<link rel="stylesheet" clay="editor-ui" href="${Yr}">
|
|
21
|
+
<style clay="editor-ui" id="hcp-style">${E}</style>`)}document.getElementById("hcp")||document.body.insertAdjacentHTML("beforeend",Gr);let n=document.getElementById("hcp"),o=e.get();(!o.prompt||typeof o.prompt!="object")&&(o.prompt={});let l=o.prompt,a=3,i=2500,s=/^(INPUT|TEXTAREA|SELECT)$/,u="#hcp, .clay-intro, .clay-owner",c=n.querySelector("[data-hcp-link]");c.href=r,t&&(n.querySelector("[data-hcp-name]").textContent=t);let h=n.querySelector("[data-hcp=open]");function p(E,L){n.hidden=!1,n.setAttribute("data-hcp-state",E),L&&n.setAttribute("data-hcp-reason",L),h.setAttribute("aria-expanded",E==="card"?"true":"false"),(E==="card"||E==="mini")&&(l.shown=!0,e.save(),n.setAttribute("data-hcp-arrived","")),O()}function A(E){return E&&!n.contains(E)&&!E.closest(u)&&(s.test(E.tagName)||E.isContentEditable)}let d=null;function m(E){clearTimeout(d),d=setTimeout(()=>{if(l.shown||l.dismissed||n.getAttribute("data-hcp-state")!=="tab")return;let L=document.activeElement;if(A(L)){let $=L.getBoundingClientRect(),D=Math.min(360,innerWidth-32);if(innerWidth<700||$.right>innerWidth-D-32&&$.bottom>innerHeight-380)return}p("card",E)},i)}let y=[];function f(E){n.contains(E.target)||!A(E.target)||(y.indexOf(E.target)<0&&y.push(E.target),l.uses=Math.max(l.uses||0,y.length),l.shown||e.save(),y.length>=a&&m("use"))}function g(E){A(E.target)&&(n.getAttribute("data-hcp-state")==="card"&&p(l.shown?"mini":"tab"),innerWidth<700&&n.setAttribute("data-hcp-typing",""))}function v(){setTimeout(()=>{A(document.activeElement)||n.removeAttribute("data-hcp-typing")},50)}let T=0;function O(){T||(T=requestAnimationFrame(()=>{T=0;let L=Ue(innerWidth-24,$=>n.contains($)||$.closest("[data-hcp-preview], .clay-owner"))+"px";n.style.getPropertyValue("--hcp-lift")!==L&&n.style.setProperty("--hcp-lift",L),We()}))}function x(){let E=window.clay&&window.clay.getHTML;if(typeof E!="function"||typeof URL>"u"||typeof URL.createObjectURL!="function")return!1;let L=location.pathname.split("/").filter(Boolean).pop()||"index.html",$=URL.createObjectURL(new Blob([E()],{type:"text/html"})),D=document.createElement("a");return D.href=$,D.download=L.replace(/\.html$/,".htmlclay"),document.body.appendChild(D),D.click(),D.remove(),setTimeout(()=>URL.revokeObjectURL?.($),1e3),!0}n.addEventListener("click",E=>{let L=E.target.closest("[data-hcp]");if(L){let $=L.getAttribute("data-hcp");$==="open"?(p("card","open"),c.focus()):$==="minimize"?(p("mini"),h.focus()):$==="dismiss"&&(n.getAttribute("data-hcp-reason")==="error"?(p("mini"),h.focus()):(l.dismissed=!0,p("mini"),h.focus()));return}E.target.closest("[data-hcp-link]")&&(n.getAttribute("data-hcp-reason")==="error"&&(E.preventDefault(),x()),l.downloaded=!0,l.shown=!0,e.save())}),n.addEventListener("animationend",E=>{(E.animationName==="hcp-arrive"||E.animationName==="hcp-arrive-fade")&&n.setAttribute("data-hcp-arrived","")}),n.addEventListener("keydown",E=>{E.key==="Escape"&&n.getAttribute("data-hcp-state")==="card"&&(p("mini"),h.focus())});function C(){p("card","error")}function W(){n.getAttribute("data-hcp-reason")==="error"&&n.setAttribute("data-hcp-reason","use")}let Q={set:p,root:n,showError:C,clearError:W};return document.addEventListener("input",f,!0),document.addEventListener("change",f,!0),document.addEventListener("focusin",g),document.addEventListener("focusout",v),addEventListener("scroll",O,{passive:!0}),addEventListener("resize",O),document.addEventListener("transitionend",O,!0),p(l.shown||l.dismissed?"mini":"tab"),!l.shown&&(l.uses||0)>=a&&m("return"),Q}var M=null,G=null,Me=qe,je=null,Ht=Promise.resolve();function Wt(){return import("../c-TJ6WOJL3.js").then(e=>e.mountOwnerChip()).catch(e=>(console.warn("visitor-drafts: the owner chip did not load",e),null))}function Qr(e){return e.template?import("../c-5LKDWQTL.js").then(t=>t.mountIntro(e)).catch(t=>(console.warn("visitor-drafts: the intro did not load",t),null)):Promise.resolve(null)}var fe=te(),$e=document.querySelector('script[data-rules-name~="api"]');if(Be&&fe&&$e){M=jt(),De(a=>M.write(a));let e=M.restore();G={restored:e.restored,hadDraft:e.hadDraft,parked:!!e.parked,...e.partial&&{partial:!0},...e.blocked&&{blocked:!0}},document.dispatchEvent(new CustomEvent("clay:drafts-restored",{detail:G}));let t=It(fe,Ce());je=Dt(t),Me=Pt(je);let r=document.querySelector('meta[name="application-name"]')?.content?.trim()||document.title.split(/:|\s\|\s/)[0].trim()||"This app",n=document.querySelector("template[visitor-intro]"),o=()=>{Ht=Bt({memory:t,appName:r,link:Me}).then(a=>Qr({memory:t,template:n,appName:r,hadDraft:e.hadDraft}).then(()=>a)).then(a=>(document.addEventListener("clay:drafts-store-failed",()=>a.showError()),document.addEventListener("clay:drafts-saved",()=>a.clearError()),(me?Wt():Promise.resolve(null)).then(()=>a)))};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",o,{once:!0}):o(),Pe(()=>M.flush()),window.addEventListener("storage",a=>{a.key===M.key&&M.adoptExternal()});let l=()=>M.flush();document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&l()}),window.addEventListener("pagehide",l)}else if(!fe||!$e){let e=[];fe||e.push('a visitor-drafts="<slot>" attribute on <html>'),$e||e.push('a <script data-rules-name~="api"> rules tag'),console.warn(`visitor-drafts: this page keeps no draft (missing ${e.join(" and ")})`)}else me&&He&&!Ie()&&(Ht=Wt());var Sn=M?{active:!0,slot:M.slot,key:M.key,hasDraft:()=>!!M.read(),restored:()=>G,saveNow:()=>M.writeLive(),reset(){return M.clear(),window.location.reload(),!0},onRestore(e){return G?(e(G),!0):(document.addEventListener("clay:drafts-restored",t=>e(t.detail),{once:!0}),!1)},editOriginal:_e,backToDraft:ze,downloadUrl:()=>Me,source:je}:Fe();export{Ht as ready,Sn as visitorDrafts};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as m}from"../c-MTQHWQC3.js";import{e as u,g as f}from"../c-OW5QIGG3.js";import{d as a}from"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import{d as l}from"../c-N7JPUPGC.js";import"../c-HA6INT6J.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";var o=l(),i=document.querySelector('script[data-rules-name~="api"]'),e=null,n=null,s=0,c=()=>f&&u&&!a()&&!!o&&!!i;function p(){if(e)return Promise.resolve(e);if(!n){let t=s;n=import("../c-TJ6WOJL3.js").then(({mountOwnerChip:d})=>{let r=d()||document.getElementById("clay-owner");return t===s?(e=r,r):(r?.liftOff?.(),r?.remove(),null)}).finally(()=>{n=null})}return n}function h(){s+=1,e?.liftOff?.(),e?.remove(),e=null,document.getElementById("clay-owner-vars")?.remove()}if(!o||!i){let t=[];o||t.push('a visitor-drafts="<slot>" attribute on <html>'),i||t.push('a <script data-rules-name~="api"> rules tag'),console.warn(`visitor-drafts: this page keeps no draft (missing ${t.join(" and ")})`)}var v=c()?p():Promise.resolve(null),O=v;function P(){return{id:"clay:drafts-owner",order:400,prepare(t={}){return{enable(){t.initial!==!0&&c()&&p()},quiesce(){},resume(){},dispose(){h()}}}}}var k=m();export{P as draftsOwnerParticipant,P as modeParticipant,O as ready,k as visitorDrafts};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c}from"../c-Y5HBBIQ4.js";import"../c-VRZN56XY.js";import"../c-OW5QIGG3.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import"../c-HA6INT6J.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";export{c as default,a as modeParticipant,b as wire,a as wireParticipant};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as S,c as q}from"./c-NUHP2XDB.js";import{g as U}from"./c-
|
|
1
|
+
import{b as S,c as q}from"./c-NUHP2XDB.js";import{g as U}from"./c-XCNTK76U.js";import{a as f}from"./c-VKEDWYDF.js";import{b as K}from"./c-ZWIOJGMT.js";import{e as I}from"./c-VRZN56XY.js";import"./c-IJUK2GPW.js";import{a as k,b as u,c as a,e as c,f as o,g as b,i as D,n as j}from"./c-OW5QIGG3.js";import{c as O,e as $}from"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-N7JPUPGC.js";import"./c-VG5XIN4T.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-DCFSEJZG.js";import"./c-WRBKEJD4.js";import{a as E}from"./c-VHNSBD2M.js";var R={};E(R,{activateInitialMode:()=>ce,canEdit:()=>a,default:()=>pe,init:()=>L,isEditMode:()=>c,isOwner:()=>b,mode:()=>o,modeLifecycle:()=>se,noteLiveSwitch:()=>de,setMode:()=>w,setPageTypeOnPageLoad:()=>V,toggleEditMode:()=>F});var M=!1,ie=e=>{if(typeof e?.id=="string"&&e.id.startsWith("clay:"))throw new TypeError(`clay.modeLifecycle: the id "${e.id}" is reserved`);return j(e)},se={register:ie,canWrite:()=>D().phase==="idle"&&c,get state(){return Object.freeze(D())}},T=null,_=()=>T||=import("./c-VE6ZMYMC.js").catch(()=>T=null),A=null,de=e=>{A=e};async function ce(){if(c)try{await(await _()).activateInitial()}catch(e){console.error("clayjs: the mode lifecycle failed to start:",e)}}var m=null;async function w(e){if(e!=="edit"&&e!=="view")throw new TypeError(`clay.setMode: unknown mode "${e}"`);if(m)return m.target===e?m.promise:{ok:!1,mode:o,code:"busy"};if(e===o&&!T)return{ok:!0,mode:o,changed:!1};if(u)return{ok:!1,mode:o,code:"not-allowed"};let t=le(e);m={target:e,promise:t};try{return await t}finally{m?.promise===t&&(m=null)}}async function le(e){let t=typeof window<"u"?window.clay?._requestHostMode:void 0;if(typeof t=="function"&&e!==o){let r;try{r=await t(e)}catch{return{ok:!1,mode:o,code:"host-failed"}}if(r?.reason!=="host-unsupported")return r?.ok?(M=!0,{ok:!0,mode:e,changed:!0,reloading:!0}):{ok:!1,mode:o,code:r?.reason||"host-refused"}}return e==="edit"&&o!=="edit"?ue():!a&&!(e==="view"&&o==="edit")?{ok:!1,mode:o,code:"not-allowed"}:H(e)}async function ue(){let e=location.pathname,{checkHostPermission:t}=await import("./core/host-permission-FNXVEFNE.js"),r=await t({fresh:!0});return location.pathname!==e?{ok:!1,mode:o,code:"cancelled"}:r===!1?{ok:!1,mode:o,code:"permission-denied"}:a?H("edit"):{ok:!1,mode:o,code:"not-allowed"}}async function H(e){if(A){let t=await _(),r=t&&await t.switchMode(e,A);if(r)return r}if(e===o)return{ok:!0,mode:o,changed:!1};if(o==="edit"){let t;try{t=await window.clay?.save?.flush?.()}catch(r){return{ok:!1,mode:o,code:"save-failed",state:r?.state}}if(t&&t.state&&t.state!=="saved"&&t.state!=="clean")return{ok:!1,mode:o,code:"save-failed",state:t.state}}return M=!0,k({mode:e,canEdit:a,internal:!0}),location.reload(),{ok:!0,mode:e,changed:!0,reloading:!0}}function fe(){let e=new URL(window.location.href);e.searchParams.set("editmode","true"),window.location.href=e.toString()}var F=()=>u?fe():w(o==="edit"?"view":"edit");function me(){!a||u||window.addEventListener("pagehide",()=>{M||k({mode:o,canEdit:a,internal:!1})})}function z(){a?document.documentElement.setAttribute("canedit","true"):document.documentElement.removeAttribute("canedit")}function V(){f(()=>{document.documentElement.setAttribute("editmode",c?"true":"false"),document.documentElement.setAttribute("pageowner",b?"true":"false"),z(),document.addEventListener("clay:capabilitychange",z),u?document.documentElement.setAttribute("draftmode","true"):document.documentElement.removeAttribute("draftmode")})}function L(){V(),me()}L();var pe={init:L,setMode:w,toggleEditMode:F,isEditMode:c,isOwner:b,canEdit:a,mode:o};var B={};var W=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),we=W?"\u2318\u21E7E":"Ctrl+Shift+E",he=`.clay-mode-note {
|
|
2
2
|
position: fixed;
|
|
3
3
|
right: calc(16px + env(safe-area-inset-right, 0px));
|
|
4
4
|
bottom: calc(16px + env(safe-area-inset-bottom, 0px));
|
|
@@ -65,4 +65,4 @@ import{b as S,c as q}from"./c-NUHP2XDB.js";import{g as U}from"./c-QIX5BJYN.js";i
|
|
|
65
65
|
right: calc(16px + env(safe-area-inset-right, 0px));
|
|
66
66
|
max-width: none;
|
|
67
67
|
}
|
|
68
|
-
}`;function ge(){if(document.getElementById("clay-mode-note-style"))return;let e=document.createElement("style");e.id="clay-mode-note-style",e.setAttribute("clay","editor-ui"),e.textContent=he,document.head.append(e)}function ye(e){(a||o==="edit")&&(!(W?e.metaKey:e.ctrlKey)||!e.shiftKey||e.altKey||e.code!=="KeyE"||e.isComposing||(e.preventDefault(),w(o==="edit"?"view":"edit").then(t=>{t.ok||import("./c-QHIWXHRO.js").then(({modeRefusalText:r})=>{let n=r(t);n&&window.clay?.toast?.(n,"error")})})))}function be(){ge();let e=document.createElement("div");e.setAttribute("clay","editor-ui"),e.setAttribute("role","status"),e.className="clay-mode-note",e.innerHTML=`<span>This page opens in view mode. Press <kbd>${we}</kbd> to edit.</span><button type="button" aria-label="Dismiss">\xD7</button>`;let t=()=>e.remove();e.querySelector("button").addEventListener("click",t),addEventListener("keydown",r=>{r.key==="Escape"&&t()},{once:!0}),setTimeout(t,12e3),document.body.append(e)}u||(document.addEventListener("keydown",ye),f(()=>{!a||o!=="view"||document.querySelector("[clay-mode-toggle]")||queueMicrotask(()=>{if(window.clay?.menu)return;let e=window.clay?.storage?.local;!e||e.get("mode-note")||(e.set("mode-note",!0),be())})}));var P={};E(P,{whenShown:()=>De});var ve="This page can't be edited: the app serving it is out of date. Update HTML Clay to 1.9.0 or newer.",i=null,l=null;function h(){if(!i)return;let e=window.visualViewport,t=e?Math.max(0,window.innerHeight-e.height-e.offsetTop):0;S(i,"bottom",`calc(${16+t}px + env(safe-area-inset-bottom,0px))`)}function xe(){i&&(S(i,"display","none"),window.visualViewport?.removeEventListener("resize",h),window.visualViewport?.removeEventListener("scroll",h))}function Ee(){i=l.bevelSurface("div",["position:fixed","left:50%","transform:translateX(-50%)","z-index:2147483001","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:${l.pageScheme()}`]),i.setAttribute("clay",l.RUNTIME_ONLY),i.setAttribute("data-clay-stale-host",""),i.setAttribute("role","alert");let e=q("span",["all:initial","color-scheme:inherit","display:inline-block","flex:none","width:8px","height:8px","border-radius:50%",`background:${l.TOKENS.ox}`]);e.setAttribute("clay",l.RUNTIME_ONLY);let t=l.bevelButton("Dismiss",{small:!0,variant:"quiet",onClick:xe});t.setAttribute("aria-label","Dismiss this message"),i.append(e,l.bevelText("span",[],ve),t),document.body.appendChild(i),h(),window.visualViewport?.addEventListener("resize",h),window.visualViewport?.addEventListener("scroll",h)}async function ke(){if(!$()||c)return;let[e,t]=await Promise.all([import("./c-6HMB24EV.js"),import("./c-ZE46QDIH.js")]);l={...e,TOKENS:t.TOKENS},Ee()}var G=Promise.resolve();f(()=>{G=ke()});var De=()=>G;var N={};E(N,{createPageDataApi:()=>X,readData:()=>Re,setPageDataLiveSync:()=>Ce,writeData:()=>Pe});var Se="data-read",Te="data-write";function v(e,t,r){let n=new Error(t);return n.code=e,n.details=r,n}async function Y(e){if(typeof e.json=="function")return e.json();let t=await e.text();return t?JSON.parse(t):null}async function Ae(e){let t={};try{t=await Y(e)||{}}catch{}let r=t.message||t.error||e.statusText||`Request failed (${e.status})`,n=new Error(r);return n.status=e.status,n.error=t.error,n.details=t.details,n}function Me(e){let t=e.headers?.get?.("ETag");return typeof t=="string"&&t?t:null}function Le(e,t){let r=`${t.origin}${t.pathname}`;return e!==void 0?`${r}?data=${encodeURIComponent(JSON.stringify(e))}`:`${t.origin}/_/api${t.pathname}`}async function J(){let{isDraftMode:e}=await import("./core/is-edit-mode-
|
|
68
|
+
}`;function ge(){if(document.getElementById("clay-mode-note-style"))return;let e=document.createElement("style");e.id="clay-mode-note-style",e.setAttribute("clay","editor-ui"),e.textContent=he,document.head.append(e)}function ye(e){(a||o==="edit")&&(!(W?e.metaKey:e.ctrlKey)||!e.shiftKey||e.altKey||e.code!=="KeyE"||e.isComposing||(e.preventDefault(),w(o==="edit"?"view":"edit").then(t=>{t.ok||import("./c-QHIWXHRO.js").then(({modeRefusalText:r})=>{let n=r(t);n&&window.clay?.toast?.(n,"error")})})))}function be(){ge();let e=document.createElement("div");e.setAttribute("clay","editor-ui"),e.setAttribute("role","status"),e.className="clay-mode-note",e.innerHTML=`<span>This page opens in view mode. Press <kbd>${we}</kbd> to edit.</span><button type="button" aria-label="Dismiss">\xD7</button>`;let t=()=>e.remove();e.querySelector("button").addEventListener("click",t),addEventListener("keydown",r=>{r.key==="Escape"&&t()},{once:!0}),setTimeout(t,12e3),document.body.append(e)}u||(document.addEventListener("keydown",ye),f(()=>{!a||o!=="view"||document.querySelector("[clay-mode-toggle]")||queueMicrotask(()=>{if(window.clay?.menu)return;let e=window.clay?.storage?.local;!e||e.get("mode-note")||(e.set("mode-note",!0),be())})}));var P={};E(P,{whenShown:()=>De});var ve="This page can't be edited: the app serving it is out of date. Update HTML Clay to 1.9.0 or newer.",i=null,l=null;function h(){if(!i)return;let e=window.visualViewport,t=e?Math.max(0,window.innerHeight-e.height-e.offsetTop):0;S(i,"bottom",`calc(${16+t}px + env(safe-area-inset-bottom,0px))`)}function xe(){i&&(S(i,"display","none"),window.visualViewport?.removeEventListener("resize",h),window.visualViewport?.removeEventListener("scroll",h))}function Ee(){i=l.bevelSurface("div",["position:fixed","left:50%","transform:translateX(-50%)","z-index:2147483001","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:${l.pageScheme()}`]),i.setAttribute("clay",l.RUNTIME_ONLY),i.setAttribute("data-clay-stale-host",""),i.setAttribute("role","alert");let e=q("span",["all:initial","color-scheme:inherit","display:inline-block","flex:none","width:8px","height:8px","border-radius:50%",`background:${l.TOKENS.ox}`]);e.setAttribute("clay",l.RUNTIME_ONLY);let t=l.bevelButton("Dismiss",{small:!0,variant:"quiet",onClick:xe});t.setAttribute("aria-label","Dismiss this message"),i.append(e,l.bevelText("span",[],ve),t),document.body.appendChild(i),h(),window.visualViewport?.addEventListener("resize",h),window.visualViewport?.addEventListener("scroll",h)}async function ke(){if(!$()||c)return;let[e,t]=await Promise.all([import("./c-6HMB24EV.js"),import("./c-ZE46QDIH.js")]);l={...e,TOKENS:t.TOKENS},Ee()}var G=Promise.resolve();f(()=>{G=ke()});var De=()=>G;var N={};E(N,{createPageDataApi:()=>X,readData:()=>Re,setPageDataLiveSync:()=>Ce,writeData:()=>Pe});var Se="data-read",Te="data-write";function v(e,t,r){let n=new Error(t);return n.code=e,n.details=r,n}async function Y(e){if(typeof e.json=="function")return e.json();let t=await e.text();return t?JSON.parse(t):null}async function Ae(e){let t={};try{t=await Y(e)||{}}catch{}let r=t.message||t.error||e.statusText||`Request failed (${e.status})`,n=new Error(r);return n.status=e.status,n.error=t.error,n.details=t.details,n}function Me(e){let t=e.headers?.get?.("ETag");return typeof t=="string"&&t?t:null}function Le(e,t){let r=`${t.origin}${t.pathname}`;return e!==void 0?`${r}?data=${encodeURIComponent(JSON.stringify(e))}`:`${t.origin}/_/api${t.pathname}`}async function J(){let{isDraftMode:e}=await import("./core/is-edit-mode-KTWA3O5N.js");return e?v("DataUnavailableInDraft","Page data is kept in this browser for this visitor."):null}function X({supports:e=I,token:t=O,fetchImpl:r=(...g)=>fetch(...g),getLocation:n=()=>window.location,eventTarget:Q=document,loadWriteModules:Z,syncTimeoutMs:ee,httpTimeoutMs:te}={}){let g=null,p=null;function oe(s){g=s}async function re(s){let y=await J();if(y)throw y;if(!await e(Se))throw v("DataReadUnsupported","This host does not support reading page data.");let d;try{d=await r(Le(s,n()),{method:"GET",credentials:"same-origin",cache:"no-store",redirect:"error"})}catch(x){throw Object.assign(v("DataReadFailed",x?.message||"Could not read page data."),{cause:x})}if(!d.ok)throw await Ae(d);return{data:await Y(d),etag:Me(d)}}function ne(){return p||(p=import("./c-UDUUJPFZ.js").then(({createPageDataWrite:s})=>s({supports:e,token:t,fetchImpl:r,getLocation:n,eventTarget:Q,getLiveSync:()=>g,loadWriteModules:Z,syncTimeoutMs:ee,httpTimeoutMs:te})).catch(s=>{throw p=null,s}),p)}async function ae(s,y){let d=await J();if(d)throw d;if(!await e(Te))throw v("DataWriteUnsupported","This host does not support writing page data.");return(await ne()).writeData(s,y)}return{readData:re,writeData:ae,setLiveSync:oe}}var C=X(),Re=C.readData,Pe=C.writeData,Ce=C.setLiveSync;var Ve={"lib/mutation.js":K,"core/preserve-authored.js":U,"core/edit-mode.js":R,"core/mode-key.js":B,"core/stale-host-notice.js":P,"core/page-data.js":N};export{Ve as core};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b as c,c as d,d as e,e as f,f as g,g as h}from"../c-G2JPKCTP.js";import{e as b}from"../c-7OLLJPWP.js";import"../c-LZJPNR2W.js";import"../c-FILLTJA7.js";import"../c-5VYOWDTI.js";import"../c-QJ4OM3G6.js";import"../c-WYFDLITL.js";import"../c-ZWIOJGMT.js";import"../c-TQEMVJCS.js";import"../c-DCXOXBF3.js";import"../c-VRZN56XY.js";import"../c-IJUK2GPW.js";import"../c-OW5QIGG3.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import"../c-SPIORRYS.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-DCFSEJZG.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";export{e as LiveSync,d as REMOTE_WINS_SELECTOR,c as SYNC_IGNORE_SELECTOR,b as WIRE_PROFILES,a as conflicts,h as default,f as liveSync,g as morph};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r,b as l,c as m,d as c}from"../c-
|
|
1
|
+
import{a as r,b as l,c as m,d as c}from"../c-AMSNPOCX.js";import{b as d}from"../c-KIPQJX4B.js";import"../c-QHWJ5ZIJ.js";import{a as s,b as n,c as o}from"../c-ZUCOKOHT.js";import"../c-UL2YUY52.js";import"../c-LFPHCXY3.js";import{a}from"../c-2AZDZWCK.js";import"../c-OIBUTDXI.js";import"../c-4JZDZFF6.js";import"../c-VAK7SG37.js";import{f as i}from"../c-46XYM55L.js";import"../c-NUHP2XDB.js";import"../c-VKEDWYDF.js";import"../c-VHNSBD2M.js";i();var t=window.clay=window.clay||{};t.toast=o;t.toastPersistent=s;t.ask=r;t.confirm=l;t.tell=m;t.snippet=c;t.modal=d;typeof window.toast>"u"&&(window.toast=o);typeof window.toastPersistent>"u"&&(window.toastPersistent=s);a.toasts=!0;a.savedToast=!!t.saveToast;Object.defineProperty(t,"saveToast",{get:()=>a.savedToast,set:e=>{a.savedToast=!!e},enumerable:!0,configurable:!0});document.addEventListener("clay:save-saved",e=>{n("Couldn't save"),n("Offline, not saved"),e.detail?.msgType==="warning"?o(e.detail.msg||"Saved","warning"):(!a.chip||a.savedToast)&&o(e.detail?.msg||"Saved","success")});document.addEventListener("clay:save-error",()=>s("Couldn't save","error"));document.addEventListener("clay:save-offline",()=>s("Offline, not saved","warning"));document.addEventListener("clay:live-notice",e=>{e.detail?.code==="save-uncertain"&&s(e.detail.message,"warning"),e.detail?.code==="op-too-large"&&o(e.detail.message,"warning")});export{r as ask,l as consent,c as snippet,m as tell,d as themodal,o as toast,s as toastPersistent};
|