@sanity/vision 6.11.1-next.6 → 6.12.0-next.112

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.
@@ -1,6 +1,6 @@
1
- import { t as visionLocaleNamespace } from "./i18n-B53Bf56u.js";
1
+ import { t as visionLocaleNamespace } from "./i18n-t8J2mRUI.js";
2
2
  import { Component, Fragment, Suspense, use, useEffect, useImperativeHandle, useRef, useState } from "react";
3
- import { ContextMenuButton, Translate, UserAvatar, VARIANTS_STUDIO_CLIENT_OPTIONS, getReleaseIdFromReleaseDocumentId, getVariantTitle, isCardinalityOneRelease, sortReleases, useActiveReleases, useClient, useCurrentUser, useDataset, useDateTimeFormat, useKeyValueStore, usePerspective, useScheduledDraftsEnabled, useTranslation, useWorkspace } from "sanity";
3
+ import { ContextMenuButton, RELEASES_STUDIO_CLIENT_OPTIONS, Translate, UserAvatar, VARIANTS_STUDIO_CLIENT_OPTIONS, getReleaseIdFromReleaseDocumentId, getVariantTitle, isCardinalityOneRelease, sortReleases, useActiveReleases, useClient, useCurrentUser, useDataset, useDateTimeFormat, useKeyValueStore, usePerspective, useScheduledDraftsEnabled, useTranslation, useWorkspace } from "sanity";
4
4
  import { IntentLink } from "sanity/router";
5
5
  import { c } from "react/compiler-runtime";
6
6
  import { Badge, Button, Card, Container, Dialog, Flex, Grid, Heading, Hotkeys, Inline, Label, Select, Spinner, Stack, Tab, TabList, Text, TextInput, rem, useClickOutsideEvent, useTheme, useTheme_v2 } from "@sanity/ui";
@@ -44,6 +44,7 @@ import { CopyIcon } from "@sanity/icons/Copy";
44
44
  import { HelpCircleIcon } from "@sanity/icons/HelpCircle";
45
45
  import { Popover } from "@sanity/ui/popover";
46
46
  import { json2csv } from "json-2-csv";
47
+ import { isHttpError } from "@sanity/client";
47
48
  import { JsonInspector } from "@rexxars/react-json-inspector";
48
49
  import { LinkIcon } from "@sanity/icons/Link";
49
50
  import LRU from "quick-lru";
@@ -1930,6 +1931,46 @@ function getMemoizedBlobUrlResolver(mimeType, stringEncoder) {
1930
1931
  })();
1931
1932
  }
1932
1933
  const getJsonBlobUrl = getMemoizedBlobUrlResolver("application/json", (input) => JSON.stringify(input, null, 2)), getCsvBlobUrl = getMemoizedBlobUrlResolver("text/csv", (input) => json2csv(Array.isArray(input) ? input : [input]).trim());
1934
+ /**
1935
+ * Returns true when `selected` does not satisfy `required`.
1936
+ *
1937
+ * `X` is the experimental API: it satisfies every requirement, and when it is
1938
+ * the requirement only `X` satisfies it. Dated versions compare
1939
+ * lexicographically. `v1` sits below every dated version and `X`.
1940
+ */
1941
+ function isApiVersionBelow(selected, required) {
1942
+ let parsedSelected = parseApiVersion(selected), parsedRequired = parseApiVersion(required);
1943
+ return parsedSelected.kind === "unknown" || parsedRequired.kind === "unknown" || parsedSelected.kind === "experimental" ? !1 : parsedRequired.kind === "experimental" ? !0 : parsedSelected.kind === "legacy" ? parsedRequired.kind !== "legacy" : parsedRequired.kind !== "legacy" && parsedSelected.value < parsedRequired.value;
1944
+ }
1945
+ function parseApiVersion(version) {
1946
+ let normalized = version.replace(/^v/i, "").trim();
1947
+ return normalized ? normalized.toUpperCase() === "X" ? { kind: "experimental" } : normalized === "1" ? { kind: "legacy" } : /^\d{4}-\d{2}-\d{2}$/.test(normalized) ? {
1948
+ kind: "dated",
1949
+ value: normalized
1950
+ } : { kind: "unknown" } : { kind: "unknown" };
1951
+ }
1952
+ const NAMED_PERSPECTIVES = /* @__PURE__ */ new Set([
1953
+ "raw",
1954
+ "published",
1955
+ "drafts",
1956
+ "previewDrafts"
1957
+ ]), API_VERSION_CAPABILITIES = [{
1958
+ id: "variants",
1959
+ requiredApiVersion: VARIANTS_STUDIO_CLIENT_OPTIONS.apiVersion,
1960
+ explanationKey: "query.error.unsupported-variant",
1961
+ applies: ({ variant }) => !!variant
1962
+ }, {
1963
+ id: "releases",
1964
+ requiredApiVersion: RELEASES_STUDIO_CLIENT_OPTIONS.apiVersion,
1965
+ explanationKey: "query.error.unsupported-release-perspective",
1966
+ applies: ({ perspective }) => hasReleaseInPerspective(perspective)
1967
+ }];
1968
+ function hasReleaseInPerspective(perspective) {
1969
+ return Array.isArray(perspective) ? perspective.some((entry) => !NAMED_PERSPECTIVES.has(entry)) : !1;
1970
+ }
1971
+ function getUnsatisfiedApiVersionCapability(context, capabilities = API_VERSION_CAPABILITIES) {
1972
+ if (context.statusCode === 400) return capabilities.find((capability) => capability.applies(context) && isApiVersionBelow(context.apiVersion, capability.requiredApiVersion));
1973
+ }
1933
1974
  var errorCode = "vgszcp0";
