@useago/sdk 1.7.2 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +175 -0
  2. package/README.md +96 -1
  3. package/dist/angular.cjs +1 -1
  4. package/dist/angular.d.cts +402 -5
  5. package/dist/angular.d.ts +402 -5
  6. package/dist/angular.js +11 -7
  7. package/dist/{createConversationSession-DP90nY71.js → createConversationSession-B1Qn-y0I.js} +3 -3
  8. package/dist/createConversationSession-B3v_xOU7.cjs +1 -0
  9. package/dist/createFormCollector-FvwDOqnV.cjs +1 -0
  10. package/dist/{createFormCollector-BivHRIAe.js → createFormCollector-m79zk_NA.js} +1 -1
  11. package/dist/createMockClient-BEOXI8yW.cjs +1 -0
  12. package/dist/{createMockClient-BDLW6tVc.js → createMockClient-Beao82tu.js} +31 -18
  13. package/dist/devtools.cjs +61 -12
  14. package/dist/devtools.d.cts +403 -5
  15. package/dist/devtools.d.ts +403 -5
  16. package/dist/devtools.js +225 -73
  17. package/dist/errors-BLfjXnLB.js +32 -0
  18. package/dist/errors-o1IB5fEu.cjs +1 -0
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.d.cts +489 -7
  21. package/dist/index.d.ts +489 -7
  22. package/dist/index.js +124 -118
  23. package/dist/react.cjs +4 -4
  24. package/dist/react.d.cts +510 -3
  25. package/dist/react.d.ts +510 -3
  26. package/dist/react.js +1036 -752
  27. package/dist/sheetController-BThJRtOu.cjs +1 -0
  28. package/dist/sheetController-aEKXIvjk.js +343 -0
  29. package/dist/testing.cjs +1 -1
  30. package/dist/testing.d.cts +393 -3
  31. package/dist/testing.d.ts +393 -3
  32. package/dist/testing.js +1 -1
  33. package/dist/types-Ct1hlKwg.js +2408 -0
  34. package/dist/types-mcW8vB1U.cjs +10 -0
  35. package/dist/vue.cjs +1 -1
  36. package/dist/vue.d.cts +615 -3
  37. package/dist/vue.d.ts +615 -3
  38. package/dist/vue.js +202 -154
  39. package/dist/widget.cjs +6 -4
  40. package/dist/widget.d.cts +733 -5
  41. package/dist/widget.d.ts +733 -5
  42. package/dist/widget.js +3996 -786
  43. package/llms-full.txt +264 -31
  44. package/package.json +1 -1
  45. package/dist/AgoClient-7yXQ6R3O.cjs +0 -9
  46. package/dist/AgoClient-DTkBRGFE.js +0 -1965
  47. package/dist/createConversationSession-Bv6a15E0.cjs +0 -1
  48. package/dist/createFormCollector-CwfiYn0V.cjs +0 -1
  49. package/dist/createMockClient-BSNuN3ys.cjs +0 -1
  50. package/dist/sheetController-CBUVOroo.js +0 -205
  51. package/dist/sheetController-DY-sC13T.cjs +0 -1
