"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var E=require("./extend-DGz701kq.js"),d=require("motion/react"),r=require("react");function $(e){const n=r.useRef(e);return n.current=e,r.useCallback((...i)=>n.current(...i),[])}const j=e=>[typeof e=="object"?e.x:null,typeof e=="object"?e.y:null,typeof e!="object"?e:null],w=(e,n)=>r.useEffect(e,j(n)),D=(e,n)=>r.useMemo(e,j(n)),L=["alpha","angle","rotation","x","y","width","height"],X=["scale","pivot","position","skew"],R=[...L,...X],c=e=>{if(e===void 0)return;const n=Object.fromEntries(Object.entries(e).filter(([i])=>!(i in R)));if(Object.keys(n).length!==0)return n};function _(e){return function({initial:n,animate:i,ref:f,transition:M,...x}){const a=r.useRef(null);r.useImperativeHandle(f,()=>a.current);const g=r.useRef(!0),h=r.use(d.MotionConfigContext).transition,v=$(t=>{const o=i?.transition,s=i?.transition?.[t],u=M,p=M?.[t],m=h,I=h?.[t];return c(s)??c(o)??c(p)??c(u)??c(I)??c(m)}),P=t=>{const o=x[t],s=r.useRef(n?.[t]??o??i?.[t]).current;return D(()=>g.current?s:o,o)},l=r.useRef({}),y=r.useCallback((t,o)=>{var s;(s=l.current)[t]??(s[t]=[]),l.current[t].push(o)},[]),O=r.useCallback(t=>{l.current[t]?.forEach(o=>o.stop()),l.current[t]=[]},[]),q=r.useCallback((t,o)=>{if(o===void 0||!a.current)return;const s=v(t);if(typeof o=="object"){const u=a.current?.[t],{x:p,y:m}=o;if(!u)return;p!==void 0&&y(t,d.animate(u,{x:[u.x,p]},s)),m!==void 0&&y(t,d.animate(u,{y:[u.y,m]},s))}else y(t,d.animate(a.current,{[t]:o},s))},[v]),C=r.useRef({});for(const t of R)C.current[t]=P(t),w(()=>()=>O(t),x[t]),w(()=>q(t,i?.[t]),i?.[t]);return r.useEffect(()=>{g.current=!1},[]),r.createElement(e,{...x,...C.current,ref:a})}}const b=new Proxy({},{get(e,n){if(!(n in e))throw n in E.catalogue?new Error(`${n} is part of the PIXI namespace, but is not part of the motion namespace! Did you forget to extendMotion?`):new Error(`${n} is not part of the motion namespace! Did you forget to extendMotion?`);return e[n]},set(e,n,i){if(typeof n=="string"){const f=_(`pixi${n}`);e[n.toLowerCase()]=f,e[`pixi${n}`]=f}else e[n]=i;return!0}});function k(e){Object.assign(b,e),E.extend(e)}function F(e){r.useMemo(()=>{k(e)},[e])}exports.default=b,exports.extendMotion=k,exports.pixiMotion=b,exports.useExtendMotion=F;
//# sourceMappingURL=pixi-react.min2.js.map
