@redneckz/wildless-cms-uni-blocks 0.14.57 → 0.14.59

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 (142) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +494 -479
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/AdTile/AdTile.d.ts +6 -0
  5. package/bundle/components/AdTile/AdTileContent.d.ts +5 -0
  6. package/bundle/components/AdTile/useAdTile.d.ts +2 -0
  7. package/bundle/components/ComparisonTable/TableCell.d.ts +1 -1
  8. package/bundle/components/ComparisonTable/TableCell.mobile.d.ts +1 -1
  9. package/bundle/components/ComparisonTable/TableColumn.d.ts +1 -1
  10. package/bundle/model/ContentPageDef.d.ts +1 -0
  11. package/bundle/utils/isOdd.d.ts +1 -0
  12. package/dist/components/AdTile/AdTile.d.ts +6 -0
  13. package/dist/components/AdTile/AdTile.js +12 -0
  14. package/dist/components/AdTile/AdTile.js.map +1 -0
  15. package/dist/components/AdTile/AdTileContent.d.ts +5 -0
  16. package/dist/components/AdTile/AdTileContent.js +2 -0
  17. package/dist/components/AdTile/AdTileContent.js.map +1 -0
  18. package/dist/components/AdTile/useAdTile.d.ts +2 -0
  19. package/dist/components/AdTile/useAdTile.js +12 -0
  20. package/dist/components/AdTile/useAdTile.js.map +1 -0
  21. package/dist/components/Blocks.js +4 -2
  22. package/dist/components/Blocks.js.map +1 -1
  23. package/dist/components/Blocks.mobile.js +2 -0
  24. package/dist/components/Blocks.mobile.js.map +1 -1
  25. package/dist/components/ComparisonTable/TableCell.d.ts +1 -1
  26. package/dist/components/ComparisonTable/TableCell.js +1 -1
  27. package/dist/components/ComparisonTable/TableCell.js.map +1 -1
  28. package/dist/components/ComparisonTable/TableCell.mobile.d.ts +1 -1
  29. package/dist/components/ComparisonTable/TableCell.mobile.js +1 -1
  30. package/dist/components/ComparisonTable/TableCell.mobile.js.map +1 -1
  31. package/dist/components/ComparisonTable/TableColumn.d.ts +1 -1
  32. package/dist/model/ContentPageDef.d.ts +1 -0
  33. package/dist/ui-kit/BaseFiltration/BaseFiltrationInner.js +4 -2
  34. package/dist/ui-kit/BaseFiltration/BaseFiltrationInner.js.map +1 -1
  35. package/dist/utils/isOdd.d.ts +1 -0
  36. package/dist/utils/isOdd.js +5 -0
  37. package/dist/utils/isOdd.js.map +1 -0
  38. package/lib/components/AdTile/AdTile.d.ts +6 -0
  39. package/lib/components/AdTile/AdTile.fixture.d.ts +6 -0
  40. package/lib/components/AdTile/AdTile.js +10 -0
  41. package/lib/components/AdTile/AdTile.js.map +1 -0
  42. package/lib/components/AdTile/AdTileContent.d.ts +5 -0
  43. package/lib/components/AdTile/AdTileContent.js +2 -0
  44. package/lib/components/AdTile/AdTileContent.js.map +1 -0
  45. package/lib/components/AdTile/useAdTile.d.ts +2 -0
  46. package/lib/components/AdTile/useAdTile.js +9 -0
  47. package/lib/components/AdTile/useAdTile.js.map +1 -0
  48. package/lib/components/Blocks.js +4 -2
  49. package/lib/components/Blocks.js.map +1 -1
  50. package/lib/components/Blocks.mobile.js +2 -0
  51. package/lib/components/Blocks.mobile.js.map +1 -1
  52. package/lib/components/ComparisonTable/TableCell.d.ts +1 -1
  53. package/lib/components/ComparisonTable/TableCell.js +1 -1
  54. package/lib/components/ComparisonTable/TableCell.js.map +1 -1
  55. package/lib/components/ComparisonTable/TableCell.mobile.d.ts +1 -1
  56. package/lib/components/ComparisonTable/TableCell.mobile.js +1 -1
  57. package/lib/components/ComparisonTable/TableCell.mobile.js.map +1 -1
  58. package/lib/components/ComparisonTable/TableColumn.d.ts +1 -1
  59. package/lib/model/ContentPageDef.d.ts +1 -0
  60. package/lib/ui-kit/BaseFiltration/BaseFiltrationInner.js +4 -2
  61. package/lib/ui-kit/BaseFiltration/BaseFiltrationInner.js.map +1 -1
  62. package/lib/utils/isOdd.d.ts +1 -0
  63. package/lib/utils/isOdd.js +2 -0
  64. package/lib/utils/isOdd.js.map +1 -0
  65. package/mobile/bundle/bundle.umd.js +451 -436
  66. package/mobile/bundle/bundle.umd.min.js +1 -1
  67. package/mobile/bundle/components/AdTile/AdTile.d.ts +6 -0
  68. package/mobile/bundle/components/AdTile/AdTileContent.d.ts +5 -0
  69. package/mobile/bundle/components/AdTile/useAdTile.d.ts +2 -0
  70. package/mobile/bundle/components/ComparisonTable/TableCell.d.ts +1 -1
  71. package/mobile/bundle/components/ComparisonTable/TableColumn.d.ts +1 -1
  72. package/mobile/bundle/model/ContentPageDef.d.ts +1 -0
  73. package/mobile/bundle/utils/isOdd.d.ts +1 -0
  74. package/mobile/dist/components/AdTile/AdTile.d.ts +6 -0
  75. package/mobile/dist/components/AdTile/AdTile.js +12 -0
  76. package/mobile/dist/components/AdTile/AdTile.js.map +1 -0
  77. package/mobile/dist/components/AdTile/AdTileContent.d.ts +5 -0
  78. package/mobile/dist/components/AdTile/AdTileContent.js +2 -0
  79. package/mobile/dist/components/AdTile/AdTileContent.js.map +1 -0
  80. package/mobile/dist/components/AdTile/useAdTile.d.ts +2 -0
  81. package/mobile/dist/components/AdTile/useAdTile.js +12 -0
  82. package/mobile/dist/components/AdTile/useAdTile.js.map +1 -0
  83. package/mobile/dist/components/Blocks.js +2 -0
  84. package/mobile/dist/components/Blocks.js.map +1 -1
  85. package/mobile/dist/components/ComparisonTable/TableCell.d.ts +1 -1
  86. package/mobile/dist/components/ComparisonTable/TableCell.js +1 -1
  87. package/mobile/dist/components/ComparisonTable/TableCell.js.map +1 -1
  88. package/mobile/dist/components/ComparisonTable/TableColumn.d.ts +1 -1
  89. package/mobile/dist/model/ContentPageDef.d.ts +1 -0
  90. package/mobile/dist/ui-kit/BaseFiltration/BaseFiltrationInner.js +4 -2
  91. package/mobile/dist/ui-kit/BaseFiltration/BaseFiltrationInner.js.map +1 -1
  92. package/mobile/dist/utils/isOdd.d.ts +1 -0
  93. package/mobile/dist/utils/isOdd.js +5 -0
  94. package/mobile/dist/utils/isOdd.js.map +1 -0
  95. package/mobile/lib/common.css +1 -1
  96. package/mobile/lib/components/AdTile/AdTile.d.ts +6 -0
  97. package/mobile/lib/components/AdTile/AdTile.js +10 -0
  98. package/mobile/lib/components/AdTile/AdTile.js.map +1 -0
  99. package/mobile/lib/components/AdTile/AdTileContent.d.ts +5 -0
  100. package/mobile/lib/components/AdTile/AdTileContent.js +2 -0
  101. package/mobile/lib/components/AdTile/AdTileContent.js.map +1 -0
  102. package/mobile/lib/components/AdTile/useAdTile.d.ts +2 -0
  103. package/mobile/lib/components/AdTile/useAdTile.js +9 -0
  104. package/mobile/lib/components/AdTile/useAdTile.js.map +1 -0
  105. package/mobile/lib/components/Blocks.js +2 -0
  106. package/mobile/lib/components/Blocks.js.map +1 -1
  107. package/mobile/lib/components/ComparisonTable/TableCell.d.ts +1 -1
  108. package/mobile/lib/components/ComparisonTable/TableCell.js +1 -1
  109. package/mobile/lib/components/ComparisonTable/TableCell.js.map +1 -1
  110. package/mobile/lib/components/ComparisonTable/TableColumn.d.ts +1 -1
  111. package/mobile/lib/model/ContentPageDef.d.ts +1 -0
  112. package/mobile/lib/ui-kit/BaseFiltration/BaseFiltrationInner.js +4 -2
  113. package/mobile/lib/ui-kit/BaseFiltration/BaseFiltrationInner.js.map +1 -1
  114. package/mobile/lib/utils/isOdd.d.ts +1 -0
  115. package/mobile/lib/utils/isOdd.js +2 -0
  116. package/mobile/lib/utils/isOdd.js.map +1 -0
  117. package/mobile/src/components/AdTile/AdTile.example.json +1 -0
  118. package/mobile/src/components/AdTile/AdTile.tsx +18 -0
  119. package/mobile/src/components/AdTile/AdTile.ui.json +1 -0
  120. package/mobile/src/components/AdTile/AdTileContent.ts +6 -0
  121. package/mobile/src/components/AdTile/useAdTile.ts +17 -0
  122. package/mobile/src/components/Blocks.ts +3 -0
  123. package/mobile/src/components/ComparisonTable/TableCell.tsx +2 -2
  124. package/mobile/src/components/ComparisonTable/TableColumn.tsx +1 -1
  125. package/mobile/src/model/ContentPageDef.ts +1 -0
  126. package/mobile/src/ui-kit/BaseFiltration/BaseFiltrationInner.tsx +4 -0
  127. package/mobile/src/utils/isOdd.ts +1 -0
  128. package/package.json +1 -1
  129. package/src/components/AdTile/AdTile.example.json +1 -0
  130. package/src/components/AdTile/AdTile.fixture.tsx +11 -0
  131. package/src/components/AdTile/AdTile.tsx +18 -0
  132. package/src/components/AdTile/AdTile.ui.json +1 -0
  133. package/src/components/AdTile/AdTileContent.ts +6 -0
  134. package/src/components/AdTile/useAdTile.ts +17 -0
  135. package/src/components/Blocks.mobile.ts +3 -0
  136. package/src/components/Blocks.ts +5 -2
  137. package/src/components/ComparisonTable/TableCell.mobile.tsx +2 -2
  138. package/src/components/ComparisonTable/TableCell.tsx +2 -2
  139. package/src/components/ComparisonTable/TableColumn.tsx +1 -1
  140. package/src/model/ContentPageDef.ts +1 -0
  141. package/src/ui-kit/BaseFiltration/BaseFiltrationInner.tsx +4 -0
  142. package/src/utils/isOdd.ts +1 -0
@@ -243,30 +243,10 @@
243
243
  return JSXTmpl;
244
244
  };
245
245
 
246
- function LeadServiceAPI() {
247
- async function send(body, isIndividualType) {
248
- const url = isIndividualType ? '/api/v1/lead' : '/api/v1/sendcorporatelead';
249
- try {
250
- const response = await fetch(url, {
251
- method: 'POST',
252
- headers: { 'Content-Type': 'application/json' },
253
- mode: 'cors',
254
- body: JSON.stringify(body),
255
- });
256
- if (!response?.ok) {
257
- return null;
258
- }
259
- const data = await response.json();
260
- return data;
261
- }
262
- catch (e) {
263
- return null;
264
- }
265
- }
266
- return {
267
- send,
268
- };
269
- }
246
+ const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
247
+
248
+ const isClient = !isSSR();
249
+ const ClientOnly = JSX(({ children }) => (isClient ? children : null));
270
250
 
