@depict-ai/react-ui 4.8.7 → 4.9.1

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.
@@ -0,0 +1,1361 @@
1
+ import {add_to_version_info as $jb2Oo$add_to_version_info, catchify as $jb2Oo$catchify, queueMacroTask as $jb2Oo$queueMacroTask, instant_exec_on_suspect_history_change as $jb2Oo$instant_exec_on_suspect_history_change, derror as $jb2Oo$derror, dwarn as $jb2Oo$dwarn} from "@depict-ai/utilishared";
2
+ import {CategoryTitle as $383b6fd56bf151bd$re_export$CategoryTitle, embedded_num_products as $383b6fd56bf151bd$re_export$EmbeddedNumProducts, SearchModalV2 as $383b6fd56bf151bd$re_export$SearchModalV2, ClassicSearchModal as $383b6fd56bf151bd$re_export$ClassicSearchModal, DepictAPI as $jb2Oo$DepictAPI, DepictSearch as $jb2Oo$DepictSearch, DepictCategory as $jb2Oo$DepictCategory, get_search_query_updating_blocked_signal as $jb2Oo$get_search_query_updating_blocked_signal, SearchPage as $jb2Oo$SearchPage, defaultColsAtSize as $jb2Oo$defaultColsAtSize, defaultGridSpacing as $jb2Oo$defaultGridSpacing, ProductCardError as $jb2Oo$ProductCardError, CategoryPage as $jb2Oo$CategoryPage, defaultCategoryTitlePlugin as $jb2Oo$defaultCategoryTitlePlugin, BreadCrumbs as $jb2Oo$BreadCrumbs, QuickLinks as $jb2Oo$QuickLinks, ImagePlaceholder as $jb2Oo$ImagePlaceholder, TextPlaceholder as $jb2Oo$TextPlaceholder, RecommendationSlider as $jb2Oo$RecommendationSlider, RecommendationGrid as $jb2Oo$RecommendationGrid, LooksSliderOrGrid as $jb2Oo$LooksSliderOrGrid, modalVersionSymbol as $jb2Oo$modalVersionSymbol, open_modal_with_alignment as $jb2Oo$open_modal_with_alignment, SearchField as $jb2Oo$SearchField, fetchDepictRecommendations as $jb2Oo$fetchDepictRecommendations} from "@depict-ai/ui";
3
+ import {untrack as $jb2Oo$untrack, createRoot as $jb2Oo$createRoot, createEffect as $jb2Oo$createEffect, createSignal as $jb2Oo$createSignal, createComputed as $jb2Oo$createComputed, createMemo as $jb2Oo$createMemo, onCleanup as $jb2Oo$onCleanup, getOwner as $jb2Oo$getOwner, runWithOwner as $jb2Oo$runWithOwner, on as $jb2Oo$on, mapArray as $jb2Oo$mapArray, Show as $jb2Oo$Show, createRenderEffect as $jb2Oo$createRenderEffect} from "solid-js";
4
+ import {createElement as $jb2Oo$createElement, Fragment as $jb2Oo$Fragment, useEffect as $jb2Oo$useEffect, useState as $jb2Oo$useState, useRef as $jb2Oo$useRef, forwardRef as $jb2Oo$forwardRef, Component as $jb2Oo$Component, useCallback as $jb2Oo$useCallback} from "react";
5
+ import {defaultLocale as $jb2Oo$defaultLocale} from "@depict-ai/ui/locales";
6
+ import {render as $jb2Oo$render, createComponent as $jb2Oo$createComponent, hydrate as $jb2Oo$hydrate, isServer as $jb2Oo$isServer, ssr as $jb2Oo$ssr, ssrHydrationKey as $jb2Oo$ssrHydrationKey} from "solid-js/web";
7
+ import {createStore as $jb2Oo$createStore, reconcile as $jb2Oo$reconcile} from "solid-js/store";
8
+ import {DPC as $jb2Oo$DPC} from "@depict-ai/dpc";
9
+ import {jsx as $jb2Oo$jsx} from "react/jsx-runtime";
10
+ import {createPortal as $jb2Oo$createPortal} from "react-dom";
11
+ import {renderToString as $jb2Oo$renderToString} from "react-dom/server";
12
+
13
+ /*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
14
+ // Note, if you add an export here, also add one in src-server/main.ts
15
+ const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "4.9.1";
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+ const $8c691d7f86317052$export$8e769ad4338a911e = {
28
+ usedLocale: (0, $jb2Oo$createSignal)((0, $jb2Oo$defaultLocale)),
29
+ search_instances: new Map(),
30
+ category_instances: new Map(),
31
+ api: null,
32
+ dpc: null,
33
+ merchant: (0, $jb2Oo$createSignal)(),
34
+ market: (0, $jb2Oo$createSignal)(),
35
+ sessionId: (0, $jb2Oo$createSignal)(),
36
+ known_category_paths: new Set(),
37
+ search_page_path_: (0, $jb2Oo$createSignal)(),
38
+ search_page_in_dom: (0, $jb2Oo$createSignal)(false),
39
+ category_page_in_dom: (0, $jb2Oo$createSignal)(false),
40
+ provider_is_updating: (0, $jb2Oo$createSignal)(false),
41
+ enable_content_search: (0, $jb2Oo$createSignal)(),
42
+ disable_override_listing_id: (0, $jb2Oo$createSignal)()
43
+ };
44
+
45
+
46
+
47
+
48
+
49
+
50
+ let $ac53b4e3251b31d0$var$run_on_href_change;
51
+ let $ac53b4e3251b31d0$var$old_href = location.href;
52
+ function $ac53b4e3251b31d0$export$74f3924c5027fe1d(cb) {
53
+ $ac53b4e3251b31d0$var$run_on_href_change = cb;
54
+ }
55
+ (0, $jb2Oo$instant_exec_on_suspect_history_change).add((0, $jb2Oo$catchify)(()=>{
56
+ const { href: href } = location;
57
+ if ($ac53b4e3251b31d0$var$run_on_href_change && $ac53b4e3251b31d0$var$old_href !== href) $ac53b4e3251b31d0$var$run_on_href_change(href);
58
+ $ac53b4e3251b31d0$var$old_href = href;
59
+ }));
60
+ const $ac53b4e3251b31d0$export$775e6b3892b5ad52 = function() {
61
+ let url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : location;
62
+ return url.pathname == (0, $jb2Oo$untrack)((0, $8c691d7f86317052$export$8e769ad4338a911e).search_page_path_[0]);
63
+ }; // might have changed therefore get it from globalState
64
+ const $ac53b4e3251b31d0$export$30c8a12df09be0e4 = function() {
65
+ let url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : location;
66
+ return (0, $8c691d7f86317052$export$8e769ad4338a911e).known_category_paths.has(url.pathname);
67
+ };
68
+ function $ac53b4e3251b31d0$export$f6e64e17bd69eeef(_ref) {
69
+ let { solid_component: solid_component, props: props, wrapper_type: wrapper_type = "div", wrapper_style: wrapper_style = {}, hydrate_function_when_ssr: hydrate_function_when_ssr } = _ref;
70
+ const [portals, set_portals] = (0, $jb2Oo$useState)([]);
71
+ const wrapper_element_ref = (0, $jb2Oo$useRef)();
72
+ const [[store, write_store]] = (0, $jb2Oo$useState)(()=>(0, $jb2Oo$createStore)(props));
73
+ // Update store when props change
74
+ write_store((0, $jb2Oo$reconcile)(props));
75
+ (0, $jb2Oo$useEffect)(()=>{
76
+ let gotDisposed = false;
77
+ const wrapper_element = wrapper_element_ref.current;
78
+ // If someone only rendered a solid component on the client that *could* be hydrated (no childNodes) then we fall back to `render` to avoid solid complaining about not being able to hydrate or crashing because the result of generateHydrationScript hasn't run at all
79
+ // This can happen for HMR or when SSR capable components are only rendered on the client
80
+ const render_function = hydrate_function_when_ssr && wrapper_element.childNodes.length ? hydrate_function_when_ssr : (0, $jb2Oo$render);
81
+ // Our system of suppressing hydration warnings and SSR-ing seems to generally work (all the time also in our test storefronts)
82
+ // But sometimes in prod (see https://depictaiworkspace.slack.com/archives/C061PGT2N3A/p1702038855265339) react for some reason actually sets innerHTML = ""; on our wrapper
83
+ // Deleting all our elements. To prevent that we just patch innerHTML to not do anything when being set to a new value
84
+ if (hydrate_function_when_ssr && !Object.getOwnPropertyNames(wrapper_element).includes("innerHTML")) Object.defineProperty(wrapper_element, "innerHTML", {
85
+ configurable: false,
86
+ enumerable: true,
87
+ get () {
88
+ var _Object$getOwnPropert, _Object$getOwnPropert2;
89
+ return (_Object$getOwnPropert = Object.getOwnPropertyDescriptor(Element.prototype, "innerHTML")) === null || _Object$getOwnPropert === void 0 ? void 0 : (_Object$getOwnPropert2 = _Object$getOwnPropert.get) === null || _Object$getOwnPropert2 === void 0 ? void 0 : _Object$getOwnPropert2.call(wrapper_element);
90
+ },
91
+ set () {
92
+ // Do nothing
93
+ }
94
+ });
95
+ const dispose = render_function(()=>solid_component(store, (newPortals)=>!gotDisposed && set_portals(newPortals)), wrapper_element);
96
+ return ()=>{
97
+ // Try being stupid react strict mode re-running effect proof https://legacy.reactjs.org/docs/strict-mode.html#ensuring-reusable-state
98
+ // And https://github.com/facebook/react/issues/24502
99
+ dispose();
100
+ // Nuke absolutely everything when this effect gets torn down so that we don't have any stale state or portals
101
+ gotDisposed = true;
102
+ wrapper_element.replaceChildren();
103
+ set_portals([]);
104
+ };
105
+ }, []);
106
+ return /*#__PURE__*/ (0, $jb2Oo$createElement)((0, $jb2Oo$Fragment), null, /*#__PURE__*/ (0, $jb2Oo$createElement)(wrapper_type, {
107
+ ref: wrapper_element_ref,
108
+ style: wrapper_style,
109
+ ...hydrate_function_when_ssr ? {
110
+ // We need this because on the server we put the solid SSR rendered string into html but it won't match on the client, luckily we can just suppress it
111
+ suppressHydrationWarning: true,
112
+ dangerouslySetInnerHTML: {
113
+ __html: ""
114
+ }
115
+ } : {}
116
+ }), ...portals);
117
+ }
118
+
119
+
120
+
121
+
122
+ let $64144f6d578fd8ac$var$set = false;
123
+ let $64144f6d578fd8ac$var$padding_animation;
124
+ function $64144f6d578fd8ac$export$6453cbc34515a94d() {
125
+ var _window, _window$next, _window$next$router, _window$next$router$e;
126
+ /// WARNING WARNING WARNING
127
+ // If you are debugging scroll restoration, make sure you're not in strict mode!!!!! Scroll restoration in nextjs won't work in strict mode because react will nuke all our elements from the DOM and render them again during going back
128
+ // Next 13.x+ has strict mode by default, opt out by setting reactStrictMode: false in next.config.js
129
+ const are_on_search_or_category_page = ()=>(0, $ac53b4e3251b31d0$export$775e6b3892b5ad52)() || (0, $ac53b4e3251b31d0$export$30c8a12df09be0e4)();
130
+ if ($64144f6d578fd8ac$var$set) return; // Just being safe
131
+ $64144f6d578fd8ac$var$set = true;
132
+ // We used to initialise this variable with false which in some cases (scroll to top button in FloatingButtons) would cause the scroll to be blocked when it shouldn't (see https://depictaiworkspace.slack.com/archives/C058KQ3MU8Z/p1686141321127089?thread_ts=1686134246.109689&cid=C058KQ3MU8Z)
133
+ // I don't know why we'd want to initialise it with false? The only reason I can see is in the hopes of scroll restoration working on initial page load, but it basically never does due to react rendering and executing our component too late
134
+ let should_use_old_scroll = true;
135
+ const old_scrollTo = window.scrollTo;
136
+ const next_router_event_target = $64144f6d578fd8ac$var$make_next_router_event_target(); // So we can use once: true
137
+ window.scrollTo = function() {
138
+ if (should_use_old_scroll || process.env.__NEXT_SCROLL_RESTORATION || !are_on_search_or_category_page() || history.scrollRestoration === "manual" // I.e. Chimi has manual scroll restoration that we don't want to block https://depictaiworkspace.slack.com/archives/C058KQ3MU8Z/p1686658007164019?thread_ts=1686134246.109689&cid=C058KQ3MU8Z
139
+ ) {
140
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key];
141
+ return Reflect.apply(old_scrollTo, window, args);
142
+ } else should_use_old_scroll = true;
143
+ };
144
+ // When popping state, add padding in the same event as the "popstate" event (required) and then remove it once our stuff is in the DOM
145
+ addEventListener("popstate", (0, $jb2Oo$catchify)(()=>{
146
+ if (!are_on_search_or_category_page()) {
147
+ $64144f6d578fd8ac$var$removeLotsOfPadding(); // Just making sure
148
+ return;
149
+ }
150
+ should_use_old_scroll = false;
151
+ const [get_search_page_in_dom] = (0, $8c691d7f86317052$export$8e769ad4338a911e).search_page_in_dom;
152
+ const [get_category_page_in_dom] = (0, $8c691d7f86317052$export$8e769ad4338a911e).category_page_in_dom;
153
+ const search_page_in_dom = (0, $jb2Oo$untrack)(get_search_page_in_dom);
154
+ const category_page_in_dom = (0, $jb2Oo$untrack)(get_category_page_in_dom);
155
+ const new_is_search = (0, $ac53b4e3251b31d0$export$775e6b3892b5ad52)();
156
+ const new_is_category = (0, $ac53b4e3251b31d0$export$30c8a12df09be0e4)();
157
+ let accessor_to_wait_for;
158
+ if (search_page_in_dom && new_is_search || category_page_in_dom && new_is_category) {
159
+ // Already on the page we're going to
160
+ $64144f6d578fd8ac$var$removeLotsOfPadding();
161
+ return;
162
+ }
163
+ $64144f6d578fd8ac$var$addLotsOfPadding();
164
+ if (new_is_search && category_page_in_dom) accessor_to_wait_for = get_search_page_in_dom;
165
+ else if (new_is_category && search_page_in_dom) accessor_to_wait_for = get_category_page_in_dom;
166
+ else accessor_to_wait_for = new_is_search ? get_search_page_in_dom : get_category_page_in_dom;
167
+ (0, $jb2Oo$createRoot)((dispose)=>(0, $jb2Oo$createEffect)(()=>{
168
+ if (accessor_to_wait_for()) {
169
+ $64144f6d578fd8ac$var$removeLotsOfPadding();
170
+ dispose();
171
+ }
172
+ }));
173
+ }));
174
+ (_window = window) === null || _window === void 0 || (_window$next = _window.next) === null || _window$next === void 0 || (_window$next$router = _window$next.router) === null || _window$next$router === void 0 || (_window$next$router$e = _window$next$router.events) === null || _window$next$router$e === void 0 || _window$next$router$e.on(// We have to use the actual next router here, if we'd use next_router_event_target for this window.event wouldn't be the popstate anymore
175
+ "routeChangeStart", (0, $jb2Oo$catchify)(()=>{
176
+ // this is for when we navigate to a new page (replaceState or pushState)
177
+ // We need to ensure that the page doesn't get shorter before the new history entry has been pushed
178
+ // There is beforeHistoryChange which fires literally the line of code before the history API is called, so we make the page long until a task after that
179
+ // The challenge is knowing on routeChangeStart if we're in a popstate (back/forward) or a pushState/replaceState
180
+ // We use the deprecated window.event property for that
181
+ // This is catchified, so we should see in sentry when it starts failing if browsers ever remove it???
182
+ if (window.event instanceof PopStateEvent) return;
183
+ $64144f6d578fd8ac$var$addLotsOfPadding();
184
+ next_router_event_target.addEventListener("beforeHistoryChange", (0, $jb2Oo$catchify)(()=>(0, $jb2Oo$queueMacroTask)($64144f6d578fd8ac$var$removeLotsOfPadding)), {
185
+ once: true
186
+ });
187
+ }));
188
+ }
189
+ /*
190
+ Here we want to be able to add padding that *definitely* gets applied and then be able to revert precisely to what was before.
191
+ The best way to achieve this is using an animation that with the fill set to none. This is because animations have the absolute highest precedence in CSS, even higher than !important. Then, to revert to the old padding, we just play the animation which is 1ms long so, it immediately finishes and whatever was defined before takes precedence again.
192
+ */ function $64144f6d578fd8ac$var$addLotsOfPadding() {
193
+ var _history$state, _history$state$search, _history$state$search2;
194
+ if ($64144f6d578fd8ac$var$padding_animation) return; // We're already showing a bunch of padding
195
+ $64144f6d578fd8ac$var$padding_animation = document.body.animate({
196
+ paddingBottom: (((_history$state = history.state) === null || _history$state === void 0 ? void 0 : (_history$state$search = _history$state.search_scroll_restoration_data) === null || _history$state$search === void 0 ? void 0 : (_history$state$search2 = _history$state$search[0]) === null || _history$state$search2 === void 0 ? void 0 : _history$state$search2.min_results_loaded) || 150) * 500 + "px",
197
+ offset: 0
198
+ }, 1);
199
+ $64144f6d578fd8ac$var$padding_animation.pause();
200
+ }
201
+ function $64144f6d578fd8ac$var$removeLotsOfPadding() {
202
+ if ($64144f6d578fd8ac$var$padding_animation) {
203
+ $64144f6d578fd8ac$var$padding_animation.play();
204
+ $64144f6d578fd8ac$var$padding_animation = undefined;
205
+ }
206
+ }
207
+ function $64144f6d578fd8ac$var$make_next_router_event_target() {
208
+ var _window2, _window2$next, _window2$next$router, _window2$next$router$;
209
+ const next_router_event_target = new EventTarget();
210
+ (_window2 = window) === null || _window2 === void 0 || (_window2$next = _window2.next) === null || _window2$next === void 0 || (_window2$next$router = _window2$next.router) === null || _window2$next$router === void 0 || (_window2$next$router$ = _window2$next$router.events) === null || _window2$next$router$ === void 0 || _window2$next$router$.on("beforeHistoryChange", ()=>next_router_event_target.dispatchEvent(new CustomEvent("beforeHistoryChange")));
211
+ return next_router_event_target;
212
+ }
213
+
214
+
215
+
216
+
217
+ const $7abe9e29758fa0eb$export$599d4515591ef232 = (relativeUrl, isReplace, scroll)=>{
218
+ var _window, _window$next;
219
+ if (typeof ((_window = window) === null || _window === void 0 ? void 0 : (_window$next = _window.next) === null || _window$next === void 0 ? void 0 : _window$next.router) === "undefined") throw new Error("You must provide a navigateFunction when not using Next.js.");
220
+ let Page;
221
+ (function(Page) {
222
+ Page[Page["OTHER"] = 0] = "OTHER";
223
+ Page[Page["SEARCH"] = 1] = "SEARCH";
224
+ Page[Page["CATEGORY"] = 2] = "CATEGORY";
225
+ })(Page || (Page = {}));
226
+ const current_page = (0, $ac53b4e3251b31d0$export$775e6b3892b5ad52)() ? Page.SEARCH : (0, $ac53b4e3251b31d0$export$30c8a12df09be0e4)() ? Page.CATEGORY : Page.OTHER;
227
+ const target_u_o = new URL(relativeUrl, location.origin);
228
+ const target_page = (0, $ac53b4e3251b31d0$export$775e6b3892b5ad52)(target_u_o) ? Page.SEARCH : (0, $ac53b4e3251b31d0$export$30c8a12df09be0e4)(target_u_o) ? Page.CATEGORY : Page.OTHER;
229
+ window.next.router[isReplace ? "replace" : "push"](relativeUrl, undefined, {
230
+ shallow: current_page === target_page && target_page !== Page.OTHER,
231
+ scroll: // Can't go shallowly to other pages
232
+ scroll
233
+ });
234
+ };
235
+
236
+
237
+
238
+
239
+ const $b34796f5ebe3470e$export$38b98fae14bd1f64 = ()=>{
240
+ if (!(0, $8c691d7f86317052$export$8e769ad4338a911e).dpc) throw new Error("Depict tracking is not configured. Wrap your app in a DepictProvider.");
241
+ return {
242
+ dpc: (0, $8c691d7f86317052$export$8e769ad4338a911e).dpc
243
+ };
244
+ };
245
+ const $b34796f5ebe3470e$export$47e064413edabf36 = (merchant, market, sessionId)=>{
246
+ if (!merchant) return;
247
+ try {
248
+ let { dpc: dpc } = (0, $8c691d7f86317052$export$8e769ad4338a911e);
249
+ if (!dpc) dpc = (0, $8c691d7f86317052$export$8e769ad4338a911e).dpc = new (0, $jb2Oo$DPC)(merchant, {
250
+ market: market
251
+ });
252
+ dpc.merchant = merchant;
253
+ dpc.market = market;
254
+ dpc.setSessionId(sessionId);
255
+ } catch (e) {
256
+ // Make sure to not break the users app if we throw
257
+ queueMicrotask(()=>{
258
+ throw e;
259
+ });
260
+ }
261
+ };
262
+
263
+
264
+
265
+
266
+
267
+ function $bef9f58602be2478$export$bae2769a30719c48(disposable, stateKey) {
268
+ const actual_function = (dispose)=>{
269
+ var _globalState$enableCa;
270
+ const { usedLocale: [get_locale], merchant: [get_merchant], market: [get_market], search_query_url_param_name: search_query_url_param_name, search_page_path_: [get_search_page_path], enable_content_search: [get_enable_content_search] } = (0, $8c691d7f86317052$export$8e769ad4338a911e);
271
+ const instance = new (0, $jb2Oo$DepictSearch)({
272
+ api: (0, $8c691d7f86317052$export$8e769ad4338a911e).api,
273
+ search_query_url_param_name: search_query_url_param_name,
274
+ market: (0, $jb2Oo$untrack)(get_market),
275
+ // TODO: check if we can do this
276
+ merchant: (0, $jb2Oo$untrack)(get_merchant),
277
+ enable_category_suggestions: (_globalState$enableCa = (0, $8c691d7f86317052$export$8e769ad4338a911e).enableCategorySuggestions) !== null && _globalState$enableCa !== void 0 ? _globalState$enableCa : false,
278
+ // default category suggestions to false for @depict-ai/react-ui (https://linear.app/depictai/issue/FRO-401/default-enablecategorysuggestions-to-false)
279
+ localization: (0, $jb2Oo$untrack)(get_locale),
280
+ url_transformer: (url)=>url.pathname = (0, $jb2Oo$untrack)(get_search_page_path),
281
+ on_navigation: function() {
282
+ return (0, $8c691d7f86317052$export$8e769ad4338a911e).on_navigation(...arguments);
283
+ },
284
+ // wrapping the function here since it could change
285
+ unique_instance_key_for_state: stateKey,
286
+ enable_content_search: (0, $jb2Oo$untrack)(get_enable_content_search),
287
+ searchModalComponent: (0, $8c691d7f86317052$export$8e769ad4338a911e).searchModalComponent_ || (process.env.NO_SEARCH_MODAL_DEFAULT === "true" ? undefined : (0, $383b6fd56bf151bd$re_export$SearchModalV2))
288
+ });
289
+ (0, $jb2Oo$createComputed)(()=>{
290
+ const new_merchant = get_merchant();
291
+ if (new_merchant) instance.merchant = new_merchant;
292
+ });
293
+ (0, $jb2Oo$createComputed)(()=>{
294
+ const new_market = get_market();
295
+ if (new_market) instance.market = new_market;
296
+ });
297
+ (0, $jb2Oo$createComputed)(()=>instance.localization = get_locale());
298
+ (0, $jb2Oo$createComputed)(()=>instance.enable_content_search = get_enable_content_search());
299
+ return {
300
+ instance: instance,
301
+ dispose: dispose,
302
+ users: 0
303
+ };
304
+ };
305
+ const function_length_0 = ()=>actual_function();
306
+ const function_length_1 = (dispose)=>actual_function(dispose);
307
+ return (0, $jb2Oo$createRoot)(disposable ? function_length_1 : function_length_0); // solid-js creates roots differently based on if it can detect a dispose argument, with function.length. That's why this is written like this
308
+ }
309
+
310
+
311
+
312
+
313
+
314
+ function $b1c85026e863c95b$export$248b95d5073d5bab(disposable, stateKey) {
315
+ const actual_function = (dispose)=>{
316
+ const { usedLocale: [get_locale], merchant: [get_merchant], market: [get_market], disable_override_listing_id: [get_disable_override_listing_id] } = (0, $8c691d7f86317052$export$8e769ad4338a911e);
317
+ const instance = new (0, $jb2Oo$DepictCategory)({
318
+ api: (0, $8c691d7f86317052$export$8e769ad4338a911e).api,
319
+ market: (0, $jb2Oo$untrack)(get_market),
320
+ // TODO: check if we can do this
321
+ merchant: (0, $jb2Oo$untrack)(get_merchant),
322
+ localization: (0, $jb2Oo$untrack)(get_locale),
323
+ on_navigation: function() {
324
+ return (0, $8c691d7f86317052$export$8e769ad4338a911e).on_navigation(...arguments);
325
+ },
326
+ // wrapping the function here since it could change
327
+ unique_instance_key_for_state: stateKey
328
+ });
329
+ (0, $jb2Oo$createComputed)(()=>{
330
+ const new_merchant = get_merchant();
331
+ if (new_merchant) instance.merchant = new_merchant;
332
+ });
333
+ (0, $jb2Oo$createComputed)(()=>{
334
+ const new_market = get_market();
335
+ if (new_market) instance.market = new_market;
336
+ });
337
+ (0, $jb2Oo$createComputed)(()=>instance.localization = get_locale());
338
+ (0, $jb2Oo$createComputed)(()=>instance.disable_override_listing_id = get_disable_override_listing_id());
339
+ return {
340
+ instance: instance,
341
+ dispose: dispose,
342
+ users: 0
343
+ };
344
+ };
345
+ const function_length_0 = ()=>actual_function();
346
+ const function_length_1 = (dispose)=>actual_function(dispose);
347
+ return (0, $jb2Oo$createRoot)(disposable ? function_length_1 : function_length_0); // solid-js creates roots differently based on if it can detect a dispose argument, with function.length. That's why this is written like this
348
+ }
349
+
350
+
351
+ let $18e5b9f66c7ade8e$var$provider_instances = 0;
352
+ function $18e5b9f66c7ade8e$export$9fac37a9c21c2f3b(props) {
353
+ (0, $8c691d7f86317052$export$8e769ad4338a911e).provider_is_updating[1](true);
354
+ try {
355
+ return $18e5b9f66c7ade8e$var$ActualDepictProvider(props);
356
+ } finally{
357
+ (0, $8c691d7f86317052$export$8e769ad4338a911e).provider_is_updating[1](false);
358
+ }
359
+ }
360
+ function $18e5b9f66c7ade8e$var$ActualDepictProvider(props) {
361
+ var _props$search, _props$category;
362
+ const { children: children, navigateFunction: navigateFunction, market: market, merchant: merchant, locale: locale, metaData: metaData, sessionId: sessionId } = props;
363
+ const usedLocale = locale !== null && locale !== void 0 ? locale : (0, $jb2Oo$defaultLocale);
364
+ const { searchPagePath: searchPagePath, urlParamName: urlParamName, enableCategorySuggestions: enableCategorySuggestions, enableContentSearch: enableContentSearch, searchModalComponent: searchModalComponent } = (_props$search = props.search) !== null && _props$search !== void 0 ? _props$search : {};
365
+ $18e5b9f66c7ade8e$var$multiple_depictprovider_guard();
366
+ // Will run on other prop changes, but harmless
367
+ (0, $8c691d7f86317052$export$8e769ad4338a911e).sessionId[1](sessionId);
368
+ (0, $8c691d7f86317052$export$8e769ad4338a911e).usedLocale[1](usedLocale);
369
+ (0, $8c691d7f86317052$export$8e769ad4338a911e).enable_content_search[1](enableContentSearch);
370
+ (0, $8c691d7f86317052$export$8e769ad4338a911e).metaData = metaData;
371
+ (0, $8c691d7f86317052$export$8e769ad4338a911e).search_query_url_param_name = urlParamName;
372
+ (0, $8c691d7f86317052$export$8e769ad4338a911e).enableCategorySuggestions = enableCategorySuggestions;
373
+ (0, $8c691d7f86317052$export$8e769ad4338a911e).disable_override_listing_id[1]((_props$category = props.category) === null || _props$category === void 0 ? void 0 : _props$category.disableOverrideListingId);
374
+ (0, $8c691d7f86317052$export$8e769ad4338a911e).searchModalComponent_ = searchModalComponent;
375
+ (0, $b34796f5ebe3470e$export$47e064413edabf36)(merchant, market, sessionId);
376
+ if (!market || !merchant) return (0, $jb2Oo$createElement)((0, $jb2Oo$Fragment), null, children);
377
+ (0, $8c691d7f86317052$export$8e769ad4338a911e).market[1](market);
378
+ (0, $8c691d7f86317052$export$8e769ad4338a911e).merchant[1](merchant);
379
+ (0, $64144f6d578fd8ac$export$6453cbc34515a94d)();
380
+ try {
381
+ const { search_instances: search_instances, category_instances: category_instances, search_page_path_: [, set_search_page_path] } = (0, $8c691d7f86317052$export$8e769ad4338a911e);
382
+ const on_navigation = (_ref)=>{
383
+ let { is_replace: is_replace, new_url: new_url, scroll: scroll } = _ref;
384
+ const new_relative_url = new_url.origin === location.origin ? new_url.pathname + new_url.search + new_url.hash : new_url.href; // bail out of making URL relative if it's not possible
385
+ if (navigateFunction) navigateFunction(new_relative_url, {
386
+ replace: is_replace,
387
+ scroll: scroll
388
+ });
389
+ else (0, $7abe9e29758fa0eb$export$599d4515591ef232)(new_relative_url, is_replace, scroll);
390
+ };
391
+ (0, $8c691d7f86317052$export$8e769ad4338a911e).on_navigation = on_navigation;
392
+ (0, $8c691d7f86317052$export$8e769ad4338a911e).api || ((0, $8c691d7f86317052$export$8e769ad4338a911e).api = new (0, $jb2Oo$DepictAPI)({
393
+ get_metadata: async ()=>(0, $8c691d7f86317052$export$8e769ad4338a911e).metaData,
394
+ get_session_id: ()=>(0, $jb2Oo$untrack)((0, $8c691d7f86317052$export$8e769ad4338a911e).sessionId[0])
395
+ }));
396
+ (0, $8c691d7f86317052$export$8e769ad4338a911e).api.display_transformers = props.displayTransformers;
397
+ if (searchPagePath) set_search_page_path($18e5b9f66c7ade8e$var$ensure_correct_formatting(searchPagePath));
398
+ if (!search_instances.get(undefined)) {
399
+ // Create initial search instance which always exists. It i.e. gards against the state getting deleted from history.state by someone pushing to it with an empty object, which commonly people copy from code snippets.
400
+ // Also, it emulates the behavior pre-supporting multiple "depict blocks" on the same page
401
+ const instance = (0, $bef9f58602be2478$export$bae2769a30719c48)(false);
402
+ search_instances.set(undefined, instance);
403
+ }
404
+ if (!category_instances.get(undefined)) {
405
+ const instance = (0, $b1c85026e863c95b$export$248b95d5073d5bab)(false);
406
+ category_instances.set(undefined, instance);
407
+ }
408
+ } catch (e) {
409
+ // Make sure to not break the users app if we throw
410
+ queueMicrotask(()=>{
411
+ throw e;
412
+ });
413
+ }
414
+ return (0, $jb2Oo$createElement)((0, $jb2Oo$Fragment), null, children);
415
+ }
416
+ function $18e5b9f66c7ade8e$var$ensure_correct_formatting(path) {
417
+ // Make sure the path starts with a slash as it always will and is_page will fail otherwise
418
+ if (!path.startsWith("/")) return "/" + path;
419
+ return path;
420
+ }
421
+ function $18e5b9f66c7ade8e$var$multiple_depictprovider_guard() {
422
+ (0, $jb2Oo$useEffect)(()=>{
423
+ $18e5b9f66c7ade8e$var$provider_instances++;
424
+ if ($18e5b9f66c7ade8e$var$provider_instances > 1) throw new Error("You are using multiple DepictProviders. This is not supported and will lead to unexpected behavior. You can create multiple SearchPage and CategoryPage components, but only one DepictProvider.");
425
+ return ()=>{
426
+ $18e5b9f66c7ade8e$var$provider_instances--;
427
+ };
428
+ }, []);
429
+ }
430
+
431
+
432
+
433
+ const $f6a205a95e4fdee3$export$80e99ee6b29cadd2 = /*#__PURE__*/ (0, $jb2Oo$forwardRef)((_, ref)=>{
434
+ return /*#__PURE__*/ (0, $jb2Oo$createElement)("div", {
435
+ className: "depict aligner",
436
+ style: {
437
+ height: "100%"
438
+ },
439
+ ref: ref
440
+ });
441
+ });
442
+
443
+
444
+
445
+
446
+
447
+
448
+
449
+
450
+
451
+
452
+
453
+
454
+ function $fda7a7820477f957$export$f4d89133c6985668(type, stateKey, componentName) {
455
+ const instances = (0, $8c691d7f86317052$export$8e769ad4338a911e)[type + "_instances"];
456
+ if (!instances.get(undefined)) throw Error("".concat(componentName, ": State not set up. Did you forget to wrap your app in DepictProvider? Also make sure you've provided a merchant and a market."));
457
+ let instance = instances.get(stateKey);
458
+ if (!instance) {
459
+ instance = type === "search" ? (0, $bef9f58602be2478$export$bae2769a30719c48)(true, stateKey) : (0, $b1c85026e863c95b$export$248b95d5073d5bab)(true, stateKey);
460
+ instances.set(stateKey, instance);
461
+ }
462
+ instance.users++;
463
+ (0, $jb2Oo$onCleanup)(()=>{
464
+ var _instance;
465
+ instance.users--;
466
+ if (!instance.users && (_instance = instance) !== null && _instance !== void 0 && _instance.dispose) {
467
+ // main instance is not disposable, and shouldn't be deletable either
468
+ instance.dispose();
469
+ instances.delete(stateKey);
470
+ }
471
+ });
472
+ return instance.instance;
473
+ }
474
+
475
+
476
+
477
+
478
+
479
+
480
+ class $88d93ed7309e90d1$export$d0f82e3ef89b1f22 extends (0, $jb2Oo$Component) {
481
+ constructor(props){
482
+ super(props);
483
+ this.state = {
484
+ hasError: false
485
+ };
486
+ }
487
+ static getDerivedStateFromError() {
488
+ // Update state so the next render will show the fallback UI.
489
+ return {
490
+ hasError: true
491
+ };
492
+ }
493
+ componentDidCatch(error) {
494
+ this.props.on_error(error);
495
+ }
496
+ render() {
497
+ if (this.state.hasError) // You can render any custom fallback UI
498
+ return (0, $jb2Oo$createElement)("div", {
499
+ children: "Component failed"
500
+ });
501
+ return this.props.children;
502
+ }
503
+ }
504
+
505
+
506
+
507
+
508
+ async function $cce08f18e2476cbf$export$32024253978abdc7(_ref) {
509
+ let { component_props: component_props, component_portals: component_portals, set_portals: set_portals, get_react_template: get_react_template, set_on_index_change_: set_on_index_change_ } = _ref;
510
+ let set_react_has_ran_hooks;
511
+ let was_cleaned_up = false;
512
+ const react_has_ran_hooks = new Promise((r)=>set_react_has_ran_hooks = r);
513
+ const solid_container = document.createElement("div");
514
+ const [setIndexFunctionAccessor, setIndexFunctionSetter] = (0, $jb2Oo$createSignal)();
515
+ let call_when_template_changes;
516
+ const owner = (0, $jb2Oo$getOwner)();
517
+ const reactProductCard = (0, $jb2Oo$jsx)((props)=>{
518
+ // Sneak in a hook into their product card component to know once react has finished rendering and running hooks
519
+ (0, $jb2Oo$useEffect)(set_react_has_ran_hooks, []);
520
+ const [react_template, set_react_template] = (0, $jb2Oo$useState)(()=>(0, $jb2Oo$untrack)(get_react_template));
521
+ const [index, setIndex] = (0, $jb2Oo$useState)(0);
522
+ setIndexFunctionSetter(()=>setIndex);
523
+ call_when_template_changes = set_react_template;
524
+ return react_template(set_on_index_change_ ? {
525
+ ...props,
526
+ index: index
527
+ } : props);
528
+ }, component_props);
529
+ const reactProductCardInErrorBoundary = (0, $jb2Oo$jsx)((0, $88d93ed7309e90d1$export$d0f82e3ef89b1f22), {
530
+ children: reactProductCard,
531
+ on_error: (error)=>(0, $jb2Oo$runWithOwner)(owner, ()=>{
532
+ if (was_cleaned_up) return; // Would infinite loop if we'd throw after we've already been cleaned up. That is because the `ErrorBoundary` won't be "registered" with the cleaned-up owner anymore so react would hear about the throw and attempt to re-render the error boundary or something which would throw again, etc.
533
+ throw new (0, $jb2Oo$ProductCardError)(error);
534
+ })
535
+ });
536
+ const portal = $jb2Oo$createPortal(reactProductCardInErrorBoundary, solid_container);
537
+ component_portals.add(portal);
538
+ set_portals([
539
+ ...component_portals
540
+ ]);
541
+ set_on_index_change_ === null || set_on_index_change_ === void 0 || set_on_index_change_((newIndex)=>{
542
+ var _setIndexFunctionAcce;
543
+ return (_setIndexFunctionAcce = setIndexFunctionAccessor()) === null || _setIndexFunctionAcce === void 0 ? void 0 : _setIndexFunctionAcce(newIndex);
544
+ });
545
+ (0, $jb2Oo$createEffect)((0, $jb2Oo$on)(get_react_template, (new_template)=>queueMicrotask(()=>{
546
+ var _call_when_template_c;
547
+ return(// if we update the state inside the portal synchronously from the parent call react gets confused with "Warning: Cannot update a component (`Unknown`) while rendering a different component (`$48d7f568740a317d$export$f7d2f673fc2f091d`). To locate the bad setState() call inside `$48d7f568740a317d$export$f7d2f673fc2f091d`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render"
548
+ // Therefore do it after a microtask to evade detection
549
+ (_call_when_template_c = call_when_template_changes) === null || _call_when_template_c === void 0 ? void 0 : _call_when_template_c(()=>new_template));
550
+ }), {
551
+ defer: true
552
+ })); // If we get a new template. call the useState hook thing so we correctly re-execute with the new template
553
+ (0, $jb2Oo$onCleanup)(()=>{
554
+ was_cleaned_up = true;
555
+ // this will stop working after any await so be careful to not await before this, or you'll have to carry the owner over with getOwner and runWithOwner
556
+ component_portals.delete(portal);
557
+ // Updating i.e. the merchant will cause a setState call while rendering the DepictProvider component which is illegal because it usually infinite loops react apps. In our case it doesn't though, so we just evade detection by doing it a microtask later. See also https://github.com/facebook/react/issues/18178#issuecomment-595846312
558
+ queueMicrotask(()=>set_portals([
559
+ ...component_portals
560
+ ]));
561
+ });
562
+ await react_has_ran_hooks; // After React has created elements it still takes some time to actually connect the refs and run the hooks. We don't want to replace placeholders before then.
563
+ return [
564
+ solid_container
565
+ ];
566
+ }
567
+
568
+
569
+
570
+
571
+ function $0565aab3357d32e9$export$84601d922bd37be1(blocks, component_portals, set_portals) {
572
+ // This will re-render everything if a block moves around but the alternative is that we re-render every time any state that has been used in the content blocks changes which is worse
573
+ return (0, $jb2Oo$mapArray)(blocks, (block)=>{
574
+ if (!block) return block;
575
+ return {
576
+ get span_columns () {
577
+ return block === null || block === void 0 ? void 0 : block.spanColumns;
578
+ },
579
+ get span_rows () {
580
+ return block === null || block === void 0 ? void 0 : block.spanRows;
581
+ },
582
+ get position () {
583
+ return block === null || block === void 0 ? void 0 : block.position;
584
+ },
585
+ content: ()=>(0, $cce08f18e2476cbf$export$32024253978abdc7)({
586
+ get_react_template: ()=>block.content,
587
+ component_portals: component_portals,
588
+ set_portals: set_portals,
589
+ component_props: {}
590
+ })
591
+ };
592
+ });
593
+ }
594
+
595
+
596
+
597
+
598
+
599
+ function $7d10b4c67928d97f$export$eb5844afe948564b(props) {
600
+ const default_is_set = (0, $jb2Oo$createMemo)(()=>{
601
+ var _globalState$usedLoca;
602
+ return !!((0, $8c691d7f86317052$export$8e769ad4338a911e).merchant[0]() && (0, $8c691d7f86317052$export$8e769ad4338a911e).market[0]() && (_globalState$usedLoca = (0, $8c691d7f86317052$export$8e769ad4338a911e).usedLocale[0]()) !== null && _globalState$usedLoca !== void 0 && _globalState$usedLoca.backend_locale_);
603
+ });
604
+ const should_show = (0, $jb2Oo$createMemo)((prev)=>{
605
+ if (!prev && (0, $8c691d7f86317052$export$8e769ad4338a911e).provider_is_updating[0]()) // Why `!prev`? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/7854#note_1495776987
606
+ // If we weren't showing the component and the DepictProvider is currently updating, wait for it to have finished updating before showing the component
607
+ // Otherwise as soon as tenant and market is set we render the CategoryPage, but we might not have a DepictCategory yet, see https://depictaiworkspace.slack.com/archives/C04UZ2Z0RNE/p1690895918347289?thread_ts=1688391305.529449&cid=C04UZ2Z0RNE
608
+ return false;
609
+ return (props.isSet || default_is_set)();
610
+ });
611
+ return (0, $jb2Oo$createComponent)((0, $jb2Oo$Show), {
612
+ get when () {
613
+ return should_show();
614
+ },
615
+ get children () {
616
+ return props.children;
617
+ }
618
+ });
619
+ }
620
+
621
+
622
+ const $f33e2dee70c97da3$var$rendered_components_with_state_key = new Set();
623
+ function $f33e2dee70c97da3$export$a54ec244c8863715(props) {
624
+ return (0, $ac53b4e3251b31d0$export$f6e64e17bd69eeef)({
625
+ solid_component: function() {
626
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key];
627
+ // Work around some kind of babel bug where an optimisation turns ...args into `arguments` in the ES10 build which becomes the wrong arguments when read from teh getter
628
+ const ourArguments = args;
629
+ return (0, $jb2Oo$createComponent)((0, $7d10b4c67928d97f$export$eb5844afe948564b), {
630
+ get children () {
631
+ return $f33e2dee70c97da3$var$SolidSearchPage(...ourArguments);
632
+ }
633
+ });
634
+ },
635
+ props: props
636
+ });
637
+ }
638
+ function $f33e2dee70c97da3$var$SolidSearchPage(props, set_portals) {
639
+ const depict_search = (0, $jb2Oo$createMemo)(()=>{
640
+ const instance = (0, $fda7a7820477f957$export$f4d89133c6985668)("search", props.stateKey, "SearchPage");
641
+ (0, $jb2Oo$onCleanup)(()=>{
642
+ var _get_search_query_upd;
643
+ // Make sure we don't block the search query updating signal when we switch to a new provider instance
644
+ (_get_search_query_upd = (0, $jb2Oo$get_search_query_updating_blocked_signal)(instance)) === null || _get_search_query_upd === void 0 || _get_search_query_upd[1](false);
645
+ });
646
+ return instance;
647
+ });
648
+ const update_updating_blocked_signal = ()=>{
649
+ // if search instances changes, also re-check for good measure (otherwise would have untrack around depict_search)
650
+ const signal = (0, $jb2Oo$get_search_query_updating_blocked_signal)(depict_search());
651
+ if (!signal) throw Error("No search_query_updating_blocked_signal when rendering SearchPage");
652
+ const [, write_signal] = signal;
653
+ // This causes a bug. To reproduce:
654
+ // 1. Go to front page
655
+ // 2. Make a search
656
+ // 3. Press back button
657
+ // 4. Open search modal
658
+ // 5. Check the list of previous queries - the query just made isn't shown
659
+ // This is because on the front page the search_query updating is blocked because it's not the search page, and that means that `filtered_previous_searches` in Autocomplete.tsx doesn't filter out the current search query
660
+ // Because it's so minor and would be quite hard to fix (one would need a second "actual search query" signal just for this purpose) it's wontfix for now
661
+ // EDIT: now that we're resetting this in the onCleanup of the memo above this might no longer be the case
662
+ write_signal(!(0, $ac53b4e3251b31d0$export$775e6b3892b5ad52)(location));
663
+ };
664
+ const [, set_search_page_in_dom] = (0, $8c691d7f86317052$export$8e769ad4338a911e).search_page_in_dom;
665
+ const component_portals = new Set();
666
+ // We should only get here once react already has a DOM node which means we should be in the DOM
667
+ set_search_page_in_dom(true);
668
+ (0, $jb2Oo$onCleanup)(()=>set_search_page_in_dom(false));
669
+ // react is really slow with disposing components, we want to avoid a flash of another search query when you click on a product and navigate away
670
+ (0, $ac53b4e3251b31d0$export$74f3924c5027fe1d)(update_updating_blocked_signal); // if we navigate, re-check
671
+ (0, $jb2Oo$createComputed)(()=>{
672
+ (0, $8c691d7f86317052$export$8e769ad4338a911e).search_page_path_[0](); // if react defined path changes, re-check
673
+ update_updating_blocked_signal();
674
+ });
675
+ $f33e2dee70c97da3$var$search_page_path_checker();
676
+ return (0, $jb2Oo$createMemo)(()=>{
677
+ const stateKey = (0, $jb2Oo$untrack)(()=>props.stateKey);
678
+ if ($f33e2dee70c97da3$var$rendered_components_with_state_key.has(stateKey)) throw new Error("You have multiple SearchPage components with the same stateKey: ".concat(stateKey, ". Each SearchPage component must have a unique stateKey."));
679
+ const transformed_content_blocks = (0, $0565aab3357d32e9$export$84601d922bd37be1)(()=>props.contentBlocksByRow, component_portals, set_portals);
680
+ $f33e2dee70c97da3$var$rendered_components_with_state_key.add(stateKey);
681
+ (0, $jb2Oo$onCleanup)(()=>$f33e2dee70c97da3$var$rendered_components_with_state_key.delete(stateKey));
682
+ return (0, $jb2Oo$SearchPage)({
683
+ // Default config goes here
684
+ get include_input_field () {
685
+ return props.includeInputField;
686
+ },
687
+ get cols_at_size () {
688
+ var _props$columnsAtSize;
689
+ return (_props$columnsAtSize = props.columnsAtSize) !== null && _props$columnsAtSize !== void 0 ? _props$columnsAtSize : (0, $jb2Oo$defaultColsAtSize);
690
+ },
691
+ get grid_spacing () {
692
+ var _props$gridSpacing;
693
+ return (_props$gridSpacing = props.gridSpacing) !== null && _props$gridSpacing !== void 0 ? _props$gridSpacing : (0, $jb2Oo$defaultGridSpacing);
694
+ },
695
+ depict_search: depict_search(),
696
+ product_card_template: (display, info)=>(0, $cce08f18e2476cbf$export$32024253978abdc7)({
697
+ component_props: {
698
+ display: display
699
+ },
700
+ get_react_template: ()=>props.productCard,
701
+ component_portals: component_portals,
702
+ set_portals: set_portals,
703
+ set_on_index_change_: info === null || info === void 0 ? void 0 : info.set_on_index_change
704
+ }),
705
+ get content_blocks_by_row () {
706
+ return transformed_content_blocks();
707
+ }
708
+ });
709
+ });
710
+ }
711
+ /**
712
+ * Users often set the searchPagePath to something without the market which breaks everything using the searchPagePath internally, notably refining the search query. Add a warning for them.
713
+ */ function $f33e2dee70c97da3$var$search_page_path_checker() {
714
+ let has_warned = false;
715
+ (0, $jb2Oo$createEffect)(()=>{
716
+ if (has_warned) return;
717
+ const should_be_path = (0, $8c691d7f86317052$export$8e769ad4338a911e).search_page_path_[0]();
718
+ const { pathname: pathname } = location;
719
+ if (// allow some variability just to be sure
720
+ should_be_path !== pathname && should_be_path + "/" !== pathname && should_be_path !== pathname + "/") {
721
+ (0, $jb2Oo$derror)("searchPagePath is set to", should_be_path, "but the SearchPage is rendered at", pathname, ". Please double-check your searchPagePath is where the SearchPage component ends up being rendered, after all redirects, unless you're sure this is intentional.");
722
+ has_warned = true;
723
+ }
724
+ });
725
+ }
726
+
727
+
728
+
729
+
730
+
731
+
732
+
733
+
734
+
735
+
736
+
737
+ const $710dda89475e8c05$var$rendered_components_with_state_key = new Set();
738
+ function $710dda89475e8c05$export$f7d2f673fc2f091d(props) {
739
+ return (0, $ac53b4e3251b31d0$export$f6e64e17bd69eeef)({
740
+ // @ts-ignore
741
+ solid_component: function() {
742
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key];
743
+ // Work around some kind of babel bug where an optimisation turns ...args into `arguments` in the ES10 build which becomes the wrong arguments when read from teh getter
744
+ const ourArguments = args;
745
+ return (0, $jb2Oo$createComponent)((0, $7d10b4c67928d97f$export$eb5844afe948564b), {
746
+ get children () {
747
+ return $710dda89475e8c05$var$SolidCategoryPage(...ourArguments);
748
+ }
749
+ });
750
+ },
751
+ props: props,
752
+ wrapper_type: "div",
753
+ wrapper_style: {}
754
+ });
755
+ }
756
+ function $710dda89475e8c05$var$SolidCategoryPage(props, set_portals) {
757
+ const depict_category = (0, $jb2Oo$createMemo)(()=>(0, $fda7a7820477f957$export$f4d89133c6985668)("category", props.stateKey, "CategoryPage") // stateKey can change
758
+ );
759
+ const [category_state_set, set_category_state_set] = (0, $jb2Oo$createSignal)(false);
760
+ const component_portals = new Set();
761
+ const [, set_category_page_in_dom] = (0, $8c691d7f86317052$export$8e769ad4338a911e).category_page_in_dom;
762
+ // We should only get here once react already has a DOM node which means we should be in the DOM
763
+ set_category_page_in_dom(true);
764
+ (0, $jb2Oo$onCleanup)(()=>set_category_page_in_dom(false));
765
+ (0, $jb2Oo$createComputed)(()=>{
766
+ const { listingQuery: listingQuery } = props;
767
+ // listingQuery is a store, but we want to just set it as a normal object whose reference changes when the store changes
768
+ depict_category().listing_query = {
769
+ ...listingQuery
770
+ };
771
+ if (listingQuery !== null && listingQuery !== void 0 && listingQuery.id && listingQuery !== null && listingQuery !== void 0 && listingQuery.type) {
772
+ set_category_state_set(true);
773
+ (0, $8c691d7f86317052$export$8e769ad4338a911e).known_category_paths.add(location.pathname);
774
+ }
775
+ });
776
+ const Category = ()=>(0, $jb2Oo$createMemo)(()=>{
777
+ const stateKey = (0, $jb2Oo$untrack)(()=>props.stateKey);
778
+ if ($710dda89475e8c05$var$rendered_components_with_state_key.has(stateKey)) throw new Error("You have multiple CategoryPage components with the same stateKey: ".concat(stateKey, ". Each CategoryPage component must have a unique stateKey."));
779
+ $710dda89475e8c05$var$rendered_components_with_state_key.add(stateKey);
780
+ (0, $jb2Oo$onCleanup)(()=>$710dda89475e8c05$var$rendered_components_with_state_key.delete(stateKey));
781
+ const transformed_content_blocks = (0, $0565aab3357d32e9$export$84601d922bd37be1)(()=>props.contentBlocksByRow, component_portals, set_portals);
782
+ return (0, $jb2Oo$CategoryPage)({
783
+ depict_category: depict_category(),
784
+ get cols_at_size () {
785
+ var _props$columnsAtSize;
786
+ return (_props$columnsAtSize = props.columnsAtSize) !== null && _props$columnsAtSize !== void 0 ? _props$columnsAtSize : (0, $jb2Oo$defaultColsAtSize);
787
+ },
788
+ get grid_spacing () {
789
+ var _props$gridSpacing;
790
+ return (_props$gridSpacing = props.gridSpacing) !== null && _props$gridSpacing !== void 0 ? _props$gridSpacing : (0, $jb2Oo$defaultGridSpacing);
791
+ },
792
+ category_title: (0, $jb2Oo$untrack)(()=>props.categoryTitlePlugin) || (0, $jb2Oo$defaultCategoryTitlePlugin),
793
+ get show_breadcrumbs () {
794
+ return props.showBreadcrumbs;
795
+ },
796
+ get show_quicklinks () {
797
+ return props.showQuicklinks;
798
+ },
799
+ get content_blocks_by_row () {
800
+ // Having content blocks and a slider at the same time is not supported, so we have to actually forward undefined if none are specified
801
+ if (!props.contentBlocksByRow) return undefined;
802
+ return transformed_content_blocks();
803
+ },
804
+ get layout () {
805
+ return props.layout;
806
+ },
807
+ product_card_template: (display, info)=>(0, $cce08f18e2476cbf$export$32024253978abdc7)({
808
+ component_props: {
809
+ display: display
810
+ },
811
+ get_react_template: ()=>props.productCard,
812
+ component_portals: component_portals,
813
+ set_portals: set_portals,
814
+ set_on_index_change_: info === null || info === void 0 ? void 0 : info.set_on_index_change
815
+ })
816
+ });
817
+ });
818
+ return (0, $jb2Oo$createComponent)((0, $7d10b4c67928d97f$export$eb5844afe948564b), {
819
+ isSet: category_state_set,
820
+ get children () {
821
+ return (0, $jb2Oo$createComponent)(Category, {});
822
+ }
823
+ });
824
+ }
825
+
826
+
827
+
828
+
829
+
830
+
831
+
832
+
833
+ function $ec632214ac078e79$export$5646050d516e06bc(react_props) {
834
+ return (0, $ac53b4e3251b31d0$export$f6e64e17bd69eeef)({
835
+ solid_component: (solidProps)=>(0, $jb2Oo$createComponent)((0, $7d10b4c67928d97f$export$eb5844afe948564b), {
836
+ get children () {
837
+ return (0, $jb2Oo$createComponent)($ec632214ac078e79$var$VanillaBreadcrumbs, solidProps);
838
+ }
839
+ }),
840
+ props: react_props
841
+ });
842
+ }
843
+ function $ec632214ac078e79$var$VanillaBreadcrumbs(props) {
844
+ // memo so stateKey can be dynamically changed
845
+ return (0, $jb2Oo$createMemo)(()=>{
846
+ const depict_category = (0, $fda7a7820477f957$export$f4d89133c6985668)("category", props.stateKey, "BreadCrumbs");
847
+ return (0, $jb2Oo$BreadCrumbs)({
848
+ depict_category: depict_category
849
+ });
850
+ });
851
+ }
852
+
853
+
854
+
855
+
856
+
857
+
858
+
859
+
860
+ function $c61814cfb91ead09$export$466cdc317043f6cb() {
861
+ let react_props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
862
+ return (0, $ac53b4e3251b31d0$export$f6e64e17bd69eeef)({
863
+ solid_component: (solidProps)=>(0, $jb2Oo$createComponent)((0, $7d10b4c67928d97f$export$eb5844afe948564b), {
864
+ get children () {
865
+ return (0, $jb2Oo$createComponent)($c61814cfb91ead09$var$VanillaQuickLinks, solidProps);
866
+ }
867
+ }),
868
+ props: react_props
869
+ });
870
+ }
871
+ function $c61814cfb91ead09$var$VanillaQuickLinks(props) {
872
+ // memo so stateKey can be dynamically changed
873
+ return (0, $jb2Oo$createMemo)(()=>{
874
+ const depict_category = (0, $fda7a7820477f957$export$f4d89133c6985668)("category", props.stateKey, "QuickLinks");
875
+ return (0, $jb2Oo$QuickLinks)({
876
+ depict_category: depict_category
877
+ });
878
+ });
879
+ }
880
+
881
+
882
+
883
+
884
+
885
+ const $6406849926c3f794$export$3f37af283f8fb843 = (raw_react_props)=>{
886
+ const react_props = {
887
+ class: raw_react_props.className,
888
+ ...raw_react_props
889
+ };
890
+ return (0, $ac53b4e3251b31d0$export$f6e64e17bd69eeef)({
891
+ solid_component: (props_store)=>(0, $jb2Oo$ImagePlaceholder)(props_store),
892
+ props: react_props,
893
+ wrapper_type: "span",
894
+ hydrate_function_when_ssr: (0, $jb2Oo$hydrate)
895
+ });
896
+ };
897
+
898
+
899
+
900
+
901
+
902
+ const $2c7738b65cbcac1c$export$89c6019e4baa40b1 = (raw_react_props)=>{
903
+ const react_props = {
904
+ class: raw_react_props.className,
905
+ ...raw_react_props
906
+ };
907
+ return (0, $ac53b4e3251b31d0$export$f6e64e17bd69eeef)({
908
+ solid_component: (props_store)=>(0, $jb2Oo$TextPlaceholder)(props_store),
909
+ props: react_props,
910
+ wrapper_type: "span",
911
+ hydrate_function_when_ssr: (0, $jb2Oo$hydrate),
912
+ wrapper_style: {
913
+ "height": "100%"
914
+ }
915
+ });
916
+ };
917
+
918
+
919
+
920
+
921
+
922
+ // Triggered by synsam trying to put null here and typescript somehow not complaining
923
+
924
+ function $758339150fbfe9d5$export$4daadad26e48a2c7(props) {
925
+ var _props$recommendation;
926
+ const us = "RecommendationSlider/RecommendationGrid:";
927
+ if (typeof (props === null || props === void 0 ? void 0 : (_props$recommendation = props.recommendations) === null || _props$recommendation === void 0 ? void 0 : _props$recommendation.then) !== "function") {
928
+ (0, $jb2Oo$dwarn)(us, "Got", props.recommendations, "which is not thenable");
929
+ throw new Error(us + " props.recommendations needs to be a promise that is either unresolved (`new Promise(() => {})`) so we can show placeholders, or resolved (`Promise.resolve(recommendation_array)`) to the recommendations to show");
930
+ }
931
+ }
932
+
933
+
934
+ function $c02e9fd51f31a1bd$export$82cfdc85a4d15688(props) {
935
+ (0, $758339150fbfe9d5$export$4daadad26e48a2c7)(props);
936
+ return (0, $ac53b4e3251b31d0$export$f6e64e17bd69eeef)({
937
+ solid_component: $c02e9fd51f31a1bd$export$5abb40edfde2a843,
938
+ props: props
939
+ });
940
+ }
941
+ function $c02e9fd51f31a1bd$export$5abb40edfde2a843(props, set_portals) {
942
+ const component_portals = new Set();
943
+ return (0, $jb2Oo$RecommendationSlider)({
944
+ get recommendations () {
945
+ return props.recommendations;
946
+ },
947
+ product_card_template: (display, info)=>(0, $cce08f18e2476cbf$export$32024253978abdc7)({
948
+ component_props: {
949
+ display: display
950
+ },
951
+ get_react_template: ()=>props.productCard,
952
+ component_portals: component_portals,
953
+ set_portals: set_portals,
954
+ set_on_index_change_: info === null || info === void 0 ? void 0 : info.set_on_index_change
955
+ }),
956
+ get cols_at_size () {
957
+ return props.columnsAtSize || (0, $jb2Oo$defaultColsAtSize);
958
+ },
959
+ get grid_spacing () {
960
+ var _props$gridSpacing;
961
+ return (_props$gridSpacing = props.gridSpacing) !== null && _props$gridSpacing !== void 0 ? _props$gridSpacing : (0, $jb2Oo$defaultGridSpacing);
962
+ },
963
+ get title () {
964
+ return props.title;
965
+ }
966
+ });
967
+ }
968
+
969
+
970
+
971
+
972
+
973
+
974
+
975
+
976
+ function $cd68097a7ee08669$export$e46079a2793e9ec7(props, set_portals) {
977
+ const component_portals = new Set();
978
+ return (0, $jb2Oo$RecommendationGrid)({
979
+ get recommendations () {
980
+ return props.recommendations;
981
+ },
982
+ product_card_template: (display, info)=>{
983
+ if (0, $jb2Oo$isServer) {
984
+ // This function can't be async on the server
985
+ // @ts-ignore emulate the wrapper div that we need in prod here too for consistency
986
+ const reactRetVal = (0, $jb2Oo$renderToString)((0, $jb2Oo$createElement)(()=>props.productCard({
987
+ display: display
988
+ })));
989
+ return (0, $jb2Oo$ssr)([
990
+ "<div",
991
+ ">",
992
+ "</div>"
993
+ ], (0, $jb2Oo$ssrHydrationKey)(), reactRetVal);
994
+ }
995
+ return (0, $cce08f18e2476cbf$export$32024253978abdc7)({
996
+ component_props: {
997
+ display: display
998
+ },
999
+ get_react_template: ()=>props.productCard,
1000
+ component_portals: component_portals,
1001
+ set_portals: set_portals,
1002
+ set_on_index_change_: info === null || info === void 0 ? void 0 : info.set_on_index_change
1003
+ });
1004
+ },
1005
+ get cols_at_size () {
1006
+ return props.columnsAtSize || (0, $jb2Oo$defaultColsAtSize);
1007
+ },
1008
+ get grid_spacing () {
1009
+ var _props$gridSpacing;
1010
+ return (_props$gridSpacing = props.gridSpacing) !== null && _props$gridSpacing !== void 0 ? _props$gridSpacing : (0, $jb2Oo$defaultGridSpacing);
1011
+ },
1012
+ get max_rows () {
1013
+ return props.maxRows;
1014
+ },
1015
+ get title () {
1016
+ return props.title;
1017
+ },
1018
+ get view_more_button () {
1019
+ var _viewMoreButton$start;
1020
+ const { viewMoreButton: viewMoreButton } = props;
1021
+ return viewMoreButton ? {
1022
+ text: viewMoreButton.text,
1023
+ start_rows: (_viewMoreButton$start = viewMoreButton.startRows) !== null && _viewMoreButton$start !== void 0 ? _viewMoreButton$start : 2,
1024
+ rows_per_click: viewMoreButton.rowsPerClick
1025
+ } : undefined;
1026
+ }
1027
+ });
1028
+ }
1029
+
1030
+
1031
+
1032
+
1033
+ function $31abef71c0a2d3fc$export$b0a773486c1c2312(props) {
1034
+ (0, $758339150fbfe9d5$export$4daadad26e48a2c7)(props);
1035
+ return (0, $ac53b4e3251b31d0$export$f6e64e17bd69eeef)({
1036
+ solid_component: (0, $cd68097a7ee08669$export$e46079a2793e9ec7),
1037
+ props: props,
1038
+ hydrate_function_when_ssr: (0, $jb2Oo$hydrate),
1039
+ wrapper_type: "section"
1040
+ });
1041
+ }
1042
+
1043
+
1044
+
1045
+
1046
+
1047
+
1048
+
1049
+ function $42a99d61b8f0a22c$export$ee471bde82ce7cf7(props) {
1050
+ return (0, $ac53b4e3251b31d0$export$f6e64e17bd69eeef)({
1051
+ solid_component: (props)=>(0, $jb2Oo$createComponent)((0, $7d10b4c67928d97f$export$eb5844afe948564b), {
1052
+ get children () {
1053
+ return (0, $jb2Oo$createComponent)($42a99d61b8f0a22c$export$5afe1596ca0120c7, props);
1054
+ }
1055
+ }),
1056
+ props: props
1057
+ });
1058
+ }
1059
+ function $42a99d61b8f0a22c$export$5afe1596ca0120c7(props) {
1060
+ const { merchant: [merchant], market: [market], usedLocale: [locale], on_navigation: on_navigation } = (0, $8c691d7f86317052$export$8e769ad4338a911e);
1061
+ return (0, $jb2Oo$LooksSliderOrGrid)({
1062
+ get gridSpacing_ () {
1063
+ var _props$gridSpacing;
1064
+ return (_props$gridSpacing = props.gridSpacing) !== null && _props$gridSpacing !== void 0 ? _props$gridSpacing : (0, $jb2Oo$defaultGridSpacing);
1065
+ },
1066
+ get columnsAtSize_ () {
1067
+ var _props$columnsAtSize;
1068
+ return (_props$columnsAtSize = props.columnsAtSize) !== null && _props$columnsAtSize !== void 0 ? _props$columnsAtSize : (0, $jb2Oo$defaultColsAtSize);
1069
+ },
1070
+ get productId_ () {
1071
+ return props.productId;
1072
+ },
1073
+ get imagePlaceholderAspectRatio_ () {
1074
+ var _props$imagePlacehold;
1075
+ return (_props$imagePlacehold = props.imagePlaceholderAspectRatio) !== null && _props$imagePlacehold !== void 0 ? _props$imagePlacehold : 0.75;
1076
+ },
1077
+ get title_ () {
1078
+ return props.title;
1079
+ },
1080
+ get class_ () {
1081
+ return props.className;
1082
+ },
1083
+ get merchant_ () {
1084
+ return merchant();
1085
+ },
1086
+ get market_ () {
1087
+ return market();
1088
+ },
1089
+ get priceFormatting_ () {
1090
+ return locale().price_formatting_;
1091
+ },
1092
+ get locale_ () {
1093
+ return locale().backend_locale_;
1094
+ },
1095
+ get onNavigation_ () {
1096
+ return on_navigation;
1097
+ },
1098
+ get gridOptions_ () {
1099
+ var _view_more_button$sta;
1100
+ const { gridOptions: gridOptions } = props;
1101
+ const view_more_button = gridOptions === null || gridOptions === void 0 ? void 0 : gridOptions.viewMoreButton;
1102
+ return gridOptions && {
1103
+ max_rows: gridOptions.maxRows,
1104
+ view_more_button: view_more_button && {
1105
+ text: view_more_button.text,
1106
+ start_rows: (_view_more_button$sta = view_more_button.startRows) !== null && _view_more_button$sta !== void 0 ? _view_more_button$sta : 2,
1107
+ rows_per_click: view_more_button.rowsPerClick
1108
+ }
1109
+ };
1110
+ },
1111
+ get displayTransformers_ () {
1112
+ var _globalState$api;
1113
+ return (_globalState$api = (0, $8c691d7f86317052$export$8e769ad4338a911e).api) === null || _globalState$api === void 0 ? void 0 : _globalState$api.display_transformers;
1114
+ }
1115
+ });
1116
+ }
1117
+
1118
+
1119
+
1120
+
1121
+
1122
+
1123
+
1124
+
1125
+
1126
+
1127
+ const $1283ca5a3f4a4617$export$d69d8daa20eae175 = (createOpenModalParams)=>{
1128
+ const { location: location = "centered", alignerRef: alignerRef, stateKey: stateKey } = createOpenModalParams;
1129
+ let [deduped_variable, set_deduped_variable] = (0, $jb2Oo$useState)();
1130
+ // When component using this hook unmounts, "untrack" our component and dispose the search instance if needed
1131
+ (0, $jb2Oo$useEffect)(()=>{
1132
+ var _deduped_variable, _deduped_variable$;
1133
+ return (_deduped_variable = deduped_variable) === null || _deduped_variable === void 0 ? void 0 : (_deduped_variable$ = _deduped_variable[1]) === null || _deduped_variable$ === void 0 ? void 0 : _deduped_variable$.call(_deduped_variable);
1134
+ }, []);
1135
+ const openModal = ()=>{
1136
+ var _globalState$searchMo;
1137
+ // Get the search instance and track this component, but only once (basically work around re-rendering)
1138
+ // We have to do this in the openModal function since people might call this hook before creating DepictProvider
1139
+ if (!deduped_variable) {
1140
+ deduped_variable = (0, $jb2Oo$createRoot)((dispose)=>[
1141
+ (0, $fda7a7820477f957$export$f4d89133c6985668)("search", stateKey, "useSearchModal"),
1142
+ dispose
1143
+ ]);
1144
+ set_deduped_variable(deduped_variable);
1145
+ }
1146
+ const [search] = deduped_variable;
1147
+ const runAnimations_ = ((_globalState$searchMo = (0, $8c691d7f86317052$export$8e769ad4338a911e).searchModalComponent_) === null || _globalState$searchMo === void 0 ? void 0 : _globalState$searchMo[0, $jb2Oo$modalVersionSymbol]) === 2;
1148
+ if (location === "aligned" && alignerRef !== null && alignerRef !== void 0 && alignerRef.current) (0, $jb2Oo$open_modal_with_alignment)({
1149
+ "element": alignerRef.current,
1150
+ "location": location,
1151
+ "search": search,
1152
+ runAnimations_: runAnimations_
1153
+ });
1154
+ else (0, $jb2Oo$open_modal_with_alignment)({
1155
+ "location": "centered",
1156
+ "search": search,
1157
+ runAnimations_: runAnimations_
1158
+ });
1159
+ };
1160
+ return openModal;
1161
+ };
1162
+
1163
+
1164
+ function $356d18d3ed66814e$export$912994940e660d32() {
1165
+ let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1166
+ const open = (0, $1283ca5a3f4a4617$export$d69d8daa20eae175)({
1167
+ globalState: $8c691d7f86317052$export$8e769ad4338a911e,
1168
+ ...params
1169
+ });
1170
+ return {
1171
+ open: open
1172
+ };
1173
+ }
1174
+
1175
+
1176
+
1177
+
1178
+
1179
+
1180
+
1181
+
1182
+
1183
+ const $ab2d430c2034aa17$export$9bb30bbe003b82e0 = function() {
1184
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1185
+ // We should just export a plain SearchField component here, not a weird hook thing, but I don't want to make a breaking change. Just fixing the re-rendering issue for now.
1186
+ // Create signal that persists across renders
1187
+ const [[get_aligner_signal_value, set_aligner_signal_value]] = (0, $jb2Oo$useState)((0, $jb2Oo$createSignal)());
1188
+ // Update signal value when alignerRef changes
1189
+ set_aligner_signal_value(props === null || props === void 0 ? void 0 : props.alignerRef);
1190
+ // Make sure react never re-renders the actual SearchField component
1191
+ const componentFunction = (0, $jb2Oo$useCallback)(()=>(0, $ac53b4e3251b31d0$export$f6e64e17bd69eeef)({
1192
+ solid_component: ()=>(0, $jb2Oo$createComponent)((0, $7d10b4c67928d97f$export$eb5844afe948564b), {
1193
+ get children () {
1194
+ return (0, $jb2Oo$createMemo)(()=>{
1195
+ const depict_search = (0, $fda7a7820477f957$export$f4d89133c6985668)("search", props.stateKey, "useSearchField");
1196
+ return (0, $jb2Oo$SearchField)({
1197
+ depict_search: depict_search,
1198
+ get aligner_ref () {
1199
+ var _get_aligner_signal_v;
1200
+ // React mutates the object at some random time so only get the current value once it actually is requested
1201
+ return (_get_aligner_signal_v = get_aligner_signal_value()) === null || _get_aligner_signal_v === void 0 ? void 0 : _get_aligner_signal_v.current;
1202
+ }
1203
+ });
1204
+ });
1205
+ }
1206
+ }),
1207
+ props: {}
1208
+ }), []);
1209
+ return {
1210
+ SearchField: componentFunction
1211
+ };
1212
+ };
1213
+
1214
+
1215
+
1216
+
1217
+
1218
+
1219
+ function $1895644749ca8d8a$export$6501da23a2770fc() {
1220
+ return {
1221
+ fetchRecommendations: $1895644749ca8d8a$var$fetchRecommendations
1222
+ };
1223
+ }
1224
+ async function $1895644749ca8d8a$var$fetchRecommendations(opts) {
1225
+ var _globalState$api, _globalState$api$disp;
1226
+ const { merchant: [get_merchant], market: [get_market], usedLocale: [get_usedLocale], sessionId: [get_sessionId] } = (0, $8c691d7f86317052$export$8e769ad4338a911e);
1227
+ const merchant = (0, $jb2Oo$untrack)(get_merchant);
1228
+ const market = (0, $jb2Oo$untrack)(get_market);
1229
+ const locale = (0, $jb2Oo$untrack)(get_usedLocale).backend_locale_;
1230
+ if (!merchant || !market || !locale) throw new Error("Depict recommendations are not configured (merchant, market or locale is falsy). Wrap your app in a DepictProvider.");
1231
+ const fetchedRecs = await (0, $jb2Oo$fetchDepictRecommendations)({
1232
+ merchant: merchant,
1233
+ market: market,
1234
+ locale: locale,
1235
+ sessionId: (0, $jb2Oo$untrack)(get_sessionId),
1236
+ ...opts
1237
+ });
1238
+ const transformFunction = (_globalState$api = (0, $8c691d7f86317052$export$8e769ad4338a911e).api) === null || _globalState$api === void 0 ? void 0 : (_globalState$api$disp = _globalState$api.display_transformers) === null || _globalState$api$disp === void 0 ? void 0 : _globalState$api$disp.products;
1239
+ if (transformFunction) return await transformFunction({
1240
+ merchant: merchant,
1241
+ market: market,
1242
+ locale: locale,
1243
+ displays: fetchedRecs
1244
+ });
1245
+ return fetchedRecs;
1246
+ }
1247
+
1248
+
1249
+
1250
+
1251
+
1252
+ function $39af3ccd78996343$export$72616730c1fad2f4(stateKey) {
1253
+ // Create signal that will persist re-renders
1254
+ const [[getStateKeySignalValue, setStateKeySignalValue]] = (0, $jb2Oo$useState)((0, $jb2Oo$createSignal)(stateKey));
1255
+ const [cachedFunctionCalls] = (0, $jb2Oo$useState)({});
1256
+ const [hookFunctionsObject, setHookFunctionsObject] = (0, $jb2Oo$useState)(new Proxy({}, {
1257
+ get (target, property) {
1258
+ return function() {
1259
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key];
1260
+ // Cache function calls until we have the real functions
1261
+ cachedFunctionCalls[property] = args;
1262
+ };
1263
+ }
1264
+ }));
1265
+ (0, $jb2Oo$useEffect)(()=>{
1266
+ // get_instance_and_track_component may first return something in useEffect because the next-js router first gives us stuff from the URL after hydration (effects have ran) and we only create the instances if merchant and market is set
1267
+ return (0, $jb2Oo$createRoot)((dispose)=>{
1268
+ let firstRun = true;
1269
+ (0, $jb2Oo$createRenderEffect)(()=>{
1270
+ const depict_category = (0, $fda7a7820477f957$export$f4d89133c6985668)("category", getStateKeySignalValue(), "useCategoryFilterHelpers");
1271
+ const functions = $39af3ccd78996343$var$createHookFunctions(depict_category);
1272
+ if (firstRun) {
1273
+ firstRun = false;
1274
+ // Run cached function calls
1275
+ Object.entries(cachedFunctionCalls).forEach((_ref)=>{
1276
+ var _functions$key;
1277
+ let [key, args] = _ref;
1278
+ return (_functions$key = functions[key]) === null || _functions$key === void 0 ? void 0 : _functions$key.call(functions, ...args);
1279
+ });
1280
+ }
1281
+ setHookFunctionsObject(functions);
1282
+ });
1283
+ return dispose;
1284
+ });
1285
+ }, []);
1286
+ // When props change, update our signal value so solid can react to stateKey changing
1287
+ (0, $jb2Oo$useEffect)(()=>{
1288
+ setStateKeySignalValue(stateKey);
1289
+ }, [
1290
+ stateKey
1291
+ ]);
1292
+ return hookFunctionsObject;
1293
+ }
1294
+ function $39af3ccd78996343$var$createHookFunctions(depictCategory) {
1295
+ const categorySetShouldShowFilters = (newValue)=>{
1296
+ const { historyStateSignals_: { filters_open: [, setFiltersOpen], sorting_open: [, setSortingOpen] } } = depictCategory;
1297
+ if (newValue) // Close sorting so we don't show both at once
1298
+ setSortingOpen(false);
1299
+ setFiltersOpen(newValue);
1300
+ };
1301
+ const categorySetFilter = (filter)=>{
1302
+ const [selectedFilters, setSelectedFilters] = depictCategory.selectedFilters_;
1303
+ const filteredFilters = (0, $jb2Oo$untrack)(selectedFilters).filter((_ref2)=>{
1304
+ let { field: field, op: op } = _ref2;
1305
+ return field !== filter.field && op !== filter.op;
1306
+ });
1307
+ filteredFilters.push(filter);
1308
+ setSelectedFilters(filteredFilters);
1309
+ };
1310
+ const categoryExpandFilterGroup = (groupToExpand)=>{
1311
+ const [expandedFilters, setExpandedFilters] = depictCategory.historyStateSignals_.expanded_filters;
1312
+ const newExpanded = (0, $jb2Oo$untrack)(expandedFilters).filter((_ref3)=>{
1313
+ let { section_: section_ } = _ref3;
1314
+ return section_ !== groupToExpand;
1315
+ });
1316
+ newExpanded.push({
1317
+ section_: groupToExpand,
1318
+ expanded_: true
1319
+ });
1320
+ setExpandedFilters(newExpanded);
1321
+ };
1322
+ return {
1323
+ categorySetShouldShowFilters: categorySetShouldShowFilters,
1324
+ categorySetFilter: categorySetFilter,
1325
+ categoryExpandFilterGroup: categoryExpandFilterGroup
1326
+ };
1327
+ }
1328
+
1329
+
1330
+
1331
+
1332
+
1333
+
1334
+ const $05726fa9c7eda0a1$export$804fac5697cfbe35 = (router)=>(relativeUrl, _ref)=>{
1335
+ let { scroll: scroll, replace: replace } = _ref;
1336
+ let Page;
1337
+ (function(Page) {
1338
+ Page[Page["OTHER"] = 0] = "OTHER";
1339
+ Page[Page["SEARCH"] = 1] = "SEARCH";
1340
+ Page[Page["CATEGORY"] = 2] = "CATEGORY";
1341
+ })(Page || (Page = {}));
1342
+ const current_page = (0, $ac53b4e3251b31d0$export$775e6b3892b5ad52)() ? Page.SEARCH : (0, $ac53b4e3251b31d0$export$30c8a12df09be0e4)() ? Page.CATEGORY : Page.OTHER;
1343
+ const target_u_o = new URL(relativeUrl, location.origin);
1344
+ const target_page = (0, $ac53b4e3251b31d0$export$775e6b3892b5ad52)(target_u_o) ? Page.SEARCH : (0, $ac53b4e3251b31d0$export$30c8a12df09be0e4)(target_u_o) ? Page.CATEGORY : Page.OTHER;
1345
+ router[replace ? "replace" : "push"](relativeUrl, undefined, {
1346
+ shallow: current_page === target_page && target_page !== Page.OTHER,
1347
+ scroll: // Can't go shallowly to other pages
1348
+ scroll
1349
+ });
1350
+ };
1351
+
1352
+
1353
+ const $a7dfdd84298ae791$export$b8a61e5c71402559 = {
1354
+ nextRouterNavigation: $05726fa9c7eda0a1$export$804fac5697cfbe35
1355
+ };
1356
+
1357
+
1358
+ (0, $jb2Oo$add_to_version_info)("react-ui", (0, $9bd9bb8700ab2ada$export$83d89fbfd8236492));
1359
+
1360
+
1361
+ export {$c61814cfb91ead09$export$466cdc317043f6cb as QuickLinks, $ec632214ac078e79$export$5646050d516e06bc as BreadCrumbs, $f6a205a95e4fdee3$export$80e99ee6b29cadd2 as ComponentAligner, $18e5b9f66c7ade8e$export$9fac37a9c21c2f3b as DepictProvider, $710dda89475e8c05$export$f7d2f673fc2f091d as CategoryPage, $f33e2dee70c97da3$export$a54ec244c8863715 as SearchPage, $6406849926c3f794$export$3f37af283f8fb843 as ImagePlaceholder, $2c7738b65cbcac1c$export$89c6019e4baa40b1 as TextPlaceholder, $31abef71c0a2d3fc$export$b0a773486c1c2312 as RecommendationGrid, $c02e9fd51f31a1bd$export$82cfdc85a4d15688 as RecommendationSlider, $42a99d61b8f0a22c$export$ee471bde82ce7cf7 as LooksSliderOrGrid, $356d18d3ed66814e$export$912994940e660d32 as useSearchModal, $ab2d430c2034aa17$export$9bb30bbe003b82e0 as useSearchField, $1895644749ca8d8a$export$6501da23a2770fc as useFetchRecommendations, $b34796f5ebe3470e$export$38b98fae14bd1f64 as usePerformanceClient, $39af3ccd78996343$export$72616730c1fad2f4 as useCategoryFilterHelpers, $383b6fd56bf151bd$re_export$CategoryTitle as CategoryTitle, $383b6fd56bf151bd$re_export$EmbeddedNumProducts as EmbeddedNumProducts, $383b6fd56bf151bd$re_export$SearchModalV2 as SearchModalV2, $383b6fd56bf151bd$re_export$ClassicSearchModal as ClassicSearchModal, $9bd9bb8700ab2ada$export$83d89fbfd8236492 as version, $a7dfdd84298ae791$export$b8a61e5c71402559 as Navigation};