sanity-plugin-media 6.1.5 → 6.1.7

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.
package/dist/index.js CHANGED
@@ -11,8 +11,8 @@ import { combineReducers, configureStore, createAction, createSelector, createSl
11
11
  import groq from "groq";
12
12
  import { nanoid } from "nanoid";
13
13
  import { combineEpics, createEpicMiddleware, ofType } from "redux-observable";
14
- import { EMPTY, Observable, Subject, from, iif, merge, of, throwError } from "rxjs";
15
- import { bufferTime, catchError, concatMap, debounceTime, delay, filter, first, map, mergeMap, switchMap, takeUntil, withLatestFrom } from "rxjs/operators";
14
+ import { EMPTY, Observable, Subject, from, iif, merge, of, takeUntil, throwError } from "rxjs";
15
+ import { bufferTime, catchError, concatMap, debounceTime, delay, filter, first, map, mergeMap, switchMap, takeUntil as takeUntil$1, withLatestFrom } from "rxjs/operators";
16
16
  import { uuid } from "@sanity/uuid";
17
17
  import pluralize from "pluralize";
18
18
  import { createGlobalStyle, css, styled } from "styled-components";
@@ -75,12 +75,12 @@ const AssetSourceDispatchContext = createContext(void 0), AssetBrowserDispatchPr
75
75
  if (context === void 0) throw Error("useAssetSourceActions must be used within an AssetSourceDispatchProvider");
76
76
  return context;
77
77
  }, useRootPortalElement = () => {
78
- let $ = c(3), [container] = useState(_temp$37), t0, t1;
78
+ let $ = c(3), [container] = useState(_temp$38), t0, t1;
79
79
  return $[0] === container ? (t0 = $[1], t1 = $[2]) : (t0 = () => (container.classList.add("media-portal"), document.body.appendChild(container), () => {
80
80
  document.body.removeChild(container);
81
81
  }), t1 = [container], $[0] = container, $[1] = t0, $[2] = t1), useEffect(t0, t1), container;
82
82
  };
83
- function _temp$37() {
83
+ function _temp$38() {
84
84
  return document.createElement("div");
85
85
  }
86
86
  const useTypedSelector = useSelector, useVersionedClient = () => {
@@ -2110,7 +2110,7 @@ const ButtonAssetCopy = (t0) => {
2110
2110
  }), $[2] = doc, $[3] = onClick, $[4] = schemaType, $[5] = t1) : t1 = $[5], t1;
2111
2111
  }, Container$2 = /* @__PURE__ */ styled(Box).withConfig({
2112
2112
  displayName: "Container",
2113
- componentId: "sc-ov4bwf-0"
2113
+ componentId: "sc-91y0jf-0"
2114
2114
  })(({ theme }) => css`text{font-family:${theme.sanity.fonts.text.family} !important;font-size:8px !important;font-weight:500 !important;}`), FileIcon$1 = (props) => {
2115
2115
  let $ = c(11), { extension, onClick, width } = props, t0;
2116
2116
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { height: "100%" }, $[0] = t0) : t0 = $[0];
@@ -2256,10 +2256,10 @@ function getSchemeColor(scheme, colorKey) {
2256
2256
  }
