reactivity.cjs.js 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044
  1. /**
  2. * @vue/reactivity v3.5.33
  3. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  4. * @license MIT
  5. **/
  6. 'use strict';
  7. Object.defineProperty(exports, '__esModule', { value: true });
  8. var shared = require('@vue/shared');
  9. function warn(msg, ...args) {
  10. console.warn(`[Vue warn] ${msg}`, ...args);
  11. }
  12. let activeEffectScope;
  13. class EffectScope {
  14. // TODO isolatedDeclarations "__v_skip"
  15. constructor(detached = false) {
  16. this.detached = detached;
  17. /**
  18. * @internal
  19. */
  20. this._active = true;
  21. /**
  22. * @internal track `on` calls, allow `on` call multiple times
  23. */
  24. this._on = 0;
  25. /**
  26. * @internal
  27. */
  28. this.effects = [];
  29. /**
  30. * @internal
  31. */
  32. this.cleanups = [];
  33. this._isPaused = false;
  34. this.__v_skip = true;
  35. this.parent = activeEffectScope;
  36. if (!detached && activeEffectScope) {
  37. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  38. this
  39. ) - 1;
  40. }
  41. }
  42. get active() {
  43. return this._active;
  44. }
  45. pause() {
  46. if (this._active) {
  47. this._isPaused = true;
  48. let i, l;
  49. if (this.scopes) {
  50. for (i = 0, l = this.scopes.length; i < l; i++) {
  51. this.scopes[i].pause();
  52. }
  53. }
  54. for (i = 0, l = this.effects.length; i < l; i++) {
  55. this.effects[i].pause();
  56. }
  57. }
  58. }
  59. /**
  60. * Resumes the effect scope, including all child scopes and effects.
  61. */
  62. resume() {
  63. if (this._active) {
  64. if (this._isPaused) {
  65. this._isPaused = false;
  66. let i, l;
  67. if (this.scopes) {
  68. for (i = 0, l = this.scopes.length; i < l; i++) {
  69. this.scopes[i].resume();
  70. }
  71. }
  72. for (i = 0, l = this.effects.length; i < l; i++) {
  73. this.effects[i].resume();
  74. }
  75. }
  76. }
  77. }
  78. run(fn) {
  79. if (this._active) {
  80. const currentEffectScope = activeEffectScope;
  81. try {
  82. activeEffectScope = this;
  83. return fn();
  84. } finally {
  85. activeEffectScope = currentEffectScope;
  86. }
  87. } else {
  88. warn(`cannot run an inactive effect scope.`);
  89. }
  90. }
  91. /**
  92. * This should only be called on non-detached scopes
  93. * @internal
  94. */
  95. on() {
  96. if (++this._on === 1) {
  97. this.prevScope = activeEffectScope;
  98. activeEffectScope = this;
  99. }
  100. }
  101. /**
  102. * This should only be called on non-detached scopes
  103. * @internal
  104. */
  105. off() {
  106. if (this._on > 0 && --this._on === 0) {
  107. if (activeEffectScope === this) {
  108. activeEffectScope = this.prevScope;
  109. } else {
  110. let current = activeEffectScope;
  111. while (current) {
  112. if (current.prevScope === this) {
  113. current.prevScope = this.prevScope;
  114. break;
  115. }
  116. current = current.prevScope;
  117. }
  118. }
  119. this.prevScope = void 0;
  120. }
  121. }
  122. stop(fromParent) {
  123. if (this._active) {
  124. this._active = false;
  125. let i, l;
  126. for (i = 0, l = this.effects.length; i < l; i++) {
  127. this.effects[i].stop();
  128. }
  129. this.effects.length = 0;
  130. for (i = 0, l = this.cleanups.length; i < l; i++) {
  131. this.cleanups[i]();
  132. }
  133. this.cleanups.length = 0;
  134. if (this.scopes) {
  135. for (i = 0, l = this.scopes.length; i < l; i++) {
  136. this.scopes[i].stop(true);
  137. }
  138. this.scopes.length = 0;
  139. }
  140. if (!this.detached && this.parent && !fromParent) {
  141. const last = this.parent.scopes.pop();
  142. if (last && last !== this) {
  143. this.parent.scopes[this.index] = last;
  144. last.index = this.index;
  145. }
  146. }
  147. this.parent = void 0;
  148. }
  149. }
  150. }
  151. function effectScope(detached) {
  152. return new EffectScope(detached);
  153. }
  154. function getCurrentScope() {
  155. return activeEffectScope;
  156. }
  157. function onScopeDispose(fn, failSilently = false) {
  158. if (activeEffectScope) {
  159. activeEffectScope.cleanups.push(fn);
  160. } else if (!failSilently) {
  161. warn(
  162. `onScopeDispose() is called when there is no active effect scope to be associated with.`
  163. );
  164. }
  165. }
  166. let activeSub;
  167. const EffectFlags = {
  168. "ACTIVE": 1,
  169. "1": "ACTIVE",
  170. "RUNNING": 2,
  171. "2": "RUNNING",
  172. "TRACKING": 4,
  173. "4": "TRACKING",
  174. "NOTIFIED": 8,
  175. "8": "NOTIFIED",
  176. "DIRTY": 16,
  177. "16": "DIRTY",
  178. "ALLOW_RECURSE": 32,
  179. "32": "ALLOW_RECURSE",
  180. "PAUSED": 64,
  181. "64": "PAUSED",
  182. "EVALUATED": 128,
  183. "128": "EVALUATED"
  184. };
  185. const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
  186. class ReactiveEffect {
  187. constructor(fn) {
  188. this.fn = fn;
  189. /**
  190. * @internal
  191. */
  192. this.deps = void 0;
  193. /**
  194. * @internal
  195. */
  196. this.depsTail = void 0;
  197. /**
  198. * @internal
  199. */
  200. this.flags = 1 | 4;
  201. /**
  202. * @internal
  203. */
  204. this.next = void 0;
  205. /**
  206. * @internal
  207. */
  208. this.cleanup = void 0;
  209. this.scheduler = void 0;
  210. if (activeEffectScope && activeEffectScope.active) {
  211. activeEffectScope.effects.push(this);
  212. }
  213. }
  214. pause() {
  215. this.flags |= 64;
  216. }
  217. resume() {
  218. if (this.flags & 64) {
  219. this.flags &= -65;
  220. if (pausedQueueEffects.has(this)) {
  221. pausedQueueEffects.delete(this);
  222. this.trigger();
  223. }
  224. }
  225. }
  226. /**
  227. * @internal
  228. */
  229. notify() {
  230. if (this.flags & 2 && !(this.flags & 32)) {
  231. return;
  232. }
  233. if (!(this.flags & 8)) {
  234. batch(this);
  235. }
  236. }
  237. run() {
  238. if (!(this.flags & 1)) {
  239. return this.fn();
  240. }
  241. this.flags |= 2;
  242. cleanupEffect(this);
  243. prepareDeps(this);
  244. const prevEffect = activeSub;
  245. const prevShouldTrack = shouldTrack;
  246. activeSub = this;
  247. shouldTrack = true;
  248. try {
  249. return this.fn();
  250. } finally {
  251. if (activeSub !== this) {
  252. warn(
  253. "Active effect was not restored correctly - this is likely a Vue internal bug."
  254. );
  255. }
  256. cleanupDeps(this);
  257. activeSub = prevEffect;
  258. shouldTrack = prevShouldTrack;
  259. this.flags &= -3;
  260. }
  261. }
  262. stop() {
  263. if (this.flags & 1) {
  264. for (let link = this.deps; link; link = link.nextDep) {
  265. removeSub(link);
  266. }
  267. this.deps = this.depsTail = void 0;
  268. cleanupEffect(this);
  269. this.onStop && this.onStop();
  270. this.flags &= -2;
  271. }
  272. }
  273. trigger() {
  274. if (this.flags & 64) {
  275. pausedQueueEffects.add(this);
  276. } else if (this.scheduler) {
  277. this.scheduler();
  278. } else {
  279. this.runIfDirty();
  280. }
  281. }
  282. /**
  283. * @internal
  284. */
  285. runIfDirty() {
  286. if (isDirty(this)) {
  287. this.run();
  288. }
  289. }
  290. get dirty() {
  291. return isDirty(this);
  292. }
  293. }
  294. let batchDepth = 0;
  295. let batchedSub;
  296. let batchedComputed;
  297. function batch(sub, isComputed = false) {
  298. sub.flags |= 8;
  299. if (isComputed) {
  300. sub.next = batchedComputed;
  301. batchedComputed = sub;
  302. return;
  303. }
  304. sub.next = batchedSub;
  305. batchedSub = sub;
  306. }
  307. function startBatch() {
  308. batchDepth++;
  309. }
  310. function endBatch() {
  311. if (--batchDepth > 0) {
  312. return;
  313. }
  314. if (batchedComputed) {
  315. let e = batchedComputed;
  316. batchedComputed = void 0;
  317. while (e) {
  318. const next = e.next;
  319. e.next = void 0;
  320. e.flags &= -9;
  321. e = next;
  322. }
  323. }
  324. let error;
  325. while (batchedSub) {
  326. let e = batchedSub;
  327. batchedSub = void 0;
  328. while (e) {
  329. const next = e.next;
  330. e.next = void 0;
  331. e.flags &= -9;
  332. if (e.flags & 1) {
  333. try {
  334. ;
  335. e.trigger();
  336. } catch (err) {
  337. if (!error) error = err;
  338. }
  339. }
  340. e = next;
  341. }
  342. }
  343. if (error) throw error;
  344. }
  345. function prepareDeps(sub) {
  346. for (let link = sub.deps; link; link = link.nextDep) {
  347. link.version = -1;
  348. link.prevActiveLink = link.dep.activeLink;
  349. link.dep.activeLink = link;
  350. }
  351. }
  352. function cleanupDeps(sub) {
  353. let head;
  354. let tail = sub.depsTail;
  355. let link = tail;
  356. while (link) {
  357. const prev = link.prevDep;
  358. if (link.version === -1) {
  359. if (link === tail) tail = prev;
  360. removeSub(link);
  361. removeDep(link);
  362. } else {
  363. head = link;
  364. }
  365. link.dep.activeLink = link.prevActiveLink;
  366. link.prevActiveLink = void 0;
  367. link = prev;
  368. }
  369. sub.deps = head;
  370. sub.depsTail = tail;
  371. }
  372. function isDirty(sub) {
  373. for (let link = sub.deps; link; link = link.nextDep) {
  374. if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
  375. return true;
  376. }
  377. }
  378. if (sub._dirty) {
  379. return true;
  380. }
  381. return false;
  382. }
  383. function refreshComputed(computed) {
  384. if (computed.flags & 4 && !(computed.flags & 16)) {
  385. return;
  386. }
  387. computed.flags &= -17;
  388. if (computed.globalVersion === globalVersion) {
  389. return;
  390. }
  391. computed.globalVersion = globalVersion;
  392. if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
  393. return;
  394. }
  395. computed.flags |= 2;
  396. const dep = computed.dep;
  397. const prevSub = activeSub;
  398. const prevShouldTrack = shouldTrack;
  399. activeSub = computed;
  400. shouldTrack = true;
  401. try {
  402. prepareDeps(computed);
  403. const value = computed.fn(computed._value);
  404. if (dep.version === 0 || shared.hasChanged(value, computed._value)) {
  405. computed.flags |= 128;
  406. computed._value = value;
  407. dep.version++;
  408. }
  409. } catch (err) {
  410. dep.version++;
  411. throw err;
  412. } finally {
  413. activeSub = prevSub;
  414. shouldTrack = prevShouldTrack;
  415. cleanupDeps(computed);
  416. computed.flags &= -3;
  417. }
  418. }
  419. function removeSub(link, soft = false) {
  420. const { dep, prevSub, nextSub } = link;
  421. if (prevSub) {
  422. prevSub.nextSub = nextSub;
  423. link.prevSub = void 0;
  424. }
  425. if (nextSub) {
  426. nextSub.prevSub = prevSub;
  427. link.nextSub = void 0;
  428. }
  429. if (dep.subsHead === link) {
  430. dep.subsHead = nextSub;
  431. }
  432. if (dep.subs === link) {
  433. dep.subs = prevSub;
  434. if (!prevSub && dep.computed) {
  435. dep.computed.flags &= -5;
  436. for (let l = dep.computed.deps; l; l = l.nextDep) {
  437. removeSub(l, true);
  438. }
  439. }
  440. }
  441. if (!soft && !--dep.sc && dep.map) {
  442. dep.map.delete(dep.key);
  443. }
  444. }
  445. function removeDep(link) {
  446. const { prevDep, nextDep } = link;
  447. if (prevDep) {
  448. prevDep.nextDep = nextDep;
  449. link.prevDep = void 0;
  450. }
  451. if (nextDep) {
  452. nextDep.prevDep = prevDep;
  453. link.nextDep = void 0;
  454. }
  455. }
  456. function effect(fn, options) {
  457. if (fn.effect instanceof ReactiveEffect) {
  458. fn = fn.effect.fn;
  459. }
  460. const e = new ReactiveEffect(fn);
  461. if (options) {
  462. shared.extend(e, options);
  463. }
  464. try {
  465. e.run();
  466. } catch (err) {
  467. e.stop();
  468. throw err;
  469. }
  470. const runner = e.run.bind(e);
  471. runner.effect = e;
  472. return runner;
  473. }
  474. function stop(runner) {
  475. runner.effect.stop();
  476. }
  477. let shouldTrack = true;
  478. const trackStack = [];
  479. function pauseTracking() {
  480. trackStack.push(shouldTrack);
  481. shouldTrack = false;
  482. }
  483. function enableTracking() {
  484. trackStack.push(shouldTrack);
  485. shouldTrack = true;
  486. }
  487. function resetTracking() {
  488. const last = trackStack.pop();
  489. shouldTrack = last === void 0 ? true : last;
  490. }
  491. function onEffectCleanup(fn, failSilently = false) {
  492. if (activeSub instanceof ReactiveEffect) {
  493. activeSub.cleanup = fn;
  494. } else if (!failSilently) {
  495. warn(
  496. `onEffectCleanup() was called when there was no active effect to associate with.`
  497. );
  498. }
  499. }
  500. function cleanupEffect(e) {
  501. const { cleanup } = e;
  502. e.cleanup = void 0;
  503. if (cleanup) {
  504. const prevSub = activeSub;
  505. activeSub = void 0;
  506. try {
  507. cleanup();
  508. } finally {
  509. activeSub = prevSub;
  510. }
  511. }
  512. }
  513. let globalVersion = 0;
  514. class Link {
  515. constructor(sub, dep) {
  516. this.sub = sub;
  517. this.dep = dep;
  518. this.version = dep.version;
  519. this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
  520. }
  521. }
  522. class Dep {
  523. // TODO isolatedDeclarations "__v_skip"
  524. constructor(computed) {
  525. this.computed = computed;
  526. this.version = 0;
  527. /**
  528. * Link between this dep and the current active effect
  529. */
  530. this.activeLink = void 0;
  531. /**
  532. * Doubly linked list representing the subscribing effects (tail)
  533. */
  534. this.subs = void 0;
  535. /**
  536. * For object property deps cleanup
  537. */
  538. this.map = void 0;
  539. this.key = void 0;
  540. /**
  541. * Subscriber counter
  542. */
  543. this.sc = 0;
  544. /**
  545. * @internal
  546. */
  547. this.__v_skip = true;
  548. {
  549. this.subsHead = void 0;
  550. }
  551. }
  552. track(debugInfo) {
  553. if (!activeSub || !shouldTrack || activeSub === this.computed) {
  554. return;
  555. }
  556. let link = this.activeLink;
  557. if (link === void 0 || link.sub !== activeSub) {
  558. link = this.activeLink = new Link(activeSub, this);
  559. if (!activeSub.deps) {
  560. activeSub.deps = activeSub.depsTail = link;
  561. } else {
  562. link.prevDep = activeSub.depsTail;
  563. activeSub.depsTail.nextDep = link;
  564. activeSub.depsTail = link;
  565. }
  566. addSub(link);
  567. } else if (link.version === -1) {
  568. link.version = this.version;
  569. if (link.nextDep) {
  570. const next = link.nextDep;
  571. next.prevDep = link.prevDep;
  572. if (link.prevDep) {
  573. link.prevDep.nextDep = next;
  574. }
  575. link.prevDep = activeSub.depsTail;
  576. link.nextDep = void 0;
  577. activeSub.depsTail.nextDep = link;
  578. activeSub.depsTail = link;
  579. if (activeSub.deps === link) {
  580. activeSub.deps = next;
  581. }
  582. }
  583. }
  584. if (activeSub.onTrack) {
  585. activeSub.onTrack(
  586. shared.extend(
  587. {
  588. effect: activeSub
  589. },
  590. debugInfo
  591. )
  592. );
  593. }
  594. return link;
  595. }
  596. trigger(debugInfo) {
  597. this.version++;
  598. globalVersion++;
  599. this.notify(debugInfo);
  600. }
  601. notify(debugInfo) {
  602. startBatch();
  603. try {
  604. if (true) {
  605. for (let head = this.subsHead; head; head = head.nextSub) {
  606. if (head.sub.onTrigger && !(head.sub.flags & 8)) {
  607. head.sub.onTrigger(
  608. shared.extend(
  609. {
  610. effect: head.sub
  611. },
  612. debugInfo
  613. )
  614. );
  615. }
  616. }
  617. }
  618. for (let link = this.subs; link; link = link.prevSub) {
  619. if (link.sub.notify()) {
  620. ;
  621. link.sub.dep.notify();
  622. }
  623. }
  624. } finally {
  625. endBatch();
  626. }
  627. }
  628. }
  629. function addSub(link) {
  630. link.dep.sc++;
  631. if (link.sub.flags & 4) {
  632. const computed = link.dep.computed;
  633. if (computed && !link.dep.subs) {
  634. computed.flags |= 4 | 16;
  635. for (let l = computed.deps; l; l = l.nextDep) {
  636. addSub(l);
  637. }
  638. }
  639. const currentTail = link.dep.subs;
  640. if (currentTail !== link) {
  641. link.prevSub = currentTail;
  642. if (currentTail) currentTail.nextSub = link;
  643. }
  644. if (link.dep.subsHead === void 0) {
  645. link.dep.subsHead = link;
  646. }
  647. link.dep.subs = link;
  648. }
  649. }
  650. const targetMap = /* @__PURE__ */ new WeakMap();
  651. const ITERATE_KEY = /* @__PURE__ */ Symbol(
  652. "Object iterate"
  653. );
  654. const MAP_KEY_ITERATE_KEY = /* @__PURE__ */ Symbol(
  655. "Map keys iterate"
  656. );
  657. const ARRAY_ITERATE_KEY = /* @__PURE__ */ Symbol(
  658. "Array iterate"
  659. );
  660. function track(target, type, key) {
  661. if (shouldTrack && activeSub) {
  662. let depsMap = targetMap.get(target);
  663. if (!depsMap) {
  664. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  665. }
  666. let dep = depsMap.get(key);
  667. if (!dep) {
  668. depsMap.set(key, dep = new Dep());
  669. dep.map = depsMap;
  670. dep.key = key;
  671. }
  672. {
  673. dep.track({
  674. target,
  675. type,
  676. key
  677. });
  678. }
  679. }
  680. }
  681. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  682. const depsMap = targetMap.get(target);
  683. if (!depsMap) {
  684. globalVersion++;
  685. return;
  686. }
  687. const run = (dep) => {
  688. if (dep) {
  689. {
  690. dep.trigger({
  691. target,
  692. type,
  693. key,
  694. newValue,
  695. oldValue,
  696. oldTarget
  697. });
  698. }
  699. }
  700. };
  701. startBatch();
  702. if (type === "clear") {
  703. depsMap.forEach(run);
  704. } else {
  705. const targetIsArray = shared.isArray(target);
  706. const isArrayIndex = targetIsArray && shared.isIntegerKey(key);
  707. if (targetIsArray && key === "length") {
  708. const newLength = Number(newValue);
  709. depsMap.forEach((dep, key2) => {
  710. if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !shared.isSymbol(key2) && key2 >= newLength) {
  711. run(dep);
  712. }
  713. });
  714. } else {
  715. if (key !== void 0 || depsMap.has(void 0)) {
  716. run(depsMap.get(key));
  717. }
  718. if (isArrayIndex) {
  719. run(depsMap.get(ARRAY_ITERATE_KEY));
  720. }
  721. switch (type) {
  722. case "add":
  723. if (!targetIsArray) {
  724. run(depsMap.get(ITERATE_KEY));
  725. if (shared.isMap(target)) {
  726. run(depsMap.get(MAP_KEY_ITERATE_KEY));
  727. }
  728. } else if (isArrayIndex) {
  729. run(depsMap.get("length"));
  730. }
  731. break;
  732. case "delete":
  733. if (!targetIsArray) {
  734. run(depsMap.get(ITERATE_KEY));
  735. if (shared.isMap(target)) {
  736. run(depsMap.get(MAP_KEY_ITERATE_KEY));
  737. }
  738. }
  739. break;
  740. case "set":
  741. if (shared.isMap(target)) {
  742. run(depsMap.get(ITERATE_KEY));
  743. }
  744. break;
  745. }
  746. }
  747. }
  748. endBatch();
  749. }
  750. function getDepFromReactive(object, key) {
  751. const depMap = targetMap.get(object);
  752. return depMap && depMap.get(key);
  753. }
  754. function reactiveReadArray(array) {
  755. const raw = toRaw(array);
  756. if (raw === array) return raw;
  757. track(raw, "iterate", ARRAY_ITERATE_KEY);
  758. return isShallow(array) ? raw : raw.map(toReactive);
  759. }
  760. function shallowReadArray(arr) {
  761. track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
  762. return arr;
  763. }
  764. function toWrapped(target, item) {
  765. if (isReadonly(target)) {
  766. return isReactive(target) ? toReadonly(toReactive(item)) : toReadonly(item);
  767. }
  768. return toReactive(item);
  769. }
  770. const arrayInstrumentations = {
  771. __proto__: null,
  772. [Symbol.iterator]() {
  773. return iterator(this, Symbol.iterator, (item) => toWrapped(this, item));
  774. },
  775. concat(...args) {
  776. return reactiveReadArray(this).concat(
  777. ...args.map((x) => shared.isArray(x) ? reactiveReadArray(x) : x)
  778. );
  779. },
  780. entries() {
  781. return iterator(this, "entries", (value) => {
  782. value[1] = toWrapped(this, value[1]);
  783. return value;
  784. });
  785. },
  786. every(fn, thisArg) {
  787. return apply(this, "every", fn, thisArg, void 0, arguments);
  788. },
  789. filter(fn, thisArg) {
  790. return apply(
  791. this,
  792. "filter",
  793. fn,
  794. thisArg,
  795. (v) => v.map((item) => toWrapped(this, item)),
  796. arguments
  797. );
  798. },
  799. find(fn, thisArg) {
  800. return apply(
  801. this,
  802. "find",
  803. fn,
  804. thisArg,
  805. (item) => toWrapped(this, item),
  806. arguments
  807. );
  808. },
  809. findIndex(fn, thisArg) {
  810. return apply(this, "findIndex", fn, thisArg, void 0, arguments);
  811. },
  812. findLast(fn, thisArg) {
  813. return apply(
  814. this,
  815. "findLast",
  816. fn,
  817. thisArg,
  818. (item) => toWrapped(this, item),
  819. arguments
  820. );
  821. },
  822. findLastIndex(fn, thisArg) {
  823. return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
  824. },
  825. // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
  826. forEach(fn, thisArg) {
  827. return apply(this, "forEach", fn, thisArg, void 0, arguments);
  828. },
  829. includes(...args) {
  830. return searchProxy(this, "includes", args);
  831. },
  832. indexOf(...args) {
  833. return searchProxy(this, "indexOf", args);
  834. },
  835. join(separator) {
  836. return reactiveReadArray(this).join(separator);
  837. },
  838. // keys() iterator only reads `length`, no optimization required
  839. lastIndexOf(...args) {
  840. return searchProxy(this, "lastIndexOf", args);
  841. },
  842. map(fn, thisArg) {
  843. return apply(this, "map", fn, thisArg, void 0, arguments);
  844. },
  845. pop() {
  846. return noTracking(this, "pop");
  847. },
  848. push(...args) {
  849. return noTracking(this, "push", args);
  850. },
  851. reduce(fn, ...args) {
  852. return reduce(this, "reduce", fn, args);
  853. },
  854. reduceRight(fn, ...args) {
  855. return reduce(this, "reduceRight", fn, args);
  856. },
  857. shift() {
  858. return noTracking(this, "shift");
  859. },
  860. // slice could use ARRAY_ITERATE but also seems to beg for range tracking
  861. some(fn, thisArg) {
  862. return apply(this, "some", fn, thisArg, void 0, arguments);
  863. },
  864. splice(...args) {
  865. return noTracking(this, "splice", args);
  866. },
  867. toReversed() {
  868. return reactiveReadArray(this).toReversed();
  869. },
  870. toSorted(comparer) {
  871. return reactiveReadArray(this).toSorted(comparer);
  872. },
  873. toSpliced(...args) {
  874. return reactiveReadArray(this).toSpliced(...args);
  875. },
  876. unshift(...args) {
  877. return noTracking(this, "unshift", args);
  878. },
  879. values() {
  880. return iterator(this, "values", (item) => toWrapped(this, item));
  881. }
  882. };
  883. function iterator(self, method, wrapValue) {
  884. const arr = shallowReadArray(self);
  885. const iter = arr[method]();
  886. if (arr !== self && !isShallow(self)) {
  887. iter._next = iter.next;
  888. iter.next = () => {
  889. const result = iter._next();
  890. if (!result.done) {
  891. result.value = wrapValue(result.value);
  892. }
  893. return result;
  894. };
  895. }
  896. return iter;
  897. }
  898. const arrayProto = Array.prototype;
  899. function apply(self, method, fn, thisArg, wrappedRetFn, args) {
  900. const arr = shallowReadArray(self);
  901. const needsWrap = arr !== self && !isShallow(self);
  902. const methodFn = arr[method];
  903. if (methodFn !== arrayProto[method]) {
  904. const result2 = methodFn.apply(self, args);
  905. return needsWrap ? toReactive(result2) : result2;
  906. }
  907. let wrappedFn = fn;
  908. if (arr !== self) {
  909. if (needsWrap) {
  910. wrappedFn = function(item, index) {
  911. return fn.call(this, toWrapped(self, item), index, self);
  912. };
  913. } else if (fn.length > 2) {
  914. wrappedFn = function(item, index) {
  915. return fn.call(this, item, index, self);
  916. };
  917. }
  918. }
  919. const result = methodFn.call(arr, wrappedFn, thisArg);
  920. return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
  921. }
  922. function reduce(self, method, fn, args) {
  923. const arr = shallowReadArray(self);
  924. const needsWrap = arr !== self && !isShallow(self);
  925. let wrappedFn = fn;
  926. let wrapInitialAccumulator = false;
  927. if (arr !== self) {
  928. if (needsWrap) {
  929. wrapInitialAccumulator = args.length === 0;
  930. wrappedFn = function(acc, item, index) {
  931. if (wrapInitialAccumulator) {
  932. wrapInitialAccumulator = false;
  933. acc = toWrapped(self, acc);
  934. }
  935. return fn.call(this, acc, toWrapped(self, item), index, self);
  936. };
  937. } else if (fn.length > 3) {
  938. wrappedFn = function(acc, item, index) {
  939. return fn.call(this, acc, item, index, self);
  940. };
  941. }
  942. }
  943. const result = arr[method](wrappedFn, ...args);
  944. return wrapInitialAccumulator ? toWrapped(self, result) : result;
  945. }
  946. function searchProxy(self, method, args) {
  947. const arr = toRaw(self);
  948. track(arr, "iterate", ARRAY_ITERATE_KEY);
  949. const res = arr[method](...args);
  950. if ((res === -1 || res === false) && isProxy(args[0])) {
  951. args[0] = toRaw(args[0]);
  952. return arr[method](...args);
  953. }
  954. return res;
  955. }
  956. function noTracking(self, method, args = []) {
  957. pauseTracking();
  958. startBatch();
  959. const res = toRaw(self)[method].apply(self, args);
  960. endBatch();
  961. resetTracking();
  962. return res;
  963. }
  964. const isNonTrackableKeys = /* @__PURE__ */ shared.makeMap(`__proto__,__v_isRef,__isVue`);
  965. const builtInSymbols = new Set(
  966. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(shared.isSymbol)
  967. );
  968. function hasOwnProperty(key) {
  969. if (!shared.isSymbol(key)) key = String(key);
  970. const obj = toRaw(this);
  971. track(obj, "has", key);
  972. return obj.hasOwnProperty(key);
  973. }
  974. class BaseReactiveHandler {
  975. constructor(_isReadonly = false, _isShallow = false) {
  976. this._isReadonly = _isReadonly;
  977. this._isShallow = _isShallow;
  978. }
  979. get(target, key, receiver) {
  980. if (key === "__v_skip") return target["__v_skip"];
  981. const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
  982. if (key === "__v_isReactive") {
  983. return !isReadonly2;
  984. } else if (key === "__v_isReadonly") {
  985. return isReadonly2;
  986. } else if (key === "__v_isShallow") {
  987. return isShallow2;
  988. } else if (key === "__v_raw") {
  989. if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
  990. // this means the receiver is a user proxy of the reactive proxy
  991. Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
  992. return target;
  993. }
  994. return;
  995. }
  996. const targetIsArray = shared.isArray(target);
  997. if (!isReadonly2) {
  998. let fn;
  999. if (targetIsArray && (fn = arrayInstrumentations[key])) {
  1000. return fn;
  1001. }
  1002. if (key === "hasOwnProperty") {
  1003. return hasOwnProperty;
  1004. }
  1005. }
  1006. const res = Reflect.get(
  1007. target,
  1008. key,
  1009. // if this is a proxy wrapping a ref, return methods using the raw ref
  1010. // as receiver so that we don't have to call `toRaw` on the ref in all
  1011. // its class methods
  1012. isRef(target) ? target : receiver
  1013. );
  1014. if (shared.isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  1015. return res;
  1016. }
  1017. if (!isReadonly2) {
  1018. track(target, "get", key);
  1019. }
  1020. if (isShallow2) {
  1021. return res;
  1022. }
  1023. if (isRef(res)) {
  1024. const value = targetIsArray && shared.isIntegerKey(key) ? res : res.value;
  1025. return isReadonly2 && shared.isObject(value) ? readonly(value) : value;
  1026. }
  1027. if (shared.isObject(res)) {
  1028. return isReadonly2 ? readonly(res) : reactive(res);
  1029. }
  1030. return res;
  1031. }
  1032. }
  1033. class MutableReactiveHandler extends BaseReactiveHandler {
  1034. constructor(isShallow2 = false) {
  1035. super(false, isShallow2);
  1036. }
  1037. set(target, key, value, receiver) {
  1038. let oldValue = target[key];
  1039. const isArrayWithIntegerKey = shared.isArray(target) && shared.isIntegerKey(key);
  1040. if (!this._isShallow) {
  1041. const isOldValueReadonly = isReadonly(oldValue);
  1042. if (!isShallow(value) && !isReadonly(value)) {
  1043. oldValue = toRaw(oldValue);
  1044. value = toRaw(value);
  1045. }
  1046. if (!isArrayWithIntegerKey && isRef(oldValue) && !isRef(value)) {
  1047. if (isOldValueReadonly) {
  1048. {
  1049. warn(
  1050. `Set operation on key "${String(key)}" failed: target is readonly.`,
  1051. target[key]
  1052. );
  1053. }
  1054. return true;
  1055. } else {
  1056. oldValue.value = value;
  1057. return true;
  1058. }
  1059. }
  1060. }
  1061. const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : shared.hasOwn(target, key);
  1062. const result = Reflect.set(
  1063. target,
  1064. key,
  1065. value,
  1066. isRef(target) ? target : receiver
  1067. );
  1068. if (target === toRaw(receiver)) {
  1069. if (!hadKey) {
  1070. trigger(target, "add", key, value);
  1071. } else if (shared.hasChanged(value, oldValue)) {
  1072. trigger(target, "set", key, value, oldValue);
  1073. }
  1074. }
  1075. return result;
  1076. }
  1077. deleteProperty(target, key) {
  1078. const hadKey = shared.hasOwn(target, key);
  1079. const oldValue = target[key];
  1080. const result = Reflect.deleteProperty(target, key);
  1081. if (result && hadKey) {
  1082. trigger(target, "delete", key, void 0, oldValue);
  1083. }
  1084. return result;
  1085. }
  1086. has(target, key) {
  1087. const result = Reflect.has(target, key);
  1088. if (!shared.isSymbol(key) || !builtInSymbols.has(key)) {
  1089. track(target, "has", key);
  1090. }
  1091. return result;
  1092. }
  1093. ownKeys(target) {
  1094. track(
  1095. target,
  1096. "iterate",
  1097. shared.isArray(target) ? "length" : ITERATE_KEY
  1098. );
  1099. return Reflect.ownKeys(target);
  1100. }
  1101. }
  1102. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  1103. constructor(isShallow2 = false) {
  1104. super(true, isShallow2);
  1105. }
  1106. set(target, key) {
  1107. {
  1108. warn(
  1109. `Set operation on key "${String(key)}" failed: target is readonly.`,
  1110. target
  1111. );
  1112. }
  1113. return true;
  1114. }
  1115. deleteProperty(target, key) {
  1116. {
  1117. warn(
  1118. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  1119. target
  1120. );
  1121. }
  1122. return true;
  1123. }
  1124. }
  1125. const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
  1126. const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
  1127. const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
  1128. const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
  1129. const toShallow = (value) => value;
  1130. const getProto = (v) => Reflect.getPrototypeOf(v);
  1131. function createIterableMethod(method, isReadonly2, isShallow2) {
  1132. return function(...args) {
  1133. const target = this["__v_raw"];
  1134. const rawTarget = toRaw(target);
  1135. const targetIsMap = shared.isMap(rawTarget);
  1136. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  1137. const isKeyOnly = method === "keys" && targetIsMap;
  1138. const innerIterator = target[method](...args);
  1139. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  1140. !isReadonly2 && track(
  1141. rawTarget,
  1142. "iterate",
  1143. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  1144. );
  1145. return shared.extend(
  1146. // inheriting all iterator properties
  1147. Object.create(innerIterator),
  1148. {
  1149. // iterator protocol
  1150. next() {
  1151. const { value, done } = innerIterator.next();
  1152. return done ? { value, done } : {
  1153. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  1154. done
  1155. };
  1156. }
  1157. }
  1158. );
  1159. };
  1160. }
  1161. function createReadonlyMethod(type) {
  1162. return function(...args) {
  1163. {
  1164. const key = args[0] ? `on key "${args[0]}" ` : ``;
  1165. warn(
  1166. `${shared.capitalize(type)} operation ${key}failed: target is readonly.`,
  1167. toRaw(this)
  1168. );
  1169. }
  1170. return type === "delete" ? false : type === "clear" ? void 0 : this;
  1171. };
  1172. }
  1173. function createInstrumentations(readonly, shallow) {
  1174. const instrumentations = {
  1175. get(key) {
  1176. const target = this["__v_raw"];
  1177. const rawTarget = toRaw(target);
  1178. const rawKey = toRaw(key);
  1179. if (!readonly) {
  1180. if (shared.hasChanged(key, rawKey)) {
  1181. track(rawTarget, "get", key);
  1182. }
  1183. track(rawTarget, "get", rawKey);
  1184. }
  1185. const { has } = getProto(rawTarget);
  1186. const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
  1187. if (has.call(rawTarget, key)) {
  1188. return wrap(target.get(key));
  1189. } else if (has.call(rawTarget, rawKey)) {
  1190. return wrap(target.get(rawKey));
  1191. } else if (target !== rawTarget) {
  1192. target.get(key);
  1193. }
  1194. },
  1195. get size() {
  1196. const target = this["__v_raw"];
  1197. !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
  1198. return target.size;
  1199. },
  1200. has(key) {
  1201. const target = this["__v_raw"];
  1202. const rawTarget = toRaw(target);
  1203. const rawKey = toRaw(key);
  1204. if (!readonly) {
  1205. if (shared.hasChanged(key, rawKey)) {
  1206. track(rawTarget, "has", key);
  1207. }
  1208. track(rawTarget, "has", rawKey);
  1209. }
  1210. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  1211. },
  1212. forEach(callback, thisArg) {
  1213. const observed = this;
  1214. const target = observed["__v_raw"];
  1215. const rawTarget = toRaw(target);
  1216. const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
  1217. !readonly && track(rawTarget, "iterate", ITERATE_KEY);
  1218. return target.forEach((value, key) => {
  1219. return callback.call(thisArg, wrap(value), wrap(key), observed);
  1220. });
  1221. }
  1222. };
  1223. shared.extend(
  1224. instrumentations,
  1225. readonly ? {
  1226. add: createReadonlyMethod("add"),
  1227. set: createReadonlyMethod("set"),
  1228. delete: createReadonlyMethod("delete"),
  1229. clear: createReadonlyMethod("clear")
  1230. } : {
  1231. add(value) {
  1232. const target = toRaw(this);
  1233. const proto = getProto(target);
  1234. const rawValue = toRaw(value);
  1235. const valueToAdd = !shallow && !isShallow(value) && !isReadonly(value) ? rawValue : value;
  1236. const hadKey = proto.has.call(target, valueToAdd) || shared.hasChanged(value, valueToAdd) && proto.has.call(target, value) || shared.hasChanged(rawValue, valueToAdd) && proto.has.call(target, rawValue);
  1237. if (!hadKey) {
  1238. target.add(valueToAdd);
  1239. trigger(target, "add", valueToAdd, valueToAdd);
  1240. }
  1241. return this;
  1242. },
  1243. set(key, value) {
  1244. if (!shallow && !isShallow(value) && !isReadonly(value)) {
  1245. value = toRaw(value);
  1246. }
  1247. const target = toRaw(this);
  1248. const { has, get } = getProto(target);
  1249. let hadKey = has.call(target, key);
  1250. if (!hadKey) {
  1251. key = toRaw(key);
  1252. hadKey = has.call(target, key);
  1253. } else {
  1254. checkIdentityKeys(target, has, key);
  1255. }
  1256. const oldValue = get.call(target, key);
  1257. target.set(key, value);
  1258. if (!hadKey) {
  1259. trigger(target, "add", key, value);
  1260. } else if (shared.hasChanged(value, oldValue)) {
  1261. trigger(target, "set", key, value, oldValue);
  1262. }
  1263. return this;
  1264. },
  1265. delete(key) {
  1266. const target = toRaw(this);
  1267. const { has, get } = getProto(target);
  1268. let hadKey = has.call(target, key);
  1269. if (!hadKey) {
  1270. key = toRaw(key);
  1271. hadKey = has.call(target, key);
  1272. } else {
  1273. checkIdentityKeys(target, has, key);
  1274. }
  1275. const oldValue = get ? get.call(target, key) : void 0;
  1276. const result = target.delete(key);
  1277. if (hadKey) {
  1278. trigger(target, "delete", key, void 0, oldValue);
  1279. }
  1280. return result;
  1281. },
  1282. clear() {
  1283. const target = toRaw(this);
  1284. const hadItems = target.size !== 0;
  1285. const oldTarget = shared.isMap(target) ? new Map(target) : new Set(target) ;
  1286. const result = target.clear();
  1287. if (hadItems) {
  1288. trigger(
  1289. target,
  1290. "clear",
  1291. void 0,
  1292. void 0,
  1293. oldTarget
  1294. );
  1295. }
  1296. return result;
  1297. }
  1298. }
  1299. );
  1300. const iteratorMethods = [
  1301. "keys",
  1302. "values",
  1303. "entries",
  1304. Symbol.iterator
  1305. ];
  1306. iteratorMethods.forEach((method) => {
  1307. instrumentations[method] = createIterableMethod(method, readonly, shallow);
  1308. });
  1309. return instrumentations;
  1310. }
  1311. function createInstrumentationGetter(isReadonly2, shallow) {
  1312. const instrumentations = createInstrumentations(isReadonly2, shallow);
  1313. return (target, key, receiver) => {
  1314. if (key === "__v_isReactive") {
  1315. return !isReadonly2;
  1316. } else if (key === "__v_isReadonly") {
  1317. return isReadonly2;
  1318. } else if (key === "__v_raw") {
  1319. return target;
  1320. }
  1321. return Reflect.get(
  1322. shared.hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1323. key,
  1324. receiver
  1325. );
  1326. };
  1327. }
  1328. const mutableCollectionHandlers = {
  1329. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1330. };
  1331. const shallowCollectionHandlers = {
  1332. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1333. };
  1334. const readonlyCollectionHandlers = {
  1335. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1336. };
  1337. const shallowReadonlyCollectionHandlers = {
  1338. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1339. };
  1340. function checkIdentityKeys(target, has, key) {
  1341. const rawKey = toRaw(key);
  1342. if (rawKey !== key && has.call(target, rawKey)) {
  1343. const type = shared.toRawType(target);
  1344. warn(
  1345. `Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`
  1346. );
  1347. }
  1348. }
  1349. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1350. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1351. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1352. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1353. function targetTypeMap(rawType) {
  1354. switch (rawType) {
  1355. case "Object":
  1356. case "Array":
  1357. return 1 /* COMMON */;
  1358. case "Map":
  1359. case "Set":
  1360. case "WeakMap":
  1361. case "WeakSet":
  1362. return 2 /* COLLECTION */;
  1363. default:
  1364. return 0 /* INVALID */;
  1365. }
  1366. }
  1367. function getTargetType(value) {
  1368. return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(shared.toRawType(value));
  1369. }
  1370. // @__NO_SIDE_EFFECTS__
  1371. function reactive(target) {
  1372. if (/* @__PURE__ */ isReadonly(target)) {
  1373. return target;
  1374. }
  1375. return createReactiveObject(
  1376. target,
  1377. false,
  1378. mutableHandlers,
  1379. mutableCollectionHandlers,
  1380. reactiveMap
  1381. );
  1382. }
  1383. // @__NO_SIDE_EFFECTS__
  1384. function shallowReactive(target) {
  1385. return createReactiveObject(
  1386. target,
  1387. false,
  1388. shallowReactiveHandlers,
  1389. shallowCollectionHandlers,
  1390. shallowReactiveMap
  1391. );
  1392. }
  1393. // @__NO_SIDE_EFFECTS__
  1394. function readonly(target) {
  1395. return createReactiveObject(
  1396. target,
  1397. true,
  1398. readonlyHandlers,
  1399. readonlyCollectionHandlers,
  1400. readonlyMap
  1401. );
  1402. }
  1403. // @__NO_SIDE_EFFECTS__
  1404. function shallowReadonly(target) {
  1405. return createReactiveObject(
  1406. target,
  1407. true,
  1408. shallowReadonlyHandlers,
  1409. shallowReadonlyCollectionHandlers,
  1410. shallowReadonlyMap
  1411. );
  1412. }
  1413. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1414. if (!shared.isObject(target)) {
  1415. {
  1416. warn(
  1417. `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
  1418. target
  1419. )}`
  1420. );
  1421. }
  1422. return target;
  1423. }
  1424. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1425. return target;
  1426. }
  1427. const targetType = getTargetType(target);
  1428. if (targetType === 0 /* INVALID */) {
  1429. return target;
  1430. }
  1431. const existingProxy = proxyMap.get(target);
  1432. if (existingProxy) {
  1433. return existingProxy;
  1434. }
  1435. const proxy = new Proxy(
  1436. target,
  1437. targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
  1438. );
  1439. proxyMap.set(target, proxy);
  1440. return proxy;
  1441. }
  1442. // @__NO_SIDE_EFFECTS__
  1443. function isReactive(value) {
  1444. if (/* @__PURE__ */ isReadonly(value)) {
  1445. return /* @__PURE__ */ isReactive(value["__v_raw"]);
  1446. }
  1447. return !!(value && value["__v_isReactive"]);
  1448. }
  1449. // @__NO_SIDE_EFFECTS__
  1450. function isReadonly(value) {
  1451. return !!(value && value["__v_isReadonly"]);
  1452. }
  1453. // @__NO_SIDE_EFFECTS__
  1454. function isShallow(value) {
  1455. return !!(value && value["__v_isShallow"]);
  1456. }
  1457. // @__NO_SIDE_EFFECTS__
  1458. function isProxy(value) {
  1459. return value ? !!value["__v_raw"] : false;
  1460. }
  1461. // @__NO_SIDE_EFFECTS__
  1462. function toRaw(observed) {
  1463. const raw = observed && observed["__v_raw"];
  1464. return raw ? /* @__PURE__ */ toRaw(raw) : observed;
  1465. }
  1466. function markRaw(value) {
  1467. if (!shared.hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
  1468. shared.def(value, "__v_skip", true);
  1469. }
  1470. return value;
  1471. }
  1472. const toReactive = (value) => shared.isObject(value) ? /* @__PURE__ */ reactive(value) : value;
  1473. const toReadonly = (value) => shared.isObject(value) ? /* @__PURE__ */ readonly(value) : value;
  1474. // @__NO_SIDE_EFFECTS__
  1475. function isRef(r) {
  1476. return r ? r["__v_isRef"] === true : false;
  1477. }
  1478. // @__NO_SIDE_EFFECTS__
  1479. function ref(value) {
  1480. return createRef(value, false);
  1481. }
  1482. // @__NO_SIDE_EFFECTS__
  1483. function shallowRef(value) {
  1484. return createRef(value, true);
  1485. }
  1486. function createRef(rawValue, shallow) {
  1487. if (/* @__PURE__ */ isRef(rawValue)) {
  1488. return rawValue;
  1489. }
  1490. return new RefImpl(rawValue, shallow);
  1491. }
  1492. class RefImpl {
  1493. constructor(value, isShallow2) {
  1494. this.dep = new Dep();
  1495. this["__v_isRef"] = true;
  1496. this["__v_isShallow"] = false;
  1497. this._rawValue = isShallow2 ? value : toRaw(value);
  1498. this._value = isShallow2 ? value : toReactive(value);
  1499. this["__v_isShallow"] = isShallow2;
  1500. }
  1501. get value() {
  1502. {
  1503. this.dep.track({
  1504. target: this,
  1505. type: "get",
  1506. key: "value"
  1507. });
  1508. }
  1509. return this._value;
  1510. }
  1511. set value(newValue) {
  1512. const oldValue = this._rawValue;
  1513. const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
  1514. newValue = useDirectValue ? newValue : toRaw(newValue);
  1515. if (shared.hasChanged(newValue, oldValue)) {
  1516. this._rawValue = newValue;
  1517. this._value = useDirectValue ? newValue : toReactive(newValue);
  1518. {
  1519. this.dep.trigger({
  1520. target: this,
  1521. type: "set",
  1522. key: "value",
  1523. newValue,
  1524. oldValue
  1525. });
  1526. }
  1527. }
  1528. }
  1529. }
  1530. function triggerRef(ref2) {
  1531. if (ref2.dep) {
  1532. {
  1533. ref2.dep.trigger({
  1534. target: ref2,
  1535. type: "set",
  1536. key: "value",
  1537. newValue: ref2._value
  1538. });
  1539. }
  1540. }
  1541. }
  1542. function unref(ref2) {
  1543. return /* @__PURE__ */ isRef(ref2) ? ref2.value : ref2;
  1544. }
  1545. function toValue(source) {
  1546. return shared.isFunction(source) ? source() : unref(source);
  1547. }
  1548. const shallowUnwrapHandlers = {
  1549. get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
  1550. set: (target, key, value, receiver) => {
  1551. const oldValue = target[key];
  1552. if (/* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) {
  1553. oldValue.value = value;
  1554. return true;
  1555. } else {
  1556. return Reflect.set(target, key, value, receiver);
  1557. }
  1558. }
  1559. };
  1560. function proxyRefs(objectWithRefs) {
  1561. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1562. }
  1563. class CustomRefImpl {
  1564. constructor(factory) {
  1565. this["__v_isRef"] = true;
  1566. this._value = void 0;
  1567. const dep = this.dep = new Dep();
  1568. const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
  1569. this._get = get;
  1570. this._set = set;
  1571. }
  1572. get value() {
  1573. return this._value = this._get();
  1574. }
  1575. set value(newVal) {
  1576. this._set(newVal);
  1577. }
  1578. }
  1579. function customRef(factory) {
  1580. return new CustomRefImpl(factory);
  1581. }
  1582. // @__NO_SIDE_EFFECTS__
  1583. function toRefs(object) {
  1584. if (!isProxy(object)) {
  1585. warn(`toRefs() expects a reactive object but received a plain one.`);
  1586. }
  1587. const ret = shared.isArray(object) ? new Array(object.length) : {};
  1588. for (const key in object) {
  1589. ret[key] = propertyToRef(object, key);
  1590. }
  1591. return ret;
  1592. }
  1593. class ObjectRefImpl {
  1594. constructor(_object, key, _defaultValue) {
  1595. this._object = _object;
  1596. this._defaultValue = _defaultValue;
  1597. this["__v_isRef"] = true;
  1598. this._value = void 0;
  1599. this._key = shared.isSymbol(key) ? key : String(key);
  1600. this._raw = toRaw(_object);
  1601. let shallow = true;
  1602. let obj = _object;
  1603. if (!shared.isArray(_object) || shared.isSymbol(this._key) || !shared.isIntegerKey(this._key)) {
  1604. do {
  1605. shallow = !isProxy(obj) || isShallow(obj);
  1606. } while (shallow && (obj = obj["__v_raw"]));
  1607. }
  1608. this._shallow = shallow;
  1609. }
  1610. get value() {
  1611. let val = this._object[this._key];
  1612. if (this._shallow) {
  1613. val = unref(val);
  1614. }
  1615. return this._value = val === void 0 ? this._defaultValue : val;
  1616. }
  1617. set value(newVal) {
  1618. if (this._shallow && /* @__PURE__ */ isRef(this._raw[this._key])) {
  1619. const nestedRef = this._object[this._key];
  1620. if (/* @__PURE__ */ isRef(nestedRef)) {
  1621. nestedRef.value = newVal;
  1622. return;
  1623. }
  1624. }
  1625. this._object[this._key] = newVal;
  1626. }
  1627. get dep() {
  1628. return getDepFromReactive(this._raw, this._key);
  1629. }
  1630. }
  1631. class GetterRefImpl {
  1632. constructor(_getter) {
  1633. this._getter = _getter;
  1634. this["__v_isRef"] = true;
  1635. this["__v_isReadonly"] = true;
  1636. this._value = void 0;
  1637. }
  1638. get value() {
  1639. return this._value = this._getter();
  1640. }
  1641. }
  1642. // @__NO_SIDE_EFFECTS__
  1643. function toRef(source, key, defaultValue) {
  1644. if (/* @__PURE__ */ isRef(source)) {
  1645. return source;
  1646. } else if (shared.isFunction(source)) {
  1647. return new GetterRefImpl(source);
  1648. } else if (shared.isObject(source) && arguments.length > 1) {
  1649. return propertyToRef(source, key, defaultValue);
  1650. } else {
  1651. return /* @__PURE__ */ ref(source);
  1652. }
  1653. }
  1654. function propertyToRef(source, key, defaultValue) {
  1655. return new ObjectRefImpl(source, key, defaultValue);
  1656. }
  1657. class ComputedRefImpl {
  1658. constructor(fn, setter, isSSR) {
  1659. this.fn = fn;
  1660. this.setter = setter;
  1661. /**
  1662. * @internal
  1663. */
  1664. this._value = void 0;
  1665. /**
  1666. * @internal
  1667. */
  1668. this.dep = new Dep(this);
  1669. /**
  1670. * @internal
  1671. */
  1672. this.__v_isRef = true;
  1673. // TODO isolatedDeclarations "__v_isReadonly"
  1674. // A computed is also a subscriber that tracks other deps
  1675. /**
  1676. * @internal
  1677. */
  1678. this.deps = void 0;
  1679. /**
  1680. * @internal
  1681. */
  1682. this.depsTail = void 0;
  1683. /**
  1684. * @internal
  1685. */
  1686. this.flags = 16;
  1687. /**
  1688. * @internal
  1689. */
  1690. this.globalVersion = globalVersion - 1;
  1691. /**
  1692. * @internal
  1693. */
  1694. this.next = void 0;
  1695. // for backwards compat
  1696. this.effect = this;
  1697. this["__v_isReadonly"] = !setter;
  1698. this.isSSR = isSSR;
  1699. }
  1700. /**
  1701. * @internal
  1702. */
  1703. notify() {
  1704. this.flags |= 16;
  1705. if (!(this.flags & 8) && // avoid infinite self recursion
  1706. activeSub !== this) {
  1707. batch(this, true);
  1708. return true;
  1709. }
  1710. }
  1711. get value() {
  1712. const link = this.dep.track({
  1713. target: this,
  1714. type: "get",
  1715. key: "value"
  1716. }) ;
  1717. refreshComputed(this);
  1718. if (link) {
  1719. link.version = this.dep.version;
  1720. }
  1721. return this._value;
  1722. }
  1723. set value(newValue) {
  1724. if (this.setter) {
  1725. this.setter(newValue);
  1726. } else {
  1727. warn("Write operation failed: computed value is readonly");
  1728. }
  1729. }
  1730. }
  1731. // @__NO_SIDE_EFFECTS__
  1732. function computed(getterOrOptions, debugOptions, isSSR = false) {
  1733. let getter;
  1734. let setter;
  1735. if (shared.isFunction(getterOrOptions)) {
  1736. getter = getterOrOptions;
  1737. } else {
  1738. getter = getterOrOptions.get;
  1739. setter = getterOrOptions.set;
  1740. }
  1741. const cRef = new ComputedRefImpl(getter, setter, isSSR);
  1742. if (debugOptions && !isSSR) {
  1743. cRef.onTrack = debugOptions.onTrack;
  1744. cRef.onTrigger = debugOptions.onTrigger;
  1745. }
  1746. return cRef;
  1747. }
  1748. const TrackOpTypes = {
  1749. "GET": "get",
  1750. "HAS": "has",
  1751. "ITERATE": "iterate"
  1752. };
  1753. const TriggerOpTypes = {
  1754. "SET": "set",
  1755. "ADD": "add",
  1756. "DELETE": "delete",
  1757. "CLEAR": "clear"
  1758. };
  1759. const ReactiveFlags = {
  1760. "SKIP": "__v_skip",
  1761. "IS_REACTIVE": "__v_isReactive",
  1762. "IS_READONLY": "__v_isReadonly",
  1763. "IS_SHALLOW": "__v_isShallow",
  1764. "RAW": "__v_raw",
  1765. "IS_REF": "__v_isRef"
  1766. };
  1767. const WatchErrorCodes = {
  1768. "WATCH_GETTER": 2,
  1769. "2": "WATCH_GETTER",
  1770. "WATCH_CALLBACK": 3,
  1771. "3": "WATCH_CALLBACK",
  1772. "WATCH_CLEANUP": 4,
  1773. "4": "WATCH_CLEANUP"
  1774. };
  1775. const INITIAL_WATCHER_VALUE = {};
  1776. const cleanupMap = /* @__PURE__ */ new WeakMap();
  1777. let activeWatcher = void 0;
  1778. function getCurrentWatcher() {
  1779. return activeWatcher;
  1780. }
  1781. function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
  1782. if (owner) {
  1783. let cleanups = cleanupMap.get(owner);
  1784. if (!cleanups) cleanupMap.set(owner, cleanups = []);
  1785. cleanups.push(cleanupFn);
  1786. } else if (!failSilently) {
  1787. warn(
  1788. `onWatcherCleanup() was called when there was no active watcher to associate with.`
  1789. );
  1790. }
  1791. }
  1792. function watch(source, cb, options = shared.EMPTY_OBJ) {
  1793. const { immediate, deep, once, scheduler, augmentJob, call } = options;
  1794. const warnInvalidSource = (s) => {
  1795. (options.onWarn || warn)(
  1796. `Invalid watch source: `,
  1797. s,
  1798. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  1799. );
  1800. };
  1801. const reactiveGetter = (source2) => {
  1802. if (deep) return source2;
  1803. if (isShallow(source2) || deep === false || deep === 0)
  1804. return traverse(source2, 1);
  1805. return traverse(source2);
  1806. };
  1807. let effect;
  1808. let getter;
  1809. let cleanup;
  1810. let boundCleanup;
  1811. let forceTrigger = false;
  1812. let isMultiSource = false;
  1813. if (isRef(source)) {
  1814. getter = () => source.value;
  1815. forceTrigger = isShallow(source);
  1816. } else if (isReactive(source)) {
  1817. getter = () => reactiveGetter(source);
  1818. forceTrigger = true;
  1819. } else if (shared.isArray(source)) {
  1820. isMultiSource = true;
  1821. forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
  1822. getter = () => source.map((s) => {
  1823. if (isRef(s)) {
  1824. return s.value;
  1825. } else if (isReactive(s)) {
  1826. return reactiveGetter(s);
  1827. } else if (shared.isFunction(s)) {
  1828. return call ? call(s, 2) : s();
  1829. } else {
  1830. warnInvalidSource(s);
  1831. }
  1832. });
  1833. } else if (shared.isFunction(source)) {
  1834. if (cb) {
  1835. getter = call ? () => call(source, 2) : source;
  1836. } else {
  1837. getter = () => {
  1838. if (cleanup) {
  1839. pauseTracking();
  1840. try {
  1841. cleanup();
  1842. } finally {
  1843. resetTracking();
  1844. }
  1845. }
  1846. const currentEffect = activeWatcher;
  1847. activeWatcher = effect;
  1848. try {
  1849. return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
  1850. } finally {
  1851. activeWatcher = currentEffect;
  1852. }
  1853. };
  1854. }
  1855. } else {
  1856. getter = shared.NOOP;
  1857. warnInvalidSource(source);
  1858. }
  1859. if (cb && deep) {
  1860. const baseGetter = getter;
  1861. const depth = deep === true ? Infinity : deep;
  1862. getter = () => traverse(baseGetter(), depth);
  1863. }
  1864. const scope = getCurrentScope();
  1865. const watchHandle = () => {
  1866. effect.stop();
  1867. if (scope && scope.active) {
  1868. shared.remove(scope.effects, effect);
  1869. }
  1870. };
  1871. if (once && cb) {
  1872. const _cb = cb;
  1873. cb = (...args) => {
  1874. _cb(...args);
  1875. watchHandle();
  1876. };
  1877. }
  1878. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  1879. const job = (immediateFirstRun) => {
  1880. if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
  1881. return;
  1882. }
  1883. if (cb) {
  1884. const newValue = effect.run();
  1885. if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => shared.hasChanged(v, oldValue[i])) : shared.hasChanged(newValue, oldValue))) {
  1886. if (cleanup) {
  1887. cleanup();
  1888. }
  1889. const currentWatcher = activeWatcher;
  1890. activeWatcher = effect;
  1891. try {
  1892. const args = [
  1893. newValue,
  1894. // pass undefined as the old value when it's changed for the first time
  1895. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  1896. boundCleanup
  1897. ];
  1898. oldValue = newValue;
  1899. call ? call(cb, 3, args) : (
  1900. // @ts-expect-error
  1901. cb(...args)
  1902. );
  1903. } finally {
  1904. activeWatcher = currentWatcher;
  1905. }
  1906. }
  1907. } else {
  1908. effect.run();
  1909. }
  1910. };
  1911. if (augmentJob) {
  1912. augmentJob(job);
  1913. }
  1914. effect = new ReactiveEffect(getter);
  1915. effect.scheduler = scheduler ? () => scheduler(job, false) : job;
  1916. boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
  1917. cleanup = effect.onStop = () => {
  1918. const cleanups = cleanupMap.get(effect);
  1919. if (cleanups) {
  1920. if (call) {
  1921. call(cleanups, 4);
  1922. } else {
  1923. for (const cleanup2 of cleanups) cleanup2();
  1924. }
  1925. cleanupMap.delete(effect);
  1926. }
  1927. };
  1928. {
  1929. effect.onTrack = options.onTrack;
  1930. effect.onTrigger = options.onTrigger;
  1931. }
  1932. if (cb) {
  1933. if (immediate) {
  1934. job(true);
  1935. } else {
  1936. oldValue = effect.run();
  1937. }
  1938. } else if (scheduler) {
  1939. scheduler(job.bind(null, true), true);
  1940. } else {
  1941. effect.run();
  1942. }
  1943. watchHandle.pause = effect.pause.bind(effect);
  1944. watchHandle.resume = effect.resume.bind(effect);
  1945. watchHandle.stop = watchHandle;
  1946. return watchHandle;
  1947. }
  1948. function traverse(value, depth = Infinity, seen) {
  1949. if (depth <= 0 || !shared.isObject(value) || value["__v_skip"]) {
  1950. return value;
  1951. }
  1952. seen = seen || /* @__PURE__ */ new Map();
  1953. if ((seen.get(value) || 0) >= depth) {
  1954. return value;
  1955. }
  1956. seen.set(value, depth);
  1957. depth--;
  1958. if (isRef(value)) {
  1959. traverse(value.value, depth, seen);
  1960. } else if (shared.isArray(value)) {
  1961. for (let i = 0; i < value.length; i++) {
  1962. traverse(value[i], depth, seen);
  1963. }
  1964. } else if (shared.isSet(value) || shared.isMap(value)) {
  1965. value.forEach((v) => {
  1966. traverse(v, depth, seen);
  1967. });
  1968. } else if (shared.isPlainObject(value)) {
  1969. for (const key in value) {
  1970. traverse(value[key], depth, seen);
  1971. }
  1972. for (const key of Object.getOwnPropertySymbols(value)) {
  1973. if (Object.prototype.propertyIsEnumerable.call(value, key)) {
  1974. traverse(value[key], depth, seen);
  1975. }
  1976. }
  1977. }
  1978. return value;
  1979. }
  1980. exports.ARRAY_ITERATE_KEY = ARRAY_ITERATE_KEY;
  1981. exports.EffectFlags = EffectFlags;
  1982. exports.EffectScope = EffectScope;
  1983. exports.ITERATE_KEY = ITERATE_KEY;
  1984. exports.MAP_KEY_ITERATE_KEY = MAP_KEY_ITERATE_KEY;
  1985. exports.ReactiveEffect = ReactiveEffect;
  1986. exports.ReactiveFlags = ReactiveFlags;
  1987. exports.TrackOpTypes = TrackOpTypes;
  1988. exports.TriggerOpTypes = TriggerOpTypes;
  1989. exports.WatchErrorCodes = WatchErrorCodes;
  1990. exports.computed = computed;
  1991. exports.customRef = customRef;
  1992. exports.effect = effect;
  1993. exports.effectScope = effectScope;
  1994. exports.enableTracking = enableTracking;
  1995. exports.getCurrentScope = getCurrentScope;
  1996. exports.getCurrentWatcher = getCurrentWatcher;
  1997. exports.isProxy = isProxy;
  1998. exports.isReactive = isReactive;
  1999. exports.isReadonly = isReadonly;
  2000. exports.isRef = isRef;
  2001. exports.isShallow = isShallow;
  2002. exports.markRaw = markRaw;
  2003. exports.onEffectCleanup = onEffectCleanup;
  2004. exports.onScopeDispose = onScopeDispose;
  2005. exports.onWatcherCleanup = onWatcherCleanup;
  2006. exports.pauseTracking = pauseTracking;
  2007. exports.proxyRefs = proxyRefs;
  2008. exports.reactive = reactive;
  2009. exports.reactiveReadArray = reactiveReadArray;
  2010. exports.readonly = readonly;
  2011. exports.ref = ref;
  2012. exports.resetTracking = resetTracking;
  2013. exports.shallowReactive = shallowReactive;
  2014. exports.shallowReadArray = shallowReadArray;
  2015. exports.shallowReadonly = shallowReadonly;
  2016. exports.shallowRef = shallowRef;
  2017. exports.stop = stop;
  2018. exports.toRaw = toRaw;
  2019. exports.toReactive = toReactive;
  2020. exports.toReadonly = toReadonly;
  2021. exports.toRef = toRef;
  2022. exports.toRefs = toRefs;
  2023. exports.toValue = toValue;
  2024. exports.track = track;
  2025. exports.traverse = traverse;
  2026. exports.trigger = trigger;
  2027. exports.triggerRef = triggerRef;
  2028. exports.unref = unref;
  2029. exports.watch = watch;