blueeyebot-widget 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 The BlueEyeBot Authors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,193 @@
1
+ # BlueEyeBot
2
+
3
+ `blueeyebot-widget` β€” a configurable, embeddable chatbot
4
+ **Web Component**. Drop it into any existing webapp β€” React, Vue, Angular, or
5
+ plain HTML. It renders inside its own **Shadow DOM**, so the host page's CSS
6
+ can't break the widget and vice versa.
7
+
8
+ - 🎨 Themeable via attributes or CSS custom properties
9
+ - πŸ”Œ Point it at any backend URL (no rebuild)
10
+ - πŸ–₯️ Built-in **widescreen** mode to browse history full-screen
11
+ - 🧩 Framework-agnostic custom element + optional React wrapper
12
+ - πŸͺΆ Tiny β€” Preact is bundled in; React is only needed if you use the React wrapper
13
+
14
+ ## Install
15
+
16
+ This package is published to the **public npm registry** β€” no registry config
17
+ or auth token required:
18
+
19
+ ```bash
20
+ npm i blueeyebot-widget
21
+ ```
22
+
23
+ ### React
24
+
25
+ ```tsx
26
+ import { BlueEyeBot } from "blueeyebot-widget/react";
27
+
28
+ <BlueEyeBot
29
+ apiUrl="https://api.example.com/dev"
30
+ enableHistory
31
+ headers={{ Authorization: `Bearer ${token}` }}
32
+ />;
33
+ ```
34
+
35
+ ### Plain JS / custom element
36
+
37
+ ```js
38
+ import { init } from "blueeyebot-widget";
39
+
40
+ init({ apiUrl: "https://api.example.com/dev", primaryColor: "#0ea5e9" });
41
+ ```
42
+
43
+ …or use the element directly after importing the package once (the import
44
+ registers `<blue-eye-bot>`):
45
+
46
+ ```js
47
+ import "blueeyebot-widget";
48
+ ```
49
+
50
+ ```html
51
+ <blue-eye-bot api-url="https://api.example.com/dev"></blue-eye-bot>
52
+ ```
53
+
54
+ ### Vue / Angular
55
+
56
+ Use the custom element directly. Import the package once at startup and add
57
+ `<blue-eye-bot>` to a template. (Tell Vue/Angular to treat `blue-eye-bot` as a
58
+ custom element: Vue `compilerOptions.isCustomElement`, Angular
59
+ `CUSTOM_ELEMENTS_SCHEMA`.)
60
+
61
+ ### Script tag (CDN)
62
+
63
+ Because the package is on the public npm registry, the bundled IIFE build is
64
+ served by CDNs like unpkg and jsDelivr β€” no build step or hosting needed:
65
+
66
+ ```html
67
+ <script src="https://unpkg.com/blueeyebot-widget/dist/blueeyebot.iife.js"></script>
68
+ <blue-eye-bot api-url="https://api.example.com/dev" primary-color="#0ea5e9"></blue-eye-bot>
69
+ <!-- or: <script>BlueEyeBot.init({ apiUrl: "https://api.example.com/dev" })</script> -->
70
+ ```
71
+
72
+ > Pin a version for production (e.g. `unpkg.com/blueeyebot-widget@0.1.4/...`)
73
+ > so an upstream release can't change your embed unexpectedly.
74
+
75
+ ## Publishing (maintainers)
76
+
77
+ Published to the public npm registry. You need an npm account with publish
78
+ rights to the `blueeyebot-widget` package.
79
+
80
+ ```bash
81
+ cd chat-widget
82
+ npm login # one-time, per machine
83
+ npm version patch # bump version
84
+ npm publish # prepublishOnly runs the build
85
+ ```
86
+
87
+ ## Configuration
88
+
89
+ Every option can be set as an **HTML attribute** (kebab-case), via
90
+ **`init()` / the element's `config` property**, or as a **React prop**
91
+ (camelCase). `apiUrl` is the only required field.
92
+
93
+ | Prop (camelCase) | Attribute | Default | Description |
94
+ | --- | --- | --- | --- |
95
+ | `apiUrl` **(required)** | `api-url` | β€” | Backend base URL. Calls `/chat`, `/history`, `/sync`. |
96
+ | `title` | `title` | `"BlueEyeBot"` | Header label. |
97
+ | `welcomeMessage` | `welcome-message` | default greeting | First assistant message. |
98
+ | `placeholder` | `placeholder` | `"Type your question..."` | Input placeholder. |
99
+ | `userRole` | `user-role` | `"student/vizitator"` | Static fallback role sent as `user_role` in `/chat`. |
100
+ | `getUserRole` | _(JS/React only)_ | β€” | `() => string \| Promise<string>` resolved before each request (see below). |
101
+ | `position` | `position` | `"bottom-right"` | `bottom-right` or `bottom-left`. |
102
+ | `defaultOpen` | `default-open` | `false` | Open the panel on load. |
103
+ | `enableHistory` | `enable-history` | `false` | Show history panel + persist sessions. |
104
+ | `enableSync` | `enable-sync` | `false` | Show "Sync Docs" button + sync on init. |
105
+ | `allowFullscreen` | `allow-fullscreen` | `true` | Show the widescreen/maximize button. |
106
+ | `maxMessageLength` | `max-message-length` | `2000` | Input character cap. |
107
+ | `headers` | _(JS/React only)_ | `{}` | Extra request headers (e.g. auth token). |
108
+ | `zIndex` | `z-index` | `9999` | Stacking order. |
109
+ | `primaryColor` | `primary-color` | `#6366f1` | Gradient start. |
110
+ | `secondaryColor` | `secondary-color` | `#8b5cf6` | Gradient end. |
111
+ | `fontFamily` | `font-family` | system stack | Widget font. |
112
+
113
+ > Boolean attributes are **on** when present (e.g. `enable-history`); set
114
+ > `enable-history="false"` to force off.
115
+
116
+ ## Dynamic roles per host app
117
+
118
+ Each host app has its own role vocabulary, and the logged-in user's role can
119
+ change at runtime. Instead of hard-coding `userRole`, pass a **`getUserRole`**
120
+ resolver β€” the widget calls it right before every `/chat` request, so the role
121
+ always reflects the host's current auth state (no manual updates needed). It can
122
+ be sync or async:
123
+
124
+ ```tsx
125
+ // React
126
+ <BlueEyeBot
127
+ apiUrl="https://api.example.com/dev"
128
+ getUserRole={() => authStore.getState().user?.role ?? "guest"}
129
+ />
130
+ ```
131
+
132
+ ```js
133
+ // JS / script-tag
134
+ const bot = BlueEyeBot.init({ apiUrl: "https://api.example.com/dev" });
135
+ bot.config = {
136
+ apiUrl: "https://api.example.com/dev",
137
+ getUserRole: async () => (await getSession()).role, // re-read on each message
138
+ };
139
+ ```
140
+
141
+ If `getUserRole` is omitted it falls back to the static `userRole`; if it
142
+ throws/rejects, the widget also falls back to `userRole`.
143
+
144
+ > ⚠️ **Security follow-up:** a role set in the browser can be tampered with. For
145
+ > tamper-proof access control, send a verified auth token via `headers` (e.g.
146
+ > `{ Authorization: "Bearer <token>" }`) and have the **backend derive the role
147
+ > from that token** server-side, rather than trusting the `user_role` field in the
148
+ > request body. The `getUserRole` callback is the right UX hook; the token +
149
+ > server-side check is what makes it trustworthy.
150
+
151
+ ## Theming with CSS variables
152
+
153
+ For finer control, override the `--cw-*` custom properties on the element:
154
+
155
+ ```css
156
+ blue-eye-bot {
157
+ --cw-primary: #0ea5e9;
158
+ --cw-secondary: #2563eb;
159
+ --cw-text: #1e293b;
160
+ --cw-radius: 12px;
161
+ --cw-panel-width: 420px;
162
+ --cw-panel-height: 640px;
163
+ --cw-font-family: "Inter", sans-serif;
164
+ }
165
+ ```
166
+
167
+ ## Backend contract
168
+
169
+ BlueEyeBot expects the backend at `apiUrl` to expose:
170
+
171
+ - `POST /chat/stream` β†’ body `{ message, session_id, user_role }`, returns SSE stream:
172
+ - `data: {"token": "..."}` for each chunk
173
+ - `data: {"done": true, "session_id": "...", "sources": [...]}` at end
174
+ - `POST /chat` β†’ body `{ message, session_id, user_role }`, returns
175
+ `{ response, sources?, session_id? }` (non-streaming fallback)
176
+ - `GET /history?session_id=…` β†’ `{ messages: [{ role, content }] }`
177
+ - `POST /sync` β†’ `{ pages_synced }` (only used when `enableSync` is on)
178
+
179
+ The widget uses SSE streaming (`/chat/stream`) by default and falls back to `/chat` if `ReadableStream` is unavailable.
180
+
181
+ CORS must allow the embedding origin (and the `X-Session-Id`,
182
+ `Content-Type` headers).
183
+
184
+ ## Development
185
+
186
+ ```bash
187
+ npm install
188
+ npm run dev # Vite dev server
189
+ npm run build # emits dist/ (ESM, IIFE, .d.ts)
190
+ ```
191
+
192
+ Open `examples/html/index.html` against the built `dist/` to try the script-tag
193
+ build.
@@ -0,0 +1,5 @@
1
+ import { JSX } from 'preact';
2
+ import { ChatWidgetConfig } from './types';
3
+ export declare function ChatWidget({ config }: {
4
+ config: ChatWidgetConfig;
5
+ }): JSX.Element;
package/dist/api.d.ts ADDED
@@ -0,0 +1,37 @@
1
+ import { ChatMessage, ChatSource } from './types';
2
+ export interface ChatResponse {
3
+ response: string;
4
+ sources?: ChatSource[];
5
+ session_id?: string;
6
+ error?: string;
7
+ }
8
+ interface RequestContext {
9
+ apiUrl: string;
10
+ headers: Record<string, string>;
11
+ }
12
+ /** POST /chat β€” send a message and get the assistant's reply. */
13
+ export declare function sendChat(ctx: RequestContext, params: {
14
+ message: string;
15
+ sessionId: string;
16
+ userRole: string;
17
+ }): Promise<ChatResponse>;
18
+ /** GET /history β€” load prior messages for a session. Returns [] on any failure. */
19
+ export declare function loadHistory(ctx: RequestContext, sessionId: string): Promise<ChatMessage[]>;
20
+ /**
21
+ * Build the WebSocket URL for live voice transcription (`/ws/transcribe`).
22
+ * Derives ws(s):// from the configured http(s) apiUrl.
23
+ */
24
+ export declare function transcribeSocketUrl(ctx: RequestContext, lang: string): string;
25
+ /**
26
+ * POST /chat/stream β€” streaming SSE chat.
27
+ * Calls `onChunk` for each token as it arrives, then `onDone` with the final
28
+ * session ID and sources. Falls back to `sendChat` if SSE is unavailable.
29
+ */
30
+ export declare function sendChatStream(ctx: RequestContext, params: {
31
+ message: string;
32
+ sessionId: string;
33
+ userRole: string;
34
+ }, onChunk: (token: string) => void, onDone: (sessionId: string, sources: ChatSource[]) => void): Promise<void>;
35
+ /** POST /sync β€” sync documentation to Confluence. Returns status message. */
36
+ export declare function triggerSync(ctx: RequestContext): Promise<string>;
37
+ export {};
@@ -0,0 +1,18 @@
1
+ export interface TranscriptResult {
2
+ transcript: string;
3
+ isPartial: boolean;
4
+ }
5
+ export interface VoiceRecorder {
6
+ /** Stop capturing, flush final results, and close the connection. */
7
+ stop: () => void;
8
+ }
9
+ export interface StartVoiceOptions {
10
+ wsUrl: string;
11
+ onTranscript: (result: TranscriptResult) => void;
12
+ onError: (message: string) => void;
13
+ /** Fired once the connection is open and audio is flowing. */
14
+ onStart?: () => void;
15
+ }
16
+ /** Returns true if the current browser can do voice capture + streaming. */
17
+ export declare function isVoiceInputSupported(): boolean;
18
+ export declare function startVoiceRecording(opts: StartVoiceOptions): Promise<VoiceRecorder>;
@@ -0,0 +1,14 @@
1
+ import { d as t, T as d } from "./web-component-DZRPaCAI.js";
2
+ import { C as c } from "./web-component-DZRPaCAI.js";
3
+ t();
4
+ function r(n, o = document.body) {
5
+ t();
6
+ const e = document.createElement(d);
7
+ return o.appendChild(e), e.config = n, e;
8
+ }
9
+ export {
10
+ c as ChatWidgetElement,
11
+ d as TAG_NAME,
12
+ t as defineChatWidget,
13
+ r as init
14
+ };
@@ -0,0 +1,53 @@
1
+ var BlueEyeBot=(function(J){"use strict";var _e,v,ht,q,ft,gt,_t,De,me,re,mt,Ne,Oe,Ue,be={},xe=[],mn=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ke=Array.isArray;function W(r,e){for(var t in e)r[t]=e[t];return r}function We(r){r&&r.parentNode&&r.parentNode.removeChild(r)}function bt(r,e,t){var n,i,s,o={};for(s in e)s=="key"?n=e[s]:s=="ref"?i=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?_e.call(arguments,2):t),typeof r=="function"&&r.defaultProps!=null)for(s in r.defaultProps)o[s]===void 0&&(o[s]=r.defaultProps[s]);return we(r,o,n,i,null)}function we(r,e,t,n,i){var s={type:r,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++ht,__i:-1,__u:0};return i==null&&v.vnode!=null&&v.vnode(s),s}function K(r){return r.children}function ye(r,e){this.props=r,this.context=e}function X(r,e){if(e==null)return r.__?X(r.__,r.__i+1):null;for(var t;e<r.__k.length;e++)if((t=r.__k[e])!=null&&t.__e!=null)return t.__e;return typeof r.type=="function"?X(r):null}function bn(r){if(r.__P&&r.__d){var e=r.__v,t=e.__e,n=[],i=[],s=W({},e);s.__v=e.__v+1,v.vnode&&v.vnode(s),je(r.__P,s,e,r.__n,r.__P.namespaceURI,32&e.__u?[t]:null,n,t??X(e),!!(32&e.__u),i),s.__v=e.__v,s.__.__k[s.__i]=s,Tt(n,s,i),e.__e=e.__=null,s.__e!=t&&xt(s)}}function xt(r){if((r=r.__)!=null&&r.__c!=null)return r.__e=r.__c.base=null,r.__k.some(function(e){if(e!=null&&e.__e!=null)return r.__e=r.__c.base=e.__e}),xt(r)}function kt(r){(!r.__d&&(r.__d=!0)&&q.push(r)&&!ve.__r++||ft!=v.debounceRendering)&&((ft=v.debounceRendering)||gt)(ve)}function ve(){try{for(var r,e=1;q.length;)q.length>e&&q.sort(_t),r=q.shift(),e=q.length,bn(r)}finally{q.length=ve.__r=0}}function wt(r,e,t,n,i,s,o,a,c,d,u){var l,h,f,k,S,w,b,m=n&&n.__k||xe,I=e.length;for(c=xn(t,e,m,c,I),l=0;l<I;l++)(f=t.__k[l])!=null&&(h=f.__i!=-1&&m[f.__i]||be,f.__i=l,w=je(r,f,h,i,s,o,a,c,d,u),k=f.__e,f.ref&&h.ref!=f.ref&&(h.ref&&Fe(h.ref,null,f),u.push(f.ref,f.__c||k,f)),S==null&&k!=null&&(S=k),(b=!!(4&f.__u))||h.__k===f.__k?(c=yt(f,c,r,b),b&&h.__e&&(h.__e=null)):typeof f.type=="function"&&w!==void 0?c=w:k&&(c=k.nextSibling),f.__u&=-7);return t.__e=S,c}function xn(r,e,t,n,i){var s,o,a,c,d,u=t.length,l=u,h=0;for(r.__k=new Array(i),s=0;s<i;s++)(o=e[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=r.__k[s]=we(null,o,null,null,null):ke(o)?o=r.__k[s]=we(K,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=r.__k[s]=we(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):r.__k[s]=o,c=s+h,o.__=r,o.__b=r.__b+1,a=null,(d=o.__i=kn(o,t,c,l))!=-1&&(l--,(a=t[d])&&(a.__u|=2)),a==null||a.__v==null?(d==-1&&(i>u?h--:i<u&&h++),typeof o.type!="function"&&(o.__u|=4)):d!=c&&(d==c-1?h--:d==c+1?h++:(d>c?h--:h++,o.__u|=4))):r.__k[s]=null;if(l)for(s=0;s<u;s++)(a=t[s])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=X(a)),Ct(a,a));return n}function yt(r,e,t,n){var i,s;if(typeof r.type=="function"){for(i=r.__k,s=0;i&&s<i.length;s++)i[s]&&(i[s].__=r,e=yt(i[s],e,t,n));return e}r.__e!=e&&(n&&(e&&r.type&&!e.parentNode&&(e=X(r)),t.insertBefore(r.__e,e||null)),e=r.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function kn(r,e,t,n){var i,s,o,a=r.key,c=r.type,d=e[t],u=d!=null&&(2&d.__u)==0;if(d===null&&a==null||u&&a==d.key&&c==d.type)return t;if(n>(u?1:0)){for(i=t-1,s=t+1;i>=0||s<e.length;)if((d=e[o=i>=0?i--:s++])!=null&&(2&d.__u)==0&&a==d.key&&c==d.type)return o}return-1}function vt(r,e,t){e[0]=="-"?r.setProperty(e,t??""):r[e]=t==null?"":typeof t!="number"||mn.test(e)?t:t+"px"}function Se(r,e,t,n,i){var s,o;e:if(e=="style")if(typeof t=="string")r.style.cssText=t;else{if(typeof n=="string"&&(r.style.cssText=n=""),n)for(e in n)t&&e in t||vt(r.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||vt(r.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(mt,"$1")),o=e.toLowerCase(),e=o in r||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),r.l||(r.l={}),r.l[e+s]=t,t?n?t[re]=n[re]:(t[re]=Ne,r.addEventListener(e,s?Ue:Oe,s)):r.removeEventListener(e,s?Ue:Oe,s);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in r)try{r[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?r.removeAttribute(e):r.setAttribute(e,e=="popover"&&t==1?"":t))}}function St(r){return function(e){if(this.l){var t=this.l[e.type+r];if(e[me]==null)e[me]=Ne++;else if(e[me]<t[re])return;return t(v.event?v.event(e):e)}}}function je(r,e,t,n,i,s,o,a,c,d){var u,l,h,f,k,S,w,b,m,I,R,P,Le,ee,te,z=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(c=!!(32&t.__u),s=[a=e.__e=t.__e]),(u=v.__b)&&u(e);e:if(typeof z=="function")try{if(b=e.props,m=z.prototype&&z.prototype.render,I=(u=z.contextType)&&n[u.__c],R=u?I?I.props.value:u.__:n,t.__c?w=(l=e.__c=t.__c).__=l.__E:(m?e.__c=l=new z(b,R):(e.__c=l=new ye(b,R),l.constructor=z,l.render=yn),I&&I.sub(l),l.state||(l.state={}),l.__n=n,h=l.__d=!0,l.__h=[],l._sb=[]),m&&l.__s==null&&(l.__s=l.state),m&&z.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=W({},l.__s)),W(l.__s,z.getDerivedStateFromProps(b,l.__s))),f=l.props,k=l.state,l.__v=e,h)m&&z.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),m&&l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(m&&z.getDerivedStateFromProps==null&&b!==f&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(b,R),e.__v==t.__v||!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(b,l.__s,R)===!1){e.__v!=t.__v&&(l.props=b,l.state=l.__s,l.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(U){U&&(U.__=e)}),xe.push.apply(l.__h,l._sb),l._sb=[],l.__h.length&&o.push(l);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(b,l.__s,R),m&&l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(f,k,S)})}if(l.context=R,l.props=b,l.__P=r,l.__e=!1,P=v.__r,Le=0,m)l.state=l.__s,l.__d=!1,P&&P(e),u=l.render(l.props,l.state,l.context),xe.push.apply(l.__h,l._sb),l._sb=[];else do l.__d=!1,P&&P(e),u=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++Le<25);l.state=l.__s,l.getChildContext!=null&&(n=W(W({},n),l.getChildContext())),m&&!h&&l.getSnapshotBeforeUpdate!=null&&(S=l.getSnapshotBeforeUpdate(f,k)),ee=u!=null&&u.type===K&&u.key==null?$t(u.props.children):u,a=wt(r,ke(ee)?ee:[ee],e,t,n,i,s,o,a,c,d),l.base=e.__e,e.__u&=-161,l.__h.length&&o.push(l),w&&(l.__E=l.__=null)}catch(U){if(e.__v=null,c||s!=null)if(U.then){for(e.__u|=c?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;s[s.indexOf(a)]=null,e.__e=a}else{for(te=s.length;te--;)We(s[te]);qe(e)}else e.__e=t.__e,e.__k=t.__k,U.then||qe(e);v.__e(U,e,t)}else s==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=wn(t.__e,e,t,n,i,s,o,c,d);return(u=v.diffed)&&u(e),128&e.__u?void 0:a}function qe(r){r&&(r.__c&&(r.__c.__e=!0),r.__k&&r.__k.some(qe))}function Tt(r,e,t){for(var n=0;n<t.length;n++)Fe(t[n],t[++n],t[++n]);v.__c&&v.__c(e,r),r.some(function(i){try{r=i.__h,i.__h=[],r.some(function(s){s.call(i)})}catch(s){v.__e(s,i.__v)}})}function $t(r){return typeof r!="object"||r==null||r.__b>0?r:ke(r)?r.map($t):r.constructor!==void 0?null:W({},r)}function wn(r,e,t,n,i,s,o,a,c){var d,u,l,h,f,k,S,w=t.props||be,b=e.props,m=e.type;if(m=="svg"?i="http://www.w3.org/2000/svg":m=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(d=0;d<s.length;d++)if((f=s[d])&&"setAttribute"in f==!!m&&(m?f.localName==m:f.nodeType==3)){r=f,s[d]=null;break}}if(r==null){if(m==null)return document.createTextNode(b);r=document.createElementNS(i,m,b.is&&b),a&&(v.__m&&v.__m(e,s),a=!1),s=null}if(m==null)w===b||a&&r.data==b||(r.data=b);else{if(s=m=="textarea"&&b.defaultValue!=null?null:s&&_e.call(r.childNodes),!a&&s!=null)for(w={},d=0;d<r.attributes.length;d++)w[(f=r.attributes[d]).name]=f.value;for(d in w)f=w[d],d=="dangerouslySetInnerHTML"?l=f:d=="children"||d in b||d=="value"&&"defaultValue"in b||d=="checked"&&"defaultChecked"in b||Se(r,d,null,f,i);for(d in b)f=b[d],d=="children"?h=f:d=="dangerouslySetInnerHTML"?u=f:d=="value"?k=f:d=="checked"?S=f:a&&typeof f!="function"||w[d]===f||Se(r,d,f,w[d],i);if(u)a||l&&(u.__html==l.__html||u.__html==r.innerHTML)||(r.innerHTML=u.__html),e.__k=[];else if(l&&(r.innerHTML=""),wt(e.type=="template"?r.content:r,ke(h)?h:[h],e,t,n,m=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,o,s?s[0]:t.__k&&X(t,0),a,c),s!=null)for(d=s.length;d--;)We(s[d]);a&&m!="textarea"||(d="value",m=="progress"&&k==null?r.removeAttribute("value"):k!=null&&(k!==r[d]||m=="progress"&&!k||m=="option"&&k!=w[d])&&Se(r,d,k,w[d],i),d="checked",S!=null&&S!=r[d]&&Se(r,d,S,w[d],i))}return r}function Fe(r,e,t){try{if(typeof r=="function"){var n=typeof r.__u=="function";n&&r.__u(),n&&e==null||(r.__u=r(e))}else r.current=e}catch(i){v.__e(i,t)}}function Ct(r,e,t){var n,i;if(v.unmount&&v.unmount(r),(n=r.ref)&&(n.current&&n.current!=r.__e||Fe(n,null,e)),(n=r.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){v.__e(s,e)}n.base=n.__P=null}if(n=r.__k)for(i=0;i<n.length;i++)n[i]&&Ct(n[i],e,t||typeof r.type!="function");t||We(r.__e),r.__c=r.__=r.__e=void 0}function yn(r,e,t){return this.constructor(r,t)}function Ze(r,e,t){var n,i,s,o;e==document&&(e=document.documentElement),v.__&&v.__(r,e),i=(n=!1)?null:e.__k,s=[],o=[],je(e,r=e.__k=bt(K,null,[r]),i||be,be,e.namespaceURI,i?null:e.firstChild?_e.call(e.childNodes):null,s,i?i.__e:e.firstChild,n,o),Tt(s,r,o)}_e=xe.slice,v={__e:function(r,e,t,n){for(var i,s,o;e=e.__;)if((i=e.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(r)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(r,n||{}),o=i.__d),o)return i.__E=i}catch(a){r=a}throw r}},ht=0,ye.prototype.setState=function(r,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=W({},this.state),typeof r=="function"&&(r=r(W({},t),this.props)),r&&W(t,r),r!=null&&this.__v&&(e&&this._sb.push(e),kt(this))},ye.prototype.forceUpdate=function(r){this.__v&&(this.__e=!0,r&&this.__h.push(r),kt(this))},ye.prototype.render=K,q=[],gt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,_t=function(r,e){return r.__v.__b-e.__v.__b},ve.__r=0,De=Math.random().toString(8),me="__d"+De,re="__a"+De,mt=/(PointerCapture)$|Capture$/i,Ne=0,Oe=St(!1),Ue=St(!0);const vn=':host{--cw-primary: #0083ff;--cw-secondary: #0070eb;--cw-accent: var(--cw-primary);--cw-accent-strong: var(--cw-secondary);--cw-gradient: linear-gradient(135deg, var(--cw-primary), var(--cw-secondary));--cw-bg: #0a0c10;--cw-surface: #13171d;--cw-surface-2: #1b212a;--cw-border: rgba(255, 255, 255, .08);--cw-header-text: #ffffff;--cw-text: #e6edf3;--cw-text-secondary: #c9d1d9;--cw-text-muted: #5b6268;--cw-danger: #ff5c5c;--cw-radius: 18px;--cw-font-family: "Inter", system-ui, Avenir, Helvetica, Arial, sans-serif;--cw-panel-width: 400px;--cw-panel-height: 600px;--cw-z-index: 9999;position:fixed;bottom:2rem;z-index:var(--cw-z-index);font-family:var(--cw-font-family);line-height:1.5}:host([data-position="bottom-right"]),:host(:not([data-position])){right:2rem}:host([data-position="bottom-left"]){left:2rem}*,*:before,*:after{box-sizing:border-box}.bob{color:var(--cw-accent);display:block}.bobGlow{filter:drop-shadow(0 0 5px rgba(0,131,255,.75)) drop-shadow(0 0 12px rgba(0,131,255,.4))}.bobHead{opacity:.95}.bobEyes{transform-origin:52px 30px;animation:bobBlink 4.5s infinite}.bobEyesTyping{animation:bobBlink 1.8s infinite}@keyframes bobBlink{0%,90%,to{transform:scaleY(1)}93%,96%{transform:scaleY(.08)}}.bobSpinner{fill:none;stroke-dasharray:18 44;stroke-linecap:round;transform-box:fill-box;transform-origin:center;animation:bobSpin .8s linear infinite}@keyframes bobSpin{to{transform:rotate(360deg)}}.bob[data-state=error]{color:var(--cw-danger)}.bobX{transform-origin:52px 30px;animation:bobShake .4s ease-in-out 2}@keyframes bobShake{0%,to{transform:translate(0)}25%{transform:translate(-2px)}75%{transform:translate(2px)}}.bobHearts{transform-origin:52px 30px;animation:bobPulse .6s ease-in-out 2}@keyframes bobPulse{0%,to{transform:scale(1)}50%{transform:scale(1.18)}}.fabButton{background:radial-gradient(circle at 50% 40%,#161b22,#0a0c10);border:1px solid rgba(0,131,255,.25);border-radius:18px;padding:12px 16px;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 0 22px #0083ff47,0 10px 28px #00000080;transition:transform .3s cubic-bezier(.175,.885,.32,1.275),box-shadow .3s}.fabButton:hover{transform:scale(1.07);box-shadow:0 0 30px #0083ff8c,0 12px 32px #0000008c}.fabButton:active{transform:scale(.95)}.backdrop{position:fixed;inset:0;background:#0009;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);animation:fadeIn .2s ease forwards}.chatWindow{position:absolute;bottom:0;right:0;width:var(--cw-panel-width);max-width:calc(100vw - 4rem);height:var(--cw-panel-height);max-height:calc(100vh - 4rem);background:var(--cw-bg);border:1px solid var(--cw-border);border-radius:var(--cw-radius);box-shadow:0 24px 48px #0000008c,0 0 0 1px #0006;display:flex;overflow:hidden;transform-origin:bottom right;animation:scaleIn .3s cubic-bezier(.175,.885,.32,1.275) forwards;opacity:0}:host([data-position="bottom-left"]) .chatWindow{right:auto;left:0;transform-origin:bottom left}.chatWindow.maximized{position:fixed;inset:50% auto auto 50%;transform:translate(-50%,-50%);width:min(1200px,calc(100vw - 48px));height:calc(100vh - 48px);max-width:none;max-height:none;animation:fadeIn .2s ease forwards}.mainCol{position:relative;flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;background:var(--cw-bg)}@keyframes scaleIn{0%{opacity:0;transform:scale(.8) translateY(20px)}to{opacity:1;transform:scale(1) translateY(0)}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.sidebar{width:288px;flex-shrink:0;background:var(--cw-surface);border-right:1px solid var(--cw-border);display:flex;flex-direction:column;overflow:hidden;transition:width .25s ease}.sidebar.collapsed{width:72px}.sidebarTop{display:flex;align-items:center;justify-content:space-between;padding:18px 16px}.sidebar.collapsed .sidebarTop{flex-direction:column;justify-content:center;gap:12px}.sidebarBrand{display:flex;align-items:center}.railToggle{flex-shrink:0}.sidebar.collapsed .railToggle{transform:rotate(180deg)}.sidebarScroll{flex:1;overflow-y:auto;overflow-x:hidden;padding:8px 12px 16px}.sidebarSection{margin-bottom:22px}.sidebarLabel{font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--cw-text-muted);padding:0 8px 8px}.sidebar.collapsed .sidebarLabel,.sidebar.collapsed .chatItem,.sidebar.collapsed .sidebarEmpty,.sidebar.collapsed .sidebarItemText{display:none}.sidebarItem{width:100%;display:flex;align-items:center;gap:12px;padding:9px 10px;border:none;background:transparent;color:var(--cw-text-secondary);font-family:inherit;font-size:14px;border-radius:10px;cursor:pointer;text-align:left;transition:background .15s,color .15s}.sidebarItem:hover{background:var(--cw-surface-2);color:var(--cw-text)}.sidebar.collapsed .sidebarItem{justify-content:center;padding:9px 0}.chatItem{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:9px 12px;border-radius:10px;border:1px solid transparent;color:var(--cw-text-secondary);font-size:14px;cursor:pointer;transition:background .15s,color .15s,border-color .15s}.chatItem:hover{background:var(--cw-surface-2);color:var(--cw-text)}.chatItem.active{border-color:#0083ff99;background:#0083ff1a;color:var(--cw-accent)}.chatItemTitle{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chatItemDelete{flex-shrink:0;width:24px;height:24px;border:none;background:transparent;color:var(--cw-danger);border-radius:6px;display:flex;align-items:center;justify-content:center;cursor:pointer;opacity:.6;transition:opacity .15s,background .15s,color .15s}.chatItemDelete:hover{background:#ff5c5c26;color:var(--cw-danger)}.sidebarEmpty{padding:4px 10px;font-size:13px;color:var(--cw-text-muted)}.chatHeader{background:var(--cw-surface);color:var(--cw-text);padding:14px 18px;display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid var(--cw-border)}.chatWindow.maximized .chatHeader{background:var(--cw-bg)}.headerTitle{display:flex;align-items:center;gap:10px;font-weight:600;font-size:16px}.breadcrumb{color:var(--cw-text)}.breadcrumbSep{color:var(--cw-text-muted);margin-left:8px}.headerActions{display:flex;gap:6px}.iconButton{background:transparent;border:none;color:var(--cw-text-secondary);cursor:pointer;width:32px;height:32px;border-radius:8px;display:flex;align-items:center;justify-content:center;transition:background .2s,color .2s}.iconButton:hover{background:var(--cw-surface-2);color:var(--cw-text)}.chatBody{flex:1;overflow-y:auto;padding:20px;display:flex;flex-direction:column;gap:16px;background:var(--cw-bg)}.chatBody::-webkit-scrollbar,.historyPanel::-webkit-scrollbar,.sidebarScroll::-webkit-scrollbar{width:6px}.chatBody::-webkit-scrollbar-track,.historyPanel::-webkit-scrollbar-track,.sidebarScroll::-webkit-scrollbar-track{background:transparent}.chatBody::-webkit-scrollbar-thumb,.historyPanel::-webkit-scrollbar-thumb,.sidebarScroll::-webkit-scrollbar-thumb{background-color:#2a323d;border-radius:10px}.chatWindow.maximized .chatBody>*{max-width:820px;width:100%;margin-inline:auto}.message{max-width:85%;animation:msgIn .3s ease}@keyframes msgIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.message.user{align-self:flex-end}.message.assistant{align-self:flex-start}.chatWindow.maximized .message.user{align-self:flex-end;margin-right:0}.messageContent{padding:12px 16px;border-radius:16px;font-size:14.5px;line-height:1.5;white-space:pre-wrap;word-break:break-word}.message.user .messageContent{background:var(--cw-gradient);color:#fff;border-bottom-right-radius:4px}.message.assistant .messageContent{background:var(--cw-surface);color:var(--cw-text);border:1px solid var(--cw-border);border-bottom-left-radius:4px}.messageContent code{background:#ffffff14;padding:2px 6px;border-radius:4px;font-family:monospace;font-size:.9em}.message.user .messageContent code{background:#fff3}.markdownBody{white-space:normal}.markdownBody p{margin:0 0 .6em}.markdownBody p:last-child{margin-bottom:0}.markdownBody ul,.markdownBody ol{margin:.4em 0 .6em 1.4em;padding:0}.markdownBody li{margin-bottom:.2em}.markdownBody strong{font-weight:700;color:var(--cw-text)}.markdownBody em{font-style:italic}.markdownBody h1,.markdownBody h2,.markdownBody h3{margin:.6em 0 .3em;font-weight:700;line-height:1.3;color:var(--cw-text)}.markdownBody h1{font-size:1.15em}.markdownBody h2{font-size:1.05em}.markdownBody h3{font-size:.97em}.markdownBody pre{background:#ffffff0f;border:1px solid var(--cw-border);border-radius:8px;padding:10px 12px;overflow-x:auto;margin:.5em 0}.markdownBody pre code{background:transparent;padding:0;font-size:.88em}.markdownBody blockquote{border-left:3px solid var(--cw-accent);margin:.4em 0;padding:.2em .8em;color:var(--cw-text-secondary);font-style:italic}.markdownBody a{color:var(--cw-accent);text-decoration:underline;text-underline-offset:2px}.markdownBody hr{border:none;border-top:1px solid var(--cw-border);margin:.8em 0}.typingIndicator{display:flex;gap:4px;padding:4px}.typingDot{width:8px;height:8px;background:var(--cw-accent);border-radius:50%;animation:typing 1.4s infinite ease-in-out both}.typingDot:nth-child(1){animation-delay:-.32s}.typingDot:nth-child(2){animation-delay:-.16s}@keyframes typing{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}.chatFooter{padding:16px;background:var(--cw-bg);border-top:1px solid var(--cw-border)}.chatWindow.maximized .chatFooter{padding:16px 20px 20px}.chatWindow.maximized .inputWrapper{max-width:820px;margin-inline:auto}.inputWrapper{display:flex;gap:10px;align-items:flex-end;background:var(--cw-surface);padding:8px 12px;border-radius:16px;border:1px solid var(--cw-border);transition:border-color .2s,box-shadow .2s}.inputWrapper:focus-within{border-color:#0083ff80;box-shadow:0 0 0 3px #0083ff1f}.addButton{flex-shrink:0;width:32px;height:32px;border-radius:10px;border:none;background:transparent;color:var(--cw-text-secondary);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .2s,color .2s}.addButton:hover{background:var(--cw-surface-2);color:var(--cw-text)}.micButton{flex-shrink:0;width:32px;height:32px;border-radius:10px;border:none;background:transparent;color:var(--cw-text-secondary);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .2s,color .2s,box-shadow .2s}.micButton:hover:not(:disabled){background:var(--cw-surface-2);color:var(--cw-text)}.micButton:disabled{color:var(--cw-text-muted);cursor:not-allowed}.micButton.recording{color:#fff;background:#e5484d;animation:cw-mic-pulse 1.4s ease-in-out infinite}@keyframes cw-mic-pulse{0%,to{box-shadow:0 0 #e5484d80}50%{box-shadow:0 0 0 6px #e5484d00}}.textarea{flex:1;background:transparent;border:none;resize:none;padding:6px 0;font-family:inherit;font-size:14px;line-height:1.5;color:var(--cw-text);max-height:120px;outline:none}.textarea::placeholder{color:var(--cw-text-muted)}.sendButton{background:var(--cw-gradient);color:#fff;border:none;width:36px;height:36px;border-radius:12px;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:transform .2s,background .2s,opacity .2s;flex-shrink:0}.sendButton:hover:not(:disabled){transform:scale(1.05)}.sendButton:active:not(:disabled){transform:scale(.95)}.sendButton:disabled{background:var(--cw-surface-2);color:var(--cw-text-muted);cursor:not-allowed;transform:none}.footerInfo{display:flex;justify-content:space-between;padding:8px 4px 0;font-size:11px;color:var(--cw-text-muted)}.chatWindow.maximized .footerInfo{max-width:820px;margin-inline:auto}.errorMessage{background:#ff5c5c1f;color:#ff8585;padding:10px 16px;border-radius:12px;font-size:13px;align-self:center;margin:10px 0;display:flex;align-items:center;gap:8px;border:1px solid rgba(255,92,92,.3)}.historyPanel{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:12px;background:var(--cw-bg)}.historyItem{background:var(--cw-surface);border:1px solid var(--cw-border);border-radius:12px;padding:12px 16px;display:flex;justify-content:space-between;align-items:center;cursor:pointer;transition:all .2s ease}.historyItem:hover{border-color:#0083ff66;transform:translateY(-1px)}.historyItemContent{flex:1;overflow:hidden}.historyTitle{font-size:14px;font-weight:500;color:var(--cw-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:4px}.historyDate{font-size:11px;color:var(--cw-text-muted)}.deleteBtn{background:transparent;border:none;color:var(--cw-danger);width:32px;height:32px;border-radius:8px;display:flex;align-items:center;justify-content:center;cursor:pointer;opacity:.6;transition:all .2s;flex-shrink:0;margin-left:12px}.deleteBtn:hover{opacity:1;background:#ff5c5c26}.emptyHistory{text-align:center;color:var(--cw-text-muted);font-size:14px;margin-top:40px}.toastContainer{position:absolute;top:12px;left:50%;transform:translate(-50%);display:flex;flex-direction:column;gap:8px;z-index:2;pointer-events:none}.toast{background:var(--cw-surface-2);color:var(--cw-text);padding:8px 16px;border-radius:20px;font-size:12px;border:1px solid var(--cw-border);box-shadow:0 4px 12px #0006;animation:fadeIn .2s ease forwards}.toast-success{background:#16a34a;border-color:transparent;color:#fff}.toast-error{background:#dc2626;border-color:transparent;color:#fff}@media(max-width:480px){.chatWindow{width:calc(100vw - 2rem);height:calc(100vh - 100px)}.chatWindow.maximized{width:100vw;height:100vh;border-radius:0;inset:0;transform:none}.sidebar{width:240px}.sidebar.collapsed{width:64px}}';var Sn=0;function p(r,e,t,n,i,s){e||(e={});var o,a,c=e;if("ref"in c)for(a in c={},e)a=="ref"?o=e[a]:c[a]=e[a];var d={type:r,props:c,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Sn,__i:-1,__u:0,__source:i,__self:s};if(typeof r=="function"&&(o=r.defaultProps))for(a in o)c[a]===void 0&&(c[a]=o[a]);return v.vnode&&v.vnode(d),d}var se,T,Ve,It,ie=0,zt=[],C=v,Rt=C.__b,Et=C.__r,Bt=C.diffed,At=C.__c,Pt=C.unmount,Mt=C.__;function Qe(r,e){C.__h&&C.__h(T,r,ie||e),ie=0;var t=T.__H||(T.__H={__:[],__h:[]});return r>=t.__.length&&t.__.push({}),t.__[r]}function B(r){return ie=1,Tn(Ot,r)}function Tn(r,e,t){var n=Qe(se++,2);if(n.t=r,!n.__c&&(n.__=[Ot(void 0,e),function(a){var c=n.__N?n.__N[0]:n.__[0],d=n.t(c,a);c!==d&&(n.__N=[d,n.__[1]],n.__c.setState({}))}],n.__c=T,!T.__f)){var i=function(a,c,d){if(!n.__c.__H)return!0;var u=n.__c.__H.__.filter(function(h){return h.__c});if(u.every(function(h){return!h.__N}))return!s||s.call(this,a,c,d);var l=n.__c.props!==a;return u.some(function(h){if(h.__N){var f=h.__[0];h.__=h.__N,h.__N=void 0,f!==h.__[0]&&(l=!0)}}),s&&s.call(this,a,c,d)||l};T.__f=!0;var s=T.shouldComponentUpdate,o=T.componentWillUpdate;T.componentWillUpdate=function(a,c,d){if(this.__e){var u=s;s=void 0,i(a,c,d),s=u}o&&o.call(this,a,c,d)},T.shouldComponentUpdate=i}return n.__N||n.__}function Ye(r,e){var t=Qe(se++,3);!C.__s&&Nt(t.__H,e)&&(t.__=r,t.u=e,T.__H.__h.push(t))}function Te(r){return ie=5,Lt(function(){return{current:r}},[])}function Lt(r,e){var t=Qe(se++,7);return Nt(t.__H,e)&&(t.__=r(),t.__H=e,t.__h=r),t.__}function Ht(r,e){return ie=8,Lt(function(){return r},e)}function $n(){for(var r;r=zt.shift();){var e=r.__H;if(r.__P&&e)try{e.__h.some($e),e.__h.some(Ge),e.__h=[]}catch(t){e.__h=[],C.__e(t,r.__v)}}}C.__b=function(r){T=null,Rt&&Rt(r)},C.__=function(r,e){r&&e.__k&&e.__k.__m&&(r.__m=e.__k.__m),Mt&&Mt(r,e)},C.__r=function(r){Et&&Et(r),se=0;var e=(T=r.__c).__H;e&&(Ve===T?(e.__h=[],T.__h=[],e.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.some($e),e.__h.some(Ge),e.__h=[],se=0)),Ve=T},C.diffed=function(r){Bt&&Bt(r);var e=r.__c;e&&e.__H&&(e.__H.__h.length&&(zt.push(e)!==1&&It===C.requestAnimationFrame||((It=C.requestAnimationFrame)||Cn)($n)),e.__H.__.some(function(t){t.u&&(t.__H=t.u),t.u=void 0})),Ve=T=null},C.__c=function(r,e){e.some(function(t){try{t.__h.some($e),t.__h=t.__h.filter(function(n){return!n.__||Ge(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],C.__e(n,t.__v)}}),At&&At(r,e)},C.unmount=function(r){Pt&&Pt(r);var e,t=r.__c;t&&t.__H&&(t.__H.__.some(function(n){try{$e(n)}catch(i){e=i}}),t.__H=void 0,e&&C.__e(e,t.__v))};var Dt=typeof requestAnimationFrame=="function";function Cn(r){var e,t=function(){clearTimeout(n),Dt&&cancelAnimationFrame(e),setTimeout(r)},n=setTimeout(t,35);Dt&&(e=requestAnimationFrame(t))}function $e(r){var e=T,t=r.__c;typeof t=="function"&&(r.__c=void 0,t()),T=e}function Ge(r){var e=T;r.__c=r.__(),T=e}function Nt(r,e){return!r||r.length!==e.length||e.some(function(t,n){return t!==r[n]})}function Ot(r,e){return typeof e=="function"?e(r):e}function Je(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let F=Je();function Ut(r){F=r}const Wt=/[&<>"']/,In=new RegExp(Wt.source,"g"),jt=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,zn=new RegExp(jt.source,"g"),Rn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},qt=r=>Rn[r];function A(r,e){if(e){if(Wt.test(r))return r.replace(In,qt)}else if(jt.test(r))return r.replace(zn,qt);return r}const En=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Bn(r){return r.replace(En,(e,t)=>(t=t.toLowerCase(),t==="colon"?":":t.charAt(0)==="#"?t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const An=/(^|[^\[])\^/g;function y(r,e){let t=typeof r=="string"?r:r.source;e=e||"";const n={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(An,"$1"),t=t.replace(i,o),n},getRegex:()=>new RegExp(t,e)};return n}function Ft(r){try{r=encodeURI(r).replace(/%25/g,"%")}catch{return null}return r}const oe={exec:()=>null};function Zt(r,e){const t=r.replace(/\|/g,(s,o,a)=>{let c=!1,d=o;for(;--d>=0&&a[d]==="\\";)c=!c;return c?"|":" |"}),n=t.split(/ \|/);let i=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n}function Ce(r,e,t){const n=r.length;if(n===0)return"";let i=0;for(;i<n&&r.charAt(n-i-1)===e;)i++;return r.slice(0,n-i)}function Pn(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<r.length;n++)if(r[n]==="\\")n++;else if(r[n]===e[0])t++;else if(r[n]===e[1]&&(t--,t<0))return n;return-1}function Vt(r,e,t,n){const i=e.href,s=e.title?A(e.title):null,o=r[1].replace(/\\([\[\]])/g,"$1");if(r[0].charAt(0)!=="!"){n.state.inLink=!0;const a={type:"link",raw:t,href:i,title:s,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=!1,a}return{type:"image",raw:t,href:i,title:s,text:A(o)}}function Mn(r,e){const t=r.match(/^(\s+)(?:```)/);if(t===null)return e;const n=t[1];return e.split(`
2
+ `).map(i=>{const s=i.match(/^\s+/);if(s===null)return i;const[o]=s;return o.length>=n.length?i.slice(n.length):i}).join(`
3
+ `)}class Ie{options;rules;lexer;constructor(e){this.options=e||F}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Ce(n,`
4
+ `)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],i=Mn(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(/#$/.test(n)){const i=Ce(n,"#");(this.options.pedantic||!i||/ $/.test(i))&&(n=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let n=t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
5
+ $1`);n=Ce(n.replace(/^ *>[ \t]?/gm,""),`
6
+ `);const i=this.lexer.state.top;this.lexer.state.top=!0;const s=this.lexer.blockTokens(n);return this.lexer.state.top=i,{type:"blockquote",raw:t[0],tokens:s,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const i=n.length>1,s={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");const o=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);let a="",c="",d=!1;for(;e;){let u=!1;if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;a=t[0],e=e.substring(a.length);let l=t[2].split(`
7
+ `,1)[0].replace(/^\t+/,b=>" ".repeat(3*b.length)),h=e.split(`
8
+ `,1)[0],f=0;this.options.pedantic?(f=2,c=l.trimStart()):(f=t[2].search(/[^ ]/),f=f>4?1:f,c=l.slice(f),f+=t[1].length);let k=!1;if(!l&&/^ *$/.test(h)&&(a+=h+`
9
+ `,e=e.substring(h.length+1),u=!0),!u){const b=new RegExp(`^ {0,${Math.min(3,f-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),m=new RegExp(`^ {0,${Math.min(3,f-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),I=new RegExp(`^ {0,${Math.min(3,f-1)}}(?:\`\`\`|~~~)`),R=new RegExp(`^ {0,${Math.min(3,f-1)}}#`);for(;e;){const P=e.split(`
10
+ `,1)[0];if(h=P,this.options.pedantic&&(h=h.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),I.test(h)||R.test(h)||b.test(h)||m.test(e))break;if(h.search(/[^ ]/)>=f||!h.trim())c+=`
11
+ `+h.slice(f);else{if(k||l.search(/[^ ]/)>=4||I.test(l)||R.test(l)||m.test(l))break;c+=`
12
+ `+h}!k&&!h.trim()&&(k=!0),a+=P+`
13
+ `,e=e.substring(P.length+1),l=h.slice(f)}}s.loose||(d?s.loose=!0:/\n *\n *$/.test(a)&&(d=!0));let S=null,w;this.options.gfm&&(S=/^\[[ xX]\] /.exec(c),S&&(w=S[0]!=="[ ] ",c=c.replace(/^\[[ xX]\] +/,""))),s.items.push({type:"list_item",raw:a,task:!!S,checked:w,loose:!1,text:c,tokens:[]}),s.raw+=a}s.items[s.items.length-1].raw=a.trimEnd(),s.items[s.items.length-1].text=c.trimEnd(),s.raw=s.raw.trimEnd();for(let u=0;u<s.items.length;u++)if(this.lexer.state.top=!1,s.items[u].tokens=this.lexer.blockTokens(s.items[u].text,[]),!s.loose){const l=s.items[u].tokens.filter(f=>f.type==="space"),h=l.length>0&&l.some(f=>/\n.*\n/.test(f.raw));s.loose=h}if(s.loose)for(let u=0;u<s.items.length;u++)s.items[u].loose=!0;return s}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(/\s+/g," "),i=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:i,title:s}}}table(e){const t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;const n=Zt(t[1]),i=t[2].replace(/^\||\| *$/g,"").split("|"),s=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
14
+ `):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(const a of i)/^ *-+: *$/.test(a)?o.align.push("right"):/^ *:-+: *$/.test(a)?o.align.push("center"):/^ *:-+ *$/.test(a)?o.align.push("left"):o.align.push(null);for(const a of n)o.header.push({text:a,tokens:this.lexer.inline(a)});for(const a of s)o.rows.push(Zt(a,o.header.length).map(c=>({text:c,tokens:this.lexer.inline(c)})));return o}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
15
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:A(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const o=Ce(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{const o=Pn(t[2],"()");if(o>-1){const c=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,c).trim(),t[3]=""}}let i=t[2],s="";if(this.options.pedantic){const o=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);o&&(i=o[1],s=o[3])}else s=t[3]?t[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(n)?i=i.slice(1):i=i.slice(1,-1)),Vt(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const i=(n[2]||n[1]).replace(/\s+/g," "),s=t[i.toLowerCase()];if(!s){const o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return Vt(n,s,n[0],this.lexer)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!i||i[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(i[1]||i[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const o=[...i[0]].length-1;let a,c,d=o,u=0;const l=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+o);(i=l.exec(t))!=null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(c=[...a].length,i[3]||i[4]){d+=c;continue}else if((i[5]||i[6])&&o%3&&!((o+c)%3)){u+=c;continue}if(d-=c,d>0)continue;c=Math.min(c,c+d+u);const h=[...i[0]][0].length,f=e.slice(0,o+i.index+h+c);if(Math.min(o,c)%2){const S=f.slice(1,-1);return{type:"em",raw:f,text:S,tokens:this.lexer.inlineTokens(S)}}const k=f.slice(2,-2);return{type:"strong",raw:f,text:k,tokens:this.lexer.inlineTokens(k)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(/\n/g," ");const i=/[^ ]/.test(n),s=/^ /.test(n)&&/ $/.test(n);return i&&s&&(n=n.substring(1,n.length-1)),n=A(n,!0),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,i;return t[2]==="@"?(n=A(t[1]),i="mailto:"+n):(n=A(t[1]),i=n),{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,i;if(t[2]==="@")n=A(t[0]),i="mailto:"+n;else{let s;do s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(s!==t[0]);n=A(t[0]),t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let n;return this.lexer.state.inRawBlock?n=t[0]:n=A(t[0]),{type:"text",raw:t[0],text:n}}}}const Ln=/^(?: *(?:\n|$))+/,Hn=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Dn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ae=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Nn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Qt=/(?:[*+-]|\d{1,9}[.)])/,Yt=y(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,Qt).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),Ke=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,On=/^[^\n]+/,Xe=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Un=y(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",Xe).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Wn=y(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Qt).getRegex(),ze="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",et=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,jn=y("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",et).replace("tag",ze).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Gt=y(Ke).replace("hr",ae).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ze).getRegex(),tt={blockquote:y(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Gt).getRegex(),code:Hn,def:Un,fences:Dn,heading:Nn,hr:ae,html:jn,lheading:Yt,list:Wn,newline:Ln,paragraph:Gt,table:oe,text:On},Jt=y("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ae).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ze).getRegex(),qn={...tt,table:Jt,paragraph:y(Ke).replace("hr",ae).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Jt).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ze).getRegex()},Fn={...tt,html:y(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",et).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:oe,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:y(Ke).replace("hr",ae).replace("heading",` *#{1,6} *[^
16
+ ]`).replace("lheading",Yt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Kt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Zn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Xt=/^( {2,}|\\)\n(?!\s*$)/,Vn=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,le="\\p{P}\\p{S}",Qn=y(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,le).getRegex(),Yn=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,Gn=y(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,le).getRegex(),Jn=y("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,le).getRegex(),Kn=y("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,le).getRegex(),Xn=y(/\\([punct])/,"gu").replace(/punct/g,le).getRegex(),er=y(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),tr=y(et).replace("(?:-->|$)","-->").getRegex(),nr=y("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",tr).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Re=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,rr=y(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Re).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),en=y(/^!?\[(label)\]\[(ref)\]/).replace("label",Re).replace("ref",Xe).getRegex(),tn=y(/^!?\[(ref)\](?:\[\])?/).replace("ref",Xe).getRegex(),sr=y("reflink|nolink(?!\\()","g").replace("reflink",en).replace("nolink",tn).getRegex(),nt={_backpedal:oe,anyPunctuation:Xn,autolink:er,blockSkip:Yn,br:Xt,code:Zn,del:oe,emStrongLDelim:Gn,emStrongRDelimAst:Jn,emStrongRDelimUnd:Kn,escape:Kt,link:rr,nolink:tn,punctuation:Qn,reflink:en,reflinkSearch:sr,tag:nr,text:Vn,url:oe},ir={...nt,link:y(/^!?\[(label)\]\((.*?)\)/).replace("label",Re).getRegex(),reflink:y(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Re).getRegex()},rt={...nt,escape:y(Kt).replace("])","~|])").getRegex(),url:y(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},or={...rt,br:y(Xt).replace("{2,}","*").getRegex(),text:y(rt.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ee={normal:tt,gfm:qn,pedantic:Fn},ce={normal:nt,gfm:rt,breaks:or,pedantic:ir};class D{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||F,this.options.tokenizer=this.options.tokenizer||new Ie,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:Ee.normal,inline:ce.normal};this.options.pedantic?(t.block=Ee.pedantic,t.inline=ce.pedantic):this.options.gfm&&(t.block=Ee.gfm,this.options.breaks?t.inline=ce.breaks:t.inline=ce.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ee,inline:ce}}static lex(e,t){return new D(t).lex(e)}static lexInline(e,t){return new D(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
17
+ `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){this.options.pedantic?e=e.replace(/\t/g," ").replace(/^ +$/gm,""):e=e.replace(/^( *)(\t+)/gm,(a,c,d)=>c+" ".repeat(d.length));let n,i,s,o;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(a=>(n=a.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length),n.raw.length===1&&t.length>0?t[t.length-1].raw+=`
18
+ `:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
19
+ `+n.raw,i.text+=`
20
+ `+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
21
+ `+n.raw,i.text+=`
22
+ `+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(s=e,this.options.extensions&&this.options.extensions.startBlock){let a=1/0;const c=e.slice(1);let d;this.options.extensions.startBlock.forEach(u=>{d=u.call({lexer:this},c),typeof d=="number"&&d>=0&&(a=Math.min(a,d))}),a<1/0&&a>=0&&(s=e.substring(0,a+1))}if(this.state.top&&(n=this.tokenizer.paragraph(s))){i=t[t.length-1],o&&i.type==="paragraph"?(i.raw+=`
23
+ `+n.raw,i.text+=`
24
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n),o=s.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&i.type==="text"?(i.raw+=`
25
+ `+n.raw,i.text+=`
26
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);continue}if(e){const a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,i,s,o=e,a,c,d;if(this.tokens.links){const u=Object.keys(this.tokens.links);if(u.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(o))!=null;)u.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.blockSkip.exec(o))!=null;)o=o.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(o))!=null;)o=o.slice(0,a.index)+"++"+o.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(c||(d=""),c=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(u=>(n=u.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length),i=t[t.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,o,d)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}if(s=e,this.options.extensions&&this.options.extensions.startInline){let u=1/0;const l=e.slice(1);let h;this.options.extensions.startInline.forEach(f=>{h=f.call({lexer:this},l),typeof h=="number"&&h>=0&&(u=Math.min(u,h))}),u<1/0&&u>=0&&(s=e.substring(0,u+1))}if(n=this.tokenizer.inlineText(s)){e=e.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(d=n.raw.slice(-1)),c=!0,i=t[t.length-1],i&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(e){const u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return t}}class Be{options;constructor(e){this.options=e||F}code(e,t,n){const i=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+`
27
+ `,i?'<pre><code class="language-'+A(i)+'">'+(n?e:A(e,!0))+`</code></pre>
28
+ `:"<pre><code>"+(n?e:A(e,!0))+`</code></pre>
29
+ `}blockquote(e){return`<blockquote>
30
+ ${e}</blockquote>
31
+ `}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>
32
+ `}hr(){return`<hr>
33
+ `}list(e,t,n){const i=t?"ol":"ul",s=t&&n!==1?' start="'+n+'"':"";return"<"+i+s+`>
34
+ `+e+"</"+i+`>
35
+ `}listitem(e,t,n){return`<li>${e}</li>
36
+ `}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>
37
+ `}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),`<table>
38
+ <thead>
39
+ `+e+`</thead>
40
+ `+t+`</table>
41
+ `}tablerow(e){return`<tr>
42
+ ${e}</tr>
43
+ `}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
44
+ `}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){const i=Ft(e);if(i===null)return n;e=i;let s='<a href="'+e+'"';return t&&(s+=' title="'+t+'"'),s+=">"+n+"</a>",s}image(e,t,n){const i=Ft(e);if(i===null)return n;e=i;let s=`<img src="${e}" alt="${n}"`;return t&&(s+=` title="${t}"`),s+=">",s}text(e){return e}}class st{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class N{options;renderer;textRenderer;constructor(e){this.options=e||F,this.options.renderer=this.options.renderer||new Be,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new st}static parse(e,t){return new N(t).parse(e)}static parseInline(e,t){return new N(t).parseInline(e)}parse(e,t=!0){let n="";for(let i=0;i<e.length;i++){const s=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]){const o=s,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(o.type)){n+=a||"";continue}}switch(s.type){case"space":continue;case"hr":{n+=this.renderer.hr();continue}case"heading":{const o=s;n+=this.renderer.heading(this.parseInline(o.tokens),o.depth,Bn(this.parseInline(o.tokens,this.textRenderer)));continue}case"code":{const o=s;n+=this.renderer.code(o.text,o.lang,!!o.escaped);continue}case"table":{const o=s;let a="",c="";for(let u=0;u<o.header.length;u++)c+=this.renderer.tablecell(this.parseInline(o.header[u].tokens),{header:!0,align:o.align[u]});a+=this.renderer.tablerow(c);let d="";for(let u=0;u<o.rows.length;u++){const l=o.rows[u];c="";for(let h=0;h<l.length;h++)c+=this.renderer.tablecell(this.parseInline(l[h].tokens),{header:!1,align:o.align[h]});d+=this.renderer.tablerow(c)}n+=this.renderer.table(a,d);continue}case"blockquote":{const o=s,a=this.parse(o.tokens);n+=this.renderer.blockquote(a);continue}case"list":{const o=s,a=o.ordered,c=o.start,d=o.loose;let u="";for(let l=0;l<o.items.length;l++){const h=o.items[l],f=h.checked,k=h.task;let S="";if(h.task){const w=this.renderer.checkbox(!!f);d?h.tokens.length>0&&h.tokens[0].type==="paragraph"?(h.tokens[0].text=w+" "+h.tokens[0].text,h.tokens[0].tokens&&h.tokens[0].tokens.length>0&&h.tokens[0].tokens[0].type==="text"&&(h.tokens[0].tokens[0].text=w+" "+h.tokens[0].tokens[0].text)):h.tokens.unshift({type:"text",text:w+" "}):S+=w+" "}S+=this.parse(h.tokens,d),u+=this.renderer.listitem(S,k,!!f)}n+=this.renderer.list(u,a,c);continue}case"html":{const o=s;n+=this.renderer.html(o.text,o.block);continue}case"paragraph":{const o=s;n+=this.renderer.paragraph(this.parseInline(o.tokens));continue}case"text":{let o=s,a=o.tokens?this.parseInline(o.tokens):o.text;for(;i+1<e.length&&e[i+1].type==="text";)o=e[++i],a+=`
45
+ `+(o.tokens?this.parseInline(o.tokens):o.text);n+=t?this.renderer.paragraph(a):a;continue}default:{const o='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let i=0;i<e.length;i++){const s=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]){const o=this.options.extensions.renderers[s.type].call({parser:this},s);if(o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){n+=o||"";continue}}switch(s.type){case"escape":{const o=s;n+=t.text(o.text);break}case"html":{const o=s;n+=t.html(o.text);break}case"link":{const o=s;n+=t.link(o.href,o.title,this.parseInline(o.tokens,t));break}case"image":{const o=s;n+=t.image(o.href,o.title,o.text);break}case"strong":{const o=s;n+=t.strong(this.parseInline(o.tokens,t));break}case"em":{const o=s;n+=t.em(this.parseInline(o.tokens,t));break}case"codespan":{const o=s;n+=t.codespan(o.text);break}case"br":{n+=t.br();break}case"del":{const o=s;n+=t.del(this.parseInline(o.tokens,t));break}case"text":{const o=s;n+=t.text(o.text);break}default:{const o='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}}class Ae{options;constructor(e){this.options=e||F}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}class ar{defaults=Je();options=this.setOptions;parse=this.#e(D.lex,N.parse);parseInline=this.#e(D.lexInline,N.parseInline);Parser=N;Renderer=Be;TextRenderer=st;Lexer=D;Tokenizer=Ie;Hooks=Ae;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(const i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{const s=i;for(const o of s.header)n=n.concat(this.walkTokens(o.tokens,t));for(const o of s.rows)for(const a of o)n=n.concat(this.walkTokens(a.tokens,t));break}case"list":{const s=i;n=n.concat(this.walkTokens(s.items,t));break}default:{const s=i;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(o=>{const a=s[o].flat(1/0);n=n.concat(this.walkTokens(a,t))}):s.tokens&&(n=n.concat(this.walkTokens(s.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const o=t.renderers[s.name];o?t.renderers[s.name]=function(...a){let c=s.renderer.apply(this,a);return c===!1&&(c=o.apply(this,a)),c}:t.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const o=t[s.level];o?o.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),i.extensions=t),n.renderer){const s=this.defaults.renderer||new Be(this.defaults);for(const o in n.renderer){if(!(o in s))throw new Error(`renderer '${o}' does not exist`);if(o==="options")continue;const a=o,c=n.renderer[a],d=s[a];s[a]=(...u)=>{let l=c.apply(s,u);return l===!1&&(l=d.apply(s,u)),l||""}}i.renderer=s}if(n.tokenizer){const s=this.defaults.tokenizer||new Ie(this.defaults);for(const o in n.tokenizer){if(!(o in s))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;const a=o,c=n.tokenizer[a],d=s[a];s[a]=(...u)=>{let l=c.apply(s,u);return l===!1&&(l=d.apply(s,u)),l}}i.tokenizer=s}if(n.hooks){const s=this.defaults.hooks||new Ae;for(const o in n.hooks){if(!(o in s))throw new Error(`hook '${o}' does not exist`);if(o==="options")continue;const a=o,c=n.hooks[a],d=s[a];Ae.passThroughHooks.has(o)?s[a]=u=>{if(this.defaults.async)return Promise.resolve(c.call(s,u)).then(h=>d.call(s,h));const l=c.call(s,u);return d.call(s,l)}:s[a]=(...u)=>{let l=c.apply(s,u);return l===!1&&(l=d.apply(s,u)),l}}i.hooks=s}if(n.walkTokens){const s=this.defaults.walkTokens,o=n.walkTokens;i.walkTokens=function(a){let c=[];return c.push(o.call(this,a)),s&&(c=c.concat(s.call(this,a))),c}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return D.lex(e,t??this.defaults)}parser(e,t){return N.parse(e,t??this.defaults)}#e(e,t){return(n,i)=>{const s={...i},o={...this.defaults,...s};this.defaults.async===!0&&s.async===!1&&(o.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),o.async=!0);const a=this.#t(!!o.silent,!!o.async);if(typeof n>"u"||n===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(o.hooks&&(o.hooks.options=o),o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(n):n).then(c=>e(c,o)).then(c=>o.hooks?o.hooks.processAllTokens(c):c).then(c=>o.walkTokens?Promise.all(this.walkTokens(c,o.walkTokens)).then(()=>c):c).then(c=>t(c,o)).then(c=>o.hooks?o.hooks.postprocess(c):c).catch(a);try{o.hooks&&(n=o.hooks.preprocess(n));let c=e(n,o);o.hooks&&(c=o.hooks.processAllTokens(c)),o.walkTokens&&this.walkTokens(c,o.walkTokens);let d=t(c,o);return o.hooks&&(d=o.hooks.postprocess(d)),d}catch(c){return a(c)}}}#t(e,t){return n=>{if(n.message+=`
46
+ Please report this to https://github.com/markedjs/marked.`,e){const i="<p>An error occurred:</p><pre>"+A(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}}}const Z=new ar;function x(r,e){return Z.parse(r,e)}x.options=x.setOptions=function(r){return Z.setOptions(r),x.defaults=Z.defaults,Ut(x.defaults),x},x.getDefaults=Je,x.defaults=F,x.use=function(...r){return Z.use(...r),x.defaults=Z.defaults,Ut(x.defaults),x},x.walkTokens=function(r,e){return Z.walkTokens(r,e)},x.parseInline=Z.parseInline,x.Parser=N,x.parser=N.parse,x.Renderer=Be,x.TextRenderer=st,x.Lexer=D,x.lexer=D.lex,x.Tokenizer=Ie,x.Hooks=Ae,x.parse=x,x.options,x.setOptions,x.use,x.walkTokens,x.parseInline,N.parse,D.lex;function Pe(r,e,t){const n={...r.headers};return t&&(n["Content-Type"]="application/json"),e&&(n["X-Session-Id"]=e),n}async function lr(r,e){const t=await fetch(`${r.apiUrl}/chat`,{method:"POST",headers:Pe(r,e.sessionId,!0),body:JSON.stringify({message:e.message,session_id:e.sessionId,user_role:e.userRole})}),n=await t.json();if(!t.ok)throw new Error(n?.error||"Something went wrong. Please try again.");return n}async function nn(r,e){try{const t=await fetch(`${r.apiUrl}/history?session_id=${encodeURIComponent(e)}`,{headers:Pe(r,e,!1)});if(!t.ok)return[];const n=await t.json();return Array.isArray(n?.messages)?n.messages:[]}catch{return[]}}function cr(r,e){return`${r.apiUrl.replace(/^http/i,"ws")}/ws/transcribe?lang=${encodeURIComponent(e)}`}async function pr(r,e,t,n){if(!("ReadableStream"in globalThis)){const c=await lr(r,e);t(c.response??""),n(c.session_id??e.sessionId,c.sources??[]);return}const i=await fetch(`${r.apiUrl}/chat/stream`,{method:"POST",headers:Pe(r,e.sessionId,!0),body:JSON.stringify({message:e.message,session_id:e.sessionId,user_role:e.userRole})});if(!i.ok||!i.body)throw new Error(`Stream request failed: ${i.status}`);const s=i.body.getReader(),o=new TextDecoder;let a="";for(;;){const{done:c,value:d}=await s.read();if(c)break;a+=o.decode(d,{stream:!0});const u=a.split(`
47
+ `);a=u.pop()??"";for(const l of u){if(!l.startsWith("data:"))continue;const h=l.slice(5).trim();if(!h)continue;let f;try{f=JSON.parse(h)}catch{continue}if(typeof f.token=="string")t(f.token);else if(f.done===!0)n(typeof f.session_id=="string"?f.session_id:e.sessionId,Array.isArray(f.sources)?f.sources:[]);else if(typeof f.error=="string")throw new Error(f.error)}}}async function dr(r){const e=await fetch(`${r.apiUrl}/sync`,{method:"POST",headers:Pe(r,null,!0)});if(!e.ok)throw new Error("Sync failed");return(await e.json())?.status??"Sync completed"}const Me=new Map;function it(){try{return window.localStorage}catch{return null}}const M={get(r){try{const e=it();return e?e.getItem(r):Me.get(r)??null}catch{return Me.get(r)??null}},set(r,e){Me.set(r,e);try{it()?.setItem(r,e)}catch{}},remove(r){Me.delete(r);try{it()?.removeItem(r)}catch{}}};let ur=1;function hr(){const[r,e]=B([]),t=Ht(i=>{e(s=>s.filter(o=>o.id!==i))},[]),n=Ht((i,s="info",o=3e3)=>{const a=ur++;return e(c=>[...c,{id:a,message:i,type:s}]),o>0&&setTimeout(()=>t(a),o),a},[t]);return{toasts:r,show:n,dismiss:t}}function fr({toasts:r}){return r.length===0?null:p("div",{class:"toastContainer",children:r.map(e=>p("div",{class:`toast toast-${e.type}`,children:e.message},e.id))})}const gr=16e3;function _r(){return typeof navigator<"u"&&!!navigator.mediaDevices?.getUserMedia&&typeof WebSocket<"u"&&!!(window.AudioContext||window.webkitAudioContext)}function mr(r){const e=new ArrayBuffer(r.length*2),t=new DataView(e);for(let n=0;n<r.length;n++){const i=Math.max(-1,Math.min(1,r[n]));t.setInt16(n*2,i<0?i*32768:i*32767,!0)}return e}function br(r,e,t){if(t>=e)return r;const n=e/t,i=Math.round(r.length/n),s=new Float32Array(i);let o=0,a=0;for(;o<s.length;){const c=Math.round((o+1)*n);let d=0,u=0;for(let l=a;l<c&&l<r.length;l++)d+=r[l],u++;s[o]=u>0?d/u:0,o++,a=c}return s}async function xr(r){let e;try{e=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}})}catch{throw new Error("Microphone access was denied or is unavailable.")}const t=window.AudioContext||window.webkitAudioContext,n=new t,i=n.createMediaStreamSource(e),s=n.createScriptProcessor(4096,1,1),o=n.createGain();o.gain.value=0;const a=new WebSocket(r.wsUrl);a.binaryType="arraybuffer";let c=!1;const d=()=>{try{s.disconnect()}catch{}try{i.disconnect()}catch{}try{o.disconnect()}catch{}try{n.close()}catch{}e.getTracks().forEach(u=>u.stop())};return a.onopen=()=>{i.connect(s),s.connect(o),o.connect(n.destination),r.onStart?.()},a.onmessage=u=>{try{const l=JSON.parse(u.data);if(l.error){r.onError(String(l.error));return}typeof l.transcript=="string"&&r.onTranscript({transcript:l.transcript,isPartial:!!l.isPartial})}catch{}},a.onerror=()=>r.onError("Voice connection error."),a.onclose=()=>d(),s.onaudioprocess=u=>{if(a.readyState!==WebSocket.OPEN)return;const l=u.inputBuffer.getChannelData(0),h=mr(br(l,n.sampleRate,gr));a.send(h)},{stop:()=>{if(!c)if(c=!0,d(),a.readyState===WebSocket.OPEN){try{a.send("STOP")}catch{}setTimeout(()=>{try{a.close()}catch{}},800)}else try{a.close()}catch{}}}}function H({size:r=18,children:e,...t}){return p("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...t,children:e})}const kr=r=>p(H,{...r,children:[p("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),p("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),wr=r=>p(H,{...r,children:[p("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),p("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]}),rn=r=>p(H,{...r,children:[p("polyline",{points:"23 4 23 10 17 10"}),p("polyline",{points:"1 20 1 14 7 14"}),p("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]}),yr=r=>p(H,{...r,children:[p("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),p("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),vr=r=>p(H,{...r,children:[p("circle",{cx:"12",cy:"12",r:"10"}),p("polyline",{points:"12 6 12 12 16 14"})]}),sn=r=>p(H,{...r,children:[p("polyline",{points:"3 6 5 6 21 6"}),p("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),Sr=r=>p(H,{...r,children:[p("polyline",{points:"15 3 21 3 21 9"}),p("polyline",{points:"9 21 3 21 3 15"}),p("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),p("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}),Tr=r=>p(H,{...r,children:[p("polyline",{points:"4 14 10 14 10 20"}),p("polyline",{points:"20 10 14 10 14 4"}),p("line",{x1:"14",y1:"10",x2:"21",y2:"3"}),p("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}),$r=r=>p(H,{...r,children:[p("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),p("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),Cr=r=>p(H,{...r,children:p("polyline",{points:"15 18 9 12 15 6"})}),Ir=r=>p(H,{...r,children:[p("path",{d:"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"}),p("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),p("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),p("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]}),V=38,Q=66,E=30,pe=11;function on(r,e){const t=pe/8;return`M ${r} ${e+5*t} C ${r-7*t} ${e-1*t}, ${r-6*t} ${e-7*t}, ${r} ${e-3*t} C ${r+6*t} ${e-7*t}, ${r+7*t} ${e-1*t}, ${r} ${e+5*t} Z`}function ot({size:r=24,state:e="idle",glow:t=!1,...n}){const i=["bob",t?"bobGlow":""].filter(Boolean).join(" ");return p("svg",{class:i,"data-state":e,width:r*104/60,height:r,viewBox:"0 0 104 60",fill:"none","aria-hidden":"true",...n,children:[p("rect",{class:"bobHead",x:"2.5",y:"2.5",width:"99",height:"55",rx:"27.5",stroke:"currentColor","stroke-width":"3"}),e==="loading"?p("g",{class:"bobSpinners",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round",children:[p("circle",{class:"bobSpinner",cx:V,cy:E,r:pe-2}),p("circle",{class:"bobSpinner",cx:Q,cy:E,r:pe-2})]}):e==="error"?p("g",{class:"bobX",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round",children:[p("line",{x1:V-6,y1:E-6,x2:V+6,y2:E+6}),p("line",{x1:V+6,y1:E-6,x2:V-6,y2:E+6}),p("line",{x1:Q-6,y1:E-6,x2:Q+6,y2:E+6}),p("line",{x1:Q+6,y1:E-6,x2:Q-6,y2:E+6})]}):e==="success"?p("g",{class:"bobHearts",fill:"currentColor",children:[p("path",{d:on(V,E)}),p("path",{d:on(Q,E)})]}):p("g",{class:`bobEyes${e==="typing"?" bobEyesTyping":""}`,fill:"currentColor",children:[p("circle",{cx:V,cy:E,r:pe}),p("circle",{cx:Q,cy:E,r:pe})]})]})}x.setOptions({async:!1});const Y="cw_session_id",de="cw_sessions";function at(){return"ses_"+Date.now().toString(36)+"_"+Math.random().toString(36).substring(2,10)}function zr({config:r}){const e={apiUrl:r.apiUrl,headers:r.headers},t=r.enableHistory,[n,i]=B(r.defaultOpen),[s,o]=B(!1),[a,c]=B(""),[d,u]=B([]),[l,h]=B(""),[f,k]=B(!1),[S,w]=B(null),[b,m]=B(!1),[I,R]=B([]),[P,Le]=B(!1),[ee,te]=B(!1),[z,U]=B(!1),{toasts:Mr,show:ne,dismiss:Lr}=hr(),pn=Te(null),fe=Te(null),He=Te(null),ge=Te(""),ct=()=>({role:"assistant",content:r.welcomeMessage});Ye(()=>{let g;if(t){g=M.get(Y)||at(),M.set(Y,g);try{R(JSON.parse(M.get(de)||"[]"))}catch{R([])}}else g=at(),M.remove(Y);c(g),nn(e,g).then(_=>{u(_.length>0?_:[ct()])})},[r.apiUrl,r.enableHistory]),Ye(()=>{pn.current?.scrollIntoView({behavior:"smooth"})},[d,f]),Ye(()=>()=>He.current?.stop(),[]);const pt=()=>{const g=at();t?M.set(Y,g):M.remove(Y),c(g),u([ct()]),w(null),m(!1)},Hr=g=>{if(!t)return;let _=[];try{_=JSON.parse(M.get(de)||"[]")}catch{_=[]}_.some($=>$.id===a)||(_.unshift({id:a,title:g.substring(0,50)+(g.length>50?"…":""),timestamp:new Date().toISOString()}),_=_.slice(0,20),M.set(de,JSON.stringify(_)),R(_))},dn=g=>{M.set(Y,g),c(g),nn(e,g).then(_=>u(_.length?_:[ct()])),m(!1)},un=(g,_)=>{g.stopPropagation();let $=[];try{$=JSON.parse(M.get(de)||"[]")}catch{$=[]}$=$.filter(L=>L.id!==_),M.set(de,JSON.stringify($)),R($),_===a&&pt()},hn=async()=>{const g=ne("Syncing with Confluence...","info",0);try{const _=await dr(e);ne(_,"success")}catch{ne("Sync failed","error")}finally{Lr(g)}},fn=async()=>{z&&dt();const g=l.trim();if(!(!g||f)){d.length<=1&&Hr(g),h(""),w(null),u(_=>[..._,{role:"user",content:g}]),k(!0),fe.current&&(fe.current.style.height="auto"),u(_=>[..._,{role:"assistant",content:""}]);try{let _=r.userRole;if(r.getUserRole)try{_=await r.getUserRole()}catch{}await pr(e,{message:g,sessionId:a,userRole:_},$=>{u(L=>{const G=[...L],j=G[G.length-1];return j?.role==="assistant"&&(G[G.length-1]={...j,content:j.content+$}),G})},($,L)=>{u(G=>{const j=[...G],_n=j[j.length-1];return _n?.role==="assistant"&&(j[j.length-1]={..._n,sources:L}),j}),$&&$!==a&&(c($),t&&M.set(Y,$)),te(!0),setTimeout(()=>te(!1),1800)})}catch(_){u($=>{const L=[...$];return L[L.length-1]?.role==="assistant"&&L[L.length-1].content===""&&L.pop(),L}),w(_ instanceof Error?_.message:"Unable to connect to the server.")}finally{k(!1),setTimeout(()=>fe.current?.focus(),10)}}},Dr=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),fn())},Nr=g=>{const _=g.currentTarget;h(_.value),_.style.height="auto",_.style.height=Math.min(_.scrollHeight,120)+"px"},Or=()=>{const g=fe.current;g&&(g.style.height="auto",g.style.height=Math.min(g.scrollHeight,120)+"px")},dt=()=>{He.current?.stop(),He.current=null,U(!1)},Ur=async()=>{if(z){dt();return}if(!_r()){ne("Voice input is not supported in this browser.","error");return}ge.current=l?l.replace(/\s+$/,"")+" ":"";try{const g=await xr({wsUrl:cr(e,r.voiceLanguage||"en-US"),onStart:()=>U(!0),onError:_=>{ne(_,"error"),dt()},onTranscript:({transcript:_,isPartial:$})=>{$?h(ge.current+_):(ge.current=ge.current+_+" ",h(ge.current)),setTimeout(Or,0)}});He.current=g}catch(g){ne(g instanceof Error?g.message:"Could not start recording.","error"),U(!1)}},ut=S?"error":f?"loading":ee?"success":l.trim()?"typing":"idle";if(!n)return p("button",{class:"fabButton",onClick:()=>i(!0),title:"Open Assistant","aria-label":"Open chat",children:p(ot,{size:34,state:ut,glow:!0})});const Wr=I.find(g=>g.id===a)?.title||"New Chat",gn=I.some(g=>g.id===a),jr=p("aside",{class:`sidebar${P?" collapsed":""}`,children:[p("div",{class:"sidebarTop",children:[p("span",{class:"sidebarBrand",children:p(ot,{size:30,state:ut,glow:!0})}),p("button",{class:"iconButton railToggle",onClick:()=>Le(g=>!g),title:P?"Expand":"Collapse","aria-label":P?"Expand sidebar":"Collapse sidebar",children:p(Cr,{size:18})})]}),p("div",{class:"sidebarScroll",children:[p("div",{class:"sidebarSection",children:[p("div",{class:"sidebarLabel",children:"Actions"}),p("button",{class:"sidebarItem",onClick:pt,title:"New Chat",children:[p($r,{size:18}),p("span",{class:"sidebarItemText",children:"New Chat"})]}),r.enableSync&&p("button",{class:"sidebarItem",onClick:hn,title:"Sync Documentation",children:[p(rn,{size:18}),p("span",{class:"sidebarItemText",children:"Sync Documentation"})]})]}),t&&p("div",{class:"sidebarSection",children:[p("div",{class:"sidebarLabel",children:"Chats"}),!gn&&p("div",{class:"chatItem active",title:"New Chat",children:p("span",{class:"chatItemTitle",children:"New Chat"})}),I.length===0&&gn&&p("div",{class:"sidebarEmpty",children:"No chats yet"}),I.map(g=>p("div",{class:`chatItem${g.id===a?" active":""}`,onClick:()=>dn(g.id),title:g.title,children:[p("span",{class:"chatItemTitle",children:g.title}),p("button",{class:"chatItemDelete",onClick:_=>un(_,g.id),title:"Delete chat","aria-label":"Delete chat",children:p(sn,{size:14})})]},g.id))]})]})]}),qr=p("div",{class:"chatBody",children:[d.map((g,_)=>{const $=f&&_===d.length-1&&g.role==="assistant"&&g.content==="";return p("div",{class:`message ${g.role}`,children:p("div",{class:"messageContent",children:$?p("div",{class:"typingIndicator",children:[p("div",{class:"typingDot"}),p("div",{class:"typingDot"}),p("div",{class:"typingDot"})]}):g.role==="assistant"?p("div",{class:"markdownBody",dangerouslySetInnerHTML:{__html:x.parse(g.content)}}):g.content})},_)}),S&&p("div",{class:"errorMessage",children:["⚠️ ",S]}),p("div",{ref:pn})]}),Fr=p("div",{class:"chatFooter",children:[p("div",{class:"inputWrapper",children:[p("textarea",{ref:fe,class:"textarea",value:l,onInput:Nr,onKeyDown:Dr,placeholder:r.placeholder,maxLength:r.maxMessageLength,rows:1}),r.enableVoiceInput!==!1&&p("button",{class:`micButton${z?" recording":""}`,onClick:Ur,disabled:f,title:z?"Stop recording":"Voice input","aria-label":z?"Stop recording":"Start voice input",children:p(Ir,{size:18})}),p("button",{class:"sendButton",onClick:fn,disabled:!l.trim()||f,title:"Send","aria-label":"Send message",children:p(wr,{size:18})})]}),p("div",{class:"footerInfo",children:[p("span",{children:[l.length,"/",r.maxMessageLength]}),a&&p("span",{children:["Session: ",a.substring(0,8)]})]})]});return p(K,{children:[s&&p("div",{class:"backdrop",onClick:()=>o(!1)}),p("div",{class:`chatWindow${s?" maximized":""}`,children:[s&&jr,p("div",{class:"mainCol",children:[p(fr,{toasts:Mr}),p("div",{class:"chatHeader",children:[p("div",{class:"headerTitle",children:s?p("span",{class:"breadcrumb",children:[Wr,p("span",{class:"breadcrumbSep",children:"/"})]}):p(K,{children:[p(ot,{size:22,state:ut}),p("span",{children:r.title})]})}),p("div",{class:"headerActions",children:[!s&&t&&p("button",{class:"iconButton",onClick:()=>m(g=>!g),title:"History","aria-label":"History",children:p(vr,{size:18})}),!s&&r.enableSync&&p("button",{class:"iconButton",onClick:hn,title:"Sync Docs","aria-label":"Sync docs",children:p(rn,{size:16})}),!s&&p("button",{class:"iconButton",onClick:pt,title:"New Chat","aria-label":"New chat",children:p(yr,{size:18})}),r.allowFullscreen&&p("button",{class:"iconButton",onClick:()=>o(g=>!g),title:s?"Restore":"Widescreen","aria-label":s?"Restore":"Widescreen",children:s?p(Tr,{size:16}):p(Sr,{size:16})}),p("button",{class:"iconButton",onClick:()=>i(!1),title:"Close","aria-label":"Close",children:p(kr,{size:20})})]})]}),!s&&b?p("div",{class:"historyPanel",children:I.length===0?p("div",{class:"emptyHistory",children:"No chat history yet."}):I.map(g=>p("div",{class:"historyItem",onClick:()=>dn(g.id),children:[p("div",{class:"historyItemContent",children:[p("div",{class:"historyTitle",children:g.title}),p("div",{class:"historyDate",children:new Date(g.timestamp).toLocaleString()})]}),p("button",{class:"deleteBtn",onClick:_=>un(_,g.id),title:"Delete Session","aria-label":"Delete session",children:p(sn,{size:16})})]},g.id))}):qr,(s||!b)&&Fr]})]})]})}const Rr={title:"BlueEyeBot",welcomeMessage:`Hello! I'm your documentation assistant. I can help you with:
48
+ - Feature explanations and how-to guides
49
+ - Troubleshooting common issues
50
+ - Configuration and setup questions
51
+ - Best practices and recommendations
52
+
53
+ What would you like to know?`,placeholder:"Type your question...",userRole:"student/vizitator",position:"bottom-right",defaultOpen:!1,enableHistory:!1,enableSync:!1,allowFullscreen:!0,maxMessageLength:2e3,enableVoiceInput:!0,voiceLanguage:"en-US",headers:{},zIndex:9999};function Er(r){return{...Rr,...r}}const O=r=>r,an=r=>{const e=Number(r);return Number.isNaN(e)?void 0:e},ue=r=>r!=="false"&&r!=="0",ln={"api-url":{key:"apiUrl",parse:O},title:{key:"title",parse:O},"welcome-message":{key:"welcomeMessage",parse:O},placeholder:{key:"placeholder",parse:O},"user-role":{key:"userRole",parse:O},position:{key:"position",parse:O},"default-open":{key:"defaultOpen",parse:ue},"enable-history":{key:"enableHistory",parse:ue},"enable-sync":{key:"enableSync",parse:ue},"allow-fullscreen":{key:"allowFullscreen",parse:ue},"max-message-length":{key:"maxMessageLength",parse:an},"enable-voice-input":{key:"enableVoiceInput",parse:ue},"voice-language":{key:"voiceLanguage",parse:O},"z-index":{key:"zIndex",parse:an},"primary-color":{key:"primaryColor",parse:O},"secondary-color":{key:"secondaryColor",parse:O},"font-family":{key:"fontFamily",parse:O}},Br=Object.keys(ln);function Ar(r){const e={};for(const[t,n]of Object.entries(ln))if(r.hasAttribute(t)){const i=n.parse(r.getAttribute(t)??"");i!==void 0&&(e[n.key]=i)}return e}const he="blue-eye-bot";class cn extends HTMLElement{static get observedAttributes(){return Br}mount;jsConfig={};connected=!1;constructor(){super();const e=this.attachShadow({mode:"open"}),t=document.createElement("style");t.textContent=vn,this.mount=document.createElement("div"),e.append(t,this.mount)}connectedCallback(){this.connected=!0,this.update()}disconnectedCallback(){this.connected=!1,Ze(null,this.mount)}attributeChangedCallback(){this.connected&&this.update()}set config(e){this.jsConfig=e||{},this.connected&&this.update()}get config(){return this.jsConfig}resolve(){const e={...Ar(this),...this.jsConfig};return e.apiUrl?Er(e):(console.warn(`<${he}>: "api-url" is required and was not provided.`),null)}applyHostStyles(e){const t=this.style;e.primaryColor&&t.setProperty("--cw-primary",e.primaryColor),e.secondaryColor&&t.setProperty("--cw-secondary",e.secondaryColor),e.fontFamily&&t.setProperty("--cw-font-family",e.fontFamily),t.setProperty("--cw-z-index",String(e.zIndex)),this.setAttribute("data-position",e.position)}update(){const e=this.resolve();if(!e){Ze(null,this.mount);return}this.applyHostStyles(e),Ze(bt(zr,{config:e}),this.mount)}}function lt(){typeof customElements<"u"&&!customElements.get(he)&&customElements.define(he,cn)}lt();function Pr(r,e=document.body){lt();const t=document.createElement(he);return e.appendChild(t),t.config=r,t}return J.ChatWidgetElement=cn,J.TAG_NAME=he,J.defineChatWidget=lt,J.init=Pr,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"}),J})({});
package/dist/bob.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ import { JSX } from 'preact';
2
+ /**
3
+ * BOB β€” the BlueEyeBot face. A rounded "head" outline with two glowing eyes
4
+ * whose expression maps to the chat request lifecycle:
5
+ *
6
+ * idle β†’ open eyes that periodically blink (waiting for input)
7
+ * typing β†’ open eyes, subtly attentive (user is composing a message)
8
+ * loading β†’ eyes morph into spinners (request in flight)
9
+ * success β†’ heart eyes (a response just arrived)
10
+ * error β†’ X eyes (the request failed)
11
+ *
12
+ * The face is a single inline SVG so it inherits `currentColor` for the eyes and
13
+ * ships with no extra assets. Animations live in ChatWidget.css, keyed off the
14
+ * `data-state` attribute set here.
15
+ */
16
+ export type BobState = "idle" | "typing" | "loading" | "success" | "error";
17
+ type BobProps = {
18
+ size?: number;
19
+ state?: BobState;
20
+ /** Strong outer glow β€” used for the floating launcher button. */
21
+ glow?: boolean;
22
+ } & Omit<JSX.SVGAttributes<SVGSVGElement>, "size">;
23
+ export declare function BobEyes({ size, state, glow, ...rest }: BobProps): JSX.Element;
24
+ export {};
@@ -0,0 +1,18 @@
1
+ import { ChatWidgetConfig, ChatWidgetOptions } from './types';
2
+ export declare const DEFAULT_WELCOME: string;
3
+ export declare const DEFAULT_CONFIG: Omit<ChatWidgetConfig, "apiUrl">;
4
+ /** Merge partial options over the defaults to produce a complete config. */
5
+ export declare function resolveConfig(options: ChatWidgetOptions): ChatWidgetConfig;
6
+ /**
7
+ * Maps every HTML attribute (kebab-case) to its config key and a parser.
8
+ * Used both for `observedAttributes` and for reading attributes off the element.
9
+ */
10
+ type AttrSpec = {
11
+ key: keyof ChatWidgetConfig;
12
+ parse: (raw: string) => unknown;
13
+ };
14
+ export declare const ATTRIBUTE_MAP: Record<string, AttrSpec>;
15
+ export declare const OBSERVED_ATTRIBUTES: string[];
16
+ /** Read all known attributes off an element into a partial options object. */
17
+ export declare function optionsFromAttributes(el: Element): Partial<ChatWidgetConfig>;
18
+ export {};
@@ -0,0 +1,19 @@
1
+ import { JSX } from 'preact';
2
+ type IconProps = {
3
+ size?: number;
4
+ } & JSX.SVGAttributes<SVGSVGElement>;
5
+ export declare const IconMessage: (p: IconProps) => JSX.Element;
6
+ export declare const IconClose: (p: IconProps) => JSX.Element;
7
+ export declare const IconSend: (p: IconProps) => JSX.Element;
8
+ export declare const IconRefresh: (p: IconProps) => JSX.Element;
9
+ export declare const IconPlus: (p: IconProps) => JSX.Element;
10
+ export declare const IconClock: (p: IconProps) => JSX.Element;
11
+ export declare const IconTrash: (p: IconProps) => JSX.Element;
12
+ export declare const IconExpand: (p: IconProps) => JSX.Element;
13
+ export declare const IconCompress: (p: IconProps) => JSX.Element;
14
+ export declare const IconEdit: (p: IconProps) => JSX.Element;
15
+ export declare const IconChevronLeft: (p: IconProps) => JSX.Element;
16
+ export declare const IconMenu: (p: IconProps) => JSX.Element;
17
+ export declare const IconMicrophone: (p: IconProps) => JSX.Element;
18
+ export declare const IconRobot: (p: IconProps) => JSX.Element;
19
+ export {};
@@ -0,0 +1,14 @@
1
+ import { ChatWidgetElement, TAG_NAME, defineChatWidget } from './web-component';
2
+ import { ChatWidgetOptions } from './types';
3
+ /**
4
+ * Programmatically create and mount a <blue-eye-bot>. Convenient for the
5
+ * script-tag / no-framework path:
6
+ *
7
+ * BlueEyeBot.init({ apiUrl: "https://api.example.com/dev", primaryColor: "#0ea5e9" });
8
+ *
9
+ * @param options Widget configuration (apiUrl is required).
10
+ * @param target Where to append the element (defaults to document.body).
11
+ */
12
+ export declare function init(options: ChatWidgetOptions, target?: HTMLElement): ChatWidgetElement;
13
+ export { defineChatWidget, ChatWidgetElement, TAG_NAME };
14
+ export type { ChatWidgetConfig, ChatWidgetOptions, ChatMessage, ChatSource, ChatSessionMeta, } from './types';