1934
1975
  function ErrorCode(props) {
1935
1976
  let $ = c(2), t0;
@@ -1991,19 +2032,37 @@ function dashLine(column, columnEnd) {
1991
2032
  return `${"-".repeat(column)}${"^".repeat(columnEnd ? columnEnd - column : 1)}`;
1992
2033
  }
1993
2034
  function QueryErrorDialog(props) {
1994
- let $ = c(7), t0;
1995
- $[0] === props.error.message ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(ErrorCode, {
2035
+ let $ = c(20), { error, apiVersion, perspective, variant } = props, { t } = useTranslation(visionLocaleNamespace), T0, t0, t1, t2;
2036
+ if ($[0] !== apiVersion || $[1] !== error || $[2] !== perspective || $[3] !== t || $[4] !== variant) {
2037
+ let unsatisfiedCapability = getUnsatisfiedApiVersionCapability({
2038
+ statusCode: isHttpError(error) ? error.statusCode : void 0,
2039
+ apiVersion,
2040
+ perspective,
2041
+ variant
2042
+ });
2043
+ T0 = Stack, t0 = 5, t1 = 2, t2 = unsatisfiedCapability ? /* @__PURE__ */ jsx(Text, {
2044
+ "data-testid": "query-error-api-version-capability-hint",
2045
+ size: 1,
2046
+ children: t(unsatisfiedCapability.explanationKey, { apiVersion: prefixApiVersion(unsatisfiedCapability.requiredApiVersion) })
2047
+ }) : null, $[0] = apiVersion, $[1] = error, $[2] = perspective, $[3] = t, $[4] = variant, $[5] = T0, $[6] = t0, $[7] = t1, $[8] = t2;
2048
+ } else T0 = $[5], t0 = $[6], t1 = $[7], t2 = $[8];
2049
+ let t3;
2050
+ $[9] === error.message ? t3 = $[10] : (t3 = /* @__PURE__ */ jsx(ErrorCode, {
1996
2051
  size: 1,
1997
- children: props.error.message
1998
- }), $[0] = props.error.message, $[1] = t0);
1999
- let t1;
2000
- $[2] === props.error ? t1 = $[3] : (t1 = /* @__PURE__ */ jsx(QueryErrorDetails, { error: props.error }), $[2] = props.error, $[3] = t1);
2001
- let t2;
2002
- return $[4] !== t0 || $[5] !== t1 ? (t2 = /* @__PURE__ */ jsxs(Stack, {
2003
- gap: 5,
2004
- marginTop: 2,
2005
- children: [t0, t1]
2006
- }), $[4] = t0, $[5] = t1, $[6] = t2) : t2 = $[6], t2;
2052
+ children: error.message
2053
+ }), $[9] = error.message, $[10] = t3);
2054
+ let t4;
2055
+ $[11] === error ? t4 = $[12] : (t4 = /* @__PURE__ */ jsx(QueryErrorDetails, { error }), $[11] = error, $[12] = t4);
2056
+ let t5;
2057
+ return $[13] !== T0 || $[14] !== t0 || $[15] !== t1 || $[16] !== t2 || $[17] !== t3 || $[18] !== t4 ? (t5 = /* @__PURE__ */ jsxs(T0, {
2058
+ gap: t0,
2059
+ marginTop: t1,
2060
+ children: [
2061
+ t2,
2062
+ t3,
2063
+ t4
2064
+ ]
2065
+ }), $[13] = T0, $[14] = t0, $[15] = t1, $[16] = t2, $[17] = t3, $[18] = t4, $[19] = t5) : t5 = $[19], t5;
2007
2066
  }
2008
2067
  var codeFamilyVar = "var(--_1rvgeh0)", codeFontSizeVar = "var(--_1rvgeh1)", codeLineHeightVar = "var(--_1rvgeh2)", resultViewWrapper = "_1rvgehc", space0Var = "var(--_1rvgeh3)", space2Var = "var(--_1rvgeh4)", space4HalfVar = "var(--_1rvgeh6)", space4Var = "var(--_1rvgeh5)", syntaxBooleanVar = "var(--_1rvgeha)", syntaxConstantVar = "var(--_1rvgeh8)", syntaxNumberVar = "var(--_1rvgehb)", syntaxPropertyVar = "var(--_1rvgeh7)", syntaxStringVar = "var(--_1rvgeh9)";
2009
2068
  const lru = new LRU({ maxSize: 5e4 });
@@ -2133,123 +2192,124 @@ function SaveJsonButton(t0) {
2133
2192
  }), $[0] = blobUrl, $[1] = t1), t1;
2134
2193
  }
