@vue/devtools-kit 7.0.13 → 7.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,18 +18,18 @@ var __copyProps = (to, from, except, desc) => {
18
18
  }
19
19
  return to;
20
20
  };
21
- var __toESM = (mod, isNodeMode, target8) => (target8 = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ var __toESM = (mod, isNodeMode, target9) => (target9 = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
22
  // If the importer is in node compatibility mode or this is not an ESM
23
23
  // file that has been converted to a CommonJS file using a Babel-
24
24
  // compatible transform (i.e. "__esModule" has not been set), then set
25
25
  // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target8, "default", { value: mod, enumerable: true }) : target8,
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target9, "default", { value: mod, enumerable: true }) : target9,
27
27
  mod
28
28
  ));
29
29
 
30
- // ../../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.33_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.35_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js
31
31
  var init_esm_shims = __esm({
32
- "../../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.33_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js"() {
32
+ "../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.35_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js"() {
33
33
  "use strict";
34
34
  }
35
35
  });
@@ -1575,49 +1575,57 @@ var require_speakingurl2 = __commonJS({
1575
1575
  // src/index.ts
1576
1576
  init_esm_shims();
1577
1577
 
1578
- // src/core/general/index.ts
1578
+ // src/core/index.ts
1579
1579
  init_esm_shims();
1580
- import { target as target7 } from "@vue/devtools-shared";
1581
- import { DevToolsHooks as DevToolsHooks3 } from "@vue/devtools-schema";
1580
+ import { target as target8 } from "@vue/devtools-shared";
1582
1581
 
1583
- // src/api/index.ts
1582
+ // src/hook/index.ts
1584
1583
  init_esm_shims();
1584
+ import { target } from "@vue/devtools-shared";
1585
+ import { createHooks } from "hookable";
1585
1586
 
1586
- // src/core/general/state.ts
1587
+ // src/types/index.ts
1587
1588
  init_esm_shims();
1588
- import { deepClone as deepClone2, target as global2 } from "@vue/devtools-shared";
1589
- import { debounce as debounce2 } from "perfect-debounce";
1590
1589
 
1591
- // src/core/router/index.ts
1590
+ // src/types/app.ts
1592
1591
  init_esm_shims();
1593
- import { deepClone, target as global } from "@vue/devtools-shared";
1594
- import { debounce } from "perfect-debounce";
1595
1592
 
1596
- // src/core/general/hook.ts
1593
+ // src/types/hook.ts
1597
1594
  init_esm_shims();
1598
- import { DevToolsHooks } from "@vue/devtools-schema";
1599
- import { target } from "@vue/devtools-shared";
1600
- import { createHooks } from "hookable";
1595
+
1596
+ // src/types/state.ts
1597
+ init_esm_shims();
1598
+
1599
+ // src/types/context.ts
1600
+ init_esm_shims();
1601
+
1602
+ // src/types/router.ts
1603
+ init_esm_shims();
1604
+
1605
+ // src/types/env.ts
1606
+ init_esm_shims();
1607
+
1608
+ // src/hook/index.ts
1601
1609
  var _a, _b;
1602
1610
  var devtoolsHooks = (_b = (_a = target).__VUE_DEVTOOLS_HOOK) != null ? _b : _a.__VUE_DEVTOOLS_HOOK = createHooks();
1603
1611
  var on = {
1604
1612
  vueAppInit(fn) {
1605
- devtoolsHooks.hook(DevToolsHooks.APP_INIT, fn);
1613
+ devtoolsHooks.hook("app:init" /* APP_INIT */, fn);
1606
1614
  },
1607
1615
  vueAppConnected(fn) {
1608
- devtoolsHooks.hook(DevToolsHooks.APP_CONNECTED, fn);
1616
+ devtoolsHooks.hook("app:connected" /* APP_CONNECTED */, fn);
1609
1617
  },
1610
1618
  componentAdded(fn) {
1611
- return devtoolsHooks.hook(DevToolsHooks.COMPONENT_ADDED, fn);
1619
+ return devtoolsHooks.hook("component:added" /* COMPONENT_ADDED */, fn);
1612
1620
  },
1613
1621
  componentUpdated(fn) {
1614
- return devtoolsHooks.hook(DevToolsHooks.COMPONENT_UPDATED, fn);
1622
+ return devtoolsHooks.hook("component:updated" /* COMPONENT_UPDATED */, fn);
1615
1623
  },
1616
1624
  componentRemoved(fn) {
1617
- return devtoolsHooks.hook(DevToolsHooks.COMPONENT_REMOVED, fn);
1625
+ return devtoolsHooks.hook("component:removed" /* COMPONENT_REMOVED */, fn);
1618
1626
  },
1619
1627
  setupDevtoolsPlugin(fn) {
1620
- devtoolsHooks.hook(DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, fn);
1628
+ devtoolsHooks.hook("devtools-plugin:setup" /* SETUP_DEVTOOLS_PLUGIN */, fn);
1621
1629
  }
1622
1630
  };
1623
1631
  function createDevToolsHook() {
@@ -1628,10 +1636,10 @@ function createDevToolsHook() {
1628
1636
  apps: {},
1629
1637
  events: /* @__PURE__ */ new Map(),
1630
1638
  on(event, fn) {
1631
- var _a8;
1639
+ var _a10;
1632
1640
  if (!this.events.has(event))
1633
1641
  this.events.set(event, []);
1634
- (_a8 = this.events.get(event)) == null ? void 0 : _a8.push(fn);
1642
+ (_a10 = this.events.get(event)) == null ? void 0 : _a10.push(fn);
1635
1643
  return () => this.off(event, fn);
1636
1644
  },
1637
1645
  once(event, fn) {
@@ -1658,295 +1666,200 @@ function createDevToolsHook() {
1658
1666
  }
1659
1667
  function subscribeDevToolsHook() {
1660
1668
  const hook2 = target.__VUE_DEVTOOLS_GLOBAL_HOOK__;
1661
- hook2.on(DevToolsHooks.APP_INIT, (app, version) => {
1662
- var _a8, _b8, _c;
1663
- if ((_c = (_b8 = (_a8 = app == null ? void 0 : app._instance) == null ? void 0 : _a8.type) == null ? void 0 : _b8.devtools) == null ? void 0 : _c.hide)
1669
+ hook2.on("app:init" /* APP_INIT */, (app, version) => {
1670
+ var _a10, _b10, _c;
1671
+ if ((_c = (_b10 = (_a10 = app == null ? void 0 : app._instance) == null ? void 0 : _a10.type) == null ? void 0 : _b10.devtools) == null ? void 0 : _c.hide)
1664
1672
  return;
1665
- devtoolsHooks.callHook(DevToolsHooks.APP_INIT, app, version);
1673
+ devtoolsHooks.callHook("app:init" /* APP_INIT */, app, version);
1666
1674
  });
1667
- hook2.on(DevToolsHooks.COMPONENT_ADDED, async (app, uid, parentUid, component) => {
1668
- var _a8, _b8, _c;
1669
- if ((_c = (_b8 = (_a8 = app == null ? void 0 : app._instance) == null ? void 0 : _a8.type) == null ? void 0 : _b8.devtools) == null ? void 0 : _c.hide)
1675
+ hook2.on("component:added" /* COMPONENT_ADDED */, async (app, uid, parentUid, component) => {
1676
+ var _a10, _b10, _c;
1677
+ if ((_c = (_b10 = (_a10 = app == null ? void 0 : app._instance) == null ? void 0 : _a10.type) == null ? void 0 : _b10.devtools) == null ? void 0 : _c.hide)
1670
1678
  return;
1671
1679
  if (!app || typeof uid !== "number" && !uid || !component)
1672
1680
  return;
1673
- devtoolsHooks.callHook(DevToolsHooks.COMPONENT_ADDED, app, uid, parentUid, component);
1681
+ devtoolsHooks.callHook("component:added" /* COMPONENT_ADDED */, app, uid, parentUid, component);
1674
1682
  });
1675
- hook2.on(DevToolsHooks.COMPONENT_UPDATED, (app, uid, parentUid, component) => {
1683
+ hook2.on("component:updated" /* COMPONENT_UPDATED */, (app, uid, parentUid, component) => {
1676
1684
  if (!app || typeof uid !== "number" && !uid || !component)
1677
1685
  return;
1678
- devtoolsHooks.callHook(DevToolsHooks.COMPONENT_UPDATED, app, uid, parentUid, component);
1686
+ devtoolsHooks.callHook("component:updated" /* COMPONENT_UPDATED */, app, uid, parentUid, component);
1679
1687
  });
1680
- hook2.on(DevToolsHooks.COMPONENT_REMOVED, async (app, uid, parentUid, component) => {
1688
+ hook2.on("component:removed" /* COMPONENT_REMOVED */, async (app, uid, parentUid, component) => {
1681
1689
  if (!app || typeof uid !== "number" && !uid || !component)
1682
1690
  return;
1683
- devtoolsHooks.callHook(DevToolsHooks.COMPONENT_REMOVED, app, uid, parentUid, component);
1691
+ devtoolsHooks.callHook("component:removed" /* COMPONENT_REMOVED */, app, uid, parentUid, component);
1684
1692
  });
1685
- hook2.on(DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, (pluginDescriptor, setupFn) => {
1686
- devtoolsHooks.callHook(DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, pluginDescriptor, setupFn);
1693
+ hook2.on("devtools-plugin:setup" /* SETUP_DEVTOOLS_PLUGIN */, (pluginDescriptor, setupFn) => {
1694
+ devtoolsHooks.callHook("devtools-plugin:setup" /* SETUP_DEVTOOLS_PLUGIN */, pluginDescriptor, setupFn);
1687
1695
  });
1688
1696
  }
1689
1697
  var hook = {
1690
- on
1698
+ on,
1699
+ setupDevToolsPlugin(pluginDescriptor, setupFn) {
1700
+ return devtoolsHooks.callHook("devtools-plugin:setup" /* SETUP_DEVTOOLS_PLUGIN */, pluginDescriptor, setupFn);
1701
+ }
1691
1702
  };
1692
1703
 
1704
+ // src/state/index.ts
1705
+ init_esm_shims();
1706
+
1707
+ // src/state/state.ts
1708
+ init_esm_shims();
1709
+ import { target as global2 } from "@vue/devtools-shared";
1710
+ import { debounce as debounce3 } from "perfect-debounce";
1711
+
1712
+ // src/api/index.ts
1713
+ init_esm_shims();
1714
+
1715
+ // src/api/api.ts
1716
+ init_esm_shims();
1717
+
1718
+ // src/core/timeline/index.ts
1719
+ init_esm_shims();
1720
+ function addTimelineLayer(payload) {
1721
+ devtoolsContext.timelineLayer.push(payload);
1722
+ }
1723
+
1724
+ // src/core/inspector/index.ts
1725
+ init_esm_shims();
1726
+ function addInspector(payload) {
1727
+ devtoolsContext.inspector.push(payload);
1728
+ }
1729
+ function getInspector(inspectorId) {
1730
+ return devtoolsContext.inspector.find((inspector) => inspector.id === inspectorId);
1731
+ }
1732
+ function updateInspector(inspectorId, payload) {
1733
+ const inspector = getInspector(inspectorId);
1734
+ inspector && Object.assign(inspector, payload);
1735
+ }
1736
+
1737
+ // src/core/app-record/index.ts
1738
+ init_esm_shims();
1739
+ var import_speakingurl = __toESM(require_speakingurl2(), 1);
1740
+
1741
+ // src/api/plugin.ts
1742
+ init_esm_shims();
1743
+
1693
1744
  // src/core/router/index.ts
1694
- var RouterInfoKey = "__VUE_DEVTOOLS_ROUTER_INFO__";
1695
- var RouterKey = "__VUE_DEVTOOLS_ROUTER__";
1745
+ init_esm_shims();
1746
+ import { deepClone, target as global } from "@vue/devtools-shared";
1747
+ import { debounce } from "perfect-debounce";
1748
+
1749
+ // src/api/hook.ts
1750
+ init_esm_shims();
1751
+ import { target as target2 } from "@vue/devtools-shared";
1752
+ import { createHooks as createHooks2 } from "hookable";
1696
1753
  var _a2, _b2;
1697
- (_b2 = (_a2 = global)[RouterInfoKey]) != null ? _b2 : _a2[RouterInfoKey] = {
1698
- currentRoute: null,
1699
- routes: [],
1700
- router: null
1701
- };
1702
- var _a3, _b3;
1703
- (_b3 = (_a3 = global)[RouterKey]) != null ? _b3 : _a3[RouterKey] = null;
1704
- var devtoolsRouterInfo = new Proxy(global[RouterInfoKey], {
1705
- get(target8, property) {
1706
- return global[RouterInfoKey][property];
1754
+ var apiHooks = (_b2 = (_a2 = target2).__VUE_DEVTOOLS_API_HOOK) != null ? _b2 : _a2.__VUE_DEVTOOLS_API_HOOK = createHooks2();
1755
+
1756
+ // src/core/router/index.ts
1757
+ function getRoutes(router) {
1758
+ const routesMap = /* @__PURE__ */ new Map();
1759
+ return ((router == null ? void 0 : router.getRoutes()) || []).filter((i) => !routesMap.has(i.path) && routesMap.set(i.path, 1));
1760
+ }
1761
+ function filterRoutes(routes) {
1762
+ return routes.map((item) => {
1763
+ let { path, name, children } = item;
1764
+ if (children == null ? void 0 : children.length)
1765
+ children = filterRoutes(children);
1766
+ return {
1767
+ path,
1768
+ name,
1769
+ children
1770
+ };
1771
+ });
1772
+ }
1773
+ function filterCurrentRoute(route) {
1774
+ if (route) {
1775
+ const { fullPath, hash, href, path, name, matched, params, query } = route;
1776
+ return {
1777
+ fullPath,
1778
+ hash,
1779
+ href,
1780
+ path,
1781
+ name,
1782
+ params,
1783
+ query,
1784
+ matched: filterRoutes(matched)
1785
+ };
1707
1786
  }
1708
- });
1787
+ return route;
1788
+ }
1709
1789
  function normalizeRouterInfo(appRecord) {
1710
- const getRoutes = (router) => {
1711
- const routesMap = /* @__PURE__ */ new Map();
1712
- return ((router == null ? void 0 : router.getRoutes()) || []).filter((i) => !routesMap.has(i.path) && routesMap.set(i.path, 1));
1713
- };
1714
- function filterRoutes(routes) {
1715
- return routes.map((item) => {
1716
- let { path, name, children } = item;
1717
- if (children == null ? void 0 : children.length)
1718
- children = filterRoutes(children);
1719
- return {
1720
- path,
1721
- name,
1722
- children
1723
- };
1724
- });
1725
- }
1726
- function filterCurrentRoute(route) {
1727
- if (route) {
1728
- const { fullPath, hash, href, path, name, matched, params, query } = route;
1729
- return {
1730
- fullPath,
1731
- hash,
1732
- href,
1733
- path,
1734
- name,
1735
- params,
1736
- query,
1737
- matched: filterRoutes(matched)
1738
- };
1739
- }
1740
- return route;
1741
- }
1742
1790
  function init() {
1743
- var _a8;
1744
- const router = (_a8 = appRecord.app) == null ? void 0 : _a8.config.globalProperties.$router;
1791
+ var _a10;
1792
+ const router = (_a10 = appRecord.app) == null ? void 0 : _a10.config.globalProperties.$router;
1745
1793
  const currentRoute = filterCurrentRoute(router == null ? void 0 : router.currentRoute.value);
1746
1794
  const routes = filterRoutes(getRoutes(router));
1747
1795
  const c = console.warn;
1748
1796
  console.warn = () => {
1749
1797
  };
1750
- global[RouterInfoKey] = {
1798
+ global[ROUTER_INFO_KEY] = {
1751
1799
  currentRoute: currentRoute ? deepClone(currentRoute) : {},
1752
1800
  routes: deepClone(routes)
1753
1801
  };
1754
- global[RouterKey] = router;
1802
+ global[ROUTER_KEY] = router;
1755
1803
  console.warn = c;
1756
1804
  }
1757
1805
  init();
1758
1806
  hook.on.componentUpdated(debounce(() => {
1759
1807
  init();
1760
- apiHooks.callHook("router-info:updated" /* ROUTER_INFO_UPDATED */, global[RouterInfoKey]);
1808
+ apiHooks.callHook("router-info:updated" /* ROUTER_INFO_UPDATED */, global[ROUTER_INFO_KEY]);
1761
1809
  }, 200));
1762
1810
  }
1763
1811
  function getRouterDevToolsId(id) {
1764
1812
  return id.replace(/\D/g, "") || "0";
1765
1813
  }
1766
1814
 
1767
- // src/core/general/state.ts
1768
- var StateKey = "__VUE_DEVTOOLS_GLOBAL_STATE__";
1769
- var ContextKey = "__VUE_DEVTOOLS_CONTEXT__";
1770
- var DefaultContext = {
1771
- appRecord: null,
1772
- api: null,
1773
- inspector: [],
1774
- timelineLayer: [],
1775
- routerInfo: {},
1776
- router: null,
1777
- activeInspectorTreeId: "",
1778
- componentPluginHookBuffer: []
1779
- };
1780
- var _a4, _b4;
1781
- (_b4 = (_a4 = global2)[StateKey]) != null ? _b4 : _a4[StateKey] = {
1782
- connected: false,
1783
- clientConnected: false,
1784
- appRecords: [],
1785
- activeAppRecord: null,
1786
- selectedComponentId: null,
1787
- pluginBuffer: [],
1788
- tabs: [],
1789
- commands: [],
1790
- vitePluginDetected: false,
1791
- activeAppRecordId: null
1792
- };
1793
- var _a5, _b5;
1794
- (_b5 = (_a5 = global2)[ContextKey]) != null ? _b5 : _a5[ContextKey] = deepClone2(DefaultContext);
1795
- var callStateUpdatedHook = debounce2((state, oldState) => {
1796
- apiHooks.callHook("devtools:state-updated" /* DEVTOOLS_STATE_UPDATED */, state, oldState);
1797
- }, 80);
1798
- var callConnectedUpdatedHook = debounce2((state, oldState) => {
1799
- apiHooks.callHook("devtools:connected-updated" /* DEVTOOLS_CONNECTED_UPDATED */, state, oldState);
1800
- }, 80);
1801
- var devtoolsState = new Proxy(global2[StateKey], {
1802
- get(target8, property) {
1803
- return global2[StateKey][property];
1804
- },
1805
- set(target8, property, value) {
1806
- var _a8;
1807
- const oldState = { ...global2[StateKey] };
1808
- target8[property] = value;
1809
- global2[StateKey][property] = value;
1810
- if (property === "activeAppRecord") {
1811
- global2[ContextKey].appRecord = value;
1812
- global2[ContextKey].api = value.api;
1813
- global2[ContextKey].inspector = (_a8 = value.inspector) != null ? _a8 : [];
1814
- normalizeRouterInfo(value);
1815
- global2[ContextKey].routerInfo = devtoolsRouterInfo;
1815
+ // src/api/plugin.ts
1816
+ function collectDevToolsPlugin(pluginDescriptor, setupFn) {
1817
+ devtoolsState.pluginBuffer.push([pluginDescriptor, setupFn]);
1818
+ }
1819
+ function setupDevToolsPlugin(pluginDescriptor, setupFn) {
1820
+ return hook.setupDevToolsPlugin(pluginDescriptor, setupFn);
1821
+ }
1822
+ function registerPlugin(app, api) {
1823
+ const plugins = devtoolsState.pluginBuffer.filter(([plugin]) => plugin.app === app);
1824
+ plugins.forEach(async ([plugin, setupFn]) => {
1825
+ if (plugin.packageName === "vue-query") {
1826
+ return;
1816
1827
  }
1817
- callStateUpdatedHook(global2[StateKey], oldState);
1818
- if (["connected", "clientConnected"].includes(property.toString()) && oldState[property] !== value)
1819
- callConnectedUpdatedHook(global2[StateKey], oldState);
1820
- return true;
1821
- },
1822
- deleteProperty(target8, property) {
1823
- delete target8[property];
1824
- return true;
1825
- }
1826
- });
1827
- Object.defineProperty(devtoolsState.tabs, "push", {
1828
- configurable: true,
1829
- value(...items) {
1830
- const result = Array.prototype.push.apply(this, items);
1831
- devtoolsState.tabs = this;
1832
- apiHooks.callHook("custom-tabs:updated" /* CUSTOM_TABS_UPDATED */, this);
1833
- return result;
1834
- }
1835
- });
1836
- ["push", "splice"].forEach((method) => {
1837
- Object.defineProperty(devtoolsState.commands, method, {
1838
- configurable: true,
1839
- value(...args) {
1840
- const result = Array.prototype[method].apply(this, args);
1841
- devtoolsState.commands = this;
1842
- apiHooks.callHook("custom-commands:updated" /* CUSTOM_COMMANDS_UPDATED */, this);
1843
- return result;
1828
+ if (plugin.packageName === "vue-router") {
1829
+ const id = getRouterDevToolsId(`${plugin.id}`);
1830
+ if (plugin.app === app) {
1831
+ devtoolsAppRecords.value = devtoolsAppRecords.value.map((item) => ({
1832
+ ...item,
1833
+ routerId: id
1834
+ }));
1835
+ }
1844
1836
  }
1837
+ setupFn(api);
1838
+ });
1839
+ devtoolsAppRecords.value = devtoolsAppRecords.value.map((record) => {
1840
+ var _a10, _b10;
1841
+ const globalProperties = (_b10 = (_a10 = record.app) == null ? void 0 : _a10.config) == null ? void 0 : _b10.globalProperties;
1842
+ if (!globalProperties)
1843
+ return record;
1844
+ return {
1845
+ ...record,
1846
+ moduleDetectives: {
1847
+ vueRouter: !!globalProperties.$router,
1848
+ pinia: !!globalProperties.$pinia,
1849
+ vueI18n: !!globalProperties.$i18n
1850
+ }
1851
+ };
1845
1852
  });
1846
- });
1847
- var devtoolsContext = new Proxy(global2[ContextKey], {
1848
- get(target8, property) {
1849
- if (property === "router")
1850
- return global2[RouterKey];
1851
- else if (property === "clear")
1852
- return clearDevToolsContext;
1853
- return global2[ContextKey][property];
1854
- },
1855
- set(target8, property, value) {
1856
- if (property === "componentPluginHookBuffer")
1857
- global2[ContextKey][property] = value;
1858
- return true;
1859
- }
1860
- });
1861
- function clearDevToolsContext() {
1862
- global2[ContextKey] = deepClone2(DefaultContext);
1863
1853
  }
1864
1854
 
1865
- // src/shared/index.ts
1866
- init_esm_shims();
1867
-
1868
- // src/shared/util.ts
1869
- init_esm_shims();
1870
-
1871
- // src/core/component/state/replacer.ts
1872
- init_esm_shims();
1873
-
1874
- // src/core/component/state/constants.ts
1855
+ // src/plugins/index.ts
1875
1856
  init_esm_shims();
1876
- var vueBuiltins = /* @__PURE__ */ new Set([
1877
- "nextTick",
1878
- "defineComponent",
1879
- "defineAsyncComponent",
1880
- "defineCustomElement",
1881
- "ref",
1882
- "computed",
1883
- "reactive",
1884
- "readonly",
1885
- "watchEffect",
1886
- "watchPostEffect",
1887
- "watchSyncEffect",
1888
- "watch",
1889
- "isRef",
1890
- "unref",
1891
- "toRef",
1892
- "toRefs",
1893
- "isProxy",
1894
- "isReactive",
1895
- "isReadonly",
1896
- "shallowRef",
1897
- "triggerRef",
1898
- "customRef",
1899
- "shallowReactive",
1900
- "shallowReadonly",
1901
- "toRaw",
1902
- "markRaw",
1903
- "effectScope",
1904
- "getCurrentScope",
1905
- "onScopeDispose",
1906
- "onMounted",
1907
- "onUpdated",
1908
- "onUnmounted",
1909
- "onBeforeMount",
1910
- "onBeforeUpdate",
1911
- "onBeforeUnmount",
1912
- "onErrorCaptured",
1913
- "onRenderTracked",
1914
- "onRenderTriggered",
1915
- "onActivated",
1916
- "onDeactivated",
1917
- "onServerPrefetch",
1918
- "provide",
1919
- "inject",
1920
- "h",
1921
- "mergeProps",
1922
- "cloneVNode",
1923
- "isVNode",
1924
- "resolveComponent",
1925
- "resolveDirective",
1926
- "withDirectives",
1927
- "withModifiers"
1928
- ]);
1929
- var symbolRE = /^\[native Symbol Symbol\((.*)\)\]$/;
1930
- var rawTypeRE = /^\[object (\w+)]$/;
1931
- var specialTypeRE = /^\[native (\w+) (.*?)(<>((.|\s)*))?\]$/;
1932
- var fnTypeRE = /^(?:function|class) (\w+)/;
1933
- var MAX_STRING_SIZE = 1e4;
1934
- var MAX_ARRAY_SIZE = 5e3;
1935
- var UNDEFINED = "__vue_devtool_undefined__";
1936
- var INFINITY = "__vue_devtool_infinity__";
1937
- var NEGATIVE_INFINITY = "__vue_devtool_negative_infinity__";
1938
- var NAN = "__vue_devtool_nan__";
1939
- var ESC = {
1940
- "<": "&lt;",
1941
- ">": "&gt;",
1942
- '"': "&quot;",
1943
- "&": "&amp;"
1944
- };
1945
1857
 
1946
- // src/core/component/state/custom.ts
1858
+ // src/plugins/component.ts
1947
1859
  init_esm_shims();
1860
+ import { debounce as debounce2 } from "perfect-debounce";
1948
1861
 
1949
- // src/core/component/general/util.ts
1862
+ // src/core/component/utils/index.ts
1950
1863
  init_esm_shims();
1951
1864
  import { basename, classify } from "@vue/devtools-shared";
1952
1865
  import { Fragment } from "vue";
@@ -1988,21 +1901,21 @@ async function getComponentId(options) {
1988
1901
  }
1989
1902
  }
1990
1903
  function isFragment(instance) {
1991
- var _a8;
1992
- const subTreeType = (_a8 = instance.subTree) == null ? void 0 : _a8.type;
1904
+ var _a10;
1905
+ const subTreeType = (_a10 = instance.subTree) == null ? void 0 : _a10.type;
1993
1906
  return subTreeType === Fragment;
1994
1907
  }
1995
1908
  function isBeingDestroyed(instance) {
1996
1909
  return instance._isBeingDestroyed || instance.isUnmounted;
1997
1910
  }
1998
1911
  function getInstanceName(instance) {
1999
- var _a8, _b8, _c;
1912
+ var _a10, _b10, _c;
2000
1913
  const name = getComponentTypeName(instance.type || {});
2001
1914
  if (name)
2002
1915
  return name;
2003
1916
  if (instance.root === instance)
2004
1917
  return "Root";
2005
- for (const key in (_b8 = (_a8 = instance.parent) == null ? void 0 : _a8.type) == null ? void 0 : _b8.components) {
1918
+ for (const key in (_b10 = (_a10 = instance.parent) == null ? void 0 : _a10.type) == null ? void 0 : _b10.components) {
2006
1919
  if (instance.parent.type.components[key] === instance.type)
2007
1920
  return saveComponentGussedName(instance, key);
2008
1921
  }
@@ -2016,8 +1929,8 @@ function getInstanceName(instance) {
2016
1929
  return "Anonymous Component";
2017
1930
  }
2018
1931
  function getUniqueComponentId(instance) {
2019
- var _a8, _b8, _c;
2020
- const appId = (_c = (_b8 = (_a8 = instance == null ? void 0 : instance.appContext) == null ? void 0 : _a8.app) == null ? void 0 : _b8.__VUE_DEVTOOLS_APP_RECORD_ID__) != null ? _c : 0;
1932
+ var _a10, _b10, _c;
1933
+ const appId = (_c = (_b10 = (_a10 = instance == null ? void 0 : instance.appContext) == null ? void 0 : _a10.app) == null ? void 0 : _b10.__VUE_DEVTOOLS_APP_RECORD_ID__) != null ? _c : 0;
2021
1934
  const instanceId = instance === instance.root ? "root" : instance.uid;
2022
1935
  return `${appId}:${instanceId}`;
2023
1936
  }
@@ -2046,1648 +1959,1854 @@ function getComponentInstance(appRecord, instanceId) {
2046
1959
  return instance || appRecord.instanceMap.get(":root");
2047
1960
  }
2048
1961
 
2049
- // src/core/component/state/process.ts
2050
- init_esm_shims();
2051
- import { camelize } from "@vue/devtools-shared";
2052
-
2053
- // src/core/component/state/util.ts
2054
- init_esm_shims();
2055
-
2056
- // src/core/component/state/is.ts
1962
+ // src/core/component/state/bounding-rect.ts
2057
1963
  init_esm_shims();
2058
- function isVueInstance(value) {
2059
- return value._ && Object.keys(value._).includes("vnode");
2060
- }
2061
- function isPlainObject(obj) {
2062
- return Object.prototype.toString.call(obj) === "[object Object]";
2063
- }
2064
- function isPrimitive(data) {
2065
- if (data == null)
2066
- return true;
2067
- const type = typeof data;
2068
- return type === "string" || type === "number" || type === "boolean";
2069
- }
2070
- function isRef(raw) {
2071
- return !!raw.__v_isRef;
1964
+ function createRect() {
1965
+ const rect = {
1966
+ top: 0,
1967
+ bottom: 0,
1968
+ left: 0,
1969
+ right: 0,
1970
+ get width() {
1971
+ return rect.right - rect.left;
1972
+ },
1973
+ get height() {
1974
+ return rect.bottom - rect.top;
1975
+ }
1976
+ };
1977
+ return rect;
2072
1978
  }
2073
- function isComputed(raw) {
2074
- return isRef(raw) && !!raw.effect;
1979
+ var range;
1980
+ function getTextRect(node) {
1981
+ if (!range)
1982
+ range = document.createRange();
1983
+ range.selectNode(node);
1984
+ return range.getBoundingClientRect();
2075
1985
  }
2076
- function isReactive(raw) {
2077
- return !!raw.__v_isReactive;
1986
+ function getFragmentRect(vnode) {
1987
+ const rect = createRect();
1988
+ if (!vnode.children)
1989
+ return rect;
1990
+ for (let i = 0, l = vnode.children.length; i < l; i++) {
1991
+ const childVnode = vnode.children[i];
1992
+ let childRect;
1993
+ if (childVnode.component) {
1994
+ childRect = getComponentBoundingRect(childVnode.component);
1995
+ } else if (childVnode.el) {
1996
+ const el = childVnode.el;
1997
+ if (el.nodeType === 1 || el.getBoundingClientRect)
1998
+ childRect = el.getBoundingClientRect();
1999
+ else if (el.nodeType === 3 && el.data.trim())
2000
+ childRect = getTextRect(el);
2001
+ }
2002
+ if (childRect)
2003
+ mergeRects(rect, childRect);
2004
+ }
2005
+ return rect;
2078
2006
  }
2079
- function isReadOnly(raw) {
2080
- return !!raw.__v_isReadonly;
2007
+ function mergeRects(a, b) {
2008
+ if (!a.top || b.top < a.top)
2009
+ a.top = b.top;
2010
+ if (!a.bottom || b.bottom > a.bottom)
2011
+ a.bottom = b.bottom;
2012
+ if (!a.left || b.left < a.left)
2013
+ a.left = b.left;
2014
+ if (!a.right || b.right > a.right)
2015
+ a.right = b.right;
2016
+ return a;
2081
2017
  }
2082
-
2083
- // src/core/component/state/util.ts
2084
- var tokenMap = {
2085
- [UNDEFINED]: "undefined",
2086
- [NAN]: "NaN",
2087
- [INFINITY]: "Infinity",
2088
- [NEGATIVE_INFINITY]: "-Infinity"
2018
+ var DEFAULT_RECT = {
2019
+ top: 0,
2020
+ left: 0,
2021
+ right: 0,
2022
+ bottom: 0,
2023
+ width: 0,
2024
+ height: 0
2089
2025
  };
2090
- var reversedTokenMap = Object.entries(tokenMap).reduce((acc, [key, value]) => {
2091
- acc[value] = key;
2092
- return acc;
2093
- }, {});
2094
- function internalStateTokenToString(value) {
2095
- if (value === null)
2096
- return "null";
2097
- return typeof value === "string" && tokenMap[value] || false;
2098
- }
2099
- function replaceTokenToString(value) {
2100
- const replaceRegex = new RegExp(`"(${Object.keys(tokenMap).join("|")})"`, "g");
2101
- return value.replace(replaceRegex, (_, g1) => tokenMap[g1]);
2102
- }
2103
- function replaceStringToToken(value) {
2104
- const literalValue = reversedTokenMap[value.trim()];
2105
- if (literalValue)
2106
- return `"${literalValue}"`;
2107
- const replaceRegex = new RegExp(`:\\s*(${Object.keys(reversedTokenMap).join("|")})`, "g");
2108
- return value.replace(replaceRegex, (_, g1) => `:"${reversedTokenMap[g1]}"`);
2109
- }
2110
- function getPropType(type) {
2111
- if (Array.isArray(type))
2112
- return type.map((t) => getPropType(t)).join(" or ");
2113
- if (type == null)
2114
- return "null";
2115
- const match = type.toString().match(fnTypeRE);
2116
- return typeof type === "function" ? match && match[1] || "any" : "any";
2117
- }
2118
- function sanitize(data) {
2119
- if (!isPrimitive(data) && !Array.isArray(data) && !isPlainObject(data)) {
2120
- return Object.prototype.toString.call(data);
2121
- } else {
2122
- return data;
2026
+ function getComponentBoundingRect(instance) {
2027
+ const el = instance.subTree.el;
2028
+ if (typeof window === "undefined") {
2029
+ return DEFAULT_RECT;
2123
2030
  }
2031
+ if (isFragment(instance))
2032
+ return getFragmentRect(instance.subTree);
2033
+ else if ((el == null ? void 0 : el.nodeType) === 1)
2034
+ return el == null ? void 0 : el.getBoundingClientRect();
2035
+ else if (instance.subTree.component)
2036
+ return getComponentBoundingRect(instance.subTree.component);
2037
+ else
2038
+ return DEFAULT_RECT;
2124
2039
  }
2125
- function getSetupStateType(raw) {
2126
- return {
2127
- ref: isRef(raw),
2128
- computed: isComputed(raw),
2129
- reactive: isReactive(raw),
2130
- readonly: isReadOnly(raw)
2131
- };
2132
- }
2133
- function toRaw(value) {
2134
- if (value == null ? void 0 : value.__v_raw)
2135
- return value.__v_raw;
2136
- return value;
2040
+
2041
+ // src/core/component/tree/walker.ts
2042
+ init_esm_shims();
2043
+
2044
+ // src/core/component/tree/el.ts
2045
+ init_esm_shims();
2046
+ function getRootElementsFromComponentInstance(instance) {
2047
+ if (isFragment(instance))
2048
+ return getFragmentRootElements(instance.subTree);
2049
+ if (!instance.subTree)
2050
+ return [];
2051
+ return [instance.subTree.el];
2137
2052
  }
2138
- function escape(s) {
2139
- return s.replace(/[<>"&]/g, (s2) => {
2140
- return ESC[s2] || s2;
2053
+ function getFragmentRootElements(vnode) {
2054
+ if (!vnode.children)
2055
+ return [];
2056
+ const list = [];
2057
+ vnode.children.forEach((childVnode) => {
2058
+ if (childVnode.component)
2059
+ list.push(...getRootElementsFromComponentInstance(childVnode.component));
2060
+ else if (childVnode == null ? void 0 : childVnode.el)
2061
+ list.push(childVnode.el);
2141
2062
  });
2063
+ return list;
2142
2064
  }
2143
2065
 
2144
- // src/core/component/state/process.ts
2145
- function mergeOptions(to, from, instance) {
2146
- if (typeof from === "function")
2147
- from = from.options;
2148
- if (!from)
2149
- return to;
2150
- const { mixins, extends: extendsOptions } = from;
2151
- extendsOptions && mergeOptions(to, extendsOptions, instance);
2152
- mixins && mixins.forEach(
2153
- (m) => mergeOptions(to, m, instance)
2154
- );
2155
- for (const key of ["computed", "inject"]) {
2156
- if (Object.prototype.hasOwnProperty.call(from, key)) {
2157
- if (!to[key])
2158
- to[key] = from[key];
2159
- else
2160
- Object.assign(to[key], from[key]);
2161
- }
2066
+ // src/core/component/tree/filter.ts
2067
+ init_esm_shims();
2068
+ import { classify as classify2, kebabize } from "@vue/devtools-shared";
2069
+ var ComponentFilter = class {
2070
+ constructor(filter) {
2071
+ this.filter = filter || "";
2162
2072
  }
2163
- return to;
2164
- }
2165
- function resolveMergedOptions(instance) {
2166
- const raw = instance.type;
2167
- const { mixins, extends: extendsOptions } = raw;
2168
- const globalMixins = instance.appContext.mixins;
2169
- if (!globalMixins.length && !mixins && !extendsOptions)
2170
- return raw;
2171
- const options = {};
2172
- globalMixins.forEach((m) => mergeOptions(options, m, instance));
2173
- mergeOptions(options, raw, instance);
2174
- return options;
2175
- }
2176
- function processProps(instance) {
2177
- const props = [];
2178
- const propDefinitions = instance.type.props;
2179
- for (const key in instance.props) {
2180
- const propDefinition = propDefinitions ? propDefinitions[key] : null;
2181
- const camelizeKey = camelize(key);
2182
- props.push({
2183
- type: "props",
2184
- key: camelizeKey,
2185
- value: returnError(() => instance.props[key]),
2186
- meta: propDefinition ? {
2187
- type: propDefinition.type ? getPropType(propDefinition.type) : "any",
2188
- required: !!propDefinition.required,
2189
- ...propDefinition.default ? {
2190
- default: propDefinition.default.toString()
2191
- } : {}
2192
- } : { type: "invalid" }
2193
- });
2073
+ /**
2074
+ * Check if an instance is qualified.
2075
+ *
2076
+ * @param {Vue|Vnode} instance
2077
+ * @return {boolean}
2078
+ */
2079
+ isQualified(instance) {
2080
+ const name = getInstanceName(instance);
2081
+ return classify2(name).toLowerCase().includes(this.filter) || kebabize(name).toLowerCase().includes(this.filter);
2194
2082
  }
2195
- return props;
2196
- }
2197
- function processState(instance) {
2198
- const type = instance.type;
2199
- const props = type.props;
2200
- const getters = type.vuex && type.vuex.getters;
2201
- const computedDefs = type.computed;
2202
- const data = {
2203
- ...instance.data,
2204
- ...instance.renderContext
2205
- };
2206
- return Object.keys(data).filter((key) => !(props && key in props) && !(getters && key in getters) && !(computedDefs && key in computedDefs)).map((key) => ({
2207
- key,
2208
- type: "data",
2209
- value: returnError(() => data[key]),
2210
- editable: true
2211
- }));
2212
- }
2213
- function getStateTypeAndName(info) {
2214
- const stateType = info.computed ? "computed" : info.ref ? "ref" : info.reactive ? "reactive" : null;
2215
- const stateTypeName = stateType ? `${stateType.charAt(0).toUpperCase()}${stateType.slice(1)}` : null;
2216
- return {
2217
- stateType,
2218
- stateTypeName
2219
- };
2083
+ };
2084
+ function createComponentFilter(filterText) {
2085
+ return new ComponentFilter(filterText);
2220
2086
  }
2221
- function processSetupState(instance) {
2222
- const raw = instance.devtoolsRawSetupState || {};
2223
- return Object.keys(instance.setupState).filter((key) => !vueBuiltins.has(key) && key.split(/(?=[A-Z])/)[0] !== "use").map((key) => {
2224
- var _a8, _b8, _c, _d;
2225
- const value = returnError(() => toRaw(instance.setupState[key]));
2226
- const rawData = raw[key];
2227
- let result;
2228
- let isOtherType = typeof value === "function" || typeof (value == null ? void 0 : value.render) === "function" || typeof (value == null ? void 0 : value.__asyncLoader) === "function";
2229
- if (rawData) {
2230
- const info = getSetupStateType(rawData);
2231
- const { stateType, stateTypeName } = getStateTypeAndName(info);
2232
- const isState = info.ref || info.computed || info.reactive;
2233
- const raw2 = ((_b8 = (_a8 = rawData.effect) == null ? void 0 : _a8.raw) == null ? void 0 : _b8.toString()) || ((_d = (_c = rawData.effect) == null ? void 0 : _c.fn) == null ? void 0 : _d.toString());
2234
- if (stateType)
2235
- isOtherType = false;
2236
- result = {
2237
- ...stateType ? { stateType, stateTypeName } : {},
2238
- ...raw2 ? { raw: raw2 } : {},
2239
- editable: isState && !info.readonly
2240
- };
2241
- }
2242
- const type = isOtherType ? "setup (other)" : "setup";
2243
- return {
2244
- key,
2245
- value,
2246
- type,
2247
- // @ts-expect-error ignore
2248
- ...result
2249
- };
2250
- });
2251
- }
2252
- function processComputed(instance, mergedType) {
2253
- const type = mergedType;
2254
- const computed = [];
2255
- const defs = type.computed || {};
2256
- for (const key in defs) {
2257
- const def = defs[key];
2258
- const type2 = typeof def === "function" && def.vuex ? "vuex bindings" : "computed";
2259
- computed.push({
2260
- type: type2,
2261
- key,
2262
- value: returnError(() => {
2263
- var _a8;
2264
- return (_a8 = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a8[key];
2265
- }),
2266
- editable: typeof def.set === "function"
2267
- });
2087
+
2088
+ // src/core/component/tree/walker.ts
2089
+ var ComponentWalker = class {
2090
+ constructor(options) {
2091
+ // Dedupe instances (Some instances may be both on a component and on a child abstract/functional component)
2092
+ this.captureIds = /* @__PURE__ */ new Map();
2093
+ const { filterText = "", maxDepth, recursively } = options;
2094
+ this.componentFilter = createComponentFilter(filterText);
2095
+ this.maxDepth = maxDepth;
2096
+ this.recursively = recursively;
2268
2097
  }
2269
- return computed;
2270
- }
2271
- function processAttrs(instance) {
2272
- return Object.keys(instance.attrs).map((key) => ({
2273
- type: "attrs",
2274
- key,
2275
- value: returnError(() => instance.attrs[key])
2276
- }));
2277
- }
2278
- function processProvide(instance) {
2279
- return Reflect.ownKeys(instance.provides).map((key) => ({
2280
- type: "provided",
2281
- key: key.toString(),
2282
- value: returnError(() => instance.provides[key])
2283
- }));
2284
- }
2285
- function processInject(instance, mergedType) {
2286
- if (!(mergedType == null ? void 0 : mergedType.inject))
2287
- return [];
2288
- let keys = [];
2289
- let defaultValue;
2290
- if (Array.isArray(mergedType.inject)) {
2291
- keys = mergedType.inject.map((key) => ({
2292
- key,
2293
- originalKey: key
2294
- }));
2295
- } else {
2296
- keys = Reflect.ownKeys(mergedType.inject).map((key) => {
2297
- const value = mergedType.inject[key];
2298
- let originalKey;
2299
- if (typeof value === "string" || typeof value === "symbol") {
2300
- originalKey = value;
2301
- } else {
2302
- originalKey = value.from;
2303
- defaultValue = value.default;
2304
- }
2305
- return {
2306
- key,
2307
- originalKey
2308
- };
2309
- });
2098
+ getComponentTree(instance) {
2099
+ this.captureIds = /* @__PURE__ */ new Map();
2100
+ return this.findQualifiedChildren(instance, 0);
2310
2101
  }
2311
- return keys.map(({ key, originalKey }) => ({
2312
- type: "injected",
2313
- key: originalKey && key !== originalKey ? `${originalKey.toString()} \u279E ${key.toString()}` : key.toString(),
2314
- // eslint-disable-next-line no-prototype-builtins
2315
- value: returnError(() => instance.ctx.hasOwnProperty(key) ? instance.ctx[key] : instance.provides.hasOwnProperty(originalKey) ? instance.provides[originalKey] : defaultValue)
2316
- }));
2317
- }
2318
- function processRefs(instance) {
2319
- return Object.keys(instance.refs).map((key) => ({
2320
- type: "refs",
2321
- key,
2322
- value: returnError(() => instance.refs[key])
2323
- }));
2324
- }
2325
- function processEventListeners(instance) {
2326
- var _a8;
2327
- const emitsDefinition = instance.type.emits;
2328
- const declaredEmits = Array.isArray(emitsDefinition) ? emitsDefinition : Object.keys(emitsDefinition != null ? emitsDefinition : {});
2329
- const keys = Object.keys((_a8 = instance.vnode.props) != null ? _a8 : {});
2330
- const result = [];
2331
- for (const key of keys) {
2332
- const [prefix, ...eventNameParts] = key.split(/(?=[A-Z])/);
2333
- if (prefix === "on") {
2334
- const eventName = eventNameParts.join("-").toLowerCase();
2335
- const isDeclared = declaredEmits.includes(eventName);
2336
- result.push({
2337
- type: "event listeners",
2338
- key: eventName,
2339
- value: {
2340
- _custom: {
2341
- displayText: isDeclared ? "\u2705 Declared" : "\u26A0\uFE0F Not declared",
2342
- key: isDeclared ? "\u2705 Declared" : "\u26A0\uFE0F Not declared",
2343
- value: isDeclared ? "\u2705 Declared" : "\u26A0\uFE0F Not declared",
2344
- tooltipText: !isDeclared ? `The event <code>${eventName}</code> is not declared in the <code>emits</code> option. It will leak into the component's attributes (<code>$attrs</code>).` : null
2345
- }
2346
- }
2347
- });
2102
+ getComponentParents(instance) {
2103
+ this.captureIds = /* @__PURE__ */ new Map();
2104
+ const parents = [];
2105
+ this.captureId(instance);
2106
+ let parent = instance;
2107
+ while (parent = parent.parent) {
2108
+ this.captureId(parent);
2109
+ parents.push(parent);
2348
2110
  }
2111
+ return parents;
2349
2112
  }
2350
- return result;
2351
- }
2352
- function processInstanceState(instance) {
2353
- const mergedType = resolveMergedOptions(instance);
2354
- return processProps(instance).concat(
2355
- processState(instance),
2356
- processSetupState(instance),
2357
- processComputed(instance, mergedType),
2358
- processAttrs(instance),
2359
- processProvide(instance),
2360
- processInject(instance, mergedType),
2361
- processRefs(instance),
2362
- processEventListeners(instance)
2363
- );
2364
- }
2365
-
2366
- // src/core/component/state/custom.ts
2367
- function getFunctionDetails(func) {
2368
- let string = "";
2369
- let matches = null;
2370
- try {
2371
- string = Function.prototype.toString.call(func);
2372
- matches = String.prototype.match.call(string, /\([\s\S]*?\)/);
2373
- } catch (e) {
2113
+ captureId(instance) {
2114
+ if (!instance)
2115
+ return null;
2116
+ const id = instance.__VUE_DEVTOOLS_UID__ != null ? instance.__VUE_DEVTOOLS_UID__ : getUniqueComponentId(instance);
2117
+ instance.__VUE_DEVTOOLS_UID__ = id;
2118
+ if (this.captureIds.has(id))
2119
+ return null;
2120
+ else
2121
+ this.captureIds.set(id, void 0);
2122
+ this.mark(instance);
2123
+ return id;
2374
2124
  }
2375
- const match = matches && matches[0];
2376
- const args = typeof match === "string" ? match : "(?)";
2377
- const name = typeof func.name === "string" ? func.name : "";
2378
- return {
2379
- _custom: {
2380
- type: "function",
2381
- displayText: `<span style="opacity:.5;">function</span> ${escape(name)}${args}`,
2382
- tooltipText: string.trim() ? `<pre>${string}</pre>` : null
2383
- }
2384
- };
2385
- }
2386
- function getBigIntDetails(val) {
2387
- const stringifiedBigInt = BigInt.prototype.toString.call(val);
2388
- return {
2389
- _custom: {
2390
- type: "bigint",
2391
- displayText: `BigInt(${stringifiedBigInt})`,
2392
- value: stringifiedBigInt
2125
+ /**
2126
+ * Capture the meta information of an instance. (recursive)
2127
+ *
2128
+ * @param {Vue} instance
2129
+ * @return {object}
2130
+ */
2131
+ async capture(instance, depth) {
2132
+ var _a10;
2133
+ if (!instance)
2134
+ return null;
2135
+ const id = this.captureId(instance);
2136
+ const name = getInstanceName(instance);
2137
+ const children = this.getInternalInstanceChildren(instance.subTree).filter((child) => !isBeingDestroyed(child));
2138
+ const parents = this.getComponentParents(instance) || [];
2139
+ const inactive = !!instance.isDeactivated || parents.some((parent) => parent.isDeactivated);
2140
+ const treeNode = {
2141
+ uid: instance.uid,
2142
+ id,
2143
+ name,
2144
+ renderKey: getRenderKey(instance.vnode ? instance.vnode.key : null),
2145
+ inactive,
2146
+ children: [],
2147
+ isFragment: isFragment(instance),
2148
+ tags: typeof instance.type !== "function" ? [] : [
2149
+ {
2150
+ label: "functional",
2151
+ textColor: 5592405,
2152
+ backgroundColor: 15658734
2153
+ }
2154
+ ],
2155
+ autoOpen: this.recursively,
2156
+ file: instance.type.__file || ""
2157
+ };
2158
+ if (depth < this.maxDepth || instance.type.__isKeepAlive || parents.some((parent) => parent.type.__isKeepAlive)) {
2159
+ treeNode.children = await Promise.all(children.map((child) => this.capture(child, depth + 1)).filter(Boolean));
2393
2160
  }
2394
- };
2395
- }
2396
- function getMapDetails(val) {
2397
- const list = [];
2398
- val.forEach(
2399
- (value, key) => list.push({
2400
- key,
2401
- value
2402
- })
2403
- );
2404
- return {
2405
- _custom: {
2406
- type: "map",
2407
- displayText: "Map",
2408
- value: list,
2409
- readOnly: true,
2410
- fields: {
2411
- abstract: true
2161
+ if (this.isKeepAlive(instance)) {
2162
+ const cachedComponents = this.getKeepAliveCachedInstances(instance);
2163
+ const childrenIds = children.map((child) => child.__VUE_DEVTOOLS_UID__);
2164
+ for (const cachedChild of cachedComponents) {
2165
+ if (!childrenIds.includes(cachedChild.__VUE_DEVTOOLS_UID__)) {
2166
+ const node = await this.capture({ ...cachedChild, isDeactivated: true }, depth + 1);
2167
+ if (node)
2168
+ treeNode.children.push(node);
2169
+ }
2412
2170
  }
2413
2171
  }
2414
- };
2415
- }
2416
- function getSetDetails(val) {
2417
- const list = Array.from(val);
2418
- return {
2419
- _custom: {
2420
- type: "set",
2421
- displayText: `Set[${list.length}]`,
2422
- value: list,
2423
- readOnly: true
2424
- }
2425
- };
2426
- }
2427
- function getCatchedGetters(store) {
2428
- const getters = {};
2429
- const origGetters = store.getters || {};
2430
- const keys = Object.keys(origGetters);
2431
- for (let i = 0; i < keys.length; i++) {
2432
- const key = keys[i];
2433
- Object.defineProperty(getters, key, {
2434
- enumerable: true,
2435
- get: () => {
2436
- try {
2437
- return origGetters[key];
2438
- } catch (e) {
2439
- return e;
2440
- }
2441
- }
2172
+ const rootElements = getRootElementsFromComponentInstance(instance);
2173
+ const firstElement = rootElements[0];
2174
+ if (firstElement == null ? void 0 : firstElement.parentElement) {
2175
+ const parentInstance = instance.parent;
2176
+ const parentRootElements = parentInstance ? getRootElementsFromComponentInstance(parentInstance) : [];
2177
+ let el = firstElement;
2178
+ const indexList = [];
2179
+ do {
2180
+ indexList.push(Array.from(el.parentElement.childNodes).indexOf(el));
2181
+ el = el.parentElement;
2182
+ } while (el.parentElement && parentRootElements.length && !parentRootElements.includes(el));
2183
+ treeNode.domOrder = indexList.reverse();
2184
+ } else {
2185
+ treeNode.domOrder = [-1];
2186
+ }
2187
+ if ((_a10 = instance.suspense) == null ? void 0 : _a10.suspenseKey) {
2188
+ treeNode.tags.push({
2189
+ label: instance.suspense.suspenseKey,
2190
+ backgroundColor: 14979812,
2191
+ textColor: 16777215
2192
+ });
2193
+ this.mark(instance, true);
2194
+ }
2195
+ devtoolsContext.api.visitComponentTree({
2196
+ treeNode,
2197
+ componentInstance: instance,
2198
+ app: instance.appContext.app,
2199
+ filter: this.componentFilter.filter
2442
2200
  });
2201
+ return treeNode;
2443
2202
  }
2444
- return getters;
2445
- }
2446
- function reduceStateList(list) {
2447
- if (!list.length)
2448
- return void 0;
2449
- return list.reduce((map, item) => {
2450
- const key = item.type || "data";
2451
- const obj = map[key] = map[key] || {};
2452
- obj[item.key] = item.value;
2453
- return map;
2454
- }, {});
2455
- }
2456
- function namedNodeMapToObject(map) {
2457
- const result = {};
2458
- const l = map.length;
2459
- for (let i = 0; i < l; i++) {
2460
- const node = map.item(i);
2461
- result[node.name] = node.value;
2462
- }
2463
- return result;
2464
- }
2465
- function getStoreDetails(store) {
2466
- return {
2467
- _custom: {
2468
- type: "store",
2469
- displayText: "Store",
2470
- value: {
2471
- state: store.state,
2472
- getters: getCatchedGetters(store)
2473
- },
2474
- fields: {
2475
- abstract: true
2476
- }
2477
- }
2478
- };
2479
- }
2480
- function getRouterDetails(router) {
2481
- return {
2482
- _custom: {
2483
- type: "router",
2484
- displayText: "VueRouter",
2485
- value: {
2486
- options: router.options,
2487
- currentRoute: router.currentRoute
2488
- },
2489
- fields: {
2490
- abstract: true
2491
- }
2203
+ /**
2204
+ * Find qualified children from a single instance.
2205
+ * If the instance itself is qualified, just return itself.
2206
+ * This is ok because [].concat works in both cases.
2207
+ *
2208
+ * @param {Vue|Vnode} instance
2209
+ * @return {Vue|Array}
2210
+ */
2211
+ async findQualifiedChildren(instance, depth) {
2212
+ var _a10;
2213
+ if (this.componentFilter.isQualified(instance) && !((_a10 = instance.type.devtools) == null ? void 0 : _a10.hide)) {
2214
+ return [await this.capture(instance, depth)];
2215
+ } else if (instance.subTree) {
2216
+ const list = this.isKeepAlive(instance) ? this.getKeepAliveCachedInstances(instance) : this.getInternalInstanceChildren(instance.subTree);
2217
+ return this.findQualifiedChildrenFromList(list, depth);
2218
+ } else {
2219
+ return [];
2492
2220
  }
2493
- };
2494
- }
2495
- function getInstanceDetails(instance) {
2496
- if (instance._)
2497
- instance = instance._;
2498
- const state = processInstanceState(instance);
2499
- return {
2500
- _custom: {
2501
- type: "component",
2502
- id: instance.__VUE_DEVTOOLS_UID__,
2503
- displayText: getInstanceName(instance),
2504
- tooltipText: "Component instance",
2505
- value: reduceStateList(state),
2506
- fields: {
2507
- abstract: true
2221
+ }
2222
+ /**
2223
+ * Iterate through an array of instances and flatten it into
2224
+ * an array of qualified instances. This is a depth-first
2225
+ * traversal - e.g. if an instance is not matched, we will
2226
+ * recursively go deeper until a qualified child is found.
2227
+ *
2228
+ * @param {Array} instances
2229
+ * @return {Array}
2230
+ */
2231
+ async findQualifiedChildrenFromList(instances, depth) {
2232
+ instances = instances.filter((child) => {
2233
+ var _a10;
2234
+ return !isBeingDestroyed(child) && !((_a10 = child.type.devtools) == null ? void 0 : _a10.hide);
2235
+ });
2236
+ if (!this.componentFilter.filter)
2237
+ return Promise.all(instances.map((child) => this.capture(child, depth)));
2238
+ else
2239
+ return Array.prototype.concat.apply([], await Promise.all(instances.map((i) => this.findQualifiedChildren(i, depth))));
2240
+ }
2241
+ /**
2242
+ * Get children from a component instance.
2243
+ */
2244
+ getInternalInstanceChildren(subTree, suspense = null) {
2245
+ const list = [];
2246
+ if (subTree) {
2247
+ if (subTree.component) {
2248
+ !suspense ? list.push(subTree.component) : list.push({ ...subTree.component, suspense });
2249
+ } else if (subTree.suspense) {
2250
+ const suspenseKey = !subTree.suspense.isInFallback ? "suspense default" : "suspense fallback";
2251
+ list.push(...this.getInternalInstanceChildren(subTree.suspense.activeBranch, { ...subTree.suspense, suspenseKey }));
2252
+ } else if (Array.isArray(subTree.children)) {
2253
+ subTree.children.forEach((childSubTree) => {
2254
+ if (childSubTree.component)
2255
+ !suspense ? list.push(childSubTree.component) : list.push({ ...childSubTree.component, suspense });
2256
+ else
2257
+ list.push(...this.getInternalInstanceChildren(childSubTree, suspense));
2258
+ });
2508
2259
  }
2509
2260
  }
2510
- };
2511
- }
2512
- function getComponentDefinitionDetails(definition) {
2513
- let display = getComponentName(definition);
2514
- if (display) {
2515
- if (definition.name && definition.__file)
2516
- display += ` <span>(${definition.__file})</span>`;
2517
- } else {
2518
- display = "<i>Unknown Component</i>";
2261
+ return list.filter((child) => {
2262
+ var _a10;
2263
+ return !isBeingDestroyed(child) && !((_a10 = child.type.devtools) == null ? void 0 : _a10.hide);
2264
+ });
2519
2265
  }
2520
- return {
2521
- _custom: {
2522
- type: "component-definition",
2523
- displayText: display,
2524
- tooltipText: "Component definition",
2525
- ...definition.__file ? {
2526
- file: definition.__file
2527
- } : {}
2528
- }
2529
- };
2530
- }
2531
- function getHTMLElementDetails(value) {
2532
- try {
2533
- return {
2534
- _custom: {
2535
- type: "HTMLElement",
2536
- displayText: `<span class="opacity-30">&lt;</span><span class="text-blue-500">${value.tagName.toLowerCase()}</span><span class="opacity-30">&gt;</span>`,
2537
- value: namedNodeMapToObject(value.attributes)
2538
- }
2539
- };
2540
- } catch (e) {
2541
- return {
2542
- _custom: {
2543
- type: "HTMLElement",
2544
- displayText: `<span class="text-blue-500">${String(value)}</span>`
2545
- }
2546
- };
2266
+ /**
2267
+ * Mark an instance as captured and store it in the instance map.
2268
+ *
2269
+ * @param {Vue} instance
2270
+ */
2271
+ mark(instance, force = false) {
2272
+ const instanceMap = getAppRecord(instance).instanceMap;
2273
+ if (force || !instanceMap.has(instance.__VUE_DEVTOOLS_UID__))
2274
+ instanceMap.set(instance.__VUE_DEVTOOLS_UID__, instance);
2547
2275
  }
2548
- }
2549
- function getObjectDetails(object) {
2550
- var _a8, _b8, _c, _d;
2551
- const info = getSetupStateType(object);
2552
- const isState = info.ref || info.computed || info.reactive;
2553
- if (isState) {
2554
- const stateTypeName = info.computed ? "Computed" : info.ref ? "Ref" : info.reactive ? "Reactive" : null;
2555
- const value = toRaw(info.reactive ? object : object._value);
2556
- const raw = ((_b8 = (_a8 = object.effect) == null ? void 0 : _a8.raw) == null ? void 0 : _b8.toString()) || ((_d = (_c = object.effect) == null ? void 0 : _c.fn) == null ? void 0 : _d.toString());
2557
- return {
2558
- _custom: {
2559
- type: stateTypeName == null ? void 0 : stateTypeName.toLowerCase(),
2560
- stateTypeName,
2561
- value,
2562
- ...raw ? { tooltipText: `<span class="font-mono">${raw}</span>` } : {}
2563
- }
2564
- };
2276
+ isKeepAlive(instance) {
2277
+ return instance.type.__isKeepAlive && instance.__v_cache;
2565
2278
  }
2566
- if (typeof object.__asyncLoader === "function") {
2567
- return {
2568
- _custom: {
2569
- type: "component-definition",
2570
- display: "Async component definition"
2571
- }
2572
- };
2279
+ getKeepAliveCachedInstances(instance) {
2280
+ return Array.from(instance.__v_cache.values()).map((vnode) => vnode.component).filter(Boolean);
2573
2281
  }
2574
- }
2282
+ };
2575
2283
 
2576
- // src/core/component/state/replacer.ts
2577
- function stringifyReplacer(key) {
2578
- var _a8;
2579
- if (key === "compilerOptions")
2580
- return;
2581
- const val = this[key];
2582
- const type = typeof val;
2583
- if (Array.isArray(val)) {
2584
- const l = val.length;
2585
- if (l > MAX_ARRAY_SIZE) {
2586
- return {
2587
- _isArray: true,
2588
- length: l,
2589
- items: val.slice(0, MAX_ARRAY_SIZE)
2590
- };
2284
+ // src/core/component/state/editor.ts
2285
+ init_esm_shims();
2286
+ import { isReactive, isRef, toRaw } from "vue";
2287
+ var StateEditor = class {
2288
+ constructor() {
2289
+ this.refEditor = new RefStateEditor();
2290
+ }
2291
+ set(object, path, value, cb) {
2292
+ const sections = Array.isArray(path) ? path : path.split(".");
2293
+ const markRef = false;
2294
+ while (sections.length > 1) {
2295
+ const section = sections.shift();
2296
+ if (object instanceof Map)
2297
+ object = object.get(section);
2298
+ else
2299
+ object = object[section];
2300
+ if (this.refEditor.isRef(object))
2301
+ object = this.refEditor.get(object);
2591
2302
  }
2592
- return val;
2593
- } else if (typeof val === "string") {
2594
- if (val.length > MAX_STRING_SIZE)
2595
- return `${val.substring(0, MAX_STRING_SIZE)}... (${val.length} total length)`;
2596
- else
2597
- return val;
2598
- } else if (type === "undefined") {
2599
- return UNDEFINED;
2600
- } else if (val === Number.POSITIVE_INFINITY) {
2601
- return INFINITY;
2602
- } else if (val === Number.NEGATIVE_INFINITY) {
2603
- return NEGATIVE_INFINITY;
2604
- } else if (typeof val === "function") {
2605
- return getFunctionDetails(val);
2606
- } else if (type === "symbol") {
2607
- return `[native Symbol ${Symbol.prototype.toString.call(val)}]`;
2608
- } else if (typeof val === "bigint") {
2609
- return getBigIntDetails(val);
2610
- } else if (val !== null && typeof val === "object") {
2611
- const proto = Object.prototype.toString.call(val);
2612
- if (proto === "[object Map]") {
2613
- return getMapDetails(val);
2614
- } else if (proto === "[object Set]") {
2615
- return getSetDetails(val);
2616
- } else if (proto === "[object RegExp]") {
2617
- return `[native RegExp ${RegExp.prototype.toString.call(val)}]`;
2618
- } else if (proto === "[object Date]") {
2619
- return `[native Date ${Date.prototype.toString.call(val)}]`;
2620
- } else if (proto === "[object Error]") {
2621
- return `[native Error ${val.message}<>${val.stack}]`;
2622
- } else if (val.state && val._vm) {
2623
- return getStoreDetails(val);
2624
- } else if (val.constructor && val.constructor.name === "VueRouter") {
2625
- return getRouterDetails(val);
2626
- } else if (isVueInstance(val)) {
2627
- return getInstanceDetails(val);
2628
- } else if (typeof val.render === "function") {
2629
- return getComponentDefinitionDetails(val);
2630
- } else if (val.constructor && val.constructor.name === "VNode") {
2631
- return `[native VNode <${val.tag}>]`;
2632
- } else if (typeof HTMLElement !== "undefined" && val instanceof HTMLElement) {
2633
- return getHTMLElementDetails(val);
2634
- } else if (((_a8 = val.constructor) == null ? void 0 : _a8.name) === "Store" && val._wrappedGetters) {
2635
- return "[object Store]";
2636
- } else if (val.currentRoute) {
2637
- return "[object Router]";
2303
+ const field = sections[0];
2304
+ const item = this.refEditor.get(object)[field];
2305
+ if (cb) {
2306
+ cb(object, field, value);
2307
+ } else {
2308
+ if (this.refEditor.isRef(item))
2309
+ this.refEditor.set(item, value);
2310
+ else if (markRef)
2311
+ object[field] = value;
2312
+ else
2313
+ object[field] = value;
2638
2314
  }
2639
- const customDetails = getObjectDetails(val);
2640
- if (customDetails != null)
2641
- return customDetails;
2642
- } else if (Number.isNaN(val)) {
2643
- return NAN;
2644
- }
2645
- return sanitize(val);
2646
- }
2647
-
2648
- // src/core/component/state/reviver.ts
2649
- init_esm_shims();
2650
- import { target as target2 } from "@vue/devtools-shared";
2651
- function reviveSet(val) {
2652
- const result = /* @__PURE__ */ new Set();
2653
- const list = val._custom.value;
2654
- for (let i = 0; i < list.length; i++) {
2655
- const value = list[i];
2656
- result.add(revive(value));
2657
- }
2658
- return result;
2659
- }
2660
- function reviveMap(val) {
2661
- const result = /* @__PURE__ */ new Map();
2662
- const list = val._custom.value;
2663
- for (let i = 0; i < list.length; i++) {
2664
- const { key, value } = list[i];
2665
- result.set(key, revive(value));
2666
- }
2667
- return result;
2668
- }
2669
- function revive(val) {
2670
- var _a8;
2671
- if (val === UNDEFINED) {
2672
- return void 0;
2673
- } else if (val === INFINITY) {
2674
- return Number.POSITIVE_INFINITY;
2675
- } else if (val === NEGATIVE_INFINITY) {
2676
- return Number.NEGATIVE_INFINITY;
2677
- } else if (val === NAN) {
2678
- return Number.NaN;
2679
- } else if (val && val._custom) {
2680
- const { _custom: custom } = val;
2681
- if (custom.type === "component")
2682
- return (_a8 = devtoolsContext.appRecord) == null ? void 0 : _a8.instanceMap.get(custom.id);
2683
- else if (custom.type === "map")
2684
- return reviveMap(val);
2685
- else if (custom.type === "set")
2686
- return reviveSet(val);
2687
- else if (custom.type === "bigint")
2688
- return BigInt(custom.value);
2689
- else
2690
- return revive(custom.value);
2691
- } else if (symbolRE.test(val)) {
2692
- const [, string] = symbolRE.exec(val);
2693
- return Symbol.for(string);
2694
- } else if (specialTypeRE.test(val)) {
2695
- const [, type, string, , details] = specialTypeRE.exec(val);
2696
- const result = new target2[type](string);
2697
- if (type === "Error" && details)
2698
- result.stack = details;
2699
- return result;
2700
- } else {
2701
- return val;
2702
2315
  }
2703
- }
2704
- function reviver(key, value) {
2705
- return revive(value);
2706
- }
2707
-
2708
- // src/shared/transfer.ts
2709
- init_esm_shims();
2710
- var MAX_SERIALIZED_SIZE = 512 * 1024;
2711
- function encode(data, replacer, list, seen) {
2712
- let stored, key, value, i, l;
2713
- const seenIndex = seen.get(data);
2714
- if (seenIndex != null)
2715
- return seenIndex;
2716
- const index = list.length;
2717
- const proto = Object.prototype.toString.call(data);
2718
- if (proto === "[object Object]") {
2719
- stored = {};
2720
- seen.set(data, index);
2721
- list.push(stored);
2722
- const keys = Object.keys(data);
2723
- for (i = 0, l = keys.length; i < l; i++) {
2724
- key = keys[i];
2725
- try {
2726
- if (key === "compilerOptions")
2727
- return;
2728
- value = data[key];
2729
- if (replacer)
2730
- value = replacer.call(data, key, value);
2731
- } catch (e) {
2732
- value = e;
2733
- }
2734
- stored[key] = encode(value, replacer, list, seen);
2316
+ get(object, path) {
2317
+ const sections = Array.isArray(path) ? path : path.split(".");
2318
+ for (let i = 0; i < sections.length; i++) {
2319
+ if (object instanceof Map)
2320
+ object = object.get(sections[i]);
2321
+ else
2322
+ object = object[sections[i]];
2323
+ if (this.refEditor.isRef(object))
2324
+ object = this.refEditor.get(object);
2325
+ if (!object)
2326
+ return void 0;
2735
2327
  }
2736
- } else if (proto === "[object Array]") {
2737
- stored = [];
2738
- seen.set(data, index);
2739
- list.push(stored);
2740
- for (i = 0, l = data.length; i < l; i++) {
2741
- try {
2742
- value = data[i];
2743
- if (replacer)
2744
- value = replacer.call(data, i, value);
2745
- } catch (e) {
2746
- value = e;
2747
- }
2748
- stored[i] = encode(value, replacer, list, seen);
2328
+ return object;
2329
+ }
2330
+ has(object, path, parent = false) {
2331
+ if (typeof object === "undefined")
2332
+ return false;
2333
+ const sections = Array.isArray(path) ? path.slice() : path.split(".");
2334
+ const size = !parent ? 1 : 2;
2335
+ while (object && sections.length > size) {
2336
+ const section = sections.shift();
2337
+ object = object[section];
2338
+ if (this.refEditor.isRef(object))
2339
+ object = this.refEditor.get(object);
2749
2340
  }
2750
- } else {
2751
- list.push(data);
2341
+ return object != null && Object.prototype.hasOwnProperty.call(object, sections[0]);
2752
2342
  }
2753
- return index;
2754
- }
2755
- function decode(list, reviver2 = null) {
2756
- let i = list.length;
2757
- let j, k, data, key, value, proto;
2758
- while (i--) {
2759
- data = list[i];
2760
- proto = Object.prototype.toString.call(data);
2761
- if (proto === "[object Object]") {
2762
- const keys = Object.keys(data);
2763
- for (j = 0, k = keys.length; j < k; j++) {
2764
- key = keys[j];
2765
- value = list[data[key]];
2766
- if (reviver2)
2767
- value = reviver2.call(data, key, value);
2768
- data[key] = value;
2343
+ createDefaultSetCallback(state) {
2344
+ return (object, field, value) => {
2345
+ if (state.remove || state.newKey) {
2346
+ if (Array.isArray(object))
2347
+ object.splice(field, 1);
2348
+ else if (toRaw(object) instanceof Map)
2349
+ object.delete(field);
2350
+ else if (toRaw(object) instanceof Set)
2351
+ object.delete(value);
2352
+ else
2353
+ Reflect.deleteProperty(object, field);
2769
2354
  }
2770
- } else if (proto === "[object Array]") {
2771
- for (j = 0, k = data.length; j < k; j++) {
2772
- value = list[data[j]];
2773
- if (reviver2)
2774
- value = reviver2.call(data, j, value);
2775
- data[j] = value;
2355
+ if (!state.remove) {
2356
+ const target9 = object[state.newKey || field];
2357
+ if (this.refEditor.isRef(target9))
2358
+ this.refEditor.set(target9, value);
2359
+ else if (toRaw(object) instanceof Map)
2360
+ object.set(state.newKey || field, value);
2361
+ else
2362
+ object[state.newKey || field] = value;
2776
2363
  }
2364
+ };
2365
+ }
2366
+ };
2367
+ var RefStateEditor = class {
2368
+ set(ref, value) {
2369
+ if (isRef(ref)) {
2370
+ ref.value = value;
2371
+ } else {
2372
+ const previousKeysSet = new Set(Object.keys(ref));
2373
+ const currentKeys = Object.keys(value);
2374
+ currentKeys.forEach((key) => {
2375
+ Reflect.set(ref, key, Reflect.get(value, key));
2376
+ previousKeysSet.delete(key);
2377
+ });
2378
+ previousKeysSet.forEach((key) => Reflect.deleteProperty(ref, key));
2777
2379
  }
2778
2380
  }
2779
- }
2780
- function stringifyCircularAutoChunks(data, replacer = null, space = null) {
2781
- let result;
2782
- try {
2783
- result = arguments.length === 1 ? JSON.stringify(data) : JSON.stringify(data, replacer, space);
2784
- } catch (e) {
2785
- result = stringifyStrictCircularAutoChunks(data, replacer, space);
2381
+ get(ref) {
2382
+ return isRef(ref) ? ref.value : ref;
2786
2383
  }
2787
- if (result.length > MAX_SERIALIZED_SIZE) {
2788
- const chunkCount = Math.ceil(result.length / MAX_SERIALIZED_SIZE);
2789
- const chunks = [];
2790
- for (let i = 0; i < chunkCount; i++)
2791
- chunks.push(result.slice(i * MAX_SERIALIZED_SIZE, (i + 1) * MAX_SERIALIZED_SIZE));
2792
- return chunks;
2384
+ isRef(ref) {
2385
+ return isRef(ref) || isReactive(ref);
2386
+ }
2387
+ };
2388
+ async function editComponentState(payload, stateEditor2) {
2389
+ const { path, nodeId, state, type } = payload;
2390
+ const instance = getComponentInstance(devtoolsContext.appRecord, nodeId);
2391
+ if (!instance)
2392
+ return;
2393
+ const targetPath = path.slice();
2394
+ let target9;
2395
+ if (instance.devtoolsRawSetupState && Object.keys(instance.devtoolsRawSetupState).includes(path[0])) {
2396
+ target9 = instance.devtoolsRawSetupState;
2397
+ }
2398
+ if (target9 && targetPath) {
2399
+ if (state.type === "object" && type === "reactive") {
2400
+ }
2401
+ stateEditor2.set(target9, targetPath, state.value, stateEditor2.createDefaultSetCallback(state));
2793
2402
  }
2794
- return result;
2795
- }
2796
- function stringifyStrictCircularAutoChunks(data, replacer = null, space = null) {
2797
- const list = [];
2798
- encode(data, replacer, list, /* @__PURE__ */ new Map());
2799
- return space ? ` ${JSON.stringify(list, null, space)}` : ` ${JSON.stringify(list)}`;
2800
2403
  }
2801
- function parseCircularAutoChunks(data, reviver2 = null) {
2802
- if (Array.isArray(data))
2803
- data = data.join("");
2804
- const hasCircular = /^\s/.test(data);
2805
- if (!hasCircular) {
2806
- return arguments.length === 1 ? JSON.parse(data) : JSON.parse(data, reviver2);
2807
- } else {
2808
- const list = JSON.parse(data);
2809
- decode(list, reviver2);
2810
- return list[0];
2811
- }
2404
+ var stateEditor = new StateEditor();
2405
+ async function editState(payload) {
2406
+ editComponentState(payload, stateEditor);
2812
2407
  }
2813
2408
 
2814
- // src/core/component/state/format.ts
2409
+ // src/core/component/state/index.ts
2815
2410
  init_esm_shims();
2816
- function getInspectorStateValueType(value, raw = true) {
2817
- const type = typeof value;
2818
- if (value == null || value === UNDEFINED) {
2819
- return "null";
2820
- } else if (type === "boolean" || type === "number" || value === INFINITY || value === NEGATIVE_INFINITY || value === NAN) {
2821
- return "literal";
2822
- } else if (value == null ? void 0 : value._custom) {
2823
- if (raw || value._custom.display != null || value._custom.displayText != null)
2824
- return "custom";
2825
- else
2826
- return getInspectorStateValueType(value._custom.value);
2827
- } else if (typeof value === "string") {
2828
- const typeMatch = specialTypeRE.exec(value);
2829
- if (typeMatch) {
2830
- const [, type2] = typeMatch;
2831
- return `native ${type2}`;
2832
- } else {
2833
- return "string";
2834
- }
2835
- } else if (Array.isArray(value) || (value == null ? void 0 : value._isArray)) {
2836
- return "array";
2837
- } else if (isPlainObject(value)) {
2838
- return "plain-object";
2839
- } else {
2840
- return "unknown";
2841
- }
2411
+
2412
+ // src/core/component/state/process.ts
2413
+ init_esm_shims();
2414
+ import { camelize } from "@vue/devtools-shared";
2415
+
2416
+ // src/core/component/state/constants.ts
2417
+ init_esm_shims();
2418
+ var vueBuiltins = /* @__PURE__ */ new Set([
2419
+ "nextTick",
2420
+ "defineComponent",
2421
+ "defineAsyncComponent",
2422
+ "defineCustomElement",
2423
+ "ref",
2424
+ "computed",
2425
+ "reactive",
2426
+ "readonly",
2427
+ "watchEffect",
2428
+ "watchPostEffect",
2429
+ "watchSyncEffect",
2430
+ "watch",
2431
+ "isRef",
2432
+ "unref",
2433
+ "toRef",
2434
+ "toRefs",
2435
+ "isProxy",
2436
+ "isReactive",
2437
+ "isReadonly",
2438
+ "shallowRef",
2439
+ "triggerRef",
2440
+ "customRef",
2441
+ "shallowReactive",
2442
+ "shallowReadonly",
2443
+ "toRaw",
2444
+ "markRaw",
2445
+ "effectScope",
2446
+ "getCurrentScope",
2447
+ "onScopeDispose",
2448
+ "onMounted",
2449
+ "onUpdated",
2450
+ "onUnmounted",
2451
+ "onBeforeMount",
2452
+ "onBeforeUpdate",
2453
+ "onBeforeUnmount",
2454
+ "onErrorCaptured",
2455
+ "onRenderTracked",
2456
+ "onRenderTriggered",
2457
+ "onActivated",
2458
+ "onDeactivated",
2459
+ "onServerPrefetch",
2460
+ "provide",
2461
+ "inject",
2462
+ "h",
2463
+ "mergeProps",
2464
+ "cloneVNode",
2465
+ "isVNode",
2466
+ "resolveComponent",
2467
+ "resolveDirective",
2468
+ "withDirectives",
2469
+ "withModifiers"
2470
+ ]);
2471
+ var symbolRE = /^\[native Symbol Symbol\((.*)\)\]$/;
2472
+ var rawTypeRE = /^\[object (\w+)]$/;
2473
+ var specialTypeRE = /^\[native (\w+) (.*?)(<>((.|\s)*))?\]$/;
2474
+ var fnTypeRE = /^(?:function|class) (\w+)/;
2475
+ var MAX_STRING_SIZE = 1e4;
2476
+ var MAX_ARRAY_SIZE = 5e3;
2477
+ var UNDEFINED = "__vue_devtool_undefined__";
2478
+ var INFINITY = "__vue_devtool_infinity__";
2479
+ var NEGATIVE_INFINITY = "__vue_devtool_negative_infinity__";
2480
+ var NAN = "__vue_devtool_nan__";
2481
+ var ESC = {
2482
+ "<": "&lt;",
2483
+ ">": "&gt;",
2484
+ '"': "&quot;",
2485
+ "&": "&amp;"
2486
+ };
2487
+
2488
+ // src/core/component/state/util.ts
2489
+ init_esm_shims();
2490
+
2491
+ // src/core/component/state/is.ts
2492
+ init_esm_shims();
2493
+ function isVueInstance(value) {
2494
+ return value._ && Object.keys(value._).includes("vnode");
2842
2495
  }
2843
- function formatInspectorStateValue(value, quotes = false) {
2844
- var _a8, _b8;
2845
- let result;
2846
- const type = getInspectorStateValueType(value, false);
2847
- if (type !== "custom" && (value == null ? void 0 : value._custom))
2848
- value = value._custom.value;
2849
- if (result = internalStateTokenToString(value)) {
2850
- return result;
2851
- } else if (type === "custom") {
2852
- const nestedName = ((_a8 = value._custom.value) == null ? void 0 : _a8._custom) && formatInspectorStateValue(value._custom.value);
2853
- return nestedName || value._custom.displayText || value._custom.display;
2854
- } else if (type === "array") {
2855
- return `Array[${value.length}]`;
2856
- } else if (type === "plain-object") {
2857
- return `Object${Object.keys(value).length ? "" : " (empty)"}`;
2858
- } else if (type == null ? void 0 : type.includes("native")) {
2859
- return escape((_b8 = specialTypeRE.exec(value)) == null ? void 0 : _b8[2]);
2860
- } else if (typeof value === "string") {
2861
- const typeMatch = value.match(rawTypeRE);
2862
- if (typeMatch)
2863
- value = escape(typeMatch[1]);
2864
- else if (quotes)
2865
- value = `<span>"</span>${escape(value)}<span>"</span>`;
2866
- else
2867
- value = escape(value);
2868
- value = value.replace(/ /g, "&nbsp;").replace(/\n/g, "<span>\\n</span>");
2869
- }
2870
- return value;
2496
+ function isPlainObject(obj) {
2497
+ return Object.prototype.toString.call(obj) === "[object Object]";
2871
2498
  }
2872
- function getRawValue(value) {
2873
- var _a8, _b8;
2874
- const isCustom = getInspectorStateValueType(value) === "custom";
2875
- let inherit = {};
2876
- if (isCustom) {
2877
- const data = value;
2878
- const customValue = (_a8 = data._custom) == null ? void 0 : _a8.value;
2879
- const nestedCustom = typeof customValue === "object" && customValue !== null && "_custom" in customValue ? getRawValue(customValue) : { inherit: void 0, value: void 0 };
2880
- inherit = nestedCustom.inherit || ((_b8 = data._custom) == null ? void 0 : _b8.fields) || {};
2881
- value = nestedCustom.value || customValue;
2882
- }
2883
- if (value && value._isArray)
2884
- value = value.items;
2885
- return { value, inherit };
2499
+ function isPrimitive(data) {
2500
+ if (data == null)
2501
+ return true;
2502
+ const type = typeof data;
2503
+ return type === "string" || type === "number" || type === "boolean";
2886
2504
  }
2887
- function toEdit(value) {
2888
- return replaceTokenToString(JSON.stringify(value));
2505
+ function isRef2(raw) {
2506
+ return !!raw.__v_isRef;
2889
2507
  }
2890
- function toSubmit(value) {
2891
- return JSON.parse(replaceStringToToken(value), reviver);
2508
+ function isComputed(raw) {
2509
+ return isRef2(raw) && !!raw.effect;
2892
2510
  }
2893
-
2894
- // src/shared/util.ts
2895
- function stringify(data) {
2896
- return stringifyCircularAutoChunks(data, stringifyReplacer);
2511
+ function isReactive2(raw) {
2512
+ return !!raw.__v_isReactive;
2897
2513
  }
2898
- function parse(data, revive2 = false) {
2899
- if (!data)
2900
- return {};
2901
- return revive2 ? parseCircularAutoChunks(data, reviver) : parseCircularAutoChunks(data);
2514
+ function isReadOnly(raw) {
2515
+ return !!raw.__v_isReadonly;
2902
2516
  }
2903
2517
 
2904
- // src/shared/time.ts
2905
- init_esm_shims();
2906
- function now() {
2907
- return Date.now();
2518
+ // src/core/component/state/util.ts
2519
+ var tokenMap = {
2520
+ [UNDEFINED]: "undefined",
2521
+ [NAN]: "NaN",
2522
+ [INFINITY]: "Infinity",
2523
+ [NEGATIVE_INFINITY]: "-Infinity"
2524
+ };
2525
+ var reversedTokenMap = Object.entries(tokenMap).reduce((acc, [key, value]) => {
2526
+ acc[value] = key;
2527
+ return acc;
2528
+ }, {});
2529
+ function internalStateTokenToString(value) {
2530
+ if (value === null)
2531
+ return "null";
2532
+ return typeof value === "string" && tokenMap[value] || false;
2908
2533
  }
2909
-
2910
- // src/shared/env.ts
2911
- init_esm_shims();
2912
-
2913
- // src/core/general/inspector.ts
2914
- init_esm_shims();
2915
- function addInspector(payload) {
2916
- devtoolsContext.inspector.push(payload);
2534
+ function replaceTokenToString(value) {
2535
+ const replaceRegex = new RegExp(`"(${Object.keys(tokenMap).join("|")})"`, "g");
2536
+ return value.replace(replaceRegex, (_, g1) => tokenMap[g1]);
2917
2537
  }
2918
- function getInspector(inspectorId) {
2919
- return devtoolsContext.inspector.find((inspector) => inspector.id === inspectorId);
2538
+ function replaceStringToToken(value) {
2539
+ const literalValue = reversedTokenMap[value.trim()];
2540
+ if (literalValue)
2541
+ return `"${literalValue}"`;
2542
+ const replaceRegex = new RegExp(`:\\s*(${Object.keys(reversedTokenMap).join("|")})`, "g");
2543
+ return value.replace(replaceRegex, (_, g1) => `:"${reversedTokenMap[g1]}"`);
2920
2544
  }
2921
- function updateInspector(inspectorId, payload) {
2922
- const inspector = getInspector(inspectorId);
2923
- inspector && Object.assign(inspector, payload);
2545
+ function getPropType(type) {
2546
+ if (Array.isArray(type))
2547
+ return type.map((t) => getPropType(t)).join(" or ");
2548
+ if (type == null)
2549
+ return "null";
2550
+ const match = type.toString().match(fnTypeRE);
2551
+ return typeof type === "function" ? match && match[1] || "any" : "any";
2924
2552
  }
2925
-
2926
- // src/core/timeline/index.ts
2927
- init_esm_shims();
2928
- function addTimelineLayer(payload) {
2929
- devtoolsContext.timelineLayer.push(payload);
2553
+ function sanitize(data) {
2554
+ if (!isPrimitive(data) && !Array.isArray(data) && !isPlainObject(data)) {
2555
+ return Object.prototype.toString.call(data);
2556
+ } else {
2557
+ return data;
2558
+ }
2559
+ }
2560
+ function getSetupStateType(raw) {
2561
+ return {
2562
+ ref: isRef2(raw),
2563
+ computed: isComputed(raw),
2564
+ reactive: isReactive2(raw),
2565
+ readonly: isReadOnly(raw)
2566
+ };
2567
+ }
2568
+ function toRaw2(value) {
2569
+ if (value == null ? void 0 : value.__v_raw)
2570
+ return value.__v_raw;
2571
+ return value;
2572
+ }
2573
+ function escape(s) {
2574
+ return s.replace(/[<>"&]/g, (s2) => {
2575
+ return ESC[s2] || s2;
2576
+ });
2930
2577
  }
2931
2578
 
2932
- // src/core/component/state/editor.ts
2933
- init_esm_shims();
2934
- import { isReactive as isReactive2, isRef as isRef2, toRaw as toRaw2 } from "vue";
2935
-
2936
- // src/core/component/general/index.ts
2937
- init_esm_shims();
2938
-
2939
- // src/core/component/state/editor.ts
2940
- var StateEditor = class {
2941
- constructor() {
2942
- this.refEditor = new RefStateEditor();
2943
- }
2944
- set(object, path, value, cb) {
2945
- const sections = Array.isArray(path) ? path : path.split(".");
2946
- const markRef = false;
2947
- while (sections.length > 1) {
2948
- const section = sections.shift();
2949
- object = object[section];
2950
- if (this.refEditor.isRef(object))
2951
- object = this.refEditor.get(object);
2952
- }
2953
- const field = sections[0];
2954
- const item = this.refEditor.get(object)[field];
2955
- if (cb) {
2956
- cb(object, field, value);
2957
- } else {
2958
- if (this.refEditor.isRef(item))
2959
- this.refEditor.set(item, value);
2960
- else if (markRef)
2961
- object[field] = value;
2579
+ // src/core/component/state/process.ts
2580
+ function mergeOptions(to, from, instance) {
2581
+ if (typeof from === "function")
2582
+ from = from.options;
2583
+ if (!from)
2584
+ return to;
2585
+ const { mixins, extends: extendsOptions } = from;
2586
+ extendsOptions && mergeOptions(to, extendsOptions, instance);
2587
+ mixins && mixins.forEach(
2588
+ (m) => mergeOptions(to, m, instance)
2589
+ );
2590
+ for (const key of ["computed", "inject"]) {
2591
+ if (Object.prototype.hasOwnProperty.call(from, key)) {
2592
+ if (!to[key])
2593
+ to[key] = from[key];
2962
2594
  else
2963
- object[field] = value;
2964
- }
2965
- }
2966
- get(object, path) {
2967
- const sections = Array.isArray(path) ? path : path.split(".");
2968
- for (let i = 0; i < sections.length; i++) {
2969
- object = object[sections[i]];
2970
- if (this.refEditor.isRef(object))
2971
- object = this.refEditor.get(object);
2972
- if (!object)
2973
- return void 0;
2974
- }
2975
- return object;
2976
- }
2977
- has(object, path, parent = false) {
2978
- if (typeof object === "undefined")
2979
- return false;
2980
- const sections = Array.isArray(path) ? path.slice() : path.split(".");
2981
- const size = !parent ? 1 : 2;
2982
- while (object && sections.length > size) {
2983
- const section = sections.shift();
2984
- object = object[section];
2985
- if (this.refEditor.isRef(object))
2986
- object = this.refEditor.get(object);
2987
- }
2988
- return object != null && Object.prototype.hasOwnProperty.call(object, sections[0]);
2989
- }
2990
- createDefaultSetCallback(state) {
2991
- return (object, field, value) => {
2992
- if (state.remove || state.newKey) {
2993
- if (Array.isArray(object))
2994
- object.splice(field, 1);
2995
- else if (toRaw2(object) instanceof Map && typeof value === "object" && value && "key" in value)
2996
- object.delete(value.key);
2997
- else if (toRaw2(object) instanceof Set)
2998
- object.delete(value);
2999
- else
3000
- Reflect.deleteProperty(object, field);
3001
- }
3002
- if (!state.remove) {
3003
- const target8 = object[state.newKey || field];
3004
- if (this.refEditor.isRef(target8))
3005
- this.refEditor.set(target8, value);
3006
- else
3007
- object[state.newKey || field] = value;
3008
- }
3009
- };
3010
- }
3011
- };
3012
- var RefStateEditor = class {
3013
- set(ref, value) {
3014
- if (isRef2(ref)) {
3015
- ref.value = value;
3016
- } else {
3017
- const previousKeys = Object.keys(ref);
3018
- const currentKeys = Object.keys(value);
3019
- if (previousKeys.length > currentKeys.length) {
3020
- const diffKeys = previousKeys.filter((key) => !currentKeys.includes(key));
3021
- diffKeys.forEach((key) => Reflect.deleteProperty(ref, key));
3022
- }
3023
- currentKeys.forEach((key) => {
3024
- Reflect.set(ref, key, Reflect.get(value, key));
3025
- });
3026
- }
3027
- }
3028
- get(ref) {
3029
- return isRef2(ref) ? ref.value : ref;
3030
- }
3031
- isRef(ref) {
3032
- return isRef2(ref) || isReactive2(ref);
3033
- }
3034
- };
3035
- async function editComponentState(payload, stateEditor2) {
3036
- const { path, nodeId, state, type } = payload;
3037
- const instance = getComponentInstance(devtoolsContext.appRecord, nodeId);
3038
- if (!instance)
3039
- return;
3040
- const targetPath = path.slice();
3041
- let target8;
3042
- if (instance.devtoolsRawSetupState && Object.keys(instance.devtoolsRawSetupState).includes(path[0])) {
3043
- target8 = instance.devtoolsRawSetupState;
3044
- }
3045
- if (target8 && targetPath) {
3046
- if (state.type === "object" && type === "reactive") {
2595
+ Object.assign(to[key], from[key]);
3047
2596
  }
3048
- stateEditor2.set(target8, targetPath, state.value, stateEditor2.createDefaultSetCallback(state));
3049
2597
  }
2598
+ return to;
3050
2599
  }
3051
- var stateEditor = new StateEditor();
3052
- async function editState(payload) {
3053
- editComponentState(payload, stateEditor);
2600
+ function resolveMergedOptions(instance) {
2601
+ const raw = instance.type;
2602
+ const { mixins, extends: extendsOptions } = raw;
2603
+ const globalMixins = instance.appContext.mixins;
2604
+ if (!globalMixins.length && !mixins && !extendsOptions)
2605
+ return raw;
2606
+ const options = {};
2607
+ globalMixins.forEach((m) => mergeOptions(options, m, instance));
2608
+ mergeOptions(options, raw, instance);
2609
+ return options;
3054
2610
  }
3055
-
3056
- // src/core/open-in-editor/index.ts
3057
- init_esm_shims();
3058
- import { target as target3 } from "@vue/devtools-shared";
3059
- function openInEditor(options = {}) {
3060
- const { file, line = 0, column = 0 } = options;
3061
- if (file) {
3062
- const baseUrl = window.location.origin;
3063
- if (target3.__VUE_DEVTOOLS_VITE_PLUGIN_DETECTED__) {
3064
- target3.__VUE_INSPECTOR__.openInEditor(baseUrl, file, line, column);
3065
- } else {
3066
- }
2611
+ function processProps(instance) {
2612
+ const props = [];
2613
+ const propDefinitions = instance.type.props;
2614
+ for (const key in instance.props) {
2615
+ const propDefinition = propDefinitions ? propDefinitions[key] : null;
2616
+ const camelizeKey = camelize(key);
2617
+ props.push({
2618
+ type: "props",
2619
+ key: camelizeKey,
2620
+ value: returnError(() => instance.props[key]),
2621
+ meta: propDefinition ? {
2622
+ type: propDefinition.type ? getPropType(propDefinition.type) : "any",
2623
+ required: !!propDefinition.required,
2624
+ ...propDefinition.default ? {
2625
+ default: propDefinition.default.toString()
2626
+ } : {}
2627
+ } : { type: "invalid" }
2628
+ });
3067
2629
  }
2630
+ return props;
3068
2631
  }
3069
-
3070
- // src/core/general/app-record.ts
3071
- init_esm_shims();
3072
-
3073
- // src/core/plugins/index.ts
3074
- init_esm_shims();
3075
-
3076
- // src/core/plugins/components.ts
3077
- init_esm_shims();
3078
- import { debounce as debounce3 } from "perfect-debounce";
3079
-
3080
- // src/api/plugin.ts
3081
- init_esm_shims();
3082
- import { DevToolsHooks as DevToolsHooks2 } from "@vue/devtools-schema";
3083
- function collectRegisteredPlugin(pluginDescriptor, setupFn) {
3084
- devtoolsState.pluginBuffer.push([pluginDescriptor, setupFn]);
2632
+ function processState(instance) {
2633
+ const type = instance.type;
2634
+ const props = type.props;
2635
+ const getters = type.vuex && type.vuex.getters;
2636
+ const computedDefs = type.computed;
2637
+ const data = {
2638
+ ...instance.data,
2639
+ ...instance.renderContext
2640
+ };
2641
+ return Object.keys(data).filter((key) => !(props && key in props) && !(getters && key in getters) && !(computedDefs && key in computedDefs)).map((key) => ({
2642
+ key,
2643
+ type: "data",
2644
+ value: returnError(() => data[key]),
2645
+ editable: true
2646
+ }));
3085
2647
  }
3086
- async function registerPlugin(options) {
3087
- const { app, api } = options;
3088
- const plugins = devtoolsState.pluginBuffer.filter(([plugin]) => plugin.app === app);
3089
- plugins.forEach(async ([plugin, setupFn]) => {
3090
- if (plugin.packageName === "vue-query") {
3091
- return;
3092
- }
3093
- const appRecord = await getAppRecord(plugin.app);
3094
- if (plugin.packageName === "vue-router") {
3095
- const id = getRouterDevToolsId(`${plugin.id}`);
3096
- if (plugin.app === app) {
3097
- devtoolsState.appRecords = devtoolsState.appRecords.map((item) => ({
3098
- ...item,
3099
- routerId: id
3100
- }));
3101
- }
2648
+ function getStateTypeAndName(info) {
2649
+ const stateType = info.computed ? "computed" : info.ref ? "ref" : info.reactive ? "reactive" : null;
2650
+ const stateTypeName = stateType ? `${stateType.charAt(0).toUpperCase()}${stateType.slice(1)}` : null;
2651
+ return {
2652
+ stateType,
2653
+ stateTypeName
2654
+ };
2655
+ }
2656
+ function processSetupState(instance) {
2657
+ const raw = instance.devtoolsRawSetupState || {};
2658
+ return Object.keys(instance.setupState).filter((key) => !vueBuiltins.has(key) && key.split(/(?=[A-Z])/)[0] !== "use").map((key) => {
2659
+ var _a10, _b10, _c, _d;
2660
+ const value = returnError(() => toRaw2(instance.setupState[key]));
2661
+ const rawData = raw[key];
2662
+ let result;
2663
+ let isOtherType = typeof value === "function" || typeof (value == null ? void 0 : value.render) === "function" || typeof (value == null ? void 0 : value.__asyncLoader) === "function";
2664
+ if (rawData) {
2665
+ const info = getSetupStateType(rawData);
2666
+ const { stateType, stateTypeName } = getStateTypeAndName(info);
2667
+ const isState = info.ref || info.computed || info.reactive;
2668
+ const raw2 = ((_b10 = (_a10 = rawData.effect) == null ? void 0 : _a10.raw) == null ? void 0 : _b10.toString()) || ((_d = (_c = rawData.effect) == null ? void 0 : _c.fn) == null ? void 0 : _d.toString());
2669
+ if (stateType)
2670
+ isOtherType = false;
2671
+ result = {
2672
+ ...stateType ? { stateType, stateTypeName } : {},
2673
+ ...raw2 ? { raw: raw2 } : {},
2674
+ editable: isState && !info.readonly
2675
+ };
3102
2676
  }
3103
- setupFn(api);
3104
- });
3105
- devtoolsState.appRecords = devtoolsState.appRecords.map((record) => {
3106
- var _a8, _b8;
3107
- const globalProperties = (_b8 = (_a8 = record.app) == null ? void 0 : _a8.config) == null ? void 0 : _b8.globalProperties;
3108
- if (!globalProperties)
3109
- return record;
2677
+ const type = isOtherType ? "setup (other)" : "setup";
3110
2678
  return {
3111
- ...record,
3112
- moduleDetectives: {
3113
- vueRouter: !!globalProperties.$router,
3114
- pinia: !!globalProperties.$pinia,
3115
- vueI18n: !!globalProperties.$i18n
3116
- }
2679
+ key,
2680
+ value,
2681
+ type,
2682
+ // @ts-expect-error ignore
2683
+ ...result
3117
2684
  };
3118
2685
  });
3119
2686
  }
3120
- function setupDevToolsPlugin(pluginDescriptor, setupFn) {
3121
- return devtoolsHooks.callHook(DevToolsHooks2.SETUP_DEVTOOLS_PLUGIN, pluginDescriptor, setupFn);
2687
+ function processComputed(instance, mergedType) {
2688
+ const type = mergedType;
2689
+ const computed = [];
2690
+ const defs = type.computed || {};
2691
+ for (const key in defs) {
2692
+ const def = defs[key];
2693
+ const type2 = typeof def === "function" && def.vuex ? "vuex bindings" : "computed";
2694
+ computed.push({
2695
+ type: type2,
2696
+ key,
2697
+ value: returnError(() => {
2698
+ var _a10;
2699
+ return (_a10 = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a10[key];
2700
+ }),
2701
+ editable: typeof def.set === "function"
2702
+ });
2703
+ }
2704
+ return computed;
3122
2705
  }
3123
-
3124
- // src/core/component/tree/walker.ts
3125
- init_esm_shims();
3126
-
3127
- // src/core/component/tree/el.ts
3128
- init_esm_shims();
3129
- function getRootElementsFromComponentInstance(instance) {
3130
- if (isFragment(instance))
3131
- return getFragmentRootElements(instance.subTree);
3132
- if (!instance.subTree)
3133
- return [];
3134
- return [instance.subTree.el];
2706
+ function processAttrs(instance) {
2707
+ return Object.keys(instance.attrs).map((key) => ({
2708
+ type: "attrs",
2709
+ key,
2710
+ value: returnError(() => instance.attrs[key])
2711
+ }));
3135
2712
  }
3136
- function getFragmentRootElements(vnode) {
3137
- if (!vnode.children)
3138
- return [];
3139
- const list = [];
3140
- vnode.children.forEach((childVnode) => {
3141
- if (childVnode.component)
3142
- list.push(...getRootElementsFromComponentInstance(childVnode.component));
3143
- else if (childVnode == null ? void 0 : childVnode.el)
3144
- list.push(childVnode.el);
3145
- });
3146
- return list;
2713
+ function processProvide(instance) {
2714
+ return Reflect.ownKeys(instance.provides).map((key) => ({
2715
+ type: "provided",
2716
+ key: key.toString(),
2717
+ value: returnError(() => instance.provides[key])
2718
+ }));
3147
2719
  }
3148
-
3149
- // src/core/component/tree/filter.ts
3150
- init_esm_shims();
3151
- import { classify as classify2, kebabize } from "@vue/devtools-shared";
3152
- var ComponentFilter = class {
3153
- constructor(filter) {
3154
- this.filter = filter || "";
3155
- }
3156
- /**
3157
- * Check if an instance is qualified.
3158
- *
3159
- * @param {Vue|Vnode} instance
3160
- * @return {boolean}
3161
- */
3162
- isQualified(instance) {
3163
- const name = getInstanceName(instance);
3164
- return classify2(name).toLowerCase().includes(this.filter) || kebabize(name).toLowerCase().includes(this.filter);
2720
+ function processInject(instance, mergedType) {
2721
+ if (!(mergedType == null ? void 0 : mergedType.inject))
2722
+ return [];
2723
+ let keys = [];
2724
+ let defaultValue;
2725
+ if (Array.isArray(mergedType.inject)) {
2726
+ keys = mergedType.inject.map((key) => ({
2727
+ key,
2728
+ originalKey: key
2729
+ }));
2730
+ } else {
2731
+ keys = Reflect.ownKeys(mergedType.inject).map((key) => {
2732
+ const value = mergedType.inject[key];
2733
+ let originalKey;
2734
+ if (typeof value === "string" || typeof value === "symbol") {
2735
+ originalKey = value;
2736
+ } else {
2737
+ originalKey = value.from;
2738
+ defaultValue = value.default;
2739
+ }
2740
+ return {
2741
+ key,
2742
+ originalKey
2743
+ };
2744
+ });
3165
2745
  }
3166
- };
3167
- function createComponentFilter(filterText) {
3168
- return new ComponentFilter(filterText);
2746
+ return keys.map(({ key, originalKey }) => ({
2747
+ type: "injected",
2748
+ key: originalKey && key !== originalKey ? `${originalKey.toString()} \u279E ${key.toString()}` : key.toString(),
2749
+ // eslint-disable-next-line no-prototype-builtins
2750
+ value: returnError(() => instance.ctx.hasOwnProperty(key) ? instance.ctx[key] : instance.provides.hasOwnProperty(originalKey) ? instance.provides[originalKey] : defaultValue)
2751
+ }));
3169
2752
  }
3170
-
3171
- // src/core/component/tree/walker.ts
3172
- var ComponentWalker = class {
3173
- constructor(options) {
3174
- // Dedupe instances (Some instances may be both on a component and on a child abstract/functional component)
3175
- this.captureIds = /* @__PURE__ */ new Map();
3176
- const { filterText = "", maxDepth, recursively } = options;
3177
- this.componentFilter = createComponentFilter(filterText);
3178
- this.maxDepth = maxDepth;
3179
- this.recursively = recursively;
3180
- }
3181
- getComponentTree(instance) {
3182
- this.captureIds = /* @__PURE__ */ new Map();
3183
- return this.findQualifiedChildren(instance, 0);
3184
- }
3185
- getComponentParents(instance) {
3186
- this.captureIds = /* @__PURE__ */ new Map();
3187
- const parents = [];
3188
- this.captureId(instance);
3189
- let parent = instance;
3190
- while (parent = parent.parent) {
3191
- this.captureId(parent);
3192
- parents.push(parent);
2753
+ function processRefs(instance) {
2754
+ return Object.keys(instance.refs).map((key) => ({
2755
+ type: "refs",
2756
+ key,
2757
+ value: returnError(() => instance.refs[key])
2758
+ }));
2759
+ }
2760
+ function processEventListeners(instance) {
2761
+ var _a10;
2762
+ const emitsDefinition = instance.type.emits;
2763
+ const declaredEmits = Array.isArray(emitsDefinition) ? emitsDefinition : Object.keys(emitsDefinition != null ? emitsDefinition : {});
2764
+ const keys = Object.keys((_a10 = instance.vnode.props) != null ? _a10 : {});
2765
+ const result = [];
2766
+ for (const key of keys) {
2767
+ const [prefix, ...eventNameParts] = key.split(/(?=[A-Z])/);
2768
+ if (prefix === "on") {
2769
+ const eventName = eventNameParts.join("-").toLowerCase();
2770
+ const isDeclared = declaredEmits.includes(eventName);
2771
+ result.push({
2772
+ type: "event listeners",
2773
+ key: eventName,
2774
+ value: {
2775
+ _custom: {
2776
+ displayText: isDeclared ? "\u2705 Declared" : "\u26A0\uFE0F Not declared",
2777
+ key: isDeclared ? "\u2705 Declared" : "\u26A0\uFE0F Not declared",
2778
+ value: isDeclared ? "\u2705 Declared" : "\u26A0\uFE0F Not declared",
2779
+ tooltipText: !isDeclared ? `The event <code>${eventName}</code> is not declared in the <code>emits</code> option. It will leak into the component's attributes (<code>$attrs</code>).` : null
2780
+ }
2781
+ }
2782
+ });
3193
2783
  }
3194
- return parents;
3195
2784
  }
3196
- captureId(instance) {
3197
- if (!instance)
3198
- return null;
3199
- const id = instance.__VUE_DEVTOOLS_UID__ != null ? instance.__VUE_DEVTOOLS_UID__ : getUniqueComponentId(instance);
3200
- instance.__VUE_DEVTOOLS_UID__ = id;
3201
- if (this.captureIds.has(id))
3202
- return null;
3203
- else
3204
- this.captureIds.set(id, void 0);
3205
- this.mark(instance);
3206
- return id;
3207
- }
3208
- /**
3209
- * Capture the meta information of an instance. (recursive)
3210
- *
3211
- * @param {Vue} instance
3212
- * @return {object}
3213
- */
3214
- async capture(instance, depth) {
3215
- var _a8;
3216
- if (!instance)
3217
- return null;
3218
- const id = this.captureId(instance);
3219
- const name = getInstanceName(instance);
3220
- const children = this.getInternalInstanceChildren(instance.subTree).filter((child) => !isBeingDestroyed(child));
3221
- const parents = this.getComponentParents(instance) || [];
3222
- const inactive = !!instance.isDeactivated || parents.some((parent) => parent.isDeactivated);
3223
- const treeNode = {
3224
- uid: instance.uid,
3225
- id,
3226
- name,
3227
- renderKey: getRenderKey(instance.vnode ? instance.vnode.key : null),
3228
- inactive,
3229
- children: [],
3230
- isFragment: isFragment(instance),
3231
- tags: typeof instance.type !== "function" ? [] : [
3232
- {
3233
- label: "functional",
3234
- textColor: 5592405,
3235
- backgroundColor: 15658734
2785
+ return result;
2786
+ }
2787
+ function processInstanceState(instance) {
2788
+ const mergedType = resolveMergedOptions(instance);
2789
+ return processProps(instance).concat(
2790
+ processState(instance),
2791
+ processSetupState(instance),
2792
+ processComputed(instance, mergedType),
2793
+ processAttrs(instance),
2794
+ processProvide(instance),
2795
+ processInject(instance, mergedType),
2796
+ processRefs(instance),
2797
+ processEventListeners(instance)
2798
+ );
2799
+ }
2800
+
2801
+ // src/core/component/state/index.ts
2802
+ function getInstanceState(params) {
2803
+ var _a10;
2804
+ const instance = getComponentInstance(devtoolsContext.appRecord, params.instanceId);
2805
+ const id = getUniqueComponentId(instance);
2806
+ const name = getInstanceName(instance);
2807
+ const file = (_a10 = instance == null ? void 0 : instance.type) == null ? void 0 : _a10.__file;
2808
+ const state = processInstanceState(instance);
2809
+ return {
2810
+ id,
2811
+ name,
2812
+ file,
2813
+ state,
2814
+ instance
2815
+ };
2816
+ }
2817
+
2818
+ // src/plugins/component.ts
2819
+ var INSPECTOR_ID = "components";
2820
+ function registerComponentDevToolsPlugin(app) {
2821
+ setupDevToolsPlugin({
2822
+ id: INSPECTOR_ID,
2823
+ label: "Components",
2824
+ app
2825
+ }, (api) => {
2826
+ api.addInspector({
2827
+ id: INSPECTOR_ID,
2828
+ label: "Components",
2829
+ treeFilterPlaceholder: "Search components"
2830
+ });
2831
+ api.on.getComponentBoundingRect((payload) => {
2832
+ if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
2833
+ const instance = getComponentInstance(devtoolsContext.appRecord, payload.instanceId);
2834
+ if (instance) {
2835
+ if (typeof DOMRect === "undefined")
2836
+ return;
2837
+ payload.rect = getComponentBoundingRect(instance);
2838
+ if (payload.rect instanceof DOMRect) {
2839
+ payload.rect = {
2840
+ top: payload.rect.top,
2841
+ left: payload.rect.left,
2842
+ right: payload.rect.right,
2843
+ bottom: payload.rect.bottom,
2844
+ width: payload.rect.width,
2845
+ height: payload.rect.height
2846
+ };
2847
+ }
3236
2848
  }
3237
- ],
3238
- autoOpen: this.recursively,
3239
- file: instance.type.__file || ""
3240
- };
3241
- if (depth < this.maxDepth || instance.type.__isKeepAlive || parents.some((parent) => parent.type.__isKeepAlive)) {
3242
- treeNode.children = await Promise.all(children.map((child) => this.capture(child, depth + 1)).filter(Boolean));
3243
- }
3244
- if (this.isKeepAlive(instance)) {
3245
- const cachedComponents = this.getKeepAliveCachedInstances(instance);
3246
- const childrenIds = children.map((child) => child.__VUE_DEVTOOLS_UID__);
3247
- for (const cachedChild of cachedComponents) {
3248
- if (!childrenIds.includes(cachedChild.__VUE_DEVTOOLS_UID__)) {
3249
- const node = await this.capture({ ...cachedChild, isDeactivated: true }, depth + 1);
3250
- if (node)
3251
- treeNode.children.push(node);
2849
+ }
2850
+ });
2851
+ api.on.getInspectorTree(async (payload) => {
2852
+ if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
2853
+ const instance = getComponentInstance(devtoolsContext.appRecord, payload.instanceId);
2854
+ if (instance) {
2855
+ const walker = new ComponentWalker({
2856
+ filterText: payload.filter,
2857
+ // @TODO: should make this configurable?
2858
+ maxDepth: 100,
2859
+ recursively: false
2860
+ });
2861
+ payload.rootNodes = await walker.getComponentTree(instance);
3252
2862
  }
3253
2863
  }
3254
- }
3255
- const rootElements = getRootElementsFromComponentInstance(instance);
3256
- const firstElement = rootElements[0];
3257
- if (firstElement == null ? void 0 : firstElement.parentElement) {
3258
- const parentInstance = instance.parent;
3259
- const parentRootElements = parentInstance ? getRootElementsFromComponentInstance(parentInstance) : [];
3260
- let el = firstElement;
3261
- const indexList = [];
3262
- do {
3263
- indexList.push(Array.from(el.parentElement.childNodes).indexOf(el));
3264
- el = el.parentElement;
3265
- } while (el.parentElement && parentRootElements.length && !parentRootElements.includes(el));
3266
- treeNode.domOrder = indexList.reverse();
3267
- } else {
3268
- treeNode.domOrder = [-1];
3269
- }
3270
- if ((_a8 = instance.suspense) == null ? void 0 : _a8.suspenseKey) {
3271
- treeNode.tags.push({
3272
- label: instance.suspense.suspenseKey,
3273
- backgroundColor: 14979812,
3274
- textColor: 16777215
3275
- });
3276
- this.mark(instance, true);
3277
- }
3278
- devtoolsContext.api.visitComponentTree({
3279
- treeNode,
3280
- componentInstance: instance,
3281
- app: instance.appContext.app,
3282
- filter: this.componentFilter.filter
3283
- });
3284
- return treeNode;
3285
- }
3286
- /**
3287
- * Find qualified children from a single instance.
3288
- * If the instance itself is qualified, just return itself.
3289
- * This is ok because [].concat works in both cases.
3290
- *
3291
- * @param {Vue|Vnode} instance
3292
- * @return {Vue|Array}
3293
- */
3294
- async findQualifiedChildren(instance, depth) {
3295
- var _a8;
3296
- if (this.componentFilter.isQualified(instance) && !((_a8 = instance.type.devtools) == null ? void 0 : _a8.hide)) {
3297
- return [await this.capture(instance, depth)];
3298
- } else if (instance.subTree) {
3299
- const list = this.isKeepAlive(instance) ? this.getKeepAliveCachedInstances(instance) : this.getInternalInstanceChildren(instance.subTree);
3300
- return this.findQualifiedChildrenFromList(list, depth);
3301
- } else {
3302
- return [];
3303
- }
3304
- }
3305
- /**
3306
- * Iterate through an array of instances and flatten it into
3307
- * an array of qualified instances. This is a depth-first
3308
- * traversal - e.g. if an instance is not matched, we will
3309
- * recursively go deeper until a qualified child is found.
3310
- *
3311
- * @param {Array} instances
3312
- * @return {Array}
3313
- */
3314
- async findQualifiedChildrenFromList(instances, depth) {
3315
- instances = instances.filter((child) => {
3316
- var _a8;
3317
- return !isBeingDestroyed(child) && !((_a8 = child.type.devtools) == null ? void 0 : _a8.hide);
3318
2864
  });
3319
- if (!this.componentFilter.filter)
3320
- return Promise.all(instances.map((child) => this.capture(child, depth)));
3321
- else
3322
- return Array.prototype.concat.apply([], await Promise.all(instances.map((i) => this.findQualifiedChildren(i, depth))));
3323
- }
3324
- /**
3325
- * Get children from a component instance.
3326
- */
3327
- getInternalInstanceChildren(subTree, suspense = null) {
3328
- const list = [];
3329
- if (subTree) {
3330
- if (subTree.component) {
3331
- !suspense ? list.push(subTree.component) : list.push({ ...subTree.component, suspense });
3332
- } else if (subTree.suspense) {
3333
- const suspenseKey = !subTree.suspense.isInFallback ? "suspense default" : "suspense fallback";
3334
- list.push(...this.getInternalInstanceChildren(subTree.suspense.activeBranch, { ...subTree.suspense, suspenseKey }));
3335
- } else if (Array.isArray(subTree.children)) {
3336
- subTree.children.forEach((childSubTree) => {
3337
- if (childSubTree.component)
3338
- !suspense ? list.push(childSubTree.component) : list.push({ ...childSubTree.component, suspense });
3339
- else
3340
- list.push(...this.getInternalInstanceChildren(childSubTree, suspense));
2865
+ api.on.getInspectorState(async (payload) => {
2866
+ var _a10;
2867
+ if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
2868
+ const result = getInstanceState({
2869
+ instanceId: payload.nodeId
3341
2870
  });
2871
+ const componentInstance = result.instance;
2872
+ const app2 = (_a10 = result.instance) == null ? void 0 : _a10.appContext.app;
2873
+ const _payload = {
2874
+ componentInstance,
2875
+ app: app2,
2876
+ instanceData: result
2877
+ };
2878
+ apiHooks.callHookWith((callbacks) => {
2879
+ callbacks.forEach((cb) => cb(_payload));
2880
+ }, "component-state:inspect" /* COMPONENT_STATE_INSPECT */);
2881
+ payload.state = result;
3342
2882
  }
3343
- }
3344
- return list.filter((child) => {
3345
- var _a8;
3346
- return !isBeingDestroyed(child) && !((_a8 = child.type.devtools) == null ? void 0 : _a8.hide);
3347
2883
  });
2884
+ api.on.editInspectorState(async (payload) => {
2885
+ if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
2886
+ editState(payload);
2887
+ await api.sendInspectorState("components");
2888
+ }
2889
+ });
2890
+ const debounceSendInspectorTree = debounce2(() => {
2891
+ api.sendInspectorTree(INSPECTOR_ID);
2892
+ }, 120);
2893
+ const debounceSendInspectorState = debounce2(() => {
2894
+ api.sendInspectorState(INSPECTOR_ID);
2895
+ }, 120);
2896
+ const componentAddedCleanup = hook.on.componentAdded(async (app2, uid, parentUid, component) => {
2897
+ var _a10, _b10, _c;
2898
+ if ((_c = (_b10 = (_a10 = app2 == null ? void 0 : app2._instance) == null ? void 0 : _a10.type) == null ? void 0 : _b10.devtools) == null ? void 0 : _c.hide)
2899
+ return;
2900
+ if (!app2 || typeof uid !== "number" && !uid || !component)
2901
+ return;
2902
+ const id = await getComponentId({
2903
+ app: app2,
2904
+ uid,
2905
+ instance: component
2906
+ });
2907
+ const appRecord = await getAppRecord(app2);
2908
+ if (component) {
2909
+ if (component.__VUE_DEVTOOLS_UID__ == null)
2910
+ component.__VUE_DEVTOOLS_UID__ = id;
2911
+ if (!(appRecord == null ? void 0 : appRecord.instanceMap.has(id)))
2912
+ appRecord == null ? void 0 : appRecord.instanceMap.set(id, component);
2913
+ }
2914
+ if (!appRecord)
2915
+ return;
2916
+ debounceSendInspectorTree();
2917
+ });
2918
+ const componentUpdatedCleanup = hook.on.componentUpdated(async (app2, uid, parentUid, component) => {
2919
+ var _a10, _b10, _c;
2920
+ if ((_c = (_b10 = (_a10 = app2 == null ? void 0 : app2._instance) == null ? void 0 : _a10.type) == null ? void 0 : _b10.devtools) == null ? void 0 : _c.hide)
2921
+ return;
2922
+ if (!app2 || typeof uid !== "number" && !uid || !component)
2923
+ return;
2924
+ const id = await getComponentId({
2925
+ app: app2,
2926
+ uid,
2927
+ instance: component
2928
+ });
2929
+ const appRecord = await getAppRecord(app2);
2930
+ if (component) {
2931
+ if (component.__VUE_DEVTOOLS_UID__ == null)
2932
+ component.__VUE_DEVTOOLS_UID__ = id;
2933
+ if (!(appRecord == null ? void 0 : appRecord.instanceMap.has(id)))
2934
+ appRecord == null ? void 0 : appRecord.instanceMap.set(id, component);
2935
+ }
2936
+ if (!appRecord)
2937
+ return;
2938
+ debounceSendInspectorTree();
2939
+ debounceSendInspectorState();
2940
+ });
2941
+ const componentRemovedCleanup = hook.on.componentRemoved(async (app2, uid, parentUid, component) => {
2942
+ var _a10, _b10, _c;
2943
+ if ((_c = (_b10 = (_a10 = app2 == null ? void 0 : app2._instance) == null ? void 0 : _a10.type) == null ? void 0 : _b10.devtools) == null ? void 0 : _c.hide)
2944
+ return;
2945
+ if (!app2 || typeof uid !== "number" && !uid || !component)
2946
+ return;
2947
+ const appRecord = await getAppRecord(app2);
2948
+ if (!appRecord)
2949
+ return;
2950
+ const id = await getComponentId({
2951
+ app: app2,
2952
+ uid,
2953
+ instance: component
2954
+ });
2955
+ appRecord == null ? void 0 : appRecord.instanceMap.delete(id);
2956
+ debounceSendInspectorTree();
2957
+ });
2958
+ devtoolsContext.componentPluginHookBuffer = [
2959
+ componentAddedCleanup,
2960
+ componentUpdatedCleanup,
2961
+ componentRemovedCleanup
2962
+ ];
2963
+ });
2964
+ }
2965
+
2966
+ // src/core/app-record/index.ts
2967
+ function getAppRecordName(app, fallbackName) {
2968
+ var _a10;
2969
+ return ((_a10 = app == null ? void 0 : app._component) == null ? void 0 : _a10.name) || `App ${fallbackName}`;
2970
+ }
2971
+ function getAppRootInstance(app) {
2972
+ var _a10, _b10, _c, _d;
2973
+ if (app._instance)
2974
+ return app._instance;
2975
+ else if ((_b10 = (_a10 = app._container) == null ? void 0 : _a10._vnode) == null ? void 0 : _b10.component)
2976
+ return (_d = (_c = app._container) == null ? void 0 : _c._vnode) == null ? void 0 : _d.component;
2977
+ }
2978
+ function getAppRecordId(app, defaultId) {
2979
+ if (app.__VUE_DEVTOOLS_APP_RECORD_ID__ != null)
2980
+ return app.__VUE_DEVTOOLS_APP_RECORD_ID__;
2981
+ let id = defaultId != null ? defaultId : (appRecordInfo.id++).toString();
2982
+ if (defaultId && appRecordInfo.appIds.has(id)) {
2983
+ let count = 1;
2984
+ while (appRecordInfo.appIds.has(`${defaultId}_${count}`))
2985
+ count++;
2986
+ id = `${defaultId}_${count}`;
3348
2987
  }
3349
- /**
3350
- * Mark an instance as captured and store it in the instance map.
3351
- *
3352
- * @param {Vue} instance
3353
- */
3354
- mark(instance, force = false) {
3355
- const instanceMap = getAppRecord(instance).instanceMap;
3356
- if (force || !instanceMap.has(instance.__VUE_DEVTOOLS_UID__))
3357
- instanceMap.set(instance.__VUE_DEVTOOLS_UID__, instance);
3358
- }
3359
- isKeepAlive(instance) {
3360
- return instance.type.__isKeepAlive && instance.__v_cache;
2988
+ appRecordInfo.appIds.add(id);
2989
+ app.__VUE_DEVTOOLS_APP_RECORD_ID__ = id;
2990
+ return id;
2991
+ }
2992
+ function createAppRecord(app) {
2993
+ const rootInstance = getAppRootInstance(app);
2994
+ if (rootInstance) {
2995
+ appRecordInfo.id++;
2996
+ const name = getAppRecordName(app, appRecordInfo.id.toString());
2997
+ const id = getAppRecordId(app, (0, import_speakingurl.default)(name));
2998
+ const record = {
2999
+ id,
3000
+ name,
3001
+ instanceMap: /* @__PURE__ */ new Map(),
3002
+ rootInstance
3003
+ };
3004
+ app.__VUE_DEVTOOLS_APP_RECORD__ = record;
3005
+ const rootId = `${record.id}:root`;
3006
+ record.instanceMap.set(rootId, record.rootInstance);
3007
+ record.rootInstance.__VUE_DEVTOOLS_UID__ = rootId;
3008
+ return record;
3009
+ } else {
3010
+ return {};
3361
3011
  }
3362
- getKeepAliveCachedInstances(instance) {
3363
- return Array.from(instance.__v_cache.values()).map((vnode) => vnode.component).filter(Boolean);
3012
+ }
3013
+ async function setActiveAppRecord(appRecord) {
3014
+ await registerComponentDevToolsPlugin(appRecord == null ? void 0 : appRecord.app);
3015
+ devtoolsAppRecords.active = appRecord;
3016
+ devtoolsAppRecords.activeId = `${appRecord.id}`;
3017
+ registerPlugin(appRecord.app, appRecord.api);
3018
+ }
3019
+ async function toggleActiveAppRecord(id) {
3020
+ devtoolsContext.componentPluginHookBuffer.forEach((cleanup) => cleanup());
3021
+ devtoolsContext.api.clear();
3022
+ devtoolsContext.clear();
3023
+ const appRecord = devtoolsAppRecords.value.find((record) => record.id === id);
3024
+ if (appRecord) {
3025
+ devtoolsState.pluginBuffer = devtoolsState.pluginBuffer.filter(([plugin]) => plugin.id !== "components");
3026
+ const api = new DevToolsPluginApi();
3027
+ appRecord.api = api;
3028
+ setActiveAppRecord(appRecord);
3029
+ window.postMessage({
3030
+ event: "toggle-app-record",
3031
+ target: "vue-devtools"
3032
+ });
3364
3033
  }
3365
- };
3366
-
3367
- // src/core/component/state/index.ts
3368
- init_esm_shims();
3369
- function getInstanceState(params) {
3370
- var _a8;
3371
- const instance = getComponentInstance(devtoolsContext.appRecord, params.instanceId);
3372
- const id = getUniqueComponentId(instance);
3373
- const name = getInstanceName(instance);
3374
- const file = (_a8 = instance == null ? void 0 : instance.type) == null ? void 0 : _a8.__file;
3375
- const state = processInstanceState(instance);
3376
- return {
3377
- id,
3378
- name,
3379
- file,
3380
- state,
3381
- instance
3382
- };
3383
3034
  }
3384
3035
 
3385
- // src/core/component/state/bounding-rect.ts
3036
+ // src/core/component-highlighter/index.ts
3386
3037
  init_esm_shims();
3387
- function createRect() {
3388
- const rect = {
3389
- top: 0,
3390
- bottom: 0,
3391
- left: 0,
3392
- right: 0,
3393
- get width() {
3394
- return rect.right - rect.left;
3395
- },
3396
- get height() {
3397
- return rect.bottom - rect.top;
3398
- }
3038
+ var CONTAINER_ELEMENT_ID = "__vue-devtools-component-inspector__";
3039
+ var CARD_ELEMENT_ID = "__vue-devtools-component-inspector__card__";
3040
+ var COMPONENT_NAME_ELEMENT_ID = "__vue-devtools-component-inspector__name__";
3041
+ var INDICATOR_ELEMENT_ID = "__vue-devtools-component-inspector__indicator__";
3042
+ var containerStyles = {
3043
+ display: "block",
3044
+ zIndex: 2147483640,
3045
+ position: "fixed",
3046
+ backgroundColor: "#42b88325",
3047
+ border: "1px solid #42b88350",
3048
+ borderRadius: "5px",
3049
+ transition: "all 0.1s ease-in",
3050
+ pointerEvents: "none"
3051
+ };
3052
+ var cardStyles = {
3053
+ fontFamily: "Arial, Helvetica, sans-serif",
3054
+ padding: "5px 8px",
3055
+ borderRadius: "4px",
3056
+ textAlign: "left",
3057
+ position: "absolute",
3058
+ left: 0,
3059
+ color: "#e9e9e9",
3060
+ fontSize: "14px",
3061
+ fontWeight: 600,
3062
+ lineHeight: "24px",
3063
+ backgroundColor: "#42b883",
3064
+ boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)"
3065
+ };
3066
+ var indicatorStyles = {
3067
+ display: "inline-block",
3068
+ fontWeight: 400,
3069
+ fontStyle: "normal",
3070
+ fontSize: "12px",
3071
+ opacity: 0.7
3072
+ };
3073
+ function getContainerElement() {
3074
+ return document.getElementById(CONTAINER_ELEMENT_ID);
3075
+ }
3076
+ function getCardElement() {
3077
+ return document.getElementById(CARD_ELEMENT_ID);
3078
+ }
3079
+ function getIndicatorElement() {
3080
+ return document.getElementById(INDICATOR_ELEMENT_ID);
3081
+ }
3082
+ function getNameElement() {
3083
+ return document.getElementById(COMPONENT_NAME_ELEMENT_ID);
3084
+ }
3085
+ function getStyles(bounds) {
3086
+ return {
3087
+ left: `${Math.round(bounds.left * 100) / 100}px`,
3088
+ top: `${Math.round(bounds.top * 100) / 100}px`,
3089
+ width: `${Math.round(bounds.width * 100) / 100}px`,
3090
+ height: `${Math.round(bounds.height * 100) / 100}px`
3399
3091
  };
3400
- return rect;
3401
3092
  }
3402
- var range;
3403
- function getTextRect(node) {
3404
- if (!range)
3405
- range = document.createRange();
3406
- range.selectNode(node);
3407
- return range.getBoundingClientRect();
3093
+ function create(options) {
3094
+ var _a10;
3095
+ const containerEl = document.createElement("div");
3096
+ containerEl.id = (_a10 = options.elementId) != null ? _a10 : CONTAINER_ELEMENT_ID;
3097
+ Object.assign(containerEl.style, {
3098
+ ...containerStyles,
3099
+ ...getStyles(options.bounds),
3100
+ ...options.style
3101
+ });
3102
+ const cardEl = document.createElement("span");
3103
+ cardEl.id = CARD_ELEMENT_ID;
3104
+ Object.assign(cardEl.style, {
3105
+ ...cardStyles,
3106
+ top: options.bounds.top < 35 ? 0 : "-35px"
3107
+ });
3108
+ const nameEl = document.createElement("span");
3109
+ nameEl.id = COMPONENT_NAME_ELEMENT_ID;
3110
+ nameEl.innerHTML = `&lt;${options.name}&gt;&nbsp;&nbsp;`;
3111
+ const indicatorEl = document.createElement("i");
3112
+ indicatorEl.id = INDICATOR_ELEMENT_ID;
3113
+ indicatorEl.innerHTML = `${Math.round(options.bounds.width * 100) / 100} x ${Math.round(options.bounds.height * 100) / 100}`;
3114
+ Object.assign(indicatorEl.style, indicatorStyles);
3115
+ cardEl.appendChild(nameEl);
3116
+ cardEl.appendChild(indicatorEl);
3117
+ containerEl.appendChild(cardEl);
3118
+ document.body.appendChild(containerEl);
3119
+ return containerEl;
3408
3120
  }
3409
- function getFragmentRect(vnode) {
3410
- const rect = createRect();
3411
- if (!vnode.children)
3412
- return rect;
3413
- for (let i = 0, l = vnode.children.length; i < l; i++) {
3414
- const childVnode = vnode.children[i];
3415
- let childRect;
3416
- if (childVnode.component) {
3417
- childRect = getComponentBoundingRect(childVnode.component);
3418
- } else if (childVnode.el) {
3419
- const el = childVnode.el;
3420
- if (el.nodeType === 1 || el.getBoundingClientRect)
3421
- childRect = el.getBoundingClientRect();
3422
- else if (el.nodeType === 3 && el.data.trim())
3423
- childRect = getTextRect(el);
3121
+ function update(options) {
3122
+ const containerEl = getContainerElement();
3123
+ const cardEl = getCardElement();
3124
+ const nameEl = getNameElement();
3125
+ const indicatorEl = getIndicatorElement();
3126
+ if (containerEl) {
3127
+ Object.assign(containerEl.style, {
3128
+ ...containerStyles,
3129
+ ...getStyles(options.bounds)
3130
+ });
3131
+ Object.assign(cardEl.style, {
3132
+ top: options.bounds.top < 35 ? 0 : "-35px"
3133
+ });
3134
+ nameEl.innerHTML = `&lt;${options.name}&gt;&nbsp;&nbsp;`;
3135
+ indicatorEl.innerHTML = `${Math.round(options.bounds.width * 100) / 100} x ${Math.round(options.bounds.height * 100) / 100}`;
3136
+ }
3137
+ }
3138
+ function toggleComponentHighLighter(options) {
3139
+ if (options.visible) {
3140
+ const instance = getComponentInstance(devtoolsContext.appRecord, options.id);
3141
+ if (instance && (options.bounds.width || options.bounds.height)) {
3142
+ const name = getInstanceName(instance);
3143
+ const el = getContainerElement();
3144
+ el ? update({ ...options, name }) : create({ ...options, name });
3424
3145
  }
3425
- if (childRect)
3426
- mergeRects(rect, childRect);
3146
+ } else {
3147
+ const el = getContainerElement();
3148
+ if (el)
3149
+ el.style.display = "none";
3427
3150
  }
3428
- return rect;
3429
3151
  }
3430
- function mergeRects(a, b) {
3431
- if (!a.top || b.top < a.top)
3432
- a.top = b.top;
3433
- if (!a.bottom || b.bottom > a.bottom)
3434
- a.bottom = b.bottom;
3435
- if (!a.left || b.left < a.left)
3436
- a.left = b.left;
3437
- if (!a.right || b.right > a.right)
3438
- a.right = b.right;
3439
- return a;
3152
+ function highlight(instance) {
3153
+ const bounds = getComponentBoundingRect(instance);
3154
+ const name = getInstanceName(instance);
3155
+ const container = getContainerElement();
3156
+ container ? update({ bounds, name }) : create({ bounds, name });
3440
3157
  }
3441
- var DEFAULT_RECT = {
3442
- top: 0,
3443
- left: 0,
3444
- right: 0,
3445
- bottom: 0,
3446
- width: 0,
3447
- height: 0
3448
- };
3449
- function getComponentBoundingRect(instance) {
3450
- const el = instance.subTree.el;
3451
- if (typeof window === "undefined") {
3452
- return DEFAULT_RECT;
3158
+ function unhighlight() {
3159
+ const el = getContainerElement();
3160
+ if (el)
3161
+ el.style.display = "none";
3162
+ }
3163
+ var inspectInstance = null;
3164
+ function inspectFn(e) {
3165
+ const target9 = e.target;
3166
+ if (target9) {
3167
+ const instance = target9.__vueParentComponent;
3168
+ if (instance) {
3169
+ inspectInstance = instance;
3170
+ const el = instance.vnode.el;
3171
+ if (el) {
3172
+ const bounds = getComponentBoundingRect(instance);
3173
+ const name = getInstanceName(instance);
3174
+ const container = getContainerElement();
3175
+ container ? update({ bounds, name }) : create({ bounds, name });
3176
+ }
3177
+ }
3178
+ }
3179
+ }
3180
+ function selectComponentFn(e, cb) {
3181
+ var _a10;
3182
+ e.preventDefault();
3183
+ e.stopPropagation();
3184
+ if (inspectInstance) {
3185
+ const app = (_a10 = devtoolsContext.appRecord) == null ? void 0 : _a10.app;
3186
+ getComponentId({
3187
+ app,
3188
+ uid: app.uid,
3189
+ instance: inspectInstance
3190
+ }).then((id) => {
3191
+ cb(id);
3192
+ });
3193
+ }
3194
+ }
3195
+ function inspectComponentHighLighter() {
3196
+ window.addEventListener("mouseover", inspectFn);
3197
+ return new Promise((resolve) => {
3198
+ function onSelect(e) {
3199
+ e.preventDefault();
3200
+ e.stopPropagation();
3201
+ selectComponentFn(e, (id) => {
3202
+ window.removeEventListener("click", onSelect);
3203
+ window.removeEventListener("mouseover", inspectFn);
3204
+ const el = getContainerElement();
3205
+ if (el)
3206
+ el.style.display = "none";
3207
+ resolve(JSON.stringify({ id }));
3208
+ });
3209
+ }
3210
+ window.addEventListener("click", onSelect);
3211
+ });
3212
+ }
3213
+ function scrollToComponent(options) {
3214
+ const instance = getComponentInstance(devtoolsContext.appRecord, options.id);
3215
+ if (instance) {
3216
+ const [el] = getRootElementsFromComponentInstance(instance);
3217
+ if (typeof el.scrollIntoView === "function") {
3218
+ el.scrollIntoView({
3219
+ behavior: "smooth"
3220
+ });
3221
+ } else {
3222
+ const bounds = getComponentBoundingRect(instance);
3223
+ const scrollTarget = document.createElement("div");
3224
+ const styles = {
3225
+ ...getStyles(bounds),
3226
+ position: "absolute"
3227
+ };
3228
+ Object.assign(scrollTarget.style, styles);
3229
+ document.body.appendChild(scrollTarget);
3230
+ scrollTarget.scrollIntoView({
3231
+ behavior: "smooth"
3232
+ });
3233
+ setTimeout(() => {
3234
+ document.body.removeChild(scrollTarget);
3235
+ }, 2e3);
3236
+ }
3237
+ setTimeout(() => {
3238
+ const bounds = getComponentBoundingRect(instance);
3239
+ if (bounds.width || bounds.height) {
3240
+ const name = getInstanceName(instance);
3241
+ const el2 = getContainerElement();
3242
+ el2 ? update({ ...options, name, bounds }) : create({ ...options, name, bounds });
3243
+ setTimeout(() => {
3244
+ if (el2)
3245
+ el2.style.display = "none";
3246
+ }, 1500);
3247
+ }
3248
+ }, 1200);
3453
3249
  }
3454
- if (isFragment(instance))
3455
- return getFragmentRect(instance.subTree);
3456
- else if ((el == null ? void 0 : el.nodeType) === 1)
3457
- return el == null ? void 0 : el.getBoundingClientRect();
3458
- else if (instance.subTree.component)
3459
- return getComponentBoundingRect(instance.subTree.component);
3460
- else
3461
- return DEFAULT_RECT;
3462
3250
  }
3463
3251
 
3464
- // src/api/on.ts
3252
+ // src/shared/index.ts
3465
3253
  init_esm_shims();
3466
- import { target as target4 } from "@vue/devtools-shared";
3467
- import { createHooks as createHooks2 } from "hookable";
3468
- var _a6, _b6;
3469
- var apiHooks = (_b6 = (_a6 = target4).__VUE_DEVTOOLS_API_HOOK) != null ? _b6 : _a6.__VUE_DEVTOOLS_API_HOOK = createHooks2();
3470
- var on2 = {
3471
- devtoolsStateUpdated(fn) {
3472
- apiHooks.hook("devtools:state-updated" /* DEVTOOLS_STATE_UPDATED */, fn);
3473
- },
3474
- routerInfoUpdated(fn) {
3475
- apiHooks.hook("router-info:updated" /* ROUTER_INFO_UPDATED */, fn);
3476
- },
3477
- getComponentBoundingRect(fn) {
3478
- apiHooks.hook("component-bounding-rect:get" /* GET_COMPONENT_BOUNDING_RECT */, fn);
3479
- },
3480
- // compatible
3481
- inspectComponent(fn) {
3482
- apiHooks.hook("component-state:inspect" /* COMPONENT_STATE_INSPECT */, fn);
3483
- },
3484
- visitComponentTree(fn) {
3485
- apiHooks.hook("component-tree:visit" /* VISIT_COMPONENT_TREE */, fn);
3486
- },
3487
- getInspectorTree(fn) {
3488
- apiHooks.hook("inspector-tree:get" /* GET_INSPECTOR_TREE */, fn);
3489
- },
3490
- getInspectorState(fn) {
3491
- apiHooks.hook("inspector-state:get" /* GET_INSPECTOR_STATE */, fn);
3492
- },
3493
- // private
3494
- sendInspectorTree(fn) {
3495
- apiHooks.hook("inspector-tree:send" /* SEND_INSPECTOR_TREE */, fn);
3496
- },
3497
- sendInspectorState(fn) {
3498
- apiHooks.hook("inspector-state:send" /* SEND_INSPECTOR_STATE */, fn);
3499
- },
3500
- addTimelineEvent(fn) {
3501
- apiHooks.hook("timeline:add-event" /* ADD_TIMELINE_EVENT */, fn);
3502
- },
3503
- editInspectorState(fn) {
3504
- apiHooks.hook("inspector-state:edit" /* EDIT_INSPECTOR_STATE */, fn);
3505
- },
3506
- editComponentState() {
3507
- },
3508
- customTabsUpdated(fn) {
3509
- apiHooks.hook("custom-tabs:updated" /* CUSTOM_TABS_UPDATED */, fn);
3510
- },
3511
- customCommandsUpdated(fn) {
3512
- apiHooks.hook("custom-commands:updated" /* CUSTOM_COMMANDS_UPDATED */, fn);
3513
- }
3514
- };
3515
3254
 
3516
- // src/core/plugins/components.ts
3517
- var INSPECTOR_ID = "components";
3518
- function registerComponentsDevTools(app) {
3519
- setupDevToolsPlugin({
3520
- id: INSPECTOR_ID,
3521
- label: "Components",
3522
- app
3523
- }, (api) => {
3524
- api.addInspector({
3525
- id: INSPECTOR_ID,
3526
- label: "Components",
3527
- treeFilterPlaceholder: "Search components"
3528
- });
3529
- api.on.getComponentBoundingRect((payload) => {
3530
- if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
3531
- const instance = getComponentInstance(devtoolsContext.appRecord, payload.instanceId);
3532
- if (instance) {
3533
- if (typeof DOMRect === "undefined")
3534
- return;
3535
- payload.rect = getComponentBoundingRect(instance);
3536
- if (payload.rect instanceof DOMRect) {
3537
- payload.rect = {
3538
- top: payload.rect.top,
3539
- left: payload.rect.left,
3540
- right: payload.rect.right,
3541
- bottom: payload.rect.bottom,
3542
- width: payload.rect.width,
3543
- height: payload.rect.height
3544
- };
3545
- }
3546
- }
3255
+ // src/shared/util.ts
3256
+ init_esm_shims();
3257
+
3258
+ // src/core/component/state/replacer.ts
3259
+ init_esm_shims();
3260
+
3261
+ // src/core/component/state/custom.ts
3262
+ init_esm_shims();
3263
+ function getFunctionDetails(func) {
3264
+ let string = "";
3265
+ let matches = null;
3266
+ try {
3267
+ string = Function.prototype.toString.call(func);
3268
+ matches = String.prototype.match.call(string, /\([\s\S]*?\)/);
3269
+ } catch (e) {
3270
+ }
3271
+ const match = matches && matches[0];
3272
+ const args = typeof match === "string" ? match : "(?)";
3273
+ const name = typeof func.name === "string" ? func.name : "";
3274
+ return {
3275
+ _custom: {
3276
+ type: "function",
3277
+ displayText: `<span style="opacity:.5;">function</span> ${escape(name)}${args}`,
3278
+ tooltipText: string.trim() ? `<pre>${string}</pre>` : null
3279
+ }
3280
+ };
3281
+ }
3282
+ function getBigIntDetails(val) {
3283
+ const stringifiedBigInt = BigInt.prototype.toString.call(val);
3284
+ return {
3285
+ _custom: {
3286
+ type: "bigint",
3287
+ displayText: `BigInt(${stringifiedBigInt})`,
3288
+ value: stringifiedBigInt
3289
+ }
3290
+ };
3291
+ }
3292
+ function getMapDetails(val) {
3293
+ const list = Object.fromEntries(val);
3294
+ return {
3295
+ _custom: {
3296
+ type: "map",
3297
+ displayText: "Map",
3298
+ value: list,
3299
+ readOnly: true,
3300
+ fields: {
3301
+ abstract: true
3547
3302
  }
3548
- });
3549
- api.on.getInspectorTree(async (payload) => {
3550
- if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
3551
- const instance = getComponentInstance(devtoolsContext.appRecord, payload.instanceId);
3552
- if (instance) {
3553
- const walker = new ComponentWalker({
3554
- filterText: payload.filter,
3555
- // @TODO: should make this configurable?
3556
- maxDepth: 100,
3557
- recursively: false
3558
- });
3559
- payload.rootNodes = await walker.getComponentTree(instance);
3303
+ }
3304
+ };
3305
+ }
3306
+ function getSetDetails(val) {
3307
+ const list = Array.from(val);
3308
+ return {
3309
+ _custom: {
3310
+ type: "set",
3311
+ displayText: `Set[${list.length}]`,
3312
+ value: list,
3313
+ readOnly: true
3314
+ }
3315
+ };
3316
+ }
3317
+ function getCatchedGetters(store) {
3318
+ const getters = {};
3319
+ const origGetters = store.getters || {};
3320
+ const keys = Object.keys(origGetters);
3321
+ for (let i = 0; i < keys.length; i++) {
3322
+ const key = keys[i];
3323
+ Object.defineProperty(getters, key, {
3324
+ enumerable: true,
3325
+ get: () => {
3326
+ try {
3327
+ return origGetters[key];
3328
+ } catch (e) {
3329
+ return e;
3560
3330
  }
3561
3331
  }
3562
3332
  });
3563
- api.on.getInspectorState(async (payload) => {
3564
- var _a8;
3565
- if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
3566
- const result = getInstanceState({
3567
- instanceId: payload.nodeId
3568
- });
3569
- const componentInstance = result.instance;
3570
- const app2 = (_a8 = result.instance) == null ? void 0 : _a8.appContext.app;
3571
- const _payload = {
3572
- componentInstance,
3573
- app: app2,
3574
- instanceData: result
3575
- };
3576
- apiHooks.callHookWith((callbacks) => {
3577
- callbacks.forEach((cb) => cb(_payload));
3578
- }, "component-state:inspect" /* COMPONENT_STATE_INSPECT */);
3579
- payload.state = result;
3580
- }
3581
- });
3582
- api.on.editInspectorState(async (payload) => {
3583
- if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
3584
- editState(payload);
3585
- await api.sendInspectorState("components");
3333
+ }
3334
+ return getters;
3335
+ }
3336
+ function reduceStateList(list) {
3337
+ if (!list.length)
3338
+ return void 0;
3339
+ return list.reduce((map, item) => {
3340
+ const key = item.type || "data";
3341
+ const obj = map[key] = map[key] || {};
3342
+ obj[item.key] = item.value;
3343
+ return map;
3344
+ }, {});
3345
+ }
3346
+ function namedNodeMapToObject(map) {
3347
+ const result = {};
3348
+ const l = map.length;
3349
+ for (let i = 0; i < l; i++) {
3350
+ const node = map.item(i);
3351
+ result[node.name] = node.value;
3352
+ }
3353
+ return result;
3354
+ }
3355
+ function getStoreDetails(store) {
3356
+ return {
3357
+ _custom: {
3358
+ type: "store",
3359
+ displayText: "Store",
3360
+ value: {
3361
+ state: store.state,
3362
+ getters: getCatchedGetters(store)
3363
+ },
3364
+ fields: {
3365
+ abstract: true
3586
3366
  }
3587
- });
3588
- const debounceSendInspectorTree = debounce3(() => {
3589
- api.sendInspectorTree(INSPECTOR_ID);
3590
- }, 120);
3591
- const debounceSendInspectorState = debounce3(() => {
3592
- api.sendInspectorState(INSPECTOR_ID);
3593
- }, 120);
3594
- const componentAddedCleanup = hook.on.componentAdded(async (app2, uid, parentUid, component) => {
3595
- var _a8, _b8, _c;
3596
- if ((_c = (_b8 = (_a8 = app2 == null ? void 0 : app2._instance) == null ? void 0 : _a8.type) == null ? void 0 : _b8.devtools) == null ? void 0 : _c.hide)
3597
- return;
3598
- if (!app2 || typeof uid !== "number" && !uid || !component)
3599
- return;
3600
- const id = await getComponentId({
3601
- app: app2,
3602
- uid,
3603
- instance: component
3604
- });
3605
- const appRecord = await getAppRecord(app2);
3606
- if (component) {
3607
- if (component.__VUE_DEVTOOLS_UID__ == null)
3608
- component.__VUE_DEVTOOLS_UID__ = id;
3609
- if (!(appRecord == null ? void 0 : appRecord.instanceMap.has(id)))
3610
- appRecord == null ? void 0 : appRecord.instanceMap.set(id, component);
3367
+ }
3368
+ };
3369
+ }
3370
+ function getRouterDetails(router) {
3371
+ return {
3372
+ _custom: {
3373
+ type: "router",
3374
+ displayText: "VueRouter",
3375
+ value: {
3376
+ options: router.options,
3377
+ currentRoute: router.currentRoute
3378
+ },
3379
+ fields: {
3380
+ abstract: true
3611
3381
  }
3612
- if (!appRecord)
3613
- return;
3614
- debounceSendInspectorTree();
3615
- });
3616
- const componentUpdatedCleanup = hook.on.componentUpdated(async (app2, uid, parentUid, component) => {
3617
- var _a8, _b8, _c;
3618
- if ((_c = (_b8 = (_a8 = app2 == null ? void 0 : app2._instance) == null ? void 0 : _a8.type) == null ? void 0 : _b8.devtools) == null ? void 0 : _c.hide)
3619
- return;
3620
- if (!app2 || typeof uid !== "number" && !uid || !component)
3621
- return;
3622
- const id = await getComponentId({
3623
- app: app2,
3624
- uid,
3625
- instance: component
3626
- });
3627
- const appRecord = await getAppRecord(app2);
3628
- if (component) {
3629
- if (component.__VUE_DEVTOOLS_UID__ == null)
3630
- component.__VUE_DEVTOOLS_UID__ = id;
3631
- if (!(appRecord == null ? void 0 : appRecord.instanceMap.has(id)))
3632
- appRecord == null ? void 0 : appRecord.instanceMap.set(id, component);
3382
+ }
3383
+ };
3384
+ }
3385
+ function getInstanceDetails(instance) {
3386
+ if (instance._)
3387
+ instance = instance._;
3388
+ const state = processInstanceState(instance);
3389
+ return {
3390
+ _custom: {
3391
+ type: "component",
3392
+ id: instance.__VUE_DEVTOOLS_UID__,
3393
+ displayText: getInstanceName(instance),
3394
+ tooltipText: "Component instance",
3395
+ value: reduceStateList(state),
3396
+ fields: {
3397
+ abstract: true
3633
3398
  }
3634
- if (!appRecord)
3635
- return;
3636
- debounceSendInspectorTree();
3637
- debounceSendInspectorState();
3638
- });
3639
- const componentRemovedCleanup = hook.on.componentRemoved(async (app2, uid, parentUid, component) => {
3640
- var _a8, _b8, _c;
3641
- if ((_c = (_b8 = (_a8 = app2 == null ? void 0 : app2._instance) == null ? void 0 : _a8.type) == null ? void 0 : _b8.devtools) == null ? void 0 : _c.hide)
3642
- return;
3643
- if (!app2 || typeof uid !== "number" && !uid || !component)
3644
- return;
3645
- const appRecord = await getAppRecord(app2);
3646
- if (!appRecord)
3647
- return;
3648
- const id = await getComponentId({
3649
- app: app2,
3650
- uid,
3651
- instance: component
3652
- });
3653
- appRecord == null ? void 0 : appRecord.instanceMap.delete(id);
3654
- debounceSendInspectorTree();
3655
- });
3656
- devtoolsContext.componentPluginHookBuffer = [
3657
- componentAddedCleanup,
3658
- componentUpdatedCleanup,
3659
- componentRemovedCleanup
3660
- ];
3661
- });
3399
+ }
3400
+ };
3401
+ }
3402
+ function getComponentDefinitionDetails(definition) {
3403
+ let display = getComponentName(definition);
3404
+ if (display) {
3405
+ if (definition.name && definition.__file)
3406
+ display += ` <span>(${definition.__file})</span>`;
3407
+ } else {
3408
+ display = "<i>Unknown Component</i>";
3409
+ }
3410
+ return {
3411
+ _custom: {
3412
+ type: "component-definition",
3413
+ displayText: display,
3414
+ tooltipText: "Component definition",
3415
+ ...definition.__file ? {
3416
+ file: definition.__file
3417
+ } : {}
3418
+ }
3419
+ };
3420
+ }
3421
+ function getHTMLElementDetails(value) {
3422
+ try {
3423
+ return {
3424
+ _custom: {
3425
+ type: "HTMLElement",
3426
+ displayText: `<span class="opacity-30">&lt;</span><span class="text-blue-500">${value.tagName.toLowerCase()}</span><span class="opacity-30">&gt;</span>`,
3427
+ value: namedNodeMapToObject(value.attributes)
3428
+ }
3429
+ };
3430
+ } catch (e) {
3431
+ return {
3432
+ _custom: {
3433
+ type: "HTMLElement",
3434
+ displayText: `<span class="text-blue-500">${String(value)}</span>`
3435
+ }
3436
+ };
3437
+ }
3438
+ }
3439
+ function getObjectDetails(object) {
3440
+ var _a10, _b10, _c, _d;
3441
+ const info = getSetupStateType(object);
3442
+ const isState = info.ref || info.computed || info.reactive;
3443
+ if (isState) {
3444
+ const stateTypeName = info.computed ? "Computed" : info.ref ? "Ref" : info.reactive ? "Reactive" : null;
3445
+ const value = toRaw2(info.reactive ? object : object._value);
3446
+ const raw = ((_b10 = (_a10 = object.effect) == null ? void 0 : _a10.raw) == null ? void 0 : _b10.toString()) || ((_d = (_c = object.effect) == null ? void 0 : _c.fn) == null ? void 0 : _d.toString());
3447
+ return {
3448
+ _custom: {
3449
+ type: stateTypeName == null ? void 0 : stateTypeName.toLowerCase(),
3450
+ stateTypeName,
3451
+ value,
3452
+ ...raw ? { tooltipText: `<span class="font-mono">${raw}</span>` } : {}
3453
+ }
3454
+ };
3455
+ }
3456
+ if (typeof object.__asyncLoader === "function") {
3457
+ return {
3458
+ _custom: {
3459
+ type: "component-definition",
3460
+ display: "Async component definition"
3461
+ }
3462
+ };
3463
+ }
3464
+ }
3465
+
3466
+ // src/core/component/state/replacer.ts
3467
+ function stringifyReplacer(key) {
3468
+ var _a10;
3469
+ if (key === "compilerOptions")
3470
+ return;
3471
+ const val = this[key];
3472
+ const type = typeof val;
3473
+ if (Array.isArray(val)) {
3474
+ const l = val.length;
3475
+ if (l > MAX_ARRAY_SIZE) {
3476
+ return {
3477
+ _isArray: true,
3478
+ length: l,
3479
+ items: val.slice(0, MAX_ARRAY_SIZE)
3480
+ };
3481
+ }
3482
+ return val;
3483
+ } else if (typeof val === "string") {
3484
+ if (val.length > MAX_STRING_SIZE)
3485
+ return `${val.substring(0, MAX_STRING_SIZE)}... (${val.length} total length)`;
3486
+ else
3487
+ return val;
3488
+ } else if (type === "undefined") {
3489
+ return UNDEFINED;
3490
+ } else if (val === Number.POSITIVE_INFINITY) {
3491
+ return INFINITY;
3492
+ } else if (val === Number.NEGATIVE_INFINITY) {
3493
+ return NEGATIVE_INFINITY;
3494
+ } else if (typeof val === "function") {
3495
+ return getFunctionDetails(val);
3496
+ } else if (type === "symbol") {
3497
+ return `[native Symbol ${Symbol.prototype.toString.call(val)}]`;
3498
+ } else if (typeof val === "bigint") {
3499
+ return getBigIntDetails(val);
3500
+ } else if (val !== null && typeof val === "object") {
3501
+ const proto = Object.prototype.toString.call(val);
3502
+ if (proto === "[object Map]") {
3503
+ return getMapDetails(val);
3504
+ } else if (proto === "[object Set]") {
3505
+ return getSetDetails(val);
3506
+ } else if (proto === "[object RegExp]") {
3507
+ return `[native RegExp ${RegExp.prototype.toString.call(val)}]`;
3508
+ } else if (proto === "[object Date]") {
3509
+ return `[native Date ${Date.prototype.toString.call(val)}]`;
3510
+ } else if (proto === "[object Error]") {
3511
+ return `[native Error ${val.message}<>${val.stack}]`;
3512
+ } else if (val.state && val._vm) {
3513
+ return getStoreDetails(val);
3514
+ } else if (val.constructor && val.constructor.name === "VueRouter") {
3515
+ return getRouterDetails(val);
3516
+ } else if (isVueInstance(val)) {
3517
+ return getInstanceDetails(val);
3518
+ } else if (typeof val.render === "function") {
3519
+ return getComponentDefinitionDetails(val);
3520
+ } else if (val.constructor && val.constructor.name === "VNode") {
3521
+ return `[native VNode <${val.tag}>]`;
3522
+ } else if (typeof HTMLElement !== "undefined" && val instanceof HTMLElement) {
3523
+ return getHTMLElementDetails(val);
3524
+ } else if (((_a10 = val.constructor) == null ? void 0 : _a10.name) === "Store" && val._wrappedGetters) {
3525
+ return "[object Store]";
3526
+ } else if (val.currentRoute) {
3527
+ return "[object Router]";
3528
+ }
3529
+ const customDetails = getObjectDetails(val);
3530
+ if (customDetails != null)
3531
+ return customDetails;
3532
+ } else if (Number.isNaN(val)) {
3533
+ return NAN;
3534
+ }
3535
+ return sanitize(val);
3536
+ }
3537
+
3538
+ // src/core/component/state/reviver.ts
3539
+ init_esm_shims();
3540
+ import { target as target3 } from "@vue/devtools-shared";
3541
+ function reviveSet(val) {
3542
+ const result = /* @__PURE__ */ new Set();
3543
+ const list = val._custom.value;
3544
+ for (let i = 0; i < list.length; i++) {
3545
+ const value = list[i];
3546
+ result.add(revive(value));
3547
+ }
3548
+ return result;
3549
+ }
3550
+ function reviveMap(val) {
3551
+ const result = /* @__PURE__ */ new Map();
3552
+ const list = val._custom.value;
3553
+ for (let i = 0; i < list.length; i++) {
3554
+ const { key, value } = list[i];
3555
+ result.set(key, revive(value));
3556
+ }
3557
+ return result;
3558
+ }
3559
+ function revive(val) {
3560
+ var _a10;
3561
+ if (val === UNDEFINED) {
3562
+ return void 0;
3563
+ } else if (val === INFINITY) {
3564
+ return Number.POSITIVE_INFINITY;
3565
+ } else if (val === NEGATIVE_INFINITY) {
3566
+ return Number.NEGATIVE_INFINITY;
3567
+ } else if (val === NAN) {
3568
+ return Number.NaN;
3569
+ } else if (val && val._custom) {
3570
+ const { _custom: custom } = val;
3571
+ if (custom.type === "component")
3572
+ return (_a10 = devtoolsContext.appRecord) == null ? void 0 : _a10.instanceMap.get(custom.id);
3573
+ else if (custom.type === "map")
3574
+ return reviveMap(val);
3575
+ else if (custom.type === "set")
3576
+ return reviveSet(val);
3577
+ else if (custom.type === "bigint")
3578
+ return BigInt(custom.value);
3579
+ else
3580
+ return revive(custom.value);
3581
+ } else if (symbolRE.test(val)) {
3582
+ const [, string] = symbolRE.exec(val);
3583
+ return Symbol.for(string);
3584
+ } else if (specialTypeRE.test(val)) {
3585
+ const [, type, string, , details] = specialTypeRE.exec(val);
3586
+ const result = new target3[type](string);
3587
+ if (type === "Error" && details)
3588
+ result.stack = details;
3589
+ return result;
3590
+ } else {
3591
+ return val;
3592
+ }
3593
+ }
3594
+ function reviver(key, value) {
3595
+ return revive(value);
3596
+ }
3597
+
3598
+ // src/shared/transfer.ts
3599
+ init_esm_shims();
3600
+ var MAX_SERIALIZED_SIZE = 512 * 1024;
3601
+ function encode(data, replacer, list, seen) {
3602
+ let stored, key, value, i, l;
3603
+ const seenIndex = seen.get(data);
3604
+ if (seenIndex != null)
3605
+ return seenIndex;
3606
+ const index = list.length;
3607
+ const proto = Object.prototype.toString.call(data);
3608
+ if (proto === "[object Object]") {
3609
+ stored = {};
3610
+ seen.set(data, index);
3611
+ list.push(stored);
3612
+ const keys = Object.keys(data);
3613
+ for (i = 0, l = keys.length; i < l; i++) {
3614
+ key = keys[i];
3615
+ try {
3616
+ if (key === "compilerOptions")
3617
+ return;
3618
+ value = data[key];
3619
+ if (replacer)
3620
+ value = replacer.call(data, key, value);
3621
+ } catch (e) {
3622
+ value = e;
3623
+ }
3624
+ stored[key] = encode(value, replacer, list, seen);
3625
+ }
3626
+ } else if (proto === "[object Array]") {
3627
+ stored = [];
3628
+ seen.set(data, index);
3629
+ list.push(stored);
3630
+ for (i = 0, l = data.length; i < l; i++) {
3631
+ try {
3632
+ value = data[i];
3633
+ if (replacer)
3634
+ value = replacer.call(data, i, value);
3635
+ } catch (e) {
3636
+ value = e;
3637
+ }
3638
+ stored[i] = encode(value, replacer, list, seen);
3639
+ }
3640
+ } else {
3641
+ list.push(data);
3642
+ }
3643
+ return index;
3644
+ }
3645
+ function decode(list, reviver2 = null) {
3646
+ let i = list.length;
3647
+ let j, k, data, key, value, proto;
3648
+ while (i--) {
3649
+ data = list[i];
3650
+ proto = Object.prototype.toString.call(data);
3651
+ if (proto === "[object Object]") {
3652
+ const keys = Object.keys(data);
3653
+ for (j = 0, k = keys.length; j < k; j++) {
3654
+ key = keys[j];
3655
+ value = list[data[key]];
3656
+ if (reviver2)
3657
+ value = reviver2.call(data, key, value);
3658
+ data[key] = value;
3659
+ }
3660
+ } else if (proto === "[object Array]") {
3661
+ for (j = 0, k = data.length; j < k; j++) {
3662
+ value = list[data[j]];
3663
+ if (reviver2)
3664
+ value = reviver2.call(data, j, value);
3665
+ data[j] = value;
3666
+ }
3667
+ }
3668
+ }
3669
+ }
3670
+ function stringifyCircularAutoChunks(data, replacer = null, space = null) {
3671
+ let result;
3672
+ try {
3673
+ result = arguments.length === 1 ? JSON.stringify(data) : JSON.stringify(data, replacer, space);
3674
+ } catch (e) {
3675
+ result = stringifyStrictCircularAutoChunks(data, replacer, space);
3676
+ }
3677
+ if (result.length > MAX_SERIALIZED_SIZE) {
3678
+ const chunkCount = Math.ceil(result.length / MAX_SERIALIZED_SIZE);
3679
+ const chunks = [];
3680
+ for (let i = 0; i < chunkCount; i++)
3681
+ chunks.push(result.slice(i * MAX_SERIALIZED_SIZE, (i + 1) * MAX_SERIALIZED_SIZE));
3682
+ return chunks;
3683
+ }
3684
+ return result;
3685
+ }
3686
+ function stringifyStrictCircularAutoChunks(data, replacer = null, space = null) {
3687
+ const list = [];
3688
+ encode(data, replacer, list, /* @__PURE__ */ new Map());
3689
+ return space ? ` ${JSON.stringify(list, null, space)}` : ` ${JSON.stringify(list)}`;
3690
+ }
3691
+ function parseCircularAutoChunks(data, reviver2 = null) {
3692
+ if (Array.isArray(data))
3693
+ data = data.join("");
3694
+ const hasCircular = /^\s/.test(data);
3695
+ if (!hasCircular) {
3696
+ return arguments.length === 1 ? JSON.parse(data) : JSON.parse(data, reviver2);
3697
+ } else {
3698
+ const list = JSON.parse(data);
3699
+ decode(list, reviver2);
3700
+ return list[0];
3701
+ }
3702
+ }
3703
+
3704
+ // src/core/component/state/format.ts
3705
+ init_esm_shims();
3706
+ function getInspectorStateValueType(value, raw = true) {
3707
+ const type = typeof value;
3708
+ if (value == null || value === UNDEFINED) {
3709
+ return "null";
3710
+ } else if (type === "boolean" || type === "number" || value === INFINITY || value === NEGATIVE_INFINITY || value === NAN) {
3711
+ return "literal";
3712
+ } else if (value == null ? void 0 : value._custom) {
3713
+ if (raw || value._custom.display != null || value._custom.displayText != null)
3714
+ return "custom";
3715
+ else
3716
+ return getInspectorStateValueType(value._custom.value);
3717
+ } else if (typeof value === "string") {
3718
+ const typeMatch = specialTypeRE.exec(value);
3719
+ if (typeMatch) {
3720
+ const [, type2] = typeMatch;
3721
+ return `native ${type2}`;
3722
+ } else {
3723
+ return "string";
3724
+ }
3725
+ } else if (Array.isArray(value) || (value == null ? void 0 : value._isArray)) {
3726
+ return "array";
3727
+ } else if (isPlainObject(value)) {
3728
+ return "plain-object";
3729
+ } else {
3730
+ return "unknown";
3731
+ }
3732
+ }
3733
+ function formatInspectorStateValue(value, quotes = false) {
3734
+ var _a10, _b10;
3735
+ let result;
3736
+ const type = getInspectorStateValueType(value, false);
3737
+ if (type !== "custom" && (value == null ? void 0 : value._custom))
3738
+ value = value._custom.value;
3739
+ if (result = internalStateTokenToString(value)) {
3740
+ return result;
3741
+ } else if (type === "custom") {
3742
+ const nestedName = ((_a10 = value._custom.value) == null ? void 0 : _a10._custom) && formatInspectorStateValue(value._custom.value);
3743
+ return nestedName || value._custom.displayText || value._custom.display;
3744
+ } else if (type === "array") {
3745
+ return `Array[${value.length}]`;
3746
+ } else if (type === "plain-object") {
3747
+ return `Object${Object.keys(value).length ? "" : " (empty)"}`;
3748
+ } else if (type == null ? void 0 : type.includes("native")) {
3749
+ return escape((_b10 = specialTypeRE.exec(value)) == null ? void 0 : _b10[2]);
3750
+ } else if (typeof value === "string") {
3751
+ const typeMatch = value.match(rawTypeRE);
3752
+ if (typeMatch)
3753
+ value = escape(typeMatch[1]);
3754
+ else if (quotes)
3755
+ value = `<span>"</span>${escape(value)}<span>"</span>`;
3756
+ else
3757
+ value = escape(value);
3758
+ value = value.replace(/ /g, "&nbsp;").replace(/\n/g, "<span>\\n</span>");
3759
+ }
3760
+ return value;
3761
+ }
3762
+ function getRaw(value) {
3763
+ var _a10, _b10, _c;
3764
+ let customType;
3765
+ const isCustom = getInspectorStateValueType(value) === "custom";
3766
+ let inherit = {};
3767
+ if (isCustom) {
3768
+ const data = value;
3769
+ const customValue = (_a10 = data._custom) == null ? void 0 : _a10.value;
3770
+ const currentCustomType = (_b10 = data._custom) == null ? void 0 : _b10.type;
3771
+ const nestedCustom = typeof customValue === "object" && customValue !== null && "_custom" in customValue ? getRaw(customValue) : { inherit: void 0, value: void 0, customType: void 0 };
3772
+ inherit = nestedCustom.inherit || ((_c = data._custom) == null ? void 0 : _c.fields) || {};
3773
+ value = nestedCustom.value || customValue;
3774
+ customType = nestedCustom.customType || currentCustomType;
3775
+ }
3776
+ if (value && value._isArray)
3777
+ value = value.items;
3778
+ return { value, inherit, customType };
3779
+ }
3780
+ function toEdit(value, customType) {
3781
+ if (customType === "bigint")
3782
+ return value;
3783
+ return replaceTokenToString(JSON.stringify(value));
3784
+ }
3785
+ function toSubmit(value, customType) {
3786
+ if (customType === "bigint")
3787
+ return BigInt(value);
3788
+ return JSON.parse(replaceStringToToken(value), reviver);
3662
3789
  }
3663
3790
 
3664
- // src/core/general/app-record.ts
3665
- async function setActiveAppRecord(appRecord) {
3666
- await registerComponentsDevTools(appRecord.app);
3667
- devtoolsState.activeAppRecord = appRecord;
3668
- devtoolsState.activeAppRecordId = `${appRecord.id}`;
3669
- registerPlugin({
3670
- app: appRecord.app,
3671
- api: appRecord.api
3672
- });
3791
+ // src/shared/util.ts
3792
+ function stringify(data) {
3793
+ return stringifyCircularAutoChunks(data, stringifyReplacer);
3673
3794
  }
3674
- async function toggleAppRecord(id) {
3675
- devtoolsContext.componentPluginHookBuffer.forEach((cleanup) => cleanup());
3676
- devtoolsContext.api.clear();
3677
- devtoolsContext.clear();
3678
- const appRecord = devtoolsState.appRecords.find((record) => record.id === id);
3679
- if (appRecord) {
3680
- devtoolsState.pluginBuffer = devtoolsState.pluginBuffer.filter(([plugin]) => plugin.id !== "components");
3681
- const api = new DevToolsPluginApi();
3682
- appRecord.api = api;
3683
- setActiveAppRecord(appRecord);
3684
- window.postMessage({
3685
- event: "toggle-app-record",
3686
- target: "vue-devtools"
3687
- });
3688
- }
3795
+ function parse(data, revive2 = false) {
3796
+ if (data == void 0)
3797
+ return {};
3798
+ return revive2 ? parseCircularAutoChunks(data, reviver) : parseCircularAutoChunks(data);
3799
+ }
3800
+
3801
+ // src/shared/time.ts
3802
+ init_esm_shims();
3803
+ function now() {
3804
+ return Date.now();
3689
3805
  }
3690
3806
 
3807
+ // src/shared/env.ts
3808
+ init_esm_shims();
3809
+
3691
3810
  // src/core/custom-tab/index.ts
3692
3811
  init_esm_shims();
3693
3812
  function addCustomTab(tab) {
@@ -3710,13 +3829,18 @@ function removeCustomCommand(actionId) {
3710
3829
  devtoolsState.commands.splice(index, 1);
3711
3830
  }
3712
3831
 
3713
- // src/core/vue-inspector/index.ts
3832
+ // src/core/component-inspector/index.ts
3714
3833
  init_esm_shims();
3715
- import { target as target5 } from "@vue/devtools-shared";
3834
+ import { target as target4 } from "@vue/devtools-shared";
3835
+ var _a3, _b3;
3836
+ (_b3 = (_a3 = target4).__VUE_DEVTOOLS_COMPONENT_INSPECTOR_ENABLED__) != null ? _b3 : _a3.__VUE_DEVTOOLS_COMPONENT_INSPECTOR_ENABLED__ = true;
3837
+ function toggleComponentInspectorEnabled(enabled) {
3838
+ target4.__VUE_DEVTOOLS_COMPONENT_INSPECTOR_ENABLED__ = enabled;
3839
+ }
3716
3840
  function waitForInspectorInit(cb) {
3717
3841
  let total = 0;
3718
3842
  const timer = setInterval(() => {
3719
- if (target5.__VUE_INSPECTOR__) {
3843
+ if (target4.__VUE_INSPECTOR__) {
3720
3844
  clearInterval(timer);
3721
3845
  total += 30;
3722
3846
  cb();
@@ -3727,20 +3851,20 @@ function waitForInspectorInit(cb) {
3727
3851
  }, 30);
3728
3852
  }
3729
3853
  function setupInspector() {
3730
- const inspector = target5.__VUE_INSPECTOR__;
3854
+ const inspector = target4.__VUE_INSPECTOR__;
3731
3855
  const _openInEditor = inspector.openInEditor;
3732
3856
  inspector.openInEditor = async (...params) => {
3733
3857
  inspector.disable();
3734
3858
  _openInEditor(...params);
3735
3859
  };
3736
3860
  }
3737
- function getVueInspector() {
3861
+ function getComponentInspector() {
3738
3862
  return new Promise((resolve) => {
3739
3863
  function setup() {
3740
3864
  setupInspector();
3741
- resolve(target5.__VUE_INSPECTOR__);
3865
+ resolve(target4.__VUE_INSPECTOR__);
3742
3866
  }
3743
- if (!target5.__VUE_INSPECTOR__) {
3867
+ if (!target4.__VUE_INSPECTOR__) {
3744
3868
  waitForInspectorInit(() => {
3745
3869
  setup();
3746
3870
  });
@@ -3750,271 +3874,114 @@ function getVueInspector() {
3750
3874
  });
3751
3875
  }
3752
3876
 
3753
- // src/core/component-inspector/index.ts
3877
+ // src/core/open-in-editor/index.ts
3754
3878
  init_esm_shims();
3755
- var CONTAINER_ELEMENT_ID = "__vue-devtools-component-inspector__";
3756
- var CARD_ELEMENT_ID = "__vue-devtools-component-inspector__card__";
3757
- var COMPONENT_NAME_ELEMENT_ID = "__vue-devtools-component-inspector__name__";
3758
- var INDICATOR_ELEMENT_ID = "__vue-devtools-component-inspector__indicator__";
3759
- var containerStyles = {
3760
- display: "block",
3761
- zIndex: 2147483640,
3762
- position: "fixed",
3763
- backgroundColor: "#42b88325",
3764
- border: "1px solid #42b88350",
3765
- borderRadius: "5px",
3766
- transition: "all 0.1s ease-in",
3767
- pointerEvents: "none"
3768
- };
3769
- var cardStyles = {
3770
- fontFamily: "Arial, Helvetica, sans-serif",
3771
- padding: "5px 8px",
3772
- borderRadius: "4px",
3773
- textAlign: "left",
3774
- position: "absolute",
3775
- left: 0,
3776
- color: "#e9e9e9",
3777
- fontSize: "14px",
3778
- fontWeight: 600,
3779
- lineHeight: "24px",
3780
- backgroundColor: "#42b883",
3781
- boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)"
3782
- };
3783
- var indicatorStyles = {
3784
- display: "inline-block",
3785
- fontWeight: 400,
3786
- fontStyle: "normal",
3787
- fontSize: "12px",
3788
- opacity: 0.7
3789
- };
3790
- function getCotainerElement() {
3791
- return document.getElementById(CONTAINER_ELEMENT_ID);
3792
- }
3793
- function getCardElement() {
3794
- return document.getElementById(CARD_ELEMENT_ID);
3795
- }
3796
- function getIndicatorElement() {
3797
- return document.getElementById(INDICATOR_ELEMENT_ID);
3798
- }
3799
- function getNameElement() {
3800
- return document.getElementById(COMPONENT_NAME_ELEMENT_ID);
3801
- }
3802
- function getStyles(bounds) {
3803
- return {
3804
- left: `${Math.round(bounds.left * 100) / 100}px`,
3805
- top: `${Math.round(bounds.top * 100) / 100}px`,
3806
- width: `${Math.round(bounds.width * 100) / 100}px`,
3807
- height: `${Math.round(bounds.height * 100) / 100}px`
3808
- };
3809
- }
3810
- function create(options) {
3811
- var _a8;
3812
- const containerEl = document.createElement("div");
3813
- containerEl.id = (_a8 = options.elementId) != null ? _a8 : CONTAINER_ELEMENT_ID;
3814
- Object.assign(containerEl.style, {
3815
- ...containerStyles,
3816
- ...getStyles(options.bounds),
3817
- ...options.style
3818
- });
3819
- const cardEl = document.createElement("span");
3820
- cardEl.id = CARD_ELEMENT_ID;
3821
- Object.assign(cardEl.style, {
3822
- ...cardStyles,
3823
- top: options.bounds.top < 35 ? 0 : "-35px"
3824
- });
3825
- const nameEl = document.createElement("span");
3826
- nameEl.id = COMPONENT_NAME_ELEMENT_ID;
3827
- nameEl.innerHTML = `&lt;${options.name}&gt;&nbsp;&nbsp;`;
3828
- const indicatorEl = document.createElement("i");
3829
- indicatorEl.id = INDICATOR_ELEMENT_ID;
3830
- indicatorEl.innerHTML = `${Math.round(options.bounds.width * 100) / 100} x ${Math.round(options.bounds.height * 100) / 100}`;
3831
- Object.assign(indicatorEl.style, indicatorStyles);
3832
- cardEl.appendChild(nameEl);
3833
- cardEl.appendChild(indicatorEl);
3834
- containerEl.appendChild(cardEl);
3835
- document.body.appendChild(containerEl);
3836
- return containerEl;
3837
- }
3838
- function update(options) {
3839
- const containerEl = getCotainerElement();
3840
- const cardEl = getCardElement();
3841
- const nameEl = getNameElement();
3842
- const indicatorEl = getIndicatorElement();
3843
- if (containerEl) {
3844
- Object.assign(containerEl.style, {
3845
- ...containerStyles,
3846
- ...getStyles(options.bounds)
3847
- });
3848
- Object.assign(cardEl.style, {
3849
- top: options.bounds.top < 35 ? 0 : "-35px"
3850
- });
3851
- nameEl.innerHTML = `&lt;${options.name}&gt;&nbsp;&nbsp;`;
3852
- indicatorEl.innerHTML = `${Math.round(options.bounds.width * 100) / 100} x ${Math.round(options.bounds.height * 100) / 100}`;
3853
- }
3854
- }
3855
- function toggleComponentInspector(options) {
3856
- if (options.visible) {
3857
- const instance = getComponentInstance(devtoolsContext.appRecord, options.id);
3858
- if (instance && (options.bounds.width || options.bounds.height)) {
3859
- const name = getInstanceName(instance);
3860
- const el = getCotainerElement();
3861
- el ? update({ ...options, name }) : create({ ...options, name });
3862
- }
3863
- } else {
3864
- const el = getCotainerElement();
3865
- if (el)
3866
- el.style.display = "none";
3867
- }
3868
- }
3869
- function highlight(instance) {
3870
- const bounds = getComponentBoundingRect(instance);
3871
- const name = getInstanceName(instance);
3872
- const container = getCotainerElement();
3873
- container ? update({ bounds, name }) : create({ bounds, name });
3874
- }
3875
- function unhighlight() {
3876
- const el = getCotainerElement();
3877
- if (el)
3878
- el.style.display = "none";
3879
- }
3880
- var inspectInstance = null;
3881
- function inspectFn(e) {
3882
- const target8 = e.target;
3883
- if (target8) {
3884
- const instance = target8.__vueParentComponent;
3885
- if (instance) {
3886
- inspectInstance = instance;
3887
- const el = instance.vnode.el;
3888
- if (el) {
3889
- const bounds = getComponentBoundingRect(instance);
3890
- const name = getInstanceName(instance);
3891
- const container = getCotainerElement();
3892
- container ? update({ bounds, name }) : create({ bounds, name });
3893
- }
3894
- }
3895
- }
3896
- }
3897
- function selectComponentFn(e, cb) {
3898
- var _a8;
3899
- e.preventDefault();
3900
- e.stopPropagation();
3901
- if (inspectInstance) {
3902
- const app = (_a8 = devtoolsContext.appRecord) == null ? void 0 : _a8.app;
3903
- getComponentId({
3904
- app,
3905
- uid: app.uid,
3906
- instance: inspectInstance
3907
- }).then((id) => {
3908
- cb(id);
3909
- });
3910
- }
3911
- }
3912
- function inspectComponentInspector() {
3913
- window.addEventListener("mouseover", inspectFn);
3914
- return new Promise((resolve) => {
3915
- function onSelect(e) {
3916
- e.preventDefault();
3917
- e.stopPropagation();
3918
- selectComponentFn(e, (id) => {
3919
- window.removeEventListener("click", onSelect);
3920
- window.removeEventListener("mouseover", inspectFn);
3921
- const el = getCotainerElement();
3922
- if (el)
3923
- el.style.display = "none";
3924
- resolve(JSON.stringify({ id }));
3925
- });
3926
- }
3927
- window.addEventListener("click", onSelect);
3928
- });
3929
- }
3930
- function scrollToComponent(options) {
3931
- const instance = getComponentInstance(devtoolsContext.appRecord, options.id);
3932
- if (instance) {
3933
- const [el] = getRootElementsFromComponentInstance(instance);
3934
- if (typeof el.scrollIntoView === "function") {
3935
- el.scrollIntoView({
3936
- behavior: "smooth"
3937
- });
3938
- } else {
3939
- const bounds = getComponentBoundingRect(instance);
3940
- const scrollTarget = document.createElement("div");
3941
- const styles = {
3942
- ...getStyles(bounds),
3943
- position: "absolute"
3944
- };
3945
- Object.assign(scrollTarget.style, styles);
3946
- document.body.appendChild(scrollTarget);
3947
- scrollTarget.scrollIntoView({
3948
- behavior: "smooth"
3949
- });
3950
- setTimeout(() => {
3951
- document.body.removeChild(scrollTarget);
3952
- }, 2e3);
3953
- }
3954
- setTimeout(() => {
3955
- const bounds = getComponentBoundingRect(instance);
3956
- if (bounds.width || bounds.height) {
3957
- const name = getInstanceName(instance);
3958
- const el2 = getCotainerElement();
3959
- el2 ? update({ ...options, name, bounds }) : create({ ...options, name, bounds });
3960
- setTimeout(() => {
3961
- if (el2)
3962
- el2.style.display = "none";
3963
- }, 1500);
3964
- }
3965
- }, 1200);
3879
+ import { target as target5 } from "@vue/devtools-shared";
3880
+ function openInEditor(options = {}) {
3881
+ const { file, line = 0, column = 0 } = options;
3882
+ if (file) {
3883
+ const baseUrl = window.location.origin;
3884
+ if (devtoolsState.vitePluginDetected) {
3885
+ target5.__VUE_INSPECTOR__.openInEditor(baseUrl, file, line, column);
3886
+ } else {
3887
+ }
3966
3888
  }
3967
3889
  }
3968
3890
 
3891
+ // src/api/on.ts
3892
+ init_esm_shims();
3893
+ var on2 = {
3894
+ // #region compatible with old devtools
3895
+ addTimelineEvent(fn) {
3896
+ apiHooks.hook("timeline:add-event" /* ADD_TIMELINE_EVENT */, fn);
3897
+ },
3898
+ inspectComponent(fn) {
3899
+ apiHooks.hook("component-state:inspect" /* COMPONENT_STATE_INSPECT */, fn);
3900
+ },
3901
+ visitComponentTree(fn) {
3902
+ apiHooks.hook("component-tree:visit" /* VISIT_COMPONENT_TREE */, fn);
3903
+ },
3904
+ getInspectorTree(fn) {
3905
+ apiHooks.hook("inspector-tree:get" /* GET_INSPECTOR_TREE */, fn);
3906
+ },
3907
+ getInspectorState(fn) {
3908
+ apiHooks.hook("inspector-state:get" /* GET_INSPECTOR_STATE */, fn);
3909
+ },
3910
+ sendInspectorTree(fn) {
3911
+ apiHooks.hook("inspector-tree:send" /* SEND_INSPECTOR_TREE */, fn);
3912
+ },
3913
+ sendInspectorState(fn) {
3914
+ apiHooks.hook("inspector-state:send" /* SEND_INSPECTOR_STATE */, fn);
3915
+ },
3916
+ editInspectorState(fn) {
3917
+ apiHooks.hook("inspector-state:edit" /* EDIT_INSPECTOR_STATE */, fn);
3918
+ },
3919
+ editComponentState() {
3920
+ },
3921
+ // #endregion compatible with old devtools
3922
+ // router
3923
+ routerInfoUpdated(fn) {
3924
+ apiHooks.hook("router-info:updated" /* ROUTER_INFO_UPDATED */, fn);
3925
+ },
3926
+ // component highlighter
3927
+ getComponentBoundingRect(fn) {
3928
+ apiHooks.hook("component-bounding-rect:get" /* GET_COMPONENT_BOUNDING_RECT */, fn);
3929
+ },
3930
+ // custom tabs
3931
+ customTabsUpdated(fn) {
3932
+ apiHooks.hook("custom-tabs:updated" /* CUSTOM_TABS_UPDATED */, fn);
3933
+ },
3934
+ // custom commands
3935
+ customCommandsUpdated(fn) {
3936
+ apiHooks.hook("custom-commands:updated" /* CUSTOM_COMMANDS_UPDATED */, fn);
3937
+ },
3938
+ devtoolsStateUpdated(fn) {
3939
+ apiHooks.hook("devtools:state-updated" /* DEVTOOLS_STATE_UPDATED */, fn);
3940
+ }
3941
+ };
3942
+
3969
3943
  // src/api/off.ts
3970
3944
  init_esm_shims();
3971
- function clear() {
3945
+ function remove() {
3972
3946
  apiHooks.removeAllHooks();
3973
3947
  }
3974
3948
 
3975
- // src/api/index.ts
3949
+ // src/api/api.ts
3976
3950
  var DevToolsPluginApi = class {
3977
3951
  constructor() {
3952
+ this.clear = remove;
3978
3953
  this.on = on2;
3979
- this.clear = clear;
3980
- }
3981
- toggleApp(id) {
3982
- return toggleAppRecord(id);
3983
3954
  }
3984
- addTimelineEvent(payload) {
3985
- apiHooks.callHook("timeline:add-event" /* ADD_TIMELINE_EVENT */, payload);
3955
+ // #region compatible with old devtools
3956
+ // timeline layer
3957
+ addTimelineLayer(payload) {
3958
+ addTimelineLayer(payload);
3986
3959
  }
3987
- toggleComponentInspector(payload) {
3988
- return toggleComponentInspector(payload);
3960
+ // timeline event
3961
+ addTimelineEvent(...params) {
3962
+ apiHooks.callHook("timeline:add-event" /* ADD_TIMELINE_EVENT */, ...params);
3989
3963
  }
3990
- inspectComponentInspector() {
3991
- return inspectComponentInspector();
3964
+ // add inspector
3965
+ addInspector(payload) {
3966
+ addInspector({
3967
+ id: payload.id,
3968
+ nodeId: "",
3969
+ filter: "",
3970
+ treeFilterPlaceholder: payload.treeFilterPlaceholder || ""
3971
+ });
3992
3972
  }
3993
- scrollToComponent(payload) {
3994
- return scrollToComponent(payload);
3973
+ highlightElement(instance) {
3974
+ highlight(instance);
3995
3975
  }
3996
- getComponentBoundingRect(payload) {
3997
- const { inspectorId, instanceId = "" } = payload;
3998
- const _payload = {
3999
- app: devtoolsContext.appRecord.app,
4000
- inspectorId,
4001
- instanceId,
4002
- rect: {
4003
- top: 0,
4004
- left: 0,
4005
- width: 0,
4006
- height: 0
4007
- }
4008
- };
4009
- apiHooks.callHookWith((callbacks) => {
4010
- callbacks.map((cb) => cb(_payload));
4011
- }, "component-bounding-rect:get" /* GET_COMPONENT_BOUNDING_RECT */);
4012
- return stringify(_payload.rect);
3976
+ unhighlightElement() {
3977
+ unhighlight();
4013
3978
  }
3979
+ // inspector
4014
3980
  async getInspectorTree(payload = {}) {
3981
+ var _a10;
4015
3982
  const { inspectorId, filter = "", instanceId = "" } = payload;
4016
3983
  const _payload = {
4017
- app: devtoolsContext.appRecord.app,
3984
+ app: (_a10 = devtoolsContext.appRecord) == null ? void 0 : _a10.app,
4018
3985
  inspectorId,
4019
3986
  instanceId,
4020
3987
  filter,
@@ -4032,9 +3999,10 @@ var DevToolsPluginApi = class {
4032
3999
  return stringify(_payload.rootNodes);
4033
4000
  }
4034
4001
  getInspectorState(payload = {}) {
4002
+ var _a10;
4035
4003
  const { inspectorId, nodeId } = payload;
4036
4004
  const _payload = {
4037
- app: devtoolsContext.appRecord.app,
4005
+ app: (_a10 = devtoolsContext.appRecord) == null ? void 0 : _a10.app,
4038
4006
  inspectorId,
4039
4007
  nodeId
4040
4008
  };
@@ -4049,10 +4017,11 @@ var DevToolsPluginApi = class {
4049
4017
  return stringify(state);
4050
4018
  }
4051
4019
  async editInspectorState(payload) {
4020
+ var _a10;
4052
4021
  const stateEditor2 = new StateEditor();
4053
4022
  apiHooks.callHook("inspector-state:edit" /* EDIT_INSPECTOR_STATE */, {
4054
4023
  ...payload,
4055
- app: devtoolsContext.appRecord.app,
4024
+ app: (_a10 = devtoolsContext.appRecord) == null ? void 0 : _a10.app,
4056
4025
  set: (obj, path = payload.path, value = payload.state.value, cb) => {
4057
4026
  stateEditor2.set(obj, path, value, cb || stateEditor2.createDefaultSetCallback(payload.state));
4058
4027
  }
@@ -4080,48 +4049,14 @@ var DevToolsPluginApi = class {
4080
4049
  apiHooks.callHook("inspector-state:send" /* SEND_INSPECTOR_STATE */, stringify({ ...parse(res), inspectorId }));
4081
4050
  }
4082
4051
  }
4083
- addCustomTab(tab) {
4084
- addCustomTab(tab);
4085
- }
4086
- addCustomCommand(action) {
4087
- addCustomCommand(action);
4088
- }
4089
- removeCustomCommand(actionId) {
4090
- removeCustomCommand(actionId);
4091
- }
4092
- addInspector(payload) {
4093
- var _a8;
4094
- addInspector({
4095
- id: payload.id,
4096
- nodeId: "",
4097
- filter: "",
4098
- treeFilterPlaceholder: (_a8 = payload.treeFilterPlaceholder) != null ? _a8 : ""
4099
- });
4100
- }
4101
- openInEditor(payload) {
4102
- openInEditor(payload);
4103
- }
4104
- highlightElement(instance) {
4105
- highlight(instance);
4106
- }
4107
- unhighlightElement() {
4108
- unhighlight();
4109
- }
4110
4052
  async getComponentInstances(app) {
4111
4053
  const appRecord = app.__VUE_DEVTOOLS_APP_RECORD__;
4112
4054
  const appId = appRecord.id.toString();
4113
4055
  const instances = [...appRecord.instanceMap].filter(([key]) => key.split(":")[0] === appId).map(([, instance]) => instance);
4114
4056
  return instances;
4115
4057
  }
4116
- // Vite only
4117
- getVueInspector() {
4118
- return getVueInspector();
4119
- }
4120
- visitComponentTree(payload) {
4121
- apiHooks.callHook("component-tree:visit" /* VISIT_COMPONENT_TREE */, payload);
4122
- }
4123
- addTimelineLayer(payload) {
4124
- addTimelineLayer(payload);
4058
+ visitComponentTree(...params) {
4059
+ apiHooks.callHook("component-tree:visit" /* VISIT_COMPONENT_TREE */, ...params);
4125
4060
  }
4126
4061
  notifyComponentUpdate() {
4127
4062
  }
@@ -4133,83 +4068,249 @@ var DevToolsPluginApi = class {
4133
4068
  logStoreChanges: null
4134
4069
  };
4135
4070
  }
4071
+ // #endregion compatible with old devtools
4072
+ // #region highlighter
4073
+ toggleComponentInspector(...params) {
4074
+ return toggleComponentHighLighter(...params);
4075
+ }
4076
+ inspectComponentInspector() {
4077
+ return inspectComponentHighLighter();
4078
+ }
4079
+ scrollToComponent(...params) {
4080
+ return scrollToComponent(...params);
4081
+ }
4082
+ getComponentBoundingRect(...params) {
4083
+ var _a10;
4084
+ const { inspectorId, instanceId = "" } = params[0];
4085
+ const _payload = {
4086
+ app: (_a10 = devtoolsContext.appRecord) == null ? void 0 : _a10.app,
4087
+ inspectorId,
4088
+ instanceId,
4089
+ rect: {
4090
+ top: 0,
4091
+ left: 0,
4092
+ width: 0,
4093
+ height: 0
4094
+ }
4095
+ };
4096
+ apiHooks.callHookWith((callbacks) => {
4097
+ callbacks.map((cb) => cb(_payload));
4098
+ }, "component-bounding-rect:get" /* GET_COMPONENT_BOUNDING_RECT */);
4099
+ return stringify(_payload.rect);
4100
+ }
4101
+ // #endregion highlighter
4102
+ toggleApp(id) {
4103
+ return toggleActiveAppRecord(id);
4104
+ }
4105
+ addCustomTab(tab) {
4106
+ addCustomTab(tab);
4107
+ }
4108
+ addCustomCommand(action) {
4109
+ addCustomCommand(action);
4110
+ }
4111
+ removeCustomCommand(actionId) {
4112
+ removeCustomCommand(actionId);
4113
+ }
4114
+ openInEditor(payload) {
4115
+ openInEditor(payload);
4116
+ }
4117
+ getVueInspector() {
4118
+ return getComponentInspector();
4119
+ }
4136
4120
  };
4137
4121
 
4138
- // src/core/general/app.ts
4122
+ // src/state/state.ts
4123
+ var STATE_KEY = "__VUE_DEVTOOLS_GLOBAL_STATE__";
4124
+ function initStateFactory() {
4125
+ return {
4126
+ connected: false,
4127
+ clientConnected: false,
4128
+ appRecords: [],
4129
+ activeAppRecord: null,
4130
+ selectedComponentId: null,
4131
+ pluginBuffer: [],
4132
+ tabs: [],
4133
+ commands: [],
4134
+ vitePluginDetected: false,
4135
+ activeAppRecordId: null
4136
+ };
4137
+ }
4138
+ var _a4, _b4;
4139
+ (_b4 = (_a4 = global2)[STATE_KEY]) != null ? _b4 : _a4[STATE_KEY] = initStateFactory();
4140
+ var callStateUpdatedHook = debounce3((state, oldState) => {
4141
+ apiHooks.callHook("devtools:state-updated" /* DEVTOOLS_STATE_UPDATED */, state, oldState);
4142
+ }, 80);
4143
+ var callConnectedUpdatedHook = debounce3((state, oldState) => {
4144
+ apiHooks.callHook("devtools:connected-updated" /* DEVTOOLS_CONNECTED_UPDATED */, state, oldState);
4145
+ }, 80);
4146
+ var devtoolsState = new Proxy(global2[STATE_KEY], {
4147
+ get(target9, property) {
4148
+ return global2[STATE_KEY][property];
4149
+ },
4150
+ deleteProperty(target9, property) {
4151
+ delete target9[property];
4152
+ return true;
4153
+ },
4154
+ set(target9, property, value) {
4155
+ const oldState = { ...global2[STATE_KEY] };
4156
+ target9[property] = value;
4157
+ global2[STATE_KEY][property] = value;
4158
+ callStateUpdatedHook(global2[STATE_KEY], oldState);
4159
+ if (["connected", "clientConnected"].includes(property.toString()) && oldState[property] !== value)
4160
+ callConnectedUpdatedHook(global2[STATE_KEY], oldState);
4161
+ return true;
4162
+ }
4163
+ });
4164
+ Object.defineProperty(devtoolsState.tabs, "push", {
4165
+ configurable: true,
4166
+ value(...items) {
4167
+ const result = Array.prototype.push.apply(this, items);
4168
+ devtoolsState.tabs = this;
4169
+ apiHooks.callHook("custom-tabs:updated" /* CUSTOM_TABS_UPDATED */, this);
4170
+ return result;
4171
+ }
4172
+ });
4173
+ ["push", "splice"].forEach((method) => {
4174
+ Object.defineProperty(devtoolsState.commands, method, {
4175
+ configurable: true,
4176
+ value(...args) {
4177
+ const result = Array.prototype[method].apply(this, args);
4178
+ devtoolsState.commands = this;
4179
+ apiHooks.callHook("custom-commands:updated" /* CUSTOM_COMMANDS_UPDATED */, this);
4180
+ return result;
4181
+ }
4182
+ });
4183
+ });
4184
+
4185
+ // src/state/app-record.ts
4139
4186
  init_esm_shims();
4140
- var import_speakingurl = __toESM(require_speakingurl2(), 1);
4141
4187
  import { target as target6 } from "@vue/devtools-shared";
4142
- var _a7, _b7;
4143
- var appRecordInfo = (_b7 = (_a7 = target6).__VUE_DEVTOOLS_APP_RECROD_INFO__) != null ? _b7 : _a7.__VUE_DEVTOOLS_APP_RECROD_INFO__ = {
4144
- id: 0,
4145
- appIds: /* @__PURE__ */ new Set()
4188
+
4189
+ // src/state/router.ts
4190
+ init_esm_shims();
4191
+ import { target as global3 } from "@vue/devtools-shared";
4192
+ var ROUTER_KEY = "__VUE_DEVTOOLS_ROUTER__";
4193
+ var ROUTER_INFO_KEY = "__VUE_DEVTOOLS_ROUTER_INFO__";
4194
+ var _a5, _b5;
4195
+ (_b5 = (_a5 = global3)[ROUTER_INFO_KEY]) != null ? _b5 : _a5[ROUTER_INFO_KEY] = {
4196
+ currentRoute: null,
4197
+ routes: []
4146
4198
  };
4147
- function getAppRecordName(app, fallbackName) {
4148
- var _a8;
4149
- return ((_a8 = app == null ? void 0 : app._component) == null ? void 0 : _a8.name) || `App ${fallbackName}`;
4199
+ var _a6, _b6;
4200
+ (_b6 = (_a6 = global3)[ROUTER_KEY]) != null ? _b6 : _a6[ROUTER_KEY] = null;
4201
+ var devtoolsRouterInfo = new Proxy(global3[ROUTER_INFO_KEY], {
4202
+ get(target9, property) {
4203
+ return global3[ROUTER_INFO_KEY][property];
4204
+ }
4205
+ });
4206
+
4207
+ // src/state/context.ts
4208
+ init_esm_shims();
4209
+ import { target as global4 } from "@vue/devtools-shared";
4210
+ var CONTEXT_KEY = "__VUE_DEVTOOLS_CONTEXT__";
4211
+ function initContextFactory() {
4212
+ return {
4213
+ appRecord: null,
4214
+ api: null,
4215
+ inspector: [],
4216
+ timelineLayer: [],
4217
+ routerInfo: {},
4218
+ router: null,
4219
+ activeInspectorTreeId: "",
4220
+ componentPluginHookBuffer: []
4221
+ };
4150
4222
  }
4151
- function getAppRootInstance(app) {
4152
- var _a8, _b8, _c, _d;
4153
- if (app._instance)
4154
- return app._instance;
4155
- else if ((_b8 = (_a8 = app._container) == null ? void 0 : _a8._vnode) == null ? void 0 : _b8.component)
4156
- return (_d = (_c = app._container) == null ? void 0 : _c._vnode) == null ? void 0 : _d.component;
4223
+ var _a7, _b7;
4224
+ (_b7 = (_a7 = global4)[CONTEXT_KEY]) != null ? _b7 : _a7[CONTEXT_KEY] = initContextFactory();
4225
+ function resetDevToolsContext() {
4226
+ global4[CONTEXT_KEY] = initContextFactory();
4157
4227
  }
4158
- function getAppRecordId(app, defaultId) {
4159
- if (app.__VUE_DEVTOOLS_APP_RECORD_ID__ != null)
4160
- return app.__VUE_DEVTOOLS_APP_RECORD_ID__;
4161
- let id = defaultId != null ? defaultId : (appRecordInfo.id++).toString();
4162
- if (defaultId && appRecordInfo.appIds.has(id)) {
4163
- let count = 1;
4164
- while (appRecordInfo.appIds.has(`${defaultId}_${count}`))
4165
- count++;
4166
- id = `${defaultId}_${count}`;
4228
+ var devtoolsContext = new Proxy(global4[CONTEXT_KEY], {
4229
+ get(target9, property) {
4230
+ if (property === "router")
4231
+ return global4[ROUTER_KEY];
4232
+ else if (property === "clear")
4233
+ return resetDevToolsContext;
4234
+ return global4[CONTEXT_KEY][property];
4235
+ },
4236
+ set(target9, property, value) {
4237
+ global4[CONTEXT_KEY][property] = value;
4238
+ return true;
4167
4239
  }
4168
- appRecordInfo.appIds.add(id);
4169
- app.__VUE_DEVTOOLS_APP_RECORD_ID__ = id;
4170
- return id;
4171
- }
4172
- function createAppRecord(app) {
4173
- const rootInstance = getAppRootInstance(app);
4174
- if (rootInstance) {
4175
- appRecordInfo.id++;
4176
- const name = getAppRecordName(app, appRecordInfo.id.toString());
4177
- const id = getAppRecordId(app, (0, import_speakingurl.default)(name));
4178
- const record = {
4179
- id,
4180
- name,
4181
- instanceMap: /* @__PURE__ */ new Map(),
4182
- rootInstance
4183
- };
4184
- app.__VUE_DEVTOOLS_APP_RECORD__ = record;
4185
- const rootId = `${record.id}:root`;
4186
- record.instanceMap.set(rootId, record.rootInstance);
4187
- record.rootInstance.__VUE_DEVTOOLS_UID__ = rootId;
4188
- return record;
4189
- } else {
4190
- return {};
4240
+ });
4241
+
4242
+ // src/state/app-record.ts
4243
+ var devtoolsAppRecords = new Proxy(devtoolsState.appRecords, {
4244
+ get(_, property) {
4245
+ if (property === "value")
4246
+ return devtoolsState.appRecords;
4247
+ else if (property === "active")
4248
+ return devtoolsState.activeAppRecord;
4249
+ else if (property === "activeId")
4250
+ return devtoolsState.activeAppRecordId;
4251
+ },
4252
+ set(target9, property, value) {
4253
+ var _a10;
4254
+ const oldState = { ...devtoolsState };
4255
+ if (property === "value") {
4256
+ devtoolsState.appRecords = value;
4257
+ } else if (property === "active") {
4258
+ const _value = value;
4259
+ devtoolsState.activeAppRecord = _value;
4260
+ devtoolsContext.appRecord = _value;
4261
+ devtoolsContext.api = _value.api;
4262
+ devtoolsContext.inspector = (_a10 = _value.inspector) != null ? _a10 : [];
4263
+ normalizeRouterInfo(value);
4264
+ devtoolsContext.routerInfo = devtoolsRouterInfo;
4265
+ } else if (property === "activeId") {
4266
+ devtoolsState.activeAppRecordId = value;
4267
+ }
4268
+ callStateUpdatedHook(devtoolsState, oldState);
4269
+ if (["connected", "clientConnected"].includes(property.toString()) && oldState[property] !== value)
4270
+ callConnectedUpdatedHook(devtoolsState, oldState);
4271
+ return true;
4191
4272
  }
4273
+ });
4274
+ var _a8, _b8;
4275
+ var appRecordInfo = (_b8 = (_a8 = target6).__VUE_DEVTOOLS_APP_RECROD_INFO__) != null ? _b8 : _a8.__VUE_DEVTOOLS_APP_RECROD_INFO__ = {
4276
+ id: 0,
4277
+ appIds: /* @__PURE__ */ new Set()
4278
+ };
4279
+
4280
+ // src/state/env.ts
4281
+ init_esm_shims();
4282
+ import { target as target7 } from "@vue/devtools-shared";
4283
+ var _a9, _b9;
4284
+ (_b9 = (_a9 = target7).__VUE_DEVTOOLS_ENV__) != null ? _b9 : _a9.__VUE_DEVTOOLS_ENV__ = {
4285
+ vitePluginDetected: false
4286
+ };
4287
+ function getDevToolsEnv() {
4288
+ return target7.__VUE_DEVTOOLS_ENV__;
4289
+ }
4290
+ function setDevToolsEnv(env) {
4291
+ target7.__VUE_DEVTOOLS_ENV__ = {
4292
+ ...target7.__VUE_DEVTOOLS_ENV__,
4293
+ ...env
4294
+ };
4192
4295
  }
4193
4296
 
4194
- // src/core/general/index.ts
4297
+ // src/core/index.ts
4195
4298
  function initDevTools() {
4196
- var _a8, _b8, _c;
4197
- devtoolsState.vitePluginDetected = !!target7.__VUE_DEVTOOLS_VITE_PLUGIN_DETECTED__;
4198
- const isNewDevTools = ((_a8 = target7.__VUE_DEVTOOLS_GLOBAL_HOOK__) == null ? void 0 : _a8.id) === "vue-devtools-next";
4199
- if (target7.__VUE_DEVTOOLS_GLOBAL_HOOK__ && isNewDevTools)
4299
+ var _a10;
4300
+ devtoolsState.vitePluginDetected = getDevToolsEnv().vitePluginDetected;
4301
+ const isDevToolsNext = ((_a10 = target8.__VUE_DEVTOOLS_GLOBAL_HOOK__) == null ? void 0 : _a10.id) === "vue-devtools-next";
4302
+ if (target8.__VUE_DEVTOOLS_GLOBAL_HOOK__ && isDevToolsNext)
4200
4303
  return;
4201
- if (target7.__VUE_DEVTOOLS_GLOBAL_HOOK__)
4304
+ if (target8.__VUE_DEVTOOLS_GLOBAL_HOOK__)
4202
4305
  Object.assign(__VUE_DEVTOOLS_GLOBAL_HOOK__, createDevToolsHook());
4203
4306
  else
4204
- target7.__VUE_DEVTOOLS_GLOBAL_HOOK__ = createDevToolsHook();
4205
- (_c = (_b8 = target7).__VUE_DEVTOOLS_APP_RECORDS__) != null ? _c : _b8.__VUE_DEVTOOLS_APP_RECORDS__ = [];
4206
- hook.on.setupDevtoolsPlugin(collectRegisteredPlugin);
4307
+ target8.__VUE_DEVTOOLS_GLOBAL_HOOK__ = createDevToolsHook();
4308
+ hook.on.setupDevtoolsPlugin(collectDevToolsPlugin);
4207
4309
  hook.on.vueAppInit(async (app, version) => {
4208
- var _a9;
4209
4310
  const record = createAppRecord(app);
4210
4311
  const api = new DevToolsPluginApi();
4211
- devtoolsState.appRecords = [
4212
- ...(_a9 = devtoolsState.appRecords) != null ? _a9 : [],
4312
+ devtoolsAppRecords.value = [
4313
+ ...devtoolsAppRecords.value,
4213
4314
  {
4214
4315
  ...record,
4215
4316
  app,
@@ -4217,10 +4318,10 @@ function initDevTools() {
4217
4318
  api
4218
4319
  }
4219
4320
  ];
4220
- if (devtoolsState.appRecords.length === 1) {
4221
- await setActiveAppRecord(devtoolsState.appRecords[0]);
4321
+ if (devtoolsAppRecords.value.length === 1) {
4322
+ await setActiveAppRecord(devtoolsAppRecords.value[0]);
4222
4323
  devtoolsState.connected = true;
4223
- devtoolsHooks.callHook(DevToolsHooks3.APP_CONNECTED);
4324
+ devtoolsHooks.callHook("app:connected" /* APP_CONNECTED */);
4224
4325
  }
4225
4326
  });
4226
4327
  subscribeDevToolsHook();
@@ -4260,38 +4361,28 @@ function onDevToolsClientConnected(fn) {
4260
4361
  var devtools = {
4261
4362
  state: devtoolsState,
4262
4363
  context: devtoolsContext,
4263
- init: initDevTools,
4264
4364
  hook,
4365
+ init: initDevTools,
4265
4366
  get api() {
4266
4367
  return devtoolsContext.api;
4267
4368
  }
4268
4369
  };
4269
4370
  export {
4270
- ESC,
4271
- INFINITY,
4272
- MAX_ARRAY_SIZE,
4273
- MAX_STRING_SIZE,
4274
- NAN,
4275
- NEGATIVE_INFINITY,
4276
4371
  UNDEFINED,
4277
4372
  addCustomCommand,
4278
4373
  addCustomTab,
4279
4374
  devtools,
4280
- fnTypeRE,
4281
4375
  formatInspectorStateValue,
4282
4376
  getInspectorStateValueType,
4283
- getRawValue,
4284
- now,
4377
+ getRaw,
4285
4378
  onDevToolsClientConnected,
4286
4379
  onDevToolsConnected,
4287
4380
  parse,
4288
- rawTypeRE,
4289
4381
  removeCustomCommand,
4382
+ setDevToolsEnv,
4290
4383
  setupDevToolsPlugin,
4291
- specialTypeRE,
4292
4384
  stringify,
4293
- symbolRE,
4294
4385
  toEdit,
4295
4386
  toSubmit,
4296
- vueBuiltins
4387
+ toggleComponentInspectorEnabled
4297
4388
  };