@depict-ai/ui 4.10.31 → 4.10.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,16 @@
1
- import { add_to_version_info as $b8hua$add_to_version_info, javascript_media_query as $b8hua$javascript_media_query, standard_price_format as $b8hua$standard_price_format, catchify as $b8hua$catchify1, observer as $b8hua$observer, slider_fractional_factory as $b8hua$slider_fractional_factory, report as $b8hua$report1, dlog as $b8hua$dlog, camelCasifyObject as $b8hua$camelCasifyObject, make_random_classname as $b8hua$make_random_classname, n_col_styling_with_dist as $b8hua$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $b8hua$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $b8hua$layout_get_total_rec_amount_for_row, layout_media_query_header as $b8hua$layout_media_query_header, dwarn as $b8hua$dwarn, slider_fading_factory as $b8hua$slider_fading_factory, Amazing_Slider as $b8hua$Amazing_Slider, slider_snap_css as $b8hua$slider_snap_css, useExpandingContainer as $b8hua$useExpandingContainer, hex_to_rgb as $b8hua$hex_to_rgb, relative_luminance_from_rgb as $b8hua$relative_luminance_from_rgb, instant_exec_on_suspect_history_change as $b8hua$instant_exec_on_suspect_history_change, base64_encode_unicode as $b8hua$base64_encode_unicode, base64_decode_unicode as $b8hua$base64_decode_unicode, queueMacroTask as $b8hua$queueMacroTask, findMostFrequentItem as $b8hua$findMostFrequentItem, fetch_retry as $b8hua$fetch_retry, base_url as $b8hua$base_url, deparallelize_no_drop as $b8hua$deparallelize_no_drop, ContainedImage as $b8hua$ContainedImage, make_asyncIterable_exiter as $b8hua$make_asyncIterable_exiter, href_change_ipns as $b8hua$href_change_ipns, use_href_accessor as $b8hua$use_href_accessor1, get_session_id as $b8hua$get_session_id, add_version_query_params as $b8hua$add_version_query_params, snakeCasifyObject as $b8hua$snakeCasifyObject, make_url_with_query_params as $b8hua$make_url_with_query_params, sort_obj as $b8hua$sort_obj, insert_surfaces as $b8hua$insert_surfaces } from "@depict-ai/utilishared/ES10";
1
+ import { add_to_version_info as $b8hua$add_to_version_info, javascript_media_query as $b8hua$javascript_media_query, standard_price_format as $b8hua$standard_price_format, catchify as $b8hua$catchify1, observer as $b8hua$observer, slider_fractional_factory as $b8hua$slider_fractional_factory, report as $b8hua$report1, dlog as $b8hua$dlog, camelCasifyObject as $b8hua$camelCasifyObject, make_random_classname as $b8hua$make_random_classname, n_col_styling_with_dist as $b8hua$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $b8hua$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $b8hua$layout_get_total_rec_amount_for_row, layout_media_query_header as $b8hua$layout_media_query_header, dwarn as $b8hua$dwarn, slider_fading_factory as $b8hua$slider_fading_factory, Amazing_Slider as $b8hua$Amazing_Slider, slider_snap_css as $b8hua$slider_snap_css, useExpandingContainer as $b8hua$useExpandingContainer, hex_to_rgb as $b8hua$hex_to_rgb, relative_luminance_from_rgb as $b8hua$relative_luminance_from_rgb, instant_exec_on_suspect_history_change as $b8hua$instant_exec_on_suspect_history_change, base64_encode_unicode as $b8hua$base64_encode_unicode, base64_decode_unicode as $b8hua$base64_decode_unicode, queueMacroTask as $b8hua$queueMacroTask, findMostFrequentItem as $b8hua$findMostFrequentItem, fetch_retry as $b8hua$fetch_retry, base_url as $b8hua$base_url, deparallelize_no_drop as $b8hua$deparallelize_no_drop, ContainedImage as $b8hua$ContainedImage, make_asyncIterable_exiter as $b8hua$make_asyncIterable_exiter, href_change_ipns as $b8hua$href_change_ipns, use_href_accessor as $b8hua$use_href_accessor1, get_session_id as $b8hua$get_session_id, add_version_query_params as $b8hua$add_version_query_params, snakeCasifyObject as $b8hua$snakeCasifyObject, set_event_api as $b8hua$set_event_api, make_url_with_query_params as $b8hua$make_url_with_query_params, sort_obj as $b8hua$sort_obj, insert_surfaces as $b8hua$insert_surfaces } from "@depict-ai/utilishared/ES10";
2
2
  import { createComponent as $b8hua$createComponent, ssr as $b8hua$ssr, ssrHydrationKey as $b8hua$ssrHydrationKey, escape as $b8hua$escape, isServer as $b8hua$isServer, ssrAttribute as $b8hua$ssrAttribute, mergeProps as $b8hua$mergeProps1, insert as $b8hua$insert, ssrClassList as $b8hua$ssrClassList, ssrElement as $b8hua$ssrElement, ssrStyle as $b8hua$ssrStyle, Dynamic as $b8hua$Dynamic, spread as $b8hua$spread } from "solid-js/web";
3
3
  import { createContext as $b8hua$createContext, createSignal as $b8hua$createSignal, getOwner as $b8hua$getOwner, createResource as $b8hua$createResource, untrack as $b8hua$untrack, createRoot as $b8hua$createRoot, createEffect as $b8hua$createEffect, runWithOwner as $b8hua$runWithOwner, onCleanup as $b8hua$onCleanup, createMemo as $b8hua$createMemo, Show as $b8hua$Show, createComputed as $b8hua$createComputed, createRenderEffect as $b8hua$createRenderEffect, mergeProps as $b8hua$mergeProps, useContext as $b8hua$useContext, createReaction as $b8hua$createReaction, on as $b8hua$on, Suspense as $b8hua$Suspense, ErrorBoundary as $b8hua$ErrorBoundary, Index as $b8hua$Index, For as $b8hua$For, createUniqueId as $b8hua$createUniqueId, mapArray as $b8hua$mapArray, batch as $b8hua$batch, Switch as $b8hua$Switch, Match as $b8hua$Match, splitProps as $b8hua$splitProps, createComponent as $b8hua$createComponent1, createSelector as $b8hua$createSelector, children as $b8hua$children } from "solid-js";
4
4
  import { catchify as $b8hua$catchify, report as $b8hua$report, use_href_accessor as $b8hua$use_href_accessor, dlog as $b8hua$dlog1, ListenableSet as $b8hua$ListenableSet, queueMacroTask as $b8hua$queueMacroTask1 } from "@depict-ai/utilishared/ES10";
5
5
  import { createStore as $b8hua$createStore, reconcile as $b8hua$reconcile } from "solid-js/store";
6
6
  import $b8hua$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/defineProperty";
7
- import $b8hua$babelruntimehelpersclassPrivateFieldSet from "@babel/runtime/helpers/classPrivateFieldSet";
8
7
  import $b8hua$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpers/classPrivateFieldGet";
8
+ import $b8hua$babelruntimehelpersclassPrivateFieldSet from "@babel/runtime/helpers/classPrivateFieldSet";
9
9
 
10
10
  /*! Depict.ai search and product listing SDK */
11
11
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
12
12
  register_es_version("ui", "ES10");
13
- const $8db9a15135765c11$export$83d89fbfd8236492 = "4.10.31";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "4.10.33";
14
14
  function $00a5b94f0c11efbb$export$d9f36cf74e24d595(media_query) {
15
15
  const signal = $b8hua$createSignal(false);
16
16
  $b8hua$onCleanup($b8hua$javascript_media_query(media_query, _ref => {
@@ -6925,6 +6925,14 @@ function $3b772ef9a35560fe$export$780a853d15174484(_ref) {
6925
6925
  }
6926
6926
  }));
6927
6927
  }
