@tsparticles/shape-image 3.3.0 → 3.5.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 (46) hide show
  1. package/browser/GifUtils/Enums/DisposalMethod.js +11 -1
  2. package/browser/GifUtils/Types/GIFDataHeaders.js +10 -1
  3. package/browser/GifUtils/Utils.js +19 -17
  4. package/browser/ImageDrawer.js +1 -0
  5. package/browser/ImagePreloader.js +1 -1
  6. package/browser/Utils.js +1 -1
  7. package/browser/index.js +4 -3
  8. package/cjs/GifUtils/Enums/DisposalMethod.js +12 -0
  9. package/cjs/GifUtils/Types/GIFDataHeaders.js +11 -0
  10. package/cjs/GifUtils/Utils.js +24 -23
  11. package/cjs/ImageDrawer.js +1 -0
  12. package/cjs/ImagePreloader.js +1 -1
  13. package/cjs/Utils.js +4 -5
  14. package/cjs/index.js +7 -7
  15. package/esm/GifUtils/Enums/DisposalMethod.js +11 -1
  16. package/esm/GifUtils/Types/GIFDataHeaders.js +10 -1
  17. package/esm/GifUtils/Utils.js +19 -17
  18. package/esm/ImageDrawer.js +1 -0
  19. package/esm/ImagePreloader.js +1 -1
  20. package/esm/Utils.js +1 -1
  21. package/esm/index.js +4 -3
  22. package/package.json +2 -2
  23. package/report.html +1 -1
  24. package/tsparticles.shape.image.js +82 -200
  25. package/tsparticles.shape.image.min.js +1 -1
  26. package/tsparticles.shape.image.min.js.LICENSE.txt +1 -1
  27. package/types/GifUtils/Enums/DisposalMethod.d.ts +1 -1
  28. package/types/GifUtils/Types/GIFDataHeaders.d.ts +1 -1
  29. package/types/GifUtils/Utils.d.ts +1 -1
  30. package/types/ImageDrawer.d.ts +1 -0
  31. package/umd/GifUtils/Enums/DisposalMethod.js +12 -0
  32. package/umd/GifUtils/Types/GIFDataHeaders.js +11 -0
  33. package/umd/GifUtils/Utils.js +25 -48
  34. package/umd/ImageDrawer.js +1 -0
  35. package/umd/ImagePreloader.js +1 -1
  36. package/umd/Utils.js +4 -5
  37. package/umd/index.js +8 -32
  38. package/329.min.js +0 -2
  39. package/329.min.js.LICENSE.txt +0 -1
  40. package/33.min.js +0 -2
  41. package/33.min.js.LICENSE.txt +0 -1
  42. package/715.min.js +0 -2
  43. package/715.min.js.LICENSE.txt +0 -1
  44. package/dist_browser_GifUtils_Utils_js.js +0 -50
  45. package/dist_browser_ImageDrawer_js.js +0 -30
  46. package/dist_browser_ImagePreloader_js.js +0 -40
