@vue/devtools-kit 7.0.13 → 7.0.15

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