271
251
  class EventBus {
272
252
  subscribers = {};
@@ -382,154 +362,52 @@
382
362
  return (jsx(Tag, { className: style('font-sans m-0', styles$3[headingType], className), children: title || children }));
383
363
  });
384
364
 
385
- const identity = (_) => _;
386
-
387
- const useForm = (initialState, onSubmit) => {
388
- const [formState, setFormState] = useState(initialState);
389
- const [isDirtyForm, setDirtyForm] = useState(false);
390
- const [dirtyFieldsMap, setDirtyFieldsMap] = useState({});
391
- const handlersMap = useRef({});
392
- const field = useCallback((fieldName, options) => {
393
- const { parse = identity, format = identity } = options || {};
394
- if (!handlersMap.current) {
395
- handlersMap.current = {};
396
- }
397
- handlersMap.current[fieldName] ||= (value) => {
398
- setFormState((prev) => ({ ...prev, [fieldName]: parse(value) }));
399
- setDirtyFieldsMap((prev) => ({ ...prev, [fieldName]: true }));
400
- };
401
- return {
402
- value: format(formState[fieldName]),
403
- isDirty: isDirtyForm || dirtyFieldsMap[fieldName],
404
- onChange: handlersMap.current[fieldName],
405
- };
406
- }, [formState, isDirtyForm, dirtyFieldsMap]);
407
- const update = useCallback((_) => {
408
- setFormState(_);
409
- setDirtyFieldsMap(_);
410
- }, []);
411
- const reset = useCallback(() => {
412
- setFormState(initialState);
413
- setDirtyForm(false);
414
- setDirtyFieldsMap({});
415
- }, [initialState]);
416
- const handleSubmit = useCallback((e) => {
417
- e.preventDefault();
418
- setDirtyForm(true);
419
- onSubmit && onSubmit(formState);
420
- }, [onSubmit, formState]);
421
- return [
422
- formState,
423
- {
424
- isDirty: isDirtyForm || Object.values(dirtyFieldsMap).some(Boolean),
425
- field,
426
- update,
427
- reset,
428
- onSubmit: handleSubmit,
429
- },
430
- ];
431
- };
432
-
433
- const objectValidator = (validatorsMap) => (o) => (o &&
434
- Object.entries(validatorsMap).flatMap(([key, validator]) => validator(o[key]))) ||
435
- [];
436
-
437
- const isValidationSuccess = (info) => !info?.length;
438
- const validator = (predicate) => (message) => (_) => predicate(_) ? [] : [message];
439
-
440
- const isFilled = (_) => _ !== null && _ !== undefined;
365
+ const Paragraph = JSX(({ children, ...styleProps }) => (jsx("p", { className: style('font-sans', Object.values(styleProps)), children: children })));
441
366
 
