@reggev/react-hierarchy
Version:
> A native React hierarchy chart > this project uses d3 for layout, react-spring for animations & react-svg-pan-zoom to manage the svg container.
19 lines • 233 kB
JavaScript
var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,a=(t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r,l=(e,t)=>{for(var n in t||(t={}))o.call(t,n)&&a(e,n,t[n]);if(r)for(var n of r(t))i.call(t,n)&&a(e,n,t[n]);return e},u=(e,r)=>t(e,n(r));"undefined"!=typeof require&&require;import*as s from"react";import c,{useEffect as f,useState as d,useRef as p,forwardRef as h,useCallback as m,useContext as g,useMemo as y,useImperativeHandle as v}from"react";function b(e){var t=0,n=e.children,r=n&&n.length;if(r)for(;--r>=0;)t+=n[r].value;else t=1;e.value=t}function w(e,t){e instanceof Map?(e=[void 0,e],void 0===t&&(t=S)):void 0===t&&(t=k);for(var n,r,o,i,a,l=new _(e),u=[l];n=u.pop();)if((o=t(n.data))&&(a=(o=Array.from(o)).length))for(n.children=o,i=a-1;i>=0;--i)u.push(r=o[i]=new _(o[i])),r.parent=n,r.depth=n.depth+1;return l.eachBefore(E)}function k(e){return e.children}function S(e){return Array.isArray(e)?e[1]:null}function x(e){void 0!==e.data.value&&(e.value=e.data.value),e.data=e.data.data}function E(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function _(e){this.data=e,this.depth=this.height=0,this.parent=null}function O(e){if("function"!=typeof e)throw new Error;return e}_.prototype=w.prototype={constructor:_,count:function(){return this.eachAfter(b)},each:function(e,t){let n=-1;for(const r of this)e.call(t,r,++n,this);return this},eachAfter:function(e,t){for(var n,r,o,i=this,a=[i],l=[],u=-1;i=a.pop();)if(l.push(i),n=i.children)for(r=0,o=n.length;r<o;++r)a.push(n[r]);for(;i=l.pop();)e.call(t,i,++u,this);return this},eachBefore:function(e,t){for(var n,r,o=this,i=[o],a=-1;o=i.pop();)if(e.call(t,o,++a,this),n=o.children)for(r=n.length-1;r>=0;--r)i.push(n[r]);return this},find:function(e,t){let n=-1;for(const r of this)if(e.call(t,r,++n,this))return r},sum:function(e){return this.eachAfter((function(t){for(var n=+e(t.data)||0,r=t.children,o=r&&r.length;--o>=0;)n+=r[o].value;t.value=n}))},sort:function(e){return this.eachBefore((function(t){t.children&&t.children.sort(e)}))},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),o=null;e=n.pop(),t=r.pop();for(;e===t;)o=e,e=n.pop(),t=r.pop();return o}(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var o=r.length;e!==n;)r.splice(o,0,e),e=e.parent;return r},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){return Array.from(this)},leaves:function(){var e=[];return this.eachBefore((function(t){t.children||e.push(t)})),e},links:function(){var e=this,t=[];return e.each((function(n){n!==e&&t.push({source:n.parent,target:n})})),t},copy:function(){return w(this).eachBefore(x)},[Symbol.iterator]:function*(){var e,t,n,r,o=this,i=[o];do{for(e=i.reverse(),i=[];o=e.pop();)if(yield o,t=o.children)for(n=0,r=t.length;n<r;++n)i.push(t[n])}while(i.length)}};var P={depth:-1},C={};function V(e){return e.id}function M(e){return e.parentId}function T(e,t){return e.parent===t.parent?1:2}function R(e){var t=e.children;return t?t[0]:e.t}function j(e){var t=e.children;return t?t[t.length-1]:e.t}function z(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function L(e,t,n){return e.a.parent===t.parent?e.a:n}function N(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}function D(){var e=T,t=1,n=1,r=null;function o(o){var u=function(e){for(var t,n,r,o,i,a=new N(e,0),l=[a];t=l.pop();)if(r=t._.children)for(t.children=new Array(i=r.length),o=i-1;o>=0;--o)l.push(n=t.children[o]=new N(r[o],o)),n.parent=t;return(a.parent=new N(null,0)).children=[a],a}(o);if(u.eachAfter(i),u.parent.m=-u.z,u.eachBefore(a),r)o.eachBefore(l);else{var s=o,c=o,f=o;o.eachBefore((function(e){e.x<s.x&&(s=e),e.x>c.x&&(c=e),e.depth>f.depth&&(f=e)}));var d=s===c?1:e(s,c)/2,p=d-s.x,h=t/(c.x+d+p),m=n/(f.depth||1);o.eachBefore((function(e){e.x=(e.x+p)*h,e.y=e.depth*m}))}return o}function i(t){var n=t.children,r=t.parent.children,o=t.i?r[t.i-1]:null;if(n){!function(e){for(var t,n=0,r=0,o=e.children,i=o.length;--i>=0;)(t=o[i]).z+=n,t.m+=n,n+=t.s+(r+=t.c)}(t);var i=(n[0].z+n[n.length-1].z)/2;o?(t.z=o.z+e(t._,o._),t.m=t.z-i):t.z=i}else o&&(t.z=o.z+e(t._,o._));t.parent.A=function(t,n,r){if(n){for(var o,i=t,a=t,l=n,u=i.parent.children[0],s=i.m,c=a.m,f=l.m,d=u.m;l=j(l),i=R(i),l&&i;)u=R(u),(a=j(a)).a=t,(o=l.z+f-i.z-s+e(l._,i._))>0&&(z(L(l,t,r),t,o),s+=o,c+=o),f+=l.m,s+=i.m,d+=u.m,c+=a.m;l&&!j(a)&&(a.t=l,a.m+=f-c),i&&!R(u)&&(u.t=i,u.m+=s-d,r=t)}return r}(t,o,t.parent.A||r[0])}function a(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function l(e){e.x*=t,e.y=e.depth*n}return o.separation=function(t){return arguments.length?(e=t,o):e},o.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],o):r?null:[t,n]},o.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],o):r?[t,n]:null},o}N.prototype=Object.create(_.prototype);let F=J();const A=e=>G(e,F);let I=J();A.write=e=>G(e,I);let U=J();A.onStart=e=>G(e,U);let q=J();A.onFrame=e=>G(e,q);let W=J();A.onFinish=e=>G(e,W);let $=[];A.setTimeout=(e,t)=>{let n=A.now()+t,r=()=>{let e=$.findIndex((e=>e.cancel==r));~e&&$.splice(e,1),te.count-=~e?1:0},o={time:n,handler:e,cancel:r};return $.splice(H(n),0,o),te.count+=1,Q(),o};let H=e=>~(~$.findIndex((t=>t.time>e))||~$.length);A.cancel=e=>{F.delete(e),I.delete(e)},A.sync=e=>{X=!0,A.batchedUpdates(e),X=!1},A.throttle=e=>{let t;function n(){try{e(...t)}finally{t=null}}function r(...e){t=e,A.onStart(n)}return r.handler=e,r.cancel=()=>{U.delete(n),t=null},r};let B="undefined"!=typeof window?window.requestAnimationFrame:()=>{};A.use=e=>B=e,A.now="undefined"!=typeof performance?()=>performance.now():Date.now,A.batchedUpdates=e=>e(),A.catch=console.error,A.frameLoop="always",A.advance=()=>{"demand"!==A.frameLoop?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):Z()};let Y=-1,X=!1;function G(e,t){X?(t.delete(e),e(0)):(t.add(e),Q())}function Q(){Y<0&&(Y=0,"demand"!==A.frameLoop&&B(K))}function K(){~Y&&(B(K),A.batchedUpdates(Z))}function Z(){let e=Y;Y=A.now();let t=H(Y);t&&(ee($.splice(0,t),(e=>e.handler())),te.count-=t),U.flush(),F.flush(e?Math.min(64,Y-e):16.667),q.flush(),I.flush(),W.flush()}function J(){let e=new Set,t=e;return{add(n){te.count+=t!=e||e.has(n)?0:1,e.add(n)},delete:n=>(te.count-=t==e&&e.has(n)?1:0,e.delete(n)),flush(n){t.size&&(e=new Set,te.count-=t.size,ee(t,(t=>t(n)&&e.add(t))),te.count+=e.size,t=e)}}}function ee(e,t){e.forEach((e=>{try{t(e)}catch(n){A.catch(n)}}))}const te={count:0,clear(){Y=-1,$=[],U=J(),F=J(),q=J(),I=J(),W=J(),te.count=0}};function ne(){}const re={arr:Array.isArray,obj:e=>!!e&&"Object"===e.constructor.name,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,und:e=>void 0===e};function oe(e,t){if(re.arr(e)){if(!re.arr(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return e===t}const ie=(e,t)=>e.forEach(t);function ae(e,t,n){for(const r in e)e.hasOwnProperty(r)&&t.call(n,e[r],r)}const le=e=>re.und(e)?[]:re.arr(e)?e:[e];function ue(e,t){if(e.size){const n=Array.from(e);e.clear(),ie(n,t)}}const se=(e,...t)=>ue(e,(e=>e(...t)));let ce,fe,de=null,pe=!1,he=ne;var me=Object.freeze({__proto__:null,get createStringInterpolator(){return ce},get to(){return fe},get colors(){return de},get skipAnimation(){return pe},get willAdvance(){return he},assign:e=>{e.to&&(fe=e.to),e.now&&(A.now=e.now),void 0!==e.colors&&(de=e.colors),null!=e.skipAnimation&&(pe=e.skipAnimation),e.createStringInterpolator&&(ce=e.createStringInterpolator),e.requestAnimationFrame&&A.use(e.requestAnimationFrame),e.batchedUpdates&&(A.batchedUpdates=e.batchedUpdates),e.willAdvance&&(he=e.willAdvance),e.frameLoop&&(A.frameLoop=e.frameLoop)}});const ge=new Set;let ye=[],ve=[],be=0;const we={get idle(){return!ge.size&&!ye.length},start(e){be>e.priority?(ge.add(e),A.onStart(ke)):(Se(e),A(Ee))},advance:Ee,sort(e){if(be)A.onFrame((()=>we.sort(e)));else{const t=ye.indexOf(e);~t&&(ye.splice(t,1),xe(e))}},clear(){ye=[],ge.clear()}};function ke(){ge.forEach(Se),ge.clear(),A(Ee)}function Se(e){ye.includes(e)||xe(e)}function xe(e){ye.splice(function(e,t){const n=e.findIndex(t);return n<0?e.length:n}(ye,(t=>t.priority>e.priority)),0,e)}function Ee(e){const t=ve;for(let n=0;n<ye.length;n++){const r=ye[n];be=r.priority,r.idle||(he(r),r.advance(e),r.idle||t.push(r))}return be=0,ve=ye,ve.length=0,ye=t,ye.length>0}const _e="[-+]?\\d*\\.?\\d+";function Oe(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}const Pe=new RegExp("rgb"+Oe(_e,_e,_e)),Ce=new RegExp("rgba"+Oe(_e,_e,_e,_e)),Ve=new RegExp("hsl"+Oe(_e,"[-+]?\\d*\\.?\\d+%","[-+]?\\d*\\.?\\d+%")),Me=new RegExp("hsla"+Oe(_e,"[-+]?\\d*\\.?\\d+%","[-+]?\\d*\\.?\\d+%",_e)),Te=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,Re=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,je=/^#([0-9a-fA-F]{6})$/,ze=/^#([0-9a-fA-F]{8})$/;function Le(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Ne(e,t,n){const r=n<.5?n*(1+t):n+t-n*t,o=2*n-r,i=Le(o,r,e+1/3),a=Le(o,r,e),l=Le(o,r,e-1/3);return Math.round(255*i)<<24|Math.round(255*a)<<16|Math.round(255*l)<<8}function De(e){const t=parseInt(e,10);return t<0?0:t>255?255:t}function Fe(e){return(parseFloat(e)%360+360)%360/360}function Ae(e){const t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function Ie(e){const t=parseFloat(e);return t<0?0:t>100?1:t/100}function Ue(e){let t=function(e){let t;return"number"==typeof e?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=je.exec(e))?parseInt(t[1]+"ff",16)>>>0:de&&void 0!==de[e]?de[e]:(t=Pe.exec(e))?(De(t[1])<<24|De(t[2])<<16|De(t[3])<<8|255)>>>0:(t=Ce.exec(e))?(De(t[1])<<24|De(t[2])<<16|De(t[3])<<8|Ae(t[4]))>>>0:(t=Te.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=ze.exec(e))?parseInt(t[1],16)>>>0:(t=Re.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=Ve.exec(e))?(255|Ne(Fe(t[1]),Ie(t[2]),Ie(t[3])))>>>0:(t=Me.exec(e))?(Ne(Fe(t[1]),Ie(t[2]),Ie(t[3]))|Ae(t[4]))>>>0:null}(e);return null===t?e:(t=t||0,`rgba(${(4278190080&t)>>>24}, ${(16711680&t)>>>16}, ${(65280&t)>>>8}, ${(255&t)/255})`)}const qe=(e,t,n)=>{if(re.fun(e))return e;if(re.arr(e))return qe({range:e,output:t,extrapolate:n});if(re.str(e.output[0]))return ce(e);const r=e,o=r.output,i=r.range||[0,1],a=r.extrapolateLeft||r.extrapolate||"extend",l=r.extrapolateRight||r.extrapolate||"extend",u=r.easing||(e=>e);return e=>{const t=function(e,t){for(var n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}(e,i);return function(e,t,n,r,o,i,a,l,u){let s=u?u(e):e;if(s<t){if("identity"===a)return s;"clamp"===a&&(s=t)}if(s>n){if("identity"===l)return s;"clamp"===l&&(s=n)}if(r===o)return r;if(t===n)return e<=t?r:o;t===-1/0?s=-s:n===1/0?s-=t:s=(s-t)/(n-t);s=i(s),r===-1/0?s=-s:o===1/0?s+=r:s=s*(o-r)+r;return s}(e,i[t],i[t+1],o[t],o[t+1],u,a,l,r.map)}};function We(){return(We=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const $e=Symbol.for("FluidValue.get"),He=Symbol.for("FluidValue.observers"),Be=e=>Boolean(e&&e[$e]),Ye=e=>e&&e[$e]?e[$e]():e,Xe=e=>e[He]||null;function Ge(e,t){let n=e[He];n&&n.forEach((e=>{!function(e,t){e.eventObserved?e.eventObserved(t):e(t)}(e,t)}))}class Qe{constructor(e){if(this[$e]=void 0,this[He]=void 0,!e&&!(e=this.get))throw Error("Unknown getter");Ke(this,e)}}const Ke=(e,t)=>et(e,$e,t);function Ze(e,t){if(e[$e]){let n=e[He];n||et(e,He,n=new Set),n.has(t)||(n.add(t),e.observerAdded&&e.observerAdded(n.size,t))}return t}function Je(e,t){let n=e[He];if(n&&n.has(t)){const r=n.size-1;r?n.delete(t):e[He]=null,e.observerRemoved&&e.observerRemoved(r,t)}}const et=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}),tt=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,nt=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi;let rt;const ot=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,it=(e,t,n,r,o)=>`rgba(${Math.round(t)}, ${Math.round(n)}, ${Math.round(r)}, ${o})`,at=e=>{rt||(rt=de?new RegExp(`(${Object.keys(de).join("|")})(?!\\w)`,"g"):/^\b$/);const t=e.output.map((e=>Ye(e).replace(nt,Ue).replace(rt,Ue))),n=t.map((e=>e.match(tt).map(Number))),r=n[0].map(((e,t)=>n.map((e=>{if(!(t in e))throw Error('The arity of each "output" value must be equal');return e[t]})))).map((t=>qe(We({},e,{output:t}))));return e=>{let n=0;return t[0].replace(tt,(()=>String(r[n++](e)))).replace(ot,it)}},lt="react-spring: ",ut=e=>{const t=e;let n=!1;if("function"!=typeof t)throw new TypeError(`${lt}once requires a function parameter`);return(...e)=>{n||(t(...e),n=!0)}},st=ut(console.warn);const ct=ut(console.warn);function ft(e){return re.str(e)&&("#"==e[0]||/\d/.test(e)||e in(de||{}))}const dt=e=>f(e,pt),pt=[];function ht(){const e=d()[1],t=d(mt)[0];return dt(t.unmount),()=>{t.current&&e({})}}function mt(){const e={current:!0,unmount:()=>()=>{e.current=!1}};return e}function gt(e){const t=p();return f((()=>{t.current=e})),t.current}const yt="undefined"!=typeof window&&window.document&&window.document.createElement?s.useLayoutEffect:s.useEffect,vt=Symbol.for("Animated:node"),bt=e=>e&&e[vt],wt=(e,t)=>{return n=e,r=vt,o=t,Object.defineProperty(n,r,{value:o,writable:!0,configurable:!0});var n,r,o},kt=e=>e&&e[vt]&&e[vt].getPayload();class St{constructor(){this.payload=void 0,wt(this,this)}getPayload(){return this.payload||[]}}class xt extends St{constructor(e){super(),this.done=!0,this.elapsedTime=void 0,this.lastPosition=void 0,this.lastVelocity=void 0,this.v0=void 0,this.durationProgress=0,this._value=e,re.num(this._value)&&(this.lastPosition=this._value)}static create(e){return new xt(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return re.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value!==e&&(this._value=e,!0)}reset(){const{done:e}=this;this.done=!1,re.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}}class Et extends xt{constructor(e){super(0),this._string=null,this._toString=void 0,this._toString=qe({output:[e,e]})}static create(e){return new Et(e)}getValue(){let e=this._string;return null==e?this._string=this._toString(this._value):e}setValue(e){if(re.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else{if(!super.setValue(e))return!1;this._string=null}return!0}reset(e){e&&(this._toString=qe({output:[this.getValue(),e]})),this._value=0,super.reset()}}const _t={dependencies:null};class Ot extends St{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){const t={};return ae(this.source,((n,r)=>{var o;(o=n)&&o[vt]===o?t[r]=n.getValue(e):Be(n)?t[r]=Ye(n):e||(t[r]=n)})),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&ie(this.payload,(e=>e.reset()))}_makePayload(e){if(e){const t=new Set;return ae(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){_t.dependencies&&Be(e)&&_t.dependencies.add(e);const t=kt(e);t&&ie(t,(e=>this.add(e)))}}class Pt extends Ot{constructor(e){super(e)}static create(e){return new Pt(e)}getValue(){return this.source.map((e=>e.getValue()))}setValue(e){const t=this.getPayload();return e.length==t.length?t.map(((t,n)=>t.setValue(e[n]))).some(Boolean):(super.setValue(e.map(Ct)),!0)}}function Ct(e){return(ft(e)?Et:xt).create(e)}function Vt(e){const t=bt(e);return t?t.constructor:re.arr(e)?Pt:ft(e)?Et:xt}function Mt(){return(Mt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const Tt=(e,t)=>{const n=!re.fun(e)||e.prototype&&e.prototype.isReactComponent;return h(((r,o)=>{const i=p(null),a=n&&m((e=>{i.current=function(e,t){e&&(re.fun(e)?e(t):e.current=t);return t}(o,e)}),[o]),[l,u]=function(e,t){const n=new Set;_t.dependencies=n,e.style&&(e=Mt({},e,{style:t.createAnimatedStyle(e.style)}));return e=new Ot(e),_t.dependencies=null,[e,n]}(r,t),c=ht(),d=()=>{const e=i.current;if(n&&!e)return;!1===(!!e&&t.applyAnimatedValues(e,l.getValue(!0)))&&c()},h=new Rt(d,u),g=p();yt((()=>{const e=g.current;g.current=h,ie(u,(e=>Ze(e,h))),e&&(ie(e.deps,(t=>Je(t,e))),A.cancel(e.update))})),f(d,[]),dt((()=>()=>{const e=g.current;ie(e.deps,(t=>Je(t,e)))}));const y=t.getComponentProps(l.getValue());return s.createElement(e,Mt({},y,{ref:a}))}))};class Rt{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){"change"==e.type&&A.write(this.update)}}const jt=Symbol.for("AnimatedComponent"),zt=e=>re.str(e)?e:e&&re.str(e.displayName)?e.displayName:re.fun(e)&&e.name||null;function Lt(){return(Lt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Nt(e,...t){return re.fun(e)?e(...t):e}const Dt=(e,t)=>!0===e||!!(t&&e&&(re.fun(e)?e(t):le(e).includes(t))),Ft=(e,t)=>re.obj(e)?t&&e[t]:e,At=(e,t)=>!0===e.default?e[t]:e.default?e.default[t]:void 0,It=e=>e,Ut=(e,t=It)=>{let n=qt;e.default&&!0!==e.default&&(e=e.default,n=Object.keys(e));const r={};for(const o of n){const n=t(e[o],o);re.und(n)||(r[o]=n)}return r},qt=["config","onProps","onStart","onChange","onPause","onResume","onRest"],Wt={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function $t(e){const t=function(e){const t={};let n=0;if(ae(e,((e,r)=>{Wt[r]||(t[r]=e,n++)})),n)return t}(e);if(t){const n={to:t};return ae(e,((e,r)=>r in t||(n[r]=e))),n}return Lt({},e)}function Ht(e){return e=Ye(e),re.arr(e)?e.map(Ht):ft(e)?me.createStringInterpolator({range:[0,1],output:[e,e]})(1):e}function Bt(e){for(const t in e)return!0;return!1}function Yt(e){return re.fun(e)||re.arr(e)&&re.obj(e[0])}function Xt(e,t){var n;null==(n=e.ref)||n.delete(e),null==t||t.delete(e)}function Gt(e,t){var n;t&&e.ref!==t&&(null==(n=e.ref)||n.delete(e),t.add(e),e.ref=t)}const Qt={tension:120,friction:14},Kt=Lt({},{tension:170,friction:26},{mass:1,damping:1,easing:e=>e,clamp:!1});class Zt{constructor(){this.tension=void 0,this.friction=void 0,this.frequency=void 0,this.damping=void 0,this.mass=void 0,this.velocity=0,this.restVelocity=void 0,this.precision=void 0,this.progress=void 0,this.duration=void 0,this.easing=void 0,this.clamp=void 0,this.bounce=void 0,this.decay=void 0,this.round=void 0,Object.assign(this,Kt)}}function Jt(e,t){if(re.und(t.decay)){const n=!re.und(t.tension)||!re.und(t.friction);!n&&re.und(t.frequency)&&re.und(t.damping)&&re.und(t.mass)||(e.duration=void 0,e.decay=void 0),n&&(e.frequency=void 0)}else e.duration=void 0}const en=[];class tn{constructor(){this.changed=!1,this.values=en,this.toValues=null,this.fromValues=en,this.to=void 0,this.from=void 0,this.config=new Zt,this.immediate=!1}}function nn(e,{key:t,props:n,defaultProps:r,state:o,actions:i}){return new Promise(((a,l)=>{var u;let s,c,f=Dt(null!=(u=n.cancel)?u:null==r?void 0:r.cancel,t);if(f)h();else{re.und(n.pause)||(o.paused=Dt(n.pause,t));let e=null==r?void 0:r.pause;!0!==e&&(e=o.paused||Dt(e,t)),s=Nt(n.delay||0,t),e?(o.resumeQueue.add(p),i.pause()):(i.resume(),p())}function d(){o.resumeQueue.add(p),o.timeouts.delete(c),c.cancel(),s=c.time-A.now()}function p(){s>0?(c=A.setTimeout(h,s),o.pauseQueue.add(d),o.timeouts.add(c)):h()}function h(){o.pauseQueue.delete(d),o.timeouts.delete(c),e<=(o.cancelId||0)&&(f=!0);try{i.start(Lt({},n,{callId:e,cancel:f}),a)}catch(t){l(t)}}}))}const rn=(e,t)=>1==t.length?t[0]:t.some((e=>e.cancelled))?ln(e.get()):t.every((e=>e.noop))?on(e.get()):an(e.get(),t.every((e=>e.finished))),on=e=>({value:e,noop:!0,finished:!0,cancelled:!1}),an=(e,t,n=!1)=>({value:e,finished:t,cancelled:n}),ln=e=>({value:e,cancelled:!0,finished:!1});function un(e,t,n,r){const{callId:o,parentId:i,onRest:a}=t,{asyncTo:l,promise:u}=n;return i||e!==l||t.reset?n.promise=(async()=>{n.asyncId=o,n.asyncTo=e;const s=Ut(t,((e,t)=>"onRest"===t?void 0:e));let c,f;const d=new Promise(((e,t)=>(c=e,f=t))),p=e=>{const t=o<=(n.cancelId||0)&&ln(r)||o!==n.asyncId&&an(r,!1);if(t)throw e.result=t,f(e),e},h=(e,t)=>{const i=new cn,a=new fn;return(async()=>{if(me.skipAnimation)throw sn(n),a.result=an(r,!1),f(a),a;p(i);const l=re.obj(e)?Lt({},e):Lt({},t,{to:e});l.parentId=o,ae(s,((e,t)=>{re.und(l[t])&&(l[t]=e)}));const u=await r.start(l);return p(i),n.paused&&await new Promise((e=>{n.resumeQueue.add(e)})),u})()};let m;if(me.skipAnimation)return sn(n),an(r,!1);try{let t;t=re.arr(e)?(async e=>{for(const t of e)await h(t)})(e):Promise.resolve(e(h,r.stop.bind(r))),await Promise.all([t.then(c),d]),m=an(r.get(),!0,!1)}catch(g){if(g instanceof cn)m=g.result;else{if(!(g instanceof fn))throw g;m=g.result}}finally{o==n.asyncId&&(n.asyncId=i,n.asyncTo=i?l:void 0,n.promise=i?u:void 0)}return re.fun(a)&&A.batchedUpdates((()=>{a(m,r,r.item)})),m})():u}function sn(e,t){ue(e.timeouts,(e=>e.cancel())),e.pauseQueue.clear(),e.resumeQueue.clear(),e.asyncId=e.asyncTo=e.promise=void 0,t&&(e.cancelId=t)}class cn extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise."),this.result=void 0}}class fn extends Error{constructor(){super("SkipAnimationSignal"),this.result=void 0}}const dn=e=>e instanceof hn;let pn=1;class hn extends Qe{constructor(...e){super(...e),this.id=pn++,this.key=void 0,this._priority=0}get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){const e=bt(this);return e&&e.getValue()}to(...e){return me.to(this,e)}interpolate(...e){return st(`${lt}The "interpolate" function is deprecated in v9 (use "to" instead)`),me.to(this,e)}toJSON(){return this.get()}observerAdded(e){1==e&&this._attach()}observerRemoved(e){0==e&&this._detach()}_attach(){}_detach(){}_onChange(e,t=!1){Ge(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||we.sort(this),Ge(this,{type:"priority",parent:this,priority:e})}}const mn=Symbol.for("SpringPhase"),gn=e=>(1&e[mn])>0,yn=e=>(2&e[mn])>0,vn=e=>(4&e[mn])>0,bn=(e,t)=>t?e[mn]|=3:e[mn]&=-3,wn=(e,t)=>t?e[mn]|=4:e[mn]&=-5;class kn extends hn{constructor(e,t){if(super(),this.key=void 0,this.animation=new tn,this.queue=void 0,this.defaultProps={},this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!re.und(e)||!re.und(t)){const n=re.obj(e)?Lt({},e):Lt({},t,{from:e});re.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(yn(this)||this._state.asyncTo)||vn(this)}get goal(){return Ye(this.animation.to)}get velocity(){const e=bt(this);return e instanceof xt?e.lastVelocity||0:e.getPayload().map((e=>e.lastVelocity||0))}get hasAnimated(){return gn(this)}get isAnimating(){return yn(this)}get isPaused(){return vn(this)}advance(e){let t=!0,n=!1;const r=this.animation;let{config:o,toValues:i}=r;const a=kt(r.to);!a&&Be(r.to)&&(i=le(Ye(r.to))),r.values.forEach(((l,u)=>{if(l.done)return;const s=l.constructor==Et?1:a?a[u].lastPosition:i[u];let c=r.immediate,f=s;if(!c){if(f=l.lastPosition,o.tension<=0)return void(l.done=!0);let t=l.elapsedTime+=e;const n=r.fromValues[u],i=null!=l.v0?l.v0:l.v0=re.arr(o.velocity)?o.velocity[u]:o.velocity;let a;if(re.und(o.duration))if(o.decay){const e=!0===o.decay?.998:o.decay,r=Math.exp(-(1-e)*t);f=n+i/(1-e)*(1-r),c=Math.abs(l.lastPosition-f)<.1,a=i*r}else{a=null==l.lastVelocity?i:l.lastVelocity;const t=o.precision||(n==s?.005:Math.min(1,.001*Math.abs(s-n))),r=o.restVelocity||t/10,u=o.clamp?0:o.bounce,d=!re.und(u),p=n==s?l.v0>0:n<s;let h,m=!1;const g=1,y=Math.ceil(e/g);for(let e=0;e<y&&(h=Math.abs(a)>r,h||(c=Math.abs(s-f)<=t,!c));++e){d&&(m=f==s||f>s==p,m&&(a=-a*u,f=s));a+=(1e-6*-o.tension*(f-s)+.001*-o.friction*a)/o.mass*g,f+=a*g}}else{let r=1;o.duration>0&&(this._memoizedDuration!==o.duration&&(this._memoizedDuration=o.duration,l.durationProgress>0&&(l.elapsedTime=o.duration*l.durationProgress,t=l.elapsedTime+=e)),r=(o.progress||0)+t/this._memoizedDuration,r=r>1?1:r<0?0:r,l.durationProgress=r),f=n+o.easing(r)*(s-n),a=(f-l.lastPosition)/e,c=1==r}l.lastVelocity=a,Number.isNaN(f)&&(console.warn("Got NaN while animating:",this),c=!0)}a&&!a[u].done&&(c=!1),c?l.done=!0:t=!1,l.setValue(f,o.round)&&(n=!0)}));const l=bt(this),u=l.getValue();if(t){const e=Ye(r.to);u===e&&!n||o.decay?n&&o.decay&&this._onChange(u):(l.setValue(e),this._onChange(e)),this._stop()}else n&&this._onChange(u)}set(e){return A.batchedUpdates((()=>{this._stop(),this._focus(e),this._set(e)})),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(yn(this)){const{to:e,config:t}=this.animation;A.batchedUpdates((()=>{this._onStart(),t.decay||this._set(e,!1),this._stop()}))}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,t){let n;return re.und(e)?(n=this.queue||[],this.queue=[]):n=[re.obj(e)?e:Lt({},t,{to:e})],Promise.all(n.map((e=>this._update(e)))).then((e=>rn(this,e)))}stop(e){const{to:t}=this.animation;return this._focus(this.get()),sn(this._state,e&&this._lastCallId),A.batchedUpdates((()=>this._stop(t,e))),this}reset(){this._update({reset:!0})}eventObserved(e){"change"==e.type?this._start():"priority"==e.type&&(this.priority=e.priority+1)}_prepareNode(e){const t=this.key||"";let{to:n,from:r}=e;n=re.obj(n)?n[t]:n,(null==n||Yt(n))&&(n=void 0),r=re.obj(r)?r[t]:r,null==r&&(r=void 0);const o={to:n,from:r};return gn(this)||(e.reverse&&([n,r]=[r,n]),r=Ye(r),re.und(r)?bt(this)||this._set(n):this._set(r)),o}_update(e,t){let n=Lt({},e);const{key:r,defaultProps:o}=this;n.default&&Object.assign(o,Ut(n,((e,t)=>/^on/.test(t)?Ft(e,r):e))),Cn(this,n,"onProps"),Vn(this,"onProps",n,this);const i=this._prepareNode(n);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");const a=this._state;return nn(++this._lastCallId,{key:r,props:n,defaultProps:o,state:a,actions:{pause:()=>{vn(this)||(wn(this,!0),se(a.pauseQueue),Vn(this,"onPause",an(this,Sn(this,this.animation.to)),this))},resume:()=>{vn(this)&&(wn(this,!1),yn(this)&&this._resume(),se(a.resumeQueue),Vn(this,"onResume",an(this,Sn(this,this.animation.to)),this))},start:this._merge.bind(this,i)}}).then((e=>{if(n.loop&&e.finished&&(!t||!e.noop)){const e=xn(n);if(e)return this._update(e,!0)}return e}))}_merge(e,t,n){if(t.cancel)return this.stop(!0),n(ln(this));const r=!re.und(e.to),o=!re.und(e.from);if(r||o){if(!(t.callId>this._lastToId))return n(ln(this));this._lastToId=t.callId}const{key:i,defaultProps:a,animation:l}=this,{to:u,from:s}=l;let{to:c=u,from:f=s}=e;!o||r||t.default&&!re.und(c)||(c=f),t.reverse&&([c,f]=[f,c]);const d=!oe(f,s);d&&(l.from=f),f=Ye(f);const p=!oe(c,u);p&&this._focus(c);const h=Yt(t.to),{config:m}=l,{decay:g,velocity:y}=m;(r||o)&&(m.velocity=0),t.config&&!h&&function(e,t,n){n&&(Jt(n=Lt({},n),t),t=Lt({},n,t)),Jt(e,t),Object.assign(e,t);for(const a in Kt)null==e[a]&&(e[a]=Kt[a]);let{mass:r,frequency:o,damping:i}=e;re.und(o)||(o<.01&&(o=.01),i<0&&(i=0),e.tension=Math.pow(2*Math.PI/o,2)*r,e.friction=4*Math.PI*i*r/o)}(m,Nt(t.config,i),t.config!==a.config?Nt(a.config,i):void 0);let v=bt(this);if(!v||re.und(c))return n(an(this,!0));const b=re.und(t.reset)?o&&!t.default:!re.und(f)&&Dt(t.reset,i),w=b?f:this.get(),k=Ht(c),S=re.num(k)||re.arr(k)||ft(k),x=!h&&(!S||Dt(a.immediate||t.immediate,i));if(p){const e=Vt(c);if(e!==v.constructor){if(!x)throw Error(`Cannot animate between ${v.constructor.name} and ${e.name}, as the "to" prop suggests`);v=this._set(k)}}const E=v.constructor;let _=Be(c),O=!1;if(!_){const e=b||!gn(this)&&d;(p||e)&&(O=oe(Ht(w),k),_=!O),(oe(l.immediate,x)||x)&&oe(m.decay,g)&&oe(m.velocity,y)||(_=!0)}if(O&&yn(this)&&(l.changed&&!b?_=!0:_||this._stop(u)),!h&&((_||Be(u))&&(l.values=v.getPayload(),l.toValues=Be(c)?null:E==Et?[1]:le(k)),l.immediate!=x&&(l.immediate=x,x||b||this._set(u)),_)){const{onRest:e}=l;ie(Pn,(e=>Cn(this,t,e)));const r=an(this,Sn(this,u));se(this._pendingCalls,r),this._pendingCalls.add(n),l.changed&&A.batchedUpdates((()=>{l.changed=!b,null==e||e(r,this),b?Nt(a.onRest,r):null==l.onStart||l.onStart(r,this)}))}b&&this._set(w),h?n(un(t.to,t,this._state,this)):_?this._start():yn(this)&&!p?this._pendingCalls.add(n):n(on(w))}_focus(e){const t=this.animation;e!==t.to&&(Xe(this)&&this._detach(),t.to=e,Xe(this)&&this._attach())}_attach(){let e=0;const{to:t}=this.animation;Be(t)&&(Ze(t,this),dn(t)&&(e=t.priority+1)),this.priority=e}_detach(){const{to:e}=this.animation;Be(e)&&Je(e,this)}_set(e,t=!0){const n=Ye(e);if(!re.und(n)){const e=bt(this);if(!e||!oe(n,e.getValue())){const r=Vt(n);e&&e.constructor==r?e.setValue(n):wt(this,r.create(n)),e&&A.batchedUpdates((()=>{this._onChange(n,t)}))}}return bt(this)}_onStart(){const e=this.animation;e.changed||(e.changed=!0,Vn(this,"onStart",an(this,Sn(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),Nt(this.animation.onChange,e,this)),Nt(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){const e=this.animation;bt(this).reset(Ye(e.to)),e.immediate||(e.fromValues=e.values.map((e=>e.lastPosition))),yn(this)||(bn(this,!0),vn(this)||this._resume())}_resume(){me.skipAnimation?this.finish():we.start(this)}_stop(e,t){if(yn(this)){bn(this,!1);const n=this.animation;ie(n.values,(e=>{e.done=!0})),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),Ge(this,{type:"idle",parent:this});const r=t?ln(this.get()):an(this.get(),Sn(this,null!=e?e:n.to));se(this._pendingCalls,r),n.changed&&(n.changed=!1,Vn(this,"onRest",r,this))}}}function Sn(e,t){const n=Ht(t);return oe(Ht(e.get()),n)}function xn(e,t=e.loop,n=e.to){let r=Nt(t);if(r){const o=!0!==r&&$t(r),i=(o||e).reverse,a=!o||o.reset;return En(Lt({},e,{loop:t,default:!1,pause:void 0,to:!i||Yt(n)?n:void 0,from:a?e.from:void 0,reset:a},o))}}function En(e){const{to:t,from:n}=e=$t(e),r=new Set;return re.obj(t)&&On(t,r),re.obj(n)&&On(n,r),e.keys=r.size?Array.from(r):null,e}function _n(e){const t=En(e);return re.und(t.default)&&(t.default=Ut(t)),t}function On(e,t){ae(e,((e,n)=>null!=e&&t.add(n)))}const Pn=["onStart","onRest","onChange","onPause","onResume"];function Cn(e,t,n){e.animation[n]=t[n]!==At(t,n)?Ft(t[n],e.key):void 0}function Vn(e,t,...n){var r,o,i,a;null==(r=(o=e.animation)[t])||r.call(o,...n),null==(i=(a=e.defaultProps)[t])||i.call(a,...n)}const Mn=["onStart","onChange","onRest"];let Tn=1;class Rn{constructor(e,t){this.id=Tn++,this.springs={},this.queue=[],this.ref=void 0,this._flush=void 0,this._initialProps=void 0,this._lastAsyncId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._item=void 0,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start(Lt({default:!0},e))}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every((e=>e.idle))}get item(){return this._item}set item(e){this._item=e}get(){const e={};return this.each(((t,n)=>e[n]=t.get())),e}set(e){for(const t in e){const n=e[t];re.und(n)||this.springs[t].set(n)}}update(e){return e&&this.queue.push(En(e)),this}start(e){let{queue:t}=this;return e?t=le(e).map(En):this.queue=[],this._flush?this._flush(this,t):(An(this,t),jn(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){const n=this.springs;ie(le(t),(t=>n[t].stop(!!e)))}else sn(this._state,this._lastAsyncId),this.each((t=>t.stop(!!e)));return this}pause(e){if(re.und(e))this.start({pause:!0});else{const t=this.springs;ie(le(e),(e=>t[e].pause()))}return this}resume(e){if(re.und(e))this.start({pause:!1});else{const t=this.springs;ie(le(e),(e=>t[e].resume()))}return this}each(e){ae(this.springs,e)}_onFrame(){const{onStart:e,onChange:t,onRest:n}=this._events,r=this._active.size>0,o=this._changed.size>0;(r&&!this._started||o&&!this._started)&&(this._started=!0,ue(e,(([e,t])=>{t.value=this.get(),e(t,this,this._item)})));const i=!r&&this._started,a=o||i&&n.size?this.get():null;o&&t.size&&ue(t,(([e,t])=>{t.value=a,e(t,this,this._item)})),i&&(this._started=!1,ue(n,(([e,t])=>{t.value=a,e(t,this,this._item)})))}eventObserved(e){if("change"==e.type)this._changed.add(e.parent),e.idle||this._active.add(e.parent);else{if("idle"!=e.type)return;this._active.delete(e.parent)}A.onFrame(this._onFrame)}}function jn(e,t){return Promise.all(t.map((t=>zn(e,t)))).then((t=>rn(e,t)))}async function zn(e,t,n){const{keys:r,to:o,from:i,loop:a,onRest:l,onResolve:u}=t,s=re.obj(t.default)&&t.default;a&&(t.loop=!1),!1===o&&(t.to=null),!1===i&&(t.from=null);const c=re.arr(o)||re.fun(o)?o:void 0;c?(t.to=void 0,t.onRest=void 0,s&&(s.onRest=void 0)):ie(Mn,(n=>{const r=t[n];if(re.fun(r)){const o=e._events[n];t[n]=({finished:e,cancelled:t})=>{const n=o.get(r);n?(e||(n.finished=!1),t&&(n.cancelled=!0)):o.set(r,{value:null,finished:e||!1,cancelled:t||!1})},s&&(s[n]=t[n])}}));const f=e._state;t.pause===!f.paused?(f.paused=t.pause,se(t.pause?f.pauseQueue:f.resumeQueue)):f.paused&&(t.pause=!0);const d=(r||Object.keys(e.springs)).map((n=>e.springs[n].start(t))),p=!0===t.cancel||!0===At(t,"cancel");(c||p&&f.asyncId)&&d.push(nn(++e._lastAsyncId,{props:t,state:f,actions:{pause:ne,resume:ne,start(t,n){p?(sn(f,e._lastAsyncId),n(ln(e))):(t.onRest=l,n(un(c,t,f,e)))}}})),f.paused&&await new Promise((e=>{f.resumeQueue.add(e)}));const h=rn(e,await Promise.all(d));if(a&&h.finished&&(!n||!h.noop)){const n=xn(t,a,o);if(n)return An(e,[n]),zn(e,n,!0)}return u&&A.batchedUpdates((()=>u(h,e,e.item))),h}function Ln(e,t){const n=Lt({},e.springs);return t&&ie(le(t),(e=>{re.und(e.keys)&&(e=En(e)),re.obj(e.to)||(e=Lt({},e,{to:void 0})),Fn(n,e,(e=>Dn(e)))})),Nn(e,n),n}function Nn(e,t){ae(t,((t,n)=>{e.springs[n]||(e.springs[n]=t,Ze(t,e))}))}function Dn(e,t){const n=new kn;return n.key=e,t&&Ze(n,t),n}function Fn(e,t,n){t.keys&&ie(t.keys,(r=>{(e[r]||(e[r]=n(r)))._prepareNode(t)}))}function An(e,t){ie(t,(t=>{Fn(e.springs,t,(t=>Dn(t,e)))}))}const In=["children"],Un=e=>{let{children:t}=e,n=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,In);const r=g(qn),o=n.pause||!!r.pause,i=n.immediate||!!r.immediate;n=function(e,t){const[n]=d((()=>({inputs:t,result:e()}))),r=p(),o=r.current;let i=o;i?Boolean(t&&i.inputs&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(t,i.inputs))||(i={inputs:t,result:e()}):i=n;return f((()=>{r.current=i,o==n&&(n.inputs=n.result=void 0)}),[i]),i.result}((()=>({pause:o,immediate:i})),[o,i]);const{Provider:a}=qn;return s.createElement(a,{value:n},t)},qn=(Wn=Un,$n={},Object.assign(Wn,s.createContext($n)),Wn.Provider._context=Wn,Wn.Consumer._context=Wn,Wn);var Wn,$n;Un.Provider=qn.Provider,Un.Consumer=qn.Consumer;const Hn=()=>{const e=[],t=function(t){ct(`${lt}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`);const r=[];return ie(e,((e,o)=>{if(re.und(t))r.push(e.start());else{const i=n(t,e,o);i&&r.push(e.start(i))}})),r};t.current=e,t.add=function(t){e.includes(t)||e.push(t)},t.delete=function(t){const n=e.indexOf(t);~n&&e.splice(n,1)},t.pause=function(){return ie(e,(e=>e.pause(...arguments))),this},t.resume=function(){return ie(e,(e=>e.resume(...arguments))),this},t.set=function(t){ie(e,(e=>e.set(t)))},t.start=function(t){const n=[];return ie(e,((e,r)=>{if(re.und(t))n.push(e.start());else{const o=this._getProps(t,e,r);o&&n.push(e.start(o))}})),n},t.stop=function(){return ie(e,(e=>e.stop(...arguments))),this},t.update=function(t){return ie(e,((e,n)=>e.update(this._getProps(t,e,n)))),this};const n=function(e,t,n){return re.fun(e)?e(n,t):e};return t._getProps=n,t};function Bn(e,t,n){const r=re.fun(t)&&t;r&&!n&&(n=[]);const o=y((()=>r||3==arguments.length?Hn():void 0),[]),i=p(0),a=ht(),l=y((()=>({ctrls:[],queue:[],flush(e,t){const n=Ln(e,t);return i.current>0&&!l.queue.length&&!Object.keys(n).some((t=>!e.springs[t]))?jn(e,t):new Promise((r=>{Nn(e,n),l.queue.push((()=>{r(jn(e,t))})),a()}))}})),[]),u=p([...l.ctrls]),s=[],c=gt(e)||0;function f(e,n){for(let o=e;o<n;o++){const e=u.current[o]||(u.current[o]=new Rn(null,l.flush)),n=r?r(o,e):t[o];n&&(s[o]=_n(n))}}y((()=>{ie(u.current.slice(e,c),(e=>{Xt(e,o),e.stop(!0)})),u.current.length=e,f(c,e)}),[e]),y((()=>{f(0,Math.min(c,e))}),n);const d=u.current.map(((e,t)=>Ln(e,s[t]))),h=g(Un),m=gt(h),v=h!==m&&Bt(h);yt((()=>{i.current++,l.ctrls=u.current;const{queue:e}=l;e.length&&(l.queue=[],ie(e,(e=>e()))),ie(u.current,((e,t)=>{null==o||o.add(e),v&&e.start({default:h});const n=s[t];n&&(Gt(e,n.ref),e.ref?e.queue.push(n):e.start(n))}))})),dt((()=>()=>{ie(l.ctrls,(e=>e.stop(!0)))}));const b=d.map((e=>Lt({},e)));return o?[b,o]:b}let Yn;var Xn;(Xn=Yn||(Yn={})).MOUNT="mount",Xn.ENTER="enter",Xn.UPDATE="update",Xn.LEAVE="leave";let Gn=1;function Qn(e,{key:t,keys:n=t},r){if(null===n){const t=new Set;return e.map((e=>{const n=r&&r.find((n=>n.item===e&&n.phase!==Yn.LEAVE&&!t.has(n)));return n?(t.add(n),n.key):Gn++}))}return re.und(n)?e:re.fun(n)?e.map(n):le(n)}class Kn extends hn{constructor(e,t){super(),this.key=void 0,this.idle=!0,this.calc=void 0,this._active=new Set,this.source=e,this.calc=qe(...t);const n=this._get(),r=Vt(n);wt(this,r.create(n))}advance(e){const t=this._get();oe(t,this.get())||(bt(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&Jn(this._active)&&er(this)}_get(){const e=re.arr(this.source)?this.source.map(Ye):le(Ye(this.source));return this.calc(...e)}_start(){this.idle&&!Jn(this._active)&&(this.idle=!1,ie(kt(this),(e=>{e.done=!1})),me.skipAnimation?(A.batchedUpdates((()=>this.advance())),er(this)):we.start(this))}_attach(){let e=1;ie(le(this.source),(t=>{Be(t)&&Ze(t,this),dn(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))})),this.priority=e,this._start()}_detach(){ie(le(this.source),(e=>{Be(e)&&Je(e,this)})),this._active.clear(),er(this)}eventObserved(e){"change"==e.type?e.idle?this.advance():(this._active.add(e.parent),this._start()):"idle"==e.type?this._active.delete(e.parent):"priority"==e.type&&(this.priority=le(this.source).reduce(((e,t)=>Math.max(e,(dn(t)?t.priority:0)+1)),0))}}function Zn(e){return!1!==e.idle}function Jn(e){return!e.size||Array.from(e).every(Zn)}function er(e){e.idle||(e.idle=!0,ie(kt(e),(e=>{e.done=!0})),Ge(e,{type:"idle",parent:e}))}me.assign({createStringInterpolator:at,to:(e,t)=>new Kn(e,t)});var tr={exports:{}},nr={},rr=Object.getOwnPropertySymbols,or=Object.prototype.hasOwnProperty,ir=Object.prototype.propertyIsEnumerable;function ar(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var lr=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={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(o){return!1}}()?Object.assign:function(e,t){for(var n,r,o=ar(e),i=1;i<arguments.length;i++){for(var a in n=Object(arguments[i]))or.call(n,a)&&(o[a]=n[a]);if(rr){r=rr(n);for(var l=0;l<r.length;l++)ir.call(n,r[l])&&(o[r[l]]=n[r[l]])}}return o},ur={exports:{}},sr={};
/** @license React v0.20.2
* scheduler.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.
*/
!function(e){var t,n,r,o;if("object"==typeof performance&&"function"==typeof performance.now){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}if("undefined"==typeof window||"function"!=typeof MessageChannel){var u=null,s=null,c=function(){if(null!==u)try{var t=e.unstable_now();u(!0,t),u=null}catch(n){throw setTimeout(c,0),n}};t=function(e){null!==u?setTimeout(t,0,e):(u=e,setTimeout(c,0))},n=function(e,t){s=setTimeout(e,t)},r=function(){clearTimeout(s)},e.unstable_shouldYield=function(){return!1},o=e.unstable_forceFrameRate=function(){}}else{var f=window.setTimeout,d=window.clearTimeout;if("undefined"!=typeof console){var p=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!=typeof p&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var h=!1,m=null,g=-1,y=5,v=0;e.unstable_shouldYield=function(){return e.unstable_now()>=v},o=function(){},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):y=0<e?Math.floor(1e3/e):5};var b=new MessageChannel,w=b.port2;b.port1.onmessage=function(){if(null!==m){var t=e.unstable_now();v=t+y;try{m(!0,t)?w.postMessage(null):(h=!1,m=null)}catch(n){throw w.postMessage(null),n}}else h=!1},t=function(e){m=e,h||(h=!0,w.postMessage(null))},n=function(t,n){g=f((function(){t(e.unstable_now())}),n)},r=function(){d(g),g=-1}}function k(e,t){var n=e.length;e.push(t);e:for(;;){var r=n-1>>>1,o=e[r];if(!(void 0!==o&&0<E(o,t)))break e;e[r]=t,e[n]=o,n=r}}function S(e){return void 0===(e=e[0])?null:e}function x(e){var t=e[0];if(void 0!==t){var n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length;r<o;){var i=2*(r+1)-1,a=e[i],l=i+1,u=e[l];if(void 0!==a&&0>E(a,n))void 0!==u&&0>E(u,a)?(e[r]=u,e[l]=n,r=l):(e[r]=a,e[i]=n,r=i);else{if(!(void 0!==u&&0>E(u,n)))break e;e[r]=u,e[l]=n,r=l}}}return t}return null}function E(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var _=[],O=[],P=1,C=null,V=3,M=!1,T=!1,R=!1;function j(e){for(var t=S(O);null!==t;){if(null===t.callback)x(O);else{if(!(t.startTime<=e))break;x(O),t.sortIndex=t.expirationTime,k(_,t)}t=S(O)}}function z(e){if(R=!1,j(e),!T)if(null!==S(_))T=!0,t(L);else{var r=S(O);null!==r&&n(z,r.startTime-e)}}function L(t,o){T=!1,R&&(R=!1,r()),M=!0;var i=V;try{for(j(o),C=S(_);null!==C&&(!(C.expirationTime>o)||t&&!e.unstable_shouldYield());){var a=C.callback;if("function"==typeof a){C.callback=null,V=C.priorityLevel;var l=a(C.expirationTime<=o);o=e.unstable_now(),"function"==typeof l?C.callback=l:C===S(_)&&x(_),j(o)}else x(_);C=S(_)}if(null!==C)var u=!0;else{var s=S(O);null!==s&&n(z,s.startTime-o),u=!1}return u}finally{C=null,V=i,M=!1}}var N=o;e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){T||M||(T=!0,t(L))},e.unstable_getCurrentPriorityLevel=function(){return V},e.unstable_getFirstCallbackNode=function(){return S(_)},e.unstable_next=function(e){switch(V){case 1:case 2:case 3:var t=3;break;default:t=V}var n=V;V=t;try{return e()}finally{V=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=N,e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=V;V=e;try{return t()}finally{V=n}},e.unstable_scheduleCallback=function(o,i,a){var l=e.unstable_now();switch("object"==typeof a&&null!==a?a="number"==typeof(a=a.delay)&&0<a?l+a:l:a=l,o){case 1:var u=-1;break;case 2:u=250;break;case 5:u=1073741823;break;case 4:u=1e4;break;default:u=5e3}return o={id:P++,callback:i,priorityLevel:o,startTime:a,expirationTime:u=a+u,sortIndex:-1},a>l?(o.sortIndex=a,k(O,o),null===S(_)&&o===S(O)&&(R?r():R=!0,n(z,a-l))):(o.sortIndex=u,k(_,o),T||M||(T=!0,t(L))),o},e.unstable_wrapCallback=function(e){var t=V;return function(){var n=V;V=t;try{return e.apply(this,arguments)}finally{V=n}}}}(sr),ur.exports=sr;
/** @license React v17.0.2
* react-dom.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 cr=c,fr=lr,dr=ur.exports;function pr(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!cr)throw Error(pr(227));var hr=new Set,mr={};function gr(e,t){yr(e,t),yr(e+"Capture",t)}function yr(e,t){for(mr[e]=t,e=0;e<t.length;e++)hr.add(t[e])}var vr=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),br=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,wr=Object.prototype.hasOwnProperty,kr={},Sr={};function xr(e,t,n,r,o,i,a){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var Er={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){Er[e]=new xr(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];Er[t]=new xr(t,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){Er[e]=new xr(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){Er[e]=new xr(e,2,!1,e,null,!1,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){Er[e]=new xr(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){Er[e]=new xr(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){Er[e]=new xr(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){Er[e]=new xr(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){Er[e]=new xr(e,5,!1,e.toLowerCase(),null,!1,!1)}));var _r=/[\-:]([a-z])/g;function Or(e){return e[1].toUpperCase()}function Pr(e,t,n,r){var o=Er.hasOwnProperty(t)?Er[t]:null;(null!==o?0===o.type:!r&&(2<t.length&&("o"===t[0]||"O"===t[0])&&("n"===t[1]||"N"===t[1])))||(function(e,t,n,r){if(null==t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,o,r)&&(n=null),r||null===o?function(e){return!!wr.call(Sr,e)||!wr.call(kr,e)&&(br.test(e)?Sr[e]=!0:(kr[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=null===n?3!==o.type&&"":n:(t=o.attributeName,r=o.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(o=o.type)||4===o&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(_r,Or);Er[t]=new xr(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(_r,Or);Er[t]=new xr(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(_r,Or);Er[t]=new xr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){Er[e]=new xr(e,1,!1,e.toLowerCase(),null,!1,!1)})),Er.xli