市场夺宝奇兵
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5778 lines
171 KiB

  1. import { basename, camelize, classify, deepClone, isBrowser, isNuxtApp, isUrlString, kebabize, target } from "@vue/devtools-shared";
  2. import { debounce } from "perfect-debounce";
  3. import { createHooks } from "hookable";
  4. import { createBirpc, createBirpcGroup } from "birpc";
  5. //#region rolldown:runtime
  6. var __create = Object.create;
  7. var __defProp = Object.defineProperty;
  8. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  9. var __getOwnPropNames = Object.getOwnPropertyNames;
  10. var __getProtoOf = Object.getPrototypeOf;
  11. var __hasOwnProp = Object.prototype.hasOwnProperty;
  12. var __commonJS = (cb, mod) => function() {
  13. return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  14. };
  15. var __copyProps = (to, from, except, desc) => {
  16. if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
  17. key = keys[i];
  18. if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
  19. get: ((k) => from[k]).bind(null, key),
  20. enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
  21. });
  22. }
  23. return to;
  24. };
  25. var __toESM = (mod, isNodeMode, target$1) => (target$1 = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target$1, "default", {
  26. value: mod,
  27. enumerable: true
  28. }) : target$1, mod));
  29. //#endregion
  30. //#region src/compat/index.ts
  31. function onLegacyDevToolsPluginApiAvailable(cb) {
  32. if (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__) {
  33. cb();
  34. return;
  35. }
  36. Object.defineProperty(target, "__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__", {
  37. set(value) {
  38. if (value) cb();
  39. },
  40. configurable: true
  41. });
  42. }
  43. //#endregion
  44. //#region src/core/component/utils/index.ts
  45. function getComponentTypeName(options) {
  46. const name = options.name || options._componentTag || options.__VUE_DEVTOOLS_COMPONENT_GUSSED_NAME__ || options.__name;
  47. if (name === "index" && options.__file?.endsWith("index.vue")) return "";
  48. return name;
  49. }
  50. function getComponentFileName(options) {
  51. const file = options.__file;
  52. if (file) return classify(basename(file, ".vue"));
  53. }
  54. function getComponentName(options) {
  55. const name = options.displayName || options.name || options._componentTag;
  56. if (name) return name;
  57. return getComponentFileName(options);
  58. }
  59. function saveComponentGussedName(instance, name) {
  60. instance.type.__VUE_DEVTOOLS_COMPONENT_GUSSED_NAME__ = name;
  61. return name;
  62. }
  63. function getAppRecord(instance) {
  64. if (instance.__VUE_DEVTOOLS_NEXT_APP_RECORD__) return instance.__VUE_DEVTOOLS_NEXT_APP_RECORD__;
  65. else if (instance.root) return instance.appContext.app.__VUE_DEVTOOLS_NEXT_APP_RECORD__;
  66. }
  67. async function getComponentId(options) {
  68. const { app, uid, instance } = options;
  69. try {
  70. if (instance.__VUE_DEVTOOLS_NEXT_UID__) return instance.__VUE_DEVTOOLS_NEXT_UID__;
  71. const appRecord = await getAppRecord(app);
  72. if (!appRecord) return null;
  73. const isRoot = appRecord.rootInstance === instance;
  74. return `${appRecord.id}:${isRoot ? "root" : uid}`;
  75. } catch (e) {}
  76. }
  77. function isFragment(instance) {
  78. const subTreeType = instance.subTree?.type;
  79. const appRecord = getAppRecord(instance);
  80. if (appRecord) return appRecord?.types?.Fragment === subTreeType;
  81. return false;
  82. }
  83. function isBeingDestroyed(instance) {
  84. return instance._isBeingDestroyed || instance.isUnmounted;
  85. }
  86. /**
  87. * Get the appropriate display name for an instance.
  88. *
  89. * @param {Vue} instance
  90. * @return {string}
  91. */
  92. function getInstanceName(instance) {
  93. const name = getComponentTypeName(instance?.type || {});
  94. if (name) return name;
  95. if (instance?.root === instance) return "Root";
  96. for (const key in instance.parent?.type?.components) if (instance.parent.type.components[key] === instance?.type) return saveComponentGussedName(instance, key);
  97. for (const key in instance.appContext?.components) if (instance.appContext.components[key] === instance?.type) return saveComponentGussedName(instance, key);
  98. const fileName = getComponentFileName(instance?.type || {});
  99. if (fileName) return fileName;
  100. return "Anonymous Component";
  101. }
  102. /**
  103. * Returns a devtools unique id for instance.
  104. * @param {Vue} instance
  105. */
  106. function getUniqueComponentId(instance) {
  107. const appId = instance?.appContext?.app?.__VUE_DEVTOOLS_NEXT_APP_RECORD_ID__ ?? 0;
  108. const instanceId = instance === instance?.root ? "root" : instance.uid;
  109. return `${appId}:${instanceId}`;
  110. }
  111. function getRenderKey(value) {
  112. if (value == null) return "";
  113. if (typeof value === "number") return value;
  114. else if (typeof value === "string") return `'${value}'`;
  115. else if (Array.isArray(value)) return "Array";
  116. else return "Object";
  117. }
  118. function returnError(cb) {
  119. try {
  120. return cb();
  121. } catch (e) {
  122. return e;
  123. }
  124. }
  125. function getComponentInstance(appRecord, instanceId) {
  126. instanceId = instanceId || `${appRecord.id}:root`;
  127. return appRecord.instanceMap.get(instanceId) || appRecord.instanceMap.get(":root");
  128. }
  129. function ensurePropertyExists(obj, key, skipObjCheck = false) {
  130. return skipObjCheck ? key in obj : typeof obj === "object" && obj !== null ? key in obj : false;
  131. }
  132. //#endregion
  133. //#region src/core/component/state/bounding-rect.ts
  134. function createRect() {
  135. const rect = {
  136. top: 0,
  137. bottom: 0,
  138. left: 0,
  139. right: 0,
  140. get width() {
  141. return rect.right - rect.left;
  142. },
  143. get height() {
  144. return rect.bottom - rect.top;
  145. }
  146. };
  147. return rect;
  148. }
  149. let range;
  150. function getTextRect(node) {
  151. if (!range) range = document.createRange();
  152. range.selectNode(node);
  153. return range.getBoundingClientRect();
  154. }
  155. function getFragmentRect(vnode) {
  156. const rect = createRect();
  157. if (!vnode.children) return rect;
  158. for (let i = 0, l = vnode.children.length; i < l; i++) {
  159. const childVnode = vnode.children[i];
  160. let childRect;
  161. if (childVnode.component) childRect = getComponentBoundingRect(childVnode.component);
  162. else if (childVnode.el) {
  163. const el = childVnode.el;
  164. if (el.nodeType === 1 || el.getBoundingClientRect) childRect = el.getBoundingClientRect();
  165. else if (el.nodeType === 3 && el.data.trim()) childRect = getTextRect(el);
  166. }
  167. if (childRect) mergeRects(rect, childRect);
  168. }
  169. return rect;
  170. }
  171. function mergeRects(a, b) {
  172. if (!a.top || b.top < a.top) a.top = b.top;
  173. if (!a.bottom || b.bottom > a.bottom) a.bottom = b.bottom;
  174. if (!a.left || b.left < a.left) a.left = b.left;
  175. if (!a.right || b.right > a.right) a.right = b.right;
  176. return a;
  177. }
  178. const DEFAULT_RECT = {
  179. top: 0,
  180. left: 0,
  181. right: 0,
  182. bottom: 0,
  183. width: 0,
  184. height: 0
  185. };
  186. function getComponentBoundingRect(instance) {
  187. const el = instance.subTree.el;
  188. if (typeof window === "undefined") return DEFAULT_RECT;
  189. if (isFragment(instance)) return getFragmentRect(instance.subTree);
  190. else if (el?.nodeType === 1) return el?.getBoundingClientRect();
  191. else if (instance.subTree.component) return getComponentBoundingRect(instance.subTree.component);
  192. else return DEFAULT_RECT;
  193. }
  194. //#endregion
  195. //#region src/core/component/tree/el.ts
  196. function getRootElementsFromComponentInstance(instance) {
  197. if (isFragment(instance)) return getFragmentRootElements(instance.subTree);
  198. if (!instance.subTree) return [];
  199. return [instance.subTree.el];
  200. }
  201. function getFragmentRootElements(vnode) {
  202. if (!vnode.children) return [];
  203. const list = [];
  204. vnode.children.forEach((childVnode) => {
  205. if (childVnode.component) list.push(...getRootElementsFromComponentInstance(childVnode.component));
  206. else if (childVnode?.el) list.push(childVnode.el);
  207. });
  208. return list;
  209. }
  210. //#endregion
  211. //#region src/core/component-highlighter/index.ts
  212. const CONTAINER_ELEMENT_ID = "__vue-devtools-component-inspector__";
  213. const CARD_ELEMENT_ID = "__vue-devtools-component-inspector__card__";
  214. const COMPONENT_NAME_ELEMENT_ID = "__vue-devtools-component-inspector__name__";
  215. const INDICATOR_ELEMENT_ID = "__vue-devtools-component-inspector__indicator__";
  216. const containerStyles = {
  217. display: "block",
  218. zIndex: 2147483640,
  219. position: "fixed",
  220. backgroundColor: "#42b88325",
  221. border: "1px solid #42b88350",
  222. borderRadius: "5px",
  223. transition: "all 0.1s ease-in",
  224. pointerEvents: "none"
  225. };
  226. const cardStyles = {
  227. fontFamily: "Arial, Helvetica, sans-serif",
  228. padding: "5px 8px",
  229. borderRadius: "4px",
  230. textAlign: "left",
  231. position: "absolute",
  232. left: 0,
  233. color: "#e9e9e9",
  234. fontSize: "14px",
  235. fontWeight: 600,
  236. lineHeight: "24px",
  237. backgroundColor: "#42b883",
  238. boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)"
  239. };
  240. const indicatorStyles = {
  241. display: "inline-block",
  242. fontWeight: 400,
  243. fontStyle: "normal",
  244. fontSize: "12px",
  245. opacity: .7
  246. };
  247. function getContainerElement() {
  248. return document.getElementById(CONTAINER_ELEMENT_ID);
  249. }
  250. function getCardElement() {
  251. return document.getElementById(CARD_ELEMENT_ID);
  252. }
  253. function getIndicatorElement() {
  254. return document.getElementById(INDICATOR_ELEMENT_ID);
  255. }
  256. function getNameElement() {
  257. return document.getElementById(COMPONENT_NAME_ELEMENT_ID);
  258. }
  259. function getStyles(bounds) {
  260. return {
  261. left: `${Math.round(bounds.left * 100) / 100}px`,
  262. top: `${Math.round(bounds.top * 100) / 100}px`,
  263. width: `${Math.round(bounds.width * 100) / 100}px`,
  264. height: `${Math.round(bounds.height * 100) / 100}px`
  265. };
  266. }
  267. function create(options) {
  268. const containerEl = document.createElement("div");
  269. containerEl.id = options.elementId ?? CONTAINER_ELEMENT_ID;
  270. Object.assign(containerEl.style, {
  271. ...containerStyles,
  272. ...getStyles(options.bounds),
  273. ...options.style
  274. });
  275. const cardEl = document.createElement("span");
  276. cardEl.id = CARD_ELEMENT_ID;
  277. Object.assign(cardEl.style, {
  278. ...cardStyles,
  279. top: options.bounds.top < 35 ? 0 : "-35px"
  280. });
  281. const nameEl = document.createElement("span");
  282. nameEl.id = COMPONENT_NAME_ELEMENT_ID;
  283. nameEl.innerHTML = `&lt;${options.name}&gt;&nbsp;&nbsp;`;
  284. const indicatorEl = document.createElement("i");
  285. indicatorEl.id = INDICATOR_ELEMENT_ID;
  286. indicatorEl.innerHTML = `${Math.round(options.bounds.width * 100) / 100} x ${Math.round(options.bounds.height * 100) / 100}`;
  287. Object.assign(indicatorEl.style, indicatorStyles);
  288. cardEl.appendChild(nameEl);
  289. cardEl.appendChild(indicatorEl);
  290. containerEl.appendChild(cardEl);
  291. document.body.appendChild(containerEl);
  292. return containerEl;
  293. }
  294. function update(options) {
  295. const containerEl = getContainerElement();
  296. const cardEl = getCardElement();
  297. const nameEl = getNameElement();
  298. const indicatorEl = getIndicatorElement();
  299. if (containerEl) {
  300. Object.assign(containerEl.style, {
  301. ...containerStyles,
  302. ...getStyles(options.bounds)
  303. });
  304. Object.assign(cardEl.style, { top: options.bounds.top < 35 ? 0 : "-35px" });
  305. nameEl.innerHTML = `&lt;${options.name}&gt;&nbsp;&nbsp;`;
  306. indicatorEl.innerHTML = `${Math.round(options.bounds.width * 100) / 100} x ${Math.round(options.bounds.height * 100) / 100}`;
  307. }
  308. }
  309. function highlight(instance) {
  310. const bounds = getComponentBoundingRect(instance);
  311. if (!bounds.width && !bounds.height) return;
  312. const name = getInstanceName(instance);
  313. getContainerElement() ? update({
  314. bounds,
  315. name
  316. }) : create({
  317. bounds,
  318. name
  319. });
  320. }
  321. function unhighlight() {
  322. const el = getContainerElement();
  323. if (el) el.style.display = "none";
  324. }
  325. let inspectInstance = null;
  326. function inspectFn(e) {
  327. const target$1 = e.target;
  328. if (target$1) {
  329. const instance = target$1.__vueParentComponent;
  330. if (instance) {
  331. inspectInstance = instance;
  332. if (instance.vnode.el) {
  333. const bounds = getComponentBoundingRect(instance);
  334. const name = getInstanceName(instance);
  335. getContainerElement() ? update({
  336. bounds,
  337. name
  338. }) : create({
  339. bounds,
  340. name
  341. });
  342. }
  343. }
  344. }
  345. }
  346. function selectComponentFn(e, cb) {
  347. e.preventDefault();
  348. e.stopPropagation();
  349. if (inspectInstance) {
  350. const uniqueComponentId = getUniqueComponentId(inspectInstance);
  351. cb(uniqueComponentId);
  352. }
  353. }
  354. let inspectComponentHighLighterSelectFn = null;
  355. function cancelInspectComponentHighLighter() {
  356. unhighlight();
  357. window.removeEventListener("mouseover", inspectFn);
  358. window.removeEventListener("click", inspectComponentHighLighterSelectFn, true);
  359. inspectComponentHighLighterSelectFn = null;
  360. }
  361. function inspectComponentHighLighter() {
  362. window.addEventListener("mouseover", inspectFn);
  363. return new Promise((resolve) => {
  364. function onSelect(e) {
  365. e.preventDefault();
  366. e.stopPropagation();
  367. selectComponentFn(e, (id) => {
  368. window.removeEventListener("click", onSelect, true);
  369. inspectComponentHighLighterSelectFn = null;
  370. window.removeEventListener("mouseover", inspectFn);
  371. const el = getContainerElement();
  372. if (el) el.style.display = "none";
  373. resolve(JSON.stringify({ id }));
  374. });
  375. }
  376. inspectComponentHighLighterSelectFn = onSelect;
  377. window.addEventListener("click", onSelect, true);
  378. });
  379. }
  380. function scrollToComponent(options) {
  381. const instance = getComponentInstance(activeAppRecord.value, options.id);
  382. if (instance) {
  383. const [el] = getRootElementsFromComponentInstance(instance);
  384. if (typeof el.scrollIntoView === "function") el.scrollIntoView({ behavior: "smooth" });
  385. else {
  386. const bounds = getComponentBoundingRect(instance);
  387. const scrollTarget = document.createElement("div");
  388. const styles = {
  389. ...getStyles(bounds),
  390. position: "absolute"
  391. };
  392. Object.assign(scrollTarget.style, styles);
  393. document.body.appendChild(scrollTarget);
  394. scrollTarget.scrollIntoView({ behavior: "smooth" });
  395. setTimeout(() => {
  396. document.body.removeChild(scrollTarget);
  397. }, 2e3);
  398. }
  399. setTimeout(() => {
  400. const bounds = getComponentBoundingRect(instance);
  401. if (bounds.width || bounds.height) {
  402. const name = getInstanceName(instance);
  403. const el$1 = getContainerElement();
  404. el$1 ? update({
  405. ...options,
  406. name,
  407. bounds
  408. }) : create({
  409. ...options,
  410. name,
  411. bounds
  412. });
  413. setTimeout(() => {
  414. if (el$1) el$1.style.display = "none";
  415. }, 1500);
  416. }
  417. }, 1200);
  418. }
  419. }
  420. //#endregion
  421. //#region src/core/component-inspector/index.ts
  422. target.__VUE_DEVTOOLS_COMPONENT_INSPECTOR_ENABLED__ ??= true;
  423. function toggleComponentInspectorEnabled(enabled) {
  424. target.__VUE_DEVTOOLS_COMPONENT_INSPECTOR_ENABLED__ = enabled;
  425. }
  426. function waitForInspectorInit(cb) {
  427. let total = 0;
  428. const timer = setInterval(() => {
  429. if (target.__VUE_INSPECTOR__) {
  430. clearInterval(timer);
  431. total += 30;
  432. cb();
  433. }
  434. if (total >= 5e3) clearInterval(timer);
  435. }, 30);
  436. }
  437. function setupInspector() {
  438. const inspector = target.__VUE_INSPECTOR__;
  439. const _openInEditor = inspector.openInEditor;
  440. inspector.openInEditor = async (...params) => {
  441. inspector.disable();
  442. _openInEditor(...params);
  443. };
  444. }
  445. function getComponentInspector() {
  446. return new Promise((resolve) => {
  447. function setup() {
  448. setupInspector();
  449. resolve(target.__VUE_INSPECTOR__);
  450. }
  451. if (!target.__VUE_INSPECTOR__) waitForInspectorInit(() => {
  452. setup();
  453. });
  454. else setup();
  455. });
  456. }
  457. //#endregion
  458. //#region src/shared/stub-vue.ts
  459. /**
  460. * To prevent include a **HUGE** vue package in the final bundle of chrome ext / electron
  461. * we stub the necessary vue module.
  462. * This implementation is based on the 1c3327a0fa5983aa9078e3f7bb2330f572435425 commit
  463. */
  464. /**
  465. * @from [@vue/reactivity](https://github.com/vuejs/core/blob/1c3327a0fa5983aa9078e3f7bb2330f572435425/packages/reactivity/src/constants.ts#L17-L23)
  466. */
  467. let ReactiveFlags = /* @__PURE__ */ function(ReactiveFlags$1) {
  468. ReactiveFlags$1["SKIP"] = "__v_skip";
  469. ReactiveFlags$1["IS_REACTIVE"] = "__v_isReactive";
  470. ReactiveFlags$1["IS_READONLY"] = "__v_isReadonly";
  471. ReactiveFlags$1["IS_SHALLOW"] = "__v_isShallow";
  472. ReactiveFlags$1["RAW"] = "__v_raw";
  473. return ReactiveFlags$1;
  474. }({});
  475. /**
  476. * @from [@vue/reactivity](https://github.com/vuejs/core/blob/1c3327a0fa5983aa9078e3f7bb2330f572435425/packages/reactivity/src/reactive.ts#L330-L332)
  477. */
  478. function isReadonly(value) {
  479. return !!(value && value[ReactiveFlags.IS_READONLY]);
  480. }
  481. /**
  482. * @from [@vue/reactivity](https://github.com/vuejs/core/blob/1c3327a0fa5983aa9078e3f7bb2330f572435425/packages/reactivity/src/reactive.ts#L312-L317)
  483. */
  484. function isReactive$1(value) {
  485. if (isReadonly(value)) return isReactive$1(value[ReactiveFlags.RAW]);
  486. return !!(value && value[ReactiveFlags.IS_REACTIVE]);
  487. }
  488. function isRef$1(r) {
  489. return !!(r && r.__v_isRef === true);
  490. }
  491. /**
  492. * @from [@vue/reactivity](https://github.com/vuejs/core/blob/1c3327a0fa5983aa9078e3f7bb2330f572435425/packages/reactivity/src/reactive.ts#L372-L375)
  493. */
  494. function toRaw$1(observed) {
  495. const raw = observed && observed[ReactiveFlags.RAW];
  496. return raw ? toRaw$1(raw) : observed;
  497. }
  498. /**
  499. * @from [@vue/runtime-core](https://github.com/vuejs/core/blob/1c3327a0fa5983aa9078e3f7bb2330f572435425/packages/runtime-core/src/vnode.ts#L63-L68)
  500. */
  501. const Fragment = Symbol.for("v-fgt");
  502. //#endregion
  503. //#region src/core/component/state/editor.ts
  504. var StateEditor = class {
  505. constructor() {
  506. this.refEditor = new RefStateEditor();
  507. }
  508. set(object, path, value, cb) {
  509. const sections = Array.isArray(path) ? path : path.split(".");
  510. while (sections.length > 1) {
  511. const section = sections.shift();
  512. if (object instanceof Map) object = object.get(section);
  513. else if (object instanceof Set) object = Array.from(object.values())[section];
  514. else object = object[section];
  515. if (this.refEditor.isRef(object)) object = this.refEditor.get(object);
  516. }
  517. const field = sections[0];
  518. const item = this.refEditor.get(object)[field];
  519. if (cb) cb(object, field, value);
  520. else if (this.refEditor.isRef(item)) this.refEditor.set(item, value);
  521. else object[field] = value;
  522. }
  523. get(object, path) {
  524. const sections = Array.isArray(path) ? path : path.split(".");
  525. for (let i = 0; i < sections.length; i++) {
  526. if (object instanceof Map) object = object.get(sections[i]);
  527. else object = object[sections[i]];
  528. if (this.refEditor.isRef(object)) object = this.refEditor.get(object);
  529. if (!object) return void 0;
  530. }
  531. return object;
  532. }
  533. has(object, path, parent = false) {
  534. if (typeof object === "undefined") return false;
  535. const sections = Array.isArray(path) ? path.slice() : path.split(".");
  536. const size = !parent ? 1 : 2;
  537. while (object && sections.length > size) {
  538. const section = sections.shift();
  539. object = object[section];
  540. if (this.refEditor.isRef(object)) object = this.refEditor.get(object);
  541. }
  542. return object != null && Object.prototype.hasOwnProperty.call(object, sections[0]);
  543. }
  544. createDefaultSetCallback(state) {
  545. return (object, field, value) => {
  546. if (state.remove || state.newKey) if (Array.isArray(object)) object.splice(field, 1);
  547. else if (toRaw$1(object) instanceof Map) object.delete(field);
  548. else if (toRaw$1(object) instanceof Set) object.delete(Array.from(object.values())[field]);
  549. else Reflect.deleteProperty(object, field);
  550. if (!state.remove) {
  551. const target$1 = object[state.newKey || field];
  552. if (this.refEditor.isRef(target$1)) this.refEditor.set(target$1, value);
  553. else if (toRaw$1(object) instanceof Map) object.set(state.newKey || field, value);
  554. else if (toRaw$1(object) instanceof Set) object.add(value);
  555. else object[state.newKey || field] = value;
  556. }
  557. };
  558. }
  559. };
  560. var RefStateEditor = class {
  561. set(ref, value) {
  562. if (isRef$1(ref)) ref.value = value;
  563. else {
  564. if (ref instanceof Set && Array.isArray(value)) {
  565. ref.clear();
  566. value.forEach((v) => ref.add(v));
  567. return;
  568. }
  569. const currentKeys = Object.keys(value);
  570. if (ref instanceof Map) {
  571. const previousKeysSet$1 = new Set(ref.keys());
  572. currentKeys.forEach((key) => {
  573. ref.set(key, Reflect.get(value, key));
  574. previousKeysSet$1.delete(key);
  575. });
  576. previousKeysSet$1.forEach((key) => ref.delete(key));
  577. return;
  578. }
  579. const previousKeysSet = new Set(Object.keys(ref));
  580. currentKeys.forEach((key) => {
  581. Reflect.set(ref, key, Reflect.get(value, key));
  582. previousKeysSet.delete(key);
  583. });
  584. previousKeysSet.forEach((key) => Reflect.deleteProperty(ref, key));
  585. }
  586. }
  587. get(ref) {
  588. return isRef$1(ref) ? ref.value : ref;
  589. }
  590. isRef(ref) {
  591. return isRef$1(ref) || isReactive$1(ref);
  592. }
  593. };
  594. async function editComponentState(payload, stateEditor$1) {
  595. const { path, nodeId, state, type } = payload;
  596. const instance = getComponentInstance(activeAppRecord.value, nodeId);
  597. if (!instance) return;
  598. const targetPath = path.slice();
  599. let target$1;
  600. if (Object.keys(instance.props).includes(path[0])) target$1 = instance.props;
  601. else if (instance.devtoolsRawSetupState && Object.keys(instance.devtoolsRawSetupState).includes(path[0])) target$1 = instance.devtoolsRawSetupState;
  602. else if (instance.data && Object.keys(instance.data).includes(path[0])) target$1 = instance.data;
  603. else target$1 = instance.proxy;
  604. if (target$1 && targetPath) {
  605. if (state.type === "object" && type === "reactive") {}
  606. stateEditor$1.set(target$1, targetPath, state.value, stateEditor$1.createDefaultSetCallback(state));
  607. }
  608. }
  609. const stateEditor = new StateEditor();
  610. async function editState(payload) {
  611. editComponentState(payload, stateEditor);
  612. }
  613. //#endregion
  614. //#region src/core/timeline/storage.ts
  615. const TIMELINE_LAYERS_STATE_STORAGE_ID = "__VUE_DEVTOOLS_KIT_TIMELINE_LAYERS_STATE__";
  616. function addTimelineLayersStateToStorage(state) {
  617. if (!isBrowser || typeof localStorage === "undefined" || localStorage === null) return;
  618. localStorage.setItem(TIMELINE_LAYERS_STATE_STORAGE_ID, JSON.stringify(state));
  619. }
  620. function getTimelineLayersStateFromStorage() {
  621. if (!isBrowser || typeof localStorage === "undefined" || localStorage === null) return {
  622. recordingState: false,
  623. mouseEventEnabled: false,
  624. keyboardEventEnabled: false,
  625. componentEventEnabled: false,
  626. performanceEventEnabled: false,
  627. selected: ""
  628. };
  629. const state = localStorage.getItem(TIMELINE_LAYERS_STATE_STORAGE_ID);
  630. return state ? JSON.parse(state) : {
  631. recordingState: false,
  632. mouseEventEnabled: false,
  633. keyboardEventEnabled: false,
  634. componentEventEnabled: false,
  635. performanceEventEnabled: false,
  636. selected: ""
  637. };
  638. }
  639. //#endregion
  640. //#region src/ctx/timeline.ts
  641. target.__VUE_DEVTOOLS_KIT_TIMELINE_LAYERS ??= [];
  642. const devtoolsTimelineLayers = new Proxy(target.__VUE_DEVTOOLS_KIT_TIMELINE_LAYERS, { get(target$1, prop, receiver) {
  643. return Reflect.get(target$1, prop, receiver);
  644. } });
  645. function addTimelineLayer(options, descriptor) {
  646. devtoolsState.timelineLayersState[descriptor.id] = false;
  647. devtoolsTimelineLayers.push({
  648. ...options,
  649. descriptorId: descriptor.id,
  650. appRecord: getAppRecord(descriptor.app)
  651. });
  652. }
  653. function updateTimelineLayersState(state) {
  654. const updatedState = {
  655. ...devtoolsState.timelineLayersState,
  656. ...state
  657. };
  658. addTimelineLayersStateToStorage(updatedState);
  659. updateDevToolsState({ timelineLayersState: updatedState });
  660. }
  661. //#endregion
  662. //#region src/ctx/inspector.ts
  663. target.__VUE_DEVTOOLS_KIT_INSPECTOR__ ??= [];
  664. const devtoolsInspector = new Proxy(target.__VUE_DEVTOOLS_KIT_INSPECTOR__, { get(target$1, prop, receiver) {
  665. return Reflect.get(target$1, prop, receiver);
  666. } });
  667. const callInspectorUpdatedHook = debounce(() => {
  668. devtoolsContext.hooks.callHook(DevToolsMessagingHookKeys.SEND_INSPECTOR_TO_CLIENT, getActiveInspectors());
  669. });
  670. function addInspector(inspector, descriptor) {
  671. devtoolsInspector.push({
  672. options: inspector,
  673. descriptor,
  674. treeFilterPlaceholder: inspector.treeFilterPlaceholder ?? "Search tree...",
  675. stateFilterPlaceholder: inspector.stateFilterPlaceholder ?? "Search state...",
  676. treeFilter: "",
  677. selectedNodeId: "",
  678. appRecord: getAppRecord(descriptor.app)
  679. });
  680. callInspectorUpdatedHook();
  681. }
  682. function getActiveInspectors() {
  683. return devtoolsInspector.filter((inspector) => inspector.descriptor.app === activeAppRecord.value.app).filter((inspector) => inspector.descriptor.id !== "components").map((inspector) => {
  684. const descriptor = inspector.descriptor;
  685. const options = inspector.options;
  686. return {
  687. id: options.id,
  688. label: options.label,
  689. logo: descriptor.logo,
  690. icon: `custom-ic-baseline-${options?.icon?.replace(/_/g, "-")}`,
  691. packageName: descriptor.packageName,
  692. homepage: descriptor.homepage,
  693. pluginId: descriptor.id
  694. };
  695. });
  696. }
  697. function getInspectorInfo(id) {
  698. const inspector = getInspector(id, activeAppRecord.value.app);
  699. if (!inspector) return;
  700. const descriptor = inspector.descriptor;
  701. const options = inspector.options;
  702. const timelineLayers = devtoolsTimelineLayers.filter((layer) => layer.descriptorId === descriptor.id).map((item) => ({
  703. id: item.id,
  704. label: item.label,
  705. color: item.color
  706. }));
  707. return {
  708. id: options.id,
  709. label: options.label,
  710. logo: descriptor.logo,
  711. packageName: descriptor.packageName,
  712. homepage: descriptor.homepage,
  713. timelineLayers,
  714. treeFilterPlaceholder: inspector.treeFilterPlaceholder,
  715. stateFilterPlaceholder: inspector.stateFilterPlaceholder
  716. };
  717. }
  718. function getInspector(id, app) {
  719. return devtoolsInspector.find((inspector) => inspector.options.id === id && (app ? inspector.descriptor.app === app : true));
  720. }
  721. function getInspectorActions(id) {
  722. return getInspector(id)?.options.actions;
  723. }
  724. function getInspectorNodeActions(id) {
  725. return getInspector(id)?.options.nodeActions;
  726. }
  727. //#endregion
  728. //#region src/ctx/hook.ts
  729. let DevToolsV6PluginAPIHookKeys = /* @__PURE__ */ function(DevToolsV6PluginAPIHookKeys$1) {
  730. DevToolsV6PluginAPIHookKeys$1["VISIT_COMPONENT_TREE"] = "visitComponentTree";
  731. DevToolsV6PluginAPIHookKeys$1["INSPECT_COMPONENT"] = "inspectComponent";
  732. DevToolsV6PluginAPIHookKeys$1["EDIT_COMPONENT_STATE"] = "editComponentState";
  733. DevToolsV6PluginAPIHookKeys$1["GET_INSPECTOR_TREE"] = "getInspectorTree";
  734. DevToolsV6PluginAPIHookKeys$1["GET_INSPECTOR_STATE"] = "getInspectorState";
  735. DevToolsV6PluginAPIHookKeys$1["EDIT_INSPECTOR_STATE"] = "editInspectorState";
  736. DevToolsV6PluginAPIHookKeys$1["INSPECT_TIMELINE_EVENT"] = "inspectTimelineEvent";
  737. DevToolsV6PluginAPIHookKeys$1["TIMELINE_CLEARED"] = "timelineCleared";
  738. DevToolsV6PluginAPIHookKeys$1["SET_PLUGIN_SETTINGS"] = "setPluginSettings";
  739. return DevToolsV6PluginAPIHookKeys$1;
  740. }({});
  741. let DevToolsContextHookKeys = /* @__PURE__ */ function(DevToolsContextHookKeys$1) {
  742. DevToolsContextHookKeys$1["ADD_INSPECTOR"] = "addInspector";
  743. DevToolsContextHookKeys$1["SEND_INSPECTOR_TREE"] = "sendInspectorTree";
  744. DevToolsContextHookKeys$1["SEND_INSPECTOR_STATE"] = "sendInspectorState";
  745. DevToolsContextHookKeys$1["CUSTOM_INSPECTOR_SELECT_NODE"] = "customInspectorSelectNode";
  746. DevToolsContextHookKeys$1["TIMELINE_LAYER_ADDED"] = "timelineLayerAdded";
  747. DevToolsContextHookKeys$1["TIMELINE_EVENT_ADDED"] = "timelineEventAdded";
  748. DevToolsContextHookKeys$1["GET_COMPONENT_INSTANCES"] = "getComponentInstances";
  749. DevToolsContextHookKeys$1["GET_COMPONENT_BOUNDS"] = "getComponentBounds";
  750. DevToolsContextHookKeys$1["GET_COMPONENT_NAME"] = "getComponentName";
  751. DevToolsContextHookKeys$1["COMPONENT_HIGHLIGHT"] = "componentHighlight";
  752. DevToolsContextHookKeys$1["COMPONENT_UNHIGHLIGHT"] = "componentUnhighlight";
  753. return DevToolsContextHookKeys$1;
  754. }({});
  755. let DevToolsMessagingHookKeys = /* @__PURE__ */ function(DevToolsMessagingHookKeys$1) {
  756. DevToolsMessagingHookKeys$1["SEND_INSPECTOR_TREE_TO_CLIENT"] = "sendInspectorTreeToClient";
  757. DevToolsMessagingHookKeys$1["SEND_INSPECTOR_STATE_TO_CLIENT"] = "sendInspectorStateToClient";
  758. DevToolsMessagingHookKeys$1["SEND_TIMELINE_EVENT_TO_CLIENT"] = "sendTimelineEventToClient";
  759. DevToolsMessagingHookKeys$1["SEND_INSPECTOR_TO_CLIENT"] = "sendInspectorToClient";
  760. DevToolsMessagingHookKeys$1["SEND_ACTIVE_APP_UNMOUNTED_TO_CLIENT"] = "sendActiveAppUpdatedToClient";
  761. DevToolsMessagingHookKeys$1["DEVTOOLS_STATE_UPDATED"] = "devtoolsStateUpdated";
  762. DevToolsMessagingHookKeys$1["DEVTOOLS_CONNECTED_UPDATED"] = "devtoolsConnectedUpdated";
  763. DevToolsMessagingHookKeys$1["ROUTER_INFO_UPDATED"] = "routerInfoUpdated";
  764. return DevToolsMessagingHookKeys$1;
  765. }({});
  766. function createDevToolsCtxHooks() {
  767. const hooks$1 = createHooks();
  768. hooks$1.hook(DevToolsContextHookKeys.ADD_INSPECTOR, ({ inspector, plugin }) => {
  769. addInspector(inspector, plugin.descriptor);
  770. });
  771. const debounceSendInspectorTree = debounce(async ({ inspectorId, plugin }) => {
  772. if (!inspectorId || !plugin?.descriptor?.app || devtoolsState.highPerfModeEnabled) return;
  773. const inspector = getInspector(inspectorId, plugin.descriptor.app);
  774. const _payload = {
  775. app: plugin.descriptor.app,
  776. inspectorId,
  777. filter: inspector?.treeFilter || "",
  778. rootNodes: []
  779. };
  780. await new Promise((resolve) => {
  781. hooks$1.callHookWith(async (callbacks) => {
  782. await Promise.all(callbacks.map((cb) => cb(_payload)));
  783. resolve();
  784. }, DevToolsV6PluginAPIHookKeys.GET_INSPECTOR_TREE);
  785. });
  786. hooks$1.callHookWith(async (callbacks) => {
  787. await Promise.all(callbacks.map((cb) => cb({
  788. inspectorId,
  789. rootNodes: _payload.rootNodes
  790. })));
  791. }, DevToolsMessagingHookKeys.SEND_INSPECTOR_TREE_TO_CLIENT);
  792. }, 120);
  793. hooks$1.hook(DevToolsContextHookKeys.SEND_INSPECTOR_TREE, debounceSendInspectorTree);
  794. const debounceSendInspectorState = debounce(async ({ inspectorId, plugin }) => {
  795. if (!inspectorId || !plugin?.descriptor?.app || devtoolsState.highPerfModeEnabled) return;
  796. const inspector = getInspector(inspectorId, plugin.descriptor.app);
  797. const _payload = {
  798. app: plugin.descriptor.app,
  799. inspectorId,
  800. nodeId: inspector?.selectedNodeId || "",
  801. state: null
  802. };
  803. const ctx = { currentTab: `custom-inspector:${inspectorId}` };
  804. if (_payload.nodeId) await new Promise((resolve) => {
  805. hooks$1.callHookWith(async (callbacks) => {
  806. await Promise.all(callbacks.map((cb) => cb(_payload, ctx)));
  807. resolve();
  808. }, DevToolsV6PluginAPIHookKeys.GET_INSPECTOR_STATE);
  809. });
  810. hooks$1.callHookWith(async (callbacks) => {
  811. await Promise.all(callbacks.map((cb) => cb({
  812. inspectorId,
  813. nodeId: _payload.nodeId,
  814. state: _payload.state
  815. })));
  816. }, DevToolsMessagingHookKeys.SEND_INSPECTOR_STATE_TO_CLIENT);
  817. }, 120);
  818. hooks$1.hook(DevToolsContextHookKeys.SEND_INSPECTOR_STATE, debounceSendInspectorState);
  819. hooks$1.hook(DevToolsContextHookKeys.CUSTOM_INSPECTOR_SELECT_NODE, ({ inspectorId, nodeId, plugin }) => {
  820. const inspector = getInspector(inspectorId, plugin.descriptor.app);
  821. if (!inspector) return;
  822. inspector.selectedNodeId = nodeId;
  823. });
  824. hooks$1.hook(DevToolsContextHookKeys.TIMELINE_LAYER_ADDED, ({ options, plugin }) => {
  825. addTimelineLayer(options, plugin.descriptor);
  826. });
  827. hooks$1.hook(DevToolsContextHookKeys.TIMELINE_EVENT_ADDED, ({ options, plugin }) => {
  828. if (devtoolsState.highPerfModeEnabled || !devtoolsState.timelineLayersState?.[plugin.descriptor.id] && ![
  829. "performance",
  830. "component-event",
  831. "keyboard",
  832. "mouse"
  833. ].includes(options.layerId)) return;
  834. hooks$1.callHookWith(async (callbacks) => {
  835. await Promise.all(callbacks.map((cb) => cb(options)));
  836. }, DevToolsMessagingHookKeys.SEND_TIMELINE_EVENT_TO_CLIENT);
  837. });
  838. hooks$1.hook(DevToolsContextHookKeys.GET_COMPONENT_INSTANCES, async ({ app }) => {
  839. const appRecord = app.__VUE_DEVTOOLS_NEXT_APP_RECORD__;
  840. if (!appRecord) return null;
  841. const appId = appRecord.id.toString();
  842. return [...appRecord.instanceMap].filter(([key]) => key.split(":")[0] === appId).map(([, instance]) => instance);
  843. });
  844. hooks$1.hook(DevToolsContextHookKeys.GET_COMPONENT_BOUNDS, async ({ instance }) => {
  845. return getComponentBoundingRect(instance);
  846. });
  847. hooks$1.hook(DevToolsContextHookKeys.GET_COMPONENT_NAME, ({ instance }) => {
  848. return getInstanceName(instance);
  849. });
  850. hooks$1.hook(DevToolsContextHookKeys.COMPONENT_HIGHLIGHT, ({ uid }) => {
  851. const instance = activeAppRecord.value.instanceMap.get(uid);
  852. if (instance) highlight(instance);
  853. });
  854. hooks$1.hook(DevToolsContextHookKeys.COMPONENT_UNHIGHLIGHT, () => {
  855. unhighlight();
  856. });
  857. return hooks$1;
  858. }
  859. //#endregion
  860. //#region src/ctx/state.ts
  861. target.__VUE_DEVTOOLS_KIT_APP_RECORDS__ ??= [];
  862. target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__ ??= {};
  863. target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD_ID__ ??= "";
  864. target.__VUE_DEVTOOLS_KIT_CUSTOM_TABS__ ??= [];
  865. target.__VUE_DEVTOOLS_KIT_CUSTOM_COMMANDS__ ??= [];
  866. const STATE_KEY = "__VUE_DEVTOOLS_KIT_GLOBAL_STATE__";
  867. function initStateFactory() {
  868. return {
  869. connected: false,
  870. clientConnected: false,
  871. vitePluginDetected: true,
  872. appRecords: [],
  873. activeAppRecordId: "",
  874. tabs: [],
  875. commands: [],
  876. highPerfModeEnabled: true,
  877. devtoolsClientDetected: {},
  878. perfUniqueGroupId: 0,
  879. timelineLayersState: getTimelineLayersStateFromStorage()
  880. };
  881. }
  882. target[STATE_KEY] ??= initStateFactory();
  883. const callStateUpdatedHook = debounce((state) => {
  884. devtoolsContext.hooks.callHook(DevToolsMessagingHookKeys.DEVTOOLS_STATE_UPDATED, { state });
  885. });
  886. const callConnectedUpdatedHook = debounce((state, oldState) => {
  887. devtoolsContext.hooks.callHook(DevToolsMessagingHookKeys.DEVTOOLS_CONNECTED_UPDATED, {
  888. state,
  889. oldState
  890. });
  891. });
  892. const devtoolsAppRecords = new Proxy(target.__VUE_DEVTOOLS_KIT_APP_RECORDS__, { get(_target, prop, receiver) {
  893. if (prop === "value") return target.__VUE_DEVTOOLS_KIT_APP_RECORDS__;
  894. return target.__VUE_DEVTOOLS_KIT_APP_RECORDS__[prop];
  895. } });
  896. const addDevToolsAppRecord = (app) => {
  897. target.__VUE_DEVTOOLS_KIT_APP_RECORDS__ = [...target.__VUE_DEVTOOLS_KIT_APP_RECORDS__, app];
  898. };
  899. const removeDevToolsAppRecord = (app) => {
  900. target.__VUE_DEVTOOLS_KIT_APP_RECORDS__ = devtoolsAppRecords.value.filter((record) => record.app !== app);
  901. };
  902. const activeAppRecord = new Proxy(target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__, { get(_target, prop, receiver) {
  903. if (prop === "value") return target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__;
  904. else if (prop === "id") return target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD_ID__;
  905. return target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__[prop];
  906. } });
  907. function updateAllStates() {
  908. callStateUpdatedHook({
  909. ...target[STATE_KEY],
  910. appRecords: devtoolsAppRecords.value,
  911. activeAppRecordId: activeAppRecord.id,
  912. tabs: target.__VUE_DEVTOOLS_KIT_CUSTOM_TABS__,
  913. commands: target.__VUE_DEVTOOLS_KIT_CUSTOM_COMMANDS__
  914. });
  915. }
  916. function setActiveAppRecord(app) {
  917. target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__ = app;
  918. updateAllStates();
  919. }
  920. function setActiveAppRecordId(id) {
  921. target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD_ID__ = id;
  922. updateAllStates();
  923. }
  924. const devtoolsState = new Proxy(target[STATE_KEY], {
  925. get(target$1, property) {
  926. if (property === "appRecords") return devtoolsAppRecords;
  927. else if (property === "activeAppRecordId") return activeAppRecord.id;
  928. else if (property === "tabs") return target.__VUE_DEVTOOLS_KIT_CUSTOM_TABS__;
  929. else if (property === "commands") return target.__VUE_DEVTOOLS_KIT_CUSTOM_COMMANDS__;
  930. return target[STATE_KEY][property];
  931. },
  932. deleteProperty(target$1, property) {
  933. delete target$1[property];
  934. return true;
  935. },
  936. set(target$1, property, value) {
  937. ({ ...target[STATE_KEY] });
  938. target$1[property] = value;
  939. target[STATE_KEY][property] = value;
  940. return true;
  941. }
  942. });
  943. function resetDevToolsState() {
  944. Object.assign(target[STATE_KEY], initStateFactory());
  945. }
  946. function updateDevToolsState(state) {
  947. const oldState = {
  948. ...target[STATE_KEY],
  949. appRecords: devtoolsAppRecords.value,
  950. activeAppRecordId: activeAppRecord.id
  951. };
  952. if (oldState.connected !== state.connected && state.connected || oldState.clientConnected !== state.clientConnected && state.clientConnected) callConnectedUpdatedHook(target[STATE_KEY], oldState);
  953. Object.assign(target[STATE_KEY], state);
  954. updateAllStates();
  955. }
  956. function onDevToolsConnected(fn) {
  957. return new Promise((resolve) => {
  958. if (devtoolsState.connected) {
  959. fn();
  960. resolve();
  961. }
  962. devtoolsContext.hooks.hook(DevToolsMessagingHookKeys.DEVTOOLS_CONNECTED_UPDATED, ({ state }) => {
  963. if (state.connected) {
  964. fn();
  965. resolve();
  966. }
  967. });
  968. });
  969. }
  970. const resolveIcon = (icon) => {
  971. if (!icon) return;
  972. if (icon.startsWith("baseline-")) return `custom-ic-${icon}`;
  973. if (icon.startsWith("i-") || isUrlString(icon)) return icon;
  974. return `custom-ic-baseline-${icon}`;
  975. };
  976. function addCustomTab(tab) {
  977. const tabs = target.__VUE_DEVTOOLS_KIT_CUSTOM_TABS__;
  978. if (tabs.some((t) => t.name === tab.name)) return;
  979. tabs.push({
  980. ...tab,
  981. icon: resolveIcon(tab.icon)
  982. });
  983. updateAllStates();
  984. }
  985. function addCustomCommand(action) {
  986. const commands = target.__VUE_DEVTOOLS_KIT_CUSTOM_COMMANDS__;
  987. if (commands.some((t) => t.id === action.id)) return;
  988. commands.push({
  989. ...action,
  990. icon: resolveIcon(action.icon),
  991. children: action.children ? action.children.map((child) => ({
  992. ...child,
  993. icon: resolveIcon(child.icon)
  994. })) : void 0
  995. });
  996. updateAllStates();
  997. }
  998. function removeCustomCommand(actionId) {
  999. const commands = target.__VUE_DEVTOOLS_KIT_CUSTOM_COMMANDS__;
  1000. const index = commands.findIndex((t) => t.id === actionId);
  1001. if (index === -1) return;
  1002. commands.splice(index, 1);
  1003. updateAllStates();
  1004. }
  1005. function toggleClientConnected(state) {
  1006. updateDevToolsState({ clientConnected: state });
  1007. }
  1008. //#endregion
  1009. //#region src/core/open-in-editor/index.ts
  1010. function setOpenInEditorBaseUrl(url) {
  1011. target.__VUE_DEVTOOLS_OPEN_IN_EDITOR_BASE_URL__ = url;
  1012. }
  1013. function openInEditor(options = {}) {
  1014. const { file, host, baseUrl = window.location.origin, line = 0, column = 0 } = options;
  1015. if (file) {
  1016. if (host === "chrome-extension") {
  1017. const fileName = file.replace(/\\/g, "\\\\");
  1018. const _baseUrl = window.VUE_DEVTOOLS_CONFIG?.openInEditorHost ?? "/";
  1019. fetch(`${_baseUrl}__open-in-editor?file=${encodeURI(file)}`).then((response) => {
  1020. if (!response.ok) {
  1021. const msg = `Opening component ${fileName} failed`;
  1022. console.log(`%c${msg}`, "color:red");
  1023. }
  1024. });
  1025. } else if (devtoolsState.vitePluginDetected) {
  1026. const _baseUrl = target.__VUE_DEVTOOLS_OPEN_IN_EDITOR_BASE_URL__ ?? baseUrl;
  1027. target.__VUE_INSPECTOR__.openInEditor(_baseUrl, file, line, column);
  1028. }
  1029. }
  1030. }
  1031. //#endregion
  1032. //#region src/ctx/plugin.ts
  1033. target.__VUE_DEVTOOLS_KIT_PLUGIN_BUFFER__ ??= [];
  1034. const devtoolsPluginBuffer = new Proxy(target.__VUE_DEVTOOLS_KIT_PLUGIN_BUFFER__, { get(target$1, prop, receiver) {
  1035. return Reflect.get(target$1, prop, receiver);
  1036. } });
  1037. function addDevToolsPluginToBuffer(pluginDescriptor, setupFn) {
  1038. devtoolsPluginBuffer.push([pluginDescriptor, setupFn]);
  1039. }
  1040. //#endregion
  1041. //#region src/core/plugin/plugin-settings.ts
  1042. function _getSettings(settings) {
  1043. const _settings = {};
  1044. Object.keys(settings).forEach((key) => {
  1045. _settings[key] = settings[key].defaultValue;
  1046. });
  1047. return _settings;
  1048. }
  1049. function getPluginLocalKey(pluginId) {
  1050. return `__VUE_DEVTOOLS_NEXT_PLUGIN_SETTINGS__${pluginId}__`;
  1051. }
  1052. function getPluginSettingsOptions(pluginId) {
  1053. return (devtoolsPluginBuffer.find((item) => item[0].id === pluginId && !!item[0]?.settings)?.[0] ?? null)?.settings ?? null;
  1054. }
  1055. function getPluginSettings(pluginId, fallbackValue) {
  1056. const localKey = getPluginLocalKey(pluginId);
  1057. if (localKey) {
  1058. const localSettings = localStorage.getItem(localKey);
  1059. if (localSettings) return JSON.parse(localSettings);
  1060. }
  1061. if (pluginId) {
  1062. const item = devtoolsPluginBuffer.find((item$1) => item$1[0].id === pluginId)?.[0] ?? null;
  1063. return _getSettings(item?.settings ?? {});
  1064. }
  1065. return _getSettings(fallbackValue);
  1066. }
  1067. function initPluginSettings(pluginId, settings) {
  1068. const localKey = getPluginLocalKey(pluginId);
  1069. if (!localStorage.getItem(localKey)) localStorage.setItem(localKey, JSON.stringify(_getSettings(settings)));
  1070. }
  1071. function setPluginSettings(pluginId, key, value) {
  1072. const localKey = getPluginLocalKey(pluginId);
  1073. const localSettings = localStorage.getItem(localKey);
  1074. const parsedLocalSettings = JSON.parse(localSettings || "{}");
  1075. const updated = {
  1076. ...parsedLocalSettings,
  1077. [key]: value
  1078. };
  1079. localStorage.setItem(localKey, JSON.stringify(updated));
  1080. devtoolsContext.hooks.callHookWith((callbacks) => {
  1081. callbacks.forEach((cb) => cb({
  1082. pluginId,
  1083. key,
  1084. oldValue: parsedLocalSettings[key],
  1085. newValue: value,
  1086. settings: updated
  1087. }));
  1088. }, DevToolsV6PluginAPIHookKeys.SET_PLUGIN_SETTINGS);
  1089. }
  1090. //#endregion
  1091. //#region src/types/hook.ts
  1092. let DevToolsHooks = /* @__PURE__ */ function(DevToolsHooks$1) {
  1093. DevToolsHooks$1["APP_INIT"] = "app:init";
  1094. DevToolsHooks$1["APP_UNMOUNT"] = "app:unmount";
  1095. DevToolsHooks$1["COMPONENT_UPDATED"] = "component:updated";
  1096. DevToolsHooks$1["COMPONENT_ADDED"] = "component:added";
  1097. DevToolsHooks$1["COMPONENT_REMOVED"] = "component:removed";
  1098. DevToolsHooks$1["COMPONENT_EMIT"] = "component:emit";
  1099. DevToolsHooks$1["PERFORMANCE_START"] = "perf:start";
  1100. DevToolsHooks$1["PERFORMANCE_END"] = "perf:end";
  1101. DevToolsHooks$1["ADD_ROUTE"] = "router:add-route";
  1102. DevToolsHooks$1["REMOVE_ROUTE"] = "router:remove-route";
  1103. DevToolsHooks$1["RENDER_TRACKED"] = "render:tracked";
  1104. DevToolsHooks$1["RENDER_TRIGGERED"] = "render:triggered";
  1105. DevToolsHooks$1["APP_CONNECTED"] = "app:connected";
  1106. DevToolsHooks$1["SETUP_DEVTOOLS_PLUGIN"] = "devtools-plugin:setup";
  1107. return DevToolsHooks$1;
  1108. }({});
  1109. //#endregion
  1110. //#region src/hook/index.ts
  1111. const devtoolsHooks = target.__VUE_DEVTOOLS_HOOK ??= createHooks();
  1112. const on = {
  1113. vueAppInit(fn) {
  1114. devtoolsHooks.hook(DevToolsHooks.APP_INIT, fn);
  1115. },
  1116. vueAppUnmount(fn) {
  1117. devtoolsHooks.hook(DevToolsHooks.APP_UNMOUNT, fn);
  1118. },
  1119. vueAppConnected(fn) {
  1120. devtoolsHooks.hook(DevToolsHooks.APP_CONNECTED, fn);
  1121. },
  1122. componentAdded(fn) {
  1123. return devtoolsHooks.hook(DevToolsHooks.COMPONENT_ADDED, fn);
  1124. },
  1125. componentEmit(fn) {
  1126. return devtoolsHooks.hook(DevToolsHooks.COMPONENT_EMIT, fn);
  1127. },
  1128. componentUpdated(fn) {
  1129. return devtoolsHooks.hook(DevToolsHooks.COMPONENT_UPDATED, fn);
  1130. },
  1131. componentRemoved(fn) {
  1132. return devtoolsHooks.hook(DevToolsHooks.COMPONENT_REMOVED, fn);
  1133. },
  1134. setupDevtoolsPlugin(fn) {
  1135. devtoolsHooks.hook(DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, fn);
  1136. },
  1137. perfStart(fn) {
  1138. return devtoolsHooks.hook(DevToolsHooks.PERFORMANCE_START, fn);
  1139. },
  1140. perfEnd(fn) {
  1141. return devtoolsHooks.hook(DevToolsHooks.PERFORMANCE_END, fn);
  1142. }
  1143. };
  1144. function createDevToolsHook() {
  1145. return {
  1146. id: "vue-devtools-next",
  1147. devtoolsVersion: "7.0",
  1148. enabled: false,
  1149. appRecords: [],
  1150. apps: [],
  1151. events: /* @__PURE__ */ new Map(),
  1152. on(event, fn) {
  1153. if (!this.events.has(event)) this.events.set(event, []);
  1154. this.events.get(event)?.push(fn);
  1155. return () => this.off(event, fn);
  1156. },
  1157. once(event, fn) {
  1158. const onceFn = (...args) => {
  1159. this.off(event, onceFn);
  1160. fn(...args);
  1161. };
  1162. this.on(event, onceFn);
  1163. return [event, onceFn];
  1164. },
  1165. off(event, fn) {
  1166. if (this.events.has(event)) {
  1167. const eventCallbacks = this.events.get(event);
  1168. const index = eventCallbacks.indexOf(fn);
  1169. if (index !== -1) eventCallbacks.splice(index, 1);
  1170. }
  1171. },
  1172. emit(event, ...payload) {
  1173. if (this.events.has(event)) this.events.get(event).forEach((fn) => fn(...payload));
  1174. }
  1175. };
  1176. }
  1177. function subscribeDevToolsHook(hook$1) {
  1178. hook$1.on(DevToolsHooks.APP_INIT, (app, version, types) => {
  1179. if (app?._instance?.type?.devtools?.hide) return;
  1180. devtoolsHooks.callHook(DevToolsHooks.APP_INIT, app, version, types);
  1181. });
  1182. hook$1.on(DevToolsHooks.APP_UNMOUNT, (app) => {
  1183. devtoolsHooks.callHook(DevToolsHooks.APP_UNMOUNT, app);
  1184. });
  1185. hook$1.on(DevToolsHooks.COMPONENT_ADDED, async (app, uid, parentUid, component) => {
  1186. if (app?._instance?.type?.devtools?.hide || devtoolsState.highPerfModeEnabled) return;
  1187. if (!app || typeof uid !== "number" && !uid || !component) return;
  1188. devtoolsHooks.callHook(DevToolsHooks.COMPONENT_ADDED, app, uid, parentUid, component);
  1189. });
  1190. hook$1.on(DevToolsHooks.COMPONENT_UPDATED, (app, uid, parentUid, component) => {
  1191. if (!app || typeof uid !== "number" && !uid || !component || devtoolsState.highPerfModeEnabled) return;
  1192. devtoolsHooks.callHook(DevToolsHooks.COMPONENT_UPDATED, app, uid, parentUid, component);
  1193. });
  1194. hook$1.on(DevToolsHooks.COMPONENT_REMOVED, async (app, uid, parentUid, component) => {
  1195. if (!app || typeof uid !== "number" && !uid || !component || devtoolsState.highPerfModeEnabled) return;
  1196. devtoolsHooks.callHook(DevToolsHooks.COMPONENT_REMOVED, app, uid, parentUid, component);
  1197. });
  1198. hook$1.on(DevToolsHooks.COMPONENT_EMIT, async (app, instance, event, params) => {
  1199. if (!app || !instance || devtoolsState.highPerfModeEnabled) return;
  1200. devtoolsHooks.callHook(DevToolsHooks.COMPONENT_EMIT, app, instance, event, params);
  1201. });
  1202. hook$1.on(DevToolsHooks.PERFORMANCE_START, (app, uid, vm, type, time) => {
  1203. if (!app || devtoolsState.highPerfModeEnabled) return;
  1204. devtoolsHooks.callHook(DevToolsHooks.PERFORMANCE_START, app, uid, vm, type, time);
  1205. });
  1206. hook$1.on(DevToolsHooks.PERFORMANCE_END, (app, uid, vm, type, time) => {
  1207. if (!app || devtoolsState.highPerfModeEnabled) return;
  1208. devtoolsHooks.callHook(DevToolsHooks.PERFORMANCE_END, app, uid, vm, type, time);
  1209. });
  1210. hook$1.on(DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, (pluginDescriptor, setupFn, options) => {
  1211. if (options?.target === "legacy") return;
  1212. devtoolsHooks.callHook(DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, pluginDescriptor, setupFn);
  1213. });
  1214. }
  1215. const hook = {
  1216. on,
  1217. setupDevToolsPlugin(pluginDescriptor, setupFn) {
  1218. return devtoolsHooks.callHook(DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, pluginDescriptor, setupFn);
  1219. }
  1220. };
  1221. //#endregion
  1222. //#region src/api/v6/index.ts
  1223. var DevToolsV6PluginAPI = class {
  1224. constructor({ plugin, ctx }) {
  1225. this.hooks = ctx.hooks;
  1226. this.plugin = plugin;
  1227. }
  1228. get on() {
  1229. return {
  1230. visitComponentTree: (handler) => {
  1231. this.hooks.hook(DevToolsV6PluginAPIHookKeys.VISIT_COMPONENT_TREE, handler);
  1232. },
  1233. inspectComponent: (handler) => {
  1234. this.hooks.hook(DevToolsV6PluginAPIHookKeys.INSPECT_COMPONENT, handler);
  1235. },
  1236. editComponentState: (handler) => {
  1237. this.hooks.hook(DevToolsV6PluginAPIHookKeys.EDIT_COMPONENT_STATE, handler);
  1238. },
  1239. getInspectorTree: (handler) => {
  1240. this.hooks.hook(DevToolsV6PluginAPIHookKeys.GET_INSPECTOR_TREE, handler);
  1241. },
  1242. getInspectorState: (handler) => {
  1243. this.hooks.hook(DevToolsV6PluginAPIHookKeys.GET_INSPECTOR_STATE, handler);
  1244. },
  1245. editInspectorState: (handler) => {
  1246. this.hooks.hook(DevToolsV6PluginAPIHookKeys.EDIT_INSPECTOR_STATE, handler);
  1247. },
  1248. inspectTimelineEvent: (handler) => {
  1249. this.hooks.hook(DevToolsV6PluginAPIHookKeys.INSPECT_TIMELINE_EVENT, handler);
  1250. },
  1251. timelineCleared: (handler) => {
  1252. this.hooks.hook(DevToolsV6PluginAPIHookKeys.TIMELINE_CLEARED, handler);
  1253. },
  1254. setPluginSettings: (handler) => {
  1255. this.hooks.hook(DevToolsV6PluginAPIHookKeys.SET_PLUGIN_SETTINGS, handler);
  1256. }
  1257. };
  1258. }
  1259. notifyComponentUpdate(instance) {
  1260. if (devtoolsState.highPerfModeEnabled) return;
  1261. const inspector = getActiveInspectors().find((i) => i.packageName === this.plugin.descriptor.packageName);
  1262. if (inspector?.id) {
  1263. if (instance) {
  1264. const args = [
  1265. instance.appContext.app,
  1266. instance.uid,
  1267. instance.parent?.uid,
  1268. instance
  1269. ];
  1270. devtoolsHooks.callHook(DevToolsHooks.COMPONENT_UPDATED, ...args);
  1271. } else devtoolsHooks.callHook(DevToolsHooks.COMPONENT_UPDATED);
  1272. this.hooks.callHook(DevToolsContextHookKeys.SEND_INSPECTOR_STATE, {
  1273. inspectorId: inspector.id,
  1274. plugin: this.plugin
  1275. });
  1276. }
  1277. }
  1278. addInspector(options) {
  1279. this.hooks.callHook(DevToolsContextHookKeys.ADD_INSPECTOR, {
  1280. inspector: options,
  1281. plugin: this.plugin
  1282. });
  1283. if (this.plugin.descriptor.settings) initPluginSettings(options.id, this.plugin.descriptor.settings);
  1284. }
  1285. sendInspectorTree(inspectorId) {
  1286. if (devtoolsState.highPerfModeEnabled) return;
  1287. this.hooks.callHook(DevToolsContextHookKeys.SEND_INSPECTOR_TREE, {
  1288. inspectorId,
  1289. plugin: this.plugin
  1290. });
  1291. }
  1292. sendInspectorState(inspectorId) {
  1293. if (devtoolsState.highPerfModeEnabled) return;
  1294. this.hooks.callHook(DevToolsContextHookKeys.SEND_INSPECTOR_STATE, {
  1295. inspectorId,
  1296. plugin: this.plugin
  1297. });
  1298. }
  1299. selectInspectorNode(inspectorId, nodeId) {
  1300. this.hooks.callHook(DevToolsContextHookKeys.CUSTOM_INSPECTOR_SELECT_NODE, {
  1301. inspectorId,
  1302. nodeId,
  1303. plugin: this.plugin
  1304. });
  1305. }
  1306. visitComponentTree(payload) {
  1307. return this.hooks.callHook(DevToolsV6PluginAPIHookKeys.VISIT_COMPONENT_TREE, payload);
  1308. }
  1309. now() {
  1310. if (devtoolsState.highPerfModeEnabled) return 0;
  1311. return Date.now();
  1312. }
  1313. addTimelineLayer(options) {
  1314. this.hooks.callHook(DevToolsContextHookKeys.TIMELINE_LAYER_ADDED, {
  1315. options,
  1316. plugin: this.plugin
  1317. });
  1318. }
  1319. addTimelineEvent(options) {
  1320. if (devtoolsState.highPerfModeEnabled) return;
  1321. this.hooks.callHook(DevToolsContextHookKeys.TIMELINE_EVENT_ADDED, {
  1322. options,
  1323. plugin: this.plugin
  1324. });
  1325. }
  1326. getSettings(pluginId) {
  1327. return getPluginSettings(pluginId ?? this.plugin.descriptor.id, this.plugin.descriptor.settings);
  1328. }
  1329. getComponentInstances(app) {
  1330. return this.hooks.callHook(DevToolsContextHookKeys.GET_COMPONENT_INSTANCES, { app });
  1331. }
  1332. getComponentBounds(instance) {
  1333. return this.hooks.callHook(DevToolsContextHookKeys.GET_COMPONENT_BOUNDS, { instance });
  1334. }
  1335. getComponentName(instance) {
  1336. return this.hooks.callHook(DevToolsContextHookKeys.GET_COMPONENT_NAME, { instance });
  1337. }
  1338. highlightElement(instance) {
  1339. const uid = instance.__VUE_DEVTOOLS_NEXT_UID__;
  1340. return this.hooks.callHook(DevToolsContextHookKeys.COMPONENT_HIGHLIGHT, { uid });
  1341. }
  1342. unhighlightElement() {
  1343. return this.hooks.callHook(DevToolsContextHookKeys.COMPONENT_UNHIGHLIGHT);
  1344. }
  1345. };
  1346. //#endregion
  1347. //#region src/api/index.ts
  1348. const DevToolsPluginAPI = DevToolsV6PluginAPI;
  1349. //#endregion
  1350. //#region src/core/component/state/constants.ts
  1351. const vueBuiltins = new Set([
  1352. "nextTick",
  1353. "defineComponent",
  1354. "defineAsyncComponent",
  1355. "defineCustomElement",
  1356. "ref",
  1357. "computed",
  1358. "reactive",
  1359. "readonly",
  1360. "watchEffect",
  1361. "watchPostEffect",
  1362. "watchSyncEffect",
  1363. "watch",
  1364. "isRef",
  1365. "unref",
  1366. "toRef",
  1367. "toRefs",
  1368. "isProxy",
  1369. "isReactive",
  1370. "isReadonly",
  1371. "shallowRef",
  1372. "triggerRef",
  1373. "customRef",
  1374. "shallowReactive",
  1375. "shallowReadonly",
  1376. "toRaw",
  1377. "markRaw",
  1378. "effectScope",
  1379. "getCurrentScope",
  1380. "onScopeDispose",
  1381. "onMounted",
  1382. "onUpdated",
  1383. "onUnmounted",
  1384. "onBeforeMount",
  1385. "onBeforeUpdate",
  1386. "onBeforeUnmount",
  1387. "onErrorCaptured",
  1388. "onRenderTracked",
  1389. "onRenderTriggered",
  1390. "onActivated",
  1391. "onDeactivated",
  1392. "onServerPrefetch",
  1393. "provide",
  1394. "inject",
  1395. "h",
  1396. "mergeProps",
  1397. "cloneVNode",
  1398. "isVNode",
  1399. "resolveComponent",
  1400. "resolveDirective",
  1401. "withDirectives",
  1402. "withModifiers"
  1403. ]);
  1404. const symbolRE = /^\[native Symbol Symbol\((.*)\)\]$/;
  1405. const rawTypeRE = /^\[object (\w+)\]$/;
  1406. const specialTypeRE = /^\[native (\w+) (.*?)(<>(([\s\S])*))?\]$/;
  1407. const fnTypeRE = /^(?:function|class) (\w+)/;
  1408. const MAX_STRING_SIZE = 1e4;
  1409. const MAX_ARRAY_SIZE = 5e3;
  1410. const UNDEFINED = "__vue_devtool_undefined__";
  1411. const INFINITY = "__vue_devtool_infinity__";
  1412. const NEGATIVE_INFINITY = "__vue_devtool_negative_infinity__";
  1413. const NAN = "__vue_devtool_nan__";
  1414. const ESC = {
  1415. "<": "&lt;",
  1416. ">": "&gt;",
  1417. "\"": "&quot;",
  1418. "&": "&amp;"
  1419. };
  1420. //#endregion
  1421. //#region src/core/component/state/is.ts
  1422. function isVueInstance(value) {
  1423. if (!ensurePropertyExists(value, "_")) return false;
  1424. if (!isPlainObject(value._)) return false;
  1425. return Object.keys(value._).includes("vnode");
  1426. }
  1427. function isPlainObject(obj) {
  1428. return Object.prototype.toString.call(obj) === "[object Object]";
  1429. }
  1430. function isPrimitive$1(data) {
  1431. if (data == null) return true;
  1432. const type = typeof data;
  1433. return type === "string" || type === "number" || type === "boolean";
  1434. }
  1435. function isRef(raw) {
  1436. return !!raw.__v_isRef;
  1437. }
  1438. function isComputed(raw) {
  1439. return isRef(raw) && !!raw.effect;
  1440. }
  1441. function isReactive(raw) {
  1442. return !!raw.__v_isReactive;
  1443. }
  1444. function isReadOnly(raw) {
  1445. return !!raw.__v_isReadonly;
  1446. }
  1447. //#endregion
  1448. //#region src/core/component/state/util.ts
  1449. const tokenMap = {
  1450. [UNDEFINED]: "undefined",
  1451. [NAN]: "NaN",
  1452. [INFINITY]: "Infinity",
  1453. [NEGATIVE_INFINITY]: "-Infinity"
  1454. };
  1455. const reversedTokenMap = Object.entries(tokenMap).reduce((acc, [key, value]) => {
  1456. acc[value] = key;
  1457. return acc;
  1458. }, {});
  1459. function internalStateTokenToString(value) {
  1460. if (value === null) return "null";
  1461. return typeof value === "string" && tokenMap[value] || false;
  1462. }
  1463. function replaceTokenToString(value) {
  1464. const replaceRegex = new RegExp(`"(${Object.keys(tokenMap).join("|")})"`, "g");
  1465. return value.replace(replaceRegex, (_, g1) => tokenMap[g1]);
  1466. }
  1467. function replaceStringToToken(value) {
  1468. const literalValue = reversedTokenMap[value.trim()];
  1469. if (literalValue) return `"${literalValue}"`;
  1470. const replaceRegex = new RegExp(`:\\s*(${Object.keys(reversedTokenMap).join("|")})`, "g");
  1471. return value.replace(replaceRegex, (_, g1) => `:"${reversedTokenMap[g1]}"`);
  1472. }
  1473. /**
  1474. * Convert prop type constructor to string.
  1475. */
  1476. function getPropType(type) {
  1477. if (Array.isArray(type)) return type.map((t) => getPropType(t)).join(" or ");
  1478. if (type == null) return "null";
  1479. const match = type.toString().match(fnTypeRE);
  1480. return typeof type === "function" ? match && match[1] || "any" : "any";
  1481. }
  1482. /**
  1483. * Sanitize data to be posted to the other side.
  1484. * Since the message posted is sent with structured clone,
  1485. * we need to filter out any types that might cause an error.
  1486. */
  1487. function sanitize(data) {
  1488. if (!isPrimitive$1(data) && !Array.isArray(data) && !isPlainObject(data)) return Object.prototype.toString.call(data);
  1489. else return data;
  1490. }
  1491. function getSetupStateType(raw) {
  1492. try {
  1493. return {
  1494. ref: isRef(raw),
  1495. computed: isComputed(raw),
  1496. reactive: isReactive(raw),
  1497. readonly: isReadOnly(raw)
  1498. };
  1499. } catch {
  1500. return {
  1501. ref: false,
  1502. computed: false,
  1503. reactive: false,
  1504. readonly: false
  1505. };
  1506. }
  1507. }
  1508. function toRaw(value) {
  1509. if (value?.__v_raw) return value.__v_raw;
  1510. return value;
  1511. }
  1512. function escape(s) {
  1513. return s.replace(/[<>"&]/g, (s$1) => {
  1514. return ESC[s$1] || s$1;
  1515. });
  1516. }
  1517. //#endregion
  1518. //#region src/core/component/state/process.ts
  1519. function mergeOptions(to, from, instance) {
  1520. if (typeof from === "function") from = from.options;
  1521. if (!from) return to;
  1522. const { mixins, extends: extendsOptions } = from;
  1523. extendsOptions && mergeOptions(to, extendsOptions, instance);
  1524. mixins && mixins.forEach((m) => mergeOptions(to, m, instance));
  1525. for (const key of ["computed", "inject"]) if (Object.prototype.hasOwnProperty.call(from, key)) if (!to[key]) to[key] = from[key];
  1526. else Object.assign(to[key], from[key]);
  1527. return to;
  1528. }
  1529. function resolveMergedOptions(instance) {
  1530. const raw = instance?.type;
  1531. if (!raw) return {};
  1532. const { mixins, extends: extendsOptions } = raw;
  1533. const globalMixins = instance.appContext.mixins;
  1534. if (!globalMixins.length && !mixins && !extendsOptions) return raw;
  1535. const options = {};
  1536. globalMixins.forEach((m) => mergeOptions(options, m, instance));
  1537. mergeOptions(options, raw, instance);
  1538. return options;
  1539. }
  1540. /**
  1541. * Process the props of an instance.
  1542. * Make sure return a plain object because window.postMessage()
  1543. * will throw an Error if the passed object contains Functions.
  1544. *
  1545. */
  1546. function processProps(instance) {
  1547. const props = [];
  1548. const propDefinitions = instance?.type?.props;
  1549. for (const key in instance?.props) {
  1550. const propDefinition = propDefinitions ? propDefinitions[key] : null;
  1551. const camelizeKey = camelize(key);
  1552. props.push({
  1553. type: "props",
  1554. key: camelizeKey,
  1555. value: returnError(() => instance.props[key]),
  1556. editable: true,
  1557. meta: propDefinition ? {
  1558. type: propDefinition.type ? getPropType(propDefinition.type) : "any",
  1559. required: !!propDefinition.required,
  1560. ...propDefinition.default ? { default: propDefinition.default.toString() } : {}
  1561. } : { type: "invalid" }
  1562. });
  1563. }
  1564. return props;
  1565. }
  1566. /**
  1567. * Process state, filtering out props and "clean" the result
  1568. * with a JSON dance. This removes functions which can cause
  1569. * errors during structured clone used by window.postMessage.
  1570. *
  1571. */
  1572. function processState(instance) {
  1573. const type = instance.type;
  1574. const props = type?.props;
  1575. const getters = type.vuex && type.vuex.getters;
  1576. const computedDefs = type.computed;
  1577. const data = {
  1578. ...instance.data,
  1579. ...instance.renderContext
  1580. };
  1581. return Object.keys(data).filter((key) => !(props && key in props) && !(getters && key in getters) && !(computedDefs && key in computedDefs)).map((key) => ({
  1582. key,
  1583. type: "data",
  1584. value: returnError(() => data[key]),
  1585. editable: true
  1586. }));
  1587. }
  1588. function getStateTypeAndName(info) {
  1589. const stateType = info.computed ? "computed" : info.ref ? "ref" : info.reactive ? "reactive" : null;
  1590. const stateTypeName = stateType ? `${stateType.charAt(0).toUpperCase()}${stateType.slice(1)}` : null;
  1591. return {
  1592. stateType,
  1593. stateTypeName
  1594. };
  1595. }
  1596. function processSetupState(instance) {
  1597. const raw = instance.devtoolsRawSetupState || {};
  1598. return Object.keys(instance.setupState).filter((key) => !vueBuiltins.has(key) && key.split(/(?=[A-Z])/)[0] !== "use").map((key) => {
  1599. const value = returnError(() => toRaw(instance.setupState[key]));
  1600. const accessError = value instanceof Error;
  1601. const rawData = raw[key];
  1602. let result;
  1603. let isOtherType = accessError || typeof value === "function" || ensurePropertyExists(value, "render") && typeof value.render === "function" || ensurePropertyExists(value, "__asyncLoader") && typeof value.__asyncLoader === "function" || typeof value === "object" && value && ("setup" in value || "props" in value) || /^v[A-Z]/.test(key);
  1604. if (rawData && !accessError) {
  1605. const info = getSetupStateType(rawData);
  1606. const { stateType, stateTypeName } = getStateTypeAndName(info);
  1607. const isState = info.ref || info.computed || info.reactive;
  1608. const raw$1 = ensurePropertyExists(rawData, "effect") ? rawData.effect?.raw?.toString() || rawData.effect?.fn?.toString() : null;
  1609. if (stateType) isOtherType = false;
  1610. result = {
  1611. ...stateType ? {
  1612. stateType,
  1613. stateTypeName
  1614. } : {},
  1615. ...raw$1 ? { raw: raw$1 } : {},
  1616. editable: isState && !info.readonly
  1617. };
  1618. }
  1619. return {
  1620. key,
  1621. value,
  1622. type: isOtherType ? "setup (other)" : "setup",
  1623. ...result
  1624. };
  1625. });
  1626. }
  1627. /**
  1628. * Process the computed properties of an instance.
  1629. */
  1630. function processComputed(instance, mergedType) {
  1631. const type = mergedType;
  1632. const computed = [];
  1633. const defs = type.computed || {};
  1634. for (const key in defs) {
  1635. const def = defs[key];
  1636. const type$1 = typeof def === "function" && def.vuex ? "vuex bindings" : "computed";
  1637. computed.push({
  1638. type: type$1,
  1639. key,
  1640. value: returnError(() => instance?.proxy?.[key]),
  1641. editable: typeof def.set === "function"
  1642. });
  1643. }
  1644. return computed;
  1645. }
  1646. function processAttrs(instance) {
  1647. return Object.keys(instance.attrs).map((key) => ({
  1648. type: "attrs",
  1649. key,
  1650. value: returnError(() => instance.attrs[key])
  1651. }));
  1652. }
  1653. function processProvide(instance) {
  1654. return Reflect.ownKeys(instance.provides).map((key) => ({
  1655. type: "provided",
  1656. key: key.toString(),
  1657. value: returnError(() => instance.provides[key])
  1658. }));
  1659. }
  1660. function processInject(instance, mergedType) {
  1661. if (!mergedType?.inject) return [];
  1662. let keys = [];
  1663. let defaultValue;
  1664. if (Array.isArray(mergedType.inject)) keys = mergedType.inject.map((key) => ({
  1665. key,
  1666. originalKey: key
  1667. }));
  1668. else keys = Reflect.ownKeys(mergedType.inject).map((key) => {
  1669. const value = mergedType.inject[key];
  1670. let originalKey;
  1671. if (typeof value === "string" || typeof value === "symbol") originalKey = value;
  1672. else {
  1673. originalKey = value.from;
  1674. defaultValue = value.default;
  1675. }
  1676. return {
  1677. key,
  1678. originalKey
  1679. };
  1680. });
  1681. return keys.map(({ key, originalKey }) => ({
  1682. type: "injected",
  1683. key: originalKey && key !== originalKey ? `${originalKey.toString()}${key.toString()}` : key.toString(),
  1684. value: returnError(() => instance.ctx.hasOwnProperty(key) ? instance.ctx[key] : instance.provides.hasOwnProperty(originalKey) ? instance.provides[originalKey] : defaultValue)
  1685. }));
  1686. }
  1687. function processRefs(instance) {
  1688. return Object.keys(instance.refs).map((key) => ({
  1689. type: "template refs",
  1690. key,
  1691. value: returnError(() => instance.refs[key])
  1692. }));
  1693. }
  1694. function processEventListeners(instance) {
  1695. const emitsDefinition = instance.type.emits;
  1696. const declaredEmits = Array.isArray(emitsDefinition) ? emitsDefinition : Object.keys(emitsDefinition ?? {});
  1697. const keys = Object.keys(instance?.vnode?.props ?? {});
  1698. const result = [];
  1699. for (const key of keys) {
  1700. const [prefix, ...eventNameParts] = key.split(/(?=[A-Z])/);
  1701. if (prefix === "on") {
  1702. const eventName = eventNameParts.join("-").toLowerCase();
  1703. const isDeclared = declaredEmits.includes(eventName);
  1704. result.push({
  1705. type: "event listeners",
  1706. key: eventName,
  1707. value: { _custom: {
  1708. displayText: isDeclared ? "✅ Declared" : "⚠️ Not declared",
  1709. key: isDeclared ? "✅ Declared" : "⚠️ Not declared",
  1710. value: isDeclared ? "✅ Declared" : "⚠️ Not declared",
  1711. 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
  1712. } }
  1713. });
  1714. }
  1715. }
  1716. return result;
  1717. }
  1718. function processInstanceState(instance) {
  1719. const mergedType = resolveMergedOptions(instance);
  1720. return processProps(instance).concat(processState(instance), processSetupState(instance), processComputed(instance, mergedType), processAttrs(instance), processProvide(instance), processInject(instance, mergedType), processRefs(instance), processEventListeners(instance));
  1721. }
  1722. //#endregion
  1723. //#region src/core/component/state/index.ts
  1724. function getInstanceState(params) {
  1725. const instance = getComponentInstance(activeAppRecord.value, params.instanceId);
  1726. const id = getUniqueComponentId(instance);
  1727. const name = getInstanceName(instance);
  1728. const file = instance?.type?.__file;
  1729. const state = processInstanceState(instance);
  1730. return {
  1731. id,
  1732. name,
  1733. file,
  1734. state,
  1735. instance
  1736. };
  1737. }
  1738. //#endregion
  1739. //#region src/core/component/tree/filter.ts
  1740. var ComponentFilter = class {
  1741. constructor(filter) {
  1742. this.filter = filter || "";
  1743. }
  1744. /**
  1745. * Check if an instance is qualified.
  1746. *
  1747. * @param {Vue|Vnode} instance
  1748. * @return {boolean}
  1749. */
  1750. isQualified(instance) {
  1751. const name = getInstanceName(instance);
  1752. return classify(name).toLowerCase().includes(this.filter) || kebabize(name).toLowerCase().includes(this.filter);
  1753. }
  1754. };
  1755. function createComponentFilter(filterText) {
  1756. return new ComponentFilter(filterText);
  1757. }
  1758. //#endregion
  1759. //#region src/core/component/tree/walker.ts
  1760. var ComponentWalker = class {
  1761. constructor(options) {
  1762. this.captureIds = /* @__PURE__ */ new Map();
  1763. const { filterText = "", maxDepth, recursively, api } = options;
  1764. this.componentFilter = createComponentFilter(filterText);
  1765. this.maxDepth = maxDepth;
  1766. this.recursively = recursively;
  1767. this.api = api;
  1768. }
  1769. getComponentTree(instance) {
  1770. this.captureIds = /* @__PURE__ */ new Map();
  1771. return this.findQualifiedChildren(instance, 0);
  1772. }
  1773. getComponentParents(instance) {
  1774. this.captureIds = /* @__PURE__ */ new Map();
  1775. const parents = [];
  1776. this.captureId(instance);
  1777. let parent = instance;
  1778. while (parent = parent.parent) {
  1779. this.captureId(parent);
  1780. parents.push(parent);
  1781. }
  1782. return parents;
  1783. }
  1784. captureId(instance) {
  1785. if (!instance) return null;
  1786. const id = instance.__VUE_DEVTOOLS_NEXT_UID__ != null ? instance.__VUE_DEVTOOLS_NEXT_UID__ : getUniqueComponentId(instance);
  1787. instance.__VUE_DEVTOOLS_NEXT_UID__ = id;
  1788. if (this.captureIds.has(id)) return null;
  1789. else this.captureIds.set(id, void 0);
  1790. this.mark(instance);
  1791. return id;
  1792. }
  1793. /**
  1794. * Capture the meta information of an instance. (recursive)
  1795. *
  1796. * @param {Vue} instance
  1797. * @return {object}
  1798. */
  1799. async capture(instance, depth) {
  1800. if (!instance) return null;
  1801. const id = this.captureId(instance);
  1802. const name = getInstanceName(instance);
  1803. const children = this.getInternalInstanceChildren(instance.subTree).filter((child) => !isBeingDestroyed(child));
  1804. const parents = this.getComponentParents(instance) || [];
  1805. const inactive = !!instance.isDeactivated || parents.some((parent) => parent.isDeactivated);
  1806. const treeNode = {
  1807. uid: instance.uid,
  1808. id,
  1809. name,
  1810. renderKey: getRenderKey(instance.vnode ? instance.vnode.key : null),
  1811. inactive,
  1812. children: [],
  1813. isFragment: isFragment(instance),
  1814. tags: typeof instance.type !== "function" ? [] : [{
  1815. label: "functional",
  1816. textColor: 5592405,
  1817. backgroundColor: 15658734
  1818. }],
  1819. autoOpen: this.recursively,
  1820. file: instance.type.__file || ""
  1821. };
  1822. if (depth < this.maxDepth || instance.type.__isKeepAlive || parents.some((parent) => parent.type.__isKeepAlive)) treeNode.children = await Promise.all(children.map((child) => this.capture(child, depth + 1)).filter(Boolean));
  1823. if (this.isKeepAlive(instance)) {
  1824. const cachedComponents = this.getKeepAliveCachedInstances(instance);
  1825. const childrenIds = children.map((child) => child.__VUE_DEVTOOLS_NEXT_UID__);
  1826. for (const cachedChild of cachedComponents) if (!childrenIds.includes(cachedChild.__VUE_DEVTOOLS_NEXT_UID__)) {
  1827. const node = await this.capture({
  1828. ...cachedChild,
  1829. isDeactivated: true
  1830. }, depth + 1);
  1831. if (node) treeNode.children.push(node);
  1832. }
  1833. }
  1834. const firstElement = getRootElementsFromComponentInstance(instance)[0];
  1835. if (firstElement?.parentElement) {
  1836. const parentInstance = instance.parent;
  1837. const parentRootElements = parentInstance ? getRootElementsFromComponentInstance(parentInstance) : [];
  1838. let el = firstElement;
  1839. const indexList = [];
  1840. do {
  1841. indexList.push(Array.from(el.parentElement.childNodes).indexOf(el));
  1842. el = el.parentElement;
  1843. } while (el.parentElement && parentRootElements.length && !parentRootElements.includes(el));
  1844. treeNode.domOrder = indexList.reverse();
  1845. } else treeNode.domOrder = [-1];
  1846. if (instance.suspense?.suspenseKey) {
  1847. treeNode.tags.push({
  1848. label: instance.suspense.suspenseKey,
  1849. backgroundColor: 14979812,
  1850. textColor: 16777215
  1851. });
  1852. this.mark(instance, true);
  1853. }
  1854. this.api.visitComponentTree({
  1855. treeNode,
  1856. componentInstance: instance,
  1857. app: instance.appContext.app,
  1858. filter: this.componentFilter.filter
  1859. });
  1860. return treeNode;
  1861. }
  1862. /**
  1863. * Find qualified children from a single instance.
  1864. * If the instance itself is qualified, just return itself.
  1865. * This is ok because [].concat works in both cases.
  1866. *
  1867. * @param {Vue|Vnode} instance
  1868. * @return {Vue|Array}
  1869. */
  1870. async findQualifiedChildren(instance, depth) {
  1871. if (this.componentFilter.isQualified(instance) && !instance.type.devtools?.hide) return [await this.capture(instance, depth)];
  1872. else if (instance.subTree) {
  1873. const list = this.isKeepAlive(instance) ? this.getKeepAliveCachedInstances(instance) : this.getInternalInstanceChildren(instance.subTree);
  1874. return this.findQualifiedChildrenFromList(list, depth);
  1875. } else return [];
  1876. }
  1877. /**
  1878. * Iterate through an array of instances and flatten it into
  1879. * an array of qualified instances. This is a depth-first
  1880. * traversal - e.g. if an instance is not matched, we will
  1881. * recursively go deeper until a qualified child is found.
  1882. *
  1883. * @param {Array} instances
  1884. * @return {Array}
  1885. */
  1886. async findQualifiedChildrenFromList(instances, depth) {
  1887. instances = instances.filter((child) => !isBeingDestroyed(child) && !child.type.devtools?.hide);
  1888. if (!this.componentFilter.filter) return Promise.all(instances.map((child) => this.capture(child, depth)));
  1889. else return Array.prototype.concat.apply([], await Promise.all(instances.map((i) => this.findQualifiedChildren(i, depth))));
  1890. }
  1891. /**
  1892. * Get children from a component instance.
  1893. */
  1894. getInternalInstanceChildren(subTree, suspense = null) {
  1895. const list = [];
  1896. if (subTree) {
  1897. if (subTree.component) !suspense ? list.push(subTree.component) : list.push({
  1898. ...subTree.component,
  1899. suspense
  1900. });
  1901. else if (subTree.suspense) {
  1902. const suspenseKey = !subTree.suspense.isInFallback ? "suspense default" : "suspense fallback";
  1903. list.push(...this.getInternalInstanceChildren(subTree.suspense.activeBranch, {
  1904. ...subTree.suspense,
  1905. suspenseKey
  1906. }));
  1907. } else if (Array.isArray(subTree.children)) subTree.children.forEach((childSubTree) => {
  1908. if (childSubTree.component) !suspense ? list.push(childSubTree.component) : list.push({
  1909. ...childSubTree.component,
  1910. suspense
  1911. });
  1912. else list.push(...this.getInternalInstanceChildren(childSubTree, suspense));
  1913. });
  1914. }
  1915. return list.filter((child) => !isBeingDestroyed(child) && !child.type.devtools?.hide);
  1916. }
  1917. /**
  1918. * Mark an instance as captured and store it in the instance map.
  1919. *
  1920. * @param {Vue} instance
  1921. */
  1922. mark(instance, force = false) {
  1923. const instanceMap = getAppRecord(instance).instanceMap;
  1924. if (force || !instanceMap.has(instance.__VUE_DEVTOOLS_NEXT_UID__)) {
  1925. instanceMap.set(instance.__VUE_DEVTOOLS_NEXT_UID__, instance);
  1926. activeAppRecord.value.instanceMap = instanceMap;
  1927. }
  1928. }
  1929. isKeepAlive(instance) {
  1930. return instance.type.__isKeepAlive && instance.__v_cache;
  1931. }
  1932. getKeepAliveCachedInstances(instance) {
  1933. return Array.from(instance.__v_cache.values()).map((vnode) => vnode.component).filter(Boolean);
  1934. }
  1935. };
  1936. //#endregion
  1937. //#region src/core/timeline/perf.ts
  1938. const markEndQueue = /* @__PURE__ */ new Map();
  1939. const PERFORMANCE_EVENT_LAYER_ID = "performance";
  1940. async function performanceMarkStart(api, app, uid, vm, type, time) {
  1941. const appRecord = await getAppRecord(app);
  1942. if (!appRecord) return;
  1943. const componentName = getInstanceName(vm) || "Unknown Component";
  1944. const groupId = devtoolsState.perfUniqueGroupId++;
  1945. const groupKey = `${uid}-${type}`;
  1946. appRecord.perfGroupIds.set(groupKey, {
  1947. groupId,
  1948. time
  1949. });
  1950. await api.addTimelineEvent({
  1951. layerId: PERFORMANCE_EVENT_LAYER_ID,
  1952. event: {
  1953. time: Date.now(),
  1954. data: {
  1955. component: componentName,
  1956. type,
  1957. measure: "start"
  1958. },
  1959. title: componentName,
  1960. subtitle: type,
  1961. groupId
  1962. }
  1963. });
  1964. if (markEndQueue.has(groupKey)) {
  1965. const { app: app$1, uid: uid$1, instance, type: type$1, time: time$1 } = markEndQueue.get(groupKey);
  1966. markEndQueue.delete(groupKey);
  1967. await performanceMarkEnd(api, app$1, uid$1, instance, type$1, time$1);
  1968. }
  1969. }
  1970. function performanceMarkEnd(api, app, uid, vm, type, time) {
  1971. const appRecord = getAppRecord(app);
  1972. if (!appRecord) return;
  1973. const componentName = getInstanceName(vm) || "Unknown Component";
  1974. const groupKey = `${uid}-${type}`;
  1975. const groupInfo = appRecord.perfGroupIds.get(groupKey);
  1976. if (groupInfo) {
  1977. const groupId = groupInfo.groupId;
  1978. const startTime = groupInfo.time;
  1979. const duration = time - startTime;
  1980. api.addTimelineEvent({
  1981. layerId: PERFORMANCE_EVENT_LAYER_ID,
  1982. event: {
  1983. time: Date.now(),
  1984. data: {
  1985. component: componentName,
  1986. type,
  1987. measure: "end",
  1988. duration: { _custom: {
  1989. type: "Duration",
  1990. value: duration,
  1991. display: `${duration} ms`
  1992. } }
  1993. },
  1994. title: componentName,
  1995. subtitle: type,
  1996. groupId
  1997. }
  1998. });
  1999. } else markEndQueue.set(groupKey, {
  2000. app,
  2001. uid,
  2002. instance: vm,
  2003. type,
  2004. time
  2005. });
  2006. }
  2007. //#endregion
  2008. //#region src/core/timeline/index.ts
  2009. const COMPONENT_EVENT_LAYER_ID = "component-event";
  2010. function setupBuiltinTimelineLayers(api) {
  2011. if (!isBrowser) return;
  2012. api.addTimelineLayer({
  2013. id: "mouse",
  2014. label: "Mouse",
  2015. color: 10768815
  2016. });
  2017. [
  2018. "mousedown",
  2019. "mouseup",
  2020. "click",
  2021. "dblclick"
  2022. ].forEach((eventType) => {
  2023. if (!devtoolsState.timelineLayersState.recordingState || !devtoolsState.timelineLayersState.mouseEventEnabled) return;
  2024. window.addEventListener(eventType, async (event) => {
  2025. await api.addTimelineEvent({
  2026. layerId: "mouse",
  2027. event: {
  2028. time: Date.now(),
  2029. data: {
  2030. type: eventType,
  2031. x: event.clientX,
  2032. y: event.clientY
  2033. },
  2034. title: eventType
  2035. }
  2036. });
  2037. }, {
  2038. capture: true,
  2039. passive: true
  2040. });
  2041. });
  2042. api.addTimelineLayer({
  2043. id: "keyboard",
  2044. label: "Keyboard",
  2045. color: 8475055
  2046. });
  2047. [
  2048. "keyup",
  2049. "keydown",
  2050. "keypress"
  2051. ].forEach((eventType) => {
  2052. window.addEventListener(eventType, async (event) => {
  2053. if (!devtoolsState.timelineLayersState.recordingState || !devtoolsState.timelineLayersState.keyboardEventEnabled) return;
  2054. await api.addTimelineEvent({
  2055. layerId: "keyboard",
  2056. event: {
  2057. time: Date.now(),
  2058. data: {
  2059. type: eventType,
  2060. key: event.key,
  2061. ctrlKey: event.ctrlKey,
  2062. shiftKey: event.shiftKey,
  2063. altKey: event.altKey,
  2064. metaKey: event.metaKey
  2065. },
  2066. title: event.key
  2067. }
  2068. });
  2069. }, {
  2070. capture: true,
  2071. passive: true
  2072. });
  2073. });
  2074. api.addTimelineLayer({
  2075. id: COMPONENT_EVENT_LAYER_ID,
  2076. label: "Component events",
  2077. color: 5226637
  2078. });
  2079. hook.on.componentEmit(async (app, instance, event, params) => {
  2080. if (!devtoolsState.timelineLayersState.recordingState || !devtoolsState.timelineLayersState.componentEventEnabled) return;
  2081. const appRecord = await getAppRecord(app);
  2082. if (!appRecord) return;
  2083. const componentId = `${appRecord.id}:${instance.uid}`;
  2084. const componentName = getInstanceName(instance) || "Unknown Component";
  2085. api.addTimelineEvent({
  2086. layerId: COMPONENT_EVENT_LAYER_ID,
  2087. event: {
  2088. time: Date.now(),
  2089. data: {
  2090. component: { _custom: {
  2091. type: "component-definition",
  2092. display: componentName
  2093. } },
  2094. event,
  2095. params
  2096. },
  2097. title: event,
  2098. subtitle: `by ${componentName}`,
  2099. meta: { componentId }
  2100. }
  2101. });
  2102. });
  2103. api.addTimelineLayer({
  2104. id: "performance",
  2105. label: PERFORMANCE_EVENT_LAYER_ID,
  2106. color: 4307050
  2107. });
  2108. hook.on.perfStart((app, uid, vm, type, time) => {
  2109. if (!devtoolsState.timelineLayersState.recordingState || !devtoolsState.timelineLayersState.performanceEventEnabled) return;
  2110. performanceMarkStart(api, app, uid, vm, type, time);
  2111. });
  2112. hook.on.perfEnd((app, uid, vm, type, time) => {
  2113. if (!devtoolsState.timelineLayersState.recordingState || !devtoolsState.timelineLayersState.performanceEventEnabled) return;
  2114. performanceMarkEnd(api, app, uid, vm, type, time);
  2115. });
  2116. }
  2117. //#endregion
  2118. //#region src/core/vm/index.ts
  2119. const MAX_$VM = 10;
  2120. const $vmQueue = [];
  2121. function exposeInstanceToWindow(componentInstance) {
  2122. if (typeof window === "undefined") return;
  2123. const win = window;
  2124. if (!componentInstance) return;
  2125. win.$vm = componentInstance;
  2126. if ($vmQueue[0] !== componentInstance) {
  2127. if ($vmQueue.length >= MAX_$VM) $vmQueue.pop();
  2128. for (let i = $vmQueue.length; i > 0; i--) win[`$vm${i}`] = $vmQueue[i] = $vmQueue[i - 1];
  2129. win.$vm0 = $vmQueue[0] = componentInstance;
  2130. }
  2131. }
  2132. //#endregion
  2133. //#region src/core/plugin/components.ts
  2134. const INSPECTOR_ID = "components";
  2135. function createComponentsDevToolsPlugin(app) {
  2136. const descriptor = {
  2137. id: INSPECTOR_ID,
  2138. label: "Components",
  2139. app
  2140. };
  2141. const setupFn = (api) => {
  2142. api.addInspector({
  2143. id: INSPECTOR_ID,
  2144. label: "Components",
  2145. treeFilterPlaceholder: "Search components"
  2146. });
  2147. setupBuiltinTimelineLayers(api);
  2148. api.on.getInspectorTree(async (payload) => {
  2149. if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
  2150. const instance = getComponentInstance(activeAppRecord.value, payload.instanceId);
  2151. if (instance) payload.rootNodes = await new ComponentWalker({
  2152. filterText: payload.filter,
  2153. maxDepth: 100,
  2154. recursively: false,
  2155. api
  2156. }).getComponentTree(instance);
  2157. }
  2158. });
  2159. api.on.getInspectorState(async (payload) => {
  2160. if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
  2161. const result = getInstanceState({ instanceId: payload.nodeId });
  2162. const componentInstance = result.instance;
  2163. const app$1 = result.instance?.appContext.app;
  2164. const _payload = {
  2165. componentInstance,
  2166. app: app$1,
  2167. instanceData: result
  2168. };
  2169. devtoolsContext.hooks.callHookWith((callbacks) => {
  2170. callbacks.forEach((cb) => cb(_payload));
  2171. }, DevToolsV6PluginAPIHookKeys.INSPECT_COMPONENT);
  2172. payload.state = result;
  2173. exposeInstanceToWindow(componentInstance);
  2174. }
  2175. });
  2176. api.on.editInspectorState(async (payload) => {
  2177. if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
  2178. editState(payload);
  2179. await api.sendInspectorState("components");
  2180. }
  2181. });
  2182. const debounceSendInspectorTree = debounce(() => {
  2183. api.sendInspectorTree(INSPECTOR_ID);
  2184. }, 120);
  2185. const debounceSendInspectorState = debounce(() => {
  2186. api.sendInspectorState(INSPECTOR_ID);
  2187. }, 120);
  2188. hook.on.componentAdded(async (app$1, uid, parentUid, component) => {
  2189. if (devtoolsState.highPerfModeEnabled) return;
  2190. if (app$1?._instance?.type?.devtools?.hide) return;
  2191. if (!app$1 || typeof uid !== "number" && !uid || !component) return;
  2192. const id = await getComponentId({
  2193. app: app$1,
  2194. uid,
  2195. instance: component
  2196. });
  2197. const appRecord = await getAppRecord(app$1);
  2198. if (component) {
  2199. if (component.__VUE_DEVTOOLS_NEXT_UID__ == null) component.__VUE_DEVTOOLS_NEXT_UID__ = id;
  2200. if (!appRecord?.instanceMap.has(id)) {
  2201. appRecord?.instanceMap.set(id, component);
  2202. if (activeAppRecord.value.id === appRecord?.id) activeAppRecord.value.instanceMap = appRecord.instanceMap;
  2203. }
  2204. }
  2205. if (!appRecord) return;
  2206. debounceSendInspectorTree();
  2207. });
  2208. hook.on.componentUpdated(async (app$1, uid, parentUid, component) => {
  2209. if (devtoolsState.highPerfModeEnabled) return;
  2210. if (app$1?._instance?.type?.devtools?.hide) return;
  2211. if (!app$1 || typeof uid !== "number" && !uid || !component) return;
  2212. const id = await getComponentId({
  2213. app: app$1,
  2214. uid,
  2215. instance: component
  2216. });
  2217. const appRecord = await getAppRecord(app$1);
  2218. if (component) {
  2219. if (component.__VUE_DEVTOOLS_NEXT_UID__ == null) component.__VUE_DEVTOOLS_NEXT_UID__ = id;
  2220. if (!appRecord?.instanceMap.has(id)) {
  2221. appRecord?.instanceMap.set(id, component);
  2222. if (activeAppRecord.value.id === appRecord?.id) activeAppRecord.value.instanceMap = appRecord.instanceMap;
  2223. }
  2224. }
  2225. if (!appRecord) return;
  2226. debounceSendInspectorTree();
  2227. debounceSendInspectorState();
  2228. });
  2229. hook.on.componentRemoved(async (app$1, uid, parentUid, component) => {
  2230. if (devtoolsState.highPerfModeEnabled) return;
  2231. if (app$1?._instance?.type?.devtools?.hide) return;
  2232. if (!app$1 || typeof uid !== "number" && !uid || !component) return;
  2233. const appRecord = await getAppRecord(app$1);
  2234. if (!appRecord) return;
  2235. const id = await getComponentId({
  2236. app: app$1,
  2237. uid,
  2238. instance: component
  2239. });
  2240. appRecord?.instanceMap.delete(id);
  2241. if (activeAppRecord.value.id === appRecord?.id) activeAppRecord.value.instanceMap = appRecord.instanceMap;
  2242. debounceSendInspectorTree();
  2243. });
  2244. };
  2245. return [descriptor, setupFn];
  2246. }
  2247. //#endregion
  2248. //#region src/core/plugin/index.ts
  2249. target.__VUE_DEVTOOLS_KIT__REGISTERED_PLUGIN_APPS__ ??= /* @__PURE__ */ new Set();
  2250. function setupDevToolsPlugin(pluginDescriptor, setupFn) {
  2251. return hook.setupDevToolsPlugin(pluginDescriptor, setupFn);
  2252. }
  2253. function callDevToolsPluginSetupFn(plugin, app) {
  2254. const [pluginDescriptor, setupFn] = plugin;
  2255. if (pluginDescriptor.app !== app) return;
  2256. const api = new DevToolsPluginAPI({
  2257. plugin: {
  2258. setupFn,
  2259. descriptor: pluginDescriptor
  2260. },
  2261. ctx: devtoolsContext
  2262. });
  2263. if (pluginDescriptor.packageName === "vuex") api.on.editInspectorState((payload) => {
  2264. api.sendInspectorState(payload.inspectorId);
  2265. });
  2266. setupFn(api);
  2267. }
  2268. function removeRegisteredPluginApp(app) {
  2269. target.__VUE_DEVTOOLS_KIT__REGISTERED_PLUGIN_APPS__.delete(app);
  2270. }
  2271. function registerDevToolsPlugin(app, options) {
  2272. if (target.__VUE_DEVTOOLS_KIT__REGISTERED_PLUGIN_APPS__.has(app)) return;
  2273. if (devtoolsState.highPerfModeEnabled && !options?.inspectingComponent) return;
  2274. target.__VUE_DEVTOOLS_KIT__REGISTERED_PLUGIN_APPS__.add(app);
  2275. devtoolsPluginBuffer.forEach((plugin) => {
  2276. callDevToolsPluginSetupFn(plugin, app);
  2277. });
  2278. }
  2279. //#endregion
  2280. //#region src/ctx/router.ts
  2281. const ROUTER_KEY = "__VUE_DEVTOOLS_ROUTER__";
  2282. const ROUTER_INFO_KEY = "__VUE_DEVTOOLS_ROUTER_INFO__";
  2283. target[ROUTER_INFO_KEY] ??= {
  2284. currentRoute: null,
  2285. routes: []
  2286. };
  2287. target[ROUTER_KEY] ??= {};
  2288. const devtoolsRouterInfo = new Proxy(target[ROUTER_INFO_KEY], { get(target$1, property) {
  2289. return target[ROUTER_INFO_KEY][property];
  2290. } });
  2291. const devtoolsRouter = new Proxy(target[ROUTER_KEY], { get(target$1, property) {
  2292. if (property === "value") return target[ROUTER_KEY];
  2293. } });
  2294. //#endregion
  2295. //#region src/core/router/index.ts
  2296. function getRoutes(router) {
  2297. const routesMap = /* @__PURE__ */ new Map();
  2298. return (router?.getRoutes() || []).filter((i) => !routesMap.has(i.path) && routesMap.set(i.path, 1));
  2299. }
  2300. function filterRoutes(routes) {
  2301. return routes.map((item) => {
  2302. let { path, name, children, meta } = item;
  2303. if (children?.length) children = filterRoutes(children);
  2304. return {
  2305. path,
  2306. name,
  2307. children,
  2308. meta
  2309. };
  2310. });
  2311. }
  2312. function filterCurrentRoute(route) {
  2313. if (route) {
  2314. const { fullPath, hash, href, path, name, matched, params, query } = route;
  2315. return {
  2316. fullPath,
  2317. hash,
  2318. href,
  2319. path,
  2320. name,
  2321. params,
  2322. query,
  2323. matched: filterRoutes(matched)
  2324. };
  2325. }
  2326. return route;
  2327. }
  2328. function normalizeRouterInfo(appRecord, activeAppRecord$1) {
  2329. function init() {
  2330. const router = appRecord.app?.config.globalProperties.$router;
  2331. const currentRoute = filterCurrentRoute(router?.currentRoute.value);
  2332. const routes = filterRoutes(getRoutes(router));
  2333. const c = console.warn;
  2334. console.warn = () => {};
  2335. target[ROUTER_INFO_KEY] = {
  2336. currentRoute: currentRoute ? deepClone(currentRoute) : {},
  2337. routes: deepClone(routes)
  2338. };
  2339. target[ROUTER_KEY] = router;
  2340. console.warn = c;
  2341. }
  2342. init();
  2343. hook.on.componentUpdated(debounce(() => {
  2344. if (activeAppRecord$1.value?.app !== appRecord.app) return;
  2345. init();
  2346. if (devtoolsState.highPerfModeEnabled) return;
  2347. devtoolsContext.hooks.callHook(DevToolsMessagingHookKeys.ROUTER_INFO_UPDATED, { state: target[ROUTER_INFO_KEY] });
  2348. }, 200));
  2349. }
  2350. //#endregion
  2351. //#region src/ctx/api.ts
  2352. function createDevToolsApi(hooks$1) {
  2353. return {
  2354. async getInspectorTree(payload) {
  2355. const _payload = {
  2356. ...payload,
  2357. app: activeAppRecord.value.app,
  2358. rootNodes: []
  2359. };
  2360. await new Promise((resolve) => {
  2361. hooks$1.callHookWith(async (callbacks) => {
  2362. await Promise.all(callbacks.map((cb) => cb(_payload)));
  2363. resolve();
  2364. }, DevToolsV6PluginAPIHookKeys.GET_INSPECTOR_TREE);
  2365. });
  2366. return _payload.rootNodes;
  2367. },
  2368. async getInspectorState(payload) {
  2369. const _payload = {
  2370. ...payload,
  2371. app: activeAppRecord.value.app,
  2372. state: null
  2373. };
  2374. const ctx = { currentTab: `custom-inspector:${payload.inspectorId}` };
  2375. await new Promise((resolve) => {
  2376. hooks$1.callHookWith(async (callbacks) => {
  2377. await Promise.all(callbacks.map((cb) => cb(_payload, ctx)));
  2378. resolve();
  2379. }, DevToolsV6PluginAPIHookKeys.GET_INSPECTOR_STATE);
  2380. });
  2381. return _payload.state;
  2382. },
  2383. editInspectorState(payload) {
  2384. const stateEditor$1 = new StateEditor();
  2385. const _payload = {
  2386. ...payload,
  2387. app: activeAppRecord.value.app,
  2388. set: (obj, path = payload.path, value = payload.state.value, cb) => {
  2389. stateEditor$1.set(obj, path, value, cb || stateEditor$1.createDefaultSetCallback(payload.state));
  2390. }
  2391. };
  2392. hooks$1.callHookWith((callbacks) => {
  2393. callbacks.forEach((cb) => cb(_payload));
  2394. }, DevToolsV6PluginAPIHookKeys.EDIT_INSPECTOR_STATE);
  2395. },
  2396. sendInspectorState(inspectorId) {
  2397. const inspector = getInspector(inspectorId);
  2398. hooks$1.callHook(DevToolsContextHookKeys.SEND_INSPECTOR_STATE, {
  2399. inspectorId,
  2400. plugin: {
  2401. descriptor: inspector.descriptor,
  2402. setupFn: () => ({})
  2403. }
  2404. });
  2405. },
  2406. inspectComponentInspector() {
  2407. return inspectComponentHighLighter();
  2408. },
  2409. cancelInspectComponentInspector() {
  2410. return cancelInspectComponentHighLighter();
  2411. },
  2412. getComponentRenderCode(id) {
  2413. const instance = getComponentInstance(activeAppRecord.value, id);
  2414. if (instance) return !(typeof instance?.type === "function") ? instance.render.toString() : instance.type.toString();
  2415. },
  2416. scrollToComponent(id) {
  2417. return scrollToComponent({ id });
  2418. },
  2419. openInEditor,
  2420. getVueInspector: getComponentInspector,
  2421. toggleApp(id, options) {
  2422. const appRecord = devtoolsAppRecords.value.find((record) => record.id === id);
  2423. if (appRecord) {
  2424. setActiveAppRecordId(id);
  2425. setActiveAppRecord(appRecord);
  2426. normalizeRouterInfo(appRecord, activeAppRecord);
  2427. callInspectorUpdatedHook();
  2428. registerDevToolsPlugin(appRecord.app, options);
  2429. }
  2430. },
  2431. inspectDOM(instanceId) {
  2432. const instance = getComponentInstance(activeAppRecord.value, instanceId);
  2433. if (instance) {
  2434. const [el] = getRootElementsFromComponentInstance(instance);
  2435. if (el) target.__VUE_DEVTOOLS_INSPECT_DOM_TARGET__ = el;
  2436. }
  2437. },
  2438. updatePluginSettings(pluginId, key, value) {
  2439. setPluginSettings(pluginId, key, value);
  2440. },
  2441. getPluginSettings(pluginId) {
  2442. return {
  2443. options: getPluginSettingsOptions(pluginId),
  2444. values: getPluginSettings(pluginId)
  2445. };
  2446. }
  2447. };
  2448. }
  2449. //#endregion
  2450. //#region src/ctx/env.ts
  2451. target.__VUE_DEVTOOLS_ENV__ ??= { vitePluginDetected: false };
  2452. function getDevToolsEnv() {
  2453. return target.__VUE_DEVTOOLS_ENV__;
  2454. }
  2455. function setDevToolsEnv(env) {
  2456. target.__VUE_DEVTOOLS_ENV__ = {
  2457. ...target.__VUE_DEVTOOLS_ENV__,
  2458. ...env
  2459. };
  2460. }
  2461. //#endregion
  2462. //#region src/ctx/index.ts
  2463. const hooks = createDevToolsCtxHooks();
  2464. target.__VUE_DEVTOOLS_KIT_CONTEXT__ ??= {
  2465. hooks,
  2466. get state() {
  2467. return {
  2468. ...devtoolsState,
  2469. activeAppRecordId: activeAppRecord.id,
  2470. activeAppRecord: activeAppRecord.value,
  2471. appRecords: devtoolsAppRecords.value
  2472. };
  2473. },
  2474. api: createDevToolsApi(hooks)
  2475. };
  2476. const devtoolsContext = target.__VUE_DEVTOOLS_KIT_CONTEXT__;
  2477. //#endregion
  2478. //#region ../../node_modules/.pnpm/speakingurl@14.0.1/node_modules/speakingurl/lib/speakingurl.js
  2479. var require_speakingurl$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/speakingurl@14.0.1/node_modules/speakingurl/lib/speakingurl.js": ((exports, module) => {
  2480. (function(root) {
  2481. /**
  2482. * charMap
  2483. * @type {Object}
  2484. */
  2485. var charMap = {
  2486. "À": "A",
  2487. "Á": "A",
  2488. "Â": "A",
  2489. "Ã": "A",
  2490. "Ä": "Ae",
  2491. "Å": "A",
  2492. "Æ": "AE",
  2493. "Ç": "C",
  2494. "È": "E",
  2495. "É": "E",
  2496. "Ê": "E",
  2497. "Ë": "E",
  2498. "Ì": "I",
  2499. "Í": "I",
  2500. "Î": "I",
  2501. "Ï": "I",
  2502. "Ð": "D",
  2503. "Ñ": "N",
  2504. "Ò": "O",
  2505. "Ó": "O",
  2506. "Ô": "O",
  2507. "Õ": "O",
  2508. "Ö": "Oe",
  2509. "Ő": "O",
  2510. "Ø": "O",
  2511. "Ù": "U",
  2512. "Ú": "U",
  2513. "Û": "U",
  2514. "Ü": "Ue",
  2515. "Ű": "U",
  2516. "Ý": "Y",
  2517. "Þ": "TH",
  2518. "ß": "ss",
  2519. "à": "a",
  2520. "á": "a",
  2521. "â": "a",
  2522. "ã": "a",
  2523. "ä": "ae",
  2524. "å": "a",
  2525. "æ": "ae",
  2526. "ç": "c",
  2527. "è": "e",
  2528. "é": "e",
  2529. "ê": "e",
  2530. "ë": "e",
  2531. "ì": "i",
  2532. "í": "i",
  2533. "î": "i",
  2534. "ï": "i",
  2535. "ð": "d",
  2536. "ñ": "n",
  2537. "ò": "o",
  2538. "ó": "o",
  2539. "ô": "o",
  2540. "õ": "o",
  2541. "ö": "oe",
  2542. "ő": "o",
  2543. "ø": "o",
  2544. "ù": "u",
  2545. "ú": "u",
  2546. "û": "u",
  2547. "ü": "ue",
  2548. "ű": "u",
  2549. "ý": "y",
  2550. "þ": "th",
  2551. "ÿ": "y",
  2552. "ẞ": "SS",
  2553. "ا": "a",
  2554. "أ": "a",
  2555. "إ": "i",
  2556. "آ": "aa",
  2557. "ؤ": "u",
  2558. "ئ": "e",
  2559. "ء": "a",
  2560. "ب": "b",
  2561. "ت": "t",
  2562. "ث": "th",
  2563. "ج": "j",
  2564. "ح": "h",
  2565. "خ": "kh",
  2566. "د": "d",
  2567. "ذ": "th",
  2568. "ر": "r",
  2569. "ز": "z",
  2570. "س": "s",
  2571. "ش": "sh",
  2572. "ص": "s",
  2573. "ض": "dh",
  2574. "ط": "t",
  2575. "ظ": "z",
  2576. "ع": "a",
  2577. "غ": "gh",
  2578. "ف": "f",
  2579. "ق": "q",
  2580. "ك": "k",
  2581. "ل": "l",
  2582. "م": "m",
  2583. "ن": "n",
  2584. "ه": "h",
  2585. "و": "w",
  2586. "ي": "y",
  2587. "ى": "a",
  2588. "ة": "h",
  2589. "ﻻ": "la",
  2590. "ﻷ": "laa",
  2591. "ﻹ": "lai",
  2592. "ﻵ": "laa",
  2593. "گ": "g",
  2594. "چ": "ch",
  2595. "پ": "p",
  2596. "ژ": "zh",
  2597. "ک": "k",
  2598. "ی": "y",
  2599. "َ": "a",
  2600. "ً": "an",
  2601. "ِ": "e",
  2602. "ٍ": "en",
  2603. "ُ": "u",
  2604. "ٌ": "on",
  2605. "ْ": "",
  2606. "٠": "0",
  2607. "١": "1",
  2608. "٢": "2",
  2609. "٣": "3",
  2610. "٤": "4",
  2611. "٥": "5",
  2612. "٦": "6",
  2613. "٧": "7",
  2614. "٨": "8",
  2615. "٩": "9",
  2616. "۰": "0",
  2617. "۱": "1",
  2618. "۲": "2",
  2619. "۳": "3",
  2620. "۴": "4",
  2621. "۵": "5",
  2622. "۶": "6",
  2623. "۷": "7",
  2624. "۸": "8",
  2625. "۹": "9",
  2626. "က": "k",
  2627. "ခ": "kh",
  2628. "ဂ": "g",
  2629. "ဃ": "ga",
  2630. "င": "ng",
  2631. "စ": "s",
  2632. "ဆ": "sa",
  2633. "ဇ": "z",
  2634. "စျ": "za",
  2635. "ည": "ny",
  2636. "ဋ": "t",
  2637. "ဌ": "ta",
  2638. "ဍ": "d",
  2639. "ဎ": "da",
  2640. "ဏ": "na",
  2641. "တ": "t",
  2642. "ထ": "ta",
  2643. "ဒ": "d",
  2644. "ဓ": "da",
  2645. "န": "n",
  2646. "ပ": "p",
  2647. "ဖ": "pa",
  2648. "ဗ": "b",
  2649. "ဘ": "ba",
  2650. "မ": "m",
  2651. "ယ": "y",
  2652. "ရ": "ya",
  2653. "လ": "l",
  2654. "ဝ": "w",
  2655. "သ": "th",
  2656. "ဟ": "h",
  2657. "ဠ": "la",
  2658. "အ": "a",
  2659. "ြ": "y",
  2660. "ျ": "ya",
  2661. "ွ": "w",
  2662. "ြွ": "yw",
  2663. "ျွ": "ywa",
  2664. "ှ": "h",
  2665. "ဧ": "e",
  2666. "၏": "-e",
  2667. "ဣ": "i",
  2668. "ဤ": "-i",
  2669. "ဉ": "u",
  2670. "ဦ": "-u",
  2671. "ဩ": "aw",
  2672. "သြော": "aw",
  2673. "ဪ": "aw",
  2674. "၀": "0",
  2675. "၁": "1",
  2676. "၂": "2",
  2677. "၃": "3",
  2678. "၄": "4",
  2679. "၅": "5",
  2680. "၆": "6",
  2681. "၇": "7",
  2682. "၈": "8",
  2683. "၉": "9",
  2684. "္": "",
  2685. "့": "",
  2686. "း": "",
  2687. "č": "c",
  2688. "ď": "d",
  2689. "ě": "e",
  2690. "ň": "n",
  2691. "ř": "r",
  2692. "š": "s",
  2693. "ť": "t",
  2694. "ů": "u",
  2695. "ž": "z",
  2696. "Č": "C",
  2697. "Ď": "D",
  2698. "Ě": "E",
  2699. "Ň": "N",
  2700. "Ř": "R",
  2701. "Š": "S",
  2702. "Ť": "T",
  2703. "Ů": "U",
  2704. "Ž": "Z",
  2705. "ހ": "h",
  2706. "ށ": "sh",
  2707. "ނ": "n",
  2708. "ރ": "r",
  2709. "ބ": "b",
  2710. "ޅ": "lh",
  2711. "ކ": "k",
  2712. "އ": "a",
  2713. "ވ": "v",
  2714. "މ": "m",
  2715. "ފ": "f",
  2716. "ދ": "dh",
  2717. "ތ": "th",
  2718. "ލ": "l",
  2719. "ގ": "g",
  2720. "ޏ": "gn",
  2721. "ސ": "s",
  2722. "ޑ": "d",
  2723. "ޒ": "z",
  2724. "ޓ": "t",
  2725. "ޔ": "y",
  2726. "ޕ": "p",
  2727. "ޖ": "j",
  2728. "ޗ": "ch",
  2729. "ޘ": "tt",
  2730. "ޙ": "hh",
  2731. "ޚ": "kh",
  2732. "ޛ": "th",
  2733. "ޜ": "z",
  2734. "ޝ": "sh",
  2735. "ޞ": "s",
  2736. "ޟ": "d",
  2737. "ޠ": "t",
  2738. "ޡ": "z",
  2739. "ޢ": "a",
  2740. "ޣ": "gh",
  2741. "ޤ": "q",
  2742. "ޥ": "w",
  2743. "ަ": "a",
  2744. "ާ": "aa",
  2745. "ި": "i",
  2746. "ީ": "ee",
  2747. "ު": "u",
  2748. "ޫ": "oo",
  2749. "ެ": "e",
  2750. "ޭ": "ey",
  2751. "ޮ": "o",
  2752. "ޯ": "oa",
  2753. "ް": "",
  2754. "ა": "a",
  2755. "ბ": "b",
  2756. "გ": "g",
  2757. "დ": "d",
  2758. "ე": "e",
  2759. "ვ": "v",
  2760. "ზ": "z",
  2761. "თ": "t",
  2762. "ი": "i",
  2763. "კ": "k",
  2764. "ლ": "l",
  2765. "მ": "m",
  2766. "ნ": "n",
  2767. "ო": "o",
  2768. "პ": "p",
  2769. "ჟ": "zh",
  2770. "რ": "r",
  2771. "ს": "s",
  2772. "ტ": "t",
  2773. "უ": "u",
  2774. "ფ": "p",
  2775. "ქ": "k",
  2776. "ღ": "gh",
  2777. "ყ": "q",
  2778. "შ": "sh",
  2779. "ჩ": "ch",
  2780. "ც": "ts",
  2781. "ძ": "dz",
  2782. "წ": "ts",
  2783. "ჭ": "ch",
  2784. "ხ": "kh",
  2785. "ჯ": "j",
  2786. "ჰ": "h",
  2787. "α": "a",
  2788. "β": "v",
  2789. "γ": "g",
  2790. "δ": "d",
  2791. "ε": "e",
  2792. "ζ": "z",
  2793. "η": "i",
  2794. "θ": "th",
  2795. "ι": "i",
  2796. "κ": "k",
  2797. "λ": "l",
  2798. "μ": "m",
  2799. "ν": "n",
  2800. "ξ": "ks",
  2801. "ο": "o",
  2802. "π": "p",
  2803. "ρ": "r",
  2804. "σ": "s",
  2805. "τ": "t",
  2806. "υ": "y",
  2807. "φ": "f",
  2808. "χ": "x",
  2809. "ψ": "ps",
  2810. "ω": "o",
  2811. "ά": "a",
  2812. "έ": "e",
  2813. "ί": "i",
  2814. "ό": "o",
  2815. "ύ": "y",
  2816. "ή": "i",
  2817. "ώ": "o",
  2818. "ς": "s",
  2819. "ϊ": "i",
  2820. "ΰ": "y",
  2821. "ϋ": "y",
  2822. "ΐ": "i",
  2823. "Α": "A",
  2824. "Β": "B",
  2825. "Γ": "G",
  2826. "Δ": "D",
  2827. "Ε": "E",
  2828. "Ζ": "Z",
  2829. "Η": "I",
  2830. "Θ": "TH",
  2831. "Ι": "I",
  2832. "Κ": "K",
  2833. "Λ": "L",
  2834. "Μ": "M",
  2835. "Ν": "N",
  2836. "Ξ": "KS",
  2837. "Ο": "O",
  2838. "Π": "P",
  2839. "Ρ": "R",
  2840. "Σ": "S",
  2841. "Τ": "T",
  2842. "Υ": "Y",
  2843. "Φ": "F",
  2844. "Χ": "X",
  2845. "Ψ": "PS",
  2846. "Ω": "O",
  2847. "Ά": "A",
  2848. "Έ": "E",
  2849. "Ί": "I",
  2850. "Ό": "O",
  2851. "Ύ": "Y",
  2852. "Ή": "I",
  2853. "Ώ": "O",
  2854. "Ϊ": "I",
  2855. "Ϋ": "Y",
  2856. "ā": "a",
  2857. "ē": "e",
  2858. "ģ": "g",
  2859. "ī": "i",
  2860. "ķ": "k",
  2861. "ļ": "l",
  2862. "ņ": "n",
  2863. "ū": "u",
  2864. "Ā": "A",
  2865. "Ē": "E",
  2866. "Ģ": "G",
  2867. "Ī": "I",
  2868. "Ķ": "k",
  2869. "Ļ": "L",
  2870. "Ņ": "N",
  2871. "Ū": "U",
  2872. "Ќ": "Kj",
  2873. "ќ": "kj",
  2874. "Љ": "Lj",
  2875. "љ": "lj",
  2876. "Њ": "Nj",
  2877. "њ": "nj",
  2878. "Тс": "Ts",
  2879. "тс": "ts",
  2880. "ą": "a",
  2881. "ć": "c",
  2882. "ę": "e",
  2883. "ł": "l",
  2884. "ń": "n",
  2885. "ś": "s",
  2886. "ź": "z",
  2887. "ż": "z",
  2888. "Ą": "A",
  2889. "Ć": "C",
  2890. "Ę": "E",
  2891. "Ł": "L",
  2892. "Ń": "N",
  2893. "Ś": "S",
  2894. "Ź": "Z",
  2895. "Ż": "Z",
  2896. "Є": "Ye",
  2897. "І": "I",
  2898. "Ї": "Yi",
  2899. "Ґ": "G",
  2900. "є": "ye",
  2901. "і": "i",
  2902. "ї": "yi",
  2903. "ґ": "g",
  2904. "ă": "a",
  2905. "Ă": "A",
  2906. "ș": "s",
  2907. "Ș": "S",
  2908. "ț": "t",
  2909. "Ț": "T",
  2910. "ţ": "t",
  2911. "Ţ": "T",
  2912. "а": "a",
  2913. "б": "b",
  2914. "в": "v",
  2915. "г": "g",
  2916. "д": "d",
  2917. "е": "e",
  2918. "ё": "yo",
  2919. "ж": "zh",
  2920. "з": "z",
  2921. "и": "i",
  2922. "й": "i",
  2923. "к": "k",
  2924. "л": "l",
  2925. "м": "m",
  2926. "н": "n",
  2927. "о": "o",
  2928. "п": "p",
  2929. "р": "r",
  2930. "с": "s",
  2931. "т": "t",
  2932. "у": "u",
  2933. "ф": "f",
  2934. "х": "kh",
  2935. "ц": "c",
  2936. "ч": "ch",
  2937. "ш": "sh",
  2938. "щ": "sh",
  2939. "ъ": "",
  2940. "ы": "y",
  2941. "ь": "",
  2942. "э": "e",
  2943. "ю": "yu",
  2944. "я": "ya",
  2945. "А": "A",
  2946. "Б": "B",
  2947. "В": "V",
  2948. "Г": "G",
  2949. "Д": "D",
  2950. "Е": "E",
  2951. "Ё": "Yo",
  2952. "Ж": "Zh",
  2953. "З": "Z",
  2954. "И": "I",
  2955. "Й": "I",
  2956. "К": "K",
  2957. "Л": "L",
  2958. "М": "M",
  2959. "Н": "N",
  2960. "О": "O",
  2961. "П": "P",
  2962. "Р": "R",
  2963. "С": "S",
  2964. "Т": "T",
  2965. "У": "U",
  2966. "Ф": "F",
  2967. "Х": "Kh",
  2968. "Ц": "C",
  2969. "Ч": "Ch",
  2970. "Ш": "Sh",
  2971. "Щ": "Sh",
  2972. "Ъ": "",
  2973. "Ы": "Y",
  2974. "Ь": "",
  2975. "Э": "E",
  2976. "Ю": "Yu",
  2977. "Я": "Ya",
  2978. "ђ": "dj",
  2979. "ј": "j",
  2980. "ћ": "c",
  2981. "џ": "dz",
  2982. "Ђ": "Dj",
  2983. "Ј": "j",
  2984. "Ћ": "C",
  2985. "Џ": "Dz",
  2986. "ľ": "l",
  2987. "ĺ": "l",
  2988. "ŕ": "r",
  2989. "Ľ": "L",
  2990. "Ĺ": "L",
  2991. "Ŕ": "R",
  2992. "ş": "s",
  2993. "Ş": "S",
  2994. "ı": "i",
  2995. "İ": "I",
  2996. "ğ": "g",
  2997. "Ğ": "G",
  2998. "ả": "a",
  2999. "Ả": "A",
  3000. "ẳ": "a",
  3001. "Ẳ": "A",
  3002. "ẩ": "a",
  3003. "Ẩ": "A",
  3004. "đ": "d",
  3005. "Đ": "D",
  3006. "ẹ": "e",
  3007. "Ẹ": "E",
  3008. "ẽ": "e",
  3009. "Ẽ": "E",
  3010. "ẻ": "e",
  3011. "Ẻ": "E",
  3012. "ế": "e",
  3013. "Ế": "E",
  3014. "ề": "e",
  3015. "Ề": "E",
  3016. "ệ": "e",
  3017. "Ệ": "E",
  3018. "ễ": "e",
  3019. "Ễ": "E",
  3020. "ể": "e",
  3021. "Ể": "E",
  3022. "ỏ": "o",
  3023. "ọ": "o",
  3024. "Ọ": "o",
  3025. "ố": "o",
  3026. "Ố": "O",
  3027. "ồ": "o",
  3028. "Ồ": "O",
  3029. "ổ": "o",
  3030. "Ổ": "O",
  3031. "ộ": "o",
  3032. "Ộ": "O",
  3033. "ỗ": "o",
  3034. "Ỗ": "O",
  3035. "ơ": "o",
  3036. "Ơ": "O",
  3037. "ớ": "o",
  3038. "Ớ": "O",
  3039. "ờ": "o",
  3040. "Ờ": "O",
  3041. "ợ": "o",
  3042. "Ợ": "O",
  3043. "ỡ": "o",
  3044. "Ỡ": "O",
  3045. "Ở": "o",
  3046. "ở": "o",
  3047. "ị": "i",
  3048. "Ị": "I",
  3049. "ĩ": "i",
  3050. "Ĩ": "I",
  3051. "ỉ": "i",
  3052. "Ỉ": "i",
  3053. "ủ": "u",
  3054. "Ủ": "U",
  3055. "ụ": "u",
  3056. "Ụ": "U",
  3057. "ũ": "u",
  3058. "Ũ": "U",
  3059. "ư": "u",
  3060. "Ư": "U",
  3061. "ứ": "u",
  3062. "Ứ": "U",
  3063. "ừ": "u",
  3064. "Ừ": "U",
  3065. "ự": "u",
  3066. "Ự": "U",
  3067. "ữ": "u",
  3068. "Ữ": "U",
  3069. "ử": "u",
  3070. "Ử": "ư",
  3071. "ỷ": "y",
  3072. "Ỷ": "y",
  3073. "ỳ": "y",
  3074. "Ỳ": "Y",
  3075. "ỵ": "y",
  3076. "Ỵ": "Y",
  3077. "ỹ": "y",
  3078. "Ỹ": "Y",
  3079. "ạ": "a",
  3080. "Ạ": "A",
  3081. "ấ": "a",
  3082. "Ấ": "A",
  3083. "ầ": "a",
  3084. "Ầ": "A",
  3085. "ậ": "a",
  3086. "Ậ": "A",
  3087. "ẫ": "a",
  3088. "Ẫ": "A",
  3089. "ắ": "a",
  3090. "Ắ": "A",
  3091. "ằ": "a",
  3092. "Ằ": "A",
  3093. "ặ": "a",
  3094. "Ặ": "A",
  3095. "ẵ": "a",
  3096. "Ẵ": "A",
  3097. "⓪": "0",
  3098. "①": "1",
  3099. "②": "2",
  3100. "③": "3",
  3101. "④": "4",
  3102. "⑤": "5",
  3103. "⑥": "6",
  3104. "⑦": "7",
  3105. "⑧": "8",
  3106. "⑨": "9",
  3107. "⑩": "10",
  3108. "⑪": "11",
  3109. "⑫": "12",
  3110. "⑬": "13",
  3111. "⑭": "14",
  3112. "⑮": "15",
  3113. "⑯": "16",
  3114. "⑰": "17",
  3115. "⑱": "18",
  3116. "⑲": "18",
  3117. "⑳": "18",
  3118. "⓵": "1",
  3119. "⓶": "2",
  3120. "⓷": "3",
  3121. "⓸": "4",
  3122. "⓹": "5",
  3123. "⓺": "6",
  3124. "⓻": "7",
  3125. "⓼": "8",
  3126. "⓽": "9",
  3127. "⓾": "10",
  3128. "⓿": "0",
  3129. "⓫": "11",
  3130. "⓬": "12",
  3131. "⓭": "13",
  3132. "⓮": "14",
  3133. "⓯": "15",
  3134. "⓰": "16",
  3135. "⓱": "17",
  3136. "⓲": "18",
  3137. "⓳": "19",
  3138. "⓴": "20",
  3139. "Ⓐ": "A",
  3140. "Ⓑ": "B",
  3141. "Ⓒ": "C",
  3142. "Ⓓ": "D",
  3143. "Ⓔ": "E",
  3144. "Ⓕ": "F",
  3145. "Ⓖ": "G",
  3146. "Ⓗ": "H",
  3147. "Ⓘ": "I",
  3148. "Ⓙ": "J",
  3149. "Ⓚ": "K",
  3150. "Ⓛ": "L",
  3151. "Ⓜ": "M",
  3152. "Ⓝ": "N",
  3153. "Ⓞ": "O",
  3154. "Ⓟ": "P",
  3155. "Ⓠ": "Q",
  3156. "Ⓡ": "R",
  3157. "Ⓢ": "S",
  3158. "Ⓣ": "T",
  3159. "Ⓤ": "U",
  3160. "Ⓥ": "V",
  3161. "Ⓦ": "W",
  3162. "Ⓧ": "X",
  3163. "Ⓨ": "Y",
  3164. "Ⓩ": "Z",
  3165. "ⓐ": "a",
  3166. "ⓑ": "b",
  3167. "ⓒ": "c",
  3168. "ⓓ": "d",
  3169. "ⓔ": "e",
  3170. "ⓕ": "f",
  3171. "ⓖ": "g",
  3172. "ⓗ": "h",
  3173. "ⓘ": "i",
  3174. "ⓙ": "j",
  3175. "ⓚ": "k",
  3176. "ⓛ": "l",
  3177. "ⓜ": "m",
  3178. "ⓝ": "n",
  3179. "ⓞ": "o",
  3180. "ⓟ": "p",
  3181. "ⓠ": "q",
  3182. "ⓡ": "r",
  3183. "ⓢ": "s",
  3184. "ⓣ": "t",
  3185. "ⓤ": "u",
  3186. "ⓦ": "v",
  3187. "ⓥ": "w",
  3188. "ⓧ": "x",
  3189. "ⓨ": "y",
  3190. "ⓩ": "z",
  3191. "“": "\"",
  3192. "”": "\"",
  3193. "‘": "'",
  3194. "’": "'",
  3195. "∂": "d",
  3196. "ƒ": "f",
  3197. "™": "(TM)",
  3198. "©": "(C)",
  3199. "œ": "oe",
  3200. "Œ": "OE",
  3201. "®": "(R)",
  3202. "†": "+",
  3203. "℠": "(SM)",
  3204. "…": "...",
  3205. "˚": "o",
  3206. "º": "o",
  3207. "ª": "a",
  3208. "•": "*",
  3209. "၊": ",",
  3210. "။": ".",
  3211. "$": "USD",
  3212. "€": "EUR",
  3213. "₢": "BRN",
  3214. "₣": "FRF",
  3215. "£": "GBP",
  3216. "₤": "ITL",
  3217. "₦": "NGN",
  3218. "₧": "ESP",
  3219. "₩": "KRW",
  3220. "₪": "ILS",
  3221. "₫": "VND",
  3222. "₭": "LAK",
  3223. "₮": "MNT",
  3224. "₯": "GRD",
  3225. "₱": "ARS",
  3226. "₲": "PYG",
  3227. "₳": "ARA",
  3228. "₴": "UAH",
  3229. "₵": "GHS",
  3230. "¢": "cent",
  3231. "¥": "CNY",
  3232. "元": "CNY",
  3233. "円": "YEN",
  3234. "﷼": "IRR",
  3235. "₠": "EWE",
  3236. "฿": "THB",
  3237. "₨": "INR",
  3238. "₹": "INR",
  3239. "₰": "PF",
  3240. "₺": "TRY",
  3241. "؋": "AFN",
  3242. "₼": "AZN",
  3243. "лв": "BGN",
  3244. "៛": "KHR",
  3245. "₡": "CRC",
  3246. "₸": "KZT",
  3247. "ден": "MKD",
  3248. "zł": "PLN",
  3249. "₽": "RUB",
  3250. "₾": "GEL"
  3251. };
  3252. /**
  3253. * special look ahead character array
  3254. * These characters form with consonants to become 'single'/consonant combo
  3255. * @type [Array]
  3256. */
  3257. var lookAheadCharArray = ["်", "ް"];
  3258. /**
  3259. * diatricMap for languages where transliteration changes entirely as more diatrics are added
  3260. * @type {Object}
  3261. */
  3262. var diatricMap = {
  3263. "ာ": "a",
  3264. "ါ": "a",
  3265. "ေ": "e",
  3266. "ဲ": "e",
  3267. "ိ": "i",
  3268. "ီ": "i",
  3269. "ို": "o",
  3270. "ု": "u",
  3271. "ူ": "u",
  3272. "ေါင်": "aung",
  3273. "ော": "aw",
  3274. "ော်": "aw",
  3275. "ေါ": "aw",
  3276. "ေါ်": "aw",
  3277. "်": "်",
  3278. "က်": "et",
  3279. "ိုက်": "aik",
  3280. "ောက်": "auk",
  3281. "င်": "in",
  3282. "ိုင်": "aing",
  3283. "ောင်": "aung",
  3284. "စ်": "it",
  3285. "ည်": "i",
  3286. "တ်": "at",
  3287. "ိတ်": "eik",
  3288. "ုတ်": "ok",
  3289. "ွတ်": "ut",
  3290. "ေတ်": "it",
  3291. "ဒ်": "d",
  3292. "ိုဒ်": "ok",
  3293. "ုဒ်": "ait",
  3294. "န်": "an",
  3295. "ာန်": "an",
  3296. "ိန်": "ein",
  3297. "ုန်": "on",
  3298. "ွန်": "un",
  3299. "ပ်": "at",
  3300. "ိပ်": "eik",
  3301. "ုပ်": "ok",
  3302. "ွပ်": "ut",
  3303. "န်ုပ်": "nub",
  3304. "မ်": "an",
  3305. "ိမ်": "ein",
  3306. "ုမ်": "on",
  3307. "ွမ်": "un",
  3308. "ယ်": "e",
  3309. "ိုလ်": "ol",
  3310. "ဉ်": "in",
  3311. "ံ": "an",
  3312. "ိံ": "ein",
  3313. "ုံ": "on",
  3314. "ައް": "ah",
  3315. "ަށް": "ah"
  3316. };
  3317. /**
  3318. * langCharMap language specific characters translations
  3319. * @type {Object}
  3320. */
  3321. var langCharMap = {
  3322. "en": {},
  3323. "az": {
  3324. "ç": "c",
  3325. "ə": "e",
  3326. "ğ": "g",
  3327. "ı": "i",
  3328. "ö": "o",
  3329. "ş": "s",
  3330. "ü": "u",
  3331. "Ç": "C",
  3332. "Ə": "E",
  3333. "Ğ": "G",
  3334. "İ": "I",
  3335. "Ö": "O",
  3336. "Ş": "S",
  3337. "Ü": "U"
  3338. },
  3339. "cs": {
  3340. "č": "c",
  3341. "ď": "d",
  3342. "ě": "e",
  3343. "ň": "n",
  3344. "ř": "r",
  3345. "š": "s",
  3346. "ť": "t",
  3347. "ů": "u",
  3348. "ž": "z",
  3349. "Č": "C",
  3350. "Ď": "D",
  3351. "Ě": "E",
  3352. "Ň": "N",
  3353. "Ř": "R",
  3354. "Š": "S",
  3355. "Ť": "T",
  3356. "Ů": "U",
  3357. "Ž": "Z"
  3358. },
  3359. "fi": {
  3360. "ä": "a",
  3361. "Ä": "A",
  3362. "ö": "o",
  3363. "Ö": "O"
  3364. },
  3365. "hu": {
  3366. "ä": "a",
  3367. "Ä": "A",
  3368. "ö": "o",
  3369. "Ö": "O",
  3370. "ü": "u",
  3371. "Ü": "U",
  3372. "ű": "u",
  3373. "Ű": "U"
  3374. },
  3375. "lt": {
  3376. "ą": "a",
  3377. "č": "c",
  3378. "ę": "e",
  3379. "ė": "e",
  3380. "į": "i",
  3381. "š": "s",
  3382. "ų": "u",
  3383. "ū": "u",
  3384. "ž": "z",
  3385. "Ą": "A",
  3386. "Č": "C",
  3387. "Ę": "E",
  3388. "Ė": "E",
  3389. "Į": "I",
  3390. "Š": "S",
  3391. "Ų": "U",
  3392. "Ū": "U"
  3393. },
  3394. "lv": {
  3395. "ā": "a",
  3396. "č": "c",
  3397. "ē": "e",
  3398. "ģ": "g",
  3399. "ī": "i",
  3400. "ķ": "k",
  3401. "ļ": "l",
  3402. "ņ": "n",
  3403. "š": "s",
  3404. "ū": "u",
  3405. "ž": "z",
  3406. "Ā": "A",
  3407. "Č": "C",
  3408. "Ē": "E",
  3409. "Ģ": "G",
  3410. "Ī": "i",
  3411. "Ķ": "k",
  3412. "Ļ": "L",
  3413. "Ņ": "N",
  3414. "Š": "S",
  3415. "Ū": "u",
  3416. "Ž": "Z"
  3417. },
  3418. "pl": {
  3419. "ą": "a",
  3420. "ć": "c",
  3421. "ę": "e",
  3422. "ł": "l",
  3423. "ń": "n",
  3424. "ó": "o",
  3425. "ś": "s",
  3426. "ź": "z",
  3427. "ż": "z",
  3428. "Ą": "A",
  3429. "Ć": "C",
  3430. "Ę": "e",
  3431. "Ł": "L",
  3432. "Ń": "N",
  3433. "Ó": "O",
  3434. "Ś": "S",
  3435. "Ź": "Z",
  3436. "Ż": "Z"
  3437. },
  3438. "sv": {
  3439. "ä": "a",
  3440. "Ä": "A",
  3441. "ö": "o",
  3442. "Ö": "O"
  3443. },
  3444. "sk": {
  3445. "ä": "a",
  3446. "Ä": "A"
  3447. },
  3448. "sr": {
  3449. "љ": "lj",
  3450. "њ": "nj",
  3451. "Љ": "Lj",
  3452. "Њ": "Nj",
  3453. "đ": "dj",
  3454. "Đ": "Dj"
  3455. },
  3456. "tr": {
  3457. "Ü": "U",
  3458. "Ö": "O",
  3459. "ü": "u",
  3460. "ö": "o"
  3461. }
  3462. };
  3463. /**
  3464. * symbolMap language specific symbol translations
  3465. * translations must be transliterated already
  3466. * @type {Object}
  3467. */
  3468. var symbolMap = {
  3469. "ar": {
  3470. "∆": "delta",
  3471. "∞": "la-nihaya",
  3472. "♥": "hob",
  3473. "&": "wa",
  3474. "|": "aw",
  3475. "<": "aqal-men",
  3476. ">": "akbar-men",
  3477. "∑": "majmou",
  3478. "¤": "omla"
  3479. },
  3480. "az": {},
  3481. "ca": {
  3482. "∆": "delta",
  3483. "∞": "infinit",
  3484. "♥": "amor",
  3485. "&": "i",
  3486. "|": "o",
  3487. "<": "menys que",
  3488. ">": "mes que",
  3489. "∑": "suma dels",
  3490. "¤": "moneda"
  3491. },
  3492. "cs": {
  3493. "∆": "delta",
  3494. "∞": "nekonecno",
  3495. "♥": "laska",
  3496. "&": "a",
  3497. "|": "nebo",
  3498. "<": "mensi nez",
  3499. ">": "vetsi nez",
  3500. "∑": "soucet",
  3501. "¤": "mena"
  3502. },
  3503. "de": {
  3504. "∆": "delta",
  3505. "∞": "unendlich",
  3506. "♥": "Liebe",
  3507. "&": "und",
  3508. "|": "oder",
  3509. "<": "kleiner als",
  3510. ">": "groesser als",
  3511. "∑": "Summe von",
  3512. "¤": "Waehrung"
  3513. },
  3514. "dv": {
  3515. "∆": "delta",
  3516. "∞": "kolunulaa",
  3517. "♥": "loabi",
  3518. "&": "aai",
  3519. "|": "noonee",
  3520. "<": "ah vure kuda",
  3521. ">": "ah vure bodu",
  3522. "∑": "jumula",
  3523. "¤": "faisaa"
  3524. },
  3525. "en": {
  3526. "∆": "delta",
  3527. "∞": "infinity",
  3528. "♥": "love",
  3529. "&": "and",
  3530. "|": "or",
  3531. "<": "less than",
  3532. ">": "greater than",
  3533. "∑": "sum",
  3534. "¤": "currency"
  3535. },
  3536. "es": {
  3537. "∆": "delta",
  3538. "∞": "infinito",
  3539. "♥": "amor",
  3540. "&": "y",
  3541. "|": "u",
  3542. "<": "menos que",
  3543. ">": "mas que",
  3544. "∑": "suma de los",
  3545. "¤": "moneda"
  3546. },
  3547. "fa": {
  3548. "∆": "delta",
  3549. "∞": "bi-nahayat",
  3550. "♥": "eshgh",
  3551. "&": "va",
  3552. "|": "ya",
  3553. "<": "kamtar-az",
  3554. ">": "bishtar-az",
  3555. "∑": "majmooe",
  3556. "¤": "vahed"
  3557. },
  3558. "fi": {
  3559. "∆": "delta",
  3560. "∞": "aarettomyys",
  3561. "♥": "rakkaus",
  3562. "&": "ja",
  3563. "|": "tai",
  3564. "<": "pienempi kuin",
  3565. ">": "suurempi kuin",
  3566. "∑": "summa",
  3567. "¤": "valuutta"
  3568. },
  3569. "fr": {
  3570. "∆": "delta",
  3571. "∞": "infiniment",
  3572. "♥": "Amour",
  3573. "&": "et",
  3574. "|": "ou",
  3575. "<": "moins que",
  3576. ">": "superieure a",
  3577. "∑": "somme des",
  3578. "¤": "monnaie"
  3579. },
  3580. "ge": {
  3581. "∆": "delta",
  3582. "∞": "usasruloba",
  3583. "♥": "siqvaruli",
  3584. "&": "da",
  3585. "|": "an",
  3586. "<": "naklebi",
  3587. ">": "meti",
  3588. "∑": "jami",
  3589. "¤": "valuta"
  3590. },
  3591. "gr": {},
  3592. "hu": {
  3593. "∆": "delta",
  3594. "∞": "vegtelen",
  3595. "♥": "szerelem",
  3596. "&": "es",
  3597. "|": "vagy",
  3598. "<": "kisebb mint",
  3599. ">": "nagyobb mint",
  3600. "∑": "szumma",
  3601. "¤": "penznem"
  3602. },
  3603. "it": {
  3604. "∆": "delta",
  3605. "∞": "infinito",
  3606. "♥": "amore",
  3607. "&": "e",
  3608. "|": "o",
  3609. "<": "minore di",
  3610. ">": "maggiore di",
  3611. "∑": "somma",
  3612. "¤": "moneta"
  3613. },
  3614. "lt": {
  3615. "∆": "delta",
  3616. "∞": "begalybe",
  3617. "♥": "meile",
  3618. "&": "ir",
  3619. "|": "ar",
  3620. "<": "maziau nei",
  3621. ">": "daugiau nei",
  3622. "∑": "suma",
  3623. "¤": "valiuta"
  3624. },
  3625. "lv": {
  3626. "∆": "delta",
  3627. "∞": "bezgaliba",
  3628. "♥": "milestiba",
  3629. "&": "un",
  3630. "|": "vai",
  3631. "<": "mazak neka",
  3632. ">": "lielaks neka",
  3633. "∑": "summa",
  3634. "¤": "valuta"
  3635. },
  3636. "my": {
  3637. "∆": "kwahkhyaet",
  3638. "∞": "asaonasme",
  3639. "♥": "akhyait",
  3640. "&": "nhin",
  3641. "|": "tho",
  3642. "<": "ngethaw",
  3643. ">": "kyithaw",
  3644. "∑": "paungld",
  3645. "¤": "ngwekye"
  3646. },
  3647. "mk": {},
  3648. "nl": {
  3649. "∆": "delta",
  3650. "∞": "oneindig",
  3651. "♥": "liefde",
  3652. "&": "en",
  3653. "|": "of",
  3654. "<": "kleiner dan",
  3655. ">": "groter dan",
  3656. "∑": "som",
  3657. "¤": "valuta"
  3658. },
  3659. "pl": {
  3660. "∆": "delta",
  3661. "∞": "nieskonczonosc",
  3662. "♥": "milosc",
  3663. "&": "i",
  3664. "|": "lub",
  3665. "<": "mniejsze niz",
  3666. ">": "wieksze niz",
  3667. "∑": "suma",
  3668. "¤": "waluta"
  3669. },
  3670. "pt": {
  3671. "∆": "delta",
  3672. "∞": "infinito",
  3673. "♥": "amor",
  3674. "&": "e",
  3675. "|": "ou",
  3676. "<": "menor que",
  3677. ">": "maior que",
  3678. "∑": "soma",
  3679. "¤": "moeda"
  3680. },
  3681. "ro": {
  3682. "∆": "delta",
  3683. "∞": "infinit",
  3684. "♥": "dragoste",
  3685. "&": "si",
  3686. "|": "sau",
  3687. "<": "mai mic ca",
  3688. ">": "mai mare ca",
  3689. "∑": "suma",
  3690. "¤": "valuta"
  3691. },
  3692. "ru": {
  3693. "∆": "delta",
  3694. "∞": "beskonechno",
  3695. "♥": "lubov",
  3696. "&": "i",
  3697. "|": "ili",
  3698. "<": "menshe",
  3699. ">": "bolshe",
  3700. "∑": "summa",
  3701. "¤": "valjuta"
  3702. },
  3703. "sk": {
  3704. "∆": "delta",
  3705. "∞": "nekonecno",
  3706. "♥": "laska",
  3707. "&": "a",
  3708. "|": "alebo",
  3709. "<": "menej ako",
  3710. ">": "viac ako",
  3711. "∑": "sucet",
  3712. "¤": "mena"
  3713. },
  3714. "sr": {},
  3715. "tr": {
  3716. "∆": "delta",
  3717. "∞": "sonsuzluk",
  3718. "♥": "ask",
  3719. "&": "ve",
  3720. "|": "veya",
  3721. "<": "kucuktur",
  3722. ">": "buyuktur",
  3723. "∑": "toplam",
  3724. "¤": "para birimi"
  3725. },
  3726. "uk": {
  3727. "∆": "delta",
  3728. "∞": "bezkinechnist",
  3729. "♥": "lubov",
  3730. "&": "i",
  3731. "|": "abo",
  3732. "<": "menshe",
  3733. ">": "bilshe",
  3734. "∑": "suma",
  3735. "¤": "valjuta"
  3736. },
  3737. "vn": {
  3738. "∆": "delta",
  3739. "∞": "vo cuc",
  3740. "♥": "yeu",
  3741. "&": "va",
  3742. "|": "hoac",
  3743. "<": "nho hon",
  3744. ">": "lon hon",
  3745. "∑": "tong",
  3746. "¤": "tien te"
  3747. }
  3748. };
  3749. var uricChars = [
  3750. ";",
  3751. "?",
  3752. ":",
  3753. "@",
  3754. "&",
  3755. "=",
  3756. "+",
  3757. "$",
  3758. ",",
  3759. "/"
  3760. ].join("");
  3761. var uricNoSlashChars = [
  3762. ";",
  3763. "?",
  3764. ":",
  3765. "@",
  3766. "&",
  3767. "=",
  3768. "+",
  3769. "$",
  3770. ","
  3771. ].join("");
  3772. var markChars = [
  3773. ".",
  3774. "!",
  3775. "~",
  3776. "*",
  3777. "'",
  3778. "(",
  3779. ")"
  3780. ].join("");
  3781. /**
  3782. * getSlug
  3783. * @param {string} input input string
  3784. * @param {object|string} opts config object or separator string/char
  3785. * @api public
  3786. * @return {string} sluggified string
  3787. */
  3788. var getSlug = function getSlug$1(input, opts) {
  3789. var separator = "-";
  3790. var result = "";
  3791. var diatricString = "";
  3792. var convertSymbols = true;
  3793. var customReplacements = {};
  3794. var maintainCase;
  3795. var titleCase;
  3796. var truncate;
  3797. var uricFlag;
  3798. var uricNoSlashFlag;
  3799. var markFlag;
  3800. var symbol;
  3801. var langChar;
  3802. var lucky;
  3803. var i;
  3804. var ch;
  3805. var l;
  3806. var lastCharWasSymbol;
  3807. var lastCharWasDiatric;
  3808. var allowedChars = "";
  3809. if (typeof input !== "string") return "";
  3810. if (typeof opts === "string") separator = opts;
  3811. symbol = symbolMap.en;
  3812. langChar = langCharMap.en;
  3813. if (typeof opts === "object") {
  3814. maintainCase = opts.maintainCase || false;
  3815. customReplacements = opts.custom && typeof opts.custom === "object" ? opts.custom : customReplacements;
  3816. truncate = +opts.truncate > 1 && opts.truncate || false;
  3817. uricFlag = opts.uric || false;
  3818. uricNoSlashFlag = opts.uricNoSlash || false;
  3819. markFlag = opts.mark || false;
  3820. convertSymbols = opts.symbols === false || opts.lang === false ? false : true;
  3821. separator = opts.separator || separator;
  3822. if (uricFlag) allowedChars += uricChars;
  3823. if (uricNoSlashFlag) allowedChars += uricNoSlashChars;
  3824. if (markFlag) allowedChars += markChars;
  3825. symbol = opts.lang && symbolMap[opts.lang] && convertSymbols ? symbolMap[opts.lang] : convertSymbols ? symbolMap.en : {};
  3826. langChar = opts.lang && langCharMap[opts.lang] ? langCharMap[opts.lang] : opts.lang === false || opts.lang === true ? {} : langCharMap.en;
  3827. if (opts.titleCase && typeof opts.titleCase.length === "number" && Array.prototype.toString.call(opts.titleCase)) {
  3828. opts.titleCase.forEach(function(v) {
  3829. customReplacements[v + ""] = v + "";
  3830. });
  3831. titleCase = true;
  3832. } else titleCase = !!opts.titleCase;
  3833. if (opts.custom && typeof opts.custom.length === "number" && Array.prototype.toString.call(opts.custom)) opts.custom.forEach(function(v) {
  3834. customReplacements[v + ""] = v + "";
  3835. });
  3836. Object.keys(customReplacements).forEach(function(v) {
  3837. var r;
  3838. if (v.length > 1) r = new RegExp("\\b" + escapeChars(v) + "\\b", "gi");
  3839. else r = new RegExp(escapeChars(v), "gi");
  3840. input = input.replace(r, customReplacements[v]);
  3841. });
  3842. for (ch in customReplacements) allowedChars += ch;
  3843. }
  3844. allowedChars += separator;
  3845. allowedChars = escapeChars(allowedChars);
  3846. input = input.replace(/(^\s+|\s+$)/g, "");
  3847. lastCharWasSymbol = false;
  3848. lastCharWasDiatric = false;
  3849. for (i = 0, l = input.length; i < l; i++) {
  3850. ch = input[i];
  3851. if (isReplacedCustomChar(ch, customReplacements)) lastCharWasSymbol = false;
  3852. else if (langChar[ch]) {
  3853. ch = lastCharWasSymbol && langChar[ch].match(/[A-Za-z0-9]/) ? " " + langChar[ch] : langChar[ch];
  3854. lastCharWasSymbol = false;
  3855. } else if (ch in charMap) {
  3856. if (i + 1 < l && lookAheadCharArray.indexOf(input[i + 1]) >= 0) {
  3857. diatricString += ch;
  3858. ch = "";
  3859. } else if (lastCharWasDiatric === true) {
  3860. ch = diatricMap[diatricString] + charMap[ch];
  3861. diatricString = "";
  3862. } else ch = lastCharWasSymbol && charMap[ch].match(/[A-Za-z0-9]/) ? " " + charMap[ch] : charMap[ch];
  3863. lastCharWasSymbol = false;
  3864. lastCharWasDiatric = false;
  3865. } else if (ch in diatricMap) {
  3866. diatricString += ch;
  3867. ch = "";
  3868. if (i === l - 1) ch = diatricMap[diatricString];
  3869. lastCharWasDiatric = true;
  3870. } else if (symbol[ch] && !(uricFlag && uricChars.indexOf(ch) !== -1) && !(uricNoSlashFlag && uricNoSlashChars.indexOf(ch) !== -1)) {
  3871. ch = lastCharWasSymbol || result.substr(-1).match(/[A-Za-z0-9]/) ? separator + symbol[ch] : symbol[ch];
  3872. ch += input[i + 1] !== void 0 && input[i + 1].match(/[A-Za-z0-9]/) ? separator : "";
  3873. lastCharWasSymbol = true;
  3874. } else {
  3875. if (lastCharWasDiatric === true) {
  3876. ch = diatricMap[diatricString] + ch;
  3877. diatricString = "";
  3878. lastCharWasDiatric = false;
  3879. } else if (lastCharWasSymbol && (/[A-Za-z0-9]/.test(ch) || result.substr(-1).match(/A-Za-z0-9]/))) ch = " " + ch;
  3880. lastCharWasSymbol = false;
  3881. }
  3882. result += ch.replace(new RegExp("[^\\w\\s" + allowedChars + "_-]", "g"), separator);
  3883. }
  3884. if (titleCase) result = result.replace(/(\w)(\S*)/g, function(_, i$1, r) {
  3885. var j = i$1.toUpperCase() + (r !== null ? r : "");
  3886. return Object.keys(customReplacements).indexOf(j.toLowerCase()) < 0 ? j : j.toLowerCase();
  3887. });
  3888. result = result.replace(/\s+/g, separator).replace(new RegExp("\\" + separator + "+", "g"), separator).replace(new RegExp("(^\\" + separator + "+|\\" + separator + "+$)", "g"), "");
  3889. if (truncate && result.length > truncate) {
  3890. lucky = result.charAt(truncate) === separator;
  3891. result = result.slice(0, truncate);
  3892. if (!lucky) result = result.slice(0, result.lastIndexOf(separator));
  3893. }
  3894. if (!maintainCase && !titleCase) result = result.toLowerCase();
  3895. return result;
  3896. };
  3897. /**
  3898. * createSlug curried(opts)(input)
  3899. * @param {object|string} opts config object or input string
  3900. * @return {Function} function getSlugWithConfig()
  3901. **/
  3902. var createSlug = function createSlug$1(opts) {
  3903. /**
  3904. * getSlugWithConfig
  3905. * @param {string} input string
  3906. * @return {string} slug string
  3907. */
  3908. return function getSlugWithConfig(input) {
  3909. return getSlug(input, opts);
  3910. };
  3911. };
  3912. /**
  3913. * escape Chars
  3914. * @param {string} input string
  3915. */
  3916. var escapeChars = function escapeChars$1(input) {
  3917. return input.replace(/[-\\^$*+?.()|[\]{}\/]/g, "\\$&");
  3918. };
  3919. /**
  3920. * check if the char is an already converted char from custom list
  3921. * @param {char} ch character to check
  3922. * @param {object} customReplacements custom translation map
  3923. */
  3924. var isReplacedCustomChar = function(ch, customReplacements) {
  3925. for (var c in customReplacements) if (customReplacements[c] === ch) return true;
  3926. };
  3927. if (typeof module !== "undefined" && module.exports) {
  3928. module.exports = getSlug;
  3929. module.exports.createSlug = createSlug;
  3930. } else if (typeof define !== "undefined" && define.amd) define([], function() {
  3931. return getSlug;
  3932. });
  3933. else try {
  3934. if (root.getSlug || root.createSlug) throw "speakingurl: globals exists /(getSlug|createSlug)/";
  3935. else {
  3936. root.getSlug = getSlug;
  3937. root.createSlug = createSlug;
  3938. }
  3939. } catch (e) {}
  3940. })(exports);
  3941. }) });
  3942. //#endregion
  3943. //#region ../../node_modules/.pnpm/speakingurl@14.0.1/node_modules/speakingurl/index.js
  3944. var require_speakingurl = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/speakingurl@14.0.1/node_modules/speakingurl/index.js": ((exports, module) => {
  3945. module.exports = require_speakingurl$1();
  3946. }) });
  3947. //#endregion
  3948. //#region src/core/app/index.ts
  3949. var import_speakingurl = /* @__PURE__ */ __toESM(require_speakingurl(), 1);
  3950. const appRecordInfo = target.__VUE_DEVTOOLS_NEXT_APP_RECORD_INFO__ ??= {
  3951. id: 0,
  3952. appIds: /* @__PURE__ */ new Set()
  3953. };
  3954. function getAppRecordName(app, fallbackName) {
  3955. return app?._component?.name || `App ${fallbackName}`;
  3956. }
  3957. function getAppRootInstance(app) {
  3958. if (app._instance) return app._instance;
  3959. else if (app._container?._vnode?.component) return app._container?._vnode?.component;
  3960. }
  3961. function removeAppRecordId(app) {
  3962. const id = app.__VUE_DEVTOOLS_NEXT_APP_RECORD_ID__;
  3963. if (id != null) {
  3964. appRecordInfo.appIds.delete(id);
  3965. appRecordInfo.id--;
  3966. }
  3967. }
  3968. function getAppRecordId(app, defaultId) {
  3969. if (app.__VUE_DEVTOOLS_NEXT_APP_RECORD_ID__ != null) return app.__VUE_DEVTOOLS_NEXT_APP_RECORD_ID__;
  3970. let id = defaultId ?? (appRecordInfo.id++).toString();
  3971. if (defaultId && appRecordInfo.appIds.has(id)) {
  3972. let count = 1;
  3973. while (appRecordInfo.appIds.has(`${defaultId}_${count}`)) count++;
  3974. id = `${defaultId}_${count}`;
  3975. }
  3976. appRecordInfo.appIds.add(id);
  3977. app.__VUE_DEVTOOLS_NEXT_APP_RECORD_ID__ = id;
  3978. return id;
  3979. }
  3980. function createAppRecord(app, types) {
  3981. const rootInstance = getAppRootInstance(app);
  3982. if (rootInstance) {
  3983. appRecordInfo.id++;
  3984. const name = getAppRecordName(app, appRecordInfo.id.toString());
  3985. const id = getAppRecordId(app, (0, import_speakingurl.default)(name));
  3986. const [el] = getRootElementsFromComponentInstance(rootInstance);
  3987. const record = {
  3988. id,
  3989. name,
  3990. types,
  3991. instanceMap: /* @__PURE__ */ new Map(),
  3992. perfGroupIds: /* @__PURE__ */ new Map(),
  3993. rootInstance,
  3994. iframe: isBrowser && document !== el?.ownerDocument ? el?.ownerDocument?.location?.pathname : void 0
  3995. };
  3996. app.__VUE_DEVTOOLS_NEXT_APP_RECORD__ = record;
  3997. const rootId = `${record.id}:root`;
  3998. record.instanceMap.set(rootId, record.rootInstance);
  3999. record.rootInstance.__VUE_DEVTOOLS_NEXT_UID__ = rootId;
  4000. return record;
  4001. } else return {};
  4002. }
  4003. //#endregion
  4004. //#region src/core/iframe/index.ts
  4005. function detectIframeApp(target$1, inIframe = false) {
  4006. if (inIframe) {
  4007. function sendEventToParent(cb) {
  4008. try {
  4009. const hook$2 = window.parent.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  4010. if (hook$2) cb(hook$2);
  4011. } catch (e) {}
  4012. }
  4013. const hook$1 = {
  4014. id: "vue-devtools-next",
  4015. devtoolsVersion: "7.0",
  4016. on: (event, cb) => {
  4017. sendEventToParent((hook$2) => {
  4018. hook$2.on(event, cb);
  4019. });
  4020. },
  4021. once: (event, cb) => {
  4022. sendEventToParent((hook$2) => {
  4023. hook$2.once(event, cb);
  4024. });
  4025. },
  4026. off: (event, cb) => {
  4027. sendEventToParent((hook$2) => {
  4028. hook$2.off(event, cb);
  4029. });
  4030. },
  4031. emit: (event, ...payload) => {
  4032. sendEventToParent((hook$2) => {
  4033. hook$2.emit(event, ...payload);
  4034. });
  4035. }
  4036. };
  4037. Object.defineProperty(target$1, "__VUE_DEVTOOLS_GLOBAL_HOOK__", {
  4038. get() {
  4039. return hook$1;
  4040. },
  4041. configurable: true
  4042. });
  4043. }
  4044. function injectVueHookToIframe(iframe) {
  4045. if (iframe.__vdevtools__injected) return;
  4046. try {
  4047. iframe.__vdevtools__injected = true;
  4048. const inject = () => {
  4049. try {
  4050. iframe.contentWindow.__VUE_DEVTOOLS_IFRAME__ = iframe;
  4051. const script = iframe.contentDocument.createElement("script");
  4052. script.textContent = `;(${detectIframeApp.toString()})(window, true)`;
  4053. iframe.contentDocument.documentElement.appendChild(script);
  4054. script.parentNode.removeChild(script);
  4055. } catch (e) {}
  4056. };
  4057. inject();
  4058. iframe.addEventListener("load", () => inject());
  4059. } catch (e) {}
  4060. }
  4061. function injectVueHookToIframes() {
  4062. if (typeof window === "undefined") return;
  4063. const iframes = Array.from(document.querySelectorAll("iframe:not([data-vue-devtools-ignore])"));
  4064. for (const iframe of iframes) injectVueHookToIframe(iframe);
  4065. }
  4066. injectVueHookToIframes();
  4067. let iframeAppChecks = 0;
  4068. const iframeAppCheckTimer = setInterval(() => {
  4069. injectVueHookToIframes();
  4070. iframeAppChecks++;
  4071. if (iframeAppChecks >= 5) clearInterval(iframeAppCheckTimer);
  4072. }, 1e3);
  4073. }
  4074. //#endregion
  4075. //#region src/core/index.ts
  4076. function initDevTools() {
  4077. detectIframeApp(target);
  4078. updateDevToolsState({ vitePluginDetected: getDevToolsEnv().vitePluginDetected });
  4079. const isDevToolsNext = target.__VUE_DEVTOOLS_GLOBAL_HOOK__?.id === "vue-devtools-next";
  4080. if (target.__VUE_DEVTOOLS_GLOBAL_HOOK__ && isDevToolsNext) return;
  4081. const _devtoolsHook = createDevToolsHook();
  4082. if (target.__VUE_DEVTOOLS_HOOK_REPLAY__) try {
  4083. target.__VUE_DEVTOOLS_HOOK_REPLAY__.forEach((cb) => cb(_devtoolsHook));
  4084. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = [];
  4085. } catch (e) {
  4086. console.error("[vue-devtools] Error during hook replay", e);
  4087. }
  4088. _devtoolsHook.once("init", (Vue) => {
  4089. target.__VUE_DEVTOOLS_VUE2_APP_DETECTED__ = true;
  4090. console.log("%c[_____Vue DevTools v7 log_____]", "color: red; font-bold: 600; font-size: 16px;");
  4091. console.log("%cVue DevTools v7 detected in your Vue2 project. v7 only supports Vue3 and will not work.", "font-bold: 500; font-size: 14px;");
  4092. const legacyChromeUrl = "https://chromewebstore.google.com/detail/vuejs-devtools/iaajmlceplecbljialhhkmedjlpdblhp";
  4093. const legacyFirefoxUrl = "https://addons.mozilla.org/firefox/addon/vue-js-devtools-v6-legacy";
  4094. console.log(`%cThe legacy version of chrome extension that supports both Vue 2 and Vue 3 has been moved to %c ${legacyChromeUrl}`, "font-size: 14px;", "text-decoration: underline; cursor: pointer;font-size: 14px;");
  4095. console.log(`%cThe legacy version of firefox extension that supports both Vue 2 and Vue 3 has been moved to %c ${legacyFirefoxUrl}`, "font-size: 14px;", "text-decoration: underline; cursor: pointer;font-size: 14px;");
  4096. console.log("%cPlease install and enable only the legacy version for your Vue2 app.", "font-bold: 500; font-size: 14px;");
  4097. console.log("%c[_____Vue DevTools v7 log_____]", "color: red; font-bold: 600; font-size: 16px;");
  4098. });
  4099. hook.on.setupDevtoolsPlugin((pluginDescriptor, setupFn) => {
  4100. addDevToolsPluginToBuffer(pluginDescriptor, setupFn);
  4101. const { app } = activeAppRecord ?? {};
  4102. if (pluginDescriptor.settings) initPluginSettings(pluginDescriptor.id, pluginDescriptor.settings);
  4103. if (!app) return;
  4104. callDevToolsPluginSetupFn([pluginDescriptor, setupFn], app);
  4105. });
  4106. onLegacyDevToolsPluginApiAvailable(() => {
  4107. devtoolsPluginBuffer.filter(([item]) => item.id !== "components").forEach(([pluginDescriptor, setupFn]) => {
  4108. _devtoolsHook.emit(DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, pluginDescriptor, setupFn, { target: "legacy" });
  4109. });
  4110. });
  4111. hook.on.vueAppInit(async (app, version, types) => {
  4112. const normalizedAppRecord = {
  4113. ...createAppRecord(app, types),
  4114. app,
  4115. version
  4116. };
  4117. addDevToolsAppRecord(normalizedAppRecord);
  4118. if (devtoolsAppRecords.value.length === 1) {
  4119. setActiveAppRecord(normalizedAppRecord);
  4120. setActiveAppRecordId(normalizedAppRecord.id);
  4121. normalizeRouterInfo(normalizedAppRecord, activeAppRecord);
  4122. registerDevToolsPlugin(normalizedAppRecord.app);
  4123. }
  4124. setupDevToolsPlugin(...createComponentsDevToolsPlugin(normalizedAppRecord.app));
  4125. updateDevToolsState({ connected: true });
  4126. _devtoolsHook.apps.push(app);
  4127. });
  4128. hook.on.vueAppUnmount(async (app) => {
  4129. const activeRecords = devtoolsAppRecords.value.filter((appRecord) => appRecord.app !== app);
  4130. if (activeRecords.length === 0) updateDevToolsState({ connected: false });
  4131. removeDevToolsAppRecord(app);
  4132. removeAppRecordId(app);
  4133. if (activeAppRecord.value.app === app) {
  4134. setActiveAppRecord(activeRecords[0]);
  4135. devtoolsContext.hooks.callHook(DevToolsMessagingHookKeys.SEND_ACTIVE_APP_UNMOUNTED_TO_CLIENT);
  4136. }
  4137. target.__VUE_DEVTOOLS_GLOBAL_HOOK__.apps.splice(target.__VUE_DEVTOOLS_GLOBAL_HOOK__.apps.indexOf(app), 1);
  4138. removeRegisteredPluginApp(app);
  4139. });
  4140. subscribeDevToolsHook(_devtoolsHook);
  4141. if (!target.__VUE_DEVTOOLS_GLOBAL_HOOK__) Object.defineProperty(target, "__VUE_DEVTOOLS_GLOBAL_HOOK__", {
  4142. get() {
  4143. return _devtoolsHook;
  4144. },
  4145. configurable: true
  4146. });
  4147. else if (!isNuxtApp) Object.assign(__VUE_DEVTOOLS_GLOBAL_HOOK__, _devtoolsHook);
  4148. }
  4149. function onDevToolsClientConnected(fn) {
  4150. return new Promise((resolve) => {
  4151. if (devtoolsState.connected && devtoolsState.clientConnected) {
  4152. fn();
  4153. resolve();
  4154. return;
  4155. }
  4156. devtoolsContext.hooks.hook(DevToolsMessagingHookKeys.DEVTOOLS_CONNECTED_UPDATED, ({ state }) => {
  4157. if (state.connected && state.clientConnected) {
  4158. fn();
  4159. resolve();
  4160. }
  4161. });
  4162. });
  4163. }
  4164. //#endregion
  4165. //#region src/core/high-perf-mode/index.ts
  4166. function toggleHighPerfMode(state) {
  4167. devtoolsState.highPerfModeEnabled = state ?? !devtoolsState.highPerfModeEnabled;
  4168. if (!state && activeAppRecord.value) registerDevToolsPlugin(activeAppRecord.value.app);
  4169. }
  4170. //#endregion
  4171. //#region src/core/component/state/reviver.ts
  4172. function reviveSet(val) {
  4173. const result = /* @__PURE__ */ new Set();
  4174. const list = val._custom.value;
  4175. for (let i = 0; i < list.length; i++) {
  4176. const value = list[i];
  4177. result.add(revive(value));
  4178. }
  4179. return result;
  4180. }
  4181. function reviveMap(val) {
  4182. const result = /* @__PURE__ */ new Map();
  4183. const list = val._custom.value;
  4184. for (let i = 0; i < list.length; i++) {
  4185. const { key, value } = list[i];
  4186. result.set(key, revive(value));
  4187. }
  4188. return result;
  4189. }
  4190. function revive(val) {
  4191. if (val === UNDEFINED) return;
  4192. else if (val === INFINITY) return Number.POSITIVE_INFINITY;
  4193. else if (val === NEGATIVE_INFINITY) return Number.NEGATIVE_INFINITY;
  4194. else if (val === NAN) return NaN;
  4195. else if (val && val._custom) {
  4196. const { _custom: custom } = val;
  4197. if (custom.type === "component") return activeAppRecord.value.instanceMap.get(custom.id);
  4198. else if (custom.type === "map") return reviveMap(val);
  4199. else if (custom.type === "set") return reviveSet(val);
  4200. else if (custom.type === "bigint") return BigInt(custom.value);
  4201. else return revive(custom.value);
  4202. } else if (symbolRE.test(val)) {
  4203. const [, string] = symbolRE.exec(val);
  4204. return Symbol.for(string);
  4205. } else if (specialTypeRE.test(val)) {
  4206. const [, type, string, , details] = specialTypeRE.exec(val);
  4207. const result = new target[type](string);
  4208. if (type === "Error" && details) result.stack = details;
  4209. return result;
  4210. } else return val;
  4211. }
  4212. function reviver(key, value) {
  4213. return revive(value);
  4214. }
  4215. //#endregion
  4216. //#region src/core/component/state/format.ts
  4217. function getInspectorStateValueType(value, raw = true) {
  4218. const type = typeof value;
  4219. if (value == null || value === UNDEFINED || value === "undefined") return "null";
  4220. else if (type === "boolean" || type === "number" || value === INFINITY || value === NEGATIVE_INFINITY || value === NAN) return "literal";
  4221. else if (value?._custom) if (raw || value._custom.display != null || value._custom.displayText != null) return "custom";
  4222. else return getInspectorStateValueType(value._custom.value);
  4223. else if (typeof value === "string") {
  4224. const typeMatch = specialTypeRE.exec(value);
  4225. if (typeMatch) {
  4226. const [, type$1] = typeMatch;
  4227. return `native ${type$1}`;
  4228. } else return "string";
  4229. } else if (Array.isArray(value) || value?._isArray) return "array";
  4230. else if (isPlainObject(value)) return "plain-object";
  4231. else return "unknown";
  4232. }
  4233. function formatInspectorStateValue(value, quotes = false, options) {
  4234. const { customClass } = options ?? {};
  4235. let result;
  4236. const type = getInspectorStateValueType(value, false);
  4237. if (type !== "custom" && value?._custom) value = value._custom.value;
  4238. if (result = internalStateTokenToString(value)) return result;
  4239. else if (type === "custom") return value._custom.value?._custom && formatInspectorStateValue(value._custom.value, quotes, options) || value._custom.displayText || value._custom.display;
  4240. else if (type === "array") return `Array[${value.length}]`;
  4241. else if (type === "plain-object") return `Object${Object.keys(value).length ? "" : " (empty)"}`;
  4242. else if (type?.includes("native")) return escape(specialTypeRE.exec(value)?.[2]);
  4243. else if (typeof value === "string") {
  4244. const typeMatch = value.match(rawTypeRE);
  4245. if (typeMatch) value = escapeString(typeMatch[1]);
  4246. else if (quotes) value = `<span>"</span>${customClass?.string ? `<span class=${customClass.string}>${escapeString(value)}</span>` : escapeString(value)}<span>"</span>`;
  4247. else value = customClass?.string ? `<span class="${customClass?.string ?? ""}">${escapeString(value)}</span>` : escapeString(value);
  4248. }
  4249. return value;
  4250. }
  4251. function escapeString(value) {
  4252. return escape(value).replace(/ /g, "&nbsp;").replace(/\n/g, "<span>\\n</span>");
  4253. }
  4254. function getRaw(value) {
  4255. let customType;
  4256. const isCustom = getInspectorStateValueType(value) === "custom";
  4257. let inherit = {};
  4258. if (isCustom) {
  4259. const data = value;
  4260. const customValue = data._custom?.value;
  4261. const currentCustomType = data._custom?.type;
  4262. const nestedCustom = typeof customValue === "object" && customValue !== null && "_custom" in customValue ? getRaw(customValue) : {
  4263. inherit: void 0,
  4264. value: void 0,
  4265. customType: void 0
  4266. };
  4267. inherit = nestedCustom.inherit || data._custom?.fields || {};
  4268. value = nestedCustom.value || customValue;
  4269. customType = nestedCustom.customType || currentCustomType;
  4270. }
  4271. if (value && value._isArray) value = value.items;
  4272. return {
  4273. value,
  4274. inherit,
  4275. customType
  4276. };
  4277. }
  4278. function toEdit(value, customType) {
  4279. if (customType === "bigint") return value;
  4280. if (customType === "date") return value;
  4281. return replaceTokenToString(JSON.stringify(value));
  4282. }
  4283. function toSubmit(value, customType) {
  4284. if (customType === "bigint") return BigInt(value);
  4285. if (customType === "date") return new Date(value);
  4286. return JSON.parse(replaceStringToToken(value), reviver);
  4287. }
  4288. //#endregion
  4289. //#region src/core/devtools-client/detected.ts
  4290. function updateDevToolsClientDetected(params) {
  4291. devtoolsState.devtoolsClientDetected = {
  4292. ...devtoolsState.devtoolsClientDetected,
  4293. ...params
  4294. };
  4295. const devtoolsClientVisible = Object.values(devtoolsState.devtoolsClientDetected).some(Boolean);
  4296. toggleHighPerfMode(!devtoolsClientVisible);
  4297. }
  4298. target.__VUE_DEVTOOLS_UPDATE_CLIENT_DETECTED__ ??= updateDevToolsClientDetected;
  4299. //#endregion
  4300. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/double-indexed-kv.js
  4301. var DoubleIndexedKV = class {
  4302. constructor() {
  4303. this.keyToValue = /* @__PURE__ */ new Map();
  4304. this.valueToKey = /* @__PURE__ */ new Map();
  4305. }
  4306. set(key, value) {
  4307. this.keyToValue.set(key, value);
  4308. this.valueToKey.set(value, key);
  4309. }
  4310. getByKey(key) {
  4311. return this.keyToValue.get(key);
  4312. }
  4313. getByValue(value) {
  4314. return this.valueToKey.get(value);
  4315. }
  4316. clear() {
  4317. this.keyToValue.clear();
  4318. this.valueToKey.clear();
  4319. }
  4320. };
  4321. //#endregion
  4322. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/registry.js
  4323. var Registry = class {
  4324. constructor(generateIdentifier) {
  4325. this.generateIdentifier = generateIdentifier;
  4326. this.kv = new DoubleIndexedKV();
  4327. }
  4328. register(value, identifier) {
  4329. if (this.kv.getByValue(value)) return;
  4330. if (!identifier) identifier = this.generateIdentifier(value);
  4331. this.kv.set(identifier, value);
  4332. }
  4333. clear() {
  4334. this.kv.clear();
  4335. }
  4336. getIdentifier(value) {
  4337. return this.kv.getByValue(value);
  4338. }
  4339. getValue(identifier) {
  4340. return this.kv.getByKey(identifier);
  4341. }
  4342. };
  4343. //#endregion
  4344. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/class-registry.js
  4345. var ClassRegistry = class extends Registry {
  4346. constructor() {
  4347. super((c) => c.name);
  4348. this.classToAllowedProps = /* @__PURE__ */ new Map();
  4349. }
  4350. register(value, options) {
  4351. if (typeof options === "object") {
  4352. if (options.allowProps) this.classToAllowedProps.set(value, options.allowProps);
  4353. super.register(value, options.identifier);
  4354. } else super.register(value, options);
  4355. }
  4356. getAllowedProps(value) {
  4357. return this.classToAllowedProps.get(value);
  4358. }
  4359. };
  4360. //#endregion
  4361. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/util.js
  4362. function valuesOfObj(record) {
  4363. if ("values" in Object) return Object.values(record);
  4364. const values = [];
  4365. for (const key in record) if (record.hasOwnProperty(key)) values.push(record[key]);
  4366. return values;
  4367. }
  4368. function find(record, predicate) {
  4369. const values = valuesOfObj(record);
  4370. if ("find" in values) return values.find(predicate);
  4371. const valuesNotNever = values;
  4372. for (let i = 0; i < valuesNotNever.length; i++) {
  4373. const value = valuesNotNever[i];
  4374. if (predicate(value)) return value;
  4375. }
  4376. }
  4377. function forEach(record, run) {
  4378. Object.entries(record).forEach(([key, value]) => run(value, key));
  4379. }
  4380. function includes(arr, value) {
  4381. return arr.indexOf(value) !== -1;
  4382. }
  4383. function findArr(record, predicate) {
  4384. for (let i = 0; i < record.length; i++) {
  4385. const value = record[i];
  4386. if (predicate(value)) return value;
  4387. }
  4388. }
  4389. //#endregion
  4390. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/custom-transformer-registry.js
  4391. var CustomTransformerRegistry = class {
  4392. constructor() {
  4393. this.transfomers = {};
  4394. }
  4395. register(transformer) {
  4396. this.transfomers[transformer.name] = transformer;
  4397. }
  4398. findApplicable(v) {
  4399. return find(this.transfomers, (transformer) => transformer.isApplicable(v));
  4400. }
  4401. findByName(name) {
  4402. return this.transfomers[name];
  4403. }
  4404. };
  4405. //#endregion
  4406. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/is.js
  4407. const getType$1 = (payload) => Object.prototype.toString.call(payload).slice(8, -1);
  4408. const isUndefined$1 = (payload) => typeof payload === "undefined";
  4409. const isNull$1 = (payload) => payload === null;
  4410. const isPlainObject$2 = (payload) => {
  4411. if (typeof payload !== "object" || payload === null) return false;
  4412. if (payload === Object.prototype) return false;
  4413. if (Object.getPrototypeOf(payload) === null) return true;
  4414. return Object.getPrototypeOf(payload) === Object.prototype;
  4415. };
  4416. const isEmptyObject = (payload) => isPlainObject$2(payload) && Object.keys(payload).length === 0;
  4417. const isArray$2 = (payload) => Array.isArray(payload);
  4418. const isString = (payload) => typeof payload === "string";
  4419. const isNumber = (payload) => typeof payload === "number" && !isNaN(payload);
  4420. const isBoolean = (payload) => typeof payload === "boolean";
  4421. const isRegExp = (payload) => payload instanceof RegExp;
  4422. const isMap = (payload) => payload instanceof Map;
  4423. const isSet = (payload) => payload instanceof Set;
  4424. const isSymbol = (payload) => getType$1(payload) === "Symbol";
  4425. const isDate = (payload) => payload instanceof Date && !isNaN(payload.valueOf());
  4426. const isError = (payload) => payload instanceof Error;
  4427. const isNaNValue = (payload) => typeof payload === "number" && isNaN(payload);
  4428. const isPrimitive = (payload) => isBoolean(payload) || isNull$1(payload) || isUndefined$1(payload) || isNumber(payload) || isString(payload) || isSymbol(payload);
  4429. const isBigint = (payload) => typeof payload === "bigint";
  4430. const isInfinite = (payload) => payload === Infinity || payload === -Infinity;
  4431. const isTypedArray = (payload) => ArrayBuffer.isView(payload) && !(payload instanceof DataView);
  4432. const isURL = (payload) => payload instanceof URL;
  4433. //#endregion
  4434. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/pathstringifier.js
  4435. const escapeKey = (key) => key.replace(/\./g, "\\.");
  4436. const stringifyPath = (path) => path.map(String).map(escapeKey).join(".");
  4437. const parsePath = (string) => {
  4438. const result = [];
  4439. let segment = "";
  4440. for (let i = 0; i < string.length; i++) {
  4441. let char = string.charAt(i);
  4442. if (char === "\\" && string.charAt(i + 1) === ".") {
  4443. segment += ".";
  4444. i++;
  4445. continue;
  4446. }
  4447. if (char === ".") {
  4448. result.push(segment);
  4449. segment = "";
  4450. continue;
  4451. }
  4452. segment += char;
  4453. }
  4454. const lastSegment = segment;
  4455. result.push(lastSegment);
  4456. return result;
  4457. };
  4458. //#endregion
  4459. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/transformer.js
  4460. function simpleTransformation(isApplicable, annotation, transform, untransform) {
  4461. return {
  4462. isApplicable,
  4463. annotation,
  4464. transform,
  4465. untransform
  4466. };
  4467. }
  4468. const simpleRules = [
  4469. simpleTransformation(isUndefined$1, "undefined", () => null, () => void 0),
  4470. simpleTransformation(isBigint, "bigint", (v) => v.toString(), (v) => {
  4471. if (typeof BigInt !== "undefined") return BigInt(v);
  4472. console.error("Please add a BigInt polyfill.");
  4473. return v;
  4474. }),
  4475. simpleTransformation(isDate, "Date", (v) => v.toISOString(), (v) => new Date(v)),
  4476. simpleTransformation(isError, "Error", (v, superJson) => {
  4477. const baseError = {
  4478. name: v.name,
  4479. message: v.message
  4480. };
  4481. superJson.allowedErrorProps.forEach((prop) => {
  4482. baseError[prop] = v[prop];
  4483. });
  4484. return baseError;
  4485. }, (v, superJson) => {
  4486. const e = new Error(v.message);
  4487. e.name = v.name;
  4488. e.stack = v.stack;
  4489. superJson.allowedErrorProps.forEach((prop) => {
  4490. e[prop] = v[prop];
  4491. });
  4492. return e;
  4493. }),
  4494. simpleTransformation(isRegExp, "regexp", (v) => "" + v, (regex) => {
  4495. const body = regex.slice(1, regex.lastIndexOf("/"));
  4496. const flags = regex.slice(regex.lastIndexOf("/") + 1);
  4497. return new RegExp(body, flags);
  4498. }),
  4499. simpleTransformation(isSet, "set", (v) => [...v.values()], (v) => new Set(v)),
  4500. simpleTransformation(isMap, "map", (v) => [...v.entries()], (v) => new Map(v)),
  4501. simpleTransformation((v) => isNaNValue(v) || isInfinite(v), "number", (v) => {
  4502. if (isNaNValue(v)) return "NaN";
  4503. if (v > 0) return "Infinity";
  4504. else return "-Infinity";
  4505. }, Number),
  4506. simpleTransformation((v) => v === 0 && 1 / v === -Infinity, "number", () => {
  4507. return "-0";
  4508. }, Number),
  4509. simpleTransformation(isURL, "URL", (v) => v.toString(), (v) => new URL(v))
  4510. ];
  4511. function compositeTransformation(isApplicable, annotation, transform, untransform) {
  4512. return {
  4513. isApplicable,
  4514. annotation,
  4515. transform,
  4516. untransform
  4517. };
  4518. }
  4519. const symbolRule = compositeTransformation((s, superJson) => {
  4520. if (isSymbol(s)) return !!superJson.symbolRegistry.getIdentifier(s);
  4521. return false;
  4522. }, (s, superJson) => {
  4523. return ["symbol", superJson.symbolRegistry.getIdentifier(s)];
  4524. }, (v) => v.description, (_, a, superJson) => {
  4525. const value = superJson.symbolRegistry.getValue(a[1]);
  4526. if (!value) throw new Error("Trying to deserialize unknown symbol");
  4527. return value;
  4528. });
  4529. const constructorToName = [
  4530. Int8Array,
  4531. Uint8Array,
  4532. Int16Array,
  4533. Uint16Array,
  4534. Int32Array,
  4535. Uint32Array,
  4536. Float32Array,
  4537. Float64Array,
  4538. Uint8ClampedArray
  4539. ].reduce((obj, ctor) => {
  4540. obj[ctor.name] = ctor;
  4541. return obj;
  4542. }, {});
  4543. const typedArrayRule = compositeTransformation(isTypedArray, (v) => ["typed-array", v.constructor.name], (v) => [...v], (v, a) => {
  4544. const ctor = constructorToName[a[1]];
  4545. if (!ctor) throw new Error("Trying to deserialize unknown typed array");
  4546. return new ctor(v);
  4547. });
  4548. function isInstanceOfRegisteredClass(potentialClass, superJson) {
  4549. if (potentialClass?.constructor) return !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
  4550. return false;
  4551. }
  4552. const classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, superJson) => {
  4553. return ["class", superJson.classRegistry.getIdentifier(clazz.constructor)];
  4554. }, (clazz, superJson) => {
  4555. const allowedProps = superJson.classRegistry.getAllowedProps(clazz.constructor);
  4556. if (!allowedProps) return { ...clazz };
  4557. const result = {};
  4558. allowedProps.forEach((prop) => {
  4559. result[prop] = clazz[prop];
  4560. });
  4561. return result;
  4562. }, (v, a, superJson) => {
  4563. const clazz = superJson.classRegistry.getValue(a[1]);
  4564. if (!clazz) throw new Error(`Trying to deserialize unknown class '${a[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
  4565. return Object.assign(Object.create(clazz.prototype), v);
  4566. });
  4567. const customRule = compositeTransformation((value, superJson) => {
  4568. return !!superJson.customTransformerRegistry.findApplicable(value);
  4569. }, (value, superJson) => {
  4570. return ["custom", superJson.customTransformerRegistry.findApplicable(value).name];
  4571. }, (value, superJson) => {
  4572. return superJson.customTransformerRegistry.findApplicable(value).serialize(value);
  4573. }, (v, a, superJson) => {
  4574. const transformer = superJson.customTransformerRegistry.findByName(a[1]);
  4575. if (!transformer) throw new Error("Trying to deserialize unknown custom value");
  4576. return transformer.deserialize(v);
  4577. });
  4578. const compositeRules = [
  4579. classRule,
  4580. symbolRule,
  4581. customRule,
  4582. typedArrayRule
  4583. ];
  4584. const transformValue = (value, superJson) => {
  4585. const applicableCompositeRule = findArr(compositeRules, (rule) => rule.isApplicable(value, superJson));
  4586. if (applicableCompositeRule) return {
  4587. value: applicableCompositeRule.transform(value, superJson),
  4588. type: applicableCompositeRule.annotation(value, superJson)
  4589. };
  4590. const applicableSimpleRule = findArr(simpleRules, (rule) => rule.isApplicable(value, superJson));
  4591. if (applicableSimpleRule) return {
  4592. value: applicableSimpleRule.transform(value, superJson),
  4593. type: applicableSimpleRule.annotation
  4594. };
  4595. };
  4596. const simpleRulesByAnnotation = {};
  4597. simpleRules.forEach((rule) => {
  4598. simpleRulesByAnnotation[rule.annotation] = rule;
  4599. });
  4600. const untransformValue = (json, type, superJson) => {
  4601. if (isArray$2(type)) switch (type[0]) {
  4602. case "symbol": return symbolRule.untransform(json, type, superJson);
  4603. case "class": return classRule.untransform(json, type, superJson);
  4604. case "custom": return customRule.untransform(json, type, superJson);
  4605. case "typed-array": return typedArrayRule.untransform(json, type, superJson);
  4606. default: throw new Error("Unknown transformation: " + type);
  4607. }
  4608. else {
  4609. const transformation = simpleRulesByAnnotation[type];
  4610. if (!transformation) throw new Error("Unknown transformation: " + type);
  4611. return transformation.untransform(json, superJson);
  4612. }
  4613. };
  4614. //#endregion
  4615. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/accessDeep.js
  4616. const getNthKey = (value, n) => {
  4617. if (n > value.size) throw new Error("index out of bounds");
  4618. const keys = value.keys();
  4619. while (n > 0) {
  4620. keys.next();
  4621. n--;
  4622. }
  4623. return keys.next().value;
  4624. };
  4625. function validatePath(path) {
  4626. if (includes(path, "__proto__")) throw new Error("__proto__ is not allowed as a property");
  4627. if (includes(path, "prototype")) throw new Error("prototype is not allowed as a property");
  4628. if (includes(path, "constructor")) throw new Error("constructor is not allowed as a property");
  4629. }
  4630. const getDeep = (object, path) => {
  4631. validatePath(path);
  4632. for (let i = 0; i < path.length; i++) {
  4633. const key = path[i];
  4634. if (isSet(object)) object = getNthKey(object, +key);
  4635. else if (isMap(object)) {
  4636. const row = +key;
  4637. const type = +path[++i] === 0 ? "key" : "value";
  4638. const keyOfRow = getNthKey(object, row);
  4639. switch (type) {
  4640. case "key":
  4641. object = keyOfRow;
  4642. break;
  4643. case "value":
  4644. object = object.get(keyOfRow);
  4645. break;
  4646. }
  4647. } else object = object[key];
  4648. }
  4649. return object;
  4650. };
  4651. const setDeep = (object, path, mapper) => {
  4652. validatePath(path);
  4653. if (path.length === 0) return mapper(object);
  4654. let parent = object;
  4655. for (let i = 0; i < path.length - 1; i++) {
  4656. const key = path[i];
  4657. if (isArray$2(parent)) {
  4658. const index = +key;
  4659. parent = parent[index];
  4660. } else if (isPlainObject$2(parent)) parent = parent[key];
  4661. else if (isSet(parent)) {
  4662. const row = +key;
  4663. parent = getNthKey(parent, row);
  4664. } else if (isMap(parent)) {
  4665. if (i === path.length - 2) break;
  4666. const row = +key;
  4667. const type = +path[++i] === 0 ? "key" : "value";
  4668. const keyOfRow = getNthKey(parent, row);
  4669. switch (type) {
  4670. case "key":
  4671. parent = keyOfRow;
  4672. break;
  4673. case "value":
  4674. parent = parent.get(keyOfRow);
  4675. break;
  4676. }
  4677. }
  4678. }
  4679. const lastKey = path[path.length - 1];
  4680. if (isArray$2(parent)) parent[+lastKey] = mapper(parent[+lastKey]);
  4681. else if (isPlainObject$2(parent)) parent[lastKey] = mapper(parent[lastKey]);
  4682. if (isSet(parent)) {
  4683. const oldValue = getNthKey(parent, +lastKey);
  4684. const newValue = mapper(oldValue);
  4685. if (oldValue !== newValue) {
  4686. parent.delete(oldValue);
  4687. parent.add(newValue);
  4688. }
  4689. }
  4690. if (isMap(parent)) {
  4691. const row = +path[path.length - 2];
  4692. const keyToRow = getNthKey(parent, row);
  4693. switch (+lastKey === 0 ? "key" : "value") {
  4694. case "key": {
  4695. const newKey = mapper(keyToRow);
  4696. parent.set(newKey, parent.get(keyToRow));
  4697. if (newKey !== keyToRow) parent.delete(keyToRow);
  4698. break;
  4699. }
  4700. case "value":
  4701. parent.set(keyToRow, mapper(parent.get(keyToRow)));
  4702. break;
  4703. }
  4704. }
  4705. return object;
  4706. };
  4707. //#endregion
  4708. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/plainer.js
  4709. function traverse(tree, walker$1, origin = []) {
  4710. if (!tree) return;
  4711. if (!isArray$2(tree)) {
  4712. forEach(tree, (subtree, key) => traverse(subtree, walker$1, [...origin, ...parsePath(key)]));
  4713. return;
  4714. }
  4715. const [nodeValue, children] = tree;
  4716. if (children) forEach(children, (child, key) => {
  4717. traverse(child, walker$1, [...origin, ...parsePath(key)]);
  4718. });
  4719. walker$1(nodeValue, origin);
  4720. }
  4721. function applyValueAnnotations(plain, annotations, superJson) {
  4722. traverse(annotations, (type, path) => {
  4723. plain = setDeep(plain, path, (v) => untransformValue(v, type, superJson));
  4724. });
  4725. return plain;
  4726. }
  4727. function applyReferentialEqualityAnnotations(plain, annotations) {
  4728. function apply(identicalPaths, path) {
  4729. const object = getDeep(plain, parsePath(path));
  4730. identicalPaths.map(parsePath).forEach((identicalObjectPath) => {
  4731. plain = setDeep(plain, identicalObjectPath, () => object);
  4732. });
  4733. }
  4734. if (isArray$2(annotations)) {
  4735. const [root, other] = annotations;
  4736. root.forEach((identicalPath) => {
  4737. plain = setDeep(plain, parsePath(identicalPath), () => plain);
  4738. });
  4739. if (other) forEach(other, apply);
  4740. } else forEach(annotations, apply);
  4741. return plain;
  4742. }
  4743. const isDeep = (object, superJson) => isPlainObject$2(object) || isArray$2(object) || isMap(object) || isSet(object) || isInstanceOfRegisteredClass(object, superJson);
  4744. function addIdentity(object, path, identities) {
  4745. const existingSet = identities.get(object);
  4746. if (existingSet) existingSet.push(path);
  4747. else identities.set(object, [path]);
  4748. }
  4749. function generateReferentialEqualityAnnotations(identitites, dedupe) {
  4750. const result = {};
  4751. let rootEqualityPaths = void 0;
  4752. identitites.forEach((paths) => {
  4753. if (paths.length <= 1) return;
  4754. if (!dedupe) paths = paths.map((path) => path.map(String)).sort((a, b) => a.length - b.length);
  4755. const [representativePath, ...identicalPaths] = paths;
  4756. if (representativePath.length === 0) rootEqualityPaths = identicalPaths.map(stringifyPath);
  4757. else result[stringifyPath(representativePath)] = identicalPaths.map(stringifyPath);
  4758. });
  4759. if (rootEqualityPaths) if (isEmptyObject(result)) return [rootEqualityPaths];
  4760. else return [rootEqualityPaths, result];
  4761. else return isEmptyObject(result) ? void 0 : result;
  4762. }
  4763. const walker = (object, identities, superJson, dedupe, path = [], objectsInThisPath = [], seenObjects = /* @__PURE__ */ new Map()) => {
  4764. const primitive = isPrimitive(object);
  4765. if (!primitive) {
  4766. addIdentity(object, path, identities);
  4767. const seen = seenObjects.get(object);
  4768. if (seen) return dedupe ? { transformedValue: null } : seen;
  4769. }
  4770. if (!isDeep(object, superJson)) {
  4771. const transformed$1 = transformValue(object, superJson);
  4772. const result$1 = transformed$1 ? {
  4773. transformedValue: transformed$1.value,
  4774. annotations: [transformed$1.type]
  4775. } : { transformedValue: object };
  4776. if (!primitive) seenObjects.set(object, result$1);
  4777. return result$1;
  4778. }
  4779. if (includes(objectsInThisPath, object)) return { transformedValue: null };
  4780. const transformationResult = transformValue(object, superJson);
  4781. const transformed = transformationResult?.value ?? object;
  4782. const transformedValue = isArray$2(transformed) ? [] : {};
  4783. const innerAnnotations = {};
  4784. forEach(transformed, (value, index) => {
  4785. if (index === "__proto__" || index === "constructor" || index === "prototype") throw new Error(`Detected property ${index}. This is a prototype pollution risk, please remove it from your object.`);
  4786. const recursiveResult = walker(value, identities, superJson, dedupe, [...path, index], [...objectsInThisPath, object], seenObjects);
  4787. transformedValue[index] = recursiveResult.transformedValue;
  4788. if (isArray$2(recursiveResult.annotations)) innerAnnotations[index] = recursiveResult.annotations;
  4789. else if (isPlainObject$2(recursiveResult.annotations)) forEach(recursiveResult.annotations, (tree, key) => {
  4790. innerAnnotations[escapeKey(index) + "." + key] = tree;
  4791. });
  4792. });
  4793. const result = isEmptyObject(innerAnnotations) ? {
  4794. transformedValue,
  4795. annotations: !!transformationResult ? [transformationResult.type] : void 0
  4796. } : {
  4797. transformedValue,
  4798. annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
  4799. };
  4800. if (!primitive) seenObjects.set(object, result);
  4801. return result;
  4802. };
  4803. //#endregion
  4804. //#region ../../node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.js
  4805. function getType(payload) {
  4806. return Object.prototype.toString.call(payload).slice(8, -1);
  4807. }
  4808. function isArray$1(payload) {
  4809. return getType(payload) === "Array";
  4810. }
  4811. function isPlainObject$1(payload) {
  4812. if (getType(payload) !== "Object") return false;
  4813. const prototype = Object.getPrototypeOf(payload);
  4814. return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
  4815. }
  4816. function isNull(payload) {
  4817. return getType(payload) === "Null";
  4818. }
  4819. function isOneOf(a, b, c, d, e) {
  4820. return (value) => a(value) || b(value) || !!c && c(value) || !!d && d(value) || !!e && e(value);
  4821. }
  4822. function isUndefined(payload) {
  4823. return getType(payload) === "Undefined";
  4824. }
  4825. const isNullOrUndefined = isOneOf(isNull, isUndefined);
  4826. //#endregion
  4827. //#region ../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
  4828. function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
  4829. const propType = {}.propertyIsEnumerable.call(originalObject, key) ? "enumerable" : "nonenumerable";
  4830. if (propType === "enumerable") carry[key] = newVal;
  4831. if (includeNonenumerable && propType === "nonenumerable") Object.defineProperty(carry, key, {
  4832. value: newVal,
  4833. enumerable: false,
  4834. writable: true,
  4835. configurable: true
  4836. });
  4837. }
  4838. function copy(target$1, options = {}) {
  4839. if (isArray$1(target$1)) return target$1.map((item) => copy(item, options));
  4840. if (!isPlainObject$1(target$1)) return target$1;
  4841. const props = Object.getOwnPropertyNames(target$1);
  4842. const symbols = Object.getOwnPropertySymbols(target$1);
  4843. return [...props, ...symbols].reduce((carry, key) => {
  4844. if (isArray$1(options.props) && !options.props.includes(key)) return carry;
  4845. const val = target$1[key];
  4846. const newVal = copy(val, options);
  4847. assignProp(carry, key, newVal, target$1, options.nonenumerable);
  4848. return carry;
  4849. }, {});
  4850. }
  4851. //#endregion
  4852. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.js
  4853. var SuperJSON = class {
  4854. /**
  4855. * @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
  4856. */
  4857. constructor({ dedupe = false } = {}) {
  4858. this.classRegistry = new ClassRegistry();
  4859. this.symbolRegistry = new Registry((s) => s.description ?? "");
  4860. this.customTransformerRegistry = new CustomTransformerRegistry();
  4861. this.allowedErrorProps = [];
  4862. this.dedupe = dedupe;
  4863. }
  4864. serialize(object) {
  4865. const identities = /* @__PURE__ */ new Map();
  4866. const output = walker(object, identities, this, this.dedupe);
  4867. const res = { json: output.transformedValue };
  4868. if (output.annotations) res.meta = {
  4869. ...res.meta,
  4870. values: output.annotations
  4871. };
  4872. const equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
  4873. if (equalityAnnotations) res.meta = {
  4874. ...res.meta,
  4875. referentialEqualities: equalityAnnotations
  4876. };
  4877. return res;
  4878. }
  4879. deserialize(payload) {
  4880. const { json, meta } = payload;
  4881. let result = copy(json);
  4882. if (meta?.values) result = applyValueAnnotations(result, meta.values, this);
  4883. if (meta?.referentialEqualities) result = applyReferentialEqualityAnnotations(result, meta.referentialEqualities);
  4884. return result;
  4885. }
  4886. stringify(object) {
  4887. return JSON.stringify(this.serialize(object));
  4888. }
  4889. parse(string) {
  4890. return this.deserialize(JSON.parse(string));
  4891. }
  4892. registerClass(v, options) {
  4893. this.classRegistry.register(v, options);
  4894. }
  4895. registerSymbol(v, identifier) {
  4896. this.symbolRegistry.register(v, identifier);
  4897. }
  4898. registerCustom(transformer, name) {
  4899. this.customTransformerRegistry.register({
  4900. name,
  4901. ...transformer
  4902. });
  4903. }
  4904. allowErrorProps(...props) {
  4905. this.allowedErrorProps.push(...props);
  4906. }
  4907. };
  4908. SuperJSON.defaultInstance = new SuperJSON();
  4909. SuperJSON.serialize = SuperJSON.defaultInstance.serialize.bind(SuperJSON.defaultInstance);
  4910. SuperJSON.deserialize = SuperJSON.defaultInstance.deserialize.bind(SuperJSON.defaultInstance);
  4911. SuperJSON.stringify = SuperJSON.defaultInstance.stringify.bind(SuperJSON.defaultInstance);
  4912. SuperJSON.parse = SuperJSON.defaultInstance.parse.bind(SuperJSON.defaultInstance);
  4913. SuperJSON.registerClass = SuperJSON.defaultInstance.registerClass.bind(SuperJSON.defaultInstance);
  4914. SuperJSON.registerSymbol = SuperJSON.defaultInstance.registerSymbol.bind(SuperJSON.defaultInstance);
  4915. SuperJSON.registerCustom = SuperJSON.defaultInstance.registerCustom.bind(SuperJSON.defaultInstance);
  4916. SuperJSON.allowErrorProps = SuperJSON.defaultInstance.allowErrorProps.bind(SuperJSON.defaultInstance);
  4917. const serialize = SuperJSON.serialize;
  4918. const deserialize = SuperJSON.deserialize;
  4919. const stringify$1 = SuperJSON.stringify;
  4920. const parse$1 = SuperJSON.parse;
  4921. const registerClass = SuperJSON.registerClass;
  4922. const registerCustom = SuperJSON.registerCustom;
  4923. const registerSymbol = SuperJSON.registerSymbol;
  4924. const allowErrorProps = SuperJSON.allowErrorProps;
  4925. //#endregion
  4926. //#region src/messaging/presets/broadcast-channel/context.ts
  4927. const __DEVTOOLS_KIT_BROADCAST_MESSAGING_EVENT_KEY = "__devtools-kit-broadcast-messaging-event-key__";
  4928. //#endregion
  4929. //#region src/messaging/presets/broadcast-channel/index.ts
  4930. const BROADCAST_CHANNEL_NAME = "__devtools-kit:broadcast-channel__";
  4931. function createBroadcastChannel() {
  4932. const channel = new BroadcastChannel(BROADCAST_CHANNEL_NAME);
  4933. return {
  4934. post: (data) => {
  4935. channel.postMessage(SuperJSON.stringify({
  4936. event: __DEVTOOLS_KIT_BROADCAST_MESSAGING_EVENT_KEY,
  4937. data
  4938. }));
  4939. },
  4940. on: (handler) => {
  4941. channel.onmessage = (event) => {
  4942. const parsed = SuperJSON.parse(event.data);
  4943. if (parsed.event === __DEVTOOLS_KIT_BROADCAST_MESSAGING_EVENT_KEY) handler(parsed.data);
  4944. };
  4945. }
  4946. };
  4947. }
  4948. //#endregion
  4949. //#region src/messaging/presets/electron/context.ts
  4950. const __ELECTRON_CLIENT_CONTEXT__ = "electron:client-context";
  4951. const __ELECTRON_RPOXY_CONTEXT__ = "electron:proxy-context";
  4952. const __ELECTRON_SERVER_CONTEXT__ = "electron:server-context";
  4953. const __DEVTOOLS_KIT_ELECTRON_MESSAGING_EVENT_KEY__ = {
  4954. CLIENT_TO_PROXY: "client->proxy",
  4955. PROXY_TO_CLIENT: "proxy->client",
  4956. PROXY_TO_SERVER: "proxy->server",
  4957. SERVER_TO_PROXY: "server->proxy"
  4958. };
  4959. function getElectronClientContext() {
  4960. return target[__ELECTRON_CLIENT_CONTEXT__];
  4961. }
  4962. function setElectronClientContext(context) {
  4963. target[__ELECTRON_CLIENT_CONTEXT__] = context;
  4964. }
  4965. function getElectronProxyContext() {
  4966. return target[__ELECTRON_RPOXY_CONTEXT__];
  4967. }
  4968. function setElectronProxyContext(context) {
  4969. target[__ELECTRON_RPOXY_CONTEXT__] = context;
  4970. }
  4971. function getElectronServerContext() {
  4972. return target[__ELECTRON_SERVER_CONTEXT__];
  4973. }
  4974. function setElectronServerContext(context) {
  4975. target[__ELECTRON_SERVER_CONTEXT__] = context;
  4976. }
  4977. //#endregion
  4978. //#region src/messaging/presets/electron/client.ts
  4979. function createElectronClientChannel() {
  4980. const socket = getElectronClientContext();
  4981. return {
  4982. post: (data) => {
  4983. socket.emit(__DEVTOOLS_KIT_ELECTRON_MESSAGING_EVENT_KEY__.CLIENT_TO_PROXY, SuperJSON.stringify(data));
  4984. },
  4985. on: (handler) => {
  4986. socket.on(__DEVTOOLS_KIT_ELECTRON_MESSAGING_EVENT_KEY__.PROXY_TO_CLIENT, (e) => {
  4987. handler(SuperJSON.parse(e));
  4988. });
  4989. }
  4990. };
  4991. }
  4992. //#endregion
  4993. //#region src/messaging/presets/electron/proxy.ts
  4994. function createElectronProxyChannel() {
  4995. const socket = getElectronProxyContext();
  4996. return {
  4997. post: (data) => {},
  4998. on: (handler) => {
  4999. socket.on(__DEVTOOLS_KIT_ELECTRON_MESSAGING_EVENT_KEY__.SERVER_TO_PROXY, (data) => {
  5000. socket.broadcast.emit(__DEVTOOLS_KIT_ELECTRON_MESSAGING_EVENT_KEY__.PROXY_TO_CLIENT, data);
  5001. });
  5002. socket.on(__DEVTOOLS_KIT_ELECTRON_MESSAGING_EVENT_KEY__.CLIENT_TO_PROXY, (data) => {
  5003. socket.broadcast.emit(__DEVTOOLS_KIT_ELECTRON_MESSAGING_EVENT_KEY__.PROXY_TO_SERVER, data);
  5004. });
  5005. }
  5006. };
  5007. }
  5008. //#endregion
  5009. //#region src/messaging/presets/electron/server.ts
  5010. function createElectronServerChannel() {
  5011. const socket = getElectronServerContext();
  5012. return {
  5013. post: (data) => {
  5014. socket.emit(__DEVTOOLS_KIT_ELECTRON_MESSAGING_EVENT_KEY__.SERVER_TO_PROXY, SuperJSON.stringify(data));
  5015. },
  5016. on: (handler) => {
  5017. socket.on(__DEVTOOLS_KIT_ELECTRON_MESSAGING_EVENT_KEY__.PROXY_TO_SERVER, (data) => {
  5018. handler(SuperJSON.parse(data));
  5019. });
  5020. }
  5021. };
  5022. }
  5023. //#endregion
  5024. //#region src/messaging/presets/extension/context.ts
  5025. const __EXTENSION_CLIENT_CONTEXT__ = "electron:client-context";
  5026. const __DEVTOOLS_KIT_EXTENSION_MESSAGING_EVENT_KEY__ = {
  5027. CLIENT_TO_PROXY: "client->proxy",
  5028. PROXY_TO_CLIENT: "proxy->client",
  5029. PROXY_TO_SERVER: "proxy->server",
  5030. SERVER_TO_PROXY: "server->proxy"
  5031. };
  5032. function getExtensionClientContext() {
  5033. return target[__EXTENSION_CLIENT_CONTEXT__];
  5034. }
  5035. function setExtensionClientContext(context) {
  5036. target[__EXTENSION_CLIENT_CONTEXT__] = context;
  5037. }
  5038. //#endregion
  5039. //#region src/messaging/presets/extension/client.ts
  5040. function createExtensionClientChannel() {
  5041. let disconnected = false;
  5042. let port = null;
  5043. let reconnectTimer = null;
  5044. let onMessageHandler = null;
  5045. function connect() {
  5046. try {
  5047. clearTimeout(reconnectTimer);
  5048. port = chrome.runtime.connect({ name: `${chrome.devtools.inspectedWindow.tabId}` });
  5049. setExtensionClientContext(port);
  5050. disconnected = false;
  5051. port?.onMessage.addListener(onMessageHandler);
  5052. port.onDisconnect.addListener(() => {
  5053. disconnected = true;
  5054. port?.onMessage.removeListener(onMessageHandler);
  5055. reconnectTimer = setTimeout(connect, 1e3);
  5056. });
  5057. } catch (e) {
  5058. disconnected = true;
  5059. }
  5060. }
  5061. connect();
  5062. return {
  5063. post: (data) => {
  5064. if (disconnected) return;
  5065. port?.postMessage(SuperJSON.stringify(data));
  5066. },
  5067. on: (handler) => {
  5068. onMessageHandler = (data) => {
  5069. if (disconnected) return;
  5070. handler(SuperJSON.parse(data));
  5071. };
  5072. port?.onMessage.addListener(onMessageHandler);
  5073. }
  5074. };
  5075. }
  5076. //#endregion
  5077. //#region src/messaging/presets/extension/proxy.ts
  5078. function createExtensionProxyChannel() {
  5079. const port = chrome.runtime.connect({ name: "content-script" });
  5080. function sendMessageToUserApp(payload) {
  5081. window.postMessage({
  5082. source: __DEVTOOLS_KIT_EXTENSION_MESSAGING_EVENT_KEY__.PROXY_TO_SERVER,
  5083. payload
  5084. }, "*");
  5085. }
  5086. function sendMessageToDevToolsClient(e) {
  5087. if (e.data && e.data.source === __DEVTOOLS_KIT_EXTENSION_MESSAGING_EVENT_KEY__.SERVER_TO_PROXY) try {
  5088. port.postMessage(e.data.payload);
  5089. } catch (e$1) {}
  5090. }
  5091. port.onMessage.addListener(sendMessageToUserApp);
  5092. window.addEventListener("message", sendMessageToDevToolsClient);
  5093. port.onDisconnect.addListener(() => {
  5094. window.removeEventListener("message", sendMessageToDevToolsClient);
  5095. sendMessageToUserApp(SuperJSON.stringify({ event: "shutdown" }));
  5096. });
  5097. sendMessageToUserApp(SuperJSON.stringify({ event: "init" }));
  5098. return {
  5099. post: (data) => {},
  5100. on: (handler) => {}
  5101. };
  5102. }
  5103. //#endregion
  5104. //#region src/messaging/presets/extension/server.ts
  5105. function createExtensionServerChannel() {
  5106. return {
  5107. post: (data) => {
  5108. window.postMessage({
  5109. source: __DEVTOOLS_KIT_EXTENSION_MESSAGING_EVENT_KEY__.SERVER_TO_PROXY,
  5110. payload: SuperJSON.stringify(data)
  5111. }, "*");
  5112. },
  5113. on: (handler) => {
  5114. const listener = (event) => {
  5115. if (event.data.source === __DEVTOOLS_KIT_EXTENSION_MESSAGING_EVENT_KEY__.PROXY_TO_SERVER && event.data.payload) handler(SuperJSON.parse(event.data.payload));
  5116. };
  5117. window.addEventListener("message", listener);
  5118. return () => {
  5119. window.removeEventListener("message", listener);
  5120. };
  5121. }
  5122. };
  5123. }
  5124. //#endregion
  5125. //#region src/messaging/presets/iframe/context.ts
  5126. const __DEVTOOLS_KIT_IFRAME_MESSAGING_EVENT_KEY = "__devtools-kit-iframe-messaging-event-key__";
  5127. const __IFRAME_SERVER_CONTEXT__ = "iframe:server-context";
  5128. function getIframeServerContext() {
  5129. return target[__IFRAME_SERVER_CONTEXT__];
  5130. }
  5131. function setIframeServerContext(context) {
  5132. target[__IFRAME_SERVER_CONTEXT__] = context;
  5133. }
  5134. //#endregion
  5135. //#region src/messaging/presets/iframe/client.ts
  5136. function createIframeClientChannel() {
  5137. if (!isBrowser) return {
  5138. post: (data) => {},
  5139. on: (handler) => {}
  5140. };
  5141. return {
  5142. post: (data) => window.parent.postMessage(SuperJSON.stringify({
  5143. event: __DEVTOOLS_KIT_IFRAME_MESSAGING_EVENT_KEY,
  5144. data
  5145. }), "*"),
  5146. on: (handler) => window.addEventListener("message", (event) => {
  5147. try {
  5148. const parsed = SuperJSON.parse(event.data);
  5149. if (event.source === window.parent && parsed.event === __DEVTOOLS_KIT_IFRAME_MESSAGING_EVENT_KEY) handler(parsed.data);
  5150. } catch (e) {}
  5151. })
  5152. };
  5153. }
  5154. //#endregion
  5155. //#region src/messaging/presets/iframe/server.ts
  5156. function createIframeServerChannel() {
  5157. if (!isBrowser) return {
  5158. post: (data) => {},
  5159. on: (handler) => {}
  5160. };
  5161. return {
  5162. post: (data) => {
  5163. getIframeServerContext()?.contentWindow?.postMessage(SuperJSON.stringify({
  5164. event: __DEVTOOLS_KIT_IFRAME_MESSAGING_EVENT_KEY,
  5165. data
  5166. }), "*");
  5167. },
  5168. on: (handler) => {
  5169. window.addEventListener("message", (event) => {
  5170. const iframe = getIframeServerContext();
  5171. try {
  5172. const parsed = SuperJSON.parse(event.data);
  5173. if (event.source === iframe?.contentWindow && parsed.event === __DEVTOOLS_KIT_IFRAME_MESSAGING_EVENT_KEY) handler(parsed.data);
  5174. } catch (e) {}
  5175. });
  5176. }
  5177. };
  5178. }
  5179. //#endregion
  5180. //#region src/messaging/presets/vite/context.ts
  5181. const __DEVTOOLS_KIT_VITE_MESSAGING_EVENT_KEY = "__devtools-kit-vite-messaging-event-key__";
  5182. const __VITE_CLIENT_CONTEXT__ = "vite:client-context";
  5183. const __VITE_SERVER_CONTEXT__ = "vite:server-context";
  5184. function getViteClientContext() {
  5185. return target[__VITE_CLIENT_CONTEXT__];
  5186. }
  5187. function setViteClientContext(context) {
  5188. target[__VITE_CLIENT_CONTEXT__] = context;
  5189. }
  5190. function getViteServerContext() {
  5191. return target[__VITE_SERVER_CONTEXT__];
  5192. }
  5193. function setViteServerContext(context) {
  5194. target[__VITE_SERVER_CONTEXT__] = context;
  5195. }
  5196. //#endregion
  5197. //#region src/messaging/presets/vite/client.ts
  5198. function createViteClientChannel() {
  5199. const client = getViteClientContext();
  5200. return {
  5201. post: (data) => {
  5202. client?.send(__DEVTOOLS_KIT_VITE_MESSAGING_EVENT_KEY, SuperJSON.stringify(data));
  5203. },
  5204. on: (handler) => {
  5205. client?.on(__DEVTOOLS_KIT_VITE_MESSAGING_EVENT_KEY, (event) => {
  5206. handler(SuperJSON.parse(event));
  5207. });
  5208. }
  5209. };
  5210. }
  5211. //#endregion
  5212. //#region src/messaging/presets/vite/server.ts
  5213. function createViteServerChannel() {
  5214. const viteServer = getViteServerContext();
  5215. const ws = viteServer.hot ?? viteServer.ws;
  5216. return {
  5217. post: (data) => ws?.send(__DEVTOOLS_KIT_VITE_MESSAGING_EVENT_KEY, SuperJSON.stringify(data)),
  5218. on: (handler) => ws?.on(__DEVTOOLS_KIT_VITE_MESSAGING_EVENT_KEY, (event) => {
  5219. handler(SuperJSON.parse(event));
  5220. })
  5221. };
  5222. }
  5223. //#endregion
  5224. //#region src/messaging/index.ts
  5225. target.__VUE_DEVTOOLS_KIT_MESSAGE_CHANNELS__ ??= [];
  5226. target.__VUE_DEVTOOLS_KIT_RPC_CLIENT__ ??= null;
  5227. target.__VUE_DEVTOOLS_KIT_RPC_SERVER__ ??= null;
  5228. target.__VUE_DEVTOOLS_KIT_VITE_RPC_CLIENT__ ??= null;
  5229. target.__VUE_DEVTOOLS_KIT_VITE_RPC_SERVER__ ??= null;
  5230. target.__VUE_DEVTOOLS_KIT_BROADCAST_RPC_SERVER__ ??= null;
  5231. function setRpcClientToGlobal(rpc) {
  5232. target.__VUE_DEVTOOLS_KIT_RPC_CLIENT__ = rpc;
  5233. }
  5234. function setRpcServerToGlobal(rpc) {
  5235. target.__VUE_DEVTOOLS_KIT_RPC_SERVER__ = rpc;
  5236. }
  5237. function getRpcClient() {
  5238. return target.__VUE_DEVTOOLS_KIT_RPC_CLIENT__;
  5239. }
  5240. function getRpcServer() {
  5241. return target.__VUE_DEVTOOLS_KIT_RPC_SERVER__;
  5242. }
  5243. function setViteRpcClientToGlobal(rpc) {
  5244. target.__VUE_DEVTOOLS_KIT_VITE_RPC_CLIENT__ = rpc;
  5245. }
  5246. function setViteRpcServerToGlobal(rpc) {
  5247. target.__VUE_DEVTOOLS_KIT_VITE_RPC_SERVER__ = rpc;
  5248. }
  5249. function getViteRpcClient() {
  5250. return target.__VUE_DEVTOOLS_KIT_VITE_RPC_CLIENT__;
  5251. }
  5252. function getViteRpcServer() {
  5253. return target.__VUE_DEVTOOLS_KIT_VITE_RPC_SERVER__;
  5254. }
  5255. function getChannel(preset, host = "client") {
  5256. const channel = {
  5257. iframe: {
  5258. client: createIframeClientChannel,
  5259. server: createIframeServerChannel
  5260. }[host],
  5261. electron: {
  5262. client: createElectronClientChannel,
  5263. proxy: createElectronProxyChannel,
  5264. server: createElectronServerChannel
  5265. }[host],
  5266. vite: {
  5267. client: createViteClientChannel,
  5268. server: createViteServerChannel
  5269. }[host],
  5270. broadcast: {
  5271. client: createBroadcastChannel,
  5272. server: createBroadcastChannel
  5273. }[host],
  5274. extension: {
  5275. client: createExtensionClientChannel,
  5276. proxy: createExtensionProxyChannel,
  5277. server: createExtensionServerChannel
  5278. }[host]
  5279. }[preset];
  5280. return channel();
  5281. }
  5282. function createRpcClient(functions, options = {}) {
  5283. const { channel: _channel, options: _options, preset } = options;
  5284. const channel = preset ? getChannel(preset) : _channel;
  5285. const rpc = createBirpc(functions, {
  5286. ..._options,
  5287. ...channel,
  5288. timeout: -1
  5289. });
  5290. if (preset === "vite") {
  5291. setViteRpcClientToGlobal(rpc);
  5292. return;
  5293. }
  5294. setRpcClientToGlobal(rpc);
  5295. return rpc;
  5296. }
  5297. function createRpcServer(functions, options = {}) {
  5298. const { channel: _channel, options: _options, preset } = options;
  5299. const channel = preset ? getChannel(preset, "server") : _channel;
  5300. const rpcServer = getRpcServer();
  5301. if (!rpcServer) {
  5302. const group = createBirpcGroup(functions, [channel], {
  5303. ..._options,
  5304. timeout: -1
  5305. });
  5306. if (preset === "vite") {
  5307. setViteRpcServerToGlobal(group);
  5308. return;
  5309. }
  5310. setRpcServerToGlobal(group);
  5311. } else rpcServer.updateChannels((channels) => {
  5312. channels.push(channel);
  5313. });
  5314. }
  5315. function createRpcProxy(options = {}) {
  5316. const { channel: _channel, options: _options, preset } = options;
  5317. const channel = preset ? getChannel(preset, "proxy") : _channel;
  5318. return createBirpc({}, {
  5319. ..._options,
  5320. ...channel,
  5321. timeout: -1
  5322. });
  5323. }
  5324. //#endregion
  5325. //#region src/core/component/state/custom.ts
  5326. function getFunctionDetails(func) {
  5327. let string = "";
  5328. let matches = null;
  5329. try {
  5330. string = Function.prototype.toString.call(func);
  5331. matches = String.prototype.match.call(string, /\([\s\S]*?\)/);
  5332. } catch (e) {}
  5333. const match = matches && matches[0];
  5334. const args = typeof match === "string" ? match : "(?)";
  5335. const name = typeof func.name === "string" ? func.name : "";
  5336. return { _custom: {
  5337. type: "function",
  5338. displayText: `<span style="opacity:.8;margin-right:5px;">function</span> <span style="white-space:nowrap;">${escape(name)}${args}</span>`,
  5339. tooltipText: string.trim() ? `<pre>${string}</pre>` : null
  5340. } };
  5341. }
  5342. function getBigIntDetails(val) {
  5343. const stringifiedBigInt = BigInt.prototype.toString.call(val);
  5344. return { _custom: {
  5345. type: "bigint",
  5346. displayText: `BigInt(${stringifiedBigInt})`,
  5347. value: stringifiedBigInt
  5348. } };
  5349. }
  5350. function getDateDetails(val) {
  5351. const date = new Date(val.getTime());
  5352. date.setMinutes(date.getMinutes() - date.getTimezoneOffset());
  5353. return { _custom: {
  5354. type: "date",
  5355. displayText: Date.prototype.toString.call(val),
  5356. value: date.toISOString().slice(0, -1)
  5357. } };
  5358. }
  5359. function getMapDetails(val) {
  5360. return { _custom: {
  5361. type: "map",
  5362. displayText: "Map",
  5363. value: Object.fromEntries(val),
  5364. readOnly: true,
  5365. fields: { abstract: true }
  5366. } };
  5367. }
  5368. function getSetDetails(val) {
  5369. const list = Array.from(val);
  5370. return { _custom: {
  5371. type: "set",
  5372. displayText: `Set[${list.length}]`,
  5373. value: list,
  5374. readOnly: true
  5375. } };
  5376. }
  5377. function getCaughtGetters(store) {
  5378. const getters = {};
  5379. const origGetters = store.getters || {};
  5380. const keys = Object.keys(origGetters);
  5381. for (let i = 0; i < keys.length; i++) {
  5382. const key = keys[i];
  5383. Object.defineProperty(getters, key, {
  5384. enumerable: true,
  5385. get: () => {
  5386. try {
  5387. return origGetters[key];
  5388. } catch (e) {
  5389. return e;
  5390. }
  5391. }
  5392. });
  5393. }
  5394. return getters;
  5395. }
  5396. function reduceStateList(list) {
  5397. if (!list.length) return void 0;
  5398. return list.reduce((map, item) => {
  5399. const key = item.type || "data";
  5400. const obj = map[key] = map[key] || {};
  5401. obj[item.key] = item.value;
  5402. return map;
  5403. }, {});
  5404. }
  5405. function namedNodeMapToObject(map) {
  5406. const result = {};
  5407. const l = map.length;
  5408. for (let i = 0; i < l; i++) {
  5409. const node = map.item(i);
  5410. result[node.name] = node.value;
  5411. }
  5412. return result;
  5413. }
  5414. function getStoreDetails(store) {
  5415. return { _custom: {
  5416. type: "store",
  5417. displayText: "Store",
  5418. value: {
  5419. state: store.state,
  5420. getters: getCaughtGetters(store)
  5421. },
  5422. fields: { abstract: true }
  5423. } };
  5424. }
  5425. function getRouterDetails(router) {
  5426. return { _custom: {
  5427. type: "router",
  5428. displayText: "VueRouter",
  5429. value: {
  5430. options: router.options,
  5431. currentRoute: router.currentRoute
  5432. },
  5433. fields: { abstract: true }
  5434. } };
  5435. }
  5436. function getInstanceDetails(instance) {
  5437. if (instance._) instance = instance._;
  5438. const state = processInstanceState(instance);
  5439. return { _custom: {
  5440. type: "component",
  5441. id: instance.__VUE_DEVTOOLS_NEXT_UID__,
  5442. displayText: getInstanceName(instance),
  5443. tooltipText: "Component instance",
  5444. value: reduceStateList(state),
  5445. fields: { abstract: true }
  5446. } };
  5447. }
  5448. function getComponentDefinitionDetails(definition) {
  5449. let display = getComponentName(definition);
  5450. if (display) {
  5451. if (definition.name && definition.__file) display += ` <span>(${definition.__file})</span>`;
  5452. } else display = "<i>Unknown Component</i>";
  5453. return { _custom: {
  5454. type: "component-definition",
  5455. displayText: display,
  5456. tooltipText: "Component definition",
  5457. ...definition.__file ? { file: definition.__file } : {}
  5458. } };
  5459. }
  5460. function getHTMLElementDetails(value) {
  5461. try {
  5462. return { _custom: {
  5463. type: "HTMLElement",
  5464. displayText: `<span class="opacity-30">&lt;</span><span class="text-blue-500">${value.tagName.toLowerCase()}</span><span class="opacity-30">&gt;</span>`,
  5465. value: namedNodeMapToObject(value.attributes)
  5466. } };
  5467. } catch (e) {
  5468. return { _custom: {
  5469. type: "HTMLElement",
  5470. displayText: `<span class="text-blue-500">${String(value)}</span>`
  5471. } };
  5472. }
  5473. }
  5474. /**
  5475. * - ObjectRefImpl, toRef({ foo: 'foo' }, 'foo'), `_value` is the actual value, (since 3.5.0)
  5476. * - GetterRefImpl, toRef(() => state.foo), `_value` is the actual value, (since 3.5.0)
  5477. * - RefImpl, ref('foo') / computed(() => 'foo'), `_value` is the actual value
  5478. */
  5479. function tryGetRefValue(ref) {
  5480. if (ensurePropertyExists(ref, "_value", true)) return ref._value;
  5481. if (ensurePropertyExists(ref, "value", true)) return ref.value;
  5482. }
  5483. function getObjectDetails(object) {
  5484. const info = getSetupStateType(object);
  5485. if (info.ref || info.computed || info.reactive) {
  5486. const stateTypeName = info.computed ? "Computed" : info.ref ? "Ref" : info.reactive ? "Reactive" : null;
  5487. const value = toRaw(info.reactive ? object : tryGetRefValue(object));
  5488. const raw = ensurePropertyExists(object, "effect") ? object.effect?.raw?.toString() || object.effect?.fn?.toString() : null;
  5489. return { _custom: {
  5490. type: stateTypeName?.toLowerCase(),
  5491. stateTypeName,
  5492. value,
  5493. ...raw ? { tooltipText: `<span class="font-mono">${raw}</span>` } : {}
  5494. } };
  5495. }
  5496. if (ensurePropertyExists(object, "__asyncLoader") && typeof object.__asyncLoader === "function") return { _custom: {
  5497. type: "component-definition",
  5498. display: "Async component definition"
  5499. } };
  5500. }
  5501. //#endregion
  5502. //#region src/core/component/state/replacer.ts
  5503. function stringifyReplacer(key, _value, depth, seenInstance) {
  5504. if (key === "compilerOptions") return;
  5505. const val = this[key];
  5506. const type = typeof val;
  5507. if (Array.isArray(val)) {
  5508. const l = val.length;
  5509. if (l > MAX_ARRAY_SIZE) return {
  5510. _isArray: true,
  5511. length: l,
  5512. items: val.slice(0, MAX_ARRAY_SIZE)
  5513. };
  5514. return val;
  5515. } else if (typeof val === "string") if (val.length > MAX_STRING_SIZE) return `${val.substring(0, MAX_STRING_SIZE)}... (${val.length} total length)`;
  5516. else return val;
  5517. else if (type === "undefined") return UNDEFINED;
  5518. else if (val === Number.POSITIVE_INFINITY) return INFINITY;
  5519. else if (val === Number.NEGATIVE_INFINITY) return NEGATIVE_INFINITY;
  5520. else if (typeof val === "function") return getFunctionDetails(val);
  5521. else if (type === "symbol") return `[native Symbol ${Symbol.prototype.toString.call(val)}]`;
  5522. else if (typeof val === "bigint") return getBigIntDetails(val);
  5523. else if (val !== null && typeof val === "object") {
  5524. const proto = Object.prototype.toString.call(val);
  5525. if (proto === "[object Map]") return getMapDetails(val);
  5526. else if (proto === "[object Set]") return getSetDetails(val);
  5527. else if (proto === "[object RegExp]") return `[native RegExp ${RegExp.prototype.toString.call(val)}]`;
  5528. else if (proto === "[object Date]") return getDateDetails(val);
  5529. else if (proto === "[object Error]") return `[native Error ${val.message}<>${val.stack}]`;
  5530. else if (ensurePropertyExists(val, "state", true) && ensurePropertyExists(val, "_vm", true)) return getStoreDetails(val);
  5531. else if (val.constructor && val.constructor.name === "VueRouter") return getRouterDetails(val);
  5532. else if (isVueInstance(val)) {
  5533. const componentVal = getInstanceDetails(val);
  5534. const parentInstanceDepth = seenInstance?.get(val);
  5535. if (parentInstanceDepth && parentInstanceDepth < depth) return `[[CircularRef]] <${componentVal._custom.displayText}>`;
  5536. seenInstance?.set(val, depth);
  5537. return componentVal;
  5538. } else if (ensurePropertyExists(val, "render", true) && typeof val.render === "function") return getComponentDefinitionDetails(val);
  5539. else if (val.constructor && val.constructor.name === "VNode") return `[native VNode <${val.tag}>]`;
  5540. else if (typeof HTMLElement !== "undefined" && val instanceof HTMLElement) return getHTMLElementDetails(val);
  5541. else if (val.constructor?.name === "Store" && "_wrappedGetters" in val) return "[object Store]";
  5542. else if (ensurePropertyExists(val, "currentRoute", true)) return "[object Router]";
  5543. const customDetails = getObjectDetails(val);
  5544. if (customDetails != null) return customDetails;
  5545. } else if (Number.isNaN(val)) return NAN;
  5546. return sanitize(val);
  5547. }
  5548. //#endregion
  5549. //#region src/shared/transfer.ts
  5550. const MAX_SERIALIZED_SIZE = 2 * 1024 * 1024;
  5551. function isObject(_data, proto) {
  5552. return proto === "[object Object]";
  5553. }
  5554. function isArray(_data, proto) {
  5555. return proto === "[object Array]";
  5556. }
  5557. function isVueReactiveLinkNode(node) {
  5558. const constructorName = node?.constructor?.name;
  5559. return constructorName === "Dep" && "activeLink" in node || constructorName === "Link" && "dep" in node;
  5560. }
  5561. /**
  5562. * This function is used to serialize object with handling circular references.
  5563. *
  5564. * ```ts
  5565. * const obj = { a: 1, b: { c: 2 }, d: obj }
  5566. * const result = stringifyCircularAutoChunks(obj) // call `encode` inside
  5567. * console.log(result) // [{"a":1,"b":2,"d":0},1,{"c":4},2]
  5568. * ```
  5569. *
  5570. * Each object is stored in a list and the index is used to reference the object.
  5571. * With seen map, we can check if the object is already stored in the list to avoid circular references.
  5572. *
  5573. * Note: here we have a special case for Vue instance.
  5574. * We check if a vue instance includes itself in its properties and skip it
  5575. * by using `seenVueInstance` and `depth` to avoid infinite loop.
  5576. */
  5577. function encode(data, replacer, list, seen, depth = 0, seenVueInstance = /* @__PURE__ */ new Map()) {
  5578. let stored;
  5579. let key;
  5580. let value;
  5581. let i;
  5582. let l;
  5583. const seenIndex = seen.get(data);
  5584. if (seenIndex != null) return seenIndex;
  5585. const index = list.length;
  5586. const proto = Object.prototype.toString.call(data);
  5587. if (isObject(data, proto)) {
  5588. if (isVueReactiveLinkNode(data)) return index;
  5589. stored = {};
  5590. seen.set(data, index);
  5591. list.push(stored);
  5592. const keys = Object.keys(data);
  5593. for (i = 0, l = keys.length; i < l; i++) {
  5594. key = keys[i];
  5595. if (key === "compilerOptions") return index;
  5596. value = data[key];
  5597. const isVm = value != null && isObject(value, Object.prototype.toString.call(data)) && isVueInstance(value);
  5598. try {
  5599. if (replacer) value = replacer.call(data, key, value, depth, seenVueInstance);
  5600. } catch (e) {
  5601. value = e;
  5602. }
  5603. stored[key] = encode(value, replacer, list, seen, depth + 1, seenVueInstance);
  5604. if (isVm) seenVueInstance.delete(value);
  5605. }
  5606. } else if (isArray(data, proto)) {
  5607. stored = [];
  5608. seen.set(data, index);
  5609. list.push(stored);
  5610. for (i = 0, l = data.length; i < l; i++) {
  5611. try {
  5612. value = data[i];
  5613. if (replacer) value = replacer.call(data, i, value, depth, seenVueInstance);
  5614. } catch (e) {
  5615. value = e;
  5616. }
  5617. stored[i] = encode(value, replacer, list, seen, depth + 1, seenVueInstance);
  5618. }
  5619. } else list.push(data);
  5620. return index;
  5621. }
  5622. function decode(list, reviver$1 = null) {
  5623. let i = list.length;
  5624. let j, k, data, key, value, proto;
  5625. while (i--) {
  5626. data = list[i];
  5627. proto = Object.prototype.toString.call(data);
  5628. if (proto === "[object Object]") {
  5629. const keys = Object.keys(data);
  5630. for (j = 0, k = keys.length; j < k; j++) {
  5631. key = keys[j];
  5632. value = list[data[key]];
  5633. if (reviver$1) value = reviver$1.call(data, key, value);
  5634. data[key] = value;
  5635. }
  5636. } else if (proto === "[object Array]") for (j = 0, k = data.length; j < k; j++) {
  5637. value = list[data[j]];
  5638. if (reviver$1) value = reviver$1.call(data, j, value);
  5639. data[j] = value;
  5640. }
  5641. }
  5642. }
  5643. function stringifyCircularAutoChunks(data, replacer = null, space = null) {
  5644. let result;
  5645. try {
  5646. result = arguments.length === 1 ? JSON.stringify(data) : JSON.stringify(data, (k, v) => replacer?.(k, v)?.call(this), space);
  5647. } catch (e) {
  5648. result = stringifyStrictCircularAutoChunks(data, replacer, space);
  5649. }
  5650. if (result.length > MAX_SERIALIZED_SIZE) {
  5651. const chunkCount = Math.ceil(result.length / MAX_SERIALIZED_SIZE);
  5652. const chunks = [];
  5653. for (let i = 0; i < chunkCount; i++) chunks.push(result.slice(i * MAX_SERIALIZED_SIZE, (i + 1) * MAX_SERIALIZED_SIZE));
  5654. return chunks;
  5655. }
  5656. return result;
  5657. }
  5658. function stringifyStrictCircularAutoChunks(data, replacer = null, space = null) {
  5659. const list = [];
  5660. encode(data, replacer, list, /* @__PURE__ */ new Map());
  5661. return space ? ` ${JSON.stringify(list, null, space)}` : ` ${JSON.stringify(list)}`;
  5662. }
  5663. function parseCircularAutoChunks(data, reviver$1 = null) {
  5664. if (Array.isArray(data)) data = data.join("");
  5665. if (!/^\s/.test(data)) return arguments.length === 1 ? JSON.parse(data) : JSON.parse(data, reviver$1);
  5666. else {
  5667. const list = JSON.parse(data);
  5668. decode(list, reviver$1);
  5669. return list[0];
  5670. }
  5671. }
  5672. //#endregion
  5673. //#region src/shared/util.ts
  5674. function stringify(data) {
  5675. return stringifyCircularAutoChunks(data, stringifyReplacer);
  5676. }
  5677. function parse(data, revive$1 = false) {
  5678. if (data == void 0) return {};
  5679. return revive$1 ? parseCircularAutoChunks(data, reviver) : parseCircularAutoChunks(data);
  5680. }
  5681. //#endregion
  5682. //#region src/index.ts
  5683. const devtools = {
  5684. hook,
  5685. init: () => {
  5686. initDevTools();
  5687. },
  5688. get ctx() {
  5689. return devtoolsContext;
  5690. },
  5691. get api() {
  5692. return devtoolsContext.api;
  5693. }
  5694. };
  5695. //#endregion
  5696. export { DevToolsContextHookKeys, DevToolsMessagingHookKeys, DevToolsV6PluginAPIHookKeys, INFINITY, NAN, NEGATIVE_INFINITY, ROUTER_INFO_KEY, ROUTER_KEY, UNDEFINED, activeAppRecord, addCustomCommand, addCustomTab, addDevToolsAppRecord, addDevToolsPluginToBuffer, addInspector, callConnectedUpdatedHook, callDevToolsPluginSetupFn, callInspectorUpdatedHook, callStateUpdatedHook, createComponentsDevToolsPlugin, createDevToolsApi, createDevToolsCtxHooks, createRpcClient, createRpcProxy, createRpcServer, devtools, devtoolsAppRecords, devtoolsContext, devtoolsInspector, devtoolsPluginBuffer, devtoolsRouter, devtoolsRouterInfo, devtoolsState, escape, formatInspectorStateValue, getActiveInspectors, getDevToolsEnv, getExtensionClientContext, getInspector, getInspectorActions, getInspectorInfo, getInspectorNodeActions, getInspectorStateValueType, getRaw, getRpcClient, getRpcServer, getViteRpcClient, getViteRpcServer, initDevTools, isPlainObject, onDevToolsClientConnected, onDevToolsConnected, parse, registerDevToolsPlugin, removeCustomCommand, removeDevToolsAppRecord, removeRegisteredPluginApp, resetDevToolsState, setActiveAppRecord, setActiveAppRecordId, setDevToolsEnv, setElectronClientContext, setElectronProxyContext, setElectronServerContext, setExtensionClientContext, setIframeServerContext, setOpenInEditorBaseUrl, setRpcServerToGlobal, setViteClientContext, setViteRpcClientToGlobal, setViteRpcServerToGlobal, setViteServerContext, setupDevToolsPlugin, stringify, toEdit, toSubmit, toggleClientConnected, toggleComponentInspectorEnabled, toggleHighPerfMode, updateDevToolsClientDetected, updateDevToolsState, updateTimelineLayersState };