@faststore/core 2.0.153-alpha.0 → 2.0.156-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/.turbo/turbo-build.log +6 -8
  2. package/@generated/graphql/index.ts +5 -0
  3. package/@generated/graphql/persisted.json +1 -1
  4. package/CHANGELOG.md +10 -0
  5. package/cms/faststore/sections.json +3 -8
  6. package/faststore.config.js +1 -0
  7. package/package.json +5 -5
  8. package/src/components/cms/GlobalSections.tsx +3 -25
  9. package/src/components/cms/RenderSections.tsx +37 -2
  10. package/src/components/sections/CrossSellingShelf/CrossSellingShelf.tsx +17 -3
  11. package/src/components/sections/ProductShelf/ProductShelf.tsx +7 -76
  12. package/src/components/sections/Section/section.scss +0 -7
  13. package/src/components/{sections → ui}/ProductShelf/Overrides.tsx +2 -2
  14. package/src/components/ui/ProductShelf/ProductShelf.tsx +106 -0
  15. package/src/components/ui/ProductShelf/index.ts +2 -0
  16. package/src/pages/[...slug].tsx +1 -7
  17. package/src/sdk/session/index.ts +1 -0
  18. package/.next/BUILD_ID +0 -1
  19. package/.next/build-manifest.json +0 -132
  20. package/.next/cache/.tsbuildinfo +0 -1
  21. package/.next/cache/config.json +0 -7
  22. package/.next/cache/eslint/.cache_1gneedd +0 -1
  23. package/.next/cache/next-server.js.nft.json +0 -1
  24. package/.next/cache/webpack/client-production/0.pack +0 -0
  25. package/.next/cache/webpack/client-production/index.pack +0 -0
  26. package/.next/cache/webpack/server-production/0.pack +0 -0
  27. package/.next/cache/webpack/server-production/index.pack +0 -0
  28. package/.next/export-marker.json +0 -1
  29. package/.next/images-manifest.json +0 -1
  30. package/.next/next-server.js.nft.json +0 -1
  31. package/.next/package.json +0 -1
  32. package/.next/prerender-manifest.json +0 -1
  33. package/.next/react-loadable-manifest.json +0 -48
  34. package/.next/required-server-files.json +0 -1
  35. package/.next/routes-manifest.json +0 -1
  36. package/.next/server/chunks/104.js +0 -703
  37. package/.next/server/chunks/123.js +0 -58
  38. package/.next/server/chunks/143.js +0 -106
  39. package/.next/server/chunks/183.js +0 -80
  40. package/.next/server/chunks/247.js +0 -61
  41. package/.next/server/chunks/280.js +0 -324
  42. package/.next/server/chunks/287.js +0 -58
  43. package/.next/server/chunks/289.js +0 -229
  44. package/.next/server/chunks/312.js +0 -697
  45. package/.next/server/chunks/336.js +0 -821
  46. package/.next/server/chunks/350.js +0 -142
  47. package/.next/server/chunks/368.js +0 -253
  48. package/.next/server/chunks/401.js +0 -7241
  49. package/.next/server/chunks/431.js +0 -7241
  50. package/.next/server/chunks/502.js +0 -600
  51. package/.next/server/chunks/557.js +0 -132
  52. package/.next/server/chunks/576.js +0 -80
  53. package/.next/server/chunks/597.js +0 -169
  54. package/.next/server/chunks/608.js +0 -644
  55. package/.next/server/chunks/644.js +0 -235
  56. package/.next/server/chunks/664.js +0 -3401
  57. package/.next/server/chunks/676.js +0 -32
  58. package/.next/server/chunks/701.js +0 -87
  59. package/.next/server/chunks/74.js +0 -2690
  60. package/.next/server/chunks/82.js +0 -371
  61. package/.next/server/chunks/854.js +0 -72
  62. package/.next/server/chunks/859.js +0 -959
  63. package/.next/server/chunks/874.js +0 -487
  64. package/.next/server/chunks/886.js +0 -120
  65. package/.next/server/chunks/907.js +0 -1803
  66. package/.next/server/chunks/98.js +0 -124
  67. package/.next/server/chunks/font-manifest.json +0 -1
  68. package/.next/server/font-manifest.json +0 -1
  69. package/.next/server/middleware-build-manifest.js +0 -1
  70. package/.next/server/middleware-manifest.json +0 -6
  71. package/.next/server/middleware-react-loadable-manifest.js +0 -1
  72. package/.next/server/pages/404.js +0 -393
  73. package/.next/server/pages/404.js.nft.json +0 -1
  74. package/.next/server/pages/500.js +0 -395
  75. package/.next/server/pages/500.js.nft.json +0 -1
  76. package/.next/server/pages/[...slug].js +0 -733
  77. package/.next/server/pages/[...slug].js.nft.json +0 -1
  78. package/.next/server/pages/[slug]/p.js +0 -2458
  79. package/.next/server/pages/[slug]/p.js.nft.json +0 -1
  80. package/.next/server/pages/_app.js +0 -368
  81. package/.next/server/pages/_app.js.nft.json +0 -1
  82. package/.next/server/pages/_document.js +0 -304
  83. package/.next/server/pages/_document.js.nft.json +0 -1
  84. package/.next/server/pages/_error.js +0 -164
  85. package/.next/server/pages/_error.js.nft.json +0 -1
  86. package/.next/server/pages/account.js +0 -370
  87. package/.next/server/pages/account.js.nft.json +0 -1
  88. package/.next/server/pages/api/graphql.js +0 -315
  89. package/.next/server/pages/api/graphql.js.nft.json +0 -1
  90. package/.next/server/pages/api/preview.js +0 -118
  91. package/.next/server/pages/api/preview.js.nft.json +0 -1
  92. package/.next/server/pages/checkout.js +0 -370
  93. package/.next/server/pages/checkout.js.nft.json +0 -1
  94. package/.next/server/pages/en-US/404.html +0 -81
  95. package/.next/server/pages/en-US/404.json +0 -1
  96. package/.next/server/pages/en-US/500.html +0 -81
  97. package/.next/server/pages/en-US/500.json +0 -1
  98. package/.next/server/pages/en-US/account.html +0 -81
  99. package/.next/server/pages/en-US/account.json +0 -1
  100. package/.next/server/pages/en-US/checkout.html +0 -81
  101. package/.next/server/pages/en-US/checkout.json +0 -1
  102. package/.next/server/pages/en-US/login.html +0 -81
  103. package/.next/server/pages/en-US/login.json +0 -1
  104. package/.next/server/pages/en-US/s.html +0 -81
  105. package/.next/server/pages/en-US/s.json +0 -1
  106. package/.next/server/pages/en-US.html +0 -81
  107. package/.next/server/pages/en-US.json +0 -1
  108. package/.next/server/pages/index.js +0 -966
  109. package/.next/server/pages/index.js.nft.json +0 -1
  110. package/.next/server/pages/login.js +0 -375
  111. package/.next/server/pages/login.js.nft.json +0 -1
  112. package/.next/server/pages/s.js +0 -473
  113. package/.next/server/pages/s.js.nft.json +0 -1
  114. package/.next/server/pages-manifest.json +0 -16
  115. package/.next/server/webpack-api-runtime.js +0 -229
  116. package/.next/server/webpack-runtime.js +0 -229
  117. package/.next/static/Jdc52lXcDWIk2D0wQ-Z4p/_buildManifest.js +0 -1
  118. package/.next/static/Jdc52lXcDWIk2D0wQ-Z4p/_ssgManifest.js +0 -1
  119. package/.next/static/chunks/0-0e3914d9fc148f74.js +0 -1
  120. package/.next/static/chunks/143.dd8a556e6957baa1.js +0 -1
  121. package/.next/static/chunks/226.b57e10ad9932f88c.js +0 -1
  122. package/.next/static/chunks/336.0846f48eccce57e4.js +0 -1
  123. package/.next/static/chunks/366-c0bfd9890048babf.js +0 -1
  124. package/.next/static/chunks/377-b3616792e1f5f651.js +0 -1
  125. package/.next/static/chunks/391-47b923ef44945418.js +0 -1
  126. package/.next/static/chunks/495.0ecd099878b2a36d.js +0 -1
  127. package/.next/static/chunks/502.ae82de1669112b15.js +0 -1
  128. package/.next/static/chunks/545-1d3d08edfd2ee4c6.js +0 -1
  129. package/.next/static/chunks/597.c5cf3fbeae5ceb63.js +0 -1
  130. package/.next/static/chunks/64.ebbe1d2b40f980c7.js +0 -1
  131. package/.next/static/chunks/651.7142f31ce1e052b3.js +0 -1
  132. package/.next/static/chunks/741.52f7fb873418346f.js +0 -1
  133. package/.next/static/chunks/98.97381d2021f86cd9.js +0 -1
  134. package/.next/static/chunks/framework-dfd14d7ce6600b03.js +0 -1
  135. package/.next/static/chunks/main-fd466221927468fd.js +0 -1
  136. package/.next/static/chunks/pages/404-459452495a0df278.js +0 -1
  137. package/.next/static/chunks/pages/500-008e30c48eceebed.js +0 -1
  138. package/.next/static/chunks/pages/[...slug]-bd1885159f7dfbba.js +0 -1
  139. package/.next/static/chunks/pages/[slug]/p-fa35dd93d53f75f6.js +0 -1
  140. package/.next/static/chunks/pages/_app-3e4e7e579cb0681a.js +0 -1
  141. package/.next/static/chunks/pages/_error-a7a0c1d9bfbb4f38.js +0 -1
  142. package/.next/static/chunks/pages/account-46263f0c100c3eae.js +0 -1
  143. package/.next/static/chunks/pages/checkout-20bb3710b24df3b6.js +0 -1
  144. package/.next/static/chunks/pages/index-49b7ee570f7cc4b7.js +0 -1
  145. package/.next/static/chunks/pages/login-f9d316d261fcc062.js +0 -1
  146. package/.next/static/chunks/pages/s-1cbe740b5b781d28.js +0 -1
  147. package/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js +0 -1
  148. package/.next/static/chunks/webpack-eb5ed34c93d07fac.js +0 -1
  149. package/.next/static/css/1323734429a8aa40.css +0 -1
  150. package/.next/static/css/13a4da555ff5e3be.css +0 -1
  151. package/.next/static/css/2e00f7ba49c754b3.css +0 -1
  152. package/.next/static/css/7d822a137c54a781.css +0 -1
  153. package/.next/static/css/a0feab89b7648c5c.css +0 -1
  154. package/.next/static/css/a13a9f9cd349d906.css +0 -1
  155. package/.next/static/css/a45618030b16a245.css +0 -1
  156. package/.next/static/css/bde408cc006e64f8.css +0 -1
  157. package/.next/static/css/d462d9478ce00021.css +0 -1
  158. package/.next/static/css/e02cdad8fc000339.css +0 -1
  159. package/.next/trace +0 -69
  160. package/public/~partytown/debug/partytown-atomics.js +0 -556
  161. package/public/~partytown/debug/partytown-media.js +0 -374
  162. package/public/~partytown/debug/partytown-sandbox-sw.js +0 -543
  163. package/public/~partytown/debug/partytown-sw.js +0 -59
  164. package/public/~partytown/debug/partytown-ww-atomics.js +0 -1789
  165. package/public/~partytown/debug/partytown-ww-sw.js +0 -1781
  166. package/public/~partytown/debug/partytown.js +0 -72
  167. package/public/~partytown/partytown-atomics.js +0 -2
  168. package/public/~partytown/partytown-media.js +0 -2
  169. package/public/~partytown/partytown-sw.js +0 -2
  170. package/public/~partytown/partytown.js +0 -2
