camox 0.68.0 → 0.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/core/createBlock.js +14 -7
  2. package/dist/core/hooks/useArtifactHost.js +56 -46
  3. package/dist/core/lib/artifact.d.ts +4 -0
  4. package/dist/core/lib/artifactHost.js +40 -0
  5. package/dist/core/lib/artifactRuntime.js +20 -1
  6. package/dist/features/canvas/canvasFrameDocument.js +25 -2
  7. package/dist/features/canvas/useCanvasFrame.js +6 -2
  8. package/dist/features/preview/components/previewStyles.js +11 -2
  9. package/dist/features/provider/AuthenticatedCamoxProvider.js +33 -28
  10. package/dist/features/renderer/RendererApp.js +202 -154
  11. package/dist/features/renderer/RendererFrames.js +87 -55
  12. package/dist/features/renderer/definitionAnswers.js +1 -0
  13. package/dist/features/renderer/rendererHost.js +4 -0
  14. package/dist/features/renderer/studioConnection.js +9 -1
  15. package/dist/features/runtime/pageApp.js +7 -3
  16. package/dist/features/runtime/pageNavigation.js +93 -17
  17. package/dist/features/runtime/rendererClient.js +13 -6
  18. package/dist/features/studio/agentRunToast.js +71 -0
  19. package/dist/features/studio/components/ChatWidget.js +2 -0
  20. package/dist/features/studio/components/DraftBar.js +2 -3
  21. package/dist/features/studio/components/DraftsControl.js +181 -198
  22. package/dist/features/studio/components/LocalePicker.js +22 -4
  23. package/dist/features/studio/components/ReviewDraftSheet.js +345 -568
  24. package/dist/features/studio/draftLabel.js +1 -1
  25. package/dist/features/studio/studioStore.js +5 -17
  26. package/dist/features/studio/viewSwitch.js +62 -0
  27. package/dist/lib/auth.js +5 -1
  28. package/dist/lib/draft-scope.js +28 -15
  29. package/dist/lib/studio-reads.js +46 -13
  30. package/dist/lib/view-switch.js +64 -0
  31. package/dist/package.js +1 -1
  32. package/dist/studio.css +1 -1
  33. package/package.json +6 -4
  34. package/skills/camox/references/artifacts.md +85 -1
@@ -1,7 +1,5 @@
1
- import { useDraftScope } from "../../../lib/draft-scope.js";
2
- import { reads, useReadQuery, useStudioCache } from "../../../lib/studio-reads.js";
1
+ import { reads, useReadQuery } from "../../../lib/studio-reads.js";
3
2
  import { cn } from "../../../lib/utils.js";
4
- import { getDraftReadClient } from "../../../lib/api-client.js";
5
3
  import { draftMutations, patrolMutations } from "../../../lib/queries.js";
6
4
  import { previewStore } from "../../preview/previewStore.js";
7
5
  import { studioStore } from "../studioStore.js";
@@ -9,6 +7,7 @@ import { localeLabel } from "../localeOptions.js";
9
7
  import { askAgentMessage, findingSentence, fixLabel } from "../findingSentence.js";
10
8
  import { useShowInCanvas } from "../showInCanvas.js";
11
9
  import { draftLabel, plural, timeAgo } from "../draftLabel.js";
10
+ import { useLeaveDraft } from "../viewSwitch.js";
12
11
  import { c } from "react/compiler-runtime";
13
12
  import * as React from "react";
14
13
  import { CHECKS_RUNNING_ERROR, CONFLICTS_CHANGED_ERROR, FINDINGS_OPEN_ERROR, REVISION_CHANGED_ERROR, TRANSLATIONS_PENDING_ERROR } from "@camox/api-contract/drafts";
