vite-devtools-svelte 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -6
- package/dist/client/assets/client-D_AN-igc.js +2 -0
- package/dist/client/assets/index-CJElsHas.js +6 -0
- package/dist/client/index.html +1 -1
- package/dist/index.mjs +90 -68
- package/dist/index.mjs.map +1 -1
- package/dist/runtime.d.ts +4 -2
- package/dist/template-injector.d.ts +42 -0
- package/package.json +22 -22
- package/skills/vite-devtools-svelte-perf-audit/SKILL.md +1 -1
- package/dist/client/assets/client-BF-DBa_K.js +0 -4
- package/dist/client/assets/index-CnFg6eG8.js +0 -6
package/dist/runtime.d.ts
CHANGED
|
@@ -9,9 +9,11 @@ export declare const WRAPPER_MODULE_ID = "\0svelte-devtools:wrapped-client";
|
|
|
9
9
|
* - tag/tag_proxy: named signal/proxy tracking (Svelte dev mode)
|
|
10
10
|
* - state/derived/proxy: type markers consumed by tag/tag_proxy
|
|
11
11
|
* - user_effect/user_pre_effect: effect tracking
|
|
12
|
+
* - template_effect/deferred_template_effect: render count/time profiling
|
|
13
|
+
* - each/if/key/await/component/boundary: block-callback owner attribution
|
|
12
14
|
*
|
|
13
15
|
* This single module replaces all post-compilation regex transforms
|
|
14
16
|
* for reactive tracking, making the approach Svelte-compiler-output agnostic.
|
|
15
17
|
*/
|
|
16
|
-
export declare const wrapperCode = "\nimport * as __svelte_original from 'svelte/internal/client';\nexport * from 'svelte/internal/client';\n\nfunction __dt() {\n return typeof window !== 'undefined' ? window.__SVELTE_DEVTOOLS__ : null;\n}\n\n// Component ID stack (parallel to runtime._stack but local to wrapper)\nconst __idStack = [];\nfunction __currentId() {\n return __idStack.length > 0 ? __idStack[__idStack.length - 1] : null;\n}\n\n// Tracks the most recently created signal for type determination in tag()\nconst __pendingSignal = { ref: null, type: null };\n\n// --- Component Lifecycle ---\n//\n// Observer must not break the observed: every devtools side-effect below is\n// wrapped in try/catch so a bug or an out-of-shape runtime cannot tear down\n// the user's app. The original Svelte function is always called, and its\n// return value always returned, regardless of devtools failures.\n\nexport function push() {\n const result = __svelte_original.push.apply(null, arguments);\n try {\n const dt = __dt();\n if (dt) {\n const file = dt._pendingFile || 'Unknown';\n dt._pendingFile = null;\n const id = dt.register(file);\n __idStack.push(id);\n dt.startInit(id);\n try {\n __svelte_original.user_effect(() => {\n return () => { try { dt.unmount(id); } catch {} };\n });\n } catch {}\n }\n } catch {}\n return result;\n}\n\nexport function pop() {\n // Capture devtools errors but ALWAYS forward to the original pop so the\n // Svelte component stack stays balanced.\n try {\n const dt = __dt();\n if (dt && __idStack.length > 0) {\n const id = __idStack.pop();\n try { dt.endInit(id); } catch {}\n try { dt.registered(id); } catch {}\n }\n } catch {}\n return __svelte_original.pop.apply(null, arguments);\n}\n\n// --- Signal Creation (type markers) ---\n\nexport function state() {\n const signal = __svelte_original.state.apply(null, arguments);\n try {\n __pendingSignal.ref = signal;\n __pendingSignal.type = 'state';\n } catch {}\n return signal;\n}\n\nexport function derived() {\n const signal = __svelte_original.derived.apply(null, arguments);\n try {\n __pendingSignal.ref = signal;\n __pendingSignal.type = 'derived';\n } catch {}\n return signal;\n}\n\nexport function proxy() {\n const p = __svelte_original.proxy.apply(null, arguments);\n try {\n __pendingSignal.ref = p;\n __pendingSignal.type = 'proxy';\n } catch {}\n return p;\n}\n\n// --- Signal Tagging (Svelte dev mode) ---\n\nexport function tag(signal, name) {\n const result = __svelte_original.tag.apply(null, arguments);\n try {\n const dt = __dt();\n const cid = __currentId();\n if (dt && cid !== null) {\n const type = (__pendingSignal.ref === signal) ? __pendingSignal.type : 'state';\n if (type === 'derived') {\n dt.trackDerived(signal, name, cid);\n } else {\n dt.trackState(signal, name, cid);\n }\n }\n __pendingSignal.ref = null;\n __pendingSignal.type = null;\n } catch {}\n return result;\n}\n\nexport function tag_proxy(proxy, name) {\n const result = __svelte_original.tag_proxy.apply(null, arguments);\n try {\n const dt = __dt();\n const cid = __currentId();\n if (dt && cid !== null) {\n dt.trackProxy(proxy, name, cid);\n }\n __pendingSignal.ref = null;\n __pendingSignal.type = null;\n } catch {}\n return result;\n}\n\n// --- Effect Tracking ---\n\nexport function user_effect() {\n const result = __svelte_original.user_effect.apply(null, arguments);\n try {\n const dt = __dt();\n const cid = __currentId();\n if (dt && cid !== null) {\n dt._effectCounter = (dt._effectCounter || 0) + 1;\n // Track the effect OBJECT (not the callback). The Svelte runtime\n // populates result.deps with the signals this effect depends on,\n // which is what getReactiveGraph() reads to build edges.\n dt.trackEffect(result, 'effect_' + dt._effectCounter, cid);\n }\n } catch {}\n return result;\n}\n\nexport function user_pre_effect() {\n const result = __svelte_original.user_pre_effect.apply(null, arguments);\n try {\n const dt = __dt();\n const cid = __currentId();\n if (dt && cid !== null) {\n dt._effectCounter = (dt._effectCounter || 0) + 1;\n dt.trackEffect(result, 'effect_pre_' + dt._effectCounter, cid);\n }\n } catch {}\n return result;\n}\n";
|
|
17
|
-
export declare const runtimeCode = "\nif (typeof window !== 'undefined' && !window.__SVELTE_DEVTOOLS__) {\n const __SVELTE_DT = {\n _nextId: 0,\n _instances: new Map(),\n _stack: [],\n _pendingFile: null,\n _effectCounter: 0,\n _debounceTimer: null,\n _listeners: new Set(),\n\n // Phase 2: Profiling data\n _profiles: new Map(),\n _initStartTimes: new Map(),\n _profileDebounceTimer: null,\n\n // Phase 2: Reactive graph data\n _reactiveNodes: new Map(),\n _reactiveProxies: new Map(),\n\n // Phase 3: State timeline\n _stateTimeline: [],\n _stateSnapshots: new Map(),\n _timelineDebounceTimer: null,\n\n register(file) {\n const id = this._nextId++;\n const parentId = this._stack.length > 0 ? this._stack[this._stack.length - 1] : null;\n const name = file.split('/').pop()?.replace('.svelte', '') || 'Unknown';\n this._instances.set(id, { id, file, name, parentId, mounted: true, children: [] });\n if (parentId !== null) {\n const parent = this._instances.get(parentId);\n if (parent) parent.children.push(id);\n }\n this._stack.push(id);\n this._scheduleUpdate();\n return id;\n },\n\n registered(id) {\n const idx = this._stack.indexOf(id);\n if (idx !== -1) this._stack.splice(idx, 1);\n },\n\n mount(id) {\n const instance = this._instances.get(id);\n if (instance && !instance.mounted) {\n instance.mounted = true;\n this._scheduleUpdate();\n }\n },\n\n unmount(id) {\n const instance = this._instances.get(id);\n if (instance) {\n if (instance.parentId !== null) {\n const parent = this._instances.get(instance.parentId);\n if (parent) {\n parent.children = parent.children.filter(cid => cid !== id);\n }\n }\n this._removeChildren(id);\n this._cleanupReactiveNodes(id);\n this._instances.delete(id);\n }\n this._scheduleUpdate();\n },\n\n _cleanupReactiveNodes(componentId) {\n for (const [nodeId, entry] of this._reactiveNodes) {\n if (entry.meta.componentId === componentId) {\n this._reactiveNodes.delete(nodeId);\n }\n }\n },\n\n _removeChildren(parentId) {\n const parent = this._instances.get(parentId);\n if (!parent) return;\n for (const childId of [...parent.children]) {\n this._removeChildren(childId);\n this._cleanupReactiveNodes(childId);\n this._instances.delete(childId);\n }\n },\n\n _scheduleUpdate() {\n if (this._debounceTimer) clearTimeout(this._debounceTimer);\n this._debounceTimer = setTimeout(() => {\n this._sendUpdate();\n }, 100);\n },\n\n _sendUpdate() {\n const components = [];\n for (const [, instance] of this._instances) {\n if (instance.mounted) {\n components.push({\n id: instance.id,\n file: instance.file,\n name: instance.name,\n parentId: instance.parentId,\n mounted: instance.mounted,\n });\n }\n }\n if (import.meta.hot) {\n import.meta.hot.send('svelte-devtools:components', { components });\n }\n },\n\n getTree() {\n const components = [];\n for (const [, instance] of this._instances) {\n if (instance.mounted) {\n components.push({\n id: instance.id,\n file: instance.file,\n name: instance.name,\n parentId: instance.parentId,\n mounted: instance.mounted,\n });\n }\n }\n return components;\n },\n\n // --- Phase 2: Render Profiling ---\n\n startInit(id) {\n this._initStartTimes.set(id, performance.now());\n },\n\n endInit(id) {\n const start = this._initStartTimes.get(id);\n if (start === undefined) return;\n const initTime = performance.now() - start;\n this._initStartTimes.delete(id);\n const instance = this._instances.get(id);\n if (!instance) return;\n this._profiles.set(id, {\n componentId: id,\n file: instance.file,\n name: instance.name,\n initTime,\n renderCount: 0,\n totalRenderTime: 0,\n lastRenderTime: 0,\n lastRenderAt: Date.now(),\n });\n this._scheduleProfileUpdate();\n },\n\n recordRender(id) {\n const profile = this._profiles.get(id);\n if (!profile) {\n const instance = this._instances.get(id);\n if (!instance) return;\n this._profiles.set(id, {\n componentId: id,\n file: instance.file,\n name: instance.name,\n initTime: 0,\n renderCount: 1,\n totalRenderTime: 0,\n lastRenderTime: 0,\n lastRenderAt: Date.now(),\n });\n } else {\n profile.renderCount++;\n profile.lastRenderAt = Date.now();\n }\n this._scheduleProfileUpdate();\n },\n\n recordRenderTime(id, duration) {\n const profile = this._profiles.get(id);\n if (profile) {\n profile.totalRenderTime += duration;\n profile.lastRenderTime = duration;\n }\n },\n\n _scheduleProfileUpdate() {\n if (this._profileDebounceTimer) clearTimeout(this._profileDebounceTimer);\n this._profileDebounceTimer = setTimeout(() => {\n this._sendProfileUpdate();\n }, 500);\n },\n\n _sendProfileUpdate() {\n const profiles = Array.from(this._profiles.values());\n if (import.meta.hot) {\n import.meta.hot.send('svelte-devtools:profiles', { profiles });\n }\n },\n\n getProfiles() {\n return Array.from(this._profiles.values());\n },\n\n resetProfiles() {\n this._profiles.clear();\n this._scheduleProfileUpdate();\n },\n\n // --- Phase 2: Reactive Graph Tracking ---\n\n trackState(signal, name, componentId) {\n const instance = this._instances.get(componentId);\n const nodeId = componentId + ':' + name;\n this._reactiveNodes.set(nodeId, {\n signal: new WeakRef(signal),\n meta: { id: nodeId, type: 'state', name, componentId, componentFile: instance ? instance.file : '' }\n });\n },\n\n trackProxy(proxy, name, componentId) {\n const instance = this._instances.get(componentId);\n const nodeId = componentId + ':' + name;\n this._reactiveProxies.set(nodeId, new WeakRef(proxy));\n this._reactiveNodes.set(nodeId, {\n signal: new WeakRef({ v: '(proxy)', _isProxy: true }),\n meta: { id: nodeId, type: 'state', name, componentId, componentFile: instance ? instance.file : '' }\n });\n },\n\n trackDerived(signal, name, componentId) {\n const instance = this._instances.get(componentId);\n const nodeId = componentId + ':' + name;\n this._reactiveNodes.set(nodeId, {\n signal: new WeakRef(signal),\n meta: { id: nodeId, type: 'derived', name, componentId, componentFile: instance ? instance.file : '' }\n });\n },\n\n trackEffect(effect, name, componentId) {\n const instance = this._instances.get(componentId);\n const nodeId = componentId + ':' + name;\n this._reactiveNodes.set(nodeId, {\n signal: new WeakRef(effect || { v: undefined, _isEffect: true }),\n meta: { id: nodeId, type: 'effect', name, componentId, componentFile: instance ? instance.file : '' }\n });\n return effect;\n },\n\n getReactiveGraph() {\n const nodes = [];\n const edges = [];\n const signalToId = new Map();\n\n for (const [nodeId, entry] of this._reactiveNodes) {\n const signal = entry.signal.deref();\n if (!signal || !this._instances.has(entry.meta.componentId)) {\n this._reactiveNodes.delete(nodeId);\n continue;\n }\n signalToId.set(signal, nodeId);\n const node = { ...entry.meta };\n if (signal._isProxy) {\n const proxyRef = this._reactiveProxies.get(nodeId);\n const proxy = proxyRef?.deref();\n if (proxy) {\n try {\n node.value = Array.isArray(proxy) ? '[' + proxy.length + ']' : '{' + Object.keys(proxy).length + '}';\n } catch { node.value = '(proxy)'; }\n }\n } else if (node.type !== 'effect' && signal.v !== undefined && typeof signal.v !== 'symbol') {\n try {\n const v = signal.v;\n if (typeof v === 'number' || typeof v === 'string' || typeof v === 'boolean' || v === null) {\n node.value = v;\n } else {\n node.value = '(object)';\n }\n } catch { /* ignore */ }\n }\n nodes.push(node);\n }\n\n // Map proxy internal signals to their proxy node ID\n for (const [nodeId, ref] of this._reactiveProxies) {\n const proxy = ref.deref();\n if (!proxy) { this._reactiveProxies.delete(nodeId); continue; }\n const meta = this._reactiveNodes.get(nodeId)?.meta;\n if (!meta || !this._instances.has(meta.componentId)) { this._reactiveProxies.delete(nodeId); continue; }\n }\n\n // Build edges from deps\n const edgeSet = new Set();\n for (const [nodeId, entry] of this._reactiveNodes) {\n const signal = entry.signal.deref();\n if (!signal) continue;\n if (!signal.deps) continue;\n\n const visited = new Set();\n const queue = [...signal.deps];\n while (queue.length > 0) {\n const dep = queue.shift();\n if (!dep || visited.has(dep)) continue;\n visited.add(dep);\n const depId = signalToId.get(dep);\n if (depId) {\n const key = depId + '>' + nodeId;\n if (depId !== nodeId && !edgeSet.has(key)) {\n edgeSet.add(key);\n edges.push({ from: depId, to: nodeId });\n }\n } else if (dep.deps) {\n for (const d of dep.deps) queue.push(d);\n }\n }\n }\n\n return { nodes, edges };\n },\n\n sendReactiveGraph() {\n const graph = this.getReactiveGraph();\n if (import.meta.hot) {\n import.meta.hot.send('svelte-devtools:reactive-graph', graph);\n }\n },\n\n // --- Phase 3: State Timeline ---\n\n _pollStateValues() {\n for (const [nodeId, entry] of this._reactiveNodes) {\n if (entry.meta.type !== 'state') continue;\n if (!this._instances.has(entry.meta.componentId)) {\n this._reactiveNodes.delete(nodeId);\n continue;\n }\n const signal = entry.signal.deref();\n if (!signal || signal.v === undefined) continue;\n try {\n const currentVal = signal.v;\n const prev = this._stateSnapshots.get(nodeId);\n if (prev !== undefined && currentVal === prev) continue;\n const isPrimitive = currentVal === null || typeof currentVal !== 'object';\n let newSnapshot;\n if (isPrimitive) {\n if (prev !== undefined && prev === currentVal) continue;\n newSnapshot = currentVal;\n } else {\n const currStr = JSON.stringify(currentVal);\n const prevStr = this._stateSnapshotStrs?.get(nodeId);\n if (prevStr === currStr) continue;\n newSnapshot = JSON.parse(currStr);\n if (!this._stateSnapshotStrs) this._stateSnapshotStrs = new Map();\n this._stateSnapshotStrs.set(nodeId, currStr);\n }\n if (this._stateTimeline.length >= 500) this._stateTimeline.splice(0, this._stateTimeline.length - 499);\n this._stateTimeline.push({\n id: nodeId,\n name: entry.meta.name,\n componentFile: entry.meta.componentFile,\n oldValue: prev !== undefined ? prev : null,\n newValue: newSnapshot,\n timestamp: Date.now(),\n });\n this._stateSnapshots.set(nodeId, newSnapshot);\n this._scheduleTimelineUpdate();\n } catch { /* ignore non-serializable */ }\n }\n },\n\n _scheduleTimelineUpdate() {\n if (this._timelineDebounceTimer) clearTimeout(this._timelineDebounceTimer);\n this._timelineDebounceTimer = setTimeout(() => {\n if (import.meta.hot) {\n import.meta.hot.send('svelte-devtools:state-timeline', { changes: this._stateTimeline });\n }\n }, 300);\n },\n\n getStateTimeline() {\n return this._stateTimeline;\n },\n\n clearStateTimeline() {\n this._stateTimeline = [];\n this._scheduleTimelineUpdate();\n },\n\n // --- FPS Monitoring ---\n // Uses requestAnimationFrame to measure frame rate with minimal overhead.\n // Only stores timestamps - no allocations per frame beyond a single array push.\n _fpsFrameTimes: [],\n\n _fpsLoop() {\n this._fpsFrameTimes.push(performance.now());\n requestAnimationFrame(() => this._fpsLoop());\n },\n\n _sampleFps() {\n const now = performance.now();\n // Remove frame timestamps older than 1 second\n const cutoff = now - 1000;\n let i = 0;\n while (i < this._fpsFrameTimes.length && this._fpsFrameTimes[i] < cutoff) i++;\n if (i > 0) this._fpsFrameTimes.splice(0, i);\n const fps = this._fpsFrameTimes.length;\n if (import.meta.hot) {\n import.meta.hot.send('svelte-devtools:fps', { timestamp: Date.now(), fps });\n }\n }\n };\n\n window.__SVELTE_DEVTOOLS__ = __SVELTE_DT;\n\n // Poll state values for timeline\n setInterval(() => { __SVELTE_DT._pollStateValues(); }, 200);\n\n // FPS monitoring\n requestAnimationFrame(() => __SVELTE_DT._fpsLoop());\n setInterval(() => __SVELTE_DT._sampleFps(), 500);\n\n // Phase 3: Capture runtime errors\n window.addEventListener('error', (event) => {\n if (import.meta.hot) {\n import.meta.hot.send('svelte-devtools:runtime-error', {\n message: event.message,\n file: event.filename,\n line: event.lineno,\n column: event.colno,\n stack: event.error?.stack || '',\n timestamp: Date.now(),\n });\n }\n });\n window.addEventListener('unhandledrejection', (event) => {\n if (import.meta.hot) {\n const reason = event.reason;\n import.meta.hot.send('svelte-devtools:runtime-error', {\n message: reason?.message || String(reason),\n stack: reason?.stack || '',\n timestamp: Date.now(),\n });\n }\n });\n\n // Listen for reactive graph requests from server\n if (import.meta.hot) {\n import.meta.hot.on('svelte-devtools:request-reactive-graph', () => {\n __SVELTE_DT.sendReactiveGraph();\n });\n import.meta.hot.on('svelte-devtools:request-state-timeline', () => {\n import.meta.hot.send('svelte-devtools:state-timeline', { changes: __SVELTE_DT._stateTimeline });\n });\n import.meta.hot.on('svelte-devtools:clear-state-timeline', () => {\n __SVELTE_DT.clearStateTimeline();\n });\n }\n}\n";
|
|
18
|
+
export declare const wrapperCode = "\nimport * as __svelte_original from 'svelte/internal/client';\nexport * from 'svelte/internal/client';\n\nfunction __dt() {\n return typeof window !== 'undefined' ? window.__SVELTE_DEVTOOLS__ : null;\n}\n\n// Component ID stack (parallel to runtime._stack but local to wrapper)\nconst __idStack = [];\nfunction __currentId() {\n return __idStack.length > 0 ? __idStack[__idStack.length - 1] : null;\n}\n\n// Tracks the most recently created signal for type determination in tag()\nconst __pendingSignal = { ref: null, type: null };\n\n// --- Component Lifecycle ---\n//\n// Observer must not break the observed: every devtools side-effect below is\n// wrapped in try/catch so a bug or an out-of-shape runtime cannot tear down\n// the user's app. The original Svelte function is always called, and its\n// return value always returned, regardless of devtools failures.\n\nexport function push() {\n const result = __svelte_original.push.apply(null, arguments);\n try {\n const dt = __dt();\n if (dt) {\n const file = dt._pendingFile || 'Unknown';\n dt._pendingFile = null;\n const id = dt.register(file);\n __idStack.push(id);\n dt.startInit(id);\n try {\n __svelte_original.user_effect(() => {\n return () => { try { dt.unmount(id); } catch {} };\n });\n } catch {}\n }\n } catch {}\n return result;\n}\n\nexport function pop() {\n // Capture devtools errors but ALWAYS forward to the original pop so the\n // Svelte component stack stays balanced.\n try {\n const dt = __dt();\n if (dt && __idStack.length > 0) {\n const id = __idStack.pop();\n try { dt.endInit(id); } catch {}\n try { dt.registered(id); } catch {}\n }\n } catch {}\n return __svelte_original.pop.apply(null, arguments);\n}\n\n// --- Signal Creation (type markers) ---\n\nexport function state() {\n const signal = __svelte_original.state.apply(null, arguments);\n try {\n __pendingSignal.ref = signal;\n __pendingSignal.type = 'state';\n } catch {}\n return signal;\n}\n\nexport function derived() {\n const signal = __svelte_original.derived.apply(null, arguments);\n try {\n __pendingSignal.ref = signal;\n __pendingSignal.type = 'derived';\n } catch {}\n return signal;\n}\n\nexport function proxy() {\n const p = __svelte_original.proxy.apply(null, arguments);\n try {\n __pendingSignal.ref = p;\n __pendingSignal.type = 'proxy';\n } catch {}\n return p;\n}\n\n// --- Signal Tagging (Svelte dev mode) ---\n\nexport function tag(signal, name) {\n const result = __svelte_original.tag.apply(null, arguments);\n try {\n const dt = __dt();\n const cid = __currentId();\n if (dt && cid !== null) {\n const type = (__pendingSignal.ref === signal) ? __pendingSignal.type : 'state';\n if (type === 'derived') {\n dt.trackDerived(signal, name, cid);\n } else {\n dt.trackState(signal, name, cid);\n }\n }\n __pendingSignal.ref = null;\n __pendingSignal.type = null;\n } catch {}\n return result;\n}\n\nexport function tag_proxy(proxy, name) {\n const result = __svelte_original.tag_proxy.apply(null, arguments);\n try {\n const dt = __dt();\n const cid = __currentId();\n if (dt && cid !== null) {\n dt.trackProxy(proxy, name, cid);\n }\n __pendingSignal.ref = null;\n __pendingSignal.type = null;\n } catch {}\n return result;\n}\n\n// --- Effect Tracking ---\n\nexport function user_effect() {\n const result = __svelte_original.user_effect.apply(null, arguments);\n try {\n const dt = __dt();\n const cid = __currentId();\n if (dt && cid !== null) {\n dt._effectCounter = (dt._effectCounter || 0) + 1;\n // Track the effect OBJECT (not the callback). The Svelte runtime\n // populates result.deps with the signals this effect depends on,\n // which is what getReactiveGraph() reads to build edges.\n dt.trackEffect(result, 'effect_' + dt._effectCounter, cid);\n }\n } catch {}\n return result;\n}\n\nexport function user_pre_effect() {\n const result = __svelte_original.user_pre_effect.apply(null, arguments);\n try {\n const dt = __dt();\n const cid = __currentId();\n if (dt && cid !== null) {\n dt._effectCounter = (dt._effectCounter || 0) + 1;\n dt.trackEffect(result, 'effect_pre_' + dt._effectCounter, cid);\n }\n } catch {}\n return result;\n}\n\n// --- Render Profiling ---\n//\n// Svelte 5 has no virtual DOM: the compiler wraps every dynamic part of a\n// template in a template_effect (deferred_template_effect for <svelte:head>\n// <title>). A re-run of such an effect IS the component updating the DOM, so\n// these two functions are the measurement points for renders / render time.\n//\n// The first run of an effect is the mount-time paint, already covered by\n// initTime, so it is skipped (initialRun). One state change re-runs several\n// effects of the same component, so durations are pooled per microtask and\n// recorded once per flush: recordRender() +1, recordRenderTime() the sum.\n\nconst __pendingRenderDurations = new Map();\nlet __renderFlushScheduled = false;\n\nfunction __flushRenderDurations() {\n __renderFlushScheduled = false;\n const dt = __dt();\n for (const [cid, duration] of __pendingRenderDurations) {\n if (dt) {\n try { dt.recordRender(cid); } catch {}\n try { dt.recordRenderTime(cid, duration); } catch {}\n }\n }\n __pendingRenderDurations.clear();\n}\n\nfunction __recordRenderDuration(cid, duration) {\n __pendingRenderDurations.set(cid, (__pendingRenderDurations.get(cid) || 0) + duration);\n if (!__renderFlushScheduled) {\n __renderFlushScheduled = true;\n queueMicrotask(__flushRenderDurations);\n }\n}\n\n// Returns a (possibly new) args array whose first element times each re-run\n// of the effect closure. The owning component is whatever id is on top of\n// __idStack at effect-creation time. User exceptions propagate untouched;\n// only the args are built inside try so the original is called exactly once.\nfunction __wrapTemplateEffect(args) {\n const cid = __currentId();\n const fn = args[0];\n if (cid === null || typeof fn !== 'function') return args;\n const wrapped = Array.prototype.slice.call(args);\n let initialRun = true;\n wrapped[0] = function () {\n if (initialRun) {\n initialRun = false;\n return fn.apply(this, arguments);\n }\n const start = performance.now();\n try {\n return fn.apply(this, arguments);\n } finally {\n try { __recordRenderDuration(cid, performance.now() - start); } catch {}\n }\n };\n return wrapped;\n}\n\nexport function template_effect() {\n let args = arguments;\n try { args = __wrapTemplateEffect(arguments); } catch {}\n return __svelte_original.template_effect.apply(null, args);\n}\n\nexport function deferred_template_effect() {\n let args = arguments;\n try { args = __wrapTemplateEffect(arguments); } catch {}\n return __svelte_original.deferred_template_effect.apply(null, args);\n}\n\n// --- Block Attribution ---\n//\n// Svelte creates render effects synchronously at creation time. At mount this\n// happens during the component function (between push/pop), so __idStack has\n// the owner. But effects for {#each} items added later or re-created {#if}\n// branches are created during a batch flush, when the stack is empty \u2014 they\n// would never be attributed. Block helpers themselves ARE always called\n// during their owner's init (or inside an outer block's callback), so the\n// owner id is on the stack at block-creation time. __wrapBlock captures it\n// and re-pushes it around every function argument the block invokes later,\n// so effects created inside land on the innermost owner. Child components\n// push their own id on top, keeping nested attribution correct.\n\nfunction __wrapBlockFn(fn, cid) {\n return function () {\n let pushed = false;\n try { __idStack.push(cid); pushed = true; } catch {}\n try {\n return fn.apply(this, arguments);\n } finally {\n if (pushed) { try { __idStack.pop(); } catch {} }\n }\n };\n}\n\nfunction __wrapBlock(args) {\n const cid = __currentId();\n if (cid === null) return args;\n const wrapped = Array.prototype.slice.call(args);\n for (let i = 0; i < wrapped.length; i++) {\n if (typeof wrapped[i] === 'function') wrapped[i] = __wrapBlockFn(wrapped[i], cid);\n }\n return wrapped;\n}\n\nexport function each() {\n let args = arguments;\n try { args = __wrapBlock(arguments); } catch {}\n return __svelte_original.each.apply(null, args);\n}\n\nexport function key() {\n let args = arguments;\n try { args = __wrapBlock(arguments); } catch {}\n return __svelte_original.key.apply(null, args);\n}\n\nexport function component() {\n let args = arguments;\n try { args = __wrapBlock(arguments); } catch {}\n return __svelte_original.component.apply(null, args);\n}\n\nexport function boundary() {\n let args = arguments;\n try { args = __wrapBlock(arguments); } catch {}\n return __svelte_original.boundary.apply(null, args);\n}\n\n// 'if' and 'await' are reserved words, so they cannot be declared as\n// function names and are exported via aliases instead.\nfunction __if_block() {\n let args = arguments;\n try { args = __wrapBlock(arguments); } catch {}\n return __svelte_original['if'].apply(null, args);\n}\n\nfunction __await_block() {\n let args = arguments;\n try { args = __wrapBlock(arguments); } catch {}\n return __svelte_original['await'].apply(null, args);\n}\n\nexport { __if_block as if, __await_block as await };\n";
|
|
19
|
+
export declare const runtimeCode = "\nif (typeof window !== 'undefined' && !window.__SVELTE_DEVTOOLS__) {\n const __SVELTE_DT = {\n _nextId: 0,\n _instances: new Map(),\n _stack: [],\n _pendingFile: null,\n _effectCounter: 0,\n _debounceTimer: null,\n _listeners: new Set(),\n\n // Phase 2: Profiling data\n _profiles: new Map(),\n _initStartTimes: new Map(),\n _profileDebounceTimer: null,\n\n // Phase 2: Reactive graph data\n _reactiveNodes: new Map(),\n _reactiveProxies: new Map(),\n\n // Phase 3: State timeline\n _stateTimeline: [],\n _stateSnapshots: new Map(),\n _timelineDebounceTimer: null,\n\n register(file) {\n const id = this._nextId++;\n const parentId = this._stack.length > 0 ? this._stack[this._stack.length - 1] : null;\n const name = file.split('/').pop()?.replace('.svelte', '') || 'Unknown';\n this._instances.set(id, { id, file, name, parentId, mounted: true, children: [] });\n if (parentId !== null) {\n const parent = this._instances.get(parentId);\n if (parent) parent.children.push(id);\n }\n this._stack.push(id);\n this._scheduleUpdate();\n return id;\n },\n\n registered(id) {\n const idx = this._stack.indexOf(id);\n if (idx !== -1) this._stack.splice(idx, 1);\n },\n\n mount(id) {\n const instance = this._instances.get(id);\n if (instance && !instance.mounted) {\n instance.mounted = true;\n this._scheduleUpdate();\n }\n },\n\n unmount(id) {\n const instance = this._instances.get(id);\n if (instance) {\n if (instance.parentId !== null) {\n const parent = this._instances.get(instance.parentId);\n if (parent) {\n parent.children = parent.children.filter(cid => cid !== id);\n }\n }\n this._removeChildren(id);\n this._cleanupComponent(id);\n }\n this._scheduleUpdate();\n this._scheduleProfileUpdate();\n },\n\n // Remounts get a fresh id, so entries keyed by a dead id would otherwise\n // survive forever \u2014 every per-component map must be purged here.\n _cleanupComponent(id) {\n this._cleanupReactiveNodes(id);\n this._instances.delete(id);\n this._profiles.delete(id);\n this._initStartTimes.delete(id);\n },\n\n _cleanupReactiveNodes(componentId) {\n for (const [nodeId, entry] of this._reactiveNodes) {\n if (entry.meta.componentId === componentId) {\n this._reactiveNodes.delete(nodeId);\n this._reactiveProxies.delete(nodeId);\n this._stateSnapshots.delete(nodeId);\n if (this._stateSnapshotStrs) this._stateSnapshotStrs.delete(nodeId);\n }\n }\n },\n\n _removeChildren(parentId) {\n const parent = this._instances.get(parentId);\n if (!parent) return;\n for (const childId of [...parent.children]) {\n this._removeChildren(childId);\n this._cleanupComponent(childId);\n }\n },\n\n _scheduleUpdate() {\n if (this._debounceTimer) clearTimeout(this._debounceTimer);\n this._debounceTimer = setTimeout(() => {\n this._sendUpdate();\n }, 100);\n },\n\n _sendUpdate() {\n const components = [];\n for (const [, instance] of this._instances) {\n if (instance.mounted) {\n components.push({\n id: instance.id,\n file: instance.file,\n name: instance.name,\n parentId: instance.parentId,\n mounted: instance.mounted,\n });\n }\n }\n if (import.meta.hot) {\n import.meta.hot.send('svelte-devtools:components', { components });\n }\n },\n\n getTree() {\n const components = [];\n for (const [, instance] of this._instances) {\n if (instance.mounted) {\n components.push({\n id: instance.id,\n file: instance.file,\n name: instance.name,\n parentId: instance.parentId,\n mounted: instance.mounted,\n });\n }\n }\n return components;\n },\n\n // --- Phase 2: Render Profiling ---\n\n startInit(id) {\n this._initStartTimes.set(id, performance.now());\n },\n\n endInit(id) {\n const start = this._initStartTimes.get(id);\n if (start === undefined) return;\n const initTime = performance.now() - start;\n this._initStartTimes.delete(id);\n const instance = this._instances.get(id);\n if (!instance) return;\n this._profiles.set(id, {\n componentId: id,\n file: instance.file,\n name: instance.name,\n initTime,\n renderCount: 0,\n totalRenderTime: 0,\n lastRenderTime: 0,\n lastRenderAt: Date.now(),\n });\n this._scheduleProfileUpdate();\n },\n\n recordRender(id) {\n const profile = this._profiles.get(id);\n if (!profile) {\n const instance = this._instances.get(id);\n if (!instance) return;\n this._profiles.set(id, {\n componentId: id,\n file: instance.file,\n name: instance.name,\n initTime: 0,\n renderCount: 1,\n totalRenderTime: 0,\n lastRenderTime: 0,\n lastRenderAt: Date.now(),\n });\n } else {\n profile.renderCount++;\n profile.lastRenderAt = Date.now();\n }\n this._scheduleProfileUpdate();\n },\n\n recordRenderTime(id, duration) {\n const profile = this._profiles.get(id);\n if (profile) {\n profile.totalRenderTime += duration;\n profile.lastRenderTime = duration;\n }\n },\n\n _scheduleProfileUpdate() {\n if (this._profileDebounceTimer) clearTimeout(this._profileDebounceTimer);\n this._profileDebounceTimer = setTimeout(() => {\n this._sendProfileUpdate();\n }, 500);\n },\n\n _sendProfileUpdate() {\n const profiles = Array.from(this._profiles.values());\n if (import.meta.hot) {\n import.meta.hot.send('svelte-devtools:profiles', { profiles });\n }\n },\n\n getProfiles() {\n return Array.from(this._profiles.values());\n },\n\n resetProfiles() {\n this._profiles.clear();\n this._scheduleProfileUpdate();\n },\n\n // --- Phase 2: Reactive Graph Tracking ---\n\n trackState(signal, name, componentId) {\n const instance = this._instances.get(componentId);\n const nodeId = componentId + ':' + name;\n this._reactiveNodes.set(nodeId, {\n signal: new WeakRef(signal),\n meta: { id: nodeId, type: 'state', name, componentId, componentFile: instance ? instance.file : '' }\n });\n },\n\n trackProxy(proxy, name, componentId) {\n const instance = this._instances.get(componentId);\n const nodeId = componentId + ':' + name;\n this._reactiveProxies.set(nodeId, new WeakRef(proxy));\n this._reactiveNodes.set(nodeId, {\n signal: new WeakRef({ v: '(proxy)', _isProxy: true }),\n meta: { id: nodeId, type: 'state', name, componentId, componentFile: instance ? instance.file : '' }\n });\n },\n\n trackDerived(signal, name, componentId) {\n const instance = this._instances.get(componentId);\n const nodeId = componentId + ':' + name;\n this._reactiveNodes.set(nodeId, {\n signal: new WeakRef(signal),\n meta: { id: nodeId, type: 'derived', name, componentId, componentFile: instance ? instance.file : '' }\n });\n },\n\n trackEffect(effect, name, componentId) {\n const instance = this._instances.get(componentId);\n const nodeId = componentId + ':' + name;\n this._reactiveNodes.set(nodeId, {\n signal: new WeakRef(effect || { v: undefined, _isEffect: true }),\n meta: { id: nodeId, type: 'effect', name, componentId, componentFile: instance ? instance.file : '' }\n });\n return effect;\n },\n\n getReactiveGraph() {\n const nodes = [];\n const edges = [];\n const signalToId = new Map();\n\n for (const [nodeId, entry] of this._reactiveNodes) {\n const signal = entry.signal.deref();\n if (!signal || !this._instances.has(entry.meta.componentId)) {\n this._reactiveNodes.delete(nodeId);\n continue;\n }\n signalToId.set(signal, nodeId);\n const node = { ...entry.meta };\n if (signal._isProxy) {\n const proxyRef = this._reactiveProxies.get(nodeId);\n const proxy = proxyRef?.deref();\n if (proxy) {\n try {\n node.value = Array.isArray(proxy) ? '[' + proxy.length + ']' : '{' + Object.keys(proxy).length + '}';\n } catch { node.value = '(proxy)'; }\n }\n } else if (node.type !== 'effect' && signal.v !== undefined && typeof signal.v !== 'symbol') {\n try {\n const v = signal.v;\n if (typeof v === 'number' || typeof v === 'string' || typeof v === 'boolean' || v === null) {\n node.value = v;\n } else {\n node.value = '(object)';\n }\n } catch { /* ignore */ }\n }\n nodes.push(node);\n }\n\n // Map proxy internal signals to their proxy node ID\n for (const [nodeId, ref] of this._reactiveProxies) {\n const proxy = ref.deref();\n if (!proxy) { this._reactiveProxies.delete(nodeId); continue; }\n const meta = this._reactiveNodes.get(nodeId)?.meta;\n if (!meta || !this._instances.has(meta.componentId)) { this._reactiveProxies.delete(nodeId); continue; }\n }\n\n // Build edges from deps\n const edgeSet = new Set();\n for (const [nodeId, entry] of this._reactiveNodes) {\n const signal = entry.signal.deref();\n if (!signal) continue;\n if (!signal.deps) continue;\n\n const visited = new Set();\n const queue = [...signal.deps];\n while (queue.length > 0) {\n const dep = queue.shift();\n if (!dep || visited.has(dep)) continue;\n visited.add(dep);\n const depId = signalToId.get(dep);\n if (depId) {\n const key = depId + '>' + nodeId;\n if (depId !== nodeId && !edgeSet.has(key)) {\n edgeSet.add(key);\n edges.push({ from: depId, to: nodeId });\n }\n } else if (dep.deps) {\n for (const d of dep.deps) queue.push(d);\n }\n }\n }\n\n return { nodes, edges };\n },\n\n sendReactiveGraph() {\n const graph = this.getReactiveGraph();\n if (import.meta.hot) {\n import.meta.hot.send('svelte-devtools:reactive-graph', graph);\n }\n },\n\n // --- Phase 3: State Timeline ---\n\n _pollStateValues() {\n for (const [nodeId, entry] of this._reactiveNodes) {\n if (entry.meta.type !== 'state') continue;\n if (!this._instances.has(entry.meta.componentId)) {\n this._reactiveNodes.delete(nodeId);\n continue;\n }\n const signal = entry.signal.deref();\n if (!signal || signal.v === undefined) continue;\n try {\n const currentVal = signal.v;\n const prev = this._stateSnapshots.get(nodeId);\n if (prev !== undefined && currentVal === prev) continue;\n const isPrimitive = currentVal === null || typeof currentVal !== 'object';\n let newSnapshot;\n if (isPrimitive) {\n if (prev !== undefined && prev === currentVal) continue;\n newSnapshot = currentVal;\n } else {\n const currStr = JSON.stringify(currentVal);\n const prevStr = this._stateSnapshotStrs?.get(nodeId);\n if (prevStr === currStr) continue;\n newSnapshot = JSON.parse(currStr);\n if (!this._stateSnapshotStrs) this._stateSnapshotStrs = new Map();\n this._stateSnapshotStrs.set(nodeId, currStr);\n }\n if (this._stateTimeline.length >= 500) this._stateTimeline.splice(0, this._stateTimeline.length - 499);\n this._stateTimeline.push({\n id: nodeId,\n name: entry.meta.name,\n componentFile: entry.meta.componentFile,\n oldValue: prev !== undefined ? prev : null,\n newValue: newSnapshot,\n timestamp: Date.now(),\n });\n this._stateSnapshots.set(nodeId, newSnapshot);\n this._scheduleTimelineUpdate();\n } catch { /* ignore non-serializable */ }\n }\n },\n\n _scheduleTimelineUpdate() {\n if (this._timelineDebounceTimer) clearTimeout(this._timelineDebounceTimer);\n this._timelineDebounceTimer = setTimeout(() => {\n if (import.meta.hot) {\n import.meta.hot.send('svelte-devtools:state-timeline', { changes: this._stateTimeline });\n }\n }, 300);\n },\n\n getStateTimeline() {\n return this._stateTimeline;\n },\n\n clearStateTimeline() {\n this._stateTimeline = [];\n this._scheduleTimelineUpdate();\n },\n\n // --- FPS Monitoring ---\n // Uses requestAnimationFrame to measure frame rate with minimal overhead.\n // Only stores timestamps - no allocations per frame beyond a single array push.\n _fpsFrameTimes: [],\n\n _fpsLoop() {\n this._fpsFrameTimes.push(performance.now());\n requestAnimationFrame(() => this._fpsLoop());\n },\n\n _sampleFps() {\n const now = performance.now();\n // Remove frame timestamps older than 1 second\n const cutoff = now - 1000;\n let i = 0;\n while (i < this._fpsFrameTimes.length && this._fpsFrameTimes[i] < cutoff) i++;\n if (i > 0) this._fpsFrameTimes.splice(0, i);\n const fps = this._fpsFrameTimes.length;\n if (import.meta.hot) {\n import.meta.hot.send('svelte-devtools:fps', { timestamp: Date.now(), fps });\n }\n }\n };\n\n window.__SVELTE_DEVTOOLS__ = __SVELTE_DT;\n\n // Poll state values for timeline\n setInterval(() => { __SVELTE_DT._pollStateValues(); }, 200);\n\n // FPS monitoring\n requestAnimationFrame(() => __SVELTE_DT._fpsLoop());\n setInterval(() => __SVELTE_DT._sampleFps(), 500);\n\n // Phase 3: Capture runtime errors\n window.addEventListener('error', (event) => {\n if (import.meta.hot) {\n import.meta.hot.send('svelte-devtools:runtime-error', {\n message: event.message,\n file: event.filename,\n line: event.lineno,\n column: event.colno,\n stack: event.error?.stack || '',\n timestamp: Date.now(),\n });\n }\n });\n window.addEventListener('unhandledrejection', (event) => {\n if (import.meta.hot) {\n const reason = event.reason;\n import.meta.hot.send('svelte-devtools:runtime-error', {\n message: reason?.message || String(reason),\n stack: reason?.stack || '',\n timestamp: Date.now(),\n });\n }\n });\n\n // Listen for reactive graph requests from server\n if (import.meta.hot) {\n import.meta.hot.on('svelte-devtools:request-reactive-graph', () => {\n __SVELTE_DT.sendReactiveGraph();\n });\n import.meta.hot.on('svelte-devtools:request-state-timeline', () => {\n import.meta.hot.send('svelte-devtools:state-timeline', { changes: __SVELTE_DT._stateTimeline });\n });\n import.meta.hot.on('svelte-devtools:clear-state-timeline', () => {\n __SVELTE_DT.clearStateTimeline();\n });\n }\n}\n";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* SvelteKit dev bypasses Vite's `transformIndexHtml`, so `@vitejs/devtools`'s
|
|
4
|
+
* `DevToolsInjection` never reaches the served HTML and the dock is invisible
|
|
5
|
+
* on every SvelteKit page. Tracked upstream at
|
|
6
|
+
* https://github.com/baseballyama/vite-devtools-repl/tree/main/sveltekit-transform-index-html-bypass
|
|
7
|
+
*
|
|
8
|
+
* As a stopgap, SvelteKit inlines `src/app.html` as a JS string literal inside
|
|
9
|
+
* `.svelte-kit/generated/server/internal.js`:
|
|
10
|
+
*
|
|
11
|
+
* templates: {
|
|
12
|
+
* app: ({ head, body, ... }) => "<!doctype html>...<body>...</body>...",
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* That file is loaded through Vite's module pipeline (`vite.ssrLoadModule`),
|
|
16
|
+
* so a regular `transform` hook can rewrite the literal to insert the dock's
|
|
17
|
+
* inject script before `</body>`. The actual `<script>` runs in the browser
|
|
18
|
+
* once the HTML is delivered, so no SSR safety guard on the inject module is
|
|
19
|
+
* needed for this path.
|
|
20
|
+
*
|
|
21
|
+
* This is intentionally narrow — SvelteKit-specific path match plus a
|
|
22
|
+
* structural assertion — and there's a test (`template-injector.test.ts`)
|
|
23
|
+
* that fails if SvelteKit's generated shape changes, so a silent break shows
|
|
24
|
+
* up in CI instead of as a missing dock in production.
|
|
25
|
+
*/
|
|
26
|
+
export declare const SVELTEKIT_INTERNAL_SUFFIX = ".svelte-kit/generated/server/internal.js";
|
|
27
|
+
/** Marker that the `templates.app` literal in SvelteKit's generated server. */
|
|
28
|
+
export declare const TEMPLATE_APP_MARKER = "templates: {";
|
|
29
|
+
/**
|
|
30
|
+
* Transform `.svelte-kit/generated/server/internal.js` to add the
|
|
31
|
+
* `@vitejs/devtools` inject script right before `</body>` inside the app
|
|
32
|
+
* template literal. Exposed for unit testing.
|
|
33
|
+
*
|
|
34
|
+
* Returns the new source if a substitution was made, or `null` to signal
|
|
35
|
+
* "nothing to do" (already injected, structural marker missing, etc.).
|
|
36
|
+
*/
|
|
37
|
+
export declare function injectIntoSvelteKitInternal(code: string): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Vite plugin: inject `@vitejs/devtools/client/inject` into SvelteKit's
|
|
40
|
+
* dev-only generated server template. Dev-only by construction.
|
|
41
|
+
*/
|
|
42
|
+
export declare function sveltekitTemplateInjector(): Plugin;
|
package/package.json
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-devtools-svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Svelte DevTools plugin for Vite DevTools",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"devtools",
|
|
7
|
+
"svelte",
|
|
8
|
+
"sveltekit",
|
|
9
|
+
"vite",
|
|
10
|
+
"vite-devtools",
|
|
11
|
+
"vite-plugin"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/baseballyama/vite-devtools-svelte#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/baseballyama/vite-devtools-svelte/issues"
|
|
16
|
+
},
|
|
5
17
|
"license": "MIT",
|
|
6
18
|
"author": "Yuichiro Yamashita",
|
|
7
19
|
"repository": {
|
|
@@ -9,21 +21,6 @@
|
|
|
9
21
|
"url": "git+https://github.com/baseballyama/vite-devtools-svelte.git",
|
|
10
22
|
"directory": "packages/vite-devtools-svelte"
|
|
11
23
|
},
|
|
12
|
-
"homepage": "https://github.com/baseballyama/vite-devtools-svelte#readme",
|
|
13
|
-
"bugs": {
|
|
14
|
-
"url": "https://github.com/baseballyama/vite-devtools-svelte/issues"
|
|
15
|
-
},
|
|
16
|
-
"keywords": [
|
|
17
|
-
"vite",
|
|
18
|
-
"vite-plugin",
|
|
19
|
-
"vite-devtools",
|
|
20
|
-
"svelte",
|
|
21
|
-
"sveltekit",
|
|
22
|
-
"devtools"
|
|
23
|
-
],
|
|
24
|
-
"engines": {
|
|
25
|
-
"node": ">=22.0.0"
|
|
26
|
-
},
|
|
27
24
|
"files": [
|
|
28
25
|
"dist",
|
|
29
26
|
"skills"
|
|
@@ -42,19 +39,22 @@
|
|
|
42
39
|
"access": "public"
|
|
43
40
|
},
|
|
44
41
|
"dependencies": {
|
|
45
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
46
|
-
"@vitejs/devtools-kit": "^0.
|
|
42
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
43
|
+
"@vitejs/devtools-kit": "^0.4.8",
|
|
47
44
|
"zod": "^4.4.3"
|
|
48
45
|
},
|
|
49
46
|
"devDependencies": {
|
|
50
47
|
"@types/node": "^25.6.2",
|
|
51
48
|
"typescript": "^6.0.3",
|
|
52
|
-
"vite": "^8.
|
|
53
|
-
"vite-plugin-dts": "^5.0.
|
|
54
|
-
"vitest": "^4.1.
|
|
49
|
+
"vite": "^8.1.5",
|
|
50
|
+
"vite-plugin-dts": "^5.0.3",
|
|
51
|
+
"vitest": "^4.1.10"
|
|
55
52
|
},
|
|
56
53
|
"peerDependencies": {
|
|
57
|
-
"vite": "^8.
|
|
54
|
+
"vite": "^8.1.5"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=22.0.0"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "vite build",
|
|
@@ -25,7 +25,7 @@ If either is missing, stop and tell the user what to do; do not invent metrics.
|
|
|
25
25
|
|
|
26
26
|
## Guardrails
|
|
27
27
|
|
|
28
|
-
- Never claim performance improved without a `compare_sessions` result. This skill produces only the
|
|
28
|
+
- Never claim performance improved without a `compare_sessions` result. This skill produces only the _before_ baseline.
|
|
29
29
|
- If `list_performance_issues` returns an empty list, say so and ask the user whether to lower thresholds or exercise additional flows — do not fabricate issues.
|
|
30
30
|
- The reactive graph view depends on the browser being open; if `get_reactive_graph_problems` returns empty categories, ask the user to keep the page open and retry.
|
|
31
31
|
- Session disposal: at the end, ask whether to keep the baseline (`keep: "memory"` for this session, or persist with `keep: "disk"`). Do not silently retain or delete.
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
function e(e){return typeof e==`string`?`'${e}'`:new t().serialize(e)}var t=function(){class e{#e=new Map;compare(e,t){let n=typeof e,r=typeof t;return n===`string`&&r===`string`?e.localeCompare(t):n===`number`&&r===`number`?e-t:String.prototype.localeCompare.call(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,r=n===Object||n===void 0?``:n.name;if(r!==``&&globalThis[r]===n)return this.serializeBuiltInType(r,e);if(typeof e.toJSON==`function`){let t=e.toJSON();return r+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}return this.serializeObjectEntries(r,Object.entries(e))}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t?.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((e,t)=>this.compare(e,t)))}`}$Map(e){return this.serializeObjectEntries(`Map`,e.entries())}}for(let t of[`Error`,`RegExp`,`URL`])e.prototype[`$`+t]=function(e){return`${t}(${e})`};for(let t of[`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`Float64Array`])e.prototype[`$`+t]=function(e){return`${t}[${e.join(`,`)}]`};for(let t of[`BigInt64Array`,`BigUint64Array`])e.prototype[`$`+t]=function(e){return`${t}[${e.join(`n,`)}${e.length>0?`n`:``}]`};return e}(),n=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],r=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`,a=[],o=class{_data=new s;_hash=new s([...n]);_nDataBytes=0;_minBufferSize=0;finalize(e){e&&this._append(e);let t=this._nDataBytes*8,n=this._data.sigBytes*8;return this._data.words[n>>>5]|=128<<24-n%32,this._data.words[(n+64>>>9<<4)+14]=Math.floor(t/4294967296),this._data.words[(n+64>>>9<<4)+15]=t,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}_doProcessBlock(e,t){let n=this._hash.words,i=n[0],o=n[1],s=n[2],c=n[3],l=n[4],u=n[5],d=n[6],f=n[7];for(let n=0;n<64;n++){if(n<16)a[n]=e[t+n]|0;else{let e=a[n-15],t=(e<<25|e>>>7)^(e<<14|e>>>18)^e>>>3,r=a[n-2],i=(r<<15|r>>>17)^(r<<13|r>>>19)^r>>>10;a[n]=t+a[n-7]+i+a[n-16]}let p=l&u^~l&d,m=i&o^i&s^o&s,h=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),g=(l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25),_=f+g+p+r[n]+a[n],v=h+m;f=d,d=u,u=l,l=c+_|0,c=s,s=o,o=i,i=_+v|0}n[0]=n[0]+i|0,n[1]=n[1]+o|0,n[2]=n[2]+s|0,n[3]=n[3]+c|0,n[4]=n[4]+l|0,n[5]=n[5]+u|0,n[6]=n[6]+d|0,n[7]=n[7]+f|0}_append(e){typeof e==`string`&&(e=s.fromUtf8(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes}_process(e){let t,n=this._data.sigBytes/64;n=e?Math.ceil(n):Math.max((n|0)-this._minBufferSize,0);let r=n*16,i=Math.min(r*4,this._data.sigBytes);if(r){for(let e=0;e<r;e+=16)this._doProcessBlock(this._data.words,e);t=this._data.words.splice(0,r),this._data.sigBytes-=i}return new s(t,i)}},s=class e{words;sigBytes;constructor(e,t){e=this.words=e||[],this.sigBytes=t===void 0?e.length*4:t}static fromUtf8(t){let n=unescape(encodeURIComponent(t)),r=n.length,i=[];for(let e=0;e<r;e++)i[e>>>2]|=(n.charCodeAt(e)&255)<<24-e%4*8;return new e(i,r)}toBase64(){let e=[];for(let t=0;t<this.sigBytes;t+=3){let n=this.words[t>>>2]>>>24-t%4*8&255,r=this.words[t+1>>>2]>>>24-(t+1)%4*8&255,a=this.words[t+2>>>2]>>>24-(t+2)%4*8&255,o=n<<16|r<<8|a;for(let n=0;n<4&&t*8+n*6<this.sigBytes*8;n++)e.push(i.charAt(o>>>6*(3-n)&63))}return e.join(``)}concat(e){if(this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4),this.sigBytes%4)for(let t=0;t<e.sigBytes;t++){let n=e.words[t>>>2]>>>24-t%4*8&255;this.words[this.sigBytes+t>>>2]|=n<<24-(this.sigBytes+t)%4*8}else for(let t=0;t<e.sigBytes;t+=4)this.words[this.sigBytes+t>>>2]=e.words[t>>>2];this.sigBytes+=e.sigBytes}};function c(e){return new o().finalize(e).toBase64()}function l(t){return c(e(t))}function u(e){return l(e)}function d(e,t){let n=`\x1B[${e}m`,r=`\x1B[${t}m`;return((e,...t)=>{if(Array.isArray(e)&&`raw`in e){let i=e,a=``;for(let e=0;e<i.length;e++)a+=i[e],e<t.length&&(a+=String(t[e]));return`${n}${a}${r}`}return`${n}${String(e)}${r}`})}var f={blue:d(34,39),cyan:d(36,39),gray:d(90,39),green:d(32,39),red:d(31,39),yellow:d(33,39),bold:d(1,22),dim:d(2,22),reset:d(0,0),underline:d(4,24)};function p(){let e={};function t(t,...n){let r=e[t]||[];for(let e=0,t=r.length;e<t;e++){let t=r[e];t&&t(...n)}}function n(n,...r){t(n,...r),delete e[n]}function r(t,n){return(e[t]||=[]).push(n),()=>{e[t]=e[t]?.filter(e=>n!==e)}}function i(e,t){let n=r(e,((...e)=>(n(),t(...e))));return n}return{_listeners:e,emit:t,emitOnce:n,on:r,once:i}}var m=`afraid.all.beige.better.big.blue.bold.brave.breezy.bright.brown.bumpy.busy.calm.chatty.chilly.chubby.clean.clear.clever.cold.common.cool.cozy.crisp.cuddly.curly.curvy.cute.cyan.dark.deep.dirty.dry.dull.eager.early.easy.eight.eighty.eleven.empty.every.fair.famous.fancy.fast.few.fiery.fifty.fine.five.flat.floppy.fluffy.forty.four.frank.free.fresh.fruity.full.funky.funny.fuzzy.gentle.giant.gold.good.goofy.great.green.grumpy.happy.heavy.hip.honest.hot.huge.humble.hungry.icy.itchy.jolly.khaki.kind.large.late.lazy.legal.lemon.light.little.long.loose.loud.lovely.lucky.major.many.metal.mighty.modern.moody.neat.new.nice.nine.ninety.odd.old.olive.open.orange.perky.petite.pink.plain.plenty.polite.pretty.proud.public.puny.purple.quick.quiet.rare.ready.real.red.rich.ripe.salty.seven.shaggy.shaky.sharp.shiny.short.shy.silent.silly.silver.six.sixty.slick.slimy.slow.small.smart.smooth.social.soft.solid.some.sour.sparkly.spicy.spotty.stale.strict.strong.sunny.sweet.swift.tall.tame.tangy.tasty.ten.tender.thick.thin.thirty.three.tidy.tiny.tired.tough.tricky.true.twelve.twenty.two.upset.vast.violet.wacky.warm.wet.whole.wicked.wide.wild.wise.witty.yellow.young.yummy`.split(`.`),h=`actors.ads.adults.aliens.animals.ants.apes.apples.areas.baboons.badgers.bags.balloons.bananas.banks.bars.baths.bats.beans.bears.beds.beers.bees.berries.bikes.birds.boats.bobcats.books.bottles.boxes.breads.brooms.buckets.bugs.buses.bushes.buttons.camels.cameras.candies.candles.canyons.carpets.carrots.cars.cases.cats.chairs.chefs.chicken.cities.clocks.cloths.clouds.clowns.clubs.coats.cobras.coins.colts.comics.cooks.corners.cougars.cows.crabs.crews.cups.cycles.dancers.days.deer.deserts.dingos.dodos.dogs.dolls.donkeys.donuts.doodles.doors.dots.dragons.drinks.dryers.ducks.eagles.ears.eels.eggs.emus.ends.experts.eyes.facts.falcons.fans.feet.files.flies.flowers.forks.foxes.friends.frogs.games.garlics.geckos.geese.ghosts.gifts.glasses.goats.grapes.groups.guests.hairs.hands.hats.heads.hoops.hornets.horses.hotels.hounds.houses.humans.icons.ideas.impalas.insects.islands.items.jars.jeans.jobs.jokes.keys.kids.kings.kiwis.knives.lamps.lands.laws.lemons.lies.lights.lilies.lines.lions.lizards.llamas.loops.mails.mammals.mangos.maps.masks.meals.melons.memes.meteors.mice.mirrors.moles.moments.monkeys.months.moons.moose.mugs.nails.needles.news.nights.numbers.olives.onions.oranges.otters.owls.pandas.pans.pants.papayas.papers.parents.parks.parrots.parts.paths.paws.peaches.pears.peas.pens.pets.phones.pianos.pigs.pillows.places.planes.planets.plants.plums.poems.poets.points.pots.pugs.pumas.queens.rabbits.radios.rats.ravens.readers.regions.results.rice.rings.rivers.rockets.rocks.rooms.roses.rules.sails.schools.seals.seas.sheep.shirts.shoes.showers.shrimps.sides.signs.singers.sites.sloths.snails.snakes.socks.spiders.spies.spoons.squids.stamps.stars.states.steaks.streets.suits.suns.swans.symbols.tables.taxes.taxis.teams.teeth.terms.things.ties.tigers.times.tips.tires.toes.tools.towns.toys.trains.trams.trees.turkeys.turtles.vans.views.walls.wasps.waves.ways.webs.weeks.windows.wings.wolves.wombats.words.worlds.worms.yaks.years.zebras.zoos`.split(`.`),g=`accept.act.add.admire.agree.allow.appear.argue.arrive.ask.attack.attend.bake.bathe.battle.beam.beg.begin.behave.bet.boil.bow.brake.brush.build.burn.buy.call.camp.care.carry.change.cheat.check.cheer.chew.clap.clean.cough.count.cover.crash.create.cross.cry.cut.dance.decide.deny.design.dig.divide.do.double.doubt.draw.dream.dress.drive.drop.drum.eat.end.enjoy.enter.exist.fail.fall.feel.fetch.film.find.fix.flash.float.flow.fly.fold.follow.fry.give.glow.go.grab.greet.grin.grow.guess.hammer.hang.happen.heal.hear.help.hide.hope.hug.hunt.invent.invite.itch.jam.jog.join.joke.judge.juggle.jump.kick.kiss.kneel.knock.know.laugh.lay.lead.learn.leave.lick.lie.like.listen.live.look.lose.love.make.march.marry.mate.matter.melt.mix.move.nail.notice.obey.occur.open.own.pay.peel.pick.play.poke.post.press.prove.pull.pump.punch.push.raise.read.refuse.relate.relax.remain.repair.repeat.reply.report.rescue.rest.retire.return.rhyme.ring.roll.rule.run.rush.say.scream.search.see.sell.send.serve.shake.share.shave.shine.shop.shout.show.sin.sing.sink.sip.sit.sleep.slide.smash.smell.smile.smoke.sneeze.sniff.sort.speak.spend.stand.stare.start.stay.stick.stop.strive.study.swim.switch.take.talk.tan.tap.taste.teach.tease.tell.thank.think.throw.tickle.tie.trade.train.travel.try.turn.type.unite.vanish.visit.wait.walk.warn.wash.watch.wave.wear.win.wink.wish.wonder.work.worry.write.yawn.yell`.split(`.`);function _(e){return e[Math.random()*e.length|0]}function v(){return`${_(m)}-${_(h)}-${_(g)}`}var ee=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`;function y(e=21){let t=``,n=e;for(;n--;)t+=ee[Math.random()*64|0];return t}var te=Symbol.for(`immer-nothing`),ne=Symbol.for(`immer-draftable`),b=Symbol.for(`immer-state`),re=[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},`This object has been frozen and should not be mutated`,function(e){return`Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? `+e},`An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.`,`Immer forbids circular references`,"The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},`Object.defineProperty() cannot be used on an Immer draft`,`Object.setPrototypeOf() cannot be used on an Immer draft`,`Immer only supports deleting array indices`,`Immer only supports setting array indices and the 'length' property`,function(e){return`'original' expects a draft, got: ${e}`}];function x(e,...t){{let n=re[e],r=A(n)?n.apply(null,t):n;throw Error(`[Immer] ${r}`)}throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var S=Object,C=S.getPrototypeOf,ie=`constructor`,ae=`prototype`,oe=`configurable`,se=`enumerable`,ce=`writable`,w=`value`,T=e=>!!e&&!!e[b];function E(e){return e?de(e)||ge(e)||!!e[ne]||!!e[ie]?.[ne]||_e(e)||ve(e):!1}var le=S[ae][ie].toString(),ue=new WeakMap;function de(e){if(!e||!k(e))return!1;let t=C(e);if(t===null||t===S[ae])return!0;let n=S.hasOwnProperty.call(t,ie)&&t[ie];if(n===Object)return!0;if(!A(n))return!1;let r=ue.get(n);return r===void 0&&(r=Function.toString.call(n),ue.set(n,r)),r===le}function fe(e,t,n=!0){D(e)===0?(n?Reflect.ownKeys(e):S.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function D(e){let t=e[b];return t?t.type_:ge(e)?1:_e(e)?2:ve(e)?3:0}var pe=(e,t,n=D(e))=>n===2?e.has(t):S[ae].hasOwnProperty.call(e,t),O=(e,t,n=D(e))=>n===2?e.get(t):e[t],me=(e,t,n,r=D(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function he(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var ge=Array.isArray,_e=e=>e instanceof Map,ve=e=>e instanceof Set,k=e=>typeof e==`object`,A=e=>typeof e==`function`,ye=e=>typeof e==`boolean`;function be(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var xe=e=>k(e)?e?.[b]:null,j=e=>e.copy_||e.base_,Se=e=>e.modified_?e.copy_:e.base_;function Ce(e,t){if(_e(e))return new Map(e);if(ve(e))return new Set(e);if(ge(e))return Array[ae].slice.call(e);let n=de(e);if(t===!0||t===`class_only`&&!n){let t=S.getOwnPropertyDescriptors(e);delete t[b];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];a[ce]===!1&&(a[ce]=!0,a[oe]=!0),(a.get||a.set)&&(t[i]={[oe]:!0,[ce]:!0,[se]:a[se],[w]:e[i]})}return S.create(C(e),t)}else{let t=C(e);if(t!==null&&n)return{...e};let r=S.create(t);return S.assign(r,e)}}function we(e,t=!1){return De(e)||T(e)||!E(e)?e:(D(e)>1&&S.defineProperties(e,{set:Ee,add:Ee,clear:Ee,delete:Ee}),S.freeze(e),t&&fe(e,(e,t)=>{we(t,!0)},!1),e)}function Te(){x(2)}var Ee={[w]:Te};function De(e){return e===null||!k(e)?!0:S.isFrozen(e)}var Oe=`MapSet`,ke=`Patches`,Ae=`ArrayMethods`,je={};function M(e){let t=je[e];return t||x(0,e),t}var Me=e=>!!je[e];function Ne(e,t){je[e]||(je[e]=t)}var N,Pe=()=>N,Fe=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Me(Oe)?M(Oe):void 0,arrayMethodsPlugin_:Me(Ae)?M(Ae):void 0});function Ie(e,t){t&&(e.patchPlugin_=M(ke),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Le(e){Re(e),e.drafts_.forEach(Be),e.drafts_=null}function Re(e){e===N&&(N=e.parent_)}var ze=e=>N=Fe(N,e);function Be(e){let t=e[b];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ve(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[b].modified_&&(Le(t),x(4)),E(e)&&(e=He(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[b].base_,e,t)}else e=He(t,n);return Ue(t,e,!0),Le(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===te?void 0:e}function He(e,t){if(De(t))return t;let n=t[b];if(!n)return Ze(t,e.handledSet_,e);if(!Ge(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);Ye(n,e)}return n.copy_}function Ue(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&we(t,n)}function We(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Ge=(e,t)=>e.scope_===t,Ke=[];function qe(e,t,n,r){let i=j(e),a=e.type_;if(r!==void 0&&O(i,r,a)===t){me(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;fe(i,(e,n)=>{if(T(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??Ke;for(let e of o)me(i,e,n,a)}function Je(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!Ge(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=Se(i);qe(e,i.draft_??i,a,n),Ye(i,r)})}function Ye(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}We(e)}}function Xe(e,t,n){let{scope_:r}=e;if(T(n)){let i=n[b];Ge(i,r)&&i.callbacks_.push(function(){it(e),qe(e,n,Se(i),t)})}else E(n)&&e.callbacks_.push(function(){let i=j(e);e.type_===3?i.has(n)&&Ze(n,r.handledSet_,r):O(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Ze(O(e.copy_,t,e.type_),r.handledSet_,r)})}function Ze(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||T(e)||t.has(e)||!E(e)||De(e)?e:(t.add(e),fe(e,(r,i)=>{if(T(i)){let t=i[b];Ge(t,n)&&(me(e,r,Se(t),e.type_),We(t))}else E(i)&&Ze(i,t,n)}),e)}function Qe(e,t){let n=ge(e),r={type_:+!!n,scope_:t?t.scope_:Pe(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=$e;n&&(i=[r],a=P);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var $e={get(e,t){if(t===b)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=j(e);if(!pe(i,t,e.type_))return tt(e,i,t);let a=i[t];if(e.finalized_||!E(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&be(t))return a;if(a===et(e.base_,t)){it(e);let n=e.type_===1?+t:t,r=ot(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in j(e)},ownKeys(e){return Reflect.ownKeys(j(e))},set(e,t,n){let r=nt(j(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=et(j(e),t),i=r?.[b];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(he(n,r)&&(n!==void 0||pe(e.base_,t,e.type_)))return!0;it(e),rt(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),Xe(e,t,n),!0)},deleteProperty(e,t){return it(e),et(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),rt(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=j(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[ce]:!0,[oe]:e.type_!==1||t!==`length`,[se]:r[se],[w]:n[t]}},defineProperty(){x(11)},getPrototypeOf(e){return C(e.base_)},setPrototypeOf(){x(12)}},P={};for(let e in $e){let t=$e[e];P[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}P.deleteProperty=function(e,t){return isNaN(parseInt(t))&&x(13),P.set.call(this,e,t,void 0)},P.set=function(e,t,n){return t!==`length`&&isNaN(parseInt(t))&&x(14),$e.set.call(this,e[0],t,n,e[0])};function et(e,t){let n=e[b];return(n?j(n):e)[t]}function tt(e,t,n){let r=nt(t,n);return r?w in r?r[w]:r.get?.call(e.draft_):void 0}function nt(e,t){if(!(t in e))return;let n=C(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=C(n)}}function rt(e){e.modified_||(e.modified_=!0,e.parent_&&rt(e.parent_))}function it(e){e.copy_||=(e.assigned_=new Map,Ce(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var at=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(A(e)&&!A(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}A(t)||x(6),n!==void 0&&!A(n)&&x(7);let r;if(E(e)){let i=ze(this),a=ot(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Le(i):Re(i)}return Ie(i,n),Ve(r,i)}else if(!e||!k(e)){if(r=t(e),r===void 0&&(r=e),r===te&&(r=void 0),this.autoFreeze_&&we(r,!0),n){let t=[],i=[];M(ke).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}else x(1,e)},this.produceWithPatches=(e,t)=>{if(A(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},ye(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),ye(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),ye(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){E(e)||x(8),T(e)&&(e=st(e));let t=ze(this),n=ot(t,e,void 0);return n[b].isManual_=!0,Re(t),n}finishDraft(e,t){let n=e&&e[b];(!n||!n.isManual_)&&x(9);let{scope_:r}=n;return Ie(r,t),Ve(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=M(ke).applyPatches_;return T(e)?r(e,t):this.produce(e,e=>r(e,t))}};function ot(e,t,n,r){let[i,a]=_e(t)?M(Oe).proxyMap_(t,n):ve(t)?M(Oe).proxySet_(t,n):Qe(t,n);return(n?.scope_??Pe()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?Je(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function st(e){return T(e)||x(10,e),ct(e)}function ct(e){if(!E(e)||De(e))return e;let t=e[b],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ce(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Ce(e,!0);return fe(n,(e,t)=>{me(n,e,ct(t))},r),t&&(t.finalized_=!1),n}function lt(){re.push(`Sets cannot have "replace" patches.`,function(e){return`Unsupported patch operation: `+e},function(e){return`Cannot apply patch, path doesn't resolve: `+e},`Patching reserved attributes like __proto__, prototype and constructor is not allowed`);function e(n,r=[]){if(n.key_!==void 0){let e=n.parent_.copy_??n.parent_.base_,t=xe(O(e,n.key_)),i=O(e,n.key_);if(i===void 0||i!==n.draft_&&i!==n.base_&&i!==n.copy_||t!=null&&t.base_!==n.base_)return null;let a=n.parent_.type_===3,o;if(a){let e=n.parent_;o=Array.from(e.drafts_.keys()).indexOf(n.key_)}else o=n.key_;if(!(a&&e.size>o||pe(e,o)))return null;r.push(o)}if(n.parent_)return e(n.parent_,r);r.reverse();try{t(n.copy_,r)}catch{return null}return r}function t(e,t){let n=e;for(let e=0;e<t.length-1;e++){let r=t[e];if(n=O(n,r),!k(n)||n===null)throw Error(`Cannot resolve path at '${t.join(`/`)}'`)}return n}let n=`replace`,r=`remove`;function i(e,t,n){if(e.scope_.processedForPatches_.has(e))return;e.scope_.processedForPatches_.add(e);let{patches_:r,inversePatches_:i}=n;switch(e.type_){case 0:case 2:return o(e,t,r,i);case 1:return a(e,t,r,i);case 3:return s(e,t,r,i)}}function a(e,t,i,a){let{base_:o,assigned_:s}=e,c=e.copy_;c.length<o.length&&([o,c]=[c,o],[i,a]=[a,i]);let l=e.allIndicesReassigned_===!0;for(let e=0;e<o.length;e++){let r=c[e],u=o[e];if((l||s?.get(e.toString()))&&r!==u){let o=r?.[b];if(o&&o.modified_)continue;let s=t.concat([e]);i.push({op:n,path:s,value:d(r)}),a.push({op:n,path:s,value:d(u)})}}for(let e=o.length;e<c.length;e++){let n=t.concat([e]);i.push({op:`add`,path:n,value:d(c[e])})}for(let e=c.length-1;o.length<=e;--e){let n=t.concat([e]);a.push({op:r,path:n})}}function o(e,t,i,a){let{base_:o,copy_:s,type_:c}=e;fe(e.assigned_,(e,l)=>{let u=O(o,e,c),f=O(s,e,c),p=l?pe(o,e)?n:`add`:r;if(u===f&&p===n)return;let m=t.concat(e);i.push(p===r?{op:p,path:m}:{op:p,path:m,value:d(f)}),a.push(p===`add`?{op:r,path:m}:p===r?{op:`add`,path:m,value:d(u)}:{op:n,path:m,value:d(u)})})}function s(e,t,n,i){let{base_:a,copy_:o}=e,s=0;a.forEach(e=>{if(!o.has(e)){let a=t.concat([s]);n.push({op:r,path:a,value:e}),i.unshift({op:`add`,path:a,value:e})}s++}),s=0,o.forEach(e=>{if(!a.has(e)){let a=t.concat([s]);n.push({op:`add`,path:a,value:e}),i.unshift({op:r,path:a,value:e})}s++})}function c(e,t,r){let{patches_:i,inversePatches_:a}=r;i.push({op:n,path:[],value:t===te?void 0:t}),a.push({op:n,path:[],value:e})}function l(e,t){return t.forEach(t=>{let{path:i,op:a}=t,o=e;for(let e=0;e<i.length-1;e++){let t=D(o),n=i[e];typeof n!=`string`&&typeof n!=`number`&&(n=``+n),(t===0||t===1)&&(n===`__proto__`||n===ie)&&x(19),A(o)&&n===ae&&x(19),o=O(o,n),k(o)||x(18,i.join(`/`))}let s=D(o),c=u(t.value),l=i[i.length-1];switch(a){case n:switch(s){case 2:return o.set(l,c);case 3:x(16);default:return o[l]=c}case`add`:switch(s){case 1:return l===`-`?o.push(c):o.splice(l,0,c);case 2:return o.set(l,c);case 3:return o.add(c);default:return o[l]=c}case r:switch(s){case 1:return o.splice(l,1);case 2:return o.delete(l);case 3:return o.delete(t.value);default:return delete o[l]}default:x(17,a)}}),e}function u(e){if(!E(e))return e;if(ge(e))return e.map(u);if(_e(e))return new Map(Array.from(e.entries()).map(([e,t])=>[e,u(t)]));if(ve(e))return new Set(Array.from(e).map(u));let t=Object.create(C(e));for(let n in e)t[n]=u(e[n]);return pe(e,ne)&&(t[ne]=e[ne]),t}function d(e){return T(e)?u(e):e}Ne(ke,{applyPatches_:l,generatePatches_:i,generateReplacementPatches_:c,getPath:e})}var F=new at,ut=F.produce,dt=F.produceWithPatches.bind(F),ft=F.applyPatches.bind(F);function pt(e){let{enablePatches:t=!1}=e,n=p(),r=e.initialValue,i=new Set;return{on:n.on,value:()=>r,patch:(e,t=y())=>{i.has(t)||(lt(),r=ft(r,e),i.add(t),n.emit(`updated`,r,void 0,t))},mutate:(e,a=y())=>{if(!i.has(a))if(i.add(a),t){let[t,i]=dt(r,e);r=t,n.emit(`updated`,r,i,a)}else r=ut(r,e),n.emit(`updated`,r,void 0,a)},syncIds:i}}var mt=typeof self==`object`?self:globalThis;function ht(e,t){let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new mt[e](t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new mt[a](o),i)};return r}function gt(e){return ht(new Map,e)(0)}var I=``,{toString:_t}={},{keys:vt}=Object;function L(e){let t=typeof e;if(t!==`object`||!e)return[0,t];let n=_t.call(e).slice(8,-1);switch(n){case`Array`:return[1,I];case`Object`:return[2,I];case`Date`:return[3,I];case`RegExp`:return[4,I];case`Map`:return[5,I];case`Set`:return[6,I];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]}function yt([e,t]){return e===0&&(t===`function`||t===`symbol`)}function bt(e,t,n,r){let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=L(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize ${s}`);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of vt(r))(e||!yt(L(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(yt(L(n))||yt(L(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!yt(L(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a}function xt(e,t={}){let n=[];return bt(!(t.json||t.lossy),!!t.json,new Map,n)(e),n}var{parse:St,stringify:Ct}=JSON,wt={json:!0,lossy:!0};function Tt(e){return gt(St(e))}function Et(e){return Ct(xt(e,wt))}function Dt(e){return gt(e)}function Ot(e){return Et(e)}function kt(e){return Tt(e)}var At=256,jt=class extends Error{name=`StreamClosedError`};function Mt(e={}){let t=e.id??y(),n=Math.max(0,e.replayWindow??0),r=p(),i=new AbortController,a=[],o=!1,s=0;function c(e){if(o)throw new jt(`Cannot write to a closed stream "${t}"`);s+=1,n>0&&(a.push({seq:s,chunk:e}),a.length>n&&a.splice(0,a.length-n)),r.emit(`chunk`,s,e)}function l(e){if(o)return;o=!0;let t=Pt(e);i.abort(e),r.emit(`end`,t)}function u(){o||(o=!0,i.signal.aborted||i.abort(`stream closed`),r.emit(`end`,void 0))}function d(e){o||i.signal.aborted||i.abort(e??`aborted`)}let f=new WritableStream({write(e){c(e)},close(){u()},abort(e){l(e)}});return{id:t,signal:i.signal,get closed(){return o},get lastSeq(){return s},write:c,error:l,close:u,abort:d,writable:f,events:r,buffer:a}}function Nt(e={}){let t=e.id??y(),n=Math.max(1,e.highWaterMark??At),r=[],i=0,a=!1,o=!1,s,c,l,u;function d(){if(c){if(r.length>0){let e=r.shift(),t=c;c=void 0,t.resolve({value:e,done:!1});return}if(a){let e=c;if(c=void 0,s){let t=Error(s.message);t.name=s.name,e.reject(t)}else e.resolve({value:void 0,done:!0})}}}function f(){if(l){for(;r.length>0;){let e=r.shift();try{l.enqueue(e)}catch{break}}if(a&&l){try{if(s){let e=Error(s.message);e.name=s.name,l.error(e)}else l.close()}catch{}l=void 0}}}function p(t,s){if(!(a||o)&&!(t<=i)){if(i=t,r.push(s),r.length>n){let t=r.length-n;r.splice(0,t),e.onOverflow?.(t)}d(),u&&f()}}function m(e){a||(a=!0,s=e,d(),u&&f())}function h(){o||a||(o=!0,e.onCancel?.(),m(void 0))}function g(){return u||(u=new ReadableStream({start(e){l=e,f()},cancel(){h()}}),u)}return{id:t,get cancelled(){return o},get done(){return a},get lastSeenSeq(){return i},get readable(){return g()},cancel:h,_push:p,_end:m,[Symbol.asyncIterator](){return{next(){if(r.length>0)return Promise.resolve({value:r.shift(),done:!1});if(a){if(s){let e=Error(s.message);return e.name=s.name,Promise.reject(e)}return Promise.resolve({value:void 0,done:!0})}return new Promise((e,t)=>{c={resolve:e,reject:t}})},return(){return h(),Promise.resolve({value:void 0,done:!0})}}}}}function Pt(e){if(e instanceof Error)return{name:e.name||`Error`,message:e.message};if(typeof e==`string`)return{name:`Error`,message:e};try{return{name:`Error`,message:JSON.stringify(e)}}catch{return{name:`Error`,message:String(e)}}}function Ft(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function It(e,...t){return typeof e==`function`?e(...t):e}var Lt=Error.captureStackTrace;function Rt(e){return e.split(`
|
|
2
|
-
`).filter(e=>!e.trimStart().startsWith(`at `)||!e.includes(`/node_modules/`)&&!e.includes(`(node:`)).join(`
|
|
3
|
-
`)}var zt=class e extends Error{name=`Diagnostic`;docs;fix;sources;get why(){return this.message}constructor(t,n=e){super(t.why,{cause:t.cause}),this.fix=t.fix,this.docs=t.docs,this.sources=t.sources,Lt?.(this,n),this.stack&&=Rt(this.stack)}toJSON(){return{name:this.name,why:this.why,fix:this.fix,docs:this.docs,sources:this.sources,cause:this.cause}}devOnly};function Bt(e){let t=e.reporters??[],n={},{docsBase:r}=e;for(let i of Object.keys(e.codes)){let a=e.codes[i],o=a.docs===!1?void 0:a.docs||(typeof r==`string`?`${r}/${i.toLowerCase()}`:r?.(i)),s=(e={},n={})=>{let r=new zt({why:It(a.why,e),fix:It(a.fix,e),docs:o,cause:e.cause,sources:e.sources},s);r.name=i;for(let e of t)e(r,n);return r};n[i]=s}return n}function Vt(e){return t=>{let n=`${e.bold(e.red(`[${t.name}]`))} ${t.message}`,r=[];return t.fix&&r.push(`${e.dim(`fix:`)} ${t.fix}`),t.sources?.length&&r.push(`${e.dim(`sources:`)} ${t.sources.join(`, `)}`),t.docs&&r.push(`${e.dim(`see:`)} ${e.cyan(t.docs)}`),r.length===0?n:[n,...r.map((t,n)=>`${e.dim(n<r.length-1?`├▶`:`╰▶`)} ${t}`)].join(`
|
|
4
|
-
`)}}var Ht=`q`,Ut=`s`;function Wt(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var Gt=Math.random.bind(Math),Kt=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`;function qt(e=21){let t=``,n=e;for(;n--;)t+=Kt[Gt()*64|0];return t}var Jt=6e4,Yt=e=>e,Xt=Yt,{clearTimeout:Zt,setTimeout:Qt}=globalThis;function $t(e,t){let{post:n,on:r,off:i=()=>{},eventNames:a=[],serialize:o=Yt,deserialize:s=Xt,resolver:c,bind:l=`rpc`,timeout:u=Jt,proxify:d=!0}=t,f=!1,p=new Map,m,h;async function g(e,r,i,a){if(f)throw Error(`[birpc] rpc is closed, cannot call "${e}"`);let s={m:e,a:r,t:Ht};a&&(s.o=!0);let c=async e=>n(o(e));if(i){await c(s);return}if(m)try{await m}finally{m=void 0}let{promise:l,resolve:d,reject:g}=Wt(),_=qt();s.i=_;let v;async function ee(n=s){return u>=0&&(v=Qt(()=>{try{if(t.onTimeoutError?.call(h,e,r)!==!0)throw Error(`[birpc] timeout on calling "${e}"`)}catch(e){g(e)}p.delete(_)},u),typeof v==`object`&&(v=v.unref?.())),p.set(_,{resolve:d,reject:g,timeoutId:v,method:e}),await c(n),l}try{t.onRequest?await t.onRequest.call(h,s,ee,d):await ee()}catch(e){if(t.onGeneralError?.call(h,e)!==!0)throw e;return}finally{Zt(v),p.delete(_)}return l}let _={$call:(e,...t)=>g(e,t,!1),$callOptional:(e,...t)=>g(e,t,!1,!0),$callEvent:(e,...t)=>g(e,t,!0),$callRaw:e=>g(e.method,e.args,e.event,e.optional),$rejectPendingCalls:ee,get $closed(){return f},get $meta(){return t.meta},$close:v,$functions:e};h=d?new Proxy({},{get(t,n){if(Object.prototype.hasOwnProperty.call(_,n))return _[n];if(n===`then`&&!a.includes(`then`)&&!(`then`in e))return;let r=(...e)=>g(n,e,!0);if(a.includes(n))return r.asEvent=r,r;let i=(...e)=>g(n,e,!1);return i.asEvent=r,i}}):_;function v(e){f=!0,p.forEach(({reject:t,method:n})=>{let r=Error(`[birpc] rpc is closed, cannot call "${n}"`);if(e)return e.cause??=r,t(e);t(r)}),p.clear(),i(y)}function ee(e){let t=Array.from(p.values()).map(({method:t,reject:n})=>e?e({method:t,reject:n}):n(Error(`[birpc]: rejected pending call "${t}".`)));return p.clear(),t}async function y(r,...i){let a;try{a=s(r)}catch(e){if(t.onGeneralError?.call(h,e)!==!0)throw e;return}if(a.t===Ht){let{m:r,a:s,o:u}=a,d,f,p=await(c?c.call(h,r,e[r]):e[r]);if(u&&(p||=()=>void 0),!p)f=Error(`[birpc] function "${r}" not found`);else try{d=await p.apply(l===`rpc`?h:e,s)}catch(e){f=e}if(a.i){if(f&&t.onFunctionError&&t.onFunctionError.call(h,f,r,s)===!0)return;if(!f)try{await n(o({t:Ut,i:a.i,r:d}),...i);return}catch(e){if(f=e,t.onGeneralError?.call(h,e,r,s)!==!0)throw e}try{await n(o({t:Ut,i:a.i,e:f}),...i)}catch(e){if(t.onGeneralError?.call(h,e,r,s)!==!0)throw e}}}else{let{i:e,r:t,e:n}=a,r=p.get(e);r&&(Zt(r.timeoutId),n?r.reject(n):r.resolve(t)),p.delete(e)}}return m=r(y),h}var en=`__connection.json`,tn=`__rpc-dump/index.json`,nn=Vt(f);function rn(e,{method:t=`warn`}={}){console[t](nn(e))}var R=Bt({docsBase:`https://devfra.me/errors`,reporters:[rn],codes:{DF0019:{why:e=>`RPC function "${e.name}" has \`agent\` set but \`jsonSerializable\` is not \`true\` — MCP requires JSON-serializable data.`,fix:"Set `jsonSerializable: true` if the payload is JSON-safe, or remove `agent` to keep it RPC-only."},DF0020:{why:e=>`RPC function "${e.name}" declares \`jsonSerializable: true\` but the value at "${e.path}" is a ${e.type}.`,fix:"Either drop `jsonSerializable: true` (falls back to structured-clone) or change the value to a JSON-safe shape."},DF0021:{why:e=>`RPC function "${e.name}" is already registered`,fix:"Use the `force` parameter to overwrite an existing registration."},DF0022:{why:e=>`RPC function "${e.name}" is not registered. Use register() to add new functions.`},DF0023:{why:e=>`RPC function "${e.name}" is not registered`},DF0024:{why:e=>`Either handler or setup function must be provided for RPC function "${e.name}"`},DF0025:{why:e=>`Function "${e.name}" not found in dump store`},DF0026:{why:e=>`No dump match for "${e.name}" with args: ${e.args}`},DF0027:{why:e=>`Function "${e.name}" with type "${e.type}" cannot have dump configuration. Only "static" and "query" types support dumps.`},DF0028:{why:e=>`Function "${e.name}" with type "${e.type}" cannot use \`snapshot: true\`. Only "query" functions support this sugar; "static" functions have equivalent default behavior already.`,fix:"Remove `snapshot: true`, or change the function type to `query`."}}});function an(e){let t=e.cause instanceof Error?e.cause:on(e.cause)?an(e.cause):e.cause,n=t===void 0?Error(e.message):Error(e.message,{cause:t});n.name=e.name;for(let t of Object.keys(e))t===`name`||t===`message`||t===`cause`||(n[t]=e[t]);return n}function on(e){return typeof e==`object`&&!!e&&typeof e.message==`string`&&typeof e.name==`string`}async function sn(e,t){return e.__resolved?e.__resolved:e.setup?(e.__promise??=Promise.resolve(e.setup(t)).then(t=>(e.__resolved=t,e.__promise=void 0,t)),e.__resolved??=await e.__promise):{}}async function cn(e,t){if(e.handler)return e.handler;let n=await sn(e,t);if(!n.handler)throw R.DF0024({name:e.name});return n.handler}var ln=class{cacheMap=new Map;options;keySerializer;constructor(e){this.options=e,this.keySerializer=e.keySerializer||(e=>u(e))}updateOptions(e){this.options={...this.options,...e}}cached(e,t){let n=this.cacheMap.get(e);if(n)return n.get(this.keySerializer(t))}apply(e,t){let n=this.cacheMap.get(e.m)||new Map;n.set(this.keySerializer(e.a),t),this.cacheMap.set(e.m,n)}validate(e){return this.options.functions.includes(e)}clear(e){e?this.cacheMap.delete(e):this.cacheMap.clear()}},un=class{context;definitions=new Map;functions;_onChanged=[];constructor(e){this.context=e;let t=this.definitions,n=this;this.functions=new Proxy({},{get(e,r){let i=t.get(r);if(i)return cn(i,n.context)},has(e,n){return t.has(n)},getOwnPropertyDescriptor(e,n){return{value:t.get(n)?.handler,configurable:!0,enumerable:!0}},ownKeys(){return Array.from(t.keys())}})}register(e,t=!1){if(this.definitions.has(e.name)&&!t)throw R.DF0021({name:e.name});dn(e),this.definitions.set(e.name,e),this._onChanged.forEach(t=>t(e.name))}update(e,t=!1){if(!this.definitions.has(e.name)&&!t)throw R.DF0022({name:e.name});dn(e),this.definitions.set(e.name,e),this._onChanged.forEach(t=>t(e.name))}onChanged(e){return this._onChanged.push(e),()=>{let t=this._onChanged.indexOf(e);t!==-1&&this._onChanged.splice(t,1)}}async getHandler(e){return await cn(this.definitions.get(e),this.context)}getSchema(e){let t=this.definitions.get(e);if(!t)throw R.DF0023({name:String(e)});return{args:t.args,returns:t.returns}}has(e){return this.definitions.has(e)}get(e){return this.definitions.get(e)}list(){return Array.from(this.definitions.keys())}};function dn(e){if(e.agent&&e.jsonSerializable!==!0)throw R.DF0019({name:e.name})}function fn(e,t=``){return JSON.stringify(e,function(e,n){let r=this,i=r==null?n:r[e];if(i===void 0){if(Array.isArray(r))throw z(t,`undefined`,r,e);return n}if(i===null)return n;if(typeof i==`bigint`)throw z(t,`BigInt`,r,e);if(typeof i==`object`){if(i instanceof Map)throw z(t,`Map`,r,e);if(i instanceof Set)throw z(t,`Set`,r,e);if(i instanceof Date)throw z(t,`Date`,r,e);if(Array.isArray(i))return n;let a=Object.getPrototypeOf(i);if(a!==null&&a!==Object.prototype)throw z(t,i.constructor?.name??`class instance`,r,e)}return n})}function z(e,t,n,r){let i=pn(n,r);return R.DF0020({name:e||`<anonymous>`,type:t,path:i})}function pn(e,t){return Array.isArray(e)?`[${t}]`:t===``?`<root>`:t}function mn(e){let t=new Map,n=new Map,r=new Set,i=e.connectionMeta.backend===`static`;function a(e,t){let r=n.get(e);return r&&typeof r==`object`&&!Array.isArray(r)&&typeof t==`object`&&!Array.isArray(t)?{...r,...t}:t}e.client.register({name:`devframe:rpc:client-state:updated`,type:`event`,handler:(e,n,r)=>{let i=t.get(e);!i||i.syncIds.has(r)||i.mutate(()=>a(e,n),r)}}),e.client.register({name:`devframe:rpc:client-state:patch`,type:`event`,handler:(e,n,r)=>{let i=t.get(e);!i||i.syncIds.has(r)||i.patch(n,r)}});function o(t,n){let r=[];return r.push(n.on(`updated`,(n,r,a)=>{i||(r?e.callEvent(`devframe:rpc:server-state:patch`,t,r,a):e.callEvent(`devframe:rpc:server-state:set`,t,n,a))})),()=>{for(let e of r)e()}}return{keys:()=>Array.from(t.keys()),onKeyAdded(e){return r.add(e),()=>{r.delete(e)}},get:async(s,c)=>{if(c?.initialValue!==void 0&&n.set(s,c.initialValue),t.has(s))return t.get(s);let l=pt({initialValue:c?.initialValue,enablePatches:!1});async function u(){if(i||e.callEvent(`devframe:rpc:server-state:subscribe`,s),c?.initialValue!==void 0){t.set(s,l);for(let e of r)e(s);return e.call(`devframe:rpc:server-state:get`,s).then(e=>{e!==void 0&&l.mutate(()=>a(s,e))}).catch(e=>{console.error(`Error getting server state`,e)}),o(s,l),l}else{let n=await e.call(`devframe:rpc:server-state:get`,s);l.mutate(()=>a(s,n)),t.set(s,l);for(let e of r)e(s);return o(s,l),l}}return new Promise(t=>{e.isTrusted?u().then(t):(t(l),e.events.on(`rpc:is-trusted:updated`,e=>{e&&u()}))})}}}function hn(e){return typeof e==`object`&&!!e&&e.type===`static`&&typeof e.path==`string`}function gn(e){return typeof e==`object`&&!!e&&e.type===`query`&&typeof e.records==`object`&&e.records!==null}function _n(e){return typeof e==`object`&&!!e&&(`output`in e||`error`in e)}function vn(e){if(e.error)throw an(e.error);return e.output}function yn(e,t){let n=new Map,r=new Map;function i(e,t){return t===`structured-clone`?Dt(e):e}async function a(e){n.has(e.path)||n.set(e.path,t(e.path).then(t=>i(t,e.serialization)));let r=await n.get(e.path);return _n(r)?vn(r):r}async function o(e,n){return r.has(e)||r.set(e,t(e).then(e=>i(e,n))),await r.get(e)}async function s(t,n){if(!(t in e))throw Error(`[devtools-rpc] Function "${t}" not found in dump store`);let r=e[t];if(hn(r)){if(n.length>0)throw Error(`[devtools-rpc] No dump match for "${t}" with args: ${JSON.stringify(n)}`);return await a(r)}if(gn(r)){let e=u(n),i=r.records[e];if(i)return vn(await o(i,r.serialization));if(r.fallback)return vn(await o(r.fallback,r.serialization));throw Error(`[devtools-rpc] No dump match for "${t}" with args: ${JSON.stringify(n)}`)}if(n.length===0)return r;throw Error(`[devtools-rpc] No dump match for "${t}" with args: ${JSON.stringify(n)}`)}return{call:async(e,t)=>await s(e,t),callOptional:async(t,n)=>{if(t in e)return await s(t,n)},callEvent:async(e,t)=>{}}}async function bn(e){let t=yn(await e.fetchJsonFromBases(tn),e.fetchJsonFromBases);return{isTrusted:!0,requestTrust:async()=>!0,requestTrustWithToken:async()=>!0,ensureTrusted:async()=>!0,call:(...e)=>t.call(e[0],e.slice(1)),callEvent:(...e)=>t.callEvent(e[0],e.slice(1)),callOptional:(...e)=>t.callOptional(e[0],e.slice(1))}}var xn=``;function Sn(e,t){return`${e}${xn}${t}`}function Cn(e){let t=new Map,n=new Map;e.client.register({name:`devframe:streaming:chunk`,type:`event`,handler(e,n,r,i){t.get(Sn(e,n))?._push(r,i)}}),e.client.register({name:`devframe:streaming:end`,type:`event`,handler(e,n,r){let i=Sn(e,n),a=t.get(i);a&&(a._end(r),t.delete(i))}}),e.client.register({name:`devframe:streaming:upload-cancel`,type:`event`,handler(e,t){let r=Sn(e,t),i=n.get(r);i&&(i.abort(`server cancelled upload`),n.delete(r))}}),e.events.on(`rpc:is-trusted:updated`,n=>{if(n)for(let[n,r]of t){if(r.cancelled||r.done)continue;let t=n.indexOf(xn);if(t<0)continue;let i=n.slice(0,t),a=n.slice(t+1);e.callEvent(`devframe:streaming:subscribe`,i,a,{afterSeq:r.lastSeenSeq})}});function r(n,r,i={}){let a=Sn(n,r),o=t.get(a);if(o)return o;let s=Nt({id:r,highWaterMark:i.highWaterMark,onOverflow(e){console.warn(`[devframe] DF0029: Stream "${n}#${r}" dropped ${e} chunk(s) after exceeding the client high-water mark.`)},onCancel(){e.callEvent(`devframe:streaming:cancel`,n,r),t.delete(a)}});if(t.set(a,s),e.isTrusted)e.callEvent(`devframe:streaming:subscribe`,n,r,{afterSeq:0});else{let i=e.events.on(`rpc:is-trusted:updated`,o=>{o&&(i(),t.has(a)&&!s.cancelled&&!s.done&&e.callEvent(`devframe:streaming:subscribe`,n,r,{afterSeq:s.lastSeenSeq}))})}return s}function i(t,r){let i=Sn(t,r),a=n.get(i);if(a)return a;let o=Mt({id:r});return o.events.on(`chunk`,(n,i)=>{e.callEvent(`devframe:streaming:upload-chunk`,t,r,n,i)}),o.events.on(`end`,a=>{e.callEvent(`devframe:streaming:upload-end`,t,r,a),n.delete(i)}),n.set(i,o),o}return{subscribe:r,upload:i}}function wn(e,t){let{channel:n,rpcOptions:r={}}=t;return $t(e,{...n,timeout:-1,...r,proxify:!1})}function Tn(){}var En=new Map;function Dn(e){let t=e.url;e.authToken&&(t=`${t}?vite_devtools_auth_token=${encodeURIComponent(e.authToken)}`);let n=new WebSocket(t),{onConnected:r=Tn,onError:i=Tn,onDisconnected:a=Tn,definitions:o=En}=e;n.addEventListener(`open`,e=>{r(e)}),n.addEventListener(`error`,e=>{i(e instanceof Error?e:Error(e.type))}),n.addEventListener(`close`,e=>{a(e)});let s=new Map;return{on:e=>{n.addEventListener(`message`,t=>{e(t.data)})},post:e=>{if(n.readyState===WebSocket.OPEN)n.send(e);else{function t(){n.send(e),n.removeEventListener(`open`,t)}n.addEventListener(`open`,t)}},serialize:e=>{let t;return e.t===`q`?t=e.m:(t=s.get(e.i),s.delete(e.i)),!(e.t===`s`&&`e`in e)&&t&&o.get(t)?.jsonSerializable===!0?fn(e,t??``):`s:${Ot(e)}`},deserialize:e=>{let t=e.startsWith(`s:`)?kt(e.slice(2)):JSON.parse(e);return t.t===`q`&&t.i&&t.m&&s.set(t.i,t.m),t}}}var On=``,kn=`?`,An=`major`,B=`model`,V=`name`,H=`type`,U=`vendor`,W=`version`,G=`architecture`,jn=`console`,K=`mobile`,q=`tablet`,J=`smarttv`,Y=`wearable`,Mn=`embedded`,Nn=500,Pn=`Amazon`,Fn=`Apple`,In=`ASUS`,Ln=`BlackBerry`,X=`Browser`,Rn=`Chrome`,zn=`Edge`,Bn=`Firefox`,Vn=`Google`,Hn=`Huawei`,Un=`LG`,Wn=`Microsoft`,Gn=`Motorola`,Kn=`Opera`,qn=`Samsung`,Jn=`Sharp`,Yn=`Sony`,Xn=`Xiaomi`,Zn=`Zebra`,Qn=`Facebook`,$n=`Chromium OS`,er=`Mac OS`;function tr(e,t={}){let n={};for(let r of Object.keys(e)){let i=t[r];i&&i.length%2==0?n[r]=[...i,...e[r]]:n[r]=e[r]}return n}function Z(e){let t={};for(let n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t}function nr(e){return e.toLowerCase()}function rr(e,t){return typeof e==`string`?nr(t).includes(nr(e)):!1}function ir(e){return typeof e==`string`?e.replace(/[^\d.]/g,On).split(`.`)[0]:void 0}function ar(e,t){let n=e.replace(/^\s+/,On);return t===void 0?n:n.substring(0,t)}function Q(e,t,n){let r=n??{};for(let n=0;n<t.length;n+=2){let i=t[n],a=t[n+1];for(let t=0;t<i.length;t++){let n=i[t];if(!n)break;let o=n.exec(e);if(o){for(let e=0;e<a.length;e++){let t=o[e+1],n=a[e];if(Array.isArray(n)){let e=n[0],i=n.length;if(i===2){let i=n[1];typeof i==`function`?r[e]=i(t,void 0,r):r[e]=i}else if(i===3){let i=n[1],a=n[2];typeof i==`function`&&!(`exec`in i)&&!(`test`in i)?r[e]=t?i(t,a,r):void 0:r[e]=t?t.replace(i,a):void 0}else i===4&&(r[e]=t?n[3](t.replace(n[1],n[2]),void 0,r):void 0)}else r[n]=t||void 0}return r}}}return r}function or(e,t){for(let n in t){let r=t[n];if(Array.isArray(r)&&r.length>0){for(let t=0;t<r.length;t++)if(rr(r[t],e))return n===kn?void 0:n}else if(rr(r,e))return n===kn?void 0:n}return e}var sr={"1.0":`/8`,"1.2":`/1`,"1.3":`/3`,"2.0":`/412`,"2.0.2":`/416`,"2.0.3":`/417`,"2.0.4":`/419`,"?":`/`},cr={ME:`4.90`,"NT 3.11":`NT3.51`,"NT 4.0":`NT4.0`,2e3:`NT 5.0`,XP:[`NT 5.1`,`NT 5.2`],Vista:`NT 6.0`,7:`NT 6.1`,8:`NT 6.2`,"8.1":`NT 6.3`,10:[`NT 6.4`,`NT 10.0`],RT:`ARM`},lr={browser:[[/\b(?:crmo|crios)\/([\w.]+)/i],[W,[V,`Chrome`]],[/edg(?:e|ios|a)?\/([\w.]+)/i],[W,[V,`Edge`]],[/(opera mini)\/([-\w.]+)/i,/(opera [mobileta]{3,6})\b.+version\/([-\w.]+)/i,/(opera)(?:.+version\/|[/ ]+)([\w.]+)/i],[V,W],[/opios[/ ]+([\w.]+)/i],[W,[V,`${Kn} Mini`]],[/\bop(?:rg)?x\/([\w.]+)/i],[W,[V,`${Kn} GX`]],[/\bopr\/([\w.]+)/i],[W,[V,Kn]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[/ ]?([\w.]+)/i],[W,[V,`Baidu`]],[/(kindle)\/([\w.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[/ ]?([\w.]*)/i,/(avant|iemobile|slim)\s?(?:browser)?[/ ]?([\w.]*)/i,/(?:ms|\()(ie) ([\w.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w.]+)/i,/(heytap|ovi)browser\/([\d.]+)/i,/(weibo)__([\d.]+)/i],[V,W],[/\bddg\/([\w.]+)/i],[W,[V,`DuckDuckGo`]],[/(?:\buc? ?browser|juc.+ucweb)[/ ]?([\w.]+)/i],[W,[V,`UC${X}`]],[/microm.+\bqbcore\/([\w.]+)/i,/\bqbcore\/([\w.]+).+microm/i,/micromessenger\/([\w.]+)/i],[W,[V,`WeChat`]],[/konqueror\/([\w.]+)/i],[W,[V,`Konqueror`]],[/trident.+rv[: ]([\w.]{1,9})\b.+like gecko/i],[W,[V,`IE`]],[/ya(?:search)?browser\/([\w.]+)/i],[W,[V,`Yandex`]],[/slbrowser\/([\w.]+)/i],[W,[V,`Smart Lenovo ${X}`]],[/(avast|avg)\/([\w.]+)/i],[[V,/(.+)/,`$1 Secure ${X}`],W],[/\bfocus\/([\w.]+)/i],[W,[V,`${Bn} Focus`]],[/\bopt\/([\w.]+)/i],[W,[V,`${Kn} Touch`]],[/coc_coc\w+\/([\w.]+)/i],[W,[V,`Coc Coc`]],[/dolfin\/([\w.]+)/i],[W,[V,`Dolphin`]],[/coast\/([\w.]+)/i],[W,[V,`${Kn} Coast`]],[/miuibrowser\/([\w.]+)/i],[W,[V,`MIUI ${X}`]],[/fxios\/([-\w.]+)/i],[W,[V,Bn]],[/\bqihu|(qi?ho{0,2}|360)browser/i],[[V,`360 ${X}`]],[/(oculus|sailfish|huawei|vivo)browser\/([\w.]+)/i],[[V,/(.+)/,`$1 ${X}`],W],[/samsungbrowser\/([\w.]+)/i],[W,[V,`${qn} Internet`]],[/(comodo_dragon)\/([\w.]+)/i],[[V,/_/g,` `],W],[/metasr[/ ]?([\d.]+)/i],[W,[V,`Sogou Explorer`]],[/(sogou)mo\w+\/([\d.]+)/i],[[V,`Sogou Mobile`],W],[/(electron)\/([\w.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w.]+))/i,/m?(qqbrowser|2345Explorer)[/ ]?([\w.]+)/i],[V,W],[/(lbbrowser)/i,/\[(linkedin)app\]/i],[V],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w.]+);)/i],[[V,Qn],W],[/(Klarna)\/([\w.]+)/i,/(kakao(?:talk|story))[/ ]([\w.]+)/i,/(naver)\(.*?(\d+\.[\w.]+).*\)/i,/safari (line)\/([\w.]+)/i,/\b(line)\/([\w.]+)\/iab/i,/(alipay)client\/([\w.]+)/i,/(twitter)(?:and| f.+e\/([\w.]+))/i,/(chromium|instagram|snapchat)[/ ]([-\w.]+)/i],[V,W],[/\bgsa\/([\w.]+) .*safari\//i],[W,[V,`GSA`]],[/musical_ly(?:.+app_?version\/|_)([\w.]+)/i],[W,[V,`TikTok`]],[/headlesschrome(?:\/([\w.]+)| )/i],[W,[V,`${Rn} Headless`]],[/ wv\).+(chrome)\/([\w.]+)/i],[[V,`${Rn} WebView`],W],[/droid.+ version\/([\w.]+)\b.+(?:mobile safari|safari)/i],[W,[V,`Android ${X}`]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w.]+)/i],[V,W],[/version\/([\w.,]+) .*mobile\/\w+ (safari)/i],[W,[V,`Mobile Safari`]],[/version\/([\w(.|,)]+) .*(mobile ?safari|safari)/i],[W,V],[/webkit.+?(mobile ?safari|safari)(\/[\w.]+)/i],[V,[W,or,sr]],[/(webkit|khtml)\/([\w.]+)/i],[V,W],[/(navigator|netscape\d?)\/([-\w.]+)/i],[[V,`Netscape`],W],[/mobile vr; rv:([\w.]+)\).+firefox/i],[W,[V,`${Bn} Reality`]],[/ekiohf.+(flow)\/([\w.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[/ ]?([\w.+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w.]+)$/i,/(firefox)\/([\w.]+)/i,/(mozilla)\/([\w.]+) .+rv:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[. ]?browser)[-/ ]?v?([\w.]+)/i,/(links) \(([\w.]+)/i,/panasonic;(viera)/i],[V,W],[/(cobalt)\/([\w.]+)/i],[V,[W,/master.|lts./,``]]],cpu:[[/(amd|x(?:(?:86|64)[-_])?|wow|win)64[;)]/i],[[G,`amd64`]],[/(ia32(?=;))/i],[[G,nr]],[/((?:i[346]|x)86)[;)]/i],[[G,`ia32`]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[G,`arm64`]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[G,`armhf`]],[/windows (ce|mobile); ppc;/i],[[G,`arm`]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[G,/ower/,On,nr]],[/(sun4\w)[;)]/i],[[G,`sparc`]],[/(avr32|ia64(?=;)|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[G,nr]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[B,[U,qn],[H,q]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?\d+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[B,[U,qn],[H,K]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[B,[U,Fn],[H,K]],[/\((ipad);[-\w),; ]+apple/i,/applecoremedia\/[\w.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[B,[U,Fn],[H,q]],[/(macintosh);/i],[B,[U,Fn]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[B,[U,Jn],[H,K]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[B,[U,Hn],[H,q]],[/(?:huawei|honor)([-\w ]+)[;)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][0-359c][adn]?)\b(?!.+d\/s)/i],[B,[U,Hn],[H,K]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?[\w ]+)(?: bui|\))/i,/oid[^)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?\d?\w?[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[B,/_/g,` `],[U,Xn],[H,K]],[/oid[^)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?pad[\w ]+)(?: bui|\))/i],[[B,/_/g,` `],[U,Xn],[H,q]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[B,[U,`OPPO`],[H,K]],[/\b(opd2\d{3}a?) bui/i],[B,[U,`OPPO`],[H,q]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[B,[U,`Vivo`],[H,K]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[B,[U,`Realme`],[H,K]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w() ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[B,[U,Gn],[H,K]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[B,[U,Gn],[H,q]],[/((?=lg)?[vl]k-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[B,[U,Un],[H,q]],[/(lm(?:-?f100[nv]?|-[\w.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?(\w+) bui/i],[B,[U,Un],[H,K]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab[\w ]+|yt[-\w]{6}|tb[-\w]{6})/i],[B,[U,`Lenovo`],[H,q]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w.]*)/i],[[B,/_/g,` `],[U,`Nokia`],[H,K]],[/(pixel c)\b/i],[B,[U,Vn],[H,q]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[B,[U,Vn],[H,K]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]?\d\.))/i],[B,[U,Yn],[H,K]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[B,`Xperia Tablet`],[U,Yn],[H,q]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[B,[U,`OnePlus`],[H,K]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[B,[U,Pn],[H,q]],[/((?:sd|kf)[0349hijor-uw]+)( bui|\)).+silk\//i],[[B,/(.+)/g,`Fire Phone $1`],[U,Pn],[H,K]],[/(playbook);[-\w),; ]+(rim)/i],[B,U,[H,q]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[B,[U,Ln],[H,K]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[B,[U,In],[H,q]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[B,[U,In],[H,K]],[/(nexus 9)/i],[B,[U,`HTC`],[H,q]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!;|\.)|sony(?!-bra))[-_ ]?([-\w]*)/i],[U,[B,/_/g,` `],[H,K]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[B,[U,`Acer`],[H,q]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[B,[U,`Meizu`],[H,K]],[/; ((?:power )?armor[\w ]{0,8})(?: bui|\))/i],[B,[U,`Ulefone`],[H,K]],[/(blackberry|benq|palm(?=-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[U,B,[H,K]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[U,B,[H,q]],[/(surface duo)/i],[B,[U,Wn],[H,q]],[/droid [\d.]+; (fp\du?)(?: b|\))/i],[B,[U,`Fairphone`],[H,K]],[/(u304aa)/i],[B,[U,`AT&T`],[H,K]],[/\bsie-(\w*)/i],[B,[U,`Siemens`],[H,K]],[/\b(rct\w+) b/i],[B,[U,`RCA`],[H,q]],[/\b(venue[\d ]{2,7}) b/i],[B,[U,`Dell`],[H,q]],[/\b(q(?:mv|ta)\w+) b/i],[B,[U,`Verizon`],[H,q]],[/\b(?:barnes[& ]+noble |bn[rt])([\w+ ]*) b/i],[B,[U,`Barnes & Noble`],[H,q]],[/\b(tm\d{3}\w+) b/i],[B,[U,`NuVision`],[H,q]],[/\b(k88) b/i],[B,[U,`ZTE`],[H,q]],[/\b(nx\d{3}j) b/i],[B,[U,`ZTE`],[H,K]],[/\b(gen\d{3}) b.+49h/i],[B,[U,`Swiss`],[H,K]],[/\b(zur\d{3}) b/i],[B,[U,`Swiss`],[H,q]],[/\b((zeki)?tb.*\b) b/i],[B,[U,`Zeki`],[H,q]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[U,`Dragon Touch`],B,[H,q]],[/\b(ns-?\w{0,9}) b/i],[B,[U,`Insignia`],[H,q]],[/\b((nxa|next)-?\w{0,9}) b/i],[B,[U,`NextBook`],[H,q]],[/\b(xtreme_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[U,`Voice`],B,[H,K]],[/\b(lvtel-)?(v1[12]) b/i],[[U,`LvTel`],B,[H,K]],[/\b(ph-1) /i],[B,[U,`Essential`],[H,K]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[B,[U,`Envizen`],[H,q]],[/\b(trio[-\w. ]+) b/i],[B,[U,`MachSpeed`],[H,q]],[/\btu_(1491) b/i],[B,[U,`Rotor`],[H,q]],[/(shield[\w ]+) b/i],[B,[U,`Nvidia`],[H,q]],[/(sprint) (\w+)/i],[U,B,[H,K]],[/(kin\.[onetw]{3})/i],[[B,/\./g,` `],[U,Wn],[H,K]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[B,[U,Zn],[H,q]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[B,[U,Zn],[H,K]],[/smart-tv.+(samsung)/i],[U,[H,J]],[/hbbtv.+maple;(\d+)/i],[[B,/^/,`SmartTV`],[U,qn],[H,J]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[U,Un],[H,J]],[/(apple) ?tv/i],[U,[B,`${Fn} TV`],[H,J]],[/crkey/i],[[B,`${Rn}cast`],[U,Vn],[H,J]],[/droid.+aft(\w+)( bui|\))/i],[B,[U,Pn],[H,J]],[/\(dtv[);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[B,[U,Jn],[H,J]],[/(bravia[\w ]+)( bui|\))/i],[B,[U,Yn],[H,J]],[/(mitv-\w{5}) bui/i],[B,[U,Xn],[H,J]],[/Hbbtv.*(technisat) (.*);/i],[U,B,[H,J]],[/\b(roku)[\dx]*[)/]((?:dvp-)?[\d.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w+ ]*; *(\w[^;]*);([^;]*)/i],[[U,ar],[B,ar],[H,J]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[H,J]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[U,B,[H,jn]],[/droid.+; (shield) bui/i],[B,[U,`Nvidia`],[H,jn]],[/(playstation [345portablevi]+)/i],[B,[U,Yn],[H,jn]],[/\b(xbox(?: one)?(?!; xbox))[); ]/i],[B,[U,Wn],[H,jn]],[/((pebble))app/i],[U,B,[H,Y]],[/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i],[B,[U,Fn],[H,Y]],[/droid.+; (glass) \d/i],[B,[U,Vn],[H,Y]],[/droid.+; (wt63?0{2,3})\)/i],[B,[U,Zn],[H,Y]],[/(quest( \d| pro)?)/i],[B,[U,Qn],[H,Y]],[/(tesla)(?: qtcarbrowser|\/[-\w.]+)/i],[U,[H,Mn]],[/(aeobc)\b/i],[B,[U,Pn],[H,Mn]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[B,[H,K]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[B,[H,q]],[/\b((tablet|tab)[;/]|focus\/\d(?!.+mobile))/i],[[H,q]],[/(phone|mobile(?:[;/]| [ \w/.]*safari)|pda(?=.+windows ce))/i],[[H,K]],[/(android[-\w. ]{0,9});.+buil/i],[B,[U,`Generic`]]],engine:[[/windows.+ edge\/([\w.]+)/i],[W,[V,`${zn}HTML`]],[/webkit\/537\.36.+chrome\/(?!27)([\w.]+)/i],[W,[V,`Blink`]],[/(presto)\/([\w.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w.]+)/i,/ekioh(flow)\/([\w.]+)/i,/(khtml|tasman|links)[/ ]\(?([\w.]+)/i,/(icab)[/ ]([23]\.[\d.]+)/i,/\b(libweb)/i],[V,W],[/rv:([\w.]{1,9})\b.+(gecko)/i],[W,V]],os:[[/microsoft (windows) (vista|xp)/i],[V,W],[/(windows (?:phone(?: os)?|mobile))[/ ]?([.\w ]*)/i],[V,[W,or,cr]],[/windows nt 6\.2; (arm)/i,/windows[/ ]?([ntce\d. ]+\w)(?!.+xbox)/i,/(?:win(?=[39n])|win 9x )([nt\d.]+)/i],[[W,or,cr],[V,`Windows`]],[/ip[honead]{2,4}\b(?:.*os (\w+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[/ ])([\d.]+)/i,/cfnetwork\/.+darwin/i],[[W,/_/g,`.`],[V,`iOS`]],[/(mac os x) ?([\w. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[V,er],[W,/_/g,`.`]],[/droid ([\w.]+)\b.+(android[- ]x86|harmonyos)/i],[W,V],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-/ ]?([\w.]*)/i,/(blackberry)\w*\/([\w.]*)/i,/(tizen|kaios)[/ ]([\w.]+)/i,/\((series40);/i],[V,W],[/\(bb(10);/i],[W,[V,Ln]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-/ ]?([\w.]*)/i],[W,[V,`Symbian`]],[/mozilla\/[\d.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w.]+)/i],[W,[V,`${Bn} OS`]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w.]+)/i],[W,[V,`webOS`]],[/watch(?: ?os[,/]|\d,\d\/)([\d.]+)/i],[W,[V,`watchOS`]],[/crkey\/([\d.]+)/i],[W,[V,`${Rn}cast`]],[/(cros) \w+(?:\)| ([\w.]+)\b)/i],[[V,$n],W],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w.]*)/i,/(mint)[/() ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-/ ]?(?!chrom|package)([-\w.]*)/i,/(hurd|linux) ?([\w.]*)/i,/(gnu) ?([\w.]*)/i,/\b([-e-hrntopcs]{0,5}bsd|dragonfly)[/ ]?(?!amd|[ix346]{1,2}86)([\w.]*)/i,/(haiku) (\w+)/i],[V,W],[/(sunos) ?([\w.]*)/i],[[V,`Solaris`],W],[/((?:open)?solaris)[-/ ]?([\w.]*)/i,/(aix) ((\d)(?=[.) ])[\w.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w.]*)/i],[V,W]]};function ur(e){return typeof e==`object`&&!!e}Object.freeze(Z([V,W,An])),Object.freeze(Z([G])),Object.freeze(Z([B,U,H,jn,K,J,q,Y,Mn])),Object.freeze(Z([V,W])),Object.freeze(Z([V,W]));function dr(){if(!(typeof window>`u`||!window.navigator))return window.navigator}function fr(e){return e.length>Nn?ar(e,Nn):e}function pr(e){if(typeof e==`string`)return{ua:fr(e),isSelfNavigator:!1,navigator:void 0,userAgentData:void 0,regexMap:lr};let t=dr(),n=fr(t&&t.userAgent?t.userAgent:On);return{ua:n,isSelfNavigator:!!(t&&t.userAgent===n),navigator:t,userAgentData:t?.userAgentData,regexMap:lr}}function mr(e,t){if(!t&&!ur(e))return pr(e);let n=dr(),r=ur(e)?void 0:e,i=ur(e)?e:t,a=fr(r||(n&&n.userAgent?n.userAgent:On)),o=n?.userAgentData;return{ua:a,isSelfNavigator:!!(n&&n.userAgent===a),navigator:n,userAgentData:o,regexMap:i?tr(lr,i):lr}}function hr(e){let t={name:void 0,version:void 0,major:void 0};return Q(e.ua,e.regexMap.browser,t),t.major=ir(t.version),e.isSelfNavigator&&e.navigator?.brave&&typeof e.navigator.brave.isBrave==`function`&&(t.name=`Brave`),t}function gr(e){let t={architecture:void 0};return Q(e.ua,e.regexMap.cpu,t),t}function _r(e){let t={vendor:void 0,model:void 0,type:void 0};return Q(e.ua,e.regexMap.device,t),e.isSelfNavigator&&!t.type&&e.userAgentData?.mobile&&(t.type=K),e.isSelfNavigator&&t.model===`Macintosh`&&e.navigator&&e.navigator.standalone!==void 0&&e.navigator.maxTouchPoints&&e.navigator.maxTouchPoints>2&&(t.model=`iPad`,t.type=q),t}function vr(e){let t={name:void 0,version:void 0};return Q(e.ua,e.regexMap.engine,t),t}function yr(e){let t={name:void 0,version:void 0};return Q(e.ua,e.regexMap.os,t),e.isSelfNavigator&&!t.name&&e.userAgentData?.platform&&e.userAgentData.platform!==`Unknown`&&(t.name=e.userAgentData.platform.replace(/chrome os/i,$n).replace(/macos/i,er)),t}function br(e,t){let n,r,i,a,o,s,c=()=>n||=mr(e,t);return{get ua(){return c().ua},get browser(){return r||=hr(c()),r},get engine(){return i||=vr(c()),i},get os(){return a||=yr(c()),a},get device(){return o||=_r(c()),o},get cpu(){return s||=gr(c()),s}}}function xr(e){return e==null?!1:`${+e}`==`${e}`}function Sr(e){let{authToken:t,connectionMeta:n,events:r,clientRpc:i,rpcOptions:a={},wsOptions:o={}}=e,s=!1,c=Ft(),l=xr(n.websocket)?`${location.protocol.replace(`http`,`ws`)}//${location.hostname}:${n.websocket}`:n.websocket,u=new Map;for(let e of n.jsonSerializableMethods??[])u.set(e,{jsonSerializable:!0});let d=wn(i.functions,{channel:Dn({url:l,authToken:t,definitions:u,...o}),rpcOptions:a});i.register({name:`devframe:auth:revoked`,type:`event`,handler:()=>{s=!1,r.emit(`rpc:is-trusted:updated`,!1)}});let f=t;async function p(e){f=e;let t=br(navigator.userAgent),n=[t.browser.name,t.browser.version,`|`,t.os.name,t.os.version,t.device.type].filter(e=>e).join(` `),i=await d.$call(`vite:anonymous:auth`,{authToken:e,ua:n,origin:location.origin});return s=i.isTrusted,c.resolve(s),r.emit(`rpc:is-trusted:updated`,s),i.isTrusted}async function m(){return s?!0:p(f)}async function h(e=6e4){if(s&&c.resolve(!0),e<=0)return c.promise;let t=()=>{};return await Promise.race([c.promise.then(t),new Promise((n,r)=>{let i=setTimeout(()=>{r(Error(`[devframe] Timeout waiting for rpc to be trusted`))},e);t=()=>clearTimeout(i)})]),s}return{get isTrusted(){return s},requestTrust:m,requestTrustWithToken:p,ensureTrusted:h,call:(...e)=>d.$call(...e),callEvent:(...e)=>d.$callEvent(...e),callOptional:(...e)=>d.$callOptional(...e)}}var Cr=`__VITE_DEVTOOLS_CONNECTION_META__`,$=`__VITE_DEVTOOLS_CONNECTION_AUTH_TOKEN__`;function wr(e){let t=[()=>e,()=>localStorage.getItem($),()=>window?.[$],()=>globalThis?.[$],()=>parent.window?.[$]],n;for(let e of t)try{if(n=e(),n)break}catch{}return n||=v(),localStorage.setItem($,n),globalThis[$]=n,n}function Tr(){let e=[()=>window?.[Cr],()=>globalThis?.[Cr],()=>parent.window?.[Cr]];for(let t of e)try{let e=t();if(e)return e}catch{}}async function Er(e={}){let{baseURL:t=`./`,rpcOptions:n={},cacheOptions:r=!1}=e,i=p(),a=Array.isArray(t)?t:[t],o=e.connectionMeta||Tr(),s=a[0]??`./`;function c(e){return e.endsWith(`/`)?e:`${e}/`}function l(e,t){return/^https?:\/\//.test(t)||t.startsWith(`/`)?t:`${c(e)}${t}`}if(!o){let e=[];for(let t of a)try{o=await fetch(l(t,en)).then(e=>e.json()),s=t,globalThis[Cr]=o;break}catch(t){e.push(t)}if(!o)throw Error(`Failed to get connection meta from ${a.join(`, `)}`,{cause:e})}let u=new ln({functions:[],...typeof e.cacheOptions==`object`?e.cacheOptions:{}}),d={rpc:void 0},f=wr(e.authToken),m=new un(d);async function h(e){let t=[s,...a.filter(e=>e!==s)].filter(e=>e!=null),n=[];for(let r of t)try{return await fetch(l(r,e)).then(t=>{if(!t.ok)throw Error(`Failed to fetch ${e} from ${r}: ${t.status}`);return t.json()})}catch(e){n.push(e)}throw Error(`Failed to load ${e} from ${t.join(`, `)}`,{cause:n})}let g=o.backend===`static`?await bn({fetchJsonFromBases:h}):Sr({authToken:f,connectionMeta:o,events:i,clientRpc:m,rpcOptions:{...n,async onRequest(e,t,i){if(await n.onRequest?.call(this,e,t,i),r&&u?.validate(e.m)){let n=u.cached(e.m,e.a);if(n)return i(n);{let n=await t(e);u?.apply(e,n)}}else await t(e)}},wsOptions:e.wsOptions}),_={events:i,get isTrusted(){return g.isTrusted},connectionMeta:o,ensureTrusted:g.ensureTrusted,requestTrust:g.requestTrust,requestTrustWithToken:async e=>(localStorage.setItem($,e),globalThis[$]=e,g.requestTrustWithToken(e)),call:g.call,callEvent:g.callEvent,callOptional:g.callOptional,client:m,sharedState:void 0,streaming:void 0,cacheManager:u};_.sharedState=mn(_),_.streaming=Cn(_),d.rpc=_,g.requestTrust();try{let e=new BroadcastChannel(`vite-devtools-auth`);e.onmessage=e=>{e.data?.type===`auth-update`&&e.data.authToken&&_.requestTrustWithToken(e.data.authToken)}}catch{}return _}export{Er as getDevToolsRpcClient};
|