@@ -1,644 +0,0 @@
1
- exports.id = 608;
2
- exports.ids = [608];
3
- exports.modules = {
4
-
5
- /***/ 6495:
6
- /***/ ((__unused_webpack_module, exports) => {
7
-
8
- "use strict";
9
- var __webpack_unused_export__;
10
-
11
- __webpack_unused_export__ = ({
12
- value: true
13
- });
14
- exports.Z = _extends;
15
- function _extends() {
16
- return extends_.apply(this, arguments);
17
- }
18
- function extends_() {
19
- extends_ = Object.assign || function(target) {
20
- for(var i = 1; i < arguments.length; i++){
21
- var source = arguments[i];
22
- for(var key in source){
23
- if (Object.prototype.hasOwnProperty.call(source, key)) {
24
- target[key] = source[key];
25
- }
26
- }
27
- }
28
- return target;
29
- };
30
- return extends_.apply(this, arguments);
31
- }
32
-
33
-
34
- /***/ }),
35
-
36
- /***/ 2648:
37
- /***/ ((__unused_webpack_module, exports) => {
38
-
39
- "use strict";
40
- var __webpack_unused_export__;
41
-
42
- __webpack_unused_export__ = ({
43
- value: true
44
- });
45
- exports.Z = _interopRequireDefault;
46
- function _interopRequireDefault(obj) {
47
- return obj && obj.__esModule ? obj : {
48
- default: obj
49
- };
50
- }
51
-
52
-
53
- /***/ }),
54
-
55
- /***/ 1598:
56
- /***/ ((__unused_webpack_module, exports) => {
57
-
58
- "use strict";
59
- var __webpack_unused_export__;
60
-
61
- __webpack_unused_export__ = ({
62
- value: true
63
- });
64
- exports.Z = _interopRequireWildcard;
65
- function _interopRequireWildcard(obj, nodeInterop) {
66
- if (!nodeInterop && obj && obj.__esModule) {
67
- return obj;
68
- }
69
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
70
- return {
71
- default: obj
72
- };
73
- }
74
- var cache = _getRequireWildcardCache(nodeInterop);
75
- if (cache && cache.has(obj)) {
76
- return cache.get(obj);
77
- }
78
- var newObj = {};
79
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
80
- for(var key in obj){
81
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
82
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
83
- if (desc && (desc.get || desc.set)) {
84
- Object.defineProperty(newObj, key, desc);
85
- } else {
86
- newObj[key] = obj[key];
87
- }
88
- }
89
- }
90
- newObj.default = obj;
91
- if (cache) {
92
- cache.set(obj, newObj);
93
- }
94
- return newObj;
95
- }
96
- function _getRequireWildcardCache(nodeInterop1) {
97
- if (typeof WeakMap !== "function") return null;
98
- var cacheBabelInterop = new WeakMap();
99
- var cacheNodeInterop = new WeakMap();
100
- return (_getRequireWildcardCache = function(nodeInterop) {
101
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
102
- })(nodeInterop1);
103
- }
104
-
105
-
106
- /***/ }),
107
-
108
- /***/ 7273:
109
- /***/ ((__unused_webpack_module, exports) => {
110
-
111
- "use strict";
112
- var __webpack_unused_export__;
113
-
114
- __webpack_unused_export__ = ({
115
- value: true
116
- });
117
- exports.Z = _objectWithoutPropertiesLoose;
118
- function _objectWithoutPropertiesLoose(source, excluded) {
119
- if (source == null) return {};
120
- var target = {};
121
- var sourceKeys = Object.keys(source);
122
- var key, i;
123
- for(i = 0; i < sourceKeys.length; i++){
124
- key = sourceKeys[i];
125
- if (excluded.indexOf(key) >= 0) continue;
126
- target[key] = source[key];
127
- }
128
- return target;
129
- }
130
-
131
-
132
- /***/ }),
133
-
134
- /***/ 1432:
135
- /***/ ((module, exports, __webpack_require__) => {
136
-
137
- "client";
138
- "use strict";
139
-
140
- Object.defineProperty(exports, "__esModule", ({
141
- value: true
142
- }));
143
- exports["default"] = Image;
144
-
145
- var _extends = (__webpack_require__(6495)/* ["default"] */ .Z);
146
-
147
- var _interop_require_default = (__webpack_require__(2648)/* ["default"] */ .Z);
148
-
149
- var _interop_require_wildcard = (__webpack_require__(1598)/* ["default"] */ .Z);
150
-
151
- var _object_without_properties_loose = (__webpack_require__(7273)/* ["default"] */ .Z);
152
-
153
- var _react = _interop_require_wildcard(__webpack_require__(6689));
154
-
155
- var _head = _interop_require_default(__webpack_require__(4957));
156
-
157
- var _imageBlurSvg = __webpack_require__(4486);
158
-
159
- var _imageConfig = __webpack_require__(5843);
160
-
161
- var _imageConfigContext = __webpack_require__(744);
162
-
163
- var _utils = __webpack_require__(9232);
164
-
165
- function Image(_param) {
166
- var {
167
- src,
168
- sizes,
169
- unoptimized = false,
170
- priority = false,
171
- loading,
172
- className,
173
- quality,
174
- width,
175
- height,
176
- fill,
177
- style,
178
- onLoadingComplete,
179
- placeholder = 'empty',
180
- blurDataURL
181
- } = _param,
182
- all = _object_without_properties_loose(_param, ["src", "sizes", "unoptimized", "priority", "loading", "className", "quality", "width", "height", "fill", "style", "onLoadingComplete", "placeholder", "blurDataURL"]);
183
-
184
- const configContext = (0, _react).useContext(_imageConfigContext.ImageConfigContext);
185
- const config = (0, _react).useMemo(() => {
186
- const c = configEnv || configContext || _imageConfig.imageConfigDefault;
187
- const allSizes = [...c.deviceSizes, ...c.imageSizes].sort((a, b) => a - b);
188
- const deviceSizes = c.deviceSizes.sort((a, b) => a - b);
189
- return _extends({}, c, {
190
- allSizes,
191
- deviceSizes
192
- });
193
- }, [configContext]);
194
- let rest = all;
195
- let loader = defaultLoader;
196
-
197
- if ('loader' in rest) {
198
- if (rest.loader) {
199
- const customImageLoader = rest.loader;
200
-
201
- var _tmp;
202
-
203
- _tmp = obj => {
204
- const {
205
- config: _
206
- } = obj,
207
- opts = _object_without_properties_loose(obj, ["config"]); // The config object is internal only so we must
208
- // not pass it to the user-defined loader()
209
-
210
-
211
- return customImageLoader(opts);
212
- }, loader = _tmp, _tmp;
213
- } // Remove property so it's not spread on <img>
214
-
215
-
216
- delete rest.loader;
217
- }
218
-
219
- let staticSrc = '';
220
- let widthInt = getInt(width);
221
- let heightInt = getInt(height);
222
- let blurWidth;
223
- let blurHeight;
224
-
225
- if (isStaticImport(src)) {
226
- const staticImageData = isStaticRequire(src) ? src.default : src;
227
-
228
- if (!staticImageData.src) {
229
- throw new Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ${JSON.stringify(staticImageData)}`);
230
- }
231
-
232
- if (!staticImageData.height || !staticImageData.width) {
233
- throw new Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ${JSON.stringify(staticImageData)}`);
234
- }
235
-
236
- blurWidth = staticImageData.blurWidth;
237
- blurHeight = staticImageData.blurHeight;
238
- blurDataURL = blurDataURL || staticImageData.blurDataURL;
239
- staticSrc = staticImageData.src;
240
-
241
- if (!fill) {
242
- if (!widthInt && !heightInt) {
243
- widthInt = staticImageData.width;
244
- heightInt = staticImageData.height;
245
- } else if (widthInt && !heightInt) {
246
- const ratio = widthInt / staticImageData.width;
247
- heightInt = Math.round(staticImageData.height * ratio);
248
- } else if (!widthInt && heightInt) {
249
- const ratio = heightInt / staticImageData.height;
250
- widthInt = Math.round(staticImageData.width * ratio);
251
- }
252
- }
253
- }
254
-
255
- src = typeof src === 'string' ? src : staticSrc;
256
- let isLazy = !priority && (loading === 'lazy' || typeof loading === 'undefined');
257
-
258
- if (src.startsWith('data:') || src.startsWith('blob:')) {
259
- // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
260
- unoptimized = true;
261
- isLazy = false;
262
- }
263
-
264
- if (config.unoptimized) {
265
- unoptimized = true;
266
- }
267
-
268
- const [blurComplete, setBlurComplete] = (0, _react).useState(false);
269
- const [showAltText, setShowAltText] = (0, _react).useState(false);
270
- const qualityInt = getInt(quality);
271
-
272
- if (false) {}
273
-
274
- const imgStyle = Object.assign(fill ? {
275
- position: 'absolute',
276
- height: '100%',
277
- width: '100%',
278
- left: 0,
279
- top: 0,
280
- right: 0,
281
- bottom: 0
282
- } : {}, showAltText ? {} : {
283
- color: 'transparent'
284
- }, style);
285
- const blurStyle = placeholder === 'blur' && blurDataURL && !blurComplete ? {
286
- backgroundSize: imgStyle.objectFit || 'cover',
287
- backgroundPosition: imgStyle.objectPosition || '50% 50%',
288
- backgroundRepeat: 'no-repeat',
289
- backgroundImage: `url("data:image/svg+xml;charset=utf-8,${(0, _imageBlurSvg).getImageBlurSvg({
290
- widthInt,
291
- heightInt,
292
- blurWidth,
293
- blurHeight,
294
- blurDataURL
295
- })}")`
296
- } : {};
297
-
298
- if (false) {}
299
-
300
- const imgAttributes = generateImgAttrs({
301
- config,
302
- src,
303
- unoptimized,
304
- width: widthInt,
305
- quality: qualityInt,
306
- sizes,
307
- loader
308
- });
309
- let srcString = src;
310
-
311
- if (false) {}
312
-
313
- let imageSrcSetPropName = 'imagesrcset';
314
- let imageSizesPropName = 'imagesizes';
315
-
316
- if (true) {
317
- imageSrcSetPropName = 'imageSrcSet';
318
- imageSizesPropName = 'imageSizes';
319
- }
320
-
321
- const linkProps = {
322
- // Note: imagesrcset and imagesizes are not in the link element type with react 17.
323
- [imageSrcSetPropName]: imgAttributes.srcSet,
324
- [imageSizesPropName]: imgAttributes.sizes,
325
- crossOrigin: rest.crossOrigin
326
- };
327
- const onLoadingCompleteRef = (0, _react).useRef(onLoadingComplete);
328
- (0, _react).useEffect(() => {
329
- onLoadingCompleteRef.current = onLoadingComplete;
330
- }, [onLoadingComplete]);
331
-
332
- const imgElementArgs = _extends({
333
- isLazy,
334
- imgAttributes,
335
- heightInt,
336
- widthInt,
337
- qualityInt,
338
- className,
339
- imgStyle,
340
- blurStyle,
341
- loading,
342
- config,
343
- fill,
344
- unoptimized,
345
- placeholder,
346
- loader,
347
- srcString,
348
- onLoadingCompleteRef,
349
- setBlurComplete,
350
- setShowAltText
351
- }, rest);
352
-
353
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(ImageElement, Object.assign({}, imgElementArgs)), priority ? // Note how we omit the `href` attribute, as it would only be relevant
354
- // for browsers that do not support `imagesrcset`, and in those cases
355
- // it would likely cause the incorrect image to be preloaded.
356
- //
357
- // https://html.spec.whatwg.org/multipage/semantics.html#attr-link-imagesrcset
358
-
359
- /*#__PURE__*/
360
- _react.default.createElement(_head.default, null, /*#__PURE__*/_react.default.createElement("link", Object.assign({
361
- key: '__nimg-' + imgAttributes.src + imgAttributes.srcSet + imgAttributes.sizes,
362
- rel: "preload",
363
- as: "image",
364
- href: imgAttributes.srcSet ? undefined : imgAttributes.src
365
- }, linkProps))) : null);
366
- }
367
-
368
- 'client';
369
- const configEnv = {"deviceSizes":[360,540,768,1280,1440],"imageSizes":[34,68,154,320],"path":"/_next/image","loader":"default","dangerouslyAllowSVG":false,"unoptimized":false};
370
- const allImgs = new Map();
371
- let perfObserver;
372
-
373
- if (true) {
374
- global.__NEXT_IMAGE_IMPORTED = true;
375
- }
376
-
377
- const VALID_LOADING_VALUES = (/* unused pure expression or super */ null && (['lazy', 'eager', undefined]));
378
-
379
- function isStaticRequire(src) {
380
- return src.default !== undefined;
381
- }
382
-
383
- function isStaticImageData(src) {
384
- return src.src !== undefined;
385
- }
386
-
387
- function isStaticImport(src) {
388
- return typeof src === 'object' && (isStaticRequire(src) || isStaticImageData(src));
389
- }
390
-
391
- function getWidths({
392
- deviceSizes,
393
- allSizes
394
- }, width, sizes) {
395
- if (sizes) {
396
- // Find all the "vw" percent sizes used in the sizes prop
397
- const viewportWidthRe = /(^|\s)(1?\d?\d)vw/g;
398
- const percentSizes = [];
399
-
400
- for (let match; match = viewportWidthRe.exec(sizes); match) {
401
- percentSizes.push(parseInt(match[2]));
402
- }
403
-
404
- if (percentSizes.length) {
405
- const smallestRatio = Math.min(...percentSizes) * 0.01;
406
- return {
407
- widths: allSizes.filter(s => s >= deviceSizes[0] * smallestRatio),
408
- kind: 'w'
409
- };
410
- }
411
-
412
- return {
413
- widths: allSizes,
414
- kind: 'w'
415
- };
416
- }
417
-
418
- if (typeof width !== 'number') {
419
- return {
420
- widths: deviceSizes,
421
- kind: 'w'
422
- };
423
- }
424
-
425
- const widths = [...new Set( // > This means that most OLED screens that say they are 3x resolution,
426
- // > are actually 3x in the green color, but only 1.5x in the red and
427
- // > blue colors. Showing a 3x resolution image in the app vs a 2x
428
- // > resolution image will be visually the same, though the 3x image
429
- // > takes significantly more data. Even true 3x resolution screens are
430
- // > wasteful as the human eye cannot see that level of detail without
431
- // > something like a magnifying glass.
432
- // https://blog.twitter.com/engineering/en_us/topics/infrastructure/2019/capping-image-fidelity-on-ultra-high-resolution-devices.html
433
- [width, width * 2
434
- /*, width * 3*/
435
- ].map(w => allSizes.find(p => p >= w) || allSizes[allSizes.length - 1]))];
436
- return {
437
- widths,
438
- kind: 'x'
439
- };
440
- }
441
-
442
- function generateImgAttrs({
443
- config,
444
- src,
445
- unoptimized,
446
- width,
447
- quality,
448
- sizes,
449
- loader
450
- }) {
451
- if (unoptimized) {
452
- return {
453
- src,
454
- srcSet: undefined,
455
- sizes: undefined
456
- };
457
- }
458
-
459
- const {
460
- widths,
461
- kind
462
- } = getWidths(config, width, sizes);
463
- const last = widths.length - 1;
464
- return {
465
- sizes: !sizes && kind === 'w' ? '100vw' : sizes,
466
- srcSet: widths.map((w, i) => `${loader({
467
- config,
468
- src,
469
- quality,
470
- width: w
471
- })} ${kind === 'w' ? w : i + 1}${kind}`).join(', '),
472
- // It's intended to keep `src` the last attribute because React updates
473
- // attributes in order. If we keep `src` the first one, Safari will
474
- // immediately start to fetch `src`, before `sizes` and `srcSet` are even
475
- // updated by React. That causes multiple unnecessary requests if `srcSet`
476
- // and `sizes` are defined.
477
- // This bug cannot be reproduced in Chrome or Firefox.
478
- src: loader({
479
- config,
480
- src,
481
- quality,
482
- width: widths[last]
483
- })
484
- };
485
- }
486
-
487
- function getInt(x) {
488
- if (typeof x === 'number' || typeof x === 'undefined') {
489
- return x;
490
- }
491
-
492
- if (typeof x === 'string' && /^[0-9]+$/.test(x)) {
493
- return parseInt(x, 10);
494
- }
495
-
496
- return NaN;
497
- } // See https://stackoverflow.com/q/39777833/266535 for why we use this ref
498
- // handler instead of the img's onLoad attribute.
499
-
500
-
501
- function handleLoading(img, src, placeholder, onLoadingCompleteRef, setBlurComplete) {
502
- if (!img || img['data-loaded-src'] === src) {
503
- return;
504
- }
505
-
506
- img['data-loaded-src'] = src;
507
- const p = 'decode' in img ? img.decode() : Promise.resolve();
508
- p.catch(() => {}).then(() => {
509
- if (!img.parentNode) {
510
- // Exit early in case of race condition:
511
- // - onload() is called
512
- // - decode() is called but incomplete
513
- // - unmount is called
514
- // - decode() completes
515
- return;
516
- }
517
-
518
- if (placeholder === 'blur') {
519
- setBlurComplete(true);
520
- }
521
-
522
- if (onLoadingCompleteRef == null ? void 0 : onLoadingCompleteRef.current) {
523
- onLoadingCompleteRef.current(img);
524
- }
525
-
526
- if (false) {}
527
- });
528
- }
529
-
530
- const ImageElement = _param => {
531
- var {
532
- imgAttributes,
533
- heightInt,
534
- widthInt,
535
- qualityInt,
536
- className,
537
- imgStyle,
538
- blurStyle,
539
- isLazy,
540
- fill,
541
- placeholder,
542
- loading,
543
- srcString,
544
- config,
545
- unoptimized,
546
- loader,
547
- onLoadingCompleteRef,
548
- setBlurComplete,
549
- setShowAltText,
550
- onLoad,
551
- onError
552
- } = _param,
553
- rest = _object_without_properties_loose(_param, ["imgAttributes", "heightInt", "widthInt", "qualityInt", "className", "imgStyle", "blurStyle", "isLazy", "fill", "placeholder", "loading", "srcString", "config", "unoptimized", "loader", "onLoadingCompleteRef", "setBlurComplete", "setShowAltText", "onLoad", "onError"]);
554
-
555
- loading = isLazy ? 'lazy' : loading;
556
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("img", Object.assign({}, rest, imgAttributes, {
557
- width: widthInt,
558
- height: heightInt,
559
- decoding: "async",
560
- "data-nimg": `future${fill ? '-fill' : ''}`,
561
- className: className,
562
- // @ts-ignore - TODO: upgrade to `@types/react@17`
563
- loading: loading,
564
- style: _extends({}, imgStyle, blurStyle),
565
- ref: (0, _react).useCallback(img => {
566
- if (!img) {
567
- return;
568
- }
569
-
570
- if (onError) {
571
- // If the image has an error before react hydrates, then the error is lost.
572
- // The workaround is to wait until the image is mounted which is after hydration,
573
- // then we set the src again to trigger the error handler (if there was an error).
574
- // eslint-disable-next-line no-self-assign
575
- img.src = img.src;
576
- }
577
-
578
- if (false) {}
579
-
580
- if (img.complete) {
581
- handleLoading(img, srcString, placeholder, onLoadingCompleteRef, setBlurComplete);
582
- }
583
- }, [srcString, placeholder, onLoadingCompleteRef, setBlurComplete, onError]),
584
- onLoad: event => {
585
- const img = event.currentTarget;
586
- handleLoading(img, srcString, placeholder, onLoadingCompleteRef, setBlurComplete);
587
-
588
- if (onLoad) {
589
- onLoad(event);
590
- }
591
- },
592
- onError: event => {
593
- // if the real image fails to load, this will ensure "alt" is visible
594
- setShowAltText(true);
595
-
596
- if (placeholder === 'blur') {
597
- // If the real image fails to load, this will still remove the placeholder.
598
- setBlurComplete(true);
599
- }
600
-
601
- if (onError) {
602
- onError(event);
603
- }
604
- }
605
- })));
606
- };
607
-
608
- function defaultLoader({
609
- config,
610
- src,
611
- width,
612
- quality
613
- }) {
614
- if (false) {}
615
-
616
- if (src.endsWith('.svg') && !config.dangerouslyAllowSVG) {
617
- // Special case to make svg serve as-is to avoid proxying
618
- // through the built-in Image Optimization API.
619
- return src;
620
- }
621
-
622
- return `${config.path}?url=${encodeURIComponent(src)}&w=${width}&q=${quality || 75}`;
623
- }
624
-
625
- if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') {
626
- Object.defineProperty(exports.default, '__esModule', {
627
- value: true
628
- });
629
- Object.assign(exports.default, exports);
630
- module.exports = exports.default;
631
- }
632
-
633
- /***/ }),
634
-
635
- /***/ 1608:
636
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
637
-
638
- module.exports = __webpack_require__(1432)
639
-
640
-
641
- /***/ })
642
-
643
- };
644
- ;