@blinkk/root-cms 3.0.5 → 3.0.6

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 (101) hide show
  1. package/dist/app.js +3 -2
  2. package/dist/{chunk-VSPPZPMP.js → chunk-7L5OI5ES.js} +9 -9
  3. package/dist/core/plugin.d.ts +17 -0
  4. package/dist/plugin.js +12 -1
  5. package/dist/ui/AIPage-JPZ4QUB4.js +1 -0
  6. package/dist/ui/{AssetsPage-DZQHAENZ.js → AssetsPage-GDJMKS3M.js} +1 -1
  7. package/dist/ui/{CollectionPage-WVVG62NR.js → CollectionPage-5DVXJEET.js} +1 -1
  8. package/dist/ui/ComparePage-LIXA6G66.js +1 -0
  9. package/dist/ui/{DataPage-WMLBCPGF.js → DataPage-AP4Z5JPS.js} +1 -1
  10. package/dist/ui/{DataSourcePage-POZAQFPU.js → DataSourcePage-WO3ZKMFI.js} +1 -1
  11. package/dist/ui/DocTranslationsPage-QKYFIVHP.js +1 -0
  12. package/dist/ui/DocumentPage-ON43I5KM.js +1 -0
  13. package/dist/ui/{EditDataSourcePage-PUA2AJ4C.js → EditDataSourcePage-XVMEV2LJ.js} +1 -1
  14. package/dist/ui/{EditReleasePage-CENP46EO.js → EditReleasePage-A2NB5TFG.js} +1 -1
  15. package/dist/ui/{ImageEditorDialog-4H665KK2.js → ImageEditorDialog-QEULJAT2.js} +2 -2
  16. package/dist/ui/LogsPage-4LZJX3O4.js +1 -0
  17. package/dist/ui/{NewDataSourcePage-FTILYFJY.js → NewDataSourcePage-4YWX7IOG.js} +1 -1
  18. package/dist/ui/NewReleasePage-HWLVTEXX.js +1 -0
  19. package/dist/ui/{NotFoundPage-EP2OE4JV.js → NotFoundPage-72AXQAYX.js} +1 -1
  20. package/dist/ui/{ProjectPage-6J7QCG75.js → ProjectPage-L4GYDIA5.js} +1 -1
  21. package/dist/ui/ReleasePage-43BSWL5B.js +1 -0
  22. package/dist/ui/{ReleasesPage-RWFOJ5VG.js → ReleasesPage-CJXAZBP6.js} +1 -1
  23. package/dist/ui/{SettingsPage-M4SIDBTI.js → SettingsPage-SYXAMKSF.js} +1 -1
  24. package/dist/ui/{SidebarToolsPage-GAX3XJ7W.js → SidebarToolsPage-OFF5BOXP.js} +1 -1
  25. package/dist/ui/TaskPage-HBDLHFI5.js +1 -0
  26. package/dist/ui/TasksPage-OLCDTQNB.js +1 -0
  27. package/dist/ui/{TranslationsArbPage-JGQGATCS.js → TranslationsArbPage-E3NCMAMS.js} +1 -1
  28. package/dist/ui/{TranslationsEditPage-7AGZGHKS.js → TranslationsEditPage-IWOI7Y5G.js} +1 -1
  29. package/dist/ui/{TranslationsPage-WIDVSTYF.js → TranslationsPage-OBN6CQZZ.js} +31 -31
  30. package/dist/ui/{ai-tools-5E5ELLZX.js → ai-tools-4DWMFQS6.js} +1 -1
  31. package/dist/ui/{chunk-KYDOSLTO.js → chunk-2225WAJ2.js} +1 -1
  32. package/dist/ui/chunk-32LRQ5MJ.js +1 -0
  33. package/dist/ui/{chunk-HKINZLMW.js → chunk-344GZOGG.js} +45 -45
  34. package/dist/ui/{chunk-7MTDTPYB.js → chunk-3HVDIPSS.js} +1 -1
  35. package/dist/ui/{chunk-BZIRGB4W.js → chunk-3IDOZ4MG.js} +1 -1
  36. package/dist/ui/{chunk-HHMG665Z.js → chunk-3XYCOR6Z.js} +1 -1
  37. package/dist/ui/chunk-4CUWZQXT.js +7 -0
  38. package/dist/ui/{chunk-3IYZCUPI.js → chunk-4IXGYXA2.js} +1 -1
  39. package/dist/ui/{chunk-PHBMVORG.js → chunk-6E7PGMZX.js} +1 -1
  40. package/dist/ui/{chunk-VMT7JFAM.js → chunk-6GPTGBA7.js} +1 -1
  41. package/dist/ui/{chunk-767BAQ53.js → chunk-6MOPIV5T.js} +1 -1
  42. package/dist/ui/{chunk-E2RCCK2T.js → chunk-AOCBDKLV.js} +1 -1
  43. package/dist/ui/chunk-AXETBZ6T.js +1 -0
  44. package/dist/ui/{chunk-54DVDYU6.js → chunk-BEDUTYQP.js} +1 -1
  45. package/dist/ui/{chunk-62UWGWON.js → chunk-CVGYBXVH.js} +1 -1
  46. package/dist/ui/{chunk-L4RHGQUG.js → chunk-D37DCENS.js} +1 -1
  47. package/dist/ui/{chunk-4W73RW5I.js → chunk-DXKEDMEI.js} +1 -1
  48. package/dist/ui/{chunk-C5NH23G4.js → chunk-EMYXSVTD.js} +1 -1
  49. package/dist/ui/{chunk-PWKJDYE2.js → chunk-GDSSFO5R.js} +1 -1
  50. package/dist/ui/{chunk-KFAZBEPV.js → chunk-HYARD7BK.js} +1 -1
  51. package/dist/ui/chunk-IDYKCAAL.js +1 -0
  52. package/dist/ui/{chunk-P4U2LUTF.js → chunk-IKED2IGU.js} +1 -1
  53. package/dist/ui/{chunk-KKEWCXVV.js → chunk-J3EGGI57.js} +1 -1
  54. package/dist/ui/{chunk-HRGYNHZ3.js → chunk-KPJ53X55.js} +1 -1
  55. package/dist/ui/{chunk-W3BJ2EZX.js → chunk-KYKFNAX4.js} +1 -1
  56. package/dist/ui/{chunk-TJBVMFNQ.js → chunk-MZP6RIG2.js} +1 -1
  57. package/dist/ui/chunk-N4DFAIC5.js +7 -0
  58. package/dist/ui/{chunk-HLMBCVRX.js → chunk-N5Y5OWTV.js} +1 -1
  59. package/dist/ui/chunk-NMBXHKIJ.js +81 -0
  60. package/dist/ui/chunk-NQ5ARARP.js +1 -0
  61. package/dist/ui/{chunk-X2WHBGTP.js → chunk-NQB37NMX.js} +1 -1
  62. package/dist/ui/chunk-OVRTVMO5.js +1 -0
  63. package/dist/ui/{chunk-AEWL2RWR.js → chunk-RI2JWWU3.js} +53 -53
  64. package/dist/ui/{chunk-AL3TN2KI.js → chunk-RPOP6MVJ.js} +1 -1
  65. package/dist/ui/{chunk-JHBAMPGB.js → chunk-RQKL4KXY.js} +1 -1
  66. package/dist/ui/{chunk-P3NETZZP.js → chunk-SEUH7LN2.js} +1 -1
  67. package/dist/ui/{chunk-QGBR3J2Y.js → chunk-T47V6AGW.js} +1 -1
  68. package/dist/ui/{chunk-ONTGW2VA.js → chunk-TDKVKTW4.js} +1 -1
  69. package/dist/ui/chunk-TZEZEMRQ.js +1 -0
  70. package/dist/ui/{chunk-RSVO46S3.js → chunk-UA7UCTX5.js} +1 -1
  71. package/dist/ui/chunk-UFQSZ6J2.js +3 -0
  72. package/dist/ui/{chunk-DEGMKEHP.js → chunk-UHWNLNP4.js} +1 -1
  73. package/dist/ui/{chunk-CGCKJFL4.js → chunk-V7RAXP2W.js} +1 -1
  74. package/dist/ui/{chunk-JYFLU7DM.js → chunk-WKOX3VFN.js} +1 -1
  75. package/dist/ui/{chunk-SQRKKWRG.js → chunk-XYBHH5L4.js} +1 -1
  76. package/dist/ui/ui.css +1 -1
  77. package/dist/ui/ui.js +1 -1
  78. package/package.json +10 -10
  79. package/dist/ui/AIPage-F3NNYM5E.js +0 -1
  80. package/dist/ui/ComparePage-CRDHP45W.js +0 -1
  81. package/dist/ui/DocTranslationsPage-UR5D2RF2.js +0 -1
  82. package/dist/ui/DocumentPage-SQ7ROBMC.js +0 -1
  83. package/dist/ui/LogsPage-FZRN6MBJ.js +0 -1
  84. package/dist/ui/NewReleasePage-MHJC66KK.js +0 -1
  85. package/dist/ui/ReleasePage-IZ3DNGT4.js +0 -1
  86. package/dist/ui/TaskPage-UCATTNZ5.js +0 -1
  87. package/dist/ui/TasksPage-4AQLQ4IT.js +0 -1
  88. package/dist/ui/chunk-7UIUAHC4.js +0 -1
  89. package/dist/ui/chunk-AFWBSIPL.js +0 -1
  90. package/dist/ui/chunk-I6ICVKEC.js +0 -1
  91. package/dist/ui/chunk-JKCZGT6B.js +0 -1
  92. package/dist/ui/chunk-JZFTZ4X4.js +0 -87
  93. package/dist/ui/chunk-NZHF733K.js +0 -7
  94. package/dist/ui/chunk-PJA7YP4A.js +0 -1
  95. package/dist/ui/chunk-XOQ3KDSR.js +0 -3
  96. package/dist/ui/chunk-YFA6U2CV.js +0 -1
  97. /package/dist/ui/{ImageEditorDialog-4H665KK2.js.LEGAL.txt → ImageEditorDialog-QEULJAT2.js.LEGAL.txt} +0 -0
  98. /package/dist/ui/{chunk-NZHF733K.js.LEGAL.txt → chunk-4CUWZQXT.js.LEGAL.txt} +0 -0
  99. /package/dist/ui/{chunk-JZFTZ4X4.js.LEGAL.txt → chunk-NMBXHKIJ.js.LEGAL.txt} +0 -0
  100. /package/dist/ui/{chunk-AEWL2RWR.js.LEGAL.txt → chunk-RI2JWWU3.js.LEGAL.txt} +0 -0
  101. /package/dist/ui/{prerender-Q4YSDCPB.js → prerender-M47IWV5Q.js} +0 -0
package/dist/app.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getServerVersion,
3
3
  serializeAiConfig
4
- } from "./chunk-VSPPZPMP.js";
4
+ } from "./chunk-7L5OI5ES.js";
5
5
  import "./chunk-RXWDB3K4.js";
6
6
  import "./chunk-N4K6ICFR.js";
7
7
  import {
@@ -149,7 +149,8 @@ async function renderApp(req, res, options) {
149
149
  hasImport: isFunction(t.onImport),
150
150
  hasExport: isFunction(t.onExport)
151
151
  })),
152
- defaultOneOfVariant: cmsConfig.defaultOneOfVariant || "dropdown"
152
+ defaultOneOfVariant: cmsConfig.defaultOneOfVariant || "dropdown",
153
+ excludeLocalesFromTranslations: cmsConfig.excludeLocalesFromTranslations || []
153
154
  };
154
155
  const projectName = cmsConfig.name || cmsConfig.id || "";
155
156
  const title = getCmsTitle(projectName, cmsConfig.minimalBranding);
@@ -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.5",
1201
+ version: "3.0.6",
1202
1202
  author: "s@blinkk.com",
1203
1203
  license: "MIT",