442
- const defaultCache = new Map();
443
- const applyCache = (fetcher, cache = defaultCache) => (key) => {
444
- const cachedData = cache.get(key);
445
- if (isFilled(cachedData)) {
446
- return cachedData;
447
- }
448
- const data = fetcher(key);
449
- if (isFilled(data)) {
450
- cache.set(key, Promise.resolve(data));
451
- }
452
- else {
453
- cache.delete(key);
454
- }
455
- return data;
367
+ const headlineVersionStyles = {
368
+ XXL: {
369
+ title: { headingType: 'h0', as: 'h1' },
370
+ descriptionSize: 'text-h5',
371
+ descriptionWeight: 'font-normal',
372
+ descriptionStyle: 'mt-xl',
373
+ },
374
+ XL: {
375
+ title: { headingType: 'h1', as: 'h1' },
376
+ descriptionSize: 'text-xl',
377
+ descriptionWeight: 'font-light',
378
+ descriptionStyle: 'mt-m',
379
+ },
380
+ L: {
381
+ title: { headingType: 'h2', as: 'h2' },
382
+ descriptionSize: 'text-xl',
383
+ descriptionWeight: 'font-light',
384
+ descriptionStyle: 'mt-m',
385
+ },
386
+ M: {
387
+ title: { headingType: 'h3', as: 'h2' },
388
+ descriptionSize: 'text-xl',
389
+ descriptionWeight: 'font-light',
390
+ descriptionStyle: 'mt-s',
391
+ },
392
+ S: {
393
+ title: { headingType: 'h4', as: 'h2' },
394
+ descriptionSize: 'text-xl',
395
+ descriptionWeight: 'font-light',
396
+ descriptionStyle: 'mt-xs',
397
+ },
398
+ XS: {
399
+ title: { headingType: 'h5', as: 'h2' },
400
+ descriptionSize: 'text-m',
401
+ descriptionWeight: 'font-light',
402
+ descriptionStyle: 'mt-xs',
403
+ },
456
404
  };
457
405
 
458
- const isSimpleKey = (args) => Boolean(args && Array.isArray(args) && args.length === 1 && typeof args[0] === 'string');
459
- function useAsyncData(key, fetcher, { fallback, cache } = {}) {
460
- const args = useMemo(() => keyToArgs(key), [key]);
461
- const [simpleKey] = isSimpleKey(args) ? args : [];
462
- const [data, setData] = useState(undefined);
463
- const [error, setError] = useState(undefined);
464
- useEffect(() => {
465
- const isEmptyKey = !args.some(isFilled);
466
- if (isEmptyKey) {
467
- return;
468
- }
469
- let canceled = false;
470
- const setResult = (newData, err) => {
471
- if (!canceled) {
472
- setData(newData);
473
- setError(err);
474
- }
475
- };
476
- (async () => {
477
- try {
478
- setResult(await (simpleKey ? applyCache(fetcher, cache)(simpleKey) : fetcher(...args)));
479
- }
480
- catch (err) {
481
- setResult(undefined, err);
482
- }
483
- })();
484
- return () => {
485
- canceled = true;
486
- };
487
- }, [fetcher, cache, args]);
488
- const fallbackData = fallback && simpleKey && fallback[simpleKey];
489
- return {
490
- data: !data && fallbackData ? fallbackData : data,
491
- error,
492
- mutate: () => Promise.resolve(undefined) // TODO Clean up cache
493
- };
494
- }
495
- function keyToArgs(key) {
496
- if (Array.isArray(key)) {
497
- return key;
498
- }
499
- else if (key instanceof Function) {
500
- return keyToArgs(key());
501
- }
502
- else {
503
- return [key];
504
- }
505
- }
506
-
507
- async function fetchJSON(url, options) {
508
- try {
509
- return url ? await fetchJSONUnsafe(url, options) : null;
510
- }
511
- catch (err) {
512
- console.error(err);
513
- }
514
- return null;
515
- }
516
- async function fetchJSONUnsafe(url, options) {
517
- const response = await fetch(url, {
518
- ...options,
519
- headers: {
520
- ...options?.headers,
521
- 'Content-Type': 'application/json',
522
- },
523
- });
524
- return response.json();
525
- }
526
-
527
- const REGIONS_URL$1 = '/api/v1/regions';
528
- const EMPTY_VALUE$5 = [];
529
- function useGetRegions() {
530
- const { data } = useAsyncData(REGIONS_URL$1, fetchJSONUnsafe);
531
- return data || EMPTY_VALUE$5;
532
- }
406
+ const Headline = JSX(({ className, version = '', headlineVersion = 'XL', title, description, align = 'text-center', as, isEmbedded = false, isTheme = false, ...rest }) => {
407
+ const versionStyle = headlineVersionStyles[headlineVersion];
408
+ const descriptionStyle = { marginTop: versionStyle.descriptionStyle };
409
+ return (jsxs(BlockWrapper, { className: style(isEmbedded ? '@container-normal' : '', className), defaultPadding: isEmbedded ? '' : 'p-6xl', version: version, isTheme: isTheme, ...rest, children: [title ? (jsx(Heading, { className: style('whitespace-pre-wrap', align), ...versionStyle?.title, as: as || versionStyle?.title.as, title: title })) : null, description ? (jsx(Paragraph, { size: versionStyle.descriptionSize, font: versionStyle.descriptionWeight, align: align, ...descriptionStyle, children: description })) : null] }));
410
+ });
533
411
 
534
412
  const useDialogManager = () => ({
535
413
  open: (dialog, options = {}) => defaultEventBus.fire('dialog', { type: 'open', dialog, ...options }),
@@ -710,9 +588,397 @@
710
588
  const RegularButton = JSX(({ className = '', href, rel, target, ariaLabel, version, rounded, onClick, children }) => (jsx("a", { className: getRegularButtonClasses({ className, version, rounded }), href: href, rel: rel, target: target, "aria-label": ariaLabel, role: href ? 'link' : 'button', onClick: onClick, children: children })));
711
589
  const DisabledButton = JSX(({ className, ariaLabel, version, rounded, children }) => (jsx("div", { role: "button", "aria-disabled": "true", "aria-label": ariaLabel, tabIndex: -1, className: getDisabledButtonClasses({ className, rounded, version }), children: children })));
712
590
 
713
- const Paragraph = JSX(({ children, ...styleProps }) => (jsx("p", { className: style('font-sans', Object.values(styleProps)), children: children })));
591
+ const isOnlyDigits = (str) => str && !/\D/.test(str);
714
592
 
715
- const Text = JSX(({ children, ...styleProps }) => (jsx("span", { className: style('font-sans', Object.values(styleProps)), children: children })));
593
+ const svgUseStyleMap = {
594
+ normal: '',
595
+ color: 'text-primary-main',
596
+ black: 'text-black',
597
+ white: 'text-black',
598
+ };
599
+ const Icon = JSX(({ className = '', imageClassName = '', name = '', alt = `Иконка ${name}`, title = alt, iconVersion = 'color', width, height, }) => {
600
+ const router = useRouter();
601
+ const href = adjustHref(router)(joinPath(projectSettings.CDN, '/icons', `${name}.svg`));
602
+ if (iconVersion !== 'normal') {
603
+ return (jsx(Background, { className: className, children: jsxs("svg", { className: style(getSvgSize(width), svgUseStyleMap[iconVersion], iconVersion === 'white' ? 'invert' : '', imageClassName), width: width, height: height, "aria-hidden": "true", children: [title ? jsx("title", { children: title }) : null, alt ? jsx("desc", { children: alt }) : null, jsx("use", { href: `${href}#icon`, xlinkHref: `${href}#icon` })] }) }));
604
+ }
605
+ return (jsx("img", { className: className, src: href, alt: alt, title: title, "aria-hidden": "true", width: width, height: height, style: getInlineStyle(className, height) }));
606
+ });
607
+ const getInlineStyle = (className, height) => {
608
+ if (className?.includes('h-')) {
609
+ return {};
610
+ }
611
+ return { height: isOnlyDigits(height) ? `${height}px` : height, width: 'auto' };
612
+ };
613
+ const getSvgSize = (width) => (width ? '' : 'w-full h-full');
614
+ const Background = JSX(({ className, children }) => className ? jsx("div", { className: className, children: children }) : children);
615
+
616
+ const sourcesComparator = (a, b) => a?.media && b?.media ? a.media - b.media : 0;
617
+ const ImgAsPicture = JSX(({ className = '', image, imageClassName = '', pathPrefix }) => {
618
+ const router = useRouter();
619
+ return (jsxs("picture", { className: className, children: [image?.sources?.length
620
+ ? image.sources
621
+ .filter((_) => _?.src)
622
+ .sort(sourcesComparator)
623
+ .map(({ src, format, media }, index) => (jsx("source", { srcSet: adjustSrc(router, pathPrefix)(src), type: formatToMimeType(format), media: media ? `(max-width: ${media}px)` : '', width: image.size?.width, height: image.size?.height }, `${index}_${src}`)))
624
+ : null, image?.src
625
+ ? renderImg({ ...image, src: adjustSrc(router, pathPrefix)(image.src) }, imageClassName)
626
+ : null] }));
627
+ });
628
+ const renderImg = (image, imageClassName = '') => (jsx("img", { src: image.src, className: style('object-contain', imageClassName), alt: image.alt || image.title, title: image.title || '', style: {
629
+ width: image.size?.width ? `${image.size?.width}px` : '100%',
630
+ height: image.size?.height ? `${image.size?.height}px` : 'auto',
631
+ }, width: image.size?.width, height: image.size?.height }));
632
+ const adjustSrc = (router, pathPrefix) => (src) => src && !isURL(src) ? adjustHref(router)(joinPath(pathPrefix, src)) : src;
633
+ const formatToMimeType = (format) => format ? `image/${String(format)}` : undefined;
634
+
635
+ const Img = JSX(({ className = '', image, imageClassName = '', pathPrefix, ...iconProps }) => {
636
+ if (!image?.src && !image?.icon) {
637
+ return null;
638
+ }
639
+ return image.icon ? (jsx(Icon, { className: className, imageClassName: imageClassName, iconVersion: image?.iconVersion, name: image.icon, ...iconProps })) : (jsx(ImgAsPicture, { className: className, imageClassName: imageClassName, image: image, pathPrefix: pathPrefix }));
640
+ });
641
+
642
+ function renderBackwardButton(version, handleClick) {
643
+ const iconVersion = version === 'primary' ? 'white' : 'black';
644
+ const className = 'w-12 h-12 min-h-12 min-w-12 flex items-center justify-center';
645
+ const text = 'Вернуться назад';
646
+ return (jsxs("div", { className: "hidden sm:flex items-center gap-s", children: [jsx("div", { className: getRegularButtonClasses({ className, version, rounded: true }), onClick: handleClick, children: jsx(Img, { className: "w-4 h-4", image: {
647
+ icon: 'ArrowLeftIcon',
648
+ iconVersion: iconVersion,
649
+ } }) }), jsx(Button, { version: "link", className: "group-data-secondary:text-white/80", text: text, ariaLabel: text, onClick: handleClick })] }));
650
+ }
651
+
652
+ const imageAlignmentMap = {
653
+ start: '@xl:self-start',
654
+ center: '@xl:self-center',
655
+ end: '@xl:self-end',
656
+ };
657
+ const BaseTile = JSX(({ className, version = 'primary', defaultPadding, padding, title = '', insetTitle = '', buttons, leftImage, rightImage, imageAlign, isImageAlwaysOnRight = false, isImageSecondary = false, backwardButton, children, }) => {
658
+ const router = useRouter();
659
+ const handleClick = useCallback((ev) => {
660
+ ev?.preventDefault();
661
+ router.back();
662
+ }, []);
663
+ return (jsxs("div", { className: getStyle(padding, defaultPadding, className), children: [backwardButton ? renderBackwardButton(version, handleClick) : null, title ? jsx("div", { className: "relative", children: title }) : null, jsxs("div", { className: style('grow relative flex flex-col @xl:flex-row gap-3xl w-full', leftImage ? 'self-start @xl:w-auto' : ''), children: [renderImageContainer(leftImage, { imageAlign, className: 'mx-auto' }), jsxs("div", { className: style('grid gap-3xl h-full', rightImage ? '@xl:grid-cols-2' : '', leftImage ? '' : 'grow'), children: [jsxs("div", { className: "grow space-y-lg min-w-fit", children: [insetTitle, children] }), renderImageContainer(rightImage, {
664
+ className: style('@xl:justify-self-end @xl:col-start-2', buttons ? rowSpanStyle(isImageAlwaysOnRight) : '', positionStyle(isImageAlwaysOnRight), imageSecondaryStyle(isImageSecondary)),
665
+ imageAlign,
666
+ }), renderButtons(buttons)] })] })] }));
667
+ });
668
+ const getStyle = (padding = '', defaultPadding = '', className = '') => style('relative flex flex-col gap-3xl overflow-hidden', padding || defaultPadding, className);
669
+ const rowSpanStyle = (isImageAlwaysOnRight) => isImageAlwaysOnRight ? 'row-span-2' : '@xl:row-span-2';
670
+ const positionStyle = (isImageAlwaysOnRight) => isImageAlwaysOnRight ? 'col-start-2 self-center' : '';
671
+ const renderButtons = (buttons) => buttons ? jsx("div", { className: "self-end", children: buttons }) : null;
672
+ const renderImageContainer = (image, { className, imageAlign }) => image ? (jsx("div", { className: style('shrink-1/2 justify-self-center', imageAlign && imageAlignmentMap[imageAlign], className), children: image })) : null;
673
+ const imageSecondaryStyle = (isImageSecondary) => isImageSecondary ? 'hidden @xl:block' : '';
674
+
675
+ const sum = (list = []) => list.reduce((a, b) => a + b, 0);
676
+
677
+ const avg = (items = []) => (items?.length ? sum(items) / items.length : 0);
678
+
679
+ const deviation = (items) => items?.length ? Math.sqrt(Math.abs(avg(items.map((_) => _ ** 2)) - avg(items) ** 2)) : 0;
680
+
681
+ const renderBenefitIcon = (icon, benefitsVersion = 'normal') => icon ? (jsx("div", { className: style('sm:w-12 sm:h-12 sm:min-w-12 w-11 h-11 min-w-11 box-border flex items-center justify-center rounded-icon', benefitsVersion === 'normal'
682
+ ? 'bg-secondary-light text-primary-main'
683
+ : 'bg-primary-main text-black group-data-secondary:bg-white/30 group-data-secondary:text-black'), children: jsx(Img, { className: "w-6 h-6", image: { ...icon, iconVersion: icon.iconVersion || benefitsVersion } }) })) : null;
684
+
685
+ const getHtmlText = (html) => html.replace(/<\/?[^>]+\/?>/g, '').trim();
686
+
687
+ const RichText = JSX((props) => {
688
+ const { __html = '', richVersion = '' } = props;
689
+ return getHtmlText(__html) ? (jsx("div", { className: style(richVersion, 'md-container'), dangerouslySetInnerHTML: { __html } })) : null;
690
+ });
691
+
692
+ const renderBenefitDescription = (description, i) => description ? (jsx(Paragraph, { font: "font-light", size: "text-m", color: "text-secondary-text group-data-secondary:text-white", children: description }, `description-${i}`)) : null;
693
+
694
+ const Text = JSX(({ children, ...styleProps }) => (jsx("span", { className: style('font-sans', Object.values(styleProps)), children: children })));
695
+
696
+ const renderBenefitLabel = (label, i) => label ? (jsx(Text, { color: "text-primary-text group-data-secondary:text-white", size: "text-h6", children: label }, `label-${i}`)) : null;
697
+
698
+ const renderBenefitText = (_, i) => _.type === 'rte' && '__html' in _ && _.__html ? (jsx(RichText, { ..._ }, `rte-${i}`)) : ([
699
+ 'label' in _ ? renderBenefitLabel(_.label, i) : null,
700
+ 'description' in _ ? (jsx("span", { className: _.descriptionClassName, children: renderBenefitDescription(_.description, i) }, String(i))) : null,
701
+ ]);
702
+
703
+ const BenefitItem = JSX(({ className, benefitsVersion, ..._ }) => (jsxs("div", { className: style('flex gap-m min-w-56 items-center', className), children: ['icon' in _ ? renderBenefitIcon(_.icon, benefitsVersion) : null, jsx("div", { children: renderBenefitText(_) })] })));
704
+
705
+ const MAX_BENEFITS_LEN_DEVIATION = 16;
706
+ const benefitLength = (_) => _.type === 'rte'
707
+ ? _?.__html?.length || 0
708
+ : Math.max(_?.label?.length || 0, _?.description?.length || 0);
709
+ const isDistortedBenefits = (benefits) => deviation(benefits.map(benefitLength)) > MAX_BENEFITS_LEN_DEVIATION;
710
+ const hasIcon = (_) => _ && 'icon' in _ && _.icon && (_.icon.icon || _.icon.src);
711
+ const isTextualBenefits = (benefits) => !benefits.some(hasIcon);
712
+ const DefaultBenefitsList = JSX(({ className, benefitsVersion = 'normal', benefits }) => benefits?.length ? (jsx("div", { className: style('flex gap-x-m gap-y-s', isDistortedBenefits(benefits) || isTextualBenefits(benefits) ? 'flex-col' : 'flex-wrap', className), children: benefits.map((_, i) => (jsx(BenefitItem, { benefitsVersion: benefitsVersion, ..._ }, String(i)))) })) : null);
713
+
714
+ const TabularBenefitsList = JSX(({ className, benefits }) => benefits?.length ? (jsx("div", { className: style('grid grid-cols-[max-content_1fr] auto-rows-auto items-baseline gap-x-m gap-y-xs', className), children: benefits.flatMap(renderBenefitText) })) : null);
715
+
716
+ const BenefitsList = JSX(({ isTabularBenefits, ...rest }) => isTabularBenefits ? jsx(TabularBenefitsList, { ...rest }) : jsx(DefaultBenefitsList, { ...rest }));
717
+
718
+ const isIcon = (icon) => Boolean(icon?.src || icon?.icon);
719
+
720
+ const renderButtonsSection = (buttons, { className, buttonClassName, isVertical } = {}) => buttons?.length && buttons.some((_) => _?.text || _?.icon?.icon) ? (jsx("div", { className: style('flex', isVertical
721
+ ? 'flex-col gap-xs justify-items-stretch'
722
+ : 'flex-wrap @xl:flex-nowrap gap-lg sm:gap-m', className), children: buttons.map(renderButton$1(buttonClassName)) })) : null;
723
+ const renderButton$1 = (buttonClassName = '') => (button, index) => {
724
+ const { text, icon, iconRight, version, ...rest } = button || {};
725
+ const iconVersion = getIconVersion(icon, version);
726
+ const iconRightVersion = getIconVersion(iconRight, version);
727
+ return text || icon?.icon ? (jsx(Button, { className: style('basis-full @lg:basis-auto', buttonClassName), appendLeft: renderButtonIcon({ ...icon, iconVersion }), appendRight: renderButtonIcon({ ...iconRight, iconVersion: iconRightVersion }), version: version, text: text, ...rest }, index ? String(index) : '')) : null;
728
+ };
729
+ const DEFAULT_ICON_W = 24;
730
+ const getIconVersion = (icon, version = 'secondary') => {
731
+ const iconVersionDefault = version === 'secondary' ? 'color' : 'white';
732
+ return icon?.iconVersion ? icon?.iconVersion : iconVersionDefault;
733
+ };
734
+ const renderButtonIcon = (icon) => isIcon(icon) ? (jsx(Img, { image: icon, width: String(icon?.size?.width || DEFAULT_ICON_W), height: String(DEFAULT_ICON_W) })) : null;
735
+
736
+ const DOT_SIZE_MAP = {
737
+ L: 'w-1.5 h-1.5 mr-m',
738
+ M: 'w-1.5 h-1.5 mr-s',
739
+ S: 'w-1 h-1 mr-xs',
740
+ XS: 'w-1 h-1 mr-xs',
741
+ };
742
+ const ListItem = JSX(({ className, isDotted, children, size = 'M' }) => (jsxs("div", { className: style('font-sans flex', className), role: "listitem", children: [isDotted ? (jsx("div", { className: "shrink-0", children: jsx("div", { className: style('align-middle inline-block rounded-full bg-primary-text group-data-secondary:bg-white', DOT_SIZE_MAP[size]) }) })) : null, jsx("span", { children: children })] })));
743
+
744
+ const TEXT_SIZE_MAP = {
745
+ XS: 'text-m font-light',
746
+ S: 'text-l font-light',
747
+ M: 'text-h6',
748
+ L: 'text-h5',
749
+ };
750
+ const ITEM_INDENT_MAP = {
751
+ XS: 'ml-2xs',
752
+ S: 'ml-xs',
753
+ M: 'ml-s',
754
+ L: 'ml-m',
755
+ };
756
+ const List = JSX(({ className, hasIndent, isDotted = true, items = [], listItemSize = 'M' }) => items?.length ? (jsx("section", { className: style('flex flex-col gap-xs text-left text-primary-text group-data-secondary:text-white group-data-gray:text-secondary-text', TEXT_SIZE_MAP[listItemSize], hasIndent ? ITEM_INDENT_MAP[listItemSize] : '', className), role: "list", children: items.map((item, i) => (jsx(ListItem, { isDotted: isDotted, size: listItemSize, children: item }, String(i)))) })) : null);
757
+
758
+ const toLocalNumberFormat = (fractionDigits = 0) => (_ = 0) => new Intl.NumberFormat('ru-RU', {
759
+ minimumFractionDigits: 0,
760
+ maximumFractionDigits: fractionDigits,
761
+ }).format(Number(_) || 0);
762
+
763
+ const PriceList = JSX(({ priceList }) => priceList?.length ? (jsx("div", { className: "flex flex-wrap xl:flex-nowrap xl:bg-main-divider xl:rounded-md p-xs gap-xl", children: priceList.map(renderPriceListItem) })) : null);
764
+ const renderPriceListItem = ({ label, amount }) => (jsxs("div", { className: "basis-full flex flex-col-reverse sm:flex-row sm:justify-between sm:bg-main-divider sm:py-m sm:px-lg sm:rounded-md items-baseline whitespace-pre", children: [jsx(Text, { font: "font-light", size: "text-l", color: "text-secondary-text", children: label }), amount ? (jsxs("span", { className: "font-sans text-h6 sm:text-primary-main text-primary-text", children: [toLocalNumberFormat(2)(amount), " \u20BD"] })) : null] }));
765
+
766
+ const Tags = JSX(({ className, tags }) => tags?.length ? (jsx("div", { className: style('flex flex-wrap gap-xs', className), role: "list", children: tags.map(renderTag) })) : null);
767
+ const renderTag = (tag, key) => (jsx("div", { className: "p-xs border-solid border rounded-md border-gray", role: "listitem", children: jsx(Text, { size: "text-m", font: "font-light", children: tag }) }, String(key)));
768
+
769
+ const BaseProductTile = JSX(
770
+ // eslint-disable-next-line max-lines-per-function
771
+ ({ className, padding, defaultPadding, title, description, headlineVersion = 'L', align = 'text-left', benefitsVersion, isTabularBenefits, benefits, __html, isFullWidthTitle, items, isDotted = true, priceList = [], listItemSize, tags = [], buttons, image, imageOptions: { imageAlign = 'center', directionRight = true, isImageAlwaysOnRight, isImageSecondary = false, } = {}, backwardButton, children, ...rest }) => {
772
+ const img = image?.src ? jsx(Img, { image: image }) : null;
773
+ const headline = (jsx(Headline, { title: title, description: description, headlineVersion: headlineVersion, align: align, isEmbedded: true }));
774
+ const filteredBenefits = benefits?.filter((_) => _?.type === 'rte' || 'label' in _ || 'description' in _);
775
+ return (jsx(BaseTile, { className: className, padding: padding, defaultPadding: defaultPadding, ...(isFullWidthTitle ? { title: headline } : { insetTitle: headline }), ...leftOrRightImage(img, directionRight), isImageSecondary: isImageSecondary, imageAlign: imageAlign, isImageAlwaysOnRight: isImageAlwaysOnRight, buttons: renderButtonsSection(buttons), backwardButton: backwardButton, ...rest, children: jsxs("div", { className: "flex flex-col sm:gap-xl gap-4xl", children: [filteredBenefits?.length ? (jsx(BenefitsList, { benefitsVersion: benefitsVersion, isTabularBenefits: isTabularBenefits, benefits: filteredBenefits })) : null, __html ? jsx(RichText, { __html: __html }) : null, items?.length ? (jsx(List, { items: items, isDotted: isDotted, listItemSize: listItemSize })) : null, children, priceList?.length ? jsx(PriceList, { priceList: priceList }) : null, renderTags(tags)] }) }));
776
+ });
777
+ const leftOrRightImage = (img, directionRight) => directionRight ? { rightImage: img } : { leftImage: img };
778
+ const renderTags = (tags) => (tags?.length ? jsx(Tags, { tags: tags }) : null);
779
+
780
+ const getBorderStyle$1 = (showBorder) => showBorder
781
+ ? 'border border-solid border-gray group-data-secondary:border-white/50 group-data-gray:border-main-divider'
782
+ : '';
783
+
784
+ const ProductBlock = JSX(({ className, padding, showBorder, ...rest }) => (jsx(BlockWrapper, { className: style('overflow-hidden flex flex-col gap-3xl box-border', getBorderStyle$1(showBorder), className), padding: "p-0", ...rest, children: jsx(BaseProductTile, { defaultPadding: "p-6xl", padding: padding, className: "grow h-full", ...rest }) })));
785
+
786
+ const isFilled = (_) => _ !== null && _ !== undefined;
787
+
788
+ const defaultCache = new Map();
789
+ const applyCache = (fetcher, cache = defaultCache) => (key) => {
790
+ const cachedData = cache.get(key);
791
+ if (isFilled(cachedData)) {
792
+ return cachedData;
793
+ }
794
+ const data = fetcher(key);
795
+ if (isFilled(data)) {
796
+ cache.set(key, Promise.resolve(data));
797
+ }
798
+ else {
799
+ cache.delete(key);
800
+ }
801
+ return data;
802
+ };
803
+
804
+ const isSimpleKey = (args) => Boolean(args && Array.isArray(args) && args.length === 1 && typeof args[0] === 'string');
805
+ function useAsyncData(key, fetcher, { fallback, cache } = {}) {
806
+ const args = useMemo(() => keyToArgs(key), [key]);
807
+ const [simpleKey] = isSimpleKey(args) ? args : [];
808
+ const [data, setData] = useState(undefined);
809
+ const [error, setError] = useState(undefined);
810
+ useEffect(() => {
811
+ const isEmptyKey = !args.some(isFilled);
812
+ if (isEmptyKey) {
813
+ return;
814
+ }
815
+ let canceled = false;
816
+ const setResult = (newData, err) => {
817
+ if (!canceled) {
818
+ setData(newData);
819
+ setError(err);
820
+ }
821
+ };
822
+ (async () => {
823
+ try {
824
+ setResult(await (simpleKey ? applyCache(fetcher, cache)(simpleKey) : fetcher(...args)));
825
+ }
826
+ catch (err) {
827
+ setResult(undefined, err);
828
+ }
829
+ })();
830
+ return () => {
831
+ canceled = true;
832
+ };
833
+ }, [fetcher, cache, args]);
834
+ const fallbackData = fallback && simpleKey && fallback[simpleKey];
835
+ return {
836
+ data: !data && fallbackData ? fallbackData : data,
837
+ error,
838
+ mutate: () => Promise.resolve(undefined) // TODO Clean up cache
839
+ };
840
+ }
841
+ function keyToArgs(key) {
842
+ if (Array.isArray(key)) {
843
+ return key;
844
+ }
845
+ else if (key instanceof Function) {
846
+ return keyToArgs(key());
847
+ }
848
+ else {
849
+ return [key];
850
+ }
851
+ }
852
+
853
+ async function fetchJSON(url, options) {
854
+ try {
855
+ return url ? await fetchJSONUnsafe(url, options) : null;
856
+ }
857
+ catch (err) {
858
+ console.error(err);
859
+ }
860
+ return null;
861
+ }
862
+ async function fetchJSONUnsafe(url, options) {
863
+ const response = await fetch(url, {
864
+ ...options,
865
+ headers: {
866
+ ...options?.headers,
867
+ 'Content-Type': 'application/json',
868
+ },
869
+ });
870
+ return response.json();
871
+ }
872
+
873
+ const EMPTY_VALUE$5 = {};
874
+ const DEFAULT_FOLDER_NAME = 'wcms-resources';
875
+ function useSWRResource(filename, options = {}) {
876
+ const { fallback = EMPTY_VALUE$5, folderName = DEFAULT_FOLDER_NAME, setBasePath = false } = options;
877
+ const path = joinPath('/', setBasePath ? projectSettings.BASE_PATH : '', folderName, `${filename}.json`);
878
+ const { data } = useAsyncData(filename ? path : null, fetchJSONUnsafe, {
879
+ fallback,
880
+ });
881
+ return data || EMPTY_VALUE$5;
882
+ }
883
+
884
+ const useAdTile = (sourceBook = 'reklamnaya-plitka') => {
885
+ const data = useSWRResource(sourceBook);
886
+ const tileIndex = useMemo(() => randomNumInRange(0, data?.items?.length), [data]);
887
+ return data?.items?.[tileIndex];
888
+ };
889
+ const randomNumInRange = (min = 0, max = 0) => Math.floor(Math.random() * (max - min) + min);
890
+
891
+ const AdTile = JSX((props) => {
892
+ const content = useAdTile(props.options?.page?.adSourceBook);
893
+ return content ? (jsx(ClientOnly, { children: jsx(ProductBlock, { ...content, ...props }) })) : null;
894
+ });
895
+
896
+ function LeadServiceAPI() {
897
+ async function send(body, isIndividualType) {
898
+ const url = isIndividualType ? '/api/v1/lead' : '/api/v1/sendcorporatelead';
899
+ try {
900
+ const response = await fetch(url, {
901
+ method: 'POST',
902
+ headers: { 'Content-Type': 'application/json' },
903
+ mode: 'cors',
904
+ body: JSON.stringify(body),
905
+ });
906
+ if (!response?.ok) {
907
+ return null;
908
+ }
909
+ const data = await response.json();
910
+ return data;
911
+ }
912
+ catch (e) {
913
+ return null;
914
+ }
915
+ }
916
+ return {
917
+ send,
918
+ };
919
+ }
920
+
921
+ const identity = (_) => _;
922
+
923
+ const useForm = (initialState, onSubmit) => {
924
+ const [formState, setFormState] = useState(initialState);
925
+ const [isDirtyForm, setDirtyForm] = useState(false);
926
+ const [dirtyFieldsMap, setDirtyFieldsMap] = useState({});
927
+ const handlersMap = useRef({});
928
+ const field = useCallback((fieldName, options) => {
929
+ const { parse = identity, format = identity } = options || {};
930
+ if (!handlersMap.current) {
931
+ handlersMap.current = {};
932
+ }
933
+ handlersMap.current[fieldName] ||= (value) => {
934
+ setFormState((prev) => ({ ...prev, [fieldName]: parse(value) }));
935
+ setDirtyFieldsMap((prev) => ({ ...prev, [fieldName]: true }));
936
+ };
937
+ return {
938
+ value: format(formState[fieldName]),
939
+ isDirty: isDirtyForm || dirtyFieldsMap[fieldName],
940
+ onChange: handlersMap.current[fieldName],
941
+ };
942
+ }, [formState, isDirtyForm, dirtyFieldsMap]);
943
+ const update = useCallback((_) => {
944
+ setFormState(_);
945
+ setDirtyFieldsMap(_);
946
+ }, []);
947
+ const reset = useCallback(() => {
948
+ setFormState(initialState);
949
+ setDirtyForm(false);
950
+ setDirtyFieldsMap({});
951
+ }, [initialState]);
952
+ const handleSubmit = useCallback((e) => {
953
+ e.preventDefault();
954
+ setDirtyForm(true);
955
+ onSubmit && onSubmit(formState);
956
+ }, [onSubmit, formState]);
957
+ return [
958
+ formState,
959
+ {
960
+ isDirty: isDirtyForm || Object.values(dirtyFieldsMap).some(Boolean),
961
+ field,
962
+ update,
963
+ reset,
964
+ onSubmit: handleSubmit,
965
+ },
966
+ ];
967
+ };
968
+
969
+ const objectValidator = (validatorsMap) => (o) => (o &&
970
+ Object.entries(validatorsMap).flatMap(([key, validator]) => validator(o[key]))) ||
971
+ [];
972
+
973
+ const isValidationSuccess = (info) => !info?.length;
974
+ const validator = (predicate) => (message) => (_) => predicate(_) ? [] : [message];
975
+
976
+ const REGIONS_URL$1 = '/api/v1/regions';
977
+ const EMPTY_VALUE$4 = [];
978
+ function useGetRegions() {
979
+ const { data } = useAsyncData(REGIONS_URL$1, fetchJSONUnsafe);
980
+ return data || EMPTY_VALUE$4;
981
+ }
716
982
 
717
983
  const Footnote = JSX(({ text, link }) => (jsxs(Paragraph, { size: "text-s", font: "font-light", color: "text-secondary-text", children: [jsx(Text, { children: text || 'Нажимая кнопку, вы подтверждаете согласие с ' }), link ? (jsx(Button, { href: link.href, ariaLabel: "\u0443\u0441\u043B\u043E\u0432\u0438\u044F \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043D\u043D\u044B\u0445", target: link.target, className: "text-primary-main", children: jsx(Text, { children: link.text }) })) : null] })));
718
984
 
@@ -804,31 +1070,6 @@
804
1070
  return [value, { setValue, setTrue, setFalse, toggle }];
805
1071
  }
806
1072
 
807
- const isOnlyDigits = (str) => str && !/\D/.test(str);
808
-
809
- const svgUseStyleMap = {
810
- normal: '',
811
- color: 'text-primary-main',
812
- black: 'text-black',
813
- white: 'text-black',
814
- };
815
- const Icon = JSX(({ className = '', imageClassName = '', name = '', alt = `Иконка ${name}`, title = alt, iconVersion = 'color', width, height, }) => {
816
- const router = useRouter();
817
- const href = adjustHref(router)(joinPath(projectSettings.CDN, '/icons', `${name}.svg`));
818
- if (iconVersion !== 'normal') {
819
- return (jsx(Background, { className: className, children: jsxs("svg", { className: style(getSvgSize(width), svgUseStyleMap[iconVersion], iconVersion === 'white' ? 'invert' : '', imageClassName), width: width, height: height, "aria-hidden": "true", children: [title ? jsx("title", { children: title }) : null, alt ? jsx("desc", { children: alt }) : null, jsx("use", { href: `${href}#icon`, xlinkHref: `${href}#icon` })] }) }));
820
- }
821
- return (jsx("img", { className: className, src: href, alt: alt, title: title, "aria-hidden": "true", width: width, height: height, style: getInlineStyle(className, height) }));
822
- });
823
- const getInlineStyle = (className, height) => {
824
- if (className?.includes('h-')) {
825
- return {};
826
- }
827
- return { height: isOnlyDigits(height) ? `${height}px` : height, width: 'auto' };
828
- };
829
- const getSvgSize = (width) => (width ? '' : 'w-full h-full');
830
- const Background = JSX(({ className, children }) => className ? jsx("div", { className: className, children: children }) : children);
831
-
832
1073
  const formatOption = (_) => _?.text || _?.key || '';
833
1074
 
834
1075
  function useEventListener(target, type, listener, options) {
@@ -917,11 +1158,11 @@
917
1158
  onClose: handleClose,
918
1159
  iconVersion,
919
1160
  });
920
- return (jsxs("div", { className: className, children: [renderLabel(label), jsxs("div", { className: style('relative', isOpen ? 'z-20' : 'z-10'), ref: inputRef, children: [jsxs("div", { className: style('h-14 text-l flex justify-between items-center text-primary-text cursor-pointer relative z-10', getBorderStyle$1(isBorder, valid)), onClick: isOpen ? handleClose : open, children: [jsx("p", { className: "p-m pr-3xl flex items-center overflow-hidden text-ellipsis whitespace-nowrap", children: formatOption(value) || placeholder }), renderIcon$1(isOpen, iconVersion)] }), isSearch && isOpen ? (jsx("div", { className: style('absolute top-0 w-full z-20'), children: jsx(Input, { type: "text", autoFocus: true, value: query, onChange: setQuery }) })) : null] })] }));
1161
+ return (jsxs("div", { className: className, children: [renderLabel(label), jsxs("div", { className: style('relative', isOpen ? 'z-20' : 'z-10'), ref: inputRef, children: [jsxs("div", { className: style('h-14 text-l flex justify-between items-center text-primary-text cursor-pointer relative z-10', getBorderStyle(isBorder, valid)), onClick: isOpen ? handleClose : open, children: [jsx("p", { className: "p-m pr-3xl flex items-center overflow-hidden text-ellipsis whitespace-nowrap", children: formatOption(value) || placeholder }), renderIcon$1(isOpen, iconVersion)] }), isSearch && isOpen ? (jsx("div", { className: style('absolute top-0 w-full z-20'), children: jsx(Input, { type: "text", autoFocus: true, value: query, onChange: setQuery }) })) : null] })] }));
921
1162
  });
