next-cloudinary 0.0.7 → 0.0.9

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.
package/README.md ADDED
@@ -0,0 +1,256 @@
1
+ <img align="center" height="50" src="https://res.cloudinary.com/cloudinary-marketing/image/upload/f_auto,q_auto,h_100/v1595456749/creative_source/Logo/PNG/cloudinary_logo_blue_0720_2x.png" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img align="center" height="30" src="https://user-images.githubusercontent.com/1045274/189200861-1089b9db-5a78-4b43-9f6c-dfb1752c92f9.png" />
2
+
3
+ # Cloudinary Next.js Component
4
+
5
+ Get the best of Cloudinary in Next.js with the CldImage component!
6
+
7
+ > 🚨 EXPERIMENTAL: while this should be working pretty well, it's consider experimental, so use at your own risk!
8
+
9
+ **This plugin is not officially supported by Cloudinary.**
10
+
11
+ ## ⚡️ Getting Started
12
+
13
+ ### Installation
14
+
15
+ * Install `next-cloudinary` with:
16
+ ```
17
+ yarn add next-cloudinary
18
+ # or
19
+ npm install next-cloudinary
20
+ ```
21
+
22
+ * Add an environment variable with your Cloud Name:
23
+ ```
24
+ NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME="<Your Cloud Name>"
25
+ ```
26
+
27
+ * Import the CldImage component:
28
+ ```
29
+ import { CldImage } from 'next-cloudinary';
30
+ ```
31
+
32
+ ### Usage
33
+
34
+ The basic required props include `width`, `height`, and `src`:
35
+
36
+ ```
37
+ <CldImage
38
+ width="600"
39
+ height="600"
40
+ src="<Public ID>"
41
+ />
42
+ ```
43
+
44
+ You can further take advantage of Cloudinary features like background removal and overlays by adding additional props:
45
+
46
+ ```
47
+ <CldImage
48
+ width="600"
49
+ height="600"
50
+ src="<Public ID>"
51
+ crop="thumb"
52
+ gravity="faces"
53
+ removeBackground
54
+ tint="100:blue:green:red"
55
+ underlays={[{
56
+ publicId: '<Public ID>',
57
+ width: 600,
58
+ height: 600,
59
+ crop: 'fill'
60
+ }]}
61
+ />
62
+ ```
63
+
64
+ As CldImage is a wrapper around the Next.js Image component, all built-in Image component features will work out-of-the-box including the `layout` prop.
65
+
66
+ ## 🛠 Configuration
67
+
68
+ ### General Props
69
+
70
+ | Prop Name | Type | Example |
71
+ |------------------|-------------|------------------------------|
72
+ | crop | string | `"thumb"` |
73
+ | gravity | string | `"faces"` |
74
+ | overlays | array | See Below |
75
+ | removeBackground | bool/string | `true` |
76
+ | underlays | array | See Below |
77
+
78
+ ### Effect Props
79
+
80
+ | Prop Name | Type | Example |
81
+ |------------------ |-------------|------------------------------|
82
+ | art | string | `"al_dente"` |
83
+ | autoBrightness | bool/string | `true`, `"80"` |
84
+ | autoColor | bool/string | `true`, `"80"` |
85
+ | autoContrast | bool/string | `true`, `"80"` |
86
+ | assistColorblind | bool/string | `true`, `"20"`, `"xray"` |
87
+ | blackwhite | bool/string | `true`, `"40"` |
88
+ | blur | bool/string | `true`, `"800"` |
89
+ | blurFaces | bool/string | `true`, `"800"` |
90
+ | blurRegion | bool/string | `true`, `"1000,h_425,w_550,x_600,y_400"` |
91
+ | brightness | bool/string | `true`, `"100"` |
92
+ | brightnessHSB | bool/string | `true`, `"100"` |
93
+ | cartoonify | bool/string | `true`, `"70:80"` |
94
+ | colorize | string | `"35,co_darkviolet"` |
95
+ | contrast | bool/string | `true`, `"100"`, `"level_-70"` |
96
+ | distort | string | `"150:340:1500:10:1500:1550:50:1000"`, `"arc:180.0"` |
97
+ | fillLight | bool/string | `true`, `"70:20"` |
98
+ | gamma | bool/string | `true`, `"100"` |
99
+ | gradientFade | bool/string | `true`, `"symmetric:10,x_0.2,y_0.4"` |
100
+ | grayscale | bool | `true` |
101
+ | improve | bool/string | `true`, `"50"`, `"indoor"` |
102
+ | negate | bool | `true` |
103
+ | oilPaint | bool/string | `true`, `"40"` |
104
+ | outline | bool/string | `true`, `"40"`, `"outer:15:200"` |
105
+ | pixelate | bool/string | `true`, `"20"` |
106
+ | pixelateFaces | bool/string | `true`, `"20"` |
107
+ | pixelateRegion | bool/string | `true`, `"35,h_425,w_550,x_600,y_400"` |
108
+ | redeye | bool/string | `true` |
109
+ | replaceColor | string | `"saddlebrown"`, `"2F4F4F:20"`, `"silver:55:89b8ed"` |
110
+ | saturation | bool/string | `true`, `"70"` |
111
+ | sepia | bool/string | `true`, `"50"` |
112
+ | shadow | bool/string | `true`, `"50,x_-15,y_15"` |
113
+ | sharpen | bool/string | `true`, `"100"` |
114
+ | shear | string | `"20.0:0.0"` |
115
+ | simulateColorblind | bool/string | `"deuteranopia"` |
116
+ | tint | bool/string | `true`, `"100:red:blue:yellow"` |
117
+ | unsharpMask | bool/string | `true`, `"500"` |
118
+ | vectorize | bool/string | `true`, `"3:0.5"` |
119
+ | vibrance | bool/string | `true`, `"70"` |
120
+ | vignette | bool/string | `true`, `"30"` |
121
+
122
+ [View the Cloudinary docs](https://cloudinary.com/documentation/transformation_reference#e_effect) to see learn more about using effects.
123
+
124
+ ### Background Removal
125
+
126
+ Removing backgrounds require enabling the [Cloudinary AI Background Removal Add-On](https://cloudinary.com/documentation/cloudinary_ai_background_removal_addon) which includes a free tier for getting started.
127
+
128
+ Once enabled, you can simply apply the `removeBackground` parameter.
129
+
130
+ **Example:**
131
+
132
+ ```
133
+ <CldImage
134
+ ...
135
+ removeBackground
136
+ />
137
+ ```
138
+
139
+ ### Overlays
140
+
141
+ The `overlays` prop is an array of objects with the following configuration options:
142
+
143
+ | Property Name | Type | Example |
144
+ |------------------|-------------|--------------------------------------|
145
+ | effects | array | See Below |
146
+ | position | object | See Below |
147
+ | publicId | string | `"thumb"` |
148
+ | text | object | See Below |
149
+
150
+ The position property can include:
151
+
152
+ | Property Name | Type | Example |
153
+ |------------------|-------------|--------------------------------------|
154
+ | angle | number | `45` |
155
+ | gravity | string | '"north_west"' |
156
+ | x | number | `10` |
157
+ | y | number | `10` |
158
+
159
+ Objects in the effects array can include:
160
+
161
+ | Property Name | Type | Example |
162
+ |------------------|-------------|--------------------------------------|
163
+ | aspectRatio | string | `"3.0"` |
164
+ | crop | string | `10` |
165
+ | gravity | string | '"north_west"' |
166
+ | height | number | '600' |
167
+ | width | number | '600' |
168
+
169
+ The text property can include:
170
+
171
+ | Property Name | Type | Example |
172
+ |------------------|-------------|--------------------------------------|
173
+ | color | string | `"blueviolet"` |
174
+ | fontFamily | string | `"Open Sans"` |
175
+ | fontSize | number | `48` |
176
+ | fontWeight | string | `"bold"` |
177
+ | letterSpacing | number | `"14"` |
178
+ | textDecoration | string | `"underline"` |
179
+
180
+ #### Adding Images
181
+
182
+ You can add images on top of other images by using image-based overlays.
183
+
184
+ **Example:**
185
+
186
+ ```
187
+ <CldImage
188
+ ...
189
+ overlays={[{
190
+ publicId: '<Public ID>',
191
+ position: {
192
+ x: 10,
193
+ y: 10,
194
+ gravity: 'north_west',
195
+ },
196
+ effects: [
197
+ {
198
+ crop: 'fill',
199
+ gravity: 'auto',
200
+ width: 500,
201
+ height: 500
202
+ }
203
+ ]
204
+ }]}
205
+ />
206
+ ```
207
+
208
+ #### Adding Text
209
+
210
+ You can add text on top of your image with text-based overlays.
211
+
212
+ **Example:**
213
+
214
+ ```
215
+ <CldImage
216
+ ...
217
+ overlays={[{
218
+ width: 2670 - 20,
219
+ crop: 'fit',
220
+ position: {
221
+ x: 10,
222
+ y: 10,
223
+ gravity: 'north_west',
224
+ },
225
+ text: {
226
+ color: 'blueviolet',
227
+ fontFamily: 'Source Sans Pro',
228
+ fontSize: 120,
229
+ fontWeight: 'bold',
230
+ textDecoration: 'underline',
231
+ letterSpacing: 14,
232
+ text: 'Text'
233
+ }
234
+ }]}
235
+ />
236
+ ```
237
+
238
+ ### Underlays
239
+
240
+ Underlays function very similar to overlays in terms of options, however they **do not support text**.
241
+
242
+ See the examples above under Overlays to learn more about the available configurations.
243
+
244
+ **Example:**
245
+
246
+ ```
247
+ <CldImage
248
+ ...
249
+ underlays={[{
250
+ publicId: '<Public ID>',
251
+ width: 1920,
252
+ height: 1200,
253
+ crop: 'fill'
254
+ }]}
255
+ />
256
+ ```
@@ -74,7 +74,8 @@ function createPlaceholderUrl(_ref) {
74
74
  }
75
75
 
76
76
  var cropsGravityAuto = ['crop', 'fill', 'lfill', 'fill_pad', 'thumb'];
77
- function croppingPlugin(_temp) {
77
+ var options$5 = ['crop', 'gravity'];
78
+ function plugin$4(_temp) {
78
79
  var _ref = _temp === void 0 ? {} : _temp,
79
80
  cldImage = _ref.cldImage,
80
81
  options = _ref.options,
@@ -106,6 +107,12 @@ function croppingPlugin(_temp) {
106
107
  cldImage.resize(transformationString);
107
108
  }
108
109
 
110
+ var croppingPlugin = {
111
+ __proto__: null,
112
+ options: options$5,
113
+ plugin: plugin$4
114
+ };
115
+
109
116
  // aspectRatio
110
117
  var primary = {
111
118
  aspectRatio: {
@@ -161,7 +168,8 @@ var text = {
161
168
  };
162
169
 
163
170
  var _excluded$1 = ["publicId", "position", "text", "effects"];
164
- function overlaysPlugin(_temp) {
171
+ var options$4 = ['overlays'];
172
+ function plugin$3(_temp) {
165
173
  var _ref = _temp === void 0 ? {} : _temp,
166
174
  cldImage = _ref.cldImage,
167
175
  cldOptions = _ref.cldOptions;
@@ -256,7 +264,14 @@ function overlaysPlugin(_temp) {
256
264
  });
257
265
  }
258
266
 
259
- function removeBackgroundPlugin(_temp) {
267
+ var overlaysPlugin = {
268
+ __proto__: null,
269
+ options: options$4,
270
+ plugin: plugin$3
271
+ };
272
+
273
+ var options$3 = ['removeBackground'];
274
+ function plugin$2(_temp) {
260
275
  var _ref = _temp === void 0 ? {} : _temp,
261
276
  cldImage = _ref.cldImage,
262
277
  cldOptions = _ref.cldOptions;
@@ -269,20 +284,92 @@ function removeBackgroundPlugin(_temp) {
269
284
  }
270
285
  }
271
286
 
272
- function tintPlugin(_temp) {
287
+ var removeBackgroundPlugin = {
288
+ __proto__: null,
289
+ options: options$3,
290
+ plugin: plugin$2
291
+ };
292
+
293
+ var params = ['art', {
294
+ prop: 'autoBrightness',
295
+ effect: 'auto_brightness'
296
+ }, {
297
+ prop: 'autoColor',
298
+ effect: 'auto_color'
299
+ }, {
300
+ prop: 'autoContrast',
301
+ effect: 'auto_contrast'
302
+ }, {
303
+ prop: 'assistColorblind',
304
+ effect: 'assist_colorblind'
305
+ }, 'blackwhite', 'blur', {
306
+ prop: 'blurFaces',
307
+ effect: 'blur_faces'
308
+ }, {
309
+ prop: 'blurRegion',
310
+ effect: 'blur_region'
311
+ }, 'brightness', {
312
+ prop: 'brightnessHSB',
313
+ effect: 'brightness_hsb'
314
+ }, 'cartoonify', 'colorize', 'contrast', 'distort', {
315
+ prop: 'fillLight',
316
+ effect: 'fill_light'
317
+ }, 'gamma', {
318
+ prop: 'gradientFade',
319
+ effect: 'gradient_fade'
320
+ }, 'grayscale', 'improve', 'negate', {
321
+ prop: 'oilPaint',
322
+ effect: 'oil_paint'
323
+ }, 'outline', 'pixelate', {
324
+ prop: 'pixelateFaces',
325
+ effect: 'pixelate_faces'
326
+ }, {
327
+ prop: 'pixelateRegion',
328
+ effect: 'pixelate_region'
329
+ }, 'redeye', {
330
+ prop: 'replaceColor',
331
+ effect: 'replace_color'
332
+ }, 'saturation', 'sepia', 'shadow', 'sharpen', 'shear', {
333
+ prop: 'simulateColorblind',
334
+ effect: 'simulate_colorblind'
335
+ }, 'tint', {
336
+ prop: 'unsharpMask',
337
+ effect: 'unsharp_mask'
338
+ }, 'vectorize', 'vibrance', 'vignette' // 'zoompan' // requires GIF format
339
+ ];
340
+ var options$2 = params.map(function (param) {
341
+ return param.prop || param;
342
+ });
343
+ function plugin$1(_temp) {
273
344
  var _ref = _temp === void 0 ? {} : _temp,
274
345
  cldImage = _ref.cldImage,
275
346
  cldOptions = _ref.cldOptions;
276
347
 
277
- var tint = cldOptions.tint;
348
+ params.forEach(function (key) {
349
+ var prop = key.prop || key;
350
+ var effect = key.effect || key;
278
351
 
279
- if (tint) {
280
- cldImage.effect("e_tint:" + tint);
281
- }
352
+ if (prop === 'oilPaint' && cldOptions[prop]) {
353
+ console.log('cldOptions[prop]', cldOptions[prop]);
354
+ }
355
+
356
+ if (cldOptions[prop] === true) {
357
+ cldImage.effect("e_" + effect);
358
+ } else if (typeof cldOptions[prop] === 'string') {
359
+ cldImage.effect("e_" + effect + ":" + cldOptions[prop]);
360
+ }
361
+ });
282
362
  }
283
363
 
364
+ var effectsPlugin = {
365
+ __proto__: null,
366
+ options: options$2,
367
+ plugin: plugin$1
368
+ };
369
+
284
370
  var _excluded = ["publicId", "type", "position", "text", "effects"];
285
- function underlaysPlugin(_temp) {
371
+ var options$1 = ['underlays'];
372
+ function plugin(_temp) {
286
373
  var _ref = _temp === void 0 ? {} : _temp,
287
374
  cldImage = _ref.cldImage,
288
375
  cldOptions = _ref.cldOptions;
@@ -350,13 +437,19 @@ function underlaysPlugin(_temp) {
350
437
  });
351
438
  }
352
439
 
440
+ var underlaysPlugin = {
441
+ __proto__: null,
442
+ options: options$1,
443
+ plugin: plugin
444
+ };
445
+
353
446
  var cld = new urlGen.Cloudinary({
354
447
  cloud: {
355
448
  cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME
356
449
  }
357
450
  });
358
451
  var transformationPlugins = [removeBackgroundPlugin, // Background Removal must always come first
359
- croppingPlugin, tintPlugin, overlaysPlugin, underlaysPlugin];
452
+ croppingPlugin, effectsPlugin, overlaysPlugin, underlaysPlugin];
360
453
  function cloudinaryLoader(options, cldOptions) {
361
454
  var src = options.src,
362
455
  _options$format = options.format,
@@ -364,7 +457,8 @@ function cloudinaryLoader(options, cldOptions) {
364
457
  _options$quality = options.quality,
365
458
  quality = _options$quality === void 0 ? 'auto' : _options$quality;
366
459
  var cldImage = cld.image(src);
367
- transformationPlugins.forEach(function (plugin) {
460
+ transformationPlugins.forEach(function (_ref) {
461
+ var plugin = _ref.plugin;
368
462
  plugin({
369
463
  cldImage: cldImage,
370
464
  options: options,
@@ -374,19 +468,31 @@ function cloudinaryLoader(options, cldOptions) {
374
468
  return cldImage.format(format).delivery("q_" + quality).toURL();
375
469
  }
376
470
 
377
- var options = ['crop', 'gravity', 'overlays', 'removeBackground', 'tint', 'underlays'];
471
+ var options = [];
378
472
 
379
473
  var CldImage = function CldImage(props) {
380
- // Construct the base Image component props by filtering out Cloudinary-specific props
474
+ var CLD_OPTIONS = [].concat(options);
475
+ transformationPlugins.forEach(function (_ref) {
476
+ var _ref$options = _ref.options,
477
+ options = _ref$options === void 0 ? [] : _ref$options;
478
+ options.forEach(function (option) {
479
+ if (CLD_OPTIONS.includes(option)) {
480
+ throw new Error("Option " + option + " already exists!");
481
+ }
482
+
483
+ CLD_OPTIONS.push(option);
484
+ });
485
+ }); // Construct the base Image component props by filtering out Cloudinary-specific props
486
+
381
487
  var imageProps = {};
382
488
  Object.keys(props).filter(function (key) {
383
- return !options.includes(key);
489
+ return !CLD_OPTIONS.includes(key);
384
490
  }).forEach(function (key) {
385
491
  return imageProps[key] = props[key];
386
492
  }); // Construct Cloudinary-specific props by looking for values for any of the supported prop keys
387
493
 
388
494
  var cldOptions = {};
389
- options.forEach(function (key) {
495
+ CLD_OPTIONS.forEach(function (key) {
390
496
  if (props[key]) {
391
497
  cldOptions[key] = props[key];
392
498
  }
@@ -1 +1 @@
1
- {"version":3,"file":"next-cloudinary.js","sources":["../src/lib/cloudinary.js","../src/plugins/cropping.js","../src/constants/qualifiers.js","../src/plugins/overlays.js","../src/plugins/remove-background.js","../src/plugins/tint.js","../src/plugins/underlays.js","../src/loaders/cloudinary-loader.js","../src/constants/options.js","../src/components/CldImage/CldImage.js"],"sourcesContent":["import { Cloudinary } from '@cloudinary/url-gen';\n\nconst cld = new Cloudinary({\n cloud: {\n cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME\n },\n url: {\n // Used to avoid issues with SSR particularly for the blurred placeholder\n analytics: false\n }\n});\n\n/**\n * createPlaceholderUrl\n */\n\nexport function createPlaceholderUrl({ src, placeholder }) {\n const cldImage = cld.image(src)\n .resize('c_limit,w_100')\n .delivery('q_1')\n .format('auto');\n\n if ( placeholder === 'grayscale' ) {\n cldImage.effect('e_grayscale');\n }\n\n if ( placeholder.includes('color:') ) {\n const color = placeholder.split(':').splice(1).join(':')\n cldImage.effect('e_grayscale');\n cldImage.effect(`e_colorize:60,co_${color}`);\n }\n\n return cldImage.toURL();\n}","const cropsGravityAuto = [ 'crop', 'fill', 'lfill', 'fill_pad', 'thumb' ];\n\nexport function croppingPlugin({ cldImage, options, cldOptions } = {}) {\n const { width, height } = options;\n const { crop = 'limit', gravity } = cldOptions;\n\n let transformationString = `c_${crop},w_${width}`;\n\n if ( !gravity && cropsGravityAuto.includes(crop) ) {\n gravity = 'auto';\n }\n\n if ( !['limit'].includes(crop) ) {\n transformationString = `${transformationString},h_${height}`;\n }\n\n if ( gravity ) {\n if ( gravity === 'auto' && !cropsGravityAuto.includes(crop) ) {\n console.warn('Auto gravity can only be used with crop, fill, lfill, fill_pad or thumb. Not applying gravity.');\n } else {\n transformationString = `${transformationString},g_${gravity}`;\n }\n }\n\n cldImage.resize(transformationString);\n}","// aspectRatio\n\nexport const primary = {\n aspectRatio: {\n qualifier: 'ar'\n },\n crop: {\n qualifier: 'c'\n },\n gravity: {\n qualifier: 'g'\n },\n height: {\n qualifier: 'h'\n },\n width: {\n qualifier: 'w'\n },\n};\n\nexport const position = {\n angle: {\n qualifier: 'a'\n },\n gravity: {\n qualifier: 'g'\n },\n x: {\n qualifier: 'x'\n },\n y: {\n qualifier: 'y'\n },\n}\n\nexport const text = {\n color: {\n qualifier: 'co',\n location: 'primary'\n },\n fontFamily: {\n qualifier: false\n },\n fontSize: {\n qualifier: false\n },\n fontWeight: {\n qualifier: false\n },\n letterSpacing: {\n qualifier: 'letter_spacing'\n },\n textDecoration: {\n qualifier: false\n }\n}","import {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport function overlaysPlugin({ cldImage, options, cldOptions } = {}) {\n const { overlays = [] } = cldOptions;\n\n const type = 'overlay';\n const typeQualifier = 'l';\n\n overlays.forEach(({ publicId, position, text, effects: layerEffects = [], ...options }) => {\n const hasPublicId = typeof publicId === 'string';\n const hasText = typeof text === 'object';\n const hasPosition = typeof position === 'object';\n\n if ( !hasPublicId && !hasText ) {\n console.warn(`An ${type} is missing Public ID or Text`);\n return;\n }\n\n // Start to construct the transformation string using text or the public ID\n // if it's image-based\n\n let layerTransformation;\n\n if ( hasText ) {\n layerTransformation = `${typeQualifier}_text`;\n } else {\n layerTransformation = `${typeQualifier}_${publicId.replace(/\\//g, ':')}`;\n }\n\n // Begin organizing transformations based on what it is and the location\n // it needs to be placed in the URL\n\n const primary = [];\n const applied = [];\n\n // Gemeral options\n\n Object.keys(options).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${options[key]}`);\n });\n\n // Layer effects\n\n layerEffects.forEach(effect => {\n Object.keys(effect).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${effect[key]}`);\n });\n });\n\n // Text styling\n\n if ( hasText ) {\n const textTransformations = [];\n\n Object.keys(text).forEach(key => {\n if ( !qualifiersText[key] ) return;\n\n const { qualifier, location } = qualifiersText[key];\n\n if ( location === 'primary' ) {\n primary.push(`${qualifier}_${text[key]}`);\n } else {\n textTransformations.push(text[key]);\n }\n });\n\n layerTransformation = `${layerTransformation}:${textTransformations.join('_')}:${text.text}`\n }\n\n // Positioning\n\n if ( hasPosition ) {\n Object.keys(position).forEach(key => {\n if ( !qualifiersPosition[key] ) return;\n\n const { qualifier } = qualifiersPosition[key];\n\n applied.push(`${qualifier}_${position[key]}`);\n });\n }\n\n // Add all primary transformations\n\n layerTransformation = `${layerTransformation},${primary.join(',')}`;\n\n // Add all applied transformations\n\n layerTransformation = `${layerTransformation}/fl_layer_apply`;\n\n if ( applied.length > 0 ) {\n layerTransformation = `${layerTransformation},${applied.join(',')}`;\n }\n\n // Finally add it to the image\n\n cldImage.addTransformation(layerTransformation);\n });\n}","export function removeBackgroundPlugin({ cldImage, options, cldOptions } = {}) {\n const { removeBackground = false } = cldOptions;\n if ( removeBackground ) {\n cldImage.effect('e_background_removal');\n }\n}","export function tintPlugin({ cldImage, options, cldOptions } = {}) {\n const { tint } = cldOptions;\n\n if ( tint ) {\n cldImage.effect(`e_tint:${tint}`);\n }\n}","import {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport function underlaysPlugin({ cldImage, options, cldOptions } = {}) {\n const { underlays = [] } = cldOptions;\n\n const type = 'underlay';\n const typeQualifier = 'u';\n\n underlays.forEach(({ publicId, type, position, text, effects: layerEffects = [], ...options }) => {\n const hasPublicId = typeof publicId === 'string';\n const hasPosition = typeof position === 'object';\n\n if ( !hasPublicId ) {\n console.warn(`An ${type} is missing a Public ID`);\n return;\n }\n\n // Start to construct the transformation string using text or the public ID\n // if it's image-based\n\n let layerTransformation = `${typeQualifier}_${publicId.replace(/\\//g, ':')}`;\n\n // Begin organizing transformations based on what it is and the location\n // it needs to be placed in the URL\n\n const primary = [];\n const applied = [];\n\n // Gemeral options\n\n Object.keys(options).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${options[key]}`);\n });\n\n // Layer effects\n\n layerEffects.forEach(effect => {\n Object.keys(effect).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${effect[key]}`);\n });\n });\n\n // Positioning\n\n if ( hasPosition ) {\n Object.keys(position).forEach(key => {\n if ( !qualifiersPosition[key] ) return;\n\n const { qualifier } = qualifiersPosition[key];\n\n applied.push(`${qualifier}_${position[key]}`);\n });\n }\n\n // Add all primary transformations\n\n layerTransformation = `${layerTransformation},${primary.join(',')}`;\n\n // Add all applied transformations\n\n layerTransformation = `${layerTransformation}/fl_layer_apply`;\n\n if ( applied.length > 0 ) {\n layerTransformation = `${layerTransformation},${applied.join(',')}`;\n }\n\n // Finally add it to the image\n\n cldImage.addTransformation(layerTransformation);\n });\n}","import { Cloudinary } from '@cloudinary/url-gen';\n\nimport { croppingPlugin } from '../plugins/cropping';\nimport { overlaysPlugin } from '../plugins/overlays';\nimport { removeBackgroundPlugin } from '../plugins/remove-background';\nimport { tintPlugin } from '../plugins/tint';\nimport { underlaysPlugin } from '../plugins/underlays';\n\nimport {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nconst cld = new Cloudinary({\n cloud: {\n cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME\n },\n});\n\nconst transformationPlugins = [\n removeBackgroundPlugin, // Background Removal must always come first\n croppingPlugin,\n tintPlugin,\n overlaysPlugin,\n underlaysPlugin\n];\n\nexport function cloudinaryLoader(options, cldOptions) {\n const {\n src,\n width,\n format = 'auto',\n quality = 'auto',\n } = options;\n\n const cldImage = cld.image(src);\n\n transformationPlugins.forEach(plugin => {\n plugin({\n cldImage,\n options,\n cldOptions\n });\n });\n\n return cldImage.format(format).delivery(`q_${quality}`).toURL();\n}","export const options = [\n 'crop',\n 'gravity',\n 'overlays',\n 'removeBackground',\n 'tint',\n 'underlays',\n];\n\n\n","import Image from 'next/image';\n\nimport { createPlaceholderUrl } from '../../lib/cloudinary';\nimport { cloudinaryLoader } from '../../loaders/cloudinary-loader';\n\nimport { options as CLD_OPTIONS } from '../../constants/options';\n\nconst CldImage = props => {\n\n // Construct the base Image component props by filtering out Cloudinary-specific props\n\n const imageProps = {};\n\n Object.keys(props)\n .filter(key => !CLD_OPTIONS.includes(key))\n .forEach(key => imageProps[key] = props[key]);\n\n // Construct Cloudinary-specific props by looking for values for any of the supported prop keys\n\n const cldOptions = {};\n\n CLD_OPTIONS.forEach(key => {\n if ( props[key] ) {\n cldOptions[key] = props[key];\n }\n });\n\n // If we see a placeholder option, configure a Cloudinary-based URL.\n // The resulting image will always be blurred per Next.js, so we're\n // limited on options for placeholders.\n //\n // We need to do this logic here as we potentially need to mutate\n // an Image component prop as opposed to simply the URL\n //\n // https://nextjs.org/docs/api-reference/next/image#blurdataurl\n\n if ( imageProps.placeholder ) {\n imageProps.blurDataURL = createPlaceholderUrl({\n src: props.src,\n placeholder: props.placeholder\n });\n\n if ( imageProps.placeholder !== 'blur' ) {\n imageProps.placeholder = 'blur';\n }\n }\n\n return (\n <Image\n {...imageProps}\n loader={(options) => cloudinaryLoader({ ...imageProps, options }, cldOptions)}\n />\n );\n}\n\nexport default CldImage;"],"names":["cld","Cloudinary","cloud","cloudName","process","env","NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME","url","analytics","createPlaceholderUrl","src","placeholder","cldImage","image","resize","delivery","format","effect","includes","color","split","splice","join","toURL","cropsGravityAuto","croppingPlugin","options","cldOptions","width","height","crop","gravity","transformationString","console","warn","primary","aspectRatio","qualifier","position","angle","x","y","text","location","fontFamily","fontSize","fontWeight","letterSpacing","textDecoration","overlaysPlugin","overlays","type","typeQualifier","forEach","publicId","effects","layerEffects","_excluded","hasPublicId","hasText","hasPosition","layerTransformation","replace","applied","Object","keys","key","qualifiersPrimary","push","textTransformations","qualifiersText","qualifiersPosition","length","addTransformation","removeBackgroundPlugin","removeBackground","tintPlugin","tint","underlaysPlugin","underlays","transformationPlugins","cloudinaryLoader","quality","plugin","CldImage","props","imageProps","filter","CLD_OPTIONS","blurDataURL","_jsx","Image"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,KAAG,GAAG,IAAIC,iBAAJ,CAAe;AACzBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,SAAS,EAAEC,OAAO,CAACC,GAAR,CAAYC,iCAAAA;GAFA;AAIzBC,EAAAA,GAAG,EAAE;AACH;AACAC,IAAAA,SAAS,EAAE,KAAA;AAFR,GAAA;AAJoB,CAAf,CAAZ,CAAA;AAUA;AACA;AACA;;AAEO,SAASC,oBAAT,CAAoD,I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D,KAAA;AACF,GAJD,EAdwB;AAqBxB;AACA;AACA;AACA;AACA;AACA;AACA;;EAEA,IAAKoB,UAAU,CAAC3E,WAAhB,EAA8B;AAC5B2E,IAAAA,UAAU,CAACG,WAAX,GAAyBhF,oBAAoB,CAAC;MAC5CC,GAAG,EAAE2E,KAAK,CAAC3E,GADiC;MAE5CC,WAAW,EAAE0E,KAAK,CAAC1E,WAAAA;AAFyB,KAAD,CAA7C,CAAA;;AAKA,IAAA,IAAK2E,UAAU,CAAC3E,WAAX,KAA2B,MAAhC,EAAyC;MACvC2E,UAAU,CAAC3E,WAAX,GAAyB,MAAzB,CAAA;AACD,KAAA;AACF,GAAA;;EAED,oBACE+E,cAAA,CAACC,yBAAD,EAAA,QAAA,CAAA,EAAA,EACML,UADN,EAAA;IAEE,MAAM,EAAE,gBAAC5D,OAAD,EAAA;MAAA,OAAauD,gBAAgB,cAAMK,UAAN,EAAA;AAAkB5D,QAAAA,OAAO,EAAPA,OAAAA;AAAlB,OAAA,CAAA,EAA6BC,UAA7B,CAA7B,CAAA;AAAA,KAAA;GAHZ,CAAA,CAAA,CAAA;AAMD;;;;;;;;"}
1
+ {"version":3,"file":"next-cloudinary.js","sources":["../src/lib/cloudinary.js","../src/plugins/cropping.js","../src/constants/qualifiers.js","../src/plugins/overlays.js","../src/plugins/remove-background.js","../src/plugins/effects.js","../src/plugins/underlays.js","../src/loaders/cloudinary-loader.js","../src/constants/options.js","../src/components/CldImage/CldImage.js"],"sourcesContent":["import { Cloudinary } from '@cloudinary/url-gen';\n\nconst cld = new Cloudinary({\n cloud: {\n cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME\n },\n url: {\n // Used to avoid issues with SSR particularly for the blurred placeholder\n analytics: false\n }\n});\n\n/**\n * createPlaceholderUrl\n */\n\nexport function createPlaceholderUrl({ src, placeholder }) {\n const cldImage = cld.image(src)\n .resize('c_limit,w_100')\n .delivery('q_1')\n .format('auto');\n\n if ( placeholder === 'grayscale' ) {\n cldImage.effect('e_grayscale');\n }\n\n if ( placeholder.includes('color:') ) {\n const color = placeholder.split(':').splice(1).join(':')\n cldImage.effect('e_grayscale');\n cldImage.effect(`e_colorize:60,co_${color}`);\n }\n\n return cldImage.toURL();\n}","const cropsGravityAuto = [ 'crop', 'fill', 'lfill', 'fill_pad', 'thumb' ];\n\nexport const options = ['crop', 'gravity'];\n\nexport function plugin({ cldImage, options, cldOptions } = {}) {\n const { width, height } = options;\n const { crop = 'limit', gravity } = cldOptions;\n\n let transformationString = `c_${crop},w_${width}`;\n\n if ( !gravity && cropsGravityAuto.includes(crop) ) {\n gravity = 'auto';\n }\n\n if ( !['limit'].includes(crop) ) {\n transformationString = `${transformationString},h_${height}`;\n }\n\n if ( gravity ) {\n if ( gravity === 'auto' && !cropsGravityAuto.includes(crop) ) {\n console.warn('Auto gravity can only be used with crop, fill, lfill, fill_pad or thumb. Not applying gravity.');\n } else {\n transformationString = `${transformationString},g_${gravity}`;\n }\n }\n\n cldImage.resize(transformationString);\n}","// aspectRatio\n\nexport const primary = {\n aspectRatio: {\n qualifier: 'ar'\n },\n crop: {\n qualifier: 'c'\n },\n gravity: {\n qualifier: 'g'\n },\n height: {\n qualifier: 'h'\n },\n width: {\n qualifier: 'w'\n },\n};\n\nexport const position = {\n angle: {\n qualifier: 'a'\n },\n gravity: {\n qualifier: 'g'\n },\n x: {\n qualifier: 'x'\n },\n y: {\n qualifier: 'y'\n },\n}\n\nexport const text = {\n color: {\n qualifier: 'co',\n location: 'primary'\n },\n fontFamily: {\n qualifier: false\n },\n fontSize: {\n qualifier: false\n },\n fontWeight: {\n qualifier: false\n },\n letterSpacing: {\n qualifier: 'letter_spacing'\n },\n textDecoration: {\n qualifier: false\n }\n}","import {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport const options = ['overlays'];\n\nexport function plugin({ cldImage, options, cldOptions } = {}) {\n const { overlays = [] } = cldOptions;\n\n const type = 'overlay';\n const typeQualifier = 'l';\n\n overlays.forEach(({ publicId, position, text, effects: layerEffects = [], ...options }) => {\n const hasPublicId = typeof publicId === 'string';\n const hasText = typeof text === 'object';\n const hasPosition = typeof position === 'object';\n\n if ( !hasPublicId && !hasText ) {\n console.warn(`An ${type} is missing Public ID or Text`);\n return;\n }\n\n // Start to construct the transformation string using text or the public ID\n // if it's image-based\n\n let layerTransformation;\n\n if ( hasText ) {\n layerTransformation = `${typeQualifier}_text`;\n } else {\n layerTransformation = `${typeQualifier}_${publicId.replace(/\\//g, ':')}`;\n }\n\n // Begin organizing transformations based on what it is and the location\n // it needs to be placed in the URL\n\n const primary = [];\n const applied = [];\n\n // Gemeral options\n\n Object.keys(options).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${options[key]}`);\n });\n\n // Layer effects\n\n layerEffects.forEach(effect => {\n Object.keys(effect).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${effect[key]}`);\n });\n });\n\n // Text styling\n\n if ( hasText ) {\n const textTransformations = [];\n\n Object.keys(text).forEach(key => {\n if ( !qualifiersText[key] ) return;\n\n const { qualifier, location } = qualifiersText[key];\n\n if ( location === 'primary' ) {\n primary.push(`${qualifier}_${text[key]}`);\n } else {\n textTransformations.push(text[key]);\n }\n });\n\n layerTransformation = `${layerTransformation}:${textTransformations.join('_')}:${text.text}`\n }\n\n // Positioning\n\n if ( hasPosition ) {\n Object.keys(position).forEach(key => {\n if ( !qualifiersPosition[key] ) return;\n\n const { qualifier } = qualifiersPosition[key];\n\n applied.push(`${qualifier}_${position[key]}`);\n });\n }\n\n // Add all primary transformations\n\n layerTransformation = `${layerTransformation},${primary.join(',')}`;\n\n // Add all applied transformations\n\n layerTransformation = `${layerTransformation}/fl_layer_apply`;\n\n if ( applied.length > 0 ) {\n layerTransformation = `${layerTransformation},${applied.join(',')}`;\n }\n\n // Finally add it to the image\n\n cldImage.addTransformation(layerTransformation);\n });\n}","export const options = ['removeBackground'];\n\nexport function plugin({ cldImage, options, cldOptions } = {}) {\n const { removeBackground = false } = cldOptions;\n if ( removeBackground ) {\n cldImage.effect('e_background_removal');\n }\n}","const params = [\n 'art',\n {\n prop: 'autoBrightness',\n effect: 'auto_brightness',\n },\n {\n prop: 'autoColor',\n effect: 'auto_color',\n },\n {\n prop: 'autoContrast',\n effect: 'auto_contrast',\n },\n {\n prop: 'assistColorblind',\n effect: 'assist_colorblind',\n },\n 'blackwhite',\n 'blur',\n {\n prop: 'blurFaces',\n effect: 'blur_faces',\n },\n {\n prop: 'blurRegion',\n effect: 'blur_region',\n },\n 'brightness',\n {\n prop: 'brightnessHSB',\n effect: 'brightness_hsb',\n },\n 'cartoonify',\n 'colorize',\n 'contrast',\n 'distort',\n {\n prop: 'fillLight',\n effect: 'fill_light',\n },\n 'gamma',\n {\n prop: 'gradientFade',\n effect: 'gradient_fade',\n },\n 'grayscale',\n 'improve',\n 'negate',\n {\n prop: 'oilPaint',\n effect: 'oil_paint',\n },\n 'outline',\n 'pixelate',\n {\n prop: 'pixelateFaces',\n effect: 'pixelate_faces',\n },\n {\n prop: 'pixelateRegion',\n effect: 'pixelate_region',\n },\n 'redeye',\n {\n prop: 'replaceColor',\n effect: 'replace_color',\n },\n 'saturation',\n 'sepia',\n 'shadow',\n 'sharpen',\n 'shear',\n {\n prop: 'simulateColorblind',\n effect: 'simulate_colorblind',\n },\n 'tint',\n {\n prop: 'unsharpMask',\n effect: 'unsharp_mask',\n },\n 'vectorize',\n 'vibrance',\n 'vignette',\n // 'zoompan' // requires GIF format\n];\n\nexport const options = params.map(param => param.prop || param);\n\nexport function plugin({ cldImage, cldOptions } = {}) {\n params.forEach(key => {\n\n const prop = key.prop || key;\n const effect = key.effect || key;\n\n if ( prop === 'oilPaint' && cldOptions[prop]) {\n console.log('cldOptions[prop]', cldOptions[prop])\n }\n if ( cldOptions[prop] === true ) {\n cldImage.effect(`e_${effect}`);\n } else if ( typeof cldOptions[prop] === 'string' ) {\n cldImage.effect(`e_${effect}:${cldOptions[prop]}`);\n }\n });\n}","import {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport const options = ['underlays'];\n\nexport function plugin({ cldImage, options, cldOptions } = {}) {\n const { underlays = [] } = cldOptions;\n\n const type = 'underlay';\n const typeQualifier = 'u';\n\n underlays.forEach(({ publicId, type, position, text, effects: layerEffects = [], ...options }) => {\n const hasPublicId = typeof publicId === 'string';\n const hasPosition = typeof position === 'object';\n\n if ( !hasPublicId ) {\n console.warn(`An ${type} is missing a Public ID`);\n return;\n }\n\n // Start to construct the transformation string using text or the public ID\n // if it's image-based\n\n let layerTransformation = `${typeQualifier}_${publicId.replace(/\\//g, ':')}`;\n\n // Begin organizing transformations based on what it is and the location\n // it needs to be placed in the URL\n\n const primary = [];\n const applied = [];\n\n // Gemeral options\n\n Object.keys(options).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${options[key]}`);\n });\n\n // Layer effects\n\n layerEffects.forEach(effect => {\n Object.keys(effect).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${effect[key]}`);\n });\n });\n\n // Positioning\n\n if ( hasPosition ) {\n Object.keys(position).forEach(key => {\n if ( !qualifiersPosition[key] ) return;\n\n const { qualifier } = qualifiersPosition[key];\n\n applied.push(`${qualifier}_${position[key]}`);\n });\n }\n\n // Add all primary transformations\n\n layerTransformation = `${layerTransformation},${primary.join(',')}`;\n\n // Add all applied transformations\n\n layerTransformation = `${layerTransformation}/fl_layer_apply`;\n\n if ( applied.length > 0 ) {\n layerTransformation = `${layerTransformation},${applied.join(',')}`;\n }\n\n // Finally add it to the image\n\n cldImage.addTransformation(layerTransformation);\n });\n}","import { Cloudinary } from '@cloudinary/url-gen';\n\nimport * as croppingPlugin from '../plugins/cropping';\nimport * as overlaysPlugin from '../plugins/overlays';\nimport * as removeBackgroundPlugin from '../plugins/remove-background';\nimport * as effectsPlugin from '../plugins/effects';\nimport * as underlaysPlugin from '../plugins/underlays';\n\nimport {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nconst cld = new Cloudinary({\n cloud: {\n cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME\n },\n});\n\nexport const transformationPlugins = [\n removeBackgroundPlugin, // Background Removal must always come first\n croppingPlugin,\n effectsPlugin,\n overlaysPlugin,\n underlaysPlugin\n];\n\nexport function cloudinaryLoader(options, cldOptions) {\n const {\n src,\n width,\n format = 'auto',\n quality = 'auto',\n } = options;\n\n const cldImage = cld.image(src);\n\n transformationPlugins.forEach(({ plugin }) => {\n plugin({\n cldImage,\n options,\n cldOptions\n });\n });\n\n return cldImage.format(format).delivery(`q_${quality}`).toURL();\n}","export const options = [];","import Image from 'next/image';\n\nimport { createPlaceholderUrl } from '../../lib/cloudinary';\nimport { cloudinaryLoader, transformationPlugins } from '../../loaders/cloudinary-loader';\n\nimport { options as defaultOptions } from '../../constants/options';\n\nconst CldImage = props => {\n\n const CLD_OPTIONS = [...defaultOptions];\n\n transformationPlugins.forEach(({ options = [] }) => {\n options.forEach(option => {\n if ( CLD_OPTIONS.includes(option) ) {\n throw new Error(`Option ${option} already exists!`);\n }\n CLD_OPTIONS.push(option);\n });\n })\n\n // Construct the base Image component props by filtering out Cloudinary-specific props\n\n const imageProps = {};\n\n Object.keys(props)\n .filter(key => !CLD_OPTIONS.includes(key))\n .forEach(key => imageProps[key] = props[key]);\n\n // Construct Cloudinary-specific props by looking for values for any of the supported prop keys\n\n const cldOptions = {};\n\n CLD_OPTIONS.forEach(key => {\n if ( props[key] ) {\n cldOptions[key] = props[key];\n }\n });\n\n // If we see a placeholder option, configure a Cloudinary-based URL.\n // The resulting image will always be blurred per Next.js, so we're\n // limited on options for placeholders.\n //\n // We need to do this logic here as we potentially need to mutate\n // an Image component prop as opposed to simply the URL\n //\n // https://nextjs.org/docs/api-reference/next/image#blurdataurl\n\n if ( imageProps.placeholder ) {\n imageProps.blurDataURL = createPlaceholderUrl({\n src: props.src,\n placeholder: props.placeholder\n });\n\n if ( imageProps.placeholder !== 'blur' ) {\n imageProps.placeholder = 'blur';\n }\n }\n\n return (\n <Image\n {...imageProps}\n loader={(options) => cloudinaryLoader({ ...imageProps, options }, cldOptions)}\n />\n );\n}\n\nexport default CldImage;"],"names":["cld","Cloudinary","cloud","cloudName","process","env","NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME","url","analytics","createPlaceholderUrl","src","placeholder","cldImage","image","resize","delivery","format","effect","includes","color","split","splice","join","toURL","cropsGravityAuto","options","plugin","cldOptions","width","height","crop","gravity","transformationString","console","warn","primary","aspectRatio","qualifier","position","angle","x","y","text","location","fontFamily","fontSize","fontWeight","letterSpacing","textDecoration","overlays","type","typeQualifier","forEach","publicId","effects","layerEffects","_excluded","hasPublicId","hasText","hasPosition","layerTransformation","replace","applied","Object","keys","key","qualifiersPrimary","push","textTransformations","qualifiersText","qualifiersPosition","length","addTransformation","removeBackground","params","prop","map","param","log","underlays","transformationPlugins","removeBackgroundPlugin","croppingPlugin","effectsPlugin","overlaysPlugin","underlaysPlugin","cloudinaryLoader","quality","CldImage","props","CLD_OPTIONS","defaultOptions","option","Error","imageProps","filter","blurDataURL","_jsx","Image"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,KAAG,GAAG,IAAIC,iBAAJ,CAAe;AACzBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,SAAS,EAAEC,OAAO,CAACC,GAAR,CAAYC,iCAAAA;GAFA;AAIzBC,EAAAA,GAAG,EAAE;AACH;AACAC,IAAAA,SAAS,EAAE,KAAA;AAFR,GAAA;AAJoB,CAAf,CAAZ,CAAA;AAUA;AACA;AACA;;AA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