@@ -954,7 +953,7 @@ function _temp5(locale) {
954
953
  * draft.
955
954
  */
956
955
  function DraftOverview(t0) {
957
- const $ = c(34);
956
+ const $ = c(35);
958
957
  const { projectId, preview } = t0;
959
958
  const { overview, changes } = preview;
960
959
  let t1;
@@ -967,34 +966,36 @@ function DraftOverview(t0) {
967
966
  } else t1 = $[0];
968
967
  const retry = useMutation(t1);
969
968
  if (changes.length === 0) {
970
- let t2;
971
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
972
- t2 = /* @__PURE__ */ jsx("p", {
969
+ const t2 = preview.code ? "This draft changes the website's code." : "This draft has no changes.";
970
+ let t3;
971
+ if ($[1] !== t2) {
972
+ t3 = /* @__PURE__ */ jsx("p", {
973
973
  className: "text-muted-foreground text-sm",
974
- children: "This draft has no changes."
974
+ children: t2
975
975
  });
976
976
  $[1] = t2;
977
- } else t2 = $[1];
978
- return t2;
977
+ $[2] = t3;
978
+ } else t3 = $[2];
979
+ return t3;
979
980
  }
980
981
  if (overview.status === "ready") {
981
982
  let t2;
982
- if ($[2] !== overview.bullets) {
983
+ if ($[3] !== overview.bullets) {
983
984
  t2 = overview.bullets.map(_temp11);
984
- $[2] = overview.bullets;
985
- $[3] = t2;
986
- } else t2 = $[3];
985
+ $[3] = overview.bullets;
986
+ $[4] = t2;
987
+ } else t2 = $[4];
987
988
  let t3;
988
- if ($[4] !== t2) {
989
+ if ($[5] !== t2) {
989
990
  t3 = /* @__PURE__ */ jsx("ul", {
990
991
  className: "text-foreground/85 flex list-disc flex-col gap-1.5 pl-5 leading-relaxed",
991
992
  children: t2
992
993
  });
993
- $[4] = t2;
994
- $[5] = t3;
995
- } else t3 = $[5];
994
+ $[5] = t2;
995
+ $[6] = t3;
996
+ } else t3 = $[6];
996
997
  let t4;
997
- if ($[6] !== overview.stale) {
998
+ if ($[7] !== overview.stale) {
998
999
  t4 = overview.stale && /* @__PURE__ */ jsxs("p", {
999
1000
  className: "text-muted-foreground flex items-center gap-1.5 text-xs",
1000
1001
  children: [/* @__PURE__ */ jsx(Spinner, {
@@ -1002,53 +1003,53 @@ function DraftOverview(t0) {
1002
1003
  className: "size-3"
1003
1004
  }), "Updating…"]
1004
1005
  });
1005
- $[6] = overview.stale;
1006
- $[7] = t4;
1007
- } else t4 = $[7];
1006
+ $[7] = overview.stale;
1007
+ $[8] = t4;
1008
+ } else t4 = $[8];
1008
1009
  let t5;
1009
- if ($[8] !== t3 || $[9] !== t4) {
1010
+ if ($[9] !== t3 || $[10] !== t4) {
1010
1011
  t5 = /* @__PURE__ */ jsxs("div", {
1011
1012
  "data-overview": true,
1012
1013
  className: "flex flex-col gap-2",
1013
1014
  children: [t3, t4]
1014
1015
  });
1015
- $[8] = t3;
1016
- $[9] = t4;
1017
- $[10] = t5;
1018
- } else t5 = $[10];
1016
+ $[9] = t3;
1017
+ $[10] = t4;
1018
+ $[11] = t5;
1019
+ } else t5 = $[11];
1019
1020
  return t5;
1020
1021
  }
1021
1022
  if (overview.status === "failed") {
1022
1023
  let t2;
1023
- if ($[11] !== changes) {
1024
+ if ($[12] !== changes) {
1024
1025
  t2 = new Set(changes.map(_temp12));
1025
- $[11] = changes;
1026
- $[12] = t2;
1027
- } else t2 = $[12];
1026
+ $[12] = changes;
1027
+ $[13] = t2;
1028
+ } else t2 = $[13];
1028
1029
  const places = t2.size;
1029
1030
  let t3;
1030
- if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
1031
+ if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
1031
1032
  t3 = /* @__PURE__ */ jsx("p", {
1032
1033
  className: "text-sm font-medium",
1033
1034
  children: "Couldn't summarize this draft"
1034
1035
  });
1035
- $[13] = t3;
1036
- } else t3 = $[13];
1036
+ $[14] = t3;
1037
+ } else t3 = $[14];
1037
1038
  let t4;
1038
- if ($[14] !== projectId || $[15] !== retry) {
1039
+ if ($[15] !== projectId || $[16] !== retry) {
1039
1040
  t4 = () => retry.mutate({ projectId });
1040
- $[14] = projectId;
1041
- $[15] = retry;
1042
- $[16] = t4;
1043
- } else t4 = $[16];
1041
+ $[15] = projectId;
1042
+ $[16] = retry;
1043
+ $[17] = t4;
1044
+ } else t4 = $[17];
1044
1045
  let t5;
1045
- if ($[17] !== retry.isPending) {
1046
+ if ($[18] !== retry.isPending) {
1046
1047
  t5 = retry.isPending ? /* @__PURE__ */ jsx(Spinner, {}) : null;
1047
- $[17] = retry.isPending;
1048
- $[18] = t5;
1049
- } else t5 = $[18];
1048
+ $[18] = retry.isPending;
1049
+ $[19] = t5;
1050
+ } else t5 = $[19];
1050
1051
  let t6;
1051
- if ($[19] !== retry.isPending || $[20] !== t4 || $[21] !== t5) {
1052
+ if ($[20] !== retry.isPending || $[21] !== t4 || $[22] !== t5) {
1052
1053
  t6 = /* @__PURE__ */ jsxs("div", {
1053
1054
  className: "flex items-center gap-3",
1054
1055
  children: [t3, /* @__PURE__ */ jsxs(Button, {
@@ -1060,25 +1061,25 @@ function DraftOverview(t0) {
1060
1061
  children: [t5, "Retry"]
1061
1062
  })]
1062
1063
  });
1063
- $[19] = retry.isPending;
1064
- $[20] = t4;
1065
- $[21] = t5;
1066
- $[22] = t6;
1067
- } else t6 = $[22];
1064
+ $[20] = retry.isPending;
1065
+ $[21] = t4;
1066
+ $[22] = t5;
1067
+ $[23] = t6;
1068
+ } else t6 = $[23];
1068
1069
  let t7;
1069
- if ($[23] !== changes.length) {
1070
+ if ($[24] !== changes.length) {
1070
1071
  t7 = plural(changes.length, "change");
1071
- $[23] = changes.length;
1072
- $[24] = t7;
1073
- } else t7 = $[24];
1072
+ $[24] = changes.length;
1073
+ $[25] = t7;
1074
+ } else t7 = $[25];
1074
1075
  let t8;
1075
- if ($[25] !== places) {
1076
+ if ($[26] !== places) {
1076
1077
  t8 = plural(places, "place");
1077
- $[25] = places;
1078
- $[26] = t8;
1079
- } else t8 = $[26];
1078
+ $[26] = places;
1079
+ $[27] = t8;
1080
+ } else t8 = $[27];
1080
1081
  let t9;
1081
- if ($[27] !== t7 || $[28] !== t8) {
1082
+ if ($[28] !== t7 || $[29] !== t8) {
1082
1083
  t9 = /* @__PURE__ */ jsxs("p", {
1083
1084
  className: "text-muted-foreground text-sm",
1084
1085
  children: [
@@ -1087,26 +1088,26 @@ function DraftOverview(t0) {
1087
1088
  t8
1088
1089
  ]
1089
1090
  });
1090
- $[27] = t7;
1091
- $[28] = t8;
1092
- $[29] = t9;
1093
- } else t9 = $[29];
1091
+ $[28] = t7;
1092
+ $[29] = t8;
1093
+ $[30] = t9;
1094
+ } else t9 = $[30];
1094
1095
  let t10;
1095
- if ($[30] !== t6 || $[31] !== t9) {
1096
+ if ($[31] !== t6 || $[32] !== t9) {
1096
1097
  t10 = /* @__PURE__ */ jsxs("div", {
1097
1098
  "data-overview": true,
1098
1099
  className: "flex flex-col gap-2",
1099
1100
  children: [t6, t9]
1100
1101
  });
1101
- $[30] = t6;
1102
- $[31] = t9;
1103
- $[32] = t10;
1104
- } else t10 = $[32];
1102
+ $[31] = t6;
1103
+ $[32] = t9;
1104
+ $[33] = t10;
1105
+ } else t10 = $[33];
1105
1106
  return t10;
1106
1107
  }
1107
1108
  if (overview.status === "none") return null;
1108
1109
  let t2;
1109
- if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
1110
+ if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
1110
1111
  t2 = /* @__PURE__ */ jsxs("div", {
1111
1112
  "data-overview": true,
1112
1113
  className: "flex flex-col gap-2",
@@ -1120,8 +1121,8 @@ function DraftOverview(t0) {
1120
1121
  })
1121
1122
  ]
1122
1123
  });
1123
- $[33] = t2;
1124
- } else t2 = $[33];
1124
+ $[34] = t2;
1125
+ } else t2 = $[34];
1125
1126
  return t2;
1126
1127
  }
