@blinkk/root-cms 3.0.4 → 3.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +2 -1
- package/dist/{chunk-RLZFZT42.js → chunk-VSPPZPMP.js} +2 -2
- package/dist/core/schema.d.ts +20 -0
- package/dist/plugin.js +1 -1
- package/dist/shared/auto-slug-words.d.ts +7 -0
- package/dist/shared/auto-slug.d.ts +14 -0
- package/dist/ui/{AIPage-YI3RFK5F.js → AIPage-F3NNYM5E.js} +1 -1
- package/dist/ui/{AssetsPage-4JNAOFYF.js → AssetsPage-DZQHAENZ.js} +1 -1
- package/dist/ui/{CollectionPage-JWHH5G55.js → CollectionPage-WVVG62NR.js} +1 -1
- package/dist/ui/{ComparePage-YZE3EMU4.js → ComparePage-CRDHP45W.js} +1 -1
- package/dist/ui/{DataPage-VRCQSZZG.js → DataPage-WMLBCPGF.js} +1 -1
- package/dist/ui/{DataSourcePage-WMSPBZ3W.js → DataSourcePage-POZAQFPU.js} +1 -1
- package/dist/ui/{DocTranslationsPage-RY2LOZBX.js → DocTranslationsPage-UR5D2RF2.js} +1 -1
- package/dist/ui/DocumentPage-SQ7ROBMC.js +1 -0
- package/dist/ui/{EditDataSourcePage-LLCX6K4J.js → EditDataSourcePage-PUA2AJ4C.js} +1 -1
- package/dist/ui/{EditReleasePage-WQYXXMZQ.js → EditReleasePage-CENP46EO.js} +1 -1
- package/dist/ui/{LogsPage-IP2DKEYR.js → LogsPage-FZRN6MBJ.js} +1 -1
- package/dist/ui/{NewDataSourcePage-RDYJC4DH.js → NewDataSourcePage-FTILYFJY.js} +1 -1
- package/dist/ui/{NewReleasePage-DGMFU2JN.js → NewReleasePage-MHJC66KK.js} +1 -1
- package/dist/ui/{NotFoundPage-WDZ2K7EF.js → NotFoundPage-EP2OE4JV.js} +1 -1
- package/dist/ui/{ProjectPage-HYJOQUWR.js → ProjectPage-6J7QCG75.js} +1 -1
- package/dist/ui/{ReleasePage-2KSF23TK.js → ReleasePage-IZ3DNGT4.js} +1 -1
- package/dist/ui/{ReleasesPage-NZIBBXU4.js → ReleasesPage-RWFOJ5VG.js} +1 -1
- package/dist/ui/SettingsPage-M4SIDBTI.js +1 -0
- package/dist/ui/{SidebarToolsPage-5C6YBWJ7.js → SidebarToolsPage-GAX3XJ7W.js} +1 -1
- package/dist/ui/{TaskPage-SPIFPGPP.js → TaskPage-UCATTNZ5.js} +1 -1
- package/dist/ui/{TasksPage-ZOXRPBQV.js → TasksPage-4AQLQ4IT.js} +1 -1
- package/dist/ui/{TranslationsArbPage-UHANA7JD.js → TranslationsArbPage-JGQGATCS.js} +1 -1
- package/dist/ui/{TranslationsEditPage-PQY6W5YG.js → TranslationsEditPage-7AGZGHKS.js} +1 -1
- package/dist/ui/{TranslationsPage-V2PQFCN5.js → TranslationsPage-WIDVSTYF.js} +1 -1
- package/dist/ui/{chunk-FBJURT7Z.js → chunk-7MTDTPYB.js} +1 -1
- package/dist/ui/{chunk-GXSAEPU3.js → chunk-7UIUAHC4.js} +1 -1
- package/dist/ui/{chunk-JT5L6GPZ.js → chunk-AEWL2RWR.js} +1 -1
- package/dist/ui/{chunk-MDUBCXU2.js → chunk-JKCZGT6B.js} +1 -1
- package/dist/ui/chunk-P4U2LUTF.js +1 -0
- package/dist/ui/{chunk-V7S4IAGB.js → chunk-QGBR3J2Y.js} +1 -1
- package/dist/ui/ui.js +1 -1
- package/package.json +3 -3
- package/dist/ui/DocumentPage-EEGTJMIW.js +0 -1
- package/dist/ui/SettingsPage-36XFWV62.js +0 -1
- package/dist/ui/chunk-NXQVLOTK.js +0 -1
- /package/dist/ui/{chunk-JT5L6GPZ.js.LEGAL.txt → chunk-AEWL2RWR.js.LEGAL.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as h,f as d,g as W}from"./chunk-AL3TN2KI.js";import{$ as w,Ac as P,Dc as U,Eb as T,Ga as B,Ha as t,Nb as I,S as k,Sb as H,Y as L,Za as j,a as C,ba as S,c as g,cc as O,gb as N,j as x,nc as R,pb as M,ra as b,vc as z,wc as Z}from"./chunk-NZHF733K.js";import{d as m}from"./chunk-KUCVLANF.js";x();function F(e){g(()=>{let o=window.__ROOT_CTX?.rootConfig,a=o?.projectName||"Root CMS",s=o?.minimalBranding?a:`${a} \u2013 Root CMS`;document.title=e?`${e} \u2013 ${s}`:s},[e])}var f={name:"@blinkk/root-cms",version:"3.0.4",author:"s@blinkk.com",license:"MIT",engines:{node:">=22.0.0"},repository:{type:"git",url:"git+https://github.com/blinkk/rootjs.git",directory:"packages/root-cms"},files:["dist/**/*"],bin:{"root-cms":"./bin/root-cms.js"},type:"module",module:"./dist/core.js",types:"./dist/core/core.d.ts",exports:{".":{types:"./dist/core/core.d.ts",import:"./dist/core.js"},"./client":{types:"./dist/core/client.d.ts",import:"./dist/client.js"},"./core":{types:"./dist/core/core.d.ts",import:"./dist/core.js"},"./functions":{types:"./dist/core/functions.d.ts",import:"./dist/functions.js"},"./plugin":{types:"./dist/core/plugin.d.ts",import:"./dist/plugin.js"},"./project":{types:"./dist/core/project.d.ts",import:"./dist/project.js"},"./richtext":{types:"./dist/core/richtext.d.ts",import:"./dist/richtext.js"}},scripts:{build:'rm -rf dist && concurrently -n "core,signin,ui" npm:build:core npm:build:signin npm:build:ui',"build:core":"node ../../scripts/build-esbuild.mjs ./esbuild.config.json","build:ui":"pnpm build:ui:bundle && pnpm build:ui:clean","build:ui:bundle":"esbuild ui/ui.tsx --bundle --minify --alias:react=@preact/compat --alias:react-dom=@preact/compat --tsconfig=ui/tsconfig.json --outdir=dist/ui --legal-comments=external --splitting --format=esm","build:ui:clean":"rm -f dist/ui/*-*.css","build:signin":"esbuild signin/signin.tsx --bundle --minify --tsconfig=signin/tsconfig.json --outdir=dist/ui --legal-comments=external",dev:'rm -rf dist && concurrently -k -n "core,ui" npm:dev:core npm:dev:signin npm:dev:ui',"dev:core":"pnpm build:core --watch","dev:signin":"pnpm build:signin --watch","dev:ui":"pnpm build:ui:bundle --watch",test:"pnpm build && firebase emulators:exec 'vitest run --exclude=**/*.visual.test.tsx'","test:visual":"vitest run --config=vitest.config.visual.ts","test:watch":"pnpm build && firebase emulators:exec 'vitest'"},dependencies:{"@ag-grid-community/client-side-row-model":"32.3.9","@ag-grid-community/core":"32.3.9","@ag-grid-community/react":"32.3.9","@ag-grid-community/styles":"32.3.9","@ai-sdk/anthropic":"3.0.74","@ai-sdk/google":"3.0.67","@ai-sdk/openai":"3.0.60","@ai-sdk/openai-compatible":"2.0.46","@ai-sdk/react":"3.0.177",ai:"6.0.175",zod:"4.4.3","@google-cloud/firestore":"7.11.3","@hello-pangea/dnd":"18.0.1","@types/cli-progress":"3.11.6","body-parser":"1.20.2","cli-progress":"3.12.0",commander:"11.0.0","csv-parse":"5.5.2","csv-stringify":"6.4.4","date-fns":"4.1.0","date-fns-tz":"3.2.0",diff:"8.0.2","dts-dom":"3.7.0","@mantine/spotlight":"4.2.12","fnv-plus":"1.3.1",jsonwebtoken:"9.0.2",kleur:"4.1.5",minisearch:"7.2.0","sanitize-html":"2.13.1",sirv:"2.0.3","tiny-glob":"0.2.9"},"//":"NOTE(stevenle): due to compat issues with mantine and preact, mantine is pinned to v4.2.12",devDependencies:{"@babel/core":"7.17.9","@blinkk/root":"workspace:*","@editorjs/editorjs":"2.30.8","@editorjs/header":"2.8.8","@editorjs/image":"2.10.2","@editorjs/list":"2.0.6","@editorjs/nested-list":"1.4.3","@editorjs/raw":"2.5.1","@editorjs/table":"2.4.4","@editorjs/underline":"1.2.1","@emotion/react":"11.10.5","@firebase/app-compat":"0.5.2","@firebase/app-types":"0.9.3","@firebase/rules-unit-testing":"5.0.0","@lexical/code":"0.33.1","@lexical/html":"0.33.1","@lexical/link":"0.33.1","@lexical/list":"0.33.1","@lexical/markdown":"0.33.1","@lexical/react":"0.33.1","@lexical/rich-text":"0.33.1","@lexical/selection":"0.33.1","@lexical/table":"0.33.1","@lexical/utils":"0.33.1","@mantine/core":"4.2.12","@mantine/hooks":"4.2.12","@mantine/modals":"4.2.12","@mantine/notifications":"4.2.12","@preact/compat":"18.3.1","@tabler/icons-preact":"3.35.0","@testing-library/preact":"3.2.4","@testing-library/user-event":"14.6.1","@types/body-parser":"1.19.3","@types/fnv-plus":"1.3.2","@types/gapi":"0.0.47","@types/gapi.client.drive-v3":"0.0.4","@types/gapi.client.sheets-v4":"0.0.4","@types/google.accounts":"0.0.14","@types/jsonwebtoken":"9.0.1","@types/node":"24.3.1","@types/sanitize-html":"2.13.0","@vitest/browser":"4.1.6","@vitest/browser-playwright":"4.1.6",concurrently:"7.6.0",esbuild:"0.28.0",firebase:"12.2.1","firebase-admin":"13.5.0","firebase-functions":"6.4.0","firebase-tools":"14.15.2","highlight.js":"11.6.0",jsdom:"27.2.0","json-diff-kit":"1.0.29",lexical:"0.33.1",marked:"9.1.1","mdast-util-from-markdown":"2.0.1","mdast-util-gfm":"3.0.0","micromark-extension-gfm":"3.0.0",playwright:"1.56.1",preact:"10.27.1","preact-iso":"2.11.1","preact-render-to-string":"6.6.7",react:"npm:@preact/compat@18.3.1","react-dom":"npm:@preact/compat@18.3.1","react-easy-crop":"5.5.6","react-json-view-compare":"2.0.2",typescript:"6.0.3",vite:"8.0.13",vitest:"4.1.6",yjs:"13.6.27"},peerDependencies:{"@blinkk/root":"3.0.4","firebase-admin":">=11","firebase-functions":">=4"},peerDependenciesMeta:{"firebase-functions":{optional:!0}}};function V(){return t("svg",{width:"100",height:"23",viewBox:"0 0 100 23",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t("g",{"clip-path":"url(#clip0_1_318)",children:[t("path",{d:"M7.82998 5.01802C3.12925 5.6479 0.833937 18.1194 2.62578 19.6731C5.64773 22.2934 16.6441 14.1722 15.6786 9.46913C15.3009 6.61371 11.2717 4.28377 7.82998 5.01802Z",fill:"black"}),t("path",{d:"M13.9782 0.720147C12.6553 0.896474 12.0093 4.38767 12.5136 4.8226C13.364 5.55611 16.4587 3.28271 16.187 1.96616C16.0807 1.16683 14.9468 0.514607 13.9782 0.720147Z",fill:"black"}),t("path",{d:"M92.7383 17.6275C90.9681 17.6275 89.3816 17.0263 88.3796 16.0744C87.9955 15.7237 87.8953 15.3396 88.246 14.9555L88.8305 14.2541C89.1645 13.87 89.5486 13.7865 89.9327 14.1205C90.6007 14.6883 91.7029 15.1726 92.5713 15.1726C93.5232 15.1726 94.1244 14.8219 94.1244 14.2875C94.1244 13.5193 93.2059 13.4358 91.9868 13.0684C90.417 12.6008 88.5132 11.7324 88.5132 9.64493C88.5132 7.70773 90.25 6.37173 92.7383 6.37173C94.2413 6.37173 95.5272 6.87273 96.4123 7.57413C96.8131 7.90813 96.9467 8.27553 96.596 8.67633L96.0282 9.37773C95.7109 9.76183 95.3435 9.82863 94.926 9.51133C94.3916 9.09383 93.6568 8.69303 92.7884 8.69303C92.0202 8.69303 91.5192 9.01033 91.5192 9.51133C91.5192 10.1292 92.3041 10.4131 93.1224 10.6636C94.9761 11.2314 97.1304 11.8326 97.1304 14.2708C97.1304 16.4585 95.1264 17.6275 92.7383 17.6275Z",fill:"black"}),t("path",{d:"M87.0008 16.6756C87.0843 17.1766 86.8171 17.4271 86.2994 17.4271H85.097C84.596 17.4271 84.3789 17.1766 84.3121 16.6756L83.7443 11.9161L81.757 16.7424C81.5399 17.2434 81.1892 17.5106 80.6882 17.5106H80.5212C80.0202 17.5106 79.6695 17.2434 79.4524 16.7424L77.4651 11.8994L76.8973 16.6756C76.8472 17.1766 76.6301 17.4271 76.1291 17.4271H74.7263C74.2086 17.4271 73.9414 17.1766 74.0082 16.6756L75.4945 7.24013C75.5613 6.75583 75.8786 6.48863 76.3796 6.48863H76.5466C77.0476 6.48863 77.3315 6.75583 77.5486 7.24013L80.6047 13.8032L83.4938 7.24013C83.7109 6.75583 84.0115 6.48863 84.4958 6.48863H84.6795C85.1638 6.48863 85.4811 6.75583 85.5646 7.24013L87.0008 16.6756Z",fill:"black"}),t("path",{d:"M68.6496 17.6275C65.3096 17.6275 62.7211 15.2227 62.7211 11.9996C62.7211 8.77653 65.3096 6.37173 68.683 6.37173C70.3029 6.37173 71.7558 6.97293 72.7745 7.99163C73.1419 8.34233 73.1419 8.77653 72.7745 9.09383L71.9228 9.81193C71.5554 10.1292 71.2047 10.1125 70.8206 9.79523C70.2361 9.31093 69.5013 9.01033 68.683 9.01033C67.013 9.01033 65.7104 10.2628 65.7104 11.9996C65.7104 13.7364 67.013 14.9889 68.683 14.9889C69.5013 14.9889 70.2528 14.6883 70.8206 14.204C71.2047 13.8867 71.5554 13.87 71.9228 14.1873L72.7745 14.9054C73.1419 15.2227 73.1419 15.6569 72.7745 16.0076C71.7558 17.0263 70.3029 17.6275 68.6496 17.6275Z",fill:"black"}),t("path",{d:"M58.575 16.2915C58.7587 16.6923 58.4581 16.8927 58.241 17.0597C57.7233 17.4271 56.9384 17.6442 56.1201 17.6442C54.4501 17.6442 52.8469 16.6923 52.8469 14.4044V11.0978H52.1121C51.6111 11.0978 51.3439 10.8139 51.3439 10.3296V9.76183C51.3439 9.26083 51.6111 8.99363 52.1121 8.99363H52.8469V7.05643C52.8469 6.57213 53.1308 6.38843 53.6151 6.28823L54.9511 6.05443C55.4521 5.95423 55.7193 6.30493 55.7193 6.80593V8.99363H57.3726C57.8569 8.99363 58.1408 9.26083 58.1408 9.76183V10.3296C58.1408 10.8139 57.8569 11.0978 57.3726 11.0978H55.7193V14.1038C55.7193 14.9221 56.1368 15.1893 56.6545 15.1893C56.905 15.1893 57.1555 15.0724 57.3392 14.9555C57.7567 14.6883 57.9571 14.8887 58.1074 15.206L58.575 16.2915Z",fill:"black"}),t("path",{d:"M46.2592 17.6442C43.5538 17.6442 41.5999 15.7738 41.5999 13.2521C41.5999 10.7304 43.5538 8.86003 46.2592 8.86003C48.9646 8.86003 50.9185 10.7304 50.9185 13.2521C50.9185 15.7738 48.9646 17.6442 46.2592 17.6442ZM46.2592 15.1726C47.3113 15.1726 48.0628 14.3543 48.0628 13.2521C48.0628 12.1499 47.3113 11.3316 46.2592 11.3316C45.2071 11.3316 44.4389 12.1499 44.4389 13.2521C44.4389 14.3543 45.2071 15.1726 46.2592 15.1726Z",fill:"black"}),t("path",{d:"M36.052 17.6442C33.3466 17.6442 31.3927 15.7738 31.3927 13.2521C31.3927 10.7304 33.3466 8.86003 36.052 8.86003C38.7574 8.86003 40.7113 10.7304 40.7113 13.2521C40.7113 15.7738 38.7574 17.6442 36.052 17.6442ZM36.052 15.1726C37.1041 15.1726 37.8556 14.3543 37.8556 13.2521C37.8556 12.1499 37.1041 11.3316 36.052 11.3316C34.9999 11.3316 34.2317 12.1499 34.2317 13.2521C34.2317 14.3543 34.9999 15.1726 36.052 15.1726Z",fill:"black"}),t("path",{d:"M28.7099 13.0851L30.6805 16.6422C30.9644 17.1599 30.6638 17.4271 30.1628 17.4271H28.4594C27.9417 17.4271 27.8081 17.1766 27.5242 16.6589L25.7707 13.4859H24.6351V16.6422C24.6351 17.1432 24.3512 17.4271 23.8502 17.4271H22.4808C21.9798 17.4271 21.6959 17.1432 21.6959 16.6422V7.35703C21.6959 6.85603 21.9798 6.57213 22.4808 6.57213H26.5222C29.3111 6.57213 30.8141 7.92483 30.8141 10.1125C30.8141 11.5654 29.9791 12.5841 28.7099 13.0851ZM24.6351 8.96023V11.5153H26.4721C27.2236 11.5153 27.8248 11.0644 27.8248 10.2628C27.8248 9.44453 27.2236 8.96023 26.4721 8.96023H24.6351Z",fill:"black"})]}),t("defs",{children:t("clipPath",{id:"clip0_1_318",children:t("rect",{width:"99",height:"22",fill:"white",transform:"translate(0.0175781 0.177246)"})})})]})}x();function D(e){let[o,a]=C(!1);g(()=>{let c=navigator.userAgentData?.platform??navigator.platform;a(/mac/i.test(c||""))},[]);let s=()=>{W()};return t("button",{type:"button",className:d("SearchBar",e.className),onClick:s,"aria-label":"Open search",children:[t(P,{className:"SearchBar__icon",size:16,stroke:1.5}),t("span",{className:"SearchBar__placeholder",children:"Search"}),t("span",{className:"SearchBar__shortcut","aria-hidden":"true",children:o?"\u2318 + K":"Ctrl + K"})]})}var r="1.5";function i(e){return t("div",{className:"Layout",children:[t(i.Top,{}),t(i.Side,{}),t(i.Main,{...e,children:e.children}),t(i.Bottom,{})]})}function G(e){let a=e.split("?")[0].replace(/\/+$/g,"").split("/").filter(Boolean);return a.length===4&&a[0]==="cms"&&a[1]==="content"}i.Top=()=>{let e=window.__ROOT_CTX.rootConfig,o=e.projectName||e.projectId,a=e.minimalBranding,{url:s}=h(),c=!G(s);return t("div",{className:"Layout__top",children:[a?t(m,{children:[t("a",{className:"Layout__top__logo",href:"/cms",children:o}),t("a",{className:"Layout__top__version",href:"https://github.com/blinkk/rootjs/blob/main/packages/root-cms/CHANGELOG.md",target:"_blank",rel:"noreferrer noopener",children:["v",f.version]})]}):t(m,{children:[t("a",{className:"Layout__top__logo",href:"/cms",children:t(V,{})}),t("a",{className:"Layout__top__version",href:"https://github.com/blinkk/rootjs/blob/main/packages/root-cms/CHANGELOG.md",target:"_blank",rel:"noreferrer noopener",children:["v",f.version]}),t("div",{className:"Layout__top__project",children:o})]}),c&&t("div",{className:"Layout__top__search",children:t(D,{})})]})};i.Side=()=>{let{url:e}=h(),o=e.replace(/\/*$/g,""),a=window.firebase.user,s=window.__ROOT_CTX.sidebar?.tools,c=new Set(window.__ROOT_CTX.sidebar?.hiddenBuiltInTools||[]),n=u=>c.has(u),y=window.__ROOT_CTX.experiments||{},$=async()=>{await window.firebase.auth.signOut(),window.location.href="/cms/login"};return t("div",{className:"Layout__side",children:[t("div",{className:"Layout__side__buttons",children:[!n("home")&&t(i.SideButton,{label:"Home",url:"/cms",active:o==="/cms",children:t(I,{stroke:r})}),!n("content")&&t(i.SideButton,{label:"Content",url:"/cms/content",active:o.startsWith("/cms/content"),children:t(T,{stroke:r})}),y.taskManager&&t(i.SideButton,{label:"Tasks",url:"/cms/tasks",active:o.startsWith("/cms/tasks"),children:t(N,{stroke:r})}),!n("releases")&&t(i.SideButton,{label:"Releases",url:"/cms/releases",active:o.startsWith("/cms/releases"),children:t(Z,{stroke:r})}),!n("data")&&t(i.SideButton,{label:"Data",url:"/cms/data",active:o.startsWith("/cms/data"),children:t(M,{stroke:r})}),!n("assets")&&t(i.SideButton,{label:"Assets",url:"/cms/assets",active:o.startsWith("/cms/assets"),children:t(R,{stroke:r})}),!n("translations")&&t(i.SideButton,{label:"Translations",url:"/cms/translations",active:o.startsWith("/cms/translations"),children:t(H,{stroke:r})}),(y.ai||window.__ROOT_CTX.ai)&&!n("ai")&&t(i.SideButton,{label:"Root AI",url:"/cms/ai",active:o.startsWith("/cms/ai"),children:t(z,{stroke:r})}),s&&t(m,{children:[t("div",{className:"Layout__side__divider"}),Object.entries(s).map(([u,l])=>{let A=l.cmsUrl?.startsWith("/cms/")?l.cmsUrl:void 0,p=l.externalUrl,v=p??A??`/cms/tools/${u}`,_=p?void 0:v.replace(/\/*$/g,""),E=!p&&!!_&&(o===_||o.startsWith(`${_}/`));return t(i.SideButton,{className:"Layout__side__tool",label:l.label||"",url:v,active:E,external:!!p,children:l.icon?t("img",{className:"Layout__side__tool__icon",src:l.icon,alt:l.label||""}):t(j,{stroke:r})},u)}),t("div",{className:"Layout__side__divider"})]}),!n("settings")&&t(i.SideButton,{label:"Settings",url:"/cms/settings",active:o.startsWith("/cms/settings"),children:t(U,{stroke:r})})]}),t("div",{className:"Layout__side__user",children:t(b,{shadow:"md",position:"right",control:t(k,{children:t(S,{src:a.photoURL,alt:a.email,size:30,radius:"xl"})}),children:[t(b.Label,{children:t(L,{size:"xs",color:"dimmed",truncate:!0,children:["Signed in as ",a.email]})}),t(w,{}),t(b.Item,{color:"red",icon:t(O,{style:{width:14,height:14}}),onClick:$,children:"Sign out"})]})})]})};i.SideButton=e=>t(B,{className:d("Layout__side__button",e.className),label:e.label,position:"right",withArrow:!0,children:t("a",{className:d(e.active&&"active"),href:e.url,target:e.external?"_blank":void 0,rel:e.external?"noreferrer noopener":void 0,children:e.children})});i.Main=e=>t("div",{className:"Layout__main",children:e.children});i.Bottom=()=>t("div",{className:"Layout__bottom"});export{F as a,i as b};
|
|
1
|
+
import{d as h,f as d,g as W}from"./chunk-AL3TN2KI.js";import{$ as w,Ac as P,Dc as U,Eb as T,Ga as B,Ha as t,Nb as I,S as k,Sb as H,Y as L,Za as j,a as C,ba as S,c as g,cc as O,gb as N,j as x,nc as R,pb as M,ra as b,vc as z,wc as Z}from"./chunk-NZHF733K.js";import{d as m}from"./chunk-KUCVLANF.js";x();function F(e){g(()=>{let o=window.__ROOT_CTX?.rootConfig,a=o?.projectName||"Root CMS",s=o?.minimalBranding?a:`${a} \u2013 Root CMS`;document.title=e?`${e} \u2013 ${s}`:s},[e])}var f={name:"@blinkk/root-cms",version:"3.0.5",author:"s@blinkk.com",license:"MIT",engines:{node:">=22.0.0"},repository:{type:"git",url:"git+https://github.com/blinkk/rootjs.git",directory:"packages/root-cms"},files:["dist/**/*"],bin:{"root-cms":"./bin/root-cms.js"},type:"module",module:"./dist/core.js",types:"./dist/core/core.d.ts",exports:{".":{types:"./dist/core/core.d.ts",import:"./dist/core.js"},"./client":{types:"./dist/core/client.d.ts",import:"./dist/client.js"},"./core":{types:"./dist/core/core.d.ts",import:"./dist/core.js"},"./functions":{types:"./dist/core/functions.d.ts",import:"./dist/functions.js"},"./plugin":{types:"./dist/core/plugin.d.ts",import:"./dist/plugin.js"},"./project":{types:"./dist/core/project.d.ts",import:"./dist/project.js"},"./richtext":{types:"./dist/core/richtext.d.ts",import:"./dist/richtext.js"}},scripts:{build:'rm -rf dist && concurrently -n "core,signin,ui" npm:build:core npm:build:signin npm:build:ui',"build:core":"node ../../scripts/build-esbuild.mjs ./esbuild.config.json","build:ui":"pnpm build:ui:bundle && pnpm build:ui:clean","build:ui:bundle":"esbuild ui/ui.tsx --bundle --minify --alias:react=@preact/compat --alias:react-dom=@preact/compat --tsconfig=ui/tsconfig.json --outdir=dist/ui --legal-comments=external --splitting --format=esm","build:ui:clean":"rm -f dist/ui/*-*.css","build:signin":"esbuild signin/signin.tsx --bundle --minify --tsconfig=signin/tsconfig.json --outdir=dist/ui --legal-comments=external",dev:'rm -rf dist && concurrently -k -n "core,ui" npm:dev:core npm:dev:signin npm:dev:ui',"dev:core":"pnpm build:core --watch","dev:signin":"pnpm build:signin --watch","dev:ui":"pnpm build:ui:bundle --watch",test:"pnpm build && firebase emulators:exec 'vitest run --exclude=**/*.visual.test.tsx'","test:visual":"vitest run --config=vitest.config.visual.ts","test:watch":"pnpm build && firebase emulators:exec 'vitest'"},dependencies:{"@ag-grid-community/client-side-row-model":"32.3.9","@ag-grid-community/core":"32.3.9","@ag-grid-community/react":"32.3.9","@ag-grid-community/styles":"32.3.9","@ai-sdk/anthropic":"3.0.74","@ai-sdk/google":"3.0.67","@ai-sdk/openai":"3.0.60","@ai-sdk/openai-compatible":"2.0.46","@ai-sdk/react":"3.0.177",ai:"6.0.175",zod:"4.4.3","@google-cloud/firestore":"7.11.3","@hello-pangea/dnd":"18.0.1","@types/cli-progress":"3.11.6","body-parser":"1.20.2","cli-progress":"3.12.0",commander:"11.0.0","csv-parse":"5.5.2","csv-stringify":"6.4.4","date-fns":"4.1.0","date-fns-tz":"3.2.0",diff:"8.0.2","dts-dom":"3.7.0","@mantine/spotlight":"4.2.12","fnv-plus":"1.3.1",jsonwebtoken:"9.0.2",kleur:"4.1.5",minisearch:"7.2.0","sanitize-html":"2.13.1",sirv:"2.0.3","tiny-glob":"0.2.9"},"//":"NOTE(stevenle): due to compat issues with mantine and preact, mantine is pinned to v4.2.12",devDependencies:{"@babel/core":"7.17.9","@blinkk/root":"workspace:*","@editorjs/editorjs":"2.30.8","@editorjs/header":"2.8.8","@editorjs/image":"2.10.2","@editorjs/list":"2.0.6","@editorjs/nested-list":"1.4.3","@editorjs/raw":"2.5.1","@editorjs/table":"2.4.4","@editorjs/underline":"1.2.1","@emotion/react":"11.10.5","@firebase/app-compat":"0.5.2","@firebase/app-types":"0.9.3","@firebase/rules-unit-testing":"5.0.0","@lexical/code":"0.33.1","@lexical/html":"0.33.1","@lexical/link":"0.33.1","@lexical/list":"0.33.1","@lexical/markdown":"0.33.1","@lexical/react":"0.33.1","@lexical/rich-text":"0.33.1","@lexical/selection":"0.33.1","@lexical/table":"0.33.1","@lexical/utils":"0.33.1","@mantine/core":"4.2.12","@mantine/hooks":"4.2.12","@mantine/modals":"4.2.12","@mantine/notifications":"4.2.12","@preact/compat":"18.3.1","@tabler/icons-preact":"3.35.0","@testing-library/preact":"3.2.4","@testing-library/user-event":"14.6.1","@types/body-parser":"1.19.3","@types/fnv-plus":"1.3.2","@types/gapi":"0.0.47","@types/gapi.client.drive-v3":"0.0.4","@types/gapi.client.sheets-v4":"0.0.4","@types/google.accounts":"0.0.14","@types/jsonwebtoken":"9.0.1","@types/node":"24.3.1","@types/sanitize-html":"2.13.0","@vitest/browser":"4.1.6","@vitest/browser-playwright":"4.1.6",concurrently:"7.6.0",esbuild:"0.28.0",firebase:"12.2.1","firebase-admin":"13.5.0","firebase-functions":"6.4.0","firebase-tools":"14.15.2","highlight.js":"11.6.0",jsdom:"27.2.0","json-diff-kit":"1.0.29",lexical:"0.33.1",marked:"9.1.1","mdast-util-from-markdown":"2.0.1","mdast-util-gfm":"3.0.0","micromark-extension-gfm":"3.0.0",playwright:"1.56.1",preact:"10.27.1","preact-iso":"2.11.1","preact-render-to-string":"6.6.7",react:"npm:@preact/compat@18.3.1","react-dom":"npm:@preact/compat@18.3.1","react-easy-crop":"5.5.6","react-json-view-compare":"2.0.2",typescript:"6.0.3",vite:"8.0.13",vitest:"4.1.6",yjs:"13.6.27"},peerDependencies:{"@blinkk/root":"3.0.5","firebase-admin":">=11","firebase-functions":">=4"},peerDependenciesMeta:{"firebase-functions":{optional:!0}}};function V(){return t("svg",{width:"100",height:"23",viewBox:"0 0 100 23",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t("g",{"clip-path":"url(#clip0_1_318)",children:[t("path",{d:"M7.82998 5.01802C3.12925 5.6479 0.833937 18.1194 2.62578 19.6731C5.64773 22.2934 16.6441 14.1722 15.6786 9.46913C15.3009 6.61371 11.2717 4.28377 7.82998 5.01802Z",fill:"black"}),t("path",{d:"M13.9782 0.720147C12.6553 0.896474 12.0093 4.38767 12.5136 4.8226C13.364 5.55611 16.4587 3.28271 16.187 1.96616C16.0807 1.16683 14.9468 0.514607 13.9782 0.720147Z",fill:"black"}),t("path",{d:"M92.7383 17.6275C90.9681 17.6275 89.3816 17.0263 88.3796 16.0744C87.9955 15.7237 87.8953 15.3396 88.246 14.9555L88.8305 14.2541C89.1645 13.87 89.5486 13.7865 89.9327 14.1205C90.6007 14.6883 91.7029 15.1726 92.5713 15.1726C93.5232 15.1726 94.1244 14.8219 94.1244 14.2875C94.1244 13.5193 93.2059 13.4358 91.9868 13.0684C90.417 12.6008 88.5132 11.7324 88.5132 9.64493C88.5132 7.70773 90.25 6.37173 92.7383 6.37173C94.2413 6.37173 95.5272 6.87273 96.4123 7.57413C96.8131 7.90813 96.9467 8.27553 96.596 8.67633L96.0282 9.37773C95.7109 9.76183 95.3435 9.82863 94.926 9.51133C94.3916 9.09383 93.6568 8.69303 92.7884 8.69303C92.0202 8.69303 91.5192 9.01033 91.5192 9.51133C91.5192 10.1292 92.3041 10.4131 93.1224 10.6636C94.9761 11.2314 97.1304 11.8326 97.1304 14.2708C97.1304 16.4585 95.1264 17.6275 92.7383 17.6275Z",fill:"black"}),t("path",{d:"M87.0008 16.6756C87.0843 17.1766 86.8171 17.4271 86.2994 17.4271H85.097C84.596 17.4271 84.3789 17.1766 84.3121 16.6756L83.7443 11.9161L81.757 16.7424C81.5399 17.2434 81.1892 17.5106 80.6882 17.5106H80.5212C80.0202 17.5106 79.6695 17.2434 79.4524 16.7424L77.4651 11.8994L76.8973 16.6756C76.8472 17.1766 76.6301 17.4271 76.1291 17.4271H74.7263C74.2086 17.4271 73.9414 17.1766 74.0082 16.6756L75.4945 7.24013C75.5613 6.75583 75.8786 6.48863 76.3796 6.48863H76.5466C77.0476 6.48863 77.3315 6.75583 77.5486 7.24013L80.6047 13.8032L83.4938 7.24013C83.7109 6.75583 84.0115 6.48863 84.4958 6.48863H84.6795C85.1638 6.48863 85.4811 6.75583 85.5646 7.24013L87.0008 16.6756Z",fill:"black"}),t("path",{d:"M68.6496 17.6275C65.3096 17.6275 62.7211 15.2227 62.7211 11.9996C62.7211 8.77653 65.3096 6.37173 68.683 6.37173C70.3029 6.37173 71.7558 6.97293 72.7745 7.99163C73.1419 8.34233 73.1419 8.77653 72.7745 9.09383L71.9228 9.81193C71.5554 10.1292 71.2047 10.1125 70.8206 9.79523C70.2361 9.31093 69.5013 9.01033 68.683 9.01033C67.013 9.01033 65.7104 10.2628 65.7104 11.9996C65.7104 13.7364 67.013 14.9889 68.683 14.9889C69.5013 14.9889 70.2528 14.6883 70.8206 14.204C71.2047 13.8867 71.5554 13.87 71.9228 14.1873L72.7745 14.9054C73.1419 15.2227 73.1419 15.6569 72.7745 16.0076C71.7558 17.0263 70.3029 17.6275 68.6496 17.6275Z",fill:"black"}),t("path",{d:"M58.575 16.2915C58.7587 16.6923 58.4581 16.8927 58.241 17.0597C57.7233 17.4271 56.9384 17.6442 56.1201 17.6442C54.4501 17.6442 52.8469 16.6923 52.8469 14.4044V11.0978H52.1121C51.6111 11.0978 51.3439 10.8139 51.3439 10.3296V9.76183C51.3439 9.26083 51.6111 8.99363 52.1121 8.99363H52.8469V7.05643C52.8469 6.57213 53.1308 6.38843 53.6151 6.28823L54.9511 6.05443C55.4521 5.95423 55.7193 6.30493 55.7193 6.80593V8.99363H57.3726C57.8569 8.99363 58.1408 9.26083 58.1408 9.76183V10.3296C58.1408 10.8139 57.8569 11.0978 57.3726 11.0978H55.7193V14.1038C55.7193 14.9221 56.1368 15.1893 56.6545 15.1893C56.905 15.1893 57.1555 15.0724 57.3392 14.9555C57.7567 14.6883 57.9571 14.8887 58.1074 15.206L58.575 16.2915Z",fill:"black"}),t("path",{d:"M46.2592 17.6442C43.5538 17.6442 41.5999 15.7738 41.5999 13.2521C41.5999 10.7304 43.5538 8.86003 46.2592 8.86003C48.9646 8.86003 50.9185 10.7304 50.9185 13.2521C50.9185 15.7738 48.9646 17.6442 46.2592 17.6442ZM46.2592 15.1726C47.3113 15.1726 48.0628 14.3543 48.0628 13.2521C48.0628 12.1499 47.3113 11.3316 46.2592 11.3316C45.2071 11.3316 44.4389 12.1499 44.4389 13.2521C44.4389 14.3543 45.2071 15.1726 46.2592 15.1726Z",fill:"black"}),t("path",{d:"M36.052 17.6442C33.3466 17.6442 31.3927 15.7738 31.3927 13.2521C31.3927 10.7304 33.3466 8.86003 36.052 8.86003C38.7574 8.86003 40.7113 10.7304 40.7113 13.2521C40.7113 15.7738 38.7574 17.6442 36.052 17.6442ZM36.052 15.1726C37.1041 15.1726 37.8556 14.3543 37.8556 13.2521C37.8556 12.1499 37.1041 11.3316 36.052 11.3316C34.9999 11.3316 34.2317 12.1499 34.2317 13.2521C34.2317 14.3543 34.9999 15.1726 36.052 15.1726Z",fill:"black"}),t("path",{d:"M28.7099 13.0851L30.6805 16.6422C30.9644 17.1599 30.6638 17.4271 30.1628 17.4271H28.4594C27.9417 17.4271 27.8081 17.1766 27.5242 16.6589L25.7707 13.4859H24.6351V16.6422C24.6351 17.1432 24.3512 17.4271 23.8502 17.4271H22.4808C21.9798 17.4271 21.6959 17.1432 21.6959 16.6422V7.35703C21.6959 6.85603 21.9798 6.57213 22.4808 6.57213H26.5222C29.3111 6.57213 30.8141 7.92483 30.8141 10.1125C30.8141 11.5654 29.9791 12.5841 28.7099 13.0851ZM24.6351 8.96023V11.5153H26.4721C27.2236 11.5153 27.8248 11.0644 27.8248 10.2628C27.8248 9.44453 27.2236 8.96023 26.4721 8.96023H24.6351Z",fill:"black"})]}),t("defs",{children:t("clipPath",{id:"clip0_1_318",children:t("rect",{width:"99",height:"22",fill:"white",transform:"translate(0.0175781 0.177246)"})})})]})}x();function D(e){let[o,a]=C(!1);g(()=>{let c=navigator.userAgentData?.platform??navigator.platform;a(/mac/i.test(c||""))},[]);let s=()=>{W()};return t("button",{type:"button",className:d("SearchBar",e.className),onClick:s,"aria-label":"Open search",children:[t(P,{className:"SearchBar__icon",size:16,stroke:1.5}),t("span",{className:"SearchBar__placeholder",children:"Search"}),t("span",{className:"SearchBar__shortcut","aria-hidden":"true",children:o?"\u2318 + K":"Ctrl + K"})]})}var r="1.5";function i(e){return t("div",{className:"Layout",children:[t(i.Top,{}),t(i.Side,{}),t(i.Main,{...e,children:e.children}),t(i.Bottom,{})]})}function G(e){let a=e.split("?")[0].replace(/\/+$/g,"").split("/").filter(Boolean);return a.length===4&&a[0]==="cms"&&a[1]==="content"}i.Top=()=>{let e=window.__ROOT_CTX.rootConfig,o=e.projectName||e.projectId,a=e.minimalBranding,{url:s}=h(),c=!G(s);return t("div",{className:"Layout__top",children:[a?t(m,{children:[t("a",{className:"Layout__top__logo",href:"/cms",children:o}),t("a",{className:"Layout__top__version",href:"https://github.com/blinkk/rootjs/blob/main/packages/root-cms/CHANGELOG.md",target:"_blank",rel:"noreferrer noopener",children:["v",f.version]})]}):t(m,{children:[t("a",{className:"Layout__top__logo",href:"/cms",children:t(V,{})}),t("a",{className:"Layout__top__version",href:"https://github.com/blinkk/rootjs/blob/main/packages/root-cms/CHANGELOG.md",target:"_blank",rel:"noreferrer noopener",children:["v",f.version]}),t("div",{className:"Layout__top__project",children:o})]}),c&&t("div",{className:"Layout__top__search",children:t(D,{})})]})};i.Side=()=>{let{url:e}=h(),o=e.replace(/\/*$/g,""),a=window.firebase.user,s=window.__ROOT_CTX.sidebar?.tools,c=new Set(window.__ROOT_CTX.sidebar?.hiddenBuiltInTools||[]),n=u=>c.has(u),y=window.__ROOT_CTX.experiments||{},$=async()=>{await window.firebase.auth.signOut(),window.location.href="/cms/login"};return t("div",{className:"Layout__side",children:[t("div",{className:"Layout__side__buttons",children:[!n("home")&&t(i.SideButton,{label:"Home",url:"/cms",active:o==="/cms",children:t(I,{stroke:r})}),!n("content")&&t(i.SideButton,{label:"Content",url:"/cms/content",active:o.startsWith("/cms/content"),children:t(T,{stroke:r})}),y.taskManager&&t(i.SideButton,{label:"Tasks",url:"/cms/tasks",active:o.startsWith("/cms/tasks"),children:t(N,{stroke:r})}),!n("releases")&&t(i.SideButton,{label:"Releases",url:"/cms/releases",active:o.startsWith("/cms/releases"),children:t(Z,{stroke:r})}),!n("data")&&t(i.SideButton,{label:"Data",url:"/cms/data",active:o.startsWith("/cms/data"),children:t(M,{stroke:r})}),!n("assets")&&t(i.SideButton,{label:"Assets",url:"/cms/assets",active:o.startsWith("/cms/assets"),children:t(R,{stroke:r})}),!n("translations")&&t(i.SideButton,{label:"Translations",url:"/cms/translations",active:o.startsWith("/cms/translations"),children:t(H,{stroke:r})}),(y.ai||window.__ROOT_CTX.ai)&&!n("ai")&&t(i.SideButton,{label:"Root AI",url:"/cms/ai",active:o.startsWith("/cms/ai"),children:t(z,{stroke:r})}),s&&t(m,{children:[t("div",{className:"Layout__side__divider"}),Object.entries(s).map(([u,l])=>{let A=l.cmsUrl?.startsWith("/cms/")?l.cmsUrl:void 0,p=l.externalUrl,v=p??A??`/cms/tools/${u}`,_=p?void 0:v.replace(/\/*$/g,""),E=!p&&!!_&&(o===_||o.startsWith(`${_}/`));return t(i.SideButton,{className:"Layout__side__tool",label:l.label||"",url:v,active:E,external:!!p,children:l.icon?t("img",{className:"Layout__side__tool__icon",src:l.icon,alt:l.label||""}):t(j,{stroke:r})},u)}),t("div",{className:"Layout__side__divider"})]}),!n("settings")&&t(i.SideButton,{label:"Settings",url:"/cms/settings",active:o.startsWith("/cms/settings"),children:t(U,{stroke:r})})]}),t("div",{className:"Layout__side__user",children:t(b,{shadow:"md",position:"right",control:t(k,{children:t(S,{src:a.photoURL,alt:a.email,size:30,radius:"xl"})}),children:[t(b.Label,{children:t(L,{size:"xs",color:"dimmed",truncate:!0,children:["Signed in as ",a.email]})}),t(w,{}),t(b.Item,{color:"red",icon:t(O,{style:{width:14,height:14}}),onClick:$,children:"Sign out"})]})})]})};i.SideButton=e=>t(B,{className:d("Layout__side__button",e.className),label:e.label,position:"right",withArrow:!0,children:t("a",{className:d(e.active&&"active"),href:e.url,target:e.external?"_blank":void 0,rel:e.external?"noreferrer noopener":void 0,children:e.children})});i.Main=e=>t("div",{className:"Layout__main",children:e.children});i.Bottom=()=>t("div",{className:"Layout__bottom"});export{F as a,i as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as Xe}from"./chunk-NXQVLOTK.js";import{f as He}from"./chunk-3IYZCUPI.js";import{a as Le,b as $e,d as Ve,i as Se}from"./chunk-RSVO46S3.js";import{a as Ke,b as eo}from"./chunk-ONTGW2VA.js";import{a as Je}from"./chunk-L4RHGQUG.js";import{a as N,c as H}from"./chunk-HRGYNHZ3.js";import{a as _e,b as ge,c as ae}from"./chunk-JDW4UORS.js";import{d as ye,h as ve,i as xe,j as Ce,k as Ie,l as le,m as ke,n as Ae,o as we,p as De,q as Te,r as Re,s as Pe,v as de,w as Ne,x as ze}from"./chunk-AFWBSIPL.js";import{b as be,e as Me}from"./chunk-XOQ3KDSR.js";import{b as U}from"./chunk-62UWGWON.js";import{a as _,b as F}from"./chunk-I6ICVKEC.js";import{a as M}from"./chunk-HLMBCVRX.js";import{e as he}from"./chunk-ORXEMIQC.js";import{d as fe}from"./chunk-AL3TN2KI.js";import{Ea as pe,Ha as e,Ia as Ee,La as Ue,Ma as Be,Mb as je,Oa as Oe,Pc as Ge,Ra as Fe,V as J,W as Q,a as c,aa as ue,ac as Y,bc as ee,c as j,e as ce,ea as b,fa as ie,gc as Qe,ic as Ye,j as X,jb as qe,mb as K,ra as P,ub as We,va as me,wc as Ze,ya as ne}from"./chunk-NZHF733K.js";import{d as S}from"./chunk-KUCVLANF.js";X();var oo="AddToReleaseModal";function so(s){let t=N(),u=H();return{open:()=>{t.openContextModal(oo,{...u,title:"Add docs to a release",innerProps:s,size:"600px"})}}}function mo(s){let{innerProps:t,context:u,id:l}=s,d=N(),[o,y]=c(""),[p,v]=c(!1),[m,k]=c(!1),[g,A]=c([]),[a,D]=c(""),[x,T]=c(Se()),[w,f]=c("");j(()=>{async function n(){v(!0),await U(async()=>{let E=(await $e()).filter(R=>!R.publishedAt&&!R.archivedAt);A(E)}),v(!1)}n()},[]);async function I(){o==="new"?await L():o==="existing"&&await $()}async function L(){if(!x){_({title:"Missing ID",message:"Please enter a release ID.",color:"red",autoClose:5e3});return}if(!_e(x)){_({title:"Invalid ID",message:"Release ID must use alphanumeric characters and dashes only.",color:"red",autoClose:5e3});return}k(!0),await U(async()=>{let n={docIds:t.docIds};w&&(n.description=w),await Le(x,n),_({title:`Release created: ${x}`,message:e("span",{children:["Created release with ",t.docIds.length," doc(s)."," ",e("a",{href:`/cms/releases/${x}`,children:"View release"})]}),autoClose:1e4}),d.closeAll()}),k(!1)}async function $(){if(!a){_({title:"No release selected",message:"Please select a release.",color:"red",autoClose:5e3});return}k(!0),await U(async()=>{let C=g.find(z=>z.id===a)?.docIds||[],E=Array.from(new Set([...C,...t.docIds])).sort();await Ve(a,{docIds:E});let R=E.length-C.length;_({title:`Docs added to release: ${a}`,message:e("span",{children:["Added ",R," new doc(s) to release."," ",e("a",{href:`/cms/releases/${a}`,children:"View release"})]}),autoClose:1e4}),d.closeAll()}),k(!1)}let r=!0;return(o==="new"&&x||o==="existing"&&a)&&(r=!1),e("div",{className:"AddToReleaseModal",children:e("div",{className:"AddToReleaseModal__content",children:[e("div",{className:"AddToReleaseModal__docs",children:[e("div",{className:"AddToReleaseModal__docs__label",children:["Docs to add (",t.docIds.length,")"]}),e("div",{className:"AddToReleaseModal__docs__list",children:t.docIds.map(n=>e(He,{docId:n,variant:"compact",statusBadges:!0},n))})]}),e("div",{className:"AddToReleaseModal__mode",children:[e("label",{className:`AddToReleaseModal__mode__option${o==="new"?" AddToReleaseModal__mode__option--selected":o?" AddToReleaseModal__mode__option--unselected":""}`,children:[e("div",{className:"AddToReleaseModal__mode__option__input",children:[e("input",{type:"radio",name:"release-mode",value:"new",checked:o==="new",onChange:()=>y("new")})," ","New release"]}),e("div",{className:"AddToReleaseModal__mode__option__help",children:"Create a new release with these docs."})]}),e("label",{className:`AddToReleaseModal__mode__option${o==="existing"?" AddToReleaseModal__mode__option--selected":o?" AddToReleaseModal__mode__option--unselected":""}`,children:[e("div",{className:"AddToReleaseModal__mode__option__input",children:[e("input",{type:"radio",name:"release-mode",value:"existing",checked:o==="existing",onChange:()=>y("existing")})," ","Existing release"]}),e("div",{className:"AddToReleaseModal__mode__option__help",children:"Add to an existing release."})]})]}),o==="new"&&e("div",{className:"AddToReleaseModal__form",children:[e("div",{className:"AddToReleaseModal__form__field",children:[e("label",{children:"Release ID"}),e("input",{type:"text",placeholder:"e.g. my-release",value:x,onInput:n=>{T(n.target.value)}})]}),e("div",{className:"AddToReleaseModal__form__field",children:[e("label",{children:"Description (optional)"}),e("textarea",{rows:2,placeholder:"Describe this release",value:w,onInput:n=>{f(n.target.value)}})]})]}),o==="existing"&&e("div",{className:"AddToReleaseModal__releases",children:p?e("div",{className:"AddToReleaseModal__releases__empty",children:e(J,{color:"gray",size:"sm"})}):g.length===0?e("div",{className:"AddToReleaseModal__releases__empty",children:"No unpublished releases found. Create a new one instead."}):g.map(n=>e("div",{className:`AddToReleaseModal__release${a===n.id?" AddToReleaseModal__release--selected":""}`,onClick:()=>D(n.id),children:[e("input",{type:"radio",name:"existing-release",checked:a===n.id,onChange:()=>D(n.id)}),e("div",{className:"AddToReleaseModal__release__info",children:[e("div",{className:"AddToReleaseModal__release__info__id",children:n.id}),n.description&&e("div",{className:"AddToReleaseModal__release__info__description",children:n.description})]}),e("div",{className:"AddToReleaseModal__release__docCount",children:[n.docIds?.length||0," doc(s)"]})]},n.id))}),e("div",{className:"AddToReleaseModal__buttons",children:[e(b,{variant:"outline",onClick:()=>u.closeModal(l),type:"button",size:"xs",color:"dark",children:"Cancel"}),e(b,{variant:"filled",size:"xs",color:"dark",disabled:r,loading:m,onClick:I,children:o==="new"?"Create release":"Add to release"})]})]})})}mo.id=oo;X();var to="CopyDocModal";function oe(s){let t=N(),u=H();return{open:l=>{t.openContextModal(to,{...u,innerProps:{...s,...l}})}}}function po(s){let{innerProps:t,context:u,id:l}=s,{route:d}=fe(),[o,y]=c(""),[p,v]=c(""),[m,k]=c(""),[g,A]=c(""),[a,D]=c(!1),[x,T]=c(!1),[w,f]=c({}),I=t.fromDocId,L=I.split("/")[0],$=t.fromLabel||I;j(()=>{be({tags:[I]}).then(f)},[I]);function r(C,E){let R=ae(C),z=window.__ROOT_CTX.collections[E]?.slugRegex;return R?ge(R,z):""}async function n(C){if(C.preventDefault(),T(!0),A(""),!L){A("Please select a collection."),T(!1);return}if(r(p,o)){T(!1);return}let R=ae(p),z=`${o}/${R}`;try{t.fields?await Pe(z,{fields:t.fields,overwrite:a}):await Re(I,z,{overwrite:a});let O=Object.keys(w);if(O.length>0){let i=O.map(h=>({hash:h,tags:[z]}));await Me(i,{mode:"union"})}u.closeModal(l);let q=`/cms/content/${o}/${R}`;_({title:"Copied!",message:e("div",{children:[e("div",{children:`Successfully copied ${$} to ${z}.`}),e(b,{className:"CopyDocModal__notificationButton",component:"a",href:q,size:"xs",compact:!0,variant:"default",children:"Open doc"})]}),autoClose:1e4}),t.onSuccess&&t.onSuccess(z)}catch(O){let q=String(O);A(q),q.includes("already exists")&&D(!0),T(!1);return}T(!1),d(`/cms/content/${o}/${R}`)}return e("div",{className:"CopyDocModal",children:e("form",{onSubmit:C=>n(C),children:[e("div",{className:"CopyDocModal__from",children:[e(M,{className:"CopyDocModal__from__label",size:"body",weight:"bold",children:"From:"}),e(M,{className:"CopyDocModal__from__value",size:"body-sm",children:e("code",{children:$})})]}),e("div",{className:"CopyDocModal__to",children:[e(M,{className:"CopyDocModal__to__label",size:"body",weight:"bold",children:"To:"}),e(Xe,{className:"CopyDocModal__slug",collectionId:L,onChange:C=>{y(C.collectionId),v(C.slug),k(r(C.slug,C.collectionId)),A(""),D(!1)}})]}),g&&e("div",{className:"CopyDocModal__error",children:g}),e("div",{className:"CopyDocModal__buttons",children:[e(b,{variant:"outline",onClick:()=>u.closeModal(l),type:"button",size:"xs",color:"dark",children:"Cancel"}),e(b,{variant:"filled",type:"submit",size:"xs",color:"dark",loading:x,disabled:!!m||!!g&&!a,children:a?"Overwrite?":"Submit"})]})]})})}po.id=to;X();function B(s){return e("div",{className:"DocIdBadge",children:e("code",{"data-testid":"doc-id",children:s.docId})})}var io="LockPublishingModal";function no(s){let t=N(),u=H();return{open:l=>{let d={...s,...l},o;d.unlock?o=`Unlock publishing for ${s.docId}`:d.existingLock?o=`Edit publishing lock for ${s.docId}`:o=`Lock publishing for ${s.docId}`,t.openContextModal(io,{...u,title:o,innerProps:{...s,...l},size:"600px"})}}}function fo(s){let t=l=>l<10?"0"+l:l,u=new Date(s);return`${u.getFullYear()}-${t(u.getMonth()+1)}-${t(u.getDate())}T${t(u.getHours())}:${t(u.getMinutes())}`}function Z(s){let{innerProps:t}=s;return t.unlock?e(Z.Unlock,{...s}):e(Z.Lock,{...s})}Z.Lock=s=>{let{innerProps:t,context:u,id:l}=s,d=!!t.existingLock,[o,y]=c(t.existingLock?.reason||""),[p,v]=c(t.existingLock?.until||0),[m,k]=c(!1),[g,A]=c(!1),a=N();function D(f){return f?Math.floor(new Date(f).getTime()):0}async function x(f){f.preventDefault(),k(!0),await U(async()=>{await Ie(t.docId,{reason:o,until:p}),_({title:d?"Updated!":"Locked!",message:d?`Publishing lock updated for ${t.docId}.`:`Publishing is locked for ${t.docId}.`,autoClose:1e4}),a.closeModal(l),t.onChange&&t.onChange("locked")}),k(!1)}async function T(){A(!0),await U(async()=>{await le(t.docId),_({title:"Unlocked!",message:`Publishing is unlocked for ${t.docId}.`,autoClose:1e4}),a.closeModal(l),t.onChange&&t.onChange("unlocked")}),A(!1)}return e("div",{className:"LockPublishingModal LockPublishingModal--lock",children:[e(M,{className:"LockPublishingModal__body",size:"body-sm",children:d?"Publishing is currently locked. Update the publishing lock details below, or remove the lock to re\u2011enable publishing.":"Are you sure you want to lock publishing? Content editors will not be able to publish until publishing is unlocked."}),e("form",{className:"LockPublishingModal__form",onSubmit:f=>x(f),children:[e("div",{className:"LockPublishingModal__form__section",children:e(me,{name:"reason",label:"Reason",description:"Specify a short reason so other content editors know why publishing is locked.",size:"xs",radius:0,value:o,onChange:f=>{y(f.currentTarget.value)}})}),e("div",{className:"LockPublishingModal__form__section",children:e(ue,{label:"Lock until",description:"Optional. Publishing is unlocked at the specified time. If not provided, publishing will be locked indefinitely.",size:"xs",children:e("div",{className:"DocEditor__DateTimeField",children:[e("input",{name:"until",type:"datetime-local",min:he(),defaultValue:p?fo(p):"",onChange:f=>{let L=f.target.value;v(D(L))}}),e("div",{className:"DocEditor__DateTimeField__timezone",children:["timezone: ",Intl.DateTimeFormat().resolvedOptions().timeZone]})]})})}),e("div",{className:"LockPublishingModal__buttons",children:[d&&e(b,{variant:"filled",size:"xs",color:"red",type:"button",leftIcon:e(Y,{size:14}),loading:g,disabled:m,onClick:()=>T(),className:"LockPublishingModal__buttons__unlock",children:"Unlock"}),e(b,{variant:"outline",onClick:()=>u.closeModal(l),type:"button",size:"xs",color:"dark",children:"Cancel"}),e(b,{variant:"filled",size:"xs",color:"dark",leftIcon:e(ee,{size:14}),disabled:!o||g,type:"submit",loading:m,children:d?"Save":"Lock"})]})]})]})};Z.Unlock=s=>{let{innerProps:t,context:u,id:l}=s,[d,o]=c(!1),y=N();async function p(){o(!0),await U(async()=>{await le(t.docId),_({title:"Unlocked!",message:`Publishing is unlocked for ${t.docId}.`,autoClose:1e4}),y.closeModal(l),t.onChange&&t.onChange("unlocked")})}return e("div",{className:"LockPublishingModal LockPublishingModal--unlock",children:[e(M,{className:"LockPublishingModal__body",children:"Are you sure you want to unlock publishing for the following doc? This will re-enable content editors to publish the doc."}),e(B,{docId:t.docId}),e("div",{className:"LockPublishingModal__buttons",children:[e(b,{variant:"outline",onClick:()=>u.closeModal(l),type:"button",size:"xs",color:"dark",children:"Cancel"}),e(b,{variant:"filled",size:"xs",color:"dark",leftIcon:e(Y,{size:14}),loading:d,onClick:()=>p(),children:"Unlock"})]})]})};Z.id=io;X();var ro="VersionHistoryModal",ao=50;function co(s){let t=N(),u=H();return{open:()=>{t.openContextModal(ro,{...u,title:`Version history: ${s.docId}`,innerProps:s,overflow:"inside",size:"min(calc(100% - 32px), 720px)"})}}}function _o(s){let{innerProps:t,context:u,id:l}=s,d=t.docId,[o,y]=c(!0),[p,v]=c(!1),[m,k]=c([]),[g,A]=c(!1),[a,D]=c([]),[x,T]=c(!1),[w,f]=c(null),I=ce(null),L=oe({fromDocId:d}),$=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});async function r(){y(!0);let[i,h]=await Promise.all([de(d,{limit:ao}),ze(d,"draft")]);I.current=i.lastDoc,A(i.hasMore);let V={_versionId:"draft",sys:{modifiedAt:h?.sys?.modifiedAt||{toDate:()=>new Date},modifiedBy:h?.sys?.modifiedBy||"Unknown"}};k([V,...i.versions]),D(["draft"]),y(!1)}async function n(){if(!g||p)return;v(!0);let i=await de(d,{limit:ao,cursor:I.current});I.current=i.lastDoc,A(i.hasMore),k(h=>[...h,...i.versions]),v(!1)}async function C(i){await Ne(d,i),_({title:"Saved!",message:`Restored ${d} to ${$.format(i.sys.modifiedAt.toDate())}.`,autoClose:5e3}),t.onRestore&&t.onRestore({version:i})}function E(i){let h=`${d}@${i._versionId}`,V=i.sys?.modifiedAt?.toDate();if(V){let W=go(V);h=`${d}@${W}`}L.open({fields:i.fields||{},fromLabel:h,onSuccess:()=>{u.closeModal(l)}})}function R(i){a.includes(i)?D(a.filter(h=>h!==i)):a.length<2&&D([...a,i])}function z(){if(a.length!==2)return"#";let i=m.find(te=>te._versionId===a[0]),h=m.find(te=>te._versionId===a[1]);if(!i||!h)return"#";let V=m.indexOf(i),W=m.indexOf(h),re=V>W?i:h,G=V>W?h:i,se=lo(d,re._versionId),uo=lo(d,G._versionId);return`/cms/compare?left=${se}&right=${uo}`}j(()=>{r()},[]);let O=m.filter(i=>i._versionId==="draft"||!x?!0:i.tags?.includes("published")),q=m.some(i=>i.tags?.includes("published"));return o?e(J,{}):e("div",{className:"VersionHistoryModal",children:[e("div",{className:"VersionHistoryModal__actions",children:[e(b,{component:a.length===2?"a":"button",variant:"filled",size:"xs",disabled:a.length!==2,href:a.length===2?z():void 0,target:a.length===2?"_blank":void 0,rightIcon:e(Fe,{size:16}),children:"Compare"}),q&&e(ie,{size:"xs",label:"Published versions only",checked:x,onChange:i=>T(i.currentTarget.checked)})]}),O.length===0?e(M,{className:"VersionHistoryModal__versionsEmpty",size:"body",children:[e("p",{children:"No versions found."}),e("p",{className:"VersionHistoryModal__versionsEmpty__developer",children:"For developers: Configure the Root CMS cron job to populate versions."})]}):e(S,{children:[e(pe,{className:"VersionHistoryModal__versions",children:[e("thead",{children:e("tr",{children:[e("th",{children:e("span",{className:"VersionHistoryModal__versions__selectLabel",children:"Select"})}),e("th",{children:"modified at"}),e("th",{children:"modified by"}),e("th",{children:"actions"})]})}),e("tbody",{children:O.map(i=>{let h=i._versionId==="draft",V=a.includes(i._versionId),W=!V&&a.length>=2;return e("tr",{children:[e("td",{children:e(ie,{size:"xs",checked:V,disabled:W,onChange:()=>R(i._versionId),className:"VersionHistoryModal__versions__checkbox"})}),e("td",{children:e("div",{className:"VersionHistoryModal__versions__modifiedAt",children:[e(M,{size:"body-sm",className:"VersionHistoryModal__versions__modifiedAt__text",children:h?e("span",{title:"Current Draft",children:[$.format(i.sys.modifiedAt.toDate())," ","(Latest)"]}):e(S,{children:[$.format(i.sys.modifiedAt.toDate()),i.tags?.includes("published")&&e("span",{className:"VersionHistoryModal__publishedLabel",children:"(Published)"})]})}),i.publishMessage&&e(ne,{withCloseButton:!0,opened:w===`${i._versionId}-message`,onClose:()=>f(null),position:"right",withArrow:!0,shadow:"md",width:320,classNames:{body:"VersionHistoryModal__popover__body",arrow:"VersionHistoryModal__popover__arrow",close:"VersionHistoryModal__popover__close"},target:e(Q,{size:"xs",variant:"light",className:"VersionHistoryModal__messageIcon",onClick:()=>f(w===`${i._versionId}-message`?null:`${i._versionId}-message`),children:e(Qe,{size:18})}),children:e("div",{className:"VersionHistoryModal__message",children:i.publishMessage})}),(()=>{let G=i.tags?.find(se=>se.startsWith("release:"))?.replace("release:","");return G&&e(ne,{withCloseButton:!0,opened:w===`${i._versionId}-release`,onClose:()=>f(null),position:"right",withArrow:!0,shadow:"md",width:320,target:e(Q,{size:"xs",variant:"light",className:"VersionHistoryModal__messageIcon",onClick:()=>f(w===`${i._versionId}-release`?null:`${i._versionId}-release`),children:e(Ze,{size:18})}),children:e("div",{className:"VersionHistoryModal__message",children:[e("strong",{children:"Release:"})," ",G]})})})()]})}),e("td",{children:e(M,{size:"body-sm",children:i.sys.modifiedBy})}),e("td",{children:e("div",{className:"VersionHistoryModal__versions__buttons",children:!h&&e(S,{children:[e(b,{variant:"default",size:"xs",compact:!0,onClick:()=>C(i),children:"restore"}),e(b,{variant:"default",size:"xs",compact:!0,onClick:()=>E(i),leftIcon:e(K,{size:12}),children:"copy to doc"})]})})})]},i._versionId)})})]}),g&&e("div",{className:"VersionHistoryModal__loadMore",children:e(b,{variant:"subtle",size:"xs",loading:p,onClick:n,children:"Load more versions"})})]})]})}function lo(s,t){return encodeURIComponent(`${s}@${t}`).replaceAll("%2F","/").replaceAll("%40","@")}function go(s){let t=s.getFullYear(),u=String(s.getMonth()+1).padStart(2,"0"),l=String(s.getDate()).padStart(2,"0"),d=String(s.getHours()).padStart(2,"0"),o=String(s.getMinutes()).padStart(2,"0");return`${t}-${u}-${l}T${d}:${o}`}_o.id=ro;function Js(s){let{roles:t}=Je(),u=window.firebase.user.email||"",l=eo(t,u),d=Ke(t,u),o=s.docId,y=s.data||{},p=y.sys||{},v=we(y),m=N(),k=oe({fromDocId:o,onSuccess:r=>{s.onAction&&s.onAction({action:"copy",newDocId:r})}}),g=H(),A=co({docId:o}),a=no({docId:o}),D=so({docIds:[o]}),x=()=>{let r=`revert-draft-${o}`,n=m.openConfirmModal({...g,title:`Discard draft edits for ${o}`,children:e(S,{children:[e(M,{size:"body-sm",weight:"semi-bold",className:"DocActionsMenu__confirmText",children:"Are you sure you want to discard draft changes for the following doc? The doc data will revert to the published version. There is no undo."}),e(B,{docId:o})]}),labels:{confirm:"Discard draft edits",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{_({id:r,title:"Discarding draft edits",message:`Discarding draft edits of ${o}...`,loading:!0,autoClose:!1}),await xe(o),F({id:r,title:"Discarded draft edits",message:`Successfully reverted ${o} back to its published version`,loading:!1,autoClose:5e3}),m.closeModal(n),s.onAction&&s.onAction({action:"revert-draft"})}})},T=()=>{let r=`unpublish-doc-${o}`,n=m.openConfirmModal({...g,title:`Unpublish ${o}`,children:e(S,{children:[e(M,{size:"body-sm",weight:"semi-bold",className:"DocActionsMenu__confirmText",children:"Are you sure you want to unpublish the following doc? There is no undo."}),e(B,{docId:o})]}),labels:{confirm:"Unpublish",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{_({id:r,title:"Unpublishing doc",message:`Requesting unpublish of ${o}...`,loading:!0,autoClose:!1}),await ve(o),F({id:r,title:"Unpublished!",message:`Successfully unpublished ${o}!`,loading:!1,autoClose:5e3}),m.closeModal(n),s.onAction&&s.onAction({action:"unpublish"})}})},w=r=>{s.onAction&&s.onAction({action:r})},f=()=>{let r=`unschedule-doc-${o}`,n=m.openConfirmModal({...g,title:`Unschedule ${o}`,children:e(S,{children:[e(M,{size:"body-sm",weight:"semi-bold",className:"DocActionsMenu__confirmText",children:"Are you sure you want to unschedule the following doc?"}),e(B,{docId:o})]}),labels:{confirm:"Unschedule",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{_({id:r,title:"Unschedule doc",message:`Requesting unschedule of ${o}...`,loading:!0,autoClose:!1}),await Ce(o),F({id:r,title:"Unscheduled!",message:`Successfully unscheduled ${o}!`,loading:!1,autoClose:5e3}),m.closeModal(n),s.onAction&&s.onAction({action:"unschedule"})}})},I=()=>{let r=`archive-doc-${o}`,n=m.openConfirmModal({...g,title:`Archive ${o}`,children:e(S,{children:[e(M,{size:"body-sm",weight:"semi-bold",className:"DocActionsMenu__confirmText",children:"Are you sure you want to archive the following doc? Archived docs are hidden from the collection list by default but can be restored later."}),e(B,{docId:o})]}),labels:{confirm:"Archive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{_({id:r,title:"Archiving doc",message:`Requesting archive of ${o}...`,loading:!0,autoClose:!1}),await ke(o),F({id:r,title:"Archived!",message:`Successfully archived ${o}!`,loading:!1,autoClose:5e3}),m.closeModal(n),s.onAction&&s.onAction({action:"archive"})}})},L=async()=>{let r=`unarchive-doc-${o}`;_({id:r,title:"Unarchiving doc",message:`Requesting unarchive of ${o}...`,loading:!0,autoClose:!1}),await Ae(o),F({id:r,title:"Unarchived!",message:`Successfully unarchived ${o}!`,loading:!1,autoClose:5e3}),s.onAction&&s.onAction({action:"unarchive"})},$=()=>{let r=`delete-doc-${o}`,n=m.openConfirmModal({...g,title:"Delete doc",children:e(S,{children:[e(M,{size:"body-sm",weight:"semi-bold",className:"DocActionsMenu__confirmText",children:"Are you sure you want to delete the following doc? There is no undo."}),e(B,{docId:o})]}),labels:{confirm:"Delete",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{_({id:r,title:"Deleting doc",message:`Requesting deletion of ${o}...`,loading:!0,autoClose:!1}),await ye(o),F({id:r,title:"Deleted!",message:`Successfully deleted ${o}!`,loading:!1,autoClose:5e3}),m.closeModal(n),s.onDelete&&s.onDelete(),s.onAction&&s.onAction({action:"delete"})}})};return e(P,{className:"CollectionPage__collection__docsList__doc__controls__menu",position:"bottom",control:e(Q,{className:"DocEditor__ArrayField__item__header__controls__dots",children:e(We,{size:16})}),children:[!v&&e(P.Item,{icon:e(Ye,{size:20}),onClick:()=>D.open(),disabled:!d,children:"Add to release"}),e(P.Item,{icon:e(je,{size:20}),onClick:()=>A.open(),children:"Version history"}),e(P.Item,{icon:e(K,{size:20}),onClick:()=>k.open(),disabled:!l,children:"Copy"}),!v&&p.modifiedAt&&p.publishedAt&&p.modifiedAt>p.publishedAt&&e(P.Item,{icon:e(Oe,{size:20}),onClick:()=>x(),disabled:!l,children:"Discard draft edits"}),!v&&p.firstPublishedAt&&e(P.Item,{icon:e(qe,{size:20}),onClick:()=>T(),disabled:!d,children:"Unpublish"}),!v&&p.scheduledAt&&e(P.Item,{icon:e(Ee,{size:20}),onClick:()=>f(),disabled:!d,children:"Unschedule"}),!v&&(Te(y)?e(P.Item,{icon:e(Y,{size:20}),onClick:()=>a.open({unlock:!0,onChange:w}),disabled:!l,children:"Unlock publishing"}):e(P.Item,{icon:e(ee,{size:20}),onClick:()=>a.open({unlock:!1,onChange:w}),disabled:!l||De(y),children:"Lock publishing"})),v?e(P.Item,{icon:e(Ue,{size:20}),onClick:()=>L(),disabled:!l,children:"Unarchive"}):!p.publishedAt&&e(P.Item,{icon:e(Be,{size:20}),onClick:()=>I(),disabled:!l,children:"Archive"}),e(P.Item,{icon:e(Ge,{size:20}),onClick:()=>$(),disabled:!l,children:"Delete"})]})}export{so as a,mo as b,po as c,B as d,no as e,Z as f,_o as g,Js as h};
|
|
1
|
+
import{d as Xe}from"./chunk-P4U2LUTF.js";import{f as He}from"./chunk-3IYZCUPI.js";import{a as Le,b as $e,d as Ve,i as Se}from"./chunk-RSVO46S3.js";import{a as Ke,b as eo}from"./chunk-ONTGW2VA.js";import{a as Je}from"./chunk-L4RHGQUG.js";import{a as N,c as H}from"./chunk-HRGYNHZ3.js";import{a as _e,b as ge,c as ae}from"./chunk-JDW4UORS.js";import{d as ye,h as ve,i as xe,j as Ce,k as Ie,l as le,m as ke,n as Ae,o as we,p as De,q as Te,r as Re,s as Pe,v as de,w as Ne,x as ze}from"./chunk-AFWBSIPL.js";import{b as be,e as Me}from"./chunk-XOQ3KDSR.js";import{b as U}from"./chunk-62UWGWON.js";import{a as _,b as F}from"./chunk-I6ICVKEC.js";import{a as M}from"./chunk-HLMBCVRX.js";import{e as he}from"./chunk-ORXEMIQC.js";import{d as fe}from"./chunk-AL3TN2KI.js";import{Ea as pe,Ha as e,Ia as Ee,La as Ue,Ma as Be,Mb as je,Oa as Oe,Pc as Ge,Ra as Fe,V as J,W as Q,a as c,aa as ue,ac as Y,bc as ee,c as j,e as ce,ea as b,fa as ie,gc as Qe,ic as Ye,j as X,jb as qe,mb as K,ra as P,ub as We,va as me,wc as Ze,ya as ne}from"./chunk-NZHF733K.js";import{d as S}from"./chunk-KUCVLANF.js";X();var oo="AddToReleaseModal";function so(s){let t=N(),u=H();return{open:()=>{t.openContextModal(oo,{...u,title:"Add docs to a release",innerProps:s,size:"600px"})}}}function mo(s){let{innerProps:t,context:u,id:l}=s,d=N(),[o,y]=c(""),[p,v]=c(!1),[m,k]=c(!1),[g,A]=c([]),[a,D]=c(""),[x,T]=c(Se()),[w,f]=c("");j(()=>{async function n(){v(!0),await U(async()=>{let E=(await $e()).filter(R=>!R.publishedAt&&!R.archivedAt);A(E)}),v(!1)}n()},[]);async function I(){o==="new"?await L():o==="existing"&&await $()}async function L(){if(!x){_({title:"Missing ID",message:"Please enter a release ID.",color:"red",autoClose:5e3});return}if(!_e(x)){_({title:"Invalid ID",message:"Release ID must use alphanumeric characters and dashes only.",color:"red",autoClose:5e3});return}k(!0),await U(async()=>{let n={docIds:t.docIds};w&&(n.description=w),await Le(x,n),_({title:`Release created: ${x}`,message:e("span",{children:["Created release with ",t.docIds.length," doc(s)."," ",e("a",{href:`/cms/releases/${x}`,children:"View release"})]}),autoClose:1e4}),d.closeAll()}),k(!1)}async function $(){if(!a){_({title:"No release selected",message:"Please select a release.",color:"red",autoClose:5e3});return}k(!0),await U(async()=>{let C=g.find(z=>z.id===a)?.docIds||[],E=Array.from(new Set([...C,...t.docIds])).sort();await Ve(a,{docIds:E});let R=E.length-C.length;_({title:`Docs added to release: ${a}`,message:e("span",{children:["Added ",R," new doc(s) to release."," ",e("a",{href:`/cms/releases/${a}`,children:"View release"})]}),autoClose:1e4}),d.closeAll()}),k(!1)}let r=!0;return(o==="new"&&x||o==="existing"&&a)&&(r=!1),e("div",{className:"AddToReleaseModal",children:e("div",{className:"AddToReleaseModal__content",children:[e("div",{className:"AddToReleaseModal__docs",children:[e("div",{className:"AddToReleaseModal__docs__label",children:["Docs to add (",t.docIds.length,")"]}),e("div",{className:"AddToReleaseModal__docs__list",children:t.docIds.map(n=>e(He,{docId:n,variant:"compact",statusBadges:!0},n))})]}),e("div",{className:"AddToReleaseModal__mode",children:[e("label",{className:`AddToReleaseModal__mode__option${o==="new"?" AddToReleaseModal__mode__option--selected":o?" AddToReleaseModal__mode__option--unselected":""}`,children:[e("div",{className:"AddToReleaseModal__mode__option__input",children:[e("input",{type:"radio",name:"release-mode",value:"new",checked:o==="new",onChange:()=>y("new")})," ","New release"]}),e("div",{className:"AddToReleaseModal__mode__option__help",children:"Create a new release with these docs."})]}),e("label",{className:`AddToReleaseModal__mode__option${o==="existing"?" AddToReleaseModal__mode__option--selected":o?" AddToReleaseModal__mode__option--unselected":""}`,children:[e("div",{className:"AddToReleaseModal__mode__option__input",children:[e("input",{type:"radio",name:"release-mode",value:"existing",checked:o==="existing",onChange:()=>y("existing")})," ","Existing release"]}),e("div",{className:"AddToReleaseModal__mode__option__help",children:"Add to an existing release."})]})]}),o==="new"&&e("div",{className:"AddToReleaseModal__form",children:[e("div",{className:"AddToReleaseModal__form__field",children:[e("label",{children:"Release ID"}),e("input",{type:"text",placeholder:"e.g. my-release",value:x,onInput:n=>{T(n.target.value)}})]}),e("div",{className:"AddToReleaseModal__form__field",children:[e("label",{children:"Description (optional)"}),e("textarea",{rows:2,placeholder:"Describe this release",value:w,onInput:n=>{f(n.target.value)}})]})]}),o==="existing"&&e("div",{className:"AddToReleaseModal__releases",children:p?e("div",{className:"AddToReleaseModal__releases__empty",children:e(J,{color:"gray",size:"sm"})}):g.length===0?e("div",{className:"AddToReleaseModal__releases__empty",children:"No unpublished releases found. Create a new one instead."}):g.map(n=>e("div",{className:`AddToReleaseModal__release${a===n.id?" AddToReleaseModal__release--selected":""}`,onClick:()=>D(n.id),children:[e("input",{type:"radio",name:"existing-release",checked:a===n.id,onChange:()=>D(n.id)}),e("div",{className:"AddToReleaseModal__release__info",children:[e("div",{className:"AddToReleaseModal__release__info__id",children:n.id}),n.description&&e("div",{className:"AddToReleaseModal__release__info__description",children:n.description})]}),e("div",{className:"AddToReleaseModal__release__docCount",children:[n.docIds?.length||0," doc(s)"]})]},n.id))}),e("div",{className:"AddToReleaseModal__buttons",children:[e(b,{variant:"outline",onClick:()=>u.closeModal(l),type:"button",size:"xs",color:"dark",children:"Cancel"}),e(b,{variant:"filled",size:"xs",color:"dark",disabled:r,loading:m,onClick:I,children:o==="new"?"Create release":"Add to release"})]})]})})}mo.id=oo;X();var to="CopyDocModal";function oe(s){let t=N(),u=H();return{open:l=>{t.openContextModal(to,{...u,innerProps:{...s,...l}})}}}function po(s){let{innerProps:t,context:u,id:l}=s,{route:d}=fe(),[o,y]=c(""),[p,v]=c(""),[m,k]=c(""),[g,A]=c(""),[a,D]=c(!1),[x,T]=c(!1),[w,f]=c({}),I=t.fromDocId,L=I.split("/")[0],$=t.fromLabel||I;j(()=>{be({tags:[I]}).then(f)},[I]);function r(C,E){let R=ae(C),z=window.__ROOT_CTX.collections[E]?.slugRegex;return R?ge(R,z):""}async function n(C){if(C.preventDefault(),T(!0),A(""),!L){A("Please select a collection."),T(!1);return}if(r(p,o)){T(!1);return}let R=ae(p),z=`${o}/${R}`;try{t.fields?await Pe(z,{fields:t.fields,overwrite:a}):await Re(I,z,{overwrite:a});let O=Object.keys(w);if(O.length>0){let i=O.map(h=>({hash:h,tags:[z]}));await Me(i,{mode:"union"})}u.closeModal(l);let q=`/cms/content/${o}/${R}`;_({title:"Copied!",message:e("div",{children:[e("div",{children:`Successfully copied ${$} to ${z}.`}),e(b,{className:"CopyDocModal__notificationButton",component:"a",href:q,size:"xs",compact:!0,variant:"default",children:"Open doc"})]}),autoClose:1e4}),t.onSuccess&&t.onSuccess(z)}catch(O){let q=String(O);A(q),q.includes("already exists")&&D(!0),T(!1);return}T(!1),d(`/cms/content/${o}/${R}`)}return e("div",{className:"CopyDocModal",children:e("form",{onSubmit:C=>n(C),children:[e("div",{className:"CopyDocModal__from",children:[e(M,{className:"CopyDocModal__from__label",size:"body",weight:"bold",children:"From:"}),e(M,{className:"CopyDocModal__from__value",size:"body-sm",children:e("code",{children:$})})]}),e("div",{className:"CopyDocModal__to",children:[e(M,{className:"CopyDocModal__to__label",size:"body",weight:"bold",children:"To:"}),e(Xe,{className:"CopyDocModal__slug",collectionId:L,onChange:C=>{y(C.collectionId),v(C.slug),k(r(C.slug,C.collectionId)),A(""),D(!1)}})]}),g&&e("div",{className:"CopyDocModal__error",children:g}),e("div",{className:"CopyDocModal__buttons",children:[e(b,{variant:"outline",onClick:()=>u.closeModal(l),type:"button",size:"xs",color:"dark",children:"Cancel"}),e(b,{variant:"filled",type:"submit",size:"xs",color:"dark",loading:x,disabled:!!m||!!g&&!a,children:a?"Overwrite?":"Submit"})]})]})})}po.id=to;X();function B(s){return e("div",{className:"DocIdBadge",children:e("code",{"data-testid":"doc-id",children:s.docId})})}var io="LockPublishingModal";function no(s){let t=N(),u=H();return{open:l=>{let d={...s,...l},o;d.unlock?o=`Unlock publishing for ${s.docId}`:d.existingLock?o=`Edit publishing lock for ${s.docId}`:o=`Lock publishing for ${s.docId}`,t.openContextModal(io,{...u,title:o,innerProps:{...s,...l},size:"600px"})}}}function fo(s){let t=l=>l<10?"0"+l:l,u=new Date(s);return`${u.getFullYear()}-${t(u.getMonth()+1)}-${t(u.getDate())}T${t(u.getHours())}:${t(u.getMinutes())}`}function Z(s){let{innerProps:t}=s;return t.unlock?e(Z.Unlock,{...s}):e(Z.Lock,{...s})}Z.Lock=s=>{let{innerProps:t,context:u,id:l}=s,d=!!t.existingLock,[o,y]=c(t.existingLock?.reason||""),[p,v]=c(t.existingLock?.until||0),[m,k]=c(!1),[g,A]=c(!1),a=N();function D(f){return f?Math.floor(new Date(f).getTime()):0}async function x(f){f.preventDefault(),k(!0),await U(async()=>{await Ie(t.docId,{reason:o,until:p}),_({title:d?"Updated!":"Locked!",message:d?`Publishing lock updated for ${t.docId}.`:`Publishing is locked for ${t.docId}.`,autoClose:1e4}),a.closeModal(l),t.onChange&&t.onChange("locked")}),k(!1)}async function T(){A(!0),await U(async()=>{await le(t.docId),_({title:"Unlocked!",message:`Publishing is unlocked for ${t.docId}.`,autoClose:1e4}),a.closeModal(l),t.onChange&&t.onChange("unlocked")}),A(!1)}return e("div",{className:"LockPublishingModal LockPublishingModal--lock",children:[e(M,{className:"LockPublishingModal__body",size:"body-sm",children:d?"Publishing is currently locked. Update the publishing lock details below, or remove the lock to re\u2011enable publishing.":"Are you sure you want to lock publishing? Content editors will not be able to publish until publishing is unlocked."}),e("form",{className:"LockPublishingModal__form",onSubmit:f=>x(f),children:[e("div",{className:"LockPublishingModal__form__section",children:e(me,{name:"reason",label:"Reason",description:"Specify a short reason so other content editors know why publishing is locked.",size:"xs",radius:0,value:o,onChange:f=>{y(f.currentTarget.value)}})}),e("div",{className:"LockPublishingModal__form__section",children:e(ue,{label:"Lock until",description:"Optional. Publishing is unlocked at the specified time. If not provided, publishing will be locked indefinitely.",size:"xs",children:e("div",{className:"DocEditor__DateTimeField",children:[e("input",{name:"until",type:"datetime-local",min:he(),defaultValue:p?fo(p):"",onChange:f=>{let L=f.target.value;v(D(L))}}),e("div",{className:"DocEditor__DateTimeField__timezone",children:["timezone: ",Intl.DateTimeFormat().resolvedOptions().timeZone]})]})})}),e("div",{className:"LockPublishingModal__buttons",children:[d&&e(b,{variant:"filled",size:"xs",color:"red",type:"button",leftIcon:e(Y,{size:14}),loading:g,disabled:m,onClick:()=>T(),className:"LockPublishingModal__buttons__unlock",children:"Unlock"}),e(b,{variant:"outline",onClick:()=>u.closeModal(l),type:"button",size:"xs",color:"dark",children:"Cancel"}),e(b,{variant:"filled",size:"xs",color:"dark",leftIcon:e(ee,{size:14}),disabled:!o||g,type:"submit",loading:m,children:d?"Save":"Lock"})]})]})]})};Z.Unlock=s=>{let{innerProps:t,context:u,id:l}=s,[d,o]=c(!1),y=N();async function p(){o(!0),await U(async()=>{await le(t.docId),_({title:"Unlocked!",message:`Publishing is unlocked for ${t.docId}.`,autoClose:1e4}),y.closeModal(l),t.onChange&&t.onChange("unlocked")})}return e("div",{className:"LockPublishingModal LockPublishingModal--unlock",children:[e(M,{className:"LockPublishingModal__body",children:"Are you sure you want to unlock publishing for the following doc? This will re-enable content editors to publish the doc."}),e(B,{docId:t.docId}),e("div",{className:"LockPublishingModal__buttons",children:[e(b,{variant:"outline",onClick:()=>u.closeModal(l),type:"button",size:"xs",color:"dark",children:"Cancel"}),e(b,{variant:"filled",size:"xs",color:"dark",leftIcon:e(Y,{size:14}),loading:d,onClick:()=>p(),children:"Unlock"})]})]})};Z.id=io;X();var ro="VersionHistoryModal",ao=50;function co(s){let t=N(),u=H();return{open:()=>{t.openContextModal(ro,{...u,title:`Version history: ${s.docId}`,innerProps:s,overflow:"inside",size:"min(calc(100% - 32px), 720px)"})}}}function _o(s){let{innerProps:t,context:u,id:l}=s,d=t.docId,[o,y]=c(!0),[p,v]=c(!1),[m,k]=c([]),[g,A]=c(!1),[a,D]=c([]),[x,T]=c(!1),[w,f]=c(null),I=ce(null),L=oe({fromDocId:d}),$=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});async function r(){y(!0);let[i,h]=await Promise.all([de(d,{limit:ao}),ze(d,"draft")]);I.current=i.lastDoc,A(i.hasMore);let V={_versionId:"draft",sys:{modifiedAt:h?.sys?.modifiedAt||{toDate:()=>new Date},modifiedBy:h?.sys?.modifiedBy||"Unknown"}};k([V,...i.versions]),D(["draft"]),y(!1)}async function n(){if(!g||p)return;v(!0);let i=await de(d,{limit:ao,cursor:I.current});I.current=i.lastDoc,A(i.hasMore),k(h=>[...h,...i.versions]),v(!1)}async function C(i){await Ne(d,i),_({title:"Saved!",message:`Restored ${d} to ${$.format(i.sys.modifiedAt.toDate())}.`,autoClose:5e3}),t.onRestore&&t.onRestore({version:i})}function E(i){let h=`${d}@${i._versionId}`,V=i.sys?.modifiedAt?.toDate();if(V){let W=go(V);h=`${d}@${W}`}L.open({fields:i.fields||{},fromLabel:h,onSuccess:()=>{u.closeModal(l)}})}function R(i){a.includes(i)?D(a.filter(h=>h!==i)):a.length<2&&D([...a,i])}function z(){if(a.length!==2)return"#";let i=m.find(te=>te._versionId===a[0]),h=m.find(te=>te._versionId===a[1]);if(!i||!h)return"#";let V=m.indexOf(i),W=m.indexOf(h),re=V>W?i:h,G=V>W?h:i,se=lo(d,re._versionId),uo=lo(d,G._versionId);return`/cms/compare?left=${se}&right=${uo}`}j(()=>{r()},[]);let O=m.filter(i=>i._versionId==="draft"||!x?!0:i.tags?.includes("published")),q=m.some(i=>i.tags?.includes("published"));return o?e(J,{}):e("div",{className:"VersionHistoryModal",children:[e("div",{className:"VersionHistoryModal__actions",children:[e(b,{component:a.length===2?"a":"button",variant:"filled",size:"xs",disabled:a.length!==2,href:a.length===2?z():void 0,target:a.length===2?"_blank":void 0,rightIcon:e(Fe,{size:16}),children:"Compare"}),q&&e(ie,{size:"xs",label:"Published versions only",checked:x,onChange:i=>T(i.currentTarget.checked)})]}),O.length===0?e(M,{className:"VersionHistoryModal__versionsEmpty",size:"body",children:[e("p",{children:"No versions found."}),e("p",{className:"VersionHistoryModal__versionsEmpty__developer",children:"For developers: Configure the Root CMS cron job to populate versions."})]}):e(S,{children:[e(pe,{className:"VersionHistoryModal__versions",children:[e("thead",{children:e("tr",{children:[e("th",{children:e("span",{className:"VersionHistoryModal__versions__selectLabel",children:"Select"})}),e("th",{children:"modified at"}),e("th",{children:"modified by"}),e("th",{children:"actions"})]})}),e("tbody",{children:O.map(i=>{let h=i._versionId==="draft",V=a.includes(i._versionId),W=!V&&a.length>=2;return e("tr",{children:[e("td",{children:e(ie,{size:"xs",checked:V,disabled:W,onChange:()=>R(i._versionId),className:"VersionHistoryModal__versions__checkbox"})}),e("td",{children:e("div",{className:"VersionHistoryModal__versions__modifiedAt",children:[e(M,{size:"body-sm",className:"VersionHistoryModal__versions__modifiedAt__text",children:h?e("span",{title:"Current Draft",children:[$.format(i.sys.modifiedAt.toDate())," ","(Latest)"]}):e(S,{children:[$.format(i.sys.modifiedAt.toDate()),i.tags?.includes("published")&&e("span",{className:"VersionHistoryModal__publishedLabel",children:"(Published)"})]})}),i.publishMessage&&e(ne,{withCloseButton:!0,opened:w===`${i._versionId}-message`,onClose:()=>f(null),position:"right",withArrow:!0,shadow:"md",width:320,classNames:{body:"VersionHistoryModal__popover__body",arrow:"VersionHistoryModal__popover__arrow",close:"VersionHistoryModal__popover__close"},target:e(Q,{size:"xs",variant:"light",className:"VersionHistoryModal__messageIcon",onClick:()=>f(w===`${i._versionId}-message`?null:`${i._versionId}-message`),children:e(Qe,{size:18})}),children:e("div",{className:"VersionHistoryModal__message",children:i.publishMessage})}),(()=>{let G=i.tags?.find(se=>se.startsWith("release:"))?.replace("release:","");return G&&e(ne,{withCloseButton:!0,opened:w===`${i._versionId}-release`,onClose:()=>f(null),position:"right",withArrow:!0,shadow:"md",width:320,target:e(Q,{size:"xs",variant:"light",className:"VersionHistoryModal__messageIcon",onClick:()=>f(w===`${i._versionId}-release`?null:`${i._versionId}-release`),children:e(Ze,{size:18})}),children:e("div",{className:"VersionHistoryModal__message",children:[e("strong",{children:"Release:"})," ",G]})})})()]})}),e("td",{children:e(M,{size:"body-sm",children:i.sys.modifiedBy})}),e("td",{children:e("div",{className:"VersionHistoryModal__versions__buttons",children:!h&&e(S,{children:[e(b,{variant:"default",size:"xs",compact:!0,onClick:()=>C(i),children:"restore"}),e(b,{variant:"default",size:"xs",compact:!0,onClick:()=>E(i),leftIcon:e(K,{size:12}),children:"copy to doc"})]})})})]},i._versionId)})})]}),g&&e("div",{className:"VersionHistoryModal__loadMore",children:e(b,{variant:"subtle",size:"xs",loading:p,onClick:n,children:"Load more versions"})})]})]})}function lo(s,t){return encodeURIComponent(`${s}@${t}`).replaceAll("%2F","/").replaceAll("%40","@")}function go(s){let t=s.getFullYear(),u=String(s.getMonth()+1).padStart(2,"0"),l=String(s.getDate()).padStart(2,"0"),d=String(s.getHours()).padStart(2,"0"),o=String(s.getMinutes()).padStart(2,"0");return`${t}-${u}-${l}T${d}:${o}`}_o.id=ro;function Js(s){let{roles:t}=Je(),u=window.firebase.user.email||"",l=eo(t,u),d=Ke(t,u),o=s.docId,y=s.data||{},p=y.sys||{},v=we(y),m=N(),k=oe({fromDocId:o,onSuccess:r=>{s.onAction&&s.onAction({action:"copy",newDocId:r})}}),g=H(),A=co({docId:o}),a=no({docId:o}),D=so({docIds:[o]}),x=()=>{let r=`revert-draft-${o}`,n=m.openConfirmModal({...g,title:`Discard draft edits for ${o}`,children:e(S,{children:[e(M,{size:"body-sm",weight:"semi-bold",className:"DocActionsMenu__confirmText",children:"Are you sure you want to discard draft changes for the following doc? The doc data will revert to the published version. There is no undo."}),e(B,{docId:o})]}),labels:{confirm:"Discard draft edits",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{_({id:r,title:"Discarding draft edits",message:`Discarding draft edits of ${o}...`,loading:!0,autoClose:!1}),await xe(o),F({id:r,title:"Discarded draft edits",message:`Successfully reverted ${o} back to its published version`,loading:!1,autoClose:5e3}),m.closeModal(n),s.onAction&&s.onAction({action:"revert-draft"})}})},T=()=>{let r=`unpublish-doc-${o}`,n=m.openConfirmModal({...g,title:`Unpublish ${o}`,children:e(S,{children:[e(M,{size:"body-sm",weight:"semi-bold",className:"DocActionsMenu__confirmText",children:"Are you sure you want to unpublish the following doc? There is no undo."}),e(B,{docId:o})]}),labels:{confirm:"Unpublish",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{_({id:r,title:"Unpublishing doc",message:`Requesting unpublish of ${o}...`,loading:!0,autoClose:!1}),await ve(o),F({id:r,title:"Unpublished!",message:`Successfully unpublished ${o}!`,loading:!1,autoClose:5e3}),m.closeModal(n),s.onAction&&s.onAction({action:"unpublish"})}})},w=r=>{s.onAction&&s.onAction({action:r})},f=()=>{let r=`unschedule-doc-${o}`,n=m.openConfirmModal({...g,title:`Unschedule ${o}`,children:e(S,{children:[e(M,{size:"body-sm",weight:"semi-bold",className:"DocActionsMenu__confirmText",children:"Are you sure you want to unschedule the following doc?"}),e(B,{docId:o})]}),labels:{confirm:"Unschedule",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{_({id:r,title:"Unschedule doc",message:`Requesting unschedule of ${o}...`,loading:!0,autoClose:!1}),await Ce(o),F({id:r,title:"Unscheduled!",message:`Successfully unscheduled ${o}!`,loading:!1,autoClose:5e3}),m.closeModal(n),s.onAction&&s.onAction({action:"unschedule"})}})},I=()=>{let r=`archive-doc-${o}`,n=m.openConfirmModal({...g,title:`Archive ${o}`,children:e(S,{children:[e(M,{size:"body-sm",weight:"semi-bold",className:"DocActionsMenu__confirmText",children:"Are you sure you want to archive the following doc? Archived docs are hidden from the collection list by default but can be restored later."}),e(B,{docId:o})]}),labels:{confirm:"Archive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{_({id:r,title:"Archiving doc",message:`Requesting archive of ${o}...`,loading:!0,autoClose:!1}),await ke(o),F({id:r,title:"Archived!",message:`Successfully archived ${o}!`,loading:!1,autoClose:5e3}),m.closeModal(n),s.onAction&&s.onAction({action:"archive"})}})},L=async()=>{let r=`unarchive-doc-${o}`;_({id:r,title:"Unarchiving doc",message:`Requesting unarchive of ${o}...`,loading:!0,autoClose:!1}),await Ae(o),F({id:r,title:"Unarchived!",message:`Successfully unarchived ${o}!`,loading:!1,autoClose:5e3}),s.onAction&&s.onAction({action:"unarchive"})},$=()=>{let r=`delete-doc-${o}`,n=m.openConfirmModal({...g,title:"Delete doc",children:e(S,{children:[e(M,{size:"body-sm",weight:"semi-bold",className:"DocActionsMenu__confirmText",children:"Are you sure you want to delete the following doc? There is no undo."}),e(B,{docId:o})]}),labels:{confirm:"Delete",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{_({id:r,title:"Deleting doc",message:`Requesting deletion of ${o}...`,loading:!0,autoClose:!1}),await ye(o),F({id:r,title:"Deleted!",message:`Successfully deleted ${o}!`,loading:!1,autoClose:5e3}),m.closeModal(n),s.onDelete&&s.onDelete(),s.onAction&&s.onAction({action:"delete"})}})};return e(P,{className:"CollectionPage__collection__docsList__doc__controls__menu",position:"bottom",control:e(Q,{className:"DocEditor__ArrayField__item__header__controls__dots",children:e(We,{size:16})}),children:[!v&&e(P.Item,{icon:e(Ye,{size:20}),onClick:()=>D.open(),disabled:!d,children:"Add to release"}),e(P.Item,{icon:e(je,{size:20}),onClick:()=>A.open(),children:"Version history"}),e(P.Item,{icon:e(K,{size:20}),onClick:()=>k.open(),disabled:!l,children:"Copy"}),!v&&p.modifiedAt&&p.publishedAt&&p.modifiedAt>p.publishedAt&&e(P.Item,{icon:e(Oe,{size:20}),onClick:()=>x(),disabled:!l,children:"Discard draft edits"}),!v&&p.firstPublishedAt&&e(P.Item,{icon:e(qe,{size:20}),onClick:()=>T(),disabled:!d,children:"Unpublish"}),!v&&p.scheduledAt&&e(P.Item,{icon:e(Ee,{size:20}),onClick:()=>f(),disabled:!d,children:"Unschedule"}),!v&&(Te(y)?e(P.Item,{icon:e(Y,{size:20}),onClick:()=>a.open({unlock:!0,onChange:w}),disabled:!l,children:"Unlock publishing"}):e(P.Item,{icon:e(ee,{size:20}),onClick:()=>a.open({unlock:!1,onChange:w}),disabled:!l||De(y),children:"Lock publishing"})),v?e(P.Item,{icon:e(Ue,{size:20}),onClick:()=>L(),disabled:!l,children:"Unarchive"}):!p.publishedAt&&e(P.Item,{icon:e(Be,{size:20}),onClick:()=>I(),disabled:!l,children:"Archive"}),e(P.Item,{icon:e(Ge,{size:20}),onClick:()=>$(),disabled:!l,children:"Delete"})]})}export{so as a,mo as b,po as c,B as d,no as e,Z as f,_o as g,Js as h};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as gE,e as OE}from"./chunk-HHMG665Z.js";import{a as CE,b as EE}from"./chunk-YFA6U2CV.js";import{a as bE}from"./chunk-4W73RW5I.js";import{a as mE,b as _E,c as _h}from"./chunk-P3NETZZP.js";import{a as Rd}from"./chunk-V7S4IAGB.js";import{a as DE}from"./chunk-KFAZBEPV.js";import{a as cE,d as uE}from"./chunk-PHBMVORG.js";import{a as sE,d as mh}from"./chunk-JZFTZ4X4.js";import{b as aE,d as lE}from"./chunk-HKINZLMW.js";import{a as wE,b as pr,c as Zs,d as TE,e as $d,f as Hn,g as SE,i as Fo,j as en,l as zd}from"./chunk-TJBVMFNQ.js";import{a as Pd}from"./chunk-CGCKJFL4.js";import{a as ur}from"./chunk-VMT7JFAM.js";import{f as Js,j as dE}from"./chunk-SKEP5WYH.js";import{a as xC,d as yE,e as xE,h as NE}from"./chunk-GXSAEPU3.js";import{g as fE,h as Xs,i as hE}from"./chunk-NXQVLOTK.js";import{c as bC,d as yC,f as _d}from"./chunk-3IYZCUPI.js";import{a as pE}from"./chunk-X2WHBGTP.js";import{a as Bd,b as vE,c as kE}from"./chunk-ONTGW2VA.js";import{a as Fd}from"./chunk-L4RHGQUG.js";import{a as Mt,c as at}from"./chunk-HRGYNHZ3.js";import{a as Us,b as js,c as ud,d as aC}from"./chunk-W3HIZQ4Z.js";import{c as oC}from"./chunk-JDW4UORS.js";import{A as mC,D as gd,E as md,a as pd,b as Cl,e as cC,g as dC,p as uC,q as pC,t as Vs,v as fC,x as hC,y as hd,z as gC}from"./chunk-AFWBSIPL.js";import{b as fd,e as ah,f as dr,h as lC}from"./chunk-XOQ3KDSR.js";import{a as ih,b as cr}from"./chunk-62UWGWON.js";import{a as ve,b as yt,c as Jv}from"./chunk-I6ICVKEC.js";import{a as Ui}from"./chunk-HLMBCVRX.js";import{a as sh,d as rC,e as iC,f as sC}from"./chunk-ORXEMIQC.js";import{a as Ws,b as Po,e as Ze,g as _C}from"./chunk-5MV6XVGA.js";import{a as dd,c as Xv,e as Zv,p as Qv,q as eC,r as tC,u as rh}from"./chunk-EGEB6N4J.js";import{d as nC,f as Se}from"./chunk-AL3TN2KI.js";import{$ as Ks,$a as to,$b as Sd,Aa as Ro,Ab as MC,Ac as Dd,Bc as nE,Ca as qr,Cb as AC,Cc as oE,Ec as qs,Fa as cd,Fb as LC,Ga as De,Gb as Ed,Gc as rE,Ha as g,Hb as RC,Hc as Od,Ib as PC,Ic as Id,Ja as lh,Jb as FC,Jc as Md,Ka as vC,Kb as BC,Kc as Ad,Lb as $C,Na as Jr,Ob as uh,Oc as El,Pb as wd,Pc as ho,Qb as zC,Qc as Ld,Ra as Gs,Rb as HC,Sb as Hi,Tb as KC,U as oh,Ua as bd,Ub as UC,Uc as gh,V as Qt,Va as ch,W as Pe,Wa as CC,Xb as Td,Y as sr,Ya as EC,Yb as jC,Yc as iE,Zb as VC,_a as zi,_b as WC,a as R,ab as wC,b as $v,ba as Vv,bb as TC,bc as GC,c as P,cb as SC,d as un,db as kC,dc as YC,e as Y,ea as ee,eb as yd,fa as Ao,fb as dh,g as J,ga as ar,h as we,hb as xd,i as It,ic as qC,j as ke,jc as ph,k as zv,kb as vd,kc as kd,l as Hv,m as $i,ma as sd,mb as NC,nc as JC,o as Kv,oa as Lo,oc as XC,pa as ad,q as Yr,qa as Wv,qc as ZC,r as Uv,ra as X,rb as DC,rc as QC,s as jv,sa as ld,sc as eE,ta as Gv,u as vl,ub as Cd,v as et,va as lr,vc as Ki,w as Hs,wa as Yv,wc as fh,x as th,xb as Ys,xc as Nd,y as pt,yb as OC,yc as hh,z as nh,za as qv,zb as IC,zc as tE}from"./chunk-NZHF733K.js";import{b as Bi,d as Me,e as Bv,j as Ot,k as zs}from"./chunk-KUCVLANF.js";import{b as Qf,c as Re,d as eh,e as GL}from"./chunk-PVAE643M.js";var t0=Qf(e0=>{"use strict";var wl=(pt(),GL(th));function SR(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var kR=typeof Object.is=="function"?Object.is:SR,NR=wl.useSyncExternalStore,DR=wl.useRef,OR=wl.useEffect,IR=wl.useMemo,MR=wl.useDebugValue;e0.useSyncExternalStoreWithSelector=function(t,e,n,o,r){var i=DR(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=IR(function(){function l(f){if(!c){if(c=!0,d=f,f=o(f),r!==void 0&&s.hasValue){var h=s.value;if(r(h,f))return u=h}return u=f}if(h=u,kR(d,f))return h;var m=o(f);return r!==void 0&&r(h,m)?(d=f,h):(d=f,u=m)}var c=!1,d,u,p=n===void 0?null:n;return[function(){return l(e())},p===null?void 0:function(){return l(p())}]},[e,n,o,r]);var a=NR(t,i[0],i[1]);return OR(function(){s.hasValue=!0,s.value=a},[a]),MR(a),a}});var o0=Qf((k9,n0)=>{"use strict";n0.exports=t0()});var mv=Qf((pse,Hf)=>{"use strict";var nV=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var oe=(function(t){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,o={},r={manual:t.Prism&&t.Prism.manual,disableWorkerMessageHandler:t.Prism&&t.Prism.disableWorkerMessageHandler,util:{encode:function m(_){return _ instanceof i?new i(_.type,m(_.content),_.alias):Array.isArray(_)?_.map(m):_.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(m){return Object.prototype.toString.call(m).slice(8,-1)},objId:function(m){return m.__id||Object.defineProperty(m,"__id",{value:++n}),m.__id},clone:function m(_,b){b=b||{};var y,x;switch(r.util.type(_)){case"Object":if(x=r.util.objId(_),b[x])return b[x];y={},b[x]=y;for(var v in _)_.hasOwnProperty(v)&&(y[v]=m(_[v],b));return y;case"Array":return x=r.util.objId(_),b[x]?b[x]:(y=[],b[x]=y,_.forEach(function(E,C){y[C]=m(E,b)}),y);default:return _}},getLanguage:function(m){for(;m;){var _=e.exec(m.className);if(_)return _[1].toLowerCase();m=m.parentElement}return"none"},setLanguage:function(m,_){m.className=m.className.replace(RegExp(e,"gi"),""),m.classList.add("language-"+_)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(y){var m=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(y.stack)||[])[1];if(m){var _=document.getElementsByTagName("script");for(var b in _)if(_[b].src==m)return _[b]}return null}},isActive:function(m,_,b){for(var y="no-"+_;m;){var x=m.classList;if(x.contains(_))return!0;if(x.contains(y))return!1;m=m.parentElement}return!!b}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(m,_){var b=r.util.clone(r.languages[m]);for(var y in _)b[y]=_[y];return b},insertBefore:function(m,_,b,y){y=y||r.languages;var x=y[m],v={};for(var E in x)if(x.hasOwnProperty(E)){if(E==_)for(var C in b)b.hasOwnProperty(C)&&(v[C]=b[C]);b.hasOwnProperty(E)||(v[E]=x[E])}var k=y[m];return y[m]=v,r.languages.DFS(r.languages,function(T,w){w===k&&T!=m&&(this[T]=v)}),v},DFS:function m(_,b,y,x){x=x||{};var v=r.util.objId;for(var E in _)if(_.hasOwnProperty(E)){b.call(_,E,_[E],y||E);var C=_[E],k=r.util.type(C);k==="Object"&&!x[v(C)]?(x[v(C)]=!0,m(C,b,null,x)):k==="Array"&&!x[v(C)]&&(x[v(C)]=!0,m(C,b,E,x))}}},plugins:{},highlightAll:function(m,_){r.highlightAllUnder(document,m,_)},highlightAllUnder:function(m,_,b){var y={callback:b,container:m,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",y),y.elements=Array.prototype.slice.apply(y.container.querySelectorAll(y.selector)),r.hooks.run("before-all-elements-highlight",y);for(var x=0,v;v=y.elements[x++];)r.highlightElement(v,_===!0,y.callback)},highlightElement:function(m,_,b){var y=r.util.getLanguage(m),x=r.languages[y];r.util.setLanguage(m,y);var v=m.parentElement;v&&v.nodeName.toLowerCase()==="pre"&&r.util.setLanguage(v,y);var E=m.textContent,C={element:m,language:y,grammar:x,code:E};function k(w){C.highlightedCode=w,r.hooks.run("before-insert",C),C.element.innerHTML=C.highlightedCode,r.hooks.run("after-highlight",C),r.hooks.run("complete",C),b&&b.call(C.element)}if(r.hooks.run("before-sanity-check",C),v=C.element.parentElement,v&&v.nodeName.toLowerCase()==="pre"&&!v.hasAttribute("tabindex")&&v.setAttribute("tabindex","0"),!C.code){r.hooks.run("complete",C),b&&b.call(C.element);return}if(r.hooks.run("before-highlight",C),!C.grammar){k(r.util.encode(C.code));return}if(_&&t.Worker){var T=new Worker(r.filename);T.onmessage=function(w){k(w.data)},T.postMessage(JSON.stringify({language:C.language,code:C.code,immediateClose:!0}))}else k(r.highlight(C.code,C.grammar,C.language))},highlight:function(m,_,b){var y={code:m,grammar:_,language:b};if(r.hooks.run("before-tokenize",y),!y.grammar)throw new Error('The language "'+y.language+'" has no grammar.');return y.tokens=r.tokenize(y.code,y.grammar),r.hooks.run("after-tokenize",y),i.stringify(r.util.encode(y.tokens),y.language)},tokenize:function(m,_){var b=_.rest;if(b){for(var y in b)_[y]=b[y];delete _.rest}var x=new l;return c(x,x.head,m),a(m,x,_,x.head,0),u(x)},hooks:{all:{},add:function(m,_){var b=r.hooks.all;b[m]=b[m]||[],b[m].push(_)},run:function(m,_){var b=r.hooks.all[m];if(!(!b||!b.length))for(var y=0,x;x=b[y++];)x(_)}},Token:i};t.Prism=r;function i(m,_,b,y){this.type=m,this.content=_,this.alias=b,this.length=(y||"").length|0}i.stringify=function m(_,b){if(typeof _=="string")return _;if(Array.isArray(_)){var y="";return _.forEach(function(k){y+=m(k,b)}),y}var x={type:_.type,content:m(_.content,b),tag:"span",classes:["token",_.type],attributes:{},language:b},v=_.alias;v&&(Array.isArray(v)?Array.prototype.push.apply(x.classes,v):x.classes.push(v)),r.hooks.run("wrap",x);var E="";for(var C in x.attributes)E+=" "+C+'="'+(x.attributes[C]||"").replace(/"/g,""")+'"';return"<"+x.tag+' class="'+x.classes.join(" ")+'"'+E+">"+x.content+"</"+x.tag+">"};function s(m,_,b,y){m.lastIndex=_;var x=m.exec(b);if(x&&y&&x[1]){var v=x[1].length;x.index+=v,x[0]=x[0].slice(v)}return x}function a(m,_,b,y,x,v){for(var E in b)if(!(!b.hasOwnProperty(E)||!b[E])){var C=b[E];C=Array.isArray(C)?C:[C];for(var k=0;k<C.length;++k){if(v&&v.cause==E+","+k)return;var T=C[k],w=T.inside,S=!!T.lookbehind,N=!!T.greedy,D=T.alias;if(N&&!T.pattern.global){var O=T.pattern.toString().match(/[imsuy]*$/)[0];T.pattern=RegExp(T.pattern.source,O+"g")}for(var M=T.pattern||T,I=y.next,L=x;I!==_.tail&&!(v&&L>=v.reach);L+=I.value.length,I=I.next){var K=I.value;if(_.length>m.length)return;if(!(K instanceof i)){var W=1,q;if(N){if(q=s(M,L,m,S),!q||q.index>=m.length)break;var _t=q.index,B=q.index+q[0].length,se=L;for(se+=I.value.length;_t>=se;)I=I.next,se+=I.value.length;if(se-=I.value.length,L=se,I.value instanceof i)continue;for(var me=I;me!==_.tail&&(se<B||typeof me.value=="string");me=me.next)W++,se+=me.value.length;W--,K=m.slice(L,se),q.index-=L}else if(q=s(M,0,K,S),!q)continue;var _t=q.index,Zt=q[0],ut=K.slice(0,_t),bt=K.slice(_t+Zt.length),sn=L+K.length;v&&sn>v.reach&&(v.reach=sn);var ye=I.prev;ut&&(ye=c(_,ye,ut),L+=ut.length),d(_,ye,W);var Xe=new i(E,w?r.tokenize(Zt,w):Zt,D,Zt);if(I=c(_,ye,Xe),bt&&c(_,I,bt),W>1){var st={cause:E+","+k,reach:sn};a(m,_,b,I.prev,L,st),v&&st.reach>v.reach&&(v.reach=st.reach)}}}}}}function l(){var m={value:null,prev:null,next:null},_={value:null,prev:m,next:null};m.next=_,this.head=m,this.tail=_,this.length=0}function c(m,_,b){var y=_.next,x={value:b,prev:_,next:y};return _.next=x,y.prev=x,m.length++,x}function d(m,_,b){for(var y=_.next,x=0;x<b&&y!==m.tail;x++)y=y.next;_.next=y,y.prev=_,m.length-=x}function u(m){for(var _=[],b=m.head.next;b!==m.tail;)_.push(b.value),b=b.next;return _}if(!t.document)return t.addEventListener&&(r.disableWorkerMessageHandler||t.addEventListener("message",function(m){var _=JSON.parse(m.data),b=_.language,y=_.code,x=_.immediateClose;t.postMessage(r.highlight(y,r.languages[b],b)),x&&t.close()},!1)),r;var p=r.util.currentScript();p&&(r.filename=p.src,p.hasAttribute("data-manual")&&(r.manual=!0));function f(){r.manual||r.highlightAll()}if(!r.manual){var h=document.readyState;h==="loading"||h==="interactive"&&p&&p.defer?document.addEventListener("DOMContentLoaded",f):window.requestAnimationFrame?window.requestAnimationFrame(f):window.setTimeout(f,16)}return r})(nV);typeof Hf<"u"&&Hf.exports&&(Hf.exports=oe);typeof global<"u"&&(global.Prism=oe);oe.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};oe.languages.markup.tag.inside["attr-value"].inside.entity=oe.languages.markup.entity;oe.languages.markup.doctype.inside["internal-subset"].inside=oe.languages.markup;oe.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.replace(/&/,"&"))});Object.defineProperty(oe.languages.markup.tag,"addInlined",{value:function(e,n){var o={};o["language-"+n]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:oe.languages[n]},o.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:o}};r["language-"+n]={pattern:/[\s\S]+/,inside:oe.languages[n]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:r},oe.languages.insertBefore("markup","cdata",i)}});Object.defineProperty(oe.languages.markup.tag,"addAttribute",{value:function(t,e){oe.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:oe.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});oe.languages.html=oe.languages.markup;oe.languages.mathml=oe.languages.markup;oe.languages.svg=oe.languages.markup;oe.languages.xml=oe.languages.extend("markup",{});oe.languages.ssml=oe.languages.xml;oe.languages.atom=oe.languages.xml;oe.languages.rss=oe.languages.xml;(function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var n=t.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))})(oe);oe.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};oe.languages.javascript=oe.languages.extend("clike",{"class-name":[oe.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});oe.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;oe.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:oe.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:oe.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:oe.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:oe.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:oe.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});oe.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:oe.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});oe.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});oe.languages.markup&&(oe.languages.markup.tag.addInlined("script","javascript"),oe.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));oe.languages.js=oe.languages.javascript;(function(){if(typeof oe>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var t="Loading\u2026",e=function(p,f){return"\u2716 Error "+p+" while fetching file: "+f},n="\u2716 Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},r="data-src-status",i="loading",s="loaded",a="failed",l="pre[data-src]:not(["+r+'="'+s+'"]):not(['+r+'="'+i+'"])';function c(p,f,h){var m=new XMLHttpRequest;m.open("GET",p,!0),m.onreadystatechange=function(){m.readyState==4&&(m.status<400&&m.responseText?f(m.responseText):m.status>=400?h(e(m.status,m.statusText)):h(n))},m.send(null)}function d(p){var f=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(p||"");if(f){var h=Number(f[1]),m=f[2],_=f[3];return m?_?[h,Number(_)]:[h,void 0]:[h,h]}}oe.hooks.add("before-highlightall",function(p){p.selector+=", "+l}),oe.hooks.add("before-sanity-check",function(p){var f=p.element;if(f.matches(l)){p.code="",f.setAttribute(r,i);var h=f.appendChild(document.createElement("CODE"));h.textContent=t;var m=f.getAttribute("data-src"),_=p.language;if(_==="none"){var b=(/\.(\w+)$/.exec(m)||[,"none"])[1];_=o[b]||b}oe.util.setLanguage(h,_),oe.util.setLanguage(f,_);var y=oe.plugins.autoloader;y&&y.loadLanguages(_),c(m,function(x){f.setAttribute(r,s);var v=d(f.getAttribute("data-range"));if(v){var E=x.split(/\r\n?|\n/g),C=v[0],k=v[1]==null?E.length:v[1];C<0&&(C+=E.length),C=Math.max(0,Math.min(C-1,E.length)),k<0&&(k+=E.length),k=Math.max(0,Math.min(k,E.length)),x=E.slice(C,k).join(`
|
|
1
|
+
import{c as gE,e as OE}from"./chunk-HHMG665Z.js";import{a as CE,b as EE}from"./chunk-YFA6U2CV.js";import{a as bE}from"./chunk-4W73RW5I.js";import{a as mE,b as _E,c as _h}from"./chunk-P3NETZZP.js";import{a as Rd}from"./chunk-QGBR3J2Y.js";import{a as DE}from"./chunk-KFAZBEPV.js";import{a as cE,d as uE}from"./chunk-PHBMVORG.js";import{a as sE,d as mh}from"./chunk-JZFTZ4X4.js";import{b as aE,d as lE}from"./chunk-HKINZLMW.js";import{a as wE,b as pr,c as Zs,d as TE,e as $d,f as Hn,g as SE,i as Fo,j as en,l as zd}from"./chunk-TJBVMFNQ.js";import{a as Pd}from"./chunk-CGCKJFL4.js";import{a as ur}from"./chunk-VMT7JFAM.js";import{f as Js,j as dE}from"./chunk-SKEP5WYH.js";import{a as xC,d as yE,e as xE,h as NE}from"./chunk-7UIUAHC4.js";import{g as fE,h as Xs,i as hE}from"./chunk-P4U2LUTF.js";import{c as bC,d as yC,f as _d}from"./chunk-3IYZCUPI.js";import{a as pE}from"./chunk-X2WHBGTP.js";import{a as Bd,b as vE,c as kE}from"./chunk-ONTGW2VA.js";import{a as Fd}from"./chunk-L4RHGQUG.js";import{a as Mt,c as at}from"./chunk-HRGYNHZ3.js";import{a as Us,b as js,c as ud,d as aC}from"./chunk-W3HIZQ4Z.js";import{c as oC}from"./chunk-JDW4UORS.js";import{A as mC,D as gd,E as md,a as pd,b as Cl,e as cC,g as dC,p as uC,q as pC,t as Vs,v as fC,x as hC,y as hd,z as gC}from"./chunk-AFWBSIPL.js";import{b as fd,e as ah,f as dr,h as lC}from"./chunk-XOQ3KDSR.js";import{a as ih,b as cr}from"./chunk-62UWGWON.js";import{a as ve,b as yt,c as Jv}from"./chunk-I6ICVKEC.js";import{a as Ui}from"./chunk-HLMBCVRX.js";import{a as sh,d as rC,e as iC,f as sC}from"./chunk-ORXEMIQC.js";import{a as Ws,b as Po,e as Ze,g as _C}from"./chunk-5MV6XVGA.js";import{a as dd,c as Xv,e as Zv,p as Qv,q as eC,r as tC,u as rh}from"./chunk-EGEB6N4J.js";import{d as nC,f as Se}from"./chunk-AL3TN2KI.js";import{$ as Ks,$a as to,$b as Sd,Aa as Ro,Ab as MC,Ac as Dd,Bc as nE,Ca as qr,Cb as AC,Cc as oE,Ec as qs,Fa as cd,Fb as LC,Ga as De,Gb as Ed,Gc as rE,Ha as g,Hb as RC,Hc as Od,Ib as PC,Ic as Id,Ja as lh,Jb as FC,Jc as Md,Ka as vC,Kb as BC,Kc as Ad,Lb as $C,Na as Jr,Ob as uh,Oc as El,Pb as wd,Pc as ho,Qb as zC,Qc as Ld,Ra as Gs,Rb as HC,Sb as Hi,Tb as KC,U as oh,Ua as bd,Ub as UC,Uc as gh,V as Qt,Va as ch,W as Pe,Wa as CC,Xb as Td,Y as sr,Ya as EC,Yb as jC,Yc as iE,Zb as VC,_a as zi,_b as WC,a as R,ab as wC,b as $v,ba as Vv,bb as TC,bc as GC,c as P,cb as SC,d as un,db as kC,dc as YC,e as Y,ea as ee,eb as yd,fa as Ao,fb as dh,g as J,ga as ar,h as we,hb as xd,i as It,ic as qC,j as ke,jc as ph,k as zv,kb as vd,kc as kd,l as Hv,m as $i,ma as sd,mb as NC,nc as JC,o as Kv,oa as Lo,oc as XC,pa as ad,q as Yr,qa as Wv,qc as ZC,r as Uv,ra as X,rb as DC,rc as QC,s as jv,sa as ld,sc as eE,ta as Gv,u as vl,ub as Cd,v as et,va as lr,vc as Ki,w as Hs,wa as Yv,wc as fh,x as th,xb as Ys,xc as Nd,y as pt,yb as OC,yc as hh,z as nh,za as qv,zb as IC,zc as tE}from"./chunk-NZHF733K.js";import{b as Bi,d as Me,e as Bv,j as Ot,k as zs}from"./chunk-KUCVLANF.js";import{b as Qf,c as Re,d as eh,e as GL}from"./chunk-PVAE643M.js";var t0=Qf(e0=>{"use strict";var wl=(pt(),GL(th));function SR(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var kR=typeof Object.is=="function"?Object.is:SR,NR=wl.useSyncExternalStore,DR=wl.useRef,OR=wl.useEffect,IR=wl.useMemo,MR=wl.useDebugValue;e0.useSyncExternalStoreWithSelector=function(t,e,n,o,r){var i=DR(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=IR(function(){function l(f){if(!c){if(c=!0,d=f,f=o(f),r!==void 0&&s.hasValue){var h=s.value;if(r(h,f))return u=h}return u=f}if(h=u,kR(d,f))return h;var m=o(f);return r!==void 0&&r(h,m)?(d=f,h):(d=f,u=m)}var c=!1,d,u,p=n===void 0?null:n;return[function(){return l(e())},p===null?void 0:function(){return l(p())}]},[e,n,o,r]);var a=NR(t,i[0],i[1]);return OR(function(){s.hasValue=!0,s.value=a},[a]),MR(a),a}});var o0=Qf((k9,n0)=>{"use strict";n0.exports=t0()});var mv=Qf((pse,Hf)=>{"use strict";var nV=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var oe=(function(t){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,o={},r={manual:t.Prism&&t.Prism.manual,disableWorkerMessageHandler:t.Prism&&t.Prism.disableWorkerMessageHandler,util:{encode:function m(_){return _ instanceof i?new i(_.type,m(_.content),_.alias):Array.isArray(_)?_.map(m):_.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(m){return Object.prototype.toString.call(m).slice(8,-1)},objId:function(m){return m.__id||Object.defineProperty(m,"__id",{value:++n}),m.__id},clone:function m(_,b){b=b||{};var y,x;switch(r.util.type(_)){case"Object":if(x=r.util.objId(_),b[x])return b[x];y={},b[x]=y;for(var v in _)_.hasOwnProperty(v)&&(y[v]=m(_[v],b));return y;case"Array":return x=r.util.objId(_),b[x]?b[x]:(y=[],b[x]=y,_.forEach(function(E,C){y[C]=m(E,b)}),y);default:return _}},getLanguage:function(m){for(;m;){var _=e.exec(m.className);if(_)return _[1].toLowerCase();m=m.parentElement}return"none"},setLanguage:function(m,_){m.className=m.className.replace(RegExp(e,"gi"),""),m.classList.add("language-"+_)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(y){var m=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(y.stack)||[])[1];if(m){var _=document.getElementsByTagName("script");for(var b in _)if(_[b].src==m)return _[b]}return null}},isActive:function(m,_,b){for(var y="no-"+_;m;){var x=m.classList;if(x.contains(_))return!0;if(x.contains(y))return!1;m=m.parentElement}return!!b}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(m,_){var b=r.util.clone(r.languages[m]);for(var y in _)b[y]=_[y];return b},insertBefore:function(m,_,b,y){y=y||r.languages;var x=y[m],v={};for(var E in x)if(x.hasOwnProperty(E)){if(E==_)for(var C in b)b.hasOwnProperty(C)&&(v[C]=b[C]);b.hasOwnProperty(E)||(v[E]=x[E])}var k=y[m];return y[m]=v,r.languages.DFS(r.languages,function(T,w){w===k&&T!=m&&(this[T]=v)}),v},DFS:function m(_,b,y,x){x=x||{};var v=r.util.objId;for(var E in _)if(_.hasOwnProperty(E)){b.call(_,E,_[E],y||E);var C=_[E],k=r.util.type(C);k==="Object"&&!x[v(C)]?(x[v(C)]=!0,m(C,b,null,x)):k==="Array"&&!x[v(C)]&&(x[v(C)]=!0,m(C,b,E,x))}}},plugins:{},highlightAll:function(m,_){r.highlightAllUnder(document,m,_)},highlightAllUnder:function(m,_,b){var y={callback:b,container:m,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",y),y.elements=Array.prototype.slice.apply(y.container.querySelectorAll(y.selector)),r.hooks.run("before-all-elements-highlight",y);for(var x=0,v;v=y.elements[x++];)r.highlightElement(v,_===!0,y.callback)},highlightElement:function(m,_,b){var y=r.util.getLanguage(m),x=r.languages[y];r.util.setLanguage(m,y);var v=m.parentElement;v&&v.nodeName.toLowerCase()==="pre"&&r.util.setLanguage(v,y);var E=m.textContent,C={element:m,language:y,grammar:x,code:E};function k(w){C.highlightedCode=w,r.hooks.run("before-insert",C),C.element.innerHTML=C.highlightedCode,r.hooks.run("after-highlight",C),r.hooks.run("complete",C),b&&b.call(C.element)}if(r.hooks.run("before-sanity-check",C),v=C.element.parentElement,v&&v.nodeName.toLowerCase()==="pre"&&!v.hasAttribute("tabindex")&&v.setAttribute("tabindex","0"),!C.code){r.hooks.run("complete",C),b&&b.call(C.element);return}if(r.hooks.run("before-highlight",C),!C.grammar){k(r.util.encode(C.code));return}if(_&&t.Worker){var T=new Worker(r.filename);T.onmessage=function(w){k(w.data)},T.postMessage(JSON.stringify({language:C.language,code:C.code,immediateClose:!0}))}else k(r.highlight(C.code,C.grammar,C.language))},highlight:function(m,_,b){var y={code:m,grammar:_,language:b};if(r.hooks.run("before-tokenize",y),!y.grammar)throw new Error('The language "'+y.language+'" has no grammar.');return y.tokens=r.tokenize(y.code,y.grammar),r.hooks.run("after-tokenize",y),i.stringify(r.util.encode(y.tokens),y.language)},tokenize:function(m,_){var b=_.rest;if(b){for(var y in b)_[y]=b[y];delete _.rest}var x=new l;return c(x,x.head,m),a(m,x,_,x.head,0),u(x)},hooks:{all:{},add:function(m,_){var b=r.hooks.all;b[m]=b[m]||[],b[m].push(_)},run:function(m,_){var b=r.hooks.all[m];if(!(!b||!b.length))for(var y=0,x;x=b[y++];)x(_)}},Token:i};t.Prism=r;function i(m,_,b,y){this.type=m,this.content=_,this.alias=b,this.length=(y||"").length|0}i.stringify=function m(_,b){if(typeof _=="string")return _;if(Array.isArray(_)){var y="";return _.forEach(function(k){y+=m(k,b)}),y}var x={type:_.type,content:m(_.content,b),tag:"span",classes:["token",_.type],attributes:{},language:b},v=_.alias;v&&(Array.isArray(v)?Array.prototype.push.apply(x.classes,v):x.classes.push(v)),r.hooks.run("wrap",x);var E="";for(var C in x.attributes)E+=" "+C+'="'+(x.attributes[C]||"").replace(/"/g,""")+'"';return"<"+x.tag+' class="'+x.classes.join(" ")+'"'+E+">"+x.content+"</"+x.tag+">"};function s(m,_,b,y){m.lastIndex=_;var x=m.exec(b);if(x&&y&&x[1]){var v=x[1].length;x.index+=v,x[0]=x[0].slice(v)}return x}function a(m,_,b,y,x,v){for(var E in b)if(!(!b.hasOwnProperty(E)||!b[E])){var C=b[E];C=Array.isArray(C)?C:[C];for(var k=0;k<C.length;++k){if(v&&v.cause==E+","+k)return;var T=C[k],w=T.inside,S=!!T.lookbehind,N=!!T.greedy,D=T.alias;if(N&&!T.pattern.global){var O=T.pattern.toString().match(/[imsuy]*$/)[0];T.pattern=RegExp(T.pattern.source,O+"g")}for(var M=T.pattern||T,I=y.next,L=x;I!==_.tail&&!(v&&L>=v.reach);L+=I.value.length,I=I.next){var K=I.value;if(_.length>m.length)return;if(!(K instanceof i)){var W=1,q;if(N){if(q=s(M,L,m,S),!q||q.index>=m.length)break;var _t=q.index,B=q.index+q[0].length,se=L;for(se+=I.value.length;_t>=se;)I=I.next,se+=I.value.length;if(se-=I.value.length,L=se,I.value instanceof i)continue;for(var me=I;me!==_.tail&&(se<B||typeof me.value=="string");me=me.next)W++,se+=me.value.length;W--,K=m.slice(L,se),q.index-=L}else if(q=s(M,0,K,S),!q)continue;var _t=q.index,Zt=q[0],ut=K.slice(0,_t),bt=K.slice(_t+Zt.length),sn=L+K.length;v&&sn>v.reach&&(v.reach=sn);var ye=I.prev;ut&&(ye=c(_,ye,ut),L+=ut.length),d(_,ye,W);var Xe=new i(E,w?r.tokenize(Zt,w):Zt,D,Zt);if(I=c(_,ye,Xe),bt&&c(_,I,bt),W>1){var st={cause:E+","+k,reach:sn};a(m,_,b,I.prev,L,st),v&&st.reach>v.reach&&(v.reach=st.reach)}}}}}}function l(){var m={value:null,prev:null,next:null},_={value:null,prev:m,next:null};m.next=_,this.head=m,this.tail=_,this.length=0}function c(m,_,b){var y=_.next,x={value:b,prev:_,next:y};return _.next=x,y.prev=x,m.length++,x}function d(m,_,b){for(var y=_.next,x=0;x<b&&y!==m.tail;x++)y=y.next;_.next=y,y.prev=_,m.length-=x}function u(m){for(var _=[],b=m.head.next;b!==m.tail;)_.push(b.value),b=b.next;return _}if(!t.document)return t.addEventListener&&(r.disableWorkerMessageHandler||t.addEventListener("message",function(m){var _=JSON.parse(m.data),b=_.language,y=_.code,x=_.immediateClose;t.postMessage(r.highlight(y,r.languages[b],b)),x&&t.close()},!1)),r;var p=r.util.currentScript();p&&(r.filename=p.src,p.hasAttribute("data-manual")&&(r.manual=!0));function f(){r.manual||r.highlightAll()}if(!r.manual){var h=document.readyState;h==="loading"||h==="interactive"&&p&&p.defer?document.addEventListener("DOMContentLoaded",f):window.requestAnimationFrame?window.requestAnimationFrame(f):window.setTimeout(f,16)}return r})(nV);typeof Hf<"u"&&Hf.exports&&(Hf.exports=oe);typeof global<"u"&&(global.Prism=oe);oe.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};oe.languages.markup.tag.inside["attr-value"].inside.entity=oe.languages.markup.entity;oe.languages.markup.doctype.inside["internal-subset"].inside=oe.languages.markup;oe.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.replace(/&/,"&"))});Object.defineProperty(oe.languages.markup.tag,"addInlined",{value:function(e,n){var o={};o["language-"+n]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:oe.languages[n]},o.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:o}};r["language-"+n]={pattern:/[\s\S]+/,inside:oe.languages[n]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:r},oe.languages.insertBefore("markup","cdata",i)}});Object.defineProperty(oe.languages.markup.tag,"addAttribute",{value:function(t,e){oe.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:oe.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});oe.languages.html=oe.languages.markup;oe.languages.mathml=oe.languages.markup;oe.languages.svg=oe.languages.markup;oe.languages.xml=oe.languages.extend("markup",{});oe.languages.ssml=oe.languages.xml;oe.languages.atom=oe.languages.xml;oe.languages.rss=oe.languages.xml;(function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var n=t.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))})(oe);oe.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};oe.languages.javascript=oe.languages.extend("clike",{"class-name":[oe.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});oe.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;oe.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:oe.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:oe.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:oe.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:oe.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:oe.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});oe.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:oe.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});oe.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});oe.languages.markup&&(oe.languages.markup.tag.addInlined("script","javascript"),oe.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));oe.languages.js=oe.languages.javascript;(function(){if(typeof oe>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var t="Loading\u2026",e=function(p,f){return"\u2716 Error "+p+" while fetching file: "+f},n="\u2716 Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},r="data-src-status",i="loading",s="loaded",a="failed",l="pre[data-src]:not(["+r+'="'+s+'"]):not(['+r+'="'+i+'"])';function c(p,f,h){var m=new XMLHttpRequest;m.open("GET",p,!0),m.onreadystatechange=function(){m.readyState==4&&(m.status<400&&m.responseText?f(m.responseText):m.status>=400?h(e(m.status,m.statusText)):h(n))},m.send(null)}function d(p){var f=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(p||"");if(f){var h=Number(f[1]),m=f[2],_=f[3];return m?_?[h,Number(_)]:[h,void 0]:[h,h]}}oe.hooks.add("before-highlightall",function(p){p.selector+=", "+l}),oe.hooks.add("before-sanity-check",function(p){var f=p.element;if(f.matches(l)){p.code="",f.setAttribute(r,i);var h=f.appendChild(document.createElement("CODE"));h.textContent=t;var m=f.getAttribute("data-src"),_=p.language;if(_==="none"){var b=(/\.(\w+)$/.exec(m)||[,"none"])[1];_=o[b]||b}oe.util.setLanguage(h,_),oe.util.setLanguage(f,_);var y=oe.plugins.autoloader;y&&y.loadLanguages(_),c(m,function(x){f.setAttribute(r,s);var v=d(f.getAttribute("data-range"));if(v){var E=x.split(/\r\n?|\n/g),C=v[0],k=v[1]==null?E.length:v[1];C<0&&(C+=E.length),C=Math.max(0,Math.min(C-1,E.length)),k<0&&(k+=E.length),k=Math.max(0,Math.min(k,E.length)),x=E.slice(C,k).join(`
|
|
2
2
|
`),f.hasAttribute("data-start")||f.setAttribute("data-start",String(C+1))}h.textContent=x,oe.highlightElement(h)},function(x){f.setAttribute(r,a),h.textContent=x})}}),oe.plugins.fileHighlight={highlight:function(f){for(var h=(f||document).querySelectorAll(l),m=0,_;_=h[m++];)oe.highlightElement(_)}};var u=!1;oe.fileHighlight=function(){u||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),u=!0),oe.plugins.fileHighlight.highlight.apply(this,arguments)}})()});ke();ke();ke();function Hd(t){return g(Ki,{className:t.className,size:t.size})}function LE(t){let[e,n]=R(null),[o,r]=R("");if(P(()=>{let a=!0;return fetch("/cms/api/ai.config",{credentials:"include"}).then(async l=>{let c=await l.json();a&&n(c)}).catch(l=>{a&&r(String(l))}),()=>{a=!1}},[]),!e&&!o)return g("div",{className:"AiEditModal__ChatPanel__loading",children:g(Qt,{size:"sm",color:"gray"})});if(!(!!e?.enabled&&(e.models?.length||0)>0))return g("div",{className:"AiEditModal__ChatPanel__notConfigured",children:[g("div",{className:"AiEditModal__ChatPanel__notConfigured__icon",children:g(Ki,{size:32})}),g("div",{className:"AiEditModal__ChatPanel__notConfigured__title",children:"Root AI is not configured for this project."}),g("div",{className:"AiEditModal__ChatPanel__notConfigured__body",children:["Add an ",g("code",{children:"ai.models"})," entry to ",g("code",{children:"cmsPlugin()"})," in"," ",g("code",{children:"root.config.ts"}),"."]}),o&&g("pre",{className:"AiEditModal__ChatPanel__notConfigured__error",children:o})]});let s=e.models.find(a=>a.id===e.defaultModel)||e.models[0];return g(YL,{model:s,editModeData:t.editModeData,onEditModeResponse:t.onEditModeResponse,welcome:t.children})}function YL(t){let e=Y(t.editModeData);e.current=t.editModeData;let n=J(()=>new aE({api:"/cms/api/ai.edit_object",credentials:"include",prepareSendMessagesRequest:({messages:p})=>({body:{messages:p,modelId:t.model.id,editData:e.current}})}),[t.model.id]),o=Y(t.onEditModeResponse);o.current=t.onEditModeResponse;let r=Y(new Map),{messages:i,sendMessage:s,status:a,error:l,stop:c,addToolOutput:d}=cE({transport:n,sendAutomaticallyWhen:lE,onToolCall:async({toolCall:p})=>{let f=await uE(p.toolName,p.input);d({tool:p.toolName,toolCallId:p.toolCallId,output:f})}}),u=a==="streaming"||a==="submitted";return P(()=>{let p=o.current;if(p)for(let f=i.length-1;f>=0;f--){let h=i[f];if(h.role!=="assistant")continue;let m=aR(h),_=lR(m);if(!_||r.current.get(h.id)===_)return;try{let y=JSON.parse(_);y&&typeof y=="object"&&(r.current.set(h.id,_),p({message:"",data:y}))}catch{}return}},[i]),g(Me,{children:[g(qL,{messages:i,isStreaming:u,welcome:t.welcome}),l&&g("div",{className:"AiEditModal__ChatPanel__error",children:[g("strong",{children:"Error:"})," ",l.message]}),g(tR,{canAttach:t.model.capabilities.attachments,isStreaming:u,onStop:c,onSend:(p,f)=>{if(!p&&f.length===0)return;let h=nR(f),m=[p,h.text].filter(Boolean).join(`
|
|
3
3
|
|
|
4
4
|
`);s({text:m,files:h.files.map(_=>({type:"file",mediaType:_.mediaType,url:_.url,filename:_.filename}))})}})]})}function qL(t){let e=Y(null);return P(()=>{let n=e.current;n&&(n.scrollTop=n.scrollHeight)},[t.messages]),t.messages.length===0?g("div",{className:"AiEditModal__ChatPanel__transcript AiEditModal__ChatPanel__transcript--empty",ref:e,children:g("div",{className:"AiEditModal__ChatPanel__welcome",children:[g("div",{className:"AiEditModal__ChatPanel__welcome__icon",children:g(Hd,{})}),g("div",{className:"AiEditModal__ChatPanel__welcome__title",children:"Edit with Root AI"}),t.welcome&&g("div",{className:"AiEditModal__ChatPanel__welcome__body",children:t.welcome})]})}):g("div",{className:"AiEditModal__ChatPanel__transcript",ref:e,children:g("div",{className:"AiEditModal__ChatPanel__transcript__inner",children:[t.messages.map(n=>g(JL,{message:n},n.id)),t.isStreaming&&g("div",{className:"AiEditModal__ChatPanel__streamingIndicator",children:[g(Qt,{size:"xs",color:"gray"}),g("span",{children:"Thinking\u2026"})]})]})})}function JL(t){let e=t.message,n=e.role==="user",o=n?"You":"Root AI",r=n?window.firebase.user?.photoURL:null;return g("div",{className:Se("AiEditModal__ChatPanel__message",`AiEditModal__ChatPanel__message--${e.role}`),children:[g("div",{className:"AiEditModal__ChatPanel__message__avatar",children:r?g("img",{src:r,alt:o}):g(Ki,{size:18})}),g("div",{className:"AiEditModal__ChatPanel__message__body",children:[g("div",{className:"AiEditModal__ChatPanel__message__username",children:o}),g("div",{className:"AiEditModal__ChatPanel__message__parts",children:(e.parts||[]).map((i,s)=>g(XL,{part:i},s))})]})]})}function XL(t){let e=t.part;if(e.type==="text"){if(!e.text)return null;let n=cR(e.text);return n?g("div",{className:"AiEditModal__ChatPanel__textPart",children:g(mh,{code:n})}):null}return e.type==="reasoning"?g(ZL,{text:e.text}):e.type==="file"?g(QL,{part:e}):typeof e.type=="string"&&e.type.startsWith("tool-")?g(IE,{part:e}):e.type==="dynamic-tool"?g(IE,{part:e}):(e.type==="step-start",null)}function ZL(t){let[e,n]=R(!1);return t.text?g("div",{className:Se("AiEditModal__ChatPanel__reasoning",e&&"AiEditModal__ChatPanel__reasoning--open"),children:[g("button",{type:"button",className:"AiEditModal__ChatPanel__reasoning__toggle",onClick:()=>n(!e),children:[g(to,{size:14,style:{transform:e?"rotate(0deg)":"rotate(-90deg)"}}),g("span",{children:"Thinking"})]}),e&&g("div",{className:"AiEditModal__ChatPanel__reasoning__body",children:g(mh,{code:t.text})})]}):null}function QL(t){let e=t.part;return e.mediaType?.startsWith("image/")?g("div",{className:"AiEditModal__ChatPanel__filePart",children:g("img",{src:e.url,alt:e.filename||"attachment"})}):g("a",{className:"AiEditModal__ChatPanel__filePart AiEditModal__ChatPanel__filePart--link",href:e.url,target:"_blank",children:[g(ph,{size:14}),g("span",{children:e.filename||e.url})]})}function IE(t){let e=t.part,n=typeof e.type=="string"&&e.type.startsWith("tool-")?e.type.slice(5):e.toolName||"tool",o=e.state||"",[r,i]=R(!1);return g("div",{className:"AiEditModal__ChatPanel__tool",children:[g("button",{type:"button",className:"AiEditModal__ChatPanel__tool__header",onClick:()=>i(!r),children:[g(El,{size:14}),g("code",{children:n}),g("span",{className:"AiEditModal__ChatPanel__tool__state",children:eR(o)}),g(to,{size:14,style:{marginLeft:"auto",transform:r?"rotate(0deg)":"rotate(-90deg)"}})]}),r&&g("div",{className:"AiEditModal__ChatPanel__tool__body",children:[e.input&&g("details",{open:!0,children:[g("summary",{children:"Input"}),g("pre",{children:JSON.stringify(e.input,null,2)})]}),e.output&&g("details",{open:!0,children:[g("summary",{children:"Output"}),g("pre",{children:JSON.stringify(e.output,null,2)})]}),e.errorText&&g("div",{className:"AiEditModal__ChatPanel__tool__error",children:e.errorText})]})]})}function eR(t){switch(t){case"input-streaming":return"preparing\u2026";case"input-available":return"running\u2026";case"output-available":return"done";case"output-error":return"error";default:return t}}function tR(t){let[e,n]=R(""),[o,r]=R([]),[i,s]=R(!1),a=Y(null),l=Y(null);P(()=>{window.requestAnimationFrame(()=>{let h=l.current;h&&(h.style.height="auto",h.style.height=`${Math.min(h.scrollHeight,200)}px`)})},[e,o]);let d=we(()=>{t.isStreaming||!e&&o.length===0||(t.onSend(e,o),n(""),r([]),a.current&&(a.current.value=""))},[e,o,t.isStreaming]),u=h=>{h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),d())},p=async h=>{s(!0);try{let m=h.type||sR(h.name),_=await rR(h,m),b=await Js(h,{disableGci:!0});r(y=>[...y,{url:b.src,filename:b.filename||h.name,mediaType:m,textContent:_?.text,textTruncated:_?.truncated,width:b.width,height:b.height}])}catch(m){console.error("upload failed",m)}finally{s(!1),a.current&&(a.current.value="")}},f=h=>{let m=h.target;Array.from(m.files||[]).forEach(p)};return g("div",{className:"AiEditModal__ChatPanel__composer",children:[g("div",{className:Se("AiEditModal__ChatPanel__composer__prompt",(i||o.length>0)&&"AiEditModal__ChatPanel__composer__prompt--hasImage"),children:[t.canAttach&&g("label",{className:"AiEditModal__ChatPanel__composer__imageUpload",children:[g("input",{ref:a,type:"file",className:"AiEditModal__ChatPanel__composer__imageUpload__input",onChange:f}),g(De,{label:"Upload file",children:g(Pe,{component:"div",className:"AiEditModal__ChatPanel__composer__imageUpload__icon",radius:"xl",children:g(ph,{size:18})})})]}),g("textarea",{ref:l,className:"AiEditModal__ChatPanel__composer__textInput",placeholder:"Tell me what you want to change...",value:e,rows:1,autofocus:!0,onKeyDown:u,onChange:h=>n(h.target.value),onPaste:h=>{let m=h.clipboardData?.items||[];for(let _ of m)if(_.kind==="file"){let b=_.getAsFile();b&&t.canAttach&&p(b)}}}),(i||o.length>0)&&g("div",{className:"AiEditModal__ChatPanel__composer__attachments",children:[i&&g(Qt,{size:"sm"}),o.map((h,m)=>g(De,{label:h.filename,transition:"pop",position:"top",withArrow:!0,children:g("button",{className:"AiEditModal__ChatPanel__composer__attachment",onClick:()=>r(_=>_.filter((b,y)=>y!==m)),children:[h.mediaType.startsWith("image/")?g("img",{src:h.url,alt:h.filename}):g("span",{className:"AiEditModal__ChatPanel__composer__attachment__name",children:h.filename}),g("div",{className:"AiEditModal__ChatPanel__composer__attachment__close",children:g(gh,{size:20,color:"white"})})]})},m))]}),t.isStreaming?g(Pe,{className:"AiEditModal__ChatPanel__composer__submit",variant:"filled",color:"dark",radius:"xl",onClick:t.onStop,title:"Stop",children:g(gh,{size:18})}):g(Pe,{className:"AiEditModal__ChatPanel__composer__submit",variant:"filled",color:"dark",radius:"xl",disabled:i||!e&&o.length===0,onClick:d,title:"Send",children:g(nE,{size:18})})]}),g("div",{className:"AiEditModal__ChatPanel__composer__disclaimer",children:"Root AI is experimental and makes mistakes. Check all info."})]})}var ME=1e5;function nR(t){let e=t.filter(AE),n=t.filter(o=>!AE(o)).map(oR);return{files:e,text:n.length?`Attached files:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as $}from"./chunk-JHBAMPGB.js";import{a as W}from"./chunk-
|
|
1
|
+
import{a as $}from"./chunk-JHBAMPGB.js";import{a as W}from"./chunk-QGBR3J2Y.js";import{f as U}from"./chunk-3IYZCUPI.js";import{a as B,c as L,d as O,i as A}from"./chunk-RSVO46S3.js";import{a as j,c as q}from"./chunk-ONTGW2VA.js";import{a as H}from"./chunk-L4RHGQUG.js";import{a as T}from"./chunk-JDW4UORS.js";import{b as M}from"./chunk-62UWGWON.js";import{a as v}from"./chunk-I6ICVKEC.js";import{d as k}from"./chunk-AL3TN2KI.js";import{Ga as I,Ha as e,Pc as F,Ra as V,W as p,a as c,aa as D,c as N,e as P,ea as f,j as ie,oa as y,qa as z,va as E}from"./chunk-NZHF733K.js";ie();function R(s){let{route:i}=k(),S=P(null),[Y,d]=c(!1),[w,g]=c(""),[G,h]=c(!!s.releaseId),[J,C]=c(null),[m,x]=c([]),[_,b]=c([]),K=W(),Q=$(),{roles:X}=H(),Z=window.firebase.user.email||"",n=j(X,Z);async function ee(r){console.log(r),await M(async()=>{let t=await L(r);C(t),x(t?.docIds||[]),b(t?.dataSourceIds||[])}),h(!1)}N(()=>{s.releaseId&&(h(!0),ee(s.releaseId))},[s.releaseId]);async function oe(){g("");let r=S.current;function t(l){let u=r.elements[l];return u?u.value.trim():""}let o=s.releaseId||t("id");if(!o){g("missing id");return}if(!T(o)){g("id is invalid (alphanumeric characters and dashes only)");return}let a={id:o,description:t("description"),docIds:m,dataSourceIds:_};try{C(a),d(!0),s.releaseId?(await O(s.releaseId,a),v({title:"Saved release",message:`Updated ${o}`,autoClose:5e3}),d(!1)):(await B(o,a),v({title:"Added release",message:`Successfully added ${o}`,autoClose:5e3}),d(!1)),i(`/cms/releases/${o}`)}catch(l){console.error(l),v({title:"Failed to save release",message:String(l),color:"red",autoClose:!1}),d(!1)}}function ae(){K.open({multiSelect:!0,selectedDocIds:m,onChangeMulti:(r,t)=>{x(o=>{let a=[...o];if(t)a.push(r);else{let l=a.findIndex(u=>u===r);l>-1&&a.splice(l,1)}return console.log(a),a.sort()})}})}function se(){Q.open({selectedDataSourceIds:_,onChange:(r,t)=>{b(o=>{let a=[...o];if(t)a.push(r);else{let l=a.indexOf(r);l>-1&&a.splice(l,1)}return a.sort()})}})}function re(r){console.log("onRemoveDoc()",r),x(t=>{let o=[...t],a=o.indexOf(r);return a!==-1&&o.splice(a,1),console.log(o),o})}function te(r){b(t=>{let o=[...t],a=o.indexOf(r);return a!==-1&&o.splice(a,1),o})}return e("form",{className:"ReleaseForm",ref:S,onSubmit:r=>{r.preventDefault(),oe()},children:[e(z,{visible:G}),e(E,{className:"ReleaseForm__input",name:"id",label:"ID",description:"Unique identifier for the release. Use alphanumeric characters and dashes only, e.g. grogus-favorite-meals",size:"xs",radius:0,defaultValue:s.releaseId||A(),disabled:!!s.releaseId}),e(y,{className:"ReleaseForm__input",name:"description",label:"Description",description:"Optional.",size:"xs",radius:0,value:J?.description,disabled:!n}),e(D,{className:"ReleaseForm__input",label:"Docs",description:"Select one or more docs to add to the release. Note: you can add or edit this list at a later time, if needed.",size:"xs",children:[m.length>0&&e(R.DocPreviewCards,{docIds:m,onRemoveDoc:re,canEdit:n}),e(f,{className:"ReleaseForm__docSelectButton",color:"dark",size:"xs",onClick:()=>ae(),disabled:!n,children:"Select"})]}),e(D,{className:"ReleaseForm__input",label:"Data Sources",description:"Optional. Data sources to publish with the release.",size:"xs",children:[_.length>0&&e(R.DataSourceIds,{ids:_,onRemove:te,canEdit:n}),e(f,{className:"ReleaseForm__docSelectButton",color:"dark",size:"xs",onClick:()=>se(),disabled:!n,children:"Select"})]}),e("div",{className:"ReleaseForm__submit__buttons",children:e(q,{label:"You don't have access to create or edit releases",condition:!n,children:e("span",{children:e(f,{className:"ReleaseForm__submit",color:"blue",size:"xs",type:"submit",loading:Y,disabled:!n,children:s.buttonLabel||"Save"})})})}),w&&e("div",{className:"ReleaseForm__error",children:["Error: ",w]})]})}R.DocPreviewCards=s=>e("div",{className:"ReleaseForm__DocPreviewCards",children:s.docIds.map(i=>e("div",{className:"ReleaseForm__DocPreviewCards__card",children:[e(U,{className:"ReleaseForm__DocPreviewCards__card__preview",docId:i}),e("div",{className:"ReleaseForm__DocPreviewCards__card__controls",children:[s.canEdit&&e("div",{className:"ReleaseForm__DocPreviewCards__card__controls__remove",children:e(I,{label:"Remove",children:e(p,{className:"ReleaseForm__DocPreviewCards__card__controls__remove__icon",onClick:()=>s.onRemoveDoc(i),children:e(F,{size:16})})})}),e("div",{className:"ReleaseForm__DocPreviewCards__card__controls__open",children:e(I,{label:"Open",children:e(p,{component:"a",className:"ReleaseForm__DocPreviewCards__card__controls__open__icon",href:`/cms/content/${i}`,target:"_blank",children:e(V,{size:16})})})})]})]},i))});R.DataSourceIds=s=>e("div",{className:"ReleaseForm__DataSourceIds",children:s.ids.map(i=>e("div",{className:"ReleaseForm__DataSourceIds__item",children:[e("span",{className:"ReleaseForm__DataSourceIds__item__id",children:i}),s.canEdit&&e(p,{className:"ReleaseForm__DataSourceIds__item__remove",onClick:()=>s.onRemove(i),children:e(F,{size:16})})]},i))});export{R as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as se}from"./chunk-54DVDYU6.js";import{a as te,b as R,c as k}from"./chunk-JDW4UORS.js";import{a as ie}from"./chunk-YDO2EDVY.js";import{c as ne,s as re}from"./chunk-AFWBSIPL.js";import{b as oe}from"./chunk-62UWGWON.js";import{a as U}from"./chunk-I6ICVKEC.js";import{a as P}from"./chunk-HLMBCVRX.js";import{a as z}from"./chunk-5MV6XVGA.js";import{b as K,f as H,g as E,i as C,o as Z}from"./chunk-EGEB6N4J.js";import{d as ee,f as ae}from"./chunk-AL3TN2KI.js";import{A as W,Aa as Q,Ha as g,a as p,c as v,e as S,ea as j,g as X,h as N,i as B,j as D,sa as G,va as J}from"./chunk-NZHF733K.js";import{j as q,k as Ee}from"./chunk-KUCVLANF.js";function $(e){let t=window.__ROOT_CTX.collections[e.collectionId];if(!t)throw new Error(`collection not found: ${e.collectionId}`);if(!t.url)return"";let n=t.domain||window.__ROOT_CTX.rootConfig.domain||"https://example.com",r=Ce(e);return`${n}${r}`}function Ce(e){let o=window.__ROOT_CTX.collections,{collectionId:t,slug:n,locale:r}=e,a=o[t];if(!a)throw new Error(`collection not found: ${t}`);if(!a.url)return"";let s=window.__ROOT_CTX.rootConfig,f=s.base||"/",l="/[base]/[path]";r&&(l=s.i18n.urlFormat||"/[locale]/[base]/[path]");let d="",u=a?.url;if(u)if(n){let c=u.replace(/\[.*slug\]/,n).replaceAll("--","/").replace(/\/+/g,"/");c==="/index"&&(c="/"),d=c}else d=u;return le(l,{base:f,path:d,locale:r||"",slug:n})}function ze(e){let o=window.__ROOT_CTX.collections,{collectionId:t,slug:n,locale:r}=e,a=o[t];if(!a)throw new Error(`collection not found: ${t}`);let s=window.__ROOT_CTX.rootConfig,f=s.base||"/",l="/[base]/[path]";r&&(l=s.i18n.urlFormat||"/[locale]/[base]/[path]");let d="",u=a?.previewUrl||a?.url;if(u)if(n){let c=u.replace(/\[.*slug\]/,n).replaceAll("--","/").replace(/\/+/g,"/");c==="/index"&&(c="/"),d=c}else d=u;return le(l,{base:f,path:d,locale:r||"",slug:n})}function le(e,o){let t=e.replaceAll(/\[\[?(\.\.\.)?([\w\-_]*)\]?\]/g,(n,r,a)=>o[a]??n);return ke(t,{trailingSlash:window.__ROOT_CTX.rootConfig.server.trailingSlash})}function ke(e,o){return e=e.replace(/\/+/g,"/"),o?.trailingSlash===!1&&e!=="/"&&e.endsWith("/")&&(e=e.replace(/\/*$/g,"")),(e.endsWith("/index")||e.endsWith("/index/"))&&(e=e.slice(0,-6)),e.startsWith("/")||(e=`/${e}`),o?.trailingSlash&&!e.endsWith("/")&&(e=`${e}/`),e}D();function $e(e,o){let[t,n]=p([]),[r,a]=p(!0),f=se().db,l=window.__ROOT_CTX.rootConfig.projectId||"default",d=o.includeArchived??!1,u=async()=>{a(!0);let c=K(f,"Projects",l,"Collections",e,"Drafts"),i=c,m=o.orderBy;if(m==="modifiedAt")i=E(c,C("sys.modifiedAt","desc"));else if(m==="newest")i=E(c,C("sys.createdAt","desc"));else if(m==="oldest")i=E(c,C("sys.createdAt"));else if(m==="slug")i=E(c,C(H()));else if(m==="slugDesc")i=E(c,C(H(),"desc"));else{let y=window.__ROOT_CTX.collections[e]?.sortOptions?.find(w=>w.id===m);y&&(i=y.direction==="desc"?E(c,C(y.field,"desc")):E(c,C(y.field)))}await oe(async()=>{let h=await Z(i),y=[];h.docs.forEach(w=>{let L=w.data(),b=w.id,_=`${e}/${b}`,x={...L,id:_,slug:b};ne(_,x),!(!d&&x?.sys?.archivedAt)&&y.push(x)}),n(y)}),a(!1)};return v(()=>{a(!0),u()},[e,o.orderBy,d]),[r,u,t]}Ee();D();var O={CONNECTED:"connected",SCHEMA_CHANGED:"schemaChanged"};function ce(e){let t=new URLSearchParams(window.location.search).get("e");return t?t.split(",").includes(e):!1}var _e="/cms/api/sse.connect",I=ce("EnableVerboseLogging"),ue=window.location.hostname==="localhost",F=class{constructor(){this.map=new Map}on(o,t){return this.map.has(o)||this.map.set(o,new Set),this.map.get(o).add(t),()=>{this.map.get(o)?.delete(t)}}emit(o,t,n){this.map.get(o)?.forEach(r=>r(t,n)),this.map.get("*")?.forEach(r=>r({type:o,data:t},n))}},ge=q(null);function Qe(e){let t=S(new F).current,n=S(null),r=S(!1),a=S({attempt:0,timer:0}),s=S(""),f=()=>{n.current&&(n.current.close(),n.current=null)},l=N(()=>{I&&console.log("[sse] connecting..."),f();let u=new EventSource(_e);n.current=u,u.addEventListener(O.CONNECTED,i=>{if(I&&console.log("[sse] connected"),r.current=!1,a.current.attempt=0,ue){let h=de(i.data)?.serverVersion||"";s.current?s.current!==h&&(console.log(`server version changed: ${s.current} -> ${h}`),console.log("reloading..."),window.location.reload()):s.current=h}});let c=i=>{if(!i||!i.type)return;let m=de(i.data);I&&console.log("[sse] event:",i.type,m),t.emit(i.type,m,i)};Object.values(O).forEach(i=>{u.addEventListener(i,c)}),u.addEventListener("error",()=>{I&&console.log("[sse] disconnected"),u.readyState===EventSource.CLOSED&&!r.current&&(r.current=!0,(()=>{let m=++a.current.attempt,h=Math.min(3e4,Math.pow(2,m)*500),y=Math.random()*.3*h,w=h+y;window.clearTimeout(a.current.timer),a.current.timer=window.setTimeout(()=>{r.current=!1,l()},w)})())})},[t]);v(()=>{if(!ue)return;l();let u=()=>{document.visibilityState==="visible"&&n.current?.readyState!==EventSource.OPEN&&l()};return document.addEventListener("visibilitychange",u),()=>{document.removeEventListener("visibilitychange",u),window.clearTimeout(a.current.timer),f()}},[l]);let d=X(()=>({emitter:t}),[t]);return g(ge.Provider,{value:d,children:e.children})}function de(e){try{return JSON.parse(e)}catch{return e}}function fe(e,o){let t=B(ge);if(!t)throw new Error("useSSE() must be used within an <SSEProvider>");let n=S(o);v(()=>{n.current=o},[o]),v(()=>t.emitter.on(e,(r,a)=>n.current(r,a)),[t,e])}D();var me=["agile","amber","amused","ancient","autumn","azure","balmy","beige","big","bitter","black","blue","bold","brave","breezy","bright","brisk","broad","bronze","brown","bubbly","busy","calm","candid","careful","caring","cheerful","cherry","chilly","classic","clean","clear","clever","cloudy","cobalt","cold","cool","cosmic","cosy","cozy","crimson","crisp","cuddly","curious","daring","dark","dawn","dazzling","dear","deep","delicate","dewy","dizzy","dreamy","dry","dusky","dusty","eager","early","earnest","easy","electric","elegant","emerald","empty","epic","even","every","faint","fair","falling","famous","fancy","fast","feisty","fierce","fiery","fine","firm","flat","fluffy","foggy","fond","forest","fragrant","fresh","friendly","frosty","funky","funny","fuzzy","gentle","giant","glad","gleaming","glossy","gold","golden","good","graceful","grand","grassy","gray","green","groovy","happy","hardy","hazy","hearty","heavy","helpful","hidden","high","holy","honest","hopeful","humble","humming","icy","ideal","idle","indigo","inky","iron","ivory","jade","jazzy","jolly","jovial","joyful","juicy","jumpy","keen","kind","lacy","late","lazy","lemon","light","lime","linen","little","lively","lone","long","loud","lovely","loyal","lucid","lucky","lush","magenta","magic","mango","marble","maroon","massive","mauve","mellow","merry","mighty","mild","milky","mindful","minty","misty","mocha","modest","morning","mossy","muddy","mysterious","narrow","navy","neat","neon","new","nimble","noble","noisy","noon","nosy","oaken","odd","old","olive","onyx","opal","open","orange","pale","patient","peach","peachy","pearly","peppy","perky","pink","placid","plain","playful","plucky","plum","plush","polite","proud","pure","purple","quaint","quick","quiet","quirky","rapid","rare","raven","ready","red","restless","rich","rosy","rough","round","royal","ruby","rugged","rustic","sable","safe","sage","salty","sandy","sapphire","savvy","scarlet","secret","sepia","serene","shaggy","sharp","shiny","short","shrewd","shy","silent","silky","silly","silver","simple","sleek","sleepy","slim","slow","small","smart","smoky","smooth","snappy","snowy","soft","solar","solid","spicy","spiffy","spry","square","steady","steel","sticky","still","stony","stormy","strong","sturdy","sunny","super","swank","sweet","swift","tame","tan","tart","teal","tender","thin","thirsty","tidy","tiny","tireless","topaz","tough","tranquil","trim","true","twinkly","umber","upbeat","urban","useful","vast","velvet","vibrant","vintage","violet","vivid","warm","watchful","wavy","wee","whimsical","whispering","white","wild","windy","winter","wise","witty","woody","wool","yellow","young","youthful","zealous","zen","zesty","zippy"],pe=["acorn","alpaca","anchor","apple","apricot","arrow","autumn","badger","bagel","bamboo","banana","bay","beach","bear","bee","beetle","bell","berry","bird","biscuit","blossom","boat","book","boot","bottle","boulder","branch","brass","breeze","bridge","brook","broom","brunch","bubble","bucket","bud","buffalo","bug","bunny","burrow","butter","button","cabin","cactus","cake","camel","candle","canyon","cape","cardinal","carrot","cat","cave","cedar","chair","cherry","chestnut","chickpea","cliff","cloud","clove","clover","cocoa","comet","compass","cookie","coral","cottage","cotton","cove","crane","crayon","creek","cricket","crow","crumpet","crystal","cup","cupcake","currant","cypress","daffodil","dahlia","daisy","dawn","deer","desert","dew","diamond","dingo","dock","dolphin","donut","dove","dragon","drizzle","drum","duck","dumpling","dune","eagle","echo","eel","egg","elder","elephant","elk","ember","ermine","estuary","falcon","fawn","feather","fern","field","fig","finch","fir","firefly","fish","flame","flamingo","flask","flax","fleece","flower","flute","fog","forest","fountain","fox","frog","frost","galaxy","garden","gecko","gem","ginger","glacier","globe","glow","goat","goose","gorge","grape","grass","grove","gull","hammock","hare","harp","harvest","hat","hawk","haystack","hazel","heather","hedge","heron","hill","honey","horizon","horse","iceberg","iris","island","ivy","jacket","jade","jaguar","jam","jar","jasmine","jay","jelly","juniper","kayak","kelp","kettle","key","kingfisher","kite","kitten","koala","ladybug","lagoon","lake","lamp","lantern","lark","lava","leaf","lemon","lemur","leopard","lighthouse","lilac","lily","lime","lion","llama","lobster","log","lotus","lynx","magnet","mango","maple","marble","marlin","meadow","melody","melon","mermaid","meteor","mint","mist","mitten","mole","monkey","moon","moose","morel","moss","moth","mountain","mouse","muffin","mushroom","mussel","nectar","needle","nest","newt","nimbus","noodle","north","note","oak","oasis","oats","ocean","octopus","olive","onion","opal","orange","orchid","otter","owl","oyster","paddle","palm","panda","pansy","panther","paper","parrot","partridge","pasture","path","peach","peacock","pear","pebble","pelican","penguin","peony","pepper","petal","phoenix","pie","pigeon","pine","pineapple","planet","plover","plum","pond","pony","poppy","pouch","prairie","puffin","pumpkin","quail","quartz","queen","quill","rabbit","raccoon","radish","rain","rainbow","raven","reef","reel","reindeer","rhino","ribbon","ridge","river","road","robin","rock","rose","rowan","sage","salmon","sand","sapphire","satellite","scarf","sea","seagull","seal","seed","shark","shell","shore","shrimp","silk","silo","sky","sleet","snail","snake","snow","sock","spark","sparrow","spider","spire","spoon","spring","spruce","squirrel","star","starling","stone","stork","storm","stream","summer","sun","sundial","swan","swift","tadpole","tea","teal","thicket","thistle","thrush","thunder","tide","tiger","toad","tooth","topaz","tortoise","totem","tower","tractor","trail","tree","truffle","tulip","tundra","turtle","twig","twilight","umbrella","unicorn","urchin","valley","vine","violet","volcano","vulture","wagon","walnut","walrus","wasp","water","wave","whale","wheat","whisker","wildcat","willow","wind","window","winter","wolf","wombat","wood","wren","yak","yam","zebra","zinnia"];var he="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",xe="YYYYMMDD";function be(e,o){let t=o?.now??new Date,n=o?.random??Math.random,r=e.replace(/\{([^{}]+?)\}/g,(a,s)=>{let[f,l]=De(s);switch(f){case"date":return Me(t,l||xe);case"adjective":return ye(me,n);case"noun":return ye(pe,n);case"random":return Te(Oe(l,6),n);default:return a}});return k(r.toLowerCase())}function De(e){let o=e.indexOf(":");return o===-1?[e.trim(),void 0]:[e.slice(0,o).trim(),e.slice(o+1)]}function Oe(e,o){if(!e)return o;let t=parseInt(e,10);return Number.isFinite(t)&&t>0?t:o}function ye(e,o){return e[Math.floor(o()*e.length)]}function Te(e,o){let t=[];for(let n=0;n<e;n++)t.push(he.charAt(Math.floor(o()*he.length)));return t.join("")}function Me(e,o){let t={YYYY:String(e.getFullYear()),YY:String(e.getFullYear()).slice(-2),MM:T(e.getMonth()+1),DD:T(e.getDate()),HH:T(e.getHours()),mm:T(e.getMinutes()),ss:T(e.getSeconds())};return o.replace(/YYYY|YY|MM|DD|HH|mm|ss/g,n=>t[n]??n)}function T(e){return e<10?`0${e}`:String(e)}D();function we(e){let[o,t]=p(!0),[n,r]=p(null),a=N(async()=>{try{let s=await ie(e);r(s)}catch(s){console.error(s),U({title:`Failed to load collection: ${e}`,message:String(s),color:"red",autoClose:!1})}t(!1)},[e]);return v(()=>{a()},[e]),fe(O.SCHEMA_CHANGED,async s=>{await a();let f=s.file?`Applied updates from changes to ${s.file}.`:"Applied updates from changes to a .schema.ts file.";U({title:"Updated schema!",message:f})}),{loading:o,schema:n}}function Y(e){let o={_array:[]};return e.forEach(t=>{let n=Ne();o._array.push(n),o[n]=t}),o}function Ne(){let e=[],o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=o.length;for(let n=0;n<6;n++)e.push(o.charAt(Math.floor(Math.random()*t)));return e.join("")}function V(e){let o={};return e.fields.forEach(t=>{t.id&&(t.type==="array"&&t.default&&Array.isArray(t.default)?o[t.id]=Y(t.default):t.default?o[t.id]=t.default:t.type==="object"&&(o[t.id]=V(t)))}),o}function A(e,o,t){let n={...o};return e.fields.forEach(r=>{if(!r.id)return;let a=n[r.id];if(a!=null){if(r.type==="array"&&Array.isArray(a)){let s=a.map(f=>Re(r.of,f,t));n[r.id]=Y(s)}else if(r.type==="object"&&z(a))n[r.id]=A(r,a,t);else if(r.type==="oneof"&&z(a)&&typeof a._type=="string"&&t){let s=t[a._type];s&&(n[r.id]=A(s,a,t))}}}),n}function Re(e,o,t){if(!z(o))return o;if(e.type==="object")return A(e,o,t);if(e.type==="oneof"&&typeof o._type=="string"&&t){let n=t[o._type];if(n)return A(n,o,t)}return o}D();function Se(e){let[o,t]=p(e.collectionId||""),n=S(null),[r,a]=p(e.initialSlug||""),s=window.__ROOT_CTX.collections[o],f=[];e.collectionId&&e.collectionDisabled?f.push({value:e.collectionId,label:e.collectionId}):Object.keys(window.__ROOT_CTX.collections).forEach(i=>{f.push({value:i,label:i})});let l="",d="";if(s?.url){if(r){let i=k(r),m=s?.slugRegex;te(i,m)?l=$({collectionId:o,slug:i}):d=R(i,m)}else l=$({collectionId:o,slug:"[slug]"});l.endsWith("/index")&&(l=l.replace(/\/index$/,"/"))}function u(i){t(i),e.onChange&&e.onChange({collectionId:i,slug:r})}function c(i){a(i),e.onChange&&e.onChange({collectionId:o,slug:i})}return g("div",{className:ae(e.className,"SlugInput"),children:[g("div",{className:"SlugInput__inputs",children:[g(Q,{className:"SlugInput__collection",placeholder:"Collection",size:"xs",data:f,onChange:i=>u(i),value:o,disabled:!!e.collectionDisabled}),g("div",{className:"SlugInput__divider",children:"/"}),g(J,{className:"SlugInput__slug",name:"slug",ref:n,value:r,onChange:i=>{c(i.currentTarget.value)},placeholder:"slug",autoComplete:"off",size:"xs"})]}),l&&g(P,{className:"SlugInput__urlHelp",size:"body-sm",children:l}),d&&g(P,{className:"SlugInput__slugError",size:"body-sm",children:d})]})}function Ut(e){let{route:o}=ee(),t=W(),n=e.collection,r=window.__ROOT_CTX.collections[n];if(!r)throw new Error(`collection not found: ${n}`);let[a]=p(()=>r.autoSlug?be(r.autoSlug):""),[s,f]=p(a),[l,d]=p(!1),[u,c]=p(()=>y(a)),[i,m]=p(""),h=we(n);function y(b){let _=k(b);return _?R(_,r.slugRegex):""}function w(){e.onClose&&e.onClose()}async function L(b){if(b.preventDefault(),d(!0),c(""),y(s)){d(!1);return}let x=k(s),ve=`${n}/${x}`;try{let M={};!h.loading&&h.schema&&(M=await V(h.schema)),await re(ve,{fields:M})}catch(M){m(String(M)),d(!1);return}d(!1),e.skipNavigation?w():o(`/cms/content/${e.collection}/${x}`)}return g(G,{className:"NewDocModal",opened:e.opened||!1,onClose:()=>w(),title:"New",size:"500px",overlayColor:t.colorScheme==="dark"?t.colors.dark[9]:t.colors.gray[2],children:[g("div",{className:"NewDocModal__body",children:"Enter a slug for the new doc. The slug is the ID of the page and is what's used in the URL. Use only lowercase letters, numbers, and dashes."}),g("form",{onSubmit:b=>L(b),children:[g(Se,{className:"NewDocModal__slug",collectionId:n,initialSlug:a,onChange:b=>{f(b.slug),c(y(b.slug)),m("")}}),i&&g("div",{className:"NewDocModal__slugError",children:i}),g("div",{className:"NewDocModal__buttons",children:[g(j,{variant:"outline",onClick:()=>w(),type:"button",size:"xs",color:"dark",children:"Cancel"}),g(j,{variant:"filled",type:"submit",size:"xs",color:"dark",loading:h.loading||l,disabled:!!u||!!i,children:"Submit"})]})]})]})}export{$ as a,Ce as b,ze as c,Se as d,$e as e,Qe as f,we as g,V as h,A as i,Ut as j};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as z,j as I}from"./chunk-
|
|
1
|
+
import{e as z,j as I}from"./chunk-P4U2LUTF.js";import{c as N,e as L}from"./chunk-3IYZCUPI.js";import{a as C}from"./chunk-X2WHBGTP.js";import{a as w,c as y}from"./chunk-HRGYNHZ3.js";import{b as v}from"./chunk-5MV6XVGA.js";import{Aa as f,Ac as B,Ha as e,V as P,a as g,ea as p,g as M,j as x,va as S}from"./chunk-NZHF733K.js";x();x();function O(o,t){return M(()=>{if(!t.trim())return o;let l=t.toLowerCase();return o.filter(c=>{let[a,u]=c.id.split("/"),r=c.fields||{},n=window.__ROOT_CTX.collections[a],s=v(r,n.preview?.title||"meta.title")||"";return c.id.toLowerCase().includes(l)||s.toLowerCase().includes(l)||u.toLowerCase().includes(l)})},[o,t])}var h="DocPickerModal";function ee(){let o=w(),t=y();return{open:l=>{o.openContextModal(h,{...t,innerProps:l,size:"700px",overflow:"inside"})},close:()=>{o.closeModal(h)}}}function k(o){let{innerProps:t}=o,l=Object.keys(window.__ROOT_CTX.collections);t.collections?.length&&(l=l.filter(i=>t.collections?.includes(i)));let c=[{value:"",label:"Select"}];l.forEach(i=>{c.push({value:i,label:i})});let[a,u]=C("DocPickerModal.lastSelectedCollection",""),r=()=>t.initialCollection?t.initialCollection:a&&l.includes(a)?a:l.length===1?l[0]:"",[n,D]=g(r()),s=i=>{D(i),u(i)};function m(i){t.multiSelect&&t.onChangeMulti?t.onChangeMulti(i.id,!0):t.onChange&&t.onChange(i.id)}function b(i){t.multiSelect&&t.onChangeMulti&&t.onChangeMulti(i.id,!1)}return e("div",{className:"DocPickerModal",children:[l.length===0&&e("div",{className:"DocPickerModal__noCollections",children:"No collections matching schema field definition."}),l.length>0&&e(k.DocsList,{collection:n,onDocSelected:m,onDocUnselected:b,onCollectionChange:s,multiSelect:t.multiSelect,selectedDocIds:t.selectedDocIds,options:{enableSearch:t.enableSearch??!0,enableSort:t.enableSort??!0,enableCreate:t.enableCreate??!0,enableStatusBadges:t.enableStatusBadges??!0,showCollectionSelect:l.length>1,collectionSelectValue:n,collectionSelectOptions:c}})]})}k.DocsList=o=>{let[t,l]=g(""),[c,a]=C(`root::DocPickerModal:${o.collection}:sortBy`,"modifiedAt"),[u,r]=g(!1),[n,D,s]=z(o.collection||"",{orderBy:c}),m=O(s,t),b=[{value:"modifiedAt",label:"Last Modified"},{value:"slug",label:"A-Z"},{value:"slugDesc",label:"Z-A"},{value:"newest",label:"Newest"},{value:"oldest",label:"Oldest"}],i=o.selectedDocIds||[],d=o.options||{};return e("div",{className:"DocPickerModal__DocsList",children:[e("div",{className:"DocPickerModal__DocsList__stickyHeader",children:[d.showCollectionSelect&&e("div",{className:"DocPickerModal__collection__select",children:[e("div",{className:"DocPickerModal__collection__select__label",children:"Content Type:"}),e(f,{data:d.collectionSelectOptions||[],value:d.collectionSelectValue,placeholder:"Select",onChange:_=>{o.onCollectionChange?.(_||"")},size:"xs",radius:0,searchable:!0,autoFocus:!0,dropdownComponent:"div"}),d.collectionSelectValue&&e(p,{variant:"outline",color:"dark",size:"xs",onClick:()=>r(!0),children:"New"})]}),d.enableSearch&&d.collectionSelectValue&&e("div",{className:"DocPickerModal__DocsList__controls",children:[e(S,{placeholder:"Search documents...",value:t,onChange:_=>l(_.target.value),icon:e(B,{size:16}),size:"xs",className:"DocPickerModal__DocsList__controls__search"}),d.enableSort&&e(f,{data:b,value:c,onChange:_=>a(_||"modifiedAt"),size:"xs",className:"DocPickerModal__DocsList__controls__sort"})]}),!n&&s.length>0&&e("div",{className:"DocPickerModal__DocsList__count",children:["Showing ",m.length," of ",s.length," documents"]})]}),e("div",{className:"DocPickerModal__DocsList__docsContainer",children:o.collection?n?e("div",{className:"DocPickerModal__DocsList__loading",children:e(P,{color:"gray",size:"xl"})}):m.length===0?e("div",{className:"DocPickerModal__DocsList__empty",children:s.length===0?"Collection is empty.":"No documents match your search."}):e("div",{className:"DocPickerModal__DocsList__docs",children:m.map(_=>e(k.DocCard,{doc:_,onDocSelected:o.onDocSelected,onDocUnselected:o.onDocUnselected,multiSelect:o.multiSelect,selected:i.includes(_.id),enableStatusBadges:d.enableStatusBadges},_.id))}):e("div",{className:"DocPickerModal__DocsList__empty",children:"Select a content type to view documents"})}),d.collectionSelectValue&&e(I,{collection:d.collectionSelectValue,opened:u,skipNavigation:!0,onClose:()=>{r(!1),D()}})]})};k.DocCard=o=>{let[t,l]=g(!!o.selected),c=o.doc,[a,u]=c.id.split("/"),r=c.fields||{},n=window.__ROOT_CTX.collections[a],D=`/cms/content/${a}/${u}`,s=v(r,n.preview?.title||"meta.title"),m=v(r,n.preview?.image||"meta.image")||n.preview?.defaultImage;return e("div",{className:"DocPickerModal__DocCard",children:[e("div",{className:"DocPickerModal__DocCard__image",onClick:()=>window.open(D,"_blank"),children:e(L,{file:m,width:120,height:90,withPlaceholder:!m?.src})}),e("div",{className:"DocPickerModal__DocCard__content",children:[e("div",{className:"DocPickerModal__DocCard__content__header",children:e("div",{className:"DocPickerModal__DocCard__content__header__docId",onClick:()=>window.open(D,"_blank"),children:c.id})}),e("div",{className:"DocPickerModal__DocCard__content__title",children:e("div",{className:"DocPickerModal__DocCard__content__link",onClick:()=>window.open(D,"_blank"),children:s||"[UNTITLED]"})}),o.enableStatusBadges&&e("div",{className:"DocPickerModal__DocCard__content__badges",children:e(N,{doc:c})})]}),e("div",{className:"DocPickerModal__DocCard__controls",children:e("div",{className:"DocPickerModal__DocCard__controls__buttons",children:o.multiSelect?t?e(p,{variant:"light",color:"blue",size:"xs",onClick:()=>{l(!1),o.onDocUnselected(o.doc)},children:"Unselect"}):e(p,{variant:"filled",color:"blue",size:"xs",onClick:()=>{l(!0),o.onDocSelected(o.doc)},children:"Select"}):e(p,{color:"blue",size:"xs",onClick:()=>o.onDocSelected(o.doc),children:"Select"})})})]})};k.id=h;export{ee as a,k as b};
|