922
1163
  const renderLabel = (label) => label ? (jsx("div", { className: "mb-xs", children: jsx(Text, { size: "text-m", color: "text-primary-text", font: "font-light", children: label }) })) : null;
923
1164
  const renderIcon$1 = (isOpen, iconVersion) => (jsx(Icon, { className: style('absolute right-3', isOpen ? '' : 'rotate-180'), iconVersion: iconVersion, name: "ArrowUpIcon", width: "16", height: "16" }));
924
- const getBorderStyle$1 = (isBorder, valid) => style(isBorder ? 'border rounded-md hover:border-primary-hover' : '', valid ? ' border-gray' : 'border-error');
1165
+ const getBorderStyle = (isBorder, valid) => style(isBorder ? 'border rounded-md hover:border-primary-hover' : '', valid ? ' border-gray' : 'border-error');
925
1166
 
926
1167
  const SelectControl = JSX(({ className = '', error, ...rest }) => (jsxs("div", { className: className, children: [jsx(Select, { ...rest, valid: !error }), jsx("div", { className: "h-2", children: error ? (jsx(Text, { size: "text-xs", font: "font-light", color: "text-error", children: error })) : null })] })));
927
1168
 
@@ -1013,14 +1254,14 @@
1013
1254
  });
1014
1255
 
