reactivity.esm-bundler.js 53 KB

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