6928
+
6929
+ /** Shopify Lite's storefront (theme-static depict-content-blocks.js) treats screens up to 990px wide as phones. */
6930
+ const $3a2a35df91c580c6$export$1e15d45642067bf0 = "(max-width: 990px)";
6931
+ function $3a2a35df91c580c6$export$894065271726d798(visibility, isPhone) {
6932
+ if (visibility === "desktop") return !isPhone;
6933
+ if (visibility === "mobile") return isPhone;
6934
+ return true;
6935
+ }
6928
6936
  const $12ff24fdc4b26d88$export$af2c67164f68e9e9 = (content, aspectRatio) => {
6929
6937
  const {
6930
6938
  link: link,
@@ -6940,6 +6948,7 @@ function $12ff24fdc4b26d88$export$7a92d995f1bf3592(history_content_blocks_, plp_
6940
6948
  let hasSeenContentBlock = false;
6941
6949
  const [historyContentBlocks, setHistoryContentBlocks] = history_content_blocks_;
6942
6950
  const contentComponents = new Map();
6951
+ const isPhone = $00a5b94f0c11efbb$export$d9f36cf74e24d595((0, $3a2a35df91c580c6$export$1e15d45642067bf0));
6943
6952
  const delayedServerBlocks = $b8hua$createMemo(prev => {
6944
6953
  var _plp_meta;
6945
6954
  // Do not update the server blocks while the products request is loading, to avoid this: https://depictaiworkspace.slack.com/archives/C01JB6E7K7G/p1750861454651319
@@ -6966,7 +6975,10 @@ function $12ff24fdc4b26d88$export$7a92d995f1bf3592(history_content_blocks_, plp_
6966
6975
  if (!(blocksFromHistory !== null && blocksFromHistory !== void 0 && blocksFromHistory.length) && !hasSeenContentBlock) return developerProvided;
6967
6976
  const content = [...(developerProvided || [])];
6968
6977
  hasSeenContentBlock = true;
6978
+ const phone = isPhone();
6969
6979
  blocksFromHistory.forEach(row => {
6980
+ // Leave a block hidden on this device out before placement, so products fill its cells instead of a gap.
6981
+ if (!$3a2a35df91c580c6$export$894065271726d798(row.visibility, phone)) return;
6970
6982
  const {
6971
6983
  content: {
6972
6984
  link: link,
@@ -11292,12 +11304,845 @@ function $e18ab2868df26f40$export$f091cbac892643a4(obj) {
11292
11304
  return Object.fromEntries(mapped_stuff); // FUCK TYPESCRIPT, WHY CAN'T YOU DO THIS CORRECTLY???
11293
11305
  }
11294
11306
 
11307
+ /** One try and at most two retries: a 503 burst from V4 shouldn't be multiplied by fetch_retry's default of 10. */
11308
+ const $a881711b2a93404e$var$NATIVE_MAX_TRIES = 3;
11309
+ function $a881711b2a93404e$export$b6dad15503f66988(merchant, path) {
11310
+ return "".concat((0, $b8hua$base_url), "/v4/").concat(encodeURIComponent(merchant)).concat(path);
11311
+ }
11312
+ async function $a881711b2a93404e$export$88d793e3827f3436(url) {
11313
+ return (await $a881711b2a93404e$export$f035610fd74c541a(url)).body_;
11314
+ }
11315
+ async function $a881711b2a93404e$export$f035610fd74c541a(url) {
11316
+ var _error, _error2, _error3;
11317
+ const response = await $b8hua$fetch_retry(url, {
11318
+ method: "GET"
11319
+ }, $a881711b2a93404e$var$NATIVE_MAX_TRIES);
11320
+ if (!response) {
11321
+ $b8hua$dwarn("[NativeDepictAPI] no response from", url);
11322
+ return {};
11323
+ }
11324
+ if (response.status === 200)
11325
+ // A 200 that isn't JSON (a proxy's HTML page, a cut-off body) is a failed read like any other, so callers fall
11326
+ // back instead of rejecting: get_recommendation_types then forgets the read rather than keeping it in flight.
11327
+ try {
11328
+ return {
11329
+ body_: await response.json()
11330
+ };
11331
+ } catch (e) {
11332
+ $b8hua$dwarn("[NativeDepictAPI] 200 without a JSON body from", url, e);
11333
+ return {};
11334
+ }
11335
+ let error;
11336
+ try {
11337
+ error = (await response.json()).error;
11338
+ } catch {
11339
+ // not V4's error body
11340
+ }
11341
+ $b8hua$dwarn("[NativeDepictAPI]", response.status, (_error = error) === null || _error === void 0 ? void 0 : _error.code, (_error2 = error) === null || _error2 === void 0 ? void 0 : _error2.message, (_error3 = error) === null || _error3 === void 0 ? void 0 : _error3.request_id, url);
11342
+ if (response.status >= 500) {
11343
+ var _error$code, _error4, _error5, _error$request_id, _error6;
11344
+ $b8hua$report1([new Error("V4 ".concat(response.status, " ").concat((_error$code = (_error4 = error) === null || _error4 === void 0 ? void 0 : _error4.code) !== null && _error$code !== void 0 ? _error$code : "")), "Native V4 request failed"], "warning", {
11345
+ url: url,
11346
+ status: response.status,
11347
+ code: (_error5 = error) === null || _error5 === void 0 ? void 0 : _error5.code,
11348
+ request_id: (_error$request_id = (_error6 = error) === null || _error6 === void 0 ? void 0 : _error6.request_id) !== null && _error$request_id !== void 0 ? _error$request_id : response.headers.get("x-depict-request-id")
11349
+ });
11350
+ }
11351
+ return {
11352
+ error_: error
11353
+ };
11354
+ }
11355
+ const $a1878713ea20ea2c$export$8e79752841e7cdb4 = 900000;
11356
+ const $a1878713ea20ea2c$var$storage_key = merchant => "depict_v4_recommendation_types_".concat(merchant);
11357
+ /** One read per merchant and CONTEXT_TTL_MS in this page; a failed read is forgotten so the next caller tries again. */
11358
+ const $a1878713ea20ea2c$var$in_flight = new Map();
11359
+ function $a1878713ea20ea2c$var$from_storage(merchant, now) {
11360
+ try {
11361
+ var _localStorage$getItem;
11362
+ const stored = JSON.parse((_localStorage$getItem = localStorage.getItem($a1878713ea20ea2c$var$storage_key(merchant))) !== null && _localStorage$getItem !== void 0 ? _localStorage$getItem : "null");
11363
+ if (!stored || !Array.isArray(stored.types) || !(now - stored.fetched_at < $a1878713ea20ea2c$export$8e79752841e7cdb4)) return undefined;
11364
+ return $a1878713ea20ea2c$var$to_map(stored.types);
11365
+ } catch {
11366
+ return undefined;
11367
+ }
11368
+ }
11369
+ function $a1878713ea20ea2c$var$to_storage(merchant, types, now) {
11370
+ try {
11371
+ localStorage.setItem($a1878713ea20ea2c$var$storage_key(merchant), JSON.stringify({
11372
+ fetched_at: now,
11373
+ types: types
11374
+ }));
11375
+ } catch {
11376
+ // localStorage unavailable or full: read /context again on the next page.
11377
+ }
11378
+ }
11379
+ const $a1878713ea20ea2c$var$to_map = types => new Map(types.map(_ref => {
11380
+ let {
11381
+ type: type,
11382
+ inputs: inputs
11383
+ } = _ref;
11384
+ return [type, inputs];
11385
+ }));
11386
+ function $a1878713ea20ea2c$export$869eb14d6f85ac51(merchant) {
11387
+ let now = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Date.now();
11388
+ const pending = $a1878713ea20ea2c$var$in_flight.get(merchant);
11389
+ if (pending && now - pending.started_at < $a1878713ea20ea2c$export$8e79752841e7cdb4) return pending.read;
11390
+ const stored = $a1878713ea20ea2c$var$from_storage(merchant, now);
11391
+ if (stored) return Promise.resolve(stored);
11392
+ const read = $a881711b2a93404e$export$88d793e3827f3436($a881711b2a93404e$export$b6dad15503f66988(merchant, "/context")).then(context => {
11393
+ var _context$recommendati;
11394
+ if (!context) {
11395
+ var _in_flight$get;
11396
+ if (((_in_flight$get = $a1878713ea20ea2c$var$in_flight.get(merchant)) === null || _in_flight$get === void 0 ? void 0 : _in_flight$get.read) === read) $a1878713ea20ea2c$var$in_flight.delete(merchant);
11397
+ return undefined;
11398
+ }
11399
+ const types = (_context$recommendati = context.recommendation_types) !== null && _context$recommendati !== void 0 ? _context$recommendati : [];
11400
+ $a1878713ea20ea2c$var$to_storage(merchant, types, now);
11401
+ return $a1878713ea20ea2c$var$to_map(types);
11402
+ });
11403
+ $a1878713ea20ea2c$var$in_flight.set(merchant, {
11404
+ started_at: now,
11405
+ read: read
11406
+ });
11407
+ return read;
11408
+ }
11409
+ function $a1878713ea20ea2c$export$6cde5c31239dec47() {
11410
+ $a1878713ea20ea2c$var$in_flight.clear();
11411
+ }
11412
+
11413
+ /**
11414
+ * The shopper's recently viewed products, kept in the browser for the native V4 API's history-based recommendations.
11415
+ *
11416
+ * v3 kept this history on the server, per session. V4 content requests carry no session, so a surface that reads
11417
+ * history gets it in the request (`recent_views`), and the SDK keeps the list. It holds product ids and view times
11418
+ * only (no session, user or page data), bounded in size and age, in localStorage per merchant; when localStorage
11419
+ * can't be used (private mode, blocked, full) it lives in memory for the page load.
11420
+ *
11421
+ * A view is recorded when a native product-anchored recommendation request resolves its anchor, as v3's facade records
11422
+ * a resolved anchor as a view; the product being viewed is in the list from the next request on.
11423
+ */ /** recs-wasm reads the newest 20 views (V4 `recent_views` docs), so more would never be read. */
11424
+ const $67005db9d7b669bc$export$3d684435158adda6 = 20;
11425
+ const $67005db9d7b669bc$export$5eb0a366a50fa99e = 2592000000;
11426
+ /** V4's longest product id (`ProductRef`); a longer one is never a product it knows. */
11427
+ const $67005db9d7b669bc$var$MAX_ID_LENGTH = 500;
11428
+ const $67005db9d7b669bc$var$storage_key = merchant => "depict_v4_recent_views_".concat(merchant);
11429
+ /** The list per merchant as last written, which reads use when localStorage can't hold it. */
11430
+ const $67005db9d7b669bc$var$in_memory = new Map();
11431
+ /** Merchants whose last write to localStorage failed, so localStorage holds an older list than memory. */
11432
+ const $67005db9d7b669bc$var$unstored = new Set();
11433
+ /** `views` as a valid list: well-formed entries, newest first, one per id, not older than the age bound or too many. */
11434
+ function $67005db9d7b669bc$var$bounded(views, now) {
11435
+ if (!Array.isArray(views)) return [];
11436
+ const seen = new Set();
11437
+ const kept = [];
11438
+ for (const item of views) {
11439
+ if (!item || typeof item !== "object") continue;
11440
+ const {
11441
+ id: id,
11442
+ at: at
11443
+ } = item;
11444
+ if (typeof id !== "string" || !id || id.length > $67005db9d7b669bc$var$MAX_ID_LENGTH || typeof at !== "string") continue;
11445
+ const time = Date.parse(at);
11446
+ if (Number.isNaN(time) || now - time > $67005db9d7b669bc$export$5eb0a366a50fa99e) continue;
11447
+ kept.push({
11448
+ view: {
11449
+ id: id,
11450
+ at: new Date(time).toISOString()
11451
+ },
11452
+ time: time
11453
+ });
11454
+ }
11455
+ kept.sort((a, b) => b.time - a.time);
11456
+ const newest = [];
11457
+ for (const {
11458
+ view: view
11459
+ } of kept) {
11460
+ if (seen.has(view.id)) continue;
11461
+ seen.add(view.id);
11462
+ newest.push(view);
11463
+ if (newest.length === $67005db9d7b669bc$export$3d684435158adda6) break;
11464
+ }
11465
+ return newest;
11466
+ }
11467
+ function $67005db9d7b669bc$var$read_stored(merchant) {
11468
+ if ($67005db9d7b669bc$var$unstored.has(merchant)) return $67005db9d7b669bc$var$in_memory.get(merchant);
11469
+ try {
11470
+ const stored = localStorage.getItem($67005db9d7b669bc$var$storage_key(merchant));
11471
+ return stored === null ? [] : JSON.parse(stored);
11472
+ } catch {
11473
+ var _in_memory$get;
11474
+ return (_in_memory$get = $67005db9d7b669bc$var$in_memory.get(merchant)) !== null && _in_memory$get !== void 0 ? _in_memory$get : [];
11475
+ }
11476
+ }
11477
+ function $67005db9d7b669bc$export$2d7138f47b625a04(merchant) {
11478
+ let now = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Date.now();
11479
+ return $67005db9d7b669bc$var$bounded($67005db9d7b669bc$var$read_stored(merchant), now);
11480
+ }
11481
+ function $67005db9d7b669bc$export$6379943de8f8af08(merchant, product_id) {
11482
+ let now = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Date.now();
11483
+ const views = $67005db9d7b669bc$var$bounded([{
11484
+ id: product_id,
11485
+ at: new Date(now).toISOString()
11486
+ }, ...$67005db9d7b669bc$export$2d7138f47b625a04(merchant, now)], now);
11487
+ $67005db9d7b669bc$var$in_memory.set(merchant, views);
11488
+ try {
11489
+ localStorage.setItem($67005db9d7b669bc$var$storage_key(merchant), JSON.stringify(views));
11490
+ $67005db9d7b669bc$var$unstored.delete(merchant);
11491
+ } catch {
11492
+ // localStorage unavailable or full: the in-memory list serves this page load.
11493
+ $67005db9d7b669bc$var$unstored.add(merchant);
11494
+ }
11495
+ }
11496
+
11497
+ /** V4's largest `limit`, and the most ids `cart` and `exclude` take. */
11498
+ const $a9dd796a4aeb6bd4$export$f112abad09998fa8 = 100;
11499
+ const $a9dd796a4aeb6bd4$var$MAX_IDS = 100;
11500
+ /** The most products V4's `recent_views` takes. */
11501
+ const $a9dd796a4aeb6bd4$var$MAX_VIEWS = 50;
11502
+ /** What a v3 recommendations call names, as fetchDepictRecommendations takes it. */
11503
+ const $a9dd796a4aeb6bd4$var$distinct = ids => [...new Set(ids.filter(id => typeof id === "string" && id.length > 0))];
11504
+ function $a9dd796a4aeb6bd4$export$17493dc1a89b34e6(call, inputs, recent_views) {
11505
+ var _call$productIds;
11506
+ const reads = input => inputs ? inputs.includes(input) : input === "anchor";
11507
+ const product_ids = $a9dd796a4aeb6bd4$var$distinct((_call$productIds = call.productIds) !== null && _call$productIds !== void 0 ? _call$productIds : []);
11508
+ const request = {
11509
+ market: call.market,
11510
+ ...(call.locale ? {
11511
+ locale: call.locale
11512
+ } : {}),
11513
+ type: call.type
11514
+ };
11515
+ if (reads("anchor")) {
11516
+ if (call.categoryId) request.anchor = {
11517
+ type: "category",
11518
+ id: call.categoryId
11519
+ };else if (call.productId) request.anchor = {
11520
+ type: "product",
11521
+ id: call.productId
11522
+ };else if (product_ids.length) {
11523
+ const [first, ...rest] = product_ids;
11524
+ request.anchor = {
11525
+ type: "product",
11526
+ id: first
11527
+ };
11528
+ if (rest.length) request.exclude = rest.slice(0, $a9dd796a4aeb6bd4$var$MAX_IDS);
11529
+ }
11530
+ }
11531
+ if (reads("cart") && product_ids.length) request.cart = product_ids.slice(0, $a9dd796a4aeb6bd4$var$MAX_IDS);
11532
+ if (reads("recent_views") && recent_views.length) request.recent_views = recent_views.slice(0, $a9dd796a4aeb6bd4$var$MAX_VIEWS);
11533
+ if (call.limit) request.limit = Math.min(Math.max(1, Math.floor(call.limit)), $a9dd796a4aeb6bd4$export$f112abad09998fa8);
11534
+ request.include = ["attributes"];
11535
+ const anchor_only = (inputs === null || inputs === void 0 ? void 0 : inputs.length) === 1 && inputs[0] === "anchor";
11536
+ if (anchor_only && !request.anchor) return undefined;
11537
+ return request;
11538
+ }
11539
+ /** `encodeURIComponent`, as V4's own encoder writes a value (`+` would mean a space). */
11540
+ const $a9dd796a4aeb6bd4$var$encode = value => encodeURIComponent(value);
11541
+ function $a9dd796a4aeb6bd4$export$fc756666ac777d0(request) {
11542
+ var _request$recent_views;
11543
+ const pairs = [];
11544
+ const add = (key, value) => value !== undefined && pairs.push("".concat(key, "=").concat(value));
11545
+ const list = values => values === null || values === void 0 ? void 0 : values.map($a9dd796a4aeb6bd4$var$encode).join(",");
11546
+ add("market", $a9dd796a4aeb6bd4$var$encode(request.market));
11547
+ add("locale", request.locale === undefined ? undefined : $a9dd796a4aeb6bd4$var$encode(request.locale));
11548
+ add("type", $a9dd796a4aeb6bd4$var$encode(request.type));
11549
+ add("anchor", request.anchor && "".concat($a9dd796a4aeb6bd4$var$encode(request.anchor.type), ":").concat($a9dd796a4aeb6bd4$var$encode(request.anchor.id)));
11550
+ add("cart", list(request.cart));
11551
+ add("recent_views", (_request$recent_views = request.recent_views) === null || _request$recent_views === void 0 ? void 0 : _request$recent_views.map(view => "".concat($a9dd796a4aeb6bd4$var$encode(view.id), "@").concat($a9dd796a4aeb6bd4$var$encode(view.at))).join(","));
11552
+ add("query", request.query === undefined ? undefined : $a9dd796a4aeb6bd4$var$encode(request.query));
11553
+ add("exclude", list(request.exclude));
11554
+ add("limit", request.limit === undefined ? undefined : String(request.limit));
11555
+ add("include", list(request.include));
11556
+ return pairs.join("&");
11557
+ }
11558
+ const $a9dd796a4aeb6bd4$export$89962366050887f7 = product => {
11559
+ var _product$variants$pro, _product$variants$pro2;
11560
+ return (_product$variants$pro = (_product$variants$pro2 = product.variants[product.selected]) === null || _product$variants$pro2 === void 0 ? void 0 : _product$variants$pro2.product_id) !== null && _product$variants$pro !== void 0 ? _product$variants$pro : product.group_id;
11561
+ };
11562
+ function $a9dd796a4aeb6bd4$export$afe6aeae61a7aa58(hits, scope, type) {
11563
+ const anchors = hits.slice(0, type === "search" ? 10 : 1);
11564
+ return anchors.map((anchor, at) => {
11565
+ const exclude = hits.filter((_, index) => index !== at).map($a9dd796a4aeb6bd4$export$89962366050887f7);
11566
+ return {
11567
+ market: scope.market,
11568
+ ...(scope.locale ? {
11569
+ locale: scope.locale
11570
+ } : {}),
11571
+ type: type,
11572
+ anchor: {
11573
+ type: "product",
11574
+ id: $a9dd796a4aeb6bd4$export$89962366050887f7(anchor)
11575
+ },
11576
+ ...(exclude.length ? {
11577
+ exclude: exclude.slice(0, $a9dd796a4aeb6bd4$var$MAX_IDS)
11578
+ } : {}),
11579
+ include: ["attributes"]
11580
+ };
11581
+ });
11582
+ }
11583
+ function $a9dd796a4aeb6bd4$export$9af50be6508dcd00(lists, limit) {
11584
+ const merged = [];
11585
+ const taken = new Set();
11586
+ const depth = Math.max(0, ...lists.map(list => list.length));
11587
+ for (let index = 0; index < depth; index++) for (const list of lists) {
11588
+ const product = list[index];
11589
+ if (product === undefined || taken.has(product.group_id)) continue;
11590
+ taken.add(product.group_id);
11591
+ merged.push(product);
11592
+ if (merged.length >= limit) return merged;
11593
+ }
11594
+ return merged;
11595
+ }
11596
+
11597
+ /** Which v3 result id a card's `tracking_id` goes in; the d1 id it carries says the same (`d1.s.…`, `d1.l.…`). */ /** A bare 3/4/6/8-digit hex, as fi stores a computed `color_hex`; v3 serves it with its `#`. */
11598
+ const $d05d7bcd4b59b266$var$BARE_HEX = /^(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
11599
+ function $d05d7bcd4b59b266$export$7abfb7bc025aaea8(product, tracking_key) {
11600
+ var _product$attributes;
11601
+ const product_attributes = (_product$attributes = product.attributes) !== null && _product$attributes !== void 0 ? _product$attributes : {};
11602
+ return {
11603
+ variant_index: product.selected,
11604
+ variant_displays: product.variants.map(variant => {
11605
+ var _variant$price, _variant$color, _ref, _variant$attributes$m, _variant$attributes, _variant$title, _price$compare_at, _variant$slug;
11606
+ // A variant carries its own main image only when it differs from the card's; it has no gallery of its own.
11607
+ const image_urls = variant.image ? [variant.image] : [...product.images];
11608
+ const price = (_variant$price = variant.price) !== null && _variant$price !== void 0 ? _variant$price : product.price;
11609
+ const color = (_variant$color = variant.color) !== null && _variant$color !== void 0 ? _variant$color : product.color;
11610
+ const display = {
11611
+ ...product_attributes,
11612
+ // The merchant's variant attributes under their own keys (`add_to_cart_id`, `item_group_id`, …); the card
11613
+ // fields below win over a same-named attribute, as on v3.
11614
+ ...variant.attributes,
11615
+ product_id: variant.product_id,
11616
+ main_product_id: (_ref = (_variant$attributes$m = (_variant$attributes = variant.attributes) === null || _variant$attributes === void 0 ? void 0 : _variant$attributes.main_product_id) !== null && _variant$attributes$m !== void 0 ? _variant$attributes$m : variant.group_id) !== null && _ref !== void 0 ? _ref : product.group_id,
11617
+ title: (_variant$title = variant.title) !== null && _variant$title !== void 0 ? _variant$title : product.title,
11618
+ image_urls: image_urls,
11619
+ sale_price: price.amount,
11620
+ original_price: (_price$compare_at = price.compare_at) !== null && _price$compare_at !== void 0 ? _price$compare_at : price.amount,
11621
+ ...(price.lowest !== undefined ? {
11622
+ lowest_price: price.lowest
11623
+ } : {}),
11624
+ in_stock: variant.in_stock,
11625
+ ...(color ? {
11626
+ color_name: color.name
11627
+ } : {}),
11628
+ uri: (_variant$slug = variant.slug) !== null && _variant$slug !== void 0 ? _variant$slug : product.slug
11629
+ };
11630
+ const hex = display.color_hex;
11631
+ if (typeof hex === "string" && $d05d7bcd4b59b266$var$BARE_HEX.test(hex)) display.color_hex = "#".concat(hex);
11632
+ return display;
11633
+ }),
11634
+ [tracking_key]: product.tracking_id
11635
+ };
11636
+ }
11637
+ function $fdcc2c233c7ae6b6$var$_classPrivateFieldInitSpec(obj, privateMap, value) {
11638
+ $fdcc2c233c7ae6b6$var$_checkPrivateRedeclaration(obj, privateMap);
11639
+ privateMap.set(obj, value);
11640
+ }
11641
+ function $fdcc2c233c7ae6b6$var$_checkPrivateRedeclaration(obj, privateCollection) {
11642
+ if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
11643
+ }
11644
+ class $fdcc2c233c7ae6b6$export$f5ea4d073ddb4bdb extends Error {}
11645
+ /** v3's names for V4's built-in fields, both ways. */
11646
+ const $fdcc2c233c7ae6b6$var$V3_FIELD = {
11647
+ price: "sale_price"
11648
+ };
11649
+ const $fdcc2c233c7ae6b6$var$V4_FIELD = {
11650
+ sale_price: "price"
11651
+ };
11652
+ const $fdcc2c233c7ae6b6$var$V3_SORT = {
11653
+ relevance: "_relevance",
11654
+ price: "sale_price",
11655
+ newest: "product_timestamp"
11656
+ };
11657
+ const $fdcc2c233c7ae6b6$var$V4_SORT = Object.fromEntries(Object.entries($fdcc2c233c7ae6b6$var$V3_SORT).map(_ref => {
11658
+ let [v4, v3] = _ref;
11659
+ return [v3, v4];
11660
+ }));
11661
+ /** V4's public filter field syntax (`FilterField` in the contract). */
11662
+ const $fdcc2c233c7ae6b6$var$PUBLIC_FIELD = /^[A-Za-z0-9_-]+(\.[A-Za-z0-9_-]+)*$/;
11663
+ /**
11664
+ * Fields that are never a lowercased group title: v3's toggles carry no group title, and `sale_price` is v3's own
11665
+ * name for V4's price. A reserved V4 field (`price`, `brand`, `category`) is not among them: iciw's category tree is
11666
+ * titled "Category", so `category` from a link may name `product_scollection_category_hierarchy`.
11667
+ */
11668
+ const $fdcc2c233c7ae6b6$var$NEVER_A_TITLE = new Set(["in_stock", "on_sale", "sale_price"]);
11669
+ /** fi's enriched colour fields: their values are names, never a `<name>;#<hex>` composite. */
11670
+ const $fdcc2c233c7ae6b6$var$FI_COLOUR_FIELDS = new Set(["colors", "color_details"]);
11671
+ /** The colour template's field, which indexes the composite itself. */
11672
+ const $fdcc2c233c7ae6b6$var$V3_TEMPLATE_COLOUR = "color_with_hex_list";
11673
+ /** Legacy's colour pill composite suffix (`Green;#9ea386`). */
11674
+ const $fdcc2c233c7ae6b6$var$HEX_SUFFIX = /;#[0-9a-fA-F]{3,8}\s*$/;
11675
+ const $fdcc2c233c7ae6b6$var$NUMERIC = /^-?\d+(\.\d+)?$/;
11676
+ /** realtime's separator between the levels of a hierarchical facet value (`Shop # Woman`). */
11677
+ const $fdcc2c233c7ae6b6$var$HIERARCHY_SEPARATOR = " # ";
11678
+ /** The features realtime's category tree is built on. */
11679
+ const $fdcc2c233c7ae6b6$var$CATEGORY_TREE_FIELDS = new Set(["product_category_hierarchy", "product_scollection_category_hierarchy"]);
11680
+ /** V4's public name for the discount template's field (realtime `v4/worker/src/search/fields.ts`). */
11681
+ const $fdcc2c233c7ae6b6$var$DISCOUNT_FIELD = "discount";
11682
+ /** The fields of V4's toggle facets (the `on_sale` and `in_stock` templates). */
11683
+ const $fdcc2c233c7ae6b6$var$V3_TOGGLES = new Set(["on_sale", "in_stock"]);
11684
+ var $fdcc2c233c7ae6b6$var$_by_key = /*#__PURE__*/new WeakMap();
11685
+ class $fdcc2c233c7ae6b6$export$8d488bcc71d07ffb {
11686
+ constructor() {
11687
+ $fdcc2c233c7ae6b6$var$_classPrivateFieldInitSpec(this, $fdcc2c233c7ae6b6$var$_by_key, {
11688
+ writable: true,
11689
+ value: new Map()
11690
+ });
11691
+ }
11692
+ /** Adds the facets of one browse response. */
11693
+ learn_(facets) {
11694
+ for (const facet of facets !== null && facets !== void 0 ? facets : []) {
11695
+ const info = {
11696
+ field_: facet.field,
11697
+ checkbox_: facet.type === "checkbox" && !$fdcc2c233c7ae6b6$var$is_toggle(facet),
11698
+ colour_: $fdcc2c233c7ae6b6$var$FI_COLOUR_FIELDS.has(facet.field) || facet.type === "swatch" && facet.field !== $fdcc2c233c7ae6b6$var$V3_TEMPLATE_COLOUR
11699
+ };
11700
+ $b8hua$babelruntimehelpersclassPrivateFieldGet(this, $fdcc2c233c7ae6b6$var$_by_key).set(facet.field, info);
11701
+ const v3_field = $fdcc2c233c7ae6b6$var$V3_FIELD[facet.field];
11702
+ if (v3_field) $b8hua$babelruntimehelpersclassPrivateFieldGet(this, $fdcc2c233c7ae6b6$var$_by_key).set(v3_field, info);
11703
+ if (facet.title) $b8hua$babelruntimehelpersclassPrivateFieldGet(this, $fdcc2c233c7ae6b6$var$_by_key).set(facet.title.toLowerCase(), info);
11704
+ }
11705
+ }
11706
+ /** The field a v3 filter field names, when a served facet has it as its field or its title. */
11707
+ get_(field) {
11708
+ const bare = field.replace(/#$/, "");
11709
+ const direct = $b8hua$babelruntimehelpersclassPrivateFieldGet(this, $fdcc2c233c7ae6b6$var$_by_key).get(bare);
11710
+ if (direct) return direct;
11711
+ let wanted;
11712
+ try {
11713
+ wanted = decodeURIComponent(bare).toLowerCase();
11714
+ } catch {
11715
+ wanted = bare.toLowerCase();
11716
+ }
11717
+ return $b8hua$babelruntimehelpersclassPrivateFieldGet(this, $fdcc2c233c7ae6b6$var$_by_key).get(wanted);
11718
+ }
11719
+ }
11720
+ function $fdcc2c233c7ae6b6$export$3b6ba2422a5e0aa0(field, index) {
11721
+ return !!index.get_(field) || $fdcc2c233c7ae6b6$var$NEVER_A_TITLE.has(field.replace(/#$/, ""));
11722
+ }
11723
+ function $fdcc2c233c7ae6b6$var$is_empty(data) {
11724
+ return data === undefined || data === null || data === "" || Array.isArray(data) && !data.length;
11725
+ }
11726
+ function $fdcc2c233c7ae6b6$var$literal(value, field) {
11727
+ const text = String(value);
11728
+ if (text.includes("`")) throw new $fdcc2c233c7ae6b6$export$f5ea4d073ddb4bdb("filters: a value of ".concat(field, " contains a backtick"));
11729
+ // A boolean-looking string is written bare, as realtime's filter writer does for every field.
11730
+ if (/^(true|True|false|False)$/.test(text)) return text.toLowerCase();
11731
+ if (field === "price" && $fdcc2c233c7ae6b6$var$NUMERIC.test(text)) return text;
11732
+ return typeof value === "string" ? "`".concat(text, "`") : text;
11733
+ }
11734
+ function $fdcc2c233c7ae6b6$var$lax_number(value) {
11735
+ if (typeof value === "number") return value;
11736
+ if (typeof value !== "string" || value.trim() === "") return undefined;
11737
+ const number = Number(value);
11738
+ return Number.isFinite(number) ? number : undefined;
11739
+ }
11740
+ function $fdcc2c233c7ae6b6$export$c17bb5d2ead3e8f3(filter, index) {
11741
+ var _ref2, _info$field_;
11742
+ if ($fdcc2c233c7ae6b6$var$is_empty(filter.data)) return undefined;
11743
+ const info = index.get_(filter.field);
11744
+ const bare = filter.field.replace(/#$/, "");
11745
+ const field = (_ref2 = (_info$field_ = info === null || info === void 0 ? void 0 : info.field_) !== null && _info$field_ !== void 0 ? _info$field_ : $fdcc2c233c7ae6b6$var$V4_FIELD[bare]) !== null && _ref2 !== void 0 ? _ref2 : bare;
11746
+ if (!$fdcc2c233c7ae6b6$var$PUBLIC_FIELD.test(field)) throw new $fdcc2c233c7ae6b6$export$f5ea4d073ddb4bdb("Invalid filter field `".concat(filter.field, "`"));
11747
+ const clause = text => ({
11748
+ field_: field,
11749
+ clause_: text
11750
+ });
11751
+ const colour = $fdcc2c233c7ae6b6$var$FI_COLOUR_FIELDS.has(field) || !!(info !== null && info !== void 0 && info.colour_);
11752
+ const data = filter.data;
11753
+ const values = (Array.isArray(data) ? data : [data]).map(value => !Array.isArray(value) ? colour && typeof value === "string" ? value.replace($fdcc2c233c7ae6b6$var$HEX_SUFFIX, "").trim() || value : value : field === "category" ? value[value.length - 1] : value.map(String).join($fdcc2c233c7ae6b6$var$HIERARCHY_SEPARATOR));
11754
+ const list = () => "[".concat(values.map(value => $fdcc2c233c7ae6b6$var$literal(value, field)).join(","), "]");
11755
+ // V4's discount filter (the discount template's "X% or more" radio) is a threshold, so `in` or `eq` on it means
11756
+ // "this discount or more", as on the facade since realtime#2181: a link with no operator decodes as `in`, and a
11757
+ // shop may send `in ["0.2"]` itself. Several values take the largest, as `geq` does.
11758
+ const op = (filter.op === "in" || filter.op === "eq") && field === $fdcc2c233c7ae6b6$var$DISCOUNT_FIELD ? "geq" : filter.op;
11759
+ // A configured checkbox keeps in/nin; every other op on it becomes in.
11760
+ if (op !== "in" && op !== "nin" && info !== null && info !== void 0 && info.checkbox_) return clause("".concat(field, ":=").concat(list()));
11761
+ const one = () => {
11762
+ if (values.length !== 1) throw new $fdcc2c233c7ae6b6$export$f5ea4d073ddb4bdb("filters: ".concat(op, " takes one value"));
11763
+ return $fdcc2c233c7ae6b6$var$literal(values[0], field);
11764
+ };
11765
+ // A comparison takes a number, also one sent as a string; of several numbers `geq` takes the largest.
11766
+ const bound = () => {
11767
+ const numbers = values.map(value => typeof value === "number" || typeof value === "string" && $fdcc2c233c7ae6b6$var$NUMERIC.test(value) ? Number(value) : undefined);
11768
+ if (numbers.length === 0 || numbers.some(number => number === undefined)) return one();
11769
+ if (numbers.length > 1 && op !== "geq") return one();
11770
+ return String(Math.max(...numbers));
11771
+ };
11772
+ switch (op) {
11773
+ case "eq":
11774
+ return clause("".concat(field, ":=").concat(one()));
11775
+ case "neq":
11776
+ return clause("".concat(field, ":!=").concat(one()));
11777
+ case "in":
11778
+ return clause("".concat(field, ":=").concat(list()));
11779
+ case "nin":
11780
+ return clause("".concat(field, ":!=").concat(list()));
11781
+ case "leq":
11782
+ return clause("".concat(field, ":<=").concat(bound()));
11783
+ case "geq":
11784
+ return clause("".concat(field, ":>=").concat(bound()));
11785
+ case "inrange":
11786
+ {
11787
+ const [min, max] = values.map($fdcc2c233c7ae6b6$var$lax_number);
11788
+ if (min === undefined || max === undefined || values.length !== 2) throw new $fdcc2c233c7ae6b6$export$f5ea4d073ddb4bdb("filters: inrange takes [min, max]");
11789
+ return clause("".concat(field, ":[").concat(min, "..").concat(max, "]"));
11790
+ }
11791
+ default:
11792
+ throw new $fdcc2c233c7ae6b6$export$f5ea4d073ddb4bdb("filters: unknown op ".concat(op));
11793
+ }
11794
+ }
11795
+ function $fdcc2c233c7ae6b6$export$407f30f25da13cc7(filters, index) {
11796
+ const clauses = filters.flatMap(filter => {
11797
+ var _v3_filter_to_clause$, _v3_filter_to_clause;
11798
+ return (_v3_filter_to_clause$ = (_v3_filter_to_clause = $fdcc2c233c7ae6b6$export$c17bb5d2ead3e8f3(filter, index)) === null || _v3_filter_to_clause === void 0 ? void 0 : _v3_filter_to_clause.clause_) !== null && _v3_filter_to_clause$ !== void 0 ? _v3_filter_to_clause$ : [];
11799
+ });
11800
+ return clauses.length ? clauses.join(" && ") : undefined;
11801
+ }
11802
+ function $fdcc2c233c7ae6b6$export$c38de645260a41ed(error, clauses) {
11803
+ var _match, _error$message;
11804
+ if (!error || !clauses.length) return [];
11805
+ const named = (_match = ((_error$message = error.message) !== null && _error$message !== void 0 ? _error$message : "").match(/"([A-Za-z0-9_.-]+)/)) === null || _match === void 0 ? void 0 : _match[1];
11806
+ if (error.code === "unknown_filter_field") {
11807
+ if (error.allowed) {
11808
+ const allowed = new Set(error.allowed);
11809
+ return clauses.filter(clause => !allowed.has(clause.field_));
11810
+ }
11811
+ return clauses.filter(clause => clause.field_ === named);
11812
+ }
11813
+ if (error.code === "invalid_filter") {
11814
+ const on_field = clauses.filter(clause => clause.field_ === named);
11815
+ return on_field.length ? on_field : [...clauses];
11816
+ }
11817
+ return [];
11818
+ }
11819
+ function $fdcc2c233c7ae6b6$export$78eb8e636d89ff30(sort) {
11820
+ var _V4_SORT$sort$field;
11821
+ if (!sort || sort.field === "_relevance") return undefined;
11822
+ return {
11823
+ field: (_V4_SORT$sort$field = $fdcc2c233c7ae6b6$var$V4_SORT[sort.field]) !== null && _V4_SORT$sort$field !== void 0 ? _V4_SORT$sort$field : sort.field,
11824
+ order: sort.order
11825
+ };
11826
+ }
11827
+ function $fdcc2c233c7ae6b6$export$cd08b64be5110ce2(sorts) {
11828
+ return sorts.map(sort => {
11829
+ var _V3_SORT$sort$field;
11830
+ return {
11831
+ field: (_V3_SORT$sort$field = $fdcc2c233c7ae6b6$var$V3_SORT[sort.field]) !== null && _V3_SORT$sort$field !== void 0 ? _V3_SORT$sort$field : sort.field,
11832
+ order: sort.order,
11833
+ meta: {
11834
+ title: sort.title,
11835
+ values: [sort.order],
11836
+ names: [sort.title]
11837
+ }
11838
+ };
11839
+ });
11840
+ }
11841
+ const $fdcc2c233c7ae6b6$var$V3_VALUES_TYPE = {
11842
+ checkbox: "checkbox",
11843
+ radio: "radio",
11844
+ swatch: "checkbox-color",
11845
+ hierarchy: "checkbox-hierarchical",
11846
+ grid: "checkbox-grid"
11847
+ };
11848
+ /** A toggle is a template facet's one `true` value. */
11849
+ function $fdcc2c233c7ae6b6$var$is_toggle(facet) {
11850
+ return $fdcc2c233c7ae6b6$var$V3_TOGGLES.has(facet.field) && facet.type === "checkbox" && facet.values.length === 1 && facet.values[0].value === "true";
11851
+ }
11852
+ function $fdcc2c233c7ae6b6$var$category_path(value) {
11853
+ return value.split("#").map(level => level.trim()).filter(Boolean);
11854
+ }
11855
+ function $fdcc2c233c7ae6b6$export$da9af372695714ef(facets, currency) {
11856
+ return facets.filter(facet => facet.type === "range" || facet.values.length > 0).map(facet => {
11857
+ var _V3_FIELD$facet$field, _V3_VALUES_TYPE$facet;
11858
+ const field = (_V3_FIELD$facet$field = $fdcc2c233c7ae6b6$var$V3_FIELD[facet.field]) !== null && _V3_FIELD$facet$field !== void 0 ? _V3_FIELD$facet$field : facet.field;
11859
+ if (facet.type === "range") return {
11860
+ field: field,
11861
+ op: "inrange",
11862
+ data: [facet.min, facet.max],
11863
+ meta: {
11864
+ group_title: facet.title,
11865
+ type: "range",
11866
+ min: facet.min,
11867
+ max: facet.max,
11868
+ ...(facet.field === "price" && currency ? {
11869
+ currency: currency
11870
+ } : {})
11871
+ },
11872
+ id: "".concat(field, "1")
11873
+ };
11874
+ const hierarchy = facet.type === "hierarchy";
11875
+ const path = value => $fdcc2c233c7ae6b6$var$CATEGORY_TREE_FIELDS.has(facet.field) ? $fdcc2c233c7ae6b6$var$category_path(value) : value.split($fdcc2c233c7ae6b6$var$HIERARCHY_SEPARATOR);
11876
+ if ($fdcc2c233c7ae6b6$var$is_toggle(facet)) return {
11877
+ field: field,
11878
+ op: "eq",
11879
+ meta: {
11880
+ type: "checkbox",
11881
+ values: facet.values.map(value => value.value),
11882
+ counts: facet.values.map(value => value.count),
11883
+ names: facet.values.map(value => value.label)
11884
+ },
11885
+ id: "".concat(field, "1")
11886
+ };
11887
+ // Two spellings of one category path are one row in the tree.
11888
+ const seen = new Set();
11889
+ const values = $fdcc2c233c7ae6b6$var$CATEGORY_TREE_FIELDS.has(facet.field) ? facet.values.filter(_ref3 => {
11890
+ let {
11891
+ value: value
11892
+ } = _ref3;
11893
+ const levels = path(value);
11894
+ const key = JSON.stringify(levels);
11895
+ if (levels.length === 0 || seen.has(key)) return false;
11896
+ seen.add(key);
11897
+ return true;
11898
+ }) : facet.values;
11899
+ return {
11900
+ field: field,
11901
+ op: facet.field === "discount" ? "geq" : "in",
11902
+ meta: {
11903
+ group_title: facet.title,
11904
+ type: (_V3_VALUES_TYPE$facet = $fdcc2c233c7ae6b6$var$V3_VALUES_TYPE[facet.type]) !== null && _V3_VALUES_TYPE$facet !== void 0 ? _V3_VALUES_TYPE$facet : "checkbox",
11905
+ values: values.map(value => hierarchy ? path(value.value) : value.value),
11906
+ counts: values.map(value => value.count),
11907
+ names: values.map(value => hierarchy ? path(value.value).slice(-1)[0] : value.label),
11908
+ // The colour template sends swatches only with one to paint; a colour filter always sends them.
11909
+ ...(facet.type === "swatch" && (facet.field !== $fdcc2c233c7ae6b6$var$V3_TEMPLATE_COLOUR || facet.values.some(value => value.swatch)) ? {
11910
+ swatches: facet.values.map(value => {
11911
+ var _value$swatch;
11912
+ return (_value$swatch = value.swatch) !== null && _value$swatch !== void 0 ? _value$swatch : null;
11913
+ })
11914
+ } : {})
11915
+ },
11916
+ id: "".concat(field, "1")
11917
+ };
11918
+ });
11919
+ }
11920
+ function $fdcc2c233c7ae6b6$export$b84a41a5163c4fce(content) {
11921
+ return content.map(hit => {
11922
+ var _hit$highlights;
11923
+ return {
11924
+ type: "content_link",
11925
+ title: hit.title,
11926
+ ...(hit.description !== undefined ? {
11927
+ description: hit.description
11928
+ } : {}),
11929
+ ...(hit.image_url !== undefined ? {
11930
+ image_url: hit.image_url
11931
+ } : {}),
11932
+ page_url: hit.url,
11933
+ highlights: (_hit$highlights = hit.highlights) !== null && _hit$highlights !== void 0 ? _hit$highlights : []
11934
+ };
11935
+ });
11936
+ }
11937
+ function $efe3f499b0d72444$export$efb7dd882d411dd4(response, door, offset) {
11938
+ var _response$total, _response$sorts, _response$facets, _response$content;
11939
+ const tracking_key = door === "search" ? "search_result_id" : "product_listing_result_id";
11940
+ return {
11941
+ n_hits: (_response$total = response.total) !== null && _response$total !== void 0 ? _response$total : offset + response.products.length,
11942
+ sorts: $fdcc2c233c7ae6b6$export$cd08b64be5110ce2((_response$sorts = response.sorts) !== null && _response$sorts !== void 0 ? _response$sorts : []),
11943
+ filters: $fdcc2c233c7ae6b6$export$da9af372695714ef((_response$facets = response.facets) !== null && _response$facets !== void 0 ? _response$facets : [], response.currency),
11944
+ ...(door === "search" ? {
11945
+ search_request_id: response.request_id,
11946
+ content_search_links: $fdcc2c233c7ae6b6$export$b84a41a5163c4fce((_response$content = response.content) !== null && _response$content !== void 0 ? _response$content : []),
11947
+ is_fallback: null
11948
+ } : {
11949
+ product_listing_request_id: response.request_id
11950
+ }),
11951
+ ...(response.cursor !== undefined ? {
11952
+ cursor: response.cursor
11953
+ } : {}),
11954
+ displays: response.products.map(product => $d05d7bcd4b59b266$export$7abfb7bc025aaea8(product, tracking_key))
11955
+ };
11956
+ }
11957
+ function $efe3f499b0d72444$var$listing_ref_to_v3(ref, listing_type, show) {
11958
+ return {
11959
+ listing_id: ref.id,
11960
+ ...(ref.external_id !== undefined ? {
11961
+ external_id: ref.external_id
11962
+ } : {}),
11963
+ listing_type: listing_type,
11964
+ ...show,
11965
+ image_urls: [],
11966
+ title: ref.title,
11967
+ ...(ref.slug !== undefined ? {
11968
+ slug: ref.slug
11969
+ } : {})
11970
+ };
11971
+ }
11972
+ function $efe3f499b0d72444$export$996f2b1e66d9b5af(listing) {
11973
+ const listing_type = listing.type;
11974
+ const quick_links_are_siblings = listing.quick_links.some(link => link.id === listing.id);
11975
+ const quick_links = listing.quick_links.map(link => $efe3f499b0d72444$var$listing_ref_to_v3(link, listing_type, {
11976
+ show_in_breadcrumbs: true,
11977
+ show_in_quicklinks: true
11978
+ }));
11979
+ return {
11980
+ listing_id: listing.id,
11981
+ ...(listing.external_id !== undefined ? {
11982
+ external_id: listing.external_id
11983
+ } : {}),
11984
+ listing_type: listing_type,
11985
+ show_in_breadcrumbs: listing.show_in_breadcrumbs,
11986
+ show_in_quicklinks: true,
11987
+ image_urls: listing.images,
11988
+ title: listing.title,
11989
+ ...(listing.slug !== undefined ? {
11990
+ slug: listing.slug
11991
+ } : {}),
11992
+ ancestors: listing.breadcrumbs.map(ref => $efe3f499b0d72444$var$listing_ref_to_v3(ref, "category", {
11993
+ show_in_breadcrumbs: true,
11994
+ show_in_quicklinks: true
11995
+ })),
11996
+ siblings: quick_links_are_siblings ? quick_links : [],
11997
+ children: quick_links_are_siblings ? [] : quick_links,
11998
+ content_blocks: listing.content_blocks
11999
+ };
12000
+ }
12001
+ function $efe3f499b0d72444$export$76d96892da63b395(tree) {
12002
+ const by_id = new Map();
12003
+ const walk = (nodes, chain) => {
12004
+ for (const node of nodes) {
12005
+ if (!by_id.has(node.id)) by_id.set(node.id, chain);
12006
+ walk(node.children, [...chain, $efe3f499b0d72444$var$listing_ref_to_v3(node, node.type, {
12007
+ show_in_breadcrumbs: true,
12008
+ show_in_quicklinks: true
12009
+ })]);
12010
+ }
12011
+ };
12012
+ walk(tree, []);
12013
+ return listing_id => by_id.get(listing_id);
12014
+ }
12015
+ function $efe3f499b0d72444$export$2860125b419015f8(response, ancestors_of) {
12016
+ return {
12017
+ suggestions_request_id: response.request_id,
12018
+ suggestions: response.suggestions.map(suggestion => {
12019
+ if (suggestion.type === "query") return {
12020
+ type: "query",
12021
+ query: suggestion.query,
12022
+ suggestions_result_id: ""
12023
+ };
12024
+ const from_tree = ancestors_of === null || ancestors_of === void 0 ? void 0 : ancestors_of(suggestion.listing.id);
12025
+ const ancestors = from_tree && $efe3f499b0d72444$var$same_titles(from_tree, suggestion.path) ? from_tree : [];
12026
+ return {
12027
+ type: "listing",
12028
+ listing_id: suggestion.listing.id,
12029
+ ...(suggestion.listing.external_id !== undefined ? {
12030
+ external_id: suggestion.listing.external_id
12031
+ } : {}),
12032
+ listing_type: suggestion.listing.type,
12033
+ show_in_breadcrumbs: true,
12034
+ show_in_quicklinks: true,
12035
+ image_urls: suggestion.listing.images,
12036
+ title: suggestion.listing.title,
12037
+ ...(suggestion.listing.slug !== undefined ? {
12038
+ slug: suggestion.listing.slug
12039
+ } : {}),
12040
+ suggestions_result_id: "",
12041
+ ancestors: ancestors
12042
+ };
12043
+ })
12044
+ };
12045
+ }
12046
+ const $efe3f499b0d72444$var$same_titles = (ancestors, path) => ancestors.length === path.length && ancestors.every((ancestor, index) => ancestor.title === path[index]);
12047
+ /** `encodeURIComponent`, as V4's own encoder writes a value (`+` would mean a space). */
12048
+ const $efe3f499b0d72444$var$encode = value => encodeURIComponent(value);
12049
+ function $efe3f499b0d72444$export$7659319cdb555579(request) {
12050
+ var _request$include;
12051
+ const pairs = ["market=".concat($efe3f499b0d72444$var$encode(request.market))];
12052
+ const add = (key, value) => value !== undefined && pairs.push("".concat(key, "=").concat(value));
12053
+ add("locale", request.locale === undefined ? undefined : $efe3f499b0d72444$var$encode(request.locale));
12054
+ add("query", request.query === undefined ? undefined : $efe3f499b0d72444$var$encode(request.query));
12055
+ if (request.listing && "id" in request.listing) add("listing", $efe3f499b0d72444$var$encode(request.listing.id));else if (request.listing) add("listing_external_id", $efe3f499b0d72444$var$encode(request.listing.external_id));
12056
+ add("filter_by", request.filter_by === undefined ? undefined : $efe3f499b0d72444$var$encode(request.filter_by));
12057
+ if (request.sort) add("sort", "".concat($efe3f499b0d72444$var$encode(request.sort.field), ".").concat(request.sort.order));
12058
+ add("include", (_request$include = request.include) === null || _request$include === void 0 ? void 0 : _request$include.join(","));
12059
+ add("cursor", request.cursor);
12060
+ add("limit", request.limit === undefined ? undefined : String(request.limit));
12061
+ return pairs.join("&");
12062
+ }
12063
+ function $efe3f499b0d72444$export$fec3e4b5adfcea2c(params) {
12064
+ return params.filter(pair => pair[1] !== undefined).map(_ref => {
12065
+ let [key, value] = _ref;
12066
+ return "".concat(key, "=").concat($efe3f499b0d72444$var$encode(value));
12067
+ }).join("&");
12068
+ }
12069
+ function $efe3f499b0d72444$export$eb90c08da400512d(locale) {
12070
+ return locale ? locale.replace(/_/g, "-") : undefined;
12071
+ }
12072
+
12073
+ /** realtime's related search page: the hits related recommendations anchor on and never repeat. */
12074
+ const $5255d5015f3bff20$var$RELATED_SEARCH_PAGE = 100;
12075
+ const $5255d5015f3bff20$var$get_recommendations = (merchant, request) => $a881711b2a93404e$export$88d793e3827f3436($a881711b2a93404e$export$b6dad15503f66988(merchant, "/recommendations") + "?" + $a9dd796a4aeb6bd4$export$fc756666ac777d0(request));
12076
+ const $5255d5015f3bff20$var$to_displays = products => products.map(product => $d05d7bcd4b59b266$export$7abfb7bc025aaea8(product, "recommendation_id"));
12077
+ async function $5255d5015f3bff20$export$656ee5c46d5d1eda(call) {
12078
+ var _response$used_inputs;
12079
+ const {
12080
+ merchant: merchant
12081
+ } = call;
12082
+ const types = await $a1878713ea20ea2c$export$869eb14d6f85ac51(merchant);
12083
+ const inputs = types === null || types === void 0 ? void 0 : types.get(call.type);
12084
+ if (types && !inputs) {
12085
+ $b8hua$dwarn("[NativeDepictAPI] V4 serves ".concat(merchant, ' no recommendation type "').concat(call.type, '"; known:'), [...types.keys()]);
12086
+ return [];
12087
+ }
12088
+ const request = $a9dd796a4aeb6bd4$export$17493dc1a89b34e6({
12089
+ ...call,
12090
+ locale: $efe3f499b0d72444$export$eb90c08da400512d(call.locale)
12091
+ }, inputs, inputs !== null && inputs !== void 0 && inputs.includes("recent_views") ? $67005db9d7b669bc$export$2d7138f47b625a04(merchant) : []);
12092
+ if (!request) return [];
12093
+ const response = await $5255d5015f3bff20$var$get_recommendations(merchant, request);
12094
+ if (!response) return [];
12095
+ const anchor = (_response$used_inputs = response.used_inputs) === null || _response$used_inputs === void 0 ? void 0 : _response$used_inputs.anchor;
12096
+ if (call.productId && (anchor === null || anchor === void 0 ? void 0 : anchor.type) === "product") $67005db9d7b669bc$export$6379943de8f8af08(merchant, anchor.id);
12097
+ return $5255d5015f3bff20$var$to_displays(response.products);
12098
+ }
12099
+ async function $5255d5015f3bff20$export$bd5f8a7d3e47a43d(call) {
12100
+ var _types$get, _types$get2, _call$query;
12101
+ const {
12102
+ merchant: merchant,
12103
+ market: market
12104
+ } = call;
12105
+ const types = await $a1878713ea20ea2c$export$869eb14d6f85ac51(merchant);
12106
+ if (!types) return undefined;
12107
+ const type = (_types$get = types.get("search")) !== null && _types$get !== void 0 && _types$get.includes("anchor") ? "search" : (_types$get2 = types.get("similar")) !== null && _types$get2 !== void 0 && _types$get2.includes("anchor") ? "similar" : undefined;
12108
+ if (!type) {
12109
+ $b8hua$dwarn("[NativeDepictAPI] V4 serves ".concat(merchant, " no search or similar recommendations for related products"));
12110
+ return [];
12111
+ }
12112
+ const locale = $efe3f499b0d72444$export$eb90c08da400512d(call.locale);
12113
+ const query = ((_call$query = call.query) === null || _call$query === void 0 ? void 0 : _call$query.trim()) || undefined;
12114
+ const searched = await $a881711b2a93404e$export$88d793e3827f3436($a881711b2a93404e$export$b6dad15503f66988(merchant, "/browse") + "?" + $efe3f499b0d72444$export$7659319cdb555579({
12115
+ market: market,
12116
+ ...(locale ? {
12117
+ locale: locale
12118
+ } : {}),
12119
+ ...(query ? {
12120
+ query: query
12121
+ } : {}),
12122
+ limit: $5255d5015f3bff20$var$RELATED_SEARCH_PAGE
12123
+ }));
12124
+ if (!searched) return undefined;
12125
+ const asked = $a9dd796a4aeb6bd4$export$afe6aeae61a7aa58(searched.products, {
12126
+ market: market,
12127
+ ...(locale ? {
12128
+ locale: locale
12129
+ } : {})
12130
+ }, type);
12131
+ if (!asked.length) return [];
12132
+ const answers = await Promise.all(asked.map(request => $5255d5015f3bff20$var$get_recommendations(merchant, request)));
12133
+ const lists = answers.filter(answer => !!answer).map(answer => answer.products);
12134
+ if (!lists.length) return undefined;
12135
+ const products = lists.length > 1 ? $a9dd796a4aeb6bd4$export$9af50be6508dcd00(lists, Math.max(...lists.map(list => list.length))) : lists[0];
12136
+ return $5255d5015f3bff20$var$to_displays(products);
12137
+ }
11295
12138
  async function $50aebf5b445518eb$export$58e808b1db15d3bc(options) {
12139
+ if (options.api === "v4") return await $50aebf5b445518eb$var$fetch_native(options);
11296
12140
  const headers = options.headers;
11297
12141
  const product_id = options.productId || options.product_id; // Second fallback here is just because there was very little missing to make this work with snake_case input and in case someone puts in snake case'd stuff already (preview browser did) we can easily not break it
11298
12142
  const cleaned_up_options = $b8hua$snakeCasifyObject(options);
11299
12143
  delete cleaned_up_options.headers;
11300
12144
  delete cleaned_up_options.product_id;
12145
+ delete cleaned_up_options.api;
11301
12146
  cleaned_up_options.session_id || (cleaned_up_options.session_id = $b8hua$get_session_id());
11302
12147
  if (product_id && !cleaned_up_options.product_ids) cleaned_up_options.product_ids = [product_id];
11303
12148
  const options_to_send = cleaned_up_options;
@@ -11320,6 +12165,33 @@ async function $50aebf5b445518eb$export$58e808b1db15d3bc(options) {
11320
12165
  return ((_decoded = decoded) === null || _decoded === void 0 ? void 0 : _decoded.displays) || [];
11321
12166
  });
11322
12167
  }
12168
+ async function $50aebf5b445518eb$var$fetch_native(options) {
12169
+ const {
12170
+ merchant: merchant,
12171
+ market: market,
12172
+ locale: locale,
12173
+ type: type,
12174
+ headers: headers,
12175
+ categoryId: categoryId,
12176
+ productIds: productIds
12177
+ } = options;
12178
+ if (headers) $b8hua$dwarn("fetchDepictRecommendations: headers aren't sent to the native V4 API", headers);
12179
+ try {
12180
+ return await $5255d5015f3bff20$export$656ee5c46d5d1eda({
12181
+ merchant: merchant,
12182
+ market: market,
12183
+ locale: locale,
12184
+ type: type,
12185
+ categoryId: categoryId,
12186
+ productId: options.productId || options.product_id,
12187
+ productIds: productIds,
12188
+ limit: options.limit
12189
+ });
12190
+ } catch (e) {
12191
+ $b8hua$dlog("fetch_native_recommendations threw", e);
12192
+ return [];
12193
+ }
12194
+ }
11323
12195
  var $702d7656a373973e$var$_tmpl$ = ["<div", ' class="sort-and-filter-buttons fake" aria-hidden="true" style="position:absolute;z-index:-1;pointer-events:none;opacity:0"><div class="outer"><div class="inner"><!--$-->', "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--></div></div></div>"];
11324
12196
  const $702d7656a373973e$export$824dde41348efed1 = /*@__PURE__*/(() => {
11325
12197
  const actual_function = _ref => {
@@ -11614,6 +12486,11 @@ function $284849364a6ef73a$var$_classPrivateMethodGet(receiver, privateSet, fn)
11614
12486
  }
11615
12487
  const $284849364a6ef73a$var$v3_base_url = (0, $b8hua$base_url) + "/v3/";
11616
12488
  const $284849364a6ef73a$var$search_base_url = $284849364a6ef73a$var$v3_base_url + "search/";
12489
+ /**
12490
+ * One read DepictAPI makes, as the transport sees it. `request_` is the v3 request as DepictAPI would send it (with
12491
+ * session_id and metadata added), `body_` its JSON. A transport answers with the v3-shaped JSON response, or undefined
12492
+ * when the request failed (DepictAPI then serves its fallback response).
12493
+ */
11617
12494
  var $284849364a6ef73a$var$_supports_finalization_registry = /*#__PURE__*/new WeakMap();
11618
12495
  var $284849364a6ef73a$var$_cache_objs = /*#__PURE__*/new WeakMap();
11619
12496
  var $284849364a6ef73a$var$_get_cache_obj_for_endpoint = /*#__PURE__*/new WeakSet();
@@ -11628,7 +12505,29 @@ class $284849364a6ef73a$export$e015ed2f2950f2e3 {
11628
12505
  * Runs the displayTransformer for the suggest endpoints results
11629
12506
  */ /**
11630
12507
  * rest = everything except query suggestions
11631
- */
12508
+ */ /**
12509
+ * The network step of every read: sends `call` to the v3 API and returns the decoded JSON, or undefined when the
12510
+ * request failed. NativeDepictAPI overrides this to read the native V4 API instead and map its answers to v3 shapes,
12511
+ * so caching, display transformers and fallbacks stay the same for both.
12512
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12513
+ async request_raw_(call) {
12514
+ const {
12515
+ endpoint_: endpoint_,
12516
+ method_: method_,
12517
+ request_: request_,
12518
+ body_: body_
12519
+ } = call;
12520
+ const is_post = method_ === "POST";
12521
+ const url_to_request = is_post ? endpoint_ : $b8hua$make_url_with_query_params(endpoint_, request_);
12522
+ const api_response = await $b8hua$fetch_retry($b8hua$add_version_query_params(url_to_request), {
12523
+ method: method_,
12524
+ ...(is_post ? {
12525
+ body: body_
12526
+ } : {})
12527
+ });
12528
+ if (!api_response || call.kind_ !== "suggest" && api_response.status !== 200) return undefined;
12529
+ return await api_response.json();
12530
+ }
11632
12531
  constructor(options) {
11633
12532
  $284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$_cached_request);
11634
12533
  $284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$_run_display_transformers_for_rest);
@@ -11678,11 +12577,13 @@ class $284849364a6ef73a$export$e015ed2f2950f2e3 {
11678
12577
  const request = metaData ? Object.assign(with_ids, {
11679
12578
  metadata: JSON.stringify(metaData)
11680
12579
  }) : with_ids;
11681
- const url = $b8hua$make_url_with_query_params($284849364a6ef73a$var$search_base_url + "suggestions", request);
11682
- const results = await $b8hua$fetch_retry($b8hua$add_version_query_params(url));
11683
12580
  attempt_to_return_api_response: {
11684
- if (!results) break attempt_to_return_api_response;
11685
- const decoded_json = await results.json();
12581
+ const decoded_json = await this.request_raw_({
12582
+ kind_: "suggest",
12583
+ endpoint_: $284849364a6ef73a$var$search_base_url + "suggestions",
12584
+ method_: "GET",
12585
+ request_: request
12586
+ });
11686
12587
  if (!Array.isArray(decoded_json === null || decoded_json === void 0 ? void 0 : decoded_json.suggestions)) break attempt_to_return_api_response;
11687
12588
  try {
11688
12589
  return await $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_run_url_creator_for_suggest, $284849364a6ef73a$var$_run_url_creator_for_suggest2).call(this, input_req.merchant, input_req.market, input_req.locale, decoded_json);
@@ -11699,6 +12600,7 @@ class $284849364a6ef73a$export$e015ed2f2950f2e3 {
11699
12600
  async query(input_req) {
11700
12601
  return await $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_cached_request, $284849364a6ef73a$var$_cached_request2).call(this, {
11701
12602
  endpoint_: $284849364a6ef73a$var$search_base_url + "results",
12603
+ kind_: "search",
11702
12604
  input_req_: input_req,
11703
12605
  fallback_response_: () => ({
11704
12606
  "n_hits": 0,
@@ -11719,6 +12621,9 @@ class $284849364a6ef73a$export$e015ed2f2950f2e3 {
11719
12621
  return await $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_cached_request, $284849364a6ef73a$var$_cached_request2).call(this, {
11720
12622
  endpoint_: $284849364a6ef73a$var$v3_base_url + "listings/" + (id_type_ === $397620a4d7958ed1$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_),
11721
12623
  input_req_: input_req,
12624
+ kind_: "listing",
12625
+ id_to_query_for_: id_to_query_for_,
12626
+ id_type_: id_type_,
11722
12627
  fallback_response_: () => ({
11723
12628
  listing_id: "",
11724
12629
  listing_type: "category",
@@ -11746,6 +12651,9 @@ class $284849364a6ef73a$export$e015ed2f2950f2e3 {
11746
12651
  endpoint_: $284849364a6ef73a$var$v3_base_url + "listings/" + (id_type_ === $397620a4d7958ed1$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_) + "/products",
11747
12652
  input_req_: input_req_,
11748
12653
  currentListingForTransformer_: currentListingForTransformer_,
12654
+ kind_: "listing_products",
12655
+ id_to_query_for_: id_to_query_for_,
12656
+ id_type_: id_type_,
11749
12657
  fallback_response_: () => ({
11750
12658
  "n_hits": 0,
11751
12659
  "displays": [],
@@ -11759,6 +12667,7 @@ class $284849364a6ef73a$export$e015ed2f2950f2e3 {
11759
12667
  async get_recommended(input_req) {
11760
12668
  return await $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_cached_request, $284849364a6ef73a$var$_cached_request2).call(this, {
11761
12669
  endpoint_: $284849364a6ef73a$var$search_base_url + "related",
12670
+ kind_: "related",
11762
12671
  input_req_: input_req,
11763
12672
  fallback_response_: () => ({
11764
12673
  displays: []
@@ -11873,7 +12782,10 @@ async function $284849364a6ef73a$var$_cached_request2(_ref4) {
11873
12782
  input_req_: input_req_,
11874
12783
  fallback_response_: fallback_response_,
11875
12784
  method_ = "POST",
11876
- currentListingForTransformer_: currentListingForTransformer_
12785
+ currentListingForTransformer_: currentListingForTransformer_,
12786
+ kind_: kind_,
12787
+ id_to_query_for_: id_to_query_for_,
12788
+ id_type_: id_type_
11877
12789
  } = _ref4;
11878
12790
  const cache_obj = $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_get_cache_obj_for_endpoint, $284849364a6ef73a$var$_get_cache_obj_for_endpoint2).call(this, endpoint_);
11879
12791
  const with_ids = $b8hua$babelruntimehelpersclassPrivateFieldGet(this, $284849364a6ef73a$var$_add_ids_to_request).call(this, input_req_);
@@ -11890,19 +12802,19 @@ async function $284849364a6ef73a$var$_cached_request2(_ref4) {
11890
12802
  let resolve_in_progress;
11891
12803
  cache_obj.in_progress_[body] = new Promise(r => resolve_in_progress = r);
11892
12804
  try {
11893
- const is_post = method_ === "POST";
11894
- const url_to_request = is_post ? endpoint_ : $b8hua$make_url_with_query_params(endpoint_, sorted_request);
11895
- const api_response = await $b8hua$fetch_retry($b8hua$add_version_query_params(url_to_request), {
11896
- method: method_,
11897
- ...(is_post ? {
11898
- body: body
11899
- } : {})
11900
- });
11901
12805
  return_successfully: {
11902
- if (!api_response || api_response.status !== 200) break return_successfully;
11903
12806
  let result;
11904
12807
  try {
11905
- const unmodified_result = await api_response.json();
12808
+ const unmodified_result = await this.request_raw_({
12809
+ kind_: kind_,
12810
+ endpoint_: endpoint_,
12811
+ method_: method_,
12812
+ request_: sorted_request,
12813
+ body_: body,
12814
+ id_to_query_for_: id_to_query_for_,
12815
+ id_type_: id_type_
12816
+ });
12817
+ if (unmodified_result === undefined) break return_successfully;
11906
12818
  result = await $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_run_display_transformers_for_rest, $284849364a6ef73a$var$_run_display_transformers_for_rest2).call(this, input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result, currentListingForTransformer_);
11907
12819
  } catch (e) {
11908
12820
  $b8hua$dwarn("displayTransformer or json decoding failed", e);
@@ -11930,6 +12842,283 @@ async function $284849364a6ef73a$var$_cached_request2(_ref4) {
11930
12842
  delete cache_obj.in_progress_[body];
11931
12843
  }
11932
12844
  }
12845
+ function $bd9b4aebfb84ca47$var$_classPrivateMethodInitSpec(obj, privateSet) {
12846
+ $bd9b4aebfb84ca47$var$_checkPrivateRedeclaration(obj, privateSet);
12847
+ privateSet.add(obj);
12848
+ }
12849
+ function $bd9b4aebfb84ca47$var$_classPrivateFieldInitSpec(obj, privateMap, value) {
12850
+ $bd9b4aebfb84ca47$var$_checkPrivateRedeclaration(obj, privateMap);
12851
+ privateMap.set(obj, value);
12852
+ }
12853
+ function $bd9b4aebfb84ca47$var$_checkPrivateRedeclaration(obj, privateCollection) {
12854
+ if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
12855
+ }
12856
+ function $bd9b4aebfb84ca47$var$_classPrivateMethodGet(receiver, privateSet, fn) {
12857
+ if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
12858
+ return fn;
12859
+ }
12860
+ /** V4 browse's largest page; a bigger v3 page is V4's pages chained by their cursors, as the facade does. */
12861
+ const $bd9b4aebfb84ca47$var$BROWSE_MAX_LIMIT = 100;
12862
+ /** V4 browse's page size without a limit, and v3's. */
12863
+ const $bd9b4aebfb84ca47$var$DEFAULT_LIMIT = 24;
12864
+ /** A query with no letter or digit browses the catalogue instead of returning an empty grid, as on v3. */
12865
+ const $bd9b4aebfb84ca47$var$HAS_LETTER_OR_DIGIT = /[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\u{10000}-\u{1000B}\u{1000D}-\u{10026}\u{10028}-\u{1003A}\u{1003C}\u{1003D}\u{1003F}-\u{1004D}\u{10050}-\u{1005D}\u{10080}-\u{100FA}\u{10107}-\u{10133}\u{10140}-\u{10178}\u{1018A}\u{1018B}\u{10280}-\u{1029C}\u{102A0}-\u{102D0}\u{102E1}-\u{102FB}\u{10300}-\u{10323}\u{1032D}-\u{1034A}\u{10350}-\u{10375}\u{10380}-\u{1039D}\u{103A0}-\u{103C3}\u{103C8}-\u{103CF}\u{103D1}-\u{103D5}\u{10400}-\u{1049D}\u{104A0}-\u{104A9}\u{104B0}-\u{104D3}\u{104D8}-\u{104FB}\u{10500}-\u{10527}\u{10530}-\u{10563}\u{10570}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10597}-\u{105A1}\u{105A3}-\u{105B1}\u{105B3}-\u{105B9}\u{105BB}\u{105BC}\u{10600}-\u{10736}\u{10740}-\u{10755}\u{10760}-\u{10767}\u{10780}-\u{10785}\u{10787}-\u{107B0}\u{107B2}-\u{107BA}\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10858}-\u{10876}\u{10879}-\u{1089E}\u{108A7}-\u{108AF}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{108FB}-\u{1091B}\u{10920}-\u{10939}\u{10980}-\u{109B7}\u{109BC}-\u{109CF}\u{109D2}-\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A40}-\u{10A48}\u{10A60}-\u{10A7E}\u{10A80}-\u{10A9F}\u{10AC0}-\u{10AC7}\u{10AC9}-\u{10AE4}\u{10AEB}-\u{10AEF}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B58}-\u{10B72}\u{10B78}-\u{10B91}\u{10BA9}-\u{10BAF}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10CFA}-\u{10D23}\u{10D30}-\u{10D39}\u{10E60}-\u{10E7E}\u{10E80}-\u{10EA9}\u{10EB0}\u{10EB1}\u{10F00}-\u{10F27}\u{10F30}-\u{10F45}\u{10F51}-\u{10F54}\u{10F70}-\u{10F81}\u{10FB0}-\u{10FCB}\u{10FE0}-\u{10FF6}\u{11003}-\u{11037}\u{11052}-\u{1106F}\u{11071}\u{11072}\u{11075}\u{11083}-\u{110AF}\u{110D0}-\u{110E8}\u{110F0}-\u{110F9}\u{11103}-\u{11126}\u{11136}-\u{1113F}\u{11144}\u{11147}\u{11150}-\u{11172}\u{11176}\u{11183}-\u{111B2}\u{111C1}-\u{111C4}\u{111D0}-\u{111DA}\u{111DC}\u{111E1}-\u{111F4}\u{11200}-\u{11211}\u{11213}-\u{1122B}\u{1123F}\u{11240}\u{11280}-\u{11286}\u{11288}\u{1128A}-\u{1128D}\u{1128F}-\u{1129D}\u{1129F}-\u{112A8}\u{112B0}-\u{112DE}\u{112F0}-\u{112F9}\u{11305}-\u{1130C}\u{1130F}\u{11310}\u{11313}-\u{11328}\u{1132A}-\u{11330}\u{11332}\u{11333}\u{11335}-\u{11339}\u{1133D}\u{11350}\u{1135D}-\u{11361}\u{11400}-\u{11434}\u{11447}-\u{1144A}\u{11450}-\u{11459}\u{1145F}-\u{11461}\u{11480}-\u{114AF}\u{114C4}\u{114C5}\u{114C7}\u{114D0}-\u{114D9}\u{11580}-\u{115AE}\u{115D8}-\u{115DB}\u{11600}-\u{1162F}\u{11644}\u{11650}-\u{11659}\u{11680}-\u{116AA}\u{116B8}\u{116C0}-\u{116C9}\u{11700}-\u{1171A}\u{11730}-\u{1173B}\u{11740}-\u{11746}\u{11800}-\u{1182B}\u{118A0}-\u{118F2}\u{118FF}-\u{11906}\u{11909}\u{1190C}-\u{11913}\u{11915}\u{11916}\u{11918}-\u{1192F}\u{1193F}\u{11941}\u{11950}-\u{11959}\u{119A0}-\u{119A7}\u{119AA}-\u{119D0}\u{119E1}\u{119E3}\u{11A00}\u{11A0B}-\u{11A32}\u{11A3A}\u{11A50}\u{11A5C}-\u{11A89}\u{11A9D}\u{11AB0}-\u{11AF8}\u{11C00}-\u{11C08}\u{11C0A}-\u{11C2E}\u{11C40}\u{11C50}-\u{11C6C}\u{11C72}-\u{11C8F}\u{11D00}-\u{11D06}\u{11D08}\u{11D09}\u{11D0B}-\u{11D30}\u{11D46}\u{11D50}-\u{11D59}\u{11D60}-\u{11D65}\u{11D67}\u{11D68}\u{11D6A}-\u{11D89}\u{11D98}\u{11DA0}-\u{11DA9}\u{11EE0}-\u{11EF2}\u{11F02}\u{11F04}-\u{11F10}\u{11F12}-\u{11F33}\u{11F50}-\u{11F59}\u{11FB0}\u{11FC0}-\u{11FD4}\u{12000}-\u{12399}\u{12400}-\u{1246E}\u{12480}-\u{12543}\u{12F90}-\u{12FF0}\u{13000}-\u{1342F}\u{13441}-\u{13446}\u{14400}-\u{14646}\u{16800}-\u{16A38}\u{16A40}-\u{16A5E}\u{16A60}-\u{16A69}\u{16A70}-\u{16ABE}\u{16AC0}-\u{16AC9}\u{16AD0}-\u{16AED}\u{16B00}-\u{16B2F}\u{16B40}-\u{16B43}\u{16B50}-\u{16B59}\u{16B5B}-\u{16B61}\u{16B63}-\u{16B77}\u{16B7D}-\u{16B8F}\u{16E40}-\u{16E96}\u{16F00}-\u{16F4A}\u{16F50}\u{16F93}-\u{16F9F}\u{16FE0}\u{16FE1}\u{16FE3}\u{17000}-\u{187F7}\u{18800}-\u{18CD5}\u{18D00}-\u{18D08}\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}\u{1B000}-\u{1B122}\u{1B132}\u{1B150}-\u{1B152}\u{1B155}\u{1B164}-\u{1B167}\u{1B170}-\u{1B2FB}\u{1BC00}-\u{1BC6A}\u{1BC70}-\u{1BC7C}\u{1BC80}-\u{1BC88}\u{1BC90}-\u{1BC99}\u{1D2C0}-\u{1D2D3}\u{1D2E0}-\u{1D2F3}\u{1D360}-\u{1D378}\u{1D400}-\u{1D454}\u{1D456}-\u{1D49C}\u{1D49E}\u{1D49F}\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B9}\u{1D4BB}\u{1D4BD}-\u{1D4C3}\u{1D4C5}-\u{1D505}\u{1D507}-\u{1D50A}\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D51E}-\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D552}-\u{1D6A5}\u{1D6A8}-\u{1D6C0}\u{1D6C2}-\u{1D6DA}\u{1D6DC}-\u{1D6FA}\u{1D6FC}-\u{1D714}\u{1D716}-\u{1D734}\u{1D736}-\u{1D74E}\u{1D750}-\u{1D76E}\u{1D770}-\u{1D788}\u{1D78A}-\u{1D7A8}\u{1D7AA}-\u{1D7C2}\u{1D7C4}-\u{1D7CB}\u{1D7CE}-\u{1D7FF}\u{1DF00}-\u{1DF1E}\u{1DF25}-\u{1DF2A}\u{1E030}-\u{1E06D}\u{1E100}-\u{1E12C}\u{1E137}-\u{1E13D}\u{1E140}-\u{1E149}\u{1E14E}\u{1E290}-\u{1E2AD}\u{1E2C0}-\u{1E2EB}\u{1E2F0}-\u{1E2F9}\u{1E4D0}-\u{1E4EB}\u{1E4F0}-\u{1E4F9}\u{1E7E0}-\u{1E7E6}\u{1E7E8}-\u{1E7EB}\u{1E7ED}\u{1E7EE}\u{1E7F0}-\u{1E7FE}\u{1E800}-\u{1E8C4}\u{1E8C7}-\u{1E8CF}\u{1E900}-\u{1E943}\u{1E94B}\u{1E950}-\u{1E959}\u{1EC71}-\u{1ECAB}\u{1ECAD}-\u{1ECAF}\u{1ECB1}-\u{1ECB4}\u{1ED01}-\u{1ED2D}\u{1ED2F}-\u{1ED3D}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}\u{1F100}-\u{1F10C}\u{1FBF0}-\u{1FBF9}\u{20000}-\u{2A6DF}\u{2A700}-\u{2B739}\u{2B740}-\u{2B81D}\u{2B820}-\u{2CEA1}\u{2CEB0}-\u{2EBE0}\u{2F800}-\u{2FA1D}\u{30000}-\u{3134A}\u{31350}-\u{323AF}]/u;
12866
+ /** Which API an SDK reads: `v3` (the default) or the native V4 API (`https://api.depict.ai/v4/{merchant}/…`). */
12867
+ var $bd9b4aebfb84ca47$var$_facet_indices = /*#__PURE__*/new WeakMap();
12868
+ var $bd9b4aebfb84ca47$var$_learned = /*#__PURE__*/new WeakMap();
12869
+ var $bd9b4aebfb84ca47$var$_cursor_offsets = /*#__PURE__*/new WeakMap();
12870
+ var $bd9b4aebfb84ca47$var$_ancestor_lookups = /*#__PURE__*/new WeakMap();
12871
+ var $bd9b4aebfb84ca47$var$_rejected = /*#__PURE__*/new WeakMap();
12872
+ var $bd9b4aebfb84ca47$var$_merchant_url = /*#__PURE__*/new WeakSet();
12873
+ var $bd9b4aebfb84ca47$var$_get_json = /*#__PURE__*/new WeakSet();
12874
+ var $bd9b4aebfb84ca47$var$_get_answer = /*#__PURE__*/new WeakSet();
12875
+ var $bd9b4aebfb84ca47$var$_facet_index = /*#__PURE__*/new WeakSet();
12876
+ var $bd9b4aebfb84ca47$var$_browse_page = /*#__PURE__*/new WeakSet();
12877
+ var $bd9b4aebfb84ca47$var$_browse_answer = /*#__PURE__*/new WeakSet();
12878
+ var $bd9b4aebfb84ca47$var$_rejected_clauses = /*#__PURE__*/new WeakSet();
12879
+ var $bd9b4aebfb84ca47$var$_browse = /*#__PURE__*/new WeakSet();
12880
+ var $bd9b4aebfb84ca47$var$_listing = /*#__PURE__*/new WeakSet();
12881
+ var $bd9b4aebfb84ca47$var$_suggest = /*#__PURE__*/new WeakSet();
12882
+ var $bd9b4aebfb84ca47$var$_ancestors = /*#__PURE__*/new WeakSet();
12883
+ class $bd9b4aebfb84ca47$export$721afe49a594bed extends (0, $284849364a6ef73a$export$e015ed2f2950f2e3) {
12884
+ /** Facets served so far, per merchant, market and locale, to resolve v3 filter fields (group titles) to V4 fields. */ /** Browses whose facets were read only to resolve filter fields, so each is read at most once. */ /** How many products came before each cursor V4 handed out, for the lower-bound count when `total` is absent. */ /** Each listing's ancestors from the listing tree, per merchant, market and locale, read once a page load. */ /** Filter clauses V4 refused (`unknown_filter_field`, `invalid_filter`), per merchant, market and locale. */constructor(options) {
12885
+ super(options);
12886
+ $bd9b4aebfb84ca47$var$_classPrivateMethodInitSpec(this, $bd9b4aebfb84ca47$var$_ancestors);
12887
+ $bd9b4aebfb84ca47$var$_classPrivateMethodInitSpec(this, $bd9b4aebfb84ca47$var$_suggest);
12888
+ $bd9b4aebfb84ca47$var$_classPrivateMethodInitSpec(this, $bd9b4aebfb84ca47$var$_listing);
12889
+ $bd9b4aebfb84ca47$var$_classPrivateMethodInitSpec(this, $bd9b4aebfb84ca47$var$_browse);
12890
+ $bd9b4aebfb84ca47$var$_classPrivateMethodInitSpec(this, $bd9b4aebfb84ca47$var$_rejected_clauses);
12891
+ $bd9b4aebfb84ca47$var$_classPrivateMethodInitSpec(this, $bd9b4aebfb84ca47$var$_browse_answer);
12892
+ $bd9b4aebfb84ca47$var$_classPrivateMethodInitSpec(this, $bd9b4aebfb84ca47$var$_browse_page);
12893
+ $bd9b4aebfb84ca47$var$_classPrivateMethodInitSpec(this, $bd9b4aebfb84ca47$var$_facet_index);
12894
+ $bd9b4aebfb84ca47$var$_classPrivateMethodInitSpec(this, $bd9b4aebfb84ca47$var$_get_answer);
12895
+ $bd9b4aebfb84ca47$var$_classPrivateMethodInitSpec(this, $bd9b4aebfb84ca47$var$_get_json);
12896
+ $bd9b4aebfb84ca47$var$_classPrivateMethodInitSpec(this, $bd9b4aebfb84ca47$var$_merchant_url);
12897
+ $bd9b4aebfb84ca47$var$_classPrivateFieldInitSpec(this, $bd9b4aebfb84ca47$var$_facet_indices, {
12898
+ writable: true,
12899
+ value: new Map()
12900
+ });
12901
+ $bd9b4aebfb84ca47$var$_classPrivateFieldInitSpec(this, $bd9b4aebfb84ca47$var$_learned, {
12902
+ writable: true,
12903
+ value: new Set()
12904
+ });
12905
+ $bd9b4aebfb84ca47$var$_classPrivateFieldInitSpec(this, $bd9b4aebfb84ca47$var$_cursor_offsets, {
12906
+ writable: true,
12907
+ value: new Map()
12908
+ });
12909
+ $bd9b4aebfb84ca47$var$_classPrivateFieldInitSpec(this, $bd9b4aebfb84ca47$var$_ancestor_lookups, {
12910
+ writable: true,
12911
+ value: new Map()
12912
+ });
12913
+ $bd9b4aebfb84ca47$var$_classPrivateFieldInitSpec(this, $bd9b4aebfb84ca47$var$_rejected, {
12914
+ writable: true,
12915
+ value: new Map()
12916
+ });
12917
+ $b8hua$set_event_api("v4");
12918
+ }
12919
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12920
+ async request_raw_(call) {
12921
+ switch (call.kind_) {
12922
+ case "search":
12923
+ return await $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_browse, $bd9b4aebfb84ca47$var$_browse2).call(this, "search", call.request_);
12924
+ case "listing_products":
12925
+ return await $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_browse, $bd9b4aebfb84ca47$var$_browse2).call(this, "listing", call.request_, {
12926
+ [call.id_type_ === $397620a4d7958ed1$export$5aae649db1b959fc ? "external_id" : "id"]: call.id_to_query_for_
12927
+ });
12928
+ case "listing":
12929
+ return await $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_listing, $bd9b4aebfb84ca47$var$_listing2).call(this, call);
12930
+ case "suggest":
12931
+ return await $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_suggest, $bd9b4aebfb84ca47$var$_suggest2).call(this, call.request_);
12932
+ case "related":
12933
+ {
12934
+ const {
12935
+ merchant: merchant,
12936
+ market: market,
12937
+ locale: locale,
12938
+ query: query
12939
+ } = call.request_;
12940
+ const displays = await $5255d5015f3bff20$export$bd5f8a7d3e47a43d({
12941
+ merchant: merchant,
12942
+ market: market,
12943
+ locale: locale,
12944
+ query: query
12945
+ });
12946
+ return displays && {
12947
+ displays: displays
12948
+ };
12949
+ }
12950
+ }
12951
+ }
12952
+ }
12953
+ /** The v3 search or listing-products request DepictAPI hands its transport. */
12954
+ function $bd9b4aebfb84ca47$var$_merchant_url2(merchant, path) {
12955
+ return $a881711b2a93404e$export$b6dad15503f66988(merchant, path);
12956
+ }
12957
+ async function $bd9b4aebfb84ca47$var$_get_json2(url) {
12958
+ return (await $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_get_answer, $bd9b4aebfb84ca47$var$_get_answer2).call(this, url)).body_;
12959
+ }
12960
+ async function $bd9b4aebfb84ca47$var$_get_answer2(url) {
12961
+ return await $a881711b2a93404e$export$f035610fd74c541a(url);
12962
+ }
12963
+ function $bd9b4aebfb84ca47$var$_facet_index2(merchant, market, locale) {
12964
+ const key = JSON.stringify([merchant, market, locale]);
12965
+ let index = $b8hua$babelruntimehelpersclassPrivateFieldGet(this, $bd9b4aebfb84ca47$var$_facet_indices).get(key);
12966
+ if (!index) $b8hua$babelruntimehelpersclassPrivateFieldGet(this, $bd9b4aebfb84ca47$var$_facet_indices).set(key, index = new (0, $fdcc2c233c7ae6b6$export$8d488bcc71d07ffb)());
12967
+ return index;
12968
+ }
12969
+ async function $bd9b4aebfb84ca47$var$_browse_page2(merchant, request) {
12970
+ return (await $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_browse_answer, $bd9b4aebfb84ca47$var$_browse_answer2).call(this, merchant, request)).body_;
12971
+ }
12972
+ async function $bd9b4aebfb84ca47$var$_browse_answer2(merchant, request) {
12973
+ return await $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_get_answer, $bd9b4aebfb84ca47$var$_get_answer2).call(this, $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_merchant_url, $bd9b4aebfb84ca47$var$_merchant_url2).call(this, merchant, "/browse") + "?" + $efe3f499b0d72444$export$7659319cdb555579(request));
12974
+ }
12975
+ function $bd9b4aebfb84ca47$var$_rejected_clauses2(merchant, market, locale) {
12976
+ const key = JSON.stringify([merchant, market, locale]);
12977
+ let rejected = $b8hua$babelruntimehelpersclassPrivateFieldGet(this, $bd9b4aebfb84ca47$var$_rejected).get(key);
12978
+ if (!rejected) $b8hua$babelruntimehelpersclassPrivateFieldGet(this, $bd9b4aebfb84ca47$var$_rejected).set(key, rejected = new Set());
12979
+ return rejected;
12980
+ }
12981
+ async function $bd9b4aebfb84ca47$var$_browse2(door, v3_request, listing) {
12982
+ var _v3_request$filters, _v3_request$limit;
12983
+ const {
12984
+ merchant: merchant,
12985
+ market: market
12986
+ } = v3_request;
12987
+ const locale = $efe3f499b0d72444$export$eb90c08da400512d(v3_request.locale);
12988
+ const query = door === "search" && v3_request.query && $bd9b4aebfb84ca47$var$HAS_LETTER_OR_DIGIT.test(v3_request.query) ? v3_request.query : undefined;
12989
+ const base = {
12990
+ market: market,
12991
+ ...(locale ? {
12992
+ locale: locale
12993
+ } : {}),
12994
+ ...(query ? {
12995
+ query: query
12996
+ } : {}),
12997
+ ...(listing ? {
12998
+ listing: listing
12999
+ } : {})
13000
+ };
13001
+ const index = $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_facet_index, $bd9b4aebfb84ca47$var$_facet_index2).call(this, merchant, market, locale);
13002
+ const filters = (_v3_request$filters = v3_request.filters) !== null && _v3_request$filters !== void 0 ? _v3_request$filters : [];
13003
+ // depict-ui sends a filter's lowercased group title as its field. A page opened from a link with filters in it
13004
+ // comes before any facets, so read this browse's facets once to learn which field each title names.
13005
+ const learn_key = JSON.stringify([merchant, base]);
13006
+ if (filters.some(filter => filter.data != null && !$fdcc2c233c7ae6b6$export$3b6ba2422a5e0aa0(filter.field, index)) && !$b8hua$babelruntimehelpersclassPrivateFieldGet(this, $bd9b4aebfb84ca47$var$_learned).has(learn_key)) {
13007
+ var _await$_classPrivateM;
13008
+ $b8hua$babelruntimehelpersclassPrivateFieldGet(this, $bd9b4aebfb84ca47$var$_learned).add(learn_key);
13009
+ index.learn_((_await$_classPrivateM = await $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_browse_page, $bd9b4aebfb84ca47$var$_browse_page2).call(this, merchant, {
13010
+ ...base,
13011
+ include: ["facets"],
13012
+ limit: 1
13013
+ })) === null || _await$_classPrivateM === void 0 ? void 0 : _await$_classPrivateM.facets);
13014
+ }
13015
+ // A filter V4 can't take must not cost the shopper the page: a link can outlive its filter (one removed from the
13016
+ // store, a hand-written value). One the adapter can't write is left out here; one V4 rejects is left out and the
13017
+ // page asked again, and remembered for this page load so later pages don't ask with it.
13018
+ const rejected = $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_rejected_clauses, $bd9b4aebfb84ca47$var$_rejected_clauses2).call(this, merchant, market, locale);
13019
+ let clauses = [];
13020
+ for (const filter of filters) try {
13021
+ const clause = $fdcc2c233c7ae6b6$export$c17bb5d2ead3e8f3(filter, index);
13022
+ if (clause) clauses.push(clause);
13023
+ } catch (e) {
13024
+ if (!(e instanceof (0, $fdcc2c233c7ae6b6$export$f5ea4d073ddb4bdb))) throw e;
13025
+ $b8hua$dwarn("[NativeDepictAPI] leaving out a filter V4 can't take:", e.message, filter);
13026
+ }
13027
+ clauses = clauses.filter(clause => !rejected.has(clause.clause_));
13028
+ const sort = $fdcc2c233c7ae6b6$export$78eb8e636d89ff30(v3_request.sort);
13029
+ const include = door === "search" ? ["facets", "sorts", "content", "attributes"] : ["facets", "sorts", "attributes"];
13030
+ const want = (_v3_request$limit = v3_request.limit) !== null && _v3_request$limit !== void 0 ? _v3_request$limit : $bd9b4aebfb84ca47$var$DEFAULT_LIMIT;
13031
+ const offset = v3_request.cursor && $b8hua$babelruntimehelpersclassPrivateFieldGet(this, $bd9b4aebfb84ca47$var$_cursor_offsets).get(v3_request.cursor) || 0;
13032
+ const request_with = sent => ({
13033
+ ...base,
13034
+ ...(sent.length ? {
13035
+ filter_by: sent.map(clause => clause.clause_).join(" && ")
13036
+ } : {}),
13037
+ ...(sort ? {
13038
+ sort: sort
13039
+ } : {}),
13040
+ ...(v3_request.cursor ? {
13041
+ cursor: v3_request.cursor
13042
+ } : {}),
13043
+ include: include,
13044
+ ...(want !== $bd9b4aebfb84ca47$var$DEFAULT_LIMIT ? {
13045
+ limit: Math.min(want, $bd9b4aebfb84ca47$var$BROWSE_MAX_LIMIT)
13046
+ } : {})
13047
+ });
13048
+ let request = request_with(clauses);
13049
+ let answer = await $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_browse_answer, $bd9b4aebfb84ca47$var$_browse_answer2).call(this, merchant, request);
13050
+ // Each retry leaves out at least one more clause, so this ends.
13051
+ while (!answer.body_) {
13052
+ var _answer$error_;
13053
+ const refused = $fdcc2c233c7ae6b6$export$c38de645260a41ed(answer.error_, clauses);
13054
+ if (!refused.length) return undefined;
13055
+ $b8hua$dwarn("[NativeDepictAPI] leaving out filters V4 refused:", refused.map(clause => clause.clause_), (_answer$error_ = answer.error_) === null || _answer$error_ === void 0 ? void 0 : _answer$error_.message);
13056
+ for (const clause of refused) rejected.add(clause.clause_);
13057
+ clauses = clauses.filter(clause => !refused.includes(clause));
13058
+ request = request_with(clauses);
13059
+ answer = await $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_browse_answer, $bd9b4aebfb84ca47$var$_browse_answer2).call(this, merchant, request);
13060
+ }
13061
+ let response = answer.body_;
13062
+ // A page over V4's largest is its pages chained by their cursors; later pages ask for products alone.
13063
+ while (want > $bd9b4aebfb84ca47$var$BROWSE_MAX_LIMIT && response.products.length < want && response.cursor !== undefined) {
13064
+ const page = await $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_browse_page, $bd9b4aebfb84ca47$var$_browse_page2).call(this, merchant, {
13065
+ ...request,
13066
+ cursor: response.cursor,
13067
+ limit: Math.min(want - response.products.length, $bd9b4aebfb84ca47$var$BROWSE_MAX_LIMIT),
13068
+ include: ["attributes"]
13069
+ });
13070
+ if (!page) return undefined;
13071
+ if (!page.products.length) break;
13072
+ response = {
13073
+ ...response,
13074
+ products: [...response.products, ...page.products],
13075
+ ...(page.cursor !== undefined ? {
13076
+ cursor: page.cursor
13077
+ } : {
13078
+ cursor: undefined
13079
+ })
13080
+ };
13081
+ }
13082
+ if (response.cursor === undefined) delete response.cursor;
13083
+ index.learn_(response.facets);
13084
+ if (response.cursor !== undefined) $b8hua$babelruntimehelpersclassPrivateFieldGet(this, $bd9b4aebfb84ca47$var$_cursor_offsets).set(response.cursor, offset + response.products.length);
13085
+ return $efe3f499b0d72444$export$efb7dd882d411dd4(response, door, offset);
13086
+ }
13087
+ async function $bd9b4aebfb84ca47$var$_listing2(call) {
13088
+ const {
13089
+ merchant: merchant,
13090
+ market: market
13091
+ } = call.request_;
13092
+ const locale = $efe3f499b0d72444$export$eb90c08da400512d(call.request_.locale);
13093
+ const by_external_id = call.id_type_ === $397620a4d7958ed1$export$5aae649db1b959fc;
13094
+ const path = by_external_id ? "/listings" : "/listings/" + encodeURIComponent(call.id_to_query_for_);
13095
+ const response = await $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_get_json, $bd9b4aebfb84ca47$var$_get_json2).call(this, $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_merchant_url, $bd9b4aebfb84ca47$var$_merchant_url2).call(this, merchant, path) + "?" + $efe3f499b0d72444$export$fec3e4b5adfcea2c([["market", market], ["locale", locale], ["external_id", by_external_id ? call.id_to_query_for_ : undefined]]));
13096
+ return response && $efe3f499b0d72444$export$996f2b1e66d9b5af(response.listing);
13097
+ }
13098
+ async function $bd9b4aebfb84ca47$var$_suggest2(v3_request) {
13099
+ var _v3_request$query;
13100
+ const {
13101
+ merchant: merchant,
13102
+ market: market
13103
+ } = v3_request;
13104
+ const locale = $efe3f499b0d72444$export$eb90c08da400512d(v3_request.locale);
13105
+ const response = await $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_get_json, $bd9b4aebfb84ca47$var$_get_json2).call(this, $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_merchant_url, $bd9b4aebfb84ca47$var$_merchant_url2).call(this, merchant, "/suggest") + "?" + $efe3f499b0d72444$export$fec3e4b5adfcea2c([["market", market], ["locale", locale], ["query", (_v3_request$query = v3_request.query) !== null && _v3_request$query !== void 0 ? _v3_request$query : ""]]));
13106
+ if (!response) return undefined;
13107
+ const needs_ancestors = response.suggestions.some(suggestion => suggestion.type === "listing" && suggestion.path.length > 0);
13108
+ return $efe3f499b0d72444$export$2860125b419015f8(response, needs_ancestors ? await $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_ancestors, $bd9b4aebfb84ca47$var$_ancestors2).call(this, merchant, market, locale) : undefined);
13109
+ }
13110
+ function $bd9b4aebfb84ca47$var$_ancestors2(merchant, market, locale) {
13111
+ const key = JSON.stringify([merchant, market, locale]);
13112
+ let lookup = $b8hua$babelruntimehelpersclassPrivateFieldGet(this, $bd9b4aebfb84ca47$var$_ancestor_lookups).get(key);
13113
+ if (!lookup) {
13114
+ lookup = $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_get_json, $bd9b4aebfb84ca47$var$_get_json2).call(this, $bd9b4aebfb84ca47$var$_classPrivateMethodGet(this, $bd9b4aebfb84ca47$var$_merchant_url, $bd9b4aebfb84ca47$var$_merchant_url2).call(this, merchant, "/listings") + "?" + $efe3f499b0d72444$export$fec3e4b5adfcea2c([["market", market], ["locale", locale]])).then(tree => tree && $efe3f499b0d72444$export$76d96892da63b395(tree.listings));
13115
+ $b8hua$babelruntimehelpersclassPrivateFieldGet(this, $bd9b4aebfb84ca47$var$_ancestor_lookups).set(key, lookup);
13116
+ }
13117
+ return lookup;
13118
+ }
13119
+ function $bd9b4aebfb84ca47$export$6d972e6af9de09f0(version, options) {
13120
+ return version === "v4" ? new $bd9b4aebfb84ca47$export$721afe49a594bed(options) : new (0, $284849364a6ef73a$export$e015ed2f2950f2e3)(options);
13121
+ }
11933
13122
  function $9d3d794b62318ecc$export$477caf01aecaeb2a(options) {
11934
13123
  var _globalThis$location$, _globalThis$location;
11935
13124
  const router_ = options.router_;
@@ -12239,8 +13428,9 @@ class $f5f54892fd0c7d9f$export$f34314aa9505732e {
12239
13428
  quicklinks_signal_: $b8hua$createSignal(),
12240
13429
  i18n_: i18n_,
12241
13430
  reset_history_state_: reset_history_state_,
13431
+ depict_api_: typeof api === "object" && api ? api :
12242
13432
  // @ts-ignore
12243
- depict_api_: api !== null && api !== void 0 ? api : new (0, $284849364a6ef73a$export$e015ed2f2950f2e3)({
13433
+ $bd9b4aebfb84ca47$export$6d972e6af9de09f0(api, {
12244
13434
  display_transformers: display_transformers
12245
13435
  }),
12246
13436
  router_: $b8hua$babelruntimehelpersclassPrivateFieldGet(this, $f5f54892fd0c7d9f$var$_router),
@@ -13787,8 +14977,9 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
13787
14977
  const get_search_query_ = $b8hua$createMemo(previous_value => {
13788
14978
  if (get_search_query_updating_blocked()) return previous_value;else return raw_search_query_accessor();
13789
14979
  });
14980
+ const depict_api_ = typeof api === "object" && api ? api :
13790
14981
  // @ts-ignore
13791
- const depict_api_ = api !== null && api !== void 0 ? api : new (0, $284849364a6ef73a$export$e015ed2f2950f2e3)({
14982
+ $bd9b4aebfb84ca47$export$6d972e6af9de09f0(api, {
13792
14983
  display_transformers: display_transformers
13793
14984
  });
13794
14985
  const previous_searches = $07d90b8270ece8de$export$84bba84a7b837187(get_search_query_);
@@ -14800,4 +15991,4 @@ function $8821a19349c36651$export$e2bf8ce7779e827e(props) {
14800
15991
  }, "Entire CategoryPage failed");
14801
15992
  }
14802
15993
  $b8hua$add_to_version_info("ui", (0, $8db9a15135765c11$export$83d89fbfd8236492));
14803
- export { $4b4b262708b516ee$export$1d575f423147a8c as usePLPLayout, $4be619ec2cd7bba3$export$54c6d6ff54e72743 as makeSizeAccessors, $80c7883e020be192$export$f98b8d5ea7207a1 as setExtraDisplayTransformers, $80c7883e020be192$export$b2d94be4f02525b2 as getExtraDisplayTransformers, $98688279b9059f50$export$140423fa4bfb6d63 as ModernResponsiveImage, $ff7feae4dddd6073$export$92aa5d691d588f3f as remap_blocks_to_index, $715f7f2e53146662$export$d4d96868197be50e as useMobileHover, $a35e6f680c5bbc60$export$54299a3c81f5425 as useVisibilityState, $002f09d00aac50b2$export$eaa625fb39439e37 as useSlidableInformation, $618bd53ea0a41cd4$export$80bb7300ce6a8be3 as useProductCardIsVisible, $618bd53ea0a41cd4$export$f223d69ed12f5fb7 as CurrentlyIntersectingContext, $8e8b179489080711$export$5bad61ecde080b1f as useExpandingContainerReactive, $bb34cd283e904784$export$2c9f9bf2092486aa as LooksSliderOrGrid, $22dd375b476673e2$export$44809a8a3e867e30 as LookCard, $ac571292d606f30b$export$7e1297a3a19f10d8 as PseudoRouter, $6d75ec14f537c37f$export$83bb9af5671e1dbe as promiseSafeStructuredClone, $68e6625c8d51f847$export$5162a71f252e6122 as preserve_items_in_history_dot_state, $68e6625c8d51f847$export$3064e1e8c6513da3 as prefixes_to_preserve_in_history_dot_state, $9b35d1384e31813a$export$29d28dadc2d6b631 as allowNativeNavigation, $b026fa9c9c904a98$export$1ea76ea778b880dd as modalVersionSymbol, $a604a8ffa4e4c03f$export$e417c49320921907 as createDeparallelizedNoDropResource, $01c33966d9ddb108$export$f50b88e2a00918b5 as throw_globally, $40411f2ec772c376$export$9265e66f26f8e383 as ClassicSearchModal, $06fcd2a345efd24d$export$b0c55aa2e87c4be7 as SearchModalV2, $98688279b9059f50$export$9d4a4b669b1929ab as ModernResponsiveContainedImage, $6a439680ae7e9ba3$export$3e41faf802a29e71 as Tab, $6a439680ae7e9ba3$export$b2539bed5023c21c as Tabs, $6b0fd8fd20df8ccf$export$d4973c31938cbfd1 as ShopTheLookButton, $972f6bce0f9d61be$export$e183a13865960371 as history_dot_state_to_state, $2855bffe06ef7a03$export$916e6850778505f6 as strip_encoded_filter_and_sort, $2855bffe06ef7a03$export$58aa3f171519b6d7 as encode_filters, $2855bffe06ef7a03$export$f934fa24c3a86811 as decode_filters, $2855bffe06ef7a03$export$62acb285a7579555 as encode_sorting, $2855bffe06ef7a03$export$766e9676e74997d3 as decode_sorting, $4df489344a0f97c7$export$d7b7ab832c20e2f4 as shopifyContainedImageContextSymbol, $5441862cd2f5e111$export$e68cff63f76bd15b as ListingProvider, $5441862cd2f5e111$export$8d0c4fdbb05a2f2e as useListing, $1e69163caedaab4e$export$11354f017ddc9790 as ProductCardIndexProvider, $1e69163caedaab4e$export$e3faf4d95300054f as useProductCardIndex, $4df489344a0f97c7$export$e4b984597b71e989 as ShopifyContainedImage, $002f09d00aac50b2$export$6649caad96ef8870 as SlidableItems, $fc830a7ee59416ef$export$ebdc3711f7e02ccd as make_accurate_width_accessor, $d5d7e58c5c9d8db0$export$9574e176201e5e8d as RecommendationSlider, $b432b11321ad4c97$export$9756467d34d91cdb as RecommendationGrid, $56047603f9d212b6$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $801e8845d3fa3653$export$94026ee33dbabc26 as ImageContainer, $74777e8fe65b3dcb$export$b69d0d92862de18b as SentryErrorBoundary, $74777e8fe65b3dcb$export$240ecf5363d76c0f as ExtraSentryContextProvider, $ad371564683947ab$export$6c6d7a51fa9aa15d as ExpandingDetails, $e18ab2868df26f40$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $4711a82d08d2021b$export$fecbb157621501bd as SelectedFilters, $f6b0500577e1b210$export$3f1a388cc0d8fed7 as FilterBody, $44aa24b1bb793549$export$b288c38ae3fddb56 as create_modified_filters, $63f1f8dbcd07d3b0$export$d21e32dfedac04be as SolidLayout, $63f1f8dbcd07d3b0$export$445d8d3f5f706a40 as SolidLayoutWithProvidedElement, $d5f1e6a0f9117286$export$79b1565500412d9b as general_modal_abstraction, $9783d437ad61594c$export$3b621d86b1566b2 as CrossIcon, $ca6ab5f08bd28bca$export$8be2714ec7f169ee as GenericSliderArrowButton, $50aebf5b445518eb$export$58e808b1db15d3bc as fetchDepictRecommendations, $fa332ea03168857c$export$b91cec6bdc6b32a1 as CategoryTitle, $702d7656a373973e$export$824dde41348efed1 as embedded_num_products, $160ea2b55d8772d2$export$c1a6b039e689a58e as get_listings, $f5f54892fd0c7d9f$export$f34314aa9505732e as DepictCategory, $eb064bc3350276c1$export$ac6237957a15b3f0 as DepictSearch, $eb064bc3350276c1$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $eb064bc3350276c1$export$f2dc7e4e4aa11abb as SearchPage, $f3b7124b76123e44$export$aa14a9f43128f61f as ProductCardError, $169c13c0531d91d2$export$d86a33413558014e as open_modal_with_alignment, $5eaa00b951637e96$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $1308a7816c3d4f2d$export$b3ad617e9036868 as align_field, $1308a7816c3d4f2d$export$3f238c96c45e6cc6 as ALIGN_TOP, $1308a7816c3d4f2d$export$902f8b4a7dae5d78 as ALIGN_WIDTH_ON_MODAL, $1308a7816c3d4f2d$export$7895aadd1956b1c7 as ALIGN_LEFT, $1308a7816c3d4f2d$export$6060bc6bee850eb6 as SET_CENTERED_LEFT, $a9c7ba6087881ac2$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $cc64aabf2c7a1f1a$export$1233ca167bf71f9a as styles_to_valid_css_string, $e56d241d0f33d459$export$fe334901e8bebd57 as disable_scrolling, $573c007c697a1831$export$d0596b5cae35ad4 as open_search_with_shift_slash, $284849364a6ef73a$export$e015ed2f2950f2e3 as DepictAPI, $00a5b94f0c11efbb$export$d9f36cf74e24d595 as media_query_to_accessor, $e60a76195ac6d408$export$689e204eadb33baf as setup_fast_leave, $a61a2051e15c8d7a$export$5196e4c01fa56fcb as show_toast, $60ec7a29849d81db$export$a71e92cfbb498adc as SolidFormatPrice, $37e8c97bb6876197$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $bc2337c9a05ecd18$export$acb3eaade4b23afd as BasePlaceholder, $ceafb6fb91c6f394$export$89c6019e4baa40b1 as TextPlaceholder, $3ab4aa97880fb88d$export$3f37af283f8fb843 as ImagePlaceholder, $f9fd3017c20b774a$export$3ccaa27d81dd8556 as PageReplacer, $d399250dfa491636$export$864d304a0bc46829 as defaultGridSpacing, $d399250dfa491636$export$c3834fa86c616831 as defaultColsAtSize, $d399250dfa491636$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $8db9a15135765c11$export$83d89fbfd8236492 as version, $a3026fb727bc7550$export$316f6f283ae64765 as SearchField, $62a8813a51fbd22f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $62a8813a51fbd22f$export$de035477d6fef996 as QuickLinks, $8821a19349c36651$export$e2bf8ce7779e827e as CategoryPage };
15994
+ export { $4b4b262708b516ee$export$1d575f423147a8c as usePLPLayout, $4be619ec2cd7bba3$export$54c6d6ff54e72743 as makeSizeAccessors, $80c7883e020be192$export$f98b8d5ea7207a1 as setExtraDisplayTransformers, $80c7883e020be192$export$b2d94be4f02525b2 as getExtraDisplayTransformers, $98688279b9059f50$export$140423fa4bfb6d63 as ModernResponsiveImage, $ff7feae4dddd6073$export$92aa5d691d588f3f as remap_blocks_to_index, $715f7f2e53146662$export$d4d96868197be50e as useMobileHover, $a35e6f680c5bbc60$export$54299a3c81f5425 as useVisibilityState, $002f09d00aac50b2$export$eaa625fb39439e37 as useSlidableInformation, $618bd53ea0a41cd4$export$80bb7300ce6a8be3 as useProductCardIsVisible, $618bd53ea0a41cd4$export$f223d69ed12f5fb7 as CurrentlyIntersectingContext, $8e8b179489080711$export$5bad61ecde080b1f as useExpandingContainerReactive, $bb34cd283e904784$export$2c9f9bf2092486aa as LooksSliderOrGrid, $22dd375b476673e2$export$44809a8a3e867e30 as LookCard, $ac571292d606f30b$export$7e1297a3a19f10d8 as PseudoRouter, $6d75ec14f537c37f$export$83bb9af5671e1dbe as promiseSafeStructuredClone, $68e6625c8d51f847$export$5162a71f252e6122 as preserve_items_in_history_dot_state, $68e6625c8d51f847$export$3064e1e8c6513da3 as prefixes_to_preserve_in_history_dot_state, $9b35d1384e31813a$export$29d28dadc2d6b631 as allowNativeNavigation, $b026fa9c9c904a98$export$1ea76ea778b880dd as modalVersionSymbol, $a604a8ffa4e4c03f$export$e417c49320921907 as createDeparallelizedNoDropResource, $01c33966d9ddb108$export$f50b88e2a00918b5 as throw_globally, $40411f2ec772c376$export$9265e66f26f8e383 as ClassicSearchModal, $06fcd2a345efd24d$export$b0c55aa2e87c4be7 as SearchModalV2, $98688279b9059f50$export$9d4a4b669b1929ab as ModernResponsiveContainedImage, $6a439680ae7e9ba3$export$3e41faf802a29e71 as Tab, $6a439680ae7e9ba3$export$b2539bed5023c21c as Tabs, $6b0fd8fd20df8ccf$export$d4973c31938cbfd1 as ShopTheLookButton, $972f6bce0f9d61be$export$e183a13865960371 as history_dot_state_to_state, $2855bffe06ef7a03$export$916e6850778505f6 as strip_encoded_filter_and_sort, $2855bffe06ef7a03$export$58aa3f171519b6d7 as encode_filters, $2855bffe06ef7a03$export$f934fa24c3a86811 as decode_filters, $2855bffe06ef7a03$export$62acb285a7579555 as encode_sorting, $2855bffe06ef7a03$export$766e9676e74997d3 as decode_sorting, $4df489344a0f97c7$export$d7b7ab832c20e2f4 as shopifyContainedImageContextSymbol, $5441862cd2f5e111$export$e68cff63f76bd15b as ListingProvider, $5441862cd2f5e111$export$8d0c4fdbb05a2f2e as useListing, $1e69163caedaab4e$export$11354f017ddc9790 as ProductCardIndexProvider, $1e69163caedaab4e$export$e3faf4d95300054f as useProductCardIndex, $4df489344a0f97c7$export$e4b984597b71e989 as ShopifyContainedImage, $002f09d00aac50b2$export$6649caad96ef8870 as SlidableItems, $fc830a7ee59416ef$export$ebdc3711f7e02ccd as make_accurate_width_accessor, $d5d7e58c5c9d8db0$export$9574e176201e5e8d as RecommendationSlider, $b432b11321ad4c97$export$9756467d34d91cdb as RecommendationGrid, $56047603f9d212b6$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $801e8845d3fa3653$export$94026ee33dbabc26 as ImageContainer, $74777e8fe65b3dcb$export$b69d0d92862de18b as SentryErrorBoundary, $74777e8fe65b3dcb$export$240ecf5363d76c0f as ExtraSentryContextProvider, $ad371564683947ab$export$6c6d7a51fa9aa15d as ExpandingDetails, $e18ab2868df26f40$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $4711a82d08d2021b$export$fecbb157621501bd as SelectedFilters, $f6b0500577e1b210$export$3f1a388cc0d8fed7 as FilterBody, $44aa24b1bb793549$export$b288c38ae3fddb56 as create_modified_filters, $63f1f8dbcd07d3b0$export$d21e32dfedac04be as SolidLayout, $63f1f8dbcd07d3b0$export$445d8d3f5f706a40 as SolidLayoutWithProvidedElement, $d5f1e6a0f9117286$export$79b1565500412d9b as general_modal_abstraction, $9783d437ad61594c$export$3b621d86b1566b2 as CrossIcon, $ca6ab5f08bd28bca$export$8be2714ec7f169ee as GenericSliderArrowButton, $50aebf5b445518eb$export$58e808b1db15d3bc as fetchDepictRecommendations, $fa332ea03168857c$export$b91cec6bdc6b32a1 as CategoryTitle, $702d7656a373973e$export$824dde41348efed1 as embedded_num_products, $160ea2b55d8772d2$export$c1a6b039e689a58e as get_listings, $f5f54892fd0c7d9f$export$f34314aa9505732e as DepictCategory, $eb064bc3350276c1$export$ac6237957a15b3f0 as DepictSearch, $eb064bc3350276c1$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $eb064bc3350276c1$export$f2dc7e4e4aa11abb as SearchPage, $f3b7124b76123e44$export$aa14a9f43128f61f as ProductCardError, $169c13c0531d91d2$export$d86a33413558014e as open_modal_with_alignment, $5eaa00b951637e96$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $1308a7816c3d4f2d$export$b3ad617e9036868 as align_field, $1308a7816c3d4f2d$export$3f238c96c45e6cc6 as ALIGN_TOP, $1308a7816c3d4f2d$export$902f8b4a7dae5d78 as ALIGN_WIDTH_ON_MODAL, $1308a7816c3d4f2d$export$7895aadd1956b1c7 as ALIGN_LEFT, $1308a7816c3d4f2d$export$6060bc6bee850eb6 as SET_CENTERED_LEFT, $a9c7ba6087881ac2$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $cc64aabf2c7a1f1a$export$1233ca167bf71f9a as styles_to_valid_css_string, $e56d241d0f33d459$export$fe334901e8bebd57 as disable_scrolling, $573c007c697a1831$export$d0596b5cae35ad4 as open_search_with_shift_slash, $284849364a6ef73a$export$e015ed2f2950f2e3 as DepictAPI, $bd9b4aebfb84ca47$export$721afe49a594bed as NativeDepictAPI, $bd9b4aebfb84ca47$export$6d972e6af9de09f0 as create_depict_api, $00a5b94f0c11efbb$export$d9f36cf74e24d595 as media_query_to_accessor, $e60a76195ac6d408$export$689e204eadb33baf as setup_fast_leave, $a61a2051e15c8d7a$export$5196e4c01fa56fcb as show_toast, $60ec7a29849d81db$export$a71e92cfbb498adc as SolidFormatPrice, $37e8c97bb6876197$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $bc2337c9a05ecd18$export$acb3eaade4b23afd as BasePlaceholder, $ceafb6fb91c6f394$export$89c6019e4baa40b1 as TextPlaceholder, $3ab4aa97880fb88d$export$3f37af283f8fb843 as ImagePlaceholder, $f9fd3017c20b774a$export$3ccaa27d81dd8556 as PageReplacer, $d399250dfa491636$export$864d304a0bc46829 as defaultGridSpacing, $d399250dfa491636$export$c3834fa86c616831 as defaultColsAtSize, $d399250dfa491636$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $8db9a15135765c11$export$83d89fbfd8236492 as version, $a3026fb727bc7550$export$316f6f283ae64765 as SearchField, $62a8813a51fbd22f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $62a8813a51fbd22f$export$de035477d6fef996 as QuickLinks, $8821a19349c36651$export$e2bf8ce7779e827e as CategoryPage };