@mantine/lightbox 9.5.2

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 (116) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +21 -0
  3. package/cjs/Lightbox.cjs +56 -0
  4. package/cjs/Lightbox.cjs.map +1 -0
  5. package/cjs/Lightbox.module.cjs +30 -0
  6. package/cjs/Lightbox.module.cjs.map +1 -0
  7. package/cjs/LightboxCaption/LightboxCaption.cjs +30 -0
  8. package/cjs/LightboxCaption/LightboxCaption.cjs.map +1 -0
  9. package/cjs/LightboxCloseButton/LightboxCloseButton.cjs +32 -0
  10. package/cjs/LightboxCloseButton/LightboxCloseButton.cjs.map +1 -0
  11. package/cjs/LightboxNavigation/LightboxNavigation.cjs +105 -0
  12. package/cjs/LightboxNavigation/LightboxNavigation.cjs.map +1 -0
  13. package/cjs/LightboxProvider/LightboxProvider.cjs +29 -0
  14. package/cjs/LightboxProvider/LightboxProvider.cjs.map +1 -0
  15. package/cjs/LightboxRoot/LightboxRoot.cjs +407 -0
  16. package/cjs/LightboxRoot/LightboxRoot.cjs.map +1 -0
  17. package/cjs/LightboxSlide/ImageSlide.cjs +27 -0
  18. package/cjs/LightboxSlide/ImageSlide.cjs.map +1 -0
  19. package/cjs/LightboxSlide/LightboxSlide.cjs +55 -0
  20. package/cjs/LightboxSlide/LightboxSlide.cjs.map +1 -0
  21. package/cjs/LightboxSlide/VideoSlide.cjs +42 -0
  22. package/cjs/LightboxSlide/VideoSlide.cjs.map +1 -0
  23. package/cjs/LightboxSlides/LightboxSlides.cjs +56 -0
  24. package/cjs/LightboxSlides/LightboxSlides.cjs.map +1 -0
  25. package/cjs/LightboxThumbnails/LightboxThumbnails.cjs +74 -0
  26. package/cjs/LightboxThumbnails/LightboxThumbnails.cjs.map +1 -0
  27. package/cjs/LightboxToolbar/LightboxToolbar.cjs +80 -0
  28. package/cjs/LightboxToolbar/LightboxToolbar.cjs.map +1 -0
  29. package/cjs/LightboxToolbar/toolbar-items.cjs +156 -0
  30. package/cjs/LightboxToolbar/toolbar-items.cjs.map +1 -0
  31. package/cjs/_virtual/_rolldown/runtime.cjs +24 -0
  32. package/cjs/default-labels.cjs +20 -0
  33. package/cjs/default-labels.cjs.map +1 -0
  34. package/cjs/hooks/use-lightbox-keyboard.cjs +107 -0
  35. package/cjs/hooks/use-lightbox-keyboard.cjs.map +1 -0
  36. package/cjs/hooks/use-lightbox-lock-scroll.cjs +30 -0
  37. package/cjs/hooks/use-lightbox-lock-scroll.cjs.map +1 -0
  38. package/cjs/hooks/use-lightbox-swipe-close.cjs +38 -0
  39. package/cjs/hooks/use-lightbox-swipe-close.cjs.map +1 -0
  40. package/cjs/hooks/use-lightbox-zoom.cjs +257 -0
  41. package/cjs/hooks/use-lightbox-zoom.cjs.map +1 -0
  42. package/cjs/index.cjs +34 -0
  43. package/cjs/lightbox.context.cjs +8 -0
  44. package/cjs/lightbox.context.cjs.map +1 -0
  45. package/cjs/lightbox.store.cjs +90 -0
  46. package/cjs/lightbox.store.cjs.map +1 -0
  47. package/esm/Lightbox.mjs +56 -0
  48. package/esm/Lightbox.mjs.map +1 -0
  49. package/esm/Lightbox.module.mjs +30 -0
  50. package/esm/Lightbox.module.mjs.map +1 -0
  51. package/esm/LightboxCaption/LightboxCaption.mjs +30 -0
  52. package/esm/LightboxCaption/LightboxCaption.mjs.map +1 -0
  53. package/esm/LightboxCloseButton/LightboxCloseButton.mjs +32 -0
  54. package/esm/LightboxCloseButton/LightboxCloseButton.mjs.map +1 -0
  55. package/esm/LightboxNavigation/LightboxNavigation.mjs +105 -0
  56. package/esm/LightboxNavigation/LightboxNavigation.mjs.map +1 -0
  57. package/esm/LightboxProvider/LightboxProvider.mjs +29 -0
  58. package/esm/LightboxProvider/LightboxProvider.mjs.map +1 -0
  59. package/esm/LightboxRoot/LightboxRoot.mjs +404 -0
  60. package/esm/LightboxRoot/LightboxRoot.mjs.map +1 -0
  61. package/esm/LightboxSlide/ImageSlide.mjs +27 -0
  62. package/esm/LightboxSlide/ImageSlide.mjs.map +1 -0
  63. package/esm/LightboxSlide/LightboxSlide.mjs +55 -0
  64. package/esm/LightboxSlide/LightboxSlide.mjs.map +1 -0
  65. package/esm/LightboxSlide/VideoSlide.mjs +42 -0
  66. package/esm/LightboxSlide/VideoSlide.mjs.map +1 -0
  67. package/esm/LightboxSlides/LightboxSlides.mjs +56 -0
  68. package/esm/LightboxSlides/LightboxSlides.mjs.map +1 -0
  69. package/esm/LightboxThumbnails/LightboxThumbnails.mjs +72 -0
  70. package/esm/LightboxThumbnails/LightboxThumbnails.mjs.map +1 -0
  71. package/esm/LightboxToolbar/LightboxToolbar.mjs +80 -0
  72. package/esm/LightboxToolbar/LightboxToolbar.mjs.map +1 -0
  73. package/esm/LightboxToolbar/toolbar-items.mjs +153 -0
  74. package/esm/LightboxToolbar/toolbar-items.mjs.map +1 -0
  75. package/esm/default-labels.mjs +20 -0
  76. package/esm/default-labels.mjs.map +1 -0
  77. package/esm/hooks/use-lightbox-keyboard.mjs +107 -0
  78. package/esm/hooks/use-lightbox-keyboard.mjs.map +1 -0
  79. package/esm/hooks/use-lightbox-lock-scroll.mjs +30 -0
  80. package/esm/hooks/use-lightbox-lock-scroll.mjs.map +1 -0
  81. package/esm/hooks/use-lightbox-swipe-close.mjs +38 -0
  82. package/esm/hooks/use-lightbox-swipe-close.mjs.map +1 -0
  83. package/esm/hooks/use-lightbox-zoom.mjs +257 -0
  84. package/esm/hooks/use-lightbox-zoom.mjs.map +1 -0
  85. package/esm/index.mjs +14 -0
  86. package/esm/lightbox.context.mjs +8 -0
  87. package/esm/lightbox.context.mjs.map +1 -0
  88. package/esm/lightbox.store.mjs +79 -0
  89. package/esm/lightbox.store.mjs.map +1 -0
  90. package/lib/Lightbox.d.ts +63 -0
  91. package/lib/LightboxCaption/LightboxCaption.d.ts +18 -0
  92. package/lib/LightboxCloseButton/LightboxCloseButton.d.ts +16 -0
  93. package/lib/LightboxNavigation/LightboxNavigation.d.ts +16 -0
  94. package/lib/LightboxProvider/LightboxProvider.d.ts +19 -0
  95. package/lib/LightboxRoot/LightboxRoot.d.ts +88 -0
  96. package/lib/LightboxSlide/ImageSlide.d.ts +12 -0
  97. package/lib/LightboxSlide/LightboxSlide.d.ts +25 -0
  98. package/lib/LightboxSlide/VideoSlide.d.ts +12 -0
  99. package/lib/LightboxSlides/LightboxSlides.d.ts +20 -0
  100. package/lib/LightboxThumbnails/LightboxThumbnails.d.ts +16 -0
  101. package/lib/LightboxToolbar/LightboxToolbar.d.ts +19 -0
  102. package/lib/LightboxToolbar/toolbar-items.d.ts +5 -0
  103. package/lib/default-labels.d.ts +2 -0
  104. package/lib/hooks/use-lightbox-keyboard.d.ts +15 -0
  105. package/lib/hooks/use-lightbox-lock-scroll.d.ts +7 -0
  106. package/lib/hooks/use-lightbox-swipe-close.d.ts +10 -0
  107. package/lib/hooks/use-lightbox-zoom.d.ts +33 -0
  108. package/lib/index.d.mts +67 -0
  109. package/lib/index.d.ts +67 -0
  110. package/lib/lightbox.context.d.ts +36 -0
  111. package/lib/lightbox.store.d.ts +66 -0
  112. package/lib/lightbox.types.d.ts +131 -0
  113. package/lib/test-utils.d.ts +7 -0
  114. package/package.json +63 -0
  115. package/styles.css +262 -0
  116. package/styles.layer.css +263 -0
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import { useLightboxContext } from "../lightbox.context.mjs";
3
+ import Lightbox_module_default from "../Lightbox.module.mjs";
4
+ import { CloseButton, factory, useProps } from "@mantine/core";
5
+ import { jsx } from "react/jsx-runtime";
6
+ //#region packages/@mantine/lightbox/src/LightboxCloseButton/LightboxCloseButton.tsx
7
+ const LightboxCloseButton = factory((props) => {
8
+ const { classNames, className, style, styles, vars, onClick, ...others } = useProps("LightboxCloseButton", null, props);
9
+ const ctx = useLightboxContext();
10
+ return /* @__PURE__ */ jsx(CloseButton, {
11
+ ...ctx.getStyles("closeButton", {
12
+ className,
13
+ style,
14
+ classNames,
15
+ styles
16
+ }),
17
+ "aria-label": ctx.labels.closeLabel,
18
+ variant: "subtle",
19
+ size: "lg",
20
+ ...others,
21
+ onClick: (event) => {
22
+ onClick?.(event);
23
+ ctx.onClose();
24
+ }
25
+ });
26
+ });
27
+ LightboxCloseButton.classes = Lightbox_module_default;
28
+ LightboxCloseButton.displayName = "@mantine/lightbox/LightboxCloseButton";
29
+ //#endregion
30
+ export { LightboxCloseButton };
31
+
32
+ //# sourceMappingURL=LightboxCloseButton.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LightboxCloseButton.mjs","names":["classes"],"sources":["../../src/LightboxCloseButton/LightboxCloseButton.tsx"],"sourcesContent":["import {\n BoxProps,\n CloseButton,\n CompoundStylesApiProps,\n ElementProps,\n factory,\n Factory,\n useProps,\n} from '@mantine/core';\nimport { useLightboxContext } from '../lightbox.context';\nimport classes from '../Lightbox.module.css';\n\nexport type LightboxCloseButtonStylesNames = 'closeButton';\n\nexport interface LightboxCloseButtonProps\n extends BoxProps, CompoundStylesApiProps<LightboxCloseButtonFactory>, ElementProps<'button'> {}\n\nexport type LightboxCloseButtonFactory = Factory<{\n props: LightboxCloseButtonProps;\n ref: HTMLButtonElement;\n stylesNames: LightboxCloseButtonStylesNames;\n compound: true;\n}>;\n\nexport const LightboxCloseButton = factory<LightboxCloseButtonFactory>((props) => {\n const { classNames, className, style, styles, vars, onClick, ...others } = useProps(\n 'LightboxCloseButton',\n null,\n props\n );\n\n const ctx = useLightboxContext();\n\n return (\n <CloseButton\n {...ctx.getStyles('closeButton', { className, style, classNames, styles })}\n aria-label={ctx.labels.closeLabel}\n variant=\"subtle\"\n size=\"lg\"\n {...others}\n onClick={(event) => {\n onClick?.(event);\n ctx.onClose();\n }}\n />\n );\n});\n\nLightboxCloseButton.classes = classes;\nLightboxCloseButton.displayName = '@mantine/lightbox/LightboxCloseButton';\n"],"mappings":";;;;;;AAwBA,MAAa,sBAAsB,SAAqC,UAAU;CAChF,MAAM,EAAE,YAAY,WAAW,OAAO,QAAQ,MAAM,SAAS,GAAG,WAAW,SACzE,uBACA,MACA,KACF;CAEA,MAAM,MAAM,mBAAmB;CAE/B,OACE,oBAAC,aAAD;EACE,GAAI,IAAI,UAAU,eAAe;GAAE;GAAW;GAAO;GAAY;EAAO,CAAC;EACzE,cAAY,IAAI,OAAO;EACvB,SAAQ;EACR,MAAK;EACL,GAAI;EACJ,UAAU,UAAU;GAClB,UAAU,KAAK;GACf,IAAI,QAAQ;EACd;CACD,CAAA;AAEL,CAAC;AAED,oBAAoB,UAAUA;AAC9B,oBAAoB,cAAc"}
@@ -0,0 +1,105 @@
1
+ "use client";
2
+ import { useLightboxContext } from "../lightbox.context.mjs";
3
+ import Lightbox_module_default from "../Lightbox.module.mjs";
4
+ import { Box, UnstyledButton, factory, useDirection, useProps } from "@mantine/core";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { useEffect, useState } from "react";
7
+ //#region packages/@mantine/lightbox/src/LightboxNavigation/LightboxNavigation.tsx
8
+ function ChevronLeft() {
9
+ return /* @__PURE__ */ jsx("svg", {
10
+ xmlns: "http://www.w3.org/2000/svg",
11
+ viewBox: "0 0 24 24",
12
+ width: "36",
13
+ height: "36",
14
+ fill: "none",
15
+ stroke: "currentColor",
16
+ strokeWidth: "2",
17
+ strokeLinecap: "round",
18
+ strokeLinejoin: "round",
19
+ children: /* @__PURE__ */ jsx("polyline", { points: "15 18 9 12 15 6" })
20
+ });
21
+ }
22
+ function ChevronRight() {
23
+ return /* @__PURE__ */ jsx("svg", {
24
+ xmlns: "http://www.w3.org/2000/svg",
25
+ viewBox: "0 0 24 24",
26
+ width: "36",
27
+ height: "36",
28
+ fill: "none",
29
+ stroke: "currentColor",
30
+ strokeWidth: "2",
31
+ strokeLinecap: "round",
32
+ strokeLinejoin: "round",
33
+ children: /* @__PURE__ */ jsx("polyline", { points: "9 18 15 12 9 6" })
34
+ });
35
+ }
36
+ const LightboxNavigation = factory((props) => {
37
+ const { classNames, className, style, styles, vars, ...others } = useProps("LightboxNavigation", null, props);
38
+ const ctx = useLightboxContext();
39
+ const stylesApiProps = {
40
+ classNames,
41
+ styles
42
+ };
43
+ const { dir } = useDirection();
44
+ const PrevIcon = dir === "rtl" ? ChevronRight : ChevronLeft;
45
+ const NextIcon = dir === "rtl" ? ChevronLeft : ChevronRight;
46
+ const fallbackCanPrev = ctx.loop ? ctx.slides.length > 1 : ctx.currentIndex > 0;
47
+ const fallbackCanNext = ctx.loop ? ctx.slides.length > 1 : ctx.currentIndex < ctx.slides.length - 1;
48
+ const [scrollState, setScrollState] = useState(null);
49
+ const { embla } = ctx;
50
+ useEffect(() => {
51
+ if (!embla) {
52
+ setScrollState(null);
53
+ return;
54
+ }
55
+ const update = () => setScrollState({
56
+ canPrev: embla.canScrollPrev(),
57
+ canNext: embla.canScrollNext()
58
+ });
59
+ update();
60
+ embla.on("select", update);
61
+ embla.on("reInit", update);
62
+ embla.on("settle", update);
63
+ return () => {
64
+ embla.off("select", update);
65
+ embla.off("reInit", update);
66
+ embla.off("settle", update);
67
+ };
68
+ }, [embla]);
69
+ const canPrev = scrollState ? scrollState.canPrev : fallbackCanPrev;
70
+ const canNext = scrollState ? scrollState.canNext : fallbackCanNext;
71
+ return /* @__PURE__ */ jsxs(Box, {
72
+ ...ctx.getStyles("navigation", {
73
+ className,
74
+ style,
75
+ classNames,
76
+ styles
77
+ }),
78
+ ...others,
79
+ children: [/* @__PURE__ */ jsx(UnstyledButton, {
80
+ ...ctx.getStyles("navigationButton", stylesApiProps),
81
+ "aria-label": ctx.labels.previousSlideLabel,
82
+ "aria-disabled": !canPrev || void 0,
83
+ "data-inactive": !canPrev || void 0,
84
+ mod: "reduce-motion",
85
+ tabIndex: canPrev ? 0 : -1,
86
+ onClick: ctx.prev,
87
+ children: /* @__PURE__ */ jsx(PrevIcon, {})
88
+ }), /* @__PURE__ */ jsx(UnstyledButton, {
89
+ ...ctx.getStyles("navigationButton", stylesApiProps),
90
+ "aria-label": ctx.labels.nextSlideLabel,
91
+ "aria-disabled": !canNext || void 0,
92
+ "data-inactive": !canNext || void 0,
93
+ mod: "reduce-motion",
94
+ tabIndex: canNext ? 0 : -1,
95
+ onClick: ctx.next,
96
+ children: /* @__PURE__ */ jsx(NextIcon, {})
97
+ })]
98
+ });
99
+ });
100
+ LightboxNavigation.classes = Lightbox_module_default;
101
+ LightboxNavigation.displayName = "@mantine/lightbox/LightboxNavigation";
102
+ //#endregion
103
+ export { LightboxNavigation };
104
+
105
+ //# sourceMappingURL=LightboxNavigation.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LightboxNavigation.mjs","names":["classes"],"sources":["../../src/LightboxNavigation/LightboxNavigation.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport {\n Box,\n BoxProps,\n CompoundStylesApiProps,\n ElementProps,\n factory,\n Factory,\n UnstyledButton,\n useDirection,\n useProps,\n} from '@mantine/core';\nimport { useLightboxContext } from '../lightbox.context';\nimport classes from '../Lightbox.module.css';\n\nexport type LightboxNavigationStylesNames = 'navigation' | 'navigationButton';\n\nexport interface LightboxNavigationProps\n extends BoxProps, CompoundStylesApiProps<LightboxNavigationFactory>, ElementProps<'div'> {}\n\nexport type LightboxNavigationFactory = Factory<{\n props: LightboxNavigationProps;\n ref: HTMLDivElement;\n stylesNames: LightboxNavigationStylesNames;\n compound: true;\n}>;\n\nfunction ChevronLeft() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n width=\"36\"\n height=\"36\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <polyline points=\"15 18 9 12 15 6\" />\n </svg>\n );\n}\n\nfunction ChevronRight() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n width=\"36\"\n height=\"36\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <polyline points=\"9 18 15 12 9 6\" />\n </svg>\n );\n}\n\nexport const LightboxNavigation = factory<LightboxNavigationFactory>((props) => {\n const { classNames, className, style, styles, vars, ...others } = useProps(\n 'LightboxNavigation',\n null,\n props\n );\n\n const ctx = useLightboxContext();\n const stylesApiProps = { classNames, styles };\n const { dir } = useDirection();\n\n // Embla is direction-aware, so \"previous\" is the leading edge of the reading direction –\n // the chevrons have to follow it rather than always pointing left/right.\n const PrevIcon = dir === 'rtl' ? ChevronRight : ChevronLeft;\n const NextIcon = dir === 'rtl' ? ChevronLeft : ChevronRight;\n\n const fallbackCanPrev = ctx.loop ? ctx.slides.length > 1 : ctx.currentIndex > 0;\n const fallbackCanNext = ctx.loop\n ? ctx.slides.length > 1\n : ctx.currentIndex < ctx.slides.length - 1;\n\n const [scrollState, setScrollState] = useState<{ canPrev: boolean; canNext: boolean } | null>(\n null\n );\n\n const { embla } = ctx;\n\n useEffect(() => {\n if (!embla) {\n setScrollState(null);\n return undefined;\n }\n\n const update = () =>\n setScrollState({ canPrev: embla.canScrollPrev(), canNext: embla.canScrollNext() });\n\n update();\n embla.on('select', update);\n embla.on('reInit', update);\n embla.on('settle', update);\n\n return () => {\n embla.off('select', update);\n embla.off('reInit', update);\n embla.off('settle', update);\n };\n }, [embla]);\n\n const canPrev = scrollState ? scrollState.canPrev : fallbackCanPrev;\n const canNext = scrollState ? scrollState.canNext : fallbackCanNext;\n\n return (\n <Box {...ctx.getStyles('navigation', { className, style, classNames, styles })} {...others}>\n <UnstyledButton\n {...ctx.getStyles('navigationButton', stylesApiProps)}\n aria-label={ctx.labels.previousSlideLabel}\n aria-disabled={!canPrev || undefined}\n data-inactive={!canPrev || undefined}\n mod=\"reduce-motion\"\n tabIndex={canPrev ? 0 : -1}\n onClick={ctx.prev}\n >\n <PrevIcon />\n </UnstyledButton>\n\n <UnstyledButton\n {...ctx.getStyles('navigationButton', stylesApiProps)}\n aria-label={ctx.labels.nextSlideLabel}\n aria-disabled={!canNext || undefined}\n data-inactive={!canNext || undefined}\n mod=\"reduce-motion\"\n tabIndex={canNext ? 0 : -1}\n onClick={ctx.next}\n >\n <NextIcon />\n </UnstyledButton>\n </Box>\n );\n});\n\nLightboxNavigation.classes = classes;\nLightboxNavigation.displayName = '@mantine/lightbox/LightboxNavigation';\n"],"mappings":";;;;;;;AA2BA,SAAS,cAAc;CACrB,OACE,oBAAC,OAAD;EACE,OAAM;EACN,SAAQ;EACR,OAAM;EACN,QAAO;EACP,MAAK;EACL,QAAO;EACP,aAAY;EACZ,eAAc;EACd,gBAAe;EAEf,UAAA,oBAAC,YAAD,EAAU,QAAO,kBAAmB,CAAA;CACjC,CAAA;AAET;AAEA,SAAS,eAAe;CACtB,OACE,oBAAC,OAAD;EACE,OAAM;EACN,SAAQ;EACR,OAAM;EACN,QAAO;EACP,MAAK;EACL,QAAO;EACP,aAAY;EACZ,eAAc;EACd,gBAAe;EAEf,UAAA,oBAAC,YAAD,EAAU,QAAO,iBAAkB,CAAA;CAChC,CAAA;AAET;AAEA,MAAa,qBAAqB,SAAoC,UAAU;CAC9E,MAAM,EAAE,YAAY,WAAW,OAAO,QAAQ,MAAM,GAAG,WAAW,SAChE,sBACA,MACA,KACF;CAEA,MAAM,MAAM,mBAAmB;CAC/B,MAAM,iBAAiB;EAAE;EAAY;CAAO;CAC5C,MAAM,EAAE,QAAQ,aAAa;CAI7B,MAAM,WAAW,QAAQ,QAAQ,eAAe;CAChD,MAAM,WAAW,QAAQ,QAAQ,cAAc;CAE/C,MAAM,kBAAkB,IAAI,OAAO,IAAI,OAAO,SAAS,IAAI,IAAI,eAAe;CAC9E,MAAM,kBAAkB,IAAI,OACxB,IAAI,OAAO,SAAS,IACpB,IAAI,eAAe,IAAI,OAAO,SAAS;CAE3C,MAAM,CAAC,aAAa,kBAAkB,SACpC,IACF;CAEA,MAAM,EAAE,UAAU;CAElB,gBAAgB;EACd,IAAI,CAAC,OAAO;GACV,eAAe,IAAI;GACnB;EACF;EAEA,MAAM,eACJ,eAAe;GAAE,SAAS,MAAM,cAAc;GAAG,SAAS,MAAM,cAAc;EAAE,CAAC;EAEnF,OAAO;EACP,MAAM,GAAG,UAAU,MAAM;EACzB,MAAM,GAAG,UAAU,MAAM;EACzB,MAAM,GAAG,UAAU,MAAM;EAEzB,aAAa;GACX,MAAM,IAAI,UAAU,MAAM;GAC1B,MAAM,IAAI,UAAU,MAAM;GAC1B,MAAM,IAAI,UAAU,MAAM;EAC5B;CACF,GAAG,CAAC,KAAK,CAAC;CAEV,MAAM,UAAU,cAAc,YAAY,UAAU;CACpD,MAAM,UAAU,cAAc,YAAY,UAAU;CAEpD,OACE,qBAAC,KAAD;EAAK,GAAI,IAAI,UAAU,cAAc;GAAE;GAAW;GAAO;GAAY;EAAO,CAAC;EAAG,GAAI;EAApF,UAAA,CACE,oBAAC,gBAAD;GACE,GAAI,IAAI,UAAU,oBAAoB,cAAc;GACpD,cAAY,IAAI,OAAO;GACvB,iBAAe,CAAC,WAAW,KAAA;GAC3B,iBAAe,CAAC,WAAW,KAAA;GAC3B,KAAI;GACJ,UAAU,UAAU,IAAI;GACxB,SAAS,IAAI;GAEb,UAAA,oBAAC,UAAD,CAAW,CAAA;EACG,CAAA,GAEhB,oBAAC,gBAAD;GACE,GAAI,IAAI,UAAU,oBAAoB,cAAc;GACpD,cAAY,IAAI,OAAO;GACvB,iBAAe,CAAC,WAAW,KAAA;GAC3B,iBAAe,CAAC,WAAW,KAAA;GAC3B,KAAI;GACJ,UAAU,UAAU,IAAI;GACxB,SAAS,IAAI;GAEb,UAAA,oBAAC,UAAD,CAAW,CAAA;EACG,CAAA,CACb;;AAET,CAAC;AAED,mBAAmB,UAAUA;AAC7B,mBAAmB,cAAc"}
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { lightboxActions, lightboxStore, useLightboxStore } from "../lightbox.store.mjs";
3
+ import { Lightbox } from "../Lightbox.mjs";
4
+ import { factory, useProps } from "@mantine/core";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { useEffect } from "react";
7
+ //#region packages/@mantine/lightbox/src/LightboxProvider/LightboxProvider.tsx
8
+ const defaultProps = { store: lightboxStore };
9
+ const LightboxProviderComponent = factory((_props) => {
10
+ const { store, loop, ...others } = useProps("LightboxProvider", defaultProps, _props);
11
+ const state = useLightboxStore(store);
12
+ useEffect(() => {
13
+ if (store.getState().loop !== !!loop) lightboxActions.updateState(() => ({ loop: !!loop }), store);
14
+ }, [loop, store]);
15
+ return /* @__PURE__ */ jsx(Lightbox, {
16
+ ...others,
17
+ loop,
18
+ opened: state.opened,
19
+ onClose: () => lightboxActions.close(store),
20
+ slides: state.slides,
21
+ currentIndex: state.currentIndex,
22
+ onIndexChange: (index) => lightboxActions.setIndex(index, store)
23
+ });
24
+ });
25
+ LightboxProviderComponent.displayName = "@mantine/lightbox/LightboxProvider";
26
+ //#endregion
27
+ export { LightboxProviderComponent };
28
+
29
+ //# sourceMappingURL=LightboxProvider.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LightboxProvider.mjs","names":[],"sources":["../../src/LightboxProvider/LightboxProvider.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { factory, Factory, useProps } from '@mantine/core';\nimport { Lightbox, LightboxProps } from '../Lightbox';\nimport { lightboxActions, LightboxStore, lightboxStore, useLightboxStore } from '../lightbox.store';\n\nexport interface LightboxProviderProps extends Omit<\n LightboxProps,\n 'opened' | 'onClose' | 'slides' | 'currentIndex' | 'onIndexChange'\n> {\n /** Lightbox store, can be used to create multiple instances @default lightboxStore */\n store?: LightboxStore;\n}\n\nexport type LightboxProviderFactory = Factory<{\n props: LightboxProviderProps;\n ref: HTMLDivElement;\n stylesNames: never;\n compound: true;\n}>;\n\nconst defaultProps = {\n store: lightboxStore,\n} satisfies Partial<LightboxProviderProps>;\n\nexport const LightboxProviderComponent = factory<LightboxProviderFactory>((_props) => {\n const props = useProps('LightboxProvider', defaultProps, _props);\n const { store, loop, ...others } = props;\n\n const state = useLightboxStore(store!);\n\n useEffect(() => {\n if (store!.getState().loop !== !!loop) {\n lightboxActions.updateState(() => ({ loop: !!loop }), store!);\n }\n }, [loop, store]);\n\n return (\n <Lightbox\n {...others}\n loop={loop}\n opened={state.opened}\n onClose={() => lightboxActions.close(store!)}\n slides={state.slides}\n currentIndex={state.currentIndex}\n onIndexChange={(index) => lightboxActions.setIndex(index, store!)}\n />\n );\n});\n\nLightboxProviderComponent.displayName = '@mantine/lightbox/LightboxProvider';\n"],"mappings":";;;;;;;AAoBA,MAAM,eAAe,EACnB,OAAO,cACT;AAEA,MAAa,4BAA4B,SAAkC,WAAW;CAEpF,MAAM,EAAE,OAAO,MAAM,GAAG,WADV,SAAS,oBAAoB,cAAc,MAClB;CAEvC,MAAM,QAAQ,iBAAiB,KAAM;CAErC,gBAAgB;EACd,IAAI,MAAO,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,MAC/B,gBAAgB,mBAAmB,EAAE,MAAM,CAAC,CAAC,KAAK,IAAI,KAAM;CAEhE,GAAG,CAAC,MAAM,KAAK,CAAC;CAEhB,OACE,oBAAC,UAAD;EACE,GAAI;EACE;EACN,QAAQ,MAAM;EACd,eAAe,gBAAgB,MAAM,KAAM;EAC3C,QAAQ,MAAM;EACd,cAAc,MAAM;EACpB,gBAAgB,UAAU,gBAAgB,SAAS,OAAO,KAAM;CACjE,CAAA;AAEL,CAAC;AAED,0BAA0B,cAAc"}
@@ -0,0 +1,404 @@
1
+ "use client";
2
+ import { DEFAULT_LABELS } from "../default-labels.mjs";
3
+ import { LightboxContextProvider } from "../lightbox.context.mjs";
4
+ import Lightbox_module_default from "../Lightbox.module.mjs";
5
+ import { useLightboxKeyboard } from "../hooks/use-lightbox-keyboard.mjs";
6
+ import { useLightboxLockScroll } from "../hooks/use-lightbox-lock-scroll.mjs";
7
+ import { useLightboxZoom } from "../hooks/use-lightbox-zoom.mjs";
8
+ import { Box, FocusTrap, OptionalPortal, RemoveScroll, Transition, VisuallyHidden, createVarsResolver, factory, useDirection, useMantineTheme, useProps, useStyles } from "@mantine/core";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
11
+ import useEmblaCarousel from "embla-carousel-react";
12
+ import { useFocusReturn, useFullscreenDocument, useReducedMotion, useUncontrolled } from "@mantine/hooks";
13
+ //#region packages/@mantine/lightbox/src/LightboxRoot/LightboxRoot.tsx
14
+ const lightboxRootDefaultProps = {
15
+ withZoom: false,
16
+ withThumbnails: false,
17
+ withFullscreen: false,
18
+ withDownload: false,
19
+ loop: false,
20
+ closeOnClickOutside: false,
21
+ closeOnSwipeDown: true,
22
+ withKeyboardEvents: true,
23
+ returnFocus: true,
24
+ withInitialFocusPlaceholder: true,
25
+ withinPortal: true,
26
+ transitionDuration: 200,
27
+ zoomMaxScale: 3,
28
+ withSlideTransition: false
29
+ };
30
+ function createBreakpointWatchDrag(query, zoomIsActive, watchDragRef) {
31
+ return (emblaApi, event) => {
32
+ if (zoomIsActive.current) return false;
33
+ const option = watchDragRef.current[query];
34
+ if (typeof option === "function") return option(emblaApi, event);
35
+ return option ?? true;
36
+ };
37
+ }
38
+ const defaultContentTransition = {
39
+ common: { transformOrigin: "center center" },
40
+ in: {
41
+ opacity: 1,
42
+ transform: "scale(1)"
43
+ },
44
+ out: {
45
+ opacity: 0,
46
+ transform: "scale(0.95)"
47
+ },
48
+ transitionProperty: "transform, opacity"
49
+ };
50
+ function exitDocumentFullscreen() {
51
+ const _document = document;
52
+ const exit = _document.exitFullscreen || _document.msExitFullscreen || _document.webkitExitFullscreen || _document.mozCancelFullScreen;
53
+ if (typeof exit === "function") Promise.resolve(exit.call(_document)).catch(() => {});
54
+ }
55
+ const varsResolver = createVarsResolver((_, { transitionDuration, zIndex }) => ({ root: {
56
+ "--lightbox-transition-duration": `${transitionDuration}ms`,
57
+ "--lightbox-overlay-color": void 0,
58
+ "--lightbox-z-index": zIndex !== void 0 ? `${zIndex}` : void 0,
59
+ "--lightbox-toolbar-height": void 0,
60
+ "--lightbox-thumbnails-height": void 0
61
+ } }));
62
+ const LightboxRoot = factory((_props) => {
63
+ const props = useProps("LightboxRoot", lightboxRootDefaultProps, _props);
64
+ const { classNames, className, style, styles, unstyled, vars, opened, onClose, children, slides, currentIndex, onIndexChange, labels, withZoom, withThumbnails, withFullscreen, withDownload, loop, closeOnClickOutside, closeOnSwipeDown, withKeyboardEvents, returnFocus, withInitialFocusPlaceholder, withinPortal, zIndex, transitionDuration, transitionProps, emblaOptions, zoomMaxScale, withSlideTransition, attributes, mod, onClick, ref, ...others } = props;
65
+ const getStyles = useStyles({
66
+ name: "Lightbox",
67
+ classes: Lightbox_module_default,
68
+ props,
69
+ classNames,
70
+ styles,
71
+ unstyled,
72
+ attributes,
73
+ vars,
74
+ varsResolver
75
+ });
76
+ const _labels = useMemo(() => ({
77
+ ...DEFAULT_LABELS,
78
+ ...labels
79
+ }), [labels]);
80
+ const getStylesRef = useRef(getStyles);
81
+ getStylesRef.current = getStyles;
82
+ const stableGetStyles = useCallback((...args) => getStylesRef.current(...args), []);
83
+ const [_currentIndex, setCurrentIndex] = useUncontrolled({
84
+ value: currentIndex,
85
+ defaultValue: 0,
86
+ finalValue: 0,
87
+ onChange: onIndexChange
88
+ });
89
+ const zoomIsActive = useRef(false);
90
+ const currentIndexRef = useRef(_currentIndex);
91
+ const setCurrentIndexRef = useRef(setCurrentIndex);
92
+ const suppressSelectRef = useRef(null);
93
+ const fullscreenRequestedRef = useRef(false);
94
+ const ownsFullscreenRef = useRef(false);
95
+ const pendingFullscreenRef = useRef(null);
96
+ const exitOnSettleRef = useRef(false);
97
+ const emblaOptionsRef = useRef(emblaOptions);
98
+ const [startIndex, setStartIndex] = useState(_currentIndex);
99
+ const [prevOpened, setPrevOpened] = useState(opened);
100
+ if (opened !== prevOpened) {
101
+ setPrevOpened(opened);
102
+ if (opened) setStartIndex(_currentIndex);
103
+ }
104
+ const { dir } = useDirection();
105
+ const breakpointWatchDragRef = useRef({});
106
+ const resolvedEmblaOptions = useMemo(() => {
107
+ if (!emblaOptions?.breakpoints) {
108
+ breakpointWatchDragRef.current = {};
109
+ return emblaOptions;
110
+ }
111
+ const watchDragOptions = {};
112
+ const breakpoints = Object.fromEntries(Object.entries(emblaOptions.breakpoints).map(([query, value]) => {
113
+ const { loop: _loop, startIndex: _startIndex, watchDrag, ...rest } = value ?? {};
114
+ watchDragOptions[query] = watchDrag;
115
+ return [query, watchDrag === void 0 ? rest : {
116
+ ...rest,
117
+ watchDrag: createBreakpointWatchDrag(query, zoomIsActive, breakpointWatchDragRef)
118
+ }];
119
+ }));
120
+ breakpointWatchDragRef.current = watchDragOptions;
121
+ return {
122
+ ...emblaOptions,
123
+ breakpoints
124
+ };
125
+ }, [emblaOptions]);
126
+ const [emblaRef, embla] = useEmblaCarousel({
127
+ direction: dir,
128
+ ...resolvedEmblaOptions,
129
+ loop,
130
+ startIndex,
131
+ watchDrag: (emblaApi, event) => {
132
+ if (zoomIsActive.current) return false;
133
+ const userWatchDrag = emblaOptionsRef.current?.watchDrag;
134
+ if (typeof userWatchDrag === "function") return userWatchDrag(emblaApi, event);
135
+ return userWatchDrag ?? true;
136
+ }
137
+ });
138
+ const [thumbnailsVisible, setThumbnailsVisible] = useState(!!withThumbnails);
139
+ const [prevWithThumbnails, setPrevWithThumbnails] = useState(withThumbnails);
140
+ if (withThumbnails !== prevWithThumbnails) {
141
+ setPrevWithThumbnails(withThumbnails);
142
+ setThumbnailsVisible(!!withThumbnails);
143
+ }
144
+ const { toggle: toggleFullscreenFn, fullscreen: isFullscreen } = useFullscreenDocument();
145
+ const toggleThumbnails = useCallback(() => {
146
+ setThumbnailsVisible((prev) => !prev);
147
+ }, []);
148
+ const toggleFullscreen = useCallback(() => {
149
+ fullscreenRequestedRef.current = !isFullscreen;
150
+ if (isFullscreen) ownsFullscreenRef.current = false;
151
+ const request = toggleFullscreenFn().then(() => {
152
+ if (pendingFullscreenRef.current === request && exitOnSettleRef.current) {
153
+ exitOnSettleRef.current = false;
154
+ exitDocumentFullscreen();
155
+ }
156
+ }).catch(() => {
157
+ fullscreenRequestedRef.current = false;
158
+ exitOnSettleRef.current = false;
159
+ }).finally(() => {
160
+ if (pendingFullscreenRef.current === request) pendingFullscreenRef.current = null;
161
+ });
162
+ pendingFullscreenRef.current = request;
163
+ }, [toggleFullscreenFn, isFullscreen]);
164
+ useEffect(() => {
165
+ if (!isFullscreen) {
166
+ fullscreenRequestedRef.current = false;
167
+ ownsFullscreenRef.current = false;
168
+ } else if (fullscreenRequestedRef.current) {
169
+ fullscreenRequestedRef.current = false;
170
+ ownsFullscreenRef.current = true;
171
+ }
172
+ }, [isFullscreen]);
173
+ const exitOwnedFullscreen = useCallback(() => {
174
+ if (!ownsFullscreenRef.current && !fullscreenRequestedRef.current) return;
175
+ if (pendingFullscreenRef.current !== null && fullscreenRequestedRef.current) exitOnSettleRef.current = true;
176
+ fullscreenRequestedRef.current = false;
177
+ ownsFullscreenRef.current = false;
178
+ exitDocumentFullscreen();
179
+ }, []);
180
+ const zoom = useLightboxZoom({
181
+ enabled: !!withZoom,
182
+ maxScale: zoomMaxScale,
183
+ currentIndex: _currentIndex
184
+ });
185
+ useEffect(() => {
186
+ currentIndexRef.current = _currentIndex;
187
+ setCurrentIndexRef.current = setCurrentIndex;
188
+ zoomIsActive.current = zoom.zoomState.isZoomed;
189
+ emblaOptionsRef.current = emblaOptions;
190
+ });
191
+ const { resetZoom } = zoom;
192
+ useEffect(() => {
193
+ if (!opened) {
194
+ resetZoom();
195
+ setThumbnailsVisible(!!withThumbnails);
196
+ exitOwnedFullscreen();
197
+ }
198
+ }, [
199
+ opened,
200
+ resetZoom,
201
+ withThumbnails,
202
+ exitOwnedFullscreen
203
+ ]);
204
+ useEffect(() => exitOwnedFullscreen, [exitOwnedFullscreen]);
205
+ const theme = useMantineTheme();
206
+ const shouldReduceMotion = useReducedMotion();
207
+ const reduceMotion = theme.respectReducedMotion ? shouldReduceMotion : false;
208
+ const animateSlides = !!withSlideTransition && !reduceMotion;
209
+ const handleNext = useCallback(() => {
210
+ embla?.scrollNext(!animateSlides);
211
+ }, [embla, animateSlides]);
212
+ const handlePrev = useCallback(() => {
213
+ embla?.scrollPrev(!animateSlides);
214
+ }, [embla, animateSlides]);
215
+ useLightboxKeyboard({
216
+ opened,
217
+ enabled: withKeyboardEvents,
218
+ dir,
219
+ onClose,
220
+ onNext: handleNext,
221
+ onPrev: handlePrev,
222
+ onToggleFullscreen: withFullscreen ? toggleFullscreen : void 0,
223
+ onToggleThumbnails: withThumbnails ? toggleThumbnails : void 0,
224
+ onToggleZoom: withZoom ? zoom.toggleZoom : void 0,
225
+ onZoomPan: withZoom ? zoom.panZoom : void 0
226
+ });
227
+ useEffect(() => {
228
+ if (!embla) return;
229
+ const onSelect = () => {
230
+ const selected = embla.selectedScrollSnap();
231
+ if (selected !== suppressSelectRef.current) setCurrentIndexRef.current(selected);
232
+ };
233
+ const onReInit = () => {
234
+ if (embla.selectedScrollSnap() !== currentIndexRef.current) {
235
+ suppressSelectRef.current = currentIndexRef.current;
236
+ embla.scrollTo(currentIndexRef.current, true);
237
+ suppressSelectRef.current = null;
238
+ }
239
+ };
240
+ embla.on("select", onSelect);
241
+ embla.on("reInit", onReInit);
242
+ return () => {
243
+ embla.off("select", onSelect);
244
+ embla.off("reInit", onReInit);
245
+ };
246
+ }, [embla]);
247
+ useEffect(() => {
248
+ if (embla && opened && embla.selectedScrollSnap() !== _currentIndex) {
249
+ suppressSelectRef.current = _currentIndex;
250
+ embla.scrollTo(_currentIndex, !animateSlides);
251
+ suppressSelectRef.current = null;
252
+ }
253
+ }, [
254
+ _currentIndex,
255
+ embla,
256
+ opened,
257
+ animateSlides
258
+ ]);
259
+ useEffect(() => {
260
+ if (slides.length > 0 && _currentIndex > slides.length - 1) setCurrentIndexRef.current(slides.length - 1);
261
+ }, [slides.length, _currentIndex]);
262
+ useFocusReturn({
263
+ opened,
264
+ shouldReturnFocus: returnFocus
265
+ });
266
+ const shouldLockScroll = useLightboxLockScroll({
267
+ opened,
268
+ exitDuration: typeof transitionProps?.exitDuration === "number" ? transitionProps.exitDuration : typeof transitionProps?.duration === "number" ? transitionProps.duration : transitionDuration,
269
+ exitDelay: typeof transitionProps?.exitDelay === "number" ? transitionProps.exitDelay : 0
270
+ });
271
+ const transition = {
272
+ transition: defaultContentTransition,
273
+ duration: transitionDuration,
274
+ timingFunction: "ease",
275
+ ...transitionProps
276
+ };
277
+ const overlayTransition = {
278
+ transition: "fade",
279
+ duration: transition.duration,
280
+ exitDuration: transition.exitDuration,
281
+ timingFunction: transition.timingFunction,
282
+ enterDelay: transition.enterDelay,
283
+ exitDelay: transition.exitDelay,
284
+ keepMounted: transition.keepMounted
285
+ };
286
+ const setIndex = useCallback((index) => {
287
+ setCurrentIndexRef.current(index);
288
+ suppressSelectRef.current = index;
289
+ embla?.scrollTo(index, !animateSlides);
290
+ suppressSelectRef.current = null;
291
+ }, [embla, animateSlides]);
292
+ const currentSlide = slides[_currentIndex];
293
+ const currentSlideLabel = currentSlide?.type === "video" ? currentSlide.label : currentSlide?.type === "custom" ? void 0 : currentSlide?.alt;
294
+ const contextValue = useMemo(() => ({
295
+ getStyles: stableGetStyles,
296
+ labels: _labels,
297
+ opened,
298
+ slides,
299
+ currentIndex: _currentIndex,
300
+ setIndex,
301
+ next: handleNext,
302
+ prev: handlePrev,
303
+ embla: embla ?? null,
304
+ emblaRef,
305
+ withZoom: !!withZoom,
306
+ withThumbnails: !!withThumbnails,
307
+ withFullscreen: !!withFullscreen,
308
+ withDownload: !!withDownload,
309
+ thumbnailsVisible,
310
+ toggleThumbnails,
311
+ isFullscreen,
312
+ toggleFullscreen,
313
+ zoomState: zoom.zoomState,
314
+ toggleZoom: zoom.toggleZoom,
315
+ getImageZoomProps: zoom.getImageProps,
316
+ onClose,
317
+ loop: !!loop,
318
+ closeOnClickOutside: !!closeOnClickOutside,
319
+ closeOnSwipeDown: !!closeOnSwipeDown,
320
+ transitionDuration
321
+ }), [
322
+ stableGetStyles,
323
+ _labels,
324
+ opened,
325
+ slides,
326
+ _currentIndex,
327
+ setIndex,
328
+ handleNext,
329
+ handlePrev,
330
+ embla,
331
+ emblaRef,
332
+ withZoom,
333
+ withThumbnails,
334
+ withFullscreen,
335
+ withDownload,
336
+ thumbnailsVisible,
337
+ toggleThumbnails,
338
+ isFullscreen,
339
+ toggleFullscreen,
340
+ zoom,
341
+ onClose,
342
+ loop,
343
+ closeOnClickOutside,
344
+ closeOnSwipeDown,
345
+ transitionDuration
346
+ ]);
347
+ return /* @__PURE__ */ jsx(OptionalPortal, {
348
+ withinPortal,
349
+ children: /* @__PURE__ */ jsx(LightboxContextProvider, {
350
+ value: contextValue,
351
+ children: /* @__PURE__ */ jsx(RemoveScroll, {
352
+ enabled: shouldLockScroll,
353
+ children: /* @__PURE__ */ jsxs(Box, {
354
+ ...getStyles("root"),
355
+ children: [/* @__PURE__ */ jsx(Transition, {
356
+ mounted: opened,
357
+ ...overlayTransition,
358
+ children: (overlayStyles) => /* @__PURE__ */ jsx(Box, { ...getStyles("overlay", { style: overlayStyles }) })
359
+ }), /* @__PURE__ */ jsx(Transition, {
360
+ mounted: opened,
361
+ ...transition,
362
+ children: (contentStyles) => /* @__PURE__ */ jsx(FocusTrap, {
363
+ active: opened,
364
+ innerRef: ref,
365
+ children: /* @__PURE__ */ jsxs(Box, {
366
+ ...getStyles("content", {
367
+ className,
368
+ style: style ? [style, contentStyles] : contentStyles
369
+ }),
370
+ role: "dialog",
371
+ "aria-modal": "true",
372
+ "aria-label": _labels.lightboxLabel,
373
+ tabIndex: -1,
374
+ ...others,
375
+ mod,
376
+ onClick: (event) => {
377
+ onClick?.(event);
378
+ if (closeOnClickOutside && event.target === event.currentTarget) onClose();
379
+ },
380
+ children: [
381
+ withInitialFocusPlaceholder && /* @__PURE__ */ jsx(FocusTrap.InitialFocus, {}),
382
+ /* @__PURE__ */ jsx(VisuallyHidden, {
383
+ role: "status",
384
+ "aria-live": "polite",
385
+ "aria-atomic": "true",
386
+ children: slides.length > 0 ? `${_labels.slideLabel(_currentIndex + 1, slides.length)}${currentSlideLabel ? `: ${currentSlideLabel}` : ""}` : null
387
+ }),
388
+ children
389
+ ]
390
+ })
391
+ })
392
+ })]
393
+ })
394
+ })
395
+ })
396
+ });
397
+ });
398
+ LightboxRoot.classes = Lightbox_module_default;
399
+ LightboxRoot.varsResolver = varsResolver;
400
+ LightboxRoot.displayName = "@mantine/lightbox/LightboxRoot";
401
+ //#endregion
402
+ export { LightboxRoot, lightboxRootDefaultProps };
403
+
404
+ //# sourceMappingURL=LightboxRoot.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LightboxRoot.mjs","names":["classes"],"sources":["../../src/LightboxRoot/LightboxRoot.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport type { EmblaOptionsType } from 'embla-carousel';\nimport useEmblaCarousel from 'embla-carousel-react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n FocusTrap,\n MantineTransition,\n OptionalPortal,\n RemoveScroll,\n StylesApiProps,\n Transition,\n TransitionOverride,\n useDirection,\n useMantineTheme,\n useProps,\n useStyles,\n VisuallyHidden,\n} from '@mantine/core';\nimport {\n useFocusReturn,\n useFullscreenDocument,\n useReducedMotion,\n useUncontrolled,\n} from '@mantine/hooks';\nimport { DEFAULT_LABELS } from '../default-labels';\nimport { useLightboxKeyboard } from '../hooks/use-lightbox-keyboard';\nimport { useLightboxLockScroll } from '../hooks/use-lightbox-lock-scroll';\nimport { useLightboxZoom } from '../hooks/use-lightbox-zoom';\nimport { LightboxContextProvider } from '../lightbox.context';\nimport type { LightboxLabels, LightboxSlideData } from '../lightbox.types';\nimport classes from '../Lightbox.module.css';\n\nexport type LightboxRootStylesNames =\n | 'root'\n | 'overlay'\n | 'content'\n | 'toolbar'\n | 'toolbarGroup'\n | 'toolbarButton'\n | 'counter'\n | 'slides'\n | 'slidesViewport'\n | 'slidesContainer'\n | 'slide'\n | 'slideImage'\n | 'slideVideo'\n | 'thumbnails'\n | 'thumbnailsViewport'\n | 'thumbnailsContainer'\n | 'thumbnail'\n | 'thumbnailImage'\n | 'navigation'\n | 'navigationButton'\n | 'caption'\n | 'closeButton';\n\nexport type LightboxCssVariables = {\n root:\n | '--lightbox-transition-duration'\n | '--lightbox-overlay-color'\n | '--lightbox-z-index'\n | '--lightbox-toolbar-height'\n | '--lightbox-thumbnails-height';\n};\n\nexport interface LightboxRootProps\n extends BoxProps, StylesApiProps<LightboxRootFactory>, ElementProps<'div', 'children'> {\n /** Controls whether the lightbox is opened */\n opened: boolean;\n\n /** Called when the lightbox is closed */\n onClose: () => void;\n\n /** Lightbox content (compound components) */\n children: React.ReactNode;\n\n /** Array of slide data objects */\n slides: LightboxSlideData[];\n\n /** Controlled current slide index */\n currentIndex?: number;\n\n /** Called when the current slide index changes */\n onIndexChange?: (index: number) => void;\n\n /** Labels used in the component, used for accessibility and localization */\n labels?: Partial<LightboxLabels>;\n\n /** Enables image zoom on click/pinch @default false */\n withZoom?: boolean;\n\n /** Shows bottom thumbnail strip @default false */\n withThumbnails?: boolean;\n\n /** Adds fullscreen toggle to toolbar @default false */\n withFullscreen?: boolean;\n\n /** Adds download button to toolbar @default false */\n withDownload?: boolean;\n\n /** Enables infinite loop navigation @default false */\n loop?: boolean;\n\n /** Closes lightbox when the empty space around the slide content is clicked @default false */\n closeOnClickOutside?: boolean;\n\n /** Closes lightbox when swiping down on mobile @default true */\n closeOnSwipeDown?: boolean;\n\n /** Determines whether keyboard shortcuts (arrows, `F`/`T`/`Z`) are active, `Escape` always closes the lightbox @default true */\n withKeyboardEvents?: boolean;\n\n /** Determines whether focus should be returned to the last active element when the lightbox is closed @default true */\n returnFocus?: boolean;\n\n /** Adds a hidden focusable element at the start of the lightbox content – prevents the first toolbar button from receiving visible focus when the lightbox is opened with a pointer. Set to `false` if you need custom focus management. @default true */\n withInitialFocusPlaceholder?: boolean;\n\n /** Determines whether the lightbox should be rendered inside `Portal` @default true */\n withinPortal?: boolean;\n\n /** `z-index` of the overlay and content elements, `400` by default */\n zIndex?: string | number;\n\n /** Transition duration in milliseconds @default 200 */\n transitionDuration?: number;\n\n /** Props passed down to the `Transition` component that animates the content, the overlay always fades. By default, the content is scaled from 95% to 100% while fading in. */\n transitionProps?: TransitionOverride;\n\n /** Additional Embla carousel options. `loop` and `startIndex` are controlled by the\n * `loop` and `currentIndex` props and cannot be set here, at the top level or in\n * `breakpoints`; a `watchDrag` option is still honored at both levels, but dragging is\n * always disabled while the image is zoomed. */\n emblaOptions?: EmblaOptionsType;\n\n /** Maximum zoom scale @default 3 */\n zoomMaxScale?: number;\n\n /** Enables animated slide transitions for programmatic navigation @default false */\n withSlideTransition?: boolean;\n}\n\nexport type LightboxRootFactory = Factory<{\n props: LightboxRootProps;\n ref: HTMLDivElement;\n stylesNames: LightboxRootStylesNames;\n vars: LightboxCssVariables;\n}>;\n\nexport const lightboxRootDefaultProps = {\n withZoom: false,\n withThumbnails: false,\n withFullscreen: false,\n withDownload: false,\n loop: false,\n closeOnClickOutside: false,\n closeOnSwipeDown: true,\n withKeyboardEvents: true,\n returnFocus: true,\n withInitialFocusPlaceholder: true,\n withinPortal: true,\n transitionDuration: 200,\n zoomMaxScale: 3,\n withSlideTransition: false,\n} satisfies Partial<LightboxRootProps>;\n\ntype WatchDragOption = EmblaOptionsType['watchDrag'];\n\nfunction createBreakpointWatchDrag(\n query: string,\n zoomIsActive: React.RefObject<boolean>,\n watchDragRef: React.RefObject<Record<string, WatchDragOption>>\n): WatchDragOption {\n return (emblaApi, event) => {\n if (zoomIsActive.current) {\n return false;\n }\n\n const option = watchDragRef.current[query];\n\n if (typeof option === 'function') {\n return option(emblaApi, event);\n }\n\n return option ?? true;\n };\n}\n\nconst defaultContentTransition: MantineTransition = {\n common: { transformOrigin: 'center center' },\n in: { opacity: 1, transform: 'scale(1)' },\n out: { opacity: 0, transform: 'scale(0.95)' },\n transitionProperty: 'transform, opacity',\n};\n\nfunction exitDocumentFullscreen() {\n const _document = document as any;\n const exit =\n _document.exitFullscreen ||\n _document.msExitFullscreen ||\n _document.webkitExitFullscreen ||\n _document.mozCancelFullScreen;\n\n if (typeof exit === 'function') {\n Promise.resolve(exit.call(_document)).catch(() => {});\n }\n}\n\nconst varsResolver = createVarsResolver<LightboxRootFactory>(\n (_, { transitionDuration, zIndex }) => ({\n root: {\n '--lightbox-transition-duration': `${transitionDuration}ms`,\n '--lightbox-overlay-color': undefined,\n '--lightbox-z-index': zIndex !== undefined ? `${zIndex}` : undefined,\n '--lightbox-toolbar-height': undefined,\n '--lightbox-thumbnails-height': undefined,\n },\n })\n);\n\nexport const LightboxRoot = factory<LightboxRootFactory>((_props) => {\n const props = useProps('LightboxRoot', lightboxRootDefaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n opened,\n onClose,\n children,\n slides,\n currentIndex,\n onIndexChange,\n labels,\n withZoom,\n withThumbnails,\n withFullscreen,\n withDownload,\n loop,\n closeOnClickOutside,\n closeOnSwipeDown,\n withKeyboardEvents,\n returnFocus,\n withInitialFocusPlaceholder,\n withinPortal,\n zIndex,\n transitionDuration,\n transitionProps,\n emblaOptions,\n zoomMaxScale,\n withSlideTransition,\n attributes,\n mod,\n onClick,\n ref,\n ...others\n } = props;\n\n const getStyles = useStyles<LightboxRootFactory>({\n name: 'Lightbox',\n classes,\n props,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const _labels = useMemo(() => ({ ...DEFAULT_LABELS, ...labels }), [labels]);\n\n const getStylesRef = useRef(getStyles);\n getStylesRef.current = getStyles;\n\n const stableGetStyles = useCallback<typeof getStyles>(\n (...args) => getStylesRef.current(...args),\n []\n );\n\n const [_currentIndex, setCurrentIndex] = useUncontrolled({\n value: currentIndex,\n defaultValue: 0,\n finalValue: 0,\n onChange: onIndexChange,\n });\n\n const zoomIsActive = useRef(false);\n const currentIndexRef = useRef(_currentIndex);\n const setCurrentIndexRef = useRef(setCurrentIndex);\n\n // Embla emits `select` synchronously from `scrollTo`. When the scroll was requested for\n // an index the consumer already knows about, that echo is suppressed for the duration\n // of the call so `onIndexChange` is not reported twice for one navigation.\n const suppressSelectRef = useRef<number | null>(null);\n const fullscreenRequestedRef = useRef(false);\n const ownsFullscreenRef = useRef(false);\n\n // A `requestFullscreen` that is still in flight, and whether it should be undone as soon\n // as it settles because the lightbox closed in the meantime.\n const pendingFullscreenRef = useRef<Promise<void> | null>(null);\n const exitOnSettleRef = useRef(false);\n\n // Embla compares options by function source, so the `watchDrag` closure above must stay\n // textually stable – the current user options are read through this ref instead.\n const emblaOptionsRef = useRef(emblaOptions);\n\n const [startIndex, setStartIndex] = useState(_currentIndex);\n const [prevOpened, setPrevOpened] = useState(opened);\n\n if (opened !== prevOpened) {\n setPrevOpened(opened);\n if (opened) {\n setStartIndex(_currentIndex);\n }\n }\n\n const { dir } = useDirection();\n\n const breakpointWatchDragRef = useRef<Record<string, WatchDragOption>>({});\n\n const resolvedEmblaOptions = useMemo(() => {\n if (!emblaOptions?.breakpoints) {\n breakpointWatchDragRef.current = {};\n return emblaOptions;\n }\n\n const watchDragOptions: Record<string, WatchDragOption> = {};\n\n const breakpoints = Object.fromEntries(\n Object.entries(emblaOptions.breakpoints).map(([query, value]) => {\n const { loop: _loop, startIndex: _startIndex, watchDrag, ...rest } = value ?? {};\n watchDragOptions[query] = watchDrag;\n\n return [\n query,\n watchDrag === undefined\n ? rest\n : {\n ...rest,\n watchDrag: createBreakpointWatchDrag(query, zoomIsActive, breakpointWatchDragRef),\n },\n ];\n })\n );\n\n breakpointWatchDragRef.current = watchDragOptions;\n return { ...emblaOptions, breakpoints };\n }, [emblaOptions]);\n\n const [emblaRef, embla] = useEmblaCarousel({\n // Placed before the user options so `emblaOptions.direction` can still override it,\n // the same way `@mantine/carousel` wires direction up.\n direction: dir,\n ...resolvedEmblaOptions,\n loop,\n startIndex,\n watchDrag: (emblaApi, event) => {\n // The zoom gesture lock always wins – dragging a zoomed image pans it\n // instead of changing the slide.\n if (zoomIsActive.current) {\n return false;\n }\n\n const userWatchDrag = emblaOptionsRef.current?.watchDrag;\n if (typeof userWatchDrag === 'function') {\n return userWatchDrag(emblaApi, event);\n }\n\n return userWatchDrag ?? true;\n },\n });\n\n const [thumbnailsVisible, setThumbnailsVisible] = useState(!!withThumbnails);\n const [prevWithThumbnails, setPrevWithThumbnails] = useState(withThumbnails);\n\n // Toggling the feature while the lightbox is open used to leave the strip expanded with\n // no way to collapse it – the toolbar button that toggles it is only rendered while\n // `withThumbnails` is set.\n if (withThumbnails !== prevWithThumbnails) {\n setPrevWithThumbnails(withThumbnails);\n setThumbnailsVisible(!!withThumbnails);\n }\n\n const { toggle: toggleFullscreenFn, fullscreen: isFullscreen } = useFullscreenDocument();\n\n const toggleThumbnails = useCallback(() => {\n setThumbnailsVisible((prev) => !prev);\n }, []);\n\n const toggleFullscreen = useCallback(() => {\n fullscreenRequestedRef.current = !isFullscreen;\n if (isFullscreen) {\n ownsFullscreenRef.current = false;\n }\n\n const request = toggleFullscreenFn()\n .then(() => {\n // Closing while `requestFullscreen` is still pending cannot exit anything yet – the\n // browser has not entered fullscreen. The exit has to be retried once the request\n // settles, or the page is left fullscreen with no lightbox on top of it.\n if (pendingFullscreenRef.current === request && exitOnSettleRef.current) {\n exitOnSettleRef.current = false;\n exitDocumentFullscreen();\n }\n })\n .catch(() => {\n fullscreenRequestedRef.current = false;\n exitOnSettleRef.current = false;\n })\n .finally(() => {\n if (pendingFullscreenRef.current === request) {\n pendingFullscreenRef.current = null;\n }\n });\n\n pendingFullscreenRef.current = request;\n }, [toggleFullscreenFn, isFullscreen]);\n\n useEffect(() => {\n if (!isFullscreen) {\n fullscreenRequestedRef.current = false;\n ownsFullscreenRef.current = false;\n } else if (fullscreenRequestedRef.current) {\n fullscreenRequestedRef.current = false;\n ownsFullscreenRef.current = true;\n }\n }, [isFullscreen]);\n\n const exitOwnedFullscreen = useCallback(() => {\n if (!ownsFullscreenRef.current && !fullscreenRequestedRef.current) {\n return;\n }\n\n // A request that has not settled yet cannot be exited now – it is exited when it does.\n if (pendingFullscreenRef.current !== null && fullscreenRequestedRef.current) {\n exitOnSettleRef.current = true;\n }\n\n fullscreenRequestedRef.current = false;\n ownsFullscreenRef.current = false;\n exitDocumentFullscreen();\n }, []);\n\n const zoom = useLightboxZoom({\n enabled: !!withZoom,\n maxScale: zoomMaxScale!,\n currentIndex: _currentIndex,\n });\n\n useEffect(() => {\n currentIndexRef.current = _currentIndex;\n setCurrentIndexRef.current = setCurrentIndex;\n zoomIsActive.current = zoom.zoomState.isZoomed;\n emblaOptionsRef.current = emblaOptions;\n });\n\n const { resetZoom } = zoom;\n\n useEffect(() => {\n if (!opened) {\n resetZoom();\n setThumbnailsVisible(!!withThumbnails);\n exitOwnedFullscreen();\n }\n }, [opened, resetZoom, withThumbnails, exitOwnedFullscreen]);\n\n useEffect(() => exitOwnedFullscreen, [exitOwnedFullscreen]);\n\n const theme = useMantineTheme();\n const shouldReduceMotion = useReducedMotion();\n const reduceMotion = theme.respectReducedMotion ? shouldReduceMotion : false;\n const animateSlides = !!withSlideTransition && !reduceMotion;\n\n const handleNext = useCallback(() => {\n embla?.scrollNext(!animateSlides);\n }, [embla, animateSlides]);\n\n const handlePrev = useCallback(() => {\n embla?.scrollPrev(!animateSlides);\n }, [embla, animateSlides]);\n\n useLightboxKeyboard({\n opened,\n enabled: withKeyboardEvents!,\n dir,\n onClose,\n onNext: handleNext,\n onPrev: handlePrev,\n onToggleFullscreen: withFullscreen ? toggleFullscreen : undefined,\n onToggleThumbnails: withThumbnails ? toggleThumbnails : undefined,\n onToggleZoom: withZoom ? zoom.toggleZoom : undefined,\n onZoomPan: withZoom ? zoom.panZoom : undefined,\n });\n\n useEffect(() => {\n if (!embla) {\n return undefined;\n }\n\n const onSelect = () => {\n const selected = embla.selectedScrollSnap();\n\n if (selected !== suppressSelectRef.current) {\n setCurrentIndexRef.current(selected);\n }\n };\n\n const onReInit = () => {\n if (embla.selectedScrollSnap() !== currentIndexRef.current) {\n suppressSelectRef.current = currentIndexRef.current;\n embla.scrollTo(currentIndexRef.current, true);\n suppressSelectRef.current = null;\n }\n };\n\n embla.on('select', onSelect);\n embla.on('reInit', onReInit);\n return () => {\n embla.off('select', onSelect);\n embla.off('reInit', onReInit);\n };\n }, [embla]);\n\n useEffect(() => {\n if (embla && opened && embla.selectedScrollSnap() !== _currentIndex) {\n // `_currentIndex` is already what the consumer asked for – do not echo it back\n suppressSelectRef.current = _currentIndex;\n embla.scrollTo(_currentIndex, !animateSlides);\n suppressSelectRef.current = null;\n }\n }, [_currentIndex, embla, opened, animateSlides]);\n\n // Slides can be replaced or shortened while the lightbox is open – without this the\n // index can point past the end, leaving no active slide and a counter like \"3 / 2\".\n useEffect(() => {\n if (slides.length > 0 && _currentIndex > slides.length - 1) {\n setCurrentIndexRef.current(slides.length - 1);\n }\n }, [slides.length, _currentIndex]);\n\n useFocusReturn({ opened, shouldReturnFocus: returnFocus });\n\n const shouldLockScroll = useLightboxLockScroll({\n opened,\n exitDuration:\n typeof transitionProps?.exitDuration === 'number'\n ? transitionProps.exitDuration\n : typeof transitionProps?.duration === 'number'\n ? transitionProps.duration\n : transitionDuration,\n exitDelay: typeof transitionProps?.exitDelay === 'number' ? transitionProps.exitDelay : 0,\n });\n\n const transition: TransitionOverride = {\n transition: defaultContentTransition,\n duration: transitionDuration,\n timingFunction: 'ease',\n ...transitionProps,\n };\n\n const overlayTransition: TransitionOverride = {\n transition: 'fade',\n duration: transition.duration,\n exitDuration: transition.exitDuration,\n timingFunction: transition.timingFunction,\n enterDelay: transition.enterDelay,\n exitDelay: transition.exitDelay,\n keepMounted: transition.keepMounted,\n };\n\n const setIndex = useCallback(\n (index: number) => {\n setCurrentIndexRef.current(index);\n suppressSelectRef.current = index;\n embla?.scrollTo(index, !animateSlides);\n suppressSelectRef.current = null;\n },\n [embla, animateSlides]\n );\n\n const currentSlide = slides[_currentIndex];\n const currentSlideLabel =\n currentSlide?.type === 'video'\n ? currentSlide.label\n : currentSlide?.type === 'custom'\n ? undefined\n : currentSlide?.alt;\n\n const contextValue = useMemo(\n () => ({\n getStyles: stableGetStyles,\n labels: _labels,\n opened,\n slides,\n currentIndex: _currentIndex,\n setIndex,\n next: handleNext,\n prev: handlePrev,\n embla: embla ?? null,\n emblaRef,\n withZoom: !!withZoom,\n withThumbnails: !!withThumbnails,\n withFullscreen: !!withFullscreen,\n withDownload: !!withDownload,\n thumbnailsVisible,\n toggleThumbnails,\n isFullscreen,\n toggleFullscreen,\n zoomState: zoom.zoomState,\n toggleZoom: zoom.toggleZoom,\n getImageZoomProps: zoom.getImageProps,\n onClose,\n loop: !!loop,\n closeOnClickOutside: !!closeOnClickOutside,\n closeOnSwipeDown: !!closeOnSwipeDown,\n transitionDuration: transitionDuration!,\n }),\n [\n stableGetStyles,\n _labels,\n opened,\n slides,\n _currentIndex,\n setIndex,\n handleNext,\n handlePrev,\n embla,\n emblaRef,\n withZoom,\n withThumbnails,\n withFullscreen,\n withDownload,\n thumbnailsVisible,\n toggleThumbnails,\n isFullscreen,\n toggleFullscreen,\n zoom,\n onClose,\n loop,\n closeOnClickOutside,\n closeOnSwipeDown,\n transitionDuration,\n ]\n );\n\n return (\n <OptionalPortal withinPortal={withinPortal}>\n <LightboxContextProvider value={contextValue}>\n <RemoveScroll enabled={shouldLockScroll}>\n <Box {...getStyles('root')}>\n <Transition mounted={opened} {...overlayTransition}>\n {(overlayStyles) => <Box {...getStyles('overlay', { style: overlayStyles })} />}\n </Transition>\n\n <Transition mounted={opened} {...transition}>\n {(contentStyles) => (\n <FocusTrap active={opened} innerRef={ref}>\n <Box\n {...getStyles('content', {\n className,\n style: style ? [style, contentStyles] : contentStyles,\n })}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={_labels.lightboxLabel}\n tabIndex={-1}\n {...others}\n mod={mod}\n onClick={(event) => {\n onClick?.(event);\n if (closeOnClickOutside && event.target === event.currentTarget) {\n onClose();\n }\n }}\n >\n {withInitialFocusPlaceholder && <FocusTrap.InitialFocus />}\n\n <VisuallyHidden role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">\n {slides.length > 0\n ? `${_labels.slideLabel(_currentIndex + 1, slides.length)}${currentSlideLabel ? `: ${currentSlideLabel}` : ''}`\n : null}\n </VisuallyHidden>\n {children}\n </Box>\n </FocusTrap>\n )}\n </Transition>\n </Box>\n </RemoveScroll>\n </LightboxContextProvider>\n </OptionalPortal>\n );\n});\n\nLightboxRoot.classes = classes;\nLightboxRoot.varsResolver = varsResolver;\nLightboxRoot.displayName = '@mantine/lightbox/LightboxRoot';\n"],"mappings":";;;;;;;;;;;;;AA2JA,MAAa,2BAA2B;CACtC,UAAU;CACV,gBAAgB;CAChB,gBAAgB;CAChB,cAAc;CACd,MAAM;CACN,qBAAqB;CACrB,kBAAkB;CAClB,oBAAoB;CACpB,aAAa;CACb,6BAA6B;CAC7B,cAAc;CACd,oBAAoB;CACpB,cAAc;CACd,qBAAqB;AACvB;AAIA,SAAS,0BACP,OACA,cACA,cACiB;CACjB,QAAQ,UAAU,UAAU;EAC1B,IAAI,aAAa,SACf,OAAO;EAGT,MAAM,SAAS,aAAa,QAAQ;EAEpC,IAAI,OAAO,WAAW,YACpB,OAAO,OAAO,UAAU,KAAK;EAG/B,OAAO,UAAU;CACnB;AACF;AAEA,MAAM,2BAA8C;CAClD,QAAQ,EAAE,iBAAiB,gBAAgB;CAC3C,IAAI;EAAE,SAAS;EAAG,WAAW;CAAW;CACxC,KAAK;EAAE,SAAS;EAAG,WAAW;CAAc;CAC5C,oBAAoB;AACtB;AAEA,SAAS,yBAAyB;CAChC,MAAM,YAAY;CAClB,MAAM,OACJ,UAAU,kBACV,UAAU,oBACV,UAAU,wBACV,UAAU;CAEZ,IAAI,OAAO,SAAS,YAClB,QAAQ,QAAQ,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;AAExD;AAEA,MAAM,eAAe,oBAClB,GAAG,EAAE,oB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