2257
2257
  const Image$1 = styled.img.attrs({ crossOrigin: "anonymous" }).withConfig({
2258
2258
  displayName: "Image",
2259
- componentId: "sc-nu8r0m-0"
2259
+ componentId: "sc-ms5kkw-0"
2260
2260
  })`--checkerboard-color:${(props) => props.$scheme ? getSchemeColor(props.$scheme, "bg2") : "inherit"};display:block;width:100%;height:100%;object-fit:contain;${(props) => props.$showCheckerboard && css`background-image:linear-gradient(45deg,var(--checkerboard-color) 25%,transparent 25%),linear-gradient(-45deg,var(--checkerboard-color) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,var(--checkerboard-color) 75%),linear-gradient(-45deg,transparent 75%,var(--checkerboard-color) 75%);background-size:20px 20px;background-position:0 0,0 10px,10px -10px,-10px 0;`}`, StyledErrorOutlineIcon = /* @__PURE__ */ styled(ErrorOutlineIcon).withConfig({
2261
2261
  displayName: "StyledErrorOutlineIcon",
2262
- componentId: "sc-ec70oi-0"
2262
+ componentId: "sc-3yqi4g-0"
2263
2263
  })(({ theme }) => ({ color: theme.sanity.color.spot.red })), FormFieldInputLabel = (props) => {
2264
2264
  let $ = c(14), { description, error, label, name } = props, t0;
2265
2265
  $[0] !== label || $[1] !== name ? (t0 = /* @__PURE__ */ jsx(Text, {
@@ -2477,7 +2477,7 @@ const Image$1 = styled.img.attrs({ crossOrigin: "anonymous" }).withConfig({
2477
2477
  MultiValueRemove,
2478
2478
  Option: Option$1
2479
2479
  }, FormFieldInputTags = (props) => {
2480
- let $ = c(23), { control, description, disabled, error, label, name, onCreateTag, options, placeholder, value } = props, scheme = useColorSchemeValue(), creating = useTypedSelector(_temp$36), tagsFetching = useTypedSelector(_temp2$22), t0;
2480
+ let $ = c(23), { control, description, disabled, error, label, name, onCreateTag, options, placeholder, value } = props, scheme = useColorSchemeValue(), creating = useTypedSelector(_temp$37), tagsFetching = useTypedSelector(_temp2$23), t0;
2481
2481
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { zIndex: 2 }, $[0] = t0) : t0 = $[0];
2482
2482
  let t1;
2483
2483
  $[1] !== description || $[2] !== error || $[3] !== label || $[4] !== name ? (t1 = /* @__PURE__ */ jsx(FormFieldInputLabel, {
@@ -2497,7 +2497,7 @@ const Image$1 = styled.img.attrs({ crossOrigin: "anonymous" }).withConfig({
2497
2497
  isLoading: creating,
2498
2498
  isMulti: !0,
2499
2499
  name,
2500
- noOptionsMessage: _temp3$10,
2500
+ noOptionsMessage: _temp3$11,
2501
2501
  onBlur,
2502
2502
  onChange,
2503
2503
  onCreateOption: onCreateTag,
@@ -2520,13 +2520,13 @@ const Image$1 = styled.img.attrs({ crossOrigin: "anonymous" }).withConfig({
2520
2520
  children: [t1, t3]
2521
2521
  }), $[20] = t1, $[21] = t3, $[22] = t4) : t4 = $[22], t4;
2522
2522
  };
2523
- function _temp$36(state) {
2523
+ function _temp$37(state) {
2524
2524
  return state.tags.creating;
2525
2525
  }
2526
- function _temp2$22(state_0) {
2526
+ function _temp2$23(state_0) {
2527
2527
  return state_0.tags.fetching;
2528
2528
  }
2529
- function _temp3$10() {
2529
+ function _temp3$11() {
2530
2530
  return "No tags";
2531
2531
  }
2532
2532
  const FormFieldInputText = (props) => {
@@ -2686,45 +2686,45 @@ function Details({ formUpdating, handleCreateTag, control, errors, register, all
2686
2686
  onClick: () => setActiveLocaleTab(idx),
2687
2687
  label: locale.title
2688
2688
  }, locale.id))
2689
- }), locales.map((locale_0, idx_0) => /* @__PURE__ */ jsx(TabPanel, {
2690
- id: `locale-panel-${locale_0.id}`,
2691
- "aria-labelledby": `locale-tab-${locale_0.id}`,
2692
- hidden: activeLocaleTab !== idx_0,
2689
+ }), locales.map((locale, idx) => /* @__PURE__ */ jsx(TabPanel, {
2690
+ id: `locale-panel-${locale.id}`,
2691
+ "aria-labelledby": `locale-tab-${locale.id}`,
2692
+ hidden: activeLocaleTab !== idx,
2693
2693
  children: /* @__PURE__ */ jsxs(Stack, {
2694
2694
  gap: 3,
2695
2695
  children: [
2696
2696
  /* @__PURE__ */ jsx(FormFieldInputText, {
2697
- ...register(`title.${locale_0.id}`),
2697
+ ...register(`title.${locale.id}`),
2698
2698
  disabled: formUpdating,
2699
- error: (errors?.title)?.[locale_0.id]?.message,
2699
+ error: (errors?.title)?.[locale.id]?.message,
2700
2700
  label: "Title",
2701
- name: `title.${locale_0.id}`
2701
+ name: `title.${locale.id}`
2702
2702
  }),
2703
2703
  /* @__PURE__ */ jsx(FormFieldInputText, {
2704
- ...register(`altText.${locale_0.id}`),
2704
+ ...register(`altText.${locale.id}`),
2705
2705
  disabled: formUpdating,
2706
- error: (errors?.altText)?.[locale_0.id]?.message,
2706
+ error: (errors?.altText)?.[locale.id]?.message,
2707
2707
  label: "Alt Text",
2708
- name: `altText.${locale_0.id}`
2708
+ name: `altText.${locale.id}`
2709
2709
  }),
2710
2710
  /* @__PURE__ */ jsx(FormFieldInputTextarea, {
2711
- ...register(`description.${locale_0.id}`),
2711
+ ...register(`description.${locale.id}`),
2712
2712
  disabled: formUpdating,
2713
- error: (errors?.description)?.[locale_0.id]?.message,
2713
+ error: (errors?.description)?.[locale.id]?.message,
2714
2714
  label: "Description",
2715
- name: `description.${locale_0.id}`,
2715
+ name: `description.${locale.id}`,
2716
2716
  rows: 5
2717
2717
  }),
2718
2718
  creditLine?.enabled && /* @__PURE__ */ jsx(FormFieldInputText, {
2719
- ...register(`creditLine.${locale_0.id}`),
2720
- error: (errors?.creditLine)?.[locale_0.id]?.message,
2719
+ ...register(`creditLine.${locale.id}`),
2720
+ error: (errors?.creditLine)?.[locale.id]?.message,
2721
2721
  label: "Credit",
2722
- name: `creditLine.${locale_0.id}`,
2722
+ name: `creditLine.${locale.id}`,
2723
2723
  disabled: formUpdating || creditLine?.excludeSources?.includes(currentAsset?.source?.name)
2724
2724
  })
2725
2725
  ]
2726
2726
  })
2727
- }, locale_0.id))]
2727
+ }, locale.id))]
2728
2728
  })
2729
2729
  }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2730
2730
  /* @__PURE__ */ jsx(FormFieldInputText, {
@@ -2802,7 +2802,7 @@ const DialogAssetEdit = (props) => {
2802
2802
  title: makeLocaleObj(asset?.title)
2803
2803
  };
2804
2804
  }
2805
- let flattenField = _temp2$21;
2805
+ let flattenField = _temp2$22;
2806
2806
  return {
2807
2807
  altText: flattenField(asset?.altText),
2808
2808
  creditLine: flattenField(asset?.creditLine),
@@ -2868,7 +2868,7 @@ const DialogAssetEdit = (props) => {
2868
2868
  t19 = !1;
2869
2869
  break bb0;
2870
2870
  }
2871
- let isLocaleObj = _temp3$9, fields = [
2871
+ let isLocaleObj = _temp3$10, fields = [
2872
2872
  currentAsset.title,
2873
2873
  currentAsset.altText,
2874
2874
  currentAsset.description,
@@ -3180,14 +3180,14 @@ const DialogAssetEdit = (props) => {
3180
3180
  children: [t52, children]
3181
3181
  }), $[144] = children, $[145] = footer, $[146] = handleClose, $[147] = id, $[148] = t52, $[149] = t53) : t53 = $[149], t53;
3182
3182
  };
3183
- function _temp$35(v) {
3183
+ function _temp$36(v) {
3184
3184
  return v;
3185
3185
  }
3186
- function _temp2$21(field_0, t0) {
3186
+ function _temp2$22(field_0, t0) {
3187
3187
  let fallback_0 = t0 === void 0 ? "" : t0;
3188
- return typeof field_0 == "string" ? field_0 : typeof field_0 == "object" && field_0 && Object.values(field_0).find(_temp$35) || fallback_0;
3188
+ return typeof field_0 == "string" ? field_0 : typeof field_0 == "object" && field_0 && Object.values(field_0).find(_temp$36) || fallback_0;
3189
3189
  }
3190
- function _temp3$9(v_0) {
3190
+ function _temp3$10(v_0) {
3191
3191
  return typeof v_0 == "object" && !!v_0 && !Array.isArray(v_0);
3192
3192
  }
3193
3193
  function _temp4$5(l) {
@@ -3245,23 +3245,23 @@ const selectCombinedItems = createSelector([
3245
3245
  }), t3 = [downHandler, upHandler], $[4] = downHandler, $[5] = t2, $[6] = t3), useEffect(t2, t3), keyPressed;
3246
3246
  }, CardWrapper$2 = styled(Flex).withConfig({
3247
3247
  displayName: "CardWrapper",
3248
- componentId: "sc-e6odx5-0"
3248
+ componentId: "sc-paw993-0"
3249
3249
  })`box-sizing:border-box;height:100%;overflow:hidden;position:relative;width:100%;`, CardContainer = /* @__PURE__ */ styled(Flex).withConfig({
3250
3250
  displayName: "CardContainer",
3251
- componentId: "sc-e6odx5-1"
3251
+ componentId: "sc-paw993-1"
3252
3252
  })(({ $picked, theme, $updating }) => css`border:1px solid transparent;height:100%;pointer-events:${$updating ? "none" : "auto"};position:relative;transition:all 300ms;user-select:none;width:100%;border:${$picked ? `1px solid ${theme.sanity.color.spot.orange} !important` : "1px solid inherit"};${!$updating && css`@media (hover:hover) and (pointer:fine){&:hover{border:1px solid var(--card-border-color);}}`}`), ContextActionContainer$2 = /* @__PURE__ */ styled(Flex).withConfig({
3253
3253
  displayName: "ContextActionContainer",
3254
- componentId: "sc-e6odx5-2"
3254
+ componentId: "sc-paw993-2"
3255
3255
  })(({ $scheme }) => css`cursor:pointer;height:${32}px;transition:all 300ms;@media (hover:hover) and (pointer:fine){&:hover{background:${getSchemeColor($scheme, "bg")};}}`), StyledWarningOutlineIcon = /* @__PURE__ */ styled(WarningFilledIcon).withConfig({
3256
3256
  displayName: "StyledWarningOutlineIcon",
3257
- componentId: "sc-e6odx5-3"
3257
+ componentId: "sc-paw993-3"
3258
3258
  })(({ theme }) => ({ color: theme.sanity.color.spot.red })), CardAsset = (props) => {
3259
- let $ = c(83), { id, selected, source } = props, scheme = useColorSchemeValue(), toast = useToast(), shiftPressed = useKeyPress("shift"), dispatch = useDispatch(), lastPicked = useTypedSelector(_temp$34), assetsPicked = useTypedSelector(selectAssetsPicked), t0;
3259
+ let $ = c(83), { id, selected, source } = props, scheme = useColorSchemeValue(), toast = useToast(), shiftPressed = useKeyPress("shift"), dispatch = useDispatch(), lastPicked = useTypedSelector(_temp$35), assetsPicked = useTypedSelector(selectAssetsPicked), t0;
3260
3260
  $[0] === id ? t0 = $[1] : (t0 = (state_0) => selectAssetById(state_0, id), $[0] = id, $[1] = t0);
3261
3261
  let item = useTypedSelector(t0), t1;
3262
3262
  $[2] === source ? t1 = $[3] : (t1 = (state_1) => {
3263
3263
  if (source !== "replace-asset") return;
3264
- let dialog = state_1.dialog.items.find(_temp2$20);
3264
+ let dialog = state_1.dialog.items.find(_temp2$21);
3265
3265
  return dialog?.type === "dialogAllAssets" ? dialog.assetId : void 0;
3266
3266
  }, $[2] = source, $[3] = t1);
3267
3267
  let dialogReplaceAssetId = useTypedSelector(t1), asset = item?.asset, error = item?.error, isOpaque = item?.asset?.metadata?.isOpaque, picked = item?.picked, updating = item?.updating, assetToReplaceId = dialogReplaceAssetId ?? (source === "replace-asset" && assetsPicked.length === 1 ? assetsPicked[0]?.asset._id : void 0), t2;
@@ -3467,21 +3467,21 @@ const selectCombinedItems = createSelector([
3467
3467
  }), $[77] = item.updating, $[78] = picked, $[79] = t15, $[80] = t19, $[81] = t20, $[82] = t21) : t21 = $[82], t21;
3468
3468
  };
3469
3469
  var CardAsset_default = memo(CardAsset);
3470
- function _temp$34(state) {
3470
+ function _temp$35(state) {
3471
3471
  return state.assets.lastPicked;
3472
3472
  }
3473
- function _temp2$20(d) {
3473
+ function _temp2$21(d) {
3474
3474
  return d.type === "dialogAllAssets";
3475
3475
  }
3476
3476
  const CardWrapper$1 = styled(Flex).withConfig({
3477
3477
  displayName: "CardWrapper",
3478
- componentId: "sc-l04v0k-0"
3478
+ componentId: "sc-52xpdk-0"
3479
3479
  })`box-sizing:border-box;height:100%;overflow:hidden;position:relative;width:100%;`, FolderCard = styled(Card).withConfig({
3480
3480
  displayName: "FolderCard",
3481
- componentId: "sc-l04v0k-1"
3481
+ componentId: "sc-52xpdk-1"
3482
3482
  })`cursor:pointer;height:100%;transition:border-color 200ms ease;width:100%;@media (hover:hover) and (pointer:fine){&:hover{border-color:var(--card-border-color);}}`, FolderGlyph = /* @__PURE__ */ styled(Box).withConfig({
3483
3483
  displayName: "FolderGlyph",
3484
- componentId: "sc-l04v0k-2"
3484
+ componentId: "sc-52xpdk-2"
3485
3485
  })(({ theme }) => css`align-items:flex-end;background:linear-gradient( 180deg,${theme.sanity.color.spot.yellow} 0%,${theme.sanity.color.spot.yellow} 100% );border-radius:8px;display:flex;height:72px;position:relative;width:96px;&::before{background:${theme.sanity.color.spot.yellow};border-radius:8px 8px 0 0;content:'';height:18px;left:0;position:absolute;top:-8px;width:38px;}`), CardFolder = (t0) => {
3486
3486
  let $ = c(22), { folderId, name, totalCount } = t0, dispatch = useDispatch(), scheme = useColorSchemeValue(), t1;
3487
3487
  $[0] !== dispatch || $[1] !== folderId ? (t1 = () => dispatch(foldersActions.currentFolderSet({ folderId })), $[0] = dispatch, $[1] = folderId, $[2] = t1) : t1 = $[2];
@@ -3669,7 +3669,7 @@ const createThrottler = (concurrency = 4) => {
3669
3669
  return merge(of(null).pipe(mergeMap(() => generatePreviewBlobUrl$(file)), mergeMap((url) => of(uploadsActions.previewReady({
3670
3670
  blobUrl: url,
3671
3671
  hash: uploadItem.hash
3672
- })))), of(null).pipe(mergeMap(() => uploadAsset$(client, uploadItem.assetType, file, uploadItem.hash)), takeUntil(action$.pipe(filter(uploadsActions.uploadCancel.match), filter((v) => v.payload.hash === uploadItem.hash))), mergeMap((event) => {
3672
+ })))), of(null).pipe(mergeMap(() => uploadAsset$(client, uploadItem.assetType, file, uploadItem.hash)), takeUntil$1(action$.pipe(filter(uploadsActions.uploadCancel.match), filter((v) => v.payload.hash === uploadItem.hash))), mergeMap((event) => {
3673
3673
  if (event?.type === "complete") {
3674
3674
  let folderId = uploadItem.folderId || null;
3675
3675
  return folderId ? from(client.patch(event.asset._id).setIfMissing({ opt: {} }).setIfMissing({ "opt.media": {} }).set({ "opt.media.folder": {
@@ -3724,7 +3724,7 @@ const createThrottler = (concurrency = 4) => {
3724
3724
  var uploads_default = uploadsSlice.reducer;
3725
3725
  const CardWrapper = styled(Flex).withConfig({
3726
3726
  displayName: "CardWrapper",
3727
- componentId: "sc-wucbwn-0"
3727
+ componentId: "sc-2pwgvh-0"
3728
3728
  })`box-sizing:border-box;height:100%;overflow:hidden;position:relative;width:100%;`, CardUpload = (props) => {
3729
3729
  let $ = c(43), { id } = props, scheme = useColorSchemeValue(), dispatch = useDispatch(), t0;
3730
3730
  $[0] === id ? t0 = $[1] : (t0 = (state) => selectUploadById(state, id), $[0] = id, $[1] = t0);
@@ -3887,7 +3887,7 @@ const CardWrapper = styled(Flex).withConfig({
3887
3887
  return null;
3888
3888
  }), StyledItemContainer = styled.div.withConfig({
3889
3889
  displayName: "StyledItemContainer",
3890
- componentId: "sc-oxt31n-0"
3890
+ componentId: "sc-2rsg9t-0"
3891
3891
  })`height:${220}px;width:${240}px;`, ItemContainer = (props) => {
3892
3892
  let $ = c(6), ref, rest;
3893
3893
  if ($[0] !== props) {
@@ -3901,7 +3901,7 @@ const CardWrapper = styled(Flex).withConfig({
3901
3901
  }), $[3] = ref, $[4] = rest, $[5] = t0) : t0 = $[5], t0;
3902
3902
  }, StyledListContainer = styled.div.withConfig({
3903
3903
  displayName: "StyledListContainer",
3904
- componentId: "sc-oxt31n-1"
3904
+ componentId: "sc-2rsg9t-1"
3905
3905
  })`display:grid;grid-template-columns:repeat(auto-fill,${240}px);grid-template-rows:repeat(auto-fill,${220}px);justify-content:center;margin:0 auto;`, ListContainer = (props) => {
3906
3906
  let $ = c(6), ref, rest;
3907
3907
  if ($[0] !== props) {
@@ -3914,8 +3914,8 @@ const CardWrapper = styled(Flex).withConfig({
3914
3914
  ...rest
3915
3915
  }), $[3] = ref, $[4] = rest, $[5] = t0) : t0 = $[5], t0;
3916
3916
  }, AssetGridVirtualized = (props) => {
3917
- let $ = c(15), { items, onLoadMore, source } = props, selectedAssets = useTypedSelector(_temp$33), t0;
3918
- $[0] === selectedAssets ? t0 = $[1] : (t0 = selectedAssets && selectedAssets.map(_temp2$19) || [], $[0] = selectedAssets, $[1] = t0);
3917
+ let $ = c(15), { items, onLoadMore, source } = props, selectedAssets = useTypedSelector(_temp$34), t0;
3918
+ $[0] === selectedAssets ? t0 = $[1] : (t0 = selectedAssets && selectedAssets.map(_temp2$20) || [], $[0] = selectedAssets, $[1] = t0);
3919
3919
  let selectedIds = t0, totalCount = items?.length;
3920
3920
  if (totalCount === 0) return null;
3921
3921
  let t1;
@@ -3951,10 +3951,10 @@ const CardWrapper = styled(Flex).withConfig({
3951
3951
  totalCount
3952
3952
  }), $[10] = onLoadMore, $[11] = t1, $[12] = t3, $[13] = totalCount, $[14] = t5) : t5 = $[14], t5;
3953
3953
  };
3954
- function _temp$33(state) {
3954
+ function _temp$34(state) {
3955
3955
  return state.selected.assets;
3956
3956
  }
3957
- function _temp2$19(asset) {
3957
+ function _temp2$20(asset) {
3958
3958
  return asset._id;
3959
3959
  }
3960
3960
  function omitFacetId(facet) {
@@ -3962,11 +3962,11 @@ function omitFacetId(facet) {
3962
3962
  return withoutId;
3963
3963
  }
3964
3964
  const ReplaceAssetsOverview = () => {
3965
- let $ = c(36), dispatch = useDispatch(), store = useStore(), combinedItems = useTypedSelector(selectCombinedItems), assetsById = useTypedSelector(_temp$32), fetchCount = useTypedSelector(_temp2$18), fetching = useTypedSelector(_temp3$8), fetchingError = useTypedSelector(_temp4$4), pageSize = useTypedSelector(_temp5$3), searchQuery = useTypedSelector(_temp6$1), searchFacets = useTypedSelector(_temp7), currentFolderId = useTypedSelector(_temp8), currentFolderUnfiled = useTypedSelector(_temp9), assetToReplaceId = useTypedSelector(_temp1), savedBrowserStateRef = useRef(null), t0;
3965
+ let $ = c(36), dispatch = useDispatch(), store = useStore(), combinedItems = useTypedSelector(selectCombinedItems), assetsById = useTypedSelector(_temp$33), fetchCount = useTypedSelector(_temp2$19), fetching = useTypedSelector(_temp3$9), fetchingError = useTypedSelector(_temp4$4), pageSize = useTypedSelector(_temp5$3), searchQuery = useTypedSelector(_temp6$1), searchFacets = useTypedSelector(_temp7), currentFolderId = useTypedSelector(_temp8), currentFolderUnfiled = useTypedSelector(_temp9), assetToReplaceId = useTypedSelector(_temp11), savedBrowserStateRef = useRef(null), t0;
3966
3966
  $[0] !== currentFolderId || $[1] !== currentFolderUnfiled || $[2] !== searchFacets || $[3] !== searchQuery.length ? (t0 = () => searchQuery.length > 0 || searchFacets.length > 0 || !!currentFolderId || currentFolderUnfiled, $[0] = currentFolderId, $[1] = currentFolderUnfiled, $[2] = searchFacets, $[3] = searchQuery.length, $[4] = t0) : t0 = $[4];
3967
3967
  let [awaitingRefetch, setAwaitingRefetch] = useState(t0), t1, t2;
3968
3968
  $[5] !== dispatch || $[6] !== store ? (t1 = () => {
3969
- let { dialog: dialog_0, folders, search } = store.getState(), { query, facets } = search, dialogItem = dialog_0.items.find(_temp10);
3969
+ let { dialog: dialog_0, folders, search } = store.getState(), { query, facets } = search, dialogItem = dialog_0.items.find(_temp12);
3970
3970
  return savedBrowserStateRef.current = {
3971
3971
  assetId: dialogItem?.type === "dialogAllAssets" ? dialogItem.assetId : void 0,
3972
3972
  query,
@@ -4043,13 +4043,13 @@ const ReplaceAssetsOverview = () => {
4043
4043
  })
4044
4044
  }), $[32] = handleLoadMoreItems, $[33] = isEmpty, $[34] = reducedItems, $[35] = t9) : t9 = $[35], t9;
4045
4045
  };
4046
- function _temp$32(state) {
4046
+ function _temp$33(state) {
4047
4047
  return state.assets.byIds;
4048
4048
  }
4049
- function _temp2$18(state_0) {
4049
+ function _temp2$19(state_0) {
4050
4050
  return state_0.assets.fetchCount;
4051
4051
  }
4052
- function _temp3$8(state_1) {
4052
+ function _temp3$9(state_1) {
4053
4053
  return state_1.assets.fetching;
4054
4054
  }
4055
4055
  function _temp4$4(state_2) {
@@ -4070,14 +4070,14 @@ function _temp8(state_6) {
4070
4070
  function _temp9(state_7) {
4071
4071
  return state_7.folders.currentFolderUnfiled;
4072
4072
  }
4073
- function _temp0(item) {
4073
+ function _temp10(item) {
4074
4074
  return item.type === "dialogAllAssets";
4075
4075
  }
4076
- function _temp1(state_8) {
4077
- let dialog = state_8.dialog.items.find(_temp0);
4076
+ function _temp11(state_8) {
4077
+ let dialog = state_8.dialog.items.find(_temp10);
4078
4078
  return dialog?.type === "dialogAllAssets" ? dialog.assetId : void 0;
4079
4079
  }
4080
- function _temp10(item_0) {
4080
+ function _temp12(item_0) {
4081
4081
  return item_0.type === "dialogAllAssets";
4082
4082
  }
4083
4083
  const DialogAllAssets = (props) => {
@@ -4172,7 +4172,7 @@ const DialogAllAssets = (props) => {
4172
4172
  children: [t8, children]
4173
4173
  }), $[25] = children, $[26] = handleClose, $[27] = t4, $[28] = t5, $[29] = t8, $[30] = t9) : t9 = $[30], t9;
4174
4174
  }, DialogFolderCreate = (props) => {
4175
- let $ = c(43), { children, dialog: t0 } = props, { parentFolderId, id } = t0, dispatch = useDispatch(), creating = useTypedSelector(_temp$31), creatingError = useTypedSelector(_temp2$17), t1;
4175
+ let $ = c(43), { children, dialog: t0 } = props, { parentFolderId, id } = t0, dispatch = useDispatch(), creating = useTypedSelector(_temp$32), creatingError = useTypedSelector(_temp2$18), t1;
4176
4176
  $[0] === parentFolderId ? t1 = $[1] : (t1 = (state_1) => selectFolderPathById(state_1, parentFolderId), $[0] = parentFolderId, $[1] = t1);
4177
4177
  let parentPath = useTypedSelector(t1), t2;
4178
4178
  $[2] === Symbol.for("react.memo_cache_sentinel") ? (t2 = { name: "" }, $[2] = t2) : t2 = $[2];
@@ -4261,10 +4261,10 @@ const DialogAllAssets = (props) => {
4261
4261
  children: [t17, children]
4262
4262
  }), $[37] = children, $[38] = handleClose, $[39] = id, $[40] = t10, $[41] = t17, $[42] = t18) : t18 = $[42], t18;
4263
4263
  };
4264
- function _temp$31(state) {
4264
+ function _temp$32(state) {
4265
4265
  return state.folders.creating;
4266
4266
  }
4267
- function _temp2$17(state_0) {
4267
+ function _temp2$18(state_0) {
4268
4268
  return state_0.folders.creatingError;
4269
4269
  }
4270
4270
  const getExpandedIdSet$1 = (folderId, byId) => {
@@ -4314,7 +4314,7 @@ const getExpandedIdSet$1 = (folderId, byId) => {
4314
4314
  children: t1
4315
4315
  }), $[9] = t1, $[10] = t2), t2;
4316
4316
  }, DialogFolderMove = (t0) => {
4317
- let $ = c(49), { children, dialog } = t0, dispatch = useDispatch(), folderTree = useTypedSelector(selectFolderTree), byId = useTypedSelector(_temp$30), { assets, folderId, id } = dialog, [selectedId, setSelectedId] = useState(folderId || null), selectedFolder = selectedId ? byId[selectedId] : null, t1 = folderId || null, t2;
4317
+ let $ = c(49), { children, dialog } = t0, dispatch = useDispatch(), folderTree = useTypedSelector(selectFolderTree), byId = useTypedSelector(_temp$31), { assets, folderId, id } = dialog, [selectedId, setSelectedId] = useState(folderId || null), selectedFolder = selectedId ? byId[selectedId] : null, t1 = folderId || null, t2;
4318
4318
  $[0] !== byId || $[1] !== t1 ? (t2 = getExpandedIdSet$1(t1, byId), $[0] = byId, $[1] = t1, $[2] = t2) : t2 = $[2];
4319
4319
  let expandedIds = t2, t3;
4320
4320
  $[3] !== dispatch || $[4] !== id ? (t3 = () => {
@@ -4427,11 +4427,11 @@ const getExpandedIdSet$1 = (folderId, byId) => {
4427
4427
  children: [t20, children]
4428
4428
  }), $[43] = children, $[44] = handleClose, $[45] = id, $[46] = t11, $[47] = t20, $[48] = t21) : t21 = $[48], t21;
4429
4429
  };
4430
- function _temp$30(state) {
4430
+ function _temp$31(state) {
4431
4431
  return state.folders.byId;
4432
4432
  }
4433
4433
  const DialogFolderRename = (t0) => {
4434
- let $ = c(50), { children, dialog } = t0, { folderId, id } = dialog, dispatch = useDispatch(), renaming = useTypedSelector(_temp$29), renameError = useTypedSelector(_temp2$16), t1;
4434
+ let $ = c(50), { children, dialog } = t0, { folderId, id } = dialog, dispatch = useDispatch(), renaming = useTypedSelector(_temp$30), renameError = useTypedSelector(_temp2$17), t1;
4435
4435
  $[0] === folderId ? t1 = $[1] : (t1 = (state_1) => state_1.folders.byId[folderId], $[0] = folderId, $[1] = t1);
4436
4436
  let folder = useTypedSelector(t1), t2;
4437
4437
  $[2] === folderId ? t2 = $[3] : (t2 = (state_2) => selectFolderPathById(state_2, folderId), $[2] = folderId, $[3] = t2);
@@ -4526,10 +4526,10 @@ const DialogFolderRename = (t0) => {
4526
4526
  children: [t22, children]
4527
4527
  }), $[44] = children, $[45] = handleClose, $[46] = id, $[47] = t14, $[48] = t22, $[49] = t23) : t23 = $[49], t23;
4528
4528
  };
4529
- function _temp$29(state) {
4529
+ function _temp$30(state) {
4530
4530
  return state.folders.renaming;
4531
4531
  }
4532
- function _temp2$16(state_0) {
4532
+ function _temp2$17(state_0) {
4533
4533
  return state_0.folders.renameError;
4534
4534
  }
4535
4535
  const getExpandedIdSet = (folderId, byId) => {
@@ -4658,7 +4658,7 @@ const getExpandedIdSet = (folderId, byId) => {
4658
4658
  children: t5
4659
4659
  }), $[15] = node.id, $[16] = selected, $[17] = t1, $[18] = t2, $[19] = t3, $[20] = t4, $[21] = t5, $[22] = t6) : t6 = $[22], t6;
4660
4660
  }, FolderView = () => {
4661
- let $ = c(63), dispatch = useDispatch(), currentFolderId = useTypedSelector(_temp$28), byId = useTypedSelector(_temp2$15), canDeleteFolder = useTypedSelector(selectCanDeleteFolder), fetching = useTypedSelector(_temp3$7), folderTree = useTypedSelector(selectFolderTree), currentFolder = currentFolderId ? byId[currentFolderId] : null, t0;
4661
+ let $ = c(63), dispatch = useDispatch(), currentFolderId = useTypedSelector(_temp$29), byId = useTypedSelector(_temp2$16), canDeleteFolder = useTypedSelector(selectCanDeleteFolder), fetching = useTypedSelector(_temp3$8), folderTree = useTypedSelector(selectFolderTree), currentFolder = currentFolderId ? byId[currentFolderId] : null, t0;
4662
4662
  $[0] !== byId || $[1] !== currentFolderId ? (t0 = getExpandedIdSet(currentFolderId, byId), $[0] = byId, $[1] = currentFolderId, $[2] = t0) : t0 = $[2];
4663
4663
  let expandedIds = t0, t1;
4664
4664
  $[3] === expandedIds ? t1 = $[4] : (t1 = Array.from(expandedIds).join("|") || "root", $[3] = expandedIds, $[4] = t1);
@@ -4786,13 +4786,13 @@ const getExpandedIdSet = (folderId, byId) => {
4786
4786
  children: [t13, t21]
4787
4787
  }), $[60] = t13, $[61] = t21, $[62] = t22) : t22 = $[62], t22;
4788
4788
  };
4789
- function _temp$28(state) {
4789
+ function _temp$29(state) {
4790
4790
  return state.folders.currentFolderId;
4791
4791
  }
4792
- function _temp2$15(state_0) {
4792
+ function _temp2$16(state_0) {
4793
4793
  return state_0.folders.byId;
4794
4794
  }
4795
- function _temp3$7(state_1) {
4795
+ function _temp3$8(state_1) {
4796
4796
  return state_1.folders.fetching;
4797
4797
  }
4798
4798
  const DialogFolders = (props) => {
@@ -4819,7 +4819,7 @@ const DialogFolders = (props) => {
4819
4819
  }), $[3] = children, $[4] = handleClose, $[5] = id, $[6] = t3) : t3 = $[6], t3;
4820
4820
  }, Container$1 = /* @__PURE__ */ styled(Box).withConfig({
4821
4821
  displayName: "Container",
4822
- componentId: "sc-iuc26f-0"
4822
+ componentId: "sc-ash7y6-0"
4823
4823
  })(({ $scheme, theme }) => css`background:${getSchemeColor($scheme, "bg")};border-radius:${rem(theme.sanity.radius[2])};`), SearchFacet = (props) => {
4824
4824
  let $ = c(22), { children, facet } = props, scheme = useColorSchemeValue(), dispatch = useDispatch(), t0;
4825
4825
  $[0] !== dispatch || $[1] !== facet.id ? (t0 = () => {
@@ -5288,9 +5288,9 @@ const DialogFolders = (props) => {
5288
5288
  Option,
5289
5289
  SingleValue
5290
5290
  }, SearchFacetTags = (t0) => {
5291
- let $ = c(27), { facet } = t0, scheme = useColorSchemeValue(), dispatch = useDispatch(), { excludeTagSlugs } = useToolOptions(), tagsAll = useTypedSelector(_temp$27), t1;
5291
+ let $ = c(27), { facet } = t0, scheme = useColorSchemeValue(), dispatch = useDispatch(), { excludeTagSlugs } = useToolOptions(), tagsAll = useTypedSelector(_temp$28), t1;
5292
5292
  $[0] !== excludeTagSlugs || $[1] !== tagsAll ? (t1 = excludeTagSlugs.length > 0 ? tagsAll.filter((t) => !excludeTagSlugs.includes(t.tag.name.current)) : tagsAll, $[0] = excludeTagSlugs, $[1] = tagsAll, $[2] = t1) : t1 = $[2];
5293
- let tags = t1, tagsFetching = useTypedSelector(_temp2$14), t2;
5293
+ let tags = t1, tagsFetching = useTypedSelector(_temp2$15), t2;
5294
5294
  $[3] === tags ? t2 = $[4] : (t2 = getTagSelectOptions(tags), $[3] = tags, $[4] = t2);
5295
5295
  let allTagOptions = t2, popoverProps = usePortalPopoverProps(), t3;
5296
5296
  $[5] !== dispatch || $[6] !== facet.id ? (t3 = (option) => {
@@ -5337,7 +5337,7 @@ const DialogFolders = (props) => {
5337
5337
  isDisabled: tagsFetching,
5338
5338
  isSearchable: !0,
5339
5339
  name: "tags",
5340
- noOptionsMessage: _temp3$6,
5340
+ noOptionsMessage: _temp3$7,
5341
5341
  onChange: (value) => handleChange(value),
5342
5342
  options: allTagOptions,
5343
5343
  placeholder: tagsFetching ? "Loading..." : "Select...",
@@ -5351,21 +5351,21 @@ const DialogFolders = (props) => {
5351
5351
  children: [t5, t6]
5352
5352
  }), $[23] = facet, $[24] = t5, $[25] = t6, $[26] = t7) : t7 = $[26], t7;
5353
5353
  };
5354
- function _temp$27(state) {
5354
+ function _temp$28(state) {
5355
5355
  return selectTags(state);
5356
5356
  }
5357
- function _temp2$14(state_0) {
5357
+ function _temp2$15(state_0) {
5358
5358
  return state_0.tags.fetching;
5359
5359
  }
5360
- function _temp3$6() {
5360
+ function _temp3$7() {
5361
5361
  return "No tags";
5362
5362
  }
5363
5363
  const StackContainer = /* @__PURE__ */ styled(Flex).withConfig({
5364
5364
  displayName: "StackContainer",
5365
- componentId: "sc-g9phkp-0"
5365
+ componentId: "sc-2rtdyq-0"
5366
5366
  })(({ theme }) => css`> *{margin-bottom:${rem(theme.sanity.space[2])};}`), SearchFacets = (props) => {
5367
- let $ = c(6), { layout: t0 } = props, layout = t0 === void 0 ? "inline" : t0, searchFacets = useTypedSelector(_temp$26), t1;
5368
- $[0] === searchFacets ? t1 = $[1] : (t1 = searchFacets.map(_temp2$13), $[0] = searchFacets, $[1] = t1);
5367
+ let $ = c(6), { layout: t0 } = props, layout = t0 === void 0 ? "inline" : t0, searchFacets = useTypedSelector(_temp$27), t1;
5368
+ $[0] === searchFacets ? t1 = $[1] : (t1 = searchFacets.map(_temp2$14), $[0] = searchFacets, $[1] = t1);
5369
5369
  let Items = t1;
5370
5370
  if (layout === "inline") {
5371
5371
  if (searchFacets.length === 0) return null;
@@ -5388,15 +5388,15 @@ const StackContainer = /* @__PURE__ */ styled(Flex).withConfig({
5388
5388
  }
5389
5389
  throw Error("Invalid layout");
5390
5390
  };
5391
- function _temp$26(state) {
5391
+ function _temp$27(state) {
5392
5392
  return state.search.facets;
5393
5393
  }
5394
- function _temp2$13(facet) {
5394
+ function _temp2$14(facet) {
5395
5395
  let key = facet.id;
5396
5396
  return facet.type === "number" ? /* @__PURE__ */ jsx(SearchFacetNumber, { facet }, key) : facet.type === "searchable" ? /* @__PURE__ */ jsx(SearchFacetTags, { facet }, key) : facet.type === "select" ? /* @__PURE__ */ jsx(SearchFacetSelect, { facet }, key) : facet.type === "string" ? /* @__PURE__ */ jsx(SearchFacetString, { facet }, key) : null;
5397
5397
  }
5398
5398
  const SearchFacetsControl = () => {
5399
- let $ = c(35), dispatch = useDispatch(), assetTypes = useTypedSelector(_temp$25), searchFacets = useTypedSelector(_temp2$12), selectedDocument = useTypedSelector(_temp3$5), popoverProps = usePortalPopoverProps(), { creditLine } = useToolOptions(), isTool = !selectedDocument, T0, T1, T2, t0, t1, t2;
5399
+ let $ = c(35), dispatch = useDispatch(), assetTypes = useTypedSelector(_temp$26), searchFacets = useTypedSelector(_temp2$13), selectedDocument = useTypedSelector(_temp3$6), popoverProps = usePortalPopoverProps(), { creditLine } = useToolOptions(), isTool = !selectedDocument, T0, T1, T2, t0, t1, t2;
5400
5400
  if ($[0] !== assetTypes || $[1] !== creditLine?.enabled || $[2] !== dispatch || $[3] !== isTool || $[4] !== searchFacets) {
5401
5401
  let t3;
5402
5402
  $[11] !== assetTypes || $[12] !== creditLine?.enabled || $[13] !== isTool ? (t3 = (facet) => !creditLine?.enabled && facet?.type === "string" && facet?.name === "creditLine" ? !1 : facet.type === "group" || facet.type === "divider" ? !0 : isTool ? !facet?.selectOnly : facet.assetTypes.filter((assetType) => assetTypes.includes(assetType)).length > 0, $[11] = assetTypes, $[12] = creditLine?.enabled, $[13] = isTool, $[14] = t3) : t3 = $[14];
@@ -5458,13 +5458,13 @@ const SearchFacetsControl = () => {
5458
5458
  let t7;
5459
5459
  return $[31] !== T2 || $[32] !== t5 || $[33] !== t6 ? (t7 = /* @__PURE__ */ jsxs(T2, { children: [t5, t6] }), $[31] = T2, $[32] = t5, $[33] = t6, $[34] = t7) : t7 = $[34], t7;
5460
5460
  };
5461
- function _temp$25(state) {
5461
+ function _temp$26(state) {
5462
5462
  return state.assets.assetTypes;
5463
5463
  }
5464
- function _temp2$12(state_0) {
5464
+ function _temp2$13(state_0) {
5465
5465
  return state_0.search.facets;
5466
5466
  }
5467
- function _temp3$5(state_1) {
5467
+ function _temp3$6(state_1) {
5468
5468
  return state_1.selected.document;
5469
5469
  }
5470
5470
  function _temp4$3(facet_0, index, facets) {
@@ -5491,7 +5491,7 @@ const DialogSearchFacets = (props) => {
5491
5491
  children: [t2, children]
5492
5492
  }), $[3] = children, $[4] = handleClose, $[5] = id, $[6] = t3) : t3 = $[6], t3;
5493
5493
  }, DialogTagCreate = (props) => {
5494
- let $ = c(37), { children, dialog: t0 } = props, { id } = t0, dispatch = useDispatch(), creating = useTypedSelector(_temp$24), creatingError = useTypedSelector(_temp2$11), t1;
5494
+ let $ = c(37), { children, dialog: t0 } = props, { id } = t0, dispatch = useDispatch(), creating = useTypedSelector(_temp$25), creatingError = useTypedSelector(_temp2$12), t1;
5495
5495
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = { name: "" }, $[0] = t1) : t1 = $[0];
5496
5496
  let t2;
5497
5497
  $[1] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {
@@ -5562,16 +5562,16 @@ const DialogSearchFacets = (props) => {
5562
5562
  children: [t15, children]
5563
5563
  }), $[31] = children, $[32] = handleClose, $[33] = id, $[34] = t15, $[35] = t9, $[36] = t16) : t16 = $[36], t16;
5564
5564
  };
5565
- function _temp$24(state) {
5565
+ function _temp$25(state) {
5566
5566
  return state.tags.creating;
5567
5567
  }
5568
- function _temp2$11(state_0) {
5568
+ function _temp2$12(state_0) {
5569
5569
  return state_0.tags.creatingError;
5570
5570
  }
5571
5571
  const DialogTagEdit = (props) => {
5572
5572
  let $ = c(64), { children, dialog: t0 } = props, { id, tagId } = t0, client = useVersionedClient(), dispatch = useDispatch(), t1;
5573
5573
  $[0] === tagId ? t1 = $[1] : (t1 = (state) => selectTagById(state, String(tagId)), $[0] = tagId, $[1] = t1);
5574
- let tagItem = useTypedSelector(t1), [tagSnapshot, setTagSnapshot] = useState(tagItem?.tag), currentTag = tagItem ? tagItem?.tag : tagSnapshot, generateDefaultValues = _temp$23, t2 = tagItem?.tag, t3;
5574
+ let tagItem = useTypedSelector(t1), [tagSnapshot, setTagSnapshot] = useState(tagItem?.tag), currentTag = tagItem ? tagItem?.tag : tagSnapshot, generateDefaultValues = _temp$24, t2 = tagItem?.tag, t3;
5575
5575
  $[2] === t2 ? t3 = $[3] : (t3 = generateDefaultValues(t2), $[2] = t2, $[3] = t3);
5576
5576
  let t4;
5577
5577
  $[4] === Symbol.for("react.memo_cache_sentinel") ? (t4 = zodFormResolver(tagFormSchema), $[4] = t4) : t4 = $[4];
@@ -5706,15 +5706,15 @@ const DialogTagEdit = (props) => {
5706
5706
  children: [t25, children]
5707
5707
  }), $[58] = children, $[59] = handleClose, $[60] = id, $[61] = t18, $[62] = t25, $[63] = t26) : t26 = $[63], t26;
5708
5708
  };
5709
- function _temp$23(tag) {
5709
+ function _temp$24(tag) {
5710
5710
  return { name: tag?.name?.current || "" };
5711
5711
  }
5712
5712
  const TagContainer = styled(Flex).withConfig({
5713
5713
  displayName: "TagContainer",
5714
- componentId: "sc-wgczkj-0"
5714
+ componentId: "sc-3v39jc-0"
5715
5715
  })`height:${32}px;`, ButtonContainer = styled(Flex).withConfig({
5716
5716
  displayName: "ButtonContainer",
5717
- componentId: "sc-wgczkj-1"
5717
+ componentId: "sc-3v39jc-1"
5718
5718
  })`@media (pointer:fine){visibility:hidden;}@media (hover:hover) and (pointer:fine){${TagContainer}:hover &{visibility:visible;}}`, TagButton = (props) => {
5719
5719
  let $ = c(10), { disabled, icon, onClick, tone, tooltip } = props, t0;
5720
5720
  $[0] === tooltip ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Container, {
@@ -5893,12 +5893,12 @@ const TagContainer = styled(Flex).withConfig({
5893
5893
  }), TagsVirtualized = (t0) => {
5894
5894
  let $ = c(15), { tags } = t0, assetsPicked = useTypedSelector(selectAssetsPicked), [isScrolling, setIsScrolling] = useState(!1), items;
5895
5895
  if ($[0] !== assetsPicked || $[1] !== tags) {
5896
- let pickedTagIds = assetsPicked?.reduce(_temp2$10, []), pickedTagIdsUnique = [...new Set(pickedTagIds)], t1;
5896
+ let pickedTagIds = assetsPicked?.reduce(_temp2$11, []), pickedTagIdsUnique = [...new Set(pickedTagIds)], t1;
5897
5897
  $[3] === assetsPicked ? t1 = $[4] : (t1 = (acc_0, tagId) => (assetsPicked.every((assetItem) => (assetItem.asset.opt?.media?.tags?.findIndex((tag_0) => tag_0._ref === tagId) ?? -1) >= 0) ? acc_0.appliedToAll.push(tagId) : acc_0.appliedToSome.push(tagId), acc_0), $[3] = assetsPicked, $[4] = t1);
5898
5898
  let tagIdsSegmented = pickedTagIdsUnique.reduce(t1, {
5899
5899
  appliedToAll: [],
5900
5900
  appliedToSome: []
5901
- }), tagsAppliedToAll = tags.filter((tag_1) => tagIdsSegmented.appliedToAll.includes(tag_1.tag._id)).map(_temp3$4), tagsAppliedToSome = tags.filter((tag_2) => tagIdsSegmented.appliedToSome.includes(tag_2.tag._id)).map(_temp4$2), tagsUnused = tags.filter((tag_3) => !pickedTagIdsUnique.includes(tag_3.tag._id)).map(_temp5$2);
5901
+ }), tagsAppliedToAll = tags.filter((tag_1) => tagIdsSegmented.appliedToAll.includes(tag_1.tag._id)).map(_temp3$5), tagsAppliedToSome = tags.filter((tag_2) => tagIdsSegmented.appliedToSome.includes(tag_2.tag._id)).map(_temp4$2), tagsUnused = tags.filter((tag_3) => !pickedTagIdsUnique.includes(tag_3.tag._id)).map(_temp5$2);
5902
5902
  items = [], assetsPicked.length === 0 ? items = tags.map(_temp6) : (tagsAppliedToAll?.length > 0 && (items = [
5903
5903
  ...items,
5904
5904
  assetsPicked.length === 1 ? "Used" : "Used by all",
@@ -5938,14 +5938,14 @@ const TagContainer = styled(Flex).withConfig({
5938
5938
  totalCount: items.length
5939
5939
  }), $[11] = items.length, $[12] = t1, $[13] = t2, $[14] = t4) : t4 = $[14], t4;
5940
5940
  };
5941
- function _temp$22(tag) {
5941
+ function _temp$23(tag) {
5942
5942
  return tag._ref;
5943
5943
  }
5944
- function _temp2$10(acc, val) {
5945
- let assetTagIds = val?.asset?.opt?.media?.tags?.map(_temp$22) || [];
5944
+ function _temp2$11(acc, val) {
5945
+ let assetTagIds = val?.asset?.opt?.media?.tags?.map(_temp$23) || [];
5946
5946
  return acc = acc.concat(assetTagIds), acc;
5947
5947
  }
5948
- function _temp3$4(tagItem) {
5948
+ function _temp3$5(tagItem) {
5949
5949
  return {
5950
5950
  ...tagItem,
5951
5951
  actions: [
@@ -5990,7 +5990,7 @@ function _temp6(tagItem_2) {
5990
5990
  };
5991
5991
  }
5992
5992
  const TagViewHeader = (t0) => {
5993
- let $ = c(22), { allowCreate, light, title } = t0, scheme = useColorSchemeValue(), dispatch = useDispatch(), tagsCreating = useTypedSelector(_temp$21), tagsFetching = useTypedSelector(_temp2$9), t1;
5993
+ let $ = c(22), { allowCreate, light, title } = t0, scheme = useColorSchemeValue(), dispatch = useDispatch(), tagsCreating = useTypedSelector(_temp$22), tagsFetching = useTypedSelector(_temp2$10), t1;
5994
5994
  $[0] === dispatch ? t1 = $[1] : (t1 = () => {
5995
5995
  dispatch(DIALOG_ACTIONS.showTagCreate());
5996
5996
  }, $[0] = dispatch, $[1] = t1);
@@ -6028,6 +6028,7 @@ const TagViewHeader = (t0) => {
6028
6028
  icon: ComposeIcon,
6029
6029
  mode: "bleed",
6030
6030
  onClick: handleTagCreate,
6031
+ "aria-label": "Create tag",
6031
6032
  style: {
6032
6033
  background: "transparent",
6033
6034
  boxShadow: "none"
@@ -6043,16 +6044,16 @@ const TagViewHeader = (t0) => {
6043
6044
  children: [t6, t7]
6044
6045
  }) }), $[18] = t3, $[19] = t6, $[20] = t7, $[21] = t8) : t8 = $[21], t8;
6045
6046
  };
6046
- function _temp$21(state) {
6047
+ function _temp$22(state) {
6047
6048
  return state.tags.creating;
6048
6049
  }
6049
- function _temp2$9(state_0) {
6050
+ function _temp2$10(state_0) {
6050
6051
  return state_0.tags.fetching;
6051
6052
  }
6052
6053
  const TagView = () => {
6053
6054
  let $ = c(16), numPickedAssets = useTypedSelector(selectAssetsPickedLength), { excludeTagSlugs } = useToolOptions(), tagsAll = useTypedSelector(selectTags), t0;
6054
6055
  $[0] !== excludeTagSlugs || $[1] !== tagsAll ? (t0 = excludeTagSlugs.length > 0 ? tagsAll.filter((t) => !excludeTagSlugs.includes(t.tag.name.current)) : tagsAll, $[0] = excludeTagSlugs, $[1] = tagsAll, $[2] = t0) : t0 = $[2];
6055
- let tags = t0, fetching = useTypedSelector(_temp$20), fetchComplete = useTypedSelector(_temp2$8) !== -1, hasTags = !fetching && tags?.length > 0, hasPicked = numPickedAssets > 0, t1 = hasPicked ? "Tags (in selection)" : "Tags", t2;
6056
+ let tags = t0, fetching = useTypedSelector(_temp$21), fetchComplete = useTypedSelector(_temp2$9) !== -1, hasTags = !fetching && tags?.length > 0, hasPicked = numPickedAssets > 0, t1 = hasPicked ? "Tags (in selection)" : "Tags", t2;
6056
6057
  $[3] !== hasPicked || $[4] !== t1 ? (t2 = /* @__PURE__ */ jsx(TagViewHeader, {
6057
6058
  allowCreate: !0,
6058
6059
  light: hasPicked,
@@ -6081,10 +6082,10 @@ const TagView = () => {
6081
6082
  ]
6082
6083
  }), $[12] = t2, $[13] = t3, $[14] = t4, $[15] = t5) : t5 = $[15], t5;
6083
6084
  };
6084
- function _temp$20(state) {
6085
+ function _temp$21(state) {
6085
6086
  return state.tags.fetching;
6086
6087
  }
6087
- function _temp2$8(state_0) {
6088
+ function _temp2$9(state_0) {
6088
6089
  return state_0.tags.fetchCount;
6089
6090
  }
6090
6091
  const DialogTags = (props) => {
@@ -6110,7 +6111,7 @@ const DialogTags = (props) => {
6110
6111
  children: [t2, children]
6111
6112
  }), $[3] = children, $[4] = handleClose, $[5] = id, $[6] = t3) : t3 = $[6], t3;
6112
6113
  }, Dialogs = () => {
6113
- let $ = c(2), currentDialogs = useTypedSelector(_temp$19), t0;
6114
+ let $ = c(2), currentDialogs = useTypedSelector(_temp$20), t0;
6114
6115
  if ($[0] !== currentDialogs) {
6115
6116
  let renderDialogs = (dialogs, index) => {
6116
6117
  if (dialogs.length === 0 || index >= dialogs.length) return null;
@@ -6154,11 +6155,11 @@ const DialogTags = (props) => {
6154
6155
  } else t0 = $[1];
6155
6156
  return t0;
6156
6157
  };
6157
- function _temp$19(state) {
6158
+ function _temp$20(state) {
6158
6159
  return state.dialog.items;
6159
6160
  }
6160
6161
  const Notifications = () => {
6161
- let $ = c(4), items = useTypedSelector(_temp$18), toast = useToast(), t0, t1;
6162
+ let $ = c(4), items = useTypedSelector(_temp$19), toast = useToast(), t0, t1;
6162
6163
  return $[0] !== items || $[1] !== toast ? (t0 = () => {
6163
6164
  if (items.length > 0) {
6164
6165
  let lastItem = items[items.length - 1];
@@ -6170,7 +6171,7 @@ const Notifications = () => {
6170
6171
  }
6171
6172
  }, t1 = [items, toast], $[0] = items, $[1] = toast, $[2] = t0, $[3] = t1) : (t0 = $[2], t1 = $[3]), useEffect(t0, t1), null;
6172
6173
  };
6173
- function _temp$18(state) {
6174
+ function _temp$19(state) {
6174
6175
  return state.notifications.items;
6175
6176
  }
6176
6177
  const debugSlice = createSlice({
@@ -6296,6 +6297,8 @@ const rootEpic = combineEpics(assetsDeleteEpic, assetsFetchEpic, assetsFetchAfte
6296
6297
  function isSupportedAssetType(assetType) {
6297
6298
  return assetType ? SUPPORTED_ASSET_TYPES.includes(assetType) : !1;
6298
6299
  }
6300
+ /** Stops the root epic when the Media browser unmounts (tool close / dialog dismiss / tests). */
6301
+ const EPIC_END_TYPE = "media/epicEnd";
6299
6302
  function createReduxStore(props) {
6300
6303
  let epicMiddleware = createEpicMiddleware({ dependencies: { client: props.client } }), store = configureStore({
6301
6304
  reducer: rootReducer,
@@ -6353,18 +6356,27 @@ function createReduxStore(props) {
6353
6356
  }
6354
6357
  }
6355
6358
  });
6356
- return epicMiddleware.run(rootEpic), store;
6359
+ return epicMiddleware.run((action$, state$, dependencies) => rootEpic(action$, state$, dependencies).pipe(takeUntil(action$.pipe(ofType(EPIC_END_TYPE))))), {
6360
+ store,
6361
+ endEpics: () => {
6362
+ store.dispatch({ type: EPIC_END_TYPE });
6363
+ }
6364
+ };
6357
6365
  }
6358
6366
  function ReduxProvider(t0) {
6359
- let $ = c(8), children, props;
6367
+ let $ = c(11), children, props;
6360
6368
  $[0] === t0 ? (children = $[1], props = $[2]) : ({children, ...props} = t0, $[0] = t0, $[1] = children, $[2] = props);
6361
6369
  let t1;
6362
6370
  $[3] === props ? t1 = $[4] : (t1 = () => createReduxStore(props), $[3] = props, $[4] = t1);
6363
- let [store] = useState(t1), t2;
6364
- return $[5] !== children || $[6] !== store ? (t2 = /* @__PURE__ */ jsx(Provider, {
6371
+ let [t2] = useState(t1), { endEpics, store } = t2, t3, t4;
6372
+ $[5] === endEpics ? (t3 = $[6], t4 = $[7]) : (t3 = () => () => {
6373
+ endEpics();
6374
+ }, t4 = [endEpics], $[5] = endEpics, $[6] = t3, $[7] = t4), useEffect(t3, t4);
6375
+ let t5;
6376
+ return $[8] !== children || $[9] !== store ? (t5 = /* @__PURE__ */ jsx(Provider, {
6365
6377
  store,
6366
6378
  children
6367
- }), $[5] = children, $[6] = store, $[7] = t2) : t2 = $[7], t2;
6379
+ }), $[8] = children, $[9] = store, $[10] = t5) : t5 = $[10], t5;
6368
6380
  }
6369
6381
  /**
6370
6382
  * Fetches the already-selected asset into the store and opens the `assetEdit`
@@ -6377,7 +6389,7 @@ function ReduxProvider(t0) {
6377
6389
  * a second time.
6378
6390
  */
6379
6391
  const EditAssetDialog = (t0) => {
6380
- let $ = c(9), { assetId, onClose } = t0, dispatch = useDispatch(), openDialogCount = useTypedSelector(_temp$17), hasOpenedRef = useRef(!1), t1, t2;
6392
+ let $ = c(9), { assetId, onClose } = t0, dispatch = useDispatch(), openDialogCount = useTypedSelector(_temp$18), hasOpenedRef = useRef(!1), t1, t2;
6381
6393
  $[0] !== assetId || $[1] !== dispatch ? (t1 = () => {
6382
6394
  let queryFilter = `${constructFilter({
6383
6395
  assetTypes: ["file", "image"],
@@ -6427,11 +6439,11 @@ const EditAssetDialog = (t0) => {
6427
6439
  children: t7
6428
6440
  }), $[15] = client, $[16] = props.assetType, $[17] = selectedAssets, $[18] = t3, $[19] = t7, $[20] = t8) : t8 = $[20], t8;
6429
6441
  };
6430
- function _temp$17(state) {
6442
+ function _temp$18(state) {
6431
6443
  return state.dialog.items.length;
6432
6444
  }
6433
6445
  const ButtonViewGroup = () => {
6434
- let $ = c(16), dispatch = useDispatch(), view = useTypedSelector(_temp$16), t0;
6446
+ let $ = c(16), dispatch = useDispatch(), view = useTypedSelector(_temp$17), t0;
6435
6447
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { whiteSpace: "nowrap" }, $[0] = t0) : t0 = $[0];
6436
6448
  let t1 = view === "grid" ? "default" : "ghost", t2;
6437
6449
  $[1] === dispatch ? t2 = $[2] : (t2 = () => dispatch(assetsActions.viewSet({ view: "grid" })), $[1] = dispatch, $[2] = t2);
@@ -6470,11 +6482,11 @@ const ButtonViewGroup = () => {
6470
6482
  children: [t4, t8]
6471
6483
  }), $[13] = t4, $[14] = t8, $[15] = t9) : t9 = $[15], t9;
6472
6484
  };
6473
- function _temp$16(state) {
6485
+ function _temp$17(state) {
6474
6486
  return state.assets.view;
6475
6487
  }
6476
6488
  const OrderSelect = () => {
6477
- let $ = c(15), dispatch = useDispatch(), order = useTypedSelector(_temp$15), popoverProps = usePortalPopoverProps(), t0;
6489
+ let $ = c(15), dispatch = useDispatch(), order = useTypedSelector(_temp$16), popoverProps = usePortalPopoverProps(), t0;
6478
6490
  $[0] !== order.direction || $[1] !== order.field ? (t0 = getOrderTitle(order.field, order.direction), $[0] = order.direction, $[1] = order.field, $[2] = t0) : t0 = $[2];
6479
6491
  let t1;
6480
6492
  $[3] === t0 ? t1 = $[4] : (t1 = /* @__PURE__ */ jsx(Button, {
@@ -6515,7 +6527,7 @@ const OrderSelect = () => {
6515
6527
  popover: popoverProps
6516
6528
  }), $[11] = popoverProps, $[12] = t1, $[13] = t3, $[14] = t4) : t4 = $[14], t4;
6517
6529
  };
6518
- function _temp$15(state) {
6530
+ function _temp$16(state) {
6519
6531
  return state.assets.order;
6520
6532
  }
6521
6533
  const Progress = (props) => {
@@ -6563,7 +6575,7 @@ const Progress = (props) => {
6563
6575
  }), /* @__PURE__ */ jsx("path", { d: "M384 160a32 32 0 1132-32 32 32 0 01-32 32z" })]
6564
6576
  }), $[0] = t0) : t0 = $[0], t0;
6565
6577
  }, TextInputSearch = () => {
6566
- let $ = c(14), searchQuery = useTypedSelector(_temp$14), dispatch = useDispatch(), t0;
6578
+ let $ = c(14), searchQuery = useTypedSelector(_temp$15), dispatch = useDispatch(), t0;
6567
6579
  $[0] === dispatch ? t0 = $[1] : (t0 = (e) => {
6568
6580
  dispatch(searchActions.querySet({ searchQuery: e.currentTarget.value }));
6569
6581
  }, $[0] = dispatch, $[1] = t0);
@@ -6605,11 +6617,11 @@ const Progress = (props) => {
6605
6617
  children: [t3, t4]
6606
6618
  }), $[11] = t3, $[12] = t4, $[13] = t5) : t5 = $[13], t5;
6607
6619
  };
6608
- function _temp$14(state) {
6620
+ function _temp$15(state) {
6609
6621
  return state.search.query;
6610
6622
  }
6611
6623
  const Controls = () => {
6612
- let $ = c(62), dispatch = useDispatch(), fetching = useTypedSelector(_temp$13), foldersPanelVisible = useTypedSelector(_temp2$7), pageIndex = useTypedSelector(_temp3$3), searchFacets = useTypedSelector(_temp4$1), tagsPanelVisible = useTypedSelector(_temp5$1), mediaIndex = useMediaIndex(), t0;
6624
+ let $ = c(62), dispatch = useDispatch(), fetching = useTypedSelector(_temp$14), foldersPanelVisible = useTypedSelector(_temp2$8), pageIndex = useTypedSelector(_temp3$4), searchFacets = useTypedSelector(_temp4$1), tagsPanelVisible = useTypedSelector(_temp5$1), mediaIndex = useMediaIndex(), t0;
6613
6625
  $[0] === dispatch ? t0 = $[1] : (t0 = () => {
6614
6626
  dispatch(dialogActions.showSearchFacets());
6615
6627
  }, $[0] = dispatch, $[1] = t0);
@@ -6787,6 +6799,7 @@ const Controls = () => {
6787
6799
  display: t29,
6788
6800
  marginLeft: 2,
6789
6801
  children: /* @__PURE__ */ jsx(Button, {
6802
+ "aria-label": "Toggle tags panel",
6790
6803
  fontSize: 1,
6791
6804
  icon: t30,
6792
6805
  onClick: toggleTagsPanelToggle,
@@ -6814,13 +6827,13 @@ const Controls = () => {
6814
6827
  ]
6815
6828
  }), $[58] = t20, $[59] = t34, $[60] = t35, $[61] = t36) : t36 = $[61], t36;
6816
6829
  };
6817
- function _temp$13(state) {
6830
+ function _temp$14(state) {
6818
6831
  return state.assets.fetching;
6819
6832
  }
6820
- function _temp2$7(state_0) {
6833
+ function _temp2$8(state_0) {
6821
6834
  return state_0.folders.panelVisible;
6822
6835
  }
6823
- function _temp3$3(state_1) {
6836
+ function _temp3$4(state_1) {
6824
6837
  return state_1.assets.pageIndex;
6825
6838
  }
6826
6839
  function _temp4$1(state_2) {
@@ -6830,7 +6843,7 @@ function _temp5$1(state_3) {
6830
6843
  return state_3.tags.panelVisible;
6831
6844
  }
6832
6845
  const DebugControls = () => {
6833
- let $ = c(16), dispatch = useDispatch(), badConnection = useTypedSelector(_temp$12), debugEnabled = useTypedSelector(_temp2$6), t0;
6846
+ let $ = c(16), dispatch = useDispatch(), badConnection = useTypedSelector(_temp$13), debugEnabled = useTypedSelector(_temp2$7), t0;
6834
6847
  $[0] === dispatch ? t0 = $[1] : (t0 = (e) => {
6835
6848
  let checked = e.target.checked;
6836
6849
  dispatch(debugActions.setBadConnection(checked));
@@ -6892,14 +6905,14 @@ const DebugControls = () => {
6892
6905
  })
6893
6906
  }), $[13] = t5, $[14] = t8, $[15] = t9) : t9 = $[15], t9;
6894
6907
  };
6895
- function _temp$12(state) {
6908
+ function _temp$13(state) {
6896
6909
  return state.debug.badConnection;
6897
6910
  }
6898
- function _temp2$6(state_0) {
6911
+ function _temp2$7(state_0) {
6899
6912
  return state_0.debug.enabled;
6900
6913
  }
6901
6914
  const FolderBreadcrumbs = () => {
6902
- let $ = c(13), dispatch = useDispatch(), currentFolderId = useTypedSelector(_temp$11), segments = useTypedSelector(selectCurrentFolderSegments);
6915
+ let $ = c(13), dispatch = useDispatch(), currentFolderId = useTypedSelector(_temp$12), segments = useTypedSelector(selectCurrentFolderSegments);
6903
6916
  if (!currentFolderId) return null;
6904
6917
  let t0;
6905
6918
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = [
@@ -6943,12 +6956,12 @@ const FolderBreadcrumbs = () => {
6943
6956
  })
6944
6957
  }), $[10] = t1, $[11] = t2, $[12] = t3) : t3 = $[12], t3;
6945
6958
  };
6946
- function _temp$11(state) {
6959
+ function _temp$12(state) {
6947
6960
  return state.folders.currentFolderId;
6948
6961
  }
6949
6962
  const FolderPanel = () => {
6950
6963
  let $ = c(2);
6951
- if (!useTypedSelector(_temp$10)) return null;
6964
+ if (!useTypedSelector(_temp$11)) return null;
6952
6965
  let t0;
6953
6966
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = {
6954
6967
  position: "relative",
@@ -6973,7 +6986,7 @@ const FolderPanel = () => {
6973
6986
  })
6974
6987
  }), $[1] = t1) : t1 = $[1], t1;
6975
6988
  };
6976
- function _temp$10(state) {
6989
+ function _temp$11(state) {
6977
6990
  return state.folders.panelVisible;
6978
6991
  }
6979
6992
  const DropzoneDispatchContext = createContext(void 0), DropzoneDispatchProvider = (props) => {
@@ -6989,7 +7002,7 @@ const DropzoneDispatchContext = createContext(void 0), DropzoneDispatchProvider
6989
7002
  if (context === void 0) throw Error("useDropzoneActions must be used within an DropzoneDispatchProvider");
6990
7003
  return context;
6991
7004
  }, Header = (props) => {
6992
- let $ = c(23), { onClose } = props, { open } = useDropzoneActions(), { onSelect } = useAssetSourceActions(), assetTypes = useTypedSelector(_temp$9), selectedDocument = useTypedSelector(_temp2$5), { directUploads } = useToolOptions(), t0;
7005
+ let $ = c(23), { onClose } = props, { open } = useDropzoneActions(), { onSelect } = useAssetSourceActions(), assetTypes = useTypedSelector(_temp$10), selectedDocument = useTypedSelector(_temp2$6), { directUploads } = useToolOptions(), t0;
6993
7006
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { whiteSpace: "nowrap" }, $[0] = t0) : t0 = $[0];
6994
7007
  let t1;
6995
7008
  $[1] !== assetTypes || $[2] !== onSelect ? (t1 = onSelect ? `Insert ${assetTypes.join(" or ")}` : "Browse Assets", $[1] = assetTypes, $[2] = onSelect, $[3] = t1) : t1 = $[3];
@@ -7057,14 +7070,14 @@ const DropzoneDispatchContext = createContext(void 0), DropzoneDispatchProvider
7057
7070
  })
7058
7071
  }), $[20] = t4, $[21] = t7, $[22] = t8) : t8 = $[22], t8;
7059
7072
  };
7060
- function _temp$9(state) {
7073
+ function _temp$10(state) {
7061
7074
  return state.assets.assetTypes;
7062
7075
  }
7063
- function _temp2$5(state_0) {
7076
+ function _temp2$6(state_0) {
7064
7077
  return state_0.selected.document;
7065
7078
  }
7066
7079
  const TableHeaderItem = (props) => {
7067
- let $ = c(26), { field, title } = props, dispatch = useDispatch(), order = useTypedSelector(_temp$8), isActive = order.field === field, t0;
7080
+ let $ = c(26), { field, title } = props, dispatch = useDispatch(), order = useTypedSelector(_temp$9), isActive = order.field === field, t0;
7068
7081
  $[0] !== dispatch || $[1] !== field || $[2] !== isActive || $[3] !== order.direction || $[4] !== title ? (t0 = () => {
7069
7082
  if (!(!field || !title)) {
7070
7083
  if (isActive) {
@@ -7113,14 +7126,14 @@ const TableHeaderItem = (props) => {
7113
7126
  children: t9
7114
7127
  }), $[23] = t1, $[24] = t9, $[25] = t10) : t10 = $[25], t10;
7115
7128
  };
7116
- function _temp$8(state) {
7129
+ function _temp$9(state) {
7117
7130
  return state.assets.order;
7118
7131
  }
7119
7132
  const ContextActionContainer$1 = /* @__PURE__ */ styled(Flex).withConfig({
7120
7133
  displayName: "ContextActionContainer",
7121
- componentId: "sc-00jl3m-0"
7134
+ componentId: "sc-r1w061-0"
7122
7135
  })(({ $scheme }) => css`cursor:pointer;@media (hover:hover) and (pointer:fine){&:hover{background:${getSchemeColor($scheme, "bg")};}}`), TableHeader = () => {
7123
- let $ = c(24), scheme = useColorSchemeValue(), dispatch = useDispatch(), fetching = useTypedSelector(_temp$7), itemsLength = useTypedSelector(selectAssetsLength), numPickedAssets = useTypedSelector(selectAssetsPickedLength), mediaIndex = useMediaIndex(), { onSelect } = useAssetSourceActions(), allSelected = numPickedAssets === itemsLength, t0;
7136
+ let $ = c(24), scheme = useColorSchemeValue(), dispatch = useDispatch(), fetching = useTypedSelector(_temp$8), itemsLength = useTypedSelector(selectAssetsLength), numPickedAssets = useTypedSelector(selectAssetsPickedLength), mediaIndex = useMediaIndex(), { onSelect } = useAssetSourceActions(), allSelected = numPickedAssets === itemsLength, t0;
7124
7137
  $[0] !== allSelected || $[1] !== dispatch ? (t0 = (e) => {
7125
7138
  e.stopPropagation(), dispatch(allSelected ? assetsActions.pickClear() : assetsActions.pickAll());
7126
7139
  }, $[0] = allSelected, $[1] = dispatch, $[2] = t0) : t0 = $[2];
@@ -7189,20 +7202,20 @@ const ContextActionContainer$1 = /* @__PURE__ */ styled(Flex).withConfig({
7189
7202
  ]
7190
7203
  }), $[21] = t4, $[22] = t5, $[23] = t14) : t14 = $[23], t14;
7191
7204
  };
7192
- function _temp$7(state) {
7205
+ function _temp$8(state) {
7193
7206
  return state.assets.fetching;
7194
7207
  }
7195
7208
  const ContainerGrid$1 = /* @__PURE__ */ styled(Grid).withConfig({
7196
7209
  displayName: "ContainerGrid",
7197
- componentId: "sc-phlfmf-0"
7210
+ componentId: "sc-mfq3ng-0"
7198
7211
  })(({ $scheme, $selected, $updating }) => css`align-items:center;cursor:${$selected ? "default" : "pointer"};height:100%;pointer-events:${$updating ? "none" : "auto"};user-select:none;white-space:nowrap;${!$updating && css`@media (hover:hover) and (pointer:fine){&:hover{background:${getSchemeColor($scheme, "bg")};}}`}`), ContextActionContainer = /* @__PURE__ */ styled(Flex).withConfig({
7199
7212
  displayName: "ContextActionContainer",
7200
- componentId: "sc-phlfmf-1"
7213
+ componentId: "sc-mfq3ng-1"
7201
7214
  })(({ $scheme }) => css`cursor:pointer;@media (hover:hover) and (pointer:fine){&:hover{background:${getSchemeColor($scheme, "bg2")};}}`), StyledWarningIcon = /* @__PURE__ */ styled(WarningFilledIcon).withConfig({
7202
7215
  displayName: "StyledWarningIcon",
7203
- componentId: "sc-phlfmf-2"
7216
+ componentId: "sc-mfq3ng-2"
7204
7217
  })(({ theme }) => ({ color: theme.sanity.color.spot.red })), TableRowAsset = (props) => {
7205
- let $ = c(150), { id, selected } = props, scheme = useColorSchemeValue(), shiftPressed = useKeyPress("shift"), [referenceCountVisible, setReferenceCountVisible] = useState(!1), refCountVisibleTimeout = useRef(null), dispatch = useDispatch(), lastPicked = useTypedSelector(_temp$6), t0;
7218
+ let $ = c(150), { id, selected } = props, scheme = useColorSchemeValue(), shiftPressed = useKeyPress("shift"), [referenceCountVisible, setReferenceCountVisible] = useState(!1), refCountVisibleTimeout = useRef(null), dispatch = useDispatch(), lastPicked = useTypedSelector(_temp$7), t0;
7206
7219
  $[0] === id ? t0 = $[1] : (t0 = (state_0) => selectAssetById(state_0, id), $[0] = id, $[1] = t0);
7207
7220
  let item = useTypedSelector(t0), mediaIndex = useMediaIndex(), asset = item?.asset, error = item?.error, isOpaque = item?.asset?.metadata?.isOpaque, picked = item?.picked, updating = item?.updating, { isMultiSelect, onSelect } = useAssetSourceActions(), t1;
7208
7221
  $[2] !== asset || $[3] !== dispatch || $[4] !== isMultiSelect || $[5] !== lastPicked || $[6] !== onSelect || $[7] !== picked || $[8] !== selected || $[9] !== shiftPressed ? (t1 = (e) => {
@@ -7492,7 +7505,7 @@ const ContainerGrid$1 = /* @__PURE__ */ styled(Grid).withConfig({
7492
7505
  textOverflow: "ellipsis",
7493
7506
  children: referenceCountVisible ? /* @__PURE__ */ jsx(WithReferringDocuments, {
7494
7507
  id,
7495
- children: _temp2$4
7508
+ children: _temp2$5
7496
7509
  }) : /* @__PURE__ */ jsx(Fragment, { children: "-" })
7497
7510
  }), $[120] = id, $[121] = referenceCountVisible, $[122] = t59) : t59 = $[122];
7498
7511
  let t60;
@@ -7556,19 +7569,19 @@ const ContainerGrid$1 = /* @__PURE__ */ styled(Grid).withConfig({
7556
7569
  }), $[135] = item.updating, $[136] = scheme, $[137] = selected, $[138] = t13, $[139] = t22, $[140] = t28, $[141] = t36, $[142] = t41, $[143] = t47, $[144] = t5, $[145] = t55, $[146] = t60, $[147] = t65, $[148] = t9, $[149] = t66) : t66 = $[149], t66;
7557
7570
  };
7558
7571
  var TableRowAsset_default = memo(TableRowAsset);
7559
- function _temp$6(state) {
7572
+ function _temp$7(state) {
7560
7573
  return state.assets.lastPicked;
7561
7574
  }
7562
- function _temp2$4(t0) {
7575
+ function _temp2$5(t0) {
7563
7576
  let { isLoading, referringDocuments } = t0, uniqueDocuments = getUniqueDocuments(referringDocuments);
7564
7577
  return isLoading ? /* @__PURE__ */ jsx(Fragment, { children: "-" }) : /* @__PURE__ */ jsx(Fragment, { children: Array.isArray(uniqueDocuments) ? uniqueDocuments.length : 0 });
7565
7578
  }
7566
7579
  const ContainerGrid = /* @__PURE__ */ styled(Grid).withConfig({
7567
7580
  displayName: "ContainerGrid",
7568
- componentId: "sc-j0br29-0"
7581
+ componentId: "sc-ezmovx-0"
7569
7582
  })(({ theme }) => css`align-items:center;cursor:pointer;height:100%;user-select:none;white-space:nowrap;@media (hover:hover) and (pointer:fine){&:hover{background:${theme.sanity.color.card.enabled.bg};}}`), FolderBadge = /* @__PURE__ */ styled(Box).withConfig({
7570
7583
  displayName: "FolderBadge",
7571
- componentId: "sc-j0br29-1"
7584
+ componentId: "sc-ezmovx-1"
7572
7585
  })(({ theme }) => css`background:${theme.sanity.color.spot.yellow};border-radius:6px;height:42px;position:relative;width:52px;&::before{background:${theme.sanity.color.spot.yellow};border-radius:6px 6px 0 0;content:'';height:12px;left:0;position:absolute;top:-6px;width:18px;}`), TableRowFolder = (t0) => {
7573
7586
  let $ = c(45), { folderId, name, totalCount } = t0, dispatch = useDispatch(), mediaIndex = useMediaIndex(), scheme = useColorSchemeValue(), t1;
7574
7587
  $[0] !== dispatch || $[1] !== folderId ? (t1 = () => dispatch(foldersActions.currentFolderSet({ folderId })), $[0] = dispatch, $[1] = folderId, $[2] = t1) : t1 = $[2];
@@ -7867,8 +7880,8 @@ const ContainerGrid = /* @__PURE__ */ styled(Grid).withConfig({
7867
7880
  }
7868
7881
  return null;
7869
7882
  }), AssetTableVirtualized = (props) => {
7870
- let $ = c(15), { items, onLoadMore } = props, selectedAssets = useTypedSelector(_temp$5), t0;
7871
- $[0] === selectedAssets ? t0 = $[1] : (t0 = selectedAssets && selectedAssets.map(_temp2$3) || [], $[0] = selectedAssets, $[1] = t0);
7883
+ let $ = c(15), { items, onLoadMore } = props, selectedAssets = useTypedSelector(_temp$6), t0;
7884
+ $[0] === selectedAssets ? t0 = $[1] : (t0 = selectedAssets && selectedAssets.map(_temp2$4) || [], $[0] = selectedAssets, $[1] = t0);
7872
7885
  let selectedIds = t0, totalCount = items?.length;
7873
7886
  if (totalCount === 0) return null;
7874
7887
  let t1;
@@ -7891,22 +7904,22 @@ const ContainerGrid = /* @__PURE__ */ styled(Grid).withConfig({
7891
7904
  computeItemKey: t1,
7892
7905
  endReached: onLoadMore,
7893
7906
  groupCounts: t2,
7894
- groupContent: _temp3$2,
7907
+ groupContent: _temp3$3,
7895
7908
  itemContent: t3,
7896
7909
  style: t4
7897
7910
  }), $[10] = onLoadMore, $[11] = t1, $[12] = t2, $[13] = t3, $[14] = t5) : t5 = $[14], t5;
7898
7911
  };
7899
- function _temp$5(state) {
7912
+ function _temp$6(state) {
7900
7913
  return state.selected.assets;
7901
7914
  }
7902
- function _temp2$3(asset) {
7915
+ function _temp2$4(asset) {
7903
7916
  return asset._id;
7904
7917
  }
7905
- function _temp3$2() {
7918
+ function _temp3$3() {
7906
7919
  return /* @__PURE__ */ jsx(TableHeader, {});
7907
7920
  }
7908
7921
  const Items = () => {
7909
- let $ = c(15), dispatch = useDispatch(), fetchCount = useTypedSelector(_temp$4), fetching = useTypedSelector(_temp2$2), foldersPanelVisible = useTypedSelector(_temp3$1), tagsPanelVisible = useTypedSelector(_temp4), view = useTypedSelector(_temp5), combinedItems = useTypedSelector(selectCombinedItems), mediaIndex = useMediaIndex(), hasFetchedOnce = fetchCount >= 0, hasItems = combinedItems.length > 0, t0;
7922
+ let $ = c(15), dispatch = useDispatch(), fetchCount = useTypedSelector(_temp$5), fetching = useTypedSelector(_temp2$3), foldersPanelVisible = useTypedSelector(_temp3$2), tagsPanelVisible = useTypedSelector(_temp4), view = useTypedSelector(_temp5), combinedItems = useTypedSelector(selectCombinedItems), mediaIndex = useMediaIndex(), hasFetchedOnce = fetchCount >= 0, hasItems = combinedItems.length > 0, t0;
7910
7923
  $[0] !== dispatch || $[1] !== fetching ? (t0 = () => {
7911
7924
  fetching || dispatch(assetsActions.loadNextPage());
7912
7925
  }, $[0] = dispatch, $[1] = fetching, $[2] = t0) : t0 = $[2];
@@ -7941,13 +7954,13 @@ const Items = () => {
7941
7954
  })] })
7942
7955
  }), $[10] = combinedItems, $[11] = handleLoadMoreItems, $[12] = isEmpty, $[13] = view, $[14] = t4) : t4 = $[14], t4;
7943
7956
  };
7944
- function _temp$4(state) {
7957
+ function _temp$5(state) {
7945
7958
  return state.assets.fetchCount;
7946
7959
  }
7947
- function _temp2$2(state_0) {
7960
+ function _temp2$3(state_0) {
7948
7961
  return state_0.assets.fetching;
7949
7962
  }
7950
- function _temp3$1(state_1) {
7963
+ function _temp3$2(state_1) {
7951
7964
  return state_1.folders.panelVisible;
7952
7965
  }
7953
7966
  function _temp4(state_2) {
@@ -7957,7 +7970,7 @@ function _temp5(state_3) {
7957
7970
  return state_3.assets.view;
7958
7971
  }
7959
7972
  const PickedBar = () => {
7960
- let $ = c(57), scheme = useColorSchemeValue(), dispatch = useDispatch(), assetsPicked = useTypedSelector(selectAssetsPicked), currentFolderId = useTypedSelector(_temp$3), { isMultiSelect, onSelect } = useAssetSourceActions(), t0;
7973
+ let $ = c(57), scheme = useColorSchemeValue(), dispatch = useDispatch(), assetsPicked = useTypedSelector(selectAssetsPicked), currentFolderId = useTypedSelector(_temp$4), { isMultiSelect, onSelect } = useAssetSourceActions(), t0;
7961
7974
  $[0] !== assetsPicked[0] || $[1] !== assetsPicked.length ? (t0 = assetsPicked.length === 1 && !!assetsPicked[0] && isImageAsset(assetsPicked[0].asset), $[0] = assetsPicked[0], $[1] = assetsPicked.length, $[2] = t0) : t0 = $[2];
7962
7975
  let canReplace = t0, t1;
7963
7976
  $[3] === dispatch ? t1 = $[4] : (t1 = () => {
@@ -7985,7 +7998,7 @@ const PickedBar = () => {
7985
7998
  let handleRemovePickedFromFolder = t5, t6;
7986
7999
  $[18] !== assetsPicked || $[19] !== onSelect ? (t6 = () => {
7987
8000
  if (!onSelect) return;
7988
- let pickedAssetIds = assetsPicked.map(_temp2$1);
8001
+ let pickedAssetIds = assetsPicked.map(_temp2$2);
7989
8002
  pickedAssetIds.length !== 0 && onSelect(pickedAssetIds);
7990
8003
  }, $[18] = assetsPicked, $[19] = onSelect, $[20] = t6) : t6 = $[20];
7991
8004
  let handleInsertPicked = t6;
@@ -8128,10 +8141,10 @@ const PickedBar = () => {
8128
8141
  children: t19
8129
8142
  }), $[54] = t19, $[55] = t8, $[56] = t20) : t20 = $[56], t20;
8130
8143
  };
8131
- function _temp$3(state) {
8144
+ function _temp$4(state) {
8132
8145
  return state.folders.currentFolderId;
8133
8146
  }
8134
- function _temp2$1(item) {
8147
+ function _temp2$2(item) {
8135
8148
  return {
8136
8149
  kind: "assetDocumentId",
8137
8150
  value: item.asset._id
@@ -8139,7 +8152,7 @@ function _temp2$1(item) {
8139
8152
  }
8140
8153
  const TagsPanel = () => {
8141
8154
  let $ = c(2);
8142
- if (!useTypedSelector(_temp$2)) return null;
8155
+ if (!useTypedSelector(_temp$3)) return null;
8143
8156
  let t0;
8144
8157
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = {
8145
8158
  position: "relative",
@@ -8164,15 +8177,15 @@ const TagsPanel = () => {
8164
8177
  })
8165
8178
  }), $[1] = t1) : t1 = $[1], t1;
8166
8179
  };
8167
- function _temp$2(state) {
8180
+ function _temp$3(state) {
8168
8181
  return state.tags.panelVisible;
8169
8182
  }
8170
8183
  const UploadContainer = styled.div.withConfig({
8171
8184
  displayName: "UploadContainer",
8172
- componentId: "sc-2pwjx1-0"
8185
+ componentId: "sc-cm6qls-0"
8173
8186
  })`color:white;height:100%;min-height:100%;right:0;top:0;width:100%;&:focus{outline:none;}`, DragActiveContainer = styled.div.withConfig({
8174
8187
  displayName: "DragActiveContainer",
8175
- componentId: "sc-2pwjx1-1"
8188
+ componentId: "sc-cm6qls-1"
8176
8189
  })`align-items:center;background:rgba(0,0,0,0.75);display:flex;height:100%;justify-content:center;position:absolute;right:0;top:0;width:100%;z-index:3;`;
8177
8190
  async function filterFiles(fileList) {
8178
8191
  let files = Array.from(fileList), filteredFiles = [];
@@ -8182,7 +8195,7 @@ async function filterFiles(fileList) {
8182
8195
  return filteredFiles;
8183
8196
  }
8184
8197
  const UploadDropzone = (props) => {
8185
- let $ = c(32), { children } = props, { dropzone: t0, directUploads } = useToolOptions(), { maxSize } = t0, { onSelect } = useAssetSourceActions(), dispatch = useDispatch(), assetTypes = useTypedSelector(_temp$1), isImageAssetType = assetTypes.length === 1 && assetTypes[0] === "image", t1;
8198
+ let $ = c(32), { children } = props, { dropzone: t0, directUploads } = useToolOptions(), { maxSize } = t0, { onSelect } = useAssetSourceActions(), dispatch = useDispatch(), assetTypes = useTypedSelector(_temp$2), isImageAssetType = assetTypes.length === 1 && assetTypes[0] === "image", t1;
8186
8199
  $[0] !== assetTypes[0] || $[1] !== assetTypes.length || $[2] !== dispatch ? (t1 = async (acceptedFiles) => {
8187
8200
  acceptedFiles.forEach((file) => dispatch(uploadsActions.uploadRequest({
8188
8201
  file,
@@ -8191,7 +8204,7 @@ const UploadDropzone = (props) => {
8191
8204
  }, $[0] = assetTypes[0], $[1] = assetTypes.length, $[2] = dispatch, $[3] = t1) : t1 = $[3];
8192
8205
  let handleDrop = t1, t2;
8193
8206
  $[4] === dispatch ? t2 = $[5] : (t2 = (rejections) => {
8194
- rejections.flatMap(_temp3).includes("file-too-large") && dispatch(notificationsActions.add({
8207
+ rejections.flatMap(_temp3$1).includes("file-too-large") && dispatch(notificationsActions.add({
8195
8208
  status: "error",
8196
8209
  title: "One or more files exceed the maximum upload size."
8197
8210
  }));
@@ -8253,16 +8266,16 @@ const UploadDropzone = (props) => {
8253
8266
  children: t12
8254
8267
  }), $[29] = open, $[30] = t12, $[31] = t13) : t13 = $[31], t13;
8255
8268
  };
8256
- function _temp$1(state) {
8269
+ function _temp$2(state) {
8257
8270
  return state.assets.assetTypes;
8258
8271
  }
8259
- function _temp2(t0) {
8272
+ function _temp2$1(t0) {
8260
8273
  let { code } = t0;
8261
8274
  return code;
8262
8275
  }
8263
- function _temp3(t0) {
8276
+ function _temp3$1(t0) {
8264
8277
  let { errors } = t0;
8265
- return errors.map(_temp2);
8278
+ return errors.map(_temp2$1);
8266
8279
  }
8267
8280
  function getMediaTagNames(schemaType) {
8268
8281
  let mediaTags = schemaType?.options?.mediaTags;
@@ -8299,22 +8312,26 @@ function createTagHandler(dispatch) {
8299
8312
  };
8300
8313
  }
8301
8314
  function useBrowserInit(client, schemaType) {
8302
- let dispatch = useDispatch(), tagsByIds = useSelector((state) => state.tags.byIds), tagsFetchCount = useSelector((state_0) => state_0.tags.fetchCount), tagNames = getMediaTagNames(schemaType), hasMediaTags = tagNames.length > 0;
8303
- useEffect(() => {
8315
+ let $ = c(16), dispatch = useDispatch(), tagsByIds = useSelector(_temp$1), tagsFetchCount = useSelector(_temp2), t0;
8316
+ $[0] === schemaType ? t0 = $[1] : (t0 = getMediaTagNames(schemaType), $[0] = schemaType, $[1] = t0);
8317
+ let tagNames = t0, hasMediaTags = tagNames.length > 0, t1, t2;
8318
+ $[2] !== client || $[3] !== dispatch || $[4] !== hasMediaTags ? (t1 = () => {
8304
8319
  hasMediaTags || dispatch(searchActions.facetsClear()), dispatch(tagsActions.fetchRequest()), dispatch(foldersActions.fetchRequest());
8305
8320
  let assetSubscription = client.listen(groq`*[_type in ["sanity.fileAsset", "sanity.imageAsset"] && !(_id in path("drafts.**"))]`).subscribe(createAssetHandler(dispatch)), tagSubscription = client.listen(groq`*[_type == "${TAG_DOCUMENT_NAME}" && !(_id in path("drafts.**"))]`).subscribe(createTagHandler(dispatch)), folderSubscription = client.listen(groq`*[_type == "${FOLDER_DOCUMENT_NAME}" && !(_id in path("drafts.**"))]`).subscribe(() => dispatch(foldersActions.fetchRequest()));
8306
8321
  return () => {
8307
8322
  assetSubscription.unsubscribe(), tagSubscription.unsubscribe(), folderSubscription.unsubscribe();
8308
8323
  };
8309
- }, [
8324
+ }, t2 = [
8310
8325
  client,
8311
8326
  dispatch,
8312
8327
  hasMediaTags
8313
- ]), useEffect(() => {
8328
+ ], $[2] = client, $[3] = dispatch, $[4] = hasMediaTags, $[5] = t1, $[6] = t2) : (t1 = $[5], t2 = $[6]), useEffect(t1, t2);
8329
+ let t3;
8330
+ $[7] !== dispatch || $[8] !== hasMediaTags || $[9] !== tagNames || $[10] !== tagsByIds || $[11] !== tagsFetchCount ? (t3 = () => {
8314
8331
  if (!hasMediaTags || tagsFetchCount < 0) return;
8315
8332
  let tagFacetInput = inputs.tag;
8316
8333
  if (tagFacetInput.type !== "searchable") return;
8317
- let resolvedTags = tagNames.map((name) => Object.values(tagsByIds).find((item) => item.tag.name.current === name)).filter((item_0) => !!item_0);
8334
+ let resolvedTags = tagNames.map((name) => Object.values(tagsByIds).find((item) => item.tag.name.current === name)).filter(_temp3);
8318
8335
  dispatch(searchActions.facetsClear());
8319
8336
  for (let tagItem of resolvedTags) dispatch(searchActions.facetsAdd({ facet: {
8320
8337
  ...tagFacetInput,
@@ -8324,7 +8341,18 @@ function useBrowserInit(client, schemaType) {
8324
8341
  value: tagItem.tag._id
8325
8342
  }
8326
8343
  } }));
8327
- }, [tagsFetchCount, hasMediaTags]);
8344
+ }, $[7] = dispatch, $[8] = hasMediaTags, $[9] = tagNames, $[10] = tagsByIds, $[11] = tagsFetchCount, $[12] = t3) : t3 = $[12];
8345
+ let t4;
8346
+ $[13] !== hasMediaTags || $[14] !== tagsFetchCount ? (t4 = [tagsFetchCount, hasMediaTags], $[13] = hasMediaTags, $[14] = tagsFetchCount, $[15] = t4) : t4 = $[15], useEffect(t3, t4);
8347
+ }
8348
+ function _temp3(item_0) {
8349
+ return !!item_0;
8350
+ }
8351
+ function _temp2(state_0) {
8352
+ return state_0.tags.fetchCount;
8353
+ }
8354
+ function _temp$1(state) {
8355
+ return state.tags.byIds;
8328
8356
  }
8329
8357
  const BrowserContent = (t0) => {
8330
8358
  let $ = c(14), { onClose, schemaType } = t0, client = useVersionedClient(), [portalElement, setPortalElement] = useState(null);