1127
1128
  function _temp12(change) {
@@ -1133,290 +1134,110 @@ function _temp11(bullet, index) {
1133
1134
  function _temp10(error) {
1134
1135
  return toast.error(error.message || "Could not summarize the draft");
1135
1136
  }
1136
- /** Switches the studio to Live once its draft ended here, replacing the draft's URL entry. */
1137
- function useLeaveDraft() {
1138
- const $ = c(2);
1139
- const draftScope = useDraftScope();
1140
- let t0;
1141
- if ($[0] !== draftScope) {
1142
- t0 = (ended, t1) => {
1143
- const { discarded: t2 } = t1 === void 0 ? {} : t1;
1144
- const discarded = t2 === void 0 ? false : t2;
1145
- draftScope.leave(ended);
1146
- if (!ended) return;
1147
- const what = discarded ? "Changes discarded" : `Draft ${ended.outcome}`;
1148
- toast.success(`${what}. You're now viewing Live.`);
1149
- };
1150
- $[0] = draftScope;
1151
- $[1] = t0;
1152
- } else t0 = $[1];
1153
- return t0;
1154
- }
1155
- /**
1156
- * Renames a regular draft, whichever draft the studio views: the request names the draft it
1157
- * renames. A blank name clears it, so the draft shows its computed label again.
1158
- */
1159
- function useRenameDraft(projectId) {
1160
- const $ = c(8);
1161
- const studioCache = useStudioCache();
1162
- let t0;
1163
- if ($[0] !== projectId) {
1164
- t0 = (t1) => {
1165
- const { draftId, name } = t1;
1166
- return getDraftReadClient(draftId).drafts.rename({
1167
- projectId,
1168
- name
1169
- });
1170
- };
1171
- $[0] = projectId;
1172
- $[1] = t0;
1173
- } else t0 = $[1];
1174
- let t1;
1175
- if ($[2] !== projectId || $[3] !== studioCache) {
1176
- t1 = (renamed) => {
1177
- studioCache.set(reads.draft({
1178
- projectId,
1179
- draftId: renamed.id
1180
- }), renamed);
1181
- studioCache.invalidate(reads.draftList({ projectId }));
1182
- };
1183
- $[2] = projectId;
1184
- $[3] = studioCache;
1185
- $[4] = t1;
1186
- } else t1 = $[4];
1187
- let t2;
1188
- if ($[5] !== t0 || $[6] !== t1) {
1189
- t2 = {
1190
- mutationFn: t0,
1191
- onSuccess: t1,
1192
- onError: _temp13
1193
- };
1194
- $[5] = t0;
1195
- $[6] = t1;
1196
- $[7] = t2;
1197
- } else t2 = $[7];
1198
- return useMutation(t2);
1199
- }
1200
- function _temp13(error) {
1201
- return toast.error(error.message || "Could not rename the draft");
1202
- }
1203
- /**
1204
- * The draft's name in the review's header, renamed in place by any member (#203), like a page
1205
- * nickname in the Canvas Inspector: a title whose border shows on hover or focus, without
1206
- * moving the text. An unnamed draft shows its computed label until focused. Saves on Enter or
1207
- * blur, and a blank name clears it; Escape puts the name back.
1208
- */
1209
- function DraftNameInput(t0) {
1210
- const $ = c(23);
1211
- const { projectId, draft, ref, className } = t0;
1212
- const rename = useRenameDraft(projectId);
1213
- const name = draft.name ?? "";
1214
- let t1;
1215
- if ($[0] !== draft.id || $[1] !== draft.name || $[2] !== name || $[3] !== rename) {
1216
- t1 = (input) => {
1217
- if ((input.value.trim() || null) === draft.name) {
1218
- input.value = name;
1219
- return;
1220
- }
1221
- rename.mutate({
1222
- draftId: draft.id,
1223
- name: input.value
1224
- }, { onError: () => void (input.value = name) });
1225
- };
1226
- $[0] = draft.id;
1227
- $[1] = draft.name;
1228
- $[2] = name;
1229
- $[3] = rename;
1230
- $[4] = t1;
1231
- } else t1 = $[4];
1232
- const save = t1;
1233
- let t2;
1234
- if ($[5] !== draft) {
1235
- t2 = draftLabel({
1236
- ...draft,
1237
- name: null
1238
- });
1239
- $[5] = draft;
1240
- $[6] = t2;
1241
- } else t2 = $[6];
1242
- let t3;
1243
- if ($[7] !== draft) {
1244
- t3 = draftLabel(draft);
1245
- $[7] = draft;
1246
- $[8] = t3;
1247
- } else t3 = $[8];
1248
- let t4;
1249
- if ($[9] !== className) {
1250
- t4 = cn("hover:border-input focus-visible:border-ring focus-visible:ring-ring/50 placeholder:text-foreground focus:placeholder:text-muted-foreground -mx-1.5 h-8 w-full min-w-0 truncate rounded-md border border-transparent bg-transparent px-1.5 text-base font-medium transition-[color,box-shadow,border-color] outline-none hover:shadow-xs focus-visible:ring-3", className);
1251
- $[9] = className;
1252
- $[10] = t4;
1253
- } else t4 = $[10];
1254
- let t5;
1255
- if ($[11] !== save) {
1256
- t5 = (event) => save(event.currentTarget);
1257
- $[11] = save;
1258
- $[12] = t5;
1259
- } else t5 = $[12];
1260
- let t6;
1261
- if ($[13] !== name) {
1262
- t6 = (event_0) => {
1263
- if (event_0.key === "Enter") {
1264
- event_0.preventDefault();
1265
- event_0.currentTarget.blur();
1266
- }
1267
- if (event_0.key !== "Escape") return;
1268
- event_0.stopPropagation();
1269
- event_0.currentTarget.value = name;
1270
- event_0.currentTarget.blur();
1271
- };
1272
- $[13] = name;
1273
- $[14] = t6;
1274
- } else t6 = $[14];
1275
- let t7;
1276
- if ($[15] !== name || $[16] !== ref || $[17] !== t2 || $[18] !== t3 || $[19] !== t4 || $[20] !== t5 || $[21] !== t6) {
1277
- t7 = /* @__PURE__ */ jsx("input", {
1278
- ref,
1279
- "aria-label": "Draft name",
1280
- defaultValue: name,
1281
- placeholder: t2,
1282
- title: t3,
1283
- maxLength: 200,
1284
- className: t4,
1285
- onBlur: t5,
1286
- onKeyDown: t6
1287
- }, name);
1288
- $[15] = name;
1289
- $[16] = ref;
1290
- $[17] = t2;
1291
- $[18] = t3;
1292
- $[19] = t4;
1293
- $[20] = t5;
1294
- $[21] = t6;
1295
- $[22] = t7;
1296
- } else t7 = $[22];
1297
- return t7;
1298
- }
1299
1137
  /**
1300
1138
  * Reviews a draft before publishing it whole, or deletes it (ADR 0009). Publishing sends back
1301
1139
  * the token of the preview shown; when Live changed since, nothing is published and the new
1302
1140
  * preview is shown. Once the draft ends, the studio switches to Live.
1303
1141
  */
1304
1142
  function ReviewDraftSheet(t0) {
1305
- const $ = c(81);
1306
- const { projectId, draftId, open, startRenaming: t1, onOpenChange } = t0;
1307
- const startRenaming = t1 === void 0 ? false : t1;
1143
+ const $ = c(74);
1144
+ const { projectId, draftId, open, onOpenChange } = t0;
1308
1145
  const [confirmingDelete, setConfirmingDelete] = React.useState(false);
1309
- let t2;
1146
+ let t1;
1310
1147
  if ($[0] !== draftId || $[1] !== projectId) {
1311
- t2 = reads.publishPreview({
1148
+ t1 = reads.publishPreview({
1312
1149
  projectId,
1313
1150
  draftId
1314
1151
  });
1315
1152
  $[0] = draftId;
1316
1153
  $[1] = projectId;
1317
- $[2] = t2;
1318
- } else t2 = $[2];
1319
- let t3;
1154
+ $[2] = t1;
1155
+ } else t1 = $[2];
1156
+ let t2;
1320
1157
  if ($[3] !== open) {
1321
- t3 = { enabled: open };
1158
+ t2 = { enabled: open };
1322
1159
  $[3] = open;
1323
- $[4] = t3;
1324
- } else t3 = $[4];
1325
- const preview = useReadQuery(t2, t3);
1326
- let t4;
1160
+ $[4] = t2;
1161
+ } else t2 = $[4];
1162
+ const preview = useReadQuery(t1, t2);
1163
+ let t3;
1327
1164
  if ($[5] !== draftId || $[6] !== projectId) {
1328
- t4 = reads.draft({
1165
+ t3 = reads.draft({
1329
1166
  projectId,
1330
1167
  draftId
1331
1168
  });
1332
1169
  $[5] = draftId;
1333
1170
  $[6] = projectId;
1334
- $[7] = t4;
1335
- } else t4 = $[7];
1336
- let t5;
1171
+ $[7] = t3;
1172
+ } else t3 = $[7];
1173
+ let t4;
1337
1174
  if ($[8] !== open) {
1338
- t5 = { enabled: open };
1175
+ t4 = { enabled: open };
1339
1176
  $[8] = open;
1340
- $[9] = t5;
1341
- } else t5 = $[9];
1342
- const draft = useReadQuery(t4, t5);
1343
- let t6;
1177
+ $[9] = t4;
1178
+ } else t4 = $[9];
1179
+ const draft = useReadQuery(t3, t4);
1180
+ let t5;
1344
1181
  if ($[10] !== projectId) {
1345
- t6 = reads.localeList({ projectId });
1182
+ t5 = reads.localeList({ projectId });
1346
1183
  $[10] = projectId;
1347
- $[11] = t6;
1348
- } else t6 = $[11];
1349
- let t7;
1184
+ $[11] = t5;
1185
+ } else t5 = $[11];
1186
+ let t6;
1350
1187
  if ($[12] !== open) {
1351
- t7 = { enabled: open };
1188
+ t6 = { enabled: open };
1352
1189
  $[12] = open;
1353
- $[13] = t7;
1354
- } else t7 = $[13];
1355
- const locales = useReadQuery(t6, t7);
1190
+ $[13] = t6;
1191
+ } else t6 = $[13];
1192
+ const locales = useReadQuery(t5, t6);
1356
1193
  const leaveDraft = useLeaveDraft();
1357
1194
  const showInCanvas = useShowInCanvas();
1358
1195
  const popup = React.useRef(null);
1359
- const nameInput = React.useRef(null);
1360
- let t8;
1361
- if ($[14] !== startRenaming) {
1362
- t8 = () => {
1363
- if (startRenaming && nameInput.current) {
1364
- nameInput.current.select();
1365
- return nameInput.current;
1366
- }
1367
- return popup.current;
1368
- };
1369
- $[14] = startRenaming;
1370
- $[15] = t8;
1371
- } else t8 = $[15];
1372
- const initialFocus = t8;
1373
- let t9;
1374
- if ($[16] !== draft.data?.translatingLocales) {
1375
- t9 = draft.data?.translatingLocales.join(",");
1376
- $[16] = draft.data?.translatingLocales;
1377
- $[17] = t9;
1378
- } else t9 = $[17];
1379
- const pending = t9;
1196
+ let t7;
1197
+ if ($[14] !== draft.data?.translatingLocales) {
1198
+ t7 = draft.data?.translatingLocales.join(",");
1199
+ $[14] = draft.data?.translatingLocales;
1200
+ $[15] = t7;
1201
+ } else t7 = $[15];
1202
+ const pending = t7;
1380
1203
  const seenPending = React.useRef(pending);
1381
1204
  const { refetch } = preview;
1382
- let t10;
1383
- let t11;
1384
- if ($[18] !== pending || $[19] !== refetch) {
1385
- t10 = () => {
1205
+ let t8;
1206
+ let t9;
1207
+ if ($[16] !== pending || $[17] !== refetch) {
1208
+ t8 = () => {
1386
1209
  if (seenPending.current !== void 0 && seenPending.current !== pending) refetch();
1387
1210
  seenPending.current = pending;
1388
1211
  };
1389
- t11 = [pending, refetch];
1390
- $[18] = pending;
1391
- $[19] = refetch;
1392
- $[20] = t10;
1393
- $[21] = t11;
1212
+ t9 = [pending, refetch];
1213
+ $[16] = pending;
1214
+ $[17] = refetch;
1215
+ $[18] = t8;
1216
+ $[19] = t9;
1394
1217
  } else {
1395
- t10 = $[20];
1396
- t11 = $[21];
1218
+ t8 = $[18];
1219
+ t9 = $[19];
1397
1220
  }
1398
- React.useEffect(t10, t11);
1399
- const discard = draft.data?.name === null;
1400
- let t12;
1401
- if ($[22] !== discard || $[23] !== leaveDraft || $[24] !== onOpenChange) {
1402
- t12 = (ended) => {
1221
+ React.useEffect(t8, t9);
1222
+ let t10;
1223
+ if ($[20] !== leaveDraft || $[21] !== onOpenChange) {
1224
+ t10 = (ended) => {
1403
1225
  onOpenChange(false);
1404
- leaveDraft(ended, { discarded: discard });
1226
+ leaveDraft(ended);
1405
1227
  };
1406
- $[22] = discard;
1407
- $[23] = leaveDraft;
1408
- $[24] = onOpenChange;
1409
- $[25] = t12;
1410
- } else t12 = $[25];
1411
- const leave = t12;
1412
- let t13;
1413
- if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
1414
- t13 = draftMutations.publish();
1415
- $[26] = t13;
1416
- } else t13 = $[26];
1417
- let t14;
1418
- if ($[27] !== leave || $[28] !== preview) {
1419
- t14 = (result) => {
1228
+ $[20] = leaveDraft;
1229
+ $[21] = onOpenChange;
1230
+ $[22] = t10;
1231
+ } else t10 = $[22];
1232
+ const leave = t10;
1233
+ let t11;
1234
+ if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
1235
+ t11 = draftMutations.publish();
1236
+ $[23] = t11;
1237
+ } else t11 = $[23];
1238
+ let t12;
1239
+ if ($[24] !== leave || $[25] !== preview) {
1240
+ t12 = (result) => {
1420
1241
  if ("publishing" in result && result.publishing) {
1421
1242
  preview.refetch();
1422
1243
  return;
@@ -1426,13 +1247,13 @@ function ReviewDraftSheet(t0) {
1426
1247
  toast.info("This draft has no changes, so there is nothing to publish.");
1427
1248
  preview.refetch();
1428
1249
  };
1429
- $[27] = leave;
1430
- $[28] = preview;
1431
- $[29] = t14;
1432
- } else t14 = $[29];
1433
- let t15;
1434
- if ($[30] !== preview) {
1435
- t15 = (error) => {
1250
+ $[24] = leave;
1251
+ $[25] = preview;
1252
+ $[26] = t12;
1253
+ } else t12 = $[26];
1254
+ let t13;
1255
+ if ($[27] !== preview) {
1256
+ t13 = (error) => {
1436
1257
  if (error.code === CONFLICTS_CHANGED_ERROR) {
1437
1258
  toast.error("Live changed since you opened this review. Check the new list.");
1438
1259
  preview.refetch();
@@ -1457,37 +1278,35 @@ function ReviewDraftSheet(t0) {
1457
1278
  toast.error(error.message || "Could not publish the draft");
1458
1279
  preview.refetch();
1459
1280
  };
1460
- $[30] = preview;
1461
- $[31] = t15;
1462
- } else t15 = $[31];
1463
- let t16;
1464
- if ($[32] !== t14 || $[33] !== t15) {
1465
- t16 = {
1466
- ...t13,
1467
- onSuccess: t14,
1468
- onError: t15
1281
+ $[27] = preview;
1282
+ $[28] = t13;
1283
+ } else t13 = $[28];
1284
+ let t14;
1285
+ if ($[29] !== t12 || $[30] !== t13) {
1286
+ t14 = {
1287
+ ...t11,
1288
+ onSuccess: t12,
1289
+ onError: t13
1469
1290
  };
1470
- $[32] = t14;
1471
- $[33] = t15;
1472
- $[34] = t16;
1473
- } else t16 = $[34];
1474
- const publish = useMutation(t16);
1291
+ $[29] = t12;
1292
+ $[30] = t13;
1293
+ $[31] = t14;
1294
+ } else t14 = $[31];
1295
+ const publish = useMutation(t14);
1475
1296
  const data = preview.data;
1476
1297
  const headline = data?.overview.status === "ready" ? data.overview.headline : null;
1477
1298
  const busy = publish.isPending;
1478
1299
  const ready = !!data && data.blockers.length === 0 && data.translating.length === 0 && data.findings.length === 0 && data.checking.length === 0 && !data.code?.building && !data.code?.publishing && !busy && !preview.isFetching;
1479
- let t17;
1480
- if ($[35] !== draft.data || $[36] !== headline || $[37] !== projectId) {
1481
- t17 = /* @__PURE__ */ jsx("div", {
1300
+ let t15;
1301
+ if ($[32] !== draft.data || $[33] !== headline) {
1302
+ t15 = /* @__PURE__ */ jsx("div", {
1482
1303
  className: "flex flex-col gap-1 border-b p-4 pr-12",
1483
- children: headline ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(SheetDescription, {
1304
+ children: headline ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SheetDescription, {
1484
1305
  className: "flex min-w-0 items-center gap-1",
1485
- children: [draft.data && /* @__PURE__ */ jsx(DraftNameInput, {
1486
- ref: nameInput,
1487
- projectId,
1488
- draft: draft.data,
1489
- className: "placeholder:text-muted-foreground text-muted-foreground field-sizing-content h-6 w-auto max-w-full text-sm font-normal"
1490
- }), draft.data && /* @__PURE__ */ jsxs("span", {
1306
+ children: draft.data && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
1307
+ className: "truncate",
1308
+ children: draftLabel(draft.data)
1309
+ }), /* @__PURE__ */ jsxs("span", {
1491
1310
  className: "shrink-0",
1492
1311
  children: [
1493
1312
  "· ",
@@ -1495,30 +1314,22 @@ function ReviewDraftSheet(t0) {
1495
1314
  ", started ",
1496
1315
  timeAgo(draft.data.createdAt)
1497
1316
  ]
1498
- })]
1317
+ })] })
1499
1318
  }), /* @__PURE__ */ jsx(SheetTitle, {
1500
1319
  className: "text-lg leading-snug font-semibold",
1501
1320
  children: headline
1502
- })] }) : /* @__PURE__ */ jsxs(Fragment, { children: [draft.data ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SheetTitle, {
1503
- className: "sr-only",
1504
- children: draftLabel(draft.data)
1505
- }), /* @__PURE__ */ jsx(DraftNameInput, {
1506
- ref: nameInput,
1507
- projectId,
1508
- draft: draft.data
1509
- })] }) : /* @__PURE__ */ jsx(SheetTitle, {
1510
- className: "text-base",
1511
- children: "Draft"
1321
+ })] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SheetTitle, {
1322
+ className: "truncate text-base",
1323
+ children: draft.data ? draftLabel(draft.data) : "Draft"
1512
1324
  }), /* @__PURE__ */ jsx(SheetDescription, { children: draft.data ? `${draft.data.createdBy.name} · started ${timeAgo(draft.data.createdAt)}` : "Publishing applies this whole draft to Live." })] })
1513
1325
  });
1514
- $[35] = draft.data;
1515
- $[36] = headline;
1516
- $[37] = projectId;
1517
- $[38] = t17;
1518
- } else t17 = $[38];
1519
- let t18;
1520
- if ($[39] !== data || $[40] !== locales || $[41] !== onOpenChange || $[42] !== preview || $[43] !== projectId || $[44] !== showInCanvas) {
1521
- t18 = data ? /* @__PURE__ */ jsxs("div", {
1326
+ $[32] = draft.data;
1327
+ $[33] = headline;
1328
+ $[34] = t15;
1329
+ } else t15 = $[34];
1330
+ let t16;
1331
+ if ($[35] !== data || $[36] !== locales || $[37] !== onOpenChange || $[38] !== preview || $[39] !== projectId || $[40] !== showInCanvas) {
1332
+ t16 = data ? /* @__PURE__ */ jsxs("div", {
1522
1333
  className: "flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto p-4",
1523
1334
  children: [
1524
1335
  /* @__PURE__ */ jsx(DraftOverview, {
@@ -1547,264 +1358,230 @@ function ReviewDraftSheet(t0) {
1547
1358
  className: "flex flex-1 items-center justify-center",
1548
1359
  children: /* @__PURE__ */ jsx(Spinner, { className: "text-muted-foreground" })
1549
1360
  });
1550
- $[39] = data;
1551
- $[40] = locales;
1552
- $[41] = onOpenChange;
1553
- $[42] = preview;
1554
- $[43] = projectId;
1555
- $[44] = showInCanvas;
1556
- $[45] = t18;
1557
- } else t18 = $[45];
1558
- let t19;
1559
- let t20;
1560
- if ($[46] === Symbol.for("react.memo_cache_sentinel")) {
1561
- t19 = () => setConfirmingDelete(true);
1562
- t20 = /* @__PURE__ */ jsx(Trash2, {});
1563
- $[46] = t19;
1564
- $[47] = t20;
1361
+ $[35] = data;
1362
+ $[36] = locales;
1363
+ $[37] = onOpenChange;
1364
+ $[38] = preview;
1365
+ $[39] = projectId;
1366
+ $[40] = showInCanvas;
1367
+ $[41] = t16;
1368
+ } else t16 = $[41];
1369
+ let t17;
1370
+ let t18;
1371
+ if ($[42] === Symbol.for("react.memo_cache_sentinel")) {
1372
+ t17 = () => setConfirmingDelete(true);
1373
+ t18 = /* @__PURE__ */ jsx(Trash2, {});
1374
+ $[42] = t17;
1375
+ $[43] = t18;
1565
1376
  } else {
1566
- t19 = $[46];
1567
- t20 = $[47];
1377
+ t17 = $[42];
1378
+ t18 = $[43];
1568
1379
  }
1569
- const t21 = discard ? "Discard changes" : "Delete draft";
1570
- let t22;
1571
- if ($[48] !== busy || $[49] !== t21) {
1572
- t22 = /* @__PURE__ */ jsxs(Button, {
1380
+ let t19;
1381
+ if ($[44] !== busy) {
1382
+ t19 = /* @__PURE__ */ jsxs(Button, {
1573
1383
  variant: "ghost",
1574
1384
  className: "text-destructive",
1575
1385
  disabled: busy,
1576
- onClick: t19,
1577
- children: [t20, t21]
1386
+ onClick: t17,
1387
+ children: [t18, "Delete draft"]
1578
1388
  });
1579
- $[48] = busy;
1389
+ $[44] = busy;
1390
+ $[45] = t19;
1391
+ } else t19 = $[45];
1392
+ const t20 = !ready;
1393
+ let t21;
1394
+ if ($[46] !== data || $[47] !== projectId || $[48] !== publish) {
1395
+ t21 = () => data && publish.mutate(publishInput(projectId, data));
1396
+ $[46] = data;
1397
+ $[47] = projectId;
1398
+ $[48] = publish;
1580
1399
  $[49] = t21;
1581
- $[50] = t22;
1582
- } else t22 = $[50];
1583
- const t23 = !ready;
1584
- let t24;
1585
- if ($[51] !== data || $[52] !== projectId || $[53] !== publish) {
1586
- t24 = () => data && publish.mutate(publishInput(projectId, data));
1587
- $[51] = data;
1588
- $[52] = projectId;
1589
- $[53] = publish;
1590
- $[54] = t24;
1591
- } else t24 = $[54];
1592
- let t25;
1593
- if ($[55] !== publish.isPending) {
1594
- t25 = publish.isPending ? /* @__PURE__ */ jsx(Spinner, {}) : null;
1595
- $[55] = publish.isPending;
1596
- $[56] = t25;
1597
- } else t25 = $[56];
1598
- let t26;
1599
- if ($[57] !== t23 || $[58] !== t24 || $[59] !== t25) {
1600
- t26 = /* @__PURE__ */ jsxs(Button, {
1400
+ } else t21 = $[49];
1401
+ let t22;
1402
+ if ($[50] !== publish.isPending) {
1403
+ t22 = publish.isPending ? /* @__PURE__ */ jsx(Spinner, {}) : null;
1404
+ $[50] = publish.isPending;
1405
+ $[51] = t22;
1406
+ } else t22 = $[51];
1407
+ let t23;
1408
+ if ($[52] !== t20 || $[53] !== t21 || $[54] !== t22) {
1409
+ t23 = /* @__PURE__ */ jsxs(Button, {
1601
1410
  className: "ml-auto",
1602
- disabled: t23,
1603
- onClick: t24,
1604
- children: [t25, "Publish"]
1411
+ disabled: t20,
1412
+ onClick: t21,
1413
+ children: [t22, "Publish"]
1605
1414
  });
1606
- $[57] = t23;
1607
- $[58] = t24;
1608
- $[59] = t25;
1609
- $[60] = t26;
1610
- } else t26 = $[60];
1611
- let t27;
1612
- if ($[61] !== t22 || $[62] !== t26) {
1613
- t27 = /* @__PURE__ */ jsx("div", {
1415
+ $[52] = t20;
1416
+ $[53] = t21;
1417
+ $[54] = t22;
1418
+ $[55] = t23;
1419
+ } else t23 = $[55];
1420
+ let t24;
1421
+ if ($[56] !== t19 || $[57] !== t23) {
1422
+ t24 = /* @__PURE__ */ jsx("div", {
1614
1423
  className: "flex flex-col gap-3 border-t p-4",
1615
1424
  children: /* @__PURE__ */ jsxs("div", {
1616
1425
  className: "flex items-center gap-2",
1617
- children: [t22, t26]
1426
+ children: [t19, t23]
1618
1427
  })
1619
1428
  });
1620
- $[61] = t22;
1621
- $[62] = t26;
1622
- $[63] = t27;
1623
- } else t27 = $[63];
1624
- let t28;
1625
- if ($[64] !== initialFocus || $[65] !== t17 || $[66] !== t18 || $[67] !== t27) {
1626
- t28 = /* @__PURE__ */ jsxs(SheetContent, {
1429
+ $[56] = t19;
1430
+ $[57] = t23;
1431
+ $[58] = t24;
1432
+ } else t24 = $[58];
1433
+ let t25;
1434
+ if ($[59] !== t15 || $[60] !== t16 || $[61] !== t24) {
1435
+ t25 = /* @__PURE__ */ jsxs(SheetContent, {
1627
1436
  ref: popup,
1628
- initialFocus,
1437
+ initialFocus: popup,
1629
1438
  side: "right",
1630
1439
  className: "w-full gap-0 data-[side=right]:sm:max-w-lg",
1631
1440
  children: [
1632
- t17,
1633
- t18,
1634
- t27
1441
+ t15,
1442
+ t16,
1443
+ t24
1635
1444
  ]
1636
1445
  });
1637
- $[64] = initialFocus;
1638
- $[65] = t17;
1639
- $[66] = t18;
1640
- $[67] = t27;
1641
- $[68] = t28;
1642
- } else t28 = $[68];
1643
- let t29;
1644
- if ($[69] !== onOpenChange || $[70] !== open || $[71] !== t28) {
1645
- t29 = /* @__PURE__ */ jsx(Sheet, {
1446
+ $[59] = t15;
1447
+ $[60] = t16;
1448
+ $[61] = t24;
1449
+ $[62] = t25;
1450
+ } else t25 = $[62];
1451
+ let t26;
1452
+ if ($[63] !== onOpenChange || $[64] !== open || $[65] !== t25) {
1453
+ t26 = /* @__PURE__ */ jsx(Sheet, {
1646
1454
  open,
1647
1455
  onOpenChange,
1648
- children: t28
1456
+ children: t25
1649
1457
  });
1650
- $[69] = onOpenChange;
1651
- $[70] = open;
1652
- $[71] = t28;
1653
- $[72] = t29;
1654
- } else t29 = $[72];
1655
- let t30;
1656
- if ($[73] !== confirmingDelete || $[74] !== discard || $[75] !== leave || $[76] !== projectId) {
1657
- t30 = /* @__PURE__ */ jsx(DeleteDraftDialog, {
1458
+ $[63] = onOpenChange;
1459
+ $[64] = open;
1460
+ $[65] = t25;
1461
+ $[66] = t26;
1462
+ } else t26 = $[66];
1463
+ let t27;
1464
+ if ($[67] !== confirmingDelete || $[68] !== leave || $[69] !== projectId) {
1465
+ t27 = /* @__PURE__ */ jsx(DeleteDraftDialog, {
1658
1466
  projectId,
1659
1467
  open: confirmingDelete,
1660
- discard,
1661
1468
  onOpenChange: setConfirmingDelete,
1662
1469
  onDeleted: leave
1663
1470
  });
1664
- $[73] = confirmingDelete;
1665
- $[74] = discard;
1666
- $[75] = leave;
1667
- $[76] = projectId;
1668
- $[77] = t30;
1669
- } else t30 = $[77];
1670
- let t31;
1671
- if ($[78] !== t29 || $[79] !== t30) {
1672
- t31 = /* @__PURE__ */ jsxs(Fragment, { children: [t29, t30] });
1673
- $[78] = t29;
1674
- $[79] = t30;
1675
- $[80] = t31;
1676
- } else t31 = $[80];
1677
- return t31;
1471
+ $[67] = confirmingDelete;
1472
+ $[68] = leave;
1473
+ $[69] = projectId;
1474
+ $[70] = t27;
1475
+ } else t27 = $[70];
1476
+ let t28;
1477
+ if ($[71] !== t26 || $[72] !== t27) {
1478
+ t28 = /* @__PURE__ */ jsxs(Fragment, { children: [t26, t27] });
1479
+ $[71] = t26;
1480
+ $[72] = t27;
1481
+ $[73] = t28;
1482
+ } else t28 = $[73];
1483
+ return t28;
1678
1484
  }
1679
- /**
1680
- * Asks before deleting the draft the studio is in, then deletes it. Deleting an unnamed draft
1681
- * is discarding its changes: nobody kept them as a draft yet.
1682
- */
1485
+ /** Asks before deleting the draft the studio is in, then deletes it. */
1683
1486
  function DeleteDraftDialog(t0) {
1684
- const $ = c(36);
1685
- const { projectId, open, discard: t1, onOpenChange, onDeleted } = t0;
1686
- const discard = t1 === void 0 ? false : t1;
1687
- let t2;
1487
+ const $ = c(26);
1488
+ const { projectId, open, onOpenChange, onDeleted } = t0;
1489
+ let t1;
1688
1490
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1689
- t2 = draftMutations.delete();
1690
- $[0] = t2;
1691
- } else t2 = $[0];
1692
- let t3;
1491
+ t1 = draftMutations.delete();
1492
+ $[0] = t1;
1493
+ } else t1 = $[0];
1494
+ let t2;
1693
1495
  if ($[1] !== onDeleted || $[2] !== onOpenChange) {
1694
- t3 = {
1695
- ...t2,
1696
- onSuccess: (t4) => {
1697
- const { ended } = t4;
1496
+ t2 = {
1497
+ ...t1,
1498
+ onSuccess: (t3) => {
1499
+ const { ended } = t3;
1698
1500
  onOpenChange(false);
1699
1501
  onDeleted(ended);
1700
1502
  },
1701
- onError: _temp14
1503
+ onError: _temp13
1702
1504
  };
1703
1505
  $[1] = onDeleted;
1704
1506
  $[2] = onOpenChange;
1705
- $[3] = t3;
1706
- } else t3 = $[3];
1707
- const deleteDraft = useMutation(t3);
1708
- let t4;
1507
+ $[3] = t2;
1508
+ } else t2 = $[3];
1509
+ const deleteDraft = useMutation(t2);
1510
+ let t3;
1709
1511
  if ($[4] !== deleteDraft.isPending || $[5] !== onOpenChange) {
1710
- t4 = (next) => {
1512
+ t3 = (next) => {
1711
1513
  if (!deleteDraft.isPending) onOpenChange(next);
1712
1514
  };
1713
1515
  $[4] = deleteDraft.isPending;
1714
1516
  $[5] = onOpenChange;
1715
- $[6] = t4;
1716
- } else t4 = $[6];
1717
- const t5 = discard ? "Discard these changes?" : "Delete this draft?";
1718
- let t6;
1719
- if ($[7] !== t5) {
1720
- t6 = /* @__PURE__ */ jsx(AlertDialogTitle, { children: t5 });
1721
- $[7] = t5;
1722
- $[8] = t6;
1723
- } else t6 = $[8];
1724
- const t7 = discard ? "These changes are" : "Every change in this draft is";
1725
- let t8;
1726
- if ($[9] !== t7) {
1727
- t8 = /* @__PURE__ */ jsxs(AlertDialogDescription, { children: [t7, " deleted for everyone. Live stays as it is. This can't be undone."] });
1728
- $[9] = t7;
1729
- $[10] = t8;
1730
- } else t8 = $[10];
1731
- let t9;
1732
- if ($[11] !== t6 || $[12] !== t8) {
1733
- t9 = /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [t6, t8] });
1734
- $[11] = t6;
1735
- $[12] = t8;
1736
- $[13] = t9;
1737
- } else t9 = $[13];
1738
- let t10;
1739
- if ($[14] !== deleteDraft.isPending) {
1740
- t10 = /* @__PURE__ */ jsx(AlertDialogCancel, {
1517
+ $[6] = t3;
1518
+ } else t3 = $[6];
1519
+ let t4;
1520
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
1521
+ t4 = /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: "Delete this draft?" }), /* @__PURE__ */ jsx(AlertDialogDescription, { children: "Every change in this draft is deleted for everyone. Live stays as it is. This can't be undone." })] });
1522
+ $[7] = t4;
1523
+ } else t4 = $[7];
1524
+ let t5;
1525
+ if ($[8] !== deleteDraft.isPending) {
1526
+ t5 = /* @__PURE__ */ jsx(AlertDialogCancel, {
1741
1527
  variant: "outline",
1742
1528
  size: "default",
1743
1529
  disabled: deleteDraft.isPending,
1744
1530
  children: "Cancel"
1745
1531
  });
1746
- $[14] = deleteDraft.isPending;
1747
- $[15] = t10;
1748
- } else t10 = $[15];
1749
- let t11;
1750
- if ($[16] !== deleteDraft || $[17] !== projectId) {
1751
- t11 = () => deleteDraft.mutate({ projectId });
1752
- $[16] = deleteDraft;
1753
- $[17] = projectId;
1754
- $[18] = t11;
1755
- } else t11 = $[18];
1756
- let t12;
1757
- if ($[19] !== deleteDraft.isPending) {
1758
- t12 = deleteDraft.isPending ? /* @__PURE__ */ jsx(Spinner, {}) : null;
1759
- $[19] = deleteDraft.isPending;
1760
- $[20] = t12;
1761
- } else t12 = $[20];
1762
- const t13 = discard ? "Discard changes" : "Delete draft";
1763
- let t14;
1764
- if ($[21] !== deleteDraft.isPending || $[22] !== t11 || $[23] !== t12 || $[24] !== t13) {
1765
- t14 = /* @__PURE__ */ jsxs(AlertDialogAction, {
1532
+ $[8] = deleteDraft.isPending;
1533
+ $[9] = t5;
1534
+ } else t5 = $[9];
1535
+ let t6;
1536
+ if ($[10] !== deleteDraft || $[11] !== projectId) {
1537
+ t6 = () => deleteDraft.mutate({ projectId });
1538
+ $[10] = deleteDraft;
1539
+ $[11] = projectId;
1540
+ $[12] = t6;
1541
+ } else t6 = $[12];
1542
+ let t7;
1543
+ if ($[13] !== deleteDraft.isPending) {
1544
+ t7 = deleteDraft.isPending ? /* @__PURE__ */ jsx(Spinner, {}) : null;
1545
+ $[13] = deleteDraft.isPending;
1546
+ $[14] = t7;
1547
+ } else t7 = $[14];
1548
+ let t8;
1549
+ if ($[15] !== deleteDraft.isPending || $[16] !== t6 || $[17] !== t7) {
1550
+ t8 = /* @__PURE__ */ jsxs(AlertDialogAction, {
1766
1551
  variant: "destructive",
1767
1552
  disabled: deleteDraft.isPending,
1768
- onClick: t11,
1769
- children: [t12, t13]
1553
+ onClick: t6,
1554
+ children: [t7, "Delete draft"]
1770
1555
  });
1771
- $[21] = deleteDraft.isPending;
1772
- $[22] = t11;
1773
- $[23] = t12;
1774
- $[24] = t13;
1775
- $[25] = t14;
1776
- } else t14 = $[25];
1777
- let t15;
1778
- if ($[26] !== t10 || $[27] !== t14) {
1779
- t15 = /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [t10, t14] });
1780
- $[26] = t10;
1781
- $[27] = t14;
1782
- $[28] = t15;
1783
- } else t15 = $[28];
1784
- let t16;
1785
- if ($[29] !== t15 || $[30] !== t9) {
1786
- t16 = /* @__PURE__ */ jsxs(AlertDialogContent, { children: [t9, t15] });
1787
- $[29] = t15;
1788
- $[30] = t9;
1789
- $[31] = t16;
1790
- } else t16 = $[31];
1791
- let t17;
1792
- if ($[32] !== open || $[33] !== t16 || $[34] !== t4) {
1793
- t17 = /* @__PURE__ */ jsx(AlertDialog, {
1556
+ $[15] = deleteDraft.isPending;
1557
+ $[16] = t6;
1558
+ $[17] = t7;
1559
+ $[18] = t8;
1560
+ } else t8 = $[18];
1561
+ let t9;
1562
+ if ($[19] !== t5 || $[20] !== t8) {
1563
+ t9 = /* @__PURE__ */ jsxs(AlertDialogContent, { children: [t4, /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [t5, t8] })] });
1564
+ $[19] = t5;
1565
+ $[20] = t8;
1566
+ $[21] = t9;
1567
+ } else t9 = $[21];
1568
+ let t10;
1569
+ if ($[22] !== open || $[23] !== t3 || $[24] !== t9) {
1570
+ t10 = /* @__PURE__ */ jsx(AlertDialog, {
1794
1571
  open,
1795
- onOpenChange: t4,
1796
- children: t16
1572
+ onOpenChange: t3,
1573
+ children: t9
1797
1574
  });
1798
- $[32] = open;
1799
- $[33] = t16;
1800
- $[34] = t4;
1801
- $[35] = t17;
1802
- } else t17 = $[35];
1803
- return t17;
1575
+ $[22] = open;
1576
+ $[23] = t3;
1577
+ $[24] = t9;
1578
+ $[25] = t10;
1579
+ } else t10 = $[25];
1580
+ return t10;
1804
1581
  }
1805
- function _temp14(error) {
1582
+ function _temp13(error) {
1806
1583
  return toast.error(error.message || "Could not delete the draft");
1807
1584
  }
1808
1585
 
1809
1586
  //#endregion
1810
- export { DeleteDraftDialog, ReviewDraftSheet, useLeaveDraft, useRenameDraft };
1587
+ export { DeleteDraftDialog, ReviewDraftSheet };