2135
2194
  function VisionGuiResult(t0) {
2136
- let $ = c(84), { error, queryInProgress, queryResult, listenInProgress, listenMutations, dataset, queryTime, e2eTime, compactFooter: t1 } = t0, compactFooter = t1 !== void 0 && t1, { t } = useTranslation(visionLocaleNamespace), hasResult = !error && !queryInProgress && queryResult !== void 0, t2;
2137
- $[0] !== hasResult || $[1] !== queryResult ? (t2 = hasResult ? getJsonBlobUrl(queryResult) : "", $[0] = hasResult, $[1] = queryResult, $[2] = t2) : t2 = $[2];
2138
- let jsonUrl = t2, t3;
2139
- $[3] !== hasResult || $[4] !== queryResult ? (t3 = hasResult ? getCsvBlobUrl(queryResult) : "", $[3] = hasResult, $[4] = queryResult, $[5] = t3) : t3 = $[5];
2140
- let csvUrl = t3, t4 = error ? "critical" : "default", t5 = !!error, t6;
2141
- $[6] === t ? t6 = $[7] : (t6 = t("result.label"), $[6] = t, $[7] = t6);
2142
- let t7;
2143
- $[8] === t6 ? t7 = $[9] : (t7 = /* @__PURE__ */ jsx(InputBackgroundContainer, { children: /* @__PURE__ */ jsx(Box, {
2195
+ let $ = c(80), { error, apiVersion, perspective, variant, queryInProgress, queryResult, listenInProgress, listenMutations, dataset, queryTime, e2eTime, compactFooter: t1 } = t0, compactFooter = t1 !== void 0 && t1, { t } = useTranslation(visionLocaleNamespace), hasResult = !error && !queryInProgress && queryResult !== void 0, t2 = error ? "critical" : "default", t3 = !!error, t4;
2196
+ $[0] === t ? t4 = $[1] : (t4 = t("result.label"), $[0] = t, $[1] = t4);
2197
+ let t5;
2198
+ $[2] === t4 ? t5 = $[3] : (t5 = /* @__PURE__ */ jsx(InputBackgroundContainer, { children: /* @__PURE__ */ jsx(Box, {
2144
2199
  marginLeft: 3,
2145
2200
  children: /* @__PURE__ */ jsx(StyledLabel, {
2146
2201
  muted: !0,
2147
- children: t6
2202
+ children: t4
2148
2203
  })
2149
- }) }), $[8] = t6, $[9] = t7);
2150
- let t8;
2151
- $[10] !== listenInProgress || $[11] !== listenMutations || $[12] !== queryInProgress ? (t8 = (queryInProgress || listenInProgress && listenMutations.length === 0) && /* @__PURE__ */ jsx(Box, {
2204
+ }) }), $[2] = t4, $[3] = t5);
2205
+ let t6;
2206
+ $[4] !== listenInProgress || $[5] !== listenMutations || $[6] !== queryInProgress ? (t6 = (queryInProgress || listenInProgress && listenMutations.length === 0) && /* @__PURE__ */ jsx(Box, {
2152
2207
  marginTop: 3,
2153
2208
  children: /* @__PURE__ */ jsx(DelayedSpinner, {})
2154
- }), $[10] = listenInProgress, $[11] = listenMutations, $[12] = queryInProgress, $[13] = t8) : t8 = $[13];
2155
- let t9;
2156
- $[14] === error ? t9 = $[15] : (t9 = error && /* @__PURE__ */ jsx(QueryErrorDialog, { error }), $[14] = error, $[15] = t9);
2157
- let t10;
2158
- $[16] !== dataset || $[17] !== hasResult || $[18] !== queryResult ? (t10 = hasResult && /* @__PURE__ */ jsx(ResultView, {
2209
+ }), $[4] = listenInProgress, $[5] = listenMutations, $[6] = queryInProgress, $[7] = t6) : t6 = $[7];
2210
+ let t7;
2211
+ $[8] !== apiVersion || $[9] !== error || $[10] !== perspective || $[11] !== variant ? (t7 = error && /* @__PURE__ */ jsx(QueryErrorDialog, {
2212
+ apiVersion,
2213
+ error,
2214
+ perspective,
2215
+ variant
2216
+ }), $[8] = apiVersion, $[9] = error, $[10] = perspective, $[11] = variant, $[12] = t7) : t7 = $[12];
2217
+ let t8;
2218
+ $[13] !== dataset || $[14] !== hasResult || $[15] !== queryResult ? (t8 = hasResult && /* @__PURE__ */ jsx(ResultView, {
2159
2219
  data: queryResult,
2160
2220
  datasetName: dataset
2161
- }), $[16] = dataset, $[17] = hasResult, $[18] = queryResult, $[19] = t10) : t10 = $[19];
2162
- let t11;
2163
- $[20] !== dataset || $[21] !== listenInProgress || $[22] !== listenMutations ? (t11 = listenInProgress && listenMutations.length > 0 && /* @__PURE__ */ jsx(ResultView, {
2221
+ }), $[13] = dataset, $[14] = hasResult, $[15] = queryResult, $[16] = t8) : t8 = $[16];
2222
+ let t9;
2223
+ $[17] !== dataset || $[18] !== listenInProgress || $[19] !== listenMutations ? (t9 = listenInProgress && listenMutations.length > 0 && /* @__PURE__ */ jsx(ResultView, {
2164
2224
  data: listenMutations,
2165
2225
  datasetName: dataset
2166
- }), $[20] = dataset, $[21] = listenInProgress, $[22] = listenMutations, $[23] = t11) : t11 = $[23];
2167
- let t12;
2168
- $[24] !== t10 || $[25] !== t11 || $[26] !== t8 || $[27] !== t9 ? (t12 = /* @__PURE__ */ jsxs(Box, {
2226
+ }), $[17] = dataset, $[18] = listenInProgress, $[19] = listenMutations, $[20] = t9) : t9 = $[20];
2227
+ let t10;
2228
+ $[21] !== t6 || $[22] !== t7 || $[23] !== t8 || $[24] !== t9 ? (t10 = /* @__PURE__ */ jsxs(Box, {
2169
2229
  padding: 3,
2170
2230
  paddingTop: 5,
2171
2231
  children: [
2232
+ t6,
2233
+ t7,
2172
2234
  t8,
2173
- t9,
2174
- t10,
2175
- t11
2235
+ t9
2176
2236
  ]
2177
- }), $[24] = t10, $[25] = t11, $[26] = t8, $[27] = t9, $[28] = t12) : t12 = $[28];
2178
- let t13;
2179
- $[29] !== t12 || $[30] !== t7 ? (t13 = /* @__PURE__ */ jsxs(Result, {
2237
+ }), $[21] = t6, $[22] = t7, $[23] = t8, $[24] = t9, $[25] = t10) : t10 = $[25];
2238
+ let t11;
2239
+ $[26] !== t10 || $[27] !== t5 ? (t11 = /* @__PURE__ */ jsxs(Result, {
2180
2240
  overflow: "auto",
2181
- children: [t7, t12]
2182
- }), $[29] = t12, $[30] = t7, $[31] = t13) : t13 = $[31];
2183
- let t14;
2184
- $[32] !== t13 || $[33] !== t4 || $[34] !== t5 ? (t14 = /* @__PURE__ */ jsx(ResultInnerContainer, {
2241
+ children: [t5, t10]
2242
+ }), $[26] = t10, $[27] = t5, $[28] = t11) : t11 = $[28];
2243
+ let t12;
2244
+ $[29] !== t11 || $[30] !== t2 || $[31] !== t3 ? (t12 = /* @__PURE__ */ jsx(ResultInnerContainer, {
2185
2245
  flexBasis: "0%",
2186
2246
  flexGrow: 1,
2187
2247
  children: /* @__PURE__ */ jsx(ResultContainer, {
2188
2248
  flex: 1,
2189
2249
  overflow: "hidden",
2190
- tone: t4,
2191
- isInvalid: t5,
2192
- children: t13
2250
+ tone: t2,
2251
+ isInvalid: t3,
2252
+ children: t11
2193
2253
  })
2194
- }), $[32] = t13, $[33] = t4, $[34] = t5, $[35] = t14) : t14 = $[35];
2195
- let t15 = compactFooter ? "flex-start" : "space-between", t16 = compactFooter ? "stretch" : void 0, t17;
2196
- $[36] === compactFooter ? t17 = $[37] : (t17 = compactFooter ? "column" : [
2254
+ }), $[29] = t11, $[30] = t2, $[31] = t3, $[32] = t12) : t12 = $[32];
2255
+ let t13 = compactFooter ? "flex-start" : "space-between", t14 = compactFooter ? "stretch" : void 0, t15;
2256
+ $[33] === compactFooter ? t15 = $[34] : (t15 = compactFooter ? "column" : [
2197
2257
  "column",
2198
2258
  "column",
2199
2259
  "row"
2200
- ], $[36] = compactFooter, $[37] = t17);
2201
- let t18 = compactFooter ? 3 : 4, t19 = compactFooter ? 2 : 3, t20;
2202
- $[38] === compactFooter ? t20 = $[39] : (t20 = compactFooter ? { width: "100%" } : { minWidth: 0 }, $[38] = compactFooter, $[39] = t20);
2203
- let t21 = compactFooter ? 1 : 2, t22;
2204
- $[40] === t ? t22 = $[41] : (t22 = t("result.execution-time-label"), $[40] = t, $[41] = t22);
2205
- let t23;
2206
- $[42] !== queryTime || $[43] !== t ? (t23 = typeof queryTime == "number" ? `${queryTime}ms` : t("result.timing-not-applicable"), $[42] = queryTime, $[43] = t, $[44] = t23) : t23 = $[44];
2207
- let t24;
2208
- $[45] !== t21 || $[46] !== t22 || $[47] !== t23 ? (t24 = /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, {
2260
+ ], $[33] = compactFooter, $[34] = t15);
2261
+ let t16 = compactFooter ? 3 : 4, t17 = compactFooter ? 2 : 3, t18;
2262
+ $[35] === compactFooter ? t18 = $[36] : (t18 = compactFooter ? { width: "100%" } : { minWidth: 0 }, $[35] = compactFooter, $[36] = t18);
2263
+ let t19 = compactFooter ? 1 : 2, t20;
2264
+ $[37] === t ? t20 = $[38] : (t20 = t("result.execution-time-label"), $[37] = t, $[38] = t20);
2265
+ let t21;
2266
+ $[39] !== queryTime || $[40] !== t ? (t21 = typeof queryTime == "number" ? `${queryTime}ms` : t("result.timing-not-applicable"), $[39] = queryTime, $[40] = t, $[41] = t21) : t21 = $[41];
2267
+ let t22;
2268
+ $[42] !== t19 || $[43] !== t20 || $[44] !== t21 ? (t22 = /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, {
2209
2269
  muted: !0,
2210
- size: t21,
2270
+ size: t19,
2211
2271
  children: [
2212
- t22,
2272
+ t20,
2213
2273
  ":",
2214
2274
  " ",
2215
- t23
2275
+ t21
2216
2276
  ]
2217
- }) }), $[45] = t21, $[46] = t22, $[47] = t23, $[48] = t24) : t24 = $[48];
2218
- let t25 = compactFooter ? 3 : 4, t26 = compactFooter ? 1 : 2, t27;
2219
- $[49] === t ? t27 = $[50] : (t27 = t("result.end-to-end-time-label"), $[49] = t, $[50] = t27);
2220
- let t28;
2221
- $[51] !== e2eTime || $[52] !== t ? (t28 = typeof e2eTime == "number" ? `${e2eTime}ms` : t("result.timing-not-applicable"), $[51] = e2eTime, $[52] = t, $[53] = t28) : t28 = $[53];
2222
- let t29;
2223
- $[54] !== t26 || $[55] !== t27 || $[56] !== t28 ? (t29 = /* @__PURE__ */ jsxs(Text, {
2277
+ }) }), $[42] = t19, $[43] = t20, $[44] = t21, $[45] = t22) : t22 = $[45];
2278
+ let t23 = compactFooter ? 3 : 4, t24 = compactFooter ? 1 : 2, t25;
2279
+ $[46] === t ? t25 = $[47] : (t25 = t("result.end-to-end-time-label"), $[46] = t, $[47] = t25);
2280
+ let t26;
2281
+ $[48] !== e2eTime || $[49] !== t ? (t26 = typeof e2eTime == "number" ? `${e2eTime}ms` : t("result.timing-not-applicable"), $[48] = e2eTime, $[49] = t, $[50] = t26) : t26 = $[50];
2282
+ let t27;
2283
+ $[51] !== t24 || $[52] !== t25 || $[53] !== t26 ? (t27 = /* @__PURE__ */ jsxs(Text, {
2224
2284
  muted: !0,
2225
- size: t26,
2285
+ size: t24,
2226
2286
  children: [
2227
- t27,
2287
+ t25,
2228
2288
  ":",
2229
2289
  " ",
2230
- t28
2290
+ t26
2231
2291
  ]
2232
- }), $[54] = t26, $[55] = t27, $[56] = t28, $[57] = t29) : t29 = $[57];
2292
+ }), $[51] = t24, $[52] = t25, $[53] = t26, $[54] = t27) : t27 = $[54];
2293
+ let t28;
2294
+ $[55] !== t23 || $[56] !== t27 ? (t28 = /* @__PURE__ */ jsx(Box, {
2295
+ marginLeft: t23,
2296
+ children: t27
2297
+ }), $[55] = t23, $[56] = t27, $[57] = t28) : t28 = $[57];
2298
+ let t29;
2299
+ $[58] !== t22 || $[59] !== t28 ? (t29 = /* @__PURE__ */ jsxs(TimingsTextContainer, {
2300
+ align: "center",
2301
+ children: [t22, t28]
2302
+ }), $[58] = t22, $[59] = t28, $[60] = t29) : t29 = $[60];
2233
2303
  let t30;