@@ -1,41 +1,23 @@
1
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2
- if (k2 === undefined) k2 = k;
3
- var desc = Object.getOwnPropertyDescriptor(m, k);
4
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5
- desc = { enumerable: true, get: function() { return m[k]; } };
6
- }
7
- Object.defineProperty(o, k2, desc);
8
- }) : (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- o[k2] = m[k];
11
- }));
12
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
13
- Object.defineProperty(o, "default", { enumerable: true, value: v });
14
- }) : function(o, v) {
15
- o["default"] = v;
16
- });
17
- var __importStar = (this && this.__importStar) || function (mod) {
18
- if (mod && mod.__esModule) return mod;
19
- var result = {};
20
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
21
- __setModuleDefault(result, mod);
22
- return result;
23
- };
24
1
  (function (factory) {
25
2
  if (typeof module === "object" && typeof module.exports === "object") {
26
3
  var v = factory(require, exports);
27
4
  if (v !== undefined) module.exports = v;
28
5
  }
29
6
  else if (typeof define === "function" && define.amd) {
30
- define(["require", "exports", "./Constants.js", "./ByteStream.js"], factory);
7
+ define(["require", "exports", "../Utils.js", "./Constants.js", "./ByteStream.js", "./Enums/DisposalMethod.js", "./Types/GIFDataHeaders.js"], factory);
31
8
  }
32
9
  })(function (require, exports) {
33
10
  "use strict";
34
- var __syncRequire = typeof module === "object" && typeof module.exports === "object";
35
11
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.loadGifImage = exports.drawGif = exports.decodeGIF = exports.getGIFLoopAmount = void 0;
12
+ exports.getGIFLoopAmount = getGIFLoopAmount;
13
+ exports.decodeGIF = decodeGIF;
14
+ exports.drawGif = drawGif;
15
+ exports.loadGifImage = loadGifImage;
16
+ const Utils_js_1 = require("../Utils.js");
37
17
  const Constants_js_1 = require("./Constants.js");
38
18
  const ByteStream_js_1 = require("./ByteStream.js");
19
+ const DisposalMethod_js_1 = require("./Enums/DisposalMethod.js");
20
+ const GIFDataHeaders_js_1 = require("./Types/GIFDataHeaders.js");
39
21
  const origin = {
40
22
  x: 0,
41
23
  y: 0,
@@ -54,7 +36,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
54
36
  }
55
37
  function parseExtensionBlock(byteStream, gif, getFrameIndex, getTransparencyIndex) {
56
38
  switch (byteStream.nextByte()) {
57
- case 249: {
39
+ case GIFDataHeaders_js_1.GIFDataHeaders.GraphicsControlExtension: {
58
40
  const frame = gif.frames[getFrameIndex(false)];
59
41
  byteStream.pos++;
60
42
  const packedByte = byteStream.nextByte();
@@ -70,7 +52,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
70
52
  byteStream.pos++;
71
53
  break;
72
54
  }
73
- case 255: {
55
+ case GIFDataHeaders_js_1.GIFDataHeaders.ApplicationExtension: {
74
56
  byteStream.pos++;
75
57
  const applicationExtension = {
76
58
  identifier: byteStream.getString(8),
@@ -80,11 +62,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
80
62
  gif.applicationExtensions.push(applicationExtension);
81
63
  break;
82
64
  }
83
- case 254: {
65
+ case GIFDataHeaders_js_1.GIFDataHeaders.CommentExtension: {
84
66
  gif.comments.push([getFrameIndex(false), byteStream.readSubBlocks()]);
85
67
  break;
86
68
  }
87
- case 1: {
69
+ case GIFDataHeaders_js_1.GIFDataHeaders.PlainTextExtension: {
88
70
  if (gif.globalColorTable.length === 0) {
89
71
  throw new EvalError("plain text extension without global color table");
90
72
  }
@@ -237,12 +219,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
237
219
  }
238
220
  async function parseBlock(byteStream, gif, avgAlpha, getFrameIndex, getTransparencyIndex, progressCallback) {
239
221
  switch (byteStream.nextByte()) {
240
- case 59:
222
+ case GIFDataHeaders_js_1.GIFDataHeaders.EndOfFile:
241
223
  return true;
242
- case 44:
224
+ case GIFDataHeaders_js_1.GIFDataHeaders.Image:
243
225
  await parseImageBlock(byteStream, gif, avgAlpha, getFrameIndex, getTransparencyIndex, progressCallback);
244
226
  break;
245
- case 33:
227
+ case GIFDataHeaders_js_1.GIFDataHeaders.Extension:
246
228
  parseExtensionBlock(byteStream, gif, getFrameIndex, getTransparencyIndex);
247
229
  break;
248
230
  default:
@@ -259,7 +241,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
259
241
  }
260
242
  return NaN;
261
243
  }
262
- exports.getGIFLoopAmount = getGIFLoopAmount;
263
244
  async function decodeGIF(gifURL, progressCallback, avgAlpha) {
264
245
  if (!avgAlpha)
265
246
  avgAlpha = false;
@@ -338,7 +319,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
338
319
  top: 0,
339
320
  width: 0,
340
321
  height: 0,
341
- disposalMethod: 0,
322
+ disposalMethod: DisposalMethod_js_1.DisposalMethod.Replace,
342
323
  image: new ImageData(1, 1, { colorSpace: "srgb" }),
343
324
  plainTextData: null,
344
325
  userInputDelayFlag: false,
@@ -370,7 +351,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
370
351
  throw error;
371
352
  }
372
353
  }
373
- exports.decodeGIF = decodeGIF;
374
354
  function drawGif(data) {
375
355
  const { context, radius, particle, delta } = data, image = particle.image;
376
356
  if (!image?.gifData || !image.gif) {
@@ -396,20 +376,20 @@ var __importStar = (this && this.__importStar) || function (mod) {
396
376
  }
397
377
  context.scale(radius / image.gifData.width, radius / image.gifData.height);
398
378
  switch (frame.disposalMethod) {
399
- case 4:
400
- case 5:
401
- case 6:
402
- case 7:
403
- case 0:
379
+ case DisposalMethod_js_1.DisposalMethod.UndefinedA:
380
+ case DisposalMethod_js_1.DisposalMethod.UndefinedB:
381
+ case DisposalMethod_js_1.DisposalMethod.UndefinedC:
382
+ case DisposalMethod_js_1.DisposalMethod.UndefinedD:
383
+ case DisposalMethod_js_1.DisposalMethod.Replace:
404
384
  offscreenContext.drawImage(frame.bitmap, frame.left, frame.top);
405
385
  context.drawImage(offscreenCanvas, pos.x, pos.y);
406
386
  offscreenContext.clearRect(origin.x, origin.y, offscreenCanvas.width, offscreenCanvas.height);
407
387
  break;
408
- case 1:
388
+ case DisposalMethod_js_1.DisposalMethod.Combine:
409
389
  offscreenContext.drawImage(frame.bitmap, frame.left, frame.top);
410
390
  context.drawImage(offscreenCanvas, pos.x, pos.y);
411
391
  break;
412
- case 2:
392
+ case DisposalMethod_js_1.DisposalMethod.RestoreBackground:
413
393
  offscreenContext.drawImage(frame.bitmap, frame.left, frame.top);
414
394
  context.drawImage(offscreenCanvas, pos.x, pos.y);
415
395
  offscreenContext.clearRect(origin.x, origin.y, offscreenCanvas.width, offscreenCanvas.height);
@@ -420,7 +400,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
420
400
  offscreenContext.putImageData(image.gifData.backgroundImage, pos.x, pos.y);
421
401
  }
422
402
  break;
423
- case 3:
403
+ case DisposalMethod_js_1.DisposalMethod.RestorePrevious:
424
404
  {
425
405
  const previousImageData = offscreenContext.getImageData(origin.x, origin.y, offscreenCanvas.width, offscreenCanvas.height);
426
406
  offscreenContext.drawImage(frame.bitmap, frame.left, frame.top);
@@ -444,11 +424,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
444
424
  }
445
425
  context.scale(image.gifData.width / radius, image.gifData.height / radius);
446
426
  }
447
- exports.drawGif = drawGif;
448
427
  async function loadGifImage(image) {
449
428
  if (image.type !== "gif") {
450
- const { loadImage } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("../Utils.js"))) : new Promise((resolve_1, reject_1) => { require(["../Utils.js"], resolve_1, reject_1); }).then(__importStar));
451
- await loadImage(image);
429
+ await (0, Utils_js_1.loadImage)(image);
452
430
  return;
453
431
  }
454
432
  image.loading = true;
@@ -464,5 +442,4 @@ var __importStar = (this && this.__importStar) || function (mod) {
464
442
  }
465
443
  image.loading = false;
466
444
  }
467
- exports.loadGifImage = loadGifImage;
468
445
  });
@@ -16,6 +16,7 @@
16
16
  const double = 2, defaultAlpha = 1, sides = 12, defaultRatio = 1;
17
17
  class ImageDrawer {
18
18
  constructor(engine) {
19
+ this.validTypes = ["image", "images"];
19
20
  this.loadImageShape = async (imageShape) => {
20
21
  if (!this._engine.loadImage) {
21
22
  throw new Error(`${engine_1.errorPrefix} image shape not initialized`);
@@ -29,7 +29,7 @@
29
29
  }
30
30
  const preloadOptions = options.preload;
31
31
  for (const item of source.preload) {
32
- const existing = preloadOptions.find((t) => t.name === item.name || t.src === item.src);
32
+ const existing = preloadOptions.find(t => t.name === item.name || t.src === item.src);
33
33
  if (existing) {
34
34
  existing.load(item);
35
35
  }
package/umd/Utils.js CHANGED
@@ -9,7 +9,9 @@
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.replaceImageColor = exports.downloadSvgImage = exports.loadImage = void 0;
12
+ exports.loadImage = loadImage;
13
+ exports.downloadSvgImage = downloadSvgImage;
14
+ exports.replaceImageColor = replaceImageColor;
13
15
  const engine_1 = require("@tsparticles/engine");
14
16
  const stringStart = 0, defaultOpacity = 1;
15
17
  const currentColorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d.]+%?\))|currentcolor/gi;
@@ -44,7 +46,6 @@
44
46
  img.src = image.source;
45
47
  });
46
48
  }
47
- exports.loadImage = loadImage;
48
49
  async function downloadSvgImage(image) {
49
50
  if (image.type !== "svg") {
50
51
  await loadImage(image);
@@ -61,7 +62,6 @@
61
62
  }
62
63
  image.loading = false;
63
64
  }
64
- exports.downloadSvgImage = downloadSvgImage;
65
65
  function replaceImageColor(image, imageData, color, particle) {
66
66
  const svgColoredData = replaceColorSvg(image, color, particle.opacity?.value ?? defaultOpacity), imageRes = {
67
67
  color,
@@ -75,7 +75,7 @@
75
75
  replaceColor: imageData.replaceColor,
76
76
  source: imageData.src,
77
77
  };
78
- return new Promise((resolve) => {
78
+ return new Promise(resolve => {
79
79
  const svg = new Blob([svgColoredData], { type: "image/svg+xml" }), domUrl = URL || window.URL || window.webkitURL || window, url = domUrl.createObjectURL(svg), img = new Image();
80
80
  img.addEventListener("load", () => {
81
81
  imageRes.loaded = true;
@@ -99,5 +99,4 @@
99
99
  img.src = url;
100
100
  });
101
101
  }
102
- exports.replaceImageColor = replaceImageColor;
103
102
  });
package/umd/index.js CHANGED
@@ -1,41 +1,20 @@
1
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2
- if (k2 === undefined) k2 = k;
3
- var desc = Object.getOwnPropertyDescriptor(m, k);
4
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5
- desc = { enumerable: true, get: function() { return m[k]; } };
6
- }
7
- Object.defineProperty(o, k2, desc);
8
- }) : (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- o[k2] = m[k];
11
- }));
12
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
13
- Object.defineProperty(o, "default", { enumerable: true, value: v });
14
- }) : function(o, v) {
15
- o["default"] = v;
16
- });
17
- var __importStar = (this && this.__importStar) || function (mod) {
18
- if (mod && mod.__esModule) return mod;
19
- var result = {};
20
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
21
- __setModuleDefault(result, mod);
22
- return result;
23
- };
24
1
  (function (factory) {
25
2
  if (typeof module === "object" && typeof module.exports === "object") {
26
3
  var v = factory(require, exports);
27
4
  if (v !== undefined) module.exports = v;
28
5
  }
29
6
  else if (typeof define === "function" && define.amd) {
30
- define(["require", "exports", "./Utils.js", "@tsparticles/engine"], factory);
7
+ define(["require", "exports", "./Utils.js", "./ImageDrawer.js", "./ImagePreloader.js", "@tsparticles/engine", "./GifUtils/Utils.js"], factory);
31
8
  }
32
9
  })(function (require, exports) {
33
10
  "use strict";
34
- var __syncRequire = typeof module === "object" && typeof module.exports === "object";
35
11
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.loadImageShape = void 0;
12
+ exports.loadImageShape = loadImageShape;
37
13
  const Utils_js_1 = require("./Utils.js");
14
+ const ImageDrawer_js_1 = require("./ImageDrawer.js");
15
+ const ImagePreloader_js_1 = require("./ImagePreloader.js");
38
16
  const engine_1 = require("@tsparticles/engine");
17
+ const Utils_js_2 = require("./GifUtils/Utils.js");
39
18
  const extLength = 3;
40
19
  function addLoadImageToEngine(engine) {
41
20
  if (engine.loadImage) {
@@ -65,8 +44,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
65
44
  engine.images.push(image);
66
45
  let imageFunc;
67
46
  if (data.gif) {
68
- const { loadGifImage } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./GifUtils/Utils.js"))) : new Promise((resolve_1, reject_1) => { require(["./GifUtils/Utils.js"], resolve_1, reject_1); }).then(__importStar));
69
- imageFunc = loadGifImage;
47
+ imageFunc = Utils_js_2.loadGifImage;
70
48
  }
71
49
  else {
72
50
  imageFunc = data.replaceColor ? Utils_js_1.downloadSvgImage : Utils_js_1.loadImage;
@@ -80,10 +58,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
80
58
  }
81
59
  async function loadImageShape(engine, refresh = true) {
82
60
  addLoadImageToEngine(engine);
83
- const { ImagePreloaderPlugin } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./ImagePreloader.js"))) : new Promise((resolve_2, reject_2) => { require(["./ImagePreloader.js"], resolve_2, reject_2); }).then(__importStar)), { ImageDrawer } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./ImageDrawer.js"))) : new Promise((resolve_3, reject_3) => { require(["./ImageDrawer.js"], resolve_3, reject_3); }).then(__importStar));
84
- const preloader = new ImagePreloaderPlugin(engine);
61
+ const preloader = new ImagePreloader_js_1.ImagePreloaderPlugin(engine);
85
62
  await engine.addPlugin(preloader, refresh);
86
- await engine.addShape(["image", "images"], new ImageDrawer(engine), refresh);
63
+ await engine.addShape(new ImageDrawer_js_1.ImageDrawer(engine), refresh);
87
64
  }
88
- exports.loadImageShape = loadImageShape;
89
65
  });
