@uniformdev/mesh-sdk-react 19.3.0 → 19.5.1-alpha.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -358,7 +358,7 @@ var SelectionField = ({
358
358
  {
359
359
  value: selectedValue,
360
360
  loading,
361
- text: (_a2 = values.find((v) => v.id === selectedValue)) == null ? void 0 : _a2.name
361
+ text: (_a2 = values.find((v2) => v2.id === selectedValue)) == null ? void 0 : _a2.name
362
362
  }
363
363
  ) }),
364
364
  /* @__PURE__ */ jsx16(
@@ -457,9 +457,9 @@ var ProductQuery = ({
457
457
  ];
458
458
  }, [categoryOptions]);
459
459
  const brandOptions = useMemo(() => {
460
- return (brands == null ? void 0 : brands.map((b) => ({
461
- id: b.id.toString(),
462
- name: b.name
460
+ return (brands == null ? void 0 : brands.map((b2) => ({
461
+ id: b2.id.toString(),
462
+ name: b2.name
463
463
  }))) || [];
464
464
  }, [brands]);
465
465
  const handleAddProductCategory = (category) => {
@@ -474,7 +474,7 @@ var ProductQuery = ({
474
474
  const handleRemoveProductCategory = (category) => {
475
475
  var _a2;
476
476
  setFormState({
477
- categories: (_a2 = value == null ? void 0 : value.categories) == null ? void 0 : _a2.filter((c) => c !== category)
477
+ categories: (_a2 = value == null ? void 0 : value.categories) == null ? void 0 : _a2.filter((c2) => c2 !== category)
478
478
  });
479
479
  };
480
480
  const handleBrandChange = (e) => {
@@ -895,7 +895,7 @@ var ProductPreviewList = ({
895
895
  children: products == null ? void 0 : products.map((product, index) => {
896
896
  var _a;
897
897
  const [category] = (product == null ? void 0 : product.categories) || [];
898
- const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((c) => c.id === category.id)) == null ? void 0 : _a.name;
898
+ const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((c2) => c2.id === category.id)) == null ? void 0 : _a.name;
899
899
  return /* @__PURE__ */ jsx18("li", { css: productPreviewListItem, children: /* @__PURE__ */ jsxs7(
900
900
  "div",
901
901
  {
@@ -1796,7 +1796,7 @@ var EntrySearch = ({
1796
1796
  ResolvedNoResultsComponent,
1797
1797
  {
1798
1798
  searchText: textInput || textInput,
1799
- selectedContentType: (_b = (_a = contentTypes == null ? void 0 : contentTypes.find((t) => t.id === contentTypeSelected)) == null ? void 0 : _a.name) != null ? _b : contentTypeSelected
1799
+ selectedContentType: (_b = (_a = contentTypes == null ? void 0 : contentTypes.find((t2) => t2.id === contentTypeSelected)) == null ? void 0 : _a.name) != null ? _b : contentTypeSelected
1800
1800
  }
1801
1801
  ),
1802
1802
  !resultsLoading && typeof totalResults !== "undefined" && results && (results == null ? void 0 : results.length) < totalResults && /* @__PURE__ */ jsx21("button", { type: "button", css: entrySearchLoadMoreBtn, onClick: handleLoadMoreClick, children: !loadingMore ? "Load More" : /* @__PURE__ */ jsx21(LoadingIndicator, {}) })
@@ -1986,7 +1986,7 @@ function ProductSearchRow({
1986
1986
  var _a;
1987
1987
  const { categories, logoIcon } = useProductSearchContext();
1988
1988
  const [category] = result.categories || [{ id: "", name: "" }];
1989
- const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((c) => c.id === category.id)) == null ? void 0 : _a.name;
1989
+ const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((c2) => c2.id === category.id)) == null ? void 0 : _a.name;
1990
1990
  return /* @__PURE__ */ jsx22(
1991
1991
  "div",
1992
1992
  {
@@ -2121,7 +2121,7 @@ function ProductSelectedItem({
2121
2121
  var _a;
2122
2122
  const { categories, logoIcon } = useProductSearchContext();
2123
2123
  const [category] = selectedItem.categories || [{ id: "", name: "" }];
2124
- const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((c) => c.id === category.id)) == null ? void 0 : _a.name;
2124
+ const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((c2) => c2.id === category.id)) == null ? void 0 : _a.name;
2125
2125
  return /* @__PURE__ */ jsx23("div", { css: [productSelectedItemContainer], children: /* @__PURE__ */ jsxs12("article", { css: [productSelectedItemDetails], children: [
2126
2126
  /* @__PURE__ */ jsxs12("div", { css: [productSelectedItemContent], children: [
2127
2127
  selectedItem.thumbnailUrl ? /* @__PURE__ */ jsx23(
@@ -2267,7 +2267,7 @@ function ProductSearch({
2267
2267
  } = useAsync(async () => {
2268
2268
  return await onGetCategories();
2269
2269
  }, [onGetCategories]);
2270
- const categoryIds = categories == null ? void 0 : categories.map((c) => c.id).join(",");
2270
+ const categoryIds = categories == null ? void 0 : categories.map((c2) => c2.id).join(",");
2271
2271
  const categoryOptions = useMemo2(
2272
2272
  () => {
2273
2273
  if (!categories) {
@@ -2641,9 +2641,6 @@ function DefaultDamItemRenderer({ item }) {
2641
2641
  ] }) : null;
2642
2642
  }
2643
2643
 
2644
- // src/components/DataResourceVariablesList.tsx
2645
- import { Callout as Callout4, Input as Input4 } from "@uniformdev/design-system";
2646
-
2647
2644
  // src/hooks/useMeshLocation.ts
2648
2645
  import { useMemo as useMemo4, useRef as useRef7 } from "react";
2649
2646
 
@@ -2724,52 +2721,22 @@ function useMeshLocation(expectedLocation) {
2724
2721
  }
2725
2722
 
2726
2723
  // src/components/Variables/InputVariables.tsx
2727
- import { Input as Input3 } from "@uniformdev/design-system";
2724
+ import { Caption, ErrorMessage, InfoMessage, Input as Input3, WarningMessage } from "@uniformdev/design-system";
2728
2725
  import * as React11 from "react";
2726
+ import { v4 as v42 } from "uuid";
2729
2727
 
2730
- // src/components/Variables/insertVariableIntoText.ts
2731
- function insertVariableIntoText({
2732
- variableName: variableName2,
2733
- variablePrefix,
2734
- variableSuffix = "",
2735
- value,
2736
- selectionStart = null,
2737
- selectionEnd = null
2738
- }) {
2739
- const variableExpression = `${variablePrefix}${variableName2}${variableSuffix}`;
2740
- if (selectionStart !== null && selectionEnd !== null && selectionStart !== selectionEnd) {
2741
- return `${value.substring(0, selectionStart)}${variableExpression}${value.substring(selectionEnd)}`;
2742
- }
2743
- const hasCursorPosition = selectionStart !== null;
2744
- let startOffset = 0;
2745
- if (hasCursorPosition && value.substring(selectionStart - variablePrefix.length, selectionStart) === variablePrefix) {
2746
- startOffset = variablePrefix.length;
2747
- }
2748
- if (hasCursorPosition) {
2749
- return `${value.substring(0, selectionStart - startOffset)}${variableExpression}${value.substring(
2750
- selectionStart
2751
- )}`;
2752
- }
2753
- return `${value}${variableExpression}`;
2754
- }
2755
-
2756
- // src/components/Variables/InsertVariableMenu.tsx
2757
- import { Icon as Icon5, Menu as Menu2, MenuItem as MenuItem2, MenuItemSeparator } from "@uniformdev/design-system";
2728
+ // src/components/Variables/SelectVariableMenu.tsx
2729
+ import { Menu as Menu2, MenuItem as MenuItem2, MenuItemSeparator } from "@uniformdev/design-system";
2758
2730
  import { useEffect as useEffect6, useRef as useRef8, useState as useState8 } from "react";
2731
+ import { CgUsbC } from "react-icons/cg";
2759
2732
 
2760
2733
  // src/components/Variables/styles/InsertVariableMenu.styles.ts
2761
2734
  import { css as css18 } from "@emotion/react";
2762
- var menuContainer = css18`
2763
- position: relative;
2764
- `;
2765
2735
  var menuBtn = css18`
2766
2736
  background: none;
2767
2737
  border: none;
2768
2738
  color: var(--gray-300);
2769
2739
  padding: 0;
2770
- position: absolute;
2771
- bottom: 25%;
2772
- right: var(--spacing-sm);
2773
2740
  `;
2774
2741
  var menuItemTextGroup = css18`
2775
2742
  align-items: flex-start;
@@ -2798,7 +2765,7 @@ import { Button as Button2, Callout as Callout3, Input as Input2, useShortcut }
2798
2765
  import { useForm } from "react-hook-form";
2799
2766
  import { z } from "zod";
2800
2767
 
2801
- // src/components/Variables/InputVariables.styles.ts
2768
+ // src/components/Variables/styles/VariableEditor.styles.ts
2802
2769
  import { css as css19 } from "@emotion/react";
2803
2770
  var variablesFormContainer = css19`
2804
2771
  > * {
@@ -2912,6 +2879,7 @@ function VariablesProvider({
2912
2879
  const events = React10.useMemo(() => mitt(), []);
2913
2880
  const Editor = editVariableComponent != null ? editVariableComponent : VariableEditor;
2914
2881
  const contextValue = {
2882
+ flatVariables: flattenVariables(value),
2915
2883
  dispatch: (event) => {
2916
2884
  if (event.type === "set") {
2917
2885
  const { name, ...varValue } = event.variable;
@@ -2933,7 +2901,8 @@ function VariablesProvider({
2933
2901
  },
2934
2902
  variables: value,
2935
2903
  isEditing: typeof editing !== "undefined",
2936
- events
2904
+ events,
2905
+ canDispatch: true
2937
2906
  };
2938
2907
  return /* @__PURE__ */ jsxs17(VariablesContext.Provider, { value: contextValue, children: [
2939
2908
  children,
@@ -2952,63 +2921,76 @@ function VariablesProvider({
2952
2921
  ) : null
2953
2922
  ] });
2954
2923
  }
2955
- function useVariables() {
2924
+ function useVariables(returnEmptyWithoutProvider = false) {
2956
2925
  const context = React10.useContext(VariablesContext);
2957
2926
  if (!context) {
2927
+ if (returnEmptyWithoutProvider) {
2928
+ return {
2929
+ flatVariables: {},
2930
+ dispatch: () => {
2931
+ throw new Error("No VariablesProvider present");
2932
+ },
2933
+ events: mitt(),
2934
+ isEditing: false,
2935
+ variables: {},
2936
+ canDispatch: false
2937
+ };
2938
+ }
2958
2939
  throw new Error("No VariablesProvider present");
2959
2940
  }
2960
2941
  return context;
2961
2942
  }
2943
+ function flattenVariables(variables) {
2944
+ const flatVariables = {};
2945
+ Object.entries(variables).forEach(([key, value]) => {
2946
+ flatVariables[key] = value.default;
2947
+ });
2948
+ return flatVariables;
2949
+ }
2962
2950
 
2963
2951
  // src/components/Variables/useOnVariableUpdated.ts
2964
- function useOnVariableUpdated(fn, disabled) {
2952
+ function useOnVariableUpdated(fn2, disabled) {
2965
2953
  const { variables, events } = useVariables();
2966
2954
  useEffect5(() => {
2967
2955
  if (disabled) {
2968
2956
  return;
2969
2957
  }
2970
- events.on("update", fn);
2971
- return () => events.off("update", fn);
2972
- }, [disabled, events, fn, variables]);
2958
+ events.on("update", fn2);
2959
+ return () => events.off("update", fn2);
2960
+ }, [disabled, events, fn2, variables]);
2973
2961
  }
2974
2962
 
2975
2963
  // src/components/Variables/variablesToList.ts
2976
2964
  function variablesToList(variables) {
2977
- return Object.entries(variables || {}).sort(([aKey, a], [bKey, b]) => {
2965
+ return Object.entries(variables || {}).sort(([aKey, a2], [bKey, b2]) => {
2978
2966
  var _a, _b;
2979
- if (a.order && b.order) {
2980
- return a.order - b.order;
2981
- } else if (a.order) {
2967
+ if (a2.order && b2.order) {
2968
+ return a2.order - b2.order;
2969
+ } else if (a2.order) {
2982
2970
  return 1;
2983
- } else if (b.order) {
2971
+ } else if (b2.order) {
2984
2972
  return -1;
2985
2973
  }
2986
- return ((_a = a.displayName) != null ? _a : aKey).localeCompare((_b = b.displayName) != null ? _b : bKey);
2974
+ return ((_a = a2.displayName) != null ? _a : aKey).localeCompare((_b = b2.displayName) != null ? _b : bKey);
2987
2975
  }).map(([name, definition]) => ({
2988
2976
  name,
2989
2977
  ...definition
2990
2978
  }));
2991
2979
  }
2992
2980
 
2993
- // src/components/Variables/InsertVariableMenu.tsx
2981
+ // src/components/Variables/SelectVariableMenu.tsx
2994
2982
  import { Fragment as Fragment4, jsx as jsx30, jsxs as jsxs18 } from "@emotion/react/jsx-runtime";
2995
- var InsertVariableMenu = ({
2983
+ var SelectVariableMenu = ({
2996
2984
  onSelectVariable,
2997
- children,
2998
- textValue,
2999
- trigger = "${",
2985
+ onResetVariables,
3000
2986
  showAddVariableMenuOption = false,
3001
- disabled = false,
3002
- forceVisible
2987
+ forceVisible,
2988
+ buttonCss,
2989
+ buttonProps,
2990
+ tip
3003
2991
  }) => {
3004
- const { variables, dispatch, isEditing } = useVariables();
2992
+ const { variables, dispatch, isEditing, canDispatch } = useVariables();
3005
2993
  const btnRef = useRef8(null);
3006
- const tip = `Tip: access this list by typing ${trigger}`;
3007
- useEffect6(() => {
3008
- if (textValue === trigger && btnRef.current && btnRef.current.getAttribute("aria-expanded") === "false") {
3009
- btnRef.current.click();
3010
- }
3011
- }, [textValue, btnRef, trigger]);
3012
2994
  const [openedAdd, setOpenedAdd] = useState8(false);
3013
2995
  useOnVariableUpdated((varName) => {
3014
2996
  onSelectVariable == null ? void 0 : onSelectVariable({ name: varName, default: "" });
@@ -3018,141 +3000,310 @@ var InsertVariableMenu = ({
3018
3000
  setOpenedAdd(false);
3019
3001
  }
3020
3002
  }, [isEditing, openedAdd]);
3021
- if (disabled) {
3022
- return /* @__PURE__ */ jsx30(Fragment4, { children });
3023
- }
3024
3003
  const variablesList = variablesToList(variables);
3025
- return /* @__PURE__ */ jsxs18("div", { css: menuContainer, children: [
3026
- children,
3027
- /* @__PURE__ */ jsxs18(
3028
- Menu2,
3029
- {
3030
- placement: "bottom-start",
3031
- forceVisible,
3032
- menuTrigger: /* @__PURE__ */ jsx30("button", { ref: btnRef, css: menuBtn, type: "button", title: "Insert variable", children: /* @__PURE__ */ jsx30(Icon5, { icon: "usb-c", iconColor: "currentColor" }) }),
3033
- menuLabel: "Insert variable",
3034
- children: [
3035
- variablesList.map((variable) => {
3036
- const { name, helpText } = variable;
3037
- return /* @__PURE__ */ jsxs18(
3038
- MenuItem2,
3039
- {
3040
- id: name,
3041
- css: menuItemTextGroup,
3042
- onClick: () => onSelectVariable == null ? void 0 : onSelectVariable(variable),
3043
- children: [
3044
- /* @__PURE__ */ jsx30("span", { children: name }),
3045
- helpText ? /* @__PURE__ */ jsx30("small", { css: smallText, children: helpText }) : null
3046
- ]
3004
+ const menuHasVariableOptions = Object.entries(variables).length || showAddVariableMenuOption;
3005
+ return /* @__PURE__ */ jsxs18(
3006
+ Menu2,
3007
+ {
3008
+ placement: "bottom-start",
3009
+ forceVisible,
3010
+ menuTrigger: /* @__PURE__ */ jsx30(
3011
+ "button",
3012
+ {
3013
+ title: "Insert variable",
3014
+ ...buttonProps,
3015
+ ref: btnRef,
3016
+ css: [menuBtn, buttonCss],
3017
+ type: "button",
3018
+ children: /* @__PURE__ */ jsx30(CgUsbC, { size: "1.4rem" })
3019
+ }
3020
+ ),
3021
+ menuLabel: "Insert variable",
3022
+ children: [
3023
+ variablesList.map((variable) => {
3024
+ const { name, helpText } = variable;
3025
+ return /* @__PURE__ */ jsxs18(
3026
+ MenuItem2,
3027
+ {
3028
+ id: name,
3029
+ css: menuItemTextGroup,
3030
+ onClick: () => onSelectVariable == null ? void 0 : onSelectVariable(variable),
3031
+ children: [
3032
+ /* @__PURE__ */ jsx30("span", { children: name }),
3033
+ helpText ? /* @__PURE__ */ jsx30("small", { css: smallText, children: helpText }) : null
3034
+ ]
3035
+ },
3036
+ name
3037
+ );
3038
+ }),
3039
+ showAddVariableMenuOption && canDispatch ? /* @__PURE__ */ jsxs18(Fragment4, { children: [
3040
+ variablesList.length ? /* @__PURE__ */ jsx30(MenuItemSeparator, {}) : null,
3041
+ /* @__PURE__ */ jsx30(
3042
+ MenuItem2,
3043
+ {
3044
+ onClick: () => {
3045
+ setOpenedAdd(true);
3046
+ dispatch({ type: "edit", variable: "" });
3047
3047
  },
3048
- name
3049
- );
3050
- }),
3051
- showAddVariableMenuOption ? /* @__PURE__ */ jsxs18(Fragment4, { children: [
3052
- variablesList.length ? /* @__PURE__ */ jsx30(MenuItemSeparator, {}) : null,
3053
- /* @__PURE__ */ jsx30(
3054
- MenuItem2,
3055
- {
3056
- onClick: () => {
3057
- setOpenedAdd(true);
3058
- dispatch({ type: "edit", variable: "" });
3059
- },
3060
- children: "Add Variable"
3061
- }
3062
- )
3063
- ] }) : null,
3064
- Object.entries(variables).length || showAddVariableMenuOption ? /* @__PURE__ */ jsx30(MenuItemSeparator, {}) : null,
3065
- /* @__PURE__ */ jsx30("i", { css: variablesTipText, children: tip })
3066
- ]
3067
- }
3068
- )
3069
- ] });
3048
+ children: "Add Variable"
3049
+ }
3050
+ )
3051
+ ] }) : null,
3052
+ menuHasVariableOptions && onResetVariables ? /* @__PURE__ */ jsx30(MenuItemSeparator, {}) : null,
3053
+ onResetVariables ? /* @__PURE__ */ jsx30(MenuItem2, { onClick: onResetVariables, css: { color: "var(--brand-secondary-5)" }, children: "Reset" }) : null,
3054
+ tip && (menuHasVariableOptions || onResetVariables) ? /* @__PURE__ */ jsx30(MenuItemSeparator, {}) : null,
3055
+ tip ? /* @__PURE__ */ jsx30("i", { css: variablesTipText, children: tip }) : null
3056
+ ]
3057
+ }
3058
+ );
3070
3059
  };
3071
3060
 
3061
+ // src/components/Variables/styles/InputVariables.styles.ts
3062
+ import { css as css20 } from "@emotion/react";
3063
+ var menuContainer = css20`
3064
+ position: relative;
3065
+ `;
3066
+ var menuBtn2 = css20`
3067
+ position: absolute;
3068
+ bottom: 25%;
3069
+ right: var(--spacing-sm);
3070
+ `;
3071
+
3072
+ // src/components/Variables/util/variableExpression.ts
3073
+ var variableExpression = /(?<!\\)\${([^}]+)}/g;
3074
+ var variablePrefix = "${";
3075
+ var variableSuffix = "}";
3076
+
3077
+ // src/components/Variables/util/getReferencedVariables.ts
3078
+ function getReferencedVariables(value) {
3079
+ const result = [];
3080
+ for (const match of value.matchAll(variableExpression)) {
3081
+ result.push(match[1]);
3082
+ }
3083
+ return result;
3084
+ }
3085
+
3086
+ // src/components/Variables/util/insertVariableIntoText.ts
3087
+ function insertVariableIntoText({
3088
+ variableName: variableName2,
3089
+ value,
3090
+ selectionStart = null,
3091
+ selectionEnd = null
3092
+ }) {
3093
+ const variableExpression2 = `${variablePrefix}${variableName2}${variableSuffix}`;
3094
+ if (selectionStart !== null && selectionEnd !== null && selectionStart !== selectionEnd) {
3095
+ return `${value.substring(0, selectionStart)}${variableExpression2}${value.substring(selectionEnd)}`;
3096
+ }
3097
+ const hasCursorPosition = selectionStart !== null;
3098
+ let startOffset = 0;
3099
+ if (hasCursorPosition && value.substring(selectionStart - variablePrefix.length, selectionStart) === variablePrefix) {
3100
+ startOffset = variablePrefix.length;
3101
+ }
3102
+ if (hasCursorPosition) {
3103
+ return `${value.substring(0, selectionStart - startOffset)}${variableExpression2}${value.substring(
3104
+ selectionStart
3105
+ )}`;
3106
+ }
3107
+ return `${value}${variableExpression2}`;
3108
+ }
3109
+
3110
+ // src/components/Variables/styles/VariableField.styles.ts
3111
+ import { css as css21 } from "@emotion/react";
3112
+ var labelText = css21`
3113
+ align-items: center;
3114
+ display: flex;
3115
+ gap: var(--spacing-xs);
3116
+ font-weight: var(--fw-regular);
3117
+ margin: 0 0 var(--spacing-xs);
3118
+ `;
3119
+ var variableBindButton = css21`
3120
+ align-items: center;
3121
+ border: none;
3122
+ border-radius: var(--rounded-base);
3123
+ background: none;
3124
+ display: flex;
3125
+ height: 1.2rem;
3126
+ padding: var(--spacing-2xs);
3127
+ transition: background var(--duration-fast) var(--timing-ease-out),
3128
+ color var(--duration-fast) var(--timing-ease-out);
3129
+ width: 1.2rem;
3130
+
3131
+ &:hover,
3132
+ &[aria-pressed='true']:not(:disabled) {
3133
+ background: var(--brand-secondary-3);
3134
+ color: var(--white);
3135
+ }
3136
+
3137
+ &[aria-disabled='true'] {
3138
+ background: none;
3139
+ color: currentColor;
3140
+ }
3141
+ `;
3142
+
3143
+ // src/components/Variables/VariableField.tsx
3144
+ import { jsx as jsx31, jsxs as jsxs19 } from "@emotion/react/jsx-runtime";
3145
+ function VariableField({
3146
+ label,
3147
+ selectVariableMenuOptions,
3148
+ children,
3149
+ id,
3150
+ isActive,
3151
+ disableVariables
3152
+ }) {
3153
+ const { variables } = useVariables(true);
3154
+ const varCount = Object.keys(variables).length;
3155
+ const variableSelector = varCount > 0 && (selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.onSelectVariable) && !disableVariables ? /* @__PURE__ */ jsx31(
3156
+ SelectVariableMenu,
3157
+ {
3158
+ ...selectVariableMenuOptions,
3159
+ buttonCss: [variableBindButton, selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.buttonCss],
3160
+ buttonProps: isActive ? { "aria-pressed": "true" } : void 0
3161
+ }
3162
+ ) : null;
3163
+ return /* @__PURE__ */ jsxs19("div", { children: [
3164
+ /* @__PURE__ */ jsxs19("label", { htmlFor: id, css: labelText, children: [
3165
+ variableSelector,
3166
+ /* @__PURE__ */ jsx31("span", { children: label })
3167
+ ] }),
3168
+ children
3169
+ ] });
3170
+ }
3171
+
3072
3172
  // src/components/Variables/InputVariables.tsx
3073
- import { jsx as jsx31 } from "@emotion/react/jsx-runtime";
3173
+ import { Fragment as Fragment5, jsx as jsx32, jsxs as jsxs20 } from "@emotion/react/jsx-runtime";
3074
3174
  function InputVariables({
3175
+ id,
3075
3176
  "aria-label": ariaLabel,
3177
+ label,
3076
3178
  value,
3077
3179
  disableVariables,
3180
+ disableReset,
3181
+ disableInlineMenu,
3078
3182
  onChange,
3079
3183
  onPaste,
3080
3184
  showAddVariableMenuOption,
3081
- variablePrefix = "${",
3082
- variableSuffix = "}",
3185
+ inputWhenNoVariables,
3186
+ caption,
3187
+ errorMessage,
3188
+ warningMessage,
3189
+ infoMessage,
3083
3190
  ...inputProps
3084
3191
  }) {
3085
3192
  var _a, _b;
3086
- const { variables, dispatch } = useVariables();
3087
- const currentVariables = React11.useRef(variables);
3088
- const currentDispatch = React11.useRef(dispatch);
3089
- const currentSetValue = React11.useRef(onChange);
3193
+ const { variables } = useVariables(true);
3090
3194
  const inputRef = React11.useRef(null);
3091
- React11.useEffect(() => {
3092
- currentVariables.current = variables;
3093
- }, [variables]);
3094
- React11.useEffect(() => {
3095
- currentDispatch.current = dispatch;
3096
- }, [dispatch]);
3097
- React11.useEffect(() => {
3098
- currentSetValue.current = onChange;
3099
- }, [onChange]);
3100
- const onPasteHandler = () => {
3101
- setTimeout(() => {
3102
- if (!inputRef.current) {
3103
- return;
3104
- }
3105
- onPaste == null ? void 0 : onPaste(inputRef.current.value);
3106
- });
3195
+ const [finalId] = React11.useState(id != null ? id : () => v42());
3196
+ const onPasteHandler = (e) => {
3197
+ var _a2, _b2, _c;
3198
+ if (!onPaste) {
3199
+ return;
3200
+ }
3201
+ const pastedValue = (_a2 = e.clipboardData) == null ? void 0 : _a2.getData("text/plain");
3202
+ if (!pastedValue || !e.currentTarget) {
3203
+ return;
3204
+ }
3205
+ const selectionStart = (_b2 = e.currentTarget.selectionStart) != null ? _b2 : 0;
3206
+ const selectionEnd = (_c = e.currentTarget.selectionEnd) != null ? _c : 0;
3207
+ const newValue = e.currentTarget.value.substring(0, selectionStart) + pastedValue + e.currentTarget.value.substring(selectionEnd);
3208
+ onPaste(newValue);
3209
+ e.preventDefault();
3107
3210
  };
3211
+ const currentCursor = (_b = (_a = inputRef.current) == null ? void 0 : _a.selectionStart) != null ? _b : value.length;
3212
+ const forceMenu = value.substring(currentCursor - 2, currentCursor) === variablePrefix;
3213
+ const hasVariablesInValue = getReferencedVariables(value).length > 0;
3214
+ const [hadVariablesInValue, setHadVariablesInValue] = React11.useState(hasVariablesInValue);
3215
+ React11.useEffect(() => {
3216
+ if (hasVariablesInValue) {
3217
+ setHadVariablesInValue(true);
3218
+ }
3219
+ }, [hasVariablesInValue]);
3220
+ const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption;
3221
+ const disableInlineVariablesForReals = disableVariablesForReals || disableInlineMenu;
3108
3222
  const handleInsertVariable = (variable) => {
3109
3223
  var _a2, _b2;
3224
+ const baseValue = inputWhenNoVariables && !hasVariablesInValue ? "" : value;
3110
3225
  handleSetValue(
3111
3226
  insertVariableIntoText({
3112
3227
  variableName: variable.name,
3113
- value,
3114
- variablePrefix,
3115
- variableSuffix,
3228
+ value: baseValue,
3116
3229
  selectionEnd: (_a2 = inputRef.current) == null ? void 0 : _a2.selectionEnd,
3117
3230
  selectionStart: (_b2 = inputRef.current) == null ? void 0 : _b2.selectionStart
3118
3231
  })
3119
3232
  );
3120
3233
  };
3121
3234
  const handleSetValue = (rawValue) => {
3122
- currentSetValue.current(rawValue);
3235
+ onChange(rawValue);
3123
3236
  };
3124
- const currentCursor = (_b = (_a = inputRef.current) == null ? void 0 : _a.selectionStart) != null ? _b : value.length;
3125
- const forceMenu = value.substring(currentCursor - 2, currentCursor) === "${";
3126
- return /* @__PURE__ */ jsx31(
3127
- InsertVariableMenu,
3128
- {
3129
- showAddVariableMenuOption,
3130
- textValue: value,
3131
- onSelectVariable: handleInsertVariable,
3132
- disabled: disableVariables,
3133
- forceVisible: forceMenu || void 0,
3134
- children: /* @__PURE__ */ jsx31(
3135
- Input3,
3136
- {
3137
- ref: inputRef,
3138
- label: ariaLabel,
3139
- showLabel: false,
3140
- value,
3141
- onChange: (e) => handleSetValue(e.currentTarget.value),
3142
- onPaste: onPasteHandler,
3143
- ...inputProps
3144
- }
3145
- )
3146
- }
3147
- );
3237
+ const sharedMenuProps = {
3238
+ onSelectVariable: handleInsertVariable,
3239
+ showAddVariableMenuOption,
3240
+ onResetVariables: hadVariablesInValue && !disableReset ? () => {
3241
+ handleSetValue("");
3242
+ setHadVariablesInValue(false);
3243
+ } : void 0
3244
+ };
3245
+ const input = /* @__PURE__ */ jsxs20("div", { children: [
3246
+ inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ jsx32(
3247
+ InputVariablesShell,
3248
+ {
3249
+ ...sharedMenuProps,
3250
+ disabled: disableInlineVariablesForReals,
3251
+ forceVisible: forceMenu || void 0,
3252
+ children: /* @__PURE__ */ jsx32(
3253
+ Input3,
3254
+ {
3255
+ id: finalId,
3256
+ ref: inputRef,
3257
+ label: ariaLabel,
3258
+ showLabel: false,
3259
+ value,
3260
+ onChange: (e) => handleSetValue(e.currentTarget.value),
3261
+ onPaste: onPasteHandler,
3262
+ ...inputProps
3263
+ }
3264
+ )
3265
+ }
3266
+ ),
3267
+ caption ? /* @__PURE__ */ jsx32(Caption, { children: caption }) : null,
3268
+ errorMessage ? /* @__PURE__ */ jsx32(ErrorMessage, { message: errorMessage }) : null,
3269
+ warningMessage ? /* @__PURE__ */ jsx32(WarningMessage, { message: warningMessage }) : null,
3270
+ infoMessage ? /* @__PURE__ */ jsx32(InfoMessage, { message: infoMessage }) : null
3271
+ ] });
3272
+ if (label) {
3273
+ return /* @__PURE__ */ jsx32(
3274
+ VariableField,
3275
+ {
3276
+ label,
3277
+ selectVariableMenuOptions: sharedMenuProps,
3278
+ id: finalId,
3279
+ isActive: hadVariablesInValue,
3280
+ disableVariables: disableVariablesForReals,
3281
+ children: input
3282
+ }
3283
+ );
3284
+ }
3285
+ return input;
3286
+ }
3287
+ function InputVariablesShell({
3288
+ children,
3289
+ disabled,
3290
+ ...props
3291
+ }) {
3292
+ if (disabled) {
3293
+ return /* @__PURE__ */ jsx32(Fragment5, { children });
3294
+ }
3295
+ return /* @__PURE__ */ jsxs20("div", { css: menuContainer, children: [
3296
+ children,
3297
+ /* @__PURE__ */ jsx32(SelectVariableMenu, { ...props, tip: "Tip: access this list by typing ${", buttonCss: menuBtn2 })
3298
+ ] });
3148
3299
  }
3149
3300
 
3150
3301
  // src/components/Variables/VariablesList.tsx
3151
- import { css as css21 } from "@emotion/react";
3302
+ import { css as css23 } from "@emotion/react";
3152
3303
  import {
3153
3304
  AddListButton,
3154
3305
  button,
3155
- Icon as Icon6,
3306
+ Icon as Icon5,
3156
3307
  Table,
3157
3308
  TableBody,
3158
3309
  TableCellData,
@@ -3163,8 +3314,8 @@ import {
3163
3314
  import { DragDropContext as DragDropContext2, Draggable as Draggable2, Droppable as Droppable2 } from "react-beautiful-dnd";
3164
3315
 
3165
3316
  // src/components/Variables/styles/VariablesList.styles.ts
3166
- import { css as css20 } from "@emotion/react";
3167
- var tableRow = (isDragging) => css20`
3317
+ import { css as css22 } from "@emotion/react";
3318
+ var tableRow = (isDragging) => css22`
3168
3319
  position: relative;
3169
3320
  ${isDragging ? `
3170
3321
  display: table;
@@ -3172,7 +3323,7 @@ var tableRow = (isDragging) => css20`
3172
3323
  top: auto !important;
3173
3324
  ` : void 0}
3174
3325
  `;
3175
- var tableCellDragIcon = css20`
3326
+ var tableCellDragIcon = css22`
3176
3327
  &::after {
3177
3328
  content: '';
3178
3329
  display: block;
@@ -3190,7 +3341,7 @@ var tableCellDragIcon = css20`
3190
3341
  opacity: 1;
3191
3342
  }
3192
3343
  `;
3193
- var variableName = css20`
3344
+ var variableName = css22`
3194
3345
  border: none;
3195
3346
  color: var(--brand-secondary-5);
3196
3347
  font-weight: var(--fw-medium);
@@ -3201,7 +3352,7 @@ var variableName = css20`
3201
3352
  white-space: nowrap;
3202
3353
  max-width: 20ch;
3203
3354
  `;
3204
- var variableValue = css20`
3355
+ var variableValue = css22`
3205
3356
  overflow: hidden;
3206
3357
  text-overflow: ellipsis;
3207
3358
  white-space: nowrap;
@@ -3209,7 +3360,7 @@ var variableValue = css20`
3209
3360
  `;
3210
3361
 
3211
3362
  // src/components/Variables/VariablesList.tsx
3212
- import { Fragment as Fragment5, jsx as jsx32, jsxs as jsxs19 } from "@emotion/react/jsx-runtime";
3363
+ import { Fragment as Fragment6, jsx as jsx33, jsxs as jsxs21 } from "@emotion/react/jsx-runtime";
3213
3364
  function VariablesList() {
3214
3365
  const { variables, dispatch } = useVariables();
3215
3366
  const sorted = variablesToList(variables);
@@ -3230,23 +3381,23 @@ function VariablesList() {
3230
3381
  return result;
3231
3382
  }
3232
3383
  };
3233
- return /* @__PURE__ */ jsxs19(Fragment5, { children: [
3234
- /* @__PURE__ */ jsx32(DragDropContext2, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx32(Droppable2, { droppableId: "variables-table", children: (provided) => /* @__PURE__ */ jsxs19(Table, { ...provided.droppableProps, ref: provided.innerRef, children: [
3235
- /* @__PURE__ */ jsx32(TableHead, { children: /* @__PURE__ */ jsxs19(TableRow, { children: [
3236
- /* @__PURE__ */ jsx32(TableCellHead, { children: "Name" }),
3237
- /* @__PURE__ */ jsx32(TableCellHead, { children: "Default Value" }),
3238
- /* @__PURE__ */ jsx32(TableCellHead, {})
3384
+ return /* @__PURE__ */ jsxs21(Fragment6, { children: [
3385
+ /* @__PURE__ */ jsx33(DragDropContext2, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx33(Droppable2, { droppableId: "variables-table", children: (provided) => /* @__PURE__ */ jsxs21(Table, { ...provided.droppableProps, ref: provided.innerRef, children: [
3386
+ /* @__PURE__ */ jsx33(TableHead, { children: /* @__PURE__ */ jsxs21(TableRow, { children: [
3387
+ /* @__PURE__ */ jsx33(TableCellHead, { children: "Name" }),
3388
+ /* @__PURE__ */ jsx33(TableCellHead, { children: "Default Value" }),
3389
+ /* @__PURE__ */ jsx33(TableCellHead, {})
3239
3390
  ] }) }),
3240
- /* @__PURE__ */ jsxs19(TableBody, { children: [
3391
+ /* @__PURE__ */ jsxs21(TableBody, { children: [
3241
3392
  sorted.map(({ name, displayName, default: defaultValue }, index) => {
3242
3393
  const text = displayName != null ? displayName : name;
3243
- return /* @__PURE__ */ jsx32(
3394
+ return /* @__PURE__ */ jsx33(
3244
3395
  Draggable2,
3245
3396
  {
3246
3397
  draggableId: name,
3247
3398
  index,
3248
3399
  isDragDisabled: sorted.length === 1,
3249
- children: (provided2, snapshot) => /* @__PURE__ */ jsxs19(
3400
+ children: (provided2, snapshot) => /* @__PURE__ */ jsxs21(
3250
3401
  TableRow,
3251
3402
  {
3252
3403
  ref: provided2.innerRef,
@@ -3256,7 +3407,7 @@ function VariablesList() {
3256
3407
  css: tableRow(snapshot.isDragging),
3257
3408
  "data-dragging": snapshot.isDragging,
3258
3409
  children: [
3259
- /* @__PURE__ */ jsx32(TableCellData, { css: sorted.length > 1 ? tableCellDragIcon : void 0, children: /* @__PURE__ */ jsx32(
3410
+ /* @__PURE__ */ jsx33(TableCellData, { css: sorted.length > 1 ? tableCellDragIcon : void 0, children: /* @__PURE__ */ jsx33(
3260
3411
  "button",
3261
3412
  {
3262
3413
  css: variableName,
@@ -3269,21 +3420,21 @@ function VariablesList() {
3269
3420
  children: text
3270
3421
  }
3271
3422
  ) }),
3272
- /* @__PURE__ */ jsx32(TableCellData, { children: /* @__PURE__ */ jsx32("span", { css: variableValue, title: defaultValue, children: defaultValue }) }),
3273
- /* @__PURE__ */ jsx32(TableCellData, { align: "right", children: /* @__PURE__ */ jsx32(
3423
+ /* @__PURE__ */ jsx33(TableCellData, { children: /* @__PURE__ */ jsx33("span", { css: variableValue, title: defaultValue, children: defaultValue }) }),
3424
+ /* @__PURE__ */ jsx33(TableCellData, { align: "right", children: /* @__PURE__ */ jsx33(
3274
3425
  "button",
3275
3426
  {
3276
3427
  type: "button",
3277
3428
  title: `delete ${text}`,
3278
3429
  css: [
3279
3430
  button,
3280
- css21`
3431
+ css23`
3281
3432
  background: transparent;
3282
3433
  `
3283
3434
  ],
3284
3435
  "aria-controls": text,
3285
3436
  onClick: () => dispatch({ type: "remove", variable: name }),
3286
- children: /* @__PURE__ */ jsx32(Icon6, { icon: "trash", iconColor: "red" })
3437
+ children: /* @__PURE__ */ jsx33(Icon5, { icon: "trash", iconColor: "red" })
3287
3438
  }
3288
3439
  ) })
3289
3440
  ]
@@ -3296,7 +3447,7 @@ function VariablesList() {
3296
3447
  provided.placeholder
3297
3448
  ] })
3298
3449
  ] }) }) }),
3299
- /* @__PURE__ */ jsx32(
3450
+ /* @__PURE__ */ jsx33(
3300
3451
  AddListButton,
3301
3452
  {
3302
3453
  onButtonClick: () => dispatch({ type: "edit", variable: "" }),
@@ -3309,28 +3460,90 @@ function VariablesList() {
3309
3460
  ] });
3310
3461
  }
3311
3462
 
3312
- // src/components/DataResourceVariablesList.tsx
3313
- import { jsx as jsx33, jsxs as jsxs20 } from "@emotion/react/jsx-runtime";
3314
- function DataResourceVariablesList({
3315
- setVariables,
3316
- noVariables: NoVariablesComponent,
3317
- typeRenderers
3463
+ // src/components/DataResourceDynamicInputProvider.tsx
3464
+ import { jsx as jsx34 } from "@emotion/react/jsx-runtime";
3465
+ function DataResourceDynamicInputProvider({
3466
+ children,
3467
+ dynamicInputs
3468
+ }) {
3469
+ if (dynamicInputs) {
3470
+ return /* @__PURE__ */ jsx34(DataResourceDynamicInputProviderRenderer, { dynamicInputs, children });
3471
+ }
3472
+ return /* @__PURE__ */ jsx34(DataResourceDynamicInputProviderContextShim, { children });
3473
+ }
3474
+ function DataResourceDynamicInputProviderContextShim(props) {
3475
+ const {
3476
+ metadata: { dynamicInputs }
3477
+ } = useMeshLocation("dataResource");
3478
+ return /* @__PURE__ */ jsx34(DataResourceDynamicInputProviderRenderer, { ...props, dynamicInputs });
3479
+ }
3480
+ function DataResourceDynamicInputProviderRenderer({
3481
+ children,
3482
+ dynamicInputs
3318
3483
  }) {
3484
+ return /* @__PURE__ */ jsx34(
3485
+ VariablesProvider,
3486
+ {
3487
+ value: convertDynamicInputsToVariables(dynamicInputs),
3488
+ onChange: () => {
3489
+ throw new Error("Cannot change dynamic inputs. Make sure that add variable is disabled.");
3490
+ },
3491
+ editVariableComponent: () => /* @__PURE__ */ jsx34("span", { children: "Cannot edit dynamic inputs." }),
3492
+ children
3493
+ }
3494
+ );
3495
+ }
3496
+ function convertDynamicInputsToVariables(dynamicInputs) {
3497
+ return Object.entries(dynamicInputs).reduce(
3498
+ (acc, [name, input]) => {
3499
+ acc[name] = {
3500
+ type: input.type,
3501
+ default: input.value,
3502
+ helpText: `${input.value}, from ${input.type === "path" ? "URL path" : "query string"}`
3503
+ };
3504
+ return acc;
3505
+ },
3506
+ {}
3507
+ );
3508
+ }
3509
+
3510
+ // src/components/DataResourceVariablesList.tsx
3511
+ import { Callout as Callout4 } from "@uniformdev/design-system";
3512
+ import { jsx as jsx35 } from "@emotion/react/jsx-runtime";
3513
+ function DataResourceVariablesList(props) {
3319
3514
  const {
3320
3515
  value,
3321
- metadata: { dataType }
3516
+ metadata: { dataType, dynamicInputs }
3322
3517
  } = useMeshLocation("dataResource");
3518
+ return /* @__PURE__ */ jsx35(
3519
+ DataResourceVariablesListExplicit,
3520
+ {
3521
+ ...props,
3522
+ value,
3523
+ dataType,
3524
+ dynamicInputs
3525
+ }
3526
+ );
3527
+ }
3528
+ function DataResourceVariablesListExplicit({
3529
+ setVariables,
3530
+ noVariables: NoVariablesComponent,
3531
+ typeRenderers,
3532
+ dataType,
3533
+ dynamicInputs,
3534
+ value
3535
+ }) {
3323
3536
  const variableDefinitions = variablesToList(dataType.variables);
3324
3537
  if (variableDefinitions.length === 0) {
3325
3538
  if (NoVariablesComponent) {
3326
- return /* @__PURE__ */ jsx33(NoVariablesComponent, {});
3539
+ return /* @__PURE__ */ jsx35(NoVariablesComponent, {});
3327
3540
  }
3328
- return /* @__PURE__ */ jsx33(Callout4, { type: "note", children: "No settings are required." });
3541
+ return /* @__PURE__ */ jsx35(Callout4, { type: "note", children: "No settings are required." });
3329
3542
  }
3330
- return /* @__PURE__ */ jsx33("div", { children: variableDefinitions.map((variableDefinition) => {
3543
+ return /* @__PURE__ */ jsx35(DataResourceDynamicInputProvider, { dynamicInputs, children: /* @__PURE__ */ jsx35("div", { children: variableDefinitions.map((variableDefinition) => {
3331
3544
  var _a, _b, _c;
3332
3545
  const VariableRenderer = variableDefinition.type ? (_a = typeRenderers == null ? void 0 : typeRenderers[variableDefinition.type]) != null ? _a : TextVariableRenderer : TextVariableRenderer;
3333
- return /* @__PURE__ */ jsx33("div", { children: /* @__PURE__ */ jsx33(
3546
+ return /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(
3334
3547
  VariableRenderer,
3335
3548
  {
3336
3549
  definition: variableDefinition,
@@ -3349,36 +3562,29 @@ function DataResourceVariablesList({
3349
3562
  }
3350
3563
  }
3351
3564
  ) }, variableDefinition.name);
3352
- }) });
3565
+ }) }) });
3353
3566
  }
3354
3567
  function TextVariableRenderer({ definition, value, setValue }) {
3355
- return /* @__PURE__ */ jsxs20("div", { children: [
3356
- /* @__PURE__ */ jsx33(
3357
- Input4,
3358
- {
3359
- label: definition.displayName || definition.name,
3360
- value,
3361
- caption: definition.helpText,
3362
- onChange: (e) => {
3363
- setValue(e.target.value);
3364
- }
3365
- }
3366
- ),
3367
- definition.default !== "" ? /* @__PURE__ */ jsxs20("small", { children: [
3368
- "Default value: ",
3369
- definition.default
3370
- ] }) : null
3371
- ] });
3568
+ var _a;
3569
+ return /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(
3570
+ InputVariables,
3571
+ {
3572
+ label: definition.displayName || definition.name,
3573
+ value: value != null ? value : "",
3574
+ caption: (_a = definition.helpText) != null ? _a : definition.default !== "" ? `Default value: ${definition.default}` : void 0,
3575
+ onChange: setValue
3576
+ }
3577
+ ) });
3372
3578
  }
3373
3579
 
3374
3580
  // src/components/Request/RequestBody.tsx
3375
- import { css as css23 } from "@emotion/react";
3581
+ import { css as css25 } from "@emotion/react";
3376
3582
  import { InputSelect as InputSelect4, JsonEditor } from "@uniformdev/design-system";
3377
- import { useState as useState9 } from "react";
3583
+ import { useState as useState10 } from "react";
3378
3584
 
3379
3585
  // src/components/Request/RequestProvider.tsx
3380
3586
  import * as React12 from "react";
3381
- import { jsx as jsx34 } from "@emotion/react/jsx-runtime";
3587
+ import { jsx as jsx36 } from "@emotion/react/jsx-runtime";
3382
3588
  var RequestContext = React12.createContext(null);
3383
3589
  function RequestProvider({ value, onChange, children }) {
3384
3590
  const contextValue = React12.useMemo(() => {
@@ -3447,7 +3653,7 @@ function RequestProvider({ value, onChange, children }) {
3447
3653
  request: value
3448
3654
  };
3449
3655
  }, [onChange, value]);
3450
- return /* @__PURE__ */ jsx34(RequestContext.Provider, { value: contextValue, children });
3656
+ return /* @__PURE__ */ jsx36(RequestContext.Provider, { value: contextValue, children });
3451
3657
  }
3452
3658
  function useRequest() {
3453
3659
  const context = React12.useContext(RequestContext);
@@ -3458,11 +3664,11 @@ function useRequest() {
3458
3664
  }
3459
3665
 
3460
3666
  // src/components/Request/styles/Request.styles.ts
3461
- import { css as css22 } from "@emotion/react";
3462
- var innerContentStyles = css22`
3667
+ import { css as css24 } from "@emotion/react";
3668
+ var innerContentStyles = css24`
3463
3669
  background: var(--white);
3464
3670
  `;
3465
- var requestTypeContainer = (bgColor) => css22`
3671
+ var requestTypeContainer = (bgColor) => css24`
3466
3672
  align-items: start;
3467
3673
  background: ${bgColor};
3468
3674
  display: grid;
@@ -3471,17 +3677,17 @@ var requestTypeContainer = (bgColor) => css22`
3471
3677
  `;
3472
3678
 
3473
3679
  // src/components/Request/RequestTypeContainer.tsx
3474
- import { jsx as jsx35 } from "@emotion/react/jsx-runtime";
3680
+ import { jsx as jsx37 } from "@emotion/react/jsx-runtime";
3475
3681
  var RequestTypeContainer = ({
3476
3682
  bgColor = "transparent",
3477
3683
  children,
3478
3684
  ...props
3479
3685
  }) => {
3480
- return /* @__PURE__ */ jsx35("div", { css: requestTypeContainer(bgColor), ...props, children });
3686
+ return /* @__PURE__ */ jsx37("div", { css: requestTypeContainer(bgColor), ...props, children });
3481
3687
  };
3482
3688
 
3483
3689
  // src/components/Request/RequestBody.tsx
3484
- import { jsx as jsx36, jsxs as jsxs21 } from "@emotion/react/jsx-runtime";
3690
+ import { jsx as jsx38, jsxs as jsxs22 } from "@emotion/react/jsx-runtime";
3485
3691
  var LANGUAGE_OPTIONS = [
3486
3692
  { label: "Text", value: "plaintext" },
3487
3693
  { label: "JSON", value: "json" },
@@ -3500,22 +3706,22 @@ var LANGUAGE_TO_CONTENT_TYPE = {
3500
3706
  };
3501
3707
  function RequestBody() {
3502
3708
  const { request, dispatch } = useRequest();
3503
- const [language, setLanguage] = useState9("json");
3504
- return /* @__PURE__ */ jsxs21(
3709
+ const [language, setLanguage] = useState10("json");
3710
+ return /* @__PURE__ */ jsxs22(
3505
3711
  "div",
3506
3712
  {
3507
- css: css23`
3713
+ css: css25`
3508
3714
  background: var(--white);
3509
3715
  `,
3510
3716
  children: [
3511
- /* @__PURE__ */ jsx36(
3717
+ /* @__PURE__ */ jsx38(
3512
3718
  RequestTypeContainer,
3513
3719
  {
3514
3720
  bgColor: "var(--gray-100)",
3515
- css: css23`
3721
+ css: css25`
3516
3722
  padding: var(--spacing-sm) var(--spacing-base);
3517
3723
  `,
3518
- children: /* @__PURE__ */ jsx36(
3724
+ children: /* @__PURE__ */ jsx38(
3519
3725
  InputSelect4,
3520
3726
  {
3521
3727
  label: "Language",
@@ -3538,7 +3744,7 @@ function RequestBody() {
3538
3744
  )
3539
3745
  }
3540
3746
  ),
3541
- /* @__PURE__ */ jsx36(
3747
+ /* @__PURE__ */ jsx38(
3542
3748
  JsonEditor,
3543
3749
  {
3544
3750
  height: 200,
@@ -3557,16 +3763,16 @@ function RequestBody() {
3557
3763
 
3558
3764
  // src/components/Request/RequestHeaders.tsx
3559
3765
  import {
3560
- Input as Input5,
3766
+ Input as Input4,
3561
3767
  Table as Table2,
3562
3768
  TableBody as TableBody2,
3563
3769
  TableCellData as TableCellData2,
3564
3770
  TableCellHead as TableCellHead2,
3565
3771
  TableHead as TableHead2,
3566
3772
  TableRow as TableRow2,
3567
- WarningMessage
3773
+ WarningMessage as WarningMessage2
3568
3774
  } from "@uniformdev/design-system";
3569
- import { jsx as jsx37, jsxs as jsxs22 } from "@emotion/react/jsx-runtime";
3775
+ import { jsx as jsx39, jsxs as jsxs23 } from "@emotion/react/jsx-runtime";
3570
3776
  function RequestHeaders({ disableVariables }) {
3571
3777
  var _a, _b;
3572
3778
  const { dispatch, request } = useRequest();
@@ -3582,29 +3788,29 @@ function RequestHeaders({ disableVariables }) {
3582
3788
  index
3583
3789
  });
3584
3790
  };
3585
- return /* @__PURE__ */ jsx37("div", { css: innerContentStyles, children: /* @__PURE__ */ jsxs22(Table2, { children: [
3586
- /* @__PURE__ */ jsx37(TableHead2, { children: /* @__PURE__ */ jsxs22(TableRow2, { children: [
3587
- /* @__PURE__ */ jsx37(TableCellHead2, { children: "Name" }),
3588
- /* @__PURE__ */ jsx37(TableCellHead2, { children: "Value" })
3791
+ return /* @__PURE__ */ jsx39("div", { css: innerContentStyles, children: /* @__PURE__ */ jsxs23(Table2, { children: [
3792
+ /* @__PURE__ */ jsx39(TableHead2, { children: /* @__PURE__ */ jsxs23(TableRow2, { children: [
3793
+ /* @__PURE__ */ jsx39(TableCellHead2, { children: "Name" }),
3794
+ /* @__PURE__ */ jsx39(TableCellHead2, { children: "Value" })
3589
3795
  ] }) }),
3590
- /* @__PURE__ */ jsxs22(TableBody2, { children: [
3796
+ /* @__PURE__ */ jsxs23(TableBody2, { children: [
3591
3797
  (_b = (_a = request.baseRequest) == null ? void 0 : _a.headers) == null ? void 0 : _b.map((baseHeader) => {
3592
- return /* @__PURE__ */ jsxs22(TableRow2, { children: [
3593
- /* @__PURE__ */ jsxs22(TableCellData2, { width: "50%", children: [
3798
+ return /* @__PURE__ */ jsxs23(TableRow2, { children: [
3799
+ /* @__PURE__ */ jsxs23(TableCellData2, { width: "50%", children: [
3594
3800
  baseHeader.key,
3595
- /* @__PURE__ */ jsx37("br", {}),
3596
- /* @__PURE__ */ jsx37("i", { css: { color: "var(--gray-500)" }, children: /* @__PURE__ */ jsx37("small", { children: "from data source" }) })
3801
+ /* @__PURE__ */ jsx39("br", {}),
3802
+ /* @__PURE__ */ jsx39("i", { css: { color: "var(--gray-500)" }, children: /* @__PURE__ */ jsx39("small", { children: "from data source" }) })
3597
3803
  ] }),
3598
- /* @__PURE__ */ jsxs22(TableCellData2, { width: "50%", children: [
3599
- /* @__PURE__ */ jsx37("i", { css: { color: "var(--gray-500)" }, children: baseHeader.value }),
3600
- request.headers.find((p) => p.key === baseHeader.key) ? /* @__PURE__ */ jsx37(WarningMessage, { message: "overridden below" }) : null
3804
+ /* @__PURE__ */ jsxs23(TableCellData2, { width: "50%", children: [
3805
+ /* @__PURE__ */ jsx39("i", { css: { color: "var(--gray-500)" }, children: baseHeader.value }),
3806
+ request.headers.find((p2) => p2.key === baseHeader.key) ? /* @__PURE__ */ jsx39(WarningMessage2, { message: "overridden below" }) : null
3601
3807
  ] })
3602
3808
  ] }, baseHeader.key);
3603
3809
  }),
3604
3810
  deezHeaders.map((header, index) => {
3605
- return /* @__PURE__ */ jsxs22(TableRow2, { children: [
3606
- /* @__PURE__ */ jsx37(TableCellData2, { width: "50%", children: /* @__PURE__ */ jsx37(
3607
- Input5,
3811
+ return /* @__PURE__ */ jsxs23(TableRow2, { children: [
3812
+ /* @__PURE__ */ jsx39(TableCellData2, { width: "50%", children: /* @__PURE__ */ jsx39(
3813
+ Input4,
3608
3814
  {
3609
3815
  label: header.key,
3610
3816
  value: header.key,
@@ -3623,7 +3829,7 @@ function RequestHeaders({ disableVariables }) {
3623
3829
  "data-test-id": "header-key"
3624
3830
  }
3625
3831
  ) }),
3626
- /* @__PURE__ */ jsx37(TableCellData2, { width: "50%", children: header.key ? /* @__PURE__ */ jsx37(
3832
+ /* @__PURE__ */ jsx39(TableCellData2, { width: "50%", children: header.key ? /* @__PURE__ */ jsx39(
3627
3833
  InputVariables,
3628
3834
  {
3629
3835
  value: header.value,
@@ -3641,11 +3847,11 @@ function RequestHeaders({ disableVariables }) {
3641
3847
 
3642
3848
  // src/components/Request/RequestMethodSelect.tsx
3643
3849
  import { InputSelect as InputSelect5 } from "@uniformdev/design-system";
3644
- import { jsx as jsx38 } from "@emotion/react/jsx-runtime";
3850
+ import { jsx as jsx40 } from "@emotion/react/jsx-runtime";
3645
3851
  function RequestMethodSelect(props) {
3646
3852
  var _a;
3647
3853
  const { request, dispatch } = useRequest();
3648
- return /* @__PURE__ */ jsx38(
3854
+ return /* @__PURE__ */ jsx40(
3649
3855
  InputSelect5,
3650
3856
  {
3651
3857
  ...props,
@@ -3662,16 +3868,16 @@ function RequestMethodSelect(props) {
3662
3868
 
3663
3869
  // src/components/Request/RequestParameters.tsx
3664
3870
  import {
3665
- Input as Input6,
3871
+ Input as Input5,
3666
3872
  Table as Table3,
3667
3873
  TableBody as TableBody3,
3668
3874
  TableCellData as TableCellData3,
3669
3875
  TableCellHead as TableCellHead3,
3670
3876
  TableHead as TableHead3,
3671
3877
  TableRow as TableRow3,
3672
- WarningMessage as WarningMessage2
3878
+ WarningMessage as WarningMessage3
3673
3879
  } from "@uniformdev/design-system";
3674
- import { jsx as jsx39, jsxs as jsxs23 } from "@emotion/react/jsx-runtime";
3880
+ import { jsx as jsx41, jsxs as jsxs24 } from "@emotion/react/jsx-runtime";
3675
3881
  function RequestParameters({ disableVariables }) {
3676
3882
  var _a, _b;
3677
3883
  const { dispatch, request } = useRequest();
@@ -3687,29 +3893,29 @@ function RequestParameters({ disableVariables }) {
3687
3893
  index
3688
3894
  });
3689
3895
  };
3690
- return /* @__PURE__ */ jsx39("div", { css: innerContentStyles, children: /* @__PURE__ */ jsxs23(Table3, { children: [
3691
- /* @__PURE__ */ jsx39(TableHead3, { children: /* @__PURE__ */ jsxs23(TableRow3, { children: [
3692
- /* @__PURE__ */ jsx39(TableCellHead3, { children: "Name" }),
3693
- /* @__PURE__ */ jsx39(TableCellHead3, { children: "Value" })
3896
+ return /* @__PURE__ */ jsx41("div", { css: innerContentStyles, children: /* @__PURE__ */ jsxs24(Table3, { children: [
3897
+ /* @__PURE__ */ jsx41(TableHead3, { children: /* @__PURE__ */ jsxs24(TableRow3, { children: [
3898
+ /* @__PURE__ */ jsx41(TableCellHead3, { children: "Name" }),
3899
+ /* @__PURE__ */ jsx41(TableCellHead3, { children: "Value" })
3694
3900
  ] }) }),
3695
- /* @__PURE__ */ jsxs23(TableBody3, { children: [
3901
+ /* @__PURE__ */ jsxs24(TableBody3, { children: [
3696
3902
  (_b = (_a = request.baseRequest) == null ? void 0 : _a.parameters) == null ? void 0 : _b.map((baseParameter) => {
3697
- return /* @__PURE__ */ jsxs23(TableRow3, { children: [
3698
- /* @__PURE__ */ jsxs23(TableCellData3, { width: "50%", children: [
3903
+ return /* @__PURE__ */ jsxs24(TableRow3, { children: [
3904
+ /* @__PURE__ */ jsxs24(TableCellData3, { width: "50%", children: [
3699
3905
  baseParameter.key,
3700
- /* @__PURE__ */ jsx39("br", {}),
3701
- /* @__PURE__ */ jsx39("i", { css: { color: "var(--gray-500)" }, children: /* @__PURE__ */ jsx39("small", { children: "from data source" }) })
3906
+ /* @__PURE__ */ jsx41("br", {}),
3907
+ /* @__PURE__ */ jsx41("i", { css: { color: "var(--gray-500)" }, children: /* @__PURE__ */ jsx41("small", { children: "from data source" }) })
3702
3908
  ] }),
3703
- /* @__PURE__ */ jsxs23(TableCellData3, { width: "50%", children: [
3704
- /* @__PURE__ */ jsx39("i", { css: { color: "var(--gray-500)" }, children: baseParameter.value }),
3705
- request.parameters.find((p) => p.key === baseParameter.key) ? /* @__PURE__ */ jsx39(WarningMessage2, { message: "overridden below" }) : null
3909
+ /* @__PURE__ */ jsxs24(TableCellData3, { width: "50%", children: [
3910
+ /* @__PURE__ */ jsx41("i", { css: { color: "var(--gray-500)" }, children: baseParameter.value }),
3911
+ request.parameters.find((p2) => p2.key === baseParameter.key) ? /* @__PURE__ */ jsx41(WarningMessage3, { message: "overridden below" }) : null
3706
3912
  ] })
3707
3913
  ] }, baseParameter.key);
3708
3914
  }),
3709
3915
  deezParameters.map((parameter, index) => {
3710
- return /* @__PURE__ */ jsxs23(TableRow3, { children: [
3711
- /* @__PURE__ */ jsx39(TableCellData3, { width: "50%", children: /* @__PURE__ */ jsx39(
3712
- Input6,
3916
+ return /* @__PURE__ */ jsxs24(TableRow3, { children: [
3917
+ /* @__PURE__ */ jsx41(TableCellData3, { width: "50%", children: /* @__PURE__ */ jsx41(
3918
+ Input5,
3713
3919
  {
3714
3920
  label: parameter.key,
3715
3921
  value: parameter.key,
@@ -3728,7 +3934,7 @@ function RequestParameters({ disableVariables }) {
3728
3934
  "data-test-id": "parameter-key"
3729
3935
  }
3730
3936
  ) }),
3731
- /* @__PURE__ */ jsx39(TableCellData3, { width: "50%", children: parameter.key ? /* @__PURE__ */ jsx39(
3937
+ /* @__PURE__ */ jsx41(TableCellData3, { width: "50%", children: parameter.key ? /* @__PURE__ */ jsx41(
3732
3938
  InputVariables,
3733
3939
  {
3734
3940
  value: parameter.value,
@@ -3749,7 +3955,7 @@ function RequestParameters({ disableVariables }) {
3749
3955
  }
3750
3956
 
3751
3957
  // src/components/Request/RequestUrl.tsx
3752
- import { css as css24 } from "@emotion/react";
3958
+ import { css as css26 } from "@emotion/react";
3753
3959
  import { useMemo as useMemo7 } from "react";
3754
3960
 
3755
3961
  // src/components/Request/urlEncodeRequestParameter.ts
@@ -3771,7 +3977,7 @@ function decodeVariablesInUrlEncodedString(string, varValues) {
3771
3977
  }
3772
3978
 
3773
3979
  // src/components/Request/RequestUrl.tsx
3774
- import { Fragment as Fragment6, jsx as jsx40, jsxs as jsxs24 } from "@emotion/react/jsx-runtime";
3980
+ import { Fragment as Fragment7, jsx as jsx42, jsxs as jsxs25 } from "@emotion/react/jsx-runtime";
3775
3981
  function RequestUrl() {
3776
3982
  var _a, _b;
3777
3983
  const { variables } = useVariables();
@@ -3781,25 +3987,25 @@ function RequestUrl() {
3781
3987
  if (!((_a2 = request.baseRequest) == null ? void 0 : _a2.parameters)) {
3782
3988
  return request.parameters;
3783
3989
  }
3784
- return request.baseRequest.parameters.filter((baseParam) => !request.parameters.find((p) => p.key === baseParam.key)).concat(request.parameters);
3990
+ return request.baseRequest.parameters.filter((baseParam) => !request.parameters.find((p2) => p2.key === baseParam.key)).concat(request.parameters);
3785
3991
  }, [(_a = request.baseRequest) == null ? void 0 : _a.parameters, request.parameters]);
3786
- return /* @__PURE__ */ jsxs24(
3992
+ return /* @__PURE__ */ jsxs25(
3787
3993
  "small",
3788
3994
  {
3789
- css: css24`
3995
+ css: css26`
3790
3996
  display: inline-block;
3791
3997
  margin-bottom: var(--spacing-xs);
3792
3998
  word-break: break-word;
3793
3999
  `,
3794
4000
  children: [
3795
- request.baseRequest ? /* @__PURE__ */ jsx40("span", { children: (_b = request.baseRequest) == null ? void 0 : _b.baseUrl }) : null,
3796
- /* @__PURE__ */ jsxs24("span", { css: { fontWeight: request.baseRequest ? "bold" : "inherit" }, children: [
4001
+ request.baseRequest ? /* @__PURE__ */ jsx42("span", { children: (_b = request.baseRequest) == null ? void 0 : _b.baseUrl }) : null,
4002
+ /* @__PURE__ */ jsxs25("span", { css: { fontWeight: request.baseRequest ? "bold" : "inherit" }, children: [
3797
4003
  urlEncodeRequestUrl(request.relativeUrl, variables),
3798
- mergedParameters.length > 0 ? /* @__PURE__ */ jsxs24(Fragment6, { children: [
4004
+ mergedParameters.length > 0 ? /* @__PURE__ */ jsxs25(Fragment7, { children: [
3799
4005
  "?",
3800
4006
  mergedParameters.map((param, index) => {
3801
4007
  const encoded = urlEncodeRequestParameter(param, variables);
3802
- return /* @__PURE__ */ jsxs24("span", { children: [
4008
+ return /* @__PURE__ */ jsxs25("span", { children: [
3803
4009
  index > 0 ? "&" : null,
3804
4010
  encoded.key,
3805
4011
  "=",
@@ -3813,35 +4019,42 @@ function RequestUrl() {
3813
4019
  );
3814
4020
  }
3815
4021
 
4022
+ // src/components/Request/util/handlePastedUrl.ts
4023
+ function handlePastedUrl(value, currentRequest, dispatch) {
4024
+ var _a, _b, _c;
4025
+ const indexOfQueryString = value.indexOf("?");
4026
+ const hasQueryString = indexOfQueryString >= 0;
4027
+ let relativeUrl = hasQueryString ? value.substring(0, indexOfQueryString) : value;
4028
+ if (((_a = currentRequest.baseRequest) == null ? void 0 : _a.baseUrl) && relativeUrl.startsWith((_b = currentRequest.baseRequest) == null ? void 0 : _b.baseUrl)) {
4029
+ relativeUrl = relativeUrl.substring((_c = currentRequest.baseRequest) == null ? void 0 : _c.baseUrl.length);
4030
+ }
4031
+ dispatch({ type: "setRelativeUrl", relativeUrl });
4032
+ if (hasQueryString) {
4033
+ for (let index = currentRequest.parameters.length - 1; index >= 0; index--) {
4034
+ dispatch({ type: "removeParameter", index });
4035
+ }
4036
+ try {
4037
+ const query = new URLSearchParams(value.substring(indexOfQueryString));
4038
+ query.forEach((value2, key) => {
4039
+ dispatch({ type: "updateParameter", parameter: { key, value: value2 } });
4040
+ });
4041
+ } catch (e) {
4042
+ }
4043
+ }
4044
+ }
4045
+
3816
4046
  // src/components/Request/RequestUrlInput.tsx
3817
- import { jsx as jsx41 } from "@emotion/react/jsx-runtime";
4047
+ import { jsx as jsx43 } from "@emotion/react/jsx-runtime";
3818
4048
  function RequestUrlInput(props) {
3819
4049
  const { request, dispatch } = useRequest();
3820
- return /* @__PURE__ */ jsx41(
4050
+ return /* @__PURE__ */ jsx43(
3821
4051
  InputVariables,
3822
4052
  {
4053
+ disableReset: true,
3823
4054
  ...props,
3824
4055
  value: request.relativeUrl,
3825
4056
  onPaste: (value) => {
3826
- var _a, _b, _c;
3827
- const indexOfQueryString = value.indexOf("?");
3828
- if (indexOfQueryString >= 0) {
3829
- let relativeUrl = value.substring(0, indexOfQueryString);
3830
- if (((_a = request.baseRequest) == null ? void 0 : _a.baseUrl) && relativeUrl.startsWith((_b = request.baseRequest) == null ? void 0 : _b.baseUrl)) {
3831
- relativeUrl = relativeUrl.substring((_c = request.baseRequest) == null ? void 0 : _c.baseUrl.length);
3832
- }
3833
- dispatch({ type: "setRelativeUrl", relativeUrl });
3834
- for (let index = request.parameters.length - 1; index >= 0; index--) {
3835
- dispatch({ type: "removeParameter", index });
3836
- }
3837
- try {
3838
- const query = new URLSearchParams(value.substring(indexOfQueryString));
3839
- query.forEach((value2, key) => {
3840
- dispatch({ type: "updateParameter", parameter: { key, value: value2 } });
3841
- });
3842
- } catch (e) {
3843
- }
3844
- }
4057
+ handlePastedUrl(value, request, dispatch);
3845
4058
  },
3846
4059
  onChange: (value) => {
3847
4060
  dispatch({ type: "setRelativeUrl", relativeUrl: value });
@@ -3855,7 +4068,7 @@ function RequestUrlInput(props) {
3855
4068
  function useRequestHeader(headerName) {
3856
4069
  var _a, _b;
3857
4070
  const { request, dispatch } = useRequest();
3858
- const headerIndex = request.headers.findIndex((f) => f.key === headerName);
4071
+ const headerIndex = request.headers.findIndex((f2) => f2.key === headerName);
3859
4072
  return {
3860
4073
  value: (_b = (_a = request.headers[headerIndex]) == null ? void 0 : _a.value) != null ? _b : "",
3861
4074
  update: (value) => {
@@ -3872,7 +4085,7 @@ function useRequestHeader(headerName) {
3872
4085
  function useRequestParameter(paramName) {
3873
4086
  var _a, _b;
3874
4087
  const { request, dispatch } = useRequest();
3875
- const paramIndex = request.parameters.findIndex((f) => f.key === paramName);
4088
+ const paramIndex = request.parameters.findIndex((f2) => f2.key === paramName);
3876
4089
  return {
3877
4090
  value: (_b = (_a = request.parameters[paramIndex]) == null ? void 0 : _a.value) != null ? _b : "",
3878
4091
  update: (value) => {
@@ -3886,18 +4099,18 @@ function useRequestParameter(paramName) {
3886
4099
  }
3887
4100
 
3888
4101
  // src/components/DataSourceEditor.tsx
3889
- import { jsx as jsx42 } from "@emotion/react/jsx-runtime";
4102
+ import { jsx as jsx44 } from "@emotion/react/jsx-runtime";
3890
4103
  function DataSourceEditor({ onChange, children, editVariableComponent }) {
3891
4104
  var _a;
3892
4105
  const { value } = useMeshLocation("dataSource");
3893
4106
  const currentRequestValue = convertDataSourceToRequestData(value);
3894
- return /* @__PURE__ */ jsx42(
4107
+ return /* @__PURE__ */ jsx44(
3895
4108
  VariablesProvider,
3896
4109
  {
3897
4110
  value: (_a = value.variables) != null ? _a : {},
3898
4111
  onChange: (newValue) => onChange((prev) => ({ newValue: { ...prev, variables: newValue } })),
3899
4112
  editVariableComponent,
3900
- children: /* @__PURE__ */ jsx42(
4113
+ children: /* @__PURE__ */ jsx44(
3901
4114
  RequestProvider,
3902
4115
  {
3903
4116
  value: currentRequestValue,
@@ -3934,7 +4147,7 @@ function convertRequestDataToDataSource(dataSource, requestData) {
3934
4147
  }
3935
4148
 
3936
4149
  // src/components/DataTypeEditor.tsx
3937
- import { jsx as jsx43 } from "@emotion/react/jsx-runtime";
4150
+ import { jsx as jsx45 } from "@emotion/react/jsx-runtime";
3938
4151
  function DataTypeEditor({ onChange, children, editVariableComponent }) {
3939
4152
  var _a;
3940
4153
  const {
@@ -3942,13 +4155,13 @@ function DataTypeEditor({ onChange, children, editVariableComponent }) {
3942
4155
  metadata: { dataSource }
3943
4156
  } = useMeshLocation("dataType");
3944
4157
  const currentRequestValue = convertDataTypeToRequestData(value, dataSource);
3945
- return /* @__PURE__ */ jsx43(
4158
+ return /* @__PURE__ */ jsx45(
3946
4159
  VariablesProvider,
3947
4160
  {
3948
4161
  value: (_a = value.variables) != null ? _a : {},
3949
4162
  onChange: (newValue) => onChange((prev) => ({ newValue: { ...prev, variables: newValue } })),
3950
4163
  editVariableComponent,
3951
- children: /* @__PURE__ */ jsx43(
4164
+ children: /* @__PURE__ */ jsx45(
3952
4165
  RequestProvider,
3953
4166
  {
3954
4167
  value: currentRequestValue,
@@ -3998,10 +4211,10 @@ import { LoadingIndicator as LoadingIndicator2, Theme as Theme2 } from "@uniform
3998
4211
 
3999
4212
  // src/hooks/useInitializeUniformMeshSdk.ts
4000
4213
  import { initializeUniformMeshSDK } from "@uniformdev/mesh-sdk";
4001
- import { useEffect as useEffect8, useRef as useRef10, useState as useState10 } from "react";
4214
+ import { useEffect as useEffect8, useRef as useRef10, useState as useState11 } from "react";
4002
4215
  var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
4003
- const [error, setError] = useState10();
4004
- const [sdk, setSdk] = useState10();
4216
+ const [error, setError] = useState11();
4217
+ const [sdk, setSdk] = useState11();
4005
4218
  const initializationInProgress = useRef10(false);
4006
4219
  useEffect8(
4007
4220
  () => {
@@ -4036,7 +4249,7 @@ var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
4036
4249
  };
4037
4250
 
4038
4251
  // src/components/MeshApp.tsx
4039
- import { jsx as jsx44, jsxs as jsxs25 } from "@emotion/react/jsx-runtime";
4252
+ import { jsx as jsx46, jsxs as jsxs26 } from "@emotion/react/jsx-runtime";
4040
4253
  var MeshApp = ({
4041
4254
  children,
4042
4255
  loadingComponent,
@@ -4045,36 +4258,36 @@ var MeshApp = ({
4045
4258
  const { initializing, error, sdk } = useInitializeUniformMeshSdk();
4046
4259
  if (initializing || !sdk) {
4047
4260
  const LoadingComponent = loadingComponent;
4048
- return LoadingComponent ? /* @__PURE__ */ jsx44(LoadingComponent, {}) : /* @__PURE__ */ jsx44(LoadingIndicator2, {});
4261
+ return LoadingComponent ? /* @__PURE__ */ jsx46(LoadingComponent, {}) : /* @__PURE__ */ jsx46(LoadingIndicator2, {});
4049
4262
  }
4050
4263
  if (error) {
4051
4264
  const ErrorComponent = errorComponent;
4052
4265
  if (ErrorComponent) {
4053
- return /* @__PURE__ */ jsx44(ErrorComponent, { error });
4266
+ return /* @__PURE__ */ jsx46(ErrorComponent, { error });
4054
4267
  }
4055
4268
  throw error;
4056
4269
  }
4057
- return /* @__PURE__ */ jsxs25(UniformMeshSdkContext.Provider, { value: { sdk }, children: [
4058
- /* @__PURE__ */ jsx44(Theme2, {}),
4059
- /* @__PURE__ */ jsx44(UniformMeshLocationContextProvider, { children })
4270
+ return /* @__PURE__ */ jsxs26(UniformMeshSdkContext.Provider, { value: { sdk }, children: [
4271
+ /* @__PURE__ */ jsx46(Theme2, {}),
4272
+ /* @__PURE__ */ jsx46(UniformMeshLocationContextProvider, { children })
4060
4273
  ] });
4061
4274
  };
4062
4275
 
4063
4276
  // src/components/ObjectSearch/DataRefreshButton.tsx
4064
- import { css as css25 } from "@emotion/react";
4277
+ import { css as css27 } from "@emotion/react";
4065
4278
  import { Button as Button3, LoadingIndicator as LoadingIndicator3 } from "@uniformdev/design-system";
4066
- import { jsx as jsx45, jsxs as jsxs26 } from "@emotion/react/jsx-runtime";
4279
+ import { jsx as jsx47, jsxs as jsxs27 } from "@emotion/react/jsx-runtime";
4067
4280
  var DataRefreshButton = ({
4068
4281
  buttonText,
4069
4282
  isLoading,
4070
4283
  onRefreshData,
4071
4284
  ...props
4072
4285
  }) => {
4073
- return /* @__PURE__ */ jsxs26(Button3, { buttonType: "primaryInvert", onClick: onRefreshData, disabled: isLoading, ...props, children: [
4074
- !isLoading ? null : /* @__PURE__ */ jsx45(
4286
+ return /* @__PURE__ */ jsxs27(Button3, { buttonType: "primaryInvert", onClick: onRefreshData, disabled: isLoading, ...props, children: [
4287
+ !isLoading ? null : /* @__PURE__ */ jsx47(
4075
4288
  LoadingIndicator3,
4076
4289
  {
4077
- css: css25`
4290
+ css: css27`
4078
4291
  ${isLoading ? "opacity: 0.2;" : void 0}
4079
4292
  `
4080
4293
  }
@@ -4083,39 +4296,1179 @@ var DataRefreshButton = ({
4083
4296
  ] });
4084
4297
  };
4085
4298
 
4086
- // src/components/ObjectSearch/ObjectSearchContainer.tsx
4087
- import { Container, IconsProvider, ScrollableList, VerticalRhythm } from "@uniformdev/design-system";
4088
- import { jsx as jsx46, jsxs as jsxs27 } from "@emotion/react/jsx-runtime";
4089
- var ObjectSearchContainer = ({
4090
- searchFilters,
4091
- resultList,
4092
- children
4093
- }) => {
4094
- return /* @__PURE__ */ jsx46(IconsProvider, { children: /* @__PURE__ */ jsxs27(VerticalRhythm, { children: [
4095
- /* @__PURE__ */ jsx46(Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: /* @__PURE__ */ jsxs27(VerticalRhythm, { children: [
4096
- searchFilters,
4097
- !resultList ? null : /* @__PURE__ */ jsx46(ScrollableList, { role: "list", children: resultList })
4098
- ] }) }),
4099
- children
4100
- ] }) });
4299
+ // ../context/dist/api/api.mjs
4300
+ var __defProp2 = Object.defineProperty;
4301
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4302
+ var __publicField = (obj, key, value) => {
4303
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4304
+ return value;
4305
+ };
4306
+ var __accessCheck = (obj, member, msg) => {
4307
+ if (!member.has(obj))
4308
+ throw TypeError("Cannot " + msg);
4309
+ };
4310
+ var __privateGet = (obj, member, getter) => {
4311
+ __accessCheck(obj, member, "read from private field");
4312
+ return getter ? getter.call(obj) : member.get(obj);
4313
+ };
4314
+ var __privateAdd = (obj, member, value) => {
4315
+ if (member.has(obj))
4316
+ throw TypeError("Cannot add the same private member more than once");
4317
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4318
+ };
4319
+ var nullLimitPolicy = async (func) => await func();
4320
+ var ApiClientError = class extends Error {
4321
+ constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
4322
+ super(
4323
+ `${errorMessage}
4324
+ ${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
4325
+ );
4326
+ this.errorMessage = errorMessage;
4327
+ this.fetchMethod = fetchMethod;
4328
+ this.fetchUri = fetchUri;
4329
+ this.statusCode = statusCode;
4330
+ this.statusText = statusText;
4331
+ this.requestId = requestId;
4332
+ Object.setPrototypeOf(this, ApiClientError.prototype);
4333
+ }
4334
+ };
4335
+ var ApiClient = class {
4336
+ constructor(options) {
4337
+ __publicField(this, "options");
4338
+ var _a, _b, _c, _d, _e;
4339
+ if (!options.apiKey && !options.bearerToken) {
4340
+ throw new Error("You must provide an API key or a bearer token");
4341
+ }
4342
+ let leFetch = options.fetch;
4343
+ if (!leFetch) {
4344
+ if (typeof window !== "undefined") {
4345
+ leFetch = window.fetch.bind(window);
4346
+ } else if (typeof fetch !== "undefined") {
4347
+ leFetch = fetch;
4348
+ } else {
4349
+ throw new Error("You must provide or polyfill a fetch implementation when not in a browser");
4350
+ }
4351
+ }
4352
+ this.options = {
4353
+ ...options,
4354
+ fetch: leFetch,
4355
+ apiHost: this.ensureApiHost(options.apiHost),
4356
+ apiKey: (_a = options.apiKey) != null ? _a : null,
4357
+ projectId: (_b = options.projectId) != null ? _b : null,
4358
+ bearerToken: (_c = options.bearerToken) != null ? _c : null,
4359
+ limitPolicy: (_d = options.limitPolicy) != null ? _d : nullLimitPolicy,
4360
+ bypassCache: (_e = options.bypassCache) != null ? _e : false
4361
+ };
4362
+ }
4363
+ async apiClient(fetchUri, options) {
4364
+ return this.options.limitPolicy(async () => {
4365
+ var _a;
4366
+ const coreHeaders = this.options.apiKey ? {
4367
+ "x-api-key": this.options.apiKey
4368
+ } : {
4369
+ Authorization: `Bearer ${this.options.bearerToken}`
4370
+ };
4371
+ if (this.options.bypassCache) {
4372
+ coreHeaders["x-bypass-cache"] = "true";
4373
+ }
4374
+ const callApi = () => this.options.fetch(fetchUri.toString(), {
4375
+ ...options,
4376
+ headers: {
4377
+ ...options == null ? void 0 : options.headers,
4378
+ ...coreHeaders
4379
+ }
4380
+ });
4381
+ const apiResponse = await handleRateLimits(callApi);
4382
+ if (!apiResponse.ok) {
4383
+ let message = "";
4384
+ try {
4385
+ const responseText = await apiResponse.text();
4386
+ try {
4387
+ const parsed = JSON.parse(responseText);
4388
+ if (parsed.errorMessage) {
4389
+ message = Array.isArray(parsed.errorMessage) ? parsed.errorMessage.join(", ") : parsed.errorMessage;
4390
+ } else {
4391
+ message = responseText;
4392
+ }
4393
+ } catch (e) {
4394
+ message = responseText;
4395
+ }
4396
+ } catch (e) {
4397
+ message = `General error`;
4398
+ }
4399
+ throw new ApiClientError(
4400
+ message,
4401
+ (_a = options == null ? void 0 : options.method) != null ? _a : "GET",
4402
+ fetchUri.toString(),
4403
+ apiResponse.status,
4404
+ apiResponse.statusText,
4405
+ ApiClient.getRequestId(apiResponse)
4406
+ );
4407
+ }
4408
+ if (options == null ? void 0 : options.expectNoContent) {
4409
+ return null;
4410
+ }
4411
+ return await apiResponse.json();
4412
+ });
4413
+ }
4414
+ createUrl(path, queryParams, hostOverride) {
4415
+ const url = new URL(`${hostOverride != null ? hostOverride : this.options.apiHost}${path}`);
4416
+ Object.entries(queryParams != null ? queryParams : {}).forEach(([key, value]) => {
4417
+ var _a;
4418
+ if (typeof value !== "undefined" && value !== null) {
4419
+ url.searchParams.append(key, Array.isArray(value) ? value.join(",") : (_a = value == null ? void 0 : value.toString()) != null ? _a : "");
4420
+ }
4421
+ });
4422
+ return url;
4423
+ }
4424
+ ensureApiHost(apiHost) {
4425
+ if (!apiHost)
4426
+ return "https://uniform.app";
4427
+ if (!(apiHost == null ? void 0 : apiHost.startsWith("http"))) {
4428
+ throw new Error('Your apiHost must start with "http"');
4429
+ }
4430
+ if (apiHost.indexOf("/", 8) > -1) {
4431
+ throw new Error("Your apiHost must not contain a path element after the domain");
4432
+ }
4433
+ if (apiHost.indexOf("?") > -1) {
4434
+ throw new Error("Your apiHost must not contain a query string");
4435
+ }
4436
+ if (apiHost == null ? void 0 : apiHost.endsWith("/")) {
4437
+ apiHost = apiHost.substring(0, apiHost.length - 1);
4438
+ }
4439
+ return apiHost;
4440
+ }
4441
+ static getRequestId(response) {
4442
+ const apigRequestId = response.headers.get("apigw-requestid");
4443
+ if (apigRequestId) {
4444
+ return apigRequestId;
4445
+ }
4446
+ return void 0;
4447
+ }
4448
+ };
4449
+ async function handleRateLimits(callApi) {
4450
+ var _a;
4451
+ const backoffRetries = 5;
4452
+ let backoffRetriesLeft = backoffRetries;
4453
+ let response;
4454
+ while (backoffRetriesLeft > 0) {
4455
+ response = await callApi();
4456
+ if (response.status !== 429) {
4457
+ break;
4458
+ }
4459
+ let resetWait = 0;
4460
+ try {
4461
+ const dateHeader = response.headers.get("date");
4462
+ const serverTime = dateHeader ? new Date(dateHeader).getTime() : void 0;
4463
+ const body = await response.json();
4464
+ const resetTime = (_a = body == null ? void 0 : body.info) == null ? void 0 : _a.reset;
4465
+ if (typeof serverTime === "number" && typeof resetTime === "number") {
4466
+ resetWait = Math.max(0, Math.min(Math.round(1.1 * (resetTime - serverTime)), 1e4));
4467
+ }
4468
+ } catch (err) {
4469
+ }
4470
+ const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
4471
+ const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
4472
+ await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
4473
+ backoffRetriesLeft -= 1;
4474
+ }
4475
+ return response;
4476
+ }
4477
+ var _url;
4478
+ var _AggregateClient = class extends ApiClient {
4479
+ constructor(options) {
4480
+ super(options);
4481
+ }
4482
+ /** Fetches all aggregates for a project */
4483
+ async get(options) {
4484
+ const { projectId } = this.options;
4485
+ const fetchUri = this.createUrl(__privateGet(_AggregateClient, _url), { ...options, projectId });
4486
+ return await this.apiClient(fetchUri);
4487
+ }
4488
+ /** Updates or creates (based on id) an Aggregate */
4489
+ async upsert(body) {
4490
+ const fetchUri = this.createUrl(__privateGet(_AggregateClient, _url));
4491
+ await this.apiClient(fetchUri, {
4492
+ method: "PUT",
4493
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
4494
+ expectNoContent: true
4495
+ });
4496
+ }
4497
+ /** Deletes an Aggregate */
4498
+ async remove(body) {
4499
+ const fetchUri = this.createUrl(__privateGet(_AggregateClient, _url));
4500
+ await this.apiClient(fetchUri, {
4501
+ method: "DELETE",
4502
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
4503
+ expectNoContent: true
4504
+ });
4505
+ }
4506
+ };
4507
+ var AggregateClient = _AggregateClient;
4508
+ _url = /* @__PURE__ */ new WeakMap();
4509
+ __privateAdd(AggregateClient, _url, "/api/v2/aggregate");
4510
+ var _url2;
4511
+ var _DimensionClient = class extends ApiClient {
4512
+ constructor(options) {
4513
+ super(options);
4514
+ }
4515
+ /** Fetches the known score dimensions for a project */
4516
+ async get(options) {
4517
+ const { projectId } = this.options;
4518
+ const fetchUri = this.createUrl(__privateGet(_DimensionClient, _url2), { ...options, projectId });
4519
+ return await this.apiClient(fetchUri);
4520
+ }
4521
+ };
4522
+ var DimensionClient = _DimensionClient;
4523
+ _url2 = /* @__PURE__ */ new WeakMap();
4524
+ __privateAdd(DimensionClient, _url2, "/api/v2/dimension");
4525
+ var _url3;
4526
+ var _valueUrl;
4527
+ var _EnrichmentClient = class extends ApiClient {
4528
+ constructor(options) {
4529
+ super(options);
4530
+ }
4531
+ /** Fetches all enrichments and values for a project, grouped by category */
4532
+ async get(options) {
4533
+ const { projectId } = this.options;
4534
+ const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _url3), { ...options, projectId });
4535
+ return await this.apiClient(fetchUri);
4536
+ }
4537
+ /** Updates or creates (based on id) an enrichment category */
4538
+ async upsertCategory(body) {
4539
+ const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _url3));
4540
+ await this.apiClient(fetchUri, {
4541
+ method: "PUT",
4542
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
4543
+ expectNoContent: true
4544
+ });
4545
+ }
4546
+ /** Deletes an enrichment category */
4547
+ async removeCategory(body) {
4548
+ const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _url3));
4549
+ await this.apiClient(fetchUri, {
4550
+ method: "DELETE",
4551
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
4552
+ expectNoContent: true
4553
+ });
4554
+ }
4555
+ /** Updates or creates (based on id) an enrichment value within an enrichment category */
4556
+ async upsertValue(body) {
4557
+ const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _valueUrl));
4558
+ await this.apiClient(fetchUri, {
4559
+ method: "PUT",
4560
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
4561
+ expectNoContent: true
4562
+ });
4563
+ }
4564
+ /** Deletes an enrichment value within an enrichment category. The category is left alone. */
4565
+ async removeValue(body) {
4566
+ const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _valueUrl));
4567
+ await this.apiClient(fetchUri, {
4568
+ method: "DELETE",
4569
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
4570
+ expectNoContent: true
4571
+ });
4572
+ }
4573
+ };
4574
+ var EnrichmentClient = _EnrichmentClient;
4575
+ _url3 = /* @__PURE__ */ new WeakMap();
4576
+ _valueUrl = /* @__PURE__ */ new WeakMap();
4577
+ __privateAdd(EnrichmentClient, _url3, "/api/v1/enrichments");
4578
+ __privateAdd(EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
4579
+ var _url4;
4580
+ var _ManifestClient = class extends ApiClient {
4581
+ constructor(options) {
4582
+ super(options);
4583
+ }
4584
+ /** Fetches the Context manifest for a project */
4585
+ async get(options) {
4586
+ const { projectId } = this.options;
4587
+ const fetchUri = this.createUrl(__privateGet(_ManifestClient, _url4), { ...options, projectId });
4588
+ return await this.apiClient(fetchUri);
4589
+ }
4590
+ /** Publishes the Context manifest for a project */
4591
+ async publish() {
4592
+ const { projectId } = this.options;
4593
+ const fetchUri = this.createUrl("/api/v1/publish", { siteId: projectId });
4594
+ await this.apiClient(fetchUri, {
4595
+ method: "POST",
4596
+ expectNoContent: true
4597
+ });
4598
+ }
4599
+ };
4600
+ var ManifestClient = _ManifestClient;
4601
+ _url4 = /* @__PURE__ */ new WeakMap();
4602
+ __privateAdd(ManifestClient, _url4, "/api/v2/manifest");
4603
+ var _url5;
4604
+ var _QuirkClient = class extends ApiClient {
4605
+ constructor(options) {
4606
+ super(options);
4607
+ }
4608
+ /** Fetches all Quirks for a project */
4609
+ async get(options) {
4610
+ const { projectId } = this.options;
4611
+ const fetchUri = this.createUrl(__privateGet(_QuirkClient, _url5), { ...options, projectId });
4612
+ return await this.apiClient(fetchUri);
4613
+ }
4614
+ /** Updates or creates (based on id) a Quirk */
4615
+ async upsert(body) {
4616
+ const fetchUri = this.createUrl(__privateGet(_QuirkClient, _url5));
4617
+ await this.apiClient(fetchUri, {
4618
+ method: "PUT",
4619
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
4620
+ expectNoContent: true
4621
+ });
4622
+ }
4623
+ /** Deletes a Quirk */
4624
+ async remove(body) {
4625
+ const fetchUri = this.createUrl(__privateGet(_QuirkClient, _url5));
4626
+ await this.apiClient(fetchUri, {
4627
+ method: "DELETE",
4628
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
4629
+ expectNoContent: true
4630
+ });
4631
+ }
4632
+ };
4633
+ var QuirkClient = _QuirkClient;
4634
+ _url5 = /* @__PURE__ */ new WeakMap();
4635
+ __privateAdd(QuirkClient, _url5, "/api/v2/quirk");
4636
+ var _url6;
4637
+ var _SignalClient = class extends ApiClient {
4638
+ constructor(options) {
4639
+ super(options);
4640
+ }
4641
+ /** Fetches all Signals for a project */
4642
+ async get(options) {
4643
+ const { projectId } = this.options;
4644
+ const fetchUri = this.createUrl(__privateGet(_SignalClient, _url6), { ...options, projectId });
4645
+ return await this.apiClient(fetchUri);
4646
+ }
4647
+ /** Updates or creates (based on id) a Signal */
4648
+ async upsert(body) {
4649
+ const fetchUri = this.createUrl(__privateGet(_SignalClient, _url6));
4650
+ await this.apiClient(fetchUri, {
4651
+ method: "PUT",
4652
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
4653
+ expectNoContent: true
4654
+ });
4655
+ }
4656
+ /** Deletes a Signal */
4657
+ async remove(body) {
4658
+ const fetchUri = this.createUrl(__privateGet(_SignalClient, _url6));
4659
+ await this.apiClient(fetchUri, {
4660
+ method: "DELETE",
4661
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
4662
+ expectNoContent: true
4663
+ });
4664
+ }
4665
+ };
4666
+ var SignalClient = _SignalClient;
4667
+ _url6 = /* @__PURE__ */ new WeakMap();
4668
+ __privateAdd(SignalClient, _url6, "/api/v2/signal");
4669
+ var _url7;
4670
+ var _TestClient = class extends ApiClient {
4671
+ constructor(options) {
4672
+ super(options);
4673
+ }
4674
+ /** Fetches all Tests for a project */
4675
+ async get(options) {
4676
+ const { projectId } = this.options;
4677
+ const fetchUri = this.createUrl(__privateGet(_TestClient, _url7), { ...options, projectId });
4678
+ return await this.apiClient(fetchUri);
4679
+ }
4680
+ /** Updates or creates (based on id) a Test */
4681
+ async upsert(body) {
4682
+ const fetchUri = this.createUrl(__privateGet(_TestClient, _url7));
4683
+ await this.apiClient(fetchUri, {
4684
+ method: "PUT",
4685
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
4686
+ expectNoContent: true
4687
+ });
4688
+ }
4689
+ /** Deletes a Test */
4690
+ async remove(body) {
4691
+ const fetchUri = this.createUrl(__privateGet(_TestClient, _url7));
4692
+ await this.apiClient(fetchUri, {
4693
+ method: "DELETE",
4694
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
4695
+ expectNoContent: true
4696
+ });
4697
+ }
4698
+ };
4699
+ var TestClient = _TestClient;
4700
+ _url7 = /* @__PURE__ */ new WeakMap();
4701
+ __privateAdd(TestClient, _url7, "/api/v2/test");
4702
+
4703
+ // ../../node_modules/.pnpm/immer@9.0.21/node_modules/immer/dist/immer.esm.mjs
4704
+ function n(n2) {
4705
+ for (var r2 = arguments.length, t2 = Array(r2 > 1 ? r2 - 1 : 0), e = 1; e < r2; e++)
4706
+ t2[e - 1] = arguments[e];
4707
+ if ("production" !== process.env.NODE_ENV) {
4708
+ var i2 = Y[n2], o2 = i2 ? "function" == typeof i2 ? i2.apply(null, t2) : i2 : "unknown error nr: " + n2;
4709
+ throw Error("[Immer] " + o2);
4710
+ }
4711
+ throw Error("[Immer] minified error nr: " + n2 + (t2.length ? " " + t2.map(function(n3) {
4712
+ return "'" + n3 + "'";
4713
+ }).join(",") : "") + ". Find the full error at: https://bit.ly/3cXEKWf");
4714
+ }
4715
+ function r(n2) {
4716
+ return !!n2 && !!n2[Q];
4717
+ }
4718
+ function t(n2) {
4719
+ var r2;
4720
+ return !!n2 && (function(n3) {
4721
+ if (!n3 || "object" != typeof n3)
4722
+ return false;
4723
+ var r3 = Object.getPrototypeOf(n3);
4724
+ if (null === r3)
4725
+ return true;
4726
+ var t2 = Object.hasOwnProperty.call(r3, "constructor") && r3.constructor;
4727
+ return t2 === Object || "function" == typeof t2 && Function.toString.call(t2) === Z;
4728
+ }(n2) || Array.isArray(n2) || !!n2[L] || !!(null === (r2 = n2.constructor) || void 0 === r2 ? void 0 : r2[L]) || s(n2) || v(n2));
4729
+ }
4730
+ function i(n2, r2, t2) {
4731
+ void 0 === t2 && (t2 = false), 0 === o(n2) ? (t2 ? Object.keys : nn)(n2).forEach(function(e) {
4732
+ t2 && "symbol" == typeof e || r2(e, n2[e], n2);
4733
+ }) : n2.forEach(function(t3, e) {
4734
+ return r2(e, t3, n2);
4735
+ });
4736
+ }
4737
+ function o(n2) {
4738
+ var r2 = n2[Q];
4739
+ return r2 ? r2.i > 3 ? r2.i - 4 : r2.i : Array.isArray(n2) ? 1 : s(n2) ? 2 : v(n2) ? 3 : 0;
4740
+ }
4741
+ function u(n2, r2) {
4742
+ return 2 === o(n2) ? n2.has(r2) : Object.prototype.hasOwnProperty.call(n2, r2);
4743
+ }
4744
+ function a(n2, r2) {
4745
+ return 2 === o(n2) ? n2.get(r2) : n2[r2];
4746
+ }
4747
+ function f(n2, r2, t2) {
4748
+ var e = o(n2);
4749
+ 2 === e ? n2.set(r2, t2) : 3 === e ? n2.add(t2) : n2[r2] = t2;
4750
+ }
4751
+ function c(n2, r2) {
4752
+ return n2 === r2 ? 0 !== n2 || 1 / n2 == 1 / r2 : n2 != n2 && r2 != r2;
4753
+ }
4754
+ function s(n2) {
4755
+ return X && n2 instanceof Map;
4756
+ }
4757
+ function v(n2) {
4758
+ return q && n2 instanceof Set;
4759
+ }
4760
+ function p(n2) {
4761
+ return n2.o || n2.t;
4762
+ }
4763
+ function l(n2) {
4764
+ if (Array.isArray(n2))
4765
+ return Array.prototype.slice.call(n2);
4766
+ var r2 = rn(n2);
4767
+ delete r2[Q];
4768
+ for (var t2 = nn(r2), e = 0; e < t2.length; e++) {
4769
+ var i2 = t2[e], o2 = r2[i2];
4770
+ false === o2.writable && (o2.writable = true, o2.configurable = true), (o2.get || o2.set) && (r2[i2] = { configurable: true, writable: true, enumerable: o2.enumerable, value: n2[i2] });
4771
+ }
4772
+ return Object.create(Object.getPrototypeOf(n2), r2);
4773
+ }
4774
+ function d(n2, e) {
4775
+ return void 0 === e && (e = false), y(n2) || r(n2) || !t(n2) || (o(n2) > 1 && (n2.set = n2.add = n2.clear = n2.delete = h), Object.freeze(n2), e && i(n2, function(n3, r2) {
4776
+ return d(r2, true);
4777
+ }, true)), n2;
4778
+ }
4779
+ function h() {
4780
+ n(2);
4781
+ }
4782
+ function y(n2) {
4783
+ return null == n2 || "object" != typeof n2 || Object.isFrozen(n2);
4784
+ }
4785
+ function b(r2) {
4786
+ var t2 = tn[r2];
4787
+ return t2 || n(18, r2), t2;
4788
+ }
4789
+ function _() {
4790
+ return "production" === process.env.NODE_ENV || U || n(0), U;
4791
+ }
4792
+ function j(n2, r2) {
4793
+ r2 && (b("Patches"), n2.u = [], n2.s = [], n2.v = r2);
4794
+ }
4795
+ function g(n2) {
4796
+ O(n2), n2.p.forEach(S), n2.p = null;
4797
+ }
4798
+ function O(n2) {
4799
+ n2 === U && (U = n2.l);
4800
+ }
4801
+ function w(n2) {
4802
+ return U = { p: [], l: U, h: n2, m: true, _: 0 };
4803
+ }
4804
+ function S(n2) {
4805
+ var r2 = n2[Q];
4806
+ 0 === r2.i || 1 === r2.i ? r2.j() : r2.g = true;
4807
+ }
4808
+ function P(r2, e) {
4809
+ e._ = e.p.length;
4810
+ var i2 = e.p[0], o2 = void 0 !== r2 && r2 !== i2;
4811
+ return e.h.O || b("ES5").S(e, r2, o2), o2 ? (i2[Q].P && (g(e), n(4)), t(r2) && (r2 = M(e, r2), e.l || x(e, r2)), e.u && b("Patches").M(i2[Q].t, r2, e.u, e.s)) : r2 = M(e, i2, []), g(e), e.u && e.v(e.u, e.s), r2 !== H ? r2 : void 0;
4812
+ }
4813
+ function M(n2, r2, t2) {
4814
+ if (y(r2))
4815
+ return r2;
4816
+ var e = r2[Q];
4817
+ if (!e)
4818
+ return i(r2, function(i2, o3) {
4819
+ return A(n2, e, r2, i2, o3, t2);
4820
+ }, true), r2;
4821
+ if (e.A !== n2)
4822
+ return r2;
4823
+ if (!e.P)
4824
+ return x(n2, e.t, true), e.t;
4825
+ if (!e.I) {
4826
+ e.I = true, e.A._--;
4827
+ var o2 = 4 === e.i || 5 === e.i ? e.o = l(e.k) : e.o, u2 = o2, a2 = false;
4828
+ 3 === e.i && (u2 = new Set(o2), o2.clear(), a2 = true), i(u2, function(r3, i2) {
4829
+ return A(n2, e, o2, r3, i2, t2, a2);
4830
+ }), x(n2, o2, false), t2 && n2.u && b("Patches").N(e, t2, n2.u, n2.s);
4831
+ }
4832
+ return e.o;
4833
+ }
4834
+ function A(e, i2, o2, a2, c2, s2, v2) {
4835
+ if ("production" !== process.env.NODE_ENV && c2 === o2 && n(5), r(c2)) {
4836
+ var p2 = M(e, c2, s2 && i2 && 3 !== i2.i && !u(i2.R, a2) ? s2.concat(a2) : void 0);
4837
+ if (f(o2, a2, p2), !r(p2))
4838
+ return;
4839
+ e.m = false;
4840
+ } else
4841
+ v2 && o2.add(c2);
4842
+ if (t(c2) && !y(c2)) {
4843
+ if (!e.h.D && e._ < 1)
4844
+ return;
4845
+ M(e, c2), i2 && i2.A.l || x(e, c2);
4846
+ }
4847
+ }
4848
+ function x(n2, r2, t2) {
4849
+ void 0 === t2 && (t2 = false), !n2.l && n2.h.D && n2.m && d(r2, t2);
4850
+ }
4851
+ function z2(n2, r2) {
4852
+ var t2 = n2[Q];
4853
+ return (t2 ? p(t2) : n2)[r2];
4854
+ }
4855
+ function I(n2, r2) {
4856
+ if (r2 in n2)
4857
+ for (var t2 = Object.getPrototypeOf(n2); t2; ) {
4858
+ var e = Object.getOwnPropertyDescriptor(t2, r2);
4859
+ if (e)
4860
+ return e;
4861
+ t2 = Object.getPrototypeOf(t2);
4862
+ }
4863
+ }
4864
+ function k(n2) {
4865
+ n2.P || (n2.P = true, n2.l && k(n2.l));
4866
+ }
4867
+ function E(n2) {
4868
+ n2.o || (n2.o = l(n2.t));
4869
+ }
4870
+ function N(n2, r2, t2) {
4871
+ var e = s(r2) ? b("MapSet").F(r2, t2) : v(r2) ? b("MapSet").T(r2, t2) : n2.O ? function(n3, r3) {
4872
+ var t3 = Array.isArray(n3), e2 = { i: t3 ? 1 : 0, A: r3 ? r3.A : _(), P: false, I: false, R: {}, l: r3, t: n3, k: null, o: null, j: null, C: false }, i2 = e2, o2 = en;
4873
+ t3 && (i2 = [e2], o2 = on);
4874
+ var u2 = Proxy.revocable(i2, o2), a2 = u2.revoke, f2 = u2.proxy;
4875
+ return e2.k = f2, e2.j = a2, f2;
4876
+ }(r2, t2) : b("ES5").J(r2, t2);
4877
+ return (t2 ? t2.A : _()).p.push(e), e;
4878
+ }
4879
+ function R(e) {
4880
+ return r(e) || n(22, e), function n2(r2) {
4881
+ if (!t(r2))
4882
+ return r2;
4883
+ var e2, u2 = r2[Q], c2 = o(r2);
4884
+ if (u2) {
4885
+ if (!u2.P && (u2.i < 4 || !b("ES5").K(u2)))
4886
+ return u2.t;
4887
+ u2.I = true, e2 = D(r2, c2), u2.I = false;
4888
+ } else
4889
+ e2 = D(r2, c2);
4890
+ return i(e2, function(r3, t2) {
4891
+ u2 && a(u2.t, r3) === t2 || f(e2, r3, n2(t2));
4892
+ }), 3 === c2 ? new Set(e2) : e2;
4893
+ }(e);
4894
+ }
4895
+ function D(n2, r2) {
4896
+ switch (r2) {
4897
+ case 2:
4898
+ return new Map(n2);
4899
+ case 3:
4900
+ return Array.from(n2);
4901
+ }
4902
+ return l(n2);
4903
+ }
4904
+ var G;
4905
+ var U;
4906
+ var W = "undefined" != typeof Symbol && "symbol" == typeof Symbol("x");
4907
+ var X = "undefined" != typeof Map;
4908
+ var q = "undefined" != typeof Set;
4909
+ var B = "undefined" != typeof Proxy && void 0 !== Proxy.revocable && "undefined" != typeof Reflect;
4910
+ var H = W ? Symbol.for("immer-nothing") : ((G = {})["immer-nothing"] = true, G);
4911
+ var L = W ? Symbol.for("immer-draftable") : "__$immer_draftable";
4912
+ var Q = W ? Symbol.for("immer-state") : "__$immer_state";
4913
+ var Y = { 0: "Illegal state", 1: "Immer drafts cannot have computed properties", 2: "This object has been frozen and should not be mutated", 3: function(n2) {
4914
+ return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + n2;
4915
+ }, 4: "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.", 5: "Immer forbids circular references", 6: "The first or second argument to `produce` must be a function", 7: "The third argument to `produce` must be a function or undefined", 8: "First argument to `createDraft` must be a plain object, an array, or an immerable object", 9: "First argument to `finishDraft` must be a draft returned by `createDraft`", 10: "The given draft is already finalized", 11: "Object.defineProperty() cannot be used on an Immer draft", 12: "Object.setPrototypeOf() cannot be used on an Immer draft", 13: "Immer only supports deleting array indices", 14: "Immer only supports setting array indices and the 'length' property", 15: function(n2) {
4916
+ return "Cannot apply patch, path doesn't resolve: " + n2;
4917
+ }, 16: 'Sets cannot have "replace" patches.', 17: function(n2) {
4918
+ return "Unsupported patch operation: " + n2;
4919
+ }, 18: function(n2) {
4920
+ return "The plugin for '" + n2 + "' has not been loaded into Immer. To enable the plugin, import and call `enable" + n2 + "()` when initializing your application.";
4921
+ }, 20: "Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available", 21: function(n2) {
4922
+ return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '" + n2 + "'";
4923
+ }, 22: function(n2) {
4924
+ return "'current' expects a draft, got: " + n2;
4925
+ }, 23: function(n2) {
4926
+ return "'original' expects a draft, got: " + n2;
4927
+ }, 24: "Patching reserved attributes like __proto__, prototype and constructor is not allowed" };
4928
+ var Z = "" + Object.prototype.constructor;
4929
+ var nn = "undefined" != typeof Reflect && Reflect.ownKeys ? Reflect.ownKeys : void 0 !== Object.getOwnPropertySymbols ? function(n2) {
4930
+ return Object.getOwnPropertyNames(n2).concat(Object.getOwnPropertySymbols(n2));
4931
+ } : Object.getOwnPropertyNames;
4932
+ var rn = Object.getOwnPropertyDescriptors || function(n2) {
4933
+ var r2 = {};
4934
+ return nn(n2).forEach(function(t2) {
4935
+ r2[t2] = Object.getOwnPropertyDescriptor(n2, t2);
4936
+ }), r2;
4937
+ };
4938
+ var tn = {};
4939
+ var en = { get: function(n2, r2) {
4940
+ if (r2 === Q)
4941
+ return n2;
4942
+ var e = p(n2);
4943
+ if (!u(e, r2))
4944
+ return function(n3, r3, t2) {
4945
+ var e2, i3 = I(r3, t2);
4946
+ return i3 ? "value" in i3 ? i3.value : null === (e2 = i3.get) || void 0 === e2 ? void 0 : e2.call(n3.k) : void 0;
4947
+ }(n2, e, r2);
4948
+ var i2 = e[r2];
4949
+ return n2.I || !t(i2) ? i2 : i2 === z2(n2.t, r2) ? (E(n2), n2.o[r2] = N(n2.A.h, i2, n2)) : i2;
4950
+ }, has: function(n2, r2) {
4951
+ return r2 in p(n2);
4952
+ }, ownKeys: function(n2) {
4953
+ return Reflect.ownKeys(p(n2));
4954
+ }, set: function(n2, r2, t2) {
4955
+ var e = I(p(n2), r2);
4956
+ if (null == e ? void 0 : e.set)
4957
+ return e.set.call(n2.k, t2), true;
4958
+ if (!n2.P) {
4959
+ var i2 = z2(p(n2), r2), o2 = null == i2 ? void 0 : i2[Q];
4960
+ if (o2 && o2.t === t2)
4961
+ return n2.o[r2] = t2, n2.R[r2] = false, true;
4962
+ if (c(t2, i2) && (void 0 !== t2 || u(n2.t, r2)))
4963
+ return true;
4964
+ E(n2), k(n2);
4965
+ }
4966
+ return n2.o[r2] === t2 && (void 0 !== t2 || r2 in n2.o) || Number.isNaN(t2) && Number.isNaN(n2.o[r2]) || (n2.o[r2] = t2, n2.R[r2] = true), true;
4967
+ }, deleteProperty: function(n2, r2) {
4968
+ return void 0 !== z2(n2.t, r2) || r2 in n2.t ? (n2.R[r2] = false, E(n2), k(n2)) : delete n2.R[r2], n2.o && delete n2.o[r2], true;
4969
+ }, getOwnPropertyDescriptor: function(n2, r2) {
4970
+ var t2 = p(n2), e = Reflect.getOwnPropertyDescriptor(t2, r2);
4971
+ return e ? { writable: true, configurable: 1 !== n2.i || "length" !== r2, enumerable: e.enumerable, value: t2[r2] } : e;
4972
+ }, defineProperty: function() {
4973
+ n(11);
4974
+ }, getPrototypeOf: function(n2) {
4975
+ return Object.getPrototypeOf(n2.t);
4976
+ }, setPrototypeOf: function() {
4977
+ n(12);
4978
+ } };
4979
+ var on = {};
4980
+ i(en, function(n2, r2) {
4981
+ on[n2] = function() {
4982
+ return arguments[0] = arguments[0][0], r2.apply(this, arguments);
4983
+ };
4984
+ }), on.deleteProperty = function(r2, t2) {
4985
+ return "production" !== process.env.NODE_ENV && isNaN(parseInt(t2)) && n(13), on.set.call(this, r2, t2, void 0);
4986
+ }, on.set = function(r2, t2, e) {
4987
+ return "production" !== process.env.NODE_ENV && "length" !== t2 && isNaN(parseInt(t2)) && n(14), en.set.call(this, r2[0], t2, e, r2[0]);
4988
+ };
4989
+ var un = function() {
4990
+ function e(r2) {
4991
+ var e2 = this;
4992
+ this.O = B, this.D = true, this.produce = function(r3, i3, o2) {
4993
+ if ("function" == typeof r3 && "function" != typeof i3) {
4994
+ var u2 = i3;
4995
+ i3 = r3;
4996
+ var a2 = e2;
4997
+ return function(n2) {
4998
+ var r4 = this;
4999
+ void 0 === n2 && (n2 = u2);
5000
+ for (var t2 = arguments.length, e3 = Array(t2 > 1 ? t2 - 1 : 0), o3 = 1; o3 < t2; o3++)
5001
+ e3[o3 - 1] = arguments[o3];
5002
+ return a2.produce(n2, function(n3) {
5003
+ var t3;
5004
+ return (t3 = i3).call.apply(t3, [r4, n3].concat(e3));
5005
+ });
5006
+ };
5007
+ }
5008
+ var f2;
5009
+ if ("function" != typeof i3 && n(6), void 0 !== o2 && "function" != typeof o2 && n(7), t(r3)) {
5010
+ var c2 = w(e2), s2 = N(e2, r3, void 0), v2 = true;
5011
+ try {
5012
+ f2 = i3(s2), v2 = false;
5013
+ } finally {
5014
+ v2 ? g(c2) : O(c2);
5015
+ }
5016
+ return "undefined" != typeof Promise && f2 instanceof Promise ? f2.then(function(n2) {
5017
+ return j(c2, o2), P(n2, c2);
5018
+ }, function(n2) {
5019
+ throw g(c2), n2;
5020
+ }) : (j(c2, o2), P(f2, c2));
5021
+ }
5022
+ if (!r3 || "object" != typeof r3) {
5023
+ if (void 0 === (f2 = i3(r3)) && (f2 = r3), f2 === H && (f2 = void 0), e2.D && d(f2, true), o2) {
5024
+ var p2 = [], l2 = [];
5025
+ b("Patches").M(r3, f2, p2, l2), o2(p2, l2);
5026
+ }
5027
+ return f2;
5028
+ }
5029
+ n(21, r3);
5030
+ }, this.produceWithPatches = function(n2, r3) {
5031
+ if ("function" == typeof n2)
5032
+ return function(r4) {
5033
+ for (var t3 = arguments.length, i4 = Array(t3 > 1 ? t3 - 1 : 0), o3 = 1; o3 < t3; o3++)
5034
+ i4[o3 - 1] = arguments[o3];
5035
+ return e2.produceWithPatches(r4, function(r5) {
5036
+ return n2.apply(void 0, [r5].concat(i4));
5037
+ });
5038
+ };
5039
+ var t2, i3, o2 = e2.produce(n2, r3, function(n3, r4) {
5040
+ t2 = n3, i3 = r4;
5041
+ });
5042
+ return "undefined" != typeof Promise && o2 instanceof Promise ? o2.then(function(n3) {
5043
+ return [n3, t2, i3];
5044
+ }) : [o2, t2, i3];
5045
+ }, "boolean" == typeof (null == r2 ? void 0 : r2.useProxies) && this.setUseProxies(r2.useProxies), "boolean" == typeof (null == r2 ? void 0 : r2.autoFreeze) && this.setAutoFreeze(r2.autoFreeze);
5046
+ }
5047
+ var i2 = e.prototype;
5048
+ return i2.createDraft = function(e2) {
5049
+ t(e2) || n(8), r(e2) && (e2 = R(e2));
5050
+ var i3 = w(this), o2 = N(this, e2, void 0);
5051
+ return o2[Q].C = true, O(i3), o2;
5052
+ }, i2.finishDraft = function(r2, t2) {
5053
+ var e2 = r2 && r2[Q];
5054
+ "production" !== process.env.NODE_ENV && (e2 && e2.C || n(9), e2.I && n(10));
5055
+ var i3 = e2.A;
5056
+ return j(i3, t2), P(void 0, i3);
5057
+ }, i2.setAutoFreeze = function(n2) {
5058
+ this.D = n2;
5059
+ }, i2.setUseProxies = function(r2) {
5060
+ r2 && !B && n(20), this.O = r2;
5061
+ }, i2.applyPatches = function(n2, t2) {
5062
+ var e2;
5063
+ for (e2 = t2.length - 1; e2 >= 0; e2--) {
5064
+ var i3 = t2[e2];
5065
+ if (0 === i3.path.length && "replace" === i3.op) {
5066
+ n2 = i3.value;
5067
+ break;
5068
+ }
5069
+ }
5070
+ e2 > -1 && (t2 = t2.slice(e2 + 1));
5071
+ var o2 = b("Patches").$;
5072
+ return r(n2) ? o2(n2, t2) : this.produce(n2, function(n3) {
5073
+ return o2(n3, t2);
5074
+ });
5075
+ }, e;
5076
+ }();
5077
+ var an = new un();
5078
+ var fn = an.produce;
5079
+ var cn = an.produceWithPatches.bind(an);
5080
+ var sn = an.setAutoFreeze.bind(an);
5081
+ var vn = an.setUseProxies.bind(an);
5082
+ var pn = an.applyPatches.bind(an);
5083
+ var ln = an.createDraft.bind(an);
5084
+ var dn = an.finishDraft.bind(an);
5085
+
5086
+ // ../canvas/dist/index.mjs
5087
+ var __create = Object.create;
5088
+ var __defProp3 = Object.defineProperty;
5089
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5090
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5091
+ var __getProtoOf = Object.getPrototypeOf;
5092
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5093
+ var __commonJS = (cb, mod) => function __require() {
5094
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
5095
+ };
5096
+ var __copyProps = (to, from, except, desc) => {
5097
+ if (from && typeof from === "object" || typeof from === "function") {
5098
+ for (let key of __getOwnPropNames(from))
5099
+ if (!__hasOwnProp.call(to, key) && key !== except)
5100
+ __defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
5101
+ }
5102
+ return to;
5103
+ };
5104
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
5105
+ // If the importer is in node compatibility mode or this is not an ESM
5106
+ // file that has been converted to a CommonJS file using a Babel-
5107
+ // compatible transform (i.e. "__esModule" has not been set), then set
5108
+ // "default" to the CommonJS "module.exports" for node compatibility.
5109
+ isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { value: mod, enumerable: true }) : target,
5110
+ mod
5111
+ ));
5112
+ var __accessCheck2 = (obj, member, msg) => {
5113
+ if (!member.has(obj))
5114
+ throw TypeError("Cannot " + msg);
5115
+ };
5116
+ var __privateGet2 = (obj, member, getter) => {
5117
+ __accessCheck2(obj, member, "read from private field");
5118
+ return getter ? getter.call(obj) : member.get(obj);
5119
+ };
5120
+ var __privateAdd2 = (obj, member, value) => {
5121
+ if (member.has(obj))
5122
+ throw TypeError("Cannot add the same private member more than once");
5123
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
5124
+ };
5125
+ var require_retry_operation = __commonJS({
5126
+ "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports, module) {
5127
+ function RetryOperation(timeouts, options) {
5128
+ if (typeof options === "boolean") {
5129
+ options = { forever: options };
5130
+ }
5131
+ this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
5132
+ this._timeouts = timeouts;
5133
+ this._options = options || {};
5134
+ this._maxRetryTime = options && options.maxRetryTime || Infinity;
5135
+ this._fn = null;
5136
+ this._errors = [];
5137
+ this._attempts = 1;
5138
+ this._operationTimeout = null;
5139
+ this._operationTimeoutCb = null;
5140
+ this._timeout = null;
5141
+ this._operationStart = null;
5142
+ this._timer = null;
5143
+ if (this._options.forever) {
5144
+ this._cachedTimeouts = this._timeouts.slice(0);
5145
+ }
5146
+ }
5147
+ module.exports = RetryOperation;
5148
+ RetryOperation.prototype.reset = function() {
5149
+ this._attempts = 1;
5150
+ this._timeouts = this._originalTimeouts.slice(0);
5151
+ };
5152
+ RetryOperation.prototype.stop = function() {
5153
+ if (this._timeout) {
5154
+ clearTimeout(this._timeout);
5155
+ }
5156
+ if (this._timer) {
5157
+ clearTimeout(this._timer);
5158
+ }
5159
+ this._timeouts = [];
5160
+ this._cachedTimeouts = null;
5161
+ };
5162
+ RetryOperation.prototype.retry = function(err) {
5163
+ if (this._timeout) {
5164
+ clearTimeout(this._timeout);
5165
+ }
5166
+ if (!err) {
5167
+ return false;
5168
+ }
5169
+ var currentTime = (/* @__PURE__ */ new Date()).getTime();
5170
+ if (err && currentTime - this._operationStart >= this._maxRetryTime) {
5171
+ this._errors.push(err);
5172
+ this._errors.unshift(new Error("RetryOperation timeout occurred"));
5173
+ return false;
5174
+ }
5175
+ this._errors.push(err);
5176
+ var timeout = this._timeouts.shift();
5177
+ if (timeout === void 0) {
5178
+ if (this._cachedTimeouts) {
5179
+ this._errors.splice(0, this._errors.length - 1);
5180
+ timeout = this._cachedTimeouts.slice(-1);
5181
+ } else {
5182
+ return false;
5183
+ }
5184
+ }
5185
+ var self = this;
5186
+ this._timer = setTimeout(function() {
5187
+ self._attempts++;
5188
+ if (self._operationTimeoutCb) {
5189
+ self._timeout = setTimeout(function() {
5190
+ self._operationTimeoutCb(self._attempts);
5191
+ }, self._operationTimeout);
5192
+ if (self._options.unref) {
5193
+ self._timeout.unref();
5194
+ }
5195
+ }
5196
+ self._fn(self._attempts);
5197
+ }, timeout);
5198
+ if (this._options.unref) {
5199
+ this._timer.unref();
5200
+ }
5201
+ return true;
5202
+ };
5203
+ RetryOperation.prototype.attempt = function(fn2, timeoutOps) {
5204
+ this._fn = fn2;
5205
+ if (timeoutOps) {
5206
+ if (timeoutOps.timeout) {
5207
+ this._operationTimeout = timeoutOps.timeout;
5208
+ }
5209
+ if (timeoutOps.cb) {
5210
+ this._operationTimeoutCb = timeoutOps.cb;
5211
+ }
5212
+ }
5213
+ var self = this;
5214
+ if (this._operationTimeoutCb) {
5215
+ this._timeout = setTimeout(function() {
5216
+ self._operationTimeoutCb();
5217
+ }, self._operationTimeout);
5218
+ }
5219
+ this._operationStart = (/* @__PURE__ */ new Date()).getTime();
5220
+ this._fn(this._attempts);
5221
+ };
5222
+ RetryOperation.prototype.try = function(fn2) {
5223
+ console.log("Using RetryOperation.try() is deprecated");
5224
+ this.attempt(fn2);
5225
+ };
5226
+ RetryOperation.prototype.start = function(fn2) {
5227
+ console.log("Using RetryOperation.start() is deprecated");
5228
+ this.attempt(fn2);
5229
+ };
5230
+ RetryOperation.prototype.start = RetryOperation.prototype.try;
5231
+ RetryOperation.prototype.errors = function() {
5232
+ return this._errors;
5233
+ };
5234
+ RetryOperation.prototype.attempts = function() {
5235
+ return this._attempts;
5236
+ };
5237
+ RetryOperation.prototype.mainError = function() {
5238
+ if (this._errors.length === 0) {
5239
+ return null;
5240
+ }
5241
+ var counts = {};
5242
+ var mainError = null;
5243
+ var mainErrorCount = 0;
5244
+ for (var i2 = 0; i2 < this._errors.length; i2++) {
5245
+ var error = this._errors[i2];
5246
+ var message = error.message;
5247
+ var count = (counts[message] || 0) + 1;
5248
+ counts[message] = count;
5249
+ if (count >= mainErrorCount) {
5250
+ mainError = error;
5251
+ mainErrorCount = count;
5252
+ }
5253
+ }
5254
+ return mainError;
5255
+ };
5256
+ }
5257
+ });
5258
+ var require_retry = __commonJS({
5259
+ "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports) {
5260
+ var RetryOperation = require_retry_operation();
5261
+ exports.operation = function(options) {
5262
+ var timeouts = exports.timeouts(options);
5263
+ return new RetryOperation(timeouts, {
5264
+ forever: options && (options.forever || options.retries === Infinity),
5265
+ unref: options && options.unref,
5266
+ maxRetryTime: options && options.maxRetryTime
5267
+ });
5268
+ };
5269
+ exports.timeouts = function(options) {
5270
+ if (options instanceof Array) {
5271
+ return [].concat(options);
5272
+ }
5273
+ var opts = {
5274
+ retries: 10,
5275
+ factor: 2,
5276
+ minTimeout: 1 * 1e3,
5277
+ maxTimeout: Infinity,
5278
+ randomize: false
5279
+ };
5280
+ for (var key in options) {
5281
+ opts[key] = options[key];
5282
+ }
5283
+ if (opts.minTimeout > opts.maxTimeout) {
5284
+ throw new Error("minTimeout is greater than maxTimeout");
5285
+ }
5286
+ var timeouts = [];
5287
+ for (var i2 = 0; i2 < opts.retries; i2++) {
5288
+ timeouts.push(this.createTimeout(i2, opts));
5289
+ }
5290
+ if (options && options.forever && !timeouts.length) {
5291
+ timeouts.push(this.createTimeout(i2, opts));
5292
+ }
5293
+ timeouts.sort(function(a2, b2) {
5294
+ return a2 - b2;
5295
+ });
5296
+ return timeouts;
5297
+ };
5298
+ exports.createTimeout = function(attempt, opts) {
5299
+ var random = opts.randomize ? Math.random() + 1 : 1;
5300
+ var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
5301
+ timeout = Math.min(timeout, opts.maxTimeout);
5302
+ return timeout;
5303
+ };
5304
+ exports.wrap = function(obj, options, methods) {
5305
+ if (options instanceof Array) {
5306
+ methods = options;
5307
+ options = null;
5308
+ }
5309
+ if (!methods) {
5310
+ methods = [];
5311
+ for (var key in obj) {
5312
+ if (typeof obj[key] === "function") {
5313
+ methods.push(key);
5314
+ }
5315
+ }
5316
+ }
5317
+ for (var i2 = 0; i2 < methods.length; i2++) {
5318
+ var method = methods[i2];
5319
+ var original = obj[method];
5320
+ obj[method] = function retryWrapper(original2) {
5321
+ var op = exports.operation(options);
5322
+ var args = Array.prototype.slice.call(arguments, 1);
5323
+ var callback = args.pop();
5324
+ args.push(function(err) {
5325
+ if (op.retry(err)) {
5326
+ return;
5327
+ }
5328
+ if (err) {
5329
+ arguments[0] = op.mainError();
5330
+ }
5331
+ callback.apply(this, arguments);
5332
+ });
5333
+ op.attempt(function() {
5334
+ original2.apply(obj, args);
5335
+ });
5336
+ }.bind(obj, original);
5337
+ obj[method].options = options;
5338
+ }
5339
+ };
5340
+ }
5341
+ });
5342
+ var require_retry2 = __commonJS({
5343
+ "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports, module) {
5344
+ module.exports = require_retry();
5345
+ }
5346
+ });
5347
+ var import_retry = __toESM(require_retry2(), 1);
5348
+ var _url8;
5349
+ var _DataTypeClient = class extends ApiClient {
5350
+ constructor(options) {
5351
+ super(options);
5352
+ }
5353
+ /** Fetches all DataTypes for a project */
5354
+ async get(options) {
5355
+ const { projectId } = this.options;
5356
+ const fetchUri = this.createUrl(__privateGet2(_DataTypeClient, _url8), { ...options, projectId });
5357
+ return await this.apiClient(fetchUri);
5358
+ }
5359
+ /** Updates or creates (based on id) a DataType */
5360
+ async upsert(body) {
5361
+ const fetchUri = this.createUrl(__privateGet2(_DataTypeClient, _url8));
5362
+ await this.apiClient(fetchUri, {
5363
+ method: "PUT",
5364
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
5365
+ expectNoContent: true
5366
+ });
5367
+ }
5368
+ /** Deletes a DataType */
5369
+ async remove(body) {
5370
+ const fetchUri = this.createUrl(__privateGet2(_DataTypeClient, _url8));
5371
+ await this.apiClient(fetchUri, {
5372
+ method: "DELETE",
5373
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
5374
+ expectNoContent: true
5375
+ });
5376
+ }
4101
5377
  };
5378
+ var DataTypeClient = _DataTypeClient;
5379
+ _url8 = /* @__PURE__ */ new WeakMap();
5380
+ __privateAdd2(DataTypeClient, _url8, "/api/v1/data-types");
5381
+ var EDGE_MAX_L2_CACHE_TTL_IN_HOURS = 4 * 7 * 24;
5382
+ function bindVariables({
5383
+ variables,
5384
+ value,
5385
+ errorPrefix = "Variable",
5386
+ handleBinding
5387
+ }) {
5388
+ let boundCount = 0;
5389
+ const errors = [];
5390
+ const defaultHandleBinding = (variableName2, variables2, errors2) => {
5391
+ const variableValue2 = variables2[variableName2];
5392
+ if (variableValue2 === void 0) {
5393
+ errors2.push(`${errorPrefix} "${variableName2}" is not defined`);
5394
+ return "";
5395
+ }
5396
+ return variableValue2;
5397
+ };
5398
+ const result = value.replace(/(?<!\\)\${([^}]+)}/g, (_match, variableName2) => {
5399
+ const variableValue2 = (handleBinding != null ? handleBinding : defaultHandleBinding)(variableName2, variables, errors);
5400
+ boundCount++;
5401
+ return variableValue2;
5402
+ });
5403
+ return { result, boundCount, errors: errors.length > 0 ? errors : void 0 };
5404
+ }
5405
+ function bindVariablesToObject(options) {
5406
+ return bindVariablesToObjectRecursive(options);
5407
+ }
5408
+ function bindVariablesToObjectRecursive({
5409
+ value,
5410
+ recursivePath,
5411
+ ...bindVariablesOptions
5412
+ }) {
5413
+ let boundCount = 0;
5414
+ const errors = [];
5415
+ if (typeof value === "string") {
5416
+ return bindVariables({ ...bindVariablesOptions, value });
5417
+ }
5418
+ if (typeof value !== "object" || value === null) {
5419
+ return { boundCount: 0, result: value };
5420
+ }
5421
+ const result = fn(value, (draft) => {
5422
+ Object.entries(draft).forEach(([property, oldValue]) => {
5423
+ const currentObjectPath = recursivePath ? `${recursivePath}.${property}` : property;
5424
+ if (typeof oldValue === "string") {
5425
+ const bindResult = bindVariables({ ...bindVariablesOptions, value: oldValue });
5426
+ if (oldValue !== bindResult.result || bindResult.errors) {
5427
+ boundCount += bindResult.boundCount;
5428
+ draft[property] = bindResult.result;
5429
+ if (bindResult.errors) {
5430
+ errors.push(...bindResult.errors.map((e) => `${currentObjectPath}: ${e}`));
5431
+ }
5432
+ }
5433
+ return;
5434
+ }
5435
+ const childBind = bindVariablesToObject({
5436
+ ...bindVariablesOptions,
5437
+ value: oldValue,
5438
+ recursivePath: currentObjectPath
5439
+ });
5440
+ if (childBind.boundCount || childBind.errors) {
5441
+ boundCount += childBind.boundCount;
5442
+ draft[property] = childBind.result;
5443
+ if (childBind.errors) {
5444
+ errors.push(...childBind.errors.map((e) => `${currentObjectPath}: ${e}`));
5445
+ }
5446
+ }
5447
+ });
5448
+ });
5449
+ return { boundCount, result, errors: errors.length > 0 ? errors : void 0 };
5450
+ }
4102
5451
 
4103
- // src/components/ObjectSearch/ObjectSearchFilter.tsx
4104
- import { InputKeywordSearch as InputKeywordSearch2, InputSelect as InputSelect6 } from "@uniformdev/design-system";
4105
- import { useState as useState12 } from "react";
5452
+ // src/components/ObjectSearch/ObjectSearchContainer.tsx
5453
+ import { Container, IconsProvider, ScrollableList, VerticalRhythm } from "@uniformdev/design-system";
4106
5454
 
4107
5455
  // src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
4108
- import { createContext as createContext5, useCallback, useContext as useContext7, useDeferredValue, useState as useState11 } from "react";
4109
- import { jsx as jsx47 } from "@emotion/react/jsx-runtime";
5456
+ import {
5457
+ createContext as createContext5,
5458
+ useCallback,
5459
+ useContext as useContext7,
5460
+ useDeferredValue,
5461
+ useMemo as useMemo8,
5462
+ useState as useState12
5463
+ } from "react";
5464
+ import { jsx as jsx48 } from "@emotion/react/jsx-runtime";
4110
5465
  var ObjectSearchContext = createContext5({
4111
5466
  onSetQuery: () => {
4112
5467
  },
4113
5468
  onSelectItem: () => {
4114
5469
  },
4115
- query: {
4116
- contentType: "",
4117
- keyword: ""
4118
- },
5470
+ query: {},
5471
+ boundQuery: {},
4119
5472
  list: {},
4120
5473
  onSetList: () => {
4121
5474
  },
@@ -4124,22 +5477,23 @@ var ObjectSearchContext = createContext5({
4124
5477
  }
4125
5478
  });
4126
5479
  var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
4127
- const [query, setQuery] = useState11({
5480
+ const [query, setQuery] = useState12({
4128
5481
  contentType: "",
4129
5482
  keyword: ""
4130
5483
  });
5484
+ const { flatVariables } = useVariables(true);
4131
5485
  const querySearchDeferred = useDeferredValue(query);
4132
- const [selectedItems, setSelectedItems] = useState11(currentlySelectedItems != null ? currentlySelectedItems : []);
4133
- const [list, setList] = useState11({});
5486
+ const [selectedItems, setSelectedItems] = useState12(currentlySelectedItems != null ? currentlySelectedItems : []);
5487
+ const [list, setList] = useState12({});
4134
5488
  const onSetQuery = useCallback(
4135
- (value) => {
4136
- if (Array.isArray(value.contentType) && value.contentType.length > 0) {
5489
+ (value2) => {
5490
+ if (Array.isArray(value2.contentType) && value2.contentType.length > 0) {
4137
5491
  return setQuery({
4138
- ...value,
4139
- contentType: value.contentType[0].id
5492
+ ...value2,
5493
+ contentType: value2.contentType[0].id
4140
5494
  });
4141
5495
  }
4142
- return setQuery(value);
5496
+ return setQuery(value2);
4143
5497
  },
4144
5498
  [setQuery]
4145
5499
  );
@@ -4161,35 +5515,116 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
4161
5515
  setSelectedItems([]);
4162
5516
  }, [setSelectedItems]);
4163
5517
  const onSetList = useCallback(
4164
- (value) => {
4165
- setList(value);
5518
+ (value2) => {
5519
+ setList(value2);
4166
5520
  },
4167
5521
  [setList]
4168
5522
  );
4169
- return /* @__PURE__ */ jsx47(
4170
- ObjectSearchContext.Provider,
4171
- {
4172
- value: {
4173
- onSetQuery,
4174
- query: querySearchDeferred,
4175
- onSelectItem,
4176
- selectedListItems: selectedItems,
4177
- onRemoveAllSelectedItems,
4178
- list,
4179
- onSetList
4180
- },
4181
- children
4182
- }
5523
+ const boundQuery = useMemo8(() => bindQuery(query, flatVariables), [query, flatVariables]);
5524
+ const value = useMemo8(
5525
+ () => ({
5526
+ boundQuery,
5527
+ onSetQuery,
5528
+ query: querySearchDeferred,
5529
+ onSelectItem,
5530
+ selectedListItems: selectedItems,
5531
+ onRemoveAllSelectedItems,
5532
+ list,
5533
+ onSetList
5534
+ }),
5535
+ [
5536
+ boundQuery,
5537
+ onSetQuery,
5538
+ querySearchDeferred,
5539
+ onSelectItem,
5540
+ selectedItems,
5541
+ onRemoveAllSelectedItems,
5542
+ list,
5543
+ onSetList
5544
+ ]
4183
5545
  );
5546
+ return /* @__PURE__ */ jsx48(ObjectSearchContext.Provider, { value, children });
4184
5547
  };
4185
- var useObjectSearchContext = () => {
4186
- const contextValues = useContext7(ObjectSearchContext);
4187
- return { ...contextValues };
5548
+ function useObjectSearchContext() {
5549
+ return useContext7(ObjectSearchContext);
5550
+ }
5551
+ function bindQuery(query, inputs) {
5552
+ const { result, errors } = bindVariablesToObject({
5553
+ value: query,
5554
+ variables: inputs,
5555
+ errorPrefix: "Dynamic input"
5556
+ });
5557
+ if (errors == null ? void 0 : errors.length) {
5558
+ console.error(`Error binding query filters to dynamic inputs`, errors);
5559
+ }
5560
+ return result;
5561
+ }
5562
+
5563
+ // src/components/ObjectSearch/ObjectSearchContainer.tsx
5564
+ import { jsx as jsx49, jsxs as jsxs28 } from "@emotion/react/jsx-runtime";
5565
+ var ObjectSearchContainer = ({
5566
+ label,
5567
+ enableDynamicInputToResultId,
5568
+ searchFilters,
5569
+ resultList,
5570
+ children
5571
+ }) => {
5572
+ var _a, _b;
5573
+ const { onSelectItem, selectedListItems, list } = useObjectSearchContext();
5574
+ const { flatVariables } = useVariables(true);
5575
+ const body = /* @__PURE__ */ jsxs28(VerticalRhythm, { children: [
5576
+ searchFilters,
5577
+ !resultList ? null : /* @__PURE__ */ jsx49(ScrollableList, { role: "list", children: resultList })
5578
+ ] });
5579
+ const handleSelectedVariableChange = (selectedValue) => {
5580
+ var _a2;
5581
+ if (!selectedValue) {
5582
+ onSelectItem([]);
5583
+ return;
5584
+ }
5585
+ const { result, errors } = bindVariables({
5586
+ value: selectedValue,
5587
+ variables: flatVariables,
5588
+ errorPrefix: "Dynamic input"
5589
+ });
5590
+ if (!result) {
5591
+ onSelectItem([]);
5592
+ return;
5593
+ }
5594
+ const item = (_a2 = list.items) == null ? void 0 : _a2.find((i2) => i2.id === result);
5595
+ onSelectItem([
5596
+ {
5597
+ title: selectedValue,
5598
+ contentType: (errors == null ? void 0 : errors.length) ? errors[0] : `Current dynamic value "${result}" is not an ID in the options`,
5599
+ // spread any matched list item, overriding the above default props
5600
+ ...item,
5601
+ // we want to make sure the ID is our dynamic value
5602
+ id: selectedValue
5603
+ }
5604
+ ]);
5605
+ };
5606
+ return /* @__PURE__ */ jsx49(IconsProvider, { children: /* @__PURE__ */ jsxs28(VerticalRhythm, { children: [
5607
+ /* @__PURE__ */ jsx49(Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ jsx49(
5608
+ InputVariables,
5609
+ {
5610
+ label,
5611
+ value: (_b = (_a = selectedListItems == null ? void 0 : selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "",
5612
+ onChange: handleSelectedVariableChange,
5613
+ inputWhenNoVariables: body,
5614
+ disableVariables: !enableDynamicInputToResultId
5615
+ }
5616
+ ) : body }),
5617
+ children
5618
+ ] }) });
4188
5619
  };
4189
5620
 
5621
+ // src/components/ObjectSearch/ObjectSearchFilter.tsx
5622
+ import { InputKeywordSearch as InputKeywordSearch2, InputSelect as InputSelect6 } from "@uniformdev/design-system";
5623
+ import { useState as useState13 } from "react";
5624
+
4190
5625
  // src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
4191
- import { css as css26 } from "@emotion/react";
4192
- var ObjectSearchFilterContainerLabel = css26`
5626
+ import { css as css28 } from "@emotion/react";
5627
+ var ObjectSearchFilterContainerLabel = css28`
4193
5628
  align-items: center;
4194
5629
  display: flex;
4195
5630
  font-size: var(--fs-sm);
@@ -4197,21 +5632,21 @@ var ObjectSearchFilterContainerLabel = css26`
4197
5632
  line-height: 1rem;
4198
5633
  margin-bottom: var(--spacing-sm);
4199
5634
  `;
4200
- var ObjectSearchFilterContainer = css26`
5635
+ var ObjectSearchFilterContainer = css28`
4201
5636
  display: grid;
4202
5637
  gap: var(--spacing-base);
4203
5638
  `;
4204
- var ObjectSearchFilterDropdownAndTextSearch = css26`
5639
+ var ObjectSearchFilterDropdownAndTextSearch = css28`
4205
5640
  grid-template-columns: 0.5fr 1fr;
4206
5641
  `;
4207
- var ObjectSearchFilterGrid = (gridColumns) => css26`
5642
+ var ObjectSearchFilterGrid = (gridColumns) => css28`
4208
5643
  display: grid;
4209
5644
  grid-template-columns: ${gridColumns};
4210
5645
  gap: var(--spacing-base);
4211
5646
  `;
4212
5647
 
4213
5648
  // src/components/ObjectSearch/ObjectSearchFilter.tsx
4214
- import { jsx as jsx48, jsxs as jsxs28 } from "@emotion/react/jsx-runtime";
5649
+ import { jsx as jsx50, jsxs as jsxs29 } from "@emotion/react/jsx-runtime";
4215
5650
  var ObjectSearchFilter = ({
4216
5651
  requireContentType,
4217
5652
  typeSelectorAllTypesOptionText = "All content types",
@@ -4221,7 +5656,7 @@ var ObjectSearchFilter = ({
4221
5656
  selectOptions
4222
5657
  }) => {
4223
5658
  const { query, onSetQuery } = useObjectSearchContext();
4224
- const [searchState, setSearchState] = useState12({
5659
+ const [searchState, setSearchState] = useState13({
4225
5660
  contentType: "",
4226
5661
  keyword: ""
4227
5662
  });
@@ -4231,8 +5666,8 @@ var ObjectSearchFilter = ({
4231
5666
  });
4232
5667
  onSetQuery({ ...query, ...value });
4233
5668
  };
4234
- return /* @__PURE__ */ jsxs28("fieldset", { css: [ObjectSearchFilterContainer, ObjectSearchFilterDropdownAndTextSearch], children: [
4235
- /* @__PURE__ */ jsx48(
5669
+ return /* @__PURE__ */ jsxs29("fieldset", { css: [ObjectSearchFilterContainer, ObjectSearchFilterDropdownAndTextSearch], children: [
5670
+ /* @__PURE__ */ jsx50(
4236
5671
  InputSelect6,
4237
5672
  {
4238
5673
  label: selectLabel,
@@ -4248,7 +5683,7 @@ var ObjectSearchFilter = ({
4248
5683
  value: query.contentType
4249
5684
  }
4250
5685
  ),
4251
- /* @__PURE__ */ jsx48(
5686
+ /* @__PURE__ */ jsx50(
4252
5687
  InputKeywordSearch2,
4253
5688
  {
4254
5689
  inputFieldName: searchInputName,
@@ -4263,11 +5698,11 @@ var ObjectSearchFilter = ({
4263
5698
  };
4264
5699
 
4265
5700
  // src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
4266
- import { jsx as jsx49, jsxs as jsxs29 } from "@emotion/react/jsx-runtime";
5701
+ import { jsx as jsx51, jsxs as jsxs30 } from "@emotion/react/jsx-runtime";
4267
5702
  var ObjectSearchFilterContainer2 = ({ label, children }) => {
4268
- return /* @__PURE__ */ jsxs29("div", { children: [
4269
- /* @__PURE__ */ jsx49("span", { css: ObjectSearchFilterContainerLabel, children: label }),
4270
- /* @__PURE__ */ jsx49("div", { css: ObjectSearchFilterContainer, children })
5703
+ return /* @__PURE__ */ jsxs30("div", { children: [
5704
+ label ? /* @__PURE__ */ jsx51("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
5705
+ /* @__PURE__ */ jsx51("div", { css: ObjectSearchFilterContainer, children })
4271
5706
  ] });
4272
5707
  };
4273
5708
 
@@ -4275,9 +5710,9 @@ var ObjectSearchFilterContainer2 = ({ label, children }) => {
4275
5710
  import { Popover } from "@uniformdev/design-system";
4276
5711
 
4277
5712
  // src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
4278
- import { css as css27 } from "@emotion/react";
5713
+ import { css as css29 } from "@emotion/react";
4279
5714
  import { skeletonLoading } from "@uniformdev/design-system";
4280
- var ObjectListItemContainer = css27`
5715
+ var ObjectListItemContainer = css29`
4281
5716
  align-items: center;
4282
5717
  border: 1px solid var(--gray-300);
4283
5718
  border-radius: var(--rounded-base);
@@ -4290,7 +5725,7 @@ var ObjectListItemContainer = css27`
4290
5725
  display: none;
4291
5726
  }
4292
5727
  `;
4293
- var ObjectListItemLoading = css27`
5728
+ var ObjectListItemLoading = css29`
4294
5729
  animation: ${skeletonLoading} 1s linear infinite alternate;
4295
5730
  border-color: transparent;
4296
5731
  min-height: 42px;
@@ -4314,37 +5749,37 @@ var ObjectListItemLoading = css27`
4314
5749
  width: 1rem;
4315
5750
  }
4316
5751
  `;
4317
- var ObjectListItemHeadingGroup = css27`
5752
+ var ObjectListItemHeadingGroup = css29`
4318
5753
  align-items: center;
4319
5754
  display: grid;
4320
5755
  `;
4321
- var ObjectListItemTitle = css27`
5756
+ var ObjectListItemTitle = css29`
4322
5757
  color: var(--brand-secondary-1);
4323
5758
  display: block;
4324
5759
  font-size: var(--fs-sm);
4325
5760
  `;
4326
- var ObjectListItemSubtitle = css27`
5761
+ var ObjectListItemSubtitle = css29`
4327
5762
  color: var(--gray-500);
4328
5763
  display: block;
4329
5764
  font-size: var(--fs-xs);
4330
5765
  line-height: 1;
4331
5766
  `;
4332
- var ObjectListItemInfoContainer = css27`
5767
+ var ObjectListItemInfoContainer = css29`
4333
5768
  align-items: center;
4334
5769
  display: flex;
4335
5770
  justify-content: center;
4336
5771
  `;
4337
- var ObjectListItemControlledContent = css27`
5772
+ var ObjectListItemControlledContent = css29`
4338
5773
  display: flex;
4339
5774
  gap: var(--spacing-sm);
4340
5775
  `;
4341
- var ObjectListItemUnControlledContent = css27`
5776
+ var ObjectListItemUnControlledContent = css29`
4342
5777
  margin-top: var(--spacing-sm);
4343
5778
  grid-column: 1 / -1;
4344
5779
  `;
4345
5780
 
4346
5781
  // src/components/ObjectSearch/ObjectSearchListItem.tsx
4347
- import { jsx as jsx50, jsxs as jsxs30 } from "@emotion/react/jsx-runtime";
5782
+ import { jsx as jsx52, jsxs as jsxs31 } from "@emotion/react/jsx-runtime";
4348
5783
  var ObjectSearchListItem = ({
4349
5784
  id,
4350
5785
  title,
@@ -4353,8 +5788,7 @@ var ObjectSearchListItem = ({
4353
5788
  popoverData,
4354
5789
  onSelect,
4355
5790
  isMulti = false,
4356
- children,
4357
- ...props
5791
+ children
4358
5792
  }) => {
4359
5793
  const { onSelectItem, selectedListItems } = useObjectSearchContext();
4360
5794
  const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
@@ -4368,20 +5802,20 @@ var ObjectSearchListItem = ({
4368
5802
  return onSelectItem([selectedItem]);
4369
5803
  };
4370
5804
  const hideWhenInSelectedList = selectedListItems.some((item) => item.id === id);
4371
- return /* @__PURE__ */ jsxs30("div", { role: "listitem", hidden: hideWhenInSelectedList, css: ObjectListItemContainer, ...props, children: [
4372
- /* @__PURE__ */ jsxs30("div", { role: "button", onClick: handleSelectItem, css: ObjectListItemControlledContent, children: [
4373
- !image ? null : /* @__PURE__ */ jsx50("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
4374
- /* @__PURE__ */ jsxs30("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
4375
- !contentType ? null : /* @__PURE__ */ jsx50("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
4376
- /* @__PURE__ */ jsx50("span", { css: ObjectListItemTitle, children: title })
5805
+ return /* @__PURE__ */ jsxs31("div", { role: "listitem", hidden: hideWhenInSelectedList, css: ObjectListItemContainer, children: [
5806
+ /* @__PURE__ */ jsxs31("div", { role: "button", onClick: handleSelectItem, css: ObjectListItemControlledContent, children: [
5807
+ !image ? null : /* @__PURE__ */ jsx52("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
5808
+ /* @__PURE__ */ jsxs31("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
5809
+ !contentType ? null : /* @__PURE__ */ jsx52("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
5810
+ /* @__PURE__ */ jsx52("span", { css: ObjectListItemTitle, children: title })
4377
5811
  ] })
4378
5812
  ] }),
4379
- !popoverData ? null : /* @__PURE__ */ jsx50("div", { css: ObjectListItemInfoContainer, children: /* @__PURE__ */ jsx50(Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData }) }),
4380
- !children ? null : /* @__PURE__ */ jsx50("div", { css: ObjectListItemUnControlledContent, children })
5813
+ !popoverData ? null : /* @__PURE__ */ jsx52("div", { css: ObjectListItemInfoContainer, children: /* @__PURE__ */ jsx52(Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData }) }),
5814
+ !children ? null : /* @__PURE__ */ jsx52("div", { css: ObjectListItemUnControlledContent, children })
4381
5815
  ] });
4382
5816
  };
4383
5817
  var ObjectSearchListItemLoadingSkeleton = () => {
4384
- return /* @__PURE__ */ jsx50("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
5818
+ return /* @__PURE__ */ jsx52("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
4385
5819
  };
4386
5820
 
4387
5821
  // src/components/ObjectSearch/ObjectSearchResultItem.tsx
@@ -4389,9 +5823,9 @@ import { Badge, Button as Button4, Popover as Popover2 } from "@uniformdev/desig
4389
5823
  import { format as timeagoFormat } from "timeago.js";
4390
5824
 
4391
5825
  // src/components/ObjectSearch/styles/ObjectSearchResultItemButton.styles.ts
4392
- import { css as css28 } from "@emotion/react";
5826
+ import { css as css30 } from "@emotion/react";
4393
5827
  import { button as button2 } from "@uniformdev/design-system";
4394
- var ButtonStyles = css28`
5828
+ var ButtonStyles = css30`
4395
5829
  ${button2}
4396
5830
  background: transparent;
4397
5831
  border: 1px solid var(--brand-secondary-1);
@@ -4418,20 +5852,20 @@ var ButtonStyles = css28`
4418
5852
  text-decoration: none;
4419
5853
  }
4420
5854
  `;
4421
- var ButtonIcon = css28`
5855
+ var ButtonIcon = css30`
4422
5856
  width: 1rem;
4423
5857
  height: 1rem;
4424
5858
  `;
4425
5859
 
4426
5860
  // src/components/ObjectSearch/ObjectSearchResultItemButton.tsx
4427
- import { jsx as jsx51, jsxs as jsxs31 } from "@emotion/react/jsx-runtime";
5861
+ import { jsx as jsx53, jsxs as jsxs32 } from "@emotion/react/jsx-runtime";
4428
5862
  var ObjectSearchResultItemButton = ({
4429
5863
  text,
4430
5864
  icon,
4431
5865
  ...props
4432
5866
  }) => {
4433
- return /* @__PURE__ */ jsxs31("button", { type: "button", css: ButtonStyles, ...props, children: [
4434
- !icon ? null : /* @__PURE__ */ jsx51(Image, { src: icon, css: ButtonIcon }),
5867
+ return /* @__PURE__ */ jsxs32("button", { type: "button", css: ButtonStyles, ...props, children: [
5868
+ !icon ? null : /* @__PURE__ */ jsx53(Image, { src: icon, css: ButtonIcon }),
4435
5869
  text
4436
5870
  ] });
4437
5871
  };
@@ -4440,15 +5874,15 @@ var LinkButton = ({
4440
5874
  icon,
4441
5875
  ...props
4442
5876
  }) => {
4443
- return /* @__PURE__ */ jsxs31("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
4444
- !icon ? null : /* @__PURE__ */ jsx51(Image, { src: icon, css: ButtonIcon }),
5877
+ return /* @__PURE__ */ jsxs32("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
5878
+ !icon ? null : /* @__PURE__ */ jsx53(Image, { src: icon, css: ButtonIcon }),
4445
5879
  text
4446
5880
  ] });
4447
5881
  };
4448
5882
 
4449
5883
  // src/components/ObjectSearch/styles/ObjectSearchResultItem.styles.ts
4450
- import { css as css29 } from "@emotion/react";
4451
- var ObjectSearchResultItemContainer = css29`
5884
+ import { css as css31 } from "@emotion/react";
5885
+ var ObjectSearchResultItemContainer = css31`
4452
5886
  align-items: center;
4453
5887
  border: 1px solid var(--gray-300);
4454
5888
  border-radius: var(--rounded-base);
@@ -4464,7 +5898,7 @@ var ObjectSearchResultItemContainer = css29`
4464
5898
  }
4465
5899
  }
4466
5900
  `;
4467
- var ObjectSearchDragHandle = css29`
5901
+ var ObjectSearchDragHandle = css31`
4468
5902
  border-left: 2px dotted var(--gray-300);
4469
5903
  border-right: 2px dotted var(--gray-300);
4470
5904
  position: absolute;
@@ -4473,41 +5907,41 @@ var ObjectSearchDragHandle = css29`
4473
5907
  transition: opacity var(--duration-fast) var(--timing-ease-out);
4474
5908
  opacity: 0;
4475
5909
  `;
4476
- var ObjectSearchResultItemSubtitle = css29`
5910
+ var ObjectSearchResultItemSubtitle = css31`
4477
5911
  color: var(--gray-500);
4478
5912
  display: block;
4479
5913
  font-size: var(--fs-xs);
4480
5914
  line-height: 1;
4481
5915
  `;
4482
- var ObjectSearchResultItemTitle = css29`
5916
+ var ObjectSearchResultItemTitle = css31`
4483
5917
  align-items: center;
4484
5918
  color: var(--brand-secondary-1);
4485
5919
  display: flex;
4486
5920
  gap: var(--spacing-xs);
4487
5921
  `;
4488
- var ObjectSearchResultItemTimeStamp = css29`
5922
+ var ObjectSearchResultItemTimeStamp = css31`
4489
5923
  color: var(--gray-500);
4490
5924
  font-size: var(--fs-xs);
4491
5925
  `;
4492
- var ObjectSearchAuthorStateGroup = css29`
5926
+ var ObjectSearchAuthorStateGroup = css31`
4493
5927
  align-items: center;
4494
5928
  display: flex;
4495
5929
  gap: var(--spacing-sm);
4496
5930
  `;
4497
- var ObjectSearchUpdateGroup = css29`
5931
+ var ObjectSearchUpdateGroup = css31`
4498
5932
  display: grid;
4499
5933
  `;
4500
- var ObjectSearchContentContainer = css29`
5934
+ var ObjectSearchContentContainer = css31`
4501
5935
  display: flex;
4502
5936
  gap: var(--spacing-base);
4503
5937
  `;
4504
- var ObjectSearchImage = css29`
5938
+ var ObjectSearchImage = css31`
4505
5939
  width: 56px;
4506
5940
  object-fit: contain;
4507
5941
  `;
4508
5942
 
4509
5943
  // src/components/ObjectSearch/ObjectSearchResultItem.tsx
4510
- import { jsx as jsx52, jsxs as jsxs32 } from "@emotion/react/jsx-runtime";
5944
+ import { jsx as jsx54, jsxs as jsxs33 } from "@emotion/react/jsx-runtime";
4511
5945
  var ObjectSearchResultItem = ({
4512
5946
  id,
4513
5947
  title,
@@ -4528,38 +5962,38 @@ var ObjectSearchResultItem = ({
4528
5962
  const { onSelectItem } = useObjectSearchContext();
4529
5963
  const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
4530
5964
  const onRemoveItem = () => {
4531
- onSelectItem({ id });
5965
+ onSelectItem({ id, title: id });
4532
5966
  onRemove == null ? void 0 : onRemove();
4533
5967
  };
4534
- return /* @__PURE__ */ jsxs32("div", { css: ObjectSearchResultItemContainer, children: [
4535
- disableDnD ? null : /* @__PURE__ */ jsx52("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
4536
- /* @__PURE__ */ jsx52("div", { children: /* @__PURE__ */ jsxs32("div", { css: ObjectSearchContentContainer, children: [
4537
- !imageUrl ? null : /* @__PURE__ */ jsx52("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
4538
- /* @__PURE__ */ jsxs32("div", { children: [
4539
- /* @__PURE__ */ jsx52("span", { css: ObjectSearchResultItemSubtitle, children: formatedContentType }),
4540
- /* @__PURE__ */ jsxs32("span", { role: "heading", css: ObjectSearchResultItemTitle, children: [
5968
+ return /* @__PURE__ */ jsxs33("div", { css: ObjectSearchResultItemContainer, children: [
5969
+ disableDnD ? null : /* @__PURE__ */ jsx54("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
5970
+ /* @__PURE__ */ jsx54("div", { children: /* @__PURE__ */ jsxs33("div", { css: ObjectSearchContentContainer, children: [
5971
+ !imageUrl ? null : /* @__PURE__ */ jsx54("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
5972
+ /* @__PURE__ */ jsxs33("div", { children: [
5973
+ /* @__PURE__ */ jsx54("span", { css: ObjectSearchResultItemSubtitle, children: formatedContentType }),
5974
+ /* @__PURE__ */ jsxs33("span", { role: "heading", css: ObjectSearchResultItemTitle, children: [
4541
5975
  title != null ? title : name,
4542
- !popoverData ? null : /* @__PURE__ */ jsx52(Popover2, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
5976
+ !popoverData ? null : /* @__PURE__ */ jsx54(Popover2, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
4543
5977
  ] }),
4544
- !createdAt && !publishStatus ? null : /* @__PURE__ */ jsxs32("div", { css: ObjectSearchAuthorStateGroup, children: [
4545
- !(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ jsx52(Badge, { ...publishStatus, size: "sm", uppercaseText: true }),
4546
- !createdAt && !publishedAt ? null : /* @__PURE__ */ jsxs32("div", { css: ObjectSearchUpdateGroup, children: [
4547
- !createdAt ? null : /* @__PURE__ */ jsxs32("small", { css: ObjectSearchResultItemTimeStamp, children: [
4548
- /* @__PURE__ */ jsx52("strong", { children: "Last updated: " }),
5978
+ !createdAt && !publishStatus ? null : /* @__PURE__ */ jsxs33("div", { css: ObjectSearchAuthorStateGroup, children: [
5979
+ !(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ jsx54(Badge, { ...publishStatus, size: "sm", uppercaseText: true }),
5980
+ !createdAt && !publishedAt ? null : /* @__PURE__ */ jsxs33("div", { css: ObjectSearchUpdateGroup, children: [
5981
+ !createdAt ? null : /* @__PURE__ */ jsxs33("small", { css: ObjectSearchResultItemTimeStamp, children: [
5982
+ /* @__PURE__ */ jsx54("strong", { children: "Last updated: " }),
4549
5983
  timeagoFormat(createdAt)
4550
5984
  ] }),
4551
- !publishedAt ? null : /* @__PURE__ */ jsxs32("small", { css: ObjectSearchResultItemTimeStamp, children: [
4552
- /* @__PURE__ */ jsx52("strong", { children: "Last published: " }),
5985
+ !publishedAt ? null : /* @__PURE__ */ jsxs33("small", { css: ObjectSearchResultItemTimeStamp, children: [
5986
+ /* @__PURE__ */ jsx54("strong", { children: "Last published: " }),
4553
5987
  timeagoFormat(publishedAt)
4554
5988
  ] })
4555
5989
  ] })
4556
5990
  ] }),
4557
- /* @__PURE__ */ jsx52("div", { children })
5991
+ /* @__PURE__ */ jsx54("div", { children })
4558
5992
  ] })
4559
5993
  ] }) }),
4560
- !editLink && hideRemoveButton ? null : /* @__PURE__ */ jsxs32("div", { css: ObjectSearchAuthorStateGroup, children: [
4561
- !editLink ? null : /* @__PURE__ */ jsx52(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
4562
- hideRemoveButton ? null : /* @__PURE__ */ jsx52(Button4, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
5994
+ !editLink && hideRemoveButton ? null : /* @__PURE__ */ jsxs33("div", { css: ObjectSearchAuthorStateGroup, children: [
5995
+ !editLink ? null : /* @__PURE__ */ jsx54(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
5996
+ hideRemoveButton ? null : /* @__PURE__ */ jsx54(Button4, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
4563
5997
  ] })
4564
5998
  ] });
4565
5999
  };
@@ -4569,38 +6003,39 @@ import { Button as Button5, Counter } from "@uniformdev/design-system";
4569
6003
  import { DragDropContext as DragDropContext3, Draggable as Draggable3, Droppable as Droppable3 } from "react-beautiful-dnd";
4570
6004
 
4571
6005
  // src/components/ObjectSearch/styles/ObjectSearchResultList.styles.ts
4572
- import { css as css30 } from "@emotion/react";
4573
- var ObjectSearchResultListContainer = css30`
6006
+ import { css as css32 } from "@emotion/react";
6007
+ var ObjectSearchResultListContainer = css32`
4574
6008
  align-items: center;
4575
6009
  display: flex;
4576
6010
  gap: var(--spacing-sm);
4577
6011
  justify-content: space-between;
4578
6012
  `;
4579
- var ObjectSearchDragContainer = css30`
6013
+ var ObjectSearchDragContainer = css32`
4580
6014
  margin: 0 0 var(--spacing-sm);
4581
6015
  `;
4582
- var ObjectSearchResultListCounterContainer = css30`
6016
+ var ObjectSearchResultListCounterContainer = css32`
4583
6017
  align-items: center;
4584
6018
  display: flex;
4585
6019
  gap: var(--spacing-sm);
4586
6020
  `;
4587
- var ObjectSearchResultListTitle = css30`
6021
+ var ObjectSearchResultListTitle = css32`
4588
6022
  font-weight: var(--fw-bold);
4589
6023
  line-height: 1;
4590
6024
  `;
4591
6025
 
4592
6026
  // src/components/ObjectSearch/ObjectSearchResultList.tsx
4593
- import { Fragment as Fragment7, jsx as jsx53, jsxs as jsxs33 } from "@emotion/react/jsx-runtime";
4594
- var ObjectSearchResultList = ({
6027
+ import { Fragment as Fragment8, jsx as jsx55, jsxs as jsxs34 } from "@emotion/react/jsx-runtime";
6028
+ function ObjectSearchResultList({
4595
6029
  resultLabelText = "Selected",
4596
6030
  removeButtonText = "Remove all",
4597
6031
  onRemoveAllSelected,
4598
6032
  hideRemoveButton = false,
4599
6033
  additionalButtons,
4600
- renderResultComponent = (value) => /* @__PURE__ */ jsx53(ObjectSearchResultItem, { ...value, disableDnD }),
6034
+ renderResultComponent = (value) => /* @__PURE__ */ jsx55(ObjectSearchResultItem, { ...value, disableDnD }),
4601
6035
  multiSelectId,
4602
- disableDnD = false
4603
- }) => {
6036
+ disableDnD = false,
6037
+ whenNothingSelected = null
6038
+ }) {
4604
6039
  const { selectedListItems, onRemoveAllSelectedItems, onSelectItem } = useObjectSearchContext();
4605
6040
  const handleRemoveAllSelectedItems = () => {
4606
6041
  onRemoveAllSelectedItems();
@@ -4616,16 +6051,16 @@ var ObjectSearchResultList = ({
4616
6051
  return result;
4617
6052
  }
4618
6053
  };
4619
- return /* @__PURE__ */ jsxs33(Fragment7, { children: [
4620
- /* @__PURE__ */ jsxs33("div", { role: "group", css: ObjectSearchResultListContainer, children: [
4621
- /* @__PURE__ */ jsxs33("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
4622
- /* @__PURE__ */ jsx53("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
6054
+ return /* @__PURE__ */ jsxs34(Fragment8, { children: [
6055
+ /* @__PURE__ */ jsxs34("div", { role: "group", css: ObjectSearchResultListContainer, children: [
6056
+ /* @__PURE__ */ jsxs34("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
6057
+ /* @__PURE__ */ jsx55("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
4623
6058
  " ",
4624
- !selectedListItems.length ? null : /* @__PURE__ */ jsx53(Counter, { count: selectedListItems.length })
6059
+ !selectedListItems.length ? null : /* @__PURE__ */ jsx55(Counter, { count: selectedListItems.length })
4625
6060
  ] }),
4626
- /* @__PURE__ */ jsxs33("div", { css: ObjectSearchResultListCounterContainer, children: [
6061
+ /* @__PURE__ */ jsxs34("div", { css: ObjectSearchResultListCounterContainer, children: [
4627
6062
  additionalButtons,
4628
- hideRemoveButton ? null : /* @__PURE__ */ jsx53(
6063
+ hideRemoveButton ? null : /* @__PURE__ */ jsx55(
4629
6064
  Button5,
4630
6065
  {
4631
6066
  buttonType: "ghostDestructive",
@@ -4637,10 +6072,10 @@ var ObjectSearchResultList = ({
4637
6072
  )
4638
6073
  ] })
4639
6074
  ] }),
4640
- !selectedListItems.length ? null : /* @__PURE__ */ jsx53(DragDropContext3, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx53(Droppable3, { droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select", children: (provided) => /* @__PURE__ */ jsxs33("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
4641
- selectedListItems.map((item, i) => {
6075
+ !selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ jsx55(DragDropContext3, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx55(Droppable3, { droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select", children: (provided) => /* @__PURE__ */ jsxs34("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
6076
+ selectedListItems.map((item, i2) => {
4642
6077
  const renderListItem = renderResultComponent(item);
4643
- return /* @__PURE__ */ jsx53(Draggable3, { draggableId: item.id, index: i, isDragDisabled: disableDnD, children: (provided2, snapshot) => /* @__PURE__ */ jsx53(
6078
+ return /* @__PURE__ */ jsx55(Draggable3, { draggableId: item.id, index: i2, isDragDisabled: disableDnD, children: (provided2, snapshot) => /* @__PURE__ */ jsx55(
4644
6079
  "div",
4645
6080
  {
4646
6081
  css: ObjectSearchDragContainer,
@@ -4655,12 +6090,12 @@ var ObjectSearchResultList = ({
4655
6090
  provided.placeholder
4656
6091
  ] }) }) })
4657
6092
  ] });
4658
- };
6093
+ }
4659
6094
 
4660
6095
  // src/components/ObjectSearch/QueryFilter.tsx
4661
- import { Input as Input7, InputKeywordSearch as InputKeywordSearch3, InputSelect as InputSelect7 } from "@uniformdev/design-system";
4662
- import { useEffect as useEffect9, useState as useState13 } from "react";
4663
- import { jsx as jsx54, jsxs as jsxs34 } from "@emotion/react/jsx-runtime";
6096
+ import { Input as Input6, InputKeywordSearch as InputKeywordSearch3, InputSelect as InputSelect7, VerticalRhythm as VerticalRhythm2 } from "@uniformdev/design-system";
6097
+ import { useEffect as useEffect9, useState as useState14 } from "react";
6098
+ import { jsx as jsx56, jsxs as jsxs35 } from "@emotion/react/jsx-runtime";
4664
6099
  var QueryFilter = ({
4665
6100
  requireContentType,
4666
6101
  queryFilterTitle = "Configure Query",
@@ -4669,9 +6104,10 @@ var QueryFilter = ({
4669
6104
  contentTypeOptions,
4670
6105
  searchInputName = "searchText",
4671
6106
  searchInputPlaceholderText = "Enter keyword to narrow your results",
6107
+ searchInputLabel = "Query",
4672
6108
  countLabel = "Count",
4673
6109
  countValue = 5,
4674
- sortLabel = "Sort",
6110
+ sortLabel = "Sort By",
4675
6111
  sortOptions,
4676
6112
  sortOrderLabel = "Sort Order",
4677
6113
  sortOrderOptions = [
@@ -4688,9 +6124,9 @@ var QueryFilter = ({
4688
6124
  ],
4689
6125
  children
4690
6126
  }) => {
4691
- var _a, _b;
6127
+ var _a, _b, _c, _d;
4692
6128
  const { query, onSetQuery } = useObjectSearchContext();
4693
- const [queryState, setQueryState] = useState13({
6129
+ const [queryState, setQueryState] = useState14({
4694
6130
  contentType: "",
4695
6131
  keyword: "",
4696
6132
  count: countValue != null ? countValue : 5,
@@ -4704,84 +6140,142 @@ var QueryFilter = ({
4704
6140
  useEffect9(() => {
4705
6141
  onSetQuery(queryState);
4706
6142
  }, [onSetQuery, queryState]);
4707
- return /* @__PURE__ */ jsxs34("fieldset", { children: [
4708
- /* @__PURE__ */ jsx54("span", { css: ObjectSearchFilterContainerLabel, children: queryFilterTitle }),
4709
- /* @__PURE__ */ jsxs34("div", { css: ObjectSearchFilterContainer, children: [
4710
- /* @__PURE__ */ jsxs34("div", { css: ObjectSearchFilterGrid("0.5fr 1fr"), children: [
4711
- /* @__PURE__ */ jsx54(
4712
- InputSelect7,
6143
+ return /* @__PURE__ */ jsxs35("fieldset", { children: [
6144
+ /* @__PURE__ */ jsx56("span", { css: ObjectSearchFilterContainerLabel, children: queryFilterTitle }),
6145
+ /* @__PURE__ */ jsx56("div", { css: ObjectSearchFilterContainer, children: /* @__PURE__ */ jsxs35(VerticalRhythm2, { children: [
6146
+ /* @__PURE__ */ jsx56(
6147
+ InputVariables,
6148
+ {
6149
+ label: searchInputLabel,
6150
+ value: (_c = queryState.keyword) != null ? _c : "",
6151
+ onChange: (newQuery) => handleFilterChange({ keyword: newQuery }),
6152
+ disableInlineMenu: true,
6153
+ id: "qf_searchText",
6154
+ inputWhenNoVariables: /* @__PURE__ */ jsx56(
6155
+ InputKeywordSearch3,
6156
+ {
6157
+ id: "qf_searchText",
6158
+ inputFieldName: searchInputName,
6159
+ placeholder: searchInputPlaceholderText,
6160
+ onSearchTextChanged: (e) => handleFilterChange({ keyword: e }),
6161
+ disabledFieldSubmission: true,
6162
+ onClear: () => handleFilterChange({ keyword: "" }),
6163
+ value: queryState.keyword
6164
+ }
6165
+ )
6166
+ }
6167
+ ),
6168
+ /* @__PURE__ */ jsxs35("div", { css: ObjectSearchFilterGrid("1fr 100px"), children: [
6169
+ /* @__PURE__ */ jsx56(
6170
+ InputVariables,
4713
6171
  {
4714
6172
  label: contentTypeLabel,
4715
- showLabel: false,
4716
- options: [
4717
- ...!requireContentType ? [{ id: "", label: typeSelectorAllTypesOptionText }] : [],
4718
- ...contentTypeOptions ? contentTypeOptions.map((option) => {
4719
- var _a2;
4720
- return { id: option.id, label: (_a2 = option.label) != null ? _a2 : option.name, name: option.name };
4721
- }) : []
4722
- ],
4723
- onChange: (e) => handleFilterChange({ contentType: e.target.value }),
4724
- value: queryState.contentType
6173
+ id: "qf_contentType",
6174
+ value: (_d = queryState.contentType) != null ? _d : "",
6175
+ onChange: (newType) => handleFilterChange({ contentType: newType }),
6176
+ disableInlineMenu: true,
6177
+ inputWhenNoVariables: /* @__PURE__ */ jsx56(
6178
+ InputSelect7,
6179
+ {
6180
+ id: "qf_contentType",
6181
+ label: contentTypeLabel,
6182
+ showLabel: false,
6183
+ options: [
6184
+ ...!requireContentType ? [{ id: "", label: typeSelectorAllTypesOptionText }] : [],
6185
+ ...contentTypeOptions ? contentTypeOptions.map((option) => {
6186
+ var _a2;
6187
+ return { id: option.id, label: (_a2 = option.label) != null ? _a2 : option.name, name: option.name };
6188
+ }) : []
6189
+ ],
6190
+ onChange: (e) => handleFilterChange({ contentType: e.target.value }),
6191
+ value: queryState.contentType
6192
+ }
6193
+ )
4725
6194
  }
4726
6195
  ),
4727
- /* @__PURE__ */ jsx54(
4728
- InputKeywordSearch3,
6196
+ /* @__PURE__ */ jsx56(
6197
+ InputVariables,
4729
6198
  {
4730
- inputFieldName: searchInputName,
4731
- placeholder: searchInputPlaceholderText,
4732
- onSearchTextChanged: (e) => handleFilterChange({ keyword: e }),
4733
- disabledFieldSubmission: true,
4734
- onClear: () => handleFilterChange({ keyword: "" }),
4735
- value: queryState.keyword
6199
+ label: countLabel,
6200
+ id: "qf_count",
6201
+ value: queryState.count.toString(10),
6202
+ onChange: (newCount) => handleFilterChange({ count: newCount }),
6203
+ disableInlineMenu: true,
6204
+ inputWhenNoVariables: /* @__PURE__ */ jsx56(
6205
+ Input6,
6206
+ {
6207
+ id: "qf_count",
6208
+ label: countLabel,
6209
+ showLabel: false,
6210
+ type: "number",
6211
+ onChange: (e) => handleFilterChange({ count: e.target.value }),
6212
+ defaultValue: countValue,
6213
+ value: queryState.count
6214
+ }
6215
+ )
4736
6216
  }
4737
6217
  )
4738
6218
  ] }),
4739
- /* @__PURE__ */ jsxs34("div", { css: ObjectSearchFilterGrid("repeat(2, 1fr) 0.5fr"), children: [
4740
- /* @__PURE__ */ jsx54(
4741
- InputSelect7,
6219
+ /* @__PURE__ */ jsxs35("div", { css: ObjectSearchFilterGrid("2fr 1fr"), children: [
6220
+ /* @__PURE__ */ jsx56(
6221
+ InputVariables,
4742
6222
  {
6223
+ id: "qf_sortBy",
4743
6224
  label: sortLabel,
4744
- options: [
6225
+ value: queryState.sortBy,
6226
+ onChange: (newSortBy) => handleFilterChange({ sortBy: newSortBy }),
6227
+ disableInlineMenu: true,
6228
+ inputWhenNoVariables: /* @__PURE__ */ jsx56(
6229
+ InputSelect7,
4745
6230
  {
4746
- label: "Select a sort",
4747
- id: ""
4748
- },
4749
- ...sortOptions ? sortOptions.map((option) => {
4750
- var _a2;
4751
- return { id: option.id, name: option.name, label: (_a2 = option.label) != null ? _a2 : option.name };
4752
- }) : []
4753
- ],
4754
- onChange: (e) => handleFilterChange({ sortBy: e.target.value }),
4755
- value: queryState.sortBy
6231
+ label: sortLabel,
6232
+ id: "qf_sortBy",
6233
+ showLabel: false,
6234
+ options: [
6235
+ {
6236
+ label: "Select a sort",
6237
+ id: ""
6238
+ },
6239
+ ...sortOptions ? sortOptions.map((option) => {
6240
+ var _a2;
6241
+ return { id: option.id, name: option.name, label: (_a2 = option.label) != null ? _a2 : option.name };
6242
+ }) : []
6243
+ ],
6244
+ onChange: (e) => handleFilterChange({ sortBy: e.target.value }),
6245
+ value: queryState.sortBy
6246
+ }
6247
+ )
4756
6248
  }
4757
6249
  ),
4758
- /* @__PURE__ */ jsx54(
4759
- InputSelect7,
6250
+ /* @__PURE__ */ jsx56(
6251
+ InputVariables,
4760
6252
  {
4761
6253
  label: sortOrderLabel,
4762
- options: [
4763
- ...sortOrderOptions ? sortOrderOptions.map((option) => {
4764
- var _a2;
4765
- return { value: option.id, label: (_a2 = option.label) != null ? _a2 : option.name, name: option.name };
4766
- }) : []
4767
- ],
4768
- onChange: (e) => handleFilterChange({ sortOrder: e.target.value }),
4769
- value: queryState.sortOrder
4770
- }
4771
- ),
4772
- /* @__PURE__ */ jsx54(
4773
- Input7,
4774
- {
4775
- label: countLabel,
4776
- type: "number",
4777
- onChange: (e) => handleFilterChange({ count: e.target.value }),
4778
- defaultValue: countValue,
4779
- value: queryState.count
6254
+ id: "qf_sortOrder",
6255
+ value: queryState.sortOrder,
6256
+ onChange: (newSort) => handleFilterChange({ sortOrder: newSort }),
6257
+ disableInlineMenu: true,
6258
+ inputWhenNoVariables: /* @__PURE__ */ jsx56(
6259
+ InputSelect7,
6260
+ {
6261
+ label: sortOrderLabel,
6262
+ id: "qf_sortOrder",
6263
+ showLabel: false,
6264
+ options: [
6265
+ ...sortOrderOptions ? sortOrderOptions.map((option) => {
6266
+ var _a2;
6267
+ return { value: option.id, label: (_a2 = option.label) != null ? _a2 : option.name, name: option.name };
6268
+ }) : []
6269
+ ],
6270
+ onChange: (e) => handleFilterChange({ sortOrder: e.target.value }),
6271
+ value: queryState.sortOrder
6272
+ }
6273
+ )
4780
6274
  }
4781
6275
  )
4782
6276
  ] }),
4783
6277
  children
4784
- ] })
6278
+ ] }) })
4785
6279
  ] });
4786
6280
  };
4787
6281
 
@@ -4802,7 +6296,7 @@ import {
4802
6296
  Button as Button6,
4803
6297
  Callout as Callout5,
4804
6298
  Heading,
4805
- Input as Input8,
6299
+ Input as Input7,
4806
6300
  InputComboBox,
4807
6301
  InputKeywordSearch as InputKeywordSearch4,
4808
6302
  InputSelect as InputSelect8,
@@ -4839,7 +6333,9 @@ export {
4839
6333
  Callout5 as Callout,
4840
6334
  DamSelectedItem,
4841
6335
  DataRefreshButton,
6336
+ DataResourceDynamicInputProvider,
4842
6337
  DataResourceVariablesList,
6338
+ DataResourceVariablesListExplicit,
4843
6339
  DataSourceEditor,
4844
6340
  DataTypeEditor,
4845
6341
  DefaultSearchRow,
@@ -4847,7 +6343,7 @@ export {
4847
6343
  EntrySearch,
4848
6344
  Heading,
4849
6345
  icons_exports as Icons,
4850
- Input8 as Input,
6346
+ Input7 as Input,
4851
6347
  InputComboBox,
4852
6348
  InputKeywordSearch4 as InputKeywordSearch,
4853
6349
  InputSelect8 as InputSelect,
@@ -4986,5 +6482,8 @@ export {
4986
6482
  useRequestParameter,
4987
6483
  useUniformMeshSdk,
4988
6484
  useVariables,
6485
+ variableExpression,
6486
+ variablePrefix,
6487
+ variableSuffix,
4989
6488
  variablesToList
4990
6489
  };