yacd/assets/index-534e085e.js

10 lines
112 KiB
JavaScript
Raw Permalink Normal View History

2023-02-12 23:03:37 +08:00
import{r as p,R as rn}from"./index-3e6aad90.js";const K=p.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),ce=p.createContext({});function ei(){return p.useContext(ce).visualElement}const gt=p.createContext(null),ue=typeof document<"u",Q=ue?p.useLayoutEffect:p.useEffect,on=p.createContext({strict:!1});function jr(t,e,n,s){const i=ei(),o=p.useContext(on),r=p.useContext(gt),a=p.useContext(K).reducedMotion,c=p.useRef();s=s||o.renderer,!c.current&&s&&(c.current=s(t,{visualState:e,parent:i,props:n,presenceId:r?r.id:void 0,blockInitialAnimation:r?r.initial===!1:!1,reducedMotionConfig:a}));const u=c.current;return Q(()=>{u&&u.render()}),(window.HandoffAppearAnimations?Q:p.useEffect)(()=>{u&&u.animationState&&u.animationState.animateChanges()}),u}function ft(t){return typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function _r(t,e,n){return p.useCallback(s=>{s&&t.mount&&t.mount(s),e&&(s?e.mount(s):e.unmount()),n&&(typeof n=="function"?n(s):ft(n)&&(n.current=s))},[e])}function Et(t){return typeof t=="string"||Array.isArray(t)}function le(t){return typeof t=="object"&&typeof t.start=="function"}const Ur=["initial","animate","exit","whileHover","whileDrag","whileTap","whileFocus","whileInView"];function fe(t){return le(t.animate)||Ur.some(e=>Et(t[e]))}function ni(t){return Boolean(fe(t)||t.variants)}function zr(t,e){if(fe(t)){const{initial:n,animate:s}=t;return{initial:n===!1||Et(n)?n:void 0,animate:Et(s)?s:void 0}}return t.inherit!==!1?e:{}}function Nr(t){const{initial:e,animate:n}=zr(t,p.useContext(ce));return p.useMemo(()=>({initial:e,animate:n}),[Wn(e),Wn(n)])}function Wn(t){return Array.isArray(t)?t.join(" "):t}const G=t=>({isEnabled:e=>t.some(n=>!!e[n])}),Lt={measureLayout:G(["layout","layoutId","drag"]),animation:G(["animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView"]),exit:G(["exit"]),drag:G(["drag","dragControls"]),focus:G(["whileFocus"]),hover:G(["whileHover","onHoverStart","onHoverEnd"]),tap:G(["whileTap","onTap","onTapStart","onTapCancel"]),pan:G(["onPan","onPanStart","onPanSessionStart","onPanEnd"]),inView:G(["whileInView","onViewportEnter","onViewportLeave"])};function Be(t){for(const e in t)e==="projectionNodeConstructor"?Lt.projectionNodeConstructor=t[e]:Lt[e].Component=t[e]}function D(t){const e=p.useRef(null);return e.current===null&&(e.current=t()),e.current}const Pt={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let Wr=1;function $r(){return D(()=>{if(Pt.hasEverUpdated)return Wr++})}const Dt=p.createContext({});class Gr extends rn.Component{getSnapshotBeforeUpdate(){const{visualElement:e,props:n}=this.props;return e&&e.setProps(n),null}componentDidUpdate(){}render(){return this.props.children}}const si=p.createContext({}),an=Symbol.for("motionComponentSymbol");function ii({preloadedFeatures:t,createVisualElement:e,projectionNodeConstructor:n,useRender:s,useVisualState:i,Component:o}){t&&Be(t);function r(c,u){const l={...p.useContext(K),...c,layoutId:Hr(c)},{isStatic:d}=l;let f=null;const h=Nr(c),m=d?void 0:$r(),g=i(c,d);if(!d&&ue){h.visualElement=jr(o,g,l,e);const b=p.useContext(si);h.visualElement&&(f=h.visualElement.loadFeatures(l,p.useContext(on).strict,t,m,n||Lt.projectionNodeConstructor,b))}return p.createElement(Gr,{visualElement:h.visualElement,props:l},f,p.createElement(ce.Provider,{value:h},s(o,c,m,_r(g,h.visualElement,u),g,d,h.visualElement)))}const a=p.forwardRef(r);return a[an]=o,a}function Hr({layoutId:t}){const e=p.useContext(Dt).id;return e&&t!==void 0?e+"-"+t:t}function ri(t){function e(s,i={}){return ii(t(s,i))}if(typeof Proxy>"u")return e;const n=new Map;return new Proxy(e,{get:(s,i)=>(n.has(i)||n.set(i,e(i)),n.get(i))})}const Kr=["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 cn(t){return typeof t!="string"||t.includes("-")?!1:!!(Kr.indexOf(t)>-1||/[A-Z]/.test(t))}const Yt={};function Xr(t){Object.assign(Yt,t)}const qt=["transformPerspective","x"
[data-motion-pop-id="${n}"] {
position: absolute !important;
width: ${o}px !important;
height: ${r}px !important;
top: ${a}px !important;
left: ${c}px !important;
}
`),()=>{document.head.removeChild(u)}},[e]),p.createElement(Vu,{isPresent:e,childRef:s,sizeRef:i},p.cloneElement(t,{ref:s}))}const De=({children:t,initial:e,isPresent:n,onExitComplete:s,custom:i,presenceAffectsLayout:o,mode:r})=>{const a=D(Cu),c=p.useId(),u=p.useMemo(()=>({id:c,initial:e,isPresent:n,custom:i,onExitComplete:l=>{a.set(l,!0);for(const d of a.values())if(!d)return;s&&s()},register:l=>(a.set(l,!1),()=>a.delete(l))}),o?void 0:[n]);return p.useMemo(()=>{a.forEach((l,d)=>a.set(d,!1))},[n]),p.useEffect(()=>{!n&&!a.size&&s&&s()},[n]),r==="popLayout"&&(t=p.createElement(Pu,{isPresent:n},t)),p.createElement(gt.Provider,{value:u},t)};function Cu(){return new Map}const lt=t=>t.key||"";function Su(t,e){t.forEach(n=>{const s=lt(n);e.set(s,n)})}function Au(t){const e=[];return p.Children.forEach(t,n=>{p.isValidElement(n)&&e.push(n)}),e}const zl=({children:t,custom:e,initial:n=!0,onExitComplete:s,exitBeforeEnter:i,presenceAffectsLayout:o=!0,mode:r="sync"})=>{i&&(r="wait");let[a]=jn();const c=p.useContext(Dt).forceRender;c&&(a=c);const u=Sr(),l=Au(t);let d=l;const f=new Set,h=p.useRef(d),m=p.useRef(new Map).current,g=p.useRef(!0);if(Q(()=>{g.current=!1,Su(l,m),h.current=d}),vn(()=>{g.current=!0,m.clear(),f.clear()}),g.current)return p.createElement(p.Fragment,null,d.map(v=>p.createElement(De,{key:lt(v),isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:o,mode:r},v)));d=[...d];const b=h.current.map(lt),T=l.map(lt),x=b.length;for(let v=0;v<x;v++){const y=b[v];T.indexOf(y)===-1&&f.add(y)}return r==="wait"&&f.size&&(d=[]),f.forEach(v=>{if(T.indexOf(v)!==-1)return;const y=m.get(v);if(!y)return;const P=b.indexOf(v),C=()=>{m.delete(v),f.delete(v);const w=h.current.findIndex(F=>F.key===v);if(h.current.splice(w,1),!f.size){if(h.current=l,u.current===!1)return;a(),s&&s()}};d.splice(P,0,p.createElement(De,{key:lt(y),isPresent:!1,onExitComplete:C,custom:e,presenceAffectsLayout:o,mode:r},y))}),d=d.map(v=>{const y=v.key;return f.has(y)?v:p.createElement(De,{key:lt(v),isPresent:!0,presenceAffectsLayout:o,mode:r},v)}),p.createElement(p.Fragment,null,f.size?d:d.map(v=>p.cloneElement(v)))},wu=p.createContext(null),Mu=t=>!t.isLayoutDirty&&t.willUpdate(!1);function Gs(){const t=new Set,e=new WeakMap,n=()=>t.forEach(Mu);return{add:s=>{t.add(s),e.set(s,s.addEventListener("willUpdate",n))},remove:s=>{var i;t.delete(s),(i=e.get(s))===null||i===void 0||i(),e.delete(s),n()},dirty:n}}const Ar=t=>t===!0,Ru=t=>Ar(t===!0)||t==="id",Eu=({children:t,id:e,inheritId:n,inherit:s=!0})=>{n!==void 0&&(s=n);const i=p.useContext(Dt),o=p.useContext(wu),[r,a]=jn(),c=p.useRef(null),u=i.id||o;c.current===null&&(Ru(s)&&u&&(e=e?u+"-"+e:u),c.current={id:e,group:Ar(s)&&i.group||Gs()});const l=p.useMemo(()=>({...c.current,forceRender:r}),[a]);return p.createElement(Dt.Provider,{value:l},t)};let Lu=0;const Nl=({children:t})=>(p.useEffect(()=>{},[]),p.createElement(Eu,{id:D(()=>`asl-${Lu++}`)},t));function Wl({children:t,isValidProp:e,...n}){e&&li(e),n={...p.useContext(K),...n},n.isStatic=D(()=>n.isStatic);const s=p.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return p.createElement(K.Provider,{value:s},t)}function $l({children:t,features:e,strict:n=!1}){const[,s]=p.useState(!Ie(e)),i=p.useRef(void 0);if(!Ie(e)){const{renderer:o,...r}=e;i.current=o,Be(r)}return p.useEffect(()=>{Ie(e)&&e().then(({renderer:o,...r})=>{Be(r),i.current=o,s(!0)})},[]),p.createElement(on.Provider,{value:{renderer:i.current,strict:n}},t)}function Ie(t){return typeof t=="function"}const wr=p.createContext(null);function Du(t,e,n,s){if(!s)return t;const i=t.findIndex(l=>l.value===e);if(i===-1)return t;const o=s>0?1:-1,r=t[i+o];if(!r)return t;const a=t[i],c=r.layout,u=A(c.min,c.max,.5);return o===1&&a.layout.max+n>u||o===-1&&a.layout.min+n<u?Uo(t,i,i+o):t}function Iu({children:t,as:e="ul",axis:n="y",onReorder:s,values:i,...o},r){const a=D(()=>Cr(e)),c=[],u=p.useRef(!1),l={axis:n,registerItem:(d,f)=>{f&&c.findIndex(h=>d===h.value)===-1&&(c.push({value:d,layout:f[n]}),c.sort(Fu))},updateOrder:(d,f,h)=>{if(u.current)return;const m=Du(c,d,f,h);c!==m&&(u.