@panphora/clayjs 1.25.0 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all.js +1 -1
- package/dist/clay-dom.js +1 -1
- package/dist/clay-events.js +1 -1
- package/dist/clay-internals.js +1 -1
- package/dist/clay-options.js +1 -1
- package/dist/clay-router.js +1 -1
- package/dist/clay-ui.js +1 -1
- package/dist/clay-utils.js +1 -1
- package/dist/clay.js +1 -1
- package/dist/clay.standalone.js +5570 -4173
- package/dist/m/attrs/{save-freeze-MH3AOD56.js → save-freeze-PUYX32AK.js} +1 -1
- package/dist/m/{c-BOMQIQ3V.js → c-2EFMJYGJ.js} +1 -1
- package/dist/m/c-2EPHRF47.js +1 -0
- package/dist/m/{c-JD2VFAYG.js → c-2SUFMUZX.js} +2 -2
- package/dist/m/{c-CITLTVQ4.js → c-2TJCFPX4.js} +1 -1
- package/dist/m/c-33SS5A4Y.js +1 -0
- package/dist/m/{c-V2FPBRO6.js → c-34J5HC7N.js} +1 -1
- package/dist/m/c-3F3AADKG.js +1 -0
- package/dist/m/{c-TCFVG3I4.js → c-3S3647J6.js} +1 -1
- package/dist/m/{c-GY4BREDT.js → c-3S5TNRZA.js} +1 -1
- package/dist/m/{c-GDNZEOOZ.js → c-3WX5FABT.js} +1 -1
- package/dist/m/{c-AI3H6ETU.js → c-3XGLJAS7.js} +2 -2
- package/dist/m/c-42WBOKFM.js +1 -0
- package/dist/m/c-47M4QHCK.js +1 -0
- package/dist/m/{c-UOUUI265.js → c-4M2T676V.js} +1 -1
- package/dist/m/{c-GEAG5XAK.js → c-4TP3UXBT.js} +1 -1
- package/dist/m/{c-IESDKFO6.js → c-5ELELG2F.js} +1 -1
- package/dist/m/{c-X3V4RWMA.js → c-5ZYLTN3Q.js} +1 -1
- package/dist/m/{c-5PZYDWTW.js → c-67TBU56I.js} +1 -1
- package/dist/m/{c-WNOLMHI2.js → c-6BGJAJ67.js} +1 -1
- package/dist/m/{c-4Q6QIODW.js → c-755ZOHOM.js} +1 -1
- package/dist/m/c-7Q4XYDF4.js +1 -0
- package/dist/m/c-7RHOMAMR.js +1 -0
- package/dist/m/c-A5LASUEZ.js +1 -0
- package/dist/m/{c-IL5IVTOG.js → c-ABOBD7F3.js} +1 -1
- package/dist/m/c-AQVQKFKB.js +1 -0
- package/dist/m/{c-QDVG4NAZ.js → c-ARO6CPMA.js} +1 -1
- package/dist/m/{c-ORLPQFNU.js → c-AZM34SPO.js} +1 -1
- package/dist/m/{c-XUZMRQ7O.js → c-BCS3AZQZ.js} +1 -1
- package/dist/m/c-BOS7GONO.js +1 -0
- package/dist/m/{c-SUAC5RSG.js → c-C5UGNOC2.js} +1 -1
- package/dist/m/c-C6DXZIXD.js +1 -0
- package/dist/m/{c-WSTUCBHV.js → c-CPRGR2II.js} +1 -1
- package/dist/m/{c-NICICT4P.js → c-DEYHCYJB.js} +1 -1
- package/dist/m/{c-WGQVSKKC.js → c-DYTBSJBI.js} +1 -1
- package/dist/m/{c-DT7E76Z2.js → c-DZT6W2NG.js} +1 -1
- package/dist/m/{c-O2QZDVZ2.js → c-EEWPNUM2.js} +1 -1
- package/dist/m/{c-MFB74XVN.js → c-EHAR4RJJ.js} +2 -2
- package/dist/m/c-EHJWIGWN.js +1 -0
- package/dist/m/c-EIDZHQHZ.js +1 -0
- package/dist/m/{c-V2V5FKXX.js → c-EIUKME3W.js} +1 -1
- package/dist/m/c-ELXMSEN5.js +1 -0
- package/dist/m/c-EXZOA6XY.js +7 -0
- package/dist/m/{c-FKTALXNV.js → c-EYFMAR3M.js} +1 -1
- package/dist/m/c-FC5RUFPR.js +1 -0
- package/dist/m/{c-FBOO2UY3.js → c-FUN6AKFE.js} +1 -1
- package/dist/m/{c-V4B3RUWB.js → c-GFASNR55.js} +1 -1
- package/dist/m/{c-XMIDHEKF.js → c-GY36NO7C.js} +1 -1
- package/dist/m/{c-UD4VDBGJ.js → c-H3M6UDNV.js} +1 -1
- package/dist/m/{c-SFZRY6RT.js → c-H47C6PJZ.js} +1 -1
- package/dist/m/{c-MUM53J5J.js → c-H4M2T4A6.js} +1 -1
- package/dist/m/{c-U7F66I64.js → c-HYNM5U6B.js} +1 -1
- package/dist/m/c-J2YYLEVM.js +1 -0
- package/dist/m/c-J2ZW4HMR.js +1 -0
- package/dist/m/{c-WCG6AKA7.js → c-JC4RZW4E.js} +1 -1
- package/dist/m/c-K2ZHQMPF.js +1 -0
- package/dist/m/c-KD2ME5UN.js +2 -0
- package/dist/m/{c-Z2OZFX3N.js → c-L6KVXPBO.js} +1 -1
- package/dist/m/{c-GO635CRU.js → c-LAKBBJOU.js} +2 -2
- package/dist/m/{c-4AE2A2LK.js → c-LETPPG2F.js} +1 -1
- package/dist/m/{c-SFYTKRU7.js → c-MKAUC6DB.js} +1 -1
- package/dist/m/{c-WDFQ7PBU.js → c-MMEVDN6D.js} +1 -1
- package/dist/m/{c-LS7IVQVW.js → c-MMV5JULA.js} +1 -1
- package/dist/m/{c-NEQRFC4O.js → c-MVVEIJUU.js} +1 -1
- package/dist/m/{c-SXZYVXD6.js → c-N362HNGO.js} +1 -1
- package/dist/m/{c-7K4SCQB7.js → c-ND3W7D5U.js} +1 -1
- package/dist/m/{c-3E2IK5HU.js → c-NNHNXD6M.js} +1 -1
- package/dist/m/{c-D62HRSZK.js → c-NYJ577NL.js} +1 -1
- package/dist/m/{c-YFO6ZJLQ.js → c-O3DPFZCE.js} +1 -1
- package/dist/m/c-OZOACVUD.js +1 -0
- package/dist/m/{c-MV7TEUTD.js → c-OZVK3TFI.js} +1 -1
- package/dist/m/{c-ZEA3DCG3.js → c-PWILUN4T.js} +1 -1
- package/dist/m/{c-BCWYEG6P.js → c-QA3Q3MDI.js} +1 -1
- package/dist/m/{c-XHZIKRCV.js → c-QKOKMQXA.js} +1 -1
- package/dist/m/{c-TGIMBAWE.js → c-RBWVF4N5.js} +1 -1
- package/dist/m/c-RES2S5Q3.js +1 -0
- package/dist/m/c-RFGELYEU.js +2 -0
- package/dist/m/c-RGFPLQGV.js +1 -0
- package/dist/m/{c-RGAALCDU.js → c-SPOEDIMP.js} +1 -1
- package/dist/m/{c-YX2MC7YL.js → c-SRW5OBCF.js} +1 -1
- package/dist/m/{c-C6YZNU6E.js → c-SYOA4T7V.js} +1 -1
- package/dist/m/c-SYVF6ZMF.js +1 -0
- package/dist/m/{c-NADLYVAH.js → c-TJ5PFOJ2.js} +1 -1
- package/dist/m/{c-KYTVZT4D.js → c-TKV273YU.js} +1 -1
- package/dist/m/c-U35T5NAY.js +1 -0
- package/dist/m/{c-PRZNJUYZ.js → c-UEKJWXCB.js} +2 -2
- package/dist/m/c-UW6MMZ4V.js +1 -0
- package/dist/m/{c-XQTERKQA.js → c-V4DBV5ZV.js} +1 -1
- package/dist/m/c-VGG3UR7I.js +1 -0
- package/dist/m/c-VU4WEWPH.js +4 -0
- package/dist/m/{c-5Q5XBN56.js → c-W7LWCJHD.js} +1 -1
- package/dist/m/c-WHMZCRQD.js +6 -0
- package/dist/m/{c-WMRJKQ2V.js → c-WHQUZM2V.js} +1 -1
- package/dist/m/c-WOJ2RTV4.js +1 -0
- package/dist/m/{c-ZJG6C2WL.js → c-WOWGGNCJ.js} +1 -1
- package/dist/m/{c-ZORVIXUR.js → c-XHD7XJTE.js} +1 -1
- package/dist/m/c-XONFK3WC.js +1 -0
- package/dist/m/{c-HGG7M2S3.js → c-Y3J5LDKB.js} +1 -1
- package/dist/m/{c-JB5YU57S.js → c-Y3MPVURA.js} +1 -1
- package/dist/m/c-Y6HH7LTM.js +1 -0
- package/dist/m/{c-52OC3OH3.js → c-YRDKVEGR.js} +1 -1
- package/dist/m/c-YYIN4NAF.js +30 -0
- package/dist/m/{c-WVCT3ITX.js → c-YZGWSCMT.js} +1 -1
- package/dist/m/c-ZFAPQQIB.js +1 -0
- package/dist/m/core/{admin-attrs-ZI6K6UGM.js → admin-attrs-43JBA6JB.js} +1 -1
- package/dist/m/core/{autosave-BSM2ABJL.js → autosave-HD7Y7UNV.js} +1 -1
- package/dist/m/core/{conflict-notice-7EQLDYPA.js → conflict-notice-UNDOD4BL.js} +1 -1
- package/dist/m/core/{persist-2SZO3PCE.js → persist-MX3VYVBN.js} +1 -1
- package/dist/m/core/{save-K6Q47J2X.js → save-JZ7R4ET2.js} +1 -1
- package/dist/m/core/{save-core-U3Z44XBO.js → save-core-I4N6S4ED.js} +1 -1
- package/dist/m/core/site-edits-C22O53GS.js +1 -0
- package/dist/m/core/{snapshot-PWCHYFL6.js → snapshot-N5MKDGNI.js} +1 -1
- package/dist/m/core/{unsaved-warning-2WRZLJH5.js → unsaved-warning-BP6ZY3PG.js} +1 -1
- package/dist/m/internals/{index-FSLC4M7J.js → index-3LAVREAU.js} +1 -1
- package/dist/m/loader-DCKCZKY6.js +1 -0
- package/dist/m/manifest-7954CBE3.js +1 -0
- package/dist/m/manifest-edit-93AA79D7.js +1 -0
- package/dist/m/manifest.json +1240 -1179
- package/dist/m/page/{editor-PKSPJ2XJ.js → editor-UF3CIA6V.js} +5 -5
- package/dist/m/plugins/{ai-edit-3LG6MGS3.js → ai-edit-WDV2GLDU.js} +2 -2
- package/dist/m/plugins/{cms-T2HLI7JG.js → cms-KG6TCTR3.js} +9 -9
- package/dist/m/plugins/{derive-7DR5TUDH.js → derive-R4USHZ7P.js} +1 -1
- package/dist/m/plugins/{indicator-CTKX4EY7.js → indicator-OLPZ4WFI.js} +1 -1
- package/dist/m/plugins/{live-IFLL6YN5.js → live-DF5YS5AH.js} +1 -1
- package/dist/m/plugins/{menu-YJZ3JWBC.js → menu-ESEFQARM.js} +1 -1
- package/dist/m/plugins/page-GZSU77JS.js +2 -0
- package/dist/m/plugins/{page-view-NMCCU6MF.js → page-view-7MM3FEAR.js} +1 -1
- package/dist/m/plugins/{people-6WIWCZEG.js → people-EBWE337I.js} +1 -1
- package/dist/m/plugins/quickcrop-UHURKA2F.js +26 -0
- package/dist/m/plugins/richclay-MXH2GFAZ.js +549 -0
- package/dist/m/plugins/sortable-BAG3MSWS.js +1 -0
- package/dist/m/plugins/{source-7LSGOV46.js → source-OYHDXKTB.js} +1 -1
- package/dist/m/plugins/undo-KLHAGV75.js +1 -0
- package/dist/m/plugins/{upgrade-MMPZUCDM.js → upgrade-SZQJYEQQ.js} +1 -1
- package/dist/m/plugins/{visitor-drafts-V5YB7XDH.js → visitor-drafts-ZE6PCAFP.js} +2 -2
- package/dist/m/plugins/{visitor-menu-QDV2MYJN.js → visitor-menu-5XY57JQA.js} +1 -1
- package/dist/m/plugins/{wire-3YGUO3GE.js → wire-S5ATC4QI.js} +1 -1
- package/dist/m/reader-core-AHOAP5DH.js +77 -0
- package/dist/m/sync/{live-sync-XMXXZS3G.js → live-sync-RZQSDMZW.js} +1 -1
- package/dist/m/ui/index-G7ZJXNMG.js +1 -0
- package/dist/m/vendor/{sap-core.vendor-JANUQULT.js → sap-core.vendor-5TWOJYVM.js} +4 -4
- package/dist/offline-manifest.json +780 -750
- package/dist/server/core.cjs +4245 -2614
- package/dist/server/markdown.cjs +1 -0
- package/dist/server/markdown.mjs +7 -0
- package/docs/guide.md +26 -37
- package/entries/clay-data.js +1 -1
- package/entries/sap.js +5 -5
- package/package.json +6 -2
- package/packed-contract.json +3 -0
- package/src/attrs/save-freeze.js +1 -1
- package/src/core/admin-contenteditable.js +1 -1
- package/src/core/admin-inputs.js +1 -1
- package/src/core/admin-onclick.js +1 -1
- package/src/core/admin-resources.js +5 -2
- package/src/core/conflict-notice-ui.js +59 -34
- package/src/core/save.js +9 -9
- package/src/core/site-edits.js +1 -1
- package/src/core/snapshot.js +56 -43
- package/src/core/stale-host-notice.js +20 -7
- package/src/loader-logic.js +0 -13
- package/src/page/boot-pack.js +1 -0
- package/src/page/editor.js +10 -4
- package/src/page/history-intent.js +111 -4
- package/src/page/import-markdown.js +22 -8
- package/src/page/save-projection.js +1 -1
- package/src/page/ybind/bridge.js +14 -7
- package/src/page/ybind/moves.js +437 -3
- package/src/page/ybind/origins.js +1 -1
- package/src/page/ybind/recovery.js +1 -1
- package/src/plugins/page.js +48 -4
- package/src/plugins/quickcrop.js +128 -69
- package/src/plugins/richclay.js +136 -0
- package/src/plugins/sortable.js +25 -9
- package/src/plugins/undo.js +169 -7
- package/src/recovery/undo.js +14 -7
- package/src/server/markdown/index.js +23 -0
- package/src/sync/conflicts.js +3 -1
- package/src/sync/data-guard-notice.js +137 -18
- package/src/sync/live-sync.js +24 -0
- package/src/ui/bevel-controls.js +4 -1
- package/src/ui/dialogs.js +11 -7
- package/src/ui/modal.js +9 -7
- package/src/ui/toast.js +67 -32
- package/src/ui/vendor-skin.js +9 -4
- package/src/vendor/hyper-html-api-data.vendor.js +1 -1
- package/src/vendor/hyper-html-api-upgrade.vendor.js +2 -2
- package/src/vendor/hyper-undo.vendor.js +1 -1
- package/src/vendor/hypercms.vendor.js +7 -7
- package/src/vendor/richclay.vendor.js +16 -16
- package/src/vendor/sap-core.vendor.js +4 -4
- package/tool-generation/context.md +69 -0
- package/tool-generation/system.md +1 -1
- package/dist/m/c-277QP5ET.js +0 -1
- package/dist/m/c-5SZ6KFR5.js +0 -1
- package/dist/m/c-CU33V6RW.js +0 -4
- package/dist/m/c-CVSWLX3X.js +0 -1
- package/dist/m/c-DXPOFLEJ.js +0 -1
- package/dist/m/c-EODTTNVA.js +0 -1
- package/dist/m/c-ESK4S67I.js +0 -1
- package/dist/m/c-FDWR3FL7.js +0 -1
- package/dist/m/c-FJDTDGDA.js +0 -1
- package/dist/m/c-FYDKYW6E.js +0 -1
- package/dist/m/c-HKSLOVU4.js +0 -1
- package/dist/m/c-IJHF4IO6.js +0 -1
- package/dist/m/c-IUL7PU4P.js +0 -1
- package/dist/m/c-JWW6BHWD.js +0 -6
- package/dist/m/c-K4M76VPM.js +0 -7
- package/dist/m/c-M7ITYKMF.js +0 -1
- package/dist/m/c-MR75YPRT.js +0 -1
- package/dist/m/c-NFQFV7OP.js +0 -2
- package/dist/m/c-NHXOBD6A.js +0 -1
- package/dist/m/c-NVU3DORS.js +0 -1
- package/dist/m/c-PNZIJFG7.js +0 -1
- package/dist/m/c-QWB53KRW.js +0 -1
- package/dist/m/c-RHPHMTF2.js +0 -2
- package/dist/m/c-RWJ3OSCP.js +0 -1
- package/dist/m/c-SEVOS4UE.js +0 -1
- package/dist/m/c-SGG6MUXW.js +0 -1
- package/dist/m/c-SXNSSHPP.js +0 -1
- package/dist/m/c-TFLRT5JX.js +0 -1
- package/dist/m/c-TLQINES7.js +0 -30
- package/dist/m/c-U65PREMC.js +0 -1
- package/dist/m/c-V5L6HWVL.js +0 -1
- package/dist/m/c-VMXCX52Q.js +0 -1
- package/dist/m/c-YYGUHSZR.js +0 -1
- package/dist/m/core/site-edits-CFMF6GHD.js +0 -1
- package/dist/m/loader-RC54UV7H.js +0 -1
- package/dist/m/manifest-3B84C829.js +0 -1
- package/dist/m/manifest-edit-1CB79AD4.js +0 -1
- package/dist/m/plugins/page-GTDPYGE4.js +0 -2
- package/dist/m/plugins/quickcrop-X5MRIBAP.js +0 -26
- package/dist/m/plugins/richclay-L3BZMX4I.js +0 -549
- package/dist/m/plugins/sortable-365SRRL3.js +0 -1
- package/dist/m/plugins/undo-UES4KS7B.js +0 -1
- package/dist/m/reader-core-VR7EL4WV.js +0 -77
- package/dist/m/ui/index-MGTWOW2C.js +0 -1
- /package/dist/m/{c-QTTJYJMA.js → c-FILLTJA7.js} +0 -0
- /package/dist/m/plugins/{quickcrop-X5MRIBAP.js.LEGAL.txt → quickcrop-UHURKA2F.js.LEGAL.txt} +0 -0
- /package/dist/m/plugins/{richclay-L3BZMX4I.js.LEGAL.txt → richclay-MXH2GFAZ.js.LEGAL.txt} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as x,d as I,e as g,f as P,g as M}from"../c-7DJDKPGL.js";import{a as $}from"../c-MZCOGNZL.js";import"../c-IJUK2GPW.js";import{f as R,k as F}from"../c-C7SUMNMI.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-U4TWEIKZ.js";import{k as N}from"../c-UW6MMZ4V.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-MOP5KBWZ.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-ICMAOOGK.js";import{e as k}from"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";var T=k("history"),W="[cms-template]",L=["draggable","style"],X=["pointerup","pointercancel","dragend","drop"],y=new Set,h=null,E=null,m=null;function q(e,t,n,r,i){let o={target:t,type:n,handler:r,options:i};return t.addEventListener(n,r,i),e.listeners.push(o),o}function H(e,t){t.target.removeEventListener(t.type,t.handler,t.options);let n=e.listeners.indexOf(t);n!==-1&&e.listeners.splice(n,1)}function U(e,t){let n=setTimeout(()=>{e.timers.delete(n),t()},0);return e.timers.add(n),n}function Y(e,t){return{Sortable:e,root:t,admitted:!1,instances:new Set,listeners:[],timers:new Set,presses:new Set,stop:null}}var Z={admitted:!0,instances:new Set,listeners:[],timers:new Set,presses:new Set};function C(e){return[e,...e.querySelectorAll("*")].filter(t=>!t.closest(T)).map(t=>[t,L.map(n=>t.getAttribute(n))])}function _(e){for(let[t,n]of e)L.forEach((r,i)=>{let o=n[i],u=t.getAttribute(r);if(u!==o)if(o===null){if(r==="style"&&u)return;t.removeAttribute(r)}else t.setAttribute(r,o)})}function B(e){return/^(UL|OL)$/.test(e.tagName)?"li":"*"}function ee(e){return`> ${B(e)}:not(${T})`}function V(e,t){return!e||!t||t.nodeType!==1||!t.matches(B(e))?!1:!t.closest(T)&&!t.closest(W)}function D(e,t){return!e||!t||t.parentElement!==e?!1:V(e,t)}function te(e,t){let n=t.nextElementSibling;for(;n&&!D(e,n);)n=n.nextElementSibling;return n}function j(e,t){return Array.prototype.indexOf.call(e.children,t)}function G(e,t){if(t)try{new Function(`return (async function(evt) { ${t} })`)().call(e.from,e)}catch(n){console.error("Error in onsorted execution:",n)}e.from.dispatchEvent(new CustomEvent("clay:sorted",{bubbles:!0,detail:{item:e.item,from:e.from,to:e.to,oldIndex:e.oldIndex,newIndex:e.newIndex}})),e.from.dispatchEvent(new Event("input",{bubbles:!0}))}function z(e,t,n=Z){let r={};if(r.draggable=ee(e),r.setData=s=>{s.clearData(),s.setData("application/x-clay-sortable","")},t.get(e))return;let i=e.getAttribute("sortable");i&&(r.group=i);let o=e.querySelectorAll("[sortable-handle]"),u=e.querySelectorAll("[sortable]");Array.from(o).some(s=>!Array.from(u).some(l=>l.contains(s)))&&(r.handle="[sortable-handle]");let c=e.getAttribute("onsorting");if(c){let s=null;try{s=/\bawait\b/.test(c)?new Function(`return (async function(evt) { ${c} })`)():new Function("evt",c)}catch(l){console.error("Error in onsorting compilation:",l)}s&&(r.onMove=function(l){if(n.admitted)try{let a=s.call(e,l);return a instanceof Promise?void 0:a}catch(a){console.error("Error in onsorting execution:",a)}})}let d=e.getAttribute("onsorted");r.onEnd=function(s){if(!n.admitted)return;let l={item:s.item,from:s.from,to:s.to,oldIndex:s.oldIndex,newIndex:s.newIndex},a=f;f=null,b&&(_(b),b=null),a&&(M(a,l),g(a)),G(l,d)};let p=null,f=null,b=null,S=!1,A=!1,v=[],K=()=>{let s=f;f=null,b=null,g(s)},O=()=>{let s=p;p=null,s&&(n.presses.delete(s),y.delete(s),b=s),v.forEach(l=>H(n,l)),v=[],s&&U(n,()=>_(s))},Q=s=>{A&&s?.type==="pointercancel"||(A=!1,S?I(f):(g(f),f=null),S=!1,O(),U(n,K))};q(n,e,"pointerdown",s=>{let l=s.target instanceof Element?s.target:null;for(;l&&l.parentElement!==e;)l=l.parentElement;!l||p||(p=C(l),f=x(l),S=!1,A=!1,n.presses.add(p),y.add(p),v=X.map(a=>q(n,document,a,Q,!0)),v.push(q(n,document,"dragstart",()=>{A=!0},!0)))},!0),r.onUnchoose=O,r.onStart=()=>{S=!0},t.create(e,r),n.instances.add(e)}function ne(e,t,n=null){let r=d=>({ok:!1,code:d});if(!R||m&&!m.admitted)return r("not-editable");let i=document;if(!e||e.nodeType!==1||!e.isConnected||e.ownerDocument!==i)return r("detached");let o=e.parentElement;if(!o||!o.isConnected||!t||t.nodeType!==1||!t.isConnected||t.ownerDocument!==i)return r("detached");if(!o.hasAttribute("sortable")||!D(o,e)||!t.hasAttribute("sortable")||!V(t,e)||e===t||e.contains(t))return r("item");if(o!==t){let d=o.getAttribute("sortable");if(!d||d!==t.getAttribute("sortable"))return r("group")}if(n===e)return{ok:!0,moved:!1};if(n!==null&&!D(t,n))return r("anchor");if(o===t&&te(o,e)===n)return{ok:!0,moved:!1};let u=j(o,e),w=x(e);I(w);let c;try{t.insertBefore(e,n),c={item:e,from:o,to:t,oldIndex:u,newIndex:j(t,e)},M(w,c)}finally{g(w)}return G(c,o.getAttribute("onsorted")),{ok:!0,moved:!0,...c}}function re(){return h||(h=import("../vendor/Sortable.vendor-A755ITLN.js").then(e=>window.Sortable||e.default),h.catch(()=>{h=null})),h}function se(){return E||(N((e,{original:t})=>{for(let r of e.querySelectorAll("[sortable] .sortable-chosen, [sortable] .sortable-ghost, [sortable] .sortable-drag"))r.classList.remove("sortable-chosen","sortable-ghost","sortable-drag"),r.classList.length||r.removeAttribute("class");if(!y.size)return;let n=new Map;for(let r of y)for(let[i,o]of r)n.set(i,o);for(let r of e.querySelectorAll("[sortable] *")){let i=n.get(t(r));i&&L.forEach((o,u)=>{i[u]===null?r.removeAttribute(o):r.setAttribute(o,i[u])})}}),E=!0,E)}function oe(e){return{enable(){if(!e.admitted){e.admitted=!0;for(let t of e.root.querySelectorAll("[sortable]"))z(t,e.Sortable,e);e.stop=$.onAddElement({selectorFilter:"[sortable]",debounce:200,require:"observed",pausable:!1},t=>{e.admitted&&t.forEach(({element:n})=>{z(n,e.Sortable,e)})})}},quiesce(){e.admitted=!1},resume(){e.admitted=!0},dispose(){e.admitted=!1,e.stop&&(e.stop(),e.stop=null);for(let t of[...e.listeners])H(e,t);for(let t of e.timers)clearTimeout(t);e.timers.clear();for(let t of e.presses)y.delete(t);e.presses.clear(),P();for(let t of e.instances)e.Sortable?.get?.(t)?.destroy?.();e.instances.clear(),m===e&&(m=null)}}}var le=e=>e?e.signal?.aborted?!0:typeof e.isCurrent=="function"&&!e.isCurrent():!1;function ie(e=document){return{id:"clay:sortable",order:300,async prepare(t={}){if(t.initial===!0)return ae();let n=await re();if(le(t))throw Object.assign(new Error("clay:sortable prepared for a stale generation"),{code:"stale-document"});return se(),oe(m||(m=Y(n,e)))}}}async function ae(){let e=await ue;return{enable(){},quiesce:()=>e?.quiesce(),resume:()=>e?.resume(),dispose:()=>e?.dispose()}}async function J(){if(!F())return null;let e=await ie().prepare();return e.enable(),e}var ue=J(),be=Object.freeze({move:ne});var ge=J;export{ge as default,J as init,z as makeSortable,ie as modeParticipant,ne as move,ue as ready,be as sortable,ie as sortableParticipant};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../c-
|
|
1
|
+
import"../c-EHAR4RJJ.js";import{a as d}from"../c-LD6UVV5R.js";import"../c-PGSBXHUE.js";import"../c-KU3PX7LL.js";import"../c-EQ5NBOGA.js";import"../c-IJUK2GPW.js";import{k as p}from"../c-C7SUMNMI.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-U4TWEIKZ.js";import"../c-UW6MMZ4V.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-MOP5KBWZ.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";var g={installed:!1,refused:null,sourceBytes:null,paired:0,unresolved:0,unmatchedLive:0,unmatchedSource:0,attrDiffs:0,saves:0,reprints:0,lastReprint:null,partialReprints:0,lastPartialReprint:null,lastRenderMs:null,lastBytes:null,refreshes:0,timing:{fetch:null,model:null,pair:null,refresh:null}},n=null,c=null,i=null,u=p(),s=0,r=null,a=!1,o=null;function v(){return o??=import("../c-H4M2T4A6.js").catch(e=>{throw o=null,e}),o}function f(e,t,l){typeof e=="string"&&(i=Object.freeze({bytes:e,etag:t??null,seq:l??null}))}function h(){if(r)return r;let e=s,t=c;return r=v().then(l=>(n=l,e!==s?(r=null,null):l.start({context:t,latest:()=>i}))).catch(l=>(r=null,console.info("clayjs: source map off ("+(l&&l.message?l.message:l)+"); saves use the full serialization"),null)).then(l=>(e===s&&(a=!0),l)),r}function x(){return!u||a?null:h()}function m(){s++,u=!1,a=!1,r=null,c=null,n&&n.release()}d((e,t)=>{f(e,i?i.etag:null,i?i.seq:null),n&&!n.installed()&&n.adoptAccepted(e,t)});document.addEventListener("clay:sync-applied",e=>{let t=e&&e.detail;!t||t.source!=="disk"||typeof t.html!="string"||(f(t.html,t.etag,t.seq),n&&!n.installed()&&n.adoptAccepted(t.html,null))});function y(e,t,l={}){return n?n.renderSave(e,t,l):t}var A={get ready(){return u?h():null},stats:()=>n?n.stats():{...g},text:()=>n?n.text():null,locate:e=>n?n.locateLive(e):null,unpaired:()=>n?n.unpaired():null,ensureForSave:x,get repairGeneration(){return n?n.repairGeneration():0}};function L(){return{id:"clay:source",order:30,prepare(e={}){let t=e&&e.represented;if(t&&(c={represented:t},f(t.bytes,t.etag,t.seq)),e&&e.initial===!0)return u=!0,{enable(){},quiesce(){},resume(){},dispose:m};let l=++s;return u=!1,a=!1,r=null,{enable(){l===s&&(u=!0)},quiesce(){},resume(){l===s&&(u=!0)},dispose(){l===s&&m()}}}}}var R=A;export{R as default,L as modeParticipant,y as renderSave,A as source,L as sourceParticipant};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as xt,c as Nt}from"../c-7DJDKPGL.js";import{g as ke}from"../c-P73XPAOA.js";import{a as ve}from"../c-WYFDLITL.js";import"../c-MZCOGNZL.js";import"../c-IJUK2GPW.js";import{k as Ct}from"../c-C7SUMNMI.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-U4TWEIKZ.js";import{a as Vt}from"../c-MOP5KBWZ.js";import"../c-2YYDMLNZ.js";import{l as St}from"../c-HA6INT6J.js";import"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";var Pt=(()=>{var l=Object.defineProperty,f=Object.getOwnPropertyDescriptor,m=Object.getOwnPropertyNames,A=Object.prototype.hasOwnProperty,x=(e,n)=>{for(var t in n)l(e,t,{get:n[t],enumerable:!0})},j=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of m(n))!A.call(e,a)&&a!==t&&l(e,a,{get:()=>n[a],enumerable:!(o=f(n,a))||o.enumerable});return e},O=e=>j(l({},"__esModule",{value:!0}),e),q={};x(q,{default:()=>$n,endsSentence:()=>Qe,undo:()=>Pe});function pe(e,n=null){let t=[];if(e.type==="attributes"){let o=e.target,a=e.attributeName,i=e.oldValue,d=o.getAttribute(a);return i==null&&d!=null?t.push({kind:"attr-add",target:o,name:a,newValue:d}):i!=null&&d==null?t.push({kind:"attr-remove",target:o,name:a,oldValue:i}):i!==d&&t.push({kind:"attr-set",target:o,name:a,oldValue:i,newValue:d}),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 o=e.target,a=e.nextSibling,i=e.nextSibling;for(;i&&n?.(i);)i=i.nextSibling;let d=e.previousSibling;for(;d&&n?.(d);)d=d.previousSibling;let c=n?Array.from(e.addedNodes).filter(v=>!n(v)):Array.from(e.addedNodes),g=n?Array.from(e.removedNodes).filter(v=>!n(v)):Array.from(e.removedNodes);return c.length>0&&t.push({kind:"add",parent:o,nodes:c,before:a,afterAuthored:i,beforeAuthored:d,record:e}),g.length>0&&t.push({kind:"remove",parent:o,nodes:g,before:a,afterAuthored:i,beforeAuthored:d,record:e}),t}return t}function Ut(e,n=null){let t=[],o=new Map;for(let a of e){if(a.type==="attributes"){let i=a.target,d=a.attributeName,c=o.get(i);c||(c=new Map,o.set(i,c)),c.has(d)||(c.set(d,{idx:t.length,oldValue:a.oldValue}),t.push(null));continue}for(let i of pe(a,n))t.push(i)}for(let[a,i]of o)for(let[d,c]of i){let g=c.oldValue,v=a.getAttribute(d),b=null;g===v?b=null:g==null?b={kind:"attr-add",target:a,name:d,newValue:v}:v==null?b={kind:"attr-remove",target:a,name:d,oldValue:g}:b={kind:"attr-set",target:a,name:d,oldValue:g,newValue:v},t[c.idx]=b}return t.filter(a=>a!=null)}function _t(e,{sameContent:n=(t,o)=>t===o}={}){let t=[],o=new Map;for(let i of e){let d=Fe(i);if(d==null){t.push(i);continue}let c=o.get(i.target);c||(c=new Map,o.set(i.target,c));let g=c.get(d);if(g==null){let v=Ue(i);if(v.oldValue===v.newValue)continue;c.set(d,t.length),t.push({...i,...v})}else t[g]={...t[g],newValue:Ue(i).newValue}}let a=[];for(let i of t){if(Fe(i)==null){a.push(i);continue}i.oldValue!==i.newValue&&(i.kind==="value"&&i.content===!0&&n(i.oldValue,i.newValue)||a.push(Ht(i)))}return a}var Wt=new Set(["attr-set","attr-add","attr-remove","text","value"]);function Fe(e){return Wt.has(e.kind)?e.kind==="text"?"#text":e.kind==="value"?`#${e.prop||"value"}`:e.name==null?null:`@${e.name}`:null}function Ue(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 Ht(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 _e=new WeakMap,Jt=0;function $(e){let n=_e.get(e);return n||(n=`n${++Jt}`,_e.set(e,n)),n}function R(e){return!!e&&typeof e=="object"&&typeof e.nodeType=="number"}function Yt(e){return e.kind==="add"||e.kind==="remove"}function We(e,n){let t=[],o=e.childNodes;if(!o)return t;for(let a of o)n&&n(a)||t.push($(a));return t}function He(e,n,t){if(typeof n!="function"||!R(e)||e.nodeType!==1)return null;let o=null;try{o=n(e,t)}catch{o=null}return typeof o=="string"?`#form:${JSON.stringify(o)}`:null}function le(e,n,t=null,o=null,a=null,i=null){if(!R(e))return null;let d=He(e,a,t);if(d!=null)return d;if(e.nodeType===3)return`#text:${JSON.stringify(i&&i.has(e)?i.get(e):e.data)}`;if(e.nodeType===8)return`#comment:${JSON.stringify(e.data)}`;if(e.nodeType!==1)return`#node:${e.nodeType}`;let c=[];if(e.attributes){for(let v of e.attributes)Gt(v.name,e,n,t)||c.push(`${v.name}=${JSON.stringify(v.value)}`);c.sort()}let g=[];if(e.childNodes)for(let v of e.childNodes){let b=He(v,a,t);if(b!=null){g.push(b);continue}Xt(v,o)||g.push(le(v,n,t,o,a,i))}return`<${String(e.tagName||"").toLowerCase()}${c.length?` ${c.join(" ")}`:""}>${g.join("")}</>`}function Ae(e,n=[]){if(!R(e))return n;if(e.nodeType===1){let t=e.getAttribute&&e.getAttribute("data-id");t&&n.push(t)}if(e.childNodes)for(let t of e.childNodes)Ae(t,n);return n}function Gt(e,n,t,o=null){if(typeof t!="function")return!1;try{return!!t(e,n,o)}catch{return!1}}function Xt(e,n){if(typeof n!="function")return!1;try{return!!n(e)}catch{return!1}}function Je(e,n){if(typeof n!="function")return[];let t=[],o=a=>{if(!R(a))return;let i=!1;try{i=!!n(a)}catch{i=!1}if(i&&t.push(D(a,"protected")),a.childNodes)for(let d of a.childNodes)o(d)};for(let a of e)o(a);return t}function D(e,n,t=null){let o=e;o&&o.nodeType!==1&&(o=o.parentElement);let a=o&&typeof o.closest=="function"?o.closest("[data-id]"):null;return!a&&t&&typeof t.closest=="function"&&(a=t.closest("[data-id]")),{id:(a?a.getAttribute("data-id"):null)||null,kind:n||null}}function Zt(e,n,t=null){return(e||[]).filter(R).map(o=>D(o,n,t))}function de(e){return{replayable:!1,reason:e,steps:[]}}function ge(e,n){let t=[[n.afterAuthored,a=>a],[n.beforeAuthored,a=>a+1],[n.before,a=>a]],o=!1;for(let[a,i]of t){if(!R(a))continue;o=!0;let d=e.indexOf($(a));if(d>=0)return i(d)}return o?null:e.length}function Qt(e,n={}){let t=n.isIgnored||null,o=n.ignoreAttribute||null,a=n.durableForm||null,i=_t(e,{sameContent:Ee}),d=[];for(let E of i){if(!Yt(E)){if(!R(E.target))return de("non-dom-target");continue}if(!R(E.parent))return de("non-dom-parent");let C=Array.from(E.nodes||[]).filter(R);if(C.length!==0){if(C.length!==Array.from(E.nodes||[]).length)return de("non-dom-node");d.push({primitive:E,nodes:C,parent:E.parent})}}if(en(d))return de("in-record-move");let c=tn(d,t);if(!c)return de("ambiguous-structure");let g=nn(d,c),v=new Map(d.map(E=>[E.primitive,E])),b=[];for(let E of i){let C=v.get(E);if(!C){b.push(on(E));continue}let N=g.get(C);if(N){N.at===C&&b.push(N.step);continue}b.push(rn(C,c.get(C),o,t,a))}return{replayable:!0,reason:null,steps:b}}function en(e){let n=new Map;for(let t of e){let o=t.primitive.record;if(!o)continue;let a=n.get(o);a||(a=new Map,n.set(o,a));for(let i of t.nodes){let d=a.get(i);d||(d=new Set,a.set(i,d)),d.add(t.primitive.kind)}}for(let t of n.values())for(let o of t.values())if(o.size>1)return!0;return!1}function tn(e,n){let t=new Map;for(let a of e)t.has(a.parent)||t.set(a.parent,We(a.parent,n));let o=new Map;for(let a=e.length-1;a>=0;a--){let i=e[a],d=t.get(i.parent);if(!d)return null;let c=d.slice(),g;if(i.primitive.kind==="add"){let v=i.nodes.map($);if(!v.every(b=>d.includes(b)))return null;g=d.filter(b=>!v.includes(b))}else{let v=ge(c,i.primitive);if(v==null)return null;g=c.slice(),g.splice(v,0,...i.nodes.map($))}o.set(i,{before:g,after:c}),t.set(i.parent,g)}return o}function nn(e,n){let t=new Map,o=new Map;e.forEach((i,d)=>{for(let c of i.nodes){let g=$(c);i.primitive.kind==="remove"?t.set(g,{item:i,index:d,node:c}):o.set(g,{item:i,index:d,node:c})}});let a=new Map;for(let[i,d]of t){let c=o.get(i);if(!c||c.index<d.index||d.item.nodes.length!==1||c.item.nodes.length!==1)continue;let g={type:"move",node:d.node,sourceParent:d.item.parent,destParent:c.item.parent,source:n.get(d.item),dest:n.get(c.item),sourceSlot:d.item.primitive,destSlot:c.item.primitive,targets:[D(d.node,"move")]};a.set(d.item,{step:g,at:c.item}),a.set(c.item,{step:g,at:c.item})}return a}function rn(e,n,t,o,a=null){let i=e.primitive.kind;return{type:i==="add"?"add":"restore",parent:e.parent,nodes:e.nodes,seqBefore:n.before,seqAfter:n.after,slot:e.primitive,content:e.nodes.map(d=>le(d,t,e.parent,o,a)),ids:i==="remove"?e.nodes.flatMap(d=>Ae(d)):[],targets:Zt(e.nodes,i==="add"?"added":"removed",e.parent)}}function on(e){return{type:e.kind,primitive:e,targets:[D(e.target,e.name||e.prop||"text")]}}function an(e,n,t={}){if(!e||!e.replayable)return{ok:!1,code:"unsupported",targets:[]};let o={isIgnored:t.isIgnored||null,ignoreAttribute:t.ignoreAttribute||null,durableForm:t.durableForm||null,isProtected:t.isProtected||null,inScope:t.inScope||(()=>!0),liveNodesWithIds:t.liveNodesWithIds||(()=>[]),sim:new Map,planned:new Map,texts:new Map,operations:[]};for(let a=0;a<e.steps.length;a++){let i=e.steps[n==="undo"?e.steps.length-1-a:a],d=ln(i,n,o);if(d)return{ok:!1,code:d.code,targets:d.targets}}return{ok:!0,operations:o.operations}}function Q(e,n){return e.sim.has(n)||e.sim.set(n,We(n,e.isIgnored)),e.sim.get(n)}function ee(e,n){for(let t=e;t;t=t.parentNode)if(n.planned.has(t))return n.planned.get(t);return n.inScope(e)}function Ye(e,n){return n.liveNodesWithIds(e).filter(t=>ee(t,n)).length>0}function S(e,n){return{code:e,targets:n||[]}}function Ee(e,n){return e===n?!0:typeof e!="string"||typeof n!="string"?!1:e.replace(/\u00A0| /g," ")===n.replace(/\u00A0| /g," ")}function un(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 ln(e,n,t){let o=n==="undo";return e.type==="move"?pn(e,o,t):e.type==="add"?sn(e,o,t):e.type==="restore"?cn(e,o,t):dn(e,o,t)}function dn(e,n,t){let o=e.primitive,a=n?o.newValue:o.oldValue,i=n?o.oldValue:o.newValue;if(!R(o.target))return S("unsupported",e.targets);if(!ee(o.target,t))return S("target-detached",e.targets);if(o.kind==="value"&&typeof o.write=="function"&&typeof o.read!="function")return S("unsupported",e.targets);let d=un(o);return(o.content===!0?!Ee(d,a):d!==a)?S("content-changed",e.targets):(o.kind==="value"?t.operations.push({type:"value",target:o.target,prop:o.prop||"value",value:i,read:o.read||null,write:o.write||null,content:o.content===!0}):o.kind==="text"?(t.operations.push({type:"text",target:o.target,data:i}),t.texts.set(o.target,i)):t.operations.push({type:"attr",target:o.target,name:o.name,value:i??null}),null)}function sn(e,n,t){if(!R(e.parent)||!ee(e.parent,t))return S("target-detached",e.targets);if(n){if(!te(Q(t,e.parent),e.seqAfter))return S("structure-changed",e.targets);let c=Je(e.nodes,t.isProtected);if(c.length>0)return S("protected",c);for(let g=0;g<e.nodes.length;g++)if(le(e.nodes[g],t.ignoreAttribute,e.parent,t.isIgnored,t.durableForm)!==e.content[g])return S("content-changed",e.targets);for(let g of e.nodes)t.operations.push({type:"remove",node:g}),t.planned.set(g,!1);return t.sim.set(e.parent,e.seqBefore.slice()),null}if(!te(Q(t,e.parent),e.seqBefore))return S("structure-changed",e.targets);for(let c of e.nodes)if(c.parentNode)return S("structure-changed",e.targets);let o=e.nodes.flatMap(c=>Ae(c));if(o.length>0&&Ye(o,t))return S("duplicate-id",e.targets);let a=ge(e.seqBefore,e.slot);if(a==null)return S("unsupported",e.targets);let i=e.seqBefore.slice(),d=a;for(let c of e.nodes)t.operations.push({type:"insert",parent:e.parent,node:c,beforeId:i[d]??null}),i=i.slice(0,d).concat($(c),i.slice(d)),d+=1,t.planned.set(c,!0);return t.sim.set(e.parent,e.seqAfter.slice()),null}function cn(e,n,t){if(!R(e.parent)||!ee(e.parent,t))return S("target-detached",e.targets);if(n){if(!te(Q(t,e.parent),e.seqAfter))return S("structure-changed",e.targets);for(let g=0;g<e.nodes.length;g++){let v=e.nodes[g];if(v.parentNode||le(v,t.ignoreAttribute,e.parent,t.isIgnored,t.durableForm)!==e.content[g])return S("content-changed",e.targets)}if(e.ids.length>0&&Ye(e.ids,t))return S("duplicate-id",e.targets);let i=ge(e.seqAfter,e.slot);if(i==null)return S("unsupported",e.targets);let d=e.seqAfter.slice(),c=i;for(let g of e.nodes)t.operations.push({type:"insert",parent:e.parent,node:g,beforeId:d[c]??null}),d=d.slice(0,c).concat($(g),d.slice(c)),c+=1,t.planned.set(g,!0);return t.sim.set(e.parent,e.seqBefore.slice()),null}if(!te(Q(t,e.parent),e.seqBefore))return S("structure-changed",e.targets);let o=Je(e.nodes,t.isProtected);if(o.length>0)return S("protected",o);let a=i=>t.planned.get(i)===!0||typeof t.isIgnored=="function"&&t.isIgnored(i);for(let i=0;i<e.nodes.length;i++){let d=e.nodes[i];if(d.parentNode!==e.parent||le(d,t.ignoreAttribute,e.parent,a,t.durableForm,t.texts)!==e.content[i])return S("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 fn(e,n){let t=e.indexOf(n);return t<0?null:e.slice(0,t).concat(e.slice(t+1))}function pn(e,n,t){let o=$(e.node),a=n?e.destParent:e.sourceParent,i=n?e.sourceParent:e.destParent,d=Q(t,a),c=Q(t,i),g=n?e.dest.after:e.source.before,v=n?e.source.after:e.dest.before,b=n?e.sourceSlot:e.destSlot;if(!R(a)||!R(i)||!ee(a,t)||!ee(i,t))return S("target-detached",e.targets);if(!te(d,g))return S("structure-changed",e.targets);let E=a===i?fn(c,o):c;if(!te(E,v))return S("structure-changed",e.targets);let C=ge(v,b);return C==null?S("unsupported",e.targets):(t.operations.push({type:"insert",parent:i,node:e.node,beforeId:v[C]??null}),t.planned.set(e.node,!0),n?(t.sim.set(i,e.source.before.slice()),a!==i&&t.sim.set(a,e.dest.before.slice())):(t.sim.set(i,e.dest.after.slice()),a!==i&&t.sim.set(a,e.source.after.slice())),null)}function te(e,n){if(!e||!n||e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function gn(e,n){for(let t of e.childNodes||[])if($(t)===n)return t;return null}function Ge(e,n){let t=Math.min(e.length,n.length),o=0;for(;o<t&&e[o]===n[o];)o++;let a=0;for(;a<t-o&&e[e.length-1-a]===n[n.length-1-a];)a++;return n.length-a}function Xe(e,n){typeof e.write=="function"?e.write(e.target,n):e.target[e.prop]=n}function mn(e){let n=[];try{let t=null;for(let o of e)t=yn(o,n)||t;return{ok:!0,caret:t}}catch(t){for(let o=n.length-1;o>=0;o--)try{n[o]()}catch{}return{ok:!1,error:t}}}function yn(e,n){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),n.push(()=>{t==null?e.target.removeAttribute(e.name):e.target.setAttribute(e.name,t)});return}if(e.type==="text"){let t=e.target.data;return e.target.data=e.data,n.push(()=>{e.target.data=t}),{node:e.target,offset:Ge(t,e.data)}}if(e.type==="value"){let t=typeof e.read=="function"?e.read(e.target):e.target[e.prop],o=e.content?e.target.textContent:null;if(Xe(e,e.value),n.push(()=>Xe(e,t)),!e.content)return;let a=e.target.textContent;return a===o?void 0:{root:e.target,textOffset:Ge(o,a)}}if(e.type==="insert"){let t=e.beforeId==null?null:gn(e.parent,e.beforeId);if(e.beforeId!=null&&!t)throw new Error("hyper-undo: replay anchor vanished");let o=e.node.parentNode,a=e.node.nextSibling;return e.parent.insertBefore(e.node,t),n.push(()=>{o?o.insertBefore(e.node,a&&a.parentNode===o?a:null):e.node.parentNode===e.parent&&e.parent.removeChild(e.node)}),e.node.nodeType!==3?void 0:{node:e.node,offset:e.node.data.length}}if(e.type==="remove"){let t=e.node.parentNode;if(!t)throw new Error("hyper-undo: replay target is no longer attached");let o=e.node.nextSibling,a=Array.prototype.indexOf.call(t.childNodes,e.node);return t.removeChild(e.node),n.push(()=>t.insertBefore(e.node,o)),e.node.nodeType!==3?void 0:{node:t,offset:a}}}var hn=['[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]"],bn=["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"],wn=hn.join(","),vn=new RegExp("^(?:"+bn.join("|")+")(?:-|$)"),Ir=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"]})}),kn=Object.freeze({"editor-ui":Object.freeze(["no-data","no-save","no-snapshot","no-watch","no-undo"])}),An=Object.freeze(["no-save","no-snapshot","no-trigger-autosave","no-dirty","no-watch","no-undo","no-data","freeze","editor-ui","live"]);function Se(e,n){if(!e||e.nodeType!==1)return!1;let t=e.getAttribute?.("clay");return!!(t&&t.split(/\s+/).includes(n)||e.hasAttribute?.(n))}function Ze(e,n){if(Se(e,n))return!0;for(let[t,o]of Object.entries(kn))if(o.includes(n)&&Se(e,t))return!0;return!1}function En(e){return e==="clay"||An.includes(e)}var Sn=["mutations-ignore","save-remove","save-ignore","save-freeze","no-undo","no-watch"];function Cn(){if(typeof window>"u")return null;let e=window.clay?.region||window.hyperclay?.region;return e&&typeof e.resolveRegionPolicy=="function"?e.resolveRegionPolicy:null}function Ce(e){let n=Cn();if(n)try{if(!n(e).undoable)return!0}catch{}let t=e&&e.nodeType!==1?e.parentElement:e;if(t&&t.closest&&t.closest(wn))return!0;for(;t&&t.nodeType===1;){if(Ze(t,"no-undo")||Ze(t,"no-watch"))return!0;for(let o of Sn)if(Se(t,o))return!0;t=t.parentElement}return!1}function Vn(e){let n=e.target,t=n.cloneNode(!1),o=t;for(;n.parentElement;){n=n.parentElement;let a=n.cloneNode(!1);a.appendChild(t),t=a}return e.oldValue==null?o.removeAttribute(e.attributeName):o.setAttribute(e.attributeName,e.oldValue),Ce(o)}function me(e,n,t){if(t?.type==="attributes"&&En(t.attributeName)){if(Ce(e)&&Vn(t))return!0}else if(Ce(e))return!0;if(t&&t.type==="attributes"){if(t.attributeName&&vn.test(t.attributeName.toLowerCase()))return!0;if(n)try{if(n(t.attributeName,t.target))return!0}catch{}}return!1}function xn(){let e=new Map;function n(a,i){let d=e.get(a);return d||(d=new Set,e.set(a,d)),d.add(i),()=>t(a,i)}function t(a,i){let d=e.get(a);d&&d.delete(i)}function o(a,i){let d=e.get(a);if(d)for(let c of Array.from(d))try{c(i)}catch(g){console.error("[hyper-undo] listener threw",g)}}return{on:n,off:t,emit:o}}var Nn=/[.?!]["'\u201D\u2019)\]]*$/,Pn=new Set(["insertParagraph","insertLineBreak"]),Rn=new Set(["insertFromPaste","insertFromDrop","insertFromYank","insertReplacementText","deleteByCut","deleteByDrag"]),In=new Set(["Enter","Backspace","Delete"]),Tn=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"]);function Qe(e){return Nn.test(e)}function On(e,{sentence:n,endStep:t,stepOpen:o=()=>!0,composing:a}){let i=e.ownerDocument&&e.ownerDocument.defaultView;if(!i)return()=>{};let d=h=>!!h&&typeof h.nodeType=="number"&&(h===e||e.contains(h)),c=!1,g=!1,v=!1,b={kind:"other",host:null},E=h=>Rn.has(h)||h.startsWith("format")?"alone":h.startsWith("delete")?"delete":h.startsWith("insert")?"insert":"other",C=h=>{if(!h)return null;let T=h.nodeType===1?h:h.parentElement;return T&&T.closest&&T.closest('[contenteditable]:not([contenteditable="false"])')||h},N=()=>{c&&(c=!1,t())},I=h=>{if(!n||h.isComposing||!d(h.target))return;let T=h.inputType||"",z=E(T),se=C(h.target),ye=i.getSelection&&i.getSelection(),ce=!ye||ye.isCollapsed,Re=g;g=!1;let ne=v;if(v=!1,(z==="alone"||!ne&&z!==b.kind&&z!=="other"&&b.kind!=="other"||!ne&&(b.host!==null&&se!==b.host||!ce||Re))&&t(),b={kind:z,host:se},z==="alone"){c=!0,setTimeout(N,0);return}let re=T==="insertText"&&(h.data===" "||h.data==="\xA0");!re&&!Pn.has(T)||re&&!o()||Qe(Ln(i))&&(c=!0,setTimeout(N,0))},B=h=>{d(h.target)&&N()},L=h=>{d(h.target)&&a(!0)},W=h=>{d(h.target)&&a(!1)},H=h=>{d(h.target)&&(g=!0)},J=h=>{if(!d(h.target))return;if(Tn.has(h.key)){g=!0;return}if(!n||h.isComposing||h.keyCode===229||h.ctrlKey||h.metaKey||!h.key||h.key.length!==1&&!In.has(h.key))return;let T=i.getSelection&&i.getSelection(),z=b.host!==null&&C(h.target)!==b.host;!g&&!z&&(!T||T.isCollapsed)||(t(),g=!1,v=!0,setTimeout(()=>{v=!1},0))};return e.addEventListener("beforeinput",I,!0),e.addEventListener("input",B,!0),e.addEventListener("compositionstart",L,!0),e.addEventListener("compositionend",W,!0),e.addEventListener("pointerdown",H,!0),e.addEventListener("keydown",J,!0),()=>{e.removeEventListener("beforeinput",I,!0),e.removeEventListener("input",B,!0),e.removeEventListener("compositionstart",L,!0),e.removeEventListener("compositionend",W,!0),e.removeEventListener("pointerdown",H,!0),e.removeEventListener("keydown",J,!0)}}function Ln(e){let n=e.getSelection&&e.getSelection();if(!n||!n.isCollapsed||!n.anchorNode)return"";let t=n.anchorNode,o=t.nodeType===1?t:t.parentElement,a=o&&o.closest('[contenteditable]:not([contenteditable="false"])');if(!a)return"";let i=a.ownerDocument.createRange();return i.setStart(a,0),i.setEnd(t,n.anchorOffset),i.toString().replace(/\u200B/g,"").slice(-8)}var Mn={maxHistory:100,idleWindowMs:500,idleLabel:"Edit",recording:"automatic",ignoreAttribute:null,isProtected:null,ignoreNode:null,durableForm:null,typingBreak:null,refused:null,debug:!1};function et(e){let n={...Mn,...e};if(!n.scope)throw new Error("hyper-undo: scope is required");let t=xn(),o=[],a=[],i=`u${Math.random().toString(36).slice(2,8)}`,d=0,c=null,g=[],v=null,b=null,E=0,C=!1,N=n.recording==="commands"?"commands":"automatic",I=null,B=!1,L=new WeakMap,W=!1,H=!1,J=null;function h(...r){n.debug&&console.log("[hyper-undo]",...r)}function T(){C||(C=!0,b=z(Y),b.observe(n.scope,{childList:!0,attributes:!0,characterData:!0,subtree:!0,attributeOldValue:!0,characterDataOldValue:!0}),J=On(n.scope,{sentence:n.typingBreak==="sentence",stepOpen:()=>(E===0&&b&&Y(b.takeRecords()),g.length>0),endStep:X,composing:Fn}),h("started"))}function z(r){let u=typeof document<"u"&&n.scope===document.body,s=typeof window<"u"&&(window.clay?.Mutation||window.hyperclay?.Mutation)||null;return u&&s&&typeof s.createObserver=="function"?(h("sourcing records from the platform Mutation hub (shared observer)"),s.createObserver(r)):new MutationObserver(r)}function se(){C&&(C=!1,b&&(b.disconnect(),b=null),J&&(J(),J=null),W=!1,G(),o.length=0,a.length=0,g=[],c=null,I=null,B=!1,E=0,L=new WeakMap,h("stopped"))}function ye(){let r=n.scope;return!!(r&&r.nodeType===1&&r.isConnected===!1)}function ce(r,u){try{let s=u(r);return typeof s=="string"?s:null}catch{return null}}function Re(r,{read:u,write:s,prop:p="content"}={}){if(!r||typeof u!="function"||typeof s!="function")return()=>{};let k={prop:p,read:u,write:s,baseline:ce(r,u)};return L.set(r,k),()=>{L.get(r)===k&&L.delete(r)}}function ne(r){for(let u=r;u;u=u.parentNode)if(L.has(u))return u;return null}function re(r){let u=ne(r.target);return!!u&&!(r.type==="attributes"&&r.target===u)}function _(r){let u=new Set;for(let s of r)re(s)&&u.add(ne(s.target));return u}function Ie(r){let u=[];for(let s of r){let p=L.get(s),k=ce(s,p.read);if(k!=null){if(Ee(k,p.baseline)){p.baseline=k;continue}p.baseline!=null&&u.push({kind:"value",target:s,prop:p.prop,oldValue:p.baseline,newValue:k,read:p.read,write:p.write,content:!0}),p.baseline=k}}return u}function oe(r){for(let u of r){let s=L.get(u);s.baseline=ce(u,s.read)}}function ut(r){let u=_(r);!H&&g.some(s=>s.kind==="value"?u.has(s.target):r.some(p=>p.target===s.target&&(p.type==="characterData"?s.kind==="text":p.type==="attributes"&&p.attributeName===s.name)))&&(H=!0),oe(u)}function Y(r){lt(r,!1)}function lt(r,u){if(I){for(let p of r)I.records.push(p);return}if(N==="commands"){oe(_(r));return}if(E>0){ut(r);return}let s=Te(Bn(r),u);for(let p of Ie(_(r)))s.push(p);if(s.length>0){for(let p of s)g.push(p);Oe()}}function Bn(r){return typeof n.ignoreNode!="function"?r:r.filter(u=>{if(u.type!=="childList")return!0;let s=[...u.addedNodes,...u.removedNodes];return s.length===0?!0:!s.every(p=>zn(p))})}function zn(r){try{return!!n.ignoreNode(r)}catch{return!1}}function Te(r,u=!1){let s=ar(r),p=r.filter(k=>(De(k.target)||s(k.target)||u&&Et(k.target))&&!re(k)&&!me(k.target,n.ignoreAttribute,k));return Ut(p,k=>me(k,n.ignoreAttribute))}function Fn(r){W=!!r,!W&&g.length>0&&Oe()}function Oe(){G(),v=setTimeout(dt,n.idleWindowMs)}function dt(){if(v=null,W){v=setTimeout(dt,n.idleWindowMs);return}Le()}function G(){v!=null&&(clearTimeout(v),v=null)}function Le(){if(v=null,g.length===0)return;let r=g;g=[],he(n.idleLabel,r)}function he(r,u){let s=Qt(u,{isIgnored:be,ignoreAttribute:st,durableForm:n.durableForm});if(s.steps.length===0)return h("commit",r,"with nothing to record"),t.emit("commit"),null;let p={id:`${i}-${++d}`,label:r,timestamp:Date.now(),primitives:u,certificate:s};for(o.push(p),a.length=0,c=null;o.length>n.maxHistory;)o.shift();return h("commit",r,"primitives:",u.length),t.emit("commit"),p}function be(r){return me(r,n.ignoreAttribute)}function st(r,u,s=null){if(typeof n.ignoreAttribute!="function")return!1;try{return!!n.ignoreAttribute(r,u,s)}catch{return!1}}function Un(r){if(typeof n.isProtected!="function")return!1;try{return!!n.isProtected(r)}catch{return!1}}function _n(r,u){if(!C)throw new Error("hyper-undo: scope not started");if(N==="commands")return pt(r,u,{honorPause:!0,receipt:!1});Y(b.takeRecords()),X();let s=E===0?ct():null,p=u();if(p&&typeof p.then=="function")throw new Error("hyper-undo: commit() fn must be synchronous; returned a Promise");if(lt(b.takeRecords(),!0),s!=null&&ft(s),g.length===0){t.emit("commit");return}G();let k=g;g=[],he(r,k)}function Wn(r){if(!C)throw new Error("hyper-undo: scope not started");if(!b)return;if(E>1){oe(_(b.takeRecords()));return}X();let u=b.takeRecords(),s=Te(u,!0);for(let p of Ie(_(u)))s.push(p);s.length!==0&&(G(),he(r,s))}function Hn(){b&&oe(_(b.takeRecords()))}function Me(){let r=n.scope;return r&&r.ownerDocument||(typeof document<"u"?document:null)}function we(){let r=Me();return!r||!r.head||typeof r.head.querySelector!="function"?null:r.head.querySelector("title")}function ct(){let r=we();return r?r.textContent:null}function ft(r){let u=we();if(!u||r==null)return;let s=u.textContent;s!==r&&mt({kind:"value",target:u,prop:"textContent",oldValue:r,newValue:s})}function Jn(r){if(!r)return null;let u=Me();if(!u||r.target!==u||r.prop!=="title")return r;let s=we();return s?{kind:"value",target:s,prop:"textContent",oldValue:r.oldValue,newValue:r.newValue}:null}function Yn(){if(typeof window>"u")return!1;let r=window.clay?.effect||window.hyperclay?.effect;return!!(r&&r.running)}function Gn(){b&&Y(b.takeRecords()),X(),I={records:[],primitives:[]}}function Xn(){let r=I;if(I=null,!r)return[];let u=Te(r.records,!0);for(let s of Ie(_(r.records)))u.push(s);for(let s of r.primitives)u.push(s);return u}function pt(r,u,{honorPause:s,receipt:p}){if(typeof u!="function")throw new Error("hyper-undo: command() needs a synchronous function");if(I)throw new Error("hyper-undo: command() cannot nest inside another command");if(B)throw new Error("hyper-undo: command() cannot run during undo or redo");if(Yn())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 k=s&&E>0,V=k?null:ct();Gn();let M=[],P=null,K;try{try{K=u()}catch(ie){P=ie}if(b&&Y(b.takeRecords()),K&&typeof K.then=="function"){try{K.then(void 0,()=>{})}catch{}P||(P=new Error("hyper-undo: command() fn must be synchronous; returned a Promise"))}k||ft(V)}finally{M=Xn()}let F=k||M.length===0?null:he(r,M);if(P)throw P;return p?F?{id:F.id,label:F.label}:null:F}function Zn(r,u){if(!C)throw new Error("hyper-undo: scope not started");return pt(r,u,{honorPause:!1,receipt:!0})}function Qn(r){if(r!=="automatic"&&r!=="commands")throw new Error("hyper-undo: setRecording() takes 'automatic' or 'commands'");if(I)throw new Error("hyper-undo: setRecording() cannot change while a command is running");return N===r||(X(),N=r,h("recording",r)),N}function gt(r){if(!C||!r||!I&&(E>0||N==="commands"))return;let u=Jn(r);u&&mt(u)}function mt(r){if(I){I.primitives.push(r);return}g.push(r),Oe()}function er(r,{prop:u="value",oldValue:s,newValue:p,read:k,write:V}={}){!r||s===p||gt({kind:"value",target:r,prop:u,oldValue:s,newValue:p,read:k,write:V})}function X(){E===0&&b&&Y(b.takeRecords()),g.length!==0&&(G(),Le())}function yt(){E===0&&b&&Y(b.takeRecords()),E++,h("paused",E)}function ht(){E!==0&&(E--,E===0&&b&&(ut(b.takeRecords()),H&&(H=!1,G(),Le())),h("resumed",E))}function bt(r,u){if(ye())return se(),{ok:!1,code:"disconnected"};if(typeof n.holdReplay=="function"&&n.holdReplay())return{ok:!1,code:"held"};X();let s=r==="undo"?o:a,p=r==="undo"?a:o,k=[],V=s.at(-1);if(!V)return{ok:!1,code:"empty"};if(u&&u!==V.id){let P=vt(u)||V;return je(P,r,"stale-entry")}let M=n.refused==="skip"&&!u;for(;V;){let P;B=!0;try{P=an(V.certificate,r,{isIgnored:be,ignoreAttribute:st,durableForm:n.durableForm,isProtected:Un,inScope:ur,liveNodesWithIds:lr})}finally{B=!1}if(!P.ok){if(!M)return je(V,r,P.code,P.targets);wt(V,r,P.code,P.targets,k),V=s.at(-1);continue}yt();let K;B=!0;try{K=mn(P.operations)}finally{B=!1,ht()}if(!K.ok){if(h(`${r} failed and was rolled back`,K.error),!M)return je(V,r,"replay-error");wt(V,r,"replay-error",[],k),V=s.at(-1);continue}oe(new Set(P.operations.filter(ie=>ie.type==="value"&&L.has(ie.target)).map(ie=>ie.target))),s.pop(),p.push(V),c=null;let F={ok:!0,entryId:V.id,label:V.label,direction:r};return k.length&&(F.skipped=k),K.caret&&(F.caret=K.caret),h(r,V.label),t.emit(r,F),F}return{ok:!1,code:"empty",direction:r,skipped:k}}function wt(r,u,s,p,k){c={entryId:r.id,direction:u,code:s,targets:p};let V=kt(r.id);(u==="undo"?o:a).pop(),c=null;let M={entryId:r.id,label:r.label,direction:u,code:s,targets:p,description:V};h("skipped",u,s),t.emit("skipped",M),k.push(M)}function tr(r){return bt("undo",r&&r.entryId)}function nr(r){return bt("redo",r&&r.entryId)}function vt(r){return o.find(u=>u.id===r)||a.find(u=>u.id===r)||null}function je(r,u,s,p=[]){return c={entryId:r.id,direction:u,code:s,targets:p},h("refused",u,s),t.emit("refused",{entryId:r.id,label:r.label,direction:u,code:s,targets:p}),{ok:!1,code:s,entryId:r.id,label:r.label,direction:u}}function rr(r){if(!c||c.entryId!==r)return{ok:!1,code:"not-refused",entryId:r};let u=c.direction,s=u==="undo"?o:a,p=s.at(-1);return!p||p.id!==r?{ok:!1,code:"stale-entry",entryId:r}:(s.pop(),c=null,h("discarded",p.label),t.emit("discard",{entryId:r,label:p.label,direction:u}),{ok:!0,entryId:r,direction:u})}function kt(r){let u=vt(r);if(!u||!u.certificate||!u.certificate.replayable)return null;let s=c&&c.entryId===u.id?{direction:c.direction,code:c.code,targets:(c.targets||[]).map(p=>({id:p.id??null,kind:p.kind??null}))}:null;return{id:u.id,label:u.label,timestamp:u.timestamp,refused:s,steps:u.certificate.steps.map(ir)}}function or(r){return typeof r!="string"?null:r.replace(/#form:("(?:[^"\\]|\\.)*")/g,(u,s)=>{try{return JSON.parse(s)}catch{return""}})}function ir(r){if(r.type==="move")return{kind:"move",node:{id:D(r.node).id},from:{id:D(r.sourceParent).id},to:{id:D(r.destParent).id}};if(r.type==="add"||r.type==="restore")return{kind:r.type==="add"?"add":"remove",parent:{id:D(r.parent).id},nodes:r.nodes.map((V,M)=>({id:D(V).id,html:or(r.content[M])}))};let u=r.primitive,s={id:D(u.target).id},p=u.oldValue??null,k=u.newValue??null;return r.type==="value"?{kind:"value",target:s,prop:u.prop??"value",before:p,after:k}:r.type==="text"?{kind:"text",target:s,before:p,after:k}:r.type==="attr-set"||r.type==="attr-add"||r.type==="attr-remove"?{kind:"attribute",target:s,name:u.name??null,before:p,after:k}:{kind:r.type,target:s,before:p,after:k}}function ar(r){let u=new Set,s=!0;for(;s;){s=!1;for(let p of r)if(!(p.type!=="childList"||!p.removedNodes?.length)&&!re(p)&&!(!De(p.target)&&!At(p.target,u))&&!me(p.target,n.ignoreAttribute,p))for(let k of p.removedNodes)u.has(k)||(u.add(k),s=!0)}return p=>!De(p)&&At(p,u)}function At(r,u){for(let s=r;s;s=s.parentNode)if(u.has(s))return!0;return!1}function De(r){let u=n.scope;return!u||!r||typeof r.nodeType!="number"?!1:r===u||typeof u.contains=="function"&&u.contains(r)}function Et(r){let u=Me(),s=u&&u.head;if(!s||!r)return!1;let p=r.nodeType===1?r:r.parentElement;for(;p&&p!==s;p=p.parentElement)if(p.localName==="title")return!1;return p===s}function ur(r){let u=n.scope;return!r||!u?!1:r===u||we()===r||Et(r)?!0:typeof u.contains=="function"?u.contains(r):!1}function lr(r){let u=n.scope;if(!r||r.length===0||typeof u?.querySelectorAll!="function")return[];let s=new Set(r),p=[];for(let k of u.querySelectorAll("[data-id]"))s.has(k.getAttribute("data-id"))&&(be(k)||p.push(k));return p}function dr(){b&&oe(_(b.takeRecords())),o.length=0,a.length=0,g=[],c=null,G(),h("cleared"),t.emit("clear")}return{_config:n,_tracksContentAt:r=>N!=="commands"&&!!ne(r),_recordsAt:r=>N!=="commands"&&!be(r),start:T,stop:se,commit:_n,commitCaptured:Wn,discardCaptured:Hn,flush:X,command:Zn,setRecording:Qn,record:gt,recordValue:er,trackContent:Re,undo:tr,redo:nr,clear:dr,discard:rr,describe:kt,pause:yt,resume:ht,on:t.on,off:t.off,get canUndo(){return o.length>0},get canRedo(){return a.length>0},get isPaused(){return E>0},get history(){return o.map(r=>{let u={id:r.id,label:r.label,timestamp:r.timestamp};return c&&c.entryId===r.id&&(u.refused={direction:c.direction,code:c.code,targets:c.targets}),u})},get future(){return a.map(r=>{let u={id:r.id,label:r.label,timestamp:r.timestamp};return c&&c.entryId===r.id&&(u.refused={direction:c.direction,code:c.code,targets:c.targets}),u}).reverse()},get scope(){return n.scope}}}var jn=new Set(["checkbox","radio","button","submit","reset","image","file","range","color"]);function tt(e){let n=typeof e.composedPath=="function"?e.composedPath():[];return n.length>0?n:Kn(e.target)}function Dn(e){for(let n of tt(e)){if(!n||n.nodeType!==1)continue;let t=String(n.tagName||"").toUpperCase();if(t==="TEXTAREA"||t==="SELECT"||t==="INPUT"&&!jn.has(String(n.type||n.getAttribute?.("type")||"text").toLowerCase()))return!0}return!1}function nt(e){for(let n of tt(e)){if(!n||n.nodeType!==1)continue;if(n.isContentEditable===!0)return!0;let t=n.getAttribute&&n.getAttribute("contenteditable");if(t!=null&&String(t).toLowerCase()!=="false")return!0}return!1}function Ve(e,n){if(!e||!e.closest||!Array.isArray(n))return!1;for(let t of n)try{if(e.closest(t))return!0}catch{}return!1}function rt(e,n){if(Dn(e))return!0;let t=n._config,o=e.target;return t.editableKeys!=="page"?nt(e)||Ve(o,t.shadowKeydownIn):Ve(o,t.ownKeysIn)||n._tracksContentAt(o)?!1:Ve(o,t.shadowKeydownIn)?!0:nt(e)&&!n._recordsAt(o)}function Kn(e){let n=[];for(let t=e;t;t=t.parentNode||(t.host??null))n.push(t);return n}function qn(e,n){let t=i=>{let d=e.scope;if(d&&d.nodeType===1&&d.isConnected===!1){n&&n();return}if(i.defaultPrevented||i.isComposing||i.keyCode===229||rt(i,e)||!(i.metaKey||i.ctrlKey))return;let c=(i.key||"").toLowerCase();if(c==="z"&&!i.shiftKey){i.preventDefault(),i.stopPropagation(),e.undo();return}if(c==="z"&&i.shiftKey){i.preventDefault(),i.stopPropagation(),e.redo();return}if(c==="y"&&!i.shiftKey){i.preventDefault(),i.stopPropagation(),e.redo();return}},o=i=>{if(i.inputType!=="historyUndo"&&i.inputType!=="historyRedo")return;let d=e.scope;d&&d.nodeType===1&&d.isConnected===!1||i.defaultPrevented||i.isComposing||rt(i,e)||(i.preventDefault(),i.stopPropagation(),i.inputType==="historyRedo"?e.redo():e.undo())},a=e._config.editableKeys==="page";return window.addEventListener("keydown",t,!0),a&&window.addEventListener("beforeinput",o,!0),()=>{window.removeEventListener("keydown",t,!0),a&&window.removeEventListener("beforeinput",o,!0)}}var xe=[".CodeMirror",".cm-editor",".monaco-editor",".ace_editor",".ql-editor",".tiptap",".ProseMirror",".overtype-input","[data-richclay-active]",".ck-editor__editable","[data-lexical-editor]","[data-slate-editor]","trix-editor",".mce-content-body"],y=null,Ne=null,ot=null,U=null;function it(e,n){if(U){if(U.inst===e)return U.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=qn(e,n);return U={inst:e,cleanup:t},t}function at(e){U&&U.inst===e&&(U.cleanup(),U=null)}var Pe={defaults:{shadowKeydownIn:xe},start(e={}){let n=e.scope||(typeof document<"u"?document.body:null);if(!n)throw new Error("hyper-undo: no scope (need document.body or explicit { scope })");if(y){if(Ne===n)return console.warn("[hyper-undo] start() called again on existing singleton; ignoring new options"),y;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:n,shadowKeydownIn:e.shadowKeydownIn||xe};return y=et(t),y.start(),Ne=n,e.bindKeys!==!1&&(ot=it(y,()=>Pe.stop())),y},stop(){y&&(at(y),ot=null,y.stop(),y=null,Ne=null)},create(e={}){let n=e.scope||(typeof document<"u"?document.body:null);if(!n)throw new Error("hyper-undo: no scope (need document.body or explicit { scope })");let t={...e,scope:n,shadowKeydownIn:e.shadowKeydownIn||xe},o=et(t),a=null,i={_config:o._config,commit:o.commit,command:o.command,setRecording:o.setRecording,commitCaptured:o.commitCaptured,discardCaptured:o.discardCaptured,flush:o.flush,record:o.record,recordValue:o.recordValue,trackContent:o.trackContent,undo:o.undo,redo:o.redo,clear:o.clear,discard:o.discard,describe:o.describe,pause:o.pause,resume:o.resume,on:o.on,off:o.off,get canUndo(){return o.canUndo},get canRedo(){return o.canRedo},get isPaused(){return o.isPaused},get history(){return o.history},get future(){return o.future},get scope(){return o.scope},start(){e.bindKeys&&(a=it(o,()=>i.stop())),o.start()},stop(){at(o),a=null,o.stop()}};return i},commit(e,n){return y?y.commit(e,n):void 0},command(e,n){return y?y.command(e,n):void 0},setRecording(e){return y?y.setRecording(e):void 0},commitCaptured(e){return y?y.commitCaptured(e):void 0},discardCaptured(){return y?y.discardCaptured():void 0},record(e){return y?y.record(e):void 0},recordValue(e,n){return y?y.recordValue(e,n):void 0},trackContent(e,n){return y?y.trackContent(e,n):()=>{}},undo(e){return y?y.undo(e):void 0},redo(e){return y?y.redo(e):void 0},clear(){return y?y.clear():void 0},discard(e){return y?y.discard(e):void 0},describe(e){return y?y.describe(e):void 0},pause(){return y?y.pause():void 0},resume(){return y?y.resume():void 0},flush(){return y?y.flush():void 0},on(e,n){return y?y.on(e,n):void 0},off(e,n){return y?y.off(e,n):void 0},get canUndo(){return y?y.canUndo:!1},get canRedo(){return y?y.canRedo:!1},get history(){return y?y.history:[]},get future(){return y?y.future:[]},get isPaused(){return y?y.isPaused:!1}},$n=Pe;return O(q)})();window.__hyperclayNoAutoExport||(window.hyperclay=window.hyperclay||{},window.hyperclay.undo=Pt.undo,window.h=window.hyperclay);var w=Pt.undo;var jt='[contenteditable]:not([contenteditable="false"])';function sr(l,f){let m=Number(f)||0;m<0&&(m=0);let x=(l.ownerDocument||document).createTreeWalker(l,4),j=null;for(let O=x.nextNode();O;O=x.nextNode()){if(m<=O.data.length)return{node:O,offset:m};m-=O.data.length,j=O}return j?{node:j,offset:j.data.length}:{node:l,offset:l.childNodes.length}}function cr(l){let m=(l.nodeType===1?l:l.parentElement)?.closest?.(jt);return!m||!m.isConnected||typeof m.checkVisibility=="function"&&m.checkVisibility()===!1?null:m}function fr(l){if(!l)return;let f=l.root?sr(l.root,l.textOffset):l;if(!f?.node)return;let m=cr(f.node);m&&(typeof m.scrollIntoView=="function"&&m.scrollIntoView({block:"nearest",inline:"nearest"}),document.activeElement?.closest?.(jt)&&(document.activeElement!==m&&m.focus({preventScroll:!0}),document.getSelection()?.collapse(f.node,f.offset)))}var qe=new Set,$e=new Set,Dt=(l,f=null)=>{for(let m of $e){let A=m(l,f);if(typeof A=="string")return A}},Kt=(l={})=>{let f=l.ignoreAttribute;return{...l,ignoreAttribute:(m,A,x)=>qe.has(m)||St(m,A)||Vt(A,m,x)||xt(m,A)||(f?f(m,A,x):!1),isProtected:l.isProtected||pr,ignoreNode:l.ignoreNode||Nt,durableForm:l.durableForm||Dt}};function pr(l){let f=window.clay?.region?.resolveRegionPolicy;if(!f||l.nodeType!==1||Dt(l)!==void 0)return!1;let m=f(l);if(m.undoable!==!1||m.persist==="none")return!1;let A=l.parentElement;return!A||f(A).undoable!==!1}var gr=w.create.bind(w);w.create=l=>gr(Kt(l));var fe=null,mr=w.setRecording.bind(w);w.setRecording=l=>(fe=l??null,document.dispatchEvent(new CustomEvent("clay:undo-recording",{detail:{mode:fe}})),mr(l));Object.defineProperty(w,"recordingMode",{get:()=>fe,configurable:!0});var Rt=()=>w.history.at(-1)?.id??null,qt=w.command.bind(w);w.command=(l,f)=>{let m=qt(l,f);return m&&ke(),m};w.recordStep=(l,f)=>qt(l,()=>w.record(f));var $t=l=>!!l?.steps?.length&&l.steps.every(f=>f.kind==="value"&&/^blockeditor-step(?::|$)/.test(f.prop)),yr=w.commit.bind(w),It=!1;w.commit=(l,f)=>{!It&&window.clay?.effect?.running&&(It=!0,console.warn(`clay.effect: undo.commit("${l}") was called inside an effect. Run commands from event handlers, not from an effect.`));let m=Rt(),A=yr(l,f);return(A||Rt()!==m)&&ke(),A};var hr=`input${ve}:not([type="password"]):not([type="hidden"]):not([type="file"]), textarea${ve}, select${ve}`;function br(){let l=f=>window.clay?.region?.resolveRegionPolicy?.(f)?.undoable!==!1;document.querySelectorAll(hr).forEach(f=>{if(!l(f))return;if(f.tagName==="SELECT"){for(let q of f.options){let pe=q.hasAttribute("selected");q.selected!==pe&&(q.selected=pe)}return}let m=(f.getAttribute("type")||"text").toLowerCase();if(f.tagName==="INPUT"&&(m==="checkbox"||m==="radio")){let q=f.hasAttribute("checked");f.checked!==q&&(f.checked=q);return}let A=f.tagName==="TEXTAREA"?f.getAttribute("data-value")??f.textContent:f.getAttribute("value")??"";if(f.value===A)return;let x=f===document.activeElement,j,O;try{j=f.selectionStart,O=f.selectionEnd}catch{}if(f.value=A,x&&j!=null)try{f.setSelectionRange(Math.min(j,A.length),Math.min(O,A.length))}catch{}})}var Tt=l=>{l?.ok&&($t(w.describe(l.entryId))||ke(),br(),l.caret&&w.pageHistory&&fr(l.caret))},Ot=({entryId:l,label:f,direction:m,code:A})=>{document.dispatchEvent(new CustomEvent("clay:undo-refused",{detail:{ok:!1,code:A,entryId:l,label:f,direction:m}})),zt({ok:!1,code:A,entryId:l,label:f,direction:m})},Lt=({entryId:l,label:f,direction:m,code:A,description:x})=>{document.dispatchEvent(new CustomEvent("clay:undo-skipped",{detail:{entryId:l,label:f,direction:m,code:A}})),!$t(x)&&zt({ok:!1,code:A,entryId:l,label:f,direction:m,description:x})},Ke=null;function Bt(){return Ke??=import("../c-2EPHRF47.js").catch(l=>(Ke=null,console.error("clayjs: the undo recovery module could not be downloaded; a refused step stays in this tab only",l),null)),Ke}async function zt(l){let f={ok:!1,code:"unavailable"};try{let A=await Bt();A&&(f=await A.keepRefusal(w,l))}catch{f={ok:!1,code:"error"}}let m=f?.ok===!0?{ok:!0,entryId:l.entryId,direction:l.direction}:{ok:!1,code:f?.code||"error",entryId:l.entryId,direction:l.direction};document.dispatchEvent(new CustomEvent("clay:undo-kept",{detail:m}))}var ze=(l,f)=>(...m)=>Bt().then(A=>A?A[l](...m):f,()=>f),wr=ze("keep",{ok:!1,code:"unavailable"});w.addDurableForm=l=>($e.add(l),()=>{$e.delete(l)});w.ignoreAttribute=l=>{let f=String(l||"");return f?(qe.add(f),()=>{qe.delete(f)}):()=>{}};w.keep=async l=>{let f=await wr(l);return f?.ok===!0&&document.dispatchEvent(new CustomEvent("clay:undo-kept",{detail:{ok:!0,key:l?.key==null?null:`app:${l.key}`}})),f};w.kept=ze("kept",{ok:!1,code:"unavailable",records:[]});w.dismissKept=ze("dismissKept",{ok:!1,code:"unavailable"});var Be=new Set;w.reviewActions=l=>typeof l!="function"?()=>{}:(Be.add(l),()=>{Be.delete(l)});w.reviewActionsFor=l=>{let f=[];for(let m of Be){let A;try{A=m(l)}catch(x){console.error("clayjs: a review action could not describe itself; the copy stays reviewable",x);continue}for(let x of Array.isArray(A)?A:[])x&&typeof x.run=="function"&&x.label&&f.push(x)}return f};var vr=["commit","undo","redo","refused","skipped","discard","clear"],ue=new Set,Ft=l=>{for(let f=w;f;f=Object.getPrototypeOf(f)){let m=Object.getOwnPropertyDescriptor(f,l);if(m)return typeof m.get=="function"?()=>m.get.call(w):()=>!!m.value.call(w)}return()=>!1},kr=Ft("canUndo"),Ar=Ft("canRedo");Object.defineProperty(w,"canUndo",{get:()=>ue.size===0&&kr(),configurable:!0});Object.defineProperty(w,"canRedo",{get:()=>ue.size===0&&Ar(),configurable:!0});w.hold=()=>{let l=Symbol("hold");ue.add(l),ae();let f=!1;return()=>{f||(f=!0,ue.delete(l),ae())}};var ae=()=>{let l=!!Z?.started&&ue.size===0;document.dispatchEvent(new CustomEvent("clay:undo-change",{detail:{canUndo:l&&w.canUndo,canRedo:l&&w.canRedo,undo:l&&w.history.at(-1)||null,redo:l&&w.future?.[0]||null}}))},Z=null;Object.defineProperty(w,"pageHistory",{get:()=>!!Z?.started,configurable:!0});var Mt=()=>{typeof document>"u"||document.dispatchEvent(new CustomEvent("clay:undo-session",{detail:{started:!!Z?.started,pageHistory:w.pageHistory}}))};function Er(){return{started:!1,admitted:!1,subscriptions:[]}}var Sr=l=>l?l.signal?.aborted?!0:typeof l.isCurrent=="function"&&!l.isCurrent():!1;function Cr(){return typeof document>"u"||document.readyState!=="loading"?Promise.resolve():new Promise(l=>document.addEventListener("DOMContentLoaded",l,{once:!0}))}function Vr(l){return{enable(){if(!l.started){l.started=!0,l.admitted=!0,w.start(Kt({bindKeys:!0,editableKeys:"page",ownKeysIn:[".blockeditor-editor"],typingBreak:"sentence",refused:"skip",holdReplay:()=>ue.size>0,...fe?{recording:fe}:{}}));for(let f of["undo","redo"])w.on(f,Tt),l.subscriptions.push({type:f,handler:Tt});w.on("refused",Ot),l.subscriptions.push({type:"refused",handler:Ot}),w.on("skipped",Lt),l.subscriptions.push({type:"skipped",handler:Lt});for(let f of vr)w.on(f,ae),l.subscriptions.push({type:f,handler:ae});ae(),Mt()}},quiesce(){l.admitted&&(l.admitted=!1,w.pause())},resume(){l.admitted||(l.admitted=!0,w.resume())},dispose(){if(l.admitted=!1,Z===l&&(Z=null),!!l.started){l.started=!1;for(let{type:f,handler:m}of l.subscriptions.splice(0))w.off(f,m);w.stop(),ae(),Mt()}}}}function xr(){return{id:"clay:undo",order:350,async prepare(l={}){if(l.initial===!0)return Nr();if(await Cr(),Sr(l))throw Object.assign(new Error("clay:undo prepared for a stale generation"),{code:"stale-document"});return Vr(Z||(Z=Er()))}}}async function Nr(){let l=await Rr;return{enable(){},quiesce:()=>l?.quiesce(),resume:()=>l?.resume(),dispose:()=>l?.dispose()}}async function Pr(){if(!Ct()||typeof document>"u")return null;let l=await xr().prepare();return l.enable(),l}var Rr=Pr();var Br=w;export{Br as default,Pr as init,xr as modeParticipant,Rr as ready,br as restoreControls,w as undo,xr as undoParticipant};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as f,b as v}from"../c-3G2DGZUP.js";import"../c-VHNSBD2M.js";var $="hha:upgrade-check:",M=1440*60*1e3,S="upgrade-dismissed",P="A new version of this template is available.";function b(e,t){let n=e.querySelector(`meta[name="${t}"]`),r=n?n.getAttribute("content"):null;return r&&r.trim()?r.trim():null}function T(e){try{let t=globalThis.localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}}function j(e,t){try{globalThis.localStorage.setItem(e,JSON.stringify(t))}catch{}}async function x(e){let t=globalThis.crypto&&globalThis.crypto.subtle;if(!t)return null;let n=await t.digest("SHA-256",e);return[...new Uint8Array(n)].map(r=>r.toString(16).padStart(2,"0")).join("")}async function L(e,t){try{let n=await e(t,{credentials:"omit"});return n.ok?n:null}catch{return null}}async function N(e,t,{fetchFn:n,now:r}){let o=new URL(e);o.pathname=o.pathname.replace(/\.html$/,".json");let a=`${$}${o.href}:${t}`,u=T(a);if(u&&typeof u.checkedAt=="number"&&r-u.checkedAt<M)return{latest:u.latest,latestUrl:o};let i=await L(n,o.href);if(!i)return{latest:null,latestUrl:o};let c=null;try{c=await i.json()}catch{return{latest:null,latestUrl:o}}return j(a,{checkedAt:r,latest:c}),{latest:c,latestUrl:o}}function A({doc:e,loc:t}){let n=typeof window<"u"&&window.clay||{};if(!n.canEdit||n.isDraftMode)return null;let r=b(e,"hyper-source"),o=b(e,"hyper-version");if(!r||!o)return null;let a;try{a=new URL(r,t?t.href:void 0)}catch{return null}return!a.pathname.endsWith(".html")||t&&a.origin===t.origin&&a.pathname===t.pathname?null:{source:a,currentVersion:o}}async function C({doc:e=document,loc:t=location,fetchFn:n=(o,a)=>fetch(o,a),now:r=Date.now()}={}){let o=A({doc:e,loc:t});if(!o)return{status:"none",version:null,update:null};let{source:a,currentVersion:u}=o,i=(R,V=null)=>({status:R,version:u,update:V}),c=new URL(a.href);c.pathname=c.pathname.replace(/\.html$/,".json");let{latest:s}=await N(a.href,u,{fetchFn:n,now:r});if(!s||typeof s!="object"||typeof s.version!="string"||!f(s.version)||!f(u))return i("unknown");if(!v(s.version,u))return i("current");let h=typeof window<"u"&&window.clay||{},w=h.storage&&h.storage.local;if(w&&w.get(S)===s.version||typeof s.html!="string"||!s.html)return i("unknown");let m=new URL(s.html,c).href,y=await L(n,m);if(!y)return i("unknown");let g;try{g=await y.arrayBuffer()}catch{return i("unknown")}let d=await x(g);return!d||d!==String(s.sha256||"").toLowerCase()?i("unknown"):i("update",{version:s.version,html:m,sha256:d,latestUrl:c.href})}async function H(e){return(await C(e)).update}async function k(e,t){let n=window.clay;if(await I(n),!p(n)||!t)return;let r=e==="current"?"File at latest version":`Version ${t}`;n.menu.addItem({id:"upgrade",label:r,text:!0})}function O(e){let t=window.clay,n=t&&t.storage&&t.storage.local;n&&n.set(S,e)}function D(e){return!!(e&&Array.isArray(e.plugins)&&e.plugins.includes("menu"))}function p(e){return!!(e&&e.menu&&typeof e.menu.addItem=="function")}function I(e){return p(e)||!D(e)?Promise.resolve():new Promise(t=>{let n=r=>{!r.detail||r.detail.plugin!=="menu"||(document.removeEventListener("clay:plugin-ready",n),document.removeEventListener("clay:plugin-failed",n),t())};document.addEventListener("clay:plugin-ready",n),document.addEventListener("clay:plugin-failed",n)})}async function q(e,t=typeof window<"u"?window.clay:null){let n=()=>document.dispatchEvent(new CustomEvent("clay:upgrade-requested",{detail:e}));return await I(t),p(t)?(t.menu.addItem({id:"upgrade",label:`Upgrade to version ${e.version}`,badge:!0,run:n}),"menu"):t&&typeof t.toastPersistent=="function"?(t.toastPersistent(P,"info",{actions:[{label:"Upgrade",onClick:n},{label:"Not now",onClick:()=>O(e.version)}]}),"notice"):null}var U=!1;async function E(e={}){if(U)return null;U=!0;let t=window.clay;await Promise.resolve(t&&t.loaded&&t.loaded.ui).catch(()=>{});let n=A({doc:e.doc||document,loc:e.loc||location});n&&k("checking",n.currentVersion);let{status:r,version:o,update:a}=await C(e).catch(()=>({status:"unknown",version:n&&n.currentVersion,update:null}));return a?(await q(a),a):(r!=="none"&&await k(r,o),null)}async function J(e,t){return(await import("../c-
|
|
1
|
+
import{a as f,b as v}from"../c-3G2DGZUP.js";import"../c-VHNSBD2M.js";var $="hha:upgrade-check:",M=1440*60*1e3,S="upgrade-dismissed",P="A new version of this template is available.";function b(e,t){let n=e.querySelector(`meta[name="${t}"]`),r=n?n.getAttribute("content"):null;return r&&r.trim()?r.trim():null}function T(e){try{let t=globalThis.localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}}function j(e,t){try{globalThis.localStorage.setItem(e,JSON.stringify(t))}catch{}}async function x(e){let t=globalThis.crypto&&globalThis.crypto.subtle;if(!t)return null;let n=await t.digest("SHA-256",e);return[...new Uint8Array(n)].map(r=>r.toString(16).padStart(2,"0")).join("")}async function L(e,t){try{let n=await e(t,{credentials:"omit"});return n.ok?n:null}catch{return null}}async function N(e,t,{fetchFn:n,now:r}){let o=new URL(e);o.pathname=o.pathname.replace(/\.html$/,".json");let a=`${$}${o.href}:${t}`,u=T(a);if(u&&typeof u.checkedAt=="number"&&r-u.checkedAt<M)return{latest:u.latest,latestUrl:o};let i=await L(n,o.href);if(!i)return{latest:null,latestUrl:o};let c=null;try{c=await i.json()}catch{return{latest:null,latestUrl:o}}return j(a,{checkedAt:r,latest:c}),{latest:c,latestUrl:o}}function A({doc:e,loc:t}){let n=typeof window<"u"&&window.clay||{};if(!n.canEdit||n.isDraftMode)return null;let r=b(e,"hyper-source"),o=b(e,"hyper-version");if(!r||!o)return null;let a;try{a=new URL(r,t?t.href:void 0)}catch{return null}return!a.pathname.endsWith(".html")||t&&a.origin===t.origin&&a.pathname===t.pathname?null:{source:a,currentVersion:o}}async function C({doc:e=document,loc:t=location,fetchFn:n=(o,a)=>fetch(o,a),now:r=Date.now()}={}){let o=A({doc:e,loc:t});if(!o)return{status:"none",version:null,update:null};let{source:a,currentVersion:u}=o,i=(R,V=null)=>({status:R,version:u,update:V}),c=new URL(a.href);c.pathname=c.pathname.replace(/\.html$/,".json");let{latest:s}=await N(a.href,u,{fetchFn:n,now:r});if(!s||typeof s!="object"||typeof s.version!="string"||!f(s.version)||!f(u))return i("unknown");if(!v(s.version,u))return i("current");let h=typeof window<"u"&&window.clay||{},w=h.storage&&h.storage.local;if(w&&w.get(S)===s.version||typeof s.html!="string"||!s.html)return i("unknown");let m=new URL(s.html,c).href,y=await L(n,m);if(!y)return i("unknown");let g;try{g=await y.arrayBuffer()}catch{return i("unknown")}let d=await x(g);return!d||d!==String(s.sha256||"").toLowerCase()?i("unknown"):i("update",{version:s.version,html:m,sha256:d,latestUrl:c.href})}async function H(e){return(await C(e)).update}async function k(e,t){let n=window.clay;if(await I(n),!p(n)||!t)return;let r=e==="current"?"File at latest version":`Version ${t}`;n.menu.addItem({id:"upgrade",label:r,text:!0})}function O(e){let t=window.clay,n=t&&t.storage&&t.storage.local;n&&n.set(S,e)}function D(e){return!!(e&&Array.isArray(e.plugins)&&e.plugins.includes("menu"))}function p(e){return!!(e&&e.menu&&typeof e.menu.addItem=="function")}function I(e){return p(e)||!D(e)?Promise.resolve():new Promise(t=>{let n=r=>{!r.detail||r.detail.plugin!=="menu"||(document.removeEventListener("clay:plugin-ready",n),document.removeEventListener("clay:plugin-failed",n),t())};document.addEventListener("clay:plugin-ready",n),document.addEventListener("clay:plugin-failed",n)})}async function q(e,t=typeof window<"u"?window.clay:null){let n=()=>document.dispatchEvent(new CustomEvent("clay:upgrade-requested",{detail:e}));return await I(t),p(t)?(t.menu.addItem({id:"upgrade",label:`Upgrade to version ${e.version}`,badge:!0,run:n}),"menu"):t&&typeof t.toastPersistent=="function"?(t.toastPersistent(P,"info",{actions:[{label:"Upgrade",onClick:n},{label:"Not now",onClick:()=>O(e.version)}]}),"notice"):null}var U=!1;async function E(e={}){if(U)return null;U=!0;let t=window.clay;await Promise.resolve(t&&t.loaded&&t.loaded.ui).catch(()=>{});let n=A({doc:e.doc||document,loc:e.loc||location});n&&k("checking",n.currentVersion);let{status:r,version:o,update:a}=await C(e).catch(()=>({status:"unknown",version:n&&n.currentVersion,update:null}));return a?(await q(a),a):(r!=="none"&&await k(r,o),null)}async function J(e,t){return(await import("../c-Y3MPVURA.js")).replace(e,t)}function B(e){import("../c-VU4WEWPH.js").then(t=>t.start(e.detail)).catch(t=>console.error("clayjs: the upgrade could not start:",t))}var l=typeof window<"u"?window.clay:null;if(l&&l.canEdit&&!l.isDraftMode){document.addEventListener("clay:upgrade-requested",B);let e=l.ready;e&&typeof e.then=="function"?e.then(()=>E(),()=>{}):E()}export{q as announce,C as checkUpdate,H as findUpdate,J as replace,E as start};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as he,b as me,c as ye}from"../c-Y6F2FORL.js";import{a as pe,b as F,c as ut}from"../c-HKSLOVU4.js";import{a as ge,b as we,c as ve,d as be}from"../c-OKEGUICD.js";import{b as fe}from"../c-QY7F6EN6.js";import{a as de}from"../c-VMXCX52Q.js";import"../c-4ASQPRQL.js";import"../c-GQ6F6IDK.js";import"../c-I2SCCUEW.js";import"../c-5VYOWDTI.js";import"../c-P73XPAOA.js";import"../c-ZPI7M5U5.js";import"../c-WYFDLITL.js";import"../c-UGHH4MB3.js";import"../c-MZCOGNZL.js";import"../c-MFB74XVN.js";import"../c-LD6UVV5R.js";import"../c-PGSBXHUE.js";import"../c-KU3PX7LL.js";import"../c-EQ5NBOGA.js";import"../c-IJUK2GPW.js";import{b as le,f as ue,h as Nt}from"../c-C7SUMNMI.js";import{d as oe}from"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import{d as vt,g as bt,h as ae,j as ie,l as rt,m as se,n as ce}from"../c-U4TWEIKZ.js";import"../c-PNZIJFG7.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-MOP5KBWZ.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";var xe="clay:visitor-drafts:",ke=1,Se=32,er=512*1024,rr=16*1024*1024,nr=()=>Math.random().toString(36).slice(2,10)+Math.random().toString(36).slice(2,6);function Ae(t){let r=2166136261;for(let n=0;n<t.length;n++)r=Math.imul(r^t.charCodeAt(n),16777619);return(r>>>0).toString(36)+"."+t.length.toString(36)}function Z(t=window.location.pathname){let n=String(t||"/").replace(/\/{2,}/g,"/").match(/^(.*?\/[^/]+\.(?:html|htmlclay))(?:\/|$)/i),c=n?n[1]:"/";return c.toLowerCase()==="/index.html"?"/":c}var Ut=t=>xe+t,Te=(t,r=Z())=>`${xe}${t}@${r}`;function Ot(){try{return window.localStorage}catch{return null}}var D=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);function or(t){let r=[];for(let n of t.matchAll(/([^.[\]]+)|\[(\d+)\]/g))r.push(n[2]!==void 0?Number(n[2]):n[1]);return r}function ar(t,r){let n=or(r),c=t;for(let i=0;i<n.length-1;i++)if(c=c?.[n[i]],c==null||typeof c!="object")return;c&&typeof c=="object"&&delete c[n[n.length-1]]}function _(t,r){return Array.isArray(t)?Array.isArray(r)&&r.length===t.length&&t.every((n,c)=>_(n,r[c])):D(t)?D(r)&&Object.keys(t).every(n=>_(t[n],r[n])):t===r}function z(t,r){return _(t,r)&&_(r,t)}var Me='script[type="application/json"][merge][clay~="live"]',Pt="article[data-blockeditor]",ir="[onbeforesave], [onbeforesnapshot]",Ee=t=>t==="blockeditor"||/^blockeditor\.\d+$/.test(t),Rt=t=>JSON.stringify(Object.keys(t).sort().map(r=>[r,t[r]]));function dt(t){let r=t.querySelectorAll(Pt);if(r.length!==1)return null;let n={};for(let c of t.querySelectorAll(Me))try{n[c.getAttribute("merge")]=JSON.parse(c.textContent)}catch{return null}return{live:n,blockeditor:{rev:r[0].getAttribute("data-rev")||"",html:r[0].innerHTML}}}var W=(t,r)=>!t||!r?t===r:t.blockeditor.rev===r.blockeditor.rev&&Rt(t.live)===Rt(r.live),Oe=t=>D(t?.live)&&D(t?.blockeditor)?`${t.blockeditor.rev}:${Ae(Rt(t.live))}`:null;function kt(t){if(!D(t?.live)||!D(t?.blockeditor))return null;let{live:r,blockeditor:n}=t;return!Object.keys(r).length||typeof n.rev!="string"||typeof n.html!="string"?null:{live:r,blockeditor:n}}var nt=t=>Array.isArray(t)&&t.every(r=>D(r)&&(typeof r.id=="string"||typeof r.id=="number"))&&new Set(t.map(r=>r.id)).size===t.length;function ft(t,r,n=!1){if(D(t)&&D(r)){let c={...t};for(let i of Object.keys(r))i in t?c[i]=ft(t[i],r[i]):n||(c[i]=r[i]);return c}if(nt(t)&&nt(r)){let c=new Map(r.map(i=>[i.id,i]));return t.map(i=>c.has(i.id)?ft(i,c.get(i.id)):i)}return t}var Ie=(t,r)=>t.length===r.length&&t.every((n,c)=>n===r[c]);function sr(t,r,n){let c=u=>new Map(u.map(d=>[d.id,d])),i=c(t),v=c(r),k=c(n),l=u=>u.filter(d=>i.has(d.id)&&v.has(d.id)&&k.has(d.id)).map(d=>d.id),x=l(t);if(!Ie(x,l(r))||!Ie(x,l(n)))return null;for(let[u,d]of i)if(v.has(u)&&!k.has(u)&&!z(v.get(u),d)||!v.has(u)&&k.has(u)&&!z(k.get(u),d))return null;let m=!1,a=[];for(let u of r){if(i.has(u.id)&&!k.has(u.id))continue;if(!k.has(u.id)){a.push(u);continue}let d=St(i.get(u.id),u,k.get(u.id),!0);m||=d.conflict,a.push(d.value)}return n.forEach((u,d)=>{if(i.has(u.id)||v.has(u.id))return;let A=0;for(let g=d-1;g>=0;g--){let j=a.findIndex(E=>E.id===n[g].id);if(j!==-1){A=j+1;break}}a.splice(A,0,u)}),{value:a,conflict:m}}function St(t,r,n,c){if(z(r,n)||z(n,t))return{value:r,conflict:!1};if(z(r,t))return{value:n,conflict:!1};if(D(r)&&D(n)){let i={},v=!1;for(let k of new Set([...Object.keys(r),...Object.keys(n)])){let l=St(D(t)?t[k]:void 0,r[k],n[k],c);v||=l.conflict,l.value!==void 0&&(i[k]=l.value)}return{value:i,conflict:v}}if(c&&nt(t)&&nt(r)&&nt(n)){let i=sr(t,r,n);if(i)return i}return{value:r,conflict:!0}}function Et(t,r=new Map){if(Array.isArray(t)){if(nt(t))for(let n of t)r.set(n.id,(r.get(n.id)||0)+1);for(let n of t)Et(n,r)}else if(D(t))for(let n of Object.values(t))Et(n,r);return r}function Le(t,r,n){let c=St(t,r,n,!0),i=Et(r);for(let[v,k]of Et(c.value))if(k>1&&k>(i.get(v)||0))return St(t,r,n,!1);return c}function B(t,r){rt(!0),t.dispatchEvent(new CustomEvent("clay:drafts-store-failed",{detail:{error:r}}));let n=new Error("Couldn't save in this browser. Storage is full or turned off.");return n.code="draft-storage",n}var De=t=>{try{return String(JSON.parse(t)?.savedAt??"")}catch{return""}};function je(t,{path:r=Z(),storage:n=Ot()}={}){let c=Ut(t),i=Te(t,r),v=i+":legacy";try{let k=n?.getItem(i),l=n?.getItem(c);if(l==null){let u=n?.getItem(c+":ui");return u!=null&&n.getItem(i+":ui")==null&&n.getItem(i+":ui-legacy")==null&&(n.setItem(i+":ui",u),n.setItem(i+":ui-legacy","1")),"none"}let x=De(l),m=n.getItem(v);if(m===x)return"none";let a=n.getItem(i);if(a!==k)return"none";if(a==null||m!=null&&De(a)===m?n.setItem(i,l):a!==l&&(n.setItem(i+":conflict",l),console.warn("visitor-drafts: an older tab changed this draft after it moved; its copy was kept under",i+":conflict")),m==null){let u=n.getItem(c+":ui");u!=null&&n.getItem(i+":ui")==null&&n.setItem(i+":ui",u)}return n.setItem(v,x),"copied"}catch{return"failed"}}function cr(t){if(!D(t)||!("site"in t))return t;let{site:r,...n}=t;return n}function Ce({doc:t=document,storage:r=Ot(),gate:n=bt,now:c=()=>new Date,path:i=Z(),fallback:v=null,slotLimit:k=er,pendingLimit:l=rr}={}){let x=vt(t),m=Te(x,i),a=cr(pe.findRulesIn(t,"api").rules),u=null,d=null,A=null,g=null,j=!0,E=null,L=!1,U=null,$,T=null,M=null,Y=()=>{$===void 0&&($=dt(t))};function X(e){return e?(Y(),$?e.blockeditor.rev!==$.blockeditor.rev||Object.keys(e.live).some(s=>!Ee(s)&&JSON.stringify(e.live[s])!==JSON.stringify($.live[s]))||T||M?e:null:e):null}function Q(e){if(t.querySelector(Pt)||t.readyState!=="loading")return e();t.addEventListener("DOMContentLoaded",e,{once:!0})}function ot(e){Y();let o=t.querySelector(Pt);if(!o)return!1;let s=new Map([...t.querySelectorAll(Me)].map(h=>[h.getAttribute("merge"),h]));for(let[h,w]of s)Ee(h)&&!(h in e.live)&&w.remove();for(let[h,w]of Object.entries(e.live)){let S=s.get(h);S||(S=t.createElement("script"),S.setAttribute("type","application/json"),S.setAttribute("merge",h),S.setAttribute("clay","live"),o.parentNode.insertBefore(S,o)),S.textContent=JSON.stringify(w).replace(/</g,"\\u003c")}return!0}let R=nr,at=m+":reset";function it(){try{return"root:"+(r?.getItem(at)??"")}catch{return"root:"}}let mt=e=>"legacy:"+Ae(e);function Dt(e,o){return e?e.id?Array.isArray(e.ancestry)?[e.id,...e.ancestry].slice(0,Se):null:[mt(o)]:null}function yt(e){if(!U||U.raw!==u||!U.ancestry||!e?.id||e.id===U.id)return!1;let o=e.ancestry;return!Array.isArray(o)||o.includes(U.id)?!1:o.includes(U.ancestry[0])||o.length>=Se}function f(){try{if(!r)return null;let e=r.getItem(m);return e==null&&v?r.getItem(v):e}catch{return null}}function O(e){try{let o=JSON.parse(e);if(D(o)&&o.v===ke&&D(o.data))return o}catch{}return null}function I(){let e=f();return e==null?null:{raw:e,record:O(e)}}function H(){return F(t,a)}function Ke(){let e=window.clay?.getHTML;return typeof e!="function"?H():F(new DOMParser().parseFromString(e.call(window.clay),"text/html"),a)}function Bt(){try{if(typeof r.keys=="function")return r.keys();let e=[];for(let o=0;o<r.length;o++)e.push(r.key(o));return e}catch{return[]}}function Be(){try{return JSON.stringify(Ke())}catch{return null}}function tt(e,{keepSlot:o=!1}={}){let s=Bt().find(w=>w.startsWith(m+":unreadable:")&&r.getItem(w)===e);if(s){if(E=null,!o)try{r.removeItem(m)}catch{}return s}let h=m+":unreadable:"+c().toISOString();try{r.setItem(h,e)}catch{return E=e,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(E=null,!o)try{r.removeItem(m)}catch{}return console.warn(o?"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",h),h}function $t(e){let o=ft(JSON.parse(JSON.stringify(e)),H(),!0),s=[];for(let h=0;h<4;h++){let w=t.cloneNode(!0);try{ut(w,o,a)}catch(C){let et=C?.details?.unknownKeys??C?.unknownKeys;if(Array.isArray(et)&&et.length){for(let q of et)ar(o,q);continue}let ct=Object.keys(o).filter(q=>{try{return ut(t.cloneNode(!0),{[q]:o[q]},a),!1}catch{return!0}});if(!ct.length)return null;for(let q of ct)delete o[q];s.push(...ct);continue}let S=F(w,a),b=Object.keys(o).filter(C=>!_(o[C],S[C]));if(!b.length)return{data:o,dropped:s};for(let C of b)delete o[C];s.push(...b)}return null}function xt({raw:e,record:o}){let s=tt(e);return s||(u=e),d=H(),g=o?.data??d,s?{restored:!1,hadDraft:!0,parked:!0}:{restored:!1,hadDraft:!0,parked:!1,blocked:!0}}let Jt=()=>A??=H();function $e(e=I()){if(Jt(),!e)return d=g=A,Q(Y),{restored:!1,hadDraft:!1};if(j=!1,!e.record)return xt(e);let o=kt(e.record),s=Object.keys(e.record.data).length>0,h=s?$t(e.record.data):{data:{},dropped:[]},w=!!h&&(!s||Object.keys(h.data).length>0);if(!o&&!w||!o&&!s)return xt(e);if(s&&w&&ut(t,h.data,a),o&&(Q(()=>{ot(o)||(console.warn("visitor-drafts: this browser's saved page has no page to go into; it was kept aside"),tt(e.raw,{keepSlot:!0}))}),T=o,M=o),u=e.raw,d=H(),g=e.record.data,!w||h.dropped.length){let S=tt(e.raw,{keepSlot:!0});return{restored:!0,hadDraft:!0,data:w?h.data:{},partial:!0,parked:!!S,blocked:!S}}return{restored:!0,hadDraft:!0,data:h.data}}function st(){if(L)return!1;try{let e=window.clay?.getHTML;if(typeof e!="function")return!_(H(),d);let o=new DOMParser().parseFromString(e.call(window.clay),"text/html"),s=X(dt(o));return!_(F(o,a),d)||!W(s,T)&&!W(s,M)}catch{return!0}}function Ft(e){let o=m+":conflict";try{r.setItem(o,e)}catch(s){throw B(t,s)}console.warn("visitor-drafts: another tab changed the same thing; its copy was kept under",o)}function Je(e){let o=f(),s=o==null?null:O(o);if(!s)return{data:e,stored:null,ancestry:[it()],parentData:d};let h=e;if(o!==u){let w=Le(yt(s)?U.parentData:d,e,s.data);w.conflict&&Ft(o),h=w.value}return h=ft(h,s.data),{data:h,stored:z(h,s.data)?o:null,ancestry:Dt(s,o),parentData:s.data}}function At(e){let o=$t(e);if(!o||!Object.keys(o.data).length)return null;ut(t,o.data,a);try{window.Sap?.refresh?.()}catch{}return t.dispatchEvent(new CustomEvent("clay:drafts-restored",{detail:{restored:!0,hadDraft:!0,parked:!1,external:!0}})),o.data}let p={id:R(),reset:"",acked:0,seq:0,journaled:0,ops:[],sizes:[]};try{p.reset=r?.getItem(at)??""}catch{}try{let e=JSON.parse(window.sessionStorage.getItem(m+":generation"));e?.marker===p.reset&&typeof e.reset=="string"&&(p.reset=e.reset)}catch{}let Tt=`${m}:op:${p.id}`,zt=()=>({tab:p.id,reset:p.reset,acked:p.acked,at:c().getTime(),ops:p.ops});function Mt(){try{if(!p.ops.length){p.journaled=p.seq,r.removeItem(Tt);return}let e=JSON.stringify(zt());if(e.length>k)return;r.setItem(Tt,e),p.journaled=p.seq}catch{}}let Vt=null,gt=null,Wt=e=>e===void 0?t:new DOMParser().parseFromString(e,"text/html");function Zt(e,{reset:o=p.reset,at:s=null}={}){if(L)return null;let h=Wt(e),w=Yt(F(h,a),X(dt(h)),o);return gt=s,w}function Gt(e=p.reset){if(L)return null;let o=n()?.token()??null;return Zt(window.clay.getHTML(),{reset:e,at:o})}function Fe(e=p.reset){if(L)return null;let o=gt!==null&&t.querySelector(ir)!==null&&n()?.unchangedSince(gt)===!0,s=Wt(window.clay?.getHTML?.());return Yt(o?d:F(s,a),X(dt(s)),e)}function Yt(e,o,s=p.reset){if(E!=null&&tt(E,{keepSlot:!0})===null)throw B(t,new Error("an earlier saved copy could not be kept aside"));if(p.sizes.reduce((b,C)=>b+C,0)>=l)throw B(t,new Error("too many changes are waiting to be saved"));let h=!W(o,T),w={};for(let b of Object.keys(e))b in d&&_(e[b],d[b])||(w[b]=b in g?{b:g[b],m:ft(e[b],g[b])}:{m:e[b]});if(!Object.keys(w).length&&!h)return p.ops.length||(rt(!1),t.dispatchEvent(new CustomEvent("clay:drafts-saved",{detail:{data:e,unchanged:!0}}))),null;p.ops.length||(Vt={base:d,editorUnit:T,seenUnit:M});let S={seq:++p.seq,savedAt:c().toISOString(),keys:w,...h&&{unit:{seen:Oe(M),to:o}}};d={...d},g={...g};for(let b of Object.keys(w))d[b]=e[b],g[b]=w[b].m;return h&&(T=M=o),j=!1,p.reset=s,p.ops.push(S),p.sizes.push(JSON.stringify(S).length),Mt(),S}function ze(){if(L)return!0;try{st()&&Gt()}catch{return!1}return p.journaled===p.seq}function Ve(e){if(e<=p.acked)return!1;p.acked=e;let o=p.ops.filter(s=>s.seq<=e).length;return p.ops.splice(0,o),p.sizes.splice(0,o),Mt(),o>0}function Xt(){p.ops.length=0,p.sizes.length=0,Mt()}function We(){p.ops.length&&({base:d,editorUnit:T,seenUnit:M}=Vt),gt=null,Xt()}function Ze(e){let o=Object.fromEntries(Object.entries(e).filter(([h,w])=>!z(w,g[h])));if(!Object.keys(o).length)return!1;let s=At(o);return g={...g,...o},s&&(d={...d,...s}),j=!1,!0}function Qt({keepPending:e=!1}={}){L=!0,e||Xt()}let te=()=>Bt().filter(e=>e.startsWith(m+":op:"));function ee(e){if(L)return null;if(E!=null&&tt(E,{keepSlot:!0})===null)throw B(t,new Error("an earlier saved copy could not be kept aside"));let o=new DOMParser().parseFromString(e,"text/html"),s=F(o,a),h=X(dt(o)),w=!W(h,T),S=f();if(_(s,d)&&!w&&(S===u||S==null))return rt(!1),t.dispatchEvent(new CustomEvent("clay:drafts-saved",{detail:{data:s,unchanged:!0}})),s;let{data:b,stored:C,ancestry:et,parentData:ct}=Je(s),q=S==null?null:O(S),Ct=kt(q),lt=w?h:q?Ct:h;w&&q&&!W(Ct,M)&&Ft(S);let re=R(),wt=C&&W(lt,Ct)?C:JSON.stringify({v:ke,savedAt:c().toISOString(),id:re,ancestry:et,reset:p.reset,data:b,...lt&&{live:lt.live,blockeditor:lt.blockeditor}});if(wt!==C){try{if(!r)throw new Error("no storage");r.setItem(m,wt)}catch(V){throw B(t,V)}U={id:re,ancestry:et,parentData:ct,raw:wt}}let ne=Object.keys(s).filter(V=>!_(s[V],b[V]));return ne.length&&At(Object.fromEntries(ne.map(V=>[V,b[V]]))),u=wt,d=b,w&&(T=h),(w||!q)&&(M=lt),rt(!1),t.dispatchEvent(new CustomEvent("clay:drafts-saved",{detail:{data:b}})),b}function jt(){try{return ee(window.clay.getHTML()),!0}catch{return!1}}function Ge(){return L||!st()?!0:jt()}function Ye(){if(L)return!1;let e=f();if(e==null&&u!=null&&!st())return L=!0,window.location.reload(),!0;if(e==null||e===u||st())return!1;let o=O(e);if(yt(o)&&typeof window.clay?.getHTML=="function")return jt();let s=o&&At(o.data);return!s&&!kt(o)?!1:(u=e,d={...d,...s||{}},!0)}function Xe(e){if(L)return null;if(e===void 0){let s=f();e=s==null?null:O(s)}let o=kt(e);return o&&!W(o,M)?o:null}function Qe(e){M=e}function tr(){Qt(),E=null,rt(!1);try{r.removeItem(m)}catch{}let e=/^(\d+)~/.exec(p.reset),o=e?Number(e[1]):p.reset===""?1:null;try{r.setItem(at,o===null?R():`${o+1}~${R()}`)}catch{}}return{slot:x,key:m,rules:a,read:I,restore:$e,write:ee,writeLive:jt,flush:Ge,changed:st,adoptExternal:Ye,externalUnit:Xe,adoptedUnit:Qe,park:tt,clear:tr,snapshot:Be,tab:p.id,slotKey:Tt,chain:zt,capture:Zt,captureNow:Gt,captureLate:Fe,keep:ze,acknowledge:Ve,release:We,take:Ze,stop:Qt,journalSlots:te,seed:Jt,servedUnit:()=>(Y(),$),fitsInto:_,same:z,merge3:Le,unitMark:Oe,newId:R,failed:e=>B(t,e),generation:()=>p.reset,enter:e=>{p.reset=e},fresh:()=>j,shown:()=>d!==null,pending:()=>p.ops.length,unsafe:()=>p.journaled<p.seq,stopped:()=>L,held(){try{let e=JSON.parse(f());return D(e)?e:null}catch{return null}},kept:()=>!!I()||p.ops.length>0||te().length>0}}function Ne(t,r){let n=`${t}:ui`,c=()=>({v:1,prompt:{},intro:{done:null},src:null}),i=c();try{let v=JSON.parse(r?.getItem(n)||"null");v&&typeof v=="object"&&v.v===1&&(i={...c(),...v})}catch{}return{get:()=>i,save(){try{r?.setItem(n,JSON.stringify(i))}catch{}},reset(){i=c();try{r?.removeItem(n)}catch{}}}}var lr=/^[a-z0-9][a-z0-9-]{0,39}$/;function Pe(t,r=window.location.search){let n=t.get(),c=null;try{c=new URLSearchParams(r).get("src")}catch{}return!n.src&&c&&lr.test(c)&&(n.src=c,t.save()),n.src}function Re(t,r=window.location){let n=Z(r.pathname);return`/_/download${n==="/"?"":n}?as=htmlclay${t?`&src=${encodeURIComponent(t)}`:""}`}var ur=`<aside class="hcp" id="hcp" hidden aria-label="Download this app" data-hcp-state="tab" data-hcp-reason="open" sap-ignore clay="editor-ui">
|
|
1
|
+
import{a as he,b as me,c as ye}from"../c-Y6F2FORL.js";import{a as pe,b as F,c as ut}from"../c-Y6HH7LTM.js";import{a as ge,b as we,c as ve,d as be}from"../c-OKEGUICD.js";import{b as fe}from"../c-QY7F6EN6.js";import{a as de}from"../c-FC5RUFPR.js";import"../c-4ASQPRQL.js";import"../c-GQ6F6IDK.js";import"../c-I2SCCUEW.js";import"../c-5VYOWDTI.js";import"../c-P73XPAOA.js";import"../c-ZPI7M5U5.js";import"../c-WYFDLITL.js";import"../c-UGHH4MB3.js";import"../c-MZCOGNZL.js";import"../c-EHAR4RJJ.js";import"../c-LD6UVV5R.js";import"../c-PGSBXHUE.js";import"../c-KU3PX7LL.js";import"../c-EQ5NBOGA.js";import"../c-IJUK2GPW.js";import{b as le,f as ue,h as Nt}from"../c-C7SUMNMI.js";import{d as oe}from"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import{d as vt,g as bt,h as ae,j as ie,l as rt,m as se,n as ce}from"../c-U4TWEIKZ.js";import"../c-UW6MMZ4V.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-MOP5KBWZ.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";var xe="clay:visitor-drafts:",ke=1,Se=32,er=512*1024,rr=16*1024*1024,nr=()=>Math.random().toString(36).slice(2,10)+Math.random().toString(36).slice(2,6);function Ae(t){let r=2166136261;for(let n=0;n<t.length;n++)r=Math.imul(r^t.charCodeAt(n),16777619);return(r>>>0).toString(36)+"."+t.length.toString(36)}function Z(t=window.location.pathname){let n=String(t||"/").replace(/\/{2,}/g,"/").match(/^(.*?\/[^/]+\.(?:html|htmlclay))(?:\/|$)/i),c=n?n[1]:"/";return c.toLowerCase()==="/index.html"?"/":c}var Ut=t=>xe+t,Te=(t,r=Z())=>`${xe}${t}@${r}`;function Ot(){try{return window.localStorage}catch{return null}}var D=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);function or(t){let r=[];for(let n of t.matchAll(/([^.[\]]+)|\[(\d+)\]/g))r.push(n[2]!==void 0?Number(n[2]):n[1]);return r}function ar(t,r){let n=or(r),c=t;for(let i=0;i<n.length-1;i++)if(c=c?.[n[i]],c==null||typeof c!="object")return;c&&typeof c=="object"&&delete c[n[n.length-1]]}function _(t,r){return Array.isArray(t)?Array.isArray(r)&&r.length===t.length&&t.every((n,c)=>_(n,r[c])):D(t)?D(r)&&Object.keys(t).every(n=>_(t[n],r[n])):t===r}function z(t,r){return _(t,r)&&_(r,t)}var Me='script[type="application/json"][merge][clay~="live"]',Pt="article[data-blockeditor]",ir="[onbeforesave], [onbeforesnapshot]",Ee=t=>t==="blockeditor"||/^blockeditor\.\d+$/.test(t),Rt=t=>JSON.stringify(Object.keys(t).sort().map(r=>[r,t[r]]));function dt(t){let r=t.querySelectorAll(Pt);if(r.length!==1)return null;let n={};for(let c of t.querySelectorAll(Me))try{n[c.getAttribute("merge")]=JSON.parse(c.textContent)}catch{return null}return{live:n,blockeditor:{rev:r[0].getAttribute("data-rev")||"",html:r[0].innerHTML}}}var W=(t,r)=>!t||!r?t===r:t.blockeditor.rev===r.blockeditor.rev&&Rt(t.live)===Rt(r.live),Oe=t=>D(t?.live)&&D(t?.blockeditor)?`${t.blockeditor.rev}:${Ae(Rt(t.live))}`:null;function kt(t){if(!D(t?.live)||!D(t?.blockeditor))return null;let{live:r,blockeditor:n}=t;return!Object.keys(r).length||typeof n.rev!="string"||typeof n.html!="string"?null:{live:r,blockeditor:n}}var nt=t=>Array.isArray(t)&&t.every(r=>D(r)&&(typeof r.id=="string"||typeof r.id=="number"))&&new Set(t.map(r=>r.id)).size===t.length;function ft(t,r,n=!1){if(D(t)&&D(r)){let c={...t};for(let i of Object.keys(r))i in t?c[i]=ft(t[i],r[i]):n||(c[i]=r[i]);return c}if(nt(t)&&nt(r)){let c=new Map(r.map(i=>[i.id,i]));return t.map(i=>c.has(i.id)?ft(i,c.get(i.id)):i)}return t}var Ie=(t,r)=>t.length===r.length&&t.every((n,c)=>n===r[c]);function sr(t,r,n){let c=u=>new Map(u.map(d=>[d.id,d])),i=c(t),v=c(r),k=c(n),l=u=>u.filter(d=>i.has(d.id)&&v.has(d.id)&&k.has(d.id)).map(d=>d.id),x=l(t);if(!Ie(x,l(r))||!Ie(x,l(n)))return null;for(let[u,d]of i)if(v.has(u)&&!k.has(u)&&!z(v.get(u),d)||!v.has(u)&&k.has(u)&&!z(k.get(u),d))return null;let m=!1,a=[];for(let u of r){if(i.has(u.id)&&!k.has(u.id))continue;if(!k.has(u.id)){a.push(u);continue}let d=St(i.get(u.id),u,k.get(u.id),!0);m||=d.conflict,a.push(d.value)}return n.forEach((u,d)=>{if(i.has(u.id)||v.has(u.id))return;let A=0;for(let g=d-1;g>=0;g--){let j=a.findIndex(E=>E.id===n[g].id);if(j!==-1){A=j+1;break}}a.splice(A,0,u)}),{value:a,conflict:m}}function St(t,r,n,c){if(z(r,n)||z(n,t))return{value:r,conflict:!1};if(z(r,t))return{value:n,conflict:!1};if(D(r)&&D(n)){let i={},v=!1;for(let k of new Set([...Object.keys(r),...Object.keys(n)])){let l=St(D(t)?t[k]:void 0,r[k],n[k],c);v||=l.conflict,l.value!==void 0&&(i[k]=l.value)}return{value:i,conflict:v}}if(c&&nt(t)&&nt(r)&&nt(n)){let i=sr(t,r,n);if(i)return i}return{value:r,conflict:!0}}function Et(t,r=new Map){if(Array.isArray(t)){if(nt(t))for(let n of t)r.set(n.id,(r.get(n.id)||0)+1);for(let n of t)Et(n,r)}else if(D(t))for(let n of Object.values(t))Et(n,r);return r}function Le(t,r,n){let c=St(t,r,n,!0),i=Et(r);for(let[v,k]of Et(c.value))if(k>1&&k>(i.get(v)||0))return St(t,r,n,!1);return c}function B(t,r){rt(!0),t.dispatchEvent(new CustomEvent("clay:drafts-store-failed",{detail:{error:r}}));let n=new Error("Couldn't save in this browser. Storage is full or turned off.");return n.code="draft-storage",n}var De=t=>{try{return String(JSON.parse(t)?.savedAt??"")}catch{return""}};function je(t,{path:r=Z(),storage:n=Ot()}={}){let c=Ut(t),i=Te(t,r),v=i+":legacy";try{let k=n?.getItem(i),l=n?.getItem(c);if(l==null){let u=n?.getItem(c+":ui");return u!=null&&n.getItem(i+":ui")==null&&n.getItem(i+":ui-legacy")==null&&(n.setItem(i+":ui",u),n.setItem(i+":ui-legacy","1")),"none"}let x=De(l),m=n.getItem(v);if(m===x)return"none";let a=n.getItem(i);if(a!==k)return"none";if(a==null||m!=null&&De(a)===m?n.setItem(i,l):a!==l&&(n.setItem(i+":conflict",l),console.warn("visitor-drafts: an older tab changed this draft after it moved; its copy was kept under",i+":conflict")),m==null){let u=n.getItem(c+":ui");u!=null&&n.getItem(i+":ui")==null&&n.setItem(i+":ui",u)}return n.setItem(v,x),"copied"}catch{return"failed"}}function cr(t){if(!D(t)||!("site"in t))return t;let{site:r,...n}=t;return n}function Ce({doc:t=document,storage:r=Ot(),gate:n=bt,now:c=()=>new Date,path:i=Z(),fallback:v=null,slotLimit:k=er,pendingLimit:l=rr}={}){let x=vt(t),m=Te(x,i),a=cr(pe.findRulesIn(t,"api").rules),u=null,d=null,A=null,g=null,j=!0,E=null,L=!1,U=null,$,T=null,M=null,Y=()=>{$===void 0&&($=dt(t))};function X(e){return e?(Y(),$?e.blockeditor.rev!==$.blockeditor.rev||Object.keys(e.live).some(s=>!Ee(s)&&JSON.stringify(e.live[s])!==JSON.stringify($.live[s]))||T||M?e:null:e):null}function Q(e){if(t.querySelector(Pt)||t.readyState!=="loading")return e();t.addEventListener("DOMContentLoaded",e,{once:!0})}function ot(e){Y();let o=t.querySelector(Pt);if(!o)return!1;let s=new Map([...t.querySelectorAll(Me)].map(h=>[h.getAttribute("merge"),h]));for(let[h,w]of s)Ee(h)&&!(h in e.live)&&w.remove();for(let[h,w]of Object.entries(e.live)){let S=s.get(h);S||(S=t.createElement("script"),S.setAttribute("type","application/json"),S.setAttribute("merge",h),S.setAttribute("clay","live"),o.parentNode.insertBefore(S,o)),S.textContent=JSON.stringify(w).replace(/</g,"\\u003c")}return!0}let R=nr,at=m+":reset";function it(){try{return"root:"+(r?.getItem(at)??"")}catch{return"root:"}}let mt=e=>"legacy:"+Ae(e);function Dt(e,o){return e?e.id?Array.isArray(e.ancestry)?[e.id,...e.ancestry].slice(0,Se):null:[mt(o)]:null}function yt(e){if(!U||U.raw!==u||!U.ancestry||!e?.id||e.id===U.id)return!1;let o=e.ancestry;return!Array.isArray(o)||o.includes(U.id)?!1:o.includes(U.ancestry[0])||o.length>=Se}function f(){try{if(!r)return null;let e=r.getItem(m);return e==null&&v?r.getItem(v):e}catch{return null}}function O(e){try{let o=JSON.parse(e);if(D(o)&&o.v===ke&&D(o.data))return o}catch{}return null}function I(){let e=f();return e==null?null:{raw:e,record:O(e)}}function H(){return F(t,a)}function Ke(){let e=window.clay?.getHTML;return typeof e!="function"?H():F(new DOMParser().parseFromString(e.call(window.clay),"text/html"),a)}function Bt(){try{if(typeof r.keys=="function")return r.keys();let e=[];for(let o=0;o<r.length;o++)e.push(r.key(o));return e}catch{return[]}}function Be(){try{return JSON.stringify(Ke())}catch{return null}}function tt(e,{keepSlot:o=!1}={}){let s=Bt().find(w=>w.startsWith(m+":unreadable:")&&r.getItem(w)===e);if(s){if(E=null,!o)try{r.removeItem(m)}catch{}return s}let h=m+":unreadable:"+c().toISOString();try{r.setItem(h,e)}catch{return E=e,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(E=null,!o)try{r.removeItem(m)}catch{}return console.warn(o?"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",h),h}function $t(e){let o=ft(JSON.parse(JSON.stringify(e)),H(),!0),s=[];for(let h=0;h<4;h++){let w=t.cloneNode(!0);try{ut(w,o,a)}catch(C){let et=C?.details?.unknownKeys??C?.unknownKeys;if(Array.isArray(et)&&et.length){for(let q of et)ar(o,q);continue}let ct=Object.keys(o).filter(q=>{try{return ut(t.cloneNode(!0),{[q]:o[q]},a),!1}catch{return!0}});if(!ct.length)return null;for(let q of ct)delete o[q];s.push(...ct);continue}let S=F(w,a),b=Object.keys(o).filter(C=>!_(o[C],S[C]));if(!b.length)return{data:o,dropped:s};for(let C of b)delete o[C];s.push(...b)}return null}function xt({raw:e,record:o}){let s=tt(e);return s||(u=e),d=H(),g=o?.data??d,s?{restored:!1,hadDraft:!0,parked:!0}:{restored:!1,hadDraft:!0,parked:!1,blocked:!0}}let Jt=()=>A??=H();function $e(e=I()){if(Jt(),!e)return d=g=A,Q(Y),{restored:!1,hadDraft:!1};if(j=!1,!e.record)return xt(e);let o=kt(e.record),s=Object.keys(e.record.data).length>0,h=s?$t(e.record.data):{data:{},dropped:[]},w=!!h&&(!s||Object.keys(h.data).length>0);if(!o&&!w||!o&&!s)return xt(e);if(s&&w&&ut(t,h.data,a),o&&(Q(()=>{ot(o)||(console.warn("visitor-drafts: this browser's saved page has no page to go into; it was kept aside"),tt(e.raw,{keepSlot:!0}))}),T=o,M=o),u=e.raw,d=H(),g=e.record.data,!w||h.dropped.length){let S=tt(e.raw,{keepSlot:!0});return{restored:!0,hadDraft:!0,data:w?h.data:{},partial:!0,parked:!!S,blocked:!S}}return{restored:!0,hadDraft:!0,data:h.data}}function st(){if(L)return!1;try{let e=window.clay?.getHTML;if(typeof e!="function")return!_(H(),d);let o=new DOMParser().parseFromString(e.call(window.clay),"text/html"),s=X(dt(o));return!_(F(o,a),d)||!W(s,T)&&!W(s,M)}catch{return!0}}function Ft(e){let o=m+":conflict";try{r.setItem(o,e)}catch(s){throw B(t,s)}console.warn("visitor-drafts: another tab changed the same thing; its copy was kept under",o)}function Je(e){let o=f(),s=o==null?null:O(o);if(!s)return{data:e,stored:null,ancestry:[it()],parentData:d};let h=e;if(o!==u){let w=Le(yt(s)?U.parentData:d,e,s.data);w.conflict&&Ft(o),h=w.value}return h=ft(h,s.data),{data:h,stored:z(h,s.data)?o:null,ancestry:Dt(s,o),parentData:s.data}}function At(e){let o=$t(e);if(!o||!Object.keys(o.data).length)return null;ut(t,o.data,a);try{window.Sap?.refresh?.()}catch{}return t.dispatchEvent(new CustomEvent("clay:drafts-restored",{detail:{restored:!0,hadDraft:!0,parked:!1,external:!0}})),o.data}let p={id:R(),reset:"",acked:0,seq:0,journaled:0,ops:[],sizes:[]};try{p.reset=r?.getItem(at)??""}catch{}try{let e=JSON.parse(window.sessionStorage.getItem(m+":generation"));e?.marker===p.reset&&typeof e.reset=="string"&&(p.reset=e.reset)}catch{}let Tt=`${m}:op:${p.id}`,zt=()=>({tab:p.id,reset:p.reset,acked:p.acked,at:c().getTime(),ops:p.ops});function Mt(){try{if(!p.ops.length){p.journaled=p.seq,r.removeItem(Tt);return}let e=JSON.stringify(zt());if(e.length>k)return;r.setItem(Tt,e),p.journaled=p.seq}catch{}}let Vt=null,gt=null,Wt=e=>e===void 0?t:new DOMParser().parseFromString(e,"text/html");function Zt(e,{reset:o=p.reset,at:s=null}={}){if(L)return null;let h=Wt(e),w=Yt(F(h,a),X(dt(h)),o);return gt=s,w}function Gt(e=p.reset){if(L)return null;let o=n()?.token()??null;return Zt(window.clay.getHTML(),{reset:e,at:o})}function Fe(e=p.reset){if(L)return null;let o=gt!==null&&t.querySelector(ir)!==null&&n()?.unchangedSince(gt)===!0,s=Wt(window.clay?.getHTML?.());return Yt(o?d:F(s,a),X(dt(s)),e)}function Yt(e,o,s=p.reset){if(E!=null&&tt(E,{keepSlot:!0})===null)throw B(t,new Error("an earlier saved copy could not be kept aside"));if(p.sizes.reduce((b,C)=>b+C,0)>=l)throw B(t,new Error("too many changes are waiting to be saved"));let h=!W(o,T),w={};for(let b of Object.keys(e))b in d&&_(e[b],d[b])||(w[b]=b in g?{b:g[b],m:ft(e[b],g[b])}:{m:e[b]});if(!Object.keys(w).length&&!h)return p.ops.length||(rt(!1),t.dispatchEvent(new CustomEvent("clay:drafts-saved",{detail:{data:e,unchanged:!0}}))),null;p.ops.length||(Vt={base:d,editorUnit:T,seenUnit:M});let S={seq:++p.seq,savedAt:c().toISOString(),keys:w,...h&&{unit:{seen:Oe(M),to:o}}};d={...d},g={...g};for(let b of Object.keys(w))d[b]=e[b],g[b]=w[b].m;return h&&(T=M=o),j=!1,p.reset=s,p.ops.push(S),p.sizes.push(JSON.stringify(S).length),Mt(),S}function ze(){if(L)return!0;try{st()&&Gt()}catch{return!1}return p.journaled===p.seq}function Ve(e){if(e<=p.acked)return!1;p.acked=e;let o=p.ops.filter(s=>s.seq<=e).length;return p.ops.splice(0,o),p.sizes.splice(0,o),Mt(),o>0}function Xt(){p.ops.length=0,p.sizes.length=0,Mt()}function We(){p.ops.length&&({base:d,editorUnit:T,seenUnit:M}=Vt),gt=null,Xt()}function Ze(e){let o=Object.fromEntries(Object.entries(e).filter(([h,w])=>!z(w,g[h])));if(!Object.keys(o).length)return!1;let s=At(o);return g={...g,...o},s&&(d={...d,...s}),j=!1,!0}function Qt({keepPending:e=!1}={}){L=!0,e||Xt()}let te=()=>Bt().filter(e=>e.startsWith(m+":op:"));function ee(e){if(L)return null;if(E!=null&&tt(E,{keepSlot:!0})===null)throw B(t,new Error("an earlier saved copy could not be kept aside"));let o=new DOMParser().parseFromString(e,"text/html"),s=F(o,a),h=X(dt(o)),w=!W(h,T),S=f();if(_(s,d)&&!w&&(S===u||S==null))return rt(!1),t.dispatchEvent(new CustomEvent("clay:drafts-saved",{detail:{data:s,unchanged:!0}})),s;let{data:b,stored:C,ancestry:et,parentData:ct}=Je(s),q=S==null?null:O(S),Ct=kt(q),lt=w?h:q?Ct:h;w&&q&&!W(Ct,M)&&Ft(S);let re=R(),wt=C&&W(lt,Ct)?C:JSON.stringify({v:ke,savedAt:c().toISOString(),id:re,ancestry:et,reset:p.reset,data:b,...lt&&{live:lt.live,blockeditor:lt.blockeditor}});if(wt!==C){try{if(!r)throw new Error("no storage");r.setItem(m,wt)}catch(V){throw B(t,V)}U={id:re,ancestry:et,parentData:ct,raw:wt}}let ne=Object.keys(s).filter(V=>!_(s[V],b[V]));return ne.length&&At(Object.fromEntries(ne.map(V=>[V,b[V]]))),u=wt,d=b,w&&(T=h),(w||!q)&&(M=lt),rt(!1),t.dispatchEvent(new CustomEvent("clay:drafts-saved",{detail:{data:b}})),b}function jt(){try{return ee(window.clay.getHTML()),!0}catch{return!1}}function Ge(){return L||!st()?!0:jt()}function Ye(){if(L)return!1;let e=f();if(e==null&&u!=null&&!st())return L=!0,window.location.reload(),!0;if(e==null||e===u||st())return!1;let o=O(e);if(yt(o)&&typeof window.clay?.getHTML=="function")return jt();let s=o&&At(o.data);return!s&&!kt(o)?!1:(u=e,d={...d,...s||{}},!0)}function Xe(e){if(L)return null;if(e===void 0){let s=f();e=s==null?null:O(s)}let o=kt(e);return o&&!W(o,M)?o:null}function Qe(e){M=e}function tr(){Qt(),E=null,rt(!1);try{r.removeItem(m)}catch{}let e=/^(\d+)~/.exec(p.reset),o=e?Number(e[1]):p.reset===""?1:null;try{r.setItem(at,o===null?R():`${o+1}~${R()}`)}catch{}}return{slot:x,key:m,rules:a,read:I,restore:$e,write:ee,writeLive:jt,flush:Ge,changed:st,adoptExternal:Ye,externalUnit:Xe,adoptedUnit:Qe,park:tt,clear:tr,snapshot:Be,tab:p.id,slotKey:Tt,chain:zt,capture:Zt,captureNow:Gt,captureLate:Fe,keep:ze,acknowledge:Ve,release:We,take:Ze,stop:Qt,journalSlots:te,seed:Jt,servedUnit:()=>(Y(),$),fitsInto:_,same:z,merge3:Le,unitMark:Oe,newId:R,failed:e=>B(t,e),generation:()=>p.reset,enter:e=>{p.reset=e},fresh:()=>j,shown:()=>d!==null,pending:()=>p.ops.length,unsafe:()=>p.journaled<p.seq,stopped:()=>L,held(){try{let e=JSON.parse(f());return D(e)?e:null}catch{return null}},kept:()=>!!I()||p.ops.length>0||te().length>0}}function Ne(t,r){let n=`${t}:ui`,c=()=>({v:1,prompt:{},intro:{done:null},src:null}),i=c();try{let v=JSON.parse(r?.getItem(n)||"null");v&&typeof v=="object"&&v.v===1&&(i={...c(),...v})}catch{}return{get:()=>i,save(){try{r?.setItem(n,JSON.stringify(i))}catch{}},reset(){i=c();try{r?.removeItem(n)}catch{}}}}var lr=/^[a-z0-9][a-z0-9-]{0,39}$/;function Pe(t,r=window.location.search){let n=t.get(),c=null;try{c=new URLSearchParams(r).get("src")}catch{}return!n.src&&c&&lr.test(c)&&(n.src=c,t.save()),n.src}function Re(t,r=window.location){let n=Z(r.pathname);return`/_/download${n==="/"?"":n}?as=htmlclay${t?`&src=${encodeURIComponent(t)}`:""}`}var ur=`<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
2
|
<section class="hcp-card" id="hcp-card" role="dialog" aria-modal="false" aria-labelledby="hcp-title">
|
|
3
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
4
|
<div class="hcp-kicker">Free download</div>
|
|
@@ -17,4 +17,4 @@ import{a as he,b as me,c as ye}from"../c-Y6F2FORL.js";import{a as pe,b as F,c as
|
|
|
17
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
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
19
|
</div>
|
|
20
|
-
</aside>`;async function Ue({memory:t,appName:r,link:n,settle:c,canDownloadCurrent:i=()=>!0}){let{PROMPT_CSS:v}=await import("../c-SGIA4IEQ.js"),l=document.querySelector('clay-editor-ui[data-clay-ui="download-prompt"]')?.shadowRoot.getElementById("hcp");if(!l){let f=document.createElement("template");f.innerHTML=ur,l=f.content.firstElementChild,fe({name:"download-prompt",content:l,css:[v],attributes:{"sap-ignore":""}})}let x=t.get();(!x.prompt||typeof x.prompt!="object")&&(x.prompt={});let m=x.prompt,a=3,u=2500,d=/^(INPUT|TEXTAREA|SELECT)$/,A="#hcp, .clay-intro, .clay-owner",g=l.querySelector("[data-hcp-link]");g.href=n,r&&(l.querySelector("[data-hcp-name]").textContent=r);let j=l.querySelector("[data-hcp=open]");function E(f,O){l.hidden=!1,l.setAttribute("data-hcp-state",f),O&&l.setAttribute("data-hcp-reason",O),j.setAttribute("aria-expanded",f==="card"?"true":"false"),(f==="card"||f==="mini")&&(m.shown=!0,t.save(),l.setAttribute("data-hcp-arrived","")),R()}function L(f){return f&&!l.contains(f)&&!f.closest(A)&&(d.test(f.tagName)||f.isContentEditable)}let U=null;function $(f){clearTimeout(U),U=setTimeout(()=>{if(m.shown||m.dismissed||l.getAttribute("data-hcp-state")!=="tab")return;let O=document.activeElement;if(L(O)){let I=O.getBoundingClientRect(),H=Math.min(360,innerWidth-32);if(innerWidth<700||I.right>innerWidth-H-32&&I.bottom>innerHeight-380)return}E("card",f)},u)}let T=[];function M(f){l.contains(f.target)||!L(f.target)||(T.indexOf(f.target)<0&&T.push(f.target),m.uses=Math.max(m.uses||0,T.length),m.shown||t.save(),T.length>=a&&$("use"))}function Y(f){L(f.target)&&(l.getAttribute("data-hcp-state")==="card"&&E(m.shown?"mini":"tab"),innerWidth<700&&l.setAttribute("data-hcp-typing",""))}function X(){setTimeout(()=>{L(document.activeElement)||l.removeAttribute("data-hcp-typing")},50)}let Q=0,ot=!1;function R(){Q||(Q=requestAnimationFrame(()=>{Q=0;let O=ye(innerWidth-24,I=>l.contains(I)||I.closest("[data-hcp-preview], .clay-owner"))+"px";l.style.getPropertyValue("--hcp-lift")!==O&&l.style.setProperty("--hcp-lift",O),ot=!0,me(),ot=!1}))}async function at(){let f=window.clay&&window.clay.getHTML;if(typeof f!="function"||typeof URL>"u"||typeof URL.createObjectURL!="function")return!1;let O=location.pathname.split("/").filter(Boolean).pop()||"index.html";try{let{downloadHtml:I}=await import("../c-3TWCKFOP.js");return await I({html:f(),name:O.replace(/\.html$/,".htmlclay")})}catch{return!1}}let it=!1;l.addEventListener("click",async f=>{let O=f.target.closest("[data-hcp]");if(O){let I=O.getAttribute("data-hcp");I==="open"?(E("card",l.getAttribute("data-hcp-reason")==="error"?void 0:"open"),g.focus()):I==="minimize"?(E("mini"),j.focus()):I==="dismiss"&&(l.getAttribute("data-hcp-reason")==="error"?(E("mini"),j.focus()):(m.dismissed=!0,E("mini"),j.focus()));return}if(f.target.closest("[data-hcp-link]")){if(!i())return;let I=it||l.getAttribute("data-hcp-reason")==="error";if(!I){let H=c?.();if(H){if(f.preventDefault(),await H!==!1){g.click();return}I=!0}}if(I&&(f.preventDefault(),!await at())){mt(),l.querySelector(".hcp-body [data-hcp-for='error']").textContent="The download could not be made. Keep this page open and try Download free again.";return}m.downloaded=!0,m.shown=!0,t.save()}}),l.addEventListener("animationend",f=>{(f.animationName==="hcp-arrive"||f.animationName==="hcp-arrive-fade")&&l.setAttribute("data-hcp-arrived","")}),l.addEventListener("keydown",f=>{f.key==="Escape"&&l.getAttribute("data-hcp-state")==="card"&&(E("mini"),j.focus())});function mt(){E("card","error")}function Dt(){l.getAttribute("data-hcp-reason")==="error"&&l.setAttribute("data-hcp-reason","use")}let yt={set:E,root:l,showError:mt,clearError:Dt,download:(f=!1)=>{it=f;try{g.click()}finally{it=!1}}};return document.addEventListener("input",M,!0),document.addEventListener("change",M,!0),document.addEventListener("focusin",Y),document.addEventListener("focusout",X),addEventListener("scroll",R,{passive:!0}),addEventListener("resize",R),document.addEventListener(he,()=>{ot||R()}),document.addEventListener("transitionend",R,!0),l.addEventListener("transitionend",R),E(m.shown||m.dismissed?"mini":"tab"),!m.shown&&(m.uses||0)>=a&&$("return"),yt}var y=null,P=null,N=!0,_e=!1,G=Promise.resolve(),J=!1,K=null,qt=ge,_t=null,Kt=Promise.resolve(),Lt=Promise.resolve(),It=()=>!0,ht=()=>null,He=3e3;function qe(){return import("../c-N4GEJMXW.js").then(t=>t.mountOwnerChip()).catch(t=>(console.warn("visitor-drafts: the owner chip did not load",t),null))}function dr(t){return t.template?import("../c-VBXRXTVS.js").then(r=>r.mountIntro(t)).catch(r=>(console.warn("visitor-drafts: the intro did not load",r),null)):Promise.resolve(null)}var pt=vt(),Ht=document.querySelector('script[data-rules-name~="api"]');if(le&&pt&&Ht){let i=function(a){K={restored:a.restored,hadDraft:a.hadDraft,parked:!!a.parked,...a.partial&&{partial:!0},...a.blocked&&{blocked:!0}},document.dispatchEvent(new CustomEvent("clay:drafts-restored",{detail:K}));let u=document.querySelector('meta[name="application-name"]')?.content?.trim()||document.title.split(/:|\s\|\s/)[0].trim()||"This app",d=document.querySelector("template[visitor-intro]"),A=()=>{Kt=Ue({memory:c,appName:u,link:qt,settle:()=>ht(),canDownloadCurrent:()=>!J&&!K.blocked}).then(g=>dr({memory:c,template:d,appName:u,hadDraft:a.hadDraft||y.kept()}).then(()=>g)).then(g=>(document.addEventListener("clay:drafts-store-failed",()=>g.showError()),document.addEventListener("clay:drafts-saved",()=>g.clearError()),se()&&g.showError(),(Nt?qe():Promise.resolve(null)).then(()=>g)))};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",A,{once:!0}):A()},t=Z(),r=je(pt,{path:t}),n=Ot();y=Ce({path:t,fallback:r==="failed"?Ut(pt):null}),N=!(typeof globalThis.indexedDB?.open=="function"&&globalThis.IDBKeyRange),_e=!N,G=N?Promise.resolve():import("../c-
|
|
20
|
+
</aside>`;async function Ue({memory:t,appName:r,link:n,settle:c,canDownloadCurrent:i=()=>!0}){let{PROMPT_CSS:v}=await import("../c-SGIA4IEQ.js"),l=document.querySelector('clay-editor-ui[data-clay-ui="download-prompt"]')?.shadowRoot.getElementById("hcp");if(!l){let f=document.createElement("template");f.innerHTML=ur,l=f.content.firstElementChild,fe({name:"download-prompt",content:l,css:[v],attributes:{"sap-ignore":""}})}let x=t.get();(!x.prompt||typeof x.prompt!="object")&&(x.prompt={});let m=x.prompt,a=3,u=2500,d=/^(INPUT|TEXTAREA|SELECT)$/,A="#hcp, .clay-intro, .clay-owner",g=l.querySelector("[data-hcp-link]");g.href=n,r&&(l.querySelector("[data-hcp-name]").textContent=r);let j=l.querySelector("[data-hcp=open]");function E(f,O){l.hidden=!1,l.setAttribute("data-hcp-state",f),O&&l.setAttribute("data-hcp-reason",O),j.setAttribute("aria-expanded",f==="card"?"true":"false"),(f==="card"||f==="mini")&&(m.shown=!0,t.save(),l.setAttribute("data-hcp-arrived","")),R()}function L(f){return f&&!l.contains(f)&&!f.closest(A)&&(d.test(f.tagName)||f.isContentEditable)}let U=null;function $(f){clearTimeout(U),U=setTimeout(()=>{if(m.shown||m.dismissed||l.getAttribute("data-hcp-state")!=="tab")return;let O=document.activeElement;if(L(O)){let I=O.getBoundingClientRect(),H=Math.min(360,innerWidth-32);if(innerWidth<700||I.right>innerWidth-H-32&&I.bottom>innerHeight-380)return}E("card",f)},u)}let T=[];function M(f){l.contains(f.target)||!L(f.target)||(T.indexOf(f.target)<0&&T.push(f.target),m.uses=Math.max(m.uses||0,T.length),m.shown||t.save(),T.length>=a&&$("use"))}function Y(f){L(f.target)&&(l.getAttribute("data-hcp-state")==="card"&&E(m.shown?"mini":"tab"),innerWidth<700&&l.setAttribute("data-hcp-typing",""))}function X(){setTimeout(()=>{L(document.activeElement)||l.removeAttribute("data-hcp-typing")},50)}let Q=0,ot=!1;function R(){Q||(Q=requestAnimationFrame(()=>{Q=0;let O=ye(innerWidth-24,I=>l.contains(I)||I.closest("[data-hcp-preview], .clay-owner"))+"px";l.style.getPropertyValue("--hcp-lift")!==O&&l.style.setProperty("--hcp-lift",O),ot=!0,me(),ot=!1}))}async function at(){let f=window.clay&&window.clay.getHTML;if(typeof f!="function"||typeof URL>"u"||typeof URL.createObjectURL!="function")return!1;let O=location.pathname.split("/").filter(Boolean).pop()||"index.html";try{let{downloadHtml:I}=await import("../c-3TWCKFOP.js");return await I({html:f(),name:O.replace(/\.html$/,".htmlclay")})}catch{return!1}}let it=!1;l.addEventListener("click",async f=>{let O=f.target.closest("[data-hcp]");if(O){let I=O.getAttribute("data-hcp");I==="open"?(E("card",l.getAttribute("data-hcp-reason")==="error"?void 0:"open"),g.focus()):I==="minimize"?(E("mini"),j.focus()):I==="dismiss"&&(l.getAttribute("data-hcp-reason")==="error"?(E("mini"),j.focus()):(m.dismissed=!0,E("mini"),j.focus()));return}if(f.target.closest("[data-hcp-link]")){if(!i())return;let I=it||l.getAttribute("data-hcp-reason")==="error";if(!I){let H=c?.();if(H){if(f.preventDefault(),await H!==!1){g.click();return}I=!0}}if(I&&(f.preventDefault(),!await at())){mt(),l.querySelector(".hcp-body [data-hcp-for='error']").textContent="The download could not be made. Keep this page open and try Download free again.";return}m.downloaded=!0,m.shown=!0,t.save()}}),l.addEventListener("animationend",f=>{(f.animationName==="hcp-arrive"||f.animationName==="hcp-arrive-fade")&&l.setAttribute("data-hcp-arrived","")}),l.addEventListener("keydown",f=>{f.key==="Escape"&&l.getAttribute("data-hcp-state")==="card"&&(E("mini"),j.focus())});function mt(){E("card","error")}function Dt(){l.getAttribute("data-hcp-reason")==="error"&&l.setAttribute("data-hcp-reason","use")}let yt={set:E,root:l,showError:mt,clearError:Dt,download:(f=!1)=>{it=f;try{g.click()}finally{it=!1}}};return document.addEventListener("input",M,!0),document.addEventListener("change",M,!0),document.addEventListener("focusin",Y),document.addEventListener("focusout",X),addEventListener("scroll",R,{passive:!0}),addEventListener("resize",R),document.addEventListener(he,()=>{ot||R()}),document.addEventListener("transitionend",R,!0),l.addEventListener("transitionend",R),E(m.shown||m.dismissed?"mini":"tab"),!m.shown&&(m.uses||0)>=a&&$("return"),yt}var y=null,P=null,N=!0,_e=!1,G=Promise.resolve(),J=!1,K=null,qt=ge,_t=null,Kt=Promise.resolve(),Lt=Promise.resolve(),It=()=>!0,ht=()=>null,He=3e3;function qe(){return import("../c-N4GEJMXW.js").then(t=>t.mountOwnerChip()).catch(t=>(console.warn("visitor-drafts: the owner chip did not load",t),null))}function dr(t){return t.template?import("../c-VBXRXTVS.js").then(r=>r.mountIntro(t)).catch(r=>(console.warn("visitor-drafts: the intro did not load",r),null)):Promise.resolve(null)}var pt=vt(),Ht=document.querySelector('script[data-rules-name~="api"]');if(le&&pt&&Ht){let i=function(a){K={restored:a.restored,hadDraft:a.hadDraft,parked:!!a.parked,...a.partial&&{partial:!0},...a.blocked&&{blocked:!0}},document.dispatchEvent(new CustomEvent("clay:drafts-restored",{detail:K}));let u=document.querySelector('meta[name="application-name"]')?.content?.trim()||document.title.split(/:|\s\|\s/)[0].trim()||"This app",d=document.querySelector("template[visitor-intro]"),A=()=>{Kt=Ue({memory:c,appName:u,link:qt,settle:()=>ht(),canDownloadCurrent:()=>!J&&!K.blocked}).then(g=>dr({memory:c,template:d,appName:u,hadDraft:a.hadDraft||y.kept()}).then(()=>g)).then(g=>(document.addEventListener("clay:drafts-store-failed",()=>g.showError()),document.addEventListener("clay:drafts-saved",()=>g.clearError()),se()&&g.showError(),(Nt?qe():Promise.resolve(null)).then(()=>g)))};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",A,{once:!0}):A()},t=Z(),r=je(pt,{path:t}),n=Ot();y=Ce({path:t,fallback:r==="failed"?Ut(pt):null}),N=!(typeof globalThis.indexedDB?.open=="function"&&globalThis.IDBKeyRange),_e=!N,G=N?Promise.resolve():import("../c-W7LWCJHD.js").then(a=>a.openSession({store:y,storage:n,reload:()=>de({isCurrent:()=>!0,reload:()=>window.location.reload()})})).then(a=>{P=a},()=>{N=!0}),ae((a,u=null)=>{let d=!K;return Lt.then(()=>{if(J)throw B(document,new Error("the draft database did not open"));return d&&([u,a]=[bt()?.token()??null,window.clay.getHTML()]),N?void y.write(a):(y.capture(a,{at:u}),G.then(()=>{if(P)return P.sync().then(()=>{});y.write(a)}))})});let c=Ne(y.key,n);_t=Pe(c),qt=Re(_t),It=()=>{if(J)return!1;if(!K)return!0;if(N)return y.flush();let a=y.keep();return P?.hide(),a},ie(It),ce(()=>!N&&y.unsafe()),ht=()=>{if(J)return Promise.resolve(!1);if(!K)return Lt.then(()=>ht());if(N)return y.flush()?null:Promise.resolve(!1);let a=y.keep();if(!y.pending())return a?null:Promise.resolve(!1);let u=G.then(()=>P?P.sync().then(()=>!0):y.flush()).catch(()=>!1),d;return Promise.race([u,new Promise(A=>{d=setTimeout(()=>A(!1),He)})]).finally(()=>clearTimeout(d))},document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&It()}),window.addEventListener("pagehide",It);let v=!1;document.addEventListener("click",async a=>{let u=a.composedPath().find(g=>g instanceof Element&&g.matches("a[clay-wait-drafts][href]"));if(!u||a.defaultPrevented||a.button!==0||a.metaKey||a.ctrlKey||a.shiftKey||a.altKey||u.target&&u.target!=="_self")return;if(v){a.preventDefault();return}let d=ht();if(!d)return;a.preventDefault(),v=!0;let A;await Promise.race([d,new Promise(g=>{A=setTimeout(g,He)})]),clearTimeout(A),v=!1,window.location.assign(u.href)},!0);let k=()=>{if(!N||J||!K)return;let a=y.externalUnit();a&&document.dispatchEvent(new CustomEvent("clay:drafts-blockeditor-external",{detail:{live:a.live,adopted:()=>y.adoptedUnit(a)}})),y.adoptExternal()};window.addEventListener("storage",a=>{a.key===y.key&&k()}),document.addEventListener("clay:drafts-blockeditor-listening",k),window.addEventListener("pageshow",a=>{a.persisted&&k()});let l=y.held(),x=l?.v===2&&l.idb===!0,m=!N&&l?.v===1&&l.w===void 0&&y.generation()!=="";x||m||!N&&l?.w&&l.w.reset!==y.generation()?Lt=G.then(()=>P?.first).then(a=>{if(a)return i(y.restore(a.record&&{raw:JSON.stringify(a.record),record:a.record}));throw new Error("the draft database did not open")}).catch(a=>{if(!x){if(!m)try{n?.removeItem(y.key)}catch{}return i(y.restore())}J=!0,B(document,a),i({restored:!1,hadDraft:!0,blocked:!0})}):(i(y.restore()),G.then(()=>{P||(y.release(),y.flush())}))}else if(!pt||!Ht){let t=[];pt||t.push('a visitor-drafts="<slot>" attribute on <html>'),Ht||t.push('a <script data-rules-name~="api"> rules tag'),console.warn(`visitor-drafts: this page keeps no draft (missing ${t.join(" and ")})`)}else Nt&&ue&&!oe()&&(Kt=qe());var Tr=y?{active:!0,slot:y.slot,key:y.key,hasDraft:()=>y.kept(),restored:()=>K,saveNow(){if(J||!K)return!1;if(N)return y.writeLive();try{y.captureNow()}catch{return!1}return P?.sync().catch(()=>{}),!y.unsafe()},reset(){return _e?(G.then(()=>{if(P)return P.startOver();if(N&&!J)return y.clear();throw new Error("the draft database did not open")}).then(()=>window.location.reload(),t=>B(document,t)),!0):(y.clear(),window.location.reload(),!0)},onRestore(t){return K?(t(K),!0):(document.addEventListener("clay:drafts-restored",r=>t(r.detail),{once:!0}),!1)},editOriginal:we,backToDraft:ve,downloadUrl:()=>qt,download:()=>Kt.then(async t=>{let r=await ht();return t?.download(r===!1)}),source:_t}:be();async function Mr(){if(await Lt,await G,!y||!P||J)return null;let{createRecovery:t}=await import("../c-CPRGR2II.js");return t({store:y,session:P})}export{Kt as ready,Mr as recoveryDrafts,Lt as restoring,Tr as visitorDrafts};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as t}from"../c-CUMXGHVD.js";import{a as e}from"../c-VKEDWYDF.js";import{b as r}from"../c-C7SUMNMI.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-U4TWEIKZ.js";import"../c-HA6INT6J.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";r&&(t(),document.addEventListener("clay:drafts-restored",()=>t()),e(()=>{import("../c-
|
|
1
|
+
import{f as t}from"../c-CUMXGHVD.js";import{a as e}from"../c-VKEDWYDF.js";import{b as r}from"../c-C7SUMNMI.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-U4TWEIKZ.js";import"../c-HA6INT6J.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";r&&(t(),document.addEventListener("clay:drafts-restored",()=>t()),e(()=>{import("../c-MMEVDN6D.js").then(o=>o.start()).catch(o=>console.warn("visitor-menu: the menu did not load",o))}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c}from"../c-
|
|
1
|
+
import{a,b,c}from"../c-C5UGNOC2.js";import"../c-EQ5NBOGA.js";import"../c-C7SUMNMI.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-U4TWEIKZ.js";import"../c-HA6INT6J.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";export{c as default,a as modeParticipant,b as wire,a as wireParticipant};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import{a as W,b as x,c as B}from"./c-NUHP2XDB.js";import{g as F}from"./c-QCDVDZIR.js";import{a as m}from"./c-VKEDWYDF.js";import{b as V}from"./c-MZCOGNZL.js";import{e as z}from"./c-EQ5NBOGA.js";import"./c-IJUK2GPW.js";import{a as T,b as f,c as a,f as u,g as n,h as v,j as L,o as $}from"./c-C7SUMNMI.js";import{c as j,e as H}from"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-U4TWEIKZ.js";import"./c-MOP5KBWZ.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import{d as q,s as U}from"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import{a as S}from"./c-VHNSBD2M.js";var C={};S(C,{activateInitialMode:()=>ke,canEdit:()=>a,default:()=>Me,init:()=>A,isEditMode:()=>u,isOwner:()=>v,mode:()=>n,modeLifecycle:()=>xe,noteLiveSwitch:()=>Ee,setMode:()=>y,setPageTypeOnPageLoad:()=>Q,toggleEditMode:()=>X});var N=!1,ve=e=>{if(typeof e?.id=="string"&&e.id.startsWith("clay:"))throw new TypeError(`clay.modeLifecycle: the id "${e.id}" is reserved`);return $(e)},xe={register:ve,canWrite:()=>L().phase==="idle"&&u,get state(){return Object.freeze(L())}},D=null,J=()=>D||=import("./c-3WX5FABT.js").catch(()=>D=null),M=null,Ee=e=>{M=e};async function ke(){if(u)try{await(await J()).activateInitial()}catch(e){console.error("clayjs: the mode lifecycle failed to start:",e)}}var p=null;async function y(e){if(e!=="edit"&&e!=="view")throw new TypeError(`clay.setMode: unknown mode "${e}"`);if(p)return p.target===e?p.promise:{ok:!1,mode:n,code:"busy"};if(e===n&&!D)return{ok:!0,mode:n,changed:!1};if(f)return{ok:!1,mode:n,code:"not-allowed"};let t=Se(e);p={target:e,promise:t};try{return await t}finally{p?.promise===t&&(p=null)}}async function Se(e){let t=typeof window<"u"?window.clay?._requestHostMode:void 0;if(typeof t=="function"&&e!==n){let o;try{o=await t(e)}catch{return{ok:!1,mode:n,code:"host-failed"}}if(o?.reason!=="host-unsupported")return o?.ok?(N=!0,{ok:!0,mode:e,changed:!0,reloading:!0}):{ok:!1,mode:n,code:o?.reason||"host-refused"}}return e==="edit"&&n!=="edit"?Te():!a&&!(e==="view"&&n==="edit")?{ok:!1,mode:n,code:"not-allowed"}:Y(e)}async function Te(){let e=location.pathname,{checkHostPermission:t}=await import("./core/host-permission-5BYP24GC.js"),o=await t({fresh:!0});return location.pathname!==e?{ok:!1,mode:n,code:"cancelled"}:o===!1?{ok:!1,mode:n,code:"permission-denied"}:a?Y("edit"):{ok:!1,mode:n,code:"not-allowed"}}async function Y(e){if(M){let t=await J(),o=t&&await t.switchMode(e,M);if(o)return o}if(e===n)return{ok:!0,mode:n,changed:!1};if(n==="edit"){let t;try{t=await window.clay?.save?.flush?.()}catch(o){return{ok:!1,mode:n,code:"save-failed",state:o?.state}}if(t&&t.state&&t.state!=="saved"&&t.state!=="clean")return{ok:!1,mode:n,code:"save-failed",state:t.state}}return N=!0,T({mode:e,canEdit:a,internal:!0}),location.reload(),{ok:!0,mode:e,changed:!0,reloading:!0}}function Le(){let e=new URL(window.location.href);e.searchParams.set("editmode","true"),window.location.href=e.toString()}var X=()=>f?Le():y(n==="edit"?"view":"edit");function De(){!a||f||window.addEventListener("pagehide",()=>{N||T({mode:n,canEdit:a,internal:!1})})}function G(){a?document.documentElement.setAttribute("canedit","true"):document.documentElement.removeAttribute("canedit")}function Q(){m(()=>{document.documentElement.setAttribute("editmode",u?"true":"false"),document.documentElement.setAttribute("pageowner",v?"true":"false"),G(),document.addEventListener("clay:capabilitychange",G),f?document.documentElement.setAttribute("draftmode","true"):document.documentElement.removeAttribute("draftmode")})}function A(){Q(),De()}A();var Me={init:A,setMode:y,toggleEditMode:X,isEditMode:u,isOwner:v,canEdit:a,mode:n};var se={};var Z=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),Ne=Z?"\u2318\u21E7E":"Ctrl+Shift+E",Ae=`.clay-mode-note {
|
|
2
|
+
position: fixed;
|
|
3
|
+
right: calc(16px + env(safe-area-inset-right, 0px));
|
|
4
|
+
bottom: calc(16px + env(safe-area-inset-bottom, 0px));
|
|
5
|
+
z-index: 2147482000;
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
gap: 10px;
|
|
9
|
+
max-width: min(420px, calc(100vw - 32px));
|
|
10
|
+
padding: 10px 10px 10px 14px;
|
|
11
|
+
border: 1px solid rgba(23, 28, 36, .16);
|
|
12
|
+
border-radius: 12px;
|
|
13
|
+
font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
14
|
+
font-size: 13px;
|
|
15
|
+
line-height: 1.45;
|
|
16
|
+
text-align: left;
|
|
17
|
+
color: var(--clay-ui-fg, #1F2328);
|
|
18
|
+
background: var(--clay-ui-bg, #F4F4F5);
|
|
19
|
+
box-shadow: 0 8px 24px -12px rgba(23, 28, 36, .45);
|
|
20
|
+
transition: opacity .25s ease, transform .25s ease;
|
|
21
|
+
}
|
|
22
|
+
.clay-mode-note kbd {
|
|
23
|
+
font: inherit;
|
|
24
|
+
font-weight: 600;
|
|
25
|
+
padding: 1px 5px;
|
|
26
|
+
border: 1px solid rgba(23, 28, 36, .2);
|
|
27
|
+
border-radius: 5px;
|
|
28
|
+
background: rgba(23, 28, 36, .07);
|
|
29
|
+
}
|
|
30
|
+
.clay-mode-note button {
|
|
31
|
+
flex: none;
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
width: 24px;
|
|
36
|
+
height: 24px;
|
|
37
|
+
padding: 0;
|
|
38
|
+
border: 0;
|
|
39
|
+
border-radius: 6px;
|
|
40
|
+
font: inherit;
|
|
41
|
+
font-size: 16px;
|
|
42
|
+
line-height: 1;
|
|
43
|
+
color: inherit;
|
|
44
|
+
background: none;
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
opacity: .65;
|
|
47
|
+
}
|
|
48
|
+
.clay-mode-note button:hover { opacity: 1; background: rgba(23, 28, 36, .08); }
|
|
49
|
+
.clay-mode-note .clay-view-notice__edit {
|
|
50
|
+
width: auto;
|
|
51
|
+
padding: 0 10px;
|
|
52
|
+
border: 1px solid rgba(23, 28, 36, .2);
|
|
53
|
+
font-size: 13px;
|
|
54
|
+
font-weight: 600;
|
|
55
|
+
opacity: 1;
|
|
56
|
+
}
|
|
57
|
+
@media (prefers-color-scheme: dark) {
|
|
58
|
+
.clay-mode-note .clay-view-notice__edit { border-color: rgba(233, 233, 236, .22); }
|
|
59
|
+
.clay-mode-note {
|
|
60
|
+
border-color: rgba(233, 233, 236, .16);
|
|
61
|
+
color: var(--clay-ui-fg, #E9E9EC);
|
|
62
|
+
background: var(--clay-ui-bg, #26282C);
|
|
63
|
+
box-shadow: 0 8px 24px -12px rgba(0, 0, 0, .7);
|
|
64
|
+
}
|
|
65
|
+
.clay-mode-note kbd { border-color: rgba(233, 233, 236, .22); background: rgba(233, 233, 236, .1); }
|
|
66
|
+
.clay-mode-note button:hover { background: rgba(233, 233, 236, .12); }
|
|
67
|
+
}
|
|
68
|
+
@media (prefers-reduced-motion: reduce) {
|
|
69
|
+
.clay-mode-note { transition: none; }
|
|
70
|
+
}
|
|
71
|
+
@media (max-width: 559px) {
|
|
72
|
+
.clay-mode-note {
|
|
73
|
+
left: calc(16px + env(safe-area-inset-left, 0px));
|
|
74
|
+
right: calc(16px + env(safe-area-inset-right, 0px));
|
|
75
|
+
max-width: none;
|
|
76
|
+
}
|
|
77
|
+
}`,ee=new WeakSet;function te(e){import("./c-B4VYNXTQ.js").then(({mountEditorUI:t})=>{ee.has(e)||t({name:"mode-note",content:e,css:[Ae]})})}function oe(e){ee.add(e),e.getRootNode().host?.remove()}function ne(e){return y(e).then(t=>{t.ok||import("./c-QHIWXHRO.js").then(({modeRefusalText:o})=>{let i=o(t);i&&(typeof window.clay?.toast=="function"?window.clay.toast(i,"error"):typeof window.clay?.menu?.note=="function"?window.clay.menu.note(i):ae(i))})})}function Ce(e){(a||n==="edit")&&(!(Z?e.metaKey:e.ctrlKey)||!e.shiftKey||e.altKey||e.code!=="KeyE"||e.isComposing||(e.preventDefault(),ne(n==="edit"?"view":"edit")))}var Re="In view mode, so edits won't be saved.",Pe=":is(input, textarea, select):is([persist], [clay-persist])",R="[editmode\\:contenteditable], [viewmode\\:readonly], [viewmode\\:disabled]",s=null;function ie(e){if(!e.isConnected)return!1;let t=U(e);return t.persist===q.FULL&&!t.extension}function re(e){let t=e?.nodeType===1?e:e?.parentElement;if(!t)return null;let o=t.closest(Pe)||t.closest(R)||(t.isContentEditable?t:null);return o&&ie(o)?o:null}var Ie=e=>e.isContentEditable||e.matches("input, textarea, select")&&!e.readOnly&&!e.disabled,P=()=>a&&n==="view";function Oe(e){P()&&re(e.target)&&I()}function _e(e){if(!P()||e.defaultPrevented||e.isComposing||e.ctrlKey||e.metaKey||e.altKey||!(e.key.length===1&&e.key!==" ")&&e.key!=="Backspace"&&e.key!=="Delete")return;let t=e.target;if(t?.nodeType!==1||Ie(t)||t!==document.body&&!t.closest(R))return;re(t===document.body?document.getSelection()?.anchorNode:t)?.matches(R)&&I()}function Ke(e){if(!P())return;let t=e.target?.closest?.("[viewmode\\:disabled]");t&&ie(t)&&I()}function I(){s||(console.warn('clayjs: this tab is in view mode, so edits made here are not saved. clay.setMode("edit") switches; a page that must edit as soon as it opens declares <html opens-in="edit">.'),document.querySelector('clay-editor-ui[data-clay-ui="mode-note"]')?.remove(),s=document.createElement("div"),s.setAttribute("clay","editor-ui"),s.setAttribute("role","alert"),s.className="clay-mode-note clay-view-notice",s.innerHTML='<span></span><button type="button" class="clay-view-notice__edit">Switch to edit</button>',s.querySelector("span").textContent=Re,s.querySelector("button").addEventListener("click",()=>ne("edit")),te(s))}function je(){n==="view"||!s||(oe(s),s=null)}function ae(e){let t=document.createElement("div");t.setAttribute("clay","editor-ui"),t.setAttribute("role","status"),t.className="clay-mode-note",t.innerHTML=`<span>This page opens in view mode. Press <kbd>${Ne}</kbd> to edit.</span><button type="button" aria-label="Dismiss">\xD7</button>`,e&&(t.querySelector("span").textContent=e);let o=()=>oe(t);t.querySelector("button").addEventListener("click",o),addEventListener("keydown",i=>{i.key==="Escape"&&o()},{once:!0}),setTimeout(o,12e3),te(t)}f||(document.addEventListener("keydown",Ce),document.addEventListener("input",Oe,!0),document.addEventListener("pointerdown",Ke,!0),window.addEventListener("keydown",_e),document.addEventListener("clay:modechange",je),m(()=>{if(!a||n!=="view"||document.querySelector("[clay-mode-toggle]"))return;(t=>{let o=window.clay?.ready;window.clay?.storage||typeof o?.then!="function"?queueMicrotask(t):o.then(t,()=>{})})(()=>{if(window.clay?.menu||window.clay?.plugins?.includes?.("menu"))return;let t=window.clay?.storage?.local;!t||t.get("mode-note")||(t.set("mode-note",!0),ae())})}));var O={};S(O,{whenShown:()=>Ve});var He="This page can't be edited: the app serving it is out of date. Update HTML Clay to 1.9.0 or newer.",d=null,r=null;function h(){if(!d)return;let e=window.visualViewport,t=e?Math.max(0,window.innerHeight-e.height-e.offsetTop):0;x(d,"bottom",`calc(${16+t}px + env(safe-area-inset-bottom,0px))`)}function $e(){d&&(x(d,"display","none"),window.visualViewport?.removeEventListener("resize",h),window.visualViewport?.removeEventListener("scroll",h))}function qe(){let e=r.resolveTheme();d=r.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:${r.pageScheme()}`],{theme:e,parts:["notice.root","notice.panel","staleHost.root","staleHost.panel"]}),d.setAttribute("clay",r.RUNTIME_ONLY),d.setAttribute("data-clay-stale-host",""),d.setAttribute("role","alert");let t=B("span",["all:initial","color-scheme:inherit","display:inline-block","flex:none","width:8px","height:8px","border-radius:50%",`background:${r.TOKENS.ox}`]);t.setAttribute("clay",r.RUNTIME_ONLY);let o=["notice.dot","staleHost.dot"];r.themed(e)&&(r.markParts(t,e,o),W(t,r.partRules(e,o,{})));let i=r.bevelButton("Dismiss",{small:!0,variant:"quiet",onClick:$e,theme:e,parts:["notice.button","staleHost.button"],labelParts:["notice.buttonLabel","staleHost.buttonLabel"]});i.setAttribute("aria-label","Dismiss this message"),d.append(t,r.bevelText("span",[],He,{theme:e,parts:["notice.text","staleHost.text"]}),i),document.body.appendChild(d),h(),r.themed(e)?x(d,"color-scheme",e.scheme==="light dark"?"light":e.scheme):r.paintLook(d,{background:r.TOKENS.surface}),window.visualViewport?.addEventListener("resize",h),window.visualViewport?.addEventListener("scroll",h)}async function Ue(){if(!H()||u)return;let[e,t,o,i]=await Promise.all([import("./c-33SS5A4Y.js"),import("./c-46LJAZZJ.js"),import("./c-OCSZ4QGN.js"),import("./c-ELXMSEN5.js")]);r={...e,...i,TOKENS:t.TOKENS,resolveTheme:o.resolveTheme},qe()}var de=Promise.resolve();m(()=>{de=Ue()});var Ve=()=>de;var K={};S(K,{createPageDataApi:()=>ue,readData:()=>Je,setPageDataLiveSync:()=>Xe,writeData:()=>Ye});var Fe="data-read",ze="data-write";function E(e,t,o){let i=new Error(t);return i.code=e,i.details=o,i}async function le(e){if(typeof e.json=="function")return e.json();let t=await e.text();return t?JSON.parse(t):null}async function We(e){let t={};try{t=await le(e)||{}}catch{}let o=t.message||t.error||e.statusText||`Request failed (${e.status})`,i=new Error(o);return i.status=e.status,i.error=t.error,i.details=t.details,i}function Be(e){let t=e.headers?.get?.("ETag");return typeof t=="string"&&t?t:null}function Ge(e,t){let o=`${t.origin}${t.pathname}`;return e!==void 0?`${o}?data=${encodeURIComponent(JSON.stringify(e))}`:`${t.origin}/_/api${t.pathname}`}async function ce(){let{isDraftMode:e}=await import("./core/is-edit-mode-73OXKK5H.js");return e?E("DataUnavailableInDraft","Page data is kept in this browser for this visitor."):null}function ue({supports:e=z,token:t=j,fetchImpl:o=(...g)=>fetch(...g),getLocation:i=()=>window.location,eventTarget:fe=document,loadWriteModules:me,syncTimeoutMs:pe,httpTimeoutMs:we}={}){let g=null,w=null;function ye(c){g=c}async function he(c){let b=await ce();if(b)throw b;if(!await e(Fe))throw E("DataReadUnsupported","This host does not support reading page data.");let l;try{l=await o(Ge(c,i()),{method:"GET",credentials:"same-origin",cache:"no-store",redirect:"error"})}catch(k){throw Object.assign(E("DataReadFailed",k?.message||"Could not read page data."),{cause:k})}if(!l.ok)throw await We(l);return{data:await le(l),etag:Be(l)}}function ge(){return w||(w=import("./c-34J5HC7N.js").then(({createPageDataWrite:c})=>c({supports:e,token:t,fetchImpl:o,getLocation:i,eventTarget:fe,getLiveSync:()=>g,loadWriteModules:me,syncTimeoutMs:pe,httpTimeoutMs:we})).catch(c=>{throw w=null,c}),w)}async function be(c,b){let l=await ce();if(l)throw l;if(!await e(ze))throw E("DataWriteUnsupported","This host does not support writing page data.");return(await ge()).writeData(c,b)}return{readData:he,writeData:be,setLiveSync:ye}}var _=ue(),Je=_.readData,Ye=_.writeData,Xe=_.setLiveSync;var ut={"lib/mutation.js":V,"core/preserve-authored.js":F,"core/edit-mode.js":C,"core/mode-key.js":se,"core/stale-host-notice.js":O,"core/page-data.js":K};export{ut as core};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b as c,c as d,d as e,e as f,f as g,g as h}from"../c-
|
|
1
|
+
import{a,b as c,c as d,d as e,e as f,f as g,g as h}from"../c-ZFAPQQIB.js";import{f as b}from"../c-ARO6CPMA.js";import"../c-LZJPNR2W.js";import"../c-FILLTJA7.js";import"../c-5VYOWDTI.js";import"../c-P73XPAOA.js";import"../c-WYFDLITL.js";import"../c-MZCOGNZL.js";import"../c-LD6UVV5R.js";import"../c-PGSBXHUE.js";import"../c-KU3PX7LL.js";import"../c-EQ5NBOGA.js";import"../c-IJUK2GPW.js";import"../c-C7SUMNMI.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-U4TWEIKZ.js";import"../c-UW6MMZ4V.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-MOP5KBWZ.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as r,b as l,c as m,d as f}from"../c-K2ZHQMPF.js";import{b as d}from"../c-4M2T676V.js";import{a as s,b as o,c as i}from"../c-EIDZHQHZ.js";import"../c-UL2YUY52.js";import"../c-QY7F6EN6.js";import"../c-OZOACVUD.js";import"../c-QHWJ5ZIJ.js";import"../c-J2ZW4HMR.js";import"../c-A5LASUEZ.js";import"../c-4JZDZFF6.js";import"../c-5RZNFTWD.js";import"../c-PKCCHJ5X.js";import{a}from"../c-5KXDKC5G.js";import{f as n}from"../c-46XYM55L.js";import"../c-NUHP2XDB.js";import"../c-VKEDWYDF.js";import"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";n();var t=window.clay=window.clay||{};t.toast=i;t.toastPersistent=s;t.ask=r;t.confirm=l;t.tell=m;t.snippet=f;t.modal=d;typeof window.toast>"u"&&(window.toast=i);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=>{o("Couldn't save"),o("Offline, will retry"),e.detail?.msgType==="warning"?i(e.detail.msg||"Saved","warning"):a.savedToast&&i(e.detail?.msg||"Saved","success")});document.addEventListener("clay:save-error",()=>s("Couldn't save","error"));document.addEventListener("clay:save-offline",()=>s("Offline, will retry","warning"));document.addEventListener("clay:live-notice",e=>{e.detail?.code==="save-uncertain"&&s(e.detail.message,"warning"),e.detail?.code==="op-too-large"&&i(e.detail.message,"warning")});export{r as ask,l as consent,f as snippet,m as tell,d as themodal,i as toast,s as toastPersistent};
|