1015
1256
  const BRANCHES_URL = '/api/v1/branches';
1016
- const EMPTY_VALUE$4 = [];
1257
+ const EMPTY_VALUE$3 = [];
1017
1258
  function useBranches(regionCode) {
1018
1259
  const { data } = useAsyncData(regionCode ? `${BRANCHES_URL}?regionCode=${regionCode}` : null, fetchSafeBoxes$1);
1019
- return data || EMPTY_VALUE$4;
1260
+ return data || EMPTY_VALUE$3;
1020
1261
  }
1021
1262
  const fetchSafeBoxes$1 = async (url) => {
1022
1263
  const result = await fetchJSON(url, { method: 'GET' });
1023
- return result || EMPTY_VALUE$4;
1264
+ return result || EMPTY_VALUE$3;
1024
1265
  };
1025
1266
 
1026
1267
  const MIN_CREDIT_AMOUNT = 1000;
@@ -1053,11 +1294,6 @@
1053
1294
 
1054
1295
  const clamp = (value, min, max) => Math.max(min, Math.min(value, max));
1055
1296
 
1056
- const toLocalNumberFormat = (fractionDigits = 0) => (_ = 0) => new Intl.NumberFormat('ru-RU', {
1057
- minimumFractionDigits: 0,
1058
- maximumFractionDigits: fractionDigits,
1059
- }).format(Number(_) || 0);
1060
-
1061
1297
  function parseDecimal(value) {
1062
1298
  const rawValue = (value || '').replace(/\D/g, '');
1063
1299
  const unsafeDecimal = parseInt(rawValue, 10);
@@ -1165,17 +1401,6 @@
1165
1401
  return (jsxs("form", { className: "container", onSubmit: formProps.onSubmit, children: [jsx(Heading, { headingType: "h6", title: "\u041E\u0441\u0442\u0430\u0432\u044C\u0442\u0435 \u0437\u0430\u044F\u0432\u043A\u0443 \u0438 \u043C\u044B \u043E\u0442\u0432\u0435\u0442\u0438\u043C \u043D\u0430 \u043B\u044E\u0431\u044B\u0435 \u0432\u043E\u043F\u0440\u043E\u0441\u044B \u043F\u043E \u0434\u0435\u043F\u043E\u0437\u0438\u0442\u0430\u043C", className: "@xl:text-center mb-m" }), jsxs("div", { className: "max-w-[560px] m-auto space-y-s", children: [jsx(InputControl, { className: "shrink-0 w-full", label: "\u0418\u043C\u044F", ...withValidator(field('name'), nameValidator) }), jsx(PhoneInputControl, { className: "shrink-0 w-full", label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D", ...withValidator(field('phone'), phoneValidator) })] }), jsxs("div", { className: "flex justify-between flex-col-reverse @xl:items-center @xl:flex-row max-w-[560px] m-auto", children: [jsx("div", { className: "flex-1", children: jsx(Footnote, { link: link }) }), renderSubmitButton(button)] })] }));
1166
1402
  });
1167
1403
 
1168
- const EMPTY_VALUE$3 = {};
1169
- const DEFAULT_FOLDER_NAME = 'wcms-resources';
1170
- function useSWRResource(filename, options = {}) {
1171
- const { fallback = EMPTY_VALUE$3, folderName = DEFAULT_FOLDER_NAME, setBasePath = false } = options;
1172
- const path = joinPath('/', setBasePath ? projectSettings.BASE_PATH : '', folderName, `${filename}.json`);
1173
- const { data } = useAsyncData(filename ? path : null, fetchJSONUnsafe, {
1174
- fallback,
1175
- });
1176
- return data || EMPTY_VALUE$3;
1177
- }
1178
-
1179
1404
  const ApplicationFormGrantSupport = JSX((props) => {
1180
1405
  const { button, sourceBookDir } = props;
1181
1406
  const { regions } = useSWRResource(sourceBookDir || 'regions-grant-support');
@@ -1411,32 +1636,6 @@
1411
1636
  return (jsxs("form", { className: "container space-y-s", onSubmit: formProps.onSubmit, children: [renderIndividualsFields(field), jsxs("div", { className: "@xl:flex justify-between items-center", children: [jsxs("div", { className: "@xl:mb-0 mb-2 flex items-center gap-3", children: [jsx(Checkbox, { ...withValidator(field('consentDataProcessing'), defaultValidator) }), jsx(Footnote, { text: "\u0421\u043E\u0433\u043B\u0430\u0441\u0435\u043D \u0441 ", link: link })] }), renderSubmitButton(button)] })] }));
1412
1637
  });
1413
1638
 
1414
- const sourcesComparator = (a, b) => a?.media && b?.media ? a.media - b.media : 0;
1415
- const ImgAsPicture = JSX(({ className = '', image, imageClassName = '', pathPrefix }) => {
1416
- const router = useRouter();
1417
- return (jsxs("picture", { className: className, children: [image?.sources?.length
1418
- ? image.sources
1419
- .filter((_) => _?.src)
1420
- .sort(sourcesComparator)
1421
- .map(({ src, format, media }, index) => (jsx("source", { srcSet: adjustSrc(router, pathPrefix)(src), type: formatToMimeType(format), media: media ? `(max-width: ${media}px)` : '', width: image.size?.width, height: image.size?.height }, `${index}_${src}`)))
1422
- : null, image?.src
1423
- ? renderImg({ ...image, src: adjustSrc(router, pathPrefix)(image.src) }, imageClassName)
1424
- : null] }));
1425
- });
1426
- const renderImg = (image, imageClassName = '') => (jsx("img", { src: image.src, className: style('object-contain', imageClassName), alt: image.alt || image.title, title: image.title || '', style: {
1427
- width: image.size?.width ? `${image.size?.width}px` : '100%',
1428
- height: image.size?.height ? `${image.size?.height}px` : 'auto',
1429
- }, width: image.size?.width, height: image.size?.height }));
1430
- const adjustSrc = (router, pathPrefix) => (src) => src && !isURL(src) ? adjustHref(router)(joinPath(pathPrefix, src)) : src;
1431
- const formatToMimeType = (format) => format ? `image/${String(format)}` : undefined;
1432
-
1433
- const Img = JSX(({ className = '', image, imageClassName = '', pathPrefix, ...iconProps }) => {
1434
- if (!image?.src && !image?.icon) {
1435
- return null;
1436
- }
1437
- return image.icon ? (jsx(Icon, { className: className, imageClassName: imageClassName, iconVersion: image?.iconVersion, name: image.icon, ...iconProps })) : (jsx(ImgAsPicture, { className: className, imageClassName: imageClassName, image: image, pathPrefix: pathPrefix }));
1438
- });
1439
-
1440
1639
  const renderContacts = () => (jsxs("div", { className: "flex gap-xl", children: [jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", href: `tel:8 (800) 200-78-70`, "aria-label": "8 (800) 200-78-70", children: [jsx(Img, { image: { icon: 'PhoneIcon' }, width: "24", height: "24" }), jsx("span", { children: "8 (800) 200-78-70" })] }), jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", "aria-label": "ved@rshb.ru", href: `mailto:ved@rshb.ru`, children: [jsx(Img, { image: { icon: 'MailIcon' }, width: "24", height: "24" }), jsx("span", { children: "ved@rshb.ru" })] })] }));
1441
1640
 
1442
1641
  const Radio = JSX(({ name, text, value, checked, onChange, className }) => (jsx("div", { className: className, children: jsxs("label", { className: "font-sans flex gap-s items-center relative cursor-pointer", children: [jsx("input", { className: "appearance-none flex justify-center items-center shrink-0 w-5 h-5 border border-gray hover:border-primary-hover\n checked:border-2 checked:!border-primary-main focus:checked:border-primary-main focus:border-primary-text active:border-primary-text\n after:block after:w-2.5 after:h-2.5 after:rounded-full checked:after:bg-primary-main outline-none rounded-full cursor-pointer", type: "radio", value: value, name: name, checked: checked, onChange: (_) => onChange(_.target.value) }), text ? jsx(Text, { color: "text-primary-text", children: text }) : null] }) })));
@@ -1560,28 +1759,6 @@
1560
1759
  }, className: style('rounded-icon object-fit flex justify-center items-center', iconBgStyles[iconBgVersion], className), children: jsx(Icon, { ...rest, width: "54%", height: "54%", name: icon }) })) : null;
1561
1760
  });
