vviinn-widgets 2.222.0 → 2.223.0

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 (46) hide show
  1. package/dist/cjs/{index-RlbsyJJk.js → index-DZw3p4dq.js} +1 -1
  2. package/dist/cjs/{search.store-D4WiAMcl.js → search.store-Bh2_GSpU.js} +2 -1
  3. package/dist/cjs/vviinn-button_6.cjs.entry.js +1 -1
  4. package/dist/cjs/vviinn-camera_12.cjs.entry.js +152 -43
  5. package/dist/cjs/vviinn-carousel_10.cjs.entry.js +2 -53
  6. package/dist/cjs/vviinn-shop-the-look.cjs.entry.js +1 -1
  7. package/dist/cjs/vviinn-text-search.cjs.entry.js +1 -1
  8. package/dist/collection/components/vviinn-cropper/helpers/cropperOcrGate.js +36 -0
  9. package/dist/collection/components/vviinn-cropper/helpers/hasSelectedOcrFilter.js +4 -0
  10. package/dist/collection/components/vviinn-cropper/vviinn-cropper.js +108 -38
  11. package/dist/collection/components/vviinn-filters/vviinn-extended-filters.js +2 -2
  12. package/dist/collection/components/vviinn-results/vviinn-results.js +78 -3
  13. package/dist/esm/{index-CEzGPs5u.js → index-DQQYIioG.js} +1 -1
  14. package/dist/esm/{search.store-Cgs5icgA.js → search.store-lTerE9Yh.js} +2 -2
  15. package/dist/esm/vviinn-button_6.entry.js +1 -1
  16. package/dist/esm/vviinn-camera_12.entry.js +152 -43
  17. package/dist/esm/vviinn-carousel_10.entry.js +2 -53
  18. package/dist/esm/vviinn-shop-the-look.entry.js +1 -1
  19. package/dist/esm/vviinn-text-search.entry.js +1 -1
  20. package/dist/storybook/helpers/industryToken.js +6 -8
  21. package/dist/types/components/vviinn-cropper/helpers/cropperOcrGate.d.ts +19 -0
  22. package/dist/types/components/vviinn-cropper/helpers/hasSelectedOcrFilter.d.ts +2 -0
  23. package/dist/types/components/vviinn-cropper/vviinn-cropper.d.ts +14 -0
  24. package/dist/types/components/vviinn-filters/vviinn-extended-filters.d.ts +51 -0
  25. package/dist/types/components/vviinn-results/vviinn-results.d.ts +1 -1
  26. package/dist/vviinn-widgets/p-08d39cc9.entry.js +1 -0
  27. package/dist/vviinn-widgets/{p-df4365fb.entry.js → p-1e2f9b9f.entry.js} +1 -1
  28. package/dist/vviinn-widgets/{p-c1eac87b.entry.js → p-3daed25b.entry.js} +1 -1
  29. package/{www/build/p-Cxd6yzhY.js → dist/vviinn-widgets/p-CJAxBbhA.js} +1 -1
  30. package/dist/vviinn-widgets/{p-B246LK7U.js → p-DhCqK4d8.js} +1 -1
  31. package/dist/vviinn-widgets/{p-818a1e53.entry.js → p-eb579723.entry.js} +1 -1
  32. package/{www/build/p-df9a1d66.entry.js → dist/vviinn-widgets/p-f9f4e909.entry.js} +1 -1
  33. package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
  34. package/package.json +1 -1
  35. package/www/build/p-08d39cc9.entry.js +1 -0
  36. package/www/build/{p-df4365fb.entry.js → p-1e2f9b9f.entry.js} +1 -1
  37. package/www/build/{p-c1eac87b.entry.js → p-3daed25b.entry.js} +1 -1
  38. package/www/build/{p-e969c76d.js → p-4f556dc3.js} +1 -1
  39. package/{dist/vviinn-widgets/p-Cxd6yzhY.js → www/build/p-CJAxBbhA.js} +1 -1
  40. package/www/build/{p-B246LK7U.js → p-DhCqK4d8.js} +1 -1
  41. package/www/build/{p-818a1e53.entry.js → p-eb579723.entry.js} +1 -1
  42. package/{dist/vviinn-widgets/p-df9a1d66.entry.js → www/build/p-f9f4e909.entry.js} +1 -1
  43. package/www/build/vviinn-widgets.esm.js +1 -1
  44. package/www/index.html +1 -1
  45. package/dist/vviinn-widgets/p-0b7e8e2e.entry.js +0 -1
  46. package/www/build/p-0b7e8e2e.entry.js +0 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-BU8FMTXn.js');
4
- var search_store = require('./search.store-D4WiAMcl.js');
4
+ var search_store = require('./search.store-Bh2_GSpU.js');
5
5
  var store = require('./store-jPZ4ROqV.js');
6
6
 