2234
- $[58] !== t25 || $[59] !== t29 ? (t30 = /* @__PURE__ */ jsx(Box, {
2235
- marginLeft: t25,
2304
+ $[61] !== t16 || $[62] !== t17 || $[63] !== t18 || $[64] !== t29 ? (t30 = /* @__PURE__ */ jsx(TimingsCard, {
2305
+ paddingX: t16,
2306
+ paddingY: t17,
2307
+ sizing: "border",
2308
+ style: t18,
2236
2309
  children: t29
2237
- }), $[58] = t25, $[59] = t29, $[60] = t30) : t30 = $[60];
2310
+ }), $[61] = t16, $[62] = t17, $[63] = t18, $[64] = t29, $[65] = t30) : t30 = $[65];
2238
2311
  let t31;
2239
- $[61] !== t24 || $[62] !== t30 ? (t31 = /* @__PURE__ */ jsxs(TimingsTextContainer, {
2240
- align: "center",
2241
- children: [t24, t30]
2242
- }), $[61] = t24, $[62] = t30, $[63] = t31) : t31 = $[63];
2243
- let t32;
2244
- $[64] !== t18 || $[65] !== t19 || $[66] !== t20 || $[67] !== t31 ? (t32 = /* @__PURE__ */ jsx(TimingsCard, {
2245
- paddingX: t18,
2246
- paddingY: t19,
2247
- sizing: "border",
2248
- style: t20,
2249
- children: t31
2250
- }), $[64] = t18, $[65] = t19, $[66] = t20, $[67] = t31, $[68] = t32) : t32 = $[68];
2251
- let t33;
2252
- $[69] !== compactFooter || $[70] !== csvUrl || $[71] !== hasResult || $[72] !== jsonUrl || $[73] !== t ? (t33 = hasResult && /* @__PURE__ */ jsx(DownloadsCard, {
2312
+ $[66] !== compactFooter || $[67] !== hasResult || $[68] !== queryResult || $[69] !== t ? (t31 = hasResult && /* @__PURE__ */ jsx(DownloadsCard, {
2253
2313
  paddingX: compactFooter ? 3 : 4,
2254
2314
  paddingY: compactFooter ? 2 : 3,
2255
2315
  sizing: "border",
@@ -2261,32 +2321,45 @@ function VisionGuiResult(t0) {
2261
2321
  muted: !0,
2262
2322
  size: compactFooter ? 1 : 2,
2263
2323
  children: /* @__PURE__ */ jsx(Translate, {
2264
- components: { SaveResultButtons: () => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(SaveJsonButton, { blobUrl: jsonUrl }), /* @__PURE__ */ jsx(SaveCsvButton, { blobUrl: csvUrl })] }) },
2324
+ components: { SaveResultButtons },
2325
+ componentProps: { queryResult },
2265
2326
  i18nKey: "result.save-result-as-format",
2266
2327
  t
2267
2328
  })
2268
2329
  })
2269
- }), $[69] = compactFooter, $[70] = csvUrl, $[71] = hasResult, $[72] = jsonUrl, $[73] = t, $[74] = t33) : t33 = $[74];
2270
- let t34;
2271
- $[75] !== t15 || $[76] !== t16 || $[77] !== t17 || $[78] !== t32 || $[79] !== t33 ? (t34 = /* @__PURE__ */ jsxs(ResultFooter, {
2272
- justify: t15,
2273
- align: t16,
2274
- direction: t17,
2275
- children: [t32, t33]
2276
- }), $[75] = t15, $[76] = t16, $[77] = t17, $[78] = t32, $[79] = t33, $[80] = t34) : t34 = $[80];
2277
- let t35;
2278
- return $[81] !== t14 || $[82] !== t34 ? (t35 = /* @__PURE__ */ jsxs(ResultOuterContainer, {
2330
+ }), $[66] = compactFooter, $[67] = hasResult, $[68] = queryResult, $[69] = t, $[70] = t31) : t31 = $[70];
2331
+ let t32;
2332
+ $[71] !== t13 || $[72] !== t14 || $[73] !== t15 || $[74] !== t30 || $[75] !== t31 ? (t32 = /* @__PURE__ */ jsxs(ResultFooter, {
2333
+ justify: t13,
2334
+ align: t14,
2335
+ direction: t15,
2336
+ children: [t30, t31]
2337
+ }), $[71] = t13, $[72] = t14, $[73] = t15, $[74] = t30, $[75] = t31, $[76] = t32) : t32 = $[76];
2338
+ let t33;
2339
+ return $[77] !== t12 || $[78] !== t32 ? (t33 = /* @__PURE__ */ jsxs(ResultOuterContainer, {
2279
2340
  direction: "column",
2280
2341
  "data-testid": "vision-result",
2281
- children: [t14, t34]
2282
- }), $[81] = t14, $[82] = t34, $[83] = t35) : t35 = $[83], t35;
2342
+ children: [t12, t32]
2343
+ }), $[77] = t12, $[78] = t32, $[79] = t33) : t33 = $[79], t33;
2344
+ }
2345
+ function SaveResultButtons(t0) {
2346
+ let $ = c(11), { queryResult } = t0, t1;
2347
+ $[0] === queryResult ? t1 = $[1] : (t1 = getJsonBlobUrl(queryResult), $[0] = queryResult, $[1] = t1);
2348
+ let jsonUrl = t1, t2;
2349
+ $[2] === queryResult ? t2 = $[3] : (t2 = getCsvBlobUrl(queryResult), $[2] = queryResult, $[3] = t2);
2350
+ let csvUrl = t2, t3;
2351
+ $[4] === jsonUrl ? t3 = $[5] : (t3 = /* @__PURE__ */ jsx(SaveJsonButton, { blobUrl: jsonUrl }), $[4] = jsonUrl, $[5] = t3);
2352
+ let t4;
2353
+ $[6] === csvUrl ? t4 = $[7] : (t4 = /* @__PURE__ */ jsx(SaveCsvButton, { blobUrl: csvUrl }), $[6] = csvUrl, $[7] = t4);
2354
+ let t5;
2355
+ return $[8] !== t3 || $[9] !== t4 ? (t5 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t3, t4] }), $[8] = t3, $[9] = t4, $[10] = t5) : t5 = $[10], t5;
2283
2356
  }
