UNPKG

32 kBJavaScriptView Raw
1"use strict";var e=require("react"),t=require("gsap"),r=require("prop-types");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=n(e),o=n(t),l=n(r);function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),e}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function m(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?h(e):t}function v(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=p(e);if(t){var i=p(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return y(this,r)}}function b(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var x=b(function(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}((function(e){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(1),o=a(i),l=a(r(4));function a(e){return e&&e.__esModule?e:{default:e}}function s(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}r(7);var u=[],c=null,d=function(e){return[].concat(s(new Set(e)))},p=function(e){var t=e.path,r=e.handle,n=e.type,i=void 0===n?"":n;return t+"/resize=w:40"+(""===i?"":"/output=format:"+i)+"/quality=value:6/compress/blur=amount:5/"+r},f=function(e){var t=e.path,r=e.handle,n=e.resizeWidth,i=e.type,o=void 0===i?"":i;return t+"/resize=w:"+n+(""===o?"":"/output=format:"+o)+"/quality=value:80/compress/"+r},m=function(e){var t=e.path,r=e.handle,n=e.width,i=e.breakpointWidths,o=e.hiDPIMultiplier,l=e.type,a=e.blur,u=Math.round(n*o);if(a){var c=p({path:t,handle:r,type:l})+" "+u+"w";return d([c]).join(",")}var m,h=f({path:t,handle:r,resizeWidth:u,type:l})+" "+u+"w";return m=[n].concat(s(i)).sort((function(e,t){return t-e})).filter((function(e){return n>=e})).map((function(e){return f({path:t,handle:r,resizeWidth:u=e,type:l})+" "+e+"w"})),d([h].concat(s(m))).join(",")},h=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.handleIntersection=function(e){r.state.IOSupported&&e&&function(e,t){(null===c&&"undefined"!=typeof window&&(c=new IntersectionObserver((function(e){e.forEach((function(e){u.forEach((function(t){t.item===e.target&&(e.intersectionRatio>0||e.isIntersecting)&&(c.unobserve(t.item),t.callback())}))}))}),{rootMargin:"200px",threshold:.3})),c).observe(e),u.push({item:e,callback:t})}(e,(function(){r.setState({isVisible:!0})}))},r.removeBlurryImage=function(){r.blurryImageElement.style.opacity=0},r.srcset=null,r.srcsetWebp=null,r.srcsetBlur=null,r.srcsetWebpBlur=null;var n=!1,i=!1;return"undefined"!=typeof window&&window.IntersectionObserver&&(i=!0),n=!r.props.isLazy||n||!i,r.state={isVisible:n,IOSupported:i},r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"componentWillUnmount",value:function(){clearTimeout(this.timeOut)}},{key:"render",value:function(){var e=this,t=this.props,r=t.width,n=t.breakpointWidths,l=t.alt,a=t.sizes,s=t.hiDPIMultiplier,u=t.path,c=t.className,d=t.handle,h=t.objectFitMode,y=t.isLazy,v=Math.round(r*s);y&&(this.srcsetWebpBlur=m({path:u,handle:d,width:r,breakpointWidths:n,hiDPIMultiplier:s,type:"webp",blur:!0}),this.srcsetBlur=m({path:u,handle:d,width:r,breakpointWidths:n,hiDPIMultiplier:s,blur:!0})),this.srcsetWebp=m({path:u,handle:d,width:r,breakpointWidths:n,hiDPIMultiplier:s,type:"webp",blur:!1}),this.srcset=m({path:u,handle:d,width:r,breakpointWidths:n,hiDPIMultiplier:s,blur:!1});var b=!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"img";if("undefined"!=typeof document){var t=document.createElement(e);return void 0!==t.style.objectFit}return!0}()&&h;return o.default.createElement(i.Fragment,null,!b&&o.default.createElement("div",{ref:function(t){return e.handleIntersection(t)},className:"wrapper "+(c||"")},o.default.createElement("picture",{className:"picture "+(h?"picture_objectFit":"")+" "+(y?"":"noLazy")},y&&this.state.IOSupported&&o.default.createElement("img",{ref:function(t){e.blurryImageElement=t},src:p({path:u,handle:d}),alt:l,className:"blurryImage"}),this.state.isVisible&&o.default.createElement(i.Fragment,null,o.default.createElement("source",{ref:function(t){e.sourceWebp=t},srcSet:this.srcsetWebp,sizes:a,type:"image/webp"}),o.default.createElement("source",{ref:function(t){e.sourceDefault=t},srcSet:this.srcset,sizes:a,type:"image/jpeg"}),o.default.createElement("img",{ref:function(t){e.imageElement=t},src:f({path:u,handle:d,resizeWidth:v}),alt:l,onLoad:function(){y&&e.removeBlurryImage()},className:y?"":"noLazy"})))),b&&o.default.createElement("div",{className:"objectFitFallback "+(c||""),style:{backgroundImage:"url("+f({path:u,handle:d,resizeWidth:v})+")"}}))}}]),t}(i.PureComponent);h.propTypes={width:l.default.number,breakpointWidths:l.default.array,alt:l.default.string,sizes:l.default.string,hiDPIMultiplier:l.default.number,path:l.default.string,className:l.default.string,handle:l.default.string.isRequired,objectFitMode:l.default.bool,isLazy:l.default.bool},h.defaultProps={width:1400,breakpointWidths:[320,640,1024],alt:"",sizes:"100vw",hiDPIMultiplier:1.5,path:"//media.graphcms.com",className:"",objectFitMode:!1,isLazy:!0},t.default=h},function(e,t,r){e.exports=r(2)},function(e,t,r){
2/** @license React v16.10.2
3 * react.production.min.js
4 *
5 * Copyright (c) Facebook, Inc. and its affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */
10var n=r(3),i="function"==typeof Symbol&&Symbol.for,o=i?Symbol.for("react.element"):60103,l=i?Symbol.for("react.portal"):60106,a=i?Symbol.for("react.fragment"):60107,s=i?Symbol.for("react.strict_mode"):60108,u=i?Symbol.for("react.profiler"):60114,c=i?Symbol.for("react.provider"):60109,d=i?Symbol.for("react.context"):60110,p=i?Symbol.for("react.forward_ref"):60112,f=i?Symbol.for("react.suspense"):60113,m=i?Symbol.for("react.suspense_list"):60120,h=i?Symbol.for("react.memo"):60115,y=i?Symbol.for("react.lazy"):60116,v="function"==typeof Symbol&&Symbol.iterator;function b(e){for(var t=e.message,r="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)r+="&args[]="+encodeURIComponent(arguments[n]);return e.message="Minified React error #"+t+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",e}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g={};function _(e,t,r){this.props=e,this.context=t,this.refs=g,this.updater=r||x}function S(){}function w(e,t,r){this.props=e,this.context=t,this.refs=g,this.updater=r||x}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw b(Error(85));this.updater.enqueueSetState(this,e,t,"setState")},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},S.prototype=_.prototype;var k=w.prototype=new S;k.constructor=w,n(k,_.prototype),k.isPureReactComponent=!0;var j={current:null},E={suspense:null},O={current:null},P=Object.prototype.hasOwnProperty,T={key:!0,ref:!0,__self:!0,__source:!0};function I(e,t,r){var n,i={},l=null,a=null;if(null!=t)for(n in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(l=""+t.key),t)P.call(t,n)&&!T.hasOwnProperty(n)&&(i[n]=t[n]);var s=arguments.length-2;if(1===s)i.children=r;else if(1<s){for(var u=Array(s),c=0;c<s;c++)u[c]=arguments[c+2];i.children=u}if(e&&e.defaultProps)for(n in s=e.defaultProps)void 0===i[n]&&(i[n]=s[n]);return{$$typeof:o,type:e,key:l,ref:a,props:i,_owner:O.current}}function R(e){return"object"==typeof e&&null!==e&&e.$$typeof===o}var C=/\/+/g,M=[];function A(e,t,r,n){if(M.length){var i=M.pop();return i.result=e,i.keyPrefix=t,i.func=r,i.context=n,i.count=0,i}return{result:e,keyPrefix:t,func:r,context:n,count:0}}function D(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>M.length&&M.push(e)}function L(e,t,r){return null==e?0:function e(t,r,n,i){var a=typeof t;"undefined"!==a&&"boolean"!==a||(t=null);var s=!1;if(null===t)s=!0;else switch(a){case"string":case"number":s=!0;break;case"object":switch(t.$$typeof){case o:case l:s=!0}}if(s)return n(i,t,""===r?"."+W(t,0):r),1;if(s=0,r=""===r?".":r+":",Array.isArray(t))for(var u=0;u<t.length;u++){var c=r+W(a=t[u],u);s+=e(a,c,n,i)}else if("function"==typeof(c=null===t||"object"!=typeof t?null:"function"==typeof(c=v&&t[v]||t["@@iterator"])?c:null))for(t=c.call(t),u=0;!(a=t.next()).done;)s+=e(a=a.value,c=r+W(a,u++),n,i);else if("object"===a)throw n=""+t,b(Error(31),"[object Object]"===n?"object with keys {"+Object.keys(t).join(", ")+"}":n,"");return s}(e,"",t,r)}function W(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,(function(e){return t[e]}))}(e.key):t.toString(36)}function B(e,t){e.func.call(e.context,t,e.count++)}function N(e,t,r){var n=e.result,i=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?z(e,n,r,(function(e){return e})):null!=e&&(R(e)&&(e=function(e,t){return{$$typeof:o,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(e,i+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(C,"$&/")+"/")+r)),n.push(e))}function z(e,t,r,n,i){var o="";null!=r&&(o=(""+r).replace(C,"$&/")+"/"),L(e,N,t=A(t,o,n,i)),D(t)}function F(){var e=j.current;if(null===e)throw b(Error(321));return e}var $={Children:{map:function(e,t,r){if(null==e)return e;var n=[];return z(e,n,null,t,r),n},forEach:function(e,t,r){if(null==e)return e;L(e,B,t=A(null,null,t,r)),D(t)},count:function(e){return L(e,(function(){return null}),null)},toArray:function(e){var t=[];return z(e,t,null,(function(e){return e})),t},only:function(e){if(!R(e))throw b(Error(143));return e}},createRef:function(){return{current:null}},Component:_,PureComponent:w,createContext:function(e,t){return void 0===t&&(t=null),(e={$$typeof:d,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:c,_context:e},e.Consumer=e},forwardRef:function(e){return{$$typeof:p,render:e}},lazy:function(e){return{$$typeof:y,_ctor:e,_status:-1,_result:null}},memo:function(e,t){return{$$typeof:h,type:e,compare:void 0===t?null:t}},useCallback:function(e,t){return F().useCallback(e,t)},useContext:function(e,t){return F().useContext(e,t)},useEffect:function(e,t){return F().useEffect(e,t)},useImperativeHandle:function(e,t,r){return F().useImperativeHandle(e,t,r)},useDebugValue:function(){},useLayoutEffect:function(e,t){return F().useLayoutEffect(e,t)},useMemo:function(e,t){return F().useMemo(e,t)},useReducer:function(e,t,r){return F().useReducer(e,t,r)},useRef:function(e){return F().useRef(e)},useState:function(e){return F().useState(e)},Fragment:a,Profiler:u,StrictMode:s,Suspense:f,unstable_SuspenseList:m,createElement:I,cloneElement:function(e,t,r){if(null==e)throw b(Error(267),e);var i=n({},e.props),l=e.key,a=e.ref,s=e._owner;if(null!=t){if(void 0!==t.ref&&(a=t.ref,s=O.current),void 0!==t.key&&(l=""+t.key),e.type&&e.type.defaultProps)var u=e.type.defaultProps;for(c in t)P.call(t,c)&&!T.hasOwnProperty(c)&&(i[c]=void 0===t[c]&&void 0!==u?u[c]:t[c])}var c=arguments.length-2;if(1===c)i.children=r;else if(1<c){u=Array(c);for(var d=0;d<c;d++)u[d]=arguments[d+2];i.children=u}return{$$typeof:o,type:e.type,key:l,ref:a,props:i,_owner:s}},createFactory:function(e){var t=I.bind(null,e);return t.type=e,t},isValidElement:R,version:"16.10.2",unstable_withSuspenseConfig:function(e,t){var r=E.suspense;E.suspense=void 0===t?null:t;try{e()}finally{E.suspense=r}},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentDispatcher:j,ReactCurrentBatchConfig:E,ReactCurrentOwner:O,IsSomeRendererActing:{current:!1},assign:n}},U={default:$},q=U&&$||U;e.exports=q.default||q},function(e,t,r){
11/*
12object-assign
13(c) Sindre Sorhus
14@license MIT
15*/
16var n=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function l(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,a,s=l(e),u=1;u<arguments.length;u++){for(var c in r=Object(arguments[u]))i.call(r,c)&&(s[c]=r[c]);if(n){a=n(r);for(var d=0;d<a.length;d++)o.call(r,a[d])&&(s[a[d]]=r[a[d]])}}return s}},function(e,t,r){e.exports=r(5)()},function(e,t,r){var n=r(6);function i(){}function o(){}o.resetWarningCache=i,e.exports=function(){function e(e,t,r,i,o,l){if(l!==n){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:i};return r.PropTypes=r,r}},function(e,t,r){e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,r){}])}))),g=function(e){var t=e.data,r=e.index,n=e.active,o=e.setMaskref,l=e.setObjectref;return i.default.createElement("div",{className:"px_slide ".concat(n?"active":"")},i.default.createElement("div",{className:"px_mask",ref:function(e){o(e,r)}},i.default.createElement("div",{className:"px_objectWrapper",ref:function(e){l(e,r)}},t.videohandle?i.default.createElement("div",{className:"px_object"},i.default.createElement("video",{className:"videoElement",playsInline:!0,loop:!0,muted:!0,autoPlay:!1,poster:t.Picturehandle&&"https://media.graphassets.com/resize=w:1200/output=format:webp/quality=value:30/compress/".concat(t.Picturehandle)},t.videohandleWebm&&i.default.createElement("source",{src:t.videohandleWebm,type:"video/webm"}),i.default.createElement("source",{src:t.videohandle,type:"video/mp4"}))):i.default.createElement("div",{className:"px_object"},i.default.createElement(x,{handle:t.Picturehandle,objectFitMode:!0,width:1800,className:"pictureElement",alt:t.title,isLazy:!1})))))},_=function(t){d(n,e.Component);var r=v(n);function n(e){var t;return a(this,n),c(h(t=r.call(this,e)),"setMaskArray",(function(e,r){t.slidesMaskArray[r]||(t.slidesMaskArray[r]=e)})),c(h(t),"setObjectArray",(function(e,r){t.slidesObjectArray[r]||(t.slidesObjectArray[r]=e)})),c(h(t),"slideToAnimation",(function(e,r){t.sliderRef.sliderTimeline.set(t.slidesMaskArray[r],{translateX:"next"===t.sliderRef.slideDirection?"100%":"-100%"}).set(t.slidesObjectArray[r],{translateX:"next"===t.sliderRef.slideDirection?"-60%":"60%"}).to(t.slidesMaskArray[r],{onStart:function(){t.slidesMaskArray[t.sliderRef.currentSlideIndex].closest(".px_slide").classList.remove("active"),t.slidesObjectArray[r].closest(".px_slide").classList.add("active")},onComplete:function(){t.sliderRef.updateCurrentIndex(e,r)},translateX:"0%",ease:"Expo.easeInOut"},0).to(t.slidesObjectArray[r],{translateX:"0%",ease:"Expo.easeInOut"},0).to(t.slidesMaskArray[t.sliderRef.currentSlideIndex],{translateX:"next"===t.sliderRef.slideDirection?"-100%":"100%",ease:"Expo.easeInOut"},0).to(t.slidesObjectArray[t.sliderRef.currentSlideIndex],{translateX:"next"===t.sliderRef.slideDirection?"60%":"-60%",ease:"Expo.easeInOut"},0)})),t.slidesMaskArray=[],t.slidesObjectArray=[],t.sliderRef=t.props.sliderRef,t}return u(n,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"render",value:function(){var e=this,t=this.props,r=t.data,n=t.tiltBackground;return i.default.createElement("div",{className:"px_slider ".concat(n?"px_tilt":"")},r.map((function(t,r){return i.default.createElement(g,{index:r,data:t,key:"slide_".concat(r),active:r===e.sliderRef.currentSlideIndex,setMaskref:e.setMaskArray,setObjectref:e.setObjectArray})})))}}]),n}(),S=function(e){var t=e.index,r=e.active,n=e.setMaskref,o=e.children;return i.default.createElement("div",{className:"px_slide ".concat(r?"active":"")},i.default.createElement("div",{className:"px_mask",ref:function(e){n(e,t)}},o))},w={p1:{x:0,y:0},p2:{x:100,y:0},p3:{x:100,y:100},p4:{x:0,y:100}},k=function(t){d(n,e.Component);var r=v(n);function n(e){var t;return a(this,n),c(h(t=r.call(this,e)),"setMaskArray",(function(e,r){t.slidesMaskArray[r]||(t.slidesMaskArray[r]=e)})),c(h(t),"updateClipPath",(function(e){o.default.set(e,{clipPath:"polygon(".concat(w.p1.x,"% ").concat(w.p1.y,"%, ").concat(w.p2.x,"% ").concat(w.p2.y,"%, ").concat(w.p3.x,"% ").concat(w.p3.y,"%, ").concat(w.p4.x,"% ").concat(w.p4.y,"%)"),webkitClipPath:"polygon(".concat(w.p1.x,"% ").concat(w.p1.y,"%, ").concat(w.p2.x,"% ").concat(w.p2.y,"%, ").concat(w.p3.x,"% ").concat(w.p3.y,"%, ").concat(w.p4.x,"% ").concat(w.p4.y,"%)")})})),c(h(t),"slideToAnimation",(function(e,r){var n=t.sliderRef,i=n.currentSlideIndex,l=n.sliderTimeline,a=n.slideDirection,s=n.updateCurrentIndex,u=t.slidesMaskArray[i],c=t.slidesMaskArray[r];l.set([w.p2,w.p3],{x:"next"===a?0:100,onUpdate:function(){return t.updateClipPath(c)}}).to([w.p2,w.p3],{onUpdate:function(){return t.updateClipPath("next"===a?c:u)},ease:"power2.inOut",x:"next"===a?100:0,stagger:.06,onStart:function(){"next"===a&&(u.closest(".px_slide").classList.remove("active"),c.closest(".px_slide").classList.add("active"))},onComplete:function(){o.default.set([w.p2,w.p3],{x:0,onUpdate:function(){return t.updateClipPath(u)}}),s(e,r),"next"!==a&&(u.closest(".px_slide").classList.remove("active"),c.closest(".px_slide").classList.add("active"))}})})),t.slidesMaskArray=[],t.sliderRef=t.props.sliderRef,t}return u(n,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"render",value:function(){var e=this,t=this.props.children;return i.default.createElement("div",{className:"clip_slider"},t.map((function(t,r){return i.default.createElement(S,{index:r,key:"slide_".concat(r),setMaskref:e.setMaskArray,active:r===e.sliderRef.currentSlideIndex},t)})))}}]),n}(),j=function(t){d(n,e.Component);var r=v(n);function n(){var e;a(this,n);for(var t=arguments.length,i=new Array(t),l=0;l<t;l++)i[l]=arguments[l];return c(h(e=r.call.apply(r,[this].concat(i))),"performTiltAnimation",(function(t){if(e.props.sliderRef&&!e.props.sliderRef.isSliding&&e.props.sliderRef.tiltBackground){var r=t.pageX/window.innerWidth-.5,n=t.pageY/window.innerHeight-.5;o.default.to(".px_slider .active .px_object",{duration:.6,rotationY:-5*r,rotationX:-5*n,ease:"Power1.easeOut",transformPerspective:1e3,transformOrigin:"center"})}})),e}return u(n,[{key:"componentDidMount",value:function(){document.addEventListener("mousemove",this.performTiltAnimation,!1)}},{key:"shouldComponentUpdate",value:function(){return!1}},{key:"componentWillUnmount",value:function(){document.removeEventListener("mousemove",this.performTiltAnimation,!1)}},{key:"render",value:function(){return this.props.children}}]),n}();var E=function(t){d(n,e.Component);var r=v(n);function n(e){var t,i,o,l;return a(this,n),c(h(t=r.call(this,e)),"handleScroll",(i=function(e){var r=t.sliderRef,n=r.isSliding,i=r.scrollToSlide,o=r.slideNext,l=r.slidePrevious;!n&&i&&(e.preventDefault(),e.stopPropagation(),t.scrollDirection=function(e){var t=null,r=!1;return e||window.event,e.wheelDelta?t=e.wheelDelta/60:e.detail&&(t=-e.detail/2),null!==t&&(r=t>0?"up":"down"),r}(e),"down"===t.scrollDirection?o():"up"===t.scrollDirection&&l())},o=1500,function(){var e=this,t=arguments,r=function(){l=!1};l||(i.apply(e,t),l=!0,setTimeout(r,o))})),t.sliderRef=t.props.sliderRef,t.scrollDirection=null,t}return u(n,[{key:"componentDidMount",value:function(){"undefined"!=typeof window&&(navigator.userAgent.indexOf("Firefox")<0&&document.addEventListener("wheel",this.handleScroll,{passive:!1}),document.addEventListener("DOMMouseScroll",this.handleScroll,{passive:!1}))}},{key:"shouldComponentUpdate",value:function(){return!1}},{key:"componentWillUnmount",value:function(){document.removeEventListener("wheel",this.handleScroll),document.removeEventListener("DOMMouseScroll",this.handleScroll)}},{key:"render",value:function(){return this.props.children}}]),n}(),O=function(t){var r=t.tiltBackground,n=t.sliderRef,o=m(t,["tiltBackground","sliderRef"]);return i.default.createElement(e.Fragment,null,r&&!n.scrollToSlide&&i.default.createElement(j,{sliderRef:n},o.children),!r&&n.scrollToSlide&&i.default.createElement(E,{sliderRef:n},o.children),r&&n.scrollToSlide&&i.default.createElement(j,{sliderRef:n},i.default.createElement(E,{sliderRef:n},o.children)),!r&&!n.scrollToSlide&&o.children)};!function(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===r&&n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}("#canvasWrapper{position:fixed;width:100vw;height:100vh;top:0;left:0}#canvasWrapper canvas{top:0;left:0;width:100%;height:100%;display:block;position:fixed;object-fit:cover}.clip_slider,.px_slider{width:100%;height:100%;z-index:1;position:relative}.clip_slider .px_slide,.px_slider .px_slide{width:100%;height:100%;top:0;position:absolute}.clip_slider .px_slide .px_mask,.px_slider .px_slide .px_mask{position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden;transform:translate3d(100%,0,0)}.clip_slider .px_slide .px_objectWrapper,.px_slider .px_slide .px_objectWrapper{position:relative;width:100%;height:100%;transform:translate3d(-60%,0,0)}.clip_slider .px_slide .px_object,.px_slider .px_slide .px_object{width:100%;height:100%;background-position:center 10%;transform-style:preserve-3d;perspective:98px;transform:matrix(1,0,0,1,0,0);background:#020a20}.clip_slider .px_slide .px_object .wrapper,.px_slider .px_slide .px_object .wrapper{overflow:initial}.clip_slider .px_slide .px_object img,.px_slider .px_slide .px_object img{width:100%;height:100%;object-fit:cover;max-width:none;transform-origin:center}@media (max-width:1400px){.clip_slider .px_slide .px_object img,.px_slider .px_slide .px_object img{transform:scale(1.05)}}@media (min-width:1401px) and (max-width:3000px){.clip_slider .px_slide .px_object img,.px_slider .px_slide .px_object img{transform:scale(1.08)}}@media (min-width:3001px){.clip_slider .px_slide .px_object img,.px_slider .px_slide .px_object img{transform:scale(1.12)}}.clip_slider .px_slide video,.px_slider .px_slide video{position:absolute;width:100vw;height:56.25vw;min-height:100vh;min-width:177.77vh;top:50%;left:50%;-ms-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0);background:#020a20}.clip_slider .active,.px_slider .active{z-index:4;display:block}.clip_slider .active .px_mask,.clip_slider .active .px_objectWrapper,.px_slider .active .px_mask,.px_slider .active .px_objectWrapper{transform:translateZ(0)}.clip_slider .px_slide .px_mask{transform:translateZ(0);clip-path:polygon(0 0,0 0,0 100%,0 100%)}.clip_slider .px_slide:first-child .px_mask{clip-path:polygon(0 0,100% 0,100% 100%,0 100%)}");var P=function(t){d(n,e.Component);var r=v(n);function n(e){var t;return a(this,n),c(h(t=r.call(this,e)),"addEventListeners",(function(){"undefined"!=typeof window&&document.addEventListener("visibilitychange",t.handleTabsVisibility),window.addEventListener("focus",t.handleBrowserFocus),window.addEventListener("blur",t.handleBrowserFocus)})),c(h(t),"removeEventListeners",(function(){document.removeEventListener("visibilitychange",t.handleTabsVisibility),window.removeEventListener("focus",t.handleBrowserFocus),window.removeEventListener("blur",t.handleBrowserFocus)})),c(h(t),"handleSlideAutoplay",(function(){t.props.autoplay&&(t.autoplayTimeout=setTimeout((function(){t.slideTo(t.currentSlideIndex+1)}),t.props.autoplaySpeed))})),c(h(t),"createExportables",(function(){var e={};e.slideTo=t.slideTo,e.slideNext=t.slideNext,e.slidePrevious=t.slidePrevious,e.pause=t.pause,e.resume=t.resume,e.updateScrollToSlide=t.updateScrollToSlide,e.updateTiltBackground=t.updateTiltBackground,e.isIterateable=t.isIterateable,e.isPaused=function(){return t.isPaused},e.isSliding=function(){return t.isSliding},e.direction=function(){return t.direction},e.currentIndex=function(){return t.currentSlideIndex},t.props.parallaxSliderApi(e)})),c(h(t),"handleTabsVisibility",(function(){"hidden"===document.visibilityState?t.pause():"visible"===document.visibilityState&&t.resume()})),c(h(t),"handleBrowserFocus",(function(e){"blur"===e.type?t.pause():t.resume()})),c(h(t),"slideNext",(function(){t.isSliding||t.slideTo(t.currentSlideIndex+1,!0,t.currentSlideIndex===t.totalSlides-1?"next":null)})),c(h(t),"slidePrevious",(function(){t.isSliding||(0===t.currentSlideIndex?t.slideTo(t.totalSlides-1,!0,"prev"):t.slideTo(t.currentSlideIndex-1,!0))})),c(h(t),"isIterateable",(function(){return!t.props.iterations||t.iterationCounter<t.props.iterations*t.totalSlides})),c(h(t),"resume",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t.isPausedManually&&!e||(t.isPausedManually=!1,t.isPaused=!1,t.isIterateable()&&(clearTimeout(t.autoplayTimeout),t.handleSlideAutoplay()))})),c(h(t),"pause",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t.isPausedManually||(t.isPausedManually=e||t.isPausedManually,t.isPaused=!0,clearTimeout(t.autoplayTimeout))})),c(h(t),"updateCurrentIndex",(function(e,r){t.currentSlideIndex=e?r:"next"===t.slideDirection?t.currentSlideIndex+1:t.currentSlideIndex-1,t.currentSlideIndex=t.currentSlideIndex%t.totalSlides})),c(h(t),"updateScrollToSlide",(function(e){t.scrollToSlide=e})),c(h(t),"updateTiltBackground",(function(e){t.tiltBackground=e})),c(h(t),"slideTo",(function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(e!==t.currentSlideIndex){t.sliderTimeline&&t.isSliding&&t.sliderTimeline.seek(t.sliderTimeline.endTime(),!1),clearTimeout(t.autoplayTimeout);var i=e%t.totalSlides;n?t.slideDirection=n:(t.slideDirection=i>=t.currentSlideIndex?"next":"prev",r||(t.slideDirection=0===i?"next":t.slideDirection)),t.isSliding=!0,t.isSliding&&(t.sliderTimeline=o.default.timeline({defaults:{duration:t.props.slideSpeed},onStart:function(){t.props.onSlideStart&&t.props.onSlideStart(t.currentSlideIndex,i,t.slideDirection)},onComplete:function(){t.isSliding=!1,t.props.onSlideComplete&&t.props.onSlideComplete();var e=!t.props.iterations||t.iterationCounter<t.props.iterations*t.totalSlides;t.props.autoplay&&e&&!t.isPaused&&(t.iterationCounter++,t.autoplayTimeout=setTimeout((function(){t.slideTo(t.currentSlideIndex+1)}),t.props.autoplaySpeed))}}),t.effectRef.slideToAnimation(r,i))}})),t.isPaused=!1,t.isSliding=!1,t.iterationCounter=1,t.sliderTimeline=null,t.slideDirection="next",t.isPausedManually=!1,t.totalSlides=e.children?e.children.length:e.data.length,t.scrollToSlide=e.scrollToSlide,t.tiltBackground=e.tiltBackground,t.currentSlideIndex=t.props.initialSlideIndex,t}return u(n,[{key:"componentDidMount",value:function(){this.createExportables(),this.handleSlideAutoplay(),this.addEventListeners()}},{key:"shouldComponentUpdate",value:function(){return!1}},{key:"componentWillUnmount",value:function(){this.props.parallaxSliderApi(void 0),clearTimeout(this.autoplayTimeout),this.sliderTimeline&&this.sliderTimeline.kill(),this.removeEventListeners()}},{key:"render",value:function(){var t=this,r=this.props,n=r.data,o=r.tiltBackground,l=r.effect,a=r.children;return i.default.createElement(e.Fragment,null,i.default.createElement(O,{tiltBackground:"parallax"===l&&o,sliderRef:this},"parallax"===l&&i.default.createElement(_,{sliderRef:this,data:n,ref:function(e){t.effectRef=e},tiltBackground:o}),"unmask"===l&&i.default.createElement(k,{data:n,sliderRef:this,children:a,ref:function(e){t.effectRef=e}})))}}]),n}();P.propTypes={data:l.default.array.isRequired,autoplay:l.default.bool,autoplaySpeed:l.default.number,slideSpeed:l.default.number,initialSlideIndex:l.default.number,iterations:l.default.number,tiltBackground:l.default.bool,scrollToSlide:l.default.bool,effect:l.default.string},P.defaultProps={iterations:null,autoplay:!1,slideSpeed:1.6,autoplaySpeed:3e3,scrollToSlide:!1,initialSlideIndex:0,tiltBackground:!1,effect:"parallax"},module.exports=P;