@runtypelabs/persona 3.26.0 → 3.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +29 -13
  2. package/dist/animations/glyph-cycle.d.cts +1 -1
  3. package/dist/animations/glyph-cycle.d.ts +1 -1
  4. package/dist/animations/{types-BZVr1YOV.d.cts → types-CxvHw0X6.d.cts} +551 -1
  5. package/dist/animations/{types-BZVr1YOV.d.ts → types-CxvHw0X6.d.ts} +551 -1
  6. package/dist/animations/wipe.d.cts +1 -1
  7. package/dist/animations/wipe.d.ts +1 -1
  8. package/dist/codegen.cjs +80 -0
  9. package/dist/codegen.d.cts +143 -0
  10. package/dist/codegen.d.ts +143 -0
  11. package/dist/codegen.js +80 -0
  12. package/dist/index.cjs +35 -35
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +1230 -3
  15. package/dist/index.d.ts +1230 -3
  16. package/dist/index.global.js +35 -35
  17. package/dist/index.global.js.map +1 -1
  18. package/dist/index.js +31 -31
  19. package/dist/index.js.map +1 -1
  20. package/dist/install.global.js +1 -1
  21. package/dist/install.global.js.map +1 -1
  22. package/dist/launcher.global.js +133 -0
  23. package/dist/launcher.global.js.map +1 -0
  24. package/dist/smart-dom-reader.d.cts +551 -1
  25. package/dist/smart-dom-reader.d.ts +551 -1
  26. package/dist/theme-editor.d.cts +551 -1
  27. package/dist/theme-editor.d.ts +551 -1
  28. package/package.json +14 -4
  29. package/src/client.test.ts +9 -9
  30. package/src/codegen.test.ts +39 -0
  31. package/src/codegen.ts +20 -0
  32. package/src/generated/runtype-openapi-contract.ts +1249 -0
  33. package/src/index-core.ts +19 -0
  34. package/src/install.test.ts +442 -0
  35. package/src/install.ts +283 -49
  36. package/src/launcher-global.ts +115 -0
  37. package/src/runtime/init.test.ts +71 -0
  38. package/src/runtime/init.ts +17 -1
  39. package/src/types.ts +14 -8