2284
2357
  function nodeContains(node, other) {
2285
2358
  return !node || !other ? !1 : node === other || !!(node.compareDocumentPosition(other) & 16);
2286
2359
  }
2287
2360
  const sanityUrl = /\/(vX|v1|v\d{4}-\d\d-\d\d)\/.*?(?:query|listen)\/(.*?)\?(.*)/, VARIANTS_API_VERSION = prefixApiVersion(VARIANTS_STUDIO_CLIENT_OPTIONS.apiVersion), isRunHotkey = (event) => isHotkey("ctrl+enter", event) || isHotkey("mod+enter", event);
2288
2361
  function VisionGui(props) {
2289
- let $ = c(225), { datasets, config, projectId, defaultDataset } = props, toast = useToast(), { t } = useTranslation(visionLocaleNamespace), { perspectiveStack, selectedVariantName } = usePerspective(), isScheduledDraftsEnabled = useScheduledDraftsEnabled(), { data: t0 } = useActiveReleases(), t1;
2362
+ let $ = c(232), { datasets, config, projectId, defaultDataset } = props, toast = useToast(), { t } = useTranslation(visionLocaleNamespace), { perspectiveStack, selectedVariantName } = usePerspective(), isScheduledDraftsEnabled = useScheduledDraftsEnabled(), { data: t0 } = useActiveReleases(), t1;
2290
2363
  $[0] === t0 ? t1 = $[1] : (t1 = t0 === void 0 ? [] : t0, $[0] = t0, $[1] = t1);
2291
2364
  let releases = t1, isDraftModelEnabled = useWorkspace().document.drafts.enabled, editorQueryRef = useRef(null), editorParamsRef = useRef(null), visionRootRef = useRef(null), customApiVersionElementRef = useRef(null), querySubscriptionRef = useRef(void 0), listenSubscriptionRef = useRef(void 0), t2;
2292
2365
  $[2] === projectId ? t2 = $[3] : (t2 = () => getLocalStorage(projectId || "default"), $[2] = projectId, $[3] = t2);
@@ -2625,8 +2698,17 @@ function VisionGui(props) {
2625
2698
  })
