@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.
Files changed (42) hide show
  1. package/dist/app.js +2 -1
  2. package/dist/{chunk-RLZFZT42.js → chunk-VSPPZPMP.js} +2 -2
  3. package/dist/core/schema.d.ts +20 -0
  4. package/dist/plugin.js +1 -1
  5. package/dist/shared/auto-slug-words.d.ts +7 -0
  6. package/dist/shared/auto-slug.d.ts +14 -0
  7. package/dist/ui/{AIPage-YI3RFK5F.js → AIPage-F3NNYM5E.js} +1 -1
  8. package/dist/ui/{AssetsPage-4JNAOFYF.js → AssetsPage-DZQHAENZ.js} +1 -1
  9. package/dist/ui/{CollectionPage-JWHH5G55.js → CollectionPage-WVVG62NR.js} +1 -1
  10. package/dist/ui/{ComparePage-YZE3EMU4.js → ComparePage-CRDHP45W.js} +1 -1
  11. package/dist/ui/{DataPage-VRCQSZZG.js → DataPage-WMLBCPGF.js} +1 -1
  12. package/dist/ui/{DataSourcePage-WMSPBZ3W.js → DataSourcePage-POZAQFPU.js} +1 -1
  13. package/dist/ui/{DocTranslationsPage-RY2LOZBX.js → DocTranslationsPage-UR5D2RF2.js} +1 -1
  14. package/dist/ui/DocumentPage-SQ7ROBMC.js +1 -0
  15. package/dist/ui/{EditDataSourcePage-LLCX6K4J.js → EditDataSourcePage-PUA2AJ4C.js} +1 -1
  16. package/dist/ui/{EditReleasePage-WQYXXMZQ.js → EditReleasePage-CENP46EO.js} +1 -1
  17. package/dist/ui/{LogsPage-IP2DKEYR.js → LogsPage-FZRN6MBJ.js} +1 -1
  18. package/dist/ui/{NewDataSourcePage-RDYJC4DH.js → NewDataSourcePage-FTILYFJY.js} +1 -1
  19. package/dist/ui/{NewReleasePage-DGMFU2JN.js → NewReleasePage-MHJC66KK.js} +1 -1
  20. package/dist/ui/{NotFoundPage-WDZ2K7EF.js → NotFoundPage-EP2OE4JV.js} +1 -1
  21. package/dist/ui/{ProjectPage-HYJOQUWR.js → ProjectPage-6J7QCG75.js} +1 -1
  22. package/dist/ui/{ReleasePage-2KSF23TK.js → ReleasePage-IZ3DNGT4.js} +1 -1
  23. package/dist/ui/{ReleasesPage-NZIBBXU4.js → ReleasesPage-RWFOJ5VG.js} +1 -1
  24. package/dist/ui/SettingsPage-M4SIDBTI.js +1 -0
  25. package/dist/ui/{SidebarToolsPage-5C6YBWJ7.js → SidebarToolsPage-GAX3XJ7W.js} +1 -1
  26. package/dist/ui/{TaskPage-SPIFPGPP.js → TaskPage-UCATTNZ5.js} +1 -1
  27. package/dist/ui/{TasksPage-ZOXRPBQV.js → TasksPage-4AQLQ4IT.js} +1 -1
  28. package/dist/ui/{TranslationsArbPage-UHANA7JD.js → TranslationsArbPage-JGQGATCS.js} +1 -1
  29. package/dist/ui/{TranslationsEditPage-PQY6W5YG.js → TranslationsEditPage-7AGZGHKS.js} +1 -1
  30. package/dist/ui/{TranslationsPage-V2PQFCN5.js → TranslationsPage-WIDVSTYF.js} +1 -1
  31. package/dist/ui/{chunk-FBJURT7Z.js → chunk-7MTDTPYB.js} +1 -1
  32. package/dist/ui/{chunk-GXSAEPU3.js → chunk-7UIUAHC4.js} +1 -1
  33. package/dist/ui/{chunk-JT5L6GPZ.js → chunk-AEWL2RWR.js} +1 -1
  34. package/dist/ui/{chunk-MDUBCXU2.js → chunk-JKCZGT6B.js} +1 -1
  35. package/dist/ui/chunk-P4U2LUTF.js +1 -0
  36. package/dist/ui/{chunk-V7S4IAGB.js → chunk-QGBR3J2Y.js} +1 -1
  37. package/dist/ui/ui.js +1 -1
  38. package/package.json +3 -3
  39. package/dist/ui/DocumentPage-EEGTJMIW.js +0 -1
  40. package/dist/ui/SettingsPage-36XFWV62.js +0 -1
  41. package/dist/ui/chunk-NXQVLOTK.js +0 -1
  42. /package/dist/ui/{chunk-JT5L6GPZ.js.LEGAL.txt → chunk-AEWL2RWR.js.LEGAL.txt} +0 -0
package/dist/app.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getServerVersion,
3
3
  serializeAiConfig
4
- } from "./chunk-RLZFZT42.js";
4
+ } from "./chunk-VSPPZPMP.js";
5
5
  import "./chunk-RXWDB3K4.js";
6
6
  import "./chunk-N4K6ICFR.js";
