reactivity.global.js 57 KB

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