1562
1761
 
1563
- const DOT_SIZE_MAP = {
1564
- L: 'w-1.5 h-1.5 mr-m',
1565
- M: 'w-1.5 h-1.5 mr-s',
1566
- S: 'w-1 h-1 mr-xs',
1567
- XS: 'w-1 h-1 mr-xs',
1568
- };
1569
- const ListItem = JSX(({ className, isDotted, children, size = 'M' }) => (jsxs("div", { className: style('font-sans flex', className), role: "listitem", children: [isDotted ? (jsx("div", { className: "shrink-0", children: jsx("div", { className: style('align-middle inline-block rounded-full bg-primary-text group-data-secondary:bg-white', DOT_SIZE_MAP[size]) }) })) : null, jsx("span", { children: children })] })));
1570
-
1571
- const TEXT_SIZE_MAP = {
1572
- XS: 'text-m font-light',
1573
- S: 'text-l font-light',
1574
- M: 'text-h6',
1575
- L: 'text-h5',
1576
- };
1577
- const ITEM_INDENT_MAP = {
1578
- XS: 'ml-2xs',
1579
- S: 'ml-xs',
1580
- M: 'ml-s',
1581
- L: 'ml-m',
1582
- };
1583
- const List = JSX(({ className, hasIndent, isDotted = true, items = [], listItemSize = 'M' }) => items?.length ? (jsx("section", { className: style('flex flex-col gap-xs text-left text-primary-text group-data-secondary:text-white group-data-gray:text-secondary-text', TEXT_SIZE_MAP[listItemSize], hasIndent ? ITEM_INDENT_MAP[listItemSize] : '', className), role: "list", children: items.map((item, i) => (jsx(ListItem, { isDotted: isDotted, size: listItemSize, children: item }, String(i)))) })) : null);
1584
-
1585
1762
  const defaultIconSize = 56;
1586
1763
 
1587
1764
  const BenefitsBlock = JSX(({ className = '', title, benefitList, ...rest }) => (jsxs(BlockWrapper, { className: className, defaultPadding: "p-6xl", ...rest, children: [title ? jsx(Heading, { headingType: "h3", as: "h2", className: AlignStyles, title: title }) : null, benefitList?.length ? (jsx("div", { className: "flex flex-col @md:flex-row flex-wrap w-full @md:justify-center mt-xl gap-5xl", role: "list", children: benefitList.map(renderBenefit) })) : null] })));
@@ -1598,69 +1775,6 @@
1598
1775
  return description?.items && description.items.length > 0 ? (jsx("ul", { className: style(listStyleType, description.listItemSize ? TEXT_SIZE_MAP[description.listItemSize] : ''), children: description.items.map((_, i) => (jsx("li", { children: jsx(Text, { color: "text-secondary-text group-data-secondary:text-white/80", font: "font-light", children: _ }) }, `benefitListItem-${i}`))) })) : null;
1599
1776
  };
1600
1777
 
