reactivity.esm-bundler.js 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258
  1. import { extend, isArray, toNumber, isMap, isIntegerKey, hasOwn, isSymbol, isObject, hasChanged, makeMap, capitalize, toRawType, def, isFunction, NOOP } from '@vue/shared';
  2. function warn(msg, ...args) {
  3. console.warn(`[Vue warn] ${msg}`, ...args);
  4. }
  5. let activeEffectScope;
  6. class EffectScope {
  7. constructor(detached = false) {
  8. this.detached = detached;
  9. /**
  10. * @internal
  11. */
  12. this.active = true;
  13. /**
  14. * @internal
  15. */
  16. this.effects = [];
  17. /**
  18. * @internal
  19. */
  20. this.cleanups = [];
  21. this.parent = activeEffectScope;
  22. if (!detached && activeEffectScope) {
  23. this.index =
  24. (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
  25. }
  26. }
  27. run(fn) {
  28. if (this.active) {
  29. const currentEffectScope = activeEffectScope;
  30. try {
  31. activeEffectScope = this;
  32. return fn();
  33. }
  34. finally {
  35. activeEffectScope = currentEffectScope;
  36. }
  37. }
  38. else if ((process.env.NODE_ENV !== 'production')) {
  39. warn(`cannot run an inactive effect scope.`);
  40. }
  41. }
  42. /**
  43. * This should only be called on non-detached scopes
  44. * @internal
  45. */
  46. on() {
  47. activeEffectScope = this;
  48. }
  49. /**
  50. * This should only be called on non-detached scopes
  51. * @internal
  52. */
  53. off() {
  54. activeEffectScope = this.parent;
  55. }
  56. stop(fromParent) {
  57. if (this.active) {
  58. let i, l;
  59. for (i = 0, l = this.effects.length; i < l; i++) {
  60. this.effects[i].stop();
  61. }
  62. for (i = 0, l = this.cleanups.length; i < l; i++) {
  63. this.cleanups[i]();
  64. }
  65. if (this.scopes) {
  66. for (i = 0, l = this.scopes.length; i < l; i++) {
  67. this.scopes[i].stop(true);
  68. }
  69. }
  70. // nested scope, dereference from parent to avoid memory leaks
  71. if (!this.detached && this.parent && !fromParent) {
  72. // optimized O(1) removal
  73. const last = this.parent.scopes.pop();
  74. if (last && last !== this) {
  75. this.parent.scopes[this.index] = last;
  76. last.index = this.index;
  77. }
  78. }
  79. this.parent = undefined;
  80. this.active = false;
  81. }
  82. }
  83. }
  84. function effectScope(detached) {
  85. return new EffectScope(detached);
  86. }
  87. function recordEffectScope(effect, scope = activeEffectScope) {
  88. if (scope && scope.active) {
  89. scope.effects.push(effect);
  90. }
  91. }
  92. function getCurrentScope() {
  93. return activeEffectScope;
  94. }
  95. function onScopeDispose(fn) {
  96. if (activeEffectScope) {
  97. activeEffectScope.cleanups.push(fn);
  98. }
  99. else if ((process.env.NODE_ENV !== 'production')) {
  100. warn(`onScopeDispose() is called when there is no active effect scope` +
  101. ` to be associated with.`);
  102. }
  103. }
  104. const createDep = (effects) => {
  105. const dep = new Set(effects);
  106. dep.w = 0;
  107. dep.n = 0;
  108. return dep;
  109. };
  110. const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
  111. const newTracked = (dep) => (dep.n & trackOpBit) > 0;
  112. const initDepMarkers = ({ deps }) => {
  113. if (deps.length) {
  114. for (let i = 0; i < deps.length; i++) {
  115. deps[i].w |= trackOpBit; // set was tracked
  116. }
  117. }
  118. };
  119. const finalizeDepMarkers = (effect) => {
  120. const { deps } = effect;
  121. if (deps.length) {
  122. let ptr = 0;
  123. for (let i = 0; i < deps.length; i++) {
  124. const dep = deps[i];
  125. if (wasTracked(dep) && !newTracked(dep)) {
  126. dep.delete(effect);
  127. }
  128. else {
  129. deps[ptr++] = dep;
  130. }
  131. // clear bits
  132. dep.w &= ~trackOpBit;
  133. dep.n &= ~trackOpBit;
  134. }
  135. deps.length = ptr;
  136. }
  137. };
  138. const targetMap = new WeakMap();
  139. // The number of effects currently being tracked recursively.
  140. let effectTrackDepth = 0;
  141. let trackOpBit = 1;
  142. /**
  143. * The bitwise track markers support at most 30 levels of recursion.
  144. * This value is chosen to enable modern JS engines to use a SMI on all platforms.
  145. * When recursion depth is greater, fall back to using a full cleanup.
  146. */
  147. const maxMarkerBits = 30;
  148. let activeEffect;
  149. const ITERATE_KEY = Symbol((process.env.NODE_ENV !== 'production') ? 'iterate' : '');
  150. const MAP_KEY_ITERATE_KEY = Symbol((process.env.NODE_ENV !== 'production') ? 'Map key iterate' : '');
  151. class ReactiveEffect {
  152. constructor(fn, scheduler = null, scope) {
  153. this.fn = fn;
  154. this.scheduler = scheduler;
  155. this.active = true;
  156. this.deps = [];
  157. this.parent = undefined;
  158. recordEffectScope(this, scope);
  159. }
  160. run() {
  161. if (!this.active) {
  162. return this.fn();
  163. }
  164. let parent = activeEffect;
  165. let lastShouldTrack = shouldTrack;
  166. while (parent) {
  167. if (parent === this) {
  168. return;
  169. }
  170. parent = parent.parent;
  171. }
  172. try {
  173. this.parent = activeEffect;
  174. activeEffect = this;
  175. shouldTrack = true;
  176. trackOpBit = 1 << ++effectTrackDepth;
  177. if (effectTrackDepth <= maxMarkerBits) {
  178. initDepMarkers(this);
  179. }
  180. else {
  181. cleanupEffect(this);
  182. }
  183. return this.fn();
  184. }
  185. finally {
  186. if (effectTrackDepth <= maxMarkerBits) {
  187. finalizeDepMarkers(this);
  188. }
  189. trackOpBit = 1 << --effectTrackDepth;
  190. activeEffect = this.parent;
  191. shouldTrack = lastShouldTrack;
  192. this.parent = undefined;
  193. if (this.deferStop) {
  194. this.stop();
  195. }
  196. }
  197. }
  198. stop() {
  199. // stopped while running itself - defer the cleanup
  200. if (activeEffect === this) {
  201. this.deferStop = true;
  202. }
  203. else if (this.active) {
  204. cleanupEffect(this);
  205. if (this.onStop) {
  206. this.onStop();
  207. }
  208. this.active = false;
  209. }
  210. }
  211. }
  212. function cleanupEffect(effect) {
  213. const { deps } = effect;
  214. if (deps.length) {
  215. for (let i = 0; i < deps.length; i++) {
  216. deps[i].delete(effect);
  217. }
  218. deps.length = 0;
  219. }
  220. }
  221. function effect(fn, options) {
  222. if (fn.effect) {
  223. fn = fn.effect.fn;
  224. }
  225. const _effect = new ReactiveEffect(fn);
  226. if (options) {
  227. extend(_effect, options);
  228. if (options.scope)
  229. recordEffectScope(_effect, options.scope);
  230. }
  231. if (!options || !options.lazy) {
  232. _effect.run();
  233. }
  234. const runner = _effect.run.bind(_effect);
  235. runner.effect = _effect;
  236. return runner;
  237. }
  238. function stop(runner) {
  239. runner.effect.stop();
  240. }
  241. let shouldTrack = true;
  242. const trackStack = [];
  243. function pauseTracking() {
  244. trackStack.push(shouldTrack);
  245. shouldTrack = false;
  246. }
  247. function enableTracking() {
  248. trackStack.push(shouldTrack);
  249. shouldTrack = true;
  250. }
  251. function resetTracking() {
  252. const last = trackStack.pop();
  253. shouldTrack = last === undefined ? true : last;
  254. }
  255. function track(target, type, key) {
  256. if (shouldTrack && activeEffect) {
  257. let depsMap = targetMap.get(target);
  258. if (!depsMap) {
  259. targetMap.set(target, (depsMap = new Map()));
  260. }
  261. let dep = depsMap.get(key);
  262. if (!dep) {
  263. depsMap.set(key, (dep = createDep()));
  264. }
  265. const eventInfo = (process.env.NODE_ENV !== 'production')
  266. ? { effect: activeEffect, target, type, key }
  267. : undefined;
  268. trackEffects(dep, eventInfo);
  269. }
  270. }
  271. function trackEffects(dep, debuggerEventExtraInfo) {
  272. let shouldTrack = false;
  273. if (effectTrackDepth <= maxMarkerBits) {
  274. if (!newTracked(dep)) {
  275. dep.n |= trackOpBit; // set newly tracked
  276. shouldTrack = !wasTracked(dep);
  277. }
  278. }
  279. else {
  280. // Full cleanup mode.
  281. shouldTrack = !dep.has(activeEffect);
  282. }
  283. if (shouldTrack) {
  284. dep.add(activeEffect);
  285. activeEffect.deps.push(dep);
  286. if ((process.env.NODE_ENV !== 'production') && activeEffect.onTrack) {
  287. activeEffect.onTrack(Object.assign({ effect: activeEffect }, debuggerEventExtraInfo));
  288. }
  289. }
  290. }
  291. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  292. const depsMap = targetMap.get(target);
  293. if (!depsMap) {
  294. // never been tracked
  295. return;
  296. }
  297. let deps = [];
  298. if (type === "clear" /* TriggerOpTypes.CLEAR */) {
  299. // collection being cleared
  300. // trigger all effects for target
  301. deps = [...depsMap.values()];
  302. }
  303. else if (key === 'length' && isArray(target)) {
  304. const newLength = toNumber(newValue);
  305. depsMap.forEach((dep, key) => {
  306. if (key === 'length' || key >= newLength) {
  307. deps.push(dep);
  308. }
  309. });
  310. }
  311. else {
  312. // schedule runs for SET | ADD | DELETE
  313. if (key !== void 0) {
  314. deps.push(depsMap.get(key));
  315. }
  316. // also run for iteration key on ADD | DELETE | Map.SET
  317. switch (type) {
  318. case "add" /* TriggerOpTypes.ADD */:
  319. if (!isArray(target)) {
  320. deps.push(depsMap.get(ITERATE_KEY));
  321. if (isMap(target)) {
  322. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  323. }
  324. }
  325. else if (isIntegerKey(key)) {
  326. // new index added to array -> length changes
  327. deps.push(depsMap.get('length'));
  328. }
  329. break;
  330. case "delete" /* TriggerOpTypes.DELETE */:
  331. if (!isArray(target)) {
  332. deps.push(depsMap.get(ITERATE_KEY));
  333. if (isMap(target)) {
  334. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  335. }
  336. }
  337. break;
  338. case "set" /* TriggerOpTypes.SET */:
  339. if (isMap(target)) {
  340. deps.push(depsMap.get(ITERATE_KEY));
  341. }
  342. break;
  343. }
  344. }
  345. const eventInfo = (process.env.NODE_ENV !== 'production')
  346. ? { target, type, key, newValue, oldValue, oldTarget }
  347. : undefined;
  348. if (deps.length === 1) {
  349. if (deps[0]) {
  350. if ((process.env.NODE_ENV !== 'production')) {
  351. triggerEffects(deps[0], eventInfo);
  352. }
  353. else {
  354. triggerEffects(deps[0]);
  355. }
  356. }
  357. }
  358. else {
  359. const effects = [];
  360. for (const dep of deps) {
  361. if (dep) {
  362. effects.push(...dep);
  363. }
  364. }
  365. if ((process.env.NODE_ENV !== 'production')) {
  366. triggerEffects(createDep(effects), eventInfo);
  367. }
  368. else {
  369. triggerEffects(createDep(effects));
  370. }
  371. }
  372. }
  373. function triggerEffects(dep, debuggerEventExtraInfo) {
  374. // spread into array for stabilization
  375. const effects = isArray(dep) ? dep : [...dep];
  376. for (const effect of effects) {
  377. if (effect.computed) {
  378. triggerEffect(effect, debuggerEventExtraInfo);
  379. }
  380. }
  381. for (const effect of effects) {
  382. if (!effect.computed) {
  383. triggerEffect(effect, debuggerEventExtraInfo);
  384. }
  385. }
  386. }
  387. function triggerEffect(effect, debuggerEventExtraInfo) {
  388. if (effect !== activeEffect || effect.allowRecurse) {
  389. if ((process.env.NODE_ENV !== 'production') && effect.onTrigger) {
  390. effect.onTrigger(extend({ effect }, debuggerEventExtraInfo));
  391. }
  392. if (effect.scheduler) {
  393. effect.scheduler();
  394. }
  395. else {
  396. effect.run();
  397. }
  398. }
  399. }
  400. const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
  401. const builtInSymbols = new Set(
  402. /*#__PURE__*/
  403. Object.getOwnPropertyNames(Symbol)
  404. // ios10.x Object.getOwnPropertyNames(Symbol) can enumerate 'arguments' and 'caller'
  405. // but accessing them on Symbol leads to TypeError because Symbol is a strict mode
  406. // function
  407. .filter(key => key !== 'arguments' && key !== 'caller')
  408. .map(key => Symbol[key])
  409. .filter(isSymbol));
  410. const get = /*#__PURE__*/ createGetter();
  411. const shallowGet = /*#__PURE__*/ createGetter(false, true);
  412. const readonlyGet = /*#__PURE__*/ createGetter(true);
  413. const shallowReadonlyGet = /*#__PURE__*/ createGetter(true, true);
  414. const arrayInstrumentations = /*#__PURE__*/ createArrayInstrumentations();
  415. function createArrayInstrumentations() {
  416. const instrumentations = {};
  417. ['includes', 'indexOf', 'lastIndexOf'].forEach(key => {
  418. instrumentations[key] = function (...args) {
  419. const arr = toRaw(this);
  420. for (let i = 0, l = this.length; i < l; i++) {
  421. track(arr, "get" /* TrackOpTypes.GET */, i + '');
  422. }
  423. // we run the method using the original args first (which may be reactive)
  424. const res = arr[key](...args);
  425. if (res === -1 || res === false) {
  426. // if that didn't work, run it again using raw values.
  427. return arr[key](...args.map(toRaw));
  428. }
  429. else {
  430. return res;
  431. }
  432. };
  433. });
  434. ['push', 'pop', 'shift', 'unshift', 'splice'].forEach(key => {
  435. instrumentations[key] = function (...args) {
  436. pauseTracking();
  437. const res = toRaw(this)[key].apply(this, args);
  438. resetTracking();
  439. return res;
  440. };
  441. });
  442. return instrumentations;
  443. }
  444. function createGetter(isReadonly = false, shallow = false) {
  445. return function get(target, key, receiver) {
  446. if (key === "__v_isReactive" /* ReactiveFlags.IS_REACTIVE */) {
  447. return !isReadonly;
  448. }
  449. else if (key === "__v_isReadonly" /* ReactiveFlags.IS_READONLY */) {
  450. return isReadonly;
  451. }
  452. else if (key === "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */) {
  453. return shallow;
  454. }
  455. else if (key === "__v_raw" /* ReactiveFlags.RAW */ &&
  456. receiver ===
  457. (isReadonly
  458. ? shallow
  459. ? shallowReadonlyMap
  460. : readonlyMap
  461. : shallow
  462. ? shallowReactiveMap
  463. : reactiveMap).get(target)) {
  464. return target;
  465. }
  466. const targetIsArray = isArray(target);
  467. if (!isReadonly && targetIsArray && hasOwn(arrayInstrumentations, key)) {
  468. return Reflect.get(arrayInstrumentations, key, receiver);
  469. }
  470. const res = Reflect.get(target, key, receiver);
  471. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  472. return res;
  473. }
  474. if (!isReadonly) {
  475. track(target, "get" /* TrackOpTypes.GET */, key);
  476. }
  477. if (shallow) {
  478. return res;
  479. }
  480. if (isRef(res)) {
  481. // ref unwrapping - skip unwrap for Array + integer key.
  482. return targetIsArray && isIntegerKey(key) ? res : res.value;
  483. }
  484. if (isObject(res)) {
  485. // Convert returned value into a proxy as well. we do the isObject check
  486. // here to avoid invalid value warning. Also need to lazy access readonly
  487. // and reactive here to avoid circular dependency.
  488. return isReadonly ? readonly(res) : reactive(res);
  489. }
  490. return res;
  491. };
  492. }
  493. const set = /*#__PURE__*/ createSetter();
  494. const shallowSet = /*#__PURE__*/ createSetter(true);
  495. function createSetter(shallow = false) {
  496. return function set(target, key, value, receiver) {
  497. let oldValue = target[key];
  498. if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
  499. return false;
  500. }
  501. if (!shallow) {
  502. if (!isShallow(value) && !isReadonly(value)) {
  503. oldValue = toRaw(oldValue);
  504. value = toRaw(value);
  505. }
  506. if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
  507. oldValue.value = value;
  508. return true;
  509. }
  510. }
  511. const hadKey = isArray(target) && isIntegerKey(key)
  512. ? Number(key) < target.length
  513. : hasOwn(target, key);
  514. const result = Reflect.set(target, key, value, receiver);
  515. // don't trigger if target is something up in the prototype chain of original
  516. if (target === toRaw(receiver)) {
  517. if (!hadKey) {
  518. trigger(target, "add" /* TriggerOpTypes.ADD */, key, value);
  519. }
  520. else if (hasChanged(value, oldValue)) {
  521. trigger(target, "set" /* TriggerOpTypes.SET */, key, value, oldValue);
  522. }
  523. }
  524. return result;
  525. };
  526. }
  527. function deleteProperty(target, key) {
  528. const hadKey = hasOwn(target, key);
  529. const oldValue = target[key];
  530. const result = Reflect.deleteProperty(target, key);
  531. if (result && hadKey) {
  532. trigger(target, "delete" /* TriggerOpTypes.DELETE */, key, undefined, oldValue);
  533. }
  534. return result;
  535. }
  536. function has(target, key) {
  537. const result = Reflect.has(target, key);
  538. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  539. track(target, "has" /* TrackOpTypes.HAS */, key);
  540. }
  541. return result;
  542. }
  543. function ownKeys(target) {
  544. track(target, "iterate" /* TrackOpTypes.ITERATE */, isArray(target) ? 'length' : ITERATE_KEY);
  545. return Reflect.ownKeys(target);
  546. }
  547. const mutableHandlers = {
  548. get,
  549. set,
  550. deleteProperty,
  551. has,
  552. ownKeys
  553. };
  554. const readonlyHandlers = {
  555. get: readonlyGet,
  556. set(target, key) {
  557. if ((process.env.NODE_ENV !== 'production')) {
  558. warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
  559. }
  560. return true;
  561. },
  562. deleteProperty(target, key) {
  563. if ((process.env.NODE_ENV !== 'production')) {
  564. warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
  565. }
  566. return true;
  567. }
  568. };
  569. const shallowReactiveHandlers = /*#__PURE__*/ extend({}, mutableHandlers, {
  570. get: shallowGet,
  571. set: shallowSet
  572. });
  573. // Props handlers are special in the sense that it should not unwrap top-level
  574. // refs (in order to allow refs to be explicitly passed down), but should
  575. // retain the reactivity of the normal readonly object.
  576. const shallowReadonlyHandlers = /*#__PURE__*/ extend({}, readonlyHandlers, {
  577. get: shallowReadonlyGet
  578. });
  579. const toShallow = (value) => value;
  580. const getProto = (v) => Reflect.getPrototypeOf(v);
  581. function get$1(target, key, isReadonly = false, isShallow = false) {
  582. // #1772: readonly(reactive(Map)) should return readonly + reactive version
  583. // of the value
  584. target = target["__v_raw" /* ReactiveFlags.RAW */];
  585. const rawTarget = toRaw(target);
  586. const rawKey = toRaw(key);
  587. if (!isReadonly) {
  588. if (key !== rawKey) {
  589. track(rawTarget, "get" /* TrackOpTypes.GET */, key);
  590. }
  591. track(rawTarget, "get" /* TrackOpTypes.GET */, rawKey);
  592. }
  593. const { has } = getProto(rawTarget);
  594. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  595. if (has.call(rawTarget, key)) {
  596. return wrap(target.get(key));
  597. }
  598. else if (has.call(rawTarget, rawKey)) {
  599. return wrap(target.get(rawKey));
  600. }
  601. else if (target !== rawTarget) {
  602. // #3602 readonly(reactive(Map))
  603. // ensure that the nested reactive `Map` can do tracking for itself
  604. target.get(key);
  605. }
  606. }
  607. function has$1(key, isReadonly = false) {
  608. const target = this["__v_raw" /* ReactiveFlags.RAW */];
  609. const rawTarget = toRaw(target);
  610. const rawKey = toRaw(key);
  611. if (!isReadonly) {
  612. if (key !== rawKey) {
  613. track(rawTarget, "has" /* TrackOpTypes.HAS */, key);
  614. }
  615. track(rawTarget, "has" /* TrackOpTypes.HAS */, rawKey);
  616. }
  617. return key === rawKey
  618. ? target.has(key)
  619. : target.has(key) || target.has(rawKey);
  620. }
  621. function size(target, isReadonly = false) {
  622. target = target["__v_raw" /* ReactiveFlags.RAW */];
  623. !isReadonly && track(toRaw(target), "iterate" /* TrackOpTypes.ITERATE */, ITERATE_KEY);
  624. return Reflect.get(target, 'size', target);
  625. }
  626. function add(value) {
  627. value = toRaw(value);
  628. const target = toRaw(this);
  629. const proto = getProto(target);
  630. const hadKey = proto.has.call(target, value);
  631. if (!hadKey) {
  632. target.add(value);
  633. trigger(target, "add" /* TriggerOpTypes.ADD */, value, value);
  634. }
  635. return this;
  636. }
  637. function set$1(key, value) {
  638. value = toRaw(value);
  639. const target = toRaw(this);
  640. const { has, get } = getProto(target);
  641. let hadKey = has.call(target, key);
  642. if (!hadKey) {
  643. key = toRaw(key);
  644. hadKey = has.call(target, key);
  645. }
  646. else if ((process.env.NODE_ENV !== 'production')) {
  647. checkIdentityKeys(target, has, key);
  648. }
  649. const oldValue = get.call(target, key);
  650. target.set(key, value);
  651. if (!hadKey) {
  652. trigger(target, "add" /* TriggerOpTypes.ADD */, key, value);
  653. }
  654. else if (hasChanged(value, oldValue)) {
  655. trigger(target, "set" /* TriggerOpTypes.SET */, key, value, oldValue);
  656. }
  657. return this;
  658. }
  659. function deleteEntry(key) {
  660. const target = toRaw(this);
  661. const { has, get } = getProto(target);
  662. let hadKey = has.call(target, key);
  663. if (!hadKey) {
  664. key = toRaw(key);
  665. hadKey = has.call(target, key);
  666. }
  667. else if ((process.env.NODE_ENV !== 'production')) {
  668. checkIdentityKeys(target, has, key);
  669. }
  670. const oldValue = get ? get.call(target, key) : undefined;
  671. // forward the operation before queueing reactions
  672. const result = target.delete(key);
  673. if (hadKey) {
  674. trigger(target, "delete" /* TriggerOpTypes.DELETE */, key, undefined, oldValue);
  675. }
  676. return result;
  677. }
  678. function clear() {
  679. const target = toRaw(this);
  680. const hadItems = target.size !== 0;
  681. const oldTarget = (process.env.NODE_ENV !== 'production')
  682. ? isMap(target)
  683. ? new Map(target)
  684. : new Set(target)
  685. : undefined;
  686. // forward the operation before queueing reactions
  687. const result = target.clear();
  688. if (hadItems) {
  689. trigger(target, "clear" /* TriggerOpTypes.CLEAR */, undefined, undefined, oldTarget);
  690. }
  691. return result;
  692. }
  693. function createForEach(isReadonly, isShallow) {
  694. return function forEach(callback, thisArg) {
  695. const observed = this;
  696. const target = observed["__v_raw" /* ReactiveFlags.RAW */];
  697. const rawTarget = toRaw(target);
  698. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  699. !isReadonly && track(rawTarget, "iterate" /* TrackOpTypes.ITERATE */, ITERATE_KEY);
  700. return target.forEach((value, key) => {
  701. // important: make sure the callback is
  702. // 1. invoked with the reactive map as `this` and 3rd arg
  703. // 2. the value received should be a corresponding reactive/readonly.
  704. return callback.call(thisArg, wrap(value), wrap(key), observed);
  705. });
  706. };
  707. }
  708. function createIterableMethod(method, isReadonly, isShallow) {
  709. return function (...args) {
  710. const target = this["__v_raw" /* ReactiveFlags.RAW */];
  711. const rawTarget = toRaw(target);
  712. const targetIsMap = isMap(rawTarget);
  713. const isPair = method === 'entries' || (method === Symbol.iterator && targetIsMap);
  714. const isKeyOnly = method === 'keys' && targetIsMap;
  715. const innerIterator = target[method](...args);
  716. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  717. !isReadonly &&
  718. track(rawTarget, "iterate" /* TrackOpTypes.ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
  719. // return a wrapped iterator which returns observed versions of the
  720. // values emitted from the real iterator
  721. return {
  722. // iterator protocol
  723. next() {
  724. const { value, done } = innerIterator.next();
  725. return done
  726. ? { value, done }
  727. : {
  728. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  729. done
  730. };
  731. },
  732. // iterable protocol
  733. [Symbol.iterator]() {
  734. return this;
  735. }
  736. };
  737. };
  738. }
  739. function createReadonlyMethod(type) {
  740. return function (...args) {
  741. if ((process.env.NODE_ENV !== 'production')) {
  742. const key = args[0] ? `on key "${args[0]}" ` : ``;
  743. console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
  744. }
  745. return type === "delete" /* TriggerOpTypes.DELETE */ ? false : this;
  746. };
  747. }
  748. function createInstrumentations() {
  749. const mutableInstrumentations = {
  750. get(key) {
  751. return get$1(this, key);
  752. },
  753. get size() {
  754. return size(this);
  755. },
  756. has: has$1,
  757. add,
  758. set: set$1,
  759. delete: deleteEntry,
  760. clear,
  761. forEach: createForEach(false, false)
  762. };
  763. const shallowInstrumentations = {
  764. get(key) {
  765. return get$1(this, key, false, true);
  766. },
  767. get size() {
  768. return size(this);
  769. },
  770. has: has$1,
  771. add,
  772. set: set$1,
  773. delete: deleteEntry,
  774. clear,
  775. forEach: createForEach(false, true)
  776. };
  777. const readonlyInstrumentations = {
  778. get(key) {
  779. return get$1(this, key, true);
  780. },
  781. get size() {
  782. return size(this, true);
  783. },
  784. has(key) {
  785. return has$1.call(this, key, true);
  786. },
  787. add: createReadonlyMethod("add" /* TriggerOpTypes.ADD */),
  788. set: createReadonlyMethod("set" /* TriggerOpTypes.SET */),
  789. delete: createReadonlyMethod("delete" /* TriggerOpTypes.DELETE */),
  790. clear: createReadonlyMethod("clear" /* TriggerOpTypes.CLEAR */),
  791. forEach: createForEach(true, false)
  792. };
  793. const shallowReadonlyInstrumentations = {
  794. get(key) {
  795. return get$1(this, key, true, true);
  796. },
  797. get size() {
  798. return size(this, true);
  799. },
  800. has(key) {
  801. return has$1.call(this, key, true);
  802. },
  803. add: createReadonlyMethod("add" /* TriggerOpTypes.ADD */),
  804. set: createReadonlyMethod("set" /* TriggerOpTypes.SET */),
  805. delete: createReadonlyMethod("delete" /* TriggerOpTypes.DELETE */),
  806. clear: createReadonlyMethod("clear" /* TriggerOpTypes.CLEAR */),
  807. forEach: createForEach(true, true)
  808. };
  809. const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
  810. iteratorMethods.forEach(method => {
  811. mutableInstrumentations[method] = createIterableMethod(method, false, false);
  812. readonlyInstrumentations[method] = createIterableMethod(method, true, false);
  813. shallowInstrumentations[method] = createIterableMethod(method, false, true);
  814. shallowReadonlyInstrumentations[method] = createIterableMethod(method, true, true);
  815. });
  816. return [
  817. mutableInstrumentations,
  818. readonlyInstrumentations,
  819. shallowInstrumentations,
  820. shallowReadonlyInstrumentations
  821. ];
  822. }
  823. const [mutableInstrumentations, readonlyInstrumentations, shallowInstrumentations, shallowReadonlyInstrumentations] = /* #__PURE__*/ createInstrumentations();
  824. function createInstrumentationGetter(isReadonly, shallow) {
  825. const instrumentations = shallow
  826. ? isReadonly
  827. ? shallowReadonlyInstrumentations
  828. : shallowInstrumentations
  829. : isReadonly
  830. ? readonlyInstrumentations
  831. : mutableInstrumentations;
  832. return (target, key, receiver) => {
  833. if (key === "__v_isReactive" /* ReactiveFlags.IS_REACTIVE */) {
  834. return !isReadonly;
  835. }
  836. else if (key === "__v_isReadonly" /* ReactiveFlags.IS_READONLY */) {
  837. return isReadonly;
  838. }
  839. else if (key === "__v_raw" /* ReactiveFlags.RAW */) {
  840. return target;
  841. }
  842. return Reflect.get(hasOwn(instrumentations, key) && key in target
  843. ? instrumentations
  844. : target, key, receiver);
  845. };
  846. }
  847. const mutableCollectionHandlers = {
  848. get: /*#__PURE__*/ createInstrumentationGetter(false, false)
  849. };
  850. const shallowCollectionHandlers = {
  851. get: /*#__PURE__*/ createInstrumentationGetter(false, true)
  852. };
  853. const readonlyCollectionHandlers = {
  854. get: /*#__PURE__*/ createInstrumentationGetter(true, false)
  855. };
  856. const shallowReadonlyCollectionHandlers = {
  857. get: /*#__PURE__*/ createInstrumentationGetter(true, true)
  858. };
  859. function checkIdentityKeys(target, has, key) {
  860. const rawKey = toRaw(key);
  861. if (rawKey !== key && has.call(target, rawKey)) {
  862. const type = toRawType(target);
  863. console.warn(`Reactive ${type} contains both the raw and reactive ` +
  864. `versions of the same object${type === `Map` ? ` as keys` : ``}, ` +
  865. `which can lead to inconsistencies. ` +
  866. `Avoid differentiating between the raw and reactive versions ` +
  867. `of an object and only use the reactive version if possible.`);
  868. }
  869. }
  870. const reactiveMap = new WeakMap();
  871. const shallowReactiveMap = new WeakMap();
  872. const readonlyMap = new WeakMap();
  873. const shallowReadonlyMap = new WeakMap();
  874. function targetTypeMap(rawType) {
  875. switch (rawType) {
  876. case 'Object':
  877. case 'Array':
  878. return 1 /* TargetType.COMMON */;
  879. case 'Map':
  880. case 'Set':
  881. case 'WeakMap':
  882. case 'WeakSet':
  883. return 2 /* TargetType.COLLECTION */;
  884. default:
  885. return 0 /* TargetType.INVALID */;
  886. }
  887. }
  888. function getTargetType(value) {
  889. return value["__v_skip" /* ReactiveFlags.SKIP */] || !Object.isExtensible(value)
  890. ? 0 /* TargetType.INVALID */
  891. : targetTypeMap(toRawType(value));
  892. }
  893. function reactive(target) {
  894. // if trying to observe a readonly proxy, return the readonly version.
  895. if (isReadonly(target)) {
  896. return target;
  897. }
  898. return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
  899. }
  900. /**
  901. * Return a shallowly-reactive copy of the original object, where only the root
  902. * level properties are reactive. It also does not auto-unwrap refs (even at the
  903. * root level).
  904. */
  905. function shallowReactive(target) {
  906. return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
  907. }
  908. /**
  909. * Creates a readonly copy of the original object. Note the returned copy is not
  910. * made reactive, but `readonly` can be called on an already reactive object.
  911. */
  912. function readonly(target) {
  913. return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
  914. }
  915. /**
  916. * Returns a reactive-copy of the original object, where only the root level
  917. * properties are readonly, and does NOT unwrap refs nor recursively convert
  918. * returned properties.
  919. * This is used for creating the props proxy object for stateful components.
  920. */
  921. function shallowReadonly(target) {
  922. return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
  923. }
  924. function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers, proxyMap) {
  925. if (!isObject(target)) {
  926. if ((process.env.NODE_ENV !== 'production')) {
  927. console.warn(`value cannot be made reactive: ${String(target)}`);
  928. }
  929. return target;
  930. }
  931. // target is already a Proxy, return it.
  932. // exception: calling readonly() on a reactive object
  933. if (target["__v_raw" /* ReactiveFlags.RAW */] &&
  934. !(isReadonly && target["__v_isReactive" /* ReactiveFlags.IS_REACTIVE */])) {
  935. return target;
  936. }
  937. // target already has corresponding Proxy
  938. const existingProxy = proxyMap.get(target);
  939. if (existingProxy) {
  940. return existingProxy;
  941. }
  942. // only specific value types can be observed.
  943. const targetType = getTargetType(target);
  944. if (targetType === 0 /* TargetType.INVALID */) {
  945. return target;
  946. }
  947. const proxy = new Proxy(target, targetType === 2 /* TargetType.COLLECTION */ ? collectionHandlers : baseHandlers);
  948. proxyMap.set(target, proxy);
  949. return proxy;
  950. }
  951. function isReactive(value) {
  952. if (isReadonly(value)) {
  953. return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]);
  954. }
  955. return !!(value && value["__v_isReactive" /* ReactiveFlags.IS_REACTIVE */]);
  956. }
  957. function isReadonly(value) {
  958. return !!(value && value["__v_isReadonly" /* ReactiveFlags.IS_READONLY */]);
  959. }
  960. function isShallow(value) {
  961. return !!(value && value["__v_isShallow" /* ReactiveFlags.IS_SHALLOW */]);
  962. }
  963. function isProxy(value) {
  964. return isReactive(value) || isReadonly(value);
  965. }
  966. function toRaw(observed) {
  967. const raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */];
  968. return raw ? toRaw(raw) : observed;
  969. }
  970. function markRaw(value) {
  971. def(value, "__v_skip" /* ReactiveFlags.SKIP */, true);
  972. return value;
  973. }
  974. const toReactive = (value) => isObject(value) ? reactive(value) : value;
  975. const toReadonly = (value) => isObject(value) ? readonly(value) : value;
  976. function trackRefValue(ref) {
  977. if (shouldTrack && activeEffect) {
  978. ref = toRaw(ref);
  979. if ((process.env.NODE_ENV !== 'production')) {
  980. trackEffects(ref.dep || (ref.dep = createDep()), {
  981. target: ref,
  982. type: "get" /* TrackOpTypes.GET */,
  983. key: 'value'
  984. });
  985. }
  986. else {
  987. trackEffects(ref.dep || (ref.dep = createDep()));
  988. }
  989. }
  990. }
  991. function triggerRefValue(ref, newVal) {
  992. ref = toRaw(ref);
  993. if (ref.dep) {
  994. if ((process.env.NODE_ENV !== 'production')) {
  995. triggerEffects(ref.dep, {
  996. target: ref,
  997. type: "set" /* TriggerOpTypes.SET */,
  998. key: 'value',
  999. newValue: newVal
  1000. });
  1001. }
  1002. else {
  1003. triggerEffects(ref.dep);
  1004. }
  1005. }
  1006. }
  1007. function isRef(r) {
  1008. return !!(r && r.__v_isRef === true);
  1009. }
  1010. function ref(value) {
  1011. return createRef(value, false);
  1012. }
  1013. function shallowRef(value) {
  1014. return createRef(value, true);
  1015. }
  1016. function createRef(rawValue, shallow) {
  1017. if (isRef(rawValue)) {
  1018. return rawValue;
  1019. }
  1020. return new RefImpl(rawValue, shallow);
  1021. }
  1022. class RefImpl {
  1023. constructor(value, __v_isShallow) {
  1024. this.__v_isShallow = __v_isShallow;
  1025. this.dep = undefined;
  1026. this.__v_isRef = true;
  1027. this._rawValue = __v_isShallow ? value : toRaw(value);
  1028. this._value = __v_isShallow ? value : toReactive(value);
  1029. }
  1030. get value() {
  1031. trackRefValue(this);
  1032. return this._value;
  1033. }
  1034. set value(newVal) {
  1035. const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
  1036. newVal = useDirectValue ? newVal : toRaw(newVal);
  1037. if (hasChanged(newVal, this._rawValue)) {
  1038. this._rawValue = newVal;
  1039. this._value = useDirectValue ? newVal : toReactive(newVal);
  1040. triggerRefValue(this, newVal);
  1041. }
  1042. }
  1043. }
  1044. function triggerRef(ref) {
  1045. triggerRefValue(ref, (process.env.NODE_ENV !== 'production') ? ref.value : void 0);
  1046. }
  1047. function unref(ref) {
  1048. return isRef(ref) ? ref.value : ref;
  1049. }
  1050. const shallowUnwrapHandlers = {
  1051. get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
  1052. set: (target, key, value, receiver) => {
  1053. const oldValue = target[key];
  1054. if (isRef(oldValue) && !isRef(value)) {
  1055. oldValue.value = value;
  1056. return true;
  1057. }
  1058. else {
  1059. return Reflect.set(target, key, value, receiver);
  1060. }
  1061. }
  1062. };
  1063. function proxyRefs(objectWithRefs) {
  1064. return isReactive(objectWithRefs)
  1065. ? objectWithRefs
  1066. : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1067. }
  1068. class CustomRefImpl {
  1069. constructor(factory) {
  1070. this.dep = undefined;
  1071. this.__v_isRef = true;
  1072. const { get, set } = factory(() => trackRefValue(this), () => triggerRefValue(this));
  1073. this._get = get;
  1074. this._set = set;
  1075. }
  1076. get value() {
  1077. return this._get();
  1078. }
  1079. set value(newVal) {
  1080. this._set(newVal);
  1081. }
  1082. }
  1083. function customRef(factory) {
  1084. return new CustomRefImpl(factory);
  1085. }
  1086. function toRefs(object) {
  1087. if ((process.env.NODE_ENV !== 'production') && !isProxy(object)) {
  1088. console.warn(`toRefs() expects a reactive object but received a plain one.`);
  1089. }
  1090. const ret = isArray(object) ? new Array(object.length) : {};
  1091. for (const key in object) {
  1092. ret[key] = toRef(object, key);
  1093. }
  1094. return ret;
  1095. }
  1096. class ObjectRefImpl {
  1097. constructor(_object, _key, _defaultValue) {
  1098. this._object = _object;
  1099. this._key = _key;
  1100. this._defaultValue = _defaultValue;
  1101. this.__v_isRef = true;
  1102. }
  1103. get value() {
  1104. const val = this._object[this._key];
  1105. return val === undefined ? this._defaultValue : val;
  1106. }
  1107. set value(newVal) {
  1108. this._object[this._key] = newVal;
  1109. }
  1110. }
  1111. function toRef(object, key, defaultValue) {
  1112. const val = object[key];
  1113. return isRef(val)
  1114. ? val
  1115. : new ObjectRefImpl(object, key, defaultValue);
  1116. }
  1117. var _a;
  1118. class ComputedRefImpl {
  1119. constructor(getter, _setter, isReadonly, isSSR) {
  1120. this._setter = _setter;
  1121. this.dep = undefined;
  1122. this.__v_isRef = true;
  1123. this[_a] = false;
  1124. this._dirty = true;
  1125. this.effect = new ReactiveEffect(getter, () => {
  1126. if (!this._dirty) {
  1127. this._dirty = true;
  1128. triggerRefValue(this);
  1129. }
  1130. });
  1131. this.effect.computed = this;
  1132. this.effect.active = this._cacheable = !isSSR;
  1133. this["__v_isReadonly" /* ReactiveFlags.IS_READONLY */] = isReadonly;
  1134. }
  1135. get value() {
  1136. // the computed ref may get wrapped by other proxies e.g. readonly() #3376
  1137. const self = toRaw(this);
  1138. trackRefValue(self);
  1139. if (self._dirty || !self._cacheable) {
  1140. self._dirty = false;
  1141. self._value = self.effect.run();
  1142. }
  1143. return self._value;
  1144. }
  1145. set value(newValue) {
  1146. this._setter(newValue);
  1147. }
  1148. }
  1149. _a = "__v_isReadonly" /* ReactiveFlags.IS_READONLY */;
  1150. function computed(getterOrOptions, debugOptions, isSSR = false) {
  1151. let getter;
  1152. let setter;
  1153. const onlyGetter = isFunction(getterOrOptions);
  1154. if (onlyGetter) {
  1155. getter = getterOrOptions;
  1156. setter = (process.env.NODE_ENV !== 'production')
  1157. ? () => {
  1158. console.warn('Write operation failed: computed value is readonly');
  1159. }
  1160. : NOOP;
  1161. }
  1162. else {
  1163. getter = getterOrOptions.get;
  1164. setter = getterOrOptions.set;
  1165. }
  1166. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  1167. if ((process.env.NODE_ENV !== 'production') && debugOptions && !isSSR) {
  1168. cRef.effect.onTrack = debugOptions.onTrack;
  1169. cRef.effect.onTrigger = debugOptions.onTrigger;
  1170. }
  1171. return cRef;
  1172. }
  1173. var _a$1;
  1174. const tick = /*#__PURE__*/ Promise.resolve();
  1175. const queue = [];
  1176. let queued = false;
  1177. const scheduler = (fn) => {
  1178. queue.push(fn);
  1179. if (!queued) {
  1180. queued = true;
  1181. tick.then(flush);
  1182. }
  1183. };
  1184. const flush = () => {
  1185. for (let i = 0; i < queue.length; i++) {
  1186. queue[i]();
  1187. }
  1188. queue.length = 0;
  1189. queued = false;
  1190. };
  1191. class DeferredComputedRefImpl {
  1192. constructor(getter) {
  1193. this.dep = undefined;
  1194. this._dirty = true;
  1195. this.__v_isRef = true;
  1196. this[_a$1] = true;
  1197. let compareTarget;
  1198. let hasCompareTarget = false;
  1199. let scheduled = false;
  1200. this.effect = new ReactiveEffect(getter, (computedTrigger) => {
  1201. if (this.dep) {
  1202. if (computedTrigger) {
  1203. compareTarget = this._value;
  1204. hasCompareTarget = true;
  1205. }
  1206. else if (!scheduled) {
  1207. const valueToCompare = hasCompareTarget ? compareTarget : this._value;
  1208. scheduled = true;
  1209. hasCompareTarget = false;
  1210. scheduler(() => {
  1211. if (this.effect.active && this._get() !== valueToCompare) {
  1212. triggerRefValue(this);
  1213. }
  1214. scheduled = false;
  1215. });
  1216. }
  1217. // chained upstream computeds are notified synchronously to ensure
  1218. // value invalidation in case of sync access; normal effects are
  1219. // deferred to be triggered in scheduler.
  1220. for (const e of this.dep) {
  1221. if (e.computed instanceof DeferredComputedRefImpl) {
  1222. e.scheduler(true /* computedTrigger */);
  1223. }
  1224. }
  1225. }
  1226. this._dirty = true;
  1227. });
  1228. this.effect.computed = this;
  1229. }
  1230. _get() {
  1231. if (this._dirty) {
  1232. this._dirty = false;
  1233. return (this._value = this.effect.run());
  1234. }
  1235. return this._value;
  1236. }
  1237. get value() {
  1238. trackRefValue(this);
  1239. // the computed ref may get wrapped by other proxies e.g. readonly() #3376
  1240. return toRaw(this)._get();
  1241. }
  1242. }
  1243. _a$1 = "__v_isReadonly" /* ReactiveFlags.IS_READONLY */;
  1244. function deferredComputed(getter) {
  1245. return new DeferredComputedRefImpl(getter);
  1246. }
  1247. export { EffectScope, ITERATE_KEY, ReactiveEffect, computed, customRef, deferredComputed, effect, effectScope, enableTracking, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, pauseTracking, proxyRefs, reactive, readonly, ref, resetTracking, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, track, trigger, triggerRef, unref };