@orangelogic/orange-dam-content-browser-sdk 2.4.3 → 2.4.4-table-view-beta-3

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.
@@ -147,6 +147,7 @@ import CxResizeObserver from "@orangelogic/design-system/components/resize-obser
147
147
  import CxArrayLineClamp from "@orangelogic/design-system/components/array-line-clamp";
148
148
  import CxCard from "@orangelogic/design-system/components/card";
149
149
  import CxCheckbox from "@orangelogic/design-system/components/checkbox";
150
+ import CxColorSwatchGroup from "@orangelogic/design-system/components/color-swatch-group";
150
151
  /**
151
152
  * @license
152
153
  * Copyright 2019 Google LLC
@@ -1165,13 +1166,13 @@ var camelCase = createCompounder(function(result, word, index) {
1165
1166
  word = word.toLowerCase();
1166
1167
  return result + (index ? capitalize(word) : word);
1167
1168
  });
1168
- var __defProp$h = Object.defineProperty;
1169
- var __decorateClass$h = (decorators, target, key, kind) => {
1169
+ var __defProp$i = Object.defineProperty;
1170
+ var __decorateClass$i = (decorators, target, key, kind) => {
1170
1171
  var result = void 0;
1171
1172
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
1172
1173
  if (decorator = decorators[i4])
1173
1174
  result = decorator(target, key, result) || result;
1174
- if (result) __defProp$h(target, key, result);
1175
+ if (result) __defProp$i(target, key, result);
1175
1176
  return result;
1176
1177
  };
1177
1178
  const _CortexElement = class _CortexElement extends i$4 {
@@ -1298,16 +1299,16 @@ const _CortexElement = class _CortexElement extends i$4 {
1298
1299
  _CortexElement.version = "1";
1299
1300
  _CortexElement.dependencies = {};
1300
1301
  let CortexElement = _CortexElement;
1301
- __decorateClass$h([
1302
+ __decorateClass$i([
1302
1303
  n$6()
1303
1304
  ], CortexElement.prototype, "dir");
1304
- __decorateClass$h([
1305
+ __decorateClass$i([
1305
1306
  n$6()
1306
1307
  ], CortexElement.prototype, "lang");
1307
- __decorateClass$h([
1308
+ __decorateClass$i([
1308
1309
  n$6()
1309
1310
  ], CortexElement.prototype, "theme");
1310
- __decorateClass$h([
1311
+ __decorateClass$i([
1311
1312
  n$6({ attribute: "pre-render", type: Boolean })
1312
1313
  ], CortexElement.prototype, "preRender");
1313
1314
  function rescueElementPrototype(element) {
@@ -5750,7 +5751,7 @@ function watch(propertyName, options) {
5750
5751
  };
5751
5752
  };
5752
5753
  }
5753
- const styles$e = i$7`
5754
+ const styles$f = i$7`
5754
5755
  :host {
5755
5756
  display: contents;
5756
5757
  }
@@ -5839,14 +5840,14 @@ const styles$e = i$7`
5839
5840
  display: block;
5840
5841
  }
5841
5842
  `;
5842
- var __defProp$g = Object.defineProperty;
5843
- var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
5844
- var __decorateClass$g = (decorators, target, key, kind) => {
5845
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
5843
+ var __defProp$h = Object.defineProperty;
5844
+ var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
5845
+ var __decorateClass$h = (decorators, target, key, kind) => {
5846
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target;
5846
5847
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
5847
5848
  if (decorator = decorators[i4])
5848
5849
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
5849
- if (kind && result) __defProp$g(target, key, result);
5850
+ if (kind && result) __defProp$h(target, key, result);
5850
5851
  return result;
5851
5852
  };
5852
5853
  const LIBRARY_FOLDER_TITLE = "Library";
@@ -6112,7 +6113,7 @@ let CxContentBrowserBrowser = class extends CortexElement {
6112
6113
  `;
6113
6114
  }
6114
6115
  };
6115
- CxContentBrowserBrowser.styles = [componentStyles, styles$e];
6116
+ CxContentBrowserBrowser.styles = [componentStyles, styles$f];
6116
6117
  CxContentBrowserBrowser.dependencies = {
6117
6118
  "cx-drawer": CxDrawer,
6118
6119
  "cx-folder-select": CxFolderSelect,
@@ -6122,67 +6123,67 @@ CxContentBrowserBrowser.dependencies = {
6122
6123
  "cx-tooltip": CxTooltip,
6123
6124
  "cx-typography": CxTypography
6124
6125
  };
6125
- __decorateClass$g([
6126
+ __decorateClass$h([
6126
6127
  e$7(".drawer-trigger")
6127
6128
  ], CxContentBrowserBrowser.prototype, "trigger", 2);
6128
- __decorateClass$g([
6129
+ __decorateClass$h([
6129
6130
  e$7(".content-browser-browser")
6130
6131
  ], CxContentBrowserBrowser.prototype, "drawer", 2);
6131
- __decorateClass$g([
6132
+ __decorateClass$h([
6132
6133
  n$6({ attribute: "folder-id", type: String })
6133
6134
  ], CxContentBrowserBrowser.prototype, "folderId", 2);
6134
- __decorateClass$g([
6135
+ __decorateClass$h([
6135
6136
  n$6({ attribute: "folder-title", type: String })
6136
6137
  ], CxContentBrowserBrowser.prototype, "folderTitle", 2);
6137
- __decorateClass$g([
6138
+ __decorateClass$h([
6138
6139
  n$6({ attribute: "allowed-folders", type: Array })
6139
6140
  ], CxContentBrowserBrowser.prototype, "allowedFolders", 2);
6140
- __decorateClass$g([
6141
+ __decorateClass$h([
6141
6142
  n$6({ attribute: "can-pin", type: Boolean })
6142
6143
  ], CxContentBrowserBrowser.prototype, "canPin", 2);
6143
- __decorateClass$g([
6144
+ __decorateClass$h([
6144
6145
  n$6({ attribute: "collection-path", type: String })
6145
6146
  ], CxContentBrowserBrowser.prototype, "collectionPath", 2);
6146
- __decorateClass$g([
6147
+ __decorateClass$h([
6147
6148
  n$6({ attribute: "favorite-folder-id", type: String })
6148
6149
  ], CxContentBrowserBrowser.prototype, "favoriteFolderId", 2);
6149
- __decorateClass$g([
6150
+ __decorateClass$h([
6150
6151
  n$6({ attribute: "show-collections", type: Boolean })
6151
6152
  ], CxContentBrowserBrowser.prototype, "showCollections", 2);
6152
- __decorateClass$g([
6153
+ __decorateClass$h([
6153
6154
  n$6({ attribute: "show-favorite-folder", type: Boolean })
6154
6155
  ], CxContentBrowserBrowser.prototype, "showFavoriteFolder", 2);
6155
- __decorateClass$g([
6156
+ __decorateClass$h([
6156
6157
  n$6({ attribute: "force-overlay", type: Boolean })
6157
6158
  ], CxContentBrowserBrowser.prototype, "forceOverlay", 2);
6158
- __decorateClass$g([
6159
+ __decorateClass$h([
6159
6160
  n$6({ attribute: "see-thru", type: Boolean })
6160
6161
  ], CxContentBrowserBrowser.prototype, "seeThru", 2);
6161
- __decorateClass$g([
6162
+ __decorateClass$h([
6162
6163
  n$6({ attribute: "min-query-length", type: Number })
6163
6164
  ], CxContentBrowserBrowser.prototype, "minQueryLength", 2);
6164
- __decorateClass$g([
6165
+ __decorateClass$h([
6165
6166
  n$6({ attribute: "token", type: String })
6166
6167
  ], CxContentBrowserBrowser.prototype, "token", 2);
6167
- __decorateClass$g([
6168
+ __decorateClass$h([
6168
6169
  n$6({ attribute: "base-url", type: String })
6169
6170
  ], CxContentBrowserBrowser.prototype, "baseUrl", 2);
6170
- __decorateClass$g([
6171
+ __decorateClass$h([
6171
6172
  n$6({ attribute: "use-site-session", type: Boolean })
6172
6173
  ], CxContentBrowserBrowser.prototype, "useSiteSession", 2);
6173
- __decorateClass$g([
6174
+ __decorateClass$h([
6174
6175
  r$6()
6175
6176
  ], CxContentBrowserBrowser.prototype, "searchTerm", 2);
6176
- __decorateClass$g([
6177
+ __decorateClass$h([
6177
6178
  r$6()
6178
6179
  ], CxContentBrowserBrowser.prototype, "isPersistent", 2);
6179
- __decorateClass$g([
6180
+ __decorateClass$h([
6180
6181
  r$6()
6181
6182
  ], CxContentBrowserBrowser.prototype, "collectionsOpen", 2);
6182
- __decorateClass$g([
6183
+ __decorateClass$h([
6183
6184
  watch("forceOverlay", { waitUntilFirstUpdate: true })
6184
6185
  ], CxContentBrowserBrowser.prototype, "handleForceOverlayChange", 1);
6185
- CxContentBrowserBrowser = __decorateClass$g([
6186
+ CxContentBrowserBrowser = __decorateClass$h([
6186
6187
  customElement("cx-content-browser-browser")
6187
6188
  ], CxContentBrowserBrowser);
6188
6189
  /**
@@ -6313,6 +6314,7 @@ var GridView = /* @__PURE__ */ ((GridView2) => {
6313
6314
  GridView2["Small"] = "small";
6314
6315
  return GridView2;
6315
6316
  })(GridView || {});
