@ppg_pl/pallete 0.0.7 → 2.0.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 (68) hide show
  1. package/README.md +9 -1
  2. package/dist/cjs/{index-160fcb6c.js → index-53e78fc8.js} +3 -1
  3. package/dist/cjs/index-53e78fc8.js.map +1 -0
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/my-backdrop_8.cjs.entry.js +503 -253
  6. package/dist/cjs/my-backdrop_8.cjs.entry.js.map +1 -1
  7. package/dist/cjs/pallete.cjs.js +2 -2
  8. package/dist/collection/components/api/index.js +4 -2
  9. package/dist/collection/components/api/index.js.map +1 -1
  10. package/dist/collection/components/api/services.js +31 -64
  11. package/dist/collection/components/api/services.js.map +1 -1
  12. package/dist/collection/components/my-colorinfo/my-colorinfo.js +6 -4
  13. package/dist/collection/components/my-colorinfo/my-colorinfo.js.map +1 -1
  14. package/dist/collection/components/my-loader/my-loader.css +1 -1
  15. package/dist/collection/components/my-modal/my-modal.js +65 -47
  16. package/dist/collection/components/my-modal/my-modal.js.map +1 -1
  17. package/dist/collection/components/my-search/my-search.js +28 -2
  18. package/dist/collection/components/my-search/my-search.js.map +1 -1
  19. package/dist/collection/components/my-slider/index.js +5 -8
  20. package/dist/collection/components/my-slider/index.js.map +1 -1
  21. package/dist/collection/types.js.map +1 -1
  22. package/dist/components/index2.js +25 -3
  23. package/dist/components/index2.js.map +1 -1
  24. package/dist/components/my-colorinfo2.js +4 -3
  25. package/dist/components/my-colorinfo2.js.map +1 -1
  26. package/dist/components/my-loader2.js +1 -1
  27. package/dist/components/my-loader2.js.map +1 -1
  28. package/dist/components/my-modal2.js +458 -248
  29. package/dist/components/my-modal2.js.map +1 -1
  30. package/dist/components/my-search2.js +20 -3
  31. package/dist/components/my-search2.js.map +1 -1
  32. package/dist/esm/{index-943c259f.js → index-b0145abf.js} +3 -1
  33. package/dist/esm/index-b0145abf.js.map +1 -0
  34. package/dist/esm/loader.js +3 -3
  35. package/dist/esm/my-backdrop_8.entry.js +503 -253
  36. package/dist/esm/my-backdrop_8.entry.js.map +1 -1
  37. package/dist/esm/pallete.js +3 -3
  38. package/dist/pallete/p-037cfde2.entry.js +2 -0
  39. package/dist/pallete/p-037cfde2.entry.js.map +1 -0
  40. package/dist/pallete/{p-c77aaa54.js → p-c6a049a2.js} +2 -2
  41. package/dist/pallete/p-c6a049a2.js.map +1 -0
  42. package/dist/pallete/pallete.esm.js +1 -1
  43. package/dist/pallete/pallete.esm.js.map +1 -1
  44. package/dist/types/components/api/index.d.ts +2 -1
  45. package/dist/types/components/api/services.d.ts +3 -3
  46. package/dist/types/components/my-modal/my-modal.d.ts +1 -0
  47. package/dist/types/components/my-search/my-search.d.ts +2 -0
  48. package/dist/types/components/my-slider/index.d.ts +2 -2
  49. package/dist/types/components.d.ts +5 -4
  50. package/dist/types/types.d.ts +35 -24
  51. package/package.json +4 -3
  52. package/www/build/p-037cfde2.entry.js +2 -0
  53. package/www/build/p-037cfde2.entry.js.map +1 -0
  54. package/www/build/{p-c77aaa54.js → p-c6a049a2.js} +2 -2
  55. package/www/build/p-c6a049a2.js.map +1 -0
  56. package/www/build/pallete.esm.js +1 -1
  57. package/www/build/pallete.esm.js.map +1 -1
  58. package/www/index.html +1 -1
  59. package/dist/cjs/index-160fcb6c.js.map +0 -1
  60. package/dist/esm/index-943c259f.js.map +0 -1
  61. package/dist/pallete/p-c77aaa54.js.map +0 -1
  62. package/dist/pallete/p-deffcd80.entry.js +0 -2
  63. package/dist/pallete/p-deffcd80.entry.js.map +0 -1
  64. package/www/build/p-825a7d1d.js +0 -163
  65. package/www/build/p-c77aaa54.js.map +0 -1
  66. package/www/build/p-deffcd80.entry.js +0 -2
  67. package/www/build/p-deffcd80.entry.js.map +0 -1
  68. package/www/build/p-fd390eef.css +0 -3
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h, c as createEvent, g as getAssetPath, a as getElement } from './index-943c259f.js';
1
+ import { r as registerInstance, h, c as createEvent, g as getAssetPath, a as getElement } from './index-b0145abf.js';
2
2
 
3
3
  const myBackdropCss = ".pallete-wrapper *{font-family:\"Galatea\", sans-serif}my-backdrop{width:100%;height:100%;background-color:rgba(0, 0, 0, 0.7);position:fixed;z-index:100;left:0;top:0}";
4
4
 
@@ -58,6 +58,28 @@ const MyColorBox = class {
58
58
  };
59
59
  MyColorBox.style = myColorboxCss;
60
60
 
61
+ const APIURL = 'http://147.135.211.144:8055'; //'https://pallete-colors-backend.herokuapp.com';
62
+ const accessToken = 'uBKzhiNM4rkdZSe_PQvKJp9pE-DSTmtu';
63
+ class API {
64
+ async getData(ep) {
65
+ try {
66
+ const request = await fetch(`${APIURL}/${ep}`, {
67
+ method: 'GET',
68
+ headers: {
69
+ 'Authorization': `Bearer ${accessToken}`,
70
+ 'Content-Type': 'application/json',
71
+ },
72
+ });
73
+ const response = await request.json();
74
+ return response;
75
+ }
76
+ catch (error) {
77
+ console.error(error);
78
+ }
79
+ }
80
+ }
81
+ const ApiService = new API();
82
+
61
83
  const MyColorInfo = class {
62
84
  constructor(hostRef) {
63
85
  registerInstance(this, hostRef);
@@ -84,13 +106,14 @@ const MyColorInfo = class {
84
106
  this.closeImage = 'close.png';
85
107
  }
86
108
  render() {
87
- var _a, _b, _c, _d, _e, _f, _g;
109
+ var _a, _b, _c, _d, _e, _f;
110
+ console.log('current', this.currentColor);
88
111
  return (h("div", { class: `boxes__box-content ${this.currentColor.textWhite ? 'boxes__box-content__white' : ''}`, style: {
89
112
  background: this.currentColor.hex,
90
113
  maxWidth: `${this.infoBoxWidth && this.infoBoxWidth - 4}px`,
91
114
  } }, this.isMobile && h("img", { class: 'closebtn', onClick: this.onCloseButtonClick, src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }), h("div", { class: "boxes__box-content__info", style: {
92
115
  maxWidth: this.isMobile ? `${this.infoBoxWidth && this.infoBoxWidth - 35}px` : ``,
93
- } }, !this.isMobile && h("img", { class: 'closebtn', onClick: this.onCloseButtonClick, src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }), !this.isMobile && h("h2", null, this.currentColor.name), !this.isMobile && h("h4", null, this.currentColor.number), !this.isMobile && h("div", { class: "divider" }), h("div", { class: "boxes__box-content__info__value" }, h("div", { class: "boxes__box-content__info__value-image" }, ((_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.image.data) && h("img", { src: `${(_e = (_d = (_c = (_b = this.currentColor) === null || _b === void 0 ? void 0 : _b.image) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.attributes) === null || _e === void 0 ? void 0 : _e.formats.thumbnail.url}`, alt: "color-image" })), h("div", { class: "boxes__box-content__info__value-product" }, h("div", null, !this.isMobile && h("p", null, "Produkt:"), this.isMobile && h("h2", null, this.currentColor.name), " ", h("p", null, this.product)), this.isMobile && h("div", { class: 'divider' }), this.currentColor && this.currentColor.links.find((link) => { var _a, _b, _c; return ((_c = (_b = (_a = link === null || link === void 0 ? void 0 : link.shop) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.attributes) === null || _c === void 0 ? void 0 : _c.name) === this.shop; }) && (h("a", { onClick: this.goToProduct, class: `${this.currentColor.buttonInverse ? 'inverse' : ''}`, target: "_blank", href: (_f = this === null || this === void 0 ? void 0 : this.currentColor.links.find((link) => { var _a, _b, _c; return ((_c = (_b = (_a = link === null || link === void 0 ? void 0 : link.shop) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.attributes) === null || _c === void 0 ? void 0 : _c.name) === this.shop; })) === null || _f === void 0 ? void 0 : _f.path }, "przejd\u017A do produktu"))))), h("div", { class: "boxes__box-content__slider" }, h("my-slider", { color: this.currentColor.name, shop: this.shop, product: this.product, slides: (_g = this.data) === null || _g === void 0 ? void 0 : _g.images.data }), ' ')));
116
+ } }, !this.isMobile && h("img", { class: 'closebtn', onClick: this.onCloseButtonClick, src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }), !this.isMobile && h("h2", null, this.currentColor.name), !this.isMobile && h("h4", null, this.currentColor.number), !this.isMobile && h("div", { class: "divider" }), h("div", { class: "boxes__box-content__info__value" }, h("div", { class: "boxes__box-content__info__value-image" }, ((_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.image) && h("img", { src: `${APIURL}/assets/${this.currentColor.image}?access_token=${accessToken}`, alt: "color-image" })), h("div", { class: "boxes__box-content__info__value-product" }, h("div", null, !this.isMobile && h("p", null, "Produkt:"), this.isMobile && h("h2", null, (_b = this.currentColor) === null || _b === void 0 ? void 0 : _b.name), " ", h("p", null, this.product)), this.isMobile && h("div", { class: 'divider' }), this.currentColor && ((_c = this.currentColor.links) === null || _c === void 0 ? void 0 : _c.find((link) => (link === null || link === void 0 ? void 0 : link.shop) === this.shop)) && (h("a", { onClick: this.goToProduct, class: `${this.currentColor.buttonInverse ? 'inverse' : ''}`, target: "_blank", href: (_e = (_d = this === null || this === void 0 ? void 0 : this.currentColor.links) === null || _d === void 0 ? void 0 : _d.find((link) => (link === null || link === void 0 ? void 0 : link.shop) === this.shop)) === null || _e === void 0 ? void 0 : _e.path }, "przejd\u017A do produktu"))))), h("div", { class: "boxes__box-content__slider" }, h("my-slider", { color: this.currentColor.name, shop: this.shop, product: this.product, slides: (_f = this.data) === null || _f === void 0 ? void 0 : _f.images }), ' ')));
94
117
  }
95
118
  };
