@jasonshimmy/custom-elements-runtime 2.5.2 → 2.5.6

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.
Files changed (94) hide show
  1. package/README.md +115 -40
  2. package/dist/css/colors.d.ts +14 -0
  3. package/dist/custom-elements-runtime.cjs.js +6 -1
  4. package/dist/custom-elements-runtime.cjs.js.map +1 -1
  5. package/dist/custom-elements-runtime.colors.cjs.js +2 -0
  6. package/dist/custom-elements-runtime.colors.cjs.js.map +1 -0
  7. package/dist/custom-elements-runtime.colors.es.js +279 -0
  8. package/dist/custom-elements-runtime.colors.es.js.map +1 -0
  9. package/dist/custom-elements-runtime.directive-enhancements.es.js +1 -1
  10. package/dist/custom-elements-runtime.es.js +258 -166
  11. package/dist/custom-elements-runtime.es.js.map +1 -1
  12. package/dist/custom-elements-runtime.event-bus.cjs.js +1 -1
  13. package/dist/custom-elements-runtime.event-bus.cjs.js.map +1 -1
  14. package/dist/custom-elements-runtime.event-bus.es.js +28 -25
  15. package/dist/custom-elements-runtime.event-bus.es.js.map +1 -1
  16. package/dist/custom-elements-runtime.router.cjs.js +20 -20
  17. package/dist/custom-elements-runtime.router.cjs.js.map +1 -1
  18. package/dist/custom-elements-runtime.router.es.js +549 -531
  19. package/dist/custom-elements-runtime.router.es.js.map +1 -1
  20. package/dist/custom-elements-runtime.ssr.cjs.js +1 -1
  21. package/dist/custom-elements-runtime.ssr.es.js +12 -8
  22. package/dist/custom-elements-runtime.ssr.es.js.map +1 -1
  23. package/dist/custom-elements-runtime.store.cjs.js +1 -1
  24. package/dist/custom-elements-runtime.store.cjs.js.map +1 -1
  25. package/dist/custom-elements-runtime.store.es.js +5 -5
  26. package/dist/custom-elements-runtime.store.es.js.map +1 -1
  27. package/dist/custom-elements-runtime.transitions.cjs.js +1 -1
  28. package/dist/custom-elements-runtime.transitions.es.js +1 -1
  29. package/dist/event-bus.d.ts +17 -4
  30. package/dist/index.d.ts +13 -5
  31. package/dist/keep-alive.d.ts +50 -0
  32. package/dist/{logger-BuUYv7C_.js → logger-BvkEbVM4.js} +15 -11
  33. package/dist/logger-BvkEbVM4.js.map +1 -0
  34. package/dist/logger-CSALKaYm.cjs +2 -0
  35. package/dist/logger-CSALKaYm.cjs.map +1 -0
  36. package/dist/namespace-helpers-4qeKVqQw.cjs +5 -0
  37. package/dist/namespace-helpers-4qeKVqQw.cjs.map +1 -0
  38. package/dist/namespace-helpers-DcD_6_K1.js +989 -0
  39. package/dist/namespace-helpers-DcD_6_K1.js.map +1 -0
  40. package/dist/router/active-proxy.d.ts +5 -0
  41. package/dist/router/component-loader.d.ts +11 -0
  42. package/dist/router/instance.d.ts +11 -0
  43. package/dist/router/matcher.d.ts +14 -0
  44. package/dist/router/path-utils.d.ts +48 -0
  45. package/dist/router/types.d.ts +134 -0
  46. package/dist/router.d.ts +6 -208
  47. package/dist/runtime/builtin-components.d.ts +78 -0
  48. package/dist/runtime/component/element-class.d.ts +4 -0
  49. package/dist/runtime/component/factory.d.ts +39 -0
  50. package/dist/runtime/component/registry.d.ts +16 -0
  51. package/dist/runtime/component.d.ts +3 -50
  52. package/dist/runtime/discovery-state.d.ts +30 -0
  53. package/dist/runtime/hooks.d.ts +115 -0
  54. package/dist/runtime/logger.d.ts +19 -1
  55. package/dist/runtime/monitoring/health-monitor.d.ts +22 -65
  56. package/dist/runtime/reactive.d.ts +39 -7
  57. package/dist/runtime/render.d.ts +20 -4
  58. package/dist/runtime/scheduler.d.ts +69 -2
  59. package/dist/runtime/template-compiler/impl.d.ts +14 -0
  60. package/dist/runtime/template-compiler/lru-cache.d.ts +20 -0
  61. package/dist/runtime/template-compiler/props-parser.d.ts +15 -0
  62. package/dist/runtime/template-compiler/vnode-utils.d.ts +5 -0
  63. package/dist/runtime/template-compiler.d.ts +5 -28
  64. package/dist/runtime/types.d.ts +10 -0
  65. package/dist/runtime/vdom-directives.d.ts +71 -0
  66. package/dist/runtime/vdom-helpers.d.ts +126 -0
  67. package/dist/runtime/vdom-patch.d.ts +67 -0
  68. package/dist/runtime/vdom.d.ts +16 -140
  69. package/dist/ssr.d.ts +2 -1
  70. package/dist/teleport.d.ts +68 -0
  71. package/dist/template-compiler-BO8UEEDA.js +3984 -0
  72. package/dist/template-compiler-BO8UEEDA.js.map +1 -0
  73. package/dist/template-compiler-C4L8vT-6.cjs +23 -0
  74. package/dist/template-compiler-C4L8vT-6.cjs.map +1 -0
  75. package/dist/transitions-DPZiuXb9.cjs +330 -0
  76. package/dist/transitions-DPZiuXb9.cjs.map +1 -0
  77. package/dist/{transitions-Bx0Nc9zR.js → transitions-Di5wW9yc.js} +1072 -632
  78. package/dist/transitions-Di5wW9yc.js.map +1 -0
  79. package/dist/transitions.d.ts +1 -1
  80. package/package.json +18 -11
  81. package/dist/logger-BuUYv7C_.js.map +0 -1
  82. package/dist/logger-DiXdWaF-.cjs +0 -2
  83. package/dist/logger-DiXdWaF-.cjs.map +0 -1
  84. package/dist/namespace-helpers-BCVTzhAO.cjs +0 -5
  85. package/dist/namespace-helpers-BCVTzhAO.cjs.map +0 -1
  86. package/dist/namespace-helpers-CF28TyaG.js +0 -786
  87. package/dist/namespace-helpers-CF28TyaG.js.map +0 -1
  88. package/dist/template-compiler-CXHEnaBh.cjs +0 -17
  89. package/dist/template-compiler-CXHEnaBh.cjs.map +0 -1
  90. package/dist/template-compiler-DD_VZrte.js +0 -3729
  91. package/dist/template-compiler-DD_VZrte.js.map +0 -1
  92. package/dist/transitions-Bx0Nc9zR.js.map +0 -1
  93. package/dist/transitions-DfcqL-X4.cjs +0 -302
  94. package/dist/transitions-DfcqL-X4.cjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"namespace-helpers-CF28TyaG.js","sources":["../src/lib/runtime/scheduler.ts","../src/lib/runtime/reactive-proxy-cache.ts","../src/lib/runtime/reactive.ts","../src/lib/runtime/helpers.ts","../src/lib/runtime/namespace-helpers.ts"],"sourcesContent":["/**\n * Update Scheduler for batching DOM updates\n * Prevents excessive re-renders and improves performance\n */\nimport { devWarn, devError } from './logger';\n\n/**\n * Environment detection utilities\n */\ninterface TestEnvironment {\n isTest: boolean;\n isVitest: boolean;\n isCypress: boolean;\n}\n\n/**\n * Detect test environment with improved reliability\n */\nfunction detectTestEnvironment(): TestEnvironment {\n // Check Node.js environment first\n const nodeEnv = (() => {\n try {\n const process = (\n globalThis as { process?: { env?: { NODE_ENV?: string } } }\n ).process;\n return process?.env?.NODE_ENV;\n } catch {\n return undefined;\n }\n })();\n\n // Check browser test environments\n const browserTestEnv = (() => {\n try {\n if (typeof window === 'undefined')\n return { vitest: false, cypress: false };\n\n const win = window as { __vitest__?: unknown; Cypress?: unknown };\n return {\n vitest: Boolean(win.__vitest__),\n cypress: Boolean(win.Cypress),\n };\n } catch {\n return { vitest: false, cypress: false };\n }\n })();\n\n const isTest =\n nodeEnv === 'test' || browserTestEnv.vitest || browserTestEnv.cypress;\n\n return {\n isTest,\n isVitest: browserTestEnv.vitest,\n isCypress: browserTestEnv.cypress,\n };\n}\n\nclass UpdateScheduler {\n private pendingUpdates = new Map<string | (() => void), () => void>();\n private isFlushScheduled = false;\n private isFlushing = false;\n private readonly testEnv: TestEnvironment;\n private lastCleanup = 0;\n private readonly CLEANUP_INTERVAL = 5 * 60 * 1000; // 5 minutes\n private readonly MAX_PENDING_SIZE = 10000; // Prevent memory bloat\n\n constructor() {\n // Cache environment detection result to avoid repeated checks\n this.testEnv = detectTestEnvironment();\n this.schedulePeriodicCleanup();\n }\n\n /**\n * Schedule an update to be executed in the next microtask\n * Uses component identity to deduplicate multiple render requests for the same component\n */\n schedule(update: () => void, componentId?: string): void {\n // IMPORTANT: Never use update.toString() as it breaks with minification!\n // Use the componentId if provided, otherwise use the function reference directly as the key\n // since Map supports using function references as keys (identity-based comparison)\n const key = componentId || update;\n\n // Prevent memory bloat by limiting pending updates\n if (this.pendingUpdates.size >= this.MAX_PENDING_SIZE) {\n this.performEmergencyCleanup();\n }\n\n this.pendingUpdates.set(key, update);\n\n if (!this.isFlushScheduled) {\n this.scheduleFlush();\n }\n }\n\n /**\n * Schedule the flush operation based on environment\n */\n private scheduleFlush(): void {\n this.isFlushScheduled = true;\n\n if (this.testEnv.isTest && !this.isFlushing) {\n // Safe to flush synchronously in test environment to avoid timing issues\n this.flush();\n } else {\n // Batch via microtask in production or when already flushing\n queueMicrotask(() => this.flush());\n }\n }\n\n /**\n * Execute all pending updates\n */\n private flush(): void {\n // Prevent reentrant flushes\n if (this.isFlushing) {\n return;\n }\n\n this.isFlushing = true;\n\n // Capture current updates and reset state\n const updates = this.pendingUpdates;\n this.pendingUpdates = new Map();\n this.isFlushScheduled = false;\n\n try {\n // Execute all updates in batch\n for (const update of updates.values()) {\n try {\n update();\n } catch (error) {\n // Continue with other updates even if one fails\n devError('Error in batched update:', error);\n }\n }\n } finally {\n this.isFlushing = false;\n }\n }\n\n /**\n * Force flush any pending DOM updates immediately. This is useful in\n * test environments or callers that require synchronous guarantees after\n * state changes. Prefer relying on the scheduler's automatic flush when\n * possible; use this only when a caller needs to synchronously observe\n * rendered DOM changes.\n */\n flushImmediately(): void {\n if (this.pendingUpdates.size === 0) {\n return;\n }\n\n // Clear any scheduled flush since we're doing it now\n this.isFlushScheduled = false;\n this.flush();\n }\n\n /**\n * Get the number of pending updates\n */\n get pendingCount(): number {\n return this.pendingUpdates.size;\n }\n\n /**\n * Check if there are pending updates\n */\n get hasPendingUpdates(): boolean {\n return this.pendingUpdates.size > 0;\n }\n\n /**\n * Check if currently flushing updates\n */\n get isFlushingUpdates(): boolean {\n return this.isFlushing;\n }\n\n /**\n * Schedule periodic cleanup to prevent memory leaks\n */\n private schedulePeriodicCleanup(): void {\n if (this.testEnv.isTest) return; // Skip in tests\n\n const cleanup = () => {\n this.performPeriodicCleanup();\n if (!this.testEnv.isTest) {\n setTimeout(cleanup, this.CLEANUP_INTERVAL);\n }\n };\n\n setTimeout(cleanup, this.CLEANUP_INTERVAL);\n }\n\n /**\n * Perform periodic cleanup of stale entries\n */\n private performPeriodicCleanup(): void {\n const now = Date.now();\n if (now - this.lastCleanup < this.CLEANUP_INTERVAL) return;\n\n // In normal operation, pending updates should be processed quickly\n // If we have many pending updates for a long time, something might be wrong\n if (this.pendingUpdates.size > 100) {\n devWarn(\n `Scheduler has ${this.pendingUpdates.size} pending updates. Consider investigating.`,\n );\n }\n\n this.lastCleanup = now;\n }\n\n /**\n * Emergency cleanup when pending updates exceed safe limits\n */\n private performEmergencyCleanup(): void {\n devWarn(\n 'Scheduler emergency cleanup: too many pending updates, clearing oldest entries',\n );\n\n // Clear half of the pending updates (oldest first by insertion order)\n const entries = Array.from(this.pendingUpdates.entries());\n const toRemove = Math.floor(entries.length / 2);\n\n for (let i = 0; i < toRemove; i++) {\n this.pendingUpdates.delete(entries[i][0]);\n }\n }\n}\n\n// Global scheduler instance\nexport const updateScheduler = new UpdateScheduler();\n\n/**\n * Schedule a DOM update to be batched with optional component identity\n */\nexport function scheduleDOMUpdate(\n update: () => void,\n componentId?: string,\n): void {\n updateScheduler.schedule(update, componentId);\n}\n\n/**\n * Force flush any pending DOM updates immediately. This is useful in\n * test environments or callers that require synchronous guarantees after\n * state changes. Prefer relying on the scheduler's automatic flush when\n * possible; use this only when a caller needs to synchronously observe\n * rendered DOM changes.\n */\nexport function flushDOMUpdates(): void {\n updateScheduler.flushImmediately();\n}\n","/**\n * Reactive proxy cache to optimize proxy creation and reuse\n * Uses WeakMap for automatic garbage collection when objects are no longer referenced\n */\n\n/**\n * Cache for reactive proxies to avoid creating multiple proxies for the same object\n */\n// legacy symbol marker removed — use WeakSet and non-enumerable flag instead\n// Track actual proxy instances with a WeakSet for robust detection\nconst proxiedObjects = new WeakSet<object>();\n// No legacy flag: rely solely on WeakSet and WeakMap for proxy detection\n\nclass ReactiveProxyCache {\n private static cache = new WeakMap<object, object>();\n private static arrayHandlerCache = new WeakMap<\n object,\n ProxyHandler<object>\n >();\n private static objectHandlerCache = new WeakMap<\n object,\n ProxyHandler<object>\n >();\n\n /**\n * Get or create a reactive proxy for an object\n */\n static getOrCreateProxy<T extends object>(\n obj: T,\n reactiveState: {\n triggerUpdate: () => void;\n makeReactiveValue: (value: unknown) => unknown;\n },\n isArray: boolean = false,\n ): T {\n // Check if we already have a cached proxy\n const cached = this.cache.get(obj);\n if (cached) {\n return cached as T;\n }\n\n // Create appropriate handler\n const handler = isArray\n ? this.getOrCreateArrayHandler(reactiveState)\n : this.getOrCreateObjectHandler(reactiveState);\n\n // Create proxy\n const proxy = new Proxy(obj, handler);\n\n // Mark and track the proxy instance (do this via the optimizer helper)\n try {\n ProxyOptimizer.markAsProxy(proxy as Record<string | symbol, unknown>);\n } catch {\n void 0;\n }\n\n // Cache the proxy by the original target object\n this.cache.set(obj, proxy);\n\n return proxy as T;\n }\n\n /**\n * Get or create a cached array handler\n */\n private static getOrCreateArrayHandler(reactiveState: {\n triggerUpdate: () => void;\n makeReactiveValue: (value: unknown) => unknown;\n }): ProxyHandler<object> {\n // Create a unique handler for this reactive state\n if (!this.arrayHandlerCache.has(reactiveState)) {\n const handler: ProxyHandler<unknown[]> = {\n get: (target, prop, receiver) => {\n const value = Reflect.get(target, prop, receiver);\n\n // Intercept array mutating methods\n if (typeof value === 'function' && typeof prop === 'string') {\n const mutatingMethods = [\n 'push',\n 'pop',\n 'shift',\n 'unshift',\n 'splice',\n 'sort',\n 'reverse',\n 'fill',\n 'copyWithin',\n ];\n if (mutatingMethods.includes(prop)) {\n return function (...args: unknown[]) {\n const result = value.apply(target, args);\n // Trigger update after mutation\n reactiveState.triggerUpdate();\n return result;\n };\n }\n }\n\n return value;\n },\n set: (target, prop, value) => {\n (target as unknown as Record<string | symbol, unknown>)[prop] =\n reactiveState.makeReactiveValue(value);\n reactiveState.triggerUpdate();\n return true;\n },\n deleteProperty: (target, prop) => {\n delete (target as unknown as Record<string | symbol, unknown>)[prop];\n reactiveState.triggerUpdate();\n return true;\n },\n };\n\n this.arrayHandlerCache.set(reactiveState, handler);\n }\n\n return this.arrayHandlerCache.get(reactiveState)!;\n }\n\n /**\n * Get or create a cached object handler\n */\n private static getOrCreateObjectHandler(reactiveState: {\n triggerUpdate: () => void;\n makeReactiveValue: (value: unknown) => unknown;\n }): ProxyHandler<object> {\n // Create a unique handler for this reactive state\n if (!this.objectHandlerCache.has(reactiveState)) {\n const handler: ProxyHandler<Record<string | symbol, unknown>> = {\n get: (target, prop, receiver) => {\n return Reflect.get(target, prop, receiver);\n },\n set: (target, prop, value) => {\n (target as Record<string | symbol, unknown>)[prop] =\n reactiveState.makeReactiveValue(value);\n reactiveState.triggerUpdate();\n return true;\n },\n deleteProperty: (target, prop) => {\n delete (target as Record<string | symbol, unknown>)[prop];\n reactiveState.triggerUpdate();\n return true;\n },\n };\n\n this.objectHandlerCache.set(reactiveState, handler);\n }\n\n return this.objectHandlerCache.get(reactiveState)!;\n }\n\n /**\n * Check if an object already has a cached proxy\n */\n static hasProxy(obj: object): boolean {\n return this.cache.has(obj);\n }\n\n /**\n * Clear all cached proxies (useful for testing)\n */\n static clear(): void {\n this.cache = new WeakMap();\n this.arrayHandlerCache = new WeakMap();\n this.objectHandlerCache = new WeakMap();\n }\n\n /**\n * Get cache statistics (for debugging)\n * Note: WeakMap doesn't provide size, so this is limited\n */\n static getStats(): { hasCachedProxies: boolean } {\n // WeakMap doesn't expose size, but we can check if we have any handlers cached\n return {\n hasCachedProxies: this.cache instanceof WeakMap,\n };\n }\n}\n\n/**\n * Optimized proxy creation utilities\n */\nclass ProxyOptimizer {\n // Cache a stable reactiveContext object keyed by onUpdate -> makeReactive\n // This allows handler caches in ReactiveProxyCache to reuse handlers\n // for identical reactive contexts instead of creating a new context object\n // on each createReactiveProxy call.\n private static contextCache = new WeakMap<\n (...args: unknown[]) => unknown,\n WeakMap<\n (...args: unknown[]) => unknown,\n {\n triggerUpdate: () => void;\n makeReactiveValue: (value: unknown) => unknown;\n }\n >\n >();\n /**\n * Create an optimized reactive proxy with minimal overhead\n */\n static createReactiveProxy<T extends object>(\n obj: T,\n onUpdate: () => void,\n makeReactive: (value: unknown) => unknown,\n ): T {\n // If the argument is already a proxy instance, return it directly.\n try {\n if (proxiedObjects.has(obj)) return obj;\n } catch {\n // ignore\n }\n\n const isArray = Array.isArray(obj);\n\n // Reuse a stable reactiveContext object per (onUpdate, makeReactive) pair.\n let inner = this.contextCache.get(onUpdate);\n if (!inner) {\n inner = new WeakMap();\n this.contextCache.set(onUpdate, inner);\n }\n let reactiveContext = inner.get(makeReactive);\n if (!reactiveContext) {\n reactiveContext = {\n triggerUpdate: onUpdate,\n makeReactiveValue: makeReactive,\n };\n inner.set(makeReactive, reactiveContext);\n }\n\n // Delegate to the cache which will return an existing proxy for the target\n // or create one if it doesn't exist yet.\n return ReactiveProxyCache.getOrCreateProxy(obj, reactiveContext, isArray);\n }\n\n /**\n * Mark an object as a proxy (for optimization)\n */\n static markAsProxy(obj: object): void {\n if (!obj) return;\n\n // Prefer adding the actual proxy instance to the WeakSet which does not trigger proxy traps\n try {\n proxiedObjects.add(obj);\n } catch {\n // ignore\n }\n }\n}\n\nexport { ReactiveProxyCache, ProxyOptimizer };\n","import { scheduleDOMUpdate } from './scheduler';\nimport { ProxyOptimizer } from './reactive-proxy-cache';\nimport { devWarn } from './logger';\n\n/**\n * Global reactive system for tracking dependencies and triggering updates\n */\nclass ReactiveSystem {\n // Use a stack to support nested callers (component render -> watcher)\n // so that watchers can temporarily become the \"current component\" while\n // establishing dependencies without clobbering the outer component id.\n private currentComponentStack: string[] = [];\n // Consolidated component data: stores dependencies, render function, state index, and last warning time\n private componentData = new Map<\n string,\n {\n dependencies: Set<ReactiveState<unknown>>;\n renderFn: () => void;\n stateIndex: number;\n lastWarnTime: number;\n // watchers registered by the component during render\n watchers: Map<string, string>;\n }\n >();\n // Flat storage: compound key `${componentId}:${stateIndex}` -> ReactiveState\n private stateStorage = new Map<string, ReactiveState<unknown>>();\n private trackingDisabled = false;\n\n /**\n * Set the current component being rendered for dependency tracking\n */\n setCurrentComponent(componentId: string, renderFn: () => void): void {\n // Push onto the stack so nested calls can restore previous component\n this.currentComponentStack.push(componentId);\n // (no-op) push logged in debug builds\n if (!this.componentData.has(componentId)) {\n this.componentData.set(componentId, {\n dependencies: new Set(),\n renderFn,\n stateIndex: 0,\n lastWarnTime: 0,\n watchers: new Map(),\n });\n } else {\n const data = this.componentData.get(componentId)!;\n // Clean up watchers from previous renders so they don't accumulate\n if (data.watchers && data.watchers.size) {\n for (const wid of data.watchers.values()) {\n try {\n this.cleanup(wid);\n } catch {\n // swallow\n }\n }\n data.watchers.clear();\n }\n data.renderFn = renderFn;\n data.stateIndex = 0; // Reset state index for this render\n }\n }\n\n /**\n * Clear the current component after rendering\n */\n clearCurrentComponent(): void {\n // Pop the current component off the stack and restore the previous one\n this.currentComponentStack.pop();\n }\n\n /**\n * Get the current component id (top of stack) or null\n */\n getCurrentComponentId(): string | null {\n return this.currentComponentStack.length\n ? this.currentComponentStack[this.currentComponentStack.length - 1]\n : null;\n }\n\n /**\n * Register a watcher id under a component so it can be cleaned up on re-render\n */\n registerWatcher(componentId: string, watcherId: string): void {\n const data = this.componentData.get(componentId);\n if (!data) return;\n data.watchers.set(watcherId, watcherId);\n }\n\n /**\n * Temporarily disable dependency tracking\n */\n disableTracking(): void {\n this.trackingDisabled = true;\n }\n\n /**\n * Re-enable dependency tracking\n */\n enableTracking(): void {\n this.trackingDisabled = false;\n }\n\n /**\n * Check if a component is currently rendering\n */\n isRenderingComponent(): boolean {\n return this.currentComponentStack.length > 0;\n }\n\n /**\n * Return whether we should emit a render-time warning for the current component.\n * This throttles warnings to avoid spamming the console for legitimate rapid updates.\n */\n shouldEmitRenderWarning(): boolean {\n const current = this.currentComponentStack.length\n ? this.currentComponentStack[this.currentComponentStack.length - 1]\n : null;\n if (!current) return true;\n const data = this.componentData.get(current);\n if (!data) return true;\n\n const now = Date.now();\n const THROTTLE_MS = 1000; // 1 second per component\n if (now - data.lastWarnTime < THROTTLE_MS) return false;\n\n data.lastWarnTime = now;\n return true;\n }\n\n /**\n * Execute a function with tracking disabled\n */\n withoutTracking<T>(fn: () => T): T {\n const wasDisabled = this.trackingDisabled;\n this.trackingDisabled = true;\n try {\n return fn();\n } finally {\n this.trackingDisabled = wasDisabled;\n }\n }\n\n /**\n * Get or create a state instance for the current component\n */\n getOrCreateState<T>(initialValue: T): ReactiveState<T> {\n const current = this.currentComponentStack.length\n ? this.currentComponentStack[this.currentComponentStack.length - 1]\n : null;\n if (!current) {\n return new ReactiveState(initialValue);\n }\n\n const data = this.componentData.get(current);\n if (!data) {\n return new ReactiveState(initialValue);\n }\n const stateKey = `${current}:${data.stateIndex++}`;\n let state = this.stateStorage.get(stateKey) as ReactiveState<T> | undefined;\n\n if (!state) {\n state = new ReactiveState(initialValue);\n this.stateStorage.set(stateKey, state);\n }\n\n return state;\n }\n\n /**\n * Track a dependency for the current component\n */\n trackDependency(state: ReactiveState<unknown>): void {\n if (this.trackingDisabled) return;\n const current = this.currentComponentStack.length\n ? this.currentComponentStack[this.currentComponentStack.length - 1]\n : null;\n if (!current) return;\n\n const data = this.componentData.get(current);\n if (data) {\n data.dependencies.add(state);\n state.addDependent(current);\n // dependency tracked\n }\n }\n\n /**\n * Trigger updates for all components that depend on a state\n */\n triggerUpdate(state: ReactiveState<unknown>): void {\n const deps = state.getDependents();\n // trigger update for dependents\n for (const componentId of deps) {\n const data = this.componentData.get(componentId);\n if (data) {\n scheduleDOMUpdate(data.renderFn, componentId);\n }\n }\n }\n\n /**\n * Clean up component dependencies when component is destroyed\n */\n cleanup(componentId: string): void {\n const data = this.componentData.get(componentId);\n if (data) {\n for (const state of data.dependencies) {\n state.removeDependent(componentId);\n }\n this.componentData.delete(componentId);\n }\n // Remove any flat-stored state keys for this component\n const prefix = componentId + ':';\n for (const key of this.stateStorage.keys()) {\n if (key.startsWith(prefix)) {\n this.stateStorage.delete(key);\n }\n }\n }\n}\n\nconst reactiveSystem = new ReactiveSystem();\n\n// Export for internal use\nexport { reactiveSystem };\n\n/**\n * Internal reactive state class\n */\nexport class ReactiveState<T> {\n private _value: T;\n private dependents = new Set<string>();\n\n constructor(initialValue: T) {\n this._value = this.makeReactive(initialValue);\n // Mark instances with a stable cross-bundle symbol so other modules\n // can reliably detect ReactiveState objects even when classes are\n // renamed/minified or when multiple copies of the package exist.\n try {\n // Use a global symbol key to make it resilient across realms/bundles\n const key = Symbol.for('@cer/ReactiveState');\n Object.defineProperty(this, key, {\n value: true,\n enumerable: false,\n configurable: false,\n });\n } catch {\n // ignore if Symbol.for or defineProperty fails in exotic runtimes\n }\n }\n\n get value(): T {\n // Track this state as a dependency when accessed during render\n reactiveSystem.trackDependency(this);\n return this._value;\n }\n\n set value(newValue: T) {\n // Check for state modifications during render (potential infinite loop)\n if (reactiveSystem.isRenderingComponent()) {\n if (reactiveSystem.shouldEmitRenderWarning()) {\n devWarn(\n '🚨 State modification detected during render! This can cause infinite loops.\\n' +\n ' • Move state updates to event handlers\\n' +\n ' • Use useEffect/watch for side effects\\n' +\n \" • Ensure computed properties don't modify state\",\n );\n }\n }\n\n this._value = this.makeReactive(newValue);\n // Trigger updates for all dependent components\n reactiveSystem.triggerUpdate(this);\n }\n\n addDependent(componentId: string): void {\n this.dependents.add(componentId);\n }\n\n removeDependent(componentId: string): void {\n this.dependents.delete(componentId);\n }\n\n getDependents(): Set<string> {\n return this.dependents;\n }\n\n private makeReactive<U>(obj: U): U {\n if (obj === null || typeof obj !== 'object') {\n return obj;\n }\n\n // Skip reactivity for DOM nodes - they should not be made reactive\n if (\n (obj as unknown) instanceof Node ||\n (obj as unknown) instanceof Element ||\n (obj as unknown) instanceof HTMLElement\n ) {\n return obj;\n }\n\n // Use optimized proxy creation\n return ProxyOptimizer.createReactiveProxy(\n obj as unknown as object,\n () => reactiveSystem.triggerUpdate(this),\n (value: unknown) => this.makeReactive(value),\n ) as U;\n }\n}\n\n/**\n * Create reactive state that automatically triggers component re-renders\n * when accessed during render and modified afterwards.\n * Defaults to null if no initial value is provided (Vue-style ref).\n *\n * @example\n * ```ts\n * const counter = ref(0);\n * const user = ref({ name: 'John', age: 30 });\n * const emptyRef = ref(); // defaults to null\n *\n * // Usage in component\n * counter.value++; // triggers re-render\n * user.value.name = 'Jane'; // triggers re-render\n * console.log(emptyRef.value); // null\n * ```\n */\nexport function ref(): ReactiveState<null>;\nexport function ref<T>(initialValue: T): ReactiveState<T>;\nexport function ref<T>(initialValue?: T): ReactiveState<T | null> {\n // Ensure the created state has the union type T | null and explicitly\n // tell getOrCreateState the correct generic to avoid conditional-type recursion.\n return reactiveSystem.getOrCreateState<T | null>(\n (initialValue === undefined ? null : (initialValue as T)) as T | null,\n );\n}\n\n/**\n * Type guard to detect ReactiveState instances in a robust way that works\n * across bundlers, minifiers, and multiple package copies.\n */\nexport function isReactiveState(v: unknown): v is ReactiveState<unknown> {\n if (!v || typeof v !== 'object') return false;\n try {\n const key = Symbol.for('@cer/ReactiveState');\n // Safely check for the presence of the symbol-keyed property without indexing with a unique symbol\n return Object.prototype.hasOwnProperty.call(v, key);\n } catch {\n return false;\n }\n}\n\n/**\n * Create computed state that derives from other reactive state\n *\n * @example\n * ```ts\n * const firstName = ref('John');\n * const lastName = ref('Doe');\n * const fullName = computed(() => `${firstName.value} ${lastName.value}`);\n * ```\n */\nexport function computed<T>(fn: () => T): { readonly value: T } {\n const computedState = new ReactiveState(fn());\n\n // We need to track dependencies when the computed function runs\n // For now, we'll re-evaluate on every access (can be optimized later)\n return {\n get value(): T {\n reactiveSystem.trackDependency(computedState as ReactiveState<unknown>);\n return fn();\n },\n };\n}\n\n/**\n * Create a watcher that runs when dependencies change\n *\n * @example\n * ```ts\n * const count = ref(0);\n * watch(() => count.value, (newVal, oldVal) => {\n * console.log(`Count changed from ${oldVal} to ${newVal}`);\n * });\n * ```\n */\nexport function watch<T>(\n source: ReactiveState<T>,\n callback: (newValue: T, oldValue?: T) => void,\n options?: { immediate?: boolean },\n): () => void;\nexport function watch<T>(\n source: () => T,\n callback: (newValue: T, oldValue?: T) => void,\n options?: { immediate?: boolean },\n): () => void;\nexport function watch<T>(\n source: ReactiveState<T> | (() => T),\n callback: (newValue: T, oldValue?: T) => void,\n options?: { immediate?: boolean },\n): () => void {\n // Note: we must establish reactive dependencies first (a tracked\n // call) and only then capture the initial `oldValue`. Capturing\n // `oldValue` before registering as a dependent means the first\n // tracked value may differ and lead to missed or spurious callbacks.\n let oldValue: T;\n // Normalize source: accept either a ReactiveState or a getter function\n const getter: () => T = ((): (() => T) => {\n // runtime check for ReactiveState instances\n if (isReactiveState(source)) {\n // cast to ReactiveState<T> and return getter\n return () => (source as ReactiveState<T>).value;\n }\n return source as () => T;\n })();\n\n // Create a dummy component to track dependencies\n const watcherId = `watch-${Math.random().toString(36).substr(2, 9)}`;\n\n // If called during a component render, register this watcher under that\n // component so watchers created in render are cleaned up on re-render.\n try {\n const parentComp = reactiveSystem.getCurrentComponentId();\n if (parentComp) {\n reactiveSystem.registerWatcher(parentComp, watcherId);\n }\n } catch {\n /* ignore */\n }\n\n const updateWatcher = () => {\n reactiveSystem.setCurrentComponent(watcherId, updateWatcher);\n const newValue = getter();\n reactiveSystem.clearCurrentComponent();\n\n if (newValue !== oldValue) {\n callback(newValue, oldValue);\n oldValue = newValue;\n }\n };\n\n // Initial run to establish dependencies\n reactiveSystem.setCurrentComponent(watcherId, updateWatcher);\n // Capture the tracked initial value as the baseline\n oldValue = getter();\n reactiveSystem.clearCurrentComponent();\n\n // If immediate is requested, invoke the callback once with the\n // current value as `newValue` and `undefined` as the previous value\n // to match Vue's common semantics.\n if (options && options.immediate) {\n callback(oldValue, undefined);\n }\n\n // Return cleanup function\n return () => {\n reactiveSystem.cleanup(watcherId);\n };\n}\n","/**\n * Safe execution helper - silently ignores errors\n */\nexport const safe = (fn: () => void): void => {\n try {\n fn();\n } catch {\n void 0;\n }\n};\n\nimport { isReactiveState } from './reactive';\nimport { devWarn } from './logger';\n\n// Caches for string transformations to improve performance\nconst KEBAB_CASE_CACHE = new Map<string, string>();\nconst CAMEL_CASE_CACHE = new Map<string, string>();\nconst HTML_ESCAPE_CACHE = new Map<string, string>();\n\n// Cache size limits to prevent memory bloat\nconst MAX_CACHE_SIZE = 500;\n\n// Module-level state for entity map and loader. Using module-level vars avoids\n// reliance on attaching properties to functions which can be brittle when\n// minifiers are configured to mangle properties.\nlet _namedEntityMap: Record<string, string> | undefined;\n// eslint-disable-next-line prefer-const\nlet _namedEntityMapLoader: (() => Promise<Record<string, string>>) | undefined;\nlet _usedEntityFallback = false;\nlet _warnedEntityFallback = false;\n// Module-level decode element used in browser environments to avoid attaching\n// an element to the function object (function properties can be mangled by\n// aggressive minifiers). Keep a function-attached reference only for backward\n// compatibility but prefer `_decodeEl` at runtime.\nlet _decodeEl: HTMLDivElement | undefined;\n// NOTE (internal): The runtime prefers module-level state for the entity map\n// and decode element to ensure minifier-safe behavior in production builds.\n// We intentionally retain assignments to function-attached properties in a\n// few places solely for backward compatibility with older tests and code\n// paths. New code should rely on `registerEntityMap`, `loadEntityMap`, and\n// the exported `decodeEntities` function rather than inspecting internal\n// function properties.\n// Use globalThis to avoid TypeScript requiring Node typings for `process`.\nconst _isNode = !!(globalThis as { process?: { versions?: { node?: string } } })\n .process?.versions?.node;\n\n/**\n * Convert camelCase to kebab-case with caching\n */\nexport function toKebab(str: string): string {\n if (KEBAB_CASE_CACHE.has(str)) {\n return KEBAB_CASE_CACHE.get(str)!;\n }\n\n const result = str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n\n // Prevent memory bloat with size limit\n if (KEBAB_CASE_CACHE.size < MAX_CACHE_SIZE) {\n KEBAB_CASE_CACHE.set(str, result);\n }\n\n return result;\n}\n\n/**\n * Convert kebab-case to camelCase with caching\n */\nexport function toCamel(str: string): string {\n if (CAMEL_CASE_CACHE.has(str)) {\n return CAMEL_CASE_CACHE.get(str)!;\n }\n\n const result = str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());\n\n if (CAMEL_CASE_CACHE.size < MAX_CACHE_SIZE) {\n CAMEL_CASE_CACHE.set(str, result);\n }\n\n return result;\n}\n\n/**\n * Clear string transformation caches (useful for testing)\n */\nexport function clearStringCaches(): void {\n KEBAB_CASE_CACHE.clear();\n CAMEL_CASE_CACHE.clear();\n HTML_ESCAPE_CACHE.clear();\n}\n\n/**\n * Get cache statistics for debugging\n */\nexport function getStringCacheStats(): {\n kebabCacheSize: number;\n camelCacheSize: number;\n htmlEscapeCacheSize: number;\n} {\n return {\n kebabCacheSize: KEBAB_CASE_CACHE.size,\n camelCacheSize: CAMEL_CASE_CACHE.size,\n htmlEscapeCacheSize: HTML_ESCAPE_CACHE.size,\n };\n}\n\nexport function escapeHTML(\n str: string | number | boolean,\n): string | number | boolean {\n if (typeof str === 'string') {\n // Check cache first for frequently escaped strings\n if (HTML_ESCAPE_CACHE.has(str)) {\n return HTML_ESCAPE_CACHE.get(str)!;\n }\n\n const result = str.replace(\n /[&<>\"']/g,\n (c) =>\n ({\n '&': '&amp;',\n '<': '&lt;',\n '>': '&gt;',\n '\"': '&quot;',\n \"'\": '&#39;',\n })[c]!,\n );\n\n // Only cache strings that contain entities to escape\n if (result !== str && HTML_ESCAPE_CACHE.size < MAX_CACHE_SIZE) {\n HTML_ESCAPE_CACHE.set(str, result);\n }\n\n return result;\n }\n return str;\n}\n\n/**\n * Decode HTML entities (named and numeric) into their character equivalents.\n * - In browser: uses a DOM-based technique to decode entities while preserving\n * existing raw tags.\n * - In non-DOM (SSR) environments: handles numeric references and a conservative\n * named-entity map for common entities.\n *\n * @param str - string containing HTML entities\n * @returns decoded string\n */\nexport function decodeEntities(str: string): string {\n if (!str) return '';\n const s = String(str);\n\n // Browser environment: use a DOM element to decode the full set of named entities.\n if (\n typeof document !== 'undefined' &&\n typeof document.createElement === 'function'\n ) {\n const SENTINEL_L = '\\uF000';\n const SENTINEL_G = '\\uF001';\n // Protect existing literal tags so they won't be parsed as HTML by innerHTML\n const protectedStr = s.replace(/</g, SENTINEL_L).replace(/>/g, SENTINEL_G);\n\n // Prefer module-level el to avoid relying on function-attached properties\n // which can be renamed/mangled by some minifiers. Keep function-attached\n // `_el` for backward compatibility but do not depend on it.\n const el = _decodeEl || (_decodeEl = document.createElement('div'));\n try {\n (decodeEntities as { _el?: HTMLElement })._el = el;\n } catch {\n void 0;\n }\n\n el.innerHTML = protectedStr;\n const decoded = el.textContent || '';\n return decoded\n .replace(new RegExp(SENTINEL_L, 'g'), '<')\n .replace(new RegExp(SENTINEL_G, 'g'), '>');\n }\n\n // SSR / non-DOM fallback: handle numeric refs and named entities via an external JSON map.\n // Keep a tiny inline map for the most common entities so decodeEntities remains sync.\n const tinyMap: Record<string, string> = {\n lt: '<',\n gt: '>',\n amp: '&',\n quot: '\"',\n apos: \"'\",\n nbsp: '\\u00A0',\n };\n\n // Prefer module-level registered map first (minifier-safe). Keep function\n // attached map as a fallback for backward compatibility only.\n const registered =\n _namedEntityMap ??\n (decodeEntities as { _namedMap?: Record<string, string> })._namedMap;\n\n // Select map: module-level registered > function-attached registered > sync require (Node-only) > tinyMap.\n let namedMap: Record<string, string> | undefined = registered;\n\n if (!namedMap && _isNode) {\n // Try to synchronously require the JSON in Node-like environments without importing `require`.\n try {\n // Use globalThis to avoid referencing `require` directly (prevents TS needing node types)\n const maybeRequire = (globalThis as { require?: (id: string) => unknown })\n .require;\n if (typeof maybeRequire === 'function') {\n // Try several common require paths (installed package, dist layout, src layout)\n const candidates = [\n '@jasonshimmy/custom-elements-runtime/entities.json', // installed package export\n '../../entities.json', // dist/runtime -> ../../entities.json\n '../../../entities.json', // src/lib/runtime -> ../../../entities.json\n '../entities.json',\n './entities.json',\n ];\n for (const p of candidates) {\n try {\n const m = maybeRequire(p);\n // Ensure the required value is an object before assigning and cast it to the expected type\n if (m && typeof m === 'object') {\n namedMap = m as Record<string, string>;\n break;\n }\n } catch {\n void 0;\n }\n }\n }\n } catch {\n void 0;\n }\n }\n\n // If we still don't have a map, fall back to tinyMap and trigger background loader if present.\n if (!namedMap) {\n namedMap = tinyMap;\n // Keep both module and function-level flags in sync for backward compatibility.\n // Mark fallback usage primarily on module-level flags (minifier-safe).\n _usedEntityFallback = true;\n try {\n (decodeEntities as { _usedFallback?: boolean })._usedFallback = true;\n } catch {\n void 0;\n }\n const loader =\n (\n decodeEntities as {\n _namedMapLoader?: () => Promise<Record<string, string>>;\n }\n )._namedMapLoader ?? _namedEntityMapLoader;\n if (loader) {\n // Load asynchronously; when ready, cache it for future sync calls and sync to function props.\n loader()\n .then((m: Record<string, string>) => {\n _namedEntityMap = m;\n try {\n (\n decodeEntities as { _namedMap?: Record<string, string> }\n )._namedMap = m;\n } catch {\n void 0;\n }\n })\n .catch(() => {});\n }\n }\n\n // Emit a one-time dev warning if we used the tiny fallback.\n // Prefer module-level flags first, then function-attached fallbacks for\n // backward compatibility. This avoids depending on function property names\n // which some minifiers may mangle.\n if (\n (_usedEntityFallback ||\n (decodeEntities as { _usedFallback?: boolean })._usedFallback) &&\n !(\n _warnedEntityFallback ||\n (decodeEntities as { _warnedFallback?: boolean })._warnedFallback\n )\n ) {\n _warnedEntityFallback = true;\n try {\n (decodeEntities as { _warnedFallback?: boolean })._warnedFallback = true;\n } catch {\n void 0;\n }\n try {\n devWarn(\n 'decodeEntities: using small SSR fallback entity map. Register the full entities.json via registerEntityMap(entities) on the server to enable full HTML5 named-entity decoding.',\n );\n } catch {\n void 0;\n }\n }\n\n // Replace entities: numeric (hex/dec) or named.\n return s.replace(/&(#x?[0-9a-fA-F]+|[a-zA-Z]+);/g, (_, entity) => {\n if (entity.charCodeAt(0) === 35) {\n // '#'\n const isHex = (entity.charAt(1) || '').toLowerCase() === 'x';\n const num = isHex\n ? parseInt(entity.slice(2), 16)\n : parseInt(entity.slice(1), 10);\n return Number.isNaN(num) ? `&${entity};` : String.fromCodePoint(num);\n }\n const mapped =\n (namedMap as Record<string, string>)[entity] ??\n (registered && registered[entity]);\n return mapped !== undefined ? mapped : `&${entity};`;\n });\n}\n\n/**\n * Dynamically load the full named-entity map (used in SSR). Exported for testing and\n * to allow bundlers to exclude the JSON from client bundles when dynamic import\n * is used behind a DOM check.\n */\nexport async function loadEntityMap(): Promise<Record<string, string>> {\n // Prefer dynamic import so bundlers can code-split or ignore this file for browser bundles.\n // Try the published package export first; in installed packages this is usually the most\n // reliable path. Make the specifier a runtime string to discourage bundlers from inlining.\n const pkgExport = [\n '@jasonshimmy',\n 'custom-elements-runtime',\n 'entities.json',\n ].join('/');\n try {\n // @vite-ignore: dynamic import specifier constructed at runtime\n const mPkg = await import(/* @vite-ignore */ pkgExport as string);\n return (mPkg && (mPkg.default || mPkg)) as Record<string, string>;\n } catch {\n // Next try relative local JSON (useful during development or mono-repo installs)\n try {\n // Try several reasonable local import paths (development vs built layouts)\n const localCandidates = [\n pkgExport, // try package export via dynamic import too (best for installed packages)\n './entities.json',\n '../../entities.json',\n '../../../entities.json',\n ];\n for (const p of localCandidates) {\n try {\n // @vite-ignore: intentionally dynamic path candidates for dev/local resolution\n const mLocal = await import(/* @vite-ignore */ p as string);\n if (mLocal)\n return (mLocal && (mLocal.default || mLocal)) as Record<\n string,\n string\n >;\n } catch {\n void 0;\n }\n }\n // If none of the dynamic imports succeeded, fall back to the small map.\n return {\n lt: '<',\n gt: '>',\n amp: '&',\n quot: '\"',\n apos: \"'\",\n nbsp: '\\u00A0',\n };\n } catch {\n // Final small fallback\n return {\n lt: '<',\n gt: '>',\n amp: '&',\n quot: '\"',\n apos: \"'\",\n nbsp: '\\u00A0',\n };\n }\n }\n}\n\n// Attach loader to module state and (for backward compatibility) to the function\n// as well. Using module-level state avoids property-mangling risks in minified\n// builds; attaching to the function keeps tests that reference the property\n// working until they can be updated.\n_namedEntityMapLoader = loadEntityMap;\n(\n decodeEntities as typeof decodeEntities & {\n _namedMapLoader?: typeof loadEntityMap;\n }\n)._namedMapLoader = loadEntityMap;\n\n/**\n * Register a full named-entity map for SSR. Intended for server startup code to\n * provide the authoritative HTML5 entity mapping. This keeps the client bundle\n * small because the map is only injected on the server side.\n *\n * registerEntityMap should be called once at server startup prior to rendering.\n */\nexport function registerEntityMap(\n map: Record<string, string>,\n options?: { overwrite?: boolean },\n): void {\n if (!map || typeof map !== 'object') return;\n const existing = _namedEntityMap;\n if (existing && !options?.overwrite) return; // first registration wins by default\n _namedEntityMap = map;\n}\n\n/**\n * Clear any registered entity map. Useful for tests or restarting state.\n */\nexport function clearRegisteredEntityMap(): void {\n _namedEntityMap = undefined;\n}\n\n/**\n * Wrap a string as raw HTML. This is intentionally unsafe — callers must\n * sanitize untrusted input before using this. The returned object provides\n * two property names to be compatible with different parts of the runtime.\n */\nexport function unsafeHTML(html: string): {\n __unsafeHTML: string;\n __rawHTML: string;\n} {\n const s = String(html);\n // Provide both property names to be compatible with compiler/renderer expectations\n return { __unsafeHTML: s, __rawHTML: s };\n}\n\n/** Type-guard for unsafeHTML wrapper */\nexport function isUnsafeHTML(\n value: unknown,\n): value is { __unsafeHTML?: string; __rawHTML?: string } {\n return (\n !!value &&\n (typeof (value as { __unsafeHTML?: unknown }).__unsafeHTML === 'string' ||\n typeof (value as { __rawHTML?: unknown }).__rawHTML === 'string')\n );\n}\n\n/**\n * Get nested property value from object using dot notation\n */\nexport function getNestedValue(\n obj: Record<string, unknown>,\n path: string,\n): unknown {\n if (typeof path === 'string') {\n // Handle empty path explicitly: return undefined to indicate no lookup\n if (path === '') return undefined;\n const keys = path.split('.');\n let current: unknown = obj;\n\n for (const key of keys) {\n if (current == null || typeof current !== 'object') {\n current = undefined;\n break;\n }\n current = (current as Record<string, unknown>)[key];\n }\n\n // If the result is a ReactiveState object, return its value\n if (isReactiveState(current)) {\n return (current as { value: unknown }).value;\n }\n return current;\n }\n return path;\n}\n\n/**\n * Set nested property value in object using dot notation\n */\nexport function setNestedValue(\n obj: Record<string, unknown>,\n path: string,\n value: unknown,\n): void {\n const keys = String(path).split('.');\n const lastKey = keys.pop();\n if (!lastKey) return;\n const target = keys.reduce(\n (current: Record<string, unknown>, key: string) => {\n if (current[key] == null) current[key] = {};\n return current[key] as Record<string, unknown>;\n },\n obj,\n ) as Record<string, unknown>;\n\n // If target[lastKey] is a ReactiveState object, set its value property\n if (isReactiveState(target[lastKey])) {\n target[lastKey].value = value;\n } else {\n target[lastKey] = value;\n }\n}\n\n/**\n * Safely unwrap reactive-like wrappers to their inner primitive when safe.\n * Returns the original value when it's not safe to coerce to a primitive.\n */\nexport function unwrapIfPrimitive(val: unknown): unknown {\n try {\n if (val && typeof val === 'object') {\n if (isReactiveState(val)) return (val as { value: unknown }).value;\n if ('value' in val) {\n const maybe = (val as { value: unknown }).value;\n // Only return primitive inner values; otherwise return original\n if (\n maybe === null ||\n maybe === undefined ||\n typeof maybe === 'string' ||\n typeof maybe === 'number' ||\n typeof maybe === 'boolean'\n ) {\n return maybe;\n }\n return val;\n }\n }\n } catch {\n // ignore\n }\n return val;\n}\n\n/**\n * Return a serialized string for an attribute value when safe to write to DOM.\n * Returns `null` when the value should not be written as an attribute.\n */\nexport function safeSerializeAttr(val: unknown): string | null {\n const v = unwrapIfPrimitive(val);\n if (v === null || v === undefined) return null;\n const t = typeof v;\n if (t === 'string' || t === 'number' || t === 'boolean') return String(v);\n return null; // complex objects, nodes, functions -> do not serialize\n}\n\n/**\n * Determine if an attribute name is class-like and should be preserved on hosts.\n * Class-like: exactly 'class', camelCase ending with 'Class', or kebab-case ending with '-class'.\n */\nexport function isClassLikeAttr(name: string): boolean {\n if (!name || typeof name !== 'string') return false;\n if (name === 'class') return true;\n if (name.endsWith('Class')) return true;\n // Kebab-case: consider attributes where one of the hyphen-separated tokens is 'class'\n if (name.includes('-')) {\n try {\n const parts = name.split('-');\n if (parts.some((p) => p === 'class')) return true;\n } catch {\n // fallthrough\n }\n }\n return false;\n}\n","/**\n * Namespace-aware attribute helpers.\n * Provides small, fast utilities to set/remove attributes using the\n * appropriate namespace when an attribute uses a known prefix (e.g. xlink:href).\n */\n\nconst ATTR_NAMESPACE_MAP: Record<string, string> = {\n xlink: 'http://www.w3.org/1999/xlink',\n xml: 'http://www.w3.org/XML/1998/namespace',\n};\n\n/**\n * Set attribute using namespace when the key contains a known prefix.\n */\nexport function setAttributeSmart(\n el: Element,\n key: string,\n value: string,\n): void {\n try {\n if (!key || !key.includes(':')) {\n el.setAttribute(key, value);\n return;\n }\n const idx = key.indexOf(':');\n const prefix = key.substring(0, idx);\n const local = key.substring(idx + 1);\n const ns = ATTR_NAMESPACE_MAP[prefix];\n if (ns) el.setAttributeNS(ns, local, value);\n else el.setAttribute(key, value);\n } catch {\n try {\n // Fallback to un-namespaced setAttribute on error\n el.setAttribute(key, value);\n } catch {\n /* swallow */\n }\n }\n}\n\n/**\n * Remove attribute using namespace when the key contains a known prefix.\n */\nexport function removeAttributeSmart(el: Element, key: string): void {\n try {\n if (!key || !key.includes(':')) {\n el.removeAttribute(key);\n return;\n }\n const idx = key.indexOf(':');\n const prefix = key.substring(0, idx);\n const local = key.substring(idx + 1);\n const ns = ATTR_NAMESPACE_MAP[prefix];\n if (ns) el.removeAttributeNS(ns, local);\n else el.removeAttribute(key);\n } catch {\n try {\n el.removeAttribute(key);\n } catch {\n /* swallow */\n }\n }\n}\n\nexport const __TEST_ONLY_ATTR_NS_MAP = ATTR_NAMESPACE_MAP;\n\n// Common element namespace URIs and a small tag->namespace map used by\n// both the client renderer and the SSR serializer. Exporting these from\n// this module keeps namespace knowledge centralized and prevents\n// accidental duplication between runtime and SSR code.\nexport const SVG_NS = 'http://www.w3.org/2000/svg';\nexport const MATHML_NS = 'http://www.w3.org/1998/Math/MathML';\n\nexport const TAG_NAMESPACE_MAP: Record<string, string> = {\n svg: SVG_NS,\n math: MATHML_NS,\n};\n"],"names":["detectTestEnvironment","nodeEnv","browserTestEnv","win","UpdateScheduler","update","componentId","key","updates","error","devError","cleanup","now","devWarn","entries","toRemove","i","updateScheduler","scheduleDOMUpdate","flushDOMUpdates","proxiedObjects","ReactiveProxyCache","obj","reactiveState","isArray","cached","handler","proxy","ProxyOptimizer","target","prop","receiver","value","args","result","onUpdate","makeReactive","inner","reactiveContext","ReactiveSystem","renderFn","data","wid","watcherId","current","fn","wasDisabled","initialValue","ReactiveState","stateKey","state","deps","prefix","reactiveSystem","newValue","ref","isReactiveState","v","computed","computedState","watch","source","callback","options","oldValue","getter","parentComp","updateWatcher","safe","KEBAB_CASE_CACHE","CAMEL_CASE_CACHE","HTML_ESCAPE_CACHE","MAX_CACHE_SIZE","_namedEntityMap","_namedEntityMapLoader","_usedEntityFallback","_warnedEntityFallback","_decodeEl","_isNode","toKebab","str","toCamel","_","letter","escapeHTML","c","decodeEntities","s","protectedStr","el","tinyMap","registered","namedMap","maybeRequire","candidates","p","m","loader","entity","num","mapped","loadEntityMap","pkgExport","mPkg","localCandidates","mLocal","unsafeHTML","html","isUnsafeHTML","getNestedValue","path","keys","setNestedValue","lastKey","unwrapIfPrimitive","val","maybe","safeSerializeAttr","t","isClassLikeAttr","name","ATTR_NAMESPACE_MAP","setAttributeSmart","idx","local","ns","removeAttributeSmart","SVG_NS","MATHML_NS","TAG_NAMESPACE_MAP"],"mappings":";AAkBA,SAASA,IAAyC;AAEhD,QAAMC,KAAW,MAAM;AACrB,QAAI;AAIF,aAFE,WACA,SACc,KAAK;AAAA,IACvB,QAAQ;AACN;AAAA,IACF;AAAA,EACF,GAAA,GAGMC,KAAkB,MAAM;AAC5B,QAAI;AACF,UAAI,OAAO,SAAW;AACpB,eAAO,EAAE,QAAQ,IAAO,SAAS,GAAA;AAEnC,YAAMC,IAAM;AACZ,aAAO;AAAA,QACL,QAAQ,EAAQA,EAAI;AAAA,QACpB,SAAS,EAAQA,EAAI;AAAA,MAAO;AAAA,IAEhC,QAAQ;AACN,aAAO,EAAE,QAAQ,IAAO,SAAS,GAAA;AAAA,IACnC;AAAA,EACF,GAAA;AAKA,SAAO;AAAA,IACL,QAHAF,MAAY,UAAUC,EAAe,UAAUA,EAAe;AAAA,IAI9D,UAAUA,EAAe;AAAA,IACzB,WAAWA,EAAe;AAAA,EAAA;AAE9B;AAEA,MAAME,EAAgB;AAAA,EACZ,qCAAqB,IAAA;AAAA,EACrB,mBAAmB;AAAA,EACnB,aA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,GAAG,GACrB6C,IAAS7C,EAAI,UAAU,GAAGoH,CAAG,GAC7BC,IAAQrH,EAAI,UAAUoH,IAAM,CAAC,GAC7BE,IAAKJ,EAAmBrE,CAAM;AACpC,IAAIyE,IAAIpC,EAAG,eAAeoC,GAAID,GAAO5F,CAAK,IACrCyD,EAAG,aAAalF,GAAKyB,CAAK;AAAA,EACjC,QAAQ;AACN,QAAI;AAEF,MAAAyD,EAAG,aAAalF,GAAKyB,CAAK;AAAA,IAC5B,QAAQ;AAAA,IAER;AAAA,EACF;AACF;AAKO,SAAS8F,GAAqBrC,GAAalF,GAAmB;AACnE,MAAI;AACF,QAAI,CAACA,KAAO,CAACA,EAAI,SAAS,GAAG,GAAG;AAC9B,MAAAkF,EAAG,gBAAgBlF,CAAG;AACtB;AAAA,IACF;AACA,UAAMoH,IAAMpH,EAAI,QAAQ,GAAG,GACrB6C,IAAS7C,EAAI,UAAU,GAAGoH,CAAG,GAC7BC,IAAQrH,EAAI,UAAUoH,IAAM,CAAC,GAC7BE,IAAKJ,EAAmBrE,CAAM;AACpC,IAAIyE,IAAIpC,EAAG,kBAAkBoC,GAAID,CAAK,IACjCnC,EAAG,gBAAgBlF,CAAG;AAAA,EAC7B,QAAQ;AACN,QAAI;AACF,MAAAkF,EAAG,gBAAgBlF,CAAG;AAAA,IACxB,QAAQ;AAAA,IAER;AAAA,EACF;AACF;AAQO,MAAMwH,IAAS,8BACTC,IAAY,sCAEZC,KAA4C;AAAA,EACvD,KAAKF;AAAA,EACL,MAAMC;AACR;"}
