travel/web/node_modules/@vue/reactivity/dist/reactivity.global.prod.js

8 lines
13 KiB
JavaScript
Raw Normal View History

2024-06-24 11:28:18 +08:00
/**
* @vue/reactivity v3.4.29
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
var VueReactivity=function(t){"use strict";
/*! #__NO_SIDE_EFFECTS__ */function e(t,e){const s=new Set(t.split(","));return t=>s.has(t)}const s=()=>{},n=Object.assign,i=Object.prototype.hasOwnProperty,r=(t,e)=>i.call(t,e),c=Array.isArray,o=t=>"[object Map]"===f(t),u=t=>"function"==typeof t,a=t=>"symbol"==typeof t,l=t=>null!==t&&"object"==typeof t,h=Object.prototype.toString,f=t=>h.call(t),_=t=>f(t).slice(8,-1),d=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,p=(t,e)=>!Object.is(t,e);let v,g;class y{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this.parent=v,!t&&v&&(this.index=(v.scopes||(v.scopes=[])).push(this)-1)}get active(){return this._active}run(t){if(this._active){const e=v;try{return v=this,t()}finally{v=e}}}on(){v=this}off(){v=this.parent}stop(t){if(this._active){let e,s;for(e=0,s=this.effects.length;e<s;e++)this.effects[e].stop();for(e=0,s=this.cleanups.length;e<s;e++)this.cleanups[e]();if(this.scopes)for(e=0,s=this.scopes.length;e<s;e++)this.scopes[e].stop(!0);if(!this.detached&&this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.parent=void 0,this._active=!1}}}function w(t,e=v){e&&e.active&&e.effects.push(t)}class R{constructor(t,e,s,n){this.fn=t,this.trigger=e,this.scheduler=s,this.active=!0,this.deps=[],this._dirtyLevel=5,this._trackId=0,this._runnings=0,this._shouldSchedule=!1,this._depsLength=0,w(this,n)}get dirty(){if(2===this._dirtyLevel)return!1;if(3===this._dirtyLevel||4===this._dirtyLevel){this._dirtyLevel=1,j();for(let t=0;t<this._depsLength;t++){const e=this.deps[t];if(e.computed){if(2===e.computed.effect._dirtyLevel)return!0;if(S(e.computed),this._dirtyLevel>=5)break}}1===this._dirtyLevel&&(this._dirtyLevel=0),I()}return this._dirtyLevel>=5}set dirty(t){this._dirtyLevel=t?5:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let t=m,e=g;try{return m=!0,g=this,this._runnings++,b(this),this.fn()}finally{k(this),this._runnings--,g=e,m=t}}stop(){this.active&&(b(this),k(this),this.onStop&&this.onStop(),this.active=!1)}}function S(t){return t.value}function b(t){t._trackId++,t._depsLength=0}function k(t){if(t.deps.length>t._depsLength){for(let e=t._depsLength;e<t.deps.length;e++)L(t.deps[e],t);t.deps.length=t._depsLength}}function L(t,e){const s=t.get(e);void 0!==s&&e._trackId!==s&&(t.delete(e),0===t.size&&t.cleanup())}let m=!0,E=0;const O=[];function j(){O.push(m),m=!1}function I(){const t=O.pop();m=void 0===t||t}function x(){E++}function P(){for(E--;!E&&A.length;)A.shift()()}function T(t,e,s){if(e.get(t)!==t._trackId){e.set(t,t._trackId);const s=t.deps[t._depsLength];s!==e?(s&&L(s,t),t.deps[t._depsLength++]=e):t._depsLength++}}const A=[];function M(t,e,s){x();for(const n of t.keys()){if(!t.computed&&n.computed&&t.get(n)===n._trackId&&n._runnings>0){n._dirtyLevel=2;continue}let s;n._dirtyLevel<e&&(null!=s?s:s=t.get(n)===n._trackId)&&(n._shouldSchedule||(n._shouldSchedule=0===n._dirtyLevel),n.computed&&2===n._dirtyLevel&&(n._shouldSchedule=!0),n._dirtyLevel=e),n._shouldSchedule&&(null!=s?s:s=t.get(n)===n._trackId)&&(n.trigger(),n._runnings&&!n.allowRecurse||3===n._dirtyLevel||(n._shouldSchedule=!1,n.scheduler&&A.push(n.scheduler)))}P()}const V=(t,e)=>{const s=new Map;return s.cleanup=t,s.computed=e,s},W=new WeakMap,z=Symbol(""),N=Symbol("");function D(t,e,s){if(m&&g){let e=W.get(t);e||W.set(t,e=new Map);let n=e.get(s);n||e.set(s,n=V((()=>e.delete(s)))),T(g,n)}}function C(t,e,s,n,i,r){const u=W.get(t);if(!u)return;let l=[];if("clear"===e)l=[...u.values()];else if("length"===s&&c(t)){const t=Number(n);u.forEach(((e,s)=>{("length"===s||!a(s)&&s>=t)&&l.push(e)}))}else switch(void 0!==s&&l.push(u.get(s)),e){case"add":c(t)?d(s)&&l.push(u.get("length")):(l.push(u.get(z)),o(t)&&l.push(u.get(N)));break;case"delete":c(t)||(l.push(u.get(z)),o(t)&&l.push(u.get(N)));break;case"set":o(t)&&l.push(u.get(z))}x();for(const c of l)c&&M(c,5);P()}const K=e("__proto__,__v_isRef,__isVue"),H=new Set(Object.getOwnPropertyNames(Symbol).filter((t=>"arguments"!==t&&"caller"!==t)).map((t=>Symbol[t])).filter(a)),Y=F();function F(){const t={}