chunk-PBJIO4MK.js 4.5 KB

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