1204
1204
  engines: {
@@ -1273,11 +1273,11 @@ var package_default = {
1273
1273
  "@ai-sdk/openai": "3.0.60",
1274
1274
  "@ai-sdk/openai-compatible": "2.0.46",
1275
1275
  "@ai-sdk/react": "3.0.177",
1276
- ai: "6.0.175",
1277
- zod: "4.4.3",
1278
1276
  "@google-cloud/firestore": "7.11.3",
1279
1277
  "@hello-pangea/dnd": "18.0.1",
1278
+ "@mantine/spotlight": "4.2.12",
1280
1279
  "@types/cli-progress": "3.11.6",
1280
+ ai: "6.0.175",
1281
1281
  "body-parser": "1.20.2",
1282
1282
  "cli-progress": "3.12.0",
1283
1283
  commander: "11.0.0",
@@ -1287,14 +1287,14 @@ var package_default = {
1287
1287
  "date-fns-tz": "3.2.0",
1288
1288
  diff: "8.0.2",
1289
1289
  "dts-dom": "3.7.0",
1290
- "@mantine/spotlight": "4.2.12",
1291
1290
  "fnv-plus": "1.3.1",
1292
1291
  jsonwebtoken: "9.0.2",
1293
1292
  kleur: "4.1.5",
1294
1293
  minisearch: "7.2.0",
1295
1294
  "sanitize-html": "2.13.1",
1296
1295
  sirv: "2.0.3",
1297
- "tiny-glob": "0.2.9"
1296
+ "tiny-glob": "0.2.9",
1297
+ zod: "4.4.3"
1298
1298
  },
1299
1299
  "//": "NOTE(stevenle): due to compat issues with mantine and preact, mantine is pinned to v4.2.12",
1300
1300
  devDependencies: {
@@ -1339,8 +1339,8 @@ var package_default = {
1339
1339
  "@types/jsonwebtoken": "9.0.1",
1340
1340
  "@types/node": "24.3.1",
1341
1341
  "@types/sanitize-html": "2.13.0",
1342
- "@vitest/browser": "4.1.6",
1343
- "@vitest/browser-playwright": "4.1.6",
1342
+ "@vitest/browser": "4.1.8",
1343
+ "@vitest/browser-playwright": "4.1.8",
1344
1344
  concurrently: "7.6.0",
1345
1345
  esbuild: "0.28.0",
1346
1346
  firebase: "12.2.1",
@@ -1355,7 +1355,7 @@ var package_default = {
1355
1355
  "mdast-util-from-markdown": "2.0.1",
1356
1356
  "mdast-util-gfm": "3.0.0",
1357
1357
  "micromark-extension-gfm": "3.0.0",
1358
- playwright: "1.56.1",
1358
+ playwright: "1.60.0",
1359
1359
  preact: "10.27.1",
1360
1360
  "preact-iso": "2.11.1",
1361
1361
  "preact-render-to-string": "6.6.7",
@@ -1369,7 +1369,7 @@ var package_default = {
1369
1369
  yjs: "13.6.27"
1370
1370
  },
1371
1371
  peerDependencies: {
1372
- "@blinkk/root": "3.0.5",
1372
+ "@blinkk/root": "3.0.6",
1373
1373
  "firebase-admin": ">=11",
1374
1374
  "firebase-functions": ">=4"
1375
1375
  },
@@ -345,6 +345,23 @@ export type CMSPluginOptions = {
345
345
  * override this by setting their own `variant`. Defaults to `'dropdown'`.
346
346
  */
347
347
  defaultOneOfVariant?: 'dropdown' | 'picker';
348
+ /**
349
+ * Locales to exclude from translation import and export (CSV, Google Sheets,
350
+ * and any registered translation services). Each entry is matched against
351
+ * the locale id and supports wildcards, where `*` matches any number of
352
+ * characters and `?` matches a single character. Matching is
353
+ * case-insensitive. Excluded locales are omitted from exports and ignored
354
+ * when importing.
355
+ *
356
+ * Example:
357
+ * ```ts
358
+ * cmsPlugin({
359
+ * // Exclude pseudo-locales like `ALL_es`, `ALL_fr`, etc.
360
+ * excludeLocalesFromTranslations: ['ALL_*'],
361
+ * });
362
+ * ```
363
+ */
364
+ excludeLocalesFromTranslations?: string[];
348
365
  };
349
366
  export type CMSPlugin = Plugin & {
350
367
  name: 'root-cms';
package/dist/plugin.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  serializeAiConfig,
14
14
  summarizeDiff,
15
15
  translateString
16
- } from "./chunk-VSPPZPMP.js";
16
+ } from "./chunk-7L5OI5ES.js";
17
17
  import {
18
18
  runCronJobs
19
19
  } from "./chunk-PNLLZXVY.js";
@@ -221,11 +221,22 @@ function isRecord(value) {
221
221
  function isDocVersion(value) {
222
222
  return value === "draft" || value === "published";
223
223
  }
224
+ function withNoTransform(cacheControl) {
225
+ const value = cacheControl?.trim() || "no-cache";
226
+ if (/(?:^|,)\s*no-transform\s*(?:,|$)/i.test(value)) {
227
+ return value;
228
+ }
229
+ return `${value}, no-transform`;
230
+ }
224
231
  async function pipeWebResponse(webResponse, res) {
225
232
  res.status(webResponse.status);
226
233
  webResponse.headers.forEach((value, key) => {
227
234
  res.setHeader(key, value);
228
235
  });
236
+ res.setHeader(
237
+ "Cache-Control",
238
+ withNoTransform(webResponse.headers.get("cache-control"))
239
+ );
229
240
  res.setHeader("X-Accel-Buffering", "no");
230
241
  if (!webResponse.body) {
231
242
  res.end();
@@ -0,0 +1 @@
1
+ import{a as o}from"./chunk-WKOX3VFN.js";import"./chunk-6E7PGMZX.js";import"./chunk-N4DFAIC5.js";import"./chunk-NMBXHKIJ.js";import"./chunk-344GZOGG.js";import"./chunk-SKEP5WYH.js";import"./chunk-YDO2EDVY.js";import{a,b as i}from"./chunk-3HVDIPSS.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import"./chunk-RPOP6MVJ.js";import{Ga as t}from"./chunk-4CUWZQXT.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-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
+ import{k as _}from"./chunk-MZP6RIG2.js";import"./chunk-V7RAXP2W.js";import{a as f}from"./chunk-6GPTGBA7.js";import"./chunk-SKEP5WYH.js";import{a as h}from"./chunk-32LRQ5MJ.js";import"./chunk-NQ5ARARP.js";import"./chunk-UFQSZ6J2.js";import"./chunk-CVGYBXVH.js";import"./chunk-AXETBZ6T.js";import{a as m}from"./chunk-N5Y5OWTV.js";import"./chunk-ORXEMIQC.js";import{a as F,b as v}from"./chunk-3HVDIPSS.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import{f as p}from"./chunk-RPOP6MVJ.js";import{Fa as u,Ga as a,W as r,a as t,da as d,j as n,lb as c,na as g}from"./chunk-4CUWZQXT.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-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
+ import{a as U}from"./chunk-KYKFNAX4.js";import{h as B}from"./chunk-OVRTVMO5.js";import{a as D,e as S,j as z}from"./chunk-IKED2IGU.js";import{c as O,e as I}from"./chunk-4IXGYXA2.js";import"./chunk-UA7UCTX5.js";import"./chunk-BEDUTYQP.js";import{a as w}from"./chunk-NQB37NMX.js";import{b as E,c as P}from"./chunk-TDKVKTW4.js";import"./chunk-4KE2SZKH.js";import{a as A}from"./chunk-D37DCENS.js";import"./chunk-KPJ53X55.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import{a as j}from"./chunk-32LRQ5MJ.js";import"./chunk-NQ5ARARP.js";import"./chunk-UFQSZ6J2.js";import"./chunk-CVGYBXVH.js";import"./chunk-AXETBZ6T.js";import"./chunk-N5Y5OWTV.js";import"./chunk-ORXEMIQC.js";import{a as R,b as $}from"./chunk-3HVDIPSS.js";import{b as h}from"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import{d as k}from"./chunk-RPOP6MVJ.js";import{Ca as L,Ga as o,V as y,a as x,c as T,cb as u,da as C,j as M,za as N}from"./chunk-4CUWZQXT.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};
@@ -0,0 +1 @@
1
+ import{b as s}from"./chunk-TZEZEMRQ.js";import"./chunk-N4DFAIC5.js";import"./chunk-NMBXHKIJ.js";import"./chunk-NQ5ARARP.js";import"./chunk-UFQSZ6J2.js";import"./chunk-N5Y5OWTV.js";import"./chunk-ORXEMIQC.js";import{a as d,b as m}from"./chunk-3HVDIPSS.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import{d as t}from"./chunk-RPOP6MVJ.js";import{Ga as a,g as i,j as p}from"./chunk-4CUWZQXT.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-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
+ import{a as m}from"./chunk-J3EGGI57.js";import"./chunk-V7RAXP2W.js";import{a as P}from"./chunk-6GPTGBA7.js";import{a as T}from"./chunk-NQB37NMX.js";import{b as y,c as w}from"./chunk-TDKVKTW4.js";import{b as v}from"./chunk-4KE2SZKH.js";import{a as x}from"./chunk-D37DCENS.js";import"./chunk-W3HIZQ4Z.js";import{a as k}from"./chunk-32LRQ5MJ.js";import"./chunk-AXETBZ6T.js";import{a as p}from"./chunk-N5Y5OWTV.js";import{b as u}from"./chunk-ORXEMIQC.js";import{a as A,b as B}from"./chunk-3HVDIPSS.js";import"./chunk-EGEB6N4J.js";import"./chunk-RPOP6MVJ.js";import{Ca as b,Da as D,Fa as i,Ga as e,Jc as S,V as g,W as f,a as d,ba as s,c as h,da as _,g as c,j as G}from"./chunk-4CUWZQXT.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-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
+ import{a as f}from"./chunk-J3EGGI57.js";import"./chunk-V7RAXP2W.js";import{a as g}from"./chunk-6GPTGBA7.js";import"./chunk-TDKVKTW4.js";import{c as T,d as N}from"./chunk-4KE2SZKH.js";import"./chunk-D37DCENS.js";import"./chunk-W3HIZQ4Z.js";import{a as h}from"./chunk-32LRQ5MJ.js";import"./chunk-AXETBZ6T.js";import{a as A}from"./chunk-N5Y5OWTV.js";import"./chunk-ORXEMIQC.js";import{a as W,b as H}from"./chunk-3HVDIPSS.js";import"./chunk-EGEB6N4J.js";import"./chunk-RPOP6MVJ.js";import{Cc as k,Da as D,Fa as p,Ga as a,Jc as z,V as y,W as m,a as _,c as b,ca as v,da as P,j as B,na as x,oa as w}from"./chunk-4CUWZQXT.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};
@@ -0,0 +1 @@
1
+ import{b as ta}from"./chunk-6MOPIV5T.js";import{a as oa}from"./chunk-DXKEDMEI.js";import{a as ea}from"./chunk-SEUH7LN2.js";import{a as aa}from"./chunk-6GPTGBA7.js";import"./chunk-KPJ53X55.js";import{b as G}from"./chunk-W3HIZQ4Z.js";import"./chunk-YDO2EDVY.js";import{A as X,t as V}from"./chunk-NQ5ARARP.js";import{b as U,h as y}from"./chunk-UFQSZ6J2.js";import{b as j}from"./chunk-CVGYBXVH.js";import{a as B,b as O}from"./chunk-AXETBZ6T.js";import"./chunk-N5Y5OWTV.js";import"./chunk-ORXEMIQC.js";import{a as na,b as M}from"./chunk-3HVDIPSS.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import{f as S}from"./chunk-RPOP6MVJ.js";import{Fa as p,Ga as a,Jc as Y,Nc as Z,V as R,W as w,a as r,c as k,ca as W,da as f,e as A,g as E,gc as K,j as Ta,qa as C,yb as q,yc as Q,zb as J}from"./chunk-4CUWZQXT.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";Ta();function u(e){na(`Translations: ${e.collection}/${e.slug}`);let[_,l]=r(!0),[h,g]=r(!1),[o,t]=r([]),[s,c]=r({}),[N,sa]=r(null),[ra,I]=r(!1),[L,F]=r({}),[ia,z]=r(!1),m=e.collection,b=e.slug,i=`${m}/${b}`,la=oa(),x=((window.__ROOT_CTX.rootConfig.i18n||{}).locales||[]).filter(n=>!y(n)),[H,$]=ta("locale",x);async function ca(){try{let[n,d,T]=await Promise.all([ea(i),U(),X(i)]);t(n),c(d),sa(T),l(!1)}catch(n){console.error(n),l(!1),g(!0)}}if(k(()=>{ca()},[]),h)return a(u.NotFound,{docId:i});function da(n,d,T){I(!0),F(P=>{let D={...P},v=D[n]??{};return v.source=n,v[d]=T,D[n]=v,D})}async function ga(){z(!0),await j(async()=>{console.log("EditTranslationsModal.onSave()");let n=`edit-translations-${i}`;B({id:n,loading:!0,title:"Saving translations",message:`Updating for ${i}...`,autoClose:!1,disallowClose:!0});let d=Object.values(L);console.log(d),await V(i,d),O({id:n,title:"Saved translations",message:`Updated translations for ${i}!`,autoClose:!0}),F({}),I(!1)}),z(!1)}function _a(n){H.length===x.length?$([n]):$(x)}return a(M,{children:a("div",{className:"DocTranslationsPage",children:[a("div",{className:"DocTranslationsPage__header",children:[a(W,{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(aa,{size:"h1",children:["Translations: ",i]})}),a("div",{className:"DocTranslationsPage__header__controls",children:[N&&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:G(N),target:"_blank",variant:"filled",color:"green",size:"sm",children:a(Y,{size:16,strokeWidth:2.25})})}),a(f,{variant:"default",size:"xs",leftIcon:a(J,{size:16,strokeWidth:1.75}),children:"Import from Sheet"}),a(f,{variant:"default",size:"xs",leftIcon:a(q,{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(Z,{size:16})})}),size:220,children:a(C.Item,{className:"DocTranslationsPage__toolsMenu__item",icon:a(Q,{size:16}),onClick:()=>la.open({docId:i,sourceStrings:o,onPruned:n=>{c(d=>{let T={...d};return n.forEach(P=>delete T[P]),T})}}),children:"Prune unused strings"})})]})]}),a("div",{className:S("DocTranslationsPage__content",_&&"DocTranslationsPage__content--loading"),children:_?a(R,{color:"gray",size:"xl"}):a(u.Table,{locales:H,sourceStrings:o,translationsMap:s,onChange:da,changesMap:L,onSelectLocale:n=>_a(n)})}),a("div",{className:"DocTranslationsPage__footer",children:a("div",{className:"DocTranslationsPage__footer__buttons",children:a(f,{variant:"filled",color:"dark",disabled:!ra,loading:ia,onClick:()=>ga(),children:"Save"})})})]})})}u.NotFound=e=>a(M,{children:a("div",{className:"DocTranslationsPage DocTranslationsPage--error",children:a("div",{className:"DocTranslationsPage__error",children:[a("div",{className:"DocTranslationsPage__error__icon",children:a(K,{size:60})}),a("div",{className:"DocTranslationsPage__error__title",children:["Not found: ",e.docId]})]})})});u.Table=e=>{let l=((window.__ROOT_CTX.rootConfig.i18n||{}).locales||[]).filter(o=>!y(o)),h=E(()=>{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 _=A(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:S("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-6MOPIV5T.js";import{c as Le,i as Ve,j as Ue,k as We,m as $e}from"./chunk-RI2JWWU3.js";import"./chunk-3XYCOR6Z.js";import"./chunk-TZEZEMRQ.js";import"./chunk-DXKEDMEI.js";import"./chunk-SEUH7LN2.js";import"./chunk-T47V6AGW.js";import"./chunk-HYARD7BK.js";import"./chunk-2225WAJ2.js";import{a as Fe}from"./chunk-WKOX3VFN.js";import"./chunk-6E7PGMZX.js";import"./chunk-N4DFAIC5.js";import{c as Ne}from"./chunk-NMBXHKIJ.js";import"./chunk-344GZOGG.js";import{a as Me,d as Ae,f as q,h as Oe}from"./chunk-MZP6RIG2.js";import"./chunk-V7RAXP2W.js";import"./chunk-6GPTGBA7.js";import"./chunk-SKEP5WYH.js";import"./chunk-OVRTVMO5.js";import{b as Re,c as ae,g as Te}from"./chunk-IKED2IGU.js";import"./chunk-4IXGYXA2.js";import"./chunk-UA7UCTX5.js";import"./chunk-BEDUTYQP.js";import{a as R}from"./chunk-NQB37NMX.js";import{b as Be,c as se}from"./chunk-TDKVKTW4.js";import"./chunk-4KE2SZKH.js";import{a as ze}from"./chunk-D37DCENS.js";import"./chunk-KPJ53X55.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import"./chunk-NQ5ARARP.js";import"./chunk-UFQSZ6J2.js";import"./chunk-CVGYBXVH.js";import"./chunk-AXETBZ6T.js";import"./chunk-N5Y5OWTV.js";import"./chunk-ORXEMIQC.js";import{a as He,b as Xe}from"./chunk-3HVDIPSS.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import{f as I}from"./chunk-RPOP6MVJ.js";import{Fa as T,Ga as e,Ia as pe,Oa as ge,P as me,Qa as oe,Sa as fe,Sc as Ee,Tc as ne,Ua as ve,Ub as De,Vb as Ce,W as N,Za as Pe,a as y,ba as he,c as b,da as j,e as P,g as B,h as C,j as te,oc as Se,pb as we,qb as xe,rb as be,sb as ke,sc as ye,za as _e,zc as Ie}from"./chunk-4CUWZQXT.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?`${Math.max(V-28,0)/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-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
+ import{a as H}from"./chunk-EMYXSVTD.js";import"./chunk-V7RAXP2W.js";import{a as M}from"./chunk-6GPTGBA7.js";import{a as B,c as _}from"./chunk-TDKVKTW4.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-D37DCENS.js";import{a as w,c as p}from"./chunk-KPJ53X55.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import{a as F}from"./chunk-32LRQ5MJ.js";import"./chunk-CVGYBXVH.js";import{a as s,b as r}from"./chunk-AXETBZ6T.js";import{a as m}from"./chunk-N5Y5OWTV.js";import"./chunk-ORXEMIQC.js";import{a as O,b as L}from"./chunk-3HVDIPSS.js";import"./chunk-EGEB6N4J.js";import{d as y}from"./chunk-RPOP6MVJ.js";import{Fa as n,Ga as e,La as I,W as l,Wc as $,a as D,c as x,ca as P,ib as k,j as K,tc as U}from"./chunk-4CUWZQXT.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-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
+ import{a as k}from"./chunk-IDYKCAAL.js";import"./chunk-RQKL4KXY.js";import"./chunk-T47V6AGW.js";import{a as A}from"./chunk-6GPTGBA7.js";import"./chunk-IKED2IGU.js";import"./chunk-4IXGYXA2.js";import{c as s,e as E,f as w}from"./chunk-UA7UCTX5.js";import"./chunk-BEDUTYQP.js";import"./chunk-NQB37NMX.js";import{a as z,c as I}from"./chunk-TDKVKTW4.js";import"./chunk-4KE2SZKH.js";import{a as T}from"./chunk-D37DCENS.js";import{a as x,c as P}from"./chunk-KPJ53X55.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import"./chunk-NQ5ARARP.js";import"./chunk-UFQSZ6J2.js";import"./chunk-CVGYBXVH.js";import{a as h,b as f}from"./chunk-AXETBZ6T.js";import{a as g}from"./chunk-N5Y5OWTV.js";import"./chunk-ORXEMIQC.js";import{a as $,b as U}from"./chunk-3HVDIPSS.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import{d as C}from"./chunk-RPOP6MVJ.js";import{Fa as m,Ga as e,La as y,W as c,a as v,c as R,ca as b,j as B,tc as p}from"./chunk-4CUWZQXT.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,4 +1,4 @@
1
- import{e as ye}from"./chunk-SKEP5WYH.js";import{A as le,Ba as de,Ca as me,Ga as $,Ha as h,Sa as ge,Ta as ve,W as K,Y as pe,_a as we,a as C,c as Y,ea as N,g as ue,ga as P,h as q,ha as he,j as qe,sa as fe,wa as J,y as Ke}from"./chunk-NZHF733K.js";import{b as E,c as L,e as ce}from"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import{b as O,d as Ye}from"./chunk-PVAE643M.js";var Pe=O((yt,Ee)=>{"use strict";var Ce=!1,x,ee,te,Z,H,_e,G,re,oe,ne,Se,ie,ae,xe,Re;function y(){if(!Ce){Ce=!0;var r=navigator.userAgent,n=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(r),e=/(Mac OS X)|(Windows)|(Linux)/.exec(r);if(ie=/\b(iPhone|iP[ao]d)/.exec(r),ae=/\b(iP[ao]d)/.exec(r),ne=/Android/i.exec(r),xe=/FBAN\/\w+;/i.exec(r),Re=/Mobile/i.exec(r),Se=!!/Win64/.exec(r),n){x=n[1]?parseFloat(n[1]):n[5]?parseFloat(n[5]):NaN,x&&document&&document.documentMode&&(x=document.documentMode);var t=/(?:Trident\/(\d+.\d+))/.exec(r);_e=t?parseFloat(t[1])+4:x,ee=n[2]?parseFloat(n[2]):NaN,te=n[3]?parseFloat(n[3]):NaN,Z=n[4]?parseFloat(n[4]):NaN,Z?(n=/(?:Chrome\/(\d+\.\d+))/.exec(r),H=n&&n[1]?parseFloat(n[1]):NaN):H=NaN}else x=ee=te=H=Z=NaN;if(e){if(e[1]){var o=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(r);G=o?parseFloat(o[1].replace("_",".")):!0}else G=!1;re=!!e[2],oe=!!e[3]}else G=re=oe=!1}}var se={ie:function(){return y()||x},ieCompatibilityMode:function(){return y()||_e>x},ie64:function(){return se.ie()&&Se},firefox:function(){return y()||ee},opera:function(){return y()||te},webkit:function(){return y()||Z},safari:function(){return se.webkit()},chrome:function(){return y()||H},windows:function(){return y()||re},osx:function(){return y()||G},linux:function(){return y()||oe},iphone:function(){return y()||ie},mobile:function(){return y()||ie||ae||ne||Re},nativeApp:function(){return y()||xe},android:function(){return y()||ne},ipad:function(){return y()||ae}};Ee.exports=se});var ze=O((bt,De)=>{"use strict";var k=!!(typeof window<"u"&&window.document&&window.document.createElement),Je={canUseDOM:k,canUseWorkers:typeof Worker<"u",canUseEventListeners:k&&!!(window.addEventListener||window.attachEvent),canUseViewport:k&&!!window.screen,isInWorker:!k};De.exports=Je});var Te=O((Ct,Oe)=>{"use strict";var Me=ze(),Ae;Me.canUseDOM&&(Ae=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);function $e(r,n){if(!Me.canUseDOM||n&&!("addEventListener"in document))return!1;var e="on"+r,t=e in document;if(!t){var o=document.createElement("div");o.setAttribute(e,"return;"),t=typeof o[e]=="function"}return!t&&Ae&&r==="wheel"&&(t=document.implementation.hasFeature("Events.wheel","3.0")),t}Oe.exports=$e});var Ne=O((_t,Le)=>{"use strict";var Qe=Pe(),et=Te(),Ie=10,We=40,je=800;function Fe(r){var n=0,e=0,t=0,o=0;return"detail"in r&&(e=r.detail),"wheelDelta"in r&&(e=-r.wheelDelta/120),"wheelDeltaY"in r&&(e=-r.wheelDeltaY/120),"wheelDeltaX"in r&&(n=-r.wheelDeltaX/120),"axis"in r&&r.axis===r.HORIZONTAL_AXIS&&(n=e,e=0),t=n*Ie,o=e*Ie,"deltaY"in r&&(o=r.deltaY),"deltaX"in r&&(t=r.deltaX),(t||o)&&r.deltaMode&&(r.deltaMode==1?(t*=We,o*=We):(t*=je,o*=je)),t&&!n&&(n=t<1?-1:1),o&&!e&&(e=o<1?-1:1),{spinX:n,spinY:e,pixelX:t,pixelY:o}}Fe.getEventType=function(){return Qe.firefox()?"DOMMouseScroll":et("wheel")?"wheel":"mousewheel"};Le.exports=Fe});var He=O((St,Ze)=>{"use strict";Ze.exports=Ne()});qe();var Q=function(r,n){return Q=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},Q(r,n)};function be(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");Q(r,n);function e(){this.constructor=r}r.prototype=n===null?Object.create(n):(e.prototype=n.prototype,new e)}var g=function(){return g=Object.assign||function(n){for(var e,t=1,o=arguments.length;t<o;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},g.apply(this,arguments)};Ke();var Xe=Ye(He(),1);function tt(r,n,e,t,o,i){i===void 0&&(i=0);var s=D(r,n,i),a=s.width,c=s.height,u=Math.min(a,e),l=Math.min(c,t);return u>l*o?{width:l*o,height:l}:{width:u,height:u/o}}function rt(r){return r.width>r.height?r.width/r.naturalWidth:r.height/r.naturalHeight}function T(r,n,e,t,o){o===void 0&&(o=0);var i=D(n.width,n.height,o),s=i.width,a=i.height;return{x:Ge(r.x,s,e.width,t),y:Ge(r.y,a,e.height,t)}}function Ge(r,n,e,t){var o=n*t/2-e/2;return U(r,-o,o)}function ke(r,n){return Math.sqrt(Math.pow(r.y-n.y,2)+Math.pow(r.x-n.x,2))}function Be(r,n){return Math.atan2(n.y-r.y,n.x-r.x)*180/Math.PI}function ot(r,n,e,t,o,i,s){i===void 0&&(i=0),s===void 0&&(s=!0);var a=s?nt:it,c=D(n.width,n.height,i),u=D(n.naturalWidth,n.naturalHeight,i),l={x:a(100,((c.width-e.width/o)/2-r.x/o)/c.width*100),y:a(100,((c.height-e.height/o)/2-r.y/o)/c.height*100),width:a(100,e.width/c.width*100/o),height:a(100,e.height/c.height*100/o)},d=Math.round(a(u.width,l.width*u.width/100)),p=Math.round(a(u.height,l.height*u.height/100)),m=u.width>=u.height*t,v=m?{width:Math.round(p*t),height:p}:{width:d,height:Math.round(d/t)},w=g(g({},v),{x:Math.round(a(u.width-v.width,l.x*u.width/100)),y:Math.round(a(u.height-v.height,l.y*u.height/100))});return{croppedAreaPercentages:l,croppedAreaPixels:w}}function nt(r,n){return Math.min(r,Math.max(0,n))}function it(r,n){return n}function at(r,n,e,t,o,i){var s=D(n.width,n.height,e),a=U(t.width/s.width*(100/r.width),o,i),c={x:a*s.width/2-t.width/2-s.width*a*(r.x/100),y:a*s.height/2-t.height/2-s.height*a*(r.y/100)};return{crop:c,zoom:a}}function st(r,n,e){var t=rt(n);return e.height>e.width?e.height/(r.height*t):e.width/(r.width*t)}function ct(r,n,e,t,o,i){e===void 0&&(e=0);var s=D(n.naturalWidth,n.naturalHeight,e),a=U(st(r,n,t),o,i),c=t.height>t.width?t.height/r.height:t.width/r.width,u={x:((s.width-r.width)/2-r.x)*c,y:((s.height-r.height)/2-r.y)*c};return{crop:u,zoom:a}}function Ue(r,n){return{x:(n.x+r.x)/2,y:(n.y+r.y)/2}}function ut(r){return r*Math.PI/180}function D(r,n,e){var t=ut(e);return{width:Math.abs(Math.cos(t)*r)+Math.abs(Math.sin(t)*n),height:Math.abs(Math.sin(t)*r)+Math.abs(Math.cos(t)*n)}}function U(r,n,e){return Math.min(Math.max(r,n),e)}function B(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return r.filter(function(e){return typeof e=="string"&&e.length>0}).join(" ").trim()}var lt=`.reactEasyCrop_Container {
1
+ import{e as ye}from"./chunk-SKEP5WYH.js";import{A as le,Aa as de,Ba as me,Fa as $,Ga as h,Ra as ge,Sa as ve,W as K,Y as pe,Za as we,a as C,c as Y,da as N,fa as P,g as ue,ga as he,h as q,j as qe,ra as fe,va as J,y as Ke}from"./chunk-4CUWZQXT.js";import{b as E,c as L,e as ce}from"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import{b as O,d as Ye}from"./chunk-PVAE643M.js";var Pe=O((yt,Ee)=>{"use strict";var Ce=!1,S,ee,te,Z,H,_e,G,re,oe,ne,xe,ie,ae,Se,Re;function y(){if(!Ce){Ce=!0;var r=navigator.userAgent,n=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(r),e=/(Mac OS X)|(Windows)|(Linux)/.exec(r);if(ie=/\b(iPhone|iP[ao]d)/.exec(r),ae=/\b(iP[ao]d)/.exec(r),ne=/Android/i.exec(r),Se=/FBAN\/\w+;/i.exec(r),Re=/Mobile/i.exec(r),xe=!!/Win64/.exec(r),n){S=n[1]?parseFloat(n[1]):n[5]?parseFloat(n[5]):NaN,S&&document&&document.documentMode&&(S=document.documentMode);var t=/(?:Trident\/(\d+.\d+))/.exec(r);_e=t?parseFloat(t[1])+4:S,ee=n[2]?parseFloat(n[2]):NaN,te=n[3]?parseFloat(n[3]):NaN,Z=n[4]?parseFloat(n[4]):NaN,Z?(n=/(?:Chrome\/(\d+\.\d+))/.exec(r),H=n&&n[1]?parseFloat(n[1]):NaN):H=NaN}else S=ee=te=H=Z=NaN;if(e){if(e[1]){var o=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(r);G=o?parseFloat(o[1].replace("_",".")):!0}else G=!1;re=!!e[2],oe=!!e[3]}else G=re=oe=!1}}var se={ie:function(){return y()||S},ieCompatibilityMode:function(){return y()||_e>S},ie64:function(){return se.ie()&&xe},firefox:function(){return y()||ee},opera:function(){return y()||te},webkit:function(){return y()||Z},safari:function(){return se.webkit()},chrome:function(){return y()||H},windows:function(){return y()||re},osx:function(){return y()||G},linux:function(){return y()||oe},iphone:function(){return y()||ie},mobile:function(){return y()||ie||ae||ne||Re},nativeApp:function(){return y()||Se},android:function(){return y()||ne},ipad:function(){return y()||ae}};Ee.exports=se});var ze=O((bt,De)=>{"use strict";var k=!!(typeof window<"u"&&window.document&&window.document.createElement),Je={canUseDOM:k,canUseWorkers:typeof Worker<"u",canUseEventListeners:k&&!!(window.addEventListener||window.attachEvent),canUseViewport:k&&!!window.screen,isInWorker:!k};De.exports=Je});var Te=O((Ct,Oe)=>{"use strict";var Me=ze(),Ae;Me.canUseDOM&&(Ae=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);function $e(r,n){if(!Me.canUseDOM||n&&!("addEventListener"in document))return!1;var e="on"+r,t=e in document;if(!t){var o=document.createElement("div");o.setAttribute(e,"return;"),t=typeof o[e]=="function"}return!t&&Ae&&r==="wheel"&&(t=document.implementation.hasFeature("Events.wheel","3.0")),t}Oe.exports=$e});var Ne=O((_t,Le)=>{"use strict";var Qe=Pe(),et=Te(),je=10,Ie=40,We=800;function Fe(r){var n=0,e=0,t=0,o=0;return"detail"in r&&(e=r.detail),"wheelDelta"in r&&(e=-r.wheelDelta/120),"wheelDeltaY"in r&&(e=-r.wheelDeltaY/120),"wheelDeltaX"in r&&(n=-r.wheelDeltaX/120),"axis"in r&&r.axis===r.HORIZONTAL_AXIS&&(n=e,e=0),t=n*je,o=e*je,"deltaY"in r&&(o=r.deltaY),"deltaX"in r&&(t=r.deltaX),(t||o)&&r.deltaMode&&(r.deltaMode==1?(t*=Ie,o*=Ie):(t*=We,o*=We)),t&&!n&&(n=t<1?-1:1),o&&!e&&(e=o<1?-1:1),{spinX:n,spinY:e,pixelX:t,pixelY:o}}Fe.getEventType=function(){return Qe.firefox()?"DOMMouseScroll":et("wheel")?"wheel":"mousewheel"};Le.exports=Fe});var He=O((xt,Ze)=>{"use strict";Ze.exports=Ne()});qe();var Q=function(r,n){return Q=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},Q(r,n)};function be(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");Q(r,n);function e(){this.constructor=r}r.prototype=n===null?Object.create(n):(e.prototype=n.prototype,new e)}var g=function(){return g=Object.assign||function(n){for(var e,t=1,o=arguments.length;t<o;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},g.apply(this,arguments)};Ke();var Xe=Ye(He(),1);function tt(r,n,e,t,o,i){i===void 0&&(i=0);var s=D(r,n,i),a=s.width,c=s.height,u=Math.min(a,e),l=Math.min(c,t);return u>l*o?{width:l*o,height:l}:{width:u,height:u/o}}function rt(r){return r.width>r.height?r.width/r.naturalWidth:r.height/r.naturalHeight}function T(r,n,e,t,o){o===void 0&&(o=0);var i=D(n.width,n.height,o),s=i.width,a=i.height;return{x:Ge(r.x,s,e.width,t),y:Ge(r.y,a,e.height,t)}}function Ge(r,n,e,t){var o=n*t/2-e/2;return U(r,-o,o)}function ke(r,n){return Math.sqrt(Math.pow(r.y-n.y,2)+Math.pow(r.x-n.x,2))}function Be(r,n){return Math.atan2(n.y-r.y,n.x-r.x)*180/Math.PI}function ot(r,n,e,t,o,i,s){i===void 0&&(i=0),s===void 0&&(s=!0);var a=s?nt:it,c=D(n.width,n.height,i),u=D(n.naturalWidth,n.naturalHeight,i),l={x:a(100,((c.width-e.width/o)/2-r.x/o)/c.width*100),y:a(100,((c.height-e.height/o)/2-r.y/o)/c.height*100),width:a(100,e.width/c.width*100/o),height:a(100,e.height/c.height*100/o)},d=Math.round(a(u.width,l.width*u.width/100)),p=Math.round(a(u.height,l.height*u.height/100)),m=u.width>=u.height*t,v=m?{width:Math.round(p*t),height:p}:{width:d,height:Math.round(d/t)},w=g(g({},v),{x:Math.round(a(u.width-v.width,l.x*u.width/100)),y:Math.round(a(u.height-v.height,l.y*u.height/100))});return{croppedAreaPercentages:l,croppedAreaPixels:w}}function nt(r,n){return Math.min(r,Math.max(0,n))}function it(r,n){return n}function at(r,n,e,t,o,i){var s=D(n.width,n.height,e),a=U(t.width/s.width*(100/r.width),o,i),c={x:a*s.width/2-t.width/2-s.width*a*(r.x/100),y:a*s.height/2-t.height/2-s.height*a*(r.y/100)};return{crop:c,zoom:a}}function st(r,n,e){var t=rt(n);return e.height>e.width?e.height/(r.height*t):e.width/(r.width*t)}function ct(r,n,e,t,o,i){e===void 0&&(e=0);var s=D(n.naturalWidth,n.naturalHeight,e),a=U(st(r,n,t),o,i),c=t.height>t.width?t.height/r.height:t.width/r.width,u={x:((s.width-r.width)/2-r.x)*c,y:((s.height-r.height)/2-r.y)*c};return{crop:u,zoom:a}}function Ue(r,n){return{x:(n.x+r.x)/2,y:(n.y+r.y)/2}}function ut(r){return r*Math.PI/180}function D(r,n,e){var t=ut(e);return{width:Math.abs(Math.cos(t)*r)+Math.abs(Math.sin(t)*n),height:Math.abs(Math.sin(t)*r)+Math.abs(Math.cos(t)*n)}}function U(r,n,e){return Math.min(Math.max(r,n),e)}function B(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return r.filter(function(e){return typeof e=="string"&&e.length>0}).join(" ").trim()}var lt=`.reactEasyCrop_Container {
2
2
  position: absolute;
3
3
  top: 0;
4
4
  left: 0;
@@ -78,4 +78,4 @@ import{e as ye}from"./chunk-SKEP5WYH.js";import{A as le,Ba as de,Ca as me,Ga as
78
78
  border-left: 0;
79
79
  border-right: 0;
80
80
  }
81
- `,pt=1,ht=3,ft=1,Ve=(function(r){be(n,r);function n(){var e=r!==null&&r.apply(this,arguments)||this;return e.cropperRef=L(),e.imageRef=L(),e.videoRef=L(),e.containerPosition={x:0,y:0},e.containerRef=null,e.styleRef=null,e.containerRect=null,e.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},e.dragStartPosition={x:0,y:0},e.dragStartCrop={x:0,y:0},e.gestureZoomStart=0,e.gestureRotationStart=0,e.isTouching=!1,e.lastPinchDistance=0,e.lastPinchRotation=0,e.rafDragTimeout=null,e.rafPinchTimeout=null,e.wheelTimer=null,e.currentDoc=typeof document<"u"?document:null,e.currentWindow=typeof window<"u"?window:null,e.resizeObserver=null,e.previousCropSize=null,e.isInitialized=!1,e.state={cropSize:null,hasWheelJustStarted:!1,mediaObjectFit:void 0},e.initResizeObserver=function(){if(!(typeof window.ResizeObserver>"u"||!e.containerRef)){var t=!0;e.resizeObserver=new window.ResizeObserver(function(o){if(t){t=!1;return}e.computeSizes()}),e.resizeObserver.observe(e.containerRef)}},e.preventZoomSafari=function(t){return t.preventDefault()},e.cleanEvents=function(){e.currentDoc&&(e.currentDoc.removeEventListener("mousemove",e.onMouseMove),e.currentDoc.removeEventListener("mouseup",e.onDragStopped),e.currentDoc.removeEventListener("touchmove",e.onTouchMove),e.currentDoc.removeEventListener("touchend",e.onDragStopped),e.currentDoc.removeEventListener("gesturechange",e.onGestureChange),e.currentDoc.removeEventListener("gestureend",e.onGestureEnd),e.currentDoc.removeEventListener("scroll",e.onScroll))},e.clearScrollEvent=function(){e.containerRef&&e.containerRef.removeEventListener("wheel",e.onWheel),e.wheelTimer&&clearTimeout(e.wheelTimer)},e.onMediaLoad=function(){var t=e.computeSizes();t&&(e.previousCropSize=t,e.emitCropData(),e.setInitialCrop(t),e.isInitialized=!0),e.props.onMediaLoaded&&e.props.onMediaLoaded(e.mediaSize)},e.setInitialCrop=function(t){if(e.props.initialCroppedAreaPercentages){var o=at(e.props.initialCroppedAreaPercentages,e.mediaSize,e.props.rotation,t,e.props.minZoom,e.props.maxZoom),i=o.crop,s=o.zoom;e.props.onCropChange(i),e.props.onZoomChange&&e.props.onZoomChange(s)}else if(e.props.initialCroppedAreaPixels){var a=ct(e.props.initialCroppedAreaPixels,e.mediaSize,e.props.rotation,t,e.props.minZoom,e.props.maxZoom),i=a.crop,s=a.zoom;e.props.onCropChange(i),e.props.onZoomChange&&e.props.onZoomChange(s)}},e.computeSizes=function(){var t,o,i,s,a,c,u=e.imageRef.current||e.videoRef.current;if(u&&e.containerRef){e.containerRect=e.containerRef.getBoundingClientRect(),e.saveContainerPosition();var l=e.containerRect.width/e.containerRect.height,d=((t=e.imageRef.current)===null||t===void 0?void 0:t.naturalWidth)||((o=e.videoRef.current)===null||o===void 0?void 0:o.videoWidth)||0,p=((i=e.imageRef.current)===null||i===void 0?void 0:i.naturalHeight)||((s=e.videoRef.current)===null||s===void 0?void 0:s.videoHeight)||0,m=u.offsetWidth<d||u.offsetHeight<p,v=d/p,w=void 0;if(m)switch(e.state.mediaObjectFit){default:case"contain":w=l>v?{width:e.containerRect.height*v,height:e.containerRect.height}:{width:e.containerRect.width,height:e.containerRect.width/v};break;case"horizontal-cover":w={width:e.containerRect.width,height:e.containerRect.width/v};break;case"vertical-cover":w={width:e.containerRect.height*v,height:e.containerRect.height};break}else w={width:u.offsetWidth,height:u.offsetHeight};e.mediaSize=g(g({},w),{naturalWidth:d,naturalHeight:p}),e.props.setMediaSize&&e.props.setMediaSize(e.mediaSize);var b=e.props.cropSize?e.props.cropSize:tt(e.mediaSize.width,e.mediaSize.height,e.containerRect.width,e.containerRect.height,e.props.aspect,e.props.rotation);return(((a=e.state.cropSize)===null||a===void 0?void 0:a.height)!==b.height||((c=e.state.cropSize)===null||c===void 0?void 0:c.width)!==b.width)&&e.props.onCropSizeChange&&e.props.onCropSizeChange(b),e.setState({cropSize:b},e.recomputeCropPosition),e.props.setCropSize&&e.props.setCropSize(b),b}},e.saveContainerPosition=function(){if(e.containerRef){var t=e.containerRef.getBoundingClientRect();e.containerPosition={x:t.left,y:t.top}}},e.onMouseDown=function(t){e.currentDoc&&(t.preventDefault(),e.currentDoc.addEventListener("mousemove",e.onMouseMove),e.currentDoc.addEventListener("mouseup",e.onDragStopped),e.saveContainerPosition(),e.onDragStart(n.getMousePoint(t)))},e.onMouseMove=function(t){return e.onDrag(n.getMousePoint(t))},e.onScroll=function(t){e.currentDoc&&(t.preventDefault(),e.saveContainerPosition())},e.onTouchStart=function(t){e.currentDoc&&(e.isTouching=!0,!(e.props.onTouchRequest&&!e.props.onTouchRequest(t))&&(e.currentDoc.addEventListener("touchmove",e.onTouchMove,{passive:!1}),e.currentDoc.addEventListener("touchend",e.onDragStopped),e.saveContainerPosition(),t.touches.length===2?e.onPinchStart(t):t.touches.length===1&&e.onDragStart(n.getTouchPoint(t.touches[0]))))},e.onTouchMove=function(t){t.preventDefault(),t.touches.length===2?e.onPinchMove(t):t.touches.length===1&&e.onDrag(n.getTouchPoint(t.touches[0]))},e.onGestureStart=function(t){e.currentDoc&&(t.preventDefault(),e.currentDoc.addEventListener("gesturechange",e.onGestureChange),e.currentDoc.addEventListener("gestureend",e.onGestureEnd),e.gestureZoomStart=e.props.zoom,e.gestureRotationStart=e.props.rotation)},e.onGestureChange=function(t){if(t.preventDefault(),!e.isTouching){var o=n.getMousePoint(t),i=e.gestureZoomStart-1+t.scale;if(e.setNewZoom(i,o,{shouldUpdatePosition:!0}),e.props.onRotationChange){var s=e.gestureRotationStart+t.rotation;e.props.onRotationChange(s)}}},e.onGestureEnd=function(t){e.cleanEvents()},e.onDragStart=function(t){var o,i,s=t.x,a=t.y;e.dragStartPosition={x:s,y:a},e.dragStartCrop=g({},e.props.crop),(i=(o=e.props).onInteractionStart)===null||i===void 0||i.call(o)},e.onDrag=function(t){var o=t.x,i=t.y;e.currentWindow&&(e.rafDragTimeout&&e.currentWindow.cancelAnimationFrame(e.rafDragTimeout),e.rafDragTimeout=e.currentWindow.requestAnimationFrame(function(){if(e.state.cropSize&&!(o===void 0||i===void 0)){var s=o-e.dragStartPosition.x,a=i-e.dragStartPosition.y,c={x:e.dragStartCrop.x+s,y:e.dragStartCrop.y+a},u=e.props.restrictPosition?T(c,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):c;e.props.onCropChange(u)}}))},e.onDragStopped=function(){var t,o;e.isTouching=!1,e.cleanEvents(),e.emitCropData(),(o=(t=e.props).onInteractionEnd)===null||o===void 0||o.call(t)},e.onWheel=function(t){if(e.currentWindow&&!(e.props.onWheelRequest&&!e.props.onWheelRequest(t))){t.preventDefault();var o=n.getMousePoint(t),i=(0,Xe.default)(t).pixelY,s=e.props.zoom-i*e.props.zoomSpeed/200;e.setNewZoom(s,o,{shouldUpdatePosition:!0}),e.state.hasWheelJustStarted||e.setState({hasWheelJustStarted:!0},function(){var a,c;return(c=(a=e.props).onInteractionStart)===null||c===void 0?void 0:c.call(a)}),e.wheelTimer&&clearTimeout(e.wheelTimer),e.wheelTimer=e.currentWindow.setTimeout(function(){return e.setState({hasWheelJustStarted:!1},function(){var a,c;return(c=(a=e.props).onInteractionEnd)===null||c===void 0?void 0:c.call(a)})},250)}},e.getPointOnContainer=function(t,o){var i=t.x,s=t.y;if(!e.containerRect)throw new Error("The Cropper is not mounted");return{x:e.containerRect.width/2-(i-o.x),y:e.containerRect.height/2-(s-o.y)}},e.getPointOnMedia=function(t){var o=t.x,i=t.y,s=e.props,a=s.crop,c=s.zoom;return{x:(o+a.x)/c,y:(i+a.y)/c}},e.setNewZoom=function(t,o,i){var s=i===void 0?{}:i,a=s.shouldUpdatePosition,c=a===void 0?!0:a;if(!(!e.state.cropSize||!e.props.onZoomChange)){var u=U(t,e.props.minZoom,e.props.maxZoom);if(c){var l=e.getPointOnContainer(o,e.containerPosition),d=e.getPointOnMedia(l),p={x:d.x*u-l.x,y:d.y*u-l.y},m=e.props.restrictPosition?T(p,e.mediaSize,e.state.cropSize,u,e.props.rotation):p;e.props.onCropChange(m)}e.props.onZoomChange(u)}},e.getCropData=function(){if(!e.state.cropSize)return null;var t=e.props.restrictPosition?T(e.props.crop,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):e.props.crop;return ot(t,e.mediaSize,e.state.cropSize,e.getAspect(),e.props.zoom,e.props.rotation,e.props.restrictPosition)},e.emitCropData=function(){var t=e.getCropData();if(t){var o=t.croppedAreaPercentages,i=t.croppedAreaPixels;e.props.onCropComplete&&e.props.onCropComplete(o,i),e.props.onCropAreaChange&&e.props.onCropAreaChange(o,i)}},e.emitCropAreaChange=function(){var t=e.getCropData();if(t){var o=t.croppedAreaPercentages,i=t.croppedAreaPixels;e.props.onCropAreaChange&&e.props.onCropAreaChange(o,i)}},e.recomputeCropPosition=function(){var t,o;if(e.state.cropSize){var i=e.props.crop;if(e.isInitialized&&(!((t=e.previousCropSize)===null||t===void 0)&&t.width)&&(!((o=e.previousCropSize)===null||o===void 0)&&o.height)){var s=Math.abs(e.previousCropSize.width-e.state.cropSize.width)>1e-6||Math.abs(e.previousCropSize.height-e.state.cropSize.height)>1e-6;if(s){var a=e.state.cropSize.width/e.previousCropSize.width,c=e.state.cropSize.height/e.previousCropSize.height;i={x:e.props.crop.x*a,y:e.props.crop.y*c}}}var u=e.props.restrictPosition?T(i,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):i;e.previousCropSize=e.state.cropSize,e.props.onCropChange(u),e.emitCropData()}},e.onKeyDown=function(t){var o,i,s=e.props,a=s.crop,c=s.onCropChange,u=s.keyboardStep,l=s.zoom,d=s.rotation,p=u;if(e.state.cropSize){t.shiftKey&&(p*=.2);var m=g({},a);switch(t.key){case"ArrowUp":m.y-=p,t.preventDefault();break;case"ArrowDown":m.y+=p,t.preventDefault();break;case"ArrowLeft":m.x-=p,t.preventDefault();break;case"ArrowRight":m.x+=p,t.preventDefault();break;default:return}e.props.restrictPosition&&(m=T(m,e.mediaSize,e.state.cropSize,l,d)),t.repeat||(i=(o=e.props).onInteractionStart)===null||i===void 0||i.call(o),c(m)}},e.onKeyUp=function(t){var o,i;switch(t.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":t.preventDefault();break;default:return}e.emitCropData(),(i=(o=e.props).onInteractionEnd)===null||i===void 0||i.call(o)},e}return n.prototype.componentDidMount=function(){!this.currentDoc||!this.currentWindow||(this.containerRef&&(this.containerRef.ownerDocument&&(this.currentDoc=this.containerRef.ownerDocument),this.currentDoc.defaultView&&(this.currentWindow=this.currentDoc.defaultView),this.initResizeObserver(),typeof window.ResizeObserver>"u"&&this.currentWindow.addEventListener("resize",this.computeSizes),this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.onGestureStart)),this.currentDoc.addEventListener("scroll",this.onScroll),this.props.disableAutomaticStylesInjection||(this.styleRef=this.currentDoc.createElement("style"),this.styleRef.setAttribute("type","text/css"),this.props.nonce&&this.styleRef.setAttribute("nonce",this.props.nonce),this.styleRef.innerHTML=lt,this.currentDoc.head.appendChild(this.styleRef)),this.imageRef.current&&this.imageRef.current.complete&&this.onMediaLoad(),this.props.setImageRef&&this.props.setImageRef(this.imageRef),this.props.setVideoRef&&this.props.setVideoRef(this.videoRef),this.props.setCropperRef&&this.props.setCropperRef(this.cropperRef))},n.prototype.componentWillUnmount=function(){var e,t;!this.currentDoc||!this.currentWindow||(typeof window.ResizeObserver>"u"&&this.currentWindow.removeEventListener("resize",this.computeSizes),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),this.containerRef&&this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.styleRef&&((t=this.styleRef.parentNode)===null||t===void 0||t.removeChild(this.styleRef)),this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent())},n.prototype.componentDidUpdate=function(e){var t,o,i,s,a,c,u,l,d;e.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):e.aspect!==this.props.aspect?this.computeSizes():e.objectFit!==this.props.objectFit?this.computeSizes():e.zoom!==this.props.zoom?this.recomputeCropPosition():((t=e.cropSize)===null||t===void 0?void 0:t.height)!==((o=this.props.cropSize)===null||o===void 0?void 0:o.height)||((i=e.cropSize)===null||i===void 0?void 0:i.width)!==((s=this.props.cropSize)===null||s===void 0?void 0:s.width)?this.computeSizes():(((a=e.crop)===null||a===void 0?void 0:a.x)!==((c=this.props.crop)===null||c===void 0?void 0:c.x)||((u=e.crop)===null||u===void 0?void 0:u.y)!==((l=this.props.crop)===null||l===void 0?void 0:l.y))&&this.emitCropAreaChange(),e.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent()),e.video!==this.props.video&&((d=this.videoRef.current)===null||d===void 0||d.load());var p=this.getObjectFit();p!==this.state.mediaObjectFit&&this.setState({mediaObjectFit:p},this.computeSizes)},n.prototype.getAspect=function(){var e=this.props,t=e.cropSize,o=e.aspect;return t?t.width/t.height:o},n.prototype.getObjectFit=function(){var e,t,o,i;if(this.props.objectFit==="cover"){var s=this.imageRef.current||this.videoRef.current;if(s&&this.containerRef){this.containerRect=this.containerRef.getBoundingClientRect();var a=this.containerRect.width/this.containerRect.height,c=((e=this.imageRef.current)===null||e===void 0?void 0:e.naturalWidth)||((t=this.videoRef.current)===null||t===void 0?void 0:t.videoWidth)||0,u=((o=this.imageRef.current)===null||o===void 0?void 0:o.naturalHeight)||((i=this.videoRef.current)===null||i===void 0?void 0:i.videoHeight)||0,l=c/u;return l<a?"horizontal-cover":"vertical-cover"}return"horizontal-cover"}return this.props.objectFit},n.prototype.onPinchStart=function(e){var t=n.getTouchPoint(e.touches[0]),o=n.getTouchPoint(e.touches[1]);this.lastPinchDistance=ke(t,o),this.lastPinchRotation=Be(t,o),this.onDragStart(Ue(t,o))},n.prototype.onPinchMove=function(e){var t=this;if(!(!this.currentDoc||!this.currentWindow)){var o=n.getTouchPoint(e.touches[0]),i=n.getTouchPoint(e.touches[1]),s=Ue(o,i);this.onDrag(s),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame(function(){var a=ke(o,i),c=t.props.zoom*(a/t.lastPinchDistance);t.setNewZoom(c,s,{shouldUpdatePosition:!1}),t.lastPinchDistance=a;var u=Be(o,i),l=t.props.rotation+(u-t.lastPinchRotation);t.props.onRotationChange&&t.props.onRotationChange(l),t.lastPinchRotation=u})}},n.prototype.render=function(){var e=this,t,o=this.props,i=o.image,s=o.video,a=o.mediaProps,c=o.cropperProps,u=o.transform,l=o.crop,d=l.x,p=l.y,m=o.rotation,v=o.zoom,w=o.cropShape,b=o.showGrid,R=o.roundCropAreaPixels,z=o.style,I=z.containerStyle,W=z.cropAreaStyle,j=z.mediaStyle,M=o.classes,X=M.containerClassName,V=M.cropAreaClassName,F=M.mediaClassName,_=(t=this.state.mediaObjectFit)!==null&&t!==void 0?t:this.getObjectFit();return E("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:function(f){return e.containerRef=f},"data-testid":"container",style:I,className:B("reactEasyCrop_Container",X)},i?E("img",g({alt:"",className:B("reactEasyCrop_Image",_==="contain"&&"reactEasyCrop_Contain",_==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",_==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",F)},a,{src:i,ref:this.imageRef,style:g(g({},j),{transform:u||"translate(".concat(d,"px, ").concat(p,"px) rotate(").concat(m,"deg) scale(").concat(v,")")}),onLoad:this.onMediaLoad})):s&&E("video",g({autoPlay:!0,playsInline:!0,loop:!0,muted:!0,className:B("reactEasyCrop_Video",_==="contain"&&"reactEasyCrop_Contain",_==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",_==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",F)},a,{ref:this.videoRef,onLoadedMetadata:this.onMediaLoad,style:g(g({},j),{transform:u||"translate(".concat(d,"px, ").concat(p,"px) rotate(").concat(m,"deg) scale(").concat(v,")")}),controls:!1}),(Array.isArray(s)?s:[{src:s}]).map(function(A){return E("source",g({key:A.src},A))})),this.state.cropSize&&E("div",g({ref:this.cropperRef,style:g(g({},W),{width:R?Math.round(this.state.cropSize.width):this.state.cropSize.width,height:R?Math.round(this.state.cropSize.height):this.state.cropSize.height}),tabIndex:0,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,"data-testid":"cropper",className:B("reactEasyCrop_CropArea",w==="round"&&"reactEasyCrop_CropAreaRound",b&&"reactEasyCrop_CropAreaGrid",V)},c)))},n.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:ht,minZoom:pt,cropShape:"rect",objectFit:"contain",showGrid:!0,style:{},classes:{},mediaProps:{},cropperProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0,keyboardStep:ft},n.getMousePoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},n.getTouchPoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},n})(ce);var dt=Ve;function Wt(r){let n=le(),[e,t]=C(r.src),[o,i]=C({x:0,y:0}),[s,a]=C(1),[c,u]=C(null),[l,d]=C(!1),[p,m]=C(r.initialWidth||0),[v,w]=C(r.initialHeight||0),b=ue(()=>e.startsWith(ye)?e.includes("=")?e.split("=")[0]+"=s0":e+"=s0":e,[e]),R=r.filename?mt(r.filename):"jpg",z=R==="png"?"image/png":"image/jpeg",I=R==="jpg"||R==="jpeg"||r.src.toLowerCase().endsWith(".jpg")||r.src.toLowerCase().endsWith(".jpeg"),[W,j]=C("#ffffff");Y(()=>{t(r.src)},[r.src]),Y(()=>{r.initialWidth&&m(r.initialWidth),r.initialHeight&&w(r.initialHeight)},[r.initialWidth,r.initialHeight]);let M=q((f,S)=>{u(S)},[]),X=q(f=>{m(S=>S>0?S:f.naturalWidth),w(S=>S>0?S:f.naturalHeight)},[]),V=async()=>{if(c){d(!0);try{let f=await gt(b,c,{width:p||800,height:v||600},r.filename,z,I?W:void 0);f&&r.onSave(f)}catch(f){console.error(f)}finally{d(!1)}}},F=()=>{i(f=>({...f,x:0}))},_=()=>{i(f=>({...f,y:0}))},A=()=>{r.originalSrc&&(t(r.originalSrc),m(0),w(0),i({x:0,y:0}),a(1))};return h(fe,{opened:r.opened,onClose:r.onClose,title:"Edit Image",size:"xl",centered:!0,overlayColor:n.colorScheme==="dark"?n.colors.dark[9]:n.colors.gray[2],children:h(me,{spacing:"md",children:[h(P,{grow:!0,children:[h(J,{label:"Width",value:p||void 0,placeholder:"Width",onChange:f=>m(typeof f=="number"?f:0)}),h(J,{label:"Height",value:v||void 0,placeholder:"Height",onChange:f=>w(typeof f=="number"?f:0)}),I&&h(he,{label:"Background Color",value:W,onChange:j})]}),h("div",{className:"ImageEditorDialog__CropperContainer",children:h(dt,{image:b,crop:o,zoom:s,aspect:p&&v?p/v:void 0,minZoom:.1,restrictPosition:!1,onCropChange:i,onCropComplete:M,onZoomChange:a,onMediaLoaded:X})}),h(P,{children:[h(pe,{size:"sm",children:"Zoom"}),h(de,{className:"ImageEditorDialog__ZoomSlider",value:(s-1)*100,min:-100,max:200,step:1,label:f=>`${Math.round(f)}%`,onChange:f=>a(1+f/100)}),h(P,{spacing:"xs",children:[h($,{label:"Center horizontally",withArrow:!0,children:h(K,{variant:"default",onClick:F,size:"lg",children:h(ge,{size:20})})}),h($,{label:"Center vertically",withArrow:!0,children:h(K,{variant:"default",onClick:_,size:"lg",children:h(ve,{size:20})})})]})]}),h(P,{position:r.originalSrc&&e!==r.originalSrc?"apart":"right",mt:"md",children:[r.originalSrc&&e!==r.originalSrc&&h(N,{variant:"default",onClick:A,disabled:l,children:"Restore Original"}),h(P,{children:[h(N,{variant:"default",onClick:r.onClose,disabled:l,children:"Discard"}),h(N,{onClick:V,loading:l,leftIcon:h(we,{}),children:"Save"})]})]})]})})}function mt(r){return r.split(".").pop()?.toLowerCase()||""}async function gt(r,n,e,t="image.jpg",o="image/jpeg",i){let s=await vt(r),a=document.createElement("canvas"),c=a.getContext("2d");return c?(a.width=e.width,a.height=e.height,i&&(c.fillStyle=i,c.fillRect(0,0,a.width,a.height)),c.drawImage(s,n.x,n.y,n.width,n.height,0,0,e.width,e.height),new Promise(u=>{a.toBlob(l=>{if(!l){u(null);return}let d=new File([l],t,{type:o});u(d)},o)})):null}function vt(r){return new Promise((n,e)=>{let t=new Image;t.addEventListener("load",()=>n(t)),t.addEventListener("error",o=>e(o)),t.setAttribute("crossOrigin","anonymous"),t.src=r})}export{Wt as ImageEditorDialog};
81
+ `,pt=1,ht=3,ft=1,Ve=(function(r){be(n,r);function n(){var e=r!==null&&r.apply(this,arguments)||this;return e.cropperRef=L(),e.imageRef=L(),e.videoRef=L(),e.containerPosition={x:0,y:0},e.containerRef=null,e.styleRef=null,e.containerRect=null,e.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},e.dragStartPosition={x:0,y:0},e.dragStartCrop={x:0,y:0},e.gestureZoomStart=0,e.gestureRotationStart=0,e.isTouching=!1,e.lastPinchDistance=0,e.lastPinchRotation=0,e.rafDragTimeout=null,e.rafPinchTimeout=null,e.wheelTimer=null,e.currentDoc=typeof document<"u"?document:null,e.currentWindow=typeof window<"u"?window:null,e.resizeObserver=null,e.previousCropSize=null,e.isInitialized=!1,e.state={cropSize:null,hasWheelJustStarted:!1,mediaObjectFit:void 0},e.initResizeObserver=function(){if(!(typeof window.ResizeObserver>"u"||!e.containerRef)){var t=!0;e.resizeObserver=new window.ResizeObserver(function(o){if(t){t=!1;return}e.computeSizes()}),e.resizeObserver.observe(e.containerRef)}},e.preventZoomSafari=function(t){return t.preventDefault()},e.cleanEvents=function(){e.currentDoc&&(e.currentDoc.removeEventListener("mousemove",e.onMouseMove),e.currentDoc.removeEventListener("mouseup",e.onDragStopped),e.currentDoc.removeEventListener("touchmove",e.onTouchMove),e.currentDoc.removeEventListener("touchend",e.onDragStopped),e.currentDoc.removeEventListener("gesturechange",e.onGestureChange),e.currentDoc.removeEventListener("gestureend",e.onGestureEnd),e.currentDoc.removeEventListener("scroll",e.onScroll))},e.clearScrollEvent=function(){e.containerRef&&e.containerRef.removeEventListener("wheel",e.onWheel),e.wheelTimer&&clearTimeout(e.wheelTimer)},e.onMediaLoad=function(){var t=e.computeSizes();t&&(e.previousCropSize=t,e.emitCropData(),e.setInitialCrop(t),e.isInitialized=!0),e.props.onMediaLoaded&&e.props.onMediaLoaded(e.mediaSize)},e.setInitialCrop=function(t){if(e.props.initialCroppedAreaPercentages){var o=at(e.props.initialCroppedAreaPercentages,e.mediaSize,e.props.rotation,t,e.props.minZoom,e.props.maxZoom),i=o.crop,s=o.zoom;e.props.onCropChange(i),e.props.onZoomChange&&e.props.onZoomChange(s)}else if(e.props.initialCroppedAreaPixels){var a=ct(e.props.initialCroppedAreaPixels,e.mediaSize,e.props.rotation,t,e.props.minZoom,e.props.maxZoom),i=a.crop,s=a.zoom;e.props.onCropChange(i),e.props.onZoomChange&&e.props.onZoomChange(s)}},e.computeSizes=function(){var t,o,i,s,a,c,u=e.imageRef.current||e.videoRef.current;if(u&&e.containerRef){e.containerRect=e.containerRef.getBoundingClientRect(),e.saveContainerPosition();var l=e.containerRect.width/e.containerRect.height,d=((t=e.imageRef.current)===null||t===void 0?void 0:t.naturalWidth)||((o=e.videoRef.current)===null||o===void 0?void 0:o.videoWidth)||0,p=((i=e.imageRef.current)===null||i===void 0?void 0:i.naturalHeight)||((s=e.videoRef.current)===null||s===void 0?void 0:s.videoHeight)||0,m=u.offsetWidth<d||u.offsetHeight<p,v=d/p,w=void 0;if(m)switch(e.state.mediaObjectFit){default:case"contain":w=l>v?{width:e.containerRect.height*v,height:e.containerRect.height}:{width:e.containerRect.width,height:e.containerRect.width/v};break;case"horizontal-cover":w={width:e.containerRect.width,height:e.containerRect.width/v};break;case"vertical-cover":w={width:e.containerRect.height*v,height:e.containerRect.height};break}else w={width:u.offsetWidth,height:u.offsetHeight};e.mediaSize=g(g({},w),{naturalWidth:d,naturalHeight:p}),e.props.setMediaSize&&e.props.setMediaSize(e.mediaSize);var b=e.props.cropSize?e.props.cropSize:tt(e.mediaSize.width,e.mediaSize.height,e.containerRect.width,e.containerRect.height,e.props.aspect,e.props.rotation);return(((a=e.state.cropSize)===null||a===void 0?void 0:a.height)!==b.height||((c=e.state.cropSize)===null||c===void 0?void 0:c.width)!==b.width)&&e.props.onCropSizeChange&&e.props.onCropSizeChange(b),e.setState({cropSize:b},e.recomputeCropPosition),e.props.setCropSize&&e.props.setCropSize(b),b}},e.saveContainerPosition=function(){if(e.containerRef){var t=e.containerRef.getBoundingClientRect();e.containerPosition={x:t.left,y:t.top}}},e.onMouseDown=function(t){e.currentDoc&&(t.preventDefault(),e.currentDoc.addEventListener("mousemove",e.onMouseMove),e.currentDoc.addEventListener("mouseup",e.onDragStopped),e.saveContainerPosition(),e.onDragStart(n.getMousePoint(t)))},e.onMouseMove=function(t){return e.onDrag(n.getMousePoint(t))},e.onScroll=function(t){e.currentDoc&&(t.preventDefault(),e.saveContainerPosition())},e.onTouchStart=function(t){e.currentDoc&&(e.isTouching=!0,!(e.props.onTouchRequest&&!e.props.onTouchRequest(t))&&(e.currentDoc.addEventListener("touchmove",e.onTouchMove,{passive:!1}),e.currentDoc.addEventListener("touchend",e.onDragStopped),e.saveContainerPosition(),t.touches.length===2?e.onPinchStart(t):t.touches.length===1&&e.onDragStart(n.getTouchPoint(t.touches[0]))))},e.onTouchMove=function(t){t.preventDefault(),t.touches.length===2?e.onPinchMove(t):t.touches.length===1&&e.onDrag(n.getTouchPoint(t.touches[0]))},e.onGestureStart=function(t){e.currentDoc&&(t.preventDefault(),e.currentDoc.addEventListener("gesturechange",e.onGestureChange),e.currentDoc.addEventListener("gestureend",e.onGestureEnd),e.gestureZoomStart=e.props.zoom,e.gestureRotationStart=e.props.rotation)},e.onGestureChange=function(t){if(t.preventDefault(),!e.isTouching){var o=n.getMousePoint(t),i=e.gestureZoomStart-1+t.scale;if(e.setNewZoom(i,o,{shouldUpdatePosition:!0}),e.props.onRotationChange){var s=e.gestureRotationStart+t.rotation;e.props.onRotationChange(s)}}},e.onGestureEnd=function(t){e.cleanEvents()},e.onDragStart=function(t){var o,i,s=t.x,a=t.y;e.dragStartPosition={x:s,y:a},e.dragStartCrop=g({},e.props.crop),(i=(o=e.props).onInteractionStart)===null||i===void 0||i.call(o)},e.onDrag=function(t){var o=t.x,i=t.y;e.currentWindow&&(e.rafDragTimeout&&e.currentWindow.cancelAnimationFrame(e.rafDragTimeout),e.rafDragTimeout=e.currentWindow.requestAnimationFrame(function(){if(e.state.cropSize&&!(o===void 0||i===void 0)){var s=o-e.dragStartPosition.x,a=i-e.dragStartPosition.y,c={x:e.dragStartCrop.x+s,y:e.dragStartCrop.y+a},u=e.props.restrictPosition?T(c,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):c;e.props.onCropChange(u)}}))},e.onDragStopped=function(){var t,o;e.isTouching=!1,e.cleanEvents(),e.emitCropData(),(o=(t=e.props).onInteractionEnd)===null||o===void 0||o.call(t)},e.onWheel=function(t){if(e.currentWindow&&!(e.props.onWheelRequest&&!e.props.onWheelRequest(t))){t.preventDefault();var o=n.getMousePoint(t),i=(0,Xe.default)(t).pixelY,s=e.props.zoom-i*e.props.zoomSpeed/200;e.setNewZoom(s,o,{shouldUpdatePosition:!0}),e.state.hasWheelJustStarted||e.setState({hasWheelJustStarted:!0},function(){var a,c;return(c=(a=e.props).onInteractionStart)===null||c===void 0?void 0:c.call(a)}),e.wheelTimer&&clearTimeout(e.wheelTimer),e.wheelTimer=e.currentWindow.setTimeout(function(){return e.setState({hasWheelJustStarted:!1},function(){var a,c;return(c=(a=e.props).onInteractionEnd)===null||c===void 0?void 0:c.call(a)})},250)}},e.getPointOnContainer=function(t,o){var i=t.x,s=t.y;if(!e.containerRect)throw new Error("The Cropper is not mounted");return{x:e.containerRect.width/2-(i-o.x),y:e.containerRect.height/2-(s-o.y)}},e.getPointOnMedia=function(t){var o=t.x,i=t.y,s=e.props,a=s.crop,c=s.zoom;return{x:(o+a.x)/c,y:(i+a.y)/c}},e.setNewZoom=function(t,o,i){var s=i===void 0?{}:i,a=s.shouldUpdatePosition,c=a===void 0?!0:a;if(!(!e.state.cropSize||!e.props.onZoomChange)){var u=U(t,e.props.minZoom,e.props.maxZoom);if(c){var l=e.getPointOnContainer(o,e.containerPosition),d=e.getPointOnMedia(l),p={x:d.x*u-l.x,y:d.y*u-l.y},m=e.props.restrictPosition?T(p,e.mediaSize,e.state.cropSize,u,e.props.rotation):p;e.props.onCropChange(m)}e.props.onZoomChange(u)}},e.getCropData=function(){if(!e.state.cropSize)return null;var t=e.props.restrictPosition?T(e.props.crop,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):e.props.crop;return ot(t,e.mediaSize,e.state.cropSize,e.getAspect(),e.props.zoom,e.props.rotation,e.props.restrictPosition)},e.emitCropData=function(){var t=e.getCropData();if(t){var o=t.croppedAreaPercentages,i=t.croppedAreaPixels;e.props.onCropComplete&&e.props.onCropComplete(o,i),e.props.onCropAreaChange&&e.props.onCropAreaChange(o,i)}},e.emitCropAreaChange=function(){var t=e.getCropData();if(t){var o=t.croppedAreaPercentages,i=t.croppedAreaPixels;e.props.onCropAreaChange&&e.props.onCropAreaChange(o,i)}},e.recomputeCropPosition=function(){var t,o;if(e.state.cropSize){var i=e.props.crop;if(e.isInitialized&&(!((t=e.previousCropSize)===null||t===void 0)&&t.width)&&(!((o=e.previousCropSize)===null||o===void 0)&&o.height)){var s=Math.abs(e.previousCropSize.width-e.state.cropSize.width)>1e-6||Math.abs(e.previousCropSize.height-e.state.cropSize.height)>1e-6;if(s){var a=e.state.cropSize.width/e.previousCropSize.width,c=e.state.cropSize.height/e.previousCropSize.height;i={x:e.props.crop.x*a,y:e.props.crop.y*c}}}var u=e.props.restrictPosition?T(i,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):i;e.previousCropSize=e.state.cropSize,e.props.onCropChange(u),e.emitCropData()}},e.onKeyDown=function(t){var o,i,s=e.props,a=s.crop,c=s.onCropChange,u=s.keyboardStep,l=s.zoom,d=s.rotation,p=u;if(e.state.cropSize){t.shiftKey&&(p*=.2);var m=g({},a);switch(t.key){case"ArrowUp":m.y-=p,t.preventDefault();break;case"ArrowDown":m.y+=p,t.preventDefault();break;case"ArrowLeft":m.x-=p,t.preventDefault();break;case"ArrowRight":m.x+=p,t.preventDefault();break;default:return}e.props.restrictPosition&&(m=T(m,e.mediaSize,e.state.cropSize,l,d)),t.repeat||(i=(o=e.props).onInteractionStart)===null||i===void 0||i.call(o),c(m)}},e.onKeyUp=function(t){var o,i;switch(t.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":t.preventDefault();break;default:return}e.emitCropData(),(i=(o=e.props).onInteractionEnd)===null||i===void 0||i.call(o)},e}return n.prototype.componentDidMount=function(){!this.currentDoc||!this.currentWindow||(this.containerRef&&(this.containerRef.ownerDocument&&(this.currentDoc=this.containerRef.ownerDocument),this.currentDoc.defaultView&&(this.currentWindow=this.currentDoc.defaultView),this.initResizeObserver(),typeof window.ResizeObserver>"u"&&this.currentWindow.addEventListener("resize",this.computeSizes),this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.onGestureStart)),this.currentDoc.addEventListener("scroll",this.onScroll),this.props.disableAutomaticStylesInjection||(this.styleRef=this.currentDoc.createElement("style"),this.styleRef.setAttribute("type","text/css"),this.props.nonce&&this.styleRef.setAttribute("nonce",this.props.nonce),this.styleRef.innerHTML=lt,this.currentDoc.head.appendChild(this.styleRef)),this.imageRef.current&&this.imageRef.current.complete&&this.onMediaLoad(),this.props.setImageRef&&this.props.setImageRef(this.imageRef),this.props.setVideoRef&&this.props.setVideoRef(this.videoRef),this.props.setCropperRef&&this.props.setCropperRef(this.cropperRef))},n.prototype.componentWillUnmount=function(){var e,t;!this.currentDoc||!this.currentWindow||(typeof window.ResizeObserver>"u"&&this.currentWindow.removeEventListener("resize",this.computeSizes),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),this.containerRef&&this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.styleRef&&((t=this.styleRef.parentNode)===null||t===void 0||t.removeChild(this.styleRef)),this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent())},n.prototype.componentDidUpdate=function(e){var t,o,i,s,a,c,u,l,d;e.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):e.aspect!==this.props.aspect?this.computeSizes():e.objectFit!==this.props.objectFit?this.computeSizes():e.zoom!==this.props.zoom?this.recomputeCropPosition():((t=e.cropSize)===null||t===void 0?void 0:t.height)!==((o=this.props.cropSize)===null||o===void 0?void 0:o.height)||((i=e.cropSize)===null||i===void 0?void 0:i.width)!==((s=this.props.cropSize)===null||s===void 0?void 0:s.width)?this.computeSizes():(((a=e.crop)===null||a===void 0?void 0:a.x)!==((c=this.props.crop)===null||c===void 0?void 0:c.x)||((u=e.crop)===null||u===void 0?void 0:u.y)!==((l=this.props.crop)===null||l===void 0?void 0:l.y))&&this.emitCropAreaChange(),e.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent()),e.video!==this.props.video&&((d=this.videoRef.current)===null||d===void 0||d.load());var p=this.getObjectFit();p!==this.state.mediaObjectFit&&this.setState({mediaObjectFit:p},this.computeSizes)},n.prototype.getAspect=function(){var e=this.props,t=e.cropSize,o=e.aspect;return t?t.width/t.height:o},n.prototype.getObjectFit=function(){var e,t,o,i;if(this.props.objectFit==="cover"){var s=this.imageRef.current||this.videoRef.current;if(s&&this.containerRef){this.containerRect=this.containerRef.getBoundingClientRect();var a=this.containerRect.width/this.containerRect.height,c=((e=this.imageRef.current)===null||e===void 0?void 0:e.naturalWidth)||((t=this.videoRef.current)===null||t===void 0?void 0:t.videoWidth)||0,u=((o=this.imageRef.current)===null||o===void 0?void 0:o.naturalHeight)||((i=this.videoRef.current)===null||i===void 0?void 0:i.videoHeight)||0,l=c/u;return l<a?"horizontal-cover":"vertical-cover"}return"horizontal-cover"}return this.props.objectFit},n.prototype.onPinchStart=function(e){var t=n.getTouchPoint(e.touches[0]),o=n.getTouchPoint(e.touches[1]);this.lastPinchDistance=ke(t,o),this.lastPinchRotation=Be(t,o),this.onDragStart(Ue(t,o))},n.prototype.onPinchMove=function(e){var t=this;if(!(!this.currentDoc||!this.currentWindow)){var o=n.getTouchPoint(e.touches[0]),i=n.getTouchPoint(e.touches[1]),s=Ue(o,i);this.onDrag(s),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame(function(){var a=ke(o,i),c=t.props.zoom*(a/t.lastPinchDistance);t.setNewZoom(c,s,{shouldUpdatePosition:!1}),t.lastPinchDistance=a;var u=Be(o,i),l=t.props.rotation+(u-t.lastPinchRotation);t.props.onRotationChange&&t.props.onRotationChange(l),t.lastPinchRotation=u})}},n.prototype.render=function(){var e=this,t,o=this.props,i=o.image,s=o.video,a=o.mediaProps,c=o.cropperProps,u=o.transform,l=o.crop,d=l.x,p=l.y,m=o.rotation,v=o.zoom,w=o.cropShape,b=o.showGrid,R=o.roundCropAreaPixels,z=o.style,j=z.containerStyle,I=z.cropAreaStyle,W=z.mediaStyle,M=o.classes,X=M.containerClassName,V=M.cropAreaClassName,F=M.mediaClassName,_=(t=this.state.mediaObjectFit)!==null&&t!==void 0?t:this.getObjectFit();return E("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:function(f){return e.containerRef=f},"data-testid":"container",style:j,className:B("reactEasyCrop_Container",X)},i?E("img",g({alt:"",className:B("reactEasyCrop_Image",_==="contain"&&"reactEasyCrop_Contain",_==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",_==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",F)},a,{src:i,ref:this.imageRef,style:g(g({},W),{transform:u||"translate(".concat(d,"px, ").concat(p,"px) rotate(").concat(m,"deg) scale(").concat(v,")")}),onLoad:this.onMediaLoad})):s&&E("video",g({autoPlay:!0,playsInline:!0,loop:!0,muted:!0,className:B("reactEasyCrop_Video",_==="contain"&&"reactEasyCrop_Contain",_==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",_==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",F)},a,{ref:this.videoRef,onLoadedMetadata:this.onMediaLoad,style:g(g({},W),{transform:u||"translate(".concat(d,"px, ").concat(p,"px) rotate(").concat(m,"deg) scale(").concat(v,")")}),controls:!1}),(Array.isArray(s)?s:[{src:s}]).map(function(A){return E("source",g({key:A.src},A))})),this.state.cropSize&&E("div",g({ref:this.cropperRef,style:g(g({},I),{width:R?Math.round(this.state.cropSize.width):this.state.cropSize.width,height:R?Math.round(this.state.cropSize.height):this.state.cropSize.height}),tabIndex:0,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,"data-testid":"cropper",className:B("reactEasyCrop_CropArea",w==="round"&&"reactEasyCrop_CropAreaRound",b&&"reactEasyCrop_CropAreaGrid",V)},c)))},n.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:ht,minZoom:pt,cropShape:"rect",objectFit:"contain",showGrid:!0,style:{},classes:{},mediaProps:{},cropperProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0,keyboardStep:ft},n.getMousePoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},n.getTouchPoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},n})(ce);var dt=Ve;function It(r){let n=le(),[e,t]=C(r.src),[o,i]=C({x:0,y:0}),[s,a]=C(1),[c,u]=C(null),[l,d]=C(!1),[p,m]=C(r.initialWidth||0),[v,w]=C(r.initialHeight||0),b=ue(()=>e.startsWith(ye)?e.includes("=")?e.split("=")[0]+"=s0":e+"=s0":e,[e]),R=r.filename?mt(r.filename):"jpg",z=R==="png"?"image/png":"image/jpeg",j=R==="jpg"||R==="jpeg"||r.src.toLowerCase().endsWith(".jpg")||r.src.toLowerCase().endsWith(".jpeg"),[I,W]=C("#ffffff");Y(()=>{t(r.src)},[r.src]),Y(()=>{r.initialWidth&&m(r.initialWidth),r.initialHeight&&w(r.initialHeight)},[r.initialWidth,r.initialHeight]);let M=q((f,x)=>{u(x)},[]),X=q(f=>{m(x=>x>0?x:f.naturalWidth),w(x=>x>0?x:f.naturalHeight)},[]),V=async()=>{if(c){d(!0);try{let f=await gt(b,c,{width:p||800,height:v||600},r.filename,z,j?I:void 0);f&&r.onSave(f)}catch(f){console.error(f)}finally{d(!1)}}},F=()=>{i(f=>({...f,x:0}))},_=()=>{i(f=>({...f,y:0}))},A=()=>{r.originalSrc&&(t(r.originalSrc),m(0),w(0),i({x:0,y:0}),a(1))};return h(fe,{opened:r.opened,onClose:r.onClose,title:"Edit Image",size:"xl",centered:!0,overlayColor:n.colorScheme==="dark"?n.colors.dark[9]:n.colors.gray[2],children:h(me,{spacing:"md",children:[h(P,{grow:!0,children:[h(J,{label:"Width",value:p||void 0,placeholder:"Width",onChange:f=>m(typeof f=="number"?f:0)}),h(J,{label:"Height",value:v||void 0,placeholder:"Height",onChange:f=>w(typeof f=="number"?f:0)}),j&&h(he,{label:"Background Color",value:I,onChange:W})]}),h("div",{className:"ImageEditorDialog__CropperContainer",children:h(dt,{image:b,crop:o,zoom:s,aspect:p&&v?p/v:void 0,minZoom:.1,restrictPosition:!1,onCropChange:i,onCropComplete:M,onZoomChange:a,onMediaLoaded:X})}),h(P,{children:[h(pe,{size:"sm",children:"Zoom"}),h(de,{className:"ImageEditorDialog__ZoomSlider",value:(s-1)*100,min:-100,max:200,step:1,label:f=>`${Math.round(f)}%`,onChange:f=>a(1+f/100)}),h(P,{spacing:"xs",children:[h($,{label:"Center horizontally",withArrow:!0,children:h(K,{variant:"default",onClick:F,size:"lg",children:h(ge,{size:20})})}),h($,{label:"Center vertically",withArrow:!0,children:h(K,{variant:"default",onClick:_,size:"lg",children:h(ve,{size:20})})})]})]}),h(P,{position:r.originalSrc&&e!==r.originalSrc?"apart":"right",mt:"md",children:[r.originalSrc&&e!==r.originalSrc&&h(N,{variant:"default",onClick:A,disabled:l,children:"Restore Original"}),h(P,{children:[h(N,{variant:"default",onClick:r.onClose,disabled:l,children:"Discard"}),h(N,{onClick:V,loading:l,leftIcon:h(we,{}),children:"Save"})]})]})]})})}function mt(r){return r.split(".").pop()?.toLowerCase()||""}async function gt(r,n,e,t="image.jpg",o="image/jpeg",i){let s=await vt(r),a=document.createElement("canvas"),c=a.getContext("2d");return c?(a.width=e.width,a.height=e.height,i&&(c.fillStyle=i,c.fillRect(0,0,a.width,a.height)),c.drawImage(s,n.x,n.y,n.width,n.height,0,0,e.width,e.height),new Promise(u=>{a.toBlob(l=>{if(!l){u(null);return}let d=new File([l],t,{type:o});u(d)},o)})):null}function vt(r){return new Promise((n,e)=>{let t=new Image;t.addEventListener("load",()=>n(t)),t.addEventListener("error",o=>e(o)),t.setAttribute("crossOrigin","anonymous"),t.src=r})}export{It as ImageEditorDialog};
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-AOCBDKLV.js";import"./chunk-HYARD7BK.js";import"./chunk-2225WAJ2.js";import{a}from"./chunk-6GPTGBA7.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-32LRQ5MJ.js";import"./chunk-ORXEMIQC.js";import{a as g,b as i}from"./chunk-3HVDIPSS.js";import"./chunk-EGEB6N4J.js";import"./chunk-RPOP6MVJ.js";import{Ga as o}from"./chunk-4CUWZQXT.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-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
+ import{a as d}from"./chunk-EMYXSVTD.js";import"./chunk-V7RAXP2W.js";import{a as r}from"./chunk-6GPTGBA7.js";import"./chunk-4KE2SZKH.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import"./chunk-CVGYBXVH.js";import"./chunk-AXETBZ6T.js";import"./chunk-ORXEMIQC.js";import{a as t,b as o}from"./chunk-3HVDIPSS.js";import"./chunk-EGEB6N4J.js";import"./chunk-RPOP6MVJ.js";import{Ga as a,ca as e}from"./chunk-4CUWZQXT.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};
@@ -0,0 +1 @@
1
+ import{a as m}from"./chunk-IDYKCAAL.js";import"./chunk-RQKL4KXY.js";import"./chunk-T47V6AGW.js";import{a as r}from"./chunk-6GPTGBA7.js";import"./chunk-IKED2IGU.js";import"./chunk-4IXGYXA2.js";import"./chunk-UA7UCTX5.js";import"./chunk-BEDUTYQP.js";import"./chunk-NQB37NMX.js";import"./chunk-TDKVKTW4.js";import"./chunk-4KE2SZKH.js";import"./chunk-D37DCENS.js";import"./chunk-KPJ53X55.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import"./chunk-NQ5ARARP.js";import"./chunk-UFQSZ6J2.js";import"./chunk-CVGYBXVH.js";import"./chunk-AXETBZ6T.js";import"./chunk-N5Y5OWTV.js";import"./chunk-ORXEMIQC.js";import{a as s,b as d}from"./chunk-3HVDIPSS.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import"./chunk-RPOP6MVJ.js";import{Ga as e,ca as a}from"./chunk-4CUWZQXT.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-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
+ import{a as e,b as n}from"./chunk-3HVDIPSS.js";import"./chunk-RPOP6MVJ.js";import{Ga as o,gc as t}from"./chunk-4CUWZQXT.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};