(function(fe,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],u):(fe=typeof globalThis<"u"?globalThis:fe||self,u(fe["react-next-tilt"]={},fe.React))})(this,function(fe,u){"use strict";var $e={exports:{}},Le={};/** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ur;function dr(){if(ur)return Le;ur=1;var a=u,s=Symbol.for("react.element"),y=Symbol.for("react.fragment"),d=Object.prototype.hasOwnProperty,g=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,_={key:!0,ref:!0,__self:!0,__source:!0};function te(B,p,ue){var C,H={},O=null,Ce=null;ue!==void 0&&(O=""+ue),p.key!==void 0&&(O=""+p.key),p.ref!==void 0&&(Ce=p.ref);for(C in p)d.call(p,C)&&!_.hasOwnProperty(C)&&(H[C]=p[C]);if(B&&B.defaultProps)for(C in p=B.defaultProps,p)H[C]===void 0&&(H[C]=p[C]);return{$$typeof:s,type:B,key:O,ref:Ce,props:H,_owner:g.current}}return Le.Fragment=y,Le.jsx=te,Le.jsxs=te,Le}var We={};/** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var sr;function mr(){return sr||(sr=1,process.env.NODE_ENV!=="production"&&function(){var a=u,s=Symbol.for("react.element"),y=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),te=Symbol.for("react.provider"),B=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),ue=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),Ce=Symbol.for("react.offscreen"),Ne=Symbol.iterator,ye="@@iterator";function Ge(e){if(e===null||typeof e!="object")return null;var r=Ne&&e[Ne]||e[ye];return typeof r=="function"?r:null}var ne=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function h(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),f=1;f=1&&E>=0&&c[b]!==k[E];)E--;for(;b>=1&&E>=0;b--,E--)if(c[b]!==k[E]){if(b!==1||E!==1)do if(b--,E--,E<0||c[b]!==k[E]){var F=` `+c[b].replace(" at new "," at ");return e.displayName&&F.includes("")&&(F=F.replace("",e.displayName)),typeof e=="function"&&S.set(e,F),F}while(b>=1&&E>=0);break}}}finally{j=!1,Xe.current=m,w(),Error.prepareStackTrace=v}var Ie=e?e.displayName||e.name:"",vr=Ie?ke(Ie):"";return typeof e=="function"&&S.set(e,vr),vr}function ce(e,r,t){return Fe(e,!1)}function Ue(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function ie(e,r,t){if(e==null)return"";if(typeof e=="function")return Fe(e,Ue(e));if(typeof e=="string")return ke(e);switch(e){case ue:return ke("Suspense");case C:return ke("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case p:return ce(e.render);case H:return ie(e.type,r,t);case O:{var f=e,v=f._payload,m=f._init;try{return ie(m(v),r,t)}catch{}}}return""}var le=Object.prototype.hasOwnProperty,Oe={},je=ne.ReactDebugCurrentFrame;function ve(e){if(e){var r=e._owner,t=ie(e.type,e._source,r?r.type:null);je.setExtraStackFrame(t)}else je.setExtraStackFrame(null)}function Be(e,r,t,f,v){{var m=Function.call.bind(le);for(var i in e)if(m(e,i)){var c=void 0;try{if(typeof e[i]!="function"){var k=Error((f||"React class")+": "+t+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw k.name="Invariant Violation",k}c=e[i](r,i,f,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(b){c=b}c&&!(c instanceof Error)&&(ve(v),h("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",f||"React class",t,i,typeof c),ve(null)),c instanceof Error&&!(c.message in Oe)&&(Oe[c.message]=!0,ve(v),h("Failed %s type: %s",t,c.message),ve(null))}}}var He=Array.isArray;function Je(e){return He(e)}function nr(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function ar(e){try{return R(e),!1}catch{return!0}}function R(e){return""+e}function de(e){if(ar(e))return h("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",nr(e)),R(e)}var N=ne.ReactCurrentOwner,$={key:!0,ref:!0,__self:!0,__source:!0},x,D,V;V={};function or(e){if(le.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function fr(e){if(le.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Se(e,r){if(typeof e.ref=="string"&&N.current&&r&&N.current.stateNode!==r){var t=I(N.current.type);V[t]||(h('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',I(N.current.type),e.ref),V[t]=!0)}}function Me(e,r){{var t=function(){x||(x=!0,h("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function Y(e,r){{var t=function(){D||(D=!0,h("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var X=function(e,r,t,f,v,m,i){var c={$$typeof:s,type:e,key:r,ref:t,props:i,_owner:m};return c._store={},Object.defineProperty(c._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(c,"_self",{configurable:!1,enumerable:!1,writable:!1,value:f}),Object.defineProperty(c,"_source",{configurable:!1,enumerable:!1,writable:!1,value:v}),Object.freeze&&(Object.freeze(c.props),Object.freeze(c)),c};function me(e,r,t,f,v){{var m,i={},c=null,k=null;t!==void 0&&(de(t),c=""+t),fr(r)&&(de(r.key),c=""+r.key),or(r)&&(k=r.ref,Se(r,v));for(m in r)le.call(r,m)&&!$.hasOwnProperty(m)&&(i[m]=r[m]);if(e&&e.defaultProps){var b=e.defaultProps;for(m in b)i[m]===void 0&&(i[m]=b[m])}if(c||k){var E=typeof e=="function"?e.displayName||e.name||"Unknown":e;c&&Me(i,E),k&&Y(i,E)}return X(e,c,k,v,f,N.current,i)}}var q=ne.ReactCurrentOwner,G=ne.ReactDebugCurrentFrame;function ae(e){if(e){var r=e._owner,t=ie(e.type,e._source,r?r.type:null);G.setExtraStackFrame(t)}else G.setExtraStackFrame(null)}var ee;ee=!1;function Z(e){return typeof e=="object"&&e!==null&&e.$$typeof===s}function Q(){{if(q.current){var e=I(q.current.type);if(e)return` Check the render method of \``+e+"`."}return""}}function De(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return` Check your code at `+r+":"+t+"."}return""}}var pe={};function Ee(e){{var r=Q();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=` Check the top-level render call using <`+t+">.")}return r}}function he(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=Ee(r);if(pe[t])return;pe[t]=!0;var f="";e&&e._owner&&e._owner!==q.current&&(f=" It was passed a child from "+I(e._owner.type)+"."),ae(e),h('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,f),ae(null)}}function be(e,r){{if(typeof e!="object")return;if(Je(e))for(var t=0;t",c=" Did you accidentally export a JSX literal instead of a component?"):b=typeof e,h("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",b,c)}var E=me(e,r,t,v,m);if(E==null)return E;if(i){var F=r.children;if(F!==void 0)if(f)if(Je(F)){for(var Ie=0;Ieay?y:a,pr=(a,s,y)=>{let d=0;return s==="top"?d=(a.offsetY*2-1)*-1:s==="bottom"?d=(a.offsetY-.5)*2:s==="left"?d=(a.offsetX*2-1)*-1:s==="right"?d=(a.offsetX-.5)*2:s==="all"&&(d=Math.max(Math.abs(a.offsetX-.5)*2,Math.abs(a.offsetY-.5)*2)),(d*y).toFixed(2)},hr=(a,s,y)=>{let d=a.offsetX,g=a.offsetY;y||(d=1-d,g=1-g);let _="translateX(0%) translateY(0%)";return s==="top"?_=`translateX( ${d*50}% )`:s==="bottom"?_=`translateX( ${d*50}% ) translateY(50%)`:s==="left"?_=`translateY( ${g*50}% )`:s==="right"?_=`translateX(50%) translateY( ${g*50}% ) `:s==="all"&&(_=`translateX(${(d-.5)*50}%) translateY(${(g-.5)*50}%) `),_},cr=a=>{if(!a)return"translateX(0%) translateY(0%)";switch(a){case"top-left":a={left:"25%",top:"25%"};break;case"top-right":a={left:"75%",top:"25%"};break;case"bottom-left":a={left:"25%",top:"75%"};break;case"bottom-right":a={left:"75%",top:"75%"};break;case"center":a={left:"50%",top:"50%"};break}const s=a.left.includes("%")?String(parseInt(a.left)/2)+"%":a.left,y=a.top.includes("%")?String(parseInt(a.top)/2)+"%":a.top;return`translateX(${s}) translateY(${y})`},br=(a,s,y)=>{let d=a.offsetX,g=a.offsetY;s==="top-right"&&(d=1-d),s==="bottom-left"&&(g=1-g),s==="bottom-right"&&(d=1-d,g=1-g);let _=0;return y?_=((d+g)*(3/2)-1)*100:_=((d+g)*(-3/2)+.5)*100,`translateX(${_}%)`},ir=(a,s)=>{if(!s)return`translateX(${a?"50%":"-100%"})`;switch(s){case"left":s={left:"25%"};break;case"center":s={left:"50%"};break;case"right":s={left:"75%"};break}return`translateX(${s.left.includes("%")?String(parseInt(s.left)/2)+"%":s.left})`},lr=a=>{if(a instanceof HTMLElement)return a;if(a instanceof Document)return document.documentElement;if(a.current&&a.current instanceof Object&&"element"in a.current&&a.current.element instanceof HTMLElement)return a.current.element;if(a.current&&a.current instanceof HTMLElement)return a.current},yr=u.forwardRef(({width:a,height:s,borderRadius:y,perspective:d="1000px",scale:g=1,shadowEnable:_=!1,shadow:te="0 0 1rem rgba(0,0,0,0.5)",shadowType:B="box",lineGlareEnable:p=!0,lineGlareBlurEnable:ue=!0,lineGlareBlurAmount:C="4px",lineGlareMaxOpacity:H=.1,lineGlareWidthPercent:O=10,lineGlareMixBlendMode:Ce="normal",lineGlareColor:Ne="white",lineGlareReverse:ye=!1,lineGlareDirection:Ge="to-bottom-right",lineGlareHoverPosition:ne="top-left",lineGlareFixedPosition:h=void 0,spotGlareEnable:ze=!0,spotGlareSizePercent:Te=200,spotGlareMaxOpacity:xe=.5,spotGlareMixBlendMode:er="normal",spotGlarePosition:ge="top",spotGlareColor:rr="white",spotGlareReverse:Ve=!1,spotGlareFixedPosition:P=void 0,tiltMaxAngleX:M=20,tiltMaxAngleY:J=20,tiltReverse:I=!1,tiltReset:L=!0,initialAngleX:T=0,initialAngleY:W=0,disableScrollOnTouch:z=!0,style:Ke,tiltStyle:Ae,tiltClass:Ze,tiltProps:Qe,gyroMaxAngleX:K=0,gyroMaxAngleY:A=0,gyroReverse:Pe=!1,disabled:w=!1,disabledFilter:Xe="grayscale(1) brightness(125%)",CSSTransition:se="all 0.4s cubic-bezier(0.03, 0.98, 0.52, 0.99)",TiltWrapper:ke,fullPageListening:j=!1,controlElement:S,controlElementOnly:tr=!1,preserve3dEnable:Fe=!0,testIdEnable:ce=!1,onTilt:Ue,onReset:ie,onMouseEnter:le,onMouseMove:Oe,onMouseLeave:je,onTouchStart:ve,onTouchMove:Be,onTouchEnd:He,children:Je,...nr},ar)=>{const R=u.useRef(),de=u.useRef(!1),N=!j&&(!S||S&&!tr),$=u.useRef(null),x=u.useRef(null),D=u.useRef(null),V=u.useRef(null),or=u.useCallback(({children:n})=>re.jsx(re.Fragment,{children:n}),[]),fr=ke||or;p&&(O=U(O,0,50)/2),ze&&(Te=Te<0?0:Te/2),M=U(M,0,90),J=U(J,0,90),K=U(K,0,90),A=U(A,0,90),T&&(T=U(T,-M,M)),W&&(W=U(W,-J,J));const Se=u.useMemo(()=>p?(100-O)/2:0,[p,O]),Me=u.useMemo(()=>p?Se+O:0,[p,O,Se]),Y=u.useCallback((n=!0)=>{requestAnimationFrame(()=>{x.current&&(x.current.style.willChange=n?"transform":""),D.current&&(D.current.style.willChange=n?"transform, opacity":""),V.current&&(V.current.style.willChange=n?"transform":"")})},[]),X=u.useCallback((n=!0)=>{requestAnimationFrame(()=>{if(B==="box")x.current&&_&&(x.current.style.boxShadow=n?te:"");else if($.current&&_){const o=$.current.style.filter.replace(/(drop-shadow?\(.*?\))(?=\s[a-z].*?\(.*?\)|\s*$)/g,"");$.current.style.filter=n?o+` drop-shadow(${te})`:o}})},[te,_,B]),me=u.useCallback(()=>{if(!$.current||!D.current||!R.current||P)return;const n=pr(R.current,ge,xe),o=hr(R.current,ge,Ve);requestAnimationFrame(()=>{D.current&&(D.current.style.opacity=n,D.current.style.transform=o)})},[ge,xe,Ve,P]),q=u.useCallback(()=>{if(!$.current||!V.current||!R.current||h)return;const n=br(R.current,ne,ye);requestAnimationFrame(()=>{V.current&&(V.current.style.transform=n)})},[ne,ye,h]),G=u.useCallback((n=!0)=>{if(!$.current||!R.current)return{angleX:0,angleY:0};let o=-(R.current.offsetY-.5)*2*M,l=(R.current.offsetX-.5)*2*J;return I&&n&&(o=-o,l=-l),{angleX:o,angleY:l}},[M,J,I]),ae=u.useCallback(n=>{const o=(n.angleY/J+1)/2,l=(-n.angleX/M+1)/2;R.current={offsetX:o,offsetY:l}},[M,J]),ee=u.useCallback((n,o=!0,l=!1)=>{const we=o?g:1;requestAnimationFrame(()=>{x.current&&(x.current.style.transform=`rotateX(${n.angleX}deg) rotateY(${n.angleY}deg) scale3d(${we},${we},${we})`)}),Ue&&Ue({angleX:n.angleX,angleY:n.angleY},l)},[Ue,g]),Z=u.useCallback((n,o=!1,l=!1)=>{ae(n),ee(n,o,l),X(o),q(),me()},[ae,ee,X,q,me]),Q=u.useCallback(()=>{ie&&ie(),T||W?Z({angleX:T||0,angleY:W||0}):(R.current=void 0,requestAnimationFrame(()=>{V.current&&!h&&(V.current.style.transform=ir(ye)),D.current&&!P&&(D.current.style.transform=cr(),D.current.style.opacity="0"),x.current&&(x.current.style.transform="rotateX(0deg) rotateY(0deg) scale3d(1, 1, 1)")}))},[T,W,ye,P,h,ie,Z]),De=u.useCallback((n,o)=>{if(!o)return;if(j){R.current={offsetX:n.x/window.innerWidth,offsetY:n.y/window.innerHeight};return}const l=o.getBoundingClientRect();if(!l.width||!l.height)return;const we=U(n.x,l.left,l.right),e=U(n.y,l.top,l.bottom),r=(we-l.left)/l.width,t=(e-l.top)/l.height;R.current={offsetX:r,offsetY:t}},[j]);u.useImperativeHandle(ar,()=>({tilt:Z,reset:Q,angle:()=>G(!1),updateWillChange:Y,element:$.current}),[Z,Q,Y,G]);const pe=u.useCallback(()=>{w||(de.current=!0,Y(),X())},[w,X,Y]),Ee=u.useCallback(()=>{w||(z&&!j&&(typeof z=="boolean"?document.body.style.overflow="hidden":z.style.overflow="hidden"),de.current=!0,Y(),X())},[z,w,j,X,Y]),he=u.useCallback(n=>{w||(De({x:n.clientX,y:n.clientY},n.currentTarget),ee(G()),q(),me())},[w,G,De,ee,q,me]),be=u.useCallback(n=>{if(w)return;const o=n.changedTouches[0];o&&(De({x:o.clientX,y:o.clientY},n.currentTarget),ee(G()),q(),me())},[w,G,De,ee,q,me]),_e=u.useCallback(()=>{w||(de.current=!1,Y(!1),X(!1),L&&Q())},[w,Q,L,X,Y]),Re=u.useCallback(()=>{w||(z&&!j&&(typeof z=="boolean"?document.body.style.overflow="":z.style.overflow=""),de.current=!1,Y(!1),X(!1),L&&Q())},[z,w,j,Q,L,X,Y]);u.useEffect(()=>{if(!S&&!j)return;let n;j||!S?n=[document]:n=Array.isArray(S)?S:[S];for(let o of n){const l=lr(o);l&&(o=l,o.addEventListener("mouseenter",pe),o.addEventListener("mousemove",he),o.addEventListener("mouseleave",_e),o.addEventListener("touchstart",Ee,{passive:!0}),o.addEventListener("touchmove",be,{passive:!0}),o.addEventListener("touchend",Re,{passive:!0}))}return()=>{for(let o of n){const l=lr(o);l&&(o=l,o.removeEventListener("mouseenter",pe),o.removeEventListener("mousemove",he),o.removeEventListener("mouseleave",_e),o.removeEventListener("touchstart",Ee),o.removeEventListener("touchmove",be),o.removeEventListener("touchend",Re))}}},[S,pe,he,_e,Ee,be,Re,j]);const Ye=u.useCallback(n=>{if(de.current||n.beta===null&&n.gamma===null)return;let o=K&&n.beta?U(-n.beta,-K,K):T||0,l=A&&n.gamma?U(n.gamma,-A,A):W||0;Pe&&(o=-o,l=-l),Z({angleX:o,angleY:l},!1,!0)},[K,A,T,W,Pe,Z]);return u.useEffect(()=>{if(!(!K&&!A))return window.addEventListener("deviceorientation",Ye),()=>window.removeEventListener("deviceorientation",Ye)},[K,A,Ye,Y]),re.jsx("div",{ref:n=>{n&&($.current=n,R.current&&(w?Q():Z(G())),(T||W)&&!R.current&&Q())},"data-testid":ce?"container":void 0,style:Object.assign({display:"inline-block",verticalAlign:"middle",width:a,height:s,borderRadius:y,perspective:d,transformStyle:Fe?"preserve-3d":void 0,backfaceVisibility:"hidden",filter:w?Xe:void 0,transition:B==="drop"?se:void 0},Ke),onMouseEnter:N?le?n=>{pe(),le(n)}:pe:le,onTouchStart:N?ve?n=>{Ee(),ve(n)}:Ee:ve,onMouseMove:N?Oe?n=>{he(n),Oe(n)}:he:Oe,onTouchMove:N?Be?n=>{be(n),Be(n)}:be:Be,onMouseLeave:N?je?n=>{_e(),je(n)}:_e:je,onTouchEnd:N?He?n=>{Re(),He(n)}:Re:He,...nr,children:re.jsx(fr,{children:re.jsxs("div",{ref:x,"data-testid":ce?"tilt":void 0,style:Object.assign({boxSizing:"border-box",position:"relative",width:"100%",height:"100%",borderRadius:y,transformStyle:Fe?"preserve-3d":void 0,backfaceVisibility:"hidden",transition:se,transform:"rotateX(0deg) rotateY(0deg) scale3d(1, 1, 1)"},Ae),className:Ze,...Qe,children:[Je,ze&&re.jsx("div",{"data-testid":ce?"spot-glare-container":void 0,style:{pointerEvents:"none",position:"absolute",inset:"0",borderRadius:y,overflow:"hidden",backfaceVisibility:"hidden",mixBlendMode:er},children:re.jsx("div",{ref:D,"data-testid":ce?"spot-glare":void 0,style:{position:"absolute",left:ge==="all"&&!P?"-50%":"-100%",top:ge==="all"&&!P?"-50%":"-100%",width:"200%",height:"200%",transition:se,backgroundImage:`radial-gradient(${rr}, transparent ${Te}%)`,transform:cr(P),opacity:P?xe:"0"}})}),p&&re.jsx("div",{"data-testid":ce?"line-glare-container":void 0,style:{pointerEvents:"none",position:"absolute",inset:"0",borderRadius:y,overflow:"hidden",backfaceVisibility:"hidden",mixBlendMode:Ce},children:re.jsx("div",{"data-testid":ce?"line-glare":void 0,ref:V,style:{position:"absolute",left:h?"-100%":0,top:"-50%",width:"200%",height:"200%",filter:ue?`blur(${C})`:"",transition:se,opacity:String(H),transform:ir(ye,h),backgroundImage:`linear-gradient(${Ge==="to-bottom-right"?"to bottom right":"to bottom left"}, transparent, transparent ${Se}%, ${Ne} calc(${Se}% + 1px), ${Ne} ${Me}%, transparent calc(${Me}% + 1px), transparent 0%)`}})})]})})})}),qe=u.memo(yr);qe.displayName="Tilt",fe.Tilt=qe,fe.default=qe,Object.defineProperties(fe,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});