7
7
  const PlusIcon = () => (index.h("svg", { width: "32", height: "32", viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", class: "plus-icon", "aria-hidden": "true" },
@@ -8598,7 +8598,7 @@ const encodeToBase64UTF8 = (str) => {
8598
8598
  return btoa(String.fromCharCode.apply(null, utf8Array));
8599
8599
  };
8600
8600
 
8601
- const version = "2.222.0";
8601
+ const version = "2.223.0";
8602
8602
 
8603
8603
  const appStateGlobalDefaults = {
8604
8604
  excluded: null,
@@ -8901,6 +8901,7 @@ exports.campaignTypeNames = campaignTypeNames;
8901
8901
  exports.checkDeviceType = checkDeviceType;
8902
8902
  exports.checkImageType = checkImageType;
8903
8903
  exports.extractFilterValue = extractFilterValue;
8904
+ exports.extractSelectedFilters = extractSelectedFilters;
8904
8905
  exports.fold = fold;
8905
8906
  exports.fromString = fromString;
8906
8907
  exports.getAcceptableFileFormats = getAcceptableFileFormats;
@@ -2,7 +2,7 @@
2
2
 
3
3
  var index = require('./index-BU8FMTXn.js');
4
4
  var store = require('./store-jPZ4ROqV.js');
5
- var search_store = require('./search.store-D4WiAMcl.js');
5
+ var search_store = require('./search.store-Bh2_GSpU.js');
6
6
  var index$1 = require('./index-CP1QUrJT.js');
7
7
  var SecondaryActionIcon = require('./SecondaryActionIcon-CuNEBTWD.js');
8
8
  var index$2 = require('./index-BF9aENF8.js');
@@ -2,9 +2,9 @@
2
2
 
3
3
  var index = require('./index-BU8FMTXn.js');
4
4
  var Rectangle = require('./Rectangle-7dF6_xf3.js');
5
- var search_store = require('./search.store-D4WiAMcl.js');
5
+ var search_store = require('./search.store-Bh2_GSpU.js');
6
6
  var index$2 = require('./index-CP1QUrJT.js');
7
- var index$1 = require('./index-RlbsyJJk.js');
7
+ var index$1 = require('./index-DZw3p4dq.js');
8
8
  var store = require('./store-jPZ4ROqV.js');
9
9
  var cropperUtils = require('./cropperUtils-DCDOLeBS.js');
10
10
  var cssUrlHelper = require('./cssUrlHelper-B5A2BBm7.js');
@@ -246,6 +246,46 @@ const ValidateCropBoxData = (cropBoxData) => {
246
246
  return result;
247
247
  };
248
248
 
249
+ const MODALITY_COLUMN = "modality";
250
+ const OCR_VALUE = "OCR";
251
+ const hasSelectedOcrFilter = (dynamicFilters) => search_store.extractSelectedFilters(dynamicFilters !== null && dynamicFilters !== void 0 ? dynamicFilters : []).some((filter) => filter.column === MODALITY_COLUMN && filter.values.includes(OCR_VALUE));
252
+
253
+ /**
254
+ * Decides whether the cropper must be hidden because an OCR filter is active.
255
+ * Once the user adjusts the crop box the cropper stays regardless of OCR.
256
+ * Engagement resets whenever a different image is loaded.
257
+ */
258
+ class CropperOcrGate {
259
+ constructor() {
260
+ this.engaged = false;
261
+ this.lastImage = null;
262
+ this.awaitingFilters = false;
263
+ }
264
+ /** Re-arm OCR gating for a freshly loaded image. */
265
+ onImage(image) {
266
+ if (image === this.lastImage)
267
+ return;
268
+ this.lastImage = image;
269
+ this.engaged = false;
270
+ this.awaitingFilters = true;
271
+ }
272
+ /** Fresh dynamicFilters for the current image have arrived. */
273
+ onFreshFilters() {
274
+ this.awaitingFilters = false;
275
+ }
276
+ /** Mark that the user started working with the cropper. */
277
+ onUserAdjust() {
278
+ this.engaged = true;
279
+ }
280
+ /** True when the cropper should be hidden. */
281
+ isGated(dynamicFilters, isSearchLoading = false) {
282
+ // Defer while the image's search is still resolving, to avoid a flash.
283
+ if (this.awaitingFilters && isSearchLoading)
284
+ return true;
285
+ return !this.engaged && hasSelectedOcrFilter(dynamicFilters);
286
+ }
287
+ }
288
+
249
289
  const VviinnCropper = class {
250
290
  constructor(hostRef) {
251
291
  index.registerInstance(this, hostRef);
@@ -268,6 +308,45 @@ const VviinnCropper = class {
268
308
  this.showInWidget = false;
269
309
  this.cropper = null;
270
310
  this.selectedDetectedObject = null;
311
+ this.imageElement = null;
312
+ this.gate = new CropperOcrGate();
313
+ this.destroyCropper = () => {
314
+ var _a;
315
+ (_a = this.cropper) === null || _a === void 0 ? void 0 : _a.destroy();
316
+ this.cropper = null;
317
+ };
318
+ this.clearCropSelection = () => {
319
+ this.state.searchArea = null;
320
+ this.state.croppedImageUrl = null;
321
+ this.selectedDetectedObject = null;
322
+ };
323
+ /** Tear down the cropper and drop any applied crop. */
324
+ this.discardCrop = () => {
325
+ this.destroyCropper();
326
+ this.clearCropSelection();
327
+ };
328
+ this.resetCropperState = () => {
329
+ this.discardCrop();
330
+ this.state.image = null;
331
+ };
332
+ /** Show or hide the cropper to match the current OCR gate decision. */
333
+ this.reconcileCropper = () => {
334
+ // Trust the fresh filters even before the image DOM is ready.
335
+ this.gate.onFreshFilters();
336
+ if (!this.state.image || !this.imageElement || !this.state.imageBounds)
337
+ return;
338
+ if (this.gate.isGated(this.state.dynamicFilters)) {
339
+ // Drop only the frame, keep the region/object so OCR searches within it.
340
+ this.destroyCropper();
341
+ return;
342
+ }
343
+ // Guard geometry here so initCropper doesn't re-emit the aspect-ratio error on every filter change.
344
+ if (!this.cropper &&
345
+ this.hasSupportedAspectRatio() &&
346
+ this.hasSupportedSize()) {
347
+ this.initCropper(this.imageElement);
348
+ }
349
+ };
271
350
  this.initPreloadedImage = () => {
272
351
  var _a;
273
352
  if (this.showInWidget && this.state.image) {
@@ -291,14 +370,12 @@ const VviinnCropper = class {
291
370
  cleanLocalStorage();
292
371
  };
293
372
  this.resetStateHandler = ({ detail, }) => {
294
- var _a, _b;
373
+ var _a;
295
374
  if (this.skipStateChanges(detail.isTriggeredByVpsWidget))
296
375
  return;
297
- this.selectedDetectedObject = null;
298
376
  (_a = this.state.image) === null || _a === void 0 ? void 0 : _a.setAttribute("src", "");
299
377
  this.state.detectedObjects = [];
300
- this.state.image = null;
301
- (_b = this.cropper) === null || _b === void 0 ? void 0 : _b.destroy();
378
+ this.resetCropperState();
302
379
  cleanLocalStorage();
303
380
  };
304
381
  this.resetCropAreaHandler = ({ detail, }) => {
@@ -306,9 +383,7 @@ const VviinnCropper = class {
306
383
  if (this.skipStateChanges(detail.isTriggeredByVpsWidget))
307
384
  return;
308
385
  (_a = this.cropper) === null || _a === void 0 ? void 0 : _a.reset();
309
- this.state.searchArea = null;
310
- this.state.croppedImageUrl = null;
311
- this.selectedDetectedObject = null;
386
+ this.clearCropSelection();
312
387
  this.vviinnImageCrop.emit({
313
388
  isTriggeredByVpsWidget: this.showInWidget,
314
389
  });
@@ -336,32 +411,62 @@ const VviinnCropper = class {
336
411
  this.cropper.replace(this.state.image.src);
337
412
  };
338
413
  this.loadImage = () => {
339
- const renderedImageElement = this.el.shadowRoot.querySelector("img");
340
- if (this.state.image) {
341
- let data = {};
342
- if (this.cropper) {
343
- data = this.cropper.getData(true);
344
- this.cropper.destroy();
345
- }
346
- const imageBounds = Rectangle.fromImage(renderedImageElement);
347
- const { width, height } = imageBounds;
348
- this.vviinnCropperLoadImage.emit({
349
- imageBounds,
350
- });
351
- this.state.imageBounds = imageBounds;
352
- if (width / height < cropperUtils.SUPPORTED_ASPECT_RATIO ||
353
- height / width < cropperUtils.SUPPORTED_ASPECT_RATIO) {
354
- this.vviinnCropperAspectRatioError.emit(true);
355
- return;
356
- }
357
- if (width < cropperUtils.MIN_IMAGE_SIDE_FOR_CROPPER ||
358
- height < cropperUtils.MIN_IMAGE_SIDE_FOR_CROPPER) {
359
- return;
360
- }
361
- this.cropper = new cropperUtils.Cropper(renderedImageElement, Object.assign(Object.assign({}, cropperUtils.cropperOptions), { cropstart: this.cropStart, cropend: this.cropEnd, ready: () => this.cropper.reset(), data }));
414
+ var _a;
415
+ if (!this.state.image)
416
+ return;
417
+ const renderedImageElement = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("img");
418
+ if (!renderedImageElement)
419
+ return;
420
+ this.imageElement = renderedImageElement;
421
+ this.gate.onImage(this.state.image);
422
+ let data = {};
423
+ if (this.cropper) {
424
+ data = this.cropper.getData(true);
425
+ this.destroyCropper();
426
+ }
427
+ const imageBounds = Rectangle.fromImage(renderedImageElement);
428
+ this.vviinnCropperLoadImage.emit({
429
+ imageBounds,
430
+ });
431
+ this.state.imageBounds = imageBounds;
432
+ const isSearchLoading = this.state.searchStatus === "loading";
433
+ if (this.gate.isGated(this.state.dynamicFilters, isSearchLoading)) {
434
+ this.discardCrop();
435
+ // Still surface aspect-ratio errors while hidden — geometry matters regardless.
436
+ this.checkAspectRatio();
437
+ return;
362
438
  }
439
+ this.initCropper(renderedImageElement, data);
440
+ };
441
+ this.hasSupportedAspectRatio = () => {
442
+ if (!this.state.imageBounds)
443
+ return false;
444
+ const { width, height } = this.state.imageBounds;
445
+ return (width / height >= cropperUtils.SUPPORTED_ASPECT_RATIO &&
446
+ height / width >= cropperUtils.SUPPORTED_ASPECT_RATIO);
447
+ };
448
+ this.hasSupportedSize = () => {
449
+ if (!this.state.imageBounds)
450
+ return false;
451
+ const { width, height } = this.state.imageBounds;
452
+ return (width >= cropperUtils.MIN_IMAGE_SIDE_FOR_CROPPER &&
453
+ height >= cropperUtils.MIN_IMAGE_SIDE_FOR_CROPPER);
454
+ };
455
+ this.checkAspectRatio = () => {
456
+ if (this.hasSupportedAspectRatio())
457
+ return true;
458
+ this.vviinnCropperAspectRatioError.emit(true);
459
+ return false;
460
+ };
461
+ this.initCropper = (imageElement, data = {}) => {
462
+ if (!imageElement)
463
+ return;
464
+ if (!this.checkAspectRatio() || !this.hasSupportedSize())
465
+ return;
466
+ this.cropper = new cropperUtils.Cropper(imageElement, Object.assign(Object.assign({}, cropperUtils.cropperOptions), { cropstart: this.cropStart, cropend: this.cropEnd, ready: () => { var _a; return (_a = this.cropper) === null || _a === void 0 ? void 0 : _a.reset(); }, data }));
363
467
  };
364
468
  this.cropStart = () => {
469
+ this.gate.onUserAdjust();
365
470
  this.startEndCropBoxData = cropperUtils.getCropBoxData(this.cropper);
366
471
  };
367
472
  this.cropEnd = () => {
@@ -387,9 +492,10 @@ const VviinnCropper = class {
387
492
  !this.showAspectRatioError;
388
493
  }
389
494
  connectedCallback() {
390
- const { state, storeName } = search_store.useSearchStore(this.showInWidget);
495
+ const { state, storeName, onChange } = search_store.useSearchStore(this.showInWidget);
391
496
  this.state = state;
392
497
  this.storeName = storeName;
498
+ this.disposeStoreListener = onChange("dynamicFilters", this.reconcileCropper);
393
499
  this.initPreloadedImage();
394
500
  this.eventAbortController = new AbortController();
395
501
  const { signal } = this.eventAbortController;
@@ -400,10 +506,13 @@ const VviinnCropper = class {
400
506
  ], signal);
401
507
  }
402
508
  disconnectedCallback() {
403
- var _a, _b, _c;
509
+ var _a, _b;
404
510
  (_a = this.eventAbortController) === null || _a === void 0 ? void 0 : _a.abort();
405
- (_c = (_b = this.cropper) === null || _b === void 0 ? void 0 : _b.destroy) === null || _c === void 0 ? void 0 : _c.call(_b);
406
- this.state.image = null;
511
+ (_b = this.disposeStoreListener) === null || _b === void 0 ? void 0 : _b.call(this);
512
+ this.destroyCropper();
513
+ // "never" keeps no image across mounts, so clear it from the shared store.
514
+ if (this.saveImageMode === "never")
515
+ this.state.image = null;
407
516
  }
408
517
  selectDetectedObject({ detail }) {
409
518
  this.selectedDetectedObject = detail.detectedObject;
@@ -436,14 +545,14 @@ const VviinnCropper = class {
436
545
  }
437
546
  render() {
438
547
  var _a;
439
- return (index.h(index.Host, { key: 'ae2656d0782e723ffe5c8ba9ad6074db55e219c0', class: {
548
+ return (index.h(index.Host, { key: 'b50ccb5595b27ef6673ff9d9350fc30359a6f7ce', class: {
440
549
  "show-in-widget": this.showInWidget,
441
550
  active: !!this.state.image,
442
- } }, cssUrlHelper.renderExternalCSS(this.cssUrl), index.h("div", { key: '0c547762649ddc68aa2755681c6637ec1556b315', class: "container" }, this.state.image && (index.h("div", { key: '811e79aaf4ee1144c8c6ce0017300ba9aeda8803', class: "image-container", style: {
551
+ } }, cssUrlHelper.renderExternalCSS(this.cssUrl), index.h("div", { key: 'efd816ed4e19082091567714fee4ef40efe9a6c4', class: "container" }, this.state.image && (index.h("div", { key: '13f35758ba243eb73513e17375daca8431538383', class: "image-container", style: {
443
552
  width: `${this.width.toString()}px`,
444
553
  overflow: "hidden",
445
- } }, index.h("img", { key: '458474fa006a1397daa335fb9ee50477ab0e62ce', decoding: "async", width: this.width, height: this.height, src: this.state.image.src, draggable: false, onLoad: this.loadImage, alt: store.instance.t("a11y.cropperImage") }), (_a = this.state.detectedObjects) === null || _a === void 0 ? void 0 :
446
- _a.map((object) => (index.h("vviinn-detected-object", { detectedObject: object, selectedDetectedObject: this.selectedDetectedObject, basicEventData: this.basicEventData, imageBounds: this.state.imageBounds, showInWidget: this.showInWidget }))))), this.showPreloader() && (index.h("div", { key: 'd002cf170858ae7e5a46ca0f36bc64a425990119', class: "image-preloader" }, index.h("vviinn-preloader", { key: '2867876e7f492364528636d4b77dc4c7f80bee71' }))))));
554
+ } }, index.h("img", { key: '7525aae0654325fb25c88106a9ee1fface11a62e', decoding: "async", width: this.width, height: this.height, src: this.state.image.src, draggable: false, onLoad: this.loadImage, alt: store.instance.t("a11y.cropperImage") }), (_a = this.state.detectedObjects) === null || _a === void 0 ? void 0 :
555
+ _a.map((object) => (index.h("vviinn-detected-object", { detectedObject: object, selectedDetectedObject: this.selectedDetectedObject, basicEventData: this.basicEventData, imageBounds: this.state.imageBounds, showInWidget: this.showInWidget }))))), this.showPreloader() && (index.h("div", { key: 'b89ad46bda5279b77f4fe258f7a6d4af08f81c29', class: "image-preloader" }, index.h("vviinn-preloader", { key: '34f55578c05321480d7e3d8141a4638df8aad08b' }))))));
447
556
  }
448
557
  get el() { return index.getElement(this); }
449
558
  };
@@ -1040,13 +1149,13 @@ const VviinnResults = class {
1040
1149
  render() {
1041
1150
  var _a;
1042
1151
  const resultsLength = this.getResults().length;
1043
- return (index.h(index.Host, { key: '0767d0c21dee72b9a0f09a80dfe2ca7c375e4d50', id: "results-block", class: {
1152
+ return (index.h(index.Host, { key: 'd62957bb1294f3a62e14fa9a3eb97c7ef6007eae', id: "results-block", class: {
1044
1153
  "show-in-widget": this.showInWidget,
1045
1154
  "matching-discovery": this.oneClickDiscoveryMode === "append-slider",
1046
- }, exportparts: `${index$3.productCardParts}, ${index$3.listCardParts}, ${index$3.contentCardParts}, ${index$3.productCardsGridPart}` }, cssUrlHelper.renderExternalCSS(this.cssUrl), index.h("div", { key: 'bfd01f2bf39be84501ce0cf42f5672acda3e500b', class: "nothing-found" }, this.getCurrentErrorType() && (index.h("vviinn-error", { key: 'ce077ad92253c7727a509567571d821ebda6dbd4', errorType: this.getCurrentErrorType(), handler: this.resetWidgetState, hasBackground: this.showInWidget, searchType: this.state.searchType }))), index.h("div", { key: 'dc63984664328f04abe6011aa0db856cb862f37c', class: {
1155
+ }, exportparts: `${index$3.productCardParts}, ${index$3.listCardParts}, ${index$3.contentCardParts}, ${index$3.productCardsGridPart}` }, cssUrlHelper.renderExternalCSS(this.cssUrl), index.h("div", { key: '69f7a38dc02f42c357dbae8cf154ecb78380f270', class: "nothing-found" }, this.getCurrentErrorType() && (index.h("vviinn-error", { key: 'd78ed9f6d777d7ec1686b10b709deee018c4391e', errorType: this.getCurrentErrorType(), handler: this.resetWidgetState, hasBackground: this.showInWidget, searchType: this.state.searchType }))), index.h("div", { key: 'be3db62dcfd508b6f60036454d3c825d6c27f5ae', class: {
1047
1156
  hidden: this.showAspectRatioError || resultsLength === 0,
1048
1157
  products: true,
1049
- }, part: index$3.productCardsGridPart, id: "vviinn-results-products" }, resultsLength > 0 && this.renderResults(), index.h("div", { key: '2e39c5d65c5c7981c0b9a93dfe97ad62165a25b4', id: "one-click-discovery-append", style: {
1158
+ }, part: index$3.productCardsGridPart, id: "vviinn-results-products" }, resultsLength > 0 && this.renderResults(), index.h("div", { key: '88d3d2d5880806b9e24799694cc540de676d17f8', id: "one-click-discovery-append", style: {
1050
1159
  order: ((_a = this.oneClickDiscoveryAppendIndex) !== null && _a !== void 0 ? _a : resultsLength).toString(),
1051
1160
  } }))));
1052
1161
  }
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-BU8FMTXn.js');
4
- var search_store = require('./search.store-D4WiAMcl.js');
4
+ var search_store = require('./search.store-Bh2_GSpU.js');
5
5
  var Rectangle = require('./Rectangle-7dF6_xf3.js');
6
6
  var store = require('./store-jPZ4ROqV.js');
7
- var index$1 = require('./index-RlbsyJJk.js');
7
+ var index$1 = require('./index-DZw3p4dq.js');
8
8
  var constants = require('./constants-BlwqMvns.js');
9
9
  var index$2 = require('./index-CP1QUrJT.js');
10
10
  var index$3 = require('./index-BF9aENF8.js');
@@ -656,57 +656,6 @@ const filterOptionsBySearch = (filterOptions, searchTerm) => {
656
656
 
657
657
  const vviinnFiltersCss$2 = ":host{--font-family-base:Inter, system-ui, sans-serif;--font-family-mono:monospace;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;--font-size-display:32px;--font-size-title:24px;--font-size-headline:18px;--font-size-label-large:16px;--font-size-label:14px;--font-size-body-large:16px;--font-size-body:14px;--font-size-caption:12px;--line-height-display:40px;--line-height-title:32px;--line-height-headline:24px;--line-height-label-large:24px;--line-height-label:20px;--line-height-body-large:24px;--line-height-body:20px;--line-height-caption:16px;--letter-spacing-title:0px;--letter-spacing-headline:0px;--letter-spacing-label-large:0px;--letter-spacing-label:0px;--letter-spacing-body-large:0px;--letter-spacing-body:0px;--letter-spacing-caption:0px;--font-weight-400:400;--font-weight-500:500;--font-weight-600:600;--font-weight-700:700;--spacing-none:0px;--spacing-25:2px;--spacing-50:4px;--spacing-75:6px;--spacing-100:8px;--spacing-125:10px;--spacing-150:12px;--spacing-200:16px;--spacing-250:20px;--spacing-300:24px;--spacing-400:32px;--spacing-500:40px;--spacing-600:48px;--border-radius-none:0px;--border-radius-25:2px;--border-radius-50:4px;--border-radius-100:8px;--border-radius-150:12px;--border-radius-200:16px;--border-radius-300:24px;--border-radius-400:32px;--border-radius-full:9999px;--stroke-width-none:0px;--stroke-width-25:1px;--stroke-width-50:2px;--stroke-width-75:3px;--stroke-width-100:4px;--stroke-width-150:6px;--stroke-width-200:8px;--stroke-width-300:12px;--product-card-widget-min-width:135px;--product-card-results-min-width:250px;--image-set-mode-min-width:155px;--source-card-set-mode-max-width:500px;--filter-blur-none:0px;--filter-blur-100:8px;--filter-blur-150:12px;--filter-blur-200:16px;--color-bg-base:#ffffff;--color-bg-inverse:#161616;--color-border-00:#ffffff;--color-border-01:#f4f4f4;--color-border-02:#e0e0e0;--color-border-03:#c6c6c6;--color-border-inverse-00:#161616;--color-border-inverse-01:#393939;--color-field-01:#ffffff;--color-field-02:#f4f4f4;--color-icon-primary:#161616;--color-icon-secondary:#525252;--color-icon-helper:#8d8d8d;--color-icon-on-color:#ffffff;--color-icon-inverse:#ffffff;--color-icon-disabled:#16161640;--color-text-primary:#161616;--color-text-secondary:#707070;--color-text-helper:#8d8d8d;--color-text-placeholder:#a8a8a8;--color-text-on-color:#ffffff;--color-text-inverse:#ffffff;--color-text-disabled:#16161640;--button-bg-color-primary:#000000;--button-bg-color-primary-hover:#161616;--button-bg-color-primary-active:#1e1e1e;--button-bg-color-secondary:#f4f4f4;--button-bg-color-secondary-hover:#e0e0e0;--button-bg-color-secondary-active:#c6c6c6;--button-bg-color-ghost-hover:#f4f4f4;--button-bg-color-ghost-active:#eaeaea;--button-bg-color-frosted:#6f6f6f66;--button-bg-color-frosted-hover:#6f6f6f80;--button-bg-color-frosted-active:#6f6f6f99;--button-bg-color-disabled:#e0e0e0;--button-bg-color-positive:#dcfce7;--surface-bg-color-01:#f4f4f4;--surface-bg-color-01-hover:#eaeaea;--surface-bg-color-01-active:#e0e0e0;--surface-bg-color-02:#ffffff;--surface-bg-color-inverse:#262626;--surface-bg-color-inverse-hover:#303030;--surface-bg-color-inverse-active:#393939;--surface-bg-color-disabled:#e0e0e0;--surface-bg-color-shadow-01:#dddddd;--surface-bg-color-shadow-02:#c6c6c6;--chip-bg-color-primary:#161616;--chip-bg-color-primary-hover:#1e1e1e;--chip-bg-color-primary-active:#262626;--chip-bg-color-subtle:#f4f4f4;--chip-bg-color-subtle-hover:#eaeaea;--chip-bg-color-subtle-active:#e0e0e0;--chip-bg-color-outline-hover:#f4f4f4;--chip-bg-color-outline-active:#eaeaea;--label-bg-color-accent:#ff3944;--sidebar-animation-duration-default:0.5s;--search-modal-animation-duration-default:0.25s;--search-modal-animation-duration-mobile-default:0.35s;}:host{display:block;font-family:var(--font-family, var(--font-family-base));font-style:normal;display:contents;}.filters-modal-list,.sub-filters-wrapper,.main-filters-list,.filters-modal-sub-list,.selected-filters-wrapper{list-style:none;margin:0;padding:0}.main-filters-list{padding:var(--spacing-25);gap:var(--spacing-25);border-radius:8px;background:var(--surface-bg-color-01);display:inline-flex}vviinn-range-filter{width:100%;max-width:500px;padding-bottom:var(--spacing-150)}.filters-search-input-container{position:relative;box-sizing:border-box;width:100%;display:flex;align-items:center}.filters-search-icon{position:absolute;left:var(--spacing-100);color:var(--color-icon-helper);z-index:1;pointer-events:none;display:flex;align-items:center;justify-content:center}.filters-search-input{width:100%;padding:var(--spacing-100) var(--spacing-100) var(--spacing-100)\n var(--spacing-500);border:none;background:var(--color-bg-base);font-family:var(--font-family, var(--font-family-base));font-size:var(--font-size-body);font-weight:var(--font-weight-400);line-height:var(--line-height-body);color:var(--color-text-primary);box-sizing:border-box;outline:none}.filters-search-input::-moz-placeholder{color:var(--color-text-placeholder)}.filters-search-input::placeholder{color:var(--color-text-placeholder)}.filters-modal-main-button,.filters-sub-button,.filters-main-button,.filters-modal-close,.filters-sub-button-selected{font-family:var(--font-family, var(--font-family-base));cursor:pointer;border:none}.filters-sub-button,.filters-main-button{font-size:var(--font-size-body);font-weight:var(--font-weight-400);line-height:var(--line-height-body);letter-spacing:var(--letter-spacing-body);display:flex;justify-content:center;align-items:center;border-radius:6px}.filters-main-button{padding:var(--spacing-100);color:var(--color-text-secondary);background:none;transition:background 0.15s,\n color 0.15s}.filters-main-button.active,.filters-main-button:hover{background:var(--surface-bg-color-02);color:var(--color-text-primary)}.sub-filters-wrapper,.selected-filters-wrapper{gap:var(--spacing-100);display:flex;flex-direction:row;overflow-x:auto;scrollbar-width:thin}.sub-filters-wrapper{align-items:center;gap:var(--spacing-100);margin:16px -2px 0}.sub-filters-wrapper>li{padding:2px}.selected-filters-wrapper{align-items:center;gap:var(--spacing-100);flex-wrap:wrap}.filters-sub-button{color:var(--color-text-primary);background:var(--surface-bg-color-01);padding:var(--spacing-100);gap:var(--spacing-25);height:100%}.filters-sub-button>span,.filters-sub-button-selected>span{display:inline-flex;justify-content:center;align-items:center;gap:var(--spacing-25);white-space:nowrap}.filters-sub-button>span>span,.filters-sub-button-selected>span>span{padding:var(--spacing-25)}.filters-sub-button:hover{background:var(--surface-bg-color-01-hover)}.filters-sub-button:disabled{cursor:not-allowed;background:var(--surface-bg-color-disabled);color:var(--color-text-disabled)}.filters-more-button{display:flex;padding:var(--spacing-100);gap:var(--spacing-50);border-radius:var(--border-radius-100);align-items:flex-start;background-color:var(--button-bg-color-secondary);transition:background-color 0.1s;border:none;cursor:pointer}.filters-more-button:hover{background-color:var(--button-bg-color-secondary-hover)}.filters-modal-wrapper{display:flex;flex-direction:column;background:#ffffff}.filters-modal.button,.filters-modal.modal{display:none;position:fixed;top:0;bottom:0;right:0;left:0;z-index:99999;background-color:rgba(0, 0, 0, 0.5)}.filters-modal.button .filters-modal-wrapper{position:fixed;top:0;bottom:0;right:0;width:420px;z-index:99999;border-radius:var(--border-radius-400) var(--border-radius-none)\n var(--border-radius-none) var(--border-radius-400)}.filters-modal.preview{display:block}.filters-modal.open{display:block}.filters-modal-header{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;color:var(--color-text-primary);text-align:center;border-bottom:1px solid var(--color-border-01)}.filters-modal-header.show-header-content{min-height:64px}.filters-modal-title{margin:0;padding:0;font-size:var(--font-size-headline);font-weight:var(--font-weight-500);line-height:var(--line-height-headline);letter-spacing:var(--letter-spacing-headline)}.filters-modal-no-filters-message{font-size:var(--font-size-caption);color:var(--color-text-secondary);font-weight:var(--font-weight-500);line-height:var(--line-height-caption);letter-spacing:var(--letter-spacing-caption);text-align:center;padding:var(--spacing-300) var(--spacing-200);display:flex;align-items:center;justify-content:center}.filters-modal-main{overflow-y:auto;scrolbar-width:thin}.filters-modal-list{margin:var(--spacing-50) 0 0 var(--spacing-300)}.filters-modal-list>li{padding-right:var(--spacing-300)}.filters-modal:not(.preview-inline) .filters-modal-list>li:not(:last-child) .filters-modal-main-button-wrapper{border-bottom:1px solid var(--color-border-01)}.filters-modal-main-button{position:relative;width:100%;background:none;text-align:left;padding:var(--spacing-200) 0;color:var(--color-text-primary);font-size:var(--font-size-label-large);font-weight:var(--font-weight-500);line-height:var(--line-height-label-large);letter-spacing:var(--letter-spacing-label-large)}.filters-modal-main-button>svg{position:absolute;right:0;top:var(--spacing-200);color:var(--color-icon-helper);transform:rotate(90deg)}.filters-modal-main-button:hover>svg{color:var(--color-icon-primary);transition:color 0.2s}.filters-modal-main-button-wrapper.open .filters-modal-main-button>svg{transform:rotate(-90deg);color:var(--color-icon-primary)}.filters-modal-sub-list{display:none}.filters-modal-main-button-wrapper.open .filters-modal-sub-list{display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding-bottom:var(--spacing-150)}.filters-modal-sub-list>li{display:contents}.filters-modal-close{position:absolute;color:#6f6f6f;right:var(--spacing-100);top:var(--spacing-200);cursor:pointer;background:none}.filters-modal-close:hover{color:#000}.filters-modal.preview .filters-modal-close{display:none}.filters-more-modal-button{background:none;border:none;cursor:pointer;display:flex;align-items:center;height:36px;padding:var(--spacing-75);gap:var(--spacing-50);border-radius:var(--border-radius-100);background-color:var(--surface-bg-color-01);transition:background-color 0.1s;font-family:var(--font-family, var(--font-family-base));font-size:var(--font-size-label);color:var(--color-text-primary)}.filters-more-modal-button.custom:not(.clickable){cursor:default}.filters-more-modal-button:hover{background-color:var(--surface-bg-color-01-hover)}.filters-more-modal-button.active{background:var(--surface-bg-color-inverse);color:var(--color-text-inverse)}.filters-more-modal-button.active .filters-option-icon-wrapper{border-color:var(--color-bg-base);background-color:var(--color-bg-base);color:var(--color-icon-primary)}.filters-more-modal-button>span{white-space:nowrap;padding:var(--spacing-25)}.filters-more-modal-button:disabled{cursor:not-allowed;opacity:0.5}.filters-more-modal-button img{box-sizing:border-box;-o-object-fit:cover;object-fit:cover;-o-object-position:center;object-position:center;border-radius:var(--border-radius-full);border:1px solid var(--color-border-01)}.filters-modal-actions{border-top:1px solid var(--color-border-01);padding:var(--spacing-125);z-index:10;border-radius:0px 0px 0px 32px}.filters-modal-apply,.filters-modal-reset{font-family:var(--font-family, var(--font-family-base))}.filters-modal-apply{cursor:pointer;width:100%;border:none;margin-bottom:20px;display:flex;padding:var(--spacing-150);justify-content:center;align-items:center;gap:var(--spacing-50);align-self:stretch;color:var(--color-text-inverse);text-align:center;border-radius:var(--border-radius-150);background:var(--button-bg-color-primary);font-size:var(--font-size-label-large);font-weight:var(--font-weight-500);line-height:var(--line-height-label-large);letter-spacing:var(--letter-spacing-label-large)}.filters-modal-apply:disabled{background:var(--button-bg-color-disabled);color:var(--color-text-disabled)}.filters-modal-reset{background:none;border:none;cursor:pointer;display:block;text-align:center;width:100%;padding:var(--spacing-125) 0;color:var(--color-text-secondary);text-align:center;font-size:var(--font-size-label);font-weight:var(--font-weight-500);line-height:var(--line-height-label);letter-spacing:var(--letter-spacing-label)}.filters-modal-reset:hover{color:var(--color-text-primary)}.selected-filters-wrapper>li .filters-sub-button-selected{border-radius:var(--border-radius-100);background:var(--surface-bg-color-inverse);display:flex;align-items:center;justify-content:center;cursor:pointer;padding:var(--spacing-100)}.selected-filters-wrapper>li.hidden{display:none}.filters-sub-button-selected{display:flex;align-items:center;gap:var(--spacing-25);background:var(--surface-bg-color-inverse);border-radius:var(--border-radius-100);color:var(--color-text-inverse);text-overflow:ellipsis;font-size:var(--font-size-body);font-weight:var(--font-weight-400);line-height:var(--line-height-body);letter-spacing:var(--letter-spacing-body);padding:var(--spacing-100)}.filters-sub-button-color-dot{box-sizing:border-box;width:24px;height:24px;border-radius:var(--border-radius-full);border:var(--stroke-width-50) solid var(--color-border-01)}.selected-filters-wrapper .filters-sub-button-selected{width:24px;height:24px;border:none}.filters-option-icon-wrapper{display:flex;box-sizing:border-box;align-items:center;justify-content:center;border-radius:4px;border:2px solid #e0e0e0;background:#fff;width:20px;height:20px}.filters-modal-main-button-added-options{color:var(--color-text-secondary);text-overflow:ellipsis;padding-right:var(--spacing-100);font-size:var(--font-size-body);font-weight:var(--font-weight-400);line-height:var(--line-height-body);letter-spacing:var(--letter-spacing-body)}.filters-modal-main-button-added-options>span::after{content:\", \"}.filters-modal-main-button-added-options>span:last-child::after{content:\"\"}.filters-modal.preview-inline,.filters-modal.preview-inline .filters-modal-wrapper,.filters-modal.preview-inline .filters-modal-main{overflow:visible}.filters-modal.preview-inline .filters-modal-header,.filters-modal.preview-inline .filters-modal-actions{display:none}.filters-modal.preview-inline .filters-modal-list{margin:0;flex-direction:row;gap:var(--spacing-100);display:flex;flex-wrap:wrap}.filters-modal.preview-inline .extended-filters-row{box-sizing:border-box;padding-right:0;border-radius:var(--border-radius-100);background:var(--surface-bg-color-01)}.filters-modal.preview-inline .filters-modal-main-button{width:100%;display:flex;align-items:center;padding:var(--spacing-75);gap:var(--spacing-25);justify-content:space-between;font-size:var(--font-size-body);font-weight:var(--font-weight-400)}.filters-modal.preview-inline .filters-modal-main-button>svg{position:static}.filters-modal.preview-inline .extended-filters-row{position:relative}.filters-modal.preview-inline .filters-search-container{max-height:225px;width:-moz-max-content;width:max-content;min-width:140px;height:-moz-fit-content;height:fit-content;overflow:hidden;position:absolute;display:flex;flex-direction:column;flex-wrap:nowrap;align-items:stretch;padding:0;top:calc(100% + var(--spacing-75));left:0;right:0;z-index:1000;border-radius:var(--border-radius-150);border:1px solid var(--color-border-01);background-color:var(--color-bg-base);box-shadow:0 4px 8px 0 rgba(0, 0, 0, 0.1);box-sizing:border-box}.filters-modal.preview-inline .filters-search-input-container{position:sticky;top:0;background-color:var(--color-bg-base);padding:var(--spacing-50);border-bottom:1px solid var(--color-border-01);z-index:1}.filters-modal.preview-inline .filters-modal-sub-list{position:static;border:none;background:none;box-shadow:none;padding:var(--spacing-50);margin:0;max-height:165px;width:100%;box-sizing:border-box;display:flex;flex-direction:column;flex-wrap:nowrap;align-items:flex-start;gap:8px;overflow-y:auto;scrollbar-width:thin}.filters-modal.preview-inline .align-right .filters-search-container{left:auto;right:0}.filters-modal.preview-inline .filters-more-modal-button{width:100%;gap:var(--spacing-150);background-color:var(--color-bg-base)}.filters-modal.preview-inline .filters-option-icon-wrapper{margin-left:auto}.filters-modal.preview-inline .filters-more-modal-button:hover{background-color:var(--surface-bg-color-01-hover)}.filters-modal.preview-inline .filters-more-modal-button.active{color:var(--color-text-primary)}.filters-modal.preview-inline .filters-more-modal-button.active .filters-option-icon-wrapper{border-color:var(--color-bg-inverse);background-color:var(--color-bg-inverse);color:var(--color-icon-inverse)}.filters-modal.preview-inline .filters-modal-sub-list:has(vviinn-range-filter){padding:0 var(--spacing-75);width:220px;max-height:unset}.filters-modal.preview-inline vviinn-range-filter{width:100%}@media (max-width: 768px){.sub-filters-wrapper,.selected-filters-wrapper{flex-wrap:unset;overflow-x:auto;scrollbar-width:none;padding-bottom:0}.sub-filters-wrapper,.selected-filters-wrapper{-webkit-overflow-scrolling:touch;scrollbar-width:none;-ms-overflow-style:none}.sub-filters-wrapper::-webkit-scrollbar,.selected-filters-wrapper::-webkit-scrollbar{display:none}:host(.show-in-widget) .selected-filters-container{overflow-x:auto;width:100%}:host(.show-in-widget) .selected-filters-wrapper{padding:0 var(--spacing-300)}.filters-modal.button .filters-modal-wrapper,.filters-modal.modal .filters-modal-wrapper{width:100%;border-radius:24px 24px 0px 0px}.filters-modal.button .filters-modal-wrapper{top:10%}.filters-modal.modal .filters-modal-wrapper{position:fixed;width:100%;height:calc(100% - 64px);bottom:0;transform:translateY(-64px)}.filters-modal.modal .filters-modal-header{font-size:var(--font-size-body-large)}.filters-modal.modal .filters-modal-main{padding-bottom:120px}vviinn-range-filter{max-width:unset}:host(.show-in-widget.primary-filters) vviinn-range-filter{max-width:calc(100% - 48px);transform:translateX(24px)}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0}";
658
658
 
659
- /**
660
- * @slot vviinn-extended-filters-title - Text on widget's header.
661
- * @slot vviinn-extended-filters-apply - Title of Apply Button.
662
- * @slot vviinn-extended-filters-reset - Title of Reset Button.
663
- * @slot vviinn-extended-filters-no-filters - Message shown when no filters are available.
664
- * @slot vviinn-filters-search-icon - Custom icon for the search input.
665
- * @slot vviinn-range-filter-from-label - Label text for the "From" input field in range filters.
666
- * @slot vviinn-range-filter-to-label - Label text for the "To" input field in range filters.
667
- *
668
- * @part extended-filters-modal - Modal itself.
669
- * @part extended-filters-modal-wrapper - Wrapper for the modal.
670
- * @part extended-filters-header - Header of the modal.
671
- * @part extended-filters-title - Title heading (h2) of the modal.
672
- * @part extended-filters-modal-close - Close button of the modal.
673
- * @part extended-filters-no-filters - No filters message container.
674
- * @part extended-filters-main - Wrapper for the main modal content.
675
- * @part extended-filters-list - List of filters.
676
- * @part extended-filters-row - Row of the filters.
677
- * @part extended-filters-row-wrapper - Wrapper for the row.
678
- * @part extended-filters-main-button - Main button of the row.
679
- * @part extended-filters-selected-wrapper - Wrapper for the selected options.
680
- * @part extended-filters-sub-list - List of sub filters.
681
- * @part extended-filters-actions - Wrapper for the actions.
682
- * @part extended-filters-apply - Apply button.
683
- * @part extended-filters-reset - Reset button.
684
- *
685
- * @part filters-search-container - Container wrapping search input and filter list.
686
- * @part filters-search-input-container - Container for the search input with icon.
687
- * @part filters-search-icon - Icon wrapper for the search input.
688
- * @part filters-search-input - Search input field.
689
- *
690
- * @part filters-sub-row - Row of the sub filters.
691
- * @part filters-option-button - Button of the sub filter.
692
- * @part filters-option-image - Image of the sub filter.
693
- * @part filters-option-color-dot - Color Dot of the sub filter.
694
- * @part filters-option-text - Text of the sub filter.
695
- * @part filters-option-icon-wrapper - Icon Wrapper of the sub filter.
696
- *
697
- * @part histogram - Wrapper itself.
698
- * @part histogram-bar - Bar of the histogram.
699
- * @part histogram-range-container - Container for the range sliders.
700
- * @part histogram-sliders-control - Container for the range sliders control.
701
- * @part histogram-from-slider - Slider for the minimum value.
702
- * @part histogram-to-slider - Slider for the maximum value.
703
- * @part histogram-label-wrapper - Wrapper for the labels/inputs.
704
- * @part histogram-label - Label for the histogram (when showIntervalInputs is false).
705
- * @part histogram-input-container - Container for the input field (when showIntervalInputs is true).
706
- * @part histogram-input-label - Label text for the input (From/Till).
707
- * @part histogram-from-input - Input field for the minimum value.
708
- * @part histogram-to-input - Input field for the maximum value.
709
- */
710
659
  const FILTER_OPTIONS_INITIAL_COUNT = 8;
711
660
  const FILTER_OPTIONS_STEP_COUNT = 5;
712
661
  const VviinnExtendedFilters = class {
@@ -4,7 +4,7 @@ var index = require('./index-BU8FMTXn.js');
4
4
  var Rectangle = require('./Rectangle-7dF6_xf3.js');
5
5
  var cropperUtils = require('./cropperUtils-DCDOLeBS.js');
6
6
  var swiperElement = require('./swiper-element-DjtzojCR.js');
7
- var search_store = require('./search.store-D4WiAMcl.js');
7
+ var search_store = require('./search.store-Bh2_GSpU.js');
8
8
  var SecondaryActionIcon = require('./SecondaryActionIcon-CuNEBTWD.js');
9
9
  var index$1 = require('./index-BF9aENF8.js');
10
10
  var store = require('./store-jPZ4ROqV.js');
@@ -2,7 +2,7 @@
2
2
 
3
3
  var index = require('./index-BU8FMTXn.js');
4
4
  var Rectangle = require('./Rectangle-7dF6_xf3.js');
5
- var search_store = require('./search.store-D4WiAMcl.js');
5
+ var search_store = require('./search.store-Bh2_GSpU.js');
6
6
  var index$2 = require('./index-CP1QUrJT.js');
7
7
  var store = require('./store-jPZ4ROqV.js');
8
8
  var index$1 = require('./index-BF9aENF8.js');
@@ -0,0 +1,36 @@
1
+ import { hasSelectedOcrFilter } from "./hasSelectedOcrFilter";
2
+ /**
3
+ * Decides whether the cropper must be hidden because an OCR filter is active.
4
+ * Once the user adjusts the crop box the cropper stays regardless of OCR.
5
+ * Engagement resets whenever a different image is loaded.
6
+ */
7
+ export class CropperOcrGate {
8
+ constructor() {
9
+ this.engaged = false;
10
+ this.lastImage = null;
11
+ this.awaitingFilters = false;
12
+ }
13
+ /** Re-arm OCR gating for a freshly loaded image. */
14
+ onImage(image) {
15
+ if (image === this.lastImage)
16
+ return;
17
+ this.lastImage = image;
18
+ this.engaged = false;
19
+ this.awaitingFilters = true;
20
+ }
21
+ /** Fresh dynamicFilters for the current image have arrived. */
22
+ onFreshFilters() {
23
+ this.awaitingFilters = false;
24
+ }
25
+ /** Mark that the user started working with the cropper. */
26
+ onUserAdjust() {
27
+ this.engaged = true;
28
+ }
29
+ /** True when the cropper should be hidden. */
30
+ isGated(dynamicFilters, isSearchLoading = false) {
31
+ // Defer while the image's search is still resolving, to avoid a flash.
32
+ if (this.awaitingFilters && isSearchLoading)
33
+ return true;
34
+ return !this.engaged && hasSelectedOcrFilter(dynamicFilters);
35
+ }
36
+ }
@@ -0,0 +1,4 @@
1
+ import { extractSelectedFilters } from "../../vviinn-filters/helpers";
2
+ const MODALITY_COLUMN = "modality";
3
+ const OCR_VALUE = "OCR";
4
+ export const hasSelectedOcrFilter = (dynamicFilters) => extractSelectedFilters(dynamicFilters !== null && dynamicFilters !== void 0 ? dynamicFilters : []).some((filter) => filter.column === MODALITY_COLUMN && filter.values.includes(OCR_VALUE));