@runtypelabs/persona 4.32.0 → 4.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/activity-ui.cjs +1 -1
- package/dist/activity-ui.js +1 -1
- package/dist/{chunk-BrptyKSq.js → chunk-B3l7TOOv.js} +1 -1
- package/dist/{chunk-CkE90FtA.js → chunk-B4ecQzeK.js} +1 -1
- package/dist/{chunk-BWCo3rCm.js → chunk-B_H0l3u2.js} +1 -1
- package/dist/{chunk-MdlQetfC.js → chunk-BbXc58OA.js} +1 -1
- package/dist/chunk-BkOYJ11B.js +1 -0
- package/dist/{chunk-DE0cSmku.js → chunk-BpjtKnGI.js} +1 -1
- package/dist/{chunk-CzZBmTLd.js → chunk-C9uOhfk5.js} +1 -1
- package/dist/{chunk-CHAwCqpk.js → chunk-CdpVP6LZ.js} +1 -1
- package/dist/{chunk-DZg9bFK6.js → chunk-CumoXK3u.js} +1 -1
- package/dist/{chunk-FEzOcZof.js → chunk-DM-OJt5q.js} +1 -1
- package/dist/{chunk-Cb7qy0c7.js → chunk-DNdeIFJ6.js} +1 -1
- package/dist/{chunk-VaT6xry9.js → chunk-DTGvDx8o.js} +1 -1
- package/dist/{chunk-ezlpsYGk.js → chunk-DVZ8ri1z.js} +1 -1
- package/dist/{chunk-DhedQnek.js → chunk-DgZZqy14.js} +1 -1
- package/dist/{chunk-C2IbR39s.js → chunk-UWMfWW2a.js} +1 -1
- package/dist/client-dispatch.js +1 -1
- package/dist/client-history.js +1 -1
- package/dist/codegen.cjs +1 -1
- package/dist/codegen.js +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.global.js +1 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/launcher.global.js +1 -1
- package/dist/launcher.global.js.map +1 -1
- package/dist/theme-editor-preview.cjs +3 -3
- package/dist/theme-editor-preview.js +3 -3
- package/dist/theme-editor.cjs +1 -1
- package/dist/theme-editor.js +1 -1
- package/dist/theme-reference.cjs +1 -1
- package/dist/theme-reference.js +1 -1
- package/dist/voice-runtime.cjs +1 -1
- package/dist/voice-runtime.js +1 -1
- package/dist/widget.css +1 -1
- package/package.json +1 -1
- package/src/styles/widget.css +12 -0
- package/src/utils/brand.test.ts +50 -0
- package/src/utils/brand.ts +6 -2
- package/src/utils/tokens.ts +2 -1
- package/src/utils/tool-activity-summary.test.ts +8 -0
- package/src/utils/tool-activity-summary.ts +2 -1
- package/dist/chunk-DDAwu89-.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["resolveLauncherVariant","e","config","launcher","variant","future","v5Defaults","CIRCLE_LAUNCHER_TOKENS","background","foreground","border","size","iconSize","borderRadius","shadow","offset","createElement","t","element","document","tag","className","n","createNode","children","options","r","text","textContent","attrs","name","value","Object","entries","setAttribute","style","source","property","keys","appendable","filter","child","length","append","positionMap","isEmbeddedLayout","layout","embedded","enabled","sidebarMode","mountMode","isObject","Array","isArray","deepMerge","base","override","merged","key","existing","record","parseColor","color","trim","hex","exec","full","map","c","join","parseInt","slice","i","match","parts","split","test","pop","channels","part","Number","parseFloat","endsWith","NaN","a","some","isFinite","luminance","rgb","reduce","channel","sum","hexColor","Math","round","toString","padStart","mix","target","amount","inferBrandColorScheme","neutral","brand","OPT_IN_THEME_STYLE_PATHS","STYLE_PROVENANCE","Symbol","for","hasExplicitStylePath","stored","prototype","hasOwnProperty","call","values","path","valueAt","explicit","includes","index","suppliedPath","DEFAULT_FLOATING_LAUNCHER_WIDTH","DEFAULT_LAUNCHER_CONFIG","dock","side","width","title","subtitle","agentIconText","agentIconName","headerIconName","position","heightOffset","autoExpand","callToActionIconHidden","agentIconSize","headerIconSize","closeButtonPaddingX","closeButtonPaddingY","callToActionIconName","callToActionIconText","callToActionIconSize","callToActionIconPadding","callToActionIconColor","callToActionIconBackgroundColor","closeButtonBackgroundColor","clearChat","backgroundColor","borderColor","placement","iconName","showTooltip","tooltipText","paddingX","paddingY","headerIconHidden","DEFAULTS_BASE","apiUrl","clientToken","agentId","theme","darkTheme","colorScheme","tooltip","delayMs","skipDelayMs","copy","inputPlaceholder","sendButtonLabel","sendButton","borderWidth","useIcon","iconText","statusIndicator","visible","idleText","connectingText","connectedText","errorText","voiceRecognition","pauseDuration","iconColor","recordingIconColor","recordingBackgroundColor","recordingBorderColor","features","showReasoning","showToolCalls","scrollToBottom","label","streamingIndicator","scrollBehavior","scrollDurationMs","transition","mode","anchorTopOffset","showActivityWhilePinned","toolCallDisplay","collapsedMode","activePreview","grouped","groupedMode","groupBoundary","previewMaxLines","expandable","loadingAnimation","reasoningDisplay","streamAnimation","type","placeholder","speed","duration","askUserQuestion","slideInMs","freeTextLabel","freeTextPlaceholder","submitLabel","history","presentation","showScopeStatus","showDelete","showDeleteAll","suggestionChips","suggestionChipsConfig","fontFamily","fontWeight","header","showIcon","showTitle","showSubtitle","showCloseButton","showClearChat","messages","avatar","show","timestamp","groupConsecutive","slots","markdown","gfm","breaks","disableDefaultStyles","messageActions","showCopy","showUpvote","showDownvote","visibility","align","debug","DEFAULTS_V4","DEFAULT_LAUNCHER_V5","DEFAULTS_V5","errorDisplay","approval","resolvedDisplay","primaryAction","keyboardShortcuts","loadingIndicator","artifacts","iconVisibility","groupAppearance","appearance","composer","contentMaxWidth","topFade","assistant","resolveDefaultsVersion","overlay","resolveDefaults","DEFAULT_PALETTE_BASE","colors","primary","secondary","accent","gray","success","warning","error","info","purple","teal","spacing","s","k","typography","sans","serif","mono","fontSize","xs","sm","lg","xl","normal","medium","semibold","bold","lineHeight","tight","relaxed","shadows","none","md","borders","radius","DEFAULT_SEMANTIC_BASE","surface","container","textMuted","textInverse","divider","interactive","default","hover","focus","active","disabled","feedback","DEFAULT_COMPONENTS_BASE","button","padding","ghost","hoverBackground","input","ring","panel","maxWidth","height","maxHeight","inset","canvasBackground","modes","floating","inline","docked","sidebar","mobile","minimalPadding","iconBackground","iconForeground","message","gap","user","introCard","suggestion","chip","itemGap","minHeight","hoverBorder","pressedBackground","focusRing","disabledOpacity","card","list","toolBubble","reasoningBubble","scrollbar","thumb","track","inlineCode","link","prose","codeBlock","textColor","table","headerBackground","hr","blockquote","collapsibleWidget","voice","recording","indicator","processing","icon","speaking","requested","approve","deny","attachment","image","eventStream","badge","flow","step","reasoning","tool","agent","artifact","pane","toolbarBackground","DEFAULT_PALETTE_GRAY_V4","DEFAULT_PALETTE_V4","DEFAULT_PALETTE_V5","DEFAULT_SEMANTIC_V4","DEFAULT_SEMANTIC_V5","DEFAULT_COMPONENTS_V4","DEFAULT_COMPONENTS_V5","hoverForeground","activity","rowHeight","labelSize","indent","transcriptGap","responseGap","groupIndent","groupGap","groupPadding","bodyPadding","bodyFontWeight","sectionGap","bodySurface","borderBottom","iconScale","iconPadding","controlSize","controlIconSize","controlStrokeWidth","actionIconForeground","controlBorderRadius","controlHoverBackground","controlHoverForeground","controlFocusOutline","fullscreenGap","topFadeHeight","hoverBorderColor","chromeBackground","chromeBorder","titleColor","mutedColor","expandedPadding","expandedBorderRadius","sendIconSize","sendButtonRadius","footerBorder","overflowMenu","overlayBand","focusBorderColor","resolveThemeDefaults","resolveThemeDefaultsVersion","palette","semantic","components","resolveTokenValue","startsWith","current","mergeRecords","result","createTheme","baseTheme","userConfig","kind","tokens","field","legacySurface","suppliedHeader","suppliedComposer","suppliedMessage","validate","validation","errors","warnings","push","severity","valid","validateTheme","Error","plugins","plugin","transform","V","emitAliases","alias","sources","rows","charCodeAt","cssVars","COMMON_ALIASES","launcherThemeToCssVariables","resolved","resolveObject","obj","prefix","resolvedValue","resolveTokens","token","replace","canonicalThemeVariables","launcherFg","emitLauncherMuted","toLowerCase","Boolean","resolveHeaderIconPadding","DARK_COMPONENTS_BASE","dangerForeground","confirm","dangerBackground","scrim","DARK_PALETTE_V4","DARK_PALETTE_V5","DARK_COMPONENTS_V4","DARK_COMPONENTS_V5","normalizeThemeConfig","getColorScheme","documentElement","classList","contains","window","matchMedia","matches","getColorSchemeFromConfig","getActiveTheme","scheme","explicitTheme","deriveBrandTheme","ramp","stop","ink","dark","l","footerBackground","b","max","min","font","density","compact","comfortable","spacious","railHeader","elevation","flat","node","borderKey","allShadows","lightThemeConfig","darkThemeConfig","applyPanelModeWidth","isPanelWidthMode","lightWidth","darkWidth","createDarkTheme","darkDefaults","resolveDarkDefaults","createLightTheme","defineProperty","CONSUMER_PATHS","hasExplicitThemeStyle","selected","componentPath","appliedVariables","WeakMap","applyLauncherThemeVariables","applyVariables","get","removeProperty","set","setProperty","isDockedMountMode","renderIconNode","iconData","svg","createElementNS","String","viewBox","fill","stroke","strokeWidth","elementData","tagName","appendChild","setLoader","Ie","load","Le","fallbackImport","resetOnSetLoader","loader","moduleCache","loadPromise","Promise","resolve","importChunk","then","mod","catch","err","reject","provide","getSync","import","setIconsExtraLoader","loadIconsExtra","EXTRA_ICON_NAMES","runtimeIcons","Map","\"activity\"","d","\"bot\"","x","y","rx","\"check\"","\"clipboard\"","ry","\"copy\"","\"file\"","FileIcon","cx","cy","\"loader\"","\"mic\"","\"paperclip\"","\"quote\"","\"search\"","\"send\"","\"square\"","\"upload\"","\"x\"","\"ellipsis\"","\"menu\"","\"plus\"","\"minus\"","\"pencil\"","\"trash\"","\"download\"","\"maximize\"","\"minimize\"","\"star\"","\"eye\"","\"history\"","pendingIcons","extraIconsLoaded","extraReadySubscribers","Set","kickExtraIcons","X","data","icons","has","fillPendingIcons","el","delete","real","removeAttribute","firstChild","subs","clear","cb","notifyExtraIconsReady","__eagerlyProvideExtraIcons","EXTRA_LUCIDE_ICONS","console","warn","renderLucideIcon","createPlaceholderSvg","next","createLauncherButton","innerHTML","addEventListener","onToggle","update","newConfig","dockedMode","circle","dataset","personaLauncherVariant","titleEl","querySelector","subtitleEl","textContainer","textHidden","display","agentIconHidden","u","agentIconBackgroundColor","remove","add","iconSizeNum","iconSvg","iconUrl","img","src","callToActionIconEl","f","paddingTotal","boxSizing","positionClass","zIndex","boxShadow","minWidth","overflow","collapsedMaxWidth","justifyContent","destroy","removeEventListener","teaserMemoryDismissed","teaserStorageKey","persist","persistState","keyPrefix","createLauncherSurface","wrapper","currentConfig","teaserConfig","teaserElement","dismissButton","teaserTextButton","timer","shown","consumed","panelOpen","usesStorage","frequency","clearTimer","clearTimeout","dismiss","h","p","hidden","writeTeaserDismissed","useStorage","localStorage","setItem","consumeForOpen","origin","m","animate","opacity","easing","handleTeaserClick","handleDismissClick","event","stopPropagation","removeTeaserElement","applyPlacement","E","syncTeaser","teaser","resolveTeaserConfig","nextConfig","role","insertBefore","dismissible","dismissLabel","readTeaserDismissed","getItem","setTimeout","S","setPanelOpen","g","open","launcherScriptSrc","currentScript","chunkUrl","CRITICAL_LAUNCHER_ATTR","mergeCriticalLauncherConfig","nt","mount","onOpen","HTMLElement","body","resolveTarget","root"],"sources":["../src/utils/launcher-variant.ts","../src/utils/dom.ts","../src/utils/positioning.ts","../src/utils/panel-config.ts","../src/utils/deep-merge.ts","../src/utils/approval-config.ts","../src/utils/defaults-provenance.ts","../src/utils/brand.ts","../src/utils/style-provenance.ts","../src/defaults.ts","../src/utils/activity-display-defaults.ts","../src/utils/tokens.ts","../src/utils/theme.ts","../src/utils/dock.ts","../src/utils/icon-node.ts","../src/icons-extra-loader.ts","../src/utils/chunk-loader.ts","../src/utils/icons.ts","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/activity.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/arrow-down.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/arrow-up.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/arrow-up-right.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/bot.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/chevron-down.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/chevron-up.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/chevron-right.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/chevron-left.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/check.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/clipboard.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/clipboard-copy.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/code-xml.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/copy.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/file.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/file-code.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/file-spreadsheet.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/file-text.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/image-plus.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/loader.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/loader-circle.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/mic.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/paperclip.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/quote.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/refresh-cw.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/search.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/send.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/shield-alert.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/shield-check.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/shield-x.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/square.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/thumbs-down.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/thumbs-up.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/upload.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/volume-2.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/x.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/at-sign.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/arrow-left.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/arrow-right.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/external-link.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/ellipsis.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/menu.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/panel-left.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/plus.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/minus.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/pencil.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/trash.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/trash-2.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/download.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/maximize.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/minimize.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/message-square.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/star.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/eye.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/history.mjs","../src/components/launcher.ts","../src/launcher-global.ts"],"sourcesContent":["import type { AgentWidgetConfig } from \"../types\";\nimport type { LauncherTokens } from \"../types/theme\";\n\nexport const resolveLauncherVariant = (config?: Pick<AgentWidgetConfig, \"launcher\" | \"future\">): \"pill\" | \"circle\" =>\n config?.launcher?.variant ?? (config?.future?.v5Defaults === true ? \"circle\" : \"pill\");\n\nexport const CIRCLE_LAUNCHER_TOKENS: LauncherTokens = {\n background: \"semantic.colors.primary\",\n foreground: \"semantic.colors.textInverse\",\n border: \"transparent\",\n size: \"48px\",\n iconSize: \"24px\",\n borderRadius: \"palette.radius.full\",\n shadow: \"0 8px 24px rgba(0,0,0,.16)\",\n offset: \"20px\",\n};\n","/**\n * DOM utility functions\n */\nexport const createElement = <K extends keyof HTMLElementTagNameMap>(\n tag: K,\n className?: string\n): HTMLElementTagNameMap[K] => {\n const element = document.createElement(tag);\n if (className) {\n element.className = className;\n }\n return element;\n};\n\nexport const createElementInDocument = <K extends keyof HTMLElementTagNameMap>(\n documentRef: Document,\n tag: K,\n className?: string\n): HTMLElementTagNameMap[K] => {\n const element = documentRef.createElement(tag);\n if (className) {\n element.className = className;\n }\n return element;\n};\n\nexport const createFragment = (): DocumentFragment => {\n return document.createDocumentFragment();\n};\n\nexport interface CreateNodeOptions {\n /** Sets `element.className`. */\n className?: string;\n /** Sets `element.textContent` before any `children` are appended. */\n text?: string;\n /** Attribute name → value pairs applied via `setAttribute`. */\n attrs?: Record<string, string>;\n /**\n * Inline styles. Nullish (`undefined`/`null`) values are skipped so callers\n * can inline conditionals (e.g. `borderColor: cfg.borderColor`) without an\n * `if` per property. Note this only *sets* values, it never clears them, so\n * prefer it for constructing fresh elements rather than re-styling live ones.\n */\n style?: Partial<CSSStyleDeclaration>;\n}\n\n/**\n * Ergonomic element factory that bundles the className + attribute + style +\n * children boilerplate the widget's DOM builders otherwise repeat by hand.\n *\n * `createElement` stays the right tool for the simple `(tag, className)` case;\n * reach for `createNode` when a node also needs attributes, inline styles, or\n * up-front children. Nullish `children` are skipped so callers can inline\n * conditionals (e.g. `maybeIcon && el`).\n */\nexport const createNode = <K extends keyof HTMLElementTagNameMap>(\n tag: K,\n options: CreateNodeOptions = {},\n ...children: Array<Node | string | null | undefined>\n): HTMLElementTagNameMap[K] => {\n const element = document.createElement(tag);\n\n if (options.className) {\n element.className = options.className;\n }\n if (options.text !== undefined) {\n element.textContent = options.text;\n }\n if (options.attrs) {\n for (const [name, value] of Object.entries(options.attrs)) {\n element.setAttribute(name, value);\n }\n }\n if (options.style) {\n const style = element.style as unknown as Record<string, string>;\n const source = options.style as Record<string, string | null | undefined>;\n for (const property of Object.keys(source)) {\n const value = source[property];\n if (value != null) {\n style[property] = value;\n }\n }\n }\n\n const appendable = children.filter(\n (child): child is Node | string => child != null\n );\n if (appendable.length > 0) {\n element.append(...appendable);\n }\n\n return element;\n};\n\n/**\n * Join truthy class-name fragments into a single space-separated string\n * (the clsx / classnames pattern). Falsy fragments\n * (`false` / `null` / `undefined` / `\"\"`) are dropped, so conditional classes\n * read inline as `cond && \"persona-foo\"` instead of imperative\n * `classList.add(...)` branches.\n */\nexport const cx = (\n ...parts: Array<string | false | null | undefined>\n): string => parts.filter(Boolean).join(\" \");\n\n\n\n\n\n\n\n","export const positionMap: Record<\n \"bottom-right\" | \"bottom-left\" | \"top-right\" | \"top-left\",\n string\n> = {\n \"bottom-right\": \"persona-bottom-6 persona-right-6\",\n \"bottom-left\": \"persona-bottom-6 persona-left-6\",\n \"top-right\": \"persona-top-6 persona-right-6\",\n \"top-left\": \"persona-top-6 persona-left-6\"\n};\n\n\n\n\n\n\n\n\n","import type { AgentWidgetConfig, AgentWidgetConfigPatch } from \"../types\";\n\nexport const PANEL_WIDTH_VAR = \"var(--persona-components-panel-width)\";\n\n/**\n * Provenance for legacy panel geometry aliases. Config merging materializes\n * launcher defaults, so values alone cannot distinguish a caller's alias from\n * an inherited v4 default. The enumerable symbol survives object spreads while\n * remaining absent from JSON, generated snippets, and the public config shape.\n */\nexport const PANEL_ALIAS_PROVENANCE = Symbol(\"persona.panelAliasProvenance\");\n\nexport type PanelAliasProvenance = {\n launcherWidth: boolean;\n legacyLauncherWidth: boolean;\n sidebarWidth: boolean;\n dockWidth: boolean;\n};\n\ntype WithPanelAliasProvenance = {\n [PANEL_ALIAS_PROVENANCE]?: PanelAliasProvenance;\n};\n\nconst hasOwn = (value: object | undefined, key: string): boolean =>\n value != null && Object.prototype.hasOwnProperty.call(value, key);\n\nconst hasOwnDefined = (value: object | undefined, key: string): boolean =>\n hasOwn(value, key) && (value as Record<string, unknown>)[key] !== undefined;\n\nconst fromRawConfig = (\n config?: Partial<AgentWidgetConfig>\n): PanelAliasProvenance => ({\n launcherWidth: hasOwnDefined(config?.launcher, \"width\"),\n legacyLauncherWidth: hasOwnDefined(config, \"launcherWidth\"),\n sidebarWidth: hasOwnDefined(config?.launcher, \"sidebarWidth\"),\n dockWidth: hasOwnDefined(config?.launcher?.dock, \"width\"),\n});\n\nexport const getPanelAliasProvenance = (\n config?: Partial<AgentWidgetConfig>\n): PanelAliasProvenance => {\n const stored = (config as WithPanelAliasProvenance | undefined)?.[PANEL_ALIAS_PROVENANCE];\n return stored ? { ...stored } : fromRawConfig(config);\n};\n\nexport const setPanelAliasProvenance = <T extends object>(\n config: T,\n provenance: PanelAliasProvenance\n): T => {\n Object.defineProperty(config, PANEL_ALIAS_PROVENANCE, {\n value: provenance,\n enumerable: true,\n configurable: true,\n });\n return config;\n};\n\n/** Stamp a defaulted config with aliases supplied by the raw input. */\nexport const inheritPanelAliasProvenance = <T extends object>(\n result: T,\n rawConfig?: Partial<AgentWidgetConfig>\n): T => setPanelAliasProvenance(result, getPanelAliasProvenance(rawConfig));\n\n/** Apply own alias keys in a live patch, including explicit-undefined resets. */\nexport const updatePanelAliasProvenance = (\n previous: Partial<AgentWidgetConfig>,\n patch: AgentWidgetConfigPatch\n): PanelAliasProvenance => {\n // A config spread remains marked. Treat it as an already-normalized full\n // config rather than mistaking its materialized launcher defaults for a\n // patch that explicitly supplied every alias.\n const patchProvenance = (patch as WithPanelAliasProvenance)[PANEL_ALIAS_PROVENANCE];\n if (patchProvenance) return { ...patchProvenance };\n\n const next = getPanelAliasProvenance(previous);\n if (hasOwn(patch, \"launcherWidth\")) {\n next.legacyLauncherWidth = patch.launcherWidth !== undefined;\n }\n if (hasOwn(patch, \"launcher\") && patch.launcher === undefined) {\n next.launcherWidth = false;\n next.sidebarWidth = false;\n next.dockWidth = false;\n return next;\n }\n if (hasOwn(patch.launcher, \"width\")) {\n next.launcherWidth = patch.launcher?.width !== undefined;\n }\n if (hasOwn(patch.launcher, \"sidebarWidth\")) {\n next.sidebarWidth = patch.launcher?.sidebarWidth !== undefined;\n }\n if (hasOwn(patch.launcher, \"dock\") && patch.launcher?.dock === undefined) {\n next.dockWidth = false;\n } else if (hasOwn(patch.launcher?.dock, \"width\")) {\n next.dockWidth = patch.launcher?.dock?.width !== undefined;\n }\n return next;\n};\n\n/** Embedded presentation applies only to an inline mount, never a launcher host. */\nexport const isEmbeddedLayout = (config?: Partial<AgentWidgetConfig>): boolean =>\n config?.layout?.embedded === true &&\n config.launcher?.enabled === false &&\n !config.launcher.sidebarMode &&\n (config.launcher.mountMode ?? \"floating\") === \"floating\";\n\nexport const isHeaderVisible = (config?: Partial<AgentWidgetConfig>): boolean =>\n config?.layout?.showHeader ?? !isEmbeddedLayout(config);\n","const isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/**\n * Deep-merge plain objects. Arrays and non-objects are replaced by override.\n */\nexport function deepMerge<T extends Record<string, unknown>>(\n base: T | undefined,\n override: Record<string, unknown> | undefined\n): T | Record<string, unknown> | undefined {\n if (!base) return override;\n if (!override) return base;\n\n const merged: Record<string, unknown> = { ...base };\n\n for (const [key, value] of Object.entries(override)) {\n const existing = merged[key];\n if (isObject(existing) && isObject(value)) {\n merged[key] = deepMerge(existing, value);\n } else {\n merged[key] = value;\n }\n }\n\n return merged;\n}\n","import type { AgentWidgetApprovalConfig, AgentWidgetConfig } from \"../types\";\n\n/** Shared defaults kept small for the lazy approval chunk. */\nexport const DEFAULT_APPROVAL_V5: AgentWidgetApprovalConfig = {\n resolvedDisplay: \"row\",\n primaryAction: \"allow-once\",\n keyboardShortcuts: \"focused\",\n};\n\nexport const resolveApprovalConfig = (\n config?: AgentWidgetConfig\n): AgentWidgetApprovalConfig | undefined => config?.approval === false\n ? undefined\n : { ...(config?.future?.v5Defaults === true ? DEFAULT_APPROVAL_V5 : {}), ...config?.approval };\n","/** Tracks host intent for versioned defaults without comparing values to defaults. */\nconst DEFAULTS_PROVENANCE = Symbol.for(\"persona.defaultsProvenance\");\ntype Provenance = { [DEFAULTS_PROVENANCE]?: readonly string[] };\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nexport function versionedDefaultPaths(overlay: object, prefix = \"\"): string[] {\n return Object.entries(overlay).flatMap(([key, value]) => {\n const path = prefix ? `${prefix}.${key}` : key;\n return record(value) ? versionedDefaultPaths(value, path) : [path];\n });\n}\n\nexport function suppliedPath(value: unknown, path: string): \"absent\" | \"clear\" | \"explicit\" {\n const keys = path.split(\".\");\n for (let index = 0; index < keys.length; index++) {\n const key = keys[index];\n if (!record(value) || !Object.prototype.hasOwnProperty.call(value, key)) return \"absent\";\n value = value[key];\n if (value === undefined) return \"clear\";\n // Replacing a parent object with a disabled/non-object value drops every\n // tracked descendant, just as clearing that parent with undefined does.\n if (index < keys.length - 1 && !record(value)) return \"clear\";\n }\n return \"explicit\";\n}\n\nexport function defaultProvenance(config: object | undefined, paths: readonly string[]): readonly string[] {\n return (config as Provenance | undefined)?.[DEFAULTS_PROVENANCE]\n ?? paths.filter((path) => suppliedPath(config, path) === \"explicit\");\n}\n\nexport function setDefaultProvenance<T extends object>(config: T, explicit: readonly string[]): T {\n Object.defineProperty(config, DEFAULTS_PROVENANCE, {\n value: explicit, enumerable: true, configurable: true,\n });\n return config;\n}\n\nexport function inheritDefaultProvenance<T extends object>(result: T, raw: object | undefined, overlay: object): T {\n return setDefaultProvenance(result, defaultProvenance(raw, versionedDefaultPaths(overlay)));\n}\n\nexport function updateDefaultProvenance(previous: object, patch: object, paths: readonly string[]): readonly string[] {\n const marked = (patch as Provenance)[DEFAULTS_PROVENANCE];\n if (marked) return marked;\n const explicit = new Set(defaultProvenance(previous, paths));\n for (const path of paths) {\n const supplied = suppliedPath(patch, path);\n if (supplied === \"clear\") explicit.delete(path);\n if (supplied === \"explicit\") explicit.add(path);\n }\n return [...explicit];\n}\n\n/** Copy only traversed objects so deleting inherited defaults never mutates callers. */\nexport function omitInheritedDefaults<T extends object>(config: T, paths: readonly string[], explicit: readonly string[]): T {\n const result = { ...config } as Record<string, unknown>;\n for (const path of paths) {\n if (explicit.includes(path)) continue;\n const keys = path.split(\".\");\n let target: Record<string, unknown> | undefined = result;\n for (const key of keys.slice(0, -1)) {\n const child: unknown = target[key];\n if (!record(child)) { target = undefined; break; }\n target[key] = { ...child };\n target = target[key] as Record<string, unknown>;\n }\n if (target) delete target[keys[keys.length - 1]];\n }\n return result as T;\n}\n","import { deepMerge } from './deep-merge';\nimport type { BrandConfig, ColorShade, DeepPartial, PersonaTheme } from '../types/theme';\n\ntype RGB = [number, number, number];\n\n// Parsing stays independent of the DOM so the critical launcher and full widget\n// derive identical colors, including when rendering on the server.\nconst parseColor = (value?: string): RGB | undefined => {\n if (typeof value !== 'string') return;\n const color = value.trim();\n const hex = /^#([\\da-f]{3}|[\\da-f]{6})$/i.exec(color)?.[1];\n if (hex) {\n const full = hex.length === 3 ? [...hex].map((c) => c + c).join('') : hex;\n return [0, 2, 4].map((i) => parseInt(full.slice(i, i + 2), 16)) as RGB;\n }\n const match = /^rgba?\\(\\s*([^)]*)\\)$/i.exec(color);\n if (!match) return;\n const parts = match[1].trim().split(/\\s*[,/]\\s*|\\s+/);\n if (parts.length === 4 && /^(?:1(?:\\.0+)?|100%)$/.test(parts[3])) parts.pop();\n if (parts.length !== 3) return;\n const channels = parts.map((part) => {\n if (!/^\\d+(?:\\.\\d+)?%?$/.test(part)) return NaN;\n return Number.parseFloat(part) * (part.endsWith('%') ? 2.55 : 1);\n });\n if (channels.some((n) => !Number.isFinite(n) || n < 0 || n > 255)) return;\n return channels as RGB;\n};\n\nconst luminance = (rgb: RGB): number => rgb.reduce((sum, channel, i) => {\n const c = channel / 255;\n return sum + (c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4) * [0.2126, 0.7152, 0.0722][i];\n}, 0);\nconst hexColor = (rgb: RGB): string => '#' + rgb.map((c) => Math.round(c).toString(16).padStart(2, '0')).join('');\nconst mix = (rgb: RGB, target: number, amount: number): string => hexColor(rgb.map((c) => c + (target - c) * amount) as RGB);\nconst foreground = (rgb: RGB): string => luminance(rgb) > 0.179 ? '#000000' : '#ffffff';\n\nexport const inferBrandColorScheme = (brand?: BrandConfig): 'light' | 'dark' | undefined => {\n const neutral = parseColor(brand?.neutral);\n return neutral ? luminance(neutral) < 0.18 ? 'dark' : 'light' : undefined;\n};\n\n/** Sparse overlay: unspecified and invalid inputs leave versioned defaults intact. */\nexport const deriveBrandTheme = (brand?: BrandConfig, scheme: 'light' | 'dark' = 'light', components?: DeepPartial<PersonaTheme>['components'], v5Defaults = false): DeepPartial<PersonaTheme> => {\n const theme: DeepPartial<PersonaTheme> = {};\n if (!brand) return theme;\n const accent = parseColor(brand.accent);\n if (accent) {\n // Tint toward white above 500 and shade toward black below it. The seed\n // remains at 500 rather than shifting hue by adding channel constants.\n const ramp: ColorShade = {};\n for (const [stop, amount] of [[50, .96], [100, .9], [200, .75], [300, .55], [400, .25]] as const) ramp[stop] = mix(accent, 255, amount);\n ramp[500] = hexColor(accent);\n for (const [stop, amount] of [[600, .15], [700, .3], [800, .45], [900, .6], [950, .75]] as const) ramp[stop] = mix(accent, 0, amount);\n const ink = foreground(accent);\n theme.palette = { colors: { primary: ramp, accent: ramp } };\n theme.semantic = { colors: { primary: ramp[500], accent: ramp[500], interactive: { default: ramp[500], hover: ramp[600], focus: ramp[500], active: ramp[700] } } };\n theme.components = {\n button: { primary: { background: ramp[500], foreground: ink } },\n launcher: { background: ramp[500], foreground: ink },\n header: v5Defaults\n ? { background: 'semantic.colors.container', foreground: 'semantic.colors.text', iconBackground: 'transparent', iconForeground: 'semantic.colors.text' }\n : { background: ramp[500], foreground: ink, iconBackground: ramp[500], iconForeground: ink },\n approval: { approve: { foreground: ink } },\n message: { user: v5Defaults\n ? { background: 'color-mix(in srgb, var(--persona-primary) 12%, var(--persona-container))', text: 'semantic.colors.text' }\n : { background: ramp[500], text: ink } },\n };\n }\n const neutral = parseColor(brand.neutral);\n if (neutral) {\n // A seed chosen for the opposite explicit scheme still produces a usable\n // surface: project it toward that scheme's endpoint before adding layers.\n const dark = scheme === 'dark';\n const base = (dark === (luminance(neutral) < .18)) ? neutral : parseColor(mix(neutral, dark ? 0 : 255, .9))!;\n const surface = hexColor(base);\n const container = mix(base, dark ? 255 : 0, dark ? .06 : .025);\n const border = mix(base, dark ? 255 : 0, dark ? .2 : .16);\n const ink = foreground(base);\n const gray: ColorShade = {};\n for (const [stop, amount] of [[50, 0], [100, .06], [200, .16], [300, .28], [400, .45], [500, .65], [600, .72], [700, .8], [800, .9], [900, .97], [950, 1]] as const) gray[stop] = mix(base, ink === '#ffffff' ? 255 : 0, amount);\n theme.palette = { ...theme.palette, colors: { ...theme.palette?.colors, gray } };\n theme.semantic = { ...theme.semantic, colors: { ...theme.semantic?.colors, surface, background: surface, container, border, divider: border, text: ink, textMuted: mix(base, ink === '#ffffff' ? 255 : 0, .65) } };\n theme.components = { ...theme.components, panel: { background: surface }, header: { ...theme.components?.header, background: surface, foreground: ink }, composer: { footerBackground: surface } };\n }\n if (accent) {\n const surface = parseColor(theme.semantic?.colors?.surface) ?? (scheme === 'dark' ? [15, 15, 16] : [255, 255, 255]);\n let link = hexColor(accent);\n const target = foreground(surface) === '#ffffff' ? 255 : 0;\n for (let amount = 0; amount <= 1; amount += .1) {\n link = mix(accent, target, amount);\n const a = luminance(parseColor(link)!);\n const b = luminance(surface);\n if ((Math.max(a, b) + .05) / (Math.min(a, b) + .05) >= 4.5) break;\n }\n theme.components = { ...theme.components, markdown: { link: { foreground: link } }, input: { focus: { border: link, ring: link } } };\n }\n if (brand.font?.trim()) theme.semantic = { ...theme.semantic, typography: { fontFamily: brand.font } };\n const radius = { none: '0px', sm: '4px', md: '8px', lg: '16px' }[brand.radius ?? 'none'];\n if (brand.radius && radius) {\n theme.palette = { ...theme.palette, radius: { none: '0px', sm: radius, md: radius, lg: radius, xl: radius, '2xl': radius } };\n theme.components = { ...theme.components, input: { ...theme.components?.input, borderRadius: radius }, header: { ...theme.components?.header, controlBorderRadius: radius } };\n }\n const density = { compact: [13, 44, 8], comfortable: [14, 48, 12], spacious: [15, 52, 16] }[brand.density ?? 'comfortable'];\n if (brand.density && density) {\n const [size, height, gap] = density;\n theme.semantic = { ...theme.semantic, typography: { ...theme.semantic?.typography, fontSize: `${size}px` } };\n theme.components = { ...theme.components, header: { ...theme.components?.header, minHeight: `${height}px`, padding: `${gap}px 16px`, minimalPadding: `${gap}px 16px` }, history: { railHeader: { minHeight: `${height}px` } }, composer: { ...theme.components?.composer, fontSize: `${size}px`, padding: `${gap}px`, gap: `${gap / 2}px` }, message: { ...theme.components?.message, gap: `${gap}px`, user: { ...theme.components?.message?.user, fontSize: `${size}px` }, assistant: { fontSize: `${size}px` } } };\n }\n if (brand.elevation && ['flat', 'subtle', 'raised'].includes(brand.elevation)) {\n const flat = brand.elevation === 'flat';\n const shadow = flat ? 'none' : brand.elevation === 'subtle' ? '0 2px 8px rgba(0, 0, 0, 0.08)' : '0 12px 32px rgba(0, 0, 0, 0.18)';\n const border = flat ? '1px solid var(--persona-border)' : '1px solid color-mix(in srgb, var(--persona-border) 65%, transparent)';\n theme.palette = { ...theme.palette, shadows: { sm: shadow, md: shadow, lg: shadow, xl: shadow, '2xl': shadow } };\n const shadows = (node: Record<string, unknown>): Record<string, unknown> => {\n const overlay: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(node)) {\n if (key.toLowerCase().endsWith('shadow')) {\n overlay[key] = shadow;\n const borderKey = key === 'shadow' ? 'border' : key.replace(/Shadow$/, 'Border');\n if (borderKey in node) overlay[borderKey] = typeof node[borderKey] === 'string' && (node[borderKey] as string).includes('solid') ? border : flat ? 'semantic.colors.border' : 'color-mix(in srgb, var(--persona-border) 65%, transparent)';\n }\n else if (value && typeof value === 'object') {\n const child = shadows(value as Record<string, unknown>);\n if (Object.keys(child).length) overlay[key] = child;\n }\n }\n return overlay;\n };\n const allShadows = components ? shadows(components as Record<string, unknown>) : {};\n theme.components = deepMerge(theme.components, allShadows) as DeepPartial<PersonaTheme>['components'];\n theme.components = { ...theme.components, panel: { ...theme.components?.panel, shadow, modes: { floating: { shadow, border }, inline: { shadow, border }, docked: { shadow, border }, sidebar: { shadow, border }, mobile: { shadow, border } } }, launcher: { ...theme.components?.launcher, shadow, border: 'semantic.colors.border' }, composer: { ...theme.components?.composer, shadow, borderColor: 'semantic.colors.border' }, toolBubble: { shadow }, reasoningBubble: { shadow } };\n }\n return theme;\n};\n","import type { BrandConfig } from \"../types/theme\";\nimport { inferBrandColorScheme } from \"./brand\";\nimport { suppliedPath } from \"./defaults-provenance\";\n\nconst paths = (prefix: string, leaves: string): string[] =>\n leaves.split(\" \").map((leaf) => `${prefix}.${leaf}`);\n\n/** Only the style aliases covered by the replacement plan carry origin data. */\nexport const LEGACY_STYLE_PATHS: readonly string[] = /* @__PURE__ */ (() => [\n ...paths(\"launcher\", \"closeButtonSize closeButtonColor closeButtonBackgroundColor closeButtonBorderWidth closeButtonBorderColor closeButtonBorderRadius closeButtonPaddingX closeButtonPaddingY\"),\n ...paths(\"launcher.clearChat\", \"size iconColor backgroundColor borderWidth borderColor borderRadius paddingX paddingY\"),\n ...paths(\"sendButton\", \"size iconSize iconStrokeWidth backgroundColor textColor borderWidth borderColor paddingX paddingY\"),\n ...paths(\"voiceRecognition\", \"iconSize iconColor backgroundColor borderColor borderWidth paddingX paddingY recordingIconColor recordingBackgroundColor recordingBorderColor processingIconColor processingBackgroundColor processingBorderColor speakingIconColor speakingBackgroundColor speakingBorderColor\"),\n ...paths(\"toolCall\", \"shadow backgroundColor borderColor borderWidth borderRadius headerBackgroundColor headerTextColor headerPaddingX headerPaddingY contentBackgroundColor contentTextColor contentPaddingX contentPaddingY codeBlockBackgroundColor codeBlockBorderColor codeBlockTextColor toggleTextColor labelTextColor loadingAnimationColor loadingAnimationSecondaryColor loadingAnimationDuration\"),\n ...paths(\"approval\", \"backgroundColor borderColor shadow titleColor descriptionColor reasonColor approveButtonColor approveButtonTextColor denyButtonColor denyButtonTextColor parameterBackgroundColor parameterTextColor\"),\n ...paths(\"features.askUserQuestion.styles\", \"sheetBackground sheetBorder sheetShadow pillBackground pillBackgroundSelected pillTextColor pillTextColorSelected pillBorderRadius customInputBackground\"),\n ...paths(\"features.artifacts.layout\", \"paneBackground panePadding paneBorderRadius paneShadow chatShadow paneBorder paneBorderLeft unifiedSplitOuterRadius documentToolbarIconColor documentToolbarToggleActiveBackground documentToolbarToggleActiveBorderColor documentToolbarToggleActiveColor tabFadeSize\"),\n ...paths(\"suggestionChipsConfig\", \"fontWeight paddingX paddingY\"),\n])();\n\n/** Existing emitted tokens whose newly wired consumers must remain opt-in. */\nexport const OPT_IN_THEME_STYLE_PATHS: readonly string[] = [\n \"voice.recording.border\", \"voice.processing.icon\", \"voice.processing.background\", \"voice.speaking.icon\",\n \"approval.requested.text\", \"approval.approve.foreground\", \"approval.deny.foreground\", \"approval.deny.background\",\n \"reasoningBubble.shadow\", \"toolBubble.shadow\",\n];\nconst TRACKED_PATHS = /* @__PURE__ */ (() => [\n ...LEGACY_STYLE_PATHS,\n \"suggestionChips\", \"copy.welcomeTitle\", \"copy.welcomeSubtitle\", \"copy.showWelcomeCard\",\n \"features.suggestReplies.enabled\", \"features.suggestReplies.expose\",\n ...[\"theme\", \"darkTheme\"].flatMap((group) =>\n OPT_IN_THEME_STYLE_PATHS.map((path) => `${group}.components.${path}`)),\n])();\nconst STYLE_PROVENANCE = Symbol.for(\"persona.styleProvenance\");\ntype Origin = { explicit: readonly string[]; values: Readonly<Record<string, unknown>> };\ntype Marked = { [STYLE_PROVENANCE]?: Origin };\nexport const hasStyleProvenance = (config: object): boolean =>\n (config as Marked)[STYLE_PROVENANCE] !== undefined;\n\nconst valueAt = (config: unknown, path: string): unknown => {\n for (const key of path.split(\".\")) {\n if (typeof config !== \"object\" || config === null) return undefined;\n config = (config as Record<string, unknown>)[key];\n }\n return config;\n};\n\nconst origin = (config?: object): readonly string[] => {\n const stored = (config as Marked | undefined)?.[STYLE_PROVENANCE];\n if (!stored) return TRACKED_PATHS.filter((path) => suppliedPath(config, path) === \"explicit\");\n // A spread retains the symbol. Changes made on that copy are still host\n // input: compare with its recorded values, never with built-in defaults.\n const explicit = new Set(stored.explicit);\n TRACKED_PATHS.forEach((path) => {\n if (valueAt(config, path) === stored.values[path]) return;\n if (suppliedPath(config, path) === \"explicit\") explicit.add(path);\n else explicit.delete(path);\n });\n return [...explicit];\n};\n\nexport const setStyleProvenance = <T extends object>(config: T, explicit: readonly string[]): T => {\n Object.defineProperty(config, STYLE_PROVENANCE, {\n value: { explicit, values: Object.fromEntries(TRACKED_PATHS.map((path) => [path, valueAt(config, path)])) },\n enumerable: true, configurable: true,\n });\n return config;\n};\n\nexport const inheritStyleProvenance = <T extends object>(result: T, raw?: object): T =>\n setStyleProvenance(result, origin(raw));\n\nexport const updateStyleProvenance = (previous: object, patch: object): readonly string[] => {\n if ((patch as Marked)[STYLE_PROVENANCE]) return origin(patch);\n const explicit = new Set(origin(previous));\n for (const path of TRACKED_PATHS) {\n const state = suppliedPath(patch, path);\n if (state === \"clear\") explicit.delete(path);\n if (state === \"explicit\") explicit.add(path);\n }\n return [...explicit];\n};\n\n/** Unknown-origin external/default-filled configs conservatively keep present values explicit. */\nexport const hasExplicitStylePath = (config: object | undefined, path: string): boolean => {\n const stored = (config as Marked | undefined)?.[STYLE_PROVENANCE];\n if (!stored || !Object.prototype.hasOwnProperty.call(stored.values, path) || valueAt(config, path) !== stored.values[path]) {\n return suppliedPath(config, path) === \"explicit\";\n }\n return stored.explicit.includes(path);\n};\n\n/** Renderers keep responsibility for historical normalization and mode restrictions. */\nexport const getExplicitLegacyStyle = (config: object | undefined, path: string): unknown =>\n hasExplicitStylePath(config, path) ? valueAt(config, path) : undefined;\n\ntype SchemeConfig = { colorScheme?: \"light\" | \"dark\" | \"auto\"; brand?: BrandConfig };\nexport const hasExplicitThemeStyle = (\n config: object | undefined, componentPath: string, scheme?: \"light\" | \"dark\"\n): boolean => {\n const options = config as SchemeConfig | undefined;\n const selected = scheme ?? options?.colorScheme ?? inferBrandColorScheme(options?.brand) ?? \"light\";\n const dark = selected === \"dark\" || (selected === \"auto\" && (\n (typeof document !== \"undefined\" && document.documentElement.classList.contains(\"dark\")) ||\n (typeof window !== \"undefined\" && window.matchMedia?.(\"(prefers-color-scheme: dark)\").matches)\n ));\n return hasExplicitStylePath(config, `theme.components.${componentPath}`) ||\n (dark && hasExplicitStylePath(config, `darkTheme.components.${componentPath}`));\n};\n","import { DEFAULT_TOOL_CALL_DISPLAY, DEFAULT_REASONING_DISPLAY, DEFAULT_TOOL_CALL_DISPLAY_V5, DEFAULT_REASONING_DISPLAY_V5 } from \"./utils/activity-display-defaults\";\nexport { DEFAULT_TOOL_CALL_DISPLAY, DEFAULT_REASONING_DISPLAY } from \"./utils/activity-display-defaults\";\nimport type { AgentWidgetConfig, AgentWidgetLauncherConfig } from \"./types\";\nimport type { DeepPartial, PersonaTheme } from \"./types/theme\";\nimport { deepMerge } from \"./utils/deep-merge\";\nimport { DEFAULT_APPROVAL_V5 } from \"./utils/approval-config\";\nimport { defaultProvenance, inheritDefaultProvenance } from \"./utils/defaults-provenance\";\nimport { inheritPanelAliasProvenance } from \"./utils/panel-config\";\nimport { inheritStyleProvenance } from \"./utils/style-provenance\";\nimport {\n DEFAULT_TOOLTIP_DELAY_MS,\n DEFAULT_TOOLTIP_SKIP_DELAY_MS,\n} from \"./utils/tooltip-timing\";\n\n/**\n * Default width for the floating launcher panel (when not overridden).\n * Benchmarks: many chat products use ~300–400px; 400px is a frequent “standard” default.\n * We use 440px to better fit code/JSON and structured replies while staying responsive via `min(..., 100vw)`.\n */\nexport const DEFAULT_FLOATING_LAUNCHER_WIDTH = \"min(440px, calc(100vw - 24px))\";\n\n/** Max width cap paired with {@link DEFAULT_FLOATING_LAUNCHER_WIDTH} for theme defaults. */\nexport const DEFAULT_FLOATING_LAUNCHER_MAX_WIDTH = \"440px\";\n\n/** Canonical header avatar box size, shared by the initial render and updates. */\nexport const DEFAULT_HEADER_ICON_SIZE = \"40px\";\n\n/**\n * Canonical composer placeholder. The low-level builders fall back to this so\n * they cannot drift from `DEFAULT_WIDGET_CONFIG.copy.inputPlaceholder`.\n */\nexport const DEFAULT_INPUT_PLACEHOLDER = \"How can I help...\";\n\nexport const DEFAULT_LAUNCHER_CONFIG: AgentWidgetLauncherConfig = {\n enabled: true,\n mountMode: \"floating\",\n dock: {\n side: \"right\",\n width: \"420px\",\n },\n title: \"Chat Assistant\",\n subtitle: \"Here to help you get answers fast\",\n agentIconText: \"💬\",\n agentIconName: \"bot\",\n headerIconName: \"bot\",\n position: \"bottom-right\",\n width: DEFAULT_FLOATING_LAUNCHER_WIDTH,\n heightOffset: 0,\n autoExpand: false,\n callToActionIconHidden: false,\n agentIconSize: \"40px\",\n headerIconSize: DEFAULT_HEADER_ICON_SIZE,\n // closeButtonSize / clearChat.size omitted so theme.components.header.controlSize\n // sizes the header controls; setting either here would pin them past the token.\n // Zero out browser-default <button> padding so the icon gets the full\n // content box, matching clearChat.paddingX/Y below. Without this,\n // UA stylesheets add ~1-2px vertical and ~6px horizontal padding that\n // eats into the border-box width and shrinks the rendered icon.\n closeButtonPaddingX: \"0px\",\n closeButtonPaddingY: \"0px\",\n callToActionIconName: \"arrow-up-right\",\n callToActionIconText: \"\",\n callToActionIconSize: \"32px\",\n callToActionIconPadding: \"5px\",\n callToActionIconColor: undefined,\n callToActionIconBackgroundColor: undefined,\n // closeButtonColor / clearChat.iconColor omitted so theme.components.header.actionIconForeground applies.\n closeButtonBackgroundColor: \"transparent\",\n clearChat: {\n backgroundColor: \"transparent\",\n borderColor: \"transparent\",\n enabled: true,\n placement: \"inline\",\n iconName: \"refresh-cw\",\n showTooltip: true,\n tooltipText: \"Clear chat\",\n paddingX: \"0px\",\n paddingY: \"0px\",\n },\n headerIconHidden: false,\n border: undefined,\n shadow:\n \"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)\",\n};\n\n/**\n * Default widget configuration\n * Single source of truth for all default values\n */\nexport const DEFAULTS_BASE: Partial<AgentWidgetConfig> = {\n apiUrl: \"https://api.runtype.com/api/chat/dispatch\",\n // Client token mode defaults (optional, only used when clientToken is set)\n clientToken: undefined,\n agentId: undefined,\n target: undefined,\n theme: undefined,\n darkTheme: undefined,\n colorScheme: \"light\",\n tooltip: {\n delayMs: DEFAULT_TOOLTIP_DELAY_MS,\n skipDelayMs: DEFAULT_TOOLTIP_SKIP_DELAY_MS,\n },\n launcher: DEFAULT_LAUNCHER_CONFIG,\n copy: {\n // No welcomeTitle / welcomeSubtitle here on purpose: `resolveWelcomeConfig`\n // owns those defaults so presence still means \"the host set this\".\n inputPlaceholder: DEFAULT_INPUT_PLACEHOLDER,\n sendButtonLabel: \"Send\",\n },\n sendButton: {\n borderWidth: \"0px\",\n paddingX: \"12px\",\n paddingY: \"10px\",\n borderColor: undefined,\n useIcon: true,\n iconText: \"↑\",\n // No `size`: unset means \"follow --persona-composer-control-size\"\n // (theme.components.composer.controlSize), which defaults to 40px.\n showTooltip: true,\n tooltipText: \"Send message\",\n iconName: \"send\",\n },\n statusIndicator: {\n visible: true,\n idleText: \"Online\",\n connectingText: \"Connecting…\",\n connectedText: \"Streaming…\",\n errorText: \"Offline\",\n },\n voiceRecognition: {\n enabled: true,\n pauseDuration: 2000,\n iconName: \"mic\",\n // No `iconSize` / `paddingX` / `paddingY`: the mic sizes from\n // --persona-composer-control-size like every other composer control, so it\n // no longer needs the hand-tuned box that squeezed a 39px glyph.\n borderWidth: \"0px\",\n iconColor: undefined,\n backgroundColor: \"transparent\",\n borderColor: \"transparent\",\n recordingIconColor: undefined,\n recordingBackgroundColor: undefined,\n recordingBorderColor: \"transparent\",\n showTooltip: true,\n tooltipText: \"Start voice recognition\",\n },\n features: {\n showReasoning: true,\n showToolCalls: true,\n scrollToBottom: {\n enabled: true,\n iconName: \"arrow-down\",\n label: \"\",\n streamingIndicator: \"arrow\",\n scrollBehavior: \"instant\",\n scrollDurationMs: 220,\n transition: \"none\",\n },\n scrollBehavior: {\n // ChatGPT-style default: pin the just-sent message near the top and let\n // the reply stream into the space below. Restore the old \"stick to the\n // bottom\" behavior with `mode: \"follow\"`.\n mode: \"anchor-top\",\n anchorTopOffset: 16,\n // Surface the unread count + \"streaming below\" hint while pinned, so the\n // reader still sees activity arriving off-screen under the pinned turn.\n // (Suppressed by default historically; opted on alongside the anchor-top\n // default so the default UX keeps the affordance.)\n showActivityWhilePinned: true,\n },\n toolCallDisplay: DEFAULT_TOOL_CALL_DISPLAY,\n reasoningDisplay: DEFAULT_REASONING_DISPLAY,\n streamAnimation: {\n type: \"none\",\n placeholder: \"none\",\n speed: 120,\n duration: 1800,\n },\n askUserQuestion: {\n enabled: true,\n slideInMs: 180,\n freeTextLabel: \"Other…\",\n freeTextPlaceholder: \"Type your answer…\",\n submitLabel: \"Send\",\n },\n history: {\n enabled: false,\n presentation: \"panel\",\n showScopeStatus: true,\n showDelete: true,\n showDeleteAll: true,\n },\n },\n // Placeholder copy that models the right shape: verb-first, user-voice,\n // one line. Integrators should swap in domain prompts.\n suggestionChips: [\n \"Show me what you can help with\",\n \"Walk me through getting started\",\n \"Answer a question about this page\",\n ],\n suggestionChipsConfig: {\n fontFamily: \"sans-serif\",\n fontWeight: \"500\",\n paddingX: \"12px\",\n paddingY: \"6px\",\n },\n layout: {\n header: {\n layout: \"default\",\n showIcon: true,\n showTitle: true,\n showSubtitle: true,\n showCloseButton: true,\n showClearChat: true,\n },\n messages: {\n layout: \"bubble\",\n avatar: {\n show: false,\n position: \"left\",\n },\n timestamp: {\n show: false,\n position: \"below\",\n },\n groupConsecutive: false,\n },\n slots: {},\n },\n markdown: {\n options: {\n gfm: true,\n breaks: true,\n },\n disableDefaultStyles: false,\n },\n messageActions: {\n enabled: true,\n showCopy: true,\n showUpvote: false, // Requires backend - disabled by default\n showDownvote: false, // Requires backend - disabled by default\n visibility: \"hover\",\n align: \"right\",\n layout: \"pill-inside\",\n },\n debug: false,\n};\n\n/** Version-specific defaults, selected by the staged V5 opt-in. */\nexport const DEFAULTS_V4: Partial<AgentWidgetConfig> = {};\nexport const DEFAULT_LAUNCHER_V5: Partial<AgentWidgetLauncherConfig> = {\n variant: \"circle\",\n width: \"min(400px, calc(100vw - 24px))\",\n headerIconSize: \"20px\",\n};\nexport const DEFAULTS_V5: Partial<AgentWidgetConfig> = {\n // Shared default tracked here so later brand updates retain host scheme intent.\n colorScheme: \"light\",\n errorDisplay: \"block\",\n messageActions: { visibility: undefined },\n // Let the suggestion theme token control weight; explicit legacy overrides still win.\n suggestionChipsConfig: { fontWeight: undefined },\n approval: DEFAULT_APPROVAL_V5,\n loadingIndicator: { variant: \"label\" },\n launcher: DEFAULT_LAUNCHER_V5,\n features: {\n artifacts: { enabled: true },\n scrollToBottom: { streamingIndicator: \"dots\", transition: \"fade\", scrollBehavior: \"smooth\" },\n toolCallDisplay: DEFAULT_TOOL_CALL_DISPLAY_V5,\n reasoningDisplay: DEFAULT_REASONING_DISPLAY_V5,\n },\n composer: { layout: \"single-row\", placement: \"overlay\" },\n sendButton: { iconName: \"arrow-up\" },\n statusIndicator: { mode: \"transient\" },\n layout: {\n contentMaxWidth: \"768px\",\n topFade: true,\n header: { showSubtitle: false },\n messages: { assistant: { width: \"full\" } },\n },\n};\n\nexport type DefaultsVersion = \"v4\" | \"v5\";\n\n/** Shared by config, token, theme, and editor resolution. Only true opts in. */\nexport function resolveDefaultsVersion(\n config?: Pick<AgentWidgetConfig, \"future\">\n): DefaultsVersion {\n return config?.future?.v5Defaults === true ? \"v5\" : \"v4\";\n}\n\nexport function resolveDefaults(\n config?: Pick<AgentWidgetConfig, \"future\">\n): Partial<AgentWidgetConfig> {\n const overlay = resolveDefaultsVersion(config) === \"v5\" ? DEFAULTS_V5 : DEFAULTS_V4;\n return deepMerge(DEFAULTS_BASE, overlay) as Partial<AgentWidgetConfig>;\n}\n\n/** Backward-compatible export of the legacy widget defaults. */\nexport const DEFAULT_WIDGET_CONFIG = resolveDefaults();\n\nfunction mergeThemePartials(\n base: DeepPartial<PersonaTheme> | undefined,\n override: DeepPartial<PersonaTheme> | undefined\n): DeepPartial<PersonaTheme> | undefined {\n if (!base && !override) return undefined;\n if (!base) return override;\n if (!override) return base;\n return deepMerge(\n base as Record<string, unknown>,\n override as Record<string, unknown>\n ) as DeepPartial<PersonaTheme>;\n}\n\n/**\n * Helper to deep merge user config with defaults\n * This ensures all default values are present while allowing selective overrides\n */\nexport function mergeWithDefaults(\n config?: Partial<AgentWidgetConfig>\n): Partial<AgentWidgetConfig> {\n const defaults = resolveDefaults(config);\n if (!config) return inheritStyleProvenance(inheritDefaultProvenance(inheritPanelAliasProvenance(defaults), undefined, DEFAULTS_V5));\n\n return inheritStyleProvenance(inheritDefaultProvenance(inheritPanelAliasProvenance({\n ...defaults,\n ...config,\n // Leave the scheme unresolved for a brand unless the host chose one.\n // Provenance also distinguishes the inherited light default on live updates.\n colorScheme: defaultProvenance(config, [\"colorScheme\"]).includes(\"colorScheme\")\n ? config.colorScheme : config.brand ? undefined : defaults.colorScheme,\n ...((defaults.approval || config.approval !== undefined) ? { approval: config.approval === false ? false : {\n ...(defaults.approval || {}),\n ...config.approval,\n } } : {}),\n theme: mergeThemePartials(defaults.theme, config.theme),\n darkTheme: mergeThemePartials(defaults.darkTheme, config.darkTheme),\n launcher: {\n ...defaults.launcher,\n ...config.launcher,\n dock: {\n ...defaults.launcher?.dock,\n ...config.launcher?.dock,\n },\n clearChat: {\n ...defaults.launcher?.clearChat,\n ...config.launcher?.clearChat,\n },\n },\n ...((defaults.composer || config.composer) ? { composer: {\n ...defaults.composer,\n ...config.composer,\n } } : {}),\n tooltip: {\n ...defaults.tooltip,\n ...config.tooltip,\n },\n copy: {\n ...defaults.copy,\n ...config.copy,\n },\n sendButton: {\n ...defaults.sendButton,\n ...config.sendButton,\n },\n statusIndicator: {\n ...defaults.statusIndicator,\n ...config.statusIndicator,\n },\n voiceRecognition: {\n ...defaults.voiceRecognition,\n ...config.voiceRecognition,\n },\n features: (() => {\n const da = defaults.features?.artifacts;\n const ca = config.features?.artifacts;\n const dsb = defaults.features?.scrollToBottom;\n const csb = config.features?.scrollToBottom;\n const dsc = defaults.features?.scrollBehavior;\n const csc = config.features?.scrollBehavior;\n const dsa = defaults.features?.streamAnimation;\n const csa = config.features?.streamAnimation;\n const dau = defaults.features?.askUserQuestion;\n const cau = config.features?.askUserQuestion;\n const dh = defaults.features?.history;\n const ch = config.features?.history;\n const mergedArtifacts =\n da === undefined && ca === undefined\n ? undefined\n : {\n ...da,\n ...ca,\n layout: {\n ...da?.layout,\n ...ca?.layout,\n },\n };\n const mergedScrollToBottom =\n dsb === undefined && csb === undefined\n ? undefined\n : {\n ...dsb,\n ...csb,\n };\n const mergedScrollBehavior =\n dsc === undefined && csc === undefined\n ? undefined\n : {\n ...dsc,\n ...csc,\n };\n const mergedStreamAnimation =\n dsa === undefined && csa === undefined\n ? undefined\n : {\n ...dsa,\n ...csa,\n };\n const mergedAskUserQuestion =\n dau === undefined && cau === undefined\n ? undefined\n : {\n ...dau,\n ...cau,\n styles: {\n ...dau?.styles,\n ...cau?.styles,\n },\n };\n const mergedHistory =\n dh === undefined && ch === undefined\n ? undefined\n : {\n ...dh,\n ...ch,\n copy: {\n ...dh?.copy,\n ...ch?.copy,\n },\n };\n return {\n ...defaults.features,\n ...config.features,\n toolCallDisplay: {\n ...defaults.features?.toolCallDisplay,\n ...config.features?.toolCallDisplay,\n ...(config.features?.toolCallDisplay?.layout === undefined && config.features?.toolCallDisplay?.variant !== undefined\n ? { layout: config.features.toolCallDisplay.variant } : {}),\n },\n reasoningDisplay: {\n ...defaults.features?.reasoningDisplay,\n ...config.features?.reasoningDisplay,\n ...(config.features?.reasoningDisplay?.layout === undefined && config.features?.reasoningDisplay?.variant !== undefined\n ? { layout: config.features.reasoningDisplay.variant } : {}),\n },\n ...(mergedScrollToBottom !== undefined ? { scrollToBottom: mergedScrollToBottom } : {}),\n ...(mergedScrollBehavior !== undefined ? { scrollBehavior: mergedScrollBehavior } : {}),\n ...(mergedArtifacts !== undefined ? { artifacts: mergedArtifacts } : {}),\n ...(mergedStreamAnimation !== undefined ? { streamAnimation: mergedStreamAnimation } : {}),\n ...(mergedAskUserQuestion !== undefined ? { askUserQuestion: mergedAskUserQuestion } : {}),\n ...(mergedHistory !== undefined ? { history: mergedHistory } : {}),\n };\n })(),\n suggestionChips: config.suggestionChips ?? defaults.suggestionChips,\n suggestionChipsConfig: {\n ...defaults.suggestionChipsConfig,\n ...config.suggestionChipsConfig,\n },\n layout: {\n ...defaults.layout,\n ...config.layout,\n header: {\n ...defaults.layout?.header,\n ...config.layout?.header,\n },\n messages: {\n ...defaults.layout?.messages,\n ...config.layout?.messages,\n ...((defaults.layout?.messages?.user || config.layout?.messages?.user) ? {\n user: {\n ...defaults.layout?.messages?.user,\n ...config.layout?.messages?.user,\n },\n } : {}),\n ...((defaults.layout?.messages?.assistant || config.layout?.messages?.assistant) ? {\n assistant: {\n ...defaults.layout?.messages?.assistant,\n ...config.layout?.messages?.assistant,\n },\n } : {}),\n avatar: {\n ...defaults.layout?.messages?.avatar,\n ...config.layout?.messages?.avatar,\n },\n timestamp: {\n ...defaults.layout?.messages?.timestamp,\n ...config.layout?.messages?.timestamp,\n },\n },\n slots: {\n ...defaults.layout?.slots,\n ...config.layout?.slots,\n },\n },\n markdown: {\n ...defaults.markdown,\n ...config.markdown,\n options: {\n ...defaults.markdown?.options,\n ...config.markdown?.options,\n },\n },\n messageActions: {\n ...defaults.messageActions,\n ...config.messageActions,\n },\n }, config), config, DEFAULTS_V5), config);\n\n}\n","import type { AgentWidgetConfig } from \"../types\";\n\n/** Shared by config resolution and standalone transcript component builders. */\nexport const DEFAULT_TOOL_CALL_DISPLAY = {\n collapsedMode: \"tool-call\",\n activePreview: false,\n grouped: false,\n groupedMode: \"stack\",\n groupBoundary: \"adjacent\",\n previewMaxLines: 3,\n expandable: true,\n loadingAnimation: \"none\",\n} satisfies NonNullable<NonNullable<AgentWidgetConfig[\"features\"]>[\"toolCallDisplay\"]>;\n\nexport const DEFAULT_REASONING_DISPLAY = {\n activePreview: false,\n previewMaxLines: 3,\n expandable: true,\n loadingAnimation: \"none\",\n} satisfies NonNullable<NonNullable<AgentWidgetConfig[\"features\"]>[\"reasoningDisplay\"]>;\n\n// Keep the shipped resolved alias and its author-intent provenance on live updates.\nexport const DEFAULT_TOOL_CALL_DISPLAY_V5 = {\n layout: \"row\", variant: \"row\", iconVisibility: \"active\", autoExpand: false, grouped: true, groupedMode: \"collapsible\", groupAppearance: \"inset\", loadingAnimation: \"shimmer\",\n} satisfies NonNullable<NonNullable<AgentWidgetConfig[\"features\"]>[\"toolCallDisplay\"]>;\n\nexport const DEFAULT_REASONING_DISPLAY_V5 = {\n appearance: \"inset\", layout: \"row\", variant: \"row\", iconVisibility: \"active\", autoExpand: false, loadingAnimation: \"shimmer\",\n} satisfies NonNullable<NonNullable<AgentWidgetConfig[\"features\"]>[\"reasoningDisplay\"]>;\n","import { CIRCLE_LAUNCHER_TOKENS } from \"./launcher-variant\";\nimport type {\n DeepPartial,\n PersonaTheme,\n ResolvedToken,\n ThemeValidationResult,\n ThemeValidationError,\n CreateThemeOptions,\n ComponentTokens,\n SemanticTokens,\n} from '../types/theme';\nimport {\n DEFAULT_FLOATING_LAUNCHER_WIDTH,\n resolveDefaultsVersion,\n} from '../defaults';\n\n// Detached/docked panel defaults, shared by the panel token defaults, the alias\n// fallbacks below, host-layout, the theme editor, and the artifact gate.\nexport const DEFAULT_PANEL_INSET = '16px';\nexport const DEFAULT_PANEL_CANVAS_BACKGROUND = 'transparent';\n\nconst spacing = (() => {\n const s: Record<number, string> = {};\n for (const k of [0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 32, 40, 48, 56, 64])\n s[k] = k === 0 ? '0px' : `${k / 4}rem`;\n return s as Record<0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | 56 | 64, string>;\n})();\n\nconst DEFAULT_PALETTE_BASE = {\n colors: {\n primary: {\n 50: '#ffffff',\n 100: '#f5f5f5',\n 200: '#d4d4d4',\n 300: '#a3a3a3',\n 400: '#737373',\n 500: '#171717',\n 600: '#0f0f0f',\n 700: '#0a0a0a',\n 800: '#050505',\n 900: '#030303',\n 950: '#000000',\n },\n secondary: {\n 50: '#f5f3ff',\n 100: '#ede9fe',\n 200: '#ddd6fe',\n 300: '#c4b5fd',\n 400: '#a78bfa',\n 500: '#8b5cf6',\n 600: '#7c3aed',\n 700: '#6d28d9',\n 800: '#5b21b6',\n 900: '#4c1d95',\n 950: '#2e1065',\n },\n accent: {\n 50: '#ecfeff',\n 100: '#cffafe',\n 200: '#a5f3fc',\n 300: '#67e8f9',\n 400: '#22d3ee',\n 500: '#06b6d4',\n 600: '#0891b2',\n 700: '#0e7490',\n 800: '#155e75',\n 900: '#164e63',\n 950: '#083344',\n },\n gray: {\n 50: '#f9fafb',\n 100: '#f3f4f6',\n 200: '#e5e7eb',\n 300: '#d1d5db',\n 400: '#9ca3af',\n 500: '#6b7280',\n 600: '#4b5563',\n 700: '#374151',\n 800: '#1f2937',\n 900: '#111827',\n 950: '#030712',\n },\n success: {\n 50: '#f0fdf4',\n 100: '#dcfce7',\n 200: '#bbf7d0',\n 300: '#86efac',\n 400: '#4ade80',\n 500: '#22c55e',\n 600: '#16a34a',\n 700: '#15803d',\n 800: '#166534',\n 900: '#14532d',\n },\n warning: {\n 50: '#fefce8',\n 100: '#fef9c3',\n 200: '#fef08a',\n 300: '#fde047',\n 400: '#facc15',\n 500: '#eab308',\n 600: '#ca8a04',\n 700: '#a16207',\n 800: '#854d0e',\n 900: '#713f12',\n },\n error: {\n 50: '#fef2f2',\n 100: '#fee2e2',\n 200: '#fecaca',\n 300: '#fca5a5',\n 400: '#f87171',\n 500: '#ef4444',\n 600: '#dc2626',\n 700: '#b91c1c',\n 800: '#991b1b',\n 900: '#7f1d1d',\n },\n info: {\n 50: '#eff6ff',\n 100: '#dbeafe',\n 200: '#bfdbfe',\n 300: '#93c5fd',\n 400: '#60a5fa',\n 500: '#3b82f6',\n 600: '#2563eb',\n 700: '#1d4ed8',\n 800: '#1e40af',\n 900: '#1e3a8a',\n 950: '#172554',\n },\n purple: {\n 50: '#faf5ff',\n 100: '#f3e8ff',\n 200: '#e9d5ff',\n 300: '#d8b4fe',\n 400: '#c084fc',\n 500: '#a855f7',\n 600: '#9333ea',\n 700: '#7e22ce',\n 800: '#6b21a8',\n 900: '#581c87',\n 950: '#3b0764',\n },\n teal: {\n 50: '#f0fdfa',\n 100: '#ccfbf1',\n 200: '#99f6e4',\n 300: '#5eead4',\n 400: '#2dd4bf',\n 500: '#14b8a6',\n 600: '#0d9488',\n 700: '#0f766e',\n 800: '#115e59',\n 900: '#134e4a',\n 950: '#042f2e',\n },\n },\n spacing,\n typography: {\n fontFamily: {\n sans: 'system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n serif: 'Georgia, Cambria, \"Times New Roman\", Times, serif',\n mono: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace',\n },\n fontSize: {\n xs: '0.75rem',\n sm: '0.875rem',\n base: '1rem',\n lg: '1.125rem',\n xl: '1.25rem',\n '2xl': '1.5rem',\n '3xl': '1.875rem',\n '4xl': '2.25rem',\n },\n fontWeight: {\n normal: '400',\n medium: '500',\n semibold: '600',\n bold: '700',\n },\n lineHeight: {\n tight: '1.25',\n normal: '1.5',\n relaxed: '1.625',\n },\n },\n shadows: {\n none: 'none',\n sm: '0 1px 2px 0 rgb(0 0 0 / 0.05)',\n md: '0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)',\n lg: '0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)',\n xl: '0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)',\n '2xl': '0 25px 50px -12px rgb(0 0 0 / 0.25)',\n },\n borders: {\n none: 'none',\n sm: '1px solid',\n md: '2px solid',\n lg: '4px solid',\n },\n radius: {\n none: '0px',\n sm: '0.125rem',\n md: '0.375rem',\n lg: '0.5rem',\n xl: '0.75rem',\n '2xl': '1rem',\n full: '9999px',\n },\n};\n\nconst DEFAULT_SEMANTIC_BASE: SemanticTokens = {\n colors: {\n primary: 'palette.colors.primary.500',\n secondary: 'palette.colors.secondary.500',\n // Links/Focus role: solid primary\n accent: 'palette.colors.primary.600',\n // Surfaces role: soft gray\n surface: 'palette.colors.gray.50',\n background: 'palette.colors.gray.50',\n container: 'palette.colors.gray.50',\n text: 'palette.colors.gray.900',\n textMuted: 'palette.colors.gray.500',\n textInverse: 'palette.colors.gray.50',\n // Borders role: soft gray\n border: 'palette.colors.gray.200',\n divider: 'palette.colors.gray.200',\n interactive: {\n // Primary Actions role: solid primary\n default: 'palette.colors.primary.600',\n hover: 'palette.colors.primary.700',\n // Links/Focus role: solid primary\n focus: 'palette.colors.primary.600',\n active: 'palette.colors.primary.600',\n disabled: 'palette.colors.gray.300',\n },\n feedback: {\n success: 'palette.colors.success.500',\n warning: 'palette.colors.warning.500',\n error: 'palette.colors.error.500',\n info: 'palette.colors.info.500',\n },\n },\n spacing: {\n xs: 'palette.spacing.1',\n sm: 'palette.spacing.2',\n md: 'palette.spacing.4',\n lg: 'palette.spacing.6',\n xl: 'palette.spacing.8',\n '2xl': 'palette.spacing.10',\n },\n typography: {\n fontFamily: 'palette.typography.fontFamily.sans',\n fontSize: 'palette.typography.fontSize.base',\n fontWeight: 'palette.typography.fontWeight.normal',\n lineHeight: 'palette.typography.lineHeight.normal',\n },\n};\n\nconst DEFAULT_COMPONENTS_BASE: ComponentTokens = {\n button: {\n primary: {\n // Primary Actions role: solid primary\n background: 'palette.colors.primary.500',\n foreground: 'palette.colors.primary.50',\n borderRadius: 'palette.radius.lg',\n padding: 'semantic.spacing.md',\n },\n secondary: {\n background: 'semantic.colors.surface',\n foreground: 'semantic.colors.secondary',\n borderRadius: 'palette.radius.lg',\n padding: 'semantic.spacing.md',\n },\n ghost: {\n background: 'transparent',\n foreground: 'semantic.colors.text',\n borderRadius: 'palette.radius.md',\n padding: 'semantic.spacing.sm',\n // Subtle neutral tint on hover — the composer's transparent icon buttons\n // (attachment, mention) read this via `--persona-button-ghost-hover-bg`.\n hoverBackground: 'rgba(0, 0, 0, 0.05)',\n },\n },\n input: {\n // Input role: semantic surface so host light/dark schemes cascade.\n background: 'semantic.colors.surface',\n placeholder: 'semantic.colors.textMuted',\n borderRadius: 'palette.radius.lg',\n padding: 'semantic.spacing.md',\n focus: {\n border: 'palette.colors.gray.400',\n ring: 'palette.colors.gray.400',\n },\n },\n launcher: {\n // Launcher pill role: shared surface/primary tones until a host overrides.\n background: 'semantic.colors.surface',\n foreground: 'semantic.colors.primary',\n border: 'semantic.colors.border',\n size: '60px',\n iconSize: '28px',\n borderRadius: 'palette.radius.full',\n shadow: 'palette.shadows.lg',\n },\n panel: {\n width: DEFAULT_FLOATING_LAUNCHER_WIDTH,\n // Matches the existing floating runtime geometry. `maxWidth` and\n // `maxHeight` intentionally do not impose a second cap; ui.ts applies\n // the responsive width and heightOffset rules for this mode.\n maxWidth: 'none',\n height: 'min(640px, max(200px, calc(100vh - 64px)))',\n maxHeight: 'none',\n borderRadius: 'palette.radius.xl',\n shadow: 'palette.shadows.xl',\n inset: DEFAULT_PANEL_INSET,\n canvasBackground: DEFAULT_PANEL_CANVAS_BACKGROUND,\n modes: {\n floating: {\n border: '1px solid var(--persona-border)',\n shadow: 'palette.shadows.xl',\n borderRadius: 'palette.radius.xl',\n },\n inline: {\n border: '1px solid var(--persona-border)',\n shadow: 'none',\n borderRadius: 'palette.radius.xl',\n },\n docked: { border: 'none', shadow: 'none', borderRadius: 'palette.radius.xl' },\n sidebar: { border: 'none', borderRadius: '0' },\n mobile: { border: 'none', shadow: 'none', borderRadius: '0' },\n },\n },\n header: {\n // Header role: solid primary. Border, subtitle, and action icons stay\n // unset so they derive from this background/foreground pair.\n background: 'palette.colors.primary.500',\n foreground: 'palette.colors.primary.50',\n borderRadius: 'palette.radius.xl palette.radius.xl 0 0',\n padding: '20px 24px',\n minimalPadding: '16px 24px',\n iconBackground: 'palette.colors.primary.600',\n iconForeground: 'palette.colors.primary.50',\n },\n message: {\n gap: '12px',\n user: {\n // User Messages role: solid primary\n background: 'palette.colors.primary.500',\n text: 'palette.colors.primary.50',\n borderRadius: 'palette.radius.lg',\n shadow: 'palette.shadows.sm',\n },\n assistant: {\n // Assistant Messages role: semantic neutral container.\n background: 'semantic.colors.container',\n text: 'semantic.colors.text',\n borderRadius: 'palette.radius.lg',\n border: 'semantic.colors.border',\n shadow: 'palette.shadows.sm',\n },\n border: 'semantic.colors.border',\n },\n introCard: {\n // Flat by default: the greeting reads as plain text on the transcript\n // background (the industry norm), not an elevated card.\n background: 'transparent',\n borderRadius: 'palette.radius.2xl',\n padding: 'semantic.spacing.lg',\n shadow: 'palette.shadows.none',\n },\n suggestion: {\n chip: {\n background: 'semantic.colors.surface',\n foreground: 'semantic.colors.text',\n border: 'semantic.colors.border',\n borderRadius: 'palette.radius.full',\n padding: '0.5rem 0.875rem',\n gap: '0.5rem',\n itemGap: '8px',\n minHeight: '36px',\n fontSize: '0.8125rem',\n lineHeight: '1.25',\n iconSize: '16px',\n hoverBackground: 'palette.colors.gray.100',\n hoverBorder: 'palette.colors.gray.300',\n pressedBackground: 'palette.colors.gray.200',\n focusRing: 'semantic.colors.interactive.focus',\n disabledOpacity: '0.5',\n },\n card: {\n background: 'semantic.colors.surface',\n foreground: 'semantic.colors.text',\n border: 'semantic.colors.border',\n borderRadius: 'palette.radius.xl',\n padding: '1rem',\n shadow: 'palette.shadows.sm',\n gap: '0.625rem',\n itemGap: '8px',\n minHeight: '72px',\n fontSize: '0.875rem',\n lineHeight: '1.35',\n iconSize: '18px',\n hoverBackground: 'palette.colors.gray.100',\n hoverBorder: 'palette.colors.gray.300',\n pressedBackground: 'palette.colors.gray.200',\n focusRing: 'semantic.colors.interactive.focus',\n disabledOpacity: '0.5',\n },\n list: {\n background: 'transparent',\n foreground: 'semantic.colors.text',\n border: 'semantic.colors.border',\n borderRadius: 'palette.radius.md',\n padding: '0.75rem',\n gap: '0.625rem',\n itemGap: '8px',\n minHeight: '44px',\n fontSize: '0.875rem',\n lineHeight: '1.35',\n iconSize: '17px',\n hoverBackground: 'palette.colors.gray.100',\n hoverBorder: 'palette.colors.gray.300',\n pressedBackground: 'palette.colors.gray.200',\n focusRing: 'semantic.colors.interactive.focus',\n disabledOpacity: '0.5',\n },\n },\n toolBubble: {\n shadow: 'palette.shadows.sm',\n },\n reasoningBubble: {\n shadow: 'palette.shadows.sm',\n },\n composer: {\n shadow: 'palette.shadows.none',\n },\n scrollbar: {\n thumb: 'semantic.colors.border',\n track: 'transparent',\n },\n markdown: {\n inlineCode: {\n background: 'palette.colors.gray.50',\n foreground: 'palette.colors.gray.900',\n },\n link: {\n // Links/Focus role: solid primary\n foreground: 'palette.colors.primary.600',\n },\n prose: {\n fontFamily: 'inherit',\n },\n codeBlock: {\n background: 'semantic.colors.container',\n borderColor: 'semantic.colors.border',\n textColor: 'inherit',\n borderRadius: 'palette.radius.md',\n },\n table: {\n headerBackground: 'semantic.colors.container',\n borderColor: 'semantic.colors.border',\n },\n hr: {\n color: 'semantic.colors.divider',\n },\n blockquote: {\n borderColor: 'palette.colors.gray.900',\n background: 'transparent',\n textColor: 'palette.colors.gray.500',\n },\n },\n collapsibleWidget: {\n container: 'palette.colors.gray.50',\n surface: 'semantic.colors.surface',\n border: 'semantic.colors.border',\n },\n voice: {\n recording: {\n indicator: 'palette.colors.error.500',\n background: 'palette.colors.error.50',\n border: 'palette.colors.error.200',\n },\n processing: {\n icon: 'palette.colors.primary.500',\n background: 'palette.colors.primary.50',\n },\n speaking: {\n icon: 'palette.colors.success.500',\n },\n },\n // Neutral surface card (components/approval-actions.ts). The primary action\n // anchors to the brand primary; deny is a neutral tinted button. Consumers who\n // themed these (or set config.approval.* color overrides) still win.\n approval: {\n requested: {\n background: 'semantic.colors.surface',\n border: 'semantic.colors.border',\n text: 'palette.colors.gray.900',\n shadow: '0 1px 2px 0 rgba(11, 11, 11, 0.06), 0 2px 8px 0 rgba(11, 11, 11, 0.04)',\n },\n approve: {\n background: 'semantic.colors.primary',\n foreground: 'semantic.colors.textInverse',\n borderRadius: 'palette.radius.md',\n padding: 'semantic.spacing.sm',\n },\n deny: {\n background: 'semantic.colors.container',\n foreground: 'semantic.colors.text',\n borderRadius: 'palette.radius.md',\n padding: 'semantic.spacing.sm',\n },\n },\n attachment: {\n image: {\n background: 'palette.colors.gray.100',\n border: 'palette.colors.gray.200',\n },\n },\n // Event-stream badge chips: 100-tone fill / dark text per family. tool/agent\n // keep their pre-token literals (#6b21a8 / #115e59), which sit at the 800\n // step of the canonical purple/teal ramps.\n eventStream: {\n badge: {\n flow: { background: 'palette.colors.success.100', foreground: 'palette.colors.success.700' },\n step: { background: 'palette.colors.primary.100', foreground: 'palette.colors.primary.700' },\n reasoning: { background: 'palette.colors.warning.100', foreground: 'palette.colors.warning.700' },\n tool: { background: 'palette.colors.purple.100', foreground: 'palette.colors.purple.800' },\n agent: { background: 'palette.colors.teal.100', foreground: 'palette.colors.teal.800' },\n error: { background: 'palette.colors.error.100', foreground: 'palette.colors.error.700' },\n default: { background: 'palette.colors.gray.100', foreground: 'palette.colors.gray.600' },\n },\n },\n scrollToBottom: {\n background: 'components.button.primary.background',\n foreground: 'components.button.primary.foreground',\n border: 'semantic.colors.primary',\n size: '40px',\n borderRadius: 'palette.radius.full',\n shadow: 'palette.shadows.sm',\n padding: '0.5rem 0.875rem',\n gap: '0.5rem',\n fontSize: '0.875rem',\n iconSize: '14px',\n },\n artifact: {\n pane: {\n background: 'semantic.colors.container',\n toolbarBackground: 'semantic.colors.container',\n },\n },\n};\n\n/** Shared defaults with a small opt-in V5 overlay. */\nconst DEFAULT_PALETTE_GRAY_V4 = DEFAULT_PALETTE_BASE.colors.gray;\nconst DEFAULT_PALETTE_GRAY_V5 = {\n 50: '#fafafa', 100: '#f5f5f5', 200: '#e5e5e5', 300: '#d4d4d4',\n 400: '#a3a3a3', 500: '#737373', 600: '#525252', 700: '#404040',\n 800: '#262626', 900: '#171717', 950: '#0a0a0a',\n};\n\nexport const DEFAULT_PALETTE_V4 = {\n ...DEFAULT_PALETTE_BASE,\n colors: { ...DEFAULT_PALETTE_BASE.colors, gray: DEFAULT_PALETTE_GRAY_V4 },\n};\nexport const DEFAULT_PALETTE_V5 = {\n ...DEFAULT_PALETTE_BASE,\n colors: { ...DEFAULT_PALETTE_BASE.colors, gray: DEFAULT_PALETTE_GRAY_V5 },\n radius: { none: '0px', sm: '4px', md: '8px', lg: '12px', xl: '16px', '2xl': '24px', full: '9999px' },\n};\nexport const DEFAULT_PALETTE = DEFAULT_PALETTE_V4;\n\nexport const DEFAULT_SEMANTIC_V4 = DEFAULT_SEMANTIC_BASE;\nexport const DEFAULT_SEMANTIC_V5: SemanticTokens = {\n ...DEFAULT_SEMANTIC_BASE,\n colors: {\n ...DEFAULT_SEMANTIC_BASE.colors,\n surface: '#ffffff', background: '#ffffff', container: 'semantic.colors.surface',\n textInverse: '#ffffff',\n },\n typography: { ...DEFAULT_SEMANTIC_BASE.typography, fontSize: '14px', lineHeight: '1.5' },\n};\nexport const DEFAULT_SEMANTIC = DEFAULT_SEMANTIC_V4;\n\nexport const DEFAULT_COMPONENTS_V4 = DEFAULT_COMPONENTS_BASE;\nexport const DEFAULT_COMPONENTS_V5: ComponentTokens = {\n ...DEFAULT_COMPONENTS_BASE,\n scrollToBottom: {\n ...DEFAULT_COMPONENTS_BASE.scrollToBottom,\n background: 'semantic.colors.surface',\n foreground: 'semantic.colors.text',\n border: 'semantic.colors.border',\n size: '32px',\n },\n messageActions: {\n background: 'transparent',\n border: 'none',\n hoverBackground: 'components.button.ghost.hoverBackground',\n hoverForeground: 'semantic.colors.text',\n borderRadius: 'palette.radius.md',\n },\n launcher: CIRCLE_LAUNCHER_TOKENS,\n activity: {\n rowHeight: \"32px\", labelSize: \"13px\", iconSize: \"16px\", indent: \"0px\",\n transcriptGap: \"0px\", responseGap: \"12px\",\n groupIndent: \"16px\", groupGap: \"2px\", groupPadding: \"2px 0\",\n bodyPadding: \"4px 0\", bodyFontWeight: \"400\", sectionGap: \"8px\", bodySurface: \"transparent\",\n },\n toolBubble: { shadow: \"none\" },\n reasoningBubble: { shadow: \"none\" },\n input: { ...DEFAULT_COMPONENTS_BASE.input, borderRadius: 'palette.radius.full' },\n introCard: { ...DEFAULT_COMPONENTS_BASE.introCard, title: { fontSize: '22px', fontWeight: '500' } },\n suggestion: {\n chip: { ...DEFAULT_COMPONENTS_BASE.suggestion!.chip, fontWeight: '400' },\n card: { ...DEFAULT_COMPONENTS_BASE.suggestion!.card, fontWeight: '400' },\n list: { ...DEFAULT_COMPONENTS_BASE.suggestion!.list, fontWeight: '400' },\n },\n panel: {\n ...DEFAULT_COMPONENTS_BASE.panel,\n width: 'min(400px, calc(100vw - 24px))',\n height: 'min(704px, calc(100dvh - 104px))',\n borderRadius: 'palette.radius.xl',\n },\n header: {\n ...DEFAULT_COMPONENTS_BASE.header,\n background: 'semantic.colors.container', foreground: 'semantic.colors.text',\n padding: '8px 8px 8px 16px', minimalPadding: '8px 8px 8px 16px',\n minHeight: '48px', borderBottom: 'none',\n iconBackground: 'transparent', iconForeground: 'semantic.colors.text', iconScale: '1', iconPadding: 'auto',\n controlSize: '28px', controlIconSize: '16px', controlStrokeWidth: '1.5',\n actionIconForeground: 'semantic.colors.textMuted',\n controlBorderRadius: '8px',\n controlHoverBackground: 'color-mix(in srgb, var(--persona-text) 8%, transparent)',\n controlHoverForeground: 'semantic.colors.text',\n controlFocusOutline: '2px solid color-mix(in srgb, var(--persona-text) 50%, transparent)',\n title: { fontSize: '14px', fontWeight: '500', lineHeight: '1.5' },\n },\n message: {\n ...DEFAULT_COMPONENTS_BASE.message,\n gap: '20px', fullscreenGap: '28px', topFadeHeight: '18px',\n user: {\n ...DEFAULT_COMPONENTS_BASE.message.user,\n background: 'palette.colors.gray.100', text: 'semantic.colors.text',\n borderRadius: 'palette.radius.xl', shadow: 'none', padding: '8px 14px',\n fontSize: '14px', lineHeight: '1.5',\n },\n assistant: {\n ...DEFAULT_COMPONENTS_BASE.message.assistant,\n background: 'transparent', border: 'transparent', borderWidth: '0px',\n borderRadius: '0px', shadow: 'none', padding: '0px',\n fontSize: '14px', lineHeight: '1.55',\n },\n },\n artifact: {\n ...DEFAULT_COMPONENTS_BASE.artifact,\n card: {\n background: 'semantic.colors.surface',\n border: '1px solid var(--persona-border)',\n borderRadius: 'palette.radius.lg',\n hoverBackground: 'components.button.ghost.hoverBackground',\n hoverBorderColor: 'semantic.colors.border',\n },\n inline: {\n background: 'semantic.colors.surface',\n border: '1px solid var(--persona-border)',\n borderRadius: 'palette.radius.lg',\n chromeBackground: 'semantic.colors.surface',\n chromeBorder: 'semantic.colors.border',\n titleColor: 'semantic.colors.text',\n mutedColor: 'semantic.colors.textMuted',\n },\n },\n composer: {\n ...DEFAULT_COMPONENTS_BASE.composer,\n padding: '8px', fontSize: '15px', lineHeight: '1.5', controlSize: '32px', controlIconSize: '20px',\n expandedPadding: '12px 16px', expandedBorderRadius: '24px',\n sendIconSize: '18px', sendButtonRadius: '9999px', footerBorder: 'none',\n overflowMenu: { borderRadius: '12px' },\n overlayBand: 'linear-gradient(to bottom, transparent, var(--persona-container) 24px)',\n focusBorderColor: 'color-mix(in srgb, var(--persona-text) 28%, var(--persona-border))',\n focusRing: '1px solid color-mix(in srgb, var(--persona-text) 12%, transparent)',\n },\n};\nexport const DEFAULT_COMPONENTS = DEFAULT_COMPONENTS_V4;\n\nexport type ThemeDefaultsVersion = 'v4' | 'v5';\n\nexport const resolveThemeDefaultsVersion = (future?: { v5Defaults?: boolean }): ThemeDefaultsVersion =>\n resolveDefaultsVersion({ future });\n\nexport const resolveThemeDefaults = (future?: { v5Defaults?: boolean }) => {\n const version = resolveThemeDefaultsVersion(future);\n return version === 'v5'\n ? { palette: DEFAULT_PALETTE_V5, semantic: DEFAULT_SEMANTIC_V5, components: DEFAULT_COMPONENTS_V5 }\n : { palette: DEFAULT_PALETTE_V4, semantic: DEFAULT_SEMANTIC_V4, components: DEFAULT_COMPONENTS_V4 };\n};\n\nexport function resolveTokenValue(theme: PersonaTheme, path: string): string | undefined {\n if (\n !path.startsWith('palette.') &&\n !path.startsWith('semantic.') &&\n !path.startsWith('components.')\n ) {\n return path;\n }\n\n const parts = path.split('.');\n let current: any = theme;\n\n for (const part of parts) {\n if (current === undefined || current === null) {\n return undefined;\n }\n current = current[part];\n }\n\n if (\n typeof current === 'string' &&\n (current.startsWith('palette.') ||\n current.startsWith('semantic.') ||\n current.startsWith('components.'))\n ) {\n return resolveTokenValue(theme, current);\n }\n\n return current;\n}\n\nexport function resolveTokens(theme: PersonaTheme): Record<string, ResolvedToken> {\n const resolved: Record<string, ResolvedToken> = {};\n\n function resolveObject(obj: any, prefix: string) {\n for (const [key, value] of Object.entries(obj)) {\n const path = `${prefix}.${key}`;\n\n if (typeof value === 'string') {\n const resolvedValue = resolveTokenValue(theme, value);\n if (resolvedValue !== undefined) {\n resolved[path] = {\n path,\n value: resolvedValue,\n type:\n prefix.includes('color')\n ? 'color'\n : prefix.includes('spacing')\n ? 'spacing'\n : prefix.includes('typography')\n ? 'typography'\n : prefix.includes('shadow')\n ? 'shadow'\n : prefix.includes('border')\n ? 'border'\n : 'color',\n };\n }\n } else if (typeof value === 'object' && value !== null) {\n resolveObject(value, path);\n }\n }\n }\n\n resolveObject(theme.palette, 'palette');\n resolveObject(theme.semantic, 'semantic');\n resolveObject(theme.components, 'components');\n\n return resolved;\n}\n\nexport function validateTheme(theme: Partial<PersonaTheme>): ThemeValidationResult {\n const errors: ThemeValidationError[] = [];\n const warnings: ThemeValidationError[] = [];\n\n if (!theme.palette) {\n errors.push({\n path: 'palette',\n message: 'Theme must include a palette',\n severity: 'error',\n });\n }\n\n if (!theme.semantic) {\n warnings.push({\n path: 'semantic',\n message: 'No semantic tokens defined - defaults will be used',\n severity: 'warning',\n });\n }\n\n if (!theme.components) {\n warnings.push({\n path: 'components',\n message: 'No component tokens defined - defaults will be used',\n severity: 'warning',\n });\n }\n\n return {\n valid: errors.length === 0,\n errors,\n warnings,\n };\n}\n\nfunction mergeRecords(\n base: Record<string, unknown>,\n override: Record<string, unknown>\n): Record<string, unknown> {\n const result = { ...base };\n for (const [key, value] of Object.entries(override)) {\n const existing = result[key];\n if (existing && typeof existing === 'object' && !Array.isArray(existing) &&\n value && typeof value === 'object' && !Array.isArray(value)) {\n result[key] = mergeRecords(\n existing as Record<string, unknown>,\n value as Record<string, unknown>\n );\n } else {\n result[key] = value;\n }\n }\n return result;\n}\n\nexport function createTheme(\n userConfig?: DeepPartial<PersonaTheme>,\n options: CreateThemeOptions = {}\n): PersonaTheme {\n const baseTheme = resolveThemeDefaults(options.future) as PersonaTheme;\n const components = userConfig?.components;\n\n let theme: PersonaTheme = {\n palette: {\n ...baseTheme.palette,\n ...userConfig?.palette,\n colors: {\n ...baseTheme.palette.colors,\n ...userConfig?.palette?.colors,\n },\n spacing: {\n ...baseTheme.palette.spacing,\n ...userConfig?.palette?.spacing,\n },\n typography: {\n ...baseTheme.palette.typography,\n ...userConfig?.palette?.typography,\n },\n shadows: {\n ...baseTheme.palette.shadows,\n ...userConfig?.palette?.shadows,\n },\n borders: {\n ...baseTheme.palette.borders,\n ...userConfig?.palette?.borders,\n },\n radius: {\n ...baseTheme.palette.radius,\n ...userConfig?.palette?.radius,\n },\n },\n semantic: {\n ...baseTheme.semantic,\n ...userConfig?.semantic,\n colors: {\n ...baseTheme.semantic.colors,\n ...userConfig?.semantic?.colors,\n interactive: {\n ...baseTheme.semantic.colors.interactive,\n ...userConfig?.semantic?.colors?.interactive,\n },\n feedback: {\n ...baseTheme.semantic.colors.feedback,\n ...userConfig?.semantic?.colors?.feedback,\n },\n },\n spacing: {\n ...baseTheme.semantic.spacing,\n ...userConfig?.semantic?.spacing,\n },\n typography: {\n ...baseTheme.semantic.typography,\n ...userConfig?.semantic?.typography,\n },\n },\n components: components ? mergeRecords(\n baseTheme.components as unknown as Record<string, unknown>,\n components as Record<string, unknown>\n ) as unknown as ComponentTokens : baseTheme.components,\n } as PersonaTheme;\n\n // Project shared activity aliases without mutating the versioned defaults.\n const activity = components?.activity;\n for (const kind of ['toolBubble', 'reasoningBubble'] as const) {\n const tokens = theme.components[kind] = { ...theme.components[kind] };\n for (const field of ['rowHeight', 'labelSize', 'iconSize', 'indent', 'bodySurface'] as const) {\n if (activity?.[field] !== undefined && (field !== 'bodySurface' || components?.[kind]?.bodySurface === undefined)) tokens[field] = activity[field];\n }\n }\n const legacySurface = components?.collapsibleWidget?.surface;\n // V4 keeps the historical shared surface. V5 separates activity from code\n // widgets; callers use activity.bodySurface (or the per-kind override).\n if (resolveDefaultsVersion(options) === 'v4' && legacySurface !== undefined && activity?.bodySurface === undefined) {\n theme.components.activity = { ...theme.components.activity, bodySurface: legacySurface };\n }\n\n // Shared header padding also supplies minimal padding unless authored separately.\n const suppliedHeader = components?.header;\n if (suppliedHeader?.padding !== undefined && suppliedHeader.minimalPadding === undefined) {\n theme.components.header.minimalPadding = theme.components.header.padding;\n }\n\n const suppliedComposer = components?.composer;\n // An input-only override leaves the composer's defaults shared after merging.\n // Derive expanded values on a fresh object so a brand cannot mutate defaults\n // for a sibling instance or survive removal from the current configuration.\n theme.components.composer = { ...theme.components.composer };\n if (suppliedComposer?.padding !== undefined && suppliedComposer.expandedPadding === undefined) {\n theme.components.composer.expandedPadding = suppliedComposer.padding;\n }\n if (components?.input?.borderRadius !== undefined && suppliedComposer?.expandedBorderRadius === undefined) {\n theme.components.composer.expandedBorderRadius = components.input.borderRadius;\n }\n\n const suppliedMessage = components?.message;\n if (suppliedMessage?.gap !== undefined && suppliedMessage.fullscreenGap === undefined) {\n theme.components.message.fullscreenGap = theme.components.message.gap;\n }\n\n if (options.validate !== false) {\n const validation = validateTheme(theme);\n if (!validation.valid) {\n throw new Error(\n `Theme validation failed: ${validation.errors.map((e) => e.message).join(', ')}`\n );\n }\n }\n\n if (options.plugins) {\n for (const plugin of options.plugins) {\n theme = plugin.transform(theme);\n }\n }\n\n return theme;\n}\n\n/** Coerce a unitless \"0\" to \"0px\" for vars consumed inside length calc()s. */\nconst zeroLength = (value: string): string => (value.trim() === '0' ? '0px' : value);\n\nconst V = '--persona-';\n\n/**\n * WCAG relative luminance of a hex (3/4/6/8 digit) or rgb()/rgba() color.\n * Returns undefined when the value is not parseable, so callers can fall back.\n */\nconst relativeLuminance = (color: string | undefined): number | undefined => {\n if (!color) return undefined;\n const value = color.trim().toLowerCase();\n let channels: number[] | undefined;\n\n if (value.charCodeAt(0) === 35 /* '#' */) {\n const digits = value.slice(1);\n if (!/^[0-9a-f]+$/.test(digits)) return undefined;\n if (digits.length === 3 || digits.length === 4) {\n channels = [0, 1, 2].map((i) => parseInt(digits[i] + digits[i], 16));\n } else if (digits.length === 6 || digits.length === 8) {\n channels = [0, 2, 4].map((i) => parseInt(digits.slice(i, i + 2), 16));\n }\n } else {\n const match = value.match(/^rgba?\\(([^)]+)\\)$/);\n if (match) {\n const parts = match[1].split(/[,/\\s]+/).filter(Boolean);\n if (parts.length >= 3) {\n channels = parts.slice(0, 3).map((raw) => {\n const pct = raw.endsWith('%');\n const n = parseFloat(pct ? raw.slice(0, -1) : raw);\n return pct ? (n / 100) * 255 : n;\n });\n }\n }\n }\n\n if (!channels || channels.some((c) => !Number.isFinite(c))) return undefined;\n const [r, g, b] = channels.map((c) => {\n const v = Math.max(0, Math.min(255, c)) / 255;\n return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);\n });\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n};\n\n/** Below the WCAG white/black crossover luminance, white text reads better. */\nconst DARK_SURFACE_LUMINANCE = 0.179;\n\n/**\n * Each row: [aliasSuffix, ...sources]. A source starting with '=' is a\n * literal; anything else is a cssVars lookup by suffix. First defined wins;\n * rows with no defined source emit nothing. Row order is significant.\n */\ntype AliasRow = [string, ...string[]];\n\nconst emitAliases = (cssVars: Record<string, string>, rows: AliasRow[]): void => {\n for (const [alias, ...sources] of rows) {\n let value: string | undefined;\n for (const s of sources) {\n value = s.charCodeAt(0) === 61 /* '=' */ ? s.slice(1) : cssVars[V + s];\n if (value !== undefined) break;\n }\n if (value !== undefined) cssVars[V + alias] = value;\n }\n};\n\nconst COMMON_ALIASES: AliasRow[] = [\n ['primary', 'semantic-colors-primary', 'palette-colors-primary-500'],\n ['secondary', 'semantic-colors-secondary', 'palette-colors-secondary-500'],\n ['accent', 'semantic-colors-accent', 'palette-colors-accent-500'],\n ['surface', 'semantic-colors-surface', 'palette-colors-gray-50'],\n ['background', 'semantic-colors-background', 'palette-colors-gray-50'],\n ['container', 'semantic-colors-container', 'palette-colors-gray-100'],\n ['text', 'semantic-colors-text', 'palette-colors-gray-900'],\n ['text-muted', 'semantic-colors-textMuted', 'palette-colors-gray-500'],\n ['text-inverse', 'semantic-colors-textInverse', 'palette-colors-gray-50'],\n ['border', 'semantic-colors-border', 'palette-colors-gray-200'],\n ['divider', 'semantic-colors-divider', 'palette-colors-gray-200'],\n ['muted', 'text-muted'],\n ['font-family', 'semantic-typography-fontFamily', 'palette-typography-fontFamily-sans'],\n ['font-size', 'semantic-typography-fontSize', 'palette-typography-fontSize-base'],\n ['font-weight', 'semantic-typography-fontWeight', 'palette-typography-fontWeight-normal'],\n ['line-height', 'semantic-typography-lineHeight', 'palette-typography-lineHeight-normal'],\n ['input-font-family', 'font-family'],\n ['input-font-weight', 'font-weight'],\n ['radius-sm', 'palette-radius-sm', '=0.125rem'],\n ['radius-md', 'palette-radius-md', '=0.375rem'],\n ['radius-lg', 'palette-radius-lg', '=0.5rem'],\n ['radius-xl', 'palette-radius-xl', '=0.75rem'],\n ['radius-full', 'palette-radius-full', '=9999px'],\n ['launcher-radius', 'components-launcher-borderRadius', 'palette-radius-full', '=9999px'],\n ['launcher-bg', 'components-launcher-background', 'surface'],\n ['launcher-fg', 'components-launcher-foreground', 'primary'],\n];\n\n// The collapsed launcher needs canonical tokens and shared text/launcher aliases,\n// but none of the panel, artifact, or message compatibility aliases.\nconst canonicalThemeVariables = (theme: PersonaTheme): Record<string, string> => {\n const resolved = resolveTokens(theme);\n const cssVars: Record<string, string> = {};\n\n for (const [path, token] of Object.entries(resolved)) {\n const varName = path.replace(/\\./g, '-');\n cssVars[`--persona-${varName}`] = token.value;\n }\n\n return cssVars;\n};\n\nconst emitLauncherMuted = (cssVars: Record<string, string>): void => {\n // Subtitle keeps the shared muted tone while the foreground is stock (it\n // resolves to primary); a custom foreground washes to 70% so both pill\n // text lines recolor together. Compared by resolved value, not key\n // presence: DEFAULT_COMPONENTS materializes launcher.foreground into\n // every theme.\n const launcherFg = cssVars['--persona-components-launcher-foreground'];\n cssVars['--persona-launcher-fg-muted'] =\n launcherFg && launcherFg !== cssVars['--persona-primary']\n ? `color-mix(in srgb, ${launcherFg} 70%, transparent)`\n : cssVars['--persona-muted'];\n\n};\n\nconst resolveHeaderIconPadding = (cssVars: Record<string, string>): void => {\n // Resolve after aliases so palette references and dark/brand overrides count.\n // CSS variables with runtime-dependent colors can use explicit iconPadding.\n const iconPadding = cssVars['--persona-components-header-iconPadding'];\n if (iconPadding === 'auto') {\n const background = (cssVars['--persona-components-header-iconBackground'] ?? cssVars['--persona-primary']).trim().toLowerCase();\n const channels = background.match(/^(?:rgba?|hsla?)\\(([^)]+)\\)$/)?.[1].split(/[,\\s/]+/).filter(Boolean);\n const transparent = background === 'transparent' ||\n /^#(?:[\\da-f]{3}0|[\\da-f]{6}00)$/.test(background) ||\n (channels?.length === 4 && parseFloat(channels[3]) === 0);\n cssVars['--persona-components-header-iconPadding'] = transparent ? '0px' : '6px';\n }\n\n};\n\nexport function launcherThemeToCssVariables(theme: PersonaTheme): Record<string, string> {\n const cssVars = canonicalThemeVariables(theme);\n emitAliases(cssVars, COMMON_ALIASES);\n emitLauncherMuted(cssVars);\n emitAliases(cssVars, [\n ['launcher-border', 'components-launcher-border', 'border'],\n ['launcher-shadow', 'components-launcher-shadow', '=0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)'],\n ]);\n resolveHeaderIconPadding(cssVars);\n return cssVars;\n}\n\nexport function themeToCssVariables(theme: PersonaTheme): Record<string, string> {\n const cssVars = canonicalThemeVariables(theme);\n\n emitAliases(cssVars, COMMON_ALIASES);\n emitAliases(cssVars, [\n ['ask-sheet-bg', 'components-askUserQuestion-sheet-background'],\n ['ask-sheet-border', 'components-askUserQuestion-sheet-border'],\n ['ask-sheet-shadow', 'components-askUserQuestion-sheet-shadow'],\n ['ask-pill-bg', 'components-askUserQuestion-pill-background'],\n ['ask-pill-fg', 'components-askUserQuestion-pill-foreground'],\n ['ask-pill-radius', 'components-askUserQuestion-pill-borderRadius'],\n ['ask-pill-bg-selected', 'components-askUserQuestion-pill-selectedBackground'],\n ['ask-pill-fg-selected', 'components-askUserQuestion-pill-selectedForeground'],\n ['ask-input-bg', 'components-askUserQuestion-customInput-background'],\n ['voice-recording-indicator', 'components-voice-recording-indicator', 'palette-colors-error-500'],\n ['voice-recording-bg', 'components-voice-recording-background', 'palette-colors-error-50'],\n ['voice-processing-icon', 'components-voice-processing-icon', 'palette-colors-primary-500'],\n ['voice-speaking-icon', 'components-voice-speaking-icon', 'palette-colors-success-500'],\n ['approval-bg', 'components-approval-requested-background', 'surface'],\n ['approval-border', 'components-approval-requested-border', 'border'],\n ['approval-text', 'components-approval-requested-text', 'palette-colors-gray-900'],\n ['approval-shadow', 'components-approval-requested-shadow', '=0 1px 2px 0 rgba(11, 11, 11, 0.06), 0 2px 8px 0 rgba(11, 11, 11, 0.04)'],\n ['approval-approve-bg', 'components-approval-approve-background', 'button-primary-bg'],\n ['approval-deny-bg', 'components-approval-deny-background', 'container'],\n ['attachment-image-bg', 'components-attachment-image-background', 'palette-colors-gray-100'],\n ['attachment-image-border', 'components-attachment-image-border', 'palette-colors-gray-200'],\n ]);\n emitLauncherMuted(cssVars);\n\n emitAliases(cssVars, [\n ['launcher-border', 'components-launcher-border', 'border'],\n ['button-primary-bg', 'components-button-primary-background', 'primary'],\n ['button-primary-fg', 'components-button-primary-foreground', 'text-inverse'],\n ['button-radius', 'components-button-primary-borderRadius', 'palette-radius-full', '=9999px'],\n // Stop-state send button. No fallback source: widget.css carries the idle\n // appearance in its var() fallbacks, so an unset token must stay undefined.\n ['button-stop-bg', 'components-button-stop-background'],\n ['button-stop-fg', 'components-button-stop-foreground'],\n ]);\n\n // Ghost variant: transparent, neutral-foreground icon buttons (the composer's\n // attachment + mention affordances). Wired to `components.button.ghost.*`.\n emitAliases(cssVars, [\n ['button-ghost-bg', 'components-button-ghost-background', '=transparent'],\n ['button-ghost-fg', 'components-button-ghost-foreground', 'text'],\n ['button-ghost-radius', 'components-button-ghost-borderRadius', 'radius-md', '=0.375rem'],\n ['button-ghost-hover-bg', 'components-button-ghost-hoverBackground', '=rgba(0, 0, 0, 0.05)'],\n ['panel-radius', 'components-panel-borderRadius', 'radius-xl', '=0.75rem'],\n ]);\n\n cssVars['--persona-panel-border'] =\n cssVars['--persona-components-panel-border'] ?? `1px solid ${cssVars['--persona-border']}`;\n\n emitAliases(cssVars, [\n ['panel-shadow', 'components-panel-shadow', 'palette-shadows-xl', '=0 25px 50px -12px rgba(0, 0, 0, 0.25)'],\n ]);\n\n cssVars['--persona-panel-inset'] =\n cssVars['--persona-components-panel-inset'] ?? DEFAULT_PANEL_INSET;\n cssVars['--persona-panel-canvas-bg'] =\n cssVars['--persona-components-panel-canvasBackground'] ?? DEFAULT_PANEL_CANVAS_BACKGROUND;\n\n emitAliases(cssVars, [\n ['launcher-shadow', 'components-launcher-shadow', '=0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)'],\n ['input-radius', 'components-input-borderRadius', 'radius-lg', '=0.5rem'],\n ['message-user-radius', 'components-message-user-borderRadius', 'radius-lg', '=0.5rem'],\n ['message-assistant-radius', 'components-message-assistant-borderRadius', 'radius-lg', '=0.5rem'],\n ]);\n\n // Preserve the existing truthy guards and raw values (including references).\n // Nullish aliases and zero-length normalization stay on their own paths.\n const emitTruthy = (source: object | undefined, prefix: string, rows: readonly (readonly [string, string, boolean?])[], sourcePrefix = ''): void => {\n if (!source) return;\n for (const [key, alias, resolve] of rows) {\n const value = (source as Record<string, string | undefined>)[sourcePrefix + key];\n if (value) cssVars[`--persona-${prefix}${alias}`] = resolve ? resolveTokenValue(theme, value) ?? value : value;\n }\n };\n\n // Component-level color overrides: these map component tokens to\n // dedicated CSS variables that the widget CSS reads for individual elements.\n emitAliases(cssVars, [\n ['header-bg', 'components-header-background', 'surface'],\n ]);\n\n // The background/foreground pair anchors every other header color: unset\n // text and border keys mix the two rather than falling back to page chrome.\n const headerBg = cssVars['--persona-header-bg'];\n const headerFg = cssVars['--persona-components-header-foreground'];\n const headerMutedFg = headerFg ? `color-mix(in srgb, ${headerFg} 72%, ${headerBg})` : undefined;\n cssVars['--persona-header-border'] =\n cssVars['--persona-components-header-border'] ??\n (headerFg ? `color-mix(in srgb, ${headerFg} 14%, ${headerBg})` : undefined) ??\n cssVars['--persona-divider'];\n\n emitAliases(cssVars, [\n ['header-icon-bg', 'components-header-iconBackground', 'primary'],\n ['header-icon-fg', 'components-header-iconForeground', 'text-inverse'],\n ]);\n\n resolveHeaderIconPadding(cssVars);\n\n // `title.color` / `subtitle.color` supersede the legacy *Foreground tokens.\n cssVars['--persona-header-title-fg'] =\n cssVars['--persona-components-header-title-color'] ??\n cssVars['--persona-components-header-titleForeground'] ??\n headerFg ??\n cssVars['--persona-primary'];\n cssVars['--persona-header-subtitle-fg'] =\n cssVars['--persona-components-header-subtitle-color'] ??\n cssVars['--persona-components-header-subtitleForeground'] ??\n headerMutedFg ??\n cssVars['--persona-text-muted'];\n cssVars['--persona-header-action-icon-fg'] =\n cssVars['--persona-components-header-actionIconForeground'] ??\n headerMutedFg ??\n cssVars['--persona-muted'];\n\n // Unified header control box. Every header icon button reads these two from\n // the stylesheet; per-control config keys stay inline and win. The third\n // control token, `header.controlStrokeWidth`, needs no alias: widget.css\n // reads its auto-emitted `--persona-components-header-controlStrokeWidth`\n // directly and carries the 1.5 default in the var() fallback.\n emitAliases(cssVars, [\n ['header-control-size', 'components-header-controlSize', '=32px'],\n ['header-control-icon-size', 'components-header-controlIconSize', '=16px'],\n ]);\n\n // Conditional aliases retain the consuming stylesheet's fallback when unset.\n emitTruthy(theme.components?.header, 'header-', [\n ['shadow', 'shadow'],\n ['borderBottom', 'border-bottom'],\n ['minHeight', 'min-height'],\n ]);\n emitTruthy(cssVars, 'history-rail-header-', [\n ['background', 'bg'],\n ['border', 'border'],\n ['minHeight', 'min-height'],\n ], '--persona-components-history-railHeader-');\n\n // Floating (overlay-collapsed) rail. Same conditional rule: the host's\n // inline styles carry every default in their var() fallback.\n emitTruthy(cssVars, 'history-overlay-', [\n ['margin', 'margin'],\n ['borderRadius', 'radius'],\n ['shadow', 'shadow'],\n ['background', 'bg'],\n ], '--persona-components-history-overlay-');\n\n // Row overflow menu. Same conditional rule: the chunk's CSS carries the\n // elevated color-mix default in its var() fallback.\n emitTruthy(cssVars, 'history-menu-', [\n ['background', 'bg'],\n ['borderRadius', 'radius'],\n ], '--persona-components-history-menu-');\n // Messages enter/exit motion. Read straight off the theme: durations are\n // authored as bare millisecond NUMBERS, and resolveTokens collects only\n // string leaves, so these never reach the flattened vars. A unitless value\n // gains \"ms\" for the CSS animation shorthand; 0 emits \"0ms\" (leg disabled).\n const historyMotion = theme.components?.history?.motion;\n if (historyMotion) {\n const asTime = (value: number | string | undefined): string | undefined => {\n if (value === undefined) return undefined;\n const s = String(value).trim();\n return /^\\d+(\\.\\d+)?$/.test(s) ? `${s}ms` : s;\n };\n const enterMs = asTime(historyMotion.enterDurationMs);\n if (enterMs !== undefined) cssVars['--persona-history-enter-ms'] = enterMs;\n const exitMs = asTime(historyMotion.exitDurationMs);\n if (exitMs !== undefined) cssVars['--persona-history-exit-ms'] = exitMs;\n if (historyMotion.enterEasing)\n cssVars['--persona-history-enter-easing'] = historyMotion.enterEasing;\n if (historyMotion.exitEasing)\n cssVars['--persona-history-exit-easing'] = historyMotion.exitEasing;\n }\n // Destructive action text. The chunk falls back to the light-surface\n // error-600; the built-in dark theme sets this to a passing lighter red.\n const historyDangerFg = cssVars['--persona-components-history-dangerForeground'];\n if (historyDangerFg) cssVars['--persona-history-danger-fg'] = historyDangerFg;\n // Confirmation dialog. The danger fill/label pair is always emitted so the\n // dialog follows the error palette; scrim and shadow stay conditional with\n // the dialog's inline fallbacks as the defaults.\n cssVars['--persona-danger'] =\n cssVars['--persona-components-history-confirm-dangerBackground'] ??\n cssVars['--persona-palette-colors-error-700'] ??\n '#b42318';\n cssVars['--persona-danger-fg'] =\n cssVars['--persona-components-history-confirm-dangerForeground'] ?? '#ffffff';\n for (const token of ['scrim', 'shadow'] as const) {\n const value = cssVars[`--persona-components-history-confirm-${token}`];\n if (value) cssVars[`--persona-history-confirm-${token}`] = value;\n }\n\n // Portaled control tooltip. Same conditional rule: widget.css carries the\n // built-in look in every var() fallback, so an unset token stays undefined.\n emitTruthy(cssVars, 'tooltip-', [\n ['background', 'background'],\n ['foreground', 'foreground'],\n ['hintForeground', 'hint-fg'],\n ['borderRadius', 'radius'],\n ['fontSize', 'font-size'],\n ['padding', 'padding'],\n ['maxWidth', 'max-width'],\n ['shadow', 'shadow'],\n ], '--persona-components-tooltip-');\n // Booleans never resolve into a token, so the arrow reads off the theme.\n if (theme.components?.tooltip?.arrow === false)\n cssVars['--persona-tooltip-arrow-display'] = 'none';\n\n // Keep badge defaults in CSS so an omitted badge border follows the pill,\n // and its colors follow semantic overrides without freezing resolved values.\n emitTruthy(cssVars, 'scroll-to-bottom-count-', [\n ['background', 'bg'],\n ['foreground', 'fg'],\n ['border', 'border'],\n ['borderRadius', 'radius'],\n ['size', 'size'],\n ['padding', 'padding'],\n ['fontSize', 'font-size'],\n ['fontWeight', 'font-weight'],\n ], '--persona-components-scrollToBottom-countBadge-');\n\n // V5 materializes message-action defaults in the theme; V4 retains the CSS\n // fallbacks. References follow ghost/semantic overrides in either scheme.\n emitTruthy(cssVars, 'message-action-', [\n ['background', 'bg'],\n ['border', 'border'],\n ['hoverBackground', 'hover-bg'],\n ['hoverForeground', 'hover-fg'],\n ['borderRadius', 'radius'],\n ], '--persona-components-messageActions-');\n\n // Intro card aliases: short names the panel inline-styles read directly.\n // The full-path `--persona-components-introCard-*` variables auto-emit above.\n // Default is flat (transparent, no shadow): the greeting renders as plain\n // text on the transcript background; set introCard tokens for a card look.\n emitAliases(cssVars, [\n ['intro-card-bg', 'components-introCard-background', '=transparent'],\n ['intro-card-radius', 'components-introCard-borderRadius', '=1rem'],\n ]);\n\n // Flat cards (transparent background, no shadow) drop the horizontal\n // component of the stock padding so the welcome text shares the content\n // column's left edge instead of carrying an invisible card inset. Compared\n // by resolved value, not key presence: DEFAULT_COMPONENTS materializes the\n // introCard tokens into every theme. A non-stock padding is emitted as-is;\n // '1.5rem 1.5rem' forces the symmetric inset on a flat card.\n const introBg = cssVars['--persona-components-introCard-background'];\n const introShadow = cssVars['--persona-components-introCard-shadow'];\n const introCardFlat =\n (!introBg || introBg === 'transparent' || introBg === 'none') &&\n (!introShadow || introShadow === 'none');\n const introPadding =\n cssVars['--persona-components-introCard-padding'] ?? '1.5rem';\n cssVars['--persona-intro-card-padding'] =\n introCardFlat && introPadding === '1.5rem' ? '1.5rem 0' : introPadding;\n\n emitAliases(cssVars, [\n ['intro-card-shadow', 'components-introCard-shadow', '=none'],\n ['intro-card-border', 'components-introCard-border', '=none'],\n ['input-background', 'components-input-background', 'surface'],\n ['input-placeholder', 'components-input-placeholder', 'text-muted'],\n ['input-backdrop-filter', 'components-input-backdropFilter', '=none'],\n ['message-user-bg', 'components-message-user-background', 'accent'],\n ['message-user-text', 'components-message-user-text', 'text-inverse'],\n ['message-user-shadow', 'components-message-user-shadow', '=0 5px 15px rgba(15, 23, 42, 0.08)'],\n ['message-assistant-bg', 'components-message-assistant-background', 'surface'],\n ['message-assistant-text', 'components-message-assistant-text', 'text'],\n ['message-assistant-border', 'components-message-assistant-border', 'border'],\n ['message-assistant-shadow', 'components-message-assistant-shadow', '=0 1px 2px 0 rgb(0 0 0 / 0.05)'],\n ['scroll-to-bottom-bg', 'components-scrollToBottom-background', 'button-primary-bg', 'accent'],\n ['scroll-to-bottom-fg', 'components-scrollToBottom-foreground', 'button-primary-fg', 'text-inverse'],\n ['scroll-to-bottom-border', 'components-scrollToBottom-border', 'primary'],\n ['scroll-to-bottom-size', 'components-scrollToBottom-size', '=40px'],\n ['scroll-to-bottom-radius', 'components-scrollToBottom-borderRadius', 'button-radius', 'radius-full', '=9999px'],\n ['scroll-to-bottom-shadow', 'components-scrollToBottom-shadow', 'palette-shadows-sm', '=0 1px 2px 0 rgb(0 0 0 / 0.05)'],\n ['scroll-to-bottom-padding', 'components-scrollToBottom-padding', '=0.5rem 0.875rem'],\n ['scroll-to-bottom-gap', 'components-scrollToBottom-gap', '=0.5rem'],\n ['scroll-to-bottom-font-size', 'components-scrollToBottom-fontSize', 'palette-typography-fontSize-sm', '=0.875rem'],\n ['scroll-to-bottom-icon-size', 'components-scrollToBottom-iconSize', '=14px'],\n // Event-stream badge chips. Materialized in every theme (light defaults in\n // DEFAULT_COMPONENTS, dark pairs in the built-in dark layer), so the\n // chip's inline var() refs always resolve inside a themed root and\n // re-resolve on scheme toggles; the literal terminals only cover unthemed\n // direct mounts.\n ['event-badge-flow-bg', 'components-eventStream-badge-flow-background', '=#dcfce7'],\n ['event-badge-flow-fg', 'components-eventStream-badge-flow-foreground', '=#15803d'],\n ['event-badge-step-bg', 'components-eventStream-badge-step-background', '=#f5f5f5'],\n ['event-badge-step-fg', 'components-eventStream-badge-step-foreground', '=#0a0a0a'],\n ['event-badge-reasoning-bg', 'components-eventStream-badge-reasoning-background', '=#fef9c3'],\n ['event-badge-reasoning-fg', 'components-eventStream-badge-reasoning-foreground', '=#a16207'],\n ['event-badge-tool-bg', 'components-eventStream-badge-tool-background', '=#f3e8ff'],\n ['event-badge-tool-fg', 'components-eventStream-badge-tool-foreground', '=#6b21a8'],\n ['event-badge-agent-bg', 'components-eventStream-badge-agent-background', '=#ccfbf1'],\n ['event-badge-agent-fg', 'components-eventStream-badge-agent-foreground', '=#115e59'],\n ['event-badge-error-bg', 'components-eventStream-badge-error-background', '=#fee2e2'],\n ['event-badge-error-fg', 'components-eventStream-badge-error-foreground', '=#b91c1c'],\n ['event-badge-default-bg', 'components-eventStream-badge-default-background', '=#f3f4f6'],\n ['event-badge-default-fg', 'components-eventStream-badge-default-foreground', '=#4b5563'],\n ['tool-bubble-shadow', 'components-toolBubble-shadow', '=0 5px 15px rgba(15, 23, 42, 0.08)'],\n ['reasoning-bubble-shadow', 'components-reasoningBubble-shadow', '=0 5px 15px rgba(15, 23, 42, 0.08)'],\n ['composer-shadow', 'components-composer-shadow', '=none'],\n ]);\n\n // Composer spacing/type. Fallbacks reproduce the utility classes the form\n // used to carry (`px-4 py-3`, `gap-2`, `text-sm`) exactly.\n emitAliases(cssVars, [\n ['panel-background', 'components-panel-background', 'surface'],\n ['transcript-background', 'components-message-background', 'container'],\n ['transcript-top-fade-background', 'components-message-topFadeBackground', 'transcript-background'],\n ['composer-footer-background', 'components-composer-footerBackground', 'surface'],\n ['composer-footer-padding', 'components-composer-footerPadding', '=1rem 1.5rem'],\n ['composer-padding', 'components-composer-padding', '=0.75rem 1rem'],\n ['composer-gap', 'components-composer-gap', '=0.5rem'],\n ['composer-font-size', 'components-composer-fontSize', '=0.875rem'],\n ['composer-line-height', 'components-composer-lineHeight', '=1.25rem'],\n // Unified composer control box. Every icon control in the action row reads\n // these two from the stylesheet; per-control config keys stay inline and win.\n ['composer-control-size', 'components-composer-controlSize', '=40px'],\n ['composer-control-icon-size', 'components-composer-controlIconSize', '=24px'],\n // Motion: one timing pair + easing for every composer animation. A `0ms`\n // duration is a kill switch; reduced-motion is enforced in CSS on top.\n ['motion-duration-fast', 'components-motion-durationFast', '=120ms'],\n ['motion-duration-base', 'components-motion-durationBase', '=200ms'],\n ['motion-easing', 'components-motion-easing', '=cubic-bezier(0.2, 0, 0, 1)'],\n ['composer-border-color', 'components-composer-borderColor', 'border', '=#e5e7eb'],\n ['composer-overlay-band', 'components-composer-overlayBand', '=transparent'],\n // `components.composer.segmented.*`, `.modelPicker.*`, and `.overflowMenu.*`\n // get no short aliases: the rows cost gzip in the critical launcher bundle,\n // which never draws a composer. widget.css reads the auto-emitted full\n // paths, like introCard title/subtitle.\n ['scrollbar-thumb', 'components-scrollbar-thumb', 'border', '=#e5e7eb'],\n ['scrollbar-track', 'components-scrollbar-track', '=transparent'],\n ['md-inline-code-bg', 'components-markdown-inlineCode-background', 'container'],\n ['md-inline-code-color', 'components-markdown-inlineCode-foreground', 'text'],\n ['md-link-color', 'components-markdown-link-foreground', 'accent', '=#0f0f0f'],\n ]);\n\n emitTruthy(cssVars, 'md-', [\n ['h1-fontSize', 'h1-size'],\n ['h1-fontWeight', 'h1-weight'],\n ['h2-fontSize', 'h2-size'],\n ['h2-fontWeight', 'h2-weight'],\n ], '--persona-components-markdown-heading-');\n\n const mdProseFont = cssVars['--persona-components-markdown-prose-fontFamily'];\n if (mdProseFont && mdProseFont !== 'inherit') {\n cssVars['--persona-md-prose-font-family'] = mdProseFont;\n }\n\n // Markdown code block\n emitAliases(cssVars, [\n ['md-code-block-bg', 'components-markdown-codeBlock-background', 'container'],\n ['md-code-block-border-color', 'components-markdown-codeBlock-borderColor', 'border'],\n ['md-code-block-text-color', 'components-markdown-codeBlock-textColor', '=inherit'],\n ]);\n\n // Follows the palette radius so square-corner themes get square code blocks;\n // the 0.375rem fallback matches palette.radius.md's default.\n emitAliases(cssVars, [\n ['md-code-block-border-radius', 'components-markdown-codeBlock-borderRadius', 'radius-md', '=0.375rem'],\n ]);\n\n // Markdown table\n emitAliases(cssVars, [\n ['md-table-header-bg', 'components-markdown-table-headerBackground', 'container'],\n ['md-table-border-color', 'components-markdown-table-borderColor', 'border'],\n ]);\n\n // Markdown HR\n emitAliases(cssVars, [\n ['md-hr-color', 'components-markdown-hr-color', 'divider'],\n ]);\n\n // Markdown blockquote\n emitAliases(cssVars, [\n ['md-blockquote-border-color', 'components-markdown-blockquote-borderColor', 'palette-colors-gray-900'],\n ['md-blockquote-bg', 'components-markdown-blockquote-background', '=transparent'],\n ['md-blockquote-text-color', 'components-markdown-blockquote-textColor', 'palette-colors-gray-500'],\n ]);\n\n // Collapsible widget chrome (tool/reasoning/approval bubbles)\n const collapsibleWidgetAliases = [\n ['container', 'surface'],\n ['surface', 'surface'],\n ['border', 'border'],\n ] as const;\n for (const [name, semanticFallback] of collapsibleWidgetAliases) {\n const value =\n cssVars[`--persona-components-collapsibleWidget-${name}`] ??\n cssVars[`--persona-${semanticFallback}`];\n if (value !== undefined) {\n cssVars[`--persona-cw-${name}`] = value;\n // Kept for custom styles that adopted the original unprefixed aliases.\n cssVars[`--cw-${name}`] = value;\n }\n }\n\n emitAliases(cssVars, [\n ['message-border', 'components-message-border', 'border'],\n ]);\n\n // Bubble geometry/type per role. No fallback source: the message layout\n // preset's value is carried in the consuming var() fallback (inline on the\n // bubble for type/padding, in widget.css for the row width cap), so an unset\n // token must leave the variable undefined.\n emitAliases(cssVars, [\n ['message-user-padding', 'components-message-user-padding'],\n ['message-user-max-width', 'components-message-user-maxWidth'],\n ['message-user-font-size', 'components-message-user-fontSize'],\n ['message-user-font-family', 'components-message-user-fontFamily'],\n ['message-user-line-height', 'components-message-user-lineHeight'],\n ['message-assistant-padding', 'components-message-assistant-padding'],\n ['message-assistant-border-width', 'components-message-assistant-borderWidth'],\n ['message-assistant-max-width', 'components-message-assistant-maxWidth'],\n ['message-assistant-font-size', 'components-message-assistant-fontSize'],\n ['message-assistant-font-family', 'components-message-assistant-fontFamily'],\n ['message-assistant-line-height', 'components-message-assistant-lineHeight'],\n ]);\n\n // Icon button tokens\n const components = theme.components;\n emitTruthy(components?.iconButton, 'icon-btn-', [\n ['background', 'bg'],\n ['border', 'border'],\n ['color', 'color'],\n ['padding', 'padding'],\n ['borderRadius', 'radius'],\n ['hoverBackground', 'hover-bg'],\n ['hoverColor', 'hover-color'],\n ['activeBackground', 'active-bg'],\n ['activeBorder', 'active-border'],\n ]);\n\n // Label button tokens\n emitTruthy(components?.labelButton, 'label-btn-', [\n ['background', 'bg'],\n ['border', 'border'],\n ['color', 'color'],\n ['padding', 'padding'],\n ['borderRadius', 'radius'],\n ['hoverBackground', 'hover-bg'],\n ['fontSize', 'font-size'],\n ['gap', 'gap'],\n ]);\n\n // Toggle group tokens\n emitTruthy(components?.toggleGroup, 'toggle-group-', [\n ['gap', 'gap'],\n ['borderRadius', 'radius'],\n ]);\n\n // Artifact tokens\n const artifact = components?.artifact;\n if (artifact?.toolbar) {\n const t = artifact.toolbar;\n emitTruthy(t, 'artifact-toolbar-icon-', [\n ['iconHoverColor', 'hover-color'],\n ['iconHoverBackground', 'hover-bg'],\n ['iconPadding', 'padding'],\n ['iconBorderRadius', 'radius'],\n ['iconBorder', 'border'],\n ]);\n // A bare \"0\" is a <number> in calc(), not a <length>; gap/padding feed the\n // toggle thumb's width calc, so a unitless zero would zero out the thumb.\n if (t.toggleGroupGap) cssVars['--persona-artifact-toolbar-toggle-group-gap'] = zeroLength(t.toggleGroupGap);\n if (t.toggleBorderRadius) cssVars['--persona-artifact-toolbar-toggle-radius'] = t.toggleBorderRadius;\n if (t.toggleGroupPadding) cssVars['--persona-artifact-toolbar-toggle-group-padding'] = zeroLength(t.toggleGroupPadding);\n emitTruthy(t, 'artifact-toolbar-toggle-group-', [\n ['toggleGroupBorder', 'border'],\n ['toggleGroupBorderRadius', 'radius'],\n ]);\n if (t.toggleGroupBackground) cssVars['--persona-artifact-toolbar-toggle-group-bg'] = resolveTokenValue(theme, t.toggleGroupBackground) ?? t.toggleGroupBackground;\n emitTruthy(t, 'artifact-toolbar-copy-', [\n ['copyBackground', 'bg'],\n ['copyBorder', 'border'],\n ['copyColor', 'color'],\n ]);\n // Feeds the split-button halves' inner-radius calc; must stay a <length>.\n if (t.copyBorderRadius) cssVars['--persona-artifact-toolbar-copy-radius'] = zeroLength(t.copyBorderRadius);\n if (t.copyPadding) cssVars['--persona-artifact-toolbar-copy-padding'] = t.copyPadding;\n if (t.copyMenuBackground) {\n cssVars['--persona-artifact-toolbar-copy-menu-bg'] = t.copyMenuBackground;\n cssVars['--persona-dropdown-bg'] = cssVars['--persona-dropdown-bg'] ?? t.copyMenuBackground;\n }\n if (t.copyMenuBorder) {\n cssVars['--persona-artifact-toolbar-copy-menu-border'] = t.copyMenuBorder;\n cssVars['--persona-dropdown-border'] = cssVars['--persona-dropdown-border'] ?? t.copyMenuBorder;\n }\n if (t.copyMenuShadow) {\n cssVars['--persona-artifact-toolbar-copy-menu-shadow'] = t.copyMenuShadow;\n cssVars['--persona-dropdown-shadow'] = cssVars['--persona-dropdown-shadow'] ?? t.copyMenuShadow;\n }\n if (t.copyMenuBorderRadius) {\n cssVars['--persona-artifact-toolbar-copy-menu-radius'] = t.copyMenuBorderRadius;\n cssVars['--persona-dropdown-radius'] = cssVars['--persona-dropdown-radius'] ?? t.copyMenuBorderRadius;\n }\n if (t.copyMenuItemHoverBackground) {\n cssVars['--persona-artifact-toolbar-copy-menu-item-hover-bg'] = t.copyMenuItemHoverBackground;\n cssVars['--persona-dropdown-item-hover-bg'] = cssVars['--persona-dropdown-item-hover-bg'] ?? t.copyMenuItemHoverBackground;\n }\n emitTruthy(t, 'artifact-toolbar-', [\n ['iconBackground', 'icon-bg'],\n ['toolbarBorder', 'border'],\n ]);\n }\n if (artifact?.tab) {\n const t = artifact.tab;\n emitTruthy(t, 'artifact-tab-', [\n ['background', 'bg'],\n ['activeBackground', 'active-bg'],\n ['activeBorder', 'active-border'],\n ['borderRadius', 'radius'],\n ['textColor', 'color'],\n ['hoverBackground', 'hover-bg'],\n ['listBackground', 'list-bg'],\n ['listBorderColor', 'list-border-color'],\n ['listPadding', 'list-padding'],\n ]);\n }\n if (artifact?.pane) {\n const t = artifact.pane;\n if (t.toolbarBackground) {\n const toolbarBg =\n resolveTokenValue(theme, t.toolbarBackground) ?? t.toolbarBackground;\n cssVars['--persona-artifact-toolbar-bg'] = toolbarBg;\n }\n }\n // The third column opts into reference resolution; raw border/height stay raw.\n emitTruthy(artifact?.card, 'artifact-card-', [\n ['background', 'bg', true],\n ['border', 'border'],\n ['borderRadius', 'radius', true],\n ['hoverBackground', 'hover-bg', true],\n ['hoverBorderColor', 'hover-border', true],\n ]);\n emitTruthy(artifact?.inline, 'artifact-inline-', [\n ['background', 'bg', true],\n ['border', 'border'],\n ['borderRadius', 'radius', true],\n ['chromeBackground', 'chrome-bg', true],\n ['chromeBorder', 'chrome-border', true],\n ['titleColor', 'title-color', true],\n ['mutedColor', 'muted-color', true],\n ['frameHeight', 'frame-height'],\n ]);\n\n // Code (syntax-highlighted artifact source view) tokens.\n const code = components?.code;\n if (code) {\n emitTruthy(code, 'code-', [\n ['keywordColor', 'keyword-color'],\n ['stringColor', 'string-color'],\n ['commentColor', 'comment-color'],\n ['numberColor', 'number-color'],\n ['tagColor', 'tag-color'],\n ['attrColor', 'attr-color'],\n ['propertyColor', 'property-color'],\n ['lineNumberColor', 'line-number-color'],\n ['gutterBorderColor', 'gutter-border-color'],\n ]);\n if (code.background)\n cssVars['--persona-code-bg'] = resolveTokenValue(theme, code.background) ?? code.background;\n }\n\n // Interactive-state defaults. The default preset resolves container === surface,\n // which turns every hover/active rule that falls back to --persona-container\n // into a visual no-op; anchor those states one gray step down in that case.\n // A flat DARK surface takes white-alpha washes instead: light grays paint a\n // near-white pill under light text. Unparseable surfaces keep the grays.\n // Component config emitted above must keep winning, so only fill vars not set.\n const stateSurface = cssVars['--persona-surface'];\n const stateContainer = cssVars['--persona-container'];\n const gray100 = cssVars['--persona-palette-colors-gray-100'] ?? '#f3f4f6';\n const gray200 = cssVars['--persona-palette-colors-gray-200'] ?? '#e5e7eb';\n const gray300 = cssVars['--persona-palette-colors-gray-300'] ?? '#d1d5db';\n const flatTheme = !stateContainer || stateContainer === stateSurface;\n const flatLuminance = relativeLuminance(stateSurface ?? cssVars['--persona-background']);\n const flatDark = flatTheme && flatLuminance !== undefined && flatLuminance < DARK_SURFACE_LUMINANCE;\n const flatHoverBg = flatDark ? 'rgba(255, 255, 255, 0.08)' : gray100;\n const flatActiveBg = flatDark ? 'rgba(255, 255, 255, 0.12)' : gray200;\n const flatActiveBorder = flatDark ? 'rgba(255, 255, 255, 0.16)' : gray300;\n const hoverBgDefault = flatTheme ? flatHoverBg : stateContainer;\n const activeBgDefault = flatTheme ? flatActiveBg : stateContainer;\n cssVars['--persona-icon-btn-hover-bg'] = cssVars['--persona-icon-btn-hover-bg'] ?? hoverBgDefault;\n cssVars['--persona-icon-btn-active-bg'] = cssVars['--persona-icon-btn-active-bg'] ?? activeBgDefault;\n if (flatTheme) {\n cssVars['--persona-icon-btn-active-border'] =\n cssVars['--persona-icon-btn-active-border'] ?? flatActiveBorder;\n }\n cssVars['--persona-label-btn-hover-bg'] = cssVars['--persona-label-btn-hover-bg'] ?? hoverBgDefault;\n cssVars['--persona-artifact-tab-hover-bg'] =\n cssVars['--persona-artifact-tab-hover-bg'] ?? hoverBgDefault;\n cssVars['--persona-artifact-card-hover-bg'] =\n cssVars['--persona-artifact-card-hover-bg'] ?? hoverBgDefault;\n\n return cssVars;\n}\n\nexport function applyThemeVariables(element: HTMLElement, theme: PersonaTheme): void {\n const cssVars = themeToCssVariables(theme);\n\n for (const [name, value] of Object.entries(cssVars)) {\n element.style.setProperty(name, value);\n }\n}\n\n/**\n * Stable `data-persona-theme-zone` values applied to key widget regions.\n * Visual editors should use `[data-persona-theme-zone=\"header\"]` selectors\n * rather than internal class names.\n */\nexport const THEME_ZONES = {\n header: 'Widget header bar',\n messages: 'Message list area',\n 'user-message': 'User message bubble',\n 'assistant-message': 'Assistant message bubble',\n composer: 'Footer / composer area',\n container: 'Main widget container',\n 'artifact-pane': 'Artifact sidebar',\n 'artifact-toolbar': 'Artifact toolbar',\n 'artifact-inline': 'Inline artifact block',\n 'artifact-inline-chrome': 'Inline artifact title bar',\n} as const;\n\nexport type ThemeZone = keyof typeof THEME_ZONES;\n","import { CIRCLE_LAUNCHER_TOKENS, resolveLauncherVariant } from \"./launcher-variant\";\nimport type { BrandConfig, CreateThemeOptions, DeepPartial, PersonaTheme } from '../types/theme';\nimport type { AgentWidgetConfig } from '../types';\nimport { resolveDefaultsVersion } from '../defaults';\nimport { createTheme, resolveTokens, themeToCssVariables, launcherThemeToCssVariables, resolveThemeDefaults, DEFAULT_COMPONENTS_V4 } from './tokens';\nimport { isEmbeddedLayout } from \"./panel-config\";\nimport { deriveBrandTheme, inferBrandColorScheme } from './brand';\nimport { deepMerge } from './deep-merge';\nimport { hasExplicitThemeStyle, OPT_IN_THEME_STYLE_PATHS } from './style-provenance';\n\nexport type ColorScheme = 'light' | 'dark' | 'auto';\n\nexport interface PersonaWidgetConfig {\n brand?: BrandConfig;\n theme?: DeepPartial<PersonaTheme>;\n darkTheme?: DeepPartial<PersonaTheme>;\n colorScheme?: ColorScheme;\n future?: { v5Defaults?: boolean };\n}\n\ntype WidgetConfig = PersonaWidgetConfig | AgentWidgetConfig;\n\nconst isPanelWidthMode = (config?: WidgetConfig): boolean =>\n !!config &&\n \"launcher\" in config &&\n (config.launcher?.sidebarMode === true || config.launcher?.mountMode === \"docked\");\n\nconst applyPanelModeWidth = (theme: PersonaTheme, config?: WidgetConfig): PersonaTheme => {\n if (!config || !isPanelWidthMode(config)) return theme;\n const lightWidth = config.theme?.components?.panel?.width;\n const darkWidth = config.darkTheme?.components?.panel?.width;\n const configuredWidth = getColorScheme(config) === \"dark\" ? darkWidth ?? lightWidth : lightWidth;\n if (configuredWidth != null) return theme;\n return {\n ...theme,\n components: {\n ...theme.components,\n panel: { ...theme.components.panel, width: resolveDefaultsVersion(config) === \"v5\" ? \"400px\" : \"420px\" },\n },\n };\n};\n\nconst DARK_PALETTE_BASE = {\n colors: {\n primary: {\n 50: '#ffffff',\n 100: '#f5f5f5',\n 200: '#d4d4d4',\n 300: '#a3a3a3',\n 400: '#737373',\n 500: '#171717',\n 600: '#0f0f0f',\n 700: '#0a0a0a',\n 800: '#050505',\n 900: '#030303',\n 950: '#000000',\n },\n secondary: {\n 50: '#f5f3ff',\n 100: '#ede9fe',\n 200: '#ddd6fe',\n 300: '#c4b5fd',\n 400: '#a78bfa',\n 500: '#8b5cf6',\n 600: '#7c3aed',\n 700: '#6d28d9',\n 800: '#5b21b6',\n 900: '#4c1d95',\n 950: '#2e1065',\n },\n accent: {\n 50: '#ecfeff',\n 100: '#cffafe',\n 200: '#a5f3fc',\n 300: '#67e8f9',\n 400: '#22d3ee',\n 500: '#06b6d4',\n 600: '#0891b2',\n 700: '#0e7490',\n 800: '#155e75',\n 900: '#164e63',\n 950: '#083344',\n },\n gray: {\n 50: '#f9fafb',\n 100: '#f3f4f6',\n 200: '#e5e7eb',\n 300: '#d1d5db',\n 400: '#9ca3af',\n 500: '#6b7280',\n 600: '#4b5563',\n 700: '#374151',\n 800: '#1f2937',\n 900: '#111827',\n 950: '#030712',\n },\n success: {\n 50: '#f0fdf4',\n 100: '#dcfce7',\n 200: '#bbf7d0',\n 300: '#86efac',\n 400: '#4ade80',\n 500: '#22c55e',\n 600: '#16a34a',\n 700: '#15803d',\n 800: '#166534',\n 900: '#14532d',\n },\n warning: {\n 50: '#fefce8',\n 100: '#fef9c3',\n 200: '#fef08a',\n 300: '#fde047',\n 400: '#facc15',\n 500: '#eab308',\n 600: '#ca8a04',\n 700: '#a16207',\n 800: '#854d0e',\n 900: '#713f12',\n },\n error: {\n 50: '#fef2f2',\n 100: '#fee2e2',\n 200: '#fecaca',\n 300: '#fca5a5',\n 400: '#f87171',\n 500: '#ef4444',\n 600: '#dc2626',\n 700: '#b91c1c',\n 800: '#991b1b',\n 900: '#7f1d1d',\n },\n },\n};\n\n/**\n * Component defaults that only hold in a dark color scheme. Layered UNDER the\n * host's theme, so any explicit value still wins.\n *\n * The ghost hover wash must invert with the scheme: 5% black is invisible on a\n * near-black surface, so every dark scheme gets a light alpha instead.\n */\nconst DARK_COMPONENTS_BASE: DeepPartial<PersonaTheme> = {\n components: {\n button: {\n ghost: {\n hoverBackground: 'rgba(255, 255, 255, 0.08)',\n },\n },\n markdown: {\n link: {\n // primary.600 is #0f0f0f in both palettes; on a charcoal bubble that\n // fails AA. primary.300 (#a3a3a3) is ~5.8:1 on gray.800 and still\n // distinct from body text (gray.100).\n foreground: 'palette.colors.primary.300',\n },\n },\n // Event-stream badge chips flip to a 900-tone fill with a 300-tone text\n // (primary is the inverted dark ramp, so 800/200 lands the same way).\n // The light defaults are 100-tone fills that read as glowing swatches on\n // a dark panel; every pair here keeps >=4.5:1 text contrast (locked by\n // event-stream-badge-theming.test.ts).\n eventStream: {\n badge: {\n flow: { background: 'palette.colors.success.900', foreground: 'palette.colors.success.300' },\n step: { background: 'palette.colors.primary.800', foreground: 'palette.colors.primary.200' },\n reasoning: { background: 'palette.colors.warning.900', foreground: 'palette.colors.warning.300' },\n tool: { background: 'palette.colors.purple.900', foreground: 'palette.colors.purple.300' },\n agent: { background: 'palette.colors.teal.900', foreground: 'palette.colors.teal.300' },\n error: { background: 'palette.colors.error.900', foreground: 'palette.colors.error.300' },\n default: { background: 'palette.colors.gray.800', foreground: 'palette.colors.gray.300' },\n },\n },\n history: {\n // error-400: the light-surface error-600 red lands ~3:1 on dark\n // surfaces, under the 4.5:1 AA floor for the 14px destructive labels.\n dangerForeground: '#f87171',\n confirm: {\n // error-600: bright enough to read as a control against a dark\n // surface (3:1 non-text) while the white label keeps 4.8:1.\n dangerBackground: 'palette.colors.error.600',\n // 45% slate darkens near-black surfaces by almost nothing; dark\n // schemes need a heavier dimmer for the modal to read as modal.\n scrim: 'rgba(0, 0, 0, 0.6)',\n },\n },\n },\n};\n\n// V4 stays frozen; V5 provides the dark neutral ramp and semantic roles.\nexport const DARK_PALETTE_V4 = DARK_PALETTE_BASE;\nexport const DARK_PALETTE_V5 = {\n ...DARK_PALETTE_V4,\n colors: {\n ...DARK_PALETTE_V4.colors,\n primary: {\n 50: '#0f0f10', 100: '#27272a', 200: '#3f3f46', 300: '#52525b',\n 400: '#71717a', 500: '#f4f4f5', 600: '#e4e4e7', 700: '#d4d4d8',\n 800: '#a1a1aa', 900: '#fafafa', 950: '#ffffff',\n },\n gray: {\n 50: '#1a1a1b', 100: '#27272a', 200: '#2a2a2d', 300: '#52525b',\n 400: '#71717a', 500: '#a1a1aa', 600: '#b4b4bd', 700: '#d4d4d8',\n 800: '#e4e4e7', 900: '#f4f4f5', 950: '#fafafa',\n },\n },\n};\nexport const DARK_COMPONENTS_V4 = DARK_COMPONENTS_BASE;\nexport const DARK_COMPONENTS_V5: DeepPartial<PersonaTheme> = {\n semantic: {\n colors: {\n primary: 'palette.colors.primary.500',\n accent: 'palette.colors.primary.600',\n background: '#0f0f10',\n surface: 'palette.colors.gray.50',\n container: '#1c1c20',\n text: 'palette.colors.gray.900',\n textMuted: 'palette.colors.gray.500',\n textInverse: '#0f0f10',\n border: 'palette.colors.gray.200',\n divider: 'palette.colors.gray.200',\n interactive: {\n default: 'palette.colors.primary.600', hover: 'palette.colors.primary.700',\n focus: 'palette.colors.primary.600', active: 'palette.colors.primary.600',\n },\n },\n },\n components: {\n ...DARK_COMPONENTS_BASE.components,\n button: {\n ...DARK_COMPONENTS_BASE.components?.button,\n primary: { background: 'semantic.colors.primary', foreground: 'palette.colors.primary.50' },\n },\n markdown: {\n inlineCode: { background: 'palette.colors.gray.100', foreground: 'semantic.colors.text' },\n link: { foreground: 'semantic.colors.accent' },\n codeBlock: {\n background: 'semantic.colors.container', borderColor: 'semantic.colors.border',\n textColor: 'semantic.colors.text',\n },\n table: { headerBackground: 'palette.colors.gray.100', borderColor: 'semantic.colors.border' },\n blockquote: {\n background: 'semantic.colors.container', borderColor: 'palette.colors.gray.300',\n textColor: 'semantic.colors.textMuted',\n },\n },\n eventStream: {\n ...DARK_COMPONENTS_BASE.components?.eventStream,\n badge: {\n ...DARK_COMPONENTS_BASE.components?.eventStream?.badge,\n step: { background: 'palette.colors.gray.100', foreground: 'palette.colors.gray.700' },\n default: { background: 'palette.colors.gray.100', foreground: 'palette.colors.gray.700' },\n },\n },\n },\n};\n\nconst resolveDarkDefaults = (future?: { v5Defaults?: boolean }) =>\n resolveDefaultsVersion({ future }) === 'v5'\n ? { palette: DARK_PALETTE_V5, components: DARK_COMPONENTS_V5 }\n : { palette: DARK_PALETTE_V4, components: DARK_COMPONENTS_V4 };\n\n/**\n * Normalize theme config for merging; rejects non-objects.\n */\nconst normalizeThemeConfig = (\n theme: DeepPartial<PersonaTheme> | Record<string, unknown> | undefined\n): DeepPartial<PersonaTheme> | undefined => {\n if (!theme || typeof theme !== 'object' || Array.isArray(theme)) return undefined;\n return theme as DeepPartial<PersonaTheme>;\n};\n\nexport const detectColorScheme = (): 'light' | 'dark' => {\n if (typeof document !== 'undefined' && document.documentElement.classList.contains('dark')) {\n return 'dark';\n }\n\n if (typeof window !== 'undefined' && window.matchMedia?.('(prefers-color-scheme: dark)').matches) {\n return 'dark';\n }\n\n return 'light';\n};\n\nconst getColorSchemeFromConfig = (config?: WidgetConfig): 'light' | 'dark' => {\n const colorScheme = config?.colorScheme ?? inferBrandColorScheme(config?.brand) ?? 'light';\n\n if (colorScheme === 'light') return 'light';\n if (colorScheme === 'dark') return 'dark';\n\n return detectColorScheme();\n};\n\nexport const getColorScheme = (config?: WidgetConfig): 'light' | 'dark' => {\n return getColorSchemeFromConfig(config);\n};\n\nexport const createLightTheme = (\n userConfig?: DeepPartial<PersonaTheme>,\n options: Pick<CreateThemeOptions, 'future'> = {}\n): PersonaTheme => {\n return createTheme(userConfig, options);\n};\n\nexport const createDarkTheme = (\n userConfig?: DeepPartial<PersonaTheme>,\n options: Pick<CreateThemeOptions, 'future'> = {}\n): PersonaTheme => {\n // createTheme() already merges every palette sub-object (radius, typography,\n // shadows, …) over the defaults, so only the dark color scales need to be\n // layered UNDER the user's colors here. Spreading a pre-built default\n // palette instead would clobber the user's non-color palette overrides\n // (radius/typography) in dark mode while light mode honored them.\n //\n // DARK_COMPONENTS goes underneath by deep merge, not spread: a shallow\n // spread of `components` would drop the dark ghost hover the moment a host\n // set any unrelated component token.\n const darkDefaults = resolveDarkDefaults(options.future);\n const config = (deepMerge(\n darkDefaults.components as Record<string, unknown>,\n (userConfig ?? {}) as Record<string, unknown>\n ) ?? {}) as DeepPartial<PersonaTheme>;\n\n return createTheme(\n {\n ...config,\n palette: {\n ...config.palette,\n // Preserve every dark stop when a host overrides just one shade.\n // Keep V4's historical scale replacement behavior unchanged.\n colors: resolveDefaultsVersion(options) === 'v5'\n ? deepMerge(darkDefaults.palette.colors, config.palette?.colors) as PersonaTheme['palette']['colors']\n : { ...darkDefaults.palette.colors, ...config.palette?.colors },\n },\n },\n { validate: false, future: options.future }\n );\n};\n\nexport const getActiveTheme = (config?: WidgetConfig): PersonaTheme => {\n const scheme = getColorScheme(config);\n const explicitTheme = deepMerge(deriveBrandTheme(config?.brand, scheme, resolveThemeDefaults(config?.future).components, config?.future?.v5Defaults), normalizeThemeConfig(config?.theme)) as DeepPartial<PersonaTheme>;\n // Variant defaults sit under explicit theme tokens in either defaults state.\n const launcherDefaults = resolveLauncherVariant(config) === 'circle'\n ? CIRCLE_LAUNCHER_TOKENS\n : { ...DEFAULT_COMPONENTS_V4.launcher, ...(config?.future?.v5Defaults ? { offset: '1.5rem' } : {}) };\n // Scope presentation defaults below caller tokens, including dark overrides.\n const embedded = isEmbeddedLayout(config as Partial<AgentWidgetConfig>);\n const lightThemeConfig = deepMerge(\n { components: {\n launcher: launcherDefaults,\n ...(embedded ? {\n panel: { background: 'transparent', modes: { inline: { border: 'none', shadow: 'none', borderRadius: '0' } } },\n header: { background: 'transparent' },\n message: { background: 'transparent' },\n composer: { footerBackground: 'transparent', footerBorder: 'none', overlayBand: 'transparent' },\n } : {}),\n } }, explicitTheme\n ) as DeepPartial<PersonaTheme>;\n const darkThemeConfig = normalizeThemeConfig(config?.darkTheme);\n\n const theme = scheme === 'dark'\n ? applyPanelModeWidth(createDarkTheme(\n deepMerge(\n (lightThemeConfig ?? {}) as Record<string, unknown>,\n (darkThemeConfig ?? {}) as Record<string, unknown>\n ) as DeepPartial<PersonaTheme>,\n { future: config?.future }\n ), config)\n : applyPanelModeWidth(createLightTheme(lightThemeConfig, { future: config?.future }), config);\n Object.defineProperty(theme, CONSUMER_PATHS, {\n value: [...OPT_IN_THEME_STYLE_PATHS, 'suggestion.chip.padding', 'suggestion.chip.fontWeight']\n .filter((path) => hasExplicitThemeStyle(config, path, scheme)),\n });\n return theme;\n};\n\nconst CONSUMER_PATHS = Symbol('persona.themeConsumerPaths');\nexport const getCssVariables = (theme: PersonaTheme): Record<string, string> => {\n const variables = themeToCssVariables(theme);\n // Legacy chip defaults differ from the public token defaults. Keep them\n // available beneath host theme intent, including observer-only scheme changes.\n variables['--persona-suggestion-compat-padding'] = '6px 12px';\n variables['--persona-suggestion-compat-weight'] = '500';\n for (const path of (theme as PersonaTheme & { [CONSUMER_PATHS]?: readonly string[] })[CONSUMER_PATHS] ?? []) {\n const suffix = path.split('.').join('-');\n const value = variables[`--persona-components-${suffix}`];\n if (value !== undefined) variables[path === 'suggestion.chip.padding'\n ? '--persona-suggestion-compat-padding' : path === 'suggestion.chip.fontWeight'\n ? '--persona-suggestion-compat-weight' : `--persona-consumer-${suffix}`] = value;\n }\n return variables;\n};\n\nconst appliedVariables = new WeakMap<HTMLElement, string[]>();\n\nexport const applyThemeVariables = (element: HTMLElement, config?: WidgetConfig): void => {\n applyVariables(element, getCssVariables(getActiveTheme(config)), config);\n};\n\n/** Same resolved theme, with only aliases used by the collapsed launcher. */\nexport const applyLauncherThemeVariables = (element: HTMLElement, config?: WidgetConfig): void => {\n applyVariables(element, launcherThemeToCssVariables(getActiveTheme(config)), config);\n};\n\nconst applyVariables = (element: HTMLElement, cssVars: Record<string, string>, config?: WidgetConfig): void => {\n for (const name of appliedVariables.get(element) ?? []) {\n if (!(name in cssVars)) element.style.removeProperty(name);\n }\n appliedVariables.set(element, Object.keys(cssVars));\n for (const [name, value] of Object.entries(cssVars)) {\n element.style.setProperty(name, value);\n }\n\n // Stamp the resolved scheme so stylesheet rules can key scheme-specific\n // defaults (e.g. the syntax-highlight palette) off the widget's own color\n // scheme instead of the OS prefers-color-scheme, which diverges whenever a\n // host pins colorScheme. Re-applied on every theme application, so live\n // config updates and theme-observer callbacks keep it current.\n element.setAttribute(\"data-persona-color-scheme\", getColorScheme(config));\n element.setAttribute(\"data-persona-defaults\", resolveDefaultsVersion(config));\n};\n\nexport const createThemeObserver = (\n callback: (scheme: 'light' | 'dark') => void\n): (() => void) => {\n const cleanupFns: Array<() => void> = [];\n\n if (typeof document !== 'undefined' && typeof MutationObserver !== 'undefined') {\n const observer = new MutationObserver(() => {\n callback(detectColorScheme());\n });\n\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['class'],\n });\n\n cleanupFns.push(() => observer.disconnect());\n }\n\n if (typeof window !== 'undefined' && window.matchMedia) {\n const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');\n const handleChange = () => callback(detectColorScheme());\n\n if (mediaQuery.addEventListener) {\n mediaQuery.addEventListener('change', handleChange);\n cleanupFns.push(() => mediaQuery.removeEventListener('change', handleChange));\n } else if (mediaQuery.addListener) {\n mediaQuery.addListener(handleChange);\n cleanupFns.push(() => mediaQuery.removeListener(handleChange));\n }\n }\n\n return () => {\n cleanupFns.forEach((fn) => fn());\n };\n};\n\nexport { createTheme, resolveTokens, themeToCssVariables };\n","import type { AgentWidgetConfig, AgentWidgetDockConfig } from \"../types\";\nimport { getPanelAliasProvenance } from \"./panel-config\";\nimport { getActiveTheme } from \"./theme\";\nimport { resolveTokenValue } from \"./tokens\";\n\nconst DEFAULT_DOCK_CONFIG: Required<AgentWidgetDockConfig> = {\n side: \"right\",\n width: \"420px\",\n animate: true,\n reveal: \"resize\",\n maxHeight: \"100dvh\",\n};\n\nexport const isDockedMountMode = (config?: AgentWidgetConfig): boolean =>\n (config?.launcher?.mountMode ?? \"floating\") === \"docked\";\n\nexport const isComposerBarMountMode = (config?: AgentWidgetConfig): boolean =>\n (config?.launcher?.mountMode ?? \"floating\") === \"composer-bar\";\n\n/**\n * Resolved dock layout. For `reveal: \"resize\"`, when the panel is closed the dock column is `0px`.\n * For `reveal: \"overlay\"`, the panel overlays with `transform`. For `reveal: \"push\"`, a sliding track\n * moves content and panel together without width animation on the main column. For `emerge`,\n * the dock column still animates like `resize` but the widget stays `dock.width` wide inside the slot.\n * Unknown keys on `launcher.dock` (e.g. legacy `collapsedWidth`) are ignored.\n */\nexport const resolveDockConfig = (\n config?: AgentWidgetConfig\n): Required<AgentWidgetDockConfig> => {\n const dock = config?.launcher?.dock;\n const width = getPanelAliasProvenance(config).dockWidth\n ? dock?.width\n : resolveTokenValue(getActiveTheme(config), \"components.panel.width\");\n return {\n side: dock?.side ?? DEFAULT_DOCK_CONFIG.side,\n width: width ?? DEFAULT_DOCK_CONFIG.width,\n animate: dock?.animate ?? DEFAULT_DOCK_CONFIG.animate,\n reveal: dock?.reveal ?? DEFAULT_DOCK_CONFIG.reveal,\n maxHeight: dock?.maxHeight ?? DEFAULT_DOCK_CONFIG.maxHeight,\n };\n};\n","import type { IconNode } from \"lucide\";\n\n/**\n * Registry-free lucide icon renderer.\n *\n * Two ways to render an icon, chosen by how the name is known:\n * - Name is a LITERAL no config can override → import the icon's data from\n * \"lucide\" (per-icon modules, tree-shakeable) and call `renderIconNode`.\n * Bundles then carry only the glyphs they use — critical for lazy chunks,\n * which would otherwise duplicate the whole ~21 kB registry (`noExternal`).\n * - Name is host-suppliable (config, mention providers, ComponentRenderers) →\n * `renderLucideIcon` in `./icons`, which resolves strings against the\n * curated registry. Chunk code must receive that resolver INJECTED (see\n * approval-deps.ts), never import it.\n *\n * This module must never import `./icons` — that would drag the registry\n * back into every bundle that only needs `renderIconNode`.\n */\nexport const renderIconNode = (\n iconData: IconNode,\n size: number | string = 24,\n color: string = \"currentColor\",\n strokeWidth: number = 2\n): SVGElement | null => {\n if (!Array.isArray(iconData)) return null;\n\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n for (const [name, value] of Object.entries({\n width: String(size), height: String(size), viewBox: \"0 0 24 24\", fill: \"none\", stroke: color,\n \"stroke-width\": String(strokeWidth), \"stroke-linecap\": \"round\", \"stroke-linejoin\": \"round\", \"aria-hidden\": \"true\",\n })) svg.setAttribute(name, value);\n\n // IconNode shape: [[\"path\", {\"d\": \"...\"}], [\"circle\", {\"cx\": \"...\"}], ...]\n for (const elementData of iconData) {\n if (!Array.isArray(elementData) || elementData.length < 2) continue;\n const tagName = elementData[0] as string;\n const attrs = elementData[1] as Record<string, string> | undefined;\n if (!attrs) continue;\n const element = document.createElementNS(\"http://www.w3.org/2000/svg\", tagName);\n for (const [key, value] of Object.entries(attrs)) {\n // Skip 'stroke' so the parent SVG's stroke attribute drives color uniformly\n if (key !== \"stroke\") element.setAttribute(key, String(value));\n }\n svg.appendChild(element);\n }\n\n return svg;\n};\n","import { createChunkLoader } from \"./utils/chunk-loader\";\nimport type { IconNode } from \"lucide\";\n\n/**\n * Loader indirection for the lazy icons-extra chunk (the config-only tail of\n * the icon registry). Stays in the core bundle AND the critical launcher\n * bundle — both register sibling-URL loaders in their IIFE entries, so a\n * launcher configured with a non-core icon paints a sized placeholder and\n * fills within one round-trip instead of shipping the whole registry.\n *\n * The fallback import must be the literal package subpath: `build:client` and\n * the launcher build run without splitting, so a relative import would be\n * inlined; the subpath is marked external in both builds and resolves through\n * the package's own `exports` map at consumer runtime (see\n * `history-view-loader.ts` for the full rationale).\n */\nexport type IconsExtraModule = {\n EXTRA_LUCIDE_ICONS: Record<string, IconNode>;\n};\n\nconst { setLoader, load } = createChunkLoader<IconsExtraModule>({\n fallbackImport: () => import(\"@runtypelabs/persona/icons-extra\"),\n});\n\n/** Override how the chunk is fetched (each IIFE registers a sibling-URL loader). */\nexport const setIconsExtraLoader = setLoader;\n\n/** Load the extra icon data. Memoized; retries after rejection. */\nexport const loadIconsExtra = load;\n","/**\n * Generic memoized loader for a lazy code-split chunk.\n *\n * Backs the near-identical loader indirections in the core/eager bundle\n * (`context-mentions-loader.ts`, `context-mentions-inline-loader.ts`,\n * `markdown-parsers-loader.ts`): each registers a runtime loader (IIFE/CDN\n * sibling-URL chunk) and falls back to an external/relative dynamic import for\n * ESM/CJS consumers. The shared semantics are:\n *\n * - `load()` memoizes the resolved module (`moduleCache`) and the in-flight\n * promise (`loadPromise`) so concurrent callers share one import.\n * - A rejected load clears `loadPromise` so a later call retries after a\n * transient failure (one dropped fetch must not disable the feature for the\n * whole session); the current caller still sees the rejection.\n * - The registered loader wins over `fallbackImport`; if no loader is\n * registered, `fallbackImport` is used.\n *\n * IMPORTANT: this module must import nothing beyond types. It sits in the core\n * bundle, so any value import here could drag chunk code back into core and\n * defeat the split (see `context-mentions-bundle.test.ts`).\n */\n\nexport type ChunkLoaderOptions<T> = {\n /**\n * Dynamic import used when no runtime loader has been registered. Keep the\n * `import(...)` literal in the calling module (not here) so the bundler\n * resolves it as an external subpath / relative chunk at that call site.\n */\n fallbackImport: () => Promise<T>;\n /**\n * When true, registering a new loader clears the cached module and any\n * in-flight promise, so a swapped loader (test injection) takes effect\n * deterministically. Production registers its loader once before any load, so\n * this only matters mid-session.\n */\n resetOnSetLoader?: boolean;\n};\n\nexport type ChunkLoader<T> = {\n setLoader: (l: () => Promise<T>) => void;\n load: () => Promise<T>;\n /** Register a resolved module synchronously (eager builds that bundle it). */\n provide: (mod: T) => void;\n /** The cached module, or null if not loaded/provided yet. */\n getSync: () => T | null;\n};\n\nexport const createChunkLoader = <T>(\n options: ChunkLoaderOptions<T>\n): ChunkLoader<T> => {\n const { fallbackImport, resetOnSetLoader = false } = options;\n\n let loader: (() => Promise<T>) | null = null;\n let moduleCache: T | null = null;\n let loadPromise: Promise<T> | null = null;\n\n const setLoader = (l: () => Promise<T>): void => {\n loader = l;\n if (resetOnSetLoader) {\n moduleCache = null;\n loadPromise = null;\n }\n };\n\n const load = (): Promise<T> => {\n if (moduleCache) return Promise.resolve(moduleCache);\n if (loadPromise) return loadPromise;\n const importChunk = loader ?? fallbackImport;\n try {\n loadPromise = importChunk()\n .then((mod) => {\n moduleCache = mod;\n return mod;\n })\n .catch((err) => {\n loadPromise = null;\n throw err;\n });\n return loadPromise;\n } catch (error) {\n // Custom loaders may throw before returning a promise. Readiness must\n // observe the same rejection/retry contract as a failed dynamic import.\n return Promise.reject(error);\n }\n };\n\n const provide = (mod: T): void => {\n moduleCache = mod;\n };\n\n const getSync = (): T | null => moduleCache;\n\n return { setLoader, load, provide, getSync };\n};\n","import type { IconNode } from \"lucide\";\nimport { renderIconNode } from \"./icon-node\";\nimport { loadIconsExtra } from \"../icons-extra-loader\";\nimport {\n Activity,\n ArrowDown,\n ArrowLeft,\n ArrowRight,\n ArrowUp,\n ArrowUpRight,\n AtSign,\n Bot,\n Check,\n ChevronDown,\n ChevronLeft,\n ChevronRight,\n ChevronUp,\n Clipboard,\n ClipboardCopy,\n CodeXml,\n Copy,\n Download,\n Ellipsis,\n ExternalLink,\n Eye,\n File as FileIcon,\n FileCode,\n FileSpreadsheet,\n FileText,\n History,\n ImagePlus,\n Loader,\n LoaderCircle,\n Maximize,\n Menu,\n MessageSquare,\n Mic,\n Minimize,\n Minus,\n PanelLeft,\n Paperclip,\n Pencil,\n Plus,\n Quote,\n RefreshCw,\n Search,\n Send,\n ShieldAlert,\n ShieldCheck,\n ShieldX,\n Square,\n Star,\n ThumbsDown,\n ThumbsUp,\n Trash,\n Trash2,\n Upload,\n Volume2,\n X,\n} from \"lucide\";\n\n/**\n * Curated icon registry for `renderLucideIcon` (host-suppliable name strings).\n *\n * Two tiers keep the payload honest:\n * - CORE (below): the initial widget chrome —\n * config DEFAULTS (bot, send, mic, x, …) plus the chrome names routed\n * through `utils/buttons` / `utils/dropdown`. Always resolves synchronously.\n * - EXTRA (`src/icons-extra.ts`): activity glyphs and the config-only tail\n * (forms, commerce, media, …). The DATA ships in the lazy `icons-extra.js`\n * sibling chunk; the first request for one of these names kicks the fetch\n * and returns a correctly-sized empty placeholder SVG that fills in place\n * when the chunk lands. Surfaces that clone/morph rendered icons should\n * subscribe to `onExtraIconsReady` and re-render. The widget prepares this\n * registry before revealing its UI, so controls never show placeholders.\n *\n * Statically-known icons in widget code do NOT use this registry: they import\n * icon data directly and call `renderIconNode` (see utils/icon-node.ts).\n *\n * Hosts can extend the registry with custom or non-curated lucide icons via\n * `registerIcons` (public API).\n *\n * See `packages/widget/docs/icon-registry-shortlist.md` for curation rationale.\n */\nconst CORE_LUCIDE_ICONS = {\n \"activity\": Activity,\n \"arrow-down\": ArrowDown,\n \"arrow-up\": ArrowUp,\n \"arrow-up-right\": ArrowUpRight,\n \"bot\": Bot,\n \"chevron-down\": ChevronDown,\n \"chevron-up\": ChevronUp,\n \"chevron-right\": ChevronRight,\n \"chevron-left\": ChevronLeft,\n \"check\": Check,\n \"clipboard\": Clipboard,\n \"clipboard-copy\": ClipboardCopy,\n \"code-xml\": CodeXml,\n \"copy\": Copy,\n \"file\": FileIcon,\n \"file-code\": FileCode,\n \"file-spreadsheet\": FileSpreadsheet,\n \"file-text\": FileText,\n \"image-plus\": ImagePlus,\n \"loader\": Loader,\n \"loader-circle\": LoaderCircle,\n \"mic\": Mic,\n \"paperclip\": Paperclip,\n \"quote\": Quote,\n \"refresh-cw\": RefreshCw,\n \"search\": Search,\n \"send\": Send,\n \"shield-alert\": ShieldAlert,\n \"shield-check\": ShieldCheck,\n \"shield-x\": ShieldX,\n \"square\": Square,\n \"square-text\": [\n [\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\" }],\n [\"path\", { d: \"M7 8h10M7 12h10M7 16h6\" }],\n ],\n \"thumbs-down\": ThumbsDown,\n \"thumbs-up\": ThumbsUp,\n \"upload\": Upload,\n \"volume-2\": Volume2,\n \"voice-bars\": [\n [\"path\", { d: \"M4 10v4\" }],\n [\"path\", { d: \"M8 6v12\" }],\n [\"path\", { d: \"M12 3v18\" }],\n [\"path\", { d: \"M16 7v10\" }],\n [\"path\", { d: \"M20 10v4\" }],\n ],\n \"x\": X,\n \"at-sign\": AtSign,\n \"arrow-left\": ArrowLeft,\n \"arrow-right\": ArrowRight,\n \"external-link\": ExternalLink,\n \"ellipsis\": Ellipsis,\n \"menu\": Menu,\n \"panel-left\": PanelLeft,\n \"plus\": Plus,\n \"minus\": Minus,\n \"pencil\": Pencil,\n \"trash\": Trash,\n \"trash-2\": Trash2,\n \"download\": Download,\n \"maximize\": Maximize,\n \"minimize\": Minimize,\n \"message-square\": MessageSquare,\n \"star\": Star,\n \"eye\": Eye,\n \"history\": History,\n} as const satisfies Record<string, IconNode>;\n\n/**\n * Names whose data lives in the lazy icons-extra chunk. Kept as a runtime\n * list (~0.8 kB) so an unknown-name typo warns immediately instead of\n * triggering a pointless chunk fetch. MUST stay in sync with the keys of\n * `EXTRA_LUCIDE_ICONS` in `src/icons-extra.ts` (asserted by\n * `icons-partition.test.ts`).\n */\nexport const EXTRA_ICON_NAMES = [\n \"brain\",\n \"toolbox\",\n \"wrench\",\n \"circle\",\n \"database\",\n \"terminal\",\n \"user\",\n \"mail\",\n \"phone\",\n \"calendar\",\n \"clock\",\n \"building\",\n \"map-pin\",\n \"lock\",\n \"key\",\n \"credit-card\",\n \"hash\",\n \"globe\",\n \"link\",\n \"circle-check\",\n \"circle-x\",\n \"triangle-alert\",\n \"info\",\n \"ban\",\n \"shield\",\n \"ellipsis-vertical\",\n \"house\",\n \"pen-line\",\n \"save\",\n \"share\",\n \"funnel\",\n \"settings\",\n \"rotate-cw\",\n \"shopping-cart\",\n \"shopping-bag\",\n \"package\",\n \"truck\",\n \"tag\",\n \"gift\",\n \"receipt\",\n \"wallet\",\n \"store\",\n \"dollar-sign\",\n \"percent\",\n \"play\",\n \"pause\",\n \"volume-x\",\n \"camera\",\n \"image\",\n \"film\",\n \"headphones\",\n \"message-circle\",\n \"bell\",\n \"heart\",\n \"eye-off\",\n \"bookmark\",\n \"calendar-days\",\n \"timer\",\n \"folder\",\n \"folder-open\",\n \"files\",\n \"chart-column\",\n \"sparkles\",\n \"zap\",\n \"sun\",\n \"moon\",\n \"flag\",\n \"lightbulb\",\n \"monitor\",\n \"smartphone\",\n] as const;\n\n/**\n * Names of lucide icons that ship with the widget (core + lazy extra). Names\n * not in this union return `null` from `renderLucideIcon` (with a console\n * warning) unless first added via `registerIcons`.\n */\nexport type IconName =\n | keyof typeof CORE_LUCIDE_ICONS\n | (typeof EXTRA_ICON_NAMES)[number];\n\n/** Runtime registry: core map + lazily-registered extra/custom icons. */\nconst runtimeIcons = new Map<string, IconNode>(\n Object.entries(CORE_LUCIDE_ICONS)\n);\n\n// ---------------------------------------------------------------------------\n// Extra-chunk heal machinery: placeholders fill in place; cloning surfaces\n// re-render via onExtraIconsReady.\n// ---------------------------------------------------------------------------\n\nconst pendingIcons = new Map<SVGElement, string>();\n\nlet extraIconsLoaded = false;\nconst extraReadySubscribers = new Set<() => void>();\n\n/**\n * Notify heal subscribers. Unlike the markdown loader's fire-once model this\n * can fire MORE THAN ONCE: `registerIcons` may cover some pending names\n * before the chunk adoption covers the rest, and cloning surfaces must\n * re-render on each. Subscribers are only released once the chunk is adopted\n * (`final`) — after that every extra-tier name resolves synchronously, so\n * clones can no longer be created pending.\n */\nconst notifyExtraIconsReady = (final: boolean): void => {\n const subs = [...extraReadySubscribers];\n if (final) extraReadySubscribers.clear();\n for (const cb of subs) {\n try {\n cb();\n } catch {\n /* one bad subscriber must not starve the others */\n }\n }\n};\n\n/**\n * Register `cb` to run once the icons-extra chunk has been adopted (or\n * `registerIcons` supplied names that were pending). For surfaces whose\n * rendered icons get CLONED (fingerprint cache + idiomorph): a clone of a\n * pending placeholder never self-fills, so those surfaces must re-render.\n * Subscribing is passive — it never kicks the fetch (the first extra-name\n * render does). No-op when the extra icons are already registered.\n */\nexport const onExtraIconsReady = (cb: () => void): (() => void) => {\n if (extraIconsLoaded) return () => {};\n extraReadySubscribers.add(cb);\n return () => {\n extraReadySubscribers.delete(cb);\n };\n};\n\nconst fillPendingIcons = (): number => {\n let filled = 0;\n for (const [el, name] of pendingIcons) {\n const data = runtimeIcons.get(name);\n if (!data) continue;\n pendingIcons.delete(el);\n filled++;\n // Only adopt children: size, color, and stroke width already live on the\n // placeholder shell, so retaining and applying those options again is redundant.\n const real = renderIconNode(data);\n if (!real) continue;\n // Fill IN PLACE: the placeholder already carries the correct svg attrs,\n // so adopting the real children swaps nothing the layout depends on.\n el.removeAttribute(\"data-persona-icon-pending\");\n while (real.firstChild) el.appendChild(real.firstChild);\n }\n return filled;\n};\n\n/**\n * Extend the registry at runtime with custom icons (or non-curated lucide\n * data). Later registrations win. Pending placeholders for the added names\n * fill immediately. Public API.\n */\nexport const registerIcons = (icons: Record<string, IconNode>): void => {\n for (const [name, data] of Object.entries(icons)) {\n runtimeIcons.set(name, data);\n }\n // Registered names may cover pending placeholders (e.g. a self-hosted\n // deployment that renamed the bundle and registers icons instead of the\n // chunk). Cloning surfaces hold COPIES the in-place fill can't reach, so\n // notify the heal subscribers whenever anything actually filled.\n if (fillPendingIcons() > 0 && !extraIconsLoaded) {\n notifyExtraIconsReady(false);\n }\n};\n\n/**\n * npm eager path (imported via `index.ts` → `icons-extra-eager.ts`): supply\n * the extra-tier data synchronously so bundled consumers keep the historical\n * all-sync `renderLucideIcon` contract. The IIFE/CDN build never calls this —\n * it lazy-loads `icons-extra.js` instead. Host `registerIcons` overrides\n * registered before this runs still win.\n */\nexport const __eagerlyProvideExtraIcons = (\n icons: Record<string, IconNode>\n): void => {\n if (extraIconsLoaded) return;\n for (const [name, data] of Object.entries(icons)) {\n if (!runtimeIcons.has(name)) runtimeIcons.set(name, data);\n }\n extraIconsLoaded = true;\n fillPendingIcons();\n notifyExtraIconsReady(true);\n};\n\n/** Prepare icon data before revealing controls, including unopened menus. */\nexport const prepareIconRegistry = (): Promise<void> | null => extraIconsLoaded ? null :\n loadIconsExtra().then(mod => __eagerlyProvideExtraIcons(mod.EXTRA_LUCIDE_ICONS));\n\nconst kickExtraIcons = (): void => {\n void prepareIconRegistry()?.catch((err) => {\n // Placeholders stay empty; the next render retries via the chunk loader.\n console.warn(\"[Persona] Failed to load the icons-extra chunk\", err);\n });\n};\n\nconst createPlaceholderSvg = (\n size: number | string,\n color: string,\n strokeWidth: number\n): SVGElement => {\n // The same shell as a resolved glyph, so filling it never changes geometry.\n const svg = renderIconNode([], size, color, strokeWidth)!;\n svg.setAttribute(\"data-persona-icon-pending\", \"true\");\n return svg;\n};\n\n/**\n * Renders a lucide icon as an inline SVG element. Works inside Shadow\n * DOM and requires no CSS.\n *\n * Core names resolve synchronously. Extra-tier names (see EXTRA_ICON_NAMES)\n * return a correctly-sized empty placeholder on first use and fill in place\n * once the lazy icons-extra chunk lands. Unknown names return `null` and log\n * a warning.\n *\n * @param iconName - A lucide kebab-case name from the registry. See\n * `IconName` for the full list, or `docs/icon-registry-shortlist.md`\n * for rationale.\n * @param size - The size in pixels (number) or any CSS length string.\n * @param color - Stroke color (default: \"currentColor\").\n * @param strokeWidth - Stroke width (default: 2).\n * @returns SVGElement, or null if the name is not in the registry.\n */\nexport const renderLucideIcon = (\n iconName: IconName | (string & {}),\n size: number | string = 24,\n color: string = \"currentColor\",\n strokeWidth: number = 2\n): SVGElement | null => {\n const iconData = runtimeIcons.get(iconName);\n if (iconData) return renderIconNode(iconData, size, color, strokeWidth);\n\n if ((EXTRA_ICON_NAMES as readonly string[]).includes(iconName)) {\n const el = createPlaceholderSvg(size, color, strokeWidth);\n // Bounded: a permanently failing chunk (ad blocker) must not accumulate\n // element refs without limit. Oldest entries are dropped — they simply\n // stay empty, like any clone the fill can't reach.\n if (pendingIcons.size >= 500) {\n pendingIcons.delete(pendingIcons.keys().next().value!);\n }\n pendingIcons.set(el, iconName);\n kickExtraIcons();\n return el;\n }\n\n console.warn(\n `Unknown Persona icon \"${iconName}\". Use registerIcons().`\n );\n return null;\n};\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Activity = [\n [\n \"path\",\n {\n d: \"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2\"\n }\n ]\n];\n\nexport { Activity as default };\n//# sourceMappingURL=activity.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ArrowDown = [\n [\"path\", { d: \"M12 5v14\" }],\n [\"path\", { d: \"m19 12-7 7-7-7\" }]\n];\n\nexport { ArrowDown as default };\n//# sourceMappingURL=arrow-down.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ArrowUp = [\n [\"path\", { d: \"m5 12 7-7 7 7\" }],\n [\"path\", { d: \"M12 19V5\" }]\n];\n\nexport { ArrowUp as default };\n//# sourceMappingURL=arrow-up.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ArrowUpRight = [\n [\"path\", { d: \"M7 7h10v10\" }],\n [\"path\", { d: \"M7 17 17 7\" }]\n];\n\nexport { ArrowUpRight as default };\n//# sourceMappingURL=arrow-up-right.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Bot = [\n [\"path\", { d: \"M12 8V4H8\" }],\n [\"rect\", { width: \"16\", height: \"12\", x: \"4\", y: \"8\", rx: \"2\" }],\n [\"path\", { d: \"M2 14h2\" }],\n [\"path\", { d: \"M20 14h2\" }],\n [\"path\", { d: \"M15 13v2\" }],\n [\"path\", { d: \"M9 13v2\" }]\n];\n\nexport { Bot as default };\n//# sourceMappingURL=bot.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ChevronDown = [[\"path\", { d: \"m6 9 6 6 6-6\" }]];\n\nexport { ChevronDown as default };\n//# sourceMappingURL=chevron-down.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ChevronUp = [[\"path\", { d: \"m18 15-6-6-6 6\" }]];\n\nexport { ChevronUp as default };\n//# sourceMappingURL=chevron-up.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ChevronRight = [[\"path\", { d: \"m9 18 6-6-6-6\" }]];\n\nexport { ChevronRight as default };\n//# sourceMappingURL=chevron-right.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ChevronLeft = [[\"path\", { d: \"m15 18-6-6 6-6\" }]];\n\nexport { ChevronLeft as default };\n//# sourceMappingURL=chevron-left.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Check = [[\"path\", { d: \"M20 6 9 17l-5-5\" }]];\n\nexport { Check as default };\n//# sourceMappingURL=check.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Clipboard = [\n [\"rect\", { width: \"8\", height: \"4\", x: \"8\", y: \"2\", rx: \"1\", ry: \"1\" }],\n [\"path\", { d: \"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2\" }]\n];\n\nexport { Clipboard as default };\n//# sourceMappingURL=clipboard.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ClipboardCopy = [\n [\"rect\", { width: \"8\", height: \"4\", x: \"8\", y: \"2\", rx: \"1\", ry: \"1\" }],\n [\"path\", { d: \"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2\" }],\n [\"path\", { d: \"M16 4h2a2 2 0 0 1 2 2v4\" }],\n [\"path\", { d: \"M21 14H11\" }],\n [\"path\", { d: \"m15 10-4 4 4 4\" }]\n];\n\nexport { ClipboardCopy as default };\n//# sourceMappingURL=clipboard-copy.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst CodeXml = [\n [\"path\", { d: \"m18 16 4-4-4-4\" }],\n [\"path\", { d: \"m6 8-4 4 4 4\" }],\n [\"path\", { d: \"m14.5 4-5 16\" }]\n];\n\nexport { CodeXml as default };\n//# sourceMappingURL=code-xml.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Copy = [\n [\"rect\", { width: \"14\", height: \"14\", x: \"8\", y: \"8\", rx: \"2\", ry: \"2\" }],\n [\"path\", { d: \"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" }]\n];\n\nexport { Copy as default };\n//# sourceMappingURL=copy.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst File = [\n [\n \"path\",\n {\n d: \"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\"\n }\n ],\n [\"path\", { d: \"M14 2v5a1 1 0 0 0 1 1h5\" }]\n];\n\nexport { File as default };\n//# sourceMappingURL=file.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst FileCode = [\n [\n \"path\",\n {\n d: \"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\"\n }\n ],\n [\"path\", { d: \"M14 2v5a1 1 0 0 0 1 1h5\" }],\n [\"path\", { d: \"M10 12.5 8 15l2 2.5\" }],\n [\"path\", { d: \"m14 12.5 2 2.5-2 2.5\" }]\n];\n\nexport { FileCode as default };\n//# sourceMappingURL=file-code.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst FileSpreadsheet = [\n [\n \"path\",\n {\n d: \"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\"\n }\n ],\n [\"path\", { d: \"M14 2v5a1 1 0 0 0 1 1h5\" }],\n [\"path\", { d: \"M8 13h2\" }],\n [\"path\", { d: \"M14 13h2\" }],\n [\"path\", { d: \"M8 17h2\" }],\n [\"path\", { d: \"M14 17h2\" }]\n];\n\nexport { FileSpreadsheet as default };\n//# sourceMappingURL=file-spreadsheet.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst FileText = [\n [\n \"path\",\n {\n d: \"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\"\n }\n ],\n [\"path\", { d: \"M14 2v5a1 1 0 0 0 1 1h5\" }],\n [\"path\", { d: \"M10 9H8\" }],\n [\"path\", { d: \"M16 13H8\" }],\n [\"path\", { d: \"M16 17H8\" }]\n];\n\nexport { FileText as default };\n//# sourceMappingURL=file-text.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ImagePlus = [\n [\"path\", { d: \"M16 5h6\" }],\n [\"path\", { d: \"M19 2v6\" }],\n [\"path\", { d: \"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5\" }],\n [\"path\", { d: \"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\" }],\n [\"circle\", { cx: \"9\", cy: \"9\", r: \"2\" }]\n];\n\nexport { ImagePlus as default };\n//# sourceMappingURL=image-plus.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Loader = [\n [\"path\", { d: \"M12 2v4\" }],\n [\"path\", { d: \"m16.2 7.8 2.9-2.9\" }],\n [\"path\", { d: \"M18 12h4\" }],\n [\"path\", { d: \"m16.2 16.2 2.9 2.9\" }],\n [\"path\", { d: \"M12 18v4\" }],\n [\"path\", { d: \"m4.9 19.1 2.9-2.9\" }],\n [\"path\", { d: \"M2 12h4\" }],\n [\"path\", { d: \"m4.9 4.9 2.9 2.9\" }]\n];\n\nexport { Loader as default };\n//# sourceMappingURL=loader.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst LoaderCircle = [[\"path\", { d: \"M21 12a9 9 0 1 1-6.219-8.56\" }]];\n\nexport { LoaderCircle as default };\n//# sourceMappingURL=loader-circle.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Mic = [\n [\"path\", { d: \"M12 19v3\" }],\n [\"path\", { d: \"M19 10v2a7 7 0 0 1-14 0v-2\" }],\n [\"rect\", { x: \"9\", y: \"2\", width: \"6\", height: \"13\", rx: \"3\" }]\n];\n\nexport { Mic as default };\n//# sourceMappingURL=mic.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Paperclip = [\n [\n \"path\",\n {\n d: \"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551\"\n }\n ]\n];\n\nexport { Paperclip as default };\n//# sourceMappingURL=paperclip.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Quote = [\n [\n \"path\",\n {\n d: \"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z\"\n }\n ],\n [\n \"path\",\n {\n d: \"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z\"\n }\n ]\n];\n\nexport { Quote as default };\n//# sourceMappingURL=quote.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst RefreshCw = [\n [\"path\", { d: \"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8\" }],\n [\"path\", { d: \"M21 3v5h-5\" }],\n [\"path\", { d: \"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16\" }],\n [\"path\", { d: \"M8 16H3v5\" }]\n];\n\nexport { RefreshCw as default };\n//# sourceMappingURL=refresh-cw.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Search = [\n [\"path\", { d: \"m21 21-4.34-4.34\" }],\n [\"circle\", { cx: \"11\", cy: \"11\", r: \"8\" }]\n];\n\nexport { Search as default };\n//# sourceMappingURL=search.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Send = [\n [\n \"path\",\n {\n d: \"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z\"\n }\n ],\n [\"path\", { d: \"m21.854 2.147-10.94 10.939\" }]\n];\n\nexport { Send as default };\n//# sourceMappingURL=send.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ShieldAlert = [\n [\n \"path\",\n {\n d: \"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\"\n }\n ],\n [\"path\", { d: \"M12 8v4\" }],\n [\"path\", { d: \"M12 16h.01\" }]\n];\n\nexport { ShieldAlert as default };\n//# sourceMappingURL=shield-alert.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ShieldCheck = [\n [\n \"path\",\n {\n d: \"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\"\n }\n ],\n [\"path\", { d: \"m9 12 2 2 4-4\" }]\n];\n\nexport { ShieldCheck as default };\n//# sourceMappingURL=shield-check.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ShieldX = [\n [\n \"path\",\n {\n d: \"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\"\n }\n ],\n [\"path\", { d: \"m14.5 9.5-5 5\" }],\n [\"path\", { d: \"m9.5 9.5 5 5\" }]\n];\n\nexport { ShieldX as default };\n//# sourceMappingURL=shield-x.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Square = [[\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\" }]];\n\nexport { Square as default };\n//# sourceMappingURL=square.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ThumbsDown = [\n [\n \"path\",\n {\n d: \"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z\"\n }\n ],\n [\"path\", { d: \"M17 14V2\" }]\n];\n\nexport { ThumbsDown as default };\n//# sourceMappingURL=thumbs-down.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ThumbsUp = [\n [\n \"path\",\n {\n d: \"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z\"\n }\n ],\n [\"path\", { d: \"M7 10v12\" }]\n];\n\nexport { ThumbsUp as default };\n//# sourceMappingURL=thumbs-up.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Upload = [\n [\"path\", { d: \"M12 3v12\" }],\n [\"path\", { d: \"m17 8-5-5-5 5\" }],\n [\"path\", { d: \"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" }]\n];\n\nexport { Upload as default };\n//# sourceMappingURL=upload.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Volume2 = [\n [\n \"path\",\n {\n d: \"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z\"\n }\n ],\n [\"path\", { d: \"M16 9a5 5 0 0 1 0 6\" }],\n [\"path\", { d: \"M19.364 18.364a9 9 0 0 0 0-12.728\" }]\n];\n\nexport { Volume2 as default };\n//# sourceMappingURL=volume-2.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst X = [\n [\"path\", { d: \"M18 6 6 18\" }],\n [\"path\", { d: \"m6 6 12 12\" }]\n];\n\nexport { X as default };\n//# sourceMappingURL=x.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst AtSign = [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"4\" }],\n [\"path\", { d: \"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8\" }]\n];\n\nexport { AtSign as default };\n//# sourceMappingURL=at-sign.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ArrowLeft = [\n [\"path\", { d: \"m12 19-7-7 7-7\" }],\n [\"path\", { d: \"M19 12H5\" }]\n];\n\nexport { ArrowLeft as default };\n//# sourceMappingURL=arrow-left.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ArrowRight = [\n [\"path\", { d: \"M5 12h14\" }],\n [\"path\", { d: \"m12 5 7 7-7 7\" }]\n];\n\nexport { ArrowRight as default };\n//# sourceMappingURL=arrow-right.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ExternalLink = [\n [\"path\", { d: \"M15 3h6v6\" }],\n [\"path\", { d: \"M10 14 21 3\" }],\n [\"path\", { d: \"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" }]\n];\n\nexport { ExternalLink as default };\n//# sourceMappingURL=external-link.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Ellipsis = [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"1\" }],\n [\"circle\", { cx: \"19\", cy: \"12\", r: \"1\" }],\n [\"circle\", { cx: \"5\", cy: \"12\", r: \"1\" }]\n];\n\nexport { Ellipsis as default };\n//# sourceMappingURL=ellipsis.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Menu = [\n [\"path\", { d: \"M4 5h16\" }],\n [\"path\", { d: \"M4 12h16\" }],\n [\"path\", { d: \"M4 19h16\" }]\n];\n\nexport { Menu as default };\n//# sourceMappingURL=menu.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst PanelLeft = [\n [\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\" }],\n [\"path\", { d: \"M9 3v18\" }]\n];\n\nexport { PanelLeft as default };\n//# sourceMappingURL=panel-left.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Plus = [\n [\"path\", { d: \"M5 12h14\" }],\n [\"path\", { d: \"M12 5v14\" }]\n];\n\nexport { Plus as default };\n//# sourceMappingURL=plus.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Minus = [[\"path\", { d: \"M5 12h14\" }]];\n\nexport { Minus as default };\n//# sourceMappingURL=minus.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Pencil = [\n [\n \"path\",\n {\n d: \"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z\"\n }\n ],\n [\"path\", { d: \"m15 5 4 4\" }]\n];\n\nexport { Pencil as default };\n//# sourceMappingURL=pencil.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Trash = [\n [\"path\", { d: \"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6\" }],\n [\"path\", { d: \"M3 6h18\" }],\n [\"path\", { d: \"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\" }]\n];\n\nexport { Trash as default };\n//# sourceMappingURL=trash.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Trash2 = [\n [\"path\", { d: \"M10 11v6\" }],\n [\"path\", { d: \"M14 11v6\" }],\n [\"path\", { d: \"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6\" }],\n [\"path\", { d: \"M3 6h18\" }],\n [\"path\", { d: \"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\" }]\n];\n\nexport { Trash2 as default };\n//# sourceMappingURL=trash-2.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Download = [\n [\"path\", { d: \"M12 15V3\" }],\n [\"path\", { d: \"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" }],\n [\"path\", { d: \"m7 10 5 5 5-5\" }]\n];\n\nexport { Download as default };\n//# sourceMappingURL=download.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Maximize = [\n [\"path\", { d: \"M8 3H5a2 2 0 0 0-2 2v3\" }],\n [\"path\", { d: \"M21 8V5a2 2 0 0 0-2-2h-3\" }],\n [\"path\", { d: \"M3 16v3a2 2 0 0 0 2 2h3\" }],\n [\"path\", { d: \"M16 21h3a2 2 0 0 0 2-2v-3\" }]\n];\n\nexport { Maximize as default };\n//# sourceMappingURL=maximize.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Minimize = [\n [\"path\", { d: \"M8 3v3a2 2 0 0 1-2 2H3\" }],\n [\"path\", { d: \"M21 8h-3a2 2 0 0 1-2-2V3\" }],\n [\"path\", { d: \"M3 16h3a2 2 0 0 1 2 2v3\" }],\n [\"path\", { d: \"M16 21v-3a2 2 0 0 1 2-2h3\" }]\n];\n\nexport { Minimize as default };\n//# sourceMappingURL=minimize.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst MessageSquare = [\n [\n \"path\",\n {\n d: \"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z\"\n }\n ]\n];\n\nexport { MessageSquare as default };\n//# sourceMappingURL=message-square.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Star = [\n [\n \"path\",\n {\n d: \"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z\"\n }\n ]\n];\n\nexport { Star as default };\n//# sourceMappingURL=star.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Eye = [\n [\n \"path\",\n {\n d: \"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0\"\n }\n ],\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"3\" }]\n];\n\nexport { Eye as default };\n//# sourceMappingURL=eye.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst History = [\n [\"path\", { d: \"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\" }],\n [\"path\", { d: \"M3 3v5h5\" }],\n [\"path\", { d: \"M12 7v5l4 2\" }]\n];\n\nexport { History as default };\n//# sourceMappingURL=history.mjs.map\n","import { resolveLauncherVariant } from \"../utils/launcher-variant\";\nimport { createElement, createNode, cx } from \"../utils/dom\";\nimport { AgentWidgetConfig, AgentWidgetLauncherTeaserConfig } from \"../types\";\nimport { positionMap } from \"../utils/positioning\";\nimport { isDockedMountMode } from \"../utils/dock\";\nimport { renderLucideIcon } from \"../utils/icons\";\nimport { DEFAULT_OVERLAY_Z_INDEX } from \"../utils/constants\";\n\nexport interface LauncherButton {\n element: HTMLButtonElement;\n update: (config: AgentWidgetConfig) => void;\n destroy: () => void;\n}\n\nexport const createLauncherButton = (\n config: AgentWidgetConfig | undefined,\n onToggle: () => void\n): LauncherButton => {\n const button = createElement(\"button\") as HTMLButtonElement;\n button.type = \"button\";\n button.innerHTML = `\n <span class=\"persona-inline-flex persona-items-center persona-justify-center persona-rounded-full persona-bg-persona-primary persona-text-white\" data-role=\"launcher-icon\">💬</span>\n <img data-role=\"launcher-image\" class=\"persona-rounded-full persona-object-cover\" alt=\"\" style=\"display:none\" />\n <span class=\"persona-flex persona-min-w-0 persona-flex-1 persona-flex-col persona-items-start persona-text-left\">\n <span class=\"persona-block persona-w-full persona-truncate persona-text-sm persona-font-semibold persona-text-persona-launcher\" data-role=\"launcher-title\"></span>\n <span class=\"persona-block persona-w-full persona-truncate persona-text-xs persona-text-persona-launcher-muted\" data-role=\"launcher-subtitle\"></span>\n </span>\n <span class=\"persona-ml-2 persona-grid persona-place-items-center persona-rounded-full persona-bg-persona-primary persona-text-persona-call-to-action\" data-role=\"launcher-call-to-action-icon\">↗</span>\n `;\n button.addEventListener(\"click\", onToggle);\n\n const update = (newConfig: AgentWidgetConfig) => {\n const launcher = newConfig.launcher ?? {};\n const dockedMode = isDockedMountMode(newConfig);\n const circle = resolveLauncherVariant(newConfig) === \"circle\";\n if (circle) {\n button.dataset.personaLauncherVariant = \"circle\";\n button.setAttribute(\"aria-label\", launcher.title ?? \"Open chat\");\n } else {\n button.removeAttribute(\"data-persona-launcher-variant\");\n button.removeAttribute(\"aria-label\");\n }\n\n const titleEl = button.querySelector(\"[data-role='launcher-title']\");\n if (titleEl) {\n const t = launcher.title ?? \"Chat Assistant\";\n titleEl.textContent = t;\n titleEl.setAttribute(\"title\", t);\n }\n\n const subtitleEl = button.querySelector(\"[data-role='launcher-subtitle']\");\n if (subtitleEl) {\n const s = launcher.subtitle ?? \"Here to help you get answers fast\";\n subtitleEl.textContent = s;\n subtitleEl.setAttribute(\"title\", s);\n }\n\n // Hide/show text container\n const textContainer = button.querySelector(\".persona-flex-col\");\n if (textContainer) {\n if (launcher.textHidden || dockedMode || circle) {\n (textContainer as HTMLElement).style.display = \"none\";\n } else {\n (textContainer as HTMLElement).style.display = \"\";\n }\n }\n\n const icon = button.querySelector<HTMLSpanElement>(\"[data-role='launcher-icon']\");\n if (icon) {\n if (launcher.agentIconHidden) {\n icon.style.display = \"none\";\n } else {\n const iconSize = launcher.agentIconSize ?? \"40px\";\n icon.style.height = iconSize;\n icon.style.width = iconSize;\n\n // Optional custom background color for the agent icon circle. When set,\n // override the default primary-color background; otherwise restore it.\n if (launcher.agentIconBackgroundColor) {\n icon.style.backgroundColor = launcher.agentIconBackgroundColor;\n icon.classList.remove(\"persona-bg-persona-primary\");\n } else {\n icon.style.backgroundColor = \"\";\n icon.classList.add(\"persona-bg-persona-primary\");\n }\n\n // Clear existing content\n icon.innerHTML = \"\";\n \n // Render icon based on priority: Lucide icon > iconUrl > agentIconText\n if (launcher.agentIconName) {\n // Use Lucide icon\n const iconSizeNum = parseFloat(iconSize) || 24;\n const iconSvg = renderLucideIcon(launcher.agentIconName, iconSizeNum * 0.6, \"var(--persona-text-inverse, #ffffff)\", 1.5);\n if (iconSvg) {\n icon.appendChild(iconSvg);\n icon.style.display = \"\";\n } else {\n // Fallback to agentIconText if Lucide icon fails\n icon.textContent = launcher.agentIconText ?? \"💬\";\n icon.style.display = \"\";\n }\n } else if (launcher.iconUrl) {\n // Use image URL - hide icon span and show img\n icon.style.display = \"none\";\n } else {\n // Use text/emoji\n icon.textContent = launcher.agentIconText ?? \"💬\";\n icon.style.display = \"\";\n }\n }\n }\n\n const img = button.querySelector<HTMLImageElement>(\"[data-role='launcher-image']\");\n if (img) {\n const iconSize = launcher.agentIconSize ?? \"40px\";\n img.style.height = iconSize;\n img.style.width = iconSize;\n if (launcher.iconUrl && !launcher.agentIconName && !launcher.agentIconHidden) {\n // Only show image if not using Lucide icon and not hidden\n img.src = launcher.iconUrl;\n img.style.display = \"block\";\n } else {\n img.style.display = \"none\";\n }\n }\n\n const callToActionIconEl = button.querySelector<HTMLSpanElement>(\"[data-role='launcher-call-to-action-icon']\");\n if (callToActionIconEl) {\n const callToActionIconSize = launcher.callToActionIconSize ?? \"32px\";\n callToActionIconEl.style.height = callToActionIconSize;\n callToActionIconEl.style.width = callToActionIconSize;\n \n // Apply background color if configured\n if (launcher.callToActionIconBackgroundColor) {\n callToActionIconEl.style.backgroundColor = launcher.callToActionIconBackgroundColor;\n callToActionIconEl.classList.remove(\"persona-bg-persona-primary\");\n } else {\n callToActionIconEl.style.backgroundColor = \"\";\n callToActionIconEl.classList.add(\"persona-bg-persona-primary\");\n }\n\n // Apply foreground/icon color if configured\n if (launcher.callToActionIconColor) {\n callToActionIconEl.style.color = launcher.callToActionIconColor;\n callToActionIconEl.classList.remove(\"persona-text-persona-call-to-action\");\n } else {\n callToActionIconEl.style.color = \"\";\n callToActionIconEl.classList.add(\"persona-text-persona-call-to-action\");\n }\n \n // Calculate padding to adjust icon size\n let paddingTotal = 0;\n if (launcher.callToActionIconPadding) {\n callToActionIconEl.style.boxSizing = \"border-box\";\n callToActionIconEl.style.padding = launcher.callToActionIconPadding;\n // Parse padding value to calculate total padding (padding applies to both sides)\n const paddingValue = parseFloat(launcher.callToActionIconPadding) || 0;\n paddingTotal = paddingValue * 2; // padding on both sides\n } else {\n callToActionIconEl.style.boxSizing = \"\";\n callToActionIconEl.style.padding = \"\";\n }\n \n if (launcher.callToActionIconHidden || circle) {\n callToActionIconEl.style.display = \"none\";\n } else {\n callToActionIconEl.style.display = dockedMode ? \"none\" : \"\";\n \n // Clear existing content\n callToActionIconEl.innerHTML = \"\";\n \n // Use Lucide icon if provided, otherwise fall back to text\n if (launcher.callToActionIconName) {\n // Calculate actual icon size by subtracting padding\n const containerSize = parseFloat(callToActionIconSize) || 24;\n const iconSize = Math.max(containerSize - paddingTotal, 8); // Ensure minimum size of 8px\n const iconSvg = renderLucideIcon(launcher.callToActionIconName, iconSize, \"currentColor\", 1.5);\n if (iconSvg) {\n callToActionIconEl.appendChild(iconSvg);\n } else {\n // Fallback to text if icon fails to render\n callToActionIconEl.textContent = launcher.callToActionIconText ?? \"↗\";\n }\n } else {\n callToActionIconEl.textContent = launcher.callToActionIconText ?? \"↗\";\n }\n }\n }\n\n const positionClass =\n launcher.position && positionMap[launcher.position]\n ? positionMap[launcher.position]\n : positionMap[\"bottom-right\"];\n\n const floatingBase =\n \"persona-fixed persona-flex persona-items-center persona-gap-3 persona-rounded-launcher persona-bg-persona-launcher persona-py-2.5 persona-pl-3 persona-pr-3 persona-transition hover:persona-translate-y-[-2px] persona-cursor-pointer\";\n const dockedBase =\n \"persona-relative persona-mt-4 persona-mb-4 persona-mx-auto persona-flex persona-items-center persona-justify-center persona-rounded-launcher persona-bg-persona-launcher persona-transition hover:persona-translate-y-[-2px] persona-cursor-pointer\";\n\n button.className = dockedMode ? dockedBase : `${floatingBase} ${positionClass}`;\n\n if (!dockedMode) {\n button.style.zIndex = String(launcher.zIndex ?? DEFAULT_OVERLAY_Z_INDEX);\n }\n\n // Apply launcher border and shadow from config (with defaults matching previous Tailwind classes)\n const defaultBorder = \"1px solid var(--persona-launcher-border, var(--persona-border, #e5e7eb))\";\n const defaultShadow = \"var(--persona-launcher-shadow, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1))\";\n\n button.style.border = launcher.border ?? defaultBorder;\n button.style.boxShadow =\n launcher.shadow !== undefined\n ? (launcher.shadow.trim() === \"\" ? \"none\" : launcher.shadow)\n : defaultShadow;\n\n if (dockedMode) {\n // Docked mode uses a 0px column when closed and hides this button; keep no hit target.\n button.style.width = \"0\";\n button.style.minWidth = \"0\";\n button.style.maxWidth = \"0\";\n button.style.padding = \"0\";\n button.style.overflow = \"hidden\";\n button.style.border = \"none\";\n button.style.boxShadow = \"none\";\n } else {\n button.style.width = \"\";\n button.style.minWidth = \"\";\n button.style.maxWidth = launcher.collapsedMaxWidth ?? \"\";\n button.style.justifyContent = \"\";\n button.style.padding = \"\";\n button.style.overflow = \"\";\n }\n };\n\n const destroy = () => {\n button.removeEventListener(\"click\", onToggle);\n button.remove();\n };\n\n // Initial update\n if (config) {\n update(config);\n }\n\n return {\n element: button,\n update,\n destroy\n };\n};\n\n/** Teaser bubble handle. `dismiss(true)` also writes the persisted flag. */\nexport interface LauncherTeaser {\n element: HTMLElement;\n show: () => void;\n dismiss: (persist: boolean) => void;\n}\n\n/** \"auto\" covers restored/hook-driven opens: they never persist the teaser flag. */\nexport type LauncherOpenOrigin = \"user\" | \"auto\";\n\nexport interface LauncherSurface {\n /** Positioned wrapper. Sibling teaser + launcher live inside it. */\n element: HTMLElement;\n launcher: LauncherButton;\n /** Null when no teaser is configured for the current config. */\n teaser: LauncherTeaser | null;\n /** Opening the panel consumes the teaser; closing never resurrects it. */\n setPanelOpen: (open: boolean, origin?: LauncherOpenOrigin) => void;\n update: (config: AgentWidgetConfig) => void;\n destroy: () => void;\n}\n\nconst TEASER_KEY_SUFFIX = \"teaser-dismissed\";\n\n/** Consumed teaser keys for this page load; also the blocked-storage fallback. */\nconst teaserMemoryDismissed = new Set<string>();\n\nconst teaserStorageKey = (config?: AgentWidgetConfig): string => {\n const persist = config?.persistState;\n const prefix =\n (typeof persist === \"object\" ? persist?.keyPrefix : undefined) ?? \"persona-\";\n return `${prefix}${TEASER_KEY_SUFFIX}`;\n};\n\n// localStorage access throws (not just fails) in Safari private mode and\n// partitioned iframes, so every access falls back to the in-memory set.\nconst readTeaserDismissed = (key: string, useStorage: boolean): boolean => {\n if (teaserMemoryDismissed.has(key)) return true;\n if (!useStorage) return false;\n try {\n return window.localStorage.getItem(key) === \"1\";\n } catch {\n return false;\n }\n};\n\nconst writeTeaserDismissed = (key: string, useStorage: boolean): void => {\n teaserMemoryDismissed.add(key);\n if (!useStorage) return;\n try {\n window.localStorage.setItem(key, \"1\");\n } catch {\n /* blocked storage: the in-memory flag above is the fallback */\n }\n};\n\nconst prefersReducedMotion = (): boolean =>\n typeof window !== \"undefined\" &&\n typeof window.matchMedia === \"function\" &&\n window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n\nconst resolveTeaserConfig = (\n config: AgentWidgetConfig | undefined\n): AgentWidgetLauncherTeaserConfig | null => {\n const teaser = config?.launcher?.teaser;\n if (!teaser || !teaser.text) return null;\n if (config?.launcher?.enabled === false) return null;\n if (isDockedMountMode(config ?? {})) return null;\n return teaser;\n};\n\n/**\n * Launcher wrapper owning the collapsed button and its optional teaser bubble.\n * Both the critical `launcher.global.js` bundle and the full widget build the\n * launcher through this, so teaser behavior and cleanup are identical on the\n * eager and deferred paths.\n */\nexport const createLauncherSurface = (\n config: AgentWidgetConfig | undefined,\n onToggle: () => void\n): LauncherSurface => {\n const wrapper = createElement(\"div\", \"persona-launcher-surface\");\n wrapper.setAttribute(\"data-persona-launcher-surface\", \"true\");\n\n let currentConfig: AgentWidgetConfig = config ?? {};\n let teaserConfig: AgentWidgetLauncherTeaserConfig | null = null;\n let teaserElement: HTMLElement | null = null;\n let dismissButton: HTMLButtonElement | null = null;\n let teaserTextButton: HTMLButtonElement | null = null;\n let timer: ReturnType<typeof setTimeout> | null = null;\n let visible = false;\n let shown = false;\n let consumed = false;\n let panelOpen = false;\n\n const usesStorage = (): boolean =>\n (teaserConfig?.frequency ?? \"once\") === \"once\" &&\n currentConfig.persistState !== false;\n\n const clearTimer = () => {\n if (timer !== null) {\n clearTimeout(timer);\n timer = null;\n }\n };\n\n const hideBubble = () => {\n if (!teaserElement || !visible) return;\n visible = false;\n teaserElement.hidden = true;\n };\n\n const dismiss = (persist: boolean) => {\n clearTimer();\n consumed = true;\n hideBubble();\n writeTeaserDismissed(teaserStorageKey(currentConfig), persist && usesStorage());\n };\n\n /**\n * Click-through and launcher clicks consume; only a seen teaser persists.\n * An automatic open is never user intent, so it consumes in memory only.\n */\n const consumeForOpen = (origin: LauncherOpenOrigin) => {\n if (!teaserConfig || consumed) return;\n dismiss(origin === \"user\" && visible);\n };\n\n const show = () => {\n timer = null;\n if (!teaserElement || consumed || panelOpen) return;\n shown = true;\n visible = true;\n teaserElement.hidden = false;\n if (prefersReducedMotion() || typeof teaserElement.animate !== \"function\") return;\n teaserElement.animate(\n [\n { opacity: \"0\", transform: \"translateY(6px)\" },\n { opacity: \"1\", transform: \"none\" },\n ],\n { duration: 220, easing: \"ease-out\", fill: \"backwards\" }\n );\n };\n\n const schedule = () => {\n if (!teaserConfig || !teaserElement) return;\n if (consumed || shown || panelOpen) return;\n if (readTeaserDismissed(teaserStorageKey(currentConfig), usesStorage())) return;\n clearTimer();\n timer = setTimeout(show, Math.max(0, teaserConfig.delayMs ?? 0));\n };\n\n const handleTeaserClick = () => {\n dismiss(usesStorage());\n onToggle();\n };\n\n const handleDismissClick = (event: MouseEvent) => {\n event.stopPropagation();\n dismiss(usesStorage());\n };\n\n const handleLauncherToggle = () => {\n consumeForOpen(\"user\");\n onToggle();\n };\n\n const launcher = createLauncherButton(config, handleLauncherToggle);\n\n const removeTeaserElement = () => {\n clearTimer();\n teaserTextButton?.removeEventListener(\"click\", handleTeaserClick);\n dismissButton?.removeEventListener(\"click\", handleDismissClick);\n teaserElement?.remove();\n teaserElement = null;\n teaserTextButton = null;\n dismissButton = null;\n visible = false;\n };\n\n const buildTeaserElement = () => {\n teaserTextButton = createNode(\"button\", {\n className: \"persona-launcher-teaser-text\",\n attrs: { type: \"button\" },\n });\n teaserTextButton.addEventListener(\"click\", handleTeaserClick);\n\n dismissButton = createNode(\"button\", {\n className: \"persona-launcher-teaser-dismiss\",\n attrs: { type: \"button\" },\n text: \"\\u00d7\",\n });\n dismissButton.addEventListener(\"click\", handleDismissClick);\n\n teaserElement = createNode(\n \"div\",\n {\n className: \"persona-launcher-teaser\",\n attrs: {\n \"data-persona-launcher-teaser\": \"true\",\n role: \"status\",\n \"aria-live\": \"polite\",\n hidden: \"\",\n },\n },\n teaserTextButton,\n dismissButton\n );\n wrapper.insertBefore(teaserElement, launcher.element);\n };\n\n /**\n * The wrapper is `display: contents` until a teaser exists, so the launcher\n * keeps its own fixed placement; with a teaser the wrapper takes over the\n * corner and the button becomes static inside it.\n */\n const applyPlacement = () => {\n const position = currentConfig.launcher?.position ?? \"bottom-right\";\n const positionClass = positionMap[position] ?? positionMap[\"bottom-right\"];\n\n if (!teaserElement) {\n wrapper.className = \"persona-launcher-surface\";\n wrapper.removeAttribute(\"data-teaser\");\n wrapper.style.zIndex = \"\";\n launcher.element.style.position = \"\";\n return;\n }\n\n wrapper.className = cx(\"persona-launcher-surface\", positionClass);\n wrapper.setAttribute(\"data-teaser\", position);\n wrapper.style.zIndex = String(\n currentConfig.launcher?.zIndex ?? DEFAULT_OVERLAY_Z_INDEX\n );\n launcher.element.style.position = \"static\";\n };\n\n const syncTeaser = (nextConfig: AgentWidgetConfig) => {\n const next = resolveTeaserConfig(nextConfig);\n teaserConfig = next;\n\n if (!next) {\n removeTeaserElement();\n return;\n }\n\n // `shown` is deliberately not reset here: at most one appearance per load.\n if (!teaserElement) buildTeaserElement();\n\n teaserTextButton!.textContent = next.text;\n dismissButton!.hidden = next.dismissible === false;\n dismissButton!.setAttribute(\n \"aria-label\",\n next.dismissLabel ?? \"Dismiss message\"\n );\n schedule();\n };\n\n const update = (nextConfig: AgentWidgetConfig) => {\n currentConfig = nextConfig;\n launcher.update(nextConfig);\n syncTeaser(nextConfig);\n applyPlacement();\n };\n\n const setPanelOpen = (open: boolean, origin: LauncherOpenOrigin = \"user\") => {\n panelOpen = open;\n if (!open) return;\n consumeForOpen(origin);\n };\n\n const destroy = () => {\n removeTeaserElement();\n launcher.destroy();\n wrapper.remove();\n };\n\n wrapper.appendChild(launcher.element);\n if (config) {\n syncTeaser(config);\n applyPlacement();\n }\n\n return {\n element: wrapper,\n launcher,\n get teaser(): LauncherTeaser | null {\n if (!teaserElement) return null;\n return { element: teaserElement, show, dismiss };\n },\n setPanelOpen,\n update,\n destroy,\n };\n};\n","/**\n * Critical-path launcher entry: built to `launcher.global.js` (IIFE).\n *\n * Ships ONLY the real collapsed launcher surface (`createLauncherSurface`,\n * which carries the optional launcher teaser) plus the\n * theme application path, so the launcher paints pixel-identically to the full\n * widget from a tiny bundle. The heavy conversation panel is deferred until\n * first open by the installer (Phase 2).\n *\n * Icons: the CORE tier of the registry ships in this bundle, which covers the\n * launcher defaults (`bot`, `arrow-up-right`) and every widget-emitted name,\n * so default-config launchers paint with no flash. A site that configures an\n * EXTRA-tier icon (`launcher.agentIconName: \"shopping-cart\"`) paints a\n * correctly-sized empty placeholder and fills within one round-trip of the\n * `icons-extra.js` sibling chunk (loader registered below). See the\n * \"Deferred Launcher Loading\" pattern in AGENTS.md.\n *\n * Public global (via tsdown `globalName: \"AgentWidgetLauncher\"`):\n *\n * window.AgentWidgetLauncher.mount({ target, config, onOpen })\n * → { root, element, update, destroy }\n */\nimport { createLauncherSurface } from \"./components/launcher\";\nimport { applyLauncherThemeVariables } from \"./utils/theme\";\nimport { DEFAULT_LAUNCHER_CONFIG, DEFAULT_LAUNCHER_V5 } from \"./defaults\";\nimport { setIconsExtraLoader } from \"./icons-extra-loader\";\nimport type { AgentWidgetConfig } from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Deferred extra-icons loading (same sibling-URL scheme as index-global.ts,\n// derived from THIS script's src). Registered at module evaluation:\n// `document.currentScript` is null once execution leaves the initial run.\n// ---------------------------------------------------------------------------\nconst launcherScriptSrc: string | null =\n typeof document !== \"undefined\"\n ? ((document.currentScript as HTMLScriptElement | null)?.src ?? null)\n : null;\n\nsetIconsExtraLoader(() => {\n const chunkUrl = launcherScriptSrc?.replace(\n /launcher\\.global\\.js($|\\?)/,\n \"icons-extra.js$1\",\n );\n if (!chunkUrl || chunkUrl === launcherScriptSrc) {\n return Promise.reject(\n new Error(\n \"Could not derive the icons-extra.js URL from the launcher script URL \" +\n `(${launcherScriptSrc ?? \"unavailable\"}). Self-hosted deployments that ` +\n \"rename launcher.global.js should host icons-extra.js alongside it.\",\n ),\n );\n }\n return import(/* @vite-ignore */ chunkUrl);\n});\n\nexport interface AgentWidgetLauncherMountOptions {\n /** Where to mount. Defaults to `document.body` (the floating launcher is `position: fixed`). */\n target?: string | HTMLElement;\n /** The same widget config the full widget will receive: drives theme, icons, position, copy. */\n config?: AgentWidgetConfig;\n /** Called when the launcher is clicked; the installer loads the full widget and opens the panel. */\n onOpen: () => void;\n}\n\nexport interface AgentWidgetLauncherHandle {\n /** The `[data-persona-root]` wrapper that carries the theme CSS variables. */\n root: HTMLElement;\n /** The launcher button element itself. */\n element: HTMLButtonElement;\n /** Re-apply theme + re-render the launcher with new config. */\n update: (config: AgentWidgetConfig) => void;\n /** Remove the critical launcher (called at handoff once the full widget is mounted). */\n destroy: () => void;\n}\n\n/**\n * Marks the critical launcher's wrapper so the installer can find/remove it at\n * handoff without disturbing the full widget's own `[data-persona-root]`.\n */\nexport const CRITICAL_LAUNCHER_ATTR = \"data-persona-launcher-critical\";\n\nconst resolveTarget = (target?: string | HTMLElement): HTMLElement => {\n if (target instanceof HTMLElement) return target;\n if (typeof target === \"string\") {\n const el = document.querySelector<HTMLElement>(target);\n if (el) return el;\n }\n return document.body;\n};\n\nconst mergeCriticalLauncherConfig = (\n config?: AgentWidgetConfig\n): AgentWidgetConfig => ({\n ...config,\n launcher: {\n ...DEFAULT_LAUNCHER_CONFIG,\n ...(config?.future?.v5Defaults === true ? DEFAULT_LAUNCHER_V5 : {}),\n ...config?.launcher,\n dock: {\n ...DEFAULT_LAUNCHER_CONFIG.dock,\n ...config?.launcher?.dock,\n },\n },\n});\n\n/**\n * Mount the real collapsed launcher from the critical bundle.\n *\n * Mirrors the full widget's DOM exactly (`runtime/init.ts` + `ui.ts`): a\n * `[data-persona-root]` wrapper carries the theme CSS variables and the launcher\n * button is its child. Keeping the theme vars on the wrapper (not the button)\n * leaves the button's own inline style matching the full widget's, so\n * the eventual mount-then-remove handoff is invisible.\n */\nexport const mount = (\n options: AgentWidgetLauncherMountOptions\n): AgentWidgetLauncherHandle => {\n if (typeof window === \"undefined\" || typeof document === \"undefined\") {\n throw new Error(\n \"AgentWidgetLauncher can only be mounted in a browser environment\"\n );\n }\n\n const { onOpen } = options;\n const target = resolveTarget(options.target);\n\n // Render from the same launcher defaults the full widget uses without pulling\n // the full widget default object into the critical bundle.\n const config = mergeCriticalLauncherConfig(options.config);\n\n const root = document.createElement(\"div\");\n root.setAttribute(\"data-persona-root\", \"true\");\n root.setAttribute(CRITICAL_LAUNCHER_ATTR, \"true\");\n applyLauncherThemeVariables(root, config);\n\n const surface = createLauncherSurface(config, onOpen);\n root.appendChild(surface.element);\n target.appendChild(root);\n\n return {\n root,\n element: surface.launcher.element,\n update: (next: AgentWidgetConfig) => {\n const merged = mergeCriticalLauncherConfig(next);\n applyLauncherThemeVariables(root, merged);\n surface.update(merged);\n },\n // Handoff destroys the whole surface, so a pending teaser timer cannot\n // outlive the critical launcher.\n destroy: () => {\n surface.destroy();\n root.remove();\n },\n };\n};\n\n// Note: the `window.AgentWidgetLauncher` global is created by the IIFE build's\n// `globalName` (tsdown.config.ts) at build time. The installer\n// (`install.ts`) declares the `Window` augmentation it needs; this entry never\n// reads the global, so re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IACP,IAAMwD,EAASwrB,GAA4BpG,GAC3CxG,GAA4BmN,EAAM/rB,GAClCuP,EAAQkW,OAAOzlB,IAIjB0nB,QAAA,KACEnY,EAAQmY,UACRqE,EAAKvF,YAGXhqB,CAAA,C,CAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["resolveLauncherVariant","e","config","launcher","variant","future","v5Defaults","CIRCLE_LAUNCHER_TOKENS","background","foreground","border","size","iconSize","borderRadius","shadow","offset","createElement","t","element","document","tag","className","n","createNode","children","options","r","text","textContent","attrs","name","value","Object","entries","setAttribute","style","source","property","keys","appendable","filter","child","length","append","positionMap","isEmbeddedLayout","layout","embedded","enabled","sidebarMode","mountMode","isObject","Array","isArray","deepMerge","base","override","merged","key","existing","record","parseColor","color","trim","hex","exec","full","map","c","join","parseInt","slice","i","match","parts","split","test","pop","channels","part","Number","parseFloat","endsWith","NaN","a","some","isFinite","luminance","rgb","reduce","channel","sum","hexColor","Math","round","toString","padStart","mix","target","amount","inferBrandColorScheme","neutral","brand","OPT_IN_THEME_STYLE_PATHS","STYLE_PROVENANCE","Symbol","for","hasExplicitStylePath","stored","prototype","hasOwnProperty","call","values","path","valueAt","explicit","includes","index","suppliedPath","DEFAULT_FLOATING_LAUNCHER_WIDTH","DEFAULT_LAUNCHER_CONFIG","dock","side","width","title","subtitle","agentIconText","agentIconName","headerIconName","position","heightOffset","autoExpand","callToActionIconHidden","agentIconSize","headerIconSize","closeButtonPaddingX","closeButtonPaddingY","callToActionIconName","callToActionIconText","callToActionIconSize","callToActionIconPadding","callToActionIconColor","callToActionIconBackgroundColor","closeButtonBackgroundColor","clearChat","backgroundColor","borderColor","placement","iconName","showTooltip","tooltipText","paddingX","paddingY","headerIconHidden","DEFAULTS_BASE","apiUrl","clientToken","agentId","theme","darkTheme","colorScheme","tooltip","delayMs","skipDelayMs","copy","inputPlaceholder","sendButtonLabel","sendButton","borderWidth","useIcon","iconText","statusIndicator","visible","idleText","connectingText","connectedText","errorText","voiceRecognition","pauseDuration","iconColor","recordingIconColor","recordingBackgroundColor","recordingBorderColor","features","showReasoning","showToolCalls","scrollToBottom","label","streamingIndicator","scrollBehavior","scrollDurationMs","transition","mode","anchorTopOffset","showActivityWhilePinned","toolCallDisplay","collapsedMode","activePreview","grouped","groupedMode","groupBoundary","previewMaxLines","expandable","loadingAnimation","reasoningDisplay","streamAnimation","type","placeholder","speed","duration","askUserQuestion","slideInMs","freeTextLabel","freeTextPlaceholder","submitLabel","history","presentation","showScopeStatus","showDelete","showDeleteAll","suggestionChips","suggestionChipsConfig","fontFamily","fontWeight","header","showIcon","showTitle","showSubtitle","showCloseButton","showClearChat","messages","avatar","show","timestamp","groupConsecutive","slots","markdown","gfm","breaks","disableDefaultStyles","messageActions","showCopy","showUpvote","showDownvote","visibility","align","debug","DEFAULTS_V4","DEFAULT_LAUNCHER_V5","DEFAULTS_V5","errorDisplay","approval","resolvedDisplay","primaryAction","keyboardShortcuts","loadingIndicator","artifacts","iconVisibility","groupAppearance","appearance","composer","contentMaxWidth","topFade","assistant","resolveDefaultsVersion","overlay","resolveDefaults","DEFAULT_PALETTE_BASE","colors","primary","secondary","accent","gray","success","warning","error","info","purple","teal","spacing","s","k","typography","sans","serif","mono","fontSize","xs","sm","lg","xl","normal","medium","semibold","bold","lineHeight","tight","relaxed","shadows","none","md","borders","radius","DEFAULT_SEMANTIC_BASE","surface","container","textMuted","textInverse","divider","interactive","default","hover","focus","active","disabled","feedback","DEFAULT_COMPONENTS_BASE","button","padding","ghost","hoverBackground","input","ring","panel","maxWidth","height","maxHeight","inset","canvasBackground","modes","floating","inline","docked","sidebar","mobile","minimalPadding","iconBackground","iconForeground","message","gap","user","introCard","suggestion","chip","itemGap","minHeight","hoverBorder","pressedBackground","focusRing","disabledOpacity","card","list","toolBubble","reasoningBubble","scrollbar","thumb","track","inlineCode","link","prose","codeBlock","textColor","table","headerBackground","hr","blockquote","collapsibleWidget","voice","recording","indicator","processing","icon","speaking","requested","approve","deny","attachment","image","eventStream","badge","flow","step","reasoning","tool","agent","artifact","pane","toolbarBackground","DEFAULT_PALETTE_GRAY_V4","DEFAULT_PALETTE_V4","DEFAULT_PALETTE_V5","DEFAULT_SEMANTIC_V4","DEFAULT_SEMANTIC_V5","DEFAULT_COMPONENTS_V4","DEFAULT_COMPONENTS_V5","hoverForeground","activity","labelSize","indent","transcriptGap","responseGap","groupIndent","groupGap","groupPadding","bodyPadding","bodyFontWeight","sectionGap","bodySurface","borderBottom","iconScale","iconPadding","controlSize","controlIconSize","controlStrokeWidth","actionIconForeground","controlBorderRadius","controlHoverBackground","controlHoverForeground","controlFocusOutline","fullscreenGap","topFadeHeight","hoverBorderColor","chromeBackground","chromeBorder","titleColor","mutedColor","expandedPadding","expandedBorderRadius","sendIconSize","sendButtonRadius","footerBorder","overflowMenu","overlayBand","focusBorderColor","resolveThemeDefaults","resolveThemeDefaultsVersion","palette","semantic","components","resolveTokenValue","startsWith","current","mergeRecords","result","createTheme","baseTheme","userConfig","kind","tokens","field","legacySurface","suppliedHeader","suppliedComposer","suppliedMessage","validate","validation","errors","warnings","push","severity","valid","validateTheme","Error","plugins","plugin","transform","V","emitAliases","alias","sources","rows","charCodeAt","cssVars","COMMON_ALIASES","launcherThemeToCssVariables","resolved","resolveObject","obj","prefix","resolvedValue","resolveTokens","token","replace","canonicalThemeVariables","launcherFg","emitLauncherMuted","toLowerCase","Boolean","resolveHeaderIconPadding","DARK_COMPONENTS_BASE","dangerForeground","confirm","dangerBackground","scrim","DARK_PALETTE_V4","DARK_PALETTE_V5","DARK_COMPONENTS_V4","DARK_COMPONENTS_V5","normalizeThemeConfig","getColorScheme","documentElement","classList","contains","window","matchMedia","matches","getColorSchemeFromConfig","getActiveTheme","scheme","explicitTheme","deriveBrandTheme","ramp","stop","ink","dark","l","footerBackground","b","max","min","font","density","compact","comfortable","spacious","railHeader","elevation","flat","node","borderKey","allShadows","o","lightThemeConfig","darkThemeConfig","applyPanelModeWidth","isPanelWidthMode","lightWidth","darkWidth","createDarkTheme","darkDefaults","resolveDarkDefaults","createLightTheme","defineProperty","CONSUMER_PATHS","hasExplicitThemeStyle","selected","componentPath","appliedVariables","WeakMap","applyLauncherThemeVariables","applyVariables","get","removeProperty","set","setProperty","isDockedMountMode","renderIconNode","iconData","svg","createElementNS","String","viewBox","fill","stroke","strokeWidth","elementData","tagName","appendChild","setLoader","Ie","load","Le","fallbackImport","resetOnSetLoader","loader","moduleCache","loadPromise","Promise","resolve","importChunk","then","mod","catch","err","reject","provide","getSync","import","setIconsExtraLoader","loadIconsExtra","EXTRA_ICON_NAMES","runtimeIcons","Map","\"activity\"","d","\"bot\"","x","y","rx","\"check\"","\"clipboard\"","ry","\"copy\"","\"file\"","FileIcon","cx","cy","\"loader\"","\"mic\"","\"paperclip\"","\"quote\"","\"search\"","\"send\"","\"square\"","\"upload\"","\"x\"","\"ellipsis\"","\"menu\"","\"plus\"","\"minus\"","\"pencil\"","\"trash\"","\"download\"","\"maximize\"","\"minimize\"","\"star\"","\"eye\"","\"history\"","pendingIcons","extraIconsLoaded","extraReadySubscribers","Set","kickExtraIcons","X","data","icons","has","fillPendingIcons","el","delete","real","removeAttribute","firstChild","subs","clear","cb","notifyExtraIconsReady","__eagerlyProvideExtraIcons","EXTRA_LUCIDE_ICONS","console","warn","renderLucideIcon","createPlaceholderSvg","next","createLauncherButton","innerHTML","addEventListener","onToggle","update","newConfig","dockedMode","circle","dataset","personaLauncherVariant","titleEl","querySelector","subtitleEl","textContainer","textHidden","display","agentIconHidden","u","agentIconBackgroundColor","remove","add","iconSizeNum","iconSvg","iconUrl","img","src","callToActionIconEl","f","paddingTotal","boxSizing","positionClass","zIndex","boxShadow","minWidth","overflow","collapsedMaxWidth","justifyContent","destroy","removeEventListener","teaserMemoryDismissed","teaserStorageKey","persist","persistState","keyPrefix","createLauncherSurface","wrapper","currentConfig","teaserConfig","teaserElement","dismissButton","teaserTextButton","timer","shown","consumed","panelOpen","usesStorage","frequency","clearTimer","clearTimeout","dismiss","h","p","hidden","writeTeaserDismissed","useStorage","localStorage","setItem","consumeForOpen","origin","m","animate","opacity","easing","handleTeaserClick","handleDismissClick","event","stopPropagation","removeTeaserElement","applyPlacement","E","syncTeaser","teaser","resolveTeaserConfig","nextConfig","role","insertBefore","dismissible","dismissLabel","readTeaserDismissed","getItem","setTimeout","S","setPanelOpen","g","open","launcherScriptSrc","currentScript","chunkUrl","CRITICAL_LAUNCHER_ATTR","mergeCriticalLauncherConfig","nt","mount","onOpen","HTMLElement","body","resolveTarget","root"],"sources":["../src/utils/launcher-variant.ts","../src/utils/dom.ts","../src/utils/positioning.ts","../src/utils/panel-config.ts","../src/utils/deep-merge.ts","../src/utils/approval-config.ts","../src/utils/defaults-provenance.ts","../src/utils/brand.ts","../src/utils/style-provenance.ts","../src/defaults.ts","../src/utils/activity-display-defaults.ts","../src/utils/tokens.ts","../src/utils/theme.ts","../src/utils/dock.ts","../src/utils/icon-node.ts","../src/icons-extra-loader.ts","../src/utils/chunk-loader.ts","../src/utils/icons.ts","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/activity.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/arrow-down.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/arrow-up.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/arrow-up-right.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/bot.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/chevron-down.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/chevron-up.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/chevron-right.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/chevron-left.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/check.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/clipboard.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/clipboard-copy.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/code-xml.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/copy.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/file.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/file-code.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/file-spreadsheet.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/file-text.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/image-plus.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/loader.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/loader-circle.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/mic.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/paperclip.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/quote.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/refresh-cw.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/search.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/send.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/shield-alert.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/shield-check.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/shield-x.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/square.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/thumbs-down.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/thumbs-up.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/upload.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/volume-2.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/x.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/at-sign.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/arrow-left.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/arrow-right.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/external-link.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/ellipsis.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/menu.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/panel-left.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/plus.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/minus.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/pencil.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/trash.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/trash-2.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/download.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/maximize.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/minimize.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/message-square.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/star.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/eye.mjs","../../../node_modules/.pnpm/lucide@1.18.0/node_modules/lucide/dist/esm/icons/history.mjs","../src/components/launcher.ts","../src/launcher-global.ts"],"sourcesContent":["import type { AgentWidgetConfig } from \"../types\";\nimport type { LauncherTokens } from \"../types/theme\";\n\nexport const resolveLauncherVariant = (config?: Pick<AgentWidgetConfig, \"launcher\" | \"future\">): \"pill\" | \"circle\" =>\n config?.launcher?.variant ?? (config?.future?.v5Defaults === true ? \"circle\" : \"pill\");\n\nexport const CIRCLE_LAUNCHER_TOKENS: LauncherTokens = {\n background: \"semantic.colors.primary\",\n foreground: \"semantic.colors.textInverse\",\n border: \"transparent\",\n size: \"48px\",\n iconSize: \"24px\",\n borderRadius: \"palette.radius.full\",\n shadow: \"0 8px 24px rgba(0,0,0,.16)\",\n offset: \"20px\",\n};\n","/**\n * DOM utility functions\n */\nexport const createElement = <K extends keyof HTMLElementTagNameMap>(\n tag: K,\n className?: string\n): HTMLElementTagNameMap[K] => {\n const element = document.createElement(tag);\n if (className) {\n element.className = className;\n }\n return element;\n};\n\nexport const createElementInDocument = <K extends keyof HTMLElementTagNameMap>(\n documentRef: Document,\n tag: K,\n className?: string\n): HTMLElementTagNameMap[K] => {\n const element = documentRef.createElement(tag);\n if (className) {\n element.className = className;\n }\n return element;\n};\n\nexport const createFragment = (): DocumentFragment => {\n return document.createDocumentFragment();\n};\n\nexport interface CreateNodeOptions {\n /** Sets `element.className`. */\n className?: string;\n /** Sets `element.textContent` before any `children` are appended. */\n text?: string;\n /** Attribute name → value pairs applied via `setAttribute`. */\n attrs?: Record<string, string>;\n /**\n * Inline styles. Nullish (`undefined`/`null`) values are skipped so callers\n * can inline conditionals (e.g. `borderColor: cfg.borderColor`) without an\n * `if` per property. Note this only *sets* values, it never clears them, so\n * prefer it for constructing fresh elements rather than re-styling live ones.\n */\n style?: Partial<CSSStyleDeclaration>;\n}\n\n/**\n * Ergonomic element factory that bundles the className + attribute + style +\n * children boilerplate the widget's DOM builders otherwise repeat by hand.\n *\n * `createElement` stays the right tool for the simple `(tag, className)` case;\n * reach for `createNode` when a node also needs attributes, inline styles, or\n * up-front children. Nullish `children` are skipped so callers can inline\n * conditionals (e.g. `maybeIcon && el`).\n */\nexport const createNode = <K extends keyof HTMLElementTagNameMap>(\n tag: K,\n options: CreateNodeOptions = {},\n ...children: Array<Node | string | null | undefined>\n): HTMLElementTagNameMap[K] => {\n const element = document.createElement(tag);\n\n if (options.className) {\n element.className = options.className;\n }\n if (options.text !== undefined) {\n element.textContent = options.text;\n }\n if (options.attrs) {\n for (const [name, value] of Object.entries(options.attrs)) {\n element.setAttribute(name, value);\n }\n }\n if (options.style) {\n const style = element.style as unknown as Record<string, string>;\n const source = options.style as Record<string, string | null | undefined>;\n for (const property of Object.keys(source)) {\n const value = source[property];\n if (value != null) {\n style[property] = value;\n }\n }\n }\n\n const appendable = children.filter(\n (child): child is Node | string => child != null\n );\n if (appendable.length > 0) {\n element.append(...appendable);\n }\n\n return element;\n};\n\n/**\n * Join truthy class-name fragments into a single space-separated string\n * (the clsx / classnames pattern). Falsy fragments\n * (`false` / `null` / `undefined` / `\"\"`) are dropped, so conditional classes\n * read inline as `cond && \"persona-foo\"` instead of imperative\n * `classList.add(...)` branches.\n */\nexport const cx = (\n ...parts: Array<string | false | null | undefined>\n): string => parts.filter(Boolean).join(\" \");\n\n\n\n\n\n\n\n","export const positionMap: Record<\n \"bottom-right\" | \"bottom-left\" | \"top-right\" | \"top-left\",\n string\n> = {\n \"bottom-right\": \"persona-bottom-6 persona-right-6\",\n \"bottom-left\": \"persona-bottom-6 persona-left-6\",\n \"top-right\": \"persona-top-6 persona-right-6\",\n \"top-left\": \"persona-top-6 persona-left-6\"\n};\n\n\n\n\n\n\n\n\n","import type { AgentWidgetConfig, AgentWidgetConfigPatch } from \"../types\";\n\nexport const PANEL_WIDTH_VAR = \"var(--persona-components-panel-width)\";\n\n/**\n * Provenance for legacy panel geometry aliases. Config merging materializes\n * launcher defaults, so values alone cannot distinguish a caller's alias from\n * an inherited v4 default. The enumerable symbol survives object spreads while\n * remaining absent from JSON, generated snippets, and the public config shape.\n */\nexport const PANEL_ALIAS_PROVENANCE = Symbol(\"persona.panelAliasProvenance\");\n\nexport type PanelAliasProvenance = {\n launcherWidth: boolean;\n legacyLauncherWidth: boolean;\n sidebarWidth: boolean;\n dockWidth: boolean;\n};\n\ntype WithPanelAliasProvenance = {\n [PANEL_ALIAS_PROVENANCE]?: PanelAliasProvenance;\n};\n\nconst hasOwn = (value: object | undefined, key: string): boolean =>\n value != null && Object.prototype.hasOwnProperty.call(value, key);\n\nconst hasOwnDefined = (value: object | undefined, key: string): boolean =>\n hasOwn(value, key) && (value as Record<string, unknown>)[key] !== undefined;\n\nconst fromRawConfig = (\n config?: Partial<AgentWidgetConfig>\n): PanelAliasProvenance => ({\n launcherWidth: hasOwnDefined(config?.launcher, \"width\"),\n legacyLauncherWidth: hasOwnDefined(config, \"launcherWidth\"),\n sidebarWidth: hasOwnDefined(config?.launcher, \"sidebarWidth\"),\n dockWidth: hasOwnDefined(config?.launcher?.dock, \"width\"),\n});\n\nexport const getPanelAliasProvenance = (\n config?: Partial<AgentWidgetConfig>\n): PanelAliasProvenance => {\n const stored = (config as WithPanelAliasProvenance | undefined)?.[PANEL_ALIAS_PROVENANCE];\n return stored ? { ...stored } : fromRawConfig(config);\n};\n\nexport const setPanelAliasProvenance = <T extends object>(\n config: T,\n provenance: PanelAliasProvenance\n): T => {\n Object.defineProperty(config, PANEL_ALIAS_PROVENANCE, {\n value: provenance,\n enumerable: true,\n configurable: true,\n });\n return config;\n};\n\n/** Stamp a defaulted config with aliases supplied by the raw input. */\nexport const inheritPanelAliasProvenance = <T extends object>(\n result: T,\n rawConfig?: Partial<AgentWidgetConfig>\n): T => setPanelAliasProvenance(result, getPanelAliasProvenance(rawConfig));\n\n/** Apply own alias keys in a live patch, including explicit-undefined resets. */\nexport const updatePanelAliasProvenance = (\n previous: Partial<AgentWidgetConfig>,\n patch: AgentWidgetConfigPatch\n): PanelAliasProvenance => {\n // A config spread remains marked. Treat it as an already-normalized full\n // config rather than mistaking its materialized launcher defaults for a\n // patch that explicitly supplied every alias.\n const patchProvenance = (patch as WithPanelAliasProvenance)[PANEL_ALIAS_PROVENANCE];\n if (patchProvenance) return { ...patchProvenance };\n\n const next = getPanelAliasProvenance(previous);\n if (hasOwn(patch, \"launcherWidth\")) {\n next.legacyLauncherWidth = patch.launcherWidth !== undefined;\n }\n if (hasOwn(patch, \"launcher\") && patch.launcher === undefined) {\n next.launcherWidth = false;\n next.sidebarWidth = false;\n next.dockWidth = false;\n return next;\n }\n if (hasOwn(patch.launcher, \"width\")) {\n next.launcherWidth = patch.launcher?.width !== undefined;\n }\n if (hasOwn(patch.launcher, \"sidebarWidth\")) {\n next.sidebarWidth = patch.launcher?.sidebarWidth !== undefined;\n }\n if (hasOwn(patch.launcher, \"dock\") && patch.launcher?.dock === undefined) {\n next.dockWidth = false;\n } else if (hasOwn(patch.launcher?.dock, \"width\")) {\n next.dockWidth = patch.launcher?.dock?.width !== undefined;\n }\n return next;\n};\n\n/** Embedded presentation applies only to an inline mount, never a launcher host. */\nexport const isEmbeddedLayout = (config?: Partial<AgentWidgetConfig>): boolean =>\n config?.layout?.embedded === true &&\n config.launcher?.enabled === false &&\n !config.launcher.sidebarMode &&\n (config.launcher.mountMode ?? \"floating\") === \"floating\";\n\nexport const isHeaderVisible = (config?: Partial<AgentWidgetConfig>): boolean =>\n config?.layout?.showHeader ?? !isEmbeddedLayout(config);\n","const isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/**\n * Deep-merge plain objects. Arrays and non-objects are replaced by override.\n */\nexport function deepMerge<T extends Record<string, unknown>>(\n base: T | undefined,\n override: Record<string, unknown> | undefined\n): T | Record<string, unknown> | undefined {\n if (!base) return override;\n if (!override) return base;\n\n const merged: Record<string, unknown> = { ...base };\n\n for (const [key, value] of Object.entries(override)) {\n const existing = merged[key];\n if (isObject(existing) && isObject(value)) {\n merged[key] = deepMerge(existing, value);\n } else {\n merged[key] = value;\n }\n }\n\n return merged;\n}\n","import type { AgentWidgetApprovalConfig, AgentWidgetConfig } from \"../types\";\n\n/** Shared defaults kept small for the lazy approval chunk. */\nexport const DEFAULT_APPROVAL_V5: AgentWidgetApprovalConfig = {\n resolvedDisplay: \"row\",\n primaryAction: \"allow-once\",\n keyboardShortcuts: \"focused\",\n};\n\nexport const resolveApprovalConfig = (\n config?: AgentWidgetConfig\n): AgentWidgetApprovalConfig | undefined => config?.approval === false\n ? undefined\n : { ...(config?.future?.v5Defaults === true ? DEFAULT_APPROVAL_V5 : {}), ...config?.approval };\n","/** Tracks host intent for versioned defaults without comparing values to defaults. */\nconst DEFAULTS_PROVENANCE = Symbol.for(\"persona.defaultsProvenance\");\ntype Provenance = { [DEFAULTS_PROVENANCE]?: readonly string[] };\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nexport function versionedDefaultPaths(overlay: object, prefix = \"\"): string[] {\n return Object.entries(overlay).flatMap(([key, value]) => {\n const path = prefix ? `${prefix}.${key}` : key;\n return record(value) ? versionedDefaultPaths(value, path) : [path];\n });\n}\n\nexport function suppliedPath(value: unknown, path: string): \"absent\" | \"clear\" | \"explicit\" {\n const keys = path.split(\".\");\n for (let index = 0; index < keys.length; index++) {\n const key = keys[index];\n if (!record(value) || !Object.prototype.hasOwnProperty.call(value, key)) return \"absent\";\n value = value[key];\n if (value === undefined) return \"clear\";\n // Replacing a parent object with a disabled/non-object value drops every\n // tracked descendant, just as clearing that parent with undefined does.\n if (index < keys.length - 1 && !record(value)) return \"clear\";\n }\n return \"explicit\";\n}\n\nexport function defaultProvenance(config: object | undefined, paths: readonly string[]): readonly string[] {\n return (config as Provenance | undefined)?.[DEFAULTS_PROVENANCE]\n ?? paths.filter((path) => suppliedPath(config, path) === \"explicit\");\n}\n\nexport function setDefaultProvenance<T extends object>(config: T, explicit: readonly string[]): T {\n Object.defineProperty(config, DEFAULTS_PROVENANCE, {\n value: explicit, enumerable: true, configurable: true,\n });\n return config;\n}\n\nexport function inheritDefaultProvenance<T extends object>(result: T, raw: object | undefined, overlay: object): T {\n return setDefaultProvenance(result, defaultProvenance(raw, versionedDefaultPaths(overlay)));\n}\n\nexport function updateDefaultProvenance(previous: object, patch: object, paths: readonly string[]): readonly string[] {\n const marked = (patch as Provenance)[DEFAULTS_PROVENANCE];\n if (marked) return marked;\n const explicit = new Set(defaultProvenance(previous, paths));\n for (const path of paths) {\n const supplied = suppliedPath(patch, path);\n if (supplied === \"clear\") explicit.delete(path);\n if (supplied === \"explicit\") explicit.add(path);\n }\n return [...explicit];\n}\n\n/** Copy only traversed objects so deleting inherited defaults never mutates callers. */\nexport function omitInheritedDefaults<T extends object>(config: T, paths: readonly string[], explicit: readonly string[]): T {\n const result = { ...config } as Record<string, unknown>;\n for (const path of paths) {\n if (explicit.includes(path)) continue;\n const keys = path.split(\".\");\n let target: Record<string, unknown> | undefined = result;\n for (const key of keys.slice(0, -1)) {\n const child: unknown = target[key];\n if (!record(child)) { target = undefined; break; }\n target[key] = { ...child };\n target = target[key] as Record<string, unknown>;\n }\n if (target) delete target[keys[keys.length - 1]];\n }\n return result as T;\n}\n","import { deepMerge } from './deep-merge';\nimport type { BrandConfig, ColorShade, DeepPartial, PersonaTheme } from '../types/theme';\n\ntype RGB = [number, number, number];\n\n// Parsing stays independent of the DOM so the critical launcher and full widget\n// derive identical colors, including when rendering on the server.\nconst parseColor = (value?: string): RGB | undefined => {\n if (typeof value !== 'string') return;\n const color = value.trim();\n const hex = /^#([\\da-f]{3}|[\\da-f]{6})$/i.exec(color)?.[1];\n if (hex) {\n const full = hex.length === 3 ? [...hex].map((c) => c + c).join('') : hex;\n return [0, 2, 4].map((i) => parseInt(full.slice(i, i + 2), 16)) as RGB;\n }\n const match = /^rgba?\\(\\s*([^)]*)\\)$/i.exec(color);\n if (!match) return;\n const parts = match[1].trim().split(/\\s*[,/]\\s*|\\s+/);\n if (parts.length === 4 && /^(?:1(?:\\.0+)?|100%)$/.test(parts[3])) parts.pop();\n if (parts.length !== 3) return;\n const channels = parts.map((part) => {\n if (!/^\\d+(?:\\.\\d+)?%?$/.test(part)) return NaN;\n return Number.parseFloat(part) * (part.endsWith('%') ? 2.55 : 1);\n });\n if (channels.some((n) => !Number.isFinite(n) || n < 0 || n > 255)) return;\n return channels as RGB;\n};\n\nconst luminance = (rgb: RGB): number => rgb.reduce((sum, channel, i) => {\n const c = channel / 255;\n return sum + (c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4) * [0.2126, 0.7152, 0.0722][i];\n}, 0);\nconst hexColor = (rgb: RGB): string => '#' + rgb.map((c) => Math.round(c).toString(16).padStart(2, '0')).join('');\nconst mix = (rgb: RGB, target: number, amount: number): string => hexColor(rgb.map((c) => c + (target - c) * amount) as RGB);\nconst foreground = (rgb: RGB): string => luminance(rgb) > 0.179 ? '#000000' : '#ffffff';\n\nexport const inferBrandColorScheme = (brand?: BrandConfig): 'light' | 'dark' | undefined => {\n const neutral = parseColor(brand?.neutral);\n return neutral ? luminance(neutral) < 0.18 ? 'dark' : 'light' : undefined;\n};\n\n/** Sparse overlay: unspecified and invalid inputs leave versioned defaults intact. */\nexport const deriveBrandTheme = (brand?: BrandConfig, scheme: 'light' | 'dark' = 'light', components?: DeepPartial<PersonaTheme>['components'], v5Defaults = false): DeepPartial<PersonaTheme> => {\n const theme: DeepPartial<PersonaTheme> = {};\n if (!brand) return theme;\n const accent = parseColor(brand.accent);\n if (accent) {\n // Tint toward white above 500 and shade toward black below it. The seed\n // remains at 500 rather than shifting hue by adding channel constants.\n const ramp: ColorShade = {};\n for (const [stop, amount] of [[50, .96], [100, .9], [200, .75], [300, .55], [400, .25]] as const) ramp[stop] = mix(accent, 255, amount);\n ramp[500] = hexColor(accent);\n for (const [stop, amount] of [[600, .15], [700, .3], [800, .45], [900, .6], [950, .75]] as const) ramp[stop] = mix(accent, 0, amount);\n const ink = foreground(accent);\n theme.palette = { colors: { primary: ramp, accent: ramp } };\n theme.semantic = { colors: { primary: ramp[500], accent: ramp[500], interactive: { default: ramp[500], hover: ramp[600], focus: ramp[500], active: ramp[700] } } };\n theme.components = {\n button: { primary: { background: ramp[500], foreground: ink } },\n launcher: { background: ramp[500], foreground: ink },\n header: v5Defaults\n ? { background: 'semantic.colors.container', foreground: 'semantic.colors.text', iconBackground: 'transparent', iconForeground: 'semantic.colors.text' }\n : { background: ramp[500], foreground: ink, iconBackground: ramp[500], iconForeground: ink },\n approval: { approve: { foreground: ink } },\n message: { user: v5Defaults\n ? { background: 'color-mix(in srgb, var(--persona-primary) 12%, var(--persona-container))', text: 'semantic.colors.text' }\n : { background: ramp[500], text: ink } },\n };\n }\n const neutral = parseColor(brand.neutral);\n if (neutral) {\n // A seed chosen for the opposite explicit scheme still produces a usable\n // surface: project it toward that scheme's endpoint before adding layers.\n const dark = scheme === 'dark';\n const base = (dark === (luminance(neutral) < .18)) ? neutral : parseColor(mix(neutral, dark ? 0 : 255, .9))!;\n const surface = hexColor(base);\n const container = mix(base, dark ? 255 : 0, dark ? .06 : .025);\n const border = mix(base, dark ? 255 : 0, dark ? .2 : .16);\n const ink = foreground(base);\n const gray: ColorShade = {};\n for (const [stop, amount] of [[50, 0], [100, .06], [200, .16], [300, .28], [400, .45], [500, .65], [600, .72], [700, .8], [800, .9], [900, .97], [950, 1]] as const) gray[stop] = mix(base, ink === '#ffffff' ? 255 : 0, amount);\n theme.palette = { ...theme.palette, colors: { ...theme.palette?.colors, gray } };\n theme.semantic = { ...theme.semantic, colors: { ...theme.semantic?.colors, surface, background: surface, container, border, divider: border, text: ink, textMuted: mix(base, ink === '#ffffff' ? 255 : 0, .65) } };\n theme.components = { ...theme.components, panel: { background: surface }, header: { ...theme.components?.header, background: surface, foreground: ink }, composer: { footerBackground: surface } };\n }\n if (accent) {\n const surface = parseColor(theme.semantic?.colors?.surface) ?? (scheme === 'dark' ? [15, 15, 16] : [255, 255, 255]);\n let link = hexColor(accent);\n const target = foreground(surface) === '#ffffff' ? 255 : 0;\n for (let amount = 0; amount <= 1; amount += .1) {\n link = mix(accent, target, amount);\n const a = luminance(parseColor(link)!);\n const b = luminance(surface);\n if ((Math.max(a, b) + .05) / (Math.min(a, b) + .05) >= 4.5) break;\n }\n theme.components = { ...theme.components, markdown: { link: { foreground: link } }, input: { focus: { border: link, ring: link } } };\n }\n if (brand.font?.trim()) theme.semantic = { ...theme.semantic, typography: { fontFamily: brand.font } };\n const radius = { none: '0px', sm: '4px', md: '8px', lg: '16px' }[brand.radius ?? 'none'];\n if (brand.radius && radius) {\n theme.palette = { ...theme.palette, radius: { none: '0px', sm: radius, md: radius, lg: radius, xl: radius, '2xl': radius } };\n theme.components = { ...theme.components, input: { ...theme.components?.input, borderRadius: radius }, header: { ...theme.components?.header, controlBorderRadius: radius } };\n }\n const density = { compact: [13, 44, 8], comfortable: [14, 48, 12], spacious: [15, 52, 16] }[brand.density ?? 'comfortable'];\n if (brand.density && density) {\n const [size, height, gap] = density;\n theme.semantic = { ...theme.semantic, typography: { ...theme.semantic?.typography, fontSize: `${size}px` } };\n theme.components = { ...theme.components, header: { ...theme.components?.header, minHeight: `${height}px`, padding: `${gap}px 16px`, minimalPadding: `${gap}px 16px` }, history: { railHeader: { minHeight: `${height}px` } }, composer: { ...theme.components?.composer, fontSize: `${size}px`, padding: `${gap}px`, gap: `${gap / 2}px` }, message: { ...theme.components?.message, gap: `${gap}px`, user: { ...theme.components?.message?.user, fontSize: `${size}px` }, assistant: { fontSize: `${size}px` } } };\n }\n if (brand.elevation && ['flat', 'subtle', 'raised'].includes(brand.elevation)) {\n const flat = brand.elevation === 'flat';\n const shadow = flat ? 'none' : brand.elevation === 'subtle' ? '0 2px 8px rgba(0, 0, 0, 0.08)' : '0 12px 32px rgba(0, 0, 0, 0.18)';\n const border = flat ? '1px solid var(--persona-border)' : '1px solid color-mix(in srgb, var(--persona-border) 65%, transparent)';\n theme.palette = { ...theme.palette, shadows: { sm: shadow, md: shadow, lg: shadow, xl: shadow, '2xl': shadow } };\n const shadows = (node: Record<string, unknown>, path = ''): Record<string, unknown> => {\n const overlay: Record<string, unknown> = {};\n // V5 assistant defaults are unpadded prose, not a surface to elevate.\n // Explicit theme tokens still win; custom bubbles can opt into the brand\n // shadow scale with `palette.shadows.sm` alongside their padding/background.\n if (v5Defaults && path === 'message.assistant') return overlay;\n for (const [key, value] of Object.entries(node)) {\n if (key.toLowerCase().endsWith('shadow')) {\n overlay[key] = shadow;\n const borderKey = key === 'shadow' ? 'border' : key.replace(/Shadow$/, 'Border');\n if (borderKey in node) overlay[borderKey] = typeof node[borderKey] === 'string' && (node[borderKey] as string).includes('solid') ? border : flat ? 'semantic.colors.border' : 'color-mix(in srgb, var(--persona-border) 65%, transparent)';\n }\n else if (value && typeof value === 'object') {\n const child = shadows(value as Record<string, unknown>, path ? `${path}.${key}` : key);\n if (Object.keys(child).length) overlay[key] = child;\n }\n }\n return overlay;\n };\n const allShadows = components ? shadows(components as Record<string, unknown>) : {};\n theme.components = deepMerge(theme.components, allShadows) as DeepPartial<PersonaTheme>['components'];\n theme.components = { ...theme.components, panel: { ...theme.components?.panel, shadow, modes: { floating: { shadow, border }, inline: { shadow, border }, docked: { shadow, border }, sidebar: { shadow, border }, mobile: { shadow, border } } }, launcher: { ...theme.components?.launcher, shadow, border: 'semantic.colors.border' }, composer: { ...theme.components?.composer, shadow, borderColor: 'semantic.colors.border' }, toolBubble: { shadow }, reasoningBubble: { shadow } };\n }\n return theme;\n};\n","import type { BrandConfig } from \"../types/theme\";\nimport { inferBrandColorScheme } from \"./brand\";\nimport { suppliedPath } from \"./defaults-provenance\";\n\nconst paths = (prefix: string, leaves: string): string[] =>\n leaves.split(\" \").map((leaf) => `${prefix}.${leaf}`);\n\n/** Only the style aliases covered by the replacement plan carry origin data. */\nexport const LEGACY_STYLE_PATHS: readonly string[] = /* @__PURE__ */ (() => [\n ...paths(\"launcher\", \"closeButtonSize closeButtonColor closeButtonBackgroundColor closeButtonBorderWidth closeButtonBorderColor closeButtonBorderRadius closeButtonPaddingX closeButtonPaddingY\"),\n ...paths(\"launcher.clearChat\", \"size iconColor backgroundColor borderWidth borderColor borderRadius paddingX paddingY\"),\n ...paths(\"sendButton\", \"size iconSize iconStrokeWidth backgroundColor textColor borderWidth borderColor paddingX paddingY\"),\n ...paths(\"voiceRecognition\", \"iconSize iconColor backgroundColor borderColor borderWidth paddingX paddingY recordingIconColor recordingBackgroundColor recordingBorderColor processingIconColor processingBackgroundColor processingBorderColor speakingIconColor speakingBackgroundColor speakingBorderColor\"),\n ...paths(\"toolCall\", \"shadow backgroundColor borderColor borderWidth borderRadius headerBackgroundColor headerTextColor headerPaddingX headerPaddingY contentBackgroundColor contentTextColor contentPaddingX contentPaddingY codeBlockBackgroundColor codeBlockBorderColor codeBlockTextColor toggleTextColor labelTextColor loadingAnimationColor loadingAnimationSecondaryColor loadingAnimationDuration\"),\n ...paths(\"approval\", \"backgroundColor borderColor shadow titleColor descriptionColor reasonColor approveButtonColor approveButtonTextColor denyButtonColor denyButtonTextColor parameterBackgroundColor parameterTextColor\"),\n ...paths(\"features.askUserQuestion.styles\", \"sheetBackground sheetBorder sheetShadow pillBackground pillBackgroundSelected pillTextColor pillTextColorSelected pillBorderRadius customInputBackground\"),\n ...paths(\"features.artifacts.layout\", \"paneBackground panePadding paneBorderRadius paneShadow chatShadow paneBorder paneBorderLeft unifiedSplitOuterRadius documentToolbarIconColor documentToolbarToggleActiveBackground documentToolbarToggleActiveBorderColor documentToolbarToggleActiveColor tabFadeSize\"),\n ...paths(\"suggestionChipsConfig\", \"fontWeight paddingX paddingY\"),\n])();\n\n/** Existing emitted tokens whose newly wired consumers must remain opt-in. */\nexport const OPT_IN_THEME_STYLE_PATHS: readonly string[] = [\n \"voice.recording.border\", \"voice.processing.icon\", \"voice.processing.background\", \"voice.speaking.icon\",\n \"approval.requested.text\", \"approval.approve.foreground\", \"approval.deny.foreground\", \"approval.deny.background\",\n \"reasoningBubble.shadow\", \"toolBubble.shadow\",\n];\nconst TRACKED_PATHS = /* @__PURE__ */ (() => [\n ...LEGACY_STYLE_PATHS,\n \"suggestionChips\", \"copy.welcomeTitle\", \"copy.welcomeSubtitle\", \"copy.showWelcomeCard\",\n \"features.suggestReplies.enabled\", \"features.suggestReplies.expose\",\n ...[\"theme\", \"darkTheme\"].flatMap((group) =>\n OPT_IN_THEME_STYLE_PATHS.map((path) => `${group}.components.${path}`)),\n])();\nconst STYLE_PROVENANCE = Symbol.for(\"persona.styleProvenance\");\ntype Origin = { explicit: readonly string[]; values: Readonly<Record<string, unknown>> };\ntype Marked = { [STYLE_PROVENANCE]?: Origin };\nexport const hasStyleProvenance = (config: object): boolean =>\n (config as Marked)[STYLE_PROVENANCE] !== undefined;\n\nconst valueAt = (config: unknown, path: string): unknown => {\n for (const key of path.split(\".\")) {\n if (typeof config !== \"object\" || config === null) return undefined;\n config = (config as Record<string, unknown>)[key];\n }\n return config;\n};\n\nconst origin = (config?: object): readonly string[] => {\n const stored = (config as Marked | undefined)?.[STYLE_PROVENANCE];\n if (!stored) return TRACKED_PATHS.filter((path) => suppliedPath(config, path) === \"explicit\");\n // A spread retains the symbol. Changes made on that copy are still host\n // input: compare with its recorded values, never with built-in defaults.\n const explicit = new Set(stored.explicit);\n TRACKED_PATHS.forEach((path) => {\n if (valueAt(config, path) === stored.values[path]) return;\n if (suppliedPath(config, path) === \"explicit\") explicit.add(path);\n else explicit.delete(path);\n });\n return [...explicit];\n};\n\nexport const setStyleProvenance = <T extends object>(config: T, explicit: readonly string[]): T => {\n Object.defineProperty(config, STYLE_PROVENANCE, {\n value: { explicit, values: Object.fromEntries(TRACKED_PATHS.map((path) => [path, valueAt(config, path)])) },\n enumerable: true, configurable: true,\n });\n return config;\n};\n\nexport const inheritStyleProvenance = <T extends object>(result: T, raw?: object): T =>\n setStyleProvenance(result, origin(raw));\n\nexport const updateStyleProvenance = (previous: object, patch: object): readonly string[] => {\n if ((patch as Marked)[STYLE_PROVENANCE]) return origin(patch);\n const explicit = new Set(origin(previous));\n for (const path of TRACKED_PATHS) {\n const state = suppliedPath(patch, path);\n if (state === \"clear\") explicit.delete(path);\n if (state === \"explicit\") explicit.add(path);\n }\n return [...explicit];\n};\n\n/** Unknown-origin external/default-filled configs conservatively keep present values explicit. */\nexport const hasExplicitStylePath = (config: object | undefined, path: string): boolean => {\n const stored = (config as Marked | undefined)?.[STYLE_PROVENANCE];\n if (!stored || !Object.prototype.hasOwnProperty.call(stored.values, path) || valueAt(config, path) !== stored.values[path]) {\n return suppliedPath(config, path) === \"explicit\";\n }\n return stored.explicit.includes(path);\n};\n\n/** Renderers keep responsibility for historical normalization and mode restrictions. */\nexport const getExplicitLegacyStyle = (config: object | undefined, path: string): unknown =>\n hasExplicitStylePath(config, path) ? valueAt(config, path) : undefined;\n\ntype SchemeConfig = { colorScheme?: \"light\" | \"dark\" | \"auto\"; brand?: BrandConfig };\nexport const hasExplicitThemeStyle = (\n config: object | undefined, componentPath: string, scheme?: \"light\" | \"dark\"\n): boolean => {\n const options = config as SchemeConfig | undefined;\n const selected = scheme ?? options?.colorScheme ?? inferBrandColorScheme(options?.brand) ?? \"light\";\n const dark = selected === \"dark\" || (selected === \"auto\" && (\n (typeof document !== \"undefined\" && document.documentElement.classList.contains(\"dark\")) ||\n (typeof window !== \"undefined\" && window.matchMedia?.(\"(prefers-color-scheme: dark)\").matches)\n ));\n return hasExplicitStylePath(config, `theme.components.${componentPath}`) ||\n (dark && hasExplicitStylePath(config, `darkTheme.components.${componentPath}`));\n};\n","import { DEFAULT_TOOL_CALL_DISPLAY, DEFAULT_REASONING_DISPLAY, DEFAULT_TOOL_CALL_DISPLAY_V5, DEFAULT_REASONING_DISPLAY_V5 } from \"./utils/activity-display-defaults\";\nexport { DEFAULT_TOOL_CALL_DISPLAY, DEFAULT_REASONING_DISPLAY } from \"./utils/activity-display-defaults\";\nimport type { AgentWidgetConfig, AgentWidgetLauncherConfig } from \"./types\";\nimport type { DeepPartial, PersonaTheme } from \"./types/theme\";\nimport { deepMerge } from \"./utils/deep-merge\";\nimport { DEFAULT_APPROVAL_V5 } from \"./utils/approval-config\";\nimport { defaultProvenance, inheritDefaultProvenance } from \"./utils/defaults-provenance\";\nimport { inheritPanelAliasProvenance } from \"./utils/panel-config\";\nimport { inheritStyleProvenance } from \"./utils/style-provenance\";\nimport {\n DEFAULT_TOOLTIP_DELAY_MS,\n DEFAULT_TOOLTIP_SKIP_DELAY_MS,\n} from \"./utils/tooltip-timing\";\n\n/**\n * Default width for the floating launcher panel (when not overridden).\n * Benchmarks: many chat products use ~300–400px; 400px is a frequent “standard” default.\n * We use 440px to better fit code/JSON and structured replies while staying responsive via `min(..., 100vw)`.\n */\nexport const DEFAULT_FLOATING_LAUNCHER_WIDTH = \"min(440px, calc(100vw - 24px))\";\n\n/** Max width cap paired with {@link DEFAULT_FLOATING_LAUNCHER_WIDTH} for theme defaults. */\nexport const DEFAULT_FLOATING_LAUNCHER_MAX_WIDTH = \"440px\";\n\n/** Canonical header avatar box size, shared by the initial render and updates. */\nexport const DEFAULT_HEADER_ICON_SIZE = \"40px\";\n\n/**\n * Canonical composer placeholder. The low-level builders fall back to this so\n * they cannot drift from `DEFAULT_WIDGET_CONFIG.copy.inputPlaceholder`.\n */\nexport const DEFAULT_INPUT_PLACEHOLDER = \"How can I help...\";\n\nexport const DEFAULT_LAUNCHER_CONFIG: AgentWidgetLauncherConfig = {\n enabled: true,\n mountMode: \"floating\",\n dock: {\n side: \"right\",\n width: \"420px\",\n },\n title: \"Chat Assistant\",\n subtitle: \"Here to help you get answers fast\",\n agentIconText: \"💬\",\n agentIconName: \"bot\",\n headerIconName: \"bot\",\n position: \"bottom-right\",\n width: DEFAULT_FLOATING_LAUNCHER_WIDTH,\n heightOffset: 0,\n autoExpand: false,\n callToActionIconHidden: false,\n agentIconSize: \"40px\",\n headerIconSize: DEFAULT_HEADER_ICON_SIZE,\n // closeButtonSize / clearChat.size omitted so theme.components.header.controlSize\n // sizes the header controls; setting either here would pin them past the token.\n // Zero out browser-default <button> padding so the icon gets the full\n // content box, matching clearChat.paddingX/Y below. Without this,\n // UA stylesheets add ~1-2px vertical and ~6px horizontal padding that\n // eats into the border-box width and shrinks the rendered icon.\n closeButtonPaddingX: \"0px\",\n closeButtonPaddingY: \"0px\",\n callToActionIconName: \"arrow-up-right\",\n callToActionIconText: \"\",\n callToActionIconSize: \"32px\",\n callToActionIconPadding: \"5px\",\n callToActionIconColor: undefined,\n callToActionIconBackgroundColor: undefined,\n // closeButtonColor / clearChat.iconColor omitted so theme.components.header.actionIconForeground applies.\n closeButtonBackgroundColor: \"transparent\",\n clearChat: {\n backgroundColor: \"transparent\",\n borderColor: \"transparent\",\n enabled: true,\n placement: \"inline\",\n iconName: \"refresh-cw\",\n showTooltip: true,\n tooltipText: \"Clear chat\",\n paddingX: \"0px\",\n paddingY: \"0px\",\n },\n headerIconHidden: false,\n border: undefined,\n shadow:\n \"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)\",\n};\n\n/**\n * Default widget configuration\n * Single source of truth for all default values\n */\nexport const DEFAULTS_BASE: Partial<AgentWidgetConfig> = {\n apiUrl: \"https://api.runtype.com/api/chat/dispatch\",\n // Client token mode defaults (optional, only used when clientToken is set)\n clientToken: undefined,\n agentId: undefined,\n target: undefined,\n theme: undefined,\n darkTheme: undefined,\n colorScheme: \"light\",\n tooltip: {\n delayMs: DEFAULT_TOOLTIP_DELAY_MS,\n skipDelayMs: DEFAULT_TOOLTIP_SKIP_DELAY_MS,\n },\n launcher: DEFAULT_LAUNCHER_CONFIG,\n copy: {\n // No welcomeTitle / welcomeSubtitle here on purpose: `resolveWelcomeConfig`\n // owns those defaults so presence still means \"the host set this\".\n inputPlaceholder: DEFAULT_INPUT_PLACEHOLDER,\n sendButtonLabel: \"Send\",\n },\n sendButton: {\n borderWidth: \"0px\",\n paddingX: \"12px\",\n paddingY: \"10px\",\n borderColor: undefined,\n useIcon: true,\n iconText: \"↑\",\n // No `size`: unset means \"follow --persona-composer-control-size\"\n // (theme.components.composer.controlSize), which defaults to 40px.\n showTooltip: true,\n tooltipText: \"Send message\",\n iconName: \"send\",\n },\n statusIndicator: {\n visible: true,\n idleText: \"Online\",\n connectingText: \"Connecting…\",\n connectedText: \"Streaming…\",\n errorText: \"Offline\",\n },\n voiceRecognition: {\n enabled: true,\n pauseDuration: 2000,\n iconName: \"mic\",\n // No `iconSize` / `paddingX` / `paddingY`: the mic sizes from\n // --persona-composer-control-size like every other composer control, so it\n // no longer needs the hand-tuned box that squeezed a 39px glyph.\n borderWidth: \"0px\",\n iconColor: undefined,\n backgroundColor: \"transparent\",\n borderColor: \"transparent\",\n recordingIconColor: undefined,\n recordingBackgroundColor: undefined,\n recordingBorderColor: \"transparent\",\n showTooltip: true,\n tooltipText: \"Start voice recognition\",\n },\n features: {\n showReasoning: true,\n showToolCalls: true,\n scrollToBottom: {\n enabled: true,\n iconName: \"arrow-down\",\n label: \"\",\n streamingIndicator: \"arrow\",\n scrollBehavior: \"instant\",\n scrollDurationMs: 220,\n transition: \"none\",\n },\n scrollBehavior: {\n // ChatGPT-style default: pin the just-sent message near the top and let\n // the reply stream into the space below. Restore the old \"stick to the\n // bottom\" behavior with `mode: \"follow\"`.\n mode: \"anchor-top\",\n anchorTopOffset: 16,\n // Surface the unread count + \"streaming below\" hint while pinned, so the\n // reader still sees activity arriving off-screen under the pinned turn.\n // (Suppressed by default historically; opted on alongside the anchor-top\n // default so the default UX keeps the affordance.)\n showActivityWhilePinned: true,\n },\n toolCallDisplay: DEFAULT_TOOL_CALL_DISPLAY,\n reasoningDisplay: DEFAULT_REASONING_DISPLAY,\n streamAnimation: {\n type: \"none\",\n placeholder: \"none\",\n speed: 120,\n duration: 1800,\n },\n askUserQuestion: {\n enabled: true,\n slideInMs: 180,\n freeTextLabel: \"Other…\",\n freeTextPlaceholder: \"Type your answer…\",\n submitLabel: \"Send\",\n },\n history: {\n enabled: false,\n presentation: \"panel\",\n showScopeStatus: true,\n showDelete: true,\n showDeleteAll: true,\n },\n },\n // Placeholder copy that models the right shape: verb-first, user-voice,\n // one line. Integrators should swap in domain prompts.\n suggestionChips: [\n \"Show me what you can help with\",\n \"Walk me through getting started\",\n \"Answer a question about this page\",\n ],\n suggestionChipsConfig: {\n fontFamily: \"sans-serif\",\n fontWeight: \"500\",\n paddingX: \"12px\",\n paddingY: \"6px\",\n },\n layout: {\n header: {\n layout: \"default\",\n showIcon: true,\n showTitle: true,\n showSubtitle: true,\n showCloseButton: true,\n showClearChat: true,\n },\n messages: {\n layout: \"bubble\",\n avatar: {\n show: false,\n position: \"left\",\n },\n timestamp: {\n show: false,\n position: \"below\",\n },\n groupConsecutive: false,\n },\n slots: {},\n },\n markdown: {\n options: {\n gfm: true,\n breaks: true,\n },\n disableDefaultStyles: false,\n },\n messageActions: {\n enabled: true,\n showCopy: true,\n showUpvote: false, // Requires backend - disabled by default\n showDownvote: false, // Requires backend - disabled by default\n visibility: \"hover\",\n align: \"right\",\n layout: \"pill-inside\",\n },\n debug: false,\n};\n\n/** Version-specific defaults, selected by the staged V5 opt-in. */\nexport const DEFAULTS_V4: Partial<AgentWidgetConfig> = {};\nexport const DEFAULT_LAUNCHER_V5: Partial<AgentWidgetLauncherConfig> = {\n variant: \"circle\",\n width: \"min(400px, calc(100vw - 24px))\",\n headerIconSize: \"20px\",\n};\nexport const DEFAULTS_V5: Partial<AgentWidgetConfig> = {\n // Shared default tracked here so later brand updates retain host scheme intent.\n colorScheme: \"light\",\n errorDisplay: \"block\",\n messageActions: { visibility: undefined },\n // Let the suggestion theme token control weight; explicit legacy overrides still win.\n suggestionChipsConfig: { fontWeight: undefined },\n approval: DEFAULT_APPROVAL_V5,\n loadingIndicator: { variant: \"label\" },\n launcher: DEFAULT_LAUNCHER_V5,\n features: {\n artifacts: { enabled: true },\n scrollToBottom: { streamingIndicator: \"dots\", transition: \"fade\", scrollBehavior: \"smooth\" },\n toolCallDisplay: DEFAULT_TOOL_CALL_DISPLAY_V5,\n reasoningDisplay: DEFAULT_REASONING_DISPLAY_V5,\n },\n composer: { layout: \"single-row\", placement: \"overlay\" },\n sendButton: { iconName: \"arrow-up\" },\n statusIndicator: { mode: \"transient\" },\n layout: {\n contentMaxWidth: \"768px\",\n topFade: true,\n header: { showSubtitle: false },\n messages: { assistant: { width: \"full\" } },\n },\n};\n\nexport type DefaultsVersion = \"v4\" | \"v5\";\n\n/** Shared by config, token, theme, and editor resolution. Only true opts in. */\nexport function resolveDefaultsVersion(\n config?: Pick<AgentWidgetConfig, \"future\">\n): DefaultsVersion {\n return config?.future?.v5Defaults === true ? \"v5\" : \"v4\";\n}\n\nexport function resolveDefaults(\n config?: Pick<AgentWidgetConfig, \"future\">\n): Partial<AgentWidgetConfig> {\n const overlay = resolveDefaultsVersion(config) === \"v5\" ? DEFAULTS_V5 : DEFAULTS_V4;\n return deepMerge(DEFAULTS_BASE, overlay) as Partial<AgentWidgetConfig>;\n}\n\n/** Backward-compatible export of the legacy widget defaults. */\nexport const DEFAULT_WIDGET_CONFIG = resolveDefaults();\n\nfunction mergeThemePartials(\n base: DeepPartial<PersonaTheme> | undefined,\n override: DeepPartial<PersonaTheme> | undefined\n): DeepPartial<PersonaTheme> | undefined {\n if (!base && !override) return undefined;\n if (!base) return override;\n if (!override) return base;\n return deepMerge(\n base as Record<string, unknown>,\n override as Record<string, unknown>\n ) as DeepPartial<PersonaTheme>;\n}\n\n/**\n * Helper to deep merge user config with defaults\n * This ensures all default values are present while allowing selective overrides\n */\nexport function mergeWithDefaults(\n config?: Partial<AgentWidgetConfig>\n): Partial<AgentWidgetConfig> {\n const defaults = resolveDefaults(config);\n if (!config) return inheritStyleProvenance(inheritDefaultProvenance(inheritPanelAliasProvenance(defaults), undefined, DEFAULTS_V5));\n\n return inheritStyleProvenance(inheritDefaultProvenance(inheritPanelAliasProvenance({\n ...defaults,\n ...config,\n // Leave the scheme unresolved for a brand unless the host chose one.\n // Provenance also distinguishes the inherited light default on live updates.\n colorScheme: defaultProvenance(config, [\"colorScheme\"]).includes(\"colorScheme\")\n ? config.colorScheme : config.brand ? undefined : defaults.colorScheme,\n ...((defaults.approval || config.approval !== undefined) ? { approval: config.approval === false ? false : {\n ...(defaults.approval || {}),\n ...config.approval,\n } } : {}),\n theme: mergeThemePartials(defaults.theme, config.theme),\n darkTheme: mergeThemePartials(defaults.darkTheme, config.darkTheme),\n launcher: {\n ...defaults.launcher,\n ...config.launcher,\n dock: {\n ...defaults.launcher?.dock,\n ...config.launcher?.dock,\n },\n clearChat: {\n ...defaults.launcher?.clearChat,\n ...config.launcher?.clearChat,\n },\n },\n ...((defaults.composer || config.composer) ? { composer: {\n ...defaults.composer,\n ...config.composer,\n } } : {}),\n tooltip: {\n ...defaults.tooltip,\n ...config.tooltip,\n },\n copy: {\n ...defaults.copy,\n ...config.copy,\n },\n sendButton: {\n ...defaults.sendButton,\n ...config.sendButton,\n },\n statusIndicator: {\n ...defaults.statusIndicator,\n ...config.statusIndicator,\n },\n voiceRecognition: {\n ...defaults.voiceRecognition,\n ...config.voiceRecognition,\n },\n features: (() => {\n const da = defaults.features?.artifacts;\n const ca = config.features?.artifacts;\n const dsb = defaults.features?.scrollToBottom;\n const csb = config.features?.scrollToBottom;\n const dsc = defaults.features?.scrollBehavior;\n const csc = config.features?.scrollBehavior;\n const dsa = defaults.features?.streamAnimation;\n const csa = config.features?.streamAnimation;\n const dau = defaults.features?.askUserQuestion;\n const cau = config.features?.askUserQuestion;\n const dh = defaults.features?.history;\n const ch = config.features?.history;\n const mergedArtifacts =\n da === undefined && ca === undefined\n ? undefined\n : {\n ...da,\n ...ca,\n layout: {\n ...da?.layout,\n ...ca?.layout,\n },\n };\n const mergedScrollToBottom =\n dsb === undefined && csb === undefined\n ? undefined\n : {\n ...dsb,\n ...csb,\n };\n const mergedScrollBehavior =\n dsc === undefined && csc === undefined\n ? undefined\n : {\n ...dsc,\n ...csc,\n };\n const mergedStreamAnimation =\n dsa === undefined && csa === undefined\n ? undefined\n : {\n ...dsa,\n ...csa,\n };\n const mergedAskUserQuestion =\n dau === undefined && cau === undefined\n ? undefined\n : {\n ...dau,\n ...cau,\n styles: {\n ...dau?.styles,\n ...cau?.styles,\n },\n };\n const mergedHistory =\n dh === undefined && ch === undefined\n ? undefined\n : {\n ...dh,\n ...ch,\n copy: {\n ...dh?.copy,\n ...ch?.copy,\n },\n };\n return {\n ...defaults.features,\n ...config.features,\n toolCallDisplay: {\n ...defaults.features?.toolCallDisplay,\n ...config.features?.toolCallDisplay,\n ...(config.features?.toolCallDisplay?.layout === undefined && config.features?.toolCallDisplay?.variant !== undefined\n ? { layout: config.features.toolCallDisplay.variant } : {}),\n },\n reasoningDisplay: {\n ...defaults.features?.reasoningDisplay,\n ...config.features?.reasoningDisplay,\n ...(config.features?.reasoningDisplay?.layout === undefined && config.features?.reasoningDisplay?.variant !== undefined\n ? { layout: config.features.reasoningDisplay.variant } : {}),\n },\n ...(mergedScrollToBottom !== undefined ? { scrollToBottom: mergedScrollToBottom } : {}),\n ...(mergedScrollBehavior !== undefined ? { scrollBehavior: mergedScrollBehavior } : {}),\n ...(mergedArtifacts !== undefined ? { artifacts: mergedArtifacts } : {}),\n ...(mergedStreamAnimation !== undefined ? { streamAnimation: mergedStreamAnimation } : {}),\n ...(mergedAskUserQuestion !== undefined ? { askUserQuestion: mergedAskUserQuestion } : {}),\n ...(mergedHistory !== undefined ? { history: mergedHistory } : {}),\n };\n })(),\n suggestionChips: config.suggestionChips ?? defaults.suggestionChips,\n suggestionChipsConfig: {\n ...defaults.suggestionChipsConfig,\n ...config.suggestionChipsConfig,\n },\n layout: {\n ...defaults.layout,\n ...config.layout,\n header: {\n ...defaults.layout?.header,\n ...config.layout?.header,\n },\n messages: {\n ...defaults.layout?.messages,\n ...config.layout?.messages,\n ...((defaults.layout?.messages?.user || config.layout?.messages?.user) ? {\n user: {\n ...defaults.layout?.messages?.user,\n ...config.layout?.messages?.user,\n },\n } : {}),\n ...((defaults.layout?.messages?.assistant || config.layout?.messages?.assistant) ? {\n assistant: {\n ...defaults.layout?.messages?.assistant,\n ...config.layout?.messages?.assistant,\n },\n } : {}),\n avatar: {\n ...defaults.layout?.messages?.avatar,\n ...config.layout?.messages?.avatar,\n },\n timestamp: {\n ...defaults.layout?.messages?.timestamp,\n ...config.layout?.messages?.timestamp,\n },\n },\n slots: {\n ...defaults.layout?.slots,\n ...config.layout?.slots,\n },\n },\n markdown: {\n ...defaults.markdown,\n ...config.markdown,\n options: {\n ...defaults.markdown?.options,\n ...config.markdown?.options,\n },\n },\n messageActions: {\n ...defaults.messageActions,\n ...config.messageActions,\n },\n }, config), config, DEFAULTS_V5), config);\n\n}\n","import type { AgentWidgetConfig } from \"../types\";\n\n/** Shared by config resolution and standalone transcript component builders. */\nexport const DEFAULT_TOOL_CALL_DISPLAY = {\n collapsedMode: \"tool-call\",\n activePreview: false,\n grouped: false,\n groupedMode: \"stack\",\n groupBoundary: \"adjacent\",\n previewMaxLines: 3,\n expandable: true,\n loadingAnimation: \"none\",\n} satisfies NonNullable<NonNullable<AgentWidgetConfig[\"features\"]>[\"toolCallDisplay\"]>;\n\nexport const DEFAULT_REASONING_DISPLAY = {\n activePreview: false,\n previewMaxLines: 3,\n expandable: true,\n loadingAnimation: \"none\",\n} satisfies NonNullable<NonNullable<AgentWidgetConfig[\"features\"]>[\"reasoningDisplay\"]>;\n\n// Keep the shipped resolved alias and its author-intent provenance on live updates.\nexport const DEFAULT_TOOL_CALL_DISPLAY_V5 = {\n layout: \"row\", variant: \"row\", iconVisibility: \"active\", autoExpand: false, grouped: true, groupedMode: \"collapsible\", groupAppearance: \"inset\", loadingAnimation: \"shimmer\",\n} satisfies NonNullable<NonNullable<AgentWidgetConfig[\"features\"]>[\"toolCallDisplay\"]>;\n\nexport const DEFAULT_REASONING_DISPLAY_V5 = {\n appearance: \"inset\", layout: \"row\", variant: \"row\", iconVisibility: \"active\", autoExpand: false, loadingAnimation: \"shimmer\",\n} satisfies NonNullable<NonNullable<AgentWidgetConfig[\"features\"]>[\"reasoningDisplay\"]>;\n","import { CIRCLE_LAUNCHER_TOKENS } from \"./launcher-variant\";\nimport type {\n DeepPartial,\n PersonaTheme,\n ResolvedToken,\n ThemeValidationResult,\n ThemeValidationError,\n CreateThemeOptions,\n ComponentTokens,\n SemanticTokens,\n} from '../types/theme';\nimport {\n DEFAULT_FLOATING_LAUNCHER_WIDTH,\n resolveDefaultsVersion,\n} from '../defaults';\n\n// Detached/docked panel defaults, shared by the panel token defaults, the alias\n// fallbacks below, host-layout, the theme editor, and the artifact gate.\nexport const DEFAULT_PANEL_INSET = '16px';\nexport const DEFAULT_PANEL_CANVAS_BACKGROUND = 'transparent';\n\nconst spacing = (() => {\n const s: Record<number, string> = {};\n for (const k of [0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 32, 40, 48, 56, 64])\n s[k] = k === 0 ? '0px' : `${k / 4}rem`;\n return s as Record<0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | 56 | 64, string>;\n})();\n\nconst DEFAULT_PALETTE_BASE = {\n colors: {\n primary: {\n 50: '#ffffff',\n 100: '#f5f5f5',\n 200: '#d4d4d4',\n 300: '#a3a3a3',\n 400: '#737373',\n 500: '#171717',\n 600: '#0f0f0f',\n 700: '#0a0a0a',\n 800: '#050505',\n 900: '#030303',\n 950: '#000000',\n },\n secondary: {\n 50: '#f5f3ff',\n 100: '#ede9fe',\n 200: '#ddd6fe',\n 300: '#c4b5fd',\n 400: '#a78bfa',\n 500: '#8b5cf6',\n 600: '#7c3aed',\n 700: '#6d28d9',\n 800: '#5b21b6',\n 900: '#4c1d95',\n 950: '#2e1065',\n },\n accent: {\n 50: '#ecfeff',\n 100: '#cffafe',\n 200: '#a5f3fc',\n 300: '#67e8f9',\n 400: '#22d3ee',\n 500: '#06b6d4',\n 600: '#0891b2',\n 700: '#0e7490',\n 800: '#155e75',\n 900: '#164e63',\n 950: '#083344',\n },\n gray: {\n 50: '#f9fafb',\n 100: '#f3f4f6',\n 200: '#e5e7eb',\n 300: '#d1d5db',\n 400: '#9ca3af',\n 500: '#6b7280',\n 600: '#4b5563',\n 700: '#374151',\n 800: '#1f2937',\n 900: '#111827',\n 950: '#030712',\n },\n success: {\n 50: '#f0fdf4',\n 100: '#dcfce7',\n 200: '#bbf7d0',\n 300: '#86efac',\n 400: '#4ade80',\n 500: '#22c55e',\n 600: '#16a34a',\n 700: '#15803d',\n 800: '#166534',\n 900: '#14532d',\n },\n warning: {\n 50: '#fefce8',\n 100: '#fef9c3',\n 200: '#fef08a',\n 300: '#fde047',\n 400: '#facc15',\n 500: '#eab308',\n 600: '#ca8a04',\n 700: '#a16207',\n 800: '#854d0e',\n 900: '#713f12',\n },\n error: {\n 50: '#fef2f2',\n 100: '#fee2e2',\n 200: '#fecaca',\n 300: '#fca5a5',\n 400: '#f87171',\n 500: '#ef4444',\n 600: '#dc2626',\n 700: '#b91c1c',\n 800: '#991b1b',\n 900: '#7f1d1d',\n },\n info: {\n 50: '#eff6ff',\n 100: '#dbeafe',\n 200: '#bfdbfe',\n 300: '#93c5fd',\n 400: '#60a5fa',\n 500: '#3b82f6',\n 600: '#2563eb',\n 700: '#1d4ed8',\n 800: '#1e40af',\n 900: '#1e3a8a',\n 950: '#172554',\n },\n purple: {\n 50: '#faf5ff',\n 100: '#f3e8ff',\n 200: '#e9d5ff',\n 300: '#d8b4fe',\n 400: '#c084fc',\n 500: '#a855f7',\n 600: '#9333ea',\n 700: '#7e22ce',\n 800: '#6b21a8',\n 900: '#581c87',\n 950: '#3b0764',\n },\n teal: {\n 50: '#f0fdfa',\n 100: '#ccfbf1',\n 200: '#99f6e4',\n 300: '#5eead4',\n 400: '#2dd4bf',\n 500: '#14b8a6',\n 600: '#0d9488',\n 700: '#0f766e',\n 800: '#115e59',\n 900: '#134e4a',\n 950: '#042f2e',\n },\n },\n spacing,\n typography: {\n fontFamily: {\n sans: 'system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n serif: 'Georgia, Cambria, \"Times New Roman\", Times, serif',\n mono: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace',\n },\n fontSize: {\n xs: '0.75rem',\n sm: '0.875rem',\n base: '1rem',\n lg: '1.125rem',\n xl: '1.25rem',\n '2xl': '1.5rem',\n '3xl': '1.875rem',\n '4xl': '2.25rem',\n },\n fontWeight: {\n normal: '400',\n medium: '500',\n semibold: '600',\n bold: '700',\n },\n lineHeight: {\n tight: '1.25',\n normal: '1.5',\n relaxed: '1.625',\n },\n },\n shadows: {\n none: 'none',\n sm: '0 1px 2px 0 rgb(0 0 0 / 0.05)',\n md: '0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)',\n lg: '0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)',\n xl: '0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)',\n '2xl': '0 25px 50px -12px rgb(0 0 0 / 0.25)',\n },\n borders: {\n none: 'none',\n sm: '1px solid',\n md: '2px solid',\n lg: '4px solid',\n },\n radius: {\n none: '0px',\n sm: '0.125rem',\n md: '0.375rem',\n lg: '0.5rem',\n xl: '0.75rem',\n '2xl': '1rem',\n full: '9999px',\n },\n};\n\nconst DEFAULT_SEMANTIC_BASE: SemanticTokens = {\n colors: {\n primary: 'palette.colors.primary.500',\n secondary: 'palette.colors.secondary.500',\n // Links/Focus role: solid primary\n accent: 'palette.colors.primary.600',\n // Surfaces role: soft gray\n surface: 'palette.colors.gray.50',\n background: 'palette.colors.gray.50',\n container: 'palette.colors.gray.50',\n text: 'palette.colors.gray.900',\n textMuted: 'palette.colors.gray.500',\n textInverse: 'palette.colors.gray.50',\n // Borders role: soft gray\n border: 'palette.colors.gray.200',\n divider: 'palette.colors.gray.200',\n interactive: {\n // Primary Actions role: solid primary\n default: 'palette.colors.primary.600',\n hover: 'palette.colors.primary.700',\n // Links/Focus role: solid primary\n focus: 'palette.colors.primary.600',\n active: 'palette.colors.primary.600',\n disabled: 'palette.colors.gray.300',\n },\n feedback: {\n success: 'palette.colors.success.500',\n warning: 'palette.colors.warning.500',\n error: 'palette.colors.error.500',\n info: 'palette.colors.info.500',\n },\n },\n spacing: {\n xs: 'palette.spacing.1',\n sm: 'palette.spacing.2',\n md: 'palette.spacing.4',\n lg: 'palette.spacing.6',\n xl: 'palette.spacing.8',\n '2xl': 'palette.spacing.10',\n },\n typography: {\n fontFamily: 'palette.typography.fontFamily.sans',\n fontSize: 'palette.typography.fontSize.base',\n fontWeight: 'palette.typography.fontWeight.normal',\n lineHeight: 'palette.typography.lineHeight.normal',\n },\n};\n\nconst DEFAULT_COMPONENTS_BASE: ComponentTokens = {\n button: {\n primary: {\n // Primary Actions role: solid primary\n background: 'palette.colors.primary.500',\n foreground: 'palette.colors.primary.50',\n borderRadius: 'palette.radius.lg',\n padding: 'semantic.spacing.md',\n },\n secondary: {\n background: 'semantic.colors.surface',\n foreground: 'semantic.colors.secondary',\n borderRadius: 'palette.radius.lg',\n padding: 'semantic.spacing.md',\n },\n ghost: {\n background: 'transparent',\n foreground: 'semantic.colors.text',\n borderRadius: 'palette.radius.md',\n padding: 'semantic.spacing.sm',\n // Subtle neutral tint on hover — the composer's transparent icon buttons\n // (attachment, mention) read this via `--persona-button-ghost-hover-bg`.\n hoverBackground: 'rgba(0, 0, 0, 0.05)',\n },\n },\n input: {\n // Input role: semantic surface so host light/dark schemes cascade.\n background: 'semantic.colors.surface',\n placeholder: 'semantic.colors.textMuted',\n borderRadius: 'palette.radius.lg',\n padding: 'semantic.spacing.md',\n focus: {\n border: 'palette.colors.gray.400',\n ring: 'palette.colors.gray.400',\n },\n },\n launcher: {\n // Launcher pill role: shared surface/primary tones until a host overrides.\n background: 'semantic.colors.surface',\n foreground: 'semantic.colors.primary',\n border: 'semantic.colors.border',\n size: '60px',\n iconSize: '28px',\n borderRadius: 'palette.radius.full',\n shadow: 'palette.shadows.lg',\n },\n panel: {\n width: DEFAULT_FLOATING_LAUNCHER_WIDTH,\n // Matches the existing floating runtime geometry. `maxWidth` and\n // `maxHeight` intentionally do not impose a second cap; ui.ts applies\n // the responsive width and heightOffset rules for this mode.\n maxWidth: 'none',\n height: 'min(640px, max(200px, calc(100vh - 64px)))',\n maxHeight: 'none',\n borderRadius: 'palette.radius.xl',\n shadow: 'palette.shadows.xl',\n inset: DEFAULT_PANEL_INSET,\n canvasBackground: DEFAULT_PANEL_CANVAS_BACKGROUND,\n modes: {\n floating: {\n border: '1px solid var(--persona-border)',\n shadow: 'palette.shadows.xl',\n borderRadius: 'palette.radius.xl',\n },\n inline: {\n border: '1px solid var(--persona-border)',\n shadow: 'none',\n borderRadius: 'palette.radius.xl',\n },\n docked: { border: 'none', shadow: 'none', borderRadius: 'palette.radius.xl' },\n sidebar: { border: 'none', borderRadius: '0' },\n mobile: { border: 'none', shadow: 'none', borderRadius: '0' },\n },\n },\n header: {\n // Header role: solid primary. Border, subtitle, and action icons stay\n // unset so they derive from this background/foreground pair.\n background: 'palette.colors.primary.500',\n foreground: 'palette.colors.primary.50',\n borderRadius: 'palette.radius.xl palette.radius.xl 0 0',\n padding: '20px 24px',\n minimalPadding: '16px 24px',\n iconBackground: 'palette.colors.primary.600',\n iconForeground: 'palette.colors.primary.50',\n },\n message: {\n gap: '12px',\n user: {\n // User Messages role: solid primary\n background: 'palette.colors.primary.500',\n text: 'palette.colors.primary.50',\n borderRadius: 'palette.radius.lg',\n shadow: 'palette.shadows.sm',\n },\n assistant: {\n // Assistant Messages role: semantic neutral container.\n background: 'semantic.colors.container',\n text: 'semantic.colors.text',\n borderRadius: 'palette.radius.lg',\n border: 'semantic.colors.border',\n shadow: 'palette.shadows.sm',\n },\n border: 'semantic.colors.border',\n },\n introCard: {\n // Flat by default: the greeting reads as plain text on the transcript\n // background (the industry norm), not an elevated card.\n background: 'transparent',\n borderRadius: 'palette.radius.2xl',\n padding: 'semantic.spacing.lg',\n shadow: 'palette.shadows.none',\n },\n suggestion: {\n chip: {\n background: 'semantic.colors.surface',\n foreground: 'semantic.colors.text',\n border: 'semantic.colors.border',\n borderRadius: 'palette.radius.full',\n padding: '0.5rem 0.875rem',\n gap: '0.5rem',\n itemGap: '8px',\n minHeight: '36px',\n fontSize: '0.8125rem',\n lineHeight: '1.25',\n iconSize: '16px',\n hoverBackground: 'palette.colors.gray.100',\n hoverBorder: 'palette.colors.gray.300',\n pressedBackground: 'palette.colors.gray.200',\n focusRing: 'semantic.colors.interactive.focus',\n disabledOpacity: '0.5',\n },\n card: {\n background: 'semantic.colors.surface',\n foreground: 'semantic.colors.text',\n border: 'semantic.colors.border',\n borderRadius: 'palette.radius.xl',\n padding: '1rem',\n shadow: 'palette.shadows.sm',\n gap: '0.625rem',\n itemGap: '8px',\n minHeight: '72px',\n fontSize: '0.875rem',\n lineHeight: '1.35',\n iconSize: '18px',\n hoverBackground: 'palette.colors.gray.100',\n hoverBorder: 'palette.colors.gray.300',\n pressedBackground: 'palette.colors.gray.200',\n focusRing: 'semantic.colors.interactive.focus',\n disabledOpacity: '0.5',\n },\n list: {\n background: 'transparent',\n foreground: 'semantic.colors.text',\n border: 'semantic.colors.border',\n borderRadius: 'palette.radius.md',\n padding: '0.75rem',\n gap: '0.625rem',\n itemGap: '8px',\n minHeight: '44px',\n fontSize: '0.875rem',\n lineHeight: '1.35',\n iconSize: '17px',\n hoverBackground: 'palette.colors.gray.100',\n hoverBorder: 'palette.colors.gray.300',\n pressedBackground: 'palette.colors.gray.200',\n focusRing: 'semantic.colors.interactive.focus',\n disabledOpacity: '0.5',\n },\n },\n toolBubble: {\n shadow: 'palette.shadows.sm',\n },\n reasoningBubble: {\n shadow: 'palette.shadows.sm',\n },\n composer: {\n shadow: 'palette.shadows.none',\n },\n scrollbar: {\n thumb: 'semantic.colors.border',\n track: 'transparent',\n },\n markdown: {\n inlineCode: {\n background: 'palette.colors.gray.50',\n foreground: 'palette.colors.gray.900',\n },\n link: {\n // Links/Focus role: solid primary\n foreground: 'palette.colors.primary.600',\n },\n prose: {\n fontFamily: 'inherit',\n },\n codeBlock: {\n background: 'semantic.colors.container',\n borderColor: 'semantic.colors.border',\n textColor: 'inherit',\n borderRadius: 'palette.radius.md',\n },\n table: {\n headerBackground: 'semantic.colors.container',\n borderColor: 'semantic.colors.border',\n },\n hr: {\n color: 'semantic.colors.divider',\n },\n blockquote: {\n borderColor: 'palette.colors.gray.900',\n background: 'transparent',\n textColor: 'palette.colors.gray.500',\n },\n },\n collapsibleWidget: {\n container: 'palette.colors.gray.50',\n surface: 'semantic.colors.surface',\n border: 'semantic.colors.border',\n },\n voice: {\n recording: {\n indicator: 'palette.colors.error.500',\n background: 'palette.colors.error.50',\n border: 'palette.colors.error.200',\n },\n processing: {\n icon: 'palette.colors.primary.500',\n background: 'palette.colors.primary.50',\n },\n speaking: {\n icon: 'palette.colors.success.500',\n },\n },\n // Neutral surface card (components/approval-actions.ts). The primary action\n // anchors to the brand primary; deny is a neutral tinted button. Consumers who\n // themed these (or set config.approval.* color overrides) still win.\n approval: {\n requested: {\n background: 'semantic.colors.surface',\n border: 'semantic.colors.border',\n text: 'palette.colors.gray.900',\n shadow: '0 1px 2px 0 rgba(11, 11, 11, 0.06), 0 2px 8px 0 rgba(11, 11, 11, 0.04)',\n },\n approve: {\n background: 'semantic.colors.primary',\n foreground: 'semantic.colors.textInverse',\n borderRadius: 'palette.radius.md',\n padding: 'semantic.spacing.sm',\n },\n deny: {\n background: 'semantic.colors.container',\n foreground: 'semantic.colors.text',\n borderRadius: 'palette.radius.md',\n padding: 'semantic.spacing.sm',\n },\n },\n attachment: {\n image: {\n background: 'palette.colors.gray.100',\n border: 'palette.colors.gray.200',\n },\n },\n // Event-stream badge chips: 100-tone fill / dark text per family. tool/agent\n // keep their pre-token literals (#6b21a8 / #115e59), which sit at the 800\n // step of the canonical purple/teal ramps.\n eventStream: {\n badge: {\n flow: { background: 'palette.colors.success.100', foreground: 'palette.colors.success.700' },\n step: { background: 'palette.colors.primary.100', foreground: 'palette.colors.primary.700' },\n reasoning: { background: 'palette.colors.warning.100', foreground: 'palette.colors.warning.700' },\n tool: { background: 'palette.colors.purple.100', foreground: 'palette.colors.purple.800' },\n agent: { background: 'palette.colors.teal.100', foreground: 'palette.colors.teal.800' },\n error: { background: 'palette.colors.error.100', foreground: 'palette.colors.error.700' },\n default: { background: 'palette.colors.gray.100', foreground: 'palette.colors.gray.600' },\n },\n },\n scrollToBottom: {\n background: 'components.button.primary.background',\n foreground: 'components.button.primary.foreground',\n border: 'semantic.colors.primary',\n size: '40px',\n borderRadius: 'palette.radius.full',\n shadow: 'palette.shadows.sm',\n padding: '0.5rem 0.875rem',\n gap: '0.5rem',\n fontSize: '0.875rem',\n iconSize: '14px',\n },\n artifact: {\n pane: {\n background: 'semantic.colors.container',\n toolbarBackground: 'semantic.colors.container',\n },\n },\n};\n\n/** Shared defaults with a small opt-in V5 overlay. */\nconst DEFAULT_PALETTE_GRAY_V4 = DEFAULT_PALETTE_BASE.colors.gray;\nconst DEFAULT_PALETTE_GRAY_V5 = {\n 50: '#fafafa', 100: '#f5f5f5', 200: '#e5e5e5', 300: '#d4d4d4',\n 400: '#a3a3a3', 500: '#737373', 600: '#525252', 700: '#404040',\n 800: '#262626', 900: '#171717', 950: '#0a0a0a',\n};\n\nexport const DEFAULT_PALETTE_V4 = {\n ...DEFAULT_PALETTE_BASE,\n colors: { ...DEFAULT_PALETTE_BASE.colors, gray: DEFAULT_PALETTE_GRAY_V4 },\n};\nexport const DEFAULT_PALETTE_V5 = {\n ...DEFAULT_PALETTE_BASE,\n colors: { ...DEFAULT_PALETTE_BASE.colors, gray: DEFAULT_PALETTE_GRAY_V5 },\n radius: { none: '0px', sm: '4px', md: '8px', lg: '12px', xl: '16px', '2xl': '24px', full: '9999px' },\n};\nexport const DEFAULT_PALETTE = DEFAULT_PALETTE_V4;\n\nexport const DEFAULT_SEMANTIC_V4 = DEFAULT_SEMANTIC_BASE;\nexport const DEFAULT_SEMANTIC_V5: SemanticTokens = {\n ...DEFAULT_SEMANTIC_BASE,\n colors: {\n ...DEFAULT_SEMANTIC_BASE.colors,\n surface: '#ffffff', background: '#ffffff', container: 'semantic.colors.surface',\n textInverse: '#ffffff',\n },\n typography: { ...DEFAULT_SEMANTIC_BASE.typography, fontSize: '14px', lineHeight: '1.5' },\n};\nexport const DEFAULT_SEMANTIC = DEFAULT_SEMANTIC_V4;\n\nexport const DEFAULT_COMPONENTS_V4 = DEFAULT_COMPONENTS_BASE;\nexport const DEFAULT_COMPONENTS_V5: ComponentTokens = {\n ...DEFAULT_COMPONENTS_BASE,\n scrollToBottom: {\n ...DEFAULT_COMPONENTS_BASE.scrollToBottom,\n background: 'semantic.colors.surface',\n foreground: 'semantic.colors.text',\n border: 'semantic.colors.border',\n size: '32px',\n },\n messageActions: {\n background: 'transparent',\n border: 'none',\n hoverBackground: 'components.button.ghost.hoverBackground',\n hoverForeground: 'semantic.colors.text',\n borderRadius: 'palette.radius.md',\n },\n launcher: CIRCLE_LAUNCHER_TOKENS,\n activity: {\n // CSS owns contextual parent, nested, and coarse-pointer row heights.\n labelSize: \"13px\", iconSize: \"16px\", indent: \"0px\",\n transcriptGap: \"0px\", responseGap: \"12px\",\n groupIndent: \"16px\", groupGap: \"2px\", groupPadding: \"2px 0\",\n bodyPadding: \"4px 0\", bodyFontWeight: \"400\", sectionGap: \"8px\", bodySurface: \"transparent\",\n },\n toolBubble: { shadow: \"none\" },\n reasoningBubble: { shadow: \"none\" },\n input: { ...DEFAULT_COMPONENTS_BASE.input, borderRadius: 'palette.radius.full' },\n introCard: { ...DEFAULT_COMPONENTS_BASE.introCard, title: { fontSize: '22px', fontWeight: '500' } },\n suggestion: {\n chip: { ...DEFAULT_COMPONENTS_BASE.suggestion!.chip, fontWeight: '400' },\n card: { ...DEFAULT_COMPONENTS_BASE.suggestion!.card, fontWeight: '400' },\n list: { ...DEFAULT_COMPONENTS_BASE.suggestion!.list, fontWeight: '400' },\n },\n panel: {\n ...DEFAULT_COMPONENTS_BASE.panel,\n width: 'min(400px, calc(100vw - 24px))',\n height: 'min(704px, calc(100dvh - 104px))',\n borderRadius: 'palette.radius.xl',\n },\n header: {\n ...DEFAULT_COMPONENTS_BASE.header,\n background: 'semantic.colors.container', foreground: 'semantic.colors.text',\n padding: '8px 8px 8px 16px', minimalPadding: '8px 8px 8px 16px',\n minHeight: '48px', borderBottom: 'none',\n iconBackground: 'transparent', iconForeground: 'semantic.colors.text', iconScale: '1', iconPadding: 'auto',\n controlSize: '28px', controlIconSize: '16px', controlStrokeWidth: '1.5',\n actionIconForeground: 'semantic.colors.textMuted',\n controlBorderRadius: '8px',\n controlHoverBackground: 'color-mix(in srgb, var(--persona-text) 8%, transparent)',\n controlHoverForeground: 'semantic.colors.text',\n controlFocusOutline: '2px solid color-mix(in srgb, var(--persona-text) 50%, transparent)',\n title: { fontSize: '14px', fontWeight: '500', lineHeight: '1.5' },\n },\n message: {\n ...DEFAULT_COMPONENTS_BASE.message,\n gap: '20px', fullscreenGap: '28px', topFadeHeight: '18px',\n user: {\n ...DEFAULT_COMPONENTS_BASE.message.user,\n background: 'palette.colors.gray.100', text: 'semantic.colors.text',\n borderRadius: 'palette.radius.xl', shadow: 'none', padding: '8px 14px',\n fontSize: '14px', lineHeight: '1.5',\n },\n assistant: {\n ...DEFAULT_COMPONENTS_BASE.message.assistant,\n background: 'transparent', border: 'transparent', borderWidth: '0px',\n borderRadius: '0px', shadow: 'none', padding: '0px',\n fontSize: '14px', lineHeight: '1.55',\n },\n },\n artifact: {\n ...DEFAULT_COMPONENTS_BASE.artifact,\n card: {\n background: 'semantic.colors.surface',\n border: '1px solid var(--persona-border)',\n borderRadius: 'palette.radius.lg',\n hoverBackground: 'components.button.ghost.hoverBackground',\n hoverBorderColor: 'semantic.colors.border',\n },\n inline: {\n background: 'semantic.colors.surface',\n border: '1px solid var(--persona-border)',\n borderRadius: 'palette.radius.lg',\n chromeBackground: 'semantic.colors.surface',\n chromeBorder: 'semantic.colors.border',\n titleColor: 'semantic.colors.text',\n mutedColor: 'semantic.colors.textMuted',\n },\n },\n composer: {\n ...DEFAULT_COMPONENTS_BASE.composer,\n padding: '8px', fontSize: '15px', lineHeight: '1.5', controlSize: '32px', controlIconSize: '20px',\n expandedPadding: '12px 16px', expandedBorderRadius: '24px',\n sendIconSize: '18px', sendButtonRadius: '9999px', footerBorder: 'none',\n overflowMenu: { borderRadius: '12px' },\n overlayBand: 'linear-gradient(to bottom, transparent, var(--persona-container) 24px)',\n focusBorderColor: 'color-mix(in srgb, var(--persona-text) 28%, var(--persona-border))',\n focusRing: '1px solid color-mix(in srgb, var(--persona-text) 12%, transparent)',\n },\n};\nexport const DEFAULT_COMPONENTS = DEFAULT_COMPONENTS_V4;\n\nexport type ThemeDefaultsVersion = 'v4' | 'v5';\n\nexport const resolveThemeDefaultsVersion = (future?: { v5Defaults?: boolean }): ThemeDefaultsVersion =>\n resolveDefaultsVersion({ future });\n\nexport const resolveThemeDefaults = (future?: { v5Defaults?: boolean }) => {\n const version = resolveThemeDefaultsVersion(future);\n return version === 'v5'\n ? { palette: DEFAULT_PALETTE_V5, semantic: DEFAULT_SEMANTIC_V5, components: DEFAULT_COMPONENTS_V5 }\n : { palette: DEFAULT_PALETTE_V4, semantic: DEFAULT_SEMANTIC_V4, components: DEFAULT_COMPONENTS_V4 };\n};\n\nexport function resolveTokenValue(theme: PersonaTheme, path: string): string | undefined {\n if (\n !path.startsWith('palette.') &&\n !path.startsWith('semantic.') &&\n !path.startsWith('components.')\n ) {\n return path;\n }\n\n const parts = path.split('.');\n let current: any = theme;\n\n for (const part of parts) {\n if (current === undefined || current === null) {\n return undefined;\n }\n current = current[part];\n }\n\n if (\n typeof current === 'string' &&\n (current.startsWith('palette.') ||\n current.startsWith('semantic.') ||\n current.startsWith('components.'))\n ) {\n return resolveTokenValue(theme, current);\n }\n\n return current;\n}\n\nexport function resolveTokens(theme: PersonaTheme): Record<string, ResolvedToken> {\n const resolved: Record<string, ResolvedToken> = {};\n\n function resolveObject(obj: any, prefix: string) {\n for (const [key, value] of Object.entries(obj)) {\n const path = `${prefix}.${key}`;\n\n if (typeof value === 'string') {\n const resolvedValue = resolveTokenValue(theme, value);\n if (resolvedValue !== undefined) {\n resolved[path] = {\n path,\n value: resolvedValue,\n type:\n prefix.includes('color')\n ? 'color'\n : prefix.includes('spacing')\n ? 'spacing'\n : prefix.includes('typography')\n ? 'typography'\n : prefix.includes('shadow')\n ? 'shadow'\n : prefix.includes('border')\n ? 'border'\n : 'color',\n };\n }\n } else if (typeof value === 'object' && value !== null) {\n resolveObject(value, path);\n }\n }\n }\n\n resolveObject(theme.palette, 'palette');\n resolveObject(theme.semantic, 'semantic');\n resolveObject(theme.components, 'components');\n\n return resolved;\n}\n\nexport function validateTheme(theme: Partial<PersonaTheme>): ThemeValidationResult {\n const errors: ThemeValidationError[] = [];\n const warnings: ThemeValidationError[] = [];\n\n if (!theme.palette) {\n errors.push({\n path: 'palette',\n message: 'Theme must include a palette',\n severity: 'error',\n });\n }\n\n if (!theme.semantic) {\n warnings.push({\n path: 'semantic',\n message: 'No semantic tokens defined - defaults will be used',\n severity: 'warning',\n });\n }\n\n if (!theme.components) {\n warnings.push({\n path: 'components',\n message: 'No component tokens defined - defaults will be used',\n severity: 'warning',\n });\n }\n\n return {\n valid: errors.length === 0,\n errors,\n warnings,\n };\n}\n\nfunction mergeRecords(\n base: Record<string, unknown>,\n override: Record<string, unknown>\n): Record<string, unknown> {\n const result = { ...base };\n for (const [key, value] of Object.entries(override)) {\n const existing = result[key];\n if (existing && typeof existing === 'object' && !Array.isArray(existing) &&\n value && typeof value === 'object' && !Array.isArray(value)) {\n result[key] = mergeRecords(\n existing as Record<string, unknown>,\n value as Record<string, unknown>\n );\n } else {\n result[key] = value;\n }\n }\n return result;\n}\n\nexport function createTheme(\n userConfig?: DeepPartial<PersonaTheme>,\n options: CreateThemeOptions = {}\n): PersonaTheme {\n const baseTheme = resolveThemeDefaults(options.future) as PersonaTheme;\n const components = userConfig?.components;\n\n let theme: PersonaTheme = {\n palette: {\n ...baseTheme.palette,\n ...userConfig?.palette,\n colors: {\n ...baseTheme.palette.colors,\n ...userConfig?.palette?.colors,\n },\n spacing: {\n ...baseTheme.palette.spacing,\n ...userConfig?.palette?.spacing,\n },\n typography: {\n ...baseTheme.palette.typography,\n ...userConfig?.palette?.typography,\n },\n shadows: {\n ...baseTheme.palette.shadows,\n ...userConfig?.palette?.shadows,\n },\n borders: {\n ...baseTheme.palette.borders,\n ...userConfig?.palette?.borders,\n },\n radius: {\n ...baseTheme.palette.radius,\n ...userConfig?.palette?.radius,\n },\n },\n semantic: {\n ...baseTheme.semantic,\n ...userConfig?.semantic,\n colors: {\n ...baseTheme.semantic.colors,\n ...userConfig?.semantic?.colors,\n interactive: {\n ...baseTheme.semantic.colors.interactive,\n ...userConfig?.semantic?.colors?.interactive,\n },\n feedback: {\n ...baseTheme.semantic.colors.feedback,\n ...userConfig?.semantic?.colors?.feedback,\n },\n },\n spacing: {\n ...baseTheme.semantic.spacing,\n ...userConfig?.semantic?.spacing,\n },\n typography: {\n ...baseTheme.semantic.typography,\n ...userConfig?.semantic?.typography,\n },\n },\n components: components ? mergeRecords(\n baseTheme.components as unknown as Record<string, unknown>,\n components as Record<string, unknown>\n ) as unknown as ComponentTokens : baseTheme.components,\n } as PersonaTheme;\n\n // Project shared activity aliases without mutating the versioned defaults.\n const activity = components?.activity;\n for (const kind of ['toolBubble', 'reasoningBubble'] as const) {\n const tokens = theme.components[kind] = { ...theme.components[kind] };\n for (const field of ['rowHeight', 'labelSize', 'iconSize', 'indent', 'bodySurface'] as const) {\n if (activity?.[field] !== undefined && (field !== 'bodySurface' || components?.[kind]?.bodySurface === undefined)) tokens[field] = activity[field];\n }\n }\n const legacySurface = components?.collapsibleWidget?.surface;\n // V4 keeps the historical shared surface. V5 separates activity from code\n // widgets; callers use activity.bodySurface (or the per-kind override).\n if (resolveDefaultsVersion(options) === 'v4' && legacySurface !== undefined && activity?.bodySurface === undefined) {\n theme.components.activity = { ...theme.components.activity, bodySurface: legacySurface };\n }\n\n // Shared header padding also supplies minimal padding unless authored separately.\n const suppliedHeader = components?.header;\n if (suppliedHeader?.padding !== undefined && suppliedHeader.minimalPadding === undefined) {\n theme.components.header.minimalPadding = theme.components.header.padding;\n }\n\n const suppliedComposer = components?.composer;\n // An input-only override leaves the composer's defaults shared after merging.\n // Derive expanded values on a fresh object so a brand cannot mutate defaults\n // for a sibling instance or survive removal from the current configuration.\n theme.components.composer = { ...theme.components.composer };\n if (suppliedComposer?.padding !== undefined && suppliedComposer.expandedPadding === undefined) {\n theme.components.composer.expandedPadding = suppliedComposer.padding;\n }\n if (components?.input?.borderRadius !== undefined && suppliedComposer?.expandedBorderRadius === undefined) {\n theme.components.composer.expandedBorderRadius = components.input.borderRadius;\n }\n\n const suppliedMessage = components?.message;\n if (suppliedMessage?.gap !== undefined && suppliedMessage.fullscreenGap === undefined) {\n theme.components.message.fullscreenGap = theme.components.message.gap;\n }\n\n if (options.validate !== false) {\n const validation = validateTheme(theme);\n if (!validation.valid) {\n throw new Error(\n `Theme validation failed: ${validation.errors.map((e) => e.message).join(', ')}`\n );\n }\n }\n\n if (options.plugins) {\n for (const plugin of options.plugins) {\n theme = plugin.transform(theme);\n }\n }\n\n return theme;\n}\n\n/** Coerce a unitless \"0\" to \"0px\" for vars consumed inside length calc()s. */\nconst zeroLength = (value: string): string => (value.trim() === '0' ? '0px' : value);\n\nconst V = '--persona-';\n\n/**\n * WCAG relative luminance of a hex (3/4/6/8 digit) or rgb()/rgba() color.\n * Returns undefined when the value is not parseable, so callers can fall back.\n */\nconst relativeLuminance = (color: string | undefined): number | undefined => {\n if (!color) return undefined;\n const value = color.trim().toLowerCase();\n let channels: number[] | undefined;\n\n if (value.charCodeAt(0) === 35 /* '#' */) {\n const digits = value.slice(1);\n if (!/^[0-9a-f]+$/.test(digits)) return undefined;\n if (digits.length === 3 || digits.length === 4) {\n channels = [0, 1, 2].map((i) => parseInt(digits[i] + digits[i], 16));\n } else if (digits.length === 6 || digits.length === 8) {\n channels = [0, 2, 4].map((i) => parseInt(digits.slice(i, i + 2), 16));\n }\n } else {\n const match = value.match(/^rgba?\\(([^)]+)\\)$/);\n if (match) {\n const parts = match[1].split(/[,/\\s]+/).filter(Boolean);\n if (parts.length >= 3) {\n channels = parts.slice(0, 3).map((raw) => {\n const pct = raw.endsWith('%');\n const n = parseFloat(pct ? raw.slice(0, -1) : raw);\n return pct ? (n / 100) * 255 : n;\n });\n }\n }\n }\n\n if (!channels || channels.some((c) => !Number.isFinite(c))) return undefined;\n const [r, g, b] = channels.map((c) => {\n const v = Math.max(0, Math.min(255, c)) / 255;\n return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);\n });\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n};\n\n/** Below the WCAG white/black crossover luminance, white text reads better. */\nconst DARK_SURFACE_LUMINANCE = 0.179;\n\n/**\n * Each row: [aliasSuffix, ...sources]. A source starting with '=' is a\n * literal; anything else is a cssVars lookup by suffix. First defined wins;\n * rows with no defined source emit nothing. Row order is significant.\n */\ntype AliasRow = [string, ...string[]];\n\nconst emitAliases = (cssVars: Record<string, string>, rows: AliasRow[]): void => {\n for (const [alias, ...sources] of rows) {\n let value: string | undefined;\n for (const s of sources) {\n value = s.charCodeAt(0) === 61 /* '=' */ ? s.slice(1) : cssVars[V + s];\n if (value !== undefined) break;\n }\n if (value !== undefined) cssVars[V + alias] = value;\n }\n};\n\nconst COMMON_ALIASES: AliasRow[] = [\n ['primary', 'semantic-colors-primary', 'palette-colors-primary-500'],\n ['secondary', 'semantic-colors-secondary', 'palette-colors-secondary-500'],\n ['accent', 'semantic-colors-accent', 'palette-colors-accent-500'],\n ['surface', 'semantic-colors-surface', 'palette-colors-gray-50'],\n ['background', 'semantic-colors-background', 'palette-colors-gray-50'],\n ['container', 'semantic-colors-container', 'palette-colors-gray-100'],\n ['text', 'semantic-colors-text', 'palette-colors-gray-900'],\n ['text-muted', 'semantic-colors-textMuted', 'palette-colors-gray-500'],\n ['text-inverse', 'semantic-colors-textInverse', 'palette-colors-gray-50'],\n ['border', 'semantic-colors-border', 'palette-colors-gray-200'],\n ['divider', 'semantic-colors-divider', 'palette-colors-gray-200'],\n ['muted', 'text-muted'],\n ['font-family', 'semantic-typography-fontFamily', 'palette-typography-fontFamily-sans'],\n ['font-size', 'semantic-typography-fontSize', 'palette-typography-fontSize-base'],\n ['font-weight', 'semantic-typography-fontWeight', 'palette-typography-fontWeight-normal'],\n ['line-height', 'semantic-typography-lineHeight', 'palette-typography-lineHeight-normal'],\n ['input-font-family', 'font-family'],\n ['input-font-weight', 'font-weight'],\n ['radius-sm', 'palette-radius-sm', '=0.125rem'],\n ['radius-md', 'palette-radius-md', '=0.375rem'],\n ['radius-lg', 'palette-radius-lg', '=0.5rem'],\n ['radius-xl', 'palette-radius-xl', '=0.75rem'],\n ['radius-full', 'palette-radius-full', '=9999px'],\n ['launcher-radius', 'components-launcher-borderRadius', 'palette-radius-full', '=9999px'],\n ['launcher-bg', 'components-launcher-background', 'surface'],\n ['launcher-fg', 'components-launcher-foreground', 'primary'],\n];\n\n// The collapsed launcher needs canonical tokens and shared text/launcher aliases,\n// but none of the panel, artifact, or message compatibility aliases.\nconst canonicalThemeVariables = (theme: PersonaTheme): Record<string, string> => {\n const resolved = resolveTokens(theme);\n const cssVars: Record<string, string> = {};\n\n for (const [path, token] of Object.entries(resolved)) {\n const varName = path.replace(/\\./g, '-');\n cssVars[`--persona-${varName}`] = token.value;\n }\n\n return cssVars;\n};\n\nconst emitLauncherMuted = (cssVars: Record<string, string>): void => {\n // Subtitle keeps the shared muted tone while the foreground is stock (it\n // resolves to primary); a custom foreground washes to 70% so both pill\n // text lines recolor together. Compared by resolved value, not key\n // presence: DEFAULT_COMPONENTS materializes launcher.foreground into\n // every theme.\n const launcherFg = cssVars['--persona-components-launcher-foreground'];\n cssVars['--persona-launcher-fg-muted'] =\n launcherFg && launcherFg !== cssVars['--persona-primary']\n ? `color-mix(in srgb, ${launcherFg} 70%, transparent)`\n : cssVars['--persona-muted'];\n\n};\n\nconst resolveHeaderIconPadding = (cssVars: Record<string, string>): void => {\n // Resolve after aliases so palette references and dark/brand overrides count.\n // CSS variables with runtime-dependent colors can use explicit iconPadding.\n const iconPadding = cssVars['--persona-components-header-iconPadding'];\n if (iconPadding === 'auto') {\n const background = (cssVars['--persona-components-header-iconBackground'] ?? cssVars['--persona-primary']).trim().toLowerCase();\n const channels = background.match(/^(?:rgba?|hsla?)\\(([^)]+)\\)$/)?.[1].split(/[,\\s/]+/).filter(Boolean);\n const transparent = background === 'transparent' ||\n /^#(?:[\\da-f]{3}0|[\\da-f]{6}00)$/.test(background) ||\n (channels?.length === 4 && parseFloat(channels[3]) === 0);\n cssVars['--persona-components-header-iconPadding'] = transparent ? '0px' : '6px';\n }\n\n};\n\nexport function launcherThemeToCssVariables(theme: PersonaTheme): Record<string, string> {\n const cssVars = canonicalThemeVariables(theme);\n emitAliases(cssVars, COMMON_ALIASES);\n emitLauncherMuted(cssVars);\n emitAliases(cssVars, [\n ['launcher-border', 'components-launcher-border', 'border'],\n ['launcher-shadow', 'components-launcher-shadow', '=0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)'],\n ]);\n resolveHeaderIconPadding(cssVars);\n return cssVars;\n}\n\nexport function themeToCssVariables(theme: PersonaTheme): Record<string, string> {\n const cssVars = canonicalThemeVariables(theme);\n\n emitAliases(cssVars, COMMON_ALIASES);\n emitAliases(cssVars, [\n ['ask-sheet-bg', 'components-askUserQuestion-sheet-background'],\n ['ask-sheet-border', 'components-askUserQuestion-sheet-border'],\n ['ask-sheet-shadow', 'components-askUserQuestion-sheet-shadow'],\n ['ask-pill-bg', 'components-askUserQuestion-pill-background'],\n ['ask-pill-fg', 'components-askUserQuestion-pill-foreground'],\n ['ask-pill-radius', 'components-askUserQuestion-pill-borderRadius'],\n ['ask-pill-bg-selected', 'components-askUserQuestion-pill-selectedBackground'],\n ['ask-pill-fg-selected', 'components-askUserQuestion-pill-selectedForeground'],\n ['ask-input-bg', 'components-askUserQuestion-customInput-background'],\n ['voice-recording-indicator', 'components-voice-recording-indicator', 'palette-colors-error-500'],\n ['voice-recording-bg', 'components-voice-recording-background', 'palette-colors-error-50'],\n ['voice-processing-icon', 'components-voice-processing-icon', 'palette-colors-primary-500'],\n ['voice-speaking-icon', 'components-voice-speaking-icon', 'palette-colors-success-500'],\n ['approval-bg', 'components-approval-requested-background', 'surface'],\n ['approval-border', 'components-approval-requested-border', 'border'],\n ['approval-text', 'components-approval-requested-text', 'palette-colors-gray-900'],\n ['approval-shadow', 'components-approval-requested-shadow', '=0 1px 2px 0 rgba(11, 11, 11, 0.06), 0 2px 8px 0 rgba(11, 11, 11, 0.04)'],\n ['approval-approve-bg', 'components-approval-approve-background', 'button-primary-bg'],\n ['approval-deny-bg', 'components-approval-deny-background', 'container'],\n ['attachment-image-bg', 'components-attachment-image-background', 'palette-colors-gray-100'],\n ['attachment-image-border', 'components-attachment-image-border', 'palette-colors-gray-200'],\n ]);\n emitLauncherMuted(cssVars);\n\n emitAliases(cssVars, [\n ['launcher-border', 'components-launcher-border', 'border'],\n ['button-primary-bg', 'components-button-primary-background', 'primary'],\n ['button-primary-fg', 'components-button-primary-foreground', 'text-inverse'],\n ['button-radius', 'components-button-primary-borderRadius', 'palette-radius-full', '=9999px'],\n // Stop-state send button. No fallback source: widget.css carries the idle\n // appearance in its var() fallbacks, so an unset token must stay undefined.\n ['button-stop-bg', 'components-button-stop-background'],\n ['button-stop-fg', 'components-button-stop-foreground'],\n ]);\n\n // Ghost variant: transparent, neutral-foreground icon buttons (the composer's\n // attachment + mention affordances). Wired to `components.button.ghost.*`.\n emitAliases(cssVars, [\n ['button-ghost-bg', 'components-button-ghost-background', '=transparent'],\n ['button-ghost-fg', 'components-button-ghost-foreground', 'text'],\n ['button-ghost-radius', 'components-button-ghost-borderRadius', 'radius-md', '=0.375rem'],\n ['button-ghost-hover-bg', 'components-button-ghost-hoverBackground', '=rgba(0, 0, 0, 0.05)'],\n ['panel-radius', 'components-panel-borderRadius', 'radius-xl', '=0.75rem'],\n ]);\n\n cssVars['--persona-panel-border'] =\n cssVars['--persona-components-panel-border'] ?? `1px solid ${cssVars['--persona-border']}`;\n\n emitAliases(cssVars, [\n ['panel-shadow', 'components-panel-shadow', 'palette-shadows-xl', '=0 25px 50px -12px rgba(0, 0, 0, 0.25)'],\n ]);\n\n cssVars['--persona-panel-inset'] =\n cssVars['--persona-components-panel-inset'] ?? DEFAULT_PANEL_INSET;\n cssVars['--persona-panel-canvas-bg'] =\n cssVars['--persona-components-panel-canvasBackground'] ?? DEFAULT_PANEL_CANVAS_BACKGROUND;\n\n emitAliases(cssVars, [\n ['launcher-shadow', 'components-launcher-shadow', '=0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)'],\n ['input-radius', 'components-input-borderRadius', 'radius-lg', '=0.5rem'],\n ['message-user-radius', 'components-message-user-borderRadius', 'radius-lg', '=0.5rem'],\n ['message-assistant-radius', 'components-message-assistant-borderRadius', 'radius-lg', '=0.5rem'],\n ]);\n\n // Preserve the existing truthy guards and raw values (including references).\n // Nullish aliases and zero-length normalization stay on their own paths.\n const emitTruthy = (source: object | undefined, prefix: string, rows: readonly (readonly [string, string, boolean?])[], sourcePrefix = ''): void => {\n if (!source) return;\n for (const [key, alias, resolve] of rows) {\n const value = (source as Record<string, string | undefined>)[sourcePrefix + key];\n if (value) cssVars[`--persona-${prefix}${alias}`] = resolve ? resolveTokenValue(theme, value) ?? value : value;\n }\n };\n\n // Component-level color overrides: these map component tokens to\n // dedicated CSS variables that the widget CSS reads for individual elements.\n emitAliases(cssVars, [\n ['header-bg', 'components-header-background', 'surface'],\n ]);\n\n // The background/foreground pair anchors every other header color: unset\n // text and border keys mix the two rather than falling back to page chrome.\n const headerBg = cssVars['--persona-header-bg'];\n const headerFg = cssVars['--persona-components-header-foreground'];\n const headerMutedFg = headerFg ? `color-mix(in srgb, ${headerFg} 72%, ${headerBg})` : undefined;\n cssVars['--persona-header-border'] =\n cssVars['--persona-components-header-border'] ??\n (headerFg ? `color-mix(in srgb, ${headerFg} 14%, ${headerBg})` : undefined) ??\n cssVars['--persona-divider'];\n\n emitAliases(cssVars, [\n ['header-icon-bg', 'components-header-iconBackground', 'primary'],\n ['header-icon-fg', 'components-header-iconForeground', 'text-inverse'],\n ]);\n\n resolveHeaderIconPadding(cssVars);\n\n // `title.color` / `subtitle.color` supersede the legacy *Foreground tokens.\n cssVars['--persona-header-title-fg'] =\n cssVars['--persona-components-header-title-color'] ??\n cssVars['--persona-components-header-titleForeground'] ??\n headerFg ??\n cssVars['--persona-primary'];\n cssVars['--persona-header-subtitle-fg'] =\n cssVars['--persona-components-header-subtitle-color'] ??\n cssVars['--persona-components-header-subtitleForeground'] ??\n headerMutedFg ??\n cssVars['--persona-text-muted'];\n cssVars['--persona-header-action-icon-fg'] =\n cssVars['--persona-components-header-actionIconForeground'] ??\n headerMutedFg ??\n cssVars['--persona-muted'];\n\n // Unified header control box. Every header icon button reads these two from\n // the stylesheet; per-control config keys stay inline and win. The third\n // control token, `header.controlStrokeWidth`, needs no alias: widget.css\n // reads its auto-emitted `--persona-components-header-controlStrokeWidth`\n // directly and carries the 1.5 default in the var() fallback.\n emitAliases(cssVars, [\n ['header-control-size', 'components-header-controlSize', '=32px'],\n ['header-control-icon-size', 'components-header-controlIconSize', '=16px'],\n ]);\n\n // Conditional aliases retain the consuming stylesheet's fallback when unset.\n emitTruthy(theme.components?.header, 'header-', [\n ['shadow', 'shadow'],\n ['borderBottom', 'border-bottom'],\n ['minHeight', 'min-height'],\n ]);\n emitTruthy(cssVars, 'history-rail-header-', [\n ['background', 'bg'],\n ['border', 'border'],\n ['minHeight', 'min-height'],\n ], '--persona-components-history-railHeader-');\n\n // Floating (overlay-collapsed) rail. Same conditional rule: the host's\n // inline styles carry every default in their var() fallback.\n emitTruthy(cssVars, 'history-overlay-', [\n ['margin', 'margin'],\n ['borderRadius', 'radius'],\n ['shadow', 'shadow'],\n ['background', 'bg'],\n ], '--persona-components-history-overlay-');\n\n // Row overflow menu. Same conditional rule: the chunk's CSS carries the\n // elevated color-mix default in its var() fallback.\n emitTruthy(cssVars, 'history-menu-', [\n ['background', 'bg'],\n ['borderRadius', 'radius'],\n ], '--persona-components-history-menu-');\n // Messages enter/exit motion. Read straight off the theme: durations are\n // authored as bare millisecond NUMBERS, and resolveTokens collects only\n // string leaves, so these never reach the flattened vars. A unitless value\n // gains \"ms\" for the CSS animation shorthand; 0 emits \"0ms\" (leg disabled).\n const historyMotion = theme.components?.history?.motion;\n if (historyMotion) {\n const asTime = (value: number | string | undefined): string | undefined => {\n if (value === undefined) return undefined;\n const s = String(value).trim();\n return /^\\d+(\\.\\d+)?$/.test(s) ? `${s}ms` : s;\n };\n const enterMs = asTime(historyMotion.enterDurationMs);\n if (enterMs !== undefined) cssVars['--persona-history-enter-ms'] = enterMs;\n const exitMs = asTime(historyMotion.exitDurationMs);\n if (exitMs !== undefined) cssVars['--persona-history-exit-ms'] = exitMs;\n if (historyMotion.enterEasing)\n cssVars['--persona-history-enter-easing'] = historyMotion.enterEasing;\n if (historyMotion.exitEasing)\n cssVars['--persona-history-exit-easing'] = historyMotion.exitEasing;\n }\n // Destructive action text. The chunk falls back to the light-surface\n // error-600; the built-in dark theme sets this to a passing lighter red.\n const historyDangerFg = cssVars['--persona-components-history-dangerForeground'];\n if (historyDangerFg) cssVars['--persona-history-danger-fg'] = historyDangerFg;\n // Confirmation dialog. The danger fill/label pair is always emitted so the\n // dialog follows the error palette; scrim and shadow stay conditional with\n // the dialog's inline fallbacks as the defaults.\n cssVars['--persona-danger'] =\n cssVars['--persona-components-history-confirm-dangerBackground'] ??\n cssVars['--persona-palette-colors-error-700'] ??\n '#b42318';\n cssVars['--persona-danger-fg'] =\n cssVars['--persona-components-history-confirm-dangerForeground'] ?? '#ffffff';\n for (const token of ['scrim', 'shadow'] as const) {\n const value = cssVars[`--persona-components-history-confirm-${token}`];\n if (value) cssVars[`--persona-history-confirm-${token}`] = value;\n }\n\n // Portaled control tooltip. Same conditional rule: widget.css carries the\n // built-in look in every var() fallback, so an unset token stays undefined.\n emitTruthy(cssVars, 'tooltip-', [\n ['background', 'background'],\n ['foreground', 'foreground'],\n ['hintForeground', 'hint-fg'],\n ['borderRadius', 'radius'],\n ['fontSize', 'font-size'],\n ['padding', 'padding'],\n ['maxWidth', 'max-width'],\n ['shadow', 'shadow'],\n ], '--persona-components-tooltip-');\n // Booleans never resolve into a token, so the arrow reads off the theme.\n if (theme.components?.tooltip?.arrow === false)\n cssVars['--persona-tooltip-arrow-display'] = 'none';\n\n // Keep badge defaults in CSS so an omitted badge border follows the pill,\n // and its colors follow semantic overrides without freezing resolved values.\n emitTruthy(cssVars, 'scroll-to-bottom-count-', [\n ['background', 'bg'],\n ['foreground', 'fg'],\n ['border', 'border'],\n ['borderRadius', 'radius'],\n ['size', 'size'],\n ['padding', 'padding'],\n ['fontSize', 'font-size'],\n ['fontWeight', 'font-weight'],\n ], '--persona-components-scrollToBottom-countBadge-');\n\n // V5 materializes message-action defaults in the theme; V4 retains the CSS\n // fallbacks. References follow ghost/semantic overrides in either scheme.\n emitTruthy(cssVars, 'message-action-', [\n ['background', 'bg'],\n ['border', 'border'],\n ['hoverBackground', 'hover-bg'],\n ['hoverForeground', 'hover-fg'],\n ['borderRadius', 'radius'],\n ], '--persona-components-messageActions-');\n\n // Intro card aliases: short names the panel inline-styles read directly.\n // The full-path `--persona-components-introCard-*` variables auto-emit above.\n // Default is flat (transparent, no shadow): the greeting renders as plain\n // text on the transcript background; set introCard tokens for a card look.\n emitAliases(cssVars, [\n ['intro-card-bg', 'components-introCard-background', '=transparent'],\n ['intro-card-radius', 'components-introCard-borderRadius', '=1rem'],\n ]);\n\n // Flat cards (transparent background, no shadow) drop the horizontal\n // component of the stock padding so the welcome text shares the content\n // column's left edge instead of carrying an invisible card inset. Compared\n // by resolved value, not key presence: DEFAULT_COMPONENTS materializes the\n // introCard tokens into every theme. A non-stock padding is emitted as-is;\n // '1.5rem 1.5rem' forces the symmetric inset on a flat card.\n const introBg = cssVars['--persona-components-introCard-background'];\n const introShadow = cssVars['--persona-components-introCard-shadow'];\n const introCardFlat =\n (!introBg || introBg === 'transparent' || introBg === 'none') &&\n (!introShadow || introShadow === 'none');\n const introPadding =\n cssVars['--persona-components-introCard-padding'] ?? '1.5rem';\n cssVars['--persona-intro-card-padding'] =\n introCardFlat && introPadding === '1.5rem' ? '1.5rem 0' : introPadding;\n\n emitAliases(cssVars, [\n ['intro-card-shadow', 'components-introCard-shadow', '=none'],\n ['intro-card-border', 'components-introCard-border', '=none'],\n ['input-background', 'components-input-background', 'surface'],\n ['input-placeholder', 'components-input-placeholder', 'text-muted'],\n ['input-backdrop-filter', 'components-input-backdropFilter', '=none'],\n ['message-user-bg', 'components-message-user-background', 'accent'],\n ['message-user-text', 'components-message-user-text', 'text-inverse'],\n ['message-user-shadow', 'components-message-user-shadow', '=0 5px 15px rgba(15, 23, 42, 0.08)'],\n ['message-assistant-bg', 'components-message-assistant-background', 'surface'],\n ['message-assistant-text', 'components-message-assistant-text', 'text'],\n ['message-assistant-border', 'components-message-assistant-border', 'border'],\n ['message-assistant-shadow', 'components-message-assistant-shadow', '=0 1px 2px 0 rgb(0 0 0 / 0.05)'],\n ['scroll-to-bottom-bg', 'components-scrollToBottom-background', 'button-primary-bg', 'accent'],\n ['scroll-to-bottom-fg', 'components-scrollToBottom-foreground', 'button-primary-fg', 'text-inverse'],\n ['scroll-to-bottom-border', 'components-scrollToBottom-border', 'primary'],\n ['scroll-to-bottom-size', 'components-scrollToBottom-size', '=40px'],\n ['scroll-to-bottom-radius', 'components-scrollToBottom-borderRadius', 'button-radius', 'radius-full', '=9999px'],\n ['scroll-to-bottom-shadow', 'components-scrollToBottom-shadow', 'palette-shadows-sm', '=0 1px 2px 0 rgb(0 0 0 / 0.05)'],\n ['scroll-to-bottom-padding', 'components-scrollToBottom-padding', '=0.5rem 0.875rem'],\n ['scroll-to-bottom-gap', 'components-scrollToBottom-gap', '=0.5rem'],\n ['scroll-to-bottom-font-size', 'components-scrollToBottom-fontSize', 'palette-typography-fontSize-sm', '=0.875rem'],\n ['scroll-to-bottom-icon-size', 'components-scrollToBottom-iconSize', '=14px'],\n // Event-stream badge chips. Materialized in every theme (light defaults in\n // DEFAULT_COMPONENTS, dark pairs in the built-in dark layer), so the\n // chip's inline var() refs always resolve inside a themed root and\n // re-resolve on scheme toggles; the literal terminals only cover unthemed\n // direct mounts.\n ['event-badge-flow-bg', 'components-eventStream-badge-flow-background', '=#dcfce7'],\n ['event-badge-flow-fg', 'components-eventStream-badge-flow-foreground', '=#15803d'],\n ['event-badge-step-bg', 'components-eventStream-badge-step-background', '=#f5f5f5'],\n ['event-badge-step-fg', 'components-eventStream-badge-step-foreground', '=#0a0a0a'],\n ['event-badge-reasoning-bg', 'components-eventStream-badge-reasoning-background', '=#fef9c3'],\n ['event-badge-reasoning-fg', 'components-eventStream-badge-reasoning-foreground', '=#a16207'],\n ['event-badge-tool-bg', 'components-eventStream-badge-tool-background', '=#f3e8ff'],\n ['event-badge-tool-fg', 'components-eventStream-badge-tool-foreground', '=#6b21a8'],\n ['event-badge-agent-bg', 'components-eventStream-badge-agent-background', '=#ccfbf1'],\n ['event-badge-agent-fg', 'components-eventStream-badge-agent-foreground', '=#115e59'],\n ['event-badge-error-bg', 'components-eventStream-badge-error-background', '=#fee2e2'],\n ['event-badge-error-fg', 'components-eventStream-badge-error-foreground', '=#b91c1c'],\n ['event-badge-default-bg', 'components-eventStream-badge-default-background', '=#f3f4f6'],\n ['event-badge-default-fg', 'components-eventStream-badge-default-foreground', '=#4b5563'],\n ['tool-bubble-shadow', 'components-toolBubble-shadow', '=0 5px 15px rgba(15, 23, 42, 0.08)'],\n ['reasoning-bubble-shadow', 'components-reasoningBubble-shadow', '=0 5px 15px rgba(15, 23, 42, 0.08)'],\n ['composer-shadow', 'components-composer-shadow', '=none'],\n ]);\n\n // Composer spacing/type. Fallbacks reproduce the utility classes the form\n // used to carry (`px-4 py-3`, `gap-2`, `text-sm`) exactly.\n emitAliases(cssVars, [\n ['panel-background', 'components-panel-background', 'surface'],\n ['transcript-background', 'components-message-background', 'container'],\n ['transcript-top-fade-background', 'components-message-topFadeBackground', 'transcript-background'],\n ['composer-footer-background', 'components-composer-footerBackground', 'surface'],\n ['composer-footer-padding', 'components-composer-footerPadding', '=1rem 1.5rem'],\n ['composer-padding', 'components-composer-padding', '=0.75rem 1rem'],\n ['composer-gap', 'components-composer-gap', '=0.5rem'],\n ['composer-font-size', 'components-composer-fontSize', '=0.875rem'],\n ['composer-line-height', 'components-composer-lineHeight', '=1.25rem'],\n // Unified composer control box. Every icon control in the action row reads\n // these two from the stylesheet; per-control config keys stay inline and win.\n ['composer-control-size', 'components-composer-controlSize', '=40px'],\n ['composer-control-icon-size', 'components-composer-controlIconSize', '=24px'],\n // Motion: one timing pair + easing for every composer animation. A `0ms`\n // duration is a kill switch; reduced-motion is enforced in CSS on top.\n ['motion-duration-fast', 'components-motion-durationFast', '=120ms'],\n ['motion-duration-base', 'components-motion-durationBase', '=200ms'],\n ['motion-easing', 'components-motion-easing', '=cubic-bezier(0.2, 0, 0, 1)'],\n ['composer-border-color', 'components-composer-borderColor', 'border', '=#e5e7eb'],\n ['composer-overlay-band', 'components-composer-overlayBand', '=transparent'],\n // `components.composer.segmented.*`, `.modelPicker.*`, and `.overflowMenu.*`\n // get no short aliases: the rows cost gzip in the critical launcher bundle,\n // which never draws a composer. widget.css reads the auto-emitted full\n // paths, like introCard title/subtitle.\n ['scrollbar-thumb', 'components-scrollbar-thumb', 'border', '=#e5e7eb'],\n ['scrollbar-track', 'components-scrollbar-track', '=transparent'],\n ['md-inline-code-bg', 'components-markdown-inlineCode-background', 'container'],\n ['md-inline-code-color', 'components-markdown-inlineCode-foreground', 'text'],\n ['md-link-color', 'components-markdown-link-foreground', 'accent', '=#0f0f0f'],\n ]);\n\n emitTruthy(cssVars, 'md-', [\n ['h1-fontSize', 'h1-size'],\n ['h1-fontWeight', 'h1-weight'],\n ['h2-fontSize', 'h2-size'],\n ['h2-fontWeight', 'h2-weight'],\n ], '--persona-components-markdown-heading-');\n\n const mdProseFont = cssVars['--persona-components-markdown-prose-fontFamily'];\n if (mdProseFont && mdProseFont !== 'inherit') {\n cssVars['--persona-md-prose-font-family'] = mdProseFont;\n }\n\n // Markdown code block\n emitAliases(cssVars, [\n ['md-code-block-bg', 'components-markdown-codeBlock-background', 'container'],\n ['md-code-block-border-color', 'components-markdown-codeBlock-borderColor', 'border'],\n ['md-code-block-text-color', 'components-markdown-codeBlock-textColor', '=inherit'],\n ]);\n\n // Follows the palette radius so square-corner themes get square code blocks;\n // the 0.375rem fallback matches palette.radius.md's default.\n emitAliases(cssVars, [\n ['md-code-block-border-radius', 'components-markdown-codeBlock-borderRadius', 'radius-md', '=0.375rem'],\n ]);\n\n // Markdown table\n emitAliases(cssVars, [\n ['md-table-header-bg', 'components-markdown-table-headerBackground', 'container'],\n ['md-table-border-color', 'components-markdown-table-borderColor', 'border'],\n ]);\n\n // Markdown HR\n emitAliases(cssVars, [\n ['md-hr-color', 'components-markdown-hr-color', 'divider'],\n ]);\n\n // Markdown blockquote\n emitAliases(cssVars, [\n ['md-blockquote-border-color', 'components-markdown-blockquote-borderColor', 'palette-colors-gray-900'],\n ['md-blockquote-bg', 'components-markdown-blockquote-background', '=transparent'],\n ['md-blockquote-text-color', 'components-markdown-blockquote-textColor', 'palette-colors-gray-500'],\n ]);\n\n // Collapsible widget chrome (tool/reasoning/approval bubbles)\n const collapsibleWidgetAliases = [\n ['container', 'surface'],\n ['surface', 'surface'],\n ['border', 'border'],\n ] as const;\n for (const [name, semanticFallback] of collapsibleWidgetAliases) {\n const value =\n cssVars[`--persona-components-collapsibleWidget-${name}`] ??\n cssVars[`--persona-${semanticFallback}`];\n if (value !== undefined) {\n cssVars[`--persona-cw-${name}`] = value;\n // Kept for custom styles that adopted the original unprefixed aliases.\n cssVars[`--cw-${name}`] = value;\n }\n }\n\n emitAliases(cssVars, [\n ['message-border', 'components-message-border', 'border'],\n ]);\n\n // Bubble geometry/type per role. No fallback source: the message layout\n // preset's value is carried in the consuming var() fallback (inline on the\n // bubble for type/padding, in widget.css for the row width cap), so an unset\n // token must leave the variable undefined.\n emitAliases(cssVars, [\n ['message-user-padding', 'components-message-user-padding'],\n ['message-user-max-width', 'components-message-user-maxWidth'],\n ['message-user-font-size', 'components-message-user-fontSize'],\n ['message-user-font-family', 'components-message-user-fontFamily'],\n ['message-user-line-height', 'components-message-user-lineHeight'],\n ['message-assistant-padding', 'components-message-assistant-padding'],\n ['message-assistant-border-width', 'components-message-assistant-borderWidth'],\n ['message-assistant-max-width', 'components-message-assistant-maxWidth'],\n ['message-assistant-font-size', 'components-message-assistant-fontSize'],\n ['message-assistant-font-family', 'components-message-assistant-fontFamily'],\n ['message-assistant-line-height', 'components-message-assistant-lineHeight'],\n ]);\n\n // Icon button tokens\n const components = theme.components;\n emitTruthy(components?.iconButton, 'icon-btn-', [\n ['background', 'bg'],\n ['border', 'border'],\n ['color', 'color'],\n ['padding', 'padding'],\n ['borderRadius', 'radius'],\n ['hoverBackground', 'hover-bg'],\n ['hoverColor', 'hover-color'],\n ['activeBackground', 'active-bg'],\n ['activeBorder', 'active-border'],\n ]);\n\n // Label button tokens\n emitTruthy(components?.labelButton, 'label-btn-', [\n ['background', 'bg'],\n ['border', 'border'],\n ['color', 'color'],\n ['padding', 'padding'],\n ['borderRadius', 'radius'],\n ['hoverBackground', 'hover-bg'],\n ['fontSize', 'font-size'],\n ['gap', 'gap'],\n ]);\n\n // Toggle group tokens\n emitTruthy(components?.toggleGroup, 'toggle-group-', [\n ['gap', 'gap'],\n ['borderRadius', 'radius'],\n ]);\n\n // Artifact tokens\n const artifact = components?.artifact;\n if (artifact?.toolbar) {\n const t = artifact.toolbar;\n emitTruthy(t, 'artifact-toolbar-icon-', [\n ['iconHoverColor', 'hover-color'],\n ['iconHoverBackground', 'hover-bg'],\n ['iconPadding', 'padding'],\n ['iconBorderRadius', 'radius'],\n ['iconBorder', 'border'],\n ]);\n // A bare \"0\" is a <number> in calc(), not a <length>; gap/padding feed the\n // toggle thumb's width calc, so a unitless zero would zero out the thumb.\n if (t.toggleGroupGap) cssVars['--persona-artifact-toolbar-toggle-group-gap'] = zeroLength(t.toggleGroupGap);\n if (t.toggleBorderRadius) cssVars['--persona-artifact-toolbar-toggle-radius'] = t.toggleBorderRadius;\n if (t.toggleGroupPadding) cssVars['--persona-artifact-toolbar-toggle-group-padding'] = zeroLength(t.toggleGroupPadding);\n emitTruthy(t, 'artifact-toolbar-toggle-group-', [\n ['toggleGroupBorder', 'border'],\n ['toggleGroupBorderRadius', 'radius'],\n ]);\n if (t.toggleGroupBackground) cssVars['--persona-artifact-toolbar-toggle-group-bg'] = resolveTokenValue(theme, t.toggleGroupBackground) ?? t.toggleGroupBackground;\n emitTruthy(t, 'artifact-toolbar-copy-', [\n ['copyBackground', 'bg'],\n ['copyBorder', 'border'],\n ['copyColor', 'color'],\n ]);\n // Feeds the split-button halves' inner-radius calc; must stay a <length>.\n if (t.copyBorderRadius) cssVars['--persona-artifact-toolbar-copy-radius'] = zeroLength(t.copyBorderRadius);\n if (t.copyPadding) cssVars['--persona-artifact-toolbar-copy-padding'] = t.copyPadding;\n if (t.copyMenuBackground) {\n cssVars['--persona-artifact-toolbar-copy-menu-bg'] = t.copyMenuBackground;\n cssVars['--persona-dropdown-bg'] = cssVars['--persona-dropdown-bg'] ?? t.copyMenuBackground;\n }\n if (t.copyMenuBorder) {\n cssVars['--persona-artifact-toolbar-copy-menu-border'] = t.copyMenuBorder;\n cssVars['--persona-dropdown-border'] = cssVars['--persona-dropdown-border'] ?? t.copyMenuBorder;\n }\n if (t.copyMenuShadow) {\n cssVars['--persona-artifact-toolbar-copy-menu-shadow'] = t.copyMenuShadow;\n cssVars['--persona-dropdown-shadow'] = cssVars['--persona-dropdown-shadow'] ?? t.copyMenuShadow;\n }\n if (t.copyMenuBorderRadius) {\n cssVars['--persona-artifact-toolbar-copy-menu-radius'] = t.copyMenuBorderRadius;\n cssVars['--persona-dropdown-radius'] = cssVars['--persona-dropdown-radius'] ?? t.copyMenuBorderRadius;\n }\n if (t.copyMenuItemHoverBackground) {\n cssVars['--persona-artifact-toolbar-copy-menu-item-hover-bg'] = t.copyMenuItemHoverBackground;\n cssVars['--persona-dropdown-item-hover-bg'] = cssVars['--persona-dropdown-item-hover-bg'] ?? t.copyMenuItemHoverBackground;\n }\n emitTruthy(t, 'artifact-toolbar-', [\n ['iconBackground', 'icon-bg'],\n ['toolbarBorder', 'border'],\n ]);\n }\n if (artifact?.tab) {\n const t = artifact.tab;\n emitTruthy(t, 'artifact-tab-', [\n ['background', 'bg'],\n ['activeBackground', 'active-bg'],\n ['activeBorder', 'active-border'],\n ['borderRadius', 'radius'],\n ['textColor', 'color'],\n ['hoverBackground', 'hover-bg'],\n ['listBackground', 'list-bg'],\n ['listBorderColor', 'list-border-color'],\n ['listPadding', 'list-padding'],\n ]);\n }\n if (artifact?.pane) {\n const t = artifact.pane;\n if (t.toolbarBackground) {\n const toolbarBg =\n resolveTokenValue(theme, t.toolbarBackground) ?? t.toolbarBackground;\n cssVars['--persona-artifact-toolbar-bg'] = toolbarBg;\n }\n }\n // The third column opts into reference resolution; raw border/height stay raw.\n emitTruthy(artifact?.card, 'artifact-card-', [\n ['background', 'bg', true],\n ['border', 'border'],\n ['borderRadius', 'radius', true],\n ['hoverBackground', 'hover-bg', true],\n ['hoverBorderColor', 'hover-border', true],\n ]);\n emitTruthy(artifact?.inline, 'artifact-inline-', [\n ['background', 'bg', true],\n ['border', 'border'],\n ['borderRadius', 'radius', true],\n ['chromeBackground', 'chrome-bg', true],\n ['chromeBorder', 'chrome-border', true],\n ['titleColor', 'title-color', true],\n ['mutedColor', 'muted-color', true],\n ['frameHeight', 'frame-height'],\n ]);\n\n // Code (syntax-highlighted artifact source view) tokens.\n const code = components?.code;\n if (code) {\n emitTruthy(code, 'code-', [\n ['keywordColor', 'keyword-color'],\n ['stringColor', 'string-color'],\n ['commentColor', 'comment-color'],\n ['numberColor', 'number-color'],\n ['tagColor', 'tag-color'],\n ['attrColor', 'attr-color'],\n ['propertyColor', 'property-color'],\n ['lineNumberColor', 'line-number-color'],\n ['gutterBorderColor', 'gutter-border-color'],\n ]);\n if (code.background)\n cssVars['--persona-code-bg'] = resolveTokenValue(theme, code.background) ?? code.background;\n }\n\n // Interactive-state defaults. The default preset resolves container === surface,\n // which turns every hover/active rule that falls back to --persona-container\n // into a visual no-op; anchor those states one gray step down in that case.\n // A flat DARK surface takes white-alpha washes instead: light grays paint a\n // near-white pill under light text. Unparseable surfaces keep the grays.\n // Component config emitted above must keep winning, so only fill vars not set.\n const stateSurface = cssVars['--persona-surface'];\n const stateContainer = cssVars['--persona-container'];\n const gray100 = cssVars['--persona-palette-colors-gray-100'] ?? '#f3f4f6';\n const gray200 = cssVars['--persona-palette-colors-gray-200'] ?? '#e5e7eb';\n const gray300 = cssVars['--persona-palette-colors-gray-300'] ?? '#d1d5db';\n const flatTheme = !stateContainer || stateContainer === stateSurface;\n const flatLuminance = relativeLuminance(stateSurface ?? cssVars['--persona-background']);\n const flatDark = flatTheme && flatLuminance !== undefined && flatLuminance < DARK_SURFACE_LUMINANCE;\n const flatHoverBg = flatDark ? 'rgba(255, 255, 255, 0.08)' : gray100;\n const flatActiveBg = flatDark ? 'rgba(255, 255, 255, 0.12)' : gray200;\n const flatActiveBorder = flatDark ? 'rgba(255, 255, 255, 0.16)' : gray300;\n const hoverBgDefault = flatTheme ? flatHoverBg : stateContainer;\n const activeBgDefault = flatTheme ? flatActiveBg : stateContainer;\n cssVars['--persona-icon-btn-hover-bg'] = cssVars['--persona-icon-btn-hover-bg'] ?? hoverBgDefault;\n cssVars['--persona-icon-btn-active-bg'] = cssVars['--persona-icon-btn-active-bg'] ?? activeBgDefault;\n if (flatTheme) {\n cssVars['--persona-icon-btn-active-border'] =\n cssVars['--persona-icon-btn-active-border'] ?? flatActiveBorder;\n }\n cssVars['--persona-label-btn-hover-bg'] = cssVars['--persona-label-btn-hover-bg'] ?? hoverBgDefault;\n cssVars['--persona-artifact-tab-hover-bg'] =\n cssVars['--persona-artifact-tab-hover-bg'] ?? hoverBgDefault;\n cssVars['--persona-artifact-card-hover-bg'] =\n cssVars['--persona-artifact-card-hover-bg'] ?? hoverBgDefault;\n\n return cssVars;\n}\n\nexport function applyThemeVariables(element: HTMLElement, theme: PersonaTheme): void {\n const cssVars = themeToCssVariables(theme);\n\n for (const [name, value] of Object.entries(cssVars)) {\n element.style.setProperty(name, value);\n }\n}\n\n/**\n * Stable `data-persona-theme-zone` values applied to key widget regions.\n * Visual editors should use `[data-persona-theme-zone=\"header\"]` selectors\n * rather than internal class names.\n */\nexport const THEME_ZONES = {\n header: 'Widget header bar',\n messages: 'Message list area',\n 'user-message': 'User message bubble',\n 'assistant-message': 'Assistant message bubble',\n composer: 'Footer / composer area',\n container: 'Main widget container',\n 'artifact-pane': 'Artifact sidebar',\n 'artifact-toolbar': 'Artifact toolbar',\n 'artifact-inline': 'Inline artifact block',\n 'artifact-inline-chrome': 'Inline artifact title bar',\n} as const;\n\nexport type ThemeZone = keyof typeof THEME_ZONES;\n","import { CIRCLE_LAUNCHER_TOKENS, resolveLauncherVariant } from \"./launcher-variant\";\nimport type { BrandConfig, CreateThemeOptions, DeepPartial, PersonaTheme } from '../types/theme';\nimport type { AgentWidgetConfig } from '../types';\nimport { resolveDefaultsVersion } from '../defaults';\nimport { createTheme, resolveTokens, themeToCssVariables, launcherThemeToCssVariables, resolveThemeDefaults, DEFAULT_COMPONENTS_V4 } from './tokens';\nimport { isEmbeddedLayout } from \"./panel-config\";\nimport { deriveBrandTheme, inferBrandColorScheme } from './brand';\nimport { deepMerge } from './deep-merge';\nimport { hasExplicitThemeStyle, OPT_IN_THEME_STYLE_PATHS } from './style-provenance';\n\nexport type ColorScheme = 'light' | 'dark' | 'auto';\n\nexport interface PersonaWidgetConfig {\n brand?: BrandConfig;\n theme?: DeepPartial<PersonaTheme>;\n darkTheme?: DeepPartial<PersonaTheme>;\n colorScheme?: ColorScheme;\n future?: { v5Defaults?: boolean };\n}\n\ntype WidgetConfig = PersonaWidgetConfig | AgentWidgetConfig;\n\nconst isPanelWidthMode = (config?: WidgetConfig): boolean =>\n !!config &&\n \"launcher\" in config &&\n (config.launcher?.sidebarMode === true || config.launcher?.mountMode === \"docked\");\n\nconst applyPanelModeWidth = (theme: PersonaTheme, config?: WidgetConfig): PersonaTheme => {\n if (!config || !isPanelWidthMode(config)) return theme;\n const lightWidth = config.theme?.components?.panel?.width;\n const darkWidth = config.darkTheme?.components?.panel?.width;\n const configuredWidth = getColorScheme(config) === \"dark\" ? darkWidth ?? lightWidth : lightWidth;\n if (configuredWidth != null) return theme;\n return {\n ...theme,\n components: {\n ...theme.components,\n panel: { ...theme.components.panel, width: resolveDefaultsVersion(config) === \"v5\" ? \"400px\" : \"420px\" },\n },\n };\n};\n\nconst DARK_PALETTE_BASE = {\n colors: {\n primary: {\n 50: '#ffffff',\n 100: '#f5f5f5',\n 200: '#d4d4d4',\n 300: '#a3a3a3',\n 400: '#737373',\n 500: '#171717',\n 600: '#0f0f0f',\n 700: '#0a0a0a',\n 800: '#050505',\n 900: '#030303',\n 950: '#000000',\n },\n secondary: {\n 50: '#f5f3ff',\n 100: '#ede9fe',\n 200: '#ddd6fe',\n 300: '#c4b5fd',\n 400: '#a78bfa',\n 500: '#8b5cf6',\n 600: '#7c3aed',\n 700: '#6d28d9',\n 800: '#5b21b6',\n 900: '#4c1d95',\n 950: '#2e1065',\n },\n accent: {\n 50: '#ecfeff',\n 100: '#cffafe',\n 200: '#a5f3fc',\n 300: '#67e8f9',\n 400: '#22d3ee',\n 500: '#06b6d4',\n 600: '#0891b2',\n 700: '#0e7490',\n 800: '#155e75',\n 900: '#164e63',\n 950: '#083344',\n },\n gray: {\n 50: '#f9fafb',\n 100: '#f3f4f6',\n 200: '#e5e7eb',\n 300: '#d1d5db',\n 400: '#9ca3af',\n 500: '#6b7280',\n 600: '#4b5563',\n 700: '#374151',\n 800: '#1f2937',\n 900: '#111827',\n 950: '#030712',\n },\n success: {\n 50: '#f0fdf4',\n 100: '#dcfce7',\n 200: '#bbf7d0',\n 300: '#86efac',\n 400: '#4ade80',\n 500: '#22c55e',\n 600: '#16a34a',\n 700: '#15803d',\n 800: '#166534',\n 900: '#14532d',\n },\n warning: {\n 50: '#fefce8',\n 100: '#fef9c3',\n 200: '#fef08a',\n 300: '#fde047',\n 400: '#facc15',\n 500: '#eab308',\n 600: '#ca8a04',\n 700: '#a16207',\n 800: '#854d0e',\n 900: '#713f12',\n },\n error: {\n 50: '#fef2f2',\n 100: '#fee2e2',\n 200: '#fecaca',\n 300: '#fca5a5',\n 400: '#f87171',\n 500: '#ef4444',\n 600: '#dc2626',\n 700: '#b91c1c',\n 800: '#991b1b',\n 900: '#7f1d1d',\n },\n },\n};\n\n/**\n * Component defaults that only hold in a dark color scheme. Layered UNDER the\n * host's theme, so any explicit value still wins.\n *\n * The ghost hover wash must invert with the scheme: 5% black is invisible on a\n * near-black surface, so every dark scheme gets a light alpha instead.\n */\nconst DARK_COMPONENTS_BASE: DeepPartial<PersonaTheme> = {\n components: {\n button: {\n ghost: {\n hoverBackground: 'rgba(255, 255, 255, 0.08)',\n },\n },\n markdown: {\n link: {\n // primary.600 is #0f0f0f in both palettes; on a charcoal bubble that\n // fails AA. primary.300 (#a3a3a3) is ~5.8:1 on gray.800 and still\n // distinct from body text (gray.100).\n foreground: 'palette.colors.primary.300',\n },\n },\n // Event-stream badge chips flip to a 900-tone fill with a 300-tone text\n // (primary is the inverted dark ramp, so 800/200 lands the same way).\n // The light defaults are 100-tone fills that read as glowing swatches on\n // a dark panel; every pair here keeps >=4.5:1 text contrast (locked by\n // event-stream-badge-theming.test.ts).\n eventStream: {\n badge: {\n flow: { background: 'palette.colors.success.900', foreground: 'palette.colors.success.300' },\n step: { background: 'palette.colors.primary.800', foreground: 'palette.colors.primary.200' },\n reasoning: { background: 'palette.colors.warning.900', foreground: 'palette.colors.warning.300' },\n tool: { background: 'palette.colors.purple.900', foreground: 'palette.colors.purple.300' },\n agent: { background: 'palette.colors.teal.900', foreground: 'palette.colors.teal.300' },\n error: { background: 'palette.colors.error.900', foreground: 'palette.colors.error.300' },\n default: { background: 'palette.colors.gray.800', foreground: 'palette.colors.gray.300' },\n },\n },\n history: {\n // error-400: the light-surface error-600 red lands ~3:1 on dark\n // surfaces, under the 4.5:1 AA floor for the 14px destructive labels.\n dangerForeground: '#f87171',\n confirm: {\n // error-600: bright enough to read as a control against a dark\n // surface (3:1 non-text) while the white label keeps 4.8:1.\n dangerBackground: 'palette.colors.error.600',\n // 45% slate darkens near-black surfaces by almost nothing; dark\n // schemes need a heavier dimmer for the modal to read as modal.\n scrim: 'rgba(0, 0, 0, 0.6)',\n },\n },\n },\n};\n\n// V4 stays frozen; V5 provides the dark neutral ramp and semantic roles.\nexport const DARK_PALETTE_V4 = DARK_PALETTE_BASE;\nexport const DARK_PALETTE_V5 = {\n ...DARK_PALETTE_V4,\n colors: {\n ...DARK_PALETTE_V4.colors,\n primary: {\n 50: '#0f0f10', 100: '#27272a', 200: '#3f3f46', 300: '#52525b',\n 400: '#71717a', 500: '#f4f4f5', 600: '#e4e4e7', 700: '#d4d4d8',\n 800: '#a1a1aa', 900: '#fafafa', 950: '#ffffff',\n },\n gray: {\n 50: '#1a1a1b', 100: '#27272a', 200: '#2a2a2d', 300: '#52525b',\n 400: '#71717a', 500: '#a1a1aa', 600: '#b4b4bd', 700: '#d4d4d8',\n 800: '#e4e4e7', 900: '#f4f4f5', 950: '#fafafa',\n },\n },\n};\nexport const DARK_COMPONENTS_V4 = DARK_COMPONENTS_BASE;\nexport const DARK_COMPONENTS_V5: DeepPartial<PersonaTheme> = {\n semantic: {\n colors: {\n primary: 'palette.colors.primary.500',\n accent: 'palette.colors.primary.600',\n background: '#0f0f10',\n surface: 'palette.colors.gray.50',\n container: '#1c1c20',\n text: 'palette.colors.gray.900',\n textMuted: 'palette.colors.gray.500',\n textInverse: '#0f0f10',\n border: 'palette.colors.gray.200',\n divider: 'palette.colors.gray.200',\n interactive: {\n default: 'palette.colors.primary.600', hover: 'palette.colors.primary.700',\n focus: 'palette.colors.primary.600', active: 'palette.colors.primary.600',\n },\n },\n },\n components: {\n ...DARK_COMPONENTS_BASE.components,\n button: {\n ...DARK_COMPONENTS_BASE.components?.button,\n primary: { background: 'semantic.colors.primary', foreground: 'palette.colors.primary.50' },\n },\n markdown: {\n inlineCode: { background: 'palette.colors.gray.100', foreground: 'semantic.colors.text' },\n link: { foreground: 'semantic.colors.accent' },\n codeBlock: {\n background: 'semantic.colors.container', borderColor: 'semantic.colors.border',\n textColor: 'semantic.colors.text',\n },\n table: { headerBackground: 'palette.colors.gray.100', borderColor: 'semantic.colors.border' },\n blockquote: {\n background: 'semantic.colors.container', borderColor: 'palette.colors.gray.300',\n textColor: 'semantic.colors.textMuted',\n },\n },\n eventStream: {\n ...DARK_COMPONENTS_BASE.components?.eventStream,\n badge: {\n ...DARK_COMPONENTS_BASE.components?.eventStream?.badge,\n step: { background: 'palette.colors.gray.100', foreground: 'palette.colors.gray.700' },\n default: { background: 'palette.colors.gray.100', foreground: 'palette.colors.gray.700' },\n },\n },\n },\n};\n\nconst resolveDarkDefaults = (future?: { v5Defaults?: boolean }) =>\n resolveDefaultsVersion({ future }) === 'v5'\n ? { palette: DARK_PALETTE_V5, components: DARK_COMPONENTS_V5 }\n : { palette: DARK_PALETTE_V4, components: DARK_COMPONENTS_V4 };\n\n/**\n * Normalize theme config for merging; rejects non-objects.\n */\nconst normalizeThemeConfig = (\n theme: DeepPartial<PersonaTheme> | Record<string, unknown> | undefined\n): DeepPartial<PersonaTheme> | undefined => {\n if (!theme || typeof theme !== 'object' || Array.isArray(theme)) return undefined;\n return theme as DeepPartial<PersonaTheme>;\n};\n\nexport const detectColorScheme = (): 'light' | 'dark' => {\n if (typeof document !== 'undefined' && document.documentElement.classList.contains('dark')) {\n return 'dark';\n }\n\n if (typeof window !== 'undefined' && window.matchMedia?.('(prefers-color-scheme: dark)').matches) {\n return 'dark';\n }\n\n return 'light';\n};\n\nconst getColorSchemeFromConfig = (config?: WidgetConfig): 'light' | 'dark' => {\n const colorScheme = config?.colorScheme ?? inferBrandColorScheme(config?.brand) ?? 'light';\n\n if (colorScheme === 'light') return 'light';\n if (colorScheme === 'dark') return 'dark';\n\n return detectColorScheme();\n};\n\nexport const getColorScheme = (config?: WidgetConfig): 'light' | 'dark' => {\n return getColorSchemeFromConfig(config);\n};\n\nexport const createLightTheme = (\n userConfig?: DeepPartial<PersonaTheme>,\n options: Pick<CreateThemeOptions, 'future'> = {}\n): PersonaTheme => {\n return createTheme(userConfig, options);\n};\n\nexport const createDarkTheme = (\n userConfig?: DeepPartial<PersonaTheme>,\n options: Pick<CreateThemeOptions, 'future'> = {}\n): PersonaTheme => {\n // createTheme() already merges every palette sub-object (radius, typography,\n // shadows, …) over the defaults, so only the dark color scales need to be\n // layered UNDER the user's colors here. Spreading a pre-built default\n // palette instead would clobber the user's non-color palette overrides\n // (radius/typography) in dark mode while light mode honored them.\n //\n // DARK_COMPONENTS goes underneath by deep merge, not spread: a shallow\n // spread of `components` would drop the dark ghost hover the moment a host\n // set any unrelated component token.\n const darkDefaults = resolveDarkDefaults(options.future);\n const config = (deepMerge(\n darkDefaults.components as Record<string, unknown>,\n (userConfig ?? {}) as Record<string, unknown>\n ) ?? {}) as DeepPartial<PersonaTheme>;\n\n return createTheme(\n {\n ...config,\n palette: {\n ...config.palette,\n // Preserve every dark stop when a host overrides just one shade.\n // Keep V4's historical scale replacement behavior unchanged.\n colors: resolveDefaultsVersion(options) === 'v5'\n ? deepMerge(darkDefaults.palette.colors, config.palette?.colors) as PersonaTheme['palette']['colors']\n : { ...darkDefaults.palette.colors, ...config.palette?.colors },\n },\n },\n { validate: false, future: options.future }\n );\n};\n\nexport const getActiveTheme = (config?: WidgetConfig): PersonaTheme => {\n const scheme = getColorScheme(config);\n const explicitTheme = deepMerge(deriveBrandTheme(config?.brand, scheme, resolveThemeDefaults(config?.future).components, config?.future?.v5Defaults), normalizeThemeConfig(config?.theme)) as DeepPartial<PersonaTheme>;\n // Variant defaults sit under explicit theme tokens in either defaults state.\n const launcherDefaults = resolveLauncherVariant(config) === 'circle'\n ? CIRCLE_LAUNCHER_TOKENS\n : { ...DEFAULT_COMPONENTS_V4.launcher, ...(config?.future?.v5Defaults ? { offset: '1.5rem' } : {}) };\n // Scope presentation defaults below caller tokens, including dark overrides.\n const embedded = isEmbeddedLayout(config as Partial<AgentWidgetConfig>);\n const lightThemeConfig = deepMerge(\n { components: {\n launcher: launcherDefaults,\n ...(embedded ? {\n panel: { background: 'transparent', modes: { inline: { border: 'none', shadow: 'none', borderRadius: '0' } } },\n header: { background: 'transparent' },\n message: { background: 'transparent' },\n composer: { footerBackground: 'transparent', footerBorder: 'none', overlayBand: 'transparent' },\n } : {}),\n } }, explicitTheme\n ) as DeepPartial<PersonaTheme>;\n const darkThemeConfig = normalizeThemeConfig(config?.darkTheme);\n\n const theme = scheme === 'dark'\n ? applyPanelModeWidth(createDarkTheme(\n deepMerge(\n (lightThemeConfig ?? {}) as Record<string, unknown>,\n (darkThemeConfig ?? {}) as Record<string, unknown>\n ) as DeepPartial<PersonaTheme>,\n { future: config?.future }\n ), config)\n : applyPanelModeWidth(createLightTheme(lightThemeConfig, { future: config?.future }), config);\n Object.defineProperty(theme, CONSUMER_PATHS, {\n value: [...OPT_IN_THEME_STYLE_PATHS, 'suggestion.chip.padding', 'suggestion.chip.fontWeight']\n .filter((path) => hasExplicitThemeStyle(config, path, scheme)),\n });\n return theme;\n};\n\nconst CONSUMER_PATHS = Symbol('persona.themeConsumerPaths');\nexport const getCssVariables = (theme: PersonaTheme): Record<string, string> => {\n const variables = themeToCssVariables(theme);\n // Legacy chip defaults differ from the public token defaults. Keep them\n // available beneath host theme intent, including observer-only scheme changes.\n variables['--persona-suggestion-compat-padding'] = '6px 12px';\n variables['--persona-suggestion-compat-weight'] = '500';\n for (const path of (theme as PersonaTheme & { [CONSUMER_PATHS]?: readonly string[] })[CONSUMER_PATHS] ?? []) {\n const suffix = path.split('.').join('-');\n const value = variables[`--persona-components-${suffix}`];\n if (value !== undefined) variables[path === 'suggestion.chip.padding'\n ? '--persona-suggestion-compat-padding' : path === 'suggestion.chip.fontWeight'\n ? '--persona-suggestion-compat-weight' : `--persona-consumer-${suffix}`] = value;\n }\n return variables;\n};\n\nconst appliedVariables = new WeakMap<HTMLElement, string[]>();\n\nexport const applyThemeVariables = (element: HTMLElement, config?: WidgetConfig): void => {\n applyVariables(element, getCssVariables(getActiveTheme(config)), config);\n};\n\n/** Same resolved theme, with only aliases used by the collapsed launcher. */\nexport const applyLauncherThemeVariables = (element: HTMLElement, config?: WidgetConfig): void => {\n applyVariables(element, launcherThemeToCssVariables(getActiveTheme(config)), config);\n};\n\nconst applyVariables = (element: HTMLElement, cssVars: Record<string, string>, config?: WidgetConfig): void => {\n for (const name of appliedVariables.get(element) ?? []) {\n if (!(name in cssVars)) element.style.removeProperty(name);\n }\n appliedVariables.set(element, Object.keys(cssVars));\n for (const [name, value] of Object.entries(cssVars)) {\n element.style.setProperty(name, value);\n }\n\n // Stamp the resolved scheme so stylesheet rules can key scheme-specific\n // defaults (e.g. the syntax-highlight palette) off the widget's own color\n // scheme instead of the OS prefers-color-scheme, which diverges whenever a\n // host pins colorScheme. Re-applied on every theme application, so live\n // config updates and theme-observer callbacks keep it current.\n element.setAttribute(\"data-persona-color-scheme\", getColorScheme(config));\n element.setAttribute(\"data-persona-defaults\", resolveDefaultsVersion(config));\n};\n\nexport const createThemeObserver = (\n callback: (scheme: 'light' | 'dark') => void\n): (() => void) => {\n const cleanupFns: Array<() => void> = [];\n\n if (typeof document !== 'undefined' && typeof MutationObserver !== 'undefined') {\n const observer = new MutationObserver(() => {\n callback(detectColorScheme());\n });\n\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['class'],\n });\n\n cleanupFns.push(() => observer.disconnect());\n }\n\n if (typeof window !== 'undefined' && window.matchMedia) {\n const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');\n const handleChange = () => callback(detectColorScheme());\n\n if (mediaQuery.addEventListener) {\n mediaQuery.addEventListener('change', handleChange);\n cleanupFns.push(() => mediaQuery.removeEventListener('change', handleChange));\n } else if (mediaQuery.addListener) {\n mediaQuery.addListener(handleChange);\n cleanupFns.push(() => mediaQuery.removeListener(handleChange));\n }\n }\n\n return () => {\n cleanupFns.forEach((fn) => fn());\n };\n};\n\nexport { createTheme, resolveTokens, themeToCssVariables };\n","import type { AgentWidgetConfig, AgentWidgetDockConfig } from \"../types\";\nimport { getPanelAliasProvenance } from \"./panel-config\";\nimport { getActiveTheme } from \"./theme\";\nimport { resolveTokenValue } from \"./tokens\";\n\nconst DEFAULT_DOCK_CONFIG: Required<AgentWidgetDockConfig> = {\n side: \"right\",\n width: \"420px\",\n animate: true,\n reveal: \"resize\",\n maxHeight: \"100dvh\",\n};\n\nexport const isDockedMountMode = (config?: AgentWidgetConfig): boolean =>\n (config?.launcher?.mountMode ?? \"floating\") === \"docked\";\n\nexport const isComposerBarMountMode = (config?: AgentWidgetConfig): boolean =>\n (config?.launcher?.mountMode ?? \"floating\") === \"composer-bar\";\n\n/**\n * Resolved dock layout. For `reveal: \"resize\"`, when the panel is closed the dock column is `0px`.\n * For `reveal: \"overlay\"`, the panel overlays with `transform`. For `reveal: \"push\"`, a sliding track\n * moves content and panel together without width animation on the main column. For `emerge`,\n * the dock column still animates like `resize` but the widget stays `dock.width` wide inside the slot.\n * Unknown keys on `launcher.dock` (e.g. legacy `collapsedWidth`) are ignored.\n */\nexport const resolveDockConfig = (\n config?: AgentWidgetConfig\n): Required<AgentWidgetDockConfig> => {\n const dock = config?.launcher?.dock;\n const width = getPanelAliasProvenance(config).dockWidth\n ? dock?.width\n : resolveTokenValue(getActiveTheme(config), \"components.panel.width\");\n return {\n side: dock?.side ?? DEFAULT_DOCK_CONFIG.side,\n width: width ?? DEFAULT_DOCK_CONFIG.width,\n animate: dock?.animate ?? DEFAULT_DOCK_CONFIG.animate,\n reveal: dock?.reveal ?? DEFAULT_DOCK_CONFIG.reveal,\n maxHeight: dock?.maxHeight ?? DEFAULT_DOCK_CONFIG.maxHeight,\n };\n};\n","import type { IconNode } from \"lucide\";\n\n/**\n * Registry-free lucide icon renderer.\n *\n * Two ways to render an icon, chosen by how the name is known:\n * - Name is a LITERAL no config can override → import the icon's data from\n * \"lucide\" (per-icon modules, tree-shakeable) and call `renderIconNode`.\n * Bundles then carry only the glyphs they use — critical for lazy chunks,\n * which would otherwise duplicate the whole ~21 kB registry (`noExternal`).\n * - Name is host-suppliable (config, mention providers, ComponentRenderers) →\n * `renderLucideIcon` in `./icons`, which resolves strings against the\n * curated registry. Chunk code must receive that resolver INJECTED (see\n * approval-deps.ts), never import it.\n *\n * This module must never import `./icons` — that would drag the registry\n * back into every bundle that only needs `renderIconNode`.\n */\nexport const renderIconNode = (\n iconData: IconNode,\n size: number | string = 24,\n color: string = \"currentColor\",\n strokeWidth: number = 2\n): SVGElement | null => {\n if (!Array.isArray(iconData)) return null;\n\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n for (const [name, value] of Object.entries({\n width: String(size), height: String(size), viewBox: \"0 0 24 24\", fill: \"none\", stroke: color,\n \"stroke-width\": String(strokeWidth), \"stroke-linecap\": \"round\", \"stroke-linejoin\": \"round\", \"aria-hidden\": \"true\",\n })) svg.setAttribute(name, value);\n\n // IconNode shape: [[\"path\", {\"d\": \"...\"}], [\"circle\", {\"cx\": \"...\"}], ...]\n for (const elementData of iconData) {\n if (!Array.isArray(elementData) || elementData.length < 2) continue;\n const tagName = elementData[0] as string;\n const attrs = elementData[1] as Record<string, string> | undefined;\n if (!attrs) continue;\n const element = document.createElementNS(\"http://www.w3.org/2000/svg\", tagName);\n for (const [key, value] of Object.entries(attrs)) {\n // Skip 'stroke' so the parent SVG's stroke attribute drives color uniformly\n if (key !== \"stroke\") element.setAttribute(key, String(value));\n }\n svg.appendChild(element);\n }\n\n return svg;\n};\n","import { createChunkLoader } from \"./utils/chunk-loader\";\nimport type { IconNode } from \"lucide\";\n\n/**\n * Loader indirection for the lazy icons-extra chunk (the config-only tail of\n * the icon registry). Stays in the core bundle AND the critical launcher\n * bundle — both register sibling-URL loaders in their IIFE entries, so a\n * launcher configured with a non-core icon paints a sized placeholder and\n * fills within one round-trip instead of shipping the whole registry.\n *\n * The fallback import must be the literal package subpath: `build:client` and\n * the launcher build run without splitting, so a relative import would be\n * inlined; the subpath is marked external in both builds and resolves through\n * the package's own `exports` map at consumer runtime (see\n * `history-view-loader.ts` for the full rationale).\n */\nexport type IconsExtraModule = {\n EXTRA_LUCIDE_ICONS: Record<string, IconNode>;\n};\n\nconst { setLoader, load } = createChunkLoader<IconsExtraModule>({\n fallbackImport: () => import(\"@runtypelabs/persona/icons-extra\"),\n});\n\n/** Override how the chunk is fetched (each IIFE registers a sibling-URL loader). */\nexport const setIconsExtraLoader = setLoader;\n\n/** Load the extra icon data. Memoized; retries after rejection. */\nexport const loadIconsExtra = load;\n","/**\n * Generic memoized loader for a lazy code-split chunk.\n *\n * Backs the near-identical loader indirections in the core/eager bundle\n * (`context-mentions-loader.ts`, `context-mentions-inline-loader.ts`,\n * `markdown-parsers-loader.ts`): each registers a runtime loader (IIFE/CDN\n * sibling-URL chunk) and falls back to an external/relative dynamic import for\n * ESM/CJS consumers. The shared semantics are:\n *\n * - `load()` memoizes the resolved module (`moduleCache`) and the in-flight\n * promise (`loadPromise`) so concurrent callers share one import.\n * - A rejected load clears `loadPromise` so a later call retries after a\n * transient failure (one dropped fetch must not disable the feature for the\n * whole session); the current caller still sees the rejection.\n * - The registered loader wins over `fallbackImport`; if no loader is\n * registered, `fallbackImport` is used.\n *\n * IMPORTANT: this module must import nothing beyond types. It sits in the core\n * bundle, so any value import here could drag chunk code back into core and\n * defeat the split (see `context-mentions-bundle.test.ts`).\n */\n\nexport type ChunkLoaderOptions<T> = {\n /**\n * Dynamic import used when no runtime loader has been registered. Keep the\n * `import(...)` literal in the calling module (not here) so the bundler\n * resolves it as an external subpath / relative chunk at that call site.\n */\n fallbackImport: () => Promise<T>;\n /**\n * When true, registering a new loader clears the cached module and any\n * in-flight promise, so a swapped loader (test injection) takes effect\n * deterministically. Production registers its loader once before any load, so\n * this only matters mid-session.\n */\n resetOnSetLoader?: boolean;\n};\n\nexport type ChunkLoader<T> = {\n setLoader: (l: () => Promise<T>) => void;\n load: () => Promise<T>;\n /** Register a resolved module synchronously (eager builds that bundle it). */\n provide: (mod: T) => void;\n /** The cached module, or null if not loaded/provided yet. */\n getSync: () => T | null;\n};\n\nexport const createChunkLoader = <T>(\n options: ChunkLoaderOptions<T>\n): ChunkLoader<T> => {\n const { fallbackImport, resetOnSetLoader = false } = options;\n\n let loader: (() => Promise<T>) | null = null;\n let moduleCache: T | null = null;\n let loadPromise: Promise<T> | null = null;\n\n const setLoader = (l: () => Promise<T>): void => {\n loader = l;\n if (resetOnSetLoader) {\n moduleCache = null;\n loadPromise = null;\n }\n };\n\n const load = (): Promise<T> => {\n if (moduleCache) return Promise.resolve(moduleCache);\n if (loadPromise) return loadPromise;\n const importChunk = loader ?? fallbackImport;\n try {\n loadPromise = importChunk()\n .then((mod) => {\n moduleCache = mod;\n return mod;\n })\n .catch((err) => {\n loadPromise = null;\n throw err;\n });\n return loadPromise;\n } catch (error) {\n // Custom loaders may throw before returning a promise. Readiness must\n // observe the same rejection/retry contract as a failed dynamic import.\n return Promise.reject(error);\n }\n };\n\n const provide = (mod: T): void => {\n moduleCache = mod;\n };\n\n const getSync = (): T | null => moduleCache;\n\n return { setLoader, load, provide, getSync };\n};\n","import type { IconNode } from \"lucide\";\nimport { renderIconNode } from \"./icon-node\";\nimport { loadIconsExtra } from \"../icons-extra-loader\";\nimport {\n Activity,\n ArrowDown,\n ArrowLeft,\n ArrowRight,\n ArrowUp,\n ArrowUpRight,\n AtSign,\n Bot,\n Check,\n ChevronDown,\n ChevronLeft,\n ChevronRight,\n ChevronUp,\n Clipboard,\n ClipboardCopy,\n CodeXml,\n Copy,\n Download,\n Ellipsis,\n ExternalLink,\n Eye,\n File as FileIcon,\n FileCode,\n FileSpreadsheet,\n FileText,\n History,\n ImagePlus,\n Loader,\n LoaderCircle,\n Maximize,\n Menu,\n MessageSquare,\n Mic,\n Minimize,\n Minus,\n PanelLeft,\n Paperclip,\n Pencil,\n Plus,\n Quote,\n RefreshCw,\n Search,\n Send,\n ShieldAlert,\n ShieldCheck,\n ShieldX,\n Square,\n Star,\n ThumbsDown,\n ThumbsUp,\n Trash,\n Trash2,\n Upload,\n Volume2,\n X,\n} from \"lucide\";\n\n/**\n * Curated icon registry for `renderLucideIcon` (host-suppliable name strings).\n *\n * Two tiers keep the payload honest:\n * - CORE (below): the initial widget chrome —\n * config DEFAULTS (bot, send, mic, x, …) plus the chrome names routed\n * through `utils/buttons` / `utils/dropdown`. Always resolves synchronously.\n * - EXTRA (`src/icons-extra.ts`): activity glyphs and the config-only tail\n * (forms, commerce, media, …). The DATA ships in the lazy `icons-extra.js`\n * sibling chunk; the first request for one of these names kicks the fetch\n * and returns a correctly-sized empty placeholder SVG that fills in place\n * when the chunk lands. Surfaces that clone/morph rendered icons should\n * subscribe to `onExtraIconsReady` and re-render. The widget prepares this\n * registry before revealing its UI, so controls never show placeholders.\n *\n * Statically-known icons in widget code do NOT use this registry: they import\n * icon data directly and call `renderIconNode` (see utils/icon-node.ts).\n *\n * Hosts can extend the registry with custom or non-curated lucide icons via\n * `registerIcons` (public API).\n *\n * See `packages/widget/docs/icon-registry-shortlist.md` for curation rationale.\n */\nconst CORE_LUCIDE_ICONS = {\n \"activity\": Activity,\n \"arrow-down\": ArrowDown,\n \"arrow-up\": ArrowUp,\n \"arrow-up-right\": ArrowUpRight,\n \"bot\": Bot,\n \"chevron-down\": ChevronDown,\n \"chevron-up\": ChevronUp,\n \"chevron-right\": ChevronRight,\n \"chevron-left\": ChevronLeft,\n \"check\": Check,\n \"clipboard\": Clipboard,\n \"clipboard-copy\": ClipboardCopy,\n \"code-xml\": CodeXml,\n \"copy\": Copy,\n \"file\": FileIcon,\n \"file-code\": FileCode,\n \"file-spreadsheet\": FileSpreadsheet,\n \"file-text\": FileText,\n \"image-plus\": ImagePlus,\n \"loader\": Loader,\n \"loader-circle\": LoaderCircle,\n \"mic\": Mic,\n \"paperclip\": Paperclip,\n \"quote\": Quote,\n \"refresh-cw\": RefreshCw,\n \"search\": Search,\n \"send\": Send,\n \"shield-alert\": ShieldAlert,\n \"shield-check\": ShieldCheck,\n \"shield-x\": ShieldX,\n \"square\": Square,\n \"square-text\": [\n [\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\" }],\n [\"path\", { d: \"M7 8h10M7 12h10M7 16h6\" }],\n ],\n \"thumbs-down\": ThumbsDown,\n \"thumbs-up\": ThumbsUp,\n \"upload\": Upload,\n \"volume-2\": Volume2,\n \"voice-bars\": [\n [\"path\", { d: \"M4 10v4\" }],\n [\"path\", { d: \"M8 6v12\" }],\n [\"path\", { d: \"M12 3v18\" }],\n [\"path\", { d: \"M16 7v10\" }],\n [\"path\", { d: \"M20 10v4\" }],\n ],\n \"x\": X,\n \"at-sign\": AtSign,\n \"arrow-left\": ArrowLeft,\n \"arrow-right\": ArrowRight,\n \"external-link\": ExternalLink,\n \"ellipsis\": Ellipsis,\n \"menu\": Menu,\n \"panel-left\": PanelLeft,\n \"plus\": Plus,\n \"minus\": Minus,\n \"pencil\": Pencil,\n \"trash\": Trash,\n \"trash-2\": Trash2,\n \"download\": Download,\n \"maximize\": Maximize,\n \"minimize\": Minimize,\n \"message-square\": MessageSquare,\n \"star\": Star,\n \"eye\": Eye,\n \"history\": History,\n} as const satisfies Record<string, IconNode>;\n\n/**\n * Names whose data lives in the lazy icons-extra chunk. Kept as a runtime\n * list (~0.8 kB) so an unknown-name typo warns immediately instead of\n * triggering a pointless chunk fetch. MUST stay in sync with the keys of\n * `EXTRA_LUCIDE_ICONS` in `src/icons-extra.ts` (asserted by\n * `icons-partition.test.ts`).\n */\nexport const EXTRA_ICON_NAMES = [\n \"brain\",\n \"toolbox\",\n \"wrench\",\n \"circle\",\n \"database\",\n \"terminal\",\n \"user\",\n \"mail\",\n \"phone\",\n \"calendar\",\n \"clock\",\n \"building\",\n \"map-pin\",\n \"lock\",\n \"key\",\n \"credit-card\",\n \"hash\",\n \"globe\",\n \"link\",\n \"circle-check\",\n \"circle-x\",\n \"triangle-alert\",\n \"info\",\n \"ban\",\n \"shield\",\n \"ellipsis-vertical\",\n \"house\",\n \"pen-line\",\n \"save\",\n \"share\",\n \"funnel\",\n \"settings\",\n \"rotate-cw\",\n \"shopping-cart\",\n \"shopping-bag\",\n \"package\",\n \"truck\",\n \"tag\",\n \"gift\",\n \"receipt\",\n \"wallet\",\n \"store\",\n \"dollar-sign\",\n \"percent\",\n \"play\",\n \"pause\",\n \"volume-x\",\n \"camera\",\n \"image\",\n \"film\",\n \"headphones\",\n \"message-circle\",\n \"bell\",\n \"heart\",\n \"eye-off\",\n \"bookmark\",\n \"calendar-days\",\n \"timer\",\n \"folder\",\n \"folder-open\",\n \"files\",\n \"chart-column\",\n \"sparkles\",\n \"zap\",\n \"sun\",\n \"moon\",\n \"flag\",\n \"lightbulb\",\n \"monitor\",\n \"smartphone\",\n] as const;\n\n/**\n * Names of lucide icons that ship with the widget (core + lazy extra). Names\n * not in this union return `null` from `renderLucideIcon` (with a console\n * warning) unless first added via `registerIcons`.\n */\nexport type IconName =\n | keyof typeof CORE_LUCIDE_ICONS\n | (typeof EXTRA_ICON_NAMES)[number];\n\n/** Runtime registry: core map + lazily-registered extra/custom icons. */\nconst runtimeIcons = new Map<string, IconNode>(\n Object.entries(CORE_LUCIDE_ICONS)\n);\n\n// ---------------------------------------------------------------------------\n// Extra-chunk heal machinery: placeholders fill in place; cloning surfaces\n// re-render via onExtraIconsReady.\n// ---------------------------------------------------------------------------\n\nconst pendingIcons = new Map<SVGElement, string>();\n\nlet extraIconsLoaded = false;\nconst extraReadySubscribers = new Set<() => void>();\n\n/**\n * Notify heal subscribers. Unlike the markdown loader's fire-once model this\n * can fire MORE THAN ONCE: `registerIcons` may cover some pending names\n * before the chunk adoption covers the rest, and cloning surfaces must\n * re-render on each. Subscribers are only released once the chunk is adopted\n * (`final`) — after that every extra-tier name resolves synchronously, so\n * clones can no longer be created pending.\n */\nconst notifyExtraIconsReady = (final: boolean): void => {\n const subs = [...extraReadySubscribers];\n if (final) extraReadySubscribers.clear();\n for (const cb of subs) {\n try {\n cb();\n } catch {\n /* one bad subscriber must not starve the others */\n }\n }\n};\n\n/**\n * Register `cb` to run once the icons-extra chunk has been adopted (or\n * `registerIcons` supplied names that were pending). For surfaces whose\n * rendered icons get CLONED (fingerprint cache + idiomorph): a clone of a\n * pending placeholder never self-fills, so those surfaces must re-render.\n * Subscribing is passive — it never kicks the fetch (the first extra-name\n * render does). No-op when the extra icons are already registered.\n */\nexport const onExtraIconsReady = (cb: () => void): (() => void) => {\n if (extraIconsLoaded) return () => {};\n extraReadySubscribers.add(cb);\n return () => {\n extraReadySubscribers.delete(cb);\n };\n};\n\nconst fillPendingIcons = (): number => {\n let filled = 0;\n for (const [el, name] of pendingIcons) {\n const data = runtimeIcons.get(name);\n if (!data) continue;\n pendingIcons.delete(el);\n filled++;\n // Only adopt children: size, color, and stroke width already live on the\n // placeholder shell, so retaining and applying those options again is redundant.\n const real = renderIconNode(data);\n if (!real) continue;\n // Fill IN PLACE: the placeholder already carries the correct svg attrs,\n // so adopting the real children swaps nothing the layout depends on.\n el.removeAttribute(\"data-persona-icon-pending\");\n while (real.firstChild) el.appendChild(real.firstChild);\n }\n return filled;\n};\n\n/**\n * Extend the registry at runtime with custom icons (or non-curated lucide\n * data). Later registrations win. Pending placeholders for the added names\n * fill immediately. Public API.\n */\nexport const registerIcons = (icons: Record<string, IconNode>): void => {\n for (const [name, data] of Object.entries(icons)) {\n runtimeIcons.set(name, data);\n }\n // Registered names may cover pending placeholders (e.g. a self-hosted\n // deployment that renamed the bundle and registers icons instead of the\n // chunk). Cloning surfaces hold COPIES the in-place fill can't reach, so\n // notify the heal subscribers whenever anything actually filled.\n if (fillPendingIcons() > 0 && !extraIconsLoaded) {\n notifyExtraIconsReady(false);\n }\n};\n\n/**\n * npm eager path (imported via `index.ts` → `icons-extra-eager.ts`): supply\n * the extra-tier data synchronously so bundled consumers keep the historical\n * all-sync `renderLucideIcon` contract. The IIFE/CDN build never calls this —\n * it lazy-loads `icons-extra.js` instead. Host `registerIcons` overrides\n * registered before this runs still win.\n */\nexport const __eagerlyProvideExtraIcons = (\n icons: Record<string, IconNode>\n): void => {\n if (extraIconsLoaded) return;\n for (const [name, data] of Object.entries(icons)) {\n if (!runtimeIcons.has(name)) runtimeIcons.set(name, data);\n }\n extraIconsLoaded = true;\n fillPendingIcons();\n notifyExtraIconsReady(true);\n};\n\n/** Prepare icon data before revealing controls, including unopened menus. */\nexport const prepareIconRegistry = (): Promise<void> | null => extraIconsLoaded ? null :\n loadIconsExtra().then(mod => __eagerlyProvideExtraIcons(mod.EXTRA_LUCIDE_ICONS));\n\nconst kickExtraIcons = (): void => {\n void prepareIconRegistry()?.catch((err) => {\n // Placeholders stay empty; the next render retries via the chunk loader.\n console.warn(\"[Persona] Failed to load the icons-extra chunk\", err);\n });\n};\n\nconst createPlaceholderSvg = (\n size: number | string,\n color: string,\n strokeWidth: number\n): SVGElement => {\n // The same shell as a resolved glyph, so filling it never changes geometry.\n const svg = renderIconNode([], size, color, strokeWidth)!;\n svg.setAttribute(\"data-persona-icon-pending\", \"true\");\n return svg;\n};\n\n/**\n * Renders a lucide icon as an inline SVG element. Works inside Shadow\n * DOM and requires no CSS.\n *\n * Core names resolve synchronously. Extra-tier names (see EXTRA_ICON_NAMES)\n * return a correctly-sized empty placeholder on first use and fill in place\n * once the lazy icons-extra chunk lands. Unknown names return `null` and log\n * a warning.\n *\n * @param iconName - A lucide kebab-case name from the registry. See\n * `IconName` for the full list, or `docs/icon-registry-shortlist.md`\n * for rationale.\n * @param size - The size in pixels (number) or any CSS length string.\n * @param color - Stroke color (default: \"currentColor\").\n * @param strokeWidth - Stroke width (default: 2).\n * @returns SVGElement, or null if the name is not in the registry.\n */\nexport const renderLucideIcon = (\n iconName: IconName | (string & {}),\n size: number | string = 24,\n color: string = \"currentColor\",\n strokeWidth: number = 2\n): SVGElement | null => {\n const iconData = runtimeIcons.get(iconName);\n if (iconData) return renderIconNode(iconData, size, color, strokeWidth);\n\n if ((EXTRA_ICON_NAMES as readonly string[]).includes(iconName)) {\n const el = createPlaceholderSvg(size, color, strokeWidth);\n // Bounded: a permanently failing chunk (ad blocker) must not accumulate\n // element refs without limit. Oldest entries are dropped — they simply\n // stay empty, like any clone the fill can't reach.\n if (pendingIcons.size >= 500) {\n pendingIcons.delete(pendingIcons.keys().next().value!);\n }\n pendingIcons.set(el, iconName);\n kickExtraIcons();\n return el;\n }\n\n console.warn(\n `Unknown Persona icon \"${iconName}\". Use registerIcons().`\n );\n return null;\n};\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Activity = [\n [\n \"path\",\n {\n d: \"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2\"\n }\n ]\n];\n\nexport { Activity as default };\n//# sourceMappingURL=activity.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ArrowDown = [\n [\"path\", { d: \"M12 5v14\" }],\n [\"path\", { d: \"m19 12-7 7-7-7\" }]\n];\n\nexport { ArrowDown as default };\n//# sourceMappingURL=arrow-down.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ArrowUp = [\n [\"path\", { d: \"m5 12 7-7 7 7\" }],\n [\"path\", { d: \"M12 19V5\" }]\n];\n\nexport { ArrowUp as default };\n//# sourceMappingURL=arrow-up.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ArrowUpRight = [\n [\"path\", { d: \"M7 7h10v10\" }],\n [\"path\", { d: \"M7 17 17 7\" }]\n];\n\nexport { ArrowUpRight as default };\n//# sourceMappingURL=arrow-up-right.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Bot = [\n [\"path\", { d: \"M12 8V4H8\" }],\n [\"rect\", { width: \"16\", height: \"12\", x: \"4\", y: \"8\", rx: \"2\" }],\n [\"path\", { d: \"M2 14h2\" }],\n [\"path\", { d: \"M20 14h2\" }],\n [\"path\", { d: \"M15 13v2\" }],\n [\"path\", { d: \"M9 13v2\" }]\n];\n\nexport { Bot as default };\n//# sourceMappingURL=bot.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ChevronDown = [[\"path\", { d: \"m6 9 6 6 6-6\" }]];\n\nexport { ChevronDown as default };\n//# sourceMappingURL=chevron-down.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ChevronUp = [[\"path\", { d: \"m18 15-6-6-6 6\" }]];\n\nexport { ChevronUp as default };\n//# sourceMappingURL=chevron-up.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ChevronRight = [[\"path\", { d: \"m9 18 6-6-6-6\" }]];\n\nexport { ChevronRight as default };\n//# sourceMappingURL=chevron-right.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ChevronLeft = [[\"path\", { d: \"m15 18-6-6 6-6\" }]];\n\nexport { ChevronLeft as default };\n//# sourceMappingURL=chevron-left.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Check = [[\"path\", { d: \"M20 6 9 17l-5-5\" }]];\n\nexport { Check as default };\n//# sourceMappingURL=check.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Clipboard = [\n [\"rect\", { width: \"8\", height: \"4\", x: \"8\", y: \"2\", rx: \"1\", ry: \"1\" }],\n [\"path\", { d: \"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2\" }]\n];\n\nexport { Clipboard as default };\n//# sourceMappingURL=clipboard.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ClipboardCopy = [\n [\"rect\", { width: \"8\", height: \"4\", x: \"8\", y: \"2\", rx: \"1\", ry: \"1\" }],\n [\"path\", { d: \"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2\" }],\n [\"path\", { d: \"M16 4h2a2 2 0 0 1 2 2v4\" }],\n [\"path\", { d: \"M21 14H11\" }],\n [\"path\", { d: \"m15 10-4 4 4 4\" }]\n];\n\nexport { ClipboardCopy as default };\n//# sourceMappingURL=clipboard-copy.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst CodeXml = [\n [\"path\", { d: \"m18 16 4-4-4-4\" }],\n [\"path\", { d: \"m6 8-4 4 4 4\" }],\n [\"path\", { d: \"m14.5 4-5 16\" }]\n];\n\nexport { CodeXml as default };\n//# sourceMappingURL=code-xml.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Copy = [\n [\"rect\", { width: \"14\", height: \"14\", x: \"8\", y: \"8\", rx: \"2\", ry: \"2\" }],\n [\"path\", { d: \"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" }]\n];\n\nexport { Copy as default };\n//# sourceMappingURL=copy.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst File = [\n [\n \"path\",\n {\n d: \"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\"\n }\n ],\n [\"path\", { d: \"M14 2v5a1 1 0 0 0 1 1h5\" }]\n];\n\nexport { File as default };\n//# sourceMappingURL=file.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst FileCode = [\n [\n \"path\",\n {\n d: \"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\"\n }\n ],\n [\"path\", { d: \"M14 2v5a1 1 0 0 0 1 1h5\" }],\n [\"path\", { d: \"M10 12.5 8 15l2 2.5\" }],\n [\"path\", { d: \"m14 12.5 2 2.5-2 2.5\" }]\n];\n\nexport { FileCode as default };\n//# sourceMappingURL=file-code.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst FileSpreadsheet = [\n [\n \"path\",\n {\n d: \"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\"\n }\n ],\n [\"path\", { d: \"M14 2v5a1 1 0 0 0 1 1h5\" }],\n [\"path\", { d: \"M8 13h2\" }],\n [\"path\", { d: \"M14 13h2\" }],\n [\"path\", { d: \"M8 17h2\" }],\n [\"path\", { d: \"M14 17h2\" }]\n];\n\nexport { FileSpreadsheet as default };\n//# sourceMappingURL=file-spreadsheet.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst FileText = [\n [\n \"path\",\n {\n d: \"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\"\n }\n ],\n [\"path\", { d: \"M14 2v5a1 1 0 0 0 1 1h5\" }],\n [\"path\", { d: \"M10 9H8\" }],\n [\"path\", { d: \"M16 13H8\" }],\n [\"path\", { d: \"M16 17H8\" }]\n];\n\nexport { FileText as default };\n//# sourceMappingURL=file-text.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ImagePlus = [\n [\"path\", { d: \"M16 5h6\" }],\n [\"path\", { d: \"M19 2v6\" }],\n [\"path\", { d: \"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5\" }],\n [\"path\", { d: \"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\" }],\n [\"circle\", { cx: \"9\", cy: \"9\", r: \"2\" }]\n];\n\nexport { ImagePlus as default };\n//# sourceMappingURL=image-plus.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Loader = [\n [\"path\", { d: \"M12 2v4\" }],\n [\"path\", { d: \"m16.2 7.8 2.9-2.9\" }],\n [\"path\", { d: \"M18 12h4\" }],\n [\"path\", { d: \"m16.2 16.2 2.9 2.9\" }],\n [\"path\", { d: \"M12 18v4\" }],\n [\"path\", { d: \"m4.9 19.1 2.9-2.9\" }],\n [\"path\", { d: \"M2 12h4\" }],\n [\"path\", { d: \"m4.9 4.9 2.9 2.9\" }]\n];\n\nexport { Loader as default };\n//# sourceMappingURL=loader.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst LoaderCircle = [[\"path\", { d: \"M21 12a9 9 0 1 1-6.219-8.56\" }]];\n\nexport { LoaderCircle as default };\n//# sourceMappingURL=loader-circle.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Mic = [\n [\"path\", { d: \"M12 19v3\" }],\n [\"path\", { d: \"M19 10v2a7 7 0 0 1-14 0v-2\" }],\n [\"rect\", { x: \"9\", y: \"2\", width: \"6\", height: \"13\", rx: \"3\" }]\n];\n\nexport { Mic as default };\n//# sourceMappingURL=mic.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Paperclip = [\n [\n \"path\",\n {\n d: \"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551\"\n }\n ]\n];\n\nexport { Paperclip as default };\n//# sourceMappingURL=paperclip.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Quote = [\n [\n \"path\",\n {\n d: \"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z\"\n }\n ],\n [\n \"path\",\n {\n d: \"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z\"\n }\n ]\n];\n\nexport { Quote as default };\n//# sourceMappingURL=quote.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst RefreshCw = [\n [\"path\", { d: \"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8\" }],\n [\"path\", { d: \"M21 3v5h-5\" }],\n [\"path\", { d: \"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16\" }],\n [\"path\", { d: \"M8 16H3v5\" }]\n];\n\nexport { RefreshCw as default };\n//# sourceMappingURL=refresh-cw.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Search = [\n [\"path\", { d: \"m21 21-4.34-4.34\" }],\n [\"circle\", { cx: \"11\", cy: \"11\", r: \"8\" }]\n];\n\nexport { Search as default };\n//# sourceMappingURL=search.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Send = [\n [\n \"path\",\n {\n d: \"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z\"\n }\n ],\n [\"path\", { d: \"m21.854 2.147-10.94 10.939\" }]\n];\n\nexport { Send as default };\n//# sourceMappingURL=send.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ShieldAlert = [\n [\n \"path\",\n {\n d: \"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\"\n }\n ],\n [\"path\", { d: \"M12 8v4\" }],\n [\"path\", { d: \"M12 16h.01\" }]\n];\n\nexport { ShieldAlert as default };\n//# sourceMappingURL=shield-alert.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ShieldCheck = [\n [\n \"path\",\n {\n d: \"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\"\n }\n ],\n [\"path\", { d: \"m9 12 2 2 4-4\" }]\n];\n\nexport { ShieldCheck as default };\n//# sourceMappingURL=shield-check.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ShieldX = [\n [\n \"path\",\n {\n d: \"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\"\n }\n ],\n [\"path\", { d: \"m14.5 9.5-5 5\" }],\n [\"path\", { d: \"m9.5 9.5 5 5\" }]\n];\n\nexport { ShieldX as default };\n//# sourceMappingURL=shield-x.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Square = [[\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\" }]];\n\nexport { Square as default };\n//# sourceMappingURL=square.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ThumbsDown = [\n [\n \"path\",\n {\n d: \"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z\"\n }\n ],\n [\"path\", { d: \"M17 14V2\" }]\n];\n\nexport { ThumbsDown as default };\n//# sourceMappingURL=thumbs-down.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ThumbsUp = [\n [\n \"path\",\n {\n d: \"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z\"\n }\n ],\n [\"path\", { d: \"M7 10v12\" }]\n];\n\nexport { ThumbsUp as default };\n//# sourceMappingURL=thumbs-up.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Upload = [\n [\"path\", { d: \"M12 3v12\" }],\n [\"path\", { d: \"m17 8-5-5-5 5\" }],\n [\"path\", { d: \"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" }]\n];\n\nexport { Upload as default };\n//# sourceMappingURL=upload.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Volume2 = [\n [\n \"path\",\n {\n d: \"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z\"\n }\n ],\n [\"path\", { d: \"M16 9a5 5 0 0 1 0 6\" }],\n [\"path\", { d: \"M19.364 18.364a9 9 0 0 0 0-12.728\" }]\n];\n\nexport { Volume2 as default };\n//# sourceMappingURL=volume-2.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst X = [\n [\"path\", { d: \"M18 6 6 18\" }],\n [\"path\", { d: \"m6 6 12 12\" }]\n];\n\nexport { X as default };\n//# sourceMappingURL=x.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst AtSign = [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"4\" }],\n [\"path\", { d: \"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8\" }]\n];\n\nexport { AtSign as default };\n//# sourceMappingURL=at-sign.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ArrowLeft = [\n [\"path\", { d: \"m12 19-7-7 7-7\" }],\n [\"path\", { d: \"M19 12H5\" }]\n];\n\nexport { ArrowLeft as default };\n//# sourceMappingURL=arrow-left.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ArrowRight = [\n [\"path\", { d: \"M5 12h14\" }],\n [\"path\", { d: \"m12 5 7 7-7 7\" }]\n];\n\nexport { ArrowRight as default };\n//# sourceMappingURL=arrow-right.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst ExternalLink = [\n [\"path\", { d: \"M15 3h6v6\" }],\n [\"path\", { d: \"M10 14 21 3\" }],\n [\"path\", { d: \"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" }]\n];\n\nexport { ExternalLink as default };\n//# sourceMappingURL=external-link.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Ellipsis = [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"1\" }],\n [\"circle\", { cx: \"19\", cy: \"12\", r: \"1\" }],\n [\"circle\", { cx: \"5\", cy: \"12\", r: \"1\" }]\n];\n\nexport { Ellipsis as default };\n//# sourceMappingURL=ellipsis.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Menu = [\n [\"path\", { d: \"M4 5h16\" }],\n [\"path\", { d: \"M4 12h16\" }],\n [\"path\", { d: \"M4 19h16\" }]\n];\n\nexport { Menu as default };\n//# sourceMappingURL=menu.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst PanelLeft = [\n [\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\" }],\n [\"path\", { d: \"M9 3v18\" }]\n];\n\nexport { PanelLeft as default };\n//# sourceMappingURL=panel-left.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Plus = [\n [\"path\", { d: \"M5 12h14\" }],\n [\"path\", { d: \"M12 5v14\" }]\n];\n\nexport { Plus as default };\n//# sourceMappingURL=plus.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Minus = [[\"path\", { d: \"M5 12h14\" }]];\n\nexport { Minus as default };\n//# sourceMappingURL=minus.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Pencil = [\n [\n \"path\",\n {\n d: \"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z\"\n }\n ],\n [\"path\", { d: \"m15 5 4 4\" }]\n];\n\nexport { Pencil as default };\n//# sourceMappingURL=pencil.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Trash = [\n [\"path\", { d: \"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6\" }],\n [\"path\", { d: \"M3 6h18\" }],\n [\"path\", { d: \"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\" }]\n];\n\nexport { Trash as default };\n//# sourceMappingURL=trash.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Trash2 = [\n [\"path\", { d: \"M10 11v6\" }],\n [\"path\", { d: \"M14 11v6\" }],\n [\"path\", { d: \"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6\" }],\n [\"path\", { d: \"M3 6h18\" }],\n [\"path\", { d: \"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\" }]\n];\n\nexport { Trash2 as default };\n//# sourceMappingURL=trash-2.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Download = [\n [\"path\", { d: \"M12 15V3\" }],\n [\"path\", { d: \"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" }],\n [\"path\", { d: \"m7 10 5 5 5-5\" }]\n];\n\nexport { Download as default };\n//# sourceMappingURL=download.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Maximize = [\n [\"path\", { d: \"M8 3H5a2 2 0 0 0-2 2v3\" }],\n [\"path\", { d: \"M21 8V5a2 2 0 0 0-2-2h-3\" }],\n [\"path\", { d: \"M3 16v3a2 2 0 0 0 2 2h3\" }],\n [\"path\", { d: \"M16 21h3a2 2 0 0 0 2-2v-3\" }]\n];\n\nexport { Maximize as default };\n//# sourceMappingURL=maximize.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Minimize = [\n [\"path\", { d: \"M8 3v3a2 2 0 0 1-2 2H3\" }],\n [\"path\", { d: \"M21 8h-3a2 2 0 0 1-2-2V3\" }],\n [\"path\", { d: \"M3 16h3a2 2 0 0 1 2 2v3\" }],\n [\"path\", { d: \"M16 21v-3a2 2 0 0 1 2-2h3\" }]\n];\n\nexport { Minimize as default };\n//# sourceMappingURL=minimize.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst MessageSquare = [\n [\n \"path\",\n {\n d: \"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z\"\n }\n ]\n];\n\nexport { MessageSquare as default };\n//# sourceMappingURL=message-square.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Star = [\n [\n \"path\",\n {\n d: \"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z\"\n }\n ]\n];\n\nexport { Star as default };\n//# sourceMappingURL=star.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst Eye = [\n [\n \"path\",\n {\n d: \"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0\"\n }\n ],\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"3\" }]\n];\n\nexport { Eye as default };\n//# sourceMappingURL=eye.mjs.map\n","/**\n * @license lucide v1.18.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst History = [\n [\"path\", { d: \"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\" }],\n [\"path\", { d: \"M3 3v5h5\" }],\n [\"path\", { d: \"M12 7v5l4 2\" }]\n];\n\nexport { History as default };\n//# sourceMappingURL=history.mjs.map\n","import { resolveLauncherVariant } from \"../utils/launcher-variant\";\nimport { createElement, createNode, cx } from \"../utils/dom\";\nimport { AgentWidgetConfig, AgentWidgetLauncherTeaserConfig } from \"../types\";\nimport { positionMap } from \"../utils/positioning\";\nimport { isDockedMountMode } from \"../utils/dock\";\nimport { renderLucideIcon } from \"../utils/icons\";\nimport { DEFAULT_OVERLAY_Z_INDEX } from \"../utils/constants\";\n\nexport interface LauncherButton {\n element: HTMLButtonElement;\n update: (config: AgentWidgetConfig) => void;\n destroy: () => void;\n}\n\nexport const createLauncherButton = (\n config: AgentWidgetConfig | undefined,\n onToggle: () => void\n): LauncherButton => {\n const button = createElement(\"button\") as HTMLButtonElement;\n button.type = \"button\";\n button.innerHTML = `\n <span class=\"persona-inline-flex persona-items-center persona-justify-center persona-rounded-full persona-bg-persona-primary persona-text-white\" data-role=\"launcher-icon\">💬</span>\n <img data-role=\"launcher-image\" class=\"persona-rounded-full persona-object-cover\" alt=\"\" style=\"display:none\" />\n <span class=\"persona-flex persona-min-w-0 persona-flex-1 persona-flex-col persona-items-start persona-text-left\">\n <span class=\"persona-block persona-w-full persona-truncate persona-text-sm persona-font-semibold persona-text-persona-launcher\" data-role=\"launcher-title\"></span>\n <span class=\"persona-block persona-w-full persona-truncate persona-text-xs persona-text-persona-launcher-muted\" data-role=\"launcher-subtitle\"></span>\n </span>\n <span class=\"persona-ml-2 persona-grid persona-place-items-center persona-rounded-full persona-bg-persona-primary persona-text-persona-call-to-action\" data-role=\"launcher-call-to-action-icon\">↗</span>\n `;\n button.addEventListener(\"click\", onToggle);\n\n const update = (newConfig: AgentWidgetConfig) => {\n const launcher = newConfig.launcher ?? {};\n const dockedMode = isDockedMountMode(newConfig);\n const circle = resolveLauncherVariant(newConfig) === \"circle\";\n if (circle) {\n button.dataset.personaLauncherVariant = \"circle\";\n button.setAttribute(\"aria-label\", launcher.title ?? \"Open chat\");\n } else {\n button.removeAttribute(\"data-persona-launcher-variant\");\n button.removeAttribute(\"aria-label\");\n }\n\n const titleEl = button.querySelector(\"[data-role='launcher-title']\");\n if (titleEl) {\n const t = launcher.title ?? \"Chat Assistant\";\n titleEl.textContent = t;\n titleEl.setAttribute(\"title\", t);\n }\n\n const subtitleEl = button.querySelector(\"[data-role='launcher-subtitle']\");\n if (subtitleEl) {\n const s = launcher.subtitle ?? \"Here to help you get answers fast\";\n subtitleEl.textContent = s;\n subtitleEl.setAttribute(\"title\", s);\n }\n\n // Hide/show text container\n const textContainer = button.querySelector(\".persona-flex-col\");\n if (textContainer) {\n if (launcher.textHidden || dockedMode || circle) {\n (textContainer as HTMLElement).style.display = \"none\";\n } else {\n (textContainer as HTMLElement).style.display = \"\";\n }\n }\n\n const icon = button.querySelector<HTMLSpanElement>(\"[data-role='launcher-icon']\");\n if (icon) {\n if (launcher.agentIconHidden) {\n icon.style.display = \"none\";\n } else {\n const iconSize = launcher.agentIconSize ?? \"40px\";\n icon.style.height = iconSize;\n icon.style.width = iconSize;\n\n // Optional custom background color for the agent icon circle. When set,\n // override the default primary-color background; otherwise restore it.\n if (launcher.agentIconBackgroundColor) {\n icon.style.backgroundColor = launcher.agentIconBackgroundColor;\n icon.classList.remove(\"persona-bg-persona-primary\");\n } else {\n icon.style.backgroundColor = \"\";\n icon.classList.add(\"persona-bg-persona-primary\");\n }\n\n // Clear existing content\n icon.innerHTML = \"\";\n \n // Render icon based on priority: Lucide icon > iconUrl > agentIconText\n if (launcher.agentIconName) {\n // Use Lucide icon\n const iconSizeNum = parseFloat(iconSize) || 24;\n const iconSvg = renderLucideIcon(launcher.agentIconName, iconSizeNum * 0.6, \"var(--persona-text-inverse, #ffffff)\", 1.5);\n if (iconSvg) {\n icon.appendChild(iconSvg);\n icon.style.display = \"\";\n } else {\n // Fallback to agentIconText if Lucide icon fails\n icon.textContent = launcher.agentIconText ?? \"💬\";\n icon.style.display = \"\";\n }\n } else if (launcher.iconUrl) {\n // Use image URL - hide icon span and show img\n icon.style.display = \"none\";\n } else {\n // Use text/emoji\n icon.textContent = launcher.agentIconText ?? \"💬\";\n icon.style.display = \"\";\n }\n }\n }\n\n const img = button.querySelector<HTMLImageElement>(\"[data-role='launcher-image']\");\n if (img) {\n const iconSize = launcher.agentIconSize ?? \"40px\";\n img.style.height = iconSize;\n img.style.width = iconSize;\n if (launcher.iconUrl && !launcher.agentIconName && !launcher.agentIconHidden) {\n // Only show image if not using Lucide icon and not hidden\n img.src = launcher.iconUrl;\n img.style.display = \"block\";\n } else {\n img.style.display = \"none\";\n }\n }\n\n const callToActionIconEl = button.querySelector<HTMLSpanElement>(\"[data-role='launcher-call-to-action-icon']\");\n if (callToActionIconEl) {\n const callToActionIconSize = launcher.callToActionIconSize ?? \"32px\";\n callToActionIconEl.style.height = callToActionIconSize;\n callToActionIconEl.style.width = callToActionIconSize;\n \n // Apply background color if configured\n if (launcher.callToActionIconBackgroundColor) {\n callToActionIconEl.style.backgroundColor = launcher.callToActionIconBackgroundColor;\n callToActionIconEl.classList.remove(\"persona-bg-persona-primary\");\n } else {\n callToActionIconEl.style.backgroundColor = \"\";\n callToActionIconEl.classList.add(\"persona-bg-persona-primary\");\n }\n\n // Apply foreground/icon color if configured\n if (launcher.callToActionIconColor) {\n callToActionIconEl.style.color = launcher.callToActionIconColor;\n callToActionIconEl.classList.remove(\"persona-text-persona-call-to-action\");\n } else {\n callToActionIconEl.style.color = \"\";\n callToActionIconEl.classList.add(\"persona-text-persona-call-to-action\");\n }\n \n // Calculate padding to adjust icon size\n let paddingTotal = 0;\n if (launcher.callToActionIconPadding) {\n callToActionIconEl.style.boxSizing = \"border-box\";\n callToActionIconEl.style.padding = launcher.callToActionIconPadding;\n // Parse padding value to calculate total padding (padding applies to both sides)\n const paddingValue = parseFloat(launcher.callToActionIconPadding) || 0;\n paddingTotal = paddingValue * 2; // padding on both sides\n } else {\n callToActionIconEl.style.boxSizing = \"\";\n callToActionIconEl.style.padding = \"\";\n }\n \n if (launcher.callToActionIconHidden || circle) {\n callToActionIconEl.style.display = \"none\";\n } else {\n callToActionIconEl.style.display = dockedMode ? \"none\" : \"\";\n \n // Clear existing content\n callToActionIconEl.innerHTML = \"\";\n \n // Use Lucide icon if provided, otherwise fall back to text\n if (launcher.callToActionIconName) {\n // Calculate actual icon size by subtracting padding\n const containerSize = parseFloat(callToActionIconSize) || 24;\n const iconSize = Math.max(containerSize - paddingTotal, 8); // Ensure minimum size of 8px\n const iconSvg = renderLucideIcon(launcher.callToActionIconName, iconSize, \"currentColor\", 1.5);\n if (iconSvg) {\n callToActionIconEl.appendChild(iconSvg);\n } else {\n // Fallback to text if icon fails to render\n callToActionIconEl.textContent = launcher.callToActionIconText ?? \"↗\";\n }\n } else {\n callToActionIconEl.textContent = launcher.callToActionIconText ?? \"↗\";\n }\n }\n }\n\n const positionClass =\n launcher.position && positionMap[launcher.position]\n ? positionMap[launcher.position]\n : positionMap[\"bottom-right\"];\n\n const floatingBase =\n \"persona-fixed persona-flex persona-items-center persona-gap-3 persona-rounded-launcher persona-bg-persona-launcher persona-py-2.5 persona-pl-3 persona-pr-3 persona-transition hover:persona-translate-y-[-2px] persona-cursor-pointer\";\n const dockedBase =\n \"persona-relative persona-mt-4 persona-mb-4 persona-mx-auto persona-flex persona-items-center persona-justify-center persona-rounded-launcher persona-bg-persona-launcher persona-transition hover:persona-translate-y-[-2px] persona-cursor-pointer\";\n\n button.className = dockedMode ? dockedBase : `${floatingBase} ${positionClass}`;\n\n if (!dockedMode) {\n button.style.zIndex = String(launcher.zIndex ?? DEFAULT_OVERLAY_Z_INDEX);\n }\n\n // Apply launcher border and shadow from config (with defaults matching previous Tailwind classes)\n const defaultBorder = \"1px solid var(--persona-launcher-border, var(--persona-border, #e5e7eb))\";\n const defaultShadow = \"var(--persona-launcher-shadow, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1))\";\n\n button.style.border = launcher.border ?? defaultBorder;\n button.style.boxShadow =\n launcher.shadow !== undefined\n ? (launcher.shadow.trim() === \"\" ? \"none\" : launcher.shadow)\n : defaultShadow;\n\n if (dockedMode) {\n // Docked mode uses a 0px column when closed and hides this button; keep no hit target.\n button.style.width = \"0\";\n button.style.minWidth = \"0\";\n button.style.maxWidth = \"0\";\n button.style.padding = \"0\";\n button.style.overflow = \"hidden\";\n button.style.border = \"none\";\n button.style.boxShadow = \"none\";\n } else {\n button.style.width = \"\";\n button.style.minWidth = \"\";\n button.style.maxWidth = launcher.collapsedMaxWidth ?? \"\";\n button.style.justifyContent = \"\";\n button.style.padding = \"\";\n button.style.overflow = \"\";\n }\n };\n\n const destroy = () => {\n button.removeEventListener(\"click\", onToggle);\n button.remove();\n };\n\n // Initial update\n if (config) {\n update(config);\n }\n\n return {\n element: button,\n update,\n destroy\n };\n};\n\n/** Teaser bubble handle. `dismiss(true)` also writes the persisted flag. */\nexport interface LauncherTeaser {\n element: HTMLElement;\n show: () => void;\n dismiss: (persist: boolean) => void;\n}\n\n/** \"auto\" covers restored/hook-driven opens: they never persist the teaser flag. */\nexport type LauncherOpenOrigin = \"user\" | \"auto\";\n\nexport interface LauncherSurface {\n /** Positioned wrapper. Sibling teaser + launcher live inside it. */\n element: HTMLElement;\n launcher: LauncherButton;\n /** Null when no teaser is configured for the current config. */\n teaser: LauncherTeaser | null;\n /** Opening the panel consumes the teaser; closing never resurrects it. */\n setPanelOpen: (open: boolean, origin?: LauncherOpenOrigin) => void;\n update: (config: AgentWidgetConfig) => void;\n destroy: () => void;\n}\n\nconst TEASER_KEY_SUFFIX = \"teaser-dismissed\";\n\n/** Consumed teaser keys for this page load; also the blocked-storage fallback. */\nconst teaserMemoryDismissed = new Set<string>();\n\nconst teaserStorageKey = (config?: AgentWidgetConfig): string => {\n const persist = config?.persistState;\n const prefix =\n (typeof persist === \"object\" ? persist?.keyPrefix : undefined) ?? \"persona-\";\n return `${prefix}${TEASER_KEY_SUFFIX}`;\n};\n\n// localStorage access throws (not just fails) in Safari private mode and\n// partitioned iframes, so every access falls back to the in-memory set.\nconst readTeaserDismissed = (key: string, useStorage: boolean): boolean => {\n if (teaserMemoryDismissed.has(key)) return true;\n if (!useStorage) return false;\n try {\n return window.localStorage.getItem(key) === \"1\";\n } catch {\n return false;\n }\n};\n\nconst writeTeaserDismissed = (key: string, useStorage: boolean): void => {\n teaserMemoryDismissed.add(key);\n if (!useStorage) return;\n try {\n window.localStorage.setItem(key, \"1\");\n } catch {\n /* blocked storage: the in-memory flag above is the fallback */\n }\n};\n\nconst prefersReducedMotion = (): boolean =>\n typeof window !== \"undefined\" &&\n typeof window.matchMedia === \"function\" &&\n window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n\nconst resolveTeaserConfig = (\n config: AgentWidgetConfig | undefined\n): AgentWidgetLauncherTeaserConfig | null => {\n const teaser = config?.launcher?.teaser;\n if (!teaser || !teaser.text) return null;\n if (config?.launcher?.enabled === false) return null;\n if (isDockedMountMode(config ?? {})) return null;\n return teaser;\n};\n\n/**\n * Launcher wrapper owning the collapsed button and its optional teaser bubble.\n * Both the critical `launcher.global.js` bundle and the full widget build the\n * launcher through this, so teaser behavior and cleanup are identical on the\n * eager and deferred paths.\n */\nexport const createLauncherSurface = (\n config: AgentWidgetConfig | undefined,\n onToggle: () => void\n): LauncherSurface => {\n const wrapper = createElement(\"div\", \"persona-launcher-surface\");\n wrapper.setAttribute(\"data-persona-launcher-surface\", \"true\");\n\n let currentConfig: AgentWidgetConfig = config ?? {};\n let teaserConfig: AgentWidgetLauncherTeaserConfig | null = null;\n let teaserElement: HTMLElement | null = null;\n let dismissButton: HTMLButtonElement | null = null;\n let teaserTextButton: HTMLButtonElement | null = null;\n let timer: ReturnType<typeof setTimeout> | null = null;\n let visible = false;\n let shown = false;\n let consumed = false;\n let panelOpen = false;\n\n const usesStorage = (): boolean =>\n (teaserConfig?.frequency ?? \"once\") === \"once\" &&\n currentConfig.persistState !== false;\n\n const clearTimer = () => {\n if (timer !== null) {\n clearTimeout(timer);\n timer = null;\n }\n };\n\n const hideBubble = () => {\n if (!teaserElement || !visible) return;\n visible = false;\n teaserElement.hidden = true;\n };\n\n const dismiss = (persist: boolean) => {\n clearTimer();\n consumed = true;\n hideBubble();\n writeTeaserDismissed(teaserStorageKey(currentConfig), persist && usesStorage());\n };\n\n /**\n * Click-through and launcher clicks consume; only a seen teaser persists.\n * An automatic open is never user intent, so it consumes in memory only.\n */\n const consumeForOpen = (origin: LauncherOpenOrigin) => {\n if (!teaserConfig || consumed) return;\n dismiss(origin === \"user\" && visible);\n };\n\n const show = () => {\n timer = null;\n if (!teaserElement || consumed || panelOpen) return;\n shown = true;\n visible = true;\n teaserElement.hidden = false;\n if (prefersReducedMotion() || typeof teaserElement.animate !== \"function\") return;\n teaserElement.animate(\n [\n { opacity: \"0\", transform: \"translateY(6px)\" },\n { opacity: \"1\", transform: \"none\" },\n ],\n { duration: 220, easing: \"ease-out\", fill: \"backwards\" }\n );\n };\n\n const schedule = () => {\n if (!teaserConfig || !teaserElement) return;\n if (consumed || shown || panelOpen) return;\n if (readTeaserDismissed(teaserStorageKey(currentConfig), usesStorage())) return;\n clearTimer();\n timer = setTimeout(show, Math.max(0, teaserConfig.delayMs ?? 0));\n };\n\n const handleTeaserClick = () => {\n dismiss(usesStorage());\n onToggle();\n };\n\n const handleDismissClick = (event: MouseEvent) => {\n event.stopPropagation();\n dismiss(usesStorage());\n };\n\n const handleLauncherToggle = () => {\n consumeForOpen(\"user\");\n onToggle();\n };\n\n const launcher = createLauncherButton(config, handleLauncherToggle);\n\n const removeTeaserElement = () => {\n clearTimer();\n teaserTextButton?.removeEventListener(\"click\", handleTeaserClick);\n dismissButton?.removeEventListener(\"click\", handleDismissClick);\n teaserElement?.remove();\n teaserElement = null;\n teaserTextButton = null;\n dismissButton = null;\n visible = false;\n };\n\n const buildTeaserElement = () => {\n teaserTextButton = createNode(\"button\", {\n className: \"persona-launcher-teaser-text\",\n attrs: { type: \"button\" },\n });\n teaserTextButton.addEventListener(\"click\", handleTeaserClick);\n\n dismissButton = createNode(\"button\", {\n className: \"persona-launcher-teaser-dismiss\",\n attrs: { type: \"button\" },\n text: \"\\u00d7\",\n });\n dismissButton.addEventListener(\"click\", handleDismissClick);\n\n teaserElement = createNode(\n \"div\",\n {\n className: \"persona-launcher-teaser\",\n attrs: {\n \"data-persona-launcher-teaser\": \"true\",\n role: \"status\",\n \"aria-live\": \"polite\",\n hidden: \"\",\n },\n },\n teaserTextButton,\n dismissButton\n );\n wrapper.insertBefore(teaserElement, launcher.element);\n };\n\n /**\n * The wrapper is `display: contents` until a teaser exists, so the launcher\n * keeps its own fixed placement; with a teaser the wrapper takes over the\n * corner and the button becomes static inside it.\n */\n const applyPlacement = () => {\n const position = currentConfig.launcher?.position ?? \"bottom-right\";\n const positionClass = positionMap[position] ?? positionMap[\"bottom-right\"];\n\n if (!teaserElement) {\n wrapper.className = \"persona-launcher-surface\";\n wrapper.removeAttribute(\"data-teaser\");\n wrapper.style.zIndex = \"\";\n launcher.element.style.position = \"\";\n return;\n }\n\n wrapper.className = cx(\"persona-launcher-surface\", positionClass);\n wrapper.setAttribute(\"data-teaser\", position);\n wrapper.style.zIndex = String(\n currentConfig.launcher?.zIndex ?? DEFAULT_OVERLAY_Z_INDEX\n );\n launcher.element.style.position = \"static\";\n };\n\n const syncTeaser = (nextConfig: AgentWidgetConfig) => {\n const next = resolveTeaserConfig(nextConfig);\n teaserConfig = next;\n\n if (!next) {\n removeTeaserElement();\n return;\n }\n\n // `shown` is deliberately not reset here: at most one appearance per load.\n if (!teaserElement) buildTeaserElement();\n\n teaserTextButton!.textContent = next.text;\n dismissButton!.hidden = next.dismissible === false;\n dismissButton!.setAttribute(\n \"aria-label\",\n next.dismissLabel ?? \"Dismiss message\"\n );\n schedule();\n };\n\n const update = (nextConfig: AgentWidgetConfig) => {\n currentConfig = nextConfig;\n launcher.update(nextConfig);\n syncTeaser(nextConfig);\n applyPlacement();\n };\n\n const setPanelOpen = (open: boolean, origin: LauncherOpenOrigin = \"user\") => {\n panelOpen = open;\n if (!open) return;\n consumeForOpen(origin);\n };\n\n const destroy = () => {\n removeTeaserElement();\n launcher.destroy();\n wrapper.remove();\n };\n\n wrapper.appendChild(launcher.element);\n if (config) {\n syncTeaser(config);\n applyPlacement();\n }\n\n return {\n element: wrapper,\n launcher,\n get teaser(): LauncherTeaser | null {\n if (!teaserElement) return null;\n return { element: teaserElement, show, dismiss };\n },\n setPanelOpen,\n update,\n destroy,\n };\n};\n","/**\n * Critical-path launcher entry: built to `launcher.global.js` (IIFE).\n *\n * Ships ONLY the real collapsed launcher surface (`createLauncherSurface`,\n * which carries the optional launcher teaser) plus the\n * theme application path, so the launcher paints pixel-identically to the full\n * widget from a tiny bundle. The heavy conversation panel is deferred until\n * first open by the installer (Phase 2).\n *\n * Icons: the CORE tier of the registry ships in this bundle, which covers the\n * launcher defaults (`bot`, `arrow-up-right`) and every widget-emitted name,\n * so default-config launchers paint with no flash. A site that configures an\n * EXTRA-tier icon (`launcher.agentIconName: \"shopping-cart\"`) paints a\n * correctly-sized empty placeholder and fills within one round-trip of the\n * `icons-extra.js` sibling chunk (loader registered below). See the\n * \"Deferred Launcher Loading\" pattern in AGENTS.md.\n *\n * Public global (via tsdown `globalName: \"AgentWidgetLauncher\"`):\n *\n * window.AgentWidgetLauncher.mount({ target, config, onOpen })\n * → { root, element, update, destroy }\n */\nimport { createLauncherSurface } from \"./components/launcher\";\nimport { applyLauncherThemeVariables } from \"./utils/theme\";\nimport { DEFAULT_LAUNCHER_CONFIG, DEFAULT_LAUNCHER_V5 } from \"./defaults\";\nimport { setIconsExtraLoader } from \"./icons-extra-loader\";\nimport type { AgentWidgetConfig } from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Deferred extra-icons loading (same sibling-URL scheme as index-global.ts,\n// derived from THIS script's src). Registered at module evaluation:\n// `document.currentScript` is null once execution leaves the initial run.\n// ---------------------------------------------------------------------------\nconst launcherScriptSrc: string | null =\n typeof document !== \"undefined\"\n ? ((document.currentScript as HTMLScriptElement | null)?.src ?? null)\n : null;\n\nsetIconsExtraLoader(() => {\n const chunkUrl = launcherScriptSrc?.replace(\n /launcher\\.global\\.js($|\\?)/,\n \"icons-extra.js$1\",\n );\n if (!chunkUrl || chunkUrl === launcherScriptSrc) {\n return Promise.reject(\n new Error(\n \"Could not derive the icons-extra.js URL from the launcher script URL \" +\n `(${launcherScriptSrc ?? \"unavailable\"}). Self-hosted deployments that ` +\n \"rename launcher.global.js should host icons-extra.js alongside it.\",\n ),\n );\n }\n return import(/* @vite-ignore */ chunkUrl);\n});\n\nexport interface AgentWidgetLauncherMountOptions {\n /** Where to mount. Defaults to `document.body` (the floating launcher is `position: fixed`). */\n target?: string | HTMLElement;\n /** The same widget config the full widget will receive: drives theme, icons, position, copy. */\n config?: AgentWidgetConfig;\n /** Called when the launcher is clicked; the installer loads the full widget and opens the panel. */\n onOpen: () => void;\n}\n\nexport interface AgentWidgetLauncherHandle {\n /** The `[data-persona-root]` wrapper that carries the theme CSS variables. */\n root: HTMLElement;\n /** The launcher button element itself. */\n element: HTMLButtonElement;\n /** Re-apply theme + re-render the launcher with new config. */\n update: (config: AgentWidgetConfig) => void;\n /** Remove the critical launcher (called at handoff once the full widget is mounted). */\n destroy: () => void;\n}\n\n/**\n * Marks the critical launcher's wrapper so the installer can find/remove it at\n * handoff without disturbing the full widget's own `[data-persona-root]`.\n */\nexport const CRITICAL_LAUNCHER_ATTR = \"data-persona-launcher-critical\";\n\nconst resolveTarget = (target?: string | HTMLElement): HTMLElement => {\n if (target instanceof HTMLElement) return target;\n if (typeof target === \"string\") {\n const el = document.querySelector<HTMLElement>(target);\n if (el) return el;\n }\n return document.body;\n};\n\nconst mergeCriticalLauncherConfig = (\n config?: AgentWidgetConfig\n): AgentWidgetConfig => ({\n ...config,\n launcher: {\n ...DEFAULT_LAUNCHER_CONFIG,\n ...(config?.future?.v5Defaults === true ? DEFAULT_LAUNCHER_V5 : {}),\n ...config?.launcher,\n dock: {\n ...DEFAULT_LAUNCHER_CONFIG.dock,\n ...config?.launcher?.dock,\n },\n },\n});\n\n/**\n * Mount the real collapsed launcher from the critical bundle.\n *\n * Mirrors the full widget's DOM exactly (`runtime/init.ts` + `ui.ts`): a\n * `[data-persona-root]` wrapper carries the theme CSS variables and the launcher\n * button is its child. Keeping the theme vars on the wrapper (not the button)\n * leaves the button's own inline style matching the full widget's, so\n * the eventual mount-then-remove handoff is invisible.\n */\nexport const mount = (\n options: AgentWidgetLauncherMountOptions\n): AgentWidgetLauncherHandle => {\n if (typeof window === \"undefined\" || typeof document === \"undefined\") {\n throw new Error(\n \"AgentWidgetLauncher can only be mounted in a browser environment\"\n );\n }\n\n const { onOpen } = options;\n const target = resolveTarget(options.target);\n\n // Render from the same launcher defaults the full widget uses without pulling\n // the full widget default object into the critical bundle.\n const config = mergeCriticalLauncherConfig(options.config);\n\n const root = document.createElement(\"div\");\n root.setAttribute(\"data-persona-root\", \"true\");\n root.setAttribute(CRITICAL_LAUNCHER_ATTR, \"true\");\n applyLauncherThemeVariables(root, config);\n\n const surface = createLauncherSurface(config, onOpen);\n root.appendChild(surface.element);\n target.appendChild(root);\n\n return {\n root,\n element: surface.launcher.element,\n update: (next: AgentWidgetConfig) => {\n const merged = mergeCriticalLauncherConfig(next);\n applyLauncherThemeVariables(root, merged);\n surface.update(merged);\n },\n // Handoff destroys the whole surface, so a pending teaser timer cannot\n // outlive the critical launcher.\n destroy: () => {\n surface.destroy();\n root.remove();\n },\n };\n};\n\n// Note: the `window.AgentWidgetLauncher` global is created by the IIFE build's\n// `globalName` (tsdown.config.ts) at build time. The installer\n// (`install.ts`) declares the `Window` augmentation it needs; this entry never\n// reads the global, so re-declaring it here would only create a cross-file type\n// conflict.\n"],"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