1601
- const isIcon = (icon) => Boolean(icon?.src || icon?.icon);
1602
-
1603
- const renderButtonsSection = (buttons, { className, buttonClassName, isVertical } = {}) => buttons?.length && buttons.some((_) => _?.text || _?.icon?.icon) ? (jsx("div", { className: style('flex', isVertical
1604
- ? 'flex-col gap-xs justify-items-stretch'
1605
- : 'flex-wrap @xl:flex-nowrap gap-lg sm:gap-m', className), children: buttons.map(renderButton$1(buttonClassName)) })) : null;
1606
- const renderButton$1 = (buttonClassName = '') => (button, index) => {
1607
- const { text, icon, iconRight, version, ...rest } = button || {};
1608
- const iconVersion = getIconVersion(icon, version);
1609
- const iconRightVersion = getIconVersion(iconRight, version);
1610
- return text || icon?.icon ? (jsx(Button, { className: style('basis-full @lg:basis-auto', buttonClassName), appendLeft: renderButtonIcon({ ...icon, iconVersion }), appendRight: renderButtonIcon({ ...iconRight, iconVersion: iconRightVersion }), version: version, text: text, ...rest }, index ? String(index) : '')) : null;
1611
- };
1612
- const DEFAULT_ICON_W = 24;
1613
- const getIconVersion = (icon, version = 'secondary') => {
1614
- const iconVersionDefault = version === 'secondary' ? 'color' : 'white';
1615
- return icon?.iconVersion ? icon?.iconVersion : iconVersionDefault;
1616
- };
1617
- const renderButtonIcon = (icon) => isIcon(icon) ? (jsx(Img, { image: icon, width: String(icon?.size?.width || DEFAULT_ICON_W), height: String(DEFAULT_ICON_W) })) : null;
1618
-
1619
- const headlineVersionStyles = {
1620
- XXL: {
1621
- title: { headingType: 'h0', as: 'h1' },
1622
- descriptionSize: 'text-h5',
1623
- descriptionWeight: 'font-normal',
1624
- descriptionStyle: 'mt-xl',
1625
- },
1626
- XL: {
1627
- title: { headingType: 'h1', as: 'h1' },
1628
- descriptionSize: 'text-xl',
1629
- descriptionWeight: 'font-light',
1630
- descriptionStyle: 'mt-m',
1631
- },
1632
- L: {
1633
- title: { headingType: 'h2', as: 'h2' },
1634
- descriptionSize: 'text-xl',
1635
- descriptionWeight: 'font-light',
1636
- descriptionStyle: 'mt-m',
1637
- },
1638
- M: {
1639
- title: { headingType: 'h3', as: 'h2' },
1640
- descriptionSize: 'text-xl',
1641
- descriptionWeight: 'font-light',
1642
- descriptionStyle: 'mt-s',
1643
- },
1644
- S: {
1645
- title: { headingType: 'h4', as: 'h2' },
1646
- descriptionSize: 'text-xl',
1647
- descriptionWeight: 'font-light',
1648
- descriptionStyle: 'mt-xs',
1649
- },
1650
- XS: {
1651
- title: { headingType: 'h5', as: 'h2' },
1652
- descriptionSize: 'text-m',
1653
- descriptionWeight: 'font-light',
1654
- descriptionStyle: 'mt-xs',
1655
- },
1656
- };
1657
-
1658
- const Headline = JSX(({ className, version = '', headlineVersion = 'XL', title, description, align = 'text-center', as, isEmbedded = false, isTheme = false, ...rest }) => {
1659
- const versionStyle = headlineVersionStyles[headlineVersion];
1660
- const descriptionStyle = { marginTop: versionStyle.descriptionStyle };
1661
- return (jsxs(BlockWrapper, { className: style(isEmbedded ? '@container-normal' : '', className), defaultPadding: isEmbedded ? '' : 'p-6xl', version: version, isTheme: isTheme, ...rest, children: [title ? (jsx(Heading, { className: style('whitespace-pre-wrap', align), ...versionStyle?.title, as: as || versionStyle?.title.as, title: title })) : null, description ? (jsx(Paragraph, { size: versionStyle.descriptionSize, font: versionStyle.descriptionWeight, align: align, ...descriptionStyle, children: description })) : null] }));
1662
- });
1663
-
1664
1778
  const Bonus = JSX(({ className = '', title, description, bonusItems = [], align = AlignStyles, ...rest }) => (jsx(BlockWrapper, { className: className, defaultPadding: "p-6xl", ...rest, children: jsxs("div", { className: "container", children: [jsx(Headline, { className: "mb-xl", isEmbedded: true, title: title, description: description, headlineVersion: "M", align: align }), jsx("div", { className: "flex flex-wrap gap-3xl gap-x-m w-full", children: bonusItems.length > 0
1665
1779
  ? bonusItems.map((_, i) => (jsxs("div", { className: "w-full @xl:w-[48%] sm:space-y-xs flex flex-col grow p-xl sm:p-m border border-gray", children: [jsx("div", { className: "grow", children: jsx(Headline, { title: _?.title, description: _?.description, headlineVersion: "S", isEmbedded: true, align: "text-left" }) }), jsxs("div", { className: "flex justify-center sm:justify-between sm:items-end", children: [jsx("div", { className: "hidden sm:block", children: renderButtonsSection(_?.buttons) }), _.bonusItemContent?.bonusType
1666
1780
  ? renderBonusItemContent(_.bonusItemContent)
@@ -2797,10 +2911,6 @@
2797
2911
  : null;
2798
2912
  }
2799
2913
 
2800
- const getBorderStyle = (showBorder) => showBorder
2801
- ? 'border border-solid border-gray group-data-secondary:border-white/50 group-data-gray:border-main-divider'
2802
- : '';
2803
-
2804
2914
  const renderCardHighlight = ({ className, text = 'ХИТ' } = {}) => (jsxs("div", { className: style('w-14 h-14 bg-white flex flex-col items-center justify-center rounded-md shadow-main-black', className), children: [jsx(Icon, { iconVersion: "black", name: "HeartIcon", width: "24", height: "24" }), jsx(Paragraph, { size: "text-s", font: "font-normal", align: "text-center", color: "text-primary-text", children: text })] }));
2805
2915
 
2806
2916
  const cardBaseStyle = 'relative h-full';
@@ -2829,7 +2939,7 @@
2829
2939
  };
2830
2940
  const cardWrapperStyle = (_, { someCardsHighlighted }) => style(cardBaseStyle, someCardsHighlighted && (isCardHighlighted(_) ? 'pt-3xl' : 'pt-3xl sm:pt-16'));
2831
2941
  const cardStyle = (_, { someCardsHighlighted, showBorder, cardSize = 'normal', }) => style(cardBaseStyle, 'min-w-80', CARD_SIZE_MAP[cardSize], // TODO fix для RecommendationCard
2832
- someCardsHighlighted && (isCardHighlighted(_) ? 'pt-3xl sm:pt-16' : 'pt-3xl'), getBorderStyle(showBorder), showBorder && 'h-full');
2942
+ someCardsHighlighted && (isCardHighlighted(_) ? 'pt-3xl sm:pt-16' : 'pt-3xl'), getBorderStyle$1(showBorder), showBorder && 'h-full');
2833
2943
  const isCardHighlighted = (_) => _?.content && 'isHighlighting' in _.content && _.content.isHighlighting;
2834
2944
 
2835
2945
  const VISIBLE_ITEM_COUNT = 0;
@@ -2878,39 +2988,6 @@
2878
2988
  isVertical: true,
2879
2989
  })] })] }) })));
2880
2990
 
2881
- function renderBackwardButton(version, handleClick) {
2882
- const iconVersion = version === 'primary' ? 'white' : 'black';
2883
- const className = 'w-12 h-12 min-h-12 min-w-12 flex items-center justify-center';
2884
- const text = 'Вернуться назад';
2885
- return (jsxs("div", { className: "hidden sm:flex items-center gap-s", children: [jsx("div", { className: getRegularButtonClasses({ className, version, rounded: true }), onClick: handleClick, children: jsx(Img, { className: "w-4 h-4", image: {
2886
- icon: 'ArrowLeftIcon',
2887
- iconVersion: iconVersion,
2888
- } }) }), jsx(Button, { version: "link", className: "group-data-secondary:text-white/80", text: text, ariaLabel: text, onClick: handleClick })] }));
2889
- }
2890
-
2891
- const imageAlignmentMap = {
2892
- start: '@xl:self-start',
2893
- center: '@xl:self-center',
2894
- end: '@xl:self-end',
2895
- };
2896
- const BaseTile = JSX(({ className, version = 'primary', defaultPadding, padding, title = '', insetTitle = '', buttons, leftImage, rightImage, imageAlign, isImageAlwaysOnRight = false, isImageSecondary = false, backwardButton, children, }) => {
2897
- const router = useRouter();
2898
- const handleClick = useCallback((ev) => {
2899
- ev?.preventDefault();
2900
- router.back();
2901
- }, []);
2902
- return (jsxs("div", { className: getStyle(padding, defaultPadding, className), children: [backwardButton ? renderBackwardButton(version, handleClick) : null, title ? jsx("div", { className: "relative", children: title }) : null, jsxs("div", { className: style('grow relative flex flex-col @xl:flex-row gap-3xl w-full', leftImage ? 'self-start @xl:w-auto' : ''), children: [renderImageContainer(leftImage, { imageAlign, className: 'mx-auto' }), jsxs("div", { className: style('grid gap-3xl h-full', rightImage ? '@xl:grid-cols-2' : '', leftImage ? '' : 'grow'), children: [jsxs("div", { className: "grow space-y-lg min-w-fit", children: [insetTitle, children] }), renderImageContainer(rightImage, {
2903
- className: style('@xl:justify-self-end @xl:col-start-2', buttons ? rowSpanStyle(isImageAlwaysOnRight) : '', positionStyle(isImageAlwaysOnRight), imageSecondaryStyle(isImageSecondary)),
2904
- imageAlign,
2905
- }), renderButtons(buttons)] })] })] }));
2906
- });
2907
- const getStyle = (padding = '', defaultPadding = '', className = '') => style('relative flex flex-col gap-3xl overflow-hidden', padding || defaultPadding, className);
2908
- const rowSpanStyle = (isImageAlwaysOnRight) => isImageAlwaysOnRight ? 'row-span-2' : '@xl:row-span-2';
2909
- const positionStyle = (isImageAlwaysOnRight) => isImageAlwaysOnRight ? 'col-start-2 self-center' : '';
2910
- const renderButtons = (buttons) => buttons ? jsx("div", { className: "self-end", children: buttons }) : null;
2911
- const renderImageContainer = (image, { className, imageAlign }) => image ? (jsx("div", { className: style('shrink-1/2 justify-self-center', imageAlign && imageAlignmentMap[imageAlign], className), children: image })) : null;
2912
- const imageSecondaryStyle = (isImageSecondary) => isImageSecondary ? 'hidden @xl:block' : '';
2913
-
2914
2991
  const cardStyleMap = {
2915
2992
  black: 'bg-black',
2916
2993
  white: 'bg-white',
@@ -2937,64 +3014,6 @@
2937
3014
  .map((link, index) => (jsx(CarouselLinkButton, { ...link }, String(index)))) }, String(groupIndex)))) }));
2938
3015
  };
2939
3016
 
