2 lines
26 KiB
JavaScript
2 lines
26 KiB
JavaScript
import{createContext as t}from"react";function e(t,e){-1===t.indexOf(e)&&t.push(e)}function s(t,e){const s=t.indexOf(e);s>-1&&t.splice(s,1)}const n=(t,e,s)=>s>e?e:s<t?t:s,r={},i=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),a=t=>/^0[^.\s]+$/u.test(t),o=t=>t;class h{constructor(){this.subscriptions=[]}add(t){return e(this.subscriptions,t),()=>s(this.subscriptions,t)}notify(t,e,s){const n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](t,e,s);else for(let r=0;r<n;r++){const n=this.subscriptions[r];n&&n(t,e,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function l(t,e){return e?t*(1e3/e):0}const c=t({}),u=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],d={value:null,addProjectionMetrics:null};function p(t,e){let s=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},a=()=>s=!0,o=u.reduce((t,s)=>(t[s]=function(t,e){let s=new Set,n=new Set,r=!1,i=!1;const a=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1},h=0;function l(e){a.has(e)&&(c.schedule(e),t()),h++,e(o)}const c={schedule:(t,e=!1,i=!1)=>{const o=i&&r?s:n;return e&&a.add(t),o.has(t)||o.add(t),t},cancel:t=>{n.delete(t),a.delete(t)},process:t=>{o=t,r?i=!0:(r=!0,[s,n]=[n,s],s.forEach(l),e&&d.value&&d.value.frameloop[e].push(h),h=0,s.clear(),r=!1,i&&(i=!1,c.process(t)))}};return c}(a,e?s:void 0),t),{}),{setup:h,read:l,resolveKeyframes:c,preUpdate:p,update:f,preRender:m,render:g,postRender:v}=o,y=()=>{const a=r.useManualTiming?i.timestamp:performance.now();s=!1,r.useManualTiming||(i.delta=n?1e3/60:Math.max(Math.min(a-i.timestamp,40),1)),i.timestamp=a,i.isProcessing=!0,h.process(i),l.process(i),c.process(i),p.process(i),f.process(i),m.process(i),g.process(i),v.process(i),i.isProcessing=!1,s&&e&&(n=!1,t(y))};return{schedule:u.reduce((e,r)=>{const a=o[r];return e[r]=(e,r=!1,o=!1)=>(s||(s=!0,n=!0,i.isProcessing||t(y)),a.schedule(e,r,o)),e},{}),cancel:t=>{for(let e=0;e<u.length;e++)o[u[e]].cancel(t)},state:i,steps:o}}const{schedule:f,cancel:m,state:g,steps:v}=p("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:o,!0);let y;function b(){y=void 0}const w={now:()=>(void 0===y&&w.set(g.isProcessing||r.useManualTiming?g.timestamp:performance.now()),y),set:t=>{y=t,queueMicrotask(b)}},V=t=>e=>"string"==typeof e&&e.startsWith(t),S=V("--"),M=V("var(--"),x=t=>!!M(t)&&C.test(t.split("/*")[0].trim()),C=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function A(t){return"string"==typeof t&&t.split("/*")[0].includes("var(--")}const k={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},F={...k,transform:t=>n(0,1,t)},P={...k,default:1},T=t=>Math.round(1e5*t)/1e5,B=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const R=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,E=(t,e)=>s=>Boolean("string"==typeof s&&R.test(s)&&s.startsWith(t)||e&&!function(t){return null==t}(s)&&Object.prototype.hasOwnProperty.call(s,e)),I=(t,e,s)=>n=>{if("string"!=typeof n)return n;const[r,i,a,o]=n.match(B);return{[t]:parseFloat(r),[e]:parseFloat(i),[s]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},N={...k,transform:t=>Math.round((t=>n(0,255,t))(t))},Y={test:E("rgb","red"),parse:I("red","green","blue"),transform:({red:t,green:e,blue:s,alpha:n=1})=>"rgba("+N.transform(t)+", "+N.transform(e)+", "+N.transform(s)+", "+T(F.transform(n))+")"};const L={test:E("#"),parse:function(t){let e="",s="",n="",r="";return t.length>5?(e=t.substring(1,3),s=t.substring(3,5),n=t.substring(5,7),r=t.substring(7,9)):(e=t.substring(1,2),s=t.substring(2,3),n=t.substring(3,4),r=t.substring(4,5),e+=e,s+=s,n+=n,r+=r),{red:parseInt(e,16),green:parseInt(s,16),blue:parseInt(n,16),alpha:r?parseInt(r,16)/255:1}},transform:Y.transform},X=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),O=X("deg"),$=X("%"),j=X("px"),W=X("vh"),U=X("vw"),Z=(()=>({...$,parse:t=>$.parse(t)/100,transform:t=>$.transform(100*t)}))(),K={test:E("hsl","hue"),parse:I("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:s,alpha:n=1})=>"hsla("+Math.round(t)+", "+$.transform(T(e))+", "+$.transform(T(s))+", "+T(F.transform(n))+")"},z={test:t=>Y.test(t)||L.test(t)||K.test(t),parse:t=>Y.test(t)?Y.parse(t):K.test(t)?K.parse(t):L.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?Y.transform(t):K.transform(t),getAnimatableNone:t=>{const e=z.parse(t);return e.alpha=0,z.transform(e)}},D=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const q="number",H="color",G=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function J(t){const e=t.toString(),s=[],n={color:[],number:[],var:[]},r=[];let i=0;const a=e.replace(G,t=>(z.test(t)?(n.color.push(i),r.push(H),s.push(z.parse(t))):t.startsWith("var(")?(n.var.push(i),r.push("var"),s.push(t)):(n.number.push(i),r.push(q),s.push(parseFloat(t))),++i,"${}")).split("${}");return{values:s,split:a,indexes:n,types:r}}function Q(t){return J(t).values}function _(t){const{split:e,types:s}=J(t),n=e.length;return t=>{let r="";for(let i=0;i<n;i++)if(r+=e[i],void 0!==t[i]){const e=s[i];r+=e===q?T(t[i]):e===H?z.transform(t[i]):t[i]}return r}}const tt=t=>"number"==typeof t?0:z.test(t)?z.getAnimatableNone(t):t;const et={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(B)?.length||0)+(t.match(D)?.length||0)>0},parse:Q,createTransformer:_,getAnimatableNone:function(t){const e=Q(t);return _(t)(e.map(tt))}},st=(t,e,s)=>t+(e-t)*s;const nt=t=>180*t/Math.PI,rt=t=>{const e=nt(Math.atan2(t[1],t[0]));return at(e)},it={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:rt,rotateZ:rt,skewX:t=>nt(Math.atan(t[1])),skewY:t=>nt(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},at=t=>((t%=360)<0&&(t+=360),t),ot=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),ht=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),lt={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:ot,scaleY:ht,scale:t=>(ot(t)+ht(t))/2,rotateX:t=>at(nt(Math.atan2(t[6],t[5]))),rotateY:t=>at(nt(Math.atan2(-t[2],t[0]))),rotateZ:rt,rotate:rt,skewX:t=>nt(Math.atan(t[4])),skewY:t=>nt(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function ct(t){return t.includes("scale")?1:0}function ut(t,e){if(!t||"none"===t)return ct(e);const s=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,r;if(s)n=lt,r=s;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=it,r=e}if(!r)return ct(e);const i=n[e],a=r[1].split(",").map(pt);return"function"==typeof i?i(a):a[i]}const dt=(t,e)=>{const{transform:s="none"}=getComputedStyle(t);return ut(s,e)};function pt(t){return parseFloat(t.trim())}const ft=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],mt=(()=>new Set(ft))(),gt=t=>t===k||t===j,vt=new Set(["x","y","z"]),yt=ft.filter(t=>!vt.has(t));const bt={width:({x:t},{paddingLeft:e="0",paddingRight:s="0"})=>t.max-t.min-parseFloat(e)-parseFloat(s),height:({y:t},{paddingTop:e="0",paddingBottom:s="0"})=>t.max-t.min-parseFloat(e)-parseFloat(s),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>ut(e,"x"),y:(t,{transform:e})=>ut(e,"y")};bt.translateX=bt.x,bt.translateY=bt.y;const wt=new Set;let Vt=!1,St=!1,Mt=!1;function xt(){if(St){const t=Array.from(wt).filter(t=>t.needsMeasurement),e=new Set(t.map(t=>t.element)),s=new Map;e.forEach(t=>{const e=function(t){const e=[];return yt.forEach(s=>{const n=t.getValue(s);void 0!==n&&(e.push([s,n.get()]),n.set(s.startsWith("scale")?1:0))}),e}(t);e.length&&(s.set(t,e),t.render())}),t.forEach(t=>t.measureInitialState()),e.forEach(t=>{t.render();const e=s.get(t);e&&e.forEach(([e,s])=>{t.getValue(e)?.set(s)})}),t.forEach(t=>t.measureEndState()),t.forEach(t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)})}St=!1,Vt=!1,wt.forEach(t=>t.complete(Mt)),wt.clear()}function Ct(){wt.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(St=!0)})}function At(){Mt=!0,Ct(),xt(),Mt=!1}class kt{constructor(t,e,s,n,r,i=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=s,this.motionValue=n,this.element=r,this.isAsync=i}scheduleResolve(){this.state="scheduled",this.isAsync?(wt.add(this),Vt||(Vt=!0,f.read(Ct),f.resolveKeyframes(xt))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:s,motionValue:n}=this;if(null===t[0]){const r=n?.get(),i=t[t.length-1];if(void 0!==r)t[0]=r;else if(s&&e){const n=s.readValue(e,i);null!=n&&(t[0]=n)}void 0===t[0]&&(t[0]=i),n&&void 0===r&&n.set(t[0])}!function(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),wt.delete(this)}cancel(){"scheduled"===this.state&&(wt.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}class Ft{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=t=>{const e=w.now();if(this.updatedAt!==e&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const t of this.dependents)t.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=w.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new h);const s=this.events[t].add(e);return"change"===t?()=>{s(),f.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,e,s){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=w.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return l(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Pt(t,e){return new Ft(t,e)}function Tt(t){const e=[{},{}];return t?.values.forEach((t,s)=>{e[0][s]=t.get(),e[1][s]=t.getVelocity()}),e}function Bt(t,e,s,n){if("function"==typeof e){const[r,i]=Tt(n);e=e(void 0!==s?s:t.custom,r,i)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[r,i]=Tt(n);e=e(void 0!==s?s:t.custom,r,i)}return e}const Rt=t=>Boolean(t&&t.getVelocity);function Et(t){return t.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const It="data-"+Et("framerAppearId"),Nt=t=>e=>e.test(t),Yt=[k,j,$,O,U,W,{test:t=>"auto"===t,parse:t=>t}],Lt=t=>Yt.find(Nt(t)),Xt=new Set(["brightness","contrast","saturate","opacity"]);function Ot(t){const[e,s]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[n]=s.match(B)||[];if(!n)return t;const r=s.replace(n,"");let i=Xt.has(e)?1:0;return n!==s&&(i*=100),e+"("+i+r+")"}const $t=/\b([a-z-]*)\(.*?\)/gu,jt={...et,getAnimatableNone:t=>{const e=t.match($t);return e?e.map(Ot).join(" "):t}},Wt={...k,transform:Math.round},Ut={borderWidth:j,borderTopWidth:j,borderRightWidth:j,borderBottomWidth:j,borderLeftWidth:j,borderRadius:j,radius:j,borderTopLeftRadius:j,borderTopRightRadius:j,borderBottomRightRadius:j,borderBottomLeftRadius:j,width:j,maxWidth:j,height:j,maxHeight:j,top:j,right:j,bottom:j,left:j,inset:j,insetBlock:j,insetBlockStart:j,insetBlockEnd:j,insetInline:j,insetInlineStart:j,insetInlineEnd:j,padding:j,paddingTop:j,paddingRight:j,paddingBottom:j,paddingLeft:j,paddingBlock:j,paddingBlockStart:j,paddingBlockEnd:j,paddingInline:j,paddingInlineStart:j,paddingInlineEnd:j,margin:j,marginTop:j,marginRight:j,marginBottom:j,marginLeft:j,marginBlock:j,marginBlockStart:j,marginBlockEnd:j,marginInline:j,marginInlineStart:j,marginInlineEnd:j,backgroundPositionX:j,backgroundPositionY:j,...{rotate:O,rotateX:O,rotateY:O,rotateZ:O,scale:P,scaleX:P,scaleY:P,scaleZ:P,skew:O,skewX:O,skewY:O,distance:j,translateX:j,translateY:j,translateZ:j,x:j,y:j,z:j,perspective:j,transformPerspective:j,opacity:F,originX:Z,originY:Z,originZ:j},zIndex:Wt,fillOpacity:F,strokeOpacity:F,numOctaves:Wt},Zt={...Ut,color:z,backgroundColor:z,outlineColor:z,fill:z,stroke:z,borderColor:z,borderTopColor:z,borderRightColor:z,borderBottomColor:z,borderLeftColor:z,filter:jt,WebkitFilter:jt},Kt=t=>Zt[t];function zt(t,e){let s=Kt(t);return s!==jt&&(s=et),s.getAnimatableNone?s.getAnimatableNone(e):void 0}const Dt=(t,e)=>e&&"number"==typeof t?e.transform(t):t,{schedule:qt,cancel:Ht}=p(queueMicrotask,!1),Gt=[...Yt,z,et],Jt=()=>({x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}),Qt=()=>({x:{min:0,max:0},y:{min:0,max:0}}),_t={current:null},te={current:!1},ee="undefined"!=typeof window;const se=new WeakMap;function ne(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function re(t){return"string"==typeof t||Array.isArray(t)}const ie=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ae=["initial",...ie];function oe(t){return ne(t.animate)||ae.some(e=>re(t[e]))}function he(t){return Boolean(oe(t)||t.variants)}const le=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let ce={};function ue(t){ce=t}function de(){return ce}class pe{scrapeMotionValuesFromProps(t,e,s){return{}}constructor({parent:t,props:e,presenceContext:s,reducedMotionConfig:n,blockInitialAnimation:r,visualState:i},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=kt,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=w.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,f.render(this.render,!1,!0))};const{latestValues:o,renderState:h}=i;this.latestValues=o,this.baseTarget={...o},this.initialValues=e.initial?{...o}:{},this.renderState=h,this.parent=t,this.props=e,this.presenceContext=s,this.depth=t?t.depth+1:0,this.reducedMotionConfig=n,this.options=a,this.blockInitialAnimation=Boolean(r),this.isControllingVariants=oe(e),this.isVariantNode=he(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:l,...c}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in c){const e=c[t];void 0!==o[t]&&Rt(e)&&e.set(o[t])}}mount(t){this.current=t,se.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(te.current||function(){if(te.current=!0,ee)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>_t.current=t.matches;t.addEventListener("change",e),e()}else _t.current=!1}(),this.shouldReduceMotion=_t.current),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),m(this.notifyUpdate),m(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const s=mt.has(t);s&&this.onBindTransform&&this.onBindTransform();const n=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&f.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let r;"undefined"!=typeof window&&window.MotionCheckAppearSync&&(r=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,()=>{n(),r&&r(),e.owner&&e.stop()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in ce){const e=ce[t];if(!e)continue;const{isEnabled:s,Feature:n}=e;if(!this.features[t]&&n&&s(this.props)&&(this.features[t]=new n(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<le.length;e++){const s=le[e];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const n=t["on"+s];n&&(this.propEventSubscriptions[s]=this.on(s,n))}this.prevMotionValues=function(t,e,s){for(const n in e){const r=e[n],i=s[n];if(Rt(r))t.addValue(n,r);else if(Rt(i))t.addValue(n,Pt(r,{owner:t}));else if(i!==r)if(t.hasValue(n)){const e=t.getValue(n);!0===e.liveStyle?e.jump(r):e.hasAnimated||e.set(r)}else{const e=t.getStaticValue(n);t.addValue(n,Pt(void 0!==e?e:r,{owner:t}))}}for(const n in s)void 0===e[n]&&t.removeValue(n);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const s=this.values.get(t);e!==s&&(s&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return void 0===s&&void 0!==e&&(s=Pt(null===e?void 0:e,{owner:this}),this.addValue(t,s)),s}readValue(t,e){let s=void 0===this.latestValues[t]&&this.current?this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var n;return null!=s&&("string"==typeof s&&(i(s)||a(s))?s=parseFloat(s):(n=s,!Gt.find(Nt(n))&&et.test(e)&&(s=zt(t,e))),this.setBaseTarget(t,Rt(s)?s.get():s)),Rt(s)?s.get():s}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){const{initial:e}=this.props;let s;if("string"==typeof e||"object"==typeof e){const n=Bt(this.props,e,this.presenceContext?.custom);n&&(s=n[t])}if(e&&void 0!==s)return s;const n=this.getBaseTargetFromProps(this.props,t);return void 0===n||Rt(n)?void 0!==this.initialValues[t]&&void 0===s?void 0:this.baseTarget[t]:n}on(t,e){return this.events[t]||(this.events[t]=new h),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}scheduleRenderMicrotask(){qt.render(this.render)}}const fe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},me=ft.length;function ge(t,e,s){const{style:n,vars:r,transformOrigin:i}=t;let a=!1,o=!1;for(const t in e){const s=e[t];if(mt.has(t))a=!0;else if(S(t))r[t]=s;else{const e=Dt(s,Ut[t]);t.startsWith("origin")?(o=!0,i[t]=e):n[t]=e}}if(e.transform||(a||s?n.transform=function(t,e,s){let n="",r=!0;for(let i=0;i<me;i++){const a=ft[i],o=t[a];if(void 0===o)continue;let h=!0;if(h="number"==typeof o?o===(a.startsWith("scale")?1:0):0===parseFloat(o),!h||s){const t=Dt(o,Ut[a]);h||(r=!1,n+=`${fe[a]||a}(${t}) `),s&&(e[a]=t)}}return n=n.trim(),s?n=s(e,r?"":n):r&&(n="none"),n}(e,t.transform,s):n.transform&&(n.transform="none")),o){const{originX:t="50%",originY:e="50%",originZ:s=0}=i;n.transformOrigin=`${t} ${e} ${s}`}}function ve(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ye={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!j.test(t))return t;t=parseFloat(t)}return`${ve(t,e.target.x)}% ${ve(t,e.target.y)}%`}},be={correct:(t,{treeScale:e,projectionDelta:s})=>{const n=t,r=et.parse(t);if(r.length>5)return n;const i=et.createTransformer(t),a="number"!=typeof r[0]?1:0,o=s.x.scale*e.x,h=s.y.scale*e.y;r[0+a]/=o,r[1+a]/=h;const l=st(o,h,.5);return"number"==typeof r[2+a]&&(r[2+a]/=l),"number"==typeof r[3+a]&&(r[3+a]/=l),i(r)}},we={borderRadius:{...ye,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ye,borderTopRightRadius:ye,borderBottomLeftRadius:ye,borderBottomRightRadius:ye,boxShadow:be};function Ve(t,{layout:e,layoutId:s}){return mt.has(t)||t.startsWith("origin")||(e||void 0!==s)&&(!!we[t]||"opacity"===t)}function Se(t,e,s){const n=t.style,r=e?.style,i={};if(!n)return i;for(const e in n)(Rt(n[e])||r&&Rt(r[e])||Ve(e,t)||void 0!==s?.getValue(e)?.liveStyle)&&(i[e]=n[e]);return i}const Me={offset:"stroke-dashoffset",array:"stroke-dasharray"},xe={offset:"strokeDashoffset",array:"strokeDasharray"};const Ce=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Ae(t,{attrX:e,attrY:s,attrScale:n,pathLength:r,pathSpacing:i=1,pathOffset:a=0,...o},h,l,c){if(ge(t,o,l),h)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:u,style:d}=t;u.transform&&(d.transform=u.transform,delete u.transform),(d.transform||u.transformOrigin)&&(d.transformOrigin=u.transformOrigin??"50% 50%",delete u.transformOrigin),d.transform&&(d.transformBox=c?.transformBox??"fill-box",delete u.transformBox);for(const t of Ce)void 0!==u[t]&&(d[t]=u[t],delete u[t]);void 0!==e&&(u.x=e),void 0!==s&&(u.y=s),void 0!==n&&(u.scale=n),void 0!==r&&function(t,e,s=1,n=0,r=!0){t.pathLength=1;const i=r?Me:xe;t[i.offset]=j.transform(-n);const a=j.transform(e),o=j.transform(s);t[i.array]=`${a} ${o}`}(u,r,i,a,!1)}const ke=t=>"string"==typeof t&&"svg"===t.toLowerCase();function Fe(t,e,s){const n=Se(t,e,s);for(const s in t)if(Rt(t[s])||Rt(e[s])){n[-1!==ft.indexOf(s)?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s]=t[s]}return n}function Pe(t){return Rt(t)?t.get():t}const Te=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Be(t){return"string"==typeof t&&!t.includes("-")&&!!(Te.indexOf(t)>-1||/[A-Z]/u.test(t))}const Re=t(null),Ee=t({});function Ie(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}export{Et as $,J as A,f as B,m as C,g as D,w as E,l as F,n as G,At as H,i as I,mt as J,kt as K,c as L,r as M,ft as N,Pt as O,Re as P,a as Q,zt as R,Ee as S,Lt as T,A as U,bt as V,gt as W,pe as X,ct as Y,dt as Z,S as _,re as a,Qt as a0,Kt as a1,ae as a2,ie as a3,$ as a4,j as a5,e as a6,s as a7,h as a8,v as a9,qt as aa,Jt as ab,we as ac,Rt as b,Ve as c,ge as d,Ae as e,ke as f,Be as g,he as h,oe as i,ne as j,Bt as k,Fe as l,de as m,ue as n,It as o,Ie as p,o as q,Pe as r,Se as s,st as t,Y as u,K as v,L as w,x,z as y,et as z};
|