(function () { 'use strict'; const DEFAULT_TOKENS = { palette: 'obsidian', theme: 'dark', lightPreset: 'crystal', radiusBase: 6, specularAlpha: 0.095, borderAlpha: 0.115, glassBlur: 16, proseLineHeight: 1.7, editorialSerif: true, grainAlpha: 0.022, prismStrength: 1, }; const MODELS = [ { id: 'orchestrator', group: 'Antigravity 编排中枢 · 双阶段托管', name: 'Orchestrator', camp: 'gemini', isOrchestrator: true, sampledId: 'Carbon (Plan) ⇄ Exec', fallbackId: 'gemini-4-flash-001', desc: '规划核深思 ⇄ 执行核快跑 · 自动托管', efforts: [], }, { id: 'claude-4.6-sonnet', group: 'Claude 4.6 系列 · 原生三档', name: 'Claude 4.6 Sonnet', camp: 'claude', sampledId: 'claude-sonnet-4-6-20260929', fallbackId: 'claude-haiku-4-5-20260601', desc: '日常编码与架构对齐主力 · Low / Med / High', efforts: ['low', 'medium', 'high'], }, { id: 'claude-4.6-opus', group: 'Claude 4.6 系列 · 原生三档', name: 'Claude 4.6 Opus', camp: 'claude', sampledId: 'claude-opus-4-6-20260929', fallbackId: 'claude-sonnet-4-5-20260715', desc: '深水区重构 · High 满格激活扫掠点阵', efforts: ['low', 'medium', 'high'], }, { id: 'gemini-4-carbon', group: 'Gemini 4 系列 · 原生三档', name: 'Gemini 4 Carbon', camp: 'gemini', sampledId: 'gemini-4-carbon-001', fallbackId: 'gemini-4-flash-001', desc: '常规旗舰 · 支持 Low / Medium / High', efforts: ['low', 'medium', 'high'], }, { id: 'gemini-4-hydrogen', group: 'Gemini 4 系列 · Hydrogen 极深度', name: 'Gemini 4 Hydrogen', camp: 'gemini', sampledId: 'gemini-4-hydrogen-001', fallbackId: 'gemini-4-carbon-001', desc: '极深度推理 · 支持 Low..Extra (xhigh)', efforts: ['low', 'medium', 'high', 'xhigh'], }, { id: 'gpt-oss-120b', group: 'Fixed Depth · 单档锁定对照', name: 'GPT-OSS 120B (Medium)', camp: 'gemini', sampledId: 'gpt-oss-120b-medium', fallbackId: 'gemini-4-flash-lite', desc: '固定深度 · 触发 .is-locked 置灰锁定态', efforts: ['medium'], }, ]; const ALL_EFFORTS = [ { id: 'low', label: 'Low', short: 'LOW', title: '轻量快速推演', bars: 1 }, { id: 'medium', label: 'Medium', short: 'MED', title: '均衡常规推理', bars: 2 }, { id: 'high', label: 'High', short: 'HIGH', title: '深度架构推演', bars: 3, top: true }, { id: 'xhigh', label: 'Extra', short: 'EXTRA', title: '高功耗强化推理', bars: 4, spectrum: true }, ]; const SESSIONS = [ { id: 'studio-home', group: '置顶', title: 'Studio 首页与全屏波纹光晕', time: '实时', scene: 'studio' }, { id: 'm3-surface-lab', group: '今天', title: 'M3 四大死角实景舱 (True CSS)', time: '实景', scene: 'm3lab' }, { id: 'v2-refactor', group: '今天', title: 'Obsidian Prism 视觉重构', time: '刚刚', scene: 'chat' }, { id: 'effort-merge', group: '今天', title: '原版 1:1 推理等级滑块', time: '运行中', scene: 'effort', running: true }, { id: 'dash-fastpath', group: '过去 7 天', title: '实体光学水试管与模型验真', time: '昨天', scene: 'dashboard' }, { id: 'theme-tokens', group: '过去 7 天', title: '外观设置与小蟹堆开关', time: '3d', scene: 'settings' }, ]; const TIME_RANGE_STATS = { '7d': { books: '3.1 本书', sub: '累计 782K Tokens · 312 条消息 · 主力模型 Gemini 4 Carbon', scale: 0.78, }, '30d': { books: '14.2 本书', sub: '累计 3.56M Tokens · 1,284 条消息 · 主力模型 Gemini 4 Carbon', scale: 1, }, all: { books: '84.6 本书', sub: '累计 21.6M Tokens · 10,254 条消息 · 主力模型 Gemini 4 Carbon', scale: 1.18, }, }; const STREAM_FULL_PARAGRAPHS = [ { type: 'h3', text: '1. 唯一输入框棱镜与零色偏黑灰钛', }, { type: 'p', html: '将 Obsidian Neutral 的冷峻黑灰钛底盘全面降噪,仅在底部唯一主焦点 [data-testid="agent-input-box"] 保留四色光学棱镜追光边,其余浮窗与卡片回到干净的 1px 顶边内高光。', }, { type: 'h3', text: '2. 512K 无凹坑悬浮水试管与深海连续电离光谱', }, { type: 'p', html: '右侧浮窗顶部接入 Sampled Model 真实响应验真栏,左侧无框悬浮 WebGL2 硼硅水试管升级为 512K 容量基准(128k / 256k / 384k 激光微刻线)与深海连续电离冷光谱。', }, ]; const state = { tokens: { ...DEFAULT_TOKENS }, viewMode: 'single', // 'single' | 'split' | 'matrix' scene: 'studio', // 'studio' | 'chat' | 'effort' | 'dashboard' | 'settings' inspectorOpen: true, timeRange: '30d', // '7d' | '30d' | 'all' activeModelId: 'gemini-4-carbon', effortByModel: { 'claude-4.6-sonnet': 'medium', 'claude-4.6-opus': 'high', 'gemini-4-carbon': 'high', 'gemini-4-hydrogen': 'xhigh', 'gpt-oss-120b': 'medium', }, openPopover: null, // null | 'effort' | 'dashboard' overlayDemo: null, // null | 'takeover' | 'slash' mascotYieldMode: 'none', // 'none' | 'leap' | 'peek' mascotMiniPile: false, userBubbleExpanded: false, thinkingOpen: false, streamPhase: 'done', // 'done' | 'streaming' streamWordProgress: 999, convAuraPhase: 'idle', // 'idle' | 'start' | 'running' | 'complete' convAuraPhaseAt: 0, liftoffEbbAt: 0, motionLevel: 'ultra', // 'off' | 'subtle' | 'standard' | 'ultra' hasToolError: false, cacheCleanStep: 'idle', // 'idle' | 'confirm' | 'done' cacheTimerId: 0, contextVialEnabled: true, vialStreaming: false, vialCritical: false, telemetryModule: 'auto', effortSliderModule: 'auto', hoveredSlice: -1, // -1 | 0 | 1 | 2 sampleSimMode: 'ok', // 'ok' | 'fallback' | 'unreliable' rippleEnabled: true, sidebarCollapsed: false, sidebarSearchOpen: false, sidebarSearchQuery: '', sidebarCollapsedGroups: {}, workspaceName: 'obsidian-prism', m3ActiveSlashIdx: 1, m3DiffStatus: 'pending', // 'pending' | 'accepted' | 'rejected' m3SwitchOn: true, m3ToastType: 'info', // 'info' | 'success' | 'warning' | 'error' }; let rippleControllers = []; let convAuraControllers = []; let vialControllers = []; let crystalControllers = []; let sliderControllers = []; let mascotControllers = []; let masterRafId = 0; let masterSleeping = false; let masterFrameTicks = 0; let lastFrameMs = 0; let streamTimerId = 0; let windowBlurredLong = false; let blurTimeoutId = 0; let lastPointerPos = { x: -9999, y: -9999 }; let prismDirty = false; let prismRafId = 0; function escapeHtml(text) { return String(text || '') .replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"'); } // 微标签中英混排:西文保持等宽大写字距,中文段落切回无衬线且零字距,避免中文被拉散下沉 function fmtMicroLabel(text) { return escapeHtml(text).replace(/([\u3000-\u303f\u3400-\u9fff\uff00-\uffef]+)/g, '$1'); } // 是否需要减弱动态(含 motionLevel === 'off') function prefersReducedMotion() { if (state.motionLevel === 'off') return true; return Boolean(window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches); } // 视图级切换:支持时用 View Transitions 做 200ms 交叉淡化,否则直接执行 function withViewTransition(fn) { if ( typeof document.startViewTransition === 'function' && !prefersReducedMotion() && state.motionLevel !== 'subtle' && !document.hidden ) { try { document.startViewTransition(() => fn()); return; } catch {} } fn(); } function getGreetingLabel() { const h = new Date().getHours(); if (h < 6) return '夜深了,准备构建什么?'; if (h < 12) return '早安,准备构建什么?'; if (h < 18) return '下午好,准备构建什么?'; return '晚上好,准备构建什么?'; } function getActiveModel() { return MODELS.find((m) => m.id === state.activeModelId) || MODELS[3] || MODELS[0]; } function getActiveEffortMeta() { const model = getActiveModel(); if (model.isOrchestrator) { return { id: 'auto', label: 'Auto', short: 'AUTO', title: '双阶段智能托管', bars: 4, orchestrator: true }; } const curId = state.effortByModel[model.id] || model.efforts[0]; return ALL_EFFORTS.find((e) => e.id === curId) || ALL_EFFORTS[1]; } /* ── Official Brand Vector Marks, Google Spark Orbit & Animated Icons Bridge ── */ const BRAND_PATHS = { gemini: 'M24 12.024c-6.437.388-11.59 5.539-11.977 11.976h-.047C11.588 17.563 6.436 12.412 0 12.024v-.047C6.437 11.588 11.588 6.437 11.976 0h.047c.388 6.437 5.54 11.588 11.977 11.977z', claude: 'm4.714 15.956l4.718-2.648l.079-.23l-.08-.128h-.23l-.79-.048l-2.695-.073l-2.337-.097l-2.265-.122l-.57-.121l-.535-.704l.055-.353l.48-.321l.685.06l1.518.104l2.277.157l1.651.098l2.447.255h.389l.054-.158l-.133-.097l-.103-.098l-2.356-1.596l-2.55-1.688l-1.336-.972l-.722-.491L2 6.223l-.158-1.008l.656-.722l.88.06l.224.061l.893.686l1.906 1.476l2.49 1.833l.364.304l.146-.104l.018-.072l-.164-.274l-1.354-2.446l-1.445-2.49l-.644-1.032l-.17-.619a3 3 0 0 1-.103-.729L6.287.133L6.7 0l.995.134l.42.364l.619 1.415L9.735 4.14l1.555 3.03l.455.898l.243.832l.09.255h.159V9.01l.127-1.706l.237-2.095l.23-2.695l.08-.76l.376-.91l.747-.492l.583.28l.48.685l-.067.444l-.286 1.851l-.558 2.903l-.365 1.942h.213l.243-.242l.983-1.306l1.652-2.064l.728-.82l.85-.904l.547-.431h1.032l.759 1.129l-.34 1.166l-1.063 1.347l-.88 1.142l-1.263 1.7l-.79 1.36l.074.11l.188-.02l2.853-.606l1.542-.28l1.84-.315l.832.388l.09.395l-.327.807l-1.967.486l-2.307.462l-3.436.813l-.043.03l.049.061l1.548.146l.662.036h1.62l3.018.225l.79.522l.473.638l-.08.485l-1.213.62l-1.64-.389l-3.825-.91l-1.31-.329h-.183v.11l1.093 1.068l2.003 1.81l2.508 2.33l.127.578l-.321.455l-.34-.049l-2.204-1.657l-.85-.747l-1.925-1.62h-.127v.17l.443.649l2.343 3.521l.122 1.08l-.17.353l-.607.213l-.668-.122l-1.372-1.924l-1.415-2.168l-1.141-1.943l-.14.08l-.674 7.254l-.316.37l-.728.28l-.607-.461l-.322-.747l.322-1.476l.388-1.924l.316-1.53l.285-1.9l.17-.632l-.012-.042l-.14.018l-1.432 1.967l-2.18 2.945l-1.724 1.845l-.413.164l-.716-.37l.066-.662l.401-.589l2.386-3.036l1.439-1.882l.929-1.086l-.006-.158h-.055L4.138 18.56l-1.13.146l-.485-.456l.06-.746l.231-.243l1.907-1.312Z', openai: 'M20.562 10.188c.25-.688.313-1.376.25-2.063c-.062-.687-.312-1.375-.625-2c-.562-.937-1.375-1.687-2.312-2.125c-1-.437-2.063-.562-3.125-.312c-.5-.5-1.063-.938-1.688-1.25S11.687 2 11 2a5.17 5.17 0 0 0-3 .938c-.875.624-1.5 1.5-1.813 2.5c-.75.187-1.375.5-2 .875c-.562.437-1 1-1.375 1.562c-.562.938-.75 2-.625 3.063a5.44 5.44 0 0 0 1.25 2.874a4.7 4.7 0 0 0-.25 2.063c.063.688.313 1.375.625 2c.563.938 1.375 1.688 2.313 2.125c1 .438 2.062.563 3.125.313c.5.5 1.062.937 1.687 1.25S12.312 22 13 22a5.17 5.17 0 0 0 3-.937c.875-.625 1.5-1.5 1.812-2.5a4.54 4.54 0 0 0 1.938-.875c.562-.438 1.062-.938 1.375-1.563c.562-.937.75-2 .625-3.062c-.125-1.063-.5-2.063-1.188-2.876m-7.5 10.5c-1 0-1.75-.313-2.437-.875c0 0 .062-.063.125-.063l4-2.312a.5.5 0 0 0 .25-.25a.57.57 0 0 0 .062-.313V11.25l1.688 1v4.625a3.685 3.685 0 0 1-3.688 3.813M5 17.25c-.438-.75-.625-1.625-.438-2.5c0 0 .063.063.125.063l4 2.312a.56.56 0 0 0 .313.063c.125 0 .25 0 .312-.063l4.875-2.812v1.937l-4.062 2.375A3.7 3.7 0 0 1 7.312 19c-1-.25-1.812-.875-2.312-1.75M3.937 8.563a3.8 3.8 0 0 1 1.938-1.626v4.751c0 .124 0 .25.062.312a.5.5 0 0 0 .25.25l4.875 2.813l-1.687 1l-4-2.313a3.7 3.7 0 0 1-1.75-2.25c-.25-.937-.188-2.062.312-2.937M17.75 11.75l-4.875-2.812l1.687-1l4 2.312c.625.375 1.125.875 1.438 1.5s.5 1.313.437 2.063a3.7 3.7 0 0 1-.75 1.937c-.437.563-1 1-1.687 1.25v-4.75c0-.125 0-.25-.063-.312c0 0-.062-.126-.187-.188m1.687-2.5s-.062-.062-.125-.062l-4-2.313c-.125-.062-.187-.062-.312-.062s-.25 0-.313.062L9.812 9.688V7.75l4.063-2.375c.625-.375 1.312-.5 2.062-.5c.688 0 1.375.25 2 .688c.563.437 1.063 1 1.313 1.625s.312 1.375.187 2.062m-10.5 3.5l-1.687-1V7.063c0-.688.187-1.438.562-2C8.187 4.438 8.75 4 9.375 3.688a3.37 3.37 0 0 1 2.062-.313c.688.063 1.375.375 1.938.813c0 0-.063.062-.125.062l-4 2.313a.5.5 0 0 0-.25.25c-.063.125-.063.187-.063.312zm.875-2L12 9.5l2.187 1.25v2.5L12 14.5l-2.188-1.25z', }; function renderSparkOrbitMark(opts = {}) { const size = opts.size || 15; const tier = opts.tier || 'auto'; const monochrome = Boolean(opts.monochrome); const className = opts.className || ''; const icons = globalThis.__agAnimatedIcons; if (icons && typeof icons.renderGoogleSparkOrbitSvg === 'function') { const rendered = icons.renderGoogleSparkOrbitSvg({ size, tier, monochrome, className }); if (rendered) { if (className && !rendered.includes(className)) { if (/class="([^"]*)"/.test(rendered)) { return rendered.replace(/class="([^"]*)"/, `class="$1 ${className}"`); } return rendered.replace('