2940
- const sum = (list = []) => list.reduce((a, b) => a + b, 0);
2941
-
2942
- const avg = (items = []) => (items?.length ? sum(items) / items.length : 0);
2943
-
2944
- const deviation = (items) => items?.length ? Math.sqrt(Math.abs(avg(items.map((_) => _ ** 2)) - avg(items) ** 2)) : 0;
2945
-
2946
- const renderBenefitIcon = (icon, benefitsVersion = 'normal') => icon ? (jsx("div", { className: style('sm:w-12 sm:h-12 sm:min-w-12 w-11 h-11 min-w-11 box-border flex items-center justify-center rounded-icon', benefitsVersion === 'normal'
2947
- ? 'bg-secondary-light text-primary-main'
2948
- : 'bg-primary-main text-black group-data-secondary:bg-white/30 group-data-secondary:text-black'), children: jsx(Img, { className: "w-6 h-6", image: { ...icon, iconVersion: icon.iconVersion || benefitsVersion } }) })) : null;
2949
-
2950
- const getHtmlText = (html) => html.replace(/<\/?[^>]+\/?>/g, '').trim();
2951
-
2952
- const RichText = JSX((props) => {
2953
- const { __html = '', richVersion = '' } = props;
2954
- return getHtmlText(__html) ? (jsx("div", { className: style(richVersion, 'md-container'), dangerouslySetInnerHTML: { __html } })) : null;
2955
- });
2956
-
2957
- const renderBenefitDescription = (description, i) => description ? (jsx(Paragraph, { font: "font-light", size: "text-m", color: "text-secondary-text group-data-secondary:text-white", children: description }, `description-${i}`)) : null;
2958
-
2959
- const renderBenefitLabel = (label, i) => label ? (jsx(Text, { color: "text-primary-text group-data-secondary:text-white", size: "text-h6", children: label }, `label-${i}`)) : null;
2960
-
2961
- const renderBenefitText = (_, i) => _.type === 'rte' && '__html' in _ && _.__html ? (jsx(RichText, { ..._ }, `rte-${i}`)) : ([
2962
- 'label' in _ ? renderBenefitLabel(_.label, i) : null,
2963
- 'description' in _ ? (jsx("span", { className: _.descriptionClassName, children: renderBenefitDescription(_.description, i) }, String(i))) : null,
2964
- ]);
2965
-
2966
- const BenefitItem = JSX(({ className, benefitsVersion, ..._ }) => (jsxs("div", { className: style('flex gap-m min-w-56 items-center', className), children: ['icon' in _ ? renderBenefitIcon(_.icon, benefitsVersion) : null, jsx("div", { children: renderBenefitText(_) })] })));
2967
-
2968
- const MAX_BENEFITS_LEN_DEVIATION = 16;
2969
- const benefitLength = (_) => _.type === 'rte'
2970
- ? _?.__html?.length || 0
2971
- : Math.max(_?.label?.length || 0, _?.description?.length || 0);
2972
- const isDistortedBenefits = (benefits) => deviation(benefits.map(benefitLength)) > MAX_BENEFITS_LEN_DEVIATION;
2973
- const hasIcon = (_) => _ && 'icon' in _ && _.icon && (_.icon.icon || _.icon.src);
2974
- const isTextualBenefits = (benefits) => !benefits.some(hasIcon);
2975
- const DefaultBenefitsList = JSX(({ className, benefitsVersion = 'normal', benefits }) => benefits?.length ? (jsx("div", { className: style('flex gap-x-m gap-y-s', isDistortedBenefits(benefits) || isTextualBenefits(benefits) ? 'flex-col' : 'flex-wrap', className), children: benefits.map((_, i) => (jsx(BenefitItem, { benefitsVersion: benefitsVersion, ..._ }, String(i)))) })) : null);
2976
-
2977
- const TabularBenefitsList = JSX(({ className, benefits }) => benefits?.length ? (jsx("div", { className: style('grid grid-cols-[max-content_1fr] auto-rows-auto items-baseline gap-x-m gap-y-xs', className), children: benefits.flatMap(renderBenefitText) })) : null);
2978
-
2979
- const BenefitsList = JSX(({ isTabularBenefits, ...rest }) => isTabularBenefits ? jsx(TabularBenefitsList, { ...rest }) : jsx(DefaultBenefitsList, { ...rest }));
2980
-
2981
- const PriceList = JSX(({ priceList }) => priceList?.length ? (jsx("div", { className: "flex flex-wrap xl:flex-nowrap xl:bg-main-divider xl:rounded-md p-xs gap-xl", children: priceList.map(renderPriceListItem) })) : null);
2982
- const renderPriceListItem = ({ label, amount }) => (jsxs("div", { className: "basis-full flex flex-col-reverse sm:flex-row sm:justify-between sm:bg-main-divider sm:py-m sm:px-lg sm:rounded-md items-baseline whitespace-pre", children: [jsx(Text, { font: "font-light", size: "text-l", color: "text-secondary-text", children: label }), amount ? (jsxs("span", { className: "font-sans text-h6 sm:text-primary-main text-primary-text", children: [toLocalNumberFormat(2)(amount), " \u20BD"] })) : null] }));
2983
-
2984
- const Tags = JSX(({ className, tags }) => tags?.length ? (jsx("div", { className: style('flex flex-wrap gap-xs', className), role: "list", children: tags.map(renderTag) })) : null);
2985
- const renderTag = (tag, key) => (jsx("div", { className: "p-xs border-solid border rounded-md border-gray", role: "listitem", children: jsx(Text, { size: "text-m", font: "font-light", children: tag }) }, String(key)));
2986
-
2987
- const BaseProductTile = JSX(
2988
- // eslint-disable-next-line max-lines-per-function
2989
- ({ className, padding, defaultPadding, title, description, headlineVersion = 'L', align = 'text-left', benefitsVersion, isTabularBenefits, benefits, __html, isFullWidthTitle, items, isDotted = true, priceList = [], listItemSize, tags = [], buttons, image, imageOptions: { imageAlign = 'center', directionRight = true, isImageAlwaysOnRight, isImageSecondary = false, } = {}, backwardButton, children, ...rest }) => {
2990
- const img = image?.src ? jsx(Img, { image: image }) : null;
2991
- const headline = (jsx(Headline, { title: title, description: description, headlineVersion: headlineVersion, align: align, isEmbedded: true }));
2992
- const filteredBenefits = benefits?.filter((_) => _?.type === 'rte' || 'label' in _ || 'description' in _);
2993
- return (jsx(BaseTile, { className: className, padding: padding, defaultPadding: defaultPadding, ...(isFullWidthTitle ? { title: headline } : { insetTitle: headline }), ...leftOrRightImage(img, directionRight), isImageSecondary: isImageSecondary, imageAlign: imageAlign, isImageAlwaysOnRight: isImageAlwaysOnRight, buttons: renderButtonsSection(buttons), backwardButton: backwardButton, ...rest, children: jsxs("div", { className: "flex flex-col sm:gap-xl gap-4xl", children: [filteredBenefits?.length ? (jsx(BenefitsList, { benefitsVersion: benefitsVersion, isTabularBenefits: isTabularBenefits, benefits: filteredBenefits })) : null, __html ? jsx(RichText, { __html: __html }) : null, items?.length ? (jsx(List, { items: items, isDotted: isDotted, listItemSize: listItemSize })) : null, children, priceList?.length ? jsx(PriceList, { priceList: priceList }) : null, renderTags(tags)] }) }));
2994
- });
2995
- const leftOrRightImage = (img, directionRight) => directionRight ? { rightImage: img } : { leftImage: img };
2996
- const renderTags = (tags) => (tags?.length ? jsx(Tags, { tags: tags }) : null);
2997
-
2998
3017
  const LinkWrapper = JSX(({ className = '', href, target, isRemote = false, children }) => {
2999
3018
  const link = useLink({ isRemote });
3000
3019
  const linkProps = link({ href, target });
@@ -3093,7 +3112,7 @@
3093
3112
  const HeaderCell = JSX(({ icon, image, title, subtitle, isFillGradient }) => (jsxs("div", { className: "space-y-4", role: "columnheader", children: [icon ? (jsx(Img, { className: "h-16 w-16 min-w-16 min-h-16", image: icon, width: "64", height: "64" })) : null, image?.src && (jsx("div", { children: jsx(Img, { image: image }) })), title ? (jsx(Heading, { headingType: "h4", className: headingStyle(isFillGradient), title: title })) : null, subtitle ? jsx("div", { className: subtitleStyle(isFillGradient), children: subtitle }) : null] })));
3094
3113
 
3095
3114
  const cellWrapperStyle = `box-border flex flex-col`;
3096
- const TableCell = JSX(({ cell, rowHeader, isFillGradient = false }) => (jsx("div", { className: cellWrapperStyle, role: "cell", children: jsx("div", { className: style('h-full', dividerStyle$1), children: cell.map(renderCellInner(isFillGradient, rowHeader)) }) })));
3115
+ const TableCell = JSX(({ cell, rowHeader, isFillGradient = false }) => (jsx("div", { className: cellWrapperStyle, role: "cell", children: jsx("div", { className: style('h-full', dividerStyle$1), children: cell ? cell.map(renderCellInner(isFillGradient, rowHeader)) : null }) })));
3097
3116
  const renderCellInner = (isFillGradient, rowHeader) => ({ label, description }, i) => (jsxs("div", { className: "flex justify-between text-s py-s", children: [jsx("div", { className: `${isFillGradient ? 'text-white/80' : 'text-secondary-text'}`, children: rowHeader }), jsxs("div", { className: "basis-1/2", children: [label ? (jsx("div", { className: style('text-right', isFillGradient ? 'text-white' : ''), children: label })) : null, description ? (jsx("div", { className: style('text-right', isFillGradient ? 'text-white/80' : 'text-secondary-text'), children: description })) : null] })] }, String(i)));
3098
3117
 
3099
3118
  const TableColumn = JSX(({ header, columnData, visibleRowLength = 0, isFillGradient, showRow, onToggleColumn }) => {
@@ -3122,6 +3141,8 @@
3122
3141
  return orientation === 'horizontal' ? (jsx(SwipeListControl, { onVisibleIndicesChange: handleSlideChange, children: tableColumns })) : (tableColumns);
3123
3142
  });
3124
3143
 
3144
+ const isOdd = (n) => n % 2 !== 0;
3145
+
3125
3146
  const TextWithIcon = JSX(({ textNode, iconNode, tag, onClick, justifyContent = 'between', className, ...rest }) => {
3126
3147
  const Tag = tag;
3127
3148
  return (jsxs(Tag, { tag: tag, className: style('flex items-center w-full gap-1', justifyContent === 'between' ? 'justify-between' : 'justify-center', className), onClick: onClick, ...rest, children: [textNode ? jsx("div", { children: textNode }) : null, iconNode ? jsx("div", { children: iconNode }) : null] }));
@@ -3147,8 +3168,8 @@
3147
3168
  const [visibleBlocks, hiddenBlocks] = topItemsCount > 0
3148
3169
  ? [blocksToRender.slice(0, topItemsCount), blocksToRender.slice(topItemsCount)]
3149
3170
  : [blocksToRender, []];
3150
- return (jsxs("div", { children: [jsx("div", { className: style(blocksToRender.length ? 'hidden' : 'block'), children: notFound ? jsx(NotFound, { ...notFound }) : null }), jsxs("div", { className: style('space-y-2xs', blocksToRender.length ? '' : 'hidden'), children: [jsx("div", { className: style(resultsGridStyle), children: renderBlocksList(visibleBlocks, { ...rest.options, parent: block }) }), jsx(Foldable, { renderFoldableSection: ({ isUnfolded }) => {
3151
- return (jsx(FoldableSection, { className: style(resultsGridStyle), isUnfolded: isUnfolded, children: renderBlocksList(hiddenBlocks, { ...rest.options, parent: block }) }));
3171
+ return (jsxs("div", { children: [jsx("div", { className: style(blocksToRender.length ? 'hidden' : 'block'), children: notFound ? jsx(NotFound, { ...notFound }) : null }), jsxs("div", { className: style('space-y-2xs', blocksToRender.length ? '' : 'hidden'), children: [jsxs("div", { className: style(resultsGridStyle), children: [renderBlocksList(visibleBlocks, { ...rest.options, parent: block }), isOdd(visibleBlocks.length) ? jsx(AdTile, { className: "col-span-6" }) : null] }), jsx(Foldable, { renderFoldableSection: ({ isUnfolded }) => {
3172
+ return (jsxs(FoldableSection, { className: style(resultsGridStyle), isUnfolded: isUnfolded, children: [renderBlocksList(hiddenBlocks, { ...rest.options, parent: block }), isOdd(hiddenBlocks.length) ? jsx(AdTile, { className: "col-span-6" }) : null] }));
3152
3173
  }, renderFoldButton: ({ isUnfolded, onToggle }) => (jsx(DefaultFoldButton, { className: style(topItemsCount < 1 ? 'hidden' : ''), disabled: !hiddenBlocks?.length, label: label, icon: ICONS[Number(isUnfolded)], dataTheme: rest.options?.page?.colorPalette, onClick: onToggle })) })] })] }));
3153
3174
  });
3154
3175
 
@@ -3634,7 +3655,7 @@
3634
3655
  const VerticalLayout = JSX(({ className = '', gap = '', isPadding = false, isInnerPadding = true, version = 'transparent', isTheme = false, isInnerBorder = false, ...rest }) => (jsx(BlockWrapper, { className: style('relative flex flex-col', gapStyles[gap], className), defaultPadding: isPadding ? 'p-6xl' : '', version: version, isTheme: isTheme, ...rest, children: renderChildren({
3635
3656
  ...rest,
3636
3657
  extraProps: {
3637
- className: style('w-full', getBorderStyle(isInnerBorder)),
3658
+ className: style('w-full', getBorderStyle$1(isInnerBorder)),
3638
3659
  padding: isInnerPadding ? '' : 'p-0',
3639
3660
  },
3640
3661
  }) })));
@@ -3855,11 +3876,6 @@
3855
3876
  }
3856
3877
  };
3857
3878
 
3858
- const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
3859
-
3860
- const isClient = !isSSR();
3861
- const ClientOnly = JSX(({ children }) => (isClient ? children : null));
3862
-
3863
3879
  function renderClusterer(yandexMaps, map, points) {
3864
3880
  map.geoObjects.removeAll();
3865
3881
  const clusterIconContentLayout = yandexMaps.templateLayoutFactory.createClass('<div style="margin-top: -3px;">{{properties.geoObjects.length}}</div>');
@@ -4312,8 +4328,6 @@
4312
4328
  const renderShimmerItem = (width, index) => (jsx("div", { style: { width: `${width || 100}%` }, className: "h-4 mt-xs bg-secondary-light" }, String(index)));
4313
4329
  const goldenSequence = (first, size) => [first].concat(size > 0 ? goldenSequence(first / GOLDEN_RATIO, size - 1) : []);
4314
4330
 
4315
- const ProductBlock = JSX(({ className, padding, showBorder, ...rest }) => (jsx(BlockWrapper, { className: style('overflow-hidden flex flex-col gap-3xl box-border', getBorderStyle(showBorder), className), padding: "p-0", ...rest, children: jsx(BaseProductTile, { defaultPadding: "p-6xl", padding: padding, className: "grow h-full", ...rest }) })));
4316
-
4317
4331
  const ProductGallery = JSX(({ className, padding, slides = [], ...rest }) => (jsx(BlockWrapper, { className: style('overflow-hidden relative', className), padding: padding, ...rest, children: jsx(SwipeListControl, { gap: 0, padding: 0, children: slides
4318
4332
  .map((s) => s.productBlock)
4319
4333
  .map((_, i) => (jsx("div", { className: "box-border h-full", children: jsx(BaseProductTile, { className: "px-5 h-full", headlineVersion: "L", ..._, ...rest }) }, String(i)))) }) })));
@@ -5207,6 +5221,7 @@
5207
5221
  };
5208
5222
 
5209
5223
  const Blocks = {
5224
+ AdTile,
5210
5225
  ApplicationForm,
5211
5226
  BenefitsBlock,
5212
5227
  Bonus,
@@ -5439,7 +5454,7 @@
5439
5454
 
5440
5455
  const joinList = (sep) => (list) => list.reduce((acc, el, i) => (acc.length ? acc.concat({ ...sep, key: `sep-${i}` }, el) : [el]), []);
5441
5456
 
5442
- const packageVersion = "0.14.56";
5457
+ const packageVersion = "0.14.58";
5443
5458
 
5444
5459
  exports.Blocks = Blocks;
5445
5460
  exports.ContentPage = ContentPage;