96
119
 
@@ -254,7 +277,7 @@ const MyModalBundle = class {
254
277
  };
255
278
  MyModalBundle.style = myComponentCss;
256
279
 
257
- const myLoaderCss = ".container.sc-my-loader{display:flex;justify-content:center;align-items:center;height:100px;overflow:hidden}.item.sc-my-loader{width:20px;height:20px;margin:3px;list-style-type:none;transition:0.5s all ease}.item.sc-my-loader:nth-child(1){animation:right-1 1s infinite alternate;background-color:#b8cf40;animation-delay:20ms}@keyframes right-1{0%{transform:translateY(-18px)}100%{transform:translateY(18px)}}.item.sc-my-loader:nth-child(2){animation:right-2 1s infinite alternate;background-color:#ee4b5e;animation-delay:40ms}@keyframes right-2{0%{transform:translateY(-21px)}100%{transform:translateY(21px)}}.item.sc-my-loader:nth-child(3){animation:right-3 1s infinite alternate;background-color:#ea0f47;animation-delay:60ms}@keyframes right-3{0%{transform:translateY(-24px)}100%{transform:translateY(24px)}}.item.sc-my-loader:nth-child(4){animation:right-4 1s infinite alternate;background-color:#d42840;animation-delay:80ms}@keyframes right-4{0%{transform:translateY(-27px)}100%{transform:translateY(27px)}}.item.sc-my-loader:nth-child(5){animation:right-5 1s infinite alternate;background-color:#8b2850;animation-delay:100ms}@keyframes right-5{0%{transform:translateY(-30px)}100%{transform:translateY(30px)}}";
280
+ const myLoaderCss = ".container.sc-my-loader{display:flex;justify-content:center;align-items:center;height:190px;overflow:hidden}.item.sc-my-loader{width:20px;height:20px;margin:3px;list-style-type:none;transition:0.5s all ease}.item.sc-my-loader:nth-child(1){animation:right-1 1s infinite alternate;background-color:#b8cf40;animation-delay:20ms}@keyframes right-1{0%{transform:translateY(-18px)}100%{transform:translateY(18px)}}.item.sc-my-loader:nth-child(2){animation:right-2 1s infinite alternate;background-color:#ee4b5e;animation-delay:40ms}@keyframes right-2{0%{transform:translateY(-21px)}100%{transform:translateY(21px)}}.item.sc-my-loader:nth-child(3){animation:right-3 1s infinite alternate;background-color:#ea0f47;animation-delay:60ms}@keyframes right-3{0%{transform:translateY(-24px)}100%{transform:translateY(24px)}}.item.sc-my-loader:nth-child(4){animation:right-4 1s infinite alternate;background-color:#d42840;animation-delay:80ms}@keyframes right-4{0%{transform:translateY(-27px)}100%{transform:translateY(27px)}}.item.sc-my-loader:nth-child(5){animation:right-5 1s infinite alternate;background-color:#8b2850;animation-delay:100ms}@keyframes right-5{0%{transform:translateY(-30px)}100%{transform:translateY(30px)}}";
258
281
 