7
7
  import {
@@ -174,6 +174,7 @@ function serializeCollection(collection) {
174
174
  previewUrl: collection.previewUrl,
175
175
  preview: collection.preview,
176
176
  slugRegex: collection.slugRegex,
177
+ autoSlug: collection.autoSlug,
177
178
  autolock: collection.autolock,
178
179
  autolockReason: collection.autolockReason,
179
180
  sortOptions: collection.sortOptions
@@ -1198,7 +1198,7 @@ function extractJsonFromResponse(responseText) {
1198
1198
  // package.json
1199
1199
  var package_default = {
1200
1200
  name: "@blinkk/root-cms",
1201
- version: "3.0.4",
1201
+ version: "3.0.5",
1202
1202
  author: "s@blinkk.com",
1203
1203
  license: "MIT",
1204
1204
  engines: {
@@ -1369,7 +1369,7 @@ var package_default = {
1369
1369
  yjs: "13.6.27"
1370
1370
  },
1371
1371
  peerDependencies: {
1372
- "@blinkk/root": "3.0.4",
1372
+ "@blinkk/root": "3.0.5",
1373
1373
  "firebase-admin": ">=11",
1374
1374
  "firebase-functions": ">=4"
1375
1375
  },
@@ -373,6 +373,26 @@ export type Collection = SchemaWithTypes & {
373
373
  * string so it can be serialized to the CMS UI.
374
374
  */
375
375
  slugRegex?: string;
376
+ /**
377
+ * Template used to auto-fill the slug when creating a new doc. The template
378
+ * supports `{placeholder}` tokens; the field is pre-populated in the "New
379
+ * Doc" modal and the user can edit or regenerate the value before
380
+ * submitting.
381
+ *
382
+ * Supported tokens:
383
+ * - `{date}` — current date as `YYYYMMDD`
384
+ * - `{date:FORMAT}` — current date in a custom format. Supported format
385
+ * tokens: `YYYY`, `YY`, `MM`, `DD`, `HH`, `mm`, `ss`
386
+ * (e.g. `{date:YYYY-MM-DD}` → `2026-06-02`)
387
+ * - `{adjective}` — random adjective from a built-in word list
388
+ * - `{noun}` — random noun from a built-in word list
389
+ * - `{random}` / `{random:N}` — random alphanumeric string of length N
390
+ * (default 6)
391
+ *
392
+ * Example: `autoSlug: '{date:YYYYMMDD}-{adjective}-{noun}'` →
393
+ * `20260602-red-bear`
394
+ */
395
+ autoSlug?: string;
376
396
  /**
377
397
  * Automatically add a publishing lock whenever the doc is edited.
378
398
  */
package/dist/plugin.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  serializeAiConfig,
14
14
  summarizeDiff,
15
15
  translateString
16
- } from "./chunk-RLZFZT42.js";
16
+ } from "./chunk-VSPPZPMP.js";
17
17
  import {
18
18
  runCronJobs
19
19
  } from "./chunk-PNLLZXVY.js";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Word lists used by the `{adjective}` and `{noun}` tokens in `autoSlug`
3
+ * templates. All entries must be lowercase and match the default slug regex
4
+ * (a-z, 0-9, underscore).
5
+ */
6
+ export declare const ADJECTIVES: string[];
7
+ export declare const NOUNS: string[];
@@ -0,0 +1,14 @@
1
+ export interface RenderAutoSlugOptions {
2
+ /** Override the current time. Useful for tests. */
3
+ now?: Date;
4
+ /** Override the random source. Useful for tests. */
5
+ random?: () => number;
6
+ }
7
+ /**
8
+ * Renders an `autoSlug` template into a slug string.
9
+ *
10
+ * See `Collection.autoSlug` in `core/schema.ts` for the supported token
11
+ * syntax. Unknown tokens are left untouched (`{foo}`) so authors notice
12
+ * typos via the standard slug validation error.
13
+ */
14
+ export declare function renderAutoSlug(template: string, opts?: RenderAutoSlugOptions): string;
@@ -1 +1 @@
1
- import{a as o}from"./chunk-JYFLU7DM.js";import"./chunk-PHBMVORG.js";import"./chunk-JZFTZ4X4.js";import"./chunk-HKINZLMW.js";import"./chunk-SKEP5WYH.js";import"./chunk-YDO2EDVY.js";import{a,b as i}from"./chunk-FBJURT7Z.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Ha as t}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function n(r){return a("AI"),t(i,{children:t(o,{variant:"page",initialChatId:r.chatId})})}export{n as AIPage};
1
+ import{a as o}from"./chunk-JYFLU7DM.js";import"./chunk-PHBMVORG.js";import"./chunk-JZFTZ4X4.js";import"./chunk-HKINZLMW.js";import"./chunk-SKEP5WYH.js";import"./chunk-YDO2EDVY.js";import{a,b as i}from"./chunk-7MTDTPYB.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Ha as t}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function n(r){return a("AI"),t(i,{children:t(o,{variant:"page",initialChatId:r.chatId})})}export{n as AIPage};
@@ -1 +1 @@
1
- import{k as _}from"./chunk-TJBVMFNQ.js";import"./chunk-CGCKJFL4.js";import{a as f}from"./chunk-VMT7JFAM.js";import"./chunk-SKEP5WYH.js";import{a as h}from"./chunk-PJA7YP4A.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import"./chunk-62UWGWON.js";import"./chunk-I6ICVKEC.js";import{a as m}from"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as F,b as v}from"./chunk-FBJURT7Z.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import{f as p}from"./chunk-AL3TN2KI.js";import{Ga as u,Ha as a,W as r,a as t,ea as d,j as n,mb as c,oa as g}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";n();n();function x(e){let[l,i]=t(e.value||null),[w,A]=t(null);e.value!==void 0&&e.value!==l&&i(e.value);let P=s=>{i(s),e.onChange&&e.onChange(s)},b={type:"file",label:""};return a("div",{className:p("FileUploader",e.className),children:a(_,{field:e.field||b,value:l,setValue:P,loadingState:w,setLoadingState:A,variant:e.variant,showNamingOptions:e.showNamingOptions,accept:e.accept,allowEditing:e.allowEditing})})}function J(){F("Assets");let[e,l]=t(null),i=e?.gcsPath?`https://storage.googleapis.com${e.gcsPath}`:"";return a(v,{children:a("div",{className:"AssetsPage","data-testid":"assets-page",children:[a("div",{className:"AssetsPage__header",children:[a(f,{size:"h1",children:"Assets"}),a(m,{as:"p",children:"Upload assets to the project's GCS bucket."})]}),a(h,{className:"AssetsPage__content",children:[a(x,{value:e,onChange:l,showNamingOptions:!0,accept:["*/*"],allowEditing:!1,className:"AssetsPage__uploader"}),e&&i&&a("div",{className:"AssetsPage__urlGroup",children:[a(o,{label:"GCS URL",url:i}),a(o,{label:"Google Image Service URL",url:e.src})]}),e&&!i&&a("div",{className:"AssetsPage__urlGroup",children:a(o,{url:e.src})}),e&&a(d,{variant:"outline",fullWidth:!0,onClick:()=>l(null),mt:"md",children:"Upload another file"})]})]})})}function o(e){return a("div",{className:"AssetsPage__urlRow",children:[e.label&&a("div",{className:"AssetsPage__urlRow__label",children:e.label}),a("div",{className:"AssetsPage__urlRow__input",children:[a(g,{readOnly:!0,value:e.url,autosize:!0,minRows:1,size:"xs",radius:"xs",onClick:l=>l.target.select(),styles:{root:{flex:1,minWidth:0}}}),a(y,{url:e.url})]})]})}function y(e){let[l,i]=t(!1);return a(u,{label:l?"Copied!":"Copy URL",position:"top",withArrow:!0,children:a(r,{variant:"default",size:"lg",onClick:()=>{navigator.clipboard.writeText(e.url).then(()=>{i(!0),setTimeout(()=>i(!1),2e3)})},children:a(c,{size:16})})})}export{J as AssetsPage};
1
+ import{k as _}from"./chunk-TJBVMFNQ.js";import"./chunk-CGCKJFL4.js";import{a as f}from"./chunk-VMT7JFAM.js";import"./chunk-SKEP5WYH.js";import{a as h}from"./chunk-PJA7YP4A.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import"./chunk-62UWGWON.js";import"./chunk-I6ICVKEC.js";import{a as m}from"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as F,b as v}from"./chunk-7MTDTPYB.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import{f as p}from"./chunk-AL3TN2KI.js";import{Ga as u,Ha as a,W as r,a as t,ea as d,j as n,mb as c,oa as g}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";n();n();function x(e){let[l,i]=t(e.value||null),[w,A]=t(null);e.value!==void 0&&e.value!==l&&i(e.value);let P=s=>{i(s),e.onChange&&e.onChange(s)},b={type:"file",label:""};return a("div",{className:p("FileUploader",e.className),children:a(_,{field:e.field||b,value:l,setValue:P,loadingState:w,setLoadingState:A,variant:e.variant,showNamingOptions:e.showNamingOptions,accept:e.accept,allowEditing:e.allowEditing})})}function J(){F("Assets");let[e,l]=t(null),i=e?.gcsPath?`https://storage.googleapis.com${e.gcsPath}`:"";return a(v,{children:a("div",{className:"AssetsPage","data-testid":"assets-page",children:[a("div",{className:"AssetsPage__header",children:[a(f,{size:"h1",children:"Assets"}),a(m,{as:"p",children:"Upload assets to the project's GCS bucket."})]}),a(h,{className:"AssetsPage__content",children:[a(x,{value:e,onChange:l,showNamingOptions:!0,accept:["*/*"],allowEditing:!1,className:"AssetsPage__uploader"}),e&&i&&a("div",{className:"AssetsPage__urlGroup",children:[a(o,{label:"GCS URL",url:i}),a(o,{label:"Google Image Service URL",url:e.src})]}),e&&!i&&a("div",{className:"AssetsPage__urlGroup",children:a(o,{url:e.src})}),e&&a(d,{variant:"outline",fullWidth:!0,onClick:()=>l(null),mt:"md",children:"Upload another file"})]})]})})}function o(e){return a("div",{className:"AssetsPage__urlRow",children:[e.label&&a("div",{className:"AssetsPage__urlRow__label",children:e.label}),a("div",{className:"AssetsPage__urlRow__input",children:[a(g,{readOnly:!0,value:e.url,autosize:!0,minRows:1,size:"xs",radius:"xs",onClick:l=>l.target.select(),styles:{root:{flex:1,minWidth:0}}}),a(y,{url:e.url})]})]})}function y(e){let[l,i]=t(!1);return a(u,{label:l?"Copied!":"Copy URL",position:"top",withArrow:!0,children:a(r,{variant:"default",size:"lg",onClick:()=>{navigator.clipboard.writeText(e.url).then(()=>{i(!0),setTimeout(()=>i(!1),2e3)})},children:a(c,{size:16})})})}export{J as AssetsPage};
@@ -1 +1 @@
1
- import{a as U}from"./chunk-W3BJ2EZX.js";import{h as B}from"./chunk-GXSAEPU3.js";import{a as D,e as S,j as z}from"./chunk-NXQVLOTK.js";import{c as O,e as I}from"./chunk-3IYZCUPI.js";import"./chunk-RSVO46S3.js";import"./chunk-54DVDYU6.js";import{a as w}from"./chunk-X2WHBGTP.js";import{b as E,c as P}from"./chunk-ONTGW2VA.js";import"./chunk-4KE2SZKH.js";import{a as A}from"./chunk-L4RHGQUG.js";import"./chunk-HRGYNHZ3.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import{a as j}from"./chunk-PJA7YP4A.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import"./chunk-62UWGWON.js";import"./chunk-I6ICVKEC.js";import"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as R,b as $}from"./chunk-FBJURT7Z.js";import{b as h}from"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import{d as k}from"./chunk-AL3TN2KI.js";import{Aa as N,Da as L,Ha as o,V as y,a as x,c as T,db as u,ea as C,j as M}from"./chunk-NZHF733K.js";import{d as f}from"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";M();function p(e){let{route:i}=k(),l=window.__ROOT_CTX.rootConfig.projectId;R(e.collection?e.collection:"Content"),T(()=>{let a=window.__ROOT_CTX.collections,s=`root-cms::${l}::last_collection`;if(e.collection)window.localStorage.setItem(s,e.collection);else{let t=window.localStorage.getItem(s);if(t&&a[t]){i(`/cms/content/${t}`);return}if(window.__ROOT_CTX.collections.Pages){i("/cms/content/Pages");return}let _=Object.keys(window.__ROOT_CTX.collections)||[];if(_.length>0){let d=_[0];i(`/cms/content/${d}`);return}console.warn("no collections")}},[e.collection,l]);let n=window.__ROOT_CTX.collections;return o($,{children:o("div",{className:"CollectionPage",children:o("div",{className:"CollectionPage__layout",children:[o("div",{className:"CollectionPage__side",children:o(U,{collections:n,activeCollectionId:e.collection,projectId:l})}),o("div",{className:"CollectionPage__main",children:e.collection&&o(p.Collection,{collection:e.collection},e.collection)})]})})})}p.Collection=e=>{let{roles:i}=A(),l=window.firebase.user.email||"",n=E(i,l),[a,s]=w(`root::CollectionPage:${e.collection}:orderBy`,"modifiedAt"),[t,_]=w(`root::CollectionPage:${e.collection}:showArchived`,!1),[d,r]=x(!1),m=window.__ROOT_CTX.collections[e.collection];if(!m)return route("/cms/content"),o(f,{});let v=[{value:"slug",label:"A-Z"},{value:"slugDesc",label:"Z-A"},{value:"newest",label:"Newest"},{value:"oldest",label:"Oldest"},{value:"modifiedAt",label:"Last modified"},...m.sortOptions?.map(g=>({value:g.id,label:g.label}))||[]],[c,X,b]=S(e.collection,{orderBy:a,includeArchived:t});return o(f,{children:[o(z,{collection:e.collection,opened:d,onClose:()=>r(!1)}),o("div",{className:"CollectionPage__collection",children:o("div",{className:"CollectionPage__collection__docsTab",children:[!c&&o("div",{className:"CollectionPage__collection__docsTab__header",children:[o("div",{className:"CollectionPage__collection__docsTab__header__title",children:m.name||e.collection}),o("div",{className:"CollectionPage__collection__docsTab__controls",children:[o("div",{className:"CollectionPage__collection__docsTab__controls__showArchived",children:o(L,{size:"sm",color:"dark",label:"Show archived:",checked:t,onChange:g=>_(!!g.currentTarget.checked)})}),o("div",{className:"CollectionPage__collection__docsTab__controls__sort",children:[o("div",{className:"CollectionPage__collection__docsTab__controls__sort__label",children:"Sort:"}),o(N,{size:"xs",value:a,onChange:g=>s(g||"modifiedAt"),data:v})]}),o("div",{className:"CollectionPage__collection__docsTab__controls__newDoc",children:o(P,{label:"You don't have access to create new documents",condition:!n,children:o(C,{color:"dark",size:"xs",leftIcon:o(u,{size:16}),onClick:()=>r(!0),disabled:!n,children:"New"})})})]})]}),o(j,{className:"CollectionPage__collection__docsTab__content",children:c?o("div",{className:"CollectionPage__collection__docsTab__content__loading",children:o(y,{color:"gray",size:"xl"})}):b.length===0?o("div",{class:"CollectionPage__collection__docsEmpty",children:[o("div",{class:"CollectionPage__collection__docsEmpty__title",children:"Collection is empty."}),o("div",{class:"CollectionPage__collection__docsEmpty__button",children:o(P,{label:"You don't have access to create new documents",condition:!n,children:o(C,{color:"dark",size:"xs",leftIcon:o(u,{size:16}),onClick:()=>r(!0),disabled:!n,children:"New"})})})]}):o(p.DocsList,{collection:e.collection,docs:b,reloadDocs:()=>X()})})]})})]})};p.DocsList=e=>{let i=e.collection,l=window.__ROOT_CTX.collections[e.collection];if(!l)throw new Error(`could not find collection: ${i}`);let n=!!l.url,a=e.docs||[];function s(t){return n?D({collectionId:i,slug:t}):""}return o("div",{className:"CollectionPage__collection__docsList",children:a.map(t=>{let _=`/cms/content/${i}/${t.slug}`,d=s(t.slug),r=t.fields||{},m=h(r,l.preview?.title||"meta.title"),v=h(r,l.preview?.image||"meta.image")||l.preview?.defaultImage;return o("div",{className:"CollectionPage__collection__docsList__doc",children:[o("div",{className:"CollectionPage__collection__docsList__doc__image",children:o("a",{href:_,children:o(I,{file:v,width:120,height:90,withPlaceholder:!v?.src})})}),o("a",{className:"CollectionPage__collection__docsList__doc__content",href:_,children:[o("div",{className:"CollectionPage__collection__docsList__doc__content__header",children:[o("div",{className:"CollectionPage__collection__docsList__doc__content__header__docId",children:t.id}),o(O,{doc:t})]}),o("div",{className:"CollectionPage__collection__docsList__doc__content__title",children:m||"[UNTITLED]"}),n&&d&&o("div",{className:"CollectionPage__collection__docsList__doc__content__url",children:d})]}),o("div",{className:"CollectionPage__collection__docsList__doc__controls",children:o(B,{docId:t.id,data:t,onAction:c=>{(c.action==="archive"||c.action==="copy"||c.action==="unarchive"||c.action==="delete"||c.action==="unpublish"||c.action==="locked"||c.action==="unlocked")&&e.reloadDocs()}})})]},t.id)})})};export{p as CollectionPage};
1
+ import{a as U}from"./chunk-W3BJ2EZX.js";import{h as B}from"./chunk-7UIUAHC4.js";import{a as D,e as S,j as z}from"./chunk-P4U2LUTF.js";import{c as O,e as I}from"./chunk-3IYZCUPI.js";import"./chunk-RSVO46S3.js";import"./chunk-54DVDYU6.js";import{a as w}from"./chunk-X2WHBGTP.js";import{b as E,c as P}from"./chunk-ONTGW2VA.js";import"./chunk-4KE2SZKH.js";import{a as A}from"./chunk-L4RHGQUG.js";import"./chunk-HRGYNHZ3.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import{a as j}from"./chunk-PJA7YP4A.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import"./chunk-62UWGWON.js";import"./chunk-I6ICVKEC.js";import"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as R,b as $}from"./chunk-7MTDTPYB.js";import{b as h}from"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import{d as k}from"./chunk-AL3TN2KI.js";import{Aa as N,Da as L,Ha as o,V as y,a as x,c as T,db as u,ea as C,j as M}from"./chunk-NZHF733K.js";import{d as f}from"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";M();function p(e){let{route:i}=k(),l=window.__ROOT_CTX.rootConfig.projectId;R(e.collection?e.collection:"Content"),T(()=>{let a=window.__ROOT_CTX.collections,s=`root-cms::${l}::last_collection`;if(e.collection)window.localStorage.setItem(s,e.collection);else{let t=window.localStorage.getItem(s);if(t&&a[t]){i(`/cms/content/${t}`);return}if(window.__ROOT_CTX.collections.Pages){i("/cms/content/Pages");return}let _=Object.keys(window.__ROOT_CTX.collections)||[];if(_.length>0){let d=_[0];i(`/cms/content/${d}`);return}console.warn("no collections")}},[e.collection,l]);let n=window.__ROOT_CTX.collections;return o($,{children:o("div",{className:"CollectionPage",children:o("div",{className:"CollectionPage__layout",children:[o("div",{className:"CollectionPage__side",children:o(U,{collections:n,activeCollectionId:e.collection,projectId:l})}),o("div",{className:"CollectionPage__main",children:e.collection&&o(p.Collection,{collection:e.collection},e.collection)})]})})})}p.Collection=e=>{let{roles:i}=A(),l=window.firebase.user.email||"",n=E(i,l),[a,s]=w(`root::CollectionPage:${e.collection}:orderBy`,"modifiedAt"),[t,_]=w(`root::CollectionPage:${e.collection}:showArchived`,!1),[d,r]=x(!1),m=window.__ROOT_CTX.collections[e.collection];if(!m)return route("/cms/content"),o(f,{});let v=[{value:"slug",label:"A-Z"},{value:"slugDesc",label:"Z-A"},{value:"newest",label:"Newest"},{value:"oldest",label:"Oldest"},{value:"modifiedAt",label:"Last modified"},...m.sortOptions?.map(g=>({value:g.id,label:g.label}))||[]],[c,X,b]=S(e.collection,{orderBy:a,includeArchived:t});return o(f,{children:[o(z,{collection:e.collection,opened:d,onClose:()=>r(!1)}),o("div",{className:"CollectionPage__collection",children:o("div",{className:"CollectionPage__collection__docsTab",children:[!c&&o("div",{className:"CollectionPage__collection__docsTab__header",children:[o("div",{className:"CollectionPage__collection__docsTab__header__title",children:m.name||e.collection}),o("div",{className:"CollectionPage__collection__docsTab__controls",children:[o("div",{className:"CollectionPage__collection__docsTab__controls__showArchived",children:o(L,{size:"sm",color:"dark",label:"Show archived:",checked:t,onChange:g=>_(!!g.currentTarget.checked)})}),o("div",{className:"CollectionPage__collection__docsTab__controls__sort",children:[o("div",{className:"CollectionPage__collection__docsTab__controls__sort__label",children:"Sort:"}),o(N,{size:"xs",value:a,onChange:g=>s(g||"modifiedAt"),data:v})]}),o("div",{className:"CollectionPage__collection__docsTab__controls__newDoc",children:o(P,{label:"You don't have access to create new documents",condition:!n,children:o(C,{color:"dark",size:"xs",leftIcon:o(u,{size:16}),onClick:()=>r(!0),disabled:!n,children:"New"})})})]})]}),o(j,{className:"CollectionPage__collection__docsTab__content",children:c?o("div",{className:"CollectionPage__collection__docsTab__content__loading",children:o(y,{color:"gray",size:"xl"})}):b.length===0?o("div",{class:"CollectionPage__collection__docsEmpty",children:[o("div",{class:"CollectionPage__collection__docsEmpty__title",children:"Collection is empty."}),o("div",{class:"CollectionPage__collection__docsEmpty__button",children:o(P,{label:"You don't have access to create new documents",condition:!n,children:o(C,{color:"dark",size:"xs",leftIcon:o(u,{size:16}),onClick:()=>r(!0),disabled:!n,children:"New"})})})]}):o(p.DocsList,{collection:e.collection,docs:b,reloadDocs:()=>X()})})]})})]})};p.DocsList=e=>{let i=e.collection,l=window.__ROOT_CTX.collections[e.collection];if(!l)throw new Error(`could not find collection: ${i}`);let n=!!l.url,a=e.docs||[];function s(t){return n?D({collectionId:i,slug:t}):""}return o("div",{className:"CollectionPage__collection__docsList",children:a.map(t=>{let _=`/cms/content/${i}/${t.slug}`,d=s(t.slug),r=t.fields||{},m=h(r,l.preview?.title||"meta.title"),v=h(r,l.preview?.image||"meta.image")||l.preview?.defaultImage;return o("div",{className:"CollectionPage__collection__docsList__doc",children:[o("div",{className:"CollectionPage__collection__docsList__doc__image",children:o("a",{href:_,children:o(I,{file:v,width:120,height:90,withPlaceholder:!v?.src})})}),o("a",{className:"CollectionPage__collection__docsList__doc__content",href:_,children:[o("div",{className:"CollectionPage__collection__docsList__doc__content__header",children:[o("div",{className:"CollectionPage__collection__docsList__doc__content__header__docId",children:t.id}),o(O,{doc:t})]}),o("div",{className:"CollectionPage__collection__docsList__doc__content__title",children:m||"[UNTITLED]"}),n&&d&&o("div",{className:"CollectionPage__collection__docsList__doc__content__url",children:d})]}),o("div",{className:"CollectionPage__collection__docsList__doc__controls",children:o(B,{docId:t.id,data:t,onAction:c=>{(c.action==="archive"||c.action==="copy"||c.action==="unarchive"||c.action==="delete"||c.action==="unpublish"||c.action==="locked"||c.action==="unlocked")&&e.reloadDocs()}})})]},t.id)})})};export{p as CollectionPage};
@@ -1 +1 @@
1
- import{b as s}from"./chunk-YFA6U2CV.js";import"./chunk-JZFTZ4X4.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as d,b as m}from"./chunk-FBJURT7Z.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import{d as t}from"./chunk-AL3TN2KI.js";import{Ha as a,g as i,j as p}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";p();function h(){let{query:r}=t();d("Compare");let o=i(()=>n(r.left||""),[r.left]),e=i(()=>n(r.right||""),[r.right]);return a(m,{children:a("div",{className:"ComparePage",children:o&&e?a(s,{className:"ComparePage__diff",left:o,right:e}):a("div",{className:"ComparePage__error",children:"Invalid params, double check query params."})})})}function n(r){let[o,e]=String(r).split("@");return o&&e?{docId:o,versionId:e}:null}export{h as ComparePage};
1
+ import{b as s}from"./chunk-YFA6U2CV.js";import"./chunk-JZFTZ4X4.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as d,b as m}from"./chunk-7MTDTPYB.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import{d as t}from"./chunk-AL3TN2KI.js";import{Ha as a,g as i,j as p}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";p();function h(){let{query:r}=t();d("Compare");let o=i(()=>n(r.left||""),[r.left]),e=i(()=>n(r.right||""),[r.right]);return a(m,{children:a("div",{className:"ComparePage",children:o&&e?a(s,{className:"ComparePage__diff",left:o,right:e}):a("div",{className:"ComparePage__error",children:"Invalid params, double check query params."})})})}function n(r){let[o,e]=String(r).split("@");return o&&e?{docId:o,versionId:e}:null}export{h as ComparePage};
@@ -1 +1 @@
1
- import{a as m}from"./chunk-KKEWCXVV.js";import"./chunk-CGCKJFL4.js";import{a as P}from"./chunk-VMT7JFAM.js";import{a as T}from"./chunk-X2WHBGTP.js";import{b as y,c as w}from"./chunk-ONTGW2VA.js";import{b as v}from"./chunk-4KE2SZKH.js";import{a as x}from"./chunk-L4RHGQUG.js";import"./chunk-W3HIZQ4Z.js";import{a as k}from"./chunk-PJA7YP4A.js";import"./chunk-I6ICVKEC.js";import{a as p}from"./chunk-HLMBCVRX.js";import{b as u}from"./chunk-ORXEMIQC.js";import{a as A,b as B}from"./chunk-FBJURT7Z.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Da as b,Ea as D,Ga as i,Ha as e,Kc as S,V as g,W as f,a as d,c as h,ca as s,ea as _,g as c,j as G}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";G();var z={transition:"pop"};function O(a){let o=a.dataSource;return N(o.archivedAt)?e(i,{...z,label:`Archived ${L(o.archivedAt)} by ${o.archivedBy}`,children:e(s,{size:"xs",color:"gray",variant:"filled",children:"Archived"})}):N(o.publishedAt)?e(i,{...z,label:`Published ${L(o.publishedAt)} by ${o.publishedBy}`,children:e(s,{size:"xs",variant:"gradient",gradient:{from:"teal",to:"lime",deg:105},children:"Published"})}):e(s,{size:"xs",variant:"gradient",gradient:{from:"indigo",to:"cyan"},children:"Unpublished"})}function N(a){return!!(a&&a.toMillis)}function L(a){return a?.toMillis?u(a.toMillis()):u(new Date().getTime())}function E(){A("Data Sources");let{roles:a}=x(),o=window.firebase.user.email||"",r=y(a,o);return e(B,{children:e("div",{className:"DataPage",children:[e("div",{className:"DataPage__header",children:[e(P,{size:"h1",children:"Data Sources"}),e(p,{as:"p",children:"Add data sources to sync data from external services, like Google Sheets."}),e("div",{className:"DataPage__header__buttons",children:e(w,{label:"You don't have access to create new data sources",condition:!r,children:e(_,{component:"a",color:"blue",size:"xs",href:"/cms/data/new",disabled:!r,style:r?void 0:{pointerEvents:"none"},children:"New data source"})})})]}),e(E.DataSourcesTable,{})]})})}E.DataSourcesTable=()=>{let[a,o]=d(!0),[r,I]=d([]),[l,$]=T("root::DataPage:showArchived",!1),C=t=>!!t&&t.startsWith("https://docs.google.com/spreadsheets/");async function M(){let t=await v();I(t),o(!1)}let H=c(()=>r.some(t=>!!t.archivedAt),[r]),n=c(()=>r.filter(t=>{let U=!!t.archivedAt;return l?!0:!U}),[r,l]);return h(()=>{M()},[]),e("div",{className:"DataPage__DataSourcesTable",children:[!a&&H&&e("div",{className:"DataPage__DataSourcesTable__filters",children:e(b,{size:"sm",color:"dark",label:"Show archived",checked:l,onChange:t=>$(!!t.currentTarget.checked)})}),e(k,{children:[a&&e(g,{color:"gray",size:"xl"}),!a&&n.length>0&&e(D,{verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[e("thead",{children:e("tr",{children:[e("th",{children:"id"}),e("th",{children:"description"}),e("th",{children:"type"}),e("th",{children:"url"}),e("th",{children:"status"}),e("th",{children:"last synced"}),e("th",{children:"last published"})]})}),e("tbody",{children:n.map(t=>e("tr",{children:[e("td",{children:e("a",{href:`/cms/data/${t.id}`,children:t.id})}),e("td",{children:t.description||""}),e("td",{children:t.type}),e("td",{children:C(t.url)?e("div",{className:"DataPage__DataSourcesTable__url",children:[e(i,{label:"Open spreadsheet",children:e(f,{component:"a",href:t.url,target:"_blank",rel:"noreferrer",variant:"filled",color:"green",size:"sm","aria-label":"Open spreadsheet",children:e(S,{size:16,stroke:"2.25"})})}),e("a",{className:"DataPage__DataSourcesTable__url__text",href:t.url,target:"_blank",rel:"noreferrer",children:t.url})]}):t.url||""}),e("td",{children:e(O,{dataSource:t})}),e("td",{children:e(m,{dataSource:t,action:"sync"})}),e("td",{children:e(m,{dataSource:t,action:"publish"})})]},t.id))})]}),!a&&n.length===0&&e(p,{as:"p",children:"No data sources found for this filter."})]})]})};export{E as DataPage};
1
+ import{a as m}from"./chunk-KKEWCXVV.js";import"./chunk-CGCKJFL4.js";import{a as P}from"./chunk-VMT7JFAM.js";import{a as T}from"./chunk-X2WHBGTP.js";import{b as y,c as w}from"./chunk-ONTGW2VA.js";import{b as v}from"./chunk-4KE2SZKH.js";import{a as x}from"./chunk-L4RHGQUG.js";import"./chunk-W3HIZQ4Z.js";import{a as k}from"./chunk-PJA7YP4A.js";import"./chunk-I6ICVKEC.js";import{a as p}from"./chunk-HLMBCVRX.js";import{b as u}from"./chunk-ORXEMIQC.js";import{a as A,b as B}from"./chunk-7MTDTPYB.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Da as b,Ea as D,Ga as i,Ha as e,Kc as S,V as g,W as f,a as d,c as h,ca as s,ea as _,g as c,j as G}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";G();var z={transition:"pop"};function O(a){let o=a.dataSource;return N(o.archivedAt)?e(i,{...z,label:`Archived ${L(o.archivedAt)} by ${o.archivedBy}`,children:e(s,{size:"xs",color:"gray",variant:"filled",children:"Archived"})}):N(o.publishedAt)?e(i,{...z,label:`Published ${L(o.publishedAt)} by ${o.publishedBy}`,children:e(s,{size:"xs",variant:"gradient",gradient:{from:"teal",to:"lime",deg:105},children:"Published"})}):e(s,{size:"xs",variant:"gradient",gradient:{from:"indigo",to:"cyan"},children:"Unpublished"})}function N(a){return!!(a&&a.toMillis)}function L(a){return a?.toMillis?u(a.toMillis()):u(new Date().getTime())}function E(){A("Data Sources");let{roles:a}=x(),o=window.firebase.user.email||"",r=y(a,o);return e(B,{children:e("div",{className:"DataPage",children:[e("div",{className:"DataPage__header",children:[e(P,{size:"h1",children:"Data Sources"}),e(p,{as:"p",children:"Add data sources to sync data from external services, like Google Sheets."}),e("div",{className:"DataPage__header__buttons",children:e(w,{label:"You don't have access to create new data sources",condition:!r,children:e(_,{component:"a",color:"blue",size:"xs",href:"/cms/data/new",disabled:!r,style:r?void 0:{pointerEvents:"none"},children:"New data source"})})})]}),e(E.DataSourcesTable,{})]})})}E.DataSourcesTable=()=>{let[a,o]=d(!0),[r,I]=d([]),[l,$]=T("root::DataPage:showArchived",!1),C=t=>!!t&&t.startsWith("https://docs.google.com/spreadsheets/");async function M(){let t=await v();I(t),o(!1)}let H=c(()=>r.some(t=>!!t.archivedAt),[r]),n=c(()=>r.filter(t=>{let U=!!t.archivedAt;return l?!0:!U}),[r,l]);return h(()=>{M()},[]),e("div",{className:"DataPage__DataSourcesTable",children:[!a&&H&&e("div",{className:"DataPage__DataSourcesTable__filters",children:e(b,{size:"sm",color:"dark",label:"Show archived",checked:l,onChange:t=>$(!!t.currentTarget.checked)})}),e(k,{children:[a&&e(g,{color:"gray",size:"xl"}),!a&&n.length>0&&e(D,{verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[e("thead",{children:e("tr",{children:[e("th",{children:"id"}),e("th",{children:"description"}),e("th",{children:"type"}),e("th",{children:"url"}),e("th",{children:"status"}),e("th",{children:"last synced"}),e("th",{children:"last published"})]})}),e("tbody",{children:n.map(t=>e("tr",{children:[e("td",{children:e("a",{href:`/cms/data/${t.id}`,children:t.id})}),e("td",{children:t.description||""}),e("td",{children:t.type}),e("td",{children:C(t.url)?e("div",{className:"DataPage__DataSourcesTable__url",children:[e(i,{label:"Open spreadsheet",children:e(f,{component:"a",href:t.url,target:"_blank",rel:"noreferrer",variant:"filled",color:"green",size:"sm","aria-label":"Open spreadsheet",children:e(S,{size:16,stroke:"2.25"})})}),e("a",{className:"DataPage__DataSourcesTable__url__text",href:t.url,target:"_blank",rel:"noreferrer",children:t.url})]}):t.url||""}),e("td",{children:e(O,{dataSource:t})}),e("td",{children:e(m,{dataSource:t,action:"sync"})}),e("td",{children:e(m,{dataSource:t,action:"publish"})})]},t.id))})]}),!a&&n.length===0&&e(p,{as:"p",children:"No data sources found for this filter."})]})]})};export{E as DataPage};
@@ -1 +1 @@
1
- import{a as f}from"./chunk-KKEWCXVV.js";import"./chunk-CGCKJFL4.js";import{a as g}from"./chunk-VMT7JFAM.js";import"./chunk-ONTGW2VA.js";import{c as T,d as N}from"./chunk-4KE2SZKH.js";import"./chunk-L4RHGQUG.js";import"./chunk-W3HIZQ4Z.js";import{a as h}from"./chunk-PJA7YP4A.js";import"./chunk-I6ICVKEC.js";import{a as A}from"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as W,b as H}from"./chunk-FBJURT7Z.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Dc as k,Ea as D,Ga as p,Ha as a,Kc as z,V as y,W as m,a as _,c as b,da as v,ea as P,j as B,oa as x,pa as w}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";B();function r(t){W(`Data Source: ${t.id}`);let[o,l]=_(!0),[e,u]=_(null),[n,c]=_(null),i=t.id;async function d(){let s=await T(i);if(u(s),s){let I=await N(i,{mode:"draft"});c(I)}l(!1)}b(()=>{d()},[]);function S(s){s==="sync"&&d()}return a(H,{children:a("div",{className:"DataSourcePage",children:[a("div",{className:"DataSourcePage__header",children:[a(v,{className:"DataSourcePage__header__breadcrumbs",children:[a("a",{href:"/cms/data",children:"Data"}),a("div",{children:i})]}),a("div",{className:"DataSourcePage__header__titleWrap",children:[a(g,{size:"h1",children:["Data Source: ",i]}),a("div",{className:"DataSourcePage__header__controls",children:a(p,{label:"Configure",children:a(m,{component:"a",href:`/cms/data/${t.id}/edit`,children:a(k,{size:24,stroke:"1.5"})})})})]}),e?.description&&a(A,{as:"p",children:e.description})]}),e&&a(r.SyncStatus,{dataSource:e,onAction:S}),o?a(y,{color:"gray",size:"xl"}):e?a(r.DataSection,{dataSource:e,data:n}):a("div",{className:"DataSourcePage__notFound",children:"Not Found"})]})})}r.SyncStatus=t=>{let o=t.dataSource;return a("div",{className:"DataSourcePage__SyncStatus",children:[a(g,{size:"h2",children:"Status"}),a(h,{className:"DataSourcePage__SyncStatus__content",children:a(D,{verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[a("thead",{children:a("tr",{children:[a("th",{children:"last synced"}),a("th",{children:"last published"})]})}),a("tbody",{children:a("tr",{children:[a("td",{children:a(f,{dataSource:o,action:"sync",onAction:()=>{t.onAction&&t.onAction("sync")}})}),a("td",{children:a(f,{dataSource:o,action:"publish"})})]})})]})})]})};r.DataSection=t=>{let{data:o,headers:l}=t.data||{},e=t.dataSource;if(!o)return null;let u=e.dataFormat||"map";if(e.type==="gsheet"){let n=l,c=[];if(u==="array")c=o;else if(u==="map"){let i=o;if(!n){let d=new Set;i.forEach(S=>{for(let s in S)s&&d.add(s)}),n=Array.from(d)}i.forEach(d=>{c.push(n.map(S=>d[S]||""))})}return a(r.DataSectionWrap,{dataSource:e,children:a(r.DataTable,{headers:n,rows:c})})}return e.type==="http"?a(r.DataSectionWrap,{dataSource:e,children:a(r.DefaultDataDisplay,{data:o})}):(console.log(`unsupported data type: ${e.type}`),null)};r.DataSectionWrap=t=>a("div",{className:"DataSourcePage__DataSection",children:[a("div",{className:"DataSourcePage__DataSection__header",children:[a(g,{size:"h2",children:"Data"}),a("div",{className:"DataSourcePage__DataSection__header__actions",children:[t.dataSource.url?.startsWith("https://docs.google.com/spreadsheets/")&&a(p,{label:"Open spreadsheet",children:a(m,{component:"a",href:t.dataSource.url,target:"_blank",variant:"filled",color:"green",children:a(z,{size:16,stroke:"2.25"})})}),t.dataSource.previewUrl&&a(P,{component:"a",variant:"default",size:"xs",href:t.dataSource.previewUrl,target:"_blank",children:"Preview"})]})]}),a(h,{className:"DataSourcePage__DataSection__content",children:t.children})]});r.DataTable=t=>{let o=t.headers||[],l=t.rows||[];return a("div",{className:"DataSourcePage__DataTable",children:a(D,{className:"DataSourcePage__DataTable__table",verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[o.length>0&&a("thead",{children:a("tr",{children:o.map(e=>a("th",{children:e},e))})}),a("tbody",{children:l.map((e,u)=>a("tr",{children:e.map((n,c)=>a("td",{children:n},c))},u))})]})})};r.DefaultDataDisplay=t=>{let o=t.data;return typeof o=="object"?a(w,{value:JSON.stringify(o,null,2),minRows:20,maxRows:100}):a(x,{value:String(o),minRows:12,maxRows:100})};export{r as DataSourcePage};
1
+ import{a as f}from"./chunk-KKEWCXVV.js";import"./chunk-CGCKJFL4.js";import{a as g}from"./chunk-VMT7JFAM.js";import"./chunk-ONTGW2VA.js";import{c as T,d as N}from"./chunk-4KE2SZKH.js";import"./chunk-L4RHGQUG.js";import"./chunk-W3HIZQ4Z.js";import{a as h}from"./chunk-PJA7YP4A.js";import"./chunk-I6ICVKEC.js";import{a as A}from"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as W,b as H}from"./chunk-7MTDTPYB.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Dc as k,Ea as D,Ga as p,Ha as a,Kc as z,V as y,W as m,a as _,c as b,da as v,ea as P,j as B,oa as x,pa as w}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";B();function r(t){W(`Data Source: ${t.id}`);let[o,l]=_(!0),[e,u]=_(null),[n,c]=_(null),i=t.id;async function d(){let s=await T(i);if(u(s),s){let I=await N(i,{mode:"draft"});c(I)}l(!1)}b(()=>{d()},[]);function S(s){s==="sync"&&d()}return a(H,{children:a("div",{className:"DataSourcePage",children:[a("div",{className:"DataSourcePage__header",children:[a(v,{className:"DataSourcePage__header__breadcrumbs",children:[a("a",{href:"/cms/data",children:"Data"}),a("div",{children:i})]}),a("div",{className:"DataSourcePage__header__titleWrap",children:[a(g,{size:"h1",children:["Data Source: ",i]}),a("div",{className:"DataSourcePage__header__controls",children:a(p,{label:"Configure",children:a(m,{component:"a",href:`/cms/data/${t.id}/edit`,children:a(k,{size:24,stroke:"1.5"})})})})]}),e?.description&&a(A,{as:"p",children:e.description})]}),e&&a(r.SyncStatus,{dataSource:e,onAction:S}),o?a(y,{color:"gray",size:"xl"}):e?a(r.DataSection,{dataSource:e,data:n}):a("div",{className:"DataSourcePage__notFound",children:"Not Found"})]})})}r.SyncStatus=t=>{let o=t.dataSource;return a("div",{className:"DataSourcePage__SyncStatus",children:[a(g,{size:"h2",children:"Status"}),a(h,{className:"DataSourcePage__SyncStatus__content",children:a(D,{verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[a("thead",{children:a("tr",{children:[a("th",{children:"last synced"}),a("th",{children:"last published"})]})}),a("tbody",{children:a("tr",{children:[a("td",{children:a(f,{dataSource:o,action:"sync",onAction:()=>{t.onAction&&t.onAction("sync")}})}),a("td",{children:a(f,{dataSource:o,action:"publish"})})]})})]})})]})};r.DataSection=t=>{let{data:o,headers:l}=t.data||{},e=t.dataSource;if(!o)return null;let u=e.dataFormat||"map";if(e.type==="gsheet"){let n=l,c=[];if(u==="array")c=o;else if(u==="map"){let i=o;if(!n){let d=new Set;i.forEach(S=>{for(let s in S)s&&d.add(s)}),n=Array.from(d)}i.forEach(d=>{c.push(n.map(S=>d[S]||""))})}return a(r.DataSectionWrap,{dataSource:e,children:a(r.DataTable,{headers:n,rows:c})})}return e.type==="http"?a(r.DataSectionWrap,{dataSource:e,children:a(r.DefaultDataDisplay,{data:o})}):(console.log(`unsupported data type: ${e.type}`),null)};r.DataSectionWrap=t=>a("div",{className:"DataSourcePage__DataSection",children:[a("div",{className:"DataSourcePage__DataSection__header",children:[a(g,{size:"h2",children:"Data"}),a("div",{className:"DataSourcePage__DataSection__header__actions",children:[t.dataSource.url?.startsWith("https://docs.google.com/spreadsheets/")&&a(p,{label:"Open spreadsheet",children:a(m,{component:"a",href:t.dataSource.url,target:"_blank",variant:"filled",color:"green",children:a(z,{size:16,stroke:"2.25"})})}),t.dataSource.previewUrl&&a(P,{component:"a",variant:"default",size:"xs",href:t.dataSource.previewUrl,target:"_blank",children:"Preview"})]})]}),a(h,{className:"DataSourcePage__DataSection__content",children:t.children})]});r.DataTable=t=>{let o=t.headers||[],l=t.rows||[];return a("div",{className:"DataSourcePage__DataTable",children:a(D,{className:"DataSourcePage__DataTable__table",verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[o.length>0&&a("thead",{children:a("tr",{children:o.map(e=>a("th",{children:e},e))})}),a("tbody",{children:l.map((e,u)=>a("tr",{children:e.map((n,c)=>a("td",{children:n},c))},u))})]})})};r.DefaultDataDisplay=t=>{let o=t.data;return typeof o=="object"?a(w,{value:JSON.stringify(o,null,2),minRows:20,maxRows:100}):a(x,{value:String(o),minRows:12,maxRows:100})};export{r as DataSourcePage};
@@ -1 +1 @@
1
- import{b as na}from"./chunk-767BAQ53.js";import{a as ea}from"./chunk-4W73RW5I.js";import{a as aa}from"./chunk-P3NETZZP.js";import{a as Z}from"./chunk-VMT7JFAM.js";import"./chunk-HRGYNHZ3.js";import{b as j}from"./chunk-W3HIZQ4Z.js";import"./chunk-YDO2EDVY.js";import{A as V,t as U}from"./chunk-AFWBSIPL.js";import{b as G}from"./chunk-XOQ3KDSR.js";import{b as O}from"./chunk-62UWGWON.js";import{a as W,b as B}from"./chunk-I6ICVKEC.js";import"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as oa,b as S}from"./chunk-FBJURT7Z.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import{f as y}from"./chunk-AL3TN2KI.js";import{Ab as q,Ga as p,Ha as a,Kc as Q,Oc as Y,V as E,W as w,a as r,c as k,da as R,e as $,ea as f,g as A,hc as J,j as _a,ra as C,zb as X,zc as K}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";_a();function u(e){oa(`Translations: ${e.collection}/${e.slug}`);let[_,l]=r(!0),[h,g]=r(!1),[o,t]=r([]),[s,c]=r({}),[M,ta]=r(null),[sa,N]=r(!1),[I,L]=r({}),[ra,z]=r(!1),m=e.collection,b=e.slug,i=`${m}/${b}`,ia=ea(),P=(window.__ROOT_CTX.rootConfig.i18n||{}).locales||[],[F,H]=na("locale",P);async function la(){try{let[n,d,T]=await Promise.all([aa(i),G(),V(i)]);t(n),c(d),ta(T),l(!1)}catch(n){console.error(n),l(!1),g(!0)}}if(k(()=>{la()},[]),h)return a(u.NotFound,{docId:i});function ca(n,d,T){N(!0),L(x=>{let D={...x},v=D[n]??{};return v.source=n,v[d]=T,D[n]=v,D})}async function da(){z(!0),await O(async()=>{console.log("EditTranslationsModal.onSave()");let n=`edit-translations-${i}`;W({id:n,loading:!0,title:"Saving translations",message:`Updating for ${i}...`,autoClose:!1,disallowClose:!0});let d=Object.values(I);console.log(d),await U(i,d),B({id:n,title:"Saved translations",message:`Updated translations for ${i}!`,autoClose:!0}),L({}),N(!1)}),z(!1)}function ga(n){F.length===P.length?H([n]):H(P)}return a(S,{children:a("div",{className:"DocTranslationsPage",children:[a("div",{className:"DocTranslationsPage__header",children:[a(R,{className:"DocTranslationsPage__header__breadcrumbs",children:[a("a",{href:`/cms/content/${m}`,children:m}),a("a",{href:`/cms/content/${m}/${b}`,children:b}),a("div",{children:"translations"})]}),a("div",{className:"DocTranslationsPage__header__titleWrap",children:a(Z,{size:"h1",children:["Translations: ",i]})}),a("div",{className:"DocTranslationsPage__header__controls",children:[M&&a("div",{className:"DocTranslationsPage__header__linkedSheet",children:a("div",{className:"DocTranslationsPage__header__linkedSheet__controls",children:[a(p,{label:"Open Google Sheet",children:a(w,{component:"a",href:j(M),target:"_blank",variant:"filled",color:"green",size:"sm",children:a(Q,{size:16,strokeWidth:2.25})})}),a(f,{variant:"default",size:"xs",leftIcon:a(q,{size:16,strokeWidth:1.75}),children:"Import from Sheet"}),a(f,{variant:"default",size:"xs",leftIcon:a(X,{size:16,strokeWidth:1.75}),children:"Export to Sheet"})]})}),a(C,{className:"DocTranslationsPage__toolsMenu",control:a(p,{label:"Tools",children:a(w,{variant:"default",children:a(Y,{size:16})})}),size:220,children:a(C.Item,{className:"DocTranslationsPage__toolsMenu__item",icon:a(K,{size:16}),onClick:()=>ia.open({docId:i,sourceStrings:o,onPruned:n=>{c(d=>{let T={...d};return n.forEach(x=>delete T[x]),T})}}),children:"Prune unused strings"})})]})]}),a("div",{className:y("DocTranslationsPage__content",_&&"DocTranslationsPage__content--loading"),children:_?a(E,{color:"gray",size:"xl"}):a(u.Table,{locales:F,sourceStrings:o,translationsMap:s,onChange:ca,changesMap:I,onSelectLocale:n=>ga(n)})}),a("div",{className:"DocTranslationsPage__footer",children:a("div",{className:"DocTranslationsPage__footer__buttons",children:a(f,{variant:"filled",color:"dark",disabled:!sa,loading:ra,onClick:()=>da(),children:"Save"})})})]})})}u.NotFound=e=>a(S,{children:a("div",{className:"DocTranslationsPage DocTranslationsPage--error",children:a("div",{className:"DocTranslationsPage__error",children:[a("div",{className:"DocTranslationsPage__error__icon",children:a(J,{size:60})}),a("div",{className:"DocTranslationsPage__error__title",children:["Not found: ",e.docId]})]})})});u.Table=e=>{let l=(window.__ROOT_CTX.rootConfig.i18n||{}).locales||[],h=A(()=>{let o={};return Object.values(e.translationsMap).forEach(t=>{o[t.source]=t}),o},[e.translationsMap]);function g(o,t){return{translation:(h[o]||{})[t]||"",hasChanges:!1}}return a("div",{className:"DocTranslationsPage__TableWrap",children:a("table",{className:"DocTranslationsPage__Table",children:[a("thead",{children:a("tr",{children:[a("th",{className:"DocTranslationsPage__Table__sourceCellHeader",children:a("div",{className:"DocTranslationsPage__Table__headerLabel",children:"source"})}),e.locales.map(o=>a("th",{onClick:()=>e.onSelectLocale(o),className:"DocTranslationsPage__Table__localeHeader",children:a(p,{className:"DocTranslationsPage__Table__headerTooltip",placement:"start",withArrow:!0,label:e.locales.length===l.length?`Show only ${o}`:"Show all locales",children:a("div",{className:"DocTranslationsPage__Table__headerLabel",children:o})})},o))]})}),a("tbody",{children:e.sourceStrings.map(o=>a("tr",{children:[a("td",{className:"DocTranslationsPage__Table__sourceCellWrap",children:a("div",{className:"DocTranslationsPage__Table__sourceCell",children:o})}),e.locales.map(t=>{let s=g(o,t);return a("td",{children:a(u.Textarea,{source:o,locale:t,value:s.translation,onChange:e.onChange,changesMap:e.changesMap})},t)})]},o))})]})})};u.Textarea=e=>{let _=$(null),[l,h]=r(e.value),g=null;e.locale in(e.changesMap[e.source]||{})&&(g=e.changesMap[e.source][e.locale]);let o=g!==null&&g!==e.value;function t(){window.requestAnimationFrame(()=>{let s=_.current;s.style.minHeight="auto";let c=s.scrollHeight;s.style.minHeight=`${c}px`})}return k(()=>{t()},[l]),a("textarea",{ref:_,className:y("DocTranslationsPage__Textarea",o&&"DocTranslationsPage__Textarea--hasChanges",!l&&"DocTranslationsPage__Textarea--empty"),onFocus:()=>t(),rows:1,onChange:s=>{let c=s.target.value;h(c),e.onChange(e.source,e.locale,c)},value:l})};export{u as DocTranslationsPage};
1
+ import{b as na}from"./chunk-767BAQ53.js";import{a as ea}from"./chunk-4W73RW5I.js";import{a as aa}from"./chunk-P3NETZZP.js";import{a as Z}from"./chunk-VMT7JFAM.js";import"./chunk-HRGYNHZ3.js";import{b as j}from"./chunk-W3HIZQ4Z.js";import"./chunk-YDO2EDVY.js";import{A as V,t as U}from"./chunk-AFWBSIPL.js";import{b as G}from"./chunk-XOQ3KDSR.js";import{b as O}from"./chunk-62UWGWON.js";import{a as W,b as B}from"./chunk-I6ICVKEC.js";import"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as oa,b as S}from"./chunk-7MTDTPYB.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import{f as y}from"./chunk-AL3TN2KI.js";import{Ab as q,Ga as p,Ha as a,Kc as Q,Oc as Y,V as E,W as w,a as r,c as k,da as R,e as $,ea as f,g as A,hc as J,j as _a,ra as C,zb as X,zc as K}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";_a();function u(e){oa(`Translations: ${e.collection}/${e.slug}`);let[_,l]=r(!0),[h,g]=r(!1),[o,t]=r([]),[s,c]=r({}),[M,ta]=r(null),[sa,N]=r(!1),[I,L]=r({}),[ra,z]=r(!1),m=e.collection,b=e.slug,i=`${m}/${b}`,ia=ea(),P=(window.__ROOT_CTX.rootConfig.i18n||{}).locales||[],[F,H]=na("locale",P);async function la(){try{let[n,d,T]=await Promise.all([aa(i),G(),V(i)]);t(n),c(d),ta(T),l(!1)}catch(n){console.error(n),l(!1),g(!0)}}if(k(()=>{la()},[]),h)return a(u.NotFound,{docId:i});function ca(n,d,T){N(!0),L(x=>{let D={...x},v=D[n]??{};return v.source=n,v[d]=T,D[n]=v,D})}async function da(){z(!0),await O(async()=>{console.log("EditTranslationsModal.onSave()");let n=`edit-translations-${i}`;W({id:n,loading:!0,title:"Saving translations",message:`Updating for ${i}...`,autoClose:!1,disallowClose:!0});let d=Object.values(I);console.log(d),await U(i,d),B({id:n,title:"Saved translations",message:`Updated translations for ${i}!`,autoClose:!0}),L({}),N(!1)}),z(!1)}function ga(n){F.length===P.length?H([n]):H(P)}return a(S,{children:a("div",{className:"DocTranslationsPage",children:[a("div",{className:"DocTranslationsPage__header",children:[a(R,{className:"DocTranslationsPage__header__breadcrumbs",children:[a("a",{href:`/cms/content/${m}`,children:m}),a("a",{href:`/cms/content/${m}/${b}`,children:b}),a("div",{children:"translations"})]}),a("div",{className:"DocTranslationsPage__header__titleWrap",children:a(Z,{size:"h1",children:["Translations: ",i]})}),a("div",{className:"DocTranslationsPage__header__controls",children:[M&&a("div",{className:"DocTranslationsPage__header__linkedSheet",children:a("div",{className:"DocTranslationsPage__header__linkedSheet__controls",children:[a(p,{label:"Open Google Sheet",children:a(w,{component:"a",href:j(M),target:"_blank",variant:"filled",color:"green",size:"sm",children:a(Q,{size:16,strokeWidth:2.25})})}),a(f,{variant:"default",size:"xs",leftIcon:a(q,{size:16,strokeWidth:1.75}),children:"Import from Sheet"}),a(f,{variant:"default",size:"xs",leftIcon:a(X,{size:16,strokeWidth:1.75}),children:"Export to Sheet"})]})}),a(C,{className:"DocTranslationsPage__toolsMenu",control:a(p,{label:"Tools",children:a(w,{variant:"default",children:a(Y,{size:16})})}),size:220,children:a(C.Item,{className:"DocTranslationsPage__toolsMenu__item",icon:a(K,{size:16}),onClick:()=>ia.open({docId:i,sourceStrings:o,onPruned:n=>{c(d=>{let T={...d};return n.forEach(x=>delete T[x]),T})}}),children:"Prune unused strings"})})]})]}),a("div",{className:y("DocTranslationsPage__content",_&&"DocTranslationsPage__content--loading"),children:_?a(E,{color:"gray",size:"xl"}):a(u.Table,{locales:F,sourceStrings:o,translationsMap:s,onChange:ca,changesMap:I,onSelectLocale:n=>ga(n)})}),a("div",{className:"DocTranslationsPage__footer",children:a("div",{className:"DocTranslationsPage__footer__buttons",children:a(f,{variant:"filled",color:"dark",disabled:!sa,loading:ra,onClick:()=>da(),children:"Save"})})})]})})}u.NotFound=e=>a(S,{children:a("div",{className:"DocTranslationsPage DocTranslationsPage--error",children:a("div",{className:"DocTranslationsPage__error",children:[a("div",{className:"DocTranslationsPage__error__icon",children:a(J,{size:60})}),a("div",{className:"DocTranslationsPage__error__title",children:["Not found: ",e.docId]})]})})});u.Table=e=>{let l=(window.__ROOT_CTX.rootConfig.i18n||{}).locales||[],h=A(()=>{let o={};return Object.values(e.translationsMap).forEach(t=>{o[t.source]=t}),o},[e.translationsMap]);function g(o,t){return{translation:(h[o]||{})[t]||"",hasChanges:!1}}return a("div",{className:"DocTranslationsPage__TableWrap",children:a("table",{className:"DocTranslationsPage__Table",children:[a("thead",{children:a("tr",{children:[a("th",{className:"DocTranslationsPage__Table__sourceCellHeader",children:a("div",{className:"DocTranslationsPage__Table__headerLabel",children:"source"})}),e.locales.map(o=>a("th",{onClick:()=>e.onSelectLocale(o),className:"DocTranslationsPage__Table__localeHeader",children:a(p,{className:"DocTranslationsPage__Table__headerTooltip",placement:"start",withArrow:!0,label:e.locales.length===l.length?`Show only ${o}`:"Show all locales",children:a("div",{className:"DocTranslationsPage__Table__headerLabel",children:o})})},o))]})}),a("tbody",{children:e.sourceStrings.map(o=>a("tr",{children:[a("td",{className:"DocTranslationsPage__Table__sourceCellWrap",children:a("div",{className:"DocTranslationsPage__Table__sourceCell",children:o})}),e.locales.map(t=>{let s=g(o,t);return a("td",{children:a(u.Textarea,{source:o,locale:t,value:s.translation,onChange:e.onChange,changesMap:e.changesMap})},t)})]},o))})]})})};u.Textarea=e=>{let _=$(null),[l,h]=r(e.value),g=null;e.locale in(e.changesMap[e.source]||{})&&(g=e.changesMap[e.source][e.locale]);let o=g!==null&&g!==e.value;function t(){window.requestAnimationFrame(()=>{let s=_.current;s.style.minHeight="auto";let c=s.scrollHeight;s.style.minHeight=`${c}px`})}return k(()=>{t()},[l]),a("textarea",{ref:_,className:y("DocTranslationsPage__Textarea",o&&"DocTranslationsPage__Textarea--hasChanges",!l&&"DocTranslationsPage__Textarea--empty"),onFocus:()=>t(),rows:1,onChange:s=>{let c=s.target.value;h(c),e.onChange(e.source,e.locale,c)},value:l})};export{u as DocTranslationsPage};
@@ -0,0 +1 @@
1
+ import{a as je}from"./chunk-767BAQ53.js";import{c as Le,i as Ve,j as Ue,k as We,m as $e}from"./chunk-AEWL2RWR.js";import"./chunk-HHMG665Z.js";import"./chunk-YFA6U2CV.js";import"./chunk-4W73RW5I.js";import"./chunk-P3NETZZP.js";import"./chunk-QGBR3J2Y.js";import"./chunk-KFAZBEPV.js";import"./chunk-KYDOSLTO.js";import{a as Fe}from"./chunk-JYFLU7DM.js";import"./chunk-PHBMVORG.js";import{d as Ne}from"./chunk-JZFTZ4X4.js";import"./chunk-HKINZLMW.js";import{a as Me,d as Ae,f as q,h as Oe}from"./chunk-TJBVMFNQ.js";import"./chunk-CGCKJFL4.js";import"./chunk-VMT7JFAM.js";import"./chunk-SKEP5WYH.js";import"./chunk-7UIUAHC4.js";import{b as Re,c as ae,g as Te}from"./chunk-P4U2LUTF.js";import"./chunk-3IYZCUPI.js";import"./chunk-RSVO46S3.js";import"./chunk-54DVDYU6.js";import{a as R}from"./chunk-X2WHBGTP.js";import{b as Be,c as se}from"./chunk-ONTGW2VA.js";import"./chunk-4KE2SZKH.js";import{a as ze}from"./chunk-L4RHGQUG.js";import"./chunk-HRGYNHZ3.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import"./chunk-62UWGWON.js";import"./chunk-I6ICVKEC.js";import"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as He,b as Xe}from"./chunk-7MTDTPYB.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import{f as I}from"./chunk-AL3TN2KI.js";import{Aa as _e,Ac as Ie,Ga as T,Ha as e,Ja as pe,P as me,Pa as ge,Ra as oe,Ta as fe,Tc as Ee,Uc as ne,Va as ve,Vb as De,W as N,Wb as Ce,_a as Pe,a as y,c as b,ca as he,e as P,ea as j,g as B,h as C,j as te,pc as Se,qb as we,rb as xe,sb as be,tb as ke,tc as ye}from"./chunk-NZHF733K.js";import{d as O,j as ue,k as tt}from"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";te();te();async function qe(t,n){let a=await(await fetch("/cms/api/check.test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({check:t,docId:n})})).json();if(!a.success)throw new Error(a.error||"Check failed.");return a.data}function Ke(t){let n=window.__ROOT_CTX.checks||[],o=t.docId.split("/")[0],a=n.filter(s=>!s.collections||s.collections.includes(o)),[i,r]=y({}),c=C(async s=>{r(m=>({...m,[s]:{loading:!0}}));try{let m=await qe(s,t.docId);r(h=>({...h,[s]:{loading:!1,result:m}}))}catch(m){r(h=>({...h,[s]:{loading:!1,error:m.message||"Unknown error."}}))}},[t.docId]),l=C(async()=>{let s={};for(let m of a)s[m.id]={loading:!0};r(s);for(let m of a)try{let h=await qe(m.id,t.docId);r(_=>({..._,[m.id]:{loading:!1,result:h}}))}catch(h){r(_=>({..._,[m.id]:{loading:!1,error:h.message||"Unknown error."}}))}},[t.docId,a]);return e("div",{className:"ChecksPanel",children:[e("div",{className:"ChecksPanel__header",children:[e("div",{className:"ChecksPanel__header__title",children:"Checks"}),e(j,{variant:"default",size:"xs",compact:!0,leftIcon:e(Se,{size:12}),onClick:l,children:"Run All"})]}),e("div",{className:"ChecksPanel__body",children:e("div",{className:"ChecksPanel__checks",children:a.map(s=>{let m=i[s.id];return e(ot,{check:s,state:m,onRun:()=>c(s.id)},s.id)})})})]})}function ot(t){let{check:n,state:o,onRun:a}=t;return e("div",{className:"ChecksPanel__check",children:[e("div",{className:"ChecksPanel__check__header",children:[e("div",{className:"ChecksPanel__check__label",children:[n.label,o?.result&&e(it,{status:o.result.status})]}),e(j,{className:"ChecksPanel__check__runButton",variant:"default",size:"xs",compact:!0,loading:o?.loading,onClick:a,children:"Run"})]}),n.description&&e("div",{className:"ChecksPanel__check__description",children:n.description}),o?.result&&e("div",{className:I("ChecksPanel__check__result",`ChecksPanel__check__result--${o.result.status}`),children:e(Ne,{code:o.result.message})}),o?.error&&e("div",{className:"ChecksPanel__check__error",children:o.error})]})}var nt={success:"green",warning:"yellow",error:"red"},at={success:Pe,warning:pe,error:ne};function it(t){let n=nt[t.status],o=at[t.status],a=t.status.charAt(0).toUpperCase()+t.status.slice(1);return e(he,{className:"ChecksPanel__statusBadge",color:n,size:"sm",variant:"filled",leftSection:e(o,{size:10}),children:a})}function Je(t){let{device:n,expandVertically:o,iframeUrl:a,localeOptions:i,selectedLocale:r,onToggleDevice:c,onToggleExpandVertically:l,onReloadClick:s,onOpenNewTab:m,onLocaleChange:h}=t;return e("div",{className:"DocumentPagePreviewBar",children:[e("div",{className:"DocumentPagePreviewBar__devices",children:[e(T,{label:"Mobile",children:e(N,{className:I("DocumentPagePreviewBar__device",n==="mobile"&&"active"),onClick:()=>c("mobile"),children:e(ke,{size:16})})}),e(T,{label:"Tablet",children:e(N,{className:I("DocumentPagePreviewBar__device",n==="tablet"&&"active"),onClick:()=>c("tablet"),children:e(be,{size:16})})}),e(T,{label:"Desktop",children:e(N,{className:I("DocumentPagePreviewBar__device",n==="desktop"&&"active"),onClick:()=>c("desktop"),children:e(we,{size:16})})}),e(T,{label:"Expand",children:e(N,{className:I("DocumentPagePreviewBar__device",o&&"active"),"aria-pressed":o,disabled:n==="",onClick:l,children:e(fe,{size:16})})})]}),e("div",{className:"DocumentPagePreviewBar__navbar",children:e("div",{className:"DocumentPagePreviewBar__navbar__url",children:a})}),e("div",{className:"DocumentPagePreviewBar__locales",children:e(_e,{data:i,placeholder:"Locale",radius:"xl",size:"xs",required:!0,icon:e(Ee,{size:16,strokeWidth:1.5}),value:r,onChange:_=>{h(_)}})}),e("div",{className:"DocumentPagePreviewBar__buttons",children:[e(T,{label:"Reload",children:e(N,{className:"DocumentPagePreviewBar__button DocumentPagePreviewBar__button--reload",onClick:s,children:e(ye,{size:16})})}),e(T,{label:"Open new tab",children:e(N,{className:"DocumentPagePreviewBar__button DocumentPagePreviewBar__button--openNewTab",onClick:m,children:e(oe,{size:16})})})]})]})}te();function Ye(t){let n=t.docId.split("/")[0],o=Te(n),a=q(),i=P(null),[r,c]=y(""),[l,s]=y([]),[m,h]=y(!1),_=P("");_.current=r;let v=P(o.schema?.fields||[]);v.current=o.schema?.fields||[];let D=P(o.schema?.types||{});D.current=o.schema?.types||{};let x=B(()=>Me(u=>{let k=u.trim();if(!k){s([]),h(!1);return}let S=a.controller?.getData()?.fields||{},L=We(k,S,v.current,D.current);s(L),h(!0)},150),[a.controller]);b(()=>{x(r)},[r,x]),Oe(()=>{_.current.trim()&&x(_.current)}),b(()=>{t.autoFocus&&requestAnimationFrame(()=>{i.current?.focus(),i.current?.select()})},[t.autoFocus]),b(()=>{let u=()=>{i.current?.focus(),i.current?.select()};return window.addEventListener("root:focus-search",u),()=>window.removeEventListener("root:focus-search",u)},[]);let g=u=>{st(u)};return e("div",{className:"SearchPanel",children:[e("div",{className:"SearchPanel__header",children:[e("div",{className:"SearchPanel__header__title",children:"Search"}),t.onClose&&e(N,{size:"xs",onClick:t.onClose,title:"Close search",children:e(ne,{size:14})})]}),e("div",{className:"SearchPanel__searchInput",children:[e("span",{className:"SearchPanel__searchInput__icon",children:e(Ie,{size:14})}),e("input",{ref:i,type:"text",className:"SearchPanel__searchInput__input",value:r,onInput:u=>c(u.currentTarget.value),onKeyDown:u=>{u.key==="Escape"&&t.onClose&&(u.preventDefault(),t.onClose())},placeholder:"Search field values\u2026",autoComplete:"off",spellcheck:!1})]}),e("div",{className:"SearchPanel__body",children:[!m&&!r.trim()&&e("div",{className:"SearchPanel__empty",children:"Type a query above to search field values in this document."}),m&&l.length===0&&e("div",{className:"SearchPanel__empty",children:["No matches for ",e("strong",{children:r}),"."]}),l.length>0&&e(O,{children:[e("div",{className:"SearchPanel__resultsCount",children:[l.length," ",l.length===1?"match":"matches"]}),e("ul",{className:"SearchPanel__results",children:l.map((u,k)=>e(rt,{result:u,onClick:()=>g(u)},`${u.deepKey}:${k}`))})]})]})]})}function rt(t){let{result:n}=t;return e("li",{className:"SearchPanel__result",children:e("button",{type:"button",className:"SearchPanel__result__button",onClick:t.onClick,children:[e("div",{className:"SearchPanel__result__label",children:n.label}),e("div",{className:"SearchPanel__result__snippet",children:ct(n.snippet,n.matches)}),e("div",{className:"SearchPanel__result__meta",children:[e("span",{className:"SearchPanel__result__type",children:n.fieldType}),n.richTextBlock&&e("span",{className:"SearchPanel__result__badge",children:"in block"}),n.richTextInline&&e("span",{className:"SearchPanel__result__badge",children:"inline"})]})]})})}function ct(t,n){if(!n||n.length===0)return t;let o=[],a=0;for(let i of n)i.start>a&&o.push({text:t.slice(a,i.start),match:!1}),o.push({text:t.slice(i.start,i.end),match:!0}),a=i.end;return a<t.length&&o.push({text:t.slice(a),match:!1}),o.map((i,r)=>i.match?e("mark",{children:i.text},r):e("span",{children:i.text},r))}function st(t){if(window.postMessage({scrollToDeeplink:{deepKey:t.deepKey}},"*"),t.richTextBlock){let n=t.richTextBlock;setTimeout(()=>{window.dispatchEvent(new CustomEvent(Ve,{detail:n}))},350)}else if(t.richTextInline){let n=t.richTextInline;setTimeout(()=>{window.dispatchEvent(new CustomEvent(Ue,{detail:n}))},350)}}tt();te();var lt=ue(null);function K(t){let{className:n,localStorageId:o,children:a}=t,[i,r]=R(`root::SplitPanel:${o}`,350),[c,l]=y(!1),[s,m]=y(0),h=B(()=>new Set,[]),_=P(null),v=P(null),D={onResize:g=>(h.add(g),()=>{h.delete(g)})};if(b(()=>{let g=()=>l(!1);window.addEventListener("mouseup",g);let u=_.current;return u&&m(u.getBoundingClientRect().left),()=>window.removeEventListener("mouseup",g)},[]),b(()=>{let g=u=>{let k=u.clientX-s;r(k),h.forEach(S=>S())};return c&&window.addEventListener("mousemove",g),()=>window.removeEventListener("mousemove",g)},[c]),a?.length!==2)throw new Error("SplitPanel should have two <SplitPanel.Item> children.");let x={"--panel-size":`${i}px`};return e(lt.Provider,{value:D,children:e("div",{className:I(n,"SplitPanel",c&&"dragging"),ref:_,style:x,children:[a[0],e("div",{className:"SplitPanel__divider",ref:v,onMouseDown:()=>l(!0)}),a[1]]})})}K.Item=t=>e("div",{className:I("SplitPanel__item",t.className,t.fluid?"fluid":"static"),children:t.children});function le(t,n,o=""){let a=ae({collectionId:t,slug:n}),i=new URLSearchParams(window.location.search);i.set("preview","true"),i.delete("locale"),i.delete("modal");let r=`${i.toString()}${window.location.hash}`;return o?`${ae({collectionId:t,slug:n,locale:o})}?${r}`:`${a}?${r}`}function dt(t,n){let o=new URL(n,window.location.origin);try{let a=t.contentWindow?.location.href;if(a&&!a.startsWith("about:blank")){let i=new URL(a);i.origin===o.origin&&i.pathname===o.pathname&&(i.searchParams.forEach((r,c)=>{o.searchParams.set(c,r)}),o.hash=i.hash)}}catch{}return o.searchParams.set("preview","true"),o.toString()}function Ge(t){let n=t.collection,o=t.slug,a=`${n}/${o}`,{roles:i}=ze(),r=window.firebase.user.email||"",c=Be(i,r);return e(Ae,{docId:a,readOnly:!c,children:e(ut,{...t,canEdit:c})})}function ut(t){let n=t.canEdit,o=t.collection,a=t.slug,i=`${o}/${a}`;He(i);let r=window.__ROOT_CTX.collections[o],c=q(),l=!!r?.url,[s,m]=R(`root::DocumentPage::previewVisible::${o}`,l),h=B(()=>(window.__ROOT_CTX.checks||[]).some(f=>!f.collections||f.collections.includes(o)),[o]),[_,v]=R("root::DocumentPage::checksVisible",!1),D=P(_);D.current=_;let[x,g]=R("root::DocumentPage::searchVisible",!1),u=P(x);u.current=x;let k=!!(window.__ROOT_CTX.ai||window.__ROOT_CTX.experiments?.ai),[S,L]=R("root::DocumentPage::aiVisible",!1),M=P(S);M.current=S,b(()=>{window.dispatchEvent(new CustomEvent("root:checks-visible",{detail:_}))},[_]),b(()=>{window.dispatchEvent(new CustomEvent("root:search-visible",{detail:x}))},[x]),b(()=>{window.dispatchEvent(new CustomEvent("root:ai-visible",{detail:S}))},[S]);let[U,J]=R("root::DocumentPage::searchPanelWidth",360),[W,$]=y(U),[F,H]=y(!1),Y=P(null);if(b(()=>{let p=()=>{let f=!D.current;v(()=>f),f&&(g(()=>!1),L(()=>!1))};return window.addEventListener("root:toggle-checks",p),()=>window.removeEventListener("root:toggle-checks",p)},[]),b(()=>{let p=()=>{let f=!u.current;g(()=>f),f&&(v(()=>!1),L(()=>!1),requestAnimationFrame(()=>{window.dispatchEvent(new CustomEvent("root:focus-search"))}))};return window.addEventListener("root:toggle-search",p),()=>window.removeEventListener("root:toggle-search",p)},[]),b(()=>{let p=()=>{let f=!M.current;L(()=>f),f&&(v(()=>!1),g(()=>!1))};return window.addEventListener("root:toggle-ai",p),()=>window.removeEventListener("root:toggle-ai",p)},[]),b(()=>{if(!F)return;let p=A=>{let V=Y.current;if(!V)return;let re=V.getBoundingClientRect(),ce=Math.max(240,Math.min(re.right-A.clientX,800));$(ce)},f=()=>{H(!1),$(A=>(J(()=>A),A))};return window.addEventListener("mousemove",p),window.addEventListener("mouseup",f),()=>{window.removeEventListener("mousemove",p),window.removeEventListener("mouseup",f)}},[F]),!r)return e("div",{children:"Could not find collection."});let ie=C(()=>{if(!l)return;let p=le(o,a),f=window.open(p,"_blank","noopener,noreferrer");f&&f.focus()},[l,o,a]),Q=C(()=>{n&&c.controller&&c.controller.flush()},[n,c.controller]),G=Le(),X=C(()=>{let p=c.controller?.getData()?.fields||{};G.open({data:p,onSave:f=>{c.controller&&f&&typeof f=="object"&&(c.controller.updateKey("fields",f),c.controller.flush()),G.close()}})},[c.controller]),d=C(()=>{window.dispatchEvent(new CustomEvent("root:toggle-search"))},[]),w=C(()=>{k&&window.dispatchEvent(new CustomEvent("root:toggle-ai"))},[k]),E=C(()=>{L(()=>!1)},[L]);return me([["mod+S",Q],["mod+shift+F",d],["mod+I",w]]),e(Xe,{children:e("div",{className:I("DocumentPage__layout",F&&"DocumentPage__layout--dragging"),ref:Y,children:[e(K,{className:"DocumentPage",localStorageId:"DocumentPage",children:[e(K.Item,{className:I("DocumentPage__side",(!l||!s)&&"DocumentPage__side--expanded"),children:[e("div",{className:"DocumentPage__side__header",children:[e("div",{className:"DocumentPage__side__header__nav",children:[e("a",{href:`/cms/content/${o}`,children:e(N,{className:"DocumentPage__side__header__back",children:e(ge,{size:16})})}),e("div",{className:"DocumentPage__side__header__docId",children:i})]}),e("div",{className:"DocumentPage__side__header__buttons",children:[e(se,{label:"You don't have access to edit this document",condition:!n,children:e(j,{className:"DocumentPage__side__header__saveButton",variant:"filled",color:"dark",size:"xs",compact:!0,leftIcon:e(xe,{size:16}),onClick:()=>Q(),disabled:!n,children:"Save"})}),e(se,{label:"You don't have access to edit this document",condition:!n,children:e(T,{label:"Edit JSON",disabled:!n,children:e(N,{className:"DocumentPage__side__header__editJson",onClick:()=>X(),disabled:!n,children:e(ve,{size:14})})})}),l&&e(O,{children:[e(T,{label:s?"Hide preview":"Show preview",children:e(N,{className:"DocumentPage__side__header__previewToggle",onClick:()=>m(!s),children:s?e(De,{size:16}):e(Ce,{size:16})})}),!s&&e(T,{label:"Open preview in new tab",children:e(N,{className:"DocumentPage__side__header__openNewTab",onClick:ie,children:e(oe,{size:16})})})]})]})]}),e("div",{className:I("DocumentPage__side__editor",(!l||!s)&&!_&&!x&&!S&&"DocumentPage__side__editor--centered"),children:e($e,{docId:i})})]}),e(K.Item,{className:I("DocumentPage__main",(!l||!s)&&"DocumentPage__main--hidden"),fluid:!0,children:l&&s&&e(Ge.Preview,{docId:i},i)})]}),h&&_&&e(ht,{docId:i}),x&&e(O,{children:[e("div",{className:"DocumentPage__searchDivider",onMouseDown:()=>H(!0)}),e("div",{className:"DocumentPage__search",style:{flexBasis:`${W}px`},children:e(Ye,{docId:i,autoFocus:!0,onClose:()=>g(()=>!1)})})]}),k&&S&&e(mt,{docId:i,onClose:E})]})})}function mt(t){let[n,o]=R("root::DocumentPage::aiPanelWidth",420),[a,i]=y(n),r=P(null),c=P(a),l=P(),s=B(()=>e(Fe,{variant:"panel",docContext:{docId:t.docId},onClose:t.onClose}),[t.docId,t.onClose]),m=C(()=>{let h=r.current?.parentElement;if(!h)return;c.current=a,h.classList.add("DocumentPage__layout--dragging");let _=x=>{let g=r.current?.parentElement;if(!g)return;let u=g.getBoundingClientRect(),k=Math.max(280,Math.min(u.right-x.clientX,800));c.current=k,i(k)},v=()=>{h.classList.remove("DocumentPage__layout--dragging"),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",D),l.current=void 0},D=()=>{v(),o(()=>c.current)};l.current=v,window.addEventListener("mousemove",_),window.addEventListener("mouseup",D)},[a,o]);return b(()=>()=>l.current?.(),[]),e(O,{children:[e("div",{className:"DocumentPage__aiDivider",ref:r,onMouseDown:m}),e("div",{className:"DocumentPage__ai",style:{flexBasis:`${a}px`},children:s})]})}function ht(t){let[n,o]=R("root::DocumentPage::checksPanelWidth",360),[a,i]=y(n),r=P(null),c=P(a),l=P(),s=B(()=>e(Ke,{docId:t.docId}),[t.docId]),m=C(()=>{let h=r.current?.parentElement;if(!h)return;c.current=a,h.classList.add("DocumentPage__layout--dragging");let _=x=>{let g=r.current?.parentElement;if(!g)return;let u=g.getBoundingClientRect(),k=Math.max(200,Math.min(u.right-x.clientX,800));c.current=k,i(k)},v=()=>{h.classList.remove("DocumentPage__layout--dragging"),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",D),l.current=void 0},D=()=>{v(),o(()=>c.current)};l.current=v,window.addEventListener("mousemove",_),window.addEventListener("mouseup",D)},[a,o]);return b(()=>()=>l.current?.(),[]),e(O,{children:[e("div",{className:"DocumentPage__checksDivider",ref:r,onMouseDown:m}),e("div",{className:"DocumentPage__checks",style:{flexBasis:`${a}px`},children:s})]})}var Qe={mobile:[430,932],tablet:[768,1024],desktop:[1440,800]};function _t(t){let n=new Intl.DisplayNames(["en"],{type:"language"}),a=t.split("_")[0];return`${n.of(a)||t} (${t})`}Ge.Preview=t=>{let n=q();if(n.loading)return null;let[o,a]=t.docId.split("/"),r=window.__ROOT_CTX.collections[o];if(!r)throw new Error(`collection not found: ${o}`);if(!r.url)return null;let c=r.domain||window.__ROOT_CTX.rootConfig.domain||"https://example.com",l=Re({collectionId:o,slug:a}),s=ae({collectionId:o,slug:a}),m=`${c}${l}`,[h,_]=y(m),[v,D]=R("root::DocumentPage::preview::device",""),[x,g]=R("root::DocumentPage::preview::expandVertically",!1),[u,k]=y({"--iframe-width":"100%","--iframe-height":"100%","--iframe-scale":"1"}),[S,L]=je("locale",""),M=P(null),U=P(null),J=n.controller.getLocales()||[],W=le(o,a,S),$=P(W);$.current=W;let F=B(()=>[{value:"",label:"Select locale"},...J.map(d=>({value:d,label:_t(d)}))],[J]);function H(){if(document.hidden)return;let d=M.current,w=dt(d,$.current);d.src="about:blank",window.requestAnimationFrame(()=>{d.src!==w?d.src=w:d.contentWindow.location.reload()})}b(()=>{let d=M.current;function w(){let p=d.contentWindow;if(p&&s===l&&!p.location.href.startsWith("about:blank")){let f=p.location;_(`${c}${f.pathname}`)}}d.addEventListener("load",w);let E=n.controller?.onFlush(()=>{H()});return()=>{E(),d.removeEventListener("load",w)}},[]),b(()=>{let d=M.current;d.src=W},[S]);let Y=C(d=>{D(w=>{let E=w===d?"":d;return E===""&&g(!1),E})},[D,g]),ie=C(()=>{D(d=>(d&&g(w=>!w),d))},[D,g]),Q=C(()=>{n.controller&&n.controller.flush().then(()=>H())},[n.controller]),G=C(()=>{let d=le(o,a,S),w=window.open(d,"_blank","noopener,noreferrer");w&&w.focus()},[o,a,S]),X=C(()=>{if(v===""){let z={"--iframe-width":"100%","--iframe-height":"100%","--iframe-scale":"1"};k(ee=>ee["--iframe-width"]===z["--iframe-width"]&&ee["--iframe-height"]===z["--iframe-height"]&&ee["--iframe-scale"]===z["--iframe-scale"]?ee:z);return}let d=U.current;if(!d)return;let w=d.getBoundingClientRect(),[E,p]=Qe[v],f=20,A=Math.max(w.width-2*f,0),V=Math.max(w.height-2*f,0),re=A>0&&E>0?A/E:1,ce=V>0&&p>0?V/p:1,Ze=Math.min(re,ce,1),de=Number(Ze.toFixed(4))||1,et=x?`${V/de}px`:`${p}px`,Z={"--iframe-width":`${E}px`,"--iframe-height":et,"--iframe-scale":String(de)};k(z=>z["--iframe-width"]===Z["--iframe-width"]&&z["--iframe-height"]===Z["--iframe-height"]&&z["--iframe-scale"]===Z["--iframe-scale"]?z:Z)},[v,x]);return b(()=>{X();let d=U.current;if(!d)return;let w=0,E=()=>{window.cancelAnimationFrame(w),w=window.requestAnimationFrame(X)},p=new window.ResizeObserver(E);return p.observe(d),window.addEventListener("resize",E),()=>{window.cancelAnimationFrame(w),p.disconnect(),window.removeEventListener("resize",E)}},[X]),e("div",{className:"DocumentPage__main__preview",children:[e(Je,{device:v,expandVertically:x,iframeUrl:h,localeOptions:F,selectedLocale:S,onToggleDevice:Y,onToggleExpandVertically:ie,onReloadClick:Q,onOpenNewTab:G,onLocaleChange:L}),e("div",{className:"DocumentPage__main__previewFrame","data-device":v||"full",ref:U,style:u,children:[e("div",{className:"DocumentPage__main__previewFrame__deviceLabel",style:{display:v?void 0:"none"},children:v?`${v}: ${Qe[v].join("x")}`:""}),e("div",{className:"DocumentPage__main__previewFrame__iframeWrap",children:e("iframe",{ref:M,title:"iframe preview"})})]})]})};export{Ge as DocumentPage};
@@ -1 +1 @@
1
- import{a as H}from"./chunk-C5NH23G4.js";import"./chunk-CGCKJFL4.js";import{a as M}from"./chunk-VMT7JFAM.js";import{a as B,c as _}from"./chunk-ONTGW2VA.js";import{c as u,f as A,g as E,j as T,l as z}from"./chunk-4KE2SZKH.js";import{a as N}from"./chunk-L4RHGQUG.js";import{a as w,c as p}from"./chunk-HRGYNHZ3.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import{a as F}from"./chunk-PJA7YP4A.js";import"./chunk-62UWGWON.js";import{a as s,b as r}from"./chunk-I6ICVKEC.js";import{a as m}from"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as O,b as L}from"./chunk-FBJURT7Z.js";import"./chunk-EGEB6N4J.js";import{d as y}from"./chunk-AL3TN2KI.js";import{Ga as n,Ha as e,Ma as I,W as l,Xc as $,a as D,c as x,da as P,j as K,jb as k,uc as U}from"./chunk-NZHF733K.js";import{d as S}from"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";K();function ve(a){O(`Edit Data Source: ${a.id}`);let{route:b}=y(),[v,h]=D(null),i=w(),f=p(),{roles:g}=N(),R=window.firebase.user.email||"",t=B(g,R);x(()=>{u(a.id).then(o=>{h(o)})},[a.id]);function W(){let o=`delete-data-source-${a.id}`,d=i.openConfirmModal({...f,title:"Delete data source",children:e(m,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to delete data source ",e("code",{children:a.id}),"? All previously synced data will be deleted. There is no undo."]}),labels:{confirm:"Delete",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{s({id:o,title:"Deleting data source",message:`Deleting ${a.id} and synced data...`,loading:!0,autoClose:!1}),await z(a.id),r({id:o,title:"Deleted data source",message:`Successfully deleted ${a.id}`,loading:!1,autoClose:5e3}),i.closeModal(d),b("/cms/data")}})}function Y(){let o=`archive-data-source-${a.id}`,d=!!v?.publishedAt,c=i.openConfirmModal({...f,title:"Archive data source",children:e(m,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to archive data source ",e("code",{children:a.id}),"? Archived data sources cannot be synced or published.",d&&e(S,{children:[" ","Note: previously published data will remain available until the data source is unpublished."]})]}),labels:{confirm:"Archive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{s({id:o,title:"Archiving data source",message:`Archiving ${a.id}...`,loading:!0,autoClose:!1}),await A(a.id);let J=await u(a.id);h(J),r({id:o,title:"Archived data source",message:`Successfully archived ${a.id}`,loading:!1,autoClose:5e3}),i.closeModal(c),b("/cms/data")}})}function j(){let o=`unarchive-data-source-${a.id}`,d=i.openConfirmModal({...f,title:"Unarchive data source",children:e(m,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to unarchive data source ",e("code",{children:a.id}),"?"]}),labels:{confirm:"Unarchive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{s({id:o,title:"Unarchiving data source",message:`Unarchiving ${a.id}...`,loading:!0,autoClose:!1}),await E(a.id);let c=await u(a.id);h(c),r({id:o,title:"Unarchived data source",message:`Successfully unarchived ${a.id}`,loading:!1,autoClose:5e3}),i.closeModal(d),b(`/cms/data/${a.id}`)}})}function q(){let o=`unpublish-data-source-${a.id}`,d=i.openConfirmModal({...f,title:"Unpublish data source",children:e(m,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to unpublish data source ",e("code",{children:a.id}),"? The published data will be removed and will no longer be available to production. There is no undo."]}),labels:{confirm:"Unpublish",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{s({id:o,title:"Unpublishing data source",message:`Unpublishing ${a.id}...`,loading:!0,autoClose:!1}),await T(a.id);let c=await u(a.id);h(c),r({id:o,title:"Unpublished data source",message:`Successfully unpublished ${a.id}`,loading:!1,autoClose:5e3}),i.closeModal(d)}})}let G=!!v?.publishedAt,C=!!v?.archivedAt;return e(L,{children:e("div",{className:"EditDataSourcePage",children:[e("div",{className:"EditDataSourcePage__header",children:[e(P,{className:"EditDataSourcePage__header__breadcrumbs",children:[e("a",{href:"/cms/data",children:"Data Sources"}),e("a",{href:`/cms/data/${a.id}`,children:a.id}),e("div",{children:"Edit"})]}),e("div",{className:"EditDataSourcePage__header__titleWrap",children:[e(M,{size:"h1",children:["Edit Data Source: ",a.id]}),e("div",{className:"EditDataSourcePage__header__controls",children:[G&&!C&&e(_,{label:"You don't have access to unpublish data sources",condition:!t,children:e(n,{label:"Unpublish",disabled:!t,children:e(l,{onClick:q,loading:!g,disabled:!t,children:e(k,{size:20,stroke:"1.5"})})})}),e(_,{label:"You don't have access to archive data sources",condition:!t,children:C?e(n,{label:"Unarchive",disabled:!t,children:e(l,{onClick:j,loading:!g,disabled:!t,children:e(U,{size:20,stroke:"1.5"})})}):e(n,{label:"Archive",disabled:!t,children:e(l,{onClick:Y,loading:!g,disabled:!t,children:e(I,{size:20,stroke:"1.5"})})})}),e(n,{label:"Delete",children:e(l,{onClick:W,children:e($,{size:20,stroke:"1.5"})})})]})]})]}),e(F,{className:"EditDataSourcePage__form",children:e(H,{dataSourceId:a.id})})]})})}export{ve as EditDataSourcePage};
1
+ import{a as H}from"./chunk-C5NH23G4.js";import"./chunk-CGCKJFL4.js";import{a as M}from"./chunk-VMT7JFAM.js";import{a as B,c as _}from"./chunk-ONTGW2VA.js";import{c as u,f as A,g as E,j as T,l as z}from"./chunk-4KE2SZKH.js";import{a as N}from"./chunk-L4RHGQUG.js";import{a as w,c as p}from"./chunk-HRGYNHZ3.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import{a as F}from"./chunk-PJA7YP4A.js";import"./chunk-62UWGWON.js";import{a as s,b as r}from"./chunk-I6ICVKEC.js";import{a as m}from"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as O,b as L}from"./chunk-7MTDTPYB.js";import"./chunk-EGEB6N4J.js";import{d as y}from"./chunk-AL3TN2KI.js";import{Ga as n,Ha as e,Ma as I,W as l,Xc as $,a as D,c as x,da as P,j as K,jb as k,uc as U}from"./chunk-NZHF733K.js";import{d as S}from"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";K();function ve(a){O(`Edit Data Source: ${a.id}`);let{route:b}=y(),[v,h]=D(null),i=w(),f=p(),{roles:g}=N(),R=window.firebase.user.email||"",t=B(g,R);x(()=>{u(a.id).then(o=>{h(o)})},[a.id]);function W(){let o=`delete-data-source-${a.id}`,d=i.openConfirmModal({...f,title:"Delete data source",children:e(m,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to delete data source ",e("code",{children:a.id}),"? All previously synced data will be deleted. There is no undo."]}),labels:{confirm:"Delete",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{s({id:o,title:"Deleting data source",message:`Deleting ${a.id} and synced data...`,loading:!0,autoClose:!1}),await z(a.id),r({id:o,title:"Deleted data source",message:`Successfully deleted ${a.id}`,loading:!1,autoClose:5e3}),i.closeModal(d),b("/cms/data")}})}function Y(){let o=`archive-data-source-${a.id}`,d=!!v?.publishedAt,c=i.openConfirmModal({...f,title:"Archive data source",children:e(m,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to archive data source ",e("code",{children:a.id}),"? Archived data sources cannot be synced or published.",d&&e(S,{children:[" ","Note: previously published data will remain available until the data source is unpublished."]})]}),labels:{confirm:"Archive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{s({id:o,title:"Archiving data source",message:`Archiving ${a.id}...`,loading:!0,autoClose:!1}),await A(a.id);let J=await u(a.id);h(J),r({id:o,title:"Archived data source",message:`Successfully archived ${a.id}`,loading:!1,autoClose:5e3}),i.closeModal(c),b("/cms/data")}})}function j(){let o=`unarchive-data-source-${a.id}`,d=i.openConfirmModal({...f,title:"Unarchive data source",children:e(m,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to unarchive data source ",e("code",{children:a.id}),"?"]}),labels:{confirm:"Unarchive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{s({id:o,title:"Unarchiving data source",message:`Unarchiving ${a.id}...`,loading:!0,autoClose:!1}),await E(a.id);let c=await u(a.id);h(c),r({id:o,title:"Unarchived data source",message:`Successfully unarchived ${a.id}`,loading:!1,autoClose:5e3}),i.closeModal(d),b(`/cms/data/${a.id}`)}})}function q(){let o=`unpublish-data-source-${a.id}`,d=i.openConfirmModal({...f,title:"Unpublish data source",children:e(m,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to unpublish data source ",e("code",{children:a.id}),"? The published data will be removed and will no longer be available to production. There is no undo."]}),labels:{confirm:"Unpublish",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{s({id:o,title:"Unpublishing data source",message:`Unpublishing ${a.id}...`,loading:!0,autoClose:!1}),await T(a.id);let c=await u(a.id);h(c),r({id:o,title:"Unpublished data source",message:`Successfully unpublished ${a.id}`,loading:!1,autoClose:5e3}),i.closeModal(d)}})}let G=!!v?.publishedAt,C=!!v?.archivedAt;return e(L,{children:e("div",{className:"EditDataSourcePage",children:[e("div",{className:"EditDataSourcePage__header",children:[e(P,{className:"EditDataSourcePage__header__breadcrumbs",children:[e("a",{href:"/cms/data",children:"Data Sources"}),e("a",{href:`/cms/data/${a.id}`,children:a.id}),e("div",{children:"Edit"})]}),e("div",{className:"EditDataSourcePage__header__titleWrap",children:[e(M,{size:"h1",children:["Edit Data Source: ",a.id]}),e("div",{className:"EditDataSourcePage__header__controls",children:[G&&!C&&e(_,{label:"You don't have access to unpublish data sources",condition:!t,children:e(n,{label:"Unpublish",disabled:!t,children:e(l,{onClick:q,loading:!g,disabled:!t,children:e(k,{size:20,stroke:"1.5"})})})}),e(_,{label:"You don't have access to archive data sources",condition:!t,children:C?e(n,{label:"Unarchive",disabled:!t,children:e(l,{onClick:j,loading:!g,disabled:!t,children:e(U,{size:20,stroke:"1.5"})})}):e(n,{label:"Archive",disabled:!t,children:e(l,{onClick:Y,loading:!g,disabled:!t,children:e(I,{size:20,stroke:"1.5"})})})}),e(n,{label:"Delete",children:e(l,{onClick:W,children:e($,{size:20,stroke:"1.5"})})})]})]})]}),e(F,{className:"EditDataSourcePage__form",children:e(H,{dataSourceId:a.id})})]})})}export{ve as EditDataSourcePage};
@@ -1 +1 @@
1
- import{a as k}from"./chunk-MDUBCXU2.js";import"./chunk-JHBAMPGB.js";import"./chunk-V7S4IAGB.js";import{a as A}from"./chunk-VMT7JFAM.js";import"./chunk-NXQVLOTK.js";import"./chunk-3IYZCUPI.js";import{c as s,e as E,f as w}from"./chunk-RSVO46S3.js";import"./chunk-54DVDYU6.js";import"./chunk-X2WHBGTP.js";import{a as z,c as I}from"./chunk-ONTGW2VA.js";import"./chunk-4KE2SZKH.js";import{a as T}from"./chunk-L4RHGQUG.js";import{a as x,c as P}from"./chunk-HRGYNHZ3.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import"./chunk-62UWGWON.js";import{a as h,b as f}from"./chunk-I6ICVKEC.js";import{a as g}from"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as $,b as U}from"./chunk-FBJURT7Z.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import{d as C}from"./chunk-AL3TN2KI.js";import{Ga as m,Ha as e,Ma as y,W as c,a as v,c as R,da as b,j as B,uc as p}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";B();function se(i){$(`Edit Release: ${i.id}`);let{route:u}=C(),[N,t]=v(null),l=x(),_=P(),{roles:d}=T(),M=window.firebase.user.email||"",o=z(d,M);R(()=>{s(i.id).then(a=>{t(a)})},[i.id]);function L(){let a=`archive-release-${i.id}`,n=l.openConfirmModal({..._,title:"Archive release",children:e(g,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to archive release ",e("code",{children:i.id}),"?"]}),labels:{confirm:"Archive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{h({id:a,title:"Archiving release",message:`Archiving ${i.id}...`,loading:!0,autoClose:!1}),await E(i.id);let r=await s(i.id);t(r),f({id:a,title:"Archived release",message:`Successfully archived ${i.id}`,loading:!1,autoClose:5e3}),l.closeModal(n),u("/cms/releases")}})}function S(){let a=`unarchive-release-${i.id}`,n=l.openConfirmModal({..._,title:"Unarchive release",children:e(g,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to unarchive release ",e("code",{children:i.id}),"?"]}),labels:{confirm:"Unarchive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{h({id:a,title:"Unarchiving release",message:`Unarchiving ${i.id}...`,loading:!0,autoClose:!1}),await w(i.id);let r=await s(i.id);t(r),f({id:a,title:"Unarchived release",message:`Successfully unarchived ${i.id}`,loading:!1,autoClose:5e3}),l.closeModal(n),u(`/cms/releases/${i.id}`)}})}return e(U,{children:e("div",{className:"EditReleasePage",children:[e("div",{className:"EditReleasePage__header",children:[e(b,{className:"EditReleasePage__header__breadcrumbs",children:[e("a",{href:"/cms/releases",children:"Releases"}),e("a",{href:`/cms/releases/${i.id}`,children:i.id}),e("div",{children:"Edit"})]}),e("div",{className:"EditReleasePage__header__titleWrap",children:[e(A,{size:"h1",children:["Edit Release: ",i.id]}),e("div",{className:"EditReleasePage__header__controls",children:e(I,{label:"You don't have access to archive releases",condition:!o,children:N?.archivedAt?e(m,{label:"Unarchive",disabled:!o,children:e(c,{onClick:S,loading:!d,disabled:!o,children:e(p,{size:20,stroke:"1.5"})})}):e(m,{label:"Archive",disabled:!o,children:e(c,{onClick:L,loading:!d,disabled:!o,children:e(y,{size:20,stroke:"1.5"})})})})})]})]}),e(k,{releaseId:i.id})]})})}export{se as EditReleasePage};
1
+ import{a as k}from"./chunk-JKCZGT6B.js";import"./chunk-JHBAMPGB.js";import"./chunk-QGBR3J2Y.js";import{a as A}from"./chunk-VMT7JFAM.js";import"./chunk-P4U2LUTF.js";import"./chunk-3IYZCUPI.js";import{c as s,e as E,f as w}from"./chunk-RSVO46S3.js";import"./chunk-54DVDYU6.js";import"./chunk-X2WHBGTP.js";import{a as z,c as I}from"./chunk-ONTGW2VA.js";import"./chunk-4KE2SZKH.js";import{a as T}from"./chunk-L4RHGQUG.js";import{a as x,c as P}from"./chunk-HRGYNHZ3.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import"./chunk-62UWGWON.js";import{a as h,b as f}from"./chunk-I6ICVKEC.js";import{a as g}from"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as $,b as U}from"./chunk-7MTDTPYB.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import{d as C}from"./chunk-AL3TN2KI.js";import{Ga as m,Ha as e,Ma as y,W as c,a as v,c as R,da as b,j as B,uc as p}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";B();function se(i){$(`Edit Release: ${i.id}`);let{route:u}=C(),[N,t]=v(null),l=x(),_=P(),{roles:d}=T(),M=window.firebase.user.email||"",o=z(d,M);R(()=>{s(i.id).then(a=>{t(a)})},[i.id]);function L(){let a=`archive-release-${i.id}`,n=l.openConfirmModal({..._,title:"Archive release",children:e(g,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to archive release ",e("code",{children:i.id}),"?"]}),labels:{confirm:"Archive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{h({id:a,title:"Archiving release",message:`Archiving ${i.id}...`,loading:!0,autoClose:!1}),await E(i.id);let r=await s(i.id);t(r),f({id:a,title:"Archived release",message:`Successfully archived ${i.id}`,loading:!1,autoClose:5e3}),l.closeModal(n),u("/cms/releases")}})}function S(){let a=`unarchive-release-${i.id}`,n=l.openConfirmModal({..._,title:"Unarchive release",children:e(g,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to unarchive release ",e("code",{children:i.id}),"?"]}),labels:{confirm:"Unarchive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{h({id:a,title:"Unarchiving release",message:`Unarchiving ${i.id}...`,loading:!0,autoClose:!1}),await w(i.id);let r=await s(i.id);t(r),f({id:a,title:"Unarchived release",message:`Successfully unarchived ${i.id}`,loading:!1,autoClose:5e3}),l.closeModal(n),u(`/cms/releases/${i.id}`)}})}return e(U,{children:e("div",{className:"EditReleasePage",children:[e("div",{className:"EditReleasePage__header",children:[e(b,{className:"EditReleasePage__header__breadcrumbs",children:[e("a",{href:"/cms/releases",children:"Releases"}),e("a",{href:`/cms/releases/${i.id}`,children:i.id}),e("div",{children:"Edit"})]}),e("div",{className:"EditReleasePage__header__titleWrap",children:[e(A,{size:"h1",children:["Edit Release: ",i.id]}),e("div",{className:"EditReleasePage__header__controls",children:e(I,{label:"You don't have access to archive releases",condition:!o,children:N?.archivedAt?e(m,{label:"Unarchive",disabled:!o,children:e(c,{onClick:S,loading:!d,disabled:!o,children:e(p,{size:20,stroke:"1.5"})})}):e(m,{label:"Archive",disabled:!o,children:e(c,{onClick:L,loading:!d,disabled:!o,children:e(y,{size:20,stroke:"1.5"})})})})})]})]}),e(k,{releaseId:i.id})]})})}export{se as EditReleasePage};
@@ -1 +1 @@
1
- import{a as e}from"./chunk-E2RCCK2T.js";import"./chunk-KFAZBEPV.js";import"./chunk-KYDOSLTO.js";import{a}from"./chunk-VMT7JFAM.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-PJA7YP4A.js";import"./chunk-ORXEMIQC.js";import{a as g,b as i}from"./chunk-FBJURT7Z.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Ha as o}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function L(){return g("Action Logs"),o(i,{children:o("div",{className:"LogsPage",children:[o("div",{className:"LogsPage__header",children:o(a,{size:"h1",children:"Action Logs"})}),o(e,{})]})})}export{L as LogsPage};
1
+ import{a as e}from"./chunk-E2RCCK2T.js";import"./chunk-KFAZBEPV.js";import"./chunk-KYDOSLTO.js";import{a}from"./chunk-VMT7JFAM.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-PJA7YP4A.js";import"./chunk-ORXEMIQC.js";import{a as g,b as i}from"./chunk-7MTDTPYB.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Ha as o}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function L(){return g("Action Logs"),o(i,{children:o("div",{className:"LogsPage",children:[o("div",{className:"LogsPage__header",children:o(a,{size:"h1",children:"Action Logs"})}),o(e,{})]})})}export{L as LogsPage};
@@ -1 +1 @@
1
- import{a as d}from"./chunk-C5NH23G4.js";import"./chunk-CGCKJFL4.js";import{a as r}from"./chunk-VMT7JFAM.js";import"./chunk-4KE2SZKH.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import"./chunk-62UWGWON.js";import"./chunk-I6ICVKEC.js";import"./chunk-ORXEMIQC.js";import{a as t,b as o}from"./chunk-FBJURT7Z.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Ha as a,da as e}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function n(){return t("New Data Source"),a(o,{children:a("div",{className:"NewDataSourcePage",children:[a("div",{className:"NewDataSourcePage__header",children:[a(e,{className:"NewDataSourcePage__header__breadcrumbs",children:[a("a",{href:"/cms/data",children:"Data Sources"}),a("div",{children:"New"})]}),a(r,{size:"h1",children:"Add Data Source"})]}),a(d,{buttonLabel:"Create data source"})]})})}export{n as NewDataSourcePage};
1
+ import{a as d}from"./chunk-C5NH23G4.js";import"./chunk-CGCKJFL4.js";import{a as r}from"./chunk-VMT7JFAM.js";import"./chunk-4KE2SZKH.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import"./chunk-62UWGWON.js";import"./chunk-I6ICVKEC.js";import"./chunk-ORXEMIQC.js";import{a as t,b as o}from"./chunk-7MTDTPYB.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Ha as a,da as e}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function n(){return t("New Data Source"),a(o,{children:a("div",{className:"NewDataSourcePage",children:[a("div",{className:"NewDataSourcePage__header",children:[a(e,{className:"NewDataSourcePage__header__breadcrumbs",children:[a("a",{href:"/cms/data",children:"Data Sources"}),a("div",{children:"New"})]}),a(r,{size:"h1",children:"Add Data Source"})]}),a(d,{buttonLabel:"Create data source"})]})})}export{n as NewDataSourcePage};
@@ -1 +1 @@
1
- import{a as m}from"./chunk-MDUBCXU2.js";import"./chunk-JHBAMPGB.js";import"./chunk-V7S4IAGB.js";import{a as r}from"./chunk-VMT7JFAM.js";import"./chunk-NXQVLOTK.js";import"./chunk-3IYZCUPI.js";import"./chunk-RSVO46S3.js";import"./chunk-54DVDYU6.js";import"./chunk-X2WHBGTP.js";import"./chunk-ONTGW2VA.js";import"./chunk-4KE2SZKH.js";import"./chunk-L4RHGQUG.js";import"./chunk-HRGYNHZ3.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import"./chunk-62UWGWON.js";import"./chunk-I6ICVKEC.js";import"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as s,b as d}from"./chunk-FBJURT7Z.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Ha as e,da as a}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function w(){return s("New Release"),e(d,{children:e("div",{className:"NewReleasePage",children:[e("div",{className:"NewReleasePage__header",children:[e(a,{className:"NewReleasePage__header__breadcrumbs",children:[e("a",{href:"/cms/releases",children:"Releases"}),e("div",{children:"New"})]}),e(r,{size:"h1",children:"Add Release"})]}),e(m,{buttonLabel:"Create release"})]})})}export{w as NewReleasePage};
1
+ import{a as m}from"./chunk-JKCZGT6B.js";import"./chunk-JHBAMPGB.js";import"./chunk-QGBR3J2Y.js";import{a as r}from"./chunk-VMT7JFAM.js";import"./chunk-P4U2LUTF.js";import"./chunk-3IYZCUPI.js";import"./chunk-RSVO46S3.js";import"./chunk-54DVDYU6.js";import"./chunk-X2WHBGTP.js";import"./chunk-ONTGW2VA.js";import"./chunk-4KE2SZKH.js";import"./chunk-L4RHGQUG.js";import"./chunk-HRGYNHZ3.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import"./chunk-62UWGWON.js";import"./chunk-I6ICVKEC.js";import"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as s,b as d}from"./chunk-7MTDTPYB.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Ha as e,da as a}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function w(){return s("New Release"),e(d,{children:e("div",{className:"NewReleasePage",children:[e("div",{className:"NewReleasePage__header",children:[e(a,{className:"NewReleasePage__header__breadcrumbs",children:[e("a",{href:"/cms/releases",children:"Releases"}),e("div",{children:"New"})]}),e(r,{size:"h1",children:"Add Release"})]}),e(m,{buttonLabel:"Create release"})]})})}export{w as NewReleasePage};
@@ -1 +1 @@
1
- import{a as e,b as n}from"./chunk-FBJURT7Z.js";import"./chunk-AL3TN2KI.js";import{Ha as o,hc as t}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-PVAE643M.js";function l(){return e("Not Found"),o(n,{children:o("div",{className:"NotFoundPage",children:[o("div",{className:"NotFoundPage__icon",children:o(t,{size:60})}),o("h2",{className:"NotFoundPage__title",children:"Not Found"}),o("p",{className:"NotFoundPage__body",children:["Double-check the URL and try again or ",o("a",{href:"/cms",children:"go home"}),"."]})]})})}export{l as NotFoundPage};
1
+ import{a as e,b as n}from"./chunk-7MTDTPYB.js";import"./chunk-AL3TN2KI.js";import{Ha as o,hc as t}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-PVAE643M.js";function l(){return e("Not Found"),o(n,{children:o("div",{className:"NotFoundPage",children:[o("div",{className:"NotFoundPage__icon",children:o(t,{size:60})}),o("h2",{className:"NotFoundPage__title",children:"Not Found"}),o("p",{className:"NotFoundPage__body",children:["Double-check the URL and try again or ",o("a",{href:"/cms",children:"go home"}),"."]})]})})}export{l as NotFoundPage};
@@ -1 +1 @@
1
- import{a as l}from"./chunk-SQRKKWRG.js";import"./chunk-DUJYIOLE.js";import{a as s}from"./chunk-E2RCCK2T.js";import"./chunk-KFAZBEPV.js";import"./chunk-KYDOSLTO.js";import{a as r}from"./chunk-W3BJ2EZX.js";import"./chunk-X2WHBGTP.js";import"./chunk-W3HIZQ4Z.js";import{a as n}from"./chunk-PJA7YP4A.js";import"./chunk-62UWGWON.js";import"./chunk-I6ICVKEC.js";import"./chunk-ORXEMIQC.js";import{a,b as c}from"./chunk-FBJURT7Z.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Ha as e,ea as i}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function o(){a("Home");let t=!!window.__ROOT_CTX.experiments?.taskManager;return e(c,{children:e("div",{className:"ProjectPage",children:e("div",{className:"ProjectPage__main",children:[t&&e(l,{}),e("div",{className:"ProjectPage__section",children:[e(o.Collections,{}),e(o.ActionLogs,{})]})]})})})}o.SectionTitle=t=>e("div",{className:"ProjectPage__sectionTitle",children:t.children});o.Collections=()=>{let t=window.__ROOT_CTX.collections,m=window.__ROOT_CTX.rootConfig.projectId;return e("div",{className:"ProjectPage__collections",children:e(r,{collections:t,projectId:m})})};o.ActionLogs=()=>e("div",{className:"ProjectPage__actionLogs",children:[e("div",{className:"ProjectPage__actionLogs__header",children:[e(o.SectionTitle,{children:"Recent actions"}),e(i,{component:"a",variant:"default",size:"xs",compact:!0,href:"/cms/logs",children:"Show all"})]}),e(n,{children:e(s,{limit:10,compact:!0})})]});export{o as ProjectPage};
1
+ import{a as l}from"./chunk-SQRKKWRG.js";import"./chunk-DUJYIOLE.js";import{a as s}from"./chunk-E2RCCK2T.js";import"./chunk-KFAZBEPV.js";import"./chunk-KYDOSLTO.js";import{a as r}from"./chunk-W3BJ2EZX.js";import"./chunk-X2WHBGTP.js";import"./chunk-W3HIZQ4Z.js";import{a as n}from"./chunk-PJA7YP4A.js";import"./chunk-62UWGWON.js";import"./chunk-I6ICVKEC.js";import"./chunk-ORXEMIQC.js";import{a,b as c}from"./chunk-7MTDTPYB.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Ha as e,ea as i}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function o(){a("Home");let t=!!window.__ROOT_CTX.experiments?.taskManager;return e(c,{children:e("div",{className:"ProjectPage",children:e("div",{className:"ProjectPage__main",children:[t&&e(l,{}),e("div",{className:"ProjectPage__section",children:[e(o.Collections,{}),e(o.ActionLogs,{})]})]})})})}o.SectionTitle=t=>e("div",{className:"ProjectPage__sectionTitle",children:t.children});o.Collections=()=>{let t=window.__ROOT_CTX.collections,m=window.__ROOT_CTX.rootConfig.projectId;return e("div",{className:"ProjectPage__collections",children:e(r,{collections:t,projectId:m})})};o.ActionLogs=()=>e("div",{className:"ProjectPage__actionLogs",children:[e("div",{className:"ProjectPage__actionLogs__header",children:[e(o.SectionTitle,{children:"Recent actions"}),e(i,{component:"a",variant:"default",size:"xs",compact:!0,href:"/cms/logs",children:"Show all"})]}),e(n,{children:e(s,{limit:10,compact:!0})})]});export{o as ProjectPage};
@@ -1 +1 @@
1
- import{a as F}from"./chunk-PWKJDYE2.js";import{a as O}from"./chunk-DEGMKEHP.js";import{a as m}from"./chunk-VMT7JFAM.js";import{f as M}from"./chunk-3IYZCUPI.js";import{c as B,g as E,j as H}from"./chunk-RSVO46S3.js";import{a as W,c as f}from"./chunk-ONTGW2VA.js";import"./chunk-4KE2SZKH.js";import{a as U}from"./chunk-L4RHGQUG.js";import{a as I,c as k}from"./chunk-HRGYNHZ3.js";import"./chunk-W3HIZQ4Z.js";import{a as y}from"./chunk-PJA7YP4A.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import{b as v}from"./chunk-62UWGWON.js";import{a as x,b as z}from"./chunk-I6ICVKEC.js";import{a as S}from"./chunk-HLMBCVRX.js";import{c as $}from"./chunk-ORXEMIQC.js";import{a as j,b as q}from"./chunk-FBJURT7Z.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Dc as Y,Ea as N,Ga as u,Ha as e,V as w,W as A,a as c,c as D,da as T,ea as r,j as Q}from"./chunk-NZHF733K.js";import{d as C}from"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";Q();function d(t){let[o,i]=c(!0),[a,s]=c(null),[_,h]=c(0),l=t.id;j(`Release: ${l}`);async function p(){i(!0),await v(async()=>{let n=await B(l);s(n),h($())}),i(!1)}D(()=>{p()},[]);function P(n){console.log("onAction()",n),p()}return e(q,{children:e("div",{className:"ReleasePage",children:[e("div",{className:"ReleasePage__header",children:[e(T,{className:"ReleasePage__header__breadcrumbs",children:[e("a",{href:"/cms/releases",children:"Releases"}),e("div",{children:l})]}),e("div",{className:"ReleasePage__header__titleWrap",children:[e(m,{size:"h1",children:["Release: ",l]}),e("div",{className:"ReleasePage__header__controls",children:e(u,{label:"Configure",children:e(A,{component:"a",href:`/cms/releases/${t.id}/edit`,children:e(Y,{size:24,stroke:"1.5"})})})})]}),a?.description&&e(S,{as:"p",children:a.description})]}),o?e(w,{color:"gray",size:"xl"}):e(C,{children:[a&&e(d.PublishStatus,{release:a,onAction:P}),a&&a.docIds&&a.docIds.length>0&&e(d.DocsList,{release:a},`docs-list-${_}`),a&&a.dataSourceIds&&a.dataSourceIds.length>0&&e(d.DataSourcesList,{release:a},`data-sources-${_}`)]})]})})}d.PublishStatus=t=>{let{roles:o}=U(),i=window.firebase.user.email||"",a=W(o,i),s=t.release,[_,h]=c(!1),l=I(),p=k(),P=O({releaseId:s.id,onScheduled:()=>{t.onAction("scheduled")}});function n(){let g=s.docIds||[],R=s.dataSourceIds||[],b=g.length+R.length;if(b===0){x({title:"Cannot publish release",message:"Error: nothing in the release to publish.",color:"red",autoClose:!1});return}l.openConfirmModal({...p,title:`Publish release: ${s.id}`,children:e(S,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to publish this release? The ",b," items in the release will go live immediately."]}),labels:{confirm:"Publish",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!0,onConfirm:()=>{G()}})}async function G(){h(!0),await v(async()=>{let g=`publish-release-${s.id}`,R=s.docIds?.length||0,b=s.dataSourceIds?.length||0,L=R+b;x({id:g,title:"Publishing release",message:`Publishing ${L} items...`,loading:!0,autoClose:!1}),await E(s.id),z({id:g,title:"Published release!",message:`Successfully published ${L} items!`,loading:!1,autoClose:5e3}),t.onAction&&t.onAction("publish")}),h(!1)}function J(){P.open()}async function K(){await H(s.id),t.onAction("cancel-schedule")}return e("div",{className:"ReleasePage__PublishStatus",children:[e(m,{size:"h2",children:"Status"}),e(y,{children:e(N,{className:"ReleasePage__PublishStatus__table",verticalSpacing:"xs",striped:!0,fontSize:"xs",children:[e("thead",{children:e("tr",{children:[e("th",{children:"status"}),e("th",{children:"actions"})]})}),e("tbody",{children:e("tr",{children:[e("td",{children:e(F,{release:s})}),e("td",{children:e("div",{className:"ReleasePage__PublishStatus__actions",children:[!s.archivedAt&&!s.scheduledAt&&e(f,{label:"You don't have access to publish this release",condition:!a,children:e(u,{label:"Publish the release immediately",position:"bottom",withArrow:!0,disabled:!a,children:e(r,{variant:"default",size:"xs",compact:!0,onClick:()=>n(),loading:_,disabled:!a,children:s.publishedAt?"Re-publish":"Publish"})})}),!s.archivedAt&&(s.scheduledAt?e(f,{label:"You don't have access to manage scheduled releases",condition:!a,children:e(u,{label:"Cancel the scheduled release",position:"bottom",withArrow:!0,disabled:!a,children:e(r,{variant:"default",size:"xs",compact:!0,onClick:()=>K(),disabled:!a,children:"Cancel Schedule"})})}):e(f,{label:"You don't have access to manage scheduled releases",condition:!a,children:e(u,{label:"Schedule the release to be published at a future date",position:"bottom",withArrow:!0,wrapLines:!0,width:180,disabled:!a,children:e(r,{variant:"default",size:"xs",compact:!0,onClick:()=>J(),disabled:!a,children:"Schedule"})})}))]})})]})})]})})]})};d.DocsList=t=>{let o=t.release,i=o.docIds||[];return e("div",{className:"ReleasePage__DocsList",children:[e("div",{className:"ReleasePage__DocsList__header",children:[e(m,{size:"h2",children:"Docs"}),e(r,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${o.id}/edit`,children:"Edit"})]}),e(y,{className:"ReleasePage__DocsList__cards",children:i.map(a=>e("div",{className:"ReleasePage__DocsList__card",children:e("a",{href:`/cms/content/${a}`,children:e(M,{docId:a,statusBadges:!0,hideReleases:!0})})},a))})]})};d.DataSourcesList=t=>{let o=t.release,i=o.dataSourceIds||[];return e("div",{className:"ReleasePage__DataSourcesList",children:[e("div",{className:"ReleasePage__DataSourcesList__header",children:[e(m,{size:"h2",children:"Data Sources"}),e(r,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${o.id}/edit`,children:"Edit"})]}),e("div",{className:"ReleasePage__DataSourcesList__items",children:i.map(a=>e("div",{className:"ReleasePage__DataSourcesList__item",children:e("a",{href:`/cms/data/${a}`,children:a})},a))})]})};export{d as ReleasePage};
1
+ import{a as F}from"./chunk-PWKJDYE2.js";import{a as O}from"./chunk-DEGMKEHP.js";import{a as m}from"./chunk-VMT7JFAM.js";import{f as M}from"./chunk-3IYZCUPI.js";import{c as B,g as E,j as H}from"./chunk-RSVO46S3.js";import{a as W,c as f}from"./chunk-ONTGW2VA.js";import"./chunk-4KE2SZKH.js";import{a as U}from"./chunk-L4RHGQUG.js";import{a as I,c as k}from"./chunk-HRGYNHZ3.js";import"./chunk-W3HIZQ4Z.js";import{a as y}from"./chunk-PJA7YP4A.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import{b as v}from"./chunk-62UWGWON.js";import{a as x,b as z}from"./chunk-I6ICVKEC.js";import{a as S}from"./chunk-HLMBCVRX.js";import{c as $}from"./chunk-ORXEMIQC.js";import{a as j,b as q}from"./chunk-7MTDTPYB.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Dc as Y,Ea as N,Ga as u,Ha as e,V as w,W as A,a as c,c as D,da as T,ea as r,j as Q}from"./chunk-NZHF733K.js";import{d as C}from"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";Q();function d(t){let[o,i]=c(!0),[a,s]=c(null),[_,h]=c(0),l=t.id;j(`Release: ${l}`);async function p(){i(!0),await v(async()=>{let n=await B(l);s(n),h($())}),i(!1)}D(()=>{p()},[]);function P(n){console.log("onAction()",n),p()}return e(q,{children:e("div",{className:"ReleasePage",children:[e("div",{className:"ReleasePage__header",children:[e(T,{className:"ReleasePage__header__breadcrumbs",children:[e("a",{href:"/cms/releases",children:"Releases"}),e("div",{children:l})]}),e("div",{className:"ReleasePage__header__titleWrap",children:[e(m,{size:"h1",children:["Release: ",l]}),e("div",{className:"ReleasePage__header__controls",children:e(u,{label:"Configure",children:e(A,{component:"a",href:`/cms/releases/${t.id}/edit`,children:e(Y,{size:24,stroke:"1.5"})})})})]}),a?.description&&e(S,{as:"p",children:a.description})]}),o?e(w,{color:"gray",size:"xl"}):e(C,{children:[a&&e(d.PublishStatus,{release:a,onAction:P}),a&&a.docIds&&a.docIds.length>0&&e(d.DocsList,{release:a},`docs-list-${_}`),a&&a.dataSourceIds&&a.dataSourceIds.length>0&&e(d.DataSourcesList,{release:a},`data-sources-${_}`)]})]})})}d.PublishStatus=t=>{let{roles:o}=U(),i=window.firebase.user.email||"",a=W(o,i),s=t.release,[_,h]=c(!1),l=I(),p=k(),P=O({releaseId:s.id,onScheduled:()=>{t.onAction("scheduled")}});function n(){let g=s.docIds||[],R=s.dataSourceIds||[],b=g.length+R.length;if(b===0){x({title:"Cannot publish release",message:"Error: nothing in the release to publish.",color:"red",autoClose:!1});return}l.openConfirmModal({...p,title:`Publish release: ${s.id}`,children:e(S,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to publish this release? The ",b," items in the release will go live immediately."]}),labels:{confirm:"Publish",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!0,onConfirm:()=>{G()}})}async function G(){h(!0),await v(async()=>{let g=`publish-release-${s.id}`,R=s.docIds?.length||0,b=s.dataSourceIds?.length||0,L=R+b;x({id:g,title:"Publishing release",message:`Publishing ${L} items...`,loading:!0,autoClose:!1}),await E(s.id),z({id:g,title:"Published release!",message:`Successfully published ${L} items!`,loading:!1,autoClose:5e3}),t.onAction&&t.onAction("publish")}),h(!1)}function J(){P.open()}async function K(){await H(s.id),t.onAction("cancel-schedule")}return e("div",{className:"ReleasePage__PublishStatus",children:[e(m,{size:"h2",children:"Status"}),e(y,{children:e(N,{className:"ReleasePage__PublishStatus__table",verticalSpacing:"xs",striped:!0,fontSize:"xs",children:[e("thead",{children:e("tr",{children:[e("th",{children:"status"}),e("th",{children:"actions"})]})}),e("tbody",{children:e("tr",{children:[e("td",{children:e(F,{release:s})}),e("td",{children:e("div",{className:"ReleasePage__PublishStatus__actions",children:[!s.archivedAt&&!s.scheduledAt&&e(f,{label:"You don't have access to publish this release",condition:!a,children:e(u,{label:"Publish the release immediately",position:"bottom",withArrow:!0,disabled:!a,children:e(r,{variant:"default",size:"xs",compact:!0,onClick:()=>n(),loading:_,disabled:!a,children:s.publishedAt?"Re-publish":"Publish"})})}),!s.archivedAt&&(s.scheduledAt?e(f,{label:"You don't have access to manage scheduled releases",condition:!a,children:e(u,{label:"Cancel the scheduled release",position:"bottom",withArrow:!0,disabled:!a,children:e(r,{variant:"default",size:"xs",compact:!0,onClick:()=>K(),disabled:!a,children:"Cancel Schedule"})})}):e(f,{label:"You don't have access to manage scheduled releases",condition:!a,children:e(u,{label:"Schedule the release to be published at a future date",position:"bottom",withArrow:!0,wrapLines:!0,width:180,disabled:!a,children:e(r,{variant:"default",size:"xs",compact:!0,onClick:()=>J(),disabled:!a,children:"Schedule"})})}))]})})]})})]})})]})};d.DocsList=t=>{let o=t.release,i=o.docIds||[];return e("div",{className:"ReleasePage__DocsList",children:[e("div",{className:"ReleasePage__DocsList__header",children:[e(m,{size:"h2",children:"Docs"}),e(r,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${o.id}/edit`,children:"Edit"})]}),e(y,{className:"ReleasePage__DocsList__cards",children:i.map(a=>e("div",{className:"ReleasePage__DocsList__card",children:e("a",{href:`/cms/content/${a}`,children:e(M,{docId:a,statusBadges:!0,hideReleases:!0})})},a))})]})};d.DataSourcesList=t=>{let o=t.release,i=o.dataSourceIds||[];return e("div",{className:"ReleasePage__DataSourcesList",children:[e("div",{className:"ReleasePage__DataSourcesList__header",children:[e(m,{size:"h2",children:"Data Sources"}),e(r,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${o.id}/edit`,children:"Edit"})]}),e("div",{className:"ReleasePage__DataSourcesList__items",children:i.map(a=>e("div",{className:"ReleasePage__DataSourcesList__item",children:e("a",{href:`/cms/data/${a}`,children:a})},a))})]})};export{d as ReleasePage};
@@ -1 +1 @@
1
- import{a as w}from"./chunk-PWKJDYE2.js";import{a as R}from"./chunk-VMT7JFAM.js";import{b as f}from"./chunk-RSVO46S3.js";import{a as P,c as T}from"./chunk-ONTGW2VA.js";import"./chunk-4KE2SZKH.js";import{a as v}from"./chunk-L4RHGQUG.js";import"./chunk-W3HIZQ4Z.js";import{a as S}from"./chunk-PJA7YP4A.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import{a as d}from"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as x,b as y}from"./chunk-FBJURT7Z.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Ea as _,Ha as e,V as h,a as o,c as m,ea as b,g as p,j as A,za as g}from"./chunk-NZHF733K.js";import{d as c}from"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";A();function N(){x("Releases");let{roles:i}=v(),r=window.firebase.user.email||"",t=P(i,r);return e(y,{children:e("div",{className:"ReleasesPage",children:[e("div",{className:"ReleasesPage__header",children:[e(R,{size:"h1",children:"Releases"}),e(d,{as:"p",children:"Bundle one or more documents and publish them together. Schedule a release to go live at a specific time, or publish manually when you're ready."}),e("div",{className:"ReleasesPage__header__buttons",children:e(T,{label:"You don't have access to create new releases",condition:!t,children:e(b,{component:"a",color:"blue",size:"xs",href:"/cms/releases/new",disabled:!t,style:t?void 0:{pointerEvents:"none"},children:"New release"})})})]}),e(N.ReleasesTable,{})]})})}N.ReleasesTable=()=>{let[i,r]=o(!0),[t,L]=o([]),[l,B]=o("active");async function z(){let a=await f();L(a),r(!1)}let n=p(()=>t.filter(a=>{let s=!!a.archivedAt,u=!!a.publishedAt;return l==="active"?!s:l==="unpublished"?!s&&!u:l==="published"?!s&&u:s}),[t,l]);return m(()=>{z()},[]),e("div",{className:"ReleasesPage__ReleasesTable",children:[i&&e(h,{color:"gray",size:"xl"}),!i&&e(c,{children:[e("div",{className:"ReleasesPage__ReleasesTable__filters",children:e(g,{size:"sm",value:l,onChange:a=>B(a),data:[{label:"Active",value:"active"},{label:"Unpublished",value:"unpublished"},{label:"Published",value:"published"},{label:"Archived",value:"archived"}]})}),n.length>0&&e(S,{children:e(_,{className:"ReleasesPage__ReleasesTable__table",verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[e("thead",{children:e("tr",{children:[e("th",{children:"id"}),e("th",{children:"description"}),e("th",{children:"content"}),e("th",{children:"status"})]})}),e("tbody",{children:n.map(a=>e("tr",{children:[e("td",{children:e("a",{href:`/cms/releases/${a.id}`,children:a.id})}),e("td",{children:a.description||""}),e("td",{children:(a.docIds||[]).map(s=>e("div",{children:e("a",{href:`/cms/content/${s}`,children:s})},s))}),e("td",{children:e("div",{className:"ReleasesPage__ReleasesTable__publishStatus",children:e(w,{release:a})})})]},a.id))})]})}),n.length===0&&e(d,{as:"p",children:"No releases found for this filter."})]})]})};export{N as ReleasesPage};
1
+ import{a as w}from"./chunk-PWKJDYE2.js";import{a as R}from"./chunk-VMT7JFAM.js";import{b as f}from"./chunk-RSVO46S3.js";import{a as P,c as T}from"./chunk-ONTGW2VA.js";import"./chunk-4KE2SZKH.js";import{a as v}from"./chunk-L4RHGQUG.js";import"./chunk-W3HIZQ4Z.js";import{a as S}from"./chunk-PJA7YP4A.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import{a as d}from"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as x,b as y}from"./chunk-7MTDTPYB.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Ea as _,Ha as e,V as h,a as o,c as m,ea as b,g as p,j as A,za as g}from"./chunk-NZHF733K.js";import{d as c}from"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";A();function N(){x("Releases");let{roles:i}=v(),r=window.firebase.user.email||"",t=P(i,r);return e(y,{children:e("div",{className:"ReleasesPage",children:[e("div",{className:"ReleasesPage__header",children:[e(R,{size:"h1",children:"Releases"}),e(d,{as:"p",children:"Bundle one or more documents and publish them together. Schedule a release to go live at a specific time, or publish manually when you're ready."}),e("div",{className:"ReleasesPage__header__buttons",children:e(T,{label:"You don't have access to create new releases",condition:!t,children:e(b,{component:"a",color:"blue",size:"xs",href:"/cms/releases/new",disabled:!t,style:t?void 0:{pointerEvents:"none"},children:"New release"})})})]}),e(N.ReleasesTable,{})]})})}N.ReleasesTable=()=>{let[i,r]=o(!0),[t,L]=o([]),[l,B]=o("active");async function z(){let a=await f();L(a),r(!1)}let n=p(()=>t.filter(a=>{let s=!!a.archivedAt,u=!!a.publishedAt;return l==="active"?!s:l==="unpublished"?!s&&!u:l==="published"?!s&&u:s}),[t,l]);return m(()=>{z()},[]),e("div",{className:"ReleasesPage__ReleasesTable",children:[i&&e(h,{color:"gray",size:"xl"}),!i&&e(c,{children:[e("div",{className:"ReleasesPage__ReleasesTable__filters",children:e(g,{size:"sm",value:l,onChange:a=>B(a),data:[{label:"Active",value:"active"},{label:"Unpublished",value:"unpublished"},{label:"Published",value:"published"},{label:"Archived",value:"archived"}]})}),n.length>0&&e(S,{children:e(_,{className:"ReleasesPage__ReleasesTable__table",verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[e("thead",{children:e("tr",{children:[e("th",{children:"id"}),e("th",{children:"description"}),e("th",{children:"content"}),e("th",{children:"status"})]})}),e("tbody",{children:n.map(a=>e("tr",{children:[e("td",{children:e("a",{href:`/cms/releases/${a.id}`,children:a.id})}),e("td",{children:a.description||""}),e("td",{children:(a.docIds||[]).map(s=>e("div",{children:e("a",{href:`/cms/content/${s}`,children:s})},s))}),e("td",{children:e("div",{className:"ReleasesPage__ReleasesTable__publishStatus",children:e(w,{release:a})})})]},a.id))})]})}),n.length===0&&e(d,{as:"p",children:"No releases found for this filter."})]})]})};export{N as ReleasesPage};
@@ -0,0 +1 @@
1
+ import{b as ae}from"./chunk-BZIRGB4W.js";import{a as te,c as ne,e as me}from"./chunk-HHMG665Z.js";import{b as ce,c as O,d as de,f as z}from"./chunk-KYDOSLTO.js";import{a as w}from"./chunk-VMT7JFAM.js";import"./chunk-54DVDYU6.js";import{a as le}from"./chunk-L4RHGQUG.js";import"./chunk-W3HIZQ4Z.js";import{a as I}from"./chunk-PJA7YP4A.js";import{b as ee}from"./chunk-62UWGWON.js";import{a as U}from"./chunk-I6ICVKEC.js";import{a as g}from"./chunk-HLMBCVRX.js";import{f as oe}from"./chunk-ORXEMIQC.js";import{a as ge,b as ue}from"./chunk-7MTDTPYB.js";import{c as se}from"./chunk-5MV6XVGA.js";import{c as V,n as Y,p as Q,q as Z}from"./chunk-EGEB6N4J.js";import{f as N}from"./chunk-AL3TN2KI.js";import{Aa as A,Da as q,Ha as e,Pc as ie,U as L,Uc as re,W as $,a as _,c as B,ca as J,e as W,ea as v,g as C,j as T,oa as F,qa as K,ta as X,va as G}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";T();T();var Re={ADMIN:4,EDITOR:3,CONTRIBUTOR:2,VIEWER:1};function _e(o){return Re[o]??0}function ye(o,s){return _e(o)>=_e(s)?o:s}function H(o,s,a){let r=o[s];o[s]=r?ye(r,a):a}function pe(o,s={}){let a={...s},r={};for(let t of o){let m=(t.users||[]).filter(Boolean);if(m.length===0)continue;let u=(t.collections||[]).filter(Boolean);if(u.length===0)for(let d of m)H(a,d,t.role);else{for(let d of m)H(a,d,"VIEWER");for(let d of u){r[d]||(r[d]={});for(let p of m)H(r[d],p,t.role)}}}return{projectRoles:a,collectionRoles:r}}function fe(o={}){return{id:o.id||`g_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`,name:o.name||"",role:o.role||"VIEWER",collections:o.collections?[...o.collections]:[],users:o.users?[...o.users]:[]}}T();function k(o){let s=o.size||28,[a,r]=_(!1),t=o.profile?.photoURL||"",m=o.profile?.displayName||o.email,u=N("EmailAvatar",o.className),d={width:s,height:s};return t&&!a?e("img",{className:u,style:d,src:t,alt:m,onError:()=>r(!0)}):e("svg",{className:u,style:d,viewBox:"0 0 28 28",role:"img","aria-label":m,children:[e("circle",{cx:"14",cy:"14",r:"14",fill:de(o.email)}),e("text",{x:"14",y:"14",textAnchor:"middle",dominantBaseline:"central",fill:"#fff",fontSize:"13",fontWeight:"600",children:ce(o.email)})]})}var we=[{value:"ADMIN",label:"ADMIN"},{value:"EDITOR",label:"EDITOR"},{value:"CONTRIBUTOR",label:"CONTRIBUTOR"},{value:"VIEWER",label:"VIEWER"}];function xe(o){let{groups:s,onChange:a,collections:r,disabled:t}=o,m=C(()=>r.map(l=>({value:l,label:l})),[r]),[u,d]=_({});function p(l,n){a(s.map(c=>c.id===l?n(c):c))}function b(l){a(s.filter(n=>n.id!==l))}function P(){let l=s.length;a([...s,fe({name:"New group"})]),d(n=>({...n,[l]:!0}))}return e("div",{className:N(o.className,"PermissionGroupsBox"),children:[s.length===0?e("div",{className:"PermissionGroupsBox__empty",children:e(g,{size:"body-sm",weight:"semi-bold",color:"gray",children:"No permission groups yet. Create one to organize users by role and optionally scope access to specific collections."})}):e(L,{className:"PermissionGroupsBox__accordion",offsetIcon:!1,multiple:!0,state:u,onChange:d,children:s.map(l=>e(L.Item,{label:e("div",{className:"PermissionGroupsBox__trigger",children:[e("span",{className:"PermissionGroupsBox__trigger__name",children:l.name||"Untitled group"}),e(J,{color:"gray",radius:"sm",size:"xs",variant:"light",className:"PermissionGroupsBox__trigger__badge",children:[l.users.length," ",l.users.length===1?"user":"users"]})]}),children:e(Ne,{group:l,collectionOptions:m,disabled:t,onChange:n=>p(l.id,()=>n),onDelete:()=>b(l.id)})},l.id))}),e("div",{className:"PermissionGroupsBox__addGroup",children:e(v,{variant:"default",size:"xs",radius:0,disabled:t,onClick:P,children:"+ Add group"})})]})}function Ne(o){let{group:s,collectionOptions:a,disabled:r}=o,[t,m]=_(""),u=s.users.filter(i=>!O(i)),{profiles:d}=z(u);function p(i){o.onChange({...s,name:i})}function b(i){o.onChange({...s,role:i})}function P(i){o.onChange({...s,collections:i})}function l(i){let f=i.trim();if(!f||s.users.includes(f)){m("");return}o.onChange({...s,users:[...s.users,f]}),m("")}function n(i){o.onChange({...s,users:s.users.filter(f=>f!==i)})}function c(){window.confirm(`Delete the "${s.name||"Untitled group"}" group? This will remove its role assignments on next save.`)&&o.onDelete()}return e("div",{className:"PermissionGroupsBox__editor",children:[e("div",{className:"PermissionGroupsBox__editor__row",children:[e(G,{className:"PermissionGroupsBox__editor__name",label:"Group name",placeholder:"e.g. Blog Post Editors",value:s.name,radius:0,size:"xs",disabled:r,onChange:i=>p(i.target.value)}),e(A,{className:"PermissionGroupsBox__editor__role",label:"Role",data:we,value:s.role,radius:0,size:"xs",disabled:r,onChange:i=>b(i)})]}),e(X,{className:"PermissionGroupsBox__editor__collections",label:"Collections",description:"Leave empty to apply project-wide. Otherwise restrict the group's role to the selected collections.",data:a,value:s.collections,radius:0,size:"xs",searchable:!0,clearable:!0,placeholder:"All collections (project-wide)",disabled:r,onChange:i=>P(i),dropdownComponent:"div"}),e("div",{className:"PermissionGroupsBox__editor__users",children:[e(g,{size:"body-sm",weight:"semi-bold",children:"Users"}),e("form",{className:"PermissionGroupsBox__editor__addUser",onSubmit:i=>{i.preventDefault(),l(t)},children:[e(G,{className:"PermissionGroupsBox__editor__addUser__email",placeholder:"grogu@example.com",type:"email",value:t,onChange:i=>m(i.target.value),radius:0,size:"xs",disabled:r}),e(v,{size:"xs",radius:0,color:"dark",type:"submit",disabled:r||!t.trim(),children:"Add user"})]}),s.users.length>0&&e("ul",{className:"PermissionGroupsBox__editor__userList",children:s.users.map(i=>{let f=d.get(i.toLowerCase())||null;return e("li",{className:"PermissionGroupsBox__editor__userItem",children:[e(k,{className:"PermissionGroupsBox__editor__userItem__avatar",email:i,profile:f,size:24}),e("span",{className:"PermissionGroupsBox__editor__userItem__email",children:i}),e($,{size:"sm",variant:"transparent",disabled:r,onClick:()=>n(i),title:`Remove ${i}`,children:e(re,{size:14})})]},i)})})]}),e("div",{className:"PermissionGroupsBox__editor__footer",children:e(v,{variant:"subtle",size:"xs",color:"red",compact:!0,disabled:r,leftIcon:e(ie,{size:14}),onClick:c,children:"Delete group"})})]})}T();function D(o){let{roles:s,onChange:a,currentUserIsAdmin:r}=o,[t,m]=_(""),u=Object.keys(s).filter(n=>!O(n)),{profiles:d}=z(u);function p(n,c){a({...s,[n]:c})}function b(n){let c={...s};delete c[n],a(c)}function P(n){let c=n.trim();m(""),!(!c||c in s)&&a({...s,[c]:"EDITOR"})}let l=se(Object.keys(s).map(n=>({email:n,role:s[n],profile:d.get(n.toLowerCase())||null})),"email");return e("div",{className:N(o.className,"ShareBox"),children:[e("form",{className:"ShareBox__addUser",onSubmit:n=>{n.preventDefault(),P(t)},children:[e(G,{className:"ShareBox__addUser__email",placeholder:"grogu@example.com",type:"email",value:t,onChange:n=>m(n.target.value),radius:0,size:"xs",disabled:!r}),e(v,{className:"ShareBox__addUser__button",size:"xs",radius:0,color:"dark",type:"submit",disabled:!r,children:"Add user"})]}),e("div",{className:"ShareBox__users",children:l.map(n=>e(D.User,{...n,currentUserIsAdmin:r,onRoleChange:p,onRemove:b},n.email))})]})}D.User=o=>{let s=o.email===window.firebase.user.email;return e("div",{className:"ShareBox__user",children:[e(k,{className:"ShareBox__user__avatar",email:o.email,profile:o.profile,size:24}),e(g,{className:"ShareBox__user__email",size:"body-sm",weight:"semi-bold",color:"gray",children:[o.email,s&&" (you)"]}),e("div",{className:"ShareBox__user__roleSelect",children:e(A,{data:[{value:"ADMIN",label:"ADMIN"},{value:"EDITOR",label:"EDITOR"},{value:"CONTRIBUTOR",label:"CONTRIBUTOR"},{value:"VIEWER",label:"VIEWER"},{value:"REMOVE",label:"REMOVE"}],value:o.role,radius:0,size:"xs",disabled:s||!o.currentUserIsAdmin,onChange:a=>{a==="REMOVE"?o.onRemove(o.email):o.onRoleChange(o.email,a)}})})]})};function Be(o){if(!o)return"never";let s=Date.now()-o;return s<6e4?"just now":s<60*6e4?`${Math.floor(s/6e4)} min ago`:s<1440*6e4?`${Math.floor(s/(60*6e4))} hr ago`:new Date(o).toLocaleString()}function he(o){let s=window.firebase?.user?.email;if(!s)return!1;if(o[s]==="ADMIN")return!0;let a=s.split("@").at(-1);return!!(a&&o[`*@${a}`]==="ADMIN")}function Ge(){let o=ae(),[s,a]=_(!1),[r,t]=_(!1),[m,u]=_(!1),d=W(null);function p(){d.current!==null&&(window.clearInterval(d.current),d.current=null),t(!1),u(!1)}B(()=>p,[]),B(()=>{r&&o.running&&u(!0)},[r,o.running]);async function b(f){if(!(s||r)){a(!0);try{let x=await fetch("/cms/api/search.rebuild",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({force:f})});if(!x.ok){let j=await x.text().catch(()=>"");throw new Error(`HTTP ${x.status}: ${j||"rebuild failed"}`)}U({title:"Search index",message:f?"Full rebuild started.":"Incremental rebuild started.",color:"blue",autoClose:4e3}),t(!0),d.current=window.setInterval(()=>{o.refresh()},2e3),window.setTimeout(p,10*6e4)}catch(x){U({title:"Error",message:x?.message||String(x),color:"red",autoClose:!1})}finally{a(!1)}}}B(()=>{r&&m&&!o.running&&(p(),U({title:"Search index",message:"Rebuild complete.",color:"green",autoClose:3e3}))},[r,m,o.running]);let P=o.status.lastRun,l=o.status.docCount,n=o.status.fieldCount,c=o.status.shardCount,i=o.running||s;return e("div",{className:"SettingsPage__section",children:[e("div",{className:"SettingsPage__section__left",children:[e(w,{className:"SettingsPage__section__left__title",children:"Site Admin"}),e(g,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:e("p",{children:"Project-wide administrative actions. Only admins see this section."})})]}),e(I,{className:"SettingsPage__section__right",children:e("div",{className:"SettingsPage__section__setting",children:[e(g,{size:"body",weight:"semi-bold",children:"Search index"}),e(g,{size:"body-sm",weight:"semi-bold",color:"gray",children:e("p",{children:"Powers the Cmd+K global search. Rebuilds run automatically on a schedule; trigger a manual rebuild here if you want immediate results (e.g. after a schema change)."})}),e("div",{className:"SettingsPage__siteAdmin__searchStats",children:[e("div",{children:[e("strong",{children:"Last indexed:"})," ",Be(P)]}),e("div",{children:[e("strong",{children:"Indexed docs:"})," ",l.toLocaleString()]}),e("div",{children:[e("strong",{children:"Indexed fields:"})," ",n.toLocaleString()]}),e("div",{children:[e("strong",{children:"Shards:"})," ",c]})]}),e("div",{className:"SettingsPage__siteAdmin__searchButtons",children:[e(v,{variant:"default",size:"xs",compact:!0,loading:i,onClick:()=>b(!1),children:"Rebuild incremental"}),e(v,{variant:"default",size:"xs",compact:!0,loading:i,onClick:()=>{window.confirm("Force a full rebuild? This wipes the existing index and reindexes every doc from scratch.")&&b(!0)},children:"Force full rebuild"})]})]})})]})}function Ue(o,s){return JSON.stringify(o)===JSON.stringify(s)}function Ie(){let o=window.__ROOT_CTX.rootConfig.projectId||"default",s=window.__ROOT_CTX.collections||{},a=C(()=>Object.keys(s).sort(),[s]),r=window.firebase.db,t=V(r,"Projects",o),[m,u]=_(!0),[d,p]=_(!1),[b,P]=_({}),[l,n]=_({globalRoles:{},permissionGroups:[]}),[c,i]=_({globalRoles:{},permissionGroups:[]});B(()=>{Y(t).then(h=>{let S=h.data()||{},E=S.roles||{},y={globalRoles:S.globalRoles||E,permissionGroups:S.permissionGroups||[]};P(E),n(y),i({globalRoles:{...y.globalRoles},permissionGroups:y.permissionGroups.map(R=>({...R}))}),u(!1)})},[]);let f=he(b),x=!Ue(l,c);function j(h){i(S=>({...S,globalRoles:h}))}function ve(h){i(S=>({...S,permissionGroups:h}))}function be(){i({globalRoles:{...l.globalRoles},permissionGroups:l.permissionGroups.map(h=>({...h}))})}async function Pe(){d||!x||(p(!0),await ee(async()=>{let{projectRoles:h,collectionRoles:S}=pe(c.permissionGroups,c.globalRoles);await Z(t,{globalRoles:c.globalRoles,roles:h,permissionGroups:c.permissionGroups});let E=l.permissionGroups.flatMap(R=>R.collections||[]),M=new Set([...Object.keys(S),...E]);for(let R of M){let Se=V(r,"Projects",o,"Collections",R);await Q(Se,{roles:S[R]||{}},{merge:!0})}let y={globalRoles:c.globalRoles,permissionGroups:c.permissionGroups};P(h),n(y),i({globalRoles:{...y.globalRoles},permissionGroups:y.permissionGroups.map(R=>({...R}))}),oe("acls.save_groups",{metadata:{groupCount:c.permissionGroups.length,userCount:Object.keys(h).length,collections:Array.from(M)}}),U({title:"Saved",message:"Sharing settings updated.",color:"green",autoClose:3e3})}),p(!1))}return e("div",{className:"SettingsPage__section SettingsPage__section__users",children:[e("div",{className:"SettingsPage__section__left",children:[e(w,{className:"SettingsPage__section__left__title",children:"Share"}),e(g,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:[e("p",{children:"Share access to the CMS. To share with everyone in a domain, use *@example.com."}),e("ul",{children:[e("li",{children:"VIEWER: view docs but not edit"}),e("li",{children:"CONTRIBUTOR: view and edit docs, but not publish"}),e("li",{children:"EDITOR: view, edit, and publish docs"}),e("li",{children:"ADMIN: all of the above and change sharing settings"})]}),e("p",{children:["Use ",e("strong",{children:"groups"})," to manage many users at once and optionally scope a role to specific collections."]})]})]}),e(I,{className:"SettingsPage__section__right",children:e("div",{className:"SettingsPage__share",children:[e(K,{visible:m,loaderProps:{color:"gray",size:"xl"}}),e("div",{className:"SettingsPage__share__subsection",children:[e(w,{className:"SettingsPage__section__right__title",size:"h3",children:"Users"}),e(D,{className:"SettingsPage__section__users__sharebox",roles:c.globalRoles,onChange:j,currentUserIsAdmin:f})]}),e("div",{className:"SettingsPage__share__subsection",children:[e(w,{className:"SettingsPage__section__right__title",size:"h3",children:"Groups"}),e(xe,{groups:c.permissionGroups,onChange:ve,collections:a,disabled:!f})]}),e("div",{className:"SettingsPage__share__saveBar",children:[e(g,{size:"body-sm",weight:"semi-bold",color:"gray",children:x?"You have unsaved changes.":"All changes saved."}),e("div",{className:"SettingsPage__share__saveBar__actions",children:[e(v,{variant:"default",size:"xs",radius:0,disabled:!x||d,onClick:be,children:"Discard"}),e(v,{size:"xs",radius:0,color:"dark",loading:d,disabled:!x||!f,onClick:Pe,children:"Save changes"})]})]})]})})]})}function Mo(){ge("Settings");let o=me(),s=ne(),a=le(),r=!a.loading&&he(a.roles);return e(ue,{children:e("div",{className:"SettingsPage",children:[e(Ie,{}),e("div",{className:"SettingsPage__section",children:[e("div",{className:"SettingsPage__section__left",children:[e(w,{className:"SettingsPage__section__left__title",children:"Site Settings"}),e(g,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:e("p",{children:"These settings apply to the project. Only admins can change them."})})]}),e(I,{className:"SettingsPage__section__right",children:te.map(t=>e("div",{className:"SettingsPage__section__setting",children:[e(g,{size:"body",weight:"semi-bold",children:t.name}),e(g,{size:"body-sm",weight:"semi-bold",color:"gray",children:e("p",{children:t.description})}),e(F,{autosize:!0,minRows:2,maxRows:4,value:s.settings[t.key]||"",placeholder:t.placeholder,onChange:m=>s.setSettings(t.key,m.currentTarget.value)}),t.ui&&e("div",{children:t.ui(s.settings[t.key])})]},t.key))})]}),r&&e(Ge,{}),e("div",{className:"SettingsPage__section",children:[e("div",{className:"SettingsPage__section__left",children:[e(w,{className:"SettingsPage__section__left__title",children:"User Preferences"}),e(g,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:e("p",{children:"These settings are for you only."})})]}),e(I,{className:"SettingsPage__section__right",children:e("div",{className:"SettingsPage__section__userPref",children:[e("div",{className:"SettingsPage__section__userPref__description",children:[e(g,{className:"SettingsPage__section__userPref__description__title",size:"body",weight:"semi-bold",children:"Enable EditorJS Editor (legacy)"}),e(g,{className:"SettingsPage__section__userPref__description__body",size:"body-sm",weight:"semi-bold",color:"gray",children:e("p",{children:["Replaces the"," ",e("a",{href:"https://lexical.dev/",target:"_blank",rel:"noopener noreferrer nofollow",children:"Lexical"})," ","(default) rich text editor with the"," ",e("a",{href:"https://editorjs.io/",target:"_blank",rel:"noopener noreferrer nofollow",children:"EditorJS"})," ","(legacy) version."]})})]}),e("div",{className:"SettingsPage__section__userPref__input",children:e(q,{color:"dark",checked:o.preferences.EnableEditorJSEditor,onChange:t=>{let m=t.currentTarget.checked;o.setPreference("EnableEditorJSEditor",m)}})})]})})]})]})})}export{Mo as SettingsPage};
@@ -1 +1 @@
1
- import{a as t,b as a}from"./chunk-FBJURT7Z.js";import"./chunk-AL3TN2KI.js";import{Ha as e,c as d,j as l}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-PVAE643M.js";l();function u(o){let r=(window.__ROOT_CTX.sidebar?.tools||{})[o.id];t(r?.label||o.id);let i=r?.cmsUrl,s=r?.externalUrl;return d(()=>{i?.startsWith("/cms/")&&window.location.replace(i)},[i]),d(()=>{s&&window.open(s,"_blank","noopener,noreferrer")?.focus()},[s]),r?s?e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--message",children:e("a",{href:s,target:"_blank",rel:"noreferrer noopener",children:["Open ",r.label||o.id," in a new tab"]})})}):i?.startsWith("/cms/")?e(a,{children:e("div",{className:"SidebarToolsPage",children:"redirecting..."})}):i?e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["invalid cmsUrl (must start with /cms/): ",o.id]})}):r.iframeUrl?e(a,{children:e("div",{className:"SidebarToolsPage",children:e("iframe",{src:r.iframeUrl})})}):e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["missing iframeUrl: ",o.id]})}):e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["not found: ",o.id]})})}export{u as SidebarToolsPage};
1
+ import{a as t,b as a}from"./chunk-7MTDTPYB.js";import"./chunk-AL3TN2KI.js";import{Ha as e,c as d,j as l}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-PVAE643M.js";l();function u(o){let r=(window.__ROOT_CTX.sidebar?.tools||{})[o.id];t(r?.label||o.id);let i=r?.cmsUrl,s=r?.externalUrl;return d(()=>{i?.startsWith("/cms/")&&window.location.replace(i)},[i]),d(()=>{s&&window.open(s,"_blank","noopener,noreferrer")?.focus()},[s]),r?s?e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--message",children:e("a",{href:s,target:"_blank",rel:"noreferrer noopener",children:["Open ",r.label||o.id," in a new tab"]})})}):i?.startsWith("/cms/")?e(a,{children:e("div",{className:"SidebarToolsPage",children:"redirecting..."})}):i?e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["invalid cmsUrl (must start with /cms/): ",o.id]})}):r.iframeUrl?e(a,{children:e("div",{className:"SidebarToolsPage",children:e("iframe",{src:r.iframeUrl})})}):e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["missing iframeUrl: ",o.id]})}):e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["not found: ",o.id]})})}export{u as SidebarToolsPage};