@panphora/clayjs 1.21.0 → 1.22.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 +7698 -7969
- package/dist/m/{c-JOH753EJ.js → c-26KVJS6J.js} +1 -1
- package/dist/m/{c-ZE46QDIH.js → c-3TLG3OLG.js} +1 -1
- package/dist/m/{c-RT3C74GY.js → c-4OGEVKR3.js} +1 -1
- package/dist/m/{c-Y33LUUIQ.js → c-4PHDUV3H.js} +1 -1
- package/dist/m/{c-SJPD46ZO.js → c-4RFZROCF.js} +4 -4
- package/dist/m/{c-XQSXKIKM.js → c-4TWARTLS.js} +1 -1
- package/dist/m/{c-S5IEIZCN.js → c-5AQYL27I.js} +1 -1
- package/dist/m/{c-OJYM642Q.js → c-5FKRZNJV.js} +1 -1
- package/dist/m/{c-CJFDLD43.js → c-6KBKYLPO.js} +1 -1
- package/dist/m/{c-DHXPDLW6.js → c-6PBXRWDX.js} +1 -1
- package/dist/m/{c-BRLCTNMC.js → c-6RC66MYY.js} +1 -1
- package/dist/m/{c-PIVIYLTY.js → c-6UEFPHHE.js} +1 -1
- package/dist/m/{c-YQUJ74R3.js → c-BV6FQQXM.js} +1 -1
- package/dist/m/{c-YSB6JKV2.js → c-DEAFCHDO.js} +2 -2
- package/dist/m/{c-NLZ5AN4L.js → c-DKFSOJCV.js} +1 -1
- package/dist/m/c-DP4X4JID.js +1 -0
- package/dist/m/{c-LIBE4HPD.js → c-DZBZ57EE.js} +1 -1
- package/dist/m/c-ECY5AZMH.js +1 -0
- package/dist/m/{c-VAK7SG37.js → c-EUGJVHDD.js} +1 -1
- package/dist/m/{c-GPGYKER7.js → c-F5AER2ID.js} +1 -1
- package/dist/m/{c-RG6XUZFA.js → c-FAXQU7MQ.js} +1 -1
- package/dist/m/{c-XD5MOROJ.js → c-FLBUYV3P.js} +1 -1
- package/dist/m/{c-NFR673TL.js → c-FMCPQ4VT.js} +2 -2
- package/dist/m/{c-VBLFAQD2.js → c-FNIGX4FI.js} +1 -1
- package/dist/m/{c-BTLFLLML.js → c-FWFJUU3T.js} +1 -1
- package/dist/m/{c-2VB555FG.js → c-GPTKI7AQ.js} +1 -1
- package/dist/m/{c-EZ7B5AZT.js → c-GY4ODHO2.js} +1 -1
- package/dist/m/{c-5734MF2P.js → c-H6DXQEH2.js} +1 -1
- package/dist/m/{c-5FEU5MMY.js → c-HAVGDXAL.js} +1 -1
- package/dist/m/{c-W23KVGUO.js → c-HWR6GMGK.js} +1 -1
- package/dist/m/{c-BJ7YQ5QZ.js → c-IHUWUKIU.js} +1 -1
- package/dist/m/{c-AL4RBJF2.js → c-ILGQ3UXQ.js} +1 -1
- package/dist/m/{c-W3K23S72.js → c-IWTTOC2V.js} +1 -1
- package/dist/m/c-JFST6QE7.js +1 -0
- package/dist/m/{c-FNVQAACK.js → c-KE33W4RE.js} +1 -1
- package/dist/m/c-KV7R47FR.js +1 -0
- package/dist/m/{c-LPUJXRXW.js → c-L7K5EXU2.js} +1 -1
- package/dist/m/{c-3YH6JSIL.js → c-LF6HNVPU.js} +1 -1
- package/dist/m/{c-MIL4B2JQ.js → c-MRURHLKV.js} +1 -1
- package/dist/m/{c-LQU7TXIH.js → c-N33TPVTL.js} +1 -1
- package/dist/m/{c-EOCZ2YVL.js → c-NBNRLZXO.js} +1 -1
- package/dist/m/{c-JUE7B4OX.js → c-NLWEZYKJ.js} +1 -1
- package/dist/m/{c-DDDOKPI6.js → c-NNNR7OXA.js} +1 -1
- package/dist/m/{c-E4IBSAQM.js → c-OI2BYWVV.js} +1 -1
- package/dist/m/{c-SBSMJIPC.js → c-P3WATEDR.js} +1 -1
- package/dist/m/{c-ZJLU56DV.js → c-PCEMXY2K.js} +1 -1
- package/dist/m/{c-3GJ4XARY.js → c-PWBJVHA4.js} +1 -1
- package/dist/m/{c-67ILSNPR.js → c-Q5KAQJAG.js} +1 -1
- package/dist/m/{c-U5X57T4L.js → c-QHVCUTJV.js} +1 -1
- package/dist/m/{c-GKEATME6.js → c-QJFYVCJO.js} +1 -1
- package/dist/m/{c-VY6XRBOW.js → c-QTC6VGA4.js} +1 -1
- package/dist/m/{c-44B5ODN7.js → c-TMT5TL65.js} +2 -2
- package/dist/m/{c-OABVRYOT.js → c-TV7JHSRL.js} +1 -1
- package/dist/m/{c-SO63UGPQ.js → c-UWT4CXQ4.js} +1 -1
- package/dist/m/{c-EFD6QNTE.js → c-VFES2BP5.js} +1 -1
- package/dist/m/{c-UXEVJ63W.js → c-VIW5X35H.js} +1 -1
- package/dist/m/{c-EOCKLMKX.js → c-WWE67K5Y.js} +1 -1
- package/dist/m/{c-J3BXFTZS.js → c-XDVAZDUE.js} +1 -1
- package/dist/m/{c-K76AUL4I.js → c-XZJ5IK6Q.js} +1 -1
- package/dist/m/{c-2ZZBC45O.js → c-Z7RJANGO.js} +1 -1
- package/dist/m/{c-I2IFKJX2.js → c-ZAHTFCXQ.js} +1 -1
- package/dist/m/{c-GVPNDIKJ.js → c-ZKELCT4T.js} +1 -1
- package/dist/m/{c-7SXYQCN4.js → c-ZO6VL2SC.js} +1 -1
- package/dist/m/{c-M4FSPNQ2.js → c-ZYEJLZEY.js} +1 -1
- package/dist/m/core/{autosave-VPORYJSE.js → autosave-GI3WNJYN.js} +1 -1
- package/dist/m/core/{conflict-notice-JMAZLVRX.js → conflict-notice-CEI3XY6A.js} +1 -1
- package/dist/m/core/{save-AOJBDSOK.js → save-OJ5NSLS7.js} +1 -1
- package/dist/m/core/{save-core-IOCMXO5L.js → save-core-DX3RFVO3.js} +1 -1
- package/dist/m/core/{unsaved-warning-U5VUJFOE.js → unsaved-warning-HGYH7O4H.js} +1 -1
- package/dist/m/internals/{index-HDRANDWE.js → index-V4WC44FU.js} +1 -1
- package/dist/m/loader-V6VI46HU.js +1 -0
- package/dist/m/{manifest-5498AFD3.js → manifest-83C18DED.js} +1 -1
- package/dist/m/{manifest-edit-62A5A00F.js → manifest-edit-B28C1985.js} +1 -1
- package/dist/m/manifest.json +553 -553
- package/dist/m/page/{editor-EY2WAAGB.js → editor-BQEPCJLG.js} +2 -2
- package/dist/m/plugins/ai-edit-45A2J6LC.js +6 -0
- package/dist/m/plugins/cms-IFTKWF4S.js +2235 -0
- package/dist/m/plugins/{indicator-4VDXWYTD.js → indicator-IPZJ35K6.js} +1 -1
- package/dist/m/plugins/{live-5EZN2EYP.js → live-GPQXSXSM.js} +1 -1
- package/dist/m/plugins/{menu-DM2JHPSR.js → menu-UN3KRCOF.js} +1 -1
- package/dist/m/plugins/{page-LVW5DWA4.js → page-BAVLWCP6.js} +2 -2
- package/dist/m/plugins/{page-view-5KQ76IJB.js → page-view-P3UGJFDZ.js} +1 -1
- package/dist/m/plugins/{people-C7TVBBMR.js → people-Z4RGVQAV.js} +1 -1
- package/dist/m/plugins/{quickcrop-BQ5YYFCH.js → quickcrop-E34PUYA3.js} +2 -2
- package/dist/m/plugins/{richclay-KLGETK77.js → richclay-S4NVJYIK.js} +2 -2
- package/dist/m/plugins/{source-CCEUM3OR.js → source-KVN6YNTY.js} +1 -1
- package/dist/m/plugins/{upgrade-NW556WJD.js → upgrade-KTSICB22.js} +1 -1
- package/dist/m/plugins/{wire-VRYPY6EJ.js → wire-SYVIBNSE.js} +1 -1
- package/dist/m/{reader-core-2GXY7SHY.js → reader-core-RUIFH32Y.js} +2 -2
- package/dist/m/sync/{live-sync-SKPMFYOO.js → live-sync-RGQMMWK2.js} +1 -1
- package/dist/m/ui/{index-QNIPDHXQ.js → index-EZGLEM5P.js} +1 -1
- package/dist/offline-manifest.json +442 -448
- package/docs/guide.md +2 -2
- package/package.json +2 -2
- package/src/loader-logic.js +4 -1
- package/src/plugins/ai-edit.js +6 -17
- package/src/plugins/cms.js +3 -6
- package/src/ui/bevel.js +1 -1
- package/src/ui/skins/cms.js +1 -1
- package/src/ui/skins/quickcrop.js +1 -1
- package/src/ui/skins/richclay.js +1 -1
- package/src/vendor/hypercms.vendor.js +16 -69
- package/dist/m/c-FSWRGBVQ.js +0 -1
- package/dist/m/c-HMYWIHFG.js +0 -1
- package/dist/m/c-M6FNQCTQ.js +0 -1
- package/dist/m/c-WFMRX5RZ.js +0 -1
- package/dist/m/loader-ZVPK4ZN3.js +0 -1
- package/dist/m/plugins/ai-edit-J5VLSW5I.js +0 -6
- package/dist/m/plugins/cms-LRAOZHT7.js +0 -2293
- package/src/ui/skins/cms-toggle.js +0 -15
- /package/dist/m/plugins/{quickcrop-BQ5YYFCH.js.LEGAL.txt → quickcrop-E34PUYA3.js.LEGAL.txt} +0 -0
- /package/dist/m/plugins/{richclay-KLGETK77.js.LEGAL.txt → richclay-S4NVJYIK.js.LEGAL.txt} +0 -0
package/dist/m/c-FSWRGBVQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e}from"./c-W23KVGUO.js";import"./c-BRLCTNMC.js";import"./c-QHWJ5ZIJ.js";import"./c-RG6XUZFA.js";import"./c-UL2YUY52.js";import"./c-QY7F6EN6.js";import"./c-CJFDLD43.js";import"./c-BJ7YQ5QZ.js";import"./c-4JZDZFF6.js";import"./c-VAK7SG37.js";import"./c-MHI3GYKF.js";import"./c-46XYM55L.js";import"./c-NUHP2XDB.js";import"./c-VKEDWYDF.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";export{a as ask,b as consent,e as init,d as snippet,c as tell};
|
package/dist/m/c-HMYWIHFG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./c-BRLCTNMC.js";import"./c-QHWJ5ZIJ.js";import"./c-CJFDLD43.js";import"./c-BJ7YQ5QZ.js";import"./c-4JZDZFF6.js";import"./c-VAK7SG37.js";import"./c-MHI3GYKF.js";import"./c-46XYM55L.js";import"./c-NUHP2XDB.js";import"./c-VHNSBD2M.js";export{a as SURFACE_THEME,b as default};
|
package/dist/m/c-M6FNQCTQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"./c-CJFDLD43.js";import"./c-BJ7YQ5QZ.js";import"./c-4JZDZFF6.js";import"./c-VAK7SG37.js";import"./c-MHI3GYKF.js";import"./c-NUHP2XDB.js";import"./c-VHNSBD2M.js";export{c as bevelDialog,a as dismissOf,b as keepFocusIn};
|
package/dist/m/c-WFMRX5RZ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as b,b as c,c as d,d as e,e as f}from"./c-EOCKLMKX.js";import{g as a}from"./c-SJPD46ZO.js";import"./c-EXKHPOVC.js";import"./c-L5VFATT6.js";import"./c-XQSXKIKM.js";import"./c-67ILSNPR.js";import"./c-W4JCVLAB.js";import"./c-7K4SCQB7.js";import"./c-WMRJKQ2V.js";import"./c-44B5ODN7.js";import"./c-QIXT3Q7C.js";import"./c-E4IBSAQM.js";import"./c-57XDY6HC.js";import"./c-I2SCCUEW.js";import"./c-VHNSBD2M.js";export{e as ChartView,d as chartFromSlash,a as chartTables,b as insertChartAfterTable,f as refreshCharts,c as tableLabel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as W}from"./c-46XYM55L.js";import{a as J}from"./c-RS77ODLY.js";import"./c-7SWMYKAI.js";import{b as V}from"./c-FILLTJA7.js";import{a as $}from"./c-VKEDWYDF.js";import"./c-UGHH4MB3.js";import"./c-LA2BW7UY.js";import"./c-IJUK2GPW.js";import{b as F}from"./c-CYWLPPUS.js";import{i as H}from"./c-VG5XIN4T.js";import{a as G}from"./c-2YYDMLNZ.js";import{c as B,l as z}from"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var X={always:["lib/mutation.js","core/preserve-authored.js","core/edit-mode.js","core/mode-key.js","core/stale-host-notice.js","core/page-data.js"],editOnly:["core/snapshot.js","core/persist.js","core/admin-attrs.js","core/save-core.js","core/save.js","core/conflict-notice.js","core/recovery.js","core/unsaved-warning.js","core/autosave.js","attrs/save-freeze.js","attrs/onaftersave.js","attrs/refetch-on-save.js","attrs/add-from.js","lib/cache-bust.js"]},w={richclay:{path:"plugins/richclay.js",editOnly:!0,default:!0},indicator:{path:"plugins/indicator.js",editOnly:!0,default:!1},sync:{path:"sync/live-sync.js",editOnly:!1,default:!1},live:{path:"plugins/live.js",editOnly:!1,default:!1},page:{path:"plugins/page.js",editOnly:!0,default:!1},"page-view":{path:"plugins/page-view.js",editOnly:!1,default:!1,internal:!0},sortable:{path:"plugins/sortable.js",editOnly:!0,default:!1},undo:{path:"plugins/undo.js",editOnly:!0,default:!1},unsent:{path:"plugins/unsent.js",editOnly:!0,default:!1},cms:{path:"plugins/cms.js",editOnly:!1,default:!1},quickcrop:{path:"plugins/quickcrop.js",editOnly:!1,default:!1},upload:{path:"plugins/upload.js",editOnly:!0,default:!1},people:{path:"plugins/people.js",editOnly:!1,default:!1},menu:{path:"plugins/menu.js",editOnly:!1,default:!1},wire:{path:"plugins/wire.js",editOnly:!1,default:!1},message:{path:"plugins/message.js",editOnly:!1,default:!1},like:{path:"plugins/like.js",editOnly:!1,default:!1},"ai-edit":{path:"plugins/ai-edit.js",editOnly:!0,default:!1},demo:{path:"plugins/demo.js",editOnly:!1,default:!1},source:{path:"plugins/source.js",editOnly:!0,default:!0},"visitor-drafts":{path:"plugins/visitor-drafts.js",ownerPath:"plugins/visitor-drafts-owner.js",editOnly:!1,default:!1},"bind-text":{path:"plugins/bind-text.js",editOnly:!0,default:!1},derive:{path:"plugins/derive.js",editOnly:!1,default:!1},upgrade:{path:"plugins/upgrade.js",editOnly:!1,default:!1}},b={"core/is-edit-mode.js":()=>import("./core/is-edit-mode-GCX6767E.js"),"core/draft-mode.js":()=>import("./core/draft-mode-WSQAT67S.js"),"lib/region-policy.js":()=>import("./lib/region-policy-KWBPROWF.js"),"lib/mutation.js":()=>import("./reader-core-2GXY7SHY.js").then(t=>t.core["lib/mutation.js"]),"core/edit-mode.js":()=>import("./reader-core-2GXY7SHY.js").then(t=>t.core["core/edit-mode.js"]),"core/mode-key.js":()=>import("./reader-core-2GXY7SHY.js").then(t=>t.core["core/mode-key.js"]),"core/stale-host-notice.js":()=>import("./reader-core-2GXY7SHY.js").then(t=>t.core["core/stale-host-notice.js"]),"core/page-data.js":()=>import("./reader-core-2GXY7SHY.js").then(t=>t.core["core/page-data.js"]),"core/preserve-authored.js":()=>import("./reader-core-2GXY7SHY.js").then(t=>t.core["core/preserve-authored.js"]),"core/snapshot.js":()=>import("./core/snapshot-O7II2AGG.js"),"core/save-core.js":()=>import("./core/save-core-IOCMXO5L.js"),"core/save.js":()=>import("./core/save-AOJBDSOK.js"),"core/conflict-notice.js":()=>import("./core/conflict-notice-JMAZLVRX.js"),"core/recovery.js":()=>import("./core/recovery-DRFZRJED.js"),"core/unsaved-warning.js":()=>import("./core/unsaved-warning-U5VUJFOE.js"),"core/persist.js":()=>import("./core/persist-3OPWJKZS.js"),"core/admin-attrs.js":()=>import("./core/admin-attrs-ZG7R5V3E.js"),"core/autosave.js":()=>import("./core/autosave-VPORYJSE.js"),"attrs/save-freeze.js":()=>import("./attrs/save-freeze-MTFVVYV5.js"),"attrs/onaftersave.js":()=>import("./attrs/onaftersave-OKSWEJQF.js"),"attrs/refetch-on-save.js":()=>import("./attrs/refetch-on-save-DPGJJMGN.js"),"attrs/add-from.js":()=>import("./attrs/add-from-T5LJXFFI.js"),"lib/cache-bust.js":()=>import("./lib/cache-bust-NH7VBWHO.js"),"plugins/richclay.js":()=>import("./plugins/richclay-KLGETK77.js"),"plugins/indicator.js":()=>import("./plugins/indicator-4VDXWYTD.js"),"sync/live-sync.js":()=>import("./sync/live-sync-SKPMFYOO.js"),"plugins/live.js":()=>import("./plugins/live-5EZN2EYP.js"),"plugins/page.js":()=>import("./plugins/page-LVW5DWA4.js"),"plugins/page-view.js":()=>import("./plugins/page-view-5KQ76IJB.js"),"plugins/sortable.js":()=>import("./plugins/sortable-WJZZBM7R.js"),"plugins/undo.js":()=>import("./plugins/undo-3JEYK5QY.js"),"plugins/unsent.js":()=>import("./plugins/unsent-OA4RGBUT.js"),"plugins/cms.js":()=>import("./plugins/cms-LRAOZHT7.js"),"plugins/quickcrop.js":()=>import("./plugins/quickcrop-BQ5YYFCH.js"),"plugins/upload.js":()=>import("./plugins/upload-TTCQRIM5.js"),"plugins/people.js":()=>import("./plugins/people-C7TVBBMR.js"),"plugins/menu.js":()=>import("./plugins/menu-DM2JHPSR.js"),"plugins/wire.js":()=>import("./plugins/wire-VRYPY6EJ.js"),"plugins/message.js":()=>import("./plugins/message-LQ6EDH4V.js"),"plugins/like.js":()=>import("./plugins/like-EV7MTZ56.js"),"plugins/ai-edit.js":()=>import("./plugins/ai-edit-J5VLSW5I.js"),"plugins/demo.js":()=>import("./plugins/demo-42BSYQ7T.js"),"plugins/visitor-drafts.js":()=>import("./plugins/visitor-drafts-2AWNT23K.js"),"plugins/visitor-drafts-owner.js":()=>import("./plugins/visitor-drafts-owner-MZP45XSG.js"),"plugins/bind-text.js":()=>import("./plugins/bind-text-NX46N5UV.js"),"plugins/source.js":()=>import("./plugins/source-CCEUM3OR.js"),"plugins/derive.js":()=>import("./plugins/derive-QVI3LI3A.js"),"plugins/upgrade.js":()=>import("./plugins/upgrade-NW556WJD.js")},ie=["visitor-drafts","richclay","indicator","sortable","undo","unsent","quickcrop","upload","people","menu","upgrade","cms","page-view","sync","live","page","message","like","wire","ai-edit","demo","derive","bind-text","source"],re={cms:["quickcrop","upload"],"ai-edit":["wire"],page:["live","sync","upload"]},ae={page:["richclay"]},ce=new Set(["source","sortable","menu","upgrade"]);function K(t,e,o,s){let u=t.get(e);if(u)for(let n of u.split(",")){let r=n.trim();if(r){if(!w[r]||w[r].internal){console.warn(`clayjs: unknown plugin "${r}"`);continue}s(o,r)}}}var le=["sync","live","page","upload","quickcrop","cms","people","menu","upgrade","wire","ai-edit","demo","source"],ue=["attrs/refetch-on-save.js","core/conflict-notice.js"],de="https://hyperclay.com/templates/";function P(t,e,{isDraftMode:o=!1,hasSap:s=!1,hasVariants:u=!1,canEdit:n=!1,templateSource:r=null}={}){let g=[...X.always];e&&g.push(...X.editOnly);let m=new Set;K(t,"plugins",m,(i,l)=>i.add(l));let a=new Set;K(t,"exclude",a,(i,l)=>i.add(l));let d=new Set(m);for(let[i,l]of Object.entries(w))l.default&&d.add(i);s&&d.add("derive"),u&&(e||n)&&d.add("menu"),a.has("wire")&&d.delete("ai-edit"),!e&&!o&&d.has("page")&&d.add("page-view");for(let i of[...d])if(!a.has(i)&&!(w[i].editOnly&&!e))for(let l of re[i]||[])d.add(l);for(let i of a)d.delete(i);if(o){for(let i of le)d.delete(i);for(let i of ue){let l=g.indexOf(i);l>-1&&g.splice(l,1)}d.add("visitor-drafts")}!o&&n&&!a.has("upgrade")&&r&&r.startsWith(de)&&d.add("upgrade");for(let[i,l]of Object.entries(ae))if(d.has(i))for(let v of l)m.has(v)||d.delete(v);let c=[],h=[];for(let i of ie){if(!d.has(i))continue;let l=w[i];l.editOnly&&!e||(ce.has(i)?h:c).push(l.ownerPath&&!o?l.ownerPath:l.path)}return{core:g,plugins:c,late:h}}var C="data-deleted-at",R=(t,e)=>window.clay?.undo?.commit?window.clay.undo.commit(t,e):e(),Q=(t,e)=>t.dispatchEvent(new CustomEvent(e,{bubbles:!0})),I=Object.assign((t,{at:e=new Date().toISOString()}={})=>(R("Move to Trash",()=>t.setAttribute(C,e)),Q(t,"clay:trashed"),{undo:()=>I.restore(t)}),{is:t=>!!t.getAttribute(C),restore(t){R("Restore",()=>t.removeAttribute(C)),Q(t,"clay:restored")},purge(t){R("Delete forever",()=>t.remove())}});var Y=50,pe=1e3,fe='[clay~="no-snapshot"], [no-snapshot], [snapshot-remove]',k=0,ge=t=>{let e=t.nodeType===1?t:t.parentElement;if(!e)return"a detached node";let o=e.localName;return e.id?o+="#"+e.id:e.classList.length&&(o+="."+[...e.classList].slice(0,2).join(".")),"<"+o+">"};function me(t){let e=window.clay?.region?.resolveRegionPolicy;if(!e)return null;let o=s=>!!s&&!s.closest(fe)&&e(s).dirtyTracked;for(let s of t){if(s.type==="attributes"&&z(s.attributeName,s.target))continue;let u=s.target.nodeType===1?s.target:s.target.parentElement;if(o(u)&&!(s.type==="childList"&&![...s.addedNodes,...s.removedNodes].some(n=>n.nodeType!==1||o(n))))return s.target}return null}function _(t){let e=window.clay,o=e.Mutation,s=new Set,u=(y,p)=>{s.has(y)||(s.add(y),console.warn("clay.effect: "+p))},n=!1,r=!1,g=0,m=0;k&&e.isEditMode&&console.warn("clay.effect: an effect was created inside another effect, so a new one starts on every run. Create effects once, in clay.start.");let a=()=>{let y=Date.now();y-g>pe&&(g=y,m=0),++m>Y&&u("loop",`this effect ran more than ${Y} times in a second. Something keeps changing the document, often a timer or async callback the effect started.`)},d=()=>{if(n=!1,r)return;let y=null;o.pause(),k++;try{e.isEditMode===!0&&(a(),s.has("saved")||(y=new MutationObserver(()=>{}),y.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,characterData:!0})));let p=t();p&&typeof p.then=="function"&&(v(),console.error("clay.effect: fn returned a promise. It must be synchronous, so this effect was stopped."))}catch(p){console.error("clay.effect:",p)}finally{k--,o.resume();let p=y?y.takeRecords():[];if(y?.disconnect(),p.length){let O=me(p);O&&u("saved",`this effect changed ${ge(O)}, which is saved with the file. Effect writes never mark the page unsaved, so a merge can leave it dirty with no save scheduled. Draw derived values inside clay="no-dirty" or clay="editor-ui".`)}}},c=()=>{n||r||(n=!0,queueMicrotask(d))},h=["undo","redo"],i=()=>{for(let y of h)e.undo?.on?.(y,c)},l=o.onAnyChange({debounce:0,require:"observed"},c);document.addEventListener("clay:sync-applied",c),document.addEventListener("clay:modechange",i),i();let v=()=>{r=!0,l(),document.removeEventListener("clay:sync-applied",c),document.removeEventListener("clay:modechange",i);for(let y of h)e.undo?.off?.(y,c)};return c(),v}Object.defineProperty(_,"running",{get:()=>k>0});var he={overtype:()=>import("./c-PQ5LK6QE.js"),marked:()=>import("./c-XN6MBKI6.js"),highlight:()=>import("./c-33JJ6CBX.js"),"highlight/bash":()=>import("./c-KI7M4AY3.js"),"highlight/css":()=>import("./c-H4LG442Q.js"),"highlight/javascript":()=>import("./c-VDSS4K3Z.js"),"highlight/json":()=>import("./c-NRPJEVJS.js"),"highlight/python":()=>import("./c-5YIHJ3TJ.js"),"highlight/xml":()=>import("./c-WN5AY3OZ.js"),uimotion:()=>import("./c-B5CS55WR.js")};function ye(t){let e=new Map;function o(s){return Object.hasOwn(t,s)?(e.has(s)||e.set(s,t[s]().catch(u=>{throw e.delete(s),u})),e.get(s)):Promise.reject(new Error(`clay.assets: no asset named "${s}"`))}return{load:o,names:()=>Object.keys(t)}}var Z=ye(he);function L(t,e){if(!t||!e)return t;let o={...e,...t};for(let s of["entries","imports","bootImports"])o[s]={...e[s],...t[s]};return o}var je="plugins/page.js";function M(t,e,{isEditMode:o=!1,isDraftMode:s=!1,hasSapJs:u=!1}={},n=document){if(!t?.entries)return 0;let r=[...e];for(let c of e)for(let h of t.bootImports?.[c]??[])u&&h==="vendor/sap-core.vendor.js"||r.push(h);o&&!s&&r.push(...t.editBootImports??[]),o&&!s&&e.includes(je)&&r.push(...t.editorBootImports??[]);let g=new Set,m=c=>{if(!(!c||g.has(c))){g.add(c);for(let h of t.imports?.[c]??[])m(h)}};for(let c of r)m(t.entries[c]);let a=new Set([...n.querySelectorAll('link[rel="modulepreload"]')].map(c=>c.href)),d=0;for(let c of g){let h=new URL(c,t.base).href;if(a.has(h))continue;let i=n.createElement("link");i.rel="modulepreload",i.href=h,i.setAttribute("clay","no-save"),n.head.append(i),d++}return d}var E=Object.fromEntries(Object.entries(w).flatMap(([t,e])=>e.ownerPath?[[e.path,t],[e.ownerPath,t]]:[[e.path,t]])),j={},ee=new Set;function se(t){ee.has(t)||(ee.add(t),document.dispatchEvent(new CustomEvent("clay:plugin-ready",{detail:{plugin:E[t]}})))}var ve=(t,e,o,s)=>()=>t().then(u=>(M(L(e,u),[...o.core,...o.plugins,...o.late],{isEditMode:!0,hasSapJs:s}),u));function we(){return new Promise(t=>$(t))}function A(){let t=document.querySelector('meta[name="hyper-source"]');return t?t.getAttribute("content"):null}async function He(t,e,o,s=null,u=null,n=null){W(),(await b["core/draft-mode.js"]()).noteBootParams(e),await we();let g=await b["core/is-edit-mode.js"](),{isEditMode:m,isDraftMode:a,isOwner:d,siteVisibility:c,canEdit:h}=g;m&&!a&&import("./core/host-permission-6EVJGNPL.js").then(f=>f.checkHostPermission()).catch(()=>{}),window.__hyperclayEditMode=m;let i=await b["lib/region-policy.js"](),l=!!document.querySelector("[sap]"),v=document.querySelectorAll("head style[clay-variant]").length>=2,y=!!document.querySelector('script[src*="sap.js"]');G.holdSettle=l&&m;let p=P(e,m,{isDraftMode:a,hasSap:l,hasVariants:v,canEdit:h,templateSource:A()});p.plugins.includes("plugins/demo.js")&&g.commitModeFacts({destination:"demo"}),M(L(s,u),[...p.core,...p.plugins],{isEditMode:m,isDraftMode:a,hasSapJs:y}),(m||a)&&!u&&n&&n().then(f=>M(L(s,f),[...p.core,...p.plugins],{isEditMode:m,isDraftMode:a,hasSapJs:y})).catch(()=>{});let O,oe=new Promise(f=>{O=f}),ne={sync:p.plugins.includes("sync/live-sync.js")};for(let f of p.core)j[f]=await b[f](),j[f].install?.();if(Se(j,{isDraftMode:a,isOwner:d,siteVisibility:c},i),te(j),document.documentElement.getAttribute("clay-mode-switch")==="live"){let f=P(e,!0,{isDraftMode:a,hasSap:l,hasVariants:v,canEdit:h,templateSource:A()});j["core/edit-mode.js"].noteLiveSwitch({edit:f,view:P(e,!1,{isDraftMode:a,hasSap:l,hasVariants:v,canEdit:h,templateSource:A()}),loaded:j,modules:b,attach:(S,D)=>{N(S,D);let T=E[S],x=window.clay.plugins;T&&Array.isArray(x)&&!x.includes(T)&&(window.clay.plugins=Object.freeze([...x,T]))},attachEditCore:te,announce:se,loadEditHints:n?ve(n,s,f,y):null,late:oe})}await j["core/edit-mode.js"].activateInitialMode(),window.clay.plugins=Object.freeze([...p.plugins,...p.late].map(f=>E[f]));let U=m?p:P(e,!0,{isDraftMode:a,hasSap:l,hasVariants:v,canEdit:h,templateSource:A()});window.clay.editPlugins=Object.freeze([...U.plugins,...U.late].map(f=>E[f]));for(let f of p.plugins){let S;try{S=await b[f]()}catch(D){console.error(`clayjs: plugin "${f}" failed to load, continuing without it:`,D);continue}j[f]=S,f==="plugins/page-view.js"&&S.start(ne),N(f,S,j)}await Promise.allSettled(p.plugins.map(f=>j[f]?.ready).filter(Boolean)),l&&Oe(j),Ee(g),o(window.clay),document.dispatchEvent(new CustomEvent("clay:ready",{detail:{clay:window.clay}})),p.late.length?be(p.late,g).then(O,O):O()}var q=(t,e)=>w[E[t]]?.editOnly&&!e.startsAtImport();async function be(t,e){try{await window.clay.page?.ready}catch{}for(let o of t)if(!q(o,e))try{let s=await b[o]();if(q(o,e)||(j[o]=s,N(o,s,j),await s.ready,q(o,e)))continue;se(o)}catch(s){console.error(`clayjs: plugin "${o}" failed to load, continuing without it:`,s),document.dispatchEvent(new CustomEvent("clay:plugin-failed",{detail:{plugin:E[o]}}))}}function Oe(t){let e=t["core/save.js"],o=null;try{o=e?e.currentPaintSignature():null}catch(s){console.error("clayjs: could not read the page's painted values:",s)}try{window.Sap&&typeof window.Sap.mount=="function"&&window.Sap.mount()}catch(s){console.error("clayjs: the derive engine failed to mount:",s)}finally{e?.releaseBootSettle()}e&&o!=null&&e.schedulePaintHeal(o)}function Se(t,{isDraftMode:e,isOwner:o,siteVisibility:s},u){let n=window.clay,r=t["lib/mutation.js"],g=t["core/edit-mode.js"];Object.assign(n,{toggleEditMode:g.toggleEditMode,setMode:g.setMode,modeLifecycle:g.modeLifecycle,isDraftMode:e,isOwner:o,siteVisibility:s,Mutation:r.default,region:u.windowRegionShape});for(let a of["mode","isEditMode","canEdit"])Object.defineProperty(n,a,{get:()=>g[a],enumerable:!0,configurable:!0});n.assets=Z;let m=t["core/page-data.js"];n.readData=m.readData,n.writeData=m.writeData,n.ephemeral=B,n.storage=F,n.host={get versions(){return import("./c-ZRXJD4G6.js").then(a=>a.hostVersions())}},n.trash=I,n.derived=H,n.effect=_,n.style=J,n.morph=(a,d,c)=>V().then(({morph:h})=>h(a,d,c))}function te(t){let e=window.clay,o=t["core/save.js"];if(o){let r=o.savePage||o.default;r.force=o.savePageForce,r.overwrite=o.saveOverwritingConflict,r.flush=o.flushSave,r.soon=o.savePageSoon,r.limits=o.saveLimits,r.inspect=o.inspectSaveSize,e.save!==r&&typeof e.save?.replace=="function"&&(r.replace=e.save.replace),e.save!==r&&(e.save=r)}e.hasUnsavedChanges=t["core/unsaved-warning.js"]?.hasUnsavedChanges??e.hasUnsavedChanges??(()=>!1);let s=t["core/snapshot.js"];s&&(e.getHTML||(e.getHTML=s.getPageContents),e.addDocumentTransform||(e.addDocumentTransform=s.addDocumentTransform),e.onSnapshot||(e.onSnapshot=s.onSnapshot));let u=t["lib/cache-bust.js"];u&&!e.cacheBust&&(e.cacheBust=u.default);let n=t["core/recovery.js"];n&&!e.recovery&&(e.recovery=n.recovery)}function N(t,e,o=j){let s=window.clay;t==="plugins/undo.js"?s.undo=e.undo||e.default:t==="plugins/unsent.js"?s.unsent=e.unsent:t==="sync/live-sync.js"?(s.morph=e.morph,s.conflicts=e.conflicts,o["core/page-data.js"].setPageDataLiveSync(e.liveSync)):t==="plugins/live.js"?s.live=e.live:t==="plugins/page.js"?s.page=e.page:t==="plugins/upgrade.js"?(s.save=s.save||{},s.save.replace=e.replace):t==="plugins/cms.js"?s.cms=e.cms||e.default:t==="plugins/upload.js"?s.upload=e.upload||e.default:t==="plugins/people.js"?(s.people=e.people,s.author=e.author,Object.defineProperty(s,"me",{get:e.currentMe,configurable:!0,enumerable:!0})):t==="plugins/message.js"?s.message=e.message:t==="plugins/like.js"?s.like=e.like:t==="plugins/wire.js"?s.wire=e.wire||e.default:t==="plugins/ai-edit.js"?s.aiEdit=e.aiEdit||e.default:t==="plugins/demo.js"?s.demo=e.demo:t==="plugins/richclay.js"?s.RichClay=e.RichClay||e.default:t==="plugins/quickcrop.js"?s.quickcrop=e.quickcrop||e.default:t==="plugins/sortable.js"?s.sortable=e.sortable:t==="plugins/source.js"?s.source=e.source||e.default:t==="plugins/visitor-drafts.js"||t==="plugins/visitor-drafts-owner.js"?s.visitorDrafts=e.visitorDrafts:t==="plugins/bind-text.js"&&(s.bindText=e.bindText)}function Ee(t){t.isEditMode||document.addEventListener("click",e=>{e.target.closest?.("[trigger-save]")&&(t.isEditMode||(console.info("clayjs: you're not the owner of this page; changes stay local"),document.dispatchEvent(new CustomEvent("clay:view-save-attempt"))))})}export{He as boot,Oe as mountDerivedEngine};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{a as Ce}from"../c-AQYCG7QW.js";import{c as Se}from"../c-I2IFKJX2.js";import{e as $e,g as N,h as Be,j as ae,l as ve,n as Ee,p as Pe,q as d}from"../c-BJ7YQ5QZ.js";import{a as De}from"../c-4JZDZFF6.js";import{b as W,c as ye,d as re,e as w,f as Fe}from"../c-VAK7SG37.js";import{b as T}from"../c-MHI3GYKF.js";import{b as Ke}from"../c-TUGVINJR.js";import{a as le,b as We}from"../c-FILLTJA7.js";import{b as m}from"../c-NUHP2XDB.js";import"../c-TWCXBWS3.js";import{a as Ne}from"../c-VKEDWYDF.js";import{m as _e,n as se}from"../c-NLZ5AN4L.js";import"../c-4ASQPRQL.js";import"../c-GQ6F6IDK.js";import"../c-I2SCCUEW.js";import"../c-5VYOWDTI.js";import"../c-GSRLXYWL.js";import"../c-X5LNHET5.js";import"../c-WYFDLITL.js";import"../c-UGHH4MB3.js";import{a as xe}from"../c-LA2BW7UY.js";import"../c-GVPNDIKJ.js";import"../c-ATKAOH23.js";import"../c-EK63G3CG.js";import"../c-NQJRVJ56.js";import"../c-XGH4GS2T.js";import"../c-IJUK2GPW.js";import{k as He}from"../c-3O7OBDCM.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import"../c-EGTIAL6P.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import{h as J,o as Ie}from"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";var Ye="ai-edit",ft="h1,h2,h3,h4,h5,h6,p,figure",pt="p,h1,h2,h3,h4,h5,h6,li,dt,dd,blockquote,pre,figcaption,td,th",ht="section,article,aside,header,footer,nav,main,div,ul,ol,dl,table,figure,form",Je="script,style,template,textarea,input,select,button,iframe,svg,math",mt=900*1024,gt="This section is too large for AI editing; select a smaller part.",bt="The save did not finish; the edit is still on the page.",wt=0,a=null,r,g,c,y,E,h,b,v,L,D,$,B,R,F={},p=null,k=null,H=null,de=!1,ie=new WeakMap,ge=new Set,f=null,U=null,x=null,_,P,ue=null,C=null,z=null,A=null,Z=null,fe=[],q=null,Ae=0;function Xe(e){ie.delete(e),ge.delete(e)}function Me(e,t){if(!t){Xe(e);return}ie.set(e,t),ge.add(e)}var Qe="clay-ai-edit",qe="AI editing is turned off. Turn it on from the app\u2019s menu.";async function Ze(){let t=(await Se.helpers()).find(n=>n.name===Ye);return t&&(t.state==="ready"||t.state==="unavailable")?t.state:null}function xt(){xe.pause()}function Re(){xe.resume()}function ce(e){if(!(e instanceof Element))return null;let t=e.closest("[data-edit-id]");if(!t)return null;let n=e.closest(ft);return n&&t.contains(n)?n:t}function yt(e){if(e===document.body)return"document";let t=e.getAttribute("data-edit-id");if(t)return t;let n=e.closest("[data-edit-id]");return n?n.getAttribute("data-edit-id")+" \u203A "+e.tagName.toLowerCase():e.id?"#"+e.id:e.tagName.toLowerCase()}function be(){let e=window.getSelection();return!e||e.rangeCount===0||e.isCollapsed?null:e.getRangeAt(0)}function et(e){let t=e.commonAncestorContainer;if(t.nodeType!==1&&(t=t.parentElement),!t||!document.body.contains(t))return null;if(t===document.body)return document.body;if(t.closest("[data-clay-ai-edit]")||t.closest(J)||t.closest(Je))return null;if(t.closest("[data-edit-id]"))return ce(t);let n=t.closest(pt)||t.closest(ht);return n&&n!==document.body?n:null}function tt(e,t){if(!e||!t||!t.contains(e.commonAncestorContainer))return;let n=e.toString();if(!n.trim())return;let i=document.createRange();i.selectNodeContents(t),i.setEnd(e.startContainer,e.startOffset);let o=i.toString().length;return{text:n,start:o,end:o+n.length}}function pe(e){let t=be();if(t){if(e===document.body){let n=t.toString();return n.trim()?{text:n,start:void 0,end:void 0}:void 0}return tt(t,e)}}function nt(){let e=document.body.cloneNode(!0);return e.querySelectorAll(J).forEach(t=>t.remove()),e.outerHTML}function vt(e,t,n){let{HyperMorph:i}=le();return i.morph(e,t,{morphStyle:"outerHTML",restoreFocus:!0,scripts:n})}function he(e,t,{rewind:n=!1}={}){let{HyperMorph:i,mergeTagRecognizers:o}=le(),s=n?{merge:!1,handle:!1}:{mergeBase:e.snapshot,mergeTags:o,handle:!1};e.docMode?(typeof t=="string"&&(t=new DOMParser().parseFromString(t,"text/html").body),i.morph(document.body,t,{morphStyle:"outerHTML",restoreFocus:document.activeElement?.localName!=="clay-editor-ui",scripts:s,callbacks:{beforeNodeRemoved:l=>!(l.nodeType===1&&l.matches(J))}})):vt(e.el,t,s),Ke()}function Et(e,t){let n=e.search(new RegExp("<"+t+"(\\s|>)","i"));if(n===-1)return null;let i=e.slice(n).replace(/\s*`{1,3}\s*$/,"");if(t.toLowerCase()==="body")return new DOMParser().parseFromString(i,"text/html").body;let o=document.createElement("template");o.innerHTML=i;let s=o.content.firstElementChild;return!s||s.tagName.toLowerCase()!==t.toLowerCase()?null:s}function Ct(e,t,n){let i=e===document.body,o=[...t.matchAll(/(?<![\w\u00C0-\u024F.@\/:-])@([\w.-]*[/.][\w./-]*)/g)].map(u=>u[1].replace(/\.+$/,"")).filter(u=>u!=="page").filter(u=>/[/.]/.test(u)),s=i?nt():e.outerHTML,l={id:"req-"+Date.now().toString(36)+"-"+ ++wt,editId:yt(e),tag:e.tagName.toLowerCase(),elementHTML:s,comment:t,contextRefs:o};return n&&(l.quote=n.text,Number.isInteger(n.start)&&(l.selection={start:n.start,end:n.end})),!i&&/(?<![\w\u00C0-\u024F.@\/:-])@page(?![\w\/-]|\.\w)/.test(t)&&(l.page=!0),{id:l.id,el:e,docMode:i,tag:l.tag,reassertId:i?null:e.getAttribute("data-edit-id"),snapshot:s,payload:l,state:"requesting",paused:!1,handle:null,finalCandidate:null}}async function St(e,t,n){if(a=Ct(e,t,n),new Blob([JSON.stringify(a.payload)]).size>mt){a=null,me(gt,"warn");return}if(Me(e,t),Pt(),a.paused=!0,xt(),k={},te("working"),O("Sending\u2026"),a.payload.page&&await window.clay.save(),!a)return;let i=Se.send(a.payload,{helper:Ye,onStatus:({text:s})=>{a?.handle===i&&O(s)}});a.handle=i;let o=await i.done;!a||a.handle!==i||(await We(),!(!a||a.handle!==i)&&(o.state==="done"?kt(o.result||{}):o.state==="cancelled"?Q("HTML Clay stopped this edit."):Q(o.error||"the helper reported an error")))}var Tt=/^(on|hx-on|x-|@|:|v-on:|v-bind:|data-on[-:])/,Lt=new Set(["iframe","frame","object","embed","base","link"]);function At(e){let t=e.replace(/[\t\n\r]/g,"").replace(/^[\u0000- ]+/,"").toLowerCase();return t.startsWith("javascript:")||t.startsWith("vbscript:")}function Mt(e){let t=(e.getAttribute("type")||"").trim().toLowerCase();return!t||/javascript|ecmascript/.test(t)||["module","importmap","speculationrules"].includes(t)}function Te(e){return[...e.attributes].map(t=>t.name.toLowerCase()+"="+t.value).sort().join(" ")}function ze(e){let t=new Map,n=i=>t.set(i,(t.get(i)||0)+1);for(let i of[e,...e.querySelectorAll("*")]){let o=i.tagName.toLowerCase();o==="script"?Mt(i)&&n("script "+Te(i)+"|"+i.textContent.trim()):(Lt.has(o)||o==="meta"&&i.hasAttribute("http-equiv")||(o==="animate"||o==="set")&&/href/i.test(i.getAttribute("attributeName")||""))&&n(o+" "+Te(i));for(let s of i.attributes){let l=s.name.toLowerCase();Tt.test(l)?n(o+" "+l+"="+s.value.trim()):l==="srcdoc"?n(o+" srcdoc="+s.value):At(s.value)&&n(o+" "+l+"="+s.value)}}return t}function Rt(e,t,n){let i=n?new DOMParser().parseFromString(t,"text/html").body:(()=>{let s=document.createElement("template");return s.innerHTML=t,s.content.firstElementChild})(),o=i?ze(i):new Map;for(let[s,l]of ze(e))if(l>(o.get(s)||0))return!0;return!1}var Ot="The reply adds a script or event handler, so it was not applied. AI editing changes content, not code.";function kt(e){if(!a||a.state!=="requesting")return;a.state="deciding";let t=[],n=Et(e.html||"",a.tag);if(!n){Q(`reply is not a single <${a.tag}> element`);return}if(!a.docMode){let i=document.createElement("template");i.innerHTML=e.html||"",i.content.children.length>1&&t.push("reply had extra root elements \u2014 kept the first")}if(a.reassertId&&n.setAttribute("data-edit-id",a.reassertId),Rt(n,a.snapshot,a.docMode)){Q(Ot);return}_e(),a.held=!0,a.finalCandidate=n;try{he(a,n)}catch(i){Q("the reply could not be applied: "+(i?.message||i));return}S(),Xe(a.el),te("ready"),O(Ht(t,e.model),t.length?"warn":"")}function Ht(e,t){let n=["Edit ready.",...e.map(i=>"\u26A0 "+i)];return t&&n.push(`(${t})`),n.join(" ")}function Q(e){a&&(oe(),te("error"),O(e,"warn"))}function oe(){let e=a;if(a=null,!!e)try{(e.state==="requesting"||e.state==="deciding")&&le()&&he(e,e.snapshot,{rewind:!0})}finally{e.paused&&Re(),e.held&&se(),S()}}async function it(){let e=a;if(!e)return;a=null;let t=e.docMode?nt():e.el.outerHTML;try{he(e,e.snapshot,{rewind:!0})}finally{e.paused&&Re(),e.held&&se({replay:!1})}he(e,t),S(),te("saving"),O("Saving\u2026");let n=k,i=await window.clay.save();if(n===k){if(i&&i.ok===!1){te("error"),O(i.msg||bt,"warn");return}O(i&&i.msg||"Saved",i&&i.msgType==="error"?"warn":""),Bt()}}function ot(){a?.handle?.cancel(),oe(),V()}var Ge=["z-index:99999","padding:0","display:inline-grid","place-items:center","line-height:1",`box-shadow:${re}`];function K(e,t,n){return e.setAttribute(t,n),e}function It(){let{signal:e}=Z;q=document.createElement("style"),q.setAttribute("clay",$e),q.textContent=`
|
|
2
|
-
[editmode\\:contenteditable][contenteditable]:focus {
|
|
3
|
-
outline: 1px solid #4a4a6a; outline-offset: 4px; border-radius: 2px;
|
|
4
|
-
}
|
|
5
|
-
::highlight(clay-ai-edit) { background-color: ${w["brass-soft"]} !important; }
|
|
6
|
-
`,document.head.appendChild(q);let t=`color-scheme:${De()}`;g=K(ae("div",["box-sizing:content-box","position:fixed","z-index:99998","pointer-events:none",`border:2px solid ${w.brass}`,"border-radius:0",t]),"data-clay-ai-edit","ring"),d(g,!1),r=K(ve("div",["position:fixed","z-index:99999","width:min(28rem, calc(100vw - 32px))","padding:12px","border-radius:12px",`box-shadow:${re}`,`font:13px/1.5 ${W}`,t]),"data-clay-ai-edit","panel"),d(r,!1),r.setAttribute("role","dialog"),r.setAttribute("aria-label","AI edit");let n=(u,M)=>K(u,"data-clay-ai-edit-part",M);E=n(ae("div",["position:absolute","width:12px","height:12px","pointer-events:none",`background:${w.surface}`,`border-left:1px solid ${w["line-2"]}`,`border-top:1px solid ${w["line-2"]}`]),"pointer"),d(E,!1),c=n(Pe("textarea",{rules:["flex:1","min-width:0","min-height:40px","max-height:9.5em","resize:none","overflow-y:auto","padding:8px 12px",`font:15px/1.45 ${W}`]}),"input"),c.rows=1,c.placeholder="Describe the change",c.setAttribute("aria-label","Describe the change"),c.title="Enter sends \xB7 Shift+Enter adds a line \xB7 @fable or @codex picks another agent \xB7 @file.ext adds context",y=n(Ee("div",["display:block","margin-top:0",`color:${w.muted}`,`font:12.5px/1.5 ${ye}`]),"status"),y.setAttribute("role","status"),y.setAttribute("aria-live","polite"),F.send=n(N("Send",{variant:"primary",extra:["min-height:40px","flex:none"]}),"send"),d(F.send,!0,"inline-flex");let i=ae("div",["display:flex","align-items:flex-start","gap:8px"]);i.append(c,F.send),r.append(E,i,y),v=K(ve("div",["position:fixed","left:50%","bottom:16px","transform:translateX(-50%)","z-index:99999","width:min(35rem, calc(100vw - 32px))","padding:8px 10px","border-radius:12px","gap:8px","align-items:center",`box-shadow:${re}`,`font:13px/1.5 ${W}`,t]),"data-clay-ai-edit","status-bar"),d(v,!1,"flex"),L=n(Ee("div",["display:block","flex:1","min-width:0","overflow:hidden","text-overflow:ellipsis","white-space:nowrap",`color:${w.muted}`,`font:12.5px/1.5 ${ye}`]),"bar-status"),L.setAttribute("role","status"),L.setAttribute("aria-live","polite"),D=n(N("Stop",{extra:["flex:none"]}),"bar-stop"),$=n(N("Keep",{variant:"primary",extra:["flex:none"]}),"bar-keep"),B=n(N("Revert",{variant:"quiet",extra:["flex:none"]}),"bar-revert"),R=n(Be(Fe.toastClose,{label:"Dismiss error"}),"bar-close"),R.pin({flex:"none"});for(let u of[D,$,B,R])d(u,!1,"inline-flex");v.append(L,D,$,B,R),h=K(N("AI",{small:!0,extra:["position:fixed","width:26px","height:26px",`font:600 11px/1 ${W}`,...Ge,t]}),"data-clay-ai-edit","chip"),h.title="Comment on this (\u2318J)",d(h,!1,"inline-grid"),b=K(N("AI",{extra:["position:fixed","width:40px","height:40px",`font:600 14px/1 ${W}`,...Ge,t]}),"data-clay-ai-edit","bubble"),b.title="Comment on the whole page",Le(),document.body.append(g,r,v,h,b),G(),F.send.addEventListener("click",Ve),D.addEventListener("click",ot),$.addEventListener("click",it),B.addEventListener("click",()=>{oe(),V()}),R.addEventListener("click",()=>{p==="error"&&V()}),c.addEventListener("keydown",u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),F.send.hidden||Ve())}),c.addEventListener("input",ee),h.addEventListener("mousedown",u=>u.preventDefault()),h.addEventListener("click",()=>{let u=U,M=P;j(),u&&!a&&!p&&ne(u,M||pe(u))}),b.addEventListener("click",()=>{if(!(a||p)){if(!r.hidden&&f===document.body){c.value.trim()?c.focus():X();return}ne(document.body,pe(document.body))}}),window.addEventListener("scroll",()=>{S(),j()},{passive:!0,signal:e}),window.addEventListener("resize",()=>{Le(),r&&!r.hidden&&ee(),S()},{passive:!0,signal:e});let o=()=>{Le(),S()};document.addEventListener("hcms:open",()=>{o(),setTimeout(o,350)},{signal:e}),document.addEventListener("hcms:close",()=>{o(),setTimeout(o,350)},{signal:e});let s=new MutationObserver(u=>{G();let M=I=>[...I].some(Y=>Y.nodeType===1&&Y.hasAttribute("data-hcms-toggle-host"));u.some(I=>M(I.addedNodes)||M(I.removedNodes))&&o()});s.observe(document.body,{childList:!0}),fe.push(s);let l=new MutationObserver(()=>{f&&!f.isConnected&&st()});l.observe(document.body,{childList:!0,subtree:!0}),fe.push(l)}function rt(){f?.isConnected&&S()}function ee(){m(c,"height","auto"),c.value&&m(c,"height",c.scrollHeight+2+"px"),rt()}function G(){let e=b?.ownerDocument;if(!e)return;let t=!p&&A==="ready"&&!!e.querySelector("[data-edit-id]");d(b,t,"inline-grid"),t&&T(b)}function Nt(e){!e||typeof window.Highlight!="function"||!window.CSS?.highlights||window.CSS.highlights.set(Qe,new window.Highlight(e))}function we(){window.CSS?.highlights?.delete(Qe)}function at(){let e=A==="ready";c.disabled=!e,e?y.textContent===qe&&me(""):me(qe,"warn"),d(F.send,e,"inline-flex"),G()}function Ft(){Ze().then(e=>{r&&(A=e||"unavailable",!r.hidden&&!a?at():G())}).catch(()=>{})}function Le(){if(!b)return;let e=document.querySelector("[data-hcms-toggle-host]"),t=e&&e.getBoundingClientRect(),n=!!t&&t.width>0&&t.height>0;b.pin({right:n?`${Math.round((document.documentElement.clientWidth||window.innerWidth)-t.left+8)}px`:"16px",bottom:n?`${Math.round((document.documentElement.clientHeight||window.innerHeight)-t.bottom)}px`:"16px"}),T(b)}function Dt(e){clearTimeout(x),x=null,U=e,P=void 0;let t=e.getBoundingClientRect();h.pin({left:Math.min(t.right+8,window.innerWidth-34)+"px",top:Math.max(8,t.top)+"px"}),d(h,!0,"inline-grid"),T(h)}function j(){clearTimeout(x),x=null,d(h,!1,"inline-grid"),U=null,P=void 0}function je(){h.hidden||x||(x=setTimeout(j,400))}function $t(){if(a||p||!r.hidden||A!=="ready"||lt())return;let e=be(),t=e&&et(e),n=t&&tt(e,t);if(!n){P&&j();return}let i=typeof e.getClientRects=="function"?e.getClientRects():[],o=i.length?i[i.length-1]:t.getBoundingClientRect();clearTimeout(x),x=null,U=t,P=n,h.pin({left:Math.min(o.right+6,window.innerWidth-34)+"px",top:Math.max(8,o.top+o.height/2-13)+"px"}),d(h,!0,"inline-grid"),T(h)}function me(e,t){m(y,"margin-top",e?"8px":"0"),y.textContent=e||"",t==="warn"?y.setAttribute("data-tone","warn"):y.removeAttribute("data-tone"),m(y,"color",t==="warn"?w.ox:w.muted),rt()}function O(e,t){L.textContent=e||"",t==="warn"?L.setAttribute("data-tone","warn"):L.removeAttribute("data-tone"),m(L,"color",t==="warn"?w.ox:w.muted)}function te(e){clearTimeout(H),H=null;let t=!!p,n=document.activeElement;p=e;let i={working:[D],ready:[$,B],error:[R],saving:[]}[e]||[],o=[D,$,B,R];for(let l of o)d(l,i.includes(l),"inline-flex");j(),d(v,!0,"flex"),G(),S(),T(v);let s=i[0];s&&(!t||o.includes(n)&&!i.includes(n))&&s.focus({preventScroll:!0})}function Bt(){clearTimeout(H);let e=k;H=setTimeout(()=>{e&&e===k&&V()},1500)}function V(e){e!==void 0&&e!==k||(clearTimeout(H),H=null,k=null,r.hidden||Oe(),p=null,d(v,!1,"flex"),O(""),f=null,C=null,z=null,_=void 0,we(),d(r,!1),c.value="",d(g,!1),d(E,!1),G())}function S(){if(!f)return;if(!f.isConnected){st();return}if(f===document.body){if(d(g,!1),d(E,!1),r.hidden)return;let I=b.getBoundingClientRect(),Y=r.offsetWidth||480;m(r,"left",Math.max(16,Math.min((I.right||window.innerWidth-16)-Y,window.innerWidth-Y-16))+"px"),m(r,"top",Math.max(16,(I.top||window.innerHeight-56)-(r.offsetHeight||120)-12)+"px");return}let e=f.getBoundingClientRect();if(d(g,!!p||!_||!!a),m(g,"left",e.left-5+"px"),m(g,"top",e.top-5+"px"),m(g,"width",e.width+6+"px"),m(g,"height",e.height+6+"px"),r.hidden)return;let t=C&&C.startContainer.isConnected&&typeof C.getBoundingClientRect=="function"?C.getBoundingClientRect():null,n=t&&(t.width||t.height)?t:e,i=r.offsetWidth||480,o=Math.max(16,Math.min(n.left,window.innerWidth-i-16)),s=n.bottom+10,l=r.offsetHeight||120;s+l>window.innerHeight-16&&(s=Math.max(16,n.top-l-10)),m(r,"left",o+"px"),m(r,"top",s+"px");let u=s>=n.bottom,M=Math.max(14,Math.min(n.left+10-o,i-28));d(E,!0),m(E,"left",M+"px"),m(E,"top",u?"-7px":l-6+"px"),m(E,"transform",u?"rotate(45deg)":"rotate(225deg)")}function ne(e,t){!r.hidden&&f&&f!==e&&Oe();let n=t?be():null,i=document.activeElement;z=i&&i!==document.body&&!r.contains(i)?i:null,f=e,C=n?n.cloneRange():null,j(),d(r,!0),_=t;let o=t?t.text.trim().length>400?t.text.trim().slice(0,400)+"\u2026":t.text.trim():"";r.dataset.quote=o,me(""),c.value=ie.get(e)||"",Nt(C),at(),S(),ee(),T(r),T(g),c.focus(),Ft()}function Oe(){f&&Me(f,c.value)}function X(){a&&(a.handle?.cancel(),oe());let e=z,t=r.contains(document.activeElement);Oe(),f=null,C=null,z=null,_=void 0,we(),d(r,!1),d(g,!1),c.value="",ee(),t&&e&&e.isConnected&&e.focus({preventScroll:!0})}function Pt(){C=null,z=null,_=void 0,we(),d(r,!1),c.value="",ee(),S(),T(g)}function st(){let e=a;e&&(e.handle?.cancel(),oe()),V()}function Ve(){let e=c.value.trim();!e||!f||a||A!=="ready"||St(f,e,_)}var _t=/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent||"");function Wt(e){return!(_t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)||e.shiftKey||e.altKey||e.repeat||e.isComposing?!1:e.code==="KeyJ"||(e.key||"").toLowerCase()==="j"}function lt(){let e=Ce();return!e||e===document.body?!1:r&&r.contains(e)?!r.hidden:e.matches("input,textarea,select")}var Kt='[data-clay-modal], dialog[open], [aria-modal="true"]',qt='input,textarea,select,[contenteditable=""],[contenteditable="true"]';function zt(e){if(e.defaultPrevented||document.querySelector(Kt))return!1;let t=Ce();return!t||t===document.body||r.contains(t)||v.contains(t)?!0:t.isContentEditable===!0?!1:!t.matches(qt)}function Gt(){let{signal:e}=Z;document.addEventListener("pointerdown",n=>{de=r.contains(n.target)},{capture:!0,signal:e}),document.addEventListener("click",n=>{let i=de;if(de=!1,i||r.contains(n.target)||v.contains(n.target)||h.contains(n.target)||b.contains(n.target)||a||p)return;let o=n.target.closest?.("[data-edit-id]"),s=o?ce(n.target):null;if(o&&s===o){let l=!r.hidden&&o===f;r.hidden||X(),l||ne(o,pe(o))}else r.hidden||X()},{signal:e});let t=0;document.addEventListener("mousemove",n=>{let i=Date.now();if(i-t<80)return;if(t=i,a||p||!r.hidden){je();return}if(A!=="ready"||P)return;if(h.contains(n.target)){clearTimeout(x),x=null;return}let o=ce(n.target);o?Dt(o):je()},{signal:e}),document.addEventListener("keydown",n=>{if(Wt(n)){if(p||a||lt())return;f&&!f.isConnected&&X();let i=be(),o=i?et(i):null;if(!o){let s=window.getSelection(),l=s&&s.anchorNode;l&&l.nodeType!==1&&(l=l.parentElement),o=l&&ce(l)||U}if(!o)return;n.preventDefault(),ne(o,pe(o));return}if(n.key==="Escape"&&zt(n)){if(p==="working"){ot();return}if(p==="ready"){it();return}if(p==="error"){V();return}p||r.hidden||X()}},{signal:e}),document.addEventListener("selectionchange",()=>{clearTimeout(ue),ue=setTimeout($t,150)},{signal:e})}async function dt(){let e=++Ae;return A=await Ze(),e===Ae}function ct(){!A||r||(Z=new AbortController,It(),Gt())}async function ke(){!He()||r||await dt()&&ct()}function Ue(e){return e instanceof Element&&e.ownerDocument===document&&document.body.contains(e)&&!e.closest("[data-clay-ai-edit]")&&!e.closest(J)&&!e.closest(Ie)&&!e.closest(Je)}async function jt(e,{prompt:t}={}){return!Ue(e)||(await ke(),await new Promise(n=>setTimeout(n,0)),!r||a||p||!Ue(e))?!1:!r.hidden&&f===e?(c.focus(),!0):(typeof t=="string"&&!ie.has(e)&&Me(e,t),ne(e,null),!0)}function Vt(){Ae++;let e=a;a=null;try{e?.handle?.cancel(),e&&(e.paused&&Re(),e.held&&se())}catch{}clearTimeout(ue),ue=null,clearTimeout(x),x=null,clearTimeout(H),H=null,we(),Z?.abort(),Z=null;for(let t of fe)t.disconnect();fe=[];for(let t of[q,g,r,v,h,b])t?.remove();q=g=r=c=y=E=v=L=null,D=$=B=R=h=b=null,F={},p=null,k=null,f=null,C=null,z=null,_=void 0,U=null,P=void 0,de=!1,A=null,ie=new WeakMap,ge.clear()}function sn(){return{id:"clay:ai-edit",order:950,prepare(e={}){let t=e.initial===!0;return{ready:t?ut:dt(),enable(){t||ct()},quiesce(){let n=r&&!r.hidden&&c.value.trim()!==""||[...ge].some(o=>o.isConnected),i=[];if(a&&i.push(a.id),p==="saving"&&i.push("save"),n&&i.push("prompt"),!!i.length)throw Object.assign(new Error("clay.aiEdit: an edit here is still unresolved"),{code:"pending-input",pending:i})},resume(){},dispose(){Vt()}}}}}var ut=null;Ne(()=>{ut=ke().then(()=>{},()=>{})});var ln={init:ke,open:jt};export{ln as aiEdit,sn as aiEditParticipant,sn as modeParticipant};
|