package/329.min.js DELETED
@@ -1,2 +0,0 @@
1
- /*! For license information please see 329.min.js.LICENSE.txt */
2
- (this.webpackChunk_tsparticles_shape_image=this.webpackChunk_tsparticles_shape_image||[]).push([[329],{329:(t,e,a)=>{a.d(e,{zS:()=>p,loadGifImage:()=>w});const o=[0,4,2,1],i=[8,8,4,2];class s{constructor(t){this.pos=0,this.data=new Uint8ClampedArray(t)}getString(t){const e=this.data.slice(this.pos,this.pos+t);return this.pos+=e.length,e.reduce(((t,e)=>t+String.fromCharCode(e)),"")}nextByte(){return this.data[this.pos++]}nextTwoBytes(){return this.pos+=2,this.data[this.pos-2]+(this.data[this.pos-1]<<8)}readSubBlocks(){let t="",e=0;do{e=this.data[this.pos++];for(let a=e;--a>=0;t+=String.fromCharCode(this.data[this.pos++]));}while(0!==e);return t}readSubBlocksBin(){let t=this.data[this.pos],e=0;for(let a=0;0!==t;a+=t+1,t=this.data[this.pos+a])e+=t;const a=new Uint8Array(e);t=this.data[this.pos++];for(let e=0;0!==t;t=this.data[this.pos++])for(let o=t;--o>=0;a[e++]=this.data[this.pos++]);return a}skipSubBlocks(){for(const t=1,e=0;this.data[this.pos]!==e;this.pos+=this.data[this.pos]+t);this.pos++}}const r={x:0,y:0},n=0,l=.5,h=0,c=0,g=0;function f(t,e){const a=[];for(let o=0;o<e;o++)a.push({r:t.data[t.pos],g:t.data[t.pos+1],b:t.data[t.pos+2]}),t.pos+=3;return a}async function d(t,e,a,s,r,n){switch(t.nextByte()){case 59:return!0;case 44:await async function(t,e,a,s,r,n){const l=e.frames[s(!0)];l.left=t.nextTwoBytes(),l.top=t.nextTwoBytes(),l.width=t.nextTwoBytes(),l.height=t.nextTwoBytes();const h=t.nextByte(),c=128==(128&h),g=64==(64&h);l.sortFlag=32==(32&h),l.reserved=(24&h)>>>3;const d=1<<1+(7&h);c&&(l.localColorTable=f(t,d));const p=t=>{const{r:o,g:i,b:s}=(c?l.localColorTable:e.globalColorTable)[t];return t!==r(null)?{r:o,g:i,b:s,a:255}:{r:o,g:i,b:s,a:a?~~((o+i+s)/3):0}},w=(()=>{try{return new ImageData(l.width,l.height,{colorSpace:"srgb"})}catch(t){if(t instanceof DOMException&&"IndexSizeError"===t.name)return null;throw t}})();if(null==w)throw new EvalError("GIF frame size is to large");const u=t.nextByte(),m=t.readSubBlocksBin(),y=1<<u,b=(t,e)=>{const a=t>>>3,o=7&t;return(m[a]+(m[a+1]<<8)+(m[a+2]<<16)&(1<<e)-1<<o)>>>o};if(g){for(let a=0,r=u+1,h=0,c=[[0]],g=0;g<4;g++){if(o[g]<l.height){let t=0,e=0,s=!1;for(;!s;){const n=a;if(a=b(h,r),h+=r+1,a===y){r=u+1,c.length=y+2;for(let t=0;t<c.length;t++)c[t]=t<y?[t]:[]}else{a>=c.length?c.push(c[n].concat(c[n][0])):n!==y&&c.push(c[n].concat(c[a][0]));for(const s of c[a]){const{r:a,g:r,b:n,a:h}=p(s);w.data.set([a,r,n,h],o[g]*l.width+i[g]*e+t%(4*l.width)),t+=4}c.length===1<<r&&r<12&&r++}t===4*l.width*(e+1)&&(e++,o[g]+i[g]*e>=l.height&&(s=!0))}}n?.(t.pos/(t.data.length-1),s(!1)+1,w,{x:l.left,y:l.top},{width:e.width,height:e.height})}l.image=w,l.bitmap=await createImageBitmap(w)}else{let a=0,o=u+1,i=0,r=-4,h=!1;const c=[[0]];for(;!h;){const t=a;if(a=b(i,o),i+=o,a===y){o=u+1,c.length=y+2;for(let t=0;t<c.length;t++)c[t]=t<y?[t]:[]}else{if(a===y+1){h=!0;break}a>=c.length?c.push(c[t].concat(c[t][0])):t!==y&&c.push(c[t].concat(c[a][0]));for(const t of c[a]){const{r:e,g:a,b:o,a:i}=p(t);w.data.set([e,a,o,i],r+=4)}c.length>=1<<o&&o<12&&o++}}l.image=w,l.bitmap=await createImageBitmap(w),n?.((t.pos+1)/t.data.length,s(!1)+1,l.image,{x:l.left,y:l.top},{width:e.width,height:e.height})}}(t,e,a,s,r,n);break;case 33:!function(t,e,a,o){switch(t.nextByte()){case 249:{const i=e.frames[a(!1)];t.pos++;const s=t.nextByte();i.GCreserved=(224&s)>>>5,i.disposalMethod=(28&s)>>>2,i.userInputDelayFlag=2==(2&s);const r=1==(1&s);i.delayTime=10*t.nextTwoBytes();const n=t.nextByte();r&&o(n),t.pos++;break}case 255:{t.pos++;const a={identifier:t.getString(8),authenticationCode:t.getString(3),data:t.readSubBlocksBin()};e.applicationExtensions.push(a);break}case 254:e.comments.push([a(!1),t.readSubBlocks()]);break;case 1:if(0===e.globalColorTable.length)throw new EvalError("plain text extension without global color table");t.pos++,e.frames[a(!1)].plainTextData={left:t.nextTwoBytes(),top:t.nextTwoBytes(),width:t.nextTwoBytes(),height:t.nextTwoBytes(),charSize:{width:t.nextTwoBytes(),height:t.nextTwoBytes()},foregroundColor:t.nextByte(),backgroundColor:t.nextByte(),text:t.readSubBlocks()};break;default:t.skipSubBlocks()}}(t,e,s,r);break;default:throw new EvalError("undefined block found")}return!1}function p(t){const{context:e,radius:a,particle:o,delta:i}=t,s=o.image;if(!s?.gifData||!s.gif)return;const f=new OffscreenCanvas(s.gifData.width,s.gifData.height),d=f.getContext("2d");if(!d)throw new Error("could not create offscreen canvas context");d.imageSmoothingQuality="low",d.imageSmoothingEnabled=!1,d.clearRect(r.x,r.y,f.width,f.height),void 0===o.gifLoopCount&&(o.gifLoopCount=s.gifLoopCount??g);let p=o.gifFrame??n;const w={x:-s.gifData.width*l,y:-s.gifData.height*l},u=s.gifData.frames[p];if(void 0===o.gifTime&&(o.gifTime=h),u.bitmap){switch(e.scale(a/s.gifData.width,a/s.gifData.height),u.disposalMethod){case 4:case 5:case 6:case 7:case 0:d.drawImage(u.bitmap,u.left,u.top),e.drawImage(f,w.x,w.y),d.clearRect(r.x,r.y,f.width,f.height);break;case 1:d.drawImage(u.bitmap,u.left,u.top),e.drawImage(f,w.x,w.y);break;case 2:d.drawImage(u.bitmap,u.left,u.top),e.drawImage(f,w.x,w.y),d.clearRect(r.x,r.y,f.width,f.height),s.gifData.globalColorTable.length?d.putImageData(s.gifData.backgroundImage,w.x,w.y):d.putImageData(s.gifData.frames[c].image,w.x+u.left,w.y+u.top);break;case 3:{const t=d.getImageData(r.x,r.y,f.width,f.height);d.drawImage(u.bitmap,u.left,u.top),e.drawImage(f,w.x,w.y),d.clearRect(r.x,r.y,f.width,f.height),d.putImageData(t,r.x,r.y)}}if(o.gifTime+=i.value,o.gifTime>u.delayTime){if(o.gifTime-=u.delayTime,++p>=s.gifData.frames.length){if(--o.gifLoopCount<=g)return;p=c,d.clearRect(r.x,r.y,f.width,f.height)}o.gifFrame=p}e.scale(s.gifData.width/a,s.gifData.height/a)}}async function w(t){if("gif"===t.type){t.loading=!0;try{t.gifData=await async function(t,e,a){a||(a=!1);const o=await fetch(t);if(!o.ok&&404===o.status)throw new EvalError("file not found");const i=await o.arrayBuffer(),r={width:0,height:0,totalTime:0,colorRes:0,pixelAspectRatio:0,frames:[],sortFlag:!1,globalColorTable:[],backgroundImage:new ImageData(1,1,{colorSpace:"srgb"}),comments:[],applicationExtensions:[]},n=new s(new Uint8ClampedArray(i));if("GIF89a"!==n.getString(6))throw new Error("not a supported GIF file");r.width=n.nextTwoBytes(),r.height=n.nextTwoBytes();const l=n.nextByte(),h=128==(128&l);r.colorRes=(112&l)>>>4,r.sortFlag=8==(8&l);const c=1<<1+(7&l),g=n.nextByte();r.pixelAspectRatio=n.nextByte(),0!==r.pixelAspectRatio&&(r.pixelAspectRatio=(r.pixelAspectRatio+15)/64),h&&(r.globalColorTable=f(n,c));const p=(()=>{try{return new ImageData(r.width,r.height,{colorSpace:"srgb"})}catch(t){if(t instanceof DOMException&&"IndexSizeError"===t.name)return null;throw t}})();if(null==p)throw new Error("GIF frame size is to large");const{r:w,g:u,b:m}=r.globalColorTable[g];p.data.set(h?[w,u,m,255]:[0,0,0,0]);for(let t=4;t<p.data.length;t*=2)p.data.copyWithin(t,0,t);r.backgroundImage=p;let y=-1,b=!0,x=-1;const B=t=>(t&&(b=!0),y),T=t=>(null!=t&&(x=t),x);try{do{b&&(r.frames.push({left:0,top:0,width:0,height:0,disposalMethod:0,image:new ImageData(1,1,{colorSpace:"srgb"}),plainTextData:null,userInputDelayFlag:!1,delayTime:0,sortFlag:!1,localColorTable:[],reserved:0,GCreserved:0}),y++,x=-1,b=!1)}while(!await d(n,r,a,B,T,e));r.frames.length--;for(const t of r.frames){if(t.userInputDelayFlag&&0===t.delayTime){r.totalTime=1/0;break}r.totalTime+=t.delayTime}return r}catch(t){if(t instanceof EvalError)throw new Error(`error while parsing frame ${y} "${t.message}"`);throw t}}(t.source),t.gifLoopCount=function(t){for(const e of t.applicationExtensions)if(e.identifier+e.authenticationCode==="NETSCAPE2.0")return e.data[1]+(e.data[2]<<8);return NaN}(t.gifData)??g,t.gifLoopCount||(t.gifLoopCount=1/0)}catch{t.error=!0}t.loading=!1}else{const{loadImage:e}=await Promise.resolve().then(a.bind(a,764));await e(t)}}}}]);
@@ -1 +0,0 @@
1
- /*! tsParticles Image Shape v3.3.0 by Matteo Bruni */
package/33.min.js DELETED
@@ -1,2 +0,0 @@
1
- /*! For license information please see 33.min.js.LICENSE.txt */
2
- (this.webpackChunk_tsparticles_shape_image=this.webpackChunk_tsparticles_shape_image||[]).push([[33,329],{329:(t,e,a)=>{a.d(e,{zS:()=>p,loadGifImage:()=>m});const i=[0,4,2,1],o=[8,8,4,2];class s{constructor(t){this.pos=0,this.data=new Uint8ClampedArray(t)}getString(t){const e=this.data.slice(this.pos,this.pos+t);return this.pos+=e.length,e.reduce(((t,e)=>t+String.fromCharCode(e)),"")}nextByte(){return this.data[this.pos++]}nextTwoBytes(){return this.pos+=2,this.data[this.pos-2]+(this.data[this.pos-1]<<8)}readSubBlocks(){let t="",e=0;do{e=this.data[this.pos++];for(let a=e;--a>=0;t+=String.fromCharCode(this.data[this.pos++]));}while(0!==e);return t}readSubBlocksBin(){let t=this.data[this.pos],e=0;for(let a=0;0!==t;a+=t+1,t=this.data[this.pos+a])e+=t;const a=new Uint8Array(e);t=this.data[this.pos++];for(let e=0;0!==t;t=this.data[this.pos++])for(let i=t;--i>=0;a[e++]=this.data[this.pos++]);return a}skipSubBlocks(){for(const t=1,e=0;this.data[this.pos]!==e;this.pos+=this.data[this.pos]+t);this.pos++}}const n={x:0,y:0},r=0,l=.5,h=0,g=0,c=0;function f(t,e){const a=[];for(let i=0;i<e;i++)a.push({r:t.data[t.pos],g:t.data[t.pos+1],b:t.data[t.pos+2]}),t.pos+=3;return a}async function d(t,e,a,s,n,r){switch(t.nextByte()){case 59:return!0;case 44:await async function(t,e,a,s,n,r){const l=e.frames[s(!0)];l.left=t.nextTwoBytes(),l.top=t.nextTwoBytes(),l.width=t.nextTwoBytes(),l.height=t.nextTwoBytes();const h=t.nextByte(),g=128==(128&h),c=64==(64&h);l.sortFlag=32==(32&h),l.reserved=(24&h)>>>3;const d=1<<1+(7&h);g&&(l.localColorTable=f(t,d));const p=t=>{const{r:i,g:o,b:s}=(g?l.localColorTable:e.globalColorTable)[t];return t!==n(null)?{r:i,g:o,b:s,a:255}:{r:i,g:o,b:s,a:a?~~((i+o+s)/3):0}},m=(()=>{try{return new ImageData(l.width,l.height,{colorSpace:"srgb"})}catch(t){if(t instanceof DOMException&&"IndexSizeError"===t.name)return null;throw t}})();if(null==m)throw new EvalError("GIF frame size is to large");const u=t.nextByte(),w=t.readSubBlocksBin(),y=1<<u,x=(t,e)=>{const a=t>>>3,i=7&t;return(w[a]+(w[a+1]<<8)+(w[a+2]<<16)&(1<<e)-1<<i)>>>i};if(c){for(let a=0,n=u+1,h=0,g=[[0]],c=0;c<4;c++){if(i[c]<l.height){let t=0,e=0,s=!1;for(;!s;){const r=a;if(a=x(h,n),h+=n+1,a===y){n=u+1,g.length=y+2;for(let t=0;t<g.length;t++)g[t]=t<y?[t]:[]}else{a>=g.length?g.push(g[r].concat(g[r][0])):r!==y&&g.push(g[r].concat(g[a][0]));for(const s of g[a]){const{r:a,g:n,b:r,a:h}=p(s);m.data.set([a,n,r,h],i[c]*l.width+o[c]*e+t%(4*l.width)),t+=4}g.length===1<<n&&n<12&&n++}t===4*l.width*(e+1)&&(e++,i[c]+o[c]*e>=l.height&&(s=!0))}}r?.(t.pos/(t.data.length-1),s(!1)+1,m,{x:l.left,y:l.top},{width:e.width,height:e.height})}l.image=m,l.bitmap=await createImageBitmap(m)}else{let a=0,i=u+1,o=0,n=-4,h=!1;const g=[[0]];for(;!h;){const t=a;if(a=x(o,i),o+=i,a===y){i=u+1,g.length=y+2;for(let t=0;t<g.length;t++)g[t]=t<y?[t]:[]}else{if(a===y+1){h=!0;break}a>=g.length?g.push(g[t].concat(g[t][0])):t!==y&&g.push(g[t].concat(g[a][0]));for(const t of g[a]){const{r:e,g:a,b:i,a:o}=p(t);m.data.set([e,a,i,o],n+=4)}g.length>=1<<i&&i<12&&i++}}l.image=m,l.bitmap=await createImageBitmap(m),r?.((t.pos+1)/t.data.length,s(!1)+1,l.image,{x:l.left,y:l.top},{width:e.width,height:e.height})}}(t,e,a,s,n,r);break;case 33:!function(t,e,a,i){switch(t.nextByte()){case 249:{const o=e.frames[a(!1)];t.pos++;const s=t.nextByte();o.GCreserved=(224&s)>>>5,o.disposalMethod=(28&s)>>>2,o.userInputDelayFlag=2==(2&s);const n=1==(1&s);o.delayTime=10*t.nextTwoBytes();const r=t.nextByte();n&&i(r),t.pos++;break}case 255:{t.pos++;const a={identifier:t.getString(8),authenticationCode:t.getString(3),data:t.readSubBlocksBin()};e.applicationExtensions.push(a);break}case 254:e.comments.push([a(!1),t.readSubBlocks()]);break;case 1:if(0===e.globalColorTable.length)throw new EvalError("plain text extension without global color table");t.pos++,e.frames[a(!1)].plainTextData={left:t.nextTwoBytes(),top:t.nextTwoBytes(),width:t.nextTwoBytes(),height:t.nextTwoBytes(),charSize:{width:t.nextTwoBytes(),height:t.nextTwoBytes()},foregroundColor:t.nextByte(),backgroundColor:t.nextByte(),text:t.readSubBlocks()};break;default:t.skipSubBlocks()}}(t,e,s,n);break;default:throw new EvalError("undefined block found")}return!1}function p(t){const{context:e,radius:a,particle:i,delta:o}=t,s=i.image;if(!s?.gifData||!s.gif)return;const f=new OffscreenCanvas(s.gifData.width,s.gifData.height),d=f.getContext("2d");if(!d)throw new Error("could not create offscreen canvas context");d.imageSmoothingQuality="low",d.imageSmoothingEnabled=!1,d.clearRect(n.x,n.y,f.width,f.height),void 0===i.gifLoopCount&&(i.gifLoopCount=s.gifLoopCount??c);let p=i.gifFrame??r;const m={x:-s.gifData.width*l,y:-s.gifData.height*l},u=s.gifData.frames[p];if(void 0===i.gifTime&&(i.gifTime=h),u.bitmap){switch(e.scale(a/s.gifData.width,a/s.gifData.height),u.disposalMethod){case 4:case 5:case 6:case 7:case 0:d.drawImage(u.bitmap,u.left,u.top),e.drawImage(f,m.x,m.y),d.clearRect(n.x,n.y,f.width,f.height);break;case 1:d.drawImage(u.bitmap,u.left,u.top),e.drawImage(f,m.x,m.y);break;case 2:d.drawImage(u.bitmap,u.left,u.top),e.drawImage(f,m.x,m.y),d.clearRect(n.x,n.y,f.width,f.height),s.gifData.globalColorTable.length?d.putImageData(s.gifData.backgroundImage,m.x,m.y):d.putImageData(s.gifData.frames[g].image,m.x+u.left,m.y+u.top);break;case 3:{const t=d.getImageData(n.x,n.y,f.width,f.height);d.drawImage(u.bitmap,u.left,u.top),e.drawImage(f,m.x,m.y),d.clearRect(n.x,n.y,f.width,f.height),d.putImageData(t,n.x,n.y)}}if(i.gifTime+=o.value,i.gifTime>u.delayTime){if(i.gifTime-=u.delayTime,++p>=s.gifData.frames.length){if(--i.gifLoopCount<=c)return;p=g,d.clearRect(n.x,n.y,f.width,f.height)}i.gifFrame=p}e.scale(s.gifData.width/a,s.gifData.height/a)}}async function m(t){if("gif"===t.type){t.loading=!0;try{t.gifData=await async function(t,e,a){a||(a=!1);const i=await fetch(t);if(!i.ok&&404===i.status)throw new EvalError("file not found");const o=await i.arrayBuffer(),n={width:0,height:0,totalTime:0,colorRes:0,pixelAspectRatio:0,frames:[],sortFlag:!1,globalColorTable:[],backgroundImage:new ImageData(1,1,{colorSpace:"srgb"}),comments:[],applicationExtensions:[]},r=new s(new Uint8ClampedArray(o));if("GIF89a"!==r.getString(6))throw new Error("not a supported GIF file");n.width=r.nextTwoBytes(),n.height=r.nextTwoBytes();const l=r.nextByte(),h=128==(128&l);n.colorRes=(112&l)>>>4,n.sortFlag=8==(8&l);const g=1<<1+(7&l),c=r.nextByte();n.pixelAspectRatio=r.nextByte(),0!==n.pixelAspectRatio&&(n.pixelAspectRatio=(n.pixelAspectRatio+15)/64),h&&(n.globalColorTable=f(r,g));const p=(()=>{try{return new ImageData(n.width,n.height,{colorSpace:"srgb"})}catch(t){if(t instanceof DOMException&&"IndexSizeError"===t.name)return null;throw t}})();if(null==p)throw new Error("GIF frame size is to large");const{r:m,g:u,b:w}=n.globalColorTable[c];p.data.set(h?[m,u,w,255]:[0,0,0,0]);for(let t=4;t<p.data.length;t*=2)p.data.copyWithin(t,0,t);n.backgroundImage=p;let y=-1,x=!0,b=-1;const C=t=>(t&&(x=!0),y),I=t=>(null!=t&&(b=t),b);try{do{x&&(n.frames.push({left:0,top:0,width:0,height:0,disposalMethod:0,image:new ImageData(1,1,{colorSpace:"srgb"}),plainTextData:null,userInputDelayFlag:!1,delayTime:0,sortFlag:!1,localColorTable:[],reserved:0,GCreserved:0}),y++,b=-1,x=!1)}while(!await d(r,n,a,C,I,e));n.frames.length--;for(const t of n.frames){if(t.userInputDelayFlag&&0===t.delayTime){n.totalTime=1/0;break}n.totalTime+=t.delayTime}return n}catch(t){if(t instanceof EvalError)throw new Error(`error while parsing frame ${y} "${t.message}"`);throw t}}(t.source),t.gifLoopCount=function(t){for(const e of t.applicationExtensions)if(e.identifier+e.authenticationCode==="NETSCAPE2.0")return e.data[1]+(e.data[2]<<8);return NaN}(t.gifData)??c,t.gifLoopCount||(t.gifLoopCount=1/0)}catch{t.error=!0}t.loading=!1}else{const{loadImage:e}=await Promise.resolve().then(a.bind(a,764));await e(t)}}},33:(t,e,a)=>{a.d(e,{ImageDrawer:()=>n});var i=a(303),o=a(764),s=a(329);class n{constructor(t){this.loadImageShape=async t=>{if(!this._engine.loadImage)throw new Error(`${i.errorPrefix} image shape not initialized`);await this._engine.loadImage({gif:t.gif,name:t.name,replaceColor:t.replaceColor??!1,src:t.src})},this._engine=t}addImage(t){this._engine.images||(this._engine.images=[]),this._engine.images.push(t)}draw(t){const{context:e,radius:a,particle:i,opacity:o}=t,n=i.image,r=n?.element;if(n){if(e.globalAlpha=o,n.gif&&n.gifData)(0,s.zS)(t);else if(r){const t=n.ratio,i={x:-a,y:-a},o=2*a;e.drawImage(r,i.x,i.y,o,o/t)}e.globalAlpha=1}}getSidesCount(){return 12}async init(t){const e=t.actualOptions;if(e.preload&&this._engine.loadImage)for(const t of e.preload)await this._engine.loadImage(t)}loadShape(t){if("image"!==t.shape&&"images"!==t.shape)return;this._engine.images||(this._engine.images=[]);const e=t.shapeData;if(!e)return;this._engine.images.find((t=>t.name===e.name||t.source===e.src))||this.loadImageShape(e).then((()=>{this.loadShape(t)}))}particleInit(t,e){if("image"!==e.shape&&"images"!==e.shape)return;this._engine.images||(this._engine.images=[]);const a=this._engine.images,i=e.shapeData;if(!i)return;const s=e.getFillColor(),n=a.find((t=>t.name===i.name||t.source===i.src));if(!n)return;const r=i.replaceColor??n.replaceColor;n.loading?setTimeout((()=>{this.particleInit(t,e)})):(async()=>{let t;t=n.svgData&&s?await(0,o.d)(n,i,s,e):{color:s,data:n,element:n.element,gif:n.gif,gifData:n.gifData,gifLoopCount:n.gifLoopCount,loaded:!0,ratio:i.width&&i.height?i.width/i.height:n.ratio??1,replaceColor:r,source:i.src},t.ratio||(t.ratio=1);const a={image:t,fill:i.fill??e.shapeFill,close:i.close??e.shapeClose};e.image=a.image,e.shapeFill=a.fill,e.shapeClose=a.close})()}}}}]);
@@ -1 +0,0 @@
1
- /*! tsParticles Image Shape v3.3.0 by Matteo Bruni */
package/715.min.js DELETED
@@ -1,2 +0,0 @@
1
- /*! For license information please see 715.min.js.LICENSE.txt */
2
- (this.webpackChunk_tsparticles_shape_image=this.webpackChunk_tsparticles_shape_image||[]).push([[715],{715:(e,i,s)=>{s.d(i,{ImagePreloaderPlugin:()=>r});class o{constructor(){this.src="",this.gif=!1}load(e){e&&(void 0!==e.gif&&(this.gif=e.gif),void 0!==e.height&&(this.height=e.height),void 0!==e.name&&(this.name=e.name),void 0!==e.replaceColor&&(this.replaceColor=e.replaceColor),void 0!==e.src&&(this.src=e.src),void 0!==e.width&&(this.width=e.width))}}class r{constructor(e){this.id="imagePreloader",this._engine=e}async getPlugin(){return await Promise.resolve(),{}}loadOptions(e,i){if(!i?.preload)return;e.preload||(e.preload=[]);const s=e.preload;for(const e of i.preload){const i=s.find((i=>i.name===e.name||i.src===e.src));if(i)i.load(e);else{const i=new o;i.load(e),s.push(i)}}}needsPlugin(){return!0}}}}]);
@@ -1 +0,0 @@
1
- /*! tsParticles Image Shape v3.3.0 by Matteo Bruni */
@@ -1,50 +0,0 @@
1
- /*!
2
- * Author : Matteo Bruni
3
- * MIT license: https://opensource.org/licenses/MIT
4
- * Demo / Generator : https://particles.js.org/
5
- * GitHub : https://www.github.com/matteobruni/tsparticles
6
- * How to use? : Check the GitHub README
7
- * v3.3.0
8
- */
9
- "use strict";
10
- /*
11
- * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
12
- * This devtool is neither made for production nor for readable output files.
13
- * It uses "eval()" calls to create a separate source file in the browser devtools.
14
- * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
15
- * or disable the default devtool with "devtool: false".
16
- * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
17
- */
18
- (this["webpackChunk_tsparticles_shape_image"] = this["webpackChunk_tsparticles_shape_image"] || []).push([["dist_browser_GifUtils_Utils_js"],{
19
-
20
- /***/ "./dist/browser/GifUtils/ByteStream.js":
21
- /*!*********************************************!*\
22
- !*** ./dist/browser/GifUtils/ByteStream.js ***!
23
- \*********************************************/
24
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
25
-
26
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ByteStream: () => (/* binding */ ByteStream)\n/* harmony export */ });\nclass ByteStream {\n constructor(bytes) {\n this.pos = 0;\n this.data = new Uint8ClampedArray(bytes);\n }\n getString(count) {\n const slice = this.data.slice(this.pos, this.pos + count);\n this.pos += slice.length;\n return slice.reduce((acc, curr) => acc + String.fromCharCode(curr), \"\");\n }\n nextByte() {\n return this.data[this.pos++];\n }\n nextTwoBytes() {\n const increment = 2,\n previous = 1,\n shift = 8;\n this.pos += increment;\n return this.data[this.pos - increment] + (this.data[this.pos - previous] << shift);\n }\n readSubBlocks() {\n let blockString = \"\",\n size = 0;\n const minCount = 0,\n emptySize = 0;\n do {\n size = this.data[this.pos++];\n for (let count = size; --count >= minCount; blockString += String.fromCharCode(this.data[this.pos++])) {}\n } while (size !== emptySize);\n return blockString;\n }\n readSubBlocksBin() {\n let size = this.data[this.pos],\n len = 0;\n const emptySize = 0,\n increment = 1;\n for (let offset = 0; size !== emptySize; offset += size + increment, size = this.data[this.pos + offset]) {\n len += size;\n }\n const blockData = new Uint8Array(len);\n size = this.data[this.pos++];\n for (let i = 0; size !== emptySize; size = this.data[this.pos++]) {\n for (let count = size; --count >= emptySize; blockData[i++] = this.data[this.pos++]) {}\n }\n return blockData;\n }\n skipSubBlocks() {\n for (const increment = 1, noData = 0; this.data[this.pos] !== noData; this.pos += this.data[this.pos] + increment) {}\n this.pos++;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/shape-image/./dist/browser/GifUtils/ByteStream.js?");
27
-
28
- /***/ }),
29
-
30
- /***/ "./dist/browser/GifUtils/Constants.js":
31
- /*!********************************************!*\
32
- !*** ./dist/browser/GifUtils/Constants.js ***!
33
- \********************************************/
34
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
35
-
36
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ InterlaceOffsets: () => (/* binding */ InterlaceOffsets),\n/* harmony export */ InterlaceSteps: () => (/* binding */ InterlaceSteps)\n/* harmony export */ });\nconst InterlaceOffsets = [0, 4, 2, 1];\nconst InterlaceSteps = [8, 8, 4, 2];\n\n//# sourceURL=webpack://@tsparticles/shape-image/./dist/browser/GifUtils/Constants.js?");
37
-
38
- /***/ }),
39
-
40
- /***/ "./dist/browser/GifUtils/Utils.js":
41
- /*!****************************************!*\
42
- !*** ./dist/browser/GifUtils/Utils.js ***!
43
- \****************************************/
44
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
45
-
46
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decodeGIF: () => (/* binding */ decodeGIF),\n/* harmony export */ drawGif: () => (/* binding */ drawGif),\n/* harmony export */ getGIFLoopAmount: () => (/* binding */ getGIFLoopAmount),\n/* harmony export */ loadGifImage: () => (/* binding */ loadGifImage)\n/* harmony export */ });\n/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Constants.js */ \"./dist/browser/GifUtils/Constants.js\");\n/* harmony import */ var _ByteStream_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ByteStream.js */ \"./dist/browser/GifUtils/ByteStream.js\");\n\n\nconst origin = {\n x: 0,\n y: 0\n },\n defaultFrame = 0,\n half = 0.5,\n initialTime = 0,\n firstIndex = 0,\n defaultLoopCount = 0;\nfunction parseColorTable(byteStream, count) {\n const colors = [];\n for (let i = 0; i < count; i++) {\n colors.push({\n r: byteStream.data[byteStream.pos],\n g: byteStream.data[byteStream.pos + 1],\n b: byteStream.data[byteStream.pos + 2]\n });\n byteStream.pos += 3;\n }\n return colors;\n}\nfunction parseExtensionBlock(byteStream, gif, getFrameIndex, getTransparencyIndex) {\n switch (byteStream.nextByte()) {\n case 249:\n {\n const frame = gif.frames[getFrameIndex(false)];\n byteStream.pos++;\n const packedByte = byteStream.nextByte();\n frame.GCreserved = (packedByte & 0xe0) >>> 5;\n frame.disposalMethod = (packedByte & 0x1c) >>> 2;\n frame.userInputDelayFlag = (packedByte & 2) === 2;\n const transparencyFlag = (packedByte & 1) === 1;\n frame.delayTime = byteStream.nextTwoBytes() * 0xa;\n const transparencyIndex = byteStream.nextByte();\n if (transparencyFlag) {\n getTransparencyIndex(transparencyIndex);\n }\n byteStream.pos++;\n break;\n }\n case 255:\n {\n byteStream.pos++;\n const applicationExtension = {\n identifier: byteStream.getString(8),\n authenticationCode: byteStream.getString(3),\n data: byteStream.readSubBlocksBin()\n };\n gif.applicationExtensions.push(applicationExtension);\n break;\n }\n case 254:\n {\n gif.comments.push([getFrameIndex(false), byteStream.readSubBlocks()]);\n break;\n }\n case 1:\n {\n if (gif.globalColorTable.length === 0) {\n throw new EvalError(\"plain text extension without global color table\");\n }\n byteStream.pos++;\n gif.frames[getFrameIndex(false)].plainTextData = {\n left: byteStream.nextTwoBytes(),\n top: byteStream.nextTwoBytes(),\n width: byteStream.nextTwoBytes(),\n height: byteStream.nextTwoBytes(),\n charSize: {\n width: byteStream.nextTwoBytes(),\n height: byteStream.nextTwoBytes()\n },\n foregroundColor: byteStream.nextByte(),\n backgroundColor: byteStream.nextByte(),\n text: byteStream.readSubBlocks()\n };\n break;\n }\n default:\n byteStream.skipSubBlocks();\n break;\n }\n}\nasync function parseImageBlock(byteStream, gif, avgAlpha, getFrameIndex, getTransparencyIndex, progressCallback) {\n const frame = gif.frames[getFrameIndex(true)];\n frame.left = byteStream.nextTwoBytes();\n frame.top = byteStream.nextTwoBytes();\n frame.width = byteStream.nextTwoBytes();\n frame.height = byteStream.nextTwoBytes();\n const packedByte = byteStream.nextByte(),\n localColorTableFlag = (packedByte & 0x80) === 0x80,\n interlacedFlag = (packedByte & 0x40) === 0x40;\n frame.sortFlag = (packedByte & 0x20) === 0x20;\n frame.reserved = (packedByte & 0x18) >>> 3;\n const localColorCount = 1 << (packedByte & 7) + 1;\n if (localColorTableFlag) {\n frame.localColorTable = parseColorTable(byteStream, localColorCount);\n }\n const getColor = index => {\n const {\n r,\n g,\n b\n } = (localColorTableFlag ? frame.localColorTable : gif.globalColorTable)[index];\n if (index !== getTransparencyIndex(null)) {\n return {\n r,\n g,\n b,\n a: 255\n };\n }\n return {\n r,\n g,\n b,\n a: avgAlpha ? ~~((r + g + b) / 3) : 0\n };\n };\n const image = (() => {\n try {\n return new ImageData(frame.width, frame.height, {\n colorSpace: \"srgb\"\n });\n } catch (error) {\n if (error instanceof DOMException && error.name === \"IndexSizeError\") {\n return null;\n }\n throw error;\n }\n })();\n if (image == null) {\n throw new EvalError(\"GIF frame size is to large\");\n }\n const minCodeSize = byteStream.nextByte(),\n imageData = byteStream.readSubBlocksBin(),\n clearCode = 1 << minCodeSize;\n const readBits = (pos, len) => {\n const bytePos = pos >>> 3,\n bitPos = pos & 7;\n return (imageData[bytePos] + (imageData[bytePos + 1] << 8) + (imageData[bytePos + 2] << 16) & (1 << len) - 1 << bitPos) >>> bitPos;\n };\n if (interlacedFlag) {\n for (let code = 0, size = minCodeSize + 1, pos = 0, dic = [[0]], pass = 0; pass < 4; pass++) {\n if (_Constants_js__WEBPACK_IMPORTED_MODULE_0__.InterlaceOffsets[pass] < frame.height) {\n let pixelPos = 0,\n lineIndex = 0,\n exit = false;\n while (!exit) {\n const last = code;\n code = readBits(pos, size);\n pos += size + 1;\n if (code === clearCode) {\n size = minCodeSize + 1;\n dic.length = clearCode + 2;\n for (let i = 0; i < dic.length; i++) {\n dic[i] = i < clearCode ? [i] : [];\n }\n } else {\n if (code >= dic.length) {\n dic.push(dic[last].concat(dic[last][0]));\n } else if (last !== clearCode) {\n dic.push(dic[last].concat(dic[code][0]));\n }\n for (const item of dic[code]) {\n const {\n r,\n g,\n b,\n a\n } = getColor(item);\n image.data.set([r, g, b, a], _Constants_js__WEBPACK_IMPORTED_MODULE_0__.InterlaceOffsets[pass] * frame.width + _Constants_js__WEBPACK_IMPORTED_MODULE_0__.InterlaceSteps[pass] * lineIndex + pixelPos % (frame.width * 4));\n pixelPos += 4;\n }\n if (dic.length === 1 << size && size < 0xc) {\n size++;\n }\n }\n if (pixelPos === frame.width * 4 * (lineIndex + 1)) {\n lineIndex++;\n if (_Constants_js__WEBPACK_IMPORTED_MODULE_0__.InterlaceOffsets[pass] + _Constants_js__WEBPACK_IMPORTED_MODULE_0__.InterlaceSteps[pass] * lineIndex >= frame.height) {\n exit = true;\n }\n }\n }\n }\n progressCallback?.(byteStream.pos / (byteStream.data.length - 1), getFrameIndex(false) + 1, image, {\n x: frame.left,\n y: frame.top\n }, {\n width: gif.width,\n height: gif.height\n });\n }\n frame.image = image;\n frame.bitmap = await createImageBitmap(image);\n } else {\n let code = 0,\n size = minCodeSize + 1,\n pos = 0,\n pixelPos = -4,\n exit = false;\n const dic = [[0]];\n while (!exit) {\n const last = code;\n code = readBits(pos, size);\n pos += size;\n if (code === clearCode) {\n size = minCodeSize + 1;\n dic.length = clearCode + 2;\n for (let i = 0; i < dic.length; i++) {\n dic[i] = i < clearCode ? [i] : [];\n }\n } else {\n if (code === clearCode + 1) {\n exit = true;\n break;\n }\n if (code >= dic.length) {\n dic.push(dic[last].concat(dic[last][0]));\n } else if (last !== clearCode) {\n dic.push(dic[last].concat(dic[code][0]));\n }\n for (const item of dic[code]) {\n const {\n r,\n g,\n b,\n a\n } = getColor(item);\n image.data.set([r, g, b, a], pixelPos += 4);\n }\n if (dic.length >= 1 << size && size < 0xc) {\n size++;\n }\n }\n }\n frame.image = image;\n frame.bitmap = await createImageBitmap(image);\n progressCallback?.((byteStream.pos + 1) / byteStream.data.length, getFrameIndex(false) + 1, frame.image, {\n x: frame.left,\n y: frame.top\n }, {\n width: gif.width,\n height: gif.height\n });\n }\n}\nasync function parseBlock(byteStream, gif, avgAlpha, getFrameIndex, getTransparencyIndex, progressCallback) {\n switch (byteStream.nextByte()) {\n case 59:\n return true;\n case 44:\n await parseImageBlock(byteStream, gif, avgAlpha, getFrameIndex, getTransparencyIndex, progressCallback);\n break;\n case 33:\n parseExtensionBlock(byteStream, gif, getFrameIndex, getTransparencyIndex);\n break;\n default:\n throw new EvalError(\"undefined block found\");\n }\n return false;\n}\nfunction getGIFLoopAmount(gif) {\n for (const extension of gif.applicationExtensions) {\n if (extension.identifier + extension.authenticationCode !== \"NETSCAPE2.0\") {\n continue;\n }\n return extension.data[1] + (extension.data[2] << 8);\n }\n return NaN;\n}\nasync function decodeGIF(gifURL, progressCallback, avgAlpha) {\n if (!avgAlpha) avgAlpha = false;\n const res = await fetch(gifURL);\n if (!res.ok && res.status === 404) {\n throw new EvalError(\"file not found\");\n }\n const buffer = await res.arrayBuffer();\n const gif = {\n width: 0,\n height: 0,\n totalTime: 0,\n colorRes: 0,\n pixelAspectRatio: 0,\n frames: [],\n sortFlag: false,\n globalColorTable: [],\n backgroundImage: new ImageData(1, 1, {\n colorSpace: \"srgb\"\n }),\n comments: [],\n applicationExtensions: []\n },\n byteStream = new _ByteStream_js__WEBPACK_IMPORTED_MODULE_1__.ByteStream(new Uint8ClampedArray(buffer));\n if (byteStream.getString(6) !== \"GIF89a\") {\n throw new Error(\"not a supported GIF file\");\n }\n gif.width = byteStream.nextTwoBytes();\n gif.height = byteStream.nextTwoBytes();\n const packedByte = byteStream.nextByte(),\n globalColorTableFlag = (packedByte & 0x80) === 0x80;\n gif.colorRes = (packedByte & 0x70) >>> 4;\n gif.sortFlag = (packedByte & 8) === 8;\n const globalColorCount = 1 << (packedByte & 7) + 1,\n backgroundColorIndex = byteStream.nextByte();\n gif.pixelAspectRatio = byteStream.nextByte();\n if (gif.pixelAspectRatio !== 0) {\n gif.pixelAspectRatio = (gif.pixelAspectRatio + 0xf) / 0x40;\n }\n if (globalColorTableFlag) {\n gif.globalColorTable = parseColorTable(byteStream, globalColorCount);\n }\n const backgroundImage = (() => {\n try {\n return new ImageData(gif.width, gif.height, {\n colorSpace: \"srgb\"\n });\n } catch (error) {\n if (error instanceof DOMException && error.name === \"IndexSizeError\") {\n return null;\n }\n throw error;\n }\n })();\n if (backgroundImage == null) {\n throw new Error(\"GIF frame size is to large\");\n }\n const {\n r,\n g,\n b\n } = gif.globalColorTable[backgroundColorIndex];\n backgroundImage.data.set(globalColorTableFlag ? [r, g, b, 255] : [0, 0, 0, 0]);\n for (let i = 4; i < backgroundImage.data.length; i *= 2) {\n backgroundImage.data.copyWithin(i, 0, i);\n }\n gif.backgroundImage = backgroundImage;\n let frameIndex = -1,\n incrementFrameIndex = true,\n transparencyIndex = -1;\n const getframeIndex = increment => {\n if (increment) {\n incrementFrameIndex = true;\n }\n return frameIndex;\n };\n const getTransparencyIndex = newValue => {\n if (newValue != null) {\n transparencyIndex = newValue;\n }\n return transparencyIndex;\n };\n try {\n do {\n if (incrementFrameIndex) {\n gif.frames.push({\n left: 0,\n top: 0,\n width: 0,\n height: 0,\n disposalMethod: 0,\n image: new ImageData(1, 1, {\n colorSpace: \"srgb\"\n }),\n plainTextData: null,\n userInputDelayFlag: false,\n delayTime: 0,\n sortFlag: false,\n localColorTable: [],\n reserved: 0,\n GCreserved: 0\n });\n frameIndex++;\n transparencyIndex = -1;\n incrementFrameIndex = false;\n }\n } while (!(await parseBlock(byteStream, gif, avgAlpha, getframeIndex, getTransparencyIndex, progressCallback)));\n gif.frames.length--;\n for (const frame of gif.frames) {\n if (frame.userInputDelayFlag && frame.delayTime === 0) {\n gif.totalTime = Infinity;\n break;\n }\n gif.totalTime += frame.delayTime;\n }\n return gif;\n } catch (error) {\n if (error instanceof EvalError) {\n throw new Error(`error while parsing frame ${frameIndex} \"${error.message}\"`);\n }\n throw error;\n }\n}\nfunction drawGif(data) {\n const {\n context,\n radius,\n particle,\n delta\n } = data,\n image = particle.image;\n if (!image?.gifData || !image.gif) {\n return;\n }\n const offscreenCanvas = new OffscreenCanvas(image.gifData.width, image.gifData.height),\n offscreenContext = offscreenCanvas.getContext(\"2d\");\n if (!offscreenContext) {\n throw new Error(\"could not create offscreen canvas context\");\n }\n offscreenContext.imageSmoothingQuality = \"low\";\n offscreenContext.imageSmoothingEnabled = false;\n offscreenContext.clearRect(origin.x, origin.y, offscreenCanvas.width, offscreenCanvas.height);\n if (particle.gifLoopCount === undefined) {\n particle.gifLoopCount = image.gifLoopCount ?? defaultLoopCount;\n }\n let frameIndex = particle.gifFrame ?? defaultFrame;\n const pos = {\n x: -image.gifData.width * half,\n y: -image.gifData.height * half\n },\n frame = image.gifData.frames[frameIndex];\n if (particle.gifTime === undefined) {\n particle.gifTime = initialTime;\n }\n if (!frame.bitmap) {\n return;\n }\n context.scale(radius / image.gifData.width, radius / image.gifData.height);\n switch (frame.disposalMethod) {\n case 4:\n case 5:\n case 6:\n case 7:\n case 0:\n offscreenContext.drawImage(frame.bitmap, frame.left, frame.top);\n context.drawImage(offscreenCanvas, pos.x, pos.y);\n offscreenContext.clearRect(origin.x, origin.y, offscreenCanvas.width, offscreenCanvas.height);\n break;\n case 1:\n offscreenContext.drawImage(frame.bitmap, frame.left, frame.top);\n context.drawImage(offscreenCanvas, pos.x, pos.y);\n break;\n case 2:\n offscreenContext.drawImage(frame.bitmap, frame.left, frame.top);\n context.drawImage(offscreenCanvas, pos.x, pos.y);\n offscreenContext.clearRect(origin.x, origin.y, offscreenCanvas.width, offscreenCanvas.height);\n if (!image.gifData.globalColorTable.length) {\n offscreenContext.putImageData(image.gifData.frames[firstIndex].image, pos.x + frame.left, pos.y + frame.top);\n } else {\n offscreenContext.putImageData(image.gifData.backgroundImage, pos.x, pos.y);\n }\n break;\n case 3:\n {\n const previousImageData = offscreenContext.getImageData(origin.x, origin.y, offscreenCanvas.width, offscreenCanvas.height);\n offscreenContext.drawImage(frame.bitmap, frame.left, frame.top);\n context.drawImage(offscreenCanvas, pos.x, pos.y);\n offscreenContext.clearRect(origin.x, origin.y, offscreenCanvas.width, offscreenCanvas.height);\n offscreenContext.putImageData(previousImageData, origin.x, origin.y);\n }\n break;\n }\n particle.gifTime += delta.value;\n if (particle.gifTime > frame.delayTime) {\n particle.gifTime -= frame.delayTime;\n if (++frameIndex >= image.gifData.frames.length) {\n if (--particle.gifLoopCount <= defaultLoopCount) {\n return;\n }\n frameIndex = firstIndex;\n offscreenContext.clearRect(origin.x, origin.y, offscreenCanvas.width, offscreenCanvas.height);\n }\n particle.gifFrame = frameIndex;\n }\n context.scale(image.gifData.width / radius, image.gifData.height / radius);\n}\nasync function loadGifImage(image) {\n if (image.type !== \"gif\") {\n const {\n loadImage\n } = await Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! ../Utils.js */ \"./dist/browser/Utils.js\"));\n await loadImage(image);\n return;\n }\n image.loading = true;\n try {\n image.gifData = await decodeGIF(image.source);\n image.gifLoopCount = getGIFLoopAmount(image.gifData) ?? defaultLoopCount;\n if (!image.gifLoopCount) {\n image.gifLoopCount = Infinity;\n }\n } catch {\n image.error = true;\n }\n image.loading = false;\n}\n\n//# sourceURL=webpack://@tsparticles/shape-image/./dist/browser/GifUtils/Utils.js?");
47
-
48
- /***/ })
49
-
50
- }]);
@@ -1,30 +0,0 @@
1
- /*!
2
- * Author : Matteo Bruni
3
- * MIT license: https://opensource.org/licenses/MIT
4
- * Demo / Generator : https://particles.js.org/
5
- * GitHub : https://www.github.com/matteobruni/tsparticles
6
- * How to use? : Check the GitHub README
7
- * v3.3.0
8
- */
9
- "use strict";
10
- /*
11
- * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
12
- * This devtool is neither made for production nor for readable output files.
13
- * It uses "eval()" calls to create a separate source file in the browser devtools.
14
- * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
15
- * or disable the default devtool with "devtool: false".
16
- * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
17
- */
18
- (this["webpackChunk_tsparticles_shape_image"] = this["webpackChunk_tsparticles_shape_image"] || []).push([["dist_browser_ImageDrawer_js"],{
19
-
20
- /***/ "./dist/browser/ImageDrawer.js":
21
- /*!*************************************!*\
22
- !*** ./dist/browser/ImageDrawer.js ***!
23
- \*************************************/
24
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
25
-
26
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ImageDrawer: () => (/* binding */ ImageDrawer)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n/* harmony import */ var _GifUtils_Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GifUtils/Utils.js */ \"./dist/browser/GifUtils/Utils.js\");\n\n\n\nconst double = 2,\n defaultAlpha = 1,\n sides = 12,\n defaultRatio = 1;\nclass ImageDrawer {\n constructor(engine) {\n this.loadImageShape = async imageShape => {\n if (!this._engine.loadImage) {\n throw new Error(`${_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.errorPrefix} image shape not initialized`);\n }\n await this._engine.loadImage({\n gif: imageShape.gif,\n name: imageShape.name,\n replaceColor: imageShape.replaceColor ?? false,\n src: imageShape.src\n });\n };\n this._engine = engine;\n }\n addImage(image) {\n if (!this._engine.images) {\n this._engine.images = [];\n }\n this._engine.images.push(image);\n }\n draw(data) {\n const {\n context,\n radius,\n particle,\n opacity\n } = data,\n image = particle.image,\n element = image?.element;\n if (!image) {\n return;\n }\n context.globalAlpha = opacity;\n if (image.gif && image.gifData) {\n (0,_GifUtils_Utils_js__WEBPACK_IMPORTED_MODULE_1__.drawGif)(data);\n } else if (element) {\n const ratio = image.ratio,\n pos = {\n x: -radius,\n y: -radius\n },\n diameter = radius * double;\n context.drawImage(element, pos.x, pos.y, diameter, diameter / ratio);\n }\n context.globalAlpha = defaultAlpha;\n }\n getSidesCount() {\n return sides;\n }\n async init(container) {\n const options = container.actualOptions;\n if (!options.preload || !this._engine.loadImage) {\n return;\n }\n for (const imageData of options.preload) {\n await this._engine.loadImage(imageData);\n }\n }\n loadShape(particle) {\n if (particle.shape !== \"image\" && particle.shape !== \"images\") {\n return;\n }\n if (!this._engine.images) {\n this._engine.images = [];\n }\n const imageData = particle.shapeData;\n if (!imageData) {\n return;\n }\n const image = this._engine.images.find(t => t.name === imageData.name || t.source === imageData.src);\n if (!image) {\n void this.loadImageShape(imageData).then(() => {\n this.loadShape(particle);\n });\n }\n }\n particleInit(container, particle) {\n if (particle.shape !== \"image\" && particle.shape !== \"images\") {\n return;\n }\n if (!this._engine.images) {\n this._engine.images = [];\n }\n const images = this._engine.images,\n imageData = particle.shapeData;\n if (!imageData) {\n return;\n }\n const color = particle.getFillColor(),\n image = images.find(t => t.name === imageData.name || t.source === imageData.src);\n if (!image) {\n return;\n }\n const replaceColor = imageData.replaceColor ?? image.replaceColor;\n if (image.loading) {\n setTimeout(() => {\n this.particleInit(container, particle);\n });\n return;\n }\n void (async () => {\n let imageRes;\n if (image.svgData && color) {\n imageRes = await (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__.replaceImageColor)(image, imageData, color, particle);\n } else {\n imageRes = {\n color,\n data: image,\n element: image.element,\n gif: image.gif,\n gifData: image.gifData,\n gifLoopCount: image.gifLoopCount,\n loaded: true,\n ratio: imageData.width && imageData.height ? imageData.width / imageData.height : image.ratio ?? defaultRatio,\n replaceColor: replaceColor,\n source: imageData.src\n };\n }\n if (!imageRes.ratio) {\n imageRes.ratio = 1;\n }\n const fill = imageData.fill ?? particle.shapeFill,\n close = imageData.close ?? particle.shapeClose,\n imageShape = {\n image: imageRes,\n fill,\n close\n };\n particle.image = imageShape.image;\n particle.shapeFill = imageShape.fill;\n particle.shapeClose = imageShape.close;\n })();\n }\n}\n\n//# sourceURL=webpack://@tsparticles/shape-image/./dist/browser/ImageDrawer.js?");
27
-
28
- /***/ })
29
-
30
- }]);
@@ -1,40 +0,0 @@
1
- /*!
2
- * Author : Matteo Bruni
3
- * MIT license: https://opensource.org/licenses/MIT
4
- * Demo / Generator : https://particles.js.org/
5
- * GitHub : https://www.github.com/matteobruni/tsparticles
6
- * How to use? : Check the GitHub README
7
- * v3.3.0
8
- */
9
- "use strict";
10
- /*
11
- * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
12
- * This devtool is neither made for production nor for readable output files.
13
- * It uses "eval()" calls to create a separate source file in the browser devtools.
14
- * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
15
- * or disable the default devtool with "devtool: false".
16
- * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
17
- */
18
- (this["webpackChunk_tsparticles_shape_image"] = this["webpackChunk_tsparticles_shape_image"] || []).push([["dist_browser_ImagePreloader_js"],{
19
-
20
- /***/ "./dist/browser/ImagePreloader.js":
21
- /*!****************************************!*\
22
- !*** ./dist/browser/ImagePreloader.js ***!
23
- \****************************************/
24
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
25
-
26
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ImagePreloaderPlugin: () => (/* binding */ ImagePreloaderPlugin)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_Preload_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/Preload.js */ \"./dist/browser/Options/Classes/Preload.js\");\n\nclass ImagePreloaderPlugin {\n constructor(engine) {\n this.id = \"imagePreloader\";\n this._engine = engine;\n }\n async getPlugin() {\n await Promise.resolve();\n return {};\n }\n loadOptions(options, source) {\n if (!source?.preload) {\n return;\n }\n if (!options.preload) {\n options.preload = [];\n }\n const preloadOptions = options.preload;\n for (const item of source.preload) {\n const existing = preloadOptions.find(t => t.name === item.name || t.src === item.src);\n if (existing) {\n existing.load(item);\n } else {\n const preload = new _Options_Classes_Preload_js__WEBPACK_IMPORTED_MODULE_0__.Preload();\n preload.load(item);\n preloadOptions.push(preload);\n }\n }\n }\n needsPlugin() {\n return true;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/shape-image/./dist/browser/ImagePreloader.js?");
27
-
28
- /***/ }),
29
-
30
- /***/ "./dist/browser/Options/Classes/Preload.js":
31
- /*!*************************************************!*\
32
- !*** ./dist/browser/Options/Classes/Preload.js ***!
33
- \*************************************************/
34
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
35
-
36
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Preload: () => (/* binding */ Preload)\n/* harmony export */ });\nclass Preload {\n constructor() {\n this.src = \"\";\n this.gif = false;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.gif !== undefined) {\n this.gif = data.gif;\n }\n if (data.height !== undefined) {\n this.height = data.height;\n }\n if (data.name !== undefined) {\n this.name = data.name;\n }\n if (data.replaceColor !== undefined) {\n this.replaceColor = data.replaceColor;\n }\n if (data.src !== undefined) {\n this.src = data.src;\n }\n if (data.width !== undefined) {\n this.width = data.width;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/shape-image/./dist/browser/Options/Classes/Preload.js?");
37
-
38
- /***/ })
39
-
40
- }]);