2626
2699
  }), $[176] = paneSizeOptions.allowResize, $[177] = paneSizeOptions.maxSize, $[178] = paneSizeOptions.size, $[179] = t52, $[180] = t55, $[181] = t60, $[182] = t63, $[183] = t64) : t64 = $[183];
2627
2700
  let t65;
2628
- $[184] !== dataset || $[185] !== e2eTime || $[186] !== error || $[187] !== listenInProgress || $[188] !== listenMutations || $[189] !== queryInProgress || $[190] !== queryResult || $[191] !== queryTime ? (t65 = /* @__PURE__ */ jsx(VisionGuiResult, {
2701
+ $[184] !== perspective || $[185] !== perspectiveStack || $[186] !== scheduledDraftsStack ? (t65 = getActivePerspective({
2702
+ visionPerspective: perspective,
2703
+ perspectiveStack,
2704
+ scheduledDraftsStack
2705
+ }), $[184] = perspective, $[185] = perspectiveStack, $[186] = scheduledDraftsStack, $[187] = t65) : t65 = $[187];
2706
+ let t66;
2707
+ $[188] !== activeVariant || $[189] !== dataset || $[190] !== e2eTime || $[191] !== error || $[192] !== listenInProgress || $[193] !== listenMutations || $[194] !== queryInProgress || $[195] !== queryResult || $[196] !== queryTime || $[197] !== t65 || $[198] !== userApiVersion ? (t66 = /* @__PURE__ */ jsx(VisionGuiResult, {
2629
2708
  error,
2709
+ apiVersion: userApiVersion,
2710
+ perspective: t65,
2711
+ variant: activeVariant,
2630
2712
  queryInProgress,
2631
2713
  queryResult,
2632
2714
  listenInProgress,
@@ -2634,9 +2716,9 @@ function VisionGui(props) {
2634
2716
  dataset,
2635
2717
  queryTime,
2636
2718
  e2eTime
2637
- }), $[184] = dataset, $[185] = e2eTime, $[186] = error, $[187] = listenInProgress, $[188] = listenMutations, $[189] = queryInProgress, $[190] = queryResult, $[191] = queryTime, $[192] = t65) : t65 = $[192];
2638
- let t66;
2639
- $[193] !== t51 || $[194] !== t64 || $[195] !== t65 ? (t66 = /* @__PURE__ */ jsx(Box, {
2719
+ }), $[188] = activeVariant, $[189] = dataset, $[190] = e2eTime, $[191] = error, $[192] = listenInProgress, $[193] = listenMutations, $[194] = queryInProgress, $[195] = queryResult, $[196] = queryTime, $[197] = t65, $[198] = userApiVersion, $[199] = t66) : t66 = $[199];
2720
+ let t67;
2721
+ $[200] !== t51 || $[201] !== t64 || $[202] !== t66 ? (t67 = /* @__PURE__ */ jsx(Box, {
2640
2722
  height: "stretch",
2641
2723
  flexBasis: "0%",
2642
2724
  flexGrow: 1,
@@ -2644,54 +2726,54 @@ function VisionGui(props) {
2644
2726
  className: "sidebarPanes",
2645
2727
  split: t51,
2646
2728
  minSize: 300,
2647
- children: [t64, t65]
2729
+ children: [t64, t66]
2648
2730
  })
2649
- }), $[193] = t51, $[194] = t64, $[195] = t65, $[196] = t66) : t66 = $[196];
2650
- let t67;
2651
- $[197] === Symbol.for("react.memo_cache_sentinel") ? (t67 = {
2731
+ }), $[200] = t51, $[201] = t64, $[202] = t66, $[203] = t67) : t67 = $[203];
2732
+ let t68;
2733
+ $[204] === Symbol.for("react.memo_cache_sentinel") ? (t68 = {
2652
2734
  position: "absolute",
2653
2735
  left: -32,
2654
2736
  top: "50%",
2655
2737
  transform: "translateY(-50%)",
2656
2738
  zIndex: 100,
2657
2739
  pointerEvents: "auto"
2658
- }, $[197] = t67) : t67 = $[197];
2659
- let t68;
2660
- $[198] === isQueryRecallCollapsed ? t68 = $[199] : (t68 = () => setIsQueryRecallCollapsed(!isQueryRecallCollapsed), $[198] = isQueryRecallCollapsed, $[199] = t68);
2740
+ }, $[204] = t68) : t68 = $[204];
2661
2741
  let t69;
2662
- $[200] === Symbol.for("react.memo_cache_sentinel") ? (t69 = {
2742
+ $[205] === isQueryRecallCollapsed ? t69 = $[206] : (t69 = () => setIsQueryRecallCollapsed(!isQueryRecallCollapsed), $[205] = isQueryRecallCollapsed, $[206] = t69);
2743
+ let t70;
2744
+ $[207] === Symbol.for("react.memo_cache_sentinel") ? (t70 = {
2663
2745
  display: "flex",
2664
2746
  alignItems: "center",
2665
2747
  height: "100%"
2666
- }, $[200] = t69) : t69 = $[200];
2667
- let t70;
2668
- $[201] === isQueryRecallCollapsed ? t70 = $[202] : (t70 = /* @__PURE__ */ jsx("div", {
2669
- style: t69,
2670
- children: jsx(isQueryRecallCollapsed ? ChevronLeftIcon : ChevronRightIcon, {})
2671
- }), $[201] = isQueryRecallCollapsed, $[202] = t70);
2748
+ }, $[207] = t70) : t70 = $[207];
2672
2749
  let t71;
2673
- $[203] !== t68 || $[204] !== t70 ? (t71 = /* @__PURE__ */ jsx(Button, {
2750
+ $[208] === isQueryRecallCollapsed ? t71 = $[209] : (t71 = /* @__PURE__ */ jsx("div", {
2751
+ style: t70,
2752
+ children: jsx(isQueryRecallCollapsed ? ChevronLeftIcon : ChevronRightIcon, {})
2753
+ }), $[208] = isQueryRecallCollapsed, $[209] = t71);
2754
+ let t72;
2755
+ $[210] !== t69 || $[211] !== t71 ? (t72 = /* @__PURE__ */ jsx(Button, {
2674
2756
  mode: "ghost",
2675
2757
  padding: 2,
2676
- style: t67,
2677
- onClick: t68,
2678
- children: t70
2679
- }), $[203] = t68, $[204] = t70, $[205] = t71) : t71 = $[205];
2680
- let t72;
2681
- $[206] === params.parsed ? t72 = $[207] : (t72 = params.parsed || {}, $[206] = params.parsed, $[207] = t72);
2758
+ style: t68,
2759
+ onClick: t69,
2760
+ children: t71
2761
+ }), $[210] = t69, $[211] = t71, $[212] = t72) : t72 = $[212];
2682
2762
  let t73;
2683
- $[208] !== generateUrl || $[209] !== getStateFromUrl || $[210] !== query || $[211] !== setStateFromParsedUrl || $[212] !== t72 || $[213] !== url ? (t73 = /* @__PURE__ */ jsx(QueryRecallPaneWrapper, { children: /* @__PURE__ */ jsx(QueryRecall, {
2763
+ $[213] === params.parsed ? t73 = $[214] : (t73 = params.parsed || {}, $[213] = params.parsed, $[214] = t73);
2764
+ let t74;
2765
+ $[215] !== generateUrl || $[216] !== getStateFromUrl || $[217] !== query || $[218] !== setStateFromParsedUrl || $[219] !== t73 || $[220] !== url ? (t74 = /* @__PURE__ */ jsx(QueryRecallPaneWrapper, { children: /* @__PURE__ */ jsx(QueryRecall, {
2684
2766
  url,
2685
2767
  getStateFromUrl,
2686
2768
  setStateFromParsedUrl,
2687
2769
  currentQuery: query,
2688
- currentParams: t72,
2770
+ currentParams: t73,
2689
2771
  generateUrl
2690
- }) }), $[208] = generateUrl, $[209] = getStateFromUrl, $[210] = query, $[211] = setStateFromParsedUrl, $[212] = t72, $[213] = url, $[214] = t73) : t73 = $[214];
2691
- let t74;
2692
- $[215] !== t71 || $[216] !== t73 ? (t74 = /* @__PURE__ */ jsxs(QueryRecallPaneContainer, { children: [t71, t73] }), $[215] = t71, $[216] = t73, $[217] = t74) : t74 = $[217];
2772
+ }) }), $[215] = generateUrl, $[216] = getStateFromUrl, $[217] = query, $[218] = setStateFromParsedUrl, $[219] = t73, $[220] = url, $[221] = t74) : t74 = $[221];
2693
2773
  let t75;
2694
- $[218] !== t50 || $[219] !== t66 || $[220] !== t74 ? (t75 = /* @__PURE__ */ jsx(SplitpaneContainer, {
2774
+ $[222] !== t72 || $[223] !== t74 ? (t75 = /* @__PURE__ */ jsxs(QueryRecallPaneContainer, { children: [t72, t74] }), $[222] = t72, $[223] = t74, $[224] = t75) : t75 = $[224];
2775
+ let t76;
2776
+ $[225] !== t50 || $[226] !== t67 || $[227] !== t75 ? (t76 = /* @__PURE__ */ jsx(SplitpaneContainer, {
2695
2777
  flexBasis: "auto",
2696
2778
  flexGrow: 1,
2697
2779
  flexShrink: 1,
@@ -2701,19 +2783,19 @@ function VisionGui(props) {
2701
2783
  size: t50,
2702
2784
  maxSize: -225,
2703
2785
  primary: "first",
2704
- children: [t66, t74]
2786
+ children: [t67, t75]
2705
2787
  })
2706
- }), $[218] = t50, $[219] = t66, $[220] = t74, $[221] = t75) : t75 = $[221];
2707
- let t76;
2708
- return $[222] !== t49 || $[223] !== t75 ? (t76 = /* @__PURE__ */ jsxs(Root, {
2788
+ }), $[225] = t50, $[226] = t67, $[227] = t75, $[228] = t76) : t76 = $[228];
2789
+ let t77;
2790
+ return $[229] !== t49 || $[230] !== t76 ? (t77 = /* @__PURE__ */ jsxs(Root, {
2709
2791
  direction: "column",
2710
2792
  height: "fill",
2711
2793
  ref: visionRootRef,
2712
2794
  sizing: "border",
2713
2795
  overflow: "hidden",
2714
2796
  "data-testid": "vision-root",
2715
- children: [t49, t75]
2716
- }), $[222] = t49, $[223] = t75, $[224] = t76) : t76 = $[224], t76;
2797
+ children: [t49, t76]
2798
+ }), $[229] = t49, $[230] = t76, $[231] = t77) : t77 = $[231], t77;
2717
2799
  }
2718
2800
  function _temp2$1(release_0) {
2719
2801
  return getReleaseIdFromReleaseDocumentId(release_0._id);
@@ -2870,4 +2952,4 @@ function SanityVision(props) {
2870
2952
  }
2871
2953
  export { SanityVision as default };
2872
2954
 
2873
- //# sourceMappingURL=SanityVision-ChQxkYFr.js.map
2955
+ //# sourceMappingURL=SanityVision-II_F9zA2.js.map