@@ -1 +0,0 @@
1
- const d=require("./AgoClient-7yXQ6R3O.cjs");var f="ago_widget_id",g="ago_last_thread",y=7200*1e3;function v(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const r=Math.floor(Math.random()*16);return(e==="x"?r:r&3|8).toString(16)})}function _(e={}){const r=e.key??f,i=e.threadKey??g,u=e.ttlMs??y,l=e.storage??(typeof localStorage<"u"?localStorage:void 0);let n=e.widgetId??"";if(!n&&l)try{n=l.getItem(r)??""}catch{}if(n||(n=v()),l)try{l.setItem(r,n)}catch{}const o=d.createStore({value:null,lastMessageAt:null},{key:i,storage:l}),s=o.get();s.value!==null&&c(s.lastMessageAt)&&o.set({value:null,lastMessageAt:null});function c(t){return t===null?!0:Number.isFinite(u)?Date.now()-t>u:!1}return{widgetId:n,key:r,getLastActiveThread(){const{value:t,lastMessageAt:a}=o.get();return t===null||c(a)?null:t},setActiveThread(t,a){const x=a==null?null:a instanceof Date?a.getTime():a;o.set({value:t,lastMessageAt:x})},clear(){o.set({value:null,lastMessageAt:null})}}}Object.defineProperty(exports,"createConversationSession",{enumerable:!0,get:function(){return _}});
@@ -1 +0,0 @@
1
- const C=require("./AgoClient-7yXQ6R3O.cjs");var W=/^[a-zA-Z0-9_-]{1,40}$/,A=n=>n==null||n==="";function S(n,e){if("anyOf"in n)return n.anyOf.some(c=>S(c,e));if("allOf"in n)return n.allOf.every(c=>S(c,e));const l=e[n.property];if(A(l))return!1;if(Array.isArray(n.value))return n.value.some(c=>String(l)===String(c));if(!n.op)return String(l)===String(n.value);const i=Number(l),a=Number(n.value);if(Number.isNaN(i)||Number.isNaN(a))return!1;switch(n.op){case">=":return i>=a;case"<=":return i<=a;case">":return i>a;case"<":return i<a;default:return C.logger.warn(`Unknown requiredWhen op "${n.op}"; treating as not required.`),!1}}function h(n,e){const l=n.properties??{},i=new Set;for(const c of n.required??[]){const d=l[c]?.requiredWhen;(!d||S(d,e))&&i.add(c)}for(const[c,d]of Object.entries(l))d.requiredWhen&&S(d.requiredWhen,e)&&i.add(c);const a=[...i].filter(c=>A(e[c]));return{missing:a,complete:a.length===0}}function B(n){const e={};for(const[l,i]of Object.entries(n.properties??{}))e[l]={type:i.type,...i.description!=null&&{description:i.description},...i.enum&&{enum:i.enum},...i.default!==void 0&&{default:i.default}};return{type:"object",properties:e,required:[]}}function V(n){const{name:e,description:l,schema:i}=n;if(!W.test(e))throw new Error(`Invalid form collector name "${e}": must match ${W} (it becomes the update_/submit_ function names).`);const a=typeof n.submit=="string"?n.submit?{via:"client",url:n.submit}:!1:n.submit??!1;n.autoSubmit===!0&&!a&&C.logger.warn(`FormCollector "${e}": autoSubmit is ignored because no submit target is configured.`);const c=(n.autoSubmit??!0)&&!!a,d=i.properties??{},$=t=>{const r={};for(const[o,s]of Object.entries(t)){const u=d[o];if(u)if(s==null)r[o]=s;else if(u.type==="number"||u.type==="integer"){const f=typeof s=="number"?s:Number(s);r[o]=Number.isNaN(f)?s:f}else u.type==="boolean"?r[o]=typeof s=="boolean"?s:s==="true"?!0:s==="false"?!1:!!s:r[o]=s}return r},N=n.initialValues??{},m=C.createStore({values:N,submitted:!1}),w=t=>{const r=m.get(),o={...r,values:{...r.values,...t}};return m.set(o),o};let b=null;const k=(t,r)=>{b?.emitFormEvent("form:error",{name:e,values:t,error:r})};let p=null;const I=async()=>{const{values:t}=m.get(),{complete:r,missing:o}=h(i,t);if(!r)return{ok:!1,missing:o};if(!a)return{ok:!1,error:"No submit target configured for this form collector."};const s=t;try{let u;if(a.via==="client")if("handler"in a)u=await a.handler(s);else{const f=await fetch(a.url,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(s)});if(!f.ok){const j=`Submit failed: HTTP ${f.status}`;return k(s,j),{ok:!1,error:j}}u=await f.json().catch(()=>{})}else{if(!b)return{ok:!1,error:"Backend submit requires install(client) (or useFormCollector) first."};u=await b.submitFormCollector(e,s)}return m.set({...m.get(),submitted:!0,submitResult:u}),b?.emitFormEvent("form:submitted",{name:e,values:s,result:u}),{ok:!0,result:u}}catch(u){const f=u instanceof Error?u.message:"Submit failed";return C.logger.error(`FormCollector "${e}" submit failed:`,u),k(s,f),{ok:!1,error:f}}},F=()=>p||(p=(async()=>{try{return await I()}finally{p=null}})(),p),q=async()=>{if(!c||!a)return null;const{values:t,submitted:r}=m.get();return r||!h(i,t).complete?null:F()},O={name:`update_${e}`,description:`Fill or update fields of the "${e}" form. ${l} Pass any subset of fields; call it repeatedly to fill the form as the user provides information. Returns the current values and which required fields are still missing.`,parameters:B(i),handler:async t=>{const r=w($(t)),{missing:o}=h(i,r.values),s=await q();return s?s.ok?{ok:!0,values:r.values,missing:o,submitted:!0}:{ok:!0,values:r.values,missing:o,submitted:!1,submitError:s.error}:{ok:!0,values:r.values,missing:o}}},y=[O];a&&!c&&y.push({name:`submit_${e}`,description:`Submit the completed "${e}" form. Only call this once every required field is collected and the user has confirmed. If fields are missing it returns them instead of submitting.`,parameters:{type:"object",properties:{}},handler:()=>F()});const D="client__",_=a?`submit_${e}`:null,R=t=>{const r=t.functionName??t.toolName;if(r)return r.startsWith(D)?r.slice(8):r},x=t=>{let r={...N},o=!1;for(const s of t){const u=R(s);u===O.name?s.arguments&&(r={...r,...$(s.arguments)}):_&&u===_&&s.status?.toLowerCase()==="done"&&(o=!0)}m.set({values:r,submitted:o})},g=`form:${e}`,v=`${g}:definition`,P=()=>({name:`Form definition: ${e}`,description:`${l} Some fields are conditionally required; the requiredWhen field in the schema tells you when each becomes required. The form schema is the following: ${JSON.stringify(i)}.`,stable:!0}),T=()=>{const{values:t,submitted:r}=m.get(),{missing:o,complete:s}=h(i,t),u=a?c?" The form is submitted automatically as soon as every required field is filled, so there is no submit function to call.":` When nothing is missing and the user confirms, call submit_${e}.`:"",f=r?`The "${e}" form has been submitted.`:`You are currently collecting information from the user to fill the "${e}" form.`;return{name:`Form: ${e}`,description:`${f} The form's schema and field requirements are in the "${v}" client context. Call update_${e} with any fields the user provides; ask only for what is still missing.${u}`,data:{values:t,missing:o,complete:s,submitted:r}}},E=t=>{x((t.messages??[]).flatMap(r=>r.toolCalls??[]))};return{name:e,store:m,functions:y,contextKey:g,contextProvider:T,definitionContextKey:v,definitionContextProvider:P,install:t=>{b=t;for(const o of y)t.register(o);t.addDynamicContext(v,P),t.addDynamicContext(g,T);const r=m.subscribe(()=>t.notifyContextChanged());return t.on("conversation:loaded",E),()=>{r();for(const o of y)t.unregisterFunction(o.name);t.removeDynamicContext(g),t.removeDynamicContext(v),t.off("conversation:loaded",E),b===t&&(b=null)}},hydrate:x,submit:F,getValues:()=>m.get().values,setValues:t=>{w($(t)),q()},reset:()=>{m.set({values:N,submitted:!1})},getStatus:()=>h(i,m.get().values)}}async function L(n,e){const l=await n.getFormCollector(e.name);return V({name:l.name,description:e.description??l.description,schema:e.schema??l.schema,submit:e.submit??l.submit,initialValues:e.initialValues,autoSubmit:e.autoSubmit??l.autoSubmit})}Object.defineProperty(exports,"createFormCollector",{enumerable:!0,get:function(){return V}});Object.defineProperty(exports,"deriveFormStatus",{enumerable:!0,get:function(){return h}});Object.defineProperty(exports,"loadFormCollector",{enumerable:!0,get:function(){return L}});
@@ -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,r=[],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()=>{},submitFeedback:async()=>{},registerFunction:()=>{},unregisterFunction:()=>!0,getRegisteredFunctions:()=>[],executeClientFunction:async()=>{},getContextSnapshot:()=>null,notifyContextChanged:()=>{},setContext:()=>{},removeContext:()=>!0,addDynamicContext:()=>{},removeDynamicContext:()=>!0,registerNavigationFunction:()=>{},unregisterNavigationFunction:()=>{},getConfiguredAgent:()=>{},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 c;const d=f=>{c&&clearTimeout(c),n.get(e)?.delete(d),o(f)};n.has(e)||n.set(e,new Set),n.get(e).add(d),t?.timeout&&(c=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)=>(r.push({method:e,args:o}),t(...o));return i.proactive=null,i.__calls=r,i.__callsFor=e=>r.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,205 +0,0 @@
1
- var u = /* @__PURE__ */ new WeakMap(), A = [
2
- "position",
3
- "top",
4
- "left",
5
- "right",
6
- "width"
7
- ];
8
- function x(e, t) {
9
- return t.map((a) => ({
10
- style: e,
11
- prop: a,
12
- value: e.getPropertyValue(a),
13
- priority: e.getPropertyPriority(a)
14
- }));
15
- }
16
- function T(e) {
17
- for (const { style: t, prop: a, value: r, priority: n } of e) r ? t.setProperty(a, r, n) : t.removeProperty(a);
18
- }
19
- function N(e, t = document) {
20
- const a = u.get(t);
21
- if (a) {
22
- a.owners.add(e);
23
- return;
24
- }
25
- const r = t.body, n = t.documentElement, s = t.defaultView?.scrollY ?? 0;
26
- u.set(t, {
27
- owners: /* @__PURE__ */ new Set([e]),
28
- saved: [...x(r.style, A), ...x(n.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%", n.style.overflow = "hidden";
31
- }
32
- function P(e, t = document) {
33
- const a = u.get(t);
34
- !a || !a.owners.delete(e) || a.owners.size > 0 || (u.delete(t), T(a.saved), t.defaultView?.scrollTo(0, a.scrollY));
35
- }
36
- var w = '"IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', I = `var(--ago-font, ${w})`, S = {
37
- font: "--ago-font",
38
- radius: "--ago-radius",
39
- messageRadius: "--ago-message-radius",
40
- brand: "--ago-brand-color",
41
- brandText: "--ago-brand-text-color",
42
- headerBg: "--ago-header-background",
43
- headerText: "--ago-header-text-color",
44
- panelBg: "--ago-panel-background",
45
- messagesBg: "--ago-messages-background",
46
- text: "--ago-text-color",
47
- mutedText: "--ago-muted-text-color",
48
- border: "--ago-border-color",
49
- accent: "--ago-accent-color",
50
- agentBubbleBg: "--ago-agent-bubble-background"
51
- }, U = "var(--ago-brand-color, #03182f)", G = "var(--ago-brand-text-color, #fff)", H = "var(--ago-header-background, var(--ago-brand-color, #03182f))", K = "var(--ago-header-text-color, #e8f0fe)", $ = "var(--ago-panel-background, #fff)", F = "var(--ago-messages-background, #fbfbfb)", V = "var(--ago-text-color, #30373e)", X = "var(--ago-muted-text-color, #6b6d6f)", Y = "var(--ago-border-color, #dee3e8)", z = "var(--ago-accent-color, #1b5fc4)", j = "var(--ago-agent-bubble-background, #f1f3f5)", k = "var(--ago-radius, 16px)", q = "var(--ago-message-radius, 16px)", Q = "var(--ago-message-radius, 20px)";
52
- function W(e, t) {
53
- if (t)
54
- for (const a of Object.keys(S)) {
55
- const r = t[a];
56
- r != null && e.style.setProperty(S[a], r);
57
- }
58
- }
59
- function C(e, t) {
60
- Object.assign(e.style, t);
61
- }
62
- function Z(e = {}) {
63
- const t = document.createElement("div");
64
- return C(t, e), t;
65
- }
66
- var O = "ago-chat-widget-keyframes";
67
- function J() {
68
- if (typeof document > "u" || document.getElementById(O)) return;
69
- const e = document.createElement("style");
70
- e.id = O, 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); } }", document.head.appendChild(e);
71
- }
72
- var D = "2147483000";
73
- function M(e, t = "0px") {
74
- return e === void 0 ? t : typeof e == "number" ? `${e}px` : e;
75
- }
76
- function L(e) {
77
- return `(max-width: ${e}px), (max-height: 500px) and (orientation: landscape)`;
78
- }
79
- function ee(e = {}) {
80
- const t = e.breakpoint ?? 768, a = e.peekHeight ?? 152, r = M(e.bottomOffset), n = e.initialState ?? "peek", s = /* @__PURE__ */ new Set();
81
- let i = n, d = !1;
82
- const c = typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia(L(t)) : void 0;
83
- let g = p();
84
- const R = m(!1, n);
85
- function _(o, l) {
86
- if (!o) return {
87
- style: {},
88
- attrs: {
89
- role: null,
90
- "aria-modal": null,
91
- "aria-label": null
92
- }
93
- };
94
- const E = {
95
- position: "fixed",
96
- left: "0",
97
- right: "0",
98
- bottom: r,
99
- zIndex: D,
100
- display: "flex",
101
- flexDirection: "column",
102
- borderRadius: l === "full" ? "0" : `${k} ${k} 0 0`,
103
- paddingBottom: "env(safe-area-inset-bottom)"
104
- };
105
- return l === "full" ? {
106
- style: {
107
- ...E,
108
- top: "0",
109
- height: "auto",
110
- paddingTop: "env(safe-area-inset-top)"
111
- },
112
- attrs: {
113
- role: "dialog",
114
- "aria-modal": "true",
115
- tabindex: "-1"
116
- }
117
- } : {
118
- style: {
119
- ...E,
120
- top: "auto",
121
- minHeight: `calc(${a}px + env(safe-area-inset-bottom))`,
122
- height: "auto"
123
- },
124
- attrs: {
125
- role: null,
126
- "aria-modal": null,
127
- tabindex: "-1"
128
- }
129
- };
130
- }
131
- function m(o, l) {
132
- return {
133
- compact: o,
134
- state: l,
135
- isModal: o && l === "full",
136
- surface: _(o, l)
137
- };
138
- }
139
- function p() {
140
- return m(!!c?.matches, i);
141
- }
142
- function v() {
143
- g = p();
144
- for (const o of s) o();
145
- }
146
- function b(o, l) {
147
- d || i === o || (i = o, v(), e.onStateChange?.(o, l));
148
- }
149
- function y() {
150
- if (!d) {
151
- if (!c?.matches && i !== n) {
152
- i = n, v(), e.onStateChange?.(n, "breakpoint");
153
- return;
154
- }
155
- v();
156
- }
157
- }
158
- let f = !1;
159
- function B() {
160
- f || !c || (c.addEventListener("change", y), f = !0, g = p());
161
- }
162
- function h() {
163
- !f || !c || (c.removeEventListener("change", y), f = !1);
164
- }
165
- return {
166
- subscribe(o) {
167
- return s.add(o), s.size === 1 && B(), () => {
168
- s.delete(o), s.size === 0 && h();
169
- };
170
- },
171
- getSnapshot: () => g,
172
- getServerSnapshot: () => R,
173
- expand: (o = "api") => b("full", o),
174
- collapse: (o = "api") => b("peek", o),
175
- toggle: (o = "api") => b(i === "full" ? "peek" : "full", o),
176
- destroy() {
177
- d || (d = !0, h(), s.clear());
178
- }
179
- };
180
- }
181
- export {
182
- P as C,
183
- N as S,
184
- V as _,
185
- Y as a,
186
- Z as b,
187
- I as c,
188
- F as d,
189
- q as f,
190
- k as g,
191
- $ as h,
192
- j as i,
193
- H as l,
194
- X as m,
195
- ee as n,
196
- U as o,
197
- Q as p,
198
- z as r,
199
- G as s,
200
- L as t,
201
- K as u,
202
- W as v,
203
- J as x,
204
- C as y
205
- };
@@ -1 +0,0 @@
1
- var d=new WeakMap,D=["position","top","left","right","width"];function S(e,t){return t.map(r=>({style:e,prop:r,value:e.getPropertyValue(r),priority:e.getPropertyPriority(r)}))}function k(e){for(const{style:t,prop:r,value:o,priority:a}of e)o?t.setProperty(r,o,a):t.removeProperty(r)}function x(e,t=document){const r=d.get(t);if(r){r.owners.add(e);return}const o=t.body,a=t.documentElement,u=t.defaultView?.scrollY??0;d.set(t,{owners:new Set([e]),saved:[...S(o.style,D),...S(a.style,["overflow"])],scrollY:u}),o.style.position="fixed",o.style.top=`-${u}px`,o.style.left="0",o.style.right="0",o.style.width="100%",a.style.overflow="hidden"}function j(e,t=document){const r=d.get(t);!r||!r.owners.delete(e)||r.owners.size>0||(d.delete(t),k(r.saved),t.defaultView?.scrollTo(0,r.scrollY))}var L='"IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',N=`var(--ago-font, ${L})`,h={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"},M="var(--ago-brand-color, #03182f)",w="var(--ago-brand-text-color, #fff)",U="var(--ago-header-background, var(--ago-brand-color, #03182f))",G="var(--ago-header-text-color, #e8f0fe)",I="var(--ago-panel-background, #fff)",K="var(--ago-messages-background, #fbfbfb)",H="var(--ago-text-color, #30373e)",X="var(--ago-muted-text-color, #6b6d6f)",$="var(--ago-border-color, #dee3e8)",F="var(--ago-accent-color, #1b5fc4)",V="var(--ago-agent-bubble-background, #f1f3f5)",O="var(--ago-radius, 16px)",Y="var(--ago-message-radius, 16px)",z="var(--ago-message-radius, 20px)";function Q(e,t){if(t)for(const r of Object.keys(h)){const o=t[r];o!=null&&e.style.setProperty(h[r],o)}}function A(e,t){Object.assign(e.style,t)}function q(e={}){const t=document.createElement("div");return A(t,e),t}var _="ago-chat-widget-keyframes";function W(){if(typeof document>"u"||document.getElementById(_))return;const e=document.createElement("style");e.id=_,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); } }",document.head.appendChild(e)}var Z="2147483000";function J(e,t="0px"){return e===void 0?t:typeof e=="number"?`${e}px`:e}function P(e){return`(max-width: ${e}px), (max-height: 500px) and (orientation: landscape)`}function ee(e={}){const t=e.breakpoint??768,r=e.peekHeight??152,o=J(e.bottomOffset),a=e.initialState??"peek",u=new Set;let l=a,f=!1;const c=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(P(t)):void 0;let g=b();const B=y(!1,a);function T(n,i){if(!n)return{style:{},attrs:{role:null,"aria-modal":null,"aria-label":null}};const R={position:"fixed",left:"0",right:"0",bottom:o,zIndex:Z,display:"flex",flexDirection:"column",borderRadius:i==="full"?"0":`${O} ${O} 0 0`,paddingBottom:"env(safe-area-inset-bottom)"};return i==="full"?{style:{...R,top:"0",height:"auto",paddingTop:"env(safe-area-inset-top)"},attrs:{role:"dialog","aria-modal":"true",tabindex:"-1"}}:{style:{...R,top:"auto",minHeight:`calc(${r}px + env(safe-area-inset-bottom))`,height:"auto"},attrs:{role:null,"aria-modal":null,tabindex:"-1"}}}function y(n,i){return{compact:n,state:i,isModal:n&&i==="full",surface:T(n,i)}}function b(){return y(!!c?.matches,l)}function p(){g=b();for(const n of u)n()}function m(n,i){f||l===n||(l=n,p(),e.onStateChange?.(n,i))}function E(){if(!f){if(!c?.matches&&l!==a){l=a,p(),e.onStateChange?.(a,"breakpoint");return}p()}}let s=!1;function C(){s||!c||(c.addEventListener("change",E),s=!0,g=b())}function v(){!s||!c||(c.removeEventListener("change",E),s=!1)}return{subscribe(n){return u.add(n),u.size===1&&C(),()=>{u.delete(n),u.size===0&&v()}},getSnapshot:()=>g,getServerSnapshot:()=>B,expand:(n="api")=>m("full",n),collapse:(n="api")=>m("peek",n),toggle:(n="api")=>m(l==="full"?"peek":"full",n),destroy(){f||(f=!0,v(),u.clear())}}}Object.defineProperty(exports,"ACCENT_COLOR",{enumerable:!0,get:function(){return F}});Object.defineProperty(exports,"AGENT_BUBBLE_BACKGROUND",{enumerable:!0,get:function(){return V}});Object.defineProperty(exports,"BORDER_COLOR",{enumerable:!0,get:function(){return $}});Object.defineProperty(exports,"BRAND_COLOR",{enumerable:!0,get:function(){return M}});Object.defineProperty(exports,"BRAND_TEXT_COLOR",{enumerable:!0,get:function(){return w}});Object.defineProperty(exports,"FONT_VAR",{enumerable:!0,get:function(){return N}});Object.defineProperty(exports,"HEADER_BACKGROUND",{enumerable:!0,get:function(){return U}});Object.defineProperty(exports,"HEADER_TEXT_COLOR",{enumerable:!0,get:function(){return G}});Object.defineProperty(exports,"MESSAGES_BACKGROUND",{enumerable:!0,get:function(){return K}});Object.defineProperty(exports,"MESSAGE_RADIUS",{enumerable:!0,get:function(){return Y}});Object.defineProperty(exports,"MESSAGE_RADIUS_IMESSAGE",{enumerable:!0,get:function(){return z}});Object.defineProperty(exports,"MUTED_TEXT_COLOR",{enumerable:!0,get:function(){return X}});Object.defineProperty(exports,"PANEL_BACKGROUND",{enumerable:!0,get:function(){return I}});Object.defineProperty(exports,"RADIUS",{enumerable:!0,get:function(){return O}});Object.defineProperty(exports,"TEXT_COLOR",{enumerable:!0,get:function(){return H}});Object.defineProperty(exports,"applyTheme",{enumerable:!0,get:function(){return Q}});Object.defineProperty(exports,"compactMediaQuery",{enumerable:!0,get:function(){return P}});Object.defineProperty(exports,"createSheetController",{enumerable:!0,get:function(){return ee}});Object.defineProperty(exports,"css",{enumerable:!0,get:function(){return A}});Object.defineProperty(exports,"div",{enumerable:!0,get:function(){return q}});Object.defineProperty(exports,"ensureKeyframes",{enumerable:!0,get:function(){return W}});Object.defineProperty(exports,"lockBackgroundScroll",{enumerable:!0,get:function(){return x}});Object.defineProperty(exports,"unlockBackgroundScroll",{enumerable:!0,get:function(){return j}});