@@ -1,17 +0,0 @@
1
- "use strict";const l=require("./namespace-helpers-BCVTzhAO.cjs"),$=require("./logger-DiXdWaF-.cjs"),z=require("./transitions-DfcqL-X4.cjs");function rt(e,n,t){if(t)for(const[r,s]of Object.entries(t)){let o,i={};if(Array.isArray(s)?(o=s[0],i=s[1]||{}):o=s,n.set(r,{callback:o,options:i,oldValue:l.getNestedValue(e,r)}),i.immediate)try{const a=l.getNestedValue(e,r);o(a,void 0,e)}catch(a){$.devError(`Error in immediate watcher for "${r}":`,a)}}}function st(e,n,t,r){const s=(i,a)=>{if(i===a)return!0;if(typeof i!=typeof a||typeof i!="object"||i===null||a===null)return!1;if(Array.isArray(i)&&Array.isArray(a))return i.length!==a.length?!1:i.every((y,w)=>s(y,a[w]));const u=i,d=a,v=Object.keys(u||{}),b=Object.keys(d||{});return v.length!==b.length?!1:v.every(y=>s(u[y],d[y]))},o=n.get(t);if(o&&!s(r,o.oldValue))try{o.callback(r,o.oldValue,e),o.oldValue=r}catch(i){$.devError(`Error in watcher for "${t}":`,i)}for(const[i,a]of n.entries())if(a.options.deep&&t.startsWith(i+"."))try{const u=l.getNestedValue(e,i);s(u,a.oldValue)||(a.callback(u,a.oldValue,e),a.oldValue=u)}catch(u){$.devError(`Error in deep watcher for "${i}":`,u)}}function Ne(e,n){return n===Boolean?e===""||e==="true":n===Number?Number(e):e}function it(e,n,t){if(n)for(const r in n){const s=n[r],o=l.toKebab(r),i=e.getAttribute(o);if(s.type===Function&&typeof e[r]=="function")t[r]=e[r];else if(i!==null)t[r]=Ne(i,s.type);else if(typeof e[r]<"u")try{const a=e[r];if(s.type===String&&a&&typeof a=="object")try{t[r]=Ne(String(a),s.type)}catch{t[r]=a}else s.type===Boolean&&typeof a=="boolean"||s.type===Number&&typeof a=="number"||s.type===Function&&typeof a=="function"?t[r]=a:t[r]=Ne(String(a),s.type)}catch{t[r]=e[r]}else"default"in s&&s.default!==void 0&&(t[r]=s.default)}}function ot(e,n,t){if(!n.props){try{const r=t?._hookCallbacks?.props||{},s=Array.from(new Set([...Object.keys(e||{}),...Object.keys(r||{})]));for(const o of s){if(typeof o!="string"||o.startsWith("_"))continue;const i=Object.getOwnPropertyDescriptor(t,o);if(!(!Object.prototype.hasOwnProperty.call(r,o)&&i&&(i.get||i.set||!i.configurable)))try{Object.defineProperty(t,o,{enumerable:!0,configurable:!0,get(){try{const u=l.toKebab(o),d=e.getAttribute(u);if(d!==null)return d;const v=e[o];let b;return l.isReactiveState(v)||v&&typeof v=="object"&&"value"in v&&!(v instanceof Node)?b=v.value:b=v,b}catch{return e[o]}}})}catch{}}}catch{}return}it(e,n.props,t)}function at(e,n,t,r){e.onConnected&&!t&&(e.onConnected(n),r(!0))}function ct(e,n,t,r,s,o,i,a){e.onDisconnected&&e.onDisconnected(n),t.forEach(u=>u()),r(),s(),o(!1),i(null),a(!1)}function lt(e,n,t,r,s){e.onAttributeChanged&&e.onAttributeChanged(n,t,r,s)}class ft{static cache=new Map;static maxCacheSize=1e3;static dangerousPatterns=[/constructor/i,/prototype/i,/__proto__/i,/function/i,/eval/i,/import/i,/require/i,/window/i,/document/i,/global/i,/process/i,/setTimeout/i,/setInterval/i,/fetch/i,/XMLHttpRequest/i];static evaluate(n,t){const r=this.cache.get(n);if(r){if(!r.isSecure){$.devWarn("Blocked cached dangerous expression:",n);return}try{this.cache.delete(n),this.cache.set(n,r)}catch{}return r.evaluator(t)}const s=this.createEvaluator(n);if(this.cache.size>=this.maxCacheSize){const o=this.cache.keys().next().value;o&&this.cache.delete(o)}if(this.cache.set(n,s),!s.isSecure){$.devWarn("Blocked dangerous expression:",n);return}return s.evaluator(t)}static createEvaluator(n){if(this.hasDangerousPatterns(n))return{evaluator:()=>{},isSecure:!1};if(n.length>1e3)return{evaluator:()=>{},isSecure:!1};try{return{evaluator:this.createSafeEvaluator(n),isSecure:!0}}catch(t){return $.devWarn("Failed to create evaluator for expression:",n,t),{evaluator:()=>{},isSecure:!1}}}static hasDangerousPatterns(n){return this.dangerousPatterns.some(t=>t.test(n))}static createSafeEvaluator(n){const t=n.trim();if(t.startsWith("{")&&t.endsWith("}"))return this.createObjectEvaluator(n);if(/^ctx\.[a-zA-Z0-9_.]+$/.test(n.trim())){const r=n.trim().slice(4);return s=>l.getNestedValue(s,r)}return n.includes("ctx")||/[+\-*/%<>=&|?:[\]]/.test(n)?this.createSimpleEvaluator(n):r=>l.getNestedValue(r,n)}static createObjectEvaluator(n){const t=n.trim().slice(1,-1),r=this.parseObjectProperties(t);return s=>{const o={};for(const{key:i,value:a}of r)try{if(a.startsWith("ctx.")){const u=a.slice(4);o[i]=l.getNestedValue(s,u)}else o[i]=this.evaluateSimpleValue(a,s)}catch{o[i]=void 0}return o}}static parseObjectProperties(n){const t=[],r=n.split(",");for(const s of r){const o=s.indexOf(":");if(o===-1)continue;const i=s.slice(0,o).trim(),a=s.slice(o+1).trim(),u=i.replace(/^['"]|['"]$/g,"");t.push({key:u,value:a})}return t}static createSimpleEvaluator(n){return t=>{try{let r=n;const s=[];r=r.replace(/("[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*')/g,b=>`<<#${s.push(b)-1}#>>`);const o=r.match(/ctx\.[\w.]+/g)||[];for(const b of o){const y=b.slice(4),w=l.getNestedValue(t,y);if(w===void 0)return;const T=s.push(JSON.stringify(w))-1;r=r.replace(new RegExp(b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),`<<#${T}#>>`)}const i=/\b[a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)+\b/g,a=r.match(i)||[];for(const b of a){if(b.startsWith("ctx."))continue;const y=l.getNestedValue(t,b);if(y===void 0)return;const w=s.push(JSON.stringify(y))-1;r=r.replace(new RegExp(b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),`<<#${w}#>>`)}const u=/\b([a-zA-Z_][a-zA-Z0-9_]*)\b/g;let d;const v=new Set;for(;(d=u.exec(r))!==null;){const b=d[1];if(["true","false","null","undefined"].includes(b)||/^[0-9]+$/.test(b)||b==="ctx"||v.has(b))continue;v.add(b);const y=l.getNestedValue(t,b);if(y===void 0)return;const w=JSON.stringify(y),T=s.push(w)-1;b.includes(".")?r=r.replace(new RegExp(b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),`<<#${T}#>>`):r=r.replace(new RegExp("\\b"+b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"\\b","g"),`<<#${T}#>>`)}r=r.replace(/<<#(\d+)#>>/g,(b,y)=>s[Number(y)]);try{return this.evaluateBasicExpression(r)}catch{return}}catch{return}}}static evaluateBasicExpression(n){const t=this.tokenize(n);let r=0;function s(){return t[r]}function o(h){const _=t[r++];if(h&&!_)throw new Error(`Unexpected token EOF, expected ${h}`);if(h&&_&&_.type!==h&&_.value!==h)throw new Error(`Unexpected token ${_.type}/${_.value}, expected ${h}`);return _}function i(){return T()}function a(h){if(typeof h=="number")return h;if(h==null)return NaN;if(typeof h=="boolean")return h?1:0;const _=Number(h);return Number.isNaN(_)?NaN:_}function u(h,_){return typeof h=="string"||typeof _=="string"?String(h)+String(_):a(h)+a(_)}function d(h,_){return a(h)-a(_)}function v(h,_){return a(h)*a(_)}function b(h,_){return a(h)/a(_)}function y(h,_){return a(h)%a(_)}function w(h,_,f){if(typeof _=="number"&&typeof f=="number")switch(h){case">":return _>f;case"<":return _<f;case">=":return _>=f;case"<=":return _<=f;default:return!1}const m=String(_),k=String(f);switch(h){case">":return m>k;case"<":return m<k;case">=":return m>=k;case"<=":return m<=k;default:return!1}}function T(){const h=L(),_=s();if(_&&_.value==="?"){o("?");const f=i();o(":");const m=i();return h?f:m}return h}function L(){let h=c();for(;;){const _=s();if(!_||_.value!=="||")break;o("OP");const f=c();h=h||f}return h}function c(){let h=C();for(;;){const _=s();if(!_||_.value!=="&&")break;o("OP");const f=C();h=h&&f}return h}function C(){let h=S();for(;;){const _=s();if(!_||!["==","!=","===","!=="].includes(_.value))break;const f=o("OP").value,m=S();switch(f){case"==":h=h==m;break;case"!=":h=h!=m;break;case"===":h=h===m;break;case"!==":h=h!==m;break}}return h}function S(){let h=g();for(;;){const _=s();if(!_||![">","<",">=","<="].includes(_.value))break;const f=o("OP").value,m=g();switch(f){case">":h=w(">",h,m);break;case"<":h=w("<",h,m);break;case">=":h=w(">=",h,m);break;case"<=":h=w("<=",h,m);break}}return h}function g(){let h=p();for(;;){const _=s();if(!_||_.value!=="+"&&_.value!=="-")break;const f=o("OP").value,m=p();h=f==="+"?u(h,m):d(h,m)}return h}function p(){let h=A();for(;;){const _=s();if(!_||_.value!=="*"&&_.value!=="/"&&_.value!=="%")break;const f=o("OP").value,m=A();switch(f){case"*":h=v(h,m);break;case"/":h=b(h,m);break;case"%":h=y(h,m);break}}return h}function A(){const h=s();if(h&&h.value==="!")return o("OP"),!A();if(h&&h.value==="-"){o("OP");const _=A();return d(0,_)}return E()}function E(){const h=s();if(h){if(h.type==="NUMBER")return o("NUMBER"),Number(h.value);if(h.type==="STRING")return o("STRING"),h.value.slice(1,-1);if(h.type==="IDENT")return o("IDENT"),h.value==="true"?!0:h.value==="false"?!1:h.value==="null"?null:void 0;if(h.value==="["){o("PUNC");const _=[];for(;;){const f=s();if(!f||f.value==="]")break;_.push(i());const m=s();m&&m.value===","&&o("PUNC")}return o("PUNC"),_}if(h.value==="("){o("PUNC");const _=i();return o("PUNC"),_}throw new Error("Unexpected token in expression")}}return i()}static tokenize(n){const t=[],r=/\s*(=>|===|!==|==|!=|>=|<=|\|\||&&|[()?:,[\]]|\+|-|\*|\/|%|>|<|!|\d+\.?\d*|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|[a-zA-Z_][a-zA-Z0-9_]*|\S)\s*/g;let s;for(;(s=r.exec(n))!==null;){const o=s[1];o&&(/^\d/.test(o)?t.push({type:"NUMBER",value:o}):/^"/.test(o)||/^'/.test(o)?t.push({type:"STRING",value:o}):/^[a-zA-Z_]/.test(o)?t.push({type:"IDENT",value:o}):/^[()?:,[\]]$/.test(o)?t.push({type:"PUNC",value:o}):t.push({type:"OP",value:o}))}return t}static evaluateSimpleValue(n,t){if(n==="true")return!0;if(n==="false")return!1;if(!isNaN(Number(n)))return Number(n);if(n.startsWith("ctx.")){const r=n.slice(4);return l.getNestedValue(t,r)}return n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'")?n.slice(1,-1):n}static clearCache(){this.cache.clear()}static getCacheSize(){return this.cache.size}}class Z{static cleanupFunctions=new WeakMap;static addListener(n,t,r,s){n.addEventListener(t,r,s);const i={event:t,handler:r,wrapper:r,options:s,cleanup:()=>n.removeEventListener(t,r,s),addedAt:Date.now()};this.cleanupFunctions.has(n)||this.cleanupFunctions.set(n,[]);const a=this.cleanupFunctions.get(n);a.push(i),a.__metaList=a}static removeListener(n,t,r,s){n.removeEventListener(t,r,s);const o=this.cleanupFunctions.get(n);if(o)for(let i=0;i<o.length;i++){const a=o[i];if(a.event===t&&a.handler===r){o.splice(i,1),o.length===0&&this.cleanupFunctions.delete(n);return}}}static cleanup(n){const t=this.cleanupFunctions.get(n);t&&(t.forEach(r=>{try{r.cleanup()}catch{}}),this.cleanupFunctions.delete(n))}static cleanupAll(){this.cleanupFunctions=new WeakMap}static hasListeners(n){const t=this.cleanupFunctions.get(n);return!!(t&&t.length>0)}static getListenerCount(n){const t=this.cleanupFunctions.get(n);return t?t.length:0}static getListenerInfo(n){const t=this.cleanupFunctions.get(n);return t?t.map(r=>({event:r.event,handler:r.handler,wrapper:r.wrapper,options:r.options})):[]}}function ke(e,n){return Array.isArray(e)&&Array.isArray(n)?JSON.stringify([...e].sort())!==JSON.stringify([...n].sort()):e!==n}function Be(e,n,t,r,s){if(e){const o=n.value;if(s&&typeof o=="object"&&o!==null){const i={...o};i[s]=t,n.value=i}else n.value=t}else{const o=r._state||r;l.setNestedValue(o,n,t)}}function we(e,n,t,r){if(typeof e._requestRender=="function"&&e._requestRender(),typeof e._triggerWatchers=="function"){const s=n?"reactiveState":t;e._triggerWatchers(s,r)}}function ut(e,n,t){const r=`update:${l.toKebab(n)}`,s=`update:${n}`,o=new CustomEvent(r,{detail:t,bubbles:!0,cancelable:!0}),i=new CustomEvent(s,{detail:t,bubbles:!0,cancelable:!0});e.dispatchEvent(o),e.dispatchEvent(i)}function ze(e,n,t,r){const s=t;if(l.safe(()=>{if(typeof e.setAttribute=="function")try{e[n]=s}catch{}else e[n]=s}),s==null||typeof s=="string"||typeof s=="number"||typeof s=="boolean"){const o=l.safeSerializeAttr(s);o!==null?l.safe(()=>{typeof e.setAttribute=="function"&&l.setAttributeSmart(e,l.toKebab(n),String(o))}):l.safe(()=>{typeof e.removeAttribute=="function"&&l.removeAttributeSmart(e,l.toKebab(n))})}}function dt(e,n,t,r){if(e){const s=n.value;return r&&typeof s=="object"&&s!==null?s[r]:s}else{const s=t._state||t;return l.getNestedValue(s,n)}}function ae(e){return e?e.split(/\s+/).filter(Boolean):[]}function ce(e,n){if(n.length===0)return;const t=n.filter(r=>r&&!e.classList.contains(r));t.length>0&&e.classList.add(...t)}function oe(e,n){if(n.length===0)return;const t=n.filter(Boolean);t.length>0&&e.classList.remove(...t)}let Oe=!1;async function pt(e,n,t=10){if(!Oe){if(!e.isConnected){$.devWarn("⚠️ Element not connected to DOM, skipping style wait");return}for(let r=0;r<t;r++){const s=window.getComputedStyle(e),o=s.transform&&s.transform!=="",i=s.opacity&&s.opacity!=="";if(o||i){Oe=!0;return}await new Promise(a=>requestAnimationFrame(()=>a(void 0)))}Oe=!0,$.devWarn("⚠️ Styles did not load in time for transition, continuing anyway")}}function ht(e){const n=window.getComputedStyle(e),t=n.transitionDuration||"0s",r=n.transitionDelay||"0s",s=o=>{const i=parseFloat(o);return o.includes("ms")?i:i*1e3};return s(t)+s(r)}function Ge(e,n){return new Promise(t=>{const r=n??ht(e);if(r<=0){t();return}let s=!1;const o=()=>{s||(s=!0,e.removeEventListener("transitionend",i),e.removeEventListener("transitioncancel",i),t())},i=()=>o();e.addEventListener("transitionend",i),e.addEventListener("transitioncancel",i),setTimeout(o,r+50)})}async function me(e,n){const{classes:t,hooks:r,css:s,duration:o}=n;if(r?.onBeforeEnter)try{r.onBeforeEnter(e)}catch(T){$.devError("Transition onBeforeEnter error:",T)}if(!s)return r?.onEnter?new Promise(T=>{const L=r.onEnter;typeof L=="function"?L(e,()=>{if(r?.onAfterEnter)try{r.onAfterEnter(e)}catch(c){$.devError("Transition onAfterEnter error:",c)}T()}):T()}):void 0;const i=ae(t?.enterFrom),a=ae(t?.enterActive),u=ae(t?.enterTo);ce(e,i),e.offsetHeight,ce(e,a),e.offsetHeight;let d;if(r?.onEnter){const T=new Promise(L=>{d=L});try{const L=r.onEnter;typeof L=="function"&&L(e,()=>{d&&d()})}catch(L){$.devError("Transition onEnter error:",L)}d&&await T}await new Promise(T=>requestAnimationFrame(()=>T(void 0))),e.offsetHeight;const v=window.getComputedStyle(e),b=v.transform,y=v.opacity;oe(e,i),b&&b!=="none"&&(e.style.transform=b),y&&y!==""&&(e.style.opacity=y),e.offsetHeight,await new Promise(T=>requestAnimationFrame(()=>T(void 0))),e.style.transform="",e.style.opacity="",ce(e,u),e.offsetHeight,await new Promise(T=>requestAnimationFrame(()=>T(void 0)));let w;if(typeof o=="number"?w=o:o&&typeof o=="object"&&"enter"in o&&(w=o.enter),await Ge(e,w),oe(e,a),r?.onAfterEnter)try{r.onAfterEnter(e)}catch(T){$.devError("Transition onAfterEnter error:",T)}}async function Me(e,n){const{classes:t,hooks:r,css:s,duration:o}=n;if(r?.onBeforeLeave)try{r.onBeforeLeave(e)}catch(b){$.devError("Transition onBeforeLeave error:",b)}if(!s)return r?.onLeave?new Promise(b=>{const y=r.onLeave;typeof y=="function"?y(e,()=>{if(r?.onAfterLeave)try{r.onAfterLeave(e)}catch(w){$.devError("Transition onAfterLeave error:",w)}b()}):b()}):void 0;const i=ae(t?.leaveFrom),a=ae(t?.leaveActive),u=ae(t?.leaveTo);ce(e,i),e.offsetHeight,ce(e,a);let d;if(r?.onLeave){const b=new Promise(y=>{d=y});try{const y=r.onLeave;typeof y=="function"&&y(e,()=>{d&&d()})}catch(y){$.devError("Transition onLeave error:",y)}d&&await b}await new Promise(b=>requestAnimationFrame(()=>b(void 0))),await pt(e,[...i,...a]),oe(e,i),ce(e,u);let v;if(typeof o=="number"?v=o:o&&typeof o=="object"&&"leave"in o&&(v=o.leave),await Ge(e,v),oe(e,a),oe(e,u),oe(e,i),r?.onAfterLeave)try{r.onAfterLeave(e)}catch(b){$.devError("Transition onAfterLeave error:",b)}}const Ze=new WeakMap,Je=new WeakMap;function Te(e){if(!e)return;const n=Ze.get(e);if(n!==void 0)return n;try{const t=e;if(t&&t.key!=null)return String(t.key)}catch{}if(e instanceof Element){const t=e.getAttribute("data-anchor-key");if(t)return t}}function V(e,n){try{Ze.set(e,n)}catch{}try{e.key=n}catch{}try{if(e instanceof Element){const t=l.safeSerializeAttr(n);t!==null&&l.setAttributeSmart(e,"data-anchor-key",t)}}catch{}}function yt(e){if(!e)return;const n=Je.get(e);if(n!==void 0)return n;try{const t=e;if(t&&t._transitionGroup!=null)return t._transitionGroup}catch{}}function mt(e,n){try{Je.set(e,n)}catch{}try{e._transitionGroup=n}catch{}}function le(e){return e!==null&&typeof e=="object"&&"value"in e}function $e(e){try{if(l.isReactiveState(e))return e.value}catch{}try{if(le(e))return e.value}catch{}return e}function X(e,n,t){try{e&&e.attrs&&(e.attrs[n]=t)}catch{}}function q(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLButtonElement}function fe(e){return e===""?!0:typeof e=="string"?e==="false"?!1:e==="true"?!0:e!=="":e&&typeof e=="object"?l.isReactiveState(e)||"value"in e?!!e.value:!1:!!e}function ie(e,n){if(n){if(e instanceof Element){Z.cleanup(e);const t=[];for(const r in n)n[r]===e&&t.push(r);for(const r of t)delete n[r]}if(e.hasChildNodes()){const t=e.childNodes;for(let r=t.length-1;r>=0;r--)ie(t[r],n)}}}function ge(e,n,t){if(typeof e=="string")return;const r=e.props?.reactiveRef??(e.props?.props&&e.props.props.reactiveRef),s=e.props?.ref??(e.props?.props&&e.props.props.ref);if(r)try{if(l.isReactiveState(r)||typeof r=="object"&&"value"in r)r.value=n;else if(typeof r=="function")r(n);else if(typeof r=="string"&&t)try{const o=String(r);t[o]=n}catch{}}catch{}else if(s&&t)try{const o=String(s);t[o]=n}catch{}}function gt(e,n,t,r,s,o,i,a){if(!o)return;const u=n.includes("lazy"),d=n.includes("trim"),v=n.includes("number"),b=()=>{if(l.isReactiveState(e)){const p=e.value;return a&&i&&(i instanceof HTMLInputElement||i instanceof HTMLTextAreaElement||i instanceof HTMLSelectElement)&&typeof p=="object"&&p!==null?p[a]:p}const g=o?._state||o;return l.getNestedValue(g,e)},y=b();let w="text";i instanceof HTMLInputElement?w=r?.type||i.type||"text":i instanceof HTMLSelectElement?w="select":i instanceof HTMLTextAreaElement&&(w="textarea");const T=i instanceof HTMLInputElement||i instanceof HTMLTextAreaElement||i instanceof HTMLSelectElement,c=T?w==="checkbox"||w==="radio"?"checked":"value":a??"modelValue";if(w==="checkbox")if(Array.isArray(y))t[c]=y.includes(String(i?.getAttribute("value")??r?.value??""));else{const g=i?.getAttribute("true-value")??!0;t[c]=y===g}else if(w==="radio")t[c]=y===(r?.value??"");else if(w==="select")if(i&&i.hasAttribute("multiple")&&i instanceof HTMLSelectElement){const g=Array.isArray(y)?y.map(String):[];setTimeout(()=>{Array.from(i.options).forEach(p=>{p.selected=g.includes(p.value)})},0),t[c]=Array.isArray(y)?y:[]}else t[c]=y;else{!T&&l.isReactiveState(e)?t[c]=e:t[c]=y;try{const g=l.toKebab(c);r&&(r[g]=y)}catch{}}const C=u||w==="checkbox"||w==="radio"||w==="select"?"change":"input",S=g=>{if(g.isComposing||s._isComposing)return;const p=globalThis.process,A=!!p&&p.env?.NODE_ENV==="test"||typeof window<"u"&&globalThis.__vitest__;if(g.isTrusted===!1&&!A)return;const E=g.target;if(!E||E._modelUpdating)return;let N=E.value;if(w==="checkbox"){const f=b();if(Array.isArray(f)){const m=E.getAttribute("value")??"",k=Array.from(f);if(E.checked)k.includes(m)||k.push(m);else{const O=k.indexOf(m);O>-1&&k.splice(O,1)}N=k}else{const m=E.getAttribute("true-value")??!0,k=E.getAttribute("false-value")??!1;N=E.checked?m:k}}else if(w==="radio")N=E.getAttribute("value")??E.value;else if(w==="select"&&E.multiple)N=Array.from(E.selectedOptions).map(f=>f.value);else if(d&&typeof N=="string"&&(N=N.trim()),v){const f=Number(N);isNaN(f)||(N=f)}const h=b();if(ke(N,h)){E._modelUpdating=!0;try{Be(l.isReactiveState(e),e,N,o,a),we(o,l.isReactiveState(e),e,N),E&&ut(E,c,N)}finally{setTimeout(()=>E._modelUpdating=!1,0)}}};if(T){if(s[C]){const g=s[C];i&&Z.removeListener(i,C,g)}s[C]=S}else{const g=`update:${l.toKebab(c)}`,p=`update:${c}`;if(s[g]){const A=s[g];i&&Z.removeListener(i,g,A)}if(s[p]){const A=s[p];i&&Z.removeListener(i,p,A)}if(s[g]=A=>{const E=A.detail;let N=E!==void 0?E:void 0;if(N===void 0){const f=A.target;if(f&&typeof f=="object"&&"value"in f)try{N=f.value}catch{N=void 0}}const h=dt(l.isReactiveState(e),e,o,a);if(ke(N,h)){Be(l.isReactiveState(e),e,N,o,a),we(o,l.isReactiveState(e),e,N);const f=A.target;f&&ze(f,c,l.isReactiveState(e)?e:N,l.isReactiveState(e))}},l.isReactiveState(e)&&typeof e.value=="object"&&e.value!==null){let A=[];try{A=Reflect.ownKeys(e.value)}catch{A=Object.keys(e.value)}const E=A.filter(N=>typeof N=="string"&&!String(N).startsWith("_")&&N!=="constructor");for(const N of E){const h=String(N),_=`update:${l.toKebab(h)}`,f=`update:${h}`;s[_]||(s[_]=m=>{const k=m.detail!==void 0?m.detail:m.target?.value,O=l.isReactiveState(e)?e.value[h]:l.getNestedValue(o?._state||o,e);if(!ke(k,O))return;if(l.isReactiveState(e)){const I={...e.value};I[h]=k,e.value=I}else l.setNestedValue(o?._state||o,e,k);we(o,l.isReactiveState(e),e,k);const j=m.currentTarget||i||m.target;j&&ze(j,c,l.isReactiveState(e)?e:k,l.isReactiveState(e))},s[f]=s[_])}}s[p]=s[g]}(w==="text"||w==="textarea")&&(s.compositionstart=()=>s._isComposing=!0,s.compositionend=g=>{s._isComposing=!1;const p=g.target;p&&setTimeout(()=>{const A=p.value,E=o?._state||o,N=l.getNestedValue(E,e);let h=A;if(d&&(h=h.trim()),v){const f=Number(h);isNaN(f)||(h=f)}if(ke(h,N)){p._modelUpdating=!0;try{l.setNestedValue(E,e,h),we(o,l.isReactiveState(e),e,h)}finally{setTimeout(()=>p._modelUpdating=!1,0)}}},0)})}function Ye(e){const n=e.slice(2);return n?n.charAt(0).toLowerCase()+n.slice(1):""}function bt(e,n,t,r,s){if(typeof e=="object"&&e!==null)for(const[o,i]of Object.entries(e))if(o.startsWith("data-")||o.startsWith("aria-")||o==="class")t[o]=i;else if(o==="disabled"&&s&&q(s)){const a=i&&typeof i=="object"&&"value"in i;(()=>{try{return l.isReactiveState(i)}catch{return!1}})()||a?n[o]=i:t[o]=i}else n[o]=i;else if(typeof e=="string"){if(!r)return;try{const o=Ce(e,r);if(typeof o=="object"&&o!==null){for(const[i,a]of Object.entries(o))if(i.startsWith("data-")||i.startsWith("aria-")||i==="class")t[i]=a;else if(i==="disabled"&&s&&q(s)){const u=a&&typeof a=="object"&&"value"in a;(()=>{try{return l.isReactiveState(a)}catch{return!1}})()||u?n[i]=a:t[i]=a}else n[i]=a;return}else{t[e]=o;return}}catch{const o=l.getNestedValue(r,e);t[e]=o}}}function St(e,n,t){let r;if(typeof e=="string"){if(!t)return;r=Ce(e,t)}else r=e;const s=String(n.style||"");let o=s;if(r){if(s){const i=String(s).split(";").map(u=>u.trim()).filter(Boolean),a=i.findIndex(u=>u.startsWith("display:"));a>=0&&i[a]==="display: none"&&(i.splice(a,1),o=i.length>0?i.join("; ")+";":"")}}else if(s){const i=String(s).split(";").filter(Boolean),a=i.findIndex(u=>u.trim().startsWith("display:"));a>=0?i[a]="display: none":i.push("display: none"),o=i.join("; ")}else o="display: none";o!==s&&(o?n.style=o:n.style=void 0)}function Ce(e,n){return ft.evaluate(e,n)}function vt(e,n,t,r){let s;if(typeof e=="string"){if(!t)return;s=Ce(e,t)}else s=e;try{if(s&&typeof s=="object"){if(l.isReactiveState(s))s=s.value;else if("value"in s&&typeof s.value<"u"){const d=s.value;d instanceof Node||(s=d)}}}catch{}let o=[];if(typeof s=="string")o=[s];else if(Array.isArray(s))o=s.filter(Boolean);else if(typeof s=="object"&&s!==null)for(const[d,v]of Object.entries(s))v&&o.push(d);const i=o.join(" "),a=r&&r.class||n.class||"",u=a?`${a} ${i}`.trim():i.trim();u?n.class=u:n.class=void 0}function He(e){if(e===!0||e===!1)return!0;if(e==null)return!1;if(typeof e==="string")return e===""||e==="true"||e==="false";try{if(e&&typeof e=="object"&&"value"in e){const t=e.value,r=typeof t;return r==="boolean"?!0:r==="string"?t===""||t==="true"||t==="false":!1}}catch{}return!1}function Et(e,n,t){let r;if(typeof e=="string"){if(!t)return;r=Ce(e,t)}else r=e;let s="";if(typeof r=="string")s=r;else if(r&&typeof r=="object"){const i=[];for(const[a,u]of Object.entries(r))if(u!=null&&u!==""){const d=a.replace(/[A-Z]/g,y=>`-${y.toLowerCase()}`),v=["width","height","top","right","bottom","left","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","font-size","line-height","border-width","border-radius","min-width","max-width","min-height","max-height"];let b=String(u);typeof u=="number"&&v.includes(d)&&(b=`${u}px`),i.push(`${d}: ${b}`)}s=i.join("; ")+(i.length>0?";":"")}const o=String(n.style||"");n.style=o+(o&&!o.endsWith(";")?"; ":"")+s}function Ct(e,n,t){let r=e;typeof e=="string"&&t&&(r=Ce(e,t)),l.isReactiveState(r)?n.reactiveRef=r:n.ref=r}function Xe(e,n,t,r){const s={},o={...r||{}},i={};for(const[a,u]of Object.entries(e)){const{value:d,modifiers:v,arg:b}=u;if(a==="model"||a.startsWith("model:")){const y=a.split(":"),w=y.length>1?y[1]:b;gt(d,v,s,o,i,n,t,w);continue}switch(a){case"bind":bt(d,s,o,n,t);break;case"show":St(d,o,n);break;case"class":vt(d,o,n,r);break;case"style":Et(d,o,n);break;case"ref":Ct(d,s,n);break}}try{if(Object.prototype.hasOwnProperty.call(s,"disabled")&&t&&q(t)){const u=s.disabled,d=u&&typeof u=="object"&&"value"in u;let v=!1;try{v=l.isReactiveState(u)}catch{v=!1}if(!d&&!v)try{o.disabled=u,delete s.disabled;const b=globalThis;b.__VDOM_DISABLED_PROMOTIONS||(b.__VDOM_DISABLED_PROMOTIONS=[]),b.__VDOM_DISABLED_PROMOTIONS.push({phase:"bind-directive:postfix-move",location:"attrs",key:"disabled",value:u,time:Date.now(),stack:new Error().stack})}catch{}}}catch{}return{props:s,attrs:o,listeners:i}}function xe(e,n){if(Array.isArray(e)){const o=new Set;return e.map(i=>{if(!i||typeof i!="object")return i;let a=i.props?.key??i.key;if(!a){const b=i.tag||"node",w=[i.props?.attrs?.id,i.props?.attrs?.name,i.props?.attrs?.["data-key"],i.props?.props?.id,i.props?.props?.name,i.props?.props?.dataKey,i.props?.props?.["data-key"]].find(T=>T!=null)??"";a=w?`${n}:${b}:${w}`:`${n}:${b}`}let u=a,d=1;for(;o.has(u);)u=`${a}#${d++}`;o.add(u);let v=i.children;return Array.isArray(v)&&(v=xe(v,u)),{...i,key:u,children:v}})}const t=e,r=t.props?.key??t.key??n;let s=t.children;return Array.isArray(s)&&(s=xe(s,r)),{...t,key:r,children:s}}function Ke(e,n,t,r){const s=t.directives??{},o=t.attrs?{...t.attrs}:{},i=Xe(s,r,e,o),a={...n.props||{},...t.props||{},...i.props||{}},u={...n.attrs||{},...o||{},...i.attrs||{}},d=n.props??{},v=a,b=!!(t?.isCustomElement??n?.isCustomElement??!1);let y=!1;for(const c in{...d,...v}){const C=d[c],S=v[c];let g=C,p=S;if(l.safe(()=>{(l.isReactiveState(C)||le(C))&&(g=C.value)}),l.safe(()=>{(l.isReactiveState(S)||le(S))&&(p=S.value)}),!(C===S&&g===p))if(y=!0,c==="value"&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)){const A=$e(S),E=A==null?"":String(A);e.value!==E&&(e.value=E)}else if(c==="checked"&&e instanceof HTMLInputElement){const A=$e(S);e.checked=!!A}else if(c.startsWith("on")&&typeof S=="function"){const A=Ye(c);typeof C=="function"&&Z.removeListener(e,A,C),typeof S=="function"&&Z.addListener(e,A,S);try{if(A&&A.startsWith("update:")){const E=A.split(":",2)[1],N=v[E];let h=[];try{if(l.isReactiveState(N)){const f=N.value;h=f&&typeof f=="object"?Object.keys(f):[]}else N&&typeof N=="object"&&(h=Object.keys(N))}catch{h=[]}const _=h.filter(f=>typeof f=="string"&&!f.startsWith("_")&&f!=="constructor");for(const f of _){const m=`update:${f}`,k=O=>{const M=O.detail!==void 0?O.detail:O.target instanceof HTMLInputElement||O.target instanceof HTMLTextAreaElement||O.target instanceof HTMLSelectElement?O.target.value:void 0,I={...l.isReactiveState(N)?N.value||{}:v[E]||{},[f]:M};try{typeof S=="function"&&S({detail:I})}catch{}};l.safe(()=>{Z.addListener(e,m,k)})}}}catch{}}else if(S==null)l.removeAttributeSmart(e,c);else{const A=t?.isCustomElement??n?.isCustomElement??!1;if(A||c in e)try{e[c]=S,c==="disabled"&&S===!1&&!A&&q(e)&&l.removeAttributeSmart(e,"disabled")}catch{}else S===!1&&l.removeAttributeSmart(e,c)}}for(const[c,C]of Object.entries(i.listeners||{})){Z.addListener(e,c,C);try{const S=e&&e.parentElement;S&&S!==e&&Z.addListener(S,c,C)}catch{}}const w={...n.attrs??{}},T=u,L=i&&i.attrs||{};if(Object.prototype.hasOwnProperty.call(L,"class")&&typeof e.getAttribute=="function"){const c=e.getAttribute("class");c!==null&&(w.class=c)}if(Object.prototype.hasOwnProperty.call(L,"style")&&typeof e.getAttribute=="function"){const c=e.getAttribute("style");c!==null&&(w.style=c)}try{if(Object.prototype.hasOwnProperty.call(L,"class")&&L.class===void 0&&typeof e.getAttribute=="function"){const c=e.getAttribute("class");c!==null&&(w.class=c)}if(Object.prototype.hasOwnProperty.call(L,"style")&&L.style===void 0&&typeof e.getAttribute=="function"){const c=e.getAttribute("style");c!==null&&(w.style=c)}try{if(typeof e.getAttribute=="function"){const c=e.getAttribute("class");try{e instanceof HTMLInputElement&&e.type==="text"&&c!==null&&c!==w.class&&(w.class=c)}catch{}}}catch{}}catch{}for(const c in{...w,...T}){const C=w[c],S=T[c];let g=C,p=S;if(l.isReactiveState(C)&&(g=C.value),l.isReactiveState(S)&&(p=S.value),g!==p)if(y=!0,p==null||p===!1)l.safe(()=>{l.removeAttributeSmart(e,c)}),X(n,c,void 0),c==="value"&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?l.safe(()=>{e.value=""}):e instanceof HTMLSelectElement?l.safe(()=>{e.value=""}):e instanceof HTMLProgressElement&&l.safe(()=>{e.value=0})),c==="checked"&&e instanceof HTMLInputElement&&l.safe(()=>{e.checked=!1}),c==="disabled"&&q(e)&&l.safe(()=>{(e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLButtonElement)&&(e.disabled=!1)});else{if(c==="value"){if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement){l.safe(()=>{e.value=p??""});continue}else if(e instanceof HTMLSelectElement){l.safe(()=>{e.value=p??""});continue}else if(e instanceof HTMLProgressElement){l.safe(()=>{e.value=Number(p)});continue}}if(c==="checked"&&e instanceof HTMLInputElement){l.safe(()=>{e.checked=!!p});continue}if(c==="style"){const E=l.safeSerializeAttr(p);E!==null&&l.setAttributeSmart(e,c,String(E)),X(n,c,p);continue}if(c==="class"){const E=l.safeSerializeAttr(p);E!==null&&l.setAttributeSmart(e,c,String(E)),X(n,c,p);continue}if(c==="disabled"&&q(e)){l.safe(()=>{const E=fe(p);(e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLButtonElement)&&(e.disabled=E)}),fe(p)?l.safe(()=>{l.setAttributeSmart(e,c,"")}):l.safe(()=>{l.removeAttributeSmart(e,c)});continue}const A=e.namespaceURI==="http://www.w3.org/2000/svg";if(b&&!A&&c.includes("-"))if(l.isClassLikeAttr(c)){const E=l.safeSerializeAttr(S??p);if(E!==null){try{l.setAttributeSmart(e,c,String(E))}catch{}X(n,c,p)}}else{const E=l.toCamel(c);try{const N=e;N[E]=l.isReactiveState(S)?S:p,X(n,c,p)}catch{const N=l.safeSerializeAttr(S??p);N!==null&&l.setAttributeSmart(e,c,String(N))}}else if(!A&&c in e)try{const E=e;E[c]=l.isReactiveState(S)?S:p,X(n,c,p)}catch{const E=l.safeSerializeAttr(p);E!==null&&(l.setAttributeSmart(e,c,String(E)),X(n,c,p))}else{const E=l.safeSerializeAttr(p);E!==null&&(l.setAttributeSmart(e,c,String(E)),X(n,c,p))}}}try{if(q(e)){const c=a.disabled;let C;try{const g=Object.prototype.hasOwnProperty.call(i.props||{},"disabled"),p=c&&typeof c=="object"&&"value"in c;let A=!1;l.safe(()=>{A=!!l.isReactiveState(c)});const E=He(c);A||p||g||E?C=c:C=u.disabled}catch{C=u.disabled}const S=fe(C);l.safe(()=>{(e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLButtonElement)&&(e.disabled=S)}),S?l.safe(()=>{l.setAttributeSmart(e,"disabled","")}):l.safe(()=>{l.removeAttributeSmart(e,"disabled")})}}catch{}if(b&&y){const c=e;l.safe(()=>{c._applyProps?.(c._cfg)}),l.safe(()=>{typeof c.requestRender=="function"?c.requestRender():typeof c._render=="function"&&c._render?.(c._cfg)})}}function U(e,n,t,r=null){if(typeof e=="string")return document.createTextNode(e);if(e.tag==="#text"){const c=document.createTextNode(typeof e.children=="string"?e.children:"");return e.key!=null&&V(c,e.key),c}if(e.tag==="#raw"){const c=typeof e.children=="string"?e.children:"";return document.createRange().createContextualFragment(c)}if(e.tag==="#anchor"){const c=e,C=Array.isArray(c.children)?c.children:[],S=document.createTextNode(""),g=document.createTextNode("");c.key!=null&&(V(S,`${c.key}:start`),V(g,`${c.key}:end`)),c._startNode=S,c._endNode=g;const p=document.createDocumentFragment();p.appendChild(S);for(const A of C){const E=U(A,n,t,r);if(c.key!=null&&E instanceof Element&&!E.hasAttribute("data-anchor-key")){const N=A;N&&typeof N=="object"&&N.key!=null||V(E,String(c.key))}p.appendChild(E)}return p.appendChild(g),p}const s=e&&typeof e=="object"&&e.props&&e.props.attrs?e.props.attrs:void 0,i=(s&&typeof s.xmlns=="string"?String(s.xmlns):void 0)??r??l.TAG_NAMESPACE_MAP[e.tag]??null,a=i?document.createElementNS(i,e.tag):document.createElement(e.tag);e.key!=null&&V(a,e.key),e.props&&e.props?._transitionGroup&&mt(a,e.props?._transitionGroup);const{props:u={},attrs:d={},directives:v={}}=e.props??{},b=Xe(v,n,a instanceof HTMLElement?a:void 0,d),y={...u,...b.props},w={...d,...b.attrs};try{const c=(w&&w.class)??(y&&y.class)??(e.props&&e.props.attrs&&e.props.attrs.class)??(e.props&&e.props.props&&e.props.props.class),C=l.safeSerializeAttr(c);if(C!==null){const S=String(C).trim();S&&l.setAttributeSmart(a,"class",S)}}catch{}try{if(y.disabled!==void 0&&a&&q(a)){const c=y.disabled,C=c&&typeof c=="object"&&"value"in c;let S=!1;try{S=l.isReactiveState(c)}catch{S=!1}!C&&!S&&l.safe(()=>{w.disabled=c,delete y.disabled})}}catch{}const T=a.namespaceURI==="http://www.w3.org/2000/svg";for(const c in w){const C=w[c];if(typeof c!="string"||/\[object Object\]/.test(c))continue;const S=$e(C);if(typeof S=="boolean")S?l.setAttributeSmart(a,c,""):l.safe(()=>{l.removeAttributeSmart(a,c)});else if(S!=null){if(c==="disabled"&&q(a)){const g=y.disabled,p=He(g)?g:S,A=fe(p);l.safe(()=>{a.disabled=A}),A?l.safe(()=>{l.setAttributeSmart(a,c,"")}):l.safe(()=>{l.removeAttributeSmart(a,c)});continue}if(!T&&c==="value"&&(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement||a instanceof HTMLProgressElement))try{a instanceof HTMLProgressElement?a.value=Number(S):a.value=String(S??"")}catch{const g=l.safeSerializeAttr(S);g!==null&&l.setAttributeSmart(a,c,String(g))}else if(!T&&c==="checked"&&a instanceof HTMLInputElement)try{a.checked=!!S}catch{const g=l.safeSerializeAttr(S);g!==null&&l.setAttributeSmart(a,c,String(g))}else if(!T&&c in a)try{a[c]=S,c==="disabled"&&S===!1&&q(a)&&l.removeAttributeSmart(a,"disabled"),X(e.props,c,S)}catch{const g=l.safeSerializeAttr(S);g!==null&&l.setAttributeSmart(a,c,String(g))}else if((e.props?.isCustomElement??!1)&&!T&&c.includes("-")){const p=l.toCamel(c);try{a[p]=S}catch{const A=l.safeSerializeAttr(S);A!==null&&l.setAttributeSmart(a,c,String(A))}}else{const p=l.safeSerializeAttr(S);p!==null&&l.setAttributeSmart(a,c,String(p))}}}for(const c in y){const C=y[c];if(!(typeof c!="string"||/\[object Object\]/.test(c)))if(c==="value"&&(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement)){const S=typeof C=="object"&&C!==null&&le(C)?C.value:C;l.safe(()=>{a.value=String(S??"")})}else if(c.startsWith("on")&&typeof C=="function"){const S=Ye(c),g=S.includes(":")?(()=>{const p=S.split(":"),A=p[1];if(A.includes("-")){const E=A.split("-").map((N,h)=>h===0?N:N.charAt(0).toUpperCase()+N.slice(1)).join("");return`${p[0]}:${E}`}else{const E=A.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return`${p[0]}:${E}`}})():S;b.listeners&&(b.listeners[S]||b.listeners[g])||Z.addListener(a,S,C)}else{if(c.startsWith("on")&&C===void 0)continue;if(C==null||C===!1)l.removeAttributeSmart(a,c);else{const S=e.props?.isCustomElement??!1,g=typeof C=="object"&&C!==null&&l.isReactiveState(C)?C:le(C)&&typeof C.value<"u"?C.value:C;if(c==="class"||c==="style"){try{const p=l.safeSerializeAttr(g);p!==null&&l.setAttributeSmart(a,c,String(p))}catch{}continue}if(S||c in a)try{const p=typeof C=="object"&&C!==null&&l.isReactiveState(C)?C:le(C)?C.value:C;if(c==="disabled"&&q(a)){const A=y.disabled!==void 0?y.disabled:p,E=fe(A);l.safe(()=>{a.disabled=E}),E?l.safe(()=>{l.setAttributeSmart(a,c,"")}):l.safe(()=>{l.removeAttributeSmart(a,c)});continue}try{if(typeof a[c]=="boolean"){let E=p;typeof p=="string"?p==="false"?E=!1:p==="true"?E=!0:E=!!p&&p!=="":E=!!p,a[c]=E}else a[c]=p}catch{a[c]=p}}catch{}}}}for(const[c,C]of Object.entries(b.listeners||{}))Z.addListener(a,c,C);const L={...e,props:{...e.props,...b.props}};ge(L,a,t);try{const c=a;if(typeof c._applyProps=="function")try{c._applyProps(c._cfg)}catch{}typeof c.requestRender=="function"?c.requestRender():typeof c._render=="function"&&c._render(c._cfg)}catch{}if(Array.isArray(e.children)){const c=e.tag==="foreignObject"&&i===l.SVG_NS?null:a.namespaceURI??null;for(const C of e.children)a.appendChild(U(C,n,t,c))}else typeof e.children=="string"&&(a.textContent=e.children);try{if(a instanceof HTMLSelectElement&&w&&Object.prototype.hasOwnProperty.call(w,"value"))try{a.value=String(w.value??"")}catch{}}catch{}try{if(q(a)){const c=y.disabled,C=w.disabled,S=c&&typeof c=="object"&&"value"in c;let g=!1;try{g=!!l.isReactiveState(c)}catch{g=!1}const A=g||S||He(c)?c:C,E=fe(A);l.safe(()=>{a.disabled=E}),E?l.safe(()=>{l.setAttributeSmart(a,"disabled","")}):l.safe(()=>{l.removeAttributeSmart(a,"disabled")})}}catch{}return a}function At(e,n,t,r,s){if(typeof t=="string"){e.textContent!==t&&(e.textContent=t);return}if(!Array.isArray(t))return;const o=e.childNodes,i=[];for(let L=0;L<o.length;L++)i.push(o[L]);const a=Array.isArray(n)?n:[],u=yt(e);if(u){const L=g=>{if(typeof g=="string")return g.startsWith("each-")?g.substring(5):g;if(typeof g=="number")return String(g)},c=[],C=[];for(const g of t)if(g&&g.tag==="#anchor"){const p=Array.isArray(g.children)?g.children:[];for(const A of p){const E=L(A.key??g.key??"unknown");c.push({...A,key:E})}}else g&&c.push({...g,key:L(g.key)});for(const g of a)if(g&&g.tag==="#anchor"){const p=Array.isArray(g.children)?g.children:[];for(const A of p){const E=L(A.key??g.key??"unknown");C.push({...A,key:E})}}else g&&C.push({...g,key:L(g.key)});if(c.some(g=>g&&g.key!=null)||C.some(g=>g&&g.key!=null)){const g=new Map,p=new Map;for(const f of C)if(f&&f.key!=null){const m=String(f.key);g.set(m,f)}for(let f=0;f<i.length;f++){const m=i[f];let k=Te(m);if(k=L(k),k!=null&&m instanceof Element&&m.nodeType===Node.ELEMENT_NODE){let O=typeof k=="string"&&k.includes(":")?k.substring(0,k.lastIndexOf(":")):k;O=String(O),p.set(O,m)}}const A=new Set,E=new Map,N=i.length>0;if(u.moveClass&&N)for(let f=0;f<i.length;f++){const m=i[f];if(m instanceof HTMLElement&&m.parentElement){const k=m.getBoundingClientRect();E.set(m,k)}}const h=[];for(const f of c){let m=f.key;if(m==null)continue;m=String(m);const k=g.get(m);let O=p.get(m);if(O&&k){const M=be(O,k,f,r);A.add(O);const j=String(m);V(M,j),h.push({node:M,key:m,newVNode:f,oldVNode:k,isNew:!1})}else{O=U(f,r,void 0,e instanceof Element?e.namespaceURI??null:null),V(O,String(m)),e.appendChild(O);const M=N||u.appear===!0;O instanceof HTMLElement&&M&&me(O,u).catch(j=>{$.devError("Enter transition error:",j)}),h.push({node:O,key:m,newVNode:f,isNew:!0})}}const _=[];for(let f=0;f<i.length;f++){const m=i[f],k=Te(m);if(!A.has(m)&&k!=null&&m instanceof HTMLElement){const M=Me(m,u).then(()=>{e.contains(m)&&e.removeChild(m)}).catch(j=>{$.devError("Leave transition error:",j),e.contains(m)&&e.removeChild(m)});_.push(M)}}if(_.length===0){let f=e.firstChild;for(const{node:m}of h)m!==f&&e.insertBefore(m,f),f=m.nextSibling;if(u.moveClass&&E.size>0){const m=[];for(const{node:k,isNew:O}of h)if(!O&&k instanceof HTMLElement){const M=E.get(k);if(M){const j=k.getBoundingClientRect(),I=M.left-j.left,R=M.top-j.top;if(I!==0||R!==0){const B=u.moveClass.split(/\s+/).filter(x=>x);m.push({node:k,deltaX:I,deltaY:R,moveClasses:B})}}}if(m.length>0){for(const{node:k,deltaX:O,deltaY:M}of m)k.style.transform=`translate(${O}px, ${M}px)`,k.style.transitionProperty="none";e.offsetHeight,requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{node:k,moveClasses:O}of m)for(const M of O)k.classList.add(M);requestAnimationFrame(()=>{const k=u.moveClass||"",O=k.match(/duration-(\d+)/),M=O?`${O[1]}ms`:"300ms",j=k.match(/ease-(out|in|in-out|linear)/),I=j?`ease-${j[1]}`:"ease-out";for(const{node:R}of m)R.style.transition=`transform ${M} ${I}`;requestAnimationFrame(()=>{for(const{node:R,moveClasses:B}of m){R.style.removeProperty("transform");const x=()=>{for(const Q of B)R.classList.remove(Q);R.style.removeProperty("transition"),R.removeEventListener("transitionend",x),R.removeEventListener("transitioncancel",x)};R.addEventListener("transitionend",x,{once:!0}),R.addEventListener("transitioncancel",x,{once:!0})}})})})})}}}return}}const d=new Map;for(const L of a)L&&L.key!=null&&d.set(L.key,L);const v=new Map;for(let L=0;L<i.length;L++){const c=i[L],C=Te(c);C!=null&&v.set(C,c)}const b=new Set;let y=e.firstChild;function w(L,c){let C=L;for(;C&&(b.add(C),C!==c);)C=C.nextSibling}function T(L,c,C,S,g,p=!0){const A=[];let E=L.nextSibling;for(;E&&E!==c;)A.push(E),E=E.nextSibling;const N=Array.isArray(C)?C:[];if(S.some(_=>_&&_.key!=null)||N.some(_=>_&&_.key!=null)){const _=new Map,f=new Map;for(const M of N)M&&M.key!=null&&_.set(M.key,M);for(const M of A){const j=Te(M);j!=null&&f.set(j,M)}const m=g&&g.state==="visible"&&N.length===0&&S.length>0,k=new Set;let O=L.nextSibling;for(const M of S){let j;if(M.key!=null&&f.has(M.key)){const I=_.get(M.key);j=be(f.get(M.key),I,M,r),k.add(j),g&&j instanceof HTMLElement&&m&&g.appear&&me(j,g).catch(R=>{$.devError("Transition enter error (appear):",R)}),j!==O&&e.contains(j)&&e.insertBefore(j,O)}else j=U(M,r,void 0,e instanceof Element?e.namespaceURI??null:null),e.insertBefore(j,O),k.add(j),g&&j instanceof HTMLElement&&p&&me(j,g).catch(I=>{$.devError("Transition enter error:",I)});O=j.nextSibling}for(const M of A)!k.has(M)&&e.contains(M)&&(g&&M instanceof HTMLElement&&p?Me(M,g).then(()=>{e.contains(M)&&e.removeChild(M)}).catch(j=>{$.devError("Transition leave error:",j),e.contains(M)&&e.removeChild(M)}):e.removeChild(M))}else{const _=Math.min(N.length,S.length);for(let f=0;f<_;f++){const m=N[f],k=S[f],O=be(A[f],m,k,r);O!==A[f]&&(e.insertBefore(O,A[f]),e.removeChild(A[f]))}for(let f=_;f<S.length;f++){const m=U(S[f],r,void 0,e instanceof Element?e.namespaceURI??null:null);e.insertBefore(m,c),g&&m instanceof HTMLElement&&p&&me(m,g).catch(k=>{$.devError("Transition enter error:",k)})}for(let f=_;f<A.length;f++){const m=A[f];g&&m instanceof HTMLElement&&p?Me(m,g).then(()=>{e.contains(m)&&e.removeChild(m)}).catch(k=>{$.devError("Transition leave error:",k),e.contains(m)&&e.removeChild(m)}):e.removeChild(m)}}}for(const L of t){let c;if(L.tag==="#anchor"){const C=L.key,S=`${C}:start`,g=`${C}:end`;let p=v.get(S),A=v.get(g);const E=Array.isArray(L.children)?L.children:[];if(p||(p=document.createTextNode(""),V(p,S)),A||(A=document.createTextNode(""),V(A,g)),L._startNode=p,L._endNode=A,!e.contains(p)||!e.contains(A)){e.insertBefore(p,y);const N=L._transition,_=!(N&&N.state==="visible"&&E.length>0)||N.appear;for(const f of E){const m=U(f,r,s,e instanceof Element?e.namespaceURI??null:null);e.insertBefore(m,y),N&&m instanceof HTMLElement&&_&&me(m,N).catch(k=>{$.devError("Transition enter error:",k)})}e.insertBefore(A,y)}else{const N=L._transition,_=d.get(C)._transition,f=_&&_.state!==N?.state,m=N&&N.state==="visible"&&E.length>0&&!f,k=f||!m||N?.appear===!0;T(p,A,d.get(C)?.children,E,N,k)}w(p,A),y=A.nextSibling;continue}if(L.key!=null&&v.has(L.key)){const C=d.get(L.key);c=be(v.get(L.key),C,L,r,s),b.add(c),c!==y&&e.contains(c)&&(y&&!e.contains(y)&&(y=null),e.insertBefore(c,y))}else c=U(L,r,s,e instanceof Element?e.namespaceURI??null:null),y&&!e.contains(y)&&(y=null),e.insertBefore(c,y),b.add(c);y=c.nextSibling}for(let L=0;L<i.length;L++){const c=i[L];!b.has(c)&&e.contains(c)&&(ie(c,s),e.removeChild(c))}}function be(e,n,t,r,s){if(n&&typeof n!="string"&&n.props?.ref&&s&&ie(e,s),n===t)return e;if(typeof t=="string"){if(e.nodeType===Node.TEXT_NODE)return e.textContent!==t&&(e.textContent=t),e;{const i=document.createTextNode(t);return e.parentNode?.replaceChild(i,e),i}}if(t&&typeof t!="string"&&t.tag==="#anchor"){const i=t,a=Array.isArray(i.children)?i.children:[],u=i._startNode??document.createTextNode(""),d=i._endNode??document.createTextNode("");i.key!=null&&(V(u,`${i.key}:start`),V(d,`${i.key}:end`)),i._startNode=u,i._endNode=d;const v=document.createDocumentFragment();v.appendChild(u);for(const b of a){const y=U(b,r,s,e.parentNode instanceof Element?e.parentNode.namespaceURI??null:null);v.appendChild(y)}return v.appendChild(d),e.parentNode?.replaceChild(v,e),u}if(!t){ie(e,s);const i=document.createComment("removed");return e.parentNode?.replaceChild(i,e),i}if(!n||typeof n=="string"){ie(e,s);const i=U(t,r,s,e.parentNode instanceof Element?e.parentNode.namespaceURI??null:null);return ge(t,i,s),e.parentNode?.replaceChild(i,e),i}if(t.tag==="#anchor"){const i=Array.isArray(t.children)?t.children:[],a=t._startNode??document.createTextNode(""),u=t._endNode??document.createTextNode("");t.key!=null&&(V(a,`${t.key}:start`),V(u,`${t.key}:end`)),t._startNode=a,t._endNode=u;const d=document.createDocumentFragment();d.appendChild(a);for(const v of i)d.appendChild(U(v,r,s,e.parentNode instanceof Element?e.parentNode.namespaceURI??null:null));return d.appendChild(u),e.parentNode?.replaceChild(d,e),a}if(typeof n!="string"&&typeof t!="string"&&n.tag===t.tag&&n.key===t.key){const i=e;return Ke(i,n.props||{},t.props||{},r),At(i,n.children,t.children,r,s),ge(t,i,s),i}if(typeof n!="string"&&typeof t!="string"&&n.tag===t.tag&&(n.tag&&String(n.tag).includes("-")||t.props&&t.props.isCustomElement||n.props&&n.props.isCustomElement))try{const a=e;return Ke(a,n.props||{},t.props||{},r),ge(t,a,s),a}catch{}ie(e,s);const o=U(t,r,s,e.parentNode instanceof Element?e.parentNode.namespaceURI??null:null);return ge(t,o,s),e.parentNode?.replaceChild(o,e),o}function _t(e,n,t,r){let s;Array.isArray(n)?n.length===1?(s=n[0],s&&typeof s=="object"&&s.key==null&&(s={...s,key:"__root__"})):s={tag:"div",key:"__root__",children:n}:(s=n,s&&typeof s=="object"&&s.key==null&&(s={...s,key:"__root__"})),s&&typeof s=="object"&&s.tag==="#anchor"&&(s={tag:"div",key:"__anchor_root__",props:{attrs:{"data-anchor-block-root":"",key:"__anchor_root__"}},children:[s]}),s=xe(s,String(s.key??"root"));const o=e._prevVNode??null,i=e._prevDom??e.firstChild??null;let a;o&&i?typeof o!="string"&&typeof s!="string"&&o.tag===s.tag&&o.key===s.key?a=be(i,o,s,t,r):(a=U(s,t,r,e.host instanceof Element?e.host.namespaceURI??null:null),e.replaceChild(a,i)):(a=U(s,t,r,e.host instanceof Element?e.host.namespaceURI??null:null),e.firstChild?e.replaceChild(a,e.firstChild):e.appendChild(a));const u=[];for(let d=0;d<e.childNodes.length;d++){const v=e.childNodes[d];v!==a&&v.nodeName!=="STYLE"&&(ie(v,r),u.push(v))}u.forEach(d=>e.removeChild(d)),e._prevVNode=s,e._prevDom=a}const Se=[],Ve=new WeakMap,ve=new WeakMap;function kt(e,n){ve.has(e)||ve.set(e,new Set),ve.get(e).add(n)}function wt(e,n){const t=ve.get(e);t&&t.delete(n)}function Tt(e,n,t,r,s,o,i,a){if(e){Se.push(t);try{const u=n.render(t);if(u instanceof Promise){o(!0),u.then(d=>{o(!1),i(null),Ue(e,d,t,r,s),a(e.innerHTML)}).catch(d=>{o(!1),i(d)});return}Ue(e,u,t,r,s),a(e.innerHTML)}finally{Se.pop()}}}function Ue(e,n,t,r,s){e&&(_t(e,Array.isArray(n)?n:[n],t,r),s(e.innerHTML))}function Lt(e,n,t,r,s,o,i){if(o!==null&&clearTimeout(o),Date.now()-n<16){if(s(t+1),t===15)$.devWarn(`⚠️ Component is re-rendering rapidly. This might indicate:
2
- Common causes:
3
- • Event handler calling a function immediately: @click="\${fn()}" should be @click="\${fn}"
4
- • State modification during render
5
- • Missing dependencies in computed/watch
6
- Component rendering will be throttled to prevent browser freeze.`);else if(t>20){$.devError(`🛑 Infinite loop detected in component render:
7
- • This might be caused by state updates during render
8
- • Ensure all state modifications are done in event handlers or effects
9
- Stopping runaway component render to prevent browser freeze`),i(null);return}}else s(0);const d=t>=10?100:0;if(d>0){const v=setTimeout(()=>{r(Date.now()),e(),i(null)},d);i(v)}else i({}),queueMicrotask(()=>{r(Date.now());try{e()}finally{i(null)}})}function Nt(e,n){let t=n||"";try{const r=ve.get(e);if(r&&r.size>0)for(const s of r){const o=Fe(s);o&&(t+=`
10
- `+o)}else{const s=Array.from(e.querySelectorAll("*"));for(const o of s){const i=Fe(o);i&&(t+=`
11
- `+i)}}}catch{}return t}function Fe(e){try{const n=e.lastHtmlStringForJitCSS;return n&&typeof n=="string"&&n.trim()?n:""}catch{return""}}function Ot(e,n,t){const r=Nt(e,t),o=Ve.get(e)!==r;o&&Ve.set(e,r);const i=z.jitCSS(r),a=z.getProseSheet(),u=n._computedStyle||"";return{shouldUpdateStyles:o,aggregatedHtml:r,jitCss:i,proseSheet:a,userStyle:u}}function Mt(e,n){if("adoptedStyleSheets"in e&&typeof CSSStyleSheet<"u"){const r=[z.getBaseResetSheet(),z.getTransitionStyleSheet()];n&&r.push(n),e.adoptedStyleSheets=r}else Qe(e,"",n)}function Rt(e,n,t,r,s){if(!("adoptedStyleSheets"in e&&typeof CSSStyleSheet<"u"))return!1;let i=r;i||(i=new CSSStyleSheet);try{i.replaceSync(n)}catch{return!1}const a=[z.getBaseResetSheet(),z.getTransitionStyleSheet()];return t&&a.push(t),a.push(i),e.adoptedStyleSheets=a,s(i),!0}function jt(e){const n=z.minifyCSS(z.baseReset),t=z.getTransitionStyleSheet();let r="";try{t&&"cssRules"in t&&(r=Array.from(t.cssRules).map(s=>s.cssText).join(`
12
- `))}catch{r=""}return z.minifyCSS(`${n}
13
- ${r}
14
- ${e}`)}function Qe(e,n,t){const r=jt(n);let s=e.querySelector("style[data-cer-runtime]");s||(s=document.createElement("style"),l.setAttributeSmart(s,"data-cer-runtime","true"),e.appendChild(s));try{s.textContent=r}catch{}Pt(e,n,t)}function Pt(e,n,t){try{const r=[z.getBaseResetSheet(),z.getTransitionStyleSheet()];if(t&&r.push(t),typeof CSSStyleSheet<"u"&&n)try{const s=new CSSStyleSheet;s.replaceSync(n),r.push(s)}catch{r.push({cssRules:[],replaceSync:()=>{}})}e.adoptedStyleSheets=r}catch{}}function $t(e,n,t,r,s){if(!e)return;const{shouldUpdateStyles:o,jitCss:i,proseSheet:a,userStyle:u}=Ot(e,n,t);if(!o&&!u&&!a)return;if((!i||i.trim()==="")&&!u&&!a){s(null),Mt(e,a);return}const d=z.sanitizeCSS(`${u}
15
- ${i}
16
- `),v=z.minifyCSS(d);Rt(e,v,a,r,s)||(Qe(e,v,a),s(null))}let W=null;function qe(e){W=e}function Re(){W=null}function Ht(){if(!W)throw new Error("useEmit must be called during component render");const e=W.emit;if(typeof e!="function")throw new Error("useEmit requires an emit function on the component context");const n=e;return(t,r,s)=>n(t,r,s)}function de(e){e._hookCallbacks||Object.defineProperty(e,"_hookCallbacks",{value:{},writable:!0,enumerable:!1,configurable:!1})}function xt(e){if(!W)throw new Error("useOnConnected must be called during component render");de(W),W._hookCallbacks.onConnected=e}function It(e){if(!W)throw new Error("useOnDisconnected must be called during component render");de(W),W._hookCallbacks.onDisconnected=e}function Wt(e){if(!W)throw new Error("useOnAttributeChanged must be called during component render");de(W),W._hookCallbacks.onAttributeChanged=e}function Dt(e){if(!W)throw new Error("useOnError must be called during component render");de(W),W._hookCallbacks.onError=n=>{try{n instanceof Error?e(n):e(new Error(String(n)))}catch{}}}function Bt(e){if(!W)throw new Error("useProps must be called during component render");de(W);const n=W._hookCallbacks;n.props={...n.props||{},...e};const t=W;try{const s=Object.keys(e||{});for(const o of s){if(typeof o!="string"||o.startsWith("_"))continue;const i=Object.getOwnPropertyDescriptor(t,o);if(!(i&&!i.configurable))try{let u=Object.prototype.hasOwnProperty.call(t,o)?t[o]:void 0;Object.defineProperty(t,o,{configurable:!0,enumerable:!0,get(){try{const d=t&&t._host;if(d){const v=l.toKebab(o),b=d.getAttribute(v);if(b!==null){const y=typeof e[o];return y==="boolean"?b===""||b==="true":y==="number"?Number(b):b}if(typeof d[o]<"u"){const y=d[o];if(l.isReactiveState(y)||y&&typeof y=="object"&&"value"in y&&!(y instanceof Node))return y.value;const w=typeof e[o];if(!(w==="string"&&y&&typeof y=="object"))return w==="boolean"&&typeof y=="string"?y===""||y==="true":y}}}catch{}return u},set(d){u=d}})}catch{}}}catch{}return new Proxy({},{get(s,o){if(typeof o!="string")return;const i=e[o];try{const u=t&&t._host;if(u){if(u instanceof HTMLElement||typeof u.getAttribute=="function"&&typeof u.hasAttribute=="function"){const v=o.replace(/([A-Z])/g,"-$1").toLowerCase(),b=u.getAttribute(v);if(b!==null)return typeof i=="boolean"?b===""||b==="true":typeof i=="number"?Number(b):b}const d=u[o];if(typeof d<"u"&&d!==""){const v=d&&typeof d=="object"&&"value"in d&&!(d instanceof Node);if(!(typeof i=="string"&&d&&typeof d=="object"&&!v&&!l.isReactiveState(d)))return typeof i=="boolean"&&i===!1&&d===""?i:l.isReactiveState(d)||v?d.value:typeof i=="boolean"&&typeof d=="string"?d==="true"||d!==""&&d!=="false":typeof i=="number"&&typeof d=="string"&&!Number.isNaN(Number(d))?Number(d):d}}}catch{}const a=t[o];return typeof i=="boolean"&&a===""?i===!1?i:!0:l.isReactiveState(a)||a&&typeof a=="object"&&"value"in a&&!(a instanceof Node)?a.value:a!=null&&a!==""?typeof i=="boolean"&&typeof a=="string"?a==="true":typeof i=="number"&&typeof a=="string"&&!Number.isNaN(Number(a))?Number(a):a:i},has(s,o){return typeof o=="string"&&(o in t||o in e)},ownKeys(){return Array.from(new Set([...Object.keys(e),...Object.keys(t||{})]))},getOwnPropertyDescriptor(){return{configurable:!0,enumerable:!0}}})}function zt(e){if(!W)throw new Error("useStyle must be called during component render");de(W);try{const n=e();Object.defineProperty(W,"_computedStyle",{value:n,writable:!0,enumerable:!1,configurable:!0})}catch(n){$.devWarn("Error in useStyle callback:",n),Object.defineProperty(W,"_computedStyle",{value:"",writable:!0,enumerable:!1,configurable:!0})}}const ue=new Map,je=Symbol.for("cer.registry");function Kt(){if(!(typeof window>"u"&&typeof document>"u"&&typeof navigator>"u"))try{const n=globalThis;if(!n[je]){const t=Math.random().toString(36).substr(2,9);n[je]=new Map([...ue.entries()]),n[je].__realmId=t}}catch(n){$.devWarn("Could not initialize global registry:",n)}}function Vt(e,n){if(!n.render)throw new Error("Component must have a render function");return typeof window>"u"?class{constructor(){}}:class extends HTMLElement{context;_refs={};_listeners=[];_watchers=new Map;_renderTimeoutId=null;_mounted=!1;_hasError=!1;_initializing=!0;_componentId;_styleSheet=null;_lastHtmlStringForJitCSS="";get lastHtmlStringForJitCSS(){return this._lastHtmlStringForJitCSS}get isLoading(){return this._templateLoading}get lastError(){return this._templateError}_cfg;_lastRenderTime=0;_renderCount=0;_templateLoading=!1;_templateError=null;constructor(){super(),this.attachShadow({mode:"open"}),this._cfg=ue.get(e)||n,this._componentId=`${e}-${Math.random().toString(36).substr(2,9)}`;const t=this._initContext(n),r=(o,i,a)=>{Object.defineProperty(o,i,{value:a,writable:!1,enumerable:!1,configurable:!1})};r(t,"refs",this._refs),r(t,"requestRender",()=>this.requestRender()),r(t,"_requestRender",()=>this._requestRender()),r(t,"_componentId",this._componentId),r(t,"_triggerWatchers",(o,i)=>this._triggerWatchers(o,i)),this.context=t,l.safe(()=>{r(t,"_host",this)}),r(this.context,"emit",(o,i,a)=>{const u={detail:i,bubbles:!0,composed:!0,...a||{}},d=new CustomEvent(o,u);this.dispatchEvent(d);const v=o.indexOf(":");if(v>0){const b=o.substring(0,v),y=o.substring(v+1),w=y.includes("-")?`${b}:${y.split("-").map((T,L)=>L===0?T:T.charAt(0).toUpperCase()+T.slice(1)).join("")}`:`${b}:${y.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`;w!==o&&l.safe(()=>{this.dispatchEvent(new CustomEvent(w,u))})}return!d.defaultPrevented});const s=ue.get(e)||n;for(const o in s){const i=s[o];typeof i=="function"&&(this.context[o]=(...a)=>i(...a,this.context))}if(s.props)for(const o in s.props){let i=this[o];Object.defineProperty(this,o,{get(){return i},set(a){const u=i;i=a,this.context[o]=a,this._initializing||(this._applyProps(s),u!==a&&this._requestRender())},enumerable:!0,configurable:!0})}this._initializing=!1,this._initWatchers(s),this._applyProps(s),this._render(s)}connectedCallback(){this._runLogicWithinErrorBoundary(n,()=>{const t=this.getRootNode();t&&t!==document&&"host"in t&&kt(t,this),this._applyProps(n),this._requestRender(),at(n,this.context,this._mounted,r=>{this._mounted=r})})}disconnectedCallback(){this._runLogicWithinErrorBoundary(n,()=>{const t=this.getRootNode();t&&t!==document&&"host"in t&&wt(t,this),ct(n,this.context,this._listeners,()=>{this._listeners=[]},()=>{this._watchers.clear()},r=>{this._templateLoading=r},r=>{this._templateError=r},r=>{this._mounted=r})})}attributeChangedCallback(t,r,s){this._runLogicWithinErrorBoundary(n,()=>{this._applyProps(n),r!==s&&this._requestRender(),lt(n,t,r,s,this.context)})}static get observedAttributes(){return n.props?Object.keys(n.props).map(l.toKebab):[]}_render(t){this._runLogicWithinErrorBoundary(t,()=>{Tt(this.shadowRoot,t,this.context,this._refs,r=>{this._lastHtmlStringForJitCSS=r,typeof this.onHtmlStringUpdate=="function"&&this?.onHtmlStringUpdate?.(r)},r=>{this._templateLoading=r,this?.onLoadingStateChange?.(r)},r=>{this._templateError=r,this?.onErrorStateChange?.(r)},r=>this._applyStyle(t,r))})}requestRender(){this._requestRender()}_requestRender(){this._runLogicWithinErrorBoundary(this._cfg,()=>{l.scheduleDOMUpdate(()=>{Lt(()=>this._render(this._cfg),this._lastRenderTime,this._renderCount,t=>{this._lastRenderTime=t},t=>{this._renderCount=t},this._renderTimeoutId,t=>{this._renderTimeoutId=t})},this._componentId)})}_applyStyle(t,r){this._runLogicWithinErrorBoundary(t,()=>{$t(this.shadowRoot,this.context,r,this._styleSheet,s=>{this._styleSheet=s})})}_runLogicWithinErrorBoundary(t,r){this._hasError&&(this._hasError=!1);try{r()}catch(s){this._hasError=!0;try{const o=this.tagName?.toLowerCase?.()||"<unknown>",i=this._componentId||"<unknown-id>",a={};if(t&&t.props)for(const u of Object.keys(t.props))try{const d=this.context[u];d instanceof Node?a[u]=`[DOM Node: ${d.nodeName}]`:typeof d=="object"&&d!==null?a[u]=Object.keys(d).length>5?`[object(${Object.keys(d).length} keys)]`:d:a[u]=d}catch{a[u]="[unreadable]"}$.devError(`Error rendering component <${o}> (id=${i}):`,s),$.devError("Component props snapshot:",a),$.devWarn("Common causes: accessing properties of null/undefined inside template interpolations; expensive or throwing expressions inside templates that evaluate eagerly. Fixes: use optional chaining (obj?.prop), guard with ternary, or use the runtime lazy overload: when(cond, () => html`...`).")}catch{}t.onError&&t.onError(s,this.context)}}_initContext(t){try{let r=function(o,i=""){if(Array.isArray(o))return new Proxy(o,{get(a,u,d){const v=Reflect.get(a,u,d);return typeof v=="function"&&typeof u=="string"&&["push","pop","shift","unshift","splice","sort","reverse"].includes(u)?function(...y){const w=v.apply(a,y);if(!s._initializing){const T=i||"root";s._triggerWatchers(T,a),l.scheduleDOMUpdate(()=>s._render(t),s._componentId)}return w}:v},set(a,u,d){if(a[String(u)]=d,!s._initializing){const v=i?`${i}.${String(u)}`:String(u);s._triggerWatchers(v,d),l.scheduleDOMUpdate(()=>s._render(t),s._componentId)}return!0},deleteProperty(a,u){if(delete a[String(u)],!s._initializing){const d=i?`${i}.${String(u)}`:String(u);s._triggerWatchers(d,void 0),l.scheduleDOMUpdate(()=>s._render(t),s._componentId)}return!0}});if(o&&typeof o=="object"){if(l.isReactiveState(o))return o;for(const a in o){const u=i?`${i}.${a}`:a;o[a]=r(o[a],u)}return new Proxy(o,{set(a,u,d){const v=i?`${i}.${String(u)}`:String(u);return a[String(u)]=r(d,v),s._initializing||(s._triggerWatchers(v,a[String(u)]),l.scheduleDOMUpdate(()=>s._render(t),s._componentId)),!0},get(a,u,d){return Reflect.get(a,u,d)}})}return o};const s=this;return r({...t.props?Object.fromEntries(Object.entries(t.props).map(([o,i])=>[o,i.default])):{}})}catch{return{}}}_initWatchers(t){this._runLogicWithinErrorBoundary(t,()=>{rt(this.context,this._watchers,{})})}_triggerWatchers(t,r){st(this.context,this._watchers,t,r)}_applyProps(t){this._runLogicWithinErrorBoundary(t,()=>{try{ot(this,t,this.context)}catch(r){this._hasError=!0,t.onError&&t.onError(r,this.context)}})}}}function Ut(e,n){Kt();let t=l.toKebab(e);t.includes("-")||(t=`cer-${t}`);const r={},s={props:{},onConnected:o=>{if(r.onConnected)try{r.onConnected(o)}catch{}},onDisconnected:o=>{if(r.onDisconnected)try{r.onDisconnected(o)}catch{}},onAttributeChanged:(o,i,a,u)=>{if(r.onAttributeChanged)try{r.onAttributeChanged(o,i,a,u)}catch{}},onError:(o,i)=>{if(r.onError&&o)try{r.onError(o,i)}catch{}},render:o=>{const i=o,a=i._componentId||`${t}-${Math.random().toString(36).substr(2,9)}`;l.reactiveSystem.setCurrentComponent(a,()=>{o.requestRender&&o.requestRender()});try{qe(o);let u;try{u=n()}catch(d){try{const v=i._hookCallbacks;if(v&&typeof v.onError=="function")try{v.onError(d)}catch{}}catch{}throw d}if(i._hookCallbacks){const d=i._hookCallbacks;if(d.onConnected&&(r.onConnected=d.onConnected),d.onDisconnected&&(r.onDisconnected=d.onDisconnected),d.onAttributeChanged&&(r.onAttributeChanged=d.onAttributeChanged),d.onError&&(r.onError=d.onError),d.props){const v=d.props;s.props=Object.fromEntries(Object.entries(v).map(([b,y])=>[b,{type:typeof y=="boolean"?Boolean:typeof y=="number"?Number:typeof y=="string"?String:Function,default:y}])),ue.set(t,s)}}return u}finally{Re(),l.reactiveSystem.clearCurrentComponent()}}};if(ue.set(t,s),typeof window<"u"){try{const o={_hookCallbacks:{},requestRender:()=>{},emit:()=>!0};qe(o);try{n()}catch(i){try{const a=o?._hookCallbacks;if(a&&typeof a.onError=="function")try{a.onError(i)}catch{}$.devError(`Error during component discovery render <${t}>:`,i),$.devWarn("Error occurred during initial component discovery render. Consider guarding expensive expressions or using lazy factories for directives like when().")}catch{}throw Re(),i}if(Re(),o._hookCallbacks?.props){const i=o._hookCallbacks.props;s.props=Object.fromEntries(Object.entries(i).map(([a,u])=>[a,{type:typeof u=="boolean"?Boolean:typeof u=="number"?Number:typeof u=="string"?String:Function,default:u}])),ue.set(t,s)}}catch{}customElements.get(t)||customElements.define(t,Vt(t,s))}}class Ft{map=new Map;maxSize;accessOrder=new Map;accessCounter=0;constructor(n){this.maxSize=Math.max(1,n)}get(n){const t=this.map.get(n);if(t!==void 0)return this.accessOrder.set(n,++this.accessCounter),t}set(n,t){const r=this.map.has(n);this.map.set(n,t),this.accessOrder.set(n,++this.accessCounter),!r&&this.map.size>this.maxSize&&this.evictLRU()}evictLRU(){let n,t=1/0;for(const[r,s]of this.accessOrder)s<t&&(t=s,n=r);n!==void 0&&(this.map.delete(n),this.accessOrder.delete(n))}has(n){return this.map.has(n)}clear(){this.map.clear(),this.accessOrder.clear(),this.accessCounter=0}get size(){return this.map.size}}const qt=()=>{if(typeof navigator<"u"&&"deviceMemory"in navigator){const n=navigator.deviceMemory;if(n)return Math.min(1e3,Math.max(200,n*100))}return(()=>{try{return globalThis.process?.env?.NODE_ENV==="test"}catch{return!1}})()?100:500},Pe=new Ft(qt());function Gt(e,n){if(e==null){$.devWarn(`⚠️ Event handler for '@${n}' is ${e}. This will prevent the event from working. Use a function reference instead: @${n}="\${functionName}"`);return}typeof e!="function"&&$.devWarn(`🚨 Potential infinite loop detected! Event handler for '@${n}' appears to be the result of a function call (${typeof e}) instead of a function reference. Change @${n}="\${functionName()}" to @${n}="\${functionName}" to pass the function reference instead of calling it immediately.`),e===void 0&&typeof e!="function"&&$.devWarn(`💡 Tip: If your event handler function returns undefined, make sure you're passing the function reference, not calling it. Use @${n}="\${fn}" not @${n}="\${fn()}"`)}function ee(e,n={},t,r){const s=r??n.key;return{tag:e,key:s,props:n,children:t}}function Ee(e){return!!e&&typeof e=="object"&&(e.type==="AnchorBlock"||e.tag==="#anchor")}function se(e){return typeof e=="object"&&e!==null&&"tag"in e&&!Ee(e)}function Zt(e,n){return e.key!=null?e:{...e,key:n}}function Jt(e,n=[],t={}){const r={},s={},o={},i=[],a=/([:@#]?)([a-zA-Z0-9-:.]+)(?:\s*=\s*("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'|([^\s>]+)))?/g;let u;for(;u=a.exec(e);){const d=u[1],v=u[2];let b="";for(let c=3;c<u.length;c++)if(u[c]!==void 0){b=u[c];break}b.length>=2&&(b[0]==='"'&&b[b.length-1]==='"'||b[0]==="'"&&b[b.length-1]==="'")&&(b=b.slice(1,-1));const y=!/=/.test(u[0]),w=b.match(/^{{(\d+)}}$/);let T=y?!0:w?n[Number(w[1])]??null:b;w||(T==="true"?T=!0:T==="false"?T=!1:T==="null"?T=null:isNaN(Number(T))||(T=Number(T)));const L=["model","bind","show","class","style","ref","when"];if(d===":"){const[c,C]=v.split(":"),[S,...g]=c.split(".");if(L.includes(S)){const p=[...g],A=S==="model"&&C?`model:${C}`:S;o[A]={value:T,modifiers:p,arg:C}}else if(v==="disabled"){let p=T;p&&l.isReactiveState(p)&&(p=p.value);const A=typeof p;if(p===""||A==="boolean"||A==="string"&&(p==="true"||p==="false")||p==null||A==="number")r[v]=p;else{let h=T;h&&l.isReactiveState(h)&&(h=h.value),s[v]=h}i.push(v)}else{let p=T;p&&l.isReactiveState(p)&&(p=p.value),s[v]=p,i.push(v)}}else if(d==="@"){const[c,...C]=v.split("."),S=C;Gt(T,c);const g=typeof T=="function"?T:typeof t[T]=="function"?t[T]:void 0;if(g){const p=E=>{if(S.includes("prevent")&&E.preventDefault(),S.includes("stop")&&E.stopPropagation(),!(S.includes("self")&&E.target!==E.currentTarget))return S.includes("once")&&E.currentTarget?.removeEventListener(c,p),g(E)},A="on"+c.charAt(0).toUpperCase()+c.slice(1);r[A]=p}}else v==="ref"?r.ref=T:s[v]=T}return{props:r,attrs:s,directives:o,bound:i}}function Ie(e){if(!se(e)||Ee(e))return e;const n=e.props?.directives;if(n&&n.when){const t=n.when.value,r=l.isReactiveState(t)?t.value:t,s={...n};delete s.when;const o={...e.props};Object.keys(s).length>0?o.directives=s:delete o.directives;const i={...e,props:o};return Array.isArray(i.children)&&(i.children=i.children.map(u=>typeof u=="object"&&u!==null?Ie(u):u)),{tag:"#anchor",key:e.key!=null?`when-${e.key}`:`when-${e.tag}`,children:r?[i]:[]}}if(Array.isArray(e.children)){const t=e.children.map(r=>typeof r=="object"&&r!==null?Ie(r):r);return{...e,children:t}}return e}function Yt(e,n,t){const r=Se.length>0?Se[Se.length-1]:void 0,s=t??r,o=!t&&n.length===0,i=o?e.join("<!--TEMPLATE_DELIM-->"):null;if(o&&i){const f=Pe.get(i);if(f)return f}function a(f,m){return ee("#text",{},f,m)}function u(f,m,k=!1){let O=typeof f=="string"?l.decodeEntities(f):f;return!k&&typeof O=="string"&&/[\r\n]/.test(O)&&(O=O.replace(/\s+/g," ")),ee("#text",{},O,m)}let d="";for(let f=0;f<e.length;f++)d+=e[f],f<n.length&&(d+=`{{${f}}}`);const v=/<!--[\s\S]*?-->|<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g,b=[];let y,w=[],T=null,L={},c,C=0;const S=[],g=new Set(["pre","code","textarea","script","style"]);function p(){if(T&&g.has(T.toLowerCase()))return!0;for(const f of b)if(g.has(f.tag.toLowerCase()))return!0;return!1}function A(f){if(!f||typeof f!="object"||Ee(f))return;const m=f,k=L;if(m.props||m.attrs){const O=m;O.props&&(k.props||(k.props={}),Object.assign(k.props,O.props)),O.attrs&&(k.attrs||(k.attrs={}),Object.keys(O.attrs).forEach(M=>{if(M==="style"&&k.attrs.style){const j=String(k.attrs.style).replace(/;?\s*$/,""),I=String(O.attrs.style).replace(/^;?\s*/,"");k.attrs.style=j+"; "+I}else if(M==="class"&&k.attrs.class){const j=String(k.attrs.class).trim().split(/\s+/).filter(Boolean),I=String(O.attrs.class).trim().split(/\s+/).filter(Boolean),R=[...new Set([...j,...I])];k.attrs.class=R.join(" ")}else k.attrs[M]=O.attrs[M]}))}else k.props||(k.props={}),Object.assign(k.props,m)}function E(f,m){const k=T?w:S;if(Ee(f)){const O=f.key??m,M=f.children;k.push({...f,key:O,children:M});return}if(se(f)){k.push(Zt(f,void 0));return}if(Array.isArray(f)){if(f.length===0)return;for(let O=0;O<f.length;O++){const M=f[O];Ee(M)||se(M)||Array.isArray(M)?E(M,`${m}-${O}`):M!==null&&typeof M=="object"?l.isUnsafeHTML(M)?k.push(ee("#raw",{},M.__rawHTML,`${m}-${O}`)):A(M):k.push(a(String(M),`${m}-${O}`))}return}if(f!==null&&typeof f=="object"){if(l.isUnsafeHTML(f)){const O=f.__rawHTML??"";k.push(ee("#raw",{},O,m));return}A(f);return}k.push(a(String(f),m))}const N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);for(;y=v.exec(d);)if(!(y[0].startsWith("<!--")&&y[0].endsWith("-->"))){if(y[1]){const f=y[1],m=y[0][1]==="/",k=y[0][y[0].length-2]==="/"||N.has(f),{props:O,attrs:M,directives:j,bound:I}=Jt(y[2]||"",n,s??{}),R={props:{},attrs:{}};for(const B in O)R.props[B]=O[B];for(const B in M)R.attrs[B]=M[B];R.attrs&&Object.prototype.hasOwnProperty.call(R.attrs,"key")&&!(R.props&&Object.prototype.hasOwnProperty.call(R.props,"key"))&&l.safe(()=>{R.props.key=R.attrs.key});try{const B={input:["value","checked","readonly","required","placeholder","maxlength","minlength"],textarea:["value","readonly","required","placeholder","maxlength","minlength"],select:["value","required","multiple"],option:["selected","value"],video:["muted","autoplay","controls","loop","playsinline"],audio:["muted","autoplay","controls","loop"],img:["src","alt","width","height"],button:["type","name","value","autofocus","form"]},x=f.toLowerCase(),Q=B[x]??[];if(R.attrs){for(const H of Q)if(I&&I.includes(H)&&H in R.attrs&&!(R.props&&H in R.props)){let P=R.attrs[H];if(P&&l.isReactiveState(P))P=P.value,R.props[H]=P,delete R.attrs[H];else if(P&&typeof P=="object"&&"value"in P&&!(P instanceof Node))try{const D=P.value;R.props[H]=(x==="select"||x==="option")&&H==="value"?String(D):D,delete R.attrs[H]}catch{}else{const D=typeof P;if(H==="disabled")(P===""||D==="boolean"||D==="string"&&(P==="true"||P==="false")||P==null||D==="number")&&(R.props[H]=P,delete R.attrs[H]);else if(P===""||D==="string"||D==="number"||D==="boolean"||P==null){const G=(x==="select"||x==="option")&&H==="value"?String(P):P;R.props[H]=G,delete R.attrs[H]}}}}if(f.includes("-")||!!s?.__customElements?.has?.(f)){if(R.isCustomElement=!0,I&&R.attrs){const H=new Set(["id","name","data-key","key"]);for(const P of I)if(P in R.attrs&&!(R.props&&P in R.props)){const D=P.includes("-")?l.toCamel(P):P,G=R.attrs[P];if(R.props[D]=G,H.has(P)||l.isClassLikeAttr(P))try{const _e=l.safeSerializeAttr(R.attrs[P]);_e===null?delete R.attrs[P]:R.attrs[P]=_e}catch{delete R.attrs[P]}else delete R.attrs[P]}}try{if(R.attrs&&!(R.props&&"modelValue"in R.props)){const H=R.attrs["model-value"]??R.attrs.modelValue;typeof H<"u"&&(R.props.modelValue=H)}}catch{}}}catch{}if(j&&Object.keys(j).some(B=>B==="model"||B.startsWith("model:")))try{const B=Symbol.for("cer.registry"),x=globalThis[B],Q=!!(x&&typeof x.has=="function"&&x.has(f)),F=s,H=!!(F&&(F.__customElements instanceof Set&&F.__customElements.has(f)||Array.isArray(F.__isCustomElements)&&F.__isCustomElements.includes(f)));if(!!(f.includes("-")||H||Q))for(const G of Object.keys(j)){if(G!=="model"&&!G.startsWith("model:"))continue;const Ae=j[G],_e=Ae.arg??(G.includes(":")?G.split(":",2)[1]:void 0),K=Ae.value,Le=_e??"modelValue",We=l.getNestedValue,et=l.setNestedValue,pe=s?._state||s;let Y;typeof K=="string"&&pe?Y=We(pe,K):Y=K,R.props[Le]=Y;try{const te=l.toKebab(Le);R.attrs||(R.attrs={}),Y!=null&&(typeof Y=="string"||typeof Y=="number"||typeof Y=="boolean")&&(R.attrs[te]=Y)}catch{}R.isCustomElement=!0;const De=`update:${l.toKebab(Le)}`.replace(/-([a-z])/g,(te,J)=>J.toUpperCase()),tt="on"+De.charAt(0).toUpperCase()+De.slice(1);R.props[tt]=function(te){const J=te.detail!==void 0?te.detail:te.target?te.target.value:void 0;if(pe)if(K&&l.isReactiveState(K)){const ne=K.value;if(Array.isArray(J)&&Array.isArray(ne)?JSON.stringify([...J].sort())!==JSON.stringify([...ne].sort()):J!==ne){K.value=J;try{const re=s;if(re){const he=re.requestRender,ye=re._requestRender;typeof he=="function"?he():typeof ye=="function"&&ye()}}catch{}}}else{const ne=We(pe||{},typeof K=="string"?K:String(K));if(Array.isArray(J)&&Array.isArray(ne)?JSON.stringify([...J].sort())!==JSON.stringify([...ne].sort()):J!==ne){et(pe||{},typeof K=="string"?K:String(K),J);try{const re=s;if(re){const he=re.requestRender,ye=re._requestRender;typeof he=="function"?he():typeof ye=="function"&&ye()}}catch{}}}},delete j[G]}}catch{}if(Object.keys(j).length>0&&(R.directives={...j}),m){const B=w.some(H=>typeof H=="object"&&H.tag!=="#text");let x=w;if(B&&w.length>0){let H=0;for(;H<w.length;){const D=w[H];if(!se(D)||D.tag!=="#text"||typeof D.children!="string"||D.children.trim()!=="")break;H++}let P=w.length-1;for(;P>=0;){const D=w[P];if(!se(D)||D.tag!=="#text"||typeof D.children!="string"||D.children.trim()!=="")break;P--}H===0&&P===w.length-1?x=w:H>P?x=[]:x=w.slice(H,P+1)}const Q=ee(T,L,x.length===1&&se(x[0])&&x[0].tag==="#text"?typeof x[0].children=="string"?x[0].children:"":x.length?x:void 0,c),F=b.pop();F?(T=F.tag,L=F.props,c=F.key,w=F.children,w.push(Q)):(S.push(Q),T=null,L={},c=void 0,w=[])}else k?T?w.push(ee(f,R,void 0,void 0)):S.push(ee(f,R,void 0,void 0)):(T&&b.push({tag:T,props:L,children:w,key:c}),T=f,L=R,w=[])}else if(typeof y[3]<"u"){const f=Number(y[3]),m=n[f],k=`interp-${f}`;E(m,k)}else if(y[4]){const f=y[4],m=T?w:S,k=f.split(/({{\d+}})/);for(const O of k){if(!O)continue;const M=O.match(/^{{(\d+)}}$/);if(M){const j=Number(M[1]),I=n[j],R=`interp-${j}`;E(I,R)}else{const j=`text-${C++}`,I=p();m.push(u(O,j,I))}}}}const _=S.filter(f=>se(f)&&f.tag==="#text"?typeof f.children=="string"&&f.children.trim()!=="":!0).map(f=>Ie(f));if(_.length===1){const f=_[0];return o&&i&&Pe.set(i,f),f}else if(_.length>1){const f=_;return o&&i&&Pe.set(i,f),f}return ee("div",{},"","fallback-root")}function Xt(e,...n){const t=n[n.length-1],r=typeof t=="object"&&t&&!Array.isArray(t)?t:void 0;return Yt(e,n,r)}exports.component=Ut;exports.html=Xt;exports.useEmit=Ht;exports.useOnAttributeChanged=Wt;exports.useOnConnected=xt;exports.useOnDisconnected=It;exports.useOnError=Dt;exports.useProps=Bt;exports.useStyle=zt;
17
- //# sourceMappingURL=template-compiler-CXHEnaBh.cjs.map