@@ -1,2 +1,2 @@
1
- "use strict";var SiteAgentInstaller=(()=>{var m=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var E=(a,r,u,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of W(r))!T.call(a,l)&&l!==u&&m(a,l,{get:()=>r[l],enumerable:!(t=j(r,l))||t.enumerable});return a};var _=a=>E(m({},"__esModule",{value:!0}),a);var F={};(function(){"use strict";if(window.__siteAgentInstallerLoaded)return;window.__siteAgentInstallerLoaded=!0;let r=(()=>{let n=document.currentScript;if(!n)return{};let e={},o=n.getAttribute("data-config");if(o)try{let c=o.replace(/[\r\n]+\s*/g,""),g=JSON.parse(c);if(g.config){let{__proto__:M,constructor:$,prototype:J,...P}=g;Object.assign(e,P)}else e.config=g}catch(c){console.error("Failed to parse data-config JSON:",c)}let s=n.getAttribute("data-runtype-token");s&&(e.clientToken=s);let d=n.getAttribute("data-flow-id");d&&(e.flowId=d);let i=n.getAttribute("data-api-url");i&&(e.apiUrl=i);let p=n.getAttribute("data-preview-param");return p&&(e.previewQueryParam=p),e})(),t={...window.siteAgentConfig||{},...r};if(!(()=>{if(!t.previewQueryParam)return!0;let e=new URLSearchParams(window.location.search).get(t.previewQueryParam);return e!==null&&e!==""&&e.toLowerCase()!=="false"&&e!=="0"})())return;let y=t.version||"latest",A=t.cdn||"jsdelivr",h=t.autoInit!==!1,C=()=>{if(t.cssUrl&&t.jsUrl)return{cssUrl:t.cssUrl,jsUrl:t.jsUrl};let e=`/npm/@runtypelabs/persona@${y}/dist`;return A==="unpkg"?{cssUrl:`https://unpkg.com${e}/widget.css`,jsUrl:`https://unpkg.com${e}/index.global.js`}:{cssUrl:`https://cdn.jsdelivr.net${e}/widget.css`,jsUrl:`https://cdn.jsdelivr.net${e}/index.global.js`}},{cssUrl:f,jsUrl:w}=C(),k=()=>!!document.head.querySelector("link[data-persona]")||!!document.head.querySelector('link[href*="widget.css"]'),S=()=>!!window.AgentWidget,U=n=>{let e=!1,o=()=>{e||(e=!0,n())},s=()=>{typeof requestIdleCallback!="undefined"?requestIdleCallback(()=>{requestAnimationFrame(()=>{requestAnimationFrame(o)})},{timeout:3e3}):setTimeout(o,300)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",s):s()},b=()=>new Promise((n,e)=>{if(k()){n();return}let o=document.createElement("link");o.rel="stylesheet",o.href=f,o.setAttribute("data-persona","true"),o.onload=()=>n(),o.onerror=()=>e(new Error(`Failed to load CSS from ${f}`)),document.head.appendChild(o)}),v=()=>new Promise((n,e)=>{if(S()){n();return}let o=document.createElement("script");o.src=w,o.async=!0,o.onload=()=>n(),o.onerror=()=>e(new Error(`Failed to load JS from ${w}`)),document.head.appendChild(o)}),I=()=>{var s,d;if(!window.AgentWidget||!window.AgentWidget.initAgentWidget){console.warn("AgentWidget not available. Make sure the script loaded successfully.");return}let n=t.target||"body",e={...t.config};if(t.apiUrl&&!e.apiUrl&&(e.apiUrl=t.apiUrl),t.clientToken&&!e.clientToken&&(e.clientToken=t.clientToken),t.flowId&&!e.flowId&&(e.flowId=t.flowId),!(!(e.apiUrl||e.clientToken)&&Object.keys(e).length===0)){!e.postprocessMessage&&window.AgentWidget.markdownPostprocessor&&(e.postprocessMessage=({text:i})=>window.AgentWidget.markdownPostprocessor(i));try{let i=window.AgentWidget.initAgentWidget({target:n,config:e,useShadowDom:(s=t.useShadowDom)!=null?s:!1,windowKey:t.windowKey});(d=t.onReady)==null||d.call(t,i),window.dispatchEvent(new CustomEvent("persona:ready",{detail:i}))}catch(i){console.error("Failed to initialize AgentWidget:",i)}}};U(async()=>{try{await b(),await v(),h&&(t.config||t.apiUrl||t.clientToken)&&setTimeout(I,0)}catch(n){console.error("Failed to install AgentWidget:",n)}})})();return _(F);})();
1
+ "use strict";var SiteAgentInstaller=(()=>{var U=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var Q=(u,l,m,o)=>{if(l&&typeof l=="object"||typeof l=="function")for(let i of J(l))!H.call(u,i)&&i!==m&&U(u,i,{get:()=>l[i],enumerable:!(o=q(l,i))||o.enumerable});return u};var N=u=>Q(U({},"__esModule",{value:!0}),u);var K={};(function(){"use strict";if(window.__siteAgentInstallerLoaded)return;window.__siteAgentInstallerLoaded=!0;let l=(()=>{let t=document.currentScript;if(!t)return{};let e={},n=t.getAttribute("data-config");if(n)try{let w=n.replace(/[\r\n]+\s*/g,""),h=JSON.parse(w);if(h.config){let{__proto__:G,constructor:V,prototype:X,...O}=h;Object.assign(e,O)}else e.config=h}catch(w){console.error("Failed to parse data-config JSON:",w)}let r=t.getAttribute("data-runtype-token");r&&(e.clientToken=r);let s=t.getAttribute("data-flow-id");s&&(e.flowId=s);let a=t.getAttribute("data-api-url");a&&(e.apiUrl=a);let c=t.getAttribute("data-preview-param");return c&&(e.previewQueryParam=c),e})(),o={...window.siteAgentConfig||{},...l},i=(t,e)=>{try{t==null||t(e)}catch(n){console.error("[Persona] lifecycle callback threw:",n)}},d=(t,e)=>{try{window.dispatchEvent(new CustomEvent(t,{detail:e}))}catch{}},f=(t,e)=>{console.error("Failed to install AgentWidget:",e),i(o.onError,{phase:t,error:e}),d("persona:error",{phase:t,error:e})},y=!1,P=()=>{if(o.onChatReady)return o.onChatReady;if(o.onReady)return y||(y=!0,console.warn("[Persona] `onReady` is deprecated \u2014 use `onChatReady`. `onReady` still works but is removed in the next major.")),o.onReady},b=t=>{var n,r;let e=(n=t.launcher)!=null?n:{};return e.enabled===!1?!1:((r=e.mountMode)!=null?r:"floating")==="floating"};if(i(o.onScriptLoad,{version:o.version||"latest"}),d("persona:script-load",{version:o.version||"latest"}),!(()=>{if(!o.previewQueryParam)return!0;let e=new URLSearchParams(window.location.search).get(o.previewQueryParam);return e!==null&&e!==""&&e.toLowerCase()!=="false"&&e!=="0"})())return;let I=o.version||"latest",E=o.cdn||"jsdelivr",j=o.autoInit!==!1,T=()=>{if(o.cssUrl&&o.jsUrl){let r=o.jsUrl.replace(/index\.global\.js($|\?)/,"launcher.global.js$1");return{cssUrl:o.cssUrl,jsUrl:o.jsUrl,launcherUrl:r!==o.jsUrl?r:null}}let e=`/npm/@runtypelabs/persona@${I}/dist`,n=E==="unpkg"?"https://unpkg.com":"https://cdn.jsdelivr.net";return{cssUrl:`${n}${e}/widget.css`,jsUrl:`${n}${e}/index.global.js`,launcherUrl:`${n}${e}/launcher.global.js`}},{cssUrl:v,jsUrl:p,launcherUrl:g}=T(),W=()=>!!document.head.querySelector("link[data-persona]")||!!document.head.querySelector('link[href*="widget.css"]'),C=()=>!!window.AgentWidget,$=t=>{let e=!1,n=()=>{e||(e=!0,t())},r=()=>{typeof requestIdleCallback!="undefined"?requestIdleCallback(()=>{requestAnimationFrame(()=>{requestAnimationFrame(n)})},{timeout:3e3}):setTimeout(n,300)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",r):r()},A=()=>new Promise((t,e)=>{if(W()){t();return}let n=document.createElement("link");n.rel="stylesheet",n.href=v,n.setAttribute("data-persona","true"),n.onload=()=>t(),n.onerror=()=>e(new Error(`Failed to load CSS from ${v}`)),document.head.appendChild(n)}),k=()=>new Promise((t,e)=>{if(C()){t();return}let n=document.createElement("script");n.src=p,n.async=!0,n.onload=()=>t(),n.onerror=()=>e(new Error(`Failed to load JS from ${p}`)),document.head.appendChild(n)}),F=()=>!!window.AgentWidgetLauncher,M=()=>new Promise((t,e)=>{if(F()||!g){t();return}let n=document.createElement("script");n.src=g,n.async=!0,n.onload=()=>t(),n.onerror=()=>e(new Error(`Failed to load launcher from ${g}`)),document.head.appendChild(n)}),R=()=>{let t=()=>{if(C())return;let e=document.createElement("link");e.rel="prefetch",e.as="script",e.href=p,document.head.appendChild(e)};typeof requestIdleCallback!="undefined"?requestIdleCallback(t,{timeout:4e3}):setTimeout(t,1200)},S=()=>{let t=o.target||"body",e={...o.config};o.apiUrl&&!e.apiUrl&&(e.apiUrl=o.apiUrl),o.clientToken&&!e.clientToken&&(e.clientToken=o.clientToken),o.flowId&&!e.flowId&&(e.flowId=o.flowId);let n=!!(e.apiUrl||e.clientToken);return{target:t,widgetConfig:e,hasApiConfig:n}},L=(t=!1)=>{var s;if(!window.AgentWidget||!window.AgentWidget.initAgentWidget){console.warn("AgentWidget not available. Make sure the script loaded successfully.");return}let{target:e,widgetConfig:n,hasApiConfig:r}=S();if(!(!r&&Object.keys(n).length===0)){!n.postprocessMessage&&window.AgentWidget.markdownPostprocessor&&(n.postprocessMessage=({text:a})=>window.AgentWidget.markdownPostprocessor(a));try{let a=window.AgentWidget.initAgentWidget({target:e,config:n,useShadowDom:(s=o.useShadowDom)!=null?s:!1,windowKey:o.windowKey});return t&&a&&typeof a.open=="function"&&a.open(),!t&&b(n)&&(i(o.onLauncherShown,{deferred:!1}),d("persona:launcher-shown",{deferred:!1})),i(P(),a),d("persona:chat-ready",a),d("persona:ready",a),a}catch(a){f("init",a)}}},_=t=>{var a;let e=t.persistState;if(!e)return!1;let n=typeof e=="object"?e:null;if(n&&((a=n.persist)==null?void 0:a.openState)===!1)return!1;let r=n&&n.keyPrefix||"persona-",s=n&&n.storage||"session";try{return(s==="local"?window.localStorage:window.sessionStorage).getItem(`${r}widget-open`)==="true"}catch{return!1}},x=t=>{var n;return!(!g||!b(t)||((n=t.launcher)!=null?n:{}).autoExpand===!0||typeof t.onStateLoaded=="function"||_(t))},D=(t,e)=>{let n="idle",r,s=()=>{n==="idle"&&(n="loading",k().then(()=>{L(!0),r==null||r.destroy(),n="done"}).catch(c=>{n="idle",console.error("Failed to load AgentWidget on open:",c),i(o.onError,{phase:"bundle",error:c}),d("persona:error",{phase:"bundle",error:c})}))},a=window.AgentWidgetLauncher.mount({target:t,config:e,onOpen:s});r=a,i(o.onLauncherShown,{deferred:!0,element:a.element}),d("persona:launcher-shown",{deferred:!0,element:a.element}),R()};$(async()=>{try{let t=j&&(o.config||o.apiUrl||o.clientToken);if(t){let{target:e,widgetConfig:n}=S();if(x(n))try{if(await Promise.all([A(),M()]),window.AgentWidgetLauncher&&window.AgentWidgetLauncher.mount){D(e,n);return}}catch(r){console.warn("Deferred launcher failed; falling back to eager load.",r)}}try{await A()}catch(e){return f("css",e)}try{await k()}catch(e){return f("bundle",e)}t&&setTimeout(()=>L(!1),0)}catch(t){f("init",t)}})})();return N(K);})();
2
2
  //# sourceMappingURL=install.global.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/install.ts"],"sourcesContent":["/**\n * Standalone installer script for easy script tag installation\n * This script automatically loads CSS and JS, then initializes the widget\n * if configuration is provided via window.siteAgentConfig\n */\n\nexport {};\n\ninterface SiteAgentInstallConfig {\n version?: string;\n cdn?: \"unpkg\" | \"jsdelivr\";\n cssUrl?: string;\n jsUrl?: string;\n target?: string | HTMLElement;\n config?: any;\n autoInit?: boolean;\n // Client token mode options (can also be set via data attributes)\n clientToken?: string;\n flowId?: string;\n apiUrl?: string;\n // Optional query param key that gates widget installation in preview mode\n previewQueryParam?: string;\n // Shadow DOM option (defaults to false for better CSS compatibility)\n useShadowDom?: boolean;\n // Expose the widget handle on window[windowKey] for programmatic access\n windowKey?: string;\n // Called when the widget is initialized and ready for interaction\n onReady?: (handle: any) => void;\n}\n\ndeclare global {\n interface Window {\n siteAgentConfig?: SiteAgentInstallConfig;\n AgentWidget?: any;\n }\n}\n\n(function() {\n \"use strict\";\n\n // Prevent double installation\n if ((window as any).__siteAgentInstallerLoaded) {\n return;\n }\n (window as any).__siteAgentInstallerLoaded = true;\n\n /**\n * Read configuration from data attributes on the current script tag.\n * Supports: data-config (JSON), data-runtype-token, data-flow-id, data-api-url\n */\n const getConfigFromScript = (): Partial<SiteAgentInstallConfig> => {\n // Try to get the current script element\n const script = document.currentScript as HTMLScriptElement | null;\n if (!script) return {};\n\n const scriptConfig: Partial<SiteAgentInstallConfig> = {};\n\n // Full config from data-config attribute (JSON string)\n const configJson = script.getAttribute('data-config');\n if (configJson) {\n try {\n // HTML attributes preserve literal newlines/tabs which are invalid\n // control characters inside JSON string literals — strip them.\n const normalizedJson = configJson.replace(/[\\r\\n]+\\s*/g, '');\n const parsedConfig = JSON.parse(normalizedJson);\n // If it has nested 'config' property, use it; otherwise treat as widget config\n if (parsedConfig.config) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { __proto__: _a, constructor: _b, prototype: _c, ...safeConfig } = parsedConfig;\n Object.assign(scriptConfig, safeConfig);\n } else {\n // Treat the entire object as widget config\n scriptConfig.config = parsedConfig;\n }\n } catch (e) {\n console.error(\"Failed to parse data-config JSON:\", e);\n }\n }\n\n // Client token from data attribute (primary method for client token mode)\n const token = script.getAttribute('data-runtype-token');\n if (token) {\n scriptConfig.clientToken = token;\n }\n\n // Optional flow ID\n const flowId = script.getAttribute('data-flow-id');\n if (flowId) {\n scriptConfig.flowId = flowId;\n }\n\n // Optional API URL override\n const apiUrl = script.getAttribute('data-api-url');\n if (apiUrl) {\n scriptConfig.apiUrl = apiUrl;\n }\n\n // Optional preview query param gate\n const previewQueryParam = script.getAttribute('data-preview-param');\n if (previewQueryParam) {\n scriptConfig.previewQueryParam = previewQueryParam;\n }\n\n return scriptConfig;\n };\n\n // Get config from script attributes (must be called synchronously during script execution)\n const scriptConfig = getConfigFromScript();\n\n // Merge script attributes with window config (script attributes take precedence)\n const windowConfig: SiteAgentInstallConfig = window.siteAgentConfig || {};\n const config: SiteAgentInstallConfig = { ...windowConfig, ...scriptConfig };\n\n const isPreviewModeEnabled = (): boolean => {\n if (!config.previewQueryParam) {\n return true;\n }\n\n const params = new URLSearchParams(window.location.search);\n const value = params.get(config.previewQueryParam);\n return value !== null && value !== \"\" && value.toLowerCase() !== \"false\" && value !== \"0\";\n };\n\n if (!isPreviewModeEnabled()) {\n return;\n }\n \n const version = config.version || \"latest\";\n const cdn = config.cdn || \"jsdelivr\";\n const autoInit = config.autoInit !== false; // Default to true\n\n // Determine CDN base URL\n const getCdnBase = () => {\n if (config.cssUrl && config.jsUrl) {\n return { cssUrl: config.cssUrl, jsUrl: config.jsUrl };\n }\n \n const packageName = \"@runtypelabs/persona\";\n const basePath = `/npm/${packageName}@${version}/dist`;\n \n if (cdn === \"unpkg\") {\n return {\n cssUrl: `https://unpkg.com${basePath}/widget.css`,\n jsUrl: `https://unpkg.com${basePath}/index.global.js`\n };\n } else {\n return {\n cssUrl: `https://cdn.jsdelivr.net${basePath}/widget.css`,\n jsUrl: `https://cdn.jsdelivr.net${basePath}/index.global.js`\n };\n }\n };\n\n const { cssUrl, jsUrl } = getCdnBase();\n\n // Check if CSS is already loaded\n const isCssLoaded = () => {\n return !!document.head.querySelector('link[data-persona]') ||\n !!document.head.querySelector(`link[href*=\"widget.css\"]`);\n };\n\n // Check if JS is already loaded\n const isJsLoaded = () => {\n return !!(window as any).AgentWidget;\n };\n\n /**\n * Wait for framework hydration to complete (Next.js, Nuxt, etc.)\n * This prevents the framework from removing dynamically added CSS during reconciliation.\n * Uses requestIdleCallback + double requestAnimationFrame for reliable detection.\n */\n const waitForHydration = (callback: () => void): void => {\n let executed = false;\n \n const execute = () => {\n if (executed) return;\n executed = true;\n callback();\n };\n\n const afterDom = () => {\n // Strategy 1: Use requestIdleCallback if available (best for detecting idle after hydration)\n if (typeof requestIdleCallback !== 'undefined') {\n requestIdleCallback(() => {\n // Double requestAnimationFrame ensures at least one full paint cycle completed\n requestAnimationFrame(() => {\n requestAnimationFrame(execute);\n });\n }, { timeout: 3000 }); // Max wait 3 seconds, then proceed anyway\n } else {\n // Strategy 2: Fallback for Safari (no requestIdleCallback)\n // 300ms is typically enough for hydration on most pages\n setTimeout(execute, 300);\n }\n };\n\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', afterDom);\n } else {\n // DOM already ready, but still wait for potential hydration\n afterDom();\n }\n };\n\n // Load CSS\n const loadCSS = (): Promise<void> => {\n return new Promise((resolve, reject) => {\n if (isCssLoaded()) {\n resolve();\n return;\n }\n\n const link = document.createElement(\"link\");\n link.rel = \"stylesheet\";\n link.href = cssUrl;\n link.setAttribute(\"data-persona\", \"true\");\n \n link.onload = () => resolve();\n link.onerror = () => reject(new Error(`Failed to load CSS from ${cssUrl}`));\n document.head.appendChild(link);\n });\n };\n\n // Load JS\n const loadJS = (): Promise<void> => {\n return new Promise((resolve, reject) => {\n if (isJsLoaded()) {\n resolve();\n return;\n }\n\n const script = document.createElement(\"script\");\n script.src = jsUrl;\n script.async = true;\n script.onload = () => resolve();\n script.onerror = () => reject(new Error(`Failed to load JS from ${jsUrl}`));\n document.head.appendChild(script);\n });\n };\n\n // Initialize widget\n const initWidget = () => {\n if (!window.AgentWidget || !window.AgentWidget.initAgentWidget) {\n console.warn(\"AgentWidget not available. Make sure the script loaded successfully.\");\n return;\n }\n\n const target = config.target || \"body\";\n // Merge top-level config options into widget config\n const widgetConfig = { ...config.config };\n \n // Merge apiUrl from top-level config into widget config if present\n if (config.apiUrl && !widgetConfig.apiUrl) {\n widgetConfig.apiUrl = config.apiUrl;\n }\n \n // Merge clientToken from top-level config into widget config if present\n if (config.clientToken && !widgetConfig.clientToken) {\n widgetConfig.clientToken = config.clientToken;\n }\n \n // Merge flowId from top-level config into widget config if present\n if (config.flowId && !widgetConfig.flowId) {\n widgetConfig.flowId = config.flowId;\n }\n\n // Only initialize if we have either apiUrl OR clientToken (or other config)\n const hasApiConfig = widgetConfig.apiUrl || widgetConfig.clientToken;\n if (!hasApiConfig && Object.keys(widgetConfig).length === 0) {\n return;\n }\n\n // Auto-apply markdown postprocessor if not explicitly set and available\n if (!widgetConfig.postprocessMessage && window.AgentWidget.markdownPostprocessor) {\n widgetConfig.postprocessMessage = ({ text }: { text: string }) => \n window.AgentWidget.markdownPostprocessor(text);\n }\n\n try {\n const handle = window.AgentWidget.initAgentWidget({\n target,\n config: widgetConfig,\n // Explicitly disable shadow DOM for better CSS compatibility with host page\n useShadowDom: config.useShadowDom ?? false,\n windowKey: config.windowKey\n });\n\n config.onReady?.(handle);\n window.dispatchEvent(new CustomEvent(\"persona:ready\", { detail: handle }));\n } catch (error) {\n console.error(\"Failed to initialize AgentWidget:\", error);\n }\n };\n\n // Main installation flow (called after hydration completes)\n const install = async () => {\n try {\n await loadCSS();\n await loadJS();\n \n // Auto-init if we have config OR apiUrl OR clientToken\n const shouldAutoInit = autoInit && (\n config.config || \n config.apiUrl || \n config.clientToken\n );\n \n if (shouldAutoInit) {\n // Wait a tick to ensure AgentWidget is fully initialized\n setTimeout(initWidget, 0);\n }\n } catch (error) {\n console.error(\"Failed to install AgentWidget:\", error);\n }\n };\n\n // Start installation after hydration completes\n // This prevents Next.js/Nuxt/etc. from removing dynamically added CSS\n waitForHydration(install);\n})();\n\n"],"mappings":"4YAAA,IAAAA,EAAA,IAqCC,UAAW,CACV,aAGA,GAAK,OAAe,2BAClB,OAED,OAAe,2BAA6B,GA+D7C,IAAMC,GAzDsB,IAAuC,CAEjE,IAAMC,EAAS,SAAS,cACxB,GAAI,CAACA,EAAQ,MAAO,CAAC,EAErB,IAAMD,EAAgD,CAAC,EAGjDE,EAAaD,EAAO,aAAa,aAAa,EACpD,GAAIC,EACF,GAAI,CAGF,IAAMC,EAAiBD,EAAW,QAAQ,cAAe,EAAE,EACrDE,EAAe,KAAK,MAAMD,CAAc,EAE9C,GAAIC,EAAa,OAAQ,CAEvB,GAAM,CAAE,UAAWC,EAAI,YAAaC,EAAI,UAAWC,EAAI,GAAGC,CAAW,EAAIJ,EACzE,OAAO,OAAOJ,EAAcQ,CAAU,CACxC,MAEER,EAAa,OAASI,CAE1B,OAASK,EAAG,CACV,QAAQ,MAAM,oCAAqCA,CAAC,CACtD,CAIF,IAAMC,EAAQT,EAAO,aAAa,oBAAoB,EAClDS,IACFV,EAAa,YAAcU,GAI7B,IAAMC,EAASV,EAAO,aAAa,cAAc,EAC7CU,IACFX,EAAa,OAASW,GAIxB,IAAMC,EAASX,EAAO,aAAa,cAAc,EAC7CW,IACFZ,EAAa,OAASY,GAIxB,IAAMC,EAAoBZ,EAAO,aAAa,oBAAoB,EAClE,OAAIY,IACFb,EAAa,kBAAoBa,GAG5Bb,CACT,GAGyC,EAInCc,EAAi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Y,wBACzDA,EAAa,mBAAqB,CAAC,CAAE,KAAAC,CAAK,IACxC,OAAO,YAAY,sBAAsBA,CAAI,GAGjD,GAAI,CACF,IAAMC,EAAS,OAAO,YAAY,gBAAgB,CAChD,OAAAH,EACA,OAAQC,EAER,cAAchC,EAAAS,EAAO,eAAP,KAAAT,EAAuB,GACrC,UAAWS,EAAO,SACpB,CAAC,GAEDR,EAAAQ,EAAO,UAAP,MAAAR,EAAA,KAAAQ,EAAiByB,GACjB,OAAO,cAAc,IAAI,YAAY,gBAAiB,CAAE,OAAQA,CAAO,CAAC,CAAC,CAC3E,OAASC,EAAO,CACd,QAAQ,MAAM,oCAAqCA,CAAK,CAC1D,EACF,EA0BAf,EAvBgB,SAAY,CAC1B,GAAI,CACF,MAAMK,EAAQ,EACd,MAAMI,EAAO,EAGUhB,IACrBJ,EAAO,QACPA,EAAO,QACPA,EAAO,cAKP,WAAWqB,EAAY,CAAC,CAE5B,OAASK,EAAO,CACd,QAAQ,MAAM,iCAAkCA,CAAK,CACvD,CACF,CAIwB,CAC1B,GAAG","names":["install_exports","scriptConfig","script","configJson","normalizedJson","parsedConfig","_a","_b","_c","safeConfig","e","token","flowId","apiUrl","previewQueryParam","config","value","version","cdn","autoInit","getCdnBase","basePath","cssUrl","jsUrl","isCssLoaded","isJsLoaded","waitForHydration","callback","executed","execute","afterDom","loadCSS","resolve","reject","link","loadJS","initWidget","target","widgetConfig","text","handle","error"]}
1
+ {"version":3,"sources":["../src/install.ts"],"sourcesContent":["/**\n * Standalone installer script for easy script tag installation\n * This script automatically loads CSS and JS, then initializes the widget\n * if configuration is provided via window.siteAgentConfig\n */\n\nexport {};\n\ninterface SiteAgentInstallConfig {\n version?: string;\n cdn?: \"unpkg\" | \"jsdelivr\";\n cssUrl?: string;\n jsUrl?: string;\n target?: string | HTMLElement;\n config?: any;\n autoInit?: boolean;\n // Client token mode options (can also be set via data attributes)\n clientToken?: string;\n flowId?: string;\n apiUrl?: string;\n // Optional query param key that gates widget installation in preview mode\n previewQueryParam?: string;\n // Shadow DOM option (defaults to false for better CSS compatibility)\n useShadowDom?: boolean;\n // Expose the widget handle on window[windowKey] for programmatic access\n windowKey?: string;\n /**\n * Fired as soon as the installer script executes, before it loads or gates\n * anything. For diagnostics / load-timing baselines (\"did my embed run\").\n */\n onScriptLoad?: (info: { version: string }) => void;\n /**\n * Fired when the floating launcher is painted on the page — at page-load time.\n * Deferred installs: the critical launcher mounts. Eager floating installs:\n * the full widget's launcher mounts. Use this for \"widget appeared\" analytics.\n * Does NOT fire for inline / docked / composer-bar installs (no floating\n * launcher) — use `onChatReady` there.\n */\n onLauncherShown?: (info: { deferred: boolean; element?: HTMLElement }) => void;\n /**\n * Fired when the full widget is initialized and its controller API is\n * callable. Deferred installs: after the user first opens the panel. Eager\n * installs: on page load.\n */\n onChatReady?: (handle: any) => void;\n /**\n * @deprecated Use `onChatReady`. Retained as a working alias; it will be\n * removed in the next major version.\n */\n onReady?: (handle: any) => void;\n /**\n * Fired when a load step fails (stylesheet, full bundle, or init), so you can\n * detect ad-blocked / timed-out installs instead of failing silently.\n */\n onError?: (info: { phase: \"css\" | \"bundle\" | \"init\"; error: unknown }) => void;\n}\n\ndeclare global {\n interface Window {\n siteAgentConfig?: SiteAgentInstallConfig;\n AgentWidget?: any;\n AgentWidgetLauncher?: any;\n }\n}\n\n(function() {\n \"use strict\";\n\n // Prevent double installation\n if ((window as any).__siteAgentInstallerLoaded) {\n return;\n }\n (window as any).__siteAgentInstallerLoaded = true;\n\n /**\n * Read configuration from data attributes on the current script tag.\n * Supports: data-config (JSON), data-runtype-token, data-flow-id, data-api-url\n */\n const getConfigFromScript = (): Partial<SiteAgentInstallConfig> => {\n // Try to get the current script element\n const script = document.currentScript as HTMLScriptElement | null;\n if (!script) return {};\n\n const scriptConfig: Partial<SiteAgentInstallConfig> = {};\n\n // Full config from data-config attribute (JSON string)\n const configJson = script.getAttribute('data-config');\n if (configJson) {\n try {\n // HTML attributes preserve literal newlines/tabs which are invalid\n // control characters inside JSON string literals — strip them.\n const normalizedJson = configJson.replace(/[\\r\\n]+\\s*/g, '');\n const parsedConfig = JSON.parse(normalizedJson);\n // If it has nested 'config' property, use it; otherwise treat as widget config\n if (parsedConfig.config) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { __proto__: _a, constructor: _b, prototype: _c, ...safeConfig } = parsedConfig;\n Object.assign(scriptConfig, safeConfig);\n } else {\n // Treat the entire object as widget config\n scriptConfig.config = parsedConfig;\n }\n } catch (e) {\n console.error(\"Failed to parse data-config JSON:\", e);\n }\n }\n\n // Client token from data attribute (primary method for client token mode)\n const token = script.getAttribute('data-runtype-token');\n if (token) {\n scriptConfig.clientToken = token;\n }\n\n // Optional flow ID\n const flowId = script.getAttribute('data-flow-id');\n if (flowId) {\n scriptConfig.flowId = flowId;\n }\n\n // Optional API URL override\n const apiUrl = script.getAttribute('data-api-url');\n if (apiUrl) {\n scriptConfig.apiUrl = apiUrl;\n }\n\n // Optional preview query param gate\n const previewQueryParam = script.getAttribute('data-preview-param');\n if (previewQueryParam) {\n scriptConfig.previewQueryParam = previewQueryParam;\n }\n\n return scriptConfig;\n };\n\n // Get config from script attributes (must be called synchronously during script execution)\n const scriptConfig = getConfigFromScript();\n\n // Merge script attributes with window config (script attributes take precedence)\n const windowConfig: SiteAgentInstallConfig = window.siteAgentConfig || {};\n const config: SiteAgentInstallConfig = { ...windowConfig, ...scriptConfig };\n\n // --- Lifecycle helpers -----------------------------------------------------\n // A throwing user callback must never break the installer.\n const safeCall = <T>(fn: ((arg: T) => void) | undefined, arg: T): void => {\n try {\n fn?.(arg);\n } catch (e) {\n console.error(\"[Persona] lifecycle callback threw:\", e);\n }\n };\n const dispatchLifecycle = (name: string, detail: unknown): void => {\n try {\n window.dispatchEvent(new CustomEvent(name, { detail }));\n } catch {\n /* CustomEvent unsupported — ignore */\n }\n };\n const fail = (phase: \"css\" | \"bundle\" | \"init\", error: unknown): void => {\n console.error(\"Failed to install AgentWidget:\", error);\n safeCall(config.onError, { phase, error });\n dispatchLifecycle(\"persona:error\", { phase, error });\n };\n // `onReady` is the deprecated alias of `onChatReady`; warn once if it's used.\n let warnedOnReadyDeprecated = false;\n const resolveChatReady = (): ((handle: any) => void) | undefined => {\n if (config.onChatReady) return config.onChatReady;\n if (config.onReady) {\n if (!warnedOnReadyDeprecated) {\n warnedOnReadyDeprecated = true;\n console.warn(\n \"[Persona] `onReady` is deprecated — use `onChatReady`. `onReady` still works but is removed in the next major.\"\n );\n }\n return config.onReady;\n }\n return undefined;\n };\n // True when the config renders a standard floating launcher button — the only\n // case that paints a clickable launcher at load. Shared by the deferral gate\n // and the eager-path `onLauncherShown` so the event name stays honest.\n const hasFloatingLauncher = (widgetConfig: any): boolean => {\n const launcher = widgetConfig.launcher ?? {};\n if (launcher.enabled === false) return false; // inline embed\n return (launcher.mountMode ?? \"floating\") === \"floating\"; // not docked / composer-bar\n };\n\n // Earliest signal: the installer has executed. Fire before any loading or\n // preview-gating so it's a reliable \"did my embed run\" beacon for diagnostics.\n safeCall(config.onScriptLoad, { version: config.version || \"latest\" });\n dispatchLifecycle(\"persona:script-load\", { version: config.version || \"latest\" });\n\n const isPreviewModeEnabled = (): boolean => {\n if (!config.previewQueryParam) {\n return true;\n }\n\n const params = new URLSearchParams(window.location.search);\n const value = params.get(config.previewQueryParam);\n return value !== null && value !== \"\" && value.toLowerCase() !== \"false\" && value !== \"0\";\n };\n\n if (!isPreviewModeEnabled()) {\n return;\n }\n \n const version = config.version || \"latest\";\n const cdn = config.cdn || \"jsdelivr\";\n const autoInit = config.autoInit !== false; // Default to true\n\n // Determine CDN base URL\n const getCdnBase = () => {\n // For a custom URL override, derive the sibling launcher URL when the\n // override mirrors the dist layout (…/index.global.js → …/launcher.global.js)\n // so self-hosted deployments still get the optimization. A non-standard\n // jsUrl yields null → eager-load fallback.\n if (config.cssUrl && config.jsUrl) {\n const derivedLauncherUrl = config.jsUrl.replace(/index\\.global\\.js($|\\?)/, \"launcher.global.js$1\");\n return {\n cssUrl: config.cssUrl,\n jsUrl: config.jsUrl,\n launcherUrl: (derivedLauncherUrl !== config.jsUrl ? derivedLauncherUrl : null) as string | null,\n };\n }\n\n const packageName = \"@runtypelabs/persona\";\n const basePath = `/npm/${packageName}@${version}/dist`;\n const host = cdn === \"unpkg\" ? \"https://unpkg.com\" : \"https://cdn.jsdelivr.net\";\n\n return {\n cssUrl: `${host}${basePath}/widget.css`,\n jsUrl: `${host}${basePath}/index.global.js`,\n launcherUrl: `${host}${basePath}/launcher.global.js` as string | null,\n };\n };\n\n const { cssUrl, jsUrl, launcherUrl } = getCdnBase();\n\n // Check if CSS is already loaded\n const isCssLoaded = () => {\n return !!document.head.querySelector('link[data-persona]') ||\n !!document.head.querySelector(`link[href*=\"widget.css\"]`);\n };\n\n // Check if JS is already loaded\n const isJsLoaded = () => {\n return !!(window as any).AgentWidget;\n };\n\n /**\n * Wait for framework hydration to complete (Next.js, Nuxt, etc.)\n * This prevents the framework from removing dynamically added CSS during reconciliation.\n * Uses requestIdleCallback + double requestAnimationFrame for reliable detection.\n */\n const waitForHydration = (callback: () => void): void => {\n let executed = false;\n \n const execute = () => {\n if (executed) return;\n executed = true;\n callback();\n };\n\n const afterDom = () => {\n // Strategy 1: Use requestIdleCallback if available (best for detecting idle after hydration)\n if (typeof requestIdleCallback !== 'undefined') {\n requestIdleCallback(() => {\n // Double requestAnimationFrame ensures at least one full paint cycle completed\n requestAnimationFrame(() => {\n requestAnimationFrame(execute);\n });\n }, { timeout: 3000 }); // Max wait 3 seconds, then proceed anyway\n } else {\n // Strategy 2: Fallback for Safari (no requestIdleCallback)\n // 300ms is typically enough for hydration on most pages\n setTimeout(execute, 300);\n }\n };\n\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', afterDom);\n } else {\n // DOM already ready, but still wait for potential hydration\n afterDom();\n }\n };\n\n // Load CSS\n const loadCSS = (): Promise<void> => {\n return new Promise((resolve, reject) => {\n if (isCssLoaded()) {\n resolve();\n return;\n }\n\n const link = document.createElement(\"link\");\n link.rel = \"stylesheet\";\n link.href = cssUrl;\n link.setAttribute(\"data-persona\", \"true\");\n \n link.onload = () => resolve();\n link.onerror = () => reject(new Error(`Failed to load CSS from ${cssUrl}`));\n document.head.appendChild(link);\n });\n };\n\n // Load JS\n const loadJS = (): Promise<void> => {\n return new Promise((resolve, reject) => {\n if (isJsLoaded()) {\n resolve();\n return;\n }\n\n const script = document.createElement(\"script\");\n script.src = jsUrl;\n script.async = true;\n script.onload = () => resolve();\n script.onerror = () => reject(new Error(`Failed to load JS from ${jsUrl}`));\n document.head.appendChild(script);\n });\n };\n\n // Load the tiny launcher-only critical bundle (launcher.global.js)\n const isLauncherLoaded = () => !!window.AgentWidgetLauncher;\n\n const loadLauncher = (): Promise<void> => {\n return new Promise((resolve, reject) => {\n if (isLauncherLoaded() || !launcherUrl) {\n resolve();\n return;\n }\n\n const script = document.createElement(\"script\");\n script.src = launcherUrl;\n script.async = true;\n script.onload = () => resolve();\n script.onerror = () => reject(new Error(`Failed to load launcher from ${launcherUrl}`));\n document.head.appendChild(script);\n });\n };\n\n // Warm the full bundle in the background (download-only, not executed) so the\n // first open is quick. Runs at idle so it never competes with the launcher.\n const prefetchFullBundle = (): void => {\n const addPrefetch = () => {\n if (isJsLoaded()) return;\n const link = document.createElement(\"link\");\n link.rel = \"prefetch\";\n link.as = \"script\";\n link.href = jsUrl;\n document.head.appendChild(link);\n };\n if (typeof requestIdleCallback !== \"undefined\") {\n requestIdleCallback(addPrefetch, { timeout: 4000 });\n } else {\n setTimeout(addPrefetch, 1200);\n }\n };\n\n // Merge top-level installer options into the widget config. Shared by the\n // eager init path and the deferred-launcher path.\n const buildWidgetInit = (): { target: string | HTMLElement; widgetConfig: any; hasApiConfig: boolean } => {\n const target = config.target || \"body\";\n const widgetConfig: any = { ...config.config };\n\n if (config.apiUrl && !widgetConfig.apiUrl) widgetConfig.apiUrl = config.apiUrl;\n if (config.clientToken && !widgetConfig.clientToken) widgetConfig.clientToken = config.clientToken;\n if (config.flowId && !widgetConfig.flowId) widgetConfig.flowId = config.flowId;\n\n const hasApiConfig = !!(widgetConfig.apiUrl || widgetConfig.clientToken);\n return { target, widgetConfig, hasApiConfig };\n };\n\n // Initialize the full widget. When `openAfter` is true (the deferred-launcher\n // handoff), open the panel immediately via the public controller API so the\n // user's click on the critical launcher carries through.\n const initWidget = (openAfter = false): any => {\n if (!window.AgentWidget || !window.AgentWidget.initAgentWidget) {\n console.warn(\"AgentWidget not available. Make sure the script loaded successfully.\");\n return;\n }\n\n const { target, widgetConfig, hasApiConfig } = buildWidgetInit();\n\n // Only initialize if we have either apiUrl OR clientToken (or other config)\n if (!hasApiConfig && Object.keys(widgetConfig).length === 0) {\n return;\n }\n\n // Auto-apply markdown postprocessor if not explicitly set and available\n if (!widgetConfig.postprocessMessage && window.AgentWidget.markdownPostprocessor) {\n widgetConfig.postprocessMessage = ({ text }: { text: string }) =>\n window.AgentWidget.markdownPostprocessor(text);\n }\n\n try {\n const handle = window.AgentWidget.initAgentWidget({\n target,\n config: widgetConfig,\n // Explicitly disable shadow DOM for better CSS compatibility with host page\n useShadowDom: config.useShadowDom ?? false,\n windowKey: config.windowKey\n });\n\n // Handoff from the critical launcher: the user already clicked, so open\n // the panel via the existing public controller method.\n if (openAfter && handle && typeof handle.open === \"function\") {\n handle.open();\n }\n\n // Eager floating installs paint their launcher at load time too — emit the\n // same page-load \"appeared\" signal as the deferred path. The deferred\n // handoff (openAfter) already fired it at launcher mount, and non-floating\n // modes have no launcher, so guard on both.\n if (!openAfter && hasFloatingLauncher(widgetConfig)) {\n safeCall(config.onLauncherShown, { deferred: false });\n dispatchLifecycle(\"persona:launcher-shown\", { deferred: false });\n }\n\n // The full widget is initialized and its controller API is callable.\n safeCall(resolveChatReady(), handle);\n dispatchLifecycle(\"persona:chat-ready\", handle);\n dispatchLifecycle(\"persona:ready\", handle); // deprecated alias — removed next major\n return handle;\n } catch (error) {\n fail(\"init\", error);\n }\n };\n\n // A persisted \"open\" state reopens the panel on reload with no click\n // (ui.ts:7513). The installer can't see that from config, so it reads the very\n // same storage key the widget writes. Mirrors normalizePersistStateConfig\n // (ui.ts:213): openState persistence defaults on, storage to sessionStorage,\n // key prefix to \"persona-\".\n const hasPersistedOpenState = (widgetConfig: any): boolean => {\n const persistState = widgetConfig.persistState;\n if (!persistState) return false; // persistence off → nothing to restore\n const asObject = typeof persistState === \"object\" ? persistState : null;\n if (asObject && asObject.persist?.openState === false) return false; // open-state persistence opted out\n const keyPrefix = (asObject && asObject.keyPrefix) || \"persona-\";\n const storageType = (asObject && asObject.storage) || \"session\";\n try {\n const storage = storageType === \"local\" ? window.localStorage : window.sessionStorage;\n return storage.getItem(`${keyPrefix}widget-open`) === \"true\";\n } catch {\n return false; // storage blocked (private mode) → the widget can't restore either\n }\n };\n\n // The deferred-launcher optimization only applies to the common floating case\n // that paints a collapsed launcher and waits for a click. Anything that starts\n // open or renders differently eager-loads the full bundle exactly as before —\n // including the two open triggers config alone can't express: a host\n // onStateLoaded hook that may request open, and a restored \"was open\" state.\n const shouldDeferPanel = (widgetConfig: any): boolean => {\n if (!launcherUrl) return false; // custom bundle URL override — can't derive launcher URL\n if (!hasFloatingLauncher(widgetConfig)) return false; // inline / docked / composer-bar\n const launcher = widgetConfig.launcher ?? {};\n if (launcher.autoExpand === true) return false; // starts open\n if (typeof widgetConfig.onStateLoaded === \"function\") return false; // hook may request open\n if (hasPersistedOpenState(widgetConfig)) return false; // restored \"was open\"\n return true;\n };\n\n // Render the real launcher from the tiny critical bundle; load + mount the\n // full widget on first click, then remove the critical launcher.\n const mountDeferredLauncher = (target: string | HTMLElement, widgetConfig: any): void => {\n let phase: \"idle\" | \"loading\" | \"done\" = \"idle\";\n let launcherHandle: { destroy: () => void } | undefined;\n\n const onOpen = () => {\n if (phase !== \"idle\") return; // already loading or handed off\n phase = \"loading\";\n loadJS()\n .then(() => {\n initWidget(true); // mount the full widget + open the panel\n launcherHandle?.destroy(); // remove the critical launcher (same component → invisible)\n phase = \"done\";\n })\n .catch((error) => {\n phase = \"idle\"; // allow the click to be retried\n console.error(\"Failed to load AgentWidget on open:\", error);\n safeCall(config.onError, { phase: \"bundle\", error });\n dispatchLifecycle(\"persona:error\", { phase: \"bundle\", error });\n });\n };\n\n const mounted = window.AgentWidgetLauncher.mount({ target, config: widgetConfig, onOpen });\n launcherHandle = mounted;\n\n // The real launcher is now painted at page-load time — emit the page-load\n // \"appeared\" signal (distinct from `onChatReady`, which waits for first open).\n safeCall(config.onLauncherShown, { deferred: true, element: mounted.element });\n dispatchLifecycle(\"persona:launcher-shown\", { deferred: true, element: mounted.element });\n\n // Warm the full bundle so the first open is quick.\n prefetchFullBundle();\n };\n\n // Main installation flow (called after hydration completes)\n const install = async () => {\n try {\n // Auto-init if we have config OR apiUrl OR clientToken\n const shouldAutoInit = autoInit && (\n config.config ||\n config.apiUrl ||\n config.clientToken\n );\n\n // Fast path: render the real launcher from the ~13 KB critical bundle and\n // defer the full widget until first open. Only for the common floating\n // case; everything else falls through to the eager path below.\n if (shouldAutoInit) {\n const { target, widgetConfig } = buildWidgetInit();\n if (shouldDeferPanel(widgetConfig)) {\n try {\n // CSS + launcher in parallel so the launcher paints correctly styled.\n await Promise.all([loadCSS(), loadLauncher()]);\n if (window.AgentWidgetLauncher && window.AgentWidgetLauncher.mount) {\n mountDeferredLauncher(target, widgetConfig);\n return;\n }\n } catch (error) {\n console.warn(\"Deferred launcher failed; falling back to eager load.\", error);\n }\n // Fall through to the eager path on any failure.\n }\n }\n\n // Eager path (unchanged behavior): load the full bundle, then init.\n try {\n await loadCSS();\n } catch (error) {\n return fail(\"css\", error);\n }\n try {\n await loadJS();\n } catch (error) {\n return fail(\"bundle\", error);\n }\n if (shouldAutoInit) {\n // Wait a tick to ensure AgentWidget is fully initialized\n setTimeout(() => initWidget(false), 0);\n }\n } catch (error) {\n // Safety net for anything unexpected before the eager loads above.\n fail(\"init\", error);\n }\n };\n\n // Start installation after hydration completes\n // This prevents Next.js/Nux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iBzC,IACrBlB,EAAO,QACPA,EAAO,QACPA,EAAO,aAMT,GAAI2D,EAAgB,CAClB,GAAM,CAAE,OAAAhB,EAAQ,aAAA9B,CAAa,EAAI6B,EAAgB,EACjD,GAAIY,EAAiBzC,CAAY,EAC/B,GAAI,CAGF,GADA,MAAM,QAAQ,IAAI,CAACoB,EAAQ,EAAGM,EAAa,CAAC,CAAC,EACzC,OAAO,qBAAuB,OAAO,oBAAoB,MAAO,CAClEgB,EAAsBZ,EAAQ9B,CAAY,EAC1C,MACF,CACF,OAASJ,EAAO,CACd,QAAQ,KAAK,wDAAyDA,CAAK,CAC7E,CAGJ,CAGA,GAAI,CACF,MAAMwB,EAAQ,CAChB,OAASxB,EAAO,CACd,OAAOF,EAAK,MAAOE,CAAK,CAC1B,CACA,GAAI,CACF,MAAM4B,EAAO,CACf,OAAS5B,EAAO,CACd,OAAOF,EAAK,SAAUE,CAAK,CAC7B,CACIkD,GAEF,WAAW,IAAMd,EAAW,EAAK,EAAG,CAAC,CAEzC,OAASpC,EAAO,CAEdF,EAAK,OAAQE,CAAK,CACpB,CACF,CAIwB,CAC1B,GAAG","names":["install_exports","scriptConfig","script","configJson","normalizedJson","parsedConfig","_a","_b","_c","safeConfig","e","token","flowId","apiUrl","previewQueryParam","config","safeCall","fn","arg","dispatchLifecycle","name","detail","fail","phase","error","warnedOnReadyDeprecated","resolveChatReady","hasFloatingLauncher","widgetConfig","launcher","value","version","cdn","autoInit","getCdnBase","derivedLauncherUrl","basePath","host","cssUrl","jsUrl","launcherUrl","isCssLoaded","isJsLoaded","waitForHydration","callback","executed","execute","afterDom","loadCSS","resolve","reject","link","loadJS","isLauncherLoaded","loadLauncher","prefetchFullBundle","addPrefetch","buildWidgetInit","target","hasApiConfig","initWidget","openAfter","text","handle","hasPersistedOpenState","persistState","asObject","keyPrefix","storageType","shouldDeferPanel","mountDeferredLauncher","launcherHandle","onOpen","mounted","shouldAutoInit"]}
@@ -0,0 +1,133 @@
1
+ "use strict";var AgentWidgetLauncher=(()=>{var re=Object.defineProperty;var er=Object.getOwnPropertyDescriptor;var ar=Object.getOwnPropertyNames;var or=Object.prototype.hasOwnProperty;var tr=(a,o)=>{for(var e in o)re(a,e,{get:o[e],enumerable:!0})},rr=(a,o,e,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of ar(o))!or.call(a,r)&&r!==e&&re(a,r,{get:()=>o[r],enumerable:!(s=er(o,r))||s.enumerable});return a};var sr=a=>rr(re({},"__esModule",{value:!0}),a);var kr={};tr(kr,{CRITICAL_LAUNCHER_ATTR:()=>Yt,mount:()=>wr});var zt=(a,o)=>{let e=document.createElement(a);return o&&(e.className=o),e};var X={"bottom-right":"persona-bottom-6 persona-right-6","bottom-left":"persona-bottom-6 persona-left-6","top-right":"persona-top-6 persona-right-6","top-left":"persona-top-6 persona-left-6"};var Gt=a=>{var o,e;return((e=(o=a==null?void 0:a.launcher)==null?void 0:o.mountMode)!=null?e:"floating")==="docked"};var se=[["path",{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"}]];var le=[["path",{d:"M12 5v14"}],["path",{d:"m19 12-7 7-7-7"}]];var fe=[["path",{d:"m12 19-7-7 7-7"}],["path",{d:"M19 12H5"}]];var de=[["path",{d:"M5 12h14"}],["path",{d:"m12 5 7 7-7 7"}]];var pe=[["path",{d:"M7 7h10v10"}],["path",{d:"M7 17 17 7"}]];var ne=[["path",{d:"m5 12 7-7 7 7"}],["path",{d:"M12 19V5"}]];var ue=[["circle",{cx:"12",cy:"12",r:"4"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8"}]];var ie=[["path",{d:"M4.929 4.929 19.07 19.071"}],["circle",{cx:"12",cy:"12",r:"10"}]];var me=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"}]];var ce=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z"}]];var xe=[["path",{d:"M12 8V4H8"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}],["path",{d:"M2 14h2"}],["path",{d:"M20 14h2"}],["path",{d:"M15 13v2"}],["path",{d:"M9 13v2"}]];var he=[["path",{d:"M12 10h.01"}],["path",{d:"M12 14h.01"}],["path",{d:"M12 6h.01"}],["path",{d:"M16 10h.01"}],["path",{d:"M16 14h.01"}],["path",{d:"M16 6h.01"}],["path",{d:"M8 10h.01"}],["path",{d:"M8 14h.01"}],["path",{d:"M8 6h.01"}],["path",{d:"M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"}],["rect",{x:"4",y:"2",width:"16",height:"20",rx:"2"}]];var ge=[["path",{d:"M8 2v4"}],["path",{d:"M16 2v4"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}],["path",{d:"M3 10h18"}],["path",{d:"M8 14h.01"}],["path",{d:"M12 14h.01"}],["path",{d:"M16 14h.01"}],["path",{d:"M8 18h.01"}],["path",{d:"M12 18h.01"}],["path",{d:"M16 18h.01"}]];var be=[["path",{d:"M8 2v4"}],["path",{d:"M16 2v4"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}],["path",{d:"M3 10h18"}]];var Ce=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"}],["circle",{cx:"12",cy:"13",r:"3"}]];var ye=[["path",{d:"M20 6 9 17l-5-5"}]];var Se=[["path",{d:"m6 9 6 6 6-6"}]];var we=[["path",{d:"m15 18-6-6 6-6"}]];var ke=[["path",{d:"m9 18 6-6-6-6"}]];var Me=[["path",{d:"m18 15-6-6-6 6"}]];var _=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m9 12 2 2 4-4"}]];var K=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m15 9-6 6"}],["path",{d:"m9 9 6 6"}]];var Ae=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4"}],["path",{d:"M21 14H11"}],["path",{d:"m15 10-4 4 4 4"}]];var ve=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}],["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"}]];var Te=[["path",{d:"M12 6v6l4 2"}],["circle",{cx:"12",cy:"12",r:"10"}]];var Pe=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}]];var Be=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10"}]];var Le=[["line",{x1:"12",x2:"12",y1:"2",y2:"22"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"}]];var Fe=[["path",{d:"M12 15V3"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}],["path",{d:"m7 10 5 5 5-5"}]];var Z=[["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"12",cy:"5",r:"1"}],["circle",{cx:"12",cy:"19",r:"1"}]];var j=[["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"19",cy:"12",r:"1"}],["circle",{cx:"5",cy:"12",r:"1"}]];var Re=[["path",{d:"M15 3h6v6"}],["path",{d:"M10 14 21 3"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}]];var De=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}],["path",{d:"m2 2 20 20"}]];var He=[["path",{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"}],["circle",{cx:"12",cy:"12",r:"3"}]];var qe=[["path",{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"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M10 12.5 8 15l2 2.5"}],["path",{d:"m14 12.5 2 2.5-2 2.5"}]];var Ue=[["path",{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"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M8 13h2"}],["path",{d:"M14 13h2"}],["path",{d:"M8 17h2"}],["path",{d:"M14 17h2"}]];var Ee=[["path",{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"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M10 9H8"}],["path",{d:"M16 13H8"}],["path",{d:"M16 17H8"}]];var Ie=[["path",{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"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}]];var Oe=[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1"}]];var We=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M7 3v18"}],["path",{d:"M3 7.5h4"}],["path",{d:"M3 12h18"}],["path",{d:"M3 16.5h4"}],["path",{d:"M17 3v18"}],["path",{d:"M17 7.5h4"}],["path",{d:"M17 16.5h4"}]];var Ve=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528"}]];var ze=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"}]];var Ge=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}]];var Q=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"}]];var Ne=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1"}],["path",{d:"M12 8v13"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5"}]];var Xe=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}],["path",{d:"M2 12h20"}]];var _e=[["line",{x1:"4",x2:"20",y1:"9",y2:"9"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21"}]];var Ke=[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3"}]];var Ze=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"}]];var je=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}],["path",{d:"M12 7v5l4 2"}]];var J=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}]];var Qe=[["path",{d:"M16 5h6"}],["path",{d:"M19 2v6"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}],["circle",{cx:"9",cy:"9",r:"2"}]];var Je=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}],["circle",{cx:"9",cy:"9",r:"2"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}]];var Ye=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 16v-4"}],["path",{d:"M12 8h.01"}]];var $e=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"}],["path",{d:"m21 2-9.6 9.6"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5"}]];var ea=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"}]];var Y=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56"}]];var aa=[["path",{d:"M12 2v4"}],["path",{d:"m16.2 7.8 2.9-2.9"}],["path",{d:"M18 12h4"}],["path",{d:"m16.2 16.2 2.9 2.9"}],["path",{d:"M12 18v4"}],["path",{d:"m4.9 19.1 2.9-2.9"}],["path",{d:"M2 12h4"}],["path",{d:"m4.9 4.9 2.9 2.9"}]];var oa=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}]];var ta=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}]];var ra=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"}],["circle",{cx:"12",cy:"10",r:"3"}]];var sa=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"}]];var la=[["path",{d:"M4 5h16"}],["path",{d:"M4 12h16"}],["path",{d:"M4 19h16"}]];var fa=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"}]];var da=[["path",{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"}]];var pa=[["path",{d:"M12 19v3"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3"}]];var na=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"}]];var ua=[["path",{d:"M5 12h14"}]];var ia=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21"}]];var ma=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"}]];var ca=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z"}],["path",{d:"M12 22V12"}],["polyline",{points:"3.29 7 12 12 20.71 7"}],["path",{d:"m7.5 4.27 9 5.15"}]];var xa=[["path",{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"}]];var ha=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1"}]];var ga=[["path",{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"}],["path",{d:"m15 5 4 4"}]];var ba=[["line",{x1:"19",x2:"5",y1:"5",y2:"19"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5"}]];var Ca=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"}]];var ya=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"}]];var Sa=[["path",{d:"M5 12h14"}],["path",{d:"M12 5v14"}]];var wa=[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8"}],["path",{d:"M12 17.5v-11"}]];var ka=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 16H3v5"}]];var Ma=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}]];var Aa=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7"}]];var va=[["path",{d:"m21 21-4.34-4.34"}],["circle",{cx:"11",cy:"11",r:"8"}]];var Ta=[["path",{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"}],["path",{d:"m21.854 2.147-10.94 10.939"}]];var Pa=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"}],["circle",{cx:"12",cy:"12",r:"3"}]];var Ba=[["path",{d:"M12 2v13"}],["path",{d:"m16 6-4-4-4 4"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"}]];var La=[["path",{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"}],["path",{d:"M12 8v4"}],["path",{d:"M12 16h.01"}]];var Fa=[["path",{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"}],["path",{d:"m9 12 2 2 4-4"}]];var $=[["path",{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"}],["path",{d:"m14.5 9.5-5 5"}],["path",{d:"m9.5 9.5 5 5"}]];var Ra=[["path",{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"}]];var Da=[["path",{d:"M16 10a4 4 0 0 1-8 0"}],["path",{d:"M3.103 6.034h17.794"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z"}]];var Ha=[["circle",{cx:"8",cy:"21",r:"1"}],["circle",{cx:"19",cy:"21",r:"1"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"}]];var qa=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2"}],["path",{d:"M12 18h.01"}]];var ee=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"}],["path",{d:"M20 2v4"}],["path",{d:"M22 4h-4"}],["circle",{cx:"4",cy:"20",r:"2"}]];var Ua=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}]];var Ea=[["path",{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"}]];var Ia=[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05"}]];var Oa=[["circle",{cx:"12",cy:"12",r:"4"}],["path",{d:"M12 2v2"}],["path",{d:"M12 20v2"}],["path",{d:"m4.93 4.93 1.41 1.41"}],["path",{d:"m17.66 17.66 1.41 1.41"}],["path",{d:"M2 12h2"}],["path",{d:"M20 12h2"}],["path",{d:"m6.34 17.66-1.41 1.41"}],["path",{d:"m19.07 4.93-1.41 1.41"}]];var Wa=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor"}]];var Va=[["path",{d:"M17 14V2"}],["path",{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"}]];var za=[["path",{d:"M7 10v12"}],["path",{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"}]];var Ga=[["line",{x1:"10",x2:"14",y1:"2",y2:"2"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11"}],["circle",{cx:"12",cy:"14",r:"8"}]];var Na=[["path",{d:"M10 11v6"}],["path",{d:"M14 11v6"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]];var Xa=[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]];var ae=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}],["path",{d:"M12 9v4"}],["path",{d:"M12 17h.01"}]];var _a=[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2"}],["path",{d:"M15 18H9"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14"}],["circle",{cx:"17",cy:"18",r:"2"}],["circle",{cx:"7",cy:"18",r:"2"}]];var Ka=[["path",{d:"M12 3v12"}],["path",{d:"m17 8-5-5-5 5"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}]];var Za=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}],["circle",{cx:"12",cy:"7",r:"4"}]];var ja=[["path",{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"}],["path",{d:"M16 9a5 5 0 0 1 0 6"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728"}]];var Qa=[["path",{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"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15"}]];var Ja=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"}]];var Ya=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];var $a=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"}]];var lr={activity:se,"arrow-down":le,"arrow-up":ne,"arrow-up-right":pe,bot:xe,"chevron-down":Se,"chevron-up":Me,"chevron-right":ke,"chevron-left":we,check:ye,clipboard:ve,"clipboard-copy":Ae,copy:Pe,file:Ie,"file-code":qe,"file-spreadsheet":Ue,"file-text":Ee,"image-plus":Qe,loader:aa,"loader-circle":Y,mic:pa,paperclip:xa,"refresh-cw":ka,search:va,send:Ta,"shield-alert":La,"shield-check":Fa,"shield-x":$,square:Ua,"thumbs-down":Va,"thumbs-up":za,upload:Ka,"volume-2":ja,x:Ya,user:Za,mail:ta,phone:Ca,calendar:be,clock:Te,building:he,"map-pin":ra,lock:oa,key:$e,"credit-card":Be,"at-sign":ue,hash:_e,globe:Xe,link:ea,"circle-check":_,"circle-x":K,"triangle-alert":ae,info:Ye,ban:ie,shield:Ra,"arrow-left":fe,"arrow-right":de,"external-link":Re,ellipsis:j,"ellipsis-vertical":Z,menu:la,house:J,plus:Sa,minus:ua,pencil:ga,trash:Xa,"trash-2":Na,save:Aa,download:Fe,share:Ba,funnel:Q,settings:Pa,"rotate-cw":Ma,maximize:sa,minimize:na,"shopping-cart":Ha,"shopping-bag":Da,package:ca,truck:_a,tag:Wa,gift:Ne,receipt:wa,wallet:Ja,store:Ia,"dollar-sign":Le,percent:ba,play:ya,pause:ha,"volume-x":Qa,camera:Ce,image:Je,film:We,headphones:Ke,"message-circle":fa,"message-square":da,bell:me,heart:Ze,star:Ea,eye:He,"eye-off":De,bookmark:ce,"calendar-days":ge,history:je,timer:Ga,folder:Ge,"folder-open":ze,files:Oe,sparkles:ee,zap:$a,sun:Oa,moon:ma,flag:Ve,monitor:ia,smartphone:qa},eo=(a,o=24,e="currentColor",s=2)=>{let r=lr[a];return r?fr(r,o,e,s):(console.warn(`Lucide icon "${a}" is not in the Persona registry. Add it to packages/widget/src/utils/icons.ts (see docs/icon-registry-shortlist.md).`),null)};function fr(a,o,e,s){if(!Array.isArray(a))return null;let r=document.createElementNS("http://www.w3.org/2000/svg","svg");return r.setAttribute("width",String(o)),r.setAttribute("height",String(o)),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("fill","none"),r.setAttribute("stroke",e),r.setAttribute("stroke-width",String(s)),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),r.setAttribute("aria-hidden","true"),a.forEach(d=>{if(!Array.isArray(d)||d.length<2)return;let l=d[0],i=d[1];if(!i)return;let h=document.createElementNS("http://www.w3.org/2000/svg",l);Object.entries(i).forEach(([g,m])=>{g!=="stroke"&&h.setAttribute(g,String(m))}),r.appendChild(h)}),r}var ao=1e5,zd=ao+1;var Nt=(a,o)=>{let e=zt("button");e.type="button",e.innerHTML=`
2
+ <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">\u{1F4AC}</span>
3
+ <img data-role="launcher-image" class="persona-rounded-full persona-object-cover" alt="" style="display:none" />
4
+ <span class="persona-flex persona-min-w-0 persona-flex-1 persona-flex-col persona-items-start persona-text-left">
5
+ <span class="persona-block persona-w-full persona-truncate persona-text-sm persona-font-semibold persona-text-persona-primary" data-role="launcher-title"></span>
6
+ <span class="persona-block persona-w-full persona-truncate persona-text-xs persona-text-persona-muted" data-role="launcher-subtitle"></span>
7
+ </span>
8
+ <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">\u2197</span>
9
+ `,e.addEventListener("click",o);let s=d=>{var P,B,L,C,y,F,R,D,H,S,w,q,U,E;let l=(P=d.launcher)!=null?P:{},i=Gt(d),h=e.querySelector("[data-role='launcher-title']");if(h){let c=(B=l.title)!=null?B:"Chat Assistant";h.textContent=c,h.setAttribute("title",c)}let g=e.querySelector("[data-role='launcher-subtitle']");if(g){let c=(L=l.subtitle)!=null?L:"Get answers fast";g.textContent=c,g.setAttribute("title",c)}let m=e.querySelector(".persona-flex-col");m&&(l.textHidden||i?m.style.display="none":m.style.display="");let f=e.querySelector("[data-role='launcher-icon']");if(f)if(l.agentIconHidden)f.style.display="none";else{let c=(C=l.agentIconSize)!=null?C:"40px";if(f.style.height=c,f.style.width=c,f.innerHTML="",l.agentIconName){let v=parseFloat(c)||24,k=eo(l.agentIconName,v*.6,"var(--persona-text-inverse, #ffffff)",2);k?(f.appendChild(k),f.style.display=""):(f.textContent=(y=l.agentIconText)!=null?y:"\u{1F4AC}",f.style.display="")}else l.iconUrl?f.style.display="none":(f.textContent=(F=l.agentIconText)!=null?F:"\u{1F4AC}",f.style.display="")}let n=e.querySelector("[data-role='launcher-image']");if(n){let c=(R=l.agentIconSize)!=null?R:"40px";n.style.height=c,n.style.width=c,l.iconUrl&&!l.agentIconName&&!l.agentIconHidden?(n.src=l.iconUrl,n.style.display="block"):n.style.display="none"}let p=e.querySelector("[data-role='launcher-call-to-action-icon']");if(p){let c=(D=l.callToActionIconSize)!=null?D:"32px";p.style.height=c,p.style.width=c,l.callToActionIconBackgroundColor?(p.style.backgroundColor=l.callToActionIconBackgroundColor,p.classList.remove("persona-bg-persona-primary")):(p.style.backgroundColor="",p.classList.add("persona-bg-persona-primary")),l.callToActionIconColor?(p.style.color=l.callToActionIconColor,p.classList.remove("persona-text-persona-call-to-action")):(p.style.color="",p.classList.add("persona-text-persona-call-to-action"));let v=0;if(l.callToActionIconPadding?(p.style.boxSizing="border-box",p.style.padding=l.callToActionIconPadding,v=(parseFloat(l.callToActionIconPadding)||0)*2):(p.style.boxSizing="",p.style.padding=""),l.callToActionIconHidden)p.style.display="none";else if(p.style.display=i?"none":"",p.innerHTML="",l.callToActionIconName){let k=parseFloat(c)||24,O=Math.max(k-v,8),I=eo(l.callToActionIconName,O,"currentColor",2);I?p.appendChild(I):p.textContent=(H=l.callToActionIconText)!=null?H:"\u2197"}else p.textContent=(S=l.callToActionIconText)!=null?S:"\u2197"}let x=l.position&&X[l.position]?X[l.position]:X["bottom-right"],M="persona-fixed persona-flex persona-items-center persona-gap-3 persona-rounded-launcher persona-bg-persona-surface persona-py-2.5 persona-pl-3 persona-pr-3 persona-transition hover:persona-translate-y-[-2px] persona-cursor-pointer",A="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-surface persona-transition hover:persona-translate-y-[-2px] persona-cursor-pointer";e.className=i?A:`${M} ${x}`,i||(e.style.zIndex=String((w=l.zIndex)!=null?w:ao));let b="1px solid var(--persona-border, #e5e7eb)",T="var(--persona-shadow, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1))";e.style.border=(q=l.border)!=null?q:b,e.style.boxShadow=(U=l.shadow)!=null?U:T,i?(e.style.width="0",e.style.minWidth="0",e.style.maxWidth="0",e.style.padding="0",e.style.overflow="hidden",e.style.border="none",e.style.boxShadow="none"):(e.style.width="",e.style.minWidth="",e.style.maxWidth=(E=l.collapsedMaxWidth)!=null?E:"",e.style.justifyContent="",e.style.padding="",e.style.overflow="")},r=()=>{e.removeEventListener("click",o),e.remove()};return a&&s(a),{element:e,update:s,destroy:r}};var Xt=a=>typeof a=="object"&&a!==null&&!Array.isArray(a);function N(a,o){if(!a)return o;if(!o)return a;let e={...a};for(let[s,r]of Object.entries(o)){let d=e[s];Xt(d)&&Xt(r)?e[s]=N(d,r):e[s]=r}return e}var oo="min(440px, calc(100vw - 24px))",Kt="440px",u={apiUrl:"https://api.runtype.com/api/chat/dispatch",clientToken:void 0,theme:void 0,darkTheme:void 0,colorScheme:"light",launcher:{enabled:!0,mountMode:"floating",dock:{side:"right",width:"420px"},title:"Chat Assistant",subtitle:"Here to help you get answers fast",agentIconText:"\u{1F4AC}",agentIconName:"bot",headerIconName:"bot",position:"bottom-right",width:oo,heightOffset:0,autoExpand:!1,callToActionIconHidden:!1,agentIconSize:"40px",headerIconSize:"40px",closeButtonSize:"32px",closeButtonPaddingX:"0px",closeButtonPaddingY:"0px",callToActionIconName:"arrow-up-right",callToActionIconText:"",callToActionIconSize:"32px",callToActionIconPadding:"5px",callToActionIconColor:void 0,callToActionIconBackgroundColor:void 0,closeButtonBackgroundColor:"transparent",clearChat:{backgroundColor:"transparent",borderColor:"transparent",enabled:!0,placement:"inline",iconName:"refresh-cw",size:"32px",showTooltip:!0,tooltipText:"Clear chat",paddingX:"0px",paddingY:"0px"},headerIconHidden:!1,border:void 0,shadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)"},copy:{welcomeTitle:"Hello \u{1F44B}",welcomeSubtitle:"Ask anything about your account or products.",inputPlaceholder:"How can I help...",sendButtonLabel:"Send"},sendButton:{borderWidth:"0px",paddingX:"12px",paddingY:"10px",borderColor:void 0,useIcon:!0,iconText:"\u2191",size:"40px",showTooltip:!0,tooltipText:"Send message",iconName:"send"},statusIndicator:{visible:!0,idleText:"Online",connectingText:"Connecting\u2026",connectedText:"Streaming\u2026",errorText:"Offline"},voiceRecognition:{enabled:!0,pauseDuration:2e3,iconName:"mic",iconSize:"39px",borderWidth:"0px",paddingX:"9px",paddingY:"14px",iconColor:void 0,backgroundColor:"transparent",borderColor:"transparent",recordingIconColor:void 0,recordingBackgroundColor:void 0,recordingBorderColor:"transparent",showTooltip:!0,tooltipText:"Start voice recognition"},features:{showReasoning:!0,showToolCalls:!0,scrollToBottom:{enabled:!0,iconName:"arrow-down",label:""},toolCallDisplay:{collapsedMode:"tool-call",activePreview:!1,grouped:!1,previewMaxLines:3,expandable:!0,loadingAnimation:"none"},reasoningDisplay:{activePreview:!1,previewMaxLines:3,expandable:!0,loadingAnimation:"none"},streamAnimation:{type:"none",placeholder:"none",speed:120,duration:1800},askUserQuestion:{enabled:!0,slideInMs:180,freeTextLabel:"Other\u2026",freeTextPlaceholder:"Type your answer\u2026",submitLabel:"Send"}},suggestionChips:["What can you help me with?","Tell me about your features","How does this work?"],suggestionChipsConfig:{fontFamily:"sans-serif",fontWeight:"500",paddingX:"12px",paddingY:"6px"},layout:{header:{layout:"default",showIcon:!0,showTitle:!0,showSubtitle:!0,showCloseButton:!0,showClearChat:!0},messages:{layout:"bubble",avatar:{show:!1,position:"left"},timestamp:{show:!1,position:"below"},groupConsecutive:!1},slots:{}},markdown:{options:{gfm:!0,breaks:!0},disableDefaultStyles:!1},messageActions:{enabled:!0,showCopy:!0,showUpvote:!1,showDownvote:!1,visibility:"hover",align:"right",layout:"pill-inside"},debug:!1};function _t(a,o){if(!(!a&&!o))return a?o?N(a,o):a:o}function to(a){var o,e,s,r,d,l,i,h,g,m,f,n,p,x,M,A,b,T,P,B,L;return a?{...u,...a,theme:_t(u.theme,a.theme),darkTheme:_t(u.darkTheme,a.darkTheme),launcher:{...u.launcher,...a.launcher,dock:{...(o=u.launcher)==null?void 0:o.dock,...(e=a.launcher)==null?void 0:e.dock},clearChat:{...(s=u.launcher)==null?void 0:s.clearChat,...(r=a.launcher)==null?void 0:r.clearChat}},copy:{...u.copy,...a.copy},sendButton:{...u.sendButton,...a.sendButton},statusIndicator:{...u.statusIndicator,...a.statusIndicator},voiceRecognition:{...u.voiceRecognition,...a.voiceRecognition},features:(()=>{var v,k,O,I,W,V,z,G;let C=(v=u.features)==null?void 0:v.artifacts,y=(k=a.features)==null?void 0:k.artifacts,F=(O=u.features)==null?void 0:O.scrollToBottom,R=(I=a.features)==null?void 0:I.scrollToBottom,D=(W=u.features)==null?void 0:W.streamAnimation,H=(V=a.features)==null?void 0:V.streamAnimation,S=(z=u.features)==null?void 0:z.askUserQuestion,w=(G=a.features)==null?void 0:G.askUserQuestion,q=C===void 0&&y===void 0?void 0:{...C,...y,layout:{...C==null?void 0:C.layout,...y==null?void 0:y.layout}},U=F===void 0&&R===void 0?void 0:{...F,...R},E=D===void 0&&H===void 0?void 0:{...D,...H},c=S===void 0&&w===void 0?void 0:{...S,...w,styles:{...S==null?void 0:S.styles,...w==null?void 0:w.styles}};return{...u.features,...a.features,...U!==void 0?{scrollToBottom:U}:{},...q!==void 0?{artifacts:q}:{},...E!==void 0?{streamAnimation:E}:{},...c!==void 0?{askUserQuestion:c}:{}}})(),suggestionChips:(d=a.suggestionChips)!=null?d:u.suggestionChips,suggestionChipsConfig:{...u.suggestionChipsConfig,...a.suggestionChipsConfig},layout:{...u.layout,...a.layout,header:{...(l=u.layout)==null?void 0:l.header,...(i=a.layout)==null?void 0:i.header},messages:{...(h=u.layout)==null?void 0:h.messages,...(g=a.layout)==null?void 0:g.messages,avatar:{...(f=(m=u.layout)==null?void 0:m.messages)==null?void 0:f.avatar,...(p=(n=a.layout)==null?void 0:n.messages)==null?void 0:p.avatar},timestamp:{...(M=(x=u.layout)==null?void 0:x.messages)==null?void 0:M.timestamp,...(b=(A=a.layout)==null?void 0:A.messages)==null?void 0:b.timestamp}},slots:{...(T=u.layout)==null?void 0:T.slots,...(P=a.layout)==null?void 0:P.slots}},markdown:{...u.markdown,...a.markdown,options:{...(B=u.markdown)==null?void 0:B.options,...(L=a.markdown)==null?void 0:L.options}},messageActions:{...u.messageActions,...a.messageActions}}:u}var dr={colors:{primary:{50:"#ffffff",100:"#f5f5f5",200:"#d4d4d4",300:"#a3a3a3",400:"#737373",500:"#171717",600:"#0f0f0f",700:"#0a0a0a",800:"#050505",900:"#030303",950:"#000000"},secondary:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},accent:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},success:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d"},warning:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12"},error:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d"},info:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"}},spacing:{0:"0px",1:"0.25rem",2:"0.5rem",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",8:"2rem",10:"2.5rem",12:"3rem",16:"4rem",20:"5rem",24:"6rem",32:"8rem",40:"10rem",48:"12rem",56:"14rem",64:"16rem"},typography:{fontFamily:{sans:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',serif:'Georgia, Cambria, "Times New Roman", Times, serif',mono:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"},fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem"},fontWeight:{normal:"400",medium:"500",semibold:"600",bold:"700"},lineHeight:{tight:"1.25",normal:"1.5",relaxed:"1.625"}},shadows:{none:"none",sm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)","2xl":"0 25px 50px -12px rgb(0 0 0 / 0.25)"},borders:{none:"none",sm:"1px solid",md:"2px solid",lg:"4px solid"},radius:{none:"0px",sm:"0.125rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem",full:"9999px"}},pr={colors:{primary:"palette.colors.primary.500",secondary:"palette.colors.secondary.500",accent:"palette.colors.primary.600",surface:"palette.colors.gray.50",background:"palette.colors.gray.50",container:"palette.colors.gray.50",text:"palette.colors.gray.900",textMuted:"palette.colors.gray.500",textInverse:"palette.colors.gray.50",border:"palette.colors.gray.200",divider:"palette.colors.gray.200",interactive:{default:"palette.colors.primary.600",hover:"palette.colors.primary.700",focus:"palette.colors.primary.600",active:"palette.colors.primary.600",disabled:"palette.colors.gray.300"},feedback:{success:"palette.colors.success.500",warning:"palette.colors.warning.500",error:"palette.colors.error.500",info:"palette.colors.info.500"}},spacing:{xs:"palette.spacing.1",sm:"palette.spacing.2",md:"palette.spacing.4",lg:"palette.spacing.6",xl:"palette.spacing.8","2xl":"palette.spacing.10"},typography:{fontFamily:"palette.typography.fontFamily.sans",fontSize:"palette.typography.fontSize.base",fontWeight:"palette.typography.fontWeight.normal",lineHeight:"palette.typography.lineHeight.normal"}},nr={button:{primary:{background:"palette.colors.primary.500",foreground:"palette.colors.primary.50",borderRadius:"palette.radius.lg",padding:"semantic.spacing.md"},secondary:{background:"semantic.colors.surface",foreground:"semantic.colors.secondary",borderRadius:"palette.radius.lg",padding:"semantic.spacing.md"},ghost:{background:"transparent",foreground:"semantic.colors.text",borderRadius:"palette.radius.md",padding:"semantic.spacing.sm"}},input:{background:"palette.colors.gray.50",placeholder:"palette.colors.gray.400",borderRadius:"palette.radius.lg",padding:"semantic.spacing.md",focus:{border:"palette.colors.gray.400",ring:"palette.colors.gray.400"}},launcher:{background:"palette.colors.primary.500",foreground:"palette.colors.primary.50",border:"palette.colors.gray.200",size:"60px",iconSize:"28px",borderRadius:"palette.radius.full",shadow:"palette.shadows.lg"},panel:{width:oo,maxWidth:Kt,height:"600px",maxHeight:"calc(100vh - 80px)",borderRadius:"palette.radius.xl",shadow:"palette.shadows.xl"},header:{background:"palette.colors.primary.500",border:"palette.colors.primary.600",borderRadius:"palette.radius.xl palette.radius.xl 0 0",padding:"semantic.spacing.md",iconBackground:"palette.colors.primary.600",iconForeground:"palette.colors.primary.50",titleForeground:"palette.colors.primary.50",subtitleForeground:"palette.colors.primary.200",actionIconForeground:"palette.colors.primary.200"},message:{user:{background:"palette.colors.primary.500",text:"palette.colors.primary.50",borderRadius:"palette.radius.lg",shadow:"palette.shadows.sm"},assistant:{background:"palette.colors.gray.50",text:"palette.colors.gray.900",borderRadius:"palette.radius.lg",border:"palette.colors.gray.200",shadow:"palette.shadows.sm"},border:"semantic.colors.border"},introCard:{background:"semantic.colors.surface",borderRadius:"palette.radius.2xl",padding:"semantic.spacing.lg",shadow:"0 5px 15px rgba(15, 23, 42, 0.08)"},toolBubble:{shadow:"palette.shadows.sm"},reasoningBubble:{shadow:"palette.shadows.sm"},composer:{shadow:"none"},markdown:{inlineCode:{background:"palette.colors.gray.50",foreground:"palette.colors.gray.900"},link:{foreground:"palette.colors.primary.600"},prose:{fontFamily:"inherit"},codeBlock:{background:"semantic.colors.container",borderColor:"semantic.colors.border",textColor:"inherit"},table:{headerBackground:"semantic.colors.container",borderColor:"semantic.colors.border"},hr:{color:"semantic.colors.divider"},blockquote:{borderColor:"palette.colors.gray.900",background:"transparent",textColor:"palette.colors.gray.500"}},collapsibleWidget:{container:"palette.colors.gray.50",surface:"semantic.colors.surface",border:"semantic.colors.border"},voice:{recording:{indicator:"palette.colors.error.500",background:"palette.colors.error.50",border:"palette.colors.error.200"},processing:{icon:"palette.colors.primary.500",background:"palette.colors.primary.50"},speaking:{icon:"palette.colors.success.500"}},approval:{requested:{background:"palette.colors.warning.50",border:"palette.colors.warning.200",text:"palette.colors.gray.900"},approve:{background:"palette.colors.success.500",foreground:"palette.colors.gray.50",borderRadius:"palette.radius.md",padding:"semantic.spacing.sm"},deny:{background:"palette.colors.error.500",foreground:"palette.colors.gray.50",borderRadius:"palette.radius.md",padding:"semantic.spacing.sm"}},attachment:{image:{background:"palette.colors.gray.100",border:"palette.colors.gray.200"}},scrollToBottom:{background:"components.button.primary.background",foreground:"components.button.primary.foreground",border:"semantic.colors.primary",size:"40px",borderRadius:"palette.radius.full",shadow:"palette.shadows.sm",padding:"0.5rem 0.875rem",gap:"0.5rem",fontSize:"0.875rem",iconSize:"14px"},artifact:{pane:{background:"semantic.colors.container",toolbarBackground:"semantic.colors.container"}}};function ro(a,o){if(!o.startsWith("palette.")&&!o.startsWith("semantic.")&&!o.startsWith("components."))return o;let e=o.split("."),s=a;for(let r of e){if(s==null)return;s=s[r]}return typeof s=="string"&&(s.startsWith("palette.")||s.startsWith("semantic.")||s.startsWith("components."))?ro(a,s):s}function Zt(a){let o={};function e(s,r){for(let[d,l]of Object.entries(s)){let i=`${r}.${d}`;if(typeof l=="string"){let h=ro(a,l);h!==void 0&&(o[i]={path:i,value:h,type:r.includes("color")?"color":r.includes("spacing")?"spacing":r.includes("typography")?"typography":r.includes("shadow")?"shadow":r.includes("border")?"border":"color"})}else typeof l=="object"&&l!==null&&e(l,i)}}return e(a.palette,"palette"),e(a.semantic,"semantic"),e(a.components,"components"),o}function ur(a){let o=[],e=[];return a.palette||o.push({path:"palette",message:"Theme must include a palette",severity:"error"}),a.semantic||e.push({path:"semantic",message:"No semantic tokens defined - defaults will be used",severity:"warning"}),a.components||e.push({path:"components",message:"No component tokens defined - defaults will be used",severity:"warning"}),{valid:o.length===0,errors:o,warnings:e}}function jt(a,o){let e={...a};for(let[s,r]of Object.entries(o)){let d=e[s];d&&typeof d=="object"&&!Array.isArray(d)&&r&&typeof r=="object"&&!Array.isArray(r)?e[s]=jt(d,r):e[s]=r}return e}function ir(a,o){return o?jt(a,o):a}function oe(a,o={}){var r,d,l,i,h,g,m,f,n,p,x,M,A;let e={palette:dr,semantic:pr,components:nr},s={palette:{...e.palette,...a==null?void 0:a.palette,colors:{...e.palette.colors,...(r=a==null?void 0:a.palette)==null?void 0:r.colors},spacing:{...e.palette.spacing,...(d=a==null?void 0:a.palette)==null?void 0:d.spacing},typography:{...e.palette.typography,...(l=a==null?void 0:a.palette)==null?void 0:l.typography},shadows:{...e.palette.shadows,...(i=a==null?void 0:a.palette)==null?void 0:i.shadows},borders:{...e.palette.borders,...(h=a==null?void 0:a.palette)==null?void 0:h.borders},radius:{...e.palette.radius,...(g=a==null?void 0:a.palette)==null?void 0:g.radius}},semantic:{...e.semantic,...a==null?void 0:a.semantic,colors:{...e.semantic.colors,...(m=a==null?void 0:a.semantic)==null?void 0:m.colors,interactive:{...e.semantic.colors.interactive,...(n=(f=a==null?void 0:a.semantic)==null?void 0:f.colors)==null?void 0:n.interactive},feedback:{...e.semantic.colors.feedback,...(x=(p=a==null?void 0:a.semantic)==null?void 0:p.colors)==null?void 0:x.feedback}},spacing:{...e.semantic.spacing,...(M=a==null?void 0:a.semantic)==null?void 0:M.spacing},typography:{...e.semantic.typography,...(A=a==null?void 0:a.semantic)==null?void 0:A.typography}},components:ir(e.components,a==null?void 0:a.components)};if(o.validate!==!1){let b=ur(s);if(!b.valid)throw new Error(`Theme validation failed: ${b.errors.map(T=>T.message).join(", ")}`)}if(o.plugins)for(let b of o.plugins)s=b.transform(s);return s}function Qt(a){var M,A,b,T,P,B,L,C,y,F,R,D,H,S,w,q,U,E,c,v,k,O,I,W,V,z,G,lo,fo,po,no,uo,io,mo,co,xo,ho,go,bo,Co,yo,So,wo,ko,Mo,Ao,vo,To,Po,Bo,Lo,Fo,Ro,Do,Ho,qo,Uo,Eo,Io,Oo,Wo,Vo,zo,Go,No,Xo,_o,Ko,Zo,jo,Qo,Jo,Yo,$o,et,at,ot,tt,rt,st,lt,ft,dt,pt,nt,ut,it,mt,ct,xt,ht,gt,bt,Ct,yt,St,wt,kt,Mt,At,vt,Tt,Pt,Bt,Lt,Ft,Rt,Dt,Ht,qt,Ut,Et,It,Ot,Wt,Vt;let o=Zt(a),e={};for(let[t,te]of Object.entries(o)){let $t=t.replace(/\./g,"-");e[`--persona-${$t}`]=te.value}e["--persona-primary"]=(M=e["--persona-semantic-colors-primary"])!=null?M:e["--persona-palette-colors-primary-500"],e["--persona-secondary"]=(A=e["--persona-semantic-colors-secondary"])!=null?A:e["--persona-palette-colors-secondary-500"],e["--persona-accent"]=(b=e["--persona-semantic-colors-accent"])!=null?b:e["--persona-palette-colors-accent-500"],e["--persona-surface"]=(T=e["--persona-semantic-colors-surface"])!=null?T:e["--persona-palette-colors-gray-50"],e["--persona-background"]=(P=e["--persona-semantic-colors-background"])!=null?P:e["--persona-palette-colors-gray-50"],e["--persona-container"]=(B=e["--persona-semantic-colors-container"])!=null?B:e["--persona-palette-colors-gray-100"],e["--persona-text"]=(L=e["--persona-semantic-colors-text"])!=null?L:e["--persona-palette-colors-gray-900"],e["--persona-text-muted"]=(C=e["--persona-semantic-colors-text-muted"])!=null?C:e["--persona-palette-colors-gray-500"],e["--persona-text-inverse"]=(y=e["--persona-semantic-colors-text-inverse"])!=null?y:e["--persona-palette-colors-gray-50"],e["--persona-border"]=(F=e["--persona-semantic-colors-border"])!=null?F:e["--persona-palette-colors-gray-200"],e["--persona-divider"]=(R=e["--persona-semantic-colors-divider"])!=null?R:e["--persona-palette-colors-gray-200"],e["--persona-muted"]=e["--persona-text-muted"],e["--persona-voice-recording-indicator"]=(D=e["--persona-components-voice-recording-indicator"])!=null?D:e["--persona-palette-colors-error-500"],e["--persona-voice-recording-bg"]=(H=e["--persona-components-voice-recording-background"])!=null?H:e["--persona-palette-colors-error-50"],e["--persona-voice-processing-icon"]=(S=e["--persona-components-voice-processing-icon"])!=null?S:e["--persona-palette-colors-primary-500"],e["--persona-voice-speaking-icon"]=(w=e["--persona-components-voice-speaking-icon"])!=null?w:e["--persona-palette-colors-success-500"],e["--persona-approval-bg"]=(q=e["--persona-components-approval-requested-background"])!=null?q:e["--persona-palette-colors-warning-50"],e["--persona-approval-border"]=(U=e["--persona-components-approval-requested-border"])!=null?U:e["--persona-palette-colors-warning-200"],e["--persona-approval-text"]=(E=e["--persona-components-approval-requested-text"])!=null?E:e["--persona-palette-colors-gray-900"],e["--persona-approval-approve-bg"]=(c=e["--persona-components-approval-approve-background"])!=null?c:e["--persona-palette-colors-success-500"],e["--persona-approval-deny-bg"]=(v=e["--persona-components-approval-deny-background"])!=null?v:e["--persona-palette-colors-error-500"],e["--persona-attachment-image-bg"]=(k=e["--persona-components-attachment-image-background"])!=null?k:e["--persona-palette-colors-gray-100"],e["--persona-attachment-image-border"]=(O=e["--persona-components-attachment-image-border"])!=null?O:e["--persona-palette-colors-gray-200"],e["--persona-font-family"]=(I=e["--persona-semantic-typography-fontFamily"])!=null?I:e["--persona-palette-typography-fontFamily-sans"],e["--persona-font-size"]=(W=e["--persona-semantic-typography-fontSize"])!=null?W:e["--persona-palette-typography-fontSize-base"],e["--persona-font-weight"]=(V=e["--persona-semantic-typography-fontWeight"])!=null?V:e["--persona-palette-typography-fontWeight-normal"],e["--persona-line-height"]=(z=e["--persona-semantic-typography-lineHeight"])!=null?z:e["--persona-palette-typography-lineHeight-normal"],e["--persona-input-font-family"]=e["--persona-font-family"],e["--persona-input-font-weight"]=e["--persona-font-weight"],e["--persona-radius-sm"]=(G=e["--persona-palette-radius-sm"])!=null?G:"0.125rem",e["--persona-radius-md"]=(lo=e["--persona-palette-radius-md"])!=null?lo:"0.375rem",e["--persona-radius-lg"]=(fo=e["--persona-palette-radius-lg"])!=null?fo:"0.5rem",e["--persona-radius-xl"]=(po=e["--persona-palette-radius-xl"])!=null?po:"0.75rem",e["--persona-radius-full"]=(no=e["--persona-palette-radius-full"])!=null?no:"9999px",e["--persona-launcher-radius"]=(io=(uo=e["--persona-components-launcher-borderRadius"])!=null?uo:e["--persona-palette-radius-full"])!=null?io:"9999px",e["--persona-launcher-bg"]=(mo=e["--persona-components-launcher-background"])!=null?mo:e["--persona-primary"],e["--persona-launcher-fg"]=(co=e["--persona-components-launcher-foreground"])!=null?co:e["--persona-text-inverse"],e["--persona-launcher-border"]=(xo=e["--persona-components-launcher-border"])!=null?xo:e["--persona-border"],e["--persona-button-primary-bg"]=(ho=e["--persona-components-button-primary-background"])!=null?ho:e["--persona-primary"],e["--persona-button-primary-fg"]=(go=e["--persona-components-button-primary-foreground"])!=null?go:e["--persona-text-inverse"],e["--persona-button-radius"]=(Co=(bo=e["--persona-components-button-primary-borderRadius"])!=null?bo:e["--persona-palette-radius-full"])!=null?Co:"9999px",e["--persona-panel-radius"]=(So=(yo=e["--persona-components-panel-borderRadius"])!=null?yo:e["--persona-radius-xl"])!=null?So:"0.75rem",e["--persona-panel-border"]=(wo=e["--persona-components-panel-border"])!=null?wo:`1px solid ${e["--persona-border"]}`,e["--persona-panel-shadow"]=(Mo=(ko=e["--persona-components-panel-shadow"])!=null?ko:e["--persona-palette-shadows-xl"])!=null?Mo:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",e["--persona-input-radius"]=(vo=(Ao=e["--persona-components-input-borderRadius"])!=null?Ao:e["--persona-radius-lg"])!=null?vo:"0.5rem",e["--persona-message-user-radius"]=(Po=(To=e["--persona-components-message-user-borderRadius"])!=null?To:e["--persona-radius-lg"])!=null?Po:"0.5rem",e["--persona-message-assistant-radius"]=(Lo=(Bo=e["--persona-components-message-assistant-borderRadius"])!=null?Bo:e["--persona-radius-lg"])!=null?Lo:"0.5rem",e["--persona-header-bg"]=(Fo=e["--persona-components-header-background"])!=null?Fo:e["--persona-surface"],e["--persona-header-border"]=(Ro=e["--persona-components-header-border"])!=null?Ro:e["--persona-divider"],e["--persona-header-icon-bg"]=(Do=e["--persona-components-header-iconBackground"])!=null?Do:e["--persona-primary"],e["--persona-header-icon-fg"]=(Ho=e["--persona-components-header-iconForeground"])!=null?Ho:e["--persona-text-inverse"],e["--persona-header-title-fg"]=(qo=e["--persona-components-header-titleForeground"])!=null?qo:e["--persona-primary"],e["--persona-header-subtitle-fg"]=(Uo=e["--persona-components-header-subtitleForeground"])!=null?Uo:e["--persona-text-muted"],e["--persona-header-action-icon-fg"]=(Eo=e["--persona-components-header-actionIconForeground"])!=null?Eo:e["--persona-muted"];let s=(Io=a.components)==null?void 0:Io.header;s!=null&&s.shadow&&(e["--persona-header-shadow"]=s.shadow),s!=null&&s.borderBottom&&(e["--persona-header-border-bottom"]=s.borderBottom);let r=(Oo=a.components)==null?void 0:Oo.introCard;e["--persona-intro-card-bg"]=(Wo=e["--persona-components-introCard-background"])!=null?Wo:e["--persona-surface"],e["--persona-intro-card-radius"]=(Vo=e["--persona-components-introCard-borderRadius"])!=null?Vo:"1rem",e["--persona-intro-card-padding"]=(zo=e["--persona-components-introCard-padding"])!=null?zo:"1.5rem",e["--persona-intro-card-shadow"]=(No=(Go=r==null?void 0:r.shadow)!=null?Go:e["--persona-components-introCard-shadow"])!=null?No:"0 5px 15px rgba(15, 23, 42, 0.08)",e["--persona-input-background"]=(Xo=e["--persona-components-input-background"])!=null?Xo:e["--persona-surface"],e["--persona-input-placeholder"]=(_o=e["--persona-components-input-placeholder"])!=null?_o:e["--persona-text-muted"],e["--persona-message-user-bg"]=(Ko=e["--persona-components-message-user-background"])!=null?Ko:e["--persona-accent"],e["--persona-message-user-text"]=(Zo=e["--persona-components-message-user-text"])!=null?Zo:e["--persona-text-inverse"],e["--persona-message-user-shadow"]=(jo=e["--persona-components-message-user-shadow"])!=null?jo:"0 5px 15px rgba(15, 23, 42, 0.08)",e["--persona-message-assistant-bg"]=(Qo=e["--persona-components-message-assistant-background"])!=null?Qo:e["--persona-surface"],e["--persona-message-assistant-text"]=(Jo=e["--persona-components-message-assistant-text"])!=null?Jo:e["--persona-text"],e["--persona-message-assistant-border"]=(Yo=e["--persona-components-message-assistant-border"])!=null?Yo:e["--persona-border"],e["--persona-message-assistant-shadow"]=($o=e["--persona-components-message-assistant-shadow"])!=null?$o:"0 1px 2px 0 rgb(0 0 0 / 0.05)",e["--persona-scroll-to-bottom-bg"]=(at=(et=e["--persona-components-scrollToBottom-background"])!=null?et:e["--persona-button-primary-bg"])!=null?at:e["--persona-accent"],e["--persona-scroll-to-bottom-fg"]=(tt=(ot=e["--persona-components-scrollToBottom-foreground"])!=null?ot:e["--persona-button-primary-fg"])!=null?tt:e["--persona-text-inverse"],e["--persona-scroll-to-bottom-border"]=(rt=e["--persona-components-scrollToBottom-border"])!=null?rt:e["--persona-primary"],e["--persona-scroll-to-bottom-size"]=(st=e["--persona-components-scrollToBottom-size"])!=null?st:"40px",e["--persona-scroll-to-bottom-radius"]=(dt=(ft=(lt=e["--persona-components-scrollToBottom-borderRadius"])!=null?lt:e["--persona-button-radius"])!=null?ft:e["--persona-radius-full"])!=null?dt:"9999px",e["--persona-scroll-to-bottom-shadow"]=(nt=(pt=e["--persona-components-scrollToBottom-shadow"])!=null?pt:e["--persona-palette-shadows-sm"])!=null?nt:"0 1px 2px 0 rgb(0 0 0 / 0.05)",e["--persona-scroll-to-bottom-padding"]=(ut=e["--persona-components-scrollToBottom-padding"])!=null?ut:"0.5rem 0.875rem",e["--persona-scroll-to-bottom-gap"]=(it=e["--persona-components-scrollToBottom-gap"])!=null?it:"0.5rem",e["--persona-scroll-to-bottom-font-size"]=(ct=(mt=e["--persona-components-scrollToBottom-fontSize"])!=null?mt:e["--persona-palette-typography-fontSize-sm"])!=null?ct:"0.875rem",e["--persona-scroll-to-bottom-icon-size"]=(xt=e["--persona-components-scrollToBottom-iconSize"])!=null?xt:"14px",e["--persona-tool-bubble-shadow"]=(ht=e["--persona-components-toolBubble-shadow"])!=null?ht:"0 5px 15px rgba(15, 23, 42, 0.08)",e["--persona-reasoning-bubble-shadow"]=(gt=e["--persona-components-reasoningBubble-shadow"])!=null?gt:"0 5px 15px rgba(15, 23, 42, 0.08)",e["--persona-composer-shadow"]=(bt=e["--persona-components-composer-shadow"])!=null?bt:"none",e["--persona-md-inline-code-bg"]=(Ct=e["--persona-components-markdown-inlineCode-background"])!=null?Ct:e["--persona-container"],e["--persona-md-inline-code-color"]=(yt=e["--persona-components-markdown-inlineCode-foreground"])!=null?yt:e["--persona-text"],e["--persona-md-link-color"]=(wt=(St=e["--persona-components-markdown-link-foreground"])!=null?St:e["--persona-accent"])!=null?wt:"#0f0f0f";let d=e["--persona-components-markdown-heading-h1-fontSize"];d&&(e["--persona-md-h1-size"]=d);let l=e["--persona-components-markdown-heading-h1-fontWeight"];l&&(e["--persona-md-h1-weight"]=l);let i=e["--persona-components-markdown-heading-h2-fontSize"];i&&(e["--persona-md-h2-size"]=i);let h=e["--persona-components-markdown-heading-h2-fontWeight"];h&&(e["--persona-md-h2-weight"]=h);let g=e["--persona-components-markdown-prose-fontFamily"];g&&g!=="inherit"&&(e["--persona-md-prose-font-family"]=g),e["--persona-md-code-block-bg"]=(kt=e["--persona-components-markdown-codeBlock-background"])!=null?kt:e["--persona-container"],e["--persona-md-code-block-border-color"]=(Mt=e["--persona-components-markdown-codeBlock-borderColor"])!=null?Mt:e["--persona-border"],e["--persona-md-code-block-text-color"]=(At=e["--persona-components-markdown-codeBlock-textColor"])!=null?At:"inherit",e["--persona-md-table-header-bg"]=(vt=e["--persona-components-markdown-table-headerBackground"])!=null?vt:e["--persona-container"],e["--persona-md-table-border-color"]=(Tt=e["--persona-components-markdown-table-borderColor"])!=null?Tt:e["--persona-border"],e["--persona-md-hr-color"]=(Pt=e["--persona-components-markdown-hr-color"])!=null?Pt:e["--persona-divider"],e["--persona-md-blockquote-border-color"]=(Bt=e["--persona-components-markdown-blockquote-borderColor"])!=null?Bt:e["--persona-palette-colors-gray-900"],e["--persona-md-blockquote-bg"]=(Lt=e["--persona-components-markdown-blockquote-background"])!=null?Lt:"transparent",e["--persona-md-blockquote-text-color"]=(Ft=e["--persona-components-markdown-blockquote-textColor"])!=null?Ft:e["--persona-palette-colors-gray-500"],e["--cw-container"]=(Rt=e["--persona-components-collapsibleWidget-container"])!=null?Rt:e["--persona-surface"],e["--cw-surface"]=(Dt=e["--persona-components-collapsibleWidget-surface"])!=null?Dt:e["--persona-surface"],e["--cw-border"]=(Ht=e["--persona-components-collapsibleWidget-border"])!=null?Ht:e["--persona-border"],e["--persona-message-border"]=(qt=e["--persona-components-message-border"])!=null?qt:e["--persona-border"];let m=a.components,f=m==null?void 0:m.iconButton;f&&(f.background&&(e["--persona-icon-btn-bg"]=f.background),f.border&&(e["--persona-icon-btn-border"]=f.border),f.color&&(e["--persona-icon-btn-color"]=f.color),f.padding&&(e["--persona-icon-btn-padding"]=f.padding),f.borderRadius&&(e["--persona-icon-btn-radius"]=f.borderRadius),f.hoverBackground&&(e["--persona-icon-btn-hover-bg"]=f.hoverBackground),f.hoverColor&&(e["--persona-icon-btn-hover-color"]=f.hoverColor),f.activeBackground&&(e["--persona-icon-btn-active-bg"]=f.activeBackground),f.activeBorder&&(e["--persona-icon-btn-active-border"]=f.activeBorder));let n=m==null?void 0:m.labelButton;n&&(n.background&&(e["--persona-label-btn-bg"]=n.background),n.border&&(e["--persona-label-btn-border"]=n.border),n.color&&(e["--persona-label-btn-color"]=n.color),n.padding&&(e["--persona-label-btn-padding"]=n.padding),n.borderRadius&&(e["--persona-label-btn-radius"]=n.borderRadius),n.hoverBackground&&(e["--persona-label-btn-hover-bg"]=n.hoverBackground),n.fontSize&&(e["--persona-label-btn-font-size"]=n.fontSize),n.gap&&(e["--persona-label-btn-gap"]=n.gap));let p=m==null?void 0:m.toggleGroup;p&&(p.gap&&(e["--persona-toggle-group-gap"]=p.gap),p.borderRadius&&(e["--persona-toggle-group-radius"]=p.borderRadius));let x=m==null?void 0:m.artifact;if(x!=null&&x.toolbar){let t=x.toolbar;t.iconHoverColor&&(e["--persona-artifact-toolbar-icon-hover-color"]=t.iconHoverColor),t.iconHoverBackground&&(e["--persona-artifact-toolbar-icon-hover-bg"]=t.iconHoverBackground),t.iconPadding&&(e["--persona-artifact-toolbar-icon-padding"]=t.iconPadding),t.iconBorderRadius&&(e["--persona-artifact-toolbar-icon-radius"]=t.iconBorderRadius),t.iconBorder&&(e["--persona-artifact-toolbar-icon-border"]=t.iconBorder),t.toggleGroupGap&&(e["--persona-artifact-toolbar-toggle-group-gap"]=t.toggleGroupGap),t.toggleBorderRadius&&(e["--persona-artifact-toolbar-toggle-radius"]=t.toggleBorderRadius),t.copyBackground&&(e["--persona-artifact-toolbar-copy-bg"]=t.copyBackground),t.copyBorder&&(e["--persona-artifact-toolbar-copy-border"]=t.copyBorder),t.copyColor&&(e["--persona-artifact-toolbar-copy-color"]=t.copyColor),t.copyBorderRadius&&(e["--persona-artifact-toolbar-copy-radius"]=t.copyBorderRadius),t.copyPadding&&(e["--persona-artifact-toolbar-copy-padding"]=t.copyPadding),t.copyMenuBackground&&(e["--persona-artifact-toolbar-copy-menu-bg"]=t.copyMenuBackground,e["--persona-dropdown-bg"]=(Ut=e["--persona-dropdown-bg"])!=null?Ut:t.copyMenuBackground),t.copyMenuBorder&&(e["--persona-artifact-toolbar-copy-menu-border"]=t.copyMenuBorder,e["--persona-dropdown-border"]=(Et=e["--persona-dropdown-border"])!=null?Et:t.copyMenuBorder),t.copyMenuShadow&&(e["--persona-artifact-toolbar-copy-menu-shadow"]=t.copyMenuShadow,e["--persona-dropdown-shadow"]=(It=e["--persona-dropdown-shadow"])!=null?It:t.copyMenuShadow),t.copyMenuBorderRadius&&(e["--persona-artifact-toolbar-copy-menu-radius"]=t.copyMenuBorderRadius,e["--persona-dropdown-radius"]=(Ot=e["--persona-dropdown-radius"])!=null?Ot:t.copyMenuBorderRadius),t.copyMenuItemHoverBackground&&(e["--persona-artifact-toolbar-copy-menu-item-hover-bg"]=t.copyMenuItemHoverBackground,e["--persona-dropdown-item-hover-bg"]=(Wt=e["--persona-dropdown-item-hover-bg"])!=null?Wt:t.copyMenuItemHoverBackground),t.iconBackground&&(e["--persona-artifact-toolbar-icon-bg"]=t.iconBackground),t.toolbarBorder&&(e["--persona-artifact-toolbar-border"]=t.toolbarBorder)}if(x!=null&&x.tab){let t=x.tab;t.background&&(e["--persona-artifact-tab-bg"]=t.background),t.activeBackground&&(e["--persona-artifact-tab-active-bg"]=t.activeBackground),t.activeBorder&&(e["--persona-artifact-tab-active-border"]=t.activeBorder),t.borderRadius&&(e["--persona-artifact-tab-radius"]=t.borderRadius),t.textColor&&(e["--persona-artifact-tab-color"]=t.textColor),t.hoverBackground&&(e["--persona-artifact-tab-hover-bg"]=t.hoverBackground),t.listBackground&&(e["--persona-artifact-tab-list-bg"]=t.listBackground),t.listBorderColor&&(e["--persona-artifact-tab-list-border-color"]=t.listBorderColor),t.listPadding&&(e["--persona-artifact-tab-list-padding"]=t.listPadding)}if(x!=null&&x.pane){let t=x.pane;if(t.toolbarBackground){let te=(Vt=ro(a,t.toolbarBackground))!=null?Vt:t.toolbarBackground;e["--persona-artifact-toolbar-bg"]=te}}return e}var mr={colors:{primary:{50:"#ffffff",100:"#f5f5f5",200:"#d4d4d4",300:"#a3a3a3",400:"#737373",500:"#171717",600:"#0f0f0f",700:"#0a0a0a",800:"#050505",900:"#030303",950:"#000000"},secondary:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},accent:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},success:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d"},warning:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12"},error:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d"}}},Jt=a=>{if(!(!a||typeof a!="object"||Array.isArray(a)))return a},cr=()=>{var a;return typeof document!="undefined"&&document.documentElement.classList.contains("dark")||typeof window!="undefined"&&((a=window.matchMedia)!=null&&a.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light"},xr=a=>{var e;let o=(e=a==null?void 0:a.colorScheme)!=null?e:"light";return o==="light"?"light":o==="dark"?"dark":cr()},hr=a=>xr(a),gr=a=>oe(a),br=a=>{var e;let o=oe(void 0,{validate:!1});return oe({...a,palette:{...o.palette,colors:{...mr.colors,...(e=a==null?void 0:a.palette)==null?void 0:e.colors}}},{validate:!1})},Cr=a=>{let o=hr(a),e=Jt(a==null?void 0:a.theme),s=Jt(a==null?void 0:a.darkTheme);return o==="dark"?br(N(e!=null?e:{},s!=null?s:{})):gr(e)},yr=a=>Qt(a),so=(a,o)=>{var d;let e=Cr(o),s=yr(e);for(let[l,i]of Object.entries(s))a.style.setProperty(l,i);let r=(d=o==null?void 0:o.toolCall)==null?void 0:d.shadow;r!==void 0&&a.style.setProperty("--persona-tool-bubble-shadow",r.trim()===""?"none":r)};var Yt="data-persona-launcher-critical",Sr=a=>{if(a instanceof HTMLElement)return a;if(typeof a=="string"){let o=document.querySelector(a);if(o)return o}return document.body},wr=a=>{if(typeof window=="undefined"||typeof document=="undefined")throw new Error("AgentWidgetLauncher can only be mounted in a browser environment");let{onOpen:o}=a,e=Sr(a.target),s=to(a.config),r=document.createElement("div");r.setAttribute("data-persona-root","true"),r.setAttribute(Yt,"true"),so(r,s);let d=Nt(s,o);return r.appendChild(d.element),e.appendChild(r),{root:r,element:d.element,update:l=>{let i=to(l);so(r,i),d.update(i)},destroy:()=>{d.destroy(),r.remove()}}};return sr(kr);})();
10
+ /*! Bundled license information:
11
+
12
+ lucide/dist/esm/icons/activity.js:
13
+ lucide/dist/esm/icons/arrow-down.js:
14
+ lucide/dist/esm/icons/arrow-left.js:
15
+ lucide/dist/esm/icons/arrow-right.js:
16
+ lucide/dist/esm/icons/arrow-up-right.js:
17
+ lucide/dist/esm/icons/arrow-up.js:
18
+ lucide/dist/esm/icons/at-sign.js:
19
+ lucide/dist/esm/icons/ban.js:
20
+ lucide/dist/esm/icons/bell.js:
21
+ lucide/dist/esm/icons/bookmark.js:
22
+ lucide/dist/esm/icons/bot.js:
23
+ lucide/dist/esm/icons/building.js:
24
+ lucide/dist/esm/icons/calendar-days.js:
25
+ lucide/dist/esm/icons/calendar.js:
26
+ lucide/dist/esm/icons/camera.js:
27
+ lucide/dist/esm/icons/check.js:
28
+ lucide/dist/esm/icons/chevron-down.js:
29
+ lucide/dist/esm/icons/chevron-left.js:
30
+ lucide/dist/esm/icons/chevron-right.js:
31
+ lucide/dist/esm/icons/chevron-up.js:
32
+ lucide/dist/esm/icons/circle-check.js:
33
+ lucide/dist/esm/icons/circle-x.js:
34
+ lucide/dist/esm/icons/clipboard-copy.js:
35
+ lucide/dist/esm/icons/clipboard.js:
36
+ lucide/dist/esm/icons/clock.js:
37
+ lucide/dist/esm/icons/copy.js:
38
+ lucide/dist/esm/icons/credit-card.js:
39
+ lucide/dist/esm/icons/dollar-sign.js:
40
+ lucide/dist/esm/icons/download.js:
41
+ lucide/dist/esm/icons/ellipsis-vertical.js:
42
+ lucide/dist/esm/icons/ellipsis.js:
43
+ lucide/dist/esm/icons/external-link.js:
44
+ lucide/dist/esm/icons/eye-off.js:
45
+ lucide/dist/esm/icons/eye.js:
46
+ lucide/dist/esm/icons/file-code.js:
47
+ lucide/dist/esm/icons/file-spreadsheet.js:
48
+ lucide/dist/esm/icons/file-text.js:
49
+ lucide/dist/esm/icons/file.js:
50
+ lucide/dist/esm/icons/files.js:
51
+ lucide/dist/esm/icons/film.js:
52
+ lucide/dist/esm/icons/flag.js:
53
+ lucide/dist/esm/icons/folder-open.js:
54
+ lucide/dist/esm/icons/folder.js:
55
+ lucide/dist/esm/icons/funnel.js:
56
+ lucide/dist/esm/icons/gift.js:
57
+ lucide/dist/esm/icons/globe.js:
58
+ lucide/dist/esm/icons/hash.js:
59
+ lucide/dist/esm/icons/headphones.js:
60
+ lucide/dist/esm/icons/heart.js:
61
+ lucide/dist/esm/icons/history.js:
62
+ lucide/dist/esm/icons/house.js:
63
+ lucide/dist/esm/icons/image-plus.js:
64
+ lucide/dist/esm/icons/image.js:
65
+ lucide/dist/esm/icons/info.js:
66
+ lucide/dist/esm/icons/key.js:
67
+ lucide/dist/esm/icons/link.js:
68
+ lucide/dist/esm/icons/loader-circle.js:
69
+ lucide/dist/esm/icons/loader.js:
70
+ lucide/dist/esm/icons/lock.js:
71
+ lucide/dist/esm/icons/mail.js:
72
+ lucide/dist/esm/icons/map-pin.js:
73
+ lucide/dist/esm/icons/maximize.js:
74
+ lucide/dist/esm/icons/menu.js:
75
+ lucide/dist/esm/icons/message-circle.js:
76
+ lucide/dist/esm/icons/message-square.js:
77
+ lucide/dist/esm/icons/mic.js:
78
+ lucide/dist/esm/icons/minimize.js:
79
+ lucide/dist/esm/icons/minus.js:
80
+ lucide/dist/esm/icons/monitor.js:
81
+ lucide/dist/esm/icons/moon.js:
82
+ lucide/dist/esm/icons/package.js:
83
+ lucide/dist/esm/icons/paperclip.js:
84
+ lucide/dist/esm/icons/pause.js:
85
+ lucide/dist/esm/icons/pencil.js:
86
+ lucide/dist/esm/icons/percent.js:
87
+ lucide/dist/esm/icons/phone.js:
88
+ lucide/dist/esm/icons/play.js:
89
+ lucide/dist/esm/icons/plus.js:
90
+ lucide/dist/esm/icons/receipt.js:
91
+ lucide/dist/esm/icons/refresh-cw.js:
92
+ lucide/dist/esm/icons/rotate-cw.js:
93
+ lucide/dist/esm/icons/save.js:
94
+ lucide/dist/esm/icons/search.js:
95
+ lucide/dist/esm/icons/send.js:
96
+ lucide/dist/esm/icons/settings.js:
97
+ lucide/dist/esm/icons/share.js:
98
+ lucide/dist/esm/icons/shield-alert.js:
99
+ lucide/dist/esm/icons/shield-check.js:
100
+ lucide/dist/esm/icons/shield-x.js:
101
+ lucide/dist/esm/icons/shield.js:
102
+ lucide/dist/esm/icons/shopping-bag.js:
103
+ lucide/dist/esm/icons/shopping-cart.js:
104
+ lucide/dist/esm/icons/smartphone.js:
105
+ lucide/dist/esm/icons/sparkles.js:
106
+ lucide/dist/esm/icons/square.js:
107
+ lucide/dist/esm/icons/star.js:
108
+ lucide/dist/esm/icons/store.js:
109
+ lucide/dist/esm/icons/sun.js:
110
+ lucide/dist/esm/icons/tag.js:
111
+ lucide/dist/esm/icons/thumbs-down.js:
112
+ lucide/dist/esm/icons/thumbs-up.js:
113
+ lucide/dist/esm/icons/timer.js:
114
+ lucide/dist/esm/icons/trash-2.js:
115
+ lucide/dist/esm/icons/trash.js:
116
+ lucide/dist/esm/icons/triangle-alert.js:
117
+ lucide/dist/esm/icons/truck.js:
118
+ lucide/dist/esm/icons/upload.js:
119
+ lucide/dist/esm/icons/user.js:
120
+ lucide/dist/esm/icons/volume-2.js:
121
+ lucide/dist/esm/icons/volume-x.js:
122
+ lucide/dist/esm/icons/wallet.js:
123
+ lucide/dist/esm/icons/x.js:
124
+ lucide/dist/esm/icons/zap.js:
125
+ lucide/dist/esm/lucide.js:
126
+ (**
127
+ * @license lucide v0.552.0 - ISC
128
+ *
129
+ * This source code is licensed under the ISC license.
130
+ * See the LICENSE file in the root directory of this source tree.
131
+ *)
132
+ */
133
+ //# sourceMappingURL=launcher-global.global.js.map