259
282
  const MyLoader = class {
260
283
  constructor(hostRef) {
@@ -266,25 +289,26 @@ const MyLoader = class {
266
289
  };
267
290
  MyLoader.style = myLoaderCss;
268
291
 
269
- const APIURL = 'https://pallete-colors-backend.herokuapp.com';
270
- class API {
271
- async getData(ep) {
272
- try {
273
- const request = await fetch(`${APIURL}/api/${ep}`, {
274
- method: 'GET',
275
- headers: {
276
- 'Content-Type': 'application/json',
277
- },
278
- });
279
- const response = await request.json();
280
- return response;
281
- }
282
- catch (error) {
283
- console.error(error);
284
- }
285
- }
286
- }
287
- const ApiService = new API();
292
+ /** @type {import('.')} */
293
+ var esErrors = Error;
294
+
295
+ /** @type {import('./eval')} */
296
+ var _eval = EvalError;
297
+
298
+ /** @type {import('./range')} */
299
+ var range = RangeError;
300
+
301
+ /** @type {import('./ref')} */
302
+ var ref = ReferenceError;
303
+
304
+ /** @type {import('./syntax')} */
305
+ var syntax = SyntaxError;
306
+
307
+ /** @type {import('./type')} */
308
+ var type = TypeError;
309
+
310
+ /** @type {import('./uri')} */
311
+ var uri = URIError;
288
312
 
289
313
  /* eslint complexity: [2, 18], max-statements: [2, 33] */
290
314
  var shams = function hasSymbols() {
@@ -340,55 +364,91 @@ var hasSymbols$1 = function hasNativeSymbols() {
340
364
  };
341
365
 
342
366
  var test = {
367
+ __proto__: null,
343
368
  foo: {}
344
369
  };
345
370
 
346
371
  var $Object = Object;
347
372
 
373
+ /** @type {import('.')} */
348
374
  var hasProto$1 = function hasProto() {
349
- return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object);
375
+ // @ts-expect-error: TS errors on an inherited property for some reason
376
+ return { __proto__: test }.foo === test.foo
377
+ && !(test instanceof $Object);
350
378
  };
351
379
 
352
380
  /* eslint no-invalid-this: 1 */
353
381
 
354
382
  var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
355
- var slice = Array.prototype.slice;
356
383
  var toStr$1 = Object.prototype.toString;
384
+ var max = Math.max;
357
385
  var funcType = '[object Function]';
358
386
 
387
+ var concatty = function concatty(a, b) {
388
+ var arr = [];
389
+
390
+ for (var i = 0; i < a.length; i += 1) {
391
+ arr[i] = a[i];
392
+ }
393
+ for (var j = 0; j < b.length; j += 1) {
394
+ arr[j + a.length] = b[j];
395
+ }
396
+
397
+ return arr;
398
+ };
399
+
400
+ var slicy = function slicy(arrLike, offset) {
401
+ var arr = [];
402
+ for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
403
+ arr[j] = arrLike[i];
404
+ }
405
+ return arr;
406
+ };
407
+
408
+ var joiny = function (arr, joiner) {
409
+ var str = '';
410
+ for (var i = 0; i < arr.length; i += 1) {
411
+ str += arr[i];
412
+ if (i + 1 < arr.length) {
413
+ str += joiner;
414
+ }
415
+ }
416
+ return str;
417
+ };
418
+
359
419
  var implementation = function bind(that) {
360
420
  var target = this;
361
- if (typeof target !== 'function' || toStr$1.call(target) !== funcType) {
421
+ if (typeof target !== 'function' || toStr$1.apply(target) !== funcType) {
362
422
  throw new TypeError(ERROR_MESSAGE + target);
363
423
  }
364
- var args = slice.call(arguments, 1);
424
+ var args = slicy(arguments, 1);
365
425
 
366
426
  var bound;
367
427
  var binder = function () {
368
428
  if (this instanceof bound) {
369
429
  var result = target.apply(
370
430
  this,
371
- args.concat(slice.call(arguments))
431
+ concatty(args, arguments)
372
432
  );
373
433
  if (Object(result) === result) {
374
434
  return result;
375
435
  }
376
436
  return this;
377
- } else {
378
- return target.apply(
379
- that,
380
- args.concat(slice.call(arguments))
381
- );
382
437
  }
438
+ return target.apply(
439
+ that,
440
+ concatty(args, arguments)
441
+ );
442
+
383
443
  };
384
444
 
385
- var boundLength = Math.max(0, target.length - args.length);
445
+ var boundLength = max(0, target.length - args.length);
386
446
  var boundArgs = [];
387
447
  for (var i = 0; i < boundLength; i++) {
388
- boundArgs.push('$' + i);
448
+ boundArgs[i] = '$' + i;
389
449
  }
390
450
 
391
- bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
451
+ bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
392
452
 
393
453
  if (target.prototype) {
394
454
  var Empty = function Empty() {};
@@ -402,13 +462,24 @@ var implementation = function bind(that) {
402
462
 
403
463
  var functionBind = Function.prototype.bind || implementation;
404
464
 
405
- var src = functionBind.call(Function.call, Object.prototype.hasOwnProperty);
465
+ var call = Function.prototype.call;
466
+ var $hasOwn = Object.prototype.hasOwnProperty;
467
+
468
+
469
+ /** @type {import('.')} */
470
+ var hasown = functionBind.call(call, $hasOwn);
406
471
 
407
472
  var undefined$1;
408
473
 
409
- var $SyntaxError = SyntaxError;
474
+
475
+
476
+
477
+
478
+
479
+
480
+
481
+
410
482
  var $Function = Function;
411
- var $TypeError$1 = TypeError;
412
483
 
413
484
  // eslint-disable-next-line consistent-return
414
485
  var getEvalledConstructor = function (expressionSyntax) {
@@ -417,19 +488,19 @@ var getEvalledConstructor = function (expressionSyntax) {
417
488
  } catch (e) {}
418
489
  };
419
490
 
420
- var $gOPD = Object.getOwnPropertyDescriptor;
491
+ var $gOPD$1 = Object.getOwnPropertyDescriptor;
421
492
 
422
493
  var throwTypeError = function () {
423
- throw new $TypeError$1();
494
+ throw new type();
424
495
  };
425
- var ThrowTypeError = $gOPD
496
+ var ThrowTypeError = $gOPD$1
426
497
  ? (function () {
427
498
  try {
428
499
  return throwTypeError;
429
500
  } catch (calleeThrows) {
430
501
  try {
431
502
  // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
432
- return $gOPD(arguments, 'callee').get;
503
+ return $gOPD$1(arguments, 'callee').get;
433
504
  } catch (gOPDthrows) {
434
505
  return throwTypeError;
435
506
  }
@@ -451,6 +522,7 @@ var needsEval = {};
451
522
  var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined$1 : getProto(Uint8Array);
452
523
 
453
524
  var INTRINSICS = {
525
+ __proto__: null,
454
526
  '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
455
527
  '%Array%': Array,
456
528
  '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
@@ -471,9 +543,9 @@ var INTRINSICS = {
471
543
  '%decodeURIComponent%': decodeURIComponent,
472
544
  '%encodeURI%': encodeURI,
473
545
  '%encodeURIComponent%': encodeURIComponent,
474
- '%Error%': Error,
546
+ '%Error%': esErrors,
475
547
  '%eval%': eval, // eslint-disable-line no-eval
476
- '%EvalError%': EvalError,
548
+ '%EvalError%': _eval,
477
549
  '%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
478
550
  '%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
479
551
  '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
@@ -495,8 +567,8 @@ var INTRINSICS = {
495
567
  '%parseInt%': parseInt,
496
568
  '%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
497
569
  '%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
498
- '%RangeError%': RangeError,
499
- '%ReferenceError%': ReferenceError,
570
+ '%RangeError%': range,
571
+ '%ReferenceError%': ref,
500
572
  '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
501
573
  '%RegExp%': RegExp,
502
574
  '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
@@ -505,15 +577,15 @@ var INTRINSICS = {
505
577
  '%String%': String,
506
578
  '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined$1,
507
579
  '%Symbol%': hasSymbols ? Symbol : undefined$1,
508
- '%SyntaxError%': $SyntaxError,
580
+ '%SyntaxError%': syntax,
509
581
  '%ThrowTypeError%': ThrowTypeError,
510
582
  '%TypedArray%': TypedArray,
511
- '%TypeError%': $TypeError$1,
583
+ '%TypeError%': type,
512
584
  '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
513
585
  '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
514
586
  '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
515
587
  '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
516
- '%URIError%': URIError,
588
+ '%URIError%': uri,
517
589
  '%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
518
590
  '%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
519
591
  '%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
@@ -545,6 +617,7 @@ var doEval = function doEval(name) {
545
617
  };
546
618
 
547
619
  var LEGACY_ALIASES = {
620
+ __proto__: null,
548
621
  '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
549
622
  '%ArrayPrototype%': ['Array', 'prototype'],
550
623
  '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
@@ -613,9 +686,9 @@ var stringToPath = function stringToPath(string) {
613
686
  var first = $strSlice(string, 0, 1);
614
687
  var last = $strSlice(string, -1);
615
688
  if (first === '%' && last !== '%') {
616
- throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
689
+ throw new syntax('invalid intrinsic syntax, expected closing `%`');
617
690
  } else if (last === '%' && first !== '%') {
618
- throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
691
+ throw new syntax('invalid intrinsic syntax, expected opening `%`');
619
692
  }
620
693
  var result = [];
621
694
  $replace$1(string, rePropName, function (match, number, quote, subString) {
@@ -628,18 +701,18 @@ var stringToPath = function stringToPath(string) {
628
701
  var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
629
702
  var intrinsicName = name;
630
703
  var alias;
631
- if (src(LEGACY_ALIASES, intrinsicName)) {
704
+ if (hasown(LEGACY_ALIASES, intrinsicName)) {
632
705
  alias = LEGACY_ALIASES[intrinsicName];
633
706
  intrinsicName = '%' + alias[0] + '%';
634
707
  }
635
708
 
636
- if (src(INTRINSICS, intrinsicName)) {
709
+ if (hasown(INTRINSICS, intrinsicName)) {
637
710
  var value = INTRINSICS[intrinsicName];
638
711
  if (value === needsEval) {
639
712
  value = doEval(intrinsicName);
640
713
  }
641
714
  if (typeof value === 'undefined' && !allowMissing) {
642
- throw new $TypeError$1('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
715
+ throw new type('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
643
716
  }
644
717
 
645
718
  return {
@@ -649,19 +722,19 @@ var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
649
722
  };
650
723
  }
651
724
 
652
- throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
725
+ throw new syntax('intrinsic ' + name + ' does not exist!');
653
726
  };
654
727
 
655
728
  var getIntrinsic = function GetIntrinsic(name, allowMissing) {
656
729
  if (typeof name !== 'string' || name.length === 0) {
657
- throw new $TypeError$1('intrinsic name must be a non-empty string');
730
+ throw new type('intrinsic name must be a non-empty string');
658
731
  }
659
732
  if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
660
- throw new $TypeError$1('"allowMissing" argument must be a boolean');
733
+ throw new type('"allowMissing" argument must be a boolean');
661
734
  }
662
735
 
663
736
  if ($exec(/^%?[^%]*%?$/, name) === null) {
664
- throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
737
+ throw new syntax('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
665
738
  }
666
739
  var parts = stringToPath(name);
667
740
  var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
@@ -688,7 +761,7 @@ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
688
761
  )
689
762
  && first !== last
690
763
  ) {
691
- throw new $SyntaxError('property names with quotes must have matching quotes');
764
+ throw new syntax('property names with quotes must have matching quotes');
692
765
  }
693
766
  if (part === 'constructor' || !isOwn) {
694
767
  skipFurtherCaching = true;
@@ -697,17 +770,17 @@ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
697
770
  intrinsicBaseName += '.' + part;
698
771
  intrinsicRealName = '%' + intrinsicBaseName + '%';
699
772
 
700
- if (src(INTRINSICS, intrinsicRealName)) {
773
+ if (hasown(INTRINSICS, intrinsicRealName)) {
701
774
  value = INTRINSICS[intrinsicRealName];
702
775
  } else if (value != null) {
703
776
  if (!(part in value)) {
704
777
  if (!allowMissing) {
705
- throw new $TypeError$1('base intrinsic for ' + name + ' exists, but the property is not available.');
778
+ throw new type('base intrinsic for ' + name + ' exists, but the property is not available.');
706
779
  }
707
780
  return void undefined$1;
708
781
  }
709
- if ($gOPD && (i + 1) >= parts.length) {
710
- var desc = $gOPD(value, part);
782
+ if ($gOPD$1 && (i + 1) >= parts.length) {
783
+ var desc = $gOPD$1(value, part);
711
784
  isOwn = !!desc;
712
785
 
713
786
  // By convention, when a data property is converted to an accessor
@@ -723,7 +796,7 @@ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
723
796
  value = value[part];
724
797
  }
725
798
  } else {
726
- isOwn = src(value, part);
799
+ isOwn = hasown(value, part);
727
800
  value = value[part];
728
801
  }
729
802
 
@@ -735,6 +808,8 @@ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
735
808
  return value;
736
809
  };
737
810
 
811
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
812
+
738
813
  function createCommonjsModule(fn, basedir, module) {
739
814
  return module = {
740
815
  path: basedir,
@@ -764,50 +839,170 @@ function commonjsRequire () {
764
839
  throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
765
840
  }
766
841
 
842
+ /** @type {import('.')} */
843
+ var $defineProperty = getIntrinsic('%Object.defineProperty%', true) || false;
844
+ if ($defineProperty) {
845
+ try {
846
+ $defineProperty({}, 'a', { value: 1 });
847
+ } catch (e) {
848
+ // IE 8 has a broken defineProperty
849
+ $defineProperty = false;
850
+ }
851
+ }
852
+
853
+ var esDefineProperty = $defineProperty;
854
+
855
+ var $gOPD = getIntrinsic('%Object.getOwnPropertyDescriptor%', true);
856
+
857
+ if ($gOPD) {
858
+ try {
859
+ $gOPD([], 'length');
860
+ } catch (e) {
861
+ // IE 8 has a broken gOPD
862
+ $gOPD = null;
863
+ }
864
+ }
865
+
866
+ var gopd = $gOPD;
867
+
868
+ /** @type {import('.')} */
869
+ var defineDataProperty = function defineDataProperty(
870
+ obj,
871
+ property,
872
+ value
873
+ ) {
874
+ if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
875
+ throw new type('`obj` must be an object or a function`');
876
+ }
877
+ if (typeof property !== 'string' && typeof property !== 'symbol') {
878
+ throw new type('`property` must be a string or a symbol`');
879
+ }
880
+ if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) {
881
+ throw new type('`nonEnumerable`, if provided, must be a boolean or null');
882
+ }
883
+ if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) {
884
+ throw new type('`nonWritable`, if provided, must be a boolean or null');
885
+ }
886
+ if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) {
887
+ throw new type('`nonConfigurable`, if provided, must be a boolean or null');
888
+ }
889
+ if (arguments.length > 6 && typeof arguments[6] !== 'boolean') {
890
+ throw new type('`loose`, if provided, must be a boolean');
891
+ }
892
+
893
+ var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
894
+ var nonWritable = arguments.length > 4 ? arguments[4] : null;
895
+ var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
896
+ var loose = arguments.length > 6 ? arguments[6] : false;
897
+
898
+ /* @type {false | TypedPropertyDescriptor<unknown>} */
899
+ var desc = !!gopd && gopd(obj, property);
900
+
901
+ if (esDefineProperty) {
902
+ esDefineProperty(obj, property, {
903
+ configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
904
+ enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
905
+ value: value,
906
+ writable: nonWritable === null && desc ? desc.writable : !nonWritable
907
+ });
908
+ } else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) {
909
+ // must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable
910
+ obj[property] = value; // eslint-disable-line no-param-reassign
911
+ } else {
912
+ throw new syntax('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.');
913
+ }
914
+ };
915
+
916
+ var hasPropertyDescriptors = function hasPropertyDescriptors() {
917
+ return !!esDefineProperty;
918
+ };
919
+
920
+ hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
921
+ // node v0.6 has a bug where array lengths can be Set but not Defined
922
+ if (!esDefineProperty) {
923
+ return null;
924
+ }
925
+ try {
926
+ return esDefineProperty([], 'length', { value: 1 }).length !== 1;
927
+ } catch (e) {
928
+ // In Firefox 4-22, defining length on an array throws an exception.
929
+ return true;
930
+ }
931
+ };
932
+
933
+ var hasPropertyDescriptors_1 = hasPropertyDescriptors;
934
+
935
+ var hasDescriptors = hasPropertyDescriptors_1();
936
+
937
+
938
+
939
+ var $floor$1 = getIntrinsic('%Math.floor%');
940
+
941
+ /** @type {import('.')} */
942
+ var setFunctionLength = function setFunctionLength(fn, length) {
943
+ if (typeof fn !== 'function') {
944
+ throw new type('`fn` is not a function');
945
+ }
946
+ if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor$1(length) !== length) {
947
+ throw new type('`length` must be a positive 32-bit integer');
948
+ }
949
+
950
+ var loose = arguments.length > 2 && !!arguments[2];
951
+
952
+ var functionLengthIsConfigurable = true;
953
+ var functionLengthIsWritable = true;
954
+ if ('length' in fn && gopd) {
955
+ var desc = gopd(fn, 'length');
956
+ if (desc && !desc.configurable) {
957
+ functionLengthIsConfigurable = false;
958
+ }
959
+ if (desc && !desc.writable) {
960
+ functionLengthIsWritable = false;
961
+ }
962
+ }
963
+
964
+ if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
965
+ if (hasDescriptors) {
966
+ defineDataProperty(/** @type {Parameters<define>[0]} */ (fn), 'length', length, true, true);
967
+ } else {
968
+ defineDataProperty(/** @type {Parameters<define>[0]} */ (fn), 'length', length);
969
+ }
970
+ }
971
+ return fn;
972
+ };
973
+
767
974
  var callBind = createCommonjsModule(function (module) {
768
975
 
769
976
 
770
977
 
771
978
 
979
+
980
+
772
981
  var $apply = getIntrinsic('%Function.prototype.apply%');
773
982
  var $call = getIntrinsic('%Function.prototype.call%');
774
983
  var $reflectApply = getIntrinsic('%Reflect.apply%', true) || functionBind.call($call, $apply);
775
984
 
776
- var $gOPD = getIntrinsic('%Object.getOwnPropertyDescriptor%', true);
777
- var $defineProperty = getIntrinsic('%Object.defineProperty%', true);
778
- var $max = getIntrinsic('%Math.max%');
779
985
 
780
- if ($defineProperty) {
781
- try {
782
- $defineProperty({}, 'a', { value: 1 });
783
- } catch (e) {
784
- // IE 8 has a broken defineProperty
785
- $defineProperty = null;
786
- }
787
- }
986
+ var $max = getIntrinsic('%Math.max%');
788
987
 
789
988
  module.exports = function callBind(originalFunction) {
790
- var func = $reflectApply(functionBind, $call, arguments);
791
- if ($gOPD && $defineProperty) {
792
- var desc = $gOPD(func, 'length');
793
- if (desc.configurable) {
794
- // original length, plus the receiver, minus any additional arguments (after the receiver)
795
- $defineProperty(
796
- func,
797
- 'length',
798
- { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
799
- );
800
- }
989
+ if (typeof originalFunction !== 'function') {
990
+ throw new type('a function is required');
801
991
  }
802
- return func;
992
+ var func = $reflectApply(functionBind, $call, arguments);
993
+ return setFunctionLength(
994
+ func,
995
+ 1 + $max(0, originalFunction.length - (arguments.length - 1)),
996
+ true
997
+ );
803
998
  };
804
999
 
805
1000
  var applyBind = function applyBind() {
806
1001
  return $reflectApply(functionBind, $apply, arguments);
807
1002
  };
808
1003
 
809
- if ($defineProperty) {
810
- $defineProperty(module.exports, 'apply', { value: applyBind });
1004
+ if (esDefineProperty) {
1005
+ esDefineProperty(module.exports, 'apply', { value: applyBind });
811
1006
  } else {
812
1007
  module.exports.apply = applyBind;
813
1008
  }
@@ -1073,6 +1268,14 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
1073
1268
  if (isString(obj)) {
1074
1269
  return markBoxed(inspect(String(obj)));
1075
1270
  }
1271
+ // note: in IE 8, sometimes `global !== window` but both are the prototypes of each other
1272
+ /* eslint-env browser */
1273
+ if (typeof window !== 'undefined' && obj === window) {
1274
+ return '{ [object Window] }';
1275
+ }
1276
+ if (obj === commonjsGlobal) {
1277
+ return '{ [object globalThis] }';
1278
+ }
1076
1279
  if (!isDate(obj) && !isRegExp$1(obj)) {
1077
1280
  var ys = arrObjKeys(obj, inspect);
1078
1281
  var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
@@ -1349,7 +1552,6 @@ function arrObjKeys(obj, inspect) {
1349
1552
  return xs;
1350
1553
  }
1351
1554
 
1352
- var $TypeError = getIntrinsic('%TypeError%');
1353
1555
  var $WeakMap = getIntrinsic('%WeakMap%', true);
1354
1556
  var $Map = getIntrinsic('%Map%', true);
1355
1557
 
@@ -1361,53 +1563,62 @@ var $mapSet = callBound('Map.prototype.set', true);
1361
1563
  var $mapHas = callBound('Map.prototype.has', true);
1362
1564
 
1363
1565
  /*
1364
- * This function traverses the list returning the node corresponding to the
1365
- * given key.
1366
- *
1367
- * That node is also moved to the head of the list, so that if it's accessed
1368
- * again we don't need to traverse the whole list. By doing so, all the recently
1369
- * used nodes can be accessed relatively quickly.
1370
- */
1566
+ * This function traverses the list returning the node corresponding to the given key.
1567
+ *
1568
+ * That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list. By doing so, all the recently used nodes can be accessed relatively quickly.
1569
+ */
1570
+ /** @type {import('.').listGetNode} */
1371
1571
  var listGetNode = function (list, key) { // eslint-disable-line consistent-return
1372
- for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {
1572
+ /** @type {typeof list | NonNullable<(typeof list)['next']>} */
1573
+ var prev = list;
1574
+ /** @type {(typeof list)['next']} */
1575
+ var curr;
1576
+ for (; (curr = prev.next) !== null; prev = curr) {
1373
1577
  if (curr.key === key) {
1374
1578
  prev.next = curr.next;
1375
- curr.next = list.next;
1579
+ // eslint-disable-next-line no-extra-parens
1580
+ curr.next = /** @type {NonNullable<typeof list.next>} */ (list.next);
1376
1581
  list.next = curr; // eslint-disable-line no-param-reassign
1377
1582
  return curr;
1378
1583
  }
1379
1584
  }
1380
1585
  };
1381
1586
 
1587
+ /** @type {import('.').listGet} */
1382
1588
  var listGet = function (objects, key) {
1383
1589
  var node = listGetNode(objects, key);
1384
1590
  return node && node.value;
1385
1591
  };
1592
+ /** @type {import('.').listSet} */
1386
1593
  var listSet = function (objects, key, value) {
1387
1594
  var node = listGetNode(objects, key);
1388
1595
  if (node) {
1389
1596
  node.value = value;
1390
1597
  } else {
1391
1598
  // Prepend the new node to the beginning of the list
1392
- objects.next = { // eslint-disable-line no-param-reassign
1599
+ objects.next = /** @type {import('.').ListNode<typeof value>} */ ({ // eslint-disable-line no-param-reassign, no-extra-parens
1393
1600
  key: key,
1394
1601
  next: objects.next,
1395
1602
  value: value
1396
- };
1603
+ });
1397
1604
  }
1398
1605
  };
1606
+ /** @type {import('.').listHas} */
1399
1607
  var listHas = function (objects, key) {
1400
1608
  return !!listGetNode(objects, key);
1401
1609
  };
1402
1610
 
1611
+ /** @type {import('.')} */
1403
1612
  var sideChannel = function getSideChannel() {
1404
- var $wm;
1405
- var $m;
1406
- var $o;
1613
+ /** @type {WeakMap<object, unknown>} */ var $wm;
1614
+ /** @type {Map<object, unknown>} */ var $m;
1615
+ /** @type {import('.').RootNode<unknown>} */ var $o;
1616
+
1617
+ /** @type {import('.').Channel} */
1407
1618
  var channel = {
1408
1619
  assert: function (key) {
1409
1620
  if (!channel.has(key)) {
1410
- throw new $TypeError('Side channel does not contain ' + objectInspect(key));
1621
+ throw new type('Side channel does not contain ' + objectInspect(key));
1411
1622
  }
1412
1623
  },
1413
1624
  get: function (key) { // eslint-disable-line consistent-return
@@ -1454,11 +1665,7 @@ var sideChannel = function getSideChannel() {
1454
1665
  $mapSet($m, key, value);
1455
1666
  } else {
1456
1667
  if (!$o) {
1457
- /*
1458
- * Initialize the linked list as an empty node, so that we don't have
1459
- * to special-case handling of the first node: we can always refer to
1460
- * it as (previous node).next, instead of something like (list).head
1461
- */
1668
+ // Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head
1462
1669
  $o = { key: {}, next: null };
1463
1670
  }
1464
1671
  listSet($o, key, value);
@@ -1766,10 +1973,13 @@ var defaultFormat = formats['default'];
1766
1973
  var defaults$2 = {
1767
1974
  addQueryPrefix: false,
1768
1975
  allowDots: false,
1976
+ allowEmptyArrays: false,
1977
+ arrayFormat: 'indices',
1769
1978
  charset: 'utf-8',
1770
1979
  charsetSentinel: false,
1771
1980
  delimiter: '&',
1772
1981
  encode: true,
1982
+ encodeDotInKeys: false,
1773
1983
  encoder: utils.encode,
1774
1984
  encodeValuesOnly: false,
1775
1985
  format: defaultFormat,
@@ -1798,8 +2008,10 @@ var stringify = function stringify(
1798
2008
  prefix,
1799
2009
  generateArrayPrefix,
1800
2010
  commaRoundTrip,
2011
+ allowEmptyArrays,
1801
2012
  strictNullHandling,
1802
2013
  skipNulls,
2014
+ encodeDotInKeys,
1803
2015
  encoder,
1804
2016
  filter,
1805
2017
  sort,
@@ -1881,7 +2093,13 @@ var stringify = function stringify(
1881
2093
  objKeys = sort ? keys.sort(sort) : keys;
1882
2094
  }
1883
2095
 
1884
- var adjustedPrefix = commaRoundTrip && isArray$1(obj) && obj.length === 1 ? prefix + '[]' : prefix;
2096
+ var encodedPrefix = encodeDotInKeys ? prefix.replace(/\./g, '%2E') : prefix;
2097
+
2098
+ var adjustedPrefix = commaRoundTrip && isArray$1(obj) && obj.length === 1 ? encodedPrefix + '[]' : encodedPrefix;
2099
+
2100
+ if (allowEmptyArrays && isArray$1(obj) && obj.length === 0) {
2101
+ return adjustedPrefix + '[]';
2102
+ }
1885
2103
 
1886
2104
  for (var j = 0; j < objKeys.length; ++j) {
1887
2105
  var key = objKeys[j];
@@ -1891,9 +2109,10 @@ var stringify = function stringify(
1891
2109
  continue;
1892
2110
  }
1893
2111
 
2112
+ var encodedKey = allowDots && encodeDotInKeys ? key.replace(/\./g, '%2E') : key;
1894
2113
  var keyPrefix = isArray$1(obj)
1895
- ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix
1896
- : adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']');
2114
+ ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix
2115
+ : adjustedPrefix + (allowDots ? '.' + encodedKey : '[' + encodedKey + ']');
1897
2116
 
1898
2117
  sideChannel$1.set(object, step);
1899
2118
  var valueSideChannel = sideChannel();
@@ -1903,8 +2122,10 @@ var stringify = function stringify(
1903
2122
  keyPrefix,
1904
2123
  generateArrayPrefix,
1905
2124
  commaRoundTrip,
2125
+ allowEmptyArrays,
1906
2126
  strictNullHandling,
1907
2127
  skipNulls,
2128
+ encodeDotInKeys,
1908
2129
  generateArrayPrefix === 'comma' && encodeValuesOnly && isArray$1(obj) ? null : encoder,
1909
2130
  filter,
1910
2131
  sort,
@@ -1926,6 +2147,14 @@ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
1926
2147
  return defaults$2;
1927
2148
  }
1928
2149
 
2150
+ if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') {
2151
+ throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');
2152
+ }
2153
+
2154
+ if (typeof opts.encodeDotInKeys !== 'undefined' && typeof opts.encodeDotInKeys !== 'boolean') {
2155
+ throw new TypeError('`encodeDotInKeys` option can only be `true` or `false`, when provided');
2156
+ }
2157
+
1929
2158
  if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
1930
2159
  throw new TypeError('Encoder has to be a function.');
1931
2160
  }
@@ -1949,13 +2178,32 @@ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
1949
2178
  filter = opts.filter;
1950
2179
  }
1951
2180
 
2181
+ var arrayFormat;
2182
+ if (opts.arrayFormat in arrayPrefixGenerators) {
2183
+ arrayFormat = opts.arrayFormat;
2184
+ } else if ('indices' in opts) {
2185
+ arrayFormat = opts.indices ? 'indices' : 'repeat';
2186
+ } else {
2187
+ arrayFormat = defaults$2.arrayFormat;
2188
+ }
2189
+
2190
+ if ('commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
2191
+ throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
2192
+ }
2193
+
2194
+ var allowDots = typeof opts.allowDots === 'undefined' ? opts.encodeDotInKeys === true ? true : defaults$2.allowDots : !!opts.allowDots;
2195
+
1952
2196
  return {
1953
2197
  addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults$2.addQueryPrefix,
1954
- allowDots: typeof opts.allowDots === 'undefined' ? defaults$2.allowDots : !!opts.allowDots,
2198
+ allowDots: allowDots,
2199
+ allowEmptyArrays: typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults$2.allowEmptyArrays,
2200
+ arrayFormat: arrayFormat,
1955
2201
  charset: charset,
1956
2202
  charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults$2.charsetSentinel,
2203
+ commaRoundTrip: opts.commaRoundTrip,
1957
2204
  delimiter: typeof opts.delimiter === 'undefined' ? defaults$2.delimiter : opts.delimiter,
1958
2205
  encode: typeof opts.encode === 'boolean' ? opts.encode : defaults$2.encode,
2206
+ encodeDotInKeys: typeof opts.encodeDotInKeys === 'boolean' ? opts.encodeDotInKeys : defaults$2.encodeDotInKeys,
1959
2207
  encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults$2.encoder,
1960
2208
  encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults$2.encodeValuesOnly,
1961
2209
  filter: filter,
@@ -1989,20 +2237,8 @@ var stringify_1 = function (object, opts) {
1989
2237
  return '';
1990
2238
  }
1991
2239
 
1992
- var arrayFormat;
1993
- if (opts && opts.arrayFormat in arrayPrefixGenerators) {
1994
- arrayFormat = opts.arrayFormat;
1995
- } else if (opts && 'indices' in opts) {
1996
- arrayFormat = opts.indices ? 'indices' : 'repeat';
1997
- } else {
1998
- arrayFormat = 'indices';
1999
- }
2000
-
2001
- var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
2002
- if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
2003
- throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
2004
- }
2005
- var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip;
2240
+ var generateArrayPrefix = arrayPrefixGenerators[options.arrayFormat];
2241
+ var commaRoundTrip = generateArrayPrefix === 'comma' && options.commaRoundTrip;
2006
2242
 
2007
2243
  if (!objKeys) {
2008
2244
  objKeys = Object.keys(obj);
@@ -2024,8 +2260,10 @@ var stringify_1 = function (object, opts) {
2024
2260
  key,
2025
2261
  generateArrayPrefix,
2026
2262
  commaRoundTrip,
2263
+ options.allowEmptyArrays,
2027
2264
  options.strictNullHandling,
2028
2265
  options.skipNulls,
2266
+ options.encodeDotInKeys,
2029
2267
  options.encode ? options.encoder : null,
2030
2268
  options.filter,
2031
2269
  options.sort,
@@ -2060,15 +2298,18 @@ var isArray = Array.isArray;
2060
2298
 
2061
2299
  var defaults$1 = {
2062
2300
  allowDots: false,
2301
+ allowEmptyArrays: false,
2063
2302
  allowPrototypes: false,
2064
2303
  allowSparse: false,
2065
2304
  arrayLimit: 20,
2066
2305
  charset: 'utf-8',
2067
2306
  charsetSentinel: false,
2068
2307
  comma: false,
2308
+ decodeDotInKeys: true,
2069
2309
  decoder: utils.decode,
2070
2310
  delimiter: '&',
2071
2311
  depth: 5,
2312
+ duplicates: 'combine',
2072
2313
  ignoreQueryPrefix: false,
2073
2314
  interpretNumericEntities: false,
2074
2315
  parameterLimit: 1000,
@@ -2156,9 +2397,10 @@ var parseValues = function parseQueryStringValues(str, options) {
2156
2397
  val = isArray(val) ? [val] : val;
2157
2398
  }
2158
2399
 
2159
- if (has.call(obj, key)) {
2400
+ var existing = has.call(obj, key);
2401
+ if (existing && options.duplicates === 'combine') {
2160
2402
  obj[key] = utils.combine(obj[key], val);
2161
- } else {
2403
+ } else if (!existing || options.duplicates === 'last') {
2162
2404
  obj[key] = val;
2163
2405
  }
2164
2406
  }
@@ -2174,24 +2416,25 @@ var parseObject = function (chain, val, options, valuesParsed) {
2174
2416
  var root = chain[i];
2175
2417
 
2176
2418
  if (root === '[]' && options.parseArrays) {
2177
- obj = [].concat(leaf);
2419
+ obj = options.allowEmptyArrays && leaf === '' ? [] : [].concat(leaf);
2178
2420
  } else {
2179
2421
  obj = options.plainObjects ? Object.create(null) : {};
2180
2422
  var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
2181
- var index = parseInt(cleanRoot, 10);
2182
- if (!options.parseArrays && cleanRoot === '') {
2423
+ var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, '.') : cleanRoot;
2424
+ var index = parseInt(decodedRoot, 10);
2425
+ if (!options.parseArrays && decodedRoot === '') {
2183
2426
  obj = { 0: leaf };
2184
2427
  } else if (
2185
2428
  !isNaN(index)
2186
- && root !== cleanRoot
2187
- && String(index) === cleanRoot
2429
+ && root !== decodedRoot
2430
+ && String(index) === decodedRoot
2188
2431
  && index >= 0
2189
2432
  && (options.parseArrays && index <= options.arrayLimit)
2190
2433
  ) {
2191
2434
  obj = [];
2192
2435
  obj[index] = leaf;
2193
- } else if (cleanRoot !== '__proto__') {
2194
- obj[cleanRoot] = leaf;
2436
+ } else if (decodedRoot !== '__proto__') {
2437
+ obj[decodedRoot] = leaf;
2195
2438
  }
2196
2439
  }
2197
2440
 
@@ -2260,7 +2503,15 @@ var normalizeParseOptions = function normalizeParseOptions(opts) {
2260
2503
  return defaults$1;
2261
2504
  }
2262
2505
 
2263
- if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {
2506
+ if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') {
2507
+ throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');
2508
+ }
2509
+
2510
+ if (typeof opts.decodeDotInKeys !== 'undefined' && typeof opts.decodeDotInKeys !== 'boolean') {
2511
+ throw new TypeError('`decodeDotInKeys` option can only be `true` or `false`, when provided');
2512
+ }
2513
+
2514
+ if (opts.decoder !== null && typeof opts.decoder !== 'undefined' && typeof opts.decoder !== 'function') {
2264
2515
  throw new TypeError('Decoder has to be a function.');
2265
2516
  }
2266
2517
 
@@ -2269,18 +2520,29 @@ var normalizeParseOptions = function normalizeParseOptions(opts) {
2269
2520
  }
2270
2521
  var charset = typeof opts.charset === 'undefined' ? defaults$1.charset : opts.charset;
2271
2522
 
2523
+ var duplicates = typeof opts.duplicates === 'undefined' ? defaults$1.duplicates : opts.duplicates;
2524
+
2525
+ if (duplicates !== 'combine' && duplicates !== 'first' && duplicates !== 'last') {
2526
+ throw new TypeError('The duplicates option must be either combine, first, or last');
2527
+ }
2528
+
2529
+ var allowDots = typeof opts.allowDots === 'undefined' ? opts.decodeDotInKeys === true ? true : defaults$1.allowDots : !!opts.allowDots;
2530
+
2272
2531
  return {
2273
- allowDots: typeof opts.allowDots === 'undefined' ? defaults$1.allowDots : !!opts.allowDots,
2532
+ allowDots: allowDots,
2533
+ allowEmptyArrays: typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults$1.allowEmptyArrays,
2274
2534
  allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults$1.allowPrototypes,
2275
2535
  allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults$1.allowSparse,
2276
2536
  arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults$1.arrayLimit,
2277
2537
  charset: charset,
2278
2538
  charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults$1.charsetSentinel,
2279
2539
  comma: typeof opts.comma === 'boolean' ? opts.comma : defaults$1.comma,
2540
+ decodeDotInKeys: typeof opts.decodeDotInKeys === 'boolean' ? opts.decodeDotInKeys : defaults$1.decodeDotInKeys,
2280
2541
  decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults$1.decoder,
2281
2542
  delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults$1.delimiter,
2282
2543
  // eslint-disable-next-line no-implicit-coercion, no-extra-parens
2283
2544
  depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults$1.depth,
2545
+ duplicates: duplicates,
2284
2546
  ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
2285
2547
  interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults$1.interpretNumericEntities,
2286
2548
  parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults$1.parameterLimit,
@@ -2322,85 +2584,52 @@ var lib = {
2322
2584
  stringify: stringify_1
2323
2585
  };
2324
2586
 
2587
+ const limit = 100;
2325
2588
  const fetchProductColorsQuery = (id, page) => lib.stringify({
2326
- filters: {
2589
+ fields: ['*', 'products.*'].join(','),
2590
+ filter: {
2327
2591
  products: {
2328
- id: {
2329
- $eq: id,
2592
+ Product_id: {
2593
+ _eq: id,
2330
2594
  },
2331
2595
  },
2332
2596
  },
2333
- sort: ['position:asc'],
2334
- populate: ['image', 'category', 'links', 'links.shop'],
2335
- pagination: {
2336
- page: page || 1,
2337
- pageSize: 100,
2338
- },
2597
+ meta: '*',
2598
+ page: page || 1,
2599
+ limit,
2339
2600
  }, {
2340
- encodeValuesOnly: true, // prettify url
2601
+ encodeValuesOnly: true,
2341
2602
  });
2342
- const fetchCategoryColorsQuery = (color) => lib.stringify({
2343
- filters: {
2344
- category: {
2345
- id: {
2346
- $eq: color.id,
2603
+ const fetchCategoryColorsQuery = (id, page) => lib.stringify({
2604
+ fields: ['*', 'Category.*', 'products.*'].join(','),
2605
+ filter: {
2606
+ Category: {
2607
+ Category_id: {
2608
+ _eq: id,
2347
2609
  },
2348
2610
  },
2349
2611
  },
2350
- sort: ['position:asc'],
2351
- populate: ['image', 'category', 'links', 'links.shop'],
2352
- pagination: {
2353
- page: 1,
2354
- pageSize: 100,
2355
- },
2612
+ meta: '*',
2613
+ page: page || 1,
2614
+ limit,
2356
2615
  }, {
2357
- encodeValuesOnly: true, // prettify url
2616
+ encodeValuesOnly: true,
2358
2617
  });
2359
- const fetchColorByNumber = (productId, colorNumber) => lib.stringify({
2360
- filters: {
2361
- $or: [
2362
- {
2363
- $and: [
2364
- {
2365
- number: {
2366
- $contains: colorNumber,
2367
- },
2368
- },
2369
- {
2370
- products: {
2371
- id: {
2372
- $eq: productId,
2373
- },
2374
- },
2375
- },
2376
- ],
2618
+ const fetchColorByNumber = (id, colorNumber) => lib.stringify({
2619
+ fields: ['*', 'Category.*'].join(','),
2620
+ filter: {
2621
+ Category: {
2622
+ Category_id: {
2623
+ _eq: id,
2377
2624
  },
2378
- {
2379
- $and: [
2380
- {
2381
- name: {
2382
- $contains: colorNumber,
2383
- },
2384
- },
2385
- {
2386
- products: {
2387
- id: {
2388
- $eq: productId,
2389
- },
2390
- },
2391
- },
2392
- ],
2393
- },
2394
- ],
2395
- },
2396
- sort: ['position:asc'],
2397
- populate: ['image', 'category', 'product', 'links', 'links.shop'],
2398
- pagination: {
2399
- page: 1,
2400
- pageSize: 100,
2625
+ },
2626
+ number: {
2627
+ _contains: colorNumber,
2628
+ },
2401
2629
  },
2630
+ meta: '*',
2402
2631
  }, {
2403
- encodeValuesOnly: true, // prettify url
2632
+ encodeValuesOnly: true,
2404
2633
  });
2405
2634
 
2406
2635
  const myModalCss = ".pallete-wrapper *{font-family:\"Galatea\", sans-serif}.my-modal{box-shadow:1px 1px 1px #ccc;background-color:#fff;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);max-width:1555px;width:90%;z-index:1000;text-align:center;padding:35px 40px;max-height:calc(100vh - 100px);overflow-y:auto}@media (max-width: 1024px){.my-modal{padding:80px 20px 20px}}.my-modal::-webkit-scrollbar{display:none}.my-modal .loader{display:flex;flex-direction:column;align-items:center;justify-content:center;height:300px}.my-modal>img{width:300px;object-fit:cover}@media (max-width: 768px){.my-modal>img{width:200px}}.my-modal__close{position:absolute;right:20px;top:20px;background:transparent;border:none}.my-modal__close>img{width:45px;height:45px;object-fit:cover;cursor:pointer}@media (max-width: 1024px){.my-modal__close{top:65px}}.my-modal__see-more{font-size:22px;margin-bottom:27px;display:flex;justify-content:center;align-items:center}@media (max-width: 1024px){.my-modal__see-more{font-size:18px}}.my-modal__see-more img{width:45px;height:45px}@media (max-width: 1024px){.my-modal__see-more img{display:none}}.my-modal__wrapper{display:flex;flex-direction:column;position:relative}.my-modal__wrapper .boxes{display:flex;flex-direction:column;flex-wrap:wrap}.my-modal__wrapper .boxes__list{display:flex;flex-wrap:wrap;gap:5px 5px}@media (max-width: 1024px){.my-modal__wrapper .boxes__list{justify-content:center}}.my-modal__wrapper .boxes__box-content{width:100%;margin-bottom:5px;height:500px;text-align:left;display:flex;flex-direction:row;justify-content:space-between;position:relative}.my-modal__wrapper .boxes__box-content .closebtn{position:absolute;right:10px;top:10px;width:53px;height:53px;cursor:pointer;object-fit:cover;z-index:9999}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content{flex-direction:column-reverse;height:auto}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content{margin:0 auto}}.my-modal__wrapper .boxes__box-content__info{width:40%;padding:50px 40px;position:relative}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info{width:100%;padding:15px;min-height:100px}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info{min-height:auto}}.my-modal__wrapper .boxes__box-content__info h2{font-size:35px;font-weight:normal;text-transform:capitalize;margin-bottom:7px;color:#232323}.my-modal__wrapper .boxes__box-content__info h4{margin-top:0px;margin-bottom:15px;font-size:16px;color:#4c4c4c}.my-modal__wrapper .boxes__box-content__info .divider{border:1px solid #4c4c4c;opacity:0.2;margin-bottom:20px}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info .divider{margin:10px 0px}}.my-modal__wrapper .boxes__box-content__info__value{display:flex;flex-direction:row;justify-content:flex-start}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info__value{justify-content:flex-start}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info__value{flex-direction:column}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info__value-image{margin:0 auto;margin-bottom:10px}}.my-modal__wrapper .boxes__box-content__info__value-image img{width:114px;object-fit:cover}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info__value-image img{width:75px}}.my-modal__wrapper .boxes__box-content__info__value-product{color:#232323;margin-left:10px}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info__value-product h2{font-size:26px;margin:0;margin-right:10px}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info__value-product h2{font-size:16px}}.my-modal__wrapper .boxes__box-content__info__value-product p{font-size:20px;margin-top:0px;margin-bottom:0px}.my-modal__wrapper .boxes__box-content__info__value-product p:last-of-type{margin-bottom:20px}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info__value-product p:last-of-type{margin-bottom:0}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info__value-product p{font-size:10px}}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info__value-product>div{display:flex;justify-content:flex-start;align-items:center}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info__value-product>div{flex-direction:column}}.my-modal__wrapper .boxes__box-content__slider{width:60%;position:relative}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__slider{width:100%;display:block}}.my-modal__wrapper .boxes__box-content__white *{color:#fff}.my-modal__wrapper .boxes__box-content__white h2{color:#fff}.my-modal__wrapper .pagination{margin:10px 0px;font-size:16px;display:flex;flex-direction:row;align-items:center;justify-content:center}.my-modal__wrapper .pagination>span{margin:0 3px;cursor:pointer;min-width:20px;padding:5px;box-shadow:1px 1px 1px #ccc}.my-modal__wrapper .pagination .current{background-color:wheat}.my-modal .categories{padding-bottom:20px;margin-bottom:20px;border-bottom:1px solid #dfdfdf;display:flex;flex-direction:column;align-items:flex-start}.my-modal .categories__container{display:flex;flex-wrap:nowrap;gap:5px 5px;overflow-x:auto;width:100%}@media (max-width: 1024px){.my-modal .categories__container{padding-bottom:5px}}.my-modal .categories__slide-information{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.my-modal .categories__slide-information span{color:#4c4c4c;font-size:16px;font-weight:normal}.my-modal .categories__slide-information span:first-of-type{margin-left:7px}.my-modal .categories__slide-information span:last-of-type{margin-right:7px}.my-modal .button,.my-modal a{background-color:#fff;font-size:16px;box-shadow:0 10px 20px 0 rgba(0, 0, 0, 0.1);border-radius:22.5px;padding:15px 30px;color:#232323;text-decoration:none;display:block;text-align:center;transition:all 0.7s ease-in-out;border:none;cursor:pointer}.my-modal .button:hover,.my-modal a:hover{color:#fff;background-color:#232323}.my-modal .button.inverse,.my-modal a.inverse{background-color:#232323;color:#fff}.my-modal .button.inverse:hover,.my-modal a.inverse:hover{color:#232323;background-color:#fff}@media (max-width: 1024px){.my-modal .button,.my-modal a{max-width:150px;font-size:13px;padding:12px 25px}}@media (max-width: 768px){.my-modal .button,.my-modal a{margin:0 auto}}.my-modal>.button{margin:10px auto}";
@@ -2408,6 +2637,7 @@ const myModalCss = ".pallete-wrapper *{font-family:\"Galatea\", sans-serif}.my-m
2408
2637
  const MyModal = class {
2409
2638
  constructor(hostRef) {
2410
2639
  registerInstance(this, hostRef);
2640
+ this.clearSearchText = createEvent(this, "clearSearchText", 7);
2411
2641
  this.close = createEvent(this, "close", 7);
2412
2642
  this.readyToCLose = createEvent(this, "readyToCLose", 7);
2413
2643
  this.boxDesktopWidth = 130;
@@ -2463,10 +2693,18 @@ const MyModal = class {
2463
2693
  };
2464
2694
  this.fetchProductData = async () => {
2465
2695
  try {
2466
- const response = await ApiService.getData(`products?populate[0]=modalLogo&populate[1]=images&populate[2]=shops&populate[3]=categories&filters[name][$contains]=${this.product}`);
2467
- if (response) {
2468
- if (response.data[0].attributes.shops.data.find((shop) => shop.attributes.name === this.shop).id) {
2469
- this.data = Object.assign(Object.assign({}, response.data[0].attributes), { id: response.data[0].id });
2696
+ const shopResponse = await ApiService.getData(`items/Shop?filter[name][_eq]=${this.shop}`);
2697
+ const shop = shopResponse === null || shopResponse === void 0 ? void 0 : shopResponse.data[0];
2698
+ if (shop.id) {
2699
+ const response = await ApiService.getData(`items/Product?filter[name][_eq]=${this.product}&fields=*,images.*,Shop.*,Category.*.*.*.*`);
2700
+ const product = response === null || response === void 0 ? void 0 : response.data[0];
2701
+ if (product) {
2702
+ if (product.Shop.find((s) => s.Shop_id === shop.id)) {
2703
+ this.data = Object.assign(Object.assign({}, response.data[0]), { id: response.data[0].id });
2704
+ }
2705
+ else {
2706
+ return null;
2707
+ }
2470
2708
  }
2471
2709
  }
2472
2710
  }
@@ -2477,17 +2715,16 @@ const MyModal = class {
2477
2715
  this.preloader = false;
2478
2716
  }
2479
2717
  };
2480
- // TODO:
2481
2718
  this.fetchProductColors = async (id, page) => {
2482
2719
  this.loading = true;
2483
2720
  try {
2484
- const response = await ApiService.getData(`colors?${fetchProductColorsQuery(id, page)}`);
2721
+ const response = await ApiService.getData(`items/Color?${fetchProductColorsQuery(id, page)}`);
2485
2722
  if (response) {
2486
2723
  this.colors = {
2487
2724
  list: response &&
2488
2725
  response.data &&
2489
- response.data.map((item) => (Object.assign({ id: item.id }, item.attributes))),
2490
- pagination: response.meta.pagination,
2726
+ response.data.map((item) => (Object.assign({}, item))),
2727
+ pagination: response.meta,
2491
2728
  };
2492
2729
  }
2493
2730
  }
@@ -2498,16 +2735,16 @@ const MyModal = class {
2498
2735
  this.loading = false;
2499
2736
  }
2500
2737
  };
2501
- this.fetchCategoryColors = async (color) => {
2738
+ this.fetchCategoryColors = async (id, page) => {
2502
2739
  this.loading = true;
2503
2740
  try {
2504
- const response = await ApiService.getData(`colors?${fetchCategoryColorsQuery(color)}`);
2741
+ const response = await ApiService.getData(`items/Color?${fetchCategoryColorsQuery(id, page)}`);
2505
2742
  if (response) {
2506
2743
  this.colors = {
2507
2744
  list: response &&
2508
2745
  response.data &&
2509
- response.data.map((item) => (Object.assign({ id: item.id }, item.attributes))),
2510
- pagination: response.meta.pagination,
2746
+ response.data.map((item) => (Object.assign({}, item))),
2747
+ pagination: response.meta,
2511
2748
  };
2512
2749
  }
2513
2750
  }
@@ -2518,29 +2755,21 @@ const MyModal = class {
2518
2755
  this.loading = false;
2519
2756
  }
2520
2757
  };
2521
- // private onIntersection = async (entries: any) => {
2522
- // console.log(entries[0]);
2523
- // if (entries[0].intersectionRatio === 0) {
2524
- // console.log('d');
2525
- // }
2526
- // };
2527
- // private handleObserve = () => {
2528
- // console.log(this.modalEl.shadowRoot);
2529
- // const boxesList: any = (this.modalEl as any).querySelector('.my-modal__wrapper');
2530
- // console.log(boxesList);
2531
- // if (boxesList) {
2532
- // this.observer = new IntersectionObserver(this.onIntersection);
2533
- // this.observer.observe(boxesList);
2534
- // }
2535
- // };
2536
2758
  this.onPage = (page) => {
2537
- this.data && this.fetchProductColors(String(this.data.id), page);
2759
+ if (this.data) {
2760
+ if (this.selectedCategory) {
2761
+ this.fetchCategoryColors(this.selectedCategory, page);
2762
+ }
2763
+ else {
2764
+ this.fetchProductColors(String(this.data.id), page);
2765
+ }
2766
+ }
2538
2767
  this.page = page;
2539
2768
  this.currentColor = null;
2540
2769
  this.currentIndex = null;
2541
2770
  };
2542
2771
  this.handleCategoryClick = (color) => {
2543
- if (this.selectedCategory && color && this.selectedCategory.id === color.id && !this.showRange) {
2772
+ if (this.selectedCategory && color && this.selectedCategory === color && !this.showRange) {
2544
2773
  this.data && this.fetchProductColors(String(this.data.id));
2545
2774
  this.selectedCategory = null;
2546
2775
  }
@@ -2549,6 +2778,7 @@ const MyModal = class {
2549
2778
  this.selectedCategory = color;
2550
2779
  }
2551
2780
  this.currentColor = null;
2781
+ this.clearSearchText.emit();
2552
2782
  };
2553
2783
  this.shop = undefined;
2554
2784
  this.product = undefined;
@@ -2574,9 +2804,9 @@ const MyModal = class {
2574
2804
  this.infoBoxWidth = newValue * this.boxWidth;
2575
2805
  }
2576
2806
  watchPropHandler(newValue) {
2577
- if (newValue.categories.data.length > 0) {
2807
+ if (newValue.Category.length > 0) {
2578
2808
  this.showRange = true;
2579
- this.handleCategoryClick(newValue.categories.data[0]);
2809
+ this.handleCategoryClick(newValue.Category[0].Category_id.id);
2580
2810
  }
2581
2811
  else {
2582
2812
  this.fetchProductColors(String(newValue.id));
@@ -2600,21 +2830,23 @@ const MyModal = class {
2600
2830
  this.displayForMobile();
2601
2831
  }
2602
2832
  async searchColorsHandler(event) {
2603
- var _a;
2833
+ this.loading = true;
2834
+ this.currentColor = null;
2604
2835
  // if search is empty set to first category to not showing whole product colors
2605
2836
  if (event.detail === '') {
2606
- this.handleCategoryClick((_a = this.data) === null || _a === void 0 ? void 0 : _a.categories.data[0]);
2837
+ this.handleCategoryClick(this.selectedCategory);
2838
+ this.loading = true;
2607
2839
  }
2608
2840
  try {
2609
2841
  if (this.data && this.data.id && event.detail !== '') {
2610
- this.selectedCategory = null;
2611
- const response = await ApiService.getData(`colors?${fetchColorByNumber(Number(this.data.id), event.detail)}`);
2842
+ const response = await ApiService.getData(`items/Color?${fetchColorByNumber(Number(this.selectedCategory), event.detail)}`);
2612
2843
  if (response) {
2613
2844
  this.colors = {
2614
- list: response &&
2845
+ list: (response &&
2615
2846
  response.data &&
2616
- response.data.map((item) => (Object.assign({ id: item.id }, item.attributes))),
2617
- pagination: response.meta.pagination,
2847
+ response.data.map((item) => (Object.assign({}, item)))) ||
2848
+ [],
2849
+ pagination: response.meta,
2618
2850
  };
2619
2851
  }
2620
2852
  }
@@ -2622,6 +2854,9 @@ const MyModal = class {
2622
2854
  catch (error) {
2623
2855
  console.error(error);
2624
2856
  }
2857
+ finally {
2858
+ this.loading = false;
2859
+ }
2625
2860
  }
2626
2861
  componentWillLoad() {
2627
2862
  this.preloader = true;
@@ -2633,11 +2868,9 @@ const MyModal = class {
2633
2868
  this.colorTimer();
2634
2869
  }
2635
2870
  render() {
2636
- var _a, _b, _c, _d, _e, _f, _g;
2637
- return (h("div", { class: `my-modal`, onMouseEnter: () => this.handleReadyToClose(false), onMouseLeave: () => this.handleReadyToClose(true) }, this.preloader && (h("div", { class: 'loader' }, h("my-loader", null))), !this.preloader && (h("button", { class: "my-modal__close", onClick: () => this.closeModalHandler() }, h("img", { src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }))), !this.preloader && this.data && this.data.modalLogo && h("img", { src: `${(_d = (_c = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.modalLogo) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.attributes) === null || _d === void 0 ? void 0 : _d.url}`, alt: "modal-logo" }), !this.preloader && (h("p", { class: "my-modal__see-more" }, (_e = this.data) === null || _e === void 0 ? void 0 : _e.modalDescription)), this.showRange && (h("div", { class: 'categories' }, this.data && h("my-search", { productId: Number((_f = this.data) === null || _f === void 0 ? void 0 : _f.id), isMobile: this.isMobile }), h("div", { class: 'categories__container', style: { maxWidth: `${this.infoBoxWidth}px` } }, (_g = this.data) === null || _g === void 0 ? void 0 : _g.categories.data.map((c) => {
2638
- var _a;
2639
- return (h("my-colorbox", { key: c.id, onClick: () => this.handleCategoryClick(c), color: c.attributes.hex, name: c.attributes.name, shop: this.shop, product: this.product, isCategoryActive: ((_a = this.selectedCategory) === null || _a === void 0 ? void 0 : _a.id) === c.id }));
2640
- })), this.isMobile && (h("div", { class: 'categories__slide-information', style: { width: `${this.infoBoxWidth}px` } }, h("span", null, "Przewi\u0144 w lewo"), h("span", null, "Przewi\u0144 w prawo"))))), h("div", { class: 'my-modal__wrapper' }, this.loading && h("my-loader", null), !this.loading && this.colors && (h("div", { class: 'container_boxes' }, this.colors.list.length > 0 ? (this.chunks(this.colors.list).map((color, index) => {
2871
+ var _a, _b, _c, _d;
2872
+ console.log(this.colors);
2873
+ return (h("div", { class: `my-modal`, onMouseEnter: () => this.handleReadyToClose(false), onMouseLeave: () => this.handleReadyToClose(true) }, this.preloader && (h("div", { class: 'loader' }, h("my-loader", null))), !this.preloader && (h("button", { class: "my-modal__close", onClick: () => this.closeModalHandler() }, h("img", { src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }))), !this.preloader && this.data && this.data.modalLogo && h("img", { src: `${APIURL}/assets/${(_a = this.data) === null || _a === void 0 ? void 0 : _a.modalLogo}?access_token=${accessToken}`, alt: "modal-logo" }), !this.preloader && this.data && (h("p", { class: "my-modal__see-more" }, (_b = this.data) === null || _b === void 0 ? void 0 : _b.modalDescription)), this.showRange && (h("div", { class: 'categories' }, this.data && h("my-search", { productId: Number((_c = this.data) === null || _c === void 0 ? void 0 : _c.id), isMobile: this.isMobile }), h("div", { class: 'categories__container', style: { maxWidth: `${this.infoBoxWidth}px` } }, (_d = this.data) === null || _d === void 0 ? void 0 : _d.Category.map((c) => (h("my-colorbox", { key: c.id, onClick: () => this.handleCategoryClick(c.Category_id.id), color: c.Category_id.hex, name: c.Category_id.category_name, shop: this.shop, product: this.product, isCategoryActive: this.selectedCategory === c.Category_id.id })))), this.isMobile && (h("div", { class: 'categories__slide-information', style: { width: `${this.infoBoxWidth}px` } }, h("span", null, "Przewi\u0144 w lewo"), h("span", null, "Przewi\u0144 w prawo"))))), h("div", { class: 'my-modal__wrapper' }, this.loading && h("my-loader", null), !this.loading && this.colors && (h("div", { class: 'container_boxes' }, this.colors.list.length > 0 ? (this.chunks(this.colors.list).map((color, index) => {
2641
2874
  var _a;
2642
2875
  return (h("div", { key: index, class: "boxes" }, h("div", { class: "boxes__list" }, color.map((c) => {
2643
2876
  var _a;
@@ -2656,10 +2889,10 @@ const MyModal = class {
2656
2889
  ];
2657
2890
  }, color: c.hex, name: c.name, isActive: ((_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.id) === c.id, shop: this.shop, product: this.product }));
2658
2891
  })), ((_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.id) && index === this.currentIndex && (h("my-colorinfo", { currentColor: this.currentColor, shop: this.shop, product: this.product, data: this.data, isMobile: this.isMobile, infoBoxWidth: this.infoBoxWidth }))));
2659
- })) : (h("p", null, "Brak wynik\u00F3w")), this.colors.pagination.pageCount > 1 && (h("div", { class: 'pagination' }, Array.from({ length: this.colors.pagination.pageCount }).map((page, i) => (h("span", { class: i + 1 === this.page ? 'current' : '', onClick: e => {
2892
+ })) : (h("p", null, "Brak wynik\u00F3w")), this.colors.pagination.filter_count > limit && (h("div", { class: 'pagination' }, Array.from({ length: Math.ceil(this.colors.pagination.filter_count / limit) }).map((_, i) => (h("span", { class: i + 1 === this.page ? 'current' : '', onClick: e => {
2660
2893
  e.preventDefault();
2661
2894
  this.onPage(i + 1);
2662
- }, key: `#${i + 1 + page}` }, i + 1)))))))), ' ', !this.preloader && this.isMobile && (h("button", { class: "button", onClick: () => this.closeModalHandler() }, "Zamknij"))));
2895
+ }, key: `#${i + 1}` }, i + 1)))))))), !this.preloader && this.isMobile && (h("button", { class: "button", onClick: () => this.closeModalHandler() }, "Zamknij"))));
2663
2896
  }
2664
2897
  static get assetsDirs() { return ["assets"]; }
2665
2898
  get modalEl() { return getElement(this); }
@@ -2672,6 +2905,17 @@ MyModal.style = myModalCss;
2672
2905
 
2673
2906
  const mySearchCss = ".pallete-wrapper.sc-my-search *.sc-my-search{font-family:\"Galatea\", sans-serif}.search.sc-my-search{position:relative;width:400px}@media (max-width: 768px){.search.sc-my-search{width:100%}}.search.sc-my-search input.sc-my-search{margin-bottom:12px;font-size:16px;padding:19px;border-radius:27.35px;border:1px solid #dfdfdf;width:100%}.search.sc-my-search button.sc-my-search{position:absolute;border:none;background-color:transparent;right:-20px;top:0;width:50px;height:calc(100% - 12px);display:flex;flex-direction:column;align-items:center;justify-content:center;cursor:pointer}";
2674
2907
 
2908
+ function debounce(func, wait) {
2909
+ let timeout;
2910
+ return function executedFunction(...args) {
2911
+ const later = () => {
2912
+ clearTimeout(timeout);
2913
+ func(...args);
2914
+ };
2915
+ clearTimeout(timeout);
2916
+ timeout = setTimeout(later, wait);
2917
+ };
2918
+ }
2675
2919
  const MySearch = class {
2676
2920
  constructor(hostRef) {
2677
2921
  registerInstance(this, hostRef);
@@ -2679,6 +2923,10 @@ const MySearch = class {
2679
2923
  this.fetchColorsByName = (text) => {
2680
2924
  this.searchColors.emit(text);
2681
2925
  };
2926
+ this.debouncedInputChangeValue = debounce((value) => {
2927
+ this.fetchColorsByName(value);
2928
+ this.searchText = value;
2929
+ }, 300);
2682
2930
  this.productId = undefined;
2683
2931
  this.isMobile = undefined;
2684
2932
  this.searchIcon = 'search.svg';
@@ -2686,12 +2934,14 @@ const MySearch = class {
2686
2934
  }
2687
2935
  onInputChangeValue(event) {
2688
2936
  const value = event.target.value;
2689
- this.searchColors.emit(value);
2690
- this.searchText = value;
2937
+ this.debouncedInputChangeValue(value);
2691
2938
  }
2692
2939
  fetchColorsByNameHandle(newValue) {
2693
2940
  this.fetchColorsByName(newValue);
2694
2941
  }
2942
+ clearSearchTextHandler() {
2943
+ this.searchText = null;
2944
+ }
2695
2945
  render() {
2696
2946
  return (h("div", { class: 'search' }, h("input", { placeholder: this.isMobile ? 'Wyszukaj kolor' : 'Wyszukaj kolor po nazwie bądź numerze', value: this.searchText || '', type: "text", onInput: this.onInputChangeValue.bind(this) }), h("button", { onClick: () => {
2697
2947
  this.searchText && this.fetchColorsByName(this.searchText);
@@ -7977,9 +8227,9 @@ const JcSwiper = class {
7977
8227
  render() {
7978
8228
  return (h("div", { class: "slider-wrapper" }, h("div", { class: "swiper mySwiper2" }, h("div", { class: "swiper-wrapper" }, this.slides &&
7979
8229
  this.slides.length > 0 &&
7980
- this.slides.map((slide) => (h("div", { key: slide.id, class: "swiper-slide" }, h("img", { src: slide.attributes.url, alt: "room_image" }))))), h("div", { onClick: this.colorInteraction, class: "swiper-button-next" }), h("div", { onClick: this.colorInteraction, class: "swiper-button-prev" })), h("div", { class: "swiper mySwiper" }, h("div", { class: "swiper-wrapper" }, this.slides &&
8230
+ this.slides.map((slide) => (h("div", { key: slide.id, class: "swiper-slide" }, h("img", { src: `${APIURL}/assets/${slide.directus_files_id}?access_token=${accessToken}`, alt: "room_image" }))))), h("div", { onClick: this.colorInteraction, class: "swiper-button-next" }), h("div", { onClick: this.colorInteraction, class: "swiper-button-prev" })), h("div", { class: "swiper mySwiper" }, h("div", { class: "swiper-wrapper" }, this.slides &&
7981
8231
  this.slides.length > 0 &&
7982
- this.slides.map((slide) => (h("div", { key: slide.id, class: "swiper-slide" }, h("img", { src: slide.attributes.url, alt: "room_image" }))))))));
8232
+ this.slides.map((slide) => (h("div", { key: slide.id, class: "swiper-slide" }, h("img", { src: `${APIURL}/assets/${slide.directus_files_id}?access_token=${accessToken}`, alt: "room_image" }))))))));
7983
8233
  }
7984
8234
  get modalEl() { return getElement(this); }
7985
8235
  };