{"version":3,"sources":["webpack:///./src/components/pmicom/widgets/image-fade/controller.js"],"names":["asyncImport","require","default","fillWithDomElements","fillWithDomElementsAll","CLASS_ITEM","CLASS_CONTAINER","CLASS_WRAPPER","selectors","container","wrapper","selectorsAll","items","module","exports","init","root","dataset","color","addBackgroundColor","gsap","registerPlugin","ScrollTrigger","defaults","markers","height","length","tl","timeline","duration","scrollTrigger","trigger","start","end","scrub","anticipatePin","pinSpacing","pin","forEach","elem","i","set","position","top","from","querySelector","autoAlpha","to","hexValue","style","setProperty"],"mappings":";;;;;;;;;AAAA,MAAMA,WAAW,GAAGC,mBAAO,CAAC,iDAAD,CAAP,CAA4BC,OAAhD;;AACA,MAAM;EACLC,mBADK;EAELC;AAFK,IAGFH,mBAAO,CAAC,6CAAD,CAHX;;AAKA,MAAMI,UAAU,GAAG,kBAAnB;AACA,MAAMC,eAAe,GAAG,uBAAxB;AACA,MAAMC,aAAa,GAAG,qBAAtB;AAEA,MAAMC,SAAS,GAAG;EACjBC,SAAS,EAAEH,eADM;EAEjBI,OAAO,EAAEH;AAFQ,CAAlB;AAIA,MAAMI,YAAY,GAAG;EACpBC,KAAK,EAAEP;AADa,CAArB;AAGAQ,MAAM,CAACC,OAAP,GAAiB;EAChB,MAAMC,IAAN,GAAa;IACZ,MAAMf,WAAW,CAAC,IAAD,EAAO,CAAC,eAAD,EAAkB,MAAlB,CAAP,CAAjB;IAEAG,mBAAmB,CAAC,IAAD,EAAOK,SAAP,CAAnB;IACAJ,sBAAsB,CAAC,IAAD,EAAOO,YAAP,CAAtB;;IAEA,IAAI,KAAKK,IAAL,CAAUC,OAAV,CAAkBC,KAAtB,EAA6B;MAC5B,KAAKC,kBAAL;IACA;;IACD,KAAKC,IAAL,CAAUC,cAAV,CAAyB,KAAKC,aAA9B;IACA,KAAKA,aAAL,CAAmBC,QAAnB,CAA4B;MAC3BC,OAAO,EAAE;IADkB,CAA5B;IAIA,MAAMC,MAAM,GAAG,MAAM,KAAKb,KAAL,CAAWc,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AkB,GAAG;IACpB,MAAM6B,QAAQ,GAAG,KAAKhC,IAAL,CAAUC,OAAV,CAAkBC,KAAnC;IACA,KAAKF,IAAL,CAAUiC,KAAV,CAAgBC,WAAhB,CAA4B,kBAA5B,EAAgDF,QAAhD;EACA;;AArDe,CAAjB,C","file":"components--image-faded91775db6ac0caf70696.js","sourcesContent":["const asyncImport = require('util/asyncImport').default;\nconst {\n\tfillWithDomElements,\n\tfillWithDomElementsAll,\n} = require('util/functions');\n\nconst CLASS_ITEM = 'image-fade--item';\nconst CLASS_CONTAINER = 'image-fade--container';\nconst CLASS_WRAPPER = 'image-fade--wrapper';\n\nconst selectors = {\n\tcontainer: CLASS_CONTAINER,\n\twrapper: CLASS_WRAPPER,\n};\nconst selectorsAll = {\n\titems: CLASS_ITEM,\n};\nmodule.exports = {\n\tasync init() {\n\t\tawait asyncImport(this, ['ScrollTrigger', 'gsap']);\n\n\t\tfillWithDomElements(this, selectors);\n\t\tfillWithDomElementsAll(this, selectorsAll);\n\n\t\tif (this.root.dataset.color) {\n\t\t\tthis.addBackgroundColor();\n\t\t}\n\t\tthis.gsap.registerPlugin(this.ScrollTrigger);\n\t\tthis.ScrollTrigger.defaults({\n\t\t\tmarkers: false,\n\t\t});\n\n\t\tconst height = 100 * this.items.length;\n\t\tconst tl = this.gsap.timeline({\n\t\t\tduration: this.items.length,\n\t\t\tscrollTrigger: {\n\t\t\t\ttrigger: this.container,\n\t\t\t\tstart: 'top top',\n\t\t\t\tend: '+=' + height + '%',\n\t\t\t\tscrub: true,\n\t\t\t\tanticipatePin: 1,\n\t\t\t\tpinSpacing: true,\n\t\t\t},\n\t\t});\n\n\t\tthis.gsap.timeline({\n\t\t\tscrollTrigger: {\n\t\t\t\ttrigger: this.container,\n\t\t\t\tstart: 'top top',\n\t\t\t\tend: '+=' + height + '%',\n\t\t\t\tscrub: true,\n\t\t\t\tpin: this.wrapper,\n\t\t\t\tpinSpacing: true,\n\t\t\t\tanticipatePin: 1,\n\t\t\t},\n\t\t});\n\n\t\tthis.items.forEach((elem, i) => {\n\t\t\tthis.gsap.set(elem, { position: 'absolute', top: 0 });\n\n\t\t\ttl.from(elem.querySelector('img'), { autoAlpha: i === 0 ? 1 : 0 }, i);\n\n\t\t\tif (i != this.items.length - 1) {\n\t\t\t\ttl.to(elem.querySelector('img'), { autoAlpha: 0 }, i + 1.5);\n\t\t\t}\n\t\t});\n\t},\n\taddBackgroundColor() {\n\t\tconst hexValue = this.root.dataset.color;\n\t\tthis.root.style.setProperty('background-color', hexValue);\n\t},\n};\n"],"sourceRoot":""}