6317
+ const TABLE_VIEW = "table";
6316
6318
  const ASSET_SIZE = {
6317
6319
  [
6318
6320
  "small"
@@ -6345,19 +6347,43 @@ var TransformationAction = /* @__PURE__ */ ((TransformationAction2) => {
6345
6347
  TransformationAction2["Rotate"] = "Rotate";
6346
6348
  return TransformationAction2;
6347
6349
  })(TransformationAction || {});
6350
+ const autoSelectFormatConverter = {
6351
+ fromAttribute: (value) => {
6352
+ if (value === null) {
6353
+ return false;
6354
+ }
6355
+ const normalized = value.trim();
6356
+ if (normalized === "" || normalized.toLowerCase() === "true") {
6357
+ return true;
6358
+ }
6359
+ if (normalized.toLowerCase() === "false") {
6360
+ return false;
6361
+ }
6362
+ return normalized;
6363
+ },
6364
+ toAttribute: (value) => {
6365
+ return value === false ? null : String(value);
6366
+ }
6367
+ };
6368
+ function isAutoSelectFormatActive(value) {
6369
+ return value === true || typeof value === "string" && value.trim() !== "";
6370
+ }
6348
6371
  var ContentBrowserFormatDialogVariant = /* @__PURE__ */ ((ContentBrowserFormatDialogVariant2) => {
6349
6372
  ContentBrowserFormatDialogVariant2["Dialog"] = "dialog";
6350
6373
  ContentBrowserFormatDialogVariant2["Drawer"] = "drawer";
6351
6374
  return ContentBrowserFormatDialogVariant2;
6352
6375
  })(ContentBrowserFormatDialogVariant || {});
6353
- var __defProp$f = Object.defineProperty;
6354
- var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
6355
- var __decorateClass$f = (decorators, target, key, kind) => {
6356
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target;
6376
+ function toFieldKey(field) {
6377
+ return field.trim().toLowerCase();
6378
+ }
6379
+ var __defProp$g = Object.defineProperty;
6380
+ var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
6381
+ var __decorateClass$g = (decorators, target, key, kind) => {
6382
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
6357
6383
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
6358
6384
  if (decorator = decorators[i4])
6359
6385
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6360
- if (kind && result) __defProp$f(target, key, result);
6386
+ if (kind && result) __defProp$g(target, key, result);
6361
6387
  return result;
6362
6388
  };
6363
6389
  let CxContentBrowserControlFilterFacet = class extends CortexElement {
@@ -6493,37 +6519,37 @@ CxContentBrowserControlFilterFacet.dependencies = {
6493
6519
  "cx-typography": CxTypography
6494
6520
  };
6495
6521
  CxContentBrowserControlFilterFacet.itemsPerPage = 10;
6496
- __decorateClass$f([
6522
+ __decorateClass$g([
6497
6523
  n$6({ attribute: "loading", reflect: false, type: Boolean })
6498
6524
  ], CxContentBrowserControlFilterFacet.prototype, "loading", 2);
6499
- __decorateClass$f([
6525
+ __decorateClass$g([
6500
6526
  n$6({ attribute: "display-name", reflect: false, type: String })
6501
6527
  ], CxContentBrowserControlFilterFacet.prototype, "displayName", 2);
6502
- __decorateClass$f([
6528
+ __decorateClass$g([
6503
6529
  n$6({ attribute: "type", reflect: true, type: String })
6504
6530
  ], CxContentBrowserControlFilterFacet.prototype, "type", 2);
6505
- __decorateClass$f([
6531
+ __decorateClass$g([
6506
6532
  n$6({ attribute: "values", reflect: false, type: Array })
6507
6533
  ], CxContentBrowserControlFilterFacet.prototype, "values", 2);
6508
- __decorateClass$f([
6534
+ __decorateClass$g([
6509
6535
  n$6({ attribute: "collections", reflect: false, type: Array })
6510
6536
  ], CxContentBrowserControlFilterFacet.prototype, "collections", 2);
6511
- __decorateClass$f([
6537
+ __decorateClass$g([
6512
6538
  r$6()
6513
6539
  ], CxContentBrowserControlFilterFacet.prototype, "mappedSubtypes", 2);
6514
- __decorateClass$f([
6540
+ __decorateClass$g([
6515
6541
  r$6()
6516
6542
  ], CxContentBrowserControlFilterFacet.prototype, "mappedDisplayNames", 2);
6517
- __decorateClass$f([
6543
+ __decorateClass$g([
6518
6544
  r$6()
6519
6545
  ], CxContentBrowserControlFilterFacet.prototype, "page", 2);
6520
- __decorateClass$f([
6546
+ __decorateClass$g([
6521
6547
  watch("values")
6522
6548
  ], CxContentBrowserControlFilterFacet.prototype, "handleValuesChange", 1);
6523
- CxContentBrowserControlFilterFacet = __decorateClass$f([
6549
+ CxContentBrowserControlFilterFacet = __decorateClass$g([
6524
6550
  customElement("cx-content-browser-control-filter-facet")
6525
6551
  ], CxContentBrowserControlFilterFacet);
6526
- const styles$d = i$7`
6552
+ const styles$e = i$7`
6527
6553
  :host {
6528
6554
  --details-width: min(240px, 90dvw);
6529
6555
 
@@ -6548,14 +6574,14 @@ const styles$d = i$7`
6548
6574
  border-left-width: 0px;
6549
6575
  }
6550
6576
  `;
6551
- var __defProp$e = Object.defineProperty;
6552
- var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
6553
- var __decorateClass$e = (decorators, target, key, kind) => {
6554
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
6577
+ var __defProp$f = Object.defineProperty;
6578
+ var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
6579
+ var __decorateClass$f = (decorators, target, key, kind) => {
6580
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target;
6555
6581
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
6556
6582
  if (decorator = decorators[i4])
6557
6583
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6558
- if (kind && result) __defProp$e(target, key, result);
6584
+ if (kind && result) __defProp$f(target, key, result);
6559
6585
  return result;
6560
6586
  };
6561
6587
  let CxContentBrowserControlFilter = class extends CortexElement {
@@ -6780,7 +6806,7 @@ let CxContentBrowserControlFilter = class extends CortexElement {
6780
6806
  `;
6781
6807
  }
6782
6808
  };
6783
- CxContentBrowserControlFilter.styles = [componentStyles, styles$d];
6809
+ CxContentBrowserControlFilter.styles = [componentStyles, styles$e];
6784
6810
  CxContentBrowserControlFilter.dependencies = {
6785
6811
  "cx-badge": CxBadge,
6786
6812
  "cx-button": CxButton,
@@ -6801,52 +6827,52 @@ CxContentBrowserControlFilter.dependencies = {
6801
6827
  "cx-tooltip": CxTooltip,
6802
6828
  "cx-typography": CxTypography
6803
6829
  };
6804
- __decorateClass$e([
6830
+ __decorateClass$f([
6805
6831
  n$6({ attribute: "facets", reflect: false, type: Array })
6806
6832
  ], CxContentBrowserControlFilter.prototype, "facets", 2);
6807
- __decorateClass$e([
6833
+ __decorateClass$f([
6808
6834
  n$6({ attribute: "available-facets", reflect: false, type: Array })
6809
6835
  ], CxContentBrowserControlFilter.prototype, "availableFacets", 2);
6810
- __decorateClass$e([
6836
+ __decorateClass$f([
6811
6837
  n$6({ attribute: "selected-facets", reflect: false, type: Object })
6812
6838
  ], CxContentBrowserControlFilter.prototype, "selectedFacets", 2);
6813
- __decorateClass$e([
6839
+ __decorateClass$f([
6814
6840
  n$6({ attribute: "loading", reflect: false, type: Boolean })
6815
6841
  ], CxContentBrowserControlFilter.prototype, "loading", 2);
6816
- __decorateClass$e([
6842
+ __decorateClass$f([
6817
6843
  n$6({ attribute: "newly-changed-option", reflect: false, type: Object })
6818
6844
  ], CxContentBrowserControlFilter.prototype, "newlyChangedOption", 2);
6819
- __decorateClass$e([
6845
+ __decorateClass$f([
6820
6846
  n$6({ attribute: "is-mobile", reflect: false, type: Boolean })
6821
6847
  ], CxContentBrowserControlFilter.prototype, "isMobile", 2);
6822
- __decorateClass$e([
6848
+ __decorateClass$f([
6823
6849
  r$6()
6824
6850
  ], CxContentBrowserControlFilter.prototype, "appliedFiltersCount", 2);
6825
- __decorateClass$e([
6851
+ __decorateClass$f([
6826
6852
  r$6()
6827
6853
  ], CxContentBrowserControlFilter.prototype, "mappedDisplayNames", 2);
6828
- __decorateClass$e([
6854
+ __decorateClass$f([
6829
6855
  watch("facets")
6830
6856
  ], CxContentBrowserControlFilter.prototype, "handleFacetsChange", 1);
6831
- __decorateClass$e([
6857
+ __decorateClass$f([
6832
6858
  watch("selectedFacets")
6833
6859
  ], CxContentBrowserControlFilter.prototype, "handleSelectedFacetsChange", 1);
6834
- CxContentBrowserControlFilter = __decorateClass$e([
6860
+ CxContentBrowserControlFilter = __decorateClass$f([
6835
6861
  customElement("cx-content-browser-control-filter")
6836
6862
  ], CxContentBrowserControlFilter);
6837
- const styles$c = i$7`
6863
+ const styles$d = i$7`
6838
6864
  :host {
6839
6865
  display: contents;
6840
6866
  }
6841
6867
  `;
6842
- var __defProp$d = Object.defineProperty;
6843
- var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
6844
- var __decorateClass$d = (decorators, target, key, kind) => {
6845
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
6868
+ var __defProp$e = Object.defineProperty;
6869
+ var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
6870
+ var __decorateClass$e = (decorators, target, key, kind) => {
6871
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
6846
6872
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
6847
6873
  if (decorator = decorators[i4])
6848
6874
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6849
- if (kind && result) __defProp$d(target, key, result);
6875
+ if (kind && result) __defProp$e(target, key, result);
6850
6876
  return result;
6851
6877
  };
6852
6878
  let CxContentBrowserControlSort = class extends CortexElement {
@@ -6985,7 +7011,7 @@ let CxContentBrowserControlSort = class extends CortexElement {
6985
7011
  `;
6986
7012
  }
6987
7013
  };
6988
- CxContentBrowserControlSort.styles = [componentStyles, styles$c];
7014
+ CxContentBrowserControlSort.styles = [componentStyles, styles$d];
6989
7015
  CxContentBrowserControlSort.dependencies = {
6990
7016
  "cx-divider": CxDivider,
6991
7017
  "cx-dropdown": CxDropdown,
@@ -6996,40 +7022,40 @@ CxContentBrowserControlSort.dependencies = {
6996
7022
  "cx-spinner": CxSpinner,
6997
7023
  "cx-tooltip": CxTooltip
6998
7024
  };
6999
- __decorateClass$d([
7025
+ __decorateClass$e([
7000
7026
  n$6({ attribute: "sort-order-name", reflect: true, type: String })
7001
7027
  ], CxContentBrowserControlSort.prototype, "sortOrderName", 2);
7002
- __decorateClass$d([
7028
+ __decorateClass$e([
7003
7029
  n$6({ attribute: "sort-direction", reflect: true, type: String })
7004
7030
  ], CxContentBrowserControlSort.prototype, "sortDirection", 2);
7005
- __decorateClass$d([
7031
+ __decorateClass$e([
7006
7032
  n$6({ attribute: "sort-orders", reflect: false, type: Array })
7007
7033
  ], CxContentBrowserControlSort.prototype, "sortOrders", 2);
7008
- __decorateClass$d([
7034
+ __decorateClass$e([
7009
7035
  n$6({ attribute: "loading", reflect: true, type: Boolean })
7010
7036
  ], CxContentBrowserControlSort.prototype, "loading", 2);
7011
- __decorateClass$d([
7037
+ __decorateClass$e([
7012
7038
  n$6({ attribute: "is-mobile", reflect: false, type: Boolean })
7013
7039
  ], CxContentBrowserControlSort.prototype, "isMobile", 2);
7014
- __decorateClass$d([
7040
+ __decorateClass$e([
7015
7041
  n$6({ attribute: "newly-changed-option", reflect: false, type: Object })
7016
7042
  ], CxContentBrowserControlSort.prototype, "newlyChangedOption", 2);
7017
- __decorateClass$d([
7043
+ __decorateClass$e([
7018
7044
  r$6()
7019
7045
  ], CxContentBrowserControlSort.prototype, "mappedSortDirections", 2);
7020
- __decorateClass$d([
7046
+ __decorateClass$e([
7021
7047
  r$6()
7022
7048
  ], CxContentBrowserControlSort.prototype, "sortDirections", 2);
7023
- __decorateClass$d([
7049
+ __decorateClass$e([
7024
7050
  watch("sortOrderName"),
7025
7051
  watch("sortDirection"),
7026
7052
  watch("sortOrders", { waitUntilFirstUpdate: true }),
7027
7053
  watch("sortDirections", { waitUntilFirstUpdate: true })
7028
7054
  ], CxContentBrowserControlSort.prototype, "handleSortDirectionsChange", 1);
7029
- CxContentBrowserControlSort = __decorateClass$d([
7055
+ CxContentBrowserControlSort = __decorateClass$e([
7030
7056
  customElement("cx-content-browser-control-sort")
7031
7057
  ], CxContentBrowserControlSort);
7032
- const styles$b = i$7`
7058
+ const styles$c = i$7`
7033
7059
  :host {
7034
7060
  display: contents;
7035
7061
  }
@@ -7039,14 +7065,14 @@ const styles$b = i$7`
7039
7065
  --checked-icon-display: none;
7040
7066
  }
7041
7067
  `;
7042
- var __defProp$c = Object.defineProperty;
7043
- var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
7044
- var __decorateClass$c = (decorators, target, key, kind) => {
7045
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
7068
+ var __defProp$d = Object.defineProperty;
7069
+ var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
7070
+ var __decorateClass$d = (decorators, target, key, kind) => {
7071
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
7046
7072
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
7047
7073
  if (decorator = decorators[i4])
7048
7074
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7049
- if (kind && result) __defProp$c(target, key, result);
7075
+ if (kind && result) __defProp$d(target, key, result);
7050
7076
  return result;
7051
7077
  };
7052
7078
  let CxContentBrowserControlView = class extends CortexElement {
@@ -7057,6 +7083,10 @@ let CxContentBrowserControlView = class extends CortexElement {
7057
7083
  this.views = [];
7058
7084
  this.isSeeThrough = false;
7059
7085
  this.isMobile = false;
7086
+ this.canUseTable = false;
7087
+ }
7088
+ get isTable() {
7089
+ return this.view === TABLE_VIEW;
7060
7090
  }
7061
7091
  runConnectedCallback() {
7062
7092
  this.handleViewChange();
@@ -7076,6 +7106,21 @@ let CxContentBrowserControlView = class extends CortexElement {
7076
7106
  }
7077
7107
  });
7078
7108
  }
7109
+ renderTableOption() {
7110
+ if (!this.canUseTable) {
7111
+ return A;
7112
+ }
7113
+ return b`
7114
+ <cx-menu-item
7115
+ value=${TABLE_VIEW}
7116
+ type="checkbox"
7117
+ ?checked=${this.isTable}
7118
+ >
7119
+ <cx-line-clamp lines="1">${this.localize.term("table")}</cx-line-clamp>
7120
+ <cx-icon slot="prefix" name="table_rows"></cx-icon>
7121
+ </cx-menu-item>
7122
+ `;
7123
+ }
7079
7124
  handleViewChange() {
7080
7125
  this.selectedView = this.views.find((item) => item.value === this.view);
7081
7126
  }
@@ -7093,7 +7138,7 @@ let CxContentBrowserControlView = class extends CortexElement {
7093
7138
  <div slot="trigger">
7094
7139
  <cx-tooltip content=${this.localize.term("view")}>
7095
7140
  <cx-icon-button
7096
- name="dashboard"
7141
+ name=${this.isTable ? "table_rows" : "dashboard"}
7097
7142
  label=${this.localize.term("view")}
7098
7143
  outline
7099
7144
  ></cx-icon-button>
@@ -7107,7 +7152,7 @@ let CxContentBrowserControlView = class extends CortexElement {
7107
7152
  <cx-menu-label>${this.localize.term("view")}</cx-menu-label>
7108
7153
  <cx-menu-item
7109
7154
  menu="submenu"
7110
- always-show-checked-icon
7155
+ ?always-show-checked-icon=${!this.canUseTable}
7111
7156
  >
7112
7157
  ${this.localize.term("grid")}
7113
7158
  ${n$5(
@@ -7120,6 +7165,7 @@ let CxContentBrowserControlView = class extends CortexElement {
7120
7165
  )}
7121
7166
  <cx-icon slot="prefix" name="grid_view"></cx-icon>
7122
7167
  </cx-menu-item>
7168
+ ${this.renderTableOption()}
7123
7169
  <cx-divider></cx-divider>
7124
7170
  <cx-menu-item value="see-thru" class="menu-item--switch">
7125
7171
  <cx-space direction="horizontal" justify-content="space-between">
@@ -7182,6 +7228,7 @@ let CxContentBrowserControlView = class extends CortexElement {
7182
7228
  </cx-menu>
7183
7229
  <cx-icon slot="prefix" name="grid_view"></cx-icon>
7184
7230
  </cx-menu-item>
7231
+ ${this.renderTableOption()}
7185
7232
  <cx-divider></cx-divider>
7186
7233
  <cx-menu-item value="see-thru" class="menu-item--switch">
7187
7234
  <cx-space direction="horizontal" justify-content="space-between">
@@ -7199,7 +7246,7 @@ let CxContentBrowserControlView = class extends CortexElement {
7199
7246
  `;
7200
7247
  }
7201
7248
  };
7202
- CxContentBrowserControlView.styles = [componentStyles, styles$b];
7249
+ CxContentBrowserControlView.styles = [componentStyles, styles$c];
7203
7250
  CxContentBrowserControlView.dependencies = {
7204
7251
  "cx-divider": CxDivider,
7205
7252
  "cx-dropdown": CxDropdown,
@@ -7213,28 +7260,31 @@ CxContentBrowserControlView.dependencies = {
7213
7260
  "cx-switch": CxSwitch,
7214
7261
  "cx-tooltip": CxTooltip
7215
7262
  };
7216
- __decorateClass$c([
7263
+ __decorateClass$d([
7217
7264
  n$6({ attribute: "view", reflect: true, type: String })
7218
7265
  ], CxContentBrowserControlView.prototype, "view", 2);
7219
- __decorateClass$c([
7266
+ __decorateClass$d([
7220
7267
  n$6({ attribute: "views", reflect: false, type: Array })
7221
7268
  ], CxContentBrowserControlView.prototype, "views", 2);
7222
- __decorateClass$c([
7269
+ __decorateClass$d([
7223
7270
  n$6({ attribute: "is-see-through", reflect: true, type: Boolean })
7224
7271
  ], CxContentBrowserControlView.prototype, "isSeeThrough", 2);
7225
- __decorateClass$c([
7272
+ __decorateClass$d([
7226
7273
  n$6({ attribute: "is-mobile", reflect: false, type: Boolean })
7227
7274
  ], CxContentBrowserControlView.prototype, "isMobile", 2);
7228
- __decorateClass$c([
7275
+ __decorateClass$d([
7276
+ n$6({ attribute: "can-use-table", reflect: true, type: Boolean })
7277
+ ], CxContentBrowserControlView.prototype, "canUseTable", 2);
7278
+ __decorateClass$d([
7229
7279
  r$6()
7230
7280
  ], CxContentBrowserControlView.prototype, "selectedView", 2);
7231
- __decorateClass$c([
7281
+ __decorateClass$d([
7232
7282
  watch("view", { waitUntilFirstUpdate: true })
7233
7283
  ], CxContentBrowserControlView.prototype, "handleViewChange", 1);
7234
- CxContentBrowserControlView = __decorateClass$c([
7284
+ CxContentBrowserControlView = __decorateClass$d([
7235
7285
  customElement("cx-content-browser-control-view")
7236
7286
  ], CxContentBrowserControlView);
7237
- const styles$a = i$7`
7287
+ const styles$b = i$7`
7238
7288
  :host {
7239
7289
  display: block;
7240
7290
  }
@@ -7257,14 +7307,14 @@ const styles$a = i$7`
7257
7307
  margin-left: auto;
7258
7308
  }
7259
7309
  `;
7260
- var __defProp$b = Object.defineProperty;
7261
- var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
7262
- var __decorateClass$b = (decorators, target, key, kind) => {
7263
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
7310
+ var __defProp$c = Object.defineProperty;
7311
+ var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
7312
+ var __decorateClass$c = (decorators, target, key, kind) => {
7313
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
7264
7314
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
7265
7315
  if (decorator = decorators[i4])
7266
7316
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7267
- if (kind && result) __defProp$b(target, key, result);
7317
+ if (kind && result) __defProp$c(target, key, result);
7268
7318
  return result;
7269
7319
  };
7270
7320
  let CxContentBrowserControlBar = class extends CortexElement {
@@ -7285,6 +7335,7 @@ let CxContentBrowserControlBar = class extends CortexElement {
7285
7335
  this.loading = false;
7286
7336
  this.searchText = "";
7287
7337
  this.isMobile = false;
7338
+ this.canUseTable = false;
7288
7339
  }
7289
7340
  handleSearchChange(event) {
7290
7341
  this.searchText = event.target.value;
@@ -7332,6 +7383,7 @@ let CxContentBrowserControlBar = class extends CortexElement {
7332
7383
  <cx-content-browser-control-view
7333
7384
  view=${this.view}
7334
7385
  .views=${this.views}
7386
+ ?can-use-table=${this.canUseTable}
7335
7387
  ?is-see-through=${this.isSeeThrough}
7336
7388
  ?is-mobile=${this.isMobile}
7337
7389
  ></cx-content-browser-control-view>
@@ -7348,7 +7400,7 @@ let CxContentBrowserControlBar = class extends CortexElement {
7348
7400
  `;
7349
7401
  }
7350
7402
  };
7351
- CxContentBrowserControlBar.styles = [componentStyles, styles$a];
7403
+ CxContentBrowserControlBar.styles = [componentStyles, styles$b];
7352
7404
  CxContentBrowserControlBar.dependencies = {
7353
7405
  "cx-avatar": CxAvatar,
7354
7406
  "cx-content-browser-control-filter": CxContentBrowserControlFilter,
@@ -7360,52 +7412,55 @@ CxContentBrowserControlBar.dependencies = {
7360
7412
  "cx-space": CxSpace,
7361
7413
  "cx-typography": CxTypography
7362
7414
  };
7363
- __decorateClass$b([
7415
+ __decorateClass$c([
7364
7416
  n$6({ attribute: "current-count", type: Number })
7365
7417
  ], CxContentBrowserControlBar.prototype, "currentCount", 2);
7366
- __decorateClass$b([
7418
+ __decorateClass$c([
7367
7419
  n$6({ attribute: "total-count", type: Number })
7368
7420
  ], CxContentBrowserControlBar.prototype, "totalCount", 2);
7369
- __decorateClass$b([
7421
+ __decorateClass$c([
7370
7422
  n$6({ attribute: "sort-order-name", reflect: true, type: String })
7371
7423
  ], CxContentBrowserControlBar.prototype, "sortOrderName", 2);
7372
- __decorateClass$b([
7424
+ __decorateClass$c([
7373
7425
  n$6({ attribute: "sort-direction", reflect: true, type: String })
7374
7426
  ], CxContentBrowserControlBar.prototype, "sortDirection", 2);
7375
- __decorateClass$b([
7427
+ __decorateClass$c([
7376
7428
  n$6({ attribute: "sort-orders", reflect: false, type: Array })
7377
7429
  ], CxContentBrowserControlBar.prototype, "sortOrders", 2);
7378
- __decorateClass$b([
7430
+ __decorateClass$c([
7379
7431
  n$6({ attribute: "view", reflect: true, type: String })
7380
7432
  ], CxContentBrowserControlBar.prototype, "view", 2);
7381
- __decorateClass$b([
7433
+ __decorateClass$c([
7382
7434
  n$6({ attribute: "views", reflect: false, type: Array })
7383
7435
  ], CxContentBrowserControlBar.prototype, "views", 2);
7384
- __decorateClass$b([
7436
+ __decorateClass$c([
7385
7437
  n$6({ attribute: "facets", reflect: false, type: Array })
7386
7438
  ], CxContentBrowserControlBar.prototype, "facets", 2);
7387
- __decorateClass$b([
7439
+ __decorateClass$c([
7388
7440
  n$6({ attribute: "available-facets", reflect: false, type: Array })
7389
7441
  ], CxContentBrowserControlBar.prototype, "availableFacets", 2);
7390
- __decorateClass$b([
7442
+ __decorateClass$c([
7391
7443
  n$6({ attribute: "selected-facets", reflect: false, type: Object })
7392
7444
  ], CxContentBrowserControlBar.prototype, "selectedFacets", 2);
7393
- __decorateClass$b([
7445
+ __decorateClass$c([
7394
7446
  n$6({ attribute: "is-see-through", reflect: true, type: Boolean })
7395
7447
  ], CxContentBrowserControlBar.prototype, "isSeeThrough", 2);
7396
- __decorateClass$b([
7448
+ __decorateClass$c([
7397
7449
  n$6({ attribute: "loading", reflect: true, type: Boolean })
7398
7450
  ], CxContentBrowserControlBar.prototype, "loading", 2);
7399
- __decorateClass$b([
7451
+ __decorateClass$c([
7400
7452
  n$6({ attribute: false, reflect: false, type: Object })
7401
7453
  ], CxContentBrowserControlBar.prototype, "newlyChangedOption", 2);
7402
- __decorateClass$b([
7454
+ __decorateClass$c([
7403
7455
  n$6({ attribute: "search-text", reflect: false, type: String })
7404
7456
  ], CxContentBrowserControlBar.prototype, "searchText", 2);
7405
- __decorateClass$b([
7457
+ __decorateClass$c([
7406
7458
  n$6({ attribute: "is-mobile", reflect: false, type: Boolean })
7407
7459
  ], CxContentBrowserControlBar.prototype, "isMobile", 2);
7408
- CxContentBrowserControlBar = __decorateClass$b([
7460
+ __decorateClass$c([
7461
+ n$6({ attribute: "can-use-table", reflect: true, type: Boolean })
7462
+ ], CxContentBrowserControlBar.prototype, "canUseTable", 2);
7463
+ CxContentBrowserControlBar = __decorateClass$c([
7409
7464
  customElement("cx-content-browser-control-bar")
7410
7465
  ], CxContentBrowserControlBar);
7411
7466
  /**
@@ -7712,14 +7767,14 @@ var Orientation = /* @__PURE__ */ ((Orientation2) => {
7712
7767
  Orientation2["Vertical"] = "vertical";
7713
7768
  return Orientation2;
7714
7769
  })(Orientation || {});
7715
- var __defProp$a = Object.defineProperty;
7716
- var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
7717
- var __decorateClass$a = (decorators, target, key, kind) => {
7718
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
7770
+ var __defProp$b = Object.defineProperty;
7771
+ var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
7772
+ var __decorateClass$b = (decorators, target, key, kind) => {
7773
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
7719
7774
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
7720
7775
  if (decorator = decorators[i4])
7721
7776
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7722
- if (kind && result) __defProp$a(target, key, result);
7777
+ if (kind && result) __defProp$b(target, key, result);
7723
7778
  return result;
7724
7779
  };
7725
7780
  let CxContentBrowserAssetPreviewVideo = class extends CortexElement {
@@ -7835,40 +7890,40 @@ CxContentBrowserAssetPreviewVideo.dependencies = {
7835
7890
  "cx-typography": CxTypography,
7836
7891
  "cx-video": CxVideo
7837
7892
  };
7838
- __decorateClass$a([
7893
+ __decorateClass$b([
7839
7894
  e$7("cx-video")
7840
7895
  ], CxContentBrowserAssetPreviewVideo.prototype, "videoElement", 2);
7841
- __decorateClass$a([
7896
+ __decorateClass$b([
7842
7897
  e$7("img")
7843
7898
  ], CxContentBrowserAssetPreviewVideo.prototype, "imageElement", 2);
7844
- __decorateClass$a([
7899
+ __decorateClass$b([
7845
7900
  n$6({ attribute: "src", reflect: true, type: String })
7846
7901
  ], CxContentBrowserAssetPreviewVideo.prototype, "src", 2);
7847
- __decorateClass$a([
7902
+ __decorateClass$b([
7848
7903
  n$6({ attribute: "alt", reflect: true, type: String })
7849
7904
  ], CxContentBrowserAssetPreviewVideo.prototype, "alt", 2);
7850
- __decorateClass$a([
7905
+ __decorateClass$b([
7851
7906
  n$6({ attribute: "thumbnail-only", reflect: true, type: Boolean })
7852
7907
  ], CxContentBrowserAssetPreviewVideo.prototype, "thumbnailOnly", 2);
7853
- __decorateClass$a([
7908
+ __decorateClass$b([
7854
7909
  n$6({ attribute: "thumbnail-src", reflect: true, type: String })
7855
7910
  ], CxContentBrowserAssetPreviewVideo.prototype, "thumbnailSrc", 2);
7856
- __decorateClass$a([
7911
+ __decorateClass$b([
7857
7912
  n$6({ reflect: true, type: Boolean })
7858
7913
  ], CxContentBrowserAssetPreviewVideo.prototype, "controls", 2);
7859
- __decorateClass$a([
7914
+ __decorateClass$b([
7860
7915
  n$6({ attribute: "loaded", reflect: true, type: Boolean })
7861
7916
  ], CxContentBrowserAssetPreviewVideo.prototype, "loaded", 2);
7862
- __decorateClass$a([
7917
+ __decorateClass$b([
7863
7918
  r$6()
7864
7919
  ], CxContentBrowserAssetPreviewVideo.prototype, "assetDirection", 2);
7865
- __decorateClass$a([
7920
+ __decorateClass$b([
7866
7921
  r$6()
7867
7922
  ], CxContentBrowserAssetPreviewVideo.prototype, "progress", 2);
7868
- CxContentBrowserAssetPreviewVideo = __decorateClass$a([
7923
+ CxContentBrowserAssetPreviewVideo = __decorateClass$b([
7869
7924
  customElement("cx-content-browser-asset-preview-video")
7870
7925
  ], CxContentBrowserAssetPreviewVideo);
7871
- const styles$9 = i$7`
7926
+ const styles$a = i$7`
7872
7927
  :host {
7873
7928
  display: block;
7874
7929
  position: relative;
@@ -8015,14 +8070,14 @@ const styles$9 = i$7`
8015
8070
  transition: none;
8016
8071
  }
8017
8072
  `;
8018
- var __defProp$9 = Object.defineProperty;
8019
- var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
8020
- var __decorateClass$9 = (decorators, target, key, kind) => {
8021
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
8073
+ var __defProp$a = Object.defineProperty;
8074
+ var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
8075
+ var __decorateClass$a = (decorators, target, key, kind) => {
8076
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
8022
8077
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
8023
8078
  if (decorator = decorators[i4])
8024
8079
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8025
- if (kind && result) __defProp$9(target, key, result);
8080
+ if (kind && result) __defProp$a(target, key, result);
8026
8081
  return result;
8027
8082
  };
8028
8083
  const GIF_EXTENSION = ".gif";
@@ -8187,53 +8242,53 @@ let CxContentBrowserAssetPreview = class extends CortexElement {
8187
8242
  `;
8188
8243
  }
8189
8244
  };
8190
- CxContentBrowserAssetPreview.styles = [componentStyles, styles$9];
8245
+ CxContentBrowserAssetPreview.styles = [componentStyles, styles$a];
8191
8246
  CxContentBrowserAssetPreview.dependencies = {
8192
8247
  "cx-content-browser-asset-preview-video": CxContentBrowserAssetPreviewVideo,
8193
8248
  "cx-icon": CxIcon,
8194
8249
  "cx-skeleton": CxSkeleton,
8195
8250
  "cx-typography": CxTypography
8196
8251
  };
8197
- __decorateClass$9([
8252
+ __decorateClass$a([
8198
8253
  e$7("cx-content-browser-asset-preview-video")
8199
8254
  ], CxContentBrowserAssetPreview.prototype, "previewVideo", 2);
8200
- __decorateClass$9([
8255
+ __decorateClass$a([
8201
8256
  n$6({ attribute: "image-url", reflect: true, type: String })
8202
8257
  ], CxContentBrowserAssetPreview.prototype, "imageUrl", 2);
8203
- __decorateClass$9([
8258
+ __decorateClass$a([
8204
8259
  n$6({ attribute: "original-url", reflect: true, type: String })
8205
8260
  ], CxContentBrowserAssetPreview.prototype, "originalUrl", 2);
8206
- __decorateClass$9([
8261
+ __decorateClass$a([
8207
8262
  n$6({ attribute: "preview-url", reflect: true, type: String })
8208
8263
  ], CxContentBrowserAssetPreview.prototype, "previewUrl", 2);
8209
- __decorateClass$9([
8264
+ __decorateClass$a([
8210
8265
  n$6({ attribute: "alt", reflect: true, type: String })
8211
8266
  ], CxContentBrowserAssetPreview.prototype, "alt", 2);
8212
- __decorateClass$9([
8267
+ __decorateClass$a([
8213
8268
  n$6({ attribute: "doc-type", reflect: true, type: String })
8214
8269
  ], CxContentBrowserAssetPreview.prototype, "docType", 2);
8215
- __decorateClass$9([
8270
+ __decorateClass$a([
8216
8271
  n$6({ attribute: "extension", reflect: true, type: String })
8217
8272
  ], CxContentBrowserAssetPreview.prototype, "extension", 2);
8218
- __decorateClass$9([
8273
+ __decorateClass$a([
8219
8274
  n$6({ attribute: "in-cold-storage", reflect: true, type: Boolean })
8220
8275
  ], CxContentBrowserAssetPreview.prototype, "inColdStorage", 2);
8221
- __decorateClass$9([
8276
+ __decorateClass$a([
8222
8277
  n$6({ attribute: "thumbnail-only", reflect: true, type: Boolean })
8223
8278
  ], CxContentBrowserAssetPreview.prototype, "thumbnailOnly", 2);
8224
- __decorateClass$9([
8279
+ __decorateClass$a([
8225
8280
  n$6({ attribute: "controls", reflect: true, type: Boolean })
8226
8281
  ], CxContentBrowserAssetPreview.prototype, "controls", 2);
8227
- __decorateClass$9([
8282
+ __decorateClass$a([
8228
8283
  r$6()
8229
8284
  ], CxContentBrowserAssetPreview.prototype, "isError", 2);
8230
- __decorateClass$9([
8285
+ __decorateClass$a([
8231
8286
  r$6()
8232
8287
  ], CxContentBrowserAssetPreview.prototype, "loaded", 2);
8233
- CxContentBrowserAssetPreview = __decorateClass$9([
8288
+ CxContentBrowserAssetPreview = __decorateClass$a([
8234
8289
  customElement("cx-content-browser-asset-preview")
8235
8290
  ], CxContentBrowserAssetPreview);
8236
- const styles$8 = i$7`
8291
+ const styles$9 = i$7`
8237
8292
  :host {
8238
8293
  display: block;
8239
8294
  padding: var(--cx-spacing-small);
@@ -8243,14 +8298,14 @@ const styles$8 = i$7`
8243
8298
  width: 100%;
8244
8299
  }
8245
8300
  `;
8246
- var __defProp$8 = Object.defineProperty;
8247
- var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
8248
- var __decorateClass$8 = (decorators, target, key, kind) => {
8249
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
8301
+ var __defProp$9 = Object.defineProperty;
8302
+ var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
8303
+ var __decorateClass$9 = (decorators, target, key, kind) => {
8304
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
8250
8305
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
8251
8306
  if (decorator = decorators[i4])
8252
8307
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8253
- if (kind && result) __defProp$8(target, key, result);
8308
+ if (kind && result) __defProp$9(target, key, result);
8254
8309
  return result;
8255
8310
  };
8256
8311
  let CxContentBrowserAssetTrackingParameters = class extends CortexElement {
@@ -8359,7 +8414,7 @@ let CxContentBrowserAssetTrackingParameters = class extends CortexElement {
8359
8414
  `;
8360
8415
  }
8361
8416
  };
8362
- CxContentBrowserAssetTrackingParameters.styles = [componentStyles, styles$8];
8417
+ CxContentBrowserAssetTrackingParameters.styles = [componentStyles, styles$9];
8363
8418
  CxContentBrowserAssetTrackingParameters.dependencies = {
8364
8419
  "cx-button": CxButton,
8365
8420
  "cx-icon": CxIcon,
@@ -8368,13 +8423,13 @@ CxContentBrowserAssetTrackingParameters.dependencies = {
8368
8423
  "cx-input-group": CxInputGroup,
8369
8424
  "cx-space": CxSpace
8370
8425
  };
8371
- __decorateClass$8([
8426
+ __decorateClass$9([
8372
8427
  n$6({ attribute: false, type: Array })
8373
8428
  ], CxContentBrowserAssetTrackingParameters.prototype, "values", 2);
8374
- CxContentBrowserAssetTrackingParameters = __decorateClass$8([
8429
+ CxContentBrowserAssetTrackingParameters = __decorateClass$9([
8375
8430
  customElement("cx-content-browser-asset-tracking-parameters")
8376
8431
  ], CxContentBrowserAssetTrackingParameters);
8377
- const styles$7 = i$7`
8432
+ const styles$8 = i$7`
8378
8433
  :host {
8379
8434
  display: block;
8380
8435
  }
@@ -8483,14 +8538,14 @@ const styles$7 = i$7`
8483
8538
  color: var(--cx-color-primary);
8484
8539
  }
8485
8540
  `;
8486
- var __defProp$7 = Object.defineProperty;
8487
- var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
8488
- var __decorateClass$7 = (decorators, target, key, kind) => {
8489
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
8541
+ var __defProp$8 = Object.defineProperty;
8542
+ var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
8543
+ var __decorateClass$8 = (decorators, target, key, kind) => {
8544
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
8490
8545
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
8491
8546
  if (decorator = decorators[i4])
8492
8547
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8493
- if (kind && result) __defProp$7(target, key, result);
8548
+ if (kind && result) __defProp$8(target, key, result);
8494
8549
  return result;
8495
8550
  };
8496
8551
  const USE_REPRESENTATIVE_VALUE = "use-representative";
@@ -8740,7 +8795,7 @@ let CxContentBrowserAssetProxySelector = class extends CortexElement {
8740
8795
  `;
8741
8796
  }
8742
8797
  };
8743
- CxContentBrowserAssetProxySelector.styles = [componentStyles, styles$7];
8798
+ CxContentBrowserAssetProxySelector.styles = [componentStyles, styles$8];
8744
8799
  CxContentBrowserAssetProxySelector.dependencies = {
8745
8800
  "cx-content-browser-asset-tracking-parameters": CxContentBrowserAssetTrackingParameters,
8746
8801
  "cx-icon": CxIcon,
@@ -8750,46 +8805,46 @@ CxContentBrowserAssetProxySelector.dependencies = {
8750
8805
  "cx-switch": CxSwitch,
8751
8806
  "cx-typography": CxTypography
8752
8807
  };
8753
- __decorateClass$7([
8808
+ __decorateClass$8([
8754
8809
  n$6({ reflect: false, type: Array })
8755
8810
  ], CxContentBrowserAssetProxySelector.prototype, "items", 2);
8756
- __decorateClass$7([
8811
+ __decorateClass$8([
8757
8812
  n$6({ attribute: "can-custom-format", reflect: true, type: Boolean })
8758
8813
  ], CxContentBrowserAssetProxySelector.prototype, "canCustomFormat", 2);
8759
- __decorateClass$7([
8814
+ __decorateClass$8([
8760
8815
  n$6({ attribute: "can-use-representative", reflect: true, type: Boolean })
8761
8816
  ], CxContentBrowserAssetProxySelector.prototype, "canUseRepresentative", 2);
8762
- __decorateClass$7([
8817
+ __decorateClass$8([
8763
8818
  n$6({ attribute: "can-use-ats", reflect: true, type: Boolean })
8764
8819
  ], CxContentBrowserAssetProxySelector.prototype, "canUseATS", 2);
8765
- __decorateClass$7([
8820
+ __decorateClass$8([
8766
8821
  n$6({ attribute: "can-use-tracking", reflect: true, type: Boolean })
8767
8822
  ], CxContentBrowserAssetProxySelector.prototype, "canUseTracking", 2);
8768
- __decorateClass$7([
8823
+ __decorateClass$8([
8769
8824
  n$6({ attribute: "selected", reflect: true, type: String })
8770
8825
  ], CxContentBrowserAssetProxySelector.prototype, "selected", 2);
8771
- __decorateClass$7([
8826
+ __decorateClass$8([
8772
8827
  n$6({ attribute: "disabled-selected", reflect: true, type: Boolean })
8773
8828
  ], CxContentBrowserAssetProxySelector.prototype, "disabledSelected", 2);
8774
- __decorateClass$7([
8829
+ __decorateClass$8([
8775
8830
  n$6({ attribute: "custom-width", reflect: true, type: String })
8776
8831
  ], CxContentBrowserAssetProxySelector.prototype, "customWidth", 2);
8777
- __decorateClass$7([
8832
+ __decorateClass$8([
8778
8833
  n$6({ attribute: "custom-height", reflect: true, type: String })
8779
8834
  ], CxContentBrowserAssetProxySelector.prototype, "customHeight", 2);
8780
- __decorateClass$7([
8835
+ __decorateClass$8([
8781
8836
  n$6({ attribute: "custom-extension", reflect: true, type: String })
8782
8837
  ], CxContentBrowserAssetProxySelector.prototype, "customExtension", 2);
8783
- __decorateClass$7([
8838
+ __decorateClass$8([
8784
8839
  n$6({ attribute: "enabled-tracking", reflect: true, type: Boolean })
8785
8840
  ], CxContentBrowserAssetProxySelector.prototype, "enabledTracking", 2);
8786
- __decorateClass$7([
8841
+ __decorateClass$8([
8787
8842
  n$6({ attribute: "tracking-parameters", reflect: false, type: Array })
8788
8843
  ], CxContentBrowserAssetProxySelector.prototype, "trackingParameters", 2);
8789
- CxContentBrowserAssetProxySelector = __decorateClass$7([
8844
+ CxContentBrowserAssetProxySelector = __decorateClass$8([
8790
8845
  customElement("cx-content-browser-asset-proxy-selector")
8791
8846
  ], CxContentBrowserAssetProxySelector);
8792
- const styles$6 = i$7`
8847
+ const styles$7 = i$7`
8793
8848
  :host {
8794
8849
  display: block;
8795
8850
  width: 100%;
@@ -8862,14 +8917,14 @@ const styles$6 = i$7`
8862
8917
  font-size: var(--cx-font-size-3x-large);
8863
8918
  }
8864
8919
  `;
8865
- var __defProp$6 = Object.defineProperty;
8866
- var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
8867
- var __decorateClass$6 = (decorators, target, key, kind) => {
8868
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
8920
+ var __defProp$7 = Object.defineProperty;
8921
+ var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
8922
+ var __decorateClass$7 = (decorators, target, key, kind) => {
8923
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
8869
8924
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
8870
8925
  if (decorator = decorators[i4])
8871
8926
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8872
- if (kind && result) __defProp$6(target, key, result);
8927
+ if (kind && result) __defProp$7(target, key, result);
8873
8928
  return result;
8874
8929
  };
8875
8930
  let CxContentBrowserAssetVersionHistory = class extends CortexElement {
@@ -8941,7 +8996,7 @@ let CxContentBrowserAssetVersionHistory = class extends CortexElement {
8941
8996
  `;
8942
8997
  }
8943
8998
  };
8944
- CxContentBrowserAssetVersionHistory.styles = [componentStyles, styles$6];
8999
+ CxContentBrowserAssetVersionHistory.styles = [componentStyles, styles$7];
8945
9000
  CxContentBrowserAssetVersionHistory.dependencies = {
8946
9001
  "cx-grid": CxGrid,
8947
9002
  "cx-grid-item": CxGridItem,
@@ -8953,13 +9008,13 @@ CxContentBrowserAssetVersionHistory.dependencies = {
8953
9008
  "cx-typography": CxTypography,
8954
9009
  "cx-content-browser-asset-preview": CxContentBrowserAssetPreview
8955
9010
  };
8956
- __decorateClass$6([
9011
+ __decorateClass$7([
8957
9012
  n$6({ reflect: false, type: Array })
8958
9013
  ], CxContentBrowserAssetVersionHistory.prototype, "versions", 2);
8959
- __decorateClass$6([
9014
+ __decorateClass$7([
8960
9015
  n$6({ reflect: true, type: Boolean })
8961
9016
  ], CxContentBrowserAssetVersionHistory.prototype, "loading", 2);
8962
- CxContentBrowserAssetVersionHistory = __decorateClass$6([
9017
+ CxContentBrowserAssetVersionHistory = __decorateClass$7([
8963
9018
  customElement("cx-content-browser-asset-version-history")
8964
9019
  ], CxContentBrowserAssetVersionHistory);
8965
9020
  const dialogStyles = i$7`
@@ -9010,7 +9065,7 @@ const drawerStyles = i$7`
9010
9065
  padding: var(--cx-spacing-medium);
9011
9066
  }
9012
9067
  `;
9013
- const styles$5 = i$7`
9068
+ const styles$6 = i$7`
9014
9069
  :host {
9015
9070
  display: block;
9016
9071
  }
@@ -9050,14 +9105,14 @@ const styles$5 = i$7`
9050
9105
  width: 100%;
9051
9106
  }
9052
9107
  `;
9053
- var __defProp$5 = Object.defineProperty;
9054
- var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
9055
- var __decorateClass$5 = (decorators, target, key, kind) => {
9056
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
9108
+ var __defProp$6 = Object.defineProperty;
9109
+ var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
9110
+ var __decorateClass$6 = (decorators, target, key, kind) => {
9111
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
9057
9112
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
9058
9113
  if (decorator = decorators[i4])
9059
9114
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9060
- if (kind && result) __defProp$5(target, key, result);
9115
+ if (kind && result) __defProp$6(target, key, result);
9061
9116
  return result;
9062
9117
  };
9063
9118
  const DEFAULT_TRACKING_PARAMETERS = [{
@@ -9099,6 +9154,7 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9099
9154
  this.canPinAsset = false;
9100
9155
  this.canTrack = false;
9101
9156
  this.canUseProxies = false;
9157
+ this.autoSelectFormat = false;
9102
9158
  this.simplePick = false;
9103
9159
  this.canViewVersions = false;
9104
9160
  this.variant = ContentBrowserFormatDialogVariant.Dialog;
@@ -9139,33 +9195,100 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9139
9195
  ], "value") : [{ displayName: this.localize.term("automatic"), value: this.autoExtension }]).filter((item) => this.shouldAppendAutoExtension || item.value !== this.autoExtension);
9140
9196
  return this.canCustomFormat && extensionList.some((item) => item.value === this.asset.extension);
9141
9197
  }
9142
- handleSupportedExtensionsChange() {
9143
- var _a2, _b2;
9144
- this.filteredProxies = this.proxies.filter((item) => {
9145
- var _a3, _b3, _c2;
9146
- const assetExtension = (_c2 = (_b3 = (_a3 = this.asset) == null ? void 0 : _a3.extension) == null ? void 0 : _b3.replace(/^\./, "")) != null ? _c2 : "";
9198
+ filterProxies(proxies) {
9199
+ return proxies.filter((item) => {
9200
+ var _a2, _b2, _c2;
9201
+ const assetExtension = (_c2 = (_b2 = (_a2 = this.asset) == null ? void 0 : _a2.extension) == null ? void 0 : _b2.replace(/^\./, "")) != null ? _c2 : "";
9147
9202
  if (!item.extension && this.asset && assetExtension) {
9148
9203
  return this.supportedExtensions.includes(assetExtension);
9149
9204
  }
9150
9205
  return true;
9151
9206
  });
9207
+ }
9208
+ handleSupportedExtensionsChange() {
9209
+ var _a2, _b2;
9210
+ this.filteredProxies = this.filterProxies(this.proxies);
9152
9211
  this.selectedProxy = (_b2 = (_a2 = this.filteredProxies[0]) == null ? void 0 : _a2.id) != null ? _b2 : "";
9153
9212
  }
9213
+ /**
9214
+ * What `autoSelectFormat` resolves to for this asset: the proxy to insert with, or `undefined`
9215
+ * when the dialog should open as usual.
9216
+ *
9217
+ * `{ proxy: undefined }` is deliberate rather than a miss — with the picker switched off there is
9218
+ * no format to name and the original file is the only outcome, which is `handleProxyConfirm`'s
9219
+ * no-proxy branch. With the picker on a proxy must actually resolve: confirming none emits
9220
+ * nothing and would turn the click into a silent no-op, so both an empty proxy list and a format
9221
+ * name that matches nothing fall back to the dialog.
9222
+ */
9223
+ resolveAutoSelection() {
9224
+ const requested = this.autoSelectFormat;
9225
+ if (!isAutoSelectFormatActive(requested)) {
9226
+ return void 0;
9227
+ }
9228
+ if (!this.canUseProxies) {
9229
+ return { proxy: void 0 };
9230
+ }
9231
+ if (requested === true) {
9232
+ const [first] = this.filteredProxies;
9233
+ return first ? { proxy: first } : void 0;
9234
+ }
9235
+ const wanted = String(requested).trim().toLowerCase();
9236
+ const match = this.filteredProxies.find((proxy) => {
9237
+ var _a2, _b2;
9238
+ return ((_a2 = proxy.proxyName) == null ? void 0 : _a2.toLowerCase()) === wanted || ((_b2 = proxy.proxyLabel) == null ? void 0 : _b2.toLowerCase()) === wanted;
9239
+ });
9240
+ return match ? { proxy: match } : void 0;
9241
+ }
9154
9242
  open({
9155
9243
  asset,
9156
9244
  isFavorite,
9157
9245
  isAssetPinned = false,
9158
9246
  proxies
9159
9247
  }) {
9248
+ var _a2, _b2;
9160
9249
  this.asset = asset;
9161
9250
  this.isFavorite = isFavorite;
9162
9251
  this.isAssetPinned = isAssetPinned;
9163
9252
  this.proxies = proxies;
9253
+ this.filteredProxies = this.filterProxies(this.proxies);
9254
+ this.selectedProxy = (_b2 = (_a2 = this.filteredProxies[0]) == null ? void 0 : _a2.id) != null ? _b2 : "";
9255
+ const autoSelection = this.disabledConfirm ? void 0 : this.resolveAutoSelection();
9256
+ if (autoSelection) {
9257
+ if (autoSelection.proxy) {
9258
+ this.selectedProxy = autoSelection.proxy.id;
9259
+ }
9260
+ if (!this.loadingConfirm) {
9261
+ this.handleProxyConfirm();
9262
+ }
9263
+ return;
9264
+ }
9265
+ this.loadingConfirm = false;
9164
9266
  this.isOpen = true;
9165
9267
  }
9166
9268
  hide() {
9167
9269
  this.handleClose();
9168
9270
  }
9271
+ /**
9272
+ * Show a dialog that `open()` skipped through the auto-confirm shortcut. The asset, proxies and
9273
+ * resolved selection are still in place, so this lands the user on exactly the dialog the
9274
+ * shortcut spared them, with its confirm button live again to retry.
9275
+ */
9276
+ revealAfterAutoConfirm() {
9277
+ if (!this.asset) {
9278
+ this.handleClose();
9279
+ return;
9280
+ }
9281
+ const autoSelection = this.resolveAutoSelection();
9282
+ if (autoSelection == null ? void 0 : autoSelection.proxy) {
9283
+ this.selectedProxy = autoSelection.proxy.id;
9284
+ }
9285
+ this.loadingConfirm = false;
9286
+ this.isOpen = true;
9287
+ }
9288
+ /** Whether the dialog is actually on screen — false when `open()` took the auto-confirm path. */
9289
+ get isDialogOpen() {
9290
+ return this.isOpen;
9291
+ }
9169
9292
  setVersionHistory(versions) {
9170
9293
  this.versions = versions;
9171
9294
  this.loadingVersionHistory = false;
@@ -9649,7 +9772,7 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9649
9772
  <cx-button
9650
9773
  class="content-browser-format__footer__button"
9651
9774
  variant="primary"
9652
- ?loading=${this.loadingProxies}
9775
+ ?loading=${this.loadingConfirm || this.loadingProxies}
9653
9776
  @click=${this.handleProxyConfirm}
9654
9777
  >
9655
9778
  <cx-icon slot="prefix" name="folder"></cx-icon>
@@ -9714,7 +9837,7 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9714
9837
  `;
9715
9838
  }
9716
9839
  handleRequestClose(event) {
9717
- if (this.loadingFavorites || this.loadingPinAsset) {
9840
+ if (this.loadingConfirm || this.loadingFavorites || this.loadingPinAsset) {
9718
9841
  event.preventDefault();
9719
9842
  return;
9720
9843
  }
@@ -9775,7 +9898,7 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9775
9898
  `;
9776
9899
  }
9777
9900
  };
9778
- CxContentBrowserFormatDialog.styles = [componentStyles, styles$5];
9901
+ CxContentBrowserFormatDialog.styles = [componentStyles, styles$6];
9779
9902
  CxContentBrowserFormatDialog.dependencies = {
9780
9903
  "cx-asset-link-format": CxAssetLinkFormat,
9781
9904
  "cx-cropper": CxCropper,
@@ -9791,16 +9914,16 @@ CxContentBrowserFormatDialog.dependencies = {
9791
9914
  "cx-tooltip": CxTooltip,
9792
9915
  "cx-typography": CxTypography
9793
9916
  };
9794
- __decorateClass$5([
9917
+ __decorateClass$6([
9795
9918
  e$7("cx-asset-link-format")
9796
9919
  ], CxContentBrowserFormatDialog.prototype, "assetLinkFormat", 2);
9797
- __decorateClass$5([
9920
+ __decorateClass$6([
9798
9921
  n$6({ reflect: false, type: Object })
9799
9922
  ], CxContentBrowserFormatDialog.prototype, "boundary", 2);
9800
- __decorateClass$5([
9923
+ __decorateClass$6([
9801
9924
  n$6({ attribute: false, reflect: false, type: Object })
9802
9925
  ], CxContentBrowserFormatDialog.prototype, "availableExtensions", 2);
9803
- __decorateClass$5([
9926
+ __decorateClass$6([
9804
9927
  n$6({
9805
9928
  attribute: "supported-extensions",
9806
9929
  converter: {
@@ -9811,7 +9934,7 @@ __decorateClass$5([
9811
9934
  type: Array
9812
9935
  })
9813
9936
  ], CxContentBrowserFormatDialog.prototype, "supportedExtensions", 2);
9814
- __decorateClass$5([
9937
+ __decorateClass$6([
9815
9938
  n$6({
9816
9939
  attribute: "supported-representative-subtypes",
9817
9940
  converter: {
@@ -9822,113 +9945,116 @@ __decorateClass$5([
9822
9945
  type: Array
9823
9946
  })
9824
9947
  ], CxContentBrowserFormatDialog.prototype, "supportedRepresentativeSubtypes", 2);
9825
- __decorateClass$5([
9948
+ __decorateClass$6([
9826
9949
  n$6({ attribute: "auto-extension", reflect: false, type: String })
9827
9950
  ], CxContentBrowserFormatDialog.prototype, "autoExtension", 2);
9828
- __decorateClass$5([
9951
+ __decorateClass$6([
9829
9952
  n$6({ attribute: "cta-text", reflect: false, type: String })
9830
9953
  ], CxContentBrowserFormatDialog.prototype, "ctaText", 2);
9831
- __decorateClass$5([
9954
+ __decorateClass$6([
9832
9955
  n$6({ attribute: "cta-text-transform", reflect: false, type: String })
9833
9956
  ], CxContentBrowserFormatDialog.prototype, "ctaTextTransform", 2);
9834
- __decorateClass$5([
9957
+ __decorateClass$6([
9835
9958
  n$6({ attribute: "can-custom-format", reflect: false, type: Boolean })
9836
9959
  ], CxContentBrowserFormatDialog.prototype, "canCustomFormat", 2);
9837
- __decorateClass$5([
9960
+ __decorateClass$6([
9838
9961
  n$6({ attribute: "can-favorite", reflect: false, type: Boolean })
9839
9962
  ], CxContentBrowserFormatDialog.prototype, "canFavorite", 2);
9840
- __decorateClass$5([
9963
+ __decorateClass$6([
9841
9964
  n$6({ attribute: "can-pin-asset", reflect: false, type: Boolean })
9842
9965
  ], CxContentBrowserFormatDialog.prototype, "canPinAsset", 2);
9843
- __decorateClass$5([
9966
+ __decorateClass$6([
9844
9967
  n$6({ attribute: "can-track", reflect: false, type: Boolean })
9845
9968
  ], CxContentBrowserFormatDialog.prototype, "canTrack", 2);
9846
- __decorateClass$5([
9969
+ __decorateClass$6([
9847
9970
  n$6({ attribute: "can-use-proxies", reflect: false, type: Boolean })
9848
9971
  ], CxContentBrowserFormatDialog.prototype, "canUseProxies", 2);
9849
- __decorateClass$5([
9972
+ __decorateClass$6([
9973
+ n$6({ attribute: "auto-select-format", converter: autoSelectFormatConverter, reflect: false })
9974
+ ], CxContentBrowserFormatDialog.prototype, "autoSelectFormat", 2);
9975
+ __decorateClass$6([
9850
9976
  n$6({ attribute: "simple-pick", reflect: false, type: Boolean })
9851
9977
  ], CxContentBrowserFormatDialog.prototype, "simplePick", 2);
9852
- __decorateClass$5([
9978
+ __decorateClass$6([
9853
9979
  n$6({ attribute: "can-view-versions", reflect: false, type: Boolean })
9854
9980
  ], CxContentBrowserFormatDialog.prototype, "canViewVersions", 2);
9855
- __decorateClass$5([
9981
+ __decorateClass$6([
9856
9982
  n$6({ reflect: true, type: String })
9857
9983
  ], CxContentBrowserFormatDialog.prototype, "variant", 2);
9858
- __decorateClass$5([
9984
+ __decorateClass$6([
9859
9985
  n$6({ attribute: "loading-favorites", reflect: true, type: Boolean })
9860
9986
  ], CxContentBrowserFormatDialog.prototype, "loadingFavorites", 2);
9861
- __decorateClass$5([
9987
+ __decorateClass$6([
9862
9988
  n$6({ attribute: "loading-pin-asset", reflect: true, type: Boolean })
9863
9989
  ], CxContentBrowserFormatDialog.prototype, "loadingPinAsset", 2);
9864
- __decorateClass$5([
9990
+ __decorateClass$6([
9865
9991
  n$6({ attribute: "loading-proxies", reflect: true, type: Boolean })
9866
9992
  ], CxContentBrowserFormatDialog.prototype, "loadingProxies", 2);
9867
- __decorateClass$5([
9993
+ __decorateClass$6([
9868
9994
  n$6({ attribute: "disabled-confirm", reflect: true, type: Boolean })
9869
9995
  ], CxContentBrowserFormatDialog.prototype, "disabledConfirm", 2);
9870
- __decorateClass$5([
9996
+ __decorateClass$6([
9871
9997
  n$6({ attribute: "token", type: String })
9872
9998
  ], CxContentBrowserFormatDialog.prototype, "token", 2);
9873
- __decorateClass$5([
9999
+ __decorateClass$6([
9874
10000
  n$6({ attribute: "base-url", type: String })
9875
10001
  ], CxContentBrowserFormatDialog.prototype, "baseUrl", 2);
9876
- __decorateClass$5([
10002
+ __decorateClass$6([
9877
10003
  r$6()
9878
10004
  ], CxContentBrowserFormatDialog.prototype, "asset", 2);
9879
- __decorateClass$5([
10005
+ __decorateClass$6([
9880
10006
  r$6()
9881
10007
  ], CxContentBrowserFormatDialog.prototype, "isOpen", 2);
9882
- __decorateClass$5([
10008
+ __decorateClass$6([
9883
10009
  r$6()
9884
10010
  ], CxContentBrowserFormatDialog.prototype, "isFavorite", 2);
9885
- __decorateClass$5([
10011
+ __decorateClass$6([
9886
10012
  r$6()
9887
10013
  ], CxContentBrowserFormatDialog.prototype, "isAssetPinned", 2);
9888
- __decorateClass$5([
10014
+ __decorateClass$6([
9889
10015
  r$6()
9890
10016
  ], CxContentBrowserFormatDialog.prototype, "proxies", 2);
9891
- __decorateClass$5([
10017
+ __decorateClass$6([
9892
10018
  r$6()
9893
10019
  ], CxContentBrowserFormatDialog.prototype, "showVersionHistory", 2);
9894
- __decorateClass$5([
10020
+ __decorateClass$6([
9895
10021
  r$6()
9896
10022
  ], CxContentBrowserFormatDialog.prototype, "showCustomFormat", 2);
9897
- __decorateClass$5([
10023
+ __decorateClass$6([
9898
10024
  r$6()
9899
10025
  ], CxContentBrowserFormatDialog.prototype, "loadingVersionHistory", 2);
9900
- __decorateClass$5([
10026
+ __decorateClass$6([
9901
10027
  r$6()
9902
10028
  ], CxContentBrowserFormatDialog.prototype, "versions", 2);
9903
- __decorateClass$5([
10029
+ __decorateClass$6([
9904
10030
  r$6()
9905
10031
  ], CxContentBrowserFormatDialog.prototype, "filteredProxies", 2);
9906
- __decorateClass$5([
10032
+ __decorateClass$6([
9907
10033
  r$6()
9908
10034
  ], CxContentBrowserFormatDialog.prototype, "selectedProxy", 2);
9909
- __decorateClass$5([
10035
+ __decorateClass$6([
9910
10036
  r$6()
9911
10037
  ], CxContentBrowserFormatDialog.prototype, "lastProxyBeforeCustomFormat", 2);
9912
- __decorateClass$5([
10038
+ __decorateClass$6([
9913
10039
  r$6()
9914
10040
  ], CxContentBrowserFormatDialog.prototype, "confirmedTransformations", 2);
9915
- __decorateClass$5([
10041
+ __decorateClass$6([
9916
10042
  r$6()
9917
10043
  ], CxContentBrowserFormatDialog.prototype, "confirmedFormat", 2);
9918
- __decorateClass$5([
10044
+ __decorateClass$6([
9919
10045
  r$6()
9920
10046
  ], CxContentBrowserFormatDialog.prototype, "loadingConfirm", 2);
9921
- __decorateClass$5([
10047
+ __decorateClass$6([
9922
10048
  r$6()
9923
10049
  ], CxContentBrowserFormatDialog.prototype, "enabledTracking", 2);
9924
- __decorateClass$5([
10050
+ __decorateClass$6([
9925
10051
  r$6()
9926
10052
  ], CxContentBrowserFormatDialog.prototype, "trackingParameters", 2);
9927
- __decorateClass$5([
10053
+ __decorateClass$6([
9928
10054
  watch("proxies", { waitUntilFirstUpdate: true }),
9929
10055
  watch("supportedExtensions")
9930
10056
  ], CxContentBrowserFormatDialog.prototype, "handleSupportedExtensionsChange", 1);
9931
- CxContentBrowserFormatDialog = __decorateClass$5([
10057
+ CxContentBrowserFormatDialog = __decorateClass$6([
9932
10058
  customElement("cx-content-browser-format-dialog")
9933
10059
  ], CxContentBrowserFormatDialog);
9934
10060
  function __decorate(decorators, target, key, desc) {
@@ -11727,7 +11853,7 @@ class GridLayout extends GridBaseLayout {
11727
11853
  this._scrollSize = size;
11728
11854
  }
11729
11855
  }
11730
- const styles$4 = i$7`
11856
+ const styles$5 = i$7`
11731
11857
  :host {
11732
11858
  display: block;
11733
11859
  }
@@ -11766,6 +11892,50 @@ const styles$4 = i$7`
11766
11892
  line-height: var(--cx-line-height-small);
11767
11893
  }
11768
11894
 
11895
+ /*
11896
+ * Affordance only, never a second control: pointer-events stay off so the click lands on the card
11897
+ * beneath and takes the one path a card click already takes, and the button is aria-hidden and
11898
+ * untabbable so the card is still the single thing announced and focused.
11899
+ */
11900
+ .content-browser-asset-card__cta {
11901
+ /*
11902
+ * Positioned against the card's base, not the image slot, so the image box has to be described
11903
+ * here: inset by the card's own padding and given the same aspect-ratio ::part(image) carries,
11904
+ * which lands it exactly on the thumbnail. Without this it covers the title row too and centres
11905
+ * the button on the card rather than on the image. Keep the ratio in step with ::part(image).
11906
+ */
11907
+ position: absolute;
11908
+ inset: var(--cx-spacing-x-small);
11909
+ bottom: auto;
11910
+ aspect-ratio: 246 / 180;
11911
+ /*
11912
+ * The image slot's overflow clip does not reach an overlay positioned against the base, so the
11913
+ * rounding is restated. Inherited, not a token: the overlay is slotted into that image slot, so
11914
+ * it takes whatever radius the thumbnail is clipped to, overrides of ::part(image) included.
11915
+ */
11916
+ border-radius: inherit;
11917
+ z-index: 1;
11918
+ display: flex;
11919
+ align-items: center;
11920
+ justify-content: center;
11921
+ background-color: rgb(0 0 0 / 35%);
11922
+ opacity: 0;
11923
+ pointer-events: none;
11924
+ transition: opacity 150ms ease;
11925
+ }
11926
+
11927
+ .content-browser-asset-card:hover .content-browser-asset-card__cta,
11928
+ .content-browser-asset-card:focus-within .content-browser-asset-card__cta,
11929
+ .content-browser-asset-card__cta--busy {
11930
+ opacity: 1;
11931
+ }
11932
+
11933
+ @media (prefers-reduced-motion: reduce) {
11934
+ .content-browser-asset-card__cta {
11935
+ transition: none;
11936
+ }
11937
+ }
11938
+
11769
11939
  .content-browser-asset-card__checkbox {
11770
11940
  position: absolute;
11771
11941
  top: 2px;
@@ -11778,19 +11948,24 @@ const styles$4 = i$7`
11778
11948
  pointer-events: none;
11779
11949
  }
11780
11950
  `;
11781
- var __defProp$4 = Object.defineProperty;
11782
- var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
11783
- var __decorateClass$4 = (decorators, target, key, kind) => {
11784
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
11951
+ var __defProp$5 = Object.defineProperty;
11952
+ var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
11953
+ var __decorateClass$5 = (decorators, target, key, kind) => {
11954
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
11785
11955
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
11786
11956
  if (decorator = decorators[i4])
11787
11957
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11788
- if (kind && result) __defProp$4(target, key, result);
11958
+ if (kind && result) __defProp$5(target, key, result);
11789
11959
  return result;
11790
11960
  };
11791
11961
  let CxContentBrowserAssetCard = class extends CortexElement {
11792
11962
  constructor() {
11793
11963
  super(...arguments);
11964
+ this.localize = new LocalizeController(this);
11965
+ this.showCta = false;
11966
+ this.ctaText = "";
11967
+ this.ctaTextTransform = "capitalize";
11968
+ this.busy = false;
11794
11969
  this.imageUrl = "";
11795
11970
  this.originalUrl = "";
11796
11971
  this.scrubUrl = "";
@@ -11857,6 +12032,26 @@ let CxContentBrowserAssetCard = class extends CortexElement {
11857
12032
  ?thumbnail-only=${this.view === "small"}
11858
12033
  ?in-cold-storage=${this.inColdStorage}
11859
12034
  ></cx-content-browser-asset-preview>
12035
+ ${n$5(
12036
+ this.showCta && !this.inColdStorage,
12037
+ () => b`
12038
+ <div
12039
+ slot="image"
12040
+ class=${e$5({
12041
+ "content-browser-asset-card__cta": true,
12042
+ "content-browser-asset-card__cta--busy": this.busy
12043
+ })}
12044
+ aria-hidden="true"
12045
+ >
12046
+ <cx-button size="small" variant="primary" tabindex="-1" ?loading=${this.busy}>
12047
+ <span style=${o$1({ textTransform: this.ctaTextTransform })}>
12048
+ ${this.ctaText || this.localize.term("insert")}
12049
+ </span>
12050
+ </cx-button>
12051
+ </div>
12052
+ `,
12053
+ () => A
12054
+ )}
11860
12055
  <cx-space spacing="small" align-items="center" wrap="nowrap" class="content-browser-asset-card__info">
11861
12056
  ${n$5(
11862
12057
  this.showTitle && this.assetName,
@@ -11967,9 +12162,10 @@ let CxContentBrowserAssetCard = class extends CortexElement {
11967
12162
  `;
11968
12163
  }
11969
12164
  };
11970
- CxContentBrowserAssetCard.styles = [componentStyles, styles$4];
12165
+ CxContentBrowserAssetCard.styles = [componentStyles, styles$5];
11971
12166
  CxContentBrowserAssetCard.dependencies = {
11972
12167
  "cx-array-line-clamp": CxArrayLineClamp,
12168
+ "cx-button": CxButton,
11973
12169
  "cx-card": CxCard,
11974
12170
  "cx-checkbox": CxCheckbox,
11975
12171
  "cx-content-browser-asset-preview": CxContentBrowserAssetPreview,
@@ -11978,46 +12174,58 @@ CxContentBrowserAssetCard.dependencies = {
11978
12174
  "cx-tag": CxTag,
11979
12175
  "cx-typography": CxTypography
11980
12176
  };
11981
- __decorateClass$4([
12177
+ __decorateClass$5([
12178
+ n$6({ attribute: "show-cta", reflect: true, type: Boolean })
12179
+ ], CxContentBrowserAssetCard.prototype, "showCta", 2);
12180
+ __decorateClass$5([
12181
+ n$6({ attribute: "cta-text", reflect: false, type: String })
12182
+ ], CxContentBrowserAssetCard.prototype, "ctaText", 2);
12183
+ __decorateClass$5([
12184
+ n$6({ attribute: "cta-text-transform", reflect: false, type: String })
12185
+ ], CxContentBrowserAssetCard.prototype, "ctaTextTransform", 2);
12186
+ __decorateClass$5([
12187
+ n$6({ attribute: "busy", reflect: true, type: Boolean })
12188
+ ], CxContentBrowserAssetCard.prototype, "busy", 2);
12189
+ __decorateClass$5([
11982
12190
  n$6({ attribute: "image-url", reflect: true, type: String })
11983
12191
  ], CxContentBrowserAssetCard.prototype, "imageUrl", 2);
11984
- __decorateClass$4([
12192
+ __decorateClass$5([
11985
12193
  n$6({ attribute: "original-url", reflect: true, type: String })
11986
12194
  ], CxContentBrowserAssetCard.prototype, "originalUrl", 2);
11987
- __decorateClass$4([
12195
+ __decorateClass$5([
11988
12196
  n$6({ attribute: "scrub-url", reflect: true, type: String })
11989
12197
  ], CxContentBrowserAssetCard.prototype, "scrubUrl", 2);
11990
- __decorateClass$4([
12198
+ __decorateClass$5([
11991
12199
  n$6({ attribute: "asset-id", reflect: true, type: String })
11992
12200
  ], CxContentBrowserAssetCard.prototype, "assetId", 2);
11993
- __decorateClass$4([
12201
+ __decorateClass$5([
11994
12202
  n$6({ attribute: "asset-name", reflect: true, type: String })
11995
12203
  ], CxContentBrowserAssetCard.prototype, "assetName", 2);
11996
- __decorateClass$4([
12204
+ __decorateClass$5([
11997
12205
  n$6({ attribute: "asset-width", reflect: true, type: String })
11998
12206
  ], CxContentBrowserAssetCard.prototype, "assetWidth", 2);
11999
- __decorateClass$4([
12207
+ __decorateClass$5([
12000
12208
  n$6({ attribute: "asset-height", reflect: true, type: String })
12001
12209
  ], CxContentBrowserAssetCard.prototype, "assetHeight", 2);
12002
- __decorateClass$4([
12210
+ __decorateClass$5([
12003
12211
  n$6({ attribute: "asset-size", reflect: true, type: String })
12004
12212
  ], CxContentBrowserAssetCard.prototype, "assetSize", 2);
12005
- __decorateClass$4([
12213
+ __decorateClass$5([
12006
12214
  n$6({ attribute: "extension", reflect: true, type: String })
12007
12215
  ], CxContentBrowserAssetCard.prototype, "extension", 2);
12008
- __decorateClass$4([
12216
+ __decorateClass$5([
12009
12217
  n$6({ attribute: "in-cold-storage", reflect: true, type: Boolean })
12010
12218
  ], CxContentBrowserAssetCard.prototype, "inColdStorage", 2);
12011
- __decorateClass$4([
12219
+ __decorateClass$5([
12012
12220
  n$6({ attribute: "doc-type", reflect: true, type: String })
12013
12221
  ], CxContentBrowserAssetCard.prototype, "docType", 2);
12014
- __decorateClass$4([
12222
+ __decorateClass$5([
12015
12223
  n$6({ attribute: "view", reflect: true, type: String })
12016
12224
  ], CxContentBrowserAssetCard.prototype, "view", 2);
12017
- __decorateClass$4([
12225
+ __decorateClass$5([
12018
12226
  n$6({ attribute: "selected", reflect: true, type: Boolean })
12019
12227
  ], CxContentBrowserAssetCard.prototype, "selected", 2);
12020
- __decorateClass$4([
12228
+ __decorateClass$5([
12021
12229
  n$6({
12022
12230
  converter: {
12023
12231
  fromAttribute: (value) => value ? value.split(",").map((tag) => tag.trim()).filter(Boolean) : [],
@@ -12032,25 +12240,25 @@ __decorateClass$4([
12032
12240
  type: String
12033
12241
  })
12034
12242
  ], CxContentBrowserAssetCard.prototype, "tags", 2);
12035
- __decorateClass$4([
12243
+ __decorateClass$5([
12036
12244
  n$6({ attribute: "show-tags", reflect: true, type: Boolean })
12037
12245
  ], CxContentBrowserAssetCard.prototype, "showTags", 2);
12038
- __decorateClass$4([
12246
+ __decorateClass$5([
12039
12247
  n$6({ attribute: "show-title", reflect: true, type: Boolean })
12040
12248
  ], CxContentBrowserAssetCard.prototype, "showTitle", 2);
12041
- __decorateClass$4([
12249
+ __decorateClass$5([
12042
12250
  n$6({ attribute: "show-size", reflect: true, type: Boolean })
12043
12251
  ], CxContentBrowserAssetCard.prototype, "showSize", 2);
12044
- __decorateClass$4([
12252
+ __decorateClass$5([
12045
12253
  n$6({ attribute: "show-dimensions", reflect: true, type: Boolean })
12046
12254
  ], CxContentBrowserAssetCard.prototype, "showDimensions", 2);
12047
- __decorateClass$4([
12255
+ __decorateClass$5([
12048
12256
  e$7("cx-content-browser-asset-preview")
12049
12257
  ], CxContentBrowserAssetCard.prototype, "preview", 2);
12050
- CxContentBrowserAssetCard = __decorateClass$4([
12258
+ CxContentBrowserAssetCard = __decorateClass$5([
12051
12259
  customElement("cx-content-browser-asset-card")
12052
12260
  ], CxContentBrowserAssetCard);
12053
- const styles$3 = i$7`
12261
+ const styles$4 = i$7`
12054
12262
  :host {
12055
12263
  display: flex;
12056
12264
  align-items: center;
@@ -12075,14 +12283,14 @@ const styles$3 = i$7`
12075
12283
  font-size: 96px;
12076
12284
  }
12077
12285
  `;
12078
- var __defProp$3 = Object.defineProperty;
12079
- var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
12080
- var __decorateClass$3 = (decorators, target, key, kind) => {
12081
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
12286
+ var __defProp$4 = Object.defineProperty;
12287
+ var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
12288
+ var __decorateClass$4 = (decorators, target, key, kind) => {
12289
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
12082
12290
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
12083
12291
  if (decorator = decorators[i4])
12084
12292
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
12085
- if (kind && result) __defProp$3(target, key, result);
12293
+ if (kind && result) __defProp$4(target, key, result);
12086
12294
  return result;
12087
12295
  };
12088
12296
  let CxContentBrowserNoResult = class extends CortexElement {
@@ -12100,17 +12308,17 @@ let CxContentBrowserNoResult = class extends CortexElement {
12100
12308
  `;
12101
12309
  }
12102
12310
  };
12103
- CxContentBrowserNoResult.styles = [componentStyles, styles$3];
12311
+ CxContentBrowserNoResult.styles = [componentStyles, styles$4];
12104
12312
  CxContentBrowserNoResult.dependencies = {
12105
12313
  "cx-icon": CxIcon
12106
12314
  };
12107
- __decorateClass$3([
12315
+ __decorateClass$4([
12108
12316
  n$6({ attribute: "icon", type: String })
12109
12317
  ], CxContentBrowserNoResult.prototype, "icon", 2);
12110
- __decorateClass$3([
12318
+ __decorateClass$4([
12111
12319
  n$6({ attribute: "message", type: String })
12112
12320
  ], CxContentBrowserNoResult.prototype, "message", 2);
12113
- CxContentBrowserNoResult = __decorateClass$3([
12321
+ CxContentBrowserNoResult = __decorateClass$4([
12114
12322
  customElement("cx-content-browser-no-result")
12115
12323
  ], CxContentBrowserNoResult);
12116
12324
  class ScrollAnchorController {
@@ -12162,8 +12370,8 @@ class ScrollAnchorController {
12162
12370
  this.cancelPendingRestore();
12163
12371
  const sequence = ++__privateWrapper(this, _restoreSequence)._;
12164
12372
  void __privateGet(this, _host).updateComplete.then(() => __async(this, null, function* () {
12165
- var _a2;
12166
- yield (_a2 = __privateGet(this, _getContainer).call(this)) == null ? void 0 : _a2.layoutComplete;
12373
+ var _a2, _b2;
12374
+ yield (_b2 = (_a2 = __privateGet(this, _getContainer).call(this)) == null ? void 0 : _a2.layoutComplete) == null ? void 0 : _b2.catch(() => void 0);
12167
12375
  if (sequence !== __privateGet(this, _restoreSequence)) {
12168
12376
  return;
12169
12377
  }
@@ -12240,7 +12448,7 @@ _columnCount = new WeakMap();
12240
12448
  _itemHeight = new WeakMap();
12241
12449
  _pendingRestoreFrames = new WeakMap();
12242
12450
  _restoreSequence = new WeakMap();
12243
- const styles$2 = i$7`
12451
+ const styles$3 = i$7`
12244
12452
  :host {
12245
12453
  display: block;
12246
12454
  flex: 1;
@@ -12261,24 +12469,24 @@ const styles$2 = i$7`
12261
12469
  --height: 4px;
12262
12470
  }
12263
12471
  `;
12264
- var __defProp$2 = Object.defineProperty;
12265
- var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
12266
- var __typeError2 = (msg) => {
12472
+ var __defProp$3 = Object.defineProperty;
12473
+ var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
12474
+ var __typeError$2 = (msg) => {
12267
12475
  throw TypeError(msg);
12268
12476
  };
12269
- var __decorateClass$2 = (decorators, target, key, kind) => {
12270
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
12477
+ var __decorateClass$3 = (decorators, target, key, kind) => {
12478
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
12271
12479
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
12272
12480
  if (decorator = decorators[i4])
12273
12481
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
12274
- if (kind && result) __defProp$2(target, key, result);
12482
+ if (kind && result) __defProp$3(target, key, result);
12275
12483
  return result;
12276
12484
  };
12277
- var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
12278
- var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
12279
- var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
12280
- var __privateSet2 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), member.set(obj, value), value);
12281
- var _gutter, _lastHeight, _lastWidth;
12485
+ var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
12486
+ var __privateGet$2 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
12487
+ var __privateAdd$2 = (obj, member, value) => member.has(obj) ? __typeError$2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
12488
+ var __privateSet$2 = (obj, member, value, setter) => (__accessCheck$2(obj, member, "write to private field"), member.set(obj, value), value);
12489
+ var _gutter, _lastHeight$1, _lastWidth;
12282
12490
  let CxContentBrowserGrid = class extends CortexElement {
12283
12491
  constructor() {
12284
12492
  super();
@@ -12292,12 +12500,16 @@ let CxContentBrowserGrid = class extends CortexElement {
12292
12500
  this.showSize = true;
12293
12501
  this.showDimensions = true;
12294
12502
  this.showTags = false;
12503
+ this.showCta = false;
12504
+ this.ctaText = "";
12505
+ this.ctaTextTransform = "capitalize";
12506
+ this.busyAssetId = void 0;
12295
12507
  this.selectedAssetId = void 0;
12296
12508
  this.assetMap = /* @__PURE__ */ new Map();
12297
12509
  this.columnWidth = 0;
12298
- __privateAdd2(this, _gutter, 8);
12299
- __privateAdd2(this, _lastHeight, 0);
12300
- __privateAdd2(this, _lastWidth, 0);
12510
+ __privateAdd$2(this, _gutter, 8);
12511
+ __privateAdd$2(this, _lastHeight$1, 0);
12512
+ __privateAdd$2(this, _lastWidth, 0);
12301
12513
  this.scrollAnchorController = new ScrollAnchorController(this, {
12302
12514
  getContainer: () => this.virtualizerEl,
12303
12515
  getItemIndexById: (id) => this.assets.findIndex((asset) => asset.id === id),
@@ -12310,7 +12522,7 @@ let CxContentBrowserGrid = class extends CortexElement {
12310
12522
  }
12311
12523
  handleViewChange() {
12312
12524
  this.scrollAnchorController.capture();
12313
- this.calculatePageSize(__privateGet2(this, _lastWidth), __privateGet2(this, _lastHeight), true);
12525
+ this.calculatePageSize(__privateGet$2(this, _lastWidth), __privateGet$2(this, _lastHeight$1), true);
12314
12526
  }
12315
12527
  handleAssetsChange() {
12316
12528
  this.assetMap.clear();
@@ -12328,17 +12540,17 @@ let CxContentBrowserGrid = class extends CortexElement {
12328
12540
  this.debouncedCalculatePageSize(width, height);
12329
12541
  }
12330
12542
  calculatePageSize(width, height, force = false) {
12331
- const lastHeight = __privateGet2(this, _lastHeight);
12332
- const lastWidth = __privateGet2(this, _lastWidth);
12543
+ const lastHeight = __privateGet$2(this, _lastHeight$1);
12544
+ const lastWidth = __privateGet$2(this, _lastWidth);
12333
12545
  if (!force && Math.abs(lastHeight - height) < 10 && Math.abs(lastWidth - width) < 10) {
12334
12546
  return;
12335
12547
  }
12336
- __privateSet2(this, _lastHeight, height);
12337
- __privateSet2(this, _lastWidth, width);
12548
+ __privateSet$2(this, _lastHeight$1, height);
12549
+ __privateSet$2(this, _lastWidth, width);
12338
12550
  const { columnCount, rowCount } = this.calculateColumnCount(width, height);
12339
12551
  this.scrollAnchorController.setLayoutMetrics({
12340
12552
  columnCount,
12341
- itemHeight: Math.max(this.columnWidth, 150) + __privateGet2(this, _gutter)
12553
+ itemHeight: Math.max(this.columnWidth, 150) + __privateGet$2(this, _gutter)
12342
12554
  });
12343
12555
  this.emit("cx-content-browser-grid-resize", {
12344
12556
  detail: {
@@ -12358,12 +12570,12 @@ let CxContentBrowserGrid = class extends CortexElement {
12358
12570
  }
12359
12571
  const effectiveWidth = ((_a2 = this.virtualizerEl) == null ? void 0 : _a2.clientWidth) || width;
12360
12572
  const breakPoint = ((_b2 = ASSET_SIZE[this.view]) == null ? void 0 : _b2.minWidth) || ASSET_SIZE[GridView.Large].minWidth;
12361
- const columnCount = Math.max(1, Math.floor((effectiveWidth + __privateGet2(this, _gutter)) / (breakPoint + __privateGet2(this, _gutter))));
12573
+ const columnCount = Math.max(1, Math.floor((effectiveWidth + __privateGet$2(this, _gutter)) / (breakPoint + __privateGet$2(this, _gutter))));
12362
12574
  let rowCount = 0;
12363
12575
  if (height) {
12364
- rowCount = Math.ceil(height / (breakPoint + __privateGet2(this, _gutter)));
12576
+ rowCount = Math.ceil(height / (breakPoint + __privateGet$2(this, _gutter)));
12365
12577
  }
12366
- const newColumnWidth = Math.floor((effectiveWidth - __privateGet2(this, _gutter) * (columnCount + 1)) / columnCount);
12578
+ const newColumnWidth = Math.floor((effectiveWidth - __privateGet$2(this, _gutter) * (columnCount + 1)) / columnCount);
12367
12579
  if (newColumnWidth !== this.columnWidth) {
12368
12580
  this.columnWidth = newColumnWidth;
12369
12581
  }
@@ -12407,6 +12619,10 @@ let CxContentBrowserGrid = class extends CortexElement {
12407
12619
  ?show-size=${this.showSize}
12408
12620
  ?show-dimensions=${this.showDimensions}
12409
12621
  ?show-tags=${this.showTags}
12622
+ ?show-cta=${this.showCta}
12623
+ ?busy=${asset.id === this.busyAssetId}
12624
+ cta-text=${this.ctaText}
12625
+ cta-text-transform=${this.ctaTextTransform}
12410
12626
  ?in-cold-storage=${asset.inColdStorage}
12411
12627
  @click=${this.handleClick}
12412
12628
  ></cx-content-browser-asset-card>
@@ -12430,7 +12646,7 @@ let CxContentBrowserGrid = class extends CortexElement {
12430
12646
  class="content-browser-grid-loading"
12431
12647
  style=${o$1({
12432
12648
  opacity: this.loading ? 1 : 0,
12433
- padding: `0 ${__privateGet2(this, _gutter) * 2}px ${__privateGet2(this, _gutter)}px`
12649
+ padding: `0 ${__privateGet$2(this, _gutter) * 2}px ${__privateGet$2(this, _gutter)}px`
12434
12650
  })}
12435
12651
  >
12436
12652
  <cx-progress-bar indeterminate></cx-progress-bar>
@@ -12454,7 +12670,7 @@ let CxContentBrowserGrid = class extends CortexElement {
12454
12670
  "overflow-x": "hidden"
12455
12671
  })}
12456
12672
  .layout=${grid({
12457
- gap: `${__privateGet2(this, _gutter)}px`,
12673
+ gap: `${__privateGet$2(this, _gutter)}px`,
12458
12674
  itemSize: {
12459
12675
  height: `${Math.max(this.columnWidth, 150)}px`,
12460
12676
  width: `${this.columnWidth}px`
@@ -12473,67 +12689,79 @@ let CxContentBrowserGrid = class extends CortexElement {
12473
12689
  }
12474
12690
  };
12475
12691
  _gutter = /* @__PURE__ */ new WeakMap();
12476
- _lastHeight = /* @__PURE__ */ new WeakMap();
12692
+ _lastHeight$1 = /* @__PURE__ */ new WeakMap();
12477
12693
  _lastWidth = /* @__PURE__ */ new WeakMap();
12478
- CxContentBrowserGrid.styles = [componentStyles, styles$2];
12694
+ CxContentBrowserGrid.styles = [componentStyles, styles$3];
12479
12695
  CxContentBrowserGrid.dependencies = {
12480
12696
  "cx-content-browser-asset-card": CxContentBrowserAssetCard,
12481
12697
  "cx-content-browser-no-result": CxContentBrowserNoResult,
12482
12698
  "cx-progress-bar": CxProgressBar,
12483
12699
  "cx-resize-observer": CxResizeObserver
12484
12700
  };
12485
- __decorateClass$2([
12701
+ __decorateClass$3([
12486
12702
  e$7(".content-browser-grid")
12487
12703
  ], CxContentBrowserGrid.prototype, "containerEl", 2);
12488
- __decorateClass$2([
12704
+ __decorateClass$3([
12489
12705
  e$7("lit-virtualizer")
12490
12706
  ], CxContentBrowserGrid.prototype, "virtualizerEl", 2);
12491
- __decorateClass$2([
12707
+ __decorateClass$3([
12492
12708
  n$6({ attribute: "assets", reflect: false, type: Array })
12493
12709
  ], CxContentBrowserGrid.prototype, "assets", 2);
12494
- __decorateClass$2([
12710
+ __decorateClass$3([
12495
12711
  n$6({ attribute: "empty", reflect: true, type: Boolean })
12496
12712
  ], CxContentBrowserGrid.prototype, "empty", 2);
12497
- __decorateClass$2([
12713
+ __decorateClass$3([
12498
12714
  n$6({ attribute: "view", reflect: true, type: String })
12499
12715
  ], CxContentBrowserGrid.prototype, "view", 2);
12500
- __decorateClass$2([
12716
+ __decorateClass$3([
12501
12717
  n$6({ attribute: "has-more", reflect: true, type: Boolean })
12502
12718
  ], CxContentBrowserGrid.prototype, "hasMore", 2);
12503
- __decorateClass$2([
12719
+ __decorateClass$3([
12504
12720
  n$6({ attribute: "loading", reflect: true, type: Boolean })
12505
12721
  ], CxContentBrowserGrid.prototype, "loading", 2);
12506
- __decorateClass$2([
12722
+ __decorateClass$3([
12507
12723
  n$6({ attribute: "show-title", reflect: true, type: Boolean })
12508
12724
  ], CxContentBrowserGrid.prototype, "showTitle", 2);
12509
- __decorateClass$2([
12725
+ __decorateClass$3([
12510
12726
  n$6({ attribute: "show-size", reflect: true, type: Boolean })
12511
12727
  ], CxContentBrowserGrid.prototype, "showSize", 2);
12512
- __decorateClass$2([
12728
+ __decorateClass$3([
12513
12729
  n$6({ attribute: "show-dimensions", reflect: true, type: Boolean })
12514
12730
  ], CxContentBrowserGrid.prototype, "showDimensions", 2);
12515
- __decorateClass$2([
12731
+ __decorateClass$3([
12516
12732
  n$6({ attribute: "show-tags", reflect: true, type: Boolean })
12517
12733
  ], CxContentBrowserGrid.prototype, "showTags", 2);
12518
- __decorateClass$2([
12734
+ __decorateClass$3([
12735
+ n$6({ attribute: "show-cta", reflect: true, type: Boolean })
12736
+ ], CxContentBrowserGrid.prototype, "showCta", 2);
12737
+ __decorateClass$3([
12738
+ n$6({ attribute: "cta-text", reflect: false, type: String })
12739
+ ], CxContentBrowserGrid.prototype, "ctaText", 2);
12740
+ __decorateClass$3([
12741
+ n$6({ attribute: "cta-text-transform", reflect: false, type: String })
12742
+ ], CxContentBrowserGrid.prototype, "ctaTextTransform", 2);
12743
+ __decorateClass$3([
12744
+ n$6({ attribute: false })
12745
+ ], CxContentBrowserGrid.prototype, "busyAssetId", 2);
12746
+ __decorateClass$3([
12519
12747
  n$6({ attribute: "selected-asset-id", reflect: true, type: String })
12520
12748
  ], CxContentBrowserGrid.prototype, "selectedAssetId", 2);
12521
- __decorateClass$2([
12749
+ __decorateClass$3([
12522
12750
  r$6()
12523
12751
  ], CxContentBrowserGrid.prototype, "assetMap", 2);
12524
- __decorateClass$2([
12752
+ __decorateClass$3([
12525
12753
  r$6()
12526
12754
  ], CxContentBrowserGrid.prototype, "columnWidth", 2);
12527
- __decorateClass$2([
12755
+ __decorateClass$3([
12528
12756
  watch("view", { waitUntilFirstUpdate: true })
12529
12757
  ], CxContentBrowserGrid.prototype, "handleViewChange", 1);
12530
- __decorateClass$2([
12758
+ __decorateClass$3([
12531
12759
  watch("assets")
12532
12760
  ], CxContentBrowserGrid.prototype, "handleAssetsChange", 1);
12533
- CxContentBrowserGrid = __decorateClass$2([
12761
+ CxContentBrowserGrid = __decorateClass$3([
12534
12762
  customElement("cx-content-browser-grid")
12535
12763
  ], CxContentBrowserGrid);
12536
- const styles$1 = i$7`
12764
+ const styles$2 = i$7`
12537
12765
  :host {
12538
12766
  display: block;
12539
12767
  }
@@ -12592,14 +12820,14 @@ const styles$1 = i$7`
12592
12820
  cursor: default;
12593
12821
  }
12594
12822
  `;
12595
- var __defProp$1 = Object.defineProperty;
12596
- var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
12597
- var __decorateClass$1 = (decorators, target, key, kind) => {
12598
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
12823
+ var __defProp$2 = Object.defineProperty;
12824
+ var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
12825
+ var __decorateClass$2 = (decorators, target, key, kind) => {
12826
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
12599
12827
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
12600
12828
  if (decorator = decorators[i4])
12601
12829
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
12602
- if (kind && result) __defProp$1(target, key, result);
12830
+ if (kind && result) __defProp$2(target, key, result);
12603
12831
  return result;
12604
12832
  };
12605
12833
  const LOGOUT_ITEM_VALUE = "logout";
@@ -12645,137 +12873,1247 @@ let CxContentBrowserHeader = class extends CortexElement {
12645
12873
  </cx-space>
12646
12874
  `;
12647
12875
  }
12648
- renderUserDropdown() {
12649
- if (this.isLoading || !this.avatar || !this.fullName) {
12650
- return b`
12651
- <cx-skeleton
12652
- effect="sheen"
12653
- style=${o$1({
12654
- borderRadius: "50%",
12655
- height: "32px",
12656
- width: "32px"
12657
- })}
12658
- ></cx-skeleton>
12659
- `;
12876
+ renderUserDropdown() {
12877
+ if (this.isLoading || !this.avatar || !this.fullName) {
12878
+ return b`
12879
+ <cx-skeleton
12880
+ effect="sheen"
12881
+ style=${o$1({
12882
+ borderRadius: "50%",
12883
+ height: "32px",
12884
+ width: "32px"
12885
+ })}
12886
+ ></cx-skeleton>
12887
+ `;
12888
+ }
12889
+ if (this.canLogout) {
12890
+ return b`
12891
+ <cx-dropdown distance="4">
12892
+ <cx-avatar
12893
+ slot="trigger"
12894
+ class="header__user-avatar header__user-avatar--dropdown-trigger"
12895
+ label=${this.localize.term("userAvatar")}
12896
+ image=${this.avatar}
12897
+ loading="lazy"
12898
+ ></cx-avatar>
12899
+ <cx-menu @cx-select=${this.handleMenuSelect}>
12900
+ <cx-menu-item class="header__user-info" readonly>
12901
+ <cx-line-clamp lines="1">${this.fullName}</cx-line-clamp>
12902
+ <cx-avatar
12903
+ slot="prefix"
12904
+ label=${this.localize.term("userAvatar")}
12905
+ image=${this.avatar}
12906
+ loading="lazy"
12907
+ style=${o$1({
12908
+ "--size": "var(--cx-font-size-x-large)"
12909
+ })}
12910
+ ></cx-avatar>
12911
+ </cx-menu-item>
12912
+ <cx-divider></cx-divider>
12913
+ <cx-menu-item value=${LOGOUT_ITEM_VALUE}>
12914
+ ${this.localize.term("logout")}
12915
+ <cx-icon slot="prefix" name="logout"></cx-icon>
12916
+ </cx-menu-item>
12917
+ </cx-menu>
12918
+ </cx-dropdown>
12919
+ `;
12920
+ }
12921
+ return b`
12922
+ <cx-avatar
12923
+ class="header__user-avatar"
12924
+ label=${this.localize.term("userAvatar")}
12925
+ image=${this.avatar}
12926
+ loading="lazy"
12927
+ ></cx-avatar>
12928
+ `;
12929
+ }
12930
+ render() {
12931
+ const containerClasses = {
12932
+ container: true,
12933
+ "container--bordered": this.bordered
12934
+ };
12935
+ return b`
12936
+ <cx-space class=${e$5(containerClasses)} direction="vertical" spacing="small">
12937
+ <cx-space class="header" justify-content="space-between" align-items="center">
12938
+ <div class="header__title">
12939
+ <cx-space class="header" justify-content="space-between" align-items="center" spacing="x-small">
12940
+ ${this.renderTitle()}
12941
+ </cx-space>
12942
+ </div>
12943
+ <div class="header__menu">
12944
+ ${this.renderUserDropdown()}
12945
+ ${n$5(
12946
+ this.showCloseButton,
12947
+ () => b`
12948
+ <cx-icon-button
12949
+ name="close"
12950
+ label=${this.localize.term("close")}
12951
+ @click=${this.handleCloseClick}
12952
+ ></cx-icon-button>
12953
+ `,
12954
+ () => A
12955
+ )}
12956
+ </div>
12957
+ </cx-space>
12958
+ <slot></slot>
12959
+ </cx-space>
12960
+ `;
12961
+ }
12962
+ };
12963
+ CxContentBrowserHeader.styles = [componentStyles, styles$2];
12964
+ CxContentBrowserHeader.dependencies = {
12965
+ "cx-avatar": CxAvatar,
12966
+ "cx-divider": CxDivider,
12967
+ "cx-dropdown": CxDropdown,
12968
+ "cx-icon": CxIcon,
12969
+ "cx-icon-button": CxIconButton,
12970
+ "cx-line-clamp": CxLineClamp,
12971
+ "cx-menu": CxMenu,
12972
+ "cx-menu-item": CxMenuItem,
12973
+ "cx-skeleton": CxSkeleton,
12974
+ "cx-space": CxSpace,
12975
+ "cx-typography": CxTypography
12976
+ };
12977
+ __decorateClass$2([
12978
+ n$6({ type: Boolean })
12979
+ ], CxContentBrowserHeader.prototype, "bordered", 2);
12980
+ __decorateClass$2([
12981
+ n$6({ attribute: "application-name", type: String })
12982
+ ], CxContentBrowserHeader.prototype, "applicationName", 2);
12983
+ __decorateClass$2([
12984
+ n$6({ type: Boolean })
12985
+ ], CxContentBrowserHeader.prototype, "loading", 2);
12986
+ __decorateClass$2([
12987
+ n$6({ attribute: "is-fetching", type: Boolean })
12988
+ ], CxContentBrowserHeader.prototype, "isFetching", 2);
12989
+ __decorateClass$2([
12990
+ n$6({ attribute: "avatar", type: String })
12991
+ ], CxContentBrowserHeader.prototype, "avatar", 2);
12992
+ __decorateClass$2([
12993
+ n$6({ attribute: "full-name", type: String })
12994
+ ], CxContentBrowserHeader.prototype, "fullName", 2);
12995
+ __decorateClass$2([
12996
+ n$6({ attribute: "folder-title", type: String })
12997
+ ], CxContentBrowserHeader.prototype, "folderTitle", 2);
12998
+ __decorateClass$2([
12999
+ n$6({ attribute: "show-close-button", type: Boolean })
13000
+ ], CxContentBrowserHeader.prototype, "showCloseButton", 2);
13001
+ __decorateClass$2([
13002
+ n$6({ attribute: "can-logout", type: Boolean })
13003
+ ], CxContentBrowserHeader.prototype, "canLogout", 2);
13004
+ CxContentBrowserHeader = __decorateClass$2([
13005
+ customElement("cx-content-browser-header")
13006
+ ], CxContentBrowserHeader);
13007
+ const styles$1 = i$7`
13008
+ /* Containing block for the absolutely positioned loading bar, which is a direct child. */
13009
+ :host {
13010
+ position: relative;
13011
+ display: flex;
13012
+ flex-direction: column;
13013
+ flex: 1;
13014
+ box-sizing: border-box;
13015
+ /*
13016
+ * A multi-line flex parent stretches an item to its own flex line's cross size rather than to
13017
+ * the container's width, and a row parent's automatic minimum refuses to shrink below content.
13018
+ * A definite width and a zero minimum keep a wide table scrolling inside the picker instead of
13019
+ * widening it (L-429EVG).
13020
+ */
13021
+ width: 100%;
13022
+ min-width: 0;
13023
+ min-height: 0;
13024
+ /*
13025
+ * The gap under the control bar belongs to the table, not to the shared cx-space above it, which
13026
+ * spaces the grid too. Fallback because an unthemed host resolves the token to nothing.
13027
+ */
13028
+ padding-top: var(--cx-spacing-medium, 16px);
13029
+ }
13030
+
13031
+ /*
13032
+ * The table is positioned out of flow, so the rows can never size this box: its height comes from
13033
+ * the container alone, in every host shape. A host slot that takes its height from a flex line
13034
+ * cannot be shorter than the height its contents report, and a table in flow reports every row it
13035
+ * holds, which paints the picker over the page below (L-42BBKC) and makes a row count read off it
13036
+ * grow with each page (L-42BFJC). The floor is the grid's own (lit-virtualizer's scroller
13037
+ * minimum), so a host that gives the picker no height gets a short table that scrolls, never one
13038
+ * that collapses to nothing.
13039
+ */
13040
+ .content-browser-table {
13041
+ position: relative;
13042
+ flex: 1 1 auto;
13043
+ min-height: 150px;
13044
+ }
13045
+
13046
+ .content-browser-table__table {
13047
+ --table-height: 100%;
13048
+ /* The frozen CTA column is a row action, not a pinned data column: it takes no divider. */
13049
+ --frozen-border-color: transparent;
13050
+
13051
+ position: absolute;
13052
+ inset: 0;
13053
+ }
13054
+
13055
+ .content-browser-table-loading {
13056
+ position: absolute;
13057
+ top: 0;
13058
+ width: 100%;
13059
+ z-index: var(--cx-z-index-drawer);
13060
+ }
13061
+
13062
+ .content-browser-table-loading cx-progress-bar {
13063
+ --height: 4px;
13064
+ }
13065
+
13066
+ .content-browser-table__empty {
13067
+ height: 100%;
13068
+ }
13069
+ `;
13070
+ var __defProp$1 = Object.defineProperty;
13071
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
13072
+ var __typeError$1 = (msg) => {
13073
+ throw TypeError(msg);
13074
+ };
13075
+ var __decorateClass$1 = (decorators, target, key, kind) => {
13076
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
13077
+ for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
13078
+ if (decorator = decorators[i4])
13079
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
13080
+ if (kind && result) __defProp$1(target, key, result);
13081
+ return result;
13082
+ };
13083
+ var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
13084
+ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
13085
+ var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
13086
+ var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
13087
+ var _columnDefinitions, _columnsSignature, _columnKeys, _rowsNeedRebuild, _heldRowKeys, _resizedWidths, _percentWidthsPending, _ctas, _renderedCtas, _pointerTrackedRows, _hoveredRow, _focusedCta, _ctaFocusedAtRender, _noHoverQueries, _hasNoHover, _ctaColumnWidth, _ctaFittedLabel, _builtTable, _syncedAssets, _pendingReplaces, _lastHeight, _containerSize, _lastRowCount, _rowCountHeld, _lastRowObserver;
13088
+ const CxTable = CxColorSwatchGroup.dependencies["cx-table"];
13089
+ const ROW_HEIGHT = 48;
13090
+ const MIN_COLUMN_WIDTH = 48;
13091
+ const CTA_FIELD = "cta";
13092
+ const FILLER_FIELD = "filler";
13093
+ const INITIAL_CTA_COLUMN_WIDTH = 96;
13094
+ const FILLER_GROW = 1e-3;
13095
+ const NO_HOVER_QUERIES = ["(hover: none)", "(any-pointer: coarse)"];
13096
+ const FLEX_TRACK = /^(\d*\.?\d+)fr$/i;
13097
+ const MINMAX_TRACK = /^minmax\(\s*(.+?)\s*,\s*(.+?)\s*\)$/i;
13098
+ const PIXEL_LENGTH = /^(\d*\.?\d+)(px)?$/i;
13099
+ const PERCENT_LENGTH = /^\d*\.?\d+%$/;
13100
+ const COLUMN_DEFAULTS = {
13101
+ headerSort: false,
13102
+ resizable: true
13103
+ };
13104
+ const FLEXIBLE = { minWidth: MIN_COLUMN_WIDTH, widthGrow: 1 };
13105
+ function parsePixels(value) {
13106
+ const match = PIXEL_LENGTH.exec(value.trim());
13107
+ return match ? Number.parseFloat(match[1]) : void 0;
13108
+ }
13109
+ function flexibleMinimum(minimum) {
13110
+ var _a2;
13111
+ return Math.max(MIN_COLUMN_WIDTH, (_a2 = parsePixels(minimum)) != null ? _a2 : 0);
13112
+ }
13113
+ function fixedSizing(width, minimum = 0) {
13114
+ if (width <= 0) {
13115
+ return { minWidth: MIN_COLUMN_WIDTH, width: MIN_COLUMN_WIDTH };
13116
+ }
13117
+ return { minWidth: Math.min(Math.max(MIN_COLUMN_WIDTH, minimum), width), width };
13118
+ }
13119
+ function flexibleSizing(minimum, grow) {
13120
+ return grow > 0 ? { minWidth: minimum, widthGrow: grow } : { minWidth: minimum, width: minimum };
13121
+ }
13122
+ function toColumnSizing(track) {
13123
+ var _a2;
13124
+ const authored = (_a2 = track == null ? void 0 : track.trim()) != null ? _a2 : "";
13125
+ if (!authored) {
13126
+ return FLEXIBLE;
13127
+ }
13128
+ const pixels = parsePixels(authored);
13129
+ if (pixels !== void 0) {
13130
+ return fixedSizing(pixels);
13131
+ }
13132
+ if (PERCENT_LENGTH.test(authored)) {
13133
+ return { minWidth: MIN_COLUMN_WIDTH, width: authored };
13134
+ }
13135
+ const flex = FLEX_TRACK.exec(authored);
13136
+ if (flex) {
13137
+ return flexibleSizing(MIN_COLUMN_WIDTH, Number.parseFloat(flex[1]));
13138
+ }
13139
+ const minmax = MINMAX_TRACK.exec(authored);
13140
+ if (!minmax) {
13141
+ return FLEXIBLE;
13142
+ }
13143
+ const [, minimum, maximum] = minmax;
13144
+ const maximumFlex = FLEX_TRACK.exec(maximum);
13145
+ if (maximumFlex) {
13146
+ return flexibleSizing(flexibleMinimum(minimum), Number.parseFloat(maximumFlex[1]));
13147
+ }
13148
+ const maximumPixels = parsePixels(maximum);
13149
+ if (maximumPixels !== void 0) {
13150
+ return fixedSizing(maximumPixels, parsePixels(minimum));
13151
+ }
13152
+ return __spreadProps(__spreadValues({}, FLEXIBLE), { minWidth: flexibleMinimum(minimum) });
13153
+ }
13154
+ function readCellValue(asset, field) {
13155
+ if (!Object.prototype.hasOwnProperty.call(asset, field)) {
13156
+ return "";
13157
+ }
13158
+ const value = asset[field];
13159
+ if (value === void 0 || value === null || typeof value === "object") {
13160
+ return "";
13161
+ }
13162
+ return String(value);
13163
+ }
13164
+ function columnsSignature(columns) {
13165
+ return JSON.stringify(columns.map(({ align, field, lines, title, width }) => [align, field, lines, title, width]));
13166
+ }
13167
+ function isAppendOf(previous, next) {
13168
+ return previous.length > 0 && next.length > previous.length && previous.every((asset, index) => next[index] === asset);
13169
+ }
13170
+ function renderCellContent(value, lines, inColdStorage) {
13171
+ const content = document.createElement("cx-line-clamp");
13172
+ content.setAttribute("lines", String(lines));
13173
+ if (lines > 1) {
13174
+ content.style.whiteSpace = "normal";
13175
+ }
13176
+ if (inColdStorage) {
13177
+ content.style.opacity = "0.5";
13178
+ }
13179
+ content.textContent = value;
13180
+ return content;
13181
+ }
13182
+ function fitRowToClamp(cell, clamp) {
13183
+ return __async(this, null, function* () {
13184
+ var _a2;
13185
+ (_a2 = cell.getElement()) == null ? void 0 : _a2.style.setProperty("min-height", `${ROW_HEIGHT}px`);
13186
+ yield clamp.updateComplete;
13187
+ if (clamp.isConnected) {
13188
+ cell.getRow().normalizeHeight();
13189
+ }
13190
+ });
13191
+ }
13192
+ let CxContentBrowserTable = class extends CortexElement {
13193
+ constructor() {
13194
+ super(...arguments);
13195
+ this.localize = new LocalizeController(this);
13196
+ this.assets = [];
13197
+ this.columns = [];
13198
+ this.ctaText = "";
13199
+ this.ctaTextTransform = "capitalize";
13200
+ this.empty = false;
13201
+ this.hasMore = false;
13202
+ this.loading = false;
13203
+ this.selectedAssetId = void 0;
13204
+ this.busyAssetId = void 0;
13205
+ this.hiddenFields = [];
13206
+ this.assetMap = /* @__PURE__ */ new Map();
13207
+ __privateAdd$1(this, _columnDefinitions, []);
13208
+ __privateAdd$1(this, _columnsSignature, "");
13209
+ __privateAdd$1(this, _columnKeys, /* @__PURE__ */ new Map());
13210
+ __privateAdd$1(this, _rowsNeedRebuild, false);
13211
+ __privateAdd$1(this, _heldRowKeys, /* @__PURE__ */ new Set());
13212
+ __privateAdd$1(this, _resizedWidths, /* @__PURE__ */ new Map());
13213
+ __privateAdd$1(this, _percentWidthsPending, false);
13214
+ __privateAdd$1(this, _ctas, /* @__PURE__ */ new WeakMap());
13215
+ __privateAdd$1(this, _renderedCtas, /* @__PURE__ */ new Set());
13216
+ __privateAdd$1(this, _pointerTrackedRows, /* @__PURE__ */ new WeakSet());
13217
+ __privateAdd$1(this, _hoveredRow);
13218
+ __privateAdd$1(this, _focusedCta);
13219
+ __privateAdd$1(this, _ctaFocusedAtRender);
13220
+ __privateAdd$1(this, _noHoverQueries, []);
13221
+ __privateAdd$1(this, _hasNoHover, false);
13222
+ __privateAdd$1(this, _ctaColumnWidth, INITIAL_CTA_COLUMN_WIDTH);
13223
+ __privateAdd$1(this, _ctaFittedLabel);
13224
+ __privateAdd$1(this, _builtTable);
13225
+ __privateAdd$1(this, _syncedAssets, []);
13226
+ __privateAdd$1(this, _pendingReplaces, 0);
13227
+ __privateAdd$1(this, _lastHeight, 0);
13228
+ __privateAdd$1(this, _containerSize);
13229
+ __privateAdd$1(this, _lastRowCount);
13230
+ __privateAdd$1(this, _rowCountHeld, false);
13231
+ __privateAdd$1(this, _lastRowObserver);
13232
+ this.handleNoHoverChange = () => {
13233
+ this.setNoHover(__privateGet$1(this, _noHoverQueries).some((list) => list.matches));
13234
+ };
13235
+ this.debouncedRedrawTable = debounce(this.redrawTable, 100);
13236
+ this.debouncedCalculatePageSize = debounce(this.calculatePageSize, 200);
13237
+ this.debouncedHandleLastRowVisible = debounce(this.handleLastRowVisible, 200);
13238
+ this.debouncedHandleScrollEnd = debounce(this.handleScrollEnd, 200);
13239
+ }
13240
+ get tabulator() {
13241
+ var _a2, _b2;
13242
+ const instance2 = (_b2 = (_a2 = this.tableEl) == null ? void 0 : _a2.tabulatorInstance) != null ? _b2 : void 0;
13243
+ return instance2 !== void 0 && instance2 === __privateGet$1(this, _builtTable) && !instance2.destroyed ? instance2 : void 0;
13244
+ }
13245
+ /** Tabulator's row holder: the one element that scrolls the rows. */
13246
+ get scrollport() {
13247
+ var _a2, _b2, _c2;
13248
+ return (_c2 = (_b2 = (_a2 = this.tabulator) == null ? void 0 : _a2.rowManager) == null ? void 0 : _b2.element) != null ? _c2 : void 0;
13249
+ }
13250
+ get hasMultilineColumn() {
13251
+ return this.columns.some((column) => {
13252
+ var _a2;
13253
+ return ((_a2 = column.lines) != null ? _a2 : 1) > 1;
13254
+ });
13255
+ }
13256
+ resolveColumnSizing(column) {
13257
+ const sizing = toColumnSizing(column.width);
13258
+ const resized = __privateGet$1(this, _resizedWidths).get(column.field);
13259
+ if (resized === void 0) {
13260
+ return sizing;
13261
+ }
13262
+ return { minWidth: sizing.minWidth, width: resized };
13263
+ }
13264
+ /** Each host column's row key, in order: a field the host repeats takes a key per occurrence. */
13265
+ resolveColumnKeys() {
13266
+ const occurrences = /* @__PURE__ */ new Map();
13267
+ return this.columns.map(({ field }) => {
13268
+ var _a2, _b2;
13269
+ const occurrence = (_a2 = occurrences.get(field)) != null ? _a2 : 0;
13270
+ const identity2 = `${field}\0${occurrence}`;
13271
+ const key = (_b2 = __privateGet$1(this, _columnKeys).get(identity2)) != null ? _b2 : `column${__privateGet$1(this, _columnKeys).size}`;
13272
+ occurrences.set(field, occurrence + 1);
13273
+ __privateGet$1(this, _columnKeys).set(identity2, key);
13274
+ return key;
13275
+ });
13276
+ }
13277
+ buildColumnDefinitions() {
13278
+ return [...this.buildDataColumnDefinitions(), this.buildFillerColumnDefinition(), this.buildCtaColumnDefinition()];
13279
+ }
13280
+ buildDataColumnDefinitions() {
13281
+ const hidden = new Set(this.hiddenFields);
13282
+ const keys2 = this.resolveColumnKeys();
13283
+ const variableRowHeight = this.hasMultilineColumn;
13284
+ return this.columns.map((column, index) => {
13285
+ var _a2;
13286
+ const lines = Math.max(1, (_a2 = column.lines) != null ? _a2 : 1);
13287
+ return __spreadValues({
13288
+ field: keys2[index],
13289
+ formatter: (cell, _params, onRendered) => {
13290
+ var _a3;
13291
+ const row = cell.getRow();
13292
+ const inColdStorage = Boolean(row.getData().inColdStorage);
13293
+ const content = renderCellContent(String((_a3 = cell.getValue()) != null ? _a3 : ""), lines, inColdStorage);
13294
+ if (inColdStorage) {
13295
+ row.getElement().style.pointerEvents = "none";
13296
+ }
13297
+ if (lines > 1) {
13298
+ onRendered(() => void fitRowToClamp(cell, content));
13299
+ } else if (variableRowHeight) {
13300
+ onRendered(() => {
13301
+ var _a4;
13302
+ return (_a4 = cell.getElement()) == null ? void 0 : _a4.style.setProperty("min-height", `${ROW_HEIGHT}px`);
13303
+ });
13304
+ }
13305
+ return content;
13306
+ },
13307
+ headerHozAlign: column.align,
13308
+ // Never `false`: Tabulator awaits a `show()` for it as it builds the header, so a percentage
13309
+ // column still has a width of 0 when `pinPercentWidths` pins it, and lays out as flexible.
13310
+ hidden: hidden.has(column.field) || void 0,
13311
+ hozAlign: column.align,
13312
+ title: column.title,
13313
+ // A node, as for a cell: `cx-table` parses a title string as HTML.
13314
+ titleFormatter: (cell) => {
13315
+ var _a3;
13316
+ return renderCellContent(String((_a3 = cell.getValue()) != null ? _a3 : ""), 1, false);
13317
+ },
13318
+ variableHeight: lines > 1
13319
+ }, this.resolveColumnSizing(column));
13320
+ });
13321
+ }
13322
+ /**
13323
+ * `fitColumns` gives the free space only to columns with no fixed width, and a drag fixes the width
13324
+ * of the column it resizes. Once every data column has one, this column takes the space they leave,
13325
+ * which would otherwise show blank, and keeps the CTA at the right edge. The CTA column cannot do it
13326
+ * itself: its floor is the button's measured width, and Tabulator reads a floor only as it builds the
13327
+ * column.
13328
+ */
13329
+ buildFillerColumnDefinition() {
13330
+ const variableRowHeight = this.hasMultilineColumn;
13331
+ return {
13332
+ field: FILLER_FIELD,
13333
+ formatter: (cell) => {
13334
+ const element = cell.getElement();
13335
+ if (variableRowHeight) {
13336
+ cell.getRow().getElement().style.minHeight = `${ROW_HEIGHT}px`;
13337
+ }
13338
+ if (element) {
13339
+ element.style.padding = "0";
13340
+ element.style.pointerEvents = "none";
13341
+ element.setAttribute("aria-hidden", "true");
13342
+ }
13343
+ return "";
13344
+ },
13345
+ headerSort: false,
13346
+ // A column laid out at 0 loses its width style, and renders as wide as its content.
13347
+ minWidth: 1,
13348
+ resizable: false,
13349
+ title: "",
13350
+ titleFormatter: (cell) => {
13351
+ const header = cell.getColumn().getElement();
13352
+ header.style.borderRight = "none";
13353
+ header.style.pointerEvents = "none";
13354
+ header.setAttribute("aria-hidden", "true");
13355
+ return "";
13356
+ },
13357
+ widthGrow: FILLER_GROW
13358
+ };
13359
+ }
13360
+ /**
13361
+ * A button of our own in a formatter cell rather than a `cx-table` hover-menu action: a row action
13362
+ * renders an icon, with its label only as a tooltip.
13363
+ */
13364
+ buildCtaColumnDefinition() {
13365
+ return {
13366
+ field: CTA_FIELD,
13367
+ formatter: (cell) => this.renderCta(cell),
13368
+ // Held at the right edge of a table wider than the picker: a click on the row hands nothing
13369
+ // over, so the CTA is the only insert a row has.
13370
+ frozen: true,
13371
+ headerSort: false,
13372
+ hozAlign: "right",
13373
+ // Tabulator's default floor would hold a narrower button's column wider than it is measured.
13374
+ minWidth: 0,
13375
+ resizable: false,
13376
+ title: "",
13377
+ // Untitled on screen, but a header a screen reader reads needs a name.
13378
+ titleFormatter: (cell) => {
13379
+ cell.getColumn().getElement().setAttribute("aria-label", this.ctaLabel);
13380
+ return "";
13381
+ },
13382
+ width: __privateGet$1(this, _ctaColumnWidth)
13383
+ };
13384
+ }
13385
+ get ctaLabel() {
13386
+ return this.ctaText || this.localize.term("insert");
13387
+ }
13388
+ renderCta(cell) {
13389
+ var _a2;
13390
+ const row = cell.getRow();
13391
+ const data = row.getData();
13392
+ if (data.inColdStorage) {
13393
+ return "";
13394
+ }
13395
+ const rowElement = row.getElement();
13396
+ const button = document.createElement("cx-button");
13397
+ const label = document.createElement("span");
13398
+ const cta = { assetId: String((_a2 = data.id) != null ? _a2 : ""), button, label, rowElement };
13399
+ rowElement.style.cursor = "default";
13400
+ button.classList.add("content-browser-table__cta");
13401
+ button.setAttribute("size", "small");
13402
+ button.setAttribute("variant", "primary");
13403
+ button.style.width = "max-content";
13404
+ button.style.maxWidth = "none";
13405
+ label.style.whiteSpace = "nowrap";
13406
+ button.append(label);
13407
+ button.addEventListener("click", (event) => {
13408
+ if (event.detail <= 1) {
13409
+ this.insertAsset(cta.assetId);
13410
+ }
13411
+ });
13412
+ button.addEventListener("focusin", () => {
13413
+ __privateSet$1(this, _focusedCta, cta);
13414
+ this.paintCta(cta);
13415
+ });
13416
+ button.addEventListener("focusout", () => {
13417
+ if (__privateGet$1(this, _focusedCta) === cta) {
13418
+ __privateSet$1(this, _focusedCta, void 0);
13419
+ }
13420
+ this.paintCta(cta);
13421
+ });
13422
+ const previous = __privateGet$1(this, _ctas).get(rowElement);
13423
+ if (previous) {
13424
+ __privateGet$1(this, _renderedCtas).delete(previous);
13425
+ }
13426
+ __privateGet$1(this, _ctas).set(rowElement, cta);
13427
+ __privateGet$1(this, _renderedCtas).add(cta);
13428
+ this.trackPointer(rowElement);
13429
+ this.paintCta(cta);
13430
+ void this.fitCtaColumn(cta);
13431
+ return button;
13432
+ }
13433
+ isCtaShown(cta) {
13434
+ return __privateGet$1(this, _hasNoHover) || cta.assetId === this.busyAssetId || cta.assetId === this.selectedAssetId || cta.rowElement === __privateGet$1(this, _hoveredRow) || cta === __privateGet$1(this, _focusedCta) && cta.button.matches(":focus-within");
13435
+ }
13436
+ /** In place, never rebuilt: a new button would drop the keyboard focus the old one held. */
13437
+ paintCta(cta) {
13438
+ const text = this.ctaLabel;
13439
+ if (cta.label.textContent !== text) {
13440
+ cta.label.textContent = text;
13441
+ }
13442
+ cta.label.style.textTransform = this.ctaTextTransform;
13443
+ cta.button.loading = cta.assetId === this.busyAssetId;
13444
+ cta.button.style.opacity = this.isCtaShown(cta) ? "1" : "0";
13445
+ }
13446
+ paintRowCta(rowElement) {
13447
+ const cta = rowElement ? __privateGet$1(this, _ctas).get(rowElement) : void 0;
13448
+ if (cta) {
13449
+ this.paintCta(cta);
13450
+ }
13451
+ }
13452
+ paintAssetCta(assetId) {
13453
+ var _a2;
13454
+ this.paintRowCta((_a2 = this.findRow(assetId)) == null ? void 0 : _a2.getElement());
13455
+ }
13456
+ trackPointer(rowElement) {
13457
+ if (__privateGet$1(this, _pointerTrackedRows).has(rowElement)) {
13458
+ return;
13459
+ }
13460
+ __privateGet$1(this, _pointerTrackedRows).add(rowElement);
13461
+ rowElement.addEventListener("mouseenter", () => this.setHoveredRow(rowElement));
13462
+ rowElement.addEventListener("mouseleave", () => {
13463
+ if (__privateGet$1(this, _hoveredRow) === rowElement) {
13464
+ this.setHoveredRow(void 0);
13465
+ }
13466
+ });
13467
+ }
13468
+ setHoveredRow(rowElement) {
13469
+ const previous = __privateGet$1(this, _hoveredRow);
13470
+ __privateSet$1(this, _hoveredRow, rowElement);
13471
+ this.paintRowCta(previous);
13472
+ this.paintRowCta(rowElement);
13473
+ }
13474
+ /**
13475
+ * Tabulator takes a row that scrolls out of its render window off the page, and a row taken off
13476
+ * the page gets no `mouseleave` to hide its CTA, nor need its button get a `focusout` for the
13477
+ * focus it drops.
13478
+ */
13479
+ releaseDetachedCta() {
13480
+ var _a2;
13481
+ if (((_a2 = __privateGet$1(this, _hoveredRow)) == null ? void 0 : _a2.isConnected) === false) {
13482
+ this.setHoveredRow(void 0);
13483
+ }
13484
+ const focused = __privateGet$1(this, _focusedCta);
13485
+ if ((focused == null ? void 0 : focused.button.isConnected) === false) {
13486
+ __privateSet$1(this, _focusedCta, void 0);
13487
+ this.paintCta(focused);
13488
+ }
13489
+ }
13490
+ /**
13491
+ * The label is the host's, so no fixed width fits it: the column takes the rendered button's
13492
+ * width plus whatever its cell puts around the button.
13493
+ */
13494
+ fitCtaColumn(cta) {
13495
+ return __async(this, null, function* () {
13496
+ yield cta.button.updateComplete;
13497
+ const tabulator = this.tabulator;
13498
+ const column = (tabulator == null ? void 0 : tabulator.getColumn(CTA_FIELD)) || void 0;
13499
+ const container = cta.button.parentElement;
13500
+ if (!tabulator || !column || !container || !cta.button.isConnected) {
13501
+ return;
13502
+ }
13503
+ const labelKey = `${this.ctaLabel}\0${this.ctaTextTransform}`;
13504
+ if (labelKey === __privateGet$1(this, _ctaFittedLabel)) {
13505
+ return;
13506
+ }
13507
+ const header = column.getElement().getBoundingClientRect().width;
13508
+ if (container.clientWidth === 0 || header === 0) {
13509
+ return;
13510
+ }
13511
+ __privateSet$1(this, _ctaFittedLabel, labelKey);
13512
+ const style = getComputedStyle(container);
13513
+ const content = container.clientWidth - Number.parseFloat(style.paddingLeft) - Number.parseFloat(style.paddingRight);
13514
+ const scale = column.getWidth() > 0 ? header / column.getWidth() : 1;
13515
+ const width = Math.ceil(column.getWidth() - content + cta.button.getBoundingClientRect().width / scale);
13516
+ if (width === Math.round(column.getWidth())) {
13517
+ return;
13518
+ }
13519
+ __privateSet$1(this, _ctaColumnWidth, width);
13520
+ column.getDefinition().width = width;
13521
+ yield column.setWidth(width);
13522
+ this.redrawTable();
13523
+ });
13524
+ }
13525
+ /** Lays the columns and the rendered rows out again. */
13526
+ redrawTable() {
13527
+ var _a2;
13528
+ (_a2 = this.tabulator) == null ? void 0 : _a2.redraw();
13529
+ }
13530
+ /**
13531
+ * Tabulator renders the rows again -- for an appended page, a redraw of its own or one of ours --
13532
+ * by taking every rendered row off the page and back, which drops the keyboard focus, so the CTA
13533
+ * that held it gets it back.
13534
+ */
13535
+ handleRenderStarted(event) {
13536
+ var _a2;
13537
+ event.stopPropagation();
13538
+ const button = (_a2 = __privateGet$1(this, _focusedCta)) == null ? void 0 : _a2.button;
13539
+ __privateSet$1(this, _ctaFocusedAtRender, (button == null ? void 0 : button.matches(":focus-within")) ? button : void 0);
13540
+ }
13541
+ handleRenderComplete(event) {
13542
+ event.stopPropagation();
13543
+ const button = __privateGet$1(this, _ctaFocusedAtRender);
13544
+ __privateSet$1(this, _ctaFocusedAtRender, void 0);
13545
+ if ((button == null ? void 0 : button.isConnected) && !button.matches(":focus-within")) {
13546
+ button.focus({ preventScroll: true });
13547
+ }
13548
+ }
13549
+ toRow(asset, keys2) {
13550
+ const row = {
13551
+ id: asset.id,
13552
+ inColdStorage: Boolean(asset.inColdStorage)
13553
+ };
13554
+ this.columns.forEach((column, index) => {
13555
+ row[keys2[index]] = readCellValue(asset, column.field);
13556
+ });
13557
+ return row;
13558
+ }
13559
+ findRow(assetId) {
13560
+ var _a2;
13561
+ if (!assetId) {
13562
+ return void 0;
13563
+ }
13564
+ return ((_a2 = this.tabulator) == null ? void 0 : _a2.getRow(assetId)) || void 0;
13565
+ }
13566
+ /**
13567
+ * `aria-current`, not `aria-selected`: this is a `grid` with no selection model of its own. The
13568
+ * Tabulator selection is there only for `cx-table`'s selected-row style: `selectableRows` stays at
13569
+ * its `highlight` default, so a click never selects a row by itself.
13570
+ */
13571
+ markCurrentRow(assetId, current) {
13572
+ var _a2, _b2;
13573
+ const row = this.findRow(assetId);
13574
+ if (!row) {
13575
+ return;
13576
+ }
13577
+ row.getElement().setAttribute("aria-current", current ? "true" : "false");
13578
+ if (current) {
13579
+ (_a2 = this.tabulator) == null ? void 0 : _a2.selectRow(assetId);
13580
+ } else {
13581
+ (_b2 = this.tabulator) == null ? void 0 : _b2.deselectRow(assetId);
13582
+ }
13583
+ }
13584
+ getPercentColumns(tabulator) {
13585
+ return tabulator.getColumns().filter((column) => {
13586
+ const { width } = column.getDefinition();
13587
+ return typeof width === "string" && PERCENT_LENGTH.test(width);
13588
+ });
13589
+ }
13590
+ /**
13591
+ * Tabulator converts a percentage to pixels once, as it builds the column, but `fitColumns` goes on
13592
+ * budgeting the column at that share of the table's current width, which leaves the flexible columns
13593
+ * a gap or an overflow at any other width: the column is budgeted at the width it was built at. A
13594
+ * table hidden as it builds its columns has no width to take a share of, and Tabulator floors every
13595
+ * share at the column's minimum: those shares are converted once the table is shown.
13596
+ */
13597
+ pinPercentWidths(tabulator) {
13598
+ const columns = this.getPercentColumns(tabulator);
13599
+ __privateSet$1(this, _percentWidthsPending, columns.length > 0 && tabulator.element.clientWidth === 0);
13600
+ if (__privateGet$1(this, _percentWidthsPending)) {
13601
+ return;
13602
+ }
13603
+ columns.forEach((column) => {
13604
+ column.getDefinition().width = column.getWidth();
13605
+ });
13606
+ }
13607
+ /** At the first width the table has, as Tabulator converts a share when it builds the column. */
13608
+ convertPendingPercentWidths() {
13609
+ return __async(this, null, function* () {
13610
+ const tabulator = this.tabulator;
13611
+ if (!__privateGet$1(this, _percentWidthsPending) || !tabulator || tabulator.element.clientWidth === 0) {
13612
+ return;
13613
+ }
13614
+ __privateSet$1(this, _percentWidthsPending, false);
13615
+ const tableWidth = tabulator.element.clientWidth;
13616
+ yield Promise.all(this.getPercentColumns(tabulator).map((column) => __async(this, null, function* () {
13617
+ const definition = column.getDefinition();
13618
+ yield column.setWidth(Math.floor(tableWidth / 100 * Number.parseInt(String(definition.width), 10)));
13619
+ definition.width = column.getWidth();
13620
+ })));
13621
+ this.redrawTable();
13622
+ });
13623
+ }
13624
+ /**
13625
+ * `content-browser` hands over the whole list on every page, so a list that only grows by a page
13626
+ * is appended: reassigning it would call `setData`, which scrolls the table back to the top. Any
13627
+ * other list -- a new search, sort, filter or folder, or a refetch that brings the assets the rows
13628
+ * show as new objects -- replaces the rows.
13629
+ */
13630
+ syncRows(replace = false) {
13631
+ return __async(this, null, function* () {
13632
+ const tabulator = this.tabulator;
13633
+ if (!tabulator) {
13634
+ return;
13635
+ }
13636
+ const columnKeys = this.resolveColumnKeys();
13637
+ const synced = __privateGet$1(this, _syncedAssets);
13638
+ const isNextPage = !replace && __privateGet$1(this, _pendingReplaces) === 0 && isAppendOf(synced, this.assets);
13639
+ __privateSet$1(this, _syncedAssets, [...this.assets]);
13640
+ if (isNextPage) {
13641
+ __privateSet$1(this, _heldRowKeys, new Set(columnKeys.filter((key) => __privateGet$1(this, _heldRowKeys).has(key))));
13642
+ yield tabulator.addData(this.assets.slice(synced.length).map((asset) => this.toRow(asset, columnKeys)));
13643
+ } else {
13644
+ __privateSet$1(this, _heldRowKeys, new Set(columnKeys));
13645
+ __privateSet$1(this, _pendingReplaces, __privateGet$1(this, _pendingReplaces) + 1);
13646
+ try {
13647
+ yield tabulator.setData(this.assets.map((asset) => this.toRow(asset, columnKeys)));
13648
+ } finally {
13649
+ __privateSet$1(this, _pendingReplaces, __privateGet$1(this, _pendingReplaces) - 1);
13650
+ }
13651
+ }
13652
+ this.markCurrentRow(this.selectedAssetId, true);
13653
+ this.observeLastRow();
13654
+ this.reportRestartedRowCount();
13655
+ this.reportHeldRowCount();
13656
+ });
13657
+ }
13658
+ handleTableBuilt(event) {
13659
+ var _a2, _b2;
13660
+ event.stopPropagation();
13661
+ __privateSet$1(this, _builtTable, (_b2 = (_a2 = this.tableEl) == null ? void 0 : _a2.tabulatorInstance) != null ? _b2 : void 0);
13662
+ __privateSet$1(this, _syncedAssets, []);
13663
+ void this.syncRows();
13664
+ }
13665
+ /**
13666
+ * `setData` replaces the rows only once its debounce runs out, and Tabulator emits `dataLoaded` just
13667
+ * before it does. Until then, the old rows stay on the page with their hover and focus.
13668
+ */
13669
+ handleDataLoaded(event) {
13670
+ event.stopPropagation();
13671
+ __privateSet$1(this, _hoveredRow, void 0);
13672
+ __privateSet$1(this, _focusedCta, void 0);
13673
+ __privateGet$1(this, _renderedCtas).clear();
13674
+ __privateSet$1(this, _ctaFittedLabel, void 0);
13675
+ }
13676
+ /**
13677
+ * Every `setColumns` builds the columns again from the host definitions, which keep the
13678
+ * percentage: `cx-table` calls it from its own `tableBuilt` handler, after this component's has
13679
+ * run, and again for every new column set.
13680
+ */
13681
+ handleColumnsLoaded(event) {
13682
+ var _a2;
13683
+ event.stopPropagation();
13684
+ const tabulator = (_a2 = this.tableEl) == null ? void 0 : _a2.tabulatorInstance;
13685
+ if (tabulator && !tabulator.destroyed) {
13686
+ this.pinPercentWidths(tabulator);
13687
+ }
13688
+ }
13689
+ willUpdate(changedProperties) {
13690
+ super.willUpdate(changedProperties);
13691
+ const signature = columnsSignature(this.columns);
13692
+ const columnsChanged = signature !== __privateGet$1(this, _columnsSignature);
13693
+ const tableRemounts = changedProperties.get("empty") === true && !this.empty;
13694
+ if (columnsChanged) {
13695
+ __privateSet$1(this, _columnsSignature, signature);
13696
+ __privateSet$1(this, _rowsNeedRebuild, this.hasUpdated && this.resolveColumnKeys().some((key) => !__privateGet$1(this, _heldRowKeys).has(key)));
13697
+ this.forgetRemovedColumnWidths();
13698
+ }
13699
+ if (columnsChanged || tableRemounts) {
13700
+ __privateSet$1(this, _columnDefinitions, this.buildColumnDefinitions());
13701
+ } else if (changedProperties.has("hiddenFields")) {
13702
+ this.applyHiddenFields();
13703
+ }
13704
+ }
13705
+ /**
13706
+ * Through Tabulator's own column visibility: new definitions would reach it through `setColumns`,
13707
+ * and the rows would have to be rebuilt, which scrolls back to the top.
13708
+ */
13709
+ applyHiddenFields() {
13710
+ const hidden = new Set(this.hiddenFields);
13711
+ const keys2 = this.resolveColumnKeys();
13712
+ __privateGet$1(this, _columnDefinitions).forEach((definition) => {
13713
+ var _a2;
13714
+ const field = String(definition.field);
13715
+ const hostColumn = this.columns[keys2.indexOf(field)];
13716
+ if (!hostColumn) {
13717
+ return;
13718
+ }
13719
+ const isHidden = hidden.has(hostColumn.field);
13720
+ const column = (_a2 = this.tabulator) == null ? void 0 : _a2.getColumn(field);
13721
+ definition.hidden = isHidden || void 0;
13722
+ if (column && column.isVisible() === isHidden) {
13723
+ if (isHidden) {
13724
+ column.hide();
13725
+ } else {
13726
+ void column.show();
13727
+ }
13728
+ }
13729
+ });
13730
+ }
13731
+ updated(changedProperties) {
13732
+ super.updated(changedProperties);
13733
+ if (__privateGet$1(this, _rowsNeedRebuild)) {
13734
+ __privateSet$1(this, _rowsNeedRebuild, false);
13735
+ void this.rebuildRows();
13736
+ }
13737
+ }
13738
+ /** A column the host stops configuring starts again from the host's width if it comes back. */
13739
+ forgetRemovedColumnWidths() {
13740
+ const fields = new Set(this.columns.map((column) => column.field));
13741
+ [...__privateGet$1(this, _resizedWidths).keys()].filter((field) => !fields.has(field)).forEach((field) => __privateGet$1(this, _resizedWidths).delete(field));
13742
+ }
13743
+ /** Once `cx-table` has taken the new column definitions. */
13744
+ rebuildRows() {
13745
+ return __async(this, null, function* () {
13746
+ var _a2;
13747
+ yield (_a2 = this.tableEl) == null ? void 0 : _a2.updateComplete;
13748
+ yield this.syncRows(true);
13749
+ });
13750
+ }
13751
+ handleAssetsChange(previous) {
13752
+ const previousAssets = previous != null ? previous : [];
13753
+ if (this.assets.length === previousAssets.length && this.assets.every((asset, index) => asset === previousAssets[index])) {
13754
+ return;
13755
+ }
13756
+ this.assetMap.clear();
13757
+ this.assets.forEach((item) => this.assetMap.set(item.id, item));
13758
+ if (!isAppendOf(previousAssets, this.assets)) {
13759
+ __privateSet$1(this, _lastRowCount, void 0);
13760
+ }
13761
+ void this.syncRows();
13762
+ }
13763
+ handleLoadingChange() {
13764
+ return __async(this, null, function* () {
13765
+ if (this.loading) {
13766
+ return;
13767
+ }
13768
+ yield this.updateComplete;
13769
+ if (__privateGet$1(this, _pendingReplaces) === 0) {
13770
+ this.reportHeldRowCount();
13771
+ }
13772
+ });
13773
+ }
13774
+ handleSelectedAssetIdChange(previous) {
13775
+ this.markCurrentRow(previous, false);
13776
+ this.markCurrentRow(this.selectedAssetId, true);
13777
+ this.paintAssetCta(previous);
13778
+ this.paintAssetCta(this.selectedAssetId);
13779
+ }
13780
+ handleBusyAssetIdChange(previous) {
13781
+ this.paintAssetCta(previous);
13782
+ this.paintAssetCta(this.busyAssetId);
13783
+ }
13784
+ handleCtaTextChange() {
13785
+ var _a2, _b2;
13786
+ (_b2 = ((_a2 = this.tabulator) == null ? void 0 : _a2.getColumn(CTA_FIELD)) || void 0) == null ? void 0 : _b2.getElement().setAttribute("aria-label", this.ctaLabel);
13787
+ __privateGet$1(this, _renderedCtas).forEach((cta) => this.paintCta(cta));
13788
+ this.fitRenderedCta();
13789
+ }
13790
+ /** Every CTA shares the label, so one on the page measures the column for all of them. */
13791
+ fitRenderedCta() {
13792
+ const rendered = [...__privateGet$1(this, _renderedCtas)].find((cta) => cta.button.isConnected);
13793
+ if (rendered) {
13794
+ void this.fitCtaColumn(rendered);
13795
+ }
13796
+ }
13797
+ /** In place, as a relabel is: a CTA built again would drop the keyboard focus the old one held. */
13798
+ setNoHover(noHover) {
13799
+ if (noHover === __privateGet$1(this, _hasNoHover)) {
13800
+ return;
13801
+ }
13802
+ __privateSet$1(this, _hasNoHover, noHover);
13803
+ __privateGet$1(this, _renderedCtas).forEach((cta) => this.paintCta(cta));
13804
+ }
13805
+ connectedCallback() {
13806
+ super.connectedCallback();
13807
+ __privateSet$1(this, _noHoverQueries, NO_HOVER_QUERIES.map((media) => window.matchMedia(media)));
13808
+ __privateGet$1(this, _noHoverQueries).forEach((list) => list.addEventListener("change", this.handleNoHoverChange));
13809
+ this.handleNoHoverChange();
13810
+ if (this.hasUpdated) {
13811
+ __privateSet$1(this, _columnDefinitions, this.buildColumnDefinitions());
13812
+ this.requestUpdate();
13813
+ }
13814
+ }
13815
+ disconnectedCallback() {
13816
+ var _a2;
13817
+ super.disconnectedCallback();
13818
+ __privateGet$1(this, _noHoverQueries).forEach((list) => list.removeEventListener("change", this.handleNoHoverChange));
13819
+ __privateSet$1(this, _noHoverQueries, []);
13820
+ (_a2 = __privateGet$1(this, _lastRowObserver)) == null ? void 0 : _a2.disconnect();
13821
+ this.debouncedCalculatePageSize.cancel();
13822
+ this.debouncedHandleScrollEnd.cancel();
13823
+ this.debouncedHandleLastRowVisible.cancel();
13824
+ this.debouncedRedrawTable.cancel();
13825
+ }
13826
+ handleResize(event) {
13827
+ event.stopPropagation();
13828
+ const entries = event.detail.entries;
13829
+ if (entries[0].target !== this.containerEl) {
13830
+ return;
13831
+ }
13832
+ const { height, width } = entries[0].contentRect;
13833
+ this.debouncedCalculatePageSize(height);
13834
+ this.refitToContainer(width, height);
13835
+ void this.convertPendingPercentWidths();
13836
+ this.fitRenderedCta();
13837
+ }
13838
+ /**
13839
+ * `cx-table` lays its columns and rows out again for a new container size only until the first
13840
+ * drag of a column divider. After it, the columns keep the old width and the rows fill only the old
13841
+ * height, which leaves a blank area right of the columns or under the rows.
13842
+ */
13843
+ refitToContainer(width, height) {
13844
+ const size = `${Math.round(width)}x${Math.round(height)}`;
13845
+ const previous = __privateGet$1(this, _containerSize);
13846
+ __privateSet$1(this, _containerSize, size);
13847
+ if (previous !== void 0 && previous !== size) {
13848
+ this.debouncedRedrawTable();
13849
+ }
13850
+ }
13851
+ calculatePageSize(height) {
13852
+ if (Math.abs(__privateGet$1(this, _lastHeight) - height) < 10) {
13853
+ return;
13854
+ }
13855
+ __privateSet$1(this, _lastHeight, height);
13856
+ this.reportRowCount();
13857
+ }
13858
+ /** Counts the rows the last measured height shows, and tells the host when the count changes. */
13859
+ reportRowCount() {
13860
+ const rowCount = Math.ceil(this.resolveVisibleHeight(__privateGet$1(this, _lastHeight)) / ROW_HEIGHT);
13861
+ __privateSet$1(this, _rowCountHeld, this.loading && this.assets.length > 0);
13862
+ if (rowCount === __privateGet$1(this, _lastRowCount) || __privateGet$1(this, _rowCountHeld)) {
13863
+ return;
13864
+ }
13865
+ __privateSet$1(this, _lastRowCount, rowCount);
13866
+ this.emit("cx-content-browser-grid-resize", {
13867
+ detail: {
13868
+ columnCount: 1,
13869
+ rowCount
13870
+ }
13871
+ });
13872
+ }
13873
+ /**
13874
+ * Only once the restarted rows are in: the host asks for the next page at once, and a page that
13875
+ * lands while `setData` waits replaces the rows again and holds them back for another half second.
13876
+ * A measurement still in its debounce reports in the same count, because a second count inside the
13877
+ * host's 200 ms fetch debounce cancels the page the first count asked for.
13878
+ */
13879
+ reportRestartedRowCount() {
13880
+ if (!this.isConnected || __privateGet$1(this, _lastRowCount) !== void 0 || __privateGet$1(this, _lastHeight) === 0) {
13881
+ return;
13882
+ }
13883
+ this.debouncedCalculatePageSize.flush();
13884
+ this.reportRowCount();
13885
+ }
13886
+ /**
13887
+ * Once the load ends and any rows it brings are in, the count measured meanwhile can ask for the
13888
+ * page after it. A table that is not built yet reports it at once.
13889
+ */
13890
+ reportHeldRowCount() {
13891
+ if (!__privateGet$1(this, _rowCountHeld) || !this.isConnected) {
13892
+ return;
13893
+ }
13894
+ this.debouncedCalculatePageSize.flush();
13895
+ this.reportRowCount();
13896
+ }
13897
+ /**
13898
+ * The rows never size the container (see the styles), so this is the height the host gives the
13899
+ * picker, and it can run past the viewport. No scrollport shows more rows than the viewport, so
13900
+ * while the rows do not overflow the scrollport the count stops there, and the page scrolls to the
13901
+ * rest, where the last row coming into view asks for more (`observeLastRow`). One that overflows,
13902
+ * or holds no rows yet, measures the space its container gives it and is used as is.
13903
+ */
13904
+ resolveVisibleHeight(height) {
13905
+ return this.isSizedByRows() ? Math.min(height, window.innerHeight) : height;
13906
+ }
13907
+ isSizedByRows() {
13908
+ var _a2, _b2;
13909
+ const scrollport = this.scrollport;
13910
+ return ((_b2 = (_a2 = this.tabulator) == null ? void 0 : _a2.getDataCount()) != null ? _b2 : 0) > 0 && scrollport !== void 0 && scrollport.scrollHeight <= scrollport.clientHeight + 1;
13911
+ }
13912
+ /**
13913
+ * A scrollport that holds its rows without overflowing never scrolls, so its own scroll never
13914
+ * reaches the end: the page scrolls instead. Once the table is taller than the viewport its count
13915
+ * is capped and stops fetching, which leaves the last row coming into view as the only sign the
13916
+ * user wants more.
13917
+ */
13918
+ observeLastRow() {
13919
+ var _a2, _b2, _c2, _d2;
13920
+ (_a2 = __privateGet$1(this, _lastRowObserver)) == null ? void 0 : _a2.disconnect();
13921
+ const rows = (_c2 = (_b2 = this.tabulator) == null ? void 0 : _b2.getRows()) != null ? _c2 : [];
13922
+ const lastRow = rows[rows.length - 1];
13923
+ if (!lastRow) {
13924
+ return;
13925
+ }
13926
+ (_d2 = __privateGet$1(this, _lastRowObserver)) != null ? _d2 : __privateSet$1(this, _lastRowObserver, new IntersectionObserver((entries) => {
13927
+ if (entries.some((entry) => entry.isIntersecting)) {
13928
+ this.debouncedHandleLastRowVisible();
13929
+ }
13930
+ }));
13931
+ __privateGet$1(this, _lastRowObserver).observe(lastRow.getElement());
13932
+ }
13933
+ handleLastRowVisible() {
13934
+ if (this.isSizedByRows() && this.containerEl.clientHeight > window.innerHeight) {
13935
+ this.handleScrollEnd();
13936
+ }
13937
+ }
13938
+ insertAsset(assetId) {
13939
+ var _a2;
13940
+ if (!assetId || ((_a2 = this.assetMap.get(assetId)) == null ? void 0 : _a2.inColdStorage)) {
13941
+ return;
13942
+ }
13943
+ this.emit("cx-content-browser-grid-click", {
13944
+ detail: {
13945
+ id: assetId
13946
+ }
13947
+ });
13948
+ }
13949
+ handleColumnResized(event) {
13950
+ var _a2;
13951
+ event.stopPropagation();
13952
+ const [column] = event.detail.args;
13953
+ const field = (_a2 = this.columns[this.resolveColumnKeys().indexOf(column.getField())]) == null ? void 0 : _a2.field;
13954
+ if (field === void 0) {
13955
+ return;
13956
+ }
13957
+ const width = Math.round(column.getWidth());
13958
+ column.getDefinition().width = width;
13959
+ __privateGet$1(this, _resizedWidths).set(field, width);
13960
+ this.emit("cx-content-browser-table-column-resize", {
13961
+ detail: {
13962
+ field,
13963
+ width
13964
+ }
13965
+ });
13966
+ this.redrawTable();
13967
+ }
13968
+ handleScrollVertical(event) {
13969
+ event.stopPropagation();
13970
+ this.releaseDetachedCta();
13971
+ const scrollport = this.scrollport;
13972
+ if (scrollport && scrollport.scrollTop + scrollport.clientHeight >= scrollport.scrollHeight - ROW_HEIGHT) {
13973
+ this.debouncedHandleScrollEnd();
12660
13974
  }
12661
- if (this.canLogout) {
12662
- return b`
12663
- <cx-dropdown distance="4">
12664
- <cx-avatar
12665
- slot="trigger"
12666
- class="header__user-avatar header__user-avatar--dropdown-trigger"
12667
- label=${this.localize.term("userAvatar")}
12668
- image=${this.avatar}
12669
- loading="lazy"
12670
- ></cx-avatar>
12671
- <cx-menu @cx-select=${this.handleMenuSelect}>
12672
- <cx-menu-item class="header__user-info" readonly>
12673
- <cx-line-clamp lines="1">${this.fullName}</cx-line-clamp>
12674
- <cx-avatar
12675
- slot="prefix"
12676
- label=${this.localize.term("userAvatar")}
12677
- image=${this.avatar}
12678
- loading="lazy"
12679
- style=${o$1({
12680
- "--size": "var(--cx-font-size-x-large)"
12681
- })}
12682
- ></cx-avatar>
12683
- </cx-menu-item>
12684
- <cx-divider></cx-divider>
12685
- <cx-menu-item value=${LOGOUT_ITEM_VALUE}>
12686
- ${this.localize.term("logout")}
12687
- <cx-icon slot="prefix" name="logout"></cx-icon>
12688
- </cx-menu-item>
12689
- </cx-menu>
12690
- </cx-dropdown>
12691
- `;
13975
+ }
13976
+ handleScrollEnd() {
13977
+ if (this.hasMore && !this.loading) {
13978
+ this.emit("cx-content-browser-grid-scroll-end");
12692
13979
  }
12693
- return b`
12694
- <cx-avatar
12695
- class="header__user-avatar"
12696
- label=${this.localize.term("userAvatar")}
12697
- image=${this.avatar}
12698
- loading="lazy"
12699
- ></cx-avatar>
12700
- `;
12701
13980
  }
12702
13981
  render() {
12703
- const containerClasses = {
12704
- container: true,
12705
- "container--bordered": this.bordered
12706
- };
12707
13982
  return b`
12708
- <cx-space class=${e$5(containerClasses)} direction="vertical" spacing="small">
12709
- <cx-space class="header" justify-content="space-between" align-items="center">
12710
- <div class="header__title">
12711
- <cx-space class="header" justify-content="space-between" align-items="center" spacing="x-small">
12712
- ${this.renderTitle()}
12713
- </cx-space>
12714
- </div>
12715
- <div class="header__menu">
12716
- ${this.renderUserDropdown()}
12717
- ${n$5(
12718
- this.showCloseButton,
13983
+ <div
13984
+ class="content-browser-table-loading"
13985
+ style=${o$1({
13986
+ opacity: this.loading ? 1 : 0
13987
+ })}
13988
+ >
13989
+ <cx-progress-bar indeterminate></cx-progress-bar>
13990
+ </div>
13991
+ <cx-resize-observer @cx-resize=${this.handleResize}>
13992
+ <div class="content-browser-table">
13993
+ ${n$5(
13994
+ this.empty,
12719
13995
  () => b`
12720
- <cx-icon-button
12721
- name="close"
12722
- label=${this.localize.term("close")}
12723
- @click=${this.handleCloseClick}
12724
- ></cx-icon-button>
12725
- `,
12726
- () => A
13996
+ <cx-content-browser-no-result
13997
+ class="content-browser-table__empty"
13998
+ icon="search_off"
13999
+ message=${this.localize.term("noResults")}
14000
+ ></cx-content-browser-no-result>
14001
+ `,
14002
+ // Left without `data`: reassigning it calls `setData`, which scrolls back to the top on
14003
+ // every page, so rows are handed to the Tabulator instance directly (see `syncRows`).
14004
+ () => b`
14005
+ <cx-table
14006
+ class="content-browser-table__table"
14007
+ layout="fitColumns"
14008
+ placeholder=""
14009
+ no-selectable
14010
+ no-clipboard
14011
+ .columns=${__privateGet$1(this, _columnDefinitions)}
14012
+ .columnDefaults=${COLUMN_DEFAULTS}
14013
+ .rowHeight=${this.hasMultilineColumn ? void 0 : ROW_HEIGHT}
14014
+ @cx-table.tableBuilt=${this.handleTableBuilt}
14015
+ @cx-table.dataLoaded=${this.handleDataLoaded}
14016
+ @cx-table.columnsLoaded=${this.handleColumnsLoaded}
14017
+ @cx-table.columnResized=${this.handleColumnResized}
14018
+ @cx-table.scrollVertical=${this.handleScrollVertical}
14019
+ @cx-table.renderStarted=${this.handleRenderStarted}
14020
+ @cx-table.renderComplete=${this.handleRenderComplete}
14021
+ ></cx-table>
14022
+ `
12727
14023
  )}
12728
- </div>
12729
- </cx-space>
12730
- <slot></slot>
12731
- </cx-space>
14024
+ </div>
14025
+ </cx-resize-observer>
12732
14026
  `;
12733
14027
  }
12734
14028
  };
12735
- CxContentBrowserHeader.styles = [componentStyles, styles$1];
12736
- CxContentBrowserHeader.dependencies = {
12737
- "cx-avatar": CxAvatar,
12738
- "cx-divider": CxDivider,
12739
- "cx-dropdown": CxDropdown,
12740
- "cx-icon": CxIcon,
12741
- "cx-icon-button": CxIconButton,
14029
+ _columnDefinitions = /* @__PURE__ */ new WeakMap();
14030
+ _columnsSignature = /* @__PURE__ */ new WeakMap();
14031
+ _columnKeys = /* @__PURE__ */ new WeakMap();
14032
+ _rowsNeedRebuild = /* @__PURE__ */ new WeakMap();
14033
+ _heldRowKeys = /* @__PURE__ */ new WeakMap();
14034
+ _resizedWidths = /* @__PURE__ */ new WeakMap();
14035
+ _percentWidthsPending = /* @__PURE__ */ new WeakMap();
14036
+ _ctas = /* @__PURE__ */ new WeakMap();
14037
+ _renderedCtas = /* @__PURE__ */ new WeakMap();
14038
+ _pointerTrackedRows = /* @__PURE__ */ new WeakMap();
14039
+ _hoveredRow = /* @__PURE__ */ new WeakMap();
14040
+ _focusedCta = /* @__PURE__ */ new WeakMap();
14041
+ _ctaFocusedAtRender = /* @__PURE__ */ new WeakMap();
14042
+ _noHoverQueries = /* @__PURE__ */ new WeakMap();
14043
+ _hasNoHover = /* @__PURE__ */ new WeakMap();
14044
+ _ctaColumnWidth = /* @__PURE__ */ new WeakMap();
14045
+ _ctaFittedLabel = /* @__PURE__ */ new WeakMap();
14046
+ _builtTable = /* @__PURE__ */ new WeakMap();
14047
+ _syncedAssets = /* @__PURE__ */ new WeakMap();
14048
+ _pendingReplaces = /* @__PURE__ */ new WeakMap();
14049
+ _lastHeight = /* @__PURE__ */ new WeakMap();
14050
+ _containerSize = /* @__PURE__ */ new WeakMap();
14051
+ _lastRowCount = /* @__PURE__ */ new WeakMap();
14052
+ _rowCountHeld = /* @__PURE__ */ new WeakMap();
14053
+ _lastRowObserver = /* @__PURE__ */ new WeakMap();
14054
+ CxContentBrowserTable.styles = [componentStyles, styles$1];
14055
+ CxContentBrowserTable.dependencies = {
14056
+ "cx-button": CxButton,
14057
+ "cx-content-browser-no-result": CxContentBrowserNoResult,
12742
14058
  "cx-line-clamp": CxLineClamp,
12743
- "cx-menu": CxMenu,
12744
- "cx-menu-item": CxMenuItem,
12745
- "cx-skeleton": CxSkeleton,
12746
- "cx-space": CxSpace,
12747
- "cx-typography": CxTypography
14059
+ "cx-progress-bar": CxProgressBar,
14060
+ "cx-resize-observer": CxResizeObserver,
14061
+ "cx-table": CxTable
12748
14062
  };
12749
14063
  __decorateClass$1([
12750
- n$6({ type: Boolean })
12751
- ], CxContentBrowserHeader.prototype, "bordered", 2);
14064
+ e$7(".content-browser-table")
14065
+ ], CxContentBrowserTable.prototype, "containerEl", 2);
12752
14066
  __decorateClass$1([
12753
- n$6({ attribute: "application-name", type: String })
12754
- ], CxContentBrowserHeader.prototype, "applicationName", 2);
14067
+ e$7("cx-table")
14068
+ ], CxContentBrowserTable.prototype, "tableEl", 2);
12755
14069
  __decorateClass$1([
12756
- n$6({ type: Boolean })
12757
- ], CxContentBrowserHeader.prototype, "loading", 2);
14070
+ n$6({ attribute: "assets", reflect: false, type: Array })
14071
+ ], CxContentBrowserTable.prototype, "assets", 2);
12758
14072
  __decorateClass$1([
12759
- n$6({ attribute: "is-fetching", type: Boolean })
12760
- ], CxContentBrowserHeader.prototype, "isFetching", 2);
14073
+ n$6({ attribute: "columns", reflect: false, type: Array })
14074
+ ], CxContentBrowserTable.prototype, "columns", 2);
12761
14075
  __decorateClass$1([
12762
- n$6({ attribute: "avatar", type: String })
12763
- ], CxContentBrowserHeader.prototype, "avatar", 2);
14076
+ n$6({ attribute: "cta-text", reflect: false, type: String })
14077
+ ], CxContentBrowserTable.prototype, "ctaText", 2);
12764
14078
  __decorateClass$1([
12765
- n$6({ attribute: "full-name", type: String })
12766
- ], CxContentBrowserHeader.prototype, "fullName", 2);
14079
+ n$6({ attribute: "cta-text-transform", reflect: false, type: String })
14080
+ ], CxContentBrowserTable.prototype, "ctaTextTransform", 2);
12767
14081
  __decorateClass$1([
12768
- n$6({ attribute: "folder-title", type: String })
12769
- ], CxContentBrowserHeader.prototype, "folderTitle", 2);
14082
+ n$6({ attribute: "empty", reflect: true, type: Boolean })
14083
+ ], CxContentBrowserTable.prototype, "empty", 2);
12770
14084
  __decorateClass$1([
12771
- n$6({ attribute: "show-close-button", type: Boolean })
12772
- ], CxContentBrowserHeader.prototype, "showCloseButton", 2);
14085
+ n$6({ attribute: "has-more", reflect: true, type: Boolean })
14086
+ ], CxContentBrowserTable.prototype, "hasMore", 2);
12773
14087
  __decorateClass$1([
12774
- n$6({ attribute: "can-logout", type: Boolean })
12775
- ], CxContentBrowserHeader.prototype, "canLogout", 2);
12776
- CxContentBrowserHeader = __decorateClass$1([
12777
- customElement("cx-content-browser-header")
12778
- ], CxContentBrowserHeader);
14088
+ n$6({ attribute: "loading", reflect: true, type: Boolean })
14089
+ ], CxContentBrowserTable.prototype, "loading", 2);
14090
+ __decorateClass$1([
14091
+ n$6({ attribute: "selected-asset-id", reflect: true, type: String })
14092
+ ], CxContentBrowserTable.prototype, "selectedAssetId", 2);
14093
+ __decorateClass$1([
14094
+ n$6({ attribute: false })
14095
+ ], CxContentBrowserTable.prototype, "busyAssetId", 2);
14096
+ __decorateClass$1([
14097
+ n$6({ attribute: false })
14098
+ ], CxContentBrowserTable.prototype, "hiddenFields", 2);
14099
+ __decorateClass$1([
14100
+ watch("assets")
14101
+ ], CxContentBrowserTable.prototype, "handleAssetsChange", 1);
14102
+ __decorateClass$1([
14103
+ watch("loading", { waitUntilFirstUpdate: true })
14104
+ ], CxContentBrowserTable.prototype, "handleLoadingChange", 1);
14105
+ __decorateClass$1([
14106
+ watch("selectedAssetId", { waitUntilFirstUpdate: true })
14107
+ ], CxContentBrowserTable.prototype, "handleSelectedAssetIdChange", 1);
14108
+ __decorateClass$1([
14109
+ watch("busyAssetId", { waitUntilFirstUpdate: true })
14110
+ ], CxContentBrowserTable.prototype, "handleBusyAssetIdChange", 1);
14111
+ __decorateClass$1([
14112
+ watch(["ctaText", "ctaTextTransform"], { waitUntilFirstUpdate: true })
14113
+ ], CxContentBrowserTable.prototype, "handleCtaTextChange", 1);
14114
+ CxContentBrowserTable = __decorateClass$1([
14115
+ customElement("cx-content-browser-table")
14116
+ ], CxContentBrowserTable);
12779
14117
  const appendPathAndQuery = (baseUrl, pathSuffix, extraQueryParams = []) => {
12780
14118
  const questionMarkIndex = baseUrl.indexOf("?");
12781
14119
  const hashIndex = baseUrl.indexOf("#");
@@ -13167,8 +14505,26 @@ function apiGetAssetsByIDs(_0) {
13167
14505
  }
13168
14506
  });
13169
14507
  }
14508
+ const ASSET_LIST_FIELDS = [
14509
+ DEFAULT_VIEW_SIZE,
14510
+ FIELD_DOC_TITLE,
14511
+ FIELD_DOC_TYPE,
14512
+ FIELD_EXTENSION,
14513
+ FIELD_FILE_SIZE,
14514
+ FIELD_IDENTIFIER,
14515
+ FIELD_KEYWORDS,
14516
+ FIELD_MAX_HEIGHT,
14517
+ FIELD_MAX_WIDTH,
14518
+ FIELD_RECORD_ID,
14519
+ FIELD_SUBTYPE,
14520
+ FIELD_TITLE_WITH_FALLBACK,
14521
+ FIELD_UPDATED_FILE_NAME,
14522
+ FIELD_STORAGE_GROUP,
14523
+ ORIGINAL_VIEW_SIZE
14524
+ ];
13170
14525
  function apiGetAssets(_0) {
13171
14526
  return __async(this, arguments, function* ({
14527
+ fields,
13172
14528
  folderId,
13173
14529
  isSeeThrough,
13174
14530
  limitedToDocTypes = [],
@@ -13179,25 +14535,17 @@ function apiGetAssets(_0) {
13179
14535
  start,
13180
14536
  useSession
13181
14537
  }) {
14538
+ var _a2;
14539
+ const validatedFields = (_a2 = fields == null ? void 0 : fields.filter((field) => field && typeof field === "string")) != null ? _a2 : [];
13182
14540
  try {
13183
14541
  const response = yield http.request({
13184
14542
  data: __spreadValues({
13185
14543
  Fields: [
13186
- DEFAULT_VIEW_SIZE,
13187
- FIELD_DOC_TITLE,
13188
- FIELD_DOC_TYPE,
13189
- FIELD_EXTENSION,
13190
- FIELD_FILE_SIZE,
13191
- FIELD_IDENTIFIER,
13192
- FIELD_KEYWORDS,
13193
- FIELD_MAX_HEIGHT,
13194
- FIELD_MAX_WIDTH,
13195
- FIELD_RECORD_ID,
13196
- FIELD_SUBTYPE,
13197
- FIELD_TITLE_WITH_FALLBACK,
13198
- FIELD_UPDATED_FILE_NAME,
13199
- FIELD_STORAGE_GROUP,
13200
- ORIGINAL_VIEW_SIZE
14544
+ ...ASSET_LIST_FIELDS,
14545
+ ...validatedFields.filter((field, index) => {
14546
+ const seen = [...ASSET_LIST_FIELDS, ...validatedFields.slice(0, index)];
14547
+ return !seen.some((item) => item.toLowerCase() === field.toLowerCase());
14548
+ })
13201
14549
  ],
13202
14550
  Limit: pageSize || void 0,
13203
14551
  LimitedToDocTypes: limitedToDocTypes,
@@ -13213,15 +14561,22 @@ function apiGetAssets(_0) {
13213
14561
  transformResponse: [
13214
14562
  ...Array.isArray(http.defaults.transformResponse) ? http.defaults.transformResponse : [],
13215
14563
  (rawResponse) => {
13216
- var _a2, _b2;
13217
- const mappedItems = (_b2 = (_a2 = rawResponse.contentItems) == null ? void 0 : _a2.map((item) => {
13218
- var _a3, _b3, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l;
13219
- let extension = (_a3 = item.fields[FIELD_EXTENSION]) != null ? _a3 : "";
14564
+ var _a3, _b2;
14565
+ const mappedItems = (_b2 = (_a3 = rawResponse.contentItems) == null ? void 0 : _a3.map((item) => {
14566
+ var _a4, _b3, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l;
14567
+ let extension = (_a4 = item.fields[FIELD_EXTENSION]) != null ? _a4 : "";
13220
14568
  const name = resolveAssetCaption(item.fields);
13221
14569
  if (extension && !extension.startsWith(".")) {
13222
14570
  extension = "." + extension;
13223
14571
  }
13224
- return {
14572
+ return __spreadProps(__spreadValues({}, validatedFields.reduce((acc, field) => {
14573
+ var _a5, _b4;
14574
+ const sourceField = (_a5 = ASSET_LIST_FIELDS.find(
14575
+ (defaultField) => defaultField.toLowerCase() === field.toLowerCase()
14576
+ )) != null ? _a5 : field;
14577
+ acc[field] = (_b4 = item.fields[sourceField]) != null ? _b4 : "";
14578
+ return acc;
14579
+ }, {})), {
13225
14580
  allowATSLink: item.fields[FIELD_ALLOW_ATS_LINK] === "True",
13226
14581
  docSubType: (_b3 = item.fields[FIELD_SUBTYPE]) != null ? _b3 : "",
13227
14582
  docType: (_c2 = item.fields[FIELD_DOC_TYPE]) != null ? _c2 : "",
@@ -13238,12 +14593,13 @@ function apiGetAssets(_0) {
13238
14593
  size: (_j = item.fields[FIELD_FILE_SIZE]) != null ? _j : "0 MB",
13239
14594
  tags: (_k = item.fields[FIELD_KEYWORDS]) != null ? _k : "",
13240
14595
  width: (_l = item.fields[FIELD_MAX_WIDTH]) != null ? _l : "0"
13241
- };
14596
+ });
13242
14597
  })) != null ? _b2 : [];
13243
14598
  return {
13244
14599
  facets: rawResponse.facets,
13245
14600
  items: mappedItems,
13246
- totalCount: rawResponse.totalCount
14601
+ totalCount: rawResponse.totalCount,
14602
+ unreadableFields: Array.isArray(rawResponse.unreadableFields) ? rawResponse.unreadableFields.filter((field) => typeof field === "string") : []
13247
14603
  };
13248
14604
  }
13249
14605
  ],
@@ -13254,7 +14610,8 @@ function apiGetAssets(_0) {
13254
14610
  return {
13255
14611
  facets: [],
13256
14612
  items: [],
13257
- totalCount: 0
14613
+ totalCount: 0,
14614
+ unreadableFields: []
13258
14615
  };
13259
14616
  }
13260
14617
  });
@@ -13711,8 +15068,16 @@ var intersection = baseRest(function(arrays) {
13711
15068
  var mapped = arrayMap(arrays, castArrayLikeObject);
13712
15069
  return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
13713
15070
  });
15071
+ function narrowUnreadableFields(unreadableFields, page) {
15072
+ if (page.items.length === 0) {
15073
+ return unreadableFields;
15074
+ }
15075
+ const flagged = new Set(page.unreadableFields.map(toFieldKey));
15076
+ return unreadableFields.filter((field) => flagged.has(toFieldKey(field)));
15077
+ }
13714
15078
  class FetchAndMergeAssetsController {
13715
15079
  constructor(host, {
15080
+ additionalFields,
13716
15081
  availableDocTypes,
13717
15082
  baseUrl,
13718
15083
  defaultFolderId,
@@ -13734,6 +15099,7 @@ class FetchAndMergeAssetsController {
13734
15099
  this.facets = [];
13735
15100
  this.items = [];
13736
15101
  this.totalCount = 0;
15102
+ this.unreadableFields = [];
13737
15103
  this.lastRequest = null;
13738
15104
  this.sortOrders = {};
13739
15105
  this.parameters = null;
@@ -13754,6 +15120,7 @@ class FetchAndMergeAssetsController {
13754
15120
  this._debounceResolve = null;
13755
15121
  this.host = host;
13756
15122
  this.availableDocTypes = availableDocTypes;
15123
+ this.additionalFields = additionalFields != null ? additionalFields : [];
13757
15124
  this.defaultFolderId = defaultFolderId;
13758
15125
  this.defaultIsSeeThrough = defaultIsSeeThrough;
13759
15126
  this.defaultSearchText = defaultSearchText;
@@ -13884,6 +15251,14 @@ class FetchAndMergeAssetsController {
13884
15251
  }
13885
15252
  this.host.requestUpdate();
13886
15253
  }
15254
+ /**
15255
+ * Table columns are host configuration and can be reconfigured after mount, unlike the rest of
15256
+ * these options — every later fetch must ask for the current field list, not the one that
15257
+ * happened to be set when the controller was constructed.
15258
+ */
15259
+ updateAdditionalFields(additionalFields) {
15260
+ this.additionalFields = additionalFields;
15261
+ }
13887
15262
  updateAuth(token, useSession) {
13888
15263
  if (this.useSiteSession) {
13889
15264
  return;
@@ -14026,6 +15401,7 @@ class FetchAndMergeAssetsController {
14026
15401
  }
14027
15402
  }
14028
15403
  request = __spreadProps(__spreadValues({}, request), {
15404
+ fields: this.additionalFields,
14029
15405
  limitedToDocTypes: this.availableDocTypes
14030
15406
  });
14031
15407
  this.lastRequest = request;
@@ -14034,8 +15410,10 @@ class FetchAndMergeAssetsController {
14034
15410
  }));
14035
15411
  if (request.start && request.start > 0 && !forceRefetch) {
14036
15412
  this.items = uniqBy([...this.items, ...assets.items], "recordId");
15413
+ this.unreadableFields = narrowUnreadableFields(this.unreadableFields, assets);
14037
15414
  } else {
14038
15415
  this.items = assets.items;
15416
+ this.unreadableFields = assets.unreadableFields;
14039
15417
  }
14040
15418
  this.facets = this.mergeFacetsWithSelected(assets.facets, this.facets, request.selectedFacets);
14041
15419
  this.totalCount = assets.totalCount;
@@ -14219,6 +15597,7 @@ class FetchAndMergeAssetsController {
14219
15597
  request: this.lastRequest,
14220
15598
  sortOrders: this.sortOrders,
14221
15599
  totalCount: this.totalCount,
15600
+ unreadableFields: this.unreadableFields,
14222
15601
  userInfo: this.userInfo
14223
15602
  });
14224
15603
  return __privateGet(this, _lastData);
@@ -14238,6 +15617,7 @@ class FetchAndMergeAssetsController {
14238
15617
  this.facets = [];
14239
15618
  this.items = [];
14240
15619
  this.totalCount = 0;
15620
+ this.unreadableFields = [];
14241
15621
  this.sortOrders = {};
14242
15622
  }
14243
15623
  }
@@ -14293,6 +15673,9 @@ const styles = i$7`
14293
15673
  `;
14294
15674
  var __defProp2 = Object.defineProperty;
14295
15675
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
15676
+ var __typeError2 = (msg) => {
15677
+ throw TypeError(msg);
15678
+ };
14296
15679
  var __decorateClass = (decorators, target, key, kind) => {
14297
15680
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
14298
15681
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
@@ -14301,11 +15684,35 @@ var __decorateClass = (decorators, target, key, kind) => {
14301
15684
  if (kind && result) __defProp2(target, key, result);
14302
15685
  return result;
14303
15686
  };
15687
+ var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
15688
+ var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), member.get(obj));
15689
+ var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
15690
+ var __privateSet2 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), member.set(obj, value), value);
15691
+ var _openingAsset, _insertInFlight;
14304
15692
  const COMPUTED_FIELDS = ["ScrubUrl", "AllowATSLink"];
14305
15693
  const MOBILE_WIDTH_THRESHOLD = 480;
14306
15694
  const FORCE_OVERLAY_THRESHOLD = 650;
14307
15695
  const PERSISTENT_DRAWER_WIDTH = 400;
14308
15696
  const INITIAL_FOLDER_TIMEOUT_MS = 3e3;
15697
+ function resolvePageSize(view) {
15698
+ switch (view) {
15699
+ case GridView.Large:
15700
+ return 15;
15701
+ case GridView.Small:
15702
+ case TABLE_VIEW:
15703
+ return 30;
15704
+ default:
15705
+ return 20;
15706
+ }
15707
+ }
15708
+ const NO_HIDDEN_FIELDS = [];
15709
+ function findUnreadableColumnFields(columns, unreadableFields) {
15710
+ if (unreadableFields.length === 0) {
15711
+ return NO_HIDDEN_FIELDS;
15712
+ }
15713
+ const unreadable = new Set(unreadableFields.map(toFieldKey));
15714
+ return columns.map((column) => column.field).filter((field) => unreadable.has(toFieldKey(field)));
15715
+ }
14309
15716
  let CxContentBrowser = class extends CortexElement {
14310
15717
  constructor() {
14311
15718
  super(...arguments);
@@ -14331,6 +15738,7 @@ let CxContentBrowser = class extends CortexElement {
14331
15738
  this.canFavorite = false;
14332
15739
  this.canPinAsset = false;
14333
15740
  this.canUseProxies = false;
15741
+ this.autoSelectFormat = false;
14334
15742
  this.simplePick = false;
14335
15743
  this.canViewVersions = false;
14336
15744
  this.canTrack = false;
@@ -14339,6 +15747,7 @@ let CxContentBrowser = class extends CortexElement {
14339
15747
  this.ctaTextTransform = "capitalize";
14340
15748
  this.extraFields = [];
14341
15749
  this.defaultGridView = GridView.Medium;
15750
+ this.tableColumns = [];
14342
15751
  this.defaultSortOrderName = "";
14343
15752
  this.defaultSortDirection = "ascending";
14344
15753
  this.defaultSelectedFacets = {};
@@ -14377,28 +15786,58 @@ let CxContentBrowser = class extends CortexElement {
14377
15786
  this.isMobile = false;
14378
15787
  this.defaultPageSize = 10;
14379
15788
  this.initialFolderPending = false;
15789
+ this.busyAssetId = void 0;
15790
+ __privateAdd2(this, _openingAsset, false);
15791
+ __privateAdd2(this, _insertInFlight, false);
14380
15792
  }
14381
15793
  willUpdate(changedProperties) {
14382
15794
  super.willUpdate(changedProperties);
14383
15795
  if (!this.hasUpdated) {
14384
- this.view = this.defaultGridView;
15796
+ this.view = this.defaultGridView === TABLE_VIEW && !this.canUseTable ? GridView.Medium : this.defaultGridView;
15797
+ }
15798
+ }
15799
+ /**
15800
+ * Never trust the host's value: it also arrives by direct property assignment, past the converter.
15801
+ * Entries are checked one by one, not just the outer array — `field` is dereferenced while the
15802
+ * fetch controller is being built, where a throw leaves the controller unassigned and the picker
15803
+ * blank. `title` is only rendered, and Lit renders a nullish one as nothing, so a column is not
15804
+ * worth dropping over it.
15805
+ */
15806
+ get tableColumnList() {
15807
+ const columns = this.tableColumns;
15808
+ if (!Array.isArray(columns)) {
15809
+ return [];
14385
15810
  }
15811
+ const seen = /* @__PURE__ */ new Set();
15812
+ return columns.flatMap((column) => {
15813
+ if (!column || typeof column !== "object") {
15814
+ return [];
15815
+ }
15816
+ const { field } = column;
15817
+ if (typeof field !== "string") {
15818
+ return [];
15819
+ }
15820
+ const trimmed = field.trim();
15821
+ if (trimmed.length === 0 || seen.has(trimmed.toLowerCase())) {
15822
+ return [];
15823
+ }
15824
+ seen.add(trimmed.toLowerCase());
15825
+ return [trimmed === field ? column : __spreadProps(__spreadValues({}, column), { field: trimmed })];
15826
+ });
15827
+ }
15828
+ /**
15829
+ * This reads the configured columns, not the shown ones. The shown columns can change with each
15830
+ * response, and a table view that goes away with them flips the view and its page size. When
15831
+ * Cortex flags each column, the rows stay with only the filler and the CTA column.
15832
+ */
15833
+ get canUseTable() {
15834
+ return this.tableColumnList.length > 0;
14386
15835
  }
14387
15836
  runFirstUpdated() {
14388
15837
  if (this.useSiteSession) {
14389
15838
  this.baseUrl = resolveSiteSessionUrl(this.baseUrl);
14390
15839
  }
14391
- switch (this.view) {
14392
- case GridView.Large:
14393
- this.defaultPageSize = 15;
14394
- break;
14395
- case GridView.Medium:
14396
- this.defaultPageSize = 20;
14397
- break;
14398
- case GridView.Small:
14399
- this.defaultPageSize = 30;
14400
- break;
14401
- }
15840
+ this.defaultPageSize = resolvePageSize(this.view);
14402
15841
  this.lastRequest = __spreadProps(__spreadValues({}, this.lastRequest), {
14403
15842
  folderId: this.defaultFolderId,
14404
15843
  isSeeThrough: this.defaultIsSeeThrough,
@@ -14413,6 +15852,7 @@ let CxContentBrowser = class extends CortexElement {
14413
15852
  }
14414
15853
  this.updateComplete.then(() => {
14415
15854
  this.fetchAndMergeAssetsController = new FetchAndMergeAssetsController(this, {
15855
+ additionalFields: this.tableColumnList.map((column) => column.field),
14416
15856
  availableDocTypes: this.availableDocTypes,
14417
15857
  baseUrl: this.baseUrl,
14418
15858
  defaultFolderId: this.defaultFolderId,
@@ -14463,7 +15903,12 @@ let CxContentBrowser = class extends CortexElement {
14463
15903
  }
14464
15904
  openFormatDialog(id) {
14465
15905
  return __async(this, null, function* () {
15906
+ if (__privateGet2(this, _openingAsset) || __privateGet2(this, _insertInFlight)) {
15907
+ return;
15908
+ }
15909
+ __privateSet2(this, _openingAsset, true);
14466
15910
  this.selectedAssetId = id;
15911
+ this.busyAssetId = id;
14467
15912
  try {
14468
15913
  const asset = yield this.fetchAndMergeAssetsController.fetchAssetByID(id, {
14469
15914
  canFavorite: this.canFavorite,
@@ -14471,6 +15916,7 @@ let CxContentBrowser = class extends CortexElement {
14471
15916
  });
14472
15917
  if (!asset) {
14473
15918
  this.selectedAssetId = void 0;
15919
+ this.busyAssetId = void 0;
14474
15920
  return;
14475
15921
  }
14476
15922
  let isAssetPinned = false;
@@ -14481,8 +15927,14 @@ let CxContentBrowser = class extends CortexElement {
14481
15927
  isAssetPinned = lookupEvent.detail.isAssetPinned;
14482
15928
  }
14483
15929
  this.formatDialog.open(__spreadProps(__spreadValues({}, asset), { isAssetPinned }));
15930
+ if (this.formatDialog.isDialogOpen) {
15931
+ this.busyAssetId = void 0;
15932
+ }
14484
15933
  } catch (e2) {
14485
15934
  this.selectedAssetId = void 0;
15935
+ this.busyAssetId = void 0;
15936
+ } finally {
15937
+ __privateSet2(this, _openingAsset, false);
14486
15938
  }
14487
15939
  });
14488
15940
  }
@@ -14496,6 +15948,18 @@ let CxContentBrowser = class extends CortexElement {
14496
15948
  });
14497
15949
  });
14498
15950
  }
15951
+ handleTableColumnsChange() {
15952
+ if (!this.fetchAndMergeAssetsController) {
15953
+ return;
15954
+ }
15955
+ this.fetchAndMergeAssetsController.updateAdditionalFields(
15956
+ this.tableColumnList.map((column) => column.field)
15957
+ );
15958
+ this.lastRequest = __spreadProps(__spreadValues({}, this.lastRequest), { start: 0 });
15959
+ if (!this.initialFolderPending) {
15960
+ void this.fetchAndMergeAssetsController.fetchAndMergeAssets(this.lastRequest);
15961
+ }
15962
+ }
14499
15963
  handleAuthChange() {
14500
15964
  var _a2;
14501
15965
  (_a2 = this.fetchAndMergeAssetsController) == null ? void 0 : _a2.updateAuth(this.token, this.useSession);
@@ -14559,17 +16023,7 @@ let CxContentBrowser = class extends CortexElement {
14559
16023
  yield this.fetchAndMergeAssetsController.fetchAndMergeAssets(this.lastRequest);
14560
16024
  }
14561
16025
  }
14562
- switch (event.detail.view) {
14563
- case GridView.Large:
14564
- this.defaultPageSize = 15;
14565
- break;
14566
- case GridView.Medium:
14567
- this.defaultPageSize = 20;
14568
- break;
14569
- case GridView.Small:
14570
- this.defaultPageSize = 30;
14571
- break;
14572
- }
16026
+ this.defaultPageSize = resolvePageSize(event.detail.view);
14573
16027
  this.view = event.detail.view;
14574
16028
  });
14575
16029
  }
@@ -14716,15 +16170,17 @@ let CxContentBrowser = class extends CortexElement {
14716
16170
  selectedProxyMetadata: event.detail.selectedProxyMetadata
14717
16171
  });
14718
16172
  this.formatDialog.hide();
16173
+ this.busyAssetId = void 0;
14719
16174
  return;
14720
16175
  }
16176
+ __privateSet2(this, _insertInFlight, true);
14721
16177
  try {
14722
16178
  const response = yield this.fetchAndMergeAssetsController.getAssetLink(__spreadProps(__spreadValues({}, event.detail), {
14723
16179
  assets: [event.detail.asset],
14724
16180
  extraFields: this.extraFields
14725
16181
  }));
14726
16182
  if (response.isError) {
14727
- this.formatDialog.setLoadingConfirm(false);
16183
+ this.reportProxyConfirmFailure();
14728
16184
  return;
14729
16185
  }
14730
16186
  this.handleSelectedAsset({
@@ -14734,12 +16190,23 @@ let CxContentBrowser = class extends CortexElement {
14734
16190
  });
14735
16191
  this.formatDialog.hide();
14736
16192
  } catch (e2) {
14737
- this.formatDialog.setLoadingConfirm(false);
16193
+ this.reportProxyConfirmFailure();
16194
+ } finally {
16195
+ __privateSet2(this, _insertInFlight, false);
16196
+ this.busyAssetId = void 0;
14738
16197
  }
14739
16198
  });
14740
16199
  }
16200
+ reportProxyConfirmFailure() {
16201
+ if (this.formatDialog.isDialogOpen) {
16202
+ this.formatDialog.setLoadingConfirm(false);
16203
+ return;
16204
+ }
16205
+ this.formatDialog.revealAfterAutoConfirm();
16206
+ }
14741
16207
  handleFormatConfirm(event) {
14742
16208
  return __async(this, null, function* () {
16209
+ __privateSet2(this, _insertInFlight, true);
14743
16210
  try {
14744
16211
  const response = yield this.fetchAndMergeAssetsController.getAssetLink(__spreadProps(__spreadValues({}, event.detail), {
14745
16212
  assets: [event.detail.asset],
@@ -14758,6 +16225,9 @@ let CxContentBrowser = class extends CortexElement {
14758
16225
  this.formatDialog.hide();
14759
16226
  } catch (e2) {
14760
16227
  this.formatDialog.setLoadingConfirm(false);
16228
+ } finally {
16229
+ __privateSet2(this, _insertInFlight, false);
16230
+ this.busyAssetId = void 0;
14761
16231
  }
14762
16232
  });
14763
16233
  }
@@ -14835,6 +16305,7 @@ let CxContentBrowser = class extends CortexElement {
14835
16305
  request,
14836
16306
  sortOrders,
14837
16307
  totalCount,
16308
+ unreadableFields,
14838
16309
  userInfo
14839
16310
  } = this.fetchAndMergeAssetsController.getData({
14840
16311
  allowedExtensions: this.allowedExtensions,
@@ -14903,6 +16374,7 @@ let CxContentBrowser = class extends CortexElement {
14903
16374
  .newlyChangedOption=${this.newlyChangedOption}
14904
16375
  .sortOrders=${sortOrders}
14905
16376
  .views=${this.views}
16377
+ ?can-use-table=${this.canUseTable}
14906
16378
  ?is-mobile=${this.isMobile}
14907
16379
  ?is-see-through=${request == null ? void 0 : request.isSeeThrough}
14908
16380
  ?loading=${loading}
@@ -14918,21 +16390,47 @@ let CxContentBrowser = class extends CortexElement {
14918
16390
  @cx-content-browser-control-filter-change=${this.handleFilterChange}
14919
16391
  @cx-content-browser-control-bar-search-change=${this.handleSearchChange}
14920
16392
  ></cx-content-browser-control-bar>
14921
- <cx-content-browser-grid
14922
- .assets=${items}
14923
- ?empty=${!loading && !this.initialFolderPending && items.length === 0}
14924
- ?has-more=${items.length < totalCount}
14925
- ?loading=${loading || this.initialFolderPending}
14926
- ?show-title=${this.showTitle}
14927
- ?show-size=${this.showSize}
14928
- ?show-dimensions=${this.showDimensions}
14929
- ?show-tags=${this.showTags}
14930
- selected-asset-id=${o$4(this.selectedAssetId || void 0)}
14931
- view=${this.view}
14932
- @cx-content-browser-grid-scroll-end=${this.handleScrollEnd}
14933
- @cx-content-browser-grid-resize=${this.handleGridResize}
14934
- @cx-content-browser-grid-click=${this.handleGridClick}
14935
- ></cx-content-browser-grid>
16393
+ ${n$5(
16394
+ this.view === TABLE_VIEW && this.canUseTable,
16395
+ () => b`
16396
+ <cx-content-browser-table
16397
+ .busyAssetId=${this.busyAssetId}
16398
+ .assets=${items}
16399
+ .columns=${this.tableColumnList}
16400
+ .hiddenFields=${findUnreadableColumnFields(this.tableColumnList, unreadableFields)}
16401
+ ?empty=${!loading && !this.initialFolderPending && items.length === 0}
16402
+ cta-text=${this.ctaText}
16403
+ cta-text-transform=${this.ctaTextTransform}
16404
+ ?has-more=${items.length < totalCount}
16405
+ ?loading=${loading || this.initialFolderPending}
16406
+ selected-asset-id=${o$4(this.selectedAssetId || void 0)}
16407
+ @cx-content-browser-grid-scroll-end=${this.handleScrollEnd}
16408
+ @cx-content-browser-grid-resize=${this.handleGridResize}
16409
+ @cx-content-browser-grid-click=${this.handleGridClick}
16410
+ ></cx-content-browser-table>
16411
+ `,
16412
+ () => b`
16413
+ <cx-content-browser-grid
16414
+ .assets=${items}
16415
+ ?empty=${!loading && !this.initialFolderPending && items.length === 0}
16416
+ ?has-more=${items.length < totalCount}
16417
+ ?loading=${loading || this.initialFolderPending}
16418
+ ?show-title=${this.showTitle}
16419
+ ?show-size=${this.showSize}
16420
+ ?show-dimensions=${this.showDimensions}
16421
+ ?show-tags=${this.showTags}
16422
+ ?show-cta=${isAutoSelectFormatActive(this.autoSelectFormat)}
16423
+ .busyAssetId=${this.busyAssetId}
16424
+ cta-text=${this.ctaText}
16425
+ cta-text-transform=${this.ctaTextTransform}
16426
+ selected-asset-id=${o$4(this.selectedAssetId || void 0)}
16427
+ view=${this.view}
16428
+ @cx-content-browser-grid-scroll-end=${this.handleScrollEnd}
16429
+ @cx-content-browser-grid-resize=${this.handleGridResize}
16430
+ @cx-content-browser-grid-click=${this.handleGridClick}
16431
+ ></cx-content-browser-grid>
16432
+ `
16433
+ )}
14936
16434
  </cx-resize-observer>
14937
16435
  <cx-content-browser-format-dialog
14938
16436
  .availableExtensions=${availableExtensions}
@@ -14945,6 +16443,7 @@ let CxContentBrowser = class extends CortexElement {
14945
16443
  cta-text-transform=${this.ctaTextTransform}
14946
16444
  variant=${this.isMobile ? ContentBrowserFormatDialogVariant.Drawer : ContentBrowserFormatDialogVariant.Dialog}
14947
16445
  token=${this.useSiteSession ? "" : this.token}
16446
+ .autoSelectFormat=${this.autoSelectFormat}
14948
16447
  ?can-custom-format=${!!(parameters == null ? void 0 : parameters.ATSEnabled)}
14949
16448
  ?can-favorite=${this.canFavorite}
14950
16449
  ?can-pin-asset=${this.canPinAsset}
@@ -14964,6 +16463,8 @@ let CxContentBrowser = class extends CortexElement {
14964
16463
  `;
14965
16464
  }
14966
16465
  };
16466
+ _openingAsset = /* @__PURE__ */ new WeakMap();
16467
+ _insertInFlight = /* @__PURE__ */ new WeakMap();
14967
16468
  CxContentBrowser.styles = [componentStyles, styles];
14968
16469
  CxContentBrowser.dependencies = {
14969
16470
  "cx-content-browser-browser": CxContentBrowserBrowser,
@@ -14972,6 +16473,7 @@ CxContentBrowser.dependencies = {
14972
16473
  "cx-content-browser-grid": CxContentBrowserGrid,
14973
16474
  "cx-content-browser-header": CxContentBrowserHeader,
14974
16475
  "cx-content-browser-no-result": CxContentBrowserNoResult,
16476
+ "cx-content-browser-table": CxContentBrowserTable,
14975
16477
  "cx-icon": CxIcon,
14976
16478
  "cx-icon-button": CxIconButton,
14977
16479
  "cx-resize-observer": CxResizeObserver,
@@ -15063,6 +16565,9 @@ __decorateClass([
15063
16565
  __decorateClass([
15064
16566
  n$6({ attribute: "can-use-proxies", reflect: true, type: Boolean })
15065
16567
  ], CxContentBrowser.prototype, "canUseProxies", 2);
16568
+ __decorateClass([
16569
+ n$6({ attribute: "auto-select-format", converter: autoSelectFormatConverter, reflect: false })
16570
+ ], CxContentBrowser.prototype, "autoSelectFormat", 2);
15066
16571
  __decorateClass([
15067
16572
  n$6({ attribute: "simple-pick", reflect: true, type: Boolean })
15068
16573
  ], CxContentBrowser.prototype, "simplePick", 2);
@@ -15095,6 +16600,32 @@ __decorateClass([
15095
16600
  __decorateClass([
15096
16601
  n$6({ attribute: "default-grid-view", type: String })
15097
16602
  ], CxContentBrowser.prototype, "defaultGridView", 2);
16603
+ __decorateClass([
16604
+ n$6({
16605
+ attribute: "table-columns",
16606
+ /**
16607
+ * Lit's stock Array converter returns `null` for anything `JSON.parse` rejects, and a host that
16608
+ * stringifies an array into the attribute hands it `""` or `"[object Object]"`. `null` then
16609
+ * throws on every read below, taking the whole picker down. An unreadable value means "no
16610
+ * columns", which turns the table view off — the same outcome as not configuring one.
16611
+ */
16612
+ converter: {
16613
+ fromAttribute: (value) => {
16614
+ if (!value) {
16615
+ return [];
16616
+ }
16617
+ try {
16618
+ const parsed = JSON.parse(value);
16619
+ return Array.isArray(parsed) ? parsed : [];
16620
+ } catch (e2) {
16621
+ return [];
16622
+ }
16623
+ },
16624
+ toAttribute: (value) => JSON.stringify(value != null ? value : [])
16625
+ },
16626
+ type: Array
16627
+ })
16628
+ ], CxContentBrowser.prototype, "tableColumns", 2);
15098
16629
  __decorateClass([
15099
16630
  n$6({ attribute: "default-sort-order-name", type: String })
15100
16631
  ], CxContentBrowser.prototype, "defaultSortOrderName", 2);
@@ -15161,9 +16692,15 @@ __decorateClass([
15161
16692
  __decorateClass([
15162
16693
  r$6()
15163
16694
  ], CxContentBrowser.prototype, "initialFolderPending", 2);
16695
+ __decorateClass([
16696
+ r$6()
16697
+ ], CxContentBrowser.prototype, "busyAssetId", 2);
15164
16698
  __decorateClass([
15165
16699
  watch("lastRequest", { waitUntilFirstUpdate: true })
15166
16700
  ], CxContentBrowser.prototype, "handleLastRequestChange", 1);
16701
+ __decorateClass([
16702
+ watch("tableColumns", { waitUntilFirstUpdate: true })
16703
+ ], CxContentBrowser.prototype, "handleTableColumnsChange", 1);
15167
16704
  __decorateClass([
15168
16705
  watch(["token", "useSession"], { waitUntilFirstUpdate: true })
15169
16706
  ], CxContentBrowser.prototype, "handleAuthChange", 1);