智慧水务管理系统 - 精河县供水工程综合管理平台

reactivity.esm-bundler.js 53KB

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