galley-cms 0.1.0 → 0.1.2
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/README.md +3 -3
- package/dist/galley.mjs +2054 -1478
- package/dist/starters/astro-editorial/README.md +3 -11
- package/dist/starters/astro-editorial/src/galley/catalog-data.js +1 -1
- package/dist/starters/astro-editorial/src/galley/catalog.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/attribution.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/forms.js +2 -2
- package/dist/starters/astro-editorial/src/galley/client/providers/frame-post.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/galley.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/hubspot.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/mailto.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/marketo.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/pardot.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/salesforce.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/webhook.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/registry.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/types.d.ts +1 -1
- package/dist/starters/astro-editorial/src/galley/components/ConsentBanner.astro +1 -1
- package/dist/starters/astro-editorial/src/galley/components/Form.astro +1 -1
- package/dist/starters/astro-editorial/src/galley/components/Scripts.astro +1 -1
- package/dist/starters/astro-editorial/src/galley/components/index.js +1 -1
- package/dist/starters/astro-editorial/src/galley/forms/forms.css +1 -1
- package/dist/starters/astro-editorial/src/galley/forms/free-email-domains.js +1 -1
- package/dist/starters/astro-editorial/src/galley/forms/logic.js +1 -1
- package/dist/starters/astro-editorial/src/galley/forms/messages.js +1 -1
- package/dist/starters/astro-editorial/src/galley/forms/render.js +1 -1
- package/dist/starters/astro-editorial/src/galley/integration.js +1 -1
- package/dist/starters/astro-editorial/src/galley/kit.d.ts +1 -1
- package/dist/starters/astro-editorial/src/galley/mailto/config.js +1 -1
- package/dist/starters/astro-editorial/src/galley/mailto/runtime.gen.js +1 -1
- package/dist/starters/astro-editorial/src/galley/runtime/site-config.js +1 -1
- package/dist/starters/astro-editorial/src/galley/schema.js +1 -1
- package/dist/starters/astro-editorial/src/galley/scripts/banner.js +1 -1
- package/dist/starters/astro-editorial/src/galley/scripts/plan.js +1 -1
- package/dist/starters/astro-editorial/src/galley/scripts/runtime.gen.js +1 -1
- package/dist/starters/astro-editorial/src/galley/scripts/snippets.js +1 -1
- package/dist/starters/astro-editorial/src/galley/shared/glob.js +1 -1
- package/dist/starters/astro-editorial/src/galley/shared/markdown.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/config.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/content.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/crawlers.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/html.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/integration.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/markdown.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/page.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/site.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/structured.js +1 -1
- package/dist/starters/astro-saas/README.md +5 -7
- package/dist/starters/astro-saas/src/galley/catalog-data.js +1 -1
- package/dist/starters/astro-saas/src/galley/catalog.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/attribution.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/forms.js +2 -2
- package/dist/starters/astro-saas/src/galley/client/providers/frame-post.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/galley.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/hubspot.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/mailto.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/marketo.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/pardot.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/salesforce.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/webhook.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/registry.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/types.d.ts +1 -1
- package/dist/starters/astro-saas/src/galley/components/ConsentBanner.astro +1 -1
- package/dist/starters/astro-saas/src/galley/components/Form.astro +1 -1
- package/dist/starters/astro-saas/src/galley/components/Scripts.astro +1 -1
- package/dist/starters/astro-saas/src/galley/components/index.js +1 -1
- package/dist/starters/astro-saas/src/galley/forms/forms.css +1 -1
- package/dist/starters/astro-saas/src/galley/forms/free-email-domains.js +1 -1
- package/dist/starters/astro-saas/src/galley/forms/logic.js +1 -1
- package/dist/starters/astro-saas/src/galley/forms/messages.js +1 -1
- package/dist/starters/astro-saas/src/galley/forms/render.js +1 -1
- package/dist/starters/astro-saas/src/galley/integration.js +1 -1
- package/dist/starters/astro-saas/src/galley/kit.d.ts +1 -1
- package/dist/starters/astro-saas/src/galley/mailto/config.js +1 -1
- package/dist/starters/astro-saas/src/galley/mailto/runtime.gen.js +1 -1
- package/dist/starters/astro-saas/src/galley/runtime/site-config.js +1 -1
- package/dist/starters/astro-saas/src/galley/schema.js +1 -1
- package/dist/starters/astro-saas/src/galley/scripts/banner.js +1 -1
- package/dist/starters/astro-saas/src/galley/scripts/plan.js +1 -1
- package/dist/starters/astro-saas/src/galley/scripts/runtime.gen.js +1 -1
- package/dist/starters/astro-saas/src/galley/scripts/snippets.js +1 -1
- package/dist/starters/astro-saas/src/galley/shared/glob.js +1 -1
- package/dist/starters/astro-saas/src/galley/shared/markdown.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/config.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/content.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/crawlers.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/html.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/integration.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/markdown.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/page.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/site.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/structured.js +1 -1
- package/dist/starters/astro-starter/README.md +5 -13
- package/dist/starters/astro-starter/src/galley/catalog-data.js +1 -1
- package/dist/starters/astro-starter/src/galley/catalog.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/attribution.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/forms.js +2 -2
- package/dist/starters/astro-starter/src/galley/client/providers/frame-post.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/galley.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/hubspot.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/mailto.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/marketo.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/pardot.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/salesforce.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/webhook.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/registry.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/types.d.ts +1 -1
- package/dist/starters/astro-starter/src/galley/components/ConsentBanner.astro +1 -1
- package/dist/starters/astro-starter/src/galley/components/Form.astro +1 -1
- package/dist/starters/astro-starter/src/galley/components/Scripts.astro +1 -1
- package/dist/starters/astro-starter/src/galley/components/index.js +1 -1
- package/dist/starters/astro-starter/src/galley/forms/forms.css +1 -1
- package/dist/starters/astro-starter/src/galley/forms/free-email-domains.js +1 -1
- package/dist/starters/astro-starter/src/galley/forms/logic.js +1 -1
- package/dist/starters/astro-starter/src/galley/forms/messages.js +1 -1
- package/dist/starters/astro-starter/src/galley/forms/render.js +1 -1
- package/dist/starters/astro-starter/src/galley/integration.js +1 -1
- package/dist/starters/astro-starter/src/galley/kit.d.ts +1 -1
- package/dist/starters/astro-starter/src/galley/mailto/config.js +1 -1
- package/dist/starters/astro-starter/src/galley/mailto/runtime.gen.js +1 -1
- package/dist/starters/astro-starter/src/galley/runtime/site-config.js +1 -1
- package/dist/starters/astro-starter/src/galley/schema.js +1 -1
- package/dist/starters/astro-starter/src/galley/scripts/banner.js +1 -1
- package/dist/starters/astro-starter/src/galley/scripts/plan.js +1 -1
- package/dist/starters/astro-starter/src/galley/scripts/runtime.gen.js +1 -1
- package/dist/starters/astro-starter/src/galley/scripts/snippets.js +1 -1
- package/dist/starters/astro-starter/src/galley/shared/glob.js +1 -1
- package/dist/starters/astro-starter/src/galley/shared/markdown.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/config.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/content.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/crawlers.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/html.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/integration.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/markdown.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/page.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/site.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/structured.js +1 -1
- package/dist/starters/astro-storefront/README.md +3 -1
- package/dist/starters/astro-storefront/src/galley/catalog-data.js +1 -1
- package/dist/starters/astro-storefront/src/galley/catalog.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/attribution.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/forms.js +2 -2
- package/dist/starters/astro-storefront/src/galley/client/providers/frame-post.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/galley.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/hubspot.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/mailto.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/marketo.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/pardot.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/salesforce.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/webhook.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/registry.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/types.d.ts +1 -1
- package/dist/starters/astro-storefront/src/galley/components/ConsentBanner.astro +1 -1
- package/dist/starters/astro-storefront/src/galley/components/Form.astro +1 -1
- package/dist/starters/astro-storefront/src/galley/components/Scripts.astro +1 -1
- package/dist/starters/astro-storefront/src/galley/components/index.js +1 -1
- package/dist/starters/astro-storefront/src/galley/forms/forms.css +1 -1
- package/dist/starters/astro-storefront/src/galley/forms/free-email-domains.js +1 -1
- package/dist/starters/astro-storefront/src/galley/forms/logic.js +1 -1
- package/dist/starters/astro-storefront/src/galley/forms/messages.js +1 -1
- package/dist/starters/astro-storefront/src/galley/forms/render.js +1 -1
- package/dist/starters/astro-storefront/src/galley/integration.js +1 -1
- package/dist/starters/astro-storefront/src/galley/kit.d.ts +1 -1
- package/dist/starters/astro-storefront/src/galley/mailto/config.js +1 -1
- package/dist/starters/astro-storefront/src/galley/mailto/runtime.gen.js +1 -1
- package/dist/starters/astro-storefront/src/galley/runtime/site-config.js +1 -1
- package/dist/starters/astro-storefront/src/galley/schema.js +1 -1
- package/dist/starters/astro-storefront/src/galley/scripts/banner.js +1 -1
- package/dist/starters/astro-storefront/src/galley/scripts/plan.js +1 -1
- package/dist/starters/astro-storefront/src/galley/scripts/runtime.gen.js +1 -1
- package/dist/starters/astro-storefront/src/galley/scripts/snippets.js +1 -1
- package/dist/starters/astro-storefront/src/galley/shared/glob.js +1 -1
- package/dist/starters/astro-storefront/src/galley/shared/markdown.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/config.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/content.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/crawlers.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/html.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/integration.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/markdown.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/page.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/site.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/structured.js +1 -1
- package/dist/web/assets/{AppSettingsScreen-D9ZHXus9.js → AppSettingsScreen-Dc1Bnkjc.js} +1 -1
- package/dist/web/assets/{BodyEditor-DAJ8MM41.js → BodyEditor-sFGFYiy3.js} +1 -1
- package/dist/web/assets/BrandScreen-sRlTBAK2.js +1 -0
- package/dist/web/assets/{CollectionScreen-DVXLw7MF.js → CollectionScreen-B1Dk62it.js} +1 -1
- package/dist/web/assets/{EditorScreen-8vhIBZu1.js → EditorScreen-CzwKUTDg.js} +3 -3
- package/dist/web/assets/{FormsScreen-BbngAAzO.js → FormsScreen-DIAnSDOR.js} +2 -2
- package/dist/web/assets/{HistoryScreen-CubZj8QG.js → HistoryScreen-rlc0r8Mc.js} +3 -3
- package/dist/web/assets/ImportScreen-C7Ktj3md.js +1 -0
- package/dist/web/assets/InboxScreen-CfKusmcx.js +2 -0
- package/dist/web/assets/{MediaLibraryPane-jMuqbnLa.js → MediaLibraryPane-DTjjTvfl.js} +1 -1
- package/dist/web/assets/{MediaScreen-mg2CATkP.js → MediaScreen-DBLgSoRu.js} +1 -1
- package/dist/web/assets/{NewSiteScreen-D9zWX6oE.js → NewSiteScreen-B-KeJDBG.js} +1 -1
- package/dist/web/assets/Online-CFMXFfKL.js +1 -0
- package/dist/web/assets/{PluginsScreen-1qEv-u35.js → PluginsScreen-BpMt6QXM.js} +1 -1
- package/dist/web/assets/{PreviewPane-a06mELw4.js → PreviewPane-BhtgFkYG.js} +1 -1
- package/dist/web/assets/{ProofScreen-CZfFbHFS.js → ProofScreen-DJPRt15E.js} +1 -1
- package/dist/web/assets/{ProviderSettings-BOiCGeSI.js → ProviderSettings-CbQQdCdU.js} +1 -1
- package/dist/web/assets/{PublishDialog-CSKU1lfx.js → PublishDialog-DhytG_-7.js} +2 -2
- package/dist/web/assets/{ReachNote-CZYr1oL0.js → ReachNote-D-RSOg6l.js} +1 -1
- package/dist/web/assets/RedirectsScreen-CSdhCO4l.js +3 -0
- package/dist/web/assets/RedirectsScreen-DayIuauB.css +1 -0
- package/dist/web/assets/{ScriptsScreen-BXY-kqbq.js → ScriptsScreen-mAuVetAc.js} +2 -2
- package/dist/web/assets/{SiteHomeScreen-DOrqAteL.js → SiteHomeScreen-BNmf8jor.js} +1 -1
- package/dist/web/assets/{SiteSettingsScreen-B8xQnhjd.js → SiteSettingsScreen-CUJkP4Zt.js} +1 -1
- package/dist/web/assets/{SourceView-B5SoYjUF.js → SourceView-Dx9Hkcz6.js} +1 -1
- package/dist/web/assets/VisibilityScreen-0dqY5q9C.js +2 -0
- package/dist/web/assets/brand-ChGvDfhV.css +1 -0
- package/dist/web/assets/{codemirror-g0T4-Tsm.js → codemirror-BDN0rzm7.js} +1 -1
- package/dist/web/assets/index-A7aTfJ-x.js +10 -0
- package/dist/web/assets/{index-Pd8oyXqS.css → index-xTbHx1DQ.css} +1 -1
- package/dist/web/assets/{listPlan-BXud7Oxv.js → listPlan-Bds9RfG_.js} +1 -1
- package/dist/web/assets/{outside-DaBM5h5B.js → outside-1xNdvt-F.js} +1 -1
- package/dist/web/assets/{paths-C8ESZJVU.js → paths-C9eC1yfK.js} +1 -1
- package/dist/web/assets/{prefs-BcNyBxxO.js → prefs-BRO4YD9h.js} +1 -1
- package/dist/web/assets/{scaffold-BHkqc62J.js → scaffold-CA0oGKYi.js} +1 -1
- package/dist/web/assets/{usePlugins-acEOSN5a.js → usePlugins-D8UH3hzc.js} +1 -1
- package/dist/web/assets/{useVisibility-kpZhLMTT.js → useVisibility-DFye68F4.js} +3 -3
- package/dist/web/assets/words-CoSgsy_e.js +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +5 -5
- package/dist/web/assets/BrandScreen-BuYHSbp6.js +0 -1
- package/dist/web/assets/ImportScreen-eVAPjnE2.js +0 -1
- package/dist/web/assets/InboxScreen-Azqy6w4_.js +0 -2
- package/dist/web/assets/Online-bYUu0ETZ.js +0 -1
- package/dist/web/assets/RedirectsScreen-DeR_yuj5.js +0 -3
- package/dist/web/assets/RedirectsScreen-QTaAXMh-.css +0 -1
- package/dist/web/assets/VisibilityScreen-B4iOATC4.js +0 -2
- package/dist/web/assets/brand-BYux4UiC.css +0 -1
- package/dist/web/assets/index-Djh-DSIT.js +0 -10
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{$ as e,A as t,At as n,B as r,F as i,Ft as a,G as o,H as s,I as c,N as l,Nt as u,O as d,P as f,St as p,_ as m,_t as h,bt as g,c as _,ft as v,g as y,gt as b,h as x,ht as S,j as C,jt as w,k as T,mt as E,n as D,pt as O,v as k,vt as A,y as j,z as M}from"./ui-C6O2tW4c.js";import{a as N,n as P,o as F,s as I}from"./chrome-Brnq5kGb.js";import{o as L}from"./events-CTTFdOf-.js";import{a as R,c as z,d as B,f as V,i as H,l as U,m as ee,o as te,p as ne,r as re,s as ie,t as ae,u as W}from"./words-CoSgsy_e.js";import{n as oe,r as se,t as ce}from"./jobs-BHawhnH2.js";var G=a(u(),1),K={all:e=>[`site`,e,`redirects`],overview:e=>[`site`,e,`redirects`,`overview`],health:e=>[`site`,e,`redirects`,`health`]};function le(e){return I(K.overview(e),()=>M(`GET /api/sites/:siteId/redirects`,{params:{siteId:e}}))}function ue(e,t){return I(K.health(e),()=>M(`GET /api/sites/:siteId/redirects/health`,{params:{siteId:e}}),{enabled:t})}function q(e,t){F(K.overview(e),t),N(K.health(e))}async function J(e,t,n,r={}){try{let i=await M(`PUT /api/sites/:siteId/redirects`,{params:{siteId:e},body:{redirects:n,baseHash:t.hash}});if(q(e,i),r.undo){let{label:t,previous:n}=r.undo;D({tone:`success`,title:t,body:`It's waiting in Proof.`,action:{label:`Undo`,onClick:()=>{J(e,i,n).then(e=>{e&&D({tone:`success`,title:`Put back`})})}}})}return i}catch(t){let n=s(t);return D({tone:`danger`,title:`Couldn’t save the redirects`,body:n.message,detail:n.detail}),n.code===`conflict`&&N(K.all(e)),null}}function de(e,t,n){return r(`GET /api/sites/:siteId/redirects/export`,{siteId:e},{format:t,...n?{hostname:n}:{}})}var Y=g(),fe=`/old-page/, /new-page/
|
|
2
|
+
/2019/05/notes/ /blog/notes/ 301
|
|
3
|
+
https://www.example.com/team/ /about/`;function pe({problem:t,onResolve:n}){let[r,i]=(0,G.useState)(t.severity===`error`),a=t.severity===`error`?`danger`:t.severity===`warning`?`warning`:`info`;return(0,Y.jsxs)(`li`,{className:`redir-problem redir-problem--${a}`,children:[(0,Y.jsxs)(`div`,{className:`redir-problem__head`,children:[(0,Y.jsx)(e,{kind:t.severity===`info`?`stet`:`bang`,className:`redir-problem__mark`}),(0,Y.jsxs)(`div`,{className:`redir-problem__text`,children:[(0,Y.jsx)(`p`,{className:`redir-problem__title`,children:t.title}),(0,Y.jsx)(`p`,{className:`redir-problem__body`,children:t.body})]})]}),(0,Y.jsx)(`div`,{className:`redir-problem__resolve`,children:t.resolution&&t.resolution.options.length>1?(0,Y.jsx)(m,{label:t.title,value:t.resolution.value,options:t.resolution.options,onChange:e=>n(t.resolution.key,e)}):t.resolution?.options.length===1&&t.resolution.value!==t.resolution.options[0].value?(0,Y.jsx)(O,{size:`sm`,variant:t.severity===`error`?`primary`:`secondary`,onClick:()=>n(t.resolution.key,t.resolution.options[0].value),children:t.resolution.options[0].label}):t.resolution?.options.length===1?(0,Y.jsx)(_,{tone:`neutral`,mark:null,children:t.resolution.options[0].label}):null}),t.examples.length?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{type:`button`,className:`app-link-button redir-problem__toggle`,"aria-expanded":r,onClick:()=>i(!r),children:r?`Hide them`:t.count>t.examples.length?`Show the first ${t.examples.length}`:`Show them`}),r?(0,Y.jsx)(`ul`,{className:`redir-problem__examples`,children:t.examples.map((e,t)=>(0,Y.jsxs)(`li`,{children:[e.line===void 0?null:(0,Y.jsx)(`span`,{className:`redir-problem__line g-mono`,children:`Line ${e.line}`}),(0,Y.jsx)(`span`,{className:`g-mono redir-problem__from`,children:e.from}),e.to?(0,Y.jsx)(`span`,{className:`g-mono g-faint`,children:` → ${e.to}`}):null,e.detail?(0,Y.jsx)(`span`,{className:`redir-problem__detail`,children:e.detail}):null]},`${e.line??t}:${e.from}`))}):null]}):null]})}function me({review:e}){let t=e.preview.filter(e=>e.state!==`same`).slice(0,200);return t.length?(0,Y.jsxs)(`div`,{className:`redir-preview`,children:[(0,Y.jsx)(`p`,{className:`g-eyebrow`,children:`What will be added`}),(0,Y.jsx)(`div`,{className:`redir-preview__table`,role:`table`,"aria-label":`Redirects to be added`,children:t.map(e=>{let t=z(e.from),n=ie(e.to);return(0,Y.jsxs)(`div`,{role:`row`,className:`redir-preview__row`,children:[(0,Y.jsx)(`span`,{role:`cell`,children:e.state===`new`?(0,Y.jsx)(_,{tone:`insert`,children:`New`}):(0,Y.jsx)(_,{tone:`change`,children:`Changed`})}),(0,Y.jsxs)(`span`,{role:`cell`,className:`redir-cell`,title:e.from,children:[t.lead?(0,Y.jsxs)(`span`,{className:`redir-address__lead`,children:[t.lead,` `]}):null,(0,Y.jsx)(`span`,{className:`g-mono`,children:t.path})]}),(0,Y.jsx)(`span`,{role:`cell`,className:`redir-arrow`,"aria-label":`goes to`,children:`→`}),(0,Y.jsxs)(`span`,{role:`cell`,className:`redir-cell`,title:e.to,children:[(0,Y.jsx)(`span`,{className:`g-mono`,children:n.path}),n.tail?(0,Y.jsxs)(`span`,{className:`redir-address__lead`,children:[` `,n.tail]}):null]}),(0,Y.jsxs)(`span`,{role:`cell`,className:`redir-kind`,children:[R(e.status),` `,(0,Y.jsx)(`span`,{className:`redir-kind__code g-mono`,children:e.status})]})]},e.from)})}),e.counts.add+e.counts.change>t.length?(0,Y.jsx)(`p`,{className:`g-hint`,children:`And ${(e.counts.add+e.counts.change-t.length).toLocaleString()} more.`}):null]}):null}function he({siteId:n,open:r,onClose:a,overview:o,start:l}){let[u,d]=(0,G.useState)({text:``}),[f,p]=(0,G.useState)(`add`),[h,g]=(0,G.useState)({}),[_,v]=(0,G.useState)([]),[y,S]=(0,G.useState)(null),[C,w]=(0,G.useState)(null),[T,E]=(0,G.useState)(!1),[k,j]=(0,G.useState)(!1),[N,P]=(0,G.useState)(!1),F=(0,G.useRef)(null),I=(0,G.useRef)(0);(0,G.useEffect)(()=>{r&&(d(l?{path:l.path,label:l.label}:{text:``}),p(`add`),g({}),v([]),S(null),w(null))},[r,l]);let L=()=>({...u.path?{path:u.path}:{text:u.text??``},...u.filename?{filename:u.filename}:{},mode:f,resolutions:h,..._.length?{siteHosts:_}:{}});(0,G.useEffect)(()=>{if(!r)return;if(!u.path&&!(u.text??``).trim()){S(null);return}let e=++I.current,t=setTimeout(()=>{E(!0),M(`POST /api/sites/:siteId/redirects/review`,{params:{siteId:n},body:L()}).then(t=>{e===I.current&&(S(t),w(null))}).catch(t=>{e===I.current&&w(t)}).finally(()=>{e===I.current&&E(!1)})},u.path?0:350);return()=>clearTimeout(t)},[r,u,f,h,_,n]);let R=async e=>{e.size>20971520?w(Error(`That file is larger than 20 MB. Split it into smaller files.`)):d({text:await e.text(),filename:e.name,label:e.name})},z=e=>{e.preventDefault(),P(!1);let t=e.dataTransfer.files[0];t&&R(t)},B=async()=>{if(y){j(!0);try{let e=await M(`POST /api/sites/:siteId/redirects/import`,{params:{siteId:n},body:{...L(),baseHash:o.hash}});q(n,e.overview);let t=e.review.counts.add+e.review.counts.change;D({tone:`success`,title:t===1?`1 redirect added`:`${t.toLocaleString()} redirects added`,body:`They’re one change in Proof, with the host’s file updated beside them.`}),a()}catch(e){let t=s(e);D({tone:`danger`,title:`Couldn’t add the redirects`,body:t.message,detail:t.detail})}finally{j(!1)}}},V=y?y.counts.add+y.counts.change:0,H=!!(y&&y.blocking>0),U=!u.path&&!(u.text??``).trim();return(0,Y.jsx)(i,{open:r,onClose:a,size:`xl`,title:`Add many redirects`,description:`Paste a list, or drop a file: a spreadsheet, a _redirects file, .htaccess or nginx lines, a Cloudflare list. Nothing is added until you confirm.`,footer:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{variant:`secondary`,onClick:a,children:`Not now`}),(0,Y.jsx)(O,{variant:`primary`,busy:k,busyLabel:`Adding…`,disabled:!y||V===0||H||T,onClick:()=>void B(),children:y&&V>0?`Add ${W(V)}`:`Add redirects`})]}),children:(0,Y.jsxs)(`div`,{className:`redir-many`,children:[(0,Y.jsxs)(`div`,{className:`redir-many__source`,children:[u.path||u.filename?(0,Y.jsxs)(`div`,{className:`redir-many__file`,children:[(0,Y.jsx)(A,{name:`page`}),(0,Y.jsx)(`span`,{children:u.label??u.filename??u.path}),(0,Y.jsx)(O,{size:`sm`,variant:`quiet`,onClick:()=>d({text:``}),children:`Paste instead`})]}):(0,Y.jsxs)(`div`,{className:b(`redir-many__drop`,N&&`redir-many__drop--on`),onDragOver:e=>(e.preventDefault(),P(!0)),onDragLeave:()=>P(!1),onDrop:z,children:[(0,Y.jsx)(t,{mono:!0,rows:7,maxRows:14,value:u.text??``,placeholder:fe,"aria-label":`Redirects to add, one per line`,onChange:e=>d({text:e.target.value}),"data-autofocus":!0}),(0,Y.jsxs)(`div`,{className:`redir-many__actions`,children:[(0,Y.jsx)(O,{size:`sm`,variant:`secondary`,icon:`upload`,onClick:()=>F.current?.click(),children:`Choose a file…`}),(0,Y.jsx)(`span`,{className:`g-hint`,children:`or drop it here`}),(0,Y.jsx)(`input`,{ref:F,type:`file`,hidden:!0,accept:`.csv,.tsv,.txt,.json,.conf,.htaccess,.mjs,text/*`,onChange:e=>e.target.files?.[0]&&void R(e.target.files[0])})]})]}),o.imports.length&&!u.path?(0,Y.jsx)(`div`,{className:`redir-many__offers`,children:o.imports.map(e=>(0,Y.jsx)(O,{size:`sm`,variant:`quiet`,icon:`download`,onClick:()=>d({path:e.path,label:e.label}),children:`${e.label} (${e.count.toLocaleString()})`},e.path))}):null,(0,Y.jsx)(m,{label:`What to do with the list already here`,value:f,onChange:p,options:[{value:`add`,label:`Add to the list`},{value:`replace`,label:`Replace the list`}]})]}),(0,Y.jsx)(`div`,{className:`redir-many__review`,"aria-live":`polite`,"aria-busy":T,children:U?(0,Y.jsx)(`p`,{className:`redir-many__idle`,children:`One redirect per line: the old address, then the new one. Full addresses of this site are shortened to their path.`}):C&&!y?(0,Y.jsx)(c,{compact:!0,title:`Couldn’t read the list`,error:C}):y?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`redir-many__summary`,children:[(0,Y.jsx)(`strong`,{children:`Understood ${y.understood.toLocaleString()} ${y.understood===1?`line`:`lines`}`}),(0,Y.jsx)(`span`,{className:`g-faint`,children:` · ${y.formatLabel}`}),T?(0,Y.jsx)(x,{label:`Checking`}):null]}),(0,Y.jsxs)(`dl`,{className:`redir-tally`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:`New`}),(0,Y.jsx)(`dd`,{children:y.counts.add.toLocaleString()})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:`Changed`}),(0,Y.jsx)(`dd`,{children:y.counts.change.toLocaleString()})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:`Already there`}),(0,Y.jsx)(`dd`,{children:y.counts.same.toLocaleString()})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:`Left out`}),(0,Y.jsx)(`dd`,{children:y.counts.leftOut.toLocaleString()})]})]}),y.unknownHosts.length?(0,Y.jsx)(`div`,{className:`redir-many__hosts`,children:y.unknownHosts.slice(0,3).map(e=>(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(`span`,{children:`${e.count.toLocaleString()} old ${e.count===1?`address is`:`addresses are`} on `}),(0,Y.jsx)(`span`,{className:`g-mono`,children:e.host}),(0,Y.jsx)(`span`,{children:`. Is that this site?`}),` `,(0,Y.jsx)(O,{size:`sm`,variant:`secondary`,onClick:()=>v([..._,e.host]),children:`Yes, read them as this site’s`})]},e.host))}):null,y.problems.length?(0,Y.jsx)(`ul`,{className:`redir-problems`,children:y.problems.map(e=>(0,Y.jsx)(pe,{problem:e,onResolve:(e,t)=>g({...h,[e]:e===`missingStatus`?Number(t):t})},`${e.code}:${e.title}`))}):(0,Y.jsxs)(`p`,{className:`redir-many__clean`,children:[(0,Y.jsx)(e,{kind:`reg`}),` Every line reads cleanly.`]}),H?(0,Y.jsx)(`p`,{className:`redir-many__blocked`,role:`status`,children:`Loops can’t be added. Leave them out to continue.`}):null,(0,Y.jsx)(me,{review:y})]}):(0,Y.jsx)(x,{label:`Reading the list`})})]})})}var ge=`2026-11-23`,_e=`https://developers.cloudflare.com/workers/static-assets/redirects/`,ve=`https://developers.cloudflare.com/pages/configuration/redirects/`,ye=`https://developers.cloudflare.com/rules/url-forwarding/bulk-redirects/create-api/`,be=`https://docs.netlify.com/manage/routing/redirects/overview/`,xe=`https://docs.netlify.com/manage/routing/redirects/redirect-options/`,Se=`https://vercel.com/docs/project-configuration/vercel-json#redirects`,Ce=`https://vercel.com/docs/routing/redirects/configuration-redirects`,we=[`Open Cloudflare's API Tokens page (My Profile › API Tokens).`,`Find the key you made for this site and select Edit (the three dots beside it).`,`Under “Permissions”, select “Add more” and choose Account › Account Filter Lists › Edit.`,`Select “Add more” again and choose Account › Bulk URL Redirects › Edit.`,`Check that “Account Resources” includes the account the site's domain is in.`,`Select “Continue to summary”, then “Update token”. The key stays the same, so nothing needs pasting again.`],Te=`https://dash.cloudflare.com/profile/api-tokens`,X=(e,t)=>({title:e,url:t,read:ge}),Z={cloudflare:{id:`cloudflare`,name:`Cloudflare`,file:`public/_redirects`,howItWorks:`Cloudflare reads a file called _redirects from the published site and applies it before serving any page. It travels with the site, so no access key is needed.`,limits:{static:2e3,dynamic:100,total:2100,lineLength:1e3},queryStrings:`Cloudflare can't match old addresses by their query string (the part after “?”); a new address may carry one.`,trailingSlash:`Cloudflare treats /page and /page/ as different addresses, so each needs its own redirect.`,caseSensitivity:`Cloudflare's docs don't say whether capitals matter; keep old addresses exactly as they were.`,statuses:[301,302,307,308],docs:[X(`Redirects (Workers static assets)`,_e),X(`Redirects (Pages)`,ve),X(`Bulk Redirects`,ye)]},netlify:{id:`netlify`,name:`Netlify`,file:`public/_redirects`,howItWorks:`Netlify reads a file called _redirects from the published site, top to bottom, and uses the first rule that matches.`,limits:{static:null,dynamic:null,total:null,lineLength:null},queryStrings:`Netlify passes the visitor's query string on to the new address, and can match an old address by its query parameters.`,trailingSlash:`Netlify matches /page and /page/ alike, so one redirect covers both.`,caseSensitivity:`Netlify matches paths with capitals exactly as written.`,statuses:[301,302],docs:[X(`Redirects and rewrites`,be),X(`Redirect options`,xe)]},vercel:{id:`vercel`,name:`Vercel`,file:`vercel.json`,howItWorks:`Vercel reads the redirects list in vercel.json when the site is built and applies it everywhere it serves the site.`,limits:{static:null,dynamic:null,total:2048,lineLength:4096},queryStrings:`Vercel passes the visitor's query string on to the new address; an old address can be matched by a query parameter.`,trailingSlash:`Vercel treats /page and /page/ as different addresses unless the site's trailing-slash setting joins them.`,caseSensitivity:`Vercel matches old addresses with capitals exactly as written.`,statuses:[301,302,307,308],docs:[X(`vercel.json redirects`,Se),X(`Configuration redirects and limits`,Ce)]},other:{id:`other`,name:`Another host`,file:null,howItWorks:`This app can't write redirects for this host. Download them in the host's format and add them where its documentation says.`,limits:{static:null,dynamic:null,total:null,lineLength:null},queryStrings:`Depends on the host.`,trailingSlash:`Depends on the host.`,caseSensitivity:`Depends on the host.`,statuses:[301,302,307,308],docs:[]}};function Q({item:e}){return(0,Y.jsxs)(`li`,{className:`g-mono`,children:[e.source_url,e.subpath_matching?` (and below)`:``,` → `,e.target_url,` `,(0,Y.jsx)(`span`,{className:`g-faint`,children:e.status_code})]})}function Ee({plan:e}){let t=e.list===`none`&&e.rule===`none`,n=[e.add?`add ${e.add.toLocaleString()}`:``,e.change?`change ${e.change.toLocaleString()}`:``,e.remove?`remove ${e.remove.toLocaleString()}`:``].filter(Boolean);return(0,Y.jsxs)(`div`,{className:`redir-plan`,children:[(0,Y.jsx)(`p`,{className:`redir-plan__headline`,children:t?`Cloudflare already matches the list. Nothing to change.`:`${n.length?n.join(`, `).replace(/^./,e=>e.toUpperCase()):`No redirects to change`} on Cloudflare.`}),(0,Y.jsxs)(`ul`,{className:`redir-plan__facts`,children:[(0,Y.jsx)(`li`,{children:e.list===`create`?`A new redirect list, “${e.listName}”, made by this app.`:`The list “${e.listName}”, made by this app${e.unchanged?`: ${e.unchanged.toLocaleString()} stay as they are`:``}.`}),(0,Y.jsx)(`li`,{children:e.rule===`create`?`One rule that turns the list on, for your account.`:e.rule===`update`?`The rule that turns the list on is put back the way this app set it.`:`The rule that turns the list on is already there.`}),(0,Y.jsx)(`li`,{children:`For ${e.hostnames.join(` and `)}. Lists and rules this app didn’t make aren’t touched.`})]}),e.examples.add.length?(0,Y.jsxs)(`details`,{className:`redir-plan__list`,open:e.add<=5,children:[(0,Y.jsx)(`summary`,{children:`Added (${e.add.toLocaleString()})`}),(0,Y.jsx)(`ul`,{children:e.examples.add.map(e=>(0,Y.jsx)(Q,{item:e},e.source_url))})]}):null,e.examples.change.length?(0,Y.jsxs)(`details`,{className:`redir-plan__list`,children:[(0,Y.jsx)(`summary`,{children:`Changed (${e.change.toLocaleString()})`}),(0,Y.jsx)(`ul`,{children:e.examples.change.map(e=>(0,Y.jsx)(Q,{item:e.after},e.after.source_url))})]}):null,e.examples.remove.length?(0,Y.jsxs)(`details`,{className:`redir-plan__list`,children:[(0,Y.jsx)(`summary`,{children:`Removed (${e.remove.toLocaleString()})`}),(0,Y.jsx)(`ul`,{children:e.examples.remove.map(e=>(0,Y.jsx)(Q,{item:e},e.source_url))})]}):null,e.skipped.length?(0,Y.jsxs)(`details`,{className:`redir-plan__list`,children:[(0,Y.jsx)(`summary`,{children:`Can’t go on Cloudflare (${e.skipped.length.toLocaleString()})`}),(0,Y.jsx)(`ul`,{children:e.skipped.slice(0,20).map(e=>(0,Y.jsxs)(`li`,{children:[(0,Y.jsx)(`span`,{className:`g-mono`,children:e.from}),` — `,e.reason]},e.from))})]}):null,e.notes.map(e=>(0,Y.jsxs)(`p`,{className:`redir-plan__note`,children:[(0,Y.jsx)(A,{name:`warning`}),` `,e]},e))]})}function De(){return(0,Y.jsxs)(`div`,{className:`redir-key`,children:[(0,Y.jsx)(`ol`,{className:`redir-key__steps`,children:we.map(e=>(0,Y.jsx)(`li`,{children:e},e))}),(0,Y.jsxs)(`a`,{className:`app-link-button`,href:Te,target:`_blank`,rel:`noopener noreferrer`,children:[`Open Cloudflare’s API Tokens page `,(0,Y.jsx)(A,{name:`external`})]})]})}function Oe({siteId:t,open:n,onClose:r,overview:a}){let o=a.cloudflare,[l,u]=(0,G.useState)(`setup`),[m,h]=(0,G.useState)(o.account??``),[g,_]=(0,G.useState)(o.hostnames.join(`, `)),[v,y]=(0,G.useState)(null),[b,S]=(0,G.useState)(null),[w,T]=(0,G.useState)(!1),[E,k]=(0,G.useState)(o.jobId),[A,j]=(0,G.useState)(null),[P,F]=(0,G.useState)(!1),I=ce(E),L=!!b&&s(b).code===`forbidden`;se(E,n&&l===`applying`),(0,G.useEffect)(()=>{n&&(u(o.jobId&&oe.getState().jobs.find(e=>e.id===o.jobId)?.state===`running`?`applying`:`setup`),h(o.account??``),_(o.hostnames.join(`, `)),y(null),S(null),j(null))},[n]),(0,G.useEffect)(()=>{l===`applying`&&I&&I.state!==`running`&&(u(`done`),N(K.all(t)))},[I,l,t]);let R=g.split(/[\s,]+/).map(e=>e.trim()).filter(Boolean),z=o.accountFrom!==`deploy`&&m.trim()!==(o.account??``)||R.join(`,`)!==o.hostnames.join(`,`),B=async()=>{T(!0),S(null);try{z&&q(t,await M(`PUT /api/sites/:siteId/redirects/settings`,{params:{siteId:t},body:{cloudflare:{...o.accountFrom===`deploy`?{}:{account:m.trim()||null},hostnames:R}}})),y(await M(`POST /api/sites/:siteId/redirects/cloudflare/plan`,{params:{siteId:t}})),u(`plan`)}catch(e){S(e)}finally{T(!1)}},V=async()=>{if(v){T(!0);try{let e=await M(`POST /api/sites/:siteId/redirects/cloudflare/apply`,{params:{siteId:t},body:{planId:v.id}});oe.getState().upsert(e),k(e.id),u(`applying`)}catch(e){S(e)}finally{T(!1)}}},H=async()=>{T(!0);try{j(await M(`POST /api/sites/:siteId/redirects/cloudflare/check`,{params:{siteId:t}})),S(null)}catch(e){S(e)}finally{T(!1)}},U=l===`setup`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{variant:`secondary`,onClick:r,children:`Not now`}),(0,Y.jsx)(O,{variant:`primary`,busy:w,busyLabel:`Asking Cloudflare…`,disabled:!o.keyConfigured||!R.length||!m.trim(),onClick:()=>void B(),children:`See the plan`})]}):l===`plan`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{variant:`secondary`,onClick:()=>u(`setup`),children:`Back`}),(0,Y.jsx)(O,{variant:`primary`,busy:w,busyLabel:`Starting…`,disabled:!v||v.list===`none`&&v.rule===`none`,onClick:()=>void V(),children:`Apply on Cloudflare`})]}):l===`done`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{variant:`secondary`,busy:w,busyLabel:`Checking…`,onClick:()=>void H(),children:`Check Cloudflare matches`}),(0,Y.jsx)(O,{variant:`primary`,onClick:r,children:`Done`})]}):null;return(0,Y.jsxs)(i,{open:n,onClose:r,size:`lg`,dismissible:l!==`applying`,title:`Set the redirects on Cloudflare`,description:`Cloudflare then answers the old addresses itself, in front of the site, with room for far more redirects than the file takes.`,footer:U,children:[l===`setup`?(0,Y.jsxs)(`div`,{className:`redir-cfd`,children:[(0,Y.jsxs)(`ul`,{className:`redir-cfd__facts`,children:[(0,Y.jsx)(`li`,{children:`Only once the site is on its own domain in this Cloudflare account, with its traffic going through Cloudflare (the orange cloud). Not on a workers.dev address.`}),(0,Y.jsx)(`li`,{children:`This app makes one redirect list and one rule, named for this site, and changes nothing else on Cloudflare.`}),(0,Y.jsx)(`li`,{children:`The file that travels with the site stays as well. Where both have a redirect, Cloudflare’s comes first.`})]}),o.accountFrom===`deploy`?(0,Y.jsx)(`p`,{className:`g-hint`,children:`Account: the one this site is put online with.`}):(0,Y.jsx)(C,{label:`Cloudflare account ID`,hint:`On the account’s home page in the Cloudflare dashboard, under Account ID.`,children:(0,Y.jsx)(d,{mono:!0,value:m,onChange:e=>h(e.target.value),placeholder:`0123456789abcdef0123456789abcdef`})}),(0,Y.jsx)(C,{label:`The site’s domains`,hint:`Separate several with commas, like example.com, www.example.com.`,children:(0,Y.jsx)(d,{mono:!0,value:g,onChange:e=>_(e.target.value),placeholder:`www.example.com`})}),o.keyConfigured?null:(0,Y.jsxs)(`p`,{className:`redir-cfd__key`,children:[(0,Y.jsx)(e,{kind:`bang`}),` Add a Cloudflare access key first, in the site’s `,(0,Y.jsx)(p,{to:`/sites/${t}/online`,children:`Online settings`}),`. Then give it these permissions:`]}),(0,Y.jsxs)(`details`,{className:`redir-cfd__perm`,open:!o.keyConfigured||L,children:[(0,Y.jsxs)(`summary`,{children:[`The access key needs `,o.permissions.join(` and `)]}),(0,Y.jsx)(De,{})]}),b?(0,Y.jsx)(c,{compact:!0,title:L?`The access key can’t change Bulk Redirects yet`:`Couldn’t make the plan`,error:b}):null,o.last?(0,Y.jsx)(`button`,{type:`button`,className:`app-link-button redir-cfd__remove`,onClick:()=>F(!0),children:`Take them off Cloudflare…`}):null]}):l===`plan`&&v?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ee,{plan:v}),b?(0,Y.jsx)(c,{compact:!0,title:`Couldn’t start`,error:b}):null]}):l===`applying`?(0,Y.jsxs)(`div`,{className:`redir-cfd__progress`,"aria-live":`polite`,children:[(0,Y.jsx)(x,{label:`Working`}),(0,Y.jsx)(`p`,{children:I?.detail??`Starting…`}),(0,Y.jsx)(`span`,{className:`redir-meter__bar`,"aria-hidden":`true`,children:(0,Y.jsx)(`span`,{style:{inlineSize:`${Math.round((I?.progress??.05)*100)}%`}})}),(0,Y.jsx)(`p`,{className:`g-hint`,children:`Cloudflare works through long lists in the background. You can close this; the result shows here and on the Redirects screen.`})]}):(0,Y.jsxs)(`div`,{className:`redir-cfd__done`,"aria-live":`polite`,children:[I?.state===`done`?(0,Y.jsxs)(`p`,{className:`redir-cfd__ok`,children:[(0,Y.jsx)(e,{kind:`reg`}),` `,I.detail]}):(0,Y.jsx)(c,{compact:!0,title:`Couldn’t set them on Cloudflare`,message:I?.detail??`Cloudflare didn’t finish.`,detail:I?.output}),A?A.matches?(0,Y.jsxs)(`p`,{className:`redir-cfd__ok`,children:[(0,Y.jsx)(e,{kind:`reg`}),` Cloudflare matches the list.`]}):(0,Y.jsx)(`ul`,{className:`redir-cfd__diff`,children:A.differences.map(e=>(0,Y.jsx)(`li`,{children:e},e))}):null,b?(0,Y.jsx)(c,{compact:!0,title:`Couldn’t check Cloudflare`,error:b}):null]}),(0,Y.jsx)(f,{open:P,onClose:()=>F(!1),title:`Take the redirects off Cloudflare?`,body:`This removes the redirect list and the rule this app made. The site’s own redirect file stays, so redirects within its limits keep working.`,confirmLabel:`Take them off`,cancelLabel:`Keep them`,tone:`danger`,errorTitle:`Couldn’t take them off Cloudflare`,onConfirm:async()=>{q(t,await M(`POST /api/sites/:siteId/redirects/cloudflare/remove`,{params:{siteId:t}})),D({tone:`success`,title:`Taken off Cloudflare`}),r()}})]})}function ke({siteId:t,overview:n}){let r=ue(t,n.redirects.length>0),i=r.data;if(n.redirects.length===0)return null;let a=(e,r)=>{J(t,n,n.redirects.map((t,n)=>n===e?{...t,to:r}:t),{undo:{label:`Pointed at the page`,previous:n.redirects}})};return(0,Y.jsxs)(`section`,{className:`app-card app-card--pad redir-panel`,"aria-labelledby":`redir-health-title`,"aria-busy":r.loading,children:[(0,Y.jsx)(`h2`,{id:`redir-health-title`,className:`redir-panel__title`,children:`Health`}),r.loading||!i?(0,Y.jsx)(y,{lines:2}):i.brokenTargets.length===0&&i.linkedOldAddresses.length===0?(0,Y.jsxs)(`p`,{className:`redir-health__ok`,children:[(0,Y.jsx)(e,{kind:`reg`}),` Every new address leads somewhere, and no page links to an old one.`]}):(0,Y.jsxs)(Y.Fragment,{children:[i.brokenTargets.length?(0,Y.jsxs)(`div`,{className:`redir-health__group`,children:[(0,Y.jsx)(`p`,{className:`redir-health__title`,children:`${i.brokenTargets.length.toLocaleString()} ${i.brokenTargets.length===1?`leads`:`lead`} nowhere`}),(0,Y.jsx)(`ul`,{children:i.brokenTargets.slice(0,6).map(e=>(0,Y.jsxs)(`li`,{children:[(0,Y.jsx)(`span`,{className:`g-mono`,children:e.from}),` → `,(0,Y.jsx)(`span`,{className:`g-mono`,children:e.to}),e.suggestion?(0,Y.jsx)(O,{size:`sm`,variant:`quiet`,onClick:()=>a(e.index,e.suggestion),children:`Point at ${e.suggestion}`}):null]},e.from))})]}):null,i.linkedOldAddresses.length?(0,Y.jsxs)(`div`,{className:`redir-health__group`,children:[(0,Y.jsx)(`p`,{className:`redir-health__title`,children:`${i.linkedOldAddresses.length.toLocaleString()} old ${i.linkedOldAddresses.length===1?`address is`:`addresses are`} still linked from the site`}),(0,Y.jsx)(`p`,{className:`g-hint`,children:`Change the link to the new address instead, so visitors skip the redirect.`}),(0,Y.jsx)(`ul`,{children:i.linkedOldAddresses.slice(0,6).map(e=>(0,Y.jsxs)(`li`,{children:[(0,Y.jsx)(`span`,{className:`g-mono`,children:e.from}),` on `,e.pages.slice(0,3).map((e,n)=>(0,Y.jsxs)(`span`,{children:[n?`, `:``,(0,Y.jsx)(p,{to:`/sites/${t}/edit?path=${encodeURIComponent(e.path)}`,children:e.title})]},e.path))]},e.from))})]}):null]})]})}var $=52;function Ae({full:e,children:t}){return(0,Y.jsx)(h,{content:(0,Y.jsx)(`span`,{className:`g-mono redir-full`,children:e}),children:(0,Y.jsx)(`span`,{className:`redir-address`,tabIndex:0,"aria-label":e,children:t})})}function je({from:e}){let{lead:t,path:n}=z(e);return(0,Y.jsxs)(Ae,{full:e,children:[t?(0,Y.jsxs)(`span`,{className:`redir-address__lead`,children:[t,` `]}):null,(0,Y.jsx)(`span`,{className:`g-mono redir-address__path`,children:n})]})}function Me({to:e}){let{path:t,tail:n}=ie(e);return(0,Y.jsxs)(Ae,{full:e,children:[(0,Y.jsx)(`span`,{className:`g-mono redir-address__path`,children:t}),n?(0,Y.jsxs)(`span`,{className:`redir-address__lead`,children:[` `,n]}):null]})}function Ne({status:e}){return(0,Y.jsxs)(`span`,{className:`redir-kind`,children:[R(e),` `,(0,Y.jsx)(`span`,{className:`redir-kind__code g-mono`,children:e})]})}function Pe({issues:t}){if(!t?.length)return(0,Y.jsx)(`span`,{className:`redir-row__mark`,"aria-hidden":`true`});let n=t.some(e=>e.severity===`error`)?`error`:t.some(e=>e.severity===`warning`)?`warning`:`info`,r=t.map(e=>e.message).join(` `);return(0,Y.jsx)(h,{content:r,children:(0,Y.jsx)(`span`,{className:`redir-row__mark redir-row__mark--${n}`,tabIndex:0,role:`img`,"aria-label":r,children:(0,Y.jsx)(e,{kind:n===`info`?`stet`:`bang`})})})}function Fe({initial:e,onSave:t,onCancel:n,saveLabel:r}){let[i,a]=(0,G.useState)(e.from),[o,s]=(0,G.useState)(e.to),[c,l]=(0,G.useState)(e.status),[u,f]=(0,G.useState)(e.note??``),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=(0,G.useRef)(null);(0,G.useEffect)(()=>_.current?.focus(),[]);let v=async()=>{let n=i.trim(),r=o.trim();if(!n.startsWith(`/`))return g(`The old address starts with “/”, like /old-page/.`);if(!r.startsWith(`/`)&&!/^https?:\/\//i.test(r))return g(`The new address starts with “/” or “https://”.`);g(null),m(!0);let a=await t({...e,from:n,to:r,status:c,...u.trim()?{note:u.trim()}:{note:void 0},source:e.source??`manual`});m(!1),a||g(`It wasn’t saved. See the message above.`)};return(0,Y.jsxs)(`div`,{className:`redir-edit`,role:`group`,"aria-label":e.from?`Edit the redirect from ${e.from}`:`New redirect`,onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),n()):e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),v())},children:[(0,Y.jsx)(d,{ref:_,size:`sm`,mono:!0,value:i,placeholder:`/old-page/`,"aria-label":`Old address`,onChange:e=>a(e.target.value)}),(0,Y.jsx)(`span`,{className:`redir-arrow`,"aria-hidden":`true`,children:`→`}),(0,Y.jsx)(d,{size:`sm`,mono:!0,value:o,placeholder:`/new-page/`,"aria-label":`New address`,onChange:e=>s(e.target.value)}),(0,Y.jsx)(T,{value:String(c),onChange:e=>l(Number(e)),options:ae,"aria-label":`Kind`}),(0,Y.jsx)(d,{size:`sm`,value:u,placeholder:`Note (optional)`,"aria-label":`Note`,onChange:e=>f(e.target.value)}),(0,Y.jsxs)(`span`,{className:`redir-edit__actions`,children:[(0,Y.jsx)(O,{size:`sm`,variant:`primary`,busy:p,busyLabel:`Saving…`,onClick:()=>void v(),children:r}),(0,Y.jsx)(O,{size:`sm`,variant:`quiet`,onClick:n,children:`Cancel`})]}),h?(0,Y.jsx)(`p`,{className:`redir-edit__problem`,role:`alert`,children:h}):null]})}function Ie({rows:e,issues:t,total:n,editing:r,onEdit:i,onSave:a,onDelete:o}){let s=(0,G.useRef)(null),[c,l]=(0,G.useState)({top:0,height:640}),u=(0,G.useMemo)(()=>H(t),[t]),d=ne(c.top,c.height,$,e.length),f=Math.min(e.length*$,728);return(0,G.useEffect)(()=>{let e=s.current;if(!e)return;let t=new ResizeObserver(()=>l(t=>({...t,height:e.clientHeight||640})));return t.observe(e),()=>t.disconnect()},[]),(0,Y.jsxs)(`div`,{className:`redir-table`,role:`table`,"aria-label":`Redirects`,"aria-rowcount":e.length+1,children:[(0,Y.jsxs)(`div`,{className:`redir-table__head`,role:`row`,"aria-rowindex":1,children:[(0,Y.jsx)(`span`,{role:`columnheader`,className:`redir-col--mark`,children:(0,Y.jsx)(`span`,{className:`g-sr`,children:`Problems`})}),(0,Y.jsx)(`span`,{role:`columnheader`,children:`Old address`}),(0,Y.jsx)(`span`,{role:`columnheader`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{role:`columnheader`,children:`New address`}),(0,Y.jsx)(`span`,{role:`columnheader`,children:`Kind`}),(0,Y.jsx)(`span`,{role:`columnheader`,className:`redir-col--source`,children:`Came from`}),(0,Y.jsx)(`span`,{role:`columnheader`,children:(0,Y.jsx)(`span`,{className:`g-sr`,children:`Actions`})})]}),(0,Y.jsx)(`div`,{ref:s,className:`redir-table__body`,style:{blockSize:Math.max(f,$)},onScroll:e=>l({top:e.currentTarget.scrollTop,height:e.currentTarget.clientHeight}),tabIndex:-1,children:(0,Y.jsx)(`div`,{style:{blockSize:e.length*$,position:`relative`},children:e.slice(d.start,d.end).map((e,t)=>{let n=d.start+t,{redirect:s,index:c}=e;return(0,Y.jsx)(`div`,{role:`row`,"aria-rowindex":n+2,className:b(`redir-row`,r===c&&`redir-row--editing`),style:{transform:`translateY(${n*$}px)`},children:r===c?(0,Y.jsx)(Fe,{initial:s,saveLabel:`Save`,onCancel:()=>i(null),onSave:e=>a(c,e)}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{role:`cell`,className:`redir-col--mark`,children:(0,Y.jsx)(Pe,{issues:u.get(c)})}),(0,Y.jsx)(`span`,{role:`cell`,className:`redir-cell`,children:(0,Y.jsx)(je,{from:s.from})}),(0,Y.jsx)(`span`,{role:`cell`,className:`redir-arrow`,"aria-label":`goes to`,children:`→`}),(0,Y.jsxs)(`span`,{role:`cell`,className:`redir-cell redir-cell--stack`,children:[(0,Y.jsx)(Me,{to:s.to}),s.note?(0,Y.jsx)(`span`,{className:`redir-note`,title:s.note,children:s.note}):null]}),(0,Y.jsx)(`span`,{role:`cell`,className:`redir-cell`,title:`${R(s.status)} (${s.status})`,children:(0,Y.jsx)(Ne,{status:s.status})}),(0,Y.jsx)(`span`,{role:`cell`,className:`redir-col--source redir-cell g-faint`,title:V(s.source),children:V(s.source)}),(0,Y.jsxs)(`span`,{role:`cell`,className:`redir-row__actions`,children:[(0,Y.jsx)(E,{icon:`settings`,label:`Edit the redirect from ${s.from}`,onClick:()=>i(c)}),(0,Y.jsx)(E,{icon:`trash`,label:`Delete the redirect from ${s.from}`,onClick:()=>o(c)})]})]})},`${c}:${s.from}`)})})}),e.length<n?(0,Y.jsx)(`p`,{className:`redir-table__foot g-hint`,children:`Showing ${e.length.toLocaleString()} of ${n.toLocaleString()}.`}):null]})}function Le({trace:t}){return t.otherDomain?(0,Y.jsxs)(`p`,{className:`redir-try__line`,children:[(0,Y.jsx)(`span`,{className:`g-mono`,children:t.otherDomain}),` isn’t this site’s address, so this site’s redirects never see it.`]}):t.hops.length===0?(0,Y.jsxs)(`div`,{className:`redir-try__result`,children:[(0,Y.jsx)(`p`,{className:`redir-try__line`,children:t.finalKind===`page`?(0,Y.jsxs)(Y.Fragment,{children:[`No redirect: `,(0,Y.jsx)(`span`,{className:`g-mono`,children:t.path}),` is the page “`,t.finalTitle,`”.`]}):t.finalKind===`file`?(0,Y.jsxs)(Y.Fragment,{children:[`No redirect: `,(0,Y.jsx)(`span`,{className:`g-mono`,children:t.path}),` is a file on the site.`]}):(0,Y.jsxs)(Y.Fragment,{children:[`No redirect, and nothing is at `,(0,Y.jsx)(`span`,{className:`g-mono`,children:t.path}),`: visitors see the missing-page page.`]})}),t.nearMiss?(0,Y.jsxs)(`p`,{className:`redir-try__note`,children:[`There is one for `,(0,Y.jsx)(`span`,{className:`g-mono`,children:t.nearMiss}),`, which differs only by the trailing slash or capitals. Most hosts treat those as different addresses.`]}):null]}):(0,Y.jsxs)(`div`,{className:`redir-try__result`,children:[(0,Y.jsx)(`ol`,{className:`redir-try__hops`,children:t.hops.map((e,t)=>(0,Y.jsxs)(`li`,{children:[(0,Y.jsx)(`span`,{className:`g-mono`,children:e.from}),(0,Y.jsx)(`span`,{className:`redir-arrow`,"aria-label":`goes to`,children:`→`}),(0,Y.jsx)(`span`,{className:`g-mono`,children:e.to}),(0,Y.jsxs)(`span`,{className:`redir-kind`,children:[R(e.status),` `,(0,Y.jsx)(`span`,{className:`redir-kind__code g-mono`,children:e.status})]})]},`${t}:${e.from}`))}),t.loop?(0,Y.jsxs)(`p`,{className:`redir-try__line redir-try__line--danger`,children:[(0,Y.jsx)(e,{kind:`bang`}),` This goes round in a circle: visitors never arrive anywhere.`]}):t.finalKind===`external`?(0,Y.jsxs)(`p`,{className:`redir-try__line`,children:[`Ends on another site: `,(0,Y.jsx)(`span`,{className:`g-mono`,children:t.final})]}):t.finalKind===`page`?(0,Y.jsxs)(`p`,{className:`redir-try__line redir-try__line--ok`,children:[(0,Y.jsx)(e,{kind:`reg`}),` Ends on “`,t.finalTitle,`”, `,(0,Y.jsx)(`span`,{className:`g-mono`,children:t.final}),t.hops.length>1?`, after ${t.hops.length} steps.`:`.`]}):t.finalKind===`file`?(0,Y.jsxs)(`p`,{className:`redir-try__line redir-try__line--ok`,children:[`Ends on the file `,(0,Y.jsx)(`span`,{className:`g-mono`,children:t.final}),`.`]}):(0,Y.jsxs)(`p`,{className:`redir-try__line redir-try__line--danger`,children:[(0,Y.jsx)(e,{kind:`bang`}),` Ends at `,(0,Y.jsx)(`span`,{className:`g-mono`,children:t.final}),`, where nothing is: visitors see the missing-page page.`]})]})}function Re({siteId:e}){let[t,n]=(0,G.useState)(``),[r,i]=(0,G.useState)(null),[a,o]=(0,G.useState)(null),[c,l]=(0,G.useState)(!1),u=async n=>{if(n.preventDefault(),t.trim()){l(!0);try{i(await M(`POST /api/sites/:siteId/redirects/try`,{params:{siteId:e},body:{address:t}})),o(null)}catch(e){o(s(e).message)}finally{l(!1)}}};return(0,Y.jsxs)(`section`,{className:`app-card app-card--pad redir-panel`,"aria-labelledby":`redir-try-title`,children:[(0,Y.jsx)(`h2`,{id:`redir-try-title`,className:`redir-panel__title`,children:`Try an address`}),(0,Y.jsxs)(`form`,{className:`redir-try__form`,onSubmit:e=>void u(e),children:[(0,Y.jsx)(d,{size:`sm`,mono:!0,value:t,placeholder:`/an-old-page/`,"aria-label":`An old address`,onChange:e=>n(e.target.value)}),(0,Y.jsx)(O,{size:`sm`,variant:`secondary`,type:`submit`,busy:c,busyLabel:`Trying…`,children:`Try`})]}),a?(0,Y.jsx)(`p`,{className:`redir-try__line redir-try__line--danger`,children:a}):r?(0,Y.jsx)(Le,{trace:r}):(0,Y.jsx)(`p`,{className:`g-hint`,children:`See exactly where a visitor who types it ends up.`})]})}var ze=[{id:`cloudflare`,blurb:`A _redirects file travels with the site.`},{id:`netlify`,blurb:`A _redirects file travels with the site.`},{id:`vercel`,blurb:`The redirects go in vercel.json.`},{id:`other`,blurb:`Download them in the host’s format.`}],Be=[{format:`csv`,label:`Spreadsheet (CSV)`},{format:`redirects-file`,label:`_redirects file`},{format:`vercel-json`,label:`Vercel`},{format:`cloudflare-csv`,label:`Cloudflare list`},{format:`nginx`,label:`nginx`},{format:`apache`,label:`Apache (.htaccess)`}];async function Ve(e,t){try{q(e,await M(`PUT /api/sites/:siteId/redirects/settings`,{params:{siteId:e},body:{host:t}}))}catch(e){let t=s(e);D({tone:`danger`,title:`Couldn’t save where the site is hosted`,body:t.message,detail:t.detail})}}function He({siteId:e,overview:t,onDone:n}){let r=t.host.suggestion?.id??null,[i,a]=(0,G.useState)(null);return(0,Y.jsxs)(`fieldset`,{className:`redir-hosts`,children:[(0,Y.jsx)(`legend`,{className:`redir-panel__title`,children:`Where is this site hosted?`}),t.host.suggestion?(0,Y.jsx)(`p`,{className:`g-hint`,children:t.host.suggestion.reason}):(0,Y.jsx)(`p`,{className:`g-hint`,children:`Redirects take effect through the host’s own file. Choose once; it’s saved with the site.`}),(0,Y.jsx)(`div`,{className:`redir-hosts__options`,children:ze.map(o=>(0,Y.jsxs)(`button`,{type:`button`,className:b(`redir-host`,r===o.id&&`redir-host--suggested`,t.host.id===o.id&&`redir-host--on`),"aria-pressed":t.host.id===o.id,disabled:i!==null,onClick:()=>{a(o.id),Ve(e,o.id).finally(()=>{a(null),n?.()})},children:[(0,Y.jsxs)(`span`,{className:`redir-host__name`,children:[Z[o.id].name,r===o.id?(0,Y.jsx)(_,{tone:`accent`,mark:null,children:`Looks like it`}):null]}),(0,Y.jsx)(`span`,{className:`redir-host__blurb`,children:o.blurb})]},o.id))})]})}function Ue({label:e,used:t,limit:n}){let r=B(t,n);return(0,Y.jsxs)(`div`,{className:b(`redir-meter`,r!==null&&r>=1&&t>(n??0)&&`redir-meter--over`),children:[(0,Y.jsxs)(`span`,{className:`redir-meter__label`,children:[e,(0,Y.jsx)(`span`,{className:`g-faint`,children:n===null?` ${t.toLocaleString()}`:` ${t.toLocaleString()} of ${n.toLocaleString()}`})]}),r===null?null:(0,Y.jsx)(`span`,{className:`redir-meter__bar`,"aria-hidden":`true`,children:(0,Y.jsx)(`span`,{style:{inlineSize:`${Math.max(r*100,t?2:0)}%`}})})]})}function We({siteId:t,overview:n,onImport:r}){let a=n.derived,[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(!1),f=async()=>{d(!0);try{q(t,await M(`POST /api/sites/:siteId/redirects/derived/replace`,{params:{siteId:t}})),l(!1),D({tone:`success`,title:`Replaced from the list`,body:`The change is waiting in Proof.`})}catch(e){let t=s(e);D({tone:`danger`,title:`Couldn’t replace the file`,body:t.message,detail:t.detail})}finally{d(!1)}},p={"in-step":{tone:`success`,text:`In step with the list`},stale:{tone:`warning`,text:`Behind the list — changed outside the app`},"hand-edited":{tone:`warning`,text:`Changed by hand`},foreign:{tone:`warning`,text:`The site’s own file`},missing:{tone:`neutral`,text:`Written when the first redirect is added`}}[a.state];return(0,Y.jsxs)(`div`,{className:`redir-derived`,children:[(0,Y.jsxs)(`p`,{className:`redir-derived__file`,children:[(0,Y.jsx)(`span`,{className:`g-mono`,children:a.path}),a.state===`missing`?null:(0,Y.jsxs)(`a`,{className:`app-link-button`,href:o(t,a.path),target:`_blank`,rel:`noopener noreferrer`,children:[`View it `,(0,Y.jsx)(A,{name:`external`})]})]}),(0,Y.jsxs)(`p`,{className:`redir-derived__state redir-derived__state--${p.tone}`,children:[(0,Y.jsx)(e,{kind:p.tone===`success`?`reg`:p.tone===`warning`?`bang`:`stet`}),` `,p.text]}),a.state===`stale`?(0,Y.jsx)(O,{size:`sm`,variant:`secondary`,busy:u,busyLabel:`Updating…`,onClick:()=>void f(),children:`Bring it up to date`}):null,a.state===`hand-edited`||a.state===`foreign`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`g-hint`,children:a.state===`foreign`?`The site already had this file, so it was left as it is. The list isn’t in it yet.`:`Someone edited this file by hand since the app wrote it, so it wasn’t replaced.`}),(0,Y.jsx)(O,{size:`sm`,variant:`secondary`,onClick:()=>l(!0),children:`Review the difference…`}),(0,Y.jsx)(i,{open:c,onClose:()=>l(!1),size:`xl`,title:a.state===`foreign`?`${a.path} isn’t from the list yet`:`${a.path} was changed by hand`,description:`The left is the file now; the right is what the list would make it. Bring its redirects into the list first if any of them should stay.`,footer:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{variant:`secondary`,onClick:()=>(l(!1),r(a.path)),children:`Bring its redirects into the list…`}),(0,Y.jsx)(O,{variant:`primary`,busy:u,busyLabel:`Replacing…`,onClick:()=>void f(),children:`Replace it with the list`})]}),children:(0,Y.jsxs)(`div`,{className:`redir-compare`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`g-eyebrow`,children:`Now`}),(0,Y.jsx)(`pre`,{className:`redir-compare__text g-mono`,children:a.current})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`g-eyebrow`,children:`From the list`}),(0,Y.jsx)(`pre`,{className:`redir-compare__text g-mono`,children:a.proposed})]})]})})]}):null]})}function Ge({siteId:t,overview:n,onImport:r,onCloudflare:i}){let[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(null),l=n.host.id,u=n.hostInfo;if(!l||a)return(0,Y.jsxs)(`section`,{className:`app-card app-card--pad redir-panel`,children:[(0,Y.jsx)(He,{siteId:t,overview:n,onDone:()=>o(!1)}),a?(0,Y.jsxs)(O,{size:`sm`,variant:`quiet`,onClick:()=>o(!1),children:[`Keep `,Z[l].name]}):null]});let d=n.usage,m=n.cloudflare;return(0,Y.jsxs)(`section`,{className:`app-card app-card--pad redir-panel`,"aria-labelledby":`redir-where-title`,children:[(0,Y.jsx)(`h2`,{id:`redir-where-title`,className:`redir-panel__title`,children:`Where they take effect`}),(0,Y.jsxs)(`p`,{className:`redir-where__host`,children:[(0,Y.jsx)(`strong`,{children:u.name}),n.host.from===`deploy`?(0,Y.jsxs)(`span`,{className:`g-faint`,children:[` · from the `,(0,Y.jsx)(p,{to:`/sites/${t}/online`,children:`Online settings`})]}):(0,Y.jsx)(`button`,{type:`button`,className:`app-link-button`,onClick:()=>o(!0),children:`Change`})]}),(0,Y.jsx)(`p`,{className:`redir-where__how`,children:u.howItWorks}),n.derived?(0,Y.jsx)(We,{siteId:t,overview:n,onImport:r}):null,d&&(u.limits.static!==null||u.limits.total!==null)?(0,Y.jsxs)(`div`,{className:`redir-meters`,children:[u.limits.static===null?null:(0,Y.jsx)(Ue,{label:`Exact addresses`,used:d.static,limit:u.limits.static}),u.limits.dynamic===null?null:(0,Y.jsx)(Ue,{label:`Wildcards`,used:d.dynamic,limit:u.limits.dynamic}),u.limits.static===null&&u.limits.total!==null?(0,Y.jsx)(Ue,{label:`Redirects`,used:d.total,limit:u.limits.total}):null]}):null,d?.leftOut.length?(0,Y.jsx)(`p`,{className:`g-hint`,children:`${d.leftOut.length.toLocaleString()} can’t go in ${u.name}’s file: ${d.leftOut[0].reason}`}):null,d?.over?(0,Y.jsxs)(`p`,{className:`redir-where__over`,role:`status`,children:[(0,Y.jsx)(e,{kind:`bang`}),` More than `,u.name,`’s file takes. `,l===`cloudflare`?`Set them on Cloudflare to cover the whole list.`:`Some won’t work until the list is shorter.`]}):null,n.leftovers.map(e=>(0,Y.jsxs)(`p`,{className:`redir-where__leftover`,children:[(0,Y.jsxs)(`span`,{children:[`The redirect file for `,Z[e.host].name,`, `,(0,Y.jsx)(`span`,{className:`g-mono`,children:e.path}),`, is still in the site.`]}),(0,Y.jsx)(O,{size:`sm`,variant:`quiet`,onClick:()=>c(e.path),children:`Remove it`})]},e.path)),l===`other`?(0,Y.jsxs)(`div`,{className:`redir-exports`,children:[(0,Y.jsx)(`p`,{className:`g-hint`,children:`This app can’t write redirects for this host. Download them in its format and add them where its documentation says.`}),(0,Y.jsx)(`ul`,{children:Be.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`a`,{className:S(`secondary`,`sm`),href:de(t,e.format),download:!0,children:[(0,Y.jsx)(A,{name:`download`}),` `,e.label]})},e.format))})]}):null,(0,Y.jsxs)(`details`,{className:`redir-where__docs`,children:[(0,Y.jsxs)(`summary`,{children:[`What `,u.name,` does with them`]}),(0,Y.jsxs)(`ul`,{children:[(0,Y.jsx)(`li`,{children:u.queryStrings}),(0,Y.jsx)(`li`,{children:u.trailingSlash}),(0,Y.jsx)(`li`,{children:u.caseSensitivity}),u.docs.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:e.title})},e.url))]})]}),m?(0,Y.jsxs)(`div`,{className:`redir-cf`,children:[(0,Y.jsx)(`h3`,{className:`redir-cf__title`,children:`Also set them on Cloudflare`}),(0,Y.jsx)(`p`,{className:`redir-cf__text`,children:m.reason}),m.last?(0,Y.jsxs)(`p`,{className:b(`redir-cf__last`,m.outOfDate&&`redir-cf__last--behind`),children:[(0,Y.jsx)(e,{kind:m.outOfDate?`bang`:`reg`}),` Set on Cloudflare ${v(m.last.appliedAt)}${m.last.who?` by ${m.last.who}`:``} · ${W(m.last.items)} for ${m.last.hostnames.join(`, `)}`,m.outOfDate?`. The list has changed since.`:`.`]}):null,(0,Y.jsx)(O,{size:`sm`,variant:m.recommended||m.outOfDate?`primary`:`secondary`,icon:`globe`,onClick:i,children:m.last?`Update on Cloudflare…`:`Set them on Cloudflare…`})]}):null,(0,Y.jsx)(f,{open:s!==null,onClose:()=>c(null),title:`Remove ${s??``}?`,body:`This app wrote it for a host the site no longer uses. Removing it is a pending change you can discard in Proof.`,confirmLabel:`Remove it`,cancelLabel:`Keep it`,onConfirm:async()=>{s&&q(t,await M(`POST /api/sites/:siteId/redirects/leftover/remove`,{params:{siteId:t},body:{path:s}}))}})]})}var Ke={from:``,to:``,status:301,source:`manual`};function qe(){let{siteId:e=``}=n(),t=le(e),r=t.data,[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(`all`),[u,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)({open:!1,start:null}),[_,v]=(0,G.useState)(!1),[b,x]=w(),S=b.get(`add`);(0,G.useEffect)(()=>{if(!S||!r)return;let e=re(r.imports,S);e&&g({open:!0,start:e}),x(e=>{let t=new URLSearchParams(e);return t.delete(`add`),t},{replace:!0})},[S,r,x]),P({crumbs:[{label:`Redirects`}]}),L(`changes.updated`,t=>{t.siteId===e&&N(K.all(e))}),L(`site.updated`,t=>{t.siteId===e&&N(K.all(e))}),L(`job`,t=>{t.job.kind===`redirects`&&t.job.siteId===e&&t.job.state!==`running`&&N(K.all(e))});let C=(0,G.useMemo)(()=>{if(!r)return[];let e=H(r.issues),t=[];return r.redirects.forEach((n,r)=>{te(n,i)&&(o!==`problems`||e.has(r))&&(o===`all`||o===`problems`||(e.get(r)??[]).some(e=>e.code===o))&&t.push({redirect:n,index:r})}),t},[r,i,o]);if(t.loading)return(0,Y.jsx)(`div`,{className:`app-screen`,"aria-busy":`true`,children:(0,Y.jsxs)(`div`,{className:`app-screen__inner app-screen__inner--wide`,children:[(0,Y.jsx)(y,{width:220,height:32}),(0,Y.jsx)(y,{lines:8,style:{marginBlockStart:24}})]})});if(!r)return(0,Y.jsx)(`div`,{className:`app-screen`,children:(0,Y.jsx)(`div`,{className:`app-screen__inner`,children:(0,Y.jsx)(c,{title:`Couldn’t load the redirects`,error:t.error,onRetry:()=>void t.refetch()})})});let E=U(r.issues),D=H(r.issues).size,A=(t,n)=>J(e,r,t,n?{undo:{label:n,previous:r.redirects}}:{}),M=e=>{let t=r.redirects[e];f(null),A(r.redirects.filter((t,n)=>n!==e),`Removed the redirect from ${t.from}`)},F=async(e,t)=>{let n=await A(r.redirects.map((n,r)=>r===e?t:n));return n&&f(null),!!n},I=async e=>{let t=await A([...r.redirects,e],`Added a redirect from ${e.from}`);return t&&m(!1),!!t};return(0,Y.jsxs)(`div`,{className:`app-screen`,children:[(0,Y.jsxs)(`div`,{className:`app-screen__inner app-screen__inner--wide redir-screen`,children:[(0,Y.jsx)(k,{title:`Redirects`,description:`When a page moves, a redirect sends visitors and search engines from its old address to the new one.`,actions:(0,Y.jsxs)(Y.Fragment,{children:[r.redirects.length?(0,Y.jsx)(j,{label:`Download`,placement:`bottom-end`,items:[{id:`csv`,label:`Spreadsheet (CSV)`},{id:`redirects-file`,label:`_redirects file`},{id:`vercel-json`,label:`Vercel (vercel.json)`},{id:`cloudflare-csv`,label:`Cloudflare Bulk Redirects list`},{id:`nginx`,label:`nginx configuration`},{id:`apache`,label:`Apache (.htaccess)`}].map(t=>({id:t.id,label:t.label,icon:`download`,onSelect:()=>window.open(de(e,t.id),`_blank`,`noopener`)})),trigger:e=>(0,Y.jsx)(O,{variant:`secondary`,icon:`download`,...e,children:`Download`})}):null,r.redirects.length?(0,Y.jsx)(O,{variant:`primary`,icon:`plus`,disabled:!!r.problem,onClick:()=>g({open:!0,start:null}),children:`Add many`}):null]})}),r.problem?(0,Y.jsx)(c,{compact:!0,title:`The redirects file can’t be read`,message:r.problem}):null,(0,Y.jsxs)(`div`,{className:`redir-layout`,children:[(0,Y.jsx)(`div`,{className:`redir-main`,children:r.redirects.length===0&&!p?(0,Y.jsxs)(`div`,{className:`app-card redir-empty`,children:[(0,Y.jsx)(l,{title:`No redirects yet.`,body:`A redirect sends visitors from an old address to a new one, so old links and search results keep working after a page moves.`,mark:`pilcrow`,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{variant:`primary`,onClick:()=>g({open:!0,start:null}),disabled:!!r.problem,children:`Add many`}),(0,Y.jsx)(O,{variant:`secondary`,onClick:()=>m(!0),disabled:!!r.problem,children:`Add one`})]})}),r.imports.length?(0,Y.jsx)(`div`,{className:`redir-empty__offers`,children:r.imports.map(e=>(0,Y.jsx)(O,{variant:`quiet`,icon:`download`,onClick:()=>g({open:!0,start:e}),children:`Bring in ${e.label.replace(/^The /,`the `)} (${e.count.toLocaleString()})`},e.path))}):null]}):(0,Y.jsxs)(Y.Fragment,{children:[ee(r.imports).filter(e=>e.path.startsWith(`wordpress-import/`)).map(e=>(0,Y.jsxs)(`div`,{className:`app-card redir-offer`,role:`note`,children:[(0,Y.jsx)(`span`,{children:`${e.label}: ${(e.waiting??e.count).toLocaleString()} ${(e.waiting??e.count)===1?`isn’t`:`aren’t`} in the list yet.`}),(0,Y.jsx)(O,{size:`sm`,variant:`secondary`,icon:`download`,disabled:!!r.problem,onClick:()=>g({open:!0,start:e}),children:`Review them`})]},e.path)),(0,Y.jsxs)(`div`,{className:`redir-toolbar`,children:[(0,Y.jsx)(d,{size:`sm`,type:`search`,value:i,placeholder:`Find an address or note`,"aria-label":`Find a redirect`,onChange:e=>a(e.target.value)}),(0,Y.jsx)(T,{value:o,onChange:s,"aria-label":`Show`,options:[{value:`all`,label:`All (${r.redirects.length.toLocaleString()})`},...D?[{value:`problems`,label:`With problems (${D.toLocaleString()})`}]:[],...E.map(e=>({value:e.code,label:`${e.label} (${e.count.toLocaleString()})`}))]}),(0,Y.jsx)(`span`,{className:`redir-toolbar__count g-faint`,children:W(r.redirects.length)}),(0,Y.jsx)(O,{size:`sm`,variant:`secondary`,icon:`plus`,onClick:()=>(m(!0),f(null)),disabled:p||!!r.problem,children:`Add one`})]}),p?(0,Y.jsx)(`div`,{className:`app-card redir-adding`,children:(0,Y.jsx)(Fe,{initial:Ke,saveLabel:`Add`,onCancel:()=>m(!1),onSave:I})}):null,C.length?(0,Y.jsx)(Ie,{rows:C,issues:r.issues,total:r.redirects.length,editing:u,onEdit:f,onSave:F,onDelete:M}):r.redirects.length?(0,Y.jsx)(l,{compact:!0,title:`Nothing matches.`,body:i?`No redirect mentions “${i}”.`:`No redirect has that problem.`,actions:(0,Y.jsx)(O,{variant:`secondary`,size:`sm`,onClick:()=>(a(``),s(`all`)),children:`Show all`})}):null,(0,Y.jsx)(`p`,{className:`redir-order g-hint`,children:`Exact addresses come first and wildcards after, the most specific first — the order every host needs. The list keeps it by itself.`})]})}),(0,Y.jsxs)(`aside`,{className:`redir-aside`,"aria-label":`Where redirects take effect`,children:[(0,Y.jsx)(Ge,{siteId:e,overview:r,onImport:e=>g({open:!0,start:{path:e,label:e,count:0}}),onCloudflare:()=>v(!0)}),(0,Y.jsx)(Re,{siteId:e}),(0,Y.jsx)(ke,{siteId:e,overview:r})]})]})]}),(0,Y.jsx)(he,{siteId:e,open:h.open,start:h.start,overview:r,onClose:()=>g({open:!1,start:null})}),r.cloudflare?(0,Y.jsx)(Oe,{siteId:e,open:_,onClose:()=>v(!1),overview:r}):null]})}export{qe as RedirectsScreen};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.redir-screen{gap:var(--space-6);display:grid}.redir-layout{gap:var(--space-6);grid-template-columns:minmax(0,1fr) clamp(280px,22vw,340px);align-items:start;display:grid}@media (width<=1100px){.redir-layout{grid-template-columns:minmax(0,1fr)}}.redir-main{gap:var(--space-3);min-inline-size:0;display:grid}.redir-aside{gap:var(--space-4);min-inline-size:0;display:grid;position:sticky;inset-block-start:0}@media (width<=1100px){.redir-aside{grid-template-columns:repeat(auto-fit,minmax(300px,1fr));position:static}}.redir-toolbar{gap:var(--space-2);flex-wrap:wrap;align-items:center;display:flex}.redir-toolbar>.g-input{flex:220px;max-inline-size:360px}.redir-toolbar__count{font-size:var(--text-sm);font-variant-numeric:tabular-nums;margin-inline-start:auto}.redir-table{border:var(--border-hair) solid var(--border-default);border-radius:var(--radius-md);background:var(--surface-raised);overflow:hidden}.redir-table__head,.redir-row,.redir-edit{align-items:center;column-gap:var(--space-3);padding-inline:var(--space-3);grid-template-columns:20px minmax(0,1.25fr) 16px minmax(0,1fr) 96px minmax(0,88px) 64px;display:grid}.redir-edit{padding-block:var(--space-2);grid-template-columns:minmax(0,1fr) 16px minmax(0,1fr) 176px minmax(0,.8fr) auto}.redir-table__head{border-block-end:var(--border-hair) solid var(--border-default);background:var(--surface-sunken);block-size:36px;font-size:var(--text-xs);font-weight:var(--weight-semibold);letter-spacing:var(--tracking-label);color:var(--ink-secondary);text-transform:uppercase}.redir-table__body{overscroll-behavior:contain;position:relative;overflow-y:auto}.redir-table__body:focus-visible{outline:var(--focus-width) solid var(--focus-ring);outline-offset:calc(-1 * var(--focus-width))}.redir-row{border-block-end:var(--border-hair) solid var(--border-subtle);block-size:52px;font-size:var(--text-sm);transition:background var(--duration-fast) var(--ease-standard);position:absolute;inset-block-start:0;inset-inline:0}.redir-row:hover,.redir-row:focus-within{background:var(--surface-sunken)}.redir-row--editing{background:var(--accent-subtle)}.redir-row--editing>.redir-edit{grid-column:1/-1;padding-inline:0}.redir-row__actions{justify-content:flex-end;gap:var(--space-0-5);opacity:.55;transition:opacity var(--duration-fast) var(--ease-standard);display:flex}.redir-row:hover .redir-row__actions,.redir-row:focus-within .redir-row__actions{opacity:1}.redir-row__mark{border-radius:var(--radius-pill);place-items:center;block-size:18px;inline-size:18px;display:inline-grid}.redir-row__mark:focus-visible{outline:var(--focus-width) solid var(--focus-ring);outline-offset:var(--focus-offset)}.redir-row__mark--error{color:var(--danger-ink)}.redir-row__mark--warning{color:var(--warning-ink)}.redir-row__mark--info{color:var(--ink-tertiary)}.redir-cell{text-overflow:ellipsis;white-space:nowrap;min-inline-size:0;overflow:hidden}.redir-cell--stack{gap:1px;display:grid}.redir-cell--stack>*{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.redir-note{color:var(--ink-tertiary);font-size:var(--text-xs)}.redir-address{border-radius:var(--radius-xs);min-inline-size:0;display:inline}.redir-address:focus-visible{outline:var(--focus-width) solid var(--focus-ring);outline-offset:1px}.redir-cell>.app-tooltip-anchor{text-overflow:ellipsis;white-space:nowrap;min-inline-size:0;display:block;overflow:hidden}.redir-full{overflow-wrap:anywhere}.redir-address__lead{color:var(--ink-secondary)}.redir-address__path{color:var(--ink-primary)}.redir-arrow{color:var(--ink-tertiary);text-align:center}.redir-kind{white-space:nowrap;color:var(--ink-primary)}.redir-kind__code{color:var(--ink-tertiary);font-size:var(--text-xs)}.redir-table__foot{padding:var(--space-2) var(--space-3);border-block-start:var(--border-hair) solid var(--border-subtle);margin:0}@media (width<=1280px){.redir-table__head,.redir-row{grid-template-columns:20px minmax(0,1.25fr) 16px minmax(0,1fr) 96px 64px}.redir-col--source{display:none}}@media (width<=760px){.redir-table__head,.redir-row{grid-template-columns:20px minmax(0,1fr) 16px minmax(0,1fr) 64px}.redir-col--source,.redir-table__head>:nth-child(5),.redir-row>:nth-child(5){display:none}.redir-edit{grid-template-columns:minmax(0,1fr)}.redir-edit>.redir-arrow{display:none}}.redir-edit__actions{gap:var(--space-1);justify-content:flex-end;display:flex}.redir-edit__problem{margin:var(--space-1) 0 0;color:var(--danger-ink);font-size:var(--text-sm);grid-column:1/-1}.redir-adding{padding:var(--space-1) var(--space-3)}.redir-adding>.redir-edit{padding-inline:0}.redir-order{margin:0}.redir-empty{padding-block-end:var(--space-4)}.redir-empty__offers{justify-content:center;gap:var(--space-2);flex-wrap:wrap;display:flex}.redir-offer{justify-content:space-between;align-items:center;gap:var(--space-3);padding:var(--space-2) var(--space-3);font-size:var(--text-sm);margin-block-end:var(--space-3);display:flex}.redir-panel{gap:var(--space-3);display:grid}.redir-panel__title{font-family:var(--font-text);font-size:var(--text-md);font-weight:var(--weight-semibold);color:var(--ink-primary);margin:0;padding:0}.redir-panel p{margin:0}.redir-where__host{align-items:baseline;gap:var(--space-2);display:flex}.redir-where__how{color:var(--ink-secondary);font-size:var(--text-sm);line-height:var(--leading-body)}.redir-where__over,.redir-where__leftover{gap:var(--space-2);font-size:var(--text-sm);color:var(--warning-ink);align-items:flex-start;display:flex}.redir-where__leftover{color:var(--ink-secondary);justify-content:space-between}.redir-where__docs{font-size:var(--text-sm);color:var(--ink-secondary)}.redir-where__docs>summary{cursor:pointer;color:var(--ink-primary)}.redir-where__docs ul{margin:var(--space-2) 0 0;gap:var(--space-1);line-height:var(--leading-body);padding-inline-start:var(--space-5);display:grid}.redir-derived{gap:var(--space-2);padding:var(--space-3);border-radius:var(--radius-sm);background:var(--surface-sunken);justify-items:start;display:grid}.redir-derived__file{gap:var(--space-2);font-size:var(--text-sm);flex-wrap:wrap;align-items:baseline;display:flex}.redir-derived__file .app-link-button{gap:var(--space-1);align-items:center;display:inline-flex}.redir-derived__state{gap:var(--space-2);font-size:var(--text-sm);align-items:center;display:flex}.redir-derived__state--success{color:var(--success-ink)}.redir-derived__state--warning{color:var(--warning-ink)}.redir-derived__state--neutral{color:var(--ink-secondary)}.redir-meters{gap:var(--space-2);display:grid}.redir-meter{gap:var(--space-1);font-size:var(--text-sm);display:grid}.redir-meter__label{font-variant-numeric:tabular-nums;justify-content:space-between;display:flex}.redir-meter__bar{border-radius:var(--radius-pill);background:var(--surface-sunken);block-size:6px;display:block;overflow:hidden}.redir-meter__bar>span{border-radius:inherit;background:var(--accent);block-size:100%;transition:inline-size var(--duration-slow) var(--ease-out);display:block}.redir-meter--over .redir-meter__bar>span{background:var(--danger)}@media (prefers-reduced-motion:reduce){.redir-meter__bar>span{transition:none}}.redir-exports ul{margin:var(--space-2) 0 0;gap:var(--space-2);flex-wrap:wrap;padding:0;list-style:none;display:flex}.redir-hosts{gap:var(--space-2);border:0;min-inline-size:0;margin:0;padding:0;display:grid}.redir-hosts>legend{margin-block-end:var(--space-1)}.redir-hosts__options{gap:var(--space-2);grid-template-columns:1fr 1fr;display:grid}.redir-host{gap:var(--space-1);text-align:start;padding:var(--space-3);cursor:pointer;border:var(--border-hair) solid var(--border-default);border-radius:var(--radius-md);background:var(--surface-raised);color:var(--ink-primary);font:inherit;transition:border-color var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard);display:grid}.redir-host:hover:not(:disabled){border-color:var(--border-strong);transform:translateY(-1px)}.redir-host:active:not(:disabled){transform:translateY(0)}.redir-host:focus-visible{outline:var(--focus-width) solid var(--focus-ring);outline-offset:var(--focus-offset)}.redir-host--suggested{border-color:var(--accent-line)}.redir-host--on{border-color:var(--accent);background:var(--accent-subtle)}.redir-host__name{gap:var(--space-2);font-weight:var(--weight-semibold);align-items:center;display:flex}.redir-host__blurb{color:var(--ink-secondary);font-size:var(--text-xs);line-height:var(--leading-sm)}@media (prefers-reduced-motion:reduce){.redir-host,.redir-host:hover:not(:disabled){transition:none;transform:none}}.redir-cf{gap:var(--space-2);border-block-start:var(--border-hair) solid var(--border-subtle);justify-items:start;padding-block-start:var(--space-3);display:grid}.redir-cf__title{font-size:var(--text-sm);font-weight:var(--weight-semibold);margin:0}.redir-cf__text{color:var(--ink-secondary);font-size:var(--text-sm);line-height:var(--leading-body)}.redir-cf__last{gap:var(--space-2);font-size:var(--text-sm);color:var(--success-ink);align-items:flex-start;display:flex}.redir-cf__last--behind{color:var(--warning-ink)}.redir-try__form{gap:var(--space-2);display:flex}.redir-try__form>.g-input{flex:1;min-inline-size:0}.redir-try__result{gap:var(--space-2);display:grid}.redir-try__hops{gap:var(--space-1);font-size:var(--text-sm);margin:0;padding:0;list-style:none;display:grid}.redir-try__hops>li{gap:var(--space-1-5);padding:var(--space-1-5) var(--space-2);border-radius:var(--radius-sm);background:var(--surface-sunken);flex-wrap:wrap;align-items:baseline;display:flex}.redir-try__hops .redir-kind{font-size:var(--text-xs);margin-inline-start:auto}.redir-try__line{gap:var(--space-1);font-size:var(--text-sm);line-height:var(--leading-body);flex-wrap:wrap;align-items:baseline;display:flex}.redir-try__line--ok{color:var(--success-ink)}.redir-try__line--danger{color:var(--danger-ink)}.redir-try__note{font-size:var(--text-sm);color:var(--warning-ink);line-height:var(--leading-body)}.redir-health__ok{gap:var(--space-2);font-size:var(--text-sm);color:var(--success-ink);line-height:var(--leading-body);display:flex}.redir-health__group{gap:var(--space-1);font-size:var(--text-sm);display:grid}.redir-health__title{font-weight:var(--weight-semibold)}.redir-health__group ul{gap:var(--space-1);margin:0;padding:0;list-style:none;display:grid}.redir-health__group li{gap:var(--space-1);flex-wrap:wrap;align-items:center;display:flex}.redir-many{gap:var(--space-5);grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);align-items:start;min-block-size:420px;display:grid}@media (width<=900px){.redir-many{grid-template-columns:minmax(0,1fr)}}.redir-many__source{gap:var(--space-3);display:grid}.redir-many__drop{gap:var(--space-2);padding:var(--space-2);border:var(--border-thick) dashed var(--border-default);border-radius:var(--radius-md);transition:border-color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard);display:grid}.redir-many__drop--on{border-color:var(--accent);background:var(--accent-subtle)}.redir-many__drop .g-textarea{background:0 0;border:0;min-block-size:168px}.redir-many__actions{gap:var(--space-2);align-items:center;display:flex}.redir-many__file{gap:var(--space-2);padding:var(--space-3);border-radius:var(--radius-md);background:var(--surface-sunken);font-size:var(--text-sm);align-items:center;display:flex}.redir-many__file>span{text-overflow:ellipsis;flex:1;min-inline-size:0;overflow:hidden}.redir-many__offers{gap:var(--space-1);flex-wrap:wrap;display:flex}.redir-many__review{gap:var(--space-3);max-block-size:62vh;align-content:start;padding-inline-end:var(--space-1);display:grid;overflow-y:auto}.redir-many__idle{padding:var(--space-6) var(--space-4);border-radius:var(--radius-md);background:var(--surface-sunken);color:var(--ink-secondary);font-size:var(--text-sm);line-height:var(--leading-body);margin:0}.redir-many__summary{gap:var(--space-2);flex-wrap:wrap;align-items:center;margin:0;display:flex}.redir-many__hosts p{gap:var(--space-1);font-size:var(--text-sm);flex-wrap:wrap;align-items:center;margin:0;display:flex}.redir-many__clean,.redir-many__blocked{gap:var(--space-2);font-size:var(--text-sm);margin:0;display:flex}.redir-many__clean{color:var(--success-ink)}.redir-many__blocked{color:var(--danger-ink);font-weight:var(--weight-medium)}.redir-tally{gap:var(--space-2);grid-template-columns:repeat(4,minmax(0,1fr));margin:0;display:grid}.redir-tally>div{padding:var(--space-2) var(--space-3);border-radius:var(--radius-sm);background:var(--surface-sunken)}.redir-tally dt{font-size:var(--text-xs);color:var(--ink-secondary)}.redir-tally dd{font-size:var(--text-lg);font-weight:var(--weight-semibold);font-variant-numeric:tabular-nums;margin:0}.redir-problems{gap:var(--space-2);margin:0;padding:0;list-style:none;display:grid}.redir-problem{gap:var(--space-1-5);padding:var(--space-3);border:var(--border-hair) solid var(--border-default);border-radius:var(--radius-md);background:var(--surface-raised);display:grid}.redir-problem--danger{border-color:var(--danger);background:var(--danger-tint)}.redir-problem__head{gap:var(--space-2);grid-template-columns:18px minmax(0,1fr);align-items:start;display:grid}.redir-problem__resolve{margin-inline-start:26px}.redir-problem__resolve:empty{display:none}.redir-problem__mark{margin-block-start:2px}.redir-problem--danger .redir-problem__mark{color:var(--danger-ink)}.redir-problem--warning .redir-problem__mark{color:var(--warning-ink)}.redir-problem--info .redir-problem__mark{color:var(--ink-tertiary)}.redir-problem__text{gap:var(--space-0-5);display:grid}.redir-problem__title{font-weight:var(--weight-semibold);font-size:var(--text-sm);margin:0}.redir-problem__body{color:var(--ink-secondary);font-size:var(--text-sm);line-height:var(--leading-body);margin:0}.redir-problem__toggle{font-size:var(--text-sm);justify-self:start;margin-inline-start:26px}.redir-problem__examples{gap:var(--space-1);font-size:var(--text-xs);margin:0 0 0 26px;padding:0;list-style:none;display:grid}.redir-problem__examples>li{gap:var(--space-1-5);flex-wrap:wrap;align-items:baseline;display:flex}.redir-problem__line{color:var(--ink-tertiary);min-inline-size:52px}.redir-problem__from{overflow-wrap:anywhere}.redir-problem__detail{color:var(--ink-secondary);flex-basis:100%;padding-inline-start:58px}.redir-preview{gap:var(--space-2);display:grid}.redir-preview>.g-eyebrow{margin:0}.redir-preview__table{border:var(--border-hair) solid var(--border-subtle);border-radius:var(--radius-sm);max-block-size:280px;overflow-y:auto}.redir-preview__row{gap:var(--space-2);padding:var(--space-1-5) var(--space-2);font-size:var(--text-xs);border-block-end:var(--border-hair) solid var(--border-subtle);grid-template-columns:76px minmax(0,1fr) 14px minmax(0,1fr) 108px;align-items:center;display:grid}.redir-preview__row:last-child{border-block-end:0}.redir-compare{gap:var(--space-3);grid-template-columns:1fr 1fr;display:grid}.redir-compare__text{margin:var(--space-1) 0 0;padding:var(--space-3);border-radius:var(--radius-sm);background:var(--surface-sunken);max-block-size:50vh;font-size:var(--text-xs);line-height:var(--leading-sm);white-space:pre;overflow:auto}.redir-cfd{gap:var(--space-4);display:grid}.redir-cfd__facts{gap:var(--space-1-5);font-size:var(--text-sm);line-height:var(--leading-body);color:var(--ink-secondary);margin:0;padding-inline-start:var(--space-5);display:grid}.redir-cfd__key{gap:var(--space-1);color:var(--warning-ink);font-size:var(--text-sm);flex-wrap:wrap;align-items:baseline;margin:0;display:flex}.redir-cfd__perm>summary{cursor:pointer;font-size:var(--text-sm);font-weight:var(--weight-medium)}.redir-cfd__remove{font-size:var(--text-sm);color:var(--danger-ink);justify-self:start}.redir-cfd__progress{gap:var(--space-3);justify-items:start;display:grid}.redir-cfd__progress>.redir-meter__bar{justify-self:stretch}.redir-cfd__progress p{margin:0}.redir-cfd__done{gap:var(--space-3);display:grid}.redir-cfd__ok{gap:var(--space-2);color:var(--success-ink);margin:0;display:flex}.redir-cfd__diff{color:var(--warning-ink);font-size:var(--text-sm);margin:0;padding-inline-start:var(--space-5)}.redir-key{gap:var(--space-2);margin-block-start:var(--space-2);display:grid}.redir-key__steps{gap:var(--space-1);font-size:var(--text-sm);line-height:var(--leading-body);margin:0;padding-inline-start:var(--space-6);display:grid}.redir-plan{gap:var(--space-3);display:grid}.redir-plan__headline{font-family:var(--font-display);font-size:var(--text-xl);line-height:var(--leading-heading);margin:0}.redir-plan__facts{gap:var(--space-1);font-size:var(--text-sm);color:var(--ink-secondary);line-height:var(--leading-body);margin:0;padding-inline-start:var(--space-5);display:grid}.redir-plan__list>summary{cursor:pointer;font-size:var(--text-sm);font-weight:var(--weight-medium)}.redir-plan__list ul{margin:var(--space-2) 0 0;gap:var(--space-1);font-size:var(--text-xs);overflow-wrap:anywhere;max-block-size:200px;padding:0;list-style:none;display:grid;overflow-y:auto}.redir-plan__note{gap:var(--space-2);font-size:var(--text-sm);color:var(--ink-secondary);line-height:var(--leading-body);align-items:flex-start;margin:0;display:flex}.redir-plan__note>.g-icon{color:var(--warning-ink);flex:none;margin-block-start:2px}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$ as e,A as t,At as n,F as r,Ft as i,I as a,N as o,Nt as s,O as c,_ as l,a as u,bt as d,c as f,g as p,gt as m,i as h,j as g,k as _,mt as v,n as y,pt as b,v as x,vt as ee}from"./ui-C6O2tW4c.js";import{A as S,B as C,C as w,D as T,H as E,M as D,N as O,P as k,R as A,S as te,V as ne,b as j,c as re,d as ie,f as ae,h as oe,i as se,j as M,l as ce,n as N,o as le,p as ue,t as de,v as P,y as F,z as I}from"./ProviderSettings-BOiCGeSI.js";import{n as L}from"./chrome-Brnq5kGb.js";import{E as fe,T as R,_ as pe,b as me,g as he,i as ge,n as _e,y as ve}from"./outside-DaBM5h5B.js";import{_ as ye,a as be,i as xe}from"./listPlan-BXud7Oxv.js";import{t as z}from"./site-DJUEXLHW.js";import{A as Se,F as Ce}from"./index-Djh-DSIT.js";var B=i(s(),1);function V(e){return oe.find(t=>t.kind===e)??ae(e)}function H(e){return e.label?.trim()||V(e.kind)?.name||e.kind}function we(e){let t=V(e.kind),n=e.kind===`custom`?M(e.settings.src)?`src`:null:t?.settings.find(e=>e.required)?.key??t?.settings[0]?.key??null;return n&&M(e.settings[n]).trim()||null}function U(e){return e.category===`tag-manager`||e.category===`analytics`?`eager`:e.category===`support`?`interaction`:`idle`}function Te(e,t,n){let r=new Set(n),i=e.kind;for(let t=2;r.has(i);t++)i=`${e.kind}-${t}`;let a={};for(let[e,n]of Object.entries(t))M(n).trim()&&(a[e]=typeof n==`string`?n.trim():n);return{id:i,kind:e.kind,enabled:!0,settings:a,placement:e.defaultPlacement,load:U(e),consent:e.defaultConsent}}var W={eager:{label:`Straight away`,line:`Loads with the page. Needed for tags that must see the first page view.`},idle:{label:`When idle`,line:`Waits until the page has finished loading, so it doesn’t slow the page down.`},interaction:{label:`First interaction`,line:`Waits for the visitor’s first scroll, tap or key press. Best for chat and pop-ups.`}},G={necessary:{label:`Necessary`,line:`Always loads. Only for scripts the site can’t work without, or that keep no record of the visitor.`},analytics:{label:`Analytics`,line:`Measures visits. Loads once the visitor agrees to analytics.`},marketing:{label:`Marketing`,line:`Advertising and follow-up. Loads once the visitor agrees to marketing.`},preferences:{label:`Preferences`,line:`Remembers choices and powers extras like chat. Loads once the visitor agrees to preferences.`}},K={head:`In the page head`,"body-start":`At the start of the page`,"body-end":`At the end of the page`},q={"tag-manager":`Tag managers`,analytics:`Analytics`,advertising:`Advertising`,marketing:`Marketing`,support:`Support and chat`,other:`Other`};function J(e){return e.consent??V(e.kind)?.defaultConsent??`necessary`}function Y(e){return e.load??`eager`}function Ee(e){return{gtm:`GTM`,ga4:`GA`,"meta-pixel":`Me`,"linkedin-insight":`in`,hubspot:`Hs`,"marketo-munchkin":`Mk`,plausible:`Pl`,segment:`Sg`,hotjar:`Hj`,clarity:`Cl`,intercom:`Ic`,custom:`</>`}[e]??e.slice(0,2)}var X=d();function De(e,t){let n=`${e.name} ${e.description} ${q[e.category]}`.toLowerCase();return t.toLowerCase().split(/\s+/).filter(Boolean).every(e=>n.includes(e))}function Oe({open:e,onClose:i,taken:a,allowBuild:o,onAdd:s}){let[u,d]=(0,B.useState)(``),{siteId:f=``}=n(),p=ue(f),[h,_]=(0,B.useState)(null),[v,y]=(0,B.useState)({}),[x,S]=(0,B.useState)(`src`),[C,w]=(0,B.useState)(!1);(0,B.useEffect)(()=>{e&&(d(``),_(null),y({}),S(`src`),w(!1))},[e]);let T=(0,B.useMemo)(()=>{let e=p.scriptIntegrations.filter(e=>De(e,u));return Object.keys(q).map(t=>({category:t,items:e.filter(e=>e.category===t)})).filter(e=>e.items.length>0)},[u,p.scriptIntegrations]),E=h?.kind===`custom`,D=(h?.settings??[]).filter(e=>!E||e.key===x),O=Object.fromEntries(D.map(e=>[e.key,se(E?{...e,required:!0}:e,v[e.key])]).filter(([,e])=>e)),k=h!==null&&Object.keys(O).length===0,A=()=>{if(w(!0),!h||!k)return;let e={};for(let t of D)v[t.key]?.trim()&&(e[t.key]=v[t.key]??``);let t=Te(h,e,a);s(re(h)?ie(t,h,p.nameOf(h.plugin)):t),i()};return(0,X.jsx)(r,{open:e,onClose:i,title:h?`Add ${h.name}`:`Add a script`,description:h?h.description:`Pick what to add. You’ll only be asked for what it needs.`,size:`lg`,footer:h?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(b,{variant:`secondary`,onClick:()=>_(null),children:`Back to the list`}),(0,X.jsxs)(b,{variant:`primary`,onClick:A,disabled:C&&!k,children:[`Add `,h.name]})]}):(0,X.jsx)(b,{variant:`secondary`,onClick:i,children:`Not now`}),children:h?(0,X.jsxs)(`div`,{className:`kit-add`,children:[E?(0,X.jsx)(g,{label:`How it’s added`,group:!0,hint:o?void 0:`Writing code into the page is only offered on sites where build mode is allowed, because it runs with full access to every page.`,children:(0,X.jsx)(l,{label:`How it’s added`,options:[{value:`src`,label:`From an address`},{value:`inline`,label:`Code`,disabled:!o}],value:x,onChange:S})}):null,D.map(e=>{let n=C||v[e.key]?O[e.key]:void 0;return(0,X.jsx)(g,{label:e.label,hint:n?void 0:e.help??(e.placeholder?`Looks like ${e.placeholder}`:void 0),error:n,children:e.key===`inline`?(0,X.jsx)(t,{mono:!0,rows:6,maxRows:16,spellCheck:!1,value:v[e.key]??``,onChange:t=>y({...v,[e.key]:t.target.value})}):(0,X.jsx)(c,{mono:!0,spellCheck:!1,placeholder:e.placeholder,value:v[e.key]??``,onChange:t=>y({...v,[e.key]:t.target.value}),onKeyDown:e=>e.key===`Enter`&&A()})},e.key)}),(0,X.jsxs)(`div`,{className:m(`kit-add__defaults`),children:[(0,X.jsx)(`p`,{className:`g-eyebrow`,children:`Already chosen for you`}),(0,X.jsxs)(`ul`,{children:[(0,X.jsxs)(`li`,{children:[W[U(h)].label,` — `,W[U(h)].line]}),(0,X.jsxs)(`li`,{children:[K[h.defaultPlacement],`.`]}),(0,X.jsxs)(`li`,{children:[`Consent: `,G[h.defaultConsent].label,`. `,G[h.defaultConsent].line]}),(0,X.jsx)(`li`,{children:`Every page. You can limit it to some pages once it’s added.`})]})]})]}):(0,X.jsxs)(`div`,{className:`kit-catalogue`,children:[(0,X.jsx)(c,{"aria-label":`Search scripts`,placeholder:`Search — analytics, chat, ads…`,value:u,onChange:e=>d(e.target.value),"data-autofocus":!0}),T.length===0?(0,X.jsxs)(`p`,{className:`g-hint`,children:[`Nothing matches “`,u,`”. Try a shorter word, or add a custom script.`]}):null,T.map(e=>(0,X.jsxs)(`section`,{className:`kit-catalogue__group`,"aria-label":q[e.category],children:[(0,X.jsx)(`p`,{className:`g-eyebrow`,children:q[e.category]}),(0,X.jsx)(`div`,{className:`kit-catalogue__items`,children:e.items.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:`kit-catalogue__item`,onClick:()=>{_(e),y({}),w(!1)},children:[(0,X.jsx)(N,{text:Ee(e.kind)}),(0,X.jsxs)(`span`,{className:`kit-catalogue__text`,children:[(0,X.jsx)(`span`,{className:`kit-catalogue__name`,children:e.name}),(0,X.jsx)(`span`,{className:`kit-catalogue__description`,children:e.description}),e.plugin===`@galley/builtin`?null:(0,X.jsxs)(`span`,{className:`kit-catalogue__description`,children:[`From the plugin `,p.nameOf(e.plugin)]})]}),(0,X.jsx)(ee,{name:`chevron-right`})]},e.kind))})]},e.category))]})})}var ke=[{value:`none`,label:`Off`},{value:`banner`,label:`Built-in banner`},{value:`external`,label:`Another consent tool`}],Ae={none:`Every switched-on script loads for every visitor, without asking.`,banner:`The site asks visitors first, with a small banner. Scripts wait for the categories they need.`,external:`Your own consent tool asks, and tells the site what visitors agreed to. Scripts wait for it.`},je=[`analytics`,`marketing`,`preferences`],Z={title:`Cookies and tracking`,text:`This site would like to measure visits and the success of its marketing. Choose what it may use. You can change this at any time from the link at the bottom of each page.`,acceptLabel:`Accept all`,rejectLabel:`Reject all`,settingsLabel:`Choose…`};function Me({banner:e,theme:t}){return(0,X.jsxs)(`div`,{className:`kit-banner-frame`,"data-theme":t,children:[(0,X.jsxs)(`div`,{className:`kit-banner`,"aria-hidden":`true`,children:[(0,X.jsx)(`p`,{className:`kit-banner__title`,children:e.title||Z.title}),(0,X.jsxs)(`p`,{className:`kit-banner__text`,children:[e.text||Z.text,` `,e.policyUrl?(0,X.jsx)(`span`,{className:`g-link`,children:`Privacy policy`}):null]}),(0,X.jsxs)(`span`,{className:`kit-banner__buttons`,children:[(0,X.jsx)(`span`,{className:`kit-pv__button`,children:e.acceptLabel||Z.acceptLabel}),(0,X.jsx)(`span`,{className:`kit-pv__button`,children:e.rejectLabel||Z.rejectLabel}),(0,X.jsx)(`span`,{className:`kit-pv__button kit-pv__button--back`,children:e.settingsLabel||Z.settingsLabel})]})]}),(0,X.jsx)(`span`,{className:`kit-banner-frame__label`,children:t===`light`?`Light`:`Dark`})]})}function Ne({config:t,trackingWithoutConsent:n}){let r=j(),i=ne(),a=t.consent,o=a?.mode??`none`,s=new Set(a?.defaults??[]),c=a?.banner??{},u=(e,t)=>{let n=je.filter(n=>n===e?t:s.has(n));r.choose([`consent`,`defaults`],n.length?n:void 0)};return(0,X.jsxs)(`section`,{className:m(`g-block kit-consent`,i.has(`area:consent`)&&`kit-consent--flash`),"aria-labelledby":`consent-title`,children:[(0,X.jsx)(`header`,{className:`g-block__head`,children:(0,X.jsx)(`h2`,{id:`consent-title`,className:`kit-tab-head__title`,children:`Consent`})}),(0,X.jsxs)(`div`,{className:`g-block__body kit-consent__body`,children:[(0,X.jsx)(g,{label:`Ask visitors first`,group:!0,hint:Ae[o],children:(0,X.jsx)(l,{label:`Ask visitors first`,options:ke,value:o,onChange:e=>r.choose([`consent`,`mode`],e)})}),n?(0,X.jsxs)(`p`,{className:`g-margin-note kit-note kit-note--warning`,role:`status`,children:[(0,X.jsx)(e,{kind:`bang`}),(0,X.jsx)(`span`,{children:`Analytics or marketing scripts are switched on with consent off. In many countries visitors must agree before these load.`})]}):null,o===`banner`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`kit-consent__texts`,children:[(0,X.jsx)(P,{path:[`consent`,`banner`,`title`],label:`Title`,placeholder:Z.title}),(0,X.jsx)(P,{path:[`consent`,`banner`,`text`],label:`Text`,placeholder:Z.text,multiline:!0}),(0,X.jsxs)(`div`,{className:`app-form-row`,children:[(0,X.jsx)(P,{path:[`consent`,`banner`,`acceptLabel`],label:`Accept button`,placeholder:Z.acceptLabel}),(0,X.jsx)(P,{path:[`consent`,`banner`,`rejectLabel`],label:`Refuse button`,placeholder:Z.rejectLabel})]}),(0,X.jsxs)(`div`,{className:`app-form-row`,children:[(0,X.jsx)(P,{path:[`consent`,`banner`,`settingsLabel`],label:`Choices button`,placeholder:Z.settingsLabel}),(0,X.jsx)(P,{path:[`consent`,`banner`,`policyUrl`],label:`Privacy policy page`,mono:!0,placeholder:`/privacy/`})]})]}),(0,X.jsxs)(`div`,{className:`kit-consent__previews`,"aria-label":`Banner preview`,children:[(0,X.jsx)(Me,{banner:c,theme:`light`}),(0,X.jsx)(Me,{banner:c,theme:`dark`})]})]}):null,o===`none`?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(g,{label:`On before the visitor chooses`,group:!0,hint:`Necessary scripts always load. Leave these off where the law asks for agreement first.`,children:(0,X.jsx)(`div`,{className:`kit-checks`,children:je.map(e=>(0,X.jsx)(h,{label:G[e].label,description:G[e].line,checked:s.has(e),onChange:t=>u(e,t)},e))})}),(0,X.jsx)(F,{path:[`consent`,`googleConsentMode`],label:`Tell Google tags about consent (Consent Mode)`,description:`Google Analytics and Tag Manager are told what visitors agreed to, so they can adjust what they record.`})]})]})]})}function Pe(e){let t=[],n=new Map;e.scripts.forEach((e,t)=>n.set(e.id,[...n.get(e.id)??[],t]));for(let[e,r]of n)e&&r.length>1&&t.push({id:`id-${e}`,tone:`warning`,text:`${r.length} scripts use the name “${e}”. Give each its own, so changes and page rules apply to the right one.`,scripts:r});let r=new Map;e.scripts.forEach((e,t)=>{if(!e.enabled)return;let n=we(e);if(!n)return;let i=`${e.kind}\n${n}`;r.set(i,[...r.get(i)??[],t])});for(let[n,i]of r){if(i.length<2)continue;let r=e.scripts[i[0]],a=n.split(`
|
|
2
|
-
`)[1]??``;t.push({id:`tag-${n}`,tone:`warning`,text:`${r?H(r):`This script`} is installed ${i.length} times with ${a}. Visits would be counted more than once — switch one off.`,scripts:i})}let i=e.scripts.flatMap((e,t)=>e.enabled&&e.kind===`ga4`?[t]:[]),a=e.scripts.flatMap((e,t)=>e.enabled&&e.kind===`gtm`?[t]:[]);if(i.length>0&&a.length>0&&t.push({id:`ga4-in-gtm`,tone:`info`,text:`Google Analytics is often set up inside the Tag Manager container too. If yours is, page views are counted twice — keep it in one place.`,scripts:[...i,...a]}),(e.consent?.mode??`none`)===`none`){let n=e.scripts.flatMap((e,t)=>{let n=J(e);return e.enabled&&(n===`analytics`||n===`marketing`)?[t]:[]});n.length>0&&t.push({id:`no-consent`,tone:`warning`,text:`Analytics and marketing scripts load without asking, because consent is off. In many countries visitors must agree before these load.`,scripts:n})}return t}function Q(e){let t=e.trim(),n=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i.exec(t);return n&&(t=t.slice(n[0].length)),t=t.split(/[?#]/)[0]??``,t.startsWith(`/`)||(t=`/${t}`),t=t.replace(/\/{2,}/g,`/`),t.length>1&&(t=t.replace(/\/+$/,``)),t}function Fe(e){let t=``,n=e.trim();n.startsWith(`/`)||(n=`/${n}`),n=n.replace(/\/+$/,``);for(let e=0;e<n.length;e+=1){let r=n[e];r===`*`&&n[e+1]===`*`?(t.endsWith(`/`)?t=`${t.slice(0,-1)}(?:/.*)?`:t+=`.*`,e+=1):t+=r===`*`?`[^/]*`:r===`?`?`[^/]`:r.replace(/[.+^${}()|[\]\\]/g,`\\$&`)}return RegExp(`^${t}/?$`)}function Ie(e,t){let n=Q(t);return Fe(e).test(n)||e.trim().replace(/\/+$/,``)===``&&n===`/`}function Le(e,t){let n=e.include??[],r=(e.exclude??[]).find(e=>Ie(e,t));if(r)return{loads:!1,because:{list:`exclude`,pattern:r}};if(n.length===0)return{loads:!0};let i=n.find(e=>Ie(e,t));return i?{loads:!0,because:{list:`include`,pattern:i}}:{loads:!1}}function Re(e){return(e.include??[]).length>0?`only`:(e.exclude??[]).length>0?`except`:`everywhere`}function ze(e){let t=Re(e),n=e=>(e??[]).map(e=>e.trim()||`/`).join(`, `);return t===`only`?`Only ${n(e.include)}${(e.exclude??[]).length?`, not ${n(e.exclude)}`:``}`:t===`except`?`Every page except ${n(e.exclude)}`:`Every page`}var Be=[{value:`everywhere`,label:`Every page`},{value:`only`,label:`Only these`},{value:`except`,label:`All except`}];function Ve({entry:e}){let[t,n]=(0,B.useState)(``),r=t.trim()?Le(e,t):null;return(0,X.jsxs)(g,{label:`Try an address`,hint:r?void 0:`Type a page address to see whether this script loads there.`,children:[(0,X.jsx)(c,{mono:!0,size:`sm`,placeholder:`/pricing/teams/`,value:t,onChange:e=>n(e.target.value)}),r?(0,X.jsxs)(`p`,{className:r.loads?`kit-verdict kit-verdict--yes`:`kit-verdict kit-verdict--no`,role:`status`,children:[r.loads?`Loads here`:`Doesn’t load here`,r.because?` — matches ${r.because.pattern}`:r.loads?` — it loads on every page`:` — no pattern matches`]}):null]})}function He({index:e,entry:t}){let n=j(),r=Re(t),[i,a]=(0,B.useState)(null),o=r===`everywhere`&&i?i:r,s=o===`except`?`exclude`:`include`,u=(o===`except`?t.exclude:t.include)??[],d=[`scripts`,e,s],f=r=>{if(a(r),r===o)return;let i=u.filter(e=>e.trim());if(r===`everywhere`){n.apply(...t.include?[{op:`unset`,path:[`scripts`,e,`include`]}]:[],...t.exclude?[{op:`unset`,path:[`scripts`,e,`exclude`]}]:[]);return}if(i.length===0)return;let c=r===`except`?`exclude`:`include`;n.apply({op:`unset`,path:[`scripts`,e,s]},{op:`set`,path:[`scripts`,e,c],value:i})},p=u.length>0?u:o===`everywhere`?[]:[``];return(0,X.jsxs)(`div`,{className:`kit-insp__group`,children:[(0,X.jsx)(g,{label:`Pages`,group:!0,children:(0,X.jsx)(l,{label:`Pages`,options:Be,value:o,onChange:f})}),o===`everywhere`?null:(0,X.jsxs)(g,{label:o===`only`?`Load only on`:`Don’t load on`,group:!0,hint:`A page address per line. * stands for one part of the address (/blog/*), ** for any number (/docs/**).`,children:[(0,X.jsx)(`ul`,{className:`kit-patterns`,children:p.map((e,t)=>(0,X.jsxs)(`li`,{className:`kit-pattern`,children:[(0,X.jsx)(c,{mono:!0,size:`sm`,"aria-label":`Page pattern ${t+1}`,placeholder:`/pricing/*`,value:e,onChange:e=>{let r=e.target.value;u.length===0?n.type(d,r?[r]:void 0):n.type([...d,t],r,!0)},onBlur:e=>{e.target.value.trim()===``&&u.length>0?n.apply(u.length===1?{op:`unset`,path:d}:{op:`remove`,path:d,index:t}):(n.commit(d),n.commit([...d,t]))}}),u.length>0?(0,X.jsx)(v,{icon:`close`,label:`Remove ${e||`pattern`}`,onClick:()=>n.apply(u.length===1?{op:`unset`,path:d}:{op:`remove`,path:d,index:t})}):null]},t))}),u.length>0?(0,X.jsx)(b,{size:`sm`,variant:`secondary`,icon:`plus`,onClick:()=>n.apply({op:`insert`,path:d,index:u.length,value:``}),children:`Add an address`}):null]}),(0,X.jsx)(Ve,{entry:t})]})}var Ue=[`necessary`,`analytics`,`marketing`,`preferences`];function We({index:t,entry:n}){let r=j(),i=I(),a=V(n.kind),o=(...e)=>[`scripts`,t,...e],s=Y(n),c=J(n),u=n.kind===`custom`,d=M(n.settings.inline).trim()!==``,f=(a?.settings??[]).filter(e=>!(u&&e.key===`inline`&&!i));return(0,X.jsxs)(`div`,{className:`kit-script-detail`,children:[(0,X.jsxs)(`div`,{className:`kit-script-detail__col`,children:[(0,X.jsx)(P,{path:o(`label`),label:`Name in this app`,placeholder:a?.name??n.kind}),f.length>0?(0,X.jsx)(de,{path:o(`settings`),specs:f,values:n.settings}):(0,X.jsx)(`p`,{className:`g-hint`,children:`This kind of script isn’t in the catalogue; its settings stay as they are in the file.`}),u&&!i?(0,X.jsxs)(`p`,{className:`g-margin-note kit-note`,children:[(0,X.jsx)(e,{kind:`reg`}),(0,X.jsx)(`span`,{children:d?`This script runs code written into the site. It can only be changed where build mode is allowed.`:`Custom code can only be added on sites where build mode is allowed. A script address works everywhere.`})]}):null,a?.docsUrl?(0,X.jsxs)(`a`,{className:`g-link`,href:a.docsUrl,target:`_blank`,rel:`noreferrer`,children:[`Where to find these in `,a.name]}):null,(0,X.jsx)(P,{path:o(`note`),label:`Note for colleagues`,multiline:!0,placeholder:`Who asked for it and why — “added for the spring campaign, ask before removing”`})]}),(0,X.jsxs)(`div`,{className:`kit-script-detail__col`,children:[(0,X.jsx)(He,{index:t,entry:n}),(0,X.jsx)(g,{label:`When it loads`,group:!0,hint:W[s].line,children:(0,X.jsx)(l,{label:`When it loads`,options:Object.keys(W).map(e=>({value:e,label:W[e].label})),value:s,onChange:e=>r.choose(o(`load`),e)})}),(0,X.jsx)(g,{label:`Consent`,group:!0,hint:G[c].line,children:(0,X.jsx)(l,{label:`Consent`,options:Ue.map(e=>({value:e,label:G[e].label})),value:c,onChange:e=>r.choose(o(`consent`),e)})}),(0,X.jsx)(g,{label:`Where in the page`,children:(0,X.jsx)(_,{value:n.placement??a?.defaultPlacement??`head`,options:Object.keys(K).map(e=>({value:e,label:K[e]})),onChange:e=>r.choose(o(`placement`),e)})}),(0,X.jsx)(F,{path:o(`inPreview`),label:`Also load in preview and development`,description:`Off by default, so your own testing isn’t counted as visits or sent to your ad accounts.`})]})]})}function Ge({index:t}){let n=[`scripts`,t],r=pe(n),i=he(n);return r===0?null:(0,X.jsxs)(`span`,{className:`g-field__state`,children:[(0,X.jsx)(e,{kind:`caret`}),i===`added`?`New`:`Edited`]})}var Ke=(0,B.memo)(function({index:t,total:n,open:r,warned:i,drag:a,onToggle:o,onMove:s,onRemove:c}){let l=me([`scripts`,t]),d=j(),p=ne(),h=(0,B.useRef)(null),g=S(l);if(!g)return null;let _=H(g),y=we(g),b=J(g),x=e=>{if(!e.altKey||e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return;e.preventDefault();let r=t+(e.key===`ArrowUp`?-1:1);r>=0&&r<n&&s(t,r)};return(0,X.jsxs)(`section`,{ref:h,className:m(`g-block kit-script`,!g.enabled&&`kit-script--off`,p.has(`script:${g.id}`)&&`kit-script--flash`,i&&`kit-script--warned`),"aria-label":_,...a.card(t),children:[(0,X.jsxs)(`div`,{className:`kit-script__row`,onKeyDown:x,children:[(0,X.jsx)(`span`,{className:`kit-dest__grip`,"aria-hidden":`true`,title:`Drag to change the order`,...a.grip(t,()=>h.current),children:(0,X.jsx)(fe,{name:`grip`})}),(0,X.jsx)(N,{text:Ee(g.kind)}),(0,X.jsxs)(`button`,{type:`button`,className:`kit-script__open`,"aria-expanded":r,onClick:()=>o(t),"aria-keyshortcuts":`Alt+ArrowUp Alt+ArrowDown`,children:[(0,X.jsx)(e,{kind:`chevron`,className:m(`app-card__chevron`,!r&&`app-card__chevron--closed`)}),(0,X.jsxs)(`span`,{className:`kit-script__titles`,children:[(0,X.jsx)(`span`,{className:`kit-script__name`,children:_}),(0,X.jsx)(`span`,{className:`kit-script__id g-mono`,children:y??(g.kind===`custom`?`Code written into the page`:V(g.kind)?`Not set up yet`:ce(g.kind))})]}),(0,X.jsxs)(`span`,{className:`g-sr`,children:[`, script `,t+1,` of `,n,`. Alt and arrow keys move it.`]})]}),(0,X.jsxs)(`span`,{className:`kit-script__facts`,children:[(0,X.jsx)(`span`,{children:ze(g)}),(0,X.jsx)(`span`,{children:W[Y(g)].label}),(0,X.jsx)(f,{tone:b===`necessary`?`neutral`:`info`,mark:null,children:G[b].label})]}),(0,X.jsx)(Ge,{index:t}),(0,X.jsx)(`span`,{className:`kit-script__switch`,children:(0,X.jsx)(u,{checked:g.enabled,"aria-label":g.enabled?`${_} is on`:`${_} is off`,onChange:e=>d.choose([`scripts`,t,`enabled`],e)})}),(0,X.jsxs)(`span`,{className:`kit-dest__tools`,children:[(0,X.jsx)(R,{icon:`arrow-up`,label:`Move ${_} up`,disabled:t===0,onClick:()=>s(t,t-1)}),(0,X.jsx)(R,{icon:`arrow-down`,label:`Move ${_} down`,disabled:t===n-1,onClick:()=>s(t,t+1)}),(0,X.jsx)(v,{icon:`trash`,label:`Remove ${_}`,onClick:()=>c(t)})]})]}),g.note&&!r?(0,X.jsx)(`p`,{className:`kit-script__note`,children:g.note}):null,r?(0,X.jsx)(`div`,{className:`g-block__body`,children:(0,X.jsx)(We,{index:t,entry:g})}):null]})});function qe(e,t){return e===`necessary`||(t?.mode??`none`)===`none`?!1:!(t?.defaults??[]).includes(e)}function Je(e,t){let n=J(e);return qe(n,t)?`Waits until ${t?.mode===`external`?`your consent tool`:`the visitor`} allows ${n}`:null}function Ye(e,t,n={}){let r=[],i=[];return e.scripts.forEach((a,o)=>{let s=H(a);if(!a.enabled)return void i.push({index:o,name:s,reason:`Switched off`});if(n.preview&&!a.inPreview)return void i.push({index:o,name:s,reason:`Not loaded in preview`});let c=Le(a,t);if(c.loads)r.push({index:o,id:a.id,name:s,load:Y(a),consent:J(a),waitsFor:Je(a,e.consent)});else{let e=c.because?`Not on pages matching ${c.because.pattern}`:`Only on ${(a.include??[]).join(`, `)}`;i.push({index:o,name:s,reason:e})}}),{loads:r,skipped:i}}function Xe({config:e,suggestions:t}){let[n,r]=(0,B.useState)(`/`),i=(0,B.useMemo)(()=>Ye(e,n||`/`),[e,n]),a=Q(n||`/`);return(0,X.jsxs)(`section`,{className:`g-block kit-where`,"aria-labelledby":`where-title`,children:[(0,X.jsx)(`header`,{className:`g-block__head`,children:(0,X.jsx)(`h2`,{id:`where-title`,className:`kit-tab-head__title`,children:`What loads where`})}),(0,X.jsxs)(`div`,{className:`g-block__body`,children:[(0,X.jsx)(g,{label:`Page address`,children:(0,X.jsx)(c,{mono:!0,value:n,onChange:e=>r(e.target.value),placeholder:`/pricing/`})}),t.length?(0,X.jsx)(`div`,{className:`kit-where__chips`,children:t.map(e=>(0,X.jsx)(`button`,{type:`button`,className:`g-chip`,onClick:()=>r(e),"aria-pressed":Q(e)===a,children:e},e))}):null,(0,X.jsxs)(`div`,{role:`status`,"aria-live":`polite`,children:[i.loads.length===0?(0,X.jsxs)(`p`,{className:`g-hint`,children:[`No scripts load on `,a,`.`]}):(0,X.jsx)(`ol`,{className:`kit-where__list`,children:i.loads.map(e=>(0,X.jsxs)(`li`,{className:`kit-where__item`,children:[(0,X.jsx)(`span`,{className:`kit-where__name`,children:e.name}),(0,X.jsxs)(`span`,{className:`kit-where__facts`,children:[W[e.load].label,e.waitsFor?` · ${e.waitsFor}`:` · No agreement needed`]})]},e.index))}),i.skipped.length>0?(0,X.jsxs)(`details`,{className:`app-details`,children:[(0,X.jsxs)(`summary`,{children:[`Not loaded here (`,i.skipped.length,`)`]}),(0,X.jsx)(`ul`,{className:`kit-where__skipped`,children:i.skipped.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`b`,{children:e.name}),` `,(0,X.jsx)(`span`,{className:`g-muted`,children:e.reason})]},e.index))})]}):null]})]})]})}var $=[`scripts`],Ze=[`Add GA4 with ID G-ABC123 and only load it after consent`,`Turn on the built-in consent banner with Consent Mode`,`Load the chat widget only on /support/**`];function Qe({open:e,setOpen:t,onAdd:n,warned:r}){let i=j(),a=me($),s=Array.isArray(a)?a:[],c=te(),l=(0,B.useRef)(null),u=(n,r)=>{let a=xe($,s.length,n,r);a&&(i.apply(...a.ops),e.has(n)&&t(new Set([...e].filter(e=>e!==n).concat(r))))},d=le(l,u),f=e=>{let n=be($,s,e),r=c.scripts[e];n&&r&&(i.apply(...n.ops),t(new Set),y({tone:`neutral`,title:`${H(r)} removed`,body:`It stops loading on the site when you publish. Undo puts it back where it was.`,action:{label:`Undo`,onClick:()=>i.apply(...n.undo)},duration:1e4}))},p=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)};return s.length===0?(0,X.jsx)(o,{compact:!0,title:`No scripts yet.`,body:`Add analytics, a tag manager, ad tracking or a chat widget. Nothing loads until you publish.`,actions:(0,X.jsx)(b,{variant:`primary`,icon:`plus`,onClick:n,children:`Add a script`})}):(0,X.jsx)(`div`,{className:`kit-scripts`,ref:l,children:s.map((t,n)=>(0,X.jsx)(Ke,{index:n,total:s.length,open:e.has(n),warned:r.has(n),drag:d,onToggle:p,onMove:u,onRemove:f},n))})}function $e({siteId:t,entry:n}){let r=z(e=>e.detail?.name??`Site`),i=z(e=>e.detail?.model.collections.find(e=>e.id===`pages`)?.url??null);L({crumbs:[{label:r,to:`/sites/${t}`},{label:`Scripts`}],...n.status===`modified`?{tag:{label:`Edited`,tone:`change`}}:n.status===`added`?{tag:{label:`New`,tone:`insert`}}:{}});let a=te(),o=j(),s=I(),c=z(e=>e.detail?.model),l=ve(e=>e.outside),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(()=>new Set),m=(0,B.useMemo)(()=>Pe(a),[a]),h=(0,B.useMemo)(()=>new Set(m.filter(e=>e.tone===`warning`&&e.id!==`no-consent`).flatMap(e=>e.scripts)),[m]),g=(0,B.useMemo)(()=>{let e=a.scripts.flatMap(e=>[...e.include??[],...e.exclude??[]]).map(e=>e.replace(/\*\*?/g,`example`).replace(/\?/g,`x`));return[...new Set([`/`,i?i.replace(`{slug}`,`about`):`/about/`,...e])].slice(0,6)},[a.scripts,i]),_=e=>{let t=a.scripts.length;o.apply(ye($,t,D(e))),p(new Set([t]))},v=m.some(e=>e.id===`no-consent`);return(0,X.jsxs)(`div`,{className:`app-screen kit-scripts-screen`,children:[(0,X.jsxs)(`div`,{className:`app-screen__inner app-screen__inner--wide`,children:[(0,X.jsx)(x,{eyebrow:`Site`,title:`Scripts`,description:`Analytics, tags and widgets the site loads. Adding or changing one is powerful, so every change waits in Proof like any other until you publish.`,actions:(0,X.jsx)(b,{variant:`primary`,icon:`plus`,onClick:()=>d(!0),children:`Add a script`})}),(0,X.jsx)(w,{subject:`scripts`,context:`About the scripts setup in ${n.path}:`,examples:Ze,placeholder:`Add GA4 with ID G-… and only load it after consent`}),(0,X.jsx)(O,{step:`layout`}),(0,X.jsx)(_e,{fields:n.fields,noun:Se(c,n.collection)}),(0,X.jsx)(ge,{}),l?(0,X.jsxs)(`p`,{className:`g-margin-note kit-note`,role:`status`,children:[(0,X.jsx)(e,{kind:`transpose`}),(0,X.jsx)(`span`,{children:l.origin===`agent`?`The assistant changed the scripts. What it changed is marked for a moment.`:`The scripts setup changed outside the app. This shows the latest version.`})]},l.at):null,m.filter(e=>e.id!==`no-consent`).map(t=>(0,X.jsxs)(`p`,{className:t.tone===`warning`?`g-margin-note kit-note kit-note--warning`:`g-margin-note kit-note`,role:`status`,children:[(0,X.jsx)(e,{kind:t.tone===`warning`?`bang`:`pilcrow`}),(0,X.jsx)(`span`,{children:t.text})]},t.id)),(0,X.jsxs)(`div`,{className:`kit-scripts-layout`,children:[(0,X.jsxs)(`section`,{className:`kit-scripts-layout__main`,"aria-labelledby":`installed-title`,children:[(0,X.jsx)(`h2`,{id:`installed-title`,className:`kit-tab-head__title`,children:`Installed`}),(0,X.jsx)(Qe,{open:f,setOpen:p,onAdd:()=>d(!0),warned:h})]}),(0,X.jsxs)(`div`,{className:`kit-scripts-layout__side`,children:[(0,X.jsx)(Ne,{config:a,trackingWithoutConsent:v}),(0,X.jsx)(Xe,{config:a,suggestions:g})]})]})]}),(0,X.jsx)(Oe,{open:u,onClose:()=>d(!1),taken:a.scripts.map(e=>e.id),allowBuild:s,onAdd:_})]})}function et({siteId:e,siteName:t}){return L({crumbs:[{label:t,to:`/sites/${e}`},{label:`Scripts`}]}),null}function tt(){let{siteId:e=``}=n(),t=z(e=>e.detail),r=t?.name??`Site`,i=t&&t.id===e?Ce(t.model):null,o=E(e,i?.path??null),s;if(!t||t.id!==e||i&&o.loading)s=(0,X.jsx)(`div`,{className:`app-screen`,"aria-busy":`true`,children:(0,X.jsxs)(`div`,{className:`app-screen__inner`,children:[(0,X.jsx)(p,{width:120,height:12}),(0,X.jsx)(p,{width:240,height:28,style:{marginBlock:`var(--space-3) var(--space-6)`}}),(0,X.jsx)(p,{lines:5,height:14})]})});else if(!i)s=(0,X.jsx)(`div`,{className:`app-screen`,children:(0,X.jsxs)(`div`,{className:`app-screen__inner`,children:[(0,X.jsx)(x,{eyebrow:`Site`,title:`Scripts`}),(0,X.jsx)(k,{feature:`scripts`})]})});else if(!o.data)s=(0,X.jsx)(`div`,{className:`app-screen app-screen--center`,children:(0,X.jsx)(a,{title:`Couldn’t open the scripts setup`,error:o.error,onRetry:()=>void o.refetch()})});else return(0,X.jsx)(C,{siteId:e,entry:o.data,marksFor:T,children:(0,X.jsxs)(`div`,{className:`kit-screen`,children:[(0,X.jsx)($e,{siteId:e,entry:o.data}),(0,X.jsx)(A,{siteId:e,entryPath:o.data.path})]})},o.data.path);return(0,X.jsxs)(`div`,{className:`kit-screen`,children:[(0,X.jsx)(et,{siteId:e,siteName:r}),s,(0,X.jsx)(A,{siteId:e})]})}export{tt as ScriptsScreen};
|
|
1
|
+
import{$ as e,A as t,At as n,F as r,Ft as i,I as a,N as o,Nt as s,O as c,_ as l,a as u,bt as d,c as f,g as p,gt as m,i as h,j as g,k as _,mt as v,n as y,pt as b,v as x,vt as ee}from"./ui-C6O2tW4c.js";import{A as S,B as C,C as w,D as T,H as E,M as D,N as O,P as k,R as A,S as te,V as ne,b as j,c as re,d as ie,f as ae,h as oe,i as se,j as M,l as ce,n as N,o as le,p as ue,t as de,v as P,y as F,z as I}from"./ProviderSettings-CbQQdCdU.js";import{n as L}from"./chrome-Brnq5kGb.js";import{E as fe,T as R,_ as pe,b as me,g as he,i as ge,n as _e,y as ve}from"./outside-1xNdvt-F.js";import{_ as ye,a as be,i as xe}from"./listPlan-Bds9RfG_.js";import{t as z}from"./site-DJUEXLHW.js";import{I as Se,j as Ce}from"./index-A7aTfJ-x.js";var B=i(s(),1);function V(e){return oe.find(t=>t.kind===e)??ae(e)}function H(e){return e.label?.trim()||V(e.kind)?.name||e.kind}function we(e){let t=V(e.kind),n=e.kind===`custom`?M(e.settings.src)?`src`:null:t?.settings.find(e=>e.required)?.key??t?.settings[0]?.key??null;return n&&M(e.settings[n]).trim()||null}function U(e){return e.category===`tag-manager`||e.category===`analytics`?`eager`:e.category===`support`?`interaction`:`idle`}function Te(e,t,n){let r=new Set(n),i=e.kind;for(let t=2;r.has(i);t++)i=`${e.kind}-${t}`;let a={};for(let[e,n]of Object.entries(t))M(n).trim()&&(a[e]=typeof n==`string`?n.trim():n);return{id:i,kind:e.kind,enabled:!0,settings:a,placement:e.defaultPlacement,load:U(e),consent:e.defaultConsent}}var W={eager:{label:`Straight away`,line:`Loads with the page. Needed for tags that must see the first page view.`},idle:{label:`When idle`,line:`Waits until the page has finished loading, so it doesn’t slow the page down.`},interaction:{label:`First interaction`,line:`Waits for the visitor’s first scroll, tap or key press. Best for chat and pop-ups.`}},G={necessary:{label:`Necessary`,line:`Always loads. Only for scripts the site can’t work without, or that keep no record of the visitor.`},analytics:{label:`Analytics`,line:`Measures visits. Loads once the visitor agrees to analytics.`},marketing:{label:`Marketing`,line:`Advertising and follow-up. Loads once the visitor agrees to marketing.`},preferences:{label:`Preferences`,line:`Remembers choices and powers extras like chat. Loads once the visitor agrees to preferences.`}},K={head:`In the page head`,"body-start":`At the start of the page`,"body-end":`At the end of the page`},q={"tag-manager":`Tag managers`,analytics:`Analytics`,advertising:`Advertising`,marketing:`Marketing`,support:`Support and chat`,other:`Other`};function J(e){return e.consent??V(e.kind)?.defaultConsent??`necessary`}function Y(e){return e.load??`eager`}function Ee(e){return{gtm:`GTM`,ga4:`GA`,"meta-pixel":`Me`,"linkedin-insight":`in`,hubspot:`Hs`,"marketo-munchkin":`Mk`,plausible:`Pl`,segment:`Sg`,hotjar:`Hj`,clarity:`Cl`,intercom:`Ic`,custom:`</>`}[e]??e.slice(0,2)}var X=d();function De(e,t){let n=`${e.name} ${e.description} ${q[e.category]}`.toLowerCase();return t.toLowerCase().split(/\s+/).filter(Boolean).every(e=>n.includes(e))}function Oe({open:e,onClose:i,taken:a,allowBuild:o,onAdd:s}){let[u,d]=(0,B.useState)(``),{siteId:f=``}=n(),p=ue(f),[h,_]=(0,B.useState)(null),[v,y]=(0,B.useState)({}),[x,S]=(0,B.useState)(`src`),[C,w]=(0,B.useState)(!1);(0,B.useEffect)(()=>{e&&(d(``),_(null),y({}),S(`src`),w(!1))},[e]);let T=(0,B.useMemo)(()=>{let e=p.scriptIntegrations.filter(e=>De(e,u));return Object.keys(q).map(t=>({category:t,items:e.filter(e=>e.category===t)})).filter(e=>e.items.length>0)},[u,p.scriptIntegrations]),E=h?.kind===`custom`,D=(h?.settings??[]).filter(e=>!E||e.key===x),O=Object.fromEntries(D.map(e=>[e.key,se(E?{...e,required:!0}:e,v[e.key])]).filter(([,e])=>e)),k=h!==null&&Object.keys(O).length===0,A=()=>{if(w(!0),!h||!k)return;let e={};for(let t of D)v[t.key]?.trim()&&(e[t.key]=v[t.key]??``);let t=Te(h,e,a);s(re(h)?ie(t,h,p.nameOf(h.plugin)):t),i()};return(0,X.jsx)(r,{open:e,onClose:i,title:h?`Add ${h.name}`:`Add a script`,description:h?h.description:`Pick what to add. You’ll only be asked for what it needs.`,size:`lg`,footer:h?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(b,{variant:`secondary`,onClick:()=>_(null),children:`Back to the list`}),(0,X.jsxs)(b,{variant:`primary`,onClick:A,disabled:C&&!k,children:[`Add `,h.name]})]}):(0,X.jsx)(b,{variant:`secondary`,onClick:i,children:`Not now`}),children:h?(0,X.jsxs)(`div`,{className:`kit-add`,children:[E?(0,X.jsx)(g,{label:`How it’s added`,group:!0,hint:o?void 0:`Writing code into the page is only offered on sites where build mode is allowed, because it runs with full access to every page.`,children:(0,X.jsx)(l,{label:`How it’s added`,options:[{value:`src`,label:`From an address`},{value:`inline`,label:`Code`,disabled:!o}],value:x,onChange:S})}):null,D.map(e=>{let n=C||v[e.key]?O[e.key]:void 0;return(0,X.jsx)(g,{label:e.label,hint:n?void 0:e.help??(e.placeholder?`Looks like ${e.placeholder}`:void 0),error:n,children:e.key===`inline`?(0,X.jsx)(t,{mono:!0,rows:6,maxRows:16,spellCheck:!1,value:v[e.key]??``,onChange:t=>y({...v,[e.key]:t.target.value})}):(0,X.jsx)(c,{mono:!0,spellCheck:!1,placeholder:e.placeholder,value:v[e.key]??``,onChange:t=>y({...v,[e.key]:t.target.value}),onKeyDown:e=>e.key===`Enter`&&A()})},e.key)}),(0,X.jsxs)(`div`,{className:m(`kit-add__defaults`),children:[(0,X.jsx)(`p`,{className:`g-eyebrow`,children:`Already chosen for you`}),(0,X.jsxs)(`ul`,{children:[(0,X.jsxs)(`li`,{children:[W[U(h)].label,` — `,W[U(h)].line]}),(0,X.jsxs)(`li`,{children:[K[h.defaultPlacement],`.`]}),(0,X.jsxs)(`li`,{children:[`Consent: `,G[h.defaultConsent].label,`. `,G[h.defaultConsent].line]}),(0,X.jsx)(`li`,{children:`Every page. You can limit it to some pages once it’s added.`})]})]})]}):(0,X.jsxs)(`div`,{className:`kit-catalogue`,children:[(0,X.jsx)(c,{"aria-label":`Search scripts`,placeholder:`Search — analytics, chat, ads…`,value:u,onChange:e=>d(e.target.value),"data-autofocus":!0}),T.length===0?(0,X.jsxs)(`p`,{className:`g-hint`,children:[`Nothing matches “`,u,`”. Try a shorter word, or add a custom script.`]}):null,T.map(e=>(0,X.jsxs)(`section`,{className:`kit-catalogue__group`,"aria-label":q[e.category],children:[(0,X.jsx)(`p`,{className:`g-eyebrow`,children:q[e.category]}),(0,X.jsx)(`div`,{className:`kit-catalogue__items`,children:e.items.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:`kit-catalogue__item`,onClick:()=>{_(e),y({}),w(!1)},children:[(0,X.jsx)(N,{text:Ee(e.kind)}),(0,X.jsxs)(`span`,{className:`kit-catalogue__text`,children:[(0,X.jsx)(`span`,{className:`kit-catalogue__name`,children:e.name}),(0,X.jsx)(`span`,{className:`kit-catalogue__description`,children:e.description}),e.plugin===`@galley/builtin`?null:(0,X.jsxs)(`span`,{className:`kit-catalogue__description`,children:[`From the plugin `,p.nameOf(e.plugin)]})]}),(0,X.jsx)(ee,{name:`chevron-right`})]},e.kind))})]},e.category))]})})}var ke=[{value:`none`,label:`Off`},{value:`banner`,label:`Built-in banner`},{value:`external`,label:`Another consent tool`}],Ae={none:`Every switched-on script loads for every visitor, without asking.`,banner:`The site asks visitors first, with a small banner. Scripts wait for the categories they need.`,external:`Your own consent tool asks, and tells the site what visitors agreed to. Scripts wait for it.`},je=[`analytics`,`marketing`,`preferences`],Z={title:`Cookies and tracking`,text:`This site would like to measure visits and the success of its marketing. Choose what it may use. You can change this at any time from the link at the bottom of each page.`,acceptLabel:`Accept all`,rejectLabel:`Reject all`,settingsLabel:`Choose…`};function Me({banner:e,theme:t}){return(0,X.jsxs)(`div`,{className:`kit-banner-frame`,"data-theme":t,children:[(0,X.jsxs)(`div`,{className:`kit-banner`,"aria-hidden":`true`,children:[(0,X.jsx)(`p`,{className:`kit-banner__title`,children:e.title||Z.title}),(0,X.jsxs)(`p`,{className:`kit-banner__text`,children:[e.text||Z.text,` `,e.policyUrl?(0,X.jsx)(`span`,{className:`g-link`,children:`Privacy policy`}):null]}),(0,X.jsxs)(`span`,{className:`kit-banner__buttons`,children:[(0,X.jsx)(`span`,{className:`kit-pv__button`,children:e.acceptLabel||Z.acceptLabel}),(0,X.jsx)(`span`,{className:`kit-pv__button`,children:e.rejectLabel||Z.rejectLabel}),(0,X.jsx)(`span`,{className:`kit-pv__button kit-pv__button--back`,children:e.settingsLabel||Z.settingsLabel})]})]}),(0,X.jsx)(`span`,{className:`kit-banner-frame__label`,children:t===`light`?`Light`:`Dark`})]})}function Ne({config:t,trackingWithoutConsent:n}){let r=j(),i=ne(),a=t.consent,o=a?.mode??`none`,s=new Set(a?.defaults??[]),c=a?.banner??{},u=(e,t)=>{let n=je.filter(n=>n===e?t:s.has(n));r.choose([`consent`,`defaults`],n.length?n:void 0)};return(0,X.jsxs)(`section`,{className:m(`g-block kit-consent`,i.has(`area:consent`)&&`kit-consent--flash`),"aria-labelledby":`consent-title`,children:[(0,X.jsx)(`header`,{className:`g-block__head`,children:(0,X.jsx)(`h2`,{id:`consent-title`,className:`kit-tab-head__title`,children:`Consent`})}),(0,X.jsxs)(`div`,{className:`g-block__body kit-consent__body`,children:[(0,X.jsx)(g,{label:`Ask visitors first`,group:!0,hint:Ae[o],children:(0,X.jsx)(l,{label:`Ask visitors first`,options:ke,value:o,onChange:e=>r.choose([`consent`,`mode`],e)})}),n?(0,X.jsxs)(`p`,{className:`g-margin-note kit-note kit-note--warning`,role:`status`,children:[(0,X.jsx)(e,{kind:`bang`}),(0,X.jsx)(`span`,{children:`Analytics or marketing scripts are switched on with consent off. In many countries visitors must agree before these load.`})]}):null,o===`banner`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`kit-consent__texts`,children:[(0,X.jsx)(P,{path:[`consent`,`banner`,`title`],label:`Title`,placeholder:Z.title}),(0,X.jsx)(P,{path:[`consent`,`banner`,`text`],label:`Text`,placeholder:Z.text,multiline:!0}),(0,X.jsxs)(`div`,{className:`app-form-row`,children:[(0,X.jsx)(P,{path:[`consent`,`banner`,`acceptLabel`],label:`Accept button`,placeholder:Z.acceptLabel}),(0,X.jsx)(P,{path:[`consent`,`banner`,`rejectLabel`],label:`Refuse button`,placeholder:Z.rejectLabel})]}),(0,X.jsxs)(`div`,{className:`app-form-row`,children:[(0,X.jsx)(P,{path:[`consent`,`banner`,`settingsLabel`],label:`Choices button`,placeholder:Z.settingsLabel}),(0,X.jsx)(P,{path:[`consent`,`banner`,`policyUrl`],label:`Privacy policy page`,mono:!0,placeholder:`/privacy/`})]})]}),(0,X.jsxs)(`div`,{className:`kit-consent__previews`,"aria-label":`Banner preview`,children:[(0,X.jsx)(Me,{banner:c,theme:`light`}),(0,X.jsx)(Me,{banner:c,theme:`dark`})]})]}):null,o===`none`?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(g,{label:`On before the visitor chooses`,group:!0,hint:`Necessary scripts always load. Leave these off where the law asks for agreement first.`,children:(0,X.jsx)(`div`,{className:`kit-checks`,children:je.map(e=>(0,X.jsx)(h,{label:G[e].label,description:G[e].line,checked:s.has(e),onChange:t=>u(e,t)},e))})}),(0,X.jsx)(F,{path:[`consent`,`googleConsentMode`],label:`Tell Google tags about consent (Consent Mode)`,description:`Google Analytics and Tag Manager are told what visitors agreed to, so they can adjust what they record.`})]})]})]})}function Pe(e){let t=[],n=new Map;e.scripts.forEach((e,t)=>n.set(e.id,[...n.get(e.id)??[],t]));for(let[e,r]of n)e&&r.length>1&&t.push({id:`id-${e}`,tone:`warning`,text:`${r.length} scripts use the name “${e}”. Give each its own, so changes and page rules apply to the right one.`,scripts:r});let r=new Map;e.scripts.forEach((e,t)=>{if(!e.enabled)return;let n=we(e);if(!n)return;let i=`${e.kind}\n${n}`;r.set(i,[...r.get(i)??[],t])});for(let[n,i]of r){if(i.length<2)continue;let r=e.scripts[i[0]],a=n.split(`
|
|
2
|
+
`)[1]??``;t.push({id:`tag-${n}`,tone:`warning`,text:`${r?H(r):`This script`} is installed ${i.length} times with ${a}. Visits would be counted more than once — switch one off.`,scripts:i})}let i=e.scripts.flatMap((e,t)=>e.enabled&&e.kind===`ga4`?[t]:[]),a=e.scripts.flatMap((e,t)=>e.enabled&&e.kind===`gtm`?[t]:[]);if(i.length>0&&a.length>0&&t.push({id:`ga4-in-gtm`,tone:`info`,text:`Google Analytics is often set up inside the Tag Manager container too. If yours is, page views are counted twice — keep it in one place.`,scripts:[...i,...a]}),(e.consent?.mode??`none`)===`none`){let n=e.scripts.flatMap((e,t)=>{let n=J(e);return e.enabled&&(n===`analytics`||n===`marketing`)?[t]:[]});n.length>0&&t.push({id:`no-consent`,tone:`warning`,text:`Analytics and marketing scripts load without asking, because consent is off. In many countries visitors must agree before these load.`,scripts:n})}return t}function Q(e){let t=e.trim(),n=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i.exec(t);return n&&(t=t.slice(n[0].length)),t=t.split(/[?#]/)[0]??``,t.startsWith(`/`)||(t=`/${t}`),t=t.replace(/\/{2,}/g,`/`),t.length>1&&(t=t.replace(/\/+$/,``)),t}function Fe(e){let t=``,n=e.trim();n.startsWith(`/`)||(n=`/${n}`),n=n.replace(/\/+$/,``);for(let e=0;e<n.length;e+=1){let r=n[e];r===`*`&&n[e+1]===`*`?(t.endsWith(`/`)?t=`${t.slice(0,-1)}(?:/.*)?`:t+=`.*`,e+=1):t+=r===`*`?`[^/]*`:r===`?`?`[^/]`:r.replace(/[.+^${}()|[\]\\]/g,`\\$&`)}return RegExp(`^${t}/?$`)}function Ie(e,t){let n=Q(t);return Fe(e).test(n)||e.trim().replace(/\/+$/,``)===``&&n===`/`}function Le(e,t){let n=e.include??[],r=(e.exclude??[]).find(e=>Ie(e,t));if(r)return{loads:!1,because:{list:`exclude`,pattern:r}};if(n.length===0)return{loads:!0};let i=n.find(e=>Ie(e,t));return i?{loads:!0,because:{list:`include`,pattern:i}}:{loads:!1}}function Re(e){return(e.include??[]).length>0?`only`:(e.exclude??[]).length>0?`except`:`everywhere`}function ze(e){let t=Re(e),n=e=>(e??[]).map(e=>e.trim()||`/`).join(`, `);return t===`only`?`Only ${n(e.include)}${(e.exclude??[]).length?`, not ${n(e.exclude)}`:``}`:t===`except`?`Every page except ${n(e.exclude)}`:`Every page`}var Be=[{value:`everywhere`,label:`Every page`},{value:`only`,label:`Only these`},{value:`except`,label:`All except`}];function Ve({entry:e}){let[t,n]=(0,B.useState)(``),r=t.trim()?Le(e,t):null;return(0,X.jsxs)(g,{label:`Try an address`,hint:r?void 0:`Type a page address to see whether this script loads there.`,children:[(0,X.jsx)(c,{mono:!0,size:`sm`,placeholder:`/pricing/teams/`,value:t,onChange:e=>n(e.target.value)}),r?(0,X.jsxs)(`p`,{className:r.loads?`kit-verdict kit-verdict--yes`:`kit-verdict kit-verdict--no`,role:`status`,children:[r.loads?`Loads here`:`Doesn’t load here`,r.because?` — matches ${r.because.pattern}`:r.loads?` — it loads on every page`:` — no pattern matches`]}):null]})}function He({index:e,entry:t}){let n=j(),r=Re(t),[i,a]=(0,B.useState)(null),o=r===`everywhere`&&i?i:r,s=o===`except`?`exclude`:`include`,u=(o===`except`?t.exclude:t.include)??[],d=[`scripts`,e,s],f=r=>{if(a(r),r===o)return;let i=u.filter(e=>e.trim());if(r===`everywhere`){n.apply(...t.include?[{op:`unset`,path:[`scripts`,e,`include`]}]:[],...t.exclude?[{op:`unset`,path:[`scripts`,e,`exclude`]}]:[]);return}if(i.length===0)return;let c=r===`except`?`exclude`:`include`;n.apply({op:`unset`,path:[`scripts`,e,s]},{op:`set`,path:[`scripts`,e,c],value:i})},p=u.length>0?u:o===`everywhere`?[]:[``];return(0,X.jsxs)(`div`,{className:`kit-insp__group`,children:[(0,X.jsx)(g,{label:`Pages`,group:!0,children:(0,X.jsx)(l,{label:`Pages`,options:Be,value:o,onChange:f})}),o===`everywhere`?null:(0,X.jsxs)(g,{label:o===`only`?`Load only on`:`Don’t load on`,group:!0,hint:`A page address per line. * stands for one part of the address (/blog/*), ** for any number (/docs/**).`,children:[(0,X.jsx)(`ul`,{className:`kit-patterns`,children:p.map((e,t)=>(0,X.jsxs)(`li`,{className:`kit-pattern`,children:[(0,X.jsx)(c,{mono:!0,size:`sm`,"aria-label":`Page pattern ${t+1}`,placeholder:`/pricing/*`,value:e,onChange:e=>{let r=e.target.value;u.length===0?n.type(d,r?[r]:void 0):n.type([...d,t],r,!0)},onBlur:e=>{e.target.value.trim()===``&&u.length>0?n.apply(u.length===1?{op:`unset`,path:d}:{op:`remove`,path:d,index:t}):(n.commit(d),n.commit([...d,t]))}}),u.length>0?(0,X.jsx)(v,{icon:`close`,label:`Remove ${e||`pattern`}`,onClick:()=>n.apply(u.length===1?{op:`unset`,path:d}:{op:`remove`,path:d,index:t})}):null]},t))}),u.length>0?(0,X.jsx)(b,{size:`sm`,variant:`secondary`,icon:`plus`,onClick:()=>n.apply({op:`insert`,path:d,index:u.length,value:``}),children:`Add an address`}):null]}),(0,X.jsx)(Ve,{entry:t})]})}var Ue=[`necessary`,`analytics`,`marketing`,`preferences`];function We({index:t,entry:n}){let r=j(),i=I(),a=V(n.kind),o=(...e)=>[`scripts`,t,...e],s=Y(n),c=J(n),u=n.kind===`custom`,d=M(n.settings.inline).trim()!==``,f=(a?.settings??[]).filter(e=>!(u&&e.key===`inline`&&!i));return(0,X.jsxs)(`div`,{className:`kit-script-detail`,children:[(0,X.jsxs)(`div`,{className:`kit-script-detail__col`,children:[(0,X.jsx)(P,{path:o(`label`),label:`Name in this app`,placeholder:a?.name??n.kind}),f.length>0?(0,X.jsx)(de,{path:o(`settings`),specs:f,values:n.settings}):(0,X.jsx)(`p`,{className:`g-hint`,children:`This kind of script isn’t in the catalogue; its settings stay as they are in the file.`}),u&&!i?(0,X.jsxs)(`p`,{className:`g-margin-note kit-note`,children:[(0,X.jsx)(e,{kind:`reg`}),(0,X.jsx)(`span`,{children:d?`This script runs code written into the site. It can only be changed where build mode is allowed.`:`Custom code can only be added on sites where build mode is allowed. A script address works everywhere.`})]}):null,a?.docsUrl?(0,X.jsxs)(`a`,{className:`g-link`,href:a.docsUrl,target:`_blank`,rel:`noreferrer`,children:[`Where to find these in `,a.name]}):null,(0,X.jsx)(P,{path:o(`note`),label:`Note for colleagues`,multiline:!0,placeholder:`Who asked for it and why — “added for the spring campaign, ask before removing”`})]}),(0,X.jsxs)(`div`,{className:`kit-script-detail__col`,children:[(0,X.jsx)(He,{index:t,entry:n}),(0,X.jsx)(g,{label:`When it loads`,group:!0,hint:W[s].line,children:(0,X.jsx)(l,{label:`When it loads`,options:Object.keys(W).map(e=>({value:e,label:W[e].label})),value:s,onChange:e=>r.choose(o(`load`),e)})}),(0,X.jsx)(g,{label:`Consent`,group:!0,hint:G[c].line,children:(0,X.jsx)(l,{label:`Consent`,options:Ue.map(e=>({value:e,label:G[e].label})),value:c,onChange:e=>r.choose(o(`consent`),e)})}),(0,X.jsx)(g,{label:`Where in the page`,children:(0,X.jsx)(_,{value:n.placement??a?.defaultPlacement??`head`,options:Object.keys(K).map(e=>({value:e,label:K[e]})),onChange:e=>r.choose(o(`placement`),e)})}),(0,X.jsx)(F,{path:o(`inPreview`),label:`Also load in preview and development`,description:`Off by default, so your own testing isn’t counted as visits or sent to your ad accounts.`})]})]})}function Ge({index:t}){let n=[`scripts`,t],r=pe(n),i=he(n);return r===0?null:(0,X.jsxs)(`span`,{className:`g-field__state`,children:[(0,X.jsx)(e,{kind:`caret`}),i===`added`?`New`:`Edited`]})}var Ke=(0,B.memo)(function({index:t,total:n,open:r,warned:i,drag:a,onToggle:o,onMove:s,onRemove:c}){let l=me([`scripts`,t]),d=j(),p=ne(),h=(0,B.useRef)(null),g=S(l);if(!g)return null;let _=H(g),y=we(g),b=J(g),x=e=>{if(!e.altKey||e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return;e.preventDefault();let r=t+(e.key===`ArrowUp`?-1:1);r>=0&&r<n&&s(t,r)};return(0,X.jsxs)(`section`,{ref:h,className:m(`g-block kit-script`,!g.enabled&&`kit-script--off`,p.has(`script:${g.id}`)&&`kit-script--flash`,i&&`kit-script--warned`),"aria-label":_,...a.card(t),children:[(0,X.jsxs)(`div`,{className:`kit-script__row`,onKeyDown:x,children:[(0,X.jsx)(`span`,{className:`kit-dest__grip`,"aria-hidden":`true`,title:`Drag to change the order`,...a.grip(t,()=>h.current),children:(0,X.jsx)(fe,{name:`grip`})}),(0,X.jsx)(N,{text:Ee(g.kind)}),(0,X.jsxs)(`button`,{type:`button`,className:`kit-script__open`,"aria-expanded":r,onClick:()=>o(t),"aria-keyshortcuts":`Alt+ArrowUp Alt+ArrowDown`,children:[(0,X.jsx)(e,{kind:`chevron`,className:m(`app-card__chevron`,!r&&`app-card__chevron--closed`)}),(0,X.jsxs)(`span`,{className:`kit-script__titles`,children:[(0,X.jsx)(`span`,{className:`kit-script__name`,children:_}),(0,X.jsx)(`span`,{className:`kit-script__id g-mono`,children:y??(g.kind===`custom`?`Code written into the page`:V(g.kind)?`Not set up yet`:ce(g.kind))})]}),(0,X.jsxs)(`span`,{className:`g-sr`,children:[`, script `,t+1,` of `,n,`. Alt and arrow keys move it.`]})]}),(0,X.jsxs)(`span`,{className:`kit-script__facts`,children:[(0,X.jsx)(`span`,{children:ze(g)}),(0,X.jsx)(`span`,{children:W[Y(g)].label}),(0,X.jsx)(f,{tone:b===`necessary`?`neutral`:`info`,mark:null,children:G[b].label})]}),(0,X.jsx)(Ge,{index:t}),(0,X.jsx)(`span`,{className:`kit-script__switch`,children:(0,X.jsx)(u,{checked:g.enabled,"aria-label":g.enabled?`${_} is on`:`${_} is off`,onChange:e=>d.choose([`scripts`,t,`enabled`],e)})}),(0,X.jsxs)(`span`,{className:`kit-dest__tools`,children:[(0,X.jsx)(R,{icon:`arrow-up`,label:`Move ${_} up`,disabled:t===0,onClick:()=>s(t,t-1)}),(0,X.jsx)(R,{icon:`arrow-down`,label:`Move ${_} down`,disabled:t===n-1,onClick:()=>s(t,t+1)}),(0,X.jsx)(v,{icon:`trash`,label:`Remove ${_}`,onClick:()=>c(t)})]})]}),g.note&&!r?(0,X.jsx)(`p`,{className:`kit-script__note`,children:g.note}):null,r?(0,X.jsx)(`div`,{className:`g-block__body`,children:(0,X.jsx)(We,{index:t,entry:g})}):null]})});function qe(e,t){return e===`necessary`||(t?.mode??`none`)===`none`?!1:!(t?.defaults??[]).includes(e)}function Je(e,t){let n=J(e);return qe(n,t)?`Waits until ${t?.mode===`external`?`your consent tool`:`the visitor`} allows ${n}`:null}function Ye(e,t,n={}){let r=[],i=[];return e.scripts.forEach((a,o)=>{let s=H(a);if(!a.enabled)return void i.push({index:o,name:s,reason:`Switched off`});if(n.preview&&!a.inPreview)return void i.push({index:o,name:s,reason:`Not loaded in preview`});let c=Le(a,t);if(c.loads)r.push({index:o,id:a.id,name:s,load:Y(a),consent:J(a),waitsFor:Je(a,e.consent)});else{let e=c.because?`Not on pages matching ${c.because.pattern}`:`Only on ${(a.include??[]).join(`, `)}`;i.push({index:o,name:s,reason:e})}}),{loads:r,skipped:i}}function Xe({config:e,suggestions:t}){let[n,r]=(0,B.useState)(`/`),i=(0,B.useMemo)(()=>Ye(e,n||`/`),[e,n]),a=Q(n||`/`);return(0,X.jsxs)(`section`,{className:`g-block kit-where`,"aria-labelledby":`where-title`,children:[(0,X.jsx)(`header`,{className:`g-block__head`,children:(0,X.jsx)(`h2`,{id:`where-title`,className:`kit-tab-head__title`,children:`What loads where`})}),(0,X.jsxs)(`div`,{className:`g-block__body`,children:[(0,X.jsx)(g,{label:`Page address`,children:(0,X.jsx)(c,{mono:!0,value:n,onChange:e=>r(e.target.value),placeholder:`/pricing/`})}),t.length?(0,X.jsx)(`div`,{className:`kit-where__chips`,children:t.map(e=>(0,X.jsx)(`button`,{type:`button`,className:`g-chip`,onClick:()=>r(e),"aria-pressed":Q(e)===a,children:e},e))}):null,(0,X.jsxs)(`div`,{role:`status`,"aria-live":`polite`,children:[i.loads.length===0?(0,X.jsxs)(`p`,{className:`g-hint`,children:[`No scripts load on `,a,`.`]}):(0,X.jsx)(`ol`,{className:`kit-where__list`,children:i.loads.map(e=>(0,X.jsxs)(`li`,{className:`kit-where__item`,children:[(0,X.jsx)(`span`,{className:`kit-where__name`,children:e.name}),(0,X.jsxs)(`span`,{className:`kit-where__facts`,children:[W[e.load].label,e.waitsFor?` · ${e.waitsFor}`:` · No agreement needed`]})]},e.index))}),i.skipped.length>0?(0,X.jsxs)(`details`,{className:`app-details`,children:[(0,X.jsxs)(`summary`,{children:[`Not loaded here (`,i.skipped.length,`)`]}),(0,X.jsx)(`ul`,{className:`kit-where__skipped`,children:i.skipped.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`b`,{children:e.name}),` `,(0,X.jsx)(`span`,{className:`g-muted`,children:e.reason})]},e.index))})]}):null]})]})]})}var $=[`scripts`],Ze=[`Add GA4 with ID G-ABC123 and only load it after consent`,`Turn on the built-in consent banner with Consent Mode`,`Load the chat widget only on /support/**`];function Qe({open:e,setOpen:t,onAdd:n,warned:r}){let i=j(),a=me($),s=Array.isArray(a)?a:[],c=te(),l=(0,B.useRef)(null),u=(n,r)=>{let a=xe($,s.length,n,r);a&&(i.apply(...a.ops),e.has(n)&&t(new Set([...e].filter(e=>e!==n).concat(r))))},d=le(l,u),f=e=>{let n=be($,s,e),r=c.scripts[e];n&&r&&(i.apply(...n.ops),t(new Set),y({tone:`neutral`,title:`${H(r)} removed`,body:`It stops loading on the site when you publish. Undo puts it back where it was.`,action:{label:`Undo`,onClick:()=>i.apply(...n.undo)},duration:1e4}))},p=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)};return s.length===0?(0,X.jsx)(o,{compact:!0,title:`No scripts yet.`,body:`Add analytics, a tag manager, ad tracking or a chat widget. Nothing loads until you publish.`,actions:(0,X.jsx)(b,{variant:`primary`,icon:`plus`,onClick:n,children:`Add a script`})}):(0,X.jsx)(`div`,{className:`kit-scripts`,ref:l,children:s.map((t,n)=>(0,X.jsx)(Ke,{index:n,total:s.length,open:e.has(n),warned:r.has(n),drag:d,onToggle:p,onMove:u,onRemove:f},n))})}function $e({siteId:t,entry:n}){let r=z(e=>e.detail?.name??`Site`),i=z(e=>e.detail?.model.collections.find(e=>e.id===`pages`)?.url??null);L({crumbs:[{label:r,to:`/sites/${t}`},{label:`Scripts`}],...n.status===`modified`?{tag:{label:`Edited`,tone:`change`}}:n.status===`added`?{tag:{label:`New`,tone:`insert`}}:{}});let a=te(),o=j(),s=I(),c=z(e=>e.detail?.model),l=ve(e=>e.outside),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(()=>new Set),m=(0,B.useMemo)(()=>Pe(a),[a]),h=(0,B.useMemo)(()=>new Set(m.filter(e=>e.tone===`warning`&&e.id!==`no-consent`).flatMap(e=>e.scripts)),[m]),g=(0,B.useMemo)(()=>{let e=a.scripts.flatMap(e=>[...e.include??[],...e.exclude??[]]).map(e=>e.replace(/\*\*?/g,`example`).replace(/\?/g,`x`));return[...new Set([`/`,i?i.replace(`{slug}`,`about`):`/about/`,...e])].slice(0,6)},[a.scripts,i]),_=e=>{let t=a.scripts.length;o.apply(ye($,t,D(e))),p(new Set([t]))},v=m.some(e=>e.id===`no-consent`);return(0,X.jsxs)(`div`,{className:`app-screen kit-scripts-screen`,children:[(0,X.jsxs)(`div`,{className:`app-screen__inner app-screen__inner--wide`,children:[(0,X.jsx)(x,{eyebrow:`Site`,title:`Scripts`,description:`Analytics, tags and widgets the site loads. Adding or changing one is powerful, so every change waits in Proof like any other until you publish.`,actions:(0,X.jsx)(b,{variant:`primary`,icon:`plus`,onClick:()=>d(!0),children:`Add a script`})}),(0,X.jsx)(w,{subject:`scripts`,context:`About the scripts setup in ${n.path}:`,examples:Ze,placeholder:`Add GA4 with ID G-… and only load it after consent`}),(0,X.jsx)(O,{step:`layout`}),(0,X.jsx)(_e,{fields:n.fields,noun:Ce(c,n.collection)}),(0,X.jsx)(ge,{}),l?(0,X.jsxs)(`p`,{className:`g-margin-note kit-note`,role:`status`,children:[(0,X.jsx)(e,{kind:`transpose`}),(0,X.jsx)(`span`,{children:l.origin===`agent`?`The assistant changed the scripts. What it changed is marked for a moment.`:`The scripts setup changed outside the app. This shows the latest version.`})]},l.at):null,m.filter(e=>e.id!==`no-consent`).map(t=>(0,X.jsxs)(`p`,{className:t.tone===`warning`?`g-margin-note kit-note kit-note--warning`:`g-margin-note kit-note`,role:`status`,children:[(0,X.jsx)(e,{kind:t.tone===`warning`?`bang`:`pilcrow`}),(0,X.jsx)(`span`,{children:t.text})]},t.id)),(0,X.jsxs)(`div`,{className:`kit-scripts-layout`,children:[(0,X.jsxs)(`section`,{className:`kit-scripts-layout__main`,"aria-labelledby":`installed-title`,children:[(0,X.jsx)(`h2`,{id:`installed-title`,className:`kit-tab-head__title`,children:`Installed`}),(0,X.jsx)(Qe,{open:f,setOpen:p,onAdd:()=>d(!0),warned:h})]}),(0,X.jsxs)(`div`,{className:`kit-scripts-layout__side`,children:[(0,X.jsx)(Ne,{config:a,trackingWithoutConsent:v}),(0,X.jsx)(Xe,{config:a,suggestions:g})]})]})]}),(0,X.jsx)(Oe,{open:u,onClose:()=>d(!1),taken:a.scripts.map(e=>e.id),allowBuild:s,onAdd:_})]})}function et({siteId:e,siteName:t}){return L({crumbs:[{label:t,to:`/sites/${e}`},{label:`Scripts`}]}),null}function tt(){let{siteId:e=``}=n(),t=z(e=>e.detail),r=t?.name??`Site`,i=t&&t.id===e?Se(t.model):null,o=E(e,i?.path??null),s;if(!t||t.id!==e||i&&o.loading)s=(0,X.jsx)(`div`,{className:`app-screen`,"aria-busy":`true`,children:(0,X.jsxs)(`div`,{className:`app-screen__inner`,children:[(0,X.jsx)(p,{width:120,height:12}),(0,X.jsx)(p,{width:240,height:28,style:{marginBlock:`var(--space-3) var(--space-6)`}}),(0,X.jsx)(p,{lines:5,height:14})]})});else if(!i)s=(0,X.jsx)(`div`,{className:`app-screen`,children:(0,X.jsxs)(`div`,{className:`app-screen__inner`,children:[(0,X.jsx)(x,{eyebrow:`Site`,title:`Scripts`}),(0,X.jsx)(k,{feature:`scripts`})]})});else if(!o.data)s=(0,X.jsx)(`div`,{className:`app-screen app-screen--center`,children:(0,X.jsx)(a,{title:`Couldn’t open the scripts setup`,error:o.error,onRetry:()=>void o.refetch()})});else return(0,X.jsx)(C,{siteId:e,entry:o.data,marksFor:T,children:(0,X.jsxs)(`div`,{className:`kit-screen`,children:[(0,X.jsx)($e,{siteId:e,entry:o.data}),(0,X.jsx)(A,{siteId:e,entryPath:o.data.path})]})},o.data.path);return(0,X.jsxs)(`div`,{className:`kit-screen`,children:[(0,X.jsx)(et,{siteId:e,siteName:r}),s,(0,X.jsx)(A,{siteId:e})]})}export{tt as ScriptsScreen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,At as t,E as n,Ft as r,I as i,N as a,Nt as o,Q as s,St as c,at as l,bt as u,c as d,ft as f,g as p,ht as m,it as h,kt as g,lt as _,nt as v,ot as y,pt as b,st as x,vt as S,z as C}from"./ui-C6O2tW4c.js";import{n as w,s as T}from"./chrome-Brnq5kGb.js";import{f as E}from"./changes-BtRtvJ12.js";import{n as D,t as O}from"./PreviewControls-Du87hOEG.js";import{
|
|
1
|
+
import{$ as e,At as t,E as n,Ft as r,I as i,N as a,Nt as o,Q as s,St as c,at as l,bt as u,c as d,ft as f,g as p,ht as m,it as h,kt as g,lt as _,nt as v,ot as y,pt as b,st as x,vt as S,z as C}from"./ui-C6O2tW4c.js";import{n as w,s as T}from"./chrome-Brnq5kGb.js";import{f as E}from"./changes-BtRtvJ12.js";import{n as D,t as O}from"./PreviewControls-Du87hOEG.js";import{B as k,R as A,z as j}from"./index-A7aTfJ-x.js";import{t as M}from"./changes-DLBkrfUR.js";import{r as N,t as P}from"./site-DJUEXLHW.js";import{OnlineCard as F}from"./Online-CFMXFfKL.js";var I=r(o(),1),L=u(),R={added:{label:`New`,tone:`insert`},modified:{label:`Edited`,tone:`change`},deleted:{label:`Deleted`,tone:`delete`}};function z({change:e,actions:t,current:n}){let r=R[e.status];return(0,L.jsxs)(`div`,{className:`g-file app-file`,role:`listitem`,"aria-current":n||void 0,children:[(0,L.jsx)(d,{tone:r.tone,children:r.label}),(0,L.jsxs)(`div`,{className:`g-file__main`,children:[(0,L.jsx)(`span`,{className:`g-file__title`,children:e.title??(e.kind===`media`?y(e.path):x(e.path))}),(0,L.jsxs)(`span`,{className:`g-file__path`,children:[l(e.path),(0,L.jsx)(`b`,{children:y(e.path)}),e.media?` · ${_(e.media)}`:null,e.summary?(0,L.jsxs)(`span`,{className:`app-file__summary`,children:[` · `,e.summary]}):null]})]}),e.binary?(0,L.jsx)(`span`,{className:`g-tally`,children:(0,L.jsx)(`span`,{className:`g-tally__chg`,children:`image`})}):(0,L.jsx)(s,{additions:e.additions,deletions:e.deletions}),t?(0,L.jsx)(`div`,{className:`app-file__actions`,children:t}):(0,L.jsx)(`span`,{})]})}function B({siteId:e}){let t=g(),[r,i]=(0,I.useState)(``),a=n=>{n?.preventDefault();let i=r.trim();t(`/sites/${e}/edit${i?`?ask=${encodeURIComponent(i)}`:``}`)};return(0,L.jsxs)(`form`,{className:`app-ask`,onSubmit:a,children:[(0,L.jsx)(`label`,{className:`app-ask__label`,htmlFor:`home-ask`,children:`What would you like to change?`}),(0,L.jsxs)(`div`,{className:`g-composer`,children:[(0,L.jsx)(`textarea`,{id:`home-ask`,rows:2,placeholder:`Ask for a change… “Add a team member called Sam”, “Shorten the home page heading”`,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&a()}}),(0,L.jsx)(`button`,{className:`g-btn g-btn--primary g-btn--icon g-btn--sm`,type:`submit`,"aria-label":`Ask the assistant`,children:(0,L.jsx)(`span`,{className:`g-mark g-mark--send`,"aria-hidden":`true`})}),(0,L.jsxs)(`div`,{className:`g-composer__foot`,children:[(0,L.jsx)(n,{keys:[`enter`]}),` opens the editor with your request · nothing changes until you publish`]})]})]})}function V({title:e,action:t,children:n,id:r}){return(0,L.jsxs)(`section`,{className:`app-section`,"aria-labelledby":r,children:[(0,L.jsxs)(`div`,{className:`app-section__head`,children:[(0,L.jsx)(`h2`,{className:`app-section__title`,id:r,children:e}),t]}),n]})}function H({siteId:e}){let{changes:t,status:n,error:r,refresh:o}=M(),s=g(),l=t?.files??[];return(0,L.jsx)(V,{id:`home-pending`,title:`Waiting to publish`,action:l.length>0?(0,L.jsx)(b,{size:`sm`,variant:`secondary`,icon:`proof`,onClick:()=>s(`/sites/${e}/proof`),children:`Review changes`}):null,children:n===`error`&&!t?(0,L.jsx)(i,{compact:!0,title:`Couldn’t check for changes`,error:r,onRetry:()=>void o()}):t?l.length===0?(0,L.jsx)(`div`,{className:`app-card app-card--quiet`,children:(0,L.jsx)(a,{compact:!0,mark:`reg`,title:`Nothing to publish.`,body:`Everything here already matches the live site. Changes you make wait here until you publish.`})}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`p`,{className:`app-section__lede`,children:[h(l.length,`page or image`,`pages and images`),` changed since the last publish`,E(l)?` — ${E(l)}`:``,`.`]}),(0,L.jsx)(`div`,{className:`app-card`,role:`list`,children:l.slice(0,5).map(t=>(0,L.jsx)(z,{change:t,actions:t.kind===`content`&&t.status!==`deleted`?(0,L.jsx)(c,{className:m(`quiet`,`sm`),to:`/sites/${e}/edit?path=${encodeURIComponent(t.path)}`,children:`Open`}):void 0},t.path))}),l.length>5?(0,L.jsxs)(c,{className:`g-link app-section__more`,to:`/sites/${e}/proof`,children:[`And `,h(l.length-5,`more change`),` in Proof`]}):null]}):(0,L.jsx)(`div`,{className:`app-card`,"aria-busy":`true`,children:[0,1].map(e=>(0,L.jsxs)(`div`,{className:`g-file`,"aria-hidden":`true`,children:[(0,L.jsx)(p,{width:54,height:20,pill:!0}),(0,L.jsx)(p,{width:180,height:12}),(0,L.jsx)(p,{width:40,height:12}),(0,L.jsx)(`span`,{})]},e))})})}function U({siteId:e}){let t=T(k.history(e,4),()=>C(`GET /api/sites/:siteId/history`,{params:{siteId:e},query:{limit:4}})),n=t.data?.items??[];return(0,L.jsx)(V,{id:`home-history`,title:`Recently published`,action:(0,L.jsx)(c,{className:m(`quiet`,`sm`),to:`/sites/${e}/history`,children:`Version history`}),children:t.loading?(0,L.jsx)(`ul`,{className:`app-timeline`,"aria-busy":`true`,children:[0,1,2].map(e=>(0,L.jsxs)(`li`,{className:`app-timeline__item`,children:[(0,L.jsx)(p,{width:220-e*30,height:14}),(0,L.jsx)(p,{width:120,height:11})]},e))}):t.status===`error`&&!t.data?(0,L.jsx)(i,{compact:!0,title:`Couldn’t load recent versions`,error:t.error,onRetry:()=>void t.refetch()}):n.length===0?(0,L.jsx)(`p`,{className:`g-hint`,children:`Nothing published yet. Each publish appears here.`}):(0,L.jsx)(`ul`,{className:`app-timeline`,children:n.map(e=>(0,L.jsxs)(`li`,{className:`app-timeline__item`,children:[(0,L.jsx)(`span`,{className:`app-timeline__message`,children:e.message}),(0,L.jsxs)(`span`,{className:`app-timeline__meta`,children:[e.author,` · `,f(e.date),e.viaGalley?(0,L.jsx)(`span`,{className:`g-sr`,children:` · published from this app`}):null]})]},e.commit))})})}function W({siteId:e}){let t=N(e);return(0,L.jsx)(V,{id:`home-preview`,title:`Preview`,action:(0,L.jsx)(D,{siteId:e}),children:(0,L.jsxs)(`div`,{className:`app-card app-card--pad app-preview-card`,children:[(0,L.jsx)(`p`,{className:`app-preview-card__text`,children:t?.state===`ready`?`Your site is running with your changes, so the editor can show every page as visitors will see it.`:t?.state===`error`?t.detail??`The preview stopped. The site’s own build reported a problem.`:t?.state===`starting`||t?.state===`installing`?t.detail??`Starting the site’s own dev server…`:`The preview runs your site with your changes. It starts when you open the editor, or now.`}),t?.baselineSource?(0,L.jsxs)(`p`,{className:`g-hint`,children:[`Compared against the `,t.baselineSource===`staging`?`staging site`:`live site`,`.`]}):null,(0,L.jsxs)(`div`,{className:`app-preview-card__actions`,children:[(0,L.jsx)(O,{siteId:e}),t?.state===`ready`&&t.url?(0,L.jsxs)(`a`,{className:m(`quiet`,`sm`),href:t.url,target:`_blank`,rel:`noreferrer`,children:[(0,L.jsx)(S,{name:`external`}),`Open in a new tab`]}):null]})]})})}function G(){let{siteId:n=``}=t(),r=P(e=>e.detail);if(w({crumbs:[{label:r?.name??`Site`},{label:`Site home`}]}),!r)return(0,L.jsx)(`div`,{className:`app-screen`,"aria-busy":`true`,children:(0,L.jsxs)(`div`,{className:`app-screen__inner app-screen__inner--wide`,children:[(0,L.jsx)(p,{width:90,height:12}),(0,L.jsx)(p,{width:260,height:30,style:{marginBlock:`var(--space-3) var(--space-8)`}}),(0,L.jsx)(p,{height:96})]})});let{model:i}=r,a=j(i),o=i.framework.version?`${i.framework.name} ${i.framework.version}`:i.framework.name,s=a.filter(e=>e.kind===`entries`).reduce((e,t)=>e+t.count,0);return(0,L.jsx)(`div`,{className:`app-screen`,children:(0,L.jsxs)(`div`,{className:`app-screen__inner app-screen__inner--wide app-home`,children:[(0,L.jsxs)(`header`,{className:`app-home__head`,children:[(0,L.jsxs)(`p`,{className:`g-eyebrow`,children:[o,` site`]}),(0,L.jsx)(`h1`,{className:`app-home__title`,children:r.name}),(0,L.jsxs)(`p`,{className:`app-home__lede`,children:[h(a.length,`collection`),` and `,h(s,`page`),` ready to edit.`,r.git.hasRemote?null:` Its versions are kept on this computer only — not backed up or shared anywhere yet.`]})]}),(0,L.jsx)(B,{siteId:n}),(0,L.jsxs)(`div`,{className:`app-home__grid`,children:[(0,L.jsxs)(`div`,{className:`app-home__main`,children:[(0,L.jsx)(H,{siteId:n}),(0,L.jsxs)(V,{id:`home-found`,title:`What’s on this site`,children:[(0,L.jsx)(`ul`,{className:`app-collections`,children:a.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(c,{className:`app-collection-row`,to:`/sites/${n}/c/${encodeURIComponent(e.id)}`,children:[(0,L.jsx)(S,{name:A(e)}),(0,L.jsx)(`span`,{className:`app-collection-row__label`,children:e.label}),(0,L.jsx)(`span`,{className:`app-collection-row__path g-mono`,children:e.path}),(0,L.jsx)(`span`,{className:`app-collection-row__count`,children:e.kind===`entries`?h(e.count,e.singular,v(e).many):(0,L.jsx)(d,{mark:null,children:`Settings file`})}),(0,L.jsx)(S,{name:`chevron-right`,className:`app-collection-row__go`})]})},e.id))}),i.notes.length>0?(0,L.jsxs)(`details`,{className:`app-details app-notes`,children:[(0,L.jsx)(`summary`,{children:`How this site was read`}),(0,L.jsx)(`ul`,{children:i.notes.map(t=>(0,L.jsxs)(`li`,{className:`g-margin-note`,children:[(0,L.jsx)(e,{kind:`stet`}),(0,L.jsx)(`span`,{children:t})]},t))})]}):null]})]}),(0,L.jsxs)(`div`,{className:`app-home__side`,children:[(0,L.jsx)(V,{id:`home-online`,title:`Online`,children:(0,L.jsx)(F,{siteId:n})}),(0,L.jsx)(V,{id:`home-import`,title:`Moving from WordPress?`,children:(0,L.jsxs)(`div`,{className:`app-card app-card--pad app-preview-card`,children:[(0,L.jsx)(`p`,{className:`app-preview-card__text`,children:`Bring its posts, pages, images and SEO details here, as changes you check before anything goes live.`}),(0,L.jsx)(`div`,{className:`app-preview-card__actions`,children:(0,L.jsx)(c,{className:m(`secondary`,`sm`),to:`/sites/${n}/import`,children:`Bring your WordPress site`})})]})}),(0,L.jsx)(W,{siteId:n}),(0,L.jsx)(U,{siteId:n})]})]})]})})}export{G as SiteHomeScreen};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as e,At as t,Ft as n,H as r,I as i,Nt as a,O as o,St as s,a as c,bt as l,c as u,g as d,gt as f,ht as p,it as m,j as h,n as g,pt as _,ut as v,v as y,z as b}from"./ui-C6O2tW4c.js";import{i as x,r as S}from"./usePlugins-acEOSN5a.js";import{a as C,n as w,o as T,s as E}from"./chrome-Brnq5kGb.js";import{t as D}from"./site-DJUEXLHW.js";import{z as O}from"./index-Djh-DSIT.js";import{OnlineCard as k}from"./Online-bYUu0ETZ.js";import{t as A}from"./hashScroll-CSp59QpH.js";var j=n(a(),1),M=l(),N={anthropic:{title:`Assistant`,what:`The Anthropic API key the assistant uses for this site.`,placeholder:`sk-ant-…`},openai:{title:`Images (OpenAI)`,what:`The OpenAI key image generation uses for this site.`,placeholder:`sk-…`},google:{title:`Images (Google)`,what:`The Google AI key image generation uses for this site.`,placeholder:`AIza…`},cloudflare:{title:`Cloudflare`,what:`The Cloudflare access key used to put this site online.`,placeholder:`Cloudflare API token`},vercel:{title:`Vercel`,what:`The Vercel access key used to put this site online.`,placeholder:`Vercel access token`}},P=e=>[`site`,e,`connections`],F=e=>[`site`,e,`usage`];function I(e){return e.inUse===`site`?`This site’s own key, ending ${e.hint??`…`}`:e.inUse===`env`?`The shared key from the environment, ending ${e.hint??`…`}`:e.inUse===`shared`?`The shared key, ending ${e.hint??`…`}`:`Not set — neither this site nor the app has one`}function L({siteId:e,secret:t,onChange:n}){let[i,a]=(0,j.useState)(!1),[s,c]=(0,j.useState)(``),[l,d]=(0,j.useState)(!1),[f,p]=(0,j.useState)(null),m=N[t.name]??{title:t.name,what:``,placeholder:``},v=async i=>{d(!0),p(null);try{n(await b(`PUT /api/sites/:siteId/secrets/:name`,{params:{siteId:e,name:t.name},body:{value:i}})),a(!1),c(``),g({tone:`success`,title:i?`Saved this site’s own ${m.title.toLowerCase()} key`:`This site uses the shared key again`})}catch(e){p(r(e).message)}finally{d(!1)}};return(0,M.jsxs)(`li`,{className:`sites-conn`,children:[(0,M.jsxs)(`div`,{className:`sites-conn__head`,children:[(0,M.jsx)(`span`,{className:`sites-conn__title`,children:m.title}),(0,M.jsx)(u,{tone:t.inUse===`site`?`accent`:`neutral`,children:t.inUse===`site`?`This site’s own key`:t.inUse?`The shared key`:`Not set`})]}),(0,M.jsx)(`p`,{className:`sites-conn__text`,children:I(t)}),i?(0,M.jsxs)(`form`,{className:`sites-conn__form`,onSubmit:e=>{e.preventDefault(),s.trim()&&v(s.trim())},children:[(0,M.jsx)(h,{label:`This site’s own ${m.title.toLowerCase()} key`,hideLabel:!0,error:f??void 0,hint:m.what,children:(0,M.jsx)(o,{type:`password`,mono:!0,size:`sm`,autoComplete:`off`,spellCheck:!1,value:s,placeholder:m.placeholder,onChange:e=>c(e.target.value),autoFocus:!0})}),(0,M.jsx)(_,{type:`submit`,size:`sm`,variant:`primary`,disabled:!s.trim(),busy:l,busyLabel:`Saving`,children:`Save key`}),(0,M.jsx)(_,{type:`button`,size:`sm`,variant:`quiet`,onClick:()=>(a(!1),c(``),p(null)),children:`Keep as it is`})]}):(0,M.jsxs)(`div`,{className:`sites-conn__actions`,children:[(0,M.jsx)(_,{size:`sm`,variant:`secondary`,onClick:()=>a(!0),children:t.site.configured?`Replace this site’s key…`:`Use a key of this site’s own…`}),t.site.configured?(0,M.jsx)(_,{size:`sm`,variant:`quiet`,busy:l,busyLabel:`Clearing`,onClick:()=>void v(null),children:`Use the shared key`}):null,f?(0,M.jsx)(`span`,{className:`g-error-text`,children:f}):null]})]})}function R({siteId:e,connections:t,onChange:n}){let i=t.author.site,[a,s]=(0,j.useState)(i?.name??``),[c,l]=(0,j.useState)(i?.email??``),[d,f]=(0,j.useState)(!1),[p,m]=(0,j.useState)(!1),[v,y]=(0,j.useState)(null),x=async t=>{m(!0),y(null);try{n(await b(`PUT /api/sites/:siteId/author`,{params:{siteId:e},body:{author:t}})),f(!1),g({tone:`success`,title:t?`Versions of this site will be recorded under that name`:`This site uses the shared author again`})}catch(e){y(r(e).message)}finally{m(!1)}};return(0,M.jsxs)(`li`,{className:`sites-conn`,children:[(0,M.jsxs)(`div`,{className:`sites-conn__head`,children:[(0,M.jsx)(`span`,{className:`sites-conn__title`,children:`Publishing author`}),(0,M.jsx)(u,{tone:t.author.inUse===`site`?`accent`:`neutral`,children:t.author.inUse===`site`?`This site’s own`:`The shared author`})]}),(0,M.jsxs)(`p`,{className:`sites-conn__text`,children:[`Each version published from this site is recorded as `,t.author.name?(0,M.jsx)(`strong`,{children:t.author.name}):`the computer’s own name`,t.author.email?(0,M.jsxs)(`span`,{className:`g-mono`,children:[` <`,t.author.email,`>`]}):null,`.`]}),d?(0,M.jsxs)(`form`,{className:`sites-conn__form sites-conn__form--author`,onSubmit:e=>{e.preventDefault(),x({name:a.trim(),email:c.trim()})},children:[(0,M.jsx)(h,{label:`Name`,children:(0,M.jsx)(o,{size:`sm`,value:a,onChange:e=>s(e.target.value),autoComplete:`name`,autoFocus:!0})}),(0,M.jsx)(h,{label:`Email`,children:(0,M.jsx)(o,{size:`sm`,type:`email`,value:c,onChange:e=>l(e.target.value),autoComplete:`email`})}),(0,M.jsx)(_,{type:`submit`,size:`sm`,variant:`primary`,disabled:!a.trim()||!c.trim(),busy:p,busyLabel:`Saving`,children:`Save author`}),(0,M.jsx)(_,{type:`button`,size:`sm`,variant:`quiet`,onClick:()=>f(!1),children:`Keep as it is`}),v?(0,M.jsx)(`span`,{className:`g-error-text`,children:v}):null]}):(0,M.jsxs)(`div`,{className:`sites-conn__actions`,children:[(0,M.jsx)(_,{size:`sm`,variant:`secondary`,onClick:()=>f(!0),children:i?`Change this site’s author…`:`Use an author of this site’s own…`}),i?(0,M.jsx)(_,{size:`sm`,variant:`quiet`,busy:p,busyLabel:`Clearing`,onClick:()=>void x(null),children:`Use the shared author`}):null]})]})}function z({label:e,totals:t}){return(0,M.jsxs)(`div`,{className:`sites-usage__cell`,children:[(0,M.jsx)(`span`,{className:`g-eyebrow`,children:e}),(0,M.jsx)(`span`,{className:`sites-usage__cost`,children:v(t.cost)}),(0,M.jsxs)(`span`,{className:`g-hint`,children:[m(t.turns,`request`),t.images?` · ${m(t.images,`image`)}`:``]})]})}function B({siteId:e}){let t=E(P(e),()=>b(`GET /api/sites/:siteId/connections`,{params:{siteId:e}})),n=E(F(e),()=>b(`GET /api/sites/:siteId/usage`,{params:{siteId:e}})),r=t=>T(P(e),t),a=[`anthropic`,`openai`,`google`,`cloudflare`,`vercel`];return(0,M.jsxs)(`div`,{className:`app-settings__sections sites-connections`,children:[(0,M.jsxs)(`section`,{className:`app-settings__section`,id:`connections`,children:[(0,M.jsxs)(`header`,{className:`app-settings__section-head`,children:[(0,M.jsx)(`h2`,{className:`app-settings__section-title`,children:`Connections`}),(0,M.jsx)(`p`,{className:`app-settings__section-text`,children:`The keys and the author this site uses. Without its own, a site uses the shared ones from App settings — give a site its own when its client pays for their own use. Keys are kept on this computer only.`})]}),(0,M.jsx)(`div`,{className:`app-settings__section-body`,children:t.loading?(0,M.jsx)(d,{height:220}):t.status===`error`&&!t.data?(0,M.jsx)(i,{compact:!0,title:`Couldn’t load this site’s connections`,error:t.error,onRetry:()=>void t.refetch()}):t.data?(0,M.jsxs)(`ul`,{className:`sites-conns`,children:[[...t.data.secrets].sort((e,t)=>a.indexOf(e.name)-a.indexOf(t.name)).map(t=>(0,M.jsx)(L,{siteId:e,secret:t,onChange:r},t.name)),(0,M.jsx)(R,{siteId:e,connections:t.data,onChange:r},t.data.author.site?.email??`shared`)]}):null})]}),(0,M.jsxs)(`section`,{className:`app-settings__section`,id:`site-usage`,children:[(0,M.jsxs)(`header`,{className:`app-settings__section-head`,children:[(0,M.jsx)(`h2`,{className:`app-settings__section-title`,children:`Assistant use`}),(0,M.jsx)(`p`,{className:`app-settings__section-text`,children:`What the assistant has cost on this site at list prices, whichever key paid for it.`})]}),(0,M.jsx)(`div`,{className:`app-settings__section-body`,children:n.loading?(0,M.jsx)(d,{height:80}):n.data?(0,M.jsxs)(`div`,{className:`sites-usage`,children:[(0,M.jsx)(z,{label:`30 days`,totals:n.data.last30}),(0,M.jsx)(z,{label:`7 days`,totals:n.data.last7}),(0,M.jsx)(z,{label:`All time`,totals:n.data.allTime})]}):(0,M.jsx)(i,{compact:!0,title:`Couldn’t load this site’s use`,error:n.error,onRetry:()=>void n.refetch()})})]})]})}function V({siteId:e}){let t=S(e),n=t.data?.plugins??[],r=n.filter(e=>e.active).length,i=n.filter(e=>e.source===`site`).length,a=n.filter(e=>e.problems.length>0).length;return(0,M.jsxs)(`section`,{className:`app-settings__section`,"aria-labelledby":`site-plugins-title`,children:[(0,M.jsxs)(`header`,{className:`app-settings__section-head`,children:[(0,M.jsx)(`h2`,{className:`app-settings__section-title`,id:`site-plugins-title`,children:`Plugins`}),(0,M.jsx)(`p`,{className:`app-settings__section-text`,children:`What plugins add while this site is open, including any the site itself names.`})]}),(0,M.jsxs)(`div`,{className:`plg-summary`,children:[t.loading?(0,M.jsx)(d,{width:280,height:16}):t.data?(0,M.jsxs)(`p`,{className:`plg-summary__text`,children:[m(r,`plugin`),` active`,i?`, ${i} named by this site`:`, none named by this site`,a?`. ${m(a,`plugin`)} ${a===1?`isn’t`:`aren’t`} working.`:`.`]}):(0,M.jsx)(`p`,{className:`plg-summary__text`,children:`The plugin list can’t be read right now.`}),(0,M.jsx)(s,{className:p(`secondary`,`sm`),to:`/sites/${e}/plugins`,children:`See plugins`})]})]})}function H(e,t,n){let r=structuredClone(e),i=[r],a=r;for(let e of t.slice(0,-1)){let t=a[e];a[e]=t&&typeof t==`object`&&!Array.isArray(t)?t:{},a=a[e],i.push(a)}let o=t[t.length-1];n===void 0||n===``||Array.isArray(n)&&n.length===0?delete a[o]:a[o]=n;for(let e=t.length-2;e>=0;e--){let n=i[e],r=t[e],a=n[r];Object.keys(a).length===0&&delete n[r]}return r}function U({id:e,title:t,description:n,children:r}){return(0,M.jsxs)(`section`,{className:`app-settings__section`,id:e,children:[(0,M.jsxs)(`header`,{className:`app-settings__section-head`,children:[(0,M.jsx)(`h2`,{className:`app-settings__section-title`,children:t}),n?(0,M.jsx)(`p`,{className:`app-settings__section-text`,children:n}):null]}),(0,M.jsx)(`div`,{className:`app-settings__section-body`,children:r})]})}function W({overridden:e,detected:t,onClear:n,hint:r}){return e?(0,M.jsxs)(M.Fragment,{children:[t?(0,M.jsxs)(M.Fragment,{children:[`Detected: `,(0,M.jsx)(`span`,{className:`g-mono`,children:t})]}):`Nothing was detected`,` · `,(0,M.jsx)(`button`,{type:`button`,className:`app-link-button`,onClick:n,children:`Use detected`})]}):r??null}function G({value:e,detected:t,onChange:n}){let r=e??t;return(0,M.jsxs)(`fieldset`,{className:`app-fieldset app-choice-list`,children:[(0,M.jsx)(`legend`,{className:`g-label`,children:`When someone presses Publish`}),[{mode:`commit`,title:`Publish directly`,body:`Pressing Publish makes changes live straight away.`},{mode:`pull-request`,title:`Send for review`,body:`Pressing Publish sends the changes to a developer, who approves them before they go live.`}].map(i=>(0,M.jsxs)(`label`,{className:f(`app-model`,r===i.mode&&`app-model--checked`),children:[(0,M.jsx)(`input`,{type:`radio`,name:`publish-mode`,className:`app-model__radio`,checked:r===i.mode,onChange:()=>n(i.mode===t?void 0:i.mode)}),(0,M.jsxs)(`span`,{className:`app-model__text`,children:[(0,M.jsxs)(`span`,{className:`app-model__name`,children:[i.title,i.mode===t&&e===void 0?(0,M.jsx)(`span`,{className:`g-faint`,children:` · detected`}):null]}),(0,M.jsx)(`span`,{className:`app-model__blurb`,children:i.body})]})]},i.mode))]})}function K({siteId:t,model:n,config:r}){let a=(0,j.useMemo)(()=>r??{},[r]),[s,l]=(0,j.useState)(a),[d,f]=(0,j.useState)(!1),[p,v]=(0,j.useState)(null),[y,S]=(0,j.useState)(a.dev?.port?.toString()??``),[w,E]=(0,j.useState)(null);(0,j.useEffect)(()=>{l(a),S(a.dev?.port?.toString()??``)},[a]);let A=JSON.stringify(s)!==JSON.stringify(a),N=(e,t)=>l(n=>H(n,e,t)),P=async e=>{if(e.preventDefault(),!w){f(!0),v(null);try{let e=await b(`PUT /api/sites/:siteId/config`,{params:{siteId:t},body:{config:s}});T(O.config(t),{config:s,detected:n}),C(O.config(t)),D.getState().refresh(),g({tone:`success`,title:`Settings saved`,body:`The site now has ${m(e.collections.length,`collection`)}. The settings file waits in Proof like any other change.`})}catch(e){v(e)}finally{f(!1)}}},F=s.ai?.instructions;return(0,M.jsxs)(`form`,{className:`app-settings__sections`,onSubmit:P,children:[(0,M.jsxs)(U,{title:`Addresses`,description:`Where the site is published. The staging address powers the side-by-side comparison in the editor and in Proof: your changes beside what’s on staging now.`,children:[(0,M.jsx)(h,{label:`Live site`,fieldKey:`urls.production`,hint:(0,M.jsx)(W,{overridden:s.urls?.production!==void 0,detected:n.urls.production,onClear:()=>N([`urls`,`production`],void 0),hint:`The address visitors use`}),children:(0,M.jsx)(o,{type:`url`,mono:!0,value:s.urls?.production??``,placeholder:n.urls.production??`https://www.example.com`,onChange:e=>N([`urls`,`production`],e.target.value.trim())})}),(0,M.jsx)(h,{label:`Staging site`,fieldKey:`urls.staging`,hint:(0,M.jsx)(W,{overridden:s.urls?.staging!==void 0,detected:n.urls.staging,onClear:()=>N([`urls`,`staging`],void 0),hint:`Optional. Used for comparisons when present; otherwise the live site is used`}),children:(0,M.jsx)(o,{type:`url`,mono:!0,value:s.urls?.staging??``,placeholder:n.urls.staging??`https://staging.example.com`,onChange:e=>N([`urls`,`staging`],e.target.value.trim())})})]}),(0,M.jsx)(U,{title:`Online`,description:`Where the site is put online and whether publishing puts changes live by itself. Saved as it changes.`,children:(0,M.jsx)(k,{siteId:t,variant:`settings`})}),(0,M.jsx)(U,{title:`Publishing`,children:(0,M.jsx)(G,{value:s.publish?.mode,detected:n.publish.mode,onChange:e=>N([`publish`,`mode`],e)})}),(0,M.jsx)(U,{title:`Preview`,description:`How the site’s own dev server is started for the preview.`,children:(0,M.jsxs)(`div`,{className:`app-form-row app-form-row--wide-first`,children:[(0,M.jsx)(h,{label:`Start command`,fieldKey:`dev.command`,hint:(0,M.jsx)(W,{overridden:s.dev?.command!==void 0,detected:n.dev?.command,onClear:()=>N([`dev`,`command`],void 0)}),children:(0,M.jsx)(o,{mono:!0,value:s.dev?.command??``,placeholder:n.dev?.command??`npm run dev`,onChange:e=>N([`dev`,`command`],e.target.value)})}),(0,M.jsx)(h,{label:`Port`,fieldKey:`dev.port`,error:w??void 0,hint:(0,M.jsx)(W,{overridden:s.dev?.port!==void 0,detected:n.dev?.port?.toString(),onClear:()=>{S(``),E(null),N([`dev`,`port`],void 0)}}),children:(0,M.jsx)(o,{mono:!0,inputMode:`numeric`,value:y,placeholder:n.dev?.port?.toString()??`auto`,onChange:e=>{let t=e.target.value.trim();S(e.target.value);let n=Number(t);t&&(!Number.isInteger(n)||n<1||n>65535)?E(`Ports are whole numbers from 1 to 65535.`):(E(null),N([`dev`,`port`],t?n:void 0))}})})]})}),(0,M.jsx)(U,{title:`Media`,children:(0,M.jsxs)(`div`,{className:`app-form-row`,children:[(0,M.jsx)(h,{label:`Folder for new images`,fieldKey:`media.dir`,hint:(0,M.jsx)(W,{overridden:s.media?.dir!==void 0,detected:n.media.dir,onClear:()=>N([`media`,`dir`],void 0)}),children:(0,M.jsx)(o,{mono:!0,value:s.media?.dir??``,placeholder:n.media.dir,onChange:e=>N([`media`,`dir`],e.target.value.trim())})}),(0,M.jsx)(h,{label:`Served from`,fieldKey:`media.publicPath`,hint:(0,M.jsx)(W,{overridden:s.media?.publicPath!==void 0,detected:n.media.publicPath,onClear:()=>N([`media`,`publicPath`],void 0),hint:`The address that folder has on the site`}),children:(0,M.jsx)(o,{mono:!0,value:s.media?.publicPath??``,placeholder:n.media.publicPath,onChange:e=>N([`media`,`publicPath`],e.target.value.trim())})})]})}),(0,M.jsxs)(U,{id:`assistant`,title:`Assistant`,description:`Files the assistant reads before every request, such as a style guide or brand voice. One path per line, from the site’s folder.`,children:[(0,M.jsx)(h,{label:`Instructions files`,fieldKey:`ai.instructions`,hint:(0,M.jsx)(W,{overridden:F!==void 0,detected:n.ai.instructions.join(`, `)||null,onClear:()=>N([`ai`,`instructions`],void 0)}),children:(0,M.jsx)(e,{mono:!0,rows:2,value:(F??[]).join(`
|
|
1
|
+
import{A as e,At as t,Ft as n,H as r,I as i,Nt as a,O as o,St as s,a as c,bt as l,c as u,g as d,gt as f,ht as p,it as m,j as h,n as g,pt as _,ut as v,v as y,z as b}from"./ui-C6O2tW4c.js";import{i as x,r as S}from"./usePlugins-D8UH3hzc.js";import{a as C,n as w,o as T,s as E}from"./chrome-Brnq5kGb.js";import{t as D}from"./site-DJUEXLHW.js";import{B as O}from"./index-A7aTfJ-x.js";import{OnlineCard as k}from"./Online-CFMXFfKL.js";import{t as A}from"./hashScroll-CSp59QpH.js";var j=n(a(),1),M=l(),N={anthropic:{title:`Assistant`,what:`The Anthropic API key the assistant uses for this site.`,placeholder:`sk-ant-…`},openai:{title:`Images (OpenAI)`,what:`The OpenAI key image generation uses for this site.`,placeholder:`sk-…`},google:{title:`Images (Google)`,what:`The Google AI key image generation uses for this site.`,placeholder:`AIza…`},cloudflare:{title:`Cloudflare`,what:`The Cloudflare access key used to put this site online.`,placeholder:`Cloudflare API token`},vercel:{title:`Vercel`,what:`The Vercel access key used to put this site online.`,placeholder:`Vercel access token`}},P=e=>[`site`,e,`connections`],F=e=>[`site`,e,`usage`];function I(e){return e.inUse===`site`?`This site’s own key, ending ${e.hint??`…`}`:e.inUse===`env`?`The shared key from the environment, ending ${e.hint??`…`}`:e.inUse===`shared`?`The shared key, ending ${e.hint??`…`}`:`Not set — neither this site nor the app has one`}function L({siteId:e,secret:t,onChange:n}){let[i,a]=(0,j.useState)(!1),[s,c]=(0,j.useState)(``),[l,d]=(0,j.useState)(!1),[f,p]=(0,j.useState)(null),m=N[t.name]??{title:t.name,what:``,placeholder:``},v=async i=>{d(!0),p(null);try{n(await b(`PUT /api/sites/:siteId/secrets/:name`,{params:{siteId:e,name:t.name},body:{value:i}})),a(!1),c(``),g({tone:`success`,title:i?`Saved this site’s own ${m.title.toLowerCase()} key`:`This site uses the shared key again`})}catch(e){p(r(e).message)}finally{d(!1)}};return(0,M.jsxs)(`li`,{className:`sites-conn`,children:[(0,M.jsxs)(`div`,{className:`sites-conn__head`,children:[(0,M.jsx)(`span`,{className:`sites-conn__title`,children:m.title}),(0,M.jsx)(u,{tone:t.inUse===`site`?`accent`:`neutral`,children:t.inUse===`site`?`This site’s own key`:t.inUse?`The shared key`:`Not set`})]}),(0,M.jsx)(`p`,{className:`sites-conn__text`,children:I(t)}),i?(0,M.jsxs)(`form`,{className:`sites-conn__form`,onSubmit:e=>{e.preventDefault(),s.trim()&&v(s.trim())},children:[(0,M.jsx)(h,{label:`This site’s own ${m.title.toLowerCase()} key`,hideLabel:!0,error:f??void 0,hint:m.what,children:(0,M.jsx)(o,{type:`password`,mono:!0,size:`sm`,autoComplete:`off`,spellCheck:!1,value:s,placeholder:m.placeholder,onChange:e=>c(e.target.value),autoFocus:!0})}),(0,M.jsx)(_,{type:`submit`,size:`sm`,variant:`primary`,disabled:!s.trim(),busy:l,busyLabel:`Saving`,children:`Save key`}),(0,M.jsx)(_,{type:`button`,size:`sm`,variant:`quiet`,onClick:()=>(a(!1),c(``),p(null)),children:`Keep as it is`})]}):(0,M.jsxs)(`div`,{className:`sites-conn__actions`,children:[(0,M.jsx)(_,{size:`sm`,variant:`secondary`,onClick:()=>a(!0),children:t.site.configured?`Replace this site’s key…`:`Use a key of this site’s own…`}),t.site.configured?(0,M.jsx)(_,{size:`sm`,variant:`quiet`,busy:l,busyLabel:`Clearing`,onClick:()=>void v(null),children:`Use the shared key`}):null,f?(0,M.jsx)(`span`,{className:`g-error-text`,children:f}):null]})]})}function R({siteId:e,connections:t,onChange:n}){let i=t.author.site,[a,s]=(0,j.useState)(i?.name??``),[c,l]=(0,j.useState)(i?.email??``),[d,f]=(0,j.useState)(!1),[p,m]=(0,j.useState)(!1),[v,y]=(0,j.useState)(null),x=async t=>{m(!0),y(null);try{n(await b(`PUT /api/sites/:siteId/author`,{params:{siteId:e},body:{author:t}})),f(!1),g({tone:`success`,title:t?`Versions of this site will be recorded under that name`:`This site uses the shared author again`})}catch(e){y(r(e).message)}finally{m(!1)}};return(0,M.jsxs)(`li`,{className:`sites-conn`,children:[(0,M.jsxs)(`div`,{className:`sites-conn__head`,children:[(0,M.jsx)(`span`,{className:`sites-conn__title`,children:`Publishing author`}),(0,M.jsx)(u,{tone:t.author.inUse===`site`?`accent`:`neutral`,children:t.author.inUse===`site`?`This site’s own`:`The shared author`})]}),(0,M.jsxs)(`p`,{className:`sites-conn__text`,children:[`Each version published from this site is recorded as `,t.author.name?(0,M.jsx)(`strong`,{children:t.author.name}):`the computer’s own name`,t.author.email?(0,M.jsxs)(`span`,{className:`g-mono`,children:[` <`,t.author.email,`>`]}):null,`.`]}),d?(0,M.jsxs)(`form`,{className:`sites-conn__form sites-conn__form--author`,onSubmit:e=>{e.preventDefault(),x({name:a.trim(),email:c.trim()})},children:[(0,M.jsx)(h,{label:`Name`,children:(0,M.jsx)(o,{size:`sm`,value:a,onChange:e=>s(e.target.value),autoComplete:`name`,autoFocus:!0})}),(0,M.jsx)(h,{label:`Email`,children:(0,M.jsx)(o,{size:`sm`,type:`email`,value:c,onChange:e=>l(e.target.value),autoComplete:`email`})}),(0,M.jsx)(_,{type:`submit`,size:`sm`,variant:`primary`,disabled:!a.trim()||!c.trim(),busy:p,busyLabel:`Saving`,children:`Save author`}),(0,M.jsx)(_,{type:`button`,size:`sm`,variant:`quiet`,onClick:()=>f(!1),children:`Keep as it is`}),v?(0,M.jsx)(`span`,{className:`g-error-text`,children:v}):null]}):(0,M.jsxs)(`div`,{className:`sites-conn__actions`,children:[(0,M.jsx)(_,{size:`sm`,variant:`secondary`,onClick:()=>f(!0),children:i?`Change this site’s author…`:`Use an author of this site’s own…`}),i?(0,M.jsx)(_,{size:`sm`,variant:`quiet`,busy:p,busyLabel:`Clearing`,onClick:()=>void x(null),children:`Use the shared author`}):null]})]})}function z({label:e,totals:t}){return(0,M.jsxs)(`div`,{className:`sites-usage__cell`,children:[(0,M.jsx)(`span`,{className:`g-eyebrow`,children:e}),(0,M.jsx)(`span`,{className:`sites-usage__cost`,children:v(t.cost)}),(0,M.jsxs)(`span`,{className:`g-hint`,children:[m(t.turns,`request`),t.images?` · ${m(t.images,`image`)}`:``]})]})}function B({siteId:e}){let t=E(P(e),()=>b(`GET /api/sites/:siteId/connections`,{params:{siteId:e}})),n=E(F(e),()=>b(`GET /api/sites/:siteId/usage`,{params:{siteId:e}})),r=t=>T(P(e),t),a=[`anthropic`,`openai`,`google`,`cloudflare`,`vercel`];return(0,M.jsxs)(`div`,{className:`app-settings__sections sites-connections`,children:[(0,M.jsxs)(`section`,{className:`app-settings__section`,id:`connections`,children:[(0,M.jsxs)(`header`,{className:`app-settings__section-head`,children:[(0,M.jsx)(`h2`,{className:`app-settings__section-title`,children:`Connections`}),(0,M.jsx)(`p`,{className:`app-settings__section-text`,children:`The keys and the author this site uses. Without its own, a site uses the shared ones from App settings — give a site its own when its client pays for their own use. Keys are kept on this computer only.`})]}),(0,M.jsx)(`div`,{className:`app-settings__section-body`,children:t.loading?(0,M.jsx)(d,{height:220}):t.status===`error`&&!t.data?(0,M.jsx)(i,{compact:!0,title:`Couldn’t load this site’s connections`,error:t.error,onRetry:()=>void t.refetch()}):t.data?(0,M.jsxs)(`ul`,{className:`sites-conns`,children:[[...t.data.secrets].sort((e,t)=>a.indexOf(e.name)-a.indexOf(t.name)).map(t=>(0,M.jsx)(L,{siteId:e,secret:t,onChange:r},t.name)),(0,M.jsx)(R,{siteId:e,connections:t.data,onChange:r},t.data.author.site?.email??`shared`)]}):null})]}),(0,M.jsxs)(`section`,{className:`app-settings__section`,id:`site-usage`,children:[(0,M.jsxs)(`header`,{className:`app-settings__section-head`,children:[(0,M.jsx)(`h2`,{className:`app-settings__section-title`,children:`Assistant use`}),(0,M.jsx)(`p`,{className:`app-settings__section-text`,children:`What the assistant has cost on this site at list prices, whichever key paid for it.`})]}),(0,M.jsx)(`div`,{className:`app-settings__section-body`,children:n.loading?(0,M.jsx)(d,{height:80}):n.data?(0,M.jsxs)(`div`,{className:`sites-usage`,children:[(0,M.jsx)(z,{label:`30 days`,totals:n.data.last30}),(0,M.jsx)(z,{label:`7 days`,totals:n.data.last7}),(0,M.jsx)(z,{label:`All time`,totals:n.data.allTime})]}):(0,M.jsx)(i,{compact:!0,title:`Couldn’t load this site’s use`,error:n.error,onRetry:()=>void n.refetch()})})]})]})}function V({siteId:e}){let t=S(e),n=t.data?.plugins??[],r=n.filter(e=>e.active).length,i=n.filter(e=>e.source===`site`).length,a=n.filter(e=>e.problems.length>0).length;return(0,M.jsxs)(`section`,{className:`app-settings__section`,"aria-labelledby":`site-plugins-title`,children:[(0,M.jsxs)(`header`,{className:`app-settings__section-head`,children:[(0,M.jsx)(`h2`,{className:`app-settings__section-title`,id:`site-plugins-title`,children:`Plugins`}),(0,M.jsx)(`p`,{className:`app-settings__section-text`,children:`What plugins add while this site is open, including any the site itself names.`})]}),(0,M.jsxs)(`div`,{className:`plg-summary`,children:[t.loading?(0,M.jsx)(d,{width:280,height:16}):t.data?(0,M.jsxs)(`p`,{className:`plg-summary__text`,children:[m(r,`plugin`),` active`,i?`, ${i} named by this site`:`, none named by this site`,a?`. ${m(a,`plugin`)} ${a===1?`isn’t`:`aren’t`} working.`:`.`]}):(0,M.jsx)(`p`,{className:`plg-summary__text`,children:`The plugin list can’t be read right now.`}),(0,M.jsx)(s,{className:p(`secondary`,`sm`),to:`/sites/${e}/plugins`,children:`See plugins`})]})]})}function H(e,t,n){let r=structuredClone(e),i=[r],a=r;for(let e of t.slice(0,-1)){let t=a[e];a[e]=t&&typeof t==`object`&&!Array.isArray(t)?t:{},a=a[e],i.push(a)}let o=t[t.length-1];n===void 0||n===``||Array.isArray(n)&&n.length===0?delete a[o]:a[o]=n;for(let e=t.length-2;e>=0;e--){let n=i[e],r=t[e],a=n[r];Object.keys(a).length===0&&delete n[r]}return r}function U({id:e,title:t,description:n,children:r}){return(0,M.jsxs)(`section`,{className:`app-settings__section`,id:e,children:[(0,M.jsxs)(`header`,{className:`app-settings__section-head`,children:[(0,M.jsx)(`h2`,{className:`app-settings__section-title`,children:t}),n?(0,M.jsx)(`p`,{className:`app-settings__section-text`,children:n}):null]}),(0,M.jsx)(`div`,{className:`app-settings__section-body`,children:r})]})}function W({overridden:e,detected:t,onClear:n,hint:r}){return e?(0,M.jsxs)(M.Fragment,{children:[t?(0,M.jsxs)(M.Fragment,{children:[`Detected: `,(0,M.jsx)(`span`,{className:`g-mono`,children:t})]}):`Nothing was detected`,` · `,(0,M.jsx)(`button`,{type:`button`,className:`app-link-button`,onClick:n,children:`Use detected`})]}):r??null}function G({value:e,detected:t,onChange:n}){let r=e??t;return(0,M.jsxs)(`fieldset`,{className:`app-fieldset app-choice-list`,children:[(0,M.jsx)(`legend`,{className:`g-label`,children:`When someone presses Publish`}),[{mode:`commit`,title:`Publish directly`,body:`Pressing Publish makes changes live straight away.`},{mode:`pull-request`,title:`Send for review`,body:`Pressing Publish sends the changes to a developer, who approves them before they go live.`}].map(i=>(0,M.jsxs)(`label`,{className:f(`app-model`,r===i.mode&&`app-model--checked`),children:[(0,M.jsx)(`input`,{type:`radio`,name:`publish-mode`,className:`app-model__radio`,checked:r===i.mode,onChange:()=>n(i.mode===t?void 0:i.mode)}),(0,M.jsxs)(`span`,{className:`app-model__text`,children:[(0,M.jsxs)(`span`,{className:`app-model__name`,children:[i.title,i.mode===t&&e===void 0?(0,M.jsx)(`span`,{className:`g-faint`,children:` · detected`}):null]}),(0,M.jsx)(`span`,{className:`app-model__blurb`,children:i.body})]})]},i.mode))]})}function K({siteId:t,model:n,config:r}){let a=(0,j.useMemo)(()=>r??{},[r]),[s,l]=(0,j.useState)(a),[d,f]=(0,j.useState)(!1),[p,v]=(0,j.useState)(null),[y,S]=(0,j.useState)(a.dev?.port?.toString()??``),[w,E]=(0,j.useState)(null);(0,j.useEffect)(()=>{l(a),S(a.dev?.port?.toString()??``)},[a]);let A=JSON.stringify(s)!==JSON.stringify(a),N=(e,t)=>l(n=>H(n,e,t)),P=async e=>{if(e.preventDefault(),!w){f(!0),v(null);try{let e=await b(`PUT /api/sites/:siteId/config`,{params:{siteId:t},body:{config:s}});T(O.config(t),{config:s,detected:n}),C(O.config(t)),D.getState().refresh(),g({tone:`success`,title:`Settings saved`,body:`The site now has ${m(e.collections.length,`collection`)}. The settings file waits in Proof like any other change.`})}catch(e){v(e)}finally{f(!1)}}},F=s.ai?.instructions;return(0,M.jsxs)(`form`,{className:`app-settings__sections`,onSubmit:P,children:[(0,M.jsxs)(U,{title:`Addresses`,description:`Where the site is published. The staging address powers the side-by-side comparison in the editor and in Proof: your changes beside what’s on staging now.`,children:[(0,M.jsx)(h,{label:`Live site`,fieldKey:`urls.production`,hint:(0,M.jsx)(W,{overridden:s.urls?.production!==void 0,detected:n.urls.production,onClear:()=>N([`urls`,`production`],void 0),hint:`The address visitors use`}),children:(0,M.jsx)(o,{type:`url`,mono:!0,value:s.urls?.production??``,placeholder:n.urls.production??`https://www.example.com`,onChange:e=>N([`urls`,`production`],e.target.value.trim())})}),(0,M.jsx)(h,{label:`Staging site`,fieldKey:`urls.staging`,hint:(0,M.jsx)(W,{overridden:s.urls?.staging!==void 0,detected:n.urls.staging,onClear:()=>N([`urls`,`staging`],void 0),hint:`Optional. Used for comparisons when present; otherwise the live site is used`}),children:(0,M.jsx)(o,{type:`url`,mono:!0,value:s.urls?.staging??``,placeholder:n.urls.staging??`https://staging.example.com`,onChange:e=>N([`urls`,`staging`],e.target.value.trim())})})]}),(0,M.jsx)(U,{title:`Online`,description:`Where the site is put online and whether publishing puts changes live by itself. Saved as it changes.`,children:(0,M.jsx)(k,{siteId:t,variant:`settings`})}),(0,M.jsx)(U,{title:`Publishing`,children:(0,M.jsx)(G,{value:s.publish?.mode,detected:n.publish.mode,onChange:e=>N([`publish`,`mode`],e)})}),(0,M.jsx)(U,{title:`Preview`,description:`How the site’s own dev server is started for the preview.`,children:(0,M.jsxs)(`div`,{className:`app-form-row app-form-row--wide-first`,children:[(0,M.jsx)(h,{label:`Start command`,fieldKey:`dev.command`,hint:(0,M.jsx)(W,{overridden:s.dev?.command!==void 0,detected:n.dev?.command,onClear:()=>N([`dev`,`command`],void 0)}),children:(0,M.jsx)(o,{mono:!0,value:s.dev?.command??``,placeholder:n.dev?.command??`npm run dev`,onChange:e=>N([`dev`,`command`],e.target.value)})}),(0,M.jsx)(h,{label:`Port`,fieldKey:`dev.port`,error:w??void 0,hint:(0,M.jsx)(W,{overridden:s.dev?.port!==void 0,detected:n.dev?.port?.toString(),onClear:()=>{S(``),E(null),N([`dev`,`port`],void 0)}}),children:(0,M.jsx)(o,{mono:!0,inputMode:`numeric`,value:y,placeholder:n.dev?.port?.toString()??`auto`,onChange:e=>{let t=e.target.value.trim();S(e.target.value);let n=Number(t);t&&(!Number.isInteger(n)||n<1||n>65535)?E(`Ports are whole numbers from 1 to 65535.`):(E(null),N([`dev`,`port`],t?n:void 0))}})})]})}),(0,M.jsx)(U,{title:`Media`,children:(0,M.jsxs)(`div`,{className:`app-form-row`,children:[(0,M.jsx)(h,{label:`Folder for new images`,fieldKey:`media.dir`,hint:(0,M.jsx)(W,{overridden:s.media?.dir!==void 0,detected:n.media.dir,onClear:()=>N([`media`,`dir`],void 0)}),children:(0,M.jsx)(o,{mono:!0,value:s.media?.dir??``,placeholder:n.media.dir,onChange:e=>N([`media`,`dir`],e.target.value.trim())})}),(0,M.jsx)(h,{label:`Served from`,fieldKey:`media.publicPath`,hint:(0,M.jsx)(W,{overridden:s.media?.publicPath!==void 0,detected:n.media.publicPath,onClear:()=>N([`media`,`publicPath`],void 0),hint:`The address that folder has on the site`}),children:(0,M.jsx)(o,{mono:!0,value:s.media?.publicPath??``,placeholder:n.media.publicPath,onChange:e=>N([`media`,`publicPath`],e.target.value.trim())})})]})}),(0,M.jsxs)(U,{id:`assistant`,title:`Assistant`,description:`Files the assistant reads before every request, such as a style guide or brand voice. One path per line, from the site’s folder.`,children:[(0,M.jsx)(h,{label:`Instructions files`,fieldKey:`ai.instructions`,hint:(0,M.jsx)(W,{overridden:F!==void 0,detected:n.ai.instructions.join(`, `)||null,onClear:()=>N([`ai`,`instructions`],void 0)}),children:(0,M.jsx)(e,{mono:!0,rows:2,value:(F??[]).join(`
|
|
2
2
|
`),placeholder:n.ai.instructions.join(`
|
|
3
3
|
`)||`CONTENT-GUIDE.md`,onChange:e=>N([`ai`,`instructions`],e.target.value.split(`
|
|
4
4
|
`).map(e=>e.trim()).filter(Boolean))})}),(0,M.jsx)(c,{checked:s.ai?.allowBuild??n.ai.allowBuild,onChange:e=>N([`ai`,`allowBuild`],e===n.ai.allowBuild&&s.ai?.allowBuild===void 0?void 0:e),label:`Allow build mode`,description:`Lets the assistant change the site’s design and code — layouts, components, styles — not just pages and images. Leave off for editors.`})]}),(0,M.jsx)(U,{title:`Settings file`,description:`What’s saved: only what differs from what was detected. It lives at the root of the site and is published with it.`,children:(0,M.jsxs)(`div`,{className:`app-config-file`,children:[(0,M.jsxs)(`div`,{className:`app-config-file__head`,children:[(0,M.jsx)(`span`,{className:`g-mono`,children:x.configFile}),A?(0,M.jsx)(u,{tone:`change`,children:`Not saved`}):r?(0,M.jsx)(u,{tone:`success`,children:`Saved`}):(0,M.jsx)(u,{mark:null,children:`Not created yet`})]}),(0,M.jsx)(`pre`,{className:`app-config-file__body`,"aria-label":`Settings file contents`,children:Object.keys(s).length>0?JSON.stringify(s,null,2):`{} — everything comes from what was detected`})]})}),p?(0,M.jsx)(i,{compact:!0,title:`Couldn’t save the settings`,error:p}):null,(0,M.jsxs)(`div`,{className:`app-savebar`,children:[(0,M.jsx)(`span`,{className:`g-hint`,children:A?`You have unsaved settings.`:`Everything is saved.`}),(0,M.jsx)(_,{variant:`quiet`,disabled:!A||d,onClick:()=>{l(a),S(a.dev?.port?.toString()??``),E(null)},children:`Reset`}),(0,M.jsx)(_,{type:`submit`,variant:`primary`,disabled:!A||!!w,busy:d,busyLabel:`Saving`,children:`Save settings`})]})]})}function q(){let{siteId:e=``}=t();w({crumbs:[{label:`Settings`}]});let n=D(e=>e.detail),a=E(O.config(e),()=>b(`GET /api/sites/:siteId/config`,{params:{siteId:e}}));A(!!a.data);let[o,s]=(0,j.useState)(!1),c=async()=>{s(!0);try{let t=await b(`POST /api/sites/:siteId/refresh`,{params:{siteId:e}});await D.getState().refresh(),C(O.site(e)),g({tone:`success`,title:`Site read again`,body:`Found ${m(t.collections.length,`collection`)} with ${m(t.collections.reduce((e,t)=>e+(t.kind===`entries`?t.count:0),0),`page`)}.`})}catch(e){g({tone:`danger`,title:`Couldn’t read the site again`,body:r(e).message,detail:r(e).detail})}finally{s(!1)}};return(0,M.jsx)(`div`,{className:`app-screen`,children:(0,M.jsxs)(`div`,{className:`app-screen__inner`,children:[(0,M.jsx)(y,{title:`Site settings`,description:`Everything here was worked out from the site itself. Change only what needs correcting; empty fields keep the detected value shown in grey.`,actions:(0,M.jsx)(_,{variant:`secondary`,icon:`refresh`,busy:o,busyLabel:`Reading the site`,onClick:()=>void c(),children:`Detect again`})}),!n||a.loading?(0,M.jsx)(`div`,{"aria-busy":`true`,children:[0,1,2].map(e=>(0,M.jsx)(d,{height:120,style:{marginBlockEnd:`var(--space-6)`}},e))}):a.status===`error`&&!a.data?(0,M.jsx)(i,{title:`Couldn’t read the site’s settings file`,error:a.error,onRetry:()=>void a.refetch()}):(0,M.jsx)(K,{siteId:e,model:a.data?.detected??n.model,config:a.data?.config??null}),n?(0,M.jsx)(B,{siteId:e}):null,n?(0,M.jsx)(V,{siteId:e}):null]})})}export{q as SiteSettingsScreen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,Ft as t,H as n,I as r,Nt as i,bt as a}from"./ui-C6O2tW4c.js";import{a as o}from"./EditorScreen-
|
|
1
|
+
import{$ as e,Ft as t,H as n,I as r,Nt as i,bt as a}from"./ui-C6O2tW4c.js";import{a as o}from"./EditorScreen-CzwKUTDg.js";import{v as s}from"./outside-1xNdvt-F.js";var c=t(i(),1),l=a(),u=800;function d(e){return e===`json`?`json`:e===`yaml`||e===`toml`?`yaml`:`frontmatter`}function f({raw:t,format:i}){let{store:a}=s(),[f,p]=(0,c.useState)(t),[m,h]=(0,c.useState)({kind:`idle`}),g=(0,c.useRef)(null),_=(0,c.useRef)(f);_.current=f;let v=async e=>{h({kind:`saving`});try{let t=(await a.actions.saveRaw(e)).refused[0];h(t?{kind:`unreadable`,detail:t.reason}:{kind:`saved`})}catch(e){h({kind:`failed`,error:e})}};return(0,c.useEffect)(()=>()=>{g.current&&(clearTimeout(g.current),a.actions.saveRaw(_.current))},[a]),(0,l.jsxs)(`div`,{className:`app-source`,children:[(0,l.jsxs)(`p`,{className:`g-margin-note app-source__note`,children:[(0,l.jsx)(e,{kind:`stet`}),(0,l.jsx)(`span`,{children:`The whole file, as text. Changes save as you type; the form picks them up when you go back.`})]}),m.kind===`unreadable`?(0,l.jsx)(r,{compact:!0,title:`This can’t be read yet, so the last change isn’t saved`,message:`Check the line it points to — often a missing quote, colon or indent. The form keeps the last version that could be read.`,detail:m.detail}):null,m.kind===`failed`?(0,l.jsx)(r,{compact:!0,title:`Couldn’t save the file`,error:m.error,message:`${n(m.error).message} What you typed is still here.`,onRetry:()=>void v(_.current)}):null,(0,l.jsx)(o,{value:f,language:d(i),label:`File source`,className:`app-source__editor`,onChange:e=>{p(e),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{g.current=null,v(e)},u)}}),(0,l.jsx)(`p`,{className:`app-source__status g-hint`,role:`status`,children:m.kind===`saving`?`Saving…`:m.kind===`saved`?`Saved`:``})]})}export{f as SourceView};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{At as e,Ft as t,I as n,N as r,Nt as i,St as a,_ as o,bt as s,c,g as l,k as u,n as d,pt as f,v as p,vt as m,z as h}from"./ui-C6O2tW4c.js";import{c as g,d as _,i as v,l as y,n as b,o as x,r as S,s as C,t as w,u as T}from"./useVisibility-DFye68F4.js";import{n as E,o as D,s as O}from"./chrome-Brnq5kGb.js";import{n as k,r as A,t as j}from"./site-DJUEXLHW.js";import{F as M}from"./index-A7aTfJ-x.js";var N=t(i(),1),P={titles:`Titles & descriptions`,content:`Headings & content`,images:`Images`,links:`Links`,indexing:`Indexing`,structured:`Structured data`,ai:`AI visibility`},F=[`titles`,`content`,`images`,`links`,`indexing`,`structured`,`ai`],I=s(),L={search:`Answers with links`,training:`Model training`,user:`Fetches for a person`,dataset:`Open archive`},R=[{value:`allow`,label:`Allow`},{value:`block`,label:`Block`}];function z({crawler:e,value:t,editable:n,onChange:r}){return(0,I.jsxs)(`li`,{className:`seo-crawler`,children:[(0,I.jsxs)(`div`,{className:`seo-crawler__control`,children:[(0,I.jsxs)(`span`,{className:`seo-crawler__name`,children:[e.label,(0,I.jsx)(`span`,{className:`seo-crawler__purpose`,children:L[e.purpose]})]}),n?(0,I.jsx)(o,{label:`${e.label}`,options:R,value:t,onChange:r}):(0,I.jsx)(`span`,{className:`seo-crawler__state`,"data-allowed":t===`allow`,children:t===`allow`?`Allowed`:`Blocked`})]}),(0,I.jsxs)(`details`,{className:`seo-crawler__more`,children:[(0,I.jsxs)(`summary`,{children:[`What it does · `,(0,I.jsx)(`span`,{className:`g-mono`,children:e.token})]}),(0,I.jsx)(`p`,{className:`seo-crawler__what`,children:e.what}),(0,I.jsxs)(`p`,{className:`seo-crawler__if`,children:[`If blocked: `,e.ifBlocked,` `,(0,I.jsxs)(`a`,{href:e.source.url,target:`_blank`,rel:`noreferrer`,className:`g-link`,children:[e.vendor,`’s page`,(0,I.jsx)(m,{name:`external`,size:12})]})]}),e.caveat?(0,I.jsx)(`p`,{className:`seo-crawler__caveat`,children:e.caveat}):null]})]})}function B({siteId:e,report:t,onSaved:n}){let r=(0,N.useMemo)(()=>Object.fromEntries(t.crawlers.map(e=>[e.token,e.allowed?`allow`:`block`])),[t]),[i,a]=(0,N.useState)(r),[o,s]=(0,N.useState)(!1),c=Object.keys(i).filter(e=>i[e]!==r[e]),l=[...new Set(t.crawlers.map(e=>e.vendor))];(0,N.useEffect)(()=>a(r),[r]);let u=async()=>{s(!0);try{n(await h(`PUT /api/sites/:siteId/visibility/crawlers`,{params:{siteId:e},body:{choices:Object.fromEntries(c.map(e=>[e,i[e]]))}})),d({tone:`success`,title:`Crawler rules changed`,body:t.where.kind===`kit`?`The change to the crawler choices is waiting in Proof. The site writes them into robots.txt once you publish.`:`The new robots.txt is waiting in Proof. Crawlers see it once you publish.`})}catch(e){d({tone:`danger`,title:`Couldn’t change the crawler rules`,body:e instanceof Error?e.message:String(e)})}finally{s(!1)}};return(0,I.jsxs)(`section`,{className:`app-card seo-panel`,"aria-labelledby":`seo-crawlers-title`,children:[(0,I.jsxs)(`header`,{className:`seo-panel__head`,children:[(0,I.jsx)(`h2`,{id:`seo-crawlers-title`,className:`seo-panel__title`,children:`AI crawlers`}),(0,I.jsx)(`p`,{className:`seo-panel__lede`,children:`Search crawlers decide whether AI assistants can find and link to this site; training crawlers decide whether its pages may train models. Blocking one isn’t blocking the other. Following these rules is up to each crawler: reputable ones say they do.`})]}),t.where.kind===`kit`?(0,I.jsxs)(`p`,{className:`seo-panel__note`,children:[t.policy,` These choices are kept in `,(0,I.jsx)(`span`,{className:`g-mono`,children:t.where.path}),`; the site writes robots.txt from them each time it is built.`]}):null,(0,I.jsx)(`ul`,{className:`seo-panel__summary`,children:t.summary.map(e=>(0,I.jsx)(`li`,{children:e},e))}),t.readable?l.map(e=>(0,I.jsxs)(`div`,{className:`seo-crawlers`,children:[(0,I.jsx)(`h3`,{className:`seo-crawlers__vendor`,children:e}),(0,I.jsx)(`ul`,{className:`seo-crawlers__list`,children:t.crawlers.filter(t=>t.vendor===e).map(e=>(0,I.jsx)(z,{crawler:e,value:i[e.token]??`allow`,editable:t.editable,onChange:t=>a({...i,[e.token]:t})},e.token))})]},e)):null,t.editNote?(0,I.jsx)(`p`,{className:`seo-panel__note`,children:t.editNote}):null,t.editable&&c.length?(0,I.jsxs)(`div`,{className:`seo-panel__foot`,children:[(0,I.jsx)(f,{variant:`secondary`,size:`sm`,onClick:()=>a(r),children:`Keep as it is`}),(0,I.jsxs)(f,{variant:`primary`,size:`sm`,busy:o,busyLabel:`Saving…`,onClick:()=>void u(),children:[`Change `,c.length===1?`1 rule`:`${c.length} rules`]})]}):null]})}function V(e){return e===`/`?`/index.md`:`${e.replace(/\/$/,``)}.md`}function H({siteId:e,report:t}){let n=j(e=>e.detail?.model.collections),r=(0,N.useMemo)(()=>(n??[]).filter(e=>e.kind===`entries`&&e.url),[n]),i=O([`site`,e,`visibility`,`pages`,r.map(e=>e.id).join(`,`)],async()=>(await Promise.all(r.slice(0,4).map(t=>h(`GET /api/sites/:siteId/entries`,{params:{siteId:e},query:{collection:t.id,limit:40,sort:`title`}})))).flatMap(e=>e.items).filter(e=>e.url),{enabled:r.length>0}),a=(0,N.useMemo)(()=>(i.data??[]).map(e=>({value:e.url,label:`${e.title} · ${e.url}`})),[i.data]),[o,s]=(0,N.useState)(`/`),c=A(e)?.url??null,p=t.kit?[t.kit.markdownTwins?`a markdown version of every page`:null,t.kit.llmsTxt?`llms.txt`:null,t.kit.llmsFullTxt?`llms-full.txt (the whole site in one file)`:null,t.kit.agentPage?`agent.md (a short guide for agents)`:null].filter(e=>e!==null):[],[g,_]=(0,N.useState)(null),[v,y]=(0,N.useState)(!1),b=async()=>{y(!0);try{_(await h(`GET /api/sites/:siteId/visibility/agent-view`,{params:{siteId:e},query:{url:o}}))}catch(e){d({tone:`danger`,title:`Couldn’t read that page`,body:e instanceof Error?e.message:String(e)})}finally{y(!1)}};return(0,I.jsxs)(`section`,{className:`app-card seo-panel`,"aria-labelledby":`seo-agent-title`,children:[(0,I.jsxs)(`header`,{className:`seo-panel__head`,children:[(0,I.jsx)(`h2`,{id:`seo-agent-title`,className:`seo-panel__title`,children:`What an AI agent reads`}),(0,I.jsx)(`p`,{className:`seo-panel__lede`,children:t.kit?t.summary.split(`${t.kit.file}. `)[1]??t.summary:t.summary})]}),t.kit?(0,I.jsxs)(`p`,{className:`seo-panel__note`,children:[p.length?`This site publishes ${p.join(`, `)}, set in `:`This site is set to publish no agent-readable version, in `,(0,I.jsx)(`span`,{className:`g-mono`,children:t.kit.file}),`.`,` `,c?(0,I.jsxs)(I.Fragment,{children:[`In the preview:`,` `,(0,I.jsxs)(`a`,{className:`g-link`,href:`${c}/llms.txt`,target:`_blank`,rel:`noreferrer`,children:[`llms.txt`,(0,I.jsx)(m,{name:`external`,size:12})]}),` `,`·`,` `,(0,I.jsxs)(`a`,{className:`g-link`,href:`${c}${V(o)}`,target:`_blank`,rel:`noreferrer`,children:[`this page’s markdown version`,(0,I.jsx)(m,{name:`external`,size:12})]})]}):`Start the preview to open them.`]}):null,(0,I.jsxs)(`p`,{className:`seo-panel__small`,children:[t.kit?``:`An agent-readable version is an llms.txt file and a plain-text copy of each page. `,`Google says its search doesn’t use them, and so far there is little evidence that other AI systems read them. Offering one is a choice, not a requirement.`,` `,(0,I.jsxs)(`a`,{className:`g-link`,href:`https://llmstxt.org/`,target:`_blank`,rel:`noreferrer`,children:[`The proposal`,(0,I.jsx)(m,{name:`external`,size:12})]})]}),(0,I.jsxs)(`div`,{className:`seo-agent__pick`,children:[a.length?(0,I.jsx)(u,{value:o,onChange:s,options:[{value:`/`,label:`Home page · /`},...a.filter(e=>e.value!==`/`)]}):(0,I.jsx)(l,{height:32}),(0,I.jsx)(f,{variant:`secondary`,size:`sm`,icon:`eye`,busy:v,busyLabel:`Reading…`,onClick:()=>void b(),children:`Show`})]}),g?(0,I.jsxs)(`div`,{className:`seo-agent__view`,children:[(0,I.jsx)(`p`,{className:`seo-panel__small`,children:g.kind===`markdown`?`The page’s own markdown version: ${g.from}.`:g.kind===`text`?`No markdown version, so this is the page’s text as sent, before any script runs — ${g.from}.`:`Read from ${g.from}.`}),(0,I.jsxs)(`pre`,{className:`seo-agent__text`,tabIndex:0,"aria-label":`What an agent receives`,children:[g.text||`(nothing)`,g.truncated?`
|
|
2
|
+
…`:``]})]}):null]})}function U({siteId:e}){let t=j(e=>e.detail?.model.collections.find(M));return t?(0,I.jsxs)(`p`,{className:`g-hint seo-settings-file`,children:[(0,I.jsx)(a,{className:`g-link`,to:`/sites/${e}/edit?path=${encodeURIComponent(t.path)}`,children:`Edit the settings file`}),` `,(0,I.jsx)(`span`,{className:`g-mono`,children:t.path})]}):null}var W={titles:`The title and description people see in search results and AI answers.`,content:`Headings, length and the words on each page.`,images:`Alt text, file sizes and share pictures.`,links:`Links that lead nowhere, and pages nothing links to.`,indexing:`Whether search engines may show each page, and which address they use.`,structured:`Details search engines read to show richer results.`,ai:`What AI crawlers may read, and how plainly the site says who it is.`};function G(e){try{return e?new URL(e).host.replace(/^www\./,``):`your-site`}catch{return`your-site`}}function K({audit:e}){return(0,I.jsx)(`div`,{className:`seo-tally`,role:`group`,"aria-label":`Findings by severity`,children:[`must`,`should`,`idea`].map(t=>(0,I.jsxs)(`div`,{className:`seo-tally__item`,"data-severity":t,children:[(0,I.jsx)(`span`,{className:`seo-tally__value`,children:e.counts[t]}),(0,I.jsx)(`span`,{className:`seo-tally__label`,children:t===`idea`?e.counts.idea===1?`Idea`:`Ideas`:C[t].label})]},t))})}function q({siteId:e,group:t,findings:n,open:r,onToggle:i,connected:a,address:o,fixing:s,onFix:l,onWrite:u}){let d={must:0,should:0,idea:0};for(let e of n)d[e.severity]+=1;let{writes:p,fixes:h}=y(n),_=`seo-group-${t}`;return(0,I.jsxs)(`section`,{className:`app-card seo-group`,"data-open":r||void 0,children:[(0,I.jsx)(`h2`,{className:`seo-group__heading`,children:(0,I.jsxs)(`button`,{type:`button`,className:`seo-group__toggle`,"aria-expanded":r,"aria-controls":_,onClick:i,disabled:n.length===0,children:[(0,I.jsx)(m,{name:r?`chevron-down`:`chevron-right`,className:`seo-group__chevron`}),(0,I.jsxs)(`span`,{className:`seo-group__text`,children:[(0,I.jsx)(`span`,{className:`seo-group__label`,children:P[t]}),(0,I.jsx)(`span`,{className:`seo-group__blurb`,children:W[t]})]}),(0,I.jsx)(`span`,{className:`seo-group__counts`,children:n.length===0?(0,I.jsx)(c,{tone:`success`,children:`In good shape`}):[`must`,`should`,`idea`].filter(e=>d[e]>0).map(e=>(0,I.jsxs)(c,{tone:C[e].tone,children:[d[e],` `,e===`idea`?d.idea===1?`idea`:`ideas`:C[e].label.toLowerCase()]},e))})]})}),r&&n.length?(0,I.jsxs)(`div`,{id:_,className:`seo-group__body`,children:[p.length||h.length>1?(0,I.jsxs)(`div`,{className:`seo-group__batch`,role:`group`,"aria-label":`Do several at once in ${P[t]}`,children:[h.length>1?(0,I.jsxs)(f,{size:`sm`,variant:`secondary`,icon:`check`,busy:h.some(e=>s.has(e.id)),busyLabel:`Fixing…`,onClick:()=>l(h),children:[`Fix all `,h.length]}):null,p.map(e=>(0,I.jsx)(f,{size:`sm`,variant:`secondary`,icon:`chat`,disabled:!a,title:a?`${T(e.count,`request`)} to the assistant, one per page`:`Connect the assistant in App settings first.`,onClick:()=>u(e.kind),children:g[e.kind].many(e.count)},e.kind)),p.length&&!a?(0,I.jsx)(`p`,{className:`seo-group__batch-note`,children:`Connect the assistant in App settings to have it write these. It uses one request per page, and only what each page already says.`}):null]}):null,(0,I.jsx)(`ul`,{className:`seo-findings`,children:n.map(t=>(0,I.jsx)(v,{finding:t,siteId:e,connected:a,fixing:s.has(t.id),onFix:e=>l([e]),onWrite:e=>u(e.write,e.path?[e.path]:void 0),address:`${o}${t.url&&t.url!==`/`?` › ${t.url.split(`/`).filter(Boolean).join(` › `)}`:``}`},t.id))})]}):null]})}function J({siteId:e,audit:t}){let n=A(e),r=k(e=>e.run);return t.rendering.source===`none`?(0,I.jsxs)(`p`,{className:`seo-note seo-note--action`,children:[(0,I.jsx)(m,{name:`eye`}),(0,I.jsx)(`span`,{children:`Only the content files were checked. Start the preview to also check the pages as visitors and crawlers get them: headings, preferred addresses, structured data and the sitemap.`}),(0,I.jsx)(f,{size:`sm`,variant:`secondary`,icon:`play`,busy:n?.state===`starting`||n?.state===`installing`,busyLabel:`Starting…`,onClick:()=>void r(e,`start`),children:`Start the preview`})]}):(0,I.jsxs)(`p`,{className:`seo-note`,children:[(0,I.jsx)(m,{name:`eye`}),` `,t.rendering.detail,` `,_(t.rendering),t.rendering.stale?` Start the preview to check your latest changes.`:``]})}function Y({siteId:e,audit:t,refetch:n}){let r=j(e=>e.detail?.model.urls.production),i=O([`settings`],()=>h(`GET /api/settings`)).data?.secrets.some(e=>e.name===`anthropic`&&e.configured)??!1,[a,o]=(0,N.useState)(()=>new Set(F.filter(e=>t.byGroup[e].must+t.byGroup[e].should>0).slice(0,1))),[s,c]=(0,N.useState)(null),{fix:l,busy:u}=w(e,n),d=G(r),f=(0,N.useMemo)(()=>new Map(F.map(e=>[e,t.findings.filter(t=>t.group===e)])),[t.findings]),p=e=>{let t=new Set(a);t.has(e)?t.delete(e):t.add(e),o(t)};return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`seo-overview`,children:[(0,I.jsx)(K,{audit:t}),(0,I.jsx)(`p`,{className:`seo-overview__summary`,children:t.summary.split(/(?<=\.)\s/)[0]})]}),(0,I.jsx)(J,{siteId:e,audit:t}),(0,I.jsxs)(`div`,{className:`seo-layout`,children:[(0,I.jsxs)(`div`,{className:`seo-layout__main`,children:[F.map(t=>(0,I.jsx)(q,{siteId:e,group:t,findings:f.get(t)??[],open:a.has(t),onToggle:()=>p(t),connected:i,address:d,fixing:u,onFix:e=>void l(e),onWrite:(e,t)=>c({kind:e,...t?{paths:t}:{}})},t)),(0,I.jsx)(`p`,{className:`seo-fineprint`,children:`Each item says whether it is measured on the site, documented by the search engine or AI provider (with a link to their page), or a judgement. Nothing here predicts rankings or whether an AI assistant will quote the site.`})]}),(0,I.jsxs)(`aside`,{className:`seo-layout__side`,"aria-label":`How AI systems see this site`,children:[(0,I.jsx)(`h2`,{className:`seo-side__title`,children:`How AI systems see this site`}),(0,I.jsx)(B,{siteId:e,report:t.crawlers,onSaved:n=>D(S.site(e),{...t,crawlers:n})}),(0,I.jsx)(H,{siteId:e,report:t.agentReadable})]})]}),(0,I.jsx)(x,{siteId:e,open:s!==null,kind:s?.kind??null,...s?.paths?{paths:s.paths}:{},onClose:()=>c(null),onFinished:()=>void n()})]})}function X(){let{siteId:t=``}=e(),i=j(e=>e.detail?.name??`Site`),a=b(t);E({crumbs:[{label:i,to:`/sites/${t}`},{label:`Search & AI`}]});let o;return o=a.loading?(0,I.jsxs)(`div`,{"aria-busy":`true`,className:`seo-loading`,children:[(0,I.jsx)(l,{height:64}),F.map(e=>(0,I.jsx)(l,{height:56},e))]}):a.data?a.data.pages.checked===0?(0,I.jsx)(r,{title:`Nothing to check yet.`,body:`Once the site has pages, this shows how search engines and AI assistants see them.`}):(0,I.jsx)(Y,{siteId:t,audit:a.data,refetch:a.refetch}):(0,I.jsx)(n,{title:`Couldn’t check the site`,error:a.error,onRetry:()=>void a.refetch()}),(0,I.jsx)(`div`,{className:`app-screen seo-screen`,children:(0,I.jsxs)(`div`,{className:`app-screen__inner app-screen__inner--wide`,children:[(0,I.jsx)(p,{eyebrow:`Site`,title:`Search & AI`,description:`How search engines and AI assistants find, read and quote this site — what needs fixing, and ideas worth a look. Fixes wait in Proof like any other change.`,actions:(0,I.jsx)(f,{variant:`secondary`,icon:`refresh`,busy:a.fetching&&!a.loading,busyLabel:`Checking…`,onClick:()=>void a.refetch(),children:`Check again`})}),o,(0,I.jsx)(U,{siteId:t})]})})}export{X as VisibilityScreen};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.brand-screen .app-screen__inner--wide{max-inline-size:1180px}.brand-head{align-items:flex-end;gap:var(--space-6);border-block-end:var(--border-hair) solid var(--border-default);flex-wrap:wrap;margin-block-end:var(--space-6);padding-block-end:var(--space-6);display:flex}.brand-head__text{gap:var(--space-2);flex:420px;display:grid}.brand-head__title{font-family:var(--font-display);font-size:var(--display-sm);line-height:var(--leading-heading);letter-spacing:var(--tracking-display);font-weight:var(--weight-regular);margin:0}.brand-head__lede{color:var(--ink-secondary);font-size:var(--text-md);line-height:var(--leading-md);max-inline-size:62ch;margin:0}.brand-loading{align-items:center;gap:var(--space-2);display:flex}.brand-head__actions{gap:var(--space-2);flex-wrap:wrap;display:flex}.brand-start{gap:var(--space-6);display:grid}.brand-start__lede{font-family:var(--font-display);font-size:var(--text-xl);line-height:var(--leading-xl);text-wrap:pretty;max-inline-size:52ch;margin:0}.brand-start__note{font-size:var(--text-sm);color:var(--warning-ink);background:var(--warning-tint);padding:var(--space-2) var(--space-3);border-radius:var(--radius-sm);max-inline-size:72ch;margin:0}.brand-ways{gap:var(--space-5);grid-template-columns:repeat(2,minmax(0,1fr));align-items:start;display:grid}@media (width<=980px){.brand-ways{grid-template-columns:minmax(0,1fr)}}.brand-way{gap:var(--space-4);padding:var(--space-8);background:var(--surface-raised);border:var(--border-hair) solid var(--border-default);border-radius:var(--radius-md);box-shadow:var(--shadow-1);transition:box-shadow var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard);align-content:start;display:grid}.brand-way:hover{box-shadow:var(--shadow-2)}.brand-way>.g-btn{justify-self:start}.brand-way__title{font-family:var(--font-display);font-size:var(--text-2xl);line-height:var(--leading-2xl);font-weight:var(--weight-regular);letter-spacing:var(--tracking-heading);margin:0}.brand-way__body{color:var(--ink-secondary);font-size:var(--text-md);line-height:var(--leading-md);text-wrap:pretty;margin:0}.brand-way__list{gap:var(--space-1);font-size:var(--text-sm);color:var(--ink-secondary);margin:0;padding:0;list-style:none;display:grid}.brand-way__list li:before{content:"‸ ";color:var(--proof-insert);font-family:var(--font-mono)}.brand-way__hint{font-size:var(--text-xs);color:var(--ink-tertiary);margin:0}.brand-drop-wrap{gap:var(--space-3);display:grid}.brand-drop{justify-items:center;gap:var(--space-2);padding:var(--space-8) var(--space-4);border:var(--border-thick) dashed var(--border-strong);border-radius:var(--radius-md);background:var(--surface-sunken);text-align:center;color:var(--ink-secondary);transition:background var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);display:grid}.brand-drop--compact{padding:var(--space-4);grid-auto-flow:column;justify-content:start}.brand-drop--over{border-color:var(--accent-text);background:var(--accent-subtle);color:var(--ink-primary)}.brand-drop__text{font-size:var(--text-sm);max-inline-size:40ch;margin:0}.brand-pending{gap:var(--space-2);margin:0;padding:0;list-style:none;display:grid}.brand-pending__item{gap:var(--space-1-5);padding:var(--space-3);border:var(--border-hair) solid var(--border-default);border-radius:var(--radius-md);background:var(--surface-paper);display:grid}.brand-pending__head{align-items:center;gap:var(--space-2);min-inline-size:0;display:flex}.brand-pending__name{min-inline-size:0;font-weight:var(--weight-semibold);font-size:var(--text-sm);text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}.brand-pending__size{font-family:var(--font-mono);font-size:var(--text-2xs);color:var(--ink-tertiary)}.brand-pending__plan{font-size:var(--text-xs);color:var(--ink-secondary);margin:0}.brand-pending__plan--error{color:var(--danger)}.brand-pending__actions{justify-content:flex-end;display:flex}.brand-progress{block-size:4px;inline-size:100%;accent-color:var(--accent-fill)}.brand-website{gap:var(--space-1-5);display:grid}.brand-website__label{font-size:var(--text-sm);font-weight:var(--weight-medium)}.brand-website__row{gap:var(--space-2);display:flex}.brand-website__row>.g-input{flex:1}.brand-sources{margin:0 0 var(--space-4);gap:var(--space-2);padding:0;list-style:none;display:grid}.brand-source{gap:var(--space-3);padding:var(--space-3);border:var(--border-hair) solid var(--border-subtle);border-radius:var(--radius-md);background:var(--surface-raised);grid-template-columns:56px minmax(0,1fr) auto;align-items:start;display:grid}.brand-source--ignored{opacity:.6}.brand-source__thumb{object-fit:contain;border-radius:var(--radius-sm);background:var(--surface-sunken);border:var(--border-hair) solid var(--border-subtle);block-size:56px;inline-size:56px}.brand-source__thumb--type{font-family:var(--font-mono);font-size:var(--text-2xs);letter-spacing:var(--tracking-label);color:var(--ink-secondary);place-items:center;display:grid}.brand-source__main{gap:var(--space-1);min-inline-size:0;display:grid}.brand-source__head{gap:var(--space-2);flex-wrap:wrap;align-items:baseline;display:flex}.brand-source__name{font-weight:var(--weight-semibold);font-size:var(--text-sm);overflow-wrap:anywhere}.brand-source__meta{font-size:var(--text-xs);color:var(--ink-tertiary)}.brand-source__note{font-size:var(--text-xs);color:var(--ink-secondary);margin:0;font-style:italic}.brand-source__learned{font-size:var(--text-xs);line-height:var(--leading-xs);color:var(--ink-secondary);gap:2px;margin:0;padding-inline-start:var(--space-4);display:grid}.brand-source__limited{color:var(--warning-ink)}.brand-source__actions{gap:var(--space-1);display:flex}.brand-progress-view{gap:var(--space-5);padding:var(--space-8);background:var(--surface-raised);border:var(--border-hair) solid var(--border-default);border-radius:var(--radius-md);justify-items:start;margin-block-end:var(--space-6);display:grid}.brand-progress-view__title{font-family:var(--font-display);font-size:var(--text-2xl);font-weight:var(--weight-regular);margin:0}.brand-steps{gap:var(--space-2-5,var(--space-3));min-inline-size:min(560px,100%);margin:0;padding:0;list-style:none;display:grid}.brand-step{gap:var(--space-2);font-size:var(--text-md);color:var(--ink-tertiary);grid-template-columns:20px auto 1fr;align-items:baseline;display:grid}.brand-step--running,.brand-step--done{color:var(--ink-primary)}.brand-step--done .g-icon{color:var(--proof-insert)}.brand-step--error{color:var(--danger)}.brand-step--skipped .brand-step__label{text-decoration:line-through;-webkit-text-decoration-color:var(--ink-disabled);text-decoration-color:var(--ink-disabled)}.brand-step__dot{background:var(--border-strong);border-radius:50%;place-self:center;block-size:6px;inline-size:6px}.brand-step__detail{font-size:var(--text-xs);color:var(--ink-secondary)}.brand-partial{gap:var(--space-2);border-block-start:var(--border-hair) solid var(--border-subtle);inline-size:100%;padding-block-start:var(--space-4);display:grid}.brand-partial__swatches{gap:var(--space-3);font-size:var(--text-xs);flex-wrap:wrap;margin:0;padding:0;list-style:none;display:flex}.brand-partial__swatches li{align-items:center;gap:var(--space-1-5);display:inline-flex}.brand-partial__swatches span{border-radius:var(--radius-xs);block-size:20px;inline-size:20px;box-shadow:inset 0 0 0 1px rgb(var(--shadow-color) / .12);animation:brand-in var(--duration-slow) var(--ease-out)}.brand-partial__fonts{font-size:var(--text-sm);color:var(--ink-secondary);margin:0}@keyframes brand-in{0%{opacity:0;transform:scale(.6)}}.brand-review{z-index:var(--z-sticky);align-items:center;gap:var(--space-3);padding:var(--space-3) var(--space-4);background:var(--surface-overlay);border:var(--border-hair) solid var(--border-default);border-inline-start:var(--border-heavy) solid var(--proof-change);border-radius:var(--radius-md);box-shadow:var(--shadow-2);flex-wrap:wrap;margin-block-end:var(--space-5);display:flex;position:sticky;inset-block-start:calc(-1 * var(--space-10))}.brand-review__text{font-size:var(--text-sm);flex:320px}.brand-review__cost{color:var(--ink-secondary)}.brand-questions{padding:var(--space-5);background:var(--proof-change-tint);border-radius:var(--radius-md);margin-block-end:var(--space-5)}.brand-questions__title{margin:0 0 var(--space-3);font-family:var(--font-display);font-size:var(--text-xl);font-weight:var(--weight-regular);color:var(--proof-change-ink)}.brand-questions ul{gap:var(--space-4);margin:0;padding:0;list-style:none;display:grid}.brand-question__text{margin:0 0 var(--space-2);font-size:var(--text-md);color:var(--ink-primary)}.brand-question__options{gap:var(--space-2);flex-wrap:wrap;display:flex}.brand-option{gap:2px var(--space-2);padding:var(--space-2) var(--space-3);border:var(--border-thick) solid var(--border-default);border-radius:var(--radius-md);background:var(--surface-raised);min-inline-size:220px;color:var(--ink-primary);font:inherit;text-align:start;cursor:pointer;transition:border-color var(--duration-fast) var(--ease-standard), transform var(--duration-instant) var(--ease-standard);grid-template-columns:auto 1fr;align-items:center;display:grid}.brand-option:hover{border-color:var(--border-strong)}.brand-option:active{transform:translateY(1px)}.brand-option--chosen{border-color:var(--accent-text);background:var(--accent-subtle)}.brand-option__chip{border-radius:var(--radius-sm);block-size:28px;inline-size:28px;box-shadow:inset 0 0 0 1px rgb(var(--shadow-color) / .15);grid-row:span 2}.brand-option__label{font-size:var(--text-sm);font-weight:var(--weight-medium)}.brand-option__where{font-size:var(--text-xs);color:var(--ink-secondary)}.brand-new{align-items:center;gap:var(--space-3);padding:var(--space-2) var(--space-3);background:var(--info-tint);color:var(--info-ink);border-radius:var(--radius-sm);font-size:var(--text-sm);margin-block-end:var(--space-4);display:flex}.brand-ask{gap:var(--space-2);padding:var(--space-2) var(--space-2) var(--space-2) var(--space-3);border:var(--border-hair) solid var(--border-default);border-radius:var(--radius-pill);background:var(--surface-raised);grid-template-columns:auto minmax(0,1fr) auto;align-items:center;margin-block-end:var(--space-5);display:grid}.brand-ask>.g-icon{color:var(--ink-tertiary)}.brand-ask .g-input{box-shadow:none;background:0 0;border:0}.brand-ask__reply{padding:0 var(--space-3) var(--space-1);font-size:var(--text-sm);color:var(--ink-secondary);grid-column:1/-1;margin:0}.brand-findings{gap:var(--space-2);margin-block-end:var(--space-6);display:grid}.brand-findings ul{gap:var(--space-1-5);margin:0;padding:0;list-style:none;display:grid}.brand-finding{align-items:center;gap:var(--space-2);font-size:var(--text-sm);border-inline-start:var(--border-heavy) solid var(--warning);flex-wrap:wrap;padding-inline-start:var(--space-3);display:flex}.brand-finding--note{border-inline-start-color:var(--info);color:var(--ink-secondary)}.brand-sheet{display:grid}.brand-band{gap:var(--space-8);padding-block:var(--space-10);border-block-start:var(--border-hair) solid var(--border-default);grid-template-columns:172px minmax(0,1fr);display:grid}@media (width<=860px){.brand-band{gap:var(--space-4);padding-block:var(--space-8);grid-template-columns:minmax(0,1fr)}}.brand-band__label{align-content:start;gap:var(--space-1);align-self:start;display:grid;position:sticky;inset-block-start:var(--space-4)}.brand-band__number{font-family:var(--font-mono);font-size:var(--text-2xs);letter-spacing:var(--tracking-label);color:var(--accent-text)}.brand-band__title{font-family:var(--font-display);font-size:var(--text-2xl);line-height:var(--leading-2xl);font-weight:var(--weight-regular);letter-spacing:var(--tracking-heading);margin:0}.brand-band__body{gap:var(--space-8);min-inline-size:0;display:grid}.brand-subhead{margin:0 0 var(--space-3);font-family:var(--font-mono);font-size:var(--text-2xs);letter-spacing:var(--tracking-label);text-transform:uppercase;color:var(--ink-secondary);font-weight:var(--weight-regular);text-align:start}.brand-note{font-size:var(--text-sm);color:var(--ink-secondary);max-inline-size:64ch;margin:0}.brand-swatches{gap:var(--space-5) var(--space-4);grid-template-columns:repeat(auto-fill,minmax(176px,1fr));margin:0;padding:0;list-style:none;display:grid}.brand-swatches--skeleton{margin-block-start:var(--space-8)}.brand-swatch{gap:var(--space-2);min-inline-size:0;display:grid}.brand-swatch__chip{border-radius:var(--radius-md);block-size:148px;padding:var(--space-3);box-shadow:inset 0 0 0 1px rgb(var(--shadow-color) / .1), var(--shadow-1);transition:transform var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard);flex-direction:column;justify-content:space-between;display:flex;position:relative}.brand-swatch:hover .brand-swatch__chip{box-shadow:inset 0 0 0 1px rgb(var(--shadow-color) / .1), var(--shadow-2);transform:translateY(-2px)}.brand-swatch__role{font-family:var(--font-mono);font-size:var(--text-2xs);letter-spacing:var(--tracking-label);text-transform:uppercase}.brand-swatch__hex{font-size:var(--text-sm);color:inherit;inline-size:9ch}.brand-swatch__chip .brand-inline:hover:not(:disabled){border-color:currentColor}.brand-swatch__chip .brand-inline:not(:focus){color:inherit}.brand-swatch__chip .brand-inline:focus{background:var(--surface-raised);color:var(--ink-primary)}.brand-more{font-size:var(--text-sm);justify-self:start;margin-block-start:var(--space-2)}.brand-swatch__pick{border-radius:var(--radius-pill);cursor:pointer;opacity:0;block-size:28px;inline-size:28px;transition:opacity var(--duration-fast) var(--ease-standard);background:color-mix(in srgb, currentColor 14%, transparent);place-items:center;display:grid;position:absolute;inset-block-start:var(--space-2);inset-inline-end:var(--space-2)}.brand-swatch:hover .brand-swatch__pick,.brand-swatch__pick:focus-within{opacity:1}.brand-swatch__pick input{opacity:0;cursor:pointer;position:absolute;inset:0}.brand-swatch__text{gap:2px;min-inline-size:0;display:grid}.brand-swatch__name{font-family:var(--font-display);font-size:var(--text-lg)}.brand-swatch__codes{gap:var(--space-2);flex-wrap:wrap;align-items:baseline;min-inline-size:0;display:flex}.brand-swatch__value{inline-size:8.5ch;font-size:var(--text-xs)}.brand-swatch__value--invalid{color:var(--danger);-webkit-text-decoration:underline wavy var(--danger);text-decoration:underline wavy var(--danger)}.brand-swatch__token{font-family:var(--font-mono);font-size:var(--text-2xs);color:var(--ink-tertiary);text-overflow:ellipsis;white-space:nowrap;max-inline-size:100%;overflow:hidden}.brand-swatch__usage{font-size:var(--text-xs);color:var(--ink-secondary);line-height:var(--leading-xs);margin:0}.brand-inline{inline-size:100%;min-inline-size:0;padding:1px var(--space-1);margin-inline:calc(-1 * var(--space-1));border:var(--border-hair) solid transparent;border-radius:var(--radius-xs);color:var(--ink-primary);font:inherit;text-overflow:ellipsis;transition:border-color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard);background:0 0}.brand-inline:hover:not(:disabled){border-color:var(--border-default)}.brand-inline:focus{border-color:var(--focus-ring);background:var(--surface-raised);outline:none}.brand-inline:disabled{color:inherit}.brand-inline--mono{font-family:var(--font-mono)}.brand-source-line{gap:var(--space-1-5);font-size:var(--text-2xs);color:var(--ink-tertiary);flex-wrap:wrap;align-items:center;margin:0;display:flex}.brand-confidence{font-family:var(--font-mono);font-size:var(--text-2xs);letter-spacing:var(--tracking-label);text-transform:uppercase;padding:0 var(--space-1);border-radius:var(--radius-xs)}.brand-confidence--measured{color:var(--proof-insert-ink);background:var(--proof-insert-tint)}.brand-confidence--declared{color:var(--info-ink);background:var(--info-tint)}.brand-confidence--inferred{color:var(--warning-ink);background:var(--warning-tint)}.brand-source-line__where{overflow-wrap:anywhere}.brand-contrast__list{margin:0;padding:0;list-style:none;display:grid}.brand-contrast__row{gap:var(--space-3);padding-block:var(--space-2);border-block-end:var(--border-hair) solid var(--border-subtle);grid-template-columns:44px minmax(0,1fr) 4.5em auto;align-items:center;display:grid}.brand-contrast__sample{border-radius:var(--radius-sm);block-size:32px;font-family:var(--font-display);font-size:var(--text-lg);box-shadow:inset 0 0 0 1px rgb(var(--shadow-color) / .1);place-items:center;display:grid}.brand-contrast__words{font-size:var(--text-sm);display:grid}.brand-contrast__seen{font-size:var(--text-2xs);color:var(--ink-tertiary)}.brand-contrast__ratio{font-family:var(--font-mono);font-size:var(--text-sm);text-align:end}.brand-fonts{gap:var(--space-4);grid-template-columns:repeat(auto-fill,minmax(260px,1fr));margin:0;padding:0;list-style:none;display:grid}.brand-font{gap:var(--space-3);padding:var(--space-4);background:var(--surface-raised);border:var(--border-hair) solid var(--border-subtle);border-radius:var(--radius-md);grid-template-columns:88px minmax(0,1fr);align-items:start;display:grid}.brand-font__aa{letter-spacing:-.02em;font-size:64px;line-height:1}.brand-font__text{gap:2px;min-inline-size:0;display:grid}.brand-font__family{font-size:var(--text-lg);font-weight:var(--weight-semibold)}.brand-font__state{font-size:var(--text-xs);color:var(--ink-secondary);margin:0}.brand-font__state code{font-size:var(--text-2xs);color:var(--ink-tertiary)}.brand-scale{margin:0;padding:0;list-style:none;display:grid}.brand-scale__row{gap:var(--space-5);padding-block:var(--space-4);border-block-end:var(--border-hair) solid var(--border-subtle);grid-template-columns:180px minmax(0,1fr);align-items:baseline;display:grid}@media (width<=860px){.brand-scale__row{gap:var(--space-1);grid-template-columns:minmax(0,1fr)}}.brand-scale__meta{gap:2px;display:grid}.brand-scale__spec{font-family:var(--font-mono);font-size:var(--text-2xs);color:var(--ink-tertiary)}.brand-scale__sample{overflow-wrap:anywhere;text-wrap:balance;margin:0}.brand-sample{gap:var(--space-3);padding:clamp(var(--space-6), 4vw, var(--space-12));border-radius:var(--radius-md);box-shadow:inset 0 0 0 1px rgb(var(--shadow-color) / .1);display:grid}.brand-sample__eyebrow{letter-spacing:.08em;text-transform:uppercase;margin:0;font-size:13px;font-weight:600}.brand-sample__heading{text-wrap:balance;max-inline-size:22ch;margin:0;font-size:clamp(28px,3.4vw,44px);line-height:1.08}.brand-sample__body{max-inline-size:56ch;margin:0;font-size:17px;line-height:1.55}.brand-sample__actions{align-items:center;gap:20px;margin-block-start:8px;display:flex}.brand-sample__button{padding:11px 20px;font-size:15px;font-weight:600}.brand-sample__link{text-underline-offset:3px;font-size:15px;text-decoration:underline}.brand-logos{gap:var(--space-5);margin:0;padding:0;list-style:none;display:grid}.brand-logo{gap:var(--space-5);grid-template-columns:minmax(0,2fr) minmax(0,1fr);align-items:start;display:grid}@media (width<=860px){.brand-logo{grid-template-columns:minmax(0,1fr)}}.brand-logo--retired .brand-logo__grounds{opacity:.45;filter:grayscale(.6)}.brand-logo__grounds{gap:var(--space-3);grid-auto-columns:1fr;grid-auto-flow:column;display:grid}.brand-logo__ground{min-block-size:168px;padding:var(--space-8);border-radius:var(--radius-md);box-shadow:inset 0 0 0 1px rgb(var(--shadow-color) / .1);place-items:center;display:grid}.brand-logo__ground img{max-block-size:96px;max-inline-size:70%}.brand-logo__none{font-size:var(--text-xs)}.brand-logo__text{gap:var(--space-1);font-size:var(--text-sm);color:var(--ink-secondary);display:grid}.brand-logo__variant{font-family:var(--font-display);font-size:var(--text-lg);color:var(--ink-primary);text-transform:capitalize}.brand-logo__notes{font-style:italic}.brand-logo__colors{gap:4px;display:inline-flex}.brand-logo__colors i{block-size:14px;inline-size:14px;box-shadow:inset 0 0 0 1px rgb(var(--shadow-color) / .15);border-radius:3px}.brand-scales{gap:var(--space-8);grid-template-columns:repeat(auto-fit,minmax(220px,1fr));display:grid}.brand-space,.brand-radii{gap:var(--space-2);font-size:var(--text-xs);color:var(--ink-secondary);margin:0;padding:0;list-style:none;display:grid}.brand-space li{gap:var(--space-2);grid-template-columns:120px auto 1fr;align-items:center;display:grid}.brand-space__bar{background:var(--accent-line);border-radius:2px;block-size:10px}.brand-space code,.brand-radii code{font-family:var(--font-mono);font-size:var(--text-2xs);color:var(--ink-primary)}.brand-radii li{gap:var(--space-2);grid-template-columns:40px auto 1fr;align-items:center;display:grid}.brand-radii__box{border:var(--border-thick) solid var(--ink-secondary);block-size:28px;inline-size:36px}.brand-radii__box--shadow{background:var(--surface-raised);border-color:#0000}.brand-components{gap:var(--space-4);grid-template-columns:repeat(auto-fill,minmax(220px,1fr));margin:0;padding:0;list-style:none;display:grid}.brand-component{gap:var(--space-2);align-content:start;display:grid}.brand-component__thumb{aspect-ratio:16/10;border-radius:var(--radius-md);background:var(--surface-sunken);border:var(--border-hair) solid var(--border-subtle);place-items:center;display:grid;overflow:hidden}.brand-component__thumb img{object-fit:cover;object-position:top;block-size:100%;inline-size:100%;transition:transform var(--duration-slow) var(--ease-out)}.brand-component:hover .brand-component__thumb img{transform:scale(1.025)}.brand-component__text{gap:2px;display:grid}.brand-component__label{font-weight:var(--weight-semibold);font-size:var(--text-sm)}.brand-component__when{font-size:var(--text-xs);color:var(--ink-secondary);line-height:var(--leading-xs)}.brand-component__used{font-family:var(--font-mono);font-size:var(--text-2xs);color:var(--ink-tertiary)}.brand-voice{gap:var(--space-6);display:grid}.brand-voice__summary{resize:vertical;inline-size:100%;padding:var(--space-1) var(--space-2);margin-inline:calc(-1 * var(--space-2));border:var(--border-hair) solid transparent;border-radius:var(--radius-sm);color:var(--ink-primary);font-family:var(--font-display);font-size:var(--text-xl);line-height:var(--leading-xl);field-sizing:content;background:0 0}.brand-voice__summary:hover{border-color:var(--border-default)}.brand-voice__summary:focus{border-color:var(--focus-ring);background:var(--surface-raised);outline:none}.brand-voice__tone{gap:var(--space-1-5);flex-wrap:wrap;margin:0;display:flex}.brand-rules{counter-reset:rule;gap:var(--space-5);margin:0;padding:0;list-style:none;display:grid}.brand-rule{counter-increment:rule;gap:var(--space-2);padding-inline-start:var(--space-8);display:grid;position:relative}.brand-rule:before{content:counter(rule, decimal-leading-zero);font-family:var(--font-mono);font-size:var(--text-2xs);color:var(--ink-tertiary);position:absolute;inset-block-start:3px;inset-inline-start:0}.brand-rule__rule{font-weight:var(--weight-semibold);font-size:var(--text-md);margin:0}.brand-rule__quote{border-inline-start:var(--border-heavy) solid var(--accent-line);margin:0;padding-inline-start:var(--space-3)}.brand-rule__quote p{font-family:var(--font-display);font-size:var(--text-lg);line-height:var(--leading-lg);margin:0;font-style:italic}.brand-rule__quote cite{font-family:var(--font-mono);font-size:var(--text-2xs);color:var(--ink-tertiary);font-style:normal}.brand-rule__edit{font-size:var(--text-sm);gap:var(--space-2);flex-wrap:wrap;margin:0;display:flex}.brand-words{border-collapse:collapse;inline-size:100%;font-size:var(--text-sm)}.brand-words th{text-align:start;font-family:var(--font-mono);font-size:var(--text-2xs);letter-spacing:var(--tracking-label);text-transform:uppercase;font-weight:var(--weight-regular);color:var(--ink-tertiary);padding:var(--space-1) 0}.brand-words td{padding:var(--space-2) var(--space-3) var(--space-2) 0;border-block-start:var(--border-hair) solid var(--border-subtle);vertical-align:top}.brand-words td:first-child{font-weight:var(--weight-semibold);inline-size:30%}.brand-words td:last-child{color:var(--ink-secondary);text-decoration:line-through;-webkit-text-decoration-color:var(--proof-delete);text-decoration-color:var(--proof-delete)}.brand-words__why{text-decoration:none;display:inline}.brand-format{gap:var(--space-2) var(--space-4);font-size:var(--text-sm);grid-template-columns:140px minmax(0,1fr);margin:0;display:grid}.brand-format dt{font-family:var(--font-mono);font-size:var(--text-2xs);letter-spacing:var(--tracking-label);text-transform:uppercase;color:var(--ink-tertiary);padding-block-start:3px}.brand-format dd{margin:0}.brand-imagery{gap:var(--space-4);display:grid}.brand-imagery__direction{font-family:var(--font-display);font-size:var(--text-lg);line-height:var(--leading-lg);max-inline-size:60ch;margin:0}.brand-dodont{gap:var(--space-6);grid-template-columns:repeat(2,minmax(0,1fr));display:grid}@media (width<=700px){.brand-dodont{grid-template-columns:minmax(0,1fr)}}.brand-dodont ul{gap:var(--space-1-5);font-size:var(--text-sm);margin:0;padding-inline-start:var(--space-4);display:grid}.brand-band--material{margin-block-start:0}.brand-digest{margin-block:var(--space-6);border-block-start:var(--border-hair) solid var(--border-subtle);font-size:var(--text-xs);color:var(--ink-secondary);padding-block-start:var(--space-4)}.brand-digest summary{cursor:pointer;gap:var(--space-2);align-items:baseline;display:flex}.brand-digest pre{margin:var(--space-3) 0 0;padding:var(--space-4);white-space:pre-wrap;max-block-size:420px;font-family:var(--font-mono);font-size:var(--text-2xs);background:var(--surface-sunken);border-radius:var(--radius-sm);color:var(--ink-primary);line-height:1.6;overflow:auto}.brand-pending-note{gap:var(--space-2);font-size:var(--text-sm);color:var(--ink-secondary);align-items:center;display:flex}.brand-apply{gap:var(--space-3);display:grid}.brand-apply__edits{gap:var(--space-2);margin:0;padding:0;list-style:none;display:grid}.brand-apply__edits li{padding:var(--space-2) var(--space-3);background:var(--surface-sunken);border-radius:var(--radius-sm);gap:2px;display:grid}.brand-apply__label{font-weight:var(--weight-semibold);font-size:var(--text-sm)}.brand-apply__code{gap:var(--space-2);font-family:var(--font-mono);font-size:var(--text-xs);flex-wrap:wrap;display:flex}.brand-apply__where{font-family:var(--font-mono);font-size:var(--text-2xs);color:var(--ink-tertiary)}.brand-apply__warning{font-size:var(--text-sm);color:var(--danger);margin:0}.brand-drift ul,.brand-check ul{margin:0 0 var(--space-4);gap:var(--space-1-5);font-size:var(--text-sm);padding:0;list-style:none;display:grid}.brand-drift li,.brand-check li{gap:var(--space-2);flex-wrap:wrap;align-items:center;display:flex}.brand-drift__chip{block-size:16px;inline-size:16px;box-shadow:inset 0 0 0 1px rgb(var(--shadow-color) / .15);border-radius:3px;display:inline-block}.brand-check{gap:var(--space-2);padding:var(--space-3) var(--space-4);border-inline-start:var(--border-heavy) solid var(--warning);background:var(--surface-raised);border-radius:var(--radius-sm);display:grid}.brand-check code{font-family:var(--font-mono);font-size:var(--text-2xs);color:var(--ink-tertiary)}@media (prefers-reduced-motion:reduce){.brand-swatch__chip,.brand-component__thumb img,.brand-way,.brand-partial__swatches span{transition:none;animation:none}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e,F as t,I as n,L as r,R as i,V as a,W as o,a as s}from"./codemirror-CWul2x0p.js";import{n as c,r as l,t as u}from"./codemirror-languages-RlWkzgfM.js";import{n as d,r as f,t as p}from"./EditorScreen-
|
|
1
|
+
import{B as e,F as t,I as n,L as r,R as i,V as a,W as o,a as s}from"./codemirror-CWul2x0p.js";import{n as c,r as l,t as u}from"./codemirror-languages-RlWkzgfM.js";import{n as d,r as f,t as p}from"./EditorScreen-CzwKUTDg.js";function m(e,t){if(e===t)return null;let n=0,r=Math.min(e.length,t.length);for(;n<r&&e.charCodeAt(n)===t.charCodeAt(n);)n++;let i=e.length,a=t.length;for(;i>n&&a>n&&e.charCodeAt(i-1)===t.charCodeAt(a-1);)i--,a--;return{from:n,to:i,insert:t.slice(n,a)}}function h(e){return e.map(([e,n])=>{let a=new r({regexp:e,decoration:t.mark({class:n})});return i.fromClass(class{decorations;constructor(e){this.decorations=a.createDeco(e)}update(e){this.decorations=a.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations})})}var g=[[/^#{1,6} .*$/gm,`app-cm-heading`],[/^>.*$/gm,`app-cm-quote`],[/^\s*(?:[-*+]|\d+[.)])(?=\s)/gm,`app-cm-marker`],[/\*\*[^*\n]+\*\*|__[^_\n]+__/g,`app-cm-strong`],[/(?<![*\w])\*[^*\s][^*\n]*\*(?!\*)|(?<![_\w])_[^_\s][^_\n]*_(?!_)/g,`app-cm-em`],[/`[^`\n]+`/g,`app-cm-code`],[/!?\[[^\]\n]*\]\([^)\n]*\)/g,`app-cm-link`]],_=[[/^---\s*$/gm,`app-cm-marker`],[/^\s*(?:- )?[\w$.-]+(?=:(?:\s|$))/gm,`app-cm-key`],[/"(?:[^"\\\n]|\\.)*"(?=\s*:)/g,`app-cm-key`],[/(?<=^\s*)#.*$/gm,`app-cm-comment`]];function v(e){return e===`json`?[l(),h(_)]:e===`yaml`?[u(),h(_)]:e===`frontmatter`?[c(),h([..._,...g])]:[c(),h(g)]}function y(t){let r=!1,i,c=e=>{let{from:t,to:n}=i.state.selection.main,r=i.state.doc.toString(),a=e(r,t,n),o=m(r,a.text);return i.dispatch({...o?{changes:o}:{},selection:{anchor:a.start,head:a.end},scrollIntoView:!0}),i.focus(),!0},l=t.shortcuts?e.of([{key:`Mod-b`,run:()=>c((e,t,n)=>f(e,t,n,`**`))},{key:`Mod-i`,run:()=>c((e,t,n)=>f(e,t,n,`*`))},{key:`Mod-e`,run:()=>c((e,t,n)=>f(e,t,n,"`"))},{key:`Mod-k`,run:()=>c((e,t,n)=>p(e,t,n))},{key:`Mod-Alt-2`,run:()=>c((e,t,n)=>d(e,t,n,`## `))},{key:`Mod-Alt-3`,run:()=>c((e,t,n)=>d(e,t,n,`### `))},{key:`Mod-Shift-8`,run:()=>c((e,t,n)=>d(e,t,n,`- `))},{key:`Mod-Shift-9`,run:()=>c((e,t,n)=>d(e,t,n,`> `))}]):[];return i=new n({parent:t.parent,state:o.create({doc:t.value,extensions:[l,s,n.lineWrapping,v(t.language),t.placeholder?a(t.placeholder):[],n.contentAttributes.of({"aria-label":t.label,"aria-multiline":`true`,spellcheck:t.language===`markdown`?`true`:`false`}),n.updateListener.of(e=>{e.docChanged&&!r&&t.onChange(e.state.doc.toString()),e.focusChanged&&(e.view.hasFocus?t.onFocus?.():t.onBlur?.())})]})}),{setValue(e){let t=m(i.state.doc.toString(),e);t&&(r=!0,i.dispatch({changes:t}),r=!1)},hasFocus:()=>i.hasFocus,focus:()=>i.focus(),edit:e=>void c(e),destroy:()=>i.destroy()}}export{y as createEditor};
|