@vue/devtools-kit 7.0.14 → 7.0.16

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