市场夺宝奇兵
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.

5863 lines
177 KiB

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