chunk-RGGBZDNW.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. import {
  2. __async,
  3. init_define_APP_INFO
  4. } from "./chunk-XY75H3MP.js";
  5. // node_modules/@vue/devtools-api/lib/esm/index.js
  6. init_define_APP_INFO();
  7. // node_modules/@vue/devtools-api/lib/esm/env.js
  8. init_define_APP_INFO();
  9. function getDevtoolsGlobalHook() {
  10. return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
  11. }
  12. function getTarget() {
  13. return typeof navigator !== "undefined" && typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
  14. }
  15. var isProxyAvailable = typeof Proxy === "function";
  16. // node_modules/@vue/devtools-api/lib/esm/const.js
  17. init_define_APP_INFO();
  18. var HOOK_SETUP = "devtools-plugin:setup";
  19. var HOOK_PLUGIN_SETTINGS_SET = "plugin:settings:set";
  20. // node_modules/@vue/devtools-api/lib/esm/proxy.js
  21. init_define_APP_INFO();
  22. // node_modules/@vue/devtools-api/lib/esm/time.js
  23. init_define_APP_INFO();
  24. var supported;
  25. var perf;
  26. function isPerformanceSupported() {
  27. var _a;
  28. if (supported !== void 0) {
  29. return supported;
  30. }
  31. if (typeof window !== "undefined" && window.performance) {
  32. supported = true;
  33. perf = window.performance;
  34. } else if (typeof global !== "undefined" && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
  35. supported = true;
  36. perf = global.perf_hooks.performance;
  37. } else {
  38. supported = false;
  39. }
  40. return supported;
  41. }
  42. function now() {
  43. return isPerformanceSupported() ? perf.now() : Date.now();
  44. }
  45. // node_modules/@vue/devtools-api/lib/esm/proxy.js
  46. var ApiProxy = class {
  47. constructor(plugin, hook) {
  48. this.target = null;
  49. this.targetQueue = [];
  50. this.onQueue = [];
  51. this.plugin = plugin;
  52. this.hook = hook;
  53. const defaultSettings = {};
  54. if (plugin.settings) {
  55. for (const id in plugin.settings) {
  56. const item = plugin.settings[id];
  57. defaultSettings[id] = item.defaultValue;
  58. }
  59. }
  60. const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;
  61. let currentSettings = Object.assign({}, defaultSettings);
  62. try {
  63. const raw = localStorage.getItem(localSettingsSaveId);
  64. const data = JSON.parse(raw);
  65. Object.assign(currentSettings, data);
  66. } catch (e) {
  67. }
  68. this.fallbacks = {
  69. getSettings() {
  70. return currentSettings;
  71. },
  72. setSettings(value) {
  73. try {
  74. localStorage.setItem(localSettingsSaveId, JSON.stringify(value));
  75. } catch (e) {
  76. }
  77. currentSettings = value;
  78. },
  79. now() {
  80. return now();
  81. }
  82. };
  83. if (hook) {
  84. hook.on(HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {
  85. if (pluginId === this.plugin.id) {
  86. this.fallbacks.setSettings(value);
  87. }
  88. });
  89. }
  90. this.proxiedOn = new Proxy({}, {
  91. get: (_target, prop) => {
  92. if (this.target) {
  93. return this.target.on[prop];
  94. } else {
  95. return (...args) => {
  96. this.onQueue.push({
  97. method: prop,
  98. args
  99. });
  100. };
  101. }
  102. }
  103. });
  104. this.proxiedTarget = new Proxy({}, {
  105. get: (_target, prop) => {
  106. if (this.target) {
  107. return this.target[prop];
  108. } else if (prop === "on") {
  109. return this.proxiedOn;
  110. } else if (Object.keys(this.fallbacks).includes(prop)) {
  111. return (...args) => {
  112. this.targetQueue.push({
  113. method: prop,
  114. args,
  115. resolve: () => {
  116. }
  117. });
  118. return this.fallbacks[prop](...args);
  119. };
  120. } else {
  121. return (...args) => {
  122. return new Promise((resolve) => {
  123. this.targetQueue.push({
  124. method: prop,
  125. args,
  126. resolve
  127. });
  128. });
  129. };
  130. }
  131. }
  132. });
  133. }
  134. setRealTarget(target) {
  135. return __async(this, null, function* () {
  136. this.target = target;
  137. for (const item of this.onQueue) {
  138. this.target.on[item.method](...item.args);
  139. }
  140. for (const item of this.targetQueue) {
  141. item.resolve(yield this.target[item.method](...item.args));
  142. }
  143. });
  144. }
  145. };
  146. // node_modules/@vue/devtools-api/lib/esm/api/index.js
  147. init_define_APP_INFO();
  148. // node_modules/@vue/devtools-api/lib/esm/api/api.js
  149. init_define_APP_INFO();
  150. // node_modules/@vue/devtools-api/lib/esm/api/app.js
  151. init_define_APP_INFO();
  152. // node_modules/@vue/devtools-api/lib/esm/api/component.js
  153. init_define_APP_INFO();
  154. // node_modules/@vue/devtools-api/lib/esm/api/context.js
  155. init_define_APP_INFO();
  156. // node_modules/@vue/devtools-api/lib/esm/api/hooks.js
  157. init_define_APP_INFO();
  158. // node_modules/@vue/devtools-api/lib/esm/api/util.js
  159. init_define_APP_INFO();
  160. // node_modules/@vue/devtools-api/lib/esm/plugin.js
  161. init_define_APP_INFO();
  162. // node_modules/@vue/devtools-api/lib/esm/index.js
  163. function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
  164. const descriptor = pluginDescriptor;
  165. const target = getTarget();
  166. const hook = getDevtoolsGlobalHook();
  167. const enableProxy = isProxyAvailable && descriptor.enableEarlyProxy;
  168. if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {
  169. hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);
  170. } else {
  171. const proxy = enableProxy ? new ApiProxy(descriptor, hook) : null;
  172. const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
  173. list.push({
  174. pluginDescriptor: descriptor,
  175. setupFn,
  176. proxy
  177. });
  178. if (proxy)
  179. setupFn(proxy.proxiedTarget);
  180. }
  181. }
  182. export {
  183. setupDevtoolsPlugin
  184. };
  185. //# sourceMappingURL=chunk-RGGBZDNW.js.map