@depict-ai/utilishared 0.0.76 → 0.0.77

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.
Files changed (5) hide show
  1. package/README.md +130 -130
  2. package/dist/index.d.ts +2404 -2403
  3. package/dist/main.js +185 -188
  4. package/dist/module.js +185 -188
  5. package/package.json +2 -2
package/dist/main.js CHANGED
@@ -185,7 +185,7 @@ $parcel$export(module.exports, "stateless_href_change_ipns", () => $69f7524c8bdd
185
185
  $parcel$export(module.exports, "href_change_ipns", () => $69f7524c8bdd85b4$export$a9d39e43ae273d26);
186
186
  $parcel$export(module.exports, "history_replacer", () => $69f7524c8bdd85b4$export$baccefee4a395d8f);
187
187
  $parcel$export(module.exports, "on_next_navigation", () => $69f7524c8bdd85b4$export$1cd22bab0d2c3b0b);
188
- $parcel$export(module.exports, "instant_exec_on_popstate_before_ipns_update", () => $69f7524c8bdd85b4$export$446840cab57eeedb);
188
+ $parcel$export(module.exports, "instant_exec_on_suspect_history_change", () => $69f7524c8bdd85b4$export$7500cdfd37aafd43);
189
189
  $parcel$export(module.exports, "async_iterable_ipns", () => $9a42a570de51ea3d$export$e806c6c1615a59ae);
190
190
  $parcel$export(module.exports, "make_ipns_stateful", () => $9a42a570de51ea3d$export$10c3e52ef388b81b);
191
191
  $parcel$export(module.exports, "make_ipns_stateless", () => $9a42a570de51ea3d$export$90740b5bc9c2b3b7);
@@ -274,7 +274,7 @@ $parcel$export(module.exports, "hsl_to_rgb", () => $d73746ee466f09ca$export$e4fd
274
274
  $parcel$export(module.exports, "relative_luminance_from_rgb", () => $d73746ee466f09ca$export$98c2b3491e76c1f);
275
275
  $parcel$export(module.exports, "version", () => $815f67c61b4c0a42$export$83d89fbfd8236492);
276
276
  $parcel$export(module.exports, "add_to_version_info", () => $e4a18bf12ad092d9$export$2cefb7e61fcbae00);
277
- const $815f67c61b4c0a42$export$83d89fbfd8236492 = "0.0.76";
277
+ const $815f67c61b4c0a42$export$83d89fbfd8236492 = "0.0.77";
278
278
 
279
279
 
280
280
  const $7b5e577a60b81e60$export$55fe61489d2c7417 = /*@__PURE__*/ (()=>process.env.STRIP_DEBUG === "true" ? false : process.env.DEBUG === "true" || process.env.NODE_ENV === "development" || process.env.BUILD_TARGET !== "node" && (document.currentScript?.dataset?.debug === "true" || localStorage.getItem("debug") === "true"))();
@@ -318,8 +318,8 @@ function $e4a18bf12ad092d9$export$fe609f0216e4ebef(url) {
318
318
 
319
319
 
320
320
 
321
- /**
322
- * @deprecated this was a stupid idea, it's much easier to read if one just does a quick arrow function that provides the wanted arguments
321
+ /**
322
+ * @deprecated this was a stupid idea, it's much easier to read if one just does a quick arrow function that provides the wanted arguments
323
323
  */ function $ee1d22bd1fcdd4e1$export$6e7454c733fa1fb2(fn, ...args) {
324
324
  return function(...unimportant_args) {
325
325
  return fn.apply(this, [
@@ -333,13 +333,13 @@ function $e4a18bf12ad092d9$export$fe609f0216e4ebef(url) {
333
333
 
334
334
 
335
335
 
336
- /**
337
- * Class containing state that an IPNS operates on. It's only exported for type info and in case that you want to use it for instanceof checks.
338
- * subscribers is an array of functions that get called every time push_value is called with a new value AND all previous subscribers are done
339
- * queue is the queue of values that subscribers gets called with
340
- * last_processed_value is the last value that the subscribers were called with
341
- * push_value adds a new value to the queue and triggers the calling of the subscribers if they're done
342
- * subscriber_done decrements the number of subscribers we are waiting for, if this isn't called call_subscribers will get stuck. It also triggers a new call to call_subscribers
336
+ /**
337
+ * Class containing state that an IPNS operates on. It's only exported for type info and in case that you want to use it for instanceof checks.
338
+ * subscribers is an array of functions that get called every time push_value is called with a new value AND all previous subscribers are done
339
+ * queue is the queue of values that subscribers gets called with
340
+ * last_processed_value is the last value that the subscribers were called with
341
+ * push_value adds a new value to the queue and triggers the calling of the subscribers if they're done
342
+ * subscriber_done decrements the number of subscribers we are waiting for, if this isn't called call_subscribers will get stuck. It also triggers a new call to call_subscribers
343
343
  */ class $5a591e8156b1128c$export$e2c811ae0eb35313 {
344
344
  subscribers_ = [];
345
345
  waiting_for_update_ = 0;
@@ -415,10 +415,10 @@ function $5a591e8156b1128c$export$3e42f5078e3abfc0(state) {
415
415
  }
416
416
 
417
417
 
418
- /**
419
- * You know how you can write `break` inside of a `for await` loop to exit it? Well, this lets you break the loop from outside. Pass any async iterable that never throws and you will get back a function and a specially proxied async iterable. Whenever you call the function all for await loops iterating the returned iterable will break. Note: This will add some extra ticks because awaiting thenable objects takes more ticks than awaiting promises.
420
- * @param async_iterable The async iterable you want to make exitable
421
- * @return An array containing a function, the exit function, and a wrapped async iterable
418
+ /**
419
+ * You know how you can write `break` inside of a `for await` loop to exit it? Well, this lets you break the loop from outside. Pass any async iterable that never throws and you will get back a function and a specially proxied async iterable. Whenever you call the function all for await loops iterating the returned iterable will break. Note: This will add some extra ticks because awaiting thenable objects takes more ticks than awaiting promises.
420
+ * @param async_iterable The async iterable you want to make exitable
421
+ * @return An array containing a function, the exit function, and a wrapped async iterable
422
422
  */ function $bbe52965151ee7f0$export$927664b47117acb0(async_iterable) {
423
423
  const promise_result_setting_functions = new Map();
424
424
  const exit_function = ()=>{
@@ -998,7 +998,7 @@ class $04a37742898e4bd5$export$32ccf3a614c84258 {
998
998
  }
999
999
 
1000
1000
 
1001
- const $7599647868f98022$var$needs_patching = /*@__PURE__*/ $7599647868f98022$var$check_if_querySelectorAll_needs_patching();
1001
+ const $7599647868f98022$var$needs_patching = typeof window === "object" ? /*@__PURE__*/ $7599647868f98022$var$check_if_querySelectorAll_needs_patching() : false;
1002
1002
  function $7599647868f98022$export$33f937d741e49339(element, selector) {
1003
1003
  if (!(element instanceof Element) || !$7599647868f98022$var$needs_patching || !selector.includes("#") || !selector.includes("+")) // covers most cases, we don't need patching or don't hit the bug
1004
1004
  return element?.querySelectorAll?.(selector);
@@ -1099,7 +1099,7 @@ class $9043c64496e3375f$export$12e07a2a9f87578a {
1099
1099
  #observer_callback_running = false;
1100
1100
  #execute_after_callback_ran = [];
1101
1101
  #attribute_attribution_map_object = {};
1102
- #territory = document;
1102
+ #territory;
1103
1103
  #listeners = [
1104
1104
  "exists",
1105
1105
  "creation",
@@ -1112,7 +1112,7 @@ class $9043c64496e3375f$export$12e07a2a9f87578a {
1112
1112
  ifexists: (selector, callback)=>{
1113
1113
  this.#check_observer_args(selector, callback, true);
1114
1114
  if (selector instanceof Node) {
1115
- if (document.documentElement.contains(selector)) // When the selector is a node the selector and the element are the same, dunno how we could reflect that in the typing though
1115
+ if (typeof document === "object" && (this.#territory || document.documentElement).contains(selector)) // When the selector is a node the selector and the element are the same, dunno how we could reflect that in the typing though
1116
1116
  this.#call_callbacks([
1117
1117
  callback
1118
1118
  ], (callback_)=>({
@@ -1128,7 +1128,7 @@ class $9043c64496e3375f$export$12e07a2a9f87578a {
1128
1128
  return;
1129
1129
  }
1130
1130
  const our_set = this.#attribute_attribution_map_object[selector] ||= new WeakSet();
1131
- const elements = (0, $7599647868f98022$export$33f937d741e49339)(this.#territory, selector);
1131
+ const elements = typeof document === "undefined" ? [] : (0, $7599647868f98022$export$33f937d741e49339)(this.#territory || document, selector);
1132
1132
  for(let i = 0; i < elements.length; i++){
1133
1133
  const element = elements[i];
1134
1134
  our_set.add(element);
@@ -1165,8 +1165,9 @@ class $9043c64496e3375f$export$12e07a2a9f87578a {
1165
1165
  }
1166
1166
  };
1167
1167
  #kickstart_observer() {
1168
+ if (typeof document === "undefined") return;
1168
1169
  this.#the_mutation_observer = new MutationObserver(this.#observer_callback);
1169
- this.#the_mutation_observer.observe(this.#territory, {
1170
+ this.#the_mutation_observer.observe(this.#territory || document, {
1170
1171
  attributes: true,
1171
1172
  childList: true,
1172
1173
  subtree: true,
@@ -1672,11 +1673,11 @@ const $4c6861fbcd3a0611$export$362abebb4b313340 = process.env.BASE_URL || "https
1672
1673
 
1673
1674
 
1674
1675
 
1675
- /**
1676
- * Gives a random number between min and max (potentially including min and max).
1677
- * @param min The minimum number.
1678
- * @param max The maximum number.
1679
- * @returns a random number
1676
+ /**
1677
+ * Gives a random number between min and max (potentially including min and max).
1678
+ * @param min The minimum number.
1679
+ * @param max The maximum number.
1680
+ * @returns a random number
1680
1681
  */ function $3f34dc07544c5857$export$bb0a9c36cf454ea0(min, max) {
1681
1682
  return Math.floor(Math.random() * (max - min + 1)) + min;
1682
1683
  }
@@ -1704,7 +1705,11 @@ class $d10801050840d92b$export$1b28bc5c68cc4d77 extends EventTarget {
1704
1705
  return (0, $3f34dc07544c5857$export$bb0a9c36cf454ea0)(1, 1000);
1705
1706
  }
1706
1707
  #connect() {
1707
- this.current_socket = new WebSocket(...this.#ws_constructor_options);
1708
+ this.current_socket = typeof window === "object" || typeof WebSocket === "function" ? new WebSocket(...this.#ws_constructor_options) : {
1709
+ readyState: 0,
1710
+ addEventListener: ()=>{},
1711
+ send: ()=>{}
1712
+ };
1708
1713
  this.#possible_events.forEach((name)=>{
1709
1714
  this.current_socket.addEventListener(name, (0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)((original_event)=>{
1710
1715
  let fixed_event;
@@ -1930,9 +1935,9 @@ class $d10801050840d92b$export$1d9c6fddbff3441f extends $d10801050840d92b$export
1930
1935
  }
1931
1936
 
1932
1937
 
1933
- /**
1934
- * Returns a random string
1935
- * @return A random string, containing a-z, 0-9 and occasionally a dot (`.`)
1938
+ /**
1939
+ * Returns a random string
1940
+ * @return A random string, containing a-z, 0-9 and occasionally a dot (`.`)
1936
1941
  */ function $650b64c1b384c895$export$656831b7e9c341c3() {
1937
1942
  return (Math.random() * 2e17).toString(36);
1938
1943
  }
@@ -2052,6 +2057,7 @@ const $0c84f8e99aac5765$export$28cacbd9b4306ffc = /*@__PURE__*/ $0c84f8e99aac576
2052
2057
 
2053
2058
 
2054
2059
  let $e0a87646d12cb987$export$6399bdb2291895e0 = ()=>{
2060
+ if (typeof document === "undefined") return "server";
2055
2061
  let id = "";
2056
2062
  let localstorage_error;
2057
2063
  let cookie_error;
@@ -2218,10 +2224,10 @@ async function $44909e19109bf973$export$8f66c4c7fb96eda2(e, product_id) {
2218
2224
 
2219
2225
 
2220
2226
 
2221
- /**
2222
- * Useful for the `thresholds` option of IntersectionObserver - if you want to be notified at a 10% change, call this and set num_steps to 10. Pls see https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/thresholds
2223
- * @param numSteps How many steps (notifications) there should be between 0 and 100% intersection
2224
- * @return Stuff to give to IntersectionObserver
2227
+ /**
2228
+ * Useful for the `thresholds` option of IntersectionObserver - if you want to be notified at a 10% change, call this and set num_steps to 10. Pls see https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/thresholds
2229
+ * @param numSteps How many steps (notifications) there should be between 0 and 100% intersection
2230
+ * @return Stuff to give to IntersectionObserver
2225
2231
  */ function $0da0cad4f39e8f32$export$f8ea2e7b15b5d129(numSteps) {
2226
2232
  const thresholds = [];
2227
2233
  for(let i = 1.0; i <= numSteps; i++){
@@ -2233,15 +2239,15 @@ async function $44909e19109bf973$export$8f66c4c7fb96eda2(e, product_id) {
2233
2239
  }
2234
2240
 
2235
2241
 
2236
- /**
2237
- * Elements currently intersecting with the viewport.
2238
- * If they are intersecting for the `has_to_be_intersecting_for` duration, we count it as an impression, and call the callback.
2242
+ /**
2243
+ * Elements currently intersecting with the viewport.
2244
+ * If they are intersecting for the `has_to_be_intersecting_for` duration, we count it as an impression, and call the callback.
2239
2245
  */ const $72ed530554068e4f$var$current_intersections = /*@__PURE__*/ new WeakMap();
2240
- /**
2241
- * Currently watched elements by the intersection observer with their respective callback
2246
+ /**
2247
+ * Currently watched elements by the intersection observer with their respective callback
2242
2248
  * */ const $72ed530554068e4f$var$watched_elements = /*@__PURE__*/ new WeakMap();
2243
2249
  const $72ed530554068e4f$var$unwatch_element = (element)=>{
2244
- $72ed530554068e4f$var$intersection_observer.unobserve(element);
2250
+ $72ed530554068e4f$var$intersection_observer?.unobserve(element);
2245
2251
  $72ed530554068e4f$var$watched_elements.delete(element);
2246
2252
  $72ed530554068e4f$var$current_intersections.delete(element);
2247
2253
  };
@@ -2250,7 +2256,7 @@ const $72ed530554068e4f$export$4c51576248bcdf31 = (element, callback)=>{
2250
2256
  (0, $e6c6e7929ea385ae$export$de56f1198d121036)("Not watching", element, "as it's already being watched");
2251
2257
  return ()=>{};
2252
2258
  }
2253
- $72ed530554068e4f$var$intersection_observer.observe(element);
2259
+ $72ed530554068e4f$var$intersection_observer?.observe(element);
2254
2260
  /** Calls the given callback and makes sure to stop watching the element */ const wrapped_callback = (element)=>{
2255
2261
  callback(element);
2256
2262
  $72ed530554068e4f$var$unwatch_element(element);
@@ -2273,7 +2279,7 @@ const $72ed530554068e4f$var$intersection_observer_callback = (entries)=>{
2273
2279
  const callback = $72ed530554068e4f$var$watched_elements.get(target);
2274
2280
  // Skip the element if it's no longer being watched.
2275
2281
  if (!callback) {
2276
- $72ed530554068e4f$var$intersection_observer.unobserve(target);
2282
+ $72ed530554068e4f$var$intersection_observer?.unobserve(target);
2277
2283
  continue;
2278
2284
  }
2279
2285
  const currently_intersecting = $72ed530554068e4f$var$current_intersections.has(target);
@@ -2303,12 +2309,12 @@ const $72ed530554068e4f$var$intersection_observer_callback = (entries)=>{
2303
2309
  }
2304
2310
  }
2305
2311
  };
2306
- /**
2307
- * Global IntersectionObserver used for all impression tracking.
2308
- * It's faster to use one observer for all elements than to create a new one for each element.
2309
- */ const $72ed530554068e4f$var$intersection_observer = /*@__PURE__*/ new IntersectionObserver((0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)($72ed530554068e4f$var$intersection_observer_callback), {
2312
+ /**
2313
+ * Global IntersectionObserver used for all impression tracking.
2314
+ * It's faster to use one observer for all elements than to create a new one for each element.
2315
+ */ const $72ed530554068e4f$var$intersection_observer = typeof window === "object" ? /*@__PURE__*/ new IntersectionObserver((0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)($72ed530554068e4f$var$intersection_observer_callback), {
2310
2316
  threshold: /*@__PURE__*/ (0, /*@__PURE__*/$0da0cad4f39e8f32$export$f8ea2e7b15b5d129)(8)
2311
- });
2317
+ }) : undefined;
2312
2318
 
2313
2319
 
2314
2320
 
@@ -2325,10 +2331,6 @@ const $11ff7b46c1fb674c$export$d0efd8ed14f5c33 = (items, display, info)=>{
2325
2331
  (0, $e6c6e7929ea385ae$export$de56f1198d121036)("Impression tracking: Can't observe", items, display);
2326
2332
  return items;
2327
2333
  }
2328
- if (!info.t) {
2329
- (0, $e6c6e7929ea385ae$export$de56f1198d121036)("Impression tracking: No tenant instance, can't track", items, display);
2330
- return items;
2331
- }
2332
2334
  (0, $2a1cbc63a04d4a2d$export$b6ae1bc530f4c149).onexists(first_watchable_el, ({ element: element })=>{
2333
2335
  (0, $72ed530554068e4f$export$4c51576248bcdf31)(element, ()=>{
2334
2336
  const { recommendation_id: recommendation_id , search_result_id: search_result_id , product_listing_result_id: product_listing_result_id , suggestions_result_id: suggestions_result_id } = display;
@@ -2444,9 +2446,10 @@ async function $c8263a2185830bf1$export$2c34560c3749dc63(button, get_product_id,
2444
2446
 
2445
2447
  const $69f7524c8bdd85b4$export$20e9533e68ee72e7 = /*@__PURE__*/ (0, /*@__PURE__*/$9a42a570de51ea3d$export$e806c6c1615a59ae)(false);
2446
2448
  const $69f7524c8bdd85b4$export$a9d39e43ae273d26 = /*@__PURE__*/ (0, /*@__PURE__*/$9a42a570de51ea3d$export$e806c6c1615a59ae)();
2447
- const $69f7524c8bdd85b4$export$446840cab57eeedb = /*@__PURE__*/ new Set();
2449
+ const $69f7524c8bdd85b4$export$7500cdfd37aafd43 = /*@__PURE__*/ new Set();
2448
2450
  let $69f7524c8bdd85b4$var$old_url;
2449
- const $69f7524c8bdd85b4$var$maybe_navigation = ()=>{
2451
+ const $69f7524c8bdd85b4$var$maybe_navigation = (what_happened, args)=>{
2452
+ if (typeof location === "undefined") return;
2450
2453
  const new_url = location.href;
2451
2454
  if ($69f7524c8bdd85b4$var$old_url !== new_url) {
2452
2455
  $69f7524c8bdd85b4$export$a9d39e43ae273d26(new_url);
@@ -2454,13 +2457,11 @@ const $69f7524c8bdd85b4$var$maybe_navigation = ()=>{
2454
2457
  $69f7524c8bdd85b4$export$20e9533e68ee72e7(new_url);
2455
2458
  $69f7524c8bdd85b4$var$old_url = new_url;
2456
2459
  }
2460
+ for (const fn of $69f7524c8bdd85b4$export$7500cdfd37aafd43)fn(what_happened, args);
2457
2461
  };
2458
- $69f7524c8bdd85b4$export$baccefee4a395d8f($69f7524c8bdd85b4$var$maybe_navigation);
2462
+ $69f7524c8bdd85b4$export$baccefee4a395d8f((args, what_happened)=>$69f7524c8bdd85b4$var$maybe_navigation(what_happened, args));
2459
2463
  $69f7524c8bdd85b4$var$maybe_navigation();
2460
- window.addEventListener("popstate", (0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)((e)=>{
2461
- for (const fn of $69f7524c8bdd85b4$export$446840cab57eeedb)(0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)(fn)(e);
2462
- $69f7524c8bdd85b4$var$maybe_navigation();
2463
- }));
2464
+ globalThis?.window?.addEventListener("popstate", (0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)((e)=>$69f7524c8bdd85b4$var$maybe_navigation("popstate", e)));
2464
2465
  async function $69f7524c8bdd85b4$export$1cd22bab0d2c3b0b(callback) {
2465
2466
  const catchified_callback = (0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)(callback);
2466
2467
  for await (const href of $69f7524c8bdd85b4$export$20e9533e68ee72e7){
@@ -2469,13 +2470,22 @@ async function $69f7524c8bdd85b4$export$1cd22bab0d2c3b0b(callback) {
2469
2470
  }
2470
2471
  }
2471
2472
  async function $69f7524c8bdd85b4$export$baccefee4a395d8f(after_navigation, replace_replaceState = true) {
2473
+ if (typeof History === "undefined") return;
2472
2474
  const { prototype: prototype } = History;
2473
2475
  const instance = history;
2474
2476
  const polyfill_dance = (the_thing)=>{
2475
2477
  const proxy_the_thing = (obj)=>{
2476
2478
  const orig_pushState = obj[the_thing];
2477
2479
  obj[the_thing] = new Proxy(orig_pushState, {
2478
- apply: (...args)=>$69f7524c8bdd85b4$var$history_applier(after_navigation, ...args)
2480
+ apply: (target, this_arg, arguments_list)=>{
2481
+ const nav_result = Reflect.apply(target, this_arg, arguments_list);
2482
+ try {
2483
+ after_navigation(arguments_list, the_thing);
2484
+ } catch (e) {
2485
+ (0, $548fd58b14b25a52$export$8048b892d651b310)(e);
2486
+ }
2487
+ return nav_result;
2488
+ }
2479
2489
  });
2480
2490
  };
2481
2491
  proxy_the_thing(prototype);
@@ -2485,15 +2495,6 @@ async function $69f7524c8bdd85b4$export$baccefee4a395d8f(after_navigation, repla
2485
2495
  polyfill_dance("pushState");
2486
2496
  if (replace_replaceState) polyfill_dance("replaceState");
2487
2497
  }
2488
- function $69f7524c8bdd85b4$var$history_applier(after_navigation, target, thisArg, argumentsList) {
2489
- const nav_result = target.apply(thisArg, argumentsList);
2490
- try {
2491
- after_navigation(argumentsList);
2492
- } catch (e) {
2493
- (0, $548fd58b14b25a52$export$8048b892d651b310)(e);
2494
- }
2495
- return nav_result;
2496
- }
2497
2498
 
2498
2499
 
2499
2500
  let $72ee205b59322497$var$last_page_pageview_sent_for;
@@ -2650,17 +2651,17 @@ const $28e42b0009d694b2$export$abec7fd9f0b9cc22 = /*@__PURE__*/ (0, /*@__PURE__*
2650
2651
 
2651
2652
 
2652
2653
  const $2026711c6c2d6204$var$required_consent_level = process.env.DEPICT_TRACKING_CONSENT_LEVEL;
2653
- /*
2654
- The Optanon cookie format can vary slightly between integrations. To figure out the key values used for a particular customer,
2655
- visit their web, finish the consent dialog, then run
2656
- new URLSearchParams(document.cookie.match("(^|;)\\s*OptanonConsent\\s*=\\s*([^;]+)")?.pop()).get("groups")
2657
- in the console. You should see something like
2658
- 'NECES:1,ANALY:1,PERON:1,MARKE:1'
2659
- Which tells you what the key values for each consent level is. Enter them in the correct order, comma separated,
2660
- as OPTANON_KEYS in the tenants .env file. For the cookie output above, the .env entry would be
2661
- OPTANON_KEYS="NECES,ANALY,PERON,MARKE"
2662
- If it's not obvious which consent level each key represents, open the consent dialog again and start de-selecting consent options,
2663
- then check the cookie value again.
2654
+ /*
2655
+ The Optanon cookie format can vary slightly between integrations. To figure out the key values used for a particular customer,
2656
+ visit their web, finish the consent dialog, then run
2657
+ new URLSearchParams(document.cookie.match("(^|;)\\s*OptanonConsent\\s*=\\s*([^;]+)")?.pop()).get("groups")
2658
+ in the console. You should see something like
2659
+ 'NECES:1,ANALY:1,PERON:1,MARKE:1'
2660
+ Which tells you what the key values for each consent level is. Enter them in the correct order, comma separated,
2661
+ as OPTANON_KEYS in the tenants .env file. For the cookie output above, the .env entry would be
2662
+ OPTANON_KEYS="NECES,ANALY,PERON,MARKE"
2663
+ If it's not obvious which consent level each key represents, open the consent dialog again and start de-selecting consent options,
2664
+ then check the cookie value again.
2664
2665
  */ const $2026711c6c2d6204$var$KEY_ORDER = [
2665
2666
  "necessary",
2666
2667
  "statistics",
@@ -3021,8 +3022,8 @@ class $16f3a26cfac77a4c$export$8d42ce4827f43582 {
3021
3022
  });
3022
3023
  })();
3023
3024
  }
3024
- } /**
3025
- * This is a list of alpha-2 country codes plus some two letter combinations commonly used to describe markets
3025
+ } /**
3026
+ * This is a list of alpha-2 country codes plus some two letter combinations commonly used to describe markets
3026
3027
  */ // albania
3027
3028
 
3028
3029
 
@@ -3245,11 +3246,11 @@ const $fbb09973782881cb$export$6ebd242c09192cec = /*@__PURE__*/ (0, /*@__PURE__*
3245
3246
 
3246
3247
 
3247
3248
  // not ideal but can help when debugging via sentry
3248
- /**
3249
- * A function that attempts to "serialize" an object to a text representation that helps with debugging when using sentry
3250
- * @param anything Something to try to serialize - this function is crappy and your mileage may vary
3251
- * @param depth How deep to go when recursing
3252
- * @return An object that is somehow closer to text (better serializable by sentry) or text
3249
+ /**
3250
+ * A function that attempts to "serialize" an object to a text representation that helps with debugging when using sentry
3251
+ * @param anything Something to try to serialize - this function is crappy and your mileage may vary
3252
+ * @param depth How deep to go when recursing
3253
+ * @return An object that is somehow closer to text (better serializable by sentry) or text
3253
3254
  */ function $45e05ec4fd7f1ee7$export$39d526a1194b6499(anything, depth) {
3254
3255
  depth ??= 0;
3255
3256
  depth++;
@@ -3376,7 +3377,7 @@ async function $558ccd2de887e6d9$export$a9fc160c5ed83bd7(t, rendering_options) {
3376
3377
  }
3377
3378
  // return if too few displays
3378
3379
  const { min_items_to_run: min_items_to_run } = rendering_options;
3379
- const good_displays = await $558ccd2de887e6d9$var$check_displays(displays, min_items_to_run).catch((0, $548fd58b14b25a52$export$8048b892d651b310));
3380
+ const good_displays = await $558ccd2de887e6d9$var$check_displays(t, displays, min_items_to_run).catch((0, $548fd58b14b25a52$export$8048b892d651b310));
3380
3381
  if (!good_displays) return {};
3381
3382
  const processed_displays = await $558ccd2de887e6d9$export$c22e610107c5a15a(t, rendering_options, displays);
3382
3383
  if (!processed_displays.length) {
@@ -3451,6 +3452,7 @@ function $558ccd2de887e6d9$export$c42139a43c877ecd(obj) {
3451
3452
  return obj;
3452
3453
  }
3453
3454
  async function $558ccd2de887e6d9$export$cf7cbc6b76039101(t, rendering_options, displays, index, functions, elements, event_listeners = []) {
3455
+ let b;
3454
3456
  let keep = true;
3455
3457
  const info = new $558ccd2de887e6d9$export$da854280fb61cd32(t, rendering_options, displays, index, ()=>keep = false, event_listeners);
3456
3458
  for(let i = 0; i < functions.length; i++){
@@ -3485,7 +3487,6 @@ async function $558ccd2de887e6d9$export$c22e610107c5a15a(t, rendering_options, d
3485
3487
  }
3486
3488
  class $558ccd2de887e6d9$export$da854280fb61cd32 {
3487
3489
  constructor(t, rendering_options, displays, index, remove_display, event_listeners){
3488
- // @ts-ignore Support for no-tenant recommendation rendering for js-ui/react-ui
3489
3490
  this.t = t;
3490
3491
  this.rendering_options = rendering_options;
3491
3492
  this.displays = displays;
@@ -3497,7 +3498,7 @@ class $558ccd2de887e6d9$export$da854280fb61cd32 {
3497
3498
  }
3498
3499
  }
3499
3500
  }
3500
- async function $558ccd2de887e6d9$var$check_displays(displays, min_items_to_run) {
3501
+ async function $558ccd2de887e6d9$var$check_displays(t, displays, min_items_to_run) {
3501
3502
  // don't run if too few recs
3502
3503
  if (min_items_to_run && displays.length < min_items_to_run) {
3503
3504
  (0, $e6c6e7929ea385ae$export$de56f1198d121036)("RR: Got too few displays, exiting");
@@ -3508,8 +3509,6 @@ async function $558ccd2de887e6d9$var$check_displays(displays, min_items_to_run)
3508
3509
  async function $558ccd2de887e6d9$var$make_sure_we_have_displays(t, rendering_options) {
3509
3510
  const recs = await rendering_options.recs;
3510
3511
  if (Array.isArray(recs)) return $558ccd2de887e6d9$export$c42139a43c877ecd(recs);
3511
- if (!t) // No recs and no tenant, so we can't get any. Should never happen.
3512
- return [];
3513
3512
  // get displays with get_displays if none are provided
3514
3513
  const get_displays_options = {
3515
3514
  type: rendering_options.type,
@@ -3734,8 +3733,8 @@ function $d1ef5fbddf08305d$var$find_last_visible(items) {
3734
3733
 
3735
3734
 
3736
3735
 
3737
- /**
3738
- * @deprecated use async_iterable_ipns instead. This can skip values which yields unexpected results.
3736
+ /**
3737
+ * @deprecated use async_iterable_ipns instead. This can skip values which yields unexpected results.
3739
3738
  */ function $7198207999c01453$export$55621c1ce3cd536b() {
3740
3739
  // the idea is to have a new promise available immediately before one resolves, so to say an infinite promise
3741
3740
  let internal_resolve; // copy and pasted from iconbeauty
@@ -3847,12 +3846,12 @@ async function $8686e45614d71607$export$9eae832ae57fbf(t, css, extra_html) {
3847
3846
 
3848
3847
  // TODO: Move ArrayElement<> to better util place
3849
3848
  // All the supported markets of all the Tenants (all possible markets).
3850
- /**
3851
- * @deprecated please use TwoLetterMarket / readonly arrays/objects instead
3849
+ /**
3850
+ * @deprecated please use TwoLetterMarket / readonly arrays/objects instead
3852
3851
  */ let $e86d825ce508e342$export$3db8c5834c5aa726;
3853
3852
  // All the known locales (add more)
3854
- /**
3855
- * @deprecated please use TwoLetterMarket / readonly arrays/objects instead
3853
+ /**
3854
+ * @deprecated please use TwoLetterMarket / readonly arrays/objects instead
3856
3855
  */ (function(Market) {
3857
3856
  Market["dk"] = "dk";
3858
3857
  Market["uk"] = "uk";
@@ -3965,8 +3964,8 @@ function $e86d825ce508e342$export$47340c0b196bc0f8(market) {
3965
3964
  }
3966
3965
  function $e86d825ce508e342$export$c5b68ecd5c37aa6c(market) {
3967
3966
  return $e86d825ce508e342$export$6eea148df5c7117c[market].currency;
3968
- } /**
3969
- * @deprecated please use TwoLetterMarket / readonly arrays/objects instead
3967
+ } /**
3968
+ * @deprecated please use TwoLetterMarket / readonly arrays/objects instead
3970
3969
  */
3971
3970
 
3972
3971
 
@@ -4313,6 +4312,7 @@ const $107a74aa4ea5902d$export$34b9dba7ce09269b = (tag, { children: children , .
4313
4312
  // Exhaustive list (I think) for these checks should be ["svg","animate","animateMotion","animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","stop","switch","symbol","text","textPath","tspan","use","view"]
4314
4313
  const is_svg = props?.xmlns || tag == "defs" || tag == "filter" || tag == "fecolormatrix" || tag == "g" || tag == "circle" || tag == "circle" || tag == "svg" || tag == "path" || tag == "polygon";
4315
4314
  if (is_svg) var namespace = props?.xmlns || "http://www.w3.org/2000/svg";
4315
+ if (typeof document === "undefined") return {};
4316
4316
  const element = is_svg ? document.createElementNS(namespace, tag) : document.createElement(tag);
4317
4317
  for(const key in props){
4318
4318
  const value = props[key];
@@ -4329,6 +4329,7 @@ const $107a74aa4ea5902d$export$34b9dba7ce09269b = (tag, { children: children , .
4329
4329
  };
4330
4330
  const $107a74aa4ea5902d$export$25062201e9e25d76 = $107a74aa4ea5902d$export$34b9dba7ce09269b;
4331
4331
  const $107a74aa4ea5902d$export$ffb0004e005737fa = ({ children: children }, _unknown)=>{
4332
+ if (typeof document === "undefined") return {};
4332
4333
  const df = document.createDocumentFragment();
4333
4334
  $107a74aa4ea5902d$var$appendChild(df, children);
4334
4335
  return df;
@@ -4777,7 +4778,6 @@ const $04d2f7d9126af667$export$ed8a68dacd075983 = /*@__PURE__*/ new Map();
4777
4778
  const $04d2f7d9126af667$export$4b50a4de9c6bbe09 = /*@__PURE__*/ new WeakSet();
4778
4779
  function $04d2f7d9126af667$export$fb9afe9f540ae069(elements, _display, info) {
4779
4780
  if (!elements?.length) return elements;
4780
- if (!info.t) return elements;
4781
4781
  const elements_as_array = [
4782
4782
  ...elements
4783
4783
  ];
@@ -4803,8 +4803,6 @@ const $04d2f7d9126af667$export$3777a14dd8c2363d = /*@__PURE__*/ new WeakSet();
4803
4803
  function $04d2f7d9126af667$export$1bffac19f9f0d6fc(elements, _display, info) {
4804
4804
  if (!elements?.length) // don't make it hurt even more that rendering failed
4805
4805
  return elements;
4806
- if (!info.t) // GTAG tracking is deprecated, if we're doing no-tenant recommendation rendering it's SDK anyway.
4807
- return elements;
4808
4806
  const [first_element] = elements;
4809
4807
  const handler = (0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)(()=>{
4810
4808
  const { rendering_options: rendering_options , displays: displays } = info;
@@ -4823,7 +4821,6 @@ function $04d2f7d9126af667$export$1bffac19f9f0d6fc(elements, _display, info) {
4823
4821
  }
4824
4822
  function $04d2f7d9126af667$export$9e1caada6901f552(elements, _display, info) {
4825
4823
  const { t: t } = info;
4826
- if (!t) return elements;
4827
4824
  (async ()=>{
4828
4825
  (0, $72ee205b59322497$export$eee4c4d924348b05)({
4829
4826
  tenant: t.tenant,
@@ -4895,7 +4892,7 @@ function $04d2f7d9126af667$var$push_function(fn1, handler) {
4895
4892
 
4896
4893
 
4897
4894
 
4898
- const $f3f05d97149aec76$export$deca40f48c0569f8 = /*@__PURE__*/ localStorage.getItem("colorize-logics") === "true";
4895
+ const $f3f05d97149aec76$export$deca40f48c0569f8 = typeof window === "undefined" ? false : /*@__PURE__*/ localStorage.getItem("colorize-logics") === "true";
4899
4896
  function $f3f05d97149aec76$export$16501883f477737a(elements, display) {
4900
4897
  elements.forEach((elem)=>{
4901
4898
  if (elem.nodeType !== Node.TEXT_NODE) {
@@ -5207,8 +5204,8 @@ class $0b6a8303b64cced1$export$1a8782481a9af507 {
5207
5204
  }
5208
5205
 
5209
5206
 
5210
- var /**
5211
- * @deprecated Please use RecommendationRenderer instead
5207
+ var /**
5208
+ * @deprecated Please use RecommendationRenderer instead
5212
5209
  */ $52d3be7ce5146924$export$2e2bcd8739ae039 = async (options)=>{
5213
5210
  const depict = new (0, $0b6a8303b64cced1$export$1a8782481a9af507)(options.options), done = new Promise((itsdone)=>{
5214
5211
  document._depict_modify = true;
@@ -5484,14 +5481,14 @@ function $765ddca135d7ab33$export$c410ce1205e5118a(_t, itms, d, slider) {
5484
5481
 
5485
5482
 
5486
5483
 
5487
- var /**
5488
- * @deprecated please use `fetch_retry()` instead
5489
- *
5490
- * Windows proof fetch factory: windows proof fetch is a utility which retries fetch requests 10 times when they fail. Reason for this is a certain windows 10 build where the network stack randomly breaks 20% of https connections
5491
- * (Note: this thing really should be rewritten with exponential backoff and a better API)
5492
- * @param dlog logging function to use
5493
- * @param error_log an array to which errors will be pushed
5494
- * @return a windows proof fetch function
5484
+ var /**
5485
+ * @deprecated please use `fetch_retry()` instead
5486
+ *
5487
+ * Windows proof fetch factory: windows proof fetch is a utility which retries fetch requests 10 times when they fail. Reason for this is a certain windows 10 build where the network stack randomly breaks 20% of https connections
5488
+ * (Note: this thing really should be rewritten with exponential backoff and a better API)
5489
+ * @param dlog logging function to use
5490
+ * @param error_log an array to which errors will be pushed
5491
+ * @return a windows proof fetch function
5495
5492
  */ $c413c7798924612a$export$2e2bcd8739ae039 = (dlog, error_log)=>{
5496
5493
  // https://sentry.io/organizations/depictai-0o/issues/2025371462/?project=5476183&query=is%3Aunresolved
5497
5494
  // https://stackoverflow.com/a/52947884
@@ -5703,10 +5700,10 @@ async function $1cc2444a0f1b992e$export$c84671f46d6a1ca({ rows: rows , container
5703
5700
  }
5704
5701
  });
5705
5702
  }
5706
- /** Getting how many recs should be displayed for a certain row (while taking override rules into account)
5707
- * This returns number of recs for this row and all the previous ones
5708
- * @param row The "index" of the row (counting from the top). Starts at 1.
5709
- * @param options Your cols_at_size layout option
5703
+ /** Getting how many recs should be displayed for a certain row (while taking override rules into account)
5704
+ * This returns number of recs for this row and all the previous ones
5705
+ * @param row The "index" of the row (counting from the top). Starts at 1.
5706
+ * @param options Your cols_at_size layout option
5710
5707
  */ function $1cc2444a0f1b992e$var$get_total_rec_amount_for_row(row, options) {
5711
5708
  const [default_cols, , , , override_obj] = options;
5712
5709
  const overrides = override_obj?.overrides || {};
@@ -5717,8 +5714,8 @@ async function $1cc2444a0f1b992e$export$c84671f46d6a1ca({ rows: rows , container
5717
5714
  }
5718
5715
  return total;
5719
5716
  }
5720
- /**
5721
- * Same as `get_total_rec_amount_for_row` but caps the result to never exceed @param max_recs
5717
+ /**
5718
+ * Same as `get_total_rec_amount_for_row` but caps the result to never exceed @param max_recs
5722
5719
  */ function $1cc2444a0f1b992e$var$get_visible_recs_without_partial_rows(rows, max_recs, options) {
5723
5720
  let visible_recs;
5724
5721
  while((visible_recs = $1cc2444a0f1b992e$var$get_total_rec_amount_for_row(rows--, options)) > max_recs);
@@ -5757,13 +5754,13 @@ function $1cc2444a0f1b992e$export$17c3166a7ebd4688(selector_beginning, default_g
5757
5754
  const overrides = override?.overrides || {};
5758
5755
  const sorted = Object.keys(overrides).sort((r1, r2)=>parseInt(r1) - parseInt(r2));
5759
5756
  const last_override_row = sorted.at(-1);
5760
- /** We run this loop up until the last override rule + 1.
5761
- * The last iteration will create styling rules that apply to every row that comes after it.
5762
- * Let's say we have one override rule for row 2.
5763
- * We:
5764
- * 1. Create styling for row 1
5765
- * 2. Create styling for row 2
5766
- * 3. Create styling for row 3 which will apply to the rest of the rows. Every row will be the same from now on.
5757
+ /** We run this loop up until the last override rule + 1.
5758
+ * The last iteration will create styling rules that apply to every row that comes after it.
5759
+ * Let's say we have one override rule for row 2.
5760
+ * We:
5761
+ * 1. Create styling for row 1
5762
+ * 2. Create styling for row 2
5763
+ * 3. Create styling for row 3 which will apply to the rest of the rows. Every row will be the same from now on.
5767
5764
  */ const max_row = last_override_row ? parseInt(last_override_row) + 1 : 1;
5768
5765
  for(let row = 1; row <= max_row; row++){
5769
5766
  const real_n_cols = overrides[row] || n_cols;
@@ -6716,12 +6713,12 @@ function $3721a5ccba25c247$export$3d04c40e7acc1a32(initial_value) {
6716
6713
 
6717
6714
 
6718
6715
 
6719
- /**
6720
- * A wrapper around window.matchMedia, basically cross browser compatibly adds an event listener to a media query that triggers when it changes
6721
- * @param query The media query (without `@media`)
6722
- * @param catchified_handler The function to execute
6723
- * @param initial_call If the handler should be called instantly with the current state of the media query
6724
- * @return An object containing `remove`, a function which removes the event listener again
6716
+ /**
6717
+ * A wrapper around window.matchMedia, basically cross browser compatibly adds an event listener to a media query that triggers when it changes
6718
+ * @param query The media query (without `@media`)
6719
+ * @param catchified_handler The function to execute
6720
+ * @param initial_call If the handler should be called instantly with the current state of the media query
6721
+ * @return An object containing `remove`, a function which removes the event listener again
6725
6722
  */
6726
6723
  function $93c499898a1702c7$export$515c3ea4d599b05a(// inspired by code in houdinisportswear modify script
6727
6724
  query, handler, initial_call = true) {
@@ -6991,9 +6988,9 @@ async function $8594d423459ba80c$export$d63b08f4f29ddba5(t, unavailability_type)
6991
6988
 
6992
6989
 
6993
6990
 
6994
- /**
6995
- * Set but you can listen for values being added or removed
6996
- * i.e. my_set.addEventListener("add", ({detail}) => console.log(detail, "was added to", my_set));
6991
+ /**
6992
+ * Set but you can listen for values being added or removed
6993
+ * i.e. my_set.addEventListener("add", ({detail}) => console.log(detail, "was added to", my_set));
6997
6994
  */ class $d343f609f5a6614f$export$74108888f38788f3 extends Set {
6998
6995
  #et = new EventTarget();
6999
6996
  addEventListener(event, callback, options) {
@@ -7021,12 +7018,12 @@ async function $8594d423459ba80c$export$d63b08f4f29ddba5(t, unavailability_type)
7021
7018
 
7022
7019
 
7023
7020
 
7024
- /**
7025
- * This does what you'd think Element.closest does. It finds the closest node in the DOM tree matching a selector. So it starts out with the siblings and then goes upwards in the DOM and checks the siblings and their children of the parent until there's no parent anymore.
7026
- * @param element Element to start out at
7027
- * @param selector Selector to search for
7028
- * @param start_right=true In what direction to start: true = right, false = left
7029
- * @return The found element or undefined
7021
+ /**
7022
+ * This does what you'd think Element.closest does. It finds the closest node in the DOM tree matching a selector. So it starts out with the siblings and then goes upwards in the DOM and checks the siblings and their children of the parent until there's no parent anymore.
7023
+ * @param element Element to start out at
7024
+ * @param selector Selector to search for
7025
+ * @param start_right=true In what direction to start: true = right, false = left
7026
+ * @return The found element or undefined
7030
7027
  */ function $14d244e5a13fa0df$export$d9fdc6ce2907f95b(element, selector, start_right = true) {
7031
7028
  for(; element; element = element.parentNode){
7032
7029
  if (element?.matches?.(selector)) return element;
@@ -7079,10 +7076,10 @@ function $1e9d51e365c02476$export$82539d9817116aff(e, url) {
7079
7076
  }
7080
7077
 
7081
7078
 
7082
- /**
7083
- * This module contains utillities for working with ecom sites using shoppify.
7084
- *
7085
- * Shopify cart API reference: https://shopify.dev/api/ajax/reference/cart
7079
+ /**
7080
+ * This module contains utillities for working with ecom sites using shoppify.
7081
+ *
7082
+ * Shopify cart API reference: https://shopify.dev/api/ajax/reference/cart
7086
7083
  */
7087
7084
 
7088
7085
  async function $7ccebf01cfe4f824$export$85be83e1935d93c2(fetch_proxy_handler, // we assume fetch is actually fetch, therefore proxy handler is typed like this
@@ -7663,14 +7660,14 @@ function $bd274a272f8400ec$export$4fbbab6c30e664d5(value) {
7663
7660
 
7664
7661
 
7665
7662
  const $6d0c26cd36f5eeff$var$promise_as_string = "Promise";
7666
- const $6d0c26cd36f5eeff$var$w = window;
7667
7663
  function $6d0c26cd36f5eeff$export$38e89c688f9d553a() {
7668
7664
  try {
7669
- let da_promise = $6d0c26cd36f5eeff$var$w[$6d0c26cd36f5eeff$var$promise_as_string];
7665
+ const w = window;
7666
+ let da_promise = w[$6d0c26cd36f5eeff$var$promise_as_string];
7670
7667
  let iframe_promise;
7671
7668
  if ((typeof da_promise.allSettled !== "function" || typeof da_promise?.prototype?.finally !== "function") && !(0, $bd274a272f8400ec$export$4fbbab6c30e664d5)(da_promise) && (iframe_promise = $6d0c26cd36f5eeff$export$e647444ed9403635())) da_promise = iframe_promise;
7672
7669
  if (da_promise) {
7673
- if (Object.getOwnPropertyDescriptor($6d0c26cd36f5eeff$var$w, $6d0c26cd36f5eeff$var$promise_as_string)?.configurable !== false) Object.defineProperty($6d0c26cd36f5eeff$var$w, $6d0c26cd36f5eeff$var$promise_as_string, {
7670
+ if (Object.getOwnPropertyDescriptor(w, $6d0c26cd36f5eeff$var$promise_as_string)?.configurable !== false) Object.defineProperty(w, $6d0c26cd36f5eeff$var$promise_as_string, {
7674
7671
  configurable: false,
7675
7672
  enumerable: true,
7676
7673
  get () {
@@ -7824,8 +7821,8 @@ function $2780129735dc272e$export$2a38b176ce969e2c(orig_url_with_trailing_slash)
7824
7821
 
7825
7822
 
7826
7823
 
7827
- /**
7828
- * Recursively sorts the keys in an object (NOT in-place, returns a new object). Do not provide objects containing anything other than primitives or other objects. Do not provide objects that have cyclical values.
7824
+ /**
7825
+ * Recursively sorts the keys in an object (NOT in-place, returns a new object). Do not provide objects containing anything other than primitives or other objects. Do not provide objects that have cyclical values.
7829
7826
  */ function $24daf6f6e6529b9f$export$12b4c6cbc6b8b4e4(maybe_obj) {
7830
7827
  if (!maybe_obj) return maybe_obj;
7831
7828
  if (typeof maybe_obj != "object") return maybe_obj;
@@ -7844,18 +7841,18 @@ function $2780129735dc272e$export$2a38b176ce969e2c(orig_url_with_trailing_slash)
7844
7841
  }
7845
7842
 
7846
7843
 
7847
- /**
7848
- * Tries to figure out the tenant's market (`TwoLetterMarket` for new integrations) through various means.
7849
- *
7850
- * 1. Checks if there is a market in one of the url segments (www.tentant.se/foo/se/bar)
7851
- * 2. Checks if the market is specified in the tenant's domain name (www.tenant-se.com)
7852
- * 3. Checks the toplevel domain (www.tenant.se/foo/bar)
7853
- *
7854
- * @param allowed_markets An array the possible markets for the tenant.
7855
- * Dont forget to specify the allowed market as const (`["se", "en"] as const`) to get the best typing
7856
- * @param url Specify this to overide the url to check, defaults to the current url
7857
- * @param tenant The tenant's name
7858
- * @returns If a market specified in `allowed_markets`was found that is returned, `undefined` otherwise
7844
+ /**
7845
+ * Tries to figure out the tenant's market (`TwoLetterMarket` for new integrations) through various means.
7846
+ *
7847
+ * 1. Checks if there is a market in one of the url segments (www.tentant.se/foo/se/bar)
7848
+ * 2. Checks if the market is specified in the tenant's domain name (www.tenant-se.com)
7849
+ * 3. Checks the toplevel domain (www.tenant.se/foo/bar)
7850
+ *
7851
+ * @param allowed_markets An array the possible markets for the tenant.
7852
+ * Dont forget to specify the allowed market as const (`["se", "en"] as const`) to get the best typing
7853
+ * @param url Specify this to overide the url to check, defaults to the current url
7854
+ * @param tenant The tenant's name
7855
+ * @returns If a market specified in `allowed_markets`was found that is returned, `undefined` otherwise
7859
7856
  */ function $02a3425594231893$export$a422d714c8cb1a5d(allowed_markets, url, tenant = process.env.TENANT) {
7860
7857
  const u_o = url ? new URL(url) : location;
7861
7858
  const { hostname: hostname } = u_o;
@@ -7972,9 +7969,9 @@ function $05802e6cb0fdbdcd$export$3427ec8268623f1(listener) {
7972
7969
 
7973
7970
 
7974
7971
 
7975
- /**
7976
- * Timeout a promise after `ms` milliseconds.
7977
- * If the promise is timed out this function will return `undefined` and not throw.
7972
+ /**
7973
+ * Timeout a promise after `ms` milliseconds.
7974
+ * If the promise is timed out this function will return `undefined` and not throw.
7978
7975
  */ function $9ed7c4b0fbf9ccd8$export$cd1adfb8059b5fcd(promise, ms) {
7979
7976
  const timeout = new Promise((res)=>setTimeout(res, ms));
7980
7977
  return Promise.race([
@@ -8257,9 +8254,9 @@ const $69accc27bcbd6972$export$ddd70fdae1b350e6 = ()=>(0, $107a74aa4ea5902d$expo
8257
8254
 
8258
8255
 
8259
8256
 
8260
- /**
8261
- * Internal color circle used in ColorPicker
8262
- * @see {createColorPicker}
8257
+ /**
8258
+ * Internal color circle used in ColorPicker
8259
+ * @see {createColorPicker}
8263
8260
  */ function $af92e61c7dfccf01$var$ColorCircle({ color: color , onClick: onClick , onHoverUpdate: onHoverUpdate }) {
8264
8261
  const button = (0, $107a74aa4ea5902d$export$34b9dba7ce09269b)("button", {
8265
8262
  class: "color-circle-container",
@@ -8286,9 +8283,9 @@ function $af92e61c7dfccf01$export$590326cc34f49e2d({ colors: colors , initialCol
8286
8283
  ColorPicker () {
8287
8284
  /** The currently active ColorCircle */ let activeCircle = null;
8288
8285
  /** The currently active color object */ let activeColor = null;
8289
- /**
8290
- * Update the currently active color object and HTMLElement
8291
- * Toggles the active class.
8286
+ /**
8287
+ * Update the currently active color object and HTMLElement
8288
+ * Toggles the active class.
8292
8289
  */ const setActive = (e, color)=>{
8293
8290
  if (e !== activeCircle) {
8294
8291
  if (activeCircle) activeCircle.classList.remove("active");
@@ -8301,8 +8298,8 @@ function $af92e61c7dfccf01$export$590326cc34f49e2d({ colors: colors , initialCol
8301
8298
  if (!dontSetActiveOnClick) setActive(clicked, color);
8302
8299
  onSelect(color);
8303
8300
  };
8304
- /**
8305
- * Handles the preview logic.
8301
+ /**
8302
+ * Handles the preview logic.
8306
8303
  */ const handleSelectOnHover = (hovered, color, hovering)=>{
8307
8304
  // Don't do any selection if the hovered circle is already selected
8308
8305
  if (hovered === activeCircle) return;
@@ -8433,7 +8430,7 @@ $80ae37b75f3a6ec8$exports = ".depict-img-cont {\n width: 100%;\n height: 100%;
8433
8430
 
8434
8431
 
8435
8432
  const $ff973b2032639b5f$export$3d13beba9b52c947 = "https://img.depict.ai/ResizeImage" + (process.env.TENANT ? "/" + process.env.TENANT : "");
8436
- const $ff973b2032639b5f$export$a98fc8a2c818d3d8 = /*@__PURE__*/ (()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent))(); // https://stackoverflow.com/a/23522755
8433
+ const $ff973b2032639b5f$export$a98fc8a2c818d3d8 = /*@__PURE__*/ (()=>typeof navigator === "undefined" ? false : /^((?!chrome|android).)*safari/i.test(navigator.userAgent))(); // https://stackoverflow.com/a/23522755
8437
8434
  function $ff973b2032639b5f$export$f39a7d0667e924a(what_to_watch, sizes_communicator = (0, $9a42a570de51ea3d$export$e806c6c1615a59ae)(), resolution_factor = 1) {
8438
8435
  let currently_live = false;
8439
8436
  const ro = new ResizeObserver((0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)((records)=>{
@@ -8495,9 +8492,9 @@ function $ff973b2032639b5f$export$a62825542f1bfcf5({ what_to_watch: what_to_watc
8495
8492
  2048,
8496
8493
  4096
8497
8494
  ] , sizes_communicator: sizes_communicator , resolution_factor: resolution_factor , market_: market_ , sizes_setter_: sizes_setter_ } = {}) {
8498
- /**
8499
- * We support what_to_watch being optional, meaning we will take the first image we get.
8500
- * For that we need to have created the image before being able to create the sizes setter.
8495
+ /**
8496
+ * We support what_to_watch being optional, meaning we will take the first image we get.
8497
+ * For that we need to have created the image before being able to create the sizes setter.
8501
8498
  */ const local_base_url = market_ ? $ff973b2032639b5f$export$3d13beba9b52c947 + "/" + market_ : $ff973b2032639b5f$export$3d13beba9b52c947;
8502
8499
  return (image_options)=>{
8503
8500
  const raw_src = image_options?.src || image_options?.["data-src"]; // get wanted src
@@ -8677,9 +8674,9 @@ const $a656daa2fa8c279a$var$TOUCHCANCEL = "touchcancel";
8677
8674
  const $a656daa2fa8c279a$var$MOUSEOVER = "mouseover";
8678
8675
  const $a656daa2fa8c279a$var$MOUSELEAVE = "mouseleave";
8679
8676
  const $a656daa2fa8c279a$var$HOVER_CLASS = "hovering";
8680
- /** This number represents how many elements are in front of div.images-container
8681
- * Here are the elements: img.depict-img-mod, div, img.depict-img-mod, div, div.second-image-container, div.main-image-container, div.images-container
8682
- * This number is not very dynamic but much more performant than iterating
8677
+ /** This number represents how many elements are in front of div.images-container
8678
+ * Here are the elements: img.depict-img-mod, div, img.depict-img-mod, div, div.second-image-container, div.main-image-container, div.images-container
8679
+ * This number is not very dynamic but much more performant than iterating
8683
8680
  */ const $a656daa2fa8c279a$var$HOVER_IMAGE_DEPTH = 7;
8684
8681
  const $a656daa2fa8c279a$var$MAX_COLLISION_DETECTION_RATE = 70; // ms
8685
8682
  const $a656daa2fa8c279a$var$touch_hover_elements = /*@__PURE__*/ new WeakMap();
@@ -8979,11 +8976,11 @@ function $12c29616944c2fb7$export$f2ca6fc699ca1fb4(props = {}) {
8979
8976
 
8980
8977
 
8981
8978
 
8982
- /**
8983
- * Shallowly converts all keys in an object from snake_case to camelCase.
8984
- * Does not support symbol keys.
8985
- *
8986
- * @param obj the object. It will be cloned and not modified in-place.
8979
+ /**
8980
+ * Shallowly converts all keys in an object from snake_case to camelCase.
8981
+ * Does not support symbol keys.
8982
+ *
8983
+ * @param obj the object. It will be cloned and not modified in-place.
8987
8984
  */ function $89758b55120b0cbd$export$9dc8f3a0aa3efc85(obj) {
8988
8985
  return Object.fromEntries(Object.entries(obj).map(([key, value])=>[
8989
8986
  key.split("_").map((part, index)=>index ? part[0].toUpperCase() + part.slice(1) : part).join(""),
@@ -8998,9 +8995,9 @@ function $89758b55120b0cbd$export$b481488de1caa85(obj) {
8998
8995
  }
8999
8996
 
9000
8997
 
9001
- /**
9002
- * Converts RGB to HSL
9003
- * Source of function: https://www.30secondsofcode.org/js/s/rgb-to-hsl
8998
+ /**
8999
+ * Converts RGB to HSL
9000
+ * Source of function: https://www.30secondsofcode.org/js/s/rgb-to-hsl
9004
9001
  */ function $d73746ee466f09ca$export$499ef00a6a3417f8(r, g, b) {
9005
9002
  r /= 255;
9006
9003
  g /= 255;