@useago/sdk 1.12.0 → 1.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +111 -4
- package/README.md +73 -0
- package/dist/angular.cjs +1 -1
- package/dist/angular.d.cts +140 -38
- package/dist/angular.d.ts +140 -38
- package/dist/angular.js +7 -4
- package/dist/autoContinue-C3UsCvT5.cjs +1 -0
- package/dist/{autoContinue-CC8K9mBU.js → autoContinue-Cb4_iEbO.js} +1 -1
- package/dist/{createConversationSession-B1Qn-y0I.js → createConversationSession-D0vks-8C.js} +1 -1
- package/dist/{createConversationSession-B3v_xOU7.cjs → createConversationSession-Ri3EKIJU.cjs} +1 -1
- package/dist/{createFormCollector-m79zk_NA.js → createFormCollector-BMN-blXs.js} +1 -1
- package/dist/{createFormCollector-FvwDOqnV.cjs → createFormCollector-BNCMIUw2.cjs} +1 -1
- package/dist/createMockClient-BPt1gSve.cjs +1 -0
- package/dist/{createMockClient-Beao82tu.js → createMockClient-YoYr3pQr.js} +1 -0
- package/dist/devtools.cjs +4 -4
- package/dist/devtools.d.cts +129 -33
- package/dist/devtools.d.ts +129 -33
- package/dist/devtools.js +87 -84
- package/dist/helpers.d.cts +42 -12
- package/dist/helpers.d.ts +42 -12
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +135 -40
- package/dist/index.d.ts +135 -40
- package/dist/index.js +44 -43
- package/dist/react.cjs +4 -4
- package/dist/react.d.cts +187 -34
- package/dist/react.d.ts +187 -34
- package/dist/react.js +822 -729
- package/dist/speechToText-BV7qxqPF.js +704 -0
- package/dist/speechToText-ZciRyyJE.cjs +1 -0
- package/dist/testing.cjs +1 -1
- package/dist/testing.d.cts +129 -33
- package/dist/testing.d.ts +129 -33
- package/dist/testing.js +1 -1
- package/dist/types-Ck3iZG0K.cjs +10 -0
- package/dist/{types-Ct1hlKwg.js → types-fX-VoHfa.js} +1042 -759
- package/dist/vue.cjs +1 -1
- package/dist/vue.d.cts +143 -35
- package/dist/vue.d.ts +143 -35
- package/dist/vue.js +133 -131
- package/dist/widget.cjs +6 -6
- package/dist/widget.d.cts +161 -33
- package/dist/widget.d.ts +161 -33
- package/dist/widget.js +1702 -1757
- package/llms-full.txt +166 -1
- package/package.json +1 -1
- package/dist/autoContinue-CP9pJR-V.cjs +0 -1
- package/dist/createMockClient-BEOXI8yW.cjs +0 -1
- package/dist/sheetController-BThJRtOu.cjs +0 -1
- package/dist/sheetController-aEKXIvjk.js +0 -343
- package/dist/types-mcW8vB1U.cjs +0 -10
package/llms-full.txt
CHANGED
|
@@ -1478,6 +1478,34 @@ knows where it is after it navigates, not just how to navigate away. Call
|
|
|
1478
1478
|
`client.unregisterNavigationFunction()` to remove both the function and that
|
|
1479
1479
|
context.
|
|
1480
1480
|
|
|
1481
|
+
#### Large route tables
|
|
1482
|
+
|
|
1483
|
+
Every route description sits in the prompt on every message. Pass
|
|
1484
|
+
`catalogue: "onDemand"` to move them into a read-only `listPages` companion the
|
|
1485
|
+
agent can call when it needs them:
|
|
1486
|
+
|
|
1487
|
+
```ts
|
|
1488
|
+
client.registerNavigationFunction(
|
|
1489
|
+
navigate,
|
|
1490
|
+
[
|
|
1491
|
+
{ name: "pricing", path: "/pricing", description: "Pricing page", section: "Marketing" },
|
|
1492
|
+
{ name: "orders", path: "/orders", description: "Order list", section: "Admin" },
|
|
1493
|
+
],
|
|
1494
|
+
{ catalogue: "onDemand" },
|
|
1495
|
+
);
|
|
1496
|
+
```
|
|
1497
|
+
|
|
1498
|
+
`navigateToPage` keeps the page names as its `page` enum, so a recognisable name
|
|
1499
|
+
can still navigate in one call.
|
|
1500
|
+
|
|
1501
|
+
Give routes a `section` and `listPages` takes it as a required argument, so the
|
|
1502
|
+
agent asks for one group at a time and no single answer has to carry the whole
|
|
1503
|
+
catalogue. Keep a section small enough that listing it fits WebMCP's 1.5K output
|
|
1504
|
+
budget. Without sections, `listPages` returns every route in one answer.
|
|
1505
|
+
|
|
1506
|
+
On a large table this can cut the tool's schema by around 70%. `section` is only
|
|
1507
|
+
read in this mode.
|
|
1508
|
+
|
|
1481
1509
|
### Page state shortcut
|
|
1482
1510
|
|
|
1483
1511
|
The mirror of navigation: instead of moving the user to another page, let the
|
|
@@ -1767,6 +1795,82 @@ user declined, then lets the turn resume. This is a no-op in placeholder mode
|
|
|
1767
1795
|
In React, `useAgoActivity` surfaces awaiting items with ready-made `approve` /
|
|
1768
1796
|
`reject` controls (see the [React guide](../frameworks/react.md)).
|
|
1769
1797
|
|
|
1798
|
+
### WebMCP bridge (share your functions with browser agents)
|
|
1799
|
+
|
|
1800
|
+
[WebMCP](https://github.com/webmachinelearning/webmcp) is a browser API that lets
|
|
1801
|
+
a page hand tools to whatever agent the user brings, such as an agentic browser
|
|
1802
|
+
or an extension. Set `webmcp` and every function you register becomes a WebMCP
|
|
1803
|
+
tool as well.
|
|
1804
|
+
|
|
1805
|
+
```ts
|
|
1806
|
+
const client = new AgoClient({
|
|
1807
|
+
baseUrl: "https://playground.api.useago.com",
|
|
1808
|
+
agent: "your-agent",
|
|
1809
|
+
webmcp: true,
|
|
1810
|
+
});
|
|
1811
|
+
|
|
1812
|
+
client.registerFunction({
|
|
1813
|
+
name: "listFlights",
|
|
1814
|
+
description: "The flights currently on screen, after filtering.",
|
|
1815
|
+
parameters: { type: "object", properties: {} },
|
|
1816
|
+
handler: () => visibleFlights(),
|
|
1817
|
+
// Optional, WebMCP only: MCP behavior hints.
|
|
1818
|
+
webmcp: { annotations: { readOnlyHint: true } },
|
|
1819
|
+
});
|
|
1820
|
+
```
|
|
1821
|
+
|
|
1822
|
+
In React it is a prop:
|
|
1823
|
+
|
|
1824
|
+
```tsx
|
|
1825
|
+
<AgoProvider baseUrl="https://playground.api.useago.com" agent="your-agent" webmcp>
|
|
1826
|
+
<App />
|
|
1827
|
+
</AgoProvider>
|
|
1828
|
+
```
|
|
1829
|
+
|
|
1830
|
+
A function a page registers on mount disappears from the browser's tool list
|
|
1831
|
+
when that page unmounts. That is a problem for navigation: the handler returns
|
|
1832
|
+
before the destination page has mounted, so the caller would read the tools of
|
|
1833
|
+
the page it just left. Mark the function and the SDK holds the call open until
|
|
1834
|
+
the destination has registered:
|
|
1835
|
+
|
|
1836
|
+
```ts
|
|
1837
|
+
client.registerFunction({
|
|
1838
|
+
name: "openOrder",
|
|
1839
|
+
description: "Open one order's detail page.",
|
|
1840
|
+
parameters: { type: "object", properties: { id: { type: "string" } } },
|
|
1841
|
+
handler: (args) => navigate(`/orders/${args.id}`),
|
|
1842
|
+
webmcp: { navigates: true },
|
|
1843
|
+
});
|
|
1844
|
+
```
|
|
1845
|
+
|
|
1846
|
+
The built-in `navigateToPage` already carries it, so
|
|
1847
|
+
[`registerNavigationFunction`](#navigation-shortcut) and `useAgoNavigation` need
|
|
1848
|
+
no change. The call resolves 150 ms after the last registration, 600 ms if the
|
|
1849
|
+
destination registers nothing, and gives up after 4 seconds.
|
|
1850
|
+
|
|
1851
|
+
Check what is exposed from the console:
|
|
1852
|
+
|
|
1853
|
+
```js
|
|
1854
|
+
(await document.modelContext.getTools()).map((t) => t.name);
|
|
1855
|
+
```
|
|
1856
|
+
|
|
1857
|
+
Off by default, and a no-op in browsers without WebMCP. Calls arrive as
|
|
1858
|
+
`function:invoke` and `function:result` like any other, so your logging and the
|
|
1859
|
+
dev panel already cover them.
|
|
1860
|
+
|
|
1861
|
+
While the bridge is on, each external call is also reported to AGO, so it shows
|
|
1862
|
+
up in the AGO dashboard next to the calls your AGO agent makes. The report carries
|
|
1863
|
+
the function name and arguments, what the handler returned or how it failed, how
|
|
1864
|
+
long it took, and a per-tab id that groups one external agent's run of calls. The
|
|
1865
|
+
result is the same value an agent call already stores, under the same
|
|
1866
|
+
`maxResultBytes` cap. Delivery is best-effort and never blocks the call. There is
|
|
1867
|
+
no separate switch: `webmcp: true` turns reporting on too.
|
|
1868
|
+
|
|
1869
|
+
**There is no approval gate on a WebMCP call**, and cancelling one does not stop
|
|
1870
|
+
your handler. `requiresApproval` and `approvalPolicy` hold a call in the agent
|
|
1871
|
+
loop, which a WebMCP call never enters. Set `webmcp: false` on a definition to
|
|
1872
|
+
keep that function private to your own agent.
|
|
1873
|
+
|
|
1770
1874
|
---
|
|
1771
1875
|
|
|
1772
1876
|
## Pre-built helpers
|
|
@@ -2235,6 +2339,7 @@ interface AgoConfig {
|
|
|
2235
2339
|
agent?: string; // default agent (id or slug) for new conversations
|
|
2236
2340
|
defaultAgentId?: string; // same as `agent`; `agent` is preferred
|
|
2237
2341
|
permission?: string; // X-Widget-Permission header
|
|
2342
|
+
language?: string | null; // Host interface locale, sent as Accept-Language
|
|
2238
2343
|
userEmail?: string; // X-User-Email header, identify the end user
|
|
2239
2344
|
userJwt?: string; // Authorization: Bearer <jwt>, authenticated users
|
|
2240
2345
|
metadata?: Record<string, unknown> | null; // Message body, for user/ticket enrichment
|
|
@@ -2252,6 +2357,7 @@ interface AgoConfig {
|
|
|
2252
2357
|
| `widgetId` | — | `X-User-Anon-Id` | Per-visitor anonymous id. If omitted, a UUID is generated and cached in `localStorage` (`ago_widget_id`) so a returning visitor keeps the same id. |
|
|
2253
2358
|
| `agent` / `defaultAgentId` | — | `agent_id` in the body | Per-message `agentId` overrides it. `agent` wins if both are set. |
|
|
2254
2359
|
| `permission` | — | `X-Widget-Permission` | Mirrors the widget's `window.AGO.permission`. |
|
|
2360
|
+
| `language` | No | `Accept-Language` | Pass your interface locale, such as `fr` or `pt-BR`. `null` clears the override. |
|
|
2255
2361
|
| `userEmail` | — | `X-User-Email` | Identifies the user to AGO. |
|
|
2256
2362
|
| `userJwt` | — | `Authorization: Bearer …` | For authenticated sessions. |
|
|
2257
2363
|
| `metadata` | — | `metadata` in the body | JSON-serializable user/ticket context. Per-message overrides replace defaults; `null` omits the field. |
|
|
@@ -2354,7 +2460,7 @@ client.updateConfig({ userJwt: token, userEmail: "jane@acme.com" });
|
|
|
2354
2460
|
```
|
|
2355
2461
|
|
|
2356
2462
|
Changing `permission` to a falsy value removes the header. In React, the
|
|
2357
|
-
`useAgo` hook re-applies `agent`, `permission`, `userEmail`, `userJwt`,
|
|
2463
|
+
`useAgo` hook re-applies `agent`, `permission`, `language`, `userEmail`, `userJwt`,
|
|
2358
2464
|
`metadata`, `debug` and `warnOnEmptyReply` automatically when those props
|
|
2359
2465
|
change (changing `baseUrl`/`widgetId` recreates the client).
|
|
2360
2466
|
|
|
@@ -2362,6 +2468,63 @@ change (changing `baseUrl`/`widgetId` recreates the client).
|
|
|
2362
2468
|
`undefined`) keeps the current value; an explicit empty or non-string `baseUrl`
|
|
2363
2469
|
throws `config_missing_base_url` and leaves the client unchanged.
|
|
2364
2470
|
|
|
2471
|
+
### Language
|
|
2472
|
+
|
|
2473
|
+
```ts
|
|
2474
|
+
const client = new AgoClient({
|
|
2475
|
+
baseUrl: "https://playground.api.useago.com",
|
|
2476
|
+
agent: "generic-guide",
|
|
2477
|
+
language: "fr",
|
|
2478
|
+
});
|
|
2479
|
+
const answer = await client.sendMessage("What can you help me with?");
|
|
2480
|
+
|
|
2481
|
+
// Run this when your application's language picker changes.
|
|
2482
|
+
client.updateConfig({ language: "de" });
|
|
2483
|
+
await client.sendMessage("And now?", { conversationId: answer.conversationId });
|
|
2484
|
+
```
|
|
2485
|
+
|
|
2486
|
+
Pass your application's current locale to `language`. The SDK sends it in the
|
|
2487
|
+
`Accept-Language` header on its requests. AGO uses the resolved language to select
|
|
2488
|
+
existing knowledge translations and source titles, falling back to the original
|
|
2489
|
+
content when a translation is unavailable. Region tags are preserved in the header
|
|
2490
|
+
(`pt-BR`); underscores are accepted (`fr_FR` becomes `fr-FR`). The backend may resolve
|
|
2491
|
+
a regional tag to its base language. If translations are stored under a base
|
|
2492
|
+
language such as `pt`, pass that code when the backend does not fall back from
|
|
2493
|
+
`pt-BR`. Source URLs remain the document's configured URLs.
|
|
2494
|
+
If a Django language cookie is sent with the
|
|
2495
|
+
request, it takes precedence over this header.
|
|
2496
|
+
|
|
2497
|
+
In React, bind the same locale your interface uses:
|
|
2498
|
+
|
|
2499
|
+
```tsx
|
|
2500
|
+
<AgoProvider baseUrl="https://playground.api.useago.com" language={i18n.language}>
|
|
2501
|
+
<App />
|
|
2502
|
+
</AgoProvider>
|
|
2503
|
+
```
|
|
2504
|
+
|
|
2505
|
+
Changing the prop updates subsequent requests without recreating the client or
|
|
2506
|
+
losing the conversation. Omit the React prop or call
|
|
2507
|
+
`client.updateConfig({ language: null })` to clear the override. With no override,
|
|
2508
|
+
the browser supplies its own language header. Each client has its own setting;
|
|
2509
|
+
the SDK does not read or change your
|
|
2510
|
+
page's language, global variables, or saved language preferences.
|
|
2511
|
+
|
|
2512
|
+
To refresh knowledge source titles already on screen, reload the conversation
|
|
2513
|
+
after changing the language. Existing answer text stays unchanged:
|
|
2514
|
+
|
|
2515
|
+
```ts
|
|
2516
|
+
client.updateConfig({ language: "fr" });
|
|
2517
|
+
const conversation = await client.getConversation(answer.conversationId);
|
|
2518
|
+
const sources = conversation.messages?.flatMap((message) => message.sources ?? []);
|
|
2519
|
+
```
|
|
2520
|
+
|
|
2521
|
+
`createAgo({ language: "fr" })` also accepts an explicit locale when your API
|
|
2522
|
+
configuration is detected from the page.
|
|
2523
|
+
|
|
2524
|
+
This header does not force the agent's reply language or translate your UI text.
|
|
2525
|
+
Continue passing translated labels, placeholders and welcome text from your
|
|
2526
|
+
application's translations.
|
|
2527
|
+
|
|
2365
2528
|
### User and ticket metadata
|
|
2366
2529
|
|
|
2367
2530
|
Pass JSON-serializable data in `config.metadata` to include it in every new
|
|
@@ -2420,8 +2583,10 @@ may be reworded in any release.
|
|
|
2420
2583
|
| Code | Thrown by | Meaning | Fix |
|
|
2421
2584
|
| --- | --- | --- | --- |
|
|
2422
2585
|
| `config_missing_base_url` | `AgoError` | `baseUrl` missing, empty, or not a string (also from `createAgo()` and `mountChatWidget`) | Pass `baseUrl`, e.g. `https://YOUR-DOMAIN.api.useago.com` (the public demo account `https://playground.api.useago.com` works without a tenant) |
|
|
2586
|
+
| `config_invalid_language` | `AgoError` | `language` is not a valid language tag | Use a tag such as `fr` or `pt-BR`, or `null` to clear the override. Invalid updates leave the client unchanged. |
|
|
2423
2587
|
| `config_suspect_base_url` | console warning only | `baseUrl` has no protocol and is not a `/path` | Add `https://`, or use a `/path` for a same-origin proxy |
|
|
2424
2588
|
| `network_error` | `AgoNetworkError` | fetch failed (offline, DNS, unreachable host) | Check `baseUrl` is reachable and includes the protocol |
|
|
2589
|
+
| `message_empty_content` | `AgoError` | `sendMessage` received empty, whitespace-only, or non-string content | Include message text, even when attaching files |
|
|
2425
2590
|
| `http_error` | `AgoApiError` | non-2xx without a structured error body | 401/403: check `userJwt`. 404: check `baseUrl` points at the API root |
|
|
2426
2591
|
| `stream_no_body` | `AgoStreamError` | the endpoint returned no streamable body | Check `baseUrl` targets an AGO API and no proxy/mock strips the SSE stream |
|
|
2427
2592
|
| `stream_error` | `AgoStreamError` | the stream failed mid-flight | Usually a dropped connection; retry the message |
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var I="You have navigated the user to a new page. That page now exposes its editable state through the available setPageState function, and its current values in the page context. If the user's latest request also asked to change something on this page, call setPageState now to apply exactly those changes and nothing else. Otherwise, reply with a short confirmation only.";function p(e){return{navigationFunctions:e?.navigationFunctions??["navigateToPage"],pageStateFunctionName:e?.pageStateFunctionName??"setPageState",continuationPrompt:e?.continuationPrompt??I,maxDepth:e?.maxDepth??1,readinessTimeoutMs:e?.readinessTimeoutMs??4e3,settleMs:e?.settleMs??150,enabled:e?.enabled??!0}}function w(e,s){const a=typeof s=="function"?()=>p(s()):()=>p(s),t={navigated:!1,pausedTurnNavigated:!1,depth:0,runId:0,ourSendPending:!1},i=()=>e.getRegisteredFunctions().some(n=>n.name===a().pageStateFunctionName),g=n=>new Promise(o=>{let l=!1;const r=N=>{l||(l=!0,clearTimeout(S),e.off("context:changed",u),o(N))},v=()=>setTimeout(()=>r(n===t.runId&&i()),a().settleMs),u=()=>{if(n!==t.runId)return r(!1);i()&&(e.off("context:changed",u),v())},S=setTimeout(()=>r(!1),a().readinessTimeoutMs);i()?v():e.on("context:changed",u)}),P=async n=>{const o=++t.runId;if(!(!await g(o)||o!==t.runId)){t.depth+=1,t.ourSendPending=!0;try{await e.sendMessage(a().continuationPrompt,{conversationId:n,hidden:!0})}catch{t.ourSendPending=!1}}},d=n=>{a().navigationFunctions.includes(n.functionName)&&(t.navigated=!0)},T=e.registerResumeGate(async()=>{a().enabled&&t.pausedTurnNavigated&&(t.pausedTurnNavigated=!1,await g(++t.runId))}),f=()=>{t.pausedTurnNavigated=t.navigated,t.navigated=!1},c=()=>{t.ourSendPending||(t.depth=0,t.runId+=1)},h=n=>{t.ourSendPending=!1;const o=t.navigated;t.navigated=!1,a().enabled&&o&&(t.depth>=a().maxDepth||P(n.conversationId))},m=()=>{t.ourSendPending=!1};return e.on("function:invoke",d),e.on("message:start",c),e.on("message:waiting-client",f),e.on("message:complete",h),e.on("message:error",m),()=>{t.runId+=1,T(),e.off("function:invoke",d),e.off("message:start",c),e.off("message:waiting-client",f),e.off("message:complete",h),e.off("message:error",m)}}Object.defineProperty(exports,"attachAutoContinueAfterNavigation",{enumerable:!0,get:function(){return w}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function y(u={}){const{overrides:g={}}=u,a={id:"mock-msg-1",conversationId:"mock-conv-1",content:"Mock response",role:"assistant",status:"DONE",createdAt:new Date},l={id:"mock-conv-1",title:"Mock Conversation",lastMessageDate:new Date},n=new Map,c=[],m={sendMessage:async()=>a,continueMessage:async()=>a,stop:async()=>null,stopMessage:async()=>({status:"not_running"}),isGenerating:()=>!1,resumePendingClientFunctions:async()=>null,registerResumeGate:()=>()=>{},getConversations:async()=>[l],getConversation:async()=>l,getMessages:async()=>[a],submitToolCallForm:async()=>({status:"completed"}),confirmToolCall:async()=>{},rejectToolCall:async()=>{},getConfig:async()=>({permissions:[],proactive:{enabled:!1}}),createTicket:async()=>({id:"mock-ticket-1",url:"https://example.test/tickets/mock-ticket-1"}),submitFeedback:async()=>{},submitConversationFeedback:async()=>a.id,registerFunction:()=>{},unregisterFunction:()=>!0,getRegisteredFunctions:()=>[],executeClientFunction:async()=>{},getContextSnapshot:()=>null,notifyContextChanged:()=>{},setContext:()=>{},removeContext:()=>!0,addDynamicContext:()=>{},removeDynamicContext:()=>!0,registerNavigationFunction:()=>{},unregisterNavigationFunction:()=>{},getConfiguredAgent:()=>{},getUserIdentity:()=>({email:void 0,hasJwt:!1}),getHttp:()=>({get:async()=>({}),post:async()=>({})}),emitProactiveEvent:(e,t)=>{const o=n.get(e);o&&[...o].forEach(s=>s(t))},on:(e,t)=>{n.has(e)||n.set(e,new Set),n.get(e).add(t)},off:(e,t)=>{n.get(e)?.delete(t)},once:(e,t)=>{const o=(...s)=>{n.get(e)?.delete(o),t(...s)};n.has(e)||n.set(e,new Set),n.get(e).add(o)},waitFor:(e,t)=>new Promise((o,s)=>{let r;const d=f=>{r&&clearTimeout(r),n.get(e)?.delete(d),o(f)};n.has(e)||n.set(e,new Set),n.get(e).add(d),t?.timeout&&(r=setTimeout(()=>{n.get(e)?.delete(d),s(new Error(`waitFor("${e}") timed out after ${t.timeout}ms`))},t.timeout))}),updateConfig:()=>{},destroy:()=>{n.clear()},...g},i={};for(const[e,t]of Object.entries(m))i[e]=(...o)=>(c.push({method:e,args:o}),t(...o));return i.proactive=null,i.__calls=c,i.__callsFor=e=>c.filter(t=>t.method===e),i.__emitEvent=(e,t)=>{const o=n.get(e);o&&[...o].forEach(s=>s(t))},i}Object.defineProperty(exports,"createMockClient",{enumerable:!0,get:function(){return y}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var p=new WeakMap,M=["position","top","left","right","width"];function B(e,t){return t.map(r=>({style:e,prop:r,value:e.getPropertyValue(r),priority:e.getPropertyPriority(r)}))}function U(e){for(const{style:t,prop:r,value:n,priority:o}of e)n?t.setProperty(r,n,o):t.removeProperty(r)}function j(e,t=document){const r=p.get(t);if(r){r.owners.add(e);return}const n=t.body,o=t.documentElement,u=t.defaultView?.scrollY??0;p.set(t,{owners:new Set([e]),saved:[...B(n.style,M),...B(o.style,["overflow"])],scrollY:u}),n.style.position="fixed",n.style.top=`-${u}px`,n.style.left="0",n.style.right="0",n.style.width="100%",o.style.overflow="hidden"}function k(e,t=document){const r=p.get(t);!r||!r.owners.delete(e)||r.owners.size>0||(p.delete(t),U(r.saved),t.defaultView?.scrollTo(0,r.scrollY))}function L(e,t){const r=e.replace("#",""),n=Number.parseInt(r.substring(0,2),16),o=Number.parseInt(r.substring(2,4),16),u=Number.parseInt(r.substring(4,6),16),a=s=>Math.min(255,Math.round(s+(255-s)*(t/100))),c=s=>s.toString(16).padStart(2,"0");return`#${c(a(n))}${c(a(o))}${c(a(u))}`}function G(e){return/^#?[0-9A-F]{6}$/i.test(e)}function H(e,t,r){const n=(1-Math.abs(2*r-1))*t,o=(e%360+360)%360/60,u=o|0,a=n*(1-Math.abs(o%2-1)),[c,s,f]=[[n,a,0],[a,n,0],[0,n,a],[0,a,n],[a,0,n],[n,0,a]][u],b=r-n/2;return[Math.round((c+b)*255),Math.round((s+b)*255),Math.round((f+b)*255)]}function F(e){const t=e.trim(),r=/^hsla?\(\s*([\d.-]+)(?:deg)?[\s,]+([\d.]+)%[\s,]+([\d.]+)%/i.exec(t);if(r){const[a,c,s]=r.slice(1,4).map(Number);return[a,c,s].some(Number.isNaN)?null:H(a,Math.min(c,100)/100,Math.min(s,100)/100)}const n=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(t);if(n){const a=n.slice(1,4).map(Number);return a.some(c=>Number.isNaN(c)||c<0||c>255)?null:a}const o=t.replace("#",""),u=o.length===3?o.split("").map(a=>a+a).join(""):o;return/^[0-9a-f]{6}$/i.test(u)?[Number.parseInt(u.substring(0,2),16),Number.parseInt(u.substring(2,4),16),Number.parseInt(u.substring(4,6),16)]:null}function A(e){const t=F(e);if(!t)return null;const[r,n,o]=t.map(u=>{const a=u/255;return a<=.03928?a/12.92:((a+.055)/1.055)**2.4});return .2126*r+.7152*n+.0722*o}function I(e,t){const r=A(e),n=A(t);return r===null||n===null?null:(Math.max(r,n)+.05)/(Math.min(r,n)+.05)}var w=/(?:repeating-)?(?:linear|radial|conic)-gradient\(/i;function K(e){return!!e&&w.test(e)}function X(e){return e.match(/#[0-9a-f]{3,8}|(?:rgba?|hsla?)\([^()]*\)|\btransparent\b/gi)??[]}function $(e){const t=e.trim().toLowerCase();if(t==="transparent")return!0;const r=/\/\s*([\d.]+)%?\s*\)$/.exec(t);if(r)return Number.parseFloat(r[1])===0;const n=/^(?:rgba|hsla)\([^)]*,\s*([\d.]+)%?\s*\)$/.exec(t);if(n)return Number.parseFloat(n[1])===0;if(!t.startsWith("#"))return!1;const o=t.slice(1);return/^[0-9a-f]+$/.test(o)?o.length===8?o.slice(6)==="00":o.length===4?o[3]==="0":!1:!1}var d="#FFFFFF",W="#000000",Y="#FFFFFF";function D(e){if(!e)return d;const t=K(e)?X(e):[e],r=(t.some($)?[...t,Y]:t).map(n=>I(n,d)).filter(n=>n!==null);return r.length&&Math.min(...r)<3?W:d}var V='"IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',z=`var(--ago-font, ${V})`,x={font:"--ago-font",radius:"--ago-radius",messageRadius:"--ago-message-radius",brand:"--ago-brand-color",brandText:"--ago-brand-text-color",headerBg:"--ago-header-background",headerText:"--ago-header-text-color",panelBg:"--ago-panel-background",messagesBg:"--ago-messages-background",text:"--ago-text-color",mutedText:"--ago-muted-text-color",border:"--ago-border-color",accent:"--ago-accent-color",agentBubbleBg:"--ago-agent-bubble-background",agentBubbleText:"--ago-agent-bubble-text-color",userBubbleBg:"--ago-user-bubble-background",userBubbleText:"--ago-user-bubble-text-color",launcherBg:"--ago-launcher-background",launcherText:"--ago-launcher-text-color",sendBg:"--ago-send-button-background",panelWidth:"--ago-panel-width"},Q="var(--ago-brand-color, #03182f)",q="var(--ago-brand-text-color, #fff)",Z="var(--ago-header-background, var(--ago-brand-color, #03182f))",J="var(--ago-header-text-color, #e8f0fe)",ee="var(--ago-panel-background, #fff)",te="var(--ago-messages-background, #fbfbfb)",re="var(--ago-text-color, #30373e)",ne="var(--ago-muted-text-color, #6b6d6f)",ae="var(--ago-border-color, #dee3e8)",oe="var(--ago-accent-color, #1b5fc4)",ue="var(--ago-agent-bubble-background, #f1f3f5)",h="var(--ago-radius, 16px)",ie="var(--ago-message-radius, 16px)",ce="var(--ago-message-radius, 20px)",se="var(--ago-launcher-background, #007bff)",le="var(--ago-launcher-text-color, #fff)",fe="var(--ago-send-button-background, var(--ago-brand-color, #03182f))",be="var(--ago-user-bubble-background, #fff)",ge="var(--ago-user-bubble-text-color, #0a0a0a)",de="var(--ago-agent-bubble-text-color, var(--ago-text-color, #30373e))",pe="var(--ago-panel-background, #f8faff)",me="var(--ago-accent-color, #003edf)",Ee="#e3edff",Oe="#e5e5e5",he="var(--ago-border-color, #e4e4e7)",ye="var(--ago-muted-text-color, #71717a)",Re="var(--ago-panel-width, 550px)",_e="0 1px 2px 0 rgba(0,0,0,0.05)",ve="0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)",Be="0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)",Ae="rgba(15, 15, 15, 0.16) 0px 5px 40px 0px";function xe(e,t){if(t)for(const r of Object.keys(x)){const n=t[r];n!=null&&e.style.setProperty(x[r],n)}}function Te(e){if(!e)return{};const t={};return e.button&&(t.launcherBg=e.button,t.sendBg=e.button),e.header&&(t.headerBg=e.header,t.headerText=D(e.header)),e.agentMessage&&(t.agentBubbleBg=e.agentMessage),e.agentMessageFont&&(t.agentBubbleText=e.agentMessageFont),e.background&&(t.panelBg=e.background,t.messagesBg=e.background),e.font&&(t.text=e.font),e.userMessage&&(t.userBubbleBg=e.userMessage),e.userMessageFont&&(t.userBubbleText=e.userMessageFont),t}function S(e,t){Object.assign(e.style,t)}function De(e={}){const t=document.createElement("div");return S(t,e),t}var T="ago-chat-widget-keyframes";function Se(){if(typeof document>"u"||document.getElementById(T))return;const e=document.createElement("style");e.id=T,e.textContent="@keyframes ago-pulse { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }@keyframes ago-spin { to { transform: rotate(360deg); } }@keyframes ago-scale-in { 50% { transform: translateX(-10px) translateY(-5px) scale(1.1); } }@keyframes ago-appear { 0%, 98% { opacity: 0; } 100% { opacity: 1; } }@keyframes ago-skeleton-pulse { 50% { opacity: 0.5; } }.ago-chat-input--embed textarea::placeholder { font-style: italic; color: #9ca3af; opacity: 1; }",document.head.appendChild(e)}var Ne="2147483000";function Pe(e,t="0px"){return e===void 0?t:typeof e=="number"?`${e}px`:e}function N(e){return`(max-width: ${e}px), (max-height: 500px) and (orientation: landscape)`}function Ce(e={}){const t=e.breakpoint??768,r=e.peekHeight??152,n=Pe(e.bottomOffset),o=e.initialState??"peek",u=new Set;let a=o,c=!1;const s=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(N(t)):void 0;let f=m();const b=y(!1,o);function P(i,l){if(!i)return{style:{},attrs:{role:null,"aria-modal":null,"aria-label":null}};const v={position:"fixed",left:"0",right:"0",bottom:n,zIndex:Ne,display:"flex",flexDirection:"column",borderRadius:l==="full"?"0":`${h} ${h} 0 0`,paddingBottom:"env(safe-area-inset-bottom)"};return l==="full"?{style:{...v,top:"0",height:"auto",paddingTop:"env(safe-area-inset-top)"},attrs:{role:"dialog","aria-modal":"true",tabindex:"-1"}}:{style:{...v,top:"auto",minHeight:`calc(${r}px + env(safe-area-inset-bottom))`,height:"auto"},attrs:{role:null,"aria-modal":null,tabindex:"-1"}}}function y(i,l){return{compact:i,state:l,isModal:i&&l==="full",surface:P(i,l)}}function m(){return y(!!s?.matches,a)}function E(){f=m();for(const i of u)i()}function O(i,l){c||a===i||(a=i,E(),e.onStateChange?.(i,l))}function R(){if(!c){if(!s?.matches&&a!==o){a=o,E(),e.onStateChange?.(o,"breakpoint");return}E()}}let g=!1;function C(){g||!s||(s.addEventListener("change",R),g=!0,f=m())}function _(){!g||!s||(s.removeEventListener("change",R),g=!1)}return{subscribe(i){return u.add(i),u.size===1&&C(),()=>{u.delete(i),u.size===0&&_()}},getSnapshot:()=>f,getServerSnapshot:()=>b,expand:(i="api")=>O("full",i),collapse:(i="api")=>O("peek",i),toggle:(i="api")=>O(a==="full"?"peek":"full",i),destroy(){c||(c=!0,_(),u.clear())}}}Object.defineProperty(exports,"ACCENT_COLOR",{enumerable:!0,get:function(){return oe}});Object.defineProperty(exports,"AGENT_BUBBLE_BACKGROUND",{enumerable:!0,get:function(){return ue}});Object.defineProperty(exports,"AGENT_BUBBLE_TEXT",{enumerable:!0,get:function(){return de}});Object.defineProperty(exports,"BORDER_COLOR",{enumerable:!0,get:function(){return ae}});Object.defineProperty(exports,"BRAND_COLOR",{enumerable:!0,get:function(){return Q}});Object.defineProperty(exports,"BRAND_TEXT_COLOR",{enumerable:!0,get:function(){return q}});Object.defineProperty(exports,"EMBED_BACKGROUND",{enumerable:!0,get:function(){return pe}});Object.defineProperty(exports,"EMBED_BORDER",{enumerable:!0,get:function(){return he}});Object.defineProperty(exports,"EMBED_MUTED_TEXT",{enumerable:!0,get:function(){return ye}});Object.defineProperty(exports,"FONT_VAR",{enumerable:!0,get:function(){return z}});Object.defineProperty(exports,"HEADER_BACKGROUND",{enumerable:!0,get:function(){return Z}});Object.defineProperty(exports,"HEADER_TEXT_COLOR",{enumerable:!0,get:function(){return J}});Object.defineProperty(exports,"LAUNCHER_BACKGROUND",{enumerable:!0,get:function(){return se}});Object.defineProperty(exports,"LAUNCHER_TEXT_COLOR",{enumerable:!0,get:function(){return le}});Object.defineProperty(exports,"MESSAGES_BACKGROUND",{enumerable:!0,get:function(){return te}});Object.defineProperty(exports,"MESSAGE_RADIUS",{enumerable:!0,get:function(){return ie}});Object.defineProperty(exports,"MESSAGE_RADIUS_IMESSAGE",{enumerable:!0,get:function(){return ce}});Object.defineProperty(exports,"MUTED_TEXT_COLOR",{enumerable:!0,get:function(){return ne}});Object.defineProperty(exports,"NEUTRAL_BORDER",{enumerable:!0,get:function(){return Oe}});Object.defineProperty(exports,"PANEL_BACKGROUND",{enumerable:!0,get:function(){return ee}});Object.defineProperty(exports,"PANEL_SHADOW",{enumerable:!0,get:function(){return Ae}});Object.defineProperty(exports,"PANEL_WIDTH",{enumerable:!0,get:function(){return Re}});Object.defineProperty(exports,"PRIMARY_ACCENT",{enumerable:!0,get:function(){return me}});Object.defineProperty(exports,"PRIMARY_FOREGROUND",{enumerable:!0,get:function(){return Ee}});Object.defineProperty(exports,"RADIUS",{enumerable:!0,get:function(){return h}});Object.defineProperty(exports,"SEND_BACKGROUND",{enumerable:!0,get:function(){return fe}});Object.defineProperty(exports,"SHADOW",{enumerable:!0,get:function(){return ve}});Object.defineProperty(exports,"SHADOW_MD",{enumerable:!0,get:function(){return Be}});Object.defineProperty(exports,"SHADOW_SM",{enumerable:!0,get:function(){return _e}});Object.defineProperty(exports,"TEXT_COLOR",{enumerable:!0,get:function(){return re}});Object.defineProperty(exports,"USER_BUBBLE_BACKGROUND_EMBED",{enumerable:!0,get:function(){return be}});Object.defineProperty(exports,"USER_BUBBLE_TEXT_EMBED",{enumerable:!0,get:function(){return ge}});Object.defineProperty(exports,"applyTheme",{enumerable:!0,get:function(){return xe}});Object.defineProperty(exports,"colorsToTheme",{enumerable:!0,get:function(){return Te}});Object.defineProperty(exports,"compactMediaQuery",{enumerable:!0,get:function(){return N}});Object.defineProperty(exports,"createSheetController",{enumerable:!0,get:function(){return Ce}});Object.defineProperty(exports,"css",{enumerable:!0,get:function(){return S}});Object.defineProperty(exports,"div",{enumerable:!0,get:function(){return De}});Object.defineProperty(exports,"ensureKeyframes",{enumerable:!0,get:function(){return Se}});Object.defineProperty(exports,"isValidHexColor",{enumerable:!0,get:function(){return G}});Object.defineProperty(exports,"lightenColor",{enumerable:!0,get:function(){return L}});Object.defineProperty(exports,"lockBackgroundScroll",{enumerable:!0,get:function(){return j}});Object.defineProperty(exports,"readableTextColor",{enumerable:!0,get:function(){return D}});Object.defineProperty(exports,"unlockBackgroundScroll",{enumerable:!0,get:function(){return k}});
|
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
var p = /* @__PURE__ */ new WeakMap(), N = [
|
|
2
|
-
"position",
|
|
3
|
-
"top",
|
|
4
|
-
"left",
|
|
5
|
-
"right",
|
|
6
|
-
"width"
|
|
7
|
-
];
|
|
8
|
-
function T(e, a) {
|
|
9
|
-
return a.map((t) => ({
|
|
10
|
-
style: e,
|
|
11
|
-
prop: t,
|
|
12
|
-
value: e.getPropertyValue(t),
|
|
13
|
-
priority: e.getPropertyPriority(t)
|
|
14
|
-
}));
|
|
15
|
-
}
|
|
16
|
-
function k(e) {
|
|
17
|
-
for (const { style: a, prop: t, value: r, priority: o } of e) r ? a.setProperty(t, r, o) : a.removeProperty(t);
|
|
18
|
-
}
|
|
19
|
-
function V(e, a = document) {
|
|
20
|
-
const t = p.get(a);
|
|
21
|
-
if (t) {
|
|
22
|
-
t.owners.add(e);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const r = a.body, o = a.documentElement, s = a.defaultView?.scrollY ?? 0;
|
|
26
|
-
p.set(a, {
|
|
27
|
-
owners: /* @__PURE__ */ new Set([e]),
|
|
28
|
-
saved: [...T(r.style, N), ...T(o.style, ["overflow"])],
|
|
29
|
-
scrollY: s
|
|
30
|
-
}), r.style.position = "fixed", r.style.top = `-${s}px`, r.style.left = "0", r.style.right = "0", r.style.width = "100%", o.style.overflow = "hidden";
|
|
31
|
-
}
|
|
32
|
-
function z(e, a = document) {
|
|
33
|
-
const t = p.get(a);
|
|
34
|
-
!t || !t.owners.delete(e) || t.owners.size > 0 || (p.delete(a), k(t.saved), a.defaultView?.scrollTo(0, t.scrollY));
|
|
35
|
-
}
|
|
36
|
-
function j(e, a) {
|
|
37
|
-
const t = e.replace("#", ""), r = Number.parseInt(t.substring(0, 2), 16), o = Number.parseInt(t.substring(2, 4), 16), s = Number.parseInt(t.substring(4, 6), 16), n = (u) => Math.min(255, Math.round(u + (255 - u) * (a / 100))), l = (u) => u.toString(16).padStart(2, "0");
|
|
38
|
-
return `#${l(n(r))}${l(n(o))}${l(n(s))}`;
|
|
39
|
-
}
|
|
40
|
-
function q(e) {
|
|
41
|
-
return /^#?[0-9A-F]{6}$/i.test(e);
|
|
42
|
-
}
|
|
43
|
-
function O(e, a, t) {
|
|
44
|
-
const r = (1 - Math.abs(2 * t - 1)) * a, o = (e % 360 + 360) % 360 / 60, s = o | 0, n = r * (1 - Math.abs(o % 2 - 1)), [l, u, g] = [
|
|
45
|
-
[
|
|
46
|
-
r,
|
|
47
|
-
n,
|
|
48
|
-
0
|
|
49
|
-
],
|
|
50
|
-
[
|
|
51
|
-
n,
|
|
52
|
-
r,
|
|
53
|
-
0
|
|
54
|
-
],
|
|
55
|
-
[
|
|
56
|
-
0,
|
|
57
|
-
r,
|
|
58
|
-
n
|
|
59
|
-
],
|
|
60
|
-
[
|
|
61
|
-
0,
|
|
62
|
-
n,
|
|
63
|
-
r
|
|
64
|
-
],
|
|
65
|
-
[
|
|
66
|
-
n,
|
|
67
|
-
0,
|
|
68
|
-
r
|
|
69
|
-
],
|
|
70
|
-
[
|
|
71
|
-
r,
|
|
72
|
-
0,
|
|
73
|
-
n
|
|
74
|
-
]
|
|
75
|
-
][s], f = t - r / 2;
|
|
76
|
-
return [
|
|
77
|
-
Math.round((l + f) * 255),
|
|
78
|
-
Math.round((u + f) * 255),
|
|
79
|
-
Math.round((g + f) * 255)
|
|
80
|
-
];
|
|
81
|
-
}
|
|
82
|
-
function C(e) {
|
|
83
|
-
const a = e.trim(), t = /^hsla?\(\s*([\d.-]+)(?:deg)?[\s,]+([\d.]+)%[\s,]+([\d.]+)%/i.exec(a);
|
|
84
|
-
if (t) {
|
|
85
|
-
const [n, l, u] = t.slice(1, 4).map(Number);
|
|
86
|
-
return [
|
|
87
|
-
n,
|
|
88
|
-
l,
|
|
89
|
-
u
|
|
90
|
-
].some(Number.isNaN) ? null : O(n, Math.min(l, 100) / 100, Math.min(u, 100) / 100);
|
|
91
|
-
}
|
|
92
|
-
const r = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(a);
|
|
93
|
-
if (r) {
|
|
94
|
-
const n = r.slice(1, 4).map(Number);
|
|
95
|
-
return n.some((l) => Number.isNaN(l) || l < 0 || l > 255) ? null : n;
|
|
96
|
-
}
|
|
97
|
-
const o = a.replace("#", ""), s = o.length === 3 ? o.split("").map((n) => n + n).join("") : o;
|
|
98
|
-
return /^[0-9a-f]{6}$/i.test(s) ? [
|
|
99
|
-
Number.parseInt(s.substring(0, 2), 16),
|
|
100
|
-
Number.parseInt(s.substring(2, 4), 16),
|
|
101
|
-
Number.parseInt(s.substring(4, 6), 16)
|
|
102
|
-
] : null;
|
|
103
|
-
}
|
|
104
|
-
function _(e) {
|
|
105
|
-
const a = C(e);
|
|
106
|
-
if (!a) return null;
|
|
107
|
-
const [t, r, o] = a.map((s) => {
|
|
108
|
-
const n = s / 255;
|
|
109
|
-
return n <= 0.03928 ? n / 12.92 : ((n + 0.055) / 1.055) ** 2.4;
|
|
110
|
-
});
|
|
111
|
-
return 0.2126 * t + 0.7152 * r + 0.0722 * o;
|
|
112
|
-
}
|
|
113
|
-
function F(e, a) {
|
|
114
|
-
const t = _(e), r = _(a);
|
|
115
|
-
return t === null || r === null ? null : (Math.max(t, r) + 0.05) / (Math.min(t, r) + 0.05);
|
|
116
|
-
}
|
|
117
|
-
var L = /(?:repeating-)?(?:linear|radial|conic)-gradient\(/i;
|
|
118
|
-
function U(e) {
|
|
119
|
-
return !!e && L.test(e);
|
|
120
|
-
}
|
|
121
|
-
function w(e) {
|
|
122
|
-
return e.match(/#[0-9a-f]{3,8}|(?:rgba?|hsla?)\([^()]*\)|\btransparent\b/gi) ?? [];
|
|
123
|
-
}
|
|
124
|
-
function I(e) {
|
|
125
|
-
const a = e.trim().toLowerCase();
|
|
126
|
-
if (a === "transparent") return !0;
|
|
127
|
-
const t = /\/\s*([\d.]+)%?\s*\)$/.exec(a);
|
|
128
|
-
if (t) return Number.parseFloat(t[1]) === 0;
|
|
129
|
-
const r = /^(?:rgba|hsla)\([^)]*,\s*([\d.]+)%?\s*\)$/.exec(a);
|
|
130
|
-
if (r) return Number.parseFloat(r[1]) === 0;
|
|
131
|
-
if (!a.startsWith("#")) return !1;
|
|
132
|
-
const o = a.slice(1);
|
|
133
|
-
return /^[0-9a-f]+$/.test(o) ? o.length === 8 ? o.slice(6) === "00" : o.length === 4 ? o[3] === "0" : !1 : !1;
|
|
134
|
-
}
|
|
135
|
-
var b = "#FFFFFF", H = "#000000", G = "#FFFFFF";
|
|
136
|
-
function P(e) {
|
|
137
|
-
if (!e) return b;
|
|
138
|
-
const a = U(e) ? w(e) : [e], t = (a.some(I) ? [...a, G] : a).map((r) => F(r, b)).filter((r) => r !== null);
|
|
139
|
-
return t.length && Math.min(...t) < 3 ? H : b;
|
|
140
|
-
}
|
|
141
|
-
var $ = '"IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', Q = `var(--ago-font, ${$})`, y = {
|
|
142
|
-
font: "--ago-font",
|
|
143
|
-
radius: "--ago-radius",
|
|
144
|
-
messageRadius: "--ago-message-radius",
|
|
145
|
-
brand: "--ago-brand-color",
|
|
146
|
-
brandText: "--ago-brand-text-color",
|
|
147
|
-
headerBg: "--ago-header-background",
|
|
148
|
-
headerText: "--ago-header-text-color",
|
|
149
|
-
panelBg: "--ago-panel-background",
|
|
150
|
-
messagesBg: "--ago-messages-background",
|
|
151
|
-
text: "--ago-text-color",
|
|
152
|
-
mutedText: "--ago-muted-text-color",
|
|
153
|
-
border: "--ago-border-color",
|
|
154
|
-
accent: "--ago-accent-color",
|
|
155
|
-
agentBubbleBg: "--ago-agent-bubble-background",
|
|
156
|
-
agentBubbleText: "--ago-agent-bubble-text-color",
|
|
157
|
-
userBubbleBg: "--ago-user-bubble-background",
|
|
158
|
-
userBubbleText: "--ago-user-bubble-text-color",
|
|
159
|
-
launcherBg: "--ago-launcher-background",
|
|
160
|
-
launcherText: "--ago-launcher-text-color",
|
|
161
|
-
sendBg: "--ago-send-button-background",
|
|
162
|
-
panelWidth: "--ago-panel-width"
|
|
163
|
-
}, Z = "var(--ago-brand-color, #03182f)", J = "var(--ago-brand-text-color, #fff)", ee = "var(--ago-header-background, var(--ago-brand-color, #03182f))", ae = "var(--ago-header-text-color, #e8f0fe)", te = "var(--ago-panel-background, #fff)", re = "var(--ago-messages-background, #fbfbfb)", ne = "var(--ago-text-color, #30373e)", oe = "var(--ago-muted-text-color, #6b6d6f)", se = "var(--ago-border-color, #dee3e8)", ie = "var(--ago-accent-color, #1b5fc4)", le = "var(--ago-agent-bubble-background, #f1f3f5)", A = "var(--ago-radius, 16px)", ue = "var(--ago-message-radius, 16px)", ce = "var(--ago-message-radius, 20px)", ge = "var(--ago-launcher-background, #007bff)", fe = "var(--ago-launcher-text-color, #fff)", de = "var(--ago-send-button-background, var(--ago-brand-color, #03182f))", be = "var(--ago-user-bubble-background, #fff)", pe = "var(--ago-user-bubble-text-color, #0a0a0a)", he = "var(--ago-agent-bubble-text-color, var(--ago-text-color, #30373e))", me = "var(--ago-panel-background, #f8faff)", ve = "var(--ago-accent-color, #003edf)", xe = "#e3edff", Ee = "#e5e5e5", Be = "var(--ago-border-color, #e4e4e7)", Re = "var(--ago-muted-text-color, #71717a)", Te = "var(--ago-panel-width, 550px)", _e = "0 1px 2px 0 rgba(0,0,0,0.05)", ye = "0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)", Ae = "0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)", Me = "rgba(15, 15, 15, 0.16) 0px 5px 40px 0px";
|
|
164
|
-
function De(e, a) {
|
|
165
|
-
if (a)
|
|
166
|
-
for (const t of Object.keys(y)) {
|
|
167
|
-
const r = a[t];
|
|
168
|
-
r != null && e.style.setProperty(y[t], r);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
function Se(e) {
|
|
172
|
-
if (!e) return {};
|
|
173
|
-
const a = {};
|
|
174
|
-
return e.button && (a.launcherBg = e.button, a.sendBg = e.button), e.header && (a.headerBg = e.header, a.headerText = P(e.header)), e.agentMessage && (a.agentBubbleBg = e.agentMessage), e.agentMessageFont && (a.agentBubbleText = e.agentMessageFont), e.background && (a.panelBg = e.background, a.messagesBg = e.background), e.font && (a.text = e.font), e.userMessage && (a.userBubbleBg = e.userMessage), e.userMessageFont && (a.userBubbleText = e.userMessageFont), a;
|
|
175
|
-
}
|
|
176
|
-
function K(e, a) {
|
|
177
|
-
Object.assign(e.style, a);
|
|
178
|
-
}
|
|
179
|
-
function Ne(e = {}) {
|
|
180
|
-
const a = document.createElement("div");
|
|
181
|
-
return K(a, e), a;
|
|
182
|
-
}
|
|
183
|
-
var M = "ago-chat-widget-keyframes";
|
|
184
|
-
function ke() {
|
|
185
|
-
if (typeof document > "u" || document.getElementById(M)) return;
|
|
186
|
-
const e = document.createElement("style");
|
|
187
|
-
e.id = M, e.textContent = "@keyframes ago-pulse { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }@keyframes ago-spin { to { transform: rotate(360deg); } }@keyframes ago-scale-in { 50% { transform: translateX(-10px) translateY(-5px) scale(1.1); } }@keyframes ago-appear { 0%, 98% { opacity: 0; } 100% { opacity: 1; } }@keyframes ago-skeleton-pulse { 50% { opacity: 0.5; } }.ago-chat-input--embed textarea::placeholder { font-style: italic; color: #9ca3af; opacity: 1; }", document.head.appendChild(e);
|
|
188
|
-
}
|
|
189
|
-
var X = "2147483000";
|
|
190
|
-
function W(e, a = "0px") {
|
|
191
|
-
return e === void 0 ? a : typeof e == "number" ? `${e}px` : e;
|
|
192
|
-
}
|
|
193
|
-
function Y(e) {
|
|
194
|
-
return `(max-width: ${e}px), (max-height: 500px) and (orientation: landscape)`;
|
|
195
|
-
}
|
|
196
|
-
function Oe(e = {}) {
|
|
197
|
-
const a = e.breakpoint ?? 768, t = e.peekHeight ?? 152, r = W(e.bottomOffset), o = e.initialState ?? "peek", s = /* @__PURE__ */ new Set();
|
|
198
|
-
let n = o, l = !1;
|
|
199
|
-
const u = typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia(Y(a)) : void 0;
|
|
200
|
-
let g = h();
|
|
201
|
-
const f = x(!1, o);
|
|
202
|
-
function D(i, c) {
|
|
203
|
-
if (!i) return {
|
|
204
|
-
style: {},
|
|
205
|
-
attrs: {
|
|
206
|
-
role: null,
|
|
207
|
-
"aria-modal": null,
|
|
208
|
-
"aria-label": null
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
const R = {
|
|
212
|
-
position: "fixed",
|
|
213
|
-
left: "0",
|
|
214
|
-
right: "0",
|
|
215
|
-
bottom: r,
|
|
216
|
-
zIndex: X,
|
|
217
|
-
display: "flex",
|
|
218
|
-
flexDirection: "column",
|
|
219
|
-
borderRadius: c === "full" ? "0" : `${A} ${A} 0 0`,
|
|
220
|
-
paddingBottom: "env(safe-area-inset-bottom)"
|
|
221
|
-
};
|
|
222
|
-
return c === "full" ? {
|
|
223
|
-
style: {
|
|
224
|
-
...R,
|
|
225
|
-
top: "0",
|
|
226
|
-
height: "auto",
|
|
227
|
-
paddingTop: "env(safe-area-inset-top)"
|
|
228
|
-
},
|
|
229
|
-
attrs: {
|
|
230
|
-
role: "dialog",
|
|
231
|
-
"aria-modal": "true",
|
|
232
|
-
tabindex: "-1"
|
|
233
|
-
}
|
|
234
|
-
} : {
|
|
235
|
-
style: {
|
|
236
|
-
...R,
|
|
237
|
-
top: "auto",
|
|
238
|
-
minHeight: `calc(${t}px + env(safe-area-inset-bottom))`,
|
|
239
|
-
height: "auto"
|
|
240
|
-
},
|
|
241
|
-
attrs: {
|
|
242
|
-
role: null,
|
|
243
|
-
"aria-modal": null,
|
|
244
|
-
tabindex: "-1"
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
function x(i, c) {
|
|
249
|
-
return {
|
|
250
|
-
compact: i,
|
|
251
|
-
state: c,
|
|
252
|
-
isModal: i && c === "full",
|
|
253
|
-
surface: D(i, c)
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
function h() {
|
|
257
|
-
return x(!!u?.matches, n);
|
|
258
|
-
}
|
|
259
|
-
function m() {
|
|
260
|
-
g = h();
|
|
261
|
-
for (const i of s) i();
|
|
262
|
-
}
|
|
263
|
-
function v(i, c) {
|
|
264
|
-
l || n === i || (n = i, m(), e.onStateChange?.(i, c));
|
|
265
|
-
}
|
|
266
|
-
function E() {
|
|
267
|
-
if (!l) {
|
|
268
|
-
if (!u?.matches && n !== o) {
|
|
269
|
-
n = o, m(), e.onStateChange?.(o, "breakpoint");
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
m();
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
let d = !1;
|
|
276
|
-
function S() {
|
|
277
|
-
d || !u || (u.addEventListener("change", E), d = !0, g = h());
|
|
278
|
-
}
|
|
279
|
-
function B() {
|
|
280
|
-
!d || !u || (u.removeEventListener("change", E), d = !1);
|
|
281
|
-
}
|
|
282
|
-
return {
|
|
283
|
-
subscribe(i) {
|
|
284
|
-
return s.add(i), s.size === 1 && S(), () => {
|
|
285
|
-
s.delete(i), s.size === 0 && B();
|
|
286
|
-
};
|
|
287
|
-
},
|
|
288
|
-
getSnapshot: () => g,
|
|
289
|
-
getServerSnapshot: () => f,
|
|
290
|
-
expand: (i = "api") => v("full", i),
|
|
291
|
-
collapse: (i = "api") => v("peek", i),
|
|
292
|
-
toggle: (i = "api") => v(n === "full" ? "peek" : "full", i),
|
|
293
|
-
destroy() {
|
|
294
|
-
l || (l = !0, B(), s.clear());
|
|
295
|
-
}
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
export {
|
|
299
|
-
Ae as A,
|
|
300
|
-
q as B,
|
|
301
|
-
Me as C,
|
|
302
|
-
A as D,
|
|
303
|
-
xe as E,
|
|
304
|
-
De as F,
|
|
305
|
-
P as H,
|
|
306
|
-
Se as I,
|
|
307
|
-
K as L,
|
|
308
|
-
ne as M,
|
|
309
|
-
be as N,
|
|
310
|
-
de as O,
|
|
311
|
-
pe as P,
|
|
312
|
-
Ne as R,
|
|
313
|
-
te as S,
|
|
314
|
-
ve as T,
|
|
315
|
-
V as U,
|
|
316
|
-
j as V,
|
|
317
|
-
z as W,
|
|
318
|
-
re as _,
|
|
319
|
-
he as a,
|
|
320
|
-
oe as b,
|
|
321
|
-
J as c,
|
|
322
|
-
Re as d,
|
|
323
|
-
Q as f,
|
|
324
|
-
fe as g,
|
|
325
|
-
ge as h,
|
|
326
|
-
le as i,
|
|
327
|
-
_e as j,
|
|
328
|
-
ye as k,
|
|
329
|
-
me as l,
|
|
330
|
-
ae as m,
|
|
331
|
-
Oe as n,
|
|
332
|
-
se as o,
|
|
333
|
-
ee as p,
|
|
334
|
-
ie as r,
|
|
335
|
-
Z as s,
|
|
336
|
-
Y as t,
|
|
337
|
-
Be as u,
|
|
338
|
-
ue as v,
|
|
339
|
-
Te as w,
|
|
340
|
-
Ee as x,
|
|
341
|
-
ce as y,
|
|
342
|
-
ke as z
|
|
343
|
-
};
|