gt-sanity 2.0.13 → 2.0.15

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,25 +1,14 @@
1
- import { documentInternationalization } from "@sanity/document-internationalization";
2
- import { DocumentInternationalizationMenu, documentInternationalization as documentInternationalization2, useDeleteTranslationAction, useDocumentInternationalizationContext, useDuplicateWithTranslationsAction } from "@sanity/document-internationalization";
3
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
4
- import { ThemeProvider, ToastProvider, Box, Flex, Spinner, Card, Text, useToast, Label, Grid, Button, Switch, Stack, Tooltip, Dialog, Container, Heading } from "@sanity/ui";
5
- import { buildTheme } from "@sanity/ui/theme";
6
- import o, { useState, useEffect, createContext, useRef, useCallback, useContext, useDebugValue, createElement, useMemo } from "react";
7
- import { useClient as useClient$1, useSchema, definePlugin } from "sanity";
8
- import { GT, getLocaleProperties } from "generaltranslation";
9
- import { libraryDefaultLocale } from "generaltranslation/internal";
10
- import { htmlToBlocks } from "@portabletext/block-tools";
11
- import { Schema } from "@sanity/schema";
12
- import { toHTML } from "@portabletext/to-html";
13
- import merge from "lodash.merge";
14
- import { JSONPath } from "jsonpath-plus";
15
- import JSONPointer from "jsonpointer";
16
- import { extractWithPath, arrayToJSONMatchPath } from "@sanity/mutator";
17
- import { CheckmarkCircleIcon, DownloadIcon, LinkIcon, PublishIcon, TranslateIcon } from "@sanity/icons";
18
- import { Link, route } from "sanity/router";
19
- const useClient = () => useClient$1({ apiVersion: "2025-09-15" });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: !0 });
3
+ var documentInternationalization = require("@sanity/document-internationalization"), jsxRuntime = require("react/jsx-runtime"), ui = require("@sanity/ui"), theme$1 = require("@sanity/ui/theme"), o = require("react"), sanity = require("sanity"), generaltranslation = require("generaltranslation"), internal = require("generaltranslation/internal"), blockTools = require("@portabletext/block-tools"), schema = require("@sanity/schema"), toHtml = require("@portabletext/to-html"), merge = require("lodash.merge"), jsonpathPlus = require("jsonpath-plus"), JSONPointer = require("jsonpointer"), mutator = require("@sanity/mutator"), icons = require("@sanity/icons"), router = require("sanity/router");
4
+ function _interopDefaultCompat(e) {
5
+ return e && typeof e == "object" && "default" in e ? e : { default: e };
6
+ }
7
+ var o__default = /* @__PURE__ */ _interopDefaultCompat(o), merge__default = /* @__PURE__ */ _interopDefaultCompat(merge), JSONPointer__default = /* @__PURE__ */ _interopDefaultCompat(JSONPointer);
8
+ const useClient = () => sanity.useClient({ apiVersion: "2025-09-15" });
20
9
  function useSecrets(id) {
21
- const [loading, setLoading] = useState(!0), [secrets, setSecrets] = useState(null), client = useClient();
22
- return useEffect(() => {
10
+ const [loading, setLoading] = o.useState(!0), [secrets, setSecrets] = o.useState(null), client = useClient();
11
+ return o.useEffect(() => {
23
12
  function fetchData() {
24
13
  client.fetch("* [_id == $id][0]", { id }).then((doc) => {
25
14
  const result = {};
@@ -31,7 +20,7 @@ function useSecrets(id) {
31
20
  fetchData();
32
21
  }, [id, client]), { loading, secrets };
33
22
  }
34
- const SECRETS_NAMESPACE = "generaltranslation.secrets", gt = new GT();
23
+ const SECRETS_NAMESPACE = "generaltranslation.secrets", gt = new generaltranslation.GT();
35
24
  function overrideConfig(secrets) {
36
25
  gt.setConfig({
37
26
  ...secrets?.project && { projectId: secrets?.project },
@@ -61,7 +50,7 @@ class GTConfig {
61
50
  return this.instance || (this.instance = new GTConfig(
62
51
  SECRETS_NAMESPACE,
63
52
  "language",
64
- gt.sourceLocale || libraryDefaultLocale,
53
+ gt.sourceLocale || internal.libraryDefaultLocale,
65
54
  [],
66
55
  [],
67
56
  () => "",
@@ -121,18 +110,18 @@ class GTConfig {
121
110
  return this.additionalBlockDeserializers;
122
111
  }
123
112
  }
124
- const pluginConfig = GTConfig.getInstance(), theme = buildTheme(), BaseTranslationWrapper = ({
113
+ const pluginConfig = GTConfig.getInstance(), theme = theme$1.buildTheme(), BaseTranslationWrapper = ({
125
114
  children,
126
115
  secretsNamespace = pluginConfig.getSecretsNamespace(),
127
116
  padding = 4,
128
117
  showContainer = !0
129
118
  }) => {
130
- const { loading: loadingSecrets, secrets } = useSecrets(secretsNamespace), content = /* @__PURE__ */ jsxs(Fragment, { children: [
131
- loadingSecrets && /* @__PURE__ */ jsx(Flex, { padding: 5, align: "center", justify: "center", children: /* @__PURE__ */ jsx(Spinner, {}) }),
132
- !loadingSecrets && !secrets && /* @__PURE__ */ jsx(Box, { padding, children: /* @__PURE__ */ jsx(Card, { tone: "caution", padding: [2, 3, 4, 4], shadow: 1, radius: 2, children: /* @__PURE__ */ jsx(Text, { children: "Can't find secrets for your translation service. Did you load them into this dataset?" }) }) }),
119
+ const { loading: loadingSecrets, secrets } = useSecrets(secretsNamespace), content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
120
+ loadingSecrets && /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { padding: 5, align: "center", justify: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, {}) }),
121
+ !loadingSecrets && !secrets && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { tone: "caution", padding: [2, 3, 4, 4], shadow: 1, radius: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Can't find secrets for your translation service. Did you load them into this dataset?" }) }) }),
133
122
  !loadingSecrets && secrets && children
134
123
  ] });
135
- return /* @__PURE__ */ jsx(ThemeProvider, { theme, children: /* @__PURE__ */ jsx(ToastProvider, { paddingY: 7, children: showContainer ? /* @__PURE__ */ jsx(Box, { padding, children: content }) : content }) });
124
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.ThemeProvider, { theme, children: /* @__PURE__ */ jsxRuntime.jsx(ui.ToastProvider, { paddingY: 7, children: showContainer ? /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding, children: content }) : content }) });
136
125
  }, reconcileArray = (origArray, translatedArray) => {
137
126
  if (translatedArray && translatedArray.some((el) => typeof el == "string"))
138
127
  return translatedArray;
@@ -163,12 +152,12 @@ const pluginConfig = GTConfig.getInstance(), theme = buildTheme(), BaseTranslati
163
152
  const merged = {};
164
153
  return ["_rev", "_id", "_type"].forEach((metaKey) => {
165
154
  translatedFields[metaKey] && (merged[metaKey] = translatedFields[metaKey]);
166
- }), extractWithPath(`..${baseLang}`, translatedFields).forEach((match2) => {
167
- const origVal = extractWithPath(
168
- arrayToJSONMatchPath(match2.path),
155
+ }), mutator.extractWithPath(`..${baseLang}`, translatedFields).forEach((match2) => {
156
+ const origVal = mutator.extractWithPath(
157
+ mutator.arrayToJSONMatchPath(match2.path),
169
158
  baseDoc
170
- )[0].value, translatedVal = extractWithPath(
171
- arrayToJSONMatchPath(match2.path),
159
+ )[0].value, translatedVal = mutator.extractWithPath(
160
+ mutator.arrayToJSONMatchPath(match2.path),
172
161
  translatedFields
173
162
  )[0].value;
174
163
  let valToPatch;
@@ -182,14 +171,14 @@ const pluginConfig = GTConfig.getInstance(), theme = buildTheme(), BaseTranslati
182
171
  localeId.replace("-", "_")
183
172
  // replace it with our locale
184
173
  ];
185
- merged[arrayToJSONMatchPath(destinationPath)] = valToPatch;
174
+ merged[mutator.arrayToJSONMatchPath(destinationPath)] = valToPatch;
186
175
  }), merged;
187
176
  }, documentLevelMerge = (translatedFields, baseDoc) => reconcileObject(baseDoc, translatedFields), BaseDocumentMerger = {
188
177
  fieldLevelMerge,
189
178
  documentLevelMerge,
190
179
  reconcileArray,
191
180
  reconcileObject
192
- }, defaultSchema = Schema.compile({
181
+ }, defaultSchema = schema.Schema.compile({
193
182
  name: "default",
194
183
  types: [
195
184
  {
@@ -205,7 +194,7 @@ const pluginConfig = GTConfig.getInstance(), theme = buildTheme(), BaseTranslati
205
194
  }
206
195
  ]
207
196
  }), blockContentType = defaultSchema.get("default").fields.find((field) => field.name === "block").type, preprocess = (html) => {
208
- const intermediateBlocks = htmlToBlocks(
197
+ const intermediateBlocks = blockTools.htmlToBlocks(
209
198
  `<p>${html}</p>`,
210
199
  blockContentType
211
200
  );
@@ -297,7 +286,7 @@ const defaultStopTypes = [
297
286
  deserialize(el, next2) {
298
287
  if (!el.hasChildNodes() || !el.getAttribute("data-gt-internal"))
299
288
  return;
300
- const { html, data } = detachGTData(el.outerHTML), block = htmlToBlocks(html, blockContentType)[0], children = next2(el.childNodes);
289
+ const { html, data } = detachGTData(el.outerHTML), block = blockTools.htmlToBlocks(html, blockContentType)[0], children = next2(el.childNodes);
301
290
  let markDefs = [];
302
291
  return "markDefs" in block && (markDefs = block.markDefs ?? []), data?.markDef && markDefs.push(data.markDef), children && children.forEach((child) => {
303
292
  child.marks = data?.markDef?._key ? [...child.marks || [], data.markDef._key] : [...child.marks || []];
@@ -315,7 +304,7 @@ const defaultStopTypes = [
315
304
  return;
316
305
  const style = el.getAttribute("data-style") ?? "";
317
306
  return {
318
- ...htmlToBlocks(el.outerHTML, blockContentType)[0],
307
+ ...blockTools.htmlToBlocks(el.outerHTML, blockContentType)[0],
319
308
  style,
320
309
  children: next2(el.childNodes)
321
310
  };
@@ -336,10 +325,10 @@ const defaultStopTypes = [
336
325
  if (!listItem)
337
326
  return;
338
327
  const level = el.getAttribute("data-level") && parseInt(el.getAttribute("data-level") || "0", 10), _key = el.id;
339
- let block = htmlToBlocks(parent.outerHTML, blockContentType)[0];
328
+ let block = blockTools.htmlToBlocks(parent.outerHTML, blockContentType)[0];
340
329
  const customStyle = el.children?.[0]?.getAttribute("data-style");
341
330
  if (new RegExp(/<("[^"]*"|'[^']*'|[^'">])*>/).test(el.innerHTML)) {
342
- const newBlock = htmlToBlocks(el.innerHTML, blockContentType)[0];
331
+ const newBlock = blockTools.htmlToBlocks(el.innerHTML, blockContentType)[0];
343
332
  if (newBlock && (block = {
344
333
  ...block,
345
334
  ...newBlock,
@@ -402,7 +391,7 @@ const defaultStopTypes = [
402
391
  const filteredObj = { _type: obj._type }, fieldFilterFunc = (field) => field.localize === !1 ? !1 : field.type === "string" || field.type === "text" || Array.isArray(obj[field.name]) ? !0 : !stopTypes.includes(field.type);
403
392
  return [
404
393
  ...META_FIELDS$1,
405
- ...objFields?.filter(fieldFilterFunc)?.map((field) => field.name)
394
+ ...objFields.filter(fieldFilterFunc).map((field) => field.name)
406
395
  ].forEach((field) => {
407
396
  obj[field] && (filteredObj[field] = obj[field]);
408
397
  }), filteredObj;
@@ -411,12 +400,12 @@ const defaultStopTypes = [
411
400
  if (stopTypes.includes(obj._type))
412
401
  return "";
413
402
  if (serializers.types && Object.keys(serializers.types).includes(obj._type))
414
- return toHTML([obj], { components: serializers });
403
+ return toHtml.toHTML([obj], { components: serializers });
415
404
  if (obj._type === "span" || obj._type === "block")
416
- return toHTML(obj, { components: serializers });
405
+ return toHtml.toHTML(obj, { components: serializers });
417
406
  let fieldNames = Object.keys(obj).filter((key) => key !== "_type");
418
- const schema = getSchema(obj._type);
419
- schema && schema.fields && (fieldNames = schema.fields.map((field) => field.name).filter((schemaKey) => Object.keys(obj).includes(schemaKey))), typeof obj == "object" && !obj._type && (obj._type = "");
407
+ const schema2 = getSchema(obj._type);
408
+ schema2 && schema2.fields && (fieldNames = schema2.fields.map((field) => field.name).filter((schemaKey) => Object.keys(obj).includes(schemaKey))), typeof obj == "object" && !obj._type && (obj._type = "");
420
409
  const newSerializationMethods = {}, tempType = `${obj._type}__temp_type__${Math.random().toString(36).substring(7)}`, objToSerialize = { _type: tempType };
421
410
  META_FIELDS.filter((f2) => f2 !== "_type").forEach((field) => {
422
411
  objToSerialize[field] = obj[field];
@@ -457,7 +446,7 @@ const defaultStopTypes = [
457
446
  };
458
447
  let serializedBlock = "";
459
448
  try {
460
- serializedBlock = toHTML(objToSerialize, {
449
+ serializedBlock = toHtml.toHTML(objToSerialize, {
461
450
  components: {
462
451
  ...serializers,
463
452
  types: {
@@ -476,16 +465,16 @@ const defaultStopTypes = [
476
465
  const output = fieldContent.filter(
477
466
  (block) => !stopTypes.includes(block._type)
478
467
  ).map((block) => {
479
- const schema = getSchema(block._type);
480
- return schema && schema.fields ? fieldFilter(block, schema.fields, stopTypes) : block;
468
+ const schema2 = getSchema(block._type);
469
+ return schema2 && schema2.fields ? fieldFilter(block, schema2.fields, stopTypes) : block;
481
470
  }).map((obj) => typeof obj == "string" ? `<span>${obj}</span>` : serializeObject(obj, stopTypes, serializers));
482
471
  return `<div class="${fieldName}" data-type="array">${output.join("")}</div>`;
483
472
  };
484
473
  return {
485
474
  serializeDocument: (doc, translationLevel = "document", baseLang = "en", stopTypes = defaultStopTypes, serializers = customSerializers) => {
486
- const schema = getSchema(doc._type);
475
+ const schema2 = getSchema(doc._type);
487
476
  let filteredObj = {};
488
- translationLevel === "field" ? filteredObj = languageObjectFieldFilter(doc, baseLang) : filteredObj = fieldFilter(doc, schema?.fields ?? [], stopTypes);
477
+ translationLevel === "field" ? filteredObj = languageObjectFieldFilter(doc, baseLang) : filteredObj = fieldFilter(doc, schema2?.fields ?? [], stopTypes);
489
478
  const serializedFields = {};
490
479
  for (const key in filteredObj) {
491
480
  if (filteredObj.hasOwnProperty(key) === !1) continue;
@@ -549,7 +538,7 @@ const deserializeArray = (arrayHTML, deserializers = customDeserializers, blockD
549
538
  child,
550
539
  deserializers,
551
540
  blockDeserializers
552
- ), deserializedObject._key = child.id) : (deserializedObject = htmlToBlocks(child.outerHTML, blockContentType, {
541
+ ), deserializedObject._key = child.id) : (deserializedObject = blockTools.htmlToBlocks(child.outerHTML, blockContentType, {
553
542
  rules: blockDeserializers
554
543
  }), deserializedObject = mergeBlocks(deserializedObject), deserializedObject._key = child.id);
555
544
  } catch (e) {
@@ -617,7 +606,7 @@ function forEachMatchingField(documentId, document2, fields, callback) {
617
606
  for (const field of entry.fields) {
618
607
  const { property, type } = field;
619
608
  try {
620
- const results = JSONPath({
609
+ const results = jsonpathPlus.JSONPath({
621
610
  json: document2,
622
611
  path: property,
623
612
  resultType: "all",
@@ -650,9 +639,9 @@ function applyDocuments(documentId, sourceDocument, targetDocument, ignore, skip
650
639
  for (const [key, value] of Object.entries(clonedTarget))
651
640
  mergedDocument[key] = value;
652
641
  return forEachMatchingField(documentId, sourceDocument, ignore, (result) => {
653
- JSONPointer.set(mergedDocument, result.pointer, result.value);
642
+ JSONPointer__default.default.set(mergedDocument, result.pointer, result.value);
654
643
  }), forEachMatchingField(documentId, sourceDocument, dedupe, (result) => {
655
- JSONPointer.set(
644
+ JSONPointer__default.default.set(
656
645
  mergedDocument,
657
646
  result.pointer,
658
647
  dedupeFieldValue(result.value, localeId)
@@ -697,7 +686,7 @@ function createStableTranslationKey(branchId, documentId, localeId) {
697
686
  return branchId ? `${branchId}:${publishedId}:${localeId}` : `${publishedId}:${localeId}`;
698
687
  }
699
688
  function deserializeDocument(document2) {
700
- const deserializers = merge(
689
+ const deserializers = merge__default.default(
701
690
  { types: {} },
702
691
  pluginConfig.getAdditionalDeserializers()
703
692
  ), blockDeserializers = [
@@ -710,11 +699,11 @@ function deserializeDocument(document2) {
710
699
  blockDeserializers
711
700
  );
712
701
  }
713
- function serializeDocument(document2, schema, baseLanguage) {
702
+ function serializeDocument(document2, schema2, baseLanguage) {
714
703
  const stopTypes = [
715
704
  ...defaultStopTypes,
716
705
  ...pluginConfig.getAdditionalStopTypes()
717
- ], serializers = merge(
706
+ ], serializers = merge__default.default(
718
707
  customSerializers,
719
708
  pluginConfig.getAdditionalSerializers()
720
709
  ), docToSerialize = stripIgnoredFields(
@@ -722,7 +711,7 @@ function serializeDocument(document2, schema, baseLanguage) {
722
711
  pluginConfig.getIgnoreFields(),
723
712
  pluginConfig.getDedupeFields()
724
713
  );
725
- return BaseDocumentSerializer(schema).serializeDocument(
714
+ return BaseDocumentSerializer(schema2).serializeDocument(
726
715
  docToSerialize,
727
716
  "document",
728
717
  baseLanguage,
@@ -748,12 +737,12 @@ async function uploadFiles(documents, secrets) {
748
737
  fileName: `sanity/${info.documentId}`,
749
738
  fileId: info.documentId,
750
739
  fileFormat: "HTML",
751
- locale: gt.sourceLocale || libraryDefaultLocale,
740
+ locale: gt.sourceLocale || internal.libraryDefaultLocale,
752
741
  versionId: info.versionId || void 0
753
742
  }
754
743
  })),
755
744
  {
756
- sourceLocale: gt.sourceLocale || libraryDefaultLocale
745
+ sourceLocale: gt.sourceLocale || internal.libraryDefaultLocale
757
746
  }
758
747
  );
759
748
  }
@@ -791,7 +780,7 @@ async function initProject(uploadResult, options, secrets) {
791
780
  }
792
781
  async function createJobs(uploadResult, localeIds, secrets) {
793
782
  return overrideConfig(secrets), await gt.enqueueFiles(uploadResult.uploadedFiles, {
794
- sourceLocale: gt.sourceLocale || libraryDefaultLocale,
783
+ sourceLocale: gt.sourceLocale || internal.libraryDefaultLocale,
795
784
  targetLocales: localeIds
796
785
  });
797
786
  }
@@ -970,7 +959,7 @@ async function patchI18nDoc(sourceDocumentId, i18nDocId, sourceDocument, mergedD
970
959
  existingDocument,
971
960
  dedupeFields,
972
961
  (result) => {
973
- JSONPointer.set(appliedDocument, result.pointer, result.value);
962
+ JSONPointer__default.default.set(appliedDocument, result.pointer, result.value);
974
963
  }
975
964
  ), await client.patch(i18nDocId, { set: appliedDocument }).commit();
976
965
  }
@@ -1263,12 +1252,12 @@ async function publishTranslations(documentIds, client) {
1263
1252
  }
1264
1253
  ), publishedDocumentIds;
1265
1254
  }
1266
- const getLocales = async (secrets) => pluginConfig.getLocales().map((locale) => ({
1255
+ const getLocales = async (_secrets) => pluginConfig.getLocales().map((locale) => ({
1267
1256
  localeId: locale,
1268
1257
  description: gt.getLocaleProperties(locale).name,
1269
1258
  enabled: !0
1270
- })), TranslationsContext = createContext(null), useTranslations = () => {
1271
- const context = useContext(TranslationsContext);
1259
+ })), TranslationsContext = o.createContext(null), useTranslations = () => {
1260
+ const context = o.useContext(TranslationsContext);
1272
1261
  if (!context)
1273
1262
  throw new Error("useTranslations must be used within TranslationsProvider");
1274
1263
  return context;
@@ -1276,25 +1265,25 @@ const getLocales = async (secrets) => pluginConfig.getLocales().map((locale) =>
1276
1265
  children,
1277
1266
  singleDocument
1278
1267
  }) => {
1279
- const [isBusy, setIsBusy] = useState(!1), [documents, setDocuments] = useState([]), [locales, setLocales] = useState([]), [autoRefresh, setAutoRefresh] = useState(!1), [autoImport, setAutoImport] = useState(!1), [autoPatchReferences, setAutoPatchReferences] = useState(!1), [autoPublish, setAutoPublish] = useState(!1), [loadingDocuments, setLoadingDocuments] = useState(!1), [importProgress, setImportProgress] = useState({
1268
+ const [isBusy, setIsBusy] = o.useState(!1), [documents, setDocuments] = o.useState([]), [locales, setLocales] = o.useState([]), [autoRefresh, setAutoRefresh] = o.useState(!1), [autoImport, setAutoImport] = o.useState(!1), [autoPatchReferences, setAutoPatchReferences] = o.useState(!1), [autoPublish, setAutoPublish] = o.useState(!1), [loadingDocuments, setLoadingDocuments] = o.useState(!1), [importProgress, setImportProgress] = o.useState({
1280
1269
  current: 0,
1281
1270
  total: 0,
1282
1271
  isImporting: !1
1283
- }), [importedTranslations, setImportedTranslations] = useState(
1272
+ }), [importedTranslations, setImportedTranslations] = o.useState(
1284
1273
  /* @__PURE__ */ new Set()
1285
- ), [existingTranslations, setExistingTranslations] = useState(
1274
+ ), [existingTranslations, setExistingTranslations] = o.useState(
1286
1275
  /* @__PURE__ */ new Set()
1287
- ), [downloadStatus, setDownloadStatus] = useState({
1276
+ ), [downloadStatus, setDownloadStatus] = o.useState({
1288
1277
  downloaded: /* @__PURE__ */ new Set(),
1289
1278
  failed: /* @__PURE__ */ new Set(),
1290
1279
  skipped: /* @__PURE__ */ new Set()
1291
- }), downloadStatusRef = useRef(downloadStatus), [translationStatuses, setTranslationStatuses] = useState(/* @__PURE__ */ new Map()), [isRefreshing, setIsRefreshing] = useState(!1), client = useClient(), schema = useSchema(), translationContext = { client, schema }, toast = useToast(), { loading: loadingSecrets, secrets } = useSecrets(
1280
+ }), downloadStatusRef = o.useRef(downloadStatus), [translationStatuses, setTranslationStatuses] = o.useState(/* @__PURE__ */ new Map()), [isRefreshing, setIsRefreshing] = o.useState(!1), client = useClient(), schema2 = sanity.useSchema(), translationContext = { client, schema: schema2 }, toast = ui.useToast(), { loading: loadingSecrets, secrets } = useSecrets(
1292
1281
  pluginConfig.getSecretsNamespace()
1293
- ), [branchId, setBranchId] = useState(void 0);
1294
- useEffect(() => {
1282
+ ), [branchId, setBranchId] = o.useState(void 0);
1283
+ o.useEffect(() => {
1295
1284
  downloadStatusRef.current = downloadStatus;
1296
1285
  }, [downloadStatus]);
1297
- const fetchDocuments = useCallback(async () => {
1286
+ const fetchDocuments = o.useCallback(async () => {
1298
1287
  setLoadingDocuments(!0);
1299
1288
  try {
1300
1289
  if (singleDocument) {
@@ -1315,7 +1304,7 @@ const getLocales = async (secrets) => pluginConfig.getLocales().map((locale) =>
1315
1304
  } finally {
1316
1305
  setLoadingDocuments(!1);
1317
1306
  }
1318
- }, [client, singleDocument]), fetchLocales = useCallback(async () => {
1307
+ }, [client, singleDocument]), fetchLocales = o.useCallback(async () => {
1319
1308
  if (secrets)
1320
1309
  try {
1321
1310
  const availableLocales = await getLocales(secrets);
@@ -1327,7 +1316,7 @@ const getLocales = async (secrets) => pluginConfig.getLocales().map((locale) =>
1327
1316
  closable: !0
1328
1317
  });
1329
1318
  }
1330
- }, [secrets]), fetchExistingTranslations = useCallback(async () => {
1319
+ }, [secrets]), fetchExistingTranslations = o.useCallback(async () => {
1331
1320
  if (!(!documents.length || !locales.length))
1332
1321
  try {
1333
1322
  const sourceLocale = pluginConfig.getSourceLocale(), availableLocaleIds = locales.filter((locale) => locale.enabled !== !1).map((locale) => locale.localeId), documentIds = documents.map(getDocumentPublishedId), existingMetadata = await client.fetch(`*[
@@ -1359,7 +1348,7 @@ const getLocales = async (secrets) => pluginConfig.getLocales().map((locale) =>
1359
1348
  closable: !0
1360
1349
  });
1361
1350
  }
1362
- }, [documents, locales, client]), handleTranslateAll = useCallback(async () => {
1351
+ }, [documents, locales, client]), handleTranslateAll = o.useCallback(async () => {
1363
1352
  if (!(!secrets || documents.length === 0)) {
1364
1353
  setIsBusy(!0);
1365
1354
  try {
@@ -1368,7 +1357,7 @@ const getLocales = async (secrets) => pluginConfig.getLocales().map((locale) =>
1368
1357
  try {
1369
1358
  const serialized = serializeDocument(
1370
1359
  cleanDoc,
1371
- schema,
1360
+ schema2,
1372
1361
  baseLanguage
1373
1362
  );
1374
1363
  return {
@@ -1398,7 +1387,7 @@ const getLocales = async (secrets) => pluginConfig.getLocales().map((locale) =>
1398
1387
  setIsBusy(!1);
1399
1388
  }
1400
1389
  }
1401
- }, [secrets, documents, locales, schema]), handleImportAll = useCallback(async () => {
1390
+ }, [secrets, documents, locales, schema2]), handleImportAll = o.useCallback(async () => {
1402
1391
  if (!(!secrets || documents.length === 0 || !branchId)) {
1403
1392
  setIsBusy(!0);
1404
1393
  try {
@@ -1461,7 +1450,7 @@ const getLocales = async (secrets) => pluginConfig.getLocales().map((locale) =>
1461
1450
  downloadStatus,
1462
1451
  translationContext,
1463
1452
  branchId
1464
- ]), getExistingTranslations = useCallback(
1453
+ ]), getExistingTranslations = o.useCallback(
1465
1454
  async (documentIds, localeIds, branchId2) => {
1466
1455
  const sourceLocale = pluginConfig.getSourceLocale(), existingMetadata = await client.fetch(`*[
1467
1456
  _type == 'translation.metadata' &&
@@ -1488,7 +1477,7 @@ const getLocales = async (secrets) => pluginConfig.getLocales().map((locale) =>
1488
1477
  }), existing;
1489
1478
  },
1490
1479
  [client]
1491
- ), handleImportMissing = useCallback(async () => {
1480
+ ), handleImportMissing = o.useCallback(async () => {
1492
1481
  if (!(!secrets || documents.length === 0 || !branchId)) {
1493
1482
  setIsBusy(!0);
1494
1483
  try {
@@ -1565,7 +1554,7 @@ const getLocales = async (secrets) => pluginConfig.getLocales().map((locale) =>
1565
1554
  translationContext,
1566
1555
  getExistingTranslations,
1567
1556
  branchId
1568
- ]), handleGetBranchId = useCallback(
1557
+ ]), handleGetBranchId = o.useCallback(
1569
1558
  async (secrets2) => {
1570
1559
  overrideConfig(secrets2);
1571
1560
  const defaultBranch = await gt.createBranch({
@@ -1575,7 +1564,7 @@ const getLocales = async (secrets) => pluginConfig.getLocales().map((locale) =>
1575
1564
  setBranchId(defaultBranch.branch.id);
1576
1565
  },
1577
1566
  [secrets]
1578
- ), handleRefreshAll = useCallback(async () => {
1567
+ ), handleRefreshAll = o.useCallback(async () => {
1579
1568
  if (!(!secrets || documents.length === 0 || !branchId)) {
1580
1569
  setIsRefreshing(!0);
1581
1570
  try {
@@ -1595,7 +1584,7 @@ const getLocales = async (secrets) => pluginConfig.getLocales().map((locale) =>
1595
1584
  downloadStatusRef.current,
1596
1585
  secrets
1597
1586
  );
1598
- setTranslationStatuses((prevStatuses) => {
1587
+ setTranslationStatuses(() => {
1599
1588
  const newStatuses = /* @__PURE__ */ new Map();
1600
1589
  for (const doc of documents)
1601
1590
  for (const localeId of availableLocaleIds) {
@@ -1642,7 +1631,7 @@ const getLocales = async (secrets) => pluginConfig.getLocales().map((locale) =>
1642
1631
  setIsRefreshing(!1);
1643
1632
  }
1644
1633
  }
1645
- }, [secrets, documents, locales, branchId]), handleImportDocument = useCallback(
1634
+ }, [secrets, documents, locales, branchId]), handleImportDocument = o.useCallback(
1646
1635
  async (documentId, versionId, localeId) => {
1647
1636
  if (!secrets) return;
1648
1637
  const key = createTranslationStatusKey(
@@ -1729,7 +1718,7 @@ const getLocales = async (secrets) => pluginConfig.getLocales().map((locale) =>
1729
1718
  }
1730
1719
  },
1731
1720
  [secrets, documents, translationContext, translationStatuses, branchId]
1732
- ), handlePatchDocumentReferences = useCallback(async () => {
1721
+ ), handlePatchDocumentReferences = o.useCallback(async () => {
1733
1722
  if (!secrets || documents.length === 0) return 0;
1734
1723
  setIsBusy(!0);
1735
1724
  try {
@@ -1803,7 +1792,7 @@ const getLocales = async (secrets) => pluginConfig.getLocales().map((locale) =>
1803
1792
  } finally {
1804
1793
  setIsBusy(!1), setImportProgress({ current: 0, total: 0, isImporting: !1 });
1805
1794
  }
1806
- }, [secrets, documents, locales, client, branchId]), handlePublishAllTranslations = useCallback(async () => {
1795
+ }, [secrets, documents, locales, client, branchId]), handlePublishAllTranslations = o.useCallback(async () => {
1807
1796
  if (!secrets || documents.length === 0) return 0;
1808
1797
  setIsBusy(!0);
1809
1798
  try {
@@ -1859,13 +1848,13 @@ const getLocales = async (secrets) => pluginConfig.getLocales().map((locale) =>
1859
1848
  setIsBusy(!1);
1860
1849
  }
1861
1850
  }, [secrets, documents, client, branchId]);
1862
- useEffect(() => {
1851
+ o.useEffect(() => {
1863
1852
  fetchDocuments();
1864
- }, [fetchDocuments]), useEffect(() => {
1853
+ }, [fetchDocuments]), o.useEffect(() => {
1865
1854
  secrets && fetchLocales();
1866
- }, [fetchLocales, secrets]), useEffect(() => {
1855
+ }, [fetchLocales, secrets]), o.useEffect(() => {
1867
1856
  documents.length > 0 && locales.length > 0 && fetchExistingTranslations();
1868
- }, [fetchExistingTranslations]), useEffect(() => {
1857
+ }, [fetchExistingTranslations]), o.useEffect(() => {
1869
1858
  documents.length > 0 && locales.length > 0 && secrets && !loadingDocuments && branchId && handleRefreshAll();
1870
1859
  }, [
1871
1860
  documents,
@@ -1874,15 +1863,15 @@ const getLocales = async (secrets) => pluginConfig.getLocales().map((locale) =>
1874
1863
  loadingDocuments,
1875
1864
  branchId,
1876
1865
  handleRefreshAll
1877
- ]), useEffect(() => {
1866
+ ]), o.useEffect(() => {
1878
1867
  if (!autoRefresh || documents.length === 0 || !secrets) return;
1879
1868
  const interval = setInterval(async () => {
1880
1869
  await handleRefreshAll();
1881
1870
  }, 1e4);
1882
1871
  return () => clearInterval(interval);
1883
- }, [autoRefresh, documents.length, secrets, handleRefreshAll]), useEffect(() => {
1872
+ }, [autoRefresh, documents.length, secrets, handleRefreshAll]), o.useEffect(() => {
1884
1873
  setImportedTranslations(new Set(downloadStatus.downloaded));
1885
- }, [downloadStatus.downloaded]), useEffect(() => {
1874
+ }, [downloadStatus.downloaded]), o.useEffect(() => {
1886
1875
  secrets && handleGetBranchId(secrets);
1887
1876
  }, [secrets, handleGetBranchId]);
1888
1877
  const contextValue = {
@@ -1918,12 +1907,12 @@ const getLocales = async (secrets) => pluginConfig.getLocales().map((locale) =>
1918
1907
  handlePatchDocumentReferences,
1919
1908
  handlePublishAllTranslations
1920
1909
  };
1921
- return /* @__PURE__ */ jsx(TranslationsContext.Provider, { value: contextValue, children });
1910
+ return /* @__PURE__ */ jsxRuntime.jsx(TranslationsContext.Provider, { value: contextValue, children });
1922
1911
  };
1923
1912
  function ProgressBar({ progress }) {
1924
- return typeof progress > "u" ? (console.warn("No progress prop passed to ProgressBar"), null) : /* @__PURE__ */ jsxs(Card, { border: !0, radius: 2, style: { width: "100%", position: "relative" }, children: [
1925
- /* @__PURE__ */ jsx(
1926
- Flex,
1913
+ return typeof progress > "u" ? (console.warn("No progress prop passed to ProgressBar"), null) : /* @__PURE__ */ jsxRuntime.jsxs(ui.Card, { border: !0, radius: 2, style: { width: "100%", position: "relative" }, children: [
1914
+ /* @__PURE__ */ jsxRuntime.jsx(
1915
+ ui.Flex,
1927
1916
  {
1928
1917
  style: {
1929
1918
  position: "absolute",
@@ -1935,14 +1924,14 @@ function ProgressBar({ progress }) {
1935
1924
  },
1936
1925
  align: "center",
1937
1926
  justify: "center",
1938
- children: /* @__PURE__ */ jsxs(Label, { size: 1, children: [
1927
+ children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Label, { size: 1, children: [
1939
1928
  progress,
1940
1929
  "%"
1941
1930
  ] })
1942
1931
  }
1943
1932
  ),
1944
- /* @__PURE__ */ jsx(
1945
- Card,
1933
+ /* @__PURE__ */ jsxRuntime.jsx(
1934
+ ui.Card,
1946
1935
  {
1947
1936
  style: {
1948
1937
  width: "100%",
@@ -1963,7 +1952,7 @@ const LanguageStatus = ({
1963
1952
  importFile,
1964
1953
  isImported = !1
1965
1954
  }) => {
1966
- const [isBusy, setIsBusy] = useState(!1), displayedProgress = isImported && progress < 100 ? 100 : progress, handleImport = useCallback(async () => {
1955
+ const [isBusy, setIsBusy] = o.useState(!1), displayedProgress = isImported && progress < 100 ? 100 : progress, handleImport = o.useCallback(async () => {
1967
1956
  setIsBusy(!0);
1968
1957
  try {
1969
1958
  await importFile();
@@ -1971,20 +1960,20 @@ const LanguageStatus = ({
1971
1960
  setIsBusy(!1);
1972
1961
  }
1973
1962
  }, [importFile, setIsBusy]);
1974
- return /* @__PURE__ */ jsx(Card, { shadow: 1, children: /* @__PURE__ */ jsxs(Grid, { columns: 5, gap: 3, padding: 3, children: [
1975
- /* @__PURE__ */ jsx(Flex, { columnStart: 1, columnEnd: 3, align: "center", children: /* @__PURE__ */ jsx(Text, { weight: "bold", size: 1, children: title }) }),
1976
- typeof displayedProgress == "number" ? /* @__PURE__ */ jsx(Flex, { columnStart: 3, columnEnd: 5, align: "center", children: /* @__PURE__ */ jsx(ProgressBar, { progress: displayedProgress }) }) : null,
1977
- /* @__PURE__ */ jsx(Box, { columnStart: 5, columnEnd: 6, children: isImported ? /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "center", style: { color: "green" }, children: [
1978
- /* @__PURE__ */ jsx(CheckmarkCircleIcon, {}),
1979
- /* @__PURE__ */ jsx(Text, { size: 1, style: { marginLeft: "4px" }, children: "Imported" })
1980
- ] }) : /* @__PURE__ */ jsx(
1981
- Button,
1963
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { shadow: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Grid, { columns: 5, gap: 3, padding: 3, children: [
1964
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { columnStart: 1, columnEnd: 3, align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "bold", size: 1, children: title }) }),
1965
+ typeof displayedProgress == "number" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { columnStart: 3, columnEnd: 5, align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ProgressBar, { progress: displayedProgress }) }) : null,
1966
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { columnStart: 5, columnEnd: 6, children: isImported ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", justify: "center", style: { color: "green" }, children: [
1967
+ /* @__PURE__ */ jsxRuntime.jsx(icons.CheckmarkCircleIcon, {}),
1968
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, style: { marginLeft: "4px" }, children: "Imported" })
1969
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(
1970
+ ui.Button,
1982
1971
  {
1983
1972
  style: { width: "100%" },
1984
1973
  mode: "ghost",
1985
1974
  onClick: handleImport,
1986
1975
  text: isBusy ? "Importing..." : "Import",
1987
- icon: isBusy ? null : DownloadIcon,
1976
+ icon: isBusy ? null : icons.DownloadIcon,
1988
1977
  disabled: isBusy || !progress || progress < 100
1989
1978
  }
1990
1979
  ) })
@@ -2588,7 +2577,7 @@ var unitlessKeys = {
2588
2577
  }, f = typeof process < "u" && process.env !== void 0 && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled", m = "active", y = "data-styled-version", v = "6.1.19", g = `/*!sc*/
2589
2578
  `, S = typeof window < "u" && typeof document < "u", w = !!(typeof SC_DISABLE_SPEEDY == "boolean" ? SC_DISABLE_SPEEDY : typeof process < "u" && process.env !== void 0 && process.env.REACT_APP_SC_DISABLE_SPEEDY !== void 0 && process.env.REACT_APP_SC_DISABLE_SPEEDY !== "" ? process.env.REACT_APP_SC_DISABLE_SPEEDY !== "false" && process.env.REACT_APP_SC_DISABLE_SPEEDY : typeof process < "u" && process.env !== void 0 && process.env.SC_DISABLE_SPEEDY !== void 0 && process.env.SC_DISABLE_SPEEDY !== "" ? process.env.SC_DISABLE_SPEEDY !== "false" && process.env.SC_DISABLE_SPEEDY : process.env.NODE_ENV !== "production"), E = /invalid hook call/i, N = /* @__PURE__ */ new Set(), P = function(t, n) {
2590
2579
  if (process.env.NODE_ENV !== "production") {
2591
- var o2 = n ? ' with the id of "'.concat(n, '"') : "", s = "The component ".concat(t).concat(o2, ` has been created dynamically.
2580
+ var o$1 = n ? ' with the id of "'.concat(n, '"') : "", s = "The component ".concat(t).concat(o$1, ` has been created dynamically.
2592
2581
  `) + `You may see this warning because you've called styled inside another component.
2593
2582
  To resolve this only create new StyledComponents outside of any render method and function component.
2594
2583
  See https://styled-components.com/docs/basics#define-styled-components-outside-of-the-render-method for more info.
@@ -2596,9 +2585,9 @@ See https://styled-components.com/docs/basics#define-styled-components-outside-o
2596
2585
  try {
2597
2586
  var a = !0;
2598
2587
  console.error = function(t2) {
2599
- for (var n2 = [], o3 = 1; o3 < arguments.length; o3++) n2[o3 - 1] = arguments[o3];
2588
+ for (var n2 = [], o2 = 1; o2 < arguments.length; o2++) n2[o2 - 1] = arguments[o2];
2600
2589
  E.test(t2) ? (a = !1, N.delete(s)) : i.apply(void 0, __spreadArray([t2], n2, !1));
2601
- }, useRef(), a && !N.has(s) && (console.warn(s), N.add(s));
2590
+ }, o.useRef(), a && !N.has(s) && (console.warn(s), N.add(s));
2602
2591
  } catch (e) {
2603
2592
  E.test(e.message) && N.delete(s);
2604
2593
  } finally {
@@ -2936,10 +2925,10 @@ function Fe(e) {
2936
2925
  return t2.name || he(15), z(e2, t2.name);
2937
2926
  }, F).toString() : "", p;
2938
2927
  }
2939
- var ze = new ke(), Me = Fe(), $e = o.createContext({ shouldForwardProp: void 0, styleSheet: ze, stylis: Me });
2940
- o.createContext(void 0);
2928
+ var ze = new ke(), Me = Fe(), $e = o__default.default.createContext({ shouldForwardProp: void 0, styleSheet: ze, stylis: Me });
2929
+ o__default.default.createContext(void 0);
2941
2930
  function Le() {
2942
- return useContext($e);
2931
+ return o.useContext($e);
2943
2932
  }
2944
2933
  var qe = (function() {
2945
2934
  function e(e2, t) {
@@ -3027,7 +3016,7 @@ var Ke = M(v), Qe = (function() {
3027
3016
  }
3028
3017
  return o2;
3029
3018
  }, e;
3030
- })(), et = o.createContext(void 0), rt = {}, st = /* @__PURE__ */ new Set();
3019
+ })(), et = o__default.default.createContext(void 0), rt = {}, st = /* @__PURE__ */ new Set();
3031
3020
  function it(e, r, s) {
3032
3021
  var i = se(e), a = e, c = !G(e), p = r.attrs, d = p === void 0 ? _ : p, h = r.componentId, f2 = h === void 0 ? (function(e2, t) {
3033
3022
  var n = typeof e2 != "string" ? "sc" : R(e2);
@@ -3049,8 +3038,8 @@ function it(e, r, s) {
3049
3038
  var N2 = new Qe(s, g2, i ? a.componentStyle : void 0);
3050
3039
  function O2(e2, r2) {
3051
3040
  return (function(e3, r3, s2) {
3052
- var i2 = e3.attrs, a2 = e3.componentStyle, c2 = e3.defaultProps, p2 = e3.foldedComponentIds, d2 = e3.styledComponentId, h2 = e3.target, f3 = o.useContext(et), m3 = Le(), y3 = e3.shouldForwardProp || m3.shouldForwardProp;
3053
- process.env.NODE_ENV !== "production" && useDebugValue(d2);
3041
+ var i2 = e3.attrs, a2 = e3.componentStyle, c2 = e3.defaultProps, p2 = e3.foldedComponentIds, d2 = e3.styledComponentId, h2 = e3.target, f3 = o__default.default.useContext(et), m3 = Le(), y3 = e3.shouldForwardProp || m3.shouldForwardProp;
3042
+ process.env.NODE_ENV !== "production" && o.useDebugValue(d2);
3054
3043
  var v2 = I(r3, f3, c2) || C, g3 = (function(e4, n, o2) {
3055
3044
  for (var r4, s3 = __assign(__assign({}, n), { className: void 0, theme: o2 }), i3 = 0; i3 < e4.length; i3 += 1) {
3056
3045
  var a3 = re(r4 = e4[i3]) ? r4(s3) : r4;
@@ -3060,16 +3049,16 @@ function it(e, r, s) {
3060
3049
  })(i2, r3, v2), S3 = g3.as || h2, w3 = {};
3061
3050
  for (var b2 in g3) g3[b2] === void 0 || b2[0] === "$" || b2 === "as" || b2 === "theme" && g3.theme === v2 || (b2 === "forwardedAs" ? w3.as = g3.forwardedAs : y3 && !y3(b2, S3) || (w3[b2] = g3[b2], y3 || process.env.NODE_ENV !== "development" || isPropValid(b2) || st.has(b2) || !A.has(S3) || (st.add(b2), console.warn('styled-components: it looks like an unknown prop "'.concat(b2, '" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));
3062
3051
  var E3 = (function(e4, t) {
3063
- var n = Le(), o2 = e4.generateAndInjectStyles(t, n.styleSheet, n.stylis);
3064
- return process.env.NODE_ENV !== "production" && useDebugValue(o2), o2;
3052
+ var n = Le(), o$1 = e4.generateAndInjectStyles(t, n.styleSheet, n.stylis);
3053
+ return process.env.NODE_ENV !== "production" && o.useDebugValue(o$1), o$1;
3065
3054
  })(a2, g3);
3066
3055
  process.env.NODE_ENV !== "production" && e3.warnTooManyClasses && e3.warnTooManyClasses(E3);
3067
3056
  var N3 = ie(p2, d2);
3068
- return E3 && (N3 += " " + E3), g3.className && (N3 += " " + g3.className), w3[G(S3) && !A.has(S3) ? "class" : "className"] = N3, s2 && (w3.ref = s2), createElement(S3, w3);
3057
+ return E3 && (N3 += " " + E3), g3.className && (N3 += " " + g3.className), w3[G(S3) && !A.has(S3) ? "class" : "className"] = N3, s2 && (w3.ref = s2), o.createElement(S3, w3);
3069
3058
  })(D2, e2, r2);
3070
3059
  }
3071
3060
  O2.displayName = y2;
3072
- var D2 = o.forwardRef(O2);
3061
+ var D2 = o__default.default.forwardRef(O2);
3073
3062
  return D2.attrs = S2, D2.componentStyle = N2, D2.displayName = y2, D2.shouldForwardProp = w2, D2.foldedComponentIds = i ? ie(a.foldedComponentIds, a.styledComponentId) : "", D2.styledComponentId = g2, D2.target = i ? a.target : e, Object.defineProperty(D2, "defaultProps", { get: function() {
3074
3063
  return this._foldedDefaultProps;
3075
3064
  }, set: function(e2) {
@@ -3137,34 +3126,34 @@ var wt = "__sc-".concat(f, "__");
3137
3126
  process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && typeof window < "u" && (window[wt] || (window[wt] = 0), window[wt] === 1 && console.warn(`It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.
3138
3127
 
3139
3128
  See https://s-c.sh/2BAXzed for more info.`), window[wt] += 1);
3140
- const WrapText = dt(Box)`
3129
+ const WrapText = dt(ui.Box)`
3141
3130
  white-space: normal;
3142
3131
  `, LocaleCheckbox = ({
3143
3132
  locale,
3144
3133
  toggle,
3145
3134
  checked
3146
3135
  }) => {
3147
- const onClick = useCallback(
3136
+ const onClick = o.useCallback(
3148
3137
  () => toggle(locale.localeId, !checked),
3149
3138
  [locale.localeId, toggle, checked]
3150
3139
  );
3151
- return /* @__PURE__ */ jsx(
3152
- Button,
3140
+ return /* @__PURE__ */ jsxRuntime.jsx(
3141
+ ui.Button,
3153
3142
  {
3154
3143
  mode: "ghost",
3155
3144
  onClick,
3156
3145
  style: { cursor: "pointer" },
3157
3146
  radius: 2,
3158
- children: /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 3, children: [
3159
- /* @__PURE__ */ jsx(
3160
- Switch,
3147
+ children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", gap: 3, children: [
3148
+ /* @__PURE__ */ jsxRuntime.jsx(
3149
+ ui.Switch,
3161
3150
  {
3162
3151
  style: { pointerEvents: "none" },
3163
3152
  onChange: onClick,
3164
3153
  checked
3165
3154
  }
3166
3155
  ),
3167
- /* @__PURE__ */ jsx(WrapText, { children: /* @__PURE__ */ jsx(Text, { size: 1, weight: "semibold", children: locale.description }) })
3156
+ /* @__PURE__ */ jsxRuntime.jsx(WrapText, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, weight: "semibold", children: locale.description }) })
3168
3157
  ] })
3169
3158
  }
3170
3159
  );
@@ -3191,16 +3180,16 @@ const WrapText = dt(Box)`
3191
3180
  setAutoPatchReferences,
3192
3181
  autoPublish,
3193
3182
  setAutoPublish
3194
- } = useTranslations(), [isImporting, setIsImporting] = useState(!1), [isPublishing, setIsPublishing] = useState(!1), toast = useToast(), document2 = documents[0], currentDocumentLanguage = useMemo(() => {
3183
+ } = useTranslations(), [isImporting, setIsImporting] = o.useState(!1), [isPublishing, setIsPublishing] = o.useState(!1), toast = ui.useToast(), document2 = documents[0], currentDocumentLanguage = o.useMemo(() => {
3195
3184
  if (!document2) return null;
3196
3185
  const languageField = pluginConfig.getLanguageField();
3197
3186
  return document2[languageField] || pluginConfig.getSourceLocale();
3198
- }, [document2]), shouldShowTranslationComponents = useMemo(() => currentDocumentLanguage ? currentDocumentLanguage === pluginConfig.getSourceLocale() : !1, [currentDocumentLanguage]), availableLocales = useMemo(() => {
3187
+ }, [document2]), shouldShowTranslationComponents = o.useMemo(() => currentDocumentLanguage ? currentDocumentLanguage === pluginConfig.getSourceLocale() : !1, [currentDocumentLanguage]), availableLocales = o.useMemo(() => {
3199
3188
  const sourceLocale = pluginConfig.getSourceLocale();
3200
3189
  return locales.filter(
3201
3190
  (locale) => locale.enabled !== !1 && locale.localeId !== sourceLocale
3202
3191
  );
3203
- }, [locales]), documentId = useMemo(() => document2 ? getDocumentPublishedId(document2) : null, [document2]), handleImportTranslations = useCallback(
3192
+ }, [locales]), documentId = o.useMemo(() => document2 ? getDocumentPublishedId(document2) : null, [document2]), handleImportTranslations = o.useCallback(
3204
3193
  async (options = {}) => {
3205
3194
  const { autoOnly = !1 } = options;
3206
3195
  if (isImporting || !documentId || autoOnly && !autoImport) return;
@@ -3241,12 +3230,12 @@ const WrapText = dt(Box)`
3241
3230
  toast
3242
3231
  ]
3243
3232
  );
3244
- useEffect(() => {
3233
+ o.useEffect(() => {
3245
3234
  handleImportTranslations({ autoOnly: !0 });
3246
- }, [handleImportTranslations]), useEffect(() => {
3235
+ }, [handleImportTranslations]), o.useEffect(() => {
3247
3236
  setAutoRefresh(!0), setAutoPatchReferences(!0), setAutoPublish(!0);
3248
3237
  }, [setAutoRefresh, setAutoPatchReferences, setAutoPublish]);
3249
- const toggleLocale = useCallback(
3238
+ const toggleLocale = o.useCallback(
3250
3239
  (localeId, shouldEnable) => {
3251
3240
  const updatedLocales = locales.map(
3252
3241
  (locale) => locale.localeId === localeId ? { ...locale, enabled: shouldEnable } : locale
@@ -3254,7 +3243,7 @@ const WrapText = dt(Box)`
3254
3243
  setLocales(updatedLocales);
3255
3244
  },
3256
3245
  [locales, setLocales]
3257
- ), toggleAllLocales = useCallback(() => {
3246
+ ), toggleAllLocales = o.useCallback(() => {
3258
3247
  const sourceLocale = pluginConfig.getSourceLocale(), allEnabled = locales.filter(
3259
3248
  (locale) => locale.localeId !== sourceLocale
3260
3249
  ).every(
@@ -3264,14 +3253,14 @@ const WrapText = dt(Box)`
3264
3253
  );
3265
3254
  setLocales(updatedLocales);
3266
3255
  }, [locales, setLocales]);
3267
- return shouldShowTranslationComponents ? /* @__PURE__ */ jsxs(Stack, { space: 6, padding: 4, children: [
3268
- /* @__PURE__ */ jsxs(Stack, { space: 4, children: [
3269
- /* @__PURE__ */ jsx(Text, { as: "h2", weight: "semibold", size: 2, children: "Generate Translations" }),
3270
- /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
3271
- /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "space-between", children: [
3272
- /* @__PURE__ */ jsx(Text, { weight: "semibold", size: 1, children: availableLocales.length === 1 ? "Select locale" : "Select locales" }),
3273
- /* @__PURE__ */ jsx(
3274
- Button,
3256
+ return shouldShowTranslationComponents ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 6, padding: 4, children: [
3257
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 4, children: [
3258
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "h2", weight: "semibold", size: 2, children: "Generate Translations" }),
3259
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
3260
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", justify: "space-between", children: [
3261
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "semibold", size: 1, children: availableLocales.length === 1 ? "Select locale" : "Select locales" }),
3262
+ /* @__PURE__ */ jsxRuntime.jsx(
3263
+ ui.Button,
3275
3264
  {
3276
3265
  fontSize: 1,
3277
3266
  padding: 2,
@@ -3280,9 +3269,9 @@ const WrapText = dt(Box)`
3280
3269
  }
3281
3270
  )
3282
3271
  ] }),
3283
- /* @__PURE__ */ jsx(Grid, { columns: [1, 1, 2, 3], gap: 1, children: locales.filter(
3272
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { columns: [1, 1, 2, 3], gap: 1, children: locales.filter(
3284
3273
  (locale) => locale.localeId !== pluginConfig.getSourceLocale()
3285
- ).map((locale) => /* @__PURE__ */ jsx(
3274
+ ).map((locale) => /* @__PURE__ */ jsxRuntime.jsx(
3286
3275
  LocaleCheckbox,
3287
3276
  {
3288
3277
  locale,
@@ -3292,8 +3281,8 @@ const WrapText = dt(Box)`
3292
3281
  locale.localeId
3293
3282
  )) })
3294
3283
  ] }),
3295
- /* @__PURE__ */ jsx(
3296
- Button,
3284
+ /* @__PURE__ */ jsxRuntime.jsx(
3285
+ ui.Button,
3297
3286
  {
3298
3287
  onClick: () => {
3299
3288
  setAutoImport(!0), handleTranslateAll();
@@ -3304,22 +3293,22 @@ const WrapText = dt(Box)`
3304
3293
  }
3305
3294
  )
3306
3295
  ] }),
3307
- documentId && availableLocales.length > 0 && /* @__PURE__ */ jsxs(Stack, { space: 4, children: [
3308
- /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "space-between", children: [
3309
- /* @__PURE__ */ jsx(Text, { as: "h2", weight: "semibold", size: 2, children: "Translation Status" }),
3310
- /* @__PURE__ */ jsxs(Flex, { gap: 3, align: "center", children: [
3311
- /* @__PURE__ */ jsxs(Flex, { gap: 2, align: "center", children: [
3312
- /* @__PURE__ */ jsx(Text, { size: 1, children: "Auto-refresh" }),
3313
- /* @__PURE__ */ jsx(
3314
- Switch,
3296
+ documentId && availableLocales.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 4, children: [
3297
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", justify: "space-between", children: [
3298
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "h2", weight: "semibold", size: 2, children: "Translation Status" }),
3299
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 3, align: "center", children: [
3300
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, align: "center", children: [
3301
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: "Auto-refresh" }),
3302
+ /* @__PURE__ */ jsxRuntime.jsx(
3303
+ ui.Switch,
3315
3304
  {
3316
3305
  checked: autoRefresh,
3317
3306
  onChange: () => setAutoRefresh(!autoRefresh)
3318
3307
  }
3319
3308
  )
3320
3309
  ] }),
3321
- /* @__PURE__ */ jsx(
3322
- Button,
3310
+ /* @__PURE__ */ jsxRuntime.jsx(
3311
+ ui.Button,
3323
3312
  {
3324
3313
  fontSize: 1,
3325
3314
  padding: 2,
@@ -3330,14 +3319,14 @@ const WrapText = dt(Box)`
3330
3319
  )
3331
3320
  ] })
3332
3321
  ] }),
3333
- /* @__PURE__ */ jsx(Box, { children: availableLocales.map((locale) => {
3322
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: availableLocales.map((locale) => {
3334
3323
  const key = createTranslationStatusKey(
3335
3324
  branchId,
3336
3325
  documentId,
3337
3326
  document2._rev,
3338
3327
  locale.localeId
3339
3328
  ), status = translationStatuses.get(key), progress = status?.progress || 0, isImported = importedTranslations.has(key);
3340
- return /* @__PURE__ */ jsx(
3329
+ return /* @__PURE__ */ jsxRuntime.jsx(
3341
3330
  LanguageStatus,
3342
3331
  {
3343
3332
  title: locale.description,
@@ -3354,17 +3343,17 @@ const WrapText = dt(Box)`
3354
3343
  key
3355
3344
  );
3356
3345
  }) }),
3357
- /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
3358
- /* @__PURE__ */ jsxs(Flex, { gap: 3, align: "center", justify: "space-between", children: [
3359
- /* @__PURE__ */ jsxs(Flex, { gap: 2, align: "center", children: [
3360
- /* @__PURE__ */ jsx(
3361
- Button,
3346
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
3347
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 3, align: "center", justify: "space-between", children: [
3348
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, align: "center", children: [
3349
+ /* @__PURE__ */ jsxRuntime.jsx(
3350
+ ui.Button,
3362
3351
  {
3363
3352
  mode: "ghost",
3364
3353
  tone: "primary",
3365
3354
  onClick: () => handleImportTranslations(),
3366
3355
  text: isImporting ? "Importing..." : "Import All",
3367
- icon: DownloadIcon,
3356
+ icon: icons.DownloadIcon,
3368
3357
  disabled: isImporting || availableLocales.every((locale) => {
3369
3358
  const key = createTranslationStatusKey(
3370
3359
  branchId,
@@ -3377,19 +3366,19 @@ const WrapText = dt(Box)`
3377
3366
  style: { minWidth: "180px" }
3378
3367
  }
3379
3368
  ),
3380
- /* @__PURE__ */ jsxs(Flex, { gap: 2, align: "center", children: [
3381
- /* @__PURE__ */ jsx(
3382
- Switch,
3369
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, align: "center", children: [
3370
+ /* @__PURE__ */ jsxRuntime.jsx(
3371
+ ui.Switch,
3383
3372
  {
3384
3373
  checked: autoImport,
3385
3374
  onChange: () => setAutoImport(!autoImport),
3386
3375
  disabled: isImporting
3387
3376
  }
3388
3377
  ),
3389
- /* @__PURE__ */ jsx(Text, { size: 1, children: "Auto-import when complete" })
3378
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: "Auto-import when complete" })
3390
3379
  ] })
3391
3380
  ] }),
3392
- /* @__PURE__ */ jsxs(Text, { size: 1, muted: !0, children: [
3381
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: 1, muted: !0, children: [
3393
3382
  "Imported",
3394
3383
  " ",
3395
3384
  availableLocales.filter((locale) => {
@@ -3413,14 +3402,14 @@ const WrapText = dt(Box)`
3413
3402
  }).length
3414
3403
  ] })
3415
3404
  ] }),
3416
- /* @__PURE__ */ jsxs(Flex, { gap: 2, align: "center", justify: "flex-start", children: [
3417
- /* @__PURE__ */ jsx(
3418
- Tooltip,
3405
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, align: "center", justify: "flex-start", children: [
3406
+ /* @__PURE__ */ jsxRuntime.jsx(
3407
+ ui.Tooltip,
3419
3408
  {
3420
3409
  placement: "top",
3421
3410
  content: `Replaces references to ${pluginConfig.getSourceLocale()} documents in this document with the corresponding translated document reference`,
3422
- children: /* @__PURE__ */ jsx(
3423
- Button,
3411
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3412
+ ui.Button,
3424
3413
  {
3425
3414
  mode: "ghost",
3426
3415
  tone: "caution",
@@ -3428,33 +3417,33 @@ const WrapText = dt(Box)`
3428
3417
  await handlePatchDocumentReferences();
3429
3418
  },
3430
3419
  text: isBusy ? "Patching..." : "Patch References",
3431
- icon: isBusy ? null : LinkIcon,
3420
+ icon: isBusy ? null : icons.LinkIcon,
3432
3421
  disabled: isBusy || isImporting,
3433
3422
  style: { minWidth: "180px" }
3434
3423
  }
3435
3424
  )
3436
3425
  }
3437
3426
  ),
3438
- /* @__PURE__ */ jsxs(Flex, { gap: 2, align: "center", children: [
3439
- /* @__PURE__ */ jsx(
3440
- Switch,
3427
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, align: "center", children: [
3428
+ /* @__PURE__ */ jsxRuntime.jsx(
3429
+ ui.Switch,
3441
3430
  {
3442
3431
  checked: autoPatchReferences,
3443
3432
  onChange: () => setAutoPatchReferences(!autoPatchReferences),
3444
3433
  disabled: isImporting || isBusy
3445
3434
  }
3446
3435
  ),
3447
- /* @__PURE__ */ jsx(Text, { size: 1, children: "Auto-patch after import" })
3436
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: "Auto-patch after import" })
3448
3437
  ] })
3449
3438
  ] }),
3450
- /* @__PURE__ */ jsxs(Flex, { gap: 2, align: "center", justify: "flex-start", children: [
3451
- /* @__PURE__ */ jsx(
3452
- Tooltip,
3439
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, align: "center", justify: "flex-start", children: [
3440
+ /* @__PURE__ */ jsxRuntime.jsx(
3441
+ ui.Tooltip,
3453
3442
  {
3454
3443
  placement: "top",
3455
3444
  content: "Publishes all translations (if the source document is published)",
3456
- children: /* @__PURE__ */ jsx(
3457
- Button,
3445
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3446
+ ui.Button,
3458
3447
  {
3459
3448
  mode: "ghost",
3460
3449
  tone: "positive",
@@ -3467,48 +3456,48 @@ const WrapText = dt(Box)`
3467
3456
  }
3468
3457
  },
3469
3458
  text: isPublishing ? "Publishing..." : "Publish Translations",
3470
- icon: isPublishing ? null : PublishIcon,
3459
+ icon: isPublishing ? null : icons.PublishIcon,
3471
3460
  disabled: isBusy || isPublishing || isImporting,
3472
3461
  style: { minWidth: "180px" }
3473
3462
  }
3474
3463
  )
3475
3464
  }
3476
3465
  ),
3477
- /* @__PURE__ */ jsxs(Flex, { gap: 2, align: "center", children: [
3478
- /* @__PURE__ */ jsx(
3479
- Switch,
3466
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, align: "center", children: [
3467
+ /* @__PURE__ */ jsxRuntime.jsx(
3468
+ ui.Switch,
3480
3469
  {
3481
3470
  checked: autoPublish,
3482
3471
  onChange: () => setAutoPublish(!autoPublish),
3483
3472
  disabled: isPublishing || isImporting || isBusy
3484
3473
  }
3485
3474
  ),
3486
- /* @__PURE__ */ jsx(Text, { size: 1, children: "Auto-publish after import" })
3475
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: "Auto-publish after import" })
3487
3476
  ] })
3488
3477
  ] })
3489
3478
  ] })
3490
3479
  ] })
3491
- ] }) : /* @__PURE__ */ jsx(Card, { padding: 4, tone: "neutral", border: !0, children: /* @__PURE__ */ jsxs(Text, { size: 1, muted: !0, children: [
3480
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { padding: 4, tone: "neutral", border: !0, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: 1, muted: !0, children: [
3492
3481
  "Translation tools are only available for",
3493
3482
  " ",
3494
- /* @__PURE__ */ jsx("code", { children: pluginConfig.getSourceLocale() }),
3483
+ /* @__PURE__ */ jsxRuntime.jsx("code", { children: pluginConfig.getSourceLocale() }),
3495
3484
  " documents."
3496
3485
  ] }) });
3497
3486
  }, TranslationTab = (props) => {
3498
3487
  const { displayed } = props.document;
3499
- return /* @__PURE__ */ jsx(BaseTranslationWrapper, { showContainer: !1, children: /* @__PURE__ */ jsx(TranslationsProvider, { singleDocument: displayed, children: /* @__PURE__ */ jsx(TranslationView, {}) }) });
3488
+ return /* @__PURE__ */ jsxRuntime.jsx(BaseTranslationWrapper, { showContainer: !1, children: /* @__PURE__ */ jsxRuntime.jsx(TranslationsProvider, { singleDocument: displayed, children: /* @__PURE__ */ jsxRuntime.jsx(TranslationView, {}) }) });
3500
3489
  }, translateAction = (props) => {
3501
- const [dialogOpen, setDialogOpen] = useState(!1), document2 = props.draft || props.published;
3490
+ const [dialogOpen, setDialogOpen] = o.useState(!1), document2 = props.draft || props.published;
3502
3491
  return {
3503
3492
  label: "Translate",
3504
- icon: TranslateIcon,
3493
+ icon: icons.TranslateIcon,
3505
3494
  tone: "primary",
3506
3495
  onHandle: () => setDialogOpen(!0),
3507
3496
  dialog: dialogOpen ? {
3508
3497
  type: "dialog",
3509
3498
  header: "Translations",
3510
3499
  onClose: () => setDialogOpen(!1),
3511
- content: /* @__PURE__ */ jsx(BaseTranslationWrapper, { showContainer: !1, children: /* @__PURE__ */ jsx(TranslationsProvider, { singleDocument: document2, children: /* @__PURE__ */ jsx(TranslationView, {}) }) })
3500
+ content: /* @__PURE__ */ jsxRuntime.jsx(BaseTranslationWrapper, { showContainer: !1, children: /* @__PURE__ */ jsxRuntime.jsx(TranslationsProvider, { singleDocument: document2, children: /* @__PURE__ */ jsxRuntime.jsx(TranslationView, {}) }) })
3512
3501
  } : null
3513
3502
  };
3514
3503
  }, TranslationsTable = () => {
@@ -3522,19 +3511,19 @@ const WrapText = dt(Box)`
3522
3511
  handleImportDocument,
3523
3512
  branchId
3524
3513
  } = useTranslations();
3525
- return loadingDocuments ? /* @__PURE__ */ jsx(Flex, { align: "center", justify: "center", padding: 4, children: /* @__PURE__ */ jsx(Spinner, {}) }) : /* @__PURE__ */ jsx(Box, { style: { maxHeight: "60vh", overflowY: "auto" }, children: /* @__PURE__ */ jsx(Stack, { space: 2, children: documents.map((document2) => /* @__PURE__ */ jsx(Card, { shadow: 1, padding: 3, children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
3526
- /* @__PURE__ */ jsx(Flex, { justify: "space-between", align: "flex-start", children: /* @__PURE__ */ jsxs(Box, { flex: 1, children: [
3527
- /* @__PURE__ */ jsx(Text, { weight: "semibold", size: 1, children: getDocumentPublishedId(document2) }),
3528
- /* @__PURE__ */ jsx(Text, { size: 0, muted: !0, style: { marginTop: "2px" }, children: document2._type })
3514
+ return loadingDocuments ? /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { align: "center", justify: "center", padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, {}) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { style: { maxHeight: "60vh", overflowY: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { space: 2, children: documents.map((document2) => /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { shadow: 1, padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
3515
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { justify: "space-between", align: "flex-start", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { flex: 1, children: [
3516
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "semibold", size: 1, children: getDocumentPublishedId(document2) }),
3517
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 0, muted: !0, style: { marginTop: "2px" }, children: document2._type })
3529
3518
  ] }) }),
3530
- /* @__PURE__ */ jsx(Stack, { space: 2, children: locales.length > 0 ? locales.filter((locale) => locale.enabled !== !1).map((locale) => {
3519
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { space: 2, children: locales.length > 0 ? locales.filter((locale) => locale.enabled !== !1).map((locale) => {
3531
3520
  const documentId = getDocumentPublishedId(document2), key = createTranslationStatusKey(
3532
3521
  branchId,
3533
3522
  documentId,
3534
3523
  document2._rev,
3535
3524
  locale.localeId
3536
3525
  ), status = translationStatuses.get(key), isDownloaded = downloadStatus.downloaded.has(key), isImported = importedTranslations.has(key);
3537
- return /* @__PURE__ */ jsx(
3526
+ return /* @__PURE__ */ jsxRuntime.jsx(
3538
3527
  LanguageStatus,
3539
3528
  {
3540
3529
  title: locale.description || locale.localeId,
@@ -3550,40 +3539,40 @@ const WrapText = dt(Box)`
3550
3539
  },
3551
3540
  `${document2._id}-${document2._rev}-${locale.localeId}`
3552
3541
  );
3553
- }) : /* @__PURE__ */ jsx(Text, { size: 1, muted: !0, children: "No locales configured" }) })
3542
+ }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, muted: !0, children: "No locales configured" }) })
3554
3543
  ] }) }, document2._id)) }) });
3555
3544
  }, TranslateAllDialog = ({
3556
3545
  isOpen,
3557
3546
  onClose
3558
3547
  }) => {
3559
- const { documents, handleTranslateAll } = useTranslations();
3560
- return isOpen ? /* @__PURE__ */ jsx(
3561
- Dialog,
3548
+ const { documents, handleTranslateAll } = useTranslations(), handleConfirm = async () => {
3549
+ onClose(), await handleTranslateAll();
3550
+ };
3551
+ return isOpen ? /* @__PURE__ */ jsxRuntime.jsx(
3552
+ ui.Dialog,
3562
3553
  {
3563
3554
  header: "Confirm Translation",
3564
3555
  id: "translate-all-dialog",
3565
3556
  onClose,
3566
- footer: /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
3567
- /* @__PURE__ */ jsx(Button, { text: "Cancel", mode: "ghost", onClick: onClose }),
3568
- /* @__PURE__ */ jsx(
3569
- Button,
3557
+ footer: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, children: [
3558
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { text: "Cancel", mode: "ghost", onClick: onClose }),
3559
+ /* @__PURE__ */ jsxRuntime.jsx(
3560
+ ui.Button,
3570
3561
  {
3571
3562
  text: "Translate All",
3572
3563
  tone: "critical",
3573
- onClick: async () => {
3574
- onClose(), await handleTranslateAll();
3575
- }
3564
+ onClick: handleConfirm
3576
3565
  }
3577
3566
  )
3578
3567
  ] }) }),
3579
- children: /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
3580
- /* @__PURE__ */ jsxs(Text, { children: [
3568
+ children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
3569
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { children: [
3581
3570
  "Are you sure you want to create translations for all",
3582
3571
  " ",
3583
3572
  documents.length,
3584
3573
  " documents?"
3585
3574
  ] }),
3586
- /* @__PURE__ */ jsx(Text, { size: 1, muted: !0, children: "This will submit all documents to General Translation for processing." })
3575
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, muted: !0, children: "This will submit all documents to General Translation for processing." })
3587
3576
  ] }) })
3588
3577
  }
3589
3578
  ) : null;
@@ -3591,27 +3580,27 @@ const WrapText = dt(Box)`
3591
3580
  isOpen,
3592
3581
  onClose
3593
3582
  }) => {
3594
- const { documents, handleImportAll } = useTranslations();
3595
- return isOpen ? /* @__PURE__ */ jsx(
3596
- Dialog,
3583
+ const { documents, handleImportAll } = useTranslations(), handleConfirm = async () => {
3584
+ onClose(), await handleImportAll();
3585
+ };
3586
+ return isOpen ? /* @__PURE__ */ jsxRuntime.jsx(
3587
+ ui.Dialog,
3597
3588
  {
3598
3589
  header: "Confirm Import",
3599
3590
  id: "import-all-dialog",
3600
3591
  onClose,
3601
- footer: /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
3602
- /* @__PURE__ */ jsx(Button, { text: "Cancel", mode: "ghost", onClick: onClose }),
3603
- /* @__PURE__ */ jsx(Button, { text: "Import All", tone: "critical", onClick: async () => {
3604
- onClose(), await handleImportAll();
3605
- } })
3592
+ footer: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, children: [
3593
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { text: "Cancel", mode: "ghost", onClick: onClose }),
3594
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { text: "Import All", tone: "critical", onClick: handleConfirm })
3606
3595
  ] }) }),
3607
- children: /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
3608
- /* @__PURE__ */ jsxs(Text, { children: [
3596
+ children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
3597
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { children: [
3609
3598
  "Are you sure you want to import translations for all",
3610
3599
  " ",
3611
3600
  documents.length,
3612
3601
  " documents?"
3613
3602
  ] }),
3614
- /* @__PURE__ */ jsx(Text, { size: 1, muted: !0, children: "This will download and apply translated content to your documents. Note that this will overwrite any existing translations!" })
3603
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, muted: !0, children: "This will download and apply translated content to your documents. Note that this will overwrite any existing translations!" })
3615
3604
  ] }) })
3616
3605
  }
3617
3606
  ) : null;
@@ -3619,29 +3608,29 @@ const WrapText = dt(Box)`
3619
3608
  isOpen,
3620
3609
  onClose
3621
3610
  }) => {
3622
- const { handleImportMissing } = useTranslations();
3623
- return isOpen ? /* @__PURE__ */ jsx(
3624
- Dialog,
3611
+ const { handleImportMissing } = useTranslations(), handleConfirm = async () => {
3612
+ onClose(), await handleImportMissing();
3613
+ };
3614
+ return isOpen ? /* @__PURE__ */ jsxRuntime.jsx(
3615
+ ui.Dialog,
3625
3616
  {
3626
3617
  header: "Confirm Import Missing",
3627
3618
  id: "import-missing-dialog",
3628
3619
  onClose,
3629
- footer: /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
3630
- /* @__PURE__ */ jsx(Button, { text: "Cancel", mode: "ghost", onClick: onClose }),
3631
- /* @__PURE__ */ jsx(
3632
- Button,
3620
+ footer: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, children: [
3621
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { text: "Cancel", mode: "ghost", onClick: onClose }),
3622
+ /* @__PURE__ */ jsxRuntime.jsx(
3623
+ ui.Button,
3633
3624
  {
3634
3625
  text: "Import Missing",
3635
3626
  tone: "primary",
3636
- onClick: async () => {
3637
- onClose(), await handleImportMissing();
3638
- }
3627
+ onClick: handleConfirm
3639
3628
  }
3640
3629
  )
3641
3630
  ] }) }),
3642
- children: /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
3643
- /* @__PURE__ */ jsx(Text, { children: "Import only the missing translations (translations that are ready but haven't been imported to Sanity yet)?" }),
3644
- /* @__PURE__ */ jsx(Text, { size: 1, muted: !0, children: "This will check existing translation metadata and only import translations that don't already exist in your dataset." })
3631
+ children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
3632
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Import only the missing translations (translations that are ready but haven't been imported to Sanity yet)?" }),
3633
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, muted: !0, children: "This will check existing translation metadata and only import translations that don't already exist in your dataset." })
3645
3634
  ] }) })
3646
3635
  }
3647
3636
  ) : null;
@@ -3650,9 +3639,9 @@ const WrapText = dt(Box)`
3650
3639
  current,
3651
3640
  total,
3652
3641
  operationName
3653
- }) => isActive ? /* @__PURE__ */ jsxs(Flex, { justify: "center", align: "center", gap: 3, children: [
3654
- /* @__PURE__ */ jsx(Spinner, { size: 1 }),
3655
- /* @__PURE__ */ jsxs(Text, { size: 1, children: [
3642
+ }) => isActive ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "center", align: "center", gap: 3, children: [
3643
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, { size: 1 }),
3644
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: 1, children: [
3656
3645
  operationName,
3657
3646
  " ",
3658
3647
  current,
@@ -3661,7 +3650,7 @@ const WrapText = dt(Box)`
3661
3650
  "..."
3662
3651
  ] })
3663
3652
  ] }) : null, TranslationsToolContent = () => {
3664
- const [isTranslateAllDialogOpen, setIsTranslateAllDialogOpen] = useState(!1), [isImportAllDialogOpen, setIsImportAllDialogOpen] = useState(!1), [isImportMissingDialogOpen, setIsImportMissingDialogOpen] = useState(!1), {
3653
+ const [isTranslateAllDialogOpen, setIsTranslateAllDialogOpen] = o.useState(!1), [isImportAllDialogOpen, setIsImportAllDialogOpen] = o.useState(!1), [isImportMissingDialogOpen, setIsImportMissingDialogOpen] = o.useState(!1), {
3665
3654
  isBusy,
3666
3655
  documents,
3667
3656
  locales,
@@ -3674,7 +3663,7 @@ const WrapText = dt(Box)`
3674
3663
  handleRefreshAll,
3675
3664
  handlePatchDocumentReferences,
3676
3665
  handlePublishAllTranslations
3677
- } = useTranslations(), [currentOperation, setCurrentOperation] = useState(null), getOperationText = (operationName, isProcessing) => {
3666
+ } = useTranslations(), [currentOperation, setCurrentOperation] = o.useState(null), getOperationText = (operationName, isProcessing) => {
3678
3667
  if (!isProcessing || !operationName) return operationName;
3679
3668
  switch (operationName) {
3680
3669
  case "Translate All":
@@ -3704,28 +3693,28 @@ const WrapText = dt(Box)`
3704
3693
  return "Processing";
3705
3694
  }
3706
3695
  };
3707
- return o.useEffect(() => {
3696
+ return o__default.default.useEffect(() => {
3708
3697
  !isBusy && !importProgress.isImporting && setCurrentOperation(null);
3709
- }, [isBusy, importProgress.isImporting]), /* @__PURE__ */ jsxs(Container, { width: 2, children: [
3710
- /* @__PURE__ */ jsx(Box, { padding: 4, marginTop: 5, children: /* @__PURE__ */ jsxs(Stack, { space: 4, children: [
3711
- /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "space-between", children: [
3712
- /* @__PURE__ */ jsxs(Stack, { space: 2, children: [
3713
- /* @__PURE__ */ jsx(Heading, { as: "h2", size: 3, children: "Translations" }),
3714
- /* @__PURE__ */ jsx(Text, { size: 2, children: "Manage your document translations from this centralized location." })
3698
+ }, [isBusy, importProgress.isImporting]), /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { width: 2, children: [
3699
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 4, marginTop: 5, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 4, children: [
3700
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", justify: "space-between", children: [
3701
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 2, children: [
3702
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { as: "h2", size: 3, children: "Translations" }),
3703
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 2, children: "Manage your document translations from this centralized location." })
3715
3704
  ] }),
3716
- /* @__PURE__ */ jsxs(Flex, { gap: 3, align: "center", children: [
3717
- /* @__PURE__ */ jsxs(Flex, { gap: 2, align: "center", children: [
3718
- /* @__PURE__ */ jsx(Text, { size: 1, children: "Auto-refresh" }),
3719
- /* @__PURE__ */ jsx(
3720
- Switch,
3705
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 3, align: "center", children: [
3706
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, align: "center", children: [
3707
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: "Auto-refresh" }),
3708
+ /* @__PURE__ */ jsxRuntime.jsx(
3709
+ ui.Switch,
3721
3710
  {
3722
3711
  checked: autoRefresh,
3723
3712
  onChange: () => setAutoRefresh(!autoRefresh)
3724
3713
  }
3725
3714
  )
3726
3715
  ] }),
3727
- /* @__PURE__ */ jsx(
3728
- Button,
3716
+ /* @__PURE__ */ jsxRuntime.jsx(
3717
+ ui.Button,
3729
3718
  {
3730
3719
  fontSize: 1,
3731
3720
  padding: 2,
@@ -3736,10 +3725,10 @@ const WrapText = dt(Box)`
3736
3725
  )
3737
3726
  ] })
3738
3727
  ] }),
3739
- /* @__PURE__ */ jsxs(Stack, { space: 4, children: [
3740
- /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { size: 1, muted: !0, children: loadingDocuments ? "Loading documents..." : `Found ${documents.length} documents available for translation` }) }),
3741
- /* @__PURE__ */ jsx(Flex, { justify: "center", children: /* @__PURE__ */ jsx(
3742
- Button,
3728
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 4, children: [
3729
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, muted: !0, children: loadingDocuments ? "Loading documents..." : `Found ${documents.length} documents available for translation` }) }),
3730
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { justify: "center", children: /* @__PURE__ */ jsxRuntime.jsx(
3731
+ ui.Button,
3743
3732
  {
3744
3733
  style: { width: "200px" },
3745
3734
  tone: "critical",
@@ -3753,17 +3742,17 @@ const WrapText = dt(Box)`
3753
3742
  disabled: isBusy || loadingDocuments || documents.length === 0
3754
3743
  }
3755
3744
  ) }),
3756
- /* @__PURE__ */ jsx(TranslationsTable, {}),
3757
- /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
3758
- /* @__PURE__ */ jsxs(Flex, { gap: 3, align: "center", justify: "space-between", children: [
3759
- /* @__PURE__ */ jsxs(Flex, { gap: 2, align: "center", children: [
3760
- /* @__PURE__ */ jsx(
3761
- Tooltip,
3745
+ /* @__PURE__ */ jsxRuntime.jsx(TranslationsTable, {}),
3746
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
3747
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 3, align: "center", justify: "space-between", children: [
3748
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, align: "center", children: [
3749
+ /* @__PURE__ */ jsxRuntime.jsx(
3750
+ ui.Tooltip,
3762
3751
  {
3763
3752
  placement: "top",
3764
3753
  content: "Imports and overrides all translations",
3765
- children: /* @__PURE__ */ jsx(
3766
- Button,
3754
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3755
+ ui.Button,
3767
3756
  {
3768
3757
  mode: "ghost",
3769
3758
  onClick: () => {
@@ -3773,19 +3762,19 @@ const WrapText = dt(Box)`
3773
3762
  "Import All",
3774
3763
  isBusy && currentOperation === "Import All"
3775
3764
  ),
3776
- icon: isBusy && currentOperation === "Import All" ? null : DownloadIcon,
3765
+ icon: isBusy && currentOperation === "Import All" ? null : icons.DownloadIcon,
3777
3766
  disabled: isBusy || loadingDocuments || documents.length === 0
3778
3767
  }
3779
3768
  )
3780
3769
  }
3781
3770
  ),
3782
- /* @__PURE__ */ jsx(
3783
- Tooltip,
3771
+ /* @__PURE__ */ jsxRuntime.jsx(
3772
+ ui.Tooltip,
3784
3773
  {
3785
3774
  placement: "top",
3786
3775
  content: "Imports all translations that are not yet imported (according to the source document's translation.metadata document)",
3787
- children: /* @__PURE__ */ jsx(
3788
- Button,
3776
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3777
+ ui.Button,
3789
3778
  {
3790
3779
  mode: "ghost",
3791
3780
  tone: "primary",
@@ -3796,19 +3785,19 @@ const WrapText = dt(Box)`
3796
3785
  "Import Missing",
3797
3786
  isBusy && currentOperation === "Import Missing"
3798
3787
  ),
3799
- icon: isBusy && currentOperation === "Import Missing" ? null : DownloadIcon,
3788
+ icon: isBusy && currentOperation === "Import Missing" ? null : icons.DownloadIcon,
3800
3789
  disabled: isBusy || loadingDocuments || documents.length === 0
3801
3790
  }
3802
3791
  )
3803
3792
  }
3804
3793
  ),
3805
- /* @__PURE__ */ jsx(
3806
- Tooltip,
3794
+ /* @__PURE__ */ jsxRuntime.jsx(
3795
+ ui.Tooltip,
3807
3796
  {
3808
3797
  placement: "top",
3809
3798
  content: "Replaces references in documents with the corresponding translated document reference",
3810
- children: /* @__PURE__ */ jsx(
3811
- Button,
3799
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3800
+ ui.Button,
3812
3801
  {
3813
3802
  mode: "ghost",
3814
3803
  tone: "caution",
@@ -3819,19 +3808,19 @@ const WrapText = dt(Box)`
3819
3808
  "Patch Document References",
3820
3809
  isBusy && currentOperation === "Patch Document References"
3821
3810
  ),
3822
- icon: isBusy && currentOperation === "Patch Document References" ? null : LinkIcon,
3811
+ icon: isBusy && currentOperation === "Patch Document References" ? null : icons.LinkIcon,
3823
3812
  disabled: isBusy || loadingDocuments || documents.length === 0
3824
3813
  }
3825
3814
  )
3826
3815
  }
3827
3816
  ),
3828
- /* @__PURE__ */ jsx(
3829
- Tooltip,
3817
+ /* @__PURE__ */ jsxRuntime.jsx(
3818
+ ui.Tooltip,
3830
3819
  {
3831
3820
  placement: "top",
3832
3821
  content: "Publishes all translations whose source document is published",
3833
- children: /* @__PURE__ */ jsx(
3834
- Button,
3822
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3823
+ ui.Button,
3835
3824
  {
3836
3825
  mode: "ghost",
3837
3826
  tone: "positive",
@@ -3842,17 +3831,17 @@ const WrapText = dt(Box)`
3842
3831
  "Publish Translations",
3843
3832
  isBusy && currentOperation === "Publish Translations"
3844
3833
  ),
3845
- icon: isBusy && currentOperation === "Publish Translations" ? null : PublishIcon,
3834
+ icon: isBusy && currentOperation === "Publish Translations" ? null : icons.PublishIcon,
3846
3835
  disabled: isBusy || loadingDocuments || documents.length === 0
3847
3836
  }
3848
3837
  )
3849
3838
  }
3850
3839
  ),
3851
- importedTranslations.size === documents.length * locales.filter((l) => l.enabled !== !1).length && documents.length > 0 && locales.length > 0 && /* @__PURE__ */ jsxs(Flex, { gap: 2, align: "center", style: { color: "green" }, children: [
3852
- /* @__PURE__ */ jsx(CheckmarkCircleIcon, {}),
3853
- /* @__PURE__ */ jsx(Text, { size: 1, children: "All translations imported" })
3840
+ importedTranslations.size === documents.length * locales.filter((l) => l.enabled !== !1).length && documents.length > 0 && locales.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, align: "center", style: { color: "green" }, children: [
3841
+ /* @__PURE__ */ jsxRuntime.jsx(icons.CheckmarkCircleIcon, {}),
3842
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: "All translations imported" })
3854
3843
  ] }),
3855
- importedTranslations.size > 0 && importedTranslations.size < documents.length * locales.filter((l) => l.enabled !== !1).length && /* @__PURE__ */ jsxs(Text, { size: 1, style: { color: "#666" }, children: [
3844
+ importedTranslations.size > 0 && importedTranslations.size < documents.length * locales.filter((l) => l.enabled !== !1).length && /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: 1, style: { color: "#666" }, children: [
3856
3845
  importedTranslations.size,
3857
3846
  "/",
3858
3847
  documents.length * locales.filter((l) => l.enabled !== !1).length,
@@ -3860,9 +3849,9 @@ const WrapText = dt(Box)`
3860
3849
  "imported"
3861
3850
  ] })
3862
3851
  ] }),
3863
- /* @__PURE__ */ jsx(Box, {})
3852
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, {})
3864
3853
  ] }),
3865
- /* @__PURE__ */ jsx(
3854
+ /* @__PURE__ */ jsxRuntime.jsx(
3866
3855
  BatchProgress,
3867
3856
  {
3868
3857
  isActive: importProgress.isImporting,
@@ -3873,28 +3862,28 @@ const WrapText = dt(Box)`
3873
3862
  )
3874
3863
  ] })
3875
3864
  ] }),
3876
- /* @__PURE__ */ jsxs(Text, { size: 2, children: [
3865
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: 2, children: [
3877
3866
  "For more information, see the",
3878
3867
  " ",
3879
- /* @__PURE__ */ jsx(Link, { href: "https://dash.generaltranslation.com", children: "General Translation Dashboard" }),
3868
+ /* @__PURE__ */ jsxRuntime.jsx(router.Link, { href: "https://dash.generaltranslation.com", children: "General Translation Dashboard" }),
3880
3869
  "."
3881
3870
  ] })
3882
3871
  ] }) }),
3883
- /* @__PURE__ */ jsx(
3872
+ /* @__PURE__ */ jsxRuntime.jsx(
3884
3873
  TranslateAllDialog,
3885
3874
  {
3886
3875
  isOpen: isTranslateAllDialogOpen,
3887
3876
  onClose: () => setIsTranslateAllDialogOpen(!1)
3888
3877
  }
3889
3878
  ),
3890
- /* @__PURE__ */ jsx(
3879
+ /* @__PURE__ */ jsxRuntime.jsx(
3891
3880
  ImportAllDialog,
3892
3881
  {
3893
3882
  isOpen: isImportAllDialogOpen,
3894
3883
  onClose: () => setIsImportAllDialogOpen(!1)
3895
3884
  }
3896
3885
  ),
3897
- /* @__PURE__ */ jsx(
3886
+ /* @__PURE__ */ jsxRuntime.jsx(
3898
3887
  ImportMissingDialog,
3899
3888
  {
3900
3889
  isOpen: isImportMissingDialogOpen,
@@ -3902,7 +3891,7 @@ const WrapText = dt(Box)`
3902
3891
  }
3903
3892
  )
3904
3893
  ] });
3905
- }, TranslationsTool = () => /* @__PURE__ */ jsx(BaseTranslationWrapper, { showContainer: !1, children: /* @__PURE__ */ jsx(TranslationsProvider, { children: /* @__PURE__ */ jsx(TranslationsToolContent, {}) }) }), gtPlugin = definePlugin(
3894
+ }, TranslationsTool = () => /* @__PURE__ */ jsxRuntime.jsx(BaseTranslationWrapper, { showContainer: !1, children: /* @__PURE__ */ jsxRuntime.jsx(TranslationsProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(TranslationsToolContent, {}) }) }), gtPlugin = sanity.definePlugin(
3906
3895
  ({
3907
3896
  languageField = "language",
3908
3897
  sourceLocale,
@@ -3924,7 +3913,7 @@ const WrapText = dt(Box)`
3924
3913
  additionalBlockDeserializers = [],
3925
3914
  showDocumentInternationalization = !0
3926
3915
  }) => {
3927
- const resolvedSourceLocale = sourceLocale ?? defaultLocale ?? libraryDefaultLocale;
3916
+ const resolvedSourceLocale = sourceLocale ?? defaultLocale ?? internal.libraryDefaultLocale;
3928
3917
  let normalizedTranslateDocuments;
3929
3918
  translateDocuments && (normalizedTranslateDocuments = translateDocuments.map((entry) => typeof entry == "string" ? { type: entry } : entry).filter((filter2) => filter2.documentId || filter2.type)), pluginConfig.init(
3930
3919
  secretsNamespace,
@@ -3953,11 +3942,11 @@ const WrapText = dt(Box)`
3953
3942
  const schemaTypes = normalizedTranslateDocuments?.map((filter2) => filter2.type).filter((type) => !!type) ?? [];
3954
3943
  if (schemaTypes.length > 0) {
3955
3944
  const supportedLanguages = [resolvedSourceLocale, ...locales].map((locale) => {
3956
- const props = getLocaleProperties(locale, resolvedSourceLocale);
3945
+ const props = generaltranslation.getLocaleProperties(locale, resolvedSourceLocale);
3957
3946
  return { id: locale, title: props.name };
3958
3947
  });
3959
3948
  plugins.push(
3960
- documentInternationalization({
3949
+ documentInternationalization.documentInternationalization({
3961
3950
  supportedLanguages,
3962
3951
  schemaTypes,
3963
3952
  languageField
@@ -3973,7 +3962,7 @@ const WrapText = dt(Box)`
3973
3962
  name: "translations",
3974
3963
  title: "Translations",
3975
3964
  component: TranslationsTool,
3976
- router: route.create("/*")
3965
+ router: router.route.create("/*")
3977
3966
  }
3978
3967
  ],
3979
3968
  document: {
@@ -3982,22 +3971,45 @@ const WrapText = dt(Box)`
3982
3971
  };
3983
3972
  }
3984
3973
  );
3985
- export {
3986
- BaseDocumentDeserializer,
3987
- BaseDocumentMerger,
3988
- BaseDocumentSerializer,
3989
- DocumentInternationalizationMenu,
3990
- TranslationTab as TranslationsTab,
3991
- attachGTData,
3992
- customSerializers,
3993
- defaultStopTypes,
3994
- detachGTData,
3995
- documentInternationalization2 as documentInternationalization,
3996
- findLatestDraft,
3997
- gtPlugin,
3998
- translateAction,
3999
- useDeleteTranslationAction,
4000
- useDocumentInternationalizationContext,
4001
- useDuplicateWithTranslationsAction
4002
- };
4003
- //# sourceMappingURL=index.mjs.map
3974
+ Object.defineProperty(exports, "DocumentInternationalizationMenu", {
3975
+ enumerable: !0,
3976
+ get: function() {
3977
+ return documentInternationalization.DocumentInternationalizationMenu;
3978
+ }
3979
+ });
3980
+ Object.defineProperty(exports, "documentInternationalization", {
3981
+ enumerable: !0,
3982
+ get: function() {
3983
+ return documentInternationalization.documentInternationalization;
3984
+ }
3985
+ });
3986
+ Object.defineProperty(exports, "useDeleteTranslationAction", {
3987
+ enumerable: !0,
3988
+ get: function() {
3989
+ return documentInternationalization.useDeleteTranslationAction;
3990
+ }
3991
+ });
3992
+ Object.defineProperty(exports, "useDocumentInternationalizationContext", {
3993
+ enumerable: !0,
3994
+ get: function() {
3995
+ return documentInternationalization.useDocumentInternationalizationContext;
3996
+ }
3997
+ });
3998
+ Object.defineProperty(exports, "useDuplicateWithTranslationsAction", {
3999
+ enumerable: !0,
4000
+ get: function() {
4001
+ return documentInternationalization.useDuplicateWithTranslationsAction;
4002
+ }
4003
+ });
4004
+ exports.BaseDocumentDeserializer = BaseDocumentDeserializer;
4005
+ exports.BaseDocumentMerger = BaseDocumentMerger;
4006
+ exports.BaseDocumentSerializer = BaseDocumentSerializer;
4007
+ exports.TranslationsTab = TranslationTab;
4008
+ exports.attachGTData = attachGTData;
4009
+ exports.customSerializers = customSerializers;
4010
+ exports.defaultStopTypes = defaultStopTypes;
4011
+ exports.detachGTData = detachGTData;
4012
+ exports.findLatestDraft = findLatestDraft;
4013
+ exports.gtPlugin = gtPlugin;
4014
+ exports.translateAction = translateAction;
